@fnet/cli 0.39.2 → 0.39.3
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/dist/index.js +1 -1
- package/package.json +9 -10
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var e,t,i=require("@fnet/config"),s=require("redis"),r=require("@flownet/lib-is-redis-online"),n=require("express"),o=require("helmet"),l=require("cors"),c=require("path"),d=require("shelljs"),a=require("nanoid"),u=require("request-ip"),h=require("express-session"),p=require("keycloak-connect"),f=require("qs");function w(){if(t)return e;t=1;const i=s,n=r;return e=async()=>{if(!await n({host:process.env.REDIS_HOST,port:process.env.REDIS_PORT}))return;const e=i.createClient({socket:{host:process.env.REDIS_HOST,port:process.env.REDIS_PORT}});return await e.connect(),e}}var _,b,m,y,k={name:"@fnet/cli",version:"0.39.
|
|
2
|
+
"use strict";var e,t,i=require("@fnet/config"),s=require("redis"),r=require("@flownet/lib-is-redis-online"),n=require("express"),o=require("helmet"),l=require("cors"),c=require("path"),d=require("shelljs"),a=require("nanoid"),u=require("request-ip"),h=require("express-session"),p=require("keycloak-connect"),f=require("qs");function w(){if(t)return e;t=1;const i=s,n=r;return e=async()=>{if(!await n({host:process.env.REDIS_HOST,port:process.env.REDIS_PORT}))return;const e=i.createClient({socket:{host:process.env.REDIS_HOST,port:process.env.REDIS_PORT}});return await e.connect(),e}}var _,b,m,y,k={name:"@fnet/cli",version:"0.39.3",files:["dist"],scripts:{start:"node src/index.js",build:"rollup --config --bundleConfigAsCjs",deploy:"npm install && npm run build && npm publish --access public",watch:"rollup --config --watch --sourcemap --bundleConfigAsCjs --environment DEVELOPMENT"},repository:{type:"git",url:"git+https://gitlab.com/fnetai/cli.git"},license:"MIT",dependencies:{"@flownet/lib-atom-api-js":"^0.1.10","@flownet/lib-bpmn-from-flow":"^0.1.8","@flownet/lib-is-redis-online":"^0.1.13","@flownet/lib-list-npm-versions":"^0.1.31","@flownet/lib-parse-imports-js":"^0.3.1","@flownet/lib-parse-node-url":"^0.1.16","@flownet/lib-pick-npm-versions":"^0.1.12","@flownet/lib-render-templates-dir":"^0.1.12","@flownet/lib-to-docker":"^0.1.13","@flownet/lib-to-electron":"^0.2.1","@flownet/lib-to-gitlab":"^0.1.21","@flownet/lib-to-ios-app":"^0.2.6","@flownet/lib-to-macos-app":"^0.2.4","@flownet/lib-to-nextjs":"^0.1.12","@flownet/lib-to-webos":"^0.2.9","@fnet/cli-project-common":"^0.1.25","@fnet/cli-project-flow":"^0.1.9","@fnet/cli-project-node":"^0.1.12","@fnet/config":"^0.2.8","@fnet/dir-zipper":"^0.1.5","@fnet/expression":"^0.1.16","@fnet/files-to-gcs":"^0.3.6","@fnet/object-from-schema":"^0.1.2","@fnet/shell":"^0.1.13","@fnet/yaml":"^0.1.12","@fnet/yargs-options-from-schema":"^0.1.1","@node-red/util":"^4.0.2",axios:"^1.5.0",chalk:"^4.1.2",cors:"^2.8.5",express:"^4.18.2","express-session":"^1.17.3","form-data":"^4.0.0","get-value":"^3.0.1",helmet:"^7.1.0",isobject:"^4.0.0","js-yaml":"^4.1.0","keycloak-connect":"^25.0.5","lodash.clonedeep":"^4.5.0","lodash.merge":"^4.6.2","lodash.omit":"^4.5.0","lodash.pick":"^3.1.0",minimist:"^1.2.8",nanoid:"^3.3.6",nunjucks:"^3.2.4",prettier:"^3.0.3",qs:"^6.11.2",redis:"^4.6.10","request-ip":"^3.3.0",semver:"^7.5.4",serve:"^14.2.3","set-value":"^4.1.0",shelljs:"^0.8.5",typescript:"^5.2.2",yaml:"^2.3.2",yargs:"^17.7.2"},bin:{fnet:"dist/builder/wf-cli.js",flib:"dist/builder/lib-cli.js",fsrv:"dist/index.js",fnode:"dist/builder/lib-cli.js"},devDependencies:{"@rollup/plugin-commonjs":"^26.0.1","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.2.1","@rollup/plugin-replace":"^5.0.2","@rollup/plugin-terser":"^0.4.3",rollup:"^4.9.6"}};const g=process.cwd(),j=i;(async function(){await j({name:["server","redis"],dir:g,optional:!0});const e=await w()();if(!e)throw new Error("Redis is offline.");const t=k,i=n,s=o,r=l,v=function(){if(b)return _;b=1;const e=n,t=c,i=d,{nanoid:s}=a;return _=class{#e;constructor(e){this._keycloak=e.keycloak,this._router=this._initRouter(),this._redis_client=e.redisClient,this._expire_ttl=3600,this._expire_ttl_short=300,this.#e=e.wdir}_initRouter(){let t=e.Router();return t.post("/workflow/builder/create",this._buildHandler.bind(this)),t.post("/workflow/builder/status",this._statusHandler.bind(this)),t.post("/workflow/builder/network",this._networkHandler.bind(this)),t}join(e,t){t.use(e,this._router)}async _cache_set(e,t,i){await this._redis_client.SETEX(e,i||this._expire_ttl,JSON.stringify(t)).catch(console.error)}async _cache_get(e){const t=await this._redis_client.GET(e).catch(console.error);return JSON.parse(t)}_buildHandler(e,t){this._build({...e.body}).then((e=>{t.status(200).send(e)})).catch((e=>{t.status(500).send()}))}_networkHandler(e,t){this._network({...e.body}).then((e=>{t.status(200).send(e)})).catch((e=>{t.status(500).send()}))}_statusHandler(e,t){try{const i=e.body.id;if(!i)throw new Error("Build Id is not defined.");const s="BUILD:"+i;this._cache_get(s).then((e=>{t.send(e)})).catch((e=>{t.status(500).send()}))}catch(e){t.status(500).send()}}async _build(e){const r=e.id;if(!r)throw new Error("Workflow Id is not defined.");const n=s(24),o=`node ${t.resolve(__dirname,"builder/wf-cli.js")} build --id=${r} --buildId=${n} --mode=all`;return i.exec(o,{async:!0,cwd:this.#e}),{id:n}}async _network(e){const r=e.id;if(!r)throw new Error("Workflow Id is not defined.");const n=s(24),o=`node ${t.resolve(__dirname,"builder/wf-cli.js")} build --id=${r} --buildId=${n} --mode=bpmn`;i.exec(o,{cwd:this.#e});const l="BUILD:"+n;return await this._cache_get(l)}}}(),E=function(){if(y)return m;y=1;const e=n,t=c,i=d,{nanoid:s}=a;return m=class{#e;constructor(e){this._keycloak=e.keycloak,this._router=this._initRouter(),this._redis_client=e.redisClient,this._expire_ttl=3600,this._expire_ttl_short=300,this.#e=e.wdir}_initRouter(){let t=e.Router();return t.post("/library/builder/create",this._buildHandler.bind(this)),t.post("/library/builder/status",this._statusHandler.bind(this)),t}join(e,t){t.use(e,this._router)}async _cache_set(e,t,i){await this._redis_client.SETEX(e,i||this._expire_ttl,JSON.stringify(t)).catch(console.error)}async _cache_get(e){const t=await this._redis_client.GET(e).catch(console.error);return JSON.parse(t)}_buildHandler(e,t){this._build({...e.body}).then((e=>{t.status(200).send(e)})).catch((e=>{t.status(500).send()}))}_statusHandler(e,t){try{const i=e.body.id;if(!i)throw new Error("Build Id is not defined.");const s="BUILD:"+i;this._cache_get(s).then((e=>{t.send(e)})).catch((e=>{t.status(500).send()}))}catch(e){t.status(500).send()}}async _build(e){const r=e.id;if(!r)throw new Error("Library Id is not defined.");const n=s(24),o=`node ${t.resolve(__dirname,"builder/lib-cli.js")} build --id=${r} --buildId=${n} --mode=all}`;return i.exec(o,{async:!0,cwd:this.#e}),{id:n}}}}(),x=u,q=h,S=new(0,q.MemoryStore),I=new p({store:S}),R=i(),T=f;R.set("query parser",(function(e){return T.parse(e,{depth:12})})),R.use(q({secret:process.env.SESSION_SECRET,resave:!1,saveUninitialized:!0,store:S})),R.use(r()),R.use(s()),R.use(i.json({limit:"1024kb"})),R.get("/healthz",(function(e,t){t.sendStatus(200)})),R.use(x.mw()),R.use(I.middleware()),new v({keycloak:I,wdir:g,redisClient:e}).join("/v1",R),new E({keycloak:I,wdir:g,redisClient:e}).join("/v1",R),R.listen(process.env.HTTP_PORT||8080),console.log(`[${t.version}] ${t.name} started.`)})().catch((e=>{console.error(e.message),process.exit(1)})),module.exports={};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fnet/cli",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.3",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"@flownet/lib-to-docker": "^0.1.13",
|
|
28
28
|
"@flownet/lib-to-electron": "^0.2.1",
|
|
29
29
|
"@flownet/lib-to-gitlab": "^0.1.21",
|
|
30
|
-
"@flownet/lib-to-ios-app": "^0.2.
|
|
31
|
-
"@flownet/lib-to-macos-app": "^0.2.
|
|
30
|
+
"@flownet/lib-to-ios-app": "^0.2.6",
|
|
31
|
+
"@flownet/lib-to-macos-app": "^0.2.4",
|
|
32
32
|
"@flownet/lib-to-nextjs": "^0.1.12",
|
|
33
|
-
"@flownet/lib-to-webos": "^0.2.
|
|
33
|
+
"@flownet/lib-to-webos": "^0.2.9",
|
|
34
34
|
"@fnet/cli-project-common": "^0.1.25",
|
|
35
35
|
"@fnet/cli-project-flow": "^0.1.9",
|
|
36
36
|
"@fnet/cli-project-node": "^0.1.12",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@fnet/shell": "^0.1.13",
|
|
43
43
|
"@fnet/yaml": "^0.1.12",
|
|
44
44
|
"@fnet/yargs-options-from-schema": "^0.1.1",
|
|
45
|
-
"@node-red/util": "^
|
|
45
|
+
"@node-red/util": "^4.0.2",
|
|
46
46
|
"axios": "^1.5.0",
|
|
47
47
|
"chalk": "^4.1.2",
|
|
48
48
|
"cors": "^2.8.5",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
"express-session": "^1.17.3",
|
|
51
51
|
"form-data": "^4.0.0",
|
|
52
52
|
"get-value": "^3.0.1",
|
|
53
|
-
"helmet": "^
|
|
53
|
+
"helmet": "^7.1.0",
|
|
54
54
|
"isobject": "^4.0.0",
|
|
55
55
|
"js-yaml": "^4.1.0",
|
|
56
|
-
"keycloak-connect": "^
|
|
56
|
+
"keycloak-connect": "^25.0.5",
|
|
57
57
|
"lodash.clonedeep": "^4.5.0",
|
|
58
58
|
"lodash.merge": "^4.6.2",
|
|
59
59
|
"lodash.omit": "^4.5.0",
|
|
60
|
-
"lodash.pick": "^
|
|
60
|
+
"lodash.pick": "^3.1.0",
|
|
61
61
|
"minimist": "^1.2.8",
|
|
62
62
|
"nanoid": "^3.3.6",
|
|
63
63
|
"nunjucks": "^3.2.4",
|
|
@@ -66,11 +66,10 @@
|
|
|
66
66
|
"redis": "^4.6.10",
|
|
67
67
|
"request-ip": "^3.3.0",
|
|
68
68
|
"semver": "^7.5.4",
|
|
69
|
-
"serve": "^14.2.
|
|
69
|
+
"serve": "^14.2.3",
|
|
70
70
|
"set-value": "^4.1.0",
|
|
71
71
|
"shelljs": "^0.8.5",
|
|
72
72
|
"typescript": "^5.2.2",
|
|
73
|
-
"uuid": "^9.0.1",
|
|
74
73
|
"yaml": "^2.3.2",
|
|
75
74
|
"yargs": "^17.7.2"
|
|
76
75
|
},
|