@sme.up/kokos-sdk-node 0.0.3 → 0.0.6

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.
Files changed (82) hide show
  1. package/README.md +1 -1
  2. package/docs/assets/highlight.css +0 -56
  3. package/docs/assets/main.js +4 -3
  4. package/docs/assets/navigation.js +1 -0
  5. package/docs/assets/search.js +1 -1
  6. package/docs/assets/style.css +95 -39
  7. package/docs/classes/ErrorWithStatus.html +13 -0
  8. package/docs/classes/ExecuteFunPayload.html +5 -108
  9. package/docs/classes/ExecutionContext.html +4 -101
  10. package/docs/classes/Fun.html +14 -171
  11. package/docs/classes/FunObject.html +6 -115
  12. package/docs/classes/SmeupDataStructureWriter.html +22 -0
  13. package/docs/classes/User.html +7 -122
  14. package/docs/enums/Format.html +3 -0
  15. package/docs/enums/Level.html +4 -0
  16. package/docs/enums/SmeupDataStructureType.html +8 -95
  17. package/docs/functions/clearLoggerContext.html +1 -0
  18. package/docs/functions/configureLogger.html +1 -0
  19. package/docs/functions/createLoggerContext.html +1 -0
  20. package/docs/functions/getSmeupDataStructureType.html +1 -0
  21. package/docs/functions/parseKeyValueBetweenBrackets.html +2 -0
  22. package/docs/functions/startServer.html +1 -0
  23. package/docs/functions/startServerWithCustomConfig.html +1 -0
  24. package/docs/index.html +3 -92
  25. package/docs/interfaces/DebugInfo.html +4 -0
  26. package/docs/interfaces/KokosService.html +3 -88
  27. package/docs/interfaces/KokosServiceMethods.html +2 -83
  28. package/docs/interfaces/KokosServiceModule.html +3 -88
  29. package/docs/interfaces/LoggerContext.html +5 -0
  30. package/docs/interfaces/MicroExecutorConfiguration.html +4 -0
  31. package/docs/interfaces/SmeupCell.html +7 -106
  32. package/docs/interfaces/SmeupColumn.html +26 -204
  33. package/docs/interfaces/SmeupDataStructure.html +5 -91
  34. package/docs/interfaces/SmeupFeedback.html +5 -0
  35. package/docs/interfaces/SmeupMessage.html +5 -102
  36. package/docs/interfaces/SmeupObject.html +18 -153
  37. package/docs/interfaces/SmeupRow.html +3 -93
  38. package/docs/interfaces/SmeupTable.html +7 -105
  39. package/docs/interfaces/SmeupTree.html +8 -112
  40. package/docs/interfaces/SmeupTreeNode.html +6 -109
  41. package/docs/modules.html +37 -93
  42. package/docs/variables/LOGGER.html +1 -0
  43. package/docs/variables/SMEUP_MESSAGE_GRAVITY.html +2 -72
  44. package/docs/variables/SMEUP_MESSAGE_MODE.html +2 -0
  45. package/lib/caller/serviceCaller.d.ts +3 -2
  46. package/lib/caller/serviceCaller.js +50 -21
  47. package/lib/configuration/configuration.d.ts +8 -0
  48. package/lib/configuration/configuration.js +29 -0
  49. package/lib/entrypoint/restapi/index.js +2 -110
  50. package/lib/entrypoint/restapi/restapi.d.ts +3 -0
  51. package/lib/entrypoint/restapi/restapi.js +149 -0
  52. package/lib/index.d.ts +8 -3
  53. package/lib/index.js +8 -3
  54. package/lib/logger/logger.d.ts +26 -0
  55. package/lib/logger/logger.js +87 -0
  56. package/lib/services/JS_00_01.js +42 -75
  57. package/lib/types/data-structures/smeupDataStructure.d.ts +27 -2
  58. package/lib/types/data-structures/smeupDataStructure.js +22 -1
  59. package/lib/types/data-structures/smeupObject.d.ts +2 -2
  60. package/lib/types/data-structures/smeupTree.d.ts +1 -1
  61. package/lib/types/general.d.ts +19 -2
  62. package/lib/types/general.js +7 -0
  63. package/lib/utils/fun.d.ts +3 -0
  64. package/lib/utils/fun.js +6 -0
  65. package/lib/utils/path.js +1 -1
  66. package/lib/utils/regex.d.ts +9 -0
  67. package/lib/utils/regex.js +53 -0
  68. package/lib/utils/smeupDataStructureWriter.d.ts +29 -0
  69. package/lib/utils/smeupDataStructureWriter.js +158 -0
  70. package/package.json +13 -14
  71. package/tsconfig.json +1 -0
  72. package/bin/kokos.js +0 -26
  73. package/docker/restapi/Dockerfile +0 -14
  74. package/docs/types/SmeupMessageGravity.html +0 -61
  75. package/init/JS_00_01.txt +0 -88
  76. package/lib/types/exceptions/execution.d.ts +0 -7
  77. package/lib/types/exceptions/execution.js +0 -10
  78. package/scripts/build.js +0 -26
  79. package/scripts/init.js +0 -95
  80. package/scripts/restapi/build-image-restapi.js +0 -60
  81. package/scripts/restapi/dev.js +0 -30
  82. package/scripts/restapi/start.js +0 -14
@@ -0,0 +1,29 @@
1
+ /// <reference types="node" />
2
+ import stream from "stream";
3
+ import { SmeupMessage } from "../types/data-structures/smeupDataStructure.js";
4
+ import { SmeupColumn, SmeupRow } from "../types/data-structures/smeupTable.js";
5
+ import { SmeupTreeNode } from "../types/data-structures/smeupTree.js";
6
+ import { Fun } from "../types/general.js";
7
+ export declare class SmeupDataStructureWriter {
8
+ private out;
9
+ private initalTimestamp;
10
+ private messages;
11
+ private columns;
12
+ private firstElement;
13
+ private lastElementWritten;
14
+ private isInitializationWritten;
15
+ private isFinalizationWritten;
16
+ private isColumnWritten;
17
+ private isRowWritten;
18
+ private isNodeWritten;
19
+ constructor(out: stream.Writable);
20
+ writeDataStructureInitialization(fun: Fun): void;
21
+ writeDataStructureFinalization(fun: Fun): void;
22
+ writeTreeNode(node: SmeupTreeNode): void;
23
+ writeColumns(columns: SmeupColumn[]): void;
24
+ writeColumn(col: SmeupColumn): void;
25
+ writeRow(row: SmeupRow): void;
26
+ writeMessage(message: SmeupMessage): void;
27
+ getColumns(): SmeupColumn[];
28
+ getMessages(): SmeupMessage[];
29
+ }
@@ -0,0 +1,158 @@
1
+ import { SmeupDataStructureType, getSmeupDataStructureType, } from "../types/data-structures/smeupDataStructure.js";
2
+ var DATA_TYPE;
3
+ (function (DATA_TYPE) {
4
+ DATA_TYPE["COLUMN"] = "COLUMN";
5
+ DATA_TYPE["ROW"] = "ROW";
6
+ DATA_TYPE["NODE"] = "NODE";
7
+ })(DATA_TYPE || (DATA_TYPE = {}));
8
+ export class SmeupDataStructureWriter {
9
+ out;
10
+ initalTimestamp;
11
+ messages = [];
12
+ columns = [];
13
+ firstElement = true;
14
+ lastElementWritten;
15
+ isInitializationWritten = false;
16
+ isFinalizationWritten = false;
17
+ isColumnWritten = false;
18
+ isRowWritten = false;
19
+ isNodeWritten = false;
20
+ constructor(out) {
21
+ this.initalTimestamp = new Date();
22
+ this.out = out;
23
+ }
24
+ writeDataStructureInitialization(fun) {
25
+ if (!this.isInitializationWritten) {
26
+ this.initalTimestamp = new Date();
27
+ const type = getSmeupDataStructureType(fun);
28
+ this.out.write(utf8Encode("{"));
29
+ this.out.write(utf8Encode(`"type": "${type}"`));
30
+ this.isInitializationWritten = true;
31
+ }
32
+ }
33
+ writeDataStructureFinalization(fun) {
34
+ if (!this.isFinalizationWritten) {
35
+ const type = getSmeupDataStructureType(fun);
36
+ switch (type) {
37
+ case SmeupDataStructureType.SmeupTree:
38
+ if (this.lastElementWritten != null) {
39
+ // close rows, columns or messages
40
+ this.out.write(utf8Encode("]"));
41
+ }
42
+ if (!this.isNodeWritten) {
43
+ this.out.write(utf8Encode(`,"children":[]`));
44
+ }
45
+ break;
46
+ case SmeupDataStructureType.SmeupTable:
47
+ // close rows or messages
48
+ if (this.lastElementWritten != null) {
49
+ // close rows, columns
50
+ this.out.write(utf8Encode("]"));
51
+ }
52
+ if (!this.isColumnWritten) {
53
+ this.out.write(utf8Encode(`,"columns":[]`));
54
+ }
55
+ if (!this.isRowWritten) {
56
+ this.out.write(utf8Encode(`,"rows":[]`));
57
+ }
58
+ break;
59
+ }
60
+ // messages
61
+ this.out.write(utf8Encode(`,"messages":${JSON.stringify(this.getMessages())}`));
62
+ // debug info
63
+ const finalTimestamp = new Date();
64
+ const debugInfo = {
65
+ initialTimestamp: this.initalTimestamp.toISOString(),
66
+ finalTimestamp: finalTimestamp.toISOString(),
67
+ executionTime_ms: finalTimestamp.getTime() - this.initalTimestamp.getTime(),
68
+ };
69
+ this.out.write(utf8Encode(`,"debugInfo":${JSON.stringify(debugInfo)}`));
70
+ this.out.write(utf8Encode("}"));
71
+ this.out.end();
72
+ this.isFinalizationWritten = true;
73
+ }
74
+ }
75
+ writeTreeNode(node) {
76
+ if (this.lastElementWritten != null) {
77
+ if (this.lastElementWritten != DATA_TYPE.NODE) {
78
+ // close columns/messages/actions... array
79
+ this.out.write(utf8Encode("]"));
80
+ // children init
81
+ this.out.write(utf8Encode(`,"children": [`));
82
+ this.firstElement = true;
83
+ }
84
+ }
85
+ else {
86
+ // children init
87
+ this.out.write(utf8Encode(`,"children": [`));
88
+ this.firstElement = true;
89
+ }
90
+ // handle comma
91
+ if (!this.firstElement) {
92
+ this.out.write(utf8Encode(","));
93
+ }
94
+ this.out.write(utf8Encode(JSON.stringify(node)));
95
+ this.firstElement = false;
96
+ this.lastElementWritten = DATA_TYPE.NODE;
97
+ this.isNodeWritten = true;
98
+ }
99
+ writeColumns(columns) {
100
+ columns.forEach((col) => {
101
+ this.writeColumn(col);
102
+ });
103
+ }
104
+ writeColumn(col) {
105
+ if (this.lastElementWritten == null) {
106
+ // column init
107
+ this.out.write(utf8Encode(',"columns": ['));
108
+ this.firstElement = true;
109
+ }
110
+ // handle comma
111
+ if (!this.firstElement) {
112
+ this.out.write(utf8Encode(","));
113
+ }
114
+ this.out.write(utf8Encode(JSON.stringify(col)));
115
+ this.firstElement = false;
116
+ this.lastElementWritten = DATA_TYPE.COLUMN;
117
+ this.isColumnWritten = true;
118
+ // add to arraylist
119
+ this.columns.push(col);
120
+ }
121
+ writeRow(row) {
122
+ if (this.lastElementWritten != null) {
123
+ if (this.lastElementWritten != DATA_TYPE.ROW) {
124
+ // close columns/messages/actions... array
125
+ this.out.write(utf8Encode("]"));
126
+ // rows init
127
+ this.out.write(utf8Encode(`,"rows": [`));
128
+ this.firstElement = true;
129
+ }
130
+ }
131
+ else {
132
+ // rows init
133
+ this.out.write(utf8Encode(`,"rows": [`));
134
+ this.firstElement = true;
135
+ }
136
+ // handle comma
137
+ if (!this.firstElement) {
138
+ this.out.write(utf8Encode(","));
139
+ }
140
+ // write row
141
+ this.out.write(utf8Encode(JSON.stringify(row)));
142
+ this.firstElement = false;
143
+ this.lastElementWritten = DATA_TYPE.ROW;
144
+ this.isRowWritten = true;
145
+ }
146
+ writeMessage(message) {
147
+ this.messages.push(message);
148
+ }
149
+ getColumns() {
150
+ return this.columns;
151
+ }
152
+ getMessages() {
153
+ return this.messages;
154
+ }
155
+ }
156
+ function utf8Encode(s) {
157
+ return Buffer.from(s, "utf-8");
158
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sme.up/kokos-sdk-node",
3
- "version": "0.0.3",
3
+ "version": "0.0.6",
4
4
  "description": "Kokos SDK Node.js",
5
5
  "author": "Smeup LAB <info@smeup.com> (https://www.smeup.com/)",
6
6
  "type": "module",
@@ -9,24 +9,21 @@
9
9
  "typings": "./lib/index.d.ts",
10
10
  "files": [
11
11
  "lib/",
12
- "scripts/",
13
- "bin/",
14
- "docker/",
15
- "init/",
16
12
  "swagger/",
17
13
  "docs/",
18
14
  "package.json",
19
15
  "tsconfig.json"
20
16
  ],
21
- "bin": {
22
- "kokos": "./bin/kokos.js"
23
- },
24
17
  "scripts": {
25
- "clean": "rimraf lib",
18
+ "clean": "rimraf lib && rimraf docs",
26
19
  "test": "NODE_ENV=test jest",
27
- "build": "npm run clean && tsc",
28
- "start:restapi": "NODE_ENV=production node ./lib/entrypoint/restapi/index.js",
29
- "dev:restapi": "NODE_ENV=development nodemon --watch './**/*.ts' --exec node --experimental-specifier-resolution=node --loader ts-node/esm ./src/entrypoint/restapi/index.ts"
20
+ "build": "npm run clean && tsc && npm run docs",
21
+ "start": "NODE_ENV=production node ./lib/entrypoint/restapi/index.js",
22
+ "dev": "NODE_ENV=development nodemon --watch './**/*.ts' --exec node --experimental-specifier-resolution=node --loader ts-node/esm ./src/entrypoint/restapi/index.ts",
23
+ "docs": "npx typedoc --out docs src/",
24
+ "test:win": "SET NODE_ENV=test&&jest",
25
+ "start:win": "SET NODE_ENV=production&&node ./lib/entrypoint/restapi/index.js",
26
+ "dev:win": "SET NODE_ENV=development&&nodemon --watch './**/*.ts' --exec node --experimental-specifier-resolution=node --loader ts-node/esm ./src/entrypoint/restapi/index.ts"
30
27
  },
31
28
  "repository": {
32
29
  "type": "git",
@@ -38,11 +35,11 @@
38
35
  },
39
36
  "homepage": "https://github.com/smeup/kokos-sdk-node#readme",
40
37
  "dependencies": {
41
- "@types/node": "^18.15.11",
42
38
  "class-transformer": "^0.5.1",
43
39
  "class-validator": "^0.14.0",
44
40
  "express": "^4.18.2",
45
- "nodemon": "^2.0.22",
41
+ "js-yaml": "^4.1.0",
42
+ "nodemon": "^3.0.1",
46
43
  "rimraf": "^4.4.1",
47
44
  "ts-node": "^10.9.1",
48
45
  "typescript": "^4.9.4"
@@ -50,6 +47,8 @@
50
47
  "devDependencies": {
51
48
  "@types/express": "^4.17.17",
52
49
  "@types/jest": "^29.5.0",
50
+ "@types/js-yaml": "^4.0.9",
51
+ "@types/node": "^20.10.3",
53
52
  "axios": "^1.3.4",
54
53
  "jest": "^29.5.0",
55
54
  "ts-jest": "^29.0.5"
package/tsconfig.json CHANGED
@@ -7,6 +7,7 @@
7
7
  "rootDir": "./src",
8
8
  "moduleResolution": "node",
9
9
  "alwaysStrict": true,
10
+ "strict": true,
10
11
  "noImplicitAny": true,
11
12
  "experimentalDecorators": true,
12
13
  "emitDecoratorMetadata": true,
package/bin/kokos.js DELETED
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // get argument
4
- const action = process.argv[2];
5
-
6
- switch (action) {
7
- // generic actions
8
- case "init":
9
- import("../scripts/init.js");
10
- break;
11
- case "build":
12
- import("../scripts/build.js");
13
- break;
14
- // rest api actions
15
- case "dev:restapi":
16
- import("../scripts/restapi/dev.js");
17
- break;
18
- case "start:restapi":
19
- import("../scripts/restapi/start.js");
20
- break;
21
- case "build-image:restapi":
22
- import("../scripts/restapi/build-image-restapi.js");
23
- break;
24
- default:
25
- console.error("Operation not permitted");
26
- }
@@ -1,14 +0,0 @@
1
- FROM node:18-slim AS builder
2
- WORKDIR /app
3
- COPY package*.json ./
4
- RUN npm install
5
- COPY . .
6
- RUN npm run build
7
-
8
- FROM node:18-slim AS server
9
- WORKDIR /app
10
- COPY package* ./
11
- RUN npm install
12
- COPY --from=builder ./app/lib ./lib
13
- EXPOSE 3000
14
- CMD ["npm", "run", "start:restapi"]
@@ -1,61 +0,0 @@
1
- <!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>SmeupMessageGravity | @sme.up/kokos-template-node</title><meta name="description" content="Documentation for @sme.up/kokos-template-node"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/search.js" id="tsd-search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
2
- <div class="tsd-toolbar-contents container">
3
- <div class="table-cell" id="tsd-search" data-base="..">
4
- <div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div>
5
- <div class="field">
6
- <div id="tsd-toolbar-links"></div></div>
7
- <ul class="results">
8
- <li class="state loading">Preparing search index...</li>
9
- <li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@sme.up/kokos-template-node</a></div>
10
- <div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></svg></a></div></div></header>
11
- <div class="container container-main">
12
- <div class="col-content">
13
- <div class="tsd-page-title">
14
- <ul class="tsd-breadcrumb">
15
- <li><a href="../modules.html">@sme.up/kokos-template-node</a></li>
16
- <li><a href="SmeupMessageGravity.html">SmeupMessageGravity</a></li></ul>
17
- <h1>Type alias SmeupMessageGravity</h1></div>
18
- <div class="tsd-signature"><span class="tsd-kind-type-alias">Smeup<wbr/>Message<wbr/>Gravity</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">typeof </span><a href="../variables/SMEUP_MESSAGE_GRAVITY.html" class="tsd-signature-type tsd-kind-variable">SMEUP_MESSAGE_GRAVITY</a><span class="tsd-signature-symbol">[</span><span class="tsd-signature-symbol">keyof </span><span class="tsd-signature-symbol">typeof </span><a href="../variables/SMEUP_MESSAGE_GRAVITY.html" class="tsd-signature-type tsd-kind-variable">SMEUP_MESSAGE_GRAVITY</a><span class="tsd-signature-symbol">]</span></div><aside class="tsd-sources">
19
- <ul>
20
- <li>Defined in <a href="https://github.com/smeup/kokos/blob/f33e4d31/templates/node/src/types/data-structures/smeupDataStructure.ts#L35">types/data-structures/smeupDataStructure.ts:35</a></li></ul></aside></div>
21
- <div class="col-sidebar">
22
- <div class="page-menu">
23
- <div class="tsd-navigation settings">
24
- <details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
25
- <h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg>Settings</h3></summary>
26
- <div class="tsd-accordion-details">
27
- <div class="tsd-filter-visibility">
28
- <h4 class="uppercase">Member Visibility</h4><form>
29
- <ul id="tsd-filter-options">
30
- <li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li>
31
- <li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li>
32
- <li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li>
33
- <li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div>
34
- <div class="tsd-theme-toggle">
35
- <h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div>
36
- <div class="site-menu">
37
- <nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-namespace)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-4-path"></rect><path d="M9.33 16V7.24H10.77L13.446 14.74C13.43 14.54 13.41 14.296 13.386 14.008C13.37 13.712 13.354 13.404 13.338 13.084C13.33 12.756 13.326 12.448 13.326 12.16V7.24H14.37V16H12.93L10.266 8.5C10.282 8.692 10.298 8.936 10.314 9.232C10.33 9.52 10.342 9.828 10.35 10.156C10.366 10.476 10.374 10.784 10.374 11.08V16H9.33Z" fill="var(--color-text)" id="icon-4-text"></path></svg><span>@sme.up/kokos-<wbr/>template-<wbr/>node</span></a>
38
- <ul class="tsd-small-nested-navigation">
39
- <li><a href="../enums/SmeupDataStructureType.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-enum)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-8-path"></rect><path d="M9.45 16V7.24H14.49V8.224H10.518V10.936H14.07V11.908H10.518V15.016H14.49V16H9.45Z" fill="var(--color-text)" id="icon-8-text"></path></svg><span>Smeup<wbr/>Data<wbr/>Structure<wbr/>Type</span></a></li>
40
- <li><a href="../classes/ExecuteFunPayload.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-128-path"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)" id="icon-128-text"></path></svg><span>Execute<wbr/>Fun<wbr/>Payload</span></a></li>
41
- <li><a href="../classes/ExecutionContext.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg><span>Execution<wbr/>Context</span></a></li>
42
- <li><a href="../classes/Fun.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg><span>Fun</span></a></li>
43
- <li><a href="../classes/FunObject.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg><span>Fun<wbr/>Object</span></a></li>
44
- <li><a href="../classes/User.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg><span>User</span></a></li>
45
- <li><a href="../interfaces/KokosService.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-256-path"></rect><path d="M9.51 16V15.016H11.298V8.224H9.51V7.24H14.19V8.224H12.402V15.016H14.19V16H9.51Z" fill="var(--color-text)" id="icon-256-text"></path></svg><span>Kokos<wbr/>Service</span></a></li>
46
- <li><a href="../interfaces/KokosServiceMethods.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Kokos<wbr/>Service<wbr/>Methods</span></a></li>
47
- <li><a href="../interfaces/KokosServiceModule.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Kokos<wbr/>Service<wbr/>Module</span></a></li>
48
- <li><a href="../interfaces/SmeupCell.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Smeup<wbr/>Cell</span></a></li>
49
- <li><a href="../interfaces/SmeupColumn.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Smeup<wbr/>Column</span></a></li>
50
- <li><a href="../interfaces/SmeupDataStructure.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Smeup<wbr/>Data<wbr/>Structure</span></a></li>
51
- <li><a href="../interfaces/SmeupMessage.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Smeup<wbr/>Message</span></a></li>
52
- <li><a href="../interfaces/SmeupObject.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Smeup<wbr/>Object</span></a></li>
53
- <li><a href="../interfaces/SmeupRow.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Smeup<wbr/>Row</span></a></li>
54
- <li><a href="../interfaces/SmeupTable.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Smeup<wbr/>Table</span></a></li>
55
- <li><a href="../interfaces/SmeupTree.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Smeup<wbr/>Tree</span></a></li>
56
- <li><a href="../interfaces/SmeupTreeNode.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Smeup<wbr/>Tree<wbr/>Node</span></a></li>
57
- <li><a href="SmeupMessageGravity.html" class="current"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-4194304-path"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)" id="icon-4194304-text"></path></svg><span>Smeup<wbr/>Message<wbr/>Gravity</span></a></li>
58
- <li><a href="../variables/SMEUP_MESSAGE_GRAVITY.html"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-variable)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-32-path"></rect><path d="M11.106 16L8.85 7.24H9.966L11.454 13.192C11.558 13.608 11.646 13.996 11.718 14.356C11.79 14.708 11.842 14.976 11.874 15.16C11.906 14.976 11.954 14.708 12.018 14.356C12.09 13.996 12.178 13.608 12.282 13.192L13.758 7.24H14.85L12.582 16H11.106Z" fill="var(--color-text)" id="icon-32-text"></path></svg><span>SMEUP_<wbr/>MESSAGE_<wbr/>GRAVITY</span></a></li></ul></nav></div></div></div>
59
- <div class="tsd-generator">
60
- <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div>
61
- <div class="overlay"></div></body></html>
package/init/JS_00_01.txt DELETED
@@ -1,88 +0,0 @@
1
- import {
2
- ExecutionContext,
3
- Fun,
4
- KokosService,
5
- SmeupTree,
6
- SmeupTable,
7
- SmeupDataStructureType,
8
- } from "@sme.up/kokos-sdk-node";
9
-
10
- const JS_00_01: KokosService = {
11
- methods: {
12
- "GET.TRE": getTree,
13
- "GET.EXB": getTable,
14
- },
15
- };
16
-
17
- async function getTree(fun: Fun, context: ExecutionContext): Promise<SmeupTree> {
18
- const tree: SmeupTree = {
19
- type: SmeupDataStructureType.SmeupTree,
20
- messages: [
21
- {
22
- gravity: "INFO",
23
- message: "Info message. CN;COL;PIPPO",
24
- mode: "TN",
25
- }
26
- ],
27
- children: [
28
- {
29
- children: [],
30
- content: {
31
- tipo: "",
32
- parametro: "",
33
- codice: "",
34
- testo: "Hello World",
35
- },
36
- },
37
- ],
38
- };
39
- return tree;
40
- }
41
-
42
- async function getTable(fun: Fun, context: ExecutionContext): Promise<SmeupTable> {
43
- const table: SmeupTable = {
44
- type: SmeupDataStructureType.SmeupTable,
45
- messages: [
46
- {
47
- gravity: "INFO",
48
- message: "Info message. CN;COL;PIPPO",
49
- mode: "TN",
50
- },
51
- {
52
- gravity: "WARNING",
53
- message: "Warning message. CN;COL;PLUTO",
54
- mode: "PM",
55
- },
56
- {
57
- gravity: "ERROR",
58
- message: "Error message.",
59
- mode: "PN",
60
- }
61
- ],
62
- columns: [
63
- {
64
- code: "COL",
65
- text: "Column",
66
- },
67
- ],
68
- rows: [
69
- {
70
- fields: {
71
- COL: {
72
- name: "COL",
73
- tooltip: false,
74
- smeupObject: {
75
- tipo: "",
76
- parametro: "",
77
- codice: "Hello World",
78
- testo: "Hello World",
79
- },
80
- }
81
- },
82
- },
83
- ],
84
- };
85
- return table;
86
- }
87
-
88
- export default JS_00_01;
@@ -1,7 +0,0 @@
1
- import { ApplicationException } from "./application.js";
2
- /**
3
- * Execution Exception
4
- */
5
- export declare class ExecutionException extends ApplicationException {
6
- constructor(message: string, error?: Error);
7
- }
@@ -1,10 +0,0 @@
1
- import { ApplicationException } from "./application.js";
2
- /**
3
- * Execution Exception
4
- */
5
- export class ExecutionException extends ApplicationException {
6
- constructor(message, error) {
7
- const errorMessage = error ? " - " + error.message : "";
8
- super(500, message + errorMessage);
9
- }
10
- }
package/scripts/build.js DELETED
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { exec } from "child_process";
4
-
5
- /**
6
- * BUILD
7
- */
8
-
9
- // start production mode
10
- console.log("Start building");
11
-
12
- // build project with typescript compiler
13
- const build = exec("rimraf lib && tsc");
14
-
15
- // redirect build stdout to standard output
16
- build.stdout.pipe(process.stdout);
17
- // redirect build stderr to standard output
18
- build.stderr.pipe(process.stderr);
19
-
20
- if (build.pid) {
21
- console.log(`Building...\nPress CTRL+C to exit\nPID: ${build.pid}`);
22
- }
23
-
24
- build.on("exit", function () {
25
- console.log("Build successfull");
26
- });
package/scripts/init.js DELETED
@@ -1,95 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import path from "path";
4
- import fs from "fs";
5
- import url from "url";
6
-
7
- /**
8
- * INITIALIZER SCRIPT
9
- *
10
- * syntax: npx @sme.up/kokos-template-node init [PROJECT_NAME]
11
- *
12
- * - create package.json
13
- * - create tsconfig.json
14
- * - create src/service/JS_00_01 example service
15
- */
16
-
17
- // constant
18
- const __filename = url.fileURLToPath(import.meta.url);
19
- const __dirname = path.dirname(__filename);
20
-
21
- try {
22
- // root path
23
- const rootPath = process.cwd();
24
-
25
- const projectName = process.argv[3];
26
- if (!projectName) {
27
- console.error(
28
- "Error: project name not defined \nSyntax: npx @sme.up/kokos-sdk-node init [PROJECT_NAME]"
29
- );
30
- process.exit();
31
- }
32
-
33
- const projectPath = path.resolve(rootPath, projectName);
34
-
35
- // create folder named as projecName
36
- fs.mkdirSync(projectPath);
37
-
38
- // read package.json, tsconfig.json, README.md
39
- const packageJson = JSON.parse(
40
- fs.readFileSync(path.resolve(__dirname, "../package.json"))
41
- );
42
- const tsconfigJson = JSON.parse(fs.readFileSync(
43
- path.resolve(__dirname, "../tsconfig.json")
44
- ));
45
- const readme = fs.readFileSync(path.resolve(__dirname, "../README.md"));
46
-
47
- // create package json
48
- const projectPackageJson = {
49
- name: projectName,
50
- version: "0.0.1",
51
- description: "Kokos Micro Executor Node.js",
52
- type: "module",
53
- scripts: {
54
- build: "kokos build",
55
- "build-image:restapi": "kokos build-image:restapi",
56
- "dev:restapi": "kokos dev:restapi",
57
- "start:restapi": "kokos start:restapi",
58
- },
59
- dependencies: {
60
- "@sme.up/kokos-template-node": packageJson.version,
61
- },
62
- };
63
- // create package.json
64
- const packageJsonStream = fs.createWriteStream(
65
- path.resolve(projectPath, "package.json")
66
- );
67
- packageJsonStream.write(JSON.stringify(projectPackageJson, null, "\t"));
68
- packageJsonStream.end();
69
- // create tsconfig.json
70
- const tsconfigStream = fs.createWriteStream(
71
- path.resolve(projectPath, "tsconfig.json")
72
- );
73
- tsconfigStream.write(JSON.stringify(tsconfigJson, null, "\t"));
74
- tsconfigStream.end();
75
- // create README.md file
76
- const readmeStream = fs.createWriteStream(
77
- path.resolve(projectPath, "README.md")
78
- );
79
- readmeStream.write(readme);
80
- readmeStream.end();
81
-
82
- // create src folder
83
- const srcFolder = path.resolve(projectPath, "src");
84
- fs.mkdirSync(srcFolder);
85
- // create services folder
86
- const serviceFolder = path.resolve(srcFolder, "services");
87
- fs.mkdirSync(serviceFolder);
88
- // load content from JS_00_01.txt
89
- // Copy /init/JS_00_01.txt file to [ROOT]/src/services/JS_00_01.ts
90
- const txtFile = path.resolve(__dirname, "../init/JS_00_01.txt");
91
- const tsFile = path.resolve(serviceFolder, "JS_00_01.ts");
92
- fs.copyFileSync(txtFile, tsFile);
93
- } catch (err) {
94
- console.error(err);
95
- }