@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/dist/esm/sdk.js
CHANGED
|
@@ -278,12 +278,13 @@ class Client {
|
|
|
278
278
|
'x-sdk-name': 'Console',
|
|
279
279
|
'x-sdk-platform': 'console',
|
|
280
280
|
'x-sdk-language': 'web',
|
|
281
|
-
'x-sdk-version': '1.4.
|
|
281
|
+
'x-sdk-version': '1.4.5',
|
|
282
282
|
'X-Appwrite-Response-Format': '1.6.0',
|
|
283
283
|
};
|
|
284
284
|
this.realtime = {
|
|
285
285
|
socket: undefined,
|
|
286
286
|
timeout: undefined,
|
|
287
|
+
heartbeat: undefined,
|
|
287
288
|
url: '',
|
|
288
289
|
channels: new Set(),
|
|
289
290
|
subscriptions: new Map(),
|
|
@@ -309,6 +310,17 @@ class Client {
|
|
|
309
310
|
return 60000;
|
|
310
311
|
}
|
|
311
312
|
},
|
|
313
|
+
createHeartbeat: () => {
|
|
314
|
+
if (this.realtime.heartbeat) {
|
|
315
|
+
clearTimeout(this.realtime.heartbeat);
|
|
316
|
+
}
|
|
317
|
+
this.realtime.heartbeat = window === null || window === void 0 ? void 0 : window.setInterval(() => {
|
|
318
|
+
var _a;
|
|
319
|
+
(_a = this.realtime.socket) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify({
|
|
320
|
+
type: 'ping'
|
|
321
|
+
}));
|
|
322
|
+
}, 20000);
|
|
323
|
+
},
|
|
312
324
|
createSocket: () => {
|
|
313
325
|
var _a, _b, _c;
|
|
314
326
|
if (this.realtime.channels.size < 1) {
|
|
@@ -337,6 +349,7 @@ class Client {
|
|
|
337
349
|
this.realtime.socket.addEventListener('message', this.realtime.onMessage);
|
|
338
350
|
this.realtime.socket.addEventListener('open', _event => {
|
|
339
351
|
this.realtime.reconnectAttempts = 0;
|
|
352
|
+
this.realtime.createHeartbeat();
|
|
340
353
|
});
|
|
341
354
|
this.realtime.socket.addEventListener('close', event => {
|
|
342
355
|
var _a, _b, _c;
|
|
@@ -963,6 +976,28 @@ class Account {
|
|
|
963
976
|
return yield this.client.call('delete', uri, apiHeaders, payload);
|
|
964
977
|
});
|
|
965
978
|
}
|
|
979
|
+
/**
|
|
980
|
+
* Get coupon details
|
|
981
|
+
*
|
|
982
|
+
*
|
|
983
|
+
* @param {string} couponId
|
|
984
|
+
* @throws {AppwriteException}
|
|
985
|
+
* @returns {Promise<Models.Coupon>}
|
|
986
|
+
*/
|
|
987
|
+
getCoupon(couponId) {
|
|
988
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
989
|
+
if (typeof couponId === 'undefined') {
|
|
990
|
+
throw new AppwriteException('Missing required parameter: "couponId"');
|
|
991
|
+
}
|
|
992
|
+
const apiPath = '/account/coupons/{couponId}'.replace('{couponId}', couponId);
|
|
993
|
+
const payload = {};
|
|
994
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
995
|
+
const apiHeaders = {
|
|
996
|
+
'content-type': 'application/json',
|
|
997
|
+
};
|
|
998
|
+
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
966
1001
|
/**
|
|
967
1002
|
* Update email
|
|
968
1003
|
*
|
|
@@ -2187,7 +2222,7 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
|
|
|
2187
2222
|
/**
|
|
2188
2223
|
* Create magic URL token
|
|
2189
2224
|
*
|
|
2190
|
-
* 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.
|
|
2225
|
+
* 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.
|
|
2191
2226
|
|
|
2192
2227
|
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).
|
|
2193
2228
|
|
|
@@ -3154,6 +3189,28 @@ class Console {
|
|
|
3154
3189
|
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
3155
3190
|
});
|
|
3156
3191
|
}
|
|
3192
|
+
/**
|
|
3193
|
+
* Create program membership
|
|
3194
|
+
*
|
|
3195
|
+
*
|
|
3196
|
+
* @param {string} programId
|
|
3197
|
+
* @throws {AppwriteException}
|
|
3198
|
+
* @returns {Promise<{}>}
|
|
3199
|
+
*/
|
|
3200
|
+
createProgramMembership(programId) {
|
|
3201
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3202
|
+
if (typeof programId === 'undefined') {
|
|
3203
|
+
throw new AppwriteException('Missing required parameter: "programId"');
|
|
3204
|
+
}
|
|
3205
|
+
const apiPath = '/console/programs/{programId}/memberships'.replace('{programId}', programId);
|
|
3206
|
+
const payload = {};
|
|
3207
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3208
|
+
const apiHeaders = {
|
|
3209
|
+
'content-type': 'application/json',
|
|
3210
|
+
};
|
|
3211
|
+
return yield this.client.call('post', uri, apiHeaders, payload);
|
|
3212
|
+
});
|
|
3213
|
+
}
|
|
3157
3214
|
/**
|
|
3158
3215
|
* Get Regions
|
|
3159
3216
|
*
|
|
@@ -9093,7 +9150,7 @@ class Migrations {
|
|
|
9093
9150
|
});
|
|
9094
9151
|
}
|
|
9095
9152
|
/**
|
|
9096
|
-
* Migrate Firebase data
|
|
9153
|
+
* Migrate Firebase data
|
|
9097
9154
|
*
|
|
9098
9155
|
*
|
|
9099
9156
|
* @param {string[]} resources
|
|
@@ -9124,74 +9181,6 @@ class Migrations {
|
|
|
9124
9181
|
return yield this.client.call('post', uri, apiHeaders, payload);
|
|
9125
9182
|
});
|
|
9126
9183
|
}
|
|
9127
|
-
/**
|
|
9128
|
-
* Revoke Appwrite's authorization to access Firebase projects
|
|
9129
|
-
*
|
|
9130
|
-
*
|
|
9131
|
-
* @throws {AppwriteException}
|
|
9132
|
-
* @returns {Promise<{}>}
|
|
9133
|
-
*/
|
|
9134
|
-
deleteFirebaseAuth() {
|
|
9135
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
9136
|
-
const apiPath = '/migrations/firebase/deauthorize';
|
|
9137
|
-
const payload = {};
|
|
9138
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9139
|
-
const apiHeaders = {
|
|
9140
|
-
'content-type': 'application/json',
|
|
9141
|
-
};
|
|
9142
|
-
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
9143
|
-
});
|
|
9144
|
-
}
|
|
9145
|
-
/**
|
|
9146
|
-
* Migrate Firebase data (OAuth)
|
|
9147
|
-
*
|
|
9148
|
-
*
|
|
9149
|
-
* @param {string[]} resources
|
|
9150
|
-
* @param {string} projectId
|
|
9151
|
-
* @throws {AppwriteException}
|
|
9152
|
-
* @returns {Promise<Models.Migration>}
|
|
9153
|
-
*/
|
|
9154
|
-
createFirebaseOAuthMigration(resources, projectId) {
|
|
9155
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
9156
|
-
if (typeof resources === 'undefined') {
|
|
9157
|
-
throw new AppwriteException('Missing required parameter: "resources"');
|
|
9158
|
-
}
|
|
9159
|
-
if (typeof projectId === 'undefined') {
|
|
9160
|
-
throw new AppwriteException('Missing required parameter: "projectId"');
|
|
9161
|
-
}
|
|
9162
|
-
const apiPath = '/migrations/firebase/oauth';
|
|
9163
|
-
const payload = {};
|
|
9164
|
-
if (typeof resources !== 'undefined') {
|
|
9165
|
-
payload['resources'] = resources;
|
|
9166
|
-
}
|
|
9167
|
-
if (typeof projectId !== 'undefined') {
|
|
9168
|
-
payload['projectId'] = projectId;
|
|
9169
|
-
}
|
|
9170
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9171
|
-
const apiHeaders = {
|
|
9172
|
-
'content-type': 'application/json',
|
|
9173
|
-
};
|
|
9174
|
-
return yield this.client.call('post', uri, apiHeaders, payload);
|
|
9175
|
-
});
|
|
9176
|
-
}
|
|
9177
|
-
/**
|
|
9178
|
-
* List Firebase projects
|
|
9179
|
-
*
|
|
9180
|
-
*
|
|
9181
|
-
* @throws {AppwriteException}
|
|
9182
|
-
* @returns {Promise<Models.FirebaseProjectList>}
|
|
9183
|
-
*/
|
|
9184
|
-
listFirebaseProjects() {
|
|
9185
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
9186
|
-
const apiPath = '/migrations/firebase/projects';
|
|
9187
|
-
const payload = {};
|
|
9188
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9189
|
-
const apiHeaders = {
|
|
9190
|
-
'content-type': 'application/json',
|
|
9191
|
-
};
|
|
9192
|
-
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
9193
|
-
});
|
|
9194
|
-
}
|
|
9195
9184
|
/**
|
|
9196
9185
|
* Generate a report on Firebase data
|
|
9197
9186
|
*
|
|
@@ -9224,38 +9213,6 @@ class Migrations {
|
|
|
9224
9213
|
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
9225
9214
|
});
|
|
9226
9215
|
}
|
|
9227
|
-
/**
|
|
9228
|
-
* Generate a report on Firebase data using OAuth
|
|
9229
|
-
*
|
|
9230
|
-
*
|
|
9231
|
-
* @param {string[]} resources
|
|
9232
|
-
* @param {string} projectId
|
|
9233
|
-
* @throws {AppwriteException}
|
|
9234
|
-
* @returns {Promise<Models.MigrationReport>}
|
|
9235
|
-
*/
|
|
9236
|
-
getFirebaseReportOAuth(resources, projectId) {
|
|
9237
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
9238
|
-
if (typeof resources === 'undefined') {
|
|
9239
|
-
throw new AppwriteException('Missing required parameter: "resources"');
|
|
9240
|
-
}
|
|
9241
|
-
if (typeof projectId === 'undefined') {
|
|
9242
|
-
throw new AppwriteException('Missing required parameter: "projectId"');
|
|
9243
|
-
}
|
|
9244
|
-
const apiPath = '/migrations/firebase/report/oauth';
|
|
9245
|
-
const payload = {};
|
|
9246
|
-
if (typeof resources !== 'undefined') {
|
|
9247
|
-
payload['resources'] = resources;
|
|
9248
|
-
}
|
|
9249
|
-
if (typeof projectId !== 'undefined') {
|
|
9250
|
-
payload['projectId'] = projectId;
|
|
9251
|
-
}
|
|
9252
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
9253
|
-
const apiHeaders = {
|
|
9254
|
-
'content-type': 'application/json',
|
|
9255
|
-
};
|
|
9256
|
-
return yield this.client.call('get', uri, apiHeaders, payload);
|
|
9257
|
-
});
|
|
9258
|
-
}
|
|
9259
9216
|
/**
|
|
9260
9217
|
* Migrate NHost data
|
|
9261
9218
|
*
|
|
@@ -9729,7 +9686,7 @@ class Organizations {
|
|
|
9729
9686
|
* @param {string} organizationId
|
|
9730
9687
|
* @param {string} aggregationId
|
|
9731
9688
|
* @throws {AppwriteException}
|
|
9732
|
-
* @returns {Promise<Models.
|
|
9689
|
+
* @returns {Promise<Models.Invoice>}
|
|
9733
9690
|
*/
|
|
9734
9691
|
getAggregation(organizationId, aggregationId) {
|
|
9735
9692
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -10021,7 +9978,7 @@ class Organizations {
|
|
|
10021
9978
|
});
|
|
10022
9979
|
}
|
|
10023
9980
|
/**
|
|
10024
|
-
*
|
|
9981
|
+
* Download invoice in PDF
|
|
10025
9982
|
*
|
|
10026
9983
|
*
|
|
10027
9984
|
* @param {string} organizationId
|
|
@@ -15586,6 +15543,7 @@ var Runtime;
|
|
|
15586
15543
|
Runtime["Bun11"] = "bun-1.1";
|
|
15587
15544
|
Runtime["Go123"] = "go-1.23";
|
|
15588
15545
|
Runtime["Static1"] = "static-1";
|
|
15546
|
+
Runtime["Flutter324"] = "flutter-3.24";
|
|
15589
15547
|
})(Runtime || (Runtime = {}));
|
|
15590
15548
|
|
|
15591
15549
|
var FunctionUsageRange;
|