restfuncs-transformer 0.9.8 → 1.1.0
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/AddRemoteMethodsMeta.d.ts +85 -0
- package/AddRemoteMethodsMeta.d.ts.map +1 -0
- package/AddRemoteMethodsMeta.js +348 -0
- package/AddRemoteMethodsMeta.js.map +1 -0
- package/AddRemoteMethodsMeta.ts +481 -0
- package/devPlayground.d.ts +3 -0
- package/devPlayground.d.ts.map +1 -0
- package/devPlayground.js +3 -0
- package/devPlayground.js.map +1 -0
- package/devPlayground.ts +5 -0
- package/index.d.ts +7 -2
- package/index.d.ts.map +1 -1
- package/index.js +93 -28
- package/index.js.map +1 -1
- package/index.ts +105 -4
- package/package.json +14 -6
- package/readme.md +70 -3
- package/transformerUtil.d.ts +60 -0
- package/transformerUtil.d.ts.map +1 -0
- package/transformerUtil.js +126 -0
- package/transformerUtil.js.map +1 -0
- package/transformerUtil.test.d.ts +2 -0
- package/transformerUtil.test.d.ts.map +1 -0
- package/transformerUtil.test.js +11 -0
- package/transformerUtil.test.js.map +1 -0
- package/transformerUtil.test.ts +12 -0
- package/transformerUtil.ts +127 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import ts, { MethodDeclaration, Node } from 'typescript';
|
|
2
|
+
import { FileTransformRun, TextPatch } from "./transformerUtil";
|
|
3
|
+
/**
|
|
4
|
+
* Transformer that adds the following statement to the method body (like in readme.md#how-it-works)
|
|
5
|
+
* <code><pre>
|
|
6
|
+
* static getRemoteMethodsMeta() {
|
|
7
|
+
* ....
|
|
8
|
+
* }
|
|
9
|
+
* </pre></code>
|
|
10
|
+
*/
|
|
11
|
+
export declare class AddRemoteMethodsMeta extends FileTransformRun {
|
|
12
|
+
/**
|
|
13
|
+
* Should this transformer squeeze the added declarations (result) into one line to keep the line numbers in the source text intact ?
|
|
14
|
+
* Prevents the [broken source maps bug](https://github.com/bogeeee/restfuncs/issues/2)
|
|
15
|
+
*/
|
|
16
|
+
static squeezeDeclarationsIntoOneLine: boolean;
|
|
17
|
+
diagnosis_currentClass_instanceMethodsSeen?: Set<string>;
|
|
18
|
+
currentClass_instanceMethodsMeta?: Record<string, string>;
|
|
19
|
+
result: TextPatch;
|
|
20
|
+
visit(node: Node): Node;
|
|
21
|
+
/**
|
|
22
|
+
* Crates the following expression like in readme.md#how-it-works
|
|
23
|
+
* <code><pre>
|
|
24
|
+
* {
|
|
25
|
+
* arguments: {
|
|
26
|
+
* ...
|
|
27
|
+
* }
|
|
28
|
+
* result: {
|
|
29
|
+
* ...
|
|
30
|
+
* }
|
|
31
|
+
* callbacks:[...]
|
|
32
|
+
* jsDoc: {
|
|
33
|
+
* ...
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
* </pre></code>
|
|
37
|
+
*
|
|
38
|
+
* @param methodName
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
41
|
+
createMethodMetaExpression(node: MethodDeclaration, methodName: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Crates the following expression like in readme.md#how-it-works
|
|
44
|
+
* <code><pre>
|
|
45
|
+
* {
|
|
46
|
+
* comment: "...",
|
|
47
|
+
* params: {...},
|
|
48
|
+
* ...
|
|
49
|
+
* }
|
|
50
|
+
* </pre></code>
|
|
51
|
+
*
|
|
52
|
+
* or
|
|
53
|
+
*
|
|
54
|
+
* <code><pre>
|
|
55
|
+
* undefined
|
|
56
|
+
* </pre></code>
|
|
57
|
+
*
|
|
58
|
+
*
|
|
59
|
+
* @param methodName
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
private createJsDocExpression;
|
|
63
|
+
/**
|
|
64
|
+
* Crates the following expression like in readme.md#how-it-works
|
|
65
|
+
* <code><pre>
|
|
66
|
+
* static getRemoteMethodsMeta(...) :... {
|
|
67
|
+
* ....
|
|
68
|
+
* }
|
|
69
|
+
* </pre></code>
|
|
70
|
+
*
|
|
71
|
+
* @param methodName
|
|
72
|
+
* @private
|
|
73
|
+
*/
|
|
74
|
+
private create_static_getRemoteMethodsMeta_expression;
|
|
75
|
+
nodeToString(node: Node, removeComments?: boolean, removeLineBreaks?: boolean): string;
|
|
76
|
+
/**
|
|
77
|
+
* Creates a node, that declares a SourceNodeDiagnosis (defined in ServerSession.ts) object.
|
|
78
|
+
*
|
|
79
|
+
* To output the info at runtime: i.e. "MyServerSessionClass.ts:23:30, reading: async myRemoteMethod(param1:...): Promise<void> {}
|
|
80
|
+
* @param node
|
|
81
|
+
*/
|
|
82
|
+
createSourceNodeDiagnosisExpression(node: Node): ts.ObjectLiteralExpression;
|
|
83
|
+
diag_sourceLocation(node: Node): string;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=AddRemoteMethodsMeta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddRemoteMethodsMeta.d.ts","sourceRoot":"","sources":["AddRemoteMethodsMeta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAGP,iBAAiB,EACjB,IAAI,EAIP,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,gBAAgB,EAAE,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAK9D;;;;;;;GAOG;AACH,qBAAa,oBAAqB,SAAQ,gBAAgB;IACtD;;;OAGG;IACH,MAAM,CAAC,8BAA8B,UAAQ;IAC7C,0CAA0C,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzD,gCAAgC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1D,MAAM,YAAmB;IAGzB,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAiEvB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,0BAA0B,CAAC,IAAI,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;IAsL/E;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CAAC,qBAAqB;IA+E7B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,6CAA6C;IAgBrD,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,cAAc,UAAO,EAAE,gBAAgB,UAAQ,GAAG,MAAM;IASjF;;;;;OAKG;IACH,mCAAmC,CAAC,IAAI,EAAE,IAAI;IAmC9C,mBAAmB,CAAC,IAAI,EAAE,IAAI;CAIjC"}
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.AddRemoteMethodsMeta = void 0;
|
|
27
|
+
const typescript_1 = __importStar(require("typescript"));
|
|
28
|
+
const transformerUtil_1 = require("./transformerUtil");
|
|
29
|
+
const index_1 = require("./index");
|
|
30
|
+
const restfuncs_common_1 = require("restfuncs-common");
|
|
31
|
+
/**
|
|
32
|
+
* Transformer that adds the following statement to the method body (like in readme.md#how-it-works)
|
|
33
|
+
* <code><pre>
|
|
34
|
+
* static getRemoteMethodsMeta() {
|
|
35
|
+
* ....
|
|
36
|
+
* }
|
|
37
|
+
* </pre></code>
|
|
38
|
+
*/
|
|
39
|
+
class AddRemoteMethodsMeta extends transformerUtil_1.FileTransformRun {
|
|
40
|
+
constructor() {
|
|
41
|
+
super(...arguments);
|
|
42
|
+
this.result = new transformerUtil_1.TextPatch();
|
|
43
|
+
}
|
|
44
|
+
/* Visitor Function */
|
|
45
|
+
visit(node) {
|
|
46
|
+
var _a;
|
|
47
|
+
if (node.kind === typescript_1.SyntaxKind.MethodDeclaration) { // @remote ?
|
|
48
|
+
const methodDeclaration = node;
|
|
49
|
+
if (this.getChilds(methodDeclaration).some(n => n.kind == typescript_1.SyntaxKind.StaticKeyword)) { // static ?
|
|
50
|
+
return node; // no special handling
|
|
51
|
+
}
|
|
52
|
+
if (this.getParent().kind !== typescript_1.SyntaxKind.ClassDeclaration) { // Method not under a class (i.e. an anonymous object ?}
|
|
53
|
+
return node; // no special handling
|
|
54
|
+
}
|
|
55
|
+
const methodName = methodDeclaration.name.escapedText;
|
|
56
|
+
try {
|
|
57
|
+
let remoteDecorator = this.getChilds(methodDeclaration).find(d => d.kind === typescript_1.SyntaxKind.Decorator);
|
|
58
|
+
if (!remoteDecorator) { // no @remote found ?
|
|
59
|
+
return node; // no special handling
|
|
60
|
+
}
|
|
61
|
+
// Diagnosis: Check for overloads:
|
|
62
|
+
if ((_a = this.diagnosis_currentClass_instanceMethodsSeen) === null || _a === void 0 ? void 0 : _a.has(methodName)) { // Seen twice ?
|
|
63
|
+
throw new Error(`@remote methods cannot have multiple/overloaded signatures: ${methodName}. Location: ${this.diag_sourceLocation(node)}`); // TODO: add diagnosis
|
|
64
|
+
}
|
|
65
|
+
this.currentClass_instanceMethodsMeta[methodName] = this.createMethodMetaExpression(methodDeclaration, methodName); // create the code:
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
this.diagnosis_currentClass_instanceMethodsSeen.add(methodName);
|
|
69
|
+
}
|
|
70
|
+
return node;
|
|
71
|
+
}
|
|
72
|
+
else if (node.kind === typescript_1.SyntaxKind.ClassDeclaration) {
|
|
73
|
+
this.diagnosis_currentClass_instanceMethodsSeen = new Set();
|
|
74
|
+
this.currentClass_instanceMethodsMeta = {};
|
|
75
|
+
try {
|
|
76
|
+
let result = this.visitChilds(node);
|
|
77
|
+
if (Object.keys(this.currentClass_instanceMethodsMeta).length > 0) { // Current class has @remote methods ?
|
|
78
|
+
if (this.result.patches.length === 0) { // First patch
|
|
79
|
+
this.result.patches.push({ position: 0, contentToInsert: '/* inserted by restfuncs-transformer:*/import _rf_typia from "typia";' }); // add the type import, which is needed by the following
|
|
80
|
+
}
|
|
81
|
+
// *** Create the "getRemoteMethodsMeta()" function and add a patch for the source file to the result: ***
|
|
82
|
+
let methodDeclarationSourceText = this.create_static_getRemoteMethodsMeta_expression();
|
|
83
|
+
if (AddRemoteMethodsMeta.squeezeDeclarationsIntoOneLine) {
|
|
84
|
+
methodDeclarationSourceText = '/* code squeezed into one line to keep line numbers intact. You can output it prettier by setting "pretty":true in the plugin configuration in tsconfig.json */' + methodDeclarationSourceText.replaceAll("\n", "");
|
|
85
|
+
}
|
|
86
|
+
methodDeclarationSourceText = ";" + methodDeclarationSourceText; // prepend with semicolon to prevent syntax error if there's stuff in the same line of the closing bracket
|
|
87
|
+
this.result.patches.push({ position: node.end - 1 /* insert before the closing bracket*/, contentToInsert: methodDeclarationSourceText }); // Add patch to result
|
|
88
|
+
}
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
this.currentClass_instanceMethodsMeta = undefined;
|
|
93
|
+
this.diagnosis_currentClass_instanceMethodsSeen = undefined;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
return this.visitChilds(node);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Crates the following expression like in readme.md#how-it-works
|
|
102
|
+
* <code><pre>
|
|
103
|
+
* {
|
|
104
|
+
* arguments: {
|
|
105
|
+
* ...
|
|
106
|
+
* }
|
|
107
|
+
* result: {
|
|
108
|
+
* ...
|
|
109
|
+
* }
|
|
110
|
+
* callbacks:[...]
|
|
111
|
+
* jsDoc: {
|
|
112
|
+
* ...
|
|
113
|
+
* }
|
|
114
|
+
* }
|
|
115
|
+
* </pre></code>
|
|
116
|
+
*
|
|
117
|
+
* @param methodName
|
|
118
|
+
* @private
|
|
119
|
+
*/
|
|
120
|
+
createMethodMetaExpression(node, methodName) {
|
|
121
|
+
// Note: These `factory.create...` "pyramids of doom", which you see all along in this method's code, were mostly created by copying the example code from readme.md#how-it-works through the [AST viewer tool](https://ts-ast-viewer.com/)
|
|
122
|
+
// TODO: remove them und use plain strings
|
|
123
|
+
const factory = this.context.factory;
|
|
124
|
+
const arguments_typiaFuncs = {
|
|
125
|
+
"validateEquals": "_rf_typia.validateEquals",
|
|
126
|
+
"validatePrune": "_rf_typia.misc.validatePrune"
|
|
127
|
+
};
|
|
128
|
+
const result_typiaFuncs = Object.assign({}, arguments_typiaFuncs);
|
|
129
|
+
const old_typiaFuncs = {
|
|
130
|
+
/**
|
|
131
|
+
* typia.validateEquals
|
|
132
|
+
*/
|
|
133
|
+
validateEquals: factory.createPropertyAccessExpression(factory.createIdentifier("_rf_typia"), factory.createIdentifier("validateEquals")),
|
|
134
|
+
"validatePrune": factory.createPropertyAccessExpression(factory.createPropertyAccessExpression(factory.createIdentifier("_rf_typia"), factory.createIdentifier("misc")), factory.createIdentifier("validatePrune"))
|
|
135
|
+
};
|
|
136
|
+
// Clone parameters and convert all ParameterDeclarations to NamedTupleMembers (They look the same in the .ts code but are of a different SyntaxKind).
|
|
137
|
+
const methodParametersWithPlaceholders = structuredClone(node.parameters).map(paramDecl => {
|
|
138
|
+
return factory.createNamedTupleMember(paramDecl.dotDotDotToken, paramDecl.name, paramDecl.questionToken, paramDecl.type || factory.createKeywordTypeNode(typescript_1.default.SyntaxKind.UnknownKeyword));
|
|
139
|
+
});
|
|
140
|
+
// ** Callbacks: **
|
|
141
|
+
// Replace the (arrow-) function declarations inside methodParametersWithPlaceholders with "_callback" placeholders and create the callbackDeclarations array which contains the
|
|
142
|
+
// declarations like in readme.md saying "[{ // here for the `someCallbackFn: (p:number) => Promise<string>` declaration ...}]"
|
|
143
|
+
let callbackDeclarations = [];
|
|
144
|
+
(0, restfuncs_common_1.visitReplace)(methodParametersWithPlaceholders, (value, visitChilds, context) => {
|
|
145
|
+
if (value && value.kind === typescript_1.SyntaxKind.FunctionType) { // found an arrow-style function type declaration ?
|
|
146
|
+
const functionTypeNode = value;
|
|
147
|
+
// **** Create the callbackDeclaration like `{ // here for the `someCallbackFn: (p:number) => Promise<string>` declaration...}` in readme.md ****
|
|
148
|
+
// Create argumentsDeclaration. `{ validateEquals: ..., validatePrune: ...}` like in readme.md
|
|
149
|
+
const argumentsDeclaration = factory.createObjectLiteralExpression(Object.keys(arguments_typiaFuncs).map((typiaFnName) => // for validateEquals + validatePrune
|
|
150
|
+
factory.createPropertyAssignment(factory.createIdentifier(typiaFnName), factory.createArrowFunction(undefined, undefined, [factory.createParameterDeclaration(undefined, undefined, factory.createIdentifier("args"), undefined, factory.createKeywordTypeNode(typescript_1.default.SyntaxKind.UnknownKeyword), undefined)], undefined, factory.createToken(typescript_1.default.SyntaxKind.EqualsGreaterThanToken), factory.createCallExpression(old_typiaFuncs[typiaFnName], [factory.createTupleTypeNode(structuredClone(functionTypeNode.parameters).map(paramDecl => {
|
|
151
|
+
return factory.createNamedTupleMember(paramDecl.dotDotDotToken, paramDecl.name, paramDecl.questionToken, paramDecl.type || factory.createKeywordTypeNode(typescript_1.default.SyntaxKind.UnknownKeyword));
|
|
152
|
+
}))], [factory.createIdentifier("args")])))), true);
|
|
153
|
+
// Create awaitedResultDeclaration. `awaitedResult = ...` like in readme.md:
|
|
154
|
+
let awaitedResultDeclaration;
|
|
155
|
+
if (functionTypeNode.type.kind == typescript_1.SyntaxKind.VoidKeyword) { // Return type is (sync) void ?
|
|
156
|
+
awaitedResultDeclaration = factory.createIdentifier("undefined");
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
if (functionTypeNode.type.kind == typescript_1.SyntaxKind.TypeReference && functionTypeNode.type.typeName.escapedText == "Promise") { // Returns via Promise
|
|
160
|
+
// Validity check:
|
|
161
|
+
if (!functionTypeNode.type.typeArguments || functionTypeNode.type.typeArguments.length != 1) {
|
|
162
|
+
throw new Error(`A callback function, declared in ${methodName}'s parameters, returns a Promise with an invalid number of type arguments. Location: ${this.diag_sourceLocation(node)}`);
|
|
163
|
+
}
|
|
164
|
+
const awaitedType = functionTypeNode.type.typeArguments[0];
|
|
165
|
+
awaitedResultDeclaration = factory.createObjectLiteralExpression(Object.keys(result_typiaFuncs).map((typiaFnName) => // for validateEquals + validatePrune
|
|
166
|
+
factory.createPropertyAssignment(factory.createIdentifier(typiaFnName), factory.createArrowFunction(undefined, undefined, [factory.createParameterDeclaration(undefined, undefined, factory.createIdentifier("value"), undefined, factory.createKeywordTypeNode(typescript_1.default.SyntaxKind.UnknownKeyword), undefined)], undefined, factory.createToken(typescript_1.default.SyntaxKind.EqualsGreaterThanToken), factory.createCallExpression(old_typiaFuncs[typiaFnName], [awaitedType], [factory.createIdentifier("value")])))), true);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
throw new Error(`A callback function, declared in ${methodName}'s parameters, declares that it returns a value directly (sync) and not via Promise (this is not possible over the wire). Please use Promise<${this.nodeToString(functionTypeNode.type, true, true)}> instead. Location: ${this.diag_sourceLocation(functionTypeNode.type)}`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
// Compose result:
|
|
173
|
+
const callbackDeclaration = factory.createObjectLiteralExpression([
|
|
174
|
+
// arguments: {...}
|
|
175
|
+
factory.createPropertyAssignment(factory.createIdentifier("arguments"), argumentsDeclaration),
|
|
176
|
+
// awaitedResult: {...}
|
|
177
|
+
factory.createPropertyAssignment(factory.createIdentifier("awaitedResult"), awaitedResultDeclaration),
|
|
178
|
+
// source:
|
|
179
|
+
factory.createPropertyAssignment(factory.createIdentifier("diagnosis_source"), this.createSourceNodeDiagnosisExpression(functionTypeNode))
|
|
180
|
+
], true);
|
|
181
|
+
callbackDeclarations.push(callbackDeclaration);
|
|
182
|
+
const declarationIndex = callbackDeclarations.length - 1;
|
|
183
|
+
return factory.createExpressionWithTypeArguments(factory.createIdentifier("CallbackPlaceholder"), [factory.createLiteralTypeNode(factory.createNumericLiteral(declarationIndex))]); // replace with CallbackPlaceholder<n>
|
|
184
|
+
}
|
|
185
|
+
return visitChilds(value, context);
|
|
186
|
+
});
|
|
187
|
+
// ** Obtain, what goes into typia.validate...<...> ***
|
|
188
|
+
const hasPlaceholders = callbackDeclarations.length > 0;
|
|
189
|
+
let typeParamForTypiaValidate = `[${node.parameters.map(param => this.nodeToString(param, true, true)).join(", ")}]`; // [param1: type1, param2: type2, ...]
|
|
190
|
+
let typeParamForTypiaValidateWithPlaceholders = this.nodeToString(factory.createTupleTypeNode(methodParametersWithPlaceholders), true, true);
|
|
191
|
+
if (node.parameters.some(p => p.type === undefined)) { // Some parameters don't have an explicit type ? (i.e. the type is inherited from the base class)
|
|
192
|
+
if (hasPlaceholders) {
|
|
193
|
+
throw new Error(`Parameter '${node.parameters.find(p => p.type === undefined).name.escapedText}' does not have a (/ an explicit) type in remote method ${methodName}. In combination with declared callback functions, all parameters must have explicit types. Location: ${this.diag_sourceLocation(node)}`); // TODO: add diagnosis
|
|
194
|
+
}
|
|
195
|
+
// Use the old style: Parameters<typeof this.prototype["method name"]>. This worked very fine in old versions but we now want to battle-test the other style
|
|
196
|
+
typeParamForTypiaValidate = typeParamForTypiaValidateWithPlaceholders = `Parameters<typeof this.prototype["${methodName}"]>`;
|
|
197
|
+
}
|
|
198
|
+
// ** compose result **
|
|
199
|
+
return `{
|
|
200
|
+
arguments: {${ /* for validateEquals + validatePrune */Object.keys(arguments_typiaFuncs).map((typiaFnName) => `
|
|
201
|
+
${typiaFnName}: (args: unknown) => ${arguments_typiaFuncs[typiaFnName]}<${typeParamForTypiaValidate}>(args)`).join(",")}
|
|
202
|
+
,
|
|
203
|
+
withPlaceholders: ${hasPlaceholders ? `{${ /* for validateEquals + validatePrune */Object.keys(arguments_typiaFuncs).map((typiaFnName) => `
|
|
204
|
+
${typiaFnName}: (args: unknown, onValidateCallbackArg: (placeholderId: string, declarationIndex: number) => boolean) => ${arguments_typiaFuncs[typiaFnName]}<${typeParamForTypiaValidateWithPlaceholders}>(args)`).join(",")}
|
|
205
|
+
}` : "undefined"}
|
|
206
|
+
},
|
|
207
|
+
result: {${ /* for validateEquals + validatePrune */Object.keys(result_typiaFuncs).map((typiaFnName) => `
|
|
208
|
+
${typiaFnName}: (value: unknown) => ${result_typiaFuncs[typiaFnName]}<Awaited<ReturnType<typeof this.prototype["${methodName}"]>>>(value)`).join(",")}
|
|
209
|
+
},
|
|
210
|
+
callbacks: [${callbackDeclarations.map(cbd => `
|
|
211
|
+
${this.nodeToString(cbd, true)}`).join(",")}
|
|
212
|
+
],
|
|
213
|
+
jsDoc: ${this.nodeToString(this.createJsDocExpression(node, methodName), true)},
|
|
214
|
+
diagnosis_source: ${this.nodeToString(this.createSourceNodeDiagnosisExpression(node), true)},
|
|
215
|
+
}`;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Crates the following expression like in readme.md#how-it-works
|
|
219
|
+
* <code><pre>
|
|
220
|
+
* {
|
|
221
|
+
* comment: "...",
|
|
222
|
+
* params: {...},
|
|
223
|
+
* ...
|
|
224
|
+
* }
|
|
225
|
+
* </pre></code>
|
|
226
|
+
*
|
|
227
|
+
* or
|
|
228
|
+
*
|
|
229
|
+
* <code><pre>
|
|
230
|
+
* undefined
|
|
231
|
+
* </pre></code>
|
|
232
|
+
*
|
|
233
|
+
*
|
|
234
|
+
* @param methodName
|
|
235
|
+
* @private
|
|
236
|
+
*/
|
|
237
|
+
createJsDocExpression(node, diagnosis_methodName) {
|
|
238
|
+
var _a;
|
|
239
|
+
const factory = this.context.factory;
|
|
240
|
+
if (!node.jsDoc || node.jsDoc.length == 0) { // no jsdoc
|
|
241
|
+
return factory.createIdentifier("undefined");
|
|
242
|
+
}
|
|
243
|
+
const jsdoc = node.jsDoc[node.jsDoc.length - 1]; // use last jsDoc
|
|
244
|
+
const comment = jsdoc.comment || "";
|
|
245
|
+
if (typeof comment !== "string") {
|
|
246
|
+
throw new Error(`Expected comment to be a string. Got: ${comment}. Location: ${this.diag_sourceLocation(node)}`); // TODO add to diagnostics instead
|
|
247
|
+
}
|
|
248
|
+
// Collect params and tags
|
|
249
|
+
const params = {};
|
|
250
|
+
const tags = [];
|
|
251
|
+
(_a = jsdoc.tags) === null || _a === void 0 ? void 0 : _a.forEach(tag => {
|
|
252
|
+
var _a;
|
|
253
|
+
const name = tag.tagName.escapedText.toLowerCase();
|
|
254
|
+
const comment = tag.comment;
|
|
255
|
+
if (comment && typeof comment !== "string") {
|
|
256
|
+
throw new Error(`Expected comment to be a string. Got: ${comment}. Location: ${this.diag_sourceLocation(node)}`); // TODO add to diagnostics instead
|
|
257
|
+
}
|
|
258
|
+
if (name === "param") {
|
|
259
|
+
const paramname = (_a = tag.name) === null || _a === void 0 ? void 0 : _a.escapedText;
|
|
260
|
+
if (paramname && comment) {
|
|
261
|
+
params[paramname] = comment;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
const tagName = tag.name;
|
|
266
|
+
tags.push({ name, comment });
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
// JSDoc. Example from readme.md#how-it-works Copy&pasted through the [AST viewer tool](https://ts-ast-viewer.com/)
|
|
270
|
+
let jsDocExpression = factory.createObjectLiteralExpression([
|
|
271
|
+
factory.createPropertyAssignment(factory.createIdentifier("comment"), factory.createStringLiteral(comment)),
|
|
272
|
+
factory.createPropertyAssignment(factory.createIdentifier("params"), factory.createObjectLiteralExpression(Object.keys(params).map(paramName => factory.createPropertyAssignment(factory.createIdentifier(paramName), factory.createStringLiteral(params[paramName]))), false)),
|
|
273
|
+
factory.createPropertyAssignment(factory.createIdentifier("tags"), factory.createArrayLiteralExpression(tags.map(tag => factory.createObjectLiteralExpression([
|
|
274
|
+
factory.createPropertyAssignment(factory.createIdentifier("name"), factory.createStringLiteral(tag.name)),
|
|
275
|
+
factory.createPropertyAssignment(factory.createIdentifier("comment"), tag.comment !== undefined ? factory.createStringLiteral(tag.comment) : factory.createIdentifier("undefined"))
|
|
276
|
+
], false)), false))
|
|
277
|
+
], true);
|
|
278
|
+
return jsDocExpression;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Crates the following expression like in readme.md#how-it-works
|
|
282
|
+
* <code><pre>
|
|
283
|
+
* static getRemoteMethodsMeta(...) :... {
|
|
284
|
+
* ....
|
|
285
|
+
* }
|
|
286
|
+
* </pre></code>
|
|
287
|
+
*
|
|
288
|
+
* @param methodName
|
|
289
|
+
* @private
|
|
290
|
+
*/
|
|
291
|
+
create_static_getRemoteMethodsMeta_expression() {
|
|
292
|
+
return `` +
|
|
293
|
+
`static getRemoteMethodsMeta(): (typeof this.type_remoteMethodsMeta) {
|
|
294
|
+
this.__hello_developer__make_sure_your_class_is_a_subclass_of_ServerSession;` /* Attempt to give a friendly error message when this is not the case. Otherwise the previous line would fail and leaves the user wondering. */ + `
|
|
295
|
+
type CallbackPlaceholder<DECL_INDEX extends number> = string & _rf_typia.tags.TagBase<{kind: "callbackFn", target: "string", value: undefined, validate: \`onValidateCallbackArg($input, \${DECL_INDEX})\`}>;
|
|
296
|
+
const result= {
|
|
297
|
+
transformerVersion: {major: ${index_1.transformerVersion.major}, feature: ${index_1.transformerVersion.feature} },
|
|
298
|
+
instanceMethods: {${Object.keys(this.currentClass_instanceMethodsMeta).map(methodName => `
|
|
299
|
+
${methodName}: ${this.currentClass_instanceMethodsMeta[methodName]}`).join(",")}
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
return result; /* Code style note for this line: Why not do \`return {...}\` directly ? This tiny difference allows for extra properties which ensure backward compatibility with older "restfuncs-server" packages. */
|
|
304
|
+
}`;
|
|
305
|
+
}
|
|
306
|
+
nodeToString(node, removeComments = false, removeLineBreaks = false) {
|
|
307
|
+
const printer = typescript_1.default.createPrinter({ newLine: typescript_1.default.NewLineKind.LineFeed, removeComments });
|
|
308
|
+
let result = printer.printNode(typescript_1.default.EmitHint.Unspecified, node, this.sourceFile);
|
|
309
|
+
if (removeLineBreaks) {
|
|
310
|
+
result = result.replaceAll(/\n\s*/g, " ");
|
|
311
|
+
}
|
|
312
|
+
return result;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Creates a node, that declares a SourceNodeDiagnosis (defined in ServerSession.ts) object.
|
|
316
|
+
*
|
|
317
|
+
* To output the info at runtime: i.e. "MyServerSessionClass.ts:23:30, reading: async myRemoteMethod(param1:...): Promise<void> {}
|
|
318
|
+
* @param node
|
|
319
|
+
*/
|
|
320
|
+
createSourceNodeDiagnosisExpression(node) {
|
|
321
|
+
var _a;
|
|
322
|
+
const factory = this.context.factory;
|
|
323
|
+
if (node.body !== undefined) {
|
|
324
|
+
// Empty the body
|
|
325
|
+
node = structuredClone(node);
|
|
326
|
+
node.body = factory.createBlock([], false);
|
|
327
|
+
}
|
|
328
|
+
const lineAndChar = this.sourceFile.getLineAndCharacterOfPosition((((_a = node.getStart) === null || _a === void 0 ? void 0 : _a.call(node, this.sourceFile, false)) || node.pos));
|
|
329
|
+
return factory.createObjectLiteralExpression([
|
|
330
|
+
factory.createPropertyAssignment(factory.createIdentifier("file"), factory.createStringLiteral(this.sourceFile.fileName)),
|
|
331
|
+
factory.createPropertyAssignment(factory.createIdentifier("line"), factory.createNumericLiteral(lineAndChar.line + 1)),
|
|
332
|
+
factory.createPropertyAssignment(factory.createIdentifier("character"), factory.createNumericLiteral(lineAndChar.character + 1)),
|
|
333
|
+
factory.createPropertyAssignment(factory.createIdentifier("signatureText"), factory.createStringLiteral(this.nodeToString(node, false)))
|
|
334
|
+
], false);
|
|
335
|
+
}
|
|
336
|
+
diag_sourceLocation(node) {
|
|
337
|
+
var _a;
|
|
338
|
+
const lineAndChar = this.sourceFile.getLineAndCharacterOfPosition((((_a = node.getStart) === null || _a === void 0 ? void 0 : _a.call(node, this.sourceFile, false)) || node.pos));
|
|
339
|
+
return `${this.sourceFile.fileName}:${lineAndChar.line + 1}:${lineAndChar.character + 1}`;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
exports.AddRemoteMethodsMeta = AddRemoteMethodsMeta;
|
|
343
|
+
/**
|
|
344
|
+
* Should this transformer squeeze the added declarations (result) into one line to keep the line numbers in the source text intact ?
|
|
345
|
+
* Prevents the [broken source maps bug](https://github.com/bogeeee/restfuncs/issues/2)
|
|
346
|
+
*/
|
|
347
|
+
AddRemoteMethodsMeta.squeezeDeclarationsIntoOneLine = true;
|
|
348
|
+
//# sourceMappingURL=AddRemoteMethodsMeta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddRemoteMethodsMeta.js","sourceRoot":"","sources":["AddRemoteMethodsMeta.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAQoB;AACpB,uDAA8D;AAC9D,mCAA2C;AAC3C,uDAA8C;AAG9C;;;;;;;GAOG;AACH,MAAa,oBAAqB,SAAQ,kCAAgB;IAA1D;;QAQI,WAAM,GAAG,IAAI,2BAAS,EAAE,CAAC;IAkc7B,CAAC;IAhcG,sBAAsB;IACtB,KAAK,CAAC,IAAU;;QACZ,IAAI,IAAI,CAAC,IAAI,KAAK,uBAAU,CAAC,iBAAiB,EAAE,EAAE,YAAY;YAC1D,MAAM,iBAAiB,GAAI,IAA0B,CAA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