@appwrite.io/console 1.7.0 → 1.9.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 +3 -3
- package/dist/cjs/sdk.js +330 -27
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +331 -28
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +330 -27
- package/docs/examples/databases/decrement-document-attribute.md +18 -0
- package/docs/examples/databases/increment-document-attribute.md +18 -0
- package/docs/examples/databases/upsert-document.md +17 -0
- package/docs/examples/databases/upsert-documents.md +1 -1
- package/docs/examples/domains/create-record-a-a-a-a.md +1 -1
- package/docs/examples/domains/create-record-a.md +1 -1
- package/docs/examples/domains/create-record-alias.md +1 -1
- package/docs/examples/domains/create-record-c-a-a.md +1 -1
- package/docs/examples/domains/create-record-c-n-a-m-e.md +1 -1
- package/docs/examples/domains/create-record-h-t-t-p-s.md +1 -1
- package/docs/examples/domains/create-record-m-x.md +1 -1
- package/docs/examples/domains/create-record-n-s.md +1 -1
- package/docs/examples/domains/create-record-s-r-v.md +1 -1
- package/docs/examples/domains/create-record-t-x-t.md +1 -1
- package/docs/examples/domains/update-record-a-a-a-a.md +1 -1
- package/docs/examples/domains/update-record-a.md +1 -1
- package/docs/examples/domains/update-record-alias.md +1 -1
- package/docs/examples/domains/update-record-c-a-a.md +1 -1
- package/docs/examples/domains/update-record-c-n-a-m-e.md +1 -1
- package/docs/examples/domains/update-record-h-t-t-p-s.md +1 -1
- package/docs/examples/domains/update-record-m-x.md +1 -1
- package/docs/examples/domains/update-record-n-s.md +1 -1
- package/docs/examples/domains/update-record-s-r-v.md +1 -1
- package/docs/examples/domains/update-record-t-x-t.md +1 -1
- package/docs/examples/functions/create.md +1 -5
- package/docs/examples/health/{get-queue-stats-usage-dump.md → get-queue-billing-project-aggregation.md} +2 -2
- package/docs/examples/health/{get-queue-billing-aggregation.md → get-queue-billing-team-aggregation.md} +1 -1
- package/docs/examples/organizations/cancel-downgrade.md +13 -0
- package/docs/examples/organizations/estimation-create-organization.md +16 -0
- package/docs/examples/organizations/estimation-delete-organization.md +13 -0
- package/docs/examples/organizations/estimation-update-plan.md +16 -0
- package/docs/examples/organizations/get-usage.md +1 -1
- package/docs/examples/organizations/validate-payment.md +14 -0
- package/docs/examples/proxy/create-redirect-rule.md +4 -2
- package/package.json +1 -1
- package/src/client.ts +9 -5
- package/src/enums/build-runtime.ts +2 -0
- package/src/enums/image-format.ts +1 -0
- package/src/enums/proxy-resource-type.ts +4 -0
- package/src/enums/runtime.ts +2 -0
- package/src/index.ts +1 -0
- package/src/models.ts +284 -2
- package/src/services/databases.ts +141 -1
- package/src/services/functions.ts +1 -17
- package/src/services/health.ts +28 -3
- package/src/services/organizations.ts +197 -0
- package/src/services/proxy.ts +16 -1
- package/src/services/tokens.ts +1 -1
- package/types/enums/build-runtime.d.ts +3 -1
- package/types/enums/image-format.d.ts +2 -1
- package/types/enums/proxy-resource-type.d.ts +4 -0
- package/types/enums/runtime.d.ts +3 -1
- package/types/index.d.ts +1 -0
- package/types/models.d.ts +284 -2
- package/types/services/databases.d.ts +39 -1
- package/types/services/functions.d.ts +1 -5
- package/types/services/health.d.ts +10 -2
- package/types/services/organizations.d.ts +57 -0
- package/types/services/proxy.d.ts +4 -1
- package/types/services/tokens.d.ts +1 -1
- package/docs/examples/functions/create-build.md +0 -15
- package/docs/examples/functions/get-function-usage.md +0 -14
- package/docs/examples/functions/update-deployment-build.md +0 -14
- package/docs/examples/functions/update-deployment.md +0 -14
- package/docs/examples/proxy/create-rule.md +0 -15
- package/src/enums/resource-type.ts +0 -4
- package/types/enums/resource-type.d.ts +0 -4
|
@@ -24,11 +24,7 @@ const result = await functions.create(
|
|
|
24
24
|
'<PROVIDER_BRANCH>', // providerBranch (optional)
|
|
25
25
|
false, // providerSilentMode (optional)
|
|
26
26
|
'<PROVIDER_ROOT_DIRECTORY>', // providerRootDirectory (optional)
|
|
27
|
-
''
|
|
28
|
-
'<TEMPLATE_REPOSITORY>', // templateRepository (optional)
|
|
29
|
-
'<TEMPLATE_OWNER>', // templateOwner (optional)
|
|
30
|
-
'<TEMPLATE_ROOT_DIRECTORY>', // templateRootDirectory (optional)
|
|
31
|
-
'<TEMPLATE_VERSION>' // templateVersion (optional)
|
|
27
|
+
'' // specification (optional)
|
|
32
28
|
);
|
|
33
29
|
|
|
34
30
|
console.log(result);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Client, Health } from "@appwrite.io/console";
|
|
2
2
|
|
|
3
3
|
const client = new Client()
|
|
4
|
-
.setEndpoint('https
|
|
4
|
+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
5
|
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
6
|
|
|
7
7
|
const health = new Health(client);
|
|
8
8
|
|
|
9
|
-
const result = await health.
|
|
9
|
+
const result = await health.getQueueBillingProjectAggregation(
|
|
10
10
|
null // threshold (optional)
|
|
11
11
|
);
|
|
12
12
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Client, Organizations } from "@appwrite.io/console";
|
|
2
|
+
|
|
3
|
+
const client = new Client()
|
|
4
|
+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
|
+
|
|
7
|
+
const organizations = new Organizations(client);
|
|
8
|
+
|
|
9
|
+
const result = await organizations.cancelDowngrade(
|
|
10
|
+
'<ORGANIZATION_ID>' // organizationId
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
console.log(result);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Client, Organizations, } from "@appwrite.io/console";
|
|
2
|
+
|
|
3
|
+
const client = new Client()
|
|
4
|
+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
|
+
|
|
7
|
+
const organizations = new Organizations(client);
|
|
8
|
+
|
|
9
|
+
const result = await organizations.estimationCreateOrganization(
|
|
10
|
+
.Tier0, // billingPlan
|
|
11
|
+
'<PAYMENT_METHOD_ID>', // paymentMethodId (optional)
|
|
12
|
+
[], // invites (optional)
|
|
13
|
+
'<COUPON_ID>' // couponId (optional)
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
console.log(result);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Client, Organizations } from "@appwrite.io/console";
|
|
2
|
+
|
|
3
|
+
const client = new Client()
|
|
4
|
+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
|
+
|
|
7
|
+
const organizations = new Organizations(client);
|
|
8
|
+
|
|
9
|
+
const result = await organizations.estimationDeleteOrganization(
|
|
10
|
+
'<ORGANIZATION_ID>' // organizationId
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
console.log(result);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Client, Organizations, } from "@appwrite.io/console";
|
|
2
|
+
|
|
3
|
+
const client = new Client()
|
|
4
|
+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
|
+
|
|
7
|
+
const organizations = new Organizations(client);
|
|
8
|
+
|
|
9
|
+
const result = await organizations.estimationUpdatePlan(
|
|
10
|
+
'<ORGANIZATION_ID>', // organizationId
|
|
11
|
+
.Tier0, // billingPlan
|
|
12
|
+
[], // invites (optional)
|
|
13
|
+
'<COUPON_ID>' // couponId (optional)
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
console.log(result);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Client, Organizations } from "@appwrite.io/console";
|
|
2
2
|
|
|
3
3
|
const client = new Client()
|
|
4
|
-
.setEndpoint('https
|
|
4
|
+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
5
|
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
6
|
|
|
7
7
|
const organizations = new Organizations(client);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Client, Organizations } from "@appwrite.io/console";
|
|
2
|
+
|
|
3
|
+
const client = new Client()
|
|
4
|
+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
6
|
+
|
|
7
|
+
const organizations = new Organizations(client);
|
|
8
|
+
|
|
9
|
+
const result = await organizations.validatePayment(
|
|
10
|
+
'<ORGANIZATION_ID>', // organizationId
|
|
11
|
+
[] // invites (optional)
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
console.log(result);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Client, Proxy,
|
|
1
|
+
import { Client, Proxy, , ProxyResourceType } from "@appwrite.io/console";
|
|
2
2
|
|
|
3
3
|
const client = new Client()
|
|
4
4
|
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
|
@@ -9,7 +9,9 @@ const proxy = new Proxy(client);
|
|
|
9
9
|
const result = await proxy.createRedirectRule(
|
|
10
10
|
'', // domain
|
|
11
11
|
'https://example.com', // url
|
|
12
|
-
.MovedPermanently301 // statusCode
|
|
12
|
+
.MovedPermanently301, // statusCode
|
|
13
|
+
'<RESOURCE_ID>', // resourceId
|
|
14
|
+
ProxyResourceType.Site // resourceType
|
|
13
15
|
);
|
|
14
16
|
|
|
15
17
|
console.log(result);
|
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": "1.
|
|
5
|
+
"version": "1.9.0",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "dist/cjs/sdk.js",
|
|
8
8
|
"exports": {
|
package/src/client.ts
CHANGED
|
@@ -316,7 +316,7 @@ class Client {
|
|
|
316
316
|
'x-sdk-name': 'Console',
|
|
317
317
|
'x-sdk-platform': 'console',
|
|
318
318
|
'x-sdk-language': 'web',
|
|
319
|
-
'x-sdk-version': '1.
|
|
319
|
+
'x-sdk-version': '1.9.0',
|
|
320
320
|
'X-Appwrite-Response-Format': '1.7.0',
|
|
321
321
|
};
|
|
322
322
|
|
|
@@ -636,9 +636,12 @@ class Client {
|
|
|
636
636
|
let options: RequestInit = {
|
|
637
637
|
method,
|
|
638
638
|
headers,
|
|
639
|
-
credentials: 'include',
|
|
640
639
|
};
|
|
641
640
|
|
|
641
|
+
if (headers['X-Appwrite-Dev-Key'] === undefined) {
|
|
642
|
+
options.credentials = 'include';
|
|
643
|
+
}
|
|
644
|
+
|
|
642
645
|
if (method === 'GET') {
|
|
643
646
|
for (const [key, value] of Object.entries(Client.flatten(params))) {
|
|
644
647
|
url.searchParams.append(key, value);
|
|
@@ -674,9 +677,9 @@ class Client {
|
|
|
674
677
|
}
|
|
675
678
|
|
|
676
679
|
async chunkedUpload(method: string, url: URL, headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void) {
|
|
677
|
-
const file = Object.
|
|
680
|
+
const [fileParam, file] = Object.entries(originalPayload).find(([_, value]) => value instanceof File) ?? [];
|
|
678
681
|
|
|
679
|
-
if (!file) {
|
|
682
|
+
if (!file || !fileParam) {
|
|
680
683
|
throw new Error('File not found in payload');
|
|
681
684
|
}
|
|
682
685
|
|
|
@@ -696,7 +699,8 @@ class Client {
|
|
|
696
699
|
headers['content-range'] = `bytes ${start}-${end-1}/${file.size}`;
|
|
697
700
|
const chunk = file.slice(start, end);
|
|
698
701
|
|
|
699
|
-
let payload = { ...originalPayload
|
|
702
|
+
let payload = { ...originalPayload };
|
|
703
|
+
payload[fileParam] = new File([chunk], file.name);
|
|
700
704
|
|
|
701
705
|
response = await this.call(method, url, headers, payload);
|
|
702
706
|
|
|
@@ -33,6 +33,7 @@ export enum BuildRuntime {
|
|
|
33
33
|
Dart31 = 'dart-3.1',
|
|
34
34
|
Dart33 = 'dart-3.3',
|
|
35
35
|
Dart35 = 'dart-3.5',
|
|
36
|
+
Dart38 = 'dart-3.8',
|
|
36
37
|
Dotnet60 = 'dotnet-6.0',
|
|
37
38
|
Dotnet70 = 'dotnet-7.0',
|
|
38
39
|
Dotnet80 = 'dotnet-8.0',
|
|
@@ -59,4 +60,5 @@ export enum BuildRuntime {
|
|
|
59
60
|
Flutter324 = 'flutter-3.24',
|
|
60
61
|
Flutter327 = 'flutter-3.27',
|
|
61
62
|
Flutter329 = 'flutter-3.29',
|
|
63
|
+
Flutter332 = 'flutter-3.32',
|
|
62
64
|
}
|
package/src/enums/runtime.ts
CHANGED
|
@@ -33,6 +33,7 @@ export enum Runtime {
|
|
|
33
33
|
Dart31 = 'dart-3.1',
|
|
34
34
|
Dart33 = 'dart-3.3',
|
|
35
35
|
Dart35 = 'dart-3.5',
|
|
36
|
+
Dart38 = 'dart-3.8',
|
|
36
37
|
Dotnet60 = 'dotnet-6.0',
|
|
37
38
|
Dotnet70 = 'dotnet-7.0',
|
|
38
39
|
Dotnet80 = 'dotnet-8.0',
|
|
@@ -59,4 +60,5 @@ export enum Runtime {
|
|
|
59
60
|
Flutter324 = 'flutter-3.24',
|
|
60
61
|
Flutter327 = 'flutter-3.27',
|
|
61
62
|
Flutter329 = 'flutter-3.29',
|
|
63
|
+
Flutter332 = 'flutter-3.32',
|
|
62
64
|
}
|
package/src/index.ts
CHANGED
|
@@ -66,6 +66,7 @@ export { EmailTemplateLocale } from './enums/email-template-locale';
|
|
|
66
66
|
export { SmsTemplateType } from './enums/sms-template-type';
|
|
67
67
|
export { SmsTemplateLocale } from './enums/sms-template-locale';
|
|
68
68
|
export { StatusCode } from './enums/status-code';
|
|
69
|
+
export { ProxyResourceType } from './enums/proxy-resource-type';
|
|
69
70
|
export { Framework } from './enums/framework';
|
|
70
71
|
export { BuildRuntime } from './enums/build-runtime';
|
|
71
72
|
export { Adapter } from './enums/adapter';
|