-
Notifications
You must be signed in to change notification settings - Fork 8
feat: Console SDK update for version 5.0.0 #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| ```javascript | ||
| import { Client, Domains } from "@appwrite.io/console"; | ||
|
|
||
| const client = new Client() | ||
| .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint | ||
| .setProject('<YOUR_PROJECT_ID>'); // Your project ID | ||
|
|
||
| const domains = new Domains(client); | ||
|
|
||
| const result = await domains.confirmPurchase({ | ||
| domainId: '<DOMAIN_ID>', | ||
| organizationId: '<ORGANIZATION_ID>' | ||
| }); | ||
|
|
||
| console.log(result); | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| ```javascript | ||
| import { Client, Domains } from "@appwrite.io/console"; | ||
|
|
||
| const client = new Client() | ||
| .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint | ||
| .setProject('<YOUR_PROJECT_ID>'); // Your project ID | ||
|
|
||
| const domains = new Domains(client); | ||
|
|
||
| const result = await domains.confirmTransferIn({ | ||
| domainId: '<DOMAIN_ID>', | ||
| organizationId: '<ORGANIZATION_ID>' | ||
| }); | ||
|
|
||
| console.log(result); | ||
| ``` |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -17,6 +17,7 @@ const result = await sites.create({ | |||||||||||||
| timeout: 1, // optional | ||||||||||||||
| installCommand: '<INSTALL_COMMAND>', // optional | ||||||||||||||
| buildCommand: '<BUILD_COMMAND>', // optional | ||||||||||||||
| startCommand: '<START_COMMAND>', // optional | ||||||||||||||
| outputDirectory: '<OUTPUT_DIRECTORY>', // optional | ||||||||||||||
| adapter: Adapter.Static, // optional | ||||||||||||||
| installationId: '<INSTALLATION_ID>', // optional | ||||||||||||||
|
|
@@ -25,7 +26,9 @@ const result = await sites.create({ | |||||||||||||
| providerBranch: '<PROVIDER_BRANCH>', // optional | ||||||||||||||
| providerSilentMode: false, // optional | ||||||||||||||
| providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional | ||||||||||||||
| specification: '' // optional | ||||||||||||||
| buildSpecification: '', // optional | ||||||||||||||
| runtimeSpecification: '', // optional | ||||||||||||||
| deploymentRetention: 0 // optional | ||||||||||||||
|
Comment on lines
+29
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use placeholders or omit these optional fields in the example.
Suggested doc fix- buildSpecification: '', // optional
- runtimeSpecification: '', // optional
- deploymentRetention: 0 // optional
+ // buildSpecification: '<BUILD_SPECIFICATION>', // optional
+ // runtimeSpecification: '<RUNTIME_SPECIFICATION>', // optional
+ // deploymentRetention: <DEPLOYMENT_RETENTION> // optional📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| }); | ||||||||||||||
|
|
||||||||||||||
| console.log(result); | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,7 @@ const result = await sites.update({ | |||||||||||||
| timeout: 1, // optional | ||||||||||||||
| installCommand: '<INSTALL_COMMAND>', // optional | ||||||||||||||
| buildCommand: '<BUILD_COMMAND>', // optional | ||||||||||||||
| startCommand: '<START_COMMAND>', // optional | ||||||||||||||
| outputDirectory: '<OUTPUT_DIRECTORY>', // optional | ||||||||||||||
| buildRuntime: BuildRuntime.Node145, // optional | ||||||||||||||
| adapter: Adapter.Static, // optional | ||||||||||||||
|
|
@@ -25,7 +26,9 @@ const result = await sites.update({ | |||||||||||||
| providerBranch: '<PROVIDER_BRANCH>', // optional | ||||||||||||||
| providerSilentMode: false, // optional | ||||||||||||||
| providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional | ||||||||||||||
| specification: '' // optional | ||||||||||||||
| buildSpecification: '', // optional | ||||||||||||||
| runtimeSpecification: '', // optional | ||||||||||||||
| deploymentRetention: 0 // optional | ||||||||||||||
|
Comment on lines
+29
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the optional update fields copy-paste safe. These literals send actual values. In an update example, that can unintentionally reset spec fields or retention instead of preserving the existing configuration. Suggested doc fix- buildSpecification: '', // optional
- runtimeSpecification: '', // optional
- deploymentRetention: 0 // optional
+ // buildSpecification: '<BUILD_SPECIFICATION>', // optional
+ // runtimeSpecification: '<RUNTIME_SPECIFICATION>', // optional
+ // deploymentRetention: <DEPLOYMENT_RETENTION> // optional📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| }); | ||||||||||||||
|
|
||||||||||||||
| console.log(result); | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -400,7 +400,7 @@ class Client { | |
| 'x-sdk-name': 'Console', | ||
| 'x-sdk-platform': 'console', | ||
| 'x-sdk-language': 'web', | ||
| 'x-sdk-version': '23.0.0', | ||
| 'x-sdk-version': '4.0.0', | ||
| 'X-Appwrite-Response-Format': '1.8.0', | ||
| }; | ||
|
|
||
|
|
@@ -995,6 +995,10 @@ class Client { | |
| window.localStorage.setItem('cookieFallback', cookieFallback); | ||
| } | ||
|
|
||
| if (data && typeof data === 'object') { | ||
| data.toString = () => JSONbig.stringify(data); | ||
| } | ||
|
Comment on lines
+998
to
+1000
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
rg -n -C3 "responseType\s*=\s*'arrayBuffer'|arrayBuffer\(" src
rg -n -C3 "\[key:\s*string\]\s*:\s*any|DocumentList|Document<|type Payload" srcRepository: appwrite/sdk-for-console Length of output: 33400 Limit The current code mutates all object responses—including ArrayBuffers from Suggested fix- if (data && typeof data === 'object') {
- data.toString = () => JSONbig.stringify(data);
+ if (
+ data &&
+ Object.prototype.toString.call(data) === '[object Object]' &&
+ !Object.prototype.hasOwnProperty.call(data, 'toString')
+ ) {
+ Object.defineProperty(data, 'toString', {
+ value() {
+ return JSONbig.stringify(this);
+ },
+ enumerable: false,
+ });
+ }🤖 Prompt for AI Agents |
||
|
|
||
| return data; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| export enum DomainPurchasePaymentStatus { | ||
| Pending = 'pending', | ||
| PendingConfirmation = 'pending_confirmation', | ||
| PendingPaymentProcessing = 'pending_payment_processing', | ||
| Authorized = 'authorized', | ||
| Captured = 'captured', | ||
| Failed = 'failed', | ||
| CaptureFailed = 'capture_failed', | ||
| RenewalCaptureFailed = 'renewal_capture_failed', | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ import { ProxyRuleDeploymentResourceType } from "./enums/proxy-rule-deployment-r | |
| import { ProxyRuleStatus } from "./enums/proxy-rule-status" | ||
| import { MessageStatus } from "./enums/message-status" | ||
| import { BillingPlanGroup } from "./enums/billing-plan-group" | ||
| import { DomainPurchasePaymentStatus } from "./enums/domain-purchase-payment-status" | ||
| import { DomainTransferStatusStatus } from "./enums/domain-transfer-status-status" | ||
|
|
||
| /** | ||
|
|
@@ -3524,6 +3525,10 @@ export namespace Models { | |
| * Site framework. | ||
| */ | ||
| framework: string; | ||
| /** | ||
| * How many days to keep the non-active deployments before they will be automatically deleted. | ||
| */ | ||
| deploymentRetention: number; | ||
| /** | ||
| * Site's active deployment ID. | ||
| */ | ||
|
|
@@ -3568,6 +3573,10 @@ export namespace Models { | |
| * The build command used to build the site. | ||
| */ | ||
| buildCommand: string; | ||
| /** | ||
| * Custom command to use when starting site runtime. | ||
| */ | ||
| startCommand: string; | ||
| /** | ||
| * The directory where the site build output is located. | ||
| */ | ||
|
|
@@ -3593,9 +3602,13 @@ export namespace Models { | |
| */ | ||
| providerSilentMode: boolean; | ||
| /** | ||
| * Machine specification for builds and executions. | ||
| * Machine specification for deployment builds. | ||
| */ | ||
| buildSpecification: string; | ||
| /** | ||
| * Machine specification for SSR executions. | ||
| */ | ||
| specification: string; | ||
| runtimeSpecification: string; | ||
| /** | ||
| * Site build runtime. | ||
| */ | ||
|
|
@@ -3750,6 +3763,10 @@ export namespace Models { | |
| * Function execution and build runtime. | ||
| */ | ||
| runtime: string; | ||
| /** | ||
| * How many days to keep the non-active deployments before they will be automatically deleted. | ||
| */ | ||
| deploymentRetention: number; | ||
| /** | ||
| * Function's active deployment ID. | ||
| */ | ||
|
|
@@ -3823,9 +3840,13 @@ export namespace Models { | |
| */ | ||
| providerSilentMode: boolean; | ||
| /** | ||
| * Machine specification for builds and executions. | ||
| * Machine specification for deployment builds. | ||
| */ | ||
| buildSpecification: string; | ||
| /** | ||
| * Machine specification for executions. | ||
| */ | ||
| specification: string; | ||
| runtimeSpecification: string; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -6136,6 +6157,22 @@ export namespace Models { | |
| * Total aggregated number of image transformations. | ||
| */ | ||
| imageTransformationsTotal: number; | ||
| /** | ||
| * Aggregated number of function executions per period. | ||
| */ | ||
| functionsExecutions: Metric[]; | ||
| /** | ||
| * Total aggregated number of function executions. | ||
| */ | ||
| functionsExecutionsTotal: number; | ||
| /** | ||
| * Aggregated number of site executions per period. | ||
| */ | ||
| sitesExecutions: Metric[]; | ||
| /** | ||
| * Total aggregated number of site executions. | ||
| */ | ||
| sitesExecutionsTotal: number; | ||
|
Comment on lines
+6160
to
+6175
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clarify how Line 6033 still documents 🤖 Prompt for AI Agents |
||
| /** | ||
| * Aggregated stats for total network bandwidth. | ||
| */ | ||
|
|
@@ -6160,6 +6197,30 @@ export namespace Models { | |
| * Total aggregated number of Imagine credits. | ||
| */ | ||
| imagineCreditsTotal: number; | ||
| /** | ||
| * Current aggregated number of open Realtime connections. | ||
| */ | ||
| realtimeConnectionsTotal: number; | ||
| /** | ||
| * Total number of Realtime messages sent to clients. | ||
| */ | ||
| realtimeMessagesTotal: number; | ||
| /** | ||
| * Total consumed Realtime bandwidth (in bytes). | ||
| */ | ||
| realtimeBandwidthTotal: number; | ||
| /** | ||
| * Aggregated number of open Realtime connections per period. | ||
| */ | ||
| realtimeConnections: Metric[]; | ||
| /** | ||
| * Aggregated number of Realtime messages sent to clients per period. | ||
| */ | ||
| realtimeMessages: Metric[]; | ||
| /** | ||
| * Aggregated consumed Realtime bandwidth (in bytes) per period. | ||
| */ | ||
| realtimeBandwidth: Metric[]; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -6890,6 +6951,22 @@ export namespace Models { | |
| * Number of sites to be migrated. | ||
| */ | ||
| site: number; | ||
| /** | ||
| * Number of providers to be migrated. | ||
| */ | ||
| provider: number; | ||
| /** | ||
| * Number of topics to be migrated. | ||
| */ | ||
| topic: number; | ||
| /** | ||
| * Number of subscribers to be migrated. | ||
| */ | ||
| subscriber: number; | ||
| /** | ||
| * Number of messages to be migrated. | ||
| */ | ||
| message: number; | ||
| /** | ||
| * Size of files to be migrated in mb. | ||
| */ | ||
|
|
@@ -8651,7 +8728,11 @@ export namespace Models { | |
| /** | ||
| * Payment status for domain purchase. | ||
| */ | ||
| paymentStatus: string; | ||
| paymentStatus: DomainPurchasePaymentStatus; | ||
| /** | ||
| * Client secret for payment confirmation. Present only when paymentStatus is pending_confirmation. | ||
| */ | ||
| clientSecret: string; | ||
| /** | ||
| * Nameservers setting. "Appwrite" or empty string. | ||
| */ | ||
|
|
@@ -8684,6 +8765,10 @@ export namespace Models { | |
| * Domain transfer status (e.g., "pending", "completed", "failed"). | ||
| */ | ||
| transferStatus: string; | ||
| /** | ||
| * Retry attempts for the current domain payment flow. Development only. | ||
| */ | ||
| attempts: number; | ||
| } | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid destructive literal values in the update example.
For
update,''and0are concrete mutations. A copied example can wipe the current specifications/retention instead of leaving them unchanged.Suggested doc fix
📝 Committable suggestion
🤖 Prompt for AI Agents