@appwrite.io/console 1.8.0 → 1.10.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/.github/workflows/publish.yml +1 -1
- package/CHANGELOG.md +45 -6
- package/README.md +82 -2
- package/dist/cjs/sdk.js +532 -200
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +533 -201
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +532 -200
- package/docs/examples/databases/create-document.md +1 -3
- package/docs/examples/databases/create-documents.md +1 -1
- 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-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-execution.md +1 -1
- 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-available-credits.md +13 -0
- package/docs/examples/organizations/get-usage.md +1 -1
- package/docs/examples/organizations/update-projects.md +14 -0
- package/docs/examples/organizations/validate-payment.md +14 -0
- package/docs/examples/proxy/create-redirect-rule.md +4 -2
- package/docs/examples/vcs/get-repository-contents.md +2 -1
- package/package.json +1 -1
- package/src/client.ts +5 -4
- 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 +513 -11
- package/src/services/account.ts +97 -36
- package/src/services/avatars.ts +26 -20
- package/src/services/backups.ts +11 -0
- package/src/services/console.ts +8 -1
- package/src/services/databases.ts +190 -31
- package/src/services/domains.ts +111 -69
- package/src/services/functions.ts +37 -8
- package/src/services/graphql.ts +1 -0
- package/src/services/health.ts +54 -4
- package/src/services/locale.ts +9 -2
- package/src/services/messaging.ts +53 -8
- package/src/services/migrations.ts +12 -0
- package/src/services/organizations.ts +301 -14
- package/src/services/project.ts +5 -0
- package/src/services/projects.ts +50 -0
- package/src/services/proxy.ts +23 -1
- package/src/services/sites.ts +32 -4
- package/src/services/storage.ts +23 -9
- package/src/services/teams.ts +30 -17
- package/src/services/tokens.ts +4 -0
- package/src/services/users.ts +69 -27
- package/src/services/vcs.ts +16 -4
- 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 +494 -188
- package/types/services/account.d.ts +36 -36
- package/types/services/avatars.d.ts +20 -20
- package/types/services/console.d.ts +1 -1
- package/types/services/databases.d.ts +67 -31
- package/types/services/domains.d.ts +69 -69
- package/types/services/functions.d.ts +8 -8
- package/types/services/health.d.ts +11 -3
- package/types/services/locale.d.ts +2 -2
- package/types/services/messaging.d.ts +8 -8
- package/types/services/organizations.d.ts +88 -14
- package/types/services/proxy.d.ts +4 -1
- package/types/services/sites.d.ts +4 -4
- package/types/services/storage.d.ts +9 -9
- package/types/services/teams.d.ts +17 -17
- package/types/services/users.d.ts +27 -27
- package/types/services/vcs.d.ts +4 -4
- 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
|
@@ -2,9 +2,7 @@ import { Client, Databases } from "@appwrite.io/console";
|
|
|
2
2
|
|
|
3
3
|
const client = new Client()
|
|
4
4
|
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
|
|
5
|
-
.
|
|
6
|
-
.setKey('<YOUR_API_KEY>') // Your secret API key
|
|
7
|
-
.setJWT('<YOUR_JWT>'); // Your secret JSON Web Token
|
|
5
|
+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
|
|
8
6
|
|
|
9
7
|
const databases = new Databases(client);
|
|
10
8
|
|
|
@@ -2,7 +2,7 @@ import { Client, Databases } from "@appwrite.io/console";
|
|
|
2
2
|
|
|
3
3
|
const client = new Client()
|
|
4
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 databases = new Databases(client);
|
|
8
8
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Client, Databases } 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 databases = new Databases(client);
|
|
8
|
+
|
|
9
|
+
const result = await databases.decrementDocumentAttribute(
|
|
10
|
+
'<DATABASE_ID>', // databaseId
|
|
11
|
+
'<COLLECTION_ID>', // collectionId
|
|
12
|
+
'<DOCUMENT_ID>', // documentId
|
|
13
|
+
'', // attribute
|
|
14
|
+
null, // value (optional)
|
|
15
|
+
null // min (optional)
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
console.log(result);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Client, Databases } 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 databases = new Databases(client);
|
|
8
|
+
|
|
9
|
+
const result = await databases.incrementDocumentAttribute(
|
|
10
|
+
'<DATABASE_ID>', // databaseId
|
|
11
|
+
'<COLLECTION_ID>', // collectionId
|
|
12
|
+
'<DOCUMENT_ID>', // documentId
|
|
13
|
+
'', // attribute
|
|
14
|
+
null, // value (optional)
|
|
15
|
+
null // max (optional)
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
console.log(result);
|
|
@@ -13,7 +13,7 @@ const result = await functions.createExecution(
|
|
|
13
13
|
'<PATH>', // path (optional)
|
|
14
14
|
ExecutionMethod.GET, // method (optional)
|
|
15
15
|
{}, // headers (optional)
|
|
16
|
-
'' // scheduledAt (optional)
|
|
16
|
+
'<SCHEDULED_AT>' // scheduledAt (optional)
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
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);
|
|
@@ -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.getAvailableCredits(
|
|
10
|
+
'<ORGANIZATION_ID>' // organizationId
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
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.updateProjects(
|
|
10
|
+
'<ORGANIZATION_ID>', // organizationId
|
|
11
|
+
[] // projects (optional)
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
console.log(result);
|
|
@@ -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);
|
|
@@ -9,7 +9,8 @@ const vcs = new Vcs(client);
|
|
|
9
9
|
const result = await vcs.getRepositoryContents(
|
|
10
10
|
'<INSTALLATION_ID>', // installationId
|
|
11
11
|
'<PROVIDER_REPOSITORY_ID>', // providerRepositoryId
|
|
12
|
-
'<PROVIDER_ROOT_DIRECTORY>' // providerRootDirectory (optional)
|
|
12
|
+
'<PROVIDER_ROOT_DIRECTORY>', // providerRootDirectory (optional)
|
|
13
|
+
'<PROVIDER_REFERENCE>' // providerReference (optional)
|
|
13
14
|
);
|
|
14
15
|
|
|
15
16
|
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.10.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.10.0',
|
|
320
320
|
'X-Appwrite-Response-Format': '1.7.0',
|
|
321
321
|
};
|
|
322
322
|
|
|
@@ -677,9 +677,9 @@ class Client {
|
|
|
677
677
|
}
|
|
678
678
|
|
|
679
679
|
async chunkedUpload(method: string, url: URL, headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void) {
|
|
680
|
-
const file = Object.
|
|
680
|
+
const [fileParam, file] = Object.entries(originalPayload).find(([_, value]) => value instanceof File) ?? [];
|
|
681
681
|
|
|
682
|
-
if (!file) {
|
|
682
|
+
if (!file || !fileParam) {
|
|
683
683
|
throw new Error('File not found in payload');
|
|
684
684
|
}
|
|
685
685
|
|
|
@@ -699,7 +699,8 @@ class Client {
|
|
|
699
699
|
headers['content-range'] = `bytes ${start}-${end-1}/${file.size}`;
|
|
700
700
|
const chunk = file.slice(start, end);
|
|
701
701
|
|
|
702
|
-
let payload = { ...originalPayload
|
|
702
|
+
let payload = { ...originalPayload };
|
|
703
|
+
payload[fileParam] = new File([chunk], file.name);
|
|
703
704
|
|
|
704
705
|
response = await this.call(method, url, headers, payload);
|
|
705
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';
|