feat: SDK update for version 14.0.0#99
Conversation
Greptile SummaryThis PR updates the Console SDK from v13.2.0 to v14.0.0, adding OAuth2 Device Authorization Grant support, new App consent metadata fields, membership
Confidence Score: 3/5Safe to merge for new object-style callers, but the deprecated positional overloads for apps.create, apps.update, and project.updateOAuth2Server will silently misroute arguments for any existing callers who pass optional parameters by position. Three deprecated-but-still-published methods have new optional parameters inserted mid-signature, shifting every subsequent positional argument without any runtime error. A caller passing enabled=true by position to apps.create gets it silently absorbed as description, and type goes to clientUri. Since TypeScript casts are erased at runtime, the SDK sends wrong field values to the server with no warning. src/services/apps.ts and src/services/project.ts — both contain deprecated positional overloads where new parameters were inserted before existing ones. Important Files Changed
|
| const apiHeaders: { [header: string]: string } = { | ||
| 'X-Appwrite-Project': this.client.config.project, | ||
| 'accept': 'application/json', | ||
| } | ||
|
|
||
| return this.client.call( | ||
| 'get', | ||
| uri, | ||
| apiHeaders, | ||
| payload | ||
| ); | ||
| payload['project'] = this.client.config.project; | ||
| payload['impersonateuserid'] = this.client.config.impersonateuserid; | ||
|
|
||
| for (const [key, value] of Object.entries(Service.flatten(payload))) { | ||
| uri.searchParams.append(key, value); | ||
| } | ||
|
|
||
| return uri.toString(); |
There was a problem hiding this comment.
Dead
apiHeaders in URL-builder methods
getInvoiceDownload (and identically getInvoiceView) now builds and returns a URL string rather than making an HTTP call, so the apiHeaders object (including the 'accept': 'application/json' entry) is assigned but never consumed. The variable can be removed entirely.
| updateOAuth2Server(params: { enabled: boolean, authorizationUrl: string, scopes?: string[], authorizationDetailsTypes?: string[], accessTokenDuration?: number, refreshTokenDuration?: number, publicAccessTokenDuration?: number, publicRefreshTokenDuration?: number, confidentialPkce?: boolean, verificationUrl?: string, userCodeLength?: number, userCodeFormat?: string, deviceCodeDuration?: number }): Promise<Models.Project>; | ||
| /** | ||
| * Update the OAuth2 server (OIDC provider) configuration. | ||
| * | ||
| * @param {boolean} enabled - Enable or disable the OAuth2 server. | ||
| * @param {string} authorizationUrl - URL to your application with consent screen. | ||
| * @param {string[]} scopes - List of allowed OAuth2 scopes. Maximum of 100 scopes are allowed, each up to 128 characters long. | ||
| * @param {string[]} authorizationDetailsTypes - List of accepted `authorization_details` types. Maximum of 100 types are allowed, each up to 128 characters long. | ||
| * @param {number} accessTokenDuration - Access token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 8 hours. | ||
| * @param {number} refreshTokenDuration - Refresh token duration in seconds for confidential clients (server-side apps that authenticate with a client secret). Leave empty to use default 1 year. | ||
| * @param {number} publicAccessTokenDuration - Access token duration in seconds for public clients (SPAs, mobile, and native apps that cannot keep a client secret). Leave empty to use default 1 hour. |
There was a problem hiding this comment.
Positional overload breaks existing callers of
updateOAuth2Server
The new authorizationDetailsTypes: string[] parameter is inserted at position 3 in the deprecated positional overload, shifting every subsequent argument by one slot. A caller who previously passed updateOAuth2Server(true, url, ['scope'], 28800 /* accessTokenDuration */) will now have 28800 received as authorizationDetailsTypes and accessTokenDuration left undefined. The value is silently accepted as a valid string[] cast at runtime since TypeScript casts are erased, so no runtime error occurs and the wrong config is sent to the server.
This PR contains updates to the SDK for version 14.0.0.
What's Changed
getDatabaseMetrics,getDatabaseInsights,getDatabaseSchema, andcreateDatabaseSchemaPreviewfromComputeserviceregionandtypeparameters fromcreateDatabaseonComputeservicehighAvailabilityandhighAvailabilityReplicaCountwithreplicasoncreateDatabaseandupdateDatabasetype,region, andhighAvailabilityfields fromDedicatedDatabasemodelDedicatedDatabaseMetrics,DedicatedDatabaseSchema,DedicatedDatabaseSchemaPreview, and performance insights modelsActivityEventmodelinternalparameter and field fromAppsservice andAppmodelgetInvoiceDownloadandgetInvoiceViewonOrganizationsnow return a URL stringdefaultas number arrays instead ofany[]deviceFlowon apps and device code settings onupdateOAuth2ServerAppsservice (description,clientUri,logoUri,privacyPolicyUrl,termsUrl,contacts)authorizationDetailsTypesparameter onupdateOAuth2Serverfor RFC 9396 supportdedicatedDatabaseIdparameter oncreateforTablesDB,DocumentsDB, andVectorsDBapiparameter oncreateDatabaseandDedicatedDatabasesExecutekey scopeuserAccessedAtmembership privacy setting and field onMembershipmodelUsermodel (emailCanonical,emailIsFree,emailIsDisposable,emailIsCorporate,emailIsCanonical)Branchmodel and TCP connection fields on dedicated database connection modeltypefield on backup policies for full or incremental backupshintfield on app secret models for identifying secretsacceptheader