@appwrite.io/console 1.4.4 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/dist/cjs/sdk.js +63 -105
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +63 -105
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +63 -105
- package/docs/examples/{migrations/delete-firebase-auth.md → account/get-coupon.md} +5 -3
- package/docs/examples/account/update-payment-method.md +1 -1
- package/docs/examples/console/create-program-membership.md +13 -0
- package/package.json +1 -1
- package/src/client.ts +30 -5
- package/src/enums/runtime.ts +1 -0
- package/src/models.ts +34 -28
- package/src/services/account.ts +29 -1
- package/src/services/console.ts +28 -0
- package/src/services/migrations.ts +1 -125
- package/src/services/organizations.ts +3 -3
- package/types/enums/runtime.d.ts +2 -1
- package/types/models.d.ts +34 -28
- package/types/services/account.d.ts +10 -1
- package/types/services/console.d.ts +9 -0
- package/types/services/migrations.d.ts +1 -37
- package/types/services/organizations.d.ts +3 -3
- package/docs/examples/migrations/create-firebase-o-auth-migration.md +0 -14
- package/docs/examples/migrations/get-firebase-report-o-auth.md +0 -14
- package/docs/examples/migrations/list-firebase-projects.md +0 -11
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c)
|
|
1
|
+
Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors.
|
|
2
2
|
All rights reserved.
|
|
3
3
|
|
|
4
4
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Appwrite Console 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)
|
|
@@ -33,7 +33,7 @@ import { Client, Account } from "@appwrite.io/console";
|
|
|
33
33
|
To install with a CDN (content delivery network) add the following scripts to the bottom of your <body> tag, but before you use any Appwrite services:
|
|
34
34
|
|
|
35
35
|
```html
|
|
36
|
-
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@1.4.
|
|
36
|
+
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@1.4.5"></script>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
|
package/dist/cjs/sdk.js
CHANGED
|
@@ -280,12 +280,13 @@ class Client {
|
|
|
280
280
|
'x-sdk-name': 'Console',
|
|
281
281
|
'x-sdk-platform': 'console',
|
|
282
282
|
'x-sdk-language': 'web',
|
|
283
|
-
'x-sdk-version': '1.4.
|
|
283
|
+
'x-sdk-version': '1.4.5',
|
|
284
284
|
'X-Appwrite-Response-Format': '1.6.0',
|
|
285
285
|
};
|
|
286
286
|
this.realtime = {
|
|
287
287
|
socket: undefined,
|
|
288
288
|
timeout: undefined,
|
|
289
|
+
heartbeat: undefined,
|
|
289
290
|
url: '',
|
|
290
291
|
channels: new Set(),
|
|
291
292
|
subscriptions: new Map(),
|
|
@@ -311,6 +312,17 @@ class Client {
|
|
|
311
312
|
return 60000;
|
|
312
313
|
}
|
|
313
314
|
},
|
|
315
|
+
createHeartbeat: () => {
|
|
316
|
+
if (this.realtime.heartbeat) {
|
|
317
|
+
clearTimeout(this.realtime.heartbeat);
|
|
318
|
+
}
|
|
319
|
+
this.realtime.heartbeat = window === null || window === void 0 ? void 0 : window.setInterval(() => {
|
|
320
|
+
var _a;
|
|
321
|
+
(_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify({
|
|
322
|
+
type: 'ping'
|
|
323
|
+
}));
|
|
324
|
+
}, 20000);
|
|
325
|
+
},
|
|
314
326
|
createSocket: () => {
|
|
315
327
|
var _a, _b, _c;
|
|
316
328
|
if (this.realtime.channels.size < 1) {
|
|
@@ -339,6 +351,7 @@ class Client {
|
|
|
339
351
|
this.realtime.socket.addEventListener('message', this.realtime.onMessage);
|
|
340
352
|
this.realtime.socket.addEventListener('open', _event => {
|
|
341
353
|
this.realtime.reconnectAttempts = 0;
|
|
354
|
+
this.realtime.createHeartbeat();
|
|
342
355
|
});
|
|
343
356
|
this.realtime.socket.addEventListener('close', event => {
|
|
344
357
|
var _a, _b, _c;
|
|
@@ -965,6 +978,28 @@ class Account {
|
|
|
965
978
|
return yield this.client.call('delete', uri, apiHeaders, payload);
|
|
966
979
|
});
|
|
967
980
|
}
|
|
981
|
+
/**
|
|
982
|
+
* Get coupon details
|
|
983
|
+
*
|
|
984
|
+
*
|
|
985
|
+
* @param {string} couponId
|
|
986
|
+
* @throws {AppwriteException}
|
|
987
|
+
* @returns {Promise<Models.Coupon>}
|
|
988
|
+
*/
|
|
989
|
+
getCoupon(couponId) {
|
|
990
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
991
|
+
if (typeof couponId === 'undefined') {
|
|
992
|
+
throw new AppwriteException('Missing required parameter: "couponId"');
|
|
993
|
+
}
|
|
994
|
+
const apiPath = '/account/coupons/{couponId}'.replace('{couponId}', couponId);
|
|
995
|
+
const payload = {};
|
|
996
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
997
|
+
const apiHeaders = {
|
|
998
|
+
'content-type': 'application/json',
|
|
999
|
+
};
|
|
1000
|
+
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
968
1003
|
/**
|
|
969
1004
|
* Update email
|
|
970
1005
|
*
|
|
@@ -2189,7 +2224,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
2189
2224
|
/**
|
|
2190
2225
|
* Create magic URL token
|
|
2191
2226
|
*
|
|
2192
|
-
* Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour.
|
|
2227
|
+
* Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour.
|
|
2193
2228
|
|
|
2194
2229
|
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
2195
2230
|
|
|
@@ -3156,6 +3191,28 @@ class Console {
|
|
|
3156
3191
|
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
3157
3192
|
});
|
|
3158
3193
|
}
|
|
3194
|
+
/**
|
|
3195
|
+
* Create program membership
|
|
3196
|
+
*
|
|
3197
|
+
*
|
|
3198
|
+
* @param {string} programId
|
|
3199
|
+
* @throws {AppwriteException}
|
|
3200
|
+
* @returns {Promise<{}>}
|
|
3201
|
+
*/
|
|
3202
|
+
createProgramMembership(programId) {
|
|
3203
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3204
|
+
if (typeof programId === 'undefined') {
|
|
3205
|
+
throw new AppwriteException('Missing required parameter: "programId"');
|
|
3206
|
+
}
|
|
3207
|
+
const apiPath = '/console/programs/{programId}/memberships'.replace('{programId}', programId);
|
|
3208
|
+
const payload = {};
|
|
3209
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3210
|
+
const apiHeaders = {
|
|
3211
|
+
'content-type': 'application/json',
|
|
3212
|
+
};
|
|
3213
|
+
return yield this.client.call('post', uri, apiHeaders, payload);
|
|
3214
|
+
});
|
|
3215
|
+
}
|
|
3159
3216
|
/**
|
|
3160
3217
|
* Get Regions
|
|
3161
3218
|
*
|
|
@@ -9095,7 +9152,7 @@ class Migrations {
|
|
|
9095
9152
|
});
|
|
9096
9153
|
}
|
|
9097
9154
|
/**
|
|
9098
|
-
* Migrate Firebase data
|
|
9155
|
+
* Migrate Firebase data
|
|
9099
9156
|
*
|
|
9100
9157
|
*
|
|
9101
9158
|
* @param {string[]} resources
|
|
@@ -9126,74 +9183,6 @@ class Migrations {
|
|
|
9126
9183
|
return yield this.client.call('post', uri, apiHeaders, payload);
|
|
9127
9184
|
});
|
|
9128
9185
|
}
|
|
9129
|
-
/**
|
|
9130
|
-
* Revoke Appwrite's authorization to access Firebase projects
|
|
9131
|
-
*
|
|
9132
|
-
*
|
|
9133
|
-
* @throws {AppwriteException}
|
|
9134
|
-
* @returns {Promise<{}>}
|
|
9135
|
-
*/
|
|
9136
|
-
deleteFirebaseAuth() {
|
|
9137
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
9138
|
-
const apiPath = '/migrations/firebase/deauthorize';
|
|
9139
|
-
const payload = {};
|
|
9140
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9141
|
-
const apiHeaders = {
|
|
9142
|
-
'content-type': 'application/json',
|
|
9143
|
-
};
|
|
9144
|
-
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
9145
|
-
});
|
|
9146
|
-
}
|
|
9147
|
-
/**
|
|
9148
|
-
* Migrate Firebase data (OAuth)
|
|
9149
|
-
*
|
|
9150
|
-
*
|
|
9151
|
-
* @param {string[]} resources
|
|
9152
|
-
* @param {string} projectId
|
|
9153
|
-
* @throws {AppwriteException}
|
|
9154
|
-
* @returns {Promise<Models.Migration>}
|
|
9155
|
-
*/
|
|
9156
|
-
createFirebaseOAuthMigration(resources, projectId) {
|
|
9157
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
9158
|
-
if (typeof resources === 'undefined') {
|
|
9159
|
-
throw new AppwriteException('Missing required parameter: "resources"');
|
|
9160
|
-
}
|
|
9161
|
-
if (typeof projectId === 'undefined') {
|
|
9162
|
-
throw new AppwriteException('Missing required parameter: "projectId"');
|
|
9163
|
-
}
|
|
9164
|
-
const apiPath = '/migrations/firebase/oauth';
|
|
9165
|
-
const payload = {};
|
|
9166
|
-
if (typeof resources !== 'undefined') {
|
|
9167
|
-
payload['resources'] = resources;
|
|
9168
|
-
}
|
|
9169
|
-
if (typeof projectId !== 'undefined') {
|
|
9170
|
-
payload['projectId'] = projectId;
|
|
9171
|
-
}
|
|
9172
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9173
|
-
const apiHeaders = {
|
|
9174
|
-
'content-type': 'application/json',
|
|
9175
|
-
};
|
|
9176
|
-
return yield this.client.call('post', uri, apiHeaders, payload);
|
|
9177
|
-
});
|
|
9178
|
-
}
|
|
9179
|
-
/**
|
|
9180
|
-
* List Firebase projects
|
|
9181
|
-
*
|
|
9182
|
-
*
|
|
9183
|
-
* @throws {AppwriteException}
|
|
9184
|
-
* @returns {Promise<Models.FirebaseProjectList>}
|
|
9185
|
-
*/
|
|
9186
|
-
listFirebaseProjects() {
|
|
9187
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
9188
|
-
const apiPath = '/migrations/firebase/projects';
|
|
9189
|
-
const payload = {};
|
|
9190
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9191
|
-
const apiHeaders = {
|
|
9192
|
-
'content-type': 'application/json',
|
|
9193
|
-
};
|
|
9194
|
-
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
9195
|
-
});
|
|
9196
|
-
}
|
|
9197
9186
|
/**
|
|
9198
9187
|
* Generate a report on Firebase data
|
|
9199
9188
|
*
|
|
@@ -9226,38 +9215,6 @@ class Migrations {
|
|
|
9226
9215
|
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
9227
9216
|
});
|
|
9228
9217
|
}
|
|
9229
|
-
/**
|
|
9230
|
-
* Generate a report on Firebase data using OAuth
|
|
9231
|
-
*
|
|
9232
|
-
*
|
|
9233
|
-
* @param {string[]} resources
|
|
9234
|
-
* @param {string} projectId
|
|
9235
|
-
* @throws {AppwriteException}
|
|
9236
|
-
* @returns {Promise<Models.MigrationReport>}
|
|
9237
|
-
*/
|
|
9238
|
-
getFirebaseReportOAuth(resources, projectId) {
|
|
9239
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
9240
|
-
if (typeof resources === 'undefined') {
|
|
9241
|
-
throw new AppwriteException('Missing required parameter: "resources"');
|
|
9242
|
-
}
|
|
9243
|
-
if (typeof projectId === 'undefined') {
|
|
9244
|
-
throw new AppwriteException('Missing required parameter: "projectId"');
|
|
9245
|
-
}
|
|
9246
|
-
const apiPath = '/migrations/firebase/report/oauth';
|
|
9247
|
-
const payload = {};
|
|
9248
|
-
if (typeof resources !== 'undefined') {
|
|
9249
|
-
payload['resources'] = resources;
|
|
9250
|
-
}
|
|
9251
|
-
if (typeof projectId !== 'undefined') {
|
|
9252
|
-
payload['projectId'] = projectId;
|
|
9253
|
-
}
|
|
9254
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9255
|
-
const apiHeaders = {
|
|
9256
|
-
'content-type': 'application/json',
|
|
9257
|
-
};
|
|
9258
|
-
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
9259
|
-
});
|
|
9260
|
-
}
|
|
9261
9218
|
/**
|
|
9262
9219
|
* Migrate NHost data
|
|
9263
9220
|
*
|
|
@@ -9731,7 +9688,7 @@ class Organizations {
|
|
|
9731
9688
|
* @param {string} organizationId
|
|
9732
9689
|
* @param {string} aggregationId
|
|
9733
9690
|
* @throws {AppwriteException}
|
|
9734
|
-
* @returns {Promise<Models.
|
|
9691
|
+
* @returns {Promise<Models.Invoice>}
|
|
9735
9692
|
*/
|
|
9736
9693
|
getAggregation(organizationId, aggregationId) {
|
|
9737
9694
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -10023,7 +9980,7 @@ class Organizations {
|
|
|
10023
9980
|
});
|
|
10024
9981
|
}
|
|
10025
9982
|
/**
|
|
10026
|
-
*
|
|
9983
|
+
* Download invoice in PDF
|
|
10027
9984
|
*
|
|
10028
9985
|
*
|
|
10029
9986
|
* @param {string} organizationId
|
|
@@ -15588,6 +15545,7 @@ exports.Runtime = void 0;
|
|
|
15588
15545
|
Runtime["Bun11"] = "bun-1.1";
|
|
15589
15546
|
Runtime["Go123"] = "go-1.23";
|
|
15590
15547
|
Runtime["Static1"] = "static-1";
|
|
15548
|
+
Runtime["Flutter324"] = "flutter-3.24";
|
|
15591
15549
|
})(exports.Runtime || (exports.Runtime = {}));
|
|
15592
15550
|
|
|
15593
15551
|
exports.FunctionUsageRange = void 0;
|