monday-sdk-js 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monday-sdk-js",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "private": false,
5
5
  "repository": "https://github.com/mondaycom/monday-sdk-js",
6
6
  "main": "src/index.js",
@@ -32,6 +32,11 @@ type AppVersion = {
32
32
  };
33
33
  };
34
34
 
35
+ export type Permissions = {
36
+ approvedScopes: string[];
37
+ requiredScopes: string[];
38
+ };
39
+
35
40
  export type BaseContext = {
36
41
  themeConfig?: Theme;
37
42
  theme: string;
@@ -40,6 +45,7 @@ export type BaseContext = {
40
45
  region: string;
41
46
  app: App;
42
47
  appVersion: AppVersion;
48
+ permissions: Permissions;
43
49
  };
44
50
 
45
51
  export type AppFeatureBoardViewContext = BaseContext & {
@@ -1,29 +1,49 @@
1
1
  import { AppFeatureContextMap, AppFeatureTypes } from "./client-context.type";
2
2
 
3
+ export type LocationResponse = Record<string, any> & {
4
+ href: string;
5
+ search: string;
6
+ };
7
+
8
+ export type FilterResponse = Record<string, any> & {
9
+ term: string;
10
+ rules: (Record<string, any> & {
11
+ column_id?: string;
12
+ compare_value?: string[];
13
+ compare_attribute?: string;
14
+ operator?: string;
15
+ })[];
16
+ operator: string | null;
17
+ };
18
+
3
19
  type SubscribableEventsResponse<AppFeatureType extends AppFeatureTypes = AppFeatureTypes> = {
4
20
  context: AppFeatureContextMap[AppFeatureType];
5
21
  settings: Record<string, any>;
6
22
  itemIds: number[];
7
23
  events: Record<string, any>;
24
+ location: LocationResponse;
25
+ filter: FilterResponse;
8
26
  };
9
27
 
10
28
  type SubscribableEvents = keyof SubscribableEventsResponse;
11
29
 
12
30
  type SettableTypes = "settings";
13
31
 
14
- interface GetResponse {
15
- data: {
16
- success: boolean;
17
- value: any;
18
- version?: any;
19
- };
32
+ type StorageResponse = {
33
+ success: boolean;
34
+ value: any;
35
+ version?: any;
36
+ };
37
+
38
+ type Response<T = StorageResponse> = {
39
+ data: T;
20
40
  errorMessage?: string | undefined;
21
41
  method: string;
22
42
  requestId: string;
23
43
  type?: string | undefined;
24
- }
44
+ };
25
45
 
26
- interface DeleteResponse {
46
+ type DeleteResponse = {
27
47
  data: {
28
48
  success: boolean;
29
49
  value: any;
@@ -32,7 +52,7 @@ interface DeleteResponse {
32
52
  method: string;
33
53
  requestId: string;
34
54
  type?: string | undefined;
35
- }
55
+ };
36
56
 
37
57
  interface SetResponse {
38
58
  data: {
@@ -52,6 +72,8 @@ export type GetterResponse<AppFeatureType extends AppFeatureTypes = AppFeatureTy
52
72
  settings: Record<string, any>;
53
73
  itemIds: number[];
54
74
  sessionToken: string;
75
+ location: LocationResponse;
76
+ filter: FilterResponse;
55
77
  };
56
78
  export interface ClientData {
57
79
  /**
@@ -70,8 +92,8 @@ export interface ClientData {
70
92
  AppFeatureType extends AppFeatureTypes = AppFeatureTypes
71
93
  >(
72
94
  type: T,
73
- params?: object & { appFeatureType?: AppFeatureType }
74
- ): Promise<GetterResponse<AppFeatureType>[T] & CustomResponse>;
95
+ params?: Record<string, any> & { appFeatureType?: AppFeatureType }
96
+ ): Promise<Response<GetterResponse<AppFeatureType>[T] & CustomResponse>>;
75
97
 
76
98
  /**
77
99
  * Creates a listener which allows subscribing to certain types of client-side events.
@@ -86,7 +108,7 @@ export interface ClientData {
86
108
  >(
87
109
  typeOrTypes: T | ReadonlyArray<T>,
88
110
  callback: (res: { data: SubscribableEventsResponse<AppFeatureType>[T] & CustomResponse }) => void,
89
- params?: object & { appFeatureType?: AppFeatureType }
111
+ params?: Record<string, any> & { appFeatureType?: AppFeatureType }
90
112
  ): void;
91
113
 
92
114
  /**
@@ -110,7 +132,7 @@ export interface ClientData {
110
132
  * Returns a stored value from the database under `key` for the app (**without any reference to the instance**)
111
133
  * @param {string} key - Used to access to stored data
112
134
  */
113
- getItem(key: string): Promise<GetResponse>;
135
+ getItem(key: string): Promise<Response>;
114
136
 
115
137
  /**
116
138
  * Deletes a stored value from the database under `key` for the app (**without any reference to the instance**)
@@ -135,7 +157,7 @@ export interface ClientData {
135
157
  * Returns a stored value from the database under `key` for a specific app instance
136
158
  * @param key
137
159
  */
138
- getItem(key: string): Promise<GetResponse>;
160
+ getItem(key: string): Promise<Response>;
139
161
 
140
162
  /**
141
163
  * Deletes a stored value from the database under `key` for a specific app instance
package/types/index.d.ts CHANGED
@@ -1,22 +1,22 @@
1
1
  // Original Definitions were contributed by: Josh Parnham <https://github.com/josh->
2
- import { MondayClientSdk } from './client-sdk.interface';
3
- import { MondayServerSdk } from './server-sdk.interface';
2
+ import { MondayClientSdk } from "./client-sdk.interface";
3
+ import { MondayServerSdk } from "./server-sdk.interface";
4
4
 
5
5
  export as namespace mondaySdk;
6
6
 
7
7
  declare function init(
8
- config?: Partial<{
9
- clientId: string;
10
- apiToken: string;
11
- apiVersion: string;
12
- }>,
8
+ config?: Partial<{
9
+ clientId: string;
10
+ apiToken: string;
11
+ apiVersion: string;
12
+ }>
13
13
  ): MondayClientSdk;
14
14
 
15
15
  declare function init(
16
- config?: Partial<{
17
- token: string;
18
- apiVersion: string;
19
- }>,
16
+ config?: Partial<{
17
+ token: string;
18
+ apiVersion: string;
19
+ }>
20
20
  ): MondayServerSdk;
21
21
 
22
22
  export = init;