From 107975ca1c2431b8a9e5b812d3b3f69e286b2c35 Mon Sep 17 00:00:00 2001 From: rami-monday Date: Wed, 10 Jan 2024 21:21:46 +0200 Subject: [PATCH] fixing the type of get response --- package-lock.json | 4 ++-- package.json | 2 +- types/client-context.type.ts | 6 ++++++ types/client-data.interface.ts | 30 ++++++++++++++++-------------- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1305d360..08bb0b11 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "monday-sdk-js", - "version": "0.5.1", + "version": "0.5.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "monday-sdk-js", - "version": "0.5.1", + "version": "0.5.3", "license": "MIT", "dependencies": { "node-fetch": "^2.6.0" diff --git a/package.json b/package.json index bbc90391..296300f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monday-sdk-js", - "version": "0.5.2", + "version": "0.5.3", "private": false, "repository": "https://github.com/mondaycom/monday-sdk-js", "main": "src/index.js", diff --git a/types/client-context.type.ts b/types/client-context.type.ts index 339cd8a7..7608533e 100644 --- a/types/client-context.type.ts +++ b/types/client-context.type.ts @@ -32,6 +32,11 @@ type AppVersion = { }; }; +export type Permissions = { + approvedScopes: string[]; + requiredScopes: string[]; +}; + export type BaseContext = { themeConfig?: Theme; theme: string; @@ -40,6 +45,7 @@ export type BaseContext = { region: string; app: App; appVersion: AppVersion; + permissions: Permissions; }; export type AppFeatureBoardViewContext = BaseContext & { diff --git a/types/client-data.interface.ts b/types/client-data.interface.ts index 884f5f5b..c94e96a5 100644 --- a/types/client-data.interface.ts +++ b/types/client-data.interface.ts @@ -11,19 +11,21 @@ type SubscribableEvents = keyof SubscribableEventsResponse; type SettableTypes = "settings"; -interface GetResponse { - data: { - success: boolean; - value: any; - version?: any; - }; +type StorageResponse = { + success: boolean; + value: any; + version?: any; +}; + +type Response = { + data: T; errorMessage?: string | undefined; method: string; requestId: string; type?: string | undefined; -} +}; -interface DeleteResponse { +type DeleteResponse = { data: { success: boolean; value: any; @@ -32,7 +34,7 @@ interface DeleteResponse { method: string; requestId: string; type?: string | undefined; -} +}; interface SetResponse { data: { @@ -70,8 +72,8 @@ export interface ClientData { AppFeatureType extends AppFeatureTypes = AppFeatureTypes >( type: T, - params?: object & { appFeatureType?: AppFeatureType } - ): Promise[T] & CustomResponse>; + params?: Record & { appFeatureType?: AppFeatureType } + ): Promise[T] & CustomResponse>>; /** * Creates a listener which allows subscribing to certain types of client-side events. @@ -86,7 +88,7 @@ export interface ClientData { >( typeOrTypes: T | ReadonlyArray, callback: (res: { data: SubscribableEventsResponse[T] & CustomResponse }) => void, - params?: object & { appFeatureType?: AppFeatureType } + params?: Record & { appFeatureType?: AppFeatureType } ): void; /** @@ -110,7 +112,7 @@ export interface ClientData { * Returns a stored value from the database under `key` for the app (**without any reference to the instance**) * @param {string} key - Used to access to stored data */ - getItem(key: string): Promise; + getItem(key: string): Promise; /** * Deletes a stored value from the database under `key` for the app (**without any reference to the instance**) @@ -135,7 +137,7 @@ export interface ClientData { * Returns a stored value from the database under `key` for a specific app instance * @param key */ - getItem(key: string): Promise; + getItem(key: string): Promise; /** * Deletes a stored value from the database under `key` for a specific app instance