From aeaabf0f7814384273c1f4de2e51c0b34dd4d0a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Salazar?= <73718835+joshrs23@users.noreply.github.com> Date: Tue, 25 Nov 2025 12:56:28 -0500 Subject: [PATCH 1/3] new schema and crud of vendorRate --- .../connector/vendorRate/mutations.gql | 51 +++++++++++++++++ dataconnect/connector/vendorRate/queries.gql | 56 +++++++++++++++++++ dataconnect/schema/VendorRate.gql | 25 +++++++++ 3 files changed, 132 insertions(+) create mode 100644 dataconnect/connector/vendorRate/mutations.gql create mode 100644 dataconnect/connector/vendorRate/queries.gql create mode 100644 dataconnect/schema/VendorRate.gql diff --git a/dataconnect/connector/vendorRate/mutations.gql b/dataconnect/connector/vendorRate/mutations.gql new file mode 100644 index 00000000..b4f2092b --- /dev/null +++ b/dataconnect/connector/vendorRate/mutations.gql @@ -0,0 +1,51 @@ +mutation CreateVendorRate( + $vendorName: String!, + $category: VendorRateCategory!, + $roleName: String!, + $employeeWage: Float!, + $markupPercentage: Float, + $vendorFeePercentage: Float, + $clientRate: Float! +) @auth(level: USER) { + vendorRate_insert( + data: { + vendorName: $vendorName + category: $category + roleName: $roleName + employeeWage: $employeeWage + markupPercentage: $markupPercentage + vendorFeePercentage: $vendorFeePercentage + clientRate: $clientRate + } + ) +} + +mutation UpdateVendorRate( + $id: UUID!, + $vendorName: String, + $category: VendorRateCategory, + $roleName: String, + $employeeWage: Float, + $markupPercentage: Float, + $vendorFeePercentage: Float, + $clientRate: Float +) @auth(level: USER) { + vendorRate_update( + id: $id, + data: { + vendorName: $vendorName + category: $category + roleName: $roleName + employeeWage: $employeeWage + markupPercentage: $markupPercentage + vendorFeePercentage: $vendorFeePercentage + clientRate: $clientRate + } + ) +} + +mutation DeleteVendorRate( + $id: UUID! +) @auth(level: USER) { + vendorRate_delete(id: $id) +} diff --git a/dataconnect/connector/vendorRate/queries.gql b/dataconnect/connector/vendorRate/queries.gql new file mode 100644 index 00000000..4daa8054 --- /dev/null +++ b/dataconnect/connector/vendorRate/queries.gql @@ -0,0 +1,56 @@ +query listVendorRate @auth(level: USER) { + vendorRates { + id + vendorName + category + roleName + employeeWage + markupPercentage + vendorFeePercentage + clientRate + } +} + +query getVendorRateById( + $id: UUID! +) @auth(level: USER) { + vendorRate(id: $id) { + id + vendorName + category + roleName + employeeWage + markupPercentage + vendorFeePercentage + clientRate + createdDate + updatedDate + createdBy + } +} + +query filterVendorRates( + $vendorName: String, + $category: VendorRateCategory, + $roleName: String, + $minClientRate: Float, + $maxClientRate: Float +) @auth(level: USER) { + vendorRates( + where: { + vendorName: { eq: $vendorName } + category: { eq: $category } + roleName: { eq: $roleName } + clientRate: { gte: $minClientRate, lte: $maxClientRate } + } + ) { + id + vendorName + category + roleName + employeeWage + markupPercentage + vendorFeePercentage + clientRate + } +} diff --git a/dataconnect/schema/VendorRate.gql b/dataconnect/schema/VendorRate.gql new file mode 100644 index 00000000..3f1de48f --- /dev/null +++ b/dataconnect/schema/VendorRate.gql @@ -0,0 +1,25 @@ +enum VendorRateCategory { + KITCHEN_AND_CULINARY + CONCESSIONS + FACILITIES + BARTENDING + SECURITY + EVENT_STAFF + MANAGEMENT + TECHNICAL + OTHER +} + +type VendorRate @table(name: "vendor_rates") { + id: UUID! @default(expr: "uuidV4()") + vendorName: String! + category: VendorRateCategory! + roleName: String! + employeeWage: Float! + markupPercentage: Float + vendorFeePercentage: Float + clientRate: Float! + createdDate: Timestamp @default(expr: "request.time") + updatedDate: Timestamp @default(expr: "request.time") + createdBy: String @default(expr: "auth.uid") +} From 44d0b49a25a6cf794cbed08611dfc2b3baf3f922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Salazar?= <73718835+joshrs23@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:01:06 -0500 Subject: [PATCH 2/3] correction in the filter clientRate --- dataconnect/connector/vendorRate/queries.gql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dataconnect/connector/vendorRate/queries.gql b/dataconnect/connector/vendorRate/queries.gql index 4daa8054..2f1dcac2 100644 --- a/dataconnect/connector/vendorRate/queries.gql +++ b/dataconnect/connector/vendorRate/queries.gql @@ -41,7 +41,7 @@ query filterVendorRates( vendorName: { eq: $vendorName } category: { eq: $category } roleName: { eq: $roleName } - clientRate: { gte: $minClientRate, lte: $maxClientRate } + clientRate: { ge: $minClientRate, le: $maxClientRate } } ) { id From 503093571c99116ee0445e9ef450af571bc32d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Salazar?= <73718835+joshrs23@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:01:42 -0500 Subject: [PATCH 3/3] new schema for front of vendorRate --- .../dataconnect-generated/.guides/usage.md | 36 +- .../src/dataconnect-generated/README.md | 1201 +++++++++++++---- .../dataconnect-generated/esm/index.esm.js | 122 +- .../src/dataconnect-generated/index.cjs.js | 133 +- .../src/dataconnect-generated/index.d.ts | 228 +++- .../src/dataconnect-generated/react/README.md | 975 ++++++++++--- .../react/esm/index.esm.js | 72 +- .../dataconnect-generated/react/index.cjs.js | 72 +- .../dataconnect-generated/react/index.d.ts | 32 +- .../dataconnect-generated/.guides/usage.md | 36 +- .../src/dataconnect-generated/README.md | 1201 +++++++++++++---- .../dataconnect-generated/esm/index.esm.js | 122 +- .../src/dataconnect-generated/index.cjs.js | 133 +- .../src/dataconnect-generated/index.d.ts | 228 +++- .../src/dataconnect-generated/react/README.md | 975 ++++++++++--- .../react/esm/index.esm.js | 72 +- .../dataconnect-generated/react/index.cjs.js | 72 +- .../dataconnect-generated/react/index.d.ts | 32 +- 18 files changed, 4634 insertions(+), 1108 deletions(-) diff --git a/frontend-web/src/dataconnect-generated/.guides/usage.md b/frontend-web/src/dataconnect-generated/.guides/usage.md index d04f7413..98ae3760 100644 --- a/frontend-web/src/dataconnect-generated/.guides/usage.md +++ b/frontend-web/src/dataconnect-generated/.guides/usage.md @@ -12,13 +12,9 @@ For each operation, there is a wrapper hook that can be used to call the operati Here are all of the hooks that get generated: ```ts -import { useCreateStaff, useListStaff, useCreateVendor, useUpdateVendor, useDeleteVendor, useListVendor, useGetVendorById, useFilterVendors, useCreateEvent, useUpdateEvent } from '@dataconnect/generated/react'; +import { useCreateVendor, useUpdateVendor, useDeleteVendor, useListVendor, useGetVendorById, useFilterVendors, useCreateVendorRate, useUpdateVendorRate, useDeleteVendorRate, useListVendorRate } from '@dataconnect/generated/react'; // The types of these hooks are available in react/index.d.ts -const { data, isPending, isSuccess, isError, error } = useCreateStaff(createStaffVars); - -const { data, isPending, isSuccess, isError, error } = useListStaff(); - const { data, isPending, isSuccess, isError, error } = useCreateVendor(createVendorVars); const { data, isPending, isSuccess, isError, error } = useUpdateVendor(updateVendorVars); @@ -31,9 +27,13 @@ const { data, isPending, isSuccess, isError, error } = useGetVendorById(getVendo const { data, isPending, isSuccess, isError, error } = useFilterVendors(filterVendorsVars); -const { data, isPending, isSuccess, isError, error } = useCreateEvent(createEventVars); +const { data, isPending, isSuccess, isError, error } = useCreateVendorRate(createVendorRateVars); -const { data, isPending, isSuccess, isError, error } = useUpdateEvent(updateEventVars); +const { data, isPending, isSuccess, isError, error } = useUpdateVendorRate(updateVendorRateVars); + +const { data, isPending, isSuccess, isError, error } = useDeleteVendorRate(deleteVendorRateVars); + +const { data, isPending, isSuccess, isError, error } = useListVendorRate(); ``` @@ -72,15 +72,9 @@ If a user is not using a supported framework, they can use the generated SDK dir Here's an example of how to use it with the first 5 operations: ```js -import { createStaff, listStaff, createVendor, updateVendor, deleteVendor, listVendor, getVendorById, filterVendors, createEvent, updateEvent } from '@dataconnect/generated'; +import { createVendor, updateVendor, deleteVendor, listVendor, getVendorById, filterVendors, createVendorRate, updateVendorRate, deleteVendorRate, listVendorRate } from '@dataconnect/generated'; -// Operation CreateStaff: For variables, look at type CreateStaffVars in ../index.d.ts -const { data } = await CreateStaff(dataConnect, createStaffVars); - -// Operation listStaff: -const { data } = await ListStaff(dataConnect); - // Operation CreateVendor: For variables, look at type CreateVendorVars in ../index.d.ts const { data } = await CreateVendor(dataConnect, createVendorVars); @@ -99,11 +93,17 @@ const { data } = await GetVendorById(dataConnect, getVendorByIdVars); // Operation filterVendors: For variables, look at type FilterVendorsVars in ../index.d.ts const { data } = await FilterVendors(dataConnect, filterVendorsVars); -// Operation CreateEvent: For variables, look at type CreateEventVars in ../index.d.ts -const { data } = await CreateEvent(dataConnect, createEventVars); +// Operation CreateVendorRate: For variables, look at type CreateVendorRateVars in ../index.d.ts +const { data } = await CreateVendorRate(dataConnect, createVendorRateVars); -// Operation UpdateEvent: For variables, look at type UpdateEventVars in ../index.d.ts -const { data } = await UpdateEvent(dataConnect, updateEventVars); +// Operation UpdateVendorRate: For variables, look at type UpdateVendorRateVars in ../index.d.ts +const { data } = await UpdateVendorRate(dataConnect, updateVendorRateVars); + +// Operation DeleteVendorRate: For variables, look at type DeleteVendorRateVars in ../index.d.ts +const { data } = await DeleteVendorRate(dataConnect, deleteVendorRateVars); + +// Operation listVendorRate: +const { data } = await ListVendorRate(dataConnect); ``` \ No newline at end of file diff --git a/frontend-web/src/dataconnect-generated/README.md b/frontend-web/src/dataconnect-generated/README.md index 1cfab8f7..66a2306d 100644 --- a/frontend-web/src/dataconnect-generated/README.md +++ b/frontend-web/src/dataconnect-generated/README.md @@ -10,21 +10,27 @@ This README will guide you through the process of using the generated JavaScript - [**Accessing the connector**](#accessing-the-connector) - [*Connecting to the local Emulator*](#connecting-to-the-local-emulator) - [**Queries**](#queries) - - [*listStaff*](#liststaff) - [*listVendor*](#listvendor) - [*getVendorById*](#getvendorbyid) - [*filterVendors*](#filtervendors) + - [*listVendorRate*](#listvendorrate) + - [*getVendorRateById*](#getvendorratebyid) + - [*filterVendorRates*](#filtervendorrates) - [*listEvents*](#listevents) - [*getEventById*](#geteventbyid) - [*filterEvents*](#filterevents) + - [*listStaff*](#liststaff) - [**Mutations**](#mutations) - - [*CreateStaff*](#createstaff) - [*CreateVendor*](#createvendor) - [*UpdateVendor*](#updatevendor) - [*DeleteVendor*](#deletevendor) + - [*CreateVendorRate*](#createvendorrate) + - [*UpdateVendorRate*](#updatevendorrate) + - [*DeleteVendorRate*](#deletevendorrate) - [*CreateEvent*](#createevent) - [*UpdateEvent*](#updateevent) - [*DeleteEvent*](#deleteevent) + - [*CreateStaff*](#createstaff) # Accessing the connector A connector is a collection of Queries and Mutations. One SDK is generated for each connector - this SDK is generated for the connector `krow-connector`. You can find more information about connectors in the [Data Connect documentation](https://firebase.google.com/docs/data-connect#how-does). @@ -71,108 +77,6 @@ The following is true for both the action shortcut function and the `QueryRef` f Below are examples of how to use the `krow-connector` connector's generated functions to execute each query. You can also follow the examples from the [Data Connect documentation](https://firebase.google.com/docs/data-connect/web-sdk#using-queries). -## listStaff -You can execute the `listStaff` query using the following action shortcut function, or by calling `executeQuery()` after calling the following `QueryRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): -```typescript -listStaff(): QueryPromise; - -interface ListStaffRef { - ... - /* Allow users to create refs without passing in DataConnect */ - (): QueryRef; -} -export const listStaffRef: ListStaffRef; -``` -You can also pass in a `DataConnect` instance to the action shortcut function or `QueryRef` function. -```typescript -listStaff(dc: DataConnect): QueryPromise; - -interface ListStaffRef { - ... - (dc: DataConnect): QueryRef; -} -export const listStaffRef: ListStaffRef; -``` - -If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the listStaffRef: -```typescript -const name = listStaffRef.operationName; -console.log(name); -``` - -### Variables -The `listStaff` query has no variables. -### Return Type -Recall that executing the `listStaff` query returns a `QueryPromise` that resolves to an object with a `data` property. - -The `data` property is an object of type `ListStaffData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: -```typescript -export interface ListStaffData { - staffs: ({ - id: UUIDString; - employeeName: string; - vendorId?: UUIDString | null; - email?: string | null; - position?: string | null; - employmentType: EmploymentType; - rating?: number | null; - reliabilityScore?: number | null; - backgroundCheckStatus: BackgroundCheckStatus; - certifications?: string | null; - } & Staff_Key)[]; -} -``` -### Using `listStaff`'s action shortcut function - -```typescript -import { getDataConnect } from 'firebase/data-connect'; -import { connectorConfig, listStaff } from '@dataconnect/generated'; - - -// Call the `listStaff()` function to execute the query. -// You can use the `await` keyword to wait for the promise to resolve. -const { data } = await listStaff(); - -// You can also pass in a `DataConnect` instance to the action shortcut function. -const dataConnect = getDataConnect(connectorConfig); -const { data } = await listStaff(dataConnect); - -console.log(data.staffs); - -// Or, you can use the `Promise` API. -listStaff().then((response) => { - const data = response.data; - console.log(data.staffs); -}); -``` - -### Using `listStaff`'s `QueryRef` function - -```typescript -import { getDataConnect, executeQuery } from 'firebase/data-connect'; -import { connectorConfig, listStaffRef } from '@dataconnect/generated'; - - -// Call the `listStaffRef()` function to get a reference to the query. -const ref = listStaffRef(); - -// You can also pass in a `DataConnect` instance to the `QueryRef` function. -const dataConnect = getDataConnect(connectorConfig); -const ref = listStaffRef(dataConnect); - -// Call `executeQuery()` on the reference to execute the query. -// You can use the `await` keyword to wait for the promise to resolve. -const { data } = await executeQuery(ref); - -console.log(data.staffs); - -// Or, you can use the `Promise` API. -executeQuery(ref).then((response) => { - const data = response.data; - console.log(data.staffs); -}); -``` - ## listVendor You can execute the `listVendor` query using the following action shortcut function, or by calling `executeQuery()` after calling the following `QueryRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): ```typescript @@ -531,6 +435,361 @@ executeQuery(ref).then((response) => { }); ``` +## listVendorRate +You can execute the `listVendorRate` query using the following action shortcut function, or by calling `executeQuery()` after calling the following `QueryRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): +```typescript +listVendorRate(): QueryPromise; + +interface ListVendorRateRef { + ... + /* Allow users to create refs without passing in DataConnect */ + (): QueryRef; +} +export const listVendorRateRef: ListVendorRateRef; +``` +You can also pass in a `DataConnect` instance to the action shortcut function or `QueryRef` function. +```typescript +listVendorRate(dc: DataConnect): QueryPromise; + +interface ListVendorRateRef { + ... + (dc: DataConnect): QueryRef; +} +export const listVendorRateRef: ListVendorRateRef; +``` + +If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the listVendorRateRef: +```typescript +const name = listVendorRateRef.operationName; +console.log(name); +``` + +### Variables +The `listVendorRate` query has no variables. +### Return Type +Recall that executing the `listVendorRate` query returns a `QueryPromise` that resolves to an object with a `data` property. + +The `data` property is an object of type `ListVendorRateData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: +```typescript +export interface ListVendorRateData { + vendorRates: ({ + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + } & VendorRate_Key)[]; +} +``` +### Using `listVendorRate`'s action shortcut function + +```typescript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, listVendorRate } from '@dataconnect/generated'; + + +// Call the `listVendorRate()` function to execute the query. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await listVendorRate(); + +// You can also pass in a `DataConnect` instance to the action shortcut function. +const dataConnect = getDataConnect(connectorConfig); +const { data } = await listVendorRate(dataConnect); + +console.log(data.vendorRates); + +// Or, you can use the `Promise` API. +listVendorRate().then((response) => { + const data = response.data; + console.log(data.vendorRates); +}); +``` + +### Using `listVendorRate`'s `QueryRef` function + +```typescript +import { getDataConnect, executeQuery } from 'firebase/data-connect'; +import { connectorConfig, listVendorRateRef } from '@dataconnect/generated'; + + +// Call the `listVendorRateRef()` function to get a reference to the query. +const ref = listVendorRateRef(); + +// You can also pass in a `DataConnect` instance to the `QueryRef` function. +const dataConnect = getDataConnect(connectorConfig); +const ref = listVendorRateRef(dataConnect); + +// Call `executeQuery()` on the reference to execute the query. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await executeQuery(ref); + +console.log(data.vendorRates); + +// Or, you can use the `Promise` API. +executeQuery(ref).then((response) => { + const data = response.data; + console.log(data.vendorRates); +}); +``` + +## getVendorRateById +You can execute the `getVendorRateById` query using the following action shortcut function, or by calling `executeQuery()` after calling the following `QueryRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): +```typescript +getVendorRateById(vars: GetVendorRateByIdVariables): QueryPromise; + +interface GetVendorRateByIdRef { + ... + /* Allow users to create refs without passing in DataConnect */ + (vars: GetVendorRateByIdVariables): QueryRef; +} +export const getVendorRateByIdRef: GetVendorRateByIdRef; +``` +You can also pass in a `DataConnect` instance to the action shortcut function or `QueryRef` function. +```typescript +getVendorRateById(dc: DataConnect, vars: GetVendorRateByIdVariables): QueryPromise; + +interface GetVendorRateByIdRef { + ... + (dc: DataConnect, vars: GetVendorRateByIdVariables): QueryRef; +} +export const getVendorRateByIdRef: GetVendorRateByIdRef; +``` + +If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the getVendorRateByIdRef: +```typescript +const name = getVendorRateByIdRef.operationName; +console.log(name); +``` + +### Variables +The `getVendorRateById` query requires an argument of type `GetVendorRateByIdVariables`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: + +```typescript +export interface GetVendorRateByIdVariables { + id: UUIDString; +} +``` +### Return Type +Recall that executing the `getVendorRateById` query returns a `QueryPromise` that resolves to an object with a `data` property. + +The `data` property is an object of type `GetVendorRateByIdData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: +```typescript +export interface GetVendorRateByIdData { + vendorRate?: { + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + createdDate?: TimestampString | null; + updatedDate?: TimestampString | null; + createdBy?: string | null; + } & VendorRate_Key; +} +``` +### Using `getVendorRateById`'s action shortcut function + +```typescript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, getVendorRateById, GetVendorRateByIdVariables } from '@dataconnect/generated'; + +// The `getVendorRateById` query requires an argument of type `GetVendorRateByIdVariables`: +const getVendorRateByIdVars: GetVendorRateByIdVariables = { + id: ..., +}; + +// Call the `getVendorRateById()` function to execute the query. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await getVendorRateById(getVendorRateByIdVars); +// Variables can be defined inline as well. +const { data } = await getVendorRateById({ id: ..., }); + +// You can also pass in a `DataConnect` instance to the action shortcut function. +const dataConnect = getDataConnect(connectorConfig); +const { data } = await getVendorRateById(dataConnect, getVendorRateByIdVars); + +console.log(data.vendorRate); + +// Or, you can use the `Promise` API. +getVendorRateById(getVendorRateByIdVars).then((response) => { + const data = response.data; + console.log(data.vendorRate); +}); +``` + +### Using `getVendorRateById`'s `QueryRef` function + +```typescript +import { getDataConnect, executeQuery } from 'firebase/data-connect'; +import { connectorConfig, getVendorRateByIdRef, GetVendorRateByIdVariables } from '@dataconnect/generated'; + +// The `getVendorRateById` query requires an argument of type `GetVendorRateByIdVariables`: +const getVendorRateByIdVars: GetVendorRateByIdVariables = { + id: ..., +}; + +// Call the `getVendorRateByIdRef()` function to get a reference to the query. +const ref = getVendorRateByIdRef(getVendorRateByIdVars); +// Variables can be defined inline as well. +const ref = getVendorRateByIdRef({ id: ..., }); + +// You can also pass in a `DataConnect` instance to the `QueryRef` function. +const dataConnect = getDataConnect(connectorConfig); +const ref = getVendorRateByIdRef(dataConnect, getVendorRateByIdVars); + +// Call `executeQuery()` on the reference to execute the query. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await executeQuery(ref); + +console.log(data.vendorRate); + +// Or, you can use the `Promise` API. +executeQuery(ref).then((response) => { + const data = response.data; + console.log(data.vendorRate); +}); +``` + +## filterVendorRates +You can execute the `filterVendorRates` query using the following action shortcut function, or by calling `executeQuery()` after calling the following `QueryRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): +```typescript +filterVendorRates(vars?: FilterVendorRatesVariables): QueryPromise; + +interface FilterVendorRatesRef { + ... + /* Allow users to create refs without passing in DataConnect */ + (vars?: FilterVendorRatesVariables): QueryRef; +} +export const filterVendorRatesRef: FilterVendorRatesRef; +``` +You can also pass in a `DataConnect` instance to the action shortcut function or `QueryRef` function. +```typescript +filterVendorRates(dc: DataConnect, vars?: FilterVendorRatesVariables): QueryPromise; + +interface FilterVendorRatesRef { + ... + (dc: DataConnect, vars?: FilterVendorRatesVariables): QueryRef; +} +export const filterVendorRatesRef: FilterVendorRatesRef; +``` + +If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the filterVendorRatesRef: +```typescript +const name = filterVendorRatesRef.operationName; +console.log(name); +``` + +### Variables +The `filterVendorRates` query has an optional argument of type `FilterVendorRatesVariables`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: + +```typescript +export interface FilterVendorRatesVariables { + vendorName?: string | null; + category?: VendorRateCategory | null; + roleName?: string | null; + minClientRate?: number | null; + maxClientRate?: number | null; +} +``` +### Return Type +Recall that executing the `filterVendorRates` query returns a `QueryPromise` that resolves to an object with a `data` property. + +The `data` property is an object of type `FilterVendorRatesData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: +```typescript +export interface FilterVendorRatesData { + vendorRates: ({ + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + } & VendorRate_Key)[]; +} +``` +### Using `filterVendorRates`'s action shortcut function + +```typescript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, filterVendorRates, FilterVendorRatesVariables } from '@dataconnect/generated'; + +// The `filterVendorRates` query has an optional argument of type `FilterVendorRatesVariables`: +const filterVendorRatesVars: FilterVendorRatesVariables = { + vendorName: ..., // optional + category: ..., // optional + roleName: ..., // optional + minClientRate: ..., // optional + maxClientRate: ..., // optional +}; + +// Call the `filterVendorRates()` function to execute the query. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await filterVendorRates(filterVendorRatesVars); +// Variables can be defined inline as well. +const { data } = await filterVendorRates({ vendorName: ..., category: ..., roleName: ..., minClientRate: ..., maxClientRate: ..., }); +// Since all variables are optional for this query, you can omit the `FilterVendorRatesVariables` argument. +const { data } = await filterVendorRates(); + +// You can also pass in a `DataConnect` instance to the action shortcut function. +const dataConnect = getDataConnect(connectorConfig); +const { data } = await filterVendorRates(dataConnect, filterVendorRatesVars); + +console.log(data.vendorRates); + +// Or, you can use the `Promise` API. +filterVendorRates(filterVendorRatesVars).then((response) => { + const data = response.data; + console.log(data.vendorRates); +}); +``` + +### Using `filterVendorRates`'s `QueryRef` function + +```typescript +import { getDataConnect, executeQuery } from 'firebase/data-connect'; +import { connectorConfig, filterVendorRatesRef, FilterVendorRatesVariables } from '@dataconnect/generated'; + +// The `filterVendorRates` query has an optional argument of type `FilterVendorRatesVariables`: +const filterVendorRatesVars: FilterVendorRatesVariables = { + vendorName: ..., // optional + category: ..., // optional + roleName: ..., // optional + minClientRate: ..., // optional + maxClientRate: ..., // optional +}; + +// Call the `filterVendorRatesRef()` function to get a reference to the query. +const ref = filterVendorRatesRef(filterVendorRatesVars); +// Variables can be defined inline as well. +const ref = filterVendorRatesRef({ vendorName: ..., category: ..., roleName: ..., minClientRate: ..., maxClientRate: ..., }); +// Since all variables are optional for this query, you can omit the `FilterVendorRatesVariables` argument. +const ref = filterVendorRatesRef(); + +// You can also pass in a `DataConnect` instance to the `QueryRef` function. +const dataConnect = getDataConnect(connectorConfig); +const ref = filterVendorRatesRef(dataConnect, filterVendorRatesVars); + +// Call `executeQuery()` on the reference to execute the query. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await executeQuery(ref); + +console.log(data.vendorRates); + +// Or, you can use the `Promise` API. +executeQuery(ref).then((response) => { + const data = response.data; + console.log(data.vendorRates); +}); +``` + ## listEvents You can execute the `listEvents` query using the following action shortcut function, or by calling `executeQuery()` after calling the following `QueryRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): ```typescript @@ -985,6 +1244,108 @@ executeQuery(ref).then((response) => { }); ``` +## listStaff +You can execute the `listStaff` query using the following action shortcut function, or by calling `executeQuery()` after calling the following `QueryRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): +```typescript +listStaff(): QueryPromise; + +interface ListStaffRef { + ... + /* Allow users to create refs without passing in DataConnect */ + (): QueryRef; +} +export const listStaffRef: ListStaffRef; +``` +You can also pass in a `DataConnect` instance to the action shortcut function or `QueryRef` function. +```typescript +listStaff(dc: DataConnect): QueryPromise; + +interface ListStaffRef { + ... + (dc: DataConnect): QueryRef; +} +export const listStaffRef: ListStaffRef; +``` + +If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the listStaffRef: +```typescript +const name = listStaffRef.operationName; +console.log(name); +``` + +### Variables +The `listStaff` query has no variables. +### Return Type +Recall that executing the `listStaff` query returns a `QueryPromise` that resolves to an object with a `data` property. + +The `data` property is an object of type `ListStaffData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: +```typescript +export interface ListStaffData { + staffs: ({ + id: UUIDString; + employeeName: string; + vendorId?: UUIDString | null; + email?: string | null; + position?: string | null; + employmentType: EmploymentType; + rating?: number | null; + reliabilityScore?: number | null; + backgroundCheckStatus: BackgroundCheckStatus; + certifications?: string | null; + } & Staff_Key)[]; +} +``` +### Using `listStaff`'s action shortcut function + +```typescript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, listStaff } from '@dataconnect/generated'; + + +// Call the `listStaff()` function to execute the query. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await listStaff(); + +// You can also pass in a `DataConnect` instance to the action shortcut function. +const dataConnect = getDataConnect(connectorConfig); +const { data } = await listStaff(dataConnect); + +console.log(data.staffs); + +// Or, you can use the `Promise` API. +listStaff().then((response) => { + const data = response.data; + console.log(data.staffs); +}); +``` + +### Using `listStaff`'s `QueryRef` function + +```typescript +import { getDataConnect, executeQuery } from 'firebase/data-connect'; +import { connectorConfig, listStaffRef } from '@dataconnect/generated'; + + +// Call the `listStaffRef()` function to get a reference to the query. +const ref = listStaffRef(); + +// You can also pass in a `DataConnect` instance to the `QueryRef` function. +const dataConnect = getDataConnect(connectorConfig); +const ref = listStaffRef(dataConnect); + +// Call `executeQuery()` on the reference to execute the query. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await executeQuery(ref); + +console.log(data.staffs); + +// Or, you can use the `Promise` API. +executeQuery(ref).then((response) => { + const data = response.data; + console.log(data.staffs); +}); +``` + # Mutations There are two ways to execute a Data Connect Mutation using the generated Web SDK: @@ -1000,139 +1361,6 @@ The following is true for both the action shortcut function and the `MutationRef Below are examples of how to use the `krow-connector` connector's generated functions to execute each mutation. You can also follow the examples from the [Data Connect documentation](https://firebase.google.com/docs/data-connect/web-sdk#using-mutations). -## CreateStaff -You can execute the `CreateStaff` mutation using the following action shortcut function, or by calling `executeMutation()` after calling the following `MutationRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): -```typescript -createStaff(vars: CreateStaffVariables): MutationPromise; - -interface CreateStaffRef { - ... - /* Allow users to create refs without passing in DataConnect */ - (vars: CreateStaffVariables): MutationRef; -} -export const createStaffRef: CreateStaffRef; -``` -You can also pass in a `DataConnect` instance to the action shortcut function or `MutationRef` function. -```typescript -createStaff(dc: DataConnect, vars: CreateStaffVariables): MutationPromise; - -interface CreateStaffRef { - ... - (dc: DataConnect, vars: CreateStaffVariables): MutationRef; -} -export const createStaffRef: CreateStaffRef; -``` - -If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the createStaffRef: -```typescript -const name = createStaffRef.operationName; -console.log(name); -``` - -### Variables -The `CreateStaff` mutation requires an argument of type `CreateStaffVariables`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: - -```typescript -export interface CreateStaffVariables { - employeeName: string; - vendorId?: UUIDString | null; - email?: string | null; - position?: string | null; - employmentType: EmploymentType; - rating?: number | null; - reliabilityScore?: number | null; - backgroundCheckStatus: BackgroundCheckStatus; - certifications?: string | null; -} -``` -### Return Type -Recall that executing the `CreateStaff` mutation returns a `MutationPromise` that resolves to an object with a `data` property. - -The `data` property is an object of type `CreateStaffData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: -```typescript -export interface CreateStaffData { - staff_insert: Staff_Key; -} -``` -### Using `CreateStaff`'s action shortcut function - -```typescript -import { getDataConnect } from 'firebase/data-connect'; -import { connectorConfig, createStaff, CreateStaffVariables } from '@dataconnect/generated'; - -// The `CreateStaff` mutation requires an argument of type `CreateStaffVariables`: -const createStaffVars: CreateStaffVariables = { - employeeName: ..., - vendorId: ..., // optional - email: ..., // optional - position: ..., // optional - employmentType: ..., - rating: ..., // optional - reliabilityScore: ..., // optional - backgroundCheckStatus: ..., - certifications: ..., // optional -}; - -// Call the `createStaff()` function to execute the mutation. -// You can use the `await` keyword to wait for the promise to resolve. -const { data } = await createStaff(createStaffVars); -// Variables can be defined inline as well. -const { data } = await createStaff({ employeeName: ..., vendorId: ..., email: ..., position: ..., employmentType: ..., rating: ..., reliabilityScore: ..., backgroundCheckStatus: ..., certifications: ..., }); - -// You can also pass in a `DataConnect` instance to the action shortcut function. -const dataConnect = getDataConnect(connectorConfig); -const { data } = await createStaff(dataConnect, createStaffVars); - -console.log(data.staff_insert); - -// Or, you can use the `Promise` API. -createStaff(createStaffVars).then((response) => { - const data = response.data; - console.log(data.staff_insert); -}); -``` - -### Using `CreateStaff`'s `MutationRef` function - -```typescript -import { getDataConnect, executeMutation } from 'firebase/data-connect'; -import { connectorConfig, createStaffRef, CreateStaffVariables } from '@dataconnect/generated'; - -// The `CreateStaff` mutation requires an argument of type `CreateStaffVariables`: -const createStaffVars: CreateStaffVariables = { - employeeName: ..., - vendorId: ..., // optional - email: ..., // optional - position: ..., // optional - employmentType: ..., - rating: ..., // optional - reliabilityScore: ..., // optional - backgroundCheckStatus: ..., - certifications: ..., // optional -}; - -// Call the `createStaffRef()` function to get a reference to the mutation. -const ref = createStaffRef(createStaffVars); -// Variables can be defined inline as well. -const ref = createStaffRef({ employeeName: ..., vendorId: ..., email: ..., position: ..., employmentType: ..., rating: ..., reliabilityScore: ..., backgroundCheckStatus: ..., certifications: ..., }); - -// You can also pass in a `DataConnect` instance to the `MutationRef` function. -const dataConnect = getDataConnect(connectorConfig); -const ref = createStaffRef(dataConnect, createStaffVars); - -// Call `executeMutation()` on the reference to execute the mutation. -// You can use the `await` keyword to wait for the promise to resolve. -const { data } = await executeMutation(ref); - -console.log(data.staff_insert); - -// Or, you can use the `Promise` API. -executeMutation(ref).then((response) => { - const data = response.data; - console.log(data.staff_insert); -}); -``` - ## CreateVendor You can execute the `CreateVendor` mutation using the following action shortcut function, or by calling `executeMutation()` after calling the following `MutationRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): ```typescript @@ -1499,6 +1727,372 @@ executeMutation(ref).then((response) => { }); ``` +## CreateVendorRate +You can execute the `CreateVendorRate` mutation using the following action shortcut function, or by calling `executeMutation()` after calling the following `MutationRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): +```typescript +createVendorRate(vars: CreateVendorRateVariables): MutationPromise; + +interface CreateVendorRateRef { + ... + /* Allow users to create refs without passing in DataConnect */ + (vars: CreateVendorRateVariables): MutationRef; +} +export const createVendorRateRef: CreateVendorRateRef; +``` +You can also pass in a `DataConnect` instance to the action shortcut function or `MutationRef` function. +```typescript +createVendorRate(dc: DataConnect, vars: CreateVendorRateVariables): MutationPromise; + +interface CreateVendorRateRef { + ... + (dc: DataConnect, vars: CreateVendorRateVariables): MutationRef; +} +export const createVendorRateRef: CreateVendorRateRef; +``` + +If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the createVendorRateRef: +```typescript +const name = createVendorRateRef.operationName; +console.log(name); +``` + +### Variables +The `CreateVendorRate` mutation requires an argument of type `CreateVendorRateVariables`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: + +```typescript +export interface CreateVendorRateVariables { + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; +} +``` +### Return Type +Recall that executing the `CreateVendorRate` mutation returns a `MutationPromise` that resolves to an object with a `data` property. + +The `data` property is an object of type `CreateVendorRateData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: +```typescript +export interface CreateVendorRateData { + vendorRate_insert: VendorRate_Key; +} +``` +### Using `CreateVendorRate`'s action shortcut function + +```typescript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, createVendorRate, CreateVendorRateVariables } from '@dataconnect/generated'; + +// The `CreateVendorRate` mutation requires an argument of type `CreateVendorRateVariables`: +const createVendorRateVars: CreateVendorRateVariables = { + vendorName: ..., + category: ..., + roleName: ..., + employeeWage: ..., + markupPercentage: ..., // optional + vendorFeePercentage: ..., // optional + clientRate: ..., +}; + +// Call the `createVendorRate()` function to execute the mutation. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await createVendorRate(createVendorRateVars); +// Variables can be defined inline as well. +const { data } = await createVendorRate({ vendorName: ..., category: ..., roleName: ..., employeeWage: ..., markupPercentage: ..., vendorFeePercentage: ..., clientRate: ..., }); + +// You can also pass in a `DataConnect` instance to the action shortcut function. +const dataConnect = getDataConnect(connectorConfig); +const { data } = await createVendorRate(dataConnect, createVendorRateVars); + +console.log(data.vendorRate_insert); + +// Or, you can use the `Promise` API. +createVendorRate(createVendorRateVars).then((response) => { + const data = response.data; + console.log(data.vendorRate_insert); +}); +``` + +### Using `CreateVendorRate`'s `MutationRef` function + +```typescript +import { getDataConnect, executeMutation } from 'firebase/data-connect'; +import { connectorConfig, createVendorRateRef, CreateVendorRateVariables } from '@dataconnect/generated'; + +// The `CreateVendorRate` mutation requires an argument of type `CreateVendorRateVariables`: +const createVendorRateVars: CreateVendorRateVariables = { + vendorName: ..., + category: ..., + roleName: ..., + employeeWage: ..., + markupPercentage: ..., // optional + vendorFeePercentage: ..., // optional + clientRate: ..., +}; + +// Call the `createVendorRateRef()` function to get a reference to the mutation. +const ref = createVendorRateRef(createVendorRateVars); +// Variables can be defined inline as well. +const ref = createVendorRateRef({ vendorName: ..., category: ..., roleName: ..., employeeWage: ..., markupPercentage: ..., vendorFeePercentage: ..., clientRate: ..., }); + +// You can also pass in a `DataConnect` instance to the `MutationRef` function. +const dataConnect = getDataConnect(connectorConfig); +const ref = createVendorRateRef(dataConnect, createVendorRateVars); + +// Call `executeMutation()` on the reference to execute the mutation. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await executeMutation(ref); + +console.log(data.vendorRate_insert); + +// Or, you can use the `Promise` API. +executeMutation(ref).then((response) => { + const data = response.data; + console.log(data.vendorRate_insert); +}); +``` + +## UpdateVendorRate +You can execute the `UpdateVendorRate` mutation using the following action shortcut function, or by calling `executeMutation()` after calling the following `MutationRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): +```typescript +updateVendorRate(vars: UpdateVendorRateVariables): MutationPromise; + +interface UpdateVendorRateRef { + ... + /* Allow users to create refs without passing in DataConnect */ + (vars: UpdateVendorRateVariables): MutationRef; +} +export const updateVendorRateRef: UpdateVendorRateRef; +``` +You can also pass in a `DataConnect` instance to the action shortcut function or `MutationRef` function. +```typescript +updateVendorRate(dc: DataConnect, vars: UpdateVendorRateVariables): MutationPromise; + +interface UpdateVendorRateRef { + ... + (dc: DataConnect, vars: UpdateVendorRateVariables): MutationRef; +} +export const updateVendorRateRef: UpdateVendorRateRef; +``` + +If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the updateVendorRateRef: +```typescript +const name = updateVendorRateRef.operationName; +console.log(name); +``` + +### Variables +The `UpdateVendorRate` mutation requires an argument of type `UpdateVendorRateVariables`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: + +```typescript +export interface UpdateVendorRateVariables { + id: UUIDString; + vendorName?: string | null; + category?: VendorRateCategory | null; + roleName?: string | null; + employeeWage?: number | null; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate?: number | null; +} +``` +### Return Type +Recall that executing the `UpdateVendorRate` mutation returns a `MutationPromise` that resolves to an object with a `data` property. + +The `data` property is an object of type `UpdateVendorRateData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: +```typescript +export interface UpdateVendorRateData { + vendorRate_update?: VendorRate_Key | null; +} +``` +### Using `UpdateVendorRate`'s action shortcut function + +```typescript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, updateVendorRate, UpdateVendorRateVariables } from '@dataconnect/generated'; + +// The `UpdateVendorRate` mutation requires an argument of type `UpdateVendorRateVariables`: +const updateVendorRateVars: UpdateVendorRateVariables = { + id: ..., + vendorName: ..., // optional + category: ..., // optional + roleName: ..., // optional + employeeWage: ..., // optional + markupPercentage: ..., // optional + vendorFeePercentage: ..., // optional + clientRate: ..., // optional +}; + +// Call the `updateVendorRate()` function to execute the mutation. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await updateVendorRate(updateVendorRateVars); +// Variables can be defined inline as well. +const { data } = await updateVendorRate({ id: ..., vendorName: ..., category: ..., roleName: ..., employeeWage: ..., markupPercentage: ..., vendorFeePercentage: ..., clientRate: ..., }); + +// You can also pass in a `DataConnect` instance to the action shortcut function. +const dataConnect = getDataConnect(connectorConfig); +const { data } = await updateVendorRate(dataConnect, updateVendorRateVars); + +console.log(data.vendorRate_update); + +// Or, you can use the `Promise` API. +updateVendorRate(updateVendorRateVars).then((response) => { + const data = response.data; + console.log(data.vendorRate_update); +}); +``` + +### Using `UpdateVendorRate`'s `MutationRef` function + +```typescript +import { getDataConnect, executeMutation } from 'firebase/data-connect'; +import { connectorConfig, updateVendorRateRef, UpdateVendorRateVariables } from '@dataconnect/generated'; + +// The `UpdateVendorRate` mutation requires an argument of type `UpdateVendorRateVariables`: +const updateVendorRateVars: UpdateVendorRateVariables = { + id: ..., + vendorName: ..., // optional + category: ..., // optional + roleName: ..., // optional + employeeWage: ..., // optional + markupPercentage: ..., // optional + vendorFeePercentage: ..., // optional + clientRate: ..., // optional +}; + +// Call the `updateVendorRateRef()` function to get a reference to the mutation. +const ref = updateVendorRateRef(updateVendorRateVars); +// Variables can be defined inline as well. +const ref = updateVendorRateRef({ id: ..., vendorName: ..., category: ..., roleName: ..., employeeWage: ..., markupPercentage: ..., vendorFeePercentage: ..., clientRate: ..., }); + +// You can also pass in a `DataConnect` instance to the `MutationRef` function. +const dataConnect = getDataConnect(connectorConfig); +const ref = updateVendorRateRef(dataConnect, updateVendorRateVars); + +// Call `executeMutation()` on the reference to execute the mutation. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await executeMutation(ref); + +console.log(data.vendorRate_update); + +// Or, you can use the `Promise` API. +executeMutation(ref).then((response) => { + const data = response.data; + console.log(data.vendorRate_update); +}); +``` + +## DeleteVendorRate +You can execute the `DeleteVendorRate` mutation using the following action shortcut function, or by calling `executeMutation()` after calling the following `MutationRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): +```typescript +deleteVendorRate(vars: DeleteVendorRateVariables): MutationPromise; + +interface DeleteVendorRateRef { + ... + /* Allow users to create refs without passing in DataConnect */ + (vars: DeleteVendorRateVariables): MutationRef; +} +export const deleteVendorRateRef: DeleteVendorRateRef; +``` +You can also pass in a `DataConnect` instance to the action shortcut function or `MutationRef` function. +```typescript +deleteVendorRate(dc: DataConnect, vars: DeleteVendorRateVariables): MutationPromise; + +interface DeleteVendorRateRef { + ... + (dc: DataConnect, vars: DeleteVendorRateVariables): MutationRef; +} +export const deleteVendorRateRef: DeleteVendorRateRef; +``` + +If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the deleteVendorRateRef: +```typescript +const name = deleteVendorRateRef.operationName; +console.log(name); +``` + +### Variables +The `DeleteVendorRate` mutation requires an argument of type `DeleteVendorRateVariables`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: + +```typescript +export interface DeleteVendorRateVariables { + id: UUIDString; +} +``` +### Return Type +Recall that executing the `DeleteVendorRate` mutation returns a `MutationPromise` that resolves to an object with a `data` property. + +The `data` property is an object of type `DeleteVendorRateData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: +```typescript +export interface DeleteVendorRateData { + vendorRate_delete?: VendorRate_Key | null; +} +``` +### Using `DeleteVendorRate`'s action shortcut function + +```typescript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, deleteVendorRate, DeleteVendorRateVariables } from '@dataconnect/generated'; + +// The `DeleteVendorRate` mutation requires an argument of type `DeleteVendorRateVariables`: +const deleteVendorRateVars: DeleteVendorRateVariables = { + id: ..., +}; + +// Call the `deleteVendorRate()` function to execute the mutation. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await deleteVendorRate(deleteVendorRateVars); +// Variables can be defined inline as well. +const { data } = await deleteVendorRate({ id: ..., }); + +// You can also pass in a `DataConnect` instance to the action shortcut function. +const dataConnect = getDataConnect(connectorConfig); +const { data } = await deleteVendorRate(dataConnect, deleteVendorRateVars); + +console.log(data.vendorRate_delete); + +// Or, you can use the `Promise` API. +deleteVendorRate(deleteVendorRateVars).then((response) => { + const data = response.data; + console.log(data.vendorRate_delete); +}); +``` + +### Using `DeleteVendorRate`'s `MutationRef` function + +```typescript +import { getDataConnect, executeMutation } from 'firebase/data-connect'; +import { connectorConfig, deleteVendorRateRef, DeleteVendorRateVariables } from '@dataconnect/generated'; + +// The `DeleteVendorRate` mutation requires an argument of type `DeleteVendorRateVariables`: +const deleteVendorRateVars: DeleteVendorRateVariables = { + id: ..., +}; + +// Call the `deleteVendorRateRef()` function to get a reference to the mutation. +const ref = deleteVendorRateRef(deleteVendorRateVars); +// Variables can be defined inline as well. +const ref = deleteVendorRateRef({ id: ..., }); + +// You can also pass in a `DataConnect` instance to the `MutationRef` function. +const dataConnect = getDataConnect(connectorConfig); +const ref = deleteVendorRateRef(dataConnect, deleteVendorRateVars); + +// Call `executeMutation()` on the reference to execute the mutation. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await executeMutation(ref); + +console.log(data.vendorRate_delete); + +// Or, you can use the `Promise` API. +executeMutation(ref).then((response) => { + const data = response.data; + console.log(data.vendorRate_delete); +}); +``` + ## CreateEvent You can execute the `CreateEvent` mutation using the following action shortcut function, or by calling `executeMutation()` after calling the following `MutationRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): ```typescript @@ -2027,3 +2621,136 @@ executeMutation(ref).then((response) => { }); ``` +## CreateStaff +You can execute the `CreateStaff` mutation using the following action shortcut function, or by calling `executeMutation()` after calling the following `MutationRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): +```typescript +createStaff(vars: CreateStaffVariables): MutationPromise; + +interface CreateStaffRef { + ... + /* Allow users to create refs without passing in DataConnect */ + (vars: CreateStaffVariables): MutationRef; +} +export const createStaffRef: CreateStaffRef; +``` +You can also pass in a `DataConnect` instance to the action shortcut function or `MutationRef` function. +```typescript +createStaff(dc: DataConnect, vars: CreateStaffVariables): MutationPromise; + +interface CreateStaffRef { + ... + (dc: DataConnect, vars: CreateStaffVariables): MutationRef; +} +export const createStaffRef: CreateStaffRef; +``` + +If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the createStaffRef: +```typescript +const name = createStaffRef.operationName; +console.log(name); +``` + +### Variables +The `CreateStaff` mutation requires an argument of type `CreateStaffVariables`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: + +```typescript +export interface CreateStaffVariables { + employeeName: string; + vendorId?: UUIDString | null; + email?: string | null; + position?: string | null; + employmentType: EmploymentType; + rating?: number | null; + reliabilityScore?: number | null; + backgroundCheckStatus: BackgroundCheckStatus; + certifications?: string | null; +} +``` +### Return Type +Recall that executing the `CreateStaff` mutation returns a `MutationPromise` that resolves to an object with a `data` property. + +The `data` property is an object of type `CreateStaffData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: +```typescript +export interface CreateStaffData { + staff_insert: Staff_Key; +} +``` +### Using `CreateStaff`'s action shortcut function + +```typescript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, createStaff, CreateStaffVariables } from '@dataconnect/generated'; + +// The `CreateStaff` mutation requires an argument of type `CreateStaffVariables`: +const createStaffVars: CreateStaffVariables = { + employeeName: ..., + vendorId: ..., // optional + email: ..., // optional + position: ..., // optional + employmentType: ..., + rating: ..., // optional + reliabilityScore: ..., // optional + backgroundCheckStatus: ..., + certifications: ..., // optional +}; + +// Call the `createStaff()` function to execute the mutation. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await createStaff(createStaffVars); +// Variables can be defined inline as well. +const { data } = await createStaff({ employeeName: ..., vendorId: ..., email: ..., position: ..., employmentType: ..., rating: ..., reliabilityScore: ..., backgroundCheckStatus: ..., certifications: ..., }); + +// You can also pass in a `DataConnect` instance to the action shortcut function. +const dataConnect = getDataConnect(connectorConfig); +const { data } = await createStaff(dataConnect, createStaffVars); + +console.log(data.staff_insert); + +// Or, you can use the `Promise` API. +createStaff(createStaffVars).then((response) => { + const data = response.data; + console.log(data.staff_insert); +}); +``` + +### Using `CreateStaff`'s `MutationRef` function + +```typescript +import { getDataConnect, executeMutation } from 'firebase/data-connect'; +import { connectorConfig, createStaffRef, CreateStaffVariables } from '@dataconnect/generated'; + +// The `CreateStaff` mutation requires an argument of type `CreateStaffVariables`: +const createStaffVars: CreateStaffVariables = { + employeeName: ..., + vendorId: ..., // optional + email: ..., // optional + position: ..., // optional + employmentType: ..., + rating: ..., // optional + reliabilityScore: ..., // optional + backgroundCheckStatus: ..., + certifications: ..., // optional +}; + +// Call the `createStaffRef()` function to get a reference to the mutation. +const ref = createStaffRef(createStaffVars); +// Variables can be defined inline as well. +const ref = createStaffRef({ employeeName: ..., vendorId: ..., email: ..., position: ..., employmentType: ..., rating: ..., reliabilityScore: ..., backgroundCheckStatus: ..., certifications: ..., }); + +// You can also pass in a `DataConnect` instance to the `MutationRef` function. +const dataConnect = getDataConnect(connectorConfig); +const ref = createStaffRef(dataConnect, createStaffVars); + +// Call `executeMutation()` on the reference to execute the mutation. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await executeMutation(ref); + +console.log(data.staff_insert); + +// Or, you can use the `Promise` API. +executeMutation(ref).then((response) => { + const data = response.data; + console.log(data.staff_insert); +}); +``` + diff --git a/frontend-web/src/dataconnect-generated/esm/index.esm.js b/frontend-web/src/dataconnect-generated/esm/index.esm.js index 3973bccc..e8f12f67 100644 --- a/frontend-web/src/dataconnect-generated/esm/index.esm.js +++ b/frontend-web/src/dataconnect-generated/esm/index.esm.js @@ -51,6 +51,18 @@ export const VendorPlatformType = { TRADITIONAL: "TRADITIONAL", } +export const VendorRateCategory = { + KITCHEN_AND_CULINARY: "KITCHEN_AND_CULINARY", + CONCESSIONS: "CONCESSIONS", + FACILITIES: "FACILITIES", + BARTENDING: "BARTENDING", + SECURITY: "SECURITY", + EVENT_STAFF: "EVENT_STAFF", + MANAGEMENT: "MANAGEMENT", + TECHNICAL: "TECHNICAL", + OTHER: "OTHER", +} + export const VendorRegion = { NATIONAL: "NATIONAL", BAY_AREA: "BAY_AREA", @@ -68,28 +80,6 @@ export const connectorConfig = { location: 'us-central1' }; -export const createStaffRef = (dcOrVars, vars) => { - const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); - dcInstance._useGeneratedSdk(); - return mutationRef(dcInstance, 'CreateStaff', inputVars); -} -createStaffRef.operationName = 'CreateStaff'; - -export function createStaff(dcOrVars, vars) { - return executeMutation(createStaffRef(dcOrVars, vars)); -} - -export const listStaffRef = (dc) => { - const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined); - dcInstance._useGeneratedSdk(); - return queryRef(dcInstance, 'listStaff'); -} -listStaffRef.operationName = 'listStaff'; - -export function listStaff(dc) { - return executeQuery(listStaffRef(dc)); -} - export const createVendorRef = (dcOrVars, vars) => { const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); dcInstance._useGeneratedSdk(); @@ -156,6 +146,72 @@ export function filterVendors(dcOrVars, vars) { return executeQuery(filterVendorsRef(dcOrVars, vars)); } +export const createVendorRateRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return mutationRef(dcInstance, 'CreateVendorRate', inputVars); +} +createVendorRateRef.operationName = 'CreateVendorRate'; + +export function createVendorRate(dcOrVars, vars) { + return executeMutation(createVendorRateRef(dcOrVars, vars)); +} + +export const updateVendorRateRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return mutationRef(dcInstance, 'UpdateVendorRate', inputVars); +} +updateVendorRateRef.operationName = 'UpdateVendorRate'; + +export function updateVendorRate(dcOrVars, vars) { + return executeMutation(updateVendorRateRef(dcOrVars, vars)); +} + +export const deleteVendorRateRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return mutationRef(dcInstance, 'DeleteVendorRate', inputVars); +} +deleteVendorRateRef.operationName = 'DeleteVendorRate'; + +export function deleteVendorRate(dcOrVars, vars) { + return executeMutation(deleteVendorRateRef(dcOrVars, vars)); +} + +export const listVendorRateRef = (dc) => { + const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined); + dcInstance._useGeneratedSdk(); + return queryRef(dcInstance, 'listVendorRate'); +} +listVendorRateRef.operationName = 'listVendorRate'; + +export function listVendorRate(dc) { + return executeQuery(listVendorRateRef(dc)); +} + +export const getVendorRateByIdRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return queryRef(dcInstance, 'getVendorRateById', inputVars); +} +getVendorRateByIdRef.operationName = 'getVendorRateById'; + +export function getVendorRateById(dcOrVars, vars) { + return executeQuery(getVendorRateByIdRef(dcOrVars, vars)); +} + +export const filterVendorRatesRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars); + dcInstance._useGeneratedSdk(); + return queryRef(dcInstance, 'filterVendorRates', inputVars); +} +filterVendorRatesRef.operationName = 'filterVendorRates'; + +export function filterVendorRates(dcOrVars, vars) { + return executeQuery(filterVendorRatesRef(dcOrVars, vars)); +} + export const createEventRef = (dcOrVars, vars) => { const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); dcInstance._useGeneratedSdk(); @@ -222,3 +278,25 @@ export function filterEvents(dcOrVars, vars) { return executeQuery(filterEventsRef(dcOrVars, vars)); } +export const createStaffRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return mutationRef(dcInstance, 'CreateStaff', inputVars); +} +createStaffRef.operationName = 'CreateStaff'; + +export function createStaff(dcOrVars, vars) { + return executeMutation(createStaffRef(dcOrVars, vars)); +} + +export const listStaffRef = (dc) => { + const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined); + dcInstance._useGeneratedSdk(); + return queryRef(dcInstance, 'listStaff'); +} +listStaffRef.operationName = 'listStaff'; + +export function listStaff(dc) { + return executeQuery(listStaffRef(dc)); +} + diff --git a/frontend-web/src/dataconnect-generated/index.cjs.js b/frontend-web/src/dataconnect-generated/index.cjs.js index c566e227..17689443 100644 --- a/frontend-web/src/dataconnect-generated/index.cjs.js +++ b/frontend-web/src/dataconnect-generated/index.cjs.js @@ -58,6 +58,19 @@ const VendorPlatformType = { } exports.VendorPlatformType = VendorPlatformType; +const VendorRateCategory = { + KITCHEN_AND_CULINARY: "KITCHEN_AND_CULINARY", + CONCESSIONS: "CONCESSIONS", + FACILITIES: "FACILITIES", + BARTENDING: "BARTENDING", + SECURITY: "SECURITY", + EVENT_STAFF: "EVENT_STAFF", + MANAGEMENT: "MANAGEMENT", + TECHNICAL: "TECHNICAL", + OTHER: "OTHER", +} +exports.VendorRateCategory = VendorRateCategory; + const VendorRegion = { NATIONAL: "NATIONAL", BAY_AREA: "BAY_AREA", @@ -77,30 +90,6 @@ const connectorConfig = { }; exports.connectorConfig = connectorConfig; -const createStaffRef = (dcOrVars, vars) => { - const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); - dcInstance._useGeneratedSdk(); - return mutationRef(dcInstance, 'CreateStaff', inputVars); -} -createStaffRef.operationName = 'CreateStaff'; -exports.createStaffRef = createStaffRef; - -exports.createStaff = function createStaff(dcOrVars, vars) { - return executeMutation(createStaffRef(dcOrVars, vars)); -}; - -const listStaffRef = (dc) => { - const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined); - dcInstance._useGeneratedSdk(); - return queryRef(dcInstance, 'listStaff'); -} -listStaffRef.operationName = 'listStaff'; -exports.listStaffRef = listStaffRef; - -exports.listStaff = function listStaff(dc) { - return executeQuery(listStaffRef(dc)); -}; - const createVendorRef = (dcOrVars, vars) => { const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); dcInstance._useGeneratedSdk(); @@ -173,6 +162,78 @@ exports.filterVendors = function filterVendors(dcOrVars, vars) { return executeQuery(filterVendorsRef(dcOrVars, vars)); }; +const createVendorRateRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return mutationRef(dcInstance, 'CreateVendorRate', inputVars); +} +createVendorRateRef.operationName = 'CreateVendorRate'; +exports.createVendorRateRef = createVendorRateRef; + +exports.createVendorRate = function createVendorRate(dcOrVars, vars) { + return executeMutation(createVendorRateRef(dcOrVars, vars)); +}; + +const updateVendorRateRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return mutationRef(dcInstance, 'UpdateVendorRate', inputVars); +} +updateVendorRateRef.operationName = 'UpdateVendorRate'; +exports.updateVendorRateRef = updateVendorRateRef; + +exports.updateVendorRate = function updateVendorRate(dcOrVars, vars) { + return executeMutation(updateVendorRateRef(dcOrVars, vars)); +}; + +const deleteVendorRateRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return mutationRef(dcInstance, 'DeleteVendorRate', inputVars); +} +deleteVendorRateRef.operationName = 'DeleteVendorRate'; +exports.deleteVendorRateRef = deleteVendorRateRef; + +exports.deleteVendorRate = function deleteVendorRate(dcOrVars, vars) { + return executeMutation(deleteVendorRateRef(dcOrVars, vars)); +}; + +const listVendorRateRef = (dc) => { + const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined); + dcInstance._useGeneratedSdk(); + return queryRef(dcInstance, 'listVendorRate'); +} +listVendorRateRef.operationName = 'listVendorRate'; +exports.listVendorRateRef = listVendorRateRef; + +exports.listVendorRate = function listVendorRate(dc) { + return executeQuery(listVendorRateRef(dc)); +}; + +const getVendorRateByIdRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return queryRef(dcInstance, 'getVendorRateById', inputVars); +} +getVendorRateByIdRef.operationName = 'getVendorRateById'; +exports.getVendorRateByIdRef = getVendorRateByIdRef; + +exports.getVendorRateById = function getVendorRateById(dcOrVars, vars) { + return executeQuery(getVendorRateByIdRef(dcOrVars, vars)); +}; + +const filterVendorRatesRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars); + dcInstance._useGeneratedSdk(); + return queryRef(dcInstance, 'filterVendorRates', inputVars); +} +filterVendorRatesRef.operationName = 'filterVendorRates'; +exports.filterVendorRatesRef = filterVendorRatesRef; + +exports.filterVendorRates = function filterVendorRates(dcOrVars, vars) { + return executeQuery(filterVendorRatesRef(dcOrVars, vars)); +}; + const createEventRef = (dcOrVars, vars) => { const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); dcInstance._useGeneratedSdk(); @@ -244,3 +305,27 @@ exports.filterEventsRef = filterEventsRef; exports.filterEvents = function filterEvents(dcOrVars, vars) { return executeQuery(filterEventsRef(dcOrVars, vars)); }; + +const createStaffRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return mutationRef(dcInstance, 'CreateStaff', inputVars); +} +createStaffRef.operationName = 'CreateStaff'; +exports.createStaffRef = createStaffRef; + +exports.createStaff = function createStaff(dcOrVars, vars) { + return executeMutation(createStaffRef(dcOrVars, vars)); +}; + +const listStaffRef = (dc) => { + const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined); + dcInstance._useGeneratedSdk(); + return queryRef(dcInstance, 'listStaff'); +} +listStaffRef.operationName = 'listStaff'; +exports.listStaffRef = listStaffRef; + +exports.listStaff = function listStaff(dc) { + return executeQuery(listStaffRef(dc)); +}; diff --git a/frontend-web/src/dataconnect-generated/index.d.ts b/frontend-web/src/dataconnect-generated/index.d.ts index 5d228d71..fa6cd96a 100644 --- a/frontend-web/src/dataconnect-generated/index.d.ts +++ b/frontend-web/src/dataconnect-generated/index.d.ts @@ -59,6 +59,18 @@ export enum VendorPlatformType { TRADITIONAL = "TRADITIONAL", }; +export enum VendorRateCategory { + KITCHEN_AND_CULINARY = "KITCHEN_AND_CULINARY", + CONCESSIONS = "CONCESSIONS", + FACILITIES = "FACILITIES", + BARTENDING = "BARTENDING", + SECURITY = "SECURITY", + EVENT_STAFF = "EVENT_STAFF", + MANAGEMENT = "MANAGEMENT", + TECHNICAL = "TECHNICAL", + OTHER = "OTHER", +}; + export enum VendorRegion { NATIONAL = "NATIONAL", BAY_AREA = "BAY_AREA", @@ -133,6 +145,20 @@ export interface CreateVendorData { vendor_insert: Vendor_Key; } +export interface CreateVendorRateData { + vendorRate_insert: VendorRate_Key; +} + +export interface CreateVendorRateVariables { + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; +} + export interface CreateVendorVariables { vendorNumber: string; legalName: string; @@ -155,6 +181,14 @@ export interface DeleteVendorData { vendor_delete?: Vendor_Key | null; } +export interface DeleteVendorRateData { + vendorRate_delete?: VendorRate_Key | null; +} + +export interface DeleteVendorRateVariables { + id: UUIDString; +} + export interface DeleteVendorVariables { id: UUIDString; } @@ -219,6 +253,27 @@ export interface FilterEventsVariables { clientEmail?: string | null; } +export interface FilterVendorRatesData { + vendorRates: ({ + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + } & VendorRate_Key)[]; +} + +export interface FilterVendorRatesVariables { + vendorName?: string | null; + category?: VendorRateCategory | null; + roleName?: string | null; + minClientRate?: number | null; + maxClientRate?: number | null; +} + export interface FilterVendorsData { vendors: ({ id: UUIDString; @@ -303,6 +358,26 @@ export interface GetVendorByIdVariables { id: UUIDString; } +export interface GetVendorRateByIdData { + vendorRate?: { + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + createdDate?: TimestampString | null; + updatedDate?: TimestampString | null; + createdBy?: string | null; + } & VendorRate_Key; +} + +export interface GetVendorRateByIdVariables { + id: UUIDString; +} + export interface ListEventsData { events: ({ id: UUIDString; @@ -371,6 +446,19 @@ export interface ListVendorData { } & Vendor_Key)[]; } +export interface ListVendorRateData { + vendorRates: ({ + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + } & VendorRate_Key)[]; +} + export interface Staff_Key { id: UUIDString; __typename?: 'Staff_Key'; @@ -422,6 +510,21 @@ export interface UpdateVendorData { vendor_update?: Vendor_Key | null; } +export interface UpdateVendorRateData { + vendorRate_update?: VendorRate_Key | null; +} + +export interface UpdateVendorRateVariables { + id: UUIDString; + vendorName?: string | null; + category?: VendorRateCategory | null; + roleName?: string | null; + employeeWage?: number | null; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate?: number | null; +} + export interface UpdateVendorVariables { id: UUIDString; vendorNumber?: string | null; @@ -433,35 +536,16 @@ export interface UpdateVendorVariables { isActive?: boolean | null; } +export interface VendorRate_Key { + id: UUIDString; + __typename?: 'VendorRate_Key'; +} + export interface Vendor_Key { id: UUIDString; __typename?: 'Vendor_Key'; } -interface CreateStaffRef { - /* Allow users to create refs without passing in DataConnect */ - (vars: CreateStaffVariables): MutationRef; - /* Allow users to pass in custom DataConnect instances */ - (dc: DataConnect, vars: CreateStaffVariables): MutationRef; - operationName: string; -} -export const createStaffRef: CreateStaffRef; - -export function createStaff(vars: CreateStaffVariables): MutationPromise; -export function createStaff(dc: DataConnect, vars: CreateStaffVariables): MutationPromise; - -interface ListStaffRef { - /* Allow users to create refs without passing in DataConnect */ - (): QueryRef; - /* Allow users to pass in custom DataConnect instances */ - (dc: DataConnect): QueryRef; - operationName: string; -} -export const listStaffRef: ListStaffRef; - -export function listStaff(): QueryPromise; -export function listStaff(dc: DataConnect): QueryPromise; - interface CreateVendorRef { /* Allow users to create refs without passing in DataConnect */ (vars: CreateVendorVariables): MutationRef; @@ -534,6 +618,78 @@ export const filterVendorsRef: FilterVendorsRef; export function filterVendors(vars?: FilterVendorsVariables): QueryPromise; export function filterVendors(dc: DataConnect, vars?: FilterVendorsVariables): QueryPromise; +interface CreateVendorRateRef { + /* Allow users to create refs without passing in DataConnect */ + (vars: CreateVendorRateVariables): MutationRef; + /* Allow users to pass in custom DataConnect instances */ + (dc: DataConnect, vars: CreateVendorRateVariables): MutationRef; + operationName: string; +} +export const createVendorRateRef: CreateVendorRateRef; + +export function createVendorRate(vars: CreateVendorRateVariables): MutationPromise; +export function createVendorRate(dc: DataConnect, vars: CreateVendorRateVariables): MutationPromise; + +interface UpdateVendorRateRef { + /* Allow users to create refs without passing in DataConnect */ + (vars: UpdateVendorRateVariables): MutationRef; + /* Allow users to pass in custom DataConnect instances */ + (dc: DataConnect, vars: UpdateVendorRateVariables): MutationRef; + operationName: string; +} +export const updateVendorRateRef: UpdateVendorRateRef; + +export function updateVendorRate(vars: UpdateVendorRateVariables): MutationPromise; +export function updateVendorRate(dc: DataConnect, vars: UpdateVendorRateVariables): MutationPromise; + +interface DeleteVendorRateRef { + /* Allow users to create refs without passing in DataConnect */ + (vars: DeleteVendorRateVariables): MutationRef; + /* Allow users to pass in custom DataConnect instances */ + (dc: DataConnect, vars: DeleteVendorRateVariables): MutationRef; + operationName: string; +} +export const deleteVendorRateRef: DeleteVendorRateRef; + +export function deleteVendorRate(vars: DeleteVendorRateVariables): MutationPromise; +export function deleteVendorRate(dc: DataConnect, vars: DeleteVendorRateVariables): MutationPromise; + +interface ListVendorRateRef { + /* Allow users to create refs without passing in DataConnect */ + (): QueryRef; + /* Allow users to pass in custom DataConnect instances */ + (dc: DataConnect): QueryRef; + operationName: string; +} +export const listVendorRateRef: ListVendorRateRef; + +export function listVendorRate(): QueryPromise; +export function listVendorRate(dc: DataConnect): QueryPromise; + +interface GetVendorRateByIdRef { + /* Allow users to create refs without passing in DataConnect */ + (vars: GetVendorRateByIdVariables): QueryRef; + /* Allow users to pass in custom DataConnect instances */ + (dc: DataConnect, vars: GetVendorRateByIdVariables): QueryRef; + operationName: string; +} +export const getVendorRateByIdRef: GetVendorRateByIdRef; + +export function getVendorRateById(vars: GetVendorRateByIdVariables): QueryPromise; +export function getVendorRateById(dc: DataConnect, vars: GetVendorRateByIdVariables): QueryPromise; + +interface FilterVendorRatesRef { + /* Allow users to create refs without passing in DataConnect */ + (vars?: FilterVendorRatesVariables): QueryRef; + /* Allow users to pass in custom DataConnect instances */ + (dc: DataConnect, vars?: FilterVendorRatesVariables): QueryRef; + operationName: string; +} +export const filterVendorRatesRef: FilterVendorRatesRef; + +export function filterVendorRates(vars?: FilterVendorRatesVariables): QueryPromise; +export function filterVendorRates(dc: DataConnect, vars?: FilterVendorRatesVariables): QueryPromise; + interface CreateEventRef { /* Allow users to create refs without passing in DataConnect */ (vars: CreateEventVariables): MutationRef; @@ -606,3 +762,27 @@ export const filterEventsRef: FilterEventsRef; export function filterEvents(vars?: FilterEventsVariables): QueryPromise; export function filterEvents(dc: DataConnect, vars?: FilterEventsVariables): QueryPromise; +interface CreateStaffRef { + /* Allow users to create refs without passing in DataConnect */ + (vars: CreateStaffVariables): MutationRef; + /* Allow users to pass in custom DataConnect instances */ + (dc: DataConnect, vars: CreateStaffVariables): MutationRef; + operationName: string; +} +export const createStaffRef: CreateStaffRef; + +export function createStaff(vars: CreateStaffVariables): MutationPromise; +export function createStaff(dc: DataConnect, vars: CreateStaffVariables): MutationPromise; + +interface ListStaffRef { + /* Allow users to create refs without passing in DataConnect */ + (): QueryRef; + /* Allow users to pass in custom DataConnect instances */ + (dc: DataConnect): QueryRef; + operationName: string; +} +export const listStaffRef: ListStaffRef; + +export function listStaff(): QueryPromise; +export function listStaff(dc: DataConnect): QueryPromise; + diff --git a/frontend-web/src/dataconnect-generated/react/README.md b/frontend-web/src/dataconnect-generated/react/README.md index dd87a50d..b53a3d0f 100644 --- a/frontend-web/src/dataconnect-generated/react/README.md +++ b/frontend-web/src/dataconnect-generated/react/README.md @@ -17,21 +17,27 @@ You can also follow the instructions from the [Data Connect documentation](https - [**Accessing the connector**](#accessing-the-connector) - [*Connecting to the local Emulator*](#connecting-to-the-local-emulator) - [**Queries**](#queries) - - [*listStaff*](#liststaff) - [*listVendor*](#listvendor) - [*getVendorById*](#getvendorbyid) - [*filterVendors*](#filtervendors) + - [*listVendorRate*](#listvendorrate) + - [*getVendorRateById*](#getvendorratebyid) + - [*filterVendorRates*](#filtervendorrates) - [*listEvents*](#listevents) - [*getEventById*](#geteventbyid) - [*filterEvents*](#filterevents) + - [*listStaff*](#liststaff) - [**Mutations**](#mutations) - - [*CreateStaff*](#createstaff) - [*CreateVendor*](#createvendor) - [*UpdateVendor*](#updatevendor) - [*DeleteVendor*](#deletevendor) + - [*CreateVendorRate*](#createvendorrate) + - [*UpdateVendorRate*](#updatevendorrate) + - [*DeleteVendorRate*](#deletevendorrate) - [*CreateEvent*](#createevent) - [*UpdateEvent*](#updateevent) - [*DeleteEvent*](#deleteevent) + - [*CreateStaff*](#createstaff) # TanStack Query Firebase & TanStack React Query This SDK provides [React](https://react.dev/) hooks generated specific to your application, for the operations found in the connector `krow-connector`. These hooks are generated using [TanStack Query Firebase](https://react-query-firebase.invertase.dev/) by our partners at Invertase, a library built on top of [TanStack React Query v5](https://tanstack.com/query/v5/docs/framework/react/overview). @@ -123,86 +129,6 @@ Here's a general overview of how to use the generated Query hooks in your code: Below are examples of how to use the `krow-connector` connector's generated Query hook functions to execute each Query. You can also follow the examples from the [Data Connect documentation](https://firebase.google.com/docs/data-connect/web-sdk#operations-react-angular). -## listStaff -You can execute the `listStaff` Query using the following Query hook function, which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts): - -```javascript -useListStaff(dc: DataConnect, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; -``` -You can also pass in a `DataConnect` instance to the Query hook function. -```javascript -useListStaff(options?: useDataConnectQueryOptions): UseDataConnectQueryResult; -``` - -### Variables -The `listStaff` Query has no variables. -### Return Type -Recall that calling the `listStaff` Query hook function returns a `UseQueryResult` object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things. - -To check the status of a Query, use the `UseQueryResult.status` field. You can also check for pending / success / error status using the `UseQueryResult.isPending`, `UseQueryResult.isSuccess`, and `UseQueryResult.isError` fields. - -To access the data returned by a Query, use the `UseQueryResult.data` field. The data for the `listStaff` Query is of type `ListStaffData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: -```javascript -export interface ListStaffData { - staffs: ({ - id: UUIDString; - employeeName: string; - vendorId?: UUIDString | null; - email?: string | null; - position?: string | null; - employmentType: EmploymentType; - rating?: number | null; - reliabilityScore?: number | null; - backgroundCheckStatus: BackgroundCheckStatus; - certifications?: string | null; - } & Staff_Key)[]; -} -``` - -To learn more about the `UseQueryResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery). - -### Using `listStaff`'s Query hook function - -```javascript -import { getDataConnect } from 'firebase/data-connect'; -import { connectorConfig } from '@dataconnect/generated'; -import { useListStaff } from '@dataconnect/generated/react' - -export default function ListStaffComponent() { - // You don't have to do anything to "execute" the Query. - // Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query. - const query = useListStaff(); - - // You can also pass in a `DataConnect` instance to the Query hook function. - const dataConnect = getDataConnect(connectorConfig); - const query = useListStaff(dataConnect); - - // You can also pass in a `useDataConnectQueryOptions` object to the Query hook function. - const options = { staleTime: 5 * 1000 }; - const query = useListStaff(options); - - // You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object. - const dataConnect = getDataConnect(connectorConfig); - const options = { staleTime: 5 * 1000 }; - const query = useListStaff(dataConnect, options); - - // Then, you can render your component dynamically based on the status of the Query. - if (query.isPending) { - return
Loading...
; - } - - if (query.isError) { - return
Error: {query.error.message}
; - } - - // If the Query is successful, you can access the data returned using the `UseQueryResult.data` field. - if (query.isSuccess) { - console.log(query.data.staffs); - } - return
Query execution {query.isSuccess ? 'successful' : 'failed'}!
; -} -``` - ## listVendor You can execute the `listVendor` Query using the following Query hook function, which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts): @@ -481,6 +407,283 @@ export default function FilterVendorsComponent() { } ``` +## listVendorRate +You can execute the `listVendorRate` Query using the following Query hook function, which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts): + +```javascript +useListVendorRate(dc: DataConnect, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +``` +You can also pass in a `DataConnect` instance to the Query hook function. +```javascript +useListVendorRate(options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +``` + +### Variables +The `listVendorRate` Query has no variables. +### Return Type +Recall that calling the `listVendorRate` Query hook function returns a `UseQueryResult` object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things. + +To check the status of a Query, use the `UseQueryResult.status` field. You can also check for pending / success / error status using the `UseQueryResult.isPending`, `UseQueryResult.isSuccess`, and `UseQueryResult.isError` fields. + +To access the data returned by a Query, use the `UseQueryResult.data` field. The data for the `listVendorRate` Query is of type `ListVendorRateData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: +```javascript +export interface ListVendorRateData { + vendorRates: ({ + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + } & VendorRate_Key)[]; +} +``` + +To learn more about the `UseQueryResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery). + +### Using `listVendorRate`'s Query hook function + +```javascript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig } from '@dataconnect/generated'; +import { useListVendorRate } from '@dataconnect/generated/react' + +export default function ListVendorRateComponent() { + // You don't have to do anything to "execute" the Query. + // Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query. + const query = useListVendorRate(); + + // You can also pass in a `DataConnect` instance to the Query hook function. + const dataConnect = getDataConnect(connectorConfig); + const query = useListVendorRate(dataConnect); + + // You can also pass in a `useDataConnectQueryOptions` object to the Query hook function. + const options = { staleTime: 5 * 1000 }; + const query = useListVendorRate(options); + + // You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object. + const dataConnect = getDataConnect(connectorConfig); + const options = { staleTime: 5 * 1000 }; + const query = useListVendorRate(dataConnect, options); + + // Then, you can render your component dynamically based on the status of the Query. + if (query.isPending) { + return
Loading...
; + } + + if (query.isError) { + return
Error: {query.error.message}
; + } + + // If the Query is successful, you can access the data returned using the `UseQueryResult.data` field. + if (query.isSuccess) { + console.log(query.data.vendorRates); + } + return
Query execution {query.isSuccess ? 'successful' : 'failed'}!
; +} +``` + +## getVendorRateById +You can execute the `getVendorRateById` Query using the following Query hook function, which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts): + +```javascript +useGetVendorRateById(dc: DataConnect, vars: GetVendorRateByIdVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +``` +You can also pass in a `DataConnect` instance to the Query hook function. +```javascript +useGetVendorRateById(vars: GetVendorRateByIdVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +``` + +### Variables +The `getVendorRateById` Query requires an argument of type `GetVendorRateByIdVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: + +```javascript +export interface GetVendorRateByIdVariables { + id: UUIDString; +} +``` +### Return Type +Recall that calling the `getVendorRateById` Query hook function returns a `UseQueryResult` object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things. + +To check the status of a Query, use the `UseQueryResult.status` field. You can also check for pending / success / error status using the `UseQueryResult.isPending`, `UseQueryResult.isSuccess`, and `UseQueryResult.isError` fields. + +To access the data returned by a Query, use the `UseQueryResult.data` field. The data for the `getVendorRateById` Query is of type `GetVendorRateByIdData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: +```javascript +export interface GetVendorRateByIdData { + vendorRate?: { + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + createdDate?: TimestampString | null; + updatedDate?: TimestampString | null; + createdBy?: string | null; + } & VendorRate_Key; +} +``` + +To learn more about the `UseQueryResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery). + +### Using `getVendorRateById`'s Query hook function + +```javascript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, GetVendorRateByIdVariables } from '@dataconnect/generated'; +import { useGetVendorRateById } from '@dataconnect/generated/react' + +export default function GetVendorRateByIdComponent() { + // The `useGetVendorRateById` Query hook requires an argument of type `GetVendorRateByIdVariables`: + const getVendorRateByIdVars: GetVendorRateByIdVariables = { + id: ..., + }; + + // You don't have to do anything to "execute" the Query. + // Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query. + const query = useGetVendorRateById(getVendorRateByIdVars); + // Variables can be defined inline as well. + const query = useGetVendorRateById({ id: ..., }); + + // You can also pass in a `DataConnect` instance to the Query hook function. + const dataConnect = getDataConnect(connectorConfig); + const query = useGetVendorRateById(dataConnect, getVendorRateByIdVars); + + // You can also pass in a `useDataConnectQueryOptions` object to the Query hook function. + const options = { staleTime: 5 * 1000 }; + const query = useGetVendorRateById(getVendorRateByIdVars, options); + + // You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object. + const dataConnect = getDataConnect(connectorConfig); + const options = { staleTime: 5 * 1000 }; + const query = useGetVendorRateById(dataConnect, getVendorRateByIdVars, options); + + // Then, you can render your component dynamically based on the status of the Query. + if (query.isPending) { + return
Loading...
; + } + + if (query.isError) { + return
Error: {query.error.message}
; + } + + // If the Query is successful, you can access the data returned using the `UseQueryResult.data` field. + if (query.isSuccess) { + console.log(query.data.vendorRate); + } + return
Query execution {query.isSuccess ? 'successful' : 'failed'}!
; +} +``` + +## filterVendorRates +You can execute the `filterVendorRates` Query using the following Query hook function, which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts): + +```javascript +useFilterVendorRates(dc: DataConnect, vars?: FilterVendorRatesVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +``` +You can also pass in a `DataConnect` instance to the Query hook function. +```javascript +useFilterVendorRates(vars?: FilterVendorRatesVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +``` + +### Variables +The `filterVendorRates` Query has an optional argument of type `FilterVendorRatesVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: + +```javascript +export interface FilterVendorRatesVariables { + vendorName?: string | null; + category?: VendorRateCategory | null; + roleName?: string | null; + minClientRate?: number | null; + maxClientRate?: number | null; +} +``` +### Return Type +Recall that calling the `filterVendorRates` Query hook function returns a `UseQueryResult` object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things. + +To check the status of a Query, use the `UseQueryResult.status` field. You can also check for pending / success / error status using the `UseQueryResult.isPending`, `UseQueryResult.isSuccess`, and `UseQueryResult.isError` fields. + +To access the data returned by a Query, use the `UseQueryResult.data` field. The data for the `filterVendorRates` Query is of type `FilterVendorRatesData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: +```javascript +export interface FilterVendorRatesData { + vendorRates: ({ + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + } & VendorRate_Key)[]; +} +``` + +To learn more about the `UseQueryResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery). + +### Using `filterVendorRates`'s Query hook function + +```javascript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, FilterVendorRatesVariables } from '@dataconnect/generated'; +import { useFilterVendorRates } from '@dataconnect/generated/react' + +export default function FilterVendorRatesComponent() { + // The `useFilterVendorRates` Query hook has an optional argument of type `FilterVendorRatesVariables`: + const filterVendorRatesVars: FilterVendorRatesVariables = { + vendorName: ..., // optional + category: ..., // optional + roleName: ..., // optional + minClientRate: ..., // optional + maxClientRate: ..., // optional + }; + + // You don't have to do anything to "execute" the Query. + // Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query. + const query = useFilterVendorRates(filterVendorRatesVars); + // Variables can be defined inline as well. + const query = useFilterVendorRates({ vendorName: ..., category: ..., roleName: ..., minClientRate: ..., maxClientRate: ..., }); + // Since all variables are optional for this Query, you can omit the `FilterVendorRatesVariables` argument. + // (as long as you don't want to provide any `options`!) + const query = useFilterVendorRates(); + + // You can also pass in a `DataConnect` instance to the Query hook function. + const dataConnect = getDataConnect(connectorConfig); + const query = useFilterVendorRates(dataConnect, filterVendorRatesVars); + + // You can also pass in a `useDataConnectQueryOptions` object to the Query hook function. + const options = { staleTime: 5 * 1000 }; + const query = useFilterVendorRates(filterVendorRatesVars, options); + // If you'd like to provide options without providing any variables, you must + // pass `undefined` where you would normally pass the variables. + const query = useFilterVendorRates(undefined, options); + + // You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object. + const dataConnect = getDataConnect(connectorConfig); + const options = { staleTime: 5 * 1000 }; + const query = useFilterVendorRates(dataConnect, filterVendorRatesVars /** or undefined */, options); + + // Then, you can render your component dynamically based on the status of the Query. + if (query.isPending) { + return
Loading...
; + } + + if (query.isError) { + return
Error: {query.error.message}
; + } + + // If the Query is successful, you can access the data returned using the `UseQueryResult.data` field. + if (query.isSuccess) { + console.log(query.data.vendorRates); + } + return
Query execution {query.isSuccess ? 'successful' : 'failed'}!
; +} +``` + ## listEvents You can execute the `listEvents` Query using the following Query hook function, which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts): @@ -850,6 +1053,86 @@ export default function FilterEventsComponent() { } ``` +## listStaff +You can execute the `listStaff` Query using the following Query hook function, which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts): + +```javascript +useListStaff(dc: DataConnect, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +``` +You can also pass in a `DataConnect` instance to the Query hook function. +```javascript +useListStaff(options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +``` + +### Variables +The `listStaff` Query has no variables. +### Return Type +Recall that calling the `listStaff` Query hook function returns a `UseQueryResult` object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things. + +To check the status of a Query, use the `UseQueryResult.status` field. You can also check for pending / success / error status using the `UseQueryResult.isPending`, `UseQueryResult.isSuccess`, and `UseQueryResult.isError` fields. + +To access the data returned by a Query, use the `UseQueryResult.data` field. The data for the `listStaff` Query is of type `ListStaffData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: +```javascript +export interface ListStaffData { + staffs: ({ + id: UUIDString; + employeeName: string; + vendorId?: UUIDString | null; + email?: string | null; + position?: string | null; + employmentType: EmploymentType; + rating?: number | null; + reliabilityScore?: number | null; + backgroundCheckStatus: BackgroundCheckStatus; + certifications?: string | null; + } & Staff_Key)[]; +} +``` + +To learn more about the `UseQueryResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery). + +### Using `listStaff`'s Query hook function + +```javascript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig } from '@dataconnect/generated'; +import { useListStaff } from '@dataconnect/generated/react' + +export default function ListStaffComponent() { + // You don't have to do anything to "execute" the Query. + // Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query. + const query = useListStaff(); + + // You can also pass in a `DataConnect` instance to the Query hook function. + const dataConnect = getDataConnect(connectorConfig); + const query = useListStaff(dataConnect); + + // You can also pass in a `useDataConnectQueryOptions` object to the Query hook function. + const options = { staleTime: 5 * 1000 }; + const query = useListStaff(options); + + // You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object. + const dataConnect = getDataConnect(connectorConfig); + const options = { staleTime: 5 * 1000 }; + const query = useListStaff(dataConnect, options); + + // Then, you can render your component dynamically based on the status of the Query. + if (query.isPending) { + return
Loading...
; + } + + if (query.isError) { + return
Error: {query.error.message}
; + } + + // If the Query is successful, you can access the data returned using the `UseQueryResult.data` field. + if (query.isSuccess) { + console.log(query.data.staffs); + } + return
Query execution {query.isSuccess ? 'successful' : 'failed'}!
; +} +``` + # Mutations The React generated SDK provides Mutations hook functions that call and return [`useDataConnectMutation`](https://react-query-firebase.invertase.dev/react/data-connect/mutations) hooks from TanStack Query Firebase. @@ -875,116 +1158,6 @@ Here's a general overview of how to use the generated Mutation hooks in your cod Below are examples of how to use the `krow-connector` connector's generated Mutation hook functions to execute each Mutation. You can also follow the examples from the [Data Connect documentation](https://firebase.google.com/docs/data-connect/web-sdk#operations-react-angular). -## CreateStaff -You can execute the `CreateStaff` Mutation using the `UseMutationResult` object returned by the following Mutation hook function (which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts)): -```javascript -useCreateStaff(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; -``` -You can also pass in a `DataConnect` instance to the Mutation hook function. -```javascript -useCreateStaff(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; -``` - -### Variables -The `CreateStaff` Mutation requires an argument of type `CreateStaffVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: - -```javascript -export interface CreateStaffVariables { - employeeName: string; - vendorId?: UUIDString | null; - email?: string | null; - position?: string | null; - employmentType: EmploymentType; - rating?: number | null; - reliabilityScore?: number | null; - backgroundCheckStatus: BackgroundCheckStatus; - certifications?: string | null; -} -``` -### Return Type -Recall that calling the `CreateStaff` Mutation hook function returns a `UseMutationResult` object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things. - -To check the status of a Mutation, use the `UseMutationResult.status` field. You can also check for pending / success / error status using the `UseMutationResult.isPending`, `UseMutationResult.isSuccess`, and `UseMutationResult.isError` fields. - -To execute the Mutation, call `UseMutationResult.mutate()`. This function executes the Mutation, but does not return the data from the Mutation. - -To access the data returned by a Mutation, use the `UseMutationResult.data` field. The data for the `CreateStaff` Mutation is of type `CreateStaffData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: -```javascript -export interface CreateStaffData { - staff_insert: Staff_Key; -} -``` - -To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation). - -### Using `CreateStaff`'s Mutation hook function - -```javascript -import { getDataConnect } from 'firebase/data-connect'; -import { connectorConfig, CreateStaffVariables } from '@dataconnect/generated'; -import { useCreateStaff } from '@dataconnect/generated/react' - -export default function CreateStaffComponent() { - // Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation. - const mutation = useCreateStaff(); - - // You can also pass in a `DataConnect` instance to the Mutation hook function. - const dataConnect = getDataConnect(connectorConfig); - const mutation = useCreateStaff(dataConnect); - - // You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function. - const options = { - onSuccess: () => { console.log('Mutation succeeded!'); } - }; - const mutation = useCreateStaff(options); - - // You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object. - const dataConnect = getDataConnect(connectorConfig); - const options = { - onSuccess: () => { console.log('Mutation succeeded!'); } - }; - const mutation = useCreateStaff(dataConnect, options); - - // After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation. - // The `useCreateStaff` Mutation requires an argument of type `CreateStaffVariables`: - const createStaffVars: CreateStaffVariables = { - employeeName: ..., - vendorId: ..., // optional - email: ..., // optional - position: ..., // optional - employmentType: ..., - rating: ..., // optional - reliabilityScore: ..., // optional - backgroundCheckStatus: ..., - certifications: ..., // optional - }; - mutation.mutate(createStaffVars); - // Variables can be defined inline as well. - mutation.mutate({ employeeName: ..., vendorId: ..., email: ..., position: ..., employmentType: ..., rating: ..., reliabilityScore: ..., backgroundCheckStatus: ..., certifications: ..., }); - - // You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`. - const options = { - onSuccess: () => { console.log('Mutation succeeded!'); } - }; - mutation.mutate(createStaffVars, options); - - // Then, you can render your component dynamically based on the status of the Mutation. - if (mutation.isPending) { - return
Loading...
; - } - - if (mutation.isError) { - return
Error: {mutation.error.message}
; - } - - // If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field. - if (mutation.isSuccess) { - console.log(mutation.data.staff_insert); - } - return
Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
; -} -``` - ## CreateVendor You can execute the `CreateVendor` Mutation using the `UseMutationResult` object returned by the following Mutation hook function (which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts)): ```javascript @@ -1293,6 +1466,314 @@ export default function DeleteVendorComponent() { } ``` +## CreateVendorRate +You can execute the `CreateVendorRate` Mutation using the `UseMutationResult` object returned by the following Mutation hook function (which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts)): +```javascript +useCreateVendorRate(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +``` +You can also pass in a `DataConnect` instance to the Mutation hook function. +```javascript +useCreateVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +``` + +### Variables +The `CreateVendorRate` Mutation requires an argument of type `CreateVendorRateVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: + +```javascript +export interface CreateVendorRateVariables { + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; +} +``` +### Return Type +Recall that calling the `CreateVendorRate` Mutation hook function returns a `UseMutationResult` object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things. + +To check the status of a Mutation, use the `UseMutationResult.status` field. You can also check for pending / success / error status using the `UseMutationResult.isPending`, `UseMutationResult.isSuccess`, and `UseMutationResult.isError` fields. + +To execute the Mutation, call `UseMutationResult.mutate()`. This function executes the Mutation, but does not return the data from the Mutation. + +To access the data returned by a Mutation, use the `UseMutationResult.data` field. The data for the `CreateVendorRate` Mutation is of type `CreateVendorRateData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: +```javascript +export interface CreateVendorRateData { + vendorRate_insert: VendorRate_Key; +} +``` + +To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation). + +### Using `CreateVendorRate`'s Mutation hook function + +```javascript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, CreateVendorRateVariables } from '@dataconnect/generated'; +import { useCreateVendorRate } from '@dataconnect/generated/react' + +export default function CreateVendorRateComponent() { + // Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation. + const mutation = useCreateVendorRate(); + + // You can also pass in a `DataConnect` instance to the Mutation hook function. + const dataConnect = getDataConnect(connectorConfig); + const mutation = useCreateVendorRate(dataConnect); + + // You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function. + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + const mutation = useCreateVendorRate(options); + + // You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object. + const dataConnect = getDataConnect(connectorConfig); + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + const mutation = useCreateVendorRate(dataConnect, options); + + // After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation. + // The `useCreateVendorRate` Mutation requires an argument of type `CreateVendorRateVariables`: + const createVendorRateVars: CreateVendorRateVariables = { + vendorName: ..., + category: ..., + roleName: ..., + employeeWage: ..., + markupPercentage: ..., // optional + vendorFeePercentage: ..., // optional + clientRate: ..., + }; + mutation.mutate(createVendorRateVars); + // Variables can be defined inline as well. + mutation.mutate({ vendorName: ..., category: ..., roleName: ..., employeeWage: ..., markupPercentage: ..., vendorFeePercentage: ..., clientRate: ..., }); + + // You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`. + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + mutation.mutate(createVendorRateVars, options); + + // Then, you can render your component dynamically based on the status of the Mutation. + if (mutation.isPending) { + return
Loading...
; + } + + if (mutation.isError) { + return
Error: {mutation.error.message}
; + } + + // If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field. + if (mutation.isSuccess) { + console.log(mutation.data.vendorRate_insert); + } + return
Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
; +} +``` + +## UpdateVendorRate +You can execute the `UpdateVendorRate` Mutation using the `UseMutationResult` object returned by the following Mutation hook function (which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts)): +```javascript +useUpdateVendorRate(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +``` +You can also pass in a `DataConnect` instance to the Mutation hook function. +```javascript +useUpdateVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +``` + +### Variables +The `UpdateVendorRate` Mutation requires an argument of type `UpdateVendorRateVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: + +```javascript +export interface UpdateVendorRateVariables { + id: UUIDString; + vendorName?: string | null; + category?: VendorRateCategory | null; + roleName?: string | null; + employeeWage?: number | null; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate?: number | null; +} +``` +### Return Type +Recall that calling the `UpdateVendorRate` Mutation hook function returns a `UseMutationResult` object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things. + +To check the status of a Mutation, use the `UseMutationResult.status` field. You can also check for pending / success / error status using the `UseMutationResult.isPending`, `UseMutationResult.isSuccess`, and `UseMutationResult.isError` fields. + +To execute the Mutation, call `UseMutationResult.mutate()`. This function executes the Mutation, but does not return the data from the Mutation. + +To access the data returned by a Mutation, use the `UseMutationResult.data` field. The data for the `UpdateVendorRate` Mutation is of type `UpdateVendorRateData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: +```javascript +export interface UpdateVendorRateData { + vendorRate_update?: VendorRate_Key | null; +} +``` + +To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation). + +### Using `UpdateVendorRate`'s Mutation hook function + +```javascript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, UpdateVendorRateVariables } from '@dataconnect/generated'; +import { useUpdateVendorRate } from '@dataconnect/generated/react' + +export default function UpdateVendorRateComponent() { + // Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation. + const mutation = useUpdateVendorRate(); + + // You can also pass in a `DataConnect` instance to the Mutation hook function. + const dataConnect = getDataConnect(connectorConfig); + const mutation = useUpdateVendorRate(dataConnect); + + // You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function. + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + const mutation = useUpdateVendorRate(options); + + // You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object. + const dataConnect = getDataConnect(connectorConfig); + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + const mutation = useUpdateVendorRate(dataConnect, options); + + // After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation. + // The `useUpdateVendorRate` Mutation requires an argument of type `UpdateVendorRateVariables`: + const updateVendorRateVars: UpdateVendorRateVariables = { + id: ..., + vendorName: ..., // optional + category: ..., // optional + roleName: ..., // optional + employeeWage: ..., // optional + markupPercentage: ..., // optional + vendorFeePercentage: ..., // optional + clientRate: ..., // optional + }; + mutation.mutate(updateVendorRateVars); + // Variables can be defined inline as well. + mutation.mutate({ id: ..., vendorName: ..., category: ..., roleName: ..., employeeWage: ..., markupPercentage: ..., vendorFeePercentage: ..., clientRate: ..., }); + + // You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`. + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + mutation.mutate(updateVendorRateVars, options); + + // Then, you can render your component dynamically based on the status of the Mutation. + if (mutation.isPending) { + return
Loading...
; + } + + if (mutation.isError) { + return
Error: {mutation.error.message}
; + } + + // If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field. + if (mutation.isSuccess) { + console.log(mutation.data.vendorRate_update); + } + return
Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
; +} +``` + +## DeleteVendorRate +You can execute the `DeleteVendorRate` Mutation using the `UseMutationResult` object returned by the following Mutation hook function (which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts)): +```javascript +useDeleteVendorRate(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +``` +You can also pass in a `DataConnect` instance to the Mutation hook function. +```javascript +useDeleteVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +``` + +### Variables +The `DeleteVendorRate` Mutation requires an argument of type `DeleteVendorRateVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: + +```javascript +export interface DeleteVendorRateVariables { + id: UUIDString; +} +``` +### Return Type +Recall that calling the `DeleteVendorRate` Mutation hook function returns a `UseMutationResult` object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things. + +To check the status of a Mutation, use the `UseMutationResult.status` field. You can also check for pending / success / error status using the `UseMutationResult.isPending`, `UseMutationResult.isSuccess`, and `UseMutationResult.isError` fields. + +To execute the Mutation, call `UseMutationResult.mutate()`. This function executes the Mutation, but does not return the data from the Mutation. + +To access the data returned by a Mutation, use the `UseMutationResult.data` field. The data for the `DeleteVendorRate` Mutation is of type `DeleteVendorRateData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: +```javascript +export interface DeleteVendorRateData { + vendorRate_delete?: VendorRate_Key | null; +} +``` + +To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation). + +### Using `DeleteVendorRate`'s Mutation hook function + +```javascript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, DeleteVendorRateVariables } from '@dataconnect/generated'; +import { useDeleteVendorRate } from '@dataconnect/generated/react' + +export default function DeleteVendorRateComponent() { + // Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation. + const mutation = useDeleteVendorRate(); + + // You can also pass in a `DataConnect` instance to the Mutation hook function. + const dataConnect = getDataConnect(connectorConfig); + const mutation = useDeleteVendorRate(dataConnect); + + // You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function. + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + const mutation = useDeleteVendorRate(options); + + // You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object. + const dataConnect = getDataConnect(connectorConfig); + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + const mutation = useDeleteVendorRate(dataConnect, options); + + // After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation. + // The `useDeleteVendorRate` Mutation requires an argument of type `DeleteVendorRateVariables`: + const deleteVendorRateVars: DeleteVendorRateVariables = { + id: ..., + }; + mutation.mutate(deleteVendorRateVars); + // Variables can be defined inline as well. + mutation.mutate({ id: ..., }); + + // You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`. + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + mutation.mutate(deleteVendorRateVars, options); + + // Then, you can render your component dynamically based on the status of the Mutation. + if (mutation.isPending) { + return
Loading...
; + } + + if (mutation.isError) { + return
Error: {mutation.error.message}
; + } + + // If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field. + if (mutation.isSuccess) { + console.log(mutation.data.vendorRate_delete); + } + return
Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
; +} +``` + ## CreateEvent You can execute the `CreateEvent` Mutation using the `UseMutationResult` object returned by the following Mutation hook function (which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts)): ```javascript @@ -1709,3 +2190,113 @@ export default function DeleteEventComponent() { } ``` +## CreateStaff +You can execute the `CreateStaff` Mutation using the `UseMutationResult` object returned by the following Mutation hook function (which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts)): +```javascript +useCreateStaff(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +``` +You can also pass in a `DataConnect` instance to the Mutation hook function. +```javascript +useCreateStaff(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +``` + +### Variables +The `CreateStaff` Mutation requires an argument of type `CreateStaffVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: + +```javascript +export interface CreateStaffVariables { + employeeName: string; + vendorId?: UUIDString | null; + email?: string | null; + position?: string | null; + employmentType: EmploymentType; + rating?: number | null; + reliabilityScore?: number | null; + backgroundCheckStatus: BackgroundCheckStatus; + certifications?: string | null; +} +``` +### Return Type +Recall that calling the `CreateStaff` Mutation hook function returns a `UseMutationResult` object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things. + +To check the status of a Mutation, use the `UseMutationResult.status` field. You can also check for pending / success / error status using the `UseMutationResult.isPending`, `UseMutationResult.isSuccess`, and `UseMutationResult.isError` fields. + +To execute the Mutation, call `UseMutationResult.mutate()`. This function executes the Mutation, but does not return the data from the Mutation. + +To access the data returned by a Mutation, use the `UseMutationResult.data` field. The data for the `CreateStaff` Mutation is of type `CreateStaffData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: +```javascript +export interface CreateStaffData { + staff_insert: Staff_Key; +} +``` + +To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation). + +### Using `CreateStaff`'s Mutation hook function + +```javascript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, CreateStaffVariables } from '@dataconnect/generated'; +import { useCreateStaff } from '@dataconnect/generated/react' + +export default function CreateStaffComponent() { + // Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation. + const mutation = useCreateStaff(); + + // You can also pass in a `DataConnect` instance to the Mutation hook function. + const dataConnect = getDataConnect(connectorConfig); + const mutation = useCreateStaff(dataConnect); + + // You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function. + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + const mutation = useCreateStaff(options); + + // You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object. + const dataConnect = getDataConnect(connectorConfig); + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + const mutation = useCreateStaff(dataConnect, options); + + // After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation. + // The `useCreateStaff` Mutation requires an argument of type `CreateStaffVariables`: + const createStaffVars: CreateStaffVariables = { + employeeName: ..., + vendorId: ..., // optional + email: ..., // optional + position: ..., // optional + employmentType: ..., + rating: ..., // optional + reliabilityScore: ..., // optional + backgroundCheckStatus: ..., + certifications: ..., // optional + }; + mutation.mutate(createStaffVars); + // Variables can be defined inline as well. + mutation.mutate({ employeeName: ..., vendorId: ..., email: ..., position: ..., employmentType: ..., rating: ..., reliabilityScore: ..., backgroundCheckStatus: ..., certifications: ..., }); + + // You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`. + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + mutation.mutate(createStaffVars, options); + + // Then, you can render your component dynamically based on the status of the Mutation. + if (mutation.isPending) { + return
Loading...
; + } + + if (mutation.isError) { + return
Error: {mutation.error.message}
; + } + + // If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field. + if (mutation.isSuccess) { + console.log(mutation.data.staff_insert); + } + return
Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
; +} +``` + diff --git a/frontend-web/src/dataconnect-generated/react/esm/index.esm.js b/frontend-web/src/dataconnect-generated/react/esm/index.esm.js index ef730402..e0722a51 100644 --- a/frontend-web/src/dataconnect-generated/react/esm/index.esm.js +++ b/frontend-web/src/dataconnect-generated/react/esm/index.esm.js @@ -1,21 +1,7 @@ -import { createStaffRef, listStaffRef, createVendorRef, updateVendorRef, deleteVendorRef, listVendorRef, getVendorByIdRef, filterVendorsRef, createEventRef, updateEventRef, deleteEventRef, listEventsRef, getEventByIdRef, filterEventsRef, connectorConfig } from '../../esm/index.esm.js'; +import { createVendorRef, updateVendorRef, deleteVendorRef, listVendorRef, getVendorByIdRef, filterVendorsRef, createVendorRateRef, updateVendorRateRef, deleteVendorRateRef, listVendorRateRef, getVendorRateByIdRef, filterVendorRatesRef, createEventRef, updateEventRef, deleteEventRef, listEventsRef, getEventByIdRef, filterEventsRef, createStaffRef, listStaffRef, connectorConfig } from '../../esm/index.esm.js'; import { validateArgs, CallerSdkTypeEnum } from 'firebase/data-connect'; import { useDataConnectQuery, useDataConnectMutation, validateReactArgs } from '@tanstack-query-firebase/react/data-connect'; -export function useCreateStaff(dcOrOptions, options) { - const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); - function refFactory(vars) { - return createStaffRef(dcInstance, vars); - } - return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); -} - - -export function useListStaff(dcOrOptions, options) { - const { dc: dcInstance, options: inputOpts } = validateReactArgs(connectorConfig, dcOrOptions, options); - const ref = listStaffRef(dcInstance); - return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); -} export function useCreateVendor(dcOrOptions, options) { const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); function refFactory(vars) { @@ -58,6 +44,48 @@ export function useFilterVendors(dcOrVars, varsOrOptions, options) { const ref = filterVendorsRef(dcInstance, inputVars); return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); } +export function useCreateVendorRate(dcOrOptions, options) { + const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); + function refFactory(vars) { + return createVendorRateRef(dcInstance, vars); + } + return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + +export function useUpdateVendorRate(dcOrOptions, options) { + const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); + function refFactory(vars) { + return updateVendorRateRef(dcInstance, vars); + } + return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + +export function useDeleteVendorRate(dcOrOptions, options) { + const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); + function refFactory(vars) { + return deleteVendorRateRef(dcInstance, vars); + } + return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + + +export function useListVendorRate(dcOrOptions, options) { + const { dc: dcInstance, options: inputOpts } = validateReactArgs(connectorConfig, dcOrOptions, options); + const ref = listVendorRateRef(dcInstance); + return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + +export function useGetVendorRateById(dcOrVars, varsOrOptions, options) { + const { dc: dcInstance, vars: inputVars, options: inputOpts } = validateReactArgs(connectorConfig, dcOrVars, varsOrOptions, options, true, true); + const ref = getVendorRateByIdRef(dcInstance, inputVars); + return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + +export function useFilterVendorRates(dcOrVars, varsOrOptions, options) { + const { dc: dcInstance, vars: inputVars, options: inputOpts } = validateReactArgs(connectorConfig, dcOrVars, varsOrOptions, options, true, false); + const ref = filterVendorRatesRef(dcInstance, inputVars); + return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} export function useCreateEvent(dcOrOptions, options) { const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); function refFactory(vars) { @@ -99,4 +127,18 @@ export function useFilterEvents(dcOrVars, varsOrOptions, options) { const { dc: dcInstance, vars: inputVars, options: inputOpts } = validateReactArgs(connectorConfig, dcOrVars, varsOrOptions, options, true, false); const ref = filterEventsRef(dcInstance, inputVars); return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} +export function useCreateStaff(dcOrOptions, options) { + const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); + function refFactory(vars) { + return createStaffRef(dcInstance, vars); + } + return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + + +export function useListStaff(dcOrOptions, options) { + const { dc: dcInstance, options: inputOpts } = validateReactArgs(connectorConfig, dcOrOptions, options); + const ref = listStaffRef(dcInstance); + return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); } \ No newline at end of file diff --git a/frontend-web/src/dataconnect-generated/react/index.cjs.js b/frontend-web/src/dataconnect-generated/react/index.cjs.js index 8983af01..a4e8fecb 100644 --- a/frontend-web/src/dataconnect-generated/react/index.cjs.js +++ b/frontend-web/src/dataconnect-generated/react/index.cjs.js @@ -1,21 +1,7 @@ -const { createStaffRef, listStaffRef, createVendorRef, updateVendorRef, deleteVendorRef, listVendorRef, getVendorByIdRef, filterVendorsRef, createEventRef, updateEventRef, deleteEventRef, listEventsRef, getEventByIdRef, filterEventsRef, connectorConfig } = require('../index.cjs.js'); +const { createVendorRef, updateVendorRef, deleteVendorRef, listVendorRef, getVendorByIdRef, filterVendorsRef, createVendorRateRef, updateVendorRateRef, deleteVendorRateRef, listVendorRateRef, getVendorRateByIdRef, filterVendorRatesRef, createEventRef, updateEventRef, deleteEventRef, listEventsRef, getEventByIdRef, filterEventsRef, createStaffRef, listStaffRef, connectorConfig } = require('../index.cjs.js'); const { validateArgs, CallerSdkTypeEnum } = require('firebase/data-connect'); const { useDataConnectQuery, useDataConnectMutation, validateReactArgs } = require('@tanstack-query-firebase/react/data-connect'); -exports.useCreateStaff = function useCreateStaff(dcOrOptions, options) { - const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); - function refFactory(vars) { - return createStaffRef(dcInstance, vars); - } - return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); -} - - -exports.useListStaff = function useListStaff(dcOrOptions, options) { - const { dc: dcInstance, options: inputOpts } = validateReactArgs(connectorConfig, dcOrOptions, options); - const ref = listStaffRef(dcInstance); - return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); -} exports.useCreateVendor = function useCreateVendor(dcOrOptions, options) { const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); function refFactory(vars) { @@ -58,6 +44,48 @@ exports.useFilterVendors = function useFilterVendors(dcOrVars, varsOrOptions, op const ref = filterVendorsRef(dcInstance, inputVars); return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); } +exports.useCreateVendorRate = function useCreateVendorRate(dcOrOptions, options) { + const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); + function refFactory(vars) { + return createVendorRateRef(dcInstance, vars); + } + return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + +exports.useUpdateVendorRate = function useUpdateVendorRate(dcOrOptions, options) { + const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); + function refFactory(vars) { + return updateVendorRateRef(dcInstance, vars); + } + return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + +exports.useDeleteVendorRate = function useDeleteVendorRate(dcOrOptions, options) { + const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); + function refFactory(vars) { + return deleteVendorRateRef(dcInstance, vars); + } + return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + + +exports.useListVendorRate = function useListVendorRate(dcOrOptions, options) { + const { dc: dcInstance, options: inputOpts } = validateReactArgs(connectorConfig, dcOrOptions, options); + const ref = listVendorRateRef(dcInstance); + return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + +exports.useGetVendorRateById = function useGetVendorRateById(dcOrVars, varsOrOptions, options) { + const { dc: dcInstance, vars: inputVars, options: inputOpts } = validateReactArgs(connectorConfig, dcOrVars, varsOrOptions, options, true, true); + const ref = getVendorRateByIdRef(dcInstance, inputVars); + return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + +exports.useFilterVendorRates = function useFilterVendorRates(dcOrVars, varsOrOptions, options) { + const { dc: dcInstance, vars: inputVars, options: inputOpts } = validateReactArgs(connectorConfig, dcOrVars, varsOrOptions, options, true, false); + const ref = filterVendorRatesRef(dcInstance, inputVars); + return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} exports.useCreateEvent = function useCreateEvent(dcOrOptions, options) { const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); function refFactory(vars) { @@ -99,4 +127,18 @@ exports.useFilterEvents = function useFilterEvents(dcOrVars, varsOrOptions, opti const { dc: dcInstance, vars: inputVars, options: inputOpts } = validateReactArgs(connectorConfig, dcOrVars, varsOrOptions, options, true, false); const ref = filterEventsRef(dcInstance, inputVars); return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} +exports.useCreateStaff = function useCreateStaff(dcOrOptions, options) { + const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); + function refFactory(vars) { + return createStaffRef(dcInstance, vars); + } + return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + + +exports.useListStaff = function useListStaff(dcOrOptions, options) { + const { dc: dcInstance, options: inputOpts } = validateReactArgs(connectorConfig, dcOrOptions, options); + const ref = listStaffRef(dcInstance); + return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); } \ No newline at end of file diff --git a/frontend-web/src/dataconnect-generated/react/index.d.ts b/frontend-web/src/dataconnect-generated/react/index.d.ts index 8888c622..0cdeedc4 100644 --- a/frontend-web/src/dataconnect-generated/react/index.d.ts +++ b/frontend-web/src/dataconnect-generated/react/index.d.ts @@ -1,16 +1,10 @@ -import { CreateStaffData, CreateStaffVariables, ListStaffData, CreateVendorData, CreateVendorVariables, UpdateVendorData, UpdateVendorVariables, DeleteVendorData, DeleteVendorVariables, ListVendorData, GetVendorByIdData, GetVendorByIdVariables, FilterVendorsData, FilterVendorsVariables, CreateEventData, CreateEventVariables, UpdateEventData, UpdateEventVariables, DeleteEventData, DeleteEventVariables, ListEventsData, GetEventByIdData, GetEventByIdVariables, FilterEventsData, FilterEventsVariables } from '../'; +import { CreateVendorData, CreateVendorVariables, UpdateVendorData, UpdateVendorVariables, DeleteVendorData, DeleteVendorVariables, ListVendorData, GetVendorByIdData, GetVendorByIdVariables, FilterVendorsData, FilterVendorsVariables, CreateVendorRateData, CreateVendorRateVariables, UpdateVendorRateData, UpdateVendorRateVariables, DeleteVendorRateData, DeleteVendorRateVariables, ListVendorRateData, GetVendorRateByIdData, GetVendorRateByIdVariables, FilterVendorRatesData, FilterVendorRatesVariables, CreateEventData, CreateEventVariables, UpdateEventData, UpdateEventVariables, DeleteEventData, DeleteEventVariables, ListEventsData, GetEventByIdData, GetEventByIdVariables, FilterEventsData, FilterEventsVariables, CreateStaffData, CreateStaffVariables, ListStaffData } from '../'; import { UseDataConnectQueryResult, useDataConnectQueryOptions, UseDataConnectMutationResult, useDataConnectMutationOptions} from '@tanstack-query-firebase/react/data-connect'; import { UseQueryResult, UseMutationResult} from '@tanstack/react-query'; import { DataConnect } from 'firebase/data-connect'; import { FirebaseError } from 'firebase/app'; -export function useCreateStaff(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; -export function useCreateStaff(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; - -export function useListStaff(options?: useDataConnectQueryOptions): UseDataConnectQueryResult; -export function useListStaff(dc: DataConnect, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; - export function useCreateVendor(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; export function useCreateVendor(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; @@ -29,6 +23,24 @@ export function useGetVendorById(dc: DataConnect, vars: GetVendorByIdVariables, export function useFilterVendors(vars?: FilterVendorsVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; export function useFilterVendors(dc: DataConnect, vars?: FilterVendorsVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +export function useCreateVendorRate(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +export function useCreateVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; + +export function useUpdateVendorRate(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +export function useUpdateVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; + +export function useDeleteVendorRate(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +export function useDeleteVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; + +export function useListVendorRate(options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +export function useListVendorRate(dc: DataConnect, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; + +export function useGetVendorRateById(vars: GetVendorRateByIdVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +export function useGetVendorRateById(dc: DataConnect, vars: GetVendorRateByIdVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; + +export function useFilterVendorRates(vars?: FilterVendorRatesVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +export function useFilterVendorRates(dc: DataConnect, vars?: FilterVendorRatesVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; + export function useCreateEvent(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; export function useCreateEvent(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; @@ -46,3 +58,9 @@ export function useGetEventById(dc: DataConnect, vars: GetEventByIdVariables, op export function useFilterEvents(vars?: FilterEventsVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; export function useFilterEvents(dc: DataConnect, vars?: FilterEventsVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; + +export function useCreateStaff(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +export function useCreateStaff(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; + +export function useListStaff(options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +export function useListStaff(dc: DataConnect, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; diff --git a/internal-api-harness/src/dataconnect-generated/.guides/usage.md b/internal-api-harness/src/dataconnect-generated/.guides/usage.md index d04f7413..98ae3760 100644 --- a/internal-api-harness/src/dataconnect-generated/.guides/usage.md +++ b/internal-api-harness/src/dataconnect-generated/.guides/usage.md @@ -12,13 +12,9 @@ For each operation, there is a wrapper hook that can be used to call the operati Here are all of the hooks that get generated: ```ts -import { useCreateStaff, useListStaff, useCreateVendor, useUpdateVendor, useDeleteVendor, useListVendor, useGetVendorById, useFilterVendors, useCreateEvent, useUpdateEvent } from '@dataconnect/generated/react'; +import { useCreateVendor, useUpdateVendor, useDeleteVendor, useListVendor, useGetVendorById, useFilterVendors, useCreateVendorRate, useUpdateVendorRate, useDeleteVendorRate, useListVendorRate } from '@dataconnect/generated/react'; // The types of these hooks are available in react/index.d.ts -const { data, isPending, isSuccess, isError, error } = useCreateStaff(createStaffVars); - -const { data, isPending, isSuccess, isError, error } = useListStaff(); - const { data, isPending, isSuccess, isError, error } = useCreateVendor(createVendorVars); const { data, isPending, isSuccess, isError, error } = useUpdateVendor(updateVendorVars); @@ -31,9 +27,13 @@ const { data, isPending, isSuccess, isError, error } = useGetVendorById(getVendo const { data, isPending, isSuccess, isError, error } = useFilterVendors(filterVendorsVars); -const { data, isPending, isSuccess, isError, error } = useCreateEvent(createEventVars); +const { data, isPending, isSuccess, isError, error } = useCreateVendorRate(createVendorRateVars); -const { data, isPending, isSuccess, isError, error } = useUpdateEvent(updateEventVars); +const { data, isPending, isSuccess, isError, error } = useUpdateVendorRate(updateVendorRateVars); + +const { data, isPending, isSuccess, isError, error } = useDeleteVendorRate(deleteVendorRateVars); + +const { data, isPending, isSuccess, isError, error } = useListVendorRate(); ``` @@ -72,15 +72,9 @@ If a user is not using a supported framework, they can use the generated SDK dir Here's an example of how to use it with the first 5 operations: ```js -import { createStaff, listStaff, createVendor, updateVendor, deleteVendor, listVendor, getVendorById, filterVendors, createEvent, updateEvent } from '@dataconnect/generated'; +import { createVendor, updateVendor, deleteVendor, listVendor, getVendorById, filterVendors, createVendorRate, updateVendorRate, deleteVendorRate, listVendorRate } from '@dataconnect/generated'; -// Operation CreateStaff: For variables, look at type CreateStaffVars in ../index.d.ts -const { data } = await CreateStaff(dataConnect, createStaffVars); - -// Operation listStaff: -const { data } = await ListStaff(dataConnect); - // Operation CreateVendor: For variables, look at type CreateVendorVars in ../index.d.ts const { data } = await CreateVendor(dataConnect, createVendorVars); @@ -99,11 +93,17 @@ const { data } = await GetVendorById(dataConnect, getVendorByIdVars); // Operation filterVendors: For variables, look at type FilterVendorsVars in ../index.d.ts const { data } = await FilterVendors(dataConnect, filterVendorsVars); -// Operation CreateEvent: For variables, look at type CreateEventVars in ../index.d.ts -const { data } = await CreateEvent(dataConnect, createEventVars); +// Operation CreateVendorRate: For variables, look at type CreateVendorRateVars in ../index.d.ts +const { data } = await CreateVendorRate(dataConnect, createVendorRateVars); -// Operation UpdateEvent: For variables, look at type UpdateEventVars in ../index.d.ts -const { data } = await UpdateEvent(dataConnect, updateEventVars); +// Operation UpdateVendorRate: For variables, look at type UpdateVendorRateVars in ../index.d.ts +const { data } = await UpdateVendorRate(dataConnect, updateVendorRateVars); + +// Operation DeleteVendorRate: For variables, look at type DeleteVendorRateVars in ../index.d.ts +const { data } = await DeleteVendorRate(dataConnect, deleteVendorRateVars); + +// Operation listVendorRate: +const { data } = await ListVendorRate(dataConnect); ``` \ No newline at end of file diff --git a/internal-api-harness/src/dataconnect-generated/README.md b/internal-api-harness/src/dataconnect-generated/README.md index 1cfab8f7..66a2306d 100644 --- a/internal-api-harness/src/dataconnect-generated/README.md +++ b/internal-api-harness/src/dataconnect-generated/README.md @@ -10,21 +10,27 @@ This README will guide you through the process of using the generated JavaScript - [**Accessing the connector**](#accessing-the-connector) - [*Connecting to the local Emulator*](#connecting-to-the-local-emulator) - [**Queries**](#queries) - - [*listStaff*](#liststaff) - [*listVendor*](#listvendor) - [*getVendorById*](#getvendorbyid) - [*filterVendors*](#filtervendors) + - [*listVendorRate*](#listvendorrate) + - [*getVendorRateById*](#getvendorratebyid) + - [*filterVendorRates*](#filtervendorrates) - [*listEvents*](#listevents) - [*getEventById*](#geteventbyid) - [*filterEvents*](#filterevents) + - [*listStaff*](#liststaff) - [**Mutations**](#mutations) - - [*CreateStaff*](#createstaff) - [*CreateVendor*](#createvendor) - [*UpdateVendor*](#updatevendor) - [*DeleteVendor*](#deletevendor) + - [*CreateVendorRate*](#createvendorrate) + - [*UpdateVendorRate*](#updatevendorrate) + - [*DeleteVendorRate*](#deletevendorrate) - [*CreateEvent*](#createevent) - [*UpdateEvent*](#updateevent) - [*DeleteEvent*](#deleteevent) + - [*CreateStaff*](#createstaff) # Accessing the connector A connector is a collection of Queries and Mutations. One SDK is generated for each connector - this SDK is generated for the connector `krow-connector`. You can find more information about connectors in the [Data Connect documentation](https://firebase.google.com/docs/data-connect#how-does). @@ -71,108 +77,6 @@ The following is true for both the action shortcut function and the `QueryRef` f Below are examples of how to use the `krow-connector` connector's generated functions to execute each query. You can also follow the examples from the [Data Connect documentation](https://firebase.google.com/docs/data-connect/web-sdk#using-queries). -## listStaff -You can execute the `listStaff` query using the following action shortcut function, or by calling `executeQuery()` after calling the following `QueryRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): -```typescript -listStaff(): QueryPromise; - -interface ListStaffRef { - ... - /* Allow users to create refs without passing in DataConnect */ - (): QueryRef; -} -export const listStaffRef: ListStaffRef; -``` -You can also pass in a `DataConnect` instance to the action shortcut function or `QueryRef` function. -```typescript -listStaff(dc: DataConnect): QueryPromise; - -interface ListStaffRef { - ... - (dc: DataConnect): QueryRef; -} -export const listStaffRef: ListStaffRef; -``` - -If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the listStaffRef: -```typescript -const name = listStaffRef.operationName; -console.log(name); -``` - -### Variables -The `listStaff` query has no variables. -### Return Type -Recall that executing the `listStaff` query returns a `QueryPromise` that resolves to an object with a `data` property. - -The `data` property is an object of type `ListStaffData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: -```typescript -export interface ListStaffData { - staffs: ({ - id: UUIDString; - employeeName: string; - vendorId?: UUIDString | null; - email?: string | null; - position?: string | null; - employmentType: EmploymentType; - rating?: number | null; - reliabilityScore?: number | null; - backgroundCheckStatus: BackgroundCheckStatus; - certifications?: string | null; - } & Staff_Key)[]; -} -``` -### Using `listStaff`'s action shortcut function - -```typescript -import { getDataConnect } from 'firebase/data-connect'; -import { connectorConfig, listStaff } from '@dataconnect/generated'; - - -// Call the `listStaff()` function to execute the query. -// You can use the `await` keyword to wait for the promise to resolve. -const { data } = await listStaff(); - -// You can also pass in a `DataConnect` instance to the action shortcut function. -const dataConnect = getDataConnect(connectorConfig); -const { data } = await listStaff(dataConnect); - -console.log(data.staffs); - -// Or, you can use the `Promise` API. -listStaff().then((response) => { - const data = response.data; - console.log(data.staffs); -}); -``` - -### Using `listStaff`'s `QueryRef` function - -```typescript -import { getDataConnect, executeQuery } from 'firebase/data-connect'; -import { connectorConfig, listStaffRef } from '@dataconnect/generated'; - - -// Call the `listStaffRef()` function to get a reference to the query. -const ref = listStaffRef(); - -// You can also pass in a `DataConnect` instance to the `QueryRef` function. -const dataConnect = getDataConnect(connectorConfig); -const ref = listStaffRef(dataConnect); - -// Call `executeQuery()` on the reference to execute the query. -// You can use the `await` keyword to wait for the promise to resolve. -const { data } = await executeQuery(ref); - -console.log(data.staffs); - -// Or, you can use the `Promise` API. -executeQuery(ref).then((response) => { - const data = response.data; - console.log(data.staffs); -}); -``` - ## listVendor You can execute the `listVendor` query using the following action shortcut function, or by calling `executeQuery()` after calling the following `QueryRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): ```typescript @@ -531,6 +435,361 @@ executeQuery(ref).then((response) => { }); ``` +## listVendorRate +You can execute the `listVendorRate` query using the following action shortcut function, or by calling `executeQuery()` after calling the following `QueryRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): +```typescript +listVendorRate(): QueryPromise; + +interface ListVendorRateRef { + ... + /* Allow users to create refs without passing in DataConnect */ + (): QueryRef; +} +export const listVendorRateRef: ListVendorRateRef; +``` +You can also pass in a `DataConnect` instance to the action shortcut function or `QueryRef` function. +```typescript +listVendorRate(dc: DataConnect): QueryPromise; + +interface ListVendorRateRef { + ... + (dc: DataConnect): QueryRef; +} +export const listVendorRateRef: ListVendorRateRef; +``` + +If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the listVendorRateRef: +```typescript +const name = listVendorRateRef.operationName; +console.log(name); +``` + +### Variables +The `listVendorRate` query has no variables. +### Return Type +Recall that executing the `listVendorRate` query returns a `QueryPromise` that resolves to an object with a `data` property. + +The `data` property is an object of type `ListVendorRateData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: +```typescript +export interface ListVendorRateData { + vendorRates: ({ + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + } & VendorRate_Key)[]; +} +``` +### Using `listVendorRate`'s action shortcut function + +```typescript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, listVendorRate } from '@dataconnect/generated'; + + +// Call the `listVendorRate()` function to execute the query. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await listVendorRate(); + +// You can also pass in a `DataConnect` instance to the action shortcut function. +const dataConnect = getDataConnect(connectorConfig); +const { data } = await listVendorRate(dataConnect); + +console.log(data.vendorRates); + +// Or, you can use the `Promise` API. +listVendorRate().then((response) => { + const data = response.data; + console.log(data.vendorRates); +}); +``` + +### Using `listVendorRate`'s `QueryRef` function + +```typescript +import { getDataConnect, executeQuery } from 'firebase/data-connect'; +import { connectorConfig, listVendorRateRef } from '@dataconnect/generated'; + + +// Call the `listVendorRateRef()` function to get a reference to the query. +const ref = listVendorRateRef(); + +// You can also pass in a `DataConnect` instance to the `QueryRef` function. +const dataConnect = getDataConnect(connectorConfig); +const ref = listVendorRateRef(dataConnect); + +// Call `executeQuery()` on the reference to execute the query. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await executeQuery(ref); + +console.log(data.vendorRates); + +// Or, you can use the `Promise` API. +executeQuery(ref).then((response) => { + const data = response.data; + console.log(data.vendorRates); +}); +``` + +## getVendorRateById +You can execute the `getVendorRateById` query using the following action shortcut function, or by calling `executeQuery()` after calling the following `QueryRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): +```typescript +getVendorRateById(vars: GetVendorRateByIdVariables): QueryPromise; + +interface GetVendorRateByIdRef { + ... + /* Allow users to create refs without passing in DataConnect */ + (vars: GetVendorRateByIdVariables): QueryRef; +} +export const getVendorRateByIdRef: GetVendorRateByIdRef; +``` +You can also pass in a `DataConnect` instance to the action shortcut function or `QueryRef` function. +```typescript +getVendorRateById(dc: DataConnect, vars: GetVendorRateByIdVariables): QueryPromise; + +interface GetVendorRateByIdRef { + ... + (dc: DataConnect, vars: GetVendorRateByIdVariables): QueryRef; +} +export const getVendorRateByIdRef: GetVendorRateByIdRef; +``` + +If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the getVendorRateByIdRef: +```typescript +const name = getVendorRateByIdRef.operationName; +console.log(name); +``` + +### Variables +The `getVendorRateById` query requires an argument of type `GetVendorRateByIdVariables`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: + +```typescript +export interface GetVendorRateByIdVariables { + id: UUIDString; +} +``` +### Return Type +Recall that executing the `getVendorRateById` query returns a `QueryPromise` that resolves to an object with a `data` property. + +The `data` property is an object of type `GetVendorRateByIdData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: +```typescript +export interface GetVendorRateByIdData { + vendorRate?: { + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + createdDate?: TimestampString | null; + updatedDate?: TimestampString | null; + createdBy?: string | null; + } & VendorRate_Key; +} +``` +### Using `getVendorRateById`'s action shortcut function + +```typescript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, getVendorRateById, GetVendorRateByIdVariables } from '@dataconnect/generated'; + +// The `getVendorRateById` query requires an argument of type `GetVendorRateByIdVariables`: +const getVendorRateByIdVars: GetVendorRateByIdVariables = { + id: ..., +}; + +// Call the `getVendorRateById()` function to execute the query. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await getVendorRateById(getVendorRateByIdVars); +// Variables can be defined inline as well. +const { data } = await getVendorRateById({ id: ..., }); + +// You can also pass in a `DataConnect` instance to the action shortcut function. +const dataConnect = getDataConnect(connectorConfig); +const { data } = await getVendorRateById(dataConnect, getVendorRateByIdVars); + +console.log(data.vendorRate); + +// Or, you can use the `Promise` API. +getVendorRateById(getVendorRateByIdVars).then((response) => { + const data = response.data; + console.log(data.vendorRate); +}); +``` + +### Using `getVendorRateById`'s `QueryRef` function + +```typescript +import { getDataConnect, executeQuery } from 'firebase/data-connect'; +import { connectorConfig, getVendorRateByIdRef, GetVendorRateByIdVariables } from '@dataconnect/generated'; + +// The `getVendorRateById` query requires an argument of type `GetVendorRateByIdVariables`: +const getVendorRateByIdVars: GetVendorRateByIdVariables = { + id: ..., +}; + +// Call the `getVendorRateByIdRef()` function to get a reference to the query. +const ref = getVendorRateByIdRef(getVendorRateByIdVars); +// Variables can be defined inline as well. +const ref = getVendorRateByIdRef({ id: ..., }); + +// You can also pass in a `DataConnect` instance to the `QueryRef` function. +const dataConnect = getDataConnect(connectorConfig); +const ref = getVendorRateByIdRef(dataConnect, getVendorRateByIdVars); + +// Call `executeQuery()` on the reference to execute the query. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await executeQuery(ref); + +console.log(data.vendorRate); + +// Or, you can use the `Promise` API. +executeQuery(ref).then((response) => { + const data = response.data; + console.log(data.vendorRate); +}); +``` + +## filterVendorRates +You can execute the `filterVendorRates` query using the following action shortcut function, or by calling `executeQuery()` after calling the following `QueryRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): +```typescript +filterVendorRates(vars?: FilterVendorRatesVariables): QueryPromise; + +interface FilterVendorRatesRef { + ... + /* Allow users to create refs without passing in DataConnect */ + (vars?: FilterVendorRatesVariables): QueryRef; +} +export const filterVendorRatesRef: FilterVendorRatesRef; +``` +You can also pass in a `DataConnect` instance to the action shortcut function or `QueryRef` function. +```typescript +filterVendorRates(dc: DataConnect, vars?: FilterVendorRatesVariables): QueryPromise; + +interface FilterVendorRatesRef { + ... + (dc: DataConnect, vars?: FilterVendorRatesVariables): QueryRef; +} +export const filterVendorRatesRef: FilterVendorRatesRef; +``` + +If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the filterVendorRatesRef: +```typescript +const name = filterVendorRatesRef.operationName; +console.log(name); +``` + +### Variables +The `filterVendorRates` query has an optional argument of type `FilterVendorRatesVariables`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: + +```typescript +export interface FilterVendorRatesVariables { + vendorName?: string | null; + category?: VendorRateCategory | null; + roleName?: string | null; + minClientRate?: number | null; + maxClientRate?: number | null; +} +``` +### Return Type +Recall that executing the `filterVendorRates` query returns a `QueryPromise` that resolves to an object with a `data` property. + +The `data` property is an object of type `FilterVendorRatesData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: +```typescript +export interface FilterVendorRatesData { + vendorRates: ({ + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + } & VendorRate_Key)[]; +} +``` +### Using `filterVendorRates`'s action shortcut function + +```typescript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, filterVendorRates, FilterVendorRatesVariables } from '@dataconnect/generated'; + +// The `filterVendorRates` query has an optional argument of type `FilterVendorRatesVariables`: +const filterVendorRatesVars: FilterVendorRatesVariables = { + vendorName: ..., // optional + category: ..., // optional + roleName: ..., // optional + minClientRate: ..., // optional + maxClientRate: ..., // optional +}; + +// Call the `filterVendorRates()` function to execute the query. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await filterVendorRates(filterVendorRatesVars); +// Variables can be defined inline as well. +const { data } = await filterVendorRates({ vendorName: ..., category: ..., roleName: ..., minClientRate: ..., maxClientRate: ..., }); +// Since all variables are optional for this query, you can omit the `FilterVendorRatesVariables` argument. +const { data } = await filterVendorRates(); + +// You can also pass in a `DataConnect` instance to the action shortcut function. +const dataConnect = getDataConnect(connectorConfig); +const { data } = await filterVendorRates(dataConnect, filterVendorRatesVars); + +console.log(data.vendorRates); + +// Or, you can use the `Promise` API. +filterVendorRates(filterVendorRatesVars).then((response) => { + const data = response.data; + console.log(data.vendorRates); +}); +``` + +### Using `filterVendorRates`'s `QueryRef` function + +```typescript +import { getDataConnect, executeQuery } from 'firebase/data-connect'; +import { connectorConfig, filterVendorRatesRef, FilterVendorRatesVariables } from '@dataconnect/generated'; + +// The `filterVendorRates` query has an optional argument of type `FilterVendorRatesVariables`: +const filterVendorRatesVars: FilterVendorRatesVariables = { + vendorName: ..., // optional + category: ..., // optional + roleName: ..., // optional + minClientRate: ..., // optional + maxClientRate: ..., // optional +}; + +// Call the `filterVendorRatesRef()` function to get a reference to the query. +const ref = filterVendorRatesRef(filterVendorRatesVars); +// Variables can be defined inline as well. +const ref = filterVendorRatesRef({ vendorName: ..., category: ..., roleName: ..., minClientRate: ..., maxClientRate: ..., }); +// Since all variables are optional for this query, you can omit the `FilterVendorRatesVariables` argument. +const ref = filterVendorRatesRef(); + +// You can also pass in a `DataConnect` instance to the `QueryRef` function. +const dataConnect = getDataConnect(connectorConfig); +const ref = filterVendorRatesRef(dataConnect, filterVendorRatesVars); + +// Call `executeQuery()` on the reference to execute the query. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await executeQuery(ref); + +console.log(data.vendorRates); + +// Or, you can use the `Promise` API. +executeQuery(ref).then((response) => { + const data = response.data; + console.log(data.vendorRates); +}); +``` + ## listEvents You can execute the `listEvents` query using the following action shortcut function, or by calling `executeQuery()` after calling the following `QueryRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): ```typescript @@ -985,6 +1244,108 @@ executeQuery(ref).then((response) => { }); ``` +## listStaff +You can execute the `listStaff` query using the following action shortcut function, or by calling `executeQuery()` after calling the following `QueryRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): +```typescript +listStaff(): QueryPromise; + +interface ListStaffRef { + ... + /* Allow users to create refs without passing in DataConnect */ + (): QueryRef; +} +export const listStaffRef: ListStaffRef; +``` +You can also pass in a `DataConnect` instance to the action shortcut function or `QueryRef` function. +```typescript +listStaff(dc: DataConnect): QueryPromise; + +interface ListStaffRef { + ... + (dc: DataConnect): QueryRef; +} +export const listStaffRef: ListStaffRef; +``` + +If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the listStaffRef: +```typescript +const name = listStaffRef.operationName; +console.log(name); +``` + +### Variables +The `listStaff` query has no variables. +### Return Type +Recall that executing the `listStaff` query returns a `QueryPromise` that resolves to an object with a `data` property. + +The `data` property is an object of type `ListStaffData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: +```typescript +export interface ListStaffData { + staffs: ({ + id: UUIDString; + employeeName: string; + vendorId?: UUIDString | null; + email?: string | null; + position?: string | null; + employmentType: EmploymentType; + rating?: number | null; + reliabilityScore?: number | null; + backgroundCheckStatus: BackgroundCheckStatus; + certifications?: string | null; + } & Staff_Key)[]; +} +``` +### Using `listStaff`'s action shortcut function + +```typescript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, listStaff } from '@dataconnect/generated'; + + +// Call the `listStaff()` function to execute the query. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await listStaff(); + +// You can also pass in a `DataConnect` instance to the action shortcut function. +const dataConnect = getDataConnect(connectorConfig); +const { data } = await listStaff(dataConnect); + +console.log(data.staffs); + +// Or, you can use the `Promise` API. +listStaff().then((response) => { + const data = response.data; + console.log(data.staffs); +}); +``` + +### Using `listStaff`'s `QueryRef` function + +```typescript +import { getDataConnect, executeQuery } from 'firebase/data-connect'; +import { connectorConfig, listStaffRef } from '@dataconnect/generated'; + + +// Call the `listStaffRef()` function to get a reference to the query. +const ref = listStaffRef(); + +// You can also pass in a `DataConnect` instance to the `QueryRef` function. +const dataConnect = getDataConnect(connectorConfig); +const ref = listStaffRef(dataConnect); + +// Call `executeQuery()` on the reference to execute the query. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await executeQuery(ref); + +console.log(data.staffs); + +// Or, you can use the `Promise` API. +executeQuery(ref).then((response) => { + const data = response.data; + console.log(data.staffs); +}); +``` + # Mutations There are two ways to execute a Data Connect Mutation using the generated Web SDK: @@ -1000,139 +1361,6 @@ The following is true for both the action shortcut function and the `MutationRef Below are examples of how to use the `krow-connector` connector's generated functions to execute each mutation. You can also follow the examples from the [Data Connect documentation](https://firebase.google.com/docs/data-connect/web-sdk#using-mutations). -## CreateStaff -You can execute the `CreateStaff` mutation using the following action shortcut function, or by calling `executeMutation()` after calling the following `MutationRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): -```typescript -createStaff(vars: CreateStaffVariables): MutationPromise; - -interface CreateStaffRef { - ... - /* Allow users to create refs without passing in DataConnect */ - (vars: CreateStaffVariables): MutationRef; -} -export const createStaffRef: CreateStaffRef; -``` -You can also pass in a `DataConnect` instance to the action shortcut function or `MutationRef` function. -```typescript -createStaff(dc: DataConnect, vars: CreateStaffVariables): MutationPromise; - -interface CreateStaffRef { - ... - (dc: DataConnect, vars: CreateStaffVariables): MutationRef; -} -export const createStaffRef: CreateStaffRef; -``` - -If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the createStaffRef: -```typescript -const name = createStaffRef.operationName; -console.log(name); -``` - -### Variables -The `CreateStaff` mutation requires an argument of type `CreateStaffVariables`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: - -```typescript -export interface CreateStaffVariables { - employeeName: string; - vendorId?: UUIDString | null; - email?: string | null; - position?: string | null; - employmentType: EmploymentType; - rating?: number | null; - reliabilityScore?: number | null; - backgroundCheckStatus: BackgroundCheckStatus; - certifications?: string | null; -} -``` -### Return Type -Recall that executing the `CreateStaff` mutation returns a `MutationPromise` that resolves to an object with a `data` property. - -The `data` property is an object of type `CreateStaffData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: -```typescript -export interface CreateStaffData { - staff_insert: Staff_Key; -} -``` -### Using `CreateStaff`'s action shortcut function - -```typescript -import { getDataConnect } from 'firebase/data-connect'; -import { connectorConfig, createStaff, CreateStaffVariables } from '@dataconnect/generated'; - -// The `CreateStaff` mutation requires an argument of type `CreateStaffVariables`: -const createStaffVars: CreateStaffVariables = { - employeeName: ..., - vendorId: ..., // optional - email: ..., // optional - position: ..., // optional - employmentType: ..., - rating: ..., // optional - reliabilityScore: ..., // optional - backgroundCheckStatus: ..., - certifications: ..., // optional -}; - -// Call the `createStaff()` function to execute the mutation. -// You can use the `await` keyword to wait for the promise to resolve. -const { data } = await createStaff(createStaffVars); -// Variables can be defined inline as well. -const { data } = await createStaff({ employeeName: ..., vendorId: ..., email: ..., position: ..., employmentType: ..., rating: ..., reliabilityScore: ..., backgroundCheckStatus: ..., certifications: ..., }); - -// You can also pass in a `DataConnect` instance to the action shortcut function. -const dataConnect = getDataConnect(connectorConfig); -const { data } = await createStaff(dataConnect, createStaffVars); - -console.log(data.staff_insert); - -// Or, you can use the `Promise` API. -createStaff(createStaffVars).then((response) => { - const data = response.data; - console.log(data.staff_insert); -}); -``` - -### Using `CreateStaff`'s `MutationRef` function - -```typescript -import { getDataConnect, executeMutation } from 'firebase/data-connect'; -import { connectorConfig, createStaffRef, CreateStaffVariables } from '@dataconnect/generated'; - -// The `CreateStaff` mutation requires an argument of type `CreateStaffVariables`: -const createStaffVars: CreateStaffVariables = { - employeeName: ..., - vendorId: ..., // optional - email: ..., // optional - position: ..., // optional - employmentType: ..., - rating: ..., // optional - reliabilityScore: ..., // optional - backgroundCheckStatus: ..., - certifications: ..., // optional -}; - -// Call the `createStaffRef()` function to get a reference to the mutation. -const ref = createStaffRef(createStaffVars); -// Variables can be defined inline as well. -const ref = createStaffRef({ employeeName: ..., vendorId: ..., email: ..., position: ..., employmentType: ..., rating: ..., reliabilityScore: ..., backgroundCheckStatus: ..., certifications: ..., }); - -// You can also pass in a `DataConnect` instance to the `MutationRef` function. -const dataConnect = getDataConnect(connectorConfig); -const ref = createStaffRef(dataConnect, createStaffVars); - -// Call `executeMutation()` on the reference to execute the mutation. -// You can use the `await` keyword to wait for the promise to resolve. -const { data } = await executeMutation(ref); - -console.log(data.staff_insert); - -// Or, you can use the `Promise` API. -executeMutation(ref).then((response) => { - const data = response.data; - console.log(data.staff_insert); -}); -``` - ## CreateVendor You can execute the `CreateVendor` mutation using the following action shortcut function, or by calling `executeMutation()` after calling the following `MutationRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): ```typescript @@ -1499,6 +1727,372 @@ executeMutation(ref).then((response) => { }); ``` +## CreateVendorRate +You can execute the `CreateVendorRate` mutation using the following action shortcut function, or by calling `executeMutation()` after calling the following `MutationRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): +```typescript +createVendorRate(vars: CreateVendorRateVariables): MutationPromise; + +interface CreateVendorRateRef { + ... + /* Allow users to create refs without passing in DataConnect */ + (vars: CreateVendorRateVariables): MutationRef; +} +export const createVendorRateRef: CreateVendorRateRef; +``` +You can also pass in a `DataConnect` instance to the action shortcut function or `MutationRef` function. +```typescript +createVendorRate(dc: DataConnect, vars: CreateVendorRateVariables): MutationPromise; + +interface CreateVendorRateRef { + ... + (dc: DataConnect, vars: CreateVendorRateVariables): MutationRef; +} +export const createVendorRateRef: CreateVendorRateRef; +``` + +If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the createVendorRateRef: +```typescript +const name = createVendorRateRef.operationName; +console.log(name); +``` + +### Variables +The `CreateVendorRate` mutation requires an argument of type `CreateVendorRateVariables`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: + +```typescript +export interface CreateVendorRateVariables { + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; +} +``` +### Return Type +Recall that executing the `CreateVendorRate` mutation returns a `MutationPromise` that resolves to an object with a `data` property. + +The `data` property is an object of type `CreateVendorRateData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: +```typescript +export interface CreateVendorRateData { + vendorRate_insert: VendorRate_Key; +} +``` +### Using `CreateVendorRate`'s action shortcut function + +```typescript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, createVendorRate, CreateVendorRateVariables } from '@dataconnect/generated'; + +// The `CreateVendorRate` mutation requires an argument of type `CreateVendorRateVariables`: +const createVendorRateVars: CreateVendorRateVariables = { + vendorName: ..., + category: ..., + roleName: ..., + employeeWage: ..., + markupPercentage: ..., // optional + vendorFeePercentage: ..., // optional + clientRate: ..., +}; + +// Call the `createVendorRate()` function to execute the mutation. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await createVendorRate(createVendorRateVars); +// Variables can be defined inline as well. +const { data } = await createVendorRate({ vendorName: ..., category: ..., roleName: ..., employeeWage: ..., markupPercentage: ..., vendorFeePercentage: ..., clientRate: ..., }); + +// You can also pass in a `DataConnect` instance to the action shortcut function. +const dataConnect = getDataConnect(connectorConfig); +const { data } = await createVendorRate(dataConnect, createVendorRateVars); + +console.log(data.vendorRate_insert); + +// Or, you can use the `Promise` API. +createVendorRate(createVendorRateVars).then((response) => { + const data = response.data; + console.log(data.vendorRate_insert); +}); +``` + +### Using `CreateVendorRate`'s `MutationRef` function + +```typescript +import { getDataConnect, executeMutation } from 'firebase/data-connect'; +import { connectorConfig, createVendorRateRef, CreateVendorRateVariables } from '@dataconnect/generated'; + +// The `CreateVendorRate` mutation requires an argument of type `CreateVendorRateVariables`: +const createVendorRateVars: CreateVendorRateVariables = { + vendorName: ..., + category: ..., + roleName: ..., + employeeWage: ..., + markupPercentage: ..., // optional + vendorFeePercentage: ..., // optional + clientRate: ..., +}; + +// Call the `createVendorRateRef()` function to get a reference to the mutation. +const ref = createVendorRateRef(createVendorRateVars); +// Variables can be defined inline as well. +const ref = createVendorRateRef({ vendorName: ..., category: ..., roleName: ..., employeeWage: ..., markupPercentage: ..., vendorFeePercentage: ..., clientRate: ..., }); + +// You can also pass in a `DataConnect` instance to the `MutationRef` function. +const dataConnect = getDataConnect(connectorConfig); +const ref = createVendorRateRef(dataConnect, createVendorRateVars); + +// Call `executeMutation()` on the reference to execute the mutation. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await executeMutation(ref); + +console.log(data.vendorRate_insert); + +// Or, you can use the `Promise` API. +executeMutation(ref).then((response) => { + const data = response.data; + console.log(data.vendorRate_insert); +}); +``` + +## UpdateVendorRate +You can execute the `UpdateVendorRate` mutation using the following action shortcut function, or by calling `executeMutation()` after calling the following `MutationRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): +```typescript +updateVendorRate(vars: UpdateVendorRateVariables): MutationPromise; + +interface UpdateVendorRateRef { + ... + /* Allow users to create refs without passing in DataConnect */ + (vars: UpdateVendorRateVariables): MutationRef; +} +export const updateVendorRateRef: UpdateVendorRateRef; +``` +You can also pass in a `DataConnect` instance to the action shortcut function or `MutationRef` function. +```typescript +updateVendorRate(dc: DataConnect, vars: UpdateVendorRateVariables): MutationPromise; + +interface UpdateVendorRateRef { + ... + (dc: DataConnect, vars: UpdateVendorRateVariables): MutationRef; +} +export const updateVendorRateRef: UpdateVendorRateRef; +``` + +If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the updateVendorRateRef: +```typescript +const name = updateVendorRateRef.operationName; +console.log(name); +``` + +### Variables +The `UpdateVendorRate` mutation requires an argument of type `UpdateVendorRateVariables`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: + +```typescript +export interface UpdateVendorRateVariables { + id: UUIDString; + vendorName?: string | null; + category?: VendorRateCategory | null; + roleName?: string | null; + employeeWage?: number | null; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate?: number | null; +} +``` +### Return Type +Recall that executing the `UpdateVendorRate` mutation returns a `MutationPromise` that resolves to an object with a `data` property. + +The `data` property is an object of type `UpdateVendorRateData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: +```typescript +export interface UpdateVendorRateData { + vendorRate_update?: VendorRate_Key | null; +} +``` +### Using `UpdateVendorRate`'s action shortcut function + +```typescript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, updateVendorRate, UpdateVendorRateVariables } from '@dataconnect/generated'; + +// The `UpdateVendorRate` mutation requires an argument of type `UpdateVendorRateVariables`: +const updateVendorRateVars: UpdateVendorRateVariables = { + id: ..., + vendorName: ..., // optional + category: ..., // optional + roleName: ..., // optional + employeeWage: ..., // optional + markupPercentage: ..., // optional + vendorFeePercentage: ..., // optional + clientRate: ..., // optional +}; + +// Call the `updateVendorRate()` function to execute the mutation. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await updateVendorRate(updateVendorRateVars); +// Variables can be defined inline as well. +const { data } = await updateVendorRate({ id: ..., vendorName: ..., category: ..., roleName: ..., employeeWage: ..., markupPercentage: ..., vendorFeePercentage: ..., clientRate: ..., }); + +// You can also pass in a `DataConnect` instance to the action shortcut function. +const dataConnect = getDataConnect(connectorConfig); +const { data } = await updateVendorRate(dataConnect, updateVendorRateVars); + +console.log(data.vendorRate_update); + +// Or, you can use the `Promise` API. +updateVendorRate(updateVendorRateVars).then((response) => { + const data = response.data; + console.log(data.vendorRate_update); +}); +``` + +### Using `UpdateVendorRate`'s `MutationRef` function + +```typescript +import { getDataConnect, executeMutation } from 'firebase/data-connect'; +import { connectorConfig, updateVendorRateRef, UpdateVendorRateVariables } from '@dataconnect/generated'; + +// The `UpdateVendorRate` mutation requires an argument of type `UpdateVendorRateVariables`: +const updateVendorRateVars: UpdateVendorRateVariables = { + id: ..., + vendorName: ..., // optional + category: ..., // optional + roleName: ..., // optional + employeeWage: ..., // optional + markupPercentage: ..., // optional + vendorFeePercentage: ..., // optional + clientRate: ..., // optional +}; + +// Call the `updateVendorRateRef()` function to get a reference to the mutation. +const ref = updateVendorRateRef(updateVendorRateVars); +// Variables can be defined inline as well. +const ref = updateVendorRateRef({ id: ..., vendorName: ..., category: ..., roleName: ..., employeeWage: ..., markupPercentage: ..., vendorFeePercentage: ..., clientRate: ..., }); + +// You can also pass in a `DataConnect` instance to the `MutationRef` function. +const dataConnect = getDataConnect(connectorConfig); +const ref = updateVendorRateRef(dataConnect, updateVendorRateVars); + +// Call `executeMutation()` on the reference to execute the mutation. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await executeMutation(ref); + +console.log(data.vendorRate_update); + +// Or, you can use the `Promise` API. +executeMutation(ref).then((response) => { + const data = response.data; + console.log(data.vendorRate_update); +}); +``` + +## DeleteVendorRate +You can execute the `DeleteVendorRate` mutation using the following action shortcut function, or by calling `executeMutation()` after calling the following `MutationRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): +```typescript +deleteVendorRate(vars: DeleteVendorRateVariables): MutationPromise; + +interface DeleteVendorRateRef { + ... + /* Allow users to create refs without passing in DataConnect */ + (vars: DeleteVendorRateVariables): MutationRef; +} +export const deleteVendorRateRef: DeleteVendorRateRef; +``` +You can also pass in a `DataConnect` instance to the action shortcut function or `MutationRef` function. +```typescript +deleteVendorRate(dc: DataConnect, vars: DeleteVendorRateVariables): MutationPromise; + +interface DeleteVendorRateRef { + ... + (dc: DataConnect, vars: DeleteVendorRateVariables): MutationRef; +} +export const deleteVendorRateRef: DeleteVendorRateRef; +``` + +If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the deleteVendorRateRef: +```typescript +const name = deleteVendorRateRef.operationName; +console.log(name); +``` + +### Variables +The `DeleteVendorRate` mutation requires an argument of type `DeleteVendorRateVariables`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: + +```typescript +export interface DeleteVendorRateVariables { + id: UUIDString; +} +``` +### Return Type +Recall that executing the `DeleteVendorRate` mutation returns a `MutationPromise` that resolves to an object with a `data` property. + +The `data` property is an object of type `DeleteVendorRateData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: +```typescript +export interface DeleteVendorRateData { + vendorRate_delete?: VendorRate_Key | null; +} +``` +### Using `DeleteVendorRate`'s action shortcut function + +```typescript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, deleteVendorRate, DeleteVendorRateVariables } from '@dataconnect/generated'; + +// The `DeleteVendorRate` mutation requires an argument of type `DeleteVendorRateVariables`: +const deleteVendorRateVars: DeleteVendorRateVariables = { + id: ..., +}; + +// Call the `deleteVendorRate()` function to execute the mutation. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await deleteVendorRate(deleteVendorRateVars); +// Variables can be defined inline as well. +const { data } = await deleteVendorRate({ id: ..., }); + +// You can also pass in a `DataConnect` instance to the action shortcut function. +const dataConnect = getDataConnect(connectorConfig); +const { data } = await deleteVendorRate(dataConnect, deleteVendorRateVars); + +console.log(data.vendorRate_delete); + +// Or, you can use the `Promise` API. +deleteVendorRate(deleteVendorRateVars).then((response) => { + const data = response.data; + console.log(data.vendorRate_delete); +}); +``` + +### Using `DeleteVendorRate`'s `MutationRef` function + +```typescript +import { getDataConnect, executeMutation } from 'firebase/data-connect'; +import { connectorConfig, deleteVendorRateRef, DeleteVendorRateVariables } from '@dataconnect/generated'; + +// The `DeleteVendorRate` mutation requires an argument of type `DeleteVendorRateVariables`: +const deleteVendorRateVars: DeleteVendorRateVariables = { + id: ..., +}; + +// Call the `deleteVendorRateRef()` function to get a reference to the mutation. +const ref = deleteVendorRateRef(deleteVendorRateVars); +// Variables can be defined inline as well. +const ref = deleteVendorRateRef({ id: ..., }); + +// You can also pass in a `DataConnect` instance to the `MutationRef` function. +const dataConnect = getDataConnect(connectorConfig); +const ref = deleteVendorRateRef(dataConnect, deleteVendorRateVars); + +// Call `executeMutation()` on the reference to execute the mutation. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await executeMutation(ref); + +console.log(data.vendorRate_delete); + +// Or, you can use the `Promise` API. +executeMutation(ref).then((response) => { + const data = response.data; + console.log(data.vendorRate_delete); +}); +``` + ## CreateEvent You can execute the `CreateEvent` mutation using the following action shortcut function, or by calling `executeMutation()` after calling the following `MutationRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): ```typescript @@ -2027,3 +2621,136 @@ executeMutation(ref).then((response) => { }); ``` +## CreateStaff +You can execute the `CreateStaff` mutation using the following action shortcut function, or by calling `executeMutation()` after calling the following `MutationRef` function, both of which are defined in [dataconnect-generated/index.d.ts](./index.d.ts): +```typescript +createStaff(vars: CreateStaffVariables): MutationPromise; + +interface CreateStaffRef { + ... + /* Allow users to create refs without passing in DataConnect */ + (vars: CreateStaffVariables): MutationRef; +} +export const createStaffRef: CreateStaffRef; +``` +You can also pass in a `DataConnect` instance to the action shortcut function or `MutationRef` function. +```typescript +createStaff(dc: DataConnect, vars: CreateStaffVariables): MutationPromise; + +interface CreateStaffRef { + ... + (dc: DataConnect, vars: CreateStaffVariables): MutationRef; +} +export const createStaffRef: CreateStaffRef; +``` + +If you need the name of the operation without creating a ref, you can retrieve the operation name by calling the `operationName` property on the createStaffRef: +```typescript +const name = createStaffRef.operationName; +console.log(name); +``` + +### Variables +The `CreateStaff` mutation requires an argument of type `CreateStaffVariables`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: + +```typescript +export interface CreateStaffVariables { + employeeName: string; + vendorId?: UUIDString | null; + email?: string | null; + position?: string | null; + employmentType: EmploymentType; + rating?: number | null; + reliabilityScore?: number | null; + backgroundCheckStatus: BackgroundCheckStatus; + certifications?: string | null; +} +``` +### Return Type +Recall that executing the `CreateStaff` mutation returns a `MutationPromise` that resolves to an object with a `data` property. + +The `data` property is an object of type `CreateStaffData`, which is defined in [dataconnect-generated/index.d.ts](./index.d.ts). It has the following fields: +```typescript +export interface CreateStaffData { + staff_insert: Staff_Key; +} +``` +### Using `CreateStaff`'s action shortcut function + +```typescript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, createStaff, CreateStaffVariables } from '@dataconnect/generated'; + +// The `CreateStaff` mutation requires an argument of type `CreateStaffVariables`: +const createStaffVars: CreateStaffVariables = { + employeeName: ..., + vendorId: ..., // optional + email: ..., // optional + position: ..., // optional + employmentType: ..., + rating: ..., // optional + reliabilityScore: ..., // optional + backgroundCheckStatus: ..., + certifications: ..., // optional +}; + +// Call the `createStaff()` function to execute the mutation. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await createStaff(createStaffVars); +// Variables can be defined inline as well. +const { data } = await createStaff({ employeeName: ..., vendorId: ..., email: ..., position: ..., employmentType: ..., rating: ..., reliabilityScore: ..., backgroundCheckStatus: ..., certifications: ..., }); + +// You can also pass in a `DataConnect` instance to the action shortcut function. +const dataConnect = getDataConnect(connectorConfig); +const { data } = await createStaff(dataConnect, createStaffVars); + +console.log(data.staff_insert); + +// Or, you can use the `Promise` API. +createStaff(createStaffVars).then((response) => { + const data = response.data; + console.log(data.staff_insert); +}); +``` + +### Using `CreateStaff`'s `MutationRef` function + +```typescript +import { getDataConnect, executeMutation } from 'firebase/data-connect'; +import { connectorConfig, createStaffRef, CreateStaffVariables } from '@dataconnect/generated'; + +// The `CreateStaff` mutation requires an argument of type `CreateStaffVariables`: +const createStaffVars: CreateStaffVariables = { + employeeName: ..., + vendorId: ..., // optional + email: ..., // optional + position: ..., // optional + employmentType: ..., + rating: ..., // optional + reliabilityScore: ..., // optional + backgroundCheckStatus: ..., + certifications: ..., // optional +}; + +// Call the `createStaffRef()` function to get a reference to the mutation. +const ref = createStaffRef(createStaffVars); +// Variables can be defined inline as well. +const ref = createStaffRef({ employeeName: ..., vendorId: ..., email: ..., position: ..., employmentType: ..., rating: ..., reliabilityScore: ..., backgroundCheckStatus: ..., certifications: ..., }); + +// You can also pass in a `DataConnect` instance to the `MutationRef` function. +const dataConnect = getDataConnect(connectorConfig); +const ref = createStaffRef(dataConnect, createStaffVars); + +// Call `executeMutation()` on the reference to execute the mutation. +// You can use the `await` keyword to wait for the promise to resolve. +const { data } = await executeMutation(ref); + +console.log(data.staff_insert); + +// Or, you can use the `Promise` API. +executeMutation(ref).then((response) => { + const data = response.data; + console.log(data.staff_insert); +}); +``` + diff --git a/internal-api-harness/src/dataconnect-generated/esm/index.esm.js b/internal-api-harness/src/dataconnect-generated/esm/index.esm.js index 3973bccc..e8f12f67 100644 --- a/internal-api-harness/src/dataconnect-generated/esm/index.esm.js +++ b/internal-api-harness/src/dataconnect-generated/esm/index.esm.js @@ -51,6 +51,18 @@ export const VendorPlatformType = { TRADITIONAL: "TRADITIONAL", } +export const VendorRateCategory = { + KITCHEN_AND_CULINARY: "KITCHEN_AND_CULINARY", + CONCESSIONS: "CONCESSIONS", + FACILITIES: "FACILITIES", + BARTENDING: "BARTENDING", + SECURITY: "SECURITY", + EVENT_STAFF: "EVENT_STAFF", + MANAGEMENT: "MANAGEMENT", + TECHNICAL: "TECHNICAL", + OTHER: "OTHER", +} + export const VendorRegion = { NATIONAL: "NATIONAL", BAY_AREA: "BAY_AREA", @@ -68,28 +80,6 @@ export const connectorConfig = { location: 'us-central1' }; -export const createStaffRef = (dcOrVars, vars) => { - const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); - dcInstance._useGeneratedSdk(); - return mutationRef(dcInstance, 'CreateStaff', inputVars); -} -createStaffRef.operationName = 'CreateStaff'; - -export function createStaff(dcOrVars, vars) { - return executeMutation(createStaffRef(dcOrVars, vars)); -} - -export const listStaffRef = (dc) => { - const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined); - dcInstance._useGeneratedSdk(); - return queryRef(dcInstance, 'listStaff'); -} -listStaffRef.operationName = 'listStaff'; - -export function listStaff(dc) { - return executeQuery(listStaffRef(dc)); -} - export const createVendorRef = (dcOrVars, vars) => { const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); dcInstance._useGeneratedSdk(); @@ -156,6 +146,72 @@ export function filterVendors(dcOrVars, vars) { return executeQuery(filterVendorsRef(dcOrVars, vars)); } +export const createVendorRateRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return mutationRef(dcInstance, 'CreateVendorRate', inputVars); +} +createVendorRateRef.operationName = 'CreateVendorRate'; + +export function createVendorRate(dcOrVars, vars) { + return executeMutation(createVendorRateRef(dcOrVars, vars)); +} + +export const updateVendorRateRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return mutationRef(dcInstance, 'UpdateVendorRate', inputVars); +} +updateVendorRateRef.operationName = 'UpdateVendorRate'; + +export function updateVendorRate(dcOrVars, vars) { + return executeMutation(updateVendorRateRef(dcOrVars, vars)); +} + +export const deleteVendorRateRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return mutationRef(dcInstance, 'DeleteVendorRate', inputVars); +} +deleteVendorRateRef.operationName = 'DeleteVendorRate'; + +export function deleteVendorRate(dcOrVars, vars) { + return executeMutation(deleteVendorRateRef(dcOrVars, vars)); +} + +export const listVendorRateRef = (dc) => { + const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined); + dcInstance._useGeneratedSdk(); + return queryRef(dcInstance, 'listVendorRate'); +} +listVendorRateRef.operationName = 'listVendorRate'; + +export function listVendorRate(dc) { + return executeQuery(listVendorRateRef(dc)); +} + +export const getVendorRateByIdRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return queryRef(dcInstance, 'getVendorRateById', inputVars); +} +getVendorRateByIdRef.operationName = 'getVendorRateById'; + +export function getVendorRateById(dcOrVars, vars) { + return executeQuery(getVendorRateByIdRef(dcOrVars, vars)); +} + +export const filterVendorRatesRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars); + dcInstance._useGeneratedSdk(); + return queryRef(dcInstance, 'filterVendorRates', inputVars); +} +filterVendorRatesRef.operationName = 'filterVendorRates'; + +export function filterVendorRates(dcOrVars, vars) { + return executeQuery(filterVendorRatesRef(dcOrVars, vars)); +} + export const createEventRef = (dcOrVars, vars) => { const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); dcInstance._useGeneratedSdk(); @@ -222,3 +278,25 @@ export function filterEvents(dcOrVars, vars) { return executeQuery(filterEventsRef(dcOrVars, vars)); } +export const createStaffRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return mutationRef(dcInstance, 'CreateStaff', inputVars); +} +createStaffRef.operationName = 'CreateStaff'; + +export function createStaff(dcOrVars, vars) { + return executeMutation(createStaffRef(dcOrVars, vars)); +} + +export const listStaffRef = (dc) => { + const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined); + dcInstance._useGeneratedSdk(); + return queryRef(dcInstance, 'listStaff'); +} +listStaffRef.operationName = 'listStaff'; + +export function listStaff(dc) { + return executeQuery(listStaffRef(dc)); +} + diff --git a/internal-api-harness/src/dataconnect-generated/index.cjs.js b/internal-api-harness/src/dataconnect-generated/index.cjs.js index c566e227..17689443 100644 --- a/internal-api-harness/src/dataconnect-generated/index.cjs.js +++ b/internal-api-harness/src/dataconnect-generated/index.cjs.js @@ -58,6 +58,19 @@ const VendorPlatformType = { } exports.VendorPlatformType = VendorPlatformType; +const VendorRateCategory = { + KITCHEN_AND_CULINARY: "KITCHEN_AND_CULINARY", + CONCESSIONS: "CONCESSIONS", + FACILITIES: "FACILITIES", + BARTENDING: "BARTENDING", + SECURITY: "SECURITY", + EVENT_STAFF: "EVENT_STAFF", + MANAGEMENT: "MANAGEMENT", + TECHNICAL: "TECHNICAL", + OTHER: "OTHER", +} +exports.VendorRateCategory = VendorRateCategory; + const VendorRegion = { NATIONAL: "NATIONAL", BAY_AREA: "BAY_AREA", @@ -77,30 +90,6 @@ const connectorConfig = { }; exports.connectorConfig = connectorConfig; -const createStaffRef = (dcOrVars, vars) => { - const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); - dcInstance._useGeneratedSdk(); - return mutationRef(dcInstance, 'CreateStaff', inputVars); -} -createStaffRef.operationName = 'CreateStaff'; -exports.createStaffRef = createStaffRef; - -exports.createStaff = function createStaff(dcOrVars, vars) { - return executeMutation(createStaffRef(dcOrVars, vars)); -}; - -const listStaffRef = (dc) => { - const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined); - dcInstance._useGeneratedSdk(); - return queryRef(dcInstance, 'listStaff'); -} -listStaffRef.operationName = 'listStaff'; -exports.listStaffRef = listStaffRef; - -exports.listStaff = function listStaff(dc) { - return executeQuery(listStaffRef(dc)); -}; - const createVendorRef = (dcOrVars, vars) => { const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); dcInstance._useGeneratedSdk(); @@ -173,6 +162,78 @@ exports.filterVendors = function filterVendors(dcOrVars, vars) { return executeQuery(filterVendorsRef(dcOrVars, vars)); }; +const createVendorRateRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return mutationRef(dcInstance, 'CreateVendorRate', inputVars); +} +createVendorRateRef.operationName = 'CreateVendorRate'; +exports.createVendorRateRef = createVendorRateRef; + +exports.createVendorRate = function createVendorRate(dcOrVars, vars) { + return executeMutation(createVendorRateRef(dcOrVars, vars)); +}; + +const updateVendorRateRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return mutationRef(dcInstance, 'UpdateVendorRate', inputVars); +} +updateVendorRateRef.operationName = 'UpdateVendorRate'; +exports.updateVendorRateRef = updateVendorRateRef; + +exports.updateVendorRate = function updateVendorRate(dcOrVars, vars) { + return executeMutation(updateVendorRateRef(dcOrVars, vars)); +}; + +const deleteVendorRateRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return mutationRef(dcInstance, 'DeleteVendorRate', inputVars); +} +deleteVendorRateRef.operationName = 'DeleteVendorRate'; +exports.deleteVendorRateRef = deleteVendorRateRef; + +exports.deleteVendorRate = function deleteVendorRate(dcOrVars, vars) { + return executeMutation(deleteVendorRateRef(dcOrVars, vars)); +}; + +const listVendorRateRef = (dc) => { + const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined); + dcInstance._useGeneratedSdk(); + return queryRef(dcInstance, 'listVendorRate'); +} +listVendorRateRef.operationName = 'listVendorRate'; +exports.listVendorRateRef = listVendorRateRef; + +exports.listVendorRate = function listVendorRate(dc) { + return executeQuery(listVendorRateRef(dc)); +}; + +const getVendorRateByIdRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return queryRef(dcInstance, 'getVendorRateById', inputVars); +} +getVendorRateByIdRef.operationName = 'getVendorRateById'; +exports.getVendorRateByIdRef = getVendorRateByIdRef; + +exports.getVendorRateById = function getVendorRateById(dcOrVars, vars) { + return executeQuery(getVendorRateByIdRef(dcOrVars, vars)); +}; + +const filterVendorRatesRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars); + dcInstance._useGeneratedSdk(); + return queryRef(dcInstance, 'filterVendorRates', inputVars); +} +filterVendorRatesRef.operationName = 'filterVendorRates'; +exports.filterVendorRatesRef = filterVendorRatesRef; + +exports.filterVendorRates = function filterVendorRates(dcOrVars, vars) { + return executeQuery(filterVendorRatesRef(dcOrVars, vars)); +}; + const createEventRef = (dcOrVars, vars) => { const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); dcInstance._useGeneratedSdk(); @@ -244,3 +305,27 @@ exports.filterEventsRef = filterEventsRef; exports.filterEvents = function filterEvents(dcOrVars, vars) { return executeQuery(filterEventsRef(dcOrVars, vars)); }; + +const createStaffRef = (dcOrVars, vars) => { + const { dc: dcInstance, vars: inputVars} = validateArgs(connectorConfig, dcOrVars, vars, true); + dcInstance._useGeneratedSdk(); + return mutationRef(dcInstance, 'CreateStaff', inputVars); +} +createStaffRef.operationName = 'CreateStaff'; +exports.createStaffRef = createStaffRef; + +exports.createStaff = function createStaff(dcOrVars, vars) { + return executeMutation(createStaffRef(dcOrVars, vars)); +}; + +const listStaffRef = (dc) => { + const { dc: dcInstance} = validateArgs(connectorConfig, dc, undefined); + dcInstance._useGeneratedSdk(); + return queryRef(dcInstance, 'listStaff'); +} +listStaffRef.operationName = 'listStaff'; +exports.listStaffRef = listStaffRef; + +exports.listStaff = function listStaff(dc) { + return executeQuery(listStaffRef(dc)); +}; diff --git a/internal-api-harness/src/dataconnect-generated/index.d.ts b/internal-api-harness/src/dataconnect-generated/index.d.ts index 5d228d71..fa6cd96a 100644 --- a/internal-api-harness/src/dataconnect-generated/index.d.ts +++ b/internal-api-harness/src/dataconnect-generated/index.d.ts @@ -59,6 +59,18 @@ export enum VendorPlatformType { TRADITIONAL = "TRADITIONAL", }; +export enum VendorRateCategory { + KITCHEN_AND_CULINARY = "KITCHEN_AND_CULINARY", + CONCESSIONS = "CONCESSIONS", + FACILITIES = "FACILITIES", + BARTENDING = "BARTENDING", + SECURITY = "SECURITY", + EVENT_STAFF = "EVENT_STAFF", + MANAGEMENT = "MANAGEMENT", + TECHNICAL = "TECHNICAL", + OTHER = "OTHER", +}; + export enum VendorRegion { NATIONAL = "NATIONAL", BAY_AREA = "BAY_AREA", @@ -133,6 +145,20 @@ export interface CreateVendorData { vendor_insert: Vendor_Key; } +export interface CreateVendorRateData { + vendorRate_insert: VendorRate_Key; +} + +export interface CreateVendorRateVariables { + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; +} + export interface CreateVendorVariables { vendorNumber: string; legalName: string; @@ -155,6 +181,14 @@ export interface DeleteVendorData { vendor_delete?: Vendor_Key | null; } +export interface DeleteVendorRateData { + vendorRate_delete?: VendorRate_Key | null; +} + +export interface DeleteVendorRateVariables { + id: UUIDString; +} + export interface DeleteVendorVariables { id: UUIDString; } @@ -219,6 +253,27 @@ export interface FilterEventsVariables { clientEmail?: string | null; } +export interface FilterVendorRatesData { + vendorRates: ({ + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + } & VendorRate_Key)[]; +} + +export interface FilterVendorRatesVariables { + vendorName?: string | null; + category?: VendorRateCategory | null; + roleName?: string | null; + minClientRate?: number | null; + maxClientRate?: number | null; +} + export interface FilterVendorsData { vendors: ({ id: UUIDString; @@ -303,6 +358,26 @@ export interface GetVendorByIdVariables { id: UUIDString; } +export interface GetVendorRateByIdData { + vendorRate?: { + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + createdDate?: TimestampString | null; + updatedDate?: TimestampString | null; + createdBy?: string | null; + } & VendorRate_Key; +} + +export interface GetVendorRateByIdVariables { + id: UUIDString; +} + export interface ListEventsData { events: ({ id: UUIDString; @@ -371,6 +446,19 @@ export interface ListVendorData { } & Vendor_Key)[]; } +export interface ListVendorRateData { + vendorRates: ({ + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + } & VendorRate_Key)[]; +} + export interface Staff_Key { id: UUIDString; __typename?: 'Staff_Key'; @@ -422,6 +510,21 @@ export interface UpdateVendorData { vendor_update?: Vendor_Key | null; } +export interface UpdateVendorRateData { + vendorRate_update?: VendorRate_Key | null; +} + +export interface UpdateVendorRateVariables { + id: UUIDString; + vendorName?: string | null; + category?: VendorRateCategory | null; + roleName?: string | null; + employeeWage?: number | null; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate?: number | null; +} + export interface UpdateVendorVariables { id: UUIDString; vendorNumber?: string | null; @@ -433,35 +536,16 @@ export interface UpdateVendorVariables { isActive?: boolean | null; } +export interface VendorRate_Key { + id: UUIDString; + __typename?: 'VendorRate_Key'; +} + export interface Vendor_Key { id: UUIDString; __typename?: 'Vendor_Key'; } -interface CreateStaffRef { - /* Allow users to create refs without passing in DataConnect */ - (vars: CreateStaffVariables): MutationRef; - /* Allow users to pass in custom DataConnect instances */ - (dc: DataConnect, vars: CreateStaffVariables): MutationRef; - operationName: string; -} -export const createStaffRef: CreateStaffRef; - -export function createStaff(vars: CreateStaffVariables): MutationPromise; -export function createStaff(dc: DataConnect, vars: CreateStaffVariables): MutationPromise; - -interface ListStaffRef { - /* Allow users to create refs without passing in DataConnect */ - (): QueryRef; - /* Allow users to pass in custom DataConnect instances */ - (dc: DataConnect): QueryRef; - operationName: string; -} -export const listStaffRef: ListStaffRef; - -export function listStaff(): QueryPromise; -export function listStaff(dc: DataConnect): QueryPromise; - interface CreateVendorRef { /* Allow users to create refs without passing in DataConnect */ (vars: CreateVendorVariables): MutationRef; @@ -534,6 +618,78 @@ export const filterVendorsRef: FilterVendorsRef; export function filterVendors(vars?: FilterVendorsVariables): QueryPromise; export function filterVendors(dc: DataConnect, vars?: FilterVendorsVariables): QueryPromise; +interface CreateVendorRateRef { + /* Allow users to create refs without passing in DataConnect */ + (vars: CreateVendorRateVariables): MutationRef; + /* Allow users to pass in custom DataConnect instances */ + (dc: DataConnect, vars: CreateVendorRateVariables): MutationRef; + operationName: string; +} +export const createVendorRateRef: CreateVendorRateRef; + +export function createVendorRate(vars: CreateVendorRateVariables): MutationPromise; +export function createVendorRate(dc: DataConnect, vars: CreateVendorRateVariables): MutationPromise; + +interface UpdateVendorRateRef { + /* Allow users to create refs without passing in DataConnect */ + (vars: UpdateVendorRateVariables): MutationRef; + /* Allow users to pass in custom DataConnect instances */ + (dc: DataConnect, vars: UpdateVendorRateVariables): MutationRef; + operationName: string; +} +export const updateVendorRateRef: UpdateVendorRateRef; + +export function updateVendorRate(vars: UpdateVendorRateVariables): MutationPromise; +export function updateVendorRate(dc: DataConnect, vars: UpdateVendorRateVariables): MutationPromise; + +interface DeleteVendorRateRef { + /* Allow users to create refs without passing in DataConnect */ + (vars: DeleteVendorRateVariables): MutationRef; + /* Allow users to pass in custom DataConnect instances */ + (dc: DataConnect, vars: DeleteVendorRateVariables): MutationRef; + operationName: string; +} +export const deleteVendorRateRef: DeleteVendorRateRef; + +export function deleteVendorRate(vars: DeleteVendorRateVariables): MutationPromise; +export function deleteVendorRate(dc: DataConnect, vars: DeleteVendorRateVariables): MutationPromise; + +interface ListVendorRateRef { + /* Allow users to create refs without passing in DataConnect */ + (): QueryRef; + /* Allow users to pass in custom DataConnect instances */ + (dc: DataConnect): QueryRef; + operationName: string; +} +export const listVendorRateRef: ListVendorRateRef; + +export function listVendorRate(): QueryPromise; +export function listVendorRate(dc: DataConnect): QueryPromise; + +interface GetVendorRateByIdRef { + /* Allow users to create refs without passing in DataConnect */ + (vars: GetVendorRateByIdVariables): QueryRef; + /* Allow users to pass in custom DataConnect instances */ + (dc: DataConnect, vars: GetVendorRateByIdVariables): QueryRef; + operationName: string; +} +export const getVendorRateByIdRef: GetVendorRateByIdRef; + +export function getVendorRateById(vars: GetVendorRateByIdVariables): QueryPromise; +export function getVendorRateById(dc: DataConnect, vars: GetVendorRateByIdVariables): QueryPromise; + +interface FilterVendorRatesRef { + /* Allow users to create refs without passing in DataConnect */ + (vars?: FilterVendorRatesVariables): QueryRef; + /* Allow users to pass in custom DataConnect instances */ + (dc: DataConnect, vars?: FilterVendorRatesVariables): QueryRef; + operationName: string; +} +export const filterVendorRatesRef: FilterVendorRatesRef; + +export function filterVendorRates(vars?: FilterVendorRatesVariables): QueryPromise; +export function filterVendorRates(dc: DataConnect, vars?: FilterVendorRatesVariables): QueryPromise; + interface CreateEventRef { /* Allow users to create refs without passing in DataConnect */ (vars: CreateEventVariables): MutationRef; @@ -606,3 +762,27 @@ export const filterEventsRef: FilterEventsRef; export function filterEvents(vars?: FilterEventsVariables): QueryPromise; export function filterEvents(dc: DataConnect, vars?: FilterEventsVariables): QueryPromise; +interface CreateStaffRef { + /* Allow users to create refs without passing in DataConnect */ + (vars: CreateStaffVariables): MutationRef; + /* Allow users to pass in custom DataConnect instances */ + (dc: DataConnect, vars: CreateStaffVariables): MutationRef; + operationName: string; +} +export const createStaffRef: CreateStaffRef; + +export function createStaff(vars: CreateStaffVariables): MutationPromise; +export function createStaff(dc: DataConnect, vars: CreateStaffVariables): MutationPromise; + +interface ListStaffRef { + /* Allow users to create refs without passing in DataConnect */ + (): QueryRef; + /* Allow users to pass in custom DataConnect instances */ + (dc: DataConnect): QueryRef; + operationName: string; +} +export const listStaffRef: ListStaffRef; + +export function listStaff(): QueryPromise; +export function listStaff(dc: DataConnect): QueryPromise; + diff --git a/internal-api-harness/src/dataconnect-generated/react/README.md b/internal-api-harness/src/dataconnect-generated/react/README.md index dd87a50d..b53a3d0f 100644 --- a/internal-api-harness/src/dataconnect-generated/react/README.md +++ b/internal-api-harness/src/dataconnect-generated/react/README.md @@ -17,21 +17,27 @@ You can also follow the instructions from the [Data Connect documentation](https - [**Accessing the connector**](#accessing-the-connector) - [*Connecting to the local Emulator*](#connecting-to-the-local-emulator) - [**Queries**](#queries) - - [*listStaff*](#liststaff) - [*listVendor*](#listvendor) - [*getVendorById*](#getvendorbyid) - [*filterVendors*](#filtervendors) + - [*listVendorRate*](#listvendorrate) + - [*getVendorRateById*](#getvendorratebyid) + - [*filterVendorRates*](#filtervendorrates) - [*listEvents*](#listevents) - [*getEventById*](#geteventbyid) - [*filterEvents*](#filterevents) + - [*listStaff*](#liststaff) - [**Mutations**](#mutations) - - [*CreateStaff*](#createstaff) - [*CreateVendor*](#createvendor) - [*UpdateVendor*](#updatevendor) - [*DeleteVendor*](#deletevendor) + - [*CreateVendorRate*](#createvendorrate) + - [*UpdateVendorRate*](#updatevendorrate) + - [*DeleteVendorRate*](#deletevendorrate) - [*CreateEvent*](#createevent) - [*UpdateEvent*](#updateevent) - [*DeleteEvent*](#deleteevent) + - [*CreateStaff*](#createstaff) # TanStack Query Firebase & TanStack React Query This SDK provides [React](https://react.dev/) hooks generated specific to your application, for the operations found in the connector `krow-connector`. These hooks are generated using [TanStack Query Firebase](https://react-query-firebase.invertase.dev/) by our partners at Invertase, a library built on top of [TanStack React Query v5](https://tanstack.com/query/v5/docs/framework/react/overview). @@ -123,86 +129,6 @@ Here's a general overview of how to use the generated Query hooks in your code: Below are examples of how to use the `krow-connector` connector's generated Query hook functions to execute each Query. You can also follow the examples from the [Data Connect documentation](https://firebase.google.com/docs/data-connect/web-sdk#operations-react-angular). -## listStaff -You can execute the `listStaff` Query using the following Query hook function, which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts): - -```javascript -useListStaff(dc: DataConnect, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; -``` -You can also pass in a `DataConnect` instance to the Query hook function. -```javascript -useListStaff(options?: useDataConnectQueryOptions): UseDataConnectQueryResult; -``` - -### Variables -The `listStaff` Query has no variables. -### Return Type -Recall that calling the `listStaff` Query hook function returns a `UseQueryResult` object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things. - -To check the status of a Query, use the `UseQueryResult.status` field. You can also check for pending / success / error status using the `UseQueryResult.isPending`, `UseQueryResult.isSuccess`, and `UseQueryResult.isError` fields. - -To access the data returned by a Query, use the `UseQueryResult.data` field. The data for the `listStaff` Query is of type `ListStaffData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: -```javascript -export interface ListStaffData { - staffs: ({ - id: UUIDString; - employeeName: string; - vendorId?: UUIDString | null; - email?: string | null; - position?: string | null; - employmentType: EmploymentType; - rating?: number | null; - reliabilityScore?: number | null; - backgroundCheckStatus: BackgroundCheckStatus; - certifications?: string | null; - } & Staff_Key)[]; -} -``` - -To learn more about the `UseQueryResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery). - -### Using `listStaff`'s Query hook function - -```javascript -import { getDataConnect } from 'firebase/data-connect'; -import { connectorConfig } from '@dataconnect/generated'; -import { useListStaff } from '@dataconnect/generated/react' - -export default function ListStaffComponent() { - // You don't have to do anything to "execute" the Query. - // Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query. - const query = useListStaff(); - - // You can also pass in a `DataConnect` instance to the Query hook function. - const dataConnect = getDataConnect(connectorConfig); - const query = useListStaff(dataConnect); - - // You can also pass in a `useDataConnectQueryOptions` object to the Query hook function. - const options = { staleTime: 5 * 1000 }; - const query = useListStaff(options); - - // You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object. - const dataConnect = getDataConnect(connectorConfig); - const options = { staleTime: 5 * 1000 }; - const query = useListStaff(dataConnect, options); - - // Then, you can render your component dynamically based on the status of the Query. - if (query.isPending) { - return
Loading...
; - } - - if (query.isError) { - return
Error: {query.error.message}
; - } - - // If the Query is successful, you can access the data returned using the `UseQueryResult.data` field. - if (query.isSuccess) { - console.log(query.data.staffs); - } - return
Query execution {query.isSuccess ? 'successful' : 'failed'}!
; -} -``` - ## listVendor You can execute the `listVendor` Query using the following Query hook function, which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts): @@ -481,6 +407,283 @@ export default function FilterVendorsComponent() { } ``` +## listVendorRate +You can execute the `listVendorRate` Query using the following Query hook function, which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts): + +```javascript +useListVendorRate(dc: DataConnect, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +``` +You can also pass in a `DataConnect` instance to the Query hook function. +```javascript +useListVendorRate(options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +``` + +### Variables +The `listVendorRate` Query has no variables. +### Return Type +Recall that calling the `listVendorRate` Query hook function returns a `UseQueryResult` object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things. + +To check the status of a Query, use the `UseQueryResult.status` field. You can also check for pending / success / error status using the `UseQueryResult.isPending`, `UseQueryResult.isSuccess`, and `UseQueryResult.isError` fields. + +To access the data returned by a Query, use the `UseQueryResult.data` field. The data for the `listVendorRate` Query is of type `ListVendorRateData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: +```javascript +export interface ListVendorRateData { + vendorRates: ({ + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + } & VendorRate_Key)[]; +} +``` + +To learn more about the `UseQueryResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery). + +### Using `listVendorRate`'s Query hook function + +```javascript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig } from '@dataconnect/generated'; +import { useListVendorRate } from '@dataconnect/generated/react' + +export default function ListVendorRateComponent() { + // You don't have to do anything to "execute" the Query. + // Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query. + const query = useListVendorRate(); + + // You can also pass in a `DataConnect` instance to the Query hook function. + const dataConnect = getDataConnect(connectorConfig); + const query = useListVendorRate(dataConnect); + + // You can also pass in a `useDataConnectQueryOptions` object to the Query hook function. + const options = { staleTime: 5 * 1000 }; + const query = useListVendorRate(options); + + // You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object. + const dataConnect = getDataConnect(connectorConfig); + const options = { staleTime: 5 * 1000 }; + const query = useListVendorRate(dataConnect, options); + + // Then, you can render your component dynamically based on the status of the Query. + if (query.isPending) { + return
Loading...
; + } + + if (query.isError) { + return
Error: {query.error.message}
; + } + + // If the Query is successful, you can access the data returned using the `UseQueryResult.data` field. + if (query.isSuccess) { + console.log(query.data.vendorRates); + } + return
Query execution {query.isSuccess ? 'successful' : 'failed'}!
; +} +``` + +## getVendorRateById +You can execute the `getVendorRateById` Query using the following Query hook function, which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts): + +```javascript +useGetVendorRateById(dc: DataConnect, vars: GetVendorRateByIdVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +``` +You can also pass in a `DataConnect` instance to the Query hook function. +```javascript +useGetVendorRateById(vars: GetVendorRateByIdVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +``` + +### Variables +The `getVendorRateById` Query requires an argument of type `GetVendorRateByIdVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: + +```javascript +export interface GetVendorRateByIdVariables { + id: UUIDString; +} +``` +### Return Type +Recall that calling the `getVendorRateById` Query hook function returns a `UseQueryResult` object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things. + +To check the status of a Query, use the `UseQueryResult.status` field. You can also check for pending / success / error status using the `UseQueryResult.isPending`, `UseQueryResult.isSuccess`, and `UseQueryResult.isError` fields. + +To access the data returned by a Query, use the `UseQueryResult.data` field. The data for the `getVendorRateById` Query is of type `GetVendorRateByIdData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: +```javascript +export interface GetVendorRateByIdData { + vendorRate?: { + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + createdDate?: TimestampString | null; + updatedDate?: TimestampString | null; + createdBy?: string | null; + } & VendorRate_Key; +} +``` + +To learn more about the `UseQueryResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery). + +### Using `getVendorRateById`'s Query hook function + +```javascript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, GetVendorRateByIdVariables } from '@dataconnect/generated'; +import { useGetVendorRateById } from '@dataconnect/generated/react' + +export default function GetVendorRateByIdComponent() { + // The `useGetVendorRateById` Query hook requires an argument of type `GetVendorRateByIdVariables`: + const getVendorRateByIdVars: GetVendorRateByIdVariables = { + id: ..., + }; + + // You don't have to do anything to "execute" the Query. + // Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query. + const query = useGetVendorRateById(getVendorRateByIdVars); + // Variables can be defined inline as well. + const query = useGetVendorRateById({ id: ..., }); + + // You can also pass in a `DataConnect` instance to the Query hook function. + const dataConnect = getDataConnect(connectorConfig); + const query = useGetVendorRateById(dataConnect, getVendorRateByIdVars); + + // You can also pass in a `useDataConnectQueryOptions` object to the Query hook function. + const options = { staleTime: 5 * 1000 }; + const query = useGetVendorRateById(getVendorRateByIdVars, options); + + // You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object. + const dataConnect = getDataConnect(connectorConfig); + const options = { staleTime: 5 * 1000 }; + const query = useGetVendorRateById(dataConnect, getVendorRateByIdVars, options); + + // Then, you can render your component dynamically based on the status of the Query. + if (query.isPending) { + return
Loading...
; + } + + if (query.isError) { + return
Error: {query.error.message}
; + } + + // If the Query is successful, you can access the data returned using the `UseQueryResult.data` field. + if (query.isSuccess) { + console.log(query.data.vendorRate); + } + return
Query execution {query.isSuccess ? 'successful' : 'failed'}!
; +} +``` + +## filterVendorRates +You can execute the `filterVendorRates` Query using the following Query hook function, which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts): + +```javascript +useFilterVendorRates(dc: DataConnect, vars?: FilterVendorRatesVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +``` +You can also pass in a `DataConnect` instance to the Query hook function. +```javascript +useFilterVendorRates(vars?: FilterVendorRatesVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +``` + +### Variables +The `filterVendorRates` Query has an optional argument of type `FilterVendorRatesVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: + +```javascript +export interface FilterVendorRatesVariables { + vendorName?: string | null; + category?: VendorRateCategory | null; + roleName?: string | null; + minClientRate?: number | null; + maxClientRate?: number | null; +} +``` +### Return Type +Recall that calling the `filterVendorRates` Query hook function returns a `UseQueryResult` object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things. + +To check the status of a Query, use the `UseQueryResult.status` field. You can also check for pending / success / error status using the `UseQueryResult.isPending`, `UseQueryResult.isSuccess`, and `UseQueryResult.isError` fields. + +To access the data returned by a Query, use the `UseQueryResult.data` field. The data for the `filterVendorRates` Query is of type `FilterVendorRatesData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: +```javascript +export interface FilterVendorRatesData { + vendorRates: ({ + id: UUIDString; + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; + } & VendorRate_Key)[]; +} +``` + +To learn more about the `UseQueryResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery). + +### Using `filterVendorRates`'s Query hook function + +```javascript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, FilterVendorRatesVariables } from '@dataconnect/generated'; +import { useFilterVendorRates } from '@dataconnect/generated/react' + +export default function FilterVendorRatesComponent() { + // The `useFilterVendorRates` Query hook has an optional argument of type `FilterVendorRatesVariables`: + const filterVendorRatesVars: FilterVendorRatesVariables = { + vendorName: ..., // optional + category: ..., // optional + roleName: ..., // optional + minClientRate: ..., // optional + maxClientRate: ..., // optional + }; + + // You don't have to do anything to "execute" the Query. + // Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query. + const query = useFilterVendorRates(filterVendorRatesVars); + // Variables can be defined inline as well. + const query = useFilterVendorRates({ vendorName: ..., category: ..., roleName: ..., minClientRate: ..., maxClientRate: ..., }); + // Since all variables are optional for this Query, you can omit the `FilterVendorRatesVariables` argument. + // (as long as you don't want to provide any `options`!) + const query = useFilterVendorRates(); + + // You can also pass in a `DataConnect` instance to the Query hook function. + const dataConnect = getDataConnect(connectorConfig); + const query = useFilterVendorRates(dataConnect, filterVendorRatesVars); + + // You can also pass in a `useDataConnectQueryOptions` object to the Query hook function. + const options = { staleTime: 5 * 1000 }; + const query = useFilterVendorRates(filterVendorRatesVars, options); + // If you'd like to provide options without providing any variables, you must + // pass `undefined` where you would normally pass the variables. + const query = useFilterVendorRates(undefined, options); + + // You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object. + const dataConnect = getDataConnect(connectorConfig); + const options = { staleTime: 5 * 1000 }; + const query = useFilterVendorRates(dataConnect, filterVendorRatesVars /** or undefined */, options); + + // Then, you can render your component dynamically based on the status of the Query. + if (query.isPending) { + return
Loading...
; + } + + if (query.isError) { + return
Error: {query.error.message}
; + } + + // If the Query is successful, you can access the data returned using the `UseQueryResult.data` field. + if (query.isSuccess) { + console.log(query.data.vendorRates); + } + return
Query execution {query.isSuccess ? 'successful' : 'failed'}!
; +} +``` + ## listEvents You can execute the `listEvents` Query using the following Query hook function, which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts): @@ -850,6 +1053,86 @@ export default function FilterEventsComponent() { } ``` +## listStaff +You can execute the `listStaff` Query using the following Query hook function, which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts): + +```javascript +useListStaff(dc: DataConnect, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +``` +You can also pass in a `DataConnect` instance to the Query hook function. +```javascript +useListStaff(options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +``` + +### Variables +The `listStaff` Query has no variables. +### Return Type +Recall that calling the `listStaff` Query hook function returns a `UseQueryResult` object. This object holds the state of your Query, including whether the Query is loading, has completed, or has succeeded/failed, and any data returned by the Query, among other things. + +To check the status of a Query, use the `UseQueryResult.status` field. You can also check for pending / success / error status using the `UseQueryResult.isPending`, `UseQueryResult.isSuccess`, and `UseQueryResult.isError` fields. + +To access the data returned by a Query, use the `UseQueryResult.data` field. The data for the `listStaff` Query is of type `ListStaffData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: +```javascript +export interface ListStaffData { + staffs: ({ + id: UUIDString; + employeeName: string; + vendorId?: UUIDString | null; + email?: string | null; + position?: string | null; + employmentType: EmploymentType; + rating?: number | null; + reliabilityScore?: number | null; + backgroundCheckStatus: BackgroundCheckStatus; + certifications?: string | null; + } & Staff_Key)[]; +} +``` + +To learn more about the `UseQueryResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useQuery). + +### Using `listStaff`'s Query hook function + +```javascript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig } from '@dataconnect/generated'; +import { useListStaff } from '@dataconnect/generated/react' + +export default function ListStaffComponent() { + // You don't have to do anything to "execute" the Query. + // Call the Query hook function to get a `UseQueryResult` object which holds the state of your Query. + const query = useListStaff(); + + // You can also pass in a `DataConnect` instance to the Query hook function. + const dataConnect = getDataConnect(connectorConfig); + const query = useListStaff(dataConnect); + + // You can also pass in a `useDataConnectQueryOptions` object to the Query hook function. + const options = { staleTime: 5 * 1000 }; + const query = useListStaff(options); + + // You can also pass both a `DataConnect` instance and a `useDataConnectQueryOptions` object. + const dataConnect = getDataConnect(connectorConfig); + const options = { staleTime: 5 * 1000 }; + const query = useListStaff(dataConnect, options); + + // Then, you can render your component dynamically based on the status of the Query. + if (query.isPending) { + return
Loading...
; + } + + if (query.isError) { + return
Error: {query.error.message}
; + } + + // If the Query is successful, you can access the data returned using the `UseQueryResult.data` field. + if (query.isSuccess) { + console.log(query.data.staffs); + } + return
Query execution {query.isSuccess ? 'successful' : 'failed'}!
; +} +``` + # Mutations The React generated SDK provides Mutations hook functions that call and return [`useDataConnectMutation`](https://react-query-firebase.invertase.dev/react/data-connect/mutations) hooks from TanStack Query Firebase. @@ -875,116 +1158,6 @@ Here's a general overview of how to use the generated Mutation hooks in your cod Below are examples of how to use the `krow-connector` connector's generated Mutation hook functions to execute each Mutation. You can also follow the examples from the [Data Connect documentation](https://firebase.google.com/docs/data-connect/web-sdk#operations-react-angular). -## CreateStaff -You can execute the `CreateStaff` Mutation using the `UseMutationResult` object returned by the following Mutation hook function (which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts)): -```javascript -useCreateStaff(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; -``` -You can also pass in a `DataConnect` instance to the Mutation hook function. -```javascript -useCreateStaff(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; -``` - -### Variables -The `CreateStaff` Mutation requires an argument of type `CreateStaffVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: - -```javascript -export interface CreateStaffVariables { - employeeName: string; - vendorId?: UUIDString | null; - email?: string | null; - position?: string | null; - employmentType: EmploymentType; - rating?: number | null; - reliabilityScore?: number | null; - backgroundCheckStatus: BackgroundCheckStatus; - certifications?: string | null; -} -``` -### Return Type -Recall that calling the `CreateStaff` Mutation hook function returns a `UseMutationResult` object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things. - -To check the status of a Mutation, use the `UseMutationResult.status` field. You can also check for pending / success / error status using the `UseMutationResult.isPending`, `UseMutationResult.isSuccess`, and `UseMutationResult.isError` fields. - -To execute the Mutation, call `UseMutationResult.mutate()`. This function executes the Mutation, but does not return the data from the Mutation. - -To access the data returned by a Mutation, use the `UseMutationResult.data` field. The data for the `CreateStaff` Mutation is of type `CreateStaffData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: -```javascript -export interface CreateStaffData { - staff_insert: Staff_Key; -} -``` - -To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation). - -### Using `CreateStaff`'s Mutation hook function - -```javascript -import { getDataConnect } from 'firebase/data-connect'; -import { connectorConfig, CreateStaffVariables } from '@dataconnect/generated'; -import { useCreateStaff } from '@dataconnect/generated/react' - -export default function CreateStaffComponent() { - // Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation. - const mutation = useCreateStaff(); - - // You can also pass in a `DataConnect` instance to the Mutation hook function. - const dataConnect = getDataConnect(connectorConfig); - const mutation = useCreateStaff(dataConnect); - - // You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function. - const options = { - onSuccess: () => { console.log('Mutation succeeded!'); } - }; - const mutation = useCreateStaff(options); - - // You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object. - const dataConnect = getDataConnect(connectorConfig); - const options = { - onSuccess: () => { console.log('Mutation succeeded!'); } - }; - const mutation = useCreateStaff(dataConnect, options); - - // After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation. - // The `useCreateStaff` Mutation requires an argument of type `CreateStaffVariables`: - const createStaffVars: CreateStaffVariables = { - employeeName: ..., - vendorId: ..., // optional - email: ..., // optional - position: ..., // optional - employmentType: ..., - rating: ..., // optional - reliabilityScore: ..., // optional - backgroundCheckStatus: ..., - certifications: ..., // optional - }; - mutation.mutate(createStaffVars); - // Variables can be defined inline as well. - mutation.mutate({ employeeName: ..., vendorId: ..., email: ..., position: ..., employmentType: ..., rating: ..., reliabilityScore: ..., backgroundCheckStatus: ..., certifications: ..., }); - - // You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`. - const options = { - onSuccess: () => { console.log('Mutation succeeded!'); } - }; - mutation.mutate(createStaffVars, options); - - // Then, you can render your component dynamically based on the status of the Mutation. - if (mutation.isPending) { - return
Loading...
; - } - - if (mutation.isError) { - return
Error: {mutation.error.message}
; - } - - // If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field. - if (mutation.isSuccess) { - console.log(mutation.data.staff_insert); - } - return
Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
; -} -``` - ## CreateVendor You can execute the `CreateVendor` Mutation using the `UseMutationResult` object returned by the following Mutation hook function (which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts)): ```javascript @@ -1293,6 +1466,314 @@ export default function DeleteVendorComponent() { } ``` +## CreateVendorRate +You can execute the `CreateVendorRate` Mutation using the `UseMutationResult` object returned by the following Mutation hook function (which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts)): +```javascript +useCreateVendorRate(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +``` +You can also pass in a `DataConnect` instance to the Mutation hook function. +```javascript +useCreateVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +``` + +### Variables +The `CreateVendorRate` Mutation requires an argument of type `CreateVendorRateVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: + +```javascript +export interface CreateVendorRateVariables { + vendorName: string; + category: VendorRateCategory; + roleName: string; + employeeWage: number; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate: number; +} +``` +### Return Type +Recall that calling the `CreateVendorRate` Mutation hook function returns a `UseMutationResult` object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things. + +To check the status of a Mutation, use the `UseMutationResult.status` field. You can also check for pending / success / error status using the `UseMutationResult.isPending`, `UseMutationResult.isSuccess`, and `UseMutationResult.isError` fields. + +To execute the Mutation, call `UseMutationResult.mutate()`. This function executes the Mutation, but does not return the data from the Mutation. + +To access the data returned by a Mutation, use the `UseMutationResult.data` field. The data for the `CreateVendorRate` Mutation is of type `CreateVendorRateData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: +```javascript +export interface CreateVendorRateData { + vendorRate_insert: VendorRate_Key; +} +``` + +To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation). + +### Using `CreateVendorRate`'s Mutation hook function + +```javascript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, CreateVendorRateVariables } from '@dataconnect/generated'; +import { useCreateVendorRate } from '@dataconnect/generated/react' + +export default function CreateVendorRateComponent() { + // Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation. + const mutation = useCreateVendorRate(); + + // You can also pass in a `DataConnect` instance to the Mutation hook function. + const dataConnect = getDataConnect(connectorConfig); + const mutation = useCreateVendorRate(dataConnect); + + // You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function. + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + const mutation = useCreateVendorRate(options); + + // You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object. + const dataConnect = getDataConnect(connectorConfig); + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + const mutation = useCreateVendorRate(dataConnect, options); + + // After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation. + // The `useCreateVendorRate` Mutation requires an argument of type `CreateVendorRateVariables`: + const createVendorRateVars: CreateVendorRateVariables = { + vendorName: ..., + category: ..., + roleName: ..., + employeeWage: ..., + markupPercentage: ..., // optional + vendorFeePercentage: ..., // optional + clientRate: ..., + }; + mutation.mutate(createVendorRateVars); + // Variables can be defined inline as well. + mutation.mutate({ vendorName: ..., category: ..., roleName: ..., employeeWage: ..., markupPercentage: ..., vendorFeePercentage: ..., clientRate: ..., }); + + // You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`. + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + mutation.mutate(createVendorRateVars, options); + + // Then, you can render your component dynamically based on the status of the Mutation. + if (mutation.isPending) { + return
Loading...
; + } + + if (mutation.isError) { + return
Error: {mutation.error.message}
; + } + + // If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field. + if (mutation.isSuccess) { + console.log(mutation.data.vendorRate_insert); + } + return
Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
; +} +``` + +## UpdateVendorRate +You can execute the `UpdateVendorRate` Mutation using the `UseMutationResult` object returned by the following Mutation hook function (which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts)): +```javascript +useUpdateVendorRate(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +``` +You can also pass in a `DataConnect` instance to the Mutation hook function. +```javascript +useUpdateVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +``` + +### Variables +The `UpdateVendorRate` Mutation requires an argument of type `UpdateVendorRateVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: + +```javascript +export interface UpdateVendorRateVariables { + id: UUIDString; + vendorName?: string | null; + category?: VendorRateCategory | null; + roleName?: string | null; + employeeWage?: number | null; + markupPercentage?: number | null; + vendorFeePercentage?: number | null; + clientRate?: number | null; +} +``` +### Return Type +Recall that calling the `UpdateVendorRate` Mutation hook function returns a `UseMutationResult` object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things. + +To check the status of a Mutation, use the `UseMutationResult.status` field. You can also check for pending / success / error status using the `UseMutationResult.isPending`, `UseMutationResult.isSuccess`, and `UseMutationResult.isError` fields. + +To execute the Mutation, call `UseMutationResult.mutate()`. This function executes the Mutation, but does not return the data from the Mutation. + +To access the data returned by a Mutation, use the `UseMutationResult.data` field. The data for the `UpdateVendorRate` Mutation is of type `UpdateVendorRateData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: +```javascript +export interface UpdateVendorRateData { + vendorRate_update?: VendorRate_Key | null; +} +``` + +To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation). + +### Using `UpdateVendorRate`'s Mutation hook function + +```javascript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, UpdateVendorRateVariables } from '@dataconnect/generated'; +import { useUpdateVendorRate } from '@dataconnect/generated/react' + +export default function UpdateVendorRateComponent() { + // Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation. + const mutation = useUpdateVendorRate(); + + // You can also pass in a `DataConnect` instance to the Mutation hook function. + const dataConnect = getDataConnect(connectorConfig); + const mutation = useUpdateVendorRate(dataConnect); + + // You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function. + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + const mutation = useUpdateVendorRate(options); + + // You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object. + const dataConnect = getDataConnect(connectorConfig); + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + const mutation = useUpdateVendorRate(dataConnect, options); + + // After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation. + // The `useUpdateVendorRate` Mutation requires an argument of type `UpdateVendorRateVariables`: + const updateVendorRateVars: UpdateVendorRateVariables = { + id: ..., + vendorName: ..., // optional + category: ..., // optional + roleName: ..., // optional + employeeWage: ..., // optional + markupPercentage: ..., // optional + vendorFeePercentage: ..., // optional + clientRate: ..., // optional + }; + mutation.mutate(updateVendorRateVars); + // Variables can be defined inline as well. + mutation.mutate({ id: ..., vendorName: ..., category: ..., roleName: ..., employeeWage: ..., markupPercentage: ..., vendorFeePercentage: ..., clientRate: ..., }); + + // You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`. + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + mutation.mutate(updateVendorRateVars, options); + + // Then, you can render your component dynamically based on the status of the Mutation. + if (mutation.isPending) { + return
Loading...
; + } + + if (mutation.isError) { + return
Error: {mutation.error.message}
; + } + + // If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field. + if (mutation.isSuccess) { + console.log(mutation.data.vendorRate_update); + } + return
Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
; +} +``` + +## DeleteVendorRate +You can execute the `DeleteVendorRate` Mutation using the `UseMutationResult` object returned by the following Mutation hook function (which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts)): +```javascript +useDeleteVendorRate(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +``` +You can also pass in a `DataConnect` instance to the Mutation hook function. +```javascript +useDeleteVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +``` + +### Variables +The `DeleteVendorRate` Mutation requires an argument of type `DeleteVendorRateVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: + +```javascript +export interface DeleteVendorRateVariables { + id: UUIDString; +} +``` +### Return Type +Recall that calling the `DeleteVendorRate` Mutation hook function returns a `UseMutationResult` object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things. + +To check the status of a Mutation, use the `UseMutationResult.status` field. You can also check for pending / success / error status using the `UseMutationResult.isPending`, `UseMutationResult.isSuccess`, and `UseMutationResult.isError` fields. + +To execute the Mutation, call `UseMutationResult.mutate()`. This function executes the Mutation, but does not return the data from the Mutation. + +To access the data returned by a Mutation, use the `UseMutationResult.data` field. The data for the `DeleteVendorRate` Mutation is of type `DeleteVendorRateData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: +```javascript +export interface DeleteVendorRateData { + vendorRate_delete?: VendorRate_Key | null; +} +``` + +To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation). + +### Using `DeleteVendorRate`'s Mutation hook function + +```javascript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, DeleteVendorRateVariables } from '@dataconnect/generated'; +import { useDeleteVendorRate } from '@dataconnect/generated/react' + +export default function DeleteVendorRateComponent() { + // Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation. + const mutation = useDeleteVendorRate(); + + // You can also pass in a `DataConnect` instance to the Mutation hook function. + const dataConnect = getDataConnect(connectorConfig); + const mutation = useDeleteVendorRate(dataConnect); + + // You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function. + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + const mutation = useDeleteVendorRate(options); + + // You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object. + const dataConnect = getDataConnect(connectorConfig); + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + const mutation = useDeleteVendorRate(dataConnect, options); + + // After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation. + // The `useDeleteVendorRate` Mutation requires an argument of type `DeleteVendorRateVariables`: + const deleteVendorRateVars: DeleteVendorRateVariables = { + id: ..., + }; + mutation.mutate(deleteVendorRateVars); + // Variables can be defined inline as well. + mutation.mutate({ id: ..., }); + + // You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`. + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + mutation.mutate(deleteVendorRateVars, options); + + // Then, you can render your component dynamically based on the status of the Mutation. + if (mutation.isPending) { + return
Loading...
; + } + + if (mutation.isError) { + return
Error: {mutation.error.message}
; + } + + // If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field. + if (mutation.isSuccess) { + console.log(mutation.data.vendorRate_delete); + } + return
Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
; +} +``` + ## CreateEvent You can execute the `CreateEvent` Mutation using the `UseMutationResult` object returned by the following Mutation hook function (which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts)): ```javascript @@ -1709,3 +2190,113 @@ export default function DeleteEventComponent() { } ``` +## CreateStaff +You can execute the `CreateStaff` Mutation using the `UseMutationResult` object returned by the following Mutation hook function (which is defined in [dataconnect-generated/react/index.d.ts](./index.d.ts)): +```javascript +useCreateStaff(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +``` +You can also pass in a `DataConnect` instance to the Mutation hook function. +```javascript +useCreateStaff(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +``` + +### Variables +The `CreateStaff` Mutation requires an argument of type `CreateStaffVariables`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: + +```javascript +export interface CreateStaffVariables { + employeeName: string; + vendorId?: UUIDString | null; + email?: string | null; + position?: string | null; + employmentType: EmploymentType; + rating?: number | null; + reliabilityScore?: number | null; + backgroundCheckStatus: BackgroundCheckStatus; + certifications?: string | null; +} +``` +### Return Type +Recall that calling the `CreateStaff` Mutation hook function returns a `UseMutationResult` object. This object holds the state of your Mutation, including whether the Mutation is loading, has completed, or has succeeded/failed, among other things. + +To check the status of a Mutation, use the `UseMutationResult.status` field. You can also check for pending / success / error status using the `UseMutationResult.isPending`, `UseMutationResult.isSuccess`, and `UseMutationResult.isError` fields. + +To execute the Mutation, call `UseMutationResult.mutate()`. This function executes the Mutation, but does not return the data from the Mutation. + +To access the data returned by a Mutation, use the `UseMutationResult.data` field. The data for the `CreateStaff` Mutation is of type `CreateStaffData`, which is defined in [dataconnect-generated/index.d.ts](../index.d.ts). It has the following fields: +```javascript +export interface CreateStaffData { + staff_insert: Staff_Key; +} +``` + +To learn more about the `UseMutationResult` object, see the [TanStack React Query documentation](https://tanstack.com/query/v5/docs/framework/react/reference/useMutation). + +### Using `CreateStaff`'s Mutation hook function + +```javascript +import { getDataConnect } from 'firebase/data-connect'; +import { connectorConfig, CreateStaffVariables } from '@dataconnect/generated'; +import { useCreateStaff } from '@dataconnect/generated/react' + +export default function CreateStaffComponent() { + // Call the Mutation hook function to get a `UseMutationResult` object which holds the state of your Mutation. + const mutation = useCreateStaff(); + + // You can also pass in a `DataConnect` instance to the Mutation hook function. + const dataConnect = getDataConnect(connectorConfig); + const mutation = useCreateStaff(dataConnect); + + // You can also pass in a `useDataConnectMutationOptions` object to the Mutation hook function. + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + const mutation = useCreateStaff(options); + + // You can also pass both a `DataConnect` instance and a `useDataConnectMutationOptions` object. + const dataConnect = getDataConnect(connectorConfig); + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + const mutation = useCreateStaff(dataConnect, options); + + // After calling the Mutation hook function, you must call `UseMutationResult.mutate()` to execute the Mutation. + // The `useCreateStaff` Mutation requires an argument of type `CreateStaffVariables`: + const createStaffVars: CreateStaffVariables = { + employeeName: ..., + vendorId: ..., // optional + email: ..., // optional + position: ..., // optional + employmentType: ..., + rating: ..., // optional + reliabilityScore: ..., // optional + backgroundCheckStatus: ..., + certifications: ..., // optional + }; + mutation.mutate(createStaffVars); + // Variables can be defined inline as well. + mutation.mutate({ employeeName: ..., vendorId: ..., email: ..., position: ..., employmentType: ..., rating: ..., reliabilityScore: ..., backgroundCheckStatus: ..., certifications: ..., }); + + // You can also pass in a `useDataConnectMutationOptions` object to `UseMutationResult.mutate()`. + const options = { + onSuccess: () => { console.log('Mutation succeeded!'); } + }; + mutation.mutate(createStaffVars, options); + + // Then, you can render your component dynamically based on the status of the Mutation. + if (mutation.isPending) { + return
Loading...
; + } + + if (mutation.isError) { + return
Error: {mutation.error.message}
; + } + + // If the Mutation is successful, you can access the data returned using the `UseMutationResult.data` field. + if (mutation.isSuccess) { + console.log(mutation.data.staff_insert); + } + return
Mutation execution {mutation.isSuccess ? 'successful' : 'failed'}!
; +} +``` + diff --git a/internal-api-harness/src/dataconnect-generated/react/esm/index.esm.js b/internal-api-harness/src/dataconnect-generated/react/esm/index.esm.js index ef730402..e0722a51 100644 --- a/internal-api-harness/src/dataconnect-generated/react/esm/index.esm.js +++ b/internal-api-harness/src/dataconnect-generated/react/esm/index.esm.js @@ -1,21 +1,7 @@ -import { createStaffRef, listStaffRef, createVendorRef, updateVendorRef, deleteVendorRef, listVendorRef, getVendorByIdRef, filterVendorsRef, createEventRef, updateEventRef, deleteEventRef, listEventsRef, getEventByIdRef, filterEventsRef, connectorConfig } from '../../esm/index.esm.js'; +import { createVendorRef, updateVendorRef, deleteVendorRef, listVendorRef, getVendorByIdRef, filterVendorsRef, createVendorRateRef, updateVendorRateRef, deleteVendorRateRef, listVendorRateRef, getVendorRateByIdRef, filterVendorRatesRef, createEventRef, updateEventRef, deleteEventRef, listEventsRef, getEventByIdRef, filterEventsRef, createStaffRef, listStaffRef, connectorConfig } from '../../esm/index.esm.js'; import { validateArgs, CallerSdkTypeEnum } from 'firebase/data-connect'; import { useDataConnectQuery, useDataConnectMutation, validateReactArgs } from '@tanstack-query-firebase/react/data-connect'; -export function useCreateStaff(dcOrOptions, options) { - const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); - function refFactory(vars) { - return createStaffRef(dcInstance, vars); - } - return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); -} - - -export function useListStaff(dcOrOptions, options) { - const { dc: dcInstance, options: inputOpts } = validateReactArgs(connectorConfig, dcOrOptions, options); - const ref = listStaffRef(dcInstance); - return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); -} export function useCreateVendor(dcOrOptions, options) { const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); function refFactory(vars) { @@ -58,6 +44,48 @@ export function useFilterVendors(dcOrVars, varsOrOptions, options) { const ref = filterVendorsRef(dcInstance, inputVars); return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); } +export function useCreateVendorRate(dcOrOptions, options) { + const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); + function refFactory(vars) { + return createVendorRateRef(dcInstance, vars); + } + return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + +export function useUpdateVendorRate(dcOrOptions, options) { + const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); + function refFactory(vars) { + return updateVendorRateRef(dcInstance, vars); + } + return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + +export function useDeleteVendorRate(dcOrOptions, options) { + const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); + function refFactory(vars) { + return deleteVendorRateRef(dcInstance, vars); + } + return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + + +export function useListVendorRate(dcOrOptions, options) { + const { dc: dcInstance, options: inputOpts } = validateReactArgs(connectorConfig, dcOrOptions, options); + const ref = listVendorRateRef(dcInstance); + return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + +export function useGetVendorRateById(dcOrVars, varsOrOptions, options) { + const { dc: dcInstance, vars: inputVars, options: inputOpts } = validateReactArgs(connectorConfig, dcOrVars, varsOrOptions, options, true, true); + const ref = getVendorRateByIdRef(dcInstance, inputVars); + return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + +export function useFilterVendorRates(dcOrVars, varsOrOptions, options) { + const { dc: dcInstance, vars: inputVars, options: inputOpts } = validateReactArgs(connectorConfig, dcOrVars, varsOrOptions, options, true, false); + const ref = filterVendorRatesRef(dcInstance, inputVars); + return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} export function useCreateEvent(dcOrOptions, options) { const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); function refFactory(vars) { @@ -99,4 +127,18 @@ export function useFilterEvents(dcOrVars, varsOrOptions, options) { const { dc: dcInstance, vars: inputVars, options: inputOpts } = validateReactArgs(connectorConfig, dcOrVars, varsOrOptions, options, true, false); const ref = filterEventsRef(dcInstance, inputVars); return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} +export function useCreateStaff(dcOrOptions, options) { + const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); + function refFactory(vars) { + return createStaffRef(dcInstance, vars); + } + return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + + +export function useListStaff(dcOrOptions, options) { + const { dc: dcInstance, options: inputOpts } = validateReactArgs(connectorConfig, dcOrOptions, options); + const ref = listStaffRef(dcInstance); + return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); } \ No newline at end of file diff --git a/internal-api-harness/src/dataconnect-generated/react/index.cjs.js b/internal-api-harness/src/dataconnect-generated/react/index.cjs.js index 8983af01..a4e8fecb 100644 --- a/internal-api-harness/src/dataconnect-generated/react/index.cjs.js +++ b/internal-api-harness/src/dataconnect-generated/react/index.cjs.js @@ -1,21 +1,7 @@ -const { createStaffRef, listStaffRef, createVendorRef, updateVendorRef, deleteVendorRef, listVendorRef, getVendorByIdRef, filterVendorsRef, createEventRef, updateEventRef, deleteEventRef, listEventsRef, getEventByIdRef, filterEventsRef, connectorConfig } = require('../index.cjs.js'); +const { createVendorRef, updateVendorRef, deleteVendorRef, listVendorRef, getVendorByIdRef, filterVendorsRef, createVendorRateRef, updateVendorRateRef, deleteVendorRateRef, listVendorRateRef, getVendorRateByIdRef, filterVendorRatesRef, createEventRef, updateEventRef, deleteEventRef, listEventsRef, getEventByIdRef, filterEventsRef, createStaffRef, listStaffRef, connectorConfig } = require('../index.cjs.js'); const { validateArgs, CallerSdkTypeEnum } = require('firebase/data-connect'); const { useDataConnectQuery, useDataConnectMutation, validateReactArgs } = require('@tanstack-query-firebase/react/data-connect'); -exports.useCreateStaff = function useCreateStaff(dcOrOptions, options) { - const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); - function refFactory(vars) { - return createStaffRef(dcInstance, vars); - } - return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); -} - - -exports.useListStaff = function useListStaff(dcOrOptions, options) { - const { dc: dcInstance, options: inputOpts } = validateReactArgs(connectorConfig, dcOrOptions, options); - const ref = listStaffRef(dcInstance); - return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); -} exports.useCreateVendor = function useCreateVendor(dcOrOptions, options) { const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); function refFactory(vars) { @@ -58,6 +44,48 @@ exports.useFilterVendors = function useFilterVendors(dcOrVars, varsOrOptions, op const ref = filterVendorsRef(dcInstance, inputVars); return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); } +exports.useCreateVendorRate = function useCreateVendorRate(dcOrOptions, options) { + const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); + function refFactory(vars) { + return createVendorRateRef(dcInstance, vars); + } + return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + +exports.useUpdateVendorRate = function useUpdateVendorRate(dcOrOptions, options) { + const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); + function refFactory(vars) { + return updateVendorRateRef(dcInstance, vars); + } + return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + +exports.useDeleteVendorRate = function useDeleteVendorRate(dcOrOptions, options) { + const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); + function refFactory(vars) { + return deleteVendorRateRef(dcInstance, vars); + } + return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + + +exports.useListVendorRate = function useListVendorRate(dcOrOptions, options) { + const { dc: dcInstance, options: inputOpts } = validateReactArgs(connectorConfig, dcOrOptions, options); + const ref = listVendorRateRef(dcInstance); + return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + +exports.useGetVendorRateById = function useGetVendorRateById(dcOrVars, varsOrOptions, options) { + const { dc: dcInstance, vars: inputVars, options: inputOpts } = validateReactArgs(connectorConfig, dcOrVars, varsOrOptions, options, true, true); + const ref = getVendorRateByIdRef(dcInstance, inputVars); + return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + +exports.useFilterVendorRates = function useFilterVendorRates(dcOrVars, varsOrOptions, options) { + const { dc: dcInstance, vars: inputVars, options: inputOpts } = validateReactArgs(connectorConfig, dcOrVars, varsOrOptions, options, true, false); + const ref = filterVendorRatesRef(dcInstance, inputVars); + return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} exports.useCreateEvent = function useCreateEvent(dcOrOptions, options) { const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); function refFactory(vars) { @@ -99,4 +127,18 @@ exports.useFilterEvents = function useFilterEvents(dcOrVars, varsOrOptions, opti const { dc: dcInstance, vars: inputVars, options: inputOpts } = validateReactArgs(connectorConfig, dcOrVars, varsOrOptions, options, true, false); const ref = filterEventsRef(dcInstance, inputVars); return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} +exports.useCreateStaff = function useCreateStaff(dcOrOptions, options) { + const { dc: dcInstance, vars: inputOpts } = validateArgs(connectorConfig, dcOrOptions, options); + function refFactory(vars) { + return createStaffRef(dcInstance, vars); + } + return useDataConnectMutation(refFactory, inputOpts, CallerSdkTypeEnum.GeneratedReact); +} + + +exports.useListStaff = function useListStaff(dcOrOptions, options) { + const { dc: dcInstance, options: inputOpts } = validateReactArgs(connectorConfig, dcOrOptions, options); + const ref = listStaffRef(dcInstance); + return useDataConnectQuery(ref, inputOpts, CallerSdkTypeEnum.GeneratedReact); } \ No newline at end of file diff --git a/internal-api-harness/src/dataconnect-generated/react/index.d.ts b/internal-api-harness/src/dataconnect-generated/react/index.d.ts index 8888c622..0cdeedc4 100644 --- a/internal-api-harness/src/dataconnect-generated/react/index.d.ts +++ b/internal-api-harness/src/dataconnect-generated/react/index.d.ts @@ -1,16 +1,10 @@ -import { CreateStaffData, CreateStaffVariables, ListStaffData, CreateVendorData, CreateVendorVariables, UpdateVendorData, UpdateVendorVariables, DeleteVendorData, DeleteVendorVariables, ListVendorData, GetVendorByIdData, GetVendorByIdVariables, FilterVendorsData, FilterVendorsVariables, CreateEventData, CreateEventVariables, UpdateEventData, UpdateEventVariables, DeleteEventData, DeleteEventVariables, ListEventsData, GetEventByIdData, GetEventByIdVariables, FilterEventsData, FilterEventsVariables } from '../'; +import { CreateVendorData, CreateVendorVariables, UpdateVendorData, UpdateVendorVariables, DeleteVendorData, DeleteVendorVariables, ListVendorData, GetVendorByIdData, GetVendorByIdVariables, FilterVendorsData, FilterVendorsVariables, CreateVendorRateData, CreateVendorRateVariables, UpdateVendorRateData, UpdateVendorRateVariables, DeleteVendorRateData, DeleteVendorRateVariables, ListVendorRateData, GetVendorRateByIdData, GetVendorRateByIdVariables, FilterVendorRatesData, FilterVendorRatesVariables, CreateEventData, CreateEventVariables, UpdateEventData, UpdateEventVariables, DeleteEventData, DeleteEventVariables, ListEventsData, GetEventByIdData, GetEventByIdVariables, FilterEventsData, FilterEventsVariables, CreateStaffData, CreateStaffVariables, ListStaffData } from '../'; import { UseDataConnectQueryResult, useDataConnectQueryOptions, UseDataConnectMutationResult, useDataConnectMutationOptions} from '@tanstack-query-firebase/react/data-connect'; import { UseQueryResult, UseMutationResult} from '@tanstack/react-query'; import { DataConnect } from 'firebase/data-connect'; import { FirebaseError } from 'firebase/app'; -export function useCreateStaff(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; -export function useCreateStaff(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; - -export function useListStaff(options?: useDataConnectQueryOptions): UseDataConnectQueryResult; -export function useListStaff(dc: DataConnect, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; - export function useCreateVendor(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; export function useCreateVendor(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; @@ -29,6 +23,24 @@ export function useGetVendorById(dc: DataConnect, vars: GetVendorByIdVariables, export function useFilterVendors(vars?: FilterVendorsVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; export function useFilterVendors(dc: DataConnect, vars?: FilterVendorsVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +export function useCreateVendorRate(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +export function useCreateVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; + +export function useUpdateVendorRate(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +export function useUpdateVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; + +export function useDeleteVendorRate(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +export function useDeleteVendorRate(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; + +export function useListVendorRate(options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +export function useListVendorRate(dc: DataConnect, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; + +export function useGetVendorRateById(vars: GetVendorRateByIdVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +export function useGetVendorRateById(dc: DataConnect, vars: GetVendorRateByIdVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; + +export function useFilterVendorRates(vars?: FilterVendorRatesVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +export function useFilterVendorRates(dc: DataConnect, vars?: FilterVendorRatesVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; + export function useCreateEvent(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; export function useCreateEvent(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; @@ -46,3 +58,9 @@ export function useGetEventById(dc: DataConnect, vars: GetEventByIdVariables, op export function useFilterEvents(vars?: FilterEventsVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; export function useFilterEvents(dc: DataConnect, vars?: FilterEventsVariables, options?: useDataConnectQueryOptions): UseDataConnectQueryResult; + +export function useCreateStaff(options?: useDataConnectMutationOptions): UseDataConnectMutationResult; +export function useCreateStaff(dc: DataConnect, options?: useDataConnectMutationOptions): UseDataConnectMutationResult; + +export function useListStaff(options?: useDataConnectQueryOptions): UseDataConnectQueryResult; +export function useListStaff(dc: DataConnect, options?: useDataConnectQueryOptions): UseDataConnectQueryResult;