@sme.up/kokos-sdk-node 0.0.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.
Files changed (81) hide show
  1. package/README.md +12 -0
  2. package/bin/kokos.js +26 -0
  3. package/docker/restapi/Dockerfile +14 -0
  4. package/docs/.nojekyll +1 -0
  5. package/docs/assets/highlight.css +78 -0
  6. package/docs/assets/main.js +58 -0
  7. package/docs/assets/search.js +1 -0
  8. package/docs/assets/style.css +1338 -0
  9. package/docs/classes/ExecuteFunPayload.html +108 -0
  10. package/docs/classes/ExecutionContext.html +101 -0
  11. package/docs/classes/Fun.html +171 -0
  12. package/docs/classes/FunObject.html +115 -0
  13. package/docs/classes/User.html +122 -0
  14. package/docs/enums/SmeupDataStructureType.html +95 -0
  15. package/docs/index.html +100 -0
  16. package/docs/interfaces/KokosService.html +88 -0
  17. package/docs/interfaces/KokosServiceMethods.html +83 -0
  18. package/docs/interfaces/KokosServiceModule.html +88 -0
  19. package/docs/interfaces/SmeupCell.html +106 -0
  20. package/docs/interfaces/SmeupColumn.html +210 -0
  21. package/docs/interfaces/SmeupDataStructure.html +91 -0
  22. package/docs/interfaces/SmeupMessage.html +102 -0
  23. package/docs/interfaces/SmeupObject.html +153 -0
  24. package/docs/interfaces/SmeupRow.html +93 -0
  25. package/docs/interfaces/SmeupTable.html +105 -0
  26. package/docs/interfaces/SmeupTree.html +112 -0
  27. package/docs/interfaces/SmeupTreeNode.html +109 -0
  28. package/docs/modules.html +93 -0
  29. package/docs/types/SmeupMessageGravity.html +61 -0
  30. package/docs/variables/SMEUP_MESSAGE_GRAVITY.html +72 -0
  31. package/init/JS_00_01.txt +64 -0
  32. package/lib/caller/serviceCaller.d.ts +32 -0
  33. package/lib/caller/serviceCaller.js +66 -0
  34. package/lib/entrypoint/restapi/index.d.ts +1 -0
  35. package/lib/entrypoint/restapi/index.js +110 -0
  36. package/lib/index.d.ts +9 -0
  37. package/lib/index.js +9 -0
  38. package/lib/services/JS_00_01.d.ts +3 -0
  39. package/lib/services/JS_00_01.js +67 -0
  40. package/lib/types/data-structures/smeupDataStructure.d.ts +32 -0
  41. package/lib/types/data-structures/smeupDataStructure.js +19 -0
  42. package/lib/types/data-structures/smeupObject.d.ts +21 -0
  43. package/lib/types/data-structures/smeupObject.js +1 -0
  44. package/lib/types/data-structures/smeupTable.d.ts +66 -0
  45. package/lib/types/data-structures/smeupTable.js +1 -0
  46. package/lib/types/data-structures/smeupTree.d.ts +21 -0
  47. package/lib/types/data-structures/smeupTree.js +1 -0
  48. package/lib/types/exceptions/application.d.ts +8 -0
  49. package/lib/types/exceptions/application.js +12 -0
  50. package/lib/types/exceptions/execution.d.ts +7 -0
  51. package/lib/types/exceptions/execution.js +10 -0
  52. package/lib/types/exceptions/validation.d.ts +7 -0
  53. package/lib/types/exceptions/validation.js +9 -0
  54. package/lib/types/general.d.ts +65 -0
  55. package/lib/types/general.js +158 -0
  56. package/lib/utils/path.d.ts +5 -0
  57. package/lib/utils/path.js +28 -0
  58. package/package.json +63 -0
  59. package/scripts/build.js +26 -0
  60. package/scripts/init.js +95 -0
  61. package/scripts/restapi/build-image-restapi.js +60 -0
  62. package/scripts/restapi/dev.js +30 -0
  63. package/scripts/restapi/start.js +14 -0
  64. package/swagger/favicon-16x16.png +0 -0
  65. package/swagger/favicon-32x32.png +0 -0
  66. package/swagger/index.html +61 -0
  67. package/swagger/oauth2-redirect.html +72 -0
  68. package/swagger/openapi.yaml +130 -0
  69. package/swagger/swagger-ui-bundle.js +92 -0
  70. package/swagger/swagger-ui-bundle.js.map +1 -0
  71. package/swagger/swagger-ui-es-bundle-core.js +9 -0
  72. package/swagger/swagger-ui-es-bundle-core.js.map +1 -0
  73. package/swagger/swagger-ui-es-bundle.js +92 -0
  74. package/swagger/swagger-ui-es-bundle.js.map +1 -0
  75. package/swagger/swagger-ui-standalone-preset.js +22 -0
  76. package/swagger/swagger-ui-standalone-preset.js.map +1 -0
  77. package/swagger/swagger-ui.css +4 -0
  78. package/swagger/swagger-ui.css.map +1 -0
  79. package/swagger/swagger-ui.js +9 -0
  80. package/swagger/swagger-ui.js.map +1 -0
  81. package/tsconfig.json +24 -0
package/lib/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * TYPES
3
+ */
4
+ export * from "./types/general.js";
5
+ /** DATA STRUCTURES */
6
+ export * from "./types/data-structures/smeupDataStructure.js";
7
+ export * from "./types/data-structures/smeupObject.js";
8
+ export * from "./types/data-structures/smeupTable.js";
9
+ export * from "./types/data-structures/smeupTree.js";
package/lib/index.js ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * TYPES
3
+ */
4
+ export * from "./types/general.js";
5
+ /** DATA STRUCTURES */
6
+ export * from "./types/data-structures/smeupDataStructure.js";
7
+ export * from "./types/data-structures/smeupObject.js";
8
+ export * from "./types/data-structures/smeupTable.js";
9
+ export * from "./types/data-structures/smeupTree.js";
@@ -0,0 +1,3 @@
1
+ import { KokosService } from "../types/general.js";
2
+ declare const JS_00_01: KokosService;
3
+ export default JS_00_01;
@@ -0,0 +1,67 @@
1
+ import { SmeupDataStructureType } from "../types/data-structures/smeupDataStructure.js";
2
+ const JS_00_01 = {
3
+ methods: {
4
+ "GET.TRE": getTree,
5
+ "GET.EXB": getTable,
6
+ },
7
+ };
8
+ async function getTree(fun, context) {
9
+ const tree = {
10
+ type: SmeupDataStructureType.SmeupTree,
11
+ children: [
12
+ {
13
+ children: [],
14
+ content: {
15
+ tipo: "CN",
16
+ parametro: "COL",
17
+ codice: "PIPPO",
18
+ testo: "Pippo",
19
+ },
20
+ },
21
+ ],
22
+ };
23
+ return tree;
24
+ }
25
+ async function getTable(fun, context) {
26
+ const table = {
27
+ type: SmeupDataStructureType.SmeupTable,
28
+ columns: [
29
+ {
30
+ code: "COL1",
31
+ text: "Column 1",
32
+ },
33
+ {
34
+ code: "COL2",
35
+ text: "Column 2",
36
+ },
37
+ ],
38
+ rows: [
39
+ {
40
+ fields: {
41
+ COL1: {
42
+ name: "COL1",
43
+ tooltip: false,
44
+ smeupObject: {
45
+ tipo: "CN",
46
+ parametro: "COL",
47
+ codice: "PIPPO",
48
+ testo: "Pippo",
49
+ },
50
+ },
51
+ COL2: {
52
+ name: "COL2",
53
+ tooltip: false,
54
+ smeupObject: {
55
+ tipo: "CN",
56
+ parametro: "COL",
57
+ codice: "PLUTO",
58
+ testo: "Pluto",
59
+ },
60
+ },
61
+ },
62
+ },
63
+ ],
64
+ };
65
+ return table;
66
+ }
67
+ export default JS_00_01;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Smeup data structure
3
+ */
4
+ export interface SmeupDataStructure {
5
+ type: SmeupDataStructureType;
6
+ }
7
+ /**
8
+ * SmeupDataStructure types
9
+ */
10
+ export declare enum SmeupDataStructureType {
11
+ /** Smeup table (EXB) */
12
+ SmeupTable = "SmeupTable",
13
+ /** Smeup tree node (TRE) */
14
+ SmeupTree = "SmeupTreeNode"
15
+ }
16
+ /**
17
+ * SmeupMessage type
18
+ */
19
+ export interface SmeupMessage {
20
+ gravity: SmeupMessageGravity;
21
+ message: string;
22
+ mode: string;
23
+ }
24
+ /**
25
+ * SmeupMessage Gravity
26
+ */
27
+ export declare const SMEUP_MESSAGE_GRAVITY: {
28
+ readonly INFO: "INFO";
29
+ readonly ERROR: "ERROR";
30
+ readonly WARNING: "WARNING";
31
+ };
32
+ export type SmeupMessageGravity = typeof SMEUP_MESSAGE_GRAVITY[keyof typeof SMEUP_MESSAGE_GRAVITY];
@@ -0,0 +1,19 @@
1
+ /**
2
+ * SmeupDataStructure types
3
+ */
4
+ export var SmeupDataStructureType;
5
+ (function (SmeupDataStructureType) {
6
+ /** Smeup table (EXB) */
7
+ SmeupDataStructureType["SmeupTable"] = "SmeupTable";
8
+ /** Smeup tree node (TRE) */
9
+ SmeupDataStructureType["SmeupTree"] = "SmeupTreeNode";
10
+ })(SmeupDataStructureType || (SmeupDataStructureType = {}));
11
+ ;
12
+ /**
13
+ * SmeupMessage Gravity
14
+ */
15
+ export const SMEUP_MESSAGE_GRAVITY = {
16
+ INFO: "INFO",
17
+ ERROR: "ERROR",
18
+ WARNING: "WARNING",
19
+ };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Smeup object
3
+ */
4
+ export interface SmeupObject {
5
+ /** type (T) */
6
+ tipo: string;
7
+ /** parameter (P) */
8
+ parametro: string;
9
+ /** code (K) */
10
+ codice: string;
11
+ /** text (D) */
12
+ testo?: string;
13
+ /** exec (E) */
14
+ exec?: string;
15
+ /** Field */
16
+ fld?: string;
17
+ /** Leaf */
18
+ leaf?: string;
19
+ /** i (I) */
20
+ i?: string;
21
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,66 @@
1
+ import { SmeupDataStructure, SmeupDataStructureType } from "./smeupDataStructure.js";
2
+ import { SmeupObject } from "./smeupObject.js";
3
+ /**
4
+ * SmeupTable (EXB)
5
+ */
6
+ export interface SmeupTable extends SmeupDataStructure {
7
+ type: SmeupDataStructureType.SmeupTable;
8
+ columns: SmeupColumn[];
9
+ rows: SmeupRow[];
10
+ }
11
+ /**
12
+ * Column Data Type
13
+ */
14
+ export interface SmeupColumn {
15
+ /** Name (code) */
16
+ code: string;
17
+ /** Group */
18
+ grp?: string;
19
+ /** Field length */
20
+ lun?: string;
21
+ canonicalForm?: string;
22
+ /** render component */
23
+ cmp?: string;
24
+ /**
25
+ * I: Input
26
+ * O: Output
27
+ * B: Input (???)
28
+ * H: Hide
29
+ * E: Autocomplete
30
+ * G: ???
31
+ *
32
+ */
33
+ io?: "I" | "O" | "B" | "H" | "G" | "E" | "";
34
+ tooltip?: boolean;
35
+ /** Visibile text */
36
+ text?: string;
37
+ sortMode?: string;
38
+ /**
39
+ * ASSE
40
+ * SERIE
41
+ */
42
+ fill?: "ASSE" | "SERIE";
43
+ /** Smeup object */
44
+ ogg?: string;
45
+ /** simple client validation */
46
+ validation?: string;
47
+ pfk?: string;
48
+ tfk?: string;
49
+ sfk?: string;
50
+ }
51
+ /**
52
+ * Row Data Type
53
+ */
54
+ export interface SmeupRow {
55
+ fields: {
56
+ [index: string]: SmeupCell;
57
+ };
58
+ }
59
+ /** Cell */
60
+ export interface SmeupCell {
61
+ /** name, refer to column name */
62
+ name: string;
63
+ /** smeup object */
64
+ smeupObject: SmeupObject;
65
+ tooltip?: boolean;
66
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ import { SmeupDataStructure, SmeupDataStructureType } from "./smeupDataStructure.js";
2
+ import { SmeupObject } from "./smeupObject.js";
3
+ import { SmeupColumn, SmeupRow } from "./smeupTable.js";
4
+ /**
5
+ * SmeupTree (TRE)
6
+ */
7
+ export interface SmeupTree extends SmeupDataStructure {
8
+ type: SmeupDataStructureType.SmeupTree;
9
+ children: SmeupTreeNode[];
10
+ columns?: SmeupColumn[];
11
+ row?: SmeupRow;
12
+ }
13
+ /**
14
+ * Smeup Tree Node (child node)
15
+ */
16
+ export interface SmeupTreeNode {
17
+ children: SmeupTreeNode[];
18
+ content: SmeupObject;
19
+ columns?: SmeupColumn[];
20
+ row?: SmeupRow;
21
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Generic application exception
3
+ */
4
+ export declare class ApplicationException extends Error {
5
+ status: number;
6
+ message: string;
7
+ constructor(status: number, message: string);
8
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Generic application exception
3
+ */
4
+ export class ApplicationException extends Error {
5
+ status;
6
+ message;
7
+ constructor(status, message) {
8
+ super(message);
9
+ this.status = status;
10
+ this.message = message;
11
+ }
12
+ }
@@ -0,0 +1,7 @@
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
+ }
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1,7 @@
1
+ import { ApplicationException } from "./application.js";
2
+ /**
3
+ * Validation Exception
4
+ */
5
+ export declare class ValidationException extends ApplicationException {
6
+ constructor(message: string);
7
+ }
@@ -0,0 +1,9 @@
1
+ import { ApplicationException } from "./application.js";
2
+ /**
3
+ * Validation Exception
4
+ */
5
+ export class ValidationException extends ApplicationException {
6
+ constructor(message) {
7
+ super(400, message);
8
+ }
9
+ }
@@ -0,0 +1,65 @@
1
+ import { SmeupDataStructure } from "./data-structures/smeupDataStructure.js";
2
+ /**
3
+ * Fun Object
4
+ */
5
+ export declare class FunObject {
6
+ t: string;
7
+ p: string;
8
+ k: string;
9
+ }
10
+ /**
11
+ * Fun
12
+ */
13
+ export declare class Fun {
14
+ component: string;
15
+ service: string;
16
+ function: string;
17
+ obj1?: FunObject;
18
+ obj2?: FunObject;
19
+ obj3?: FunObject;
20
+ obj4?: FunObject;
21
+ obj5?: FunObject;
22
+ obj6?: FunObject;
23
+ P?: string;
24
+ INPUT?: string;
25
+ }
26
+ /**
27
+ * User Type
28
+ */
29
+ export declare class User {
30
+ sessionId: string;
31
+ username: string;
32
+ environment: string;
33
+ device: string;
34
+ }
35
+ /**
36
+ * Execution Context
37
+ */
38
+ export declare class ExecutionContext {
39
+ user: User;
40
+ }
41
+ /**
42
+ * Execute Fun payalod DTO
43
+ */
44
+ export declare class ExecuteFunPayload {
45
+ fun: Fun;
46
+ context: ExecutionContext;
47
+ }
48
+ /**
49
+ * Type of Kokos Service ES Module
50
+ */
51
+ export interface KokosServiceModule {
52
+ default: KokosService;
53
+ }
54
+ /**
55
+ * Kokos Service Interface
56
+ */
57
+ export interface KokosService {
58
+ methods: KokosServiceMethods;
59
+ }
60
+ /**
61
+ * Kokos Service Method
62
+ */
63
+ export interface KokosServiceMethods {
64
+ [key: string]: (fun: Fun, context: ExecutionContext) => Promise<SmeupDataStructure>;
65
+ }
@@ -0,0 +1,158 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { IsObject, IsOptional, IsString, ValidateNested, } from "class-validator";
11
+ /**
12
+ * Fun Object
13
+ */
14
+ export class FunObject {
15
+ t;
16
+ p;
17
+ k;
18
+ }
19
+ __decorate([
20
+ IsString(),
21
+ __metadata("design:type", String)
22
+ ], FunObject.prototype, "t", void 0);
23
+ __decorate([
24
+ IsString(),
25
+ __metadata("design:type", String)
26
+ ], FunObject.prototype, "p", void 0);
27
+ __decorate([
28
+ IsString(),
29
+ __metadata("design:type", String)
30
+ ], FunObject.prototype, "k", void 0);
31
+ /**
32
+ * Fun
33
+ */
34
+ export class Fun {
35
+ component;
36
+ service;
37
+ function;
38
+ obj1;
39
+ obj2;
40
+ obj3;
41
+ obj4;
42
+ obj5;
43
+ obj6;
44
+ P;
45
+ INPUT;
46
+ }
47
+ __decorate([
48
+ IsString(),
49
+ __metadata("design:type", String)
50
+ ], Fun.prototype, "component", void 0);
51
+ __decorate([
52
+ IsString(),
53
+ __metadata("design:type", String)
54
+ ], Fun.prototype, "service", void 0);
55
+ __decorate([
56
+ IsString(),
57
+ __metadata("design:type", String)
58
+ ], Fun.prototype, "function", void 0);
59
+ __decorate([
60
+ IsObject(),
61
+ IsOptional(),
62
+ ValidateNested(),
63
+ __metadata("design:type", FunObject)
64
+ ], Fun.prototype, "obj1", void 0);
65
+ __decorate([
66
+ IsObject(),
67
+ IsOptional(),
68
+ ValidateNested(),
69
+ __metadata("design:type", FunObject)
70
+ ], Fun.prototype, "obj2", void 0);
71
+ __decorate([
72
+ IsObject(),
73
+ IsOptional(),
74
+ ValidateNested(),
75
+ __metadata("design:type", FunObject)
76
+ ], Fun.prototype, "obj3", void 0);
77
+ __decorate([
78
+ IsObject(),
79
+ IsOptional(),
80
+ ValidateNested(),
81
+ __metadata("design:type", FunObject)
82
+ ], Fun.prototype, "obj4", void 0);
83
+ __decorate([
84
+ IsObject(),
85
+ IsOptional(),
86
+ ValidateNested(),
87
+ __metadata("design:type", FunObject)
88
+ ], Fun.prototype, "obj5", void 0);
89
+ __decorate([
90
+ IsObject(),
91
+ IsOptional(),
92
+ ValidateNested(),
93
+ __metadata("design:type", FunObject)
94
+ ], Fun.prototype, "obj6", void 0);
95
+ __decorate([
96
+ IsString(),
97
+ IsOptional(),
98
+ __metadata("design:type", String)
99
+ ], Fun.prototype, "P", void 0);
100
+ __decorate([
101
+ IsString(),
102
+ IsOptional(),
103
+ __metadata("design:type", String)
104
+ ], Fun.prototype, "INPUT", void 0);
105
+ /**
106
+ * User Type
107
+ */
108
+ export class User {
109
+ sessionId;
110
+ username;
111
+ environment;
112
+ device;
113
+ }
114
+ __decorate([
115
+ IsString(),
116
+ __metadata("design:type", String)
117
+ ], User.prototype, "sessionId", void 0);
118
+ __decorate([
119
+ IsString(),
120
+ __metadata("design:type", String)
121
+ ], User.prototype, "username", void 0);
122
+ __decorate([
123
+ IsString(),
124
+ __metadata("design:type", String)
125
+ ], User.prototype, "environment", void 0);
126
+ __decorate([
127
+ IsString(),
128
+ __metadata("design:type", String)
129
+ ], User.prototype, "device", void 0);
130
+ /**
131
+ * Execution Context
132
+ */
133
+ export class ExecutionContext {
134
+ user;
135
+ }
136
+ __decorate([
137
+ IsObject(),
138
+ IsOptional(),
139
+ ValidateNested(),
140
+ __metadata("design:type", User)
141
+ ], ExecutionContext.prototype, "user", void 0);
142
+ /**
143
+ * Execute Fun payalod DTO
144
+ */
145
+ export class ExecuteFunPayload {
146
+ fun;
147
+ context;
148
+ }
149
+ __decorate([
150
+ IsObject(),
151
+ ValidateNested(),
152
+ __metadata("design:type", Fun)
153
+ ], ExecuteFunPayload.prototype, "fun", void 0);
154
+ __decorate([
155
+ IsObject(),
156
+ ValidateNested(),
157
+ __metadata("design:type", ExecutionContext)
158
+ ], ExecuteFunPayload.prototype, "context", void 0);
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Get the project root
3
+ * @returns
4
+ */
5
+ export declare function getProjectRoot(): string;
@@ -0,0 +1,28 @@
1
+ import path from "path";
2
+ import fs from "fs";
3
+ /**
4
+ * Get the project root
5
+ * @returns
6
+ */
7
+ export function getProjectRoot() {
8
+ let dir = process.cwd();
9
+ while (!containsFileOrFolder(dir, "package.json")) {
10
+ const parentDir = path.dirname(dir);
11
+ if (dir === parentDir) {
12
+ // Reached the root directory without finding package.json
13
+ return null;
14
+ }
15
+ dir = parentDir;
16
+ }
17
+ return dir;
18
+ }
19
+ function containsFileOrFolder(dir, name) {
20
+ const filePath = path.join(dir, name);
21
+ try {
22
+ const stats = fs.statSync(filePath);
23
+ return stats.isFile() || stats.isDirectory();
24
+ }
25
+ catch (error) {
26
+ return false;
27
+ }
28
+ }
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@sme.up/kokos-sdk-node",
3
+ "version": "0.0.1",
4
+ "description": "Node.js Kokos SDK",
5
+ "author": "Smeup LAB <info@smeup.com> (https://www.smeup.com/)",
6
+ "type": "module",
7
+ "exports": "./lib/index.js",
8
+ "module": "./lib/index.js",
9
+ "typings": "./lib/index.d.ts",
10
+ "files": [
11
+ "lib/",
12
+ "scripts/",
13
+ "bin/",
14
+ "docker/",
15
+ "init/",
16
+ "swagger/",
17
+ "docs/",
18
+ "package.json",
19
+ "tsconfig.json"
20
+ ],
21
+ "bin": {
22
+ "kokos": "./bin/kokos.js"
23
+ },
24
+ "scripts": {
25
+ "clean": "rimraf lib",
26
+ "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"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/smeup/kokos.git"
34
+ },
35
+ "license": "ISC",
36
+ "bugs": {
37
+ "url": "https://github.com/smeup/kokos/issues"
38
+ },
39
+ "homepage": "https://github.com/smeup/kokos#readme",
40
+ "dependencies": {
41
+ "@types/node": "^18.15.11",
42
+ "class-transformer": "^0.5.1",
43
+ "class-validator": "^0.14.0",
44
+ "express": "^4.18.2",
45
+ "nodemon": "^2.0.22",
46
+ "rimraf": "^4.4.1",
47
+ "ts-node": "^10.9.1",
48
+ "typescript": "^4.9.4"
49
+ },
50
+ "devDependencies": {
51
+ "@types/express": "^4.17.17",
52
+ "@types/jest": "^29.5.0",
53
+ "axios": "^1.3.4",
54
+ "jest": "^29.5.0",
55
+ "ts-jest": "^29.0.5"
56
+ },
57
+ "jest": {
58
+ "preset": "ts-jest/presets/default-esm",
59
+ "moduleNameMapper": {
60
+ "^(\\.{1,2}/.*)\\.js$": "$1"
61
+ }
62
+ }
63
+ }
@@ -0,0 +1,26 @@
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
+ });