node-appwrite 22.1.2 → 23.0.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/README.md +2 -2
- package/dist/client.d.mts +33 -0
- package/dist/client.d.ts +33 -0
- package/dist/client.js +52 -4
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +52 -4
- package/dist/client.mjs.map +1 -1
- package/dist/enums/backup-services.d.mts +3 -0
- package/dist/enums/backup-services.d.ts +3 -0
- package/dist/enums/backup-services.js +3 -0
- package/dist/enums/backup-services.js.map +1 -1
- package/dist/enums/backup-services.mjs +3 -0
- package/dist/enums/backup-services.mjs.map +1 -1
- package/dist/enums/database-type.d.mts +3 -1
- package/dist/enums/database-type.d.ts +3 -1
- package/dist/enums/database-type.js +2 -0
- package/dist/enums/database-type.js.map +1 -1
- package/dist/enums/database-type.mjs +2 -0
- package/dist/enums/database-type.mjs.map +1 -1
- package/dist/enums/databases-index-type.d.mts +8 -0
- package/dist/enums/databases-index-type.d.ts +8 -0
- package/dist/enums/databases-index-type.js +13 -0
- package/dist/enums/databases-index-type.js.map +1 -0
- package/dist/enums/databases-index-type.mjs +12 -0
- package/dist/enums/databases-index-type.mjs.map +1 -0
- package/dist/enums/scopes.d.mts +4 -0
- package/dist/enums/scopes.d.ts +4 -0
- package/dist/enums/scopes.js +4 -0
- package/dist/enums/scopes.js.map +1 -1
- package/dist/enums/scopes.mjs +4 -0
- package/dist/enums/scopes.mjs.map +1 -1
- package/dist/enums/{index-type.d.mts → tables-db-index-type.d.mts} +2 -2
- package/dist/enums/{index-type.d.ts → tables-db-index-type.d.ts} +2 -2
- package/dist/enums/tables-db-index-type.js +13 -0
- package/dist/enums/tables-db-index-type.js.map +1 -0
- package/dist/enums/tables-db-index-type.mjs +12 -0
- package/dist/enums/tables-db-index-type.mjs.map +1 -0
- package/dist/enums/template-reference-type.d.mts +1 -1
- package/dist/enums/template-reference-type.d.ts +1 -1
- package/dist/enums/template-reference-type.js +1 -1
- package/dist/enums/template-reference-type.js.map +1 -1
- package/dist/enums/template-reference-type.mjs +1 -1
- package/dist/enums/template-reference-type.mjs.map +1 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -1
- package/dist/index.mjs.map +1 -1
- package/dist/models.d.mts +109 -11
- package/dist/models.d.ts +109 -11
- package/dist/services/databases.d.mts +45 -42
- package/dist/services/databases.d.ts +45 -42
- package/dist/services/databases.js +52 -47
- package/dist/services/databases.js.map +1 -1
- package/dist/services/databases.mjs +52 -47
- package/dist/services/databases.mjs.map +1 -1
- package/dist/services/functions.d.mts +20 -8
- package/dist/services/functions.d.ts +20 -8
- package/dist/services/functions.js +28 -8
- package/dist/services/functions.js.map +1 -1
- package/dist/services/functions.mjs +28 -8
- package/dist/services/functions.mjs.map +1 -1
- package/dist/services/health.d.mts +23 -94
- package/dist/services/health.d.ts +23 -94
- package/dist/services/health.js +28 -119
- package/dist/services/health.js.map +1 -1
- package/dist/services/health.mjs +28 -119
- package/dist/services/health.mjs.map +1 -1
- package/dist/services/messaging.d.mts +2 -2
- package/dist/services/messaging.d.ts +2 -2
- package/dist/services/messaging.js.map +1 -1
- package/dist/services/messaging.mjs.map +1 -1
- package/dist/services/project.d.mts +136 -0
- package/dist/services/project.d.ts +136 -0
- package/dist/services/project.js +183 -0
- package/dist/services/project.js.map +1 -0
- package/dist/services/project.mjs +182 -0
- package/dist/services/project.mjs.map +1 -0
- package/dist/services/sites.d.mts +30 -12
- package/dist/services/sites.d.ts +30 -12
- package/dist/services/sites.js +60 -33
- package/dist/services/sites.js.map +1 -1
- package/dist/services/sites.mjs +60 -33
- package/dist/services/sites.mjs.map +1 -1
- package/dist/services/tables-db.d.mts +9 -6
- package/dist/services/tables-db.d.ts +9 -6
- package/dist/services/tables-db.js +6 -1
- package/dist/services/tables-db.js.map +1 -1
- package/dist/services/tables-db.mjs +6 -1
- package/dist/services/tables-db.mjs.map +1 -1
- package/dist/services/teams.d.mts +4 -4
- package/dist/services/teams.d.ts +4 -4
- package/dist/services/teams.js.map +1 -1
- package/dist/services/teams.mjs.map +1 -1
- package/dist/services/users.d.mts +26 -2
- package/dist/services/users.d.ts +26 -2
- package/dist/services/users.js +34 -0
- package/dist/services/users.js.map +1 -1
- package/dist/services/users.mjs +34 -0
- package/dist/services/users.mjs.map +1 -1
- package/dist/services/webhooks.d.mts +179 -0
- package/dist/services/webhooks.d.ts +179 -0
- package/dist/services/webhooks.js +261 -0
- package/dist/services/webhooks.js.map +1 -0
- package/dist/services/webhooks.mjs +260 -0
- package/dist/services/webhooks.mjs.map +1 -0
- package/package.json +5 -3
- package/dist/enums/index-type.js +0 -13
- package/dist/enums/index-type.js.map +0 -1
- package/dist/enums/index-type.mjs +0 -12
- package/dist/enums/index-type.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Appwrite Node.js SDK
|
|
2
2
|
|
|
3
3
|

|
|
4
|
-

|
|
5
5
|
[](https://travis-ci.com/appwrite/sdk-generator)
|
|
6
6
|
[](https://twitter.com/appwrite)
|
|
7
7
|
[](https://appwrite.io/discord)
|
|
8
8
|
|
|
9
|
-
**This SDK is compatible with Appwrite server version 1.
|
|
9
|
+
**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).**
|
|
10
10
|
|
|
11
11
|
> This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code.
|
|
12
12
|
If you're looking to integrate from the browser, you should check [appwrite/sdk-for-web](https://github.com/appwrite/sdk-for-web)
|
package/dist/client.d.mts
CHANGED
|
@@ -41,6 +41,9 @@ declare class Client {
|
|
|
41
41
|
locale: string;
|
|
42
42
|
session: string;
|
|
43
43
|
forwardeduseragent: string;
|
|
44
|
+
impersonateuserid: string;
|
|
45
|
+
impersonateuseremail: string;
|
|
46
|
+
impersonateuserphone: string;
|
|
44
47
|
};
|
|
45
48
|
headers: Headers;
|
|
46
49
|
/**
|
|
@@ -128,6 +131,36 @@ declare class Client {
|
|
|
128
131
|
* @return {this}
|
|
129
132
|
*/
|
|
130
133
|
setForwardedUserAgent(value: string): this;
|
|
134
|
+
/**
|
|
135
|
+
* Set ImpersonateUserId
|
|
136
|
+
*
|
|
137
|
+
* Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
|
|
138
|
+
*
|
|
139
|
+
* @param value string
|
|
140
|
+
*
|
|
141
|
+
* @return {this}
|
|
142
|
+
*/
|
|
143
|
+
setImpersonateUserId(value: string): this;
|
|
144
|
+
/**
|
|
145
|
+
* Set ImpersonateUserEmail
|
|
146
|
+
*
|
|
147
|
+
* Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
|
|
148
|
+
*
|
|
149
|
+
* @param value string
|
|
150
|
+
*
|
|
151
|
+
* @return {this}
|
|
152
|
+
*/
|
|
153
|
+
setImpersonateUserEmail(value: string): this;
|
|
154
|
+
/**
|
|
155
|
+
* Set ImpersonateUserPhone
|
|
156
|
+
*
|
|
157
|
+
* Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
|
|
158
|
+
*
|
|
159
|
+
* @param value string
|
|
160
|
+
*
|
|
161
|
+
* @return {this}
|
|
162
|
+
*/
|
|
163
|
+
setImpersonateUserPhone(value: string): this;
|
|
131
164
|
prepareRequest(method: string, url: URL, headers?: Headers, params?: Payload): {
|
|
132
165
|
uri: string;
|
|
133
166
|
options: RequestInit;
|
package/dist/client.d.ts
CHANGED
|
@@ -41,6 +41,9 @@ declare class Client {
|
|
|
41
41
|
locale: string;
|
|
42
42
|
session: string;
|
|
43
43
|
forwardeduseragent: string;
|
|
44
|
+
impersonateuserid: string;
|
|
45
|
+
impersonateuseremail: string;
|
|
46
|
+
impersonateuserphone: string;
|
|
44
47
|
};
|
|
45
48
|
headers: Headers;
|
|
46
49
|
/**
|
|
@@ -128,6 +131,36 @@ declare class Client {
|
|
|
128
131
|
* @return {this}
|
|
129
132
|
*/
|
|
130
133
|
setForwardedUserAgent(value: string): this;
|
|
134
|
+
/**
|
|
135
|
+
* Set ImpersonateUserId
|
|
136
|
+
*
|
|
137
|
+
* Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
|
|
138
|
+
*
|
|
139
|
+
* @param value string
|
|
140
|
+
*
|
|
141
|
+
* @return {this}
|
|
142
|
+
*/
|
|
143
|
+
setImpersonateUserId(value: string): this;
|
|
144
|
+
/**
|
|
145
|
+
* Set ImpersonateUserEmail
|
|
146
|
+
*
|
|
147
|
+
* Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
|
|
148
|
+
*
|
|
149
|
+
* @param value string
|
|
150
|
+
*
|
|
151
|
+
* @return {this}
|
|
152
|
+
*/
|
|
153
|
+
setImpersonateUserEmail(value: string): this;
|
|
154
|
+
/**
|
|
155
|
+
* Set ImpersonateUserPhone
|
|
156
|
+
*
|
|
157
|
+
* Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
|
|
158
|
+
*
|
|
159
|
+
* @param value string
|
|
160
|
+
*
|
|
161
|
+
* @return {this}
|
|
162
|
+
*/
|
|
163
|
+
setImpersonateUserPhone(value: string): this;
|
|
131
164
|
prepareRequest(method: string, url: URL, headers?: Headers, params?: Payload): {
|
|
132
165
|
uri: string;
|
|
133
166
|
options: RequestInit;
|
package/dist/client.js
CHANGED
|
@@ -50,7 +50,7 @@ class AppwriteException extends Error {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
function getUserAgent() {
|
|
53
|
-
let ua = "AppwriteNodeJSSDK/
|
|
53
|
+
let ua = "AppwriteNodeJSSDK/23.0.0";
|
|
54
54
|
const platform = [];
|
|
55
55
|
if (typeof process !== "undefined") {
|
|
56
56
|
if (typeof process.platform === "string")
|
|
@@ -80,15 +80,18 @@ const _Client = class _Client {
|
|
|
80
80
|
jwt: "",
|
|
81
81
|
locale: "",
|
|
82
82
|
session: "",
|
|
83
|
-
forwardeduseragent: ""
|
|
83
|
+
forwardeduseragent: "",
|
|
84
|
+
impersonateuserid: "",
|
|
85
|
+
impersonateuseremail: "",
|
|
86
|
+
impersonateuserphone: ""
|
|
84
87
|
};
|
|
85
88
|
this.headers = {
|
|
86
89
|
"x-sdk-name": "Node.js",
|
|
87
90
|
"x-sdk-platform": "server",
|
|
88
91
|
"x-sdk-language": "nodejs",
|
|
89
|
-
"x-sdk-version": "
|
|
92
|
+
"x-sdk-version": "23.0.0",
|
|
90
93
|
"user-agent": getUserAgent(),
|
|
91
|
-
"X-Appwrite-Response-Format": "1.
|
|
94
|
+
"X-Appwrite-Response-Format": "1.9.0"
|
|
92
95
|
};
|
|
93
96
|
}
|
|
94
97
|
/**
|
|
@@ -218,6 +221,48 @@ const _Client = class _Client {
|
|
|
218
221
|
this.config.forwardeduseragent = value;
|
|
219
222
|
return this;
|
|
220
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* Set ImpersonateUserId
|
|
226
|
+
*
|
|
227
|
+
* Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
|
|
228
|
+
*
|
|
229
|
+
* @param value string
|
|
230
|
+
*
|
|
231
|
+
* @return {this}
|
|
232
|
+
*/
|
|
233
|
+
setImpersonateUserId(value) {
|
|
234
|
+
this.headers["X-Appwrite-Impersonate-User-Id"] = value;
|
|
235
|
+
this.config.impersonateuserid = value;
|
|
236
|
+
return this;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Set ImpersonateUserEmail
|
|
240
|
+
*
|
|
241
|
+
* Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
|
|
242
|
+
*
|
|
243
|
+
* @param value string
|
|
244
|
+
*
|
|
245
|
+
* @return {this}
|
|
246
|
+
*/
|
|
247
|
+
setImpersonateUserEmail(value) {
|
|
248
|
+
this.headers["X-Appwrite-Impersonate-User-Email"] = value;
|
|
249
|
+
this.config.impersonateuseremail = value;
|
|
250
|
+
return this;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Set ImpersonateUserPhone
|
|
254
|
+
*
|
|
255
|
+
* Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
|
|
256
|
+
*
|
|
257
|
+
* @param value string
|
|
258
|
+
*
|
|
259
|
+
* @return {this}
|
|
260
|
+
*/
|
|
261
|
+
setImpersonateUserPhone(value) {
|
|
262
|
+
this.headers["X-Appwrite-Impersonate-User-Phone"] = value;
|
|
263
|
+
this.config.impersonateuserphone = value;
|
|
264
|
+
return this;
|
|
265
|
+
}
|
|
221
266
|
prepareRequest(method, url, headers = {}, params = {}) {
|
|
222
267
|
method = method.toUpperCase();
|
|
223
268
|
headers = Object.assign({}, this.headers, headers);
|
|
@@ -332,6 +377,9 @@ const _Client = class _Client {
|
|
|
332
377
|
}
|
|
333
378
|
throw new AppwriteException(data == null ? void 0 : data.message, response.status, data == null ? void 0 : data.type, responseText);
|
|
334
379
|
}
|
|
380
|
+
if (data && typeof data === "object") {
|
|
381
|
+
data.toString = () => JSONbig.stringify(data);
|
|
382
|
+
}
|
|
335
383
|
return data;
|
|
336
384
|
}
|
|
337
385
|
static flatten(data, prefix = "") {
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts"],"names":[],"mappings":"AAAA,SAAS,OAAO,UAAU,YAAY;AACtC,SAAS,mBAAmB;AAE5B,OAAO,mBAAmB;AAC1B,MAAM,gBAAgB,cAAc,EAAE,eAAe,MAAM,CAAC;AAC5D,MAAM,oBAAoB,cAAc,EAAE,iBAAiB,KAAK,CAAC;AAEjE,MAAM,WAAW,OAAO,OAAO,gBAAgB;AAC/C,MAAM,WAAW,OAAO,OAAO,gBAAgB;AAC/C,MAAM,YAAY,OAAO,qBAAqB;AAC9C,MAAM,YAAY,OAAO,sBAAsB;AAE/C,SAAS,YAAY,OAAqB;AACtC,SAAO,UAAU,QACV,OAAO,UAAU,YACjB,MAAM,iBAAiB,QACvB,OAAO,MAAM,cAAc,cAC3B,OAAO,MAAM,YAAY,cACzB,OAAO,MAAM,aAAa;AACrC;AAEA,SAAS,QAAQ,MAAc,OAAiB;AAC5C,MAAI,YAAY,KAAK,GAAG;AACpB,QAAI,MAAM,UAAU,GAAG;AACnB,YAAM,M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,aAAa,OAAO,OAAO;AADtC,IAAM,SAAN;AAmUA,SAAS,aAAa","sourcesContent":["import { fetch, FormData, File } from 'node-fetch-native-with-agent';\nimport { createAgent } from 'node-fetch-native-with-agent/agent';\nimport { Models } from './models';\nimport JSONbigModule from 'json-bigint';\nconst JSONbigParser = JSONbigModule({ storeAsString: false });\nconst JSONbigSerializer = JSONbigModule({ useNativeBigInt: true });\n\nconst MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);\nconst MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);\nconst MAX_INT64 = BigInt('9223372036854775807');\nconst MIN_INT64 = BigInt('-9223372036854775808');\n\nfunction isBigNumber(value: any): boolean {\n return value !== null\n && typeof value === 'object'\n && value._isBigNumber === true\n && typeof value.isInteger === 'function'\n && typeof value.toFixed === 'function'\n && typeof value.toNumber === 'function';\n}\n\nfunction reviver(_key: string, value: any): any {\n if (isBigNumber(value)) {\n if (value.isInteger()) {\n const str = value.toFixed();\n const bi = BigInt(str);\n if (bi >= MIN_SAFE && bi <= MAX_SAFE) {\n return Number(str);\n }\n if (bi >= MIN_INT64 && bi <= MAX_INT64) {\n return bi;\n }\n return value.toNumber();\n }\n return value.toNumber();\n }\n return value;\n}\n\nconst JSONbig = {\n parse: (text: string) => JSONbigParser.parse(text, reviver),\n stringify: JSONbigSerializer.stringify\n};\n\ntype Payload = {\n [key: string]: any;\n}\n\ntype UploadProgress = {\n $id: string;\n progress: number;\n sizeUploaded: number;\n chunksTotal: number;\n chunksUploaded: number;\n}\n\ntype Headers = {\n [key: string]: string;\n}\n\nclass AppwriteException extends Error {\n code: number;\n response: string;\n type: string;\n constructor(message: string, code: number = 0, type: string = '', response: string = '') {\n super(message);\n this.name = 'AppwriteException';\n this.message = message;\n this.code = code;\n this.type = type;\n this.response = response;\n }\n}\n\nfunction getUserAgent() {\n let ua = 'AppwriteNodeJSSDK/22.1.2';\n\n // `process` is a global in Node.js, but not fully available in all runtimes.\n const platform: string[] = [];\n if (typeof process !== 'undefined') {\n if (typeof process.platform === 'string') platform.push(process.platform);\n if (typeof process.arch === 'string') platform.push(process.arch);\n } \n if (platform.length > 0) {\n ua += ` (${platform.join('; ')})`;\n }\n\n // `navigator.userAgent` is available in Node.js 21 and later.\n // It's also part of the WinterCG spec, so many edge runtimes provide it.\n // https://common-min-api.proposal.wintercg.org/#requirements-for-navigatoruseragent\n // @ts-ignore\n if (typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string') {\n // @ts-ignore\n ua += ` ${navigator.userAgent}`;\n\n // @ts-ignore\n } else if (typeof globalThis.EdgeRuntime === 'string') {\n ua += ` EdgeRuntime`;\n\n // Older Node.js versions don't have `navigator.userAgent`, so we have to use `process.version`.\n } else if (typeof process !== 'undefined' && typeof process.version === 'string') {\n ua += ` Node.js/${process.version}`;\n }\n\n return ua;\n}\n\nclass Client {\n static CHUNK_SIZE = 1024 * 1024 * 5;\n\n config = {\n endpoint: 'https://cloud.appwrite.io/v1',\n selfSigned: false,\n project: '',\n key: '',\n jwt: '',\n locale: '',\n session: '',\n forwardeduseragent: '',\n };\n headers: Headers = {\n 'x-sdk-name': 'Node.js',\n 'x-sdk-platform': 'server',\n 'x-sdk-language': 'nodejs',\n 'x-sdk-version': '22.1.2',\n 'user-agent' : getUserAgent(),\n 'X-Appwrite-Response-Format': '1.8.0',\n };\n\n /**\n * Set Endpoint\n *\n * Your project endpoint\n *\n * @param {string} endpoint\n *\n * @returns {this}\n */\n setEndpoint(endpoint: string): this {\n if (!endpoint || typeof endpoint !== 'string') {\n throw new AppwriteException('Endpoint must be a valid string');\n }\n\n if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {\n throw new AppwriteException('Invalid endpoint URL: ' + endpoint);\n }\n\n this.config.endpoint = endpoint;\n return this;\n }\n\n /**\n * Set self-signed\n *\n * @param {boolean} selfSigned\n *\n * @returns {this}\n */\n setSelfSigned(selfSigned: boolean): this {\n // @ts-ignore\n if (typeof globalThis.EdgeRuntime !== 'undefined') {\n console.warn('setSelfSigned is not supported in edge runtimes.');\n }\n\n this.config.selfSigned = selfSigned;\n\n return this;\n }\n\n /**\n * Add header\n *\n * @param {string} header\n * @param {string} value\n *\n * @returns {this}\n */\n addHeader(header: string, value: string): this {\n this.headers[header.toLowerCase()] = value;\n\n return this;\n }\n\n /**\n * Set Project\n *\n * Your project ID\n *\n * @param value string\n *\n * @return {this}\n */\n setProject(value: string): this {\n this.headers['X-Appwrite-Project'] = value;\n this.config.project = value;\n return this;\n }\n /**\n * Set Key\n *\n * Your secret API key\n *\n * @param value string\n *\n * @return {this}\n */\n setKey(value: string): this {\n this.headers['X-Appwrite-Key'] = value;\n this.config.key = value;\n return this;\n }\n /**\n * Set JWT\n *\n * Your secret JSON Web Token\n *\n * @param value string\n *\n * @return {this}\n */\n setJWT(value: string): this {\n this.headers['X-Appwrite-JWT'] = value;\n this.config.jwt = value;\n return this;\n }\n /**\n * Set Locale\n *\n * @param value string\n *\n * @return {this}\n */\n setLocale(value: string): this {\n this.headers['X-Appwrite-Locale'] = value;\n this.config.locale = value;\n return this;\n }\n /**\n * Set Session\n *\n * The user session to authenticate with\n *\n * @param value string\n *\n * @return {this}\n */\n setSession(value: string): this {\n this.headers['X-Appwrite-Session'] = value;\n this.config.session = value;\n return this;\n }\n /**\n * Set ForwardedUserAgent\n *\n * The user agent string of the client that made the request\n *\n * @param value string\n *\n * @return {this}\n */\n setForwardedUserAgent(value: string): this {\n this.headers['X-Forwarded-User-Agent'] = value;\n this.config.forwardeduseragent = value;\n return this;\n }\n\n prepareRequest(method: string, url: URL, headers: Headers = {}, params: Payload = {}): { uri: string, options: RequestInit } {\n method = method.toUpperCase();\n\n headers = Object.assign({}, this.headers, headers);\n\n let options: RequestInit = {\n method,\n headers,\n ...createAgent(this.config.endpoint, { rejectUnauthorized: !this.config.selfSigned }),\n };\n\n if (method === 'GET') {\n for (const [key, value] of Object.entries(Client.flatten(params))) {\n url.searchParams.append(key, value);\n }\n } else {\n switch (headers['content-type']) {\n case 'application/json':\n options.body = JSONbig.stringify(params);\n break;\n\n case 'multipart/form-data':\n const formData = new FormData();\n\n for (const [key, value] of Object.entries(params)) {\n if (value instanceof File) {\n formData.append(key, value, value.name);\n } else if (Array.isArray(value)) {\n for (const nestedValue of value) {\n formData.append(`${key}[]`, nestedValue);\n }\n } else {\n formData.append(key, value);\n }\n }\n\n options.body = formData;\n delete headers['content-type'];\n break;\n }\n }\n\n return { uri: url.toString(), options };\n }\n\n async chunkedUpload(method: string, url: URL, headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void) {\n const [fileParam, file] = Object.entries(originalPayload).find(([_, value]) => value instanceof File) ?? [];\n\n if (!file || !fileParam) {\n throw new Error('File not found in payload');\n }\n\n if (file.size <= Client.CHUNK_SIZE) {\n return await this.call(method, url, headers, originalPayload);\n }\n\n let start = 0;\n let response = null;\n\n while (start < file.size) {\n let end = start + Client.CHUNK_SIZE; // Prepare end for the next chunk\n if (end >= file.size) {\n end = file.size; // Adjust for the last chunk to include the last byte\n }\n\n headers['content-range'] = `bytes ${start}-${end-1}/${file.size}`;\n const chunk = file.slice(start, end);\n\n let payload = { ...originalPayload };\n payload[fileParam] = new File([chunk], file.name);\n\n response = await this.call(method, url, headers, payload);\n\n if (onProgress && typeof onProgress === 'function') {\n onProgress({\n $id: response.$id,\n progress: Math.round((end / file.size) * 100),\n sizeUploaded: end,\n chunksTotal: Math.ceil(file.size / Client.CHUNK_SIZE),\n chunksUploaded: Math.ceil(end / Client.CHUNK_SIZE)\n });\n }\n\n if (response && response.$id) {\n headers['x-appwrite-id'] = response.$id;\n }\n\n start = end;\n }\n\n return response;\n }\n\n async ping(): Promise<string> {\n return this.call('GET', new URL(this.config.endpoint + '/ping'));\n }\n\n async redirect(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise<string> {\n const { uri, options } = this.prepareRequest(method, url, headers, params);\n \n const response = await fetch(uri, {\n ...options,\n redirect: 'manual'\n });\n\n if (response.status !== 301 && response.status !== 302) {\n throw new AppwriteException('Invalid redirect', response.status);\n }\n\n return response.headers.get('location') || '';\n }\n\n async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise<any> {\n const { uri, options } = this.prepareRequest(method, url, headers, params);\n\n let data: any = null;\n\n const response = await fetch(uri, options);\n\n const warnings = response.headers.get('x-appwrite-warning');\n if (warnings) {\n warnings.split(';').forEach((warning: string) => console.warn('Warning: ' + warning));\n }\n\n if (response.headers.get('content-type')?.includes('application/json')) {\n data = JSONbig.parse(await response.text());\n } else if (responseType === 'arrayBuffer') {\n data = await response.arrayBuffer();\n } else {\n data = {\n message: await response.text()\n };\n }\n\n if (400 <= response.status) {\n let responseText = '';\n if (response.headers.get('content-type')?.includes('application/json') || responseType === 'arrayBuffer') {\n responseText = JSONbig.stringify(data);\n } else {\n responseText = data?.message;\n }\n throw new AppwriteException(data?.message, response.status, data?.type, responseText);\n }\n\n return data;\n }\n\n static flatten(data: Payload, prefix = ''): Payload {\n let output: Payload = {};\n\n for (const [key, value] of Object.entries(data)) {\n let finalKey = prefix ? prefix + '[' + key +']' : key;\n if (Array.isArray(value)) {\n output = { ...output, ...Client.flatten(value, finalKey) };\n } else {\n output[finalKey] = value;\n }\n }\n\n return output;\n }\n}\n\nexport { Client, AppwriteException };\nexport { Query } from './query';\nexport type { Models, Payload, UploadProgress };\nexport type { QueryTypes, QueryTypesList } from './query';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/client.ts"],"names":[],"mappings":"AAAA,SAAS,OAAO,UAAU,YAAY;AACtC,SAAS,mBAAmB;AAE5B,OAAO,mBAAmB;AAC1B,MAAM,gBAAgB,cAAc,EAAE,eAAe,MAAM,CAAC;AAC5D,MAAM,oBAAoB,cAAc,EAAE,iBAAiB,KAAK,CAAC;AAEjE,MAAM,WAAW,OAAO,OAAO,gBAAgB;AAC/C,MAAM,WAAW,OAAO,OAAO,gBAAgB;AAC/C,MAAM,YAAY,OAAO,qBAAqB;AAC9C,MAAM,YAAY,O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AAe;AACvC,aAAO,MAAM,SAAS,YAAY;AAAA,IACtC,OAAO;AACH,aAAO;AAAA,QACH,SAAS,MAAM,SAAS,KAAK;AAAA,MACjC;AAAA,IACJ;AAEA,QAAI,OAAO,SAAS,QAAQ;AACxB,UAAI,eAAe;AACnB,YAAI,cAAS,QAAQ,IAAI,cAAc,MAAnC,mBAAsC,SAAS,wBAAuB,iBAAiB,eAAe;AACtG,uBAAe,QAAQ,UAAU,IAAI;AAAA,MACzC,OAAO;AACH,uBAAe,6BAAM;AAAA,MACzB;AACA,YAAM,IAAI,kBAAkB,6BAAM,SAAS,SAAS,QAAQ,6BAAM,MAAM,YAAY;AAAA,IACxF;AAEA,QAAI,QAAQ,OAAO,SAAS,UAAU;AAClC,WAAK,WAAW,MAAM,QAAQ,UAAU,IAAI;AAAA,IAChD;AAEA,WAAO;AAAA,EACX;AAAA,EAEA,OAAO,QAAQ,MAAe,SAAS,IAAa;AAChD,QAAI,SAAkB,CAAC;AAEvB,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,IAAI,GAAG;AAC7C,UAAI,WAAW,SAAS,SAAS,MAAM,MAAK,MAAM;AAClD,UAAI,MAAM,QAAQ,KAAK,GAAG;AACtB,iBAAS,EAAE,GAAG,QAAQ,GAAG,QAAO,QAAQ,OAAO,QAAQ,EAAE;AAAA,MAC7D,OAAO;AACH,eAAO,QAAQ,IAAI;AAAA,MACvB;AAAA,IACJ;AAEA,WAAO;AAAA,EACX;AACJ;AAjXM,QACK,aAAa,OAAO,OAAO;AADtC,IAAM,SAAN;AAoXA,SAAS,aAAa","sourcesContent":["import { fetch, FormData, File } from 'node-fetch-native-with-agent';\nimport { createAgent } from 'node-fetch-native-with-agent/agent';\nimport { Models } from './models';\nimport JSONbigModule from 'json-bigint';\nconst JSONbigParser = JSONbigModule({ storeAsString: false });\nconst JSONbigSerializer = JSONbigModule({ useNativeBigInt: true });\n\nconst MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);\nconst MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);\nconst MAX_INT64 = BigInt('9223372036854775807');\nconst MIN_INT64 = BigInt('-9223372036854775808');\n\nfunction isBigNumber(value: any): boolean {\n return value !== null\n && typeof value === 'object'\n && value._isBigNumber === true\n && typeof value.isInteger === 'function'\n && typeof value.toFixed === 'function'\n && typeof value.toNumber === 'function';\n}\n\nfunction reviver(_key: string, value: any): any {\n if (isBigNumber(value)) {\n if (value.isInteger()) {\n const str = value.toFixed();\n const bi = BigInt(str);\n if (bi >= MIN_SAFE && bi <= MAX_SAFE) {\n return Number(str);\n }\n if (bi >= MIN_INT64 && bi <= MAX_INT64) {\n return bi;\n }\n return value.toNumber();\n }\n return value.toNumber();\n }\n return value;\n}\n\nconst JSONbig = {\n parse: (text: string) => JSONbigParser.parse(text, reviver),\n stringify: JSONbigSerializer.stringify\n};\n\ntype Payload = {\n [key: string]: any;\n}\n\ntype UploadProgress = {\n $id: string;\n progress: number;\n sizeUploaded: number;\n chunksTotal: number;\n chunksUploaded: number;\n}\n\ntype Headers = {\n [key: string]: string;\n}\n\nclass AppwriteException extends Error {\n code: number;\n response: string;\n type: string;\n constructor(message: string, code: number = 0, type: string = '', response: string = '') {\n super(message);\n this.name = 'AppwriteException';\n this.message = message;\n this.code = code;\n this.type = type;\n this.response = response;\n }\n}\n\nfunction getUserAgent() {\n let ua = 'AppwriteNodeJSSDK/23.0.0';\n\n // `process` is a global in Node.js, but not fully available in all runtimes.\n const platform: string[] = [];\n if (typeof process !== 'undefined') {\n if (typeof process.platform === 'string') platform.push(process.platform);\n if (typeof process.arch === 'string') platform.push(process.arch);\n } \n if (platform.length > 0) {\n ua += ` (${platform.join('; ')})`;\n }\n\n // `navigator.userAgent` is available in Node.js 21 and later.\n // It's also part of the WinterCG spec, so many edge runtimes provide it.\n // https://common-min-api.proposal.wintercg.org/#requirements-for-navigatoruseragent\n // @ts-ignore\n if (typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string') {\n // @ts-ignore\n ua += ` ${navigator.userAgent}`;\n\n // @ts-ignore\n } else if (typeof globalThis.EdgeRuntime === 'string') {\n ua += ` EdgeRuntime`;\n\n // Older Node.js versions don't have `navigator.userAgent`, so we have to use `process.version`.\n } else if (typeof process !== 'undefined' && typeof process.version === 'string') {\n ua += ` Node.js/${process.version}`;\n }\n\n return ua;\n}\n\nclass Client {\n static CHUNK_SIZE = 1024 * 1024 * 5;\n\n config = {\n endpoint: 'https://cloud.appwrite.io/v1',\n selfSigned: false,\n project: '',\n key: '',\n jwt: '',\n locale: '',\n session: '',\n forwardeduseragent: '',\n impersonateuserid: '',\n impersonateuseremail: '',\n impersonateuserphone: '',\n };\n headers: Headers = {\n 'x-sdk-name': 'Node.js',\n 'x-sdk-platform': 'server',\n 'x-sdk-language': 'nodejs',\n 'x-sdk-version': '23.0.0',\n 'user-agent' : getUserAgent(),\n 'X-Appwrite-Response-Format': '1.9.0',\n };\n\n /**\n * Set Endpoint\n *\n * Your project endpoint\n *\n * @param {string} endpoint\n *\n * @returns {this}\n */\n setEndpoint(endpoint: string): this {\n if (!endpoint || typeof endpoint !== 'string') {\n throw new AppwriteException('Endpoint must be a valid string');\n }\n\n if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {\n throw new AppwriteException('Invalid endpoint URL: ' + endpoint);\n }\n\n this.config.endpoint = endpoint;\n return this;\n }\n\n /**\n * Set self-signed\n *\n * @param {boolean} selfSigned\n *\n * @returns {this}\n */\n setSelfSigned(selfSigned: boolean): this {\n // @ts-ignore\n if (typeof globalThis.EdgeRuntime !== 'undefined') {\n console.warn('setSelfSigned is not supported in edge runtimes.');\n }\n\n this.config.selfSigned = selfSigned;\n\n return this;\n }\n\n /**\n * Add header\n *\n * @param {string} header\n * @param {string} value\n *\n * @returns {this}\n */\n addHeader(header: string, value: string): this {\n this.headers[header.toLowerCase()] = value;\n\n return this;\n }\n\n /**\n * Set Project\n *\n * Your project ID\n *\n * @param value string\n *\n * @return {this}\n */\n setProject(value: string): this {\n this.headers['X-Appwrite-Project'] = value;\n this.config.project = value;\n return this;\n }\n /**\n * Set Key\n *\n * Your secret API key\n *\n * @param value string\n *\n * @return {this}\n */\n setKey(value: string): this {\n this.headers['X-Appwrite-Key'] = value;\n this.config.key = value;\n return this;\n }\n /**\n * Set JWT\n *\n * Your secret JSON Web Token\n *\n * @param value string\n *\n * @return {this}\n */\n setJWT(value: string): this {\n this.headers['X-Appwrite-JWT'] = value;\n this.config.jwt = value;\n return this;\n }\n /**\n * Set Locale\n *\n * @param value string\n *\n * @return {this}\n */\n setLocale(value: string): this {\n this.headers['X-Appwrite-Locale'] = value;\n this.config.locale = value;\n return this;\n }\n /**\n * Set Session\n *\n * The user session to authenticate with\n *\n * @param value string\n *\n * @return {this}\n */\n setSession(value: string): this {\n this.headers['X-Appwrite-Session'] = value;\n this.config.session = value;\n return this;\n }\n /**\n * Set ForwardedUserAgent\n *\n * The user agent string of the client that made the request\n *\n * @param value string\n *\n * @return {this}\n */\n setForwardedUserAgent(value: string): this {\n this.headers['X-Forwarded-User-Agent'] = value;\n this.config.forwardeduseragent = value;\n return this;\n }\n /**\n * Set ImpersonateUserId\n *\n * Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.\n *\n * @param value string\n *\n * @return {this}\n */\n setImpersonateUserId(value: string): this {\n this.headers['X-Appwrite-Impersonate-User-Id'] = value;\n this.config.impersonateuserid = value;\n return this;\n }\n /**\n * Set ImpersonateUserEmail\n *\n * Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.\n *\n * @param value string\n *\n * @return {this}\n */\n setImpersonateUserEmail(value: string): this {\n this.headers['X-Appwrite-Impersonate-User-Email'] = value;\n this.config.impersonateuseremail = value;\n return this;\n }\n /**\n * Set ImpersonateUserPhone\n *\n * Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.\n *\n * @param value string\n *\n * @return {this}\n */\n setImpersonateUserPhone(value: string): this {\n this.headers['X-Appwrite-Impersonate-User-Phone'] = value;\n this.config.impersonateuserphone = value;\n return this;\n }\n\n prepareRequest(method: string, url: URL, headers: Headers = {}, params: Payload = {}): { uri: string, options: RequestInit } {\n method = method.toUpperCase();\n\n headers = Object.assign({}, this.headers, headers);\n\n let options: RequestInit = {\n method,\n headers,\n ...createAgent(this.config.endpoint, { rejectUnauthorized: !this.config.selfSigned }),\n };\n\n if (method === 'GET') {\n for (const [key, value] of Object.entries(Client.flatten(params))) {\n url.searchParams.append(key, value);\n }\n } else {\n switch (headers['content-type']) {\n case 'application/json':\n options.body = JSONbig.stringify(params);\n break;\n\n case 'multipart/form-data':\n const formData = new FormData();\n\n for (const [key, value] of Object.entries(params)) {\n if (value instanceof File) {\n formData.append(key, value, value.name);\n } else if (Array.isArray(value)) {\n for (const nestedValue of value) {\n formData.append(`${key}[]`, nestedValue);\n }\n } else {\n formData.append(key, value);\n }\n }\n\n options.body = formData;\n delete headers['content-type'];\n break;\n }\n }\n\n return { uri: url.toString(), options };\n }\n\n async chunkedUpload(method: string, url: URL, headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void) {\n const [fileParam, file] = Object.entries(originalPayload).find(([_, value]) => value instanceof File) ?? [];\n\n if (!file || !fileParam) {\n throw new Error('File not found in payload');\n }\n\n if (file.size <= Client.CHUNK_SIZE) {\n return await this.call(method, url, headers, originalPayload);\n }\n\n let start = 0;\n let response = null;\n\n while (start < file.size) {\n let end = start + Client.CHUNK_SIZE; // Prepare end for the next chunk\n if (end >= file.size) {\n end = file.size; // Adjust for the last chunk to include the last byte\n }\n\n headers['content-range'] = `bytes ${start}-${end-1}/${file.size}`;\n const chunk = file.slice(start, end);\n\n let payload = { ...originalPayload };\n payload[fileParam] = new File([chunk], file.name);\n\n response = await this.call(method, url, headers, payload);\n\n if (onProgress && typeof onProgress === 'function') {\n onProgress({\n $id: response.$id,\n progress: Math.round((end / file.size) * 100),\n sizeUploaded: end,\n chunksTotal: Math.ceil(file.size / Client.CHUNK_SIZE),\n chunksUploaded: Math.ceil(end / Client.CHUNK_SIZE)\n });\n }\n\n if (response && response.$id) {\n headers['x-appwrite-id'] = response.$id;\n }\n\n start = end;\n }\n\n return response;\n }\n\n async ping(): Promise<string> {\n return this.call('GET', new URL(this.config.endpoint + '/ping'));\n }\n\n async redirect(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise<string> {\n const { uri, options } = this.prepareRequest(method, url, headers, params);\n \n const response = await fetch(uri, {\n ...options,\n redirect: 'manual'\n });\n\n if (response.status !== 301 && response.status !== 302) {\n throw new AppwriteException('Invalid redirect', response.status);\n }\n\n return response.headers.get('location') || '';\n }\n\n async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise<any> {\n const { uri, options } = this.prepareRequest(method, url, headers, params);\n\n let data: any = null;\n\n const response = await fetch(uri, options);\n\n const warnings = response.headers.get('x-appwrite-warning');\n if (warnings) {\n warnings.split(';').forEach((warning: string) => console.warn('Warning: ' + warning));\n }\n\n if (response.headers.get('content-type')?.includes('application/json')) {\n data = JSONbig.parse(await response.text());\n } else if (responseType === 'arrayBuffer') {\n data = await response.arrayBuffer();\n } else {\n data = {\n message: await response.text()\n };\n }\n\n if (400 <= response.status) {\n let responseText = '';\n if (response.headers.get('content-type')?.includes('application/json') || responseType === 'arrayBuffer') {\n responseText = JSONbig.stringify(data);\n } else {\n responseText = data?.message;\n }\n throw new AppwriteException(data?.message, response.status, data?.type, responseText);\n }\n\n if (data && typeof data === 'object') {\n data.toString = () => JSONbig.stringify(data);\n }\n\n return data;\n }\n\n static flatten(data: Payload, prefix = ''): Payload {\n let output: Payload = {};\n\n for (const [key, value] of Object.entries(data)) {\n let finalKey = prefix ? prefix + '[' + key +']' : key;\n if (Array.isArray(value)) {\n output = { ...output, ...Client.flatten(value, finalKey) };\n } else {\n output[finalKey] = value;\n }\n }\n\n return output;\n }\n}\n\nexport { Client, AppwriteException };\nexport { Query } from './query';\nexport type { Models, Payload, UploadProgress };\nexport type { QueryTypes, QueryTypesList } from './query';\n"]}
|
package/dist/client.mjs
CHANGED
|
@@ -45,7 +45,7 @@ var AppwriteException = class extends Error {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
function getUserAgent() {
|
|
48
|
-
let ua = "AppwriteNodeJSSDK/
|
|
48
|
+
let ua = "AppwriteNodeJSSDK/23.0.0";
|
|
49
49
|
const platform = [];
|
|
50
50
|
if (typeof process !== "undefined") {
|
|
51
51
|
if (typeof process.platform === "string")
|
|
@@ -75,15 +75,18 @@ var _Client = class _Client {
|
|
|
75
75
|
jwt: "",
|
|
76
76
|
locale: "",
|
|
77
77
|
session: "",
|
|
78
|
-
forwardeduseragent: ""
|
|
78
|
+
forwardeduseragent: "",
|
|
79
|
+
impersonateuserid: "",
|
|
80
|
+
impersonateuseremail: "",
|
|
81
|
+
impersonateuserphone: ""
|
|
79
82
|
};
|
|
80
83
|
this.headers = {
|
|
81
84
|
"x-sdk-name": "Node.js",
|
|
82
85
|
"x-sdk-platform": "server",
|
|
83
86
|
"x-sdk-language": "nodejs",
|
|
84
|
-
"x-sdk-version": "
|
|
87
|
+
"x-sdk-version": "23.0.0",
|
|
85
88
|
"user-agent": getUserAgent(),
|
|
86
|
-
"X-Appwrite-Response-Format": "1.
|
|
89
|
+
"X-Appwrite-Response-Format": "1.9.0"
|
|
87
90
|
};
|
|
88
91
|
}
|
|
89
92
|
/**
|
|
@@ -213,6 +216,48 @@ var _Client = class _Client {
|
|
|
213
216
|
this.config.forwardeduseragent = value;
|
|
214
217
|
return this;
|
|
215
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Set ImpersonateUserId
|
|
221
|
+
*
|
|
222
|
+
* Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
|
|
223
|
+
*
|
|
224
|
+
* @param value string
|
|
225
|
+
*
|
|
226
|
+
* @return {this}
|
|
227
|
+
*/
|
|
228
|
+
setImpersonateUserId(value) {
|
|
229
|
+
this.headers["X-Appwrite-Impersonate-User-Id"] = value;
|
|
230
|
+
this.config.impersonateuserid = value;
|
|
231
|
+
return this;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Set ImpersonateUserEmail
|
|
235
|
+
*
|
|
236
|
+
* Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
|
|
237
|
+
*
|
|
238
|
+
* @param value string
|
|
239
|
+
*
|
|
240
|
+
* @return {this}
|
|
241
|
+
*/
|
|
242
|
+
setImpersonateUserEmail(value) {
|
|
243
|
+
this.headers["X-Appwrite-Impersonate-User-Email"] = value;
|
|
244
|
+
this.config.impersonateuseremail = value;
|
|
245
|
+
return this;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Set ImpersonateUserPhone
|
|
249
|
+
*
|
|
250
|
+
* Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.
|
|
251
|
+
*
|
|
252
|
+
* @param value string
|
|
253
|
+
*
|
|
254
|
+
* @return {this}
|
|
255
|
+
*/
|
|
256
|
+
setImpersonateUserPhone(value) {
|
|
257
|
+
this.headers["X-Appwrite-Impersonate-User-Phone"] = value;
|
|
258
|
+
this.config.impersonateuserphone = value;
|
|
259
|
+
return this;
|
|
260
|
+
}
|
|
216
261
|
prepareRequest(method, url, headers = {}, params = {}) {
|
|
217
262
|
method = method.toUpperCase();
|
|
218
263
|
headers = Object.assign({}, this.headers, headers);
|
|
@@ -327,6 +372,9 @@ var _Client = class _Client {
|
|
|
327
372
|
}
|
|
328
373
|
throw new AppwriteException(data == null ? void 0 : data.message, response.status, data == null ? void 0 : data.type, responseText);
|
|
329
374
|
}
|
|
375
|
+
if (data && typeof data === "object") {
|
|
376
|
+
data.toString = () => JSONbig.stringify(data);
|
|
377
|
+
}
|
|
330
378
|
return data;
|
|
331
379
|
}
|
|
332
380
|
static flatten(data, prefix = "") {
|
package/dist/client.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts"],"names":[],"mappings":";AAAA,SAAS,OAAO,UAAU,YAAY;AACtC,SAAS,mBAAmB;AAE5B,OAAO,mBAAmB;AA2a1B,SAAS,aAAa;AA1atB,IAAM,gBAAgB,cAAc,EAAE,eAAe,MAAM,CAAC;AAC5D,IAAM,oBAAoB,cAAc,EAAE,iBAAiB,KAAK,CAAC;AAEjE,IAAM,WAAW,OAAO,OAAO,gBAAgB;AAC/C,IAAM,WAAW,OAAO,OAAO,gBAAgB;AAC/C,IAAM,YAAY,OAAO,qBAAqB;AAC9C,IAAM,YAAY,OAAO,sBAAsB;AAE/C,SAAS,YAAY,OAAqB;AACtC,SAAO,UAAU,QACV,OAAO,UAAU,YACjB,MAAM,iBAAiB,QACvB,OAAO,MAAM,cAAc,cAC3B,OAAO,MAAM,YAAY,cACzB,OAAO,MAAM,aAAa;AACrC;AAEA,SAAS,QAAQ,MAAc,OAAiB;AAC5C,MAAI,YAA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AAAA,MACvB;AAAA,IACJ;AAEA,WAAO;AAAA,EACX;AACJ;AAhUM,QACK,aAAa,OAAO,OAAO;AADtC,IAAM,SAAN","sourcesContent":["import { fetch, FormData, File } from 'node-fetch-native-with-agent';\nimport { createAgent } from 'node-fetch-native-with-agent/agent';\nimport { Models } from './models';\nimport JSONbigModule from 'json-bigint';\nconst JSONbigParser = JSONbigModule({ storeAsString: false });\nconst JSONbigSerializer = JSONbigModule({ useNativeBigInt: true });\n\nconst MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);\nconst MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);\nconst MAX_INT64 = BigInt('9223372036854775807');\nconst MIN_INT64 = BigInt('-9223372036854775808');\n\nfunction isBigNumber(value: any): boolean {\n return value !== null\n && typeof value === 'object'\n && value._isBigNumber === true\n && typeof value.isInteger === 'function'\n && typeof value.toFixed === 'function'\n && typeof value.toNumber === 'function';\n}\n\nfunction reviver(_key: string, value: any): any {\n if (isBigNumber(value)) {\n if (value.isInteger()) {\n const str = value.toFixed();\n const bi = BigInt(str);\n if (bi >= MIN_SAFE && bi <= MAX_SAFE) {\n return Number(str);\n }\n if (bi >= MIN_INT64 && bi <= MAX_INT64) {\n return bi;\n }\n return value.toNumber();\n }\n return value.toNumber();\n }\n return value;\n}\n\nconst JSONbig = {\n parse: (text: string) => JSONbigParser.parse(text, reviver),\n stringify: JSONbigSerializer.stringify\n};\n\ntype Payload = {\n [key: string]: any;\n}\n\ntype UploadProgress = {\n $id: string;\n progress: number;\n sizeUploaded: number;\n chunksTotal: number;\n chunksUploaded: number;\n}\n\ntype Headers = {\n [key: string]: string;\n}\n\nclass AppwriteException extends Error {\n code: number;\n response: string;\n type: string;\n constructor(message: string, code: number = 0, type: string = '', response: string = '') {\n super(message);\n this.name = 'AppwriteException';\n this.message = message;\n this.code = code;\n this.type = type;\n this.response = response;\n }\n}\n\nfunction getUserAgent() {\n let ua = 'AppwriteNodeJSSDK/22.1.2';\n\n // `process` is a global in Node.js, but not fully available in all runtimes.\n const platform: string[] = [];\n if (typeof process !== 'undefined') {\n if (typeof process.platform === 'string') platform.push(process.platform);\n if (typeof process.arch === 'string') platform.push(process.arch);\n } \n if (platform.length > 0) {\n ua += ` (${platform.join('; ')})`;\n }\n\n // `navigator.userAgent` is available in Node.js 21 and later.\n // It's also part of the WinterCG spec, so many edge runtimes provide it.\n // https://common-min-api.proposal.wintercg.org/#requirements-for-navigatoruseragent\n // @ts-ignore\n if (typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string') {\n // @ts-ignore\n ua += ` ${navigator.userAgent}`;\n\n // @ts-ignore\n } else if (typeof globalThis.EdgeRuntime === 'string') {\n ua += ` EdgeRuntime`;\n\n // Older Node.js versions don't have `navigator.userAgent`, so we have to use `process.version`.\n } else if (typeof process !== 'undefined' && typeof process.version === 'string') {\n ua += ` Node.js/${process.version}`;\n }\n\n return ua;\n}\n\nclass Client {\n static CHUNK_SIZE = 1024 * 1024 * 5;\n\n config = {\n endpoint: 'https://cloud.appwrite.io/v1',\n selfSigned: false,\n project: '',\n key: '',\n jwt: '',\n locale: '',\n session: '',\n forwardeduseragent: '',\n };\n headers: Headers = {\n 'x-sdk-name': 'Node.js',\n 'x-sdk-platform': 'server',\n 'x-sdk-language': 'nodejs',\n 'x-sdk-version': '22.1.2',\n 'user-agent' : getUserAgent(),\n 'X-Appwrite-Response-Format': '1.8.0',\n };\n\n /**\n * Set Endpoint\n *\n * Your project endpoint\n *\n * @param {string} endpoint\n *\n * @returns {this}\n */\n setEndpoint(endpoint: string): this {\n if (!endpoint || typeof endpoint !== 'string') {\n throw new AppwriteException('Endpoint must be a valid string');\n }\n\n if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {\n throw new AppwriteException('Invalid endpoint URL: ' + endpoint);\n }\n\n this.config.endpoint = endpoint;\n return this;\n }\n\n /**\n * Set self-signed\n *\n * @param {boolean} selfSigned\n *\n * @returns {this}\n */\n setSelfSigned(selfSigned: boolean): this {\n // @ts-ignore\n if (typeof globalThis.EdgeRuntime !== 'undefined') {\n console.warn('setSelfSigned is not supported in edge runtimes.');\n }\n\n this.config.selfSigned = selfSigned;\n\n return this;\n }\n\n /**\n * Add header\n *\n * @param {string} header\n * @param {string} value\n *\n * @returns {this}\n */\n addHeader(header: string, value: string): this {\n this.headers[header.toLowerCase()] = value;\n\n return this;\n }\n\n /**\n * Set Project\n *\n * Your project ID\n *\n * @param value string\n *\n * @return {this}\n */\n setProject(value: string): this {\n this.headers['X-Appwrite-Project'] = value;\n this.config.project = value;\n return this;\n }\n /**\n * Set Key\n *\n * Your secret API key\n *\n * @param value string\n *\n * @return {this}\n */\n setKey(value: string): this {\n this.headers['X-Appwrite-Key'] = value;\n this.config.key = value;\n return this;\n }\n /**\n * Set JWT\n *\n * Your secret JSON Web Token\n *\n * @param value string\n *\n * @return {this}\n */\n setJWT(value: string): this {\n this.headers['X-Appwrite-JWT'] = value;\n this.config.jwt = value;\n return this;\n }\n /**\n * Set Locale\n *\n * @param value string\n *\n * @return {this}\n */\n setLocale(value: string): this {\n this.headers['X-Appwrite-Locale'] = value;\n this.config.locale = value;\n return this;\n }\n /**\n * Set Session\n *\n * The user session to authenticate with\n *\n * @param value string\n *\n * @return {this}\n */\n setSession(value: string): this {\n this.headers['X-Appwrite-Session'] = value;\n this.config.session = value;\n return this;\n }\n /**\n * Set ForwardedUserAgent\n *\n * The user agent string of the client that made the request\n *\n * @param value string\n *\n * @return {this}\n */\n setForwardedUserAgent(value: string): this {\n this.headers['X-Forwarded-User-Agent'] = value;\n this.config.forwardeduseragent = value;\n return this;\n }\n\n prepareRequest(method: string, url: URL, headers: Headers = {}, params: Payload = {}): { uri: string, options: RequestInit } {\n method = method.toUpperCase();\n\n headers = Object.assign({}, this.headers, headers);\n\n let options: RequestInit = {\n method,\n headers,\n ...createAgent(this.config.endpoint, { rejectUnauthorized: !this.config.selfSigned }),\n };\n\n if (method === 'GET') {\n for (const [key, value] of Object.entries(Client.flatten(params))) {\n url.searchParams.append(key, value);\n }\n } else {\n switch (headers['content-type']) {\n case 'application/json':\n options.body = JSONbig.stringify(params);\n break;\n\n case 'multipart/form-data':\n const formData = new FormData();\n\n for (const [key, value] of Object.entries(params)) {\n if (value instanceof File) {\n formData.append(key, value, value.name);\n } else if (Array.isArray(value)) {\n for (const nestedValue of value) {\n formData.append(`${key}[]`, nestedValue);\n }\n } else {\n formData.append(key, value);\n }\n }\n\n options.body = formData;\n delete headers['content-type'];\n break;\n }\n }\n\n return { uri: url.toString(), options };\n }\n\n async chunkedUpload(method: string, url: URL, headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void) {\n const [fileParam, file] = Object.entries(originalPayload).find(([_, value]) => value instanceof File) ?? [];\n\n if (!file || !fileParam) {\n throw new Error('File not found in payload');\n }\n\n if (file.size <= Client.CHUNK_SIZE) {\n return await this.call(method, url, headers, originalPayload);\n }\n\n let start = 0;\n let response = null;\n\n while (start < file.size) {\n let end = start + Client.CHUNK_SIZE; // Prepare end for the next chunk\n if (end >= file.size) {\n end = file.size; // Adjust for the last chunk to include the last byte\n }\n\n headers['content-range'] = `bytes ${start}-${end-1}/${file.size}`;\n const chunk = file.slice(start, end);\n\n let payload = { ...originalPayload };\n payload[fileParam] = new File([chunk], file.name);\n\n response = await this.call(method, url, headers, payload);\n\n if (onProgress && typeof onProgress === 'function') {\n onProgress({\n $id: response.$id,\n progress: Math.round((end / file.size) * 100),\n sizeUploaded: end,\n chunksTotal: Math.ceil(file.size / Client.CHUNK_SIZE),\n chunksUploaded: Math.ceil(end / Client.CHUNK_SIZE)\n });\n }\n\n if (response && response.$id) {\n headers['x-appwrite-id'] = response.$id;\n }\n\n start = end;\n }\n\n return response;\n }\n\n async ping(): Promise<string> {\n return this.call('GET', new URL(this.config.endpoint + '/ping'));\n }\n\n async redirect(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise<string> {\n const { uri, options } = this.prepareRequest(method, url, headers, params);\n \n const response = await fetch(uri, {\n ...options,\n redirect: 'manual'\n });\n\n if (response.status !== 301 && response.status !== 302) {\n throw new AppwriteException('Invalid redirect', response.status);\n }\n\n return response.headers.get('location') || '';\n }\n\n async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise<any> {\n const { uri, options } = this.prepareRequest(method, url, headers, params);\n\n let data: any = null;\n\n const response = await fetch(uri, options);\n\n const warnings = response.headers.get('x-appwrite-warning');\n if (warnings) {\n warnings.split(';').forEach((warning: string) => console.warn('Warning: ' + warning));\n }\n\n if (response.headers.get('content-type')?.includes('application/json')) {\n data = JSONbig.parse(await response.text());\n } else if (responseType === 'arrayBuffer') {\n data = await response.arrayBuffer();\n } else {\n data = {\n message: await response.text()\n };\n }\n\n if (400 <= response.status) {\n let responseText = '';\n if (response.headers.get('content-type')?.includes('application/json') || responseType === 'arrayBuffer') {\n responseText = JSONbig.stringify(data);\n } else {\n responseText = data?.message;\n }\n throw new AppwriteException(data?.message, response.status, data?.type, responseText);\n }\n\n return data;\n }\n\n static flatten(data: Payload, prefix = ''): Payload {\n let output: Payload = {};\n\n for (const [key, value] of Object.entries(data)) {\n let finalKey = prefix ? prefix + '[' + key +']' : key;\n if (Array.isArray(value)) {\n output = { ...output, ...Client.flatten(value, finalKey) };\n } else {\n output[finalKey] = value;\n }\n }\n\n return output;\n }\n}\n\nexport { Client, AppwriteException };\nexport { Query } from './query';\nexport type { Models, Payload, UploadProgress };\nexport type { QueryTypes, QueryTypesList } from './query';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/client.ts"],"names":[],"mappings":";AAAA,SAAS,OAAO,UAAU,YAAY;AACtC,SAAS,mBAAmB;AAE5B,OAAO,mBAAmB;AA4d1B,SAAS,aAAa;AA3dtB,IAAM,gBAAgB,cAAc,EAAE,eAAe,MAAM,CAAC;AAC5D,IAAM,oBAAoB,cAAc,EAAE,iBAAiB,KAAK,CAAC;AAEjE,IAAM,WAAW,OAAO,OAAO,gBAAgB;AAC/C,IAAM,WAAW,OAAO,OA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aAAO,QAAQ,MAAM,MAAM,SAAS,KAAK,CAAC;AAAA,IAC9C,WAAW,iBAAiB,eAAe;AACvC,aAAO,MAAM,SAAS,YAAY;AAAA,IACtC,OAAO;AACH,aAAO;AAAA,QACH,SAAS,MAAM,SAAS,KAAK;AAAA,MACjC;AAAA,IACJ;AAEA,QAAI,OAAO,SAAS,QAAQ;AACxB,UAAI,eAAe;AACnB,YAAI,cAAS,QAAQ,IAAI,cAAc,MAAnC,mBAAsC,SAAS,wBAAuB,iBAAiB,eAAe;AACtG,uBAAe,QAAQ,UAAU,IAAI;AAAA,MACzC,OAAO;AACH,uBAAe,6BAAM;AAAA,MACzB;AACA,YAAM,IAAI,kBAAkB,6BAAM,SAAS,SAAS,QAAQ,6BAAM,MAAM,YAAY;AAAA,IACxF;AAEA,QAAI,QAAQ,OAAO,SAAS,UAAU;AAClC,WAAK,WAAW,MAAM,QAAQ,UAAU,IAAI;AAAA,IAChD;AAEA,WAAO;AAAA,EACX;AAAA,EAEA,OAAO,QAAQ,MAAe,SAAS,IAAa;AAChD,QAAI,SAAkB,CAAC;AAEvB,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,IAAI,GAAG;AAC7C,UAAI,WAAW,SAAS,SAAS,MAAM,MAAK,MAAM;AAClD,UAAI,MAAM,QAAQ,KAAK,GAAG;AACtB,iBAAS,EAAE,GAAG,QAAQ,GAAG,QAAO,QAAQ,OAAO,QAAQ,EAAE;AAAA,MAC7D,OAAO;AACH,eAAO,QAAQ,IAAI;AAAA,MACvB;AAAA,IACJ;AAEA,WAAO;AAAA,EACX;AACJ;AAjXM,QACK,aAAa,OAAO,OAAO;AADtC,IAAM,SAAN","sourcesContent":["import { fetch, FormData, File } from 'node-fetch-native-with-agent';\nimport { createAgent } from 'node-fetch-native-with-agent/agent';\nimport { Models } from './models';\nimport JSONbigModule from 'json-bigint';\nconst JSONbigParser = JSONbigModule({ storeAsString: false });\nconst JSONbigSerializer = JSONbigModule({ useNativeBigInt: true });\n\nconst MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);\nconst MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);\nconst MAX_INT64 = BigInt('9223372036854775807');\nconst MIN_INT64 = BigInt('-9223372036854775808');\n\nfunction isBigNumber(value: any): boolean {\n return value !== null\n && typeof value === 'object'\n && value._isBigNumber === true\n && typeof value.isInteger === 'function'\n && typeof value.toFixed === 'function'\n && typeof value.toNumber === 'function';\n}\n\nfunction reviver(_key: string, value: any): any {\n if (isBigNumber(value)) {\n if (value.isInteger()) {\n const str = value.toFixed();\n const bi = BigInt(str);\n if (bi >= MIN_SAFE && bi <= MAX_SAFE) {\n return Number(str);\n }\n if (bi >= MIN_INT64 && bi <= MAX_INT64) {\n return bi;\n }\n return value.toNumber();\n }\n return value.toNumber();\n }\n return value;\n}\n\nconst JSONbig = {\n parse: (text: string) => JSONbigParser.parse(text, reviver),\n stringify: JSONbigSerializer.stringify\n};\n\ntype Payload = {\n [key: string]: any;\n}\n\ntype UploadProgress = {\n $id: string;\n progress: number;\n sizeUploaded: number;\n chunksTotal: number;\n chunksUploaded: number;\n}\n\ntype Headers = {\n [key: string]: string;\n}\n\nclass AppwriteException extends Error {\n code: number;\n response: string;\n type: string;\n constructor(message: string, code: number = 0, type: string = '', response: string = '') {\n super(message);\n this.name = 'AppwriteException';\n this.message = message;\n this.code = code;\n this.type = type;\n this.response = response;\n }\n}\n\nfunction getUserAgent() {\n let ua = 'AppwriteNodeJSSDK/23.0.0';\n\n // `process` is a global in Node.js, but not fully available in all runtimes.\n const platform: string[] = [];\n if (typeof process !== 'undefined') {\n if (typeof process.platform === 'string') platform.push(process.platform);\n if (typeof process.arch === 'string') platform.push(process.arch);\n } \n if (platform.length > 0) {\n ua += ` (${platform.join('; ')})`;\n }\n\n // `navigator.userAgent` is available in Node.js 21 and later.\n // It's also part of the WinterCG spec, so many edge runtimes provide it.\n // https://common-min-api.proposal.wintercg.org/#requirements-for-navigatoruseragent\n // @ts-ignore\n if (typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string') {\n // @ts-ignore\n ua += ` ${navigator.userAgent}`;\n\n // @ts-ignore\n } else if (typeof globalThis.EdgeRuntime === 'string') {\n ua += ` EdgeRuntime`;\n\n // Older Node.js versions don't have `navigator.userAgent`, so we have to use `process.version`.\n } else if (typeof process !== 'undefined' && typeof process.version === 'string') {\n ua += ` Node.js/${process.version}`;\n }\n\n return ua;\n}\n\nclass Client {\n static CHUNK_SIZE = 1024 * 1024 * 5;\n\n config = {\n endpoint: 'https://cloud.appwrite.io/v1',\n selfSigned: false,\n project: '',\n key: '',\n jwt: '',\n locale: '',\n session: '',\n forwardeduseragent: '',\n impersonateuserid: '',\n impersonateuseremail: '',\n impersonateuserphone: '',\n };\n headers: Headers = {\n 'x-sdk-name': 'Node.js',\n 'x-sdk-platform': 'server',\n 'x-sdk-language': 'nodejs',\n 'x-sdk-version': '23.0.0',\n 'user-agent' : getUserAgent(),\n 'X-Appwrite-Response-Format': '1.9.0',\n };\n\n /**\n * Set Endpoint\n *\n * Your project endpoint\n *\n * @param {string} endpoint\n *\n * @returns {this}\n */\n setEndpoint(endpoint: string): this {\n if (!endpoint || typeof endpoint !== 'string') {\n throw new AppwriteException('Endpoint must be a valid string');\n }\n\n if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {\n throw new AppwriteException('Invalid endpoint URL: ' + endpoint);\n }\n\n this.config.endpoint = endpoint;\n return this;\n }\n\n /**\n * Set self-signed\n *\n * @param {boolean} selfSigned\n *\n * @returns {this}\n */\n setSelfSigned(selfSigned: boolean): this {\n // @ts-ignore\n if (typeof globalThis.EdgeRuntime !== 'undefined') {\n console.warn('setSelfSigned is not supported in edge runtimes.');\n }\n\n this.config.selfSigned = selfSigned;\n\n return this;\n }\n\n /**\n * Add header\n *\n * @param {string} header\n * @param {string} value\n *\n * @returns {this}\n */\n addHeader(header: string, value: string): this {\n this.headers[header.toLowerCase()] = value;\n\n return this;\n }\n\n /**\n * Set Project\n *\n * Your project ID\n *\n * @param value string\n *\n * @return {this}\n */\n setProject(value: string): this {\n this.headers['X-Appwrite-Project'] = value;\n this.config.project = value;\n return this;\n }\n /**\n * Set Key\n *\n * Your secret API key\n *\n * @param value string\n *\n * @return {this}\n */\n setKey(value: string): this {\n this.headers['X-Appwrite-Key'] = value;\n this.config.key = value;\n return this;\n }\n /**\n * Set JWT\n *\n * Your secret JSON Web Token\n *\n * @param value string\n *\n * @return {this}\n */\n setJWT(value: string): this {\n this.headers['X-Appwrite-JWT'] = value;\n this.config.jwt = value;\n return this;\n }\n /**\n * Set Locale\n *\n * @param value string\n *\n * @return {this}\n */\n setLocale(value: string): this {\n this.headers['X-Appwrite-Locale'] = value;\n this.config.locale = value;\n return this;\n }\n /**\n * Set Session\n *\n * The user session to authenticate with\n *\n * @param value string\n *\n * @return {this}\n */\n setSession(value: string): this {\n this.headers['X-Appwrite-Session'] = value;\n this.config.session = value;\n return this;\n }\n /**\n * Set ForwardedUserAgent\n *\n * The user agent string of the client that made the request\n *\n * @param value string\n *\n * @return {this}\n */\n setForwardedUserAgent(value: string): this {\n this.headers['X-Forwarded-User-Agent'] = value;\n this.config.forwardeduseragent = value;\n return this;\n }\n /**\n * Set ImpersonateUserId\n *\n * Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.\n *\n * @param value string\n *\n * @return {this}\n */\n setImpersonateUserId(value: string): this {\n this.headers['X-Appwrite-Impersonate-User-Id'] = value;\n this.config.impersonateuserid = value;\n return this;\n }\n /**\n * Set ImpersonateUserEmail\n *\n * Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.\n *\n * @param value string\n *\n * @return {this}\n */\n setImpersonateUserEmail(value: string): this {\n this.headers['X-Appwrite-Impersonate-User-Email'] = value;\n this.config.impersonateuseremail = value;\n return this;\n }\n /**\n * Set ImpersonateUserPhone\n *\n * Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.\n *\n * @param value string\n *\n * @return {this}\n */\n setImpersonateUserPhone(value: string): this {\n this.headers['X-Appwrite-Impersonate-User-Phone'] = value;\n this.config.impersonateuserphone = value;\n return this;\n }\n\n prepareRequest(method: string, url: URL, headers: Headers = {}, params: Payload = {}): { uri: string, options: RequestInit } {\n method = method.toUpperCase();\n\n headers = Object.assign({}, this.headers, headers);\n\n let options: RequestInit = {\n method,\n headers,\n ...createAgent(this.config.endpoint, { rejectUnauthorized: !this.config.selfSigned }),\n };\n\n if (method === 'GET') {\n for (const [key, value] of Object.entries(Client.flatten(params))) {\n url.searchParams.append(key, value);\n }\n } else {\n switch (headers['content-type']) {\n case 'application/json':\n options.body = JSONbig.stringify(params);\n break;\n\n case 'multipart/form-data':\n const formData = new FormData();\n\n for (const [key, value] of Object.entries(params)) {\n if (value instanceof File) {\n formData.append(key, value, value.name);\n } else if (Array.isArray(value)) {\n for (const nestedValue of value) {\n formData.append(`${key}[]`, nestedValue);\n }\n } else {\n formData.append(key, value);\n }\n }\n\n options.body = formData;\n delete headers['content-type'];\n break;\n }\n }\n\n return { uri: url.toString(), options };\n }\n\n async chunkedUpload(method: string, url: URL, headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void) {\n const [fileParam, file] = Object.entries(originalPayload).find(([_, value]) => value instanceof File) ?? [];\n\n if (!file || !fileParam) {\n throw new Error('File not found in payload');\n }\n\n if (file.size <= Client.CHUNK_SIZE) {\n return await this.call(method, url, headers, originalPayload);\n }\n\n let start = 0;\n let response = null;\n\n while (start < file.size) {\n let end = start + Client.CHUNK_SIZE; // Prepare end for the next chunk\n if (end >= file.size) {\n end = file.size; // Adjust for the last chunk to include the last byte\n }\n\n headers['content-range'] = `bytes ${start}-${end-1}/${file.size}`;\n const chunk = file.slice(start, end);\n\n let payload = { ...originalPayload };\n payload[fileParam] = new File([chunk], file.name);\n\n response = await this.call(method, url, headers, payload);\n\n if (onProgress && typeof onProgress === 'function') {\n onProgress({\n $id: response.$id,\n progress: Math.round((end / file.size) * 100),\n sizeUploaded: end,\n chunksTotal: Math.ceil(file.size / Client.CHUNK_SIZE),\n chunksUploaded: Math.ceil(end / Client.CHUNK_SIZE)\n });\n }\n\n if (response && response.$id) {\n headers['x-appwrite-id'] = response.$id;\n }\n\n start = end;\n }\n\n return response;\n }\n\n async ping(): Promise<string> {\n return this.call('GET', new URL(this.config.endpoint + '/ping'));\n }\n\n async redirect(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise<string> {\n const { uri, options } = this.prepareRequest(method, url, headers, params);\n \n const response = await fetch(uri, {\n ...options,\n redirect: 'manual'\n });\n\n if (response.status !== 301 && response.status !== 302) {\n throw new AppwriteException('Invalid redirect', response.status);\n }\n\n return response.headers.get('location') || '';\n }\n\n async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise<any> {\n const { uri, options } = this.prepareRequest(method, url, headers, params);\n\n let data: any = null;\n\n const response = await fetch(uri, options);\n\n const warnings = response.headers.get('x-appwrite-warning');\n if (warnings) {\n warnings.split(';').forEach((warning: string) => console.warn('Warning: ' + warning));\n }\n\n if (response.headers.get('content-type')?.includes('application/json')) {\n data = JSONbig.parse(await response.text());\n } else if (responseType === 'arrayBuffer') {\n data = await response.arrayBuffer();\n } else {\n data = {\n message: await response.text()\n };\n }\n\n if (400 <= response.status) {\n let responseText = '';\n if (response.headers.get('content-type')?.includes('application/json') || responseType === 'arrayBuffer') {\n responseText = JSONbig.stringify(data);\n } else {\n responseText = data?.message;\n }\n throw new AppwriteException(data?.message, response.status, data?.type, responseText);\n }\n\n if (data && typeof data === 'object') {\n data.toString = () => JSONbig.stringify(data);\n }\n\n return data;\n }\n\n static flatten(data: Payload, prefix = ''): Payload {\n let output: Payload = {};\n\n for (const [key, value] of Object.entries(data)) {\n let finalKey = prefix ? prefix + '[' + key +']' : key;\n if (Array.isArray(value)) {\n output = { ...output, ...Client.flatten(value, finalKey) };\n } else {\n output[finalKey] = value;\n }\n }\n\n return output;\n }\n}\n\nexport { Client, AppwriteException };\nexport { Query } from './query';\nexport type { Models, Payload, UploadProgress };\nexport type { QueryTypes, QueryTypesList } from './query';\n"]}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var BackupServices = /* @__PURE__ */ ((BackupServices2) => {
|
|
4
4
|
BackupServices2["Databases"] = "databases";
|
|
5
|
+
BackupServices2["Tablesdb"] = "tablesdb";
|
|
6
|
+
BackupServices2["Documentsdb"] = "documentsdb";
|
|
7
|
+
BackupServices2["Vectorsdb"] = "vectorsdb";
|
|
5
8
|
BackupServices2["Functions"] = "functions";
|
|
6
9
|
BackupServices2["Storage"] = "storage";
|
|
7
10
|
return BackupServices2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/enums/backup-services.ts"],"names":["BackupServices"],"mappings":"AAAO,IAAK,iBAAL,kBAAKA,oBAAL;AACH,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,aAAU;
|
|
1
|
+
{"version":3,"sources":["../../src/enums/backup-services.ts"],"names":["BackupServices"],"mappings":"AAAO,IAAK,iBAAL,kBAAKA,oBAAL;AACH,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,cAAW;AACX,EAAAA,gBAAA,iBAAc;AACd,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,aAAU;AANF,SAAAA;AAAA,GAAA","sourcesContent":["export enum BackupServices {\n Databases = 'databases',\n Tablesdb = 'tablesdb',\n Documentsdb = 'documentsdb',\n Vectorsdb = 'vectorsdb',\n Functions = 'functions',\n Storage = 'storage',\n}"]}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// src/enums/backup-services.ts
|
|
2
2
|
var BackupServices = /* @__PURE__ */ ((BackupServices2) => {
|
|
3
3
|
BackupServices2["Databases"] = "databases";
|
|
4
|
+
BackupServices2["Tablesdb"] = "tablesdb";
|
|
5
|
+
BackupServices2["Documentsdb"] = "documentsdb";
|
|
6
|
+
BackupServices2["Vectorsdb"] = "vectorsdb";
|
|
4
7
|
BackupServices2["Functions"] = "functions";
|
|
5
8
|
BackupServices2["Storage"] = "storage";
|
|
6
9
|
return BackupServices2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/enums/backup-services.ts"],"names":["BackupServices"],"mappings":";AAAO,IAAK,iBAAL,kBAAKA,oBAAL;AACH,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,aAAU;
|
|
1
|
+
{"version":3,"sources":["../../src/enums/backup-services.ts"],"names":["BackupServices"],"mappings":";AAAO,IAAK,iBAAL,kBAAKA,oBAAL;AACH,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,cAAW;AACX,EAAAA,gBAAA,iBAAc;AACd,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,aAAU;AANF,SAAAA;AAAA,GAAA","sourcesContent":["export enum BackupServices {\n Databases = 'databases',\n Tablesdb = 'tablesdb',\n Documentsdb = 'documentsdb',\n Vectorsdb = 'vectorsdb',\n Functions = 'functions',\n Storage = 'storage',\n}"]}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
var DatabaseType = /* @__PURE__ */ ((DatabaseType2) => {
|
|
4
4
|
DatabaseType2["Legacy"] = "legacy";
|
|
5
5
|
DatabaseType2["Tablesdb"] = "tablesdb";
|
|
6
|
+
DatabaseType2["Documentsdb"] = "documentsdb";
|
|
7
|
+
DatabaseType2["Vectorsdb"] = "vectorsdb";
|
|
6
8
|
return DatabaseType2;
|
|
7
9
|
})(DatabaseType || {});
|
|
8
10
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/enums/database-type.ts"],"names":["DatabaseType"],"mappings":"AAAO,IAAK,eAAL,kBAAKA,kBAAL;AACH,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;
|
|
1
|
+
{"version":3,"sources":["../../src/enums/database-type.ts"],"names":["DatabaseType"],"mappings":"AAAO,IAAK,eAAL,kBAAKA,kBAAL;AACH,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,iBAAc;AACd,EAAAA,cAAA,eAAY;AAJJ,SAAAA;AAAA,GAAA","sourcesContent":["export enum DatabaseType {\n Legacy = 'legacy',\n Tablesdb = 'tablesdb',\n Documentsdb = 'documentsdb',\n Vectorsdb = 'vectorsdb',\n}"]}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
var DatabaseType = /* @__PURE__ */ ((DatabaseType2) => {
|
|
3
3
|
DatabaseType2["Legacy"] = "legacy";
|
|
4
4
|
DatabaseType2["Tablesdb"] = "tablesdb";
|
|
5
|
+
DatabaseType2["Documentsdb"] = "documentsdb";
|
|
6
|
+
DatabaseType2["Vectorsdb"] = "vectorsdb";
|
|
5
7
|
return DatabaseType2;
|
|
6
8
|
})(DatabaseType || {});
|
|
7
9
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/enums/database-type.ts"],"names":["DatabaseType"],"mappings":";AAAO,IAAK,eAAL,kBAAKA,kBAAL;AACH,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;
|
|
1
|
+
{"version":3,"sources":["../../src/enums/database-type.ts"],"names":["DatabaseType"],"mappings":";AAAO,IAAK,eAAL,kBAAKA,kBAAL;AACH,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,iBAAc;AACd,EAAAA,cAAA,eAAY;AAJJ,SAAAA;AAAA,GAAA","sourcesContent":["export enum DatabaseType {\n Legacy = 'legacy',\n Tablesdb = 'tablesdb',\n Documentsdb = 'documentsdb',\n Vectorsdb = 'vectorsdb',\n}"]}
|