@kissflow/lowcode-client-sdk 1.0.1 → 1.0.2-1.beta.1
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 +392 -95
- package/dist/index.d.ts +263 -76
- package/dist/kf.lowcodeworkersdk.es.js +665 -0
- package/dist/kf.nocodeworkersdk.es.js +455 -0
- package/dist/kfsdk.es.js +483 -0
- package/dist/kfsdk.umd.js +1 -0
- package/dist/lowcode.d.ts +319 -0
- package/dist/lowcode.types.d.ts +106 -0
- package/dist/nocode.d.ts +316 -0
- package/dist/nocode.types.d.ts +65 -0
- package/dist/snippets.json +193 -0
- package/dist/worker.js +40 -0
- package/package.json +44 -39
- package/custom.build.js +0 -79
- package/dist/app.js +0 -48
- package/dist/base.js +0 -171
- package/dist/client.js +0 -44
- package/dist/component.js +0 -35
- package/dist/constants.js +0 -40
- package/dist/form.js +0 -44
- package/dist/formatter.js +0 -54
- package/dist/global.types.d.ts +0 -54
- package/dist/index.html +0 -23
- package/dist/index.js +0 -7
- package/dist/kflowcode.sdk.js +0 -822
- package/dist/kflowcode.sdk.js.map +0 -1
- package/dist/kflowcode.sdk.module.js +0 -808
- package/dist/kflowcode.sdk.module.js.map +0 -1
- package/dist/lowcode.sdk.js +0 -56
- package/dist/page.js +0 -62
- package/id +0 -55
- package/index.html +0 -23
- package/src/app.ts +0 -31
- package/src/base.ts +0 -109
- package/src/client.ts +0 -28
- package/src/component.ts +0 -15
- package/src/constants.ts +0 -45
- package/src/form.ts +0 -21
- package/src/formatter.ts +0 -35
- package/src/index.ts +0 -7
- package/src/lowcode.sdk.ts +0 -41
- package/src/page.ts +0 -51
- package/test/lcnc-handler.js +0 -45
- package/test/mock/api.js +0 -16
- package/test/mock/id.js +0 -55
- package/tsconfig.json +0 -7
- package/tsconfig.types.json +0 -18
- package/webpack.config.js +0 -63
package/src/page.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { BaseSDK } from "./base";
|
|
2
|
-
import { LISTENER_CMDS, EVENT_TYPES } from "./constants";
|
|
3
|
-
|
|
4
|
-
export class Page extends BaseSDK {
|
|
5
|
-
_id: string;
|
|
6
|
-
constructor(pageId: string) {
|
|
7
|
-
super({});
|
|
8
|
-
this._id = pageId;
|
|
9
|
-
}
|
|
10
|
-
getParameter(key: string) {
|
|
11
|
-
return this._postMessageAsync(LISTENER_CMDS.GET_PAGE_PARAMS, {
|
|
12
|
-
key
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
getVariable(key: string) {
|
|
16
|
-
return this._postMessageAsync(LISTENER_CMDS.GET_PAGE_VARIABLE, {
|
|
17
|
-
key
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
setVariable(key: string, value: any) {
|
|
21
|
-
return this._postMessageAsync(LISTENER_CMDS.SET_PAGE_VARIABLE, {
|
|
22
|
-
key,
|
|
23
|
-
value
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
openPopup(
|
|
27
|
-
pageId: string,
|
|
28
|
-
inputParams: object,
|
|
29
|
-
popupProperties: { w: number; h: number }
|
|
30
|
-
) {
|
|
31
|
-
let payload = {
|
|
32
|
-
pageId,
|
|
33
|
-
inputParams,
|
|
34
|
-
popupProperties: {
|
|
35
|
-
width: popupProperties.w,
|
|
36
|
-
height: popupProperties.h
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
return this._postMessageAsync(
|
|
40
|
-
LISTENER_CMDS.OPEN_POPUP_PAGE,
|
|
41
|
-
payload,
|
|
42
|
-
true,
|
|
43
|
-
() => {
|
|
44
|
-
return new Page(pageId);
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
onClose(callback: Function) {
|
|
49
|
-
this._registerEventListener(this._id, EVENT_TYPES.ON_CLOSE, callback);
|
|
50
|
-
}
|
|
51
|
-
}
|
package/test/lcnc-handler.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
class LCNCHandler {
|
|
2
|
-
constructor(props) {
|
|
3
|
-
console.log("Initializing LCNC HANDLER", props);
|
|
4
|
-
this._onMessage = this._onMessage.bind(this);
|
|
5
|
-
window.addEventListener("message", this._onMessage, false);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
_onMessage(event) {
|
|
9
|
-
console.log("Parent receives messsage", event);
|
|
10
|
-
const data = event.data;
|
|
11
|
-
this.execute(event.data, event.source);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
execute(data, sourceWindow) {
|
|
15
|
-
switch (data.command) {
|
|
16
|
-
case "PARAMS":
|
|
17
|
-
this.sendBack(sourceWindow, data, {value: "message from parent"});
|
|
18
|
-
break;
|
|
19
|
-
case "API":
|
|
20
|
-
fetch(data.url, data.args).then(async (resp) => {
|
|
21
|
-
const json = await resp.json();
|
|
22
|
-
this.sendBack(sourceWindow, data, json);
|
|
23
|
-
});
|
|
24
|
-
break;
|
|
25
|
-
case "REDIRECT":
|
|
26
|
-
window.location.href = data.url;
|
|
27
|
-
break;
|
|
28
|
-
default:
|
|
29
|
-
console.log("Command not specified", data);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
sendBack(sourceWindow, req, res) {
|
|
34
|
-
if(req._id) {
|
|
35
|
-
sourceWindow.postMessage({_req :req, ...res}, "*")
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function initHandler(options = {}) {
|
|
42
|
-
return new LCNCHandler(options);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export default initHandler
|
package/test/mock/api.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import idJSON from './id.js';
|
|
2
|
-
|
|
3
|
-
const MockAPI = {
|
|
4
|
-
"/id": idJSON,
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
self.fetch = (url, config) => {
|
|
8
|
-
let json = MockAPI[url] || {"Id": "url doesn't match"}
|
|
9
|
-
const resp = new Response(JSON.stringify(json), { "status" : 200 })
|
|
10
|
-
return new Promise((resolve, reject) => {
|
|
11
|
-
resolve(resp);
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export default MockAPI
|
package/test/mock/id.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
"_id": "Account001",
|
|
3
|
-
"Name": "OS",
|
|
4
|
-
"UserDetails": {
|
|
5
|
-
"_id": "User001",
|
|
6
|
-
"Name": "Vivek",
|
|
7
|
-
"AppConfig": {
|
|
8
|
-
"Env": "AltairUSP001",
|
|
9
|
-
"ProfileBasePath": "https://s3.amazonaws.com/altair-sss-pro-p001",
|
|
10
|
-
"UploadHost": "https://attachment.kissflow.com"
|
|
11
|
-
},
|
|
12
|
-
"ProfilePicture": {
|
|
13
|
-
"large": {
|
|
14
|
-
"fileExtension": "jpeg",
|
|
15
|
-
"height": 150,
|
|
16
|
-
"key": "AcFlqmVfTZ1X/UsEEpZPxSsvJ/photos/150x150.jpeg",
|
|
17
|
-
"name": "150x150.jpeg",
|
|
18
|
-
"size": 7939,
|
|
19
|
-
"width": 150
|
|
20
|
-
},
|
|
21
|
-
"medium": {
|
|
22
|
-
"fileExtension": "jpeg",
|
|
23
|
-
"height": 130,
|
|
24
|
-
"key": "AcFlqmVfTZ1X/UsEEpZPxSsvJ/photos/130x130.jpeg",
|
|
25
|
-
"name": "130x130.jpeg",
|
|
26
|
-
"size": 6433,
|
|
27
|
-
"width": 130
|
|
28
|
-
},
|
|
29
|
-
"original": {
|
|
30
|
-
"fileExtension": "jpg",
|
|
31
|
-
"height": 2611,
|
|
32
|
-
"key": "AcFlqmVfTZ1X/UsEEpZPxSsvJ/Vivek-Engg.jpg",
|
|
33
|
-
"name": "Vivek-Engg.jpg",
|
|
34
|
-
"size": 1797398,
|
|
35
|
-
"width": 2611
|
|
36
|
-
},
|
|
37
|
-
"preview": {
|
|
38
|
-
"fileExtension": "jpeg",
|
|
39
|
-
"height": 600,
|
|
40
|
-
"key": "AcFlqmVfTZ1X/UsEEpZPxSsvJ/photos/600x600.jpeg",
|
|
41
|
-
"name": "600x600.jpeg",
|
|
42
|
-
"size": 86345,
|
|
43
|
-
"width": 600
|
|
44
|
-
},
|
|
45
|
-
"small": {
|
|
46
|
-
"fileExtension": "jpeg",
|
|
47
|
-
"height": 70,
|
|
48
|
-
"key": "AcFlqmVfTZ1X/UsEEpZPxSsvJ/photos/70x70.jpeg",
|
|
49
|
-
"name": "70x70.jpeg",
|
|
50
|
-
"size": 2691,
|
|
51
|
-
"width": 70
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
package/tsconfig.json
DELETED
package/tsconfig.types.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"include": [
|
|
3
|
-
"./src/"
|
|
4
|
-
],
|
|
5
|
-
"exclude": [
|
|
6
|
-
"./src/constants.ts",
|
|
7
|
-
"./src/index.ts",
|
|
8
|
-
"./src/base.ts"
|
|
9
|
-
],
|
|
10
|
-
"compilerOptions": {
|
|
11
|
-
"baseUrl": ".",
|
|
12
|
-
"target": "es6",
|
|
13
|
-
"module": "es2020",
|
|
14
|
-
"declaration": true,
|
|
15
|
-
"emitDeclarationOnly": true,
|
|
16
|
-
"outFile": "./dist/index.d.ts"
|
|
17
|
-
}
|
|
18
|
-
}
|
package/webpack.config.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
|
-
const webpack = require("webpack");
|
|
3
|
-
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
4
|
-
|
|
5
|
-
let config = {
|
|
6
|
-
devtool: "source-map",
|
|
7
|
-
mode: "development",
|
|
8
|
-
devServer: {
|
|
9
|
-
contentBase: path.join(__dirname, "dist"),
|
|
10
|
-
port: 3000,
|
|
11
|
-
open: true
|
|
12
|
-
},
|
|
13
|
-
resolve: {
|
|
14
|
-
extensions: [".ts", ".js"]
|
|
15
|
-
},
|
|
16
|
-
module: {
|
|
17
|
-
rules: [
|
|
18
|
-
{
|
|
19
|
-
test: /\.ts?/,
|
|
20
|
-
use: {
|
|
21
|
-
loader: "ts-loader",
|
|
22
|
-
options: {
|
|
23
|
-
transpileOnly: true
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
exclude: /node_modules/
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
},
|
|
30
|
-
plugins: [
|
|
31
|
-
new webpack.DefinePlugin({
|
|
32
|
-
_BUILD: true
|
|
33
|
-
}),
|
|
34
|
-
new HtmlWebpackPlugin({
|
|
35
|
-
template: "./index.html",
|
|
36
|
-
filename: "index.html",
|
|
37
|
-
inject: "body"
|
|
38
|
-
})
|
|
39
|
-
]
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
let moduleLib = Object.assign({}, config, {
|
|
43
|
-
experiments: {
|
|
44
|
-
outputModule: true
|
|
45
|
-
},
|
|
46
|
-
entry: "./src/lowcode.sdk.ts",
|
|
47
|
-
output: {
|
|
48
|
-
filename: "kflowcode.sdk.module.js",
|
|
49
|
-
path: path.resolve(__dirname, "dist"),
|
|
50
|
-
|
|
51
|
-
library: {
|
|
52
|
-
type: "module"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
let commonLib = Object.assign({}, config, {
|
|
57
|
-
entry: "./src/index.ts",
|
|
58
|
-
output: {
|
|
59
|
-
filename: "kflowcode.sdk.js",
|
|
60
|
-
path: path.resolve(__dirname, "dist")
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
module.exports = [moduleLib, commonLib];
|