hotstaq 0.8.26 → 0.8.28
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/build/src/HotAPI.js +1 -1
- package/build/src/HotAPI.js.map +1 -1
- package/build/src/HotAgentRoute.d.ts +2 -1
- package/build/src/HotAgentRoute.d.ts.map +1 -1
- package/build/src/HotAgentRoute.js +9 -4
- package/build/src/HotAgentRoute.js.map +1 -1
- package/build/src/HotConvertInterfaceToRouteParameters.d.ts +17 -0
- package/build/src/HotConvertInterfaceToRouteParameters.d.ts.map +1 -0
- package/build/src/HotConvertInterfaceToRouteParameters.js +76 -0
- package/build/src/HotConvertInterfaceToRouteParameters.js.map +1 -0
- package/build/src/HotGenerator.d.ts +3 -3
- package/build/src/HotGenerator.d.ts.map +1 -1
- package/build/src/HotGenerator.js +125 -115
- package/build/src/HotGenerator.js.map +1 -1
- package/build/src/HotRoute.js +2 -2
- package/build/src/HotRoute.js.map +1 -1
- package/build/src/HotRouteMethod.d.ts +11 -6
- package/build/src/HotRouteMethod.d.ts.map +1 -1
- package/build/src/HotRouteMethod.js +76 -26
- package/build/src/HotRouteMethod.js.map +1 -1
- package/build/src/HotStaq.d.ts +5 -0
- package/build/src/HotStaq.d.ts.map +1 -1
- package/build/src/HotStaq.js +31 -1
- package/build/src/HotStaq.js.map +1 -1
- package/build/src/HotWebSocketServer.js +1 -1
- package/build/src/HotWebSocketServer.js.map +1 -1
- package/build-web/HotStaq.js +2 -2
- package/build-web/HotStaq.min.js +133 -131
- package/package.json +1 -1
- package/src/HotAPI.ts +1 -1
- package/src/HotAgentRoute.ts +10 -6
- package/src/HotConvertInterfaceToRouteParameters.ts +115 -0
- package/src/HotGenerator.ts +22 -18
- package/src/HotRoute.ts +2 -2
- package/src/HotRouteMethod.ts +100 -36
- package/src/HotStaq.ts +40 -1
- package/src/HotWebSocketServer.ts +1 -1
package/build/src/HotAPI.js
CHANGED
|
@@ -129,7 +129,7 @@ class HotAPI {
|
|
|
129
129
|
if (this.routes[routeName] == null)
|
|
130
130
|
this.routes[routeName] = new HotRoute_1.HotRoute(this.connection, routeName);
|
|
131
131
|
if (typeof (routeMethod) === "string") {
|
|
132
|
-
this.routes[routeName].addMethod(
|
|
132
|
+
this.routes[routeName].addMethod(HotRouteMethod_1.HotRouteMethod.create(this.routes[routeName], routeMethod, executeFunction));
|
|
133
133
|
}
|
|
134
134
|
else
|
|
135
135
|
this.routes[routeName].addMethod(routeMethod);
|
package/build/src/HotAPI.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HotAPI.js","sourceRoot":"","sources":["../../src/HotAPI.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4DAA+B;AAC/B,0DAAiC;AAEjC,2CAAwC;AACxC,yCAAsC;AAEtC,qDAA+F;AAyB/F;;GAEG;AACH,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAE7B,mEAAQ,CAAA;IACR,qEAAS,CAAA;IACT,+DAAM,CAAA;AACP,CAAC,EALW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAK7B;AAED;;GAEG;AACH,MAAsB,MAAM;IAgE3B,YAAa,OAAe,EAAE,UAAiC,EAAE,KAAY,IAAI;QAEhF,IAAI,UAAU,IAAI,IAAI;YACrB,MAAM,IAAI,KAAK,CAAE,2CAA2C,OAAO,EAAE,CAAC,CAAC;QAExE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC,QAAQ,CAAC;QACtD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,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,EAAE,CAAC,CAAC;gBAC/C,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEJ,OAAO,CAAC,OAAO,CAAC,CAAC;QAClB,CAAC;KAAA;CACD;AAlaD,wBAkaC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HotRoute } from "./HotRoute";
|
|
2
|
+
import { ServerRequest } from "./HotRouteMethod";
|
|
2
3
|
import { HotAgentAPI } from "./HotAgentAPI";
|
|
3
4
|
/**
|
|
4
5
|
* Hello world route.
|
|
@@ -12,6 +13,6 @@ export declare class HotAgentRoute extends HotRoute {
|
|
|
12
13
|
/**
|
|
13
14
|
* Execute a file.
|
|
14
15
|
*/
|
|
15
|
-
protected execute(req:
|
|
16
|
+
protected execute(req: ServerRequest): Promise<any>;
|
|
16
17
|
}
|
|
17
18
|
//# sourceMappingURL=HotAgentRoute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HotAgentRoute.d.ts","sourceRoot":"","sources":["../../src/HotAgentRoute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"HotAgentRoute.d.ts","sourceRoot":"","sources":["../../src/HotAgentRoute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAkC,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C;;GAEG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IAEvC;;OAEG;IACH,OAAO,EAAE,WAAW,CAAC;gBAEX,GAAG,EAAE,WAAW;IAc7B;;OAEG;cACa,OAAO,CAAE,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC;CAc1D"}
|
|
@@ -41,15 +41,20 @@ class HotAgentRoute extends HotRoute_1.HotRoute {
|
|
|
41
41
|
constructor(api) {
|
|
42
42
|
super(api.connection, "agent");
|
|
43
43
|
this.thisApi = api;
|
|
44
|
-
this.addMethod(
|
|
44
|
+
this.addMethod({
|
|
45
|
+
name: "execute",
|
|
46
|
+
onServerExecute: this.execute,
|
|
47
|
+
type: HotRouteMethod_1.HotEventMethod.POST,
|
|
48
|
+
onServerAuthorize: api.userAuth
|
|
49
|
+
});
|
|
45
50
|
}
|
|
46
51
|
/**
|
|
47
52
|
* Execute a file.
|
|
48
53
|
*/
|
|
49
|
-
execute(req
|
|
54
|
+
execute(req) {
|
|
50
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
const cmd = HotStaq_1.HotStaq.getParam("cmd", jsonObj);
|
|
52
|
-
const data = HotStaq_1.HotStaq.getParamDefault("data", jsonObj, undefined);
|
|
56
|
+
const cmd = HotStaq_1.HotStaq.getParam("cmd", req.jsonObj);
|
|
57
|
+
const data = HotStaq_1.HotStaq.getParamDefault("data", req.jsonObj, undefined);
|
|
53
58
|
let foundCmd = this.thisApi.commands[cmd];
|
|
54
59
|
if (foundCmd == null)
|
|
55
60
|
throw new Error(`Command ${cmd} not found!`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HotAgentRoute.js","sourceRoot":"","sources":["../../src/HotAgentRoute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoC;AACpC,yCAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"HotAgentRoute.js","sourceRoot":"","sources":["../../src/HotAgentRoute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoC;AACpC,yCAAsC;AACtC,qDAAiF;AAGjF,uCAAyB;AACzB,uCAAyB;AAEzB;;GAEG;AACH,MAAa,aAAc,SAAQ,mBAAQ;IAO1C,YAAa,GAAgB;QAE5B,KAAK,CAAE,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAE1B,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;QAEzB,IAAI,CAAC,SAAS,CAAE;YACd,IAAI,EAAE,SAAS;YACf,eAAe,EAAE,IAAI,CAAC,OAAO;YAC7B,IAAI,EAAE,+BAAc,CAAC,IAAI;YACzB,iBAAiB,EAAE,GAAG,CAAC,QAAQ;SAC/B,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACa,OAAO,CAAE,GAAkB;;YAE1C,MAAM,GAAG,GAAW,iBAAO,CAAC,QAAQ,CAAE,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;YAC1D,MAAM,IAAI,GAAQ,iBAAO,CAAC,eAAe,CAAE,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YACrE,IAAI,QAAQ,GAAW,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YAElD,IAAI,QAAQ,IAAI,IAAI;gBAChB,MAAM,IAAI,KAAK,CAAE,WAAW,GAAG,aAAa,CAAC,CAAC;YAElD,MAAM,OAAO,GAAW,EAAE,CAAC,YAAY,CAAE,QAAQ,CAAC,CAAC,QAAQ,EAAG,CAAC;YAC/D,EAAE,CAAC,eAAe,CAAE,OAAO,EAAE,IAAI,CAAC,CAAC;YAEnC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;KAAA;CACD;AAtCD,sCAsCC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface InterfaceProperty {
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
isOptional: boolean;
|
|
5
|
+
comments: string[];
|
|
6
|
+
child: ParsedInterface | null;
|
|
7
|
+
}
|
|
8
|
+
export interface ParsedInterface {
|
|
9
|
+
name: string;
|
|
10
|
+
comments: string[];
|
|
11
|
+
properties: InterfaceProperty[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Parse an interface from a TypeScript source file, and return a ParsedInterface object.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseInterface(tempFileLocation: string, sourceCode: string, interfaceName: string): ParsedInterface | null;
|
|
17
|
+
//# sourceMappingURL=HotConvertInterfaceToRouteParameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HotConvertInterfaceToRouteParameters.d.ts","sourceRoot":"","sources":["../../src/HotConvertInterfaceToRouteParameters.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAEjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAE/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,iBAAiB,EAAE,CAAC;CAChC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CA6F3H"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseInterface = void 0;
|
|
7
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
+
/**
|
|
9
|
+
* Parse an interface from a TypeScript source file, and return a ParsedInterface object.
|
|
10
|
+
*/
|
|
11
|
+
function parseInterface(tempFileLocation, sourceCode, interfaceName) {
|
|
12
|
+
// Parse the source code into an AST using the TypeScript compiler API
|
|
13
|
+
const sourceFile = typescript_1.default.createSourceFile(tempFileLocation, sourceCode, typescript_1.default.ScriptTarget.Latest,
|
|
14
|
+
/*setParentNodes*/ false);
|
|
15
|
+
// Find the interface node in the AST
|
|
16
|
+
let interfaceNode = null;
|
|
17
|
+
let visit = (node) => {
|
|
18
|
+
if (typescript_1.default.isInterfaceDeclaration(node)) {
|
|
19
|
+
if (node.name.getText(sourceFile) === interfaceName)
|
|
20
|
+
interfaceNode = node;
|
|
21
|
+
}
|
|
22
|
+
typescript_1.default.forEachChild(node, visit);
|
|
23
|
+
};
|
|
24
|
+
typescript_1.default.forEachChild(sourceFile, visit);
|
|
25
|
+
if (interfaceNode == null)
|
|
26
|
+
return null;
|
|
27
|
+
let getComments = (node) => {
|
|
28
|
+
const leadingComments = typescript_1.default.getLeadingCommentRanges(sourceFile.text, node.pos);
|
|
29
|
+
let comments = [];
|
|
30
|
+
if (leadingComments) {
|
|
31
|
+
comments = leadingComments.map((commentRange) => sourceFile.text.substring(commentRange.pos, commentRange.end)
|
|
32
|
+
.replace(/(^\/\*\*|\*\/|\*|\s*\/\/\/?|\s*\/\*|\s*\*\/)/gm, '') // Remove /**, */, *, ///, /*, and */
|
|
33
|
+
.trim() // Trim whitespace
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
return (comments);
|
|
37
|
+
};
|
|
38
|
+
let traverseInterface = (interfaceNode2, interfaceName2) => {
|
|
39
|
+
let interfaceComments = getComments(interfaceNode2);
|
|
40
|
+
// Extract information about the interface properties
|
|
41
|
+
let properties = [];
|
|
42
|
+
typescript_1.default.forEachChild(interfaceNode2, (childNode) => {
|
|
43
|
+
if (typescript_1.default.isPropertySignature(childNode)) {
|
|
44
|
+
const propertyName = childNode.name.getText(sourceFile);
|
|
45
|
+
let propertyType = childNode.type ? childNode.type.getText(sourceFile) : "any";
|
|
46
|
+
const propertyComments = getComments(childNode);
|
|
47
|
+
let propertyOptional = false;
|
|
48
|
+
if (childNode.questionToken != null)
|
|
49
|
+
propertyOptional = true;
|
|
50
|
+
let childInterface = null;
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
if (typescript_1.default.isTypeLiteralNode(childNode.type)) {
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
childInterface = traverseInterface(childNode.type, propertyName);
|
|
55
|
+
propertyType = "object";
|
|
56
|
+
}
|
|
57
|
+
properties.push({
|
|
58
|
+
name: propertyName,
|
|
59
|
+
type: propertyType,
|
|
60
|
+
isOptional: propertyOptional,
|
|
61
|
+
comments: propertyComments,
|
|
62
|
+
child: childInterface
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return ({
|
|
67
|
+
name: interfaceName2,
|
|
68
|
+
comments: interfaceComments,
|
|
69
|
+
properties: properties
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
let newInterface = traverseInterface(interfaceNode, interfaceName);
|
|
73
|
+
return (newInterface);
|
|
74
|
+
}
|
|
75
|
+
exports.parseInterface = parseInterface;
|
|
76
|
+
//# sourceMappingURL=HotConvertInterfaceToRouteParameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HotConvertInterfaceToRouteParameters.js","sourceRoot":"","sources":["../../src/HotConvertInterfaceToRouteParameters.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAkB5B;;GAEG;AACH,SAAgB,cAAc,CAAE,gBAAwB,EAAE,UAAkB,EAAE,aAAqB;IAElG,sEAAsE;IACtE,MAAM,UAAU,GAAkB,oBAAE,CAAC,gBAAgB,CACnD,gBAAgB,EAChB,UAAU,EACV,oBAAE,CAAC,YAAY,CAAC,MAAM;IACtB,kBAAkB,CAAC,KAAK,CACxB,CAAC;IAEH,qCAAqC;IACrC,IAAI,aAAa,GAAmC,IAAI,CAAC;IACzD,IAAI,KAAK,GAAG,CAAC,IAAa,EAAE,EAAE;QAE7B,IAAI,oBAAE,CAAC,sBAAsB,CAAC,IAAI,CAAC,EACnC;YACC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAE,UAAU,CAAC,KAAK,aAAa;gBACnD,aAAa,GAAG,IAAI,CAAC;SACtB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CAAC,CAAC,CAAC,KAAK,CAAC;gBAC/E,MAAM,gBAAgB,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;gBAChD,IAAI,gBAAgB,GAAY,KAAK,CAAC;gBAEtC,IAAI,SAAS,CAAC,aAAa,IAAI,IAAI;oBAClC,gBAAgB,GAAG,IAAI,CAAC;gBAEzB,IAAI,cAAc,GAAG,IAAI,CAAC;gBAE1B,aAAa;gBACb,IAAI,oBAAE,CAAC,iBAAiB,CAAE,SAAS,CAAC,IAAI,CAAC,EACzC;oBACC,aAAa;oBACb,cAAc,GAAG,iBAAiB,CAAE,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;oBAClE,YAAY,GAAG,QAAQ,CAAC;iBACxB;gBAED,UAAU,CAAC,IAAI,CAAC;oBACf,IAAI,EAAE,YAAY;oBAClB,IAAI,EAAE,YAAY;oBAClB,UAAU,EAAE,gBAAgB;oBAC5B,QAAQ,EAAE,gBAAgB;oBAC1B,KAAK,EAAE,cAAc;iBACrB,CAAC,CAAC;aACH;QACF,CAAC,CAAC,CAAC;QAEJ,OAAO,CAAC;YACN,IAAI,EAAE,cAAc;YACpB,QAAQ,EAAE,iBAAiB;YAC3B,UAAU,EAAE,UAAU;SACtB,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,IAAI,YAAY,GAA2B,iBAAiB,CAAE,aAAa,EAAE,aAAa,CAAC,CAAC;IAE5F,OAAO,CAAC,YAAY,CAAC,CAAC;AACvB,CAAC;AA7FD,wCA6FC"}
|
|
@@ -80,14 +80,14 @@ export declare class HotGenerator {
|
|
|
80
80
|
/**
|
|
81
81
|
* Get the content.
|
|
82
82
|
*/
|
|
83
|
-
getAPIContent(type: string, contentPart: string, data: any): string
|
|
83
|
+
getAPIContent(type: string, contentPart: string, data: any): Promise<string>;
|
|
84
84
|
/**
|
|
85
85
|
* Get the Typescript content.
|
|
86
86
|
*/
|
|
87
|
-
getTypeScriptContent(contentPart: string, data: any): string
|
|
87
|
+
getTypeScriptContent(contentPart: string, data: any): Promise<string>;
|
|
88
88
|
/**
|
|
89
89
|
* Get the JavaScript content.
|
|
90
90
|
*/
|
|
91
|
-
getJavaScriptContent(contentPart: string, data: any): string
|
|
91
|
+
getJavaScriptContent(contentPart: string, data: any): Promise<string>;
|
|
92
92
|
}
|
|
93
93
|
//# sourceMappingURL=HotGenerator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HotGenerator.d.ts","sourceRoot":"","sources":["../../src/HotGenerator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAK7C;;GAEG;AACH,qBAAa,YAAY;IAExB;;OAEG;IACH,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;gBAEF,MAAM,EAAE,MAAM;IAY3B;;OAEG;IACH,qBAAqB,CAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EACjE,SAAS,EAAE,SAAS,EAAE,UAAU,GAAE,MAAW,GAAG,MAAM;IAiCxD;;OAEG;cACa,cAAc,CAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC;QAAE,GA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AAC,IAAI,CAAC;IAoOxG;;OAEG;IACG,aAAa,CAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAanF;;OAEG;IACG,oBAAoB,CAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAkE5E;;OAEG;IACG,oBAAoB,CAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;CAkW5E"}
|
|
@@ -158,14 +158,14 @@ class HotGenerator {
|
|
|
158
158
|
yield this.processAPIs(processor, apis, (key, hotsite, loadedAPI, libraryName, apiName, outputDir, serverResult) => __awaiter(this, void 0, void 0, function* () {
|
|
159
159
|
this.logger.info(`Generating Web API for ${this.generateType} using "${key}" from HotSite "${hotsite.name}"...`);
|
|
160
160
|
let apiFileContent = "";
|
|
161
|
-
apiFileContent += this.getAPIContent(this.generateType, "header", { libraryName: libraryName, apiName: apiName, baseAPIUrl: serverResult.baseAPIUrl });
|
|
161
|
+
apiFileContent += yield this.getAPIContent(this.generateType, "header", { libraryName: libraryName, apiName: apiName, baseAPIUrl: serverResult.baseAPIUrl });
|
|
162
162
|
let collectedRoutes = [];
|
|
163
163
|
for (let key2 in serverResult.api.routes) {
|
|
164
164
|
let route = serverResult.api.routes[key2];
|
|
165
165
|
let routeName = route.route;
|
|
166
166
|
if (typeof (routeName) !== "string")
|
|
167
167
|
throw new Error(`Provided route name is not a string: ${JSON.stringify(route)}`);
|
|
168
|
-
apiFileContent += this.getAPIContent(this.generateType, "class_header", { routeName: routeName, baseAPIUrl: serverResult.baseAPIUrl,
|
|
168
|
+
apiFileContent += yield this.getAPIContent(this.generateType, "class_header", { routeName: routeName, baseAPIUrl: serverResult.baseAPIUrl,
|
|
169
169
|
libraryName: libraryName, apiName: apiName });
|
|
170
170
|
for (let iJdx = 0; iJdx < route.methods.length; iJdx++) {
|
|
171
171
|
let method = route.methods[iJdx];
|
|
@@ -177,16 +177,16 @@ class HotGenerator {
|
|
|
177
177
|
methodType = "post";
|
|
178
178
|
if (method.type === HotRouteMethod_1.HotEventMethod.FILE_UPLOAD)
|
|
179
179
|
methodType = "post";
|
|
180
|
-
apiFileContent += this.getAPIContent(this.generateType, "class_function", { methodName: methodName, routeVersion: route.version,
|
|
180
|
+
apiFileContent += yield this.getAPIContent(this.generateType, "class_function", { methodName: methodName, routeVersion: route.version,
|
|
181
181
|
routeName: routeName, methodType: methodType.toUpperCase(),
|
|
182
182
|
libraryName: libraryName, apiName: apiName, method: method });
|
|
183
183
|
}
|
|
184
|
-
apiFileContent += this.getAPIContent(this.generateType, "class_footer", { libraryName: libraryName, baseAPIUrl: serverResult.baseAPIUrl, apiName: apiName, routeName: routeName });
|
|
184
|
+
apiFileContent += yield this.getAPIContent(this.generateType, "class_footer", { libraryName: libraryName, baseAPIUrl: serverResult.baseAPIUrl, apiName: apiName, routeName: routeName });
|
|
185
185
|
collectedRoutes.push({
|
|
186
186
|
libraryName: libraryName, apiName: apiName, routeName: routeName
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
|
-
apiFileContent += this.getAPIContent(this.generateType, "footer", {
|
|
189
|
+
apiFileContent += yield this.getAPIContent(this.generateType, "footer", {
|
|
190
190
|
libraryName: libraryName, apiName: apiName, collectedRoutes: collectedRoutes
|
|
191
191
|
});
|
|
192
192
|
const outputFile = ppath.normalize(`${outputDir}/${libraryName}_${apiName}`);
|
|
@@ -279,7 +279,7 @@ class HotGenerator {
|
|
|
279
279
|
let component = null;
|
|
280
280
|
let componentName = "";
|
|
281
281
|
this.logger.verbose(`Generating method ${methodName} at path ${path}`);
|
|
282
|
-
let getChildParameters = (param) => {
|
|
282
|
+
let getChildParameters = (param) => __awaiter(this, void 0, void 0, function* () {
|
|
283
283
|
let createdObj = {
|
|
284
284
|
type: param.type || "string",
|
|
285
285
|
description: param.description || "",
|
|
@@ -299,10 +299,12 @@ class HotGenerator {
|
|
|
299
299
|
};
|
|
300
300
|
if (typeof (param2) === "string")
|
|
301
301
|
tempParam["type"] = param2;
|
|
302
|
+
else if (typeof (param2) === "function")
|
|
303
|
+
tempParam = yield param2();
|
|
302
304
|
else
|
|
303
305
|
tempParam = param2;
|
|
304
306
|
if (tempParam.type === "object")
|
|
305
|
-
createdObj.properties[key3] = getChildParameters(tempParam.parameters);
|
|
307
|
+
createdObj.properties[key3] = yield getChildParameters(tempParam.parameters);
|
|
306
308
|
else {
|
|
307
309
|
createdObj.properties[key3] = {
|
|
308
310
|
type: tempParam.type || "string",
|
|
@@ -312,7 +314,7 @@ class HotGenerator {
|
|
|
312
314
|
}
|
|
313
315
|
}
|
|
314
316
|
return (createdObj);
|
|
315
|
-
};
|
|
317
|
+
});
|
|
316
318
|
if (method.description != null)
|
|
317
319
|
methodDescription = method.description;
|
|
318
320
|
if (method.returns != null) {
|
|
@@ -321,7 +323,7 @@ class HotGenerator {
|
|
|
321
323
|
description: method.returns.description || "",
|
|
322
324
|
content: {
|
|
323
325
|
"application/json": {
|
|
324
|
-
schema: getChildParameters(method.returns)
|
|
326
|
+
schema: yield getChildParameters(method.returns)
|
|
325
327
|
}
|
|
326
328
|
}
|
|
327
329
|
};
|
|
@@ -359,7 +361,7 @@ class HotGenerator {
|
|
|
359
361
|
for (let key3 in method.parameters) {
|
|
360
362
|
let param = method.parameters[key3];
|
|
361
363
|
if (param.type === "object")
|
|
362
|
-
component.properties[key3] = getChildParameters(param);
|
|
364
|
+
component.properties[key3] = yield getChildParameters(param);
|
|
363
365
|
else {
|
|
364
366
|
component.properties[key3] = {
|
|
365
367
|
type: param.type || "string",
|
|
@@ -411,25 +413,28 @@ class HotGenerator {
|
|
|
411
413
|
* Get the content.
|
|
412
414
|
*/
|
|
413
415
|
getAPIContent(type, contentPart, data) {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
416
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
417
|
+
let content = "";
|
|
418
|
+
if (type === "javascript")
|
|
419
|
+
content = yield this.getJavaScriptContent(contentPart, data);
|
|
420
|
+
if (type === "typescript")
|
|
421
|
+
content = yield this.getTypeScriptContent(contentPart, data);
|
|
422
|
+
return (content);
|
|
423
|
+
});
|
|
420
424
|
}
|
|
421
425
|
/**
|
|
422
426
|
* Get the Typescript content.
|
|
423
427
|
*/
|
|
424
428
|
getTypeScriptContent(contentPart, data) {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
429
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
430
|
+
let content = "";
|
|
431
|
+
if (contentPart === "header") {
|
|
432
|
+
content = `
|
|
428
433
|
import { HotAPI } from "HotStaq";
|
|
429
434
|
`;
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
435
|
+
}
|
|
436
|
+
if (contentPart === "class_header") {
|
|
437
|
+
content = `
|
|
433
438
|
/**
|
|
434
439
|
* The ${data.routeName} API route.
|
|
435
440
|
*/
|
|
@@ -446,9 +451,9 @@ export class ${data.routeName} extends HotAPI
|
|
|
446
451
|
}
|
|
447
452
|
|
|
448
453
|
`;
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
454
|
+
}
|
|
455
|
+
if (contentPart === "class_function") {
|
|
456
|
+
content = `
|
|
452
457
|
/**
|
|
453
458
|
* The ${data.methodName} method.
|
|
454
459
|
*/
|
|
@@ -468,22 +473,24 @@ export class ${data.routeName} extends HotAPI
|
|
|
468
473
|
}
|
|
469
474
|
|
|
470
475
|
`;
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
476
|
+
}
|
|
477
|
+
if (contentPart === "class_footer") {
|
|
478
|
+
content = `
|
|
474
479
|
}
|
|
475
480
|
`;
|
|
476
|
-
|
|
477
|
-
|
|
481
|
+
}
|
|
482
|
+
return (content);
|
|
483
|
+
});
|
|
478
484
|
}
|
|
479
485
|
/**
|
|
480
486
|
* Get the JavaScript content.
|
|
481
487
|
*/
|
|
482
488
|
getJavaScriptContent(contentPart, data) {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
489
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
490
|
+
let content = "";
|
|
491
|
+
if (contentPart === "header") {
|
|
492
|
+
content =
|
|
493
|
+
`if (typeof (${data.libraryName}) === "undefined")
|
|
487
494
|
${data.libraryName} = {};
|
|
488
495
|
|
|
489
496
|
var HotAPIGlobal = undefined;
|
|
@@ -576,9 +583,9 @@ function HotStaqPostJSONObject (methodType, url, jsonObj, auth)
|
|
|
576
583
|
return (promise);
|
|
577
584
|
}
|
|
578
585
|
`;
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
586
|
+
}
|
|
587
|
+
if (contentPart === "class_header") {
|
|
588
|
+
content = `
|
|
582
589
|
/**
|
|
583
590
|
* The ${data.routeName} API route.
|
|
584
591
|
*/
|
|
@@ -622,90 +629,92 @@ class ${data.routeName}
|
|
|
622
629
|
}
|
|
623
630
|
}
|
|
624
631
|
`;
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
632
|
+
}
|
|
633
|
+
if (contentPart === "class_function") {
|
|
634
|
+
let method = data.method;
|
|
635
|
+
let paramsDescription = "";
|
|
636
|
+
let jsonParamOutput = "";
|
|
637
|
+
let jsonReturnOutput = "";
|
|
638
|
+
let getChildParameters = (param) => __awaiter(this, void 0, void 0, function* () {
|
|
639
|
+
let outputParams = "";
|
|
640
|
+
if (param.type != null) {
|
|
641
|
+
if (param.type === "object") {
|
|
642
|
+
if (param.parameters == null)
|
|
643
|
+
throw new Error(`Missing parameters for an object in ${method.name}`);
|
|
644
|
+
}
|
|
645
|
+
for (let key3 in param.parameters) {
|
|
646
|
+
let param2 = param.parameters[key3];
|
|
647
|
+
let tempParam = {
|
|
648
|
+
type: "string",
|
|
649
|
+
required: false,
|
|
650
|
+
description: ""
|
|
651
|
+
};
|
|
652
|
+
if (typeof (param2) === "string")
|
|
653
|
+
tempParam["type"] = param2;
|
|
654
|
+
else if (typeof (param2) === "function")
|
|
655
|
+
tempParam = yield param2();
|
|
656
|
+
else
|
|
657
|
+
tempParam = param2;
|
|
658
|
+
if (tempParam.type === "object")
|
|
659
|
+
outputParams += yield getChildParameters(tempParam.parameters);
|
|
660
|
+
else {
|
|
661
|
+
outputParams += `
|
|
653
662
|
* @property {${tempParam.type || "string"}} ${key3} ${tempParam.description || ""}`;
|
|
663
|
+
}
|
|
654
664
|
}
|
|
655
665
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
paramsToOutput += `
|
|
666
|
+
return (outputParams);
|
|
667
|
+
});
|
|
668
|
+
if (method.parameters != null) {
|
|
669
|
+
let paramsObjType = "";
|
|
670
|
+
let paramsToOutput = "";
|
|
671
|
+
paramsObjType = `${data.routeName}_${data.methodName}_json_object_type`.toUpperCase();
|
|
672
|
+
for (let key in method.parameters) {
|
|
673
|
+
let param = method.parameters[key];
|
|
674
|
+
if (param.type === "object") {
|
|
675
|
+
paramsToOutput += yield getChildParameters(param);
|
|
676
|
+
}
|
|
677
|
+
else {
|
|
678
|
+
paramsToOutput += `
|
|
670
679
|
* @property {${param.type || "string"}} ${key} ${param.description || ""}`;
|
|
680
|
+
}
|
|
671
681
|
}
|
|
672
|
-
|
|
673
|
-
paramsDescription = `/**
|
|
682
|
+
paramsDescription = `/**
|
|
674
683
|
* The JSON object to send to the server.
|
|
675
684
|
*
|
|
676
685
|
* @typedef {Object} ${paramsObjType}${paramsToOutput}
|
|
677
686
|
*/
|
|
678
687
|
|
|
679
688
|
`;
|
|
680
|
-
|
|
689
|
+
jsonParamOutput = `
|
|
681
690
|
*
|
|
682
691
|
* @param {${paramsObjType}} jsonObj`;
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
692
|
+
}
|
|
693
|
+
if (method.returns != null) {
|
|
694
|
+
if (method.returns.type === "object") {
|
|
695
|
+
let returnObjType = `${data.routeName}_${data.methodName}_json_return_type`.toUpperCase();
|
|
696
|
+
let returnParamsToOutput = yield getChildParameters(method.returns);
|
|
697
|
+
paramsDescription += `/**
|
|
689
698
|
* The JSON object returned from the server.
|
|
690
699
|
*
|
|
691
700
|
* @typedef {Object} ${returnObjType}${returnParamsToOutput}
|
|
692
701
|
*/
|
|
693
702
|
|
|
694
703
|
`;
|
|
695
|
-
|
|
704
|
+
jsonReturnOutput = `
|
|
696
705
|
*
|
|
697
706
|
* @returns {${returnObjType}} ${method.returns.description || ""}`;
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
jsonReturnOutput = `
|
|
701
710
|
*
|
|
702
711
|
* @returns {${method.returns.type}} ${method.returns.description || ""}`;
|
|
712
|
+
}
|
|
703
713
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
uploadFileBegin = `
|
|
714
|
+
let uploadFileBegin = "";
|
|
715
|
+
let uploadFileEnd = "";
|
|
716
|
+
if (method.type === HotRouteMethod_1.HotEventMethod.FILE_UPLOAD) {
|
|
717
|
+
uploadFileBegin = `
|
|
709
718
|
let uploadHeaders = {
|
|
710
719
|
"Content-Type": "multipart/form-data"
|
|
711
720
|
};
|
|
@@ -720,11 +729,11 @@ class ${data.routeName}
|
|
|
720
729
|
}).then (() =>
|
|
721
730
|
{
|
|
722
731
|
`;
|
|
723
|
-
|
|
732
|
+
uploadFileEnd = `
|
|
724
733
|
});
|
|
725
734
|
`;
|
|
726
|
-
|
|
727
|
-
|
|
735
|
+
}
|
|
736
|
+
content = `
|
|
728
737
|
${paramsDescription}/**
|
|
729
738
|
* The ${data.methodName} method.${jsonParamOutput}${jsonReturnOutput}
|
|
730
739
|
*/
|
|
@@ -755,22 +764,22 @@ class ${data.routeName}
|
|
|
755
764
|
return (promise);
|
|
756
765
|
}
|
|
757
766
|
`;
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
767
|
+
}
|
|
768
|
+
if (contentPart === "class_footer") {
|
|
769
|
+
content = `}
|
|
761
770
|
|
|
762
771
|
`;
|
|
763
|
-
}
|
|
764
|
-
if (contentPart === "footer") {
|
|
765
|
-
let routesOutput = "";
|
|
766
|
-
if (data.collectedRoutes.length > 0)
|
|
767
|
-
routesOutput += "\n";
|
|
768
|
-
for (let iIdx = 0; iIdx < data.collectedRoutes.length; iIdx++) {
|
|
769
|
-
let collectedRoute = data.collectedRoutes[iIdx];
|
|
770
|
-
routesOutput += `
|
|
771
|
-
this.${collectedRoute.routeName} = new ${collectedRoute.routeName} (baseUrl, connection, db);`;
|
|
772
772
|
}
|
|
773
|
-
|
|
773
|
+
if (contentPart === "footer") {
|
|
774
|
+
let routesOutput = "";
|
|
775
|
+
if (data.collectedRoutes.length > 0)
|
|
776
|
+
routesOutput += "\n";
|
|
777
|
+
for (let iIdx = 0; iIdx < data.collectedRoutes.length; iIdx++) {
|
|
778
|
+
let collectedRoute = data.collectedRoutes[iIdx];
|
|
779
|
+
routesOutput += `
|
|
780
|
+
this.${collectedRoute.routeName} = new ${collectedRoute.routeName} (baseUrl, connection, db);`;
|
|
781
|
+
}
|
|
782
|
+
content = `if (typeof (${data.libraryName}.${data.apiName}) === "undefined")
|
|
774
783
|
{
|
|
775
784
|
if (typeof (HotAPIGlobal) !== "undefined")
|
|
776
785
|
{
|
|
@@ -783,8 +792,9 @@ class ${data.routeName}
|
|
|
783
792
|
}
|
|
784
793
|
}
|
|
785
794
|
}`;
|
|
786
|
-
|
|
787
|
-
|
|
795
|
+
}
|
|
796
|
+
return (content);
|
|
797
|
+
});
|
|
788
798
|
}
|
|
789
799
|
}
|
|
790
800
|
exports.HotGenerator = HotGenerator;
|