@appwrite.io/console 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.yml +2 -2
- package/README.md +2 -2
- package/dist/cjs/sdk.js +62 -28
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +61 -27
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +64 -27
- package/docs/examples/messaging/create-msg91provider.md +1 -1
- package/docs/examples/messaging/update-email.md +2 -1
- package/docs/examples/messaging/update-msg91provider.md +2 -2
- package/package.json +1 -5
- package/rollup.config.js +1 -5
- package/src/client.ts +10 -5
- package/src/enums/flag.ts +2 -1
- package/src/enums/runtime.ts +4 -0
- package/src/id.ts +23 -4
- package/src/models.ts +11 -3
- package/src/services/account.ts +4 -4
- package/src/services/messaging.ts +16 -11
- package/types/client.d.ts +0 -1
- package/types/enums/flag.d.ts +2 -1
- package/types/enums/runtime.d.ts +4 -0
- package/types/id.d.ts +2 -1
- package/types/models.d.ts +11 -3
- package/types/services/account.d.ts +4 -4
- package/types/services/messaging.d.ts +6 -5
package/dist/iife/sdk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function (exports
|
|
1
|
+
(function (exports) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
/******************************************************************************
|
|
@@ -24,6 +24,12 @@
|
|
|
24
24
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
25
25
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
26
26
|
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
30
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
31
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
32
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
class Service {
|
|
@@ -115,7 +121,7 @@
|
|
|
115
121
|
'x-sdk-name': 'Console',
|
|
116
122
|
'x-sdk-platform': 'console',
|
|
117
123
|
'x-sdk-language': 'web',
|
|
118
|
-
'x-sdk-version': '0.6.
|
|
124
|
+
'x-sdk-version': '0.6.2',
|
|
119
125
|
'X-Appwrite-Response-Format': '1.5.0',
|
|
120
126
|
};
|
|
121
127
|
this.realtime = {
|
|
@@ -147,9 +153,12 @@
|
|
|
147
153
|
}
|
|
148
154
|
},
|
|
149
155
|
createSocket: () => {
|
|
150
|
-
var _a, _b;
|
|
151
|
-
if (this.realtime.channels.size < 1)
|
|
156
|
+
var _a, _b, _c;
|
|
157
|
+
if (this.realtime.channels.size < 1) {
|
|
158
|
+
this.realtime.reconnect = false;
|
|
159
|
+
(_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.close();
|
|
152
160
|
return;
|
|
161
|
+
}
|
|
153
162
|
const channels = new URLSearchParams();
|
|
154
163
|
channels.set('project', this.config.project);
|
|
155
164
|
this.realtime.channels.forEach(channel => {
|
|
@@ -158,10 +167,10 @@
|
|
|
158
167
|
const url = this.config.endpointRealtime + '/realtime?' + channels.toString();
|
|
159
168
|
if (url !== this.realtime.url || // Check if URL is present
|
|
160
169
|
!this.realtime.socket || // Check if WebSocket has not been created
|
|
161
|
-
((
|
|
170
|
+
((_b = this.realtime.socket) === null || _b === void 0 ? void 0 : _b.readyState) > WebSocket.OPEN // Check if WebSocket is CLOSING (3) or CLOSED (4)
|
|
162
171
|
) {
|
|
163
172
|
if (this.realtime.socket &&
|
|
164
|
-
((
|
|
173
|
+
((_c = this.realtime.socket) === null || _c === void 0 ? void 0 : _c.readyState) < WebSocket.CLOSING // Close WebSocket if it is CONNECTING (0) or OPEN (1)
|
|
165
174
|
) {
|
|
166
175
|
this.realtime.reconnect = false;
|
|
167
176
|
this.realtime.socket.close();
|
|
@@ -378,7 +387,7 @@
|
|
|
378
387
|
};
|
|
379
388
|
}
|
|
380
389
|
call(method, url, headers = {}, params = {}) {
|
|
381
|
-
var _a
|
|
390
|
+
var _a;
|
|
382
391
|
return __awaiter(this, void 0, void 0, function* () {
|
|
383
392
|
method = method.toUpperCase();
|
|
384
393
|
headers = Object.assign({}, this.headers, headers);
|
|
@@ -388,7 +397,10 @@
|
|
|
388
397
|
credentials: 'include'
|
|
389
398
|
};
|
|
390
399
|
if (typeof window !== 'undefined' && window.localStorage) {
|
|
391
|
-
|
|
400
|
+
const cookieFallback = window.localStorage.getItem('cookieFallback');
|
|
401
|
+
if (cookieFallback) {
|
|
402
|
+
headers['X-Fallback-Cookies'] = cookieFallback;
|
|
403
|
+
}
|
|
392
404
|
}
|
|
393
405
|
if (method === 'GET') {
|
|
394
406
|
for (const [key, value] of Object.entries(Service.flatten(params))) {
|
|
@@ -419,8 +431,8 @@
|
|
|
419
431
|
}
|
|
420
432
|
try {
|
|
421
433
|
let data = null;
|
|
422
|
-
const response = yield
|
|
423
|
-
if ((
|
|
434
|
+
const response = yield fetch(url.toString(), options);
|
|
435
|
+
if ((_a = response.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('application/json')) {
|
|
424
436
|
data = yield response.json();
|
|
425
437
|
}
|
|
426
438
|
else {
|
|
@@ -695,7 +707,7 @@
|
|
|
695
707
|
*
|
|
696
708
|
* Add an authenticator app to be used as an MFA factor. Verify the
|
|
697
709
|
* authenticator using the [verify
|
|
698
|
-
* authenticator](/docs/references/cloud/client-web/account#
|
|
710
|
+
* authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator)
|
|
699
711
|
* method.
|
|
700
712
|
*
|
|
701
713
|
* @param {AuthenticatorType} type
|
|
@@ -719,8 +731,8 @@
|
|
|
719
731
|
* Verify Authenticator
|
|
720
732
|
*
|
|
721
733
|
* Verify an authenticator app after adding it using the [add
|
|
722
|
-
* authenticator](/docs/references/cloud/client-web/account#
|
|
723
|
-
* method.
|
|
734
|
+
* authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
|
|
735
|
+
* method. add
|
|
724
736
|
*
|
|
725
737
|
* @param {AuthenticatorType} type
|
|
726
738
|
* @param {string} otp
|
|
@@ -5867,10 +5879,11 @@
|
|
|
5867
5879
|
* @param {string[]} cc
|
|
5868
5880
|
* @param {string[]} bcc
|
|
5869
5881
|
* @param {string} scheduledAt
|
|
5882
|
+
* @param {string[]} attachments
|
|
5870
5883
|
* @throws {AppwriteException}
|
|
5871
5884
|
* @returns {Promise}
|
|
5872
5885
|
*/
|
|
5873
|
-
updateEmail(messageId, topics, users, targets, subject, content, draft, html, cc, bcc, scheduledAt) {
|
|
5886
|
+
updateEmail(messageId, topics, users, targets, subject, content, draft, html, cc, bcc, scheduledAt, attachments) {
|
|
5874
5887
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5875
5888
|
if (typeof messageId === 'undefined') {
|
|
5876
5889
|
throw new AppwriteException('Missing required parameter: "messageId"');
|
|
@@ -5907,6 +5920,9 @@
|
|
|
5907
5920
|
if (typeof scheduledAt !== 'undefined') {
|
|
5908
5921
|
payload['scheduledAt'] = scheduledAt;
|
|
5909
5922
|
}
|
|
5923
|
+
if (typeof attachments !== 'undefined') {
|
|
5924
|
+
payload['attachments'] = attachments;
|
|
5925
|
+
}
|
|
5910
5926
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
5911
5927
|
return yield this.client.call('patch', uri, {
|
|
5912
5928
|
'content-type': 'application/json',
|
|
@@ -6619,14 +6635,14 @@
|
|
|
6619
6635
|
*
|
|
6620
6636
|
* @param {string} providerId
|
|
6621
6637
|
* @param {string} name
|
|
6622
|
-
* @param {string}
|
|
6638
|
+
* @param {string} templateId
|
|
6623
6639
|
* @param {string} senderId
|
|
6624
6640
|
* @param {string} authKey
|
|
6625
6641
|
* @param {boolean} enabled
|
|
6626
6642
|
* @throws {AppwriteException}
|
|
6627
6643
|
* @returns {Promise}
|
|
6628
6644
|
*/
|
|
6629
|
-
createMsg91Provider(providerId, name,
|
|
6645
|
+
createMsg91Provider(providerId, name, templateId, senderId, authKey, enabled) {
|
|
6630
6646
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6631
6647
|
if (typeof providerId === 'undefined') {
|
|
6632
6648
|
throw new AppwriteException('Missing required parameter: "providerId"');
|
|
@@ -6642,8 +6658,8 @@
|
|
|
6642
6658
|
if (typeof name !== 'undefined') {
|
|
6643
6659
|
payload['name'] = name;
|
|
6644
6660
|
}
|
|
6645
|
-
if (typeof
|
|
6646
|
-
payload['
|
|
6661
|
+
if (typeof templateId !== 'undefined') {
|
|
6662
|
+
payload['templateId'] = templateId;
|
|
6647
6663
|
}
|
|
6648
6664
|
if (typeof senderId !== 'undefined') {
|
|
6649
6665
|
payload['senderId'] = senderId;
|
|
@@ -6668,13 +6684,13 @@
|
|
|
6668
6684
|
* @param {string} providerId
|
|
6669
6685
|
* @param {string} name
|
|
6670
6686
|
* @param {boolean} enabled
|
|
6687
|
+
* @param {string} templateId
|
|
6671
6688
|
* @param {string} senderId
|
|
6672
6689
|
* @param {string} authKey
|
|
6673
|
-
* @param {string} from
|
|
6674
6690
|
* @throws {AppwriteException}
|
|
6675
6691
|
* @returns {Promise}
|
|
6676
6692
|
*/
|
|
6677
|
-
updateMsg91Provider(providerId, name, enabled, senderId, authKey
|
|
6693
|
+
updateMsg91Provider(providerId, name, enabled, templateId, senderId, authKey) {
|
|
6678
6694
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6679
6695
|
if (typeof providerId === 'undefined') {
|
|
6680
6696
|
throw new AppwriteException('Missing required parameter: "providerId"');
|
|
@@ -6687,15 +6703,15 @@
|
|
|
6687
6703
|
if (typeof enabled !== 'undefined') {
|
|
6688
6704
|
payload['enabled'] = enabled;
|
|
6689
6705
|
}
|
|
6706
|
+
if (typeof templateId !== 'undefined') {
|
|
6707
|
+
payload['templateId'] = templateId;
|
|
6708
|
+
}
|
|
6690
6709
|
if (typeof senderId !== 'undefined') {
|
|
6691
6710
|
payload['senderId'] = senderId;
|
|
6692
6711
|
}
|
|
6693
6712
|
if (typeof authKey !== 'undefined') {
|
|
6694
6713
|
payload['authKey'] = authKey;
|
|
6695
6714
|
}
|
|
6696
|
-
if (typeof from !== 'undefined') {
|
|
6697
|
-
payload['from'] = from;
|
|
6698
|
-
}
|
|
6699
6715
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
6700
6716
|
return yield this.client.call('patch', uri, {
|
|
6701
6717
|
'content-type': 'application/json',
|
|
@@ -12881,14 +12897,30 @@
|
|
|
12881
12897
|
}
|
|
12882
12898
|
}
|
|
12883
12899
|
|
|
12900
|
+
var _a, _ID_hexTimestamp;
|
|
12884
12901
|
class ID {
|
|
12885
12902
|
static custom(id) {
|
|
12886
12903
|
return id;
|
|
12887
12904
|
}
|
|
12888
|
-
static unique() {
|
|
12889
|
-
|
|
12905
|
+
static unique(padding = 7) {
|
|
12906
|
+
// Generate a unique ID with padding to have a longer ID
|
|
12907
|
+
const baseId = __classPrivateFieldGet(ID, _a, "m", _ID_hexTimestamp).call(ID);
|
|
12908
|
+
let randomPadding = '';
|
|
12909
|
+
for (let i = 0; i < padding; i++) {
|
|
12910
|
+
const randomHexDigit = Math.floor(Math.random() * 16).toString(16);
|
|
12911
|
+
randomPadding += randomHexDigit;
|
|
12912
|
+
}
|
|
12913
|
+
return baseId + randomPadding;
|
|
12890
12914
|
}
|
|
12891
12915
|
}
|
|
12916
|
+
_a = ID, _ID_hexTimestamp = function _ID_hexTimestamp() {
|
|
12917
|
+
const now = new Date();
|
|
12918
|
+
const sec = Math.floor(now.getTime() / 1000);
|
|
12919
|
+
const msec = now.getMilliseconds();
|
|
12920
|
+
// Convert to hexadecimal
|
|
12921
|
+
const hexTimestamp = sec.toString(16) + msec.toString(16).padStart(5, '0');
|
|
12922
|
+
return hexTimestamp;
|
|
12923
|
+
};
|
|
12892
12924
|
|
|
12893
12925
|
exports.AuthenticatorType = void 0;
|
|
12894
12926
|
(function (AuthenticatorType) {
|
|
@@ -13019,7 +13051,7 @@
|
|
|
13019
13051
|
Flag["Switzerland"] = "ch";
|
|
13020
13052
|
Flag["Chile"] = "cl";
|
|
13021
13053
|
Flag["China"] = "cn";
|
|
13022
|
-
Flag["
|
|
13054
|
+
Flag["CoteDIvoire"] = "ci";
|
|
13023
13055
|
Flag["Cameroon"] = "cm";
|
|
13024
13056
|
Flag["DemocraticRepublicOfTheCongo"] = "cd";
|
|
13025
13057
|
Flag["RepublicOfTheCongo"] = "cg";
|
|
@@ -13127,6 +13159,7 @@
|
|
|
13127
13159
|
Flag["Palau"] = "pw";
|
|
13128
13160
|
Flag["PapuaNewGuinea"] = "pg";
|
|
13129
13161
|
Flag["Poland"] = "pl";
|
|
13162
|
+
Flag["FrenchPolynesia"] = "pf";
|
|
13130
13163
|
Flag["NorthKorea"] = "kp";
|
|
13131
13164
|
Flag["Portugal"] = "pt";
|
|
13132
13165
|
Flag["Paraguay"] = "py";
|
|
@@ -13232,6 +13265,10 @@
|
|
|
13232
13265
|
Runtime["Python310"] = "python-3.10";
|
|
13233
13266
|
Runtime["Python311"] = "python-3.11";
|
|
13234
13267
|
Runtime["Python312"] = "python-3.12";
|
|
13268
|
+
Runtime["Pythonml311"] = "python-ml-3.11";
|
|
13269
|
+
Runtime["Deno121"] = "deno-1.21";
|
|
13270
|
+
Runtime["Deno124"] = "deno-1.24";
|
|
13271
|
+
Runtime["Deno135"] = "deno-1.35";
|
|
13235
13272
|
Runtime["Deno140"] = "deno-1.40";
|
|
13236
13273
|
Runtime["Dart215"] = "dart-2.15";
|
|
13237
13274
|
Runtime["Dart216"] = "dart-2.16";
|
|
@@ -13752,4 +13789,4 @@
|
|
|
13752
13789
|
|
|
13753
13790
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
13754
13791
|
|
|
13755
|
-
})(this.Appwrite = this.Appwrite || {}
|
|
13792
|
+
})(this.Appwrite = this.Appwrite || {});
|
|
@@ -9,7 +9,7 @@ const messaging = new Messaging(client);
|
|
|
9
9
|
const result = await messaging.createMsg91Provider(
|
|
10
10
|
'<PROVIDER_ID>', // providerId
|
|
11
11
|
'<NAME>', // name
|
|
12
|
-
'
|
|
12
|
+
'<TEMPLATE_ID>', // templateId (optional)
|
|
13
13
|
'<SENDER_ID>', // senderId (optional)
|
|
14
14
|
'<AUTH_KEY>', // authKey (optional)
|
|
15
15
|
false // enabled (optional)
|
|
@@ -10,9 +10,9 @@ const result = await messaging.updateMsg91Provider(
|
|
|
10
10
|
'<PROVIDER_ID>', // providerId
|
|
11
11
|
'<NAME>', // name (optional)
|
|
12
12
|
false, // enabled (optional)
|
|
13
|
+
'<TEMPLATE_ID>', // templateId (optional)
|
|
13
14
|
'<SENDER_ID>', // senderId (optional)
|
|
14
|
-
'<AUTH_KEY>'
|
|
15
|
-
'<FROM>' // from (optional)
|
|
15
|
+
'<AUTH_KEY>' // authKey (optional)
|
|
16
16
|
);
|
|
17
17
|
|
|
18
18
|
console.log(response);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@appwrite.io/console",
|
|
3
3
|
"homepage": "https://appwrite.io/support",
|
|
4
4
|
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
|
|
5
|
-
"version": "0.6.
|
|
5
|
+
"version": "0.6.2",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "dist/cjs/sdk.js",
|
|
8
8
|
"exports": {
|
|
@@ -32,10 +32,6 @@
|
|
|
32
32
|
"tslib": "2.4.0",
|
|
33
33
|
"typescript": "4.7.2"
|
|
34
34
|
},
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"cross-fetch": "3.1.5",
|
|
37
|
-
"isomorphic-form-data": "2.0.0"
|
|
38
|
-
},
|
|
39
35
|
"jsdelivr": "dist/iife/sdk.js",
|
|
40
36
|
"unpkg": "dist/iife/sdk.js"
|
|
41
37
|
}
|
package/rollup.config.js
CHANGED
|
@@ -2,7 +2,7 @@ import pkg from "./package.json";
|
|
|
2
2
|
import typescript from "@rollup/plugin-typescript";
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
external: Object.keys(pkg.dependencies),
|
|
5
|
+
external: Object.keys(pkg.dependencies ?? {}),
|
|
6
6
|
input: "src/index.ts",
|
|
7
7
|
plugins: [typescript()],
|
|
8
8
|
output: [
|
|
@@ -22,10 +22,6 @@ export default {
|
|
|
22
22
|
file: pkg.jsdelivr,
|
|
23
23
|
name: "Appwrite",
|
|
24
24
|
extend: true,
|
|
25
|
-
globals: {
|
|
26
|
-
"cross-fetch": "window",
|
|
27
|
-
"FormData": "FormData",
|
|
28
|
-
},
|
|
29
25
|
},
|
|
30
26
|
],
|
|
31
27
|
};
|
package/src/client.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import 'isomorphic-form-data';
|
|
2
|
-
import { fetch } from 'cross-fetch';
|
|
3
1
|
import { Models } from './models';
|
|
4
2
|
import { Service } from './service';
|
|
5
3
|
|
|
@@ -104,7 +102,7 @@ class Client {
|
|
|
104
102
|
'x-sdk-name': 'Console',
|
|
105
103
|
'x-sdk-platform': 'console',
|
|
106
104
|
'x-sdk-language': 'web',
|
|
107
|
-
'x-sdk-version': '0.6.
|
|
105
|
+
'x-sdk-version': '0.6.2',
|
|
108
106
|
'X-Appwrite-Response-Format': '1.5.0',
|
|
109
107
|
};
|
|
110
108
|
|
|
@@ -238,7 +236,11 @@ class Client {
|
|
|
238
236
|
}
|
|
239
237
|
},
|
|
240
238
|
createSocket: () => {
|
|
241
|
-
if (this.realtime.channels.size < 1)
|
|
239
|
+
if (this.realtime.channels.size < 1) {
|
|
240
|
+
this.realtime.reconnect = false;
|
|
241
|
+
this.realtime.socket?.close();
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
242
244
|
|
|
243
245
|
const channels = new URLSearchParams();
|
|
244
246
|
channels.set('project', this.config.project);
|
|
@@ -401,7 +403,10 @@ class Client {
|
|
|
401
403
|
};
|
|
402
404
|
|
|
403
405
|
if (typeof window !== 'undefined' && window.localStorage) {
|
|
404
|
-
|
|
406
|
+
const cookieFallback = window.localStorage.getItem('cookieFallback');
|
|
407
|
+
if (cookieFallback) {
|
|
408
|
+
headers['X-Fallback-Cookies'] = cookieFallback;
|
|
409
|
+
}
|
|
405
410
|
}
|
|
406
411
|
|
|
407
412
|
if (method === 'GET') {
|
package/src/enums/flag.ts
CHANGED
|
@@ -32,7 +32,7 @@ export enum Flag {
|
|
|
32
32
|
Switzerland = 'ch',
|
|
33
33
|
Chile = 'cl',
|
|
34
34
|
China = 'cn',
|
|
35
|
-
|
|
35
|
+
CoteDIvoire = 'ci',
|
|
36
36
|
Cameroon = 'cm',
|
|
37
37
|
DemocraticRepublicOfTheCongo = 'cd',
|
|
38
38
|
RepublicOfTheCongo = 'cg',
|
|
@@ -140,6 +140,7 @@ export enum Flag {
|
|
|
140
140
|
Palau = 'pw',
|
|
141
141
|
PapuaNewGuinea = 'pg',
|
|
142
142
|
Poland = 'pl',
|
|
143
|
+
FrenchPolynesia = 'pf',
|
|
143
144
|
NorthKorea = 'kp',
|
|
144
145
|
Portugal = 'pt',
|
|
145
146
|
Paraguay = 'py',
|
package/src/enums/runtime.ts
CHANGED
|
@@ -18,6 +18,10 @@ export enum Runtime {
|
|
|
18
18
|
Python310 = 'python-3.10',
|
|
19
19
|
Python311 = 'python-3.11',
|
|
20
20
|
Python312 = 'python-3.12',
|
|
21
|
+
Pythonml311 = 'python-ml-3.11',
|
|
22
|
+
Deno121 = 'deno-1.21',
|
|
23
|
+
Deno124 = 'deno-1.24',
|
|
24
|
+
Deno135 = 'deno-1.35',
|
|
21
25
|
Deno140 = 'deno-1.40',
|
|
22
26
|
Dart215 = 'dart-2.15',
|
|
23
27
|
Dart216 = 'dart-2.16',
|
package/src/id.ts
CHANGED
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
export class ID {
|
|
2
|
+
// Generate an hex ID based on timestamp
|
|
3
|
+
// Recreated from https://www.php.net/manual/en/function.uniqid.php
|
|
4
|
+
static #hexTimestamp(): string {
|
|
5
|
+
const now = new Date();
|
|
6
|
+
const sec = Math.floor(now.getTime() / 1000);
|
|
7
|
+
const msec = now.getMilliseconds();
|
|
8
|
+
|
|
9
|
+
// Convert to hexadecimal
|
|
10
|
+
const hexTimestamp = sec.toString(16) + msec.toString(16).padStart(5, '0');
|
|
11
|
+
return hexTimestamp;
|
|
12
|
+
}
|
|
13
|
+
|
|
2
14
|
public static custom(id: string): string {
|
|
3
15
|
return id
|
|
4
16
|
}
|
|
5
|
-
|
|
6
|
-
public static unique(): string {
|
|
7
|
-
|
|
17
|
+
|
|
18
|
+
public static unique(padding: number = 7): string {
|
|
19
|
+
// Generate a unique ID with padding to have a longer ID
|
|
20
|
+
const baseId = ID.#hexTimestamp();
|
|
21
|
+
let randomPadding = '';
|
|
22
|
+
for (let i = 0; i < padding; i++) {
|
|
23
|
+
const randomHexDigit = Math.floor(Math.random() * 16).toString(16);
|
|
24
|
+
randomPadding += randomHexDigit;
|
|
25
|
+
}
|
|
26
|
+
return baseId + randomPadding;
|
|
8
27
|
}
|
|
9
|
-
}
|
|
28
|
+
}
|
package/src/models.ts
CHANGED
|
@@ -1320,6 +1320,10 @@ export namespace Models {
|
|
|
1320
1320
|
* Session creation date in ISO 8601 format.
|
|
1321
1321
|
*/
|
|
1322
1322
|
$createdAt: string;
|
|
1323
|
+
/**
|
|
1324
|
+
* Session update date in ISO 8601 format.
|
|
1325
|
+
*/
|
|
1326
|
+
$updatedAt: string;
|
|
1323
1327
|
/**
|
|
1324
1328
|
* User ID.
|
|
1325
1329
|
*/
|
|
@@ -3266,17 +3270,21 @@ export namespace Models {
|
|
|
3266
3270
|
*/
|
|
3267
3271
|
export type MfaFactors = {
|
|
3268
3272
|
/**
|
|
3269
|
-
* TOTP
|
|
3273
|
+
* Can TOTP be used for MFA challenge for this account.
|
|
3270
3274
|
*/
|
|
3271
3275
|
totp: boolean;
|
|
3272
3276
|
/**
|
|
3273
|
-
*
|
|
3277
|
+
* Can phone (SMS) be used for MFA challenge for this account.
|
|
3274
3278
|
*/
|
|
3275
3279
|
phone: boolean;
|
|
3276
3280
|
/**
|
|
3277
|
-
*
|
|
3281
|
+
* Can email be used for MFA challenge for this account.
|
|
3278
3282
|
*/
|
|
3279
3283
|
email: boolean;
|
|
3284
|
+
/**
|
|
3285
|
+
* Can recovery code be used for MFA challenge for this account.
|
|
3286
|
+
*/
|
|
3287
|
+
recoveryCode: boolean;
|
|
3280
3288
|
}
|
|
3281
3289
|
/**
|
|
3282
3290
|
* Provider
|
package/src/services/account.ts
CHANGED
|
@@ -272,7 +272,7 @@ export class Account extends Service {
|
|
|
272
272
|
*
|
|
273
273
|
* Add an authenticator app to be used as an MFA factor. Verify the
|
|
274
274
|
* authenticator using the [verify
|
|
275
|
-
* authenticator](/docs/references/cloud/client-web/account#
|
|
275
|
+
* authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator)
|
|
276
276
|
* method.
|
|
277
277
|
*
|
|
278
278
|
* @param {AuthenticatorType} type
|
|
@@ -297,8 +297,8 @@ export class Account extends Service {
|
|
|
297
297
|
* Verify Authenticator
|
|
298
298
|
*
|
|
299
299
|
* Verify an authenticator app after adding it using the [add
|
|
300
|
-
* authenticator](/docs/references/cloud/client-web/account#
|
|
301
|
-
* method.
|
|
300
|
+
* authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
|
|
301
|
+
* method. add
|
|
302
302
|
*
|
|
303
303
|
* @param {AuthenticatorType} type
|
|
304
304
|
* @param {string} otp
|
|
@@ -337,7 +337,7 @@ export class Account extends Service {
|
|
|
337
337
|
* @throws {AppwriteException}
|
|
338
338
|
* @returns {Promise}
|
|
339
339
|
*/
|
|
340
|
-
async deleteMfaAuthenticator
|
|
340
|
+
async deleteMfaAuthenticator(type: AuthenticatorType, otp: string): Promise<{}> {
|
|
341
341
|
if (typeof type === 'undefined') {
|
|
342
342
|
throw new AppwriteException('Missing required parameter: "type"');
|
|
343
343
|
}
|
|
@@ -146,10 +146,11 @@ export class Messaging extends Service {
|
|
|
146
146
|
* @param {string[]} cc
|
|
147
147
|
* @param {string[]} bcc
|
|
148
148
|
* @param {string} scheduledAt
|
|
149
|
+
* @param {string[]} attachments
|
|
149
150
|
* @throws {AppwriteException}
|
|
150
151
|
* @returns {Promise}
|
|
151
152
|
*/
|
|
152
|
-
async updateEmail(messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string): Promise<Models.Message> {
|
|
153
|
+
async updateEmail(messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[]): Promise<Models.Message> {
|
|
153
154
|
if (typeof messageId === 'undefined') {
|
|
154
155
|
throw new AppwriteException('Missing required parameter: "messageId"');
|
|
155
156
|
}
|
|
@@ -197,6 +198,10 @@ export class Messaging extends Service {
|
|
|
197
198
|
payload['scheduledAt'] = scheduledAt;
|
|
198
199
|
}
|
|
199
200
|
|
|
201
|
+
if (typeof attachments !== 'undefined') {
|
|
202
|
+
payload['attachments'] = attachments;
|
|
203
|
+
}
|
|
204
|
+
|
|
200
205
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
201
206
|
return await this.client.call('patch', uri, {
|
|
202
207
|
'content-type': 'application/json',
|
|
@@ -1018,14 +1023,14 @@ export class Messaging extends Service {
|
|
|
1018
1023
|
*
|
|
1019
1024
|
* @param {string} providerId
|
|
1020
1025
|
* @param {string} name
|
|
1021
|
-
* @param {string}
|
|
1026
|
+
* @param {string} templateId
|
|
1022
1027
|
* @param {string} senderId
|
|
1023
1028
|
* @param {string} authKey
|
|
1024
1029
|
* @param {boolean} enabled
|
|
1025
1030
|
* @throws {AppwriteException}
|
|
1026
1031
|
* @returns {Promise}
|
|
1027
1032
|
*/
|
|
1028
|
-
async createMsg91Provider(providerId: string, name: string,
|
|
1033
|
+
async createMsg91Provider(providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean): Promise<Models.Provider> {
|
|
1029
1034
|
if (typeof providerId === 'undefined') {
|
|
1030
1035
|
throw new AppwriteException('Missing required parameter: "providerId"');
|
|
1031
1036
|
}
|
|
@@ -1045,8 +1050,8 @@ export class Messaging extends Service {
|
|
|
1045
1050
|
payload['name'] = name;
|
|
1046
1051
|
}
|
|
1047
1052
|
|
|
1048
|
-
if (typeof
|
|
1049
|
-
payload['
|
|
1053
|
+
if (typeof templateId !== 'undefined') {
|
|
1054
|
+
payload['templateId'] = templateId;
|
|
1050
1055
|
}
|
|
1051
1056
|
|
|
1052
1057
|
if (typeof senderId !== 'undefined') {
|
|
@@ -1075,13 +1080,13 @@ export class Messaging extends Service {
|
|
|
1075
1080
|
* @param {string} providerId
|
|
1076
1081
|
* @param {string} name
|
|
1077
1082
|
* @param {boolean} enabled
|
|
1083
|
+
* @param {string} templateId
|
|
1078
1084
|
* @param {string} senderId
|
|
1079
1085
|
* @param {string} authKey
|
|
1080
|
-
* @param {string} from
|
|
1081
1086
|
* @throws {AppwriteException}
|
|
1082
1087
|
* @returns {Promise}
|
|
1083
1088
|
*/
|
|
1084
|
-
async updateMsg91Provider(providerId: string, name?: string, enabled?: boolean,
|
|
1089
|
+
async updateMsg91Provider(providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string): Promise<Models.Provider> {
|
|
1085
1090
|
if (typeof providerId === 'undefined') {
|
|
1086
1091
|
throw new AppwriteException('Missing required parameter: "providerId"');
|
|
1087
1092
|
}
|
|
@@ -1097,6 +1102,10 @@ export class Messaging extends Service {
|
|
|
1097
1102
|
payload['enabled'] = enabled;
|
|
1098
1103
|
}
|
|
1099
1104
|
|
|
1105
|
+
if (typeof templateId !== 'undefined') {
|
|
1106
|
+
payload['templateId'] = templateId;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1100
1109
|
if (typeof senderId !== 'undefined') {
|
|
1101
1110
|
payload['senderId'] = senderId;
|
|
1102
1111
|
}
|
|
@@ -1105,10 +1114,6 @@ export class Messaging extends Service {
|
|
|
1105
1114
|
payload['authKey'] = authKey;
|
|
1106
1115
|
}
|
|
1107
1116
|
|
|
1108
|
-
if (typeof from !== 'undefined') {
|
|
1109
|
-
payload['from'] = from;
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
1117
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
1113
1118
|
return await this.client.call('patch', uri, {
|
|
1114
1119
|
'content-type': 'application/json',
|
package/types/client.d.ts
CHANGED
package/types/enums/flag.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare enum Flag {
|
|
|
32
32
|
Switzerland = "ch",
|
|
33
33
|
Chile = "cl",
|
|
34
34
|
China = "cn",
|
|
35
|
-
|
|
35
|
+
CoteDIvoire = "ci",
|
|
36
36
|
Cameroon = "cm",
|
|
37
37
|
DemocraticRepublicOfTheCongo = "cd",
|
|
38
38
|
RepublicOfTheCongo = "cg",
|
|
@@ -140,6 +140,7 @@ export declare enum Flag {
|
|
|
140
140
|
Palau = "pw",
|
|
141
141
|
PapuaNewGuinea = "pg",
|
|
142
142
|
Poland = "pl",
|
|
143
|
+
FrenchPolynesia = "pf",
|
|
143
144
|
NorthKorea = "kp",
|
|
144
145
|
Portugal = "pt",
|
|
145
146
|
Paraguay = "py",
|
package/types/enums/runtime.d.ts
CHANGED
|
@@ -18,6 +18,10 @@ export declare enum Runtime {
|
|
|
18
18
|
Python310 = "python-3.10",
|
|
19
19
|
Python311 = "python-3.11",
|
|
20
20
|
Python312 = "python-3.12",
|
|
21
|
+
Pythonml311 = "python-ml-3.11",
|
|
22
|
+
Deno121 = "deno-1.21",
|
|
23
|
+
Deno124 = "deno-1.24",
|
|
24
|
+
Deno135 = "deno-1.35",
|
|
21
25
|
Deno140 = "deno-1.40",
|
|
22
26
|
Dart215 = "dart-2.15",
|
|
23
27
|
Dart216 = "dart-2.16",
|
package/types/id.d.ts
CHANGED