@appwrite.io/console 1.8.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.
Files changed (67) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/sdk.js +287 -8
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +288 -9
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/dist/iife/sdk.js +287 -8
  7. package/docs/examples/databases/decrement-document-attribute.md +18 -0
  8. package/docs/examples/databases/increment-document-attribute.md +18 -0
  9. package/docs/examples/databases/upsert-documents.md +1 -1
  10. package/docs/examples/domains/create-record-a-a-a-a.md +1 -1
  11. package/docs/examples/domains/create-record-a.md +1 -1
  12. package/docs/examples/domains/create-record-alias.md +1 -1
  13. package/docs/examples/domains/create-record-c-a-a.md +1 -1
  14. package/docs/examples/domains/create-record-c-n-a-m-e.md +1 -1
  15. package/docs/examples/domains/create-record-h-t-t-p-s.md +1 -1
  16. package/docs/examples/domains/create-record-m-x.md +1 -1
  17. package/docs/examples/domains/create-record-n-s.md +1 -1
  18. package/docs/examples/domains/create-record-s-r-v.md +1 -1
  19. package/docs/examples/domains/create-record-t-x-t.md +1 -1
  20. package/docs/examples/domains/update-record-a-a-a-a.md +1 -1
  21. package/docs/examples/domains/update-record-a.md +1 -1
  22. package/docs/examples/domains/update-record-alias.md +1 -1
  23. package/docs/examples/domains/update-record-c-a-a.md +1 -1
  24. package/docs/examples/domains/update-record-c-n-a-m-e.md +1 -1
  25. package/docs/examples/domains/update-record-h-t-t-p-s.md +1 -1
  26. package/docs/examples/domains/update-record-m-x.md +1 -1
  27. package/docs/examples/domains/update-record-n-s.md +1 -1
  28. package/docs/examples/domains/update-record-s-r-v.md +1 -1
  29. package/docs/examples/domains/update-record-t-x-t.md +1 -1
  30. package/docs/examples/health/{get-queue-stats-usage-dump.md → get-queue-billing-project-aggregation.md} +2 -2
  31. package/docs/examples/health/{get-queue-billing-aggregation.md → get-queue-billing-team-aggregation.md} +1 -1
  32. package/docs/examples/organizations/cancel-downgrade.md +13 -0
  33. package/docs/examples/organizations/estimation-create-organization.md +16 -0
  34. package/docs/examples/organizations/estimation-delete-organization.md +13 -0
  35. package/docs/examples/organizations/estimation-update-plan.md +16 -0
  36. package/docs/examples/organizations/get-usage.md +1 -1
  37. package/docs/examples/organizations/validate-payment.md +14 -0
  38. package/docs/examples/proxy/create-redirect-rule.md +4 -2
  39. package/package.json +1 -1
  40. package/src/client.ts +5 -4
  41. package/src/enums/build-runtime.ts +2 -0
  42. package/src/enums/image-format.ts +1 -0
  43. package/src/enums/proxy-resource-type.ts +4 -0
  44. package/src/enums/runtime.ts +2 -0
  45. package/src/index.ts +1 -0
  46. package/src/models.ts +272 -2
  47. package/src/services/databases.ts +96 -1
  48. package/src/services/health.ts +28 -3
  49. package/src/services/organizations.ts +197 -0
  50. package/src/services/proxy.ts +16 -1
  51. package/types/enums/build-runtime.d.ts +3 -1
  52. package/types/enums/image-format.d.ts +2 -1
  53. package/types/enums/proxy-resource-type.d.ts +4 -0
  54. package/types/enums/runtime.d.ts +3 -1
  55. package/types/index.d.ts +1 -0
  56. package/types/models.d.ts +272 -2
  57. package/types/services/databases.d.ts +27 -1
  58. package/types/services/health.d.ts +10 -2
  59. package/types/services/organizations.d.ts +57 -0
  60. package/types/services/proxy.d.ts +4 -1
  61. package/docs/examples/functions/create-build.md +0 -15
  62. package/docs/examples/functions/get-function-usage.md +0 -14
  63. package/docs/examples/functions/update-deployment-build.md +0 -14
  64. package/docs/examples/functions/update-deployment.md +0 -14
  65. package/docs/examples/proxy/create-rule.md +0 -15
  66. package/src/enums/resource-type.ts +0 -4
  67. package/types/enums/resource-type.d.ts +0 -4
@@ -478,7 +478,7 @@ export declare class Databases {
478
478
  * @throws {AppwriteException}
479
479
  * @returns {Promise<Models.DocumentList<Document>>}
480
480
  */
481
- upsertDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, documents?: object[]): Promise<Models.DocumentList<Document>>;
481
+ upsertDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, documents: object[]): Promise<Models.DocumentList<Document>>;
482
482
  /**
483
483
  * Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated.
484
484
  *
@@ -556,6 +556,32 @@ export declare class Databases {
556
556
  * @returns {Promise<Models.LogList>}
557
557
  */
558
558
  listDocumentLogs(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Models.LogList>;
559
+ /**
560
+ * Decrement a specific attribute of a document by a given value.
561
+ *
562
+ * @param {string} databaseId
563
+ * @param {string} collectionId
564
+ * @param {string} documentId
565
+ * @param {string} attribute
566
+ * @param {number} value
567
+ * @param {number} min
568
+ * @throws {AppwriteException}
569
+ * @returns {Promise<Document>}
570
+ */
571
+ decrementDocumentAttribute<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number): Promise<Document>;
572
+ /**
573
+ * Increment a specific attribute of a document by a given value.
574
+ *
575
+ * @param {string} databaseId
576
+ * @param {string} collectionId
577
+ * @param {string} documentId
578
+ * @param {string} attribute
579
+ * @param {number} value
580
+ * @param {number} max
581
+ * @throws {AppwriteException}
582
+ * @returns {Promise<Document>}
583
+ */
584
+ incrementDocumentAttribute<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number): Promise<Document>;
559
585
  /**
560
586
  * List indexes in the collection.
561
587
  *
@@ -48,13 +48,21 @@ export declare class Health {
48
48
  */
49
49
  getPubSub(): Promise<Models.HealthStatus>;
50
50
  /**
51
- * Get billing aggregation queue
51
+ * Get billing project aggregation queue
52
52
  *
53
53
  * @param {number} threshold
54
54
  * @throws {AppwriteException}
55
55
  * @returns {Promise<Models.HealthQueue>}
56
56
  */
57
- getQueueBillingAggregation(threshold?: number): Promise<Models.HealthQueue>;
57
+ getQueueBillingProjectAggregation(threshold?: number): Promise<Models.HealthQueue>;
58
+ /**
59
+ * Get billing team aggregation queue
60
+ *
61
+ * @param {number} threshold
62
+ * @throws {AppwriteException}
63
+ * @returns {Promise<Models.HealthQueue>}
64
+ */
65
+ getQueueBillingTeamAggregation(threshold?: number): Promise<Models.HealthQueue>;
58
66
  /**
59
67
  * Get the number of builds that are waiting to be processed in the Appwrite internal queue server.
60
68
  *
@@ -30,6 +30,17 @@ export declare class Organizations {
30
30
  * @returns {Promise<Models.Organization<Preferences>>}
31
31
  */
32
32
  create<Preferences extends Models.Preferences>(organizationId: string, name: string, billingPlan: BillingPlan, paymentMethodId?: string, billingAddressId?: string, invites?: string[], couponId?: string, taxId?: string, budget?: number): Promise<Models.Organization<Preferences>>;
33
+ /**
34
+ * Get estimation for creating an organization.
35
+ *
36
+ * @param {BillingPlan} billingPlan
37
+ * @param {string} paymentMethodId
38
+ * @param {string[]} invites
39
+ * @param {string} couponId
40
+ * @throws {AppwriteException}
41
+ * @returns {Promise<Models.Estimation>}
42
+ */
43
+ estimationCreateOrganization(billingPlan: BillingPlan, paymentMethodId?: string, invites?: string[], couponId?: string): Promise<Models.Estimation>;
33
44
  /**
34
45
  * Delete an organization.
35
46
  *
@@ -129,6 +140,25 @@ export declare class Organizations {
129
140
  * @returns {Promise<Models.Credit>}
130
141
  */
131
142
  getCredit(organizationId: string, creditId: string): Promise<Models.Credit>;
143
+ /**
144
+ * Get estimation for deleting an organization.
145
+ *
146
+ * @param {string} organizationId
147
+ * @throws {AppwriteException}
148
+ * @returns {Promise<Models.EstimationDeleteOrganization>}
149
+ */
150
+ estimationDeleteOrganization(organizationId: string): Promise<Models.EstimationDeleteOrganization>;
151
+ /**
152
+ * Get estimation for updating the organization plan.
153
+ *
154
+ * @param {string} organizationId
155
+ * @param {BillingPlan} billingPlan
156
+ * @param {string[]} invites
157
+ * @param {string} couponId
158
+ * @throws {AppwriteException}
159
+ * @returns {Promise<Models.EstimationUpdatePlan>}
160
+ */
161
+ estimationUpdatePlan(organizationId: string, billingPlan: BillingPlan, invites?: string[], couponId?: string): Promise<Models.EstimationUpdatePlan>;
132
162
  /**
133
163
  * List all invoices for an organization.
134
164
  *
@@ -251,6 +281,14 @@ export declare class Organizations {
251
281
  * @returns {Promise<Models.Organization<Preferences>>}
252
282
  */
253
283
  updatePlan<Preferences extends Models.Preferences>(organizationId: string, billingPlan: BillingPlan, paymentMethodId?: string, billingAddressId?: string, invites?: string[], couponId?: string, taxId?: string, budget?: number): Promise<Models.Organization<Preferences>>;
284
+ /**
285
+ * Cancel the downgrade initiated for an organization.
286
+ *
287
+ * @param {string} organizationId
288
+ * @throws {AppwriteException}
289
+ * @returns {Promise<Models.Organization<Preferences>>}
290
+ */
291
+ cancelDowngrade<Preferences extends Models.Preferences>(organizationId: string): Promise<Models.Organization<Preferences>>;
254
292
  /**
255
293
  * Get Scopes
256
294
  *
@@ -268,4 +306,23 @@ export declare class Organizations {
268
306
  * @returns {Promise<Models.Organization<Preferences>>}
269
307
  */
270
308
  setBillingTaxId<Preferences extends Models.Preferences>(organizationId: string, taxId: string): Promise<Models.Organization<Preferences>>;
309
+ /**
310
+ * Get the usage data for an organization.
311
+ *
312
+ * @param {string} organizationId
313
+ * @param {string} startDate
314
+ * @param {string} endDate
315
+ * @throws {AppwriteException}
316
+ * @returns {Promise<Models.UsageOrganization>}
317
+ */
318
+ getUsage(organizationId: string, startDate?: string, endDate?: string): Promise<Models.UsageOrganization>;
319
+ /**
320
+ * Validate payment for team after creation or upgrade.
321
+ *
322
+ * @param {string} organizationId
323
+ * @param {string[]} invites
324
+ * @throws {AppwriteException}
325
+ * @returns {Promise<Models.Organization<Preferences>>}
326
+ */
327
+ validatePayment<Preferences extends Models.Preferences>(organizationId: string, invites?: string[]): Promise<Models.Organization<Preferences>>;
271
328
  }
@@ -1,6 +1,7 @@
1
1
  import { Client } from '../client';
2
2
  import type { Models } from '../models';
3
3
  import { StatusCode } from '../enums/status-code';
4
+ import { ProxyResourceType } from '../enums/proxy-resource-type';
4
5
  export declare class Proxy {
5
6
  client: Client;
6
7
  constructor(client: Client);
@@ -37,10 +38,12 @@ export declare class Proxy {
37
38
  * @param {string} domain
38
39
  * @param {string} url
39
40
  * @param {StatusCode} statusCode
41
+ * @param {string} resourceId
42
+ * @param {ProxyResourceType} resourceType
40
43
  * @throws {AppwriteException}
41
44
  * @returns {Promise<Models.ProxyRule>}
42
45
  */
43
- createRedirectRule(domain: string, url: string, statusCode: StatusCode): Promise<Models.ProxyRule>;
46
+ createRedirectRule(domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType): Promise<Models.ProxyRule>;
44
47
  /**
45
48
  * Create a new proxy rule for serving Appwrite Site on custom domain.
46
49
  *
@@ -1,15 +0,0 @@
1
- import { Client, Functions } from "@appwrite.io/console";
2
-
3
- const client = new Client()
4
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
- .setProject('<YOUR_PROJECT_ID>'); // Your project ID
6
-
7
- const functions = new Functions(client);
8
-
9
- const result = await functions.createBuild(
10
- '<FUNCTION_ID>', // functionId
11
- '<DEPLOYMENT_ID>', // deploymentId
12
- '<BUILD_ID>' // buildId (optional)
13
- );
14
-
15
- console.log(result);
@@ -1,14 +0,0 @@
1
- import { Client, Functions, FunctionUsageRange } from "@appwrite.io/console";
2
-
3
- const client = new Client()
4
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
- .setProject('<YOUR_PROJECT_ID>'); // Your project ID
6
-
7
- const functions = new Functions(client);
8
-
9
- const result = await functions.getFunctionUsage(
10
- '<FUNCTION_ID>', // functionId
11
- FunctionUsageRange.TwentyFourHours // range (optional)
12
- );
13
-
14
- console.log(result);
@@ -1,14 +0,0 @@
1
- import { Client, Functions } from "@appwrite.io/console";
2
-
3
- const client = new Client()
4
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
- .setProject('<YOUR_PROJECT_ID>'); // Your project ID
6
-
7
- const functions = new Functions(client);
8
-
9
- const result = await functions.updateDeploymentBuild(
10
- '<FUNCTION_ID>', // functionId
11
- '<DEPLOYMENT_ID>' // deploymentId
12
- );
13
-
14
- console.log(result);
@@ -1,14 +0,0 @@
1
- import { Client, Functions } from "@appwrite.io/console";
2
-
3
- const client = new Client()
4
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
- .setProject('<YOUR_PROJECT_ID>'); // Your project ID
6
-
7
- const functions = new Functions(client);
8
-
9
- const result = await functions.updateDeployment(
10
- '<FUNCTION_ID>', // functionId
11
- '<DEPLOYMENT_ID>' // deploymentId
12
- );
13
-
14
- console.log(result);
@@ -1,15 +0,0 @@
1
- import { Client, Proxy, } from "@appwrite.io/console";
2
-
3
- const client = new Client()
4
- .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5
- .setProject('<YOUR_PROJECT_ID>'); // Your project ID
6
-
7
- const proxy = new Proxy(client);
8
-
9
- const result = await proxy.createRule(
10
- '', // domain
11
- .Api, // resourceType
12
- '<RESOURCE_ID>' // resourceId (optional)
13
- );
14
-
15
- console.log(result);
@@ -1,4 +0,0 @@
1
- export enum ResourceType {
2
- Api = 'api',
3
- Function = 'function',
4
- }
@@ -1,4 +0,0 @@
1
- export declare enum ResourceType {
2
- Api = "api",
3
- Function = "function"
4
- }