@zeroin.earth/appwrite-graphql 0.15.0 → 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 +29 -49
- package/dist/index.d.ts +29 -49
- package/dist/index.js +141 -147
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +145 -157
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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/
|
|
82
|
-
|
|
83
|
-
|
|
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
|
|
174
|
-
var
|
|
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": "
|
|
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" } }] } }] } }] };
|
|
@@ -186,10 +100,11 @@ var CreateSessionDocument = { "kind": "Document", "definitions": [{ "kind": "Ope
|
|
|
186
100
|
var DeleteIdentityDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "DeleteIdentity" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "identityId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountDeleteIdentity" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "identityId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "identityId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "status" } }] } }] } }] };
|
|
187
101
|
var DeleteMfaAuthenticatorDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "DeleteMfaAuthenticator" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "type" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "otp" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountDeleteMfaAuthenticator" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "type" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "type" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "otp" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "otp" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "mfa" } }] } }] } }] };
|
|
188
102
|
var DeleteSessionDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "DeleteSession" }, "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": "accountDeleteSession" }, "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": "status" } }] } }] } }] };
|
|
103
|
+
var DeleteSessionsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "DeleteSessions" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "accountDeleteSessions" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "status" } }] } }] } }] };
|
|
189
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" } }] } }] } }] };
|
|
190
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" } }] } }] } }] };
|
|
191
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" } }] } }] } }] };
|
|
192
|
-
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": "
|
|
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" } }] } }] };
|
|
193
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" } }] } }] } }] };
|
|
194
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" } }] } }] } }] } }] };
|
|
195
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" } }] } }] } }] };
|
|
@@ -222,9 +137,9 @@ var GetFunctionExecutionDocument = { "kind": "Document", "definitions": [{ "kind
|
|
|
222
137
|
|
|
223
138
|
// src/__generated__/gql.ts
|
|
224
139
|
var documents = {
|
|
225
|
-
"\n fragment
|
|
226
|
-
"\n fragment
|
|
227
|
-
"\n query AccountGet {\n accountGet {\n ...
|
|
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,
|
|
228
143
|
"\n mutation CreateAnonymousSession {\n accountCreateAnonymousSession {\n _id\n expire\n current\n }\n }\n": CreateAnonymousSessionDocument,
|
|
229
144
|
"\n mutation CreateEmailToken($userId: String!, $email: String!, $phrase: Boolean) {\n accountCreateEmailToken(userId: $userId, email: $email, phrase: $phrase) {\n expire\n }\n }\n": CreateEmailTokenDocument,
|
|
230
145
|
"\n mutation CreateJWT {\n accountCreateJWT {\n jwt\n }\n }\n": CreateJwtDocument,
|
|
@@ -238,10 +153,11 @@ var documents = {
|
|
|
238
153
|
"\n mutation DeleteIdentity($identityId: String!) {\n accountDeleteIdentity(identityId: $identityId) {\n status\n }\n }\n": DeleteIdentityDocument,
|
|
239
154
|
"\n mutation DeleteMfaAuthenticator($type: String!, $otp: String!) {\n accountDeleteMfaAuthenticator(type: $type, otp: $otp) {\n mfa\n }\n }\n": DeleteMfaAuthenticatorDocument,
|
|
240
155
|
"\n mutation DeleteSession($sessionId: String!) {\n accountDeleteSession(sessionId: $sessionId) {\n status\n }\n }\n": DeleteSessionDocument,
|
|
156
|
+
"\n mutation DeleteSessions {\n accountDeleteSessions {\n status\n }\n }\n": DeleteSessionsDocument,
|
|
241
157
|
"\n query GetMfaRecoveryCodes {\n accountGetMfaRecoveryCodes {\n recoveryCodes\n }\n }\n": GetMfaRecoveryCodesDocument,
|
|
242
158
|
"\n query GetPrefs {\n accountGetPrefs {\n data\n }\n }\n": GetPrefsDocument,
|
|
243
159
|
"\n query GetSession($sessionId: String!) {\n accountGetSession(sessionId: $sessionId) {\n userId\n expire\n current\n }\n }\n": GetSessionDocument,
|
|
244
|
-
"\n query ListIdentities($queries: [String!]) {\n accountListIdentities(queries: $queries) {\n total\n identities {\n ...
|
|
160
|
+
"\n query ListIdentities($queries: [String!]) {\n accountListIdentities(queries: $queries) {\n total\n identities {\n ...Identity_Provider\n }\n }\n }\n": ListIdentitiesDocument,
|
|
245
161
|
"\n query ListMfaFactors {\n accountListMfaFactors {\n totp\n phone\n email\n }\n }\n": ListMfaFactorsDocument,
|
|
246
162
|
"\n query ListSessions {\n accountListSessions {\n sessions {\n _id\n _createdAt\n osName\n clientName\n }\n }\n }\n": ListSessionsDocument,
|
|
247
163
|
"\n mutation CreateEmailPasswordSession($email: String!, $password: String!) {\n accountCreateEmailPasswordSession(email: $email, password: $password) {\n userId\n expire\n current\n }\n }\n": CreateEmailPasswordSessionDocument,
|
|
@@ -276,13 +192,126 @@ function gql(source) {
|
|
|
276
192
|
return documents[source] ?? {};
|
|
277
193
|
}
|
|
278
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
|
+
|
|
279
306
|
// src/account/useAccount.ts
|
|
307
|
+
var import_react2 = require("react");
|
|
308
|
+
var import_immer = require("immer");
|
|
280
309
|
var getAccount = gql(
|
|
281
310
|
/* GraphQL */
|
|
282
311
|
`
|
|
283
312
|
query AccountGet {
|
|
284
313
|
accountGet {
|
|
285
|
-
...
|
|
314
|
+
...Account_User
|
|
286
315
|
}
|
|
287
316
|
}
|
|
288
317
|
`
|
|
@@ -330,11 +359,6 @@ function useAccount() {
|
|
|
330
359
|
return queryResult;
|
|
331
360
|
}
|
|
332
361
|
|
|
333
|
-
// src/__generated__/fragment-masking.ts
|
|
334
|
-
function getFragmentData(_documentNode, fragmentType) {
|
|
335
|
-
return fragmentType;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
362
|
// src/account/useCreateAnonymousSession.ts
|
|
339
363
|
var createAnonymousSession = gql(
|
|
340
364
|
/* GraphQL */
|
|
@@ -760,11 +784,11 @@ function useDeleteSession() {
|
|
|
760
784
|
}
|
|
761
785
|
|
|
762
786
|
// src/account/useDeleteSessions.ts
|
|
763
|
-
var
|
|
787
|
+
var deleteSessions = gql(
|
|
764
788
|
/* GraphQL */
|
|
765
789
|
`
|
|
766
|
-
mutation
|
|
767
|
-
|
|
790
|
+
mutation DeleteSessions {
|
|
791
|
+
accountDeleteSessions {
|
|
768
792
|
status
|
|
769
793
|
}
|
|
770
794
|
}
|
|
@@ -773,17 +797,14 @@ var deleteSession2 = gql(
|
|
|
773
797
|
function useDeleteSessions() {
|
|
774
798
|
const { graphql: graphql2 } = useAppwrite();
|
|
775
799
|
const queryResult = useMutation({
|
|
776
|
-
mutationFn: async (
|
|
800
|
+
mutationFn: async () => {
|
|
777
801
|
const { data, errors } = await graphql2.mutation({
|
|
778
|
-
query:
|
|
779
|
-
variables: {
|
|
780
|
-
sessionId
|
|
781
|
-
}
|
|
802
|
+
query: deleteSessions
|
|
782
803
|
});
|
|
783
804
|
if (errors) {
|
|
784
805
|
throw errors;
|
|
785
806
|
}
|
|
786
|
-
return data.
|
|
807
|
+
return data.accountDeleteSessions;
|
|
787
808
|
}
|
|
788
809
|
});
|
|
789
810
|
return { ...queryResult };
|
|
@@ -884,7 +905,7 @@ var accountListIdentities = gql(
|
|
|
884
905
|
accountListIdentities(queries: $queries) {
|
|
885
906
|
total
|
|
886
907
|
identities {
|
|
887
|
-
...
|
|
908
|
+
...Identity_Provider
|
|
888
909
|
}
|
|
889
910
|
}
|
|
890
911
|
}
|
|
@@ -1015,7 +1036,7 @@ function useLogin() {
|
|
|
1015
1036
|
}
|
|
1016
1037
|
|
|
1017
1038
|
// src/account/useLogout.ts
|
|
1018
|
-
var
|
|
1039
|
+
var deleteSession2 = gql(
|
|
1019
1040
|
/* GraphQL */
|
|
1020
1041
|
`
|
|
1021
1042
|
mutation DeleteSession($sessionId: String!) {
|
|
@@ -1031,7 +1052,7 @@ function useLogout() {
|
|
|
1031
1052
|
const queryResult = useMutation({
|
|
1032
1053
|
mutationFn: async ({ sessionId }) => {
|
|
1033
1054
|
const { data, errors } = await graphql2.mutation({
|
|
1034
|
-
query:
|
|
1055
|
+
query: deleteSession2,
|
|
1035
1056
|
variables: {
|
|
1036
1057
|
sessionId
|
|
1037
1058
|
}
|
|
@@ -2218,39 +2239,12 @@ function useSuspenseFunction({
|
|
|
2218
2239
|
};
|
|
2219
2240
|
}
|
|
2220
2241
|
|
|
2221
|
-
// src/account/fragments.ts
|
|
2222
|
-
var fragments_exports = {};
|
|
2223
|
-
__export(fragments_exports, {
|
|
2224
|
-
Account_UserFragment: () => Account_UserFragment,
|
|
2225
|
-
Identity_ProviderFragment: () => Identity_ProviderFragment
|
|
2226
|
-
});
|
|
2227
|
-
var Account_UserFragment = gql(
|
|
2228
|
-
/* GraphQL */
|
|
2229
|
-
`
|
|
2230
|
-
fragment Account_UserFragment on User {
|
|
2231
|
-
_id
|
|
2232
|
-
name
|
|
2233
|
-
email
|
|
2234
|
-
prefs {
|
|
2235
|
-
data
|
|
2236
|
-
}
|
|
2237
|
-
}
|
|
2238
|
-
`
|
|
2239
|
-
);
|
|
2240
|
-
var Identity_ProviderFragment = gql(
|
|
2241
|
-
/* GraphQL */
|
|
2242
|
-
`
|
|
2243
|
-
fragment Identity_ProviderFragment on Identity {
|
|
2244
|
-
userId
|
|
2245
|
-
provider
|
|
2246
|
-
}
|
|
2247
|
-
`
|
|
2248
|
-
);
|
|
2249
|
-
|
|
2250
2242
|
// src/index.ts
|
|
2251
|
-
var fragments
|
|
2252
|
-
|
|
2253
|
-
|
|
2243
|
+
var fragments;
|
|
2244
|
+
((fragments2) => {
|
|
2245
|
+
fragments2.Account_UserFragment = Account_User;
|
|
2246
|
+
fragments2.Identity_ProviderFragment = Identity_Provider;
|
|
2247
|
+
})(fragments || (fragments = {}));
|
|
2254
2248
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2255
2249
|
0 && (module.exports = {
|
|
2256
2250
|
fragments,
|