From 68229e83ccb59d4fefb103aa3c5cb0819a0e0fe0 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 23 Sep 2025 15:21:16 +1200 Subject: [PATCH] Add order random --- docs/examples/databases/create-line-attribute.md | 2 +- .../examples/databases/create-point-attribute.md | 2 +- .../databases/create-polygon-attribute.md | 2 +- docs/examples/databases/update-line-attribute.md | 2 +- .../examples/databases/update-point-attribute.md | 2 +- .../databases/update-polygon-attribute.md | 2 +- docs/examples/tablesdb/create-line-column.md | 2 +- docs/examples/tablesdb/create-point-column.md | 2 +- docs/examples/tablesdb/create-polygon-column.md | 2 +- docs/examples/tablesdb/update-line-column.md | 2 +- docs/examples/tablesdb/update-point-column.md | 2 +- docs/examples/tablesdb/update-polygon-column.md | 2 +- package.json | 2 +- src/client.ts | 4 ++-- src/models.ts | 14 +++++++------- src/query.ts | 16 ++++++++++++---- src/services/tables-db.ts | 4 ++-- 17 files changed, 36 insertions(+), 28 deletions(-) diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md index 2b356de..160bb5b 100644 --- a/docs/examples/databases/create-line-attribute.md +++ b/docs/examples/databases/create-line-attribute.md @@ -12,5 +12,5 @@ const result = await databases.createLineAttribute({ collectionId: '', key: '', required: false, - default: [[1,2], [3, 4]] // optional + default: [[1, 2], [3, 4], [5, 6]] // optional }); diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md index 3733d73..e65f5bd 100644 --- a/docs/examples/databases/create-point-attribute.md +++ b/docs/examples/databases/create-point-attribute.md @@ -12,5 +12,5 @@ const result = await databases.createPointAttribute({ collectionId: '', key: '', required: false, - default: [[1,2], [3, 4]] // optional + default: [1, 2] // optional }); diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md index 0fbe7de..3d51887 100644 --- a/docs/examples/databases/create-polygon-attribute.md +++ b/docs/examples/databases/create-polygon-attribute.md @@ -12,5 +12,5 @@ const result = await databases.createPolygonAttribute({ collectionId: '', key: '', required: false, - default: [[1,2], [3, 4]] // optional + default: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional }); diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md index dfc6a30..3c4d785 100644 --- a/docs/examples/databases/update-line-attribute.md +++ b/docs/examples/databases/update-line-attribute.md @@ -12,6 +12,6 @@ const result = await databases.updateLineAttribute({ collectionId: '', key: '', required: false, - default: [[1,2], [3, 4]], // optional + default: [[1, 2], [3, 4], [5, 6]], // optional newKey: '' // optional }); diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md index 9587f4f..0da3b33 100644 --- a/docs/examples/databases/update-point-attribute.md +++ b/docs/examples/databases/update-point-attribute.md @@ -12,6 +12,6 @@ const result = await databases.updatePointAttribute({ collectionId: '', key: '', required: false, - default: [[1,2], [3, 4]], // optional + default: [1, 2], // optional newKey: '' // optional }); diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md index f3df251..c7767cb 100644 --- a/docs/examples/databases/update-polygon-attribute.md +++ b/docs/examples/databases/update-polygon-attribute.md @@ -12,6 +12,6 @@ const result = await databases.updatePolygonAttribute({ collectionId: '', key: '', required: false, - default: [[1,2], [3, 4]], // optional + default: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional newKey: '' // optional }); diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md index 719f95b..84b941c 100644 --- a/docs/examples/tablesdb/create-line-column.md +++ b/docs/examples/tablesdb/create-line-column.md @@ -12,5 +12,5 @@ const result = await tablesDB.createLineColumn({ tableId: '', key: '', required: false, - default: [[1,2], [3, 4]] // optional + default: [[1, 2], [3, 4], [5, 6]] // optional }); diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md index 4dbba23..c59e420 100644 --- a/docs/examples/tablesdb/create-point-column.md +++ b/docs/examples/tablesdb/create-point-column.md @@ -12,5 +12,5 @@ const result = await tablesDB.createPointColumn({ tableId: '', key: '', required: false, - default: [[1,2], [3, 4]] // optional + default: [1, 2] // optional }); diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md index 76dabf3..36f2f4c 100644 --- a/docs/examples/tablesdb/create-polygon-column.md +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -12,5 +12,5 @@ const result = await tablesDB.createPolygonColumn({ tableId: '', key: '', required: false, - default: [[1,2], [3, 4]] // optional + default: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional }); diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md index 8c00645..4ec0abe 100644 --- a/docs/examples/tablesdb/update-line-column.md +++ b/docs/examples/tablesdb/update-line-column.md @@ -12,6 +12,6 @@ const result = await tablesDB.updateLineColumn({ tableId: '', key: '', required: false, - default: [[1,2], [3, 4]], // optional + default: [[1, 2], [3, 4], [5, 6]], // optional newKey: '' // optional }); diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md index 5ece8d8..cddb198 100644 --- a/docs/examples/tablesdb/update-point-column.md +++ b/docs/examples/tablesdb/update-point-column.md @@ -12,6 +12,6 @@ const result = await tablesDB.updatePointColumn({ tableId: '', key: '', required: false, - default: [[1,2], [3, 4]], // optional + default: [1, 2], // optional newKey: '' // optional }); diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md index 0649a84..963db8b 100644 --- a/docs/examples/tablesdb/update-polygon-column.md +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -12,6 +12,6 @@ const result = await tablesDB.updatePolygonColumn({ tableId: '', key: '', required: false, - default: [[1,2], [3, 4]], // optional + default: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional newKey: '' // optional }); diff --git a/package.json b/package.json index 58e2b24..278a0d6 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 abstract and simplify complex and repetitive development tasks behind a very simple REST API", - "version": "19.0.0", + "version": "19.1.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 9e577e3..715c6a3 100644 --- a/src/client.ts +++ b/src/client.ts @@ -33,7 +33,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/19.0.0'; + let ua = 'AppwriteNodeJSSDK/19.1.0'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -82,7 +82,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '19.0.0', + 'x-sdk-version': '19.1.0', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.8.0', }; diff --git a/src/models.ts b/src/models.ts index c08b303..22fd10b 100644 --- a/src/models.ts +++ b/src/models.ts @@ -3232,10 +3232,6 @@ export namespace Models { * The url of the vcs provider repository */ providerRepositoryUrl: string; - /** - * The branch of the vcs repository - */ - providerBranch: string; /** * The commit hash of the vcs commit */ @@ -3256,6 +3252,10 @@ export namespace Models { * The url of the vcs commit */ providerCommitUrl: string; + /** + * The branch of the vcs repository + */ + providerBranch: string; /** * The branch of the vcs repository */ @@ -3307,7 +3307,7 @@ export namespace Models { */ requestPath: string; /** - * HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. + * HTTP request headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. */ requestHeaders: Headers[]; /** @@ -3485,7 +3485,7 @@ export namespace Models { */ version: string; /** - * Antivirus status. Possible values can are: `disabled`, `offline`, `online` + * Antivirus status. Possible values are: `disabled`, `offline`, `online` */ status: string; } @@ -3513,7 +3513,7 @@ export namespace Models { */ ping: number; /** - * Service status. Possible values can are: `pass`, `fail` + * Service status. Possible values are: `pass`, `fail` */ status: string; } diff --git a/src/query.ts b/src/query.ts index ddaa3f2..8b274f4 100644 --- a/src/query.ts +++ b/src/query.ts @@ -52,20 +52,20 @@ export class Query { * Filter resources where attribute is equal to value. * * @param {string} attribute - * @param {QueryTypes | any[]} value + * @param {QueryTypes} value * @returns {string} */ - static equal = (attribute: string, value: QueryTypes | any[]): string => + static equal = (attribute: string, value: QueryTypes): string => new Query("equal", attribute, value).toString(); /** * Filter resources where attribute is not equal to value. * * @param {string} attribute - * @param {QueryTypes | any[]} value + * @param {QueryTypes} value * @returns {string} */ - static notEqual = (attribute: string, value: QueryTypes | any[]): string => + static notEqual = (attribute: string, value: QueryTypes): string => new Query("notEqual", attribute, value).toString(); /** @@ -195,6 +195,14 @@ export class Query { static orderAsc = (attribute: string): string => new Query("orderAsc", attribute).toString(); + /** + * Sort results randomly. + * + * @returns {string} + */ + static orderRandom = (): string => + new Query("orderRandom").toString(); + /** * Return results after documentId. * diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index 096f07e..a01149f 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -3898,7 +3898,7 @@ export class TablesDB { * * @param {string} params.databaseId - Database ID. * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). Make sure to define columns before creating rows. - * @param {object[]} params.rows - Array of documents data as JSON objects. + * @param {object[]} params.rows - Array of rows data as JSON objects. * @throws {AppwriteException} * @returns {Promise>} */ @@ -3908,7 +3908,7 @@ export class TablesDB { * * @param {string} databaseId - Database ID. * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreate). Make sure to define columns before creating rows. - * @param {object[]} rows - Array of documents data as JSON objects. + * @param {object[]} rows - Array of rows data as JSON objects. * @throws {AppwriteException} * @returns {Promise>} * @deprecated Use the object parameter style method for a better developer experience.