@kissflow/lowcode-client-sdk 1.0.39 → 1.0.41

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.
@@ -24,14 +24,69 @@ declare class TableForm {
24
24
  updateField(args: object): any;
25
25
  }
26
26
  declare class Client {
27
- showInfo(message: string | object): any;
28
- showConfirm(args: {
27
+ /**
28
+ * Display an info message toast in the platform.
29
+ *
30
+ * @param message - The message to display. Accepts a string or object (serialized to JSON).
31
+ * @returns A promise that resolves when the message is shown.
32
+ *
33
+ * @example
34
+ * await kf.client.showInfo("Record saved successfully");
35
+ */
36
+ showInfo(message: string | object): any;
37
+ /**
38
+ * Display a confirmation dialog and wait for the user's response.
39
+ *
40
+ * @param args - Dialog configuration.
41
+ * @param args.title - Dialog title.
42
+ * @param args.content - Body text of the dialog.
43
+ * @param args.okText - Label for the confirm button (default: "Ok").
44
+ * @param args.cancelText - Label for the cancel button (default: "Cancel").
45
+ * @returns A promise that resolves with `{ action: "OK" }` or `{ action: "CANCEL" }`.
46
+ *
47
+ * @example
48
+ * const { action } = await kf.client.showConfirm({
49
+ * title: "Delete record?",
50
+ * content: "This cannot be undone.",
51
+ * okText: "Delete",
52
+ * cancelText: "Cancel",
53
+ * });
54
+ * if (action === "OK") { ... }
55
+ */
56
+ showConfirm(args: {
29
57
  title: string;
30
58
  content: string;
31
59
  okText: string;
32
60
  cancelText: string;
33
61
  }): any;
34
- redirect(url: string): any;
62
+ /**
63
+ * Navigate the platform to the given URL.
64
+ *
65
+ * @param url - The URL to navigate to.
66
+ *
67
+ * @example
68
+ * kf.client.redirect("https://example.com");
69
+ */
70
+ redirect(url: string): any;
71
+ /**
72
+ * Resolve a Kissflow image field value to a base64 data URL.
73
+ *
74
+ * Custom components (iframes) cannot load Kissflow-hosted images directly due to
75
+ * CORS restrictions and 302 redirects to signed S3 URLs. This method fetches the
76
+ * image in the parent window (which has the required session cookies) and returns
77
+ * a self-contained `data:image/...;base64,...` URL that can be used as `<img src>`
78
+ * without any CORS issues.
79
+ *
80
+ * @param imageValue - The image field value must contain a `key` property and
81
+ * optionally a `photos` array. Uses `photos[1]` (preview resolution) when available,
82
+ * falls back to `key`.
83
+ * @returns A promise that resolves with the base64 data URL string.
84
+ *
85
+ * @example
86
+ * const dataUrl = await kf.client.getImageUrl(imageFieldValue);
87
+ * document.querySelector("#avatar").src = dataUrl;
88
+ */
89
+ getImageUrl(imageValue: Record<string, unknown>): any;
35
90
  }
36
91
  declare class Formatter {
37
92
  toDate(date: string): any;
@@ -49,6 +104,45 @@ declare class kf {
49
104
  static eventParameters: any
50
105
  static api(url: string, args?: FetchOptions): Promise<any>;
51
106
  }
107
+ // ============================================
108
+ // Shared Base Types
109
+ // ============================================
110
+
111
+ declare type QueryResponse = {
112
+ items: any[];
113
+ total: number;
114
+ page?: number;
115
+ pageSize?: number;
116
+ };
117
+
118
+ declare type BaseQueryOptions = {
119
+ searchValue?: string;
120
+ pageNumber?: number;
121
+ pageSize?: number;
122
+ };
123
+
124
+ declare type PayloadSortItem = {
125
+ Id: string;
126
+ SortType: "ASC" | "DESC";
127
+ };
128
+
129
+ declare type PayloadOptions = {
130
+ Columns?: any[];
131
+ Filters?: any;
132
+ Sort?: PayloadSortItem[];
133
+ FilterParam?: any;
134
+ };
135
+
136
+ declare type ProcessPayloadOptions = {
137
+ Columns?: any[];
138
+ Filters?: any;
139
+ Sort?: PayloadSortItem[];
140
+ };
141
+
142
+ // ============================================
143
+ // Core Types
144
+ // ============================================
145
+
52
146
  declare type userObject = {
53
147
  _id: string;
54
148
  Name: string;
@@ -80,13 +174,189 @@ declare type DataformItem = {
80
174
  _id: string;
81
175
  };
82
176
 
177
+
83
178
  declare type ProcessItem = {
84
179
  _id: string;
85
180
  _activity_instance_id: string;
86
181
  };
87
182
 
183
+ // ============================================
184
+ // Process Types
185
+ // ============================================
186
+
187
+ declare type ProcessMyItemsOptions = BaseQueryOptions & {
188
+ status?: "draft" | "inprogress" | "completed" | "withdrawn" | "rejected" | "all";
189
+ payload?: ProcessPayloadOptions;
190
+ };
191
+
192
+ declare type ProcessMyTasksOptions = BaseQueryOptions & {
193
+ activityId?: string;
194
+ payload?: ProcessPayloadOptions;
195
+ };
196
+
197
+ declare type ProcessParticipatedOptions = BaseQueryOptions & {
198
+ activityId?: string;
199
+ payload?: ProcessPayloadOptions;
200
+ };
201
+
202
+ declare type ProcessAdminOptions = BaseQueryOptions & {
203
+ payload?: ProcessPayloadOptions;
204
+ };
205
+
206
+ declare type ProcessQueryResponse = QueryResponse;
207
+
208
+ declare type ProcessGetItemOptions = {
209
+ instanceId: string;
210
+ };
211
+
212
+ declare type ProcessCreateItemOptions = {
213
+ data?: object;
214
+ };
215
+
216
+ declare type ProcessUpdateItemOptions = {
217
+ instanceId: string;
218
+ activityInstanceId: string;
219
+ data: object;
220
+ };
221
+
222
+ declare type ProcessDeleteItemOptions = {
223
+ instanceId: string;
224
+ };
225
+
226
+ declare type ProcessSubmitItemOptions = {
227
+ instanceId: string;
228
+ activityInstanceId: string;
229
+ comment?: string;
230
+ };
231
+
232
+ declare type ProcessRejectItemOptions = {
233
+ instanceId: string;
234
+ activityInstanceId: string;
235
+ comment: string;
236
+ };
237
+
238
+ declare type ProcessWithdrawItemOptions = {
239
+ instanceId: string;
240
+ comment?: string;
241
+ };
242
+
243
+ declare type ProcessSendbackItemOptions = {
244
+ instanceId: string;
245
+ activityInstanceId: string;
246
+ stepId: string;
247
+ comment: string;
248
+ };
249
+
250
+ declare type ProcessReassignItemOptions = {
251
+ instanceId: string;
252
+ activityInstanceId: string;
253
+ reassignTo: object;
254
+ comment: string;
255
+ reassignType?: "initiator" | "approver" | "admin";
256
+ reassignedFrom?: object[];
257
+ };
258
+
259
+ declare type ProcessGetReassigneesOptions = {
260
+ instanceId: string;
261
+ activityInstanceId: string;
262
+ pageNumber?: number;
263
+ pageSize?: number;
264
+ query?: string;
265
+ };
266
+
267
+ declare type ProcessRestartItemOptions = {
268
+ instanceId: string;
269
+ activityInstanceId: string;
270
+ };
271
+
272
+ declare type ProcessDiscardItemOptions = {
273
+ instanceId: string;
274
+ };
275
+
88
276
  declare type FetchOptions = {
89
277
  method?: string;
90
278
  body?: string | object;
91
279
  headers?: object;
92
280
  };
281
+
282
+ // ============================================
283
+ // Dataform Types
284
+ // ============================================
285
+
286
+ declare type DataformQueryOptions = BaseQueryOptions & {
287
+ viewId?: string;
288
+ payload?: PayloadOptions;
289
+ };
290
+
291
+ declare type DataformQueryResponse = QueryResponse;
292
+
293
+ declare type DataformCreateItemOptions = {
294
+ data?: object;
295
+ viewId?: string;
296
+ };
297
+
298
+ declare type DataformUpdateItemOptions = {
299
+ itemId: string; // Required: the _id of the item to update
300
+ data: object; // Required: the updated field values
301
+ viewId?: string; // Optional: view ID for view-specific update
302
+ };
303
+
304
+ declare type DataformGetItemOptions = {
305
+ itemId: string;
306
+ viewId?: string;
307
+ };
308
+
309
+ declare type DataformDeleteItemOptions = {
310
+ itemId: string;
311
+ viewId?: string;
312
+ };
313
+
314
+ declare type DataformDiscardItemOptions = {
315
+ viewId?: string;
316
+ };
317
+
318
+ declare type DataformSubmitItemOptions = {
319
+ itemId: string;
320
+ data?: object;
321
+ viewId?: string;
322
+ };
323
+
324
+ // ============================================
325
+ // Board Types
326
+ // ============================================
327
+
328
+ declare type BoardGetItemsOptions = BaseQueryOptions & {
329
+ viewId?: string;
330
+ payload?: PayloadOptions;
331
+ };
332
+
333
+ declare type BoardQueryResponse = QueryResponse;
334
+
335
+ declare type BoardGetItemOptions = {
336
+ instanceId: string;
337
+ };
338
+
339
+ declare type BoardCreateItemOptions = {
340
+ data?: object;
341
+ };
342
+
343
+ declare type BoardUpdateItemOptions = {
344
+ instanceId: string; // Required: the _id of the item to update
345
+ data: object; // Required: the updated field values
346
+ };
347
+
348
+ declare type BoardDeleteItemOptions = {
349
+ instanceId: string; // Required: the _id of the item to delete
350
+ };
351
+
352
+ declare type BoardSubmitItemOptions = {
353
+ instanceId: string;
354
+ comment?: string;
355
+ };
356
+
357
+ declare type BoardDiscardItemOptions = {
358
+ instanceId: string;
359
+ };
360
+
361
+
362
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kissflow/lowcode-client-sdk",
3
- "version": "1.0.39",
3
+ "version": "1.0.41",
4
4
  "description": "JavaScript SDK for developing over the Kissflow lowcode platform",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [