@kissflow/lowcode-client-sdk 1.0.8 → 1.0.12-beta
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/README.md +114 -126
- package/dist/global.types.d.ts +100 -0
- package/dist/index.d.ts +290 -0
- package/dist/kfsdk.es.js +176 -127
- package/dist/kfsdk.umd.js +1 -1
- package/dist/kfworkersdk.es.js +198 -87
- package/dist/lowcode.d.ts +293 -0
- package/package.json +52 -53
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
declare module "core/constants" {
|
|
2
|
+
export const LISTENER_CMDS: {
|
|
3
|
+
API: string;
|
|
4
|
+
PARAMS: string;
|
|
5
|
+
GET_CONTEXT: string;
|
|
6
|
+
RETURN: string;
|
|
7
|
+
GET_FORM_FIELD: string;
|
|
8
|
+
UPDATE_FORM: string;
|
|
9
|
+
GET_TABLE: string;
|
|
10
|
+
GET_TABLE_ROW: string;
|
|
11
|
+
ADD_TABLE_ROW: string;
|
|
12
|
+
DELETE_TABLE_ROW: string;
|
|
13
|
+
TO_JSON: string;
|
|
14
|
+
GET_TABLE_ROWS: string;
|
|
15
|
+
MESSAGE: string;
|
|
16
|
+
CONFIRM: string;
|
|
17
|
+
ALERT: string;
|
|
18
|
+
REDIRECT: string;
|
|
19
|
+
OPEN_PAGE: string;
|
|
20
|
+
FORMAT_DATE: string;
|
|
21
|
+
FORMAT_DATE_TIME: string;
|
|
22
|
+
FORMAT_NUMBER: string;
|
|
23
|
+
FORMAT_CURRENCY: string;
|
|
24
|
+
FORMAT_BOOLEAN: string;
|
|
25
|
+
GET_APP_VARIABLE: string;
|
|
26
|
+
SET_APP_VARIABLE: string;
|
|
27
|
+
GET_PAGE_VARIABLE: string;
|
|
28
|
+
SET_PAGE_VARIABLE: string;
|
|
29
|
+
GET_PAGE_PARAMS: string;
|
|
30
|
+
GET_ALL_PAGE_PARAMS: string;
|
|
31
|
+
PAGE_ON_CLOSE: string;
|
|
32
|
+
OPEN_POPUP: string;
|
|
33
|
+
GET_POPUP_PARAMS: string;
|
|
34
|
+
GET_ALL_POPUP_PARAMS: string;
|
|
35
|
+
CLOSE_POPUP: string;
|
|
36
|
+
COMPONENT_GET: string;
|
|
37
|
+
COMPONENT_REFRESH: string;
|
|
38
|
+
COMPONENT_SHOW: string;
|
|
39
|
+
COMPONENT_HIDE: string;
|
|
40
|
+
COMPONENT_ADD_EVENT_LISTENER: string;
|
|
41
|
+
INITIALIZE_CUST_COMP: string;
|
|
42
|
+
WINDOW_NDEF_READER_NEW: string;
|
|
43
|
+
WINDOW_NDEF_READER_SCAN: string;
|
|
44
|
+
WINDOW_NDEF_READER_WRITE: string;
|
|
45
|
+
WINDOW_NDEF_READER_ADD_EVENT_LISTENER: string;
|
|
46
|
+
WINDOW_NDEF_READER_MAKE_READONLY: string;
|
|
47
|
+
WINDOW_NDEF_READER_ABORT_SCAN: string;
|
|
48
|
+
};
|
|
49
|
+
export const EVENT_TYPES: {
|
|
50
|
+
COMPONENT_ON_MOUNT: string;
|
|
51
|
+
};
|
|
52
|
+
export const DEFAULTS: {
|
|
53
|
+
POPUP_ID: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
declare module "core/index" {
|
|
57
|
+
export function generateId(prefix?: string): string;
|
|
58
|
+
export const globalInstances: {};
|
|
59
|
+
export class EventBase {
|
|
60
|
+
#private;
|
|
61
|
+
constructor();
|
|
62
|
+
_addEventListener(eventName: string, callBack: Function): void;
|
|
63
|
+
_removeEventListener(eventName: string, callBack?: any): void;
|
|
64
|
+
_dispatchEvent(eventName: string, eventParams: object): boolean;
|
|
65
|
+
_dispatchMessageEvents(req: any, resp: any): void;
|
|
66
|
+
}
|
|
67
|
+
export class BaseSDK extends EventBase {
|
|
68
|
+
_postMessageAsync(command: string, args: any, hasCallBack?: boolean, callBack?: (data: any) => {}): object | string | any;
|
|
69
|
+
_postMessage(command: string, args: any, callBack?: any): void;
|
|
70
|
+
}
|
|
71
|
+
export * from "core/constants";
|
|
72
|
+
}
|
|
73
|
+
declare module "form/index" {
|
|
74
|
+
import { BaseSDK } from "core/index";
|
|
75
|
+
export class Form extends BaseSDK {
|
|
76
|
+
private instanceId;
|
|
77
|
+
type: string;
|
|
78
|
+
constructor(instanceId: string);
|
|
79
|
+
toJSON(): any;
|
|
80
|
+
getField(fieldId: string): any;
|
|
81
|
+
updateField(args: object): any;
|
|
82
|
+
getTable(tableId: string): Table;
|
|
83
|
+
}
|
|
84
|
+
class Table extends BaseSDK {
|
|
85
|
+
private tableId;
|
|
86
|
+
private instanceId;
|
|
87
|
+
constructor(instanceId: string, tableId: string);
|
|
88
|
+
toJSON(): any;
|
|
89
|
+
getRows(): TableForm[];
|
|
90
|
+
getRow(rowId: string): TableForm;
|
|
91
|
+
addRow(rowObject: object): any;
|
|
92
|
+
deleteRow(rowId: string): any;
|
|
93
|
+
}
|
|
94
|
+
export class TableForm extends BaseSDK {
|
|
95
|
+
private instanceId;
|
|
96
|
+
private tableId;
|
|
97
|
+
private rowId;
|
|
98
|
+
type: string;
|
|
99
|
+
constructor(instanceId: string, tableId: string, rowId: string);
|
|
100
|
+
getParent(): Form;
|
|
101
|
+
toJSON(): any;
|
|
102
|
+
getField(fieldId: string): any;
|
|
103
|
+
updateField(args: object): any;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
declare module "utils/client" {
|
|
107
|
+
import { BaseSDK } from "core/index";
|
|
108
|
+
export class Client extends BaseSDK {
|
|
109
|
+
showInfo(message: string): any;
|
|
110
|
+
showConfirm(args: {
|
|
111
|
+
title: string;
|
|
112
|
+
content: string;
|
|
113
|
+
okText: string;
|
|
114
|
+
cancelText: string;
|
|
115
|
+
}): any;
|
|
116
|
+
redirect(url: string): any;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
declare module "utils/formatter" {
|
|
120
|
+
import { BaseSDK } from "core/index";
|
|
121
|
+
export class Formatter extends BaseSDK {
|
|
122
|
+
toDate(date: string): any;
|
|
123
|
+
toDateTime(date: string): any;
|
|
124
|
+
toNumber(value: string): any;
|
|
125
|
+
toCurrency(value: string, currencyCode: string): any;
|
|
126
|
+
toBoolean(value: string): any;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
declare module "utils/index" {
|
|
130
|
+
export * from "utils/client";
|
|
131
|
+
export * from "utils/formatter";
|
|
132
|
+
}
|
|
133
|
+
declare module "types/external" {
|
|
134
|
+
export type userObject = {
|
|
135
|
+
_id: string;
|
|
136
|
+
Name: string;
|
|
137
|
+
Email: string;
|
|
138
|
+
UserType: string;
|
|
139
|
+
Role: string;
|
|
140
|
+
};
|
|
141
|
+
export type accountObject = {
|
|
142
|
+
_id: string;
|
|
143
|
+
};
|
|
144
|
+
export type environmentObject = {
|
|
145
|
+
isMobile: boolean;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
declare module "types/internal" {
|
|
149
|
+
import { userObject, accountObject, environmentObject } from "types/external";
|
|
150
|
+
export interface SDKContext {
|
|
151
|
+
formInstanceId: string;
|
|
152
|
+
tableId: string;
|
|
153
|
+
tableRowId: string;
|
|
154
|
+
componentId: string;
|
|
155
|
+
componentMethods?: componentMethodsType[];
|
|
156
|
+
appId: string;
|
|
157
|
+
pageId: string;
|
|
158
|
+
popupId: string;
|
|
159
|
+
user: userObject;
|
|
160
|
+
account: accountObject;
|
|
161
|
+
csrfToken: string;
|
|
162
|
+
envDetails: environmentObject;
|
|
163
|
+
}
|
|
164
|
+
export interface componentMethodsType {
|
|
165
|
+
name: string;
|
|
166
|
+
returnType?: string;
|
|
167
|
+
parameters?: string[];
|
|
168
|
+
}
|
|
169
|
+
export interface ComponentProps {
|
|
170
|
+
componentId: string;
|
|
171
|
+
componentMethods?: componentMethodsType[];
|
|
172
|
+
}
|
|
173
|
+
export interface AppContext {
|
|
174
|
+
appId: string;
|
|
175
|
+
pageId: string;
|
|
176
|
+
}
|
|
177
|
+
export interface PageContext {
|
|
178
|
+
pageId: string;
|
|
179
|
+
}
|
|
180
|
+
export interface PopupContext {
|
|
181
|
+
popupId?: string;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
declare module "app/component" {
|
|
185
|
+
import { BaseSDK } from "core/index";
|
|
186
|
+
import { ComponentProps } from "types/internal";
|
|
187
|
+
export class Component extends BaseSDK {
|
|
188
|
+
#private;
|
|
189
|
+
_id: string;
|
|
190
|
+
type: string;
|
|
191
|
+
constructor(props: ComponentProps);
|
|
192
|
+
onMount(callback: Function): void;
|
|
193
|
+
refresh(): any;
|
|
194
|
+
show(): any;
|
|
195
|
+
hide(): any;
|
|
196
|
+
}
|
|
197
|
+
export class CustomComponent extends BaseSDK {
|
|
198
|
+
type: string;
|
|
199
|
+
constructor();
|
|
200
|
+
watchParams(func: (data: any) => any): void;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
declare module "app/popup" {
|
|
204
|
+
import { BaseSDK } from "core/index";
|
|
205
|
+
import { Component } from "app/component";
|
|
206
|
+
import { PopupContext } from "types/internal";
|
|
207
|
+
export class Popup extends BaseSDK {
|
|
208
|
+
_id: string;
|
|
209
|
+
type: string;
|
|
210
|
+
constructor(props: PopupContext);
|
|
211
|
+
getParameter(key: string): any;
|
|
212
|
+
getAllParameters(): any;
|
|
213
|
+
close(): any;
|
|
214
|
+
getComponent(componentId: string): Component;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
declare module "app/page" {
|
|
218
|
+
import { BaseSDK } from "core/index";
|
|
219
|
+
import { Component } from "app/component";
|
|
220
|
+
import { Popup } from "app/popup";
|
|
221
|
+
import { PageContext } from "types/internal";
|
|
222
|
+
export class Page extends BaseSDK {
|
|
223
|
+
_id: string;
|
|
224
|
+
popup: Popup;
|
|
225
|
+
type: string;
|
|
226
|
+
constructor(props: PageContext);
|
|
227
|
+
getParameter(key: string): any;
|
|
228
|
+
getAllParameters(): any;
|
|
229
|
+
getVariable(key: string): any;
|
|
230
|
+
setVariable(key: string, value: any): any;
|
|
231
|
+
openPopup(popupId: string, popupParams: object): any;
|
|
232
|
+
getComponent(componentId: string): Component;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
declare module "app/index" {
|
|
236
|
+
import { BaseSDK } from "core/index";
|
|
237
|
+
import { Page } from "app/page";
|
|
238
|
+
import { AppContext } from "types/internal";
|
|
239
|
+
export class Application extends BaseSDK {
|
|
240
|
+
page: Page;
|
|
241
|
+
_id: string;
|
|
242
|
+
constructor(props: AppContext);
|
|
243
|
+
getVariable(key: string): any;
|
|
244
|
+
setVariable(key: string | object, value?: any): any;
|
|
245
|
+
openPage(pageId: string, pageParams: object): any;
|
|
246
|
+
}
|
|
247
|
+
export * from "app/component";
|
|
248
|
+
export { Page };
|
|
249
|
+
export * from "app/popup";
|
|
250
|
+
}
|
|
251
|
+
declare module "window/NDEFReader" {
|
|
252
|
+
import { BaseSDK } from "core/index";
|
|
253
|
+
export class NDEFReader extends BaseSDK {
|
|
254
|
+
id: string;
|
|
255
|
+
constructor();
|
|
256
|
+
scan(): Promise<unknown>;
|
|
257
|
+
write(data: any): Promise<unknown>;
|
|
258
|
+
addEventListener(eventName: string, cb: Function): void;
|
|
259
|
+
makeReadOnly(): Promise<unknown>;
|
|
260
|
+
abortScan(): Promise<unknown>;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
declare module "window/index" {
|
|
264
|
+
import { NDEFReader } from "window/NDEFReader";
|
|
265
|
+
export const window: {
|
|
266
|
+
NDEFReader: typeof NDEFReader;
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
declare module "lowcode" {
|
|
270
|
+
import { BaseSDK } from "core/index";
|
|
271
|
+
import { Form, TableForm } from "form/index";
|
|
272
|
+
import { Client, Formatter } from "utils/index";
|
|
273
|
+
import { Application, Page, Component, Popup } from "app/index";
|
|
274
|
+
import { window } from "window/index";
|
|
275
|
+
import { SDKContext } from "types/internal";
|
|
276
|
+
import { userObject, accountObject, environmentObject } from "types/external";
|
|
277
|
+
class LowcodeSDK extends BaseSDK {
|
|
278
|
+
#private;
|
|
279
|
+
context: Component | Form | TableForm | Page | Popup;
|
|
280
|
+
client: Client;
|
|
281
|
+
formatter: Formatter;
|
|
282
|
+
app: Application;
|
|
283
|
+
user: userObject;
|
|
284
|
+
env: environmentObject;
|
|
285
|
+
account: accountObject;
|
|
286
|
+
constructor(props: SDKContext);
|
|
287
|
+
api(url: string, args?: {
|
|
288
|
+
headers: object;
|
|
289
|
+
}): Promise<any>;
|
|
290
|
+
}
|
|
291
|
+
function initSDK(config: SDKContext): LowcodeSDK;
|
|
292
|
+
export { window, initSDK as default };
|
|
293
|
+
}
|
package/package.json
CHANGED
|
@@ -1,54 +1,53 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
2
|
+
"name": "@kissflow/lowcode-client-sdk",
|
|
3
|
+
"version": "1.0.12-beta",
|
|
4
|
+
"description": "JavaScript SDK for developing over the Kissflow lowcode platform",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist/"
|
|
8
|
+
],
|
|
9
|
+
"main": "./dist/kfsdk.umd.js",
|
|
10
|
+
"module": "./dist/kfsdk.es.js",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/kfsdk.es.js",
|
|
14
|
+
"require": "./dist/kfsdk.umd.js"
|
|
15
|
+
},
|
|
16
|
+
"./lowcode": {
|
|
17
|
+
"import": "./dist/kfworkersdk.es.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/kissflow/lcnc-sdk-js.git"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [],
|
|
25
|
+
"author": "Vivek Madurai<vivek@kissflow.com>",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/kissflow/lcnc-sdk-js/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/kissflow/lcnc-sdk-js#readme",
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"html-webpack-plugin": "^5.3.1",
|
|
33
|
+
"http-server": "^0.12.3",
|
|
34
|
+
"ts-loader": "^9.2.5",
|
|
35
|
+
"typescript": "^4.3.5",
|
|
36
|
+
"vite": "^2.9.8",
|
|
37
|
+
"webpack": "^5.52.1",
|
|
38
|
+
"webpack-cli": "^4.8.0",
|
|
39
|
+
"webpack-dev-server": "^3.11.2"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@lingui/cli": "^3.13.3",
|
|
43
|
+
"@lingui/react": "^2",
|
|
44
|
+
"nanoid": "^3.1.30",
|
|
45
|
+
"ts-file-parser": "0.0.21"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"start": "vite serve",
|
|
49
|
+
"customBuild": "node custom.build.mjs",
|
|
50
|
+
"build": "pnpm run customBuild",
|
|
51
|
+
"serve": "http-server -p 8080"
|
|
52
|
+
}
|
|
53
|
+
}
|