@zeroin.earth/appwrite-graphql 0.15.1 → 0.15.3

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.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,13 +104,13 @@ 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" } }] } }] } }] };
197
111
  var ListLogsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "ListLogs" }, "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": "accountListLogs" }, "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": "logs" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "event" } }, { "kind": "Field", "name": { "kind": "Name", "value": "userId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "userEmail" } }, { "kind": "Field", "name": { "kind": "Name", "value": "userName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "mode" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ip" } }, { "kind": "Field", "name": { "kind": "Name", "value": "time" } }, { "kind": "Field", "name": { "kind": "Name", "value": "osCode" } }, { "kind": "Field", "name": { "kind": "Name", "value": "osName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "osVersion" } }, { "kind": "Field", "name": { "kind": "Name", "value": "clientType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "clientCode" } }, { "kind": "Field", "name": { "kind": "Name", "value": "clientName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "clientVersion" } }, { "kind": "Field", "name": { "kind": "Name", "value": "clientEngine" } }, { "kind": "Field", "name": { "kind": "Name", "value": "clientEngineVersion" } }, { "kind": "Field", "name": { "kind": "Name", "value": "deviceName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "deviceBrand" } }, { "kind": "Field", "name": { "kind": "Name", "value": "deviceModel" } }, { "kind": "Field", "name": { "kind": "Name", "value": "countryCode" } }, { "kind": "Field", "name": { "kind": "Name", "value": "countryName" } }] } }] } }] } }] };
198
112
  var CreateRecoveryDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CreateRecovery" }, "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": "url" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountCreateRecovery" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "email" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "email" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "url" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "url" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "expire" } }] } }] } }] };
199
- var UpdateRecoveryDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "UpdateRecovery" }, "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": "secret" } }, "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" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "passwordAgain" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountUpdateRecovery" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "userId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "userId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "secret" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "secret" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "password" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "password" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "passwordAgain" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "passwordAgain" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "expire" } }] } }] } }] };
113
+ var UpdateRecoveryDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "UpdateRecovery" }, "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": "secret" } }, "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": "accountUpdateRecovery" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "userId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "userId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "secret" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "secret" } } }, { "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": "expire" } }] } }] } }] };
200
114
  var CreateAccountDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "CreateAccount" }, "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": "name" } }, "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": "password" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountCreate" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "userId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "userId" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "name" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "name" } } }, { "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": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "email" } }] } }] } }] };
201
115
  var VerifyEmailDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "VerifyEmail" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "url" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountCreateVerification" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "url" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "url" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "expire" } }] } }] } }] };
202
116
  var UpdateEmailDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "UpdateEmail" }, "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": "accountUpdateEmail" }, "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": "name" } }, { "kind": "Field", "name": { "kind": "Name", "value": "email" } }] } }] } }] };
@@ -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,13 +157,13 @@ 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,
250
164
  "\n query ListLogs($queries: [String!]) {\n accountListLogs(queries: $queries) {\n total\n logs {\n event\n userId\n userEmail\n userName\n mode\n ip\n time\n osCode\n osName\n osVersion\n clientType\n clientCode\n clientName\n clientVersion\n clientEngine\n clientEngineVersion\n deviceName\n deviceBrand\n deviceModel\n countryCode\n countryName\n }\n }\n }\n": ListLogsDocument,
251
165
  "\n mutation CreateRecovery($email: String!, $url: String!) {\n accountCreateRecovery(email: $email, url: $url) {\n expire\n }\n }\n": CreateRecoveryDocument,
252
- "\n mutation UpdateRecovery(\n $userId: String!\n $secret: String!\n $password: String!\n $passwordAgain: String!\n ) {\n accountUpdateRecovery(\n userId: $userId\n secret: $secret\n password: $password\n passwordAgain: $passwordAgain\n ) {\n expire\n }\n }\n": UpdateRecoveryDocument,
166
+ "\n mutation UpdateRecovery($userId: String!, $secret: String!, $password: String!) {\n accountUpdateRecovery(userId: $userId, secret: $secret, password: $password) {\n expire\n }\n }\n": UpdateRecoveryDocument,
253
167
  "\n mutation CreateAccount($userId: String!, $name: String, $email: String!, $password: String!) {\n accountCreate(userId: $userId, name: $name, email: $email, password: $password) {\n name\n email\n }\n }\n": CreateAccountDocument,
254
168
  "\n mutation VerifyEmail($url: String!) {\n accountCreateVerification(url: $url) {\n expire\n }\n }\n": VerifyEmailDocument,
255
169
  "\n mutation UpdateEmail($email: String!, $password: String!) {\n accountUpdateEmail(email: $email, password: $password) {\n name\n email\n }\n }\n": UpdateEmailDocument,
@@ -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
  }
@@ -1141,18 +1163,8 @@ function usePasswordRecovery() {
1141
1163
  var updateRecovery = gql(
1142
1164
  /* GraphQL */
1143
1165
  `
1144
- mutation UpdateRecovery(
1145
- $userId: String!
1146
- $secret: String!
1147
- $password: String!
1148
- $passwordAgain: String!
1149
- ) {
1150
- accountUpdateRecovery(
1151
- userId: $userId
1152
- secret: $secret
1153
- password: $password
1154
- passwordAgain: $passwordAgain
1155
- ) {
1166
+ mutation UpdateRecovery($userId: String!, $secret: String!, $password: String!) {
1167
+ accountUpdateRecovery(userId: $userId, secret: $secret, password: $password) {
1156
1168
  expire
1157
1169
  }
1158
1170
  }
@@ -1161,14 +1173,13 @@ var updateRecovery = gql(
1161
1173
  function useResetPassword() {
1162
1174
  const { graphql: graphql2 } = useAppwrite();
1163
1175
  const queryResult = useMutation({
1164
- mutationFn: async ({ userId, secret, password, passwordAgain: confirmPassword }) => {
1176
+ mutationFn: async ({ userId, secret, password }) => {
1165
1177
  const { data, errors } = await graphql2.mutation({
1166
1178
  query: updateRecovery,
1167
1179
  variables: {
1168
1180
  userId,
1169
1181
  secret,
1170
- password,
1171
- passwordAgain: confirmPassword
1182
+ password
1172
1183
  }
1173
1184
  });
1174
1185
  if (errors) {
@@ -2217,39 +2228,12 @@ function useSuspenseFunction({
2217
2228
  };
2218
2229
  }
2219
2230
 
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
2231
  // src/index.ts
2250
- var fragments = {
2251
- ...fragments_exports
2252
- };
2232
+ var fragments;
2233
+ ((fragments2) => {
2234
+ fragments2.Account_UserFragment = Account_User;
2235
+ fragments2.Identity_ProviderFragment = Identity_Provider;
2236
+ })(fragments || (fragments = {}));
2253
2237
  // Annotate the CommonJS export names for ESM import in node:
2254
2238
  0 && (module.exports = {
2255
2239
  fragments,