@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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 ZeroIn.earth
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# Appwrite GraphQL
|
|
2
|
+
|
|
3
|
+
This is a GraphQL library for Appwrite, built with the power of [@tanstack/react-query](https://github.com/TanStack/query) and inspired by [react-appwrite](https://github.com/react-appwrite/react-appwrite).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save @zeroin.earth/appwrite-graphql
|
|
9
|
+
|
|
10
|
+
yarn add @zeroin.earth/appwrite-graphql
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Set up
|
|
16
|
+
You must provide the Appwrite URL and Project ID as environment variables. It does not matter how they are provided as long as they can be accessed from `process.env.`:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
/* Endpoint - Pick one */
|
|
20
|
+
APPWRITE_ENDPOINT=
|
|
21
|
+
NEXT_PUBLIC_APPWRITE_URL=
|
|
22
|
+
|
|
23
|
+
/* Project ID - Pick one */
|
|
24
|
+
APPWRITE_PROJECT_ID=
|
|
25
|
+
NEXT_PUBLIC_APPWRITE_PROJECT_ID
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Hooks
|
|
29
|
+
|
|
30
|
+
```jsx
|
|
31
|
+
import { useLogin } from "@zeroin.earth/appwrite-graphql";
|
|
32
|
+
|
|
33
|
+
export function LogIn() {
|
|
34
|
+
const router = useRouter();
|
|
35
|
+
const { login, oAuthLogin } = useLogin();
|
|
36
|
+
|
|
37
|
+
const onSubmit: SubmitHandler<Inputs> = async (data) => {
|
|
38
|
+
login.mutate(data, {
|
|
39
|
+
onSuccess: () => {
|
|
40
|
+
router.push("/profile");
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const loginWithGoogle = () => {
|
|
46
|
+
oAuthLogin.mutate({
|
|
47
|
+
provider: "google",
|
|
48
|
+
success: 'successUrl',
|
|
49
|
+
failure: 'failureUrl',
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```jsx
|
|
56
|
+
import { useFunction } from "@zeroin.earth/appwrite-graphql";
|
|
57
|
+
|
|
58
|
+
export function Form() {
|
|
59
|
+
const { executeFunction } = useFunction();
|
|
60
|
+
|
|
61
|
+
const onSubmit: SubmitHandler<Input> = async (data) => {
|
|
62
|
+
executeFunction.mutate(
|
|
63
|
+
{
|
|
64
|
+
functionId: '6gibhbyy6tggdf',
|
|
65
|
+
body: {
|
|
66
|
+
message: {
|
|
67
|
+
...data,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
onSettled: () => {
|
|
73
|
+
setJustSignedUp(true);
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Using Fragments
|
|
82
|
+
|
|
83
|
+
```jsx
|
|
84
|
+
import {
|
|
85
|
+
fragments,
|
|
86
|
+
getFragmentData,
|
|
87
|
+
useAccount,
|
|
88
|
+
} from "@zeroin.earth/appwrite-graphql";
|
|
89
|
+
|
|
90
|
+
export function Profile() {
|
|
91
|
+
const { data, isLoading } = useAccount({});
|
|
92
|
+
const account = getFragmentData(fragments.Account_UserFragment, data);
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<div>
|
|
96
|
+
{data && (
|
|
97
|
+
<h2>{`Welcome, ${account?.name ?? "Visitor"}!`}</h2>
|
|
98
|
+
)}
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Work in progress
|
|
105
|
+
|
|
106
|
+
We are working on matching parity with the current Appwrite SDK. After we do so, version numbers will match the currently supported version of the SDK. Until then, please feel free to use what we have finished so far!
|
|
107
|
+
|
|
108
|
+
Still left to do:
|
|
109
|
+
|
|
110
|
+
### Account
|
|
111
|
+
|
|
112
|
+
- [x] Get account
|
|
113
|
+
- [x] Create account
|
|
114
|
+
- [ ] Update email
|
|
115
|
+
- [ ] List Identities
|
|
116
|
+
- [ ] Delete Identity
|
|
117
|
+
- [ ] Create JWT
|
|
118
|
+
- [ ] List logs
|
|
119
|
+
- [ ] Update name
|
|
120
|
+
- [ ] Update password
|
|
121
|
+
- [ ] Update phone
|
|
122
|
+
- [ ] Get account preferences
|
|
123
|
+
- [ ] Update preferences
|
|
124
|
+
- [x] Create password recovery
|
|
125
|
+
- [x] Create password recovery (confirmation)
|
|
126
|
+
- [ ] List sessions
|
|
127
|
+
- [ ] Delete sessions
|
|
128
|
+
- [ ] Create anonymous session
|
|
129
|
+
- [x] Create email session
|
|
130
|
+
- [ ] Create magic URL session
|
|
131
|
+
- [ ] Create magic URL session (confirmation)
|
|
132
|
+
- [ ] Create phone session
|
|
133
|
+
- [ ] Create phone session (confirmation)
|
|
134
|
+
- [ ] Get session
|
|
135
|
+
- [ ] Update OAuth session (refresh tokens)
|
|
136
|
+
- [x] Delete session
|
|
137
|
+
- [ ] Update status
|
|
138
|
+
- [x] Create email verification
|
|
139
|
+
- [x] Create email verification (confirmation)
|
|
140
|
+
- [ ] Create phone verification
|
|
141
|
+
- [ ] Create phone verification (confirmation)
|
|
142
|
+
|
|
143
|
+
### Teams
|
|
144
|
+
|
|
145
|
+
- [ ] List teams
|
|
146
|
+
- [ ] Create team
|
|
147
|
+
- [ ] Get team
|
|
148
|
+
- [ ] Update name
|
|
149
|
+
- [ ] Delete team
|
|
150
|
+
- [ ] List team memberships
|
|
151
|
+
- [ ] Create team membership
|
|
152
|
+
- [ ] Get team membership
|
|
153
|
+
- [ ] Update membership
|
|
154
|
+
- [ ] Delete team membership
|
|
155
|
+
- [ ] Update team membership status
|
|
156
|
+
- [ ] Get team preferences
|
|
157
|
+
- [ ] Update preferences
|
|
158
|
+
|
|
159
|
+
### Databases
|
|
160
|
+
|
|
161
|
+
- [X] List documents
|
|
162
|
+
- [X] Create document
|
|
163
|
+
- [X] Get document
|
|
164
|
+
- [ ] Update document
|
|
165
|
+
- [ ] Delete document
|
|
166
|
+
|
|
167
|
+
### Storage
|
|
168
|
+
|
|
169
|
+
- [ ] List files
|
|
170
|
+
- [ ] Create file
|
|
171
|
+
- [ ] Get file
|
|
172
|
+
- [ ] Update file
|
|
173
|
+
- [ ] Delete File
|
|
174
|
+
- [ ] Get file for download
|
|
175
|
+
- [ ] Get file preview
|
|
176
|
+
- [ ] Get file for view
|
|
177
|
+
|
|
178
|
+
### Functions
|
|
179
|
+
|
|
180
|
+
- [ ] List executions
|
|
181
|
+
- [X] Create execution
|
|
182
|
+
- [X] Get execution
|
|
183
|
+
|
|
184
|
+
### Locale
|
|
185
|
+
|
|
186
|
+
- [ ] Get user locale
|
|
187
|
+
- [ ] List Locale Codes
|
|
188
|
+
- [ ] List continents
|
|
189
|
+
- [ ] List countries
|
|
190
|
+
- [ ] List EU countries
|
|
191
|
+
- [ ] List countries phone codes
|
|
192
|
+
- [ ] List currencies
|
|
193
|
+
- [ ] List languages
|
|
194
|
+
|
|
195
|
+
### Avatars
|
|
196
|
+
|
|
197
|
+
- [ ] Get browser icon
|
|
198
|
+
- [ ] Get credit card icon
|
|
199
|
+
- [ ] Get favicon
|
|
200
|
+
- [ ] Get country flag
|
|
201
|
+
- [ ] Get image from URL
|
|
202
|
+
- [ ] Get user initials
|
|
203
|
+
- [ ] Get QR code
|
package/dist/index.d.mts
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 };
|