diff --git a/CHANGELOG.md b/CHANGELOG.md index 39677471..f79a0ae2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Change Log +## 30.0.0-rc.2 + +* Added: OAuth2 provider `prompt` enums (`OAuth2Auth0Prompt`, `OAuth2GithubPrompt`, and project variants) +* Added: `Topic` and `ResolvedTopic` exports +* Added: `Models.Account` and `Models.OAuth2Webflow` types +* Added: `Webflow` to the `OAuthProvider` and `ProjectOAuthProviderId` enums +* Added: `avatars.updatePhoto()` and `avatars.deletePhoto()` methods +* Added: optional `total` param on locale and list endpoints; `duration` on email-password sessions +* Updated: `chunkedUpload` supports a `text` responseType and falls back without a file +* Updated: several model fields relaxed to optional; `RestorationStatus.options` is now an object + ## 30.0.0 * Breaking: `account.listLogs`, `users.listLogs`, `Log` and `LogList` removed diff --git a/README.md b/README.md index 7f9e1f1b..900e4e23 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK targets Appwrite server version latest as shipped on Appwrite Cloud.** Self-hosted releases can lag behind Cloud — if you run an older self-hosted build, use a matching older SDK from [previous releases](https://github.com/appwrite/sdk-for-node/releases) when APIs differ. +**This SDK targets Appwrite server version 2.3.x as shipped on Appwrite Cloud.** Self-hosted releases can lag behind Cloud — if you run an older self-hosted build, use a matching older SDK from [previous releases](https://github.com/appwrite/sdk-for-node/releases) when APIs differ. > This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code. If you're looking to integrate from the browser, you should check [appwrite/sdk-for-web](https://github.com/appwrite/sdk-for-web) diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index fcc1ff18..f6ce44a1 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -11,5 +11,6 @@ const account = new sdk.Account(client); const result = await account.createEmailPasswordSession({ email: 'email@example.com', password: 'password', + duration: 60, // optional }); ``` diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index 912575ce..d65f323d 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -8,5 +8,7 @@ const client = new sdk.Client() const account = new sdk.Account(client); -const result = await account.deleteSessions(); +const result = await account.deleteSessions({ + current: false, // optional +}); ``` diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index 0bbd093e..a2d09601 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -8,5 +8,7 @@ const client = new sdk.Client() const account = new sdk.Account(client); -const result = await account.listSessions(); +const result = await account.listSessions({ + total: false, // optional +}); ``` diff --git a/docs/examples/avatars/delete-photo.md b/docs/examples/avatars/delete-photo.md new file mode 100644 index 00000000..7f36a1c3 --- /dev/null +++ b/docs/examples/avatars/delete-photo.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.deletePhoto(); +``` diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index 708db1ca..737bfcfc 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -11,8 +11,7 @@ const avatars = new sdk.Avatars(client); const result = await avatars.getScreenshot({ url: 'https://example.com', headers: { - Authorization: 'Bearer token123', - 'X-Custom-Header': 'value', + 'Accept-Language': 'en-US,en;q=0.9', }, // optional viewportWidth: 1920, // optional viewportHeight: 1080, // optional diff --git a/docs/examples/avatars/update-photo.md b/docs/examples/avatars/update-photo.md new file mode 100644 index 00000000..4e100e19 --- /dev/null +++ b/docs/examples/avatars/update-photo.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); +const { InputFile } = require('node-appwrite/file'); + +const client = new sdk.Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.updatePhoto({ + file: InputFile.fromPath('/path/to/file', 'filename'), +}); +``` diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md index 29f12043..71f797c9 100644 --- a/docs/examples/databases/create-documents.md +++ b/docs/examples/databases/create-documents.md @@ -11,7 +11,16 @@ const databases = new sdk.Databases(client); const result = await databases.createDocuments({ databaseId: '', collectionId: '', - documents: [], + documents: [ + { + $id: 'example1', + username: 'walter.obrien', + email: 'walter.obrien@example.com', + fullName: "Walter O'Brien", + age: 30, + isAdmin: false, + }, + ], transactionId: '', // optional }); ``` diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index 095bd46a..ae243785 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -13,7 +13,7 @@ const result = await databases.createIndex({ collectionId: '', key: '', type: sdk.DatabasesIndexType.Key, - attributes: [], + attributes: ['username'], orders: [sdk.OrderBy.Asc], // optional lengths: [], // optional }); diff --git a/docs/examples/databases/delete-documents.md b/docs/examples/databases/delete-documents.md index 682c0e7b..11e6437f 100644 --- a/docs/examples/databases/delete-documents.md +++ b/docs/examples/databases/delete-documents.md @@ -11,7 +11,9 @@ const databases = new sdk.Databases(client); const result = await databases.deleteDocuments({ databaseId: '', collectionId: '', - queries: [], // optional + queries: [ + '{"method":"equal", "attribute":"$id", "values":[""]}', + ], // optional transactionId: '', // optional }); ``` diff --git a/docs/examples/databases/list-transactions.md b/docs/examples/databases/list-transactions.md index c3356828..2accdeaf 100644 --- a/docs/examples/databases/list-transactions.md +++ b/docs/examples/databases/list-transactions.md @@ -10,5 +10,6 @@ const databases = new sdk.Databases(client); const result = await databases.listTransactions({ queries: [], // optional + total: false, // optional }); ``` diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index aa253547..b7054cbd 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -11,7 +11,16 @@ const databases = new sdk.Databases(client); const result = await databases.upsertDocuments({ databaseId: '', collectionId: '', - documents: [], + documents: [ + { + $id: 'example1', + username: 'walter.obrien', + email: 'walter.obrien@example.com', + fullName: "Walter O'Brien", + age: 30, + isAdmin: false, + }, + ], transactionId: '', // optional }); ``` diff --git a/docs/examples/documentsdb/create-documents.md b/docs/examples/documentsdb/create-documents.md index 298af8c6..d3d64597 100644 --- a/docs/examples/documentsdb/create-documents.md +++ b/docs/examples/documentsdb/create-documents.md @@ -11,7 +11,16 @@ const documentsDB = new sdk.DocumentsDB(client); const result = await documentsDB.createDocuments({ databaseId: '', collectionId: '', - documents: [], + documents: [ + { + $id: 'example1', + username: 'walter.obrien', + email: 'walter.obrien@example.com', + fullName: "Walter O'Brien", + age: 30, + isAdmin: false, + }, + ], transactionId: '', // optional }); ``` diff --git a/docs/examples/documentsdb/create-index.md b/docs/examples/documentsdb/create-index.md index 72e4669c..40035ead 100644 --- a/docs/examples/documentsdb/create-index.md +++ b/docs/examples/documentsdb/create-index.md @@ -13,7 +13,7 @@ const result = await documentsDB.createIndex({ collectionId: '', key: '', type: sdk.DocumentsDBIndexType.Key, - attributes: [], + attributes: ['username'], orders: [sdk.OrderBy.Asc], // optional lengths: [], // optional }); diff --git a/docs/examples/documentsdb/delete-documents.md b/docs/examples/documentsdb/delete-documents.md index 9bb214ee..97415eb4 100644 --- a/docs/examples/documentsdb/delete-documents.md +++ b/docs/examples/documentsdb/delete-documents.md @@ -11,7 +11,9 @@ const documentsDB = new sdk.DocumentsDB(client); const result = await documentsDB.deleteDocuments({ databaseId: '', collectionId: '', - queries: [], // optional + queries: [ + '{"method":"equal", "attribute":"$id", "values":[""]}', + ], // optional transactionId: '', // optional }); ``` diff --git a/docs/examples/documentsdb/list-transactions.md b/docs/examples/documentsdb/list-transactions.md index 8bc66d4b..8ea781a1 100644 --- a/docs/examples/documentsdb/list-transactions.md +++ b/docs/examples/documentsdb/list-transactions.md @@ -10,5 +10,6 @@ const documentsDB = new sdk.DocumentsDB(client); const result = await documentsDB.listTransactions({ queries: [], // optional + total: false, // optional }); ``` diff --git a/docs/examples/documentsdb/upsert-documents.md b/docs/examples/documentsdb/upsert-documents.md index 23b52200..ba03ebe6 100644 --- a/docs/examples/documentsdb/upsert-documents.md +++ b/docs/examples/documentsdb/upsert-documents.md @@ -11,7 +11,16 @@ const documentsDB = new sdk.DocumentsDB(client); const result = await documentsDB.upsertDocuments({ databaseId: '', collectionId: '', - documents: [], + documents: [ + { + $id: 'example1', + username: 'walter.obrien', + email: 'walter.obrien@example.com', + fullName: "Walter O'Brien", + age: 30, + isAdmin: false, + }, + ], transactionId: '', // optional }); ``` diff --git a/docs/examples/embeddings/create-text-embeddings.md b/docs/examples/embeddings/create-text-embeddings.md index 537a4402..68fdb1d9 100644 --- a/docs/examples/embeddings/create-text-embeddings.md +++ b/docs/examples/embeddings/create-text-embeddings.md @@ -9,7 +9,10 @@ const client = new sdk.Client() const embeddings = new sdk.Embeddings(client); const result = await embeddings.createTextEmbeddings({ - texts: [], + texts: [ + 'Appwrite helps developers build applications.', + 'Find documents with semantic search.', + ], model: sdk.EmbeddingModel.NomicEmbedText, // optional }); ``` diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index 0a4baff1..d042d712 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -1,6 +1,6 @@ ```javascript const sdk = require('node-appwrite'); -const fs = require('fs'); +const { InputFile } = require('node-appwrite/file'); const client = new sdk.Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md index fdaefd3a..4989aef0 100644 --- a/docs/examples/functions/list-runtimes.md +++ b/docs/examples/functions/list-runtimes.md @@ -8,5 +8,7 @@ const client = new sdk.Client() const functions = new sdk.Functions(client); -const result = await functions.listRuntimes(); +const result = await functions.listRuntimes({ + total: false, // optional +}); ``` diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md index f779206d..f2205c09 100644 --- a/docs/examples/functions/list-specifications.md +++ b/docs/examples/functions/list-specifications.md @@ -10,5 +10,6 @@ const functions = new sdk.Functions(client); const result = await functions.listSpecifications({ type: 'runtimes', // optional + total: false, // optional }); ``` diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index cb60aa52..31f0b604 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -9,6 +9,8 @@ const client = new sdk.Client() const graphql = new sdk.Graphql(client); const result = await graphql.mutation({ - query: {}, + query: { + query: 'mutation { accountUpdateName(name: "Walter") { name } }', + }, }); ``` diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index 86ba6962..c6861053 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -9,6 +9,8 @@ const client = new sdk.Client() const graphql = new sdk.Graphql(client); const result = await graphql.query({ - query: {}, + query: { + query: 'query { localeGet { ip } }', + }, }); ``` diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index 136992f4..0d173beb 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -8,5 +8,7 @@ const client = new sdk.Client() const locale = new sdk.Locale(client); -const result = await locale.listCodes(); +const result = await locale.listCodes({ + total: false, // optional +}); ``` diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index aa58ec57..13a33454 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -8,5 +8,7 @@ const client = new sdk.Client() const locale = new sdk.Locale(client); -const result = await locale.listContinents(); +const result = await locale.listContinents({ + total: false, // optional +}); ``` diff --git a/docs/examples/locale/list-countries-eu.md b/docs/examples/locale/list-countries-eu.md index 538b4927..dbd873c4 100644 --- a/docs/examples/locale/list-countries-eu.md +++ b/docs/examples/locale/list-countries-eu.md @@ -8,5 +8,7 @@ const client = new sdk.Client() const locale = new sdk.Locale(client); -const result = await locale.listCountriesEU(); +const result = await locale.listCountriesEU({ + total: false, // optional +}); ``` diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index c2701418..dee00d08 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -8,5 +8,7 @@ const client = new sdk.Client() const locale = new sdk.Locale(client); -const result = await locale.listCountriesPhones(); +const result = await locale.listCountriesPhones({ + total: false, // optional +}); ``` diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index 99ee2d35..0b2bd5b8 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -8,5 +8,7 @@ const client = new sdk.Client() const locale = new sdk.Locale(client); -const result = await locale.listCountries(); +const result = await locale.listCountries({ + total: false, // optional +}); ``` diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index c381774d..07ae165a 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -8,5 +8,7 @@ const client = new sdk.Client() const locale = new sdk.Locale(client); -const result = await locale.listCurrencies(); +const result = await locale.listCurrencies({ + total: false, // optional +}); ``` diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index cfd522c6..9f48ffb4 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -8,5 +8,7 @@ const client = new sdk.Client() const locale = new sdk.Locale(client); -const result = await locale.listLanguages(); +const result = await locale.listLanguages({ + total: false, // optional +}); ``` diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index 6e2fd140..46436b33 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -28,5 +28,6 @@ const result = await messaging.createPush({ contentAvailable: false, // optional critical: false, // optional priority: sdk.MessagePriority.Normal, // optional + channelId: '', // optional }); ``` diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index 426641c7..04e86f76 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -10,18 +10,18 @@ const messaging = new sdk.Messaging(client); const result = await messaging.updateEmail({ messageId: '', + subject: '', // optional + content: '', // optional topics: [], // optional users: [], // optional targets: [], // optional - subject: '', // optional - content: '', // optional - draft: false, // optional - html: false, // optional cc: [], // optional bcc: [], // optional + attachments: [], // optional replyToEmail: 'email@example.com', // optional replyToName: '', // optional + draft: false, // optional + html: false, // optional scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional - attachments: [], // optional }); ``` diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index cf8f6f1b..d62e3468 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -10,11 +10,11 @@ const messaging = new sdk.Messaging(client); const result = await messaging.updatePush({ messageId: '', + title: '', // optional + body: '<BODY>', // optional topics: [], // optional users: [], // optional targets: [], // optional - title: '<TITLE>', // optional - body: '<BODY>', // optional data: {}, // optional action: '<ACTION>', // optional image: '<ID1:ID2>', // optional @@ -28,5 +28,6 @@ const result = await messaging.updatePush({ contentAvailable: false, // optional critical: false, // optional priority: sdk.MessagePriority.Normal, // optional + channelId: '<CHANNEL_ID>', // optional }); ``` diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md index 940474a4..7c95f4fc 100644 --- a/docs/examples/messaging/update-sms.md +++ b/docs/examples/messaging/update-sms.md @@ -10,10 +10,10 @@ const messaging = new sdk.Messaging(client); const result = await messaging.updateSMS({ messageId: '<MESSAGE_ID>', + content: '<CONTENT>', // optional topics: [], // optional users: [], // optional targets: [], // optional - content: '<CONTENT>', // optional draft: false, // optional scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional }); diff --git a/docs/examples/organization/create-ephemeral-project-key.md b/docs/examples/organization/create-ephemeral-project-key.md index a2801e67..cf080c77 100644 --- a/docs/examples/organization/create-ephemeral-project-key.md +++ b/docs/examples/organization/create-ephemeral-project-key.md @@ -10,7 +10,7 @@ const organization = new sdk.Organization(client); const result = await organization.createEphemeralProjectKey({ projectId: '<PROJECT_ID>', - scopes: [sdk.ProjectKeyScopes.ProjectRead], + scopes: [sdk.ProjectKeyScopes.UsersRead], duration: 600, }); ``` diff --git a/docs/examples/organization/update-project-key.md b/docs/examples/organization/update-project-key.md index 17d19c4f..07440b6e 100644 --- a/docs/examples/organization/update-project-key.md +++ b/docs/examples/organization/update-project-key.md @@ -12,7 +12,7 @@ const result = await organization.updateProjectKey({ projectId: '<PROJECT_ID>', keyId: '<KEY_ID>', name: '<NAME>', - scopes: [sdk.ProjectKeyScopes.ProjectRead], + scopes: [sdk.ProjectKeyScopes.UsersRead], expire: '2020-10-15T06:38:00.000+00:00', // optional }); ``` diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md index 352c6316..9b40232e 100644 --- a/docs/examples/project/create-ephemeral-key.md +++ b/docs/examples/project/create-ephemeral-key.md @@ -9,7 +9,7 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.createEphemeralKey({ - scopes: [sdk.ProjectKeyScopes.ProjectRead], + scopes: [sdk.ProjectKeyScopes.UsersRead], duration: 600, }); ``` diff --git a/docs/examples/project/create-smtp-test.md b/docs/examples/project/create-smtp-test.md index 0246650b..162f1381 100644 --- a/docs/examples/project/create-smtp-test.md +++ b/docs/examples/project/create-smtp-test.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.createSMTPTest({ - emails: [], + emails: ['recipient@example.com'], }); ``` diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md index 0505a54f..81c77a73 100644 --- a/docs/examples/project/update-key.md +++ b/docs/examples/project/update-key.md @@ -11,7 +11,7 @@ const project = new sdk.Project(client); const result = await project.updateKey({ keyId: '<KEY_ID>', name: '<NAME>', - scopes: [sdk.ProjectKeyScopes.ProjectRead], + scopes: [sdk.ProjectKeyScopes.UsersRead], expire: '2020-10-15T06:38:00.000+00:00', // optional }); ``` diff --git a/docs/examples/project/update-labels.md b/docs/examples/project/update-labels.md index 1d58ef1c..e594576d 100644 --- a/docs/examples/project/update-labels.md +++ b/docs/examples/project/update-labels.md @@ -9,6 +9,6 @@ const client = new sdk.Client() const project = new sdk.Project(client); const result = await project.updateLabels({ - labels: [], + labels: ['production'], }); ``` diff --git a/docs/examples/project/update-o-auth-2-auth-0.md b/docs/examples/project/update-o-auth-2-auth-0.md index d23fb2c5..61fb73c0 100644 --- a/docs/examples/project/update-o-auth-2-auth-0.md +++ b/docs/examples/project/update-o-auth-2-auth-0.md @@ -12,6 +12,7 @@ const result = await project.updateOAuth2Auth0({ clientId: '<CLIENT_ID>', // optional clientSecret: '<CLIENT_SECRET>', // optional endpoint: '<ENDPOINT>', // optional + prompt: [sdk.ProjectOAuth2Auth0Prompt.None], // optional enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-discord.md b/docs/examples/project/update-o-auth-2-discord.md index 151b93c1..d76ac95a 100644 --- a/docs/examples/project/update-o-auth-2-discord.md +++ b/docs/examples/project/update-o-auth-2-discord.md @@ -11,6 +11,7 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Discord({ clientId: '<CLIENT_ID>', // optional clientSecret: '<CLIENT_SECRET>', // optional + prompt: [sdk.ProjectOAuth2DiscordPrompt.None], // optional enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-git-hub.md b/docs/examples/project/update-o-auth-2-git-hub.md index 0a7a757d..cb497dbe 100644 --- a/docs/examples/project/update-o-auth-2-git-hub.md +++ b/docs/examples/project/update-o-auth-2-git-hub.md @@ -11,6 +11,7 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2GitHub({ clientId: '<CLIENT_ID>', // optional clientSecret: '<CLIENT_SECRET>', // optional + prompt: [sdk.ProjectOAuth2GitHubPrompt.SelectAccount], // optional enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-kakao.md b/docs/examples/project/update-o-auth-2-kakao.md index 1a26ea6a..cb310ae3 100644 --- a/docs/examples/project/update-o-auth-2-kakao.md +++ b/docs/examples/project/update-o-auth-2-kakao.md @@ -11,6 +11,7 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Kakao({ clientId: '<CLIENT_ID>', // optional clientSecret: '<CLIENT_SECRET>', // optional + prompt: [sdk.ProjectOAuth2KakaoPrompt.None], // optional enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-microsoft.md b/docs/examples/project/update-o-auth-2-microsoft.md index 29e18697..7a7edb20 100644 --- a/docs/examples/project/update-o-auth-2-microsoft.md +++ b/docs/examples/project/update-o-auth-2-microsoft.md @@ -12,6 +12,7 @@ const result = await project.updateOAuth2Microsoft({ applicationId: '<APPLICATION_ID>', // optional applicationSecret: '<APPLICATION_SECRET>', // optional tenant: '<TENANT>', // optional + prompt: [sdk.ProjectOAuth2MicrosoftPrompt.None], // optional enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-okta.md b/docs/examples/project/update-o-auth-2-okta.md index 519f0265..4b6deba1 100644 --- a/docs/examples/project/update-o-auth-2-okta.md +++ b/docs/examples/project/update-o-auth-2-okta.md @@ -13,6 +13,7 @@ const result = await project.updateOAuth2Okta({ clientSecret: '<CLIENT_SECRET>', // optional domain: 'example.com', // optional authorizationServerId: '<AUTHORIZATION_SERVER_ID>', // optional + prompt: [sdk.ProjectOAuth2OktaPrompt.None], // optional enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-salesforce.md b/docs/examples/project/update-o-auth-2-salesforce.md index 642249f1..12698d04 100644 --- a/docs/examples/project/update-o-auth-2-salesforce.md +++ b/docs/examples/project/update-o-auth-2-salesforce.md @@ -11,6 +11,7 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Salesforce({ customerKey: '<CUSTOMER_KEY>', // optional customerSecret: '<CUSTOMER_SECRET>', // optional + prompt: [sdk.ProjectOAuth2SalesforcePrompt.Login], // optional enabled: false, // optional }); ``` diff --git a/docs/examples/project/update-o-auth-2-webflow.md b/docs/examples/project/update-o-auth-2-webflow.md new file mode 100644 index 00000000..daf2e307 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-webflow.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Webflow({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false, // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-zoho.md b/docs/examples/project/update-o-auth-2-zoho.md index 8b623cd8..baa7bc81 100644 --- a/docs/examples/project/update-o-auth-2-zoho.md +++ b/docs/examples/project/update-o-auth-2-zoho.md @@ -11,6 +11,7 @@ const project = new sdk.Project(client); const result = await project.updateOAuth2Zoho({ clientId: '<CLIENT_ID>', // optional clientSecret: '<CLIENT_SECRET>', // optional + prompt: [sdk.ProjectOAuth2ZohoPrompt.Consent], // optional enabled: false, // optional }); ``` diff --git a/docs/examples/sites/create-deployment.md b/docs/examples/sites/create-deployment.md index a07dedee..d6cee98a 100644 --- a/docs/examples/sites/create-deployment.md +++ b/docs/examples/sites/create-deployment.md @@ -1,6 +1,6 @@ ```javascript const sdk = require('node-appwrite'); -const fs = require('fs'); +const { InputFile } = require('node-appwrite/file'); const client = new sdk.Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint diff --git a/docs/examples/sites/list-frameworks.md b/docs/examples/sites/list-frameworks.md index 9a417bfd..774d280f 100644 --- a/docs/examples/sites/list-frameworks.md +++ b/docs/examples/sites/list-frameworks.md @@ -8,5 +8,7 @@ const client = new sdk.Client() const sites = new sdk.Sites(client); -const result = await sites.listFrameworks(); +const result = await sites.listFrameworks({ + total: false, // optional +}); ``` diff --git a/docs/examples/sites/list-specifications.md b/docs/examples/sites/list-specifications.md index 85a1a84f..87575708 100644 --- a/docs/examples/sites/list-specifications.md +++ b/docs/examples/sites/list-specifications.md @@ -10,5 +10,6 @@ const sites = new sdk.Sites(client); const result = await sites.listSpecifications({ type: 'runtimes', // optional + total: false, // optional }); ``` diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index d69727e1..429b6bb0 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -1,6 +1,6 @@ ```javascript const sdk = require('node-appwrite'); -const fs = require('fs'); +const { InputFile } = require('node-appwrite/file'); const client = new sdk.Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md index 2bd4818e..5a909438 100644 --- a/docs/examples/tablesdb/create-index.md +++ b/docs/examples/tablesdb/create-index.md @@ -13,7 +13,7 @@ const result = await tablesDB.createIndex({ tableId: '<TABLE_ID>', key: '<KEY>', type: sdk.TablesDBIndexType.Key, - columns: [], + columns: ['username'], orders: [sdk.OrderBy.Asc], // optional lengths: [], // optional }); diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md index af17e879..c7448b8d 100644 --- a/docs/examples/tablesdb/create-rows.md +++ b/docs/examples/tablesdb/create-rows.md @@ -11,7 +11,16 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.createRows({ databaseId: '<DATABASE_ID>', tableId: '<TABLE_ID>', - rows: [], + rows: [ + { + $id: 'example1', + username: 'walter.obrien', + email: 'walter.obrien@example.com', + fullName: "Walter O'Brien", + age: 30, + isAdmin: false, + }, + ], transactionId: '<TRANSACTION_ID>', // optional }); ``` diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md index ccc97155..a79b7882 100644 --- a/docs/examples/tablesdb/delete-rows.md +++ b/docs/examples/tablesdb/delete-rows.md @@ -11,7 +11,7 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.deleteRows({ databaseId: '<DATABASE_ID>', tableId: '<TABLE_ID>', - queries: [], // optional + queries: ['{"method":"equal", "attribute":"$id", "values":["<ROW_ID>"]}'], // optional transactionId: '<TRANSACTION_ID>', // optional }); ``` diff --git a/docs/examples/tablesdb/list-transactions.md b/docs/examples/tablesdb/list-transactions.md index 51a3fc45..9a3778bd 100644 --- a/docs/examples/tablesdb/list-transactions.md +++ b/docs/examples/tablesdb/list-transactions.md @@ -10,5 +10,6 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.listTransactions({ queries: [], // optional + total: false, // optional }); ``` diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md index fea4cbcb..f04859fd 100644 --- a/docs/examples/tablesdb/upsert-rows.md +++ b/docs/examples/tablesdb/upsert-rows.md @@ -11,7 +11,16 @@ const tablesDB = new sdk.TablesDB(client); const result = await tablesDB.upsertRows({ databaseId: '<DATABASE_ID>', tableId: '<TABLE_ID>', - rows: [], + rows: [ + { + $id: 'example1', + username: 'walter.obrien', + email: 'walter.obrien@example.com', + fullName: "Walter O'Brien", + age: 30, + isAdmin: false, + }, + ], transactionId: '<TRANSACTION_ID>', // optional }); ``` diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 3aa45e3b..47773fb5 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -10,7 +10,7 @@ const teams = new sdk.Teams(client); const result = await teams.createMembership({ teamId: '<TEAM_ID>', - roles: [], + roles: ['editor'], email: 'email@example.com', // optional userId: '<USER_ID>', // optional phone: '+12065550100', // optional diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index 7b6fe57f..07a3e2b3 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -11,6 +11,6 @@ const teams = new sdk.Teams(client); const result = await teams.updateMembership({ teamId: '<TEAM_ID>', membershipId: '<MEMBERSHIP_ID>', - roles: [], + roles: ['editor'], }); ``` diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md index e74ec102..4dbc44d9 100644 --- a/docs/examples/users/update-labels.md +++ b/docs/examples/users/update-labels.md @@ -10,6 +10,6 @@ const users = new sdk.Users(client); const result = await users.updateLabels({ userId: '<USER_ID>', - labels: [], + labels: ['subscriber'], }); ``` diff --git a/docs/examples/vectorsdb/create-collection.md b/docs/examples/vectorsdb/create-collection.md index d7ccf535..fa1be7a7 100644 --- a/docs/examples/vectorsdb/create-collection.md +++ b/docs/examples/vectorsdb/create-collection.md @@ -12,7 +12,7 @@ const result = await vectorsDB.createCollection({ databaseId: '<DATABASE_ID>', collectionId: '<COLLECTION_ID>', name: '<NAME>', - dimension: 1, + dimension: 4, permissions: [sdk.Permission.read(sdk.Role.any())], // optional documentSecurity: false, // optional enabled: false, // optional diff --git a/docs/examples/vectorsdb/create-documents.md b/docs/examples/vectorsdb/create-documents.md index bcaedd48..3e764a3e 100644 --- a/docs/examples/vectorsdb/create-documents.md +++ b/docs/examples/vectorsdb/create-documents.md @@ -11,7 +11,15 @@ const vectorsDB = new sdk.VectorsDB(client); const result = await vectorsDB.createDocuments({ databaseId: '<DATABASE_ID>', collectionId: '<COLLECTION_ID>', - documents: [], + documents: [ + { + $id: 'example1', + embeddings: [0.12, -0.55, 0.88, 1.02], + metadata: { + name: 'First document', + }, + }, + ], transactionId: '<TRANSACTION_ID>', // optional }); ``` diff --git a/docs/examples/vectorsdb/create-index.md b/docs/examples/vectorsdb/create-index.md index 4b092220..583faeec 100644 --- a/docs/examples/vectorsdb/create-index.md +++ b/docs/examples/vectorsdb/create-index.md @@ -13,7 +13,7 @@ const result = await vectorsDB.createIndex({ collectionId: '<COLLECTION_ID>', key: '<KEY>', type: sdk.VectorsDBIndexType.HnswEuclidean, - attributes: [], + attributes: ['embeddings'], orders: [sdk.OrderBy.Asc], // optional lengths: [], // optional }); diff --git a/docs/examples/vectorsdb/create-operations.md b/docs/examples/vectorsdb/create-operations.md index 3804aeed..56f2ef2e 100644 --- a/docs/examples/vectorsdb/create-operations.md +++ b/docs/examples/vectorsdb/create-operations.md @@ -17,7 +17,10 @@ const result = await vectorsDB.createOperations({ collectionId: '<COLLECTION_ID>', documentId: '<DOCUMENT_ID>', data: { - name: "Walter O'Brien", + embeddings: [0.12, -0.55, 0.88, 1.02], + metadata: { + name: 'First document', + }, }, }, ], // optional diff --git a/docs/examples/vectorsdb/delete-documents.md b/docs/examples/vectorsdb/delete-documents.md index a3905b37..2aae8cd5 100644 --- a/docs/examples/vectorsdb/delete-documents.md +++ b/docs/examples/vectorsdb/delete-documents.md @@ -11,7 +11,9 @@ const vectorsDB = new sdk.VectorsDB(client); const result = await vectorsDB.deleteDocuments({ databaseId: '<DATABASE_ID>', collectionId: '<COLLECTION_ID>', - queries: [], // optional + queries: [ + '{"method":"equal", "attribute":"$id", "values":["<DOCUMENT_ID>"]}', + ], // optional transactionId: '<TRANSACTION_ID>', // optional }); ``` diff --git a/docs/examples/vectorsdb/list-transactions.md b/docs/examples/vectorsdb/list-transactions.md index 3dfb2732..330f8eec 100644 --- a/docs/examples/vectorsdb/list-transactions.md +++ b/docs/examples/vectorsdb/list-transactions.md @@ -10,5 +10,6 @@ const vectorsDB = new sdk.VectorsDB(client); const result = await vectorsDB.listTransactions({ queries: [], // optional + total: false, // optional }); ``` diff --git a/docs/examples/vectorsdb/update-collection.md b/docs/examples/vectorsdb/update-collection.md index 4f546542..f1ca760b 100644 --- a/docs/examples/vectorsdb/update-collection.md +++ b/docs/examples/vectorsdb/update-collection.md @@ -12,7 +12,7 @@ const result = await vectorsDB.updateCollection({ databaseId: '<DATABASE_ID>', collectionId: '<COLLECTION_ID>', name: '<NAME>', - dimension: 1, // optional + dimension: 4, // optional permissions: [sdk.Permission.read(sdk.Role.any())], // optional documentSecurity: false, // optional enabled: false, // optional diff --git a/docs/examples/vectorsdb/upsert-documents.md b/docs/examples/vectorsdb/upsert-documents.md index 38079b97..eafbe97e 100644 --- a/docs/examples/vectorsdb/upsert-documents.md +++ b/docs/examples/vectorsdb/upsert-documents.md @@ -11,7 +11,15 @@ const vectorsDB = new sdk.VectorsDB(client); const result = await vectorsDB.upsertDocuments({ databaseId: '<DATABASE_ID>', collectionId: '<COLLECTION_ID>', - documents: [], + documents: [ + { + $id: 'example1', + embeddings: [0.12, -0.55, 0.88, 1.02], + metadata: { + name: 'First document', + }, + }, + ], transactionId: '<TRANSACTION_ID>', // optional }); ``` diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md index 21ecaccc..c56e892d 100644 --- a/docs/examples/webhooks/create.md +++ b/docs/examples/webhooks/create.md @@ -12,7 +12,7 @@ const result = await webhooks.create({ webhookId: '<WEBHOOK_ID>', url: 'https://example.com/webhook', name: '<NAME>', - events: [], + events: ['users.*.create'], enabled: false, // optional tls: false, // optional authUsername: '<AUTH_USERNAME>', // optional diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md index 25362bf1..283cf788 100644 --- a/docs/examples/webhooks/update.md +++ b/docs/examples/webhooks/update.md @@ -12,7 +12,7 @@ const result = await webhooks.update({ webhookId: '<WEBHOOK_ID>', name: '<NAME>', url: 'https://example.com/webhook', - events: [], + events: ['users.*.create'], enabled: false, // optional tls: false, // optional authUsername: '<AUTH_USERNAME>', // optional diff --git a/package-lock.json b/package-lock.json index 6ff18e85..686fc2d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "node-appwrite", - "version": "30.0.0", + "version": "30.0.0-rc.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "node-appwrite", - "version": "30.0.0", + "version": "30.0.0-rc.2", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0", @@ -29,7 +29,7 @@ "overrides": { "esbuild": "^0.28.1", "js-yaml": "^4.2.0", - "brace-expansion": "5.0.9" + "brace-expansion": "5.0.12" } }, "node_modules/@babel/code-frame": { @@ -219,9 +219,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.29.8", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.8.tgz", - "integrity": "sha512-E8lTAYNB1KW+FH+VGJuZM1ioAx2E6oVlvQFRrf5P8ZZmsiJXYAD9vTFV7yyEURNzgh1dFqMZuO6tUwcARbqFCA==", + "version": "7.29.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.9.tgz", + "integrity": "sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA==", "dev": true, "license": "MIT", "dependencies": { @@ -1241,9 +1241,9 @@ } }, "node_modules/@isaacs/cliui/node_modules/ansi-regex": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.3.0.tgz", - "integrity": "sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.4.0.tgz", + "integrity": "sha512-KzTVk2tCWAHtYrvvvaP8bJKJq2pVinhLcGEQdtLIYPbmNGNyYe8QwNaTUYQp2J7/vIsUKt5QCqAfUkYyG9DkOw==", "dev": true, "license": "MIT", "engines": { @@ -1409,9 +1409,9 @@ } }, "node_modules/@jest/console": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-30.5.1.tgz", - "integrity": "sha512-u5Ncuc+gXVUwjNMFQOnphHo2Qx2DxyC8Dvpmf4HCx4y0kvSkRRNiQYRixrvOP4V7y52JcSuNxqochCt0PpdHVg==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-30.5.2.tgz", + "integrity": "sha512-e8sQC4pCMHPBrPX7Hk8TJr+DM5dkUnImSTNag8SEWFAFAF6xIz4AJvCKapnrdHnZxep4bxw4PhG+ZbimYBMyKw==", "dev": true, "license": "MIT", "dependencies": { @@ -1427,17 +1427,17 @@ } }, "node_modules/@jest/core": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-30.5.1.tgz", - "integrity": "sha512-BL9g6CJUUhIbdoAflz/Va658erSSXUIvU8XUYiWNTbZljJjZ5yaC9EJ9/dQ19rpbYV3ZOK4sBACqhPaTyhoUIA==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-30.5.2.tgz", + "integrity": "sha512-/jqvFWoJF7LV1a6AUpYMbMm+2yIYsHJfR474H0SCzr9k8tnO/jl9wRg6zSG6lxgf6EozNlCG4amFzWsbZSvvZA==", "dev": true, "license": "MIT", "dependencies": { - "@jest/console": "30.5.1", + "@jest/console": "30.5.2", "@jest/pattern": "30.5.0", - "@jest/reporters": "30.5.1", - "@jest/test-result": "30.5.1", - "@jest/transform": "30.5.1", + "@jest/reporters": "30.5.2", + "@jest/test-result": "30.5.2", + "@jest/transform": "30.5.2", "@jest/types": "30.5.1", "@types/node": "*", "ansi-escapes": "^4.3.2", @@ -1447,18 +1447,18 @@ "fast-json-stable-stringify": "^2.1.0", "graceful-fs": "^4.2.11", "jest-changed-files": "30.5.1", - "jest-config": "30.5.1", + "jest-config": "30.5.2", "jest-haste-map": "30.5.1", "jest-message-util": "30.5.1", "jest-regex-util": "30.5.0", "jest-resolve": "30.5.1", - "jest-resolve-dependencies": "30.5.1", - "jest-runner": "30.5.1", - "jest-runtime": "30.5.1", - "jest-snapshot": "30.5.1", + "jest-resolve-dependencies": "30.5.2", + "jest-runner": "30.5.2", + "jest-runtime": "30.5.2", + "jest-snapshot": "30.5.2", "jest-util": "30.5.1", "jest-validate": "30.5.1", - "jest-watcher": "30.5.1", + "jest-watcher": "30.5.2", "pretty-format": "30.5.1", "slash": "^3.0.0" }, @@ -1485,39 +1485,39 @@ } }, "node_modules/@jest/environment": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-30.5.1.tgz", - "integrity": "sha512-eYJAkOsrpwDXPcoLNEG6lN9Zo3Cy35pxnVQD74vyIfsi/Q8wB/lZFsEjU4wrecOgT4ZviQDZaX/cFIJyMdMxTw==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-30.5.2.tgz", + "integrity": "sha512-nwFPOUMbmsjNNRCpnJpB9HbSZu4C07wDDds++5j+j1MezzPLxMPDdbdUVjr2o4RULDOValnDd70taPFI1EtxAg==", "dev": true, "license": "MIT", "dependencies": { - "@jest/fake-timers": "30.5.1", + "@jest/fake-timers": "30.5.2", "@jest/types": "30.5.1", "@types/node": "*", - "jest-mock": "30.5.1" + "jest-mock": "30.5.2" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/expect": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-30.5.1.tgz", - "integrity": "sha512-uOGd40P/COyUp9xHf5jeGiGJC2/ANg+2+Tk9/xN5/LxmlY/r/gxsPrx3DTEtaRZsLAX4wgNSLEDELZ5bmVs2bA==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-30.5.2.tgz", + "integrity": "sha512-2E+1Pg6jJxbRjLNLpciC71iri/3qsKJL222/aXJEFwC0VdUSvfS+JZQQLEVjUYYc8t8pQu2MGE3cF2+bNTYRsg==", "dev": true, "license": "MIT", "dependencies": { - "expect": "30.5.1", - "jest-snapshot": "30.5.1" + "expect": "30.5.2", + "jest-snapshot": "30.5.2" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/expect-utils": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-30.5.1.tgz", - "integrity": "sha512-WcRWhHQdTMRDpyWKZ/6MINBmovI7zeD+bL8wFjCncRV3NQOwKy1X45IfyblfHR4k/XciIlNEdFL9QjFO+HNKOg==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-30.5.2.tgz", + "integrity": "sha512-d/HOLSrJUlBIl6n3LzOa7cjW3xdePm5H5gQw2lixZ/0h157l9sw3mLblzFqnPcTbhDzhRQdBOX3A3KcG73nm5Q==", "dev": true, "license": "MIT", "dependencies": { @@ -1528,9 +1528,9 @@ } }, "node_modules/@jest/fake-timers": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-30.5.1.tgz", - "integrity": "sha512-rEkV6YzpBXo/L9cnj2ibyuYZuyGiNWaPUsyCu3HYJbqCV4jnEiKmf7hId20z8eKjZ0JQ9jtIYKxRSmYB/OYSsA==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-30.5.2.tgz", + "integrity": "sha512-GKk0h0tKT5SpDPxDhPg3r9mm5s8/YCBzVNMOGdRiQXwUiMsjU10mVPlMaQstH6/cu50vOb8N9oQUMETHuwwxKw==", "dev": true, "license": "MIT", "dependencies": { @@ -1538,7 +1538,7 @@ "@sinonjs/fake-timers": "^15.4.0", "@types/node": "*", "jest-message-util": "30.5.1", - "jest-mock": "30.5.1", + "jest-mock": "30.5.2", "jest-util": "30.5.1" }, "engines": { @@ -1556,16 +1556,16 @@ } }, "node_modules/@jest/globals": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-30.5.1.tgz", - "integrity": "sha512-VhqvQ251XIC7pk46YymI3HCeBLOdvriDw9zibekodAHEwoVvbVVgpU5H13GvmyOAzxtZCfsm1uvzqkaqJf2I+g==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-30.5.2.tgz", + "integrity": "sha512-62zfS+dL+M5aTNHXCNLyqD+j4oqxTIzDYrZbpqMP8Yn+gvlAGyzC6BSPNb1ZmFOakV1RtFYX/O3FCQXSWmQdgg==", "dev": true, "license": "MIT", "dependencies": { - "@jest/environment": "30.5.1", - "@jest/expect": "30.5.1", + "@jest/environment": "30.5.2", + "@jest/expect": "30.5.2", "@jest/types": "30.5.1", - "jest-mock": "30.5.1" + "jest-mock": "30.5.2" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" @@ -1602,16 +1602,16 @@ "license": "MIT" }, "node_modules/@jest/reporters": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-30.5.1.tgz", - "integrity": "sha512-RbUXIfv85KxitJn4l3MpAoMilkvXe2QCO5lXxHWftywo/VdZ5vkEoHRDgphcxP6qmoIkUaN8/UZj6NhdkIFdJg==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-30.5.2.tgz", + "integrity": "sha512-ev6E9iG73twQcfAfoTnviuYkr3yOrYbzAtMFCimv2fxHXPIp9PBt2u1wNMt0aYWgl8FPwIcS8oqRJg6alnht4Q==", "dev": true, "license": "MIT", "dependencies": { "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "30.5.1", - "@jest/test-result": "30.5.1", - "@jest/transform": "30.5.1", + "@jest/console": "30.5.2", + "@jest/test-result": "30.5.2", + "@jest/transform": "30.5.2", "@jest/types": "30.5.1", "@jridgewell/trace-mapping": "^0.3.31", "@types/node": "*", @@ -1674,9 +1674,9 @@ } }, "node_modules/@jest/source-map": { - "version": "30.5.0", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-30.5.0.tgz", - "integrity": "sha512-xWpTJP9D0bDFGbPGT8XuWSwwha/iHADyyKzUnMx4UbdgnHugxrDaQFO4RZ8x4ZsFzRP6pNii8uvlgKCDxCIuDg==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-30.5.2.tgz", + "integrity": "sha512-c5CehvkbfHX6yyNg7bMn2ylqlp9AHXuZ/3hPH/Lh5bxD/vefd/lV9HBjMqXef9yQNqkdwyZvkLSVSwB38hy8Qw==", "dev": true, "license": "MIT", "dependencies": { @@ -1690,13 +1690,13 @@ } }, "node_modules/@jest/test-result": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-30.5.1.tgz", - "integrity": "sha512-A/1S6ZBdpic50E0pxLgvaB9XNPL4k7AksmG69OO2oiotxciWZwHkbOec+qbIi+uUtIIByOVlXJUl97oZUsz+Jw==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-30.5.2.tgz", + "integrity": "sha512-eO6YU5rsLfs60ne694e0IAmRgeBnoA8mu0nlxXDbl/1j5km0o2vO9/VbbUIKIH+WRKKEI+ELgwraRGn2Lhep8g==", "dev": true, "license": "MIT", "dependencies": { - "@jest/console": "30.5.1", + "@jest/console": "30.5.2", "@jest/types": "30.5.1", "@types/istanbul-lib-coverage": "^2.0.6", "collect-v8-coverage": "^1.0.2" @@ -1706,13 +1706,13 @@ } }, "node_modules/@jest/test-sequencer": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-30.5.1.tgz", - "integrity": "sha512-SHcPnrjdVRYJv6y6l4JUTy4Jccu7zmO6BmiOfOA34UiVBto22s19WiDC0A/2qfM7MWB/qdcoqfSIRMitpjTT4A==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-30.5.2.tgz", + "integrity": "sha512-bmij8jZyYAC47ExT2GeP7PcrlwSNS+Bp3KeRuBH88gpcxqDv6fljN8PemS4J/lLZ79xb6mpaennQTTq0zUAVVg==", "dev": true, "license": "MIT", "dependencies": { - "@jest/test-result": "30.5.1", + "@jest/test-result": "30.5.2", "graceful-fs": "^4.2.11", "jest-haste-map": "30.5.1", "slash": "^3.0.0" @@ -1722,9 +1722,9 @@ } }, "node_modules/@jest/transform": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-30.5.1.tgz", - "integrity": "sha512-EDnDhn0jleU9ZhpVoA4gvqw+Ev0iw/r5upNT2b79RiwiaTiYAMMhvNJP3lmocjIe5J2ZkoNr0B3K/J6O5GIm4Q==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-30.5.2.tgz", + "integrity": "sha512-LBGwmaE886C41jDZ65eqR1YbXM7642MK3ZhTowZd5+xDlrDLuf4ePuDdDmVSvcr8NTVJ3MqxLkMbUCzuigUaoQ==", "dev": true, "license": "MIT", "dependencies": { @@ -2212,9 +2212,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.63.3.tgz", - "integrity": "sha512-w3Jnvi1ocaVm/c7yVPpfB98XeSRBMyzp6njL5MVVbGyXjpmUkN+s6Hp4t0PqhGCCaI1ZHMKXt/w0lA1RCaLVcw==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.63.5.tgz", + "integrity": "sha512-J25QJU+B78T4FhhBsNpLJyVWOi31mwtpcMwywHmOKH65Q9IWGA81gPj+dnwlhU8wktVriYE+tFAaQgrnJRzAZg==", "cpu": [ "arm" ], @@ -2226,9 +2226,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.63.3.tgz", - "integrity": "sha512-uI/ESiaIbbRYAEhzy8PCUWDp1hB0bjAqM06mW9flOoNO4Q8DQpeoREhBR5Hegfl+wpXiguyJv6XSPzEN7OxyHQ==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.63.5.tgz", + "integrity": "sha512-LDopB3zuZM5Ux9TT2luNEBJW/tYbGU2g1d+VpKk6I+gSKDb+/7sYE6M225gRQt4RbMX6MSwMsVR/phdjVUgRLg==", "cpu": [ "arm64" ], @@ -2240,9 +2240,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.63.3.tgz", - "integrity": "sha512-oxhrd1jmXLwWZ83eQYDXxuqRdkqkzrjR3JobKeuUyfdNZo11FuQIvqEOZhyIT7OBHxXoGslDDjN0cQcM6T0TqQ==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.63.5.tgz", + "integrity": "sha512-wlJEERGfeuHeBavCL2qVnNacOK43NDoZM4sjkeRPymd04OAE9T1zBqDJgmZ+CIsPTYKwdzpUC8vmOw84dwY4Tg==", "cpu": [ "arm64" ], @@ -2254,9 +2254,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.63.3.tgz", - "integrity": "sha512-7/YiIMghVE8DrxKvNdorAaJVdriOFgOIpdStnPx8ppx5zfTwC3jBCSEAIzB7JD5404m65THl6H93UTTVUvypmg==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.63.5.tgz", + "integrity": "sha512-4nJJGg5jbo2wwPP4JP+LfEBA3bvP8rU9CLuhp7jWvq9sxEyhjQFTFdrqi+/dHEin/pd8jpT0vcehIpnZtmEdcQ==", "cpu": [ "x64" ], @@ -2268,9 +2268,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.63.3.tgz", - "integrity": "sha512-GXFZRRoMAytaI5z6N3Zhfw0WL18Q0M8r95D5hlC4GqE/lGk8pbSJNUBoOWDfbm6dTciqHj2nU87tI5f6XhQiOg==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.63.5.tgz", + "integrity": "sha512-DrZbyCDF1hneuO6jRbvZ2D7+PIBM6yIwYnJpg2vIk58T+wuFpiaGZrfUr59lDWw45bg+IrpTGLPiNi/Fk4w3Cg==", "cpu": [ "arm64" ], @@ -2282,9 +2282,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.63.3.tgz", - "integrity": "sha512-77W+8X3ddYgPxUpB8nZFQs2Mq+wc4HVlcSRtApXLjYBcnPMkttrSnU8VwKQjeWYhMsITHFs5cWBQ8vz1Q+5RHQ==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.63.5.tgz", + "integrity": "sha512-gqfUVMJMB3mehqywxp6hTBFfgtMQykZY19+cfiaYP0toIJLb/1DZRJHVkQQGP13W4TAwfZDWeg1qBcheTRioXQ==", "cpu": [ "x64" ], @@ -2296,9 +2296,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.63.3.tgz", - "integrity": "sha512-FVkwK+iUC+mq+GipVK46rRVticfAPtvPUNlqlGXUDxdVk/UGjQiiiUVPUrEXdSpU2ufU0XxLGyTqDtBidDOVmg==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.63.5.tgz", + "integrity": "sha512-CFmhpvAwzSaWMlN3VN7UtmoTihlZNzoP0juQib5TQRnYUyDV8dXeWOp29sobWAT6gXl/hQgAClLlEiYozQG3OQ==", "cpu": [ "arm" ], @@ -2313,9 +2313,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.63.3.tgz", - "integrity": "sha512-+aGU1t3398yQOVj1Bz8o3e+KtswxAPvO+mtxtNdfXYMkXIHu7XhhkCD7/DEH9q8tF8uhDnMWvfpUKI8y1sZJsg==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.63.5.tgz", + "integrity": "sha512-Uc9H8eXCOayV6JLTH5bXKMId6qbhNHa818/BgYjm4jrlq3vZquC9cqyvHBw17xy5Mnj5f+I3gFK5JcEf3hSqrw==", "cpu": [ "arm" ], @@ -2330,9 +2330,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.63.3.tgz", - "integrity": "sha512-cR0kjpRXR2KJ2oQK8E2KTPtphs+b9hZ8IhTZubNryt/RsqgdOZBQ2Zq0q5UedtiIi0rs3jVhJh55RE1ZHUVGUA==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.63.5.tgz", + "integrity": "sha512-VcPr/szv/1BFw112Kt//fxulXt/JPqzzidU84iW68L2DdjnOO8QFUv2zTSYBEPHD6movBD4z+bbr5y60GYM7Jw==", "cpu": [ "arm64" ], @@ -2347,9 +2347,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.63.3.tgz", - "integrity": "sha512-y1RYi4Q3/9ByVWSSt9kX2ustE0B7kFYbJ6zZdVZVyqopZs3yhCTwRfrjIX4vezUJInma/Gs6BOFDJg7yZmJ0IQ==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.63.5.tgz", + "integrity": "sha512-BnxtJ5/91BrIHYIkGrmjz/lbMhqEHt1dPFqIxIFR+jPn0xVc/oUSCtIT089zfp5ufwGDlYz2UC+Fe1SRBpYFbQ==", "cpu": [ "arm64" ], @@ -2364,9 +2364,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.63.3.tgz", - "integrity": "sha512-DNhEA5viIj3Z5bZLE4z4oV8N5ozWqDwyt7T6KG7VdLDJ0nW+rNOYlphBl4/3HQkK75qipPLsVOfStHHOwN9WSg==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.63.5.tgz", + "integrity": "sha512-LrYcHZwF+fAMNKHYTOQ5osWM4AZF7YF6D+XtsjDyEvljtt11twc+zHVXBLNEjxVSUnKYsOhvVz4Z213eW02COQ==", "cpu": [ "loong64" ], @@ -2381,9 +2381,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.63.3.tgz", - "integrity": "sha512-17gQCqrIpXBX2Cmi9/TygnVOqGbzsba/iaqcYSL8FY7lNugg+7AiYNs5c5nKWD+NRQha36Sa0CqkJqH4XVHwnQ==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.63.5.tgz", + "integrity": "sha512-nj7QKQePAAUpCpJHtg0pR0W/b92A9NO17JS3BAQmHDn/yhmkir2p8llrKY9TOhleKIaSzy1JhxS3T9FVld6coA==", "cpu": [ "loong64" ], @@ -2398,9 +2398,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.63.3.tgz", - "integrity": "sha512-6LwVnZRIyINpdku/yOcI8Tm9YqLmhHK5emmlOOnW9tO0SYEm1FmKPcsSAGp0NBlqR2P04xaND4jvN6sTHqhq8A==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.63.5.tgz", + "integrity": "sha512-5ylkX6dWMeBKge9nTU+Rxfb+ZfaCIJ9lRqIFaK0eAMcWp7OJbYnLveLgXmm0VrvuLKb8qIK+mHyH0qu88RM+iA==", "cpu": [ "ppc64" ], @@ -2415,9 +2415,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.63.3.tgz", - "integrity": "sha512-xMUqkTXlEUtI/p5AAukMwBRr1enU3efsTeF+bskeFfk8t1C9rcC8sLREcZXmTfAXEbvRdJVSonVJez3TMlbR3w==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.63.5.tgz", + "integrity": "sha512-oHK4ZHYFDKjZviK34I+NwgfbGxgI7ztrNxj2hPTSSNFgeq1a/lEd7dHV2fdGAuTH4Iym3RHJg+vAbWaWG4B7Zg==", "cpu": [ "ppc64" ], @@ -2432,9 +2432,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.63.3.tgz", - "integrity": "sha512-S3E94co9F9WRRqEaUoQZ38K1gCz6KiM+nL7/3ijq7fDGF3OznjS5TasgYITlvl27GQKtu4lOAOsr5MFwkijvOA==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.63.5.tgz", + "integrity": "sha512-UcetmHZ6XOXuUByiKZyQmb55ZPr0LABr3Ec/HB9wKZn6CEAFWZkE+hsJErJ9hbPBC7nI0dKuELx7CoV6IM7TMg==", "cpu": [ "riscv64" ], @@ -2449,9 +2449,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.63.3.tgz", - "integrity": "sha512-1QtRDwG42x5BJI3s9mxu5rEjDnfbSnk20HQ9/ylTAYnSwYwxMVb+Vgu34wzzTQ7ogqBybebgQNUDAvZVQ38DbA==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.63.5.tgz", + "integrity": "sha512-C5CmDPQBtvjVo8cgQsBs+w6WB0JLkiixhgi6hVLV11hERWdn/p0XcPU2OUcZzac9BPOFq7SbaHFa8r3SWEysCQ==", "cpu": [ "riscv64" ], @@ -2466,9 +2466,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.63.3.tgz", - "integrity": "sha512-BQhejF6ZXOpxbngiNTP12GCGQeaDVL2QXGeBVViKIYzFHM5RKxTxwUMB1fr1BeNFphFMpnRqC5QSXFSa4z6UQw==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.63.5.tgz", + "integrity": "sha512-lHVQHJFKsuuxLMi3MQO9XVL8Tje3JR82CzB+QDKC5NWBcsIWuwsn9uIM5e3lBhI+fF1/s63qnyYqsg65+8rV/w==", "cpu": [ "s390x" ], @@ -2483,9 +2483,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.63.3.tgz", - "integrity": "sha512-SXagRwnI2Wlwlitllu59UK/nGVbD1CKPcNqDplHwIC4BqJcpXFjD32d1R/RbuISa95HdQrZM3/7v4bKiowFaLA==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.63.5.tgz", + "integrity": "sha512-3W9bTFcQNJn71cSJVM9RKIiZOy8DO/XLDii8Uv/Pm6WKqDRj7JV3ZfuXIEfyuy5LXpIzAbB/1M4Ukp9GKNa7nA==", "cpu": [ "x64" ], @@ -2500,9 +2500,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.63.3.tgz", - "integrity": "sha512-2IPozoEALRCziGqE8O9KMK60PMu5TS1huv4fwoeCexj+WjmcwFtX9CTOVbfXCUqcELAubEwRFPYlzb/WvwY2HQ==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.63.5.tgz", + "integrity": "sha512-VDC7rRJlee/scpki96GZ27Omf6yU87s1YXwVTpjE5841faVlDYYT565rgfmoR1U0sqL7z5ivQSDjcsF6VRXyBA==", "cpu": [ "x64" ], @@ -2517,9 +2517,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.63.3.tgz", - "integrity": "sha512-AoxqosUHT9IX54hFn2TiN6A7d6ZKTtE6pd2bqWtqkkNJ6HJGaU6FRouGX8L1O7R/ZwsnCnpQrHzb4pDEx+UHRQ==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.63.5.tgz", + "integrity": "sha512-z86Ok2p4pTdv5xqCKZsTooO7yBEiaJR/HzU3Wx8RmWsPoLppnMKROhJusQob8B3IE1ghC343kUW9rC2r+Wf3ig==", "cpu": [ "x64" ], @@ -2531,9 +2531,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.63.3.tgz", - "integrity": "sha512-d+CaftKgmkFBzCwezMqqy1d0QNNYugqLCMcYVQWBy5SS2YfeMP8Q8ripkgx9O8IyBXXLHrJ+aaCV4U96usv6Yg==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.63.5.tgz", + "integrity": "sha512-IzQmj+xXwQFGhMAMKMQVXkMwMZN3TqkJgAE0nSsqvVwWWciP4AIPMmWRqOQ2GfX7TUDZr+xqGFcBS36CRPGw0g==", "cpu": [ "arm64" ], @@ -2545,9 +2545,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.63.3.tgz", - "integrity": "sha512-xXlDF6nR1eOuXbdDy5Hl5fmtY7teUDevF/k0O7IPoZe4Tpmdv+lgdE5JRsnhQtt37ql9P0VF2kAN9a0OCZdo+Q==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.63.5.tgz", + "integrity": "sha512-F6qpTaPc9bwBH85kjy0/BLmLSW1uv7AoOXCoRIkg2arlgCYlWYcAbiMkvZuAcaWk9TpCRG//okznLAqLGshkMw==", "cpu": [ "arm64" ], @@ -2559,9 +2559,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.63.3.tgz", - "integrity": "sha512-YtXAgLN+JP7Ay6qG3eWhc7IHMQPzLc8r3uvhAvlJIoCz/4Q32+Bl9Fmnywidh8v1GOIMmymjovfqY9ETAtysvA==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.63.5.tgz", + "integrity": "sha512-igoDsTFhhwECBeGbUuLeIk7t8Y1apa+cs6mDWpx2EZ0ch7oEQgzHbFUXN9euoHekCAQzXdXApAGkV6jznS7tWw==", "cpu": [ "ia32" ], @@ -2573,9 +2573,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.63.3.tgz", - "integrity": "sha512-WuWtSJRNo549vzcfZyEgfqb6zeSgn1F+UE5kQ+BCjzz0W4MGCjntUHkZVc1VRuAM7+ULaSyhiPxD1spyewFvkQ==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.63.5.tgz", + "integrity": "sha512-U3teMeMbXFmaM5D+OTJpsOXd+wV/qftIeYF9kBKL4v73641qyJmoXFtA28DQLsnmlyayEsTe72xpLHrArq6vHw==", "cpu": [ "x64" ], @@ -2587,9 +2587,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.63.3.tgz", - "integrity": "sha512-+lIKX7O0+IGe7WuhATaAMMeT7B76vfhXH/l9wLQL+nvyhbw2ohYCKIdWL56JfDu75CWt5oKRP4QFH/jkMtBquA==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.63.5.tgz", + "integrity": "sha512-ypfC34F3RKXvCXBglGqGMsUSMKlgwd1HX9AOAlx9RoZZ6GaI42YHVeKpzg3JG+wpBUJYTG+NNZhqbDWL8tBZkw==", "cpu": [ "x64" ], @@ -2802,9 +2802,9 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { - "version": "7.0.9", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.9.tgz", - "integrity": "sha512-brTTsvFRt5C1gGHtPst/281UjPD5t9fBqbgoMPlVWy11ZLTPfu7HxK4ZYqO9H7o/yC9rSTCI85EaQ4OoY12qYw==", + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.10.tgz", + "integrity": "sha512-HpbUakT7xp5miBUywCHf36ZEuAJNklBJDDsGpUIjMzOSmM8ELSfA9Sa/QDPeNeqeoN31u+UTCkL4klCOVvRm4Q==", "dev": true, "license": "MIT", "engines": { @@ -3489,13 +3489,13 @@ "license": "Python-2.0" }, "node_modules/babel-jest": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-30.5.1.tgz", - "integrity": "sha512-ge1xUVZS91ml09YRMgRGgeKJ4YJpcOiuwteAxFBYLugQyp7cRw+hHej6Ho0vPjvLrjq60bb7JPHH9LAMA1/krA==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-30.5.2.tgz", + "integrity": "sha512-ES8WeJ2fNWPEDunyAtUfJ12nHyaWUloCHdkfK2oW5uSoQSUmjNKdWiGaXJITJwvFEWoD/evHEg/QoCXAvLaQqQ==", "dev": true, "license": "MIT", "dependencies": { - "@jest/transform": "30.5.1", + "@jest/transform": "30.5.2", "@types/babel__core": "^7.20.5", "babel-plugin-istanbul": "^8.0.0", "babel-preset-jest": "30.5.0", @@ -3598,9 +3598,9 @@ } }, "node_modules/baseline-browser-mapping": { - "version": "2.11.24", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.24.tgz", - "integrity": "sha512-hYrgxie335U08WqICoGqKRzV1HFXv6zdxwJE4ekCb80CM9a0SVVsN4QPwT67RraRo+9h8IATk6uxHJw7QSkdOg==", + "version": "2.11.26", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.26.tgz", + "integrity": "sha512-GLQdD3y6UF8iVuMJl5fHgE4jdn/ua7n+toKfLgNlg3BqQtOZjpy68T8Tup8/wGWZCDlm7KMg7tPb4MPn7oN0TQ==", "dev": true, "license": "Apache-2.0", "bin": { @@ -3620,9 +3620,9 @@ } }, "node_modules/brace-expansion": { - "version": "5.0.9", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", - "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", + "version": "5.0.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", + "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==", "dev": true, "license": "MIT", "dependencies": { @@ -3633,9 +3633,9 @@ } }, "node_modules/browserslist": { - "version": "4.29.0", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.0.tgz", - "integrity": "sha512-3GSvyjvDI4Dur1Meg2BekJquu5uF+9R9a1+5M1Mde192eZoXbeXjzgOsgqPS2V8D5wrrip0gR5Hf/GhWQ9ZzaA==", + "version": "4.29.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.3.tgz", + "integrity": "sha512-1R4kiYKXGViqEN0CnoDrXc1StD9niAwu+j2dukWzrD4bJgsD4lDmEp0CRbc6E/vYJIfTHwPmwyaKtVSudICdPA==", "dev": true, "funding": [ { @@ -3653,10 +3653,10 @@ ], "license": "MIT", "dependencies": { - "baseline-browser-mapping": "^2.11.23", - "caniuse-lite": "^1.0.30001810", - "electron-to-chromium": "^1.5.427", - "node-releases": "^2.0.55", + "baseline-browser-mapping": "^2.11.26", + "caniuse-lite": "^1.0.30001813", + "electron-to-chromium": "^1.5.439", + "node-releases": "^2.0.57", "update-browserslist-db": "^1.3.3" }, "bin": { @@ -3737,9 +3737,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001810", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz", - "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==", + "version": "1.0.30001814", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001814.tgz", + "integrity": "sha512-/Uaf1lAzr59XcMpW0o96WoEfr+VXK2OX4U9AgFoiSHsVJ4HppnIFUjtYzsyDH2+tgANaQb2/oxYGwCPapN1FpA==", "dev": true, "funding": [ { @@ -4003,9 +4003,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.430", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.430.tgz", - "integrity": "sha512-e1QEj72Y4zd8RlNZVmoTg+iCOSVwpk05IOiiQwdrkwCSVlZfPthevErhE+nckGd2YbsXfp1SkisznhGVIXP2NQ==", + "version": "1.5.442", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.442.tgz", + "integrity": "sha512-najZYZ3+ZpjN1z3VOsrBiv5ej18vQgfV2lvEmxWzfmKrk4bdm3Owseyud4yGU6DfFn9pyunoAHDDyM4KmP78Ew==", "dev": true, "license": "ISC" }, @@ -4312,17 +4312,17 @@ } }, "node_modules/expect": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-30.5.1.tgz", - "integrity": "sha512-m8YrYgvKe9+9gEnWEuKz+qCGfHqkrff7PPfyDnOFkjsfYRKqiYyOxDFMFieCGAuhtk/VNm63tvNgKZVzVy+Hvg==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/expect/-/expect-30.5.2.tgz", + "integrity": "sha512-0LNuMvs8/5mRYhnCR4k+lGV7fqPMs6Bnksda4S3zsCUmdxBpAn4zU4NNzXdq1pMKe/H4W5t/zVIDSJ/H3e0vDA==", "dev": true, "license": "MIT", "dependencies": { - "@jest/expect-utils": "30.5.1", + "@jest/expect-utils": "30.5.2", "@jest/get-type": "30.5.0", - "jest-matcher-utils": "30.5.1", + "jest-matcher-utils": "30.5.2", "jest-message-util": "30.5.1", - "jest-mock": "30.5.1", + "jest-mock": "30.5.2", "jest-util": "30.5.1" }, "engines": { @@ -4833,16 +4833,16 @@ } }, "node_modules/jest": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/jest/-/jest-30.5.1.tgz", - "integrity": "sha512-3qrR8+ZXFnn7y0H2yjWQNkGGBLBY4zTRoTMAq9zJcgwLLtlyonfsCLviIXK9xuE2KgIyM+M36AFcoK2DgFR36w==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/jest/-/jest-30.5.2.tgz", + "integrity": "sha512-3gnpdBIza8ijCl3iMV9ChE3hSt1+46865qqod863gQtJr1DixOkAU5DoGbi3u+XlRcw++BhZQMu/y4xBdHBvSQ==", "dev": true, "license": "MIT", "dependencies": { - "@jest/core": "30.5.1", + "@jest/core": "30.5.2", "@jest/types": "30.5.1", "import-local": "^3.2.0", - "jest-cli": "30.5.1" + "jest-cli": "30.5.2" }, "bin": { "jest": "bin/jest.js" @@ -4875,26 +4875,26 @@ } }, "node_modules/jest-circus": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-30.5.1.tgz", - "integrity": "sha512-NgliezXQ6yznqR4W5Gqw++0cZSbBZlF0NknNIAE5VmSJKWOtmWJmWnBq3TSkUOVBTPrT7FGGhVdA8DLWnxo2Sw==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-30.5.2.tgz", + "integrity": "sha512-vffFgjs5JSJ9q4ds1vNW3klKYPJfYfIY61LT/zaZgvTeASJOWZUt8LBfHgIcV4rwxlPBLl/ePBGccHEclS4PlQ==", "dev": true, "license": "MIT", "dependencies": { - "@jest/environment": "30.5.1", - "@jest/expect": "30.5.1", - "@jest/test-result": "30.5.1", + "@jest/environment": "30.5.2", + "@jest/expect": "30.5.2", + "@jest/test-result": "30.5.2", "@jest/types": "30.5.1", "@types/node": "*", "chalk": "^4.1.2", "co": "^4.6.0", "dedent": "^1.6.0", "is-generator-fn": "^2.1.0", - "jest-each": "30.5.1", - "jest-matcher-utils": "30.5.1", + "jest-each": "30.5.2", + "jest-matcher-utils": "30.5.2", "jest-message-util": "30.5.1", - "jest-runtime": "30.5.1", - "jest-snapshot": "30.5.1", + "jest-runtime": "30.5.2", + "jest-snapshot": "30.5.2", "jest-util": "30.5.1", "p-limit": "^3.1.0", "pretty-format": "30.5.1", @@ -4907,19 +4907,19 @@ } }, "node_modules/jest-cli": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-30.5.1.tgz", - "integrity": "sha512-uwNYepWgaNBCplm42fCIUZTf/tIEHIy5AYvx7eL1BrwIgyjPt+2poouR23UO2yopIP+kV8oZFHfv+l4pg/8prQ==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-30.5.2.tgz", + "integrity": "sha512-YYYxUUVjFgPvgEleKNKMaYGIFgR3l3832Cl0kRL/oCiDZ03v7wImUtquHl2OOBCCNgprjZgBN5bczS/JklPBDg==", "dev": true, "license": "MIT", "dependencies": { - "@jest/core": "30.5.1", - "@jest/test-result": "30.5.1", + "@jest/core": "30.5.2", + "@jest/test-result": "30.5.2", "@jest/types": "30.5.1", "chalk": "^4.1.2", "exit-x": "^0.2.2", "import-local": "^3.2.0", - "jest-config": "30.5.1", + "jest-config": "30.5.2", "jest-util": "30.5.1", "jest-validate": "30.5.1", "yargs": "^17.7.2" @@ -4940,29 +4940,29 @@ } }, "node_modules/jest-config": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-30.5.1.tgz", - "integrity": "sha512-L8PKM2X/ngG8PxfLMqglKGZjylPgw84bVPUlMY9W/o76TnLqPWrmQgsaT0HrheGdRtpGE5FbmREA0Kvb+Qx5gQ==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-30.5.2.tgz", + "integrity": "sha512-U6221OZekabePvGcGPf4raIBKMvYQWFHvhobDJRojOYaFMj2HaGytAdknjDhYc6JTz2fdHW9+6k0wWUDaNeOFQ==", "dev": true, "license": "MIT", "dependencies": { "@babel/core": "^7.27.4", "@jest/get-type": "30.5.0", "@jest/pattern": "30.5.0", - "@jest/test-sequencer": "30.5.1", + "@jest/test-sequencer": "30.5.2", "@jest/types": "30.5.1", - "babel-jest": "30.5.1", + "babel-jest": "30.5.2", "chalk": "^4.1.2", "ci-info": "^4.2.0", "deepmerge": "^4.3.1", "glob": "^13.0.6", "graceful-fs": "^4.2.11", - "jest-circus": "30.5.1", + "jest-circus": "30.5.2", "jest-docblock": "30.5.0", - "jest-environment-node": "30.5.1", + "jest-environment-node": "30.5.2", "jest-regex-util": "30.5.0", "jest-resolve": "30.5.1", - "jest-runner": "30.5.1", + "jest-runner": "30.5.2", "jest-util": "30.5.1", "jest-validate": "30.5.1", "parse-json": "^5.2.0", @@ -4991,9 +4991,9 @@ } }, "node_modules/jest-diff": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-30.5.1.tgz", - "integrity": "sha512-e3cNNMpv8Kh20MjjphTXs+3Vz7DQyLM1nft7KJhnh46atFhjVJRa+0Hq0beywuwsACtMQUBihQkFl8zxb7gt1Q==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-30.5.2.tgz", + "integrity": "sha512-rBtHnI6BWTiWj3lM7fOLVfChx7R9B0u9VV3PRHawKs79x6ZjW1QoSrKenaigNGWlvhtoi2BqvDbABDie+Os3xQ==", "dev": true, "license": "MIT", "dependencies": { @@ -5020,15 +5020,16 @@ } }, "node_modules/jest-each": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-30.5.1.tgz", - "integrity": "sha512-S1af0TU4v1EZ/AUlkFs/sxf/5KGsbAT9kRgdyoMX/x72y7C8ZEgETE5o1TPnbKRnrbprc5FR/moYLfdRmqEjsQ==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-30.5.2.tgz", + "integrity": "sha512-GRrW+7fmmgmkvyfEBqc1QFdWnF1Ex5yG6Y6AWL4TTxnkWlKIT98dsKh3P3UuWm6v4XsQwVE6DEzXIPMzWJ3ZbA==", "dev": true, "license": "MIT", "dependencies": { "@jest/get-type": "30.5.0", "@jest/types": "30.5.1", "chalk": "^4.1.2", + "jest-regex-util": "30.5.0", "jest-util": "30.5.1", "pretty-format": "30.5.1" }, @@ -5037,17 +5038,17 @@ } }, "node_modules/jest-environment-node": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-30.5.1.tgz", - "integrity": "sha512-LrPj3sPMjsQoOB3jrb8p/sa+XkSFNKo60TTsyc+EB2kxQJHgbwElpXnx1yX25fdFn5958FIObRtcLSHyV8VIAw==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-30.5.2.tgz", + "integrity": "sha512-Ciz4KgTGIbojxSKpuFImgWJj5EyqfE8xMq9NxWmOXnQywHHS03H9Mv+vaCB29J5pr3JBrY27WbRV18rBdjh8Dg==", "dev": true, "license": "MIT", "dependencies": { - "@jest/environment": "30.5.1", - "@jest/fake-timers": "30.5.1", + "@jest/environment": "30.5.2", + "@jest/fake-timers": "30.5.2", "@jest/types": "30.5.1", "@types/node": "*", - "jest-mock": "30.5.1", + "jest-mock": "30.5.2", "jest-util": "30.5.1", "jest-validate": "30.5.1" }, @@ -5093,15 +5094,15 @@ } }, "node_modules/jest-matcher-utils": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-30.5.1.tgz", - "integrity": "sha512-aroZVqwOz/wC2y6pC+obgFWKV9viaQWQTTSB6W5H55+egtUczIfXR/rxExTv92xD/ADYwpqaYfVWx1aqwKg7FA==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-30.5.2.tgz", + "integrity": "sha512-lFkB365PTIHOhPzwrb9T6gvlDnPpOZ7/c3ewOKKB7bzztqjVrtlyRL2MkyfJXpyY2u2SKw001JKrTx14fBUFcQ==", "dev": true, "license": "MIT", "dependencies": { "@jest/get-type": "30.5.0", "chalk": "^4.1.2", - "jest-diff": "30.5.1", + "jest-diff": "30.5.2", "pretty-format": "30.5.1" }, "engines": { @@ -5131,13 +5132,13 @@ } }, "node_modules/jest-mock": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-30.5.1.tgz", - "integrity": "sha512-9fVjc3leUpGID2/by/LU4Dvdcp7PFh9LlxS3QRWK3ABm+KtvEVsG/AEGeLY3gKOZsjkBxyfwGltoAVlW7dygHg==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-30.5.2.tgz", + "integrity": "sha512-KTHb37Fhj8xY8qPFvTFaFJHcdsumQp+ExsUlgoX232Agmc706gagBs53+CYvulV7MVQo9AgXOUxsqzzVBoJlrA==", "dev": true, "license": "MIT", "dependencies": { - "@jest/expect-utils": "30.5.1", + "@jest/expect-utils": "30.5.2", "@jest/types": "30.5.1", "@types/node": "*", "jest-util": "30.5.1" @@ -5176,31 +5177,31 @@ } }, "node_modules/jest-resolve-dependencies": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-30.5.1.tgz", - "integrity": "sha512-JKpXGONDcTaunrNVn8KCl6qAnwl06jIkvv70lhq0Ze47lsPx9sH5HoeEUiXX6iFGnliHN/qpIbQ0l38wrVmXaw==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-30.5.2.tgz", + "integrity": "sha512-GMI0DP5enX9Z2qW2zFy1bOkrCfWAOPRJQ7qHt0pdfrxBPsgWxglMPrRSK2TX/wRWYxcPRSLFg3Z88qPOzHx7FQ==", "dev": true, "license": "MIT", "dependencies": { "jest-regex-util": "30.5.0", - "jest-snapshot": "30.5.1" + "jest-snapshot": "30.5.2" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-runner": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-30.5.1.tgz", - "integrity": "sha512-FPlQE4+mwnFxXmpPrSi836KV2ZzvK1g6/nPCT8o5BcoDUUNJQeHo1/Qdkoe/QeoL4M7OeJpbnGUhYKhC1VMdaQ==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-30.5.2.tgz", + "integrity": "sha512-/B6px7hiiNhVSRwuv9AGn0nawYvwsHeQZ3ItTd5Gp2diFd0EOKaWVeWqcbw3L88vx1GfpCKjQkxWItZCTl11Rw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/console": "30.5.1", - "@jest/environment": "30.5.1", - "@jest/source-map": "30.5.0", - "@jest/test-result": "30.5.1", - "@jest/transform": "30.5.1", + "@jest/console": "30.5.2", + "@jest/environment": "30.5.2", + "@jest/source-map": "30.5.2", + "@jest/test-result": "30.5.2", + "@jest/transform": "30.5.2", "@jest/types": "30.5.1", "@types/node": "*", "chalk": "^4.1.2", @@ -5208,14 +5209,14 @@ "exit-x": "^0.2.2", "graceful-fs": "^4.2.11", "jest-docblock": "30.5.0", - "jest-environment-node": "30.5.1", + "jest-environment-node": "30.5.2", "jest-haste-map": "30.5.1", "jest-leak-detector": "30.5.1", "jest-message-util": "30.5.1", "jest-resolve": "30.5.1", - "jest-runtime": "30.5.1", + "jest-runtime": "30.5.2", "jest-util": "30.5.1", - "jest-watcher": "30.5.1", + "jest-watcher": "30.5.2", "jest-worker": "30.5.1", "p-limit": "^3.1.0" }, @@ -5224,18 +5225,18 @@ } }, "node_modules/jest-runtime": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-30.5.1.tgz", - "integrity": "sha512-UB88+NRkK2Tw/OqV7dofYcyiUGrVZtD41k/N0xQOs9fG//57XHK7JLWG52HD1UYpUAhjK4xm6DBvFX3yWudsMA==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-30.5.2.tgz", + "integrity": "sha512-0paUAHBlheai10A3XSy9Xh+YBG0IROy+/qzcDPzQ/nbbXrznQzeWy5qniICWK6d3W3scaRQCVAbXdcK0ibBq4w==", "dev": true, "license": "MIT", "dependencies": { - "@jest/environment": "30.5.1", - "@jest/fake-timers": "30.5.1", - "@jest/globals": "30.5.1", - "@jest/source-map": "30.5.0", - "@jest/test-result": "30.5.1", - "@jest/transform": "30.5.1", + "@jest/environment": "30.5.2", + "@jest/fake-timers": "30.5.2", + "@jest/globals": "30.5.2", + "@jest/source-map": "30.5.2", + "@jest/test-result": "30.5.2", + "@jest/transform": "30.5.2", "@jest/types": "30.5.1", "@types/node": "*", "chalk": "^4.1.2", @@ -5246,10 +5247,10 @@ "graceful-fs": "^4.2.11", "jest-haste-map": "30.5.1", "jest-message-util": "30.5.1", - "jest-mock": "30.5.1", + "jest-mock": "30.5.2", "jest-regex-util": "30.5.0", "jest-resolve": "30.5.1", - "jest-snapshot": "30.5.1", + "jest-snapshot": "30.5.2", "jest-util": "30.5.1", "slash": "^3.0.0", "strip-bom": "^4.0.0" @@ -5259,9 +5260,9 @@ } }, "node_modules/jest-snapshot": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-30.5.1.tgz", - "integrity": "sha512-cNWFdSb5xuDGl8hKkAZJ3YtI/PzHpAPFV+HUXWIOG8rMhpDTLVbvAc2d2wRicoYw2wGsJGLaurJT6BLC97bLXQ==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-30.5.2.tgz", + "integrity": "sha512-jKIdes25AnAH73dOCi2qE6J6vHJ6L2vyBS11M89kT50DVJcLTf2AOjvcc+2vVaN8lUbY5v2R83aqXo3Ro9fqYA==", "dev": true, "license": "MIT", "dependencies": { @@ -5270,17 +5271,17 @@ "@babel/plugin-syntax-jsx": "^7.27.1", "@babel/plugin-syntax-typescript": "^7.27.1", "@babel/types": "^7.27.3", - "@jest/expect-utils": "30.5.1", + "@jest/expect-utils": "30.5.2", "@jest/get-type": "30.5.0", "@jest/snapshot-utils": "30.5.1", - "@jest/transform": "30.5.1", + "@jest/transform": "30.5.2", "@jest/types": "30.5.1", "babel-preset-current-node-syntax": "^1.2.0", "chalk": "^4.1.2", - "expect": "30.5.1", + "expect": "30.5.2", "graceful-fs": "^4.2.11", - "jest-diff": "30.5.1", - "jest-matcher-utils": "30.5.1", + "jest-diff": "30.5.2", + "jest-matcher-utils": "30.5.2", "jest-message-util": "30.5.1", "jest-util": "30.5.1", "pretty-format": "30.5.1", @@ -5354,13 +5355,13 @@ } }, "node_modules/jest-watcher": { - "version": "30.5.1", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-30.5.1.tgz", - "integrity": "sha512-+FHJ7C+S7b3ySfhA1aFmoa6TztsnwZVv84ycPRn0tVN93np2EU4b8C/KadqA3l6igdjgLBTnUotab9ER0HLG8A==", + "version": "30.5.2", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-30.5.2.tgz", + "integrity": "sha512-rqRgg4R11GA9m1UsEZwQeixHsgZReCn6TOHAHtIH33yXrIvoX0OGPA20Yzzjkz7X40fZvcRSxEpQppYPcWzmcQ==", "dev": true, "license": "MIT", "dependencies": { - "@jest/test-result": "30.5.1", + "@jest/test-result": "30.5.2", "@jest/types": "30.5.1", "@types/node": "*", "ansi-escapes": "^4.3.2", @@ -5744,9 +5745,9 @@ "license": "MIT" }, "node_modules/node-releases": { - "version": "2.0.55", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.55.tgz", - "integrity": "sha512-mIrE/Cw9y+9Au6dS5vDKDhQza9YvG6w+ZrS6X+ZzA7yFW/soAeaups4Qzn1bL6g5FVy8WtP79+0j82oPIbqRjQ==", + "version": "2.0.57", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.57.tgz", + "integrity": "sha512-kQK9LGGFiHtrWiNhZtA7Qbw17AQz+dmsEKODRIVTXA9+e5MS/2gZEBhYJt13GrAz5/IOZKddH/0Z3TP/Zgo+yw==", "dev": true, "license": "MIT", "engines": { @@ -5926,9 +5927,9 @@ } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "11.5.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.2.tgz", - "integrity": "sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==", + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", "dev": true, "license": "BlueOak-1.0.0", "engines": { @@ -6246,9 +6247,9 @@ } }, "node_modules/rollup": { - "version": "4.63.3", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.63.3.tgz", - "integrity": "sha512-1i2XreiAoMMXuPGD6Msj2xWrMMkHojNRKivInxGQcg7/1KuPuYlfUutLyh4drnOxUTHX9cHI4wFoat8D/NKaBw==", + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.63.5.tgz", + "integrity": "sha512-KRWwmNLlPw5M7HcdYfm15oBv9n9LPtjzpzCIxS/phwqvPyxHSoKX6Y2YU3pxSPfy0CLquVgsx/j/hBi6OvH1Nw==", "dev": true, "license": "MIT", "dependencies": { @@ -6263,31 +6264,31 @@ }, "optionalDependencies": { "@napi-rs/lzma-linux-x64-gnu": "1.5.1", - "@rollup/rollup-android-arm-eabi": "4.63.3", - "@rollup/rollup-android-arm64": "4.63.3", - "@rollup/rollup-darwin-arm64": "4.63.3", - "@rollup/rollup-darwin-x64": "4.63.3", - "@rollup/rollup-freebsd-arm64": "4.63.3", - "@rollup/rollup-freebsd-x64": "4.63.3", - "@rollup/rollup-linux-arm-gnueabihf": "4.63.3", - "@rollup/rollup-linux-arm-musleabihf": "4.63.3", - "@rollup/rollup-linux-arm64-gnu": "4.63.3", - "@rollup/rollup-linux-arm64-musl": "4.63.3", - "@rollup/rollup-linux-loong64-gnu": "4.63.3", - "@rollup/rollup-linux-loong64-musl": "4.63.3", - "@rollup/rollup-linux-ppc64-gnu": "4.63.3", - "@rollup/rollup-linux-ppc64-musl": "4.63.3", - "@rollup/rollup-linux-riscv64-gnu": "4.63.3", - "@rollup/rollup-linux-riscv64-musl": "4.63.3", - "@rollup/rollup-linux-s390x-gnu": "4.63.3", - "@rollup/rollup-linux-x64-gnu": "4.63.3", - "@rollup/rollup-linux-x64-musl": "4.63.3", - "@rollup/rollup-openbsd-x64": "4.63.3", - "@rollup/rollup-openharmony-arm64": "4.63.3", - "@rollup/rollup-win32-arm64-msvc": "4.63.3", - "@rollup/rollup-win32-ia32-msvc": "4.63.3", - "@rollup/rollup-win32-x64-gnu": "4.63.3", - "@rollup/rollup-win32-x64-msvc": "4.63.3", + "@rollup/rollup-android-arm-eabi": "4.63.5", + "@rollup/rollup-android-arm64": "4.63.5", + "@rollup/rollup-darwin-arm64": "4.63.5", + "@rollup/rollup-darwin-x64": "4.63.5", + "@rollup/rollup-freebsd-arm64": "4.63.5", + "@rollup/rollup-freebsd-x64": "4.63.5", + "@rollup/rollup-linux-arm-gnueabihf": "4.63.5", + "@rollup/rollup-linux-arm-musleabihf": "4.63.5", + "@rollup/rollup-linux-arm64-gnu": "4.63.5", + "@rollup/rollup-linux-arm64-musl": "4.63.5", + "@rollup/rollup-linux-loong64-gnu": "4.63.5", + "@rollup/rollup-linux-loong64-musl": "4.63.5", + "@rollup/rollup-linux-ppc64-gnu": "4.63.5", + "@rollup/rollup-linux-ppc64-musl": "4.63.5", + "@rollup/rollup-linux-riscv64-gnu": "4.63.5", + "@rollup/rollup-linux-riscv64-musl": "4.63.5", + "@rollup/rollup-linux-s390x-gnu": "4.63.5", + "@rollup/rollup-linux-x64-gnu": "4.63.5", + "@rollup/rollup-linux-x64-musl": "4.63.5", + "@rollup/rollup-openbsd-x64": "4.63.5", + "@rollup/rollup-openharmony-arm64": "4.63.5", + "@rollup/rollup-win32-arm64-msvc": "4.63.5", + "@rollup/rollup-win32-ia32-msvc": "4.63.5", + "@rollup/rollup-win32-x64-gnu": "4.63.5", + "@rollup/rollup-win32-x64-msvc": "4.63.5", "fsevents": "~2.3.2" } }, @@ -6827,9 +6828,9 @@ "license": "MIT" }, "node_modules/undici": { - "version": "6.28.1", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.28.1.tgz", - "integrity": "sha512-zWpdTVD54H48CIybL0rWQ3ukpb9d23wM7eH5RtfdmeP70cWHNjtfo7P4vZX+5CoDcO53J4Pu5uXp7lNfjc6DRA==", + "version": "6.29.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.29.0.tgz", + "integrity": "sha512-R+RODBqp6i2pPflGdq+xIOUkl+RNfGgHwoinecKu/JCuf2uO06cOKoDbI2P7Dn6KcswdKwrczbU6IYJ6K8X+wg==", "license": "MIT", "engines": { "node": ">=18.17" diff --git a/package.json b/package.json index 4c31325e..e69605d1 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "node-appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "30.0.0", + "version": "30.0.0-rc.2", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", @@ -67,6 +67,6 @@ "overrides": { "esbuild": "^0.28.1", "js-yaml": "^4.2.0", - "brace-expansion": "5.0.9" + "brace-expansion": "5.0.12" } } diff --git a/src/client.ts b/src/client.ts index da821dd3..393e2b4f 100644 --- a/src/client.ts +++ b/src/client.ts @@ -80,7 +80,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/30.0.0'; + let ua = 'AppwriteNodeJSSDK/30.0.0-rc.2'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -141,7 +141,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '30.0.0', + 'x-sdk-version': '30.0.0-rc.2', 'user-agent': getUserAgent(), 'X-Appwrite-Response-Format': '2.3.0', }; @@ -432,6 +432,11 @@ class Client { for (const nestedValue of value) { formData.append(`${key}[]`, nestedValue); } + } else if ( + value !== null && + typeof value === 'object' + ) { + formData.append(key, JSONbig.stringify(value)); } else { formData.append(key, value); } @@ -453,6 +458,7 @@ class Client { headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void, + responseType = 'json', ) { const [fileParam, file] = Object.entries(originalPayload).find( @@ -461,16 +467,28 @@ class Client { ) ?? []; if (!file || !fileParam) { - throw new Error('File not found in payload'); + return await this.call( + method, + url, + headers, + originalPayload, + responseType, + ); } if (file instanceof InputFile) { const size = await file.size(); - if (size <= Client.CHUNK_SIZE) { + if (size <= Client.CHUNK_SIZE || responseType === 'text') { const payload = { ...originalPayload }; payload[fileParam] = await file.toFile(); - return await this.call(method, url, headers, payload); + return await this.call( + method, + url, + headers, + payload, + responseType, + ); } const totalChunks = Math.ceil(size / Client.CHUNK_SIZE); @@ -490,6 +508,7 @@ class Client { url, firstChunkHeaders, firstPayload, + responseType, ); const uploadId = response?.$id; @@ -550,6 +569,7 @@ class Client { url, chunkHeaders, chunkPayload, + responseType, ); if (failed) { @@ -603,8 +623,14 @@ class Client { return finalResponse ?? lastResponse; } - if (file.size <= Client.CHUNK_SIZE) { - return await this.call(method, url, headers, originalPayload); + if (file.size <= Client.CHUNK_SIZE || responseType === 'text') { + return await this.call( + method, + url, + headers, + originalPayload, + responseType, + ); } const totalChunks = Math.ceil(file.size / Client.CHUNK_SIZE); @@ -624,6 +650,7 @@ class Client { url, firstChunkHeaders, firstPayload, + responseType, ); const uploadId = response?.$id; @@ -684,6 +711,7 @@ class Client { url, chunkHeaders, chunkPayload, + responseType, ); if (failed) { @@ -796,7 +824,9 @@ class Client { ); } - if ( + if (responseType === 'text' && response.status < 400) { + data = await response.text(); + } else if ( response.headers.get('content-type')?.includes('application/json') ) { data = JSONbig.parse(await response.text()); diff --git a/src/enums/o-auth-2-auth-0-prompt.ts b/src/enums/o-auth-2-auth-0-prompt.ts new file mode 100644 index 00000000..e015cae0 --- /dev/null +++ b/src/enums/o-auth-2-auth-0-prompt.ts @@ -0,0 +1,5 @@ +export enum OAuth2Auth0Prompt { + None = 'none', + Login = 'login', + Consent = 'consent', +} diff --git a/src/enums/o-auth-2-discord-prompt.ts b/src/enums/o-auth-2-discord-prompt.ts new file mode 100644 index 00000000..ece22e48 --- /dev/null +++ b/src/enums/o-auth-2-discord-prompt.ts @@ -0,0 +1,4 @@ +export enum OAuth2DiscordPrompt { + None = 'none', + Consent = 'consent', +} diff --git a/src/enums/o-auth-2-github-prompt.ts b/src/enums/o-auth-2-github-prompt.ts new file mode 100644 index 00000000..0519185f --- /dev/null +++ b/src/enums/o-auth-2-github-prompt.ts @@ -0,0 +1,3 @@ +export enum OAuth2GithubPrompt { + SelectAccount = 'select_account', +} diff --git a/src/enums/o-auth-2-kakao-prompt.ts b/src/enums/o-auth-2-kakao-prompt.ts new file mode 100644 index 00000000..2b5713a5 --- /dev/null +++ b/src/enums/o-auth-2-kakao-prompt.ts @@ -0,0 +1,6 @@ +export enum OAuth2KakaoPrompt { + None = 'none', + Login = 'login', + Create = 'create', + SelectAccount = 'select_account', +} diff --git a/src/enums/o-auth-2-microsoft-prompt.ts b/src/enums/o-auth-2-microsoft-prompt.ts new file mode 100644 index 00000000..53689659 --- /dev/null +++ b/src/enums/o-auth-2-microsoft-prompt.ts @@ -0,0 +1,6 @@ +export enum OAuth2MicrosoftPrompt { + None = 'none', + Login = 'login', + Consent = 'consent', + SelectAccount = 'select_account', +} diff --git a/src/enums/o-auth-2-okta-prompt.ts b/src/enums/o-auth-2-okta-prompt.ts new file mode 100644 index 00000000..8e279048 --- /dev/null +++ b/src/enums/o-auth-2-okta-prompt.ts @@ -0,0 +1,5 @@ +export enum OAuth2OktaPrompt { + None = 'none', + Login = 'login', + Consent = 'consent', +} diff --git a/src/enums/o-auth-2-salesforce-prompt.ts b/src/enums/o-auth-2-salesforce-prompt.ts new file mode 100644 index 00000000..131dd107 --- /dev/null +++ b/src/enums/o-auth-2-salesforce-prompt.ts @@ -0,0 +1,4 @@ +export enum OAuth2SalesforcePrompt { + Login = 'login', + Consent = 'consent', +} diff --git a/src/enums/o-auth-2-zoho-prompt.ts b/src/enums/o-auth-2-zoho-prompt.ts new file mode 100644 index 00000000..22ac9540 --- /dev/null +++ b/src/enums/o-auth-2-zoho-prompt.ts @@ -0,0 +1,3 @@ +export enum OAuth2ZohoPrompt { + Consent = 'consent', +} diff --git a/src/enums/o-auth-provider.ts b/src/enums/o-auth-provider.ts index 92a95970..3dab5fb3 100644 --- a/src/enums/o-auth-provider.ts +++ b/src/enums/o-auth-provider.ts @@ -41,6 +41,7 @@ export enum OAuthProvider { Tradeshift = 'tradeshift', TradeshiftBox = 'tradeshiftBox', Twitch = 'twitch', + Webflow = 'webflow', Wordpress = 'wordpress', X = 'x', Yahoo = 'yahoo', diff --git a/src/enums/project-key-scopes.ts b/src/enums/project-key-scopes.ts index d7cb41cf..48ab459e 100644 --- a/src/enums/project-key-scopes.ts +++ b/src/enums/project-key-scopes.ts @@ -89,6 +89,7 @@ export enum ProjectKeyScopes { WebhooksWrite = 'webhooks.write', LocaleRead = 'locale.read', AvatarsRead = 'avatars.read', + AvatarsWrite = 'avatars.write', HealthRead = 'health.read', AssistantRead = 'assistant.read', MigrationsRead = 'migrations.read', diff --git a/src/enums/project-o-auth-2-auth-0-prompt.ts b/src/enums/project-o-auth-2-auth-0-prompt.ts new file mode 100644 index 00000000..a09f94f7 --- /dev/null +++ b/src/enums/project-o-auth-2-auth-0-prompt.ts @@ -0,0 +1,5 @@ +export enum ProjectOAuth2Auth0Prompt { + None = 'none', + Login = 'login', + Consent = 'consent', +} diff --git a/src/enums/project-o-auth-2-discord-prompt.ts b/src/enums/project-o-auth-2-discord-prompt.ts new file mode 100644 index 00000000..ec81b72b --- /dev/null +++ b/src/enums/project-o-auth-2-discord-prompt.ts @@ -0,0 +1,4 @@ +export enum ProjectOAuth2DiscordPrompt { + None = 'none', + Consent = 'consent', +} diff --git a/src/enums/project-o-auth-2-git-hub-prompt.ts b/src/enums/project-o-auth-2-git-hub-prompt.ts new file mode 100644 index 00000000..9abd5121 --- /dev/null +++ b/src/enums/project-o-auth-2-git-hub-prompt.ts @@ -0,0 +1,3 @@ +export enum ProjectOAuth2GitHubPrompt { + SelectAccount = 'select_account', +} diff --git a/src/enums/project-o-auth-2-kakao-prompt.ts b/src/enums/project-o-auth-2-kakao-prompt.ts new file mode 100644 index 00000000..6eae8b29 --- /dev/null +++ b/src/enums/project-o-auth-2-kakao-prompt.ts @@ -0,0 +1,6 @@ +export enum ProjectOAuth2KakaoPrompt { + None = 'none', + Login = 'login', + Create = 'create', + SelectAccount = 'select_account', +} diff --git a/src/enums/project-o-auth-2-microsoft-prompt.ts b/src/enums/project-o-auth-2-microsoft-prompt.ts new file mode 100644 index 00000000..27ff7b26 --- /dev/null +++ b/src/enums/project-o-auth-2-microsoft-prompt.ts @@ -0,0 +1,6 @@ +export enum ProjectOAuth2MicrosoftPrompt { + None = 'none', + Login = 'login', + Consent = 'consent', + SelectAccount = 'select_account', +} diff --git a/src/enums/project-o-auth-2-okta-prompt.ts b/src/enums/project-o-auth-2-okta-prompt.ts new file mode 100644 index 00000000..eedf1a01 --- /dev/null +++ b/src/enums/project-o-auth-2-okta-prompt.ts @@ -0,0 +1,5 @@ +export enum ProjectOAuth2OktaPrompt { + None = 'none', + Login = 'login', + Consent = 'consent', +} diff --git a/src/enums/project-o-auth-2-salesforce-prompt.ts b/src/enums/project-o-auth-2-salesforce-prompt.ts new file mode 100644 index 00000000..777d4a91 --- /dev/null +++ b/src/enums/project-o-auth-2-salesforce-prompt.ts @@ -0,0 +1,4 @@ +export enum ProjectOAuth2SalesforcePrompt { + Login = 'login', + Consent = 'consent', +} diff --git a/src/enums/project-o-auth-2-zoho-prompt.ts b/src/enums/project-o-auth-2-zoho-prompt.ts new file mode 100644 index 00000000..6f67a617 --- /dev/null +++ b/src/enums/project-o-auth-2-zoho-prompt.ts @@ -0,0 +1,3 @@ +export enum ProjectOAuth2ZohoPrompt { + Consent = 'consent', +} diff --git a/src/enums/project-o-auth-provider-id.ts b/src/enums/project-o-auth-provider-id.ts index 3ab5db15..ddfc17c3 100644 --- a/src/enums/project-o-auth-provider-id.ts +++ b/src/enums/project-o-auth-provider-id.ts @@ -41,6 +41,7 @@ export enum ProjectOAuthProviderId { Tradeshift = 'tradeshift', TradeshiftBox = 'tradeshiftBox', Twitch = 'twitch', + Webflow = 'webflow', Wordpress = 'wordpress', X = 'x', Yahoo = 'yahoo', diff --git a/src/enums/proxy-rule-deployment-resource-type.ts b/src/enums/proxy-rule-deployment-resource-type.ts index ef695072..2b1c942c 100644 --- a/src/enums/proxy-rule-deployment-resource-type.ts +++ b/src/enums/proxy-rule-deployment-resource-type.ts @@ -1,4 +1,5 @@ export enum ProxyRuleDeploymentResourceType { Function = 'function', Site = 'site', + DedicatedDatabase = 'dedicatedDatabase', } diff --git a/src/index.ts b/src/index.ts index 9c7dfa73..30424860 100644 --- a/src/index.ts +++ b/src/index.ts @@ -34,6 +34,7 @@ export type { QueryTypes, QueryTypesList } from './query'; export { Permission } from './permission'; export { Role } from './role'; export { ID } from './id'; +export { Topic, ResolvedTopic } from './topic'; export { Operator, Condition } from './operator'; export { AuthenticatorType } from './enums/authenticator-type'; export { AuthenticationFactor } from './enums/authentication-factor'; @@ -64,8 +65,16 @@ export { MessagePriority } from './enums/message-priority'; export { SmtpEncryption } from './enums/smtp-encryption'; export { Region } from './enums/region'; export { ProjectAuthMethodId } from './enums/project-auth-method-id'; +export { ProjectOAuth2Auth0Prompt } from './enums/project-o-auth-2-auth-0-prompt'; +export { ProjectOAuth2DiscordPrompt } from './enums/project-o-auth-2-discord-prompt'; +export { ProjectOAuth2GitHubPrompt } from './enums/project-o-auth-2-git-hub-prompt'; export { ProjectOAuth2GooglePrompt } from './enums/project-o-auth-2-google-prompt'; +export { ProjectOAuth2KakaoPrompt } from './enums/project-o-auth-2-kakao-prompt'; +export { ProjectOAuth2MicrosoftPrompt } from './enums/project-o-auth-2-microsoft-prompt'; export { ProjectOAuth2OidcPrompt } from './enums/project-o-auth-2-oidc-prompt'; +export { ProjectOAuth2OktaPrompt } from './enums/project-o-auth-2-okta-prompt'; +export { ProjectOAuth2SalesforcePrompt } from './enums/project-o-auth-2-salesforce-prompt'; +export { ProjectOAuth2ZohoPrompt } from './enums/project-o-auth-2-zoho-prompt'; export { ProjectOAuthProviderId } from './enums/project-o-auth-provider-id'; export { ProjectPolicyId } from './enums/project-policy-id'; export { ProjectProtocolId } from './enums/project-protocol-id'; @@ -94,8 +103,16 @@ export { DeploymentStatus } from './enums/deployment-status'; export { ExecutionResourceType } from './enums/execution-resource-type'; export { ExecutionTrigger } from './enums/execution-trigger'; export { ExecutionStatus } from './enums/execution-status'; +export { OAuth2GithubPrompt } from './enums/o-auth-2-github-prompt'; +export { OAuth2DiscordPrompt } from './enums/o-auth-2-discord-prompt'; export { OAuth2GooglePrompt } from './enums/o-auth-2-google-prompt'; +export { OAuth2ZohoPrompt } from './enums/o-auth-2-zoho-prompt'; +export { OAuth2SalesforcePrompt } from './enums/o-auth-2-salesforce-prompt'; +export { OAuth2Auth0Prompt } from './enums/o-auth-2-auth-0-prompt'; export { OAuth2OidcPrompt } from './enums/o-auth-2-oidc-prompt'; +export { OAuth2OktaPrompt } from './enums/o-auth-2-okta-prompt'; +export { OAuth2MicrosoftPrompt } from './enums/o-auth-2-microsoft-prompt'; +export { OAuth2KakaoPrompt } from './enums/o-auth-2-kakao-prompt'; export { PlatformType } from './enums/platform-type'; export { ProxyRuleDeploymentResourceType } from './enums/proxy-rule-deployment-resource-type'; export { ProxyRuleStatus } from './enums/proxy-rule-status'; diff --git a/src/models.ts b/src/models.ts index c9a19dc4..1fac7bc2 100644 --- a/src/models.ts +++ b/src/models.ts @@ -9,8 +9,16 @@ import { ExecutionStatus } from './enums/execution-status'; import { ProjectAuthMethodId } from './enums/project-auth-method-id'; import { ProjectServiceId } from './enums/project-service-id'; import { ProjectProtocolId } from './enums/project-protocol-id'; +import { OAuth2GithubPrompt } from './enums/o-auth-2-github-prompt'; +import { OAuth2DiscordPrompt } from './enums/o-auth-2-discord-prompt'; import { OAuth2GooglePrompt } from './enums/o-auth-2-google-prompt'; +import { OAuth2ZohoPrompt } from './enums/o-auth-2-zoho-prompt'; +import { OAuth2SalesforcePrompt } from './enums/o-auth-2-salesforce-prompt'; +import { OAuth2Auth0Prompt } from './enums/o-auth-2-auth-0-prompt'; import { OAuth2OidcPrompt } from './enums/o-auth-2-oidc-prompt'; +import { OAuth2OktaPrompt } from './enums/o-auth-2-okta-prompt'; +import { OAuth2MicrosoftPrompt } from './enums/o-auth-2-microsoft-prompt'; +import { OAuth2KakaoPrompt } from './enums/o-auth-2-kakao-prompt'; import { PlatformType } from './enums/platform-type'; import { ProxyRuleDeploymentResourceType } from './enums/proxy-rule-deployment-resource-type'; import { ProxyRuleStatus } from './enums/proxy-rule-status'; @@ -3285,6 +3293,110 @@ export namespace Models { threads: number; }; + /** + * Account + */ + export type Account< + Preferences extends Models.Preferences = Models.DefaultPreferences, + > = { + /** + * User ID. + */ + $id: string; + /** + * User creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * User update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * User name. + */ + name: string; + /** + * User registration date in ISO 8601 format. + */ + registration: string; + /** + * User status. Pass `true` for enabled and `false` for disabled. + */ + status: boolean; + /** + * Labels for the user. + */ + labels: string[]; + /** + * Password update time in ISO 8601 format. + */ + passwordUpdate: string; + /** + * User email address. + */ + email: string; + /** + * User phone number in E.164 format. + */ + phone: string; + /** + * Email verification status. + */ + emailVerification: boolean; + /** + * Canonical form of the user email address. + */ + emailCanonical?: string; + /** + * Whether the user email is from a free email provider. + */ + emailIsFree?: boolean; + /** + * Whether the user email is from a disposable email provider. + */ + emailIsDisposable?: boolean; + /** + * Whether the user email is from a corporate domain. + */ + emailIsCorporate?: boolean; + /** + * Whether the user email is in its canonical form. + */ + emailIsCanonical?: boolean; + /** + * Whether the password was found in a known data breach the last time it was checked. Null when the password has never been checked. + */ + passwordPwned?: boolean; + /** + * Phone verification status. + */ + phoneVerification: boolean; + /** + * Multi factor authentication status. + */ + mfa: boolean; + /** + * User preferences as a key-value object + */ + prefs: Preferences; + /** + * A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider. + */ + targets: Target[]; + /** + * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + */ + accessedAt: string; + /** + * Whether the user can impersonate other users. + */ + impersonator?: boolean; + /** + * ID of the original actor performing the impersonation. Present only when the current request is impersonating another user. Internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data. + */ + impersonatorUserId?: string; + }; + /** * Preferences */ @@ -4702,7 +4814,7 @@ export namespace Models { */ authUsername: string; /** - * HTTP basic authentication password. + * HTTP basic authentication password. Write-only: always returned empty. */ authPassword: string; /** @@ -4849,6 +4961,10 @@ export namespace Models { * GitHub OAuth2 client secret. */ clientSecret: string; + /** + * GitHub OAuth2 prompt values. + */ + prompt: OAuth2GithubPrompt[]; }; /** @@ -4871,6 +4987,10 @@ export namespace Models { * Discord OAuth2 client secret. */ clientSecret: string; + /** + * Discord OAuth2 prompt values. + */ + prompt: OAuth2DiscordPrompt[]; }; /** @@ -5103,6 +5223,10 @@ export namespace Models { * Zoho OAuth2 client secret. */ clientSecret: string; + /** + * Zoho OAuth2 prompt values. + */ + prompt: OAuth2ZohoPrompt[]; }; /** @@ -5171,6 +5295,28 @@ export namespace Models { clientSecret: string; }; + /** + * OAuth2Webflow + */ + export type OAuth2Webflow = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Webflow OAuth2 client ID. + */ + clientId: string; + /** + * Webflow OAuth2 client secret. + */ + clientSecret: string; + }; + /** * OAuth2Twitch */ @@ -5323,6 +5469,10 @@ export namespace Models { * Salesforce OAuth2 consumer secret. */ customerSecret: string; + /** + * Salesforce OAuth2 prompt values. + */ + prompt: OAuth2SalesforcePrompt[]; }; /** @@ -5639,6 +5789,10 @@ export namespace Models { * Auth0 OAuth2 client secret. */ clientSecret: string; + /** + * Auth0 OAuth2 prompt values. + */ + prompt: OAuth2Auth0Prompt[]; /** * Auth0 OAuth2 endpoint domain. */ @@ -5721,6 +5875,10 @@ export namespace Models { * OpenID Connect OAuth2 client secret. */ clientSecret: string; + /** + * OpenID Connect prompt values controlling the authentication and consent screens. + */ + prompt: OAuth2OidcPrompt[]; /** * OpenID Connect well-known configuration URL. When set, authorization, token, and user info endpoints can be discovered automatically. */ @@ -5737,10 +5895,6 @@ export namespace Models { * OpenID Connect user info endpoint URL. */ userInfoURL: string; - /** - * OpenID Connect prompt values controlling the authentication and consent screens. - */ - prompt: OAuth2OidcPrompt[]; /** * Maximum authentication age in seconds. When set, the user must have authenticated within this many seconds. */ @@ -5767,6 +5921,10 @@ export namespace Models { * Okta OAuth2 client secret. */ clientSecret: string; + /** + * Okta OAuth2 prompt values. + */ + prompt: OAuth2OktaPrompt[]; /** * Okta OAuth2 domain. */ @@ -5857,6 +6015,10 @@ export namespace Models { * Microsoft OAuth2 application secret. */ applicationSecret: string; + /** + * Microsoft OAuth2 prompt values. + */ + prompt: OAuth2MicrosoftPrompt[]; /** * Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. */ @@ -5927,6 +6089,10 @@ export namespace Models { * Kakao OAuth2 client secret. */ clientSecret: string; + /** + * Kakao OAuth2 prompt values. + */ + prompt: OAuth2KakaoPrompt[]; }; /** @@ -5956,6 +6122,7 @@ export namespace Models { | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress + | Models.OAuth2Webflow | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify @@ -6653,7 +6820,7 @@ export namespace Models { */ deploymentId: string; /** - * Type of deployment. Possible values are "function", "site". Used if rule's type is "deployment". + * Type of deployment resource: function, site, or dedicatedDatabase. */ deploymentResourceType?: ProxyRuleDeploymentResourceType; /** @@ -7397,17 +7564,17 @@ export namespace Models { */ policyId: string; /** - * Archive size in bytes. + * Archive size in bytes. Null until the size is known. */ - size: number; + size?: number; /** * The status of the archive creation. Possible values: pending, processing, uploading, completed, failed, skipped. */ status: string; /** - * The backup start time. + * The backup start time. Null until the backup starts. */ - startedAt: string; + startedAt?: string; /** * Migration ID. */ @@ -7747,9 +7914,9 @@ export namespace Models { */ alertLimit: number; /** - * Additional resources + * Additional resources. Null when the plan does not support usage billing. */ - usage: UsageBillingPlan; + usage?: UsageBillingPlan; /** * Addons */ @@ -8551,9 +8718,9 @@ export namespace Models { */ uptime: number; /** - * Connection statistics. + * Connection statistics. Null when the database has not been probed. */ - connections: DatabaseStatusConnections; + connections?: DatabaseStatusConnections; /** * Requested replication sync mode. Possible values: async, sync, quorum. Compare with effectiveSyncMode for what the primary is enforcing. */ @@ -9279,9 +9446,9 @@ export namespace Models { */ status: string; /** - * The backup start time. + * The restoration start time. Null until the restoration starts. */ - startedAt: string; + startedAt?: string; /** * Migration ID. */ @@ -9295,9 +9462,9 @@ export namespace Models { */ resources: string[]; /** - * Optional data in key-value object. + * Restoration options as a key-value object. */ - options: string; + options: object; }; /** diff --git a/src/services/account.ts b/src/services/account.ts index 04bab0ef..1714a6f2 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -2262,12 +2262,44 @@ export class Account { /** * Get the list of active sessions across different devices for the currently logged in user. * + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.SessionList>} */ - listSessions(): Promise<Models.SessionList> { + listSessions(params?: { total?: boolean }): Promise<Models.SessionList>; + /** + * Get the list of active sessions across different devices for the currently logged in user. + * + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.SessionList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listSessions(total?: boolean): Promise<Models.SessionList>; + listSessions( + paramsOrFirst?: { total?: boolean } | boolean, + ): Promise<Models.SessionList> { + let params: { total?: boolean }; + + if ( + typeof paramsOrFirst === 'undefined' || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { total?: boolean }; + } else { + params = { + total: paramsOrFirst as boolean, + }; + } + + const total = params.total; const apiPath = '/account/sessions'; const apiPayload: Payload = {}; + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -2279,14 +2311,46 @@ export class Account { } /** - * Delete all sessions from the user account and remove any sessions cookies from the end client. + * Delete all sessions from the user account and remove any sessions cookies from the end client. Pass `current` as false to keep the session making the request and sign out of every other session. * + * @param {boolean} params.current - Delete the current session too. Use false to sign out of every other session while staying signed in on this one. * @throws {AppwriteException} * @returns {Promise<{}>} */ - deleteSessions(): Promise<{}> { + deleteSessions(params?: { current?: boolean }): Promise<{}>; + /** + * Delete all sessions from the user account and remove any sessions cookies from the end client. Pass `current` as false to keep the session making the request and sign out of every other session. + * + * @param {boolean} current - Delete the current session too. Use false to sign out of every other session while staying signed in on this one. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteSessions(current?: boolean): Promise<{}>; + deleteSessions( + paramsOrFirst?: { current?: boolean } | boolean, + ): Promise<{}> { + let params: { current?: boolean }; + + if ( + typeof paramsOrFirst === 'undefined' || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { current?: boolean }; + } else { + params = { + current: paramsOrFirst as boolean, + }; + } + + const current = params.current; const apiPath = '/account/sessions'; const apiPayload: Payload = {}; + if (typeof current !== 'undefined') { + apiPayload['current'] = current; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -2319,26 +2383,29 @@ export class Account { } /** - * Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user. + * Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user. Use the optional `duration` parameter to create a shorter session, for example when the user doesn't choose "remember me". It must be at least 60 seconds and cannot exceed the project maximum session length. * * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * * @param {string} params.email - User email. * @param {string} params.password - User password. Must be at least 8 chars. + * @param {number} params.duration - Session length in seconds. Minimum is 60 seconds, and it cannot exceed the project maximum session length. Defaults to the project maximum session length. * @throws {AppwriteException} * @returns {Promise<Models.Session>} */ createEmailPasswordSession(params: { email: string; password: string; + duration?: number; }): Promise<Models.Session>; /** - * Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user. + * Allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user. Use the optional `duration` parameter to create a shorter session, for example when the user doesn't choose "remember me". It must be at least 60 seconds and cannot exceed the project maximum session length. * * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * * @param {string} email - User email. * @param {string} password - User password. Must be at least 8 chars. + * @param {number} duration - Session length in seconds. Minimum is 60 seconds, and it cannot exceed the project maximum session length. Defaults to the project maximum session length. * @throws {AppwriteException} * @returns {Promise<Models.Session>} * @deprecated Use the object parameter style method for a better developer experience. @@ -2346,12 +2413,14 @@ export class Account { createEmailPasswordSession( email: string, password: string, + duration?: number, ): Promise<Models.Session>; createEmailPasswordSession( - paramsOrFirst: { email: string; password: string } | string, - ...rest: [string?] + paramsOrFirst: + { email: string; password: string; duration?: number } | string, + ...rest: [string?, number?] ): Promise<Models.Session> { - let params: { email: string; password: string }; + let params: { email: string; password: string; duration?: number }; if ( paramsOrFirst && @@ -2361,16 +2430,19 @@ export class Account { params = (paramsOrFirst || {}) as { email: string; password: string; + duration?: number; }; } else { params = { email: paramsOrFirst as string, password: rest[0] as string, + duration: rest[1] as number, }; } const email = params.email; const password = params.password; + const duration = params.duration; if (typeof email === 'undefined') { throw new AppwriteException('Missing required parameter: "email"'); } @@ -2387,6 +2459,9 @@ export class Account { if (typeof password !== 'undefined') { apiPayload['password'] = password; } + if (typeof duration !== 'undefined') { + apiPayload['duration'] = duration; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -3172,7 +3247,7 @@ export class Account { * * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * - * @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, kakao, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, resend, salesforce, slack, spotify, stripe, tiktok, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. + * @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, kakao, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, resend, salesforce, slack, spotify, stripe, tiktok, tradeshift, tradeshiftBox, twitch, webflow, wordpress, x, yahoo, yammer, yandex, zoho, zoom. * @param {string} params.success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string} params.failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string[]} params.scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. @@ -3194,7 +3269,7 @@ export class Account { * * A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits). * - * @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, kakao, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, resend, salesforce, slack, spotify, stripe, tiktok, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. + * @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, appwrite, auth0, authentik, autodesk, bitbucket, bitly, box, cloudflare, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, huggingface, kakao, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, resend, salesforce, slack, spotify, stripe, tiktok, tradeshift, tradeshiftBox, twitch, webflow, wordpress, x, yahoo, yammer, yandex, zoho, zoom. * @param {string} success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string} failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. * @param {string[]} scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long. diff --git a/src/services/avatars.ts b/src/services/avatars.ts index 4f83eb0e..6faed762 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -1,4 +1,11 @@ -import { AppwriteException, Client, type Payload } from '../client'; +import { + AppwriteException, + Client, + type Payload, + UploadProgress, +} from '../client'; +import type { Models } from '../models'; +import { InputFile } from '../inputFile'; import { Browser } from '../enums/browser'; import { CreditCard } from '../enums/credit-card'; @@ -634,7 +641,7 @@ export class Avatars { } /** - * Returns the best available profile photo for a user. The endpoint tries each source in priority order and returns the first successful result: OAuth2 identity photo, Gravatar, Libravatar, Appwrite Initials, built-in static fallback. + * Returns the best available profile photo for a user. The endpoint tries each source in priority order and returns the first successful result: a custom uploaded photo (see avatars.updatePhoto), OAuth2 identity photo, Gravatar, Libravatar, Appwrite Initials, built-in static fallback. * * Passing `userId` — `current()` for the authenticated user — resolves the photo from everything known about that user: identity photos, email, and name. An explicit `emailHash` or `name` then overrides just that value, and the user's remaining sources stay in the chain. Without `userId`, passing `emailHash` and/or `name` resolves the avatar from those values alone: the hash is looked up on Gravatar and Libravatar, the name is rendered as initials, and the session user stays out of the chain so their own photo never shadows the avatar being asked for. When nothing is passed, the photo resolves for the currently authenticated user. Emails are only ever accepted pre-hashed, so no address ends up in a URL. * @@ -660,7 +667,7 @@ export class Avatars { name?: string; }): Promise<ArrayBuffer>; /** - * Returns the best available profile photo for a user. The endpoint tries each source in priority order and returns the first successful result: OAuth2 identity photo, Gravatar, Libravatar, Appwrite Initials, built-in static fallback. + * Returns the best available profile photo for a user. The endpoint tries each source in priority order and returns the first successful result: a custom uploaded photo (see avatars.updatePhoto), OAuth2 identity photo, Gravatar, Libravatar, Appwrite Initials, built-in static fallback. * * Passing `userId` — `current()` for the authenticated user — resolves the photo from everything known about that user: identity photos, email, and name. An explicit `emailHash` or `name` then overrides just that value, and the user's remaining sources stay in the chain. Without `userId`, passing `emailHash` and/or `name` resolves the avatar from those values alone: the hash is looked up on Gravatar and Libravatar, the name is rendered as initials, and the session user stays out of the chain so their own photo never shadows the avatar being asked for. When nothing is passed, the photo resolves for the currently authenticated user. Emails are only ever accepted pre-hashed, so no address ends up in a URL. * @@ -791,6 +798,111 @@ export class Avatars { ); } + /** + * Update the profile photo of the currently authenticated user. The uploaded image takes priority over every other photo source, including OAuth2 identity photos, Gravatar, and Libravatar. Updating an already customized photo replaces it. The image must be at most 5MB and is sent in a single request. + * + * @param {File | InputFile} params.file - Binary image file of at most 5MB. Allowed file types are png, jpg, jpeg, and webp. + * @throws {AppwriteException} + * @returns {Promise<Models.Account<Preferences>>} + */ + updatePhoto< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >(params: { + file: File | InputFile; + onProgress?: (progress: UploadProgress) => void; + }): Promise<Models.Account<Preferences>>; + /** + * Update the profile photo of the currently authenticated user. The uploaded image takes priority over every other photo source, including OAuth2 identity photos, Gravatar, and Libravatar. Updating an already customized photo replaces it. The image must be at most 5MB and is sent in a single request. + * + * @param {File | InputFile} file - Binary image file of at most 5MB. Allowed file types are png, jpg, jpeg, and webp. + * @throws {AppwriteException} + * @returns {Promise<Models.Account<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePhoto< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + file: File | InputFile, + onProgress?: (progress: UploadProgress) => void, + ): Promise<Models.Account<Preferences>>; + updatePhoto< + Preferences extends Models.Preferences = Models.DefaultPreferences, + >( + paramsOrFirst: + | { + file: File | InputFile; + onProgress?: (progress: UploadProgress) => void; + } + | File + | InputFile, + ...rest: [((progress: UploadProgress) => void)?] + ): Promise<Models.Account<Preferences>> { + let params: { file: File | InputFile }; + let onProgress: (progress: UploadProgress) => void; + + if ( + paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst) && + ('file' in paramsOrFirst || 'onProgress' in paramsOrFirst) + ) { + params = (paramsOrFirst || {}) as { file: File | InputFile }; + onProgress = paramsOrFirst?.onProgress as ( + progress: UploadProgress, + ) => void; + } else { + params = { + file: paramsOrFirst as File | InputFile, + }; + onProgress = rest[0] as (progress: UploadProgress) => void; + } + + const file = params.file; + if (typeof file === 'undefined') { + throw new AppwriteException('Missing required parameter: "file"'); + } + const apiPath = '/avatars/photo'; + const apiPayload: Payload = {}; + if (typeof file !== 'undefined') { + apiPayload['file'] = file; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'multipart/form-data', + accept: 'application/json', + }; + + return this.client.chunkedUpload( + 'put', + uri, + apiHeaders, + apiPayload, + onProgress, + ); + } + + /** + * Delete the profile photo of the currently authenticated user and store the built-in static placeholder in its place. The placeholder is the user's photo from then on, so it takes priority over every other photo source — OAuth2 identity photos, Gravatar, Libravatar, and initials — until a new photo is uploaded with avatars.updatePhoto. + * + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deletePhoto(): Promise<{}> { + const apiPath = '/avatars/photo'; + const apiPayload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('delete', uri, apiHeaders, apiPayload); + } + /** * Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. * @@ -909,7 +1021,7 @@ export class Avatars { * When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px. * * @param {string} params.url - Website URL which you want to capture. - * @param {object} params.headers - HTTP headers to send with the browser request. Defaults to empty. + * @param {object} params.headers - HTTP headers to send with the browser request. Only Accept and Accept-Language are allowed. Defaults to empty. * @param {number} params.viewportWidth - Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280. * @param {number} params.viewportHeight - Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720. * @param {number} params.scale - Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1. @@ -961,7 +1073,7 @@ export class Avatars { * When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px. * * @param {string} url - Website URL which you want to capture. - * @param {object} headers - HTTP headers to send with the browser request. Defaults to empty. + * @param {object} headers - HTTP headers to send with the browser request. Only Accept and Accept-Language are allowed. Defaults to empty. * @param {number} viewportWidth - Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280. * @param {number} viewportHeight - Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720. * @param {number} scale - Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1. diff --git a/src/services/databases.ts b/src/services/databases.ts index 81015d75..03929fd9 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -186,46 +186,61 @@ export class Databases { * List transactions across all databases. * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.TransactionList>} * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listTransactions` instead. */ listTransactions(params?: { queries?: string[]; + total?: boolean; }): Promise<Models.TransactionList>; /** * List transactions across all databases. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.TransactionList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listTransactions(queries?: string[]): Promise<Models.TransactionList>; listTransactions( - paramsOrFirst?: { queries?: string[] } | string[], + queries?: string[], + total?: boolean, + ): Promise<Models.TransactionList>; + listTransactions( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise<Models.TransactionList> { - let params: { queries?: string[] }; + let params: { queries?: string[]; total?: boolean }; if ( - typeof paramsOrFirst === 'undefined' || + (typeof paramsOrFirst === 'undefined' && rest.length === 0) || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) ) { - params = (paramsOrFirst || {}) as { queries?: string[] }; + params = (paramsOrFirst || {}) as { + queries?: string[]; + total?: boolean; + }; } else { params = { queries: paramsOrFirst as string[], + total: rest[0] as boolean, }; } const queries = params.queries; + const total = params.total; const apiPath = '/databases/transactions'; const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { apiPayload['queries'] = queries; } + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/documents-db.ts b/src/services/documents-db.ts index a8af65d8..823cf872 100644 --- a/src/services/documents-db.ts +++ b/src/services/documents-db.ts @@ -232,45 +232,60 @@ export class DocumentsDB { * List transactions across all databases. * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.TransactionList>} */ listTransactions(params?: { queries?: string[]; + total?: boolean; }): Promise<Models.TransactionList>; /** * List transactions across all databases. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.TransactionList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listTransactions(queries?: string[]): Promise<Models.TransactionList>; listTransactions( - paramsOrFirst?: { queries?: string[] } | string[], + queries?: string[], + total?: boolean, + ): Promise<Models.TransactionList>; + listTransactions( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise<Models.TransactionList> { - let params: { queries?: string[] }; + let params: { queries?: string[]; total?: boolean }; if ( - typeof paramsOrFirst === 'undefined' || + (typeof paramsOrFirst === 'undefined' && rest.length === 0) || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) ) { - params = (paramsOrFirst || {}) as { queries?: string[] }; + params = (paramsOrFirst || {}) as { + queries?: string[]; + total?: boolean; + }; } else { params = { queries: paramsOrFirst as string[], + total: rest[0] as boolean, }; } const queries = params.queries; + const total = params.total; const apiPath = '/documentsdb/transactions'; const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { apiPayload['queries'] = queries; } + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/domains.ts b/src/services/domains.ts index 910dcb1c..7550437a 100644 --- a/src/services/domains.ts +++ b/src/services/domains.ts @@ -4519,20 +4519,20 @@ export class Domains { * * @param {string} params.domainId - Domain unique ID. * @throws {AppwriteException} - * @returns {Promise<{}>} + * @returns {Promise<string>} */ - getZone(params: { domainId: string }): Promise<{}>; + getZone(params: { domainId: string }): Promise<string>; /** * Retrieve the DNS zone file for the given domain. This endpoint will return the DNS * zone file in a standardized format that can be used to configure DNS servers. * * @param {string} domainId - Domain unique ID. * @throws {AppwriteException} - * @returns {Promise<{}>} + * @returns {Promise<string>} * @deprecated Use the object parameter style method for a better developer experience. */ - getZone(domainId: string): Promise<{}>; - getZone(paramsOrFirst: { domainId: string } | string): Promise<{}> { + getZone(domainId: string): Promise<string>; + getZone(paramsOrFirst: { domainId: string } | string): Promise<string> { let params: { domainId: string }; if ( @@ -4565,7 +4565,7 @@ export class Domains { accept: 'text/plain', }; - return this.client.call('get', uri, apiHeaders, apiPayload); + return this.client.call('get', uri, apiHeaders, apiPayload, 'text'); } /** diff --git a/src/services/functions.ts b/src/services/functions.ts index 1a50b7af..8af9565c 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -453,12 +453,44 @@ export class Functions { /** * Get a list of all runtimes that are currently active on your instance. * + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.RuntimeList>} + */ + listRuntimes(params?: { total?: boolean }): Promise<Models.RuntimeList>; + /** + * Get a list of all runtimes that are currently active on your instance. + * + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.RuntimeList>} + * @deprecated Use the object parameter style method for a better developer experience. */ - listRuntimes(): Promise<Models.RuntimeList> { + listRuntimes(total?: boolean): Promise<Models.RuntimeList>; + listRuntimes( + paramsOrFirst?: { total?: boolean } | boolean, + ): Promise<Models.RuntimeList> { + let params: { total?: boolean }; + + if ( + typeof paramsOrFirst === 'undefined' || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { total?: boolean }; + } else { + params = { + total: paramsOrFirst as boolean, + }; + } + + const total = params.total; const apiPath = '/functions/runtimes'; const apiPayload: Payload = {}; + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -473,45 +505,60 @@ export class Functions { * List allowed function specifications for this instance. * * @param {string} params.type - Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.SpecificationList>} */ listSpecifications(params?: { type?: string; + total?: boolean; }): Promise<Models.SpecificationList>; /** * List allowed function specifications for this instance. * * @param {string} type - Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.SpecificationList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listSpecifications(type?: string): Promise<Models.SpecificationList>; listSpecifications( - paramsOrFirst?: { type?: string } | string, + type?: string, + total?: boolean, + ): Promise<Models.SpecificationList>; + listSpecifications( + paramsOrFirst?: { type?: string; total?: boolean } | string, + ...rest: [boolean?] ): Promise<Models.SpecificationList> { - let params: { type?: string }; + let params: { type?: string; total?: boolean }; if ( - typeof paramsOrFirst === 'undefined' || + (typeof paramsOrFirst === 'undefined' && rest.length === 0) || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) ) { - params = (paramsOrFirst || {}) as { type?: string }; + params = (paramsOrFirst || {}) as { + type?: string; + total?: boolean; + }; } else { params = { type: paramsOrFirst as string, + total: rest[0] as boolean, }; } const type = params.type; + const total = params.total; const apiPath = '/functions/specifications'; const apiPayload: Payload = {}; if (typeof type !== 'undefined') { apiPayload['type'] = type; } + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/locale.ts b/src/services/locale.ts index 85b80390..949a1e52 100644 --- a/src/services/locale.ts +++ b/src/services/locale.ts @@ -32,12 +32,44 @@ export class Locale { /** * List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). * + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.LocaleCodeList>} */ - listCodes(): Promise<Models.LocaleCodeList> { + listCodes(params?: { total?: boolean }): Promise<Models.LocaleCodeList>; + /** + * List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). + * + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LocaleCodeList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listCodes(total?: boolean): Promise<Models.LocaleCodeList>; + listCodes( + paramsOrFirst?: { total?: boolean } | boolean, + ): Promise<Models.LocaleCodeList> { + let params: { total?: boolean }; + + if ( + typeof paramsOrFirst === 'undefined' || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { total?: boolean }; + } else { + params = { + total: paramsOrFirst as boolean, + }; + } + + const total = params.total; const apiPath = '/locale/codes'; const apiPayload: Payload = {}; + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -51,12 +83,44 @@ export class Locale { /** * List of all continents. You can use the locale header to get the data in a supported language. * + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ContinentList>} + */ + listContinents(params?: { total?: boolean }): Promise<Models.ContinentList>; + /** + * List of all continents. You can use the locale header to get the data in a supported language. + * + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.ContinentList>} + * @deprecated Use the object parameter style method for a better developer experience. */ - listContinents(): Promise<Models.ContinentList> { + listContinents(total?: boolean): Promise<Models.ContinentList>; + listContinents( + paramsOrFirst?: { total?: boolean } | boolean, + ): Promise<Models.ContinentList> { + let params: { total?: boolean }; + + if ( + typeof paramsOrFirst === 'undefined' || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { total?: boolean }; + } else { + params = { + total: paramsOrFirst as boolean, + }; + } + + const total = params.total; const apiPath = '/locale/continents'; const apiPayload: Payload = {}; + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -70,12 +134,44 @@ export class Locale { /** * List of all countries. You can use the locale header to get the data in a supported language. * + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.CountryList>} + */ + listCountries(params?: { total?: boolean }): Promise<Models.CountryList>; + /** + * List of all countries. You can use the locale header to get the data in a supported language. + * + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.CountryList>} + * @deprecated Use the object parameter style method for a better developer experience. */ - listCountries(): Promise<Models.CountryList> { + listCountries(total?: boolean): Promise<Models.CountryList>; + listCountries( + paramsOrFirst?: { total?: boolean } | boolean, + ): Promise<Models.CountryList> { + let params: { total?: boolean }; + + if ( + typeof paramsOrFirst === 'undefined' || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { total?: boolean }; + } else { + params = { + total: paramsOrFirst as boolean, + }; + } + + const total = params.total; const apiPath = '/locale/countries'; const apiPayload: Payload = {}; + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -89,12 +185,44 @@ export class Locale { /** * List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language. * + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.CountryList>} + */ + listCountriesEU(params?: { total?: boolean }): Promise<Models.CountryList>; + /** + * List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language. + * + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.CountryList>} + * @deprecated Use the object parameter style method for a better developer experience. */ - listCountriesEU(): Promise<Models.CountryList> { + listCountriesEU(total?: boolean): Promise<Models.CountryList>; + listCountriesEU( + paramsOrFirst?: { total?: boolean } | boolean, + ): Promise<Models.CountryList> { + let params: { total?: boolean }; + + if ( + typeof paramsOrFirst === 'undefined' || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { total?: boolean }; + } else { + params = { + total: paramsOrFirst as boolean, + }; + } + + const total = params.total; const apiPath = '/locale/countries/eu'; const apiPayload: Payload = {}; + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -108,12 +236,46 @@ export class Locale { /** * List of all countries phone codes. You can use the locale header to get the data in a supported language. * + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.PhoneList>} + */ + listCountriesPhones(params?: { + total?: boolean; + }): Promise<Models.PhoneList>; + /** + * List of all countries phone codes. You can use the locale header to get the data in a supported language. + * + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.PhoneList>} + * @deprecated Use the object parameter style method for a better developer experience. */ - listCountriesPhones(): Promise<Models.PhoneList> { + listCountriesPhones(total?: boolean): Promise<Models.PhoneList>; + listCountriesPhones( + paramsOrFirst?: { total?: boolean } | boolean, + ): Promise<Models.PhoneList> { + let params: { total?: boolean }; + + if ( + typeof paramsOrFirst === 'undefined' || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { total?: boolean }; + } else { + params = { + total: paramsOrFirst as boolean, + }; + } + + const total = params.total; const apiPath = '/locale/countries/phones'; const apiPayload: Payload = {}; + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -127,12 +289,44 @@ export class Locale { /** * List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language. * + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.CurrencyList>} + */ + listCurrencies(params?: { total?: boolean }): Promise<Models.CurrencyList>; + /** + * List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language. + * + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.CurrencyList>} + * @deprecated Use the object parameter style method for a better developer experience. */ - listCurrencies(): Promise<Models.CurrencyList> { + listCurrencies(total?: boolean): Promise<Models.CurrencyList>; + listCurrencies( + paramsOrFirst?: { total?: boolean } | boolean, + ): Promise<Models.CurrencyList> { + let params: { total?: boolean }; + + if ( + typeof paramsOrFirst === 'undefined' || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { total?: boolean }; + } else { + params = { + total: paramsOrFirst as boolean, + }; + } + + const total = params.total; const apiPath = '/locale/currencies'; const apiPayload: Payload = {}; + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -146,12 +340,44 @@ export class Locale { /** * List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language. * + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LanguageList>} + */ + listLanguages(params?: { total?: boolean }): Promise<Models.LanguageList>; + /** + * List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language. + * + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.LanguageList>} + * @deprecated Use the object parameter style method for a better developer experience. */ - listLanguages(): Promise<Models.LanguageList> { + listLanguages(total?: boolean): Promise<Models.LanguageList>; + listLanguages( + paramsOrFirst?: { total?: boolean } | boolean, + ): Promise<Models.LanguageList> { + let params: { total?: boolean }; + + if ( + typeof paramsOrFirst === 'undefined' || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { total?: boolean }; + } else { + params = { + total: paramsOrFirst as boolean, + }; + } + + const total = params.total; const apiPath = '/locale/languages'; const apiPayload: Payload = {}; + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/messaging.ts b/src/services/messaging.ts index 65732ac9..22256464 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -13,7 +13,7 @@ export class Messaging { /** * Get a list of all messages from the current Appwrite project. * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType, users, targets * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} @@ -27,7 +27,7 @@ export class Messaging { /** * Get a list of all messages from the current Appwrite project. * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType, users, targets * @param {string} search - Search term to filter your list results. Max length: 256 chars. * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} @@ -343,126 +343,126 @@ export class Messaging { * * * @param {string} params.messageId - Message ID. + * @param {string} params.subject - Email Subject. + * @param {string} params.content - Email Content. * @param {string[]} params.topics - List of Topic IDs. * @param {string[]} params.users - List of User IDs. * @param {string[]} params.targets - List of Targets IDs. - * @param {string} params.subject - Email Subject. - * @param {string} params.content - Email Content. - * @param {boolean} params.draft - Is message a draft - * @param {boolean} params.html - Is content of type HTML * @param {string[]} params.cc - Array of target IDs to be added as CC. * @param {string[]} params.bcc - Array of target IDs to be added as BCC. + * @param {string[]} params.attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. * @param {string} params.replyToEmail - Email address to reply to. Pass an empty string to restore the provider or sender default. * @param {string} params.replyToName - Name of the reply to recipient. Pass an empty string to restore the provider or sender default. + * @param {boolean} params.draft - Is message a draft + * @param {boolean} params.html - Is content of type HTML * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @param {string[]} params.attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. * @throws {AppwriteException} * @returns {Promise<Models.Message>} */ updateEmail(params: { messageId: string; + subject?: string; + content?: string; topics?: string[]; users?: string[]; targets?: string[]; - subject?: string; - content?: string; - draft?: boolean; - html?: boolean; cc?: string[]; bcc?: string[]; + attachments?: string[]; replyToEmail?: string; replyToName?: string; + draft?: boolean; + html?: boolean; scheduledAt?: string; - attachments?: string[]; }): Promise<Models.Message>; /** * Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. * * * @param {string} messageId - Message ID. + * @param {string} subject - Email Subject. + * @param {string} content - Email Content. * @param {string[]} topics - List of Topic IDs. * @param {string[]} users - List of User IDs. * @param {string[]} targets - List of Targets IDs. - * @param {string} subject - Email Subject. - * @param {string} content - Email Content. - * @param {boolean} draft - Is message a draft - * @param {boolean} html - Is content of type HTML * @param {string[]} cc - Array of target IDs to be added as CC. * @param {string[]} bcc - Array of target IDs to be added as BCC. + * @param {string[]} attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. * @param {string} replyToEmail - Email address to reply to. Pass an empty string to restore the provider or sender default. * @param {string} replyToName - Name of the reply to recipient. Pass an empty string to restore the provider or sender default. + * @param {boolean} draft - Is message a draft + * @param {boolean} html - Is content of type HTML * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @param {string[]} attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. * @throws {AppwriteException} * @returns {Promise<Models.Message>} * @deprecated Use the object parameter style method for a better developer experience. */ updateEmail( messageId: string, + subject?: string, + content?: string, topics?: string[], users?: string[], targets?: string[], - subject?: string, - content?: string, - draft?: boolean, - html?: boolean, cc?: string[], bcc?: string[], + attachments?: string[], replyToEmail?: string, replyToName?: string, + draft?: boolean, + html?: boolean, scheduledAt?: string, - attachments?: string[], ): Promise<Models.Message>; updateEmail( paramsOrFirst: | { messageId: string; + subject?: string; + content?: string; topics?: string[]; users?: string[]; targets?: string[]; - subject?: string; - content?: string; - draft?: boolean; - html?: boolean; cc?: string[]; bcc?: string[]; + attachments?: string[]; replyToEmail?: string; replyToName?: string; + draft?: boolean; + html?: boolean; scheduledAt?: string; - attachments?: string[]; } | string, ...rest: [ + string?, + string?, + string[]?, string[]?, string[]?, string[]?, - string?, - string?, - boolean?, - boolean?, string[]?, string[]?, string?, string?, + boolean?, + boolean?, string?, - string[]?, ] ): Promise<Models.Message> { let params: { messageId: string; + subject?: string; + content?: string; topics?: string[]; users?: string[]; targets?: string[]; - subject?: string; - content?: string; - draft?: boolean; - html?: boolean; cc?: string[]; bcc?: string[]; + attachments?: string[]; replyToEmail?: string; replyToName?: string; + draft?: boolean; + html?: boolean; scheduledAt?: string; - attachments?: string[]; }; if ( @@ -472,53 +472,53 @@ export class Messaging { ) { params = (paramsOrFirst || {}) as { messageId: string; + subject?: string; + content?: string; topics?: string[]; users?: string[]; targets?: string[]; - subject?: string; - content?: string; - draft?: boolean; - html?: boolean; cc?: string[]; bcc?: string[]; + attachments?: string[]; replyToEmail?: string; replyToName?: string; + draft?: boolean; + html?: boolean; scheduledAt?: string; - attachments?: string[]; }; } else { params = { messageId: paramsOrFirst as string, - topics: rest[0] as string[], - users: rest[1] as string[], - targets: rest[2] as string[], - subject: rest[3] as string, - content: rest[4] as string, - draft: rest[5] as boolean, - html: rest[6] as boolean, - cc: rest[7] as string[], - bcc: rest[8] as string[], - replyToEmail: rest[9] as string, - replyToName: rest[10] as string, - scheduledAt: rest[11] as string, - attachments: rest[12] as string[], + subject: rest[0] as string, + content: rest[1] as string, + topics: rest[2] as string[], + users: rest[3] as string[], + targets: rest[4] as string[], + cc: rest[5] as string[], + bcc: rest[6] as string[], + attachments: rest[7] as string[], + replyToEmail: rest[8] as string, + replyToName: rest[9] as string, + draft: rest[10] as boolean, + html: rest[11] as boolean, + scheduledAt: rest[12] as string, }; } const messageId = params.messageId; + const subject = params.subject; + const content = params.content; const topics = params.topics; const users = params.users; const targets = params.targets; - const subject = params.subject; - const content = params.content; - const draft = params.draft; - const html = params.html; const cc = params.cc; const bcc = params.bcc; + const attachments = params.attachments; const replyToEmail = params.replyToEmail; const replyToName = params.replyToName; + const draft = params.draft; + const html = params.html; const scheduledAt = params.scheduledAt; - const attachments = params.attachments; if (typeof messageId === 'undefined' || messageId === '') { throw new AppwriteException( 'Missing required parameter: "messageId"', @@ -529,6 +529,12 @@ export class Messaging { encodeURIComponent(String(messageId)), ); const apiPayload: Payload = {}; + if (typeof subject !== 'undefined') { + apiPayload['subject'] = subject; + } + if (typeof content !== 'undefined') { + apiPayload['content'] = content; + } if (typeof topics !== 'undefined') { apiPayload['topics'] = topics; } @@ -538,36 +544,30 @@ export class Messaging { if (typeof targets !== 'undefined') { apiPayload['targets'] = targets; } - if (typeof subject !== 'undefined') { - apiPayload['subject'] = subject; - } - if (typeof content !== 'undefined') { - apiPayload['content'] = content; - } - if (typeof draft !== 'undefined') { - apiPayload['draft'] = draft; - } - if (typeof html !== 'undefined') { - apiPayload['html'] = html; - } if (typeof cc !== 'undefined') { apiPayload['cc'] = cc; } if (typeof bcc !== 'undefined') { apiPayload['bcc'] = bcc; } + if (typeof attachments !== 'undefined') { + apiPayload['attachments'] = attachments; + } if (typeof replyToEmail !== 'undefined') { apiPayload['replyToEmail'] = replyToEmail; } if (typeof replyToName !== 'undefined') { apiPayload['replyToName'] = replyToName; } + if (typeof draft !== 'undefined') { + apiPayload['draft'] = draft; + } + if (typeof html !== 'undefined') { + apiPayload['html'] = html; + } if (typeof scheduledAt !== 'undefined') { apiPayload['scheduledAt'] = scheduledAt; } - if (typeof attachments !== 'undefined') { - apiPayload['attachments'] = attachments; - } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -601,6 +601,7 @@ export class Messaging { * @param {boolean} params.contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. * @param {boolean} params.critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. * @param {MessagePriority} params.priority - Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. + * @param {string} params.channelId - ID of the notification channel to deliver the notification on. The app must have already created a channel with this ID, otherwise the channel from the app manifest is used. Available only for Android Platform. * @throws {AppwriteException} * @returns {Promise<Models.Message>} */ @@ -624,6 +625,7 @@ export class Messaging { contentAvailable?: boolean; critical?: boolean; priority?: MessagePriority; + channelId?: string; }): Promise<Models.Message>; /** * Create a new push notification. @@ -647,6 +649,7 @@ export class Messaging { * @param {boolean} contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. * @param {boolean} critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. * @param {MessagePriority} priority - Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. + * @param {string} channelId - ID of the notification channel to deliver the notification on. The app must have already created a channel with this ID, otherwise the channel from the app manifest is used. Available only for Android Platform. * @throws {AppwriteException} * @returns {Promise<Models.Message>} * @deprecated Use the object parameter style method for a better developer experience. @@ -671,6 +674,7 @@ export class Messaging { contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority, + channelId?: string, ): Promise<Models.Message>; createPush( paramsOrFirst: @@ -694,6 +698,7 @@ export class Messaging { contentAvailable?: boolean; critical?: boolean; priority?: MessagePriority; + channelId?: string; } | string, ...rest: [ @@ -715,6 +720,7 @@ export class Messaging { boolean?, boolean?, MessagePriority?, + string?, ] ): Promise<Models.Message> { let params: { @@ -737,6 +743,7 @@ export class Messaging { contentAvailable?: boolean; critical?: boolean; priority?: MessagePriority; + channelId?: string; }; if ( @@ -764,6 +771,7 @@ export class Messaging { contentAvailable?: boolean; critical?: boolean; priority?: MessagePriority; + channelId?: string; }; } else { params = { @@ -786,6 +794,7 @@ export class Messaging { contentAvailable: rest[15] as boolean, critical: rest[16] as boolean, priority: rest[17] as MessagePriority, + channelId: rest[18] as string, }; } @@ -808,6 +817,7 @@ export class Messaging { const contentAvailable = params.contentAvailable; const critical = params.critical; const priority = params.priority; + const channelId = params.channelId; if (typeof messageId === 'undefined') { throw new AppwriteException( 'Missing required parameter: "messageId"', @@ -872,6 +882,9 @@ export class Messaging { if (typeof priority !== 'undefined') { apiPayload['priority'] = priority; } + if (typeof channelId !== 'undefined') { + apiPayload['channelId'] = channelId; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -888,11 +901,11 @@ export class Messaging { * * * @param {string} params.messageId - Message ID. + * @param {string} params.title - Title for push notification. + * @param {string} params.body - Body for push notification. * @param {string[]} params.topics - List of Topic IDs. * @param {string[]} params.users - List of User IDs. * @param {string[]} params.targets - List of Targets IDs. - * @param {string} params.title - Title for push notification. - * @param {string} params.body - Body for push notification. * @param {object} params.data - Additional Data for push notification. * @param {string} params.action - Action for push notification. * @param {string} params.image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. @@ -906,16 +919,17 @@ export class Messaging { * @param {boolean} params.contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. * @param {boolean} params.critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. * @param {MessagePriority} params.priority - Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. + * @param {string} params.channelId - ID of the notification channel to deliver the notification on. The app must have already created a channel with this ID, otherwise the channel from the app manifest is used. Pass an empty string to clear it. Available only for Android platforms. * @throws {AppwriteException} * @returns {Promise<Models.Message>} */ updatePush(params: { messageId: string; + title?: string; + body?: string; topics?: string[]; users?: string[]; targets?: string[]; - title?: string; - body?: string; data?: object; action?: string; image?: string; @@ -929,17 +943,18 @@ export class Messaging { contentAvailable?: boolean; critical?: boolean; priority?: MessagePriority; + channelId?: string; }): Promise<Models.Message>; /** * Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. * * * @param {string} messageId - Message ID. + * @param {string} title - Title for push notification. + * @param {string} body - Body for push notification. * @param {string[]} topics - List of Topic IDs. * @param {string[]} users - List of User IDs. * @param {string[]} targets - List of Targets IDs. - * @param {string} title - Title for push notification. - * @param {string} body - Body for push notification. * @param {object} data - Additional Data for push notification. * @param {string} action - Action for push notification. * @param {string} image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. @@ -953,17 +968,18 @@ export class Messaging { * @param {boolean} contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. * @param {boolean} critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. * @param {MessagePriority} priority - Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. + * @param {string} channelId - ID of the notification channel to deliver the notification on. The app must have already created a channel with this ID, otherwise the channel from the app manifest is used. Pass an empty string to clear it. Available only for Android platforms. * @throws {AppwriteException} * @returns {Promise<Models.Message>} * @deprecated Use the object parameter style method for a better developer experience. */ updatePush( messageId: string, + title?: string, + body?: string, topics?: string[], users?: string[], targets?: string[], - title?: string, - body?: string, data?: object, action?: string, image?: string, @@ -977,16 +993,17 @@ export class Messaging { contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority, + channelId?: string, ): Promise<Models.Message>; updatePush( paramsOrFirst: | { messageId: string; + title?: string; + body?: string; topics?: string[]; users?: string[]; targets?: string[]; - title?: string; - body?: string; data?: object; action?: string; image?: string; @@ -1000,14 +1017,15 @@ export class Messaging { contentAvailable?: boolean; critical?: boolean; priority?: MessagePriority; + channelId?: string; } | string, ...rest: [ + string?, + string?, string[]?, string[]?, string[]?, - string?, - string?, object?, string?, string?, @@ -1021,15 +1039,16 @@ export class Messaging { boolean?, boolean?, MessagePriority?, + string?, ] ): Promise<Models.Message> { let params: { messageId: string; + title?: string; + body?: string; topics?: string[]; users?: string[]; targets?: string[]; - title?: string; - body?: string; data?: object; action?: string; image?: string; @@ -1043,6 +1062,7 @@ export class Messaging { contentAvailable?: boolean; critical?: boolean; priority?: MessagePriority; + channelId?: string; }; if ( @@ -1052,11 +1072,11 @@ export class Messaging { ) { params = (paramsOrFirst || {}) as { messageId: string; + title?: string; + body?: string; topics?: string[]; users?: string[]; targets?: string[]; - title?: string; - body?: string; data?: object; action?: string; image?: string; @@ -1070,15 +1090,16 @@ export class Messaging { contentAvailable?: boolean; critical?: boolean; priority?: MessagePriority; + channelId?: string; }; } else { params = { messageId: paramsOrFirst as string, - topics: rest[0] as string[], - users: rest[1] as string[], - targets: rest[2] as string[], - title: rest[3] as string, - body: rest[4] as string, + title: rest[0] as string, + body: rest[1] as string, + topics: rest[2] as string[], + users: rest[3] as string[], + targets: rest[4] as string[], data: rest[5] as object, action: rest[6] as string, image: rest[7] as string, @@ -1092,15 +1113,16 @@ export class Messaging { contentAvailable: rest[15] as boolean, critical: rest[16] as boolean, priority: rest[17] as MessagePriority, + channelId: rest[18] as string, }; } const messageId = params.messageId; + const title = params.title; + const body = params.body; const topics = params.topics; const users = params.users; const targets = params.targets; - const title = params.title; - const body = params.body; const data = params.data; const action = params.action; const image = params.image; @@ -1114,6 +1136,7 @@ export class Messaging { const contentAvailable = params.contentAvailable; const critical = params.critical; const priority = params.priority; + const channelId = params.channelId; if (typeof messageId === 'undefined' || messageId === '') { throw new AppwriteException( 'Missing required parameter: "messageId"', @@ -1124,6 +1147,12 @@ export class Messaging { encodeURIComponent(String(messageId)), ); const apiPayload: Payload = {}; + if (typeof title !== 'undefined') { + apiPayload['title'] = title; + } + if (typeof body !== 'undefined') { + apiPayload['body'] = body; + } if (typeof topics !== 'undefined') { apiPayload['topics'] = topics; } @@ -1133,12 +1162,6 @@ export class Messaging { if (typeof targets !== 'undefined') { apiPayload['targets'] = targets; } - if (typeof title !== 'undefined') { - apiPayload['title'] = title; - } - if (typeof body !== 'undefined') { - apiPayload['body'] = body; - } if (typeof data !== 'undefined') { apiPayload['data'] = data; } @@ -1178,6 +1201,9 @@ export class Messaging { if (typeof priority !== 'undefined') { apiPayload['priority'] = priority; } + if (typeof channelId !== 'undefined') { + apiPayload['channelId'] = channelId; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1487,10 +1513,10 @@ export class Messaging { * * * @param {string} params.messageId - Message ID. + * @param {string} params.content - Email Content. * @param {string[]} params.topics - List of Topic IDs. * @param {string[]} params.users - List of User IDs. * @param {string[]} params.targets - List of Targets IDs. - * @param {string} params.content - Email Content. * @param {boolean} params.draft - Is message a draft * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. * @throws {AppwriteException} @@ -1499,10 +1525,10 @@ export class Messaging { */ updateSms(params: { messageId: string; + content?: string; topics?: string[]; users?: string[]; targets?: string[]; - content?: string; draft?: boolean; scheduledAt?: string; }): Promise<Models.Message>; @@ -1511,10 +1537,10 @@ export class Messaging { * * * @param {string} messageId - Message ID. + * @param {string} content - Email Content. * @param {string[]} topics - List of Topic IDs. * @param {string[]} users - List of User IDs. * @param {string[]} targets - List of Targets IDs. - * @param {string} content - Email Content. * @param {boolean} draft - Is message a draft * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. * @throws {AppwriteException} @@ -1523,10 +1549,10 @@ export class Messaging { */ updateSms( messageId: string, + content?: string, topics?: string[], users?: string[], targets?: string[], - content?: string, draft?: boolean, scheduledAt?: string, ): Promise<Models.Message>; @@ -1534,22 +1560,22 @@ export class Messaging { paramsOrFirst: | { messageId: string; + content?: string; topics?: string[]; users?: string[]; targets?: string[]; - content?: string; draft?: boolean; scheduledAt?: string; } | string, - ...rest: [string[]?, string[]?, string[]?, string?, boolean?, string?] + ...rest: [string?, string[]?, string[]?, string[]?, boolean?, string?] ): Promise<Models.Message> { let params: { messageId: string; + content?: string; topics?: string[]; users?: string[]; targets?: string[]; - content?: string; draft?: boolean; scheduledAt?: string; }; @@ -1561,30 +1587,30 @@ export class Messaging { ) { params = (paramsOrFirst || {}) as { messageId: string; + content?: string; topics?: string[]; users?: string[]; targets?: string[]; - content?: string; draft?: boolean; scheduledAt?: string; }; } else { params = { messageId: paramsOrFirst as string, - topics: rest[0] as string[], - users: rest[1] as string[], - targets: rest[2] as string[], - content: rest[3] as string, + content: rest[0] as string, + topics: rest[1] as string[], + users: rest[2] as string[], + targets: rest[3] as string[], draft: rest[4] as boolean, scheduledAt: rest[5] as string, }; } const messageId = params.messageId; + const content = params.content; const topics = params.topics; const users = params.users; const targets = params.targets; - const content = params.content; const draft = params.draft; const scheduledAt = params.scheduledAt; if (typeof messageId === 'undefined' || messageId === '') { @@ -1597,6 +1623,9 @@ export class Messaging { encodeURIComponent(String(messageId)), ); const apiPayload: Payload = {}; + if (typeof content !== 'undefined') { + apiPayload['content'] = content; + } if (typeof topics !== 'undefined') { apiPayload['topics'] = topics; } @@ -1606,9 +1635,6 @@ export class Messaging { if (typeof targets !== 'undefined') { apiPayload['targets'] = targets; } - if (typeof content !== 'undefined') { - apiPayload['content'] = content; - } if (typeof draft !== 'undefined') { apiPayload['draft'] = draft; } @@ -1631,10 +1657,10 @@ export class Messaging { * * * @param {string} params.messageId - Message ID. + * @param {string} params.content - Email Content. * @param {string[]} params.topics - List of Topic IDs. * @param {string[]} params.users - List of User IDs. * @param {string[]} params.targets - List of Targets IDs. - * @param {string} params.content - Email Content. * @param {boolean} params.draft - Is message a draft * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. * @throws {AppwriteException} @@ -1642,10 +1668,10 @@ export class Messaging { */ updateSMS(params: { messageId: string; + content?: string; topics?: string[]; users?: string[]; targets?: string[]; - content?: string; draft?: boolean; scheduledAt?: string; }): Promise<Models.Message>; @@ -1654,10 +1680,10 @@ export class Messaging { * * * @param {string} messageId - Message ID. + * @param {string} content - Email Content. * @param {string[]} topics - List of Topic IDs. * @param {string[]} users - List of User IDs. * @param {string[]} targets - List of Targets IDs. - * @param {string} content - Email Content. * @param {boolean} draft - Is message a draft * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. * @throws {AppwriteException} @@ -1666,10 +1692,10 @@ export class Messaging { */ updateSMS( messageId: string, + content?: string, topics?: string[], users?: string[], targets?: string[], - content?: string, draft?: boolean, scheduledAt?: string, ): Promise<Models.Message>; @@ -1677,22 +1703,22 @@ export class Messaging { paramsOrFirst: | { messageId: string; + content?: string; topics?: string[]; users?: string[]; targets?: string[]; - content?: string; draft?: boolean; scheduledAt?: string; } | string, - ...rest: [string[]?, string[]?, string[]?, string?, boolean?, string?] + ...rest: [string?, string[]?, string[]?, string[]?, boolean?, string?] ): Promise<Models.Message> { let params: { messageId: string; + content?: string; topics?: string[]; users?: string[]; targets?: string[]; - content?: string; draft?: boolean; scheduledAt?: string; }; @@ -1704,30 +1730,30 @@ export class Messaging { ) { params = (paramsOrFirst || {}) as { messageId: string; + content?: string; topics?: string[]; users?: string[]; targets?: string[]; - content?: string; draft?: boolean; scheduledAt?: string; }; } else { params = { messageId: paramsOrFirst as string, - topics: rest[0] as string[], - users: rest[1] as string[], - targets: rest[2] as string[], - content: rest[3] as string, + content: rest[0] as string, + topics: rest[1] as string[], + users: rest[2] as string[], + targets: rest[3] as string[], draft: rest[4] as boolean, scheduledAt: rest[5] as string, }; } const messageId = params.messageId; + const content = params.content; const topics = params.topics; const users = params.users; const targets = params.targets; - const content = params.content; const draft = params.draft; const scheduledAt = params.scheduledAt; if (typeof messageId === 'undefined' || messageId === '') { @@ -1740,6 +1766,9 @@ export class Messaging { encodeURIComponent(String(messageId)), ); const apiPayload: Payload = {}; + if (typeof content !== 'undefined') { + apiPayload['content'] = content; + } if (typeof topics !== 'undefined') { apiPayload['topics'] = topics; } @@ -1749,9 +1778,6 @@ export class Messaging { if (typeof targets !== 'undefined') { apiPayload['targets'] = targets; } - if (typeof content !== 'undefined') { - apiPayload['content'] = content; - } if (typeof draft !== 'undefined') { apiPayload['draft'] = draft; } diff --git a/src/services/project.ts b/src/services/project.ts index 337db051..7d59be73 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -3,8 +3,16 @@ import type { Models } from '../models'; import { ProjectAuthMethodId } from '../enums/project-auth-method-id'; import { ProjectKeyScopes } from '../enums/project-key-scopes'; +import { ProjectOAuth2Auth0Prompt } from '../enums/project-o-auth-2-auth-0-prompt'; +import { ProjectOAuth2DiscordPrompt } from '../enums/project-o-auth-2-discord-prompt'; +import { ProjectOAuth2GitHubPrompt } from '../enums/project-o-auth-2-git-hub-prompt'; import { ProjectOAuth2GooglePrompt } from '../enums/project-o-auth-2-google-prompt'; +import { ProjectOAuth2KakaoPrompt } from '../enums/project-o-auth-2-kakao-prompt'; +import { ProjectOAuth2MicrosoftPrompt } from '../enums/project-o-auth-2-microsoft-prompt'; import { ProjectOAuth2OidcPrompt } from '../enums/project-o-auth-2-oidc-prompt'; +import { ProjectOAuth2OktaPrompt } from '../enums/project-o-auth-2-okta-prompt'; +import { ProjectOAuth2SalesforcePrompt } from '../enums/project-o-auth-2-salesforce-prompt'; +import { ProjectOAuth2ZohoPrompt } from '../enums/project-o-auth-2-zoho-prompt'; import { ProjectOAuthProviderId } from '../enums/project-o-auth-provider-id'; import { ProjectPolicyId } from '../enums/project-policy-id'; import { ProjectProtocolId } from '../enums/project-protocol-id'; @@ -1516,6 +1524,7 @@ export class Project { * @param {string} params.clientId - 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq * @param {string} params.clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF * @param {string} params.endpoint - Domain of Auth0 instance. For example: example.us.auth0.com + * @param {ProjectOAuth2Auth0Prompt[]} params.prompt - Array of Auth0 OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. Pass an empty array to use the Auth0 default. * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Auth0>} @@ -1524,6 +1533,7 @@ export class Project { clientId?: string; clientSecret?: string; endpoint?: string; + prompt?: ProjectOAuth2Auth0Prompt[]; enabled?: boolean; }): Promise<Models.OAuth2Auth0>; /** @@ -1532,6 +1542,7 @@ export class Project { * @param {string} clientId - 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq * @param {string} clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF * @param {string} endpoint - Domain of Auth0 instance. For example: example.us.auth0.com + * @param {ProjectOAuth2Auth0Prompt[]} prompt - Array of Auth0 OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. Pass an empty array to use the Auth0 default. * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Auth0>} @@ -1541,6 +1552,7 @@ export class Project { clientId?: string, clientSecret?: string, endpoint?: string, + prompt?: ProjectOAuth2Auth0Prompt[], enabled?: boolean, ): Promise<Models.OAuth2Auth0>; updateOAuth2Auth0( @@ -1549,15 +1561,17 @@ export class Project { clientId?: string; clientSecret?: string; endpoint?: string; + prompt?: ProjectOAuth2Auth0Prompt[]; enabled?: boolean; } | string, - ...rest: [string?, string?, boolean?] + ...rest: [string?, string?, ProjectOAuth2Auth0Prompt[]?, boolean?] ): Promise<Models.OAuth2Auth0> { let params: { clientId?: string; clientSecret?: string; endpoint?: string; + prompt?: ProjectOAuth2Auth0Prompt[]; enabled?: boolean; }; @@ -1571,6 +1585,7 @@ export class Project { clientId?: string; clientSecret?: string; endpoint?: string; + prompt?: ProjectOAuth2Auth0Prompt[]; enabled?: boolean; }; } else { @@ -1578,13 +1593,15 @@ export class Project { clientId: paramsOrFirst as string, clientSecret: rest[0] as string, endpoint: rest[1] as string, - enabled: rest[2] as boolean, + prompt: rest[2] as ProjectOAuth2Auth0Prompt[], + enabled: rest[3] as boolean, }; } const clientId = params.clientId; const clientSecret = params.clientSecret; const endpoint = params.endpoint; + const prompt = params.prompt; const enabled = params.enabled; const apiPath = '/project/oauth2/auth0'; const apiPayload: Payload = {}; @@ -1597,6 +1614,9 @@ export class Project { if (typeof endpoint !== 'undefined') { apiPayload['endpoint'] = endpoint; } + if (typeof prompt !== 'undefined') { + apiPayload['prompt'] = prompt; + } if (typeof enabled !== 'undefined') { apiPayload['enabled'] = enabled; } @@ -2217,6 +2237,7 @@ export class Project { * * @param {string} params.clientId - 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 * @param {string} params.clientSecret - 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D + * @param {ProjectOAuth2DiscordPrompt[]} params.prompt - Array with at most one Discord OAuth2 prompt value. "none" means: skip the authorization screen for users who already authorized the app with the requested scopes. "consent" means: ask users who already authorized the app to approve it again. Pass an empty array to use the Discord default. * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Discord>} @@ -2224,6 +2245,7 @@ export class Project { updateOAuth2Discord(params?: { clientId?: string; clientSecret?: string; + prompt?: ProjectOAuth2DiscordPrompt[]; enabled?: boolean; }): Promise<Models.OAuth2Discord>; /** @@ -2231,6 +2253,7 @@ export class Project { * * @param {string} clientId - 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 * @param {string} clientSecret - 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D + * @param {ProjectOAuth2DiscordPrompt[]} prompt - Array with at most one Discord OAuth2 prompt value. "none" means: skip the authorization screen for users who already authorized the app with the requested scopes. "consent" means: ask users who already authorized the app to approve it again. Pass an empty array to use the Discord default. * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Discord>} @@ -2239,17 +2262,24 @@ export class Project { updateOAuth2Discord( clientId?: string, clientSecret?: string, + prompt?: ProjectOAuth2DiscordPrompt[], enabled?: boolean, ): Promise<Models.OAuth2Discord>; updateOAuth2Discord( paramsOrFirst?: - | { clientId?: string; clientSecret?: string; enabled?: boolean } + | { + clientId?: string; + clientSecret?: string; + prompt?: ProjectOAuth2DiscordPrompt[]; + enabled?: boolean; + } | string, - ...rest: [string?, boolean?] + ...rest: [string?, ProjectOAuth2DiscordPrompt[]?, boolean?] ): Promise<Models.OAuth2Discord> { let params: { clientId?: string; clientSecret?: string; + prompt?: ProjectOAuth2DiscordPrompt[]; enabled?: boolean; }; @@ -2262,18 +2292,21 @@ export class Project { params = (paramsOrFirst || {}) as { clientId?: string; clientSecret?: string; + prompt?: ProjectOAuth2DiscordPrompt[]; enabled?: boolean; }; } else { params = { clientId: paramsOrFirst as string, clientSecret: rest[0] as string, - enabled: rest[1] as boolean, + prompt: rest[1] as ProjectOAuth2DiscordPrompt[], + enabled: rest[2] as boolean, }; } const clientId = params.clientId; const clientSecret = params.clientSecret; + const prompt = params.prompt; const enabled = params.enabled; const apiPath = '/project/oauth2/discord'; const apiPayload: Payload = {}; @@ -2283,6 +2316,9 @@ export class Project { if (typeof clientSecret !== 'undefined') { apiPayload['clientSecret'] = clientSecret; } + if (typeof prompt !== 'undefined') { + apiPayload['prompt'] = prompt; + } if (typeof enabled !== 'undefined') { apiPayload['enabled'] = enabled; } @@ -2818,6 +2854,7 @@ export class Project { * * @param {string} params.clientId - 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 * @param {string} params.clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc + * @param {ProjectOAuth2GitHubPrompt[]} params.prompt - Array of GitHub OAuth2 prompt values. "select_account" means: prompt the user to select an account. Pass an empty array to use the GitHub default. * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Github>} @@ -2825,6 +2862,7 @@ export class Project { updateOAuth2GitHub(params?: { clientId?: string; clientSecret?: string; + prompt?: ProjectOAuth2GitHubPrompt[]; enabled?: boolean; }): Promise<Models.OAuth2Github>; /** @@ -2832,6 +2870,7 @@ export class Project { * * @param {string} clientId - 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 * @param {string} clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc + * @param {ProjectOAuth2GitHubPrompt[]} prompt - Array of GitHub OAuth2 prompt values. "select_account" means: prompt the user to select an account. Pass an empty array to use the GitHub default. * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Github>} @@ -2840,17 +2879,24 @@ export class Project { updateOAuth2GitHub( clientId?: string, clientSecret?: string, + prompt?: ProjectOAuth2GitHubPrompt[], enabled?: boolean, ): Promise<Models.OAuth2Github>; updateOAuth2GitHub( paramsOrFirst?: - | { clientId?: string; clientSecret?: string; enabled?: boolean } + | { + clientId?: string; + clientSecret?: string; + prompt?: ProjectOAuth2GitHubPrompt[]; + enabled?: boolean; + } | string, - ...rest: [string?, boolean?] + ...rest: [string?, ProjectOAuth2GitHubPrompt[]?, boolean?] ): Promise<Models.OAuth2Github> { let params: { clientId?: string; clientSecret?: string; + prompt?: ProjectOAuth2GitHubPrompt[]; enabled?: boolean; }; @@ -2863,18 +2909,21 @@ export class Project { params = (paramsOrFirst || {}) as { clientId?: string; clientSecret?: string; + prompt?: ProjectOAuth2GitHubPrompt[]; enabled?: boolean; }; } else { params = { clientId: paramsOrFirst as string, clientSecret: rest[0] as string, - enabled: rest[1] as boolean, + prompt: rest[1] as ProjectOAuth2GitHubPrompt[], + enabled: rest[2] as boolean, }; } const clientId = params.clientId; const clientSecret = params.clientSecret; + const prompt = params.prompt; const enabled = params.enabled; const apiPath = '/project/oauth2/github'; const apiPayload: Payload = {}; @@ -2884,6 +2933,9 @@ export class Project { if (typeof clientSecret !== 'undefined') { apiPayload['clientSecret'] = clientSecret; } + if (typeof prompt !== 'undefined') { + apiPayload['prompt'] = prompt; + } if (typeof enabled !== 'undefined') { apiPayload['enabled'] = enabled; } @@ -3220,6 +3272,7 @@ export class Project { * * @param {string} params.clientId - 'REST API key' of Kakao OAuth2 app. For example: 839ff5000000000000000000013206de * @param {string} params.clientSecret - 'Client Secret' of Kakao OAuth2 app. For example: jLNVOK00000000000000000000yJebea. Generate it under Kakao Login > Security and set its status to enabled + * @param {ProjectOAuth2KakaoPrompt[]} params.prompt - Array of Kakao OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "create" means: prompt the user to sign up. "select_account" means: prompt the user to select an account. Pass an empty array to use the Kakao default. * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Kakao>} @@ -3227,6 +3280,7 @@ export class Project { updateOAuth2Kakao(params?: { clientId?: string; clientSecret?: string; + prompt?: ProjectOAuth2KakaoPrompt[]; enabled?: boolean; }): Promise<Models.OAuth2Kakao>; /** @@ -3234,6 +3288,7 @@ export class Project { * * @param {string} clientId - 'REST API key' of Kakao OAuth2 app. For example: 839ff5000000000000000000013206de * @param {string} clientSecret - 'Client Secret' of Kakao OAuth2 app. For example: jLNVOK00000000000000000000yJebea. Generate it under Kakao Login > Security and set its status to enabled + * @param {ProjectOAuth2KakaoPrompt[]} prompt - Array of Kakao OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "create" means: prompt the user to sign up. "select_account" means: prompt the user to select an account. Pass an empty array to use the Kakao default. * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Kakao>} @@ -3242,17 +3297,24 @@ export class Project { updateOAuth2Kakao( clientId?: string, clientSecret?: string, + prompt?: ProjectOAuth2KakaoPrompt[], enabled?: boolean, ): Promise<Models.OAuth2Kakao>; updateOAuth2Kakao( paramsOrFirst?: - | { clientId?: string; clientSecret?: string; enabled?: boolean } + | { + clientId?: string; + clientSecret?: string; + prompt?: ProjectOAuth2KakaoPrompt[]; + enabled?: boolean; + } | string, - ...rest: [string?, boolean?] + ...rest: [string?, ProjectOAuth2KakaoPrompt[]?, boolean?] ): Promise<Models.OAuth2Kakao> { let params: { clientId?: string; clientSecret?: string; + prompt?: ProjectOAuth2KakaoPrompt[]; enabled?: boolean; }; @@ -3265,18 +3327,21 @@ export class Project { params = (paramsOrFirst || {}) as { clientId?: string; clientSecret?: string; + prompt?: ProjectOAuth2KakaoPrompt[]; enabled?: boolean; }; } else { params = { clientId: paramsOrFirst as string, clientSecret: rest[0] as string, - enabled: rest[1] as boolean, + prompt: rest[1] as ProjectOAuth2KakaoPrompt[], + enabled: rest[2] as boolean, }; } const clientId = params.clientId; const clientSecret = params.clientSecret; + const prompt = params.prompt; const enabled = params.enabled; const apiPath = '/project/oauth2/kakao'; const apiPayload: Payload = {}; @@ -3286,6 +3351,9 @@ export class Project { if (typeof clientSecret !== 'undefined') { apiPayload['clientSecret'] = clientSecret; } + if (typeof prompt !== 'undefined') { + apiPayload['prompt'] = prompt; + } if (typeof enabled !== 'undefined') { apiPayload['enabled'] = enabled; } @@ -3593,6 +3661,7 @@ export class Project { * @param {string} params.applicationId - 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 * @param {string} params.applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u * @param {string} params.tenant - Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common + * @param {ProjectOAuth2MicrosoftPrompt[]} params.prompt - Array of Microsoft OAuth2 prompt values. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. Pass an empty array to use the Microsoft default. * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Microsoft>} @@ -3601,6 +3670,7 @@ export class Project { applicationId?: string; applicationSecret?: string; tenant?: string; + prompt?: ProjectOAuth2MicrosoftPrompt[]; enabled?: boolean; }): Promise<Models.OAuth2Microsoft>; /** @@ -3609,6 +3679,7 @@ export class Project { * @param {string} applicationId - 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 * @param {string} applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u * @param {string} tenant - Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common + * @param {ProjectOAuth2MicrosoftPrompt[]} prompt - Array of Microsoft OAuth2 prompt values. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. Pass an empty array to use the Microsoft default. * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Microsoft>} @@ -3618,6 +3689,7 @@ export class Project { applicationId?: string, applicationSecret?: string, tenant?: string, + prompt?: ProjectOAuth2MicrosoftPrompt[], enabled?: boolean, ): Promise<Models.OAuth2Microsoft>; updateOAuth2Microsoft( @@ -3626,15 +3698,17 @@ export class Project { applicationId?: string; applicationSecret?: string; tenant?: string; + prompt?: ProjectOAuth2MicrosoftPrompt[]; enabled?: boolean; } | string, - ...rest: [string?, string?, boolean?] + ...rest: [string?, string?, ProjectOAuth2MicrosoftPrompt[]?, boolean?] ): Promise<Models.OAuth2Microsoft> { let params: { applicationId?: string; applicationSecret?: string; tenant?: string; + prompt?: ProjectOAuth2MicrosoftPrompt[]; enabled?: boolean; }; @@ -3648,6 +3722,7 @@ export class Project { applicationId?: string; applicationSecret?: string; tenant?: string; + prompt?: ProjectOAuth2MicrosoftPrompt[]; enabled?: boolean; }; } else { @@ -3655,13 +3730,15 @@ export class Project { applicationId: paramsOrFirst as string, applicationSecret: rest[0] as string, tenant: rest[1] as string, - enabled: rest[2] as boolean, + prompt: rest[2] as ProjectOAuth2MicrosoftPrompt[], + enabled: rest[3] as boolean, }; } const applicationId = params.applicationId; const applicationSecret = params.applicationSecret; const tenant = params.tenant; + const prompt = params.prompt; const enabled = params.enabled; const apiPath = '/project/oauth2/microsoft'; const apiPayload: Payload = {}; @@ -3674,6 +3751,9 @@ export class Project { if (typeof tenant !== 'undefined') { apiPayload['tenant'] = tenant; } + if (typeof prompt !== 'undefined') { + apiPayload['prompt'] = prompt; + } if (typeof enabled !== 'undefined') { apiPayload['enabled'] = enabled; } @@ -3954,6 +4034,7 @@ export class Project { * @param {string} params.clientSecret - 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV * @param {string} params.domain - Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ * @param {string} params.authorizationServerId - Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z + * @param {ProjectOAuth2OktaPrompt[]} params.prompt - Array of Okta OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. Pass an empty array to use the Okta default. * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Okta>} @@ -3963,6 +4044,7 @@ export class Project { clientSecret?: string; domain?: string; authorizationServerId?: string; + prompt?: ProjectOAuth2OktaPrompt[]; enabled?: boolean; }): Promise<Models.OAuth2Okta>; /** @@ -3972,6 +4054,7 @@ export class Project { * @param {string} clientSecret - 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV * @param {string} domain - Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ * @param {string} authorizationServerId - Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z + * @param {ProjectOAuth2OktaPrompt[]} prompt - Array of Okta OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. Pass an empty array to use the Okta default. * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Okta>} @@ -3982,6 +4065,7 @@ export class Project { clientSecret?: string, domain?: string, authorizationServerId?: string, + prompt?: ProjectOAuth2OktaPrompt[], enabled?: boolean, ): Promise<Models.OAuth2Okta>; updateOAuth2Okta( @@ -3991,16 +4075,24 @@ export class Project { clientSecret?: string; domain?: string; authorizationServerId?: string; + prompt?: ProjectOAuth2OktaPrompt[]; enabled?: boolean; } | string, - ...rest: [string?, string?, string?, boolean?] + ...rest: [ + string?, + string?, + string?, + ProjectOAuth2OktaPrompt[]?, + boolean?, + ] ): Promise<Models.OAuth2Okta> { let params: { clientId?: string; clientSecret?: string; domain?: string; authorizationServerId?: string; + prompt?: ProjectOAuth2OktaPrompt[]; enabled?: boolean; }; @@ -4015,6 +4107,7 @@ export class Project { clientSecret?: string; domain?: string; authorizationServerId?: string; + prompt?: ProjectOAuth2OktaPrompt[]; enabled?: boolean; }; } else { @@ -4023,7 +4116,8 @@ export class Project { clientSecret: rest[0] as string, domain: rest[1] as string, authorizationServerId: rest[2] as string, - enabled: rest[3] as boolean, + prompt: rest[3] as ProjectOAuth2OktaPrompt[], + enabled: rest[4] as boolean, }; } @@ -4031,6 +4125,7 @@ export class Project { const clientSecret = params.clientSecret; const domain = params.domain; const authorizationServerId = params.authorizationServerId; + const prompt = params.prompt; const enabled = params.enabled; const apiPath = '/project/oauth2/okta'; const apiPayload: Payload = {}; @@ -4046,6 +4141,9 @@ export class Project { if (typeof authorizationServerId !== 'undefined') { apiPayload['authorizationServerId'] = authorizationServerId; } + if (typeof prompt !== 'undefined') { + apiPayload['prompt'] = prompt; + } if (typeof enabled !== 'undefined') { apiPayload['enabled'] = enabled; } @@ -4405,6 +4503,7 @@ export class Project { * * @param {string} params.customerKey - 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq * @param {string} params.customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 + * @param {ProjectOAuth2SalesforcePrompt[]} params.prompt - Array of Salesforce OAuth2 prompt values. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. Pass an empty array to use the Salesforce default. * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Salesforce>} @@ -4412,6 +4511,7 @@ export class Project { updateOAuth2Salesforce(params?: { customerKey?: string; customerSecret?: string; + prompt?: ProjectOAuth2SalesforcePrompt[]; enabled?: boolean; }): Promise<Models.OAuth2Salesforce>; /** @@ -4419,6 +4519,7 @@ export class Project { * * @param {string} customerKey - 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq * @param {string} customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 + * @param {ProjectOAuth2SalesforcePrompt[]} prompt - Array of Salesforce OAuth2 prompt values. "login" means: prompt the user to re-authenticate. "consent" means: prompt the user for consent. Pass an empty array to use the Salesforce default. * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Salesforce>} @@ -4427,6 +4528,7 @@ export class Project { updateOAuth2Salesforce( customerKey?: string, customerSecret?: string, + prompt?: ProjectOAuth2SalesforcePrompt[], enabled?: boolean, ): Promise<Models.OAuth2Salesforce>; updateOAuth2Salesforce( @@ -4434,14 +4536,16 @@ export class Project { | { customerKey?: string; customerSecret?: string; + prompt?: ProjectOAuth2SalesforcePrompt[]; enabled?: boolean; } | string, - ...rest: [string?, boolean?] + ...rest: [string?, ProjectOAuth2SalesforcePrompt[]?, boolean?] ): Promise<Models.OAuth2Salesforce> { let params: { customerKey?: string; customerSecret?: string; + prompt?: ProjectOAuth2SalesforcePrompt[]; enabled?: boolean; }; @@ -4454,18 +4558,21 @@ export class Project { params = (paramsOrFirst || {}) as { customerKey?: string; customerSecret?: string; + prompt?: ProjectOAuth2SalesforcePrompt[]; enabled?: boolean; }; } else { params = { customerKey: paramsOrFirst as string, customerSecret: rest[0] as string, - enabled: rest[1] as boolean, + prompt: rest[1] as ProjectOAuth2SalesforcePrompt[], + enabled: rest[2] as boolean, }; } const customerKey = params.customerKey; const customerSecret = params.customerSecret; + const prompt = params.prompt; const enabled = params.enabled; const apiPath = '/project/oauth2/salesforce'; const apiPayload: Payload = {}; @@ -4475,6 +4582,9 @@ export class Project { if (typeof customerSecret !== 'undefined') { apiPayload['customerSecret'] = customerSecret; } + if (typeof prompt !== 'undefined') { + apiPayload['prompt'] = prompt; + } if (typeof enabled !== 'undefined') { apiPayload['enabled'] = enabled; } @@ -5092,6 +5202,91 @@ export class Project { return this.client.call('patch', uri, apiHeaders, apiPayload); } + /** + * Update the project OAuth2 Webflow configuration. + * + * @param {string} params.clientId - 'Client ID' of Webflow OAuth2 app. For example: 8bb20000000000000000000000000000000000000000000000000000000040dd + * @param {string} params.clientSecret - 'Client Secret' of Webflow OAuth2 app. For example: 59bf00000000000000000000000000000000000000000000000000000000fe59 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Webflow>} + */ + updateOAuth2Webflow(params?: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }): Promise<Models.OAuth2Webflow>; + /** + * Update the project OAuth2 Webflow configuration. + * + * @param {string} clientId - 'Client ID' of Webflow OAuth2 app. For example: 8bb20000000000000000000000000000000000000000000000000000000040dd + * @param {string} clientSecret - 'Client Secret' of Webflow OAuth2 app. For example: 59bf00000000000000000000000000000000000000000000000000000000fe59 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Webflow>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Webflow( + clientId?: string, + clientSecret?: string, + enabled?: boolean, + ): Promise<Models.OAuth2Webflow>; + updateOAuth2Webflow( + paramsOrFirst?: + | { clientId?: string; clientSecret?: string; enabled?: boolean } + | string, + ...rest: [string?, boolean?] + ): Promise<Models.OAuth2Webflow> { + let params: { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }; + + if ( + (typeof paramsOrFirst === 'undefined' && rest.length === 0) || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { + clientId?: string; + clientSecret?: string; + enabled?: boolean; + }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean, + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + const apiPath = '/project/oauth2/webflow'; + const apiPayload: Payload = {}; + if (typeof clientId !== 'undefined') { + apiPayload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + apiPayload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + apiPayload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + accept: 'application/json', + }; + + return this.client.call('patch', uri, apiHeaders, apiPayload); + } + /** * Update the project OAuth2 WordPress configuration. * @@ -5437,6 +5632,7 @@ export class Project { * * @param {string} params.clientId - 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B * @param {string} params.clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e + * @param {ProjectOAuth2ZohoPrompt[]} params.prompt - Array of Zoho OAuth2 prompt values. "consent" means: prompt the user for consent. Pass an empty array to use the Zoho default. * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Zoho>} @@ -5444,6 +5640,7 @@ export class Project { updateOAuth2Zoho(params?: { clientId?: string; clientSecret?: string; + prompt?: ProjectOAuth2ZohoPrompt[]; enabled?: boolean; }): Promise<Models.OAuth2Zoho>; /** @@ -5451,6 +5648,7 @@ export class Project { * * @param {string} clientId - 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B * @param {string} clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e + * @param {ProjectOAuth2ZohoPrompt[]} prompt - Array of Zoho OAuth2 prompt values. "consent" means: prompt the user for consent. Pass an empty array to use the Zoho default. * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Zoho>} @@ -5459,17 +5657,24 @@ export class Project { updateOAuth2Zoho( clientId?: string, clientSecret?: string, + prompt?: ProjectOAuth2ZohoPrompt[], enabled?: boolean, ): Promise<Models.OAuth2Zoho>; updateOAuth2Zoho( paramsOrFirst?: - | { clientId?: string; clientSecret?: string; enabled?: boolean } + | { + clientId?: string; + clientSecret?: string; + prompt?: ProjectOAuth2ZohoPrompt[]; + enabled?: boolean; + } | string, - ...rest: [string?, boolean?] + ...rest: [string?, ProjectOAuth2ZohoPrompt[]?, boolean?] ): Promise<Models.OAuth2Zoho> { let params: { clientId?: string; clientSecret?: string; + prompt?: ProjectOAuth2ZohoPrompt[]; enabled?: boolean; }; @@ -5482,18 +5687,21 @@ export class Project { params = (paramsOrFirst || {}) as { clientId?: string; clientSecret?: string; + prompt?: ProjectOAuth2ZohoPrompt[]; enabled?: boolean; }; } else { params = { clientId: paramsOrFirst as string, clientSecret: rest[0] as string, - enabled: rest[1] as boolean, + prompt: rest[1] as ProjectOAuth2ZohoPrompt[], + enabled: rest[2] as boolean, }; } const clientId = params.clientId; const clientSecret = params.clientSecret; + const prompt = params.prompt; const enabled = params.enabled; const apiPath = '/project/oauth2/zoho'; const apiPayload: Payload = {}; @@ -5503,6 +5711,9 @@ export class Project { if (typeof clientSecret !== 'undefined') { apiPayload['clientSecret'] = clientSecret; } + if (typeof prompt !== 'undefined') { + apiPayload['prompt'] = prompt; + } if (typeof enabled !== 'undefined') { apiPayload['enabled'] = enabled; } @@ -5607,7 +5818,7 @@ export class Project { * * @param {ProjectOAuthProviderId} params.providerId - OAuth2 provider key. For example: github, google, apple. * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2HuggingFace | Models.OAuth2Resend | Models.OAuth2Cloudflare | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft | Models.OAuth2TikTok | Models.OAuth2Kakao>} + * @returns {Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Webflow | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2HuggingFace | Models.OAuth2Resend | Models.OAuth2Cloudflare | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft | Models.OAuth2TikTok | Models.OAuth2Kakao>} */ getOAuth2Provider(params: { providerId: ProjectOAuthProviderId; @@ -5627,6 +5838,7 @@ export class Project { | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress + | Models.OAuth2Webflow | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify @@ -5663,7 +5875,7 @@ export class Project { * * @param {ProjectOAuthProviderId} providerId - OAuth2 provider key. For example: github, google, apple. * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2HuggingFace | Models.OAuth2Resend | Models.OAuth2Cloudflare | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft | Models.OAuth2TikTok | Models.OAuth2Kakao>} + * @returns {Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Webflow | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2HuggingFace | Models.OAuth2Resend | Models.OAuth2Cloudflare | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft | Models.OAuth2TikTok | Models.OAuth2Kakao>} * @deprecated Use the object parameter style method for a better developer experience. */ getOAuth2Provider( @@ -5684,6 +5896,7 @@ export class Project { | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress + | Models.OAuth2Webflow | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify @@ -5734,6 +5947,7 @@ export class Project { | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress + | Models.OAuth2Webflow | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify diff --git a/src/services/proxy.ts b/src/services/proxy.ts index 1bcf88cb..b64891cb 100644 --- a/src/services/proxy.ts +++ b/src/services/proxy.ts @@ -16,6 +16,8 @@ export class Proxy { * * Depending on type, the invalidation purges a single cache tag, a single URL path, or all cached content for the domain. * + * Domains that route to a function do not support cache invalidation. + * * @param {string} params.domain - Domain name. * @param {InvalidationType} params.type - Type of reference passed. Allowed values are: tag, path, all * @param {string} params.reference - Reference to invalidate. Depending on type this can be: cache tag name (up to 128 characters), URL path (up to 2048 characters). Not required when type is all. @@ -32,6 +34,8 @@ export class Proxy { * * Depending on type, the invalidation purges a single cache tag, a single URL path, or all cached content for the domain. * + * Domains that route to a function do not support cache invalidation. + * * @param {string} domain - Domain name. * @param {InvalidationType} type - Type of reference passed. Allowed values are: tag, path, all * @param {string} reference - Reference to invalidate. Depending on type this can be: cache tag name (up to 128 characters), URL path (up to 2048 characters). Not required when type is all. diff --git a/src/services/sites.ts b/src/services/sites.ts index 35666297..17ddc6b4 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -483,12 +483,44 @@ export class Sites { /** * Get a list of all frameworks that are currently available on the server instance. * + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.FrameworkList>} + */ + listFrameworks(params?: { total?: boolean }): Promise<Models.FrameworkList>; + /** + * Get a list of all frameworks that are currently available on the server instance. + * + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.FrameworkList>} + * @deprecated Use the object parameter style method for a better developer experience. */ - listFrameworks(): Promise<Models.FrameworkList> { + listFrameworks(total?: boolean): Promise<Models.FrameworkList>; + listFrameworks( + paramsOrFirst?: { total?: boolean } | boolean, + ): Promise<Models.FrameworkList> { + let params: { total?: boolean }; + + if ( + typeof paramsOrFirst === 'undefined' || + (paramsOrFirst && + typeof paramsOrFirst === 'object' && + !Array.isArray(paramsOrFirst)) + ) { + params = (paramsOrFirst || {}) as { total?: boolean }; + } else { + params = { + total: paramsOrFirst as boolean, + }; + } + + const total = params.total; const apiPath = '/sites/frameworks'; const apiPayload: Payload = {}; + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -503,45 +535,60 @@ export class Sites { * List allowed site specifications for this instance. * * @param {string} params.type - Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.SpecificationList>} */ listSpecifications(params?: { type?: string; + total?: boolean; }): Promise<Models.SpecificationList>; /** * List allowed site specifications for this instance. * * @param {string} type - Specification type to list. Can be one of: runtimes, builds. Defaults to runtimes. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.SpecificationList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listSpecifications(type?: string): Promise<Models.SpecificationList>; listSpecifications( - paramsOrFirst?: { type?: string } | string, + type?: string, + total?: boolean, + ): Promise<Models.SpecificationList>; + listSpecifications( + paramsOrFirst?: { type?: string; total?: boolean } | string, + ...rest: [boolean?] ): Promise<Models.SpecificationList> { - let params: { type?: string }; + let params: { type?: string; total?: boolean }; if ( - typeof paramsOrFirst === 'undefined' || + (typeof paramsOrFirst === 'undefined' && rest.length === 0) || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) ) { - params = (paramsOrFirst || {}) as { type?: string }; + params = (paramsOrFirst || {}) as { + type?: string; + total?: boolean; + }; } else { params = { type: paramsOrFirst as string, + total: rest[0] as boolean, }; } const type = params.type; + const total = params.total; const apiPath = '/sites/specifications'; const apiPayload: Payload = {}; if (typeof type !== 'undefined') { apiPayload['type'] = type; } + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index 8e0bfd2a..bd8c228b 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -248,45 +248,60 @@ export class TablesDB { * List transactions across all databases. * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.TransactionList>} */ listTransactions(params?: { queries?: string[]; + total?: boolean; }): Promise<Models.TransactionList>; /** * List transactions across all databases. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.TransactionList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listTransactions(queries?: string[]): Promise<Models.TransactionList>; listTransactions( - paramsOrFirst?: { queries?: string[] } | string[], + queries?: string[], + total?: boolean, + ): Promise<Models.TransactionList>; + listTransactions( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise<Models.TransactionList> { - let params: { queries?: string[] }; + let params: { queries?: string[]; total?: boolean }; if ( - typeof paramsOrFirst === 'undefined' || + (typeof paramsOrFirst === 'undefined' && rest.length === 0) || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) ) { - params = (paramsOrFirst || {}) as { queries?: string[] }; + params = (paramsOrFirst || {}) as { + queries?: string[]; + total?: boolean; + }; } else { params = { queries: paramsOrFirst as string[], + total: rest[0] as boolean, }; } const queries = params.queries; + const total = params.total; const apiPath = '/tablesdb/transactions'; const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { apiPayload['queries'] = queries; } + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/teams.ts b/src/services/teams.ts index 1c655f54..821acb7d 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -94,7 +94,7 @@ export class Teams { * * @param {string} params.teamId - Team ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. * @param {string} params.name - Team name. Max length: 128 chars. - * @param {string[]} params.roles - Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {string[]} params.roles - Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. * @throws {AppwriteException} * @returns {Promise<Models.Team<Preferences>>} */ @@ -110,7 +110,7 @@ export class Teams { * * @param {string} teamId - Team ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. * @param {string} name - Team name. Max length: 128 chars. - * @param {string[]} roles - Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @param {string[]} roles - Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. * @throws {AppwriteException} * @returns {Promise<Models.Team<Preferences>>} * @deprecated Use the object parameter style method for a better developer experience. diff --git a/src/services/vectors-db.ts b/src/services/vectors-db.ts index 7938a17a..55871ee4 100644 --- a/src/services/vectors-db.ts +++ b/src/services/vectors-db.ts @@ -232,45 +232,60 @@ export class VectorsDB { * List transactions across all databases. * * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.TransactionList>} */ listTransactions(params?: { queries?: string[]; + total?: boolean; }): Promise<Models.TransactionList>; /** * List transactions across all databases. * * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @throws {AppwriteException} * @returns {Promise<Models.TransactionList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listTransactions(queries?: string[]): Promise<Models.TransactionList>; listTransactions( - paramsOrFirst?: { queries?: string[] } | string[], + queries?: string[], + total?: boolean, + ): Promise<Models.TransactionList>; + listTransactions( + paramsOrFirst?: { queries?: string[]; total?: boolean } | string[], + ...rest: [boolean?] ): Promise<Models.TransactionList> { - let params: { queries?: string[] }; + let params: { queries?: string[]; total?: boolean }; if ( - typeof paramsOrFirst === 'undefined' || + (typeof paramsOrFirst === 'undefined' && rest.length === 0) || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst)) ) { - params = (paramsOrFirst || {}) as { queries?: string[] }; + params = (paramsOrFirst || {}) as { + queries?: string[]; + total?: boolean; + }; } else { params = { queries: paramsOrFirst as string[], + total: rest[0] as boolean, }; } const queries = params.queries; + const total = params.total; const apiPath = '/vectorsdb/transactions'; const apiPayload: Payload = {}; if (typeof queries !== 'undefined') { apiPayload['queries'] = queries; } + if (typeof total !== 'undefined') { + apiPayload['total'] = total; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { diff --git a/src/services/webhooks.ts b/src/services/webhooks.ts index 748e9a81..0a61f598 100644 --- a/src/services/webhooks.ts +++ b/src/services/webhooks.ts @@ -321,7 +321,7 @@ export class Webhooks { * @param {boolean} params.enabled - Enable or disable a webhook. * @param {boolean} params.tls - Certificate verification, false for disabled or true for enabled. * @param {string} params.authUsername - Webhook HTTP user. Max length: 256 chars. - * @param {string} params.authPassword - Webhook HTTP password. Max length: 256 chars. + * @param {string} params.authPassword - Webhook HTTP password. Max length: 256 chars. Omit to keep the current password; it is cleared when the URL changes or TLS verification is disabled. * @throws {AppwriteException} * @returns {Promise<Models.Webhook>} */ @@ -345,7 +345,7 @@ export class Webhooks { * @param {boolean} enabled - Enable or disable a webhook. * @param {boolean} tls - Certificate verification, false for disabled or true for enabled. * @param {string} authUsername - Webhook HTTP user. Max length: 256 chars. - * @param {string} authPassword - Webhook HTTP password. Max length: 256 chars. + * @param {string} authPassword - Webhook HTTP password. Max length: 256 chars. Omit to keep the current password; it is cleared when the URL changes or TLS verification is disabled. * @throws {AppwriteException} * @returns {Promise<Models.Webhook>} * @deprecated Use the object parameter style method for a better developer experience. diff --git a/src/topic.ts b/src/topic.ts new file mode 100644 index 00000000..cd6cea01 --- /dev/null +++ b/src/topic.ts @@ -0,0 +1,103 @@ +/** + * Validate the levels passed to `path()`: a non-empty array of non-empty strings, none holding + * the level separator `/` or the wildcards `+` and `#` (use `any()` and `all()` for those). + */ +function levelsOf(levels: unknown): string[] { + if (!Array.isArray(levels)) { + throw new Error("path() expects an array, e.g. path(['user'])"); + } + if (levels.length === 0) { + throw new Error('path() needs at least one level'); + } + return levels.map((level: unknown, index: number) => { + if (typeof level !== 'string') { + const type = level === null ? 'null' : typeof level; + throw new Error( + `level at index ${index} must be a string, got ${type}`, + ); + } + if (level === '') { + throw new Error(`empty level at index ${index}`); + } + if (level.includes('/')) { + const parts = level + .split('/') + .map((part) => `'${part}'`) + .join(', '); + throw new Error( + `"${level}" contains "/", split it: path([${parts}])`, + ); + } + if (level === '+') { + throw new Error('"+" is reserved, use any()'); + } + if (level.includes('+')) { + throw new Error(`"${level}" contains "+", use any() for wildcards`); + } + if (level === '#') { + throw new Error('"#" is reserved, use all()'); + } + if (level.includes('#')) { + throw new Error(`"${level}" contains "#", use all() for wildcards`); + } + return level; + }); +} + +/** + * Helper to build MQTT topics for `Push`, level by level. + * + * Topic.path(['user', userId, 'notification']); // "user/123/notification" + * Topic.path(['user']).any().path(['notification']); // "user/+/notification" + * Topic.path(['org']).any().path(['logs']).all(); // "org/+/logs/#" + * + * `any()` matches exactly one level and `all()` everything below, at any depth (including the + * parent itself). `all()` ends the topic, so it returns a {@link ResolvedTopic}. + */ +export class Topic { + private constructor(private readonly levels: readonly string[]) {} + + /** Start a topic with the given levels, e.g. `Topic.path(['user', userId])`. */ + static path(levels: string[]): Topic { + return new Topic(levelsOf(levels)); + } + + /** Start a topic with a single-level wildcard (`+`). */ + static any(): Topic { + return new Topic(['+']); + } + + /** The multi-level wildcard alone (`#`): matches every topic. */ + static all(): ResolvedTopic { + return new ResolvedTopic(['#']); + } + + /** Append the given levels. */ + path(levels: string[]): Topic { + return new Topic([...this.levels, ...levelsOf(levels)]); + } + + /** Append a single-level wildcard (`+`): matches exactly one level. */ + any(): Topic { + return new Topic([...this.levels, '+']); + } + + /** Append the multi-level wildcard (`#`) and end the topic. */ + all(): ResolvedTopic { + return new ResolvedTopic([...this.levels, '#']); + } + + toString(): string { + return this.levels.join('/'); + } +} + +/** A topic ended by `all()`: nothing can be appended after the `#` wildcard. */ +export class ResolvedTopic { + /** @internal Created by {@link Topic.all}. */ + constructor(private readonly levels: readonly string[]) {} + + toString(): string { + return this.levels.join('/'); + } +} diff --git a/test/client.test.js b/test/client.test.js index c13af6c4..71bda01a 100644 --- a/test/client.test.js +++ b/test/client.test.js @@ -1,4 +1,5 @@ const { Client } = require('../dist/client'); +const { InputFile } = require('../dist/inputFile'); const { fetch: mockedFetch, Response, Dispatcher } = require('undici'); jest.mock('undici', () => ({ @@ -43,3 +44,112 @@ describe('Client', () => { } }); }); + +describe('Client.chunkedUpload', () => { + const url = new URL( + 'https://cloud.appwrite.io/v1/storage/buckets/bucket/files', + ); + const headers = { 'content-type': 'multipart/form-data' }; + const sentHeaders = (index) => mockedFetch.mock.calls[index][1].headers; + const file = (size) => + InputFile.fromBuffer(Buffer.alloc(size), 'upload.bin'); + + beforeEach(() => { + mockedFetch.mockReset(); + }); + + test('sends a file of exactly the chunk size in one request', async () => { + mockedFetch.mockImplementation(() => Response.json({ $id: 'file' })); + const client = new Client(); + + await client.chunkedUpload( + 'POST', + url, + { ...headers }, + { file: file(Client.CHUNK_SIZE) }, + () => {}, + ); + + expect(mockedFetch).toHaveBeenCalledTimes(1); + expect(sentHeaders(0)).not.toHaveProperty('content-range'); + }); + + test('splits a larger file into chunks that share the upload id', async () => { + mockedFetch.mockImplementation(() => + Response.json({ + $id: 'file', + chunksUploaded: mockedFetch.mock.calls.length, + chunksTotal: 2, + }), + ); + const client = new Client(); + const size = Client.CHUNK_SIZE + 1; + + const result = await client.chunkedUpload( + 'POST', + url, + { ...headers }, + { file: file(size) }, + () => {}, + ); + + expect(mockedFetch).toHaveBeenCalledTimes(2); + expect(sentHeaders(0)['content-range']).toBe( + `bytes 0-${Client.CHUNK_SIZE - 1}/${size}`, + ); + expect(sentHeaders(1)['content-range']).toBe( + `bytes ${Client.CHUNK_SIZE}-${Client.CHUNK_SIZE}/${size}`, + ); + expect(sentHeaders(1)['x-appwrite-id']).toBe('file'); + expect(result).toEqual({ + $id: 'file', + chunksUploaded: 2, + chunksTotal: 2, + }); + }); + + test('sends a text upload in one request whatever its size', async () => { + mockedFetch.mockImplementation( + () => + new Response('zone file', { + headers: { 'content-type': 'text/plain' }, + }), + ); + const client = new Client(); + + const result = await client.chunkedUpload( + 'POST', + url, + { ...headers }, + { file: file(Client.CHUNK_SIZE * 2 + 1) }, + () => {}, + 'text', + ); + + expect(mockedFetch).toHaveBeenCalledTimes(1); + expect(sentHeaders(0)).not.toHaveProperty('content-range'); + expect(result).toBe('zone file'); + }); + + test('makes a plain call with the requested response type when no file is sent', async () => { + mockedFetch.mockImplementation( + () => + new Response('plain text', { + headers: { 'content-type': 'text/plain' }, + }), + ); + const client = new Client(); + + const result = await client.chunkedUpload( + 'POST', + url, + { ...headers }, + { name: 'zone' }, + () => {}, + 'text', + ); + + expect(mockedFetch).toHaveBeenCalledTimes(1); + expect(result).toBe('plain text'); + }); +}); diff --git a/test/services/avatars.test.js b/test/services/avatars.test.js index 62baf68d..c65b1b91 100644 --- a/test/services/avatars.test.js +++ b/test/services/avatars.test.js @@ -1,4 +1,5 @@ const { Client } = require('../../dist/client'); +const { InputFile } = require('../../dist/inputFile'); const { Avatars } = require('../../dist/services/avatars'); const { fetch: mockedFetch, Response } = require('undici'); @@ -81,6 +82,45 @@ describe('Avatars', () => { expect(response).toEqual(data); }); + test('test method updatePhoto()', async () => { + const data = { + '\\$id': '5e5ea5c16897e', + '\\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', + name: 'John Doe', + registration: '2020-10-15T06:38:00.000+00:00', + status: true, + labels: [], + passwordUpdate: '2020-10-15T06:38:00.000+00:00', + email: 'john@appwrite.io', + phone: '+4930901820', + emailVerification: true, + phoneVerification: true, + mfa: true, + prefs: {}, + targets: [], + accessedAt: '2020-10-15T06:38:00.000+00:00', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await avatars.updatePhoto( + InputFile.fromBuffer(new Uint8Array(0), 'image.png'), + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + test('test method deletePhoto()', async () => { + const data = { message: '' }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await avatars.deletePhoto(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); test('test method getQR()', async () => { const data = new ArrayBuffer(0); mockedFetch.mockImplementation(() => new Response(data)); diff --git a/test/services/backups.test.js b/test/services/backups.test.js index 912e8344..922f68dd 100644 --- a/test/services/backups.test.js +++ b/test/services/backups.test.js @@ -30,9 +30,7 @@ describe('Backups', () => { '\\$createdAt': '2020-10-15T06:38:00.000+00:00', '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', policyId: 'did8jx6ws45jana098ab7', - size: 100000, status: 'completed', - startedAt: '2020-10-15T06:38:00.000+00:00', migrationId: 'did8jx6ws45jana098ab7', services: [], resources: [], @@ -51,9 +49,7 @@ describe('Backups', () => { '\\$createdAt': '2020-10-15T06:38:00.000+00:00', '\\$updatedAt': '2020-10-15T06:38:00.000+00:00', policyId: 'did8jx6ws45jana098ab7', - size: 100000, status: 'completed', - startedAt: '2020-10-15T06:38:00.000+00:00', migrationId: 'did8jx6ws45jana098ab7', services: [], resources: [], @@ -103,7 +99,12 @@ describe('Backups', () => { enabled: true, }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await backups.createPolicy('<POLICY_ID>', [], 1, ''); + const response = await backups.createPolicy( + '<POLICY_ID>', + [], + 1, + 'schedule', + ); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; @@ -170,11 +171,10 @@ describe('Backups', () => { archiveId: 'did8jx6ws45jana098ab7', policyId: 'did8jx6ws45jana098ab7', status: 'completed', - startedAt: '2020-10-15T06:38:00.000+00:00', migrationId: 'did8jx6ws45jana098ab7', services: [], resources: [], - options: '{databases.database[{oldId, newId, newName}]}', + options: {}, }; mockedFetch.mockImplementation(() => Response.json(data)); const response = await backups.createRestoration('<ARCHIVE_ID>', []); @@ -205,11 +205,10 @@ describe('Backups', () => { archiveId: 'did8jx6ws45jana098ab7', policyId: 'did8jx6ws45jana098ab7', status: 'completed', - startedAt: '2020-10-15T06:38:00.000+00:00', migrationId: 'did8jx6ws45jana098ab7', services: [], resources: [], - options: '{databases.database[{oldId, newId, newName}]}', + options: {}, }; mockedFetch.mockImplementation(() => Response.json(data)); const response = await backups.getRestoration('<RESTORATION_ID>'); diff --git a/test/services/documents-d-b.test.js b/test/services/documents-d-b.test.js index 3042c582..39664550 100644 --- a/test/services/documents-d-b.test.js +++ b/test/services/documents-d-b.test.js @@ -706,7 +706,6 @@ describe('DocumentsDB', () => { engine: 'postgresql', version: '17', uptime: 86400, - connections: {}, syncMode: 'async', syncDegraded: true, syncAcknowledgements: 1, diff --git a/test/services/domains.test.js b/test/services/domains.test.js index 18e3e3c3..fc860189 100644 --- a/test/services/domains.test.js +++ b/test/services/domains.test.js @@ -342,7 +342,12 @@ describe('Domains', () => { comment: 'Mail server record', }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await domains.createRecordA('<DOMAIN_ID>', '', '', 1); + const response = await domains.createRecordA( + '<DOMAIN_ID>', + 'name', + 'value', + 1, + ); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; @@ -368,8 +373,8 @@ describe('Domains', () => { const response = await domains.updateRecordA( '<DOMAIN_ID>', '<RECORD_ID>', - '', - '', + 'name', + 'value', 1, ); @@ -396,8 +401,8 @@ describe('Domains', () => { mockedFetch.mockImplementation(() => Response.json(data)); const response = await domains.createRecordAAAA( '<DOMAIN_ID>', - '', - '', + 'name', + 'value', 1, ); @@ -425,8 +430,8 @@ describe('Domains', () => { const response = await domains.updateRecordAAAA( '<DOMAIN_ID>', '<RECORD_ID>', - '', - '', + 'name', + 'value', 1, ); @@ -453,7 +458,7 @@ describe('Domains', () => { mockedFetch.mockImplementation(() => Response.json(data)); const response = await domains.createRecordAlias( '<DOMAIN_ID>', - '', + 'name', '<VALUE>', 1, ); @@ -482,7 +487,7 @@ describe('Domains', () => { const response = await domains.updateRecordAlias( '<DOMAIN_ID>', '<RECORD_ID>', - '', + 'name', '<VALUE>', 1, ); @@ -510,8 +515,8 @@ describe('Domains', () => { mockedFetch.mockImplementation(() => Response.json(data)); const response = await domains.createRecordCAA( '<DOMAIN_ID>', - '', - '', + 'name', + 'value', 1, ); @@ -539,8 +544,8 @@ describe('Domains', () => { const response = await domains.updateRecordCAA( '<DOMAIN_ID>', '<RECORD_ID>', - '', - '', + 'name', + 'value', 1, ); @@ -567,7 +572,7 @@ describe('Domains', () => { mockedFetch.mockImplementation(() => Response.json(data)); const response = await domains.createRecordCNAME( '<DOMAIN_ID>', - '', + 'name', '<VALUE>', 1, ); @@ -596,7 +601,7 @@ describe('Domains', () => { const response = await domains.updateRecordCNAME( '<DOMAIN_ID>', '<RECORD_ID>', - '', + 'name', '<VALUE>', 1, ); @@ -624,7 +629,7 @@ describe('Domains', () => { mockedFetch.mockImplementation(() => Response.json(data)); const response = await domains.createRecordHTTPS( '<DOMAIN_ID>', - '', + 'name', '<VALUE>', 1, ); @@ -653,7 +658,7 @@ describe('Domains', () => { const response = await domains.updateRecordHTTPS( '<DOMAIN_ID>', '<RECORD_ID>', - '', + 'name', '<VALUE>', 1, ); @@ -681,7 +686,7 @@ describe('Domains', () => { mockedFetch.mockImplementation(() => Response.json(data)); const response = await domains.createRecordMX( '<DOMAIN_ID>', - '', + 'name', '<VALUE>', 1, 1, @@ -711,7 +716,7 @@ describe('Domains', () => { const response = await domains.updateRecordMX( '<DOMAIN_ID>', '<RECORD_ID>', - '', + 'name', '<VALUE>', 1, 1, @@ -740,7 +745,7 @@ describe('Domains', () => { mockedFetch.mockImplementation(() => Response.json(data)); const response = await domains.createRecordNS( '<DOMAIN_ID>', - '', + 'name', '<VALUE>', 1, ); @@ -769,7 +774,7 @@ describe('Domains', () => { const response = await domains.updateRecordNS( '<DOMAIN_ID>', '<RECORD_ID>', - '', + 'name', '<VALUE>', 1, ); @@ -797,7 +802,7 @@ describe('Domains', () => { mockedFetch.mockImplementation(() => Response.json(data)); const response = await domains.createRecordSRV( '<DOMAIN_ID>', - '', + 'name', '<VALUE>', 1, 1, @@ -829,7 +834,7 @@ describe('Domains', () => { const response = await domains.updateRecordSRV( '<DOMAIN_ID>', '<RECORD_ID>', - '', + 'name', '<VALUE>', 1, 1, @@ -858,7 +863,11 @@ describe('Domains', () => { comment: 'Mail server record', }; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await domains.createRecordTXT('<DOMAIN_ID>', '', 1); + const response = await domains.createRecordTXT( + '<DOMAIN_ID>', + 'name', + 1, + ); // Remove custom toString method on the objects to allow for clean data comparison. delete response.toString; @@ -884,7 +893,7 @@ describe('Domains', () => { const response = await domains.updateRecordTXT( '<DOMAIN_ID>', '<RECORD_ID>', - '', + 'name', '<VALUE>', 1, ); @@ -968,8 +977,8 @@ describe('Domains', () => { expect(response).toEqual(data); }); test('test method getZone()', async () => { - const data = { message: '' }; - mockedFetch.mockImplementation(() => Response.json(data)); + const data = 'text'; + mockedFetch.mockImplementation(() => new Response(data)); const response = await domains.getZone('<DOMAIN_ID>'); // Remove custom toString method on the objects to allow for clean data comparison. diff --git a/test/services/mongo.test.js b/test/services/mongo.test.js index 7c90bbf3..748ff58a 100644 --- a/test/services/mongo.test.js +++ b/test/services/mongo.test.js @@ -298,7 +298,7 @@ describe('Mongo', () => { '<DATABASE_ID>', '<POLICY_ID>', '<NAME>', - '', + 'schedule', 1, ); @@ -883,7 +883,6 @@ describe('Mongo', () => { engine: 'postgresql', version: '17', uptime: 86400, - connections: {}, syncMode: 'async', syncDegraded: true, syncAcknowledgements: 1, diff --git a/test/services/mysql.test.js b/test/services/mysql.test.js index b7ae2299..30e05cfa 100644 --- a/test/services/mysql.test.js +++ b/test/services/mysql.test.js @@ -298,7 +298,7 @@ describe('Mysql', () => { '<DATABASE_ID>', '<POLICY_ID>', '<NAME>', - '', + 'schedule', 1, ); @@ -942,7 +942,6 @@ describe('Mysql', () => { engine: 'postgresql', version: '17', uptime: 86400, - connections: {}, syncMode: 'async', syncDegraded: true, syncAcknowledgements: 1, diff --git a/test/services/postgresql.test.js b/test/services/postgresql.test.js index b6c9142c..f002ac00 100644 --- a/test/services/postgresql.test.js +++ b/test/services/postgresql.test.js @@ -298,7 +298,7 @@ describe('Postgresql', () => { '<DATABASE_ID>', '<POLICY_ID>', '<NAME>', - '', + 'schedule', 1, ); @@ -1093,7 +1093,6 @@ describe('Postgresql', () => { engine: 'postgresql', version: '17', uptime: 86400, - connections: {}, syncMode: 'async', syncDegraded: true, syncAcknowledgements: 1, diff --git a/test/services/project.test.js b/test/services/project.test.js index 37e8c782..de5af443 100644 --- a/test/services/project.test.js +++ b/test/services/project.test.js @@ -395,6 +395,7 @@ describe('Project', () => { clientId: 'OaOkIA000000000000000000005KLSYq', clientSecret: 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF', + prompt: [], endpoint: 'example.us.auth0.com', }; mockedFetch.mockImplementation(() => Response.json(data)); @@ -519,6 +520,7 @@ describe('Project', () => { enabled: true, clientId: '950722000000343754', clientSecret: 'YmPXnM000000000000000000002zFg5D', + prompt: [], }; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Discord(); @@ -627,6 +629,7 @@ describe('Project', () => { enabled: true, clientId: 'e4d87900000000540733', clientSecret: '5e07c00000000000000000000000000000198bcc', + prompt: [], }; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2GitHub(); @@ -693,6 +696,7 @@ describe('Project', () => { enabled: true, clientId: '839ff5000000000000000000013206de', clientSecret: 'jLNVOK00000000000000000000yJebea', + prompt: [], }; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Kakao(); @@ -756,6 +760,7 @@ describe('Project', () => { enabled: true, applicationId: '00001111-aaaa-2222-bbbb-3333cccc4444', applicationSecret: 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', + prompt: [], tenant: 'common', }; mockedFetch.mockImplementation(() => Response.json(data)); @@ -789,12 +794,12 @@ describe('Project', () => { clientId: 'qibI2x0000000000000000000000000006L2YFoG', clientSecret: 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV', + prompt: [], wellKnownURL: 'https://myoauth.com/.well-known/openid-configuration', authorizationURL: 'https://myoauth.com/oauth2/authorize', tokenURL: 'https://myoauth.com/oauth2/token', userInfoURL: 'https://myoauth.com/oauth2/userinfo', - prompt: [], }; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Oidc(); @@ -811,6 +816,7 @@ describe('Project', () => { clientId: '0oa00000000000000698', clientSecret: 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV', + prompt: [], domain: 'trial-6400025.okta.com', authorizationServerId: 'aus000000000000000h7z', }; @@ -895,6 +901,7 @@ describe('Project', () => { customerKey: '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq', customerSecret: '3w000000000000e2', + prompt: [], }; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Salesforce(); @@ -1010,6 +1017,23 @@ describe('Project', () => { expect(response).toEqual(data); }); + test('test method updateOAuth2Webflow()', async () => { + const data = { + '\\$id': 'github', + enabled: true, + clientId: + '8bb20000000000000000000000000000000000000000000000000000000040dd', + clientSecret: + '59bf00000000000000000000000000000000000000000000000000000000fe59', + }; + mockedFetch.mockImplementation(() => Response.json(data)); + const response = await project.updateOAuth2Webflow(); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); test('test method updateOAuth2WordPress()', async () => { const data = { '\\$id': 'github', @@ -1078,6 +1102,7 @@ describe('Project', () => { enabled: true, clientId: '1000.83C178000000000000000000RPNX0B', clientSecret: 'fb5cac000000000000000000000000000000a68f6e', + prompt: [], }; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Zoho(); @@ -1108,6 +1133,7 @@ describe('Project', () => { enabled: true, clientId: '839ff5000000000000000000013206de', clientSecret: 'jLNVOK00000000000000000000yJebea', + prompt: [], }; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.getOAuth2Provider('amazon'); diff --git a/test/services/tables-d-b.test.js b/test/services/tables-d-b.test.js index 33dc9111..1c1cf2f4 100644 --- a/test/services/tables-d-b.test.js +++ b/test/services/tables-d-b.test.js @@ -406,7 +406,6 @@ describe('TablesDB', () => { engine: 'postgresql', version: '17', uptime: 86400, - connections: {}, syncMode: 'async', syncDegraded: true, syncAcknowledgements: 1, diff --git a/test/services/vectors-d-b.test.js b/test/services/vectors-d-b.test.js index d3b0a615..3df11da3 100644 --- a/test/services/vectors-d-b.test.js +++ b/test/services/vectors-d-b.test.js @@ -678,7 +678,6 @@ describe('VectorsDB', () => { engine: 'postgresql', version: '17', uptime: 86400, - connections: {}, syncMode: 'async', syncDegraded: true, syncAcknowledgements: 1, diff --git a/test/topic.test.js b/test/topic.test.js new file mode 100644 index 00000000..44ba8cda --- /dev/null +++ b/test/topic.test.js @@ -0,0 +1,44 @@ +const { Topic } = require('../dist/topic'); + +describe('Topic', () => { + test('path', () => { + expect(Topic.path(['user']).toString()).toEqual('user'); + expect(Topic.path(['user', 'notification']).toString()).toEqual( + 'user/notification', + ); + expect(Topic.path(['user']).path(['notification']).toString()).toEqual( + 'user/notification', + ); + }); + test('any', () => { + expect( + Topic.path(['user']).any().path(['notification']).toString(), + ).toEqual('user/+/notification'); + expect( + Topic.path(['chat']).any().any().path(['message']).toString(), + ).toEqual('chat/+/+/message'); + expect(Topic.any().path(['notification']).toString()).toEqual( + '+/notification', + ); + }); + test('all', () => { + expect( + Topic.path(['org']).any().path(['logs']).all().toString(), + ).toEqual('org/+/logs/#'); + expect(Topic.all().toString()).toEqual('#'); + }); + test.each([ + ['an empty path', []], + ['an empty level', ['user', '']], + ['a slash', ['user/123']], + ['a lone +', ['user', '+']], + ['an embedded +', ['user', 'a+b']], + ['a lone #', ['user', '#']], + ['an embedded #', ['user', 'a#b']], + ['a non-string level', ['user', null]], + ['a non-array', 'user'], + ])('rejects %s', (_, levels) => { + expect(() => Topic.path(levels)).toThrow(Error); + expect(() => Topic.any().path(levels)).toThrow(Error); + }); +});