aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/webui/src/gql/conf/fragment-masking.ts44
-rw-r--r--src/main/webui/src/gql/conf/gql.ts16
-rw-r--r--src/main/webui/src/gql/conf/graphql.ts132
3 files changed, 172 insertions, 20 deletions
diff --git a/src/main/webui/src/gql/conf/fragment-masking.ts b/src/main/webui/src/gql/conf/fragment-masking.ts
index 9881c7d..4bae142 100644
--- a/src/main/webui/src/gql/conf/fragment-masking.ts
+++ b/src/main/webui/src/gql/conf/fragment-masking.ts
@@ -1,46 +1,50 @@
/* eslint-disable */
import {
ResultOf,
- TypedDocumentNode as DocumentNode,
+ DocumentTypeDecoration,
} from "@graphql-typed-document-node/core";
-export type FragmentType<TDocumentType extends DocumentNode<any, any>> =
- TDocumentType extends DocumentNode<infer TType, any>
- ? TType extends { " $fragmentName"?: infer TKey }
- ? TKey extends string
- ? { " $fragmentRefs"?: { [key in TKey]: TType } }
- : never
+export type FragmentType<
+ TDocumentType extends DocumentTypeDecoration<any, any>,
+> = TDocumentType extends DocumentTypeDecoration<infer TType, any>
+ ? TType extends { " $fragmentName"?: infer TKey }
+ ? TKey extends string
+ ? { " $fragmentRefs"?: { [key in TKey]: TType } }
: never
- : never;
+ : never
+ : never;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
- _documentNode: DocumentNode<TType, any>,
- fragmentType: FragmentType<DocumentNode<TType, any>>,
+ _documentNode: DocumentTypeDecoration<TType, any>,
+ fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>,
): TType;
// return nullable if `fragmentType` is nullable
export function useFragment<TType>(
- _documentNode: DocumentNode<TType, any>,
- fragmentType: FragmentType<DocumentNode<TType, any>> | null | undefined,
+ _documentNode: DocumentTypeDecoration<TType, any>,
+ fragmentType:
+ | FragmentType<DocumentTypeDecoration<TType, any>>
+ | null
+ | undefined,
): TType | null | undefined;
// return array of non-nullable if `fragmentType` is array of non-nullable
export function useFragment<TType>(
- _documentNode: DocumentNode<TType, any>,
- fragmentType: ReadonlyArray<FragmentType<DocumentNode<TType, any>>>,
+ _documentNode: DocumentTypeDecoration<TType, any>,
+ fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>,
): ReadonlyArray<TType>;
// return array of nullable if `fragmentType` is array of nullable
export function useFragment<TType>(
- _documentNode: DocumentNode<TType, any>,
+ _documentNode: DocumentTypeDecoration<TType, any>,
fragmentType:
- | ReadonlyArray<FragmentType<DocumentNode<TType, any>>>
+ | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
| null
| undefined,
): ReadonlyArray<TType> | null | undefined;
export function useFragment<TType>(
- _documentNode: DocumentNode<TType, any>,
+ _documentNode: DocumentTypeDecoration<TType, any>,
fragmentType:
- | FragmentType<DocumentNode<TType, any>>
- | ReadonlyArray<FragmentType<DocumentNode<TType, any>>>
+ | FragmentType<DocumentTypeDecoration<TType, any>>
+ | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
| null
| undefined,
): TType | ReadonlyArray<TType> | null | undefined {
@@ -48,7 +52,7 @@ export function useFragment<TType>(
}
export function makeFragmentData<
- F extends DocumentNode,
+ F extends DocumentTypeDecoration<any, any>,
FT extends ResultOf<F>,
>(data: FT, _fragment: F): FragmentType<F> {
return data as FragmentType<F>;
diff --git a/src/main/webui/src/gql/conf/gql.ts b/src/main/webui/src/gql/conf/gql.ts
index 80a0ed4..0f4ec68 100644
--- a/src/main/webui/src/gql/conf/gql.ts
+++ b/src/main/webui/src/gql/conf/gql.ts
@@ -18,6 +18,10 @@ const documents = {
types.AllItemsDocument,
"\n mutation storeItem(\n $id: String\n $name: String\n $description: String\n $quantity: Float!\n $quantityUnitType: String\n ) {\n storeItem(\n item: {\n id: $id\n name: $name\n description: $description\n quantity: $quantity\n quantityUnitType: $quantityUnitType\n }\n ) {\n id\n name\n description\n quantity\n quantityUnitType\n }\n }\n":
types.StoreItemDocument,
+ "\n query allLabels {\n allLabels {\n id\n title\n color\n }\n }\n":
+ types.AllLabelsDocument,
+ "\n mutation syncLabels(\n $labels: [PantryItemLabelInput]\n ) {\n syncLabels(\n labels: $labels\n ) {\n id\n title\n color\n }\n }\n":
+ types.SyncLabelsDocument,
};
/**
@@ -46,6 +50,18 @@ export function graphql(
export function graphql(
source: "\n mutation storeItem(\n $id: String\n $name: String\n $description: String\n $quantity: Float!\n $quantityUnitType: String\n ) {\n storeItem(\n item: {\n id: $id\n name: $name\n description: $description\n quantity: $quantity\n quantityUnitType: $quantityUnitType\n }\n ) {\n id\n name\n description\n quantity\n quantityUnitType\n }\n }\n",
): (typeof documents)["\n mutation storeItem(\n $id: String\n $name: String\n $description: String\n $quantity: Float!\n $quantityUnitType: String\n ) {\n storeItem(\n item: {\n id: $id\n name: $name\n description: $description\n quantity: $quantity\n quantityUnitType: $quantityUnitType\n }\n ) {\n id\n name\n description\n quantity\n quantityUnitType\n }\n }\n"];
+/**
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
+ */
+export function graphql(
+ source: "\n query allLabels {\n allLabels {\n id\n title\n color\n }\n }\n",
+): (typeof documents)["\n query allLabels {\n allLabels {\n id\n title\n color\n }\n }\n"];
+/**
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
+ */
+export function graphql(
+ source: "\n mutation syncLabels(\n $labels: [PantryItemLabelInput]\n ) {\n syncLabels(\n labels: $labels\n ) {\n id\n title\n color\n }\n }\n",
+): (typeof documents)["\n mutation syncLabels(\n $labels: [PantryItemLabelInput]\n ) {\n syncLabels(\n labels: $labels\n ) {\n id\n title\n color\n }\n }\n"];
export function graphql(source: string) {
return (documents as any)[source] ?? {};
diff --git a/src/main/webui/src/gql/conf/graphql.ts b/src/main/webui/src/gql/conf/graphql.ts
index 2474e0f..8cf0870 100644
--- a/src/main/webui/src/gql/conf/graphql.ts
+++ b/src/main/webui/src/gql/conf/graphql.ts
@@ -27,6 +27,8 @@ export type Mutation = {
deleteItem?: Maybe<Scalars["Boolean"]>;
/** Store an item in the pantry */
storeItem?: Maybe<PantryItem>;
+ /** Create any new labels from list of labels */
+ syncLabels?: Maybe<Array<Maybe<PantryItemLabel>>>;
};
/** Mutation root */
@@ -39,10 +41,16 @@ export type MutationStoreItemArgs = {
item?: InputMaybe<PantryItemInput>;
};
+/** Mutation root */
+export type MutationSyncLabelsArgs = {
+ labels?: InputMaybe<Array<InputMaybe<PantryItemLabelInput>>>;
+};
+
export type PantryItem = {
__typename?: "PantryItem";
description?: Maybe<Scalars["String"]>;
id?: Maybe<Scalars["String"]>;
+ labels?: Maybe<Array<Maybe<Scalars["String"]>>>;
name?: Maybe<Scalars["String"]>;
quantity: Scalars["Float"];
quantityUnitType?: Maybe<Scalars["String"]>;
@@ -51,16 +59,32 @@ export type PantryItem = {
export type PantryItemInput = {
description?: InputMaybe<Scalars["String"]>;
id?: InputMaybe<Scalars["String"]>;
+ labels?: InputMaybe<Array<InputMaybe<Scalars["String"]>>>;
name?: InputMaybe<Scalars["String"]>;
quantity: Scalars["Float"];
quantityUnitType?: InputMaybe<Scalars["String"]>;
};
+export type PantryItemLabel = {
+ __typename?: "PantryItemLabel";
+ color?: Maybe<Scalars["String"]>;
+ id?: Maybe<Scalars["String"]>;
+ title?: Maybe<Scalars["String"]>;
+};
+
+export type PantryItemLabelInput = {
+ color?: InputMaybe<Scalars["String"]>;
+ id?: InputMaybe<Scalars["String"]>;
+ title?: InputMaybe<Scalars["String"]>;
+};
+
/** Query root */
export type Query = {
__typename?: "Query";
/** Get all items stored in the pantry */
allItems?: Maybe<Array<Maybe<PantryItem>>>;
+ /** Get all labels that can be assigned to items */
+ allLabels?: Maybe<Array<Maybe<PantryItemLabel>>>;
/** Get an item stored in the pantry */
item?: Maybe<PantryItem>;
};
@@ -104,6 +128,34 @@ export type StoreItemMutation = {
} | null;
};
+export type AllLabelsQueryVariables = Exact<{ [key: string]: never }>;
+
+export type AllLabelsQuery = {
+ __typename?: "Query";
+ allLabels?: Array<{
+ __typename?: "PantryItemLabel";
+ id?: string | null;
+ title?: string | null;
+ color?: string | null;
+ } | null> | null;
+};
+
+export type SyncLabelsMutationVariables = Exact<{
+ labels?: InputMaybe<
+ Array<InputMaybe<PantryItemLabelInput>> | InputMaybe<PantryItemLabelInput>
+ >;
+}>;
+
+export type SyncLabelsMutation = {
+ __typename?: "Mutation";
+ syncLabels?: Array<{
+ __typename?: "PantryItemLabel";
+ id?: string | null;
+ title?: string | null;
+ color?: string | null;
+ } | null> | null;
+};
+
export const AllItemsDocument = {
kind: "Document",
definitions: [
@@ -258,3 +310,83 @@ export const StoreItemDocument = {
},
],
} as unknown as DocumentNode<StoreItemMutation, StoreItemMutationVariables>;
+export const AllLabelsDocument = {
+ kind: "Document",
+ definitions: [
+ {
+ kind: "OperationDefinition",
+ operation: "query",
+ name: { kind: "Name", value: "allLabels" },
+ selectionSet: {
+ kind: "SelectionSet",
+ selections: [
+ {
+ kind: "Field",
+ name: { kind: "Name", value: "allLabels" },
+ selectionSet: {
+ kind: "SelectionSet",
+ selections: [
+ { kind: "Field", name: { kind: "Name", value: "id" } },
+ { kind: "Field", name: { kind: "Name", value: "title" } },
+ { kind: "Field", name: { kind: "Name", value: "color" } },
+ ],
+ },
+ },
+ ],
+ },
+ },
+ ],
+} as unknown as DocumentNode<AllLabelsQuery, AllLabelsQueryVariables>;
+export const SyncLabelsDocument = {
+ kind: "Document",
+ definitions: [
+ {
+ kind: "OperationDefinition",
+ operation: "mutation",
+ name: { kind: "Name", value: "syncLabels" },
+ variableDefinitions: [
+ {
+ kind: "VariableDefinition",
+ variable: {
+ kind: "Variable",
+ name: { kind: "Name", value: "labels" },
+ },
+ type: {
+ kind: "ListType",
+ type: {
+ kind: "NamedType",
+ name: { kind: "Name", value: "PantryItemLabelInput" },
+ },
+ },
+ },
+ ],
+ selectionSet: {
+ kind: "SelectionSet",
+ selections: [
+ {
+ kind: "Field",
+ name: { kind: "Name", value: "syncLabels" },
+ arguments: [
+ {
+ kind: "Argument",
+ name: { kind: "Name", value: "labels" },
+ value: {
+ kind: "Variable",
+ name: { kind: "Name", value: "labels" },
+ },
+ },
+ ],
+ selectionSet: {
+ kind: "SelectionSet",
+ selections: [
+ { kind: "Field", name: { kind: "Name", value: "id" } },
+ { kind: "Field", name: { kind: "Name", value: "title" } },
+ { kind: "Field", name: { kind: "Name", value: "color" } },
+ ],
+ },
+ },
+ ],
+ },
+ },
+ ],
+} as unknown as DocumentNode<SyncLabelsMutation, SyncLabelsMutationVariables>;