@zeroin.earth/appwrite-graphql 0.13.0
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/LICENSE +21 -0
- package/README.md +203 -0
- package/dist/index.d.mts +349 -0
- package/dist/index.d.ts +349 -0
- package/dist/index.js +808 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +770 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +42 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import * as _graphql_typed_document_node_core from '@graphql-typed-document-node/core';
|
|
2
|
+
import { TypedDocumentNode, DocumentTypeDecoration } from '@graphql-typed-document-node/core';
|
|
3
|
+
import { Account, Client, Models, AppwriteException } from 'appwrite';
|
|
4
|
+
import * as _tanstack_react_query_build_legacy_types from '@tanstack/react-query/build/legacy/types';
|
|
5
|
+
import { DefaultError, UseMutationOptions, QueryKey, UndefinedInitialDataOptions, DefinedInitialDataOptions, UseQueryOptions } from '@tanstack/react-query';
|
|
6
|
+
import * as _tanstack_query_core_build_legacy_queryClient_bm_z2rsD from '@tanstack/query-core/build/legacy/queryClient-bm-z2rsD';
|
|
7
|
+
|
|
8
|
+
type Maybe<T> = T | null;
|
|
9
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
10
|
+
type Scalars = {
|
|
11
|
+
ID: {
|
|
12
|
+
input: string;
|
|
13
|
+
output: string;
|
|
14
|
+
};
|
|
15
|
+
String: {
|
|
16
|
+
input: string;
|
|
17
|
+
output: string;
|
|
18
|
+
};
|
|
19
|
+
Boolean: {
|
|
20
|
+
input: boolean;
|
|
21
|
+
output: boolean;
|
|
22
|
+
};
|
|
23
|
+
Int: {
|
|
24
|
+
input: number;
|
|
25
|
+
output: number;
|
|
26
|
+
};
|
|
27
|
+
Float: {
|
|
28
|
+
input: number;
|
|
29
|
+
output: number;
|
|
30
|
+
};
|
|
31
|
+
Date: {
|
|
32
|
+
input: any;
|
|
33
|
+
output: any;
|
|
34
|
+
};
|
|
35
|
+
JSON: {
|
|
36
|
+
input: any;
|
|
37
|
+
output: any;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
type Preferences = {
|
|
41
|
+
__typename?: 'Preferences';
|
|
42
|
+
data?: Maybe<Scalars['JSON']['output']>;
|
|
43
|
+
};
|
|
44
|
+
type Session = {
|
|
45
|
+
__typename?: 'Session';
|
|
46
|
+
current?: Maybe<Scalars['Boolean']['output']>;
|
|
47
|
+
expire?: Maybe<Scalars['String']['output']>;
|
|
48
|
+
userId?: Maybe<Scalars['String']['output']>;
|
|
49
|
+
};
|
|
50
|
+
type Token = {
|
|
51
|
+
__typename?: 'Token';
|
|
52
|
+
_createdAt?: Maybe<Scalars['String']['output']>;
|
|
53
|
+
_id?: Maybe<Scalars['String']['output']>;
|
|
54
|
+
expire?: Maybe<Scalars['String']['output']>;
|
|
55
|
+
userId?: Maybe<Scalars['String']['output']>;
|
|
56
|
+
};
|
|
57
|
+
type User = {
|
|
58
|
+
__typename?: 'User';
|
|
59
|
+
_createdAt?: Maybe<Scalars['Date']['output']>;
|
|
60
|
+
_id?: Maybe<Scalars['String']['output']>;
|
|
61
|
+
_updatedAt?: Maybe<Scalars['Date']['output']>;
|
|
62
|
+
accessedAt?: Maybe<Scalars['String']['output']>;
|
|
63
|
+
email?: Maybe<Scalars['String']['output']>;
|
|
64
|
+
emailVerification?: Maybe<Scalars['Boolean']['output']>;
|
|
65
|
+
labels?: Maybe<Array<Maybe<Scalars['String']['output']>>>;
|
|
66
|
+
name?: Maybe<Scalars['String']['output']>;
|
|
67
|
+
phone?: Maybe<Scalars['String']['output']>;
|
|
68
|
+
phoneVerification?: Maybe<Scalars['Boolean']['output']>;
|
|
69
|
+
prefs?: Maybe<Preferences>;
|
|
70
|
+
registration?: Maybe<Scalars['String']['output']>;
|
|
71
|
+
status?: Maybe<Scalars['String']['output']>;
|
|
72
|
+
};
|
|
73
|
+
type Account_UserFragmentFragment = {
|
|
74
|
+
__typename?: 'User';
|
|
75
|
+
name?: string | null;
|
|
76
|
+
email?: string | null;
|
|
77
|
+
prefs?: {
|
|
78
|
+
__typename?: 'Preferences';
|
|
79
|
+
data?: any | null;
|
|
80
|
+
} | null;
|
|
81
|
+
} & {
|
|
82
|
+
' $fragmentName'?: 'Account_UserFragmentFragment';
|
|
83
|
+
};
|
|
84
|
+
type AccountGetQuery = {
|
|
85
|
+
__typename?: 'Query';
|
|
86
|
+
accountGet?: ({
|
|
87
|
+
__typename?: 'User';
|
|
88
|
+
} & {
|
|
89
|
+
' $fragmentRefs'?: {
|
|
90
|
+
'Account_UserFragmentFragment': Account_UserFragmentFragment;
|
|
91
|
+
};
|
|
92
|
+
}) | null;
|
|
93
|
+
};
|
|
94
|
+
type DeleteSessionMutation = {
|
|
95
|
+
__typename?: 'Mutation';
|
|
96
|
+
accountDeleteSession?: {
|
|
97
|
+
__typename?: 'Status';
|
|
98
|
+
status?: boolean | null;
|
|
99
|
+
} | null;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
type Variables = Record<string, unknown>;
|
|
103
|
+
declare function useAppwrite(): {
|
|
104
|
+
account: Account;
|
|
105
|
+
graphql: {
|
|
106
|
+
client: Client;
|
|
107
|
+
query: <T, V extends Variables = Variables>({ query, variables, }: {
|
|
108
|
+
query: TypedDocumentNode<T, V>;
|
|
109
|
+
variables?: V;
|
|
110
|
+
}) => Promise<{
|
|
111
|
+
data: T;
|
|
112
|
+
errors: unknown[];
|
|
113
|
+
}>;
|
|
114
|
+
mutation: <T_1, V_1 extends Variables = Variables>({ query, variables, }: {
|
|
115
|
+
query: TypedDocumentNode<T_1, V_1>;
|
|
116
|
+
variables?: V_1;
|
|
117
|
+
}) => Promise<{
|
|
118
|
+
data: T_1;
|
|
119
|
+
errors: unknown[];
|
|
120
|
+
}>;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
declare function useMutation<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown>(options: UseMutationOptions<TData, TError, TVariables, TContext>): _tanstack_react_query_build_legacy_types.UseMutationResult<TData, TError, TVariables, TContext>;
|
|
125
|
+
|
|
126
|
+
declare function useQuery<TQueryFnData, TError, TData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> | DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> | UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>): _tanstack_react_query_build_legacy_types.UseQueryResult<TData, TError>;
|
|
127
|
+
|
|
128
|
+
declare function useQueryClient(): _tanstack_query_core_build_legacy_queryClient_bm_z2rsD.b;
|
|
129
|
+
|
|
130
|
+
declare function useAccount<Preferences extends Models.Preferences>({ options, }: {
|
|
131
|
+
options?: UseQueryOptions<AccountGetQuery['accountGet'], AppwriteException, AccountGetQuery['accountGet'], string[]>;
|
|
132
|
+
}): _tanstack_react_query_build_legacy_types.UseQueryResult<{
|
|
133
|
+
__typename?: "User";
|
|
134
|
+
} & {
|
|
135
|
+
' $fragmentRefs'?: {
|
|
136
|
+
Account_UserFragmentFragment: Account_UserFragmentFragment;
|
|
137
|
+
};
|
|
138
|
+
}, AppwriteException>;
|
|
139
|
+
|
|
140
|
+
type LoginProps = {
|
|
141
|
+
email: string;
|
|
142
|
+
password: string;
|
|
143
|
+
};
|
|
144
|
+
type OAuthLoginProps = {
|
|
145
|
+
provider: string;
|
|
146
|
+
success: string;
|
|
147
|
+
failure: string;
|
|
148
|
+
};
|
|
149
|
+
declare function useLogin(): {
|
|
150
|
+
login: _tanstack_react_query_build_legacy_types.UseMutationResult<Session, AppwriteException, LoginProps, unknown>;
|
|
151
|
+
oAuthLogin: _tanstack_react_query_build_legacy_types.UseMutationResult<void | URL, AppwriteException, OAuthLoginProps, unknown>;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
declare function useLogout(): _tanstack_react_query_build_legacy_types.UseMutationResult<{
|
|
155
|
+
data: DeleteSessionMutation;
|
|
156
|
+
errors: unknown[];
|
|
157
|
+
}, Error, void, unknown>;
|
|
158
|
+
|
|
159
|
+
type Props$3 = {
|
|
160
|
+
email: string;
|
|
161
|
+
resetUrl: string;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Send the recovery email to the address supplied
|
|
165
|
+
*/
|
|
166
|
+
declare function usePasswordRecovery(): _tanstack_react_query_build_legacy_types.UseMutationResult<Token, AppwriteException, Props$3, unknown>;
|
|
167
|
+
|
|
168
|
+
type Props$2 = {
|
|
169
|
+
userId: string;
|
|
170
|
+
secret: string;
|
|
171
|
+
password: string;
|
|
172
|
+
confirmPassword: string;
|
|
173
|
+
};
|
|
174
|
+
declare function useResetPassword(): _tanstack_react_query_build_legacy_types.UseMutationResult<Token, AppwriteException, Props$2, unknown>;
|
|
175
|
+
|
|
176
|
+
type SignUpProps = {
|
|
177
|
+
userId?: string;
|
|
178
|
+
name?: string;
|
|
179
|
+
email: string;
|
|
180
|
+
password: string;
|
|
181
|
+
};
|
|
182
|
+
type VerifyProps = {
|
|
183
|
+
verifyUrl: string;
|
|
184
|
+
};
|
|
185
|
+
declare function useSignUp(): {
|
|
186
|
+
signUp: _tanstack_react_query_build_legacy_types.UseMutationResult<User, Error, SignUpProps, unknown>;
|
|
187
|
+
verifyEmail: _tanstack_react_query_build_legacy_types.UseMutationResult<Token, Error, VerifyProps, unknown>;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
type Props$1 = {
|
|
191
|
+
userId: string | null;
|
|
192
|
+
secret: string | null;
|
|
193
|
+
};
|
|
194
|
+
declare function useVerification(): _tanstack_react_query_build_legacy_types.UseMutationResult<Token, AppwriteException, Props$1, unknown>;
|
|
195
|
+
|
|
196
|
+
type Document<T> = T & Models.Document;
|
|
197
|
+
type Collection<T> = Models.DocumentList<Document<T>>;
|
|
198
|
+
|
|
199
|
+
declare function useCollection<TDocument>({ databaseId, collectionId, queries, options, }: {
|
|
200
|
+
databaseId: string;
|
|
201
|
+
collectionId: string;
|
|
202
|
+
queries: string[];
|
|
203
|
+
options?: UseQueryOptions<Collection<TDocument>, AppwriteException, Collection<TDocument>, (string | {
|
|
204
|
+
queries: string[];
|
|
205
|
+
})[]>;
|
|
206
|
+
}): {
|
|
207
|
+
documents: Document<TDocument>[];
|
|
208
|
+
total: number;
|
|
209
|
+
data: Collection<TDocument>;
|
|
210
|
+
error: AppwriteException;
|
|
211
|
+
isError: true;
|
|
212
|
+
isPending: false;
|
|
213
|
+
isLoadingError: false;
|
|
214
|
+
isRefetchError: true;
|
|
215
|
+
isSuccess: false;
|
|
216
|
+
status: "error";
|
|
217
|
+
dataUpdatedAt: number;
|
|
218
|
+
errorUpdatedAt: number;
|
|
219
|
+
failureCount: number;
|
|
220
|
+
failureReason: AppwriteException;
|
|
221
|
+
errorUpdateCount: number;
|
|
222
|
+
isFetched: boolean;
|
|
223
|
+
isFetchedAfterMount: boolean;
|
|
224
|
+
isFetching: boolean;
|
|
225
|
+
isLoading: boolean;
|
|
226
|
+
isInitialLoading: boolean;
|
|
227
|
+
isPaused: boolean;
|
|
228
|
+
isPlaceholderData: boolean;
|
|
229
|
+
isRefetching: boolean;
|
|
230
|
+
isStale: boolean;
|
|
231
|
+
refetch: (options?: _tanstack_query_core_build_legacy_queryClient_bm_z2rsD._) => Promise<_tanstack_query_core_build_legacy_queryClient_bm_z2rsD.ad<Collection<TDocument>, AppwriteException>>;
|
|
232
|
+
fetchStatus: _tanstack_query_core_build_legacy_queryClient_bm_z2rsD.a6;
|
|
233
|
+
} | {
|
|
234
|
+
documents: Document<TDocument>[];
|
|
235
|
+
total: number;
|
|
236
|
+
data: Collection<TDocument>;
|
|
237
|
+
error: null;
|
|
238
|
+
isError: false;
|
|
239
|
+
isPending: false;
|
|
240
|
+
isLoadingError: false;
|
|
241
|
+
isRefetchError: false;
|
|
242
|
+
isSuccess: true;
|
|
243
|
+
status: "success";
|
|
244
|
+
dataUpdatedAt: number;
|
|
245
|
+
errorUpdatedAt: number;
|
|
246
|
+
failureCount: number;
|
|
247
|
+
failureReason: AppwriteException;
|
|
248
|
+
errorUpdateCount: number;
|
|
249
|
+
isFetched: boolean;
|
|
250
|
+
isFetchedAfterMount: boolean;
|
|
251
|
+
isFetching: boolean;
|
|
252
|
+
isLoading: boolean;
|
|
253
|
+
isInitialLoading: boolean;
|
|
254
|
+
isPaused: boolean;
|
|
255
|
+
isPlaceholderData: boolean;
|
|
256
|
+
isRefetching: boolean;
|
|
257
|
+
isStale: boolean;
|
|
258
|
+
refetch: (options?: _tanstack_query_core_build_legacy_queryClient_bm_z2rsD._) => Promise<_tanstack_query_core_build_legacy_queryClient_bm_z2rsD.ad<Collection<TDocument>, AppwriteException>>;
|
|
259
|
+
fetchStatus: _tanstack_query_core_build_legacy_queryClient_bm_z2rsD.a6;
|
|
260
|
+
} | {
|
|
261
|
+
documents: Document<TDocument>[];
|
|
262
|
+
total: number;
|
|
263
|
+
data: undefined;
|
|
264
|
+
error: AppwriteException;
|
|
265
|
+
isError: true;
|
|
266
|
+
isPending: false;
|
|
267
|
+
isLoadingError: true;
|
|
268
|
+
isRefetchError: false;
|
|
269
|
+
isSuccess: false;
|
|
270
|
+
status: "error";
|
|
271
|
+
dataUpdatedAt: number;
|
|
272
|
+
errorUpdatedAt: number;
|
|
273
|
+
failureCount: number;
|
|
274
|
+
failureReason: AppwriteException;
|
|
275
|
+
errorUpdateCount: number;
|
|
276
|
+
isFetched: boolean;
|
|
277
|
+
isFetchedAfterMount: boolean;
|
|
278
|
+
isFetching: boolean;
|
|
279
|
+
isLoading: boolean;
|
|
280
|
+
isInitialLoading: boolean;
|
|
281
|
+
isPaused: boolean;
|
|
282
|
+
isPlaceholderData: boolean;
|
|
283
|
+
isRefetching: boolean;
|
|
284
|
+
isStale: boolean;
|
|
285
|
+
refetch: (options?: _tanstack_query_core_build_legacy_queryClient_bm_z2rsD._) => Promise<_tanstack_query_core_build_legacy_queryClient_bm_z2rsD.ad<Collection<TDocument>, AppwriteException>>;
|
|
286
|
+
fetchStatus: _tanstack_query_core_build_legacy_queryClient_bm_z2rsD.a6;
|
|
287
|
+
} | {
|
|
288
|
+
documents: Document<TDocument>[];
|
|
289
|
+
total: number;
|
|
290
|
+
data: undefined;
|
|
291
|
+
error: null;
|
|
292
|
+
isError: false;
|
|
293
|
+
isPending: true;
|
|
294
|
+
isLoadingError: false;
|
|
295
|
+
isRefetchError: false;
|
|
296
|
+
isSuccess: false;
|
|
297
|
+
status: "pending";
|
|
298
|
+
dataUpdatedAt: number;
|
|
299
|
+
errorUpdatedAt: number;
|
|
300
|
+
failureCount: number;
|
|
301
|
+
failureReason: AppwriteException;
|
|
302
|
+
errorUpdateCount: number;
|
|
303
|
+
isFetched: boolean;
|
|
304
|
+
isFetchedAfterMount: boolean;
|
|
305
|
+
isFetching: boolean;
|
|
306
|
+
isLoading: boolean;
|
|
307
|
+
isInitialLoading: boolean;
|
|
308
|
+
isPaused: boolean;
|
|
309
|
+
isPlaceholderData: boolean;
|
|
310
|
+
isRefetching: boolean;
|
|
311
|
+
isStale: boolean;
|
|
312
|
+
refetch: (options?: _tanstack_query_core_build_legacy_queryClient_bm_z2rsD._) => Promise<_tanstack_query_core_build_legacy_queryClient_bm_z2rsD.ad<Collection<TDocument>, AppwriteException>>;
|
|
313
|
+
fetchStatus: _tanstack_query_core_build_legacy_queryClient_bm_z2rsD.a6;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
declare function useCreateDocument<TDocument>(databaseId: string, collectionId: string, documentId: string, data: TDocument, permissions?: string[], options?: UseMutationOptions<string | undefined | null, AppwriteException, Document<TDocument>, string[]>): _tanstack_react_query_build_legacy_types.UseMutationResult<string, AppwriteException, Document<TDocument>, string[]>;
|
|
317
|
+
|
|
318
|
+
declare function useDocument<TDocument>(databaseId: string, collectionId: string, documentId: string, options?: UseQueryOptions<Document<TDocument>, AppwriteException, Document<TDocument>, string[]>): _tanstack_react_query_build_legacy_types.UseQueryResult<Document<TDocument>, AppwriteException>;
|
|
319
|
+
|
|
320
|
+
type Props = {
|
|
321
|
+
functionId: string;
|
|
322
|
+
body?: Record<string, unknown> | undefined;
|
|
323
|
+
async?: boolean | undefined;
|
|
324
|
+
path?: string | undefined;
|
|
325
|
+
method?: string | undefined;
|
|
326
|
+
headers?: object | undefined;
|
|
327
|
+
};
|
|
328
|
+
declare function useFunction(): {
|
|
329
|
+
executeFunction: _tanstack_react_query_build_legacy_types.UseMutationResult<Record<string, unknown>, Error, Props, unknown>;
|
|
330
|
+
currentExecution: _tanstack_react_query_build_legacy_types.UseQueryResult<unknown, unknown>;
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<infer TType, any> ? [TType] extends [{
|
|
334
|
+
' $fragmentName'?: infer TKey;
|
|
335
|
+
}] ? TKey extends string ? {
|
|
336
|
+
' $fragmentRefs'?: {
|
|
337
|
+
[key in TKey]: TType;
|
|
338
|
+
};
|
|
339
|
+
} : never : never : never;
|
|
340
|
+
declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>): TType;
|
|
341
|
+
declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined): TType | null | undefined;
|
|
342
|
+
declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>): ReadonlyArray<TType>;
|
|
343
|
+
declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined): ReadonlyArray<TType> | null | undefined;
|
|
344
|
+
|
|
345
|
+
declare const fragments: {
|
|
346
|
+
Account_UserFragment: _graphql_typed_document_node_core.TypedDocumentNode<Account_UserFragmentFragment, unknown>;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
export { fragments, getFragmentData, useAccount, useAppwrite, useCollection, useCreateDocument, useDocument, useFunction, useLogin, useLogout, useMutation, usePasswordRecovery, useQuery, useQueryClient, useResetPassword, useSignUp, useVerification };
|