diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ac51798..2b38d347 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change log +## 0.30.1 + +* Fixed: Removed `Advisor` service and `Insight`, `InsightCTA`, `InsightList`, `Report`, `ReportList` models (admin-only endpoints, not intended for client SDKs) +* Added: `sizeActual` field to `File` model + ## 0.30.0 * Added: Realtime `presences` channel and `RealtimePresence` types for presence subscriptions diff --git a/docs/examples/advisor/get-insight.md b/docs/examples/advisor/get-insight.md deleted file mode 100644 index 0f2a45b4..00000000 --- a/docs/examples/advisor/get-insight.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Advisor } from "react-native-appwrite"; - -const client = new Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const advisor = new Advisor(client); - -const result = await advisor.getInsight({ - reportId: '', - insightId: '' -}); - -console.log(result); -``` diff --git a/docs/examples/advisor/get-report.md b/docs/examples/advisor/get-report.md deleted file mode 100644 index e2dbdf27..00000000 --- a/docs/examples/advisor/get-report.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -import { Client, Advisor } from "react-native-appwrite"; - -const client = new Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const advisor = new Advisor(client); - -const result = await advisor.getReport({ - reportId: '' -}); - -console.log(result); -``` diff --git a/docs/examples/advisor/list-insights.md b/docs/examples/advisor/list-insights.md deleted file mode 100644 index 94bb145f..00000000 --- a/docs/examples/advisor/list-insights.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Advisor } from "react-native-appwrite"; - -const client = new Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const advisor = new Advisor(client); - -const result = await advisor.listInsights({ - reportId: '', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/advisor/list-reports.md b/docs/examples/advisor/list-reports.md deleted file mode 100644 index 2194ba57..00000000 --- a/docs/examples/advisor/list-reports.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Advisor } from "react-native-appwrite"; - -const client = new Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID - -const advisor = new Advisor(client); - -const result = await advisor.listReports({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/package-lock.json b/package-lock.json index 4359545b..a05bd6c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "react-native-appwrite", - "version": "0.30.0", + "version": "0.30.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "react-native-appwrite", - "version": "0.30.0", + "version": "0.30.1", "license": "BSD-3-Clause", "dependencies": { "expo-file-system": "18.*.*", diff --git a/package.json b/package.json index b399bba3..d792c587 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "react-native-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": "0.30.0", + "version": "0.30.1", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index 744509a8..02077127 100644 --- a/src/client.ts +++ b/src/client.ts @@ -180,7 +180,7 @@ class Client { 'x-sdk-name': 'React Native', 'x-sdk-platform': 'client', 'x-sdk-language': 'reactnative', - 'x-sdk-version': '0.30.0', + 'x-sdk-version': '0.30.1', 'X-Appwrite-Response-Format': '1.9.5', }; diff --git a/src/index.ts b/src/index.ts index 0b86dac4..52bb3e2a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,7 +7,6 @@ export { Graphql } from './services/graphql'; export { Locale } from './services/locale'; export { Messaging } from './services/messaging'; export { Presences } from './services/presences'; -export { Advisor } from './services/advisor'; export { Storage } from './services/storage'; export { TablesDB } from './services/tables-db'; export { Teams } from './services/teams'; diff --git a/src/models.ts b/src/models.ts index c87bb866..9b0a9c7b 100644 --- a/src/models.ts +++ b/src/models.ts @@ -243,34 +243,6 @@ export namespace Models { transactions: Transaction[]; } - /** - * Insights List - */ - export type InsightList = { - /** - * Total number of insights that matched your query. - */ - total: number; - /** - * List of insights. - */ - insights: Insight[]; - } - - /** - * Reports List - */ - export type ReportList = { - /** - * Total number of reports that matched your query. - */ - total: number; - /** - * List of reports. - */ - reports: Report[]; - } - /** * Row */ @@ -993,6 +965,10 @@ export namespace Models { * File original size in bytes. */ sizeOriginal: number; + /** + * File actual stored size in bytes after compression and/or encryption. + */ + sizeActual: number; /** * Total number of chunks available */ @@ -1474,154 +1450,4 @@ export namespace Models { */ expired: boolean; } - - /** - * Insight - */ - export type Insight = { - /** - * Insight ID. - */ - $id: string; - /** - * Insight creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Insight update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Parent report ID. Insights always belong to a report. - */ - reportId: string; - /** - * Insight type. One of databaseIndex (legacy), tablesDBIndex, documentsDBIndex, vectorsDBIndex, databasePerformance, sitePerformance, siteAccessibility, siteSeo, functionPerformance. The index types are engine-specific so each CTA can pair the right service+method (databases.createIndex, tablesDB.createIndex, documentsDB.createIndex, or vectorsDB.createIndex). - */ - type: string; - /** - * Insight severity. One of info, warning, critical. - */ - severity: string; - /** - * Insight status. One of active, dismissed. - */ - status: string; - /** - * Type of the resource the insight is about. Plural noun, e.g. databases, sites, functions. - */ - resourceType: string; - /** - * ID of the resource the insight is about. - */ - resourceId: string; - /** - * Plural noun for the parent resource that contains the insight's resource, e.g. an insight about a column index on a table → resourceType=indexes, parentResourceType=tables. Empty when the resource has no parent. - */ - parentResourceType: string; - /** - * ID of the parent resource. Empty when the resource has no parent. - */ - parentResourceId: string; - /** - * Insight title. - */ - title: string; - /** - * Short markdown summary describing the insight. - */ - summary: string; - /** - * List of call-to-action buttons attached to this insight. - */ - ctas: InsightCTA[]; - /** - * Time the insight was analyzed in ISO 8601 format. - */ - analyzedAt?: string; - /** - * Time the insight was dismissed in ISO 8601 format. Empty when not dismissed. - */ - dismissedAt?: string; - /** - * User ID that dismissed the insight. Empty when not dismissed. - */ - dismissedBy?: string; - } - - /** - * InsightCTA - */ - export type InsightCTA = { - /** - * Human-readable label for the CTA, used in UI. - */ - label: string; - /** - * Public API service (SDK namespace) the client should invoke. Must match the engine that owns the resource — for index suggestions: databases (legacy), tablesDB, documentsDB, or vectorsDB. - */ - service: string; - /** - * Public API method on the chosen service the client should invoke when this CTA is triggered. - */ - method: string; - /** - * Parameter map the client should pass to the service method when this CTA is triggered. Keys match the target API's parameter names (e.g. databaseId/tableId/columns for tablesDB, databaseId/collectionId/attributes for the legacy Databases API). - */ - params: object; - } - - /** - * Report - */ - export type Report = { - /** - * Report ID. - */ - $id: string; - /** - * Report creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Report update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * ID of the third-party app that submitted the report. - */ - appId: string; - /** - * Analyzer that produced this report. e.g. lighthouse, audit, databaseAnalyzer. - */ - type: string; - /** - * Short, human-readable title for the report. - */ - title: string; - /** - * Markdown summary describing the report. - */ - summary: string; - /** - * Plural noun describing what the report analyzes, e.g. databases, sites, urls. - */ - targetType: string; - /** - * Free-form target identifier (URL for lighthouse, resource ID for db). - */ - target: string; - /** - * Categories covered by the report, e.g. performance, accessibility. - */ - categories: string[]; - /** - * Insights nested under this report. - */ - insights: Insight[]; - /** - * Time the report was analyzed in ISO 8601 format. - */ - analyzedAt?: string; - } } diff --git a/src/services/advisor.ts b/src/services/advisor.ts deleted file mode 100644 index 6407d51b..00000000 --- a/src/services/advisor.ts +++ /dev/null @@ -1,234 +0,0 @@ -import { Service } from '../service'; -import { AppwriteException, Client } from '../client'; -import type { Models } from '../models'; -import type { UploadProgress, Payload } from '../client'; -import * as FileSystem from 'expo-file-system'; -import { Platform as RNPlatform } from 'react-native'; - - -export class Advisor extends Service { - - constructor(client: Client) - { - super(client); - } - - /** - * Get a list of all the project's analyzer reports. You can use the query params to filter your results. - * - * - * @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: appId, type, targetType, target, analyzedAt - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise} - */ - listReports(params?: { queries?: string[], total?: boolean }): Promise; - /** - * Get a list of all the project's analyzer reports. You can use the query params to filter your results. - * - * - * @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: appId, type, targetType, target, analyzedAt - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listReports(queries?: string[], total?: boolean): Promise; - listReports( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - 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 = '/reports'; - const payload: Payload = {}; - - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - - if (typeof total !== 'undefined') { - payload['total'] = total; - } - - const uri = new URL(this.client.config.endpoint + apiPath); - return this.client.call('get', uri, { - }, payload); - } - - /** - * Get an analyzer report by its unique ID. The response includes the report's metadata and the nested insights it produced. - * - * - * @param {string} params.reportId - Report ID. - * @throws {AppwriteException} - * @returns {Promise} - */ - getReport(params: { reportId: string }): Promise; - /** - * Get an analyzer report by its unique ID. The response includes the report's metadata and the nested insights it produced. - * - * - * @param {string} reportId - Report ID. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getReport(reportId: string): Promise; - getReport( - paramsOrFirst: { reportId: string } | string - ): Promise { - let params: { reportId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { reportId: string }; - } else { - params = { - reportId: paramsOrFirst as string - }; - } - - const reportId = params.reportId; - - if (typeof reportId === 'undefined') { - throw new AppwriteException('Missing required parameter: "reportId"'); - } - - const apiPath = '/reports/{reportId}'.replace('{reportId}', reportId); - const payload: Payload = {}; - - const uri = new URL(this.client.config.endpoint + apiPath); - return this.client.call('get', uri, { - }, payload); - } - - /** - * List the insights produced under a single analyzer report. You can use the query params to filter your results further. - * - * - * @param {string} params.reportId - Parent report ID. - * @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: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise} - */ - listInsights(params: { reportId: string, queries?: string[], total?: boolean }): Promise; - /** - * List the insights produced under a single analyzer report. You can use the query params to filter your results further. - * - * - * @param {string} reportId - Parent report ID. - * @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: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listInsights(reportId: string, queries?: string[], total?: boolean): Promise; - listInsights( - paramsOrFirst: { reportId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise { - let params: { reportId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { reportId: string, queries?: string[], total?: boolean }; - } else { - params = { - reportId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const reportId = params.reportId; - const queries = params.queries; - const total = params.total; - - if (typeof reportId === 'undefined') { - throw new AppwriteException('Missing required parameter: "reportId"'); - } - - const apiPath = '/reports/{reportId}/insights'.replace('{reportId}', reportId); - const payload: Payload = {}; - - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - - if (typeof total !== 'undefined') { - payload['total'] = total; - } - - const uri = new URL(this.client.config.endpoint + apiPath); - return this.client.call('get', uri, { - }, payload); - } - - /** - * Get an insight by its unique ID, scoped to its parent report. - * - * - * @param {string} params.reportId - Parent report ID. - * @param {string} params.insightId - Insight ID. - * @throws {AppwriteException} - * @returns {Promise} - */ - getInsight(params: { reportId: string, insightId: string }): Promise; - /** - * Get an insight by its unique ID, scoped to its parent report. - * - * - * @param {string} reportId - Parent report ID. - * @param {string} insightId - Insight ID. - * @throws {AppwriteException} - * @returns {Promise} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getInsight(reportId: string, insightId: string): Promise; - getInsight( - paramsOrFirst: { reportId: string, insightId: string } | string, - ...rest: [(string)?] - ): Promise { - let params: { reportId: string, insightId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { reportId: string, insightId: string }; - } else { - params = { - reportId: paramsOrFirst as string, - insightId: rest[0] as string - }; - } - - const reportId = params.reportId; - const insightId = params.insightId; - - if (typeof reportId === 'undefined') { - throw new AppwriteException('Missing required parameter: "reportId"'); - } - - if (typeof insightId === 'undefined') { - throw new AppwriteException('Missing required parameter: "insightId"'); - } - - const apiPath = '/reports/{reportId}/insights/{insightId}'.replace('{reportId}', reportId).replace('{insightId}', insightId); - const payload: Payload = {}; - - const uri = new URL(this.client.config.endpoint + apiPath); - return this.client.call('get', uri, { - }, payload); - } -};