@zeroin.earth/appwrite-graphql 0.15.1 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -43,7 +43,7 @@ type Scalars = {
43
43
  output: any;
44
44
  };
45
45
  };
46
- type Account_UserFragmentFragment = {
46
+ type Account_UserFragment = {
47
47
  __typename?: 'User';
48
48
  _id?: string | null;
49
49
  name?: string | null;
@@ -53,14 +53,14 @@ type Account_UserFragmentFragment = {
53
53
  data?: any | null;
54
54
  } | null;
55
55
  } & {
56
- ' $fragmentName'?: 'Account_UserFragmentFragment';
56
+ ' $fragmentName'?: 'Account_UserFragment';
57
57
  };
58
- type Identity_ProviderFragmentFragment = {
58
+ type Identity_ProviderFragment = {
59
59
  __typename?: 'Identity';
60
60
  userId?: string | null;
61
61
  provider?: string | null;
62
62
  } & {
63
- ' $fragmentName'?: 'Identity_ProviderFragmentFragment';
63
+ ' $fragmentName'?: 'Identity_ProviderFragment';
64
64
  };
65
65
  type GetSessionQueryVariables = Exact<{
66
66
  sessionId: Scalars['String']['input'];
@@ -111,7 +111,7 @@ declare function useAccount<Preferences extends Models.Preferences>(): _tanstack
111
111
  __typename?: "User";
112
112
  } & {
113
113
  ' $fragmentRefs'?: {
114
- Account_UserFragmentFragment: Account_UserFragmentFragment;
114
+ Account_UserFragment: Account_UserFragment;
115
115
  };
116
116
  }, AppwriteException>;
117
117
 
@@ -2117,7 +2117,7 @@ declare function useListIdentities({ queries }: ListIdentitiesQueryVariables): {
2117
2117
  __typename?: "Identity";
2118
2118
  } & {
2119
2119
  ' $fragmentRefs'?: {
2120
- Identity_ProviderFragmentFragment: Identity_ProviderFragmentFragment;
2120
+ Identity_ProviderFragment: Identity_ProviderFragment;
2121
2121
  };
2122
2122
  })[];
2123
2123
  };
@@ -2149,7 +2149,7 @@ declare function useListIdentities({ queries }: ListIdentitiesQueryVariables): {
2149
2149
  __typename?: "Identity";
2150
2150
  } & {
2151
2151
  ' $fragmentRefs'?: {
2152
- Identity_ProviderFragmentFragment: Identity_ProviderFragmentFragment;
2152
+ Identity_ProviderFragment: Identity_ProviderFragment;
2153
2153
  };
2154
2154
  })[];
2155
2155
  }, AppwriteException>>;
@@ -2162,7 +2162,7 @@ declare function useListIdentities({ queries }: ListIdentitiesQueryVariables): {
2162
2162
  __typename?: "Identity";
2163
2163
  } & {
2164
2164
  ' $fragmentRefs'?: {
2165
- Identity_ProviderFragmentFragment: Identity_ProviderFragmentFragment;
2165
+ Identity_ProviderFragment: Identity_ProviderFragment;
2166
2166
  };
2167
2167
  })[];
2168
2168
  };
@@ -2194,7 +2194,7 @@ declare function useListIdentities({ queries }: ListIdentitiesQueryVariables): {
2194
2194
  __typename?: "Identity";
2195
2195
  } & {
2196
2196
  ' $fragmentRefs'?: {
2197
- Identity_ProviderFragmentFragment: Identity_ProviderFragmentFragment;
2197
+ Identity_ProviderFragment: Identity_ProviderFragment;
2198
2198
  };
2199
2199
  })[];
2200
2200
  }, AppwriteException>>;
@@ -2229,7 +2229,7 @@ declare function useListIdentities({ queries }: ListIdentitiesQueryVariables): {
2229
2229
  __typename?: "Identity";
2230
2230
  } & {
2231
2231
  ' $fragmentRefs'?: {
2232
- Identity_ProviderFragmentFragment: Identity_ProviderFragmentFragment;
2232
+ Identity_ProviderFragment: Identity_ProviderFragment;
2233
2233
  };
2234
2234
  })[];
2235
2235
  }, AppwriteException>>;
@@ -2264,7 +2264,7 @@ declare function useListIdentities({ queries }: ListIdentitiesQueryVariables): {
2264
2264
  __typename?: "Identity";
2265
2265
  } & {
2266
2266
  ' $fragmentRefs'?: {
2267
- Identity_ProviderFragmentFragment: Identity_ProviderFragmentFragment;
2267
+ Identity_ProviderFragment: Identity_ProviderFragment;
2268
2268
  };
2269
2269
  })[];
2270
2270
  }, AppwriteException>>;
@@ -2299,7 +2299,7 @@ declare function useListIdentities({ queries }: ListIdentitiesQueryVariables): {
2299
2299
  __typename?: "Identity";
2300
2300
  } & {
2301
2301
  ' $fragmentRefs'?: {
2302
- Identity_ProviderFragmentFragment: Identity_ProviderFragmentFragment;
2302
+ Identity_ProviderFragment: Identity_ProviderFragment;
2303
2303
  };
2304
2304
  })[];
2305
2305
  }, AppwriteException>>;
@@ -5909,9 +5909,11 @@ declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TT
5909
5909
  declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>): ReadonlyArray<TType>;
5910
5910
  declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined): ReadonlyArray<TType> | null | undefined;
5911
5911
 
5912
- declare const fragments: {
5913
- Account_UserFragment: _graphql_typed_document_node_core.TypedDocumentNode<Account_UserFragmentFragment, unknown>;
5914
- Identity_ProviderFragment: _graphql_typed_document_node_core.TypedDocumentNode<Identity_ProviderFragmentFragment, unknown>;
5915
- };
5912
+ declare namespace fragments {
5913
+ const Account_UserFragment: _graphql_typed_document_node_core.TypedDocumentNode<Account_UserFragment, unknown>;
5914
+ type Account_UserFragmentType = Account_UserFragment;
5915
+ const Identity_ProviderFragment: _graphql_typed_document_node_core.TypedDocumentNode<Identity_ProviderFragment, unknown>;
5916
+ type Identity_ProviderFragmentType = Identity_ProviderFragment;
5917
+ }
5916
5918
 
5917
5919
  export { fragments, getFragmentData, useAccount, useAppwrite, useCollection, useCreateAnonymousSession, useCreateDocument, useCreateEmailToken, useCreateJWT, useCreateMagicURLToken, useCreateMfaAuthenticator, useCreateMfaChallenge, useCreateMfaRecoveryCodes, useCreatePhoneToken, useCreatePhoneVerification, useCreateSession, useDeleteDocument, useDeleteIdentity, useDeleteMfaAuthenticator, useDeleteSession, useDeleteSessions, useDocument, useFunction, useGetMfaRecoveryCodes, useGetPrefs, useGetSession, useListIdentities, useListMfaFactors, useListSessions, useLogin, useLogout, useLogs, useMutation, usePasswordRecovery, useQuery, useQueryClient, useResetPassword, useSignUp, useSuspenseCollection, useSuspenseCreateJWT, useSuspenseFunction, useUpdateDocument, useUpdateEmail, useUpdateMagicURLSession, useUpdateMfa, useUpdateMfaAuthenticator, useUpdateMfaChallenge, useUpdateMfaRecoveryCodes, useUpdateName, useUpdatePassword, useUpdatePhone, useUpdatePhoneSession, useUpdatePhoneVerification, useUpdatePrefs, useUpdateSession, useVerification };
package/dist/index.d.ts CHANGED
@@ -43,7 +43,7 @@ type Scalars = {
43
43
  output: any;
44
44
  };
45
45
  };
46
- type Account_UserFragmentFragment = {
46
+ type Account_UserFragment = {
47
47
  __typename?: 'User';
48
48
  _id?: string | null;
49
49
  name?: string | null;
@@ -53,14 +53,14 @@ type Account_UserFragmentFragment = {
53
53
  data?: any | null;
54
54
  } | null;
55
55
  } & {
56
- ' $fragmentName'?: 'Account_UserFragmentFragment';
56
+ ' $fragmentName'?: 'Account_UserFragment';
57
57
  };
58
- type Identity_ProviderFragmentFragment = {
58
+ type Identity_ProviderFragment = {
59
59
  __typename?: 'Identity';
60
60
  userId?: string | null;
61
61
  provider?: string | null;
62
62
  } & {
63
- ' $fragmentName'?: 'Identity_ProviderFragmentFragment';
63
+ ' $fragmentName'?: 'Identity_ProviderFragment';
64
64
  };
65
65
  type GetSessionQueryVariables = Exact<{
66
66
  sessionId: Scalars['String']['input'];
@@ -111,7 +111,7 @@ declare function useAccount<Preferences extends Models.Preferences>(): _tanstack
111
111
  __typename?: "User";
112
112
  } & {
113
113
  ' $fragmentRefs'?: {
114
- Account_UserFragmentFragment: Account_UserFragmentFragment;
114
+ Account_UserFragment: Account_UserFragment;
115
115
  };
116
116
  }, AppwriteException>;
117
117
 
@@ -2117,7 +2117,7 @@ declare function useListIdentities({ queries }: ListIdentitiesQueryVariables): {
2117
2117
  __typename?: "Identity";
2118
2118
  } & {
2119
2119
  ' $fragmentRefs'?: {
2120
- Identity_ProviderFragmentFragment: Identity_ProviderFragmentFragment;
2120
+ Identity_ProviderFragment: Identity_ProviderFragment;
2121
2121
  };
2122
2122
  })[];
2123
2123
  };
@@ -2149,7 +2149,7 @@ declare function useListIdentities({ queries }: ListIdentitiesQueryVariables): {
2149
2149
  __typename?: "Identity";
2150
2150
  } & {
2151
2151
  ' $fragmentRefs'?: {
2152
- Identity_ProviderFragmentFragment: Identity_ProviderFragmentFragment;
2152
+ Identity_ProviderFragment: Identity_ProviderFragment;
2153
2153
  };
2154
2154
  })[];
2155
2155
  }, AppwriteException>>;
@@ -2162,7 +2162,7 @@ declare function useListIdentities({ queries }: ListIdentitiesQueryVariables): {
2162
2162
  __typename?: "Identity";
2163
2163
  } & {
2164
2164
  ' $fragmentRefs'?: {
2165
- Identity_ProviderFragmentFragment: Identity_ProviderFragmentFragment;
2165
+ Identity_ProviderFragment: Identity_ProviderFragment;
2166
2166
  };
2167
2167
  })[];
2168
2168
  };
@@ -2194,7 +2194,7 @@ declare function useListIdentities({ queries }: ListIdentitiesQueryVariables): {
2194
2194
  __typename?: "Identity";
2195
2195
  } & {
2196
2196
  ' $fragmentRefs'?: {
2197
- Identity_ProviderFragmentFragment: Identity_ProviderFragmentFragment;
2197
+ Identity_ProviderFragment: Identity_ProviderFragment;
2198
2198
  };
2199
2199
  })[];
2200
2200
  }, AppwriteException>>;
@@ -2229,7 +2229,7 @@ declare function useListIdentities({ queries }: ListIdentitiesQueryVariables): {
2229
2229
  __typename?: "Identity";
2230
2230
  } & {
2231
2231
  ' $fragmentRefs'?: {
2232
- Identity_ProviderFragmentFragment: Identity_ProviderFragmentFragment;
2232
+ Identity_ProviderFragment: Identity_ProviderFragment;
2233
2233
  };
2234
2234
  })[];
2235
2235
  }, AppwriteException>>;
@@ -2264,7 +2264,7 @@ declare function useListIdentities({ queries }: ListIdentitiesQueryVariables): {
2264
2264
  __typename?: "Identity";
2265
2265
  } & {
2266
2266
  ' $fragmentRefs'?: {
2267
- Identity_ProviderFragmentFragment: Identity_ProviderFragmentFragment;
2267
+ Identity_ProviderFragment: Identity_ProviderFragment;
2268
2268
  };
2269
2269
  })[];
2270
2270
  }, AppwriteException>>;
@@ -2299,7 +2299,7 @@ declare function useListIdentities({ queries }: ListIdentitiesQueryVariables): {
2299
2299
  __typename?: "Identity";
2300
2300
  } & {
2301
2301
  ' $fragmentRefs'?: {
2302
- Identity_ProviderFragmentFragment: Identity_ProviderFragmentFragment;
2302
+ Identity_ProviderFragment: Identity_ProviderFragment;
2303
2303
  };
2304
2304
  })[];
2305
2305
  }, AppwriteException>>;
@@ -5909,9 +5909,11 @@ declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TT
5909
5909
  declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>): ReadonlyArray<TType>;
5910
5910
  declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined): ReadonlyArray<TType> | null | undefined;
5911
5911
 
5912
- declare const fragments: {
5913
- Account_UserFragment: _graphql_typed_document_node_core.TypedDocumentNode<Account_UserFragmentFragment, unknown>;
5914
- Identity_ProviderFragment: _graphql_typed_document_node_core.TypedDocumentNode<Identity_ProviderFragmentFragment, unknown>;
5915
- };
5912
+ declare namespace fragments {
5913
+ const Account_UserFragment: _graphql_typed_document_node_core.TypedDocumentNode<Account_UserFragment, unknown>;
5914
+ type Account_UserFragmentType = Account_UserFragment;
5915
+ const Identity_ProviderFragment: _graphql_typed_document_node_core.TypedDocumentNode<Identity_ProviderFragment, unknown>;
5916
+ type Identity_ProviderFragmentType = Identity_ProviderFragment;
5917
+ }
5916
5918
 
5917
5919
  export { fragments, getFragmentData, useAccount, useAppwrite, useCollection, useCreateAnonymousSession, useCreateDocument, useCreateEmailToken, useCreateJWT, useCreateMagicURLToken, useCreateMfaAuthenticator, useCreateMfaChallenge, useCreateMfaRecoveryCodes, useCreatePhoneToken, useCreatePhoneVerification, useCreateSession, useDeleteDocument, useDeleteIdentity, useDeleteMfaAuthenticator, useDeleteSession, useDeleteSessions, useDocument, useFunction, useGetMfaRecoveryCodes, useGetPrefs, useGetSession, useListIdentities, useListMfaFactors, useListSessions, useLogin, useLogout, useLogs, useMutation, usePasswordRecovery, useQuery, useQueryClient, useResetPassword, useSignUp, useSuspenseCollection, useSuspenseCreateJWT, useSuspenseFunction, useUpdateDocument, useUpdateEmail, useUpdateMagicURLSession, useUpdateMfa, useUpdateMfaAuthenticator, useUpdateMfaChallenge, useUpdateMfaRecoveryCodes, useUpdateName, useUpdatePassword, useUpdatePhone, useUpdatePhoneSession, useUpdatePhoneVerification, useUpdatePrefs, useUpdateSession, useVerification };
package/dist/index.js CHANGED
@@ -78,101 +78,15 @@ __export(src_exports, {
78
78
  });
79
79
  module.exports = __toCommonJS(src_exports);
80
80
 
81
- // src/useAppwrite.ts
82
- var import_react = require("react");
83
- var import_appwrite = require("appwrite");
84
- var import_graphql = require("graphql");
85
- var import_jotai = require("jotai");
86
- var client = new import_appwrite.Client();
87
- var endpoint = process.env.APPWRITE_ENDPOINT ?? process.env.NEXT_PUBLIC_APPWRITE_URL ?? "http://localhost/v1";
88
- var projectId = process.env.APPWRITE_PROJECT_ID ?? process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID ?? "[PROJECT_ID]";
89
- client.setEndpoint(endpoint).setProject(projectId);
90
- var account = new import_appwrite.Account(client);
91
- var databases = new import_appwrite.Databases(client);
92
- var functions = new import_appwrite.Functions(client);
93
- var graphql = new import_appwrite.Graphql(client);
94
- var AccountAtom = (0, import_jotai.atom)(account);
95
- var DatabasesAtom = (0, import_jotai.atom)(databases);
96
- var FunctionsAtom = (0, import_jotai.atom)(functions);
97
- var GraphqlAtom = (0, import_jotai.atom)(graphql);
98
- function useAppwrite() {
99
- const [account2] = (0, import_jotai.useAtom)(AccountAtom);
100
- const [databases2] = (0, import_jotai.useAtom)(DatabasesAtom);
101
- const [functions2] = (0, import_jotai.useAtom)(FunctionsAtom);
102
- const [graphqlAppwrite] = (0, import_jotai.useAtom)(GraphqlAtom);
103
- const graphql2 = (0, import_react.useMemo)(
104
- () => ({
105
- client: graphqlAppwrite.client,
106
- query: async ({
107
- query,
108
- variables
109
- }) => {
110
- const { data, errors } = await graphqlAppwrite.query({
111
- query: (0, import_graphql.print)(query),
112
- variables
113
- });
114
- return { data, errors };
115
- },
116
- mutation: async ({
117
- query,
118
- variables
119
- }) => {
120
- const { data, errors } = await graphqlAppwrite.mutation({
121
- query: (0, import_graphql.print)(query),
122
- variables
123
- });
124
- return { data, errors };
125
- }
126
- }),
127
- [graphqlAppwrite]
128
- );
129
- return {
130
- account: account2,
131
- databases: databases2,
132
- functions: functions2,
133
- graphql: graphql2
134
- };
135
- }
136
-
137
- // src/useMutation.ts
138
- var import_react_query2 = require("@tanstack/react-query");
139
-
140
- // src/useQueryClient.ts
141
- var import_jotai3 = require("jotai");
142
-
143
- // src/states/query.ts
144
- var import_react_query = require("@tanstack/react-query");
145
- var import_jotai2 = require("jotai");
146
- var queryClient = new import_react_query.QueryClient();
147
- var QueryAtom = (0, import_jotai2.atom)(queryClient);
148
-
149
- // src/useQueryClient.ts
150
- function useQueryClient() {
151
- const [queryClient2] = (0, import_jotai3.useAtom)(QueryAtom);
152
- return queryClient2;
153
- }
154
-
155
- // src/useMutation.ts
156
- function useMutation(options) {
157
- const queryClient2 = useQueryClient();
158
- return (0, import_react_query2.useMutation)(options, queryClient2);
159
- }
160
-
161
- // src/useQuery.ts
162
- var import_react_query3 = require("@tanstack/react-query");
163
- function useQuery(options) {
164
- const queryClient2 = useQueryClient();
165
- return (0, import_react_query3.useQuery)(options, queryClient2);
81
+ // src/__generated__/fragment-masking.ts
82
+ function getFragmentData(_documentNode, fragmentType) {
83
+ return fragmentType;
166
84
  }
167
85
 
168
- // src/account/useAccount.ts
169
- var import_react2 = require("react");
170
- var import_immer = require("immer");
171
-
172
86
  // src/__generated__/graphql.ts
173
- var Account_UserFragmentFragmentDoc = { "kind": "Document", "definitions": [{ "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "Account_UserFragment" }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "User" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "email" } }, { "kind": "Field", "name": { "kind": "Name", "value": "prefs" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "data" } }] } }] } }] };
174
- var Identity_ProviderFragmentFragmentDoc = { "kind": "Document", "definitions": [{ "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "Identity_ProviderFragment" }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "Identity" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "userId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "provider" } }] } }] };
175
- var AccountGetDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "AccountGet" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountGet" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "FragmentSpread", "name": { "kind": "Name", "value": "Account_UserFragment" } }] } }] } }, { "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "Account_UserFragment" }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "User" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "email" } }, { "kind": "Field", "name": { "kind": "Name", "value": "prefs" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "data" } }] } }] } }] };
87
+ var Account_UserFragmentDoc = { "kind": "Document", "definitions": [{ "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "Account_User" }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "User" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "email" } }, { "kind": "Field", "name": { "kind": "Name", "value": "prefs" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "data" } }] } }] } }] };
88
+ var Identity_ProviderFragmentDoc = { "kind": "Document", "definitions": [{ "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "Identity_Provider" }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "Identity" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "userId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "provider" } }] } }] };
89
+ var AccountGetDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "AccountGet" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountGet" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "FragmentSpread", "name": { "kind": "Name", "value": "Account_User" } }] } }] } }, { "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "Account_User" }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "User" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "email" } }, { "kind": "Field", "name": { "kind": "Name", "value": "prefs" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "data" } }] } }] } }] };
176
90
  var CreateAnonymousSessionDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CreateAnonymousSession" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountCreateAnonymousSession" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "expire" } }, { "kind": "Field", "name": { "kind": "Name", "value": "current" } }] } }] } }] };
177
91
  var CreateEmailTokenDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CreateEmailToken" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "userId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "email" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "phrase" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Boolean" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountCreateEmailToken" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "userId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "userId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "email" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "email" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "phrase" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "phrase" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "expire" } }] } }] } }] };
178
92
  var CreateJwtDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CreateJWT" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountCreateJWT" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "jwt" } }] } }] } }] };
@@ -190,7 +104,7 @@ var DeleteSessionsDocument = { "kind": "Document", "definitions": [{ "kind": "Op
190
104
  var GetMfaRecoveryCodesDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetMfaRecoveryCodes" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountGetMfaRecoveryCodes" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "recoveryCodes" } }] } }] } }] };
191
105
  var GetPrefsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetPrefs" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountGetPrefs" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "data" } }] } }] } }] };
192
106
  var GetSessionDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetSession" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "sessionId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountGetSession" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "sessionId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "sessionId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "userId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "expire" } }, { "kind": "Field", "name": { "kind": "Name", "value": "current" } }] } }] } }] };
193
- var ListIdentitiesDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "ListIdentities" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "queries" } }, "type": { "kind": "ListType", "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountListIdentities" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "queries" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "queries" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "total" } }, { "kind": "Field", "name": { "kind": "Name", "value": "identities" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "FragmentSpread", "name": { "kind": "Name", "value": "Identity_ProviderFragment" } }] } }] } }] } }, { "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "Identity_ProviderFragment" }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "Identity" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "userId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "provider" } }] } }] };
107
+ var ListIdentitiesDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "ListIdentities" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "queries" } }, "type": { "kind": "ListType", "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountListIdentities" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "queries" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "queries" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "total" } }, { "kind": "Field", "name": { "kind": "Name", "value": "identities" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "FragmentSpread", "name": { "kind": "Name", "value": "Identity_Provider" } }] } }] } }] } }, { "kind": "FragmentDefinition", "name": { "kind": "Name", "value": "Identity_Provider" }, "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "Identity" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "userId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "provider" } }] } }] };
194
108
  var ListMfaFactorsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "ListMfaFactors" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountListMfaFactors" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "totp" } }, { "kind": "Field", "name": { "kind": "Name", "value": "phone" } }, { "kind": "Field", "name": { "kind": "Name", "value": "email" } }] } }] } }] };
195
109
  var ListSessionsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "ListSessions" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountListSessions" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "sessions" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "_createdAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "osName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "clientName" } }] } }] } }] } }] };
196
110
  var CreateEmailPasswordSessionDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CreateEmailPasswordSession" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "email" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "password" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountCreateEmailPasswordSession" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "email" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "email" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "password" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "password" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "userId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "expire" } }, { "kind": "Field", "name": { "kind": "Name", "value": "current" } }] } }] } }] };
@@ -223,9 +137,9 @@ var GetFunctionExecutionDocument = { "kind": "Document", "definitions": [{ "kind
223
137
 
224
138
  // src/__generated__/gql.ts
225
139
  var documents = {
226
- "\n fragment Account_UserFragment on User {\n _id\n name\n email\n prefs {\n data\n }\n }\n": Account_UserFragmentFragmentDoc,
227
- "\n fragment Identity_ProviderFragment on Identity {\n userId\n provider\n }\n": Identity_ProviderFragmentFragmentDoc,
228
- "\n query AccountGet {\n accountGet {\n ...Account_UserFragment\n }\n }\n": AccountGetDocument,
140
+ "\n fragment Account_User on User {\n _id\n name\n email\n prefs {\n data\n }\n }\n": Account_UserFragmentDoc,
141
+ "\n fragment Identity_Provider on Identity {\n userId\n provider\n }\n": Identity_ProviderFragmentDoc,
142
+ "\n query AccountGet {\n accountGet {\n ...Account_User\n }\n }\n": AccountGetDocument,
229
143
  "\n mutation CreateAnonymousSession {\n accountCreateAnonymousSession {\n _id\n expire\n current\n }\n }\n": CreateAnonymousSessionDocument,
230
144
  "\n mutation CreateEmailToken($userId: String!, $email: String!, $phrase: Boolean) {\n accountCreateEmailToken(userId: $userId, email: $email, phrase: $phrase) {\n expire\n }\n }\n": CreateEmailTokenDocument,
231
145
  "\n mutation CreateJWT {\n accountCreateJWT {\n jwt\n }\n }\n": CreateJwtDocument,
@@ -243,7 +157,7 @@ var documents = {
243
157
  "\n query GetMfaRecoveryCodes {\n accountGetMfaRecoveryCodes {\n recoveryCodes\n }\n }\n": GetMfaRecoveryCodesDocument,
244
158
  "\n query GetPrefs {\n accountGetPrefs {\n data\n }\n }\n": GetPrefsDocument,
245
159
  "\n query GetSession($sessionId: String!) {\n accountGetSession(sessionId: $sessionId) {\n userId\n expire\n current\n }\n }\n": GetSessionDocument,
246
- "\n query ListIdentities($queries: [String!]) {\n accountListIdentities(queries: $queries) {\n total\n identities {\n ...Identity_ProviderFragment\n }\n }\n }\n": ListIdentitiesDocument,
160
+ "\n query ListIdentities($queries: [String!]) {\n accountListIdentities(queries: $queries) {\n total\n identities {\n ...Identity_Provider\n }\n }\n }\n": ListIdentitiesDocument,
247
161
  "\n query ListMfaFactors {\n accountListMfaFactors {\n totp\n phone\n email\n }\n }\n": ListMfaFactorsDocument,
248
162
  "\n query ListSessions {\n accountListSessions {\n sessions {\n _id\n _createdAt\n osName\n clientName\n }\n }\n }\n": ListSessionsDocument,
249
163
  "\n mutation CreateEmailPasswordSession($email: String!, $password: String!) {\n accountCreateEmailPasswordSession(email: $email, password: $password) {\n userId\n expire\n current\n }\n }\n": CreateEmailPasswordSessionDocument,
@@ -278,13 +192,126 @@ function gql(source) {
278
192
  return documents[source] ?? {};
279
193
  }
280
194
 
195
+ // src/account/fragments.ts
196
+ var Account_User = gql(
197
+ /* GraphQL */
198
+ `
199
+ fragment Account_User on User {
200
+ _id
201
+ name
202
+ email
203
+ prefs {
204
+ data
205
+ }
206
+ }
207
+ `
208
+ );
209
+ var Identity_Provider = gql(
210
+ /* GraphQL */
211
+ `
212
+ fragment Identity_Provider on Identity {
213
+ userId
214
+ provider
215
+ }
216
+ `
217
+ );
218
+
219
+ // src/useAppwrite.ts
220
+ var import_react = require("react");
221
+ var import_appwrite = require("appwrite");
222
+ var import_graphql = require("graphql");
223
+ var import_jotai = require("jotai");
224
+ var client = new import_appwrite.Client();
225
+ var endpoint = process.env.APPWRITE_ENDPOINT ?? process.env.NEXT_PUBLIC_APPWRITE_URL ?? "http://localhost/v1";
226
+ var projectId = process.env.APPWRITE_PROJECT_ID ?? process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID ?? "[PROJECT_ID]";
227
+ client.setEndpoint(endpoint).setProject(projectId);
228
+ var account = new import_appwrite.Account(client);
229
+ var databases = new import_appwrite.Databases(client);
230
+ var functions = new import_appwrite.Functions(client);
231
+ var graphql = new import_appwrite.Graphql(client);
232
+ var AccountAtom = (0, import_jotai.atom)(account);
233
+ var DatabasesAtom = (0, import_jotai.atom)(databases);
234
+ var FunctionsAtom = (0, import_jotai.atom)(functions);
235
+ var GraphqlAtom = (0, import_jotai.atom)(graphql);
236
+ function useAppwrite() {
237
+ const [account2] = (0, import_jotai.useAtom)(AccountAtom);
238
+ const [databases2] = (0, import_jotai.useAtom)(DatabasesAtom);
239
+ const [functions2] = (0, import_jotai.useAtom)(FunctionsAtom);
240
+ const [graphqlAppwrite] = (0, import_jotai.useAtom)(GraphqlAtom);
241
+ const graphql2 = (0, import_react.useMemo)(
242
+ () => ({
243
+ client: graphqlAppwrite.client,
244
+ query: async ({
245
+ query,
246
+ variables
247
+ }) => {
248
+ const { data, errors } = await graphqlAppwrite.query({
249
+ query: (0, import_graphql.print)(query),
250
+ variables
251
+ });
252
+ return { data, errors };
253
+ },
254
+ mutation: async ({
255
+ query,
256
+ variables
257
+ }) => {
258
+ const { data, errors } = await graphqlAppwrite.mutation({
259
+ query: (0, import_graphql.print)(query),
260
+ variables
261
+ });
262
+ return { data, errors };
263
+ }
264
+ }),
265
+ [graphqlAppwrite]
266
+ );
267
+ return {
268
+ account: account2,
269
+ databases: databases2,
270
+ functions: functions2,
271
+ graphql: graphql2
272
+ };
273
+ }
274
+
275
+ // src/useMutation.ts
276
+ var import_react_query2 = require("@tanstack/react-query");
277
+
278
+ // src/useQueryClient.ts
279
+ var import_jotai3 = require("jotai");
280
+
281
+ // src/states/query.ts
282
+ var import_react_query = require("@tanstack/react-query");
283
+ var import_jotai2 = require("jotai");
284
+ var queryClient = new import_react_query.QueryClient();
285
+ var QueryAtom = (0, import_jotai2.atom)(queryClient);
286
+
287
+ // src/useQueryClient.ts
288
+ function useQueryClient() {
289
+ const [queryClient2] = (0, import_jotai3.useAtom)(QueryAtom);
290
+ return queryClient2;
291
+ }
292
+
293
+ // src/useMutation.ts
294
+ function useMutation(options) {
295
+ const queryClient2 = useQueryClient();
296
+ return (0, import_react_query2.useMutation)(options, queryClient2);
297
+ }
298
+
299
+ // src/useQuery.ts
300
+ var import_react_query3 = require("@tanstack/react-query");
301
+ function useQuery(options) {
302
+ const queryClient2 = useQueryClient();
303
+ return (0, import_react_query3.useQuery)(options, queryClient2);
304
+ }
305
+
281
306
  // src/account/useAccount.ts
307
+ var import_react2 = require("react");
308
+ var import_immer = require("immer");
282
309
  var getAccount = gql(
283
310
  /* GraphQL */
284
311
  `
285
312
  query AccountGet {
286
313
  accountGet {
287
- ...Account_UserFragment
314
+ ...Account_User
288
315
  }
289
316
  }
290
317
  `
@@ -332,11 +359,6 @@ function useAccount() {
332
359
  return queryResult;
333
360
  }
334
361
 
335
- // src/__generated__/fragment-masking.ts
336
- function getFragmentData(_documentNode, fragmentType) {
337
- return fragmentType;
338
- }
339
-
340
362
  // src/account/useCreateAnonymousSession.ts
341
363
  var createAnonymousSession = gql(
342
364
  /* GraphQL */
@@ -883,7 +905,7 @@ var accountListIdentities = gql(
883
905
  accountListIdentities(queries: $queries) {
884
906
  total
885
907
  identities {
886
- ...Identity_ProviderFragment
908
+ ...Identity_Provider
887
909
  }
888
910
  }
889
911
  }
@@ -2217,39 +2239,12 @@ function useSuspenseFunction({
2217
2239
  };
2218
2240
  }
2219
2241
 
2220
- // src/account/fragments.ts
2221
- var fragments_exports = {};
2222
- __export(fragments_exports, {
2223
- Account_UserFragment: () => Account_UserFragment,
2224
- Identity_ProviderFragment: () => Identity_ProviderFragment
2225
- });
2226
- var Account_UserFragment = gql(
2227
- /* GraphQL */
2228
- `
2229
- fragment Account_UserFragment on User {
2230
- _id
2231
- name
2232
- email
2233
- prefs {
2234
- data
2235
- }
2236
- }
2237
- `
2238
- );
2239
- var Identity_ProviderFragment = gql(
2240
- /* GraphQL */
2241
- `
2242
- fragment Identity_ProviderFragment on Identity {
2243
- userId
2244
- provider
2245
- }
2246
- `
2247
- );
2248
-
2249
2242
  // src/index.ts
2250
- var fragments = {
2251
- ...fragments_exports
2252
- };
2243
+ var fragments;
2244
+ ((fragments2) => {
2245
+ fragments2.Account_UserFragment = Account_User;
2246
+ fragments2.Identity_ProviderFragment = Identity_Provider;
2247
+ })(fragments || (fragments = {}));
2253
2248
  // Annotate the CommonJS export names for ESM import in node:
2254
2249
  0 && (module.exports = {
2255
2250
  fragments,