@qwebsolutions/metapsi-generator 0.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/dist/ApiEntities.d.ts +2 -0
- package/dist/ApiEntities.d.ts.map +1 -0
- package/dist/ApiEntities.js +517 -0
- package/dist/ApiEntities.js.map +1 -0
- package/dist/ApiModel.d.ts +68 -0
- package/dist/ApiModel.d.ts.map +1 -0
- package/dist/ApiModel.js +319 -0
- package/dist/ApiModel.js.map +1 -0
- package/dist/BlockBuilder.d.ts +19 -0
- package/dist/BlockBuilder.d.ts.map +1 -0
- package/dist/BlockBuilder.js +63 -0
- package/dist/BlockBuilder.js.map +1 -0
- package/dist/CSharpContracts.d.ts +167 -0
- package/dist/CSharpContracts.d.ts.map +1 -0
- package/dist/CSharpContracts.js +132 -0
- package/dist/CSharpContracts.js.map +1 -0
- package/dist/CSharpOutput.d.ts +11 -0
- package/dist/CSharpOutput.d.ts.map +1 -0
- package/dist/CSharpOutput.js +222 -0
- package/dist/CSharpOutput.js.map +1 -0
- package/dist/CSharpSystemTypes.d.ts +40 -0
- package/dist/CSharpSystemTypes.d.ts.map +1 -0
- package/dist/CSharpSystemTypes.js +28 -0
- package/dist/CSharpSystemTypes.js.map +1 -0
- package/dist/GeneratedProject.d.ts +42 -0
- package/dist/GeneratedProject.d.ts.map +1 -0
- package/dist/GeneratedProject.js +88 -0
- package/dist/GeneratedProject.js.map +1 -0
- package/dist/MethodDefinitionBuilder.d.ts +12 -0
- package/dist/MethodDefinitionBuilder.d.ts.map +1 -0
- package/dist/MethodDefinitionBuilder.js +29 -0
- package/dist/MethodDefinitionBuilder.js.map +1 -0
- package/dist/NpmPackage.d.ts +40 -0
- package/dist/NpmPackage.d.ts.map +1 -0
- package/dist/NpmPackage.js +81 -0
- package/dist/NpmPackage.js.map +1 -0
- package/dist/Playground.d.ts +2 -0
- package/dist/Playground.d.ts.map +1 -0
- package/dist/Playground.js +98 -0
- package/dist/Playground.js.map +1 -0
- package/dist/PropertyDefinitionBuilder.d.ts +10 -0
- package/dist/PropertyDefinitionBuilder.d.ts.map +1 -0
- package/dist/PropertyDefinitionBuilder.js +13 -0
- package/dist/PropertyDefinitionBuilder.js.map +1 -0
- package/dist/ToCSharp.d.ts +11 -0
- package/dist/ToCSharp.d.ts.map +1 -0
- package/dist/ToCSharp.js +117 -0
- package/dist/ToCSharp.js.map +1 -0
- package/dist/ToCSharpApiFileContent.d.ts +4 -0
- package/dist/ToCSharpApiFileContent.d.ts.map +1 -0
- package/dist/ToCSharpApiFileContent.js +15 -0
- package/dist/ToCSharpApiFileContent.js.map +1 -0
- package/dist/ToWebComponentFileContent.d.ts +7 -0
- package/dist/ToWebComponentFileContent.d.ts.map +1 -0
- package/dist/ToWebComponentFileContent.js +383 -0
- package/dist/ToWebComponentFileContent.js.map +1 -0
- package/dist/TypeDefinitionBuilder.d.ts +14 -0
- package/dist/TypeDefinitionBuilder.d.ts.map +1 -0
- package/dist/TypeDefinitionBuilder.js +26 -0
- package/dist/TypeDefinitionBuilder.js.map +1 -0
- package/dist/TypeScriptApi.d.ts +104 -0
- package/dist/TypeScriptApi.d.ts.map +1 -0
- package/dist/TypeScriptApi.js +70 -0
- package/dist/TypeScriptApi.js.map +1 -0
- package/dist/Types.d.ts +327 -0
- package/dist/Types.d.ts.map +1 -0
- package/dist/Types.js +460 -0
- package/dist/Types.js.map +1 -0
- package/dist/WebComponentModel.d.ts +158 -0
- package/dist/WebComponentModel.d.ts.map +1 -0
- package/dist/WebComponentModel.js +367 -0
- package/dist/WebComponentModel.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +18 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +22 -0
- package/dist/internal.js.map +1 -0
- package/dist/tsProject.d.ts +65 -0
- package/dist/tsProject.d.ts.map +1 -0
- package/dist/tsProject.js +542 -0
- package/dist/tsProject.js.map +1 -0
- package/dist/tsTypeLoader.d.ts +12 -0
- package/dist/tsTypeLoader.d.ts.map +1 -0
- package/dist/tsTypeLoader.js +354 -0
- package/dist/tsTypeLoader.js.map +1 -0
- package/dist/tsTypeToCsTypes.d.ts +2 -0
- package/dist/tsTypeToCsTypes.d.ts.map +1 -0
- package/dist/tsTypeToCsTypes.js +363 -0
- package/dist/tsTypeToCsTypes.js.map +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
// import { toCSharpValidParameterName } from "./MethodDefinitionBuilder.js";
|
|
3
|
+
// export type fnSignature = {
|
|
4
|
+
// returnType: TypeReference,
|
|
5
|
+
// parameters: { paramName: string, type: TypeReference }[]
|
|
6
|
+
// }
|
|
7
|
+
// export function cartesianProduct(sets: TypeReference[][]): TypeReference[][] {
|
|
8
|
+
// return sets.reduce<TypeReference[][]>(
|
|
9
|
+
// (results, currentSet) =>
|
|
10
|
+
// results.flatMap(result => currentSet.map(element => [...result, element])),
|
|
11
|
+
// [[]]
|
|
12
|
+
// );
|
|
13
|
+
// }
|
|
14
|
+
// export function tsTypeToCsTypes(tsType: tsTypes.TypeScriptTypeReference): TypeReference[] {
|
|
15
|
+
// switch (tsType.kind) {
|
|
16
|
+
// case "boolean": return [systemBool]
|
|
17
|
+
// case "string": return [systemString]
|
|
18
|
+
// case "namedType": return [{ name: tsType.name }]
|
|
19
|
+
// case "empty": return tsType.value === "void" ? [systemVoid] : []
|
|
20
|
+
// case "union": return tsType.types.flatMap(t => tsTypeToCsTypes(t))
|
|
21
|
+
// case "function": {
|
|
22
|
+
// // same cartesian-product logic as before, but per overload/signature
|
|
23
|
+
// //...
|
|
24
|
+
// }
|
|
25
|
+
// // numberLiteral/stringLiteral etc. still throw, as before
|
|
26
|
+
// default:
|
|
27
|
+
// throw new Error(`Type conversion not supported: ${tsType.kind}`)
|
|
28
|
+
// }
|
|
29
|
+
// }
|
|
30
|
+
// export function FlattenType(tsType: tsTypes.TypeScriptTypeReference): TypeReference[] {
|
|
31
|
+
// switch (tsType.kind) {
|
|
32
|
+
// case "union":
|
|
33
|
+
// {
|
|
34
|
+
// let equivalentTypes = tsType.types.filter(x => x.kind != "empty").map(x => GetDirectCSharpTypeEquivalent(x))
|
|
35
|
+
// if (equivalentTypes.find(x => x == "no-equivalent")) throw tsType;
|
|
36
|
+
// return equivalentTypes.filter(x => x != "no-equivalent");
|
|
37
|
+
// }
|
|
38
|
+
// default:
|
|
39
|
+
// {
|
|
40
|
+
// let equivalent = GetDirectCSharpTypeEquivalent(tsType);
|
|
41
|
+
// if (equivalent == "no-equivalent")
|
|
42
|
+
// throw tsType;
|
|
43
|
+
// return [equivalent]
|
|
44
|
+
// }
|
|
45
|
+
// }
|
|
46
|
+
// }
|
|
47
|
+
// export function getAllParamCombinations(signature: tsTypes.TypeScriptFnSignature): CSharpApi.Method[] {
|
|
48
|
+
// let outMethods: CSharpApi.Method[] = [{ name: "", parameters: [], returnType: [] }]
|
|
49
|
+
// for (const parameter of signature.parameters) {
|
|
50
|
+
// let updatedOutMethods: CSharpApi.Method[] = []
|
|
51
|
+
// if (parameter.optional) {
|
|
52
|
+
// for (let prevSignature of outMethods) {
|
|
53
|
+
// let newSignature = { ...prevSignature };
|
|
54
|
+
// //newSignature.parameters = [... newSignature.parameters, { name: parameter.name, type: [csType] }]
|
|
55
|
+
// updatedOutMethods.push(newSignature)
|
|
56
|
+
// //newSignature.parameters.push({name: parameter.name, type: tsTypeToCsTypes(paramType))
|
|
57
|
+
// }
|
|
58
|
+
// }
|
|
59
|
+
// let csTypes = FlattenType(parameter.type)
|
|
60
|
+
// for (let csType of csTypes) {
|
|
61
|
+
// for (let prevSignature of outMethods) {
|
|
62
|
+
// let newSignature = { ...prevSignature };
|
|
63
|
+
// newSignature.parameters = [...newSignature.parameters, { name: parameter.name, type: csType }]
|
|
64
|
+
// updatedOutMethods.push(newSignature)
|
|
65
|
+
// //newSignature.parameters.push({name: parameter.name, type: tsTypeToCsTypes(paramType))
|
|
66
|
+
// }
|
|
67
|
+
// //console.log(parameter.name + " " + paramType.kind)
|
|
68
|
+
// }
|
|
69
|
+
// outMethods = [...updatedOutMethods];
|
|
70
|
+
// console.log("outMethods")
|
|
71
|
+
// console.log(JSON.stringify(outMethods))
|
|
72
|
+
// }
|
|
73
|
+
// return outMethods;
|
|
74
|
+
// }
|
|
75
|
+
// export function ToCSharp(
|
|
76
|
+
// entity: ApiEntityDefinition,
|
|
77
|
+
// // overrides?: {
|
|
78
|
+
// // addExplicitProperty?: (mainClass: csgen.TypeDefinition, property: csgen.TypeScriptProperty) => "skip-default" | "add-default";
|
|
79
|
+
// // addExplicitMethod?: (mainClass: csgen.TypeDefinition, extensionClass: csgen.TypeDefinition, method: csgen.TypeScriptMethod) => "skip-default" | "add-default";
|
|
80
|
+
// // convertMethodParameter?: (methodName: string, parameterName: string, parameterType: csgen.TypeScriptTypeReference) => csgen.TypeReference | "no-conversion";
|
|
81
|
+
// // convertPropertyType?: (propertyName: string, propertyType: csgen.TypeScriptTypeReference) => csgen.TypeReference | "use-default";
|
|
82
|
+
// // }
|
|
83
|
+
// ): { mainClass: TypeDefinition; extensionClass: TypeDefinition; } {
|
|
84
|
+
// var mainClass: TypeDefinition = {
|
|
85
|
+
// name: entity.typeName,
|
|
86
|
+
// keyword: "interface",
|
|
87
|
+
// isStatic: false,
|
|
88
|
+
// isPartial: true,
|
|
89
|
+
// body: []
|
|
90
|
+
// };
|
|
91
|
+
// /*
|
|
92
|
+
// if (!overrides) {
|
|
93
|
+
// overrides = {};
|
|
94
|
+
// }
|
|
95
|
+
// if (!overrides.addExplicitProperty) {
|
|
96
|
+
// overrides.addExplicitProperty = () => "add-default";
|
|
97
|
+
// }
|
|
98
|
+
// if (!overrides.addExplicitMethod) {
|
|
99
|
+
// overrides.addExplicitMethod = () => "add-default";
|
|
100
|
+
// }
|
|
101
|
+
// if (!overrides.convertMethodParameter) {
|
|
102
|
+
// overrides.convertMethodParameter = (method, parameter, type) => "no-conversion";
|
|
103
|
+
// }
|
|
104
|
+
// if (!overrides.convertPropertyType) {
|
|
105
|
+
// overrides.convertPropertyType = () => "use-default";
|
|
106
|
+
// }
|
|
107
|
+
// */
|
|
108
|
+
// var mainClass: TypeDefinition = {
|
|
109
|
+
// name: entity.typeName,
|
|
110
|
+
// keyword: "interface",
|
|
111
|
+
// isStatic: false,
|
|
112
|
+
// isPartial: true,
|
|
113
|
+
// body: []
|
|
114
|
+
// };
|
|
115
|
+
// for (const sourceProperty of entity.properties) {
|
|
116
|
+
// if (sourceProperty.comment) {
|
|
117
|
+
// const propComment: SyntaxNode = {
|
|
118
|
+
// nodeType: NodeType.Comment,
|
|
119
|
+
// comment: { lines: ["<summary>", ...splitMultiline(sourceProperty.comment), "</summary>"] }
|
|
120
|
+
// };
|
|
121
|
+
// mainClass.body.push(propComment);
|
|
122
|
+
// }
|
|
123
|
+
// var csProperty: SyntaxNode = {
|
|
124
|
+
// nodeType: NodeType.PropertyDefinition,
|
|
125
|
+
// prop: {
|
|
126
|
+
// name: sourceProperty.name,
|
|
127
|
+
// type: sourceProperty.type,
|
|
128
|
+
// visibility: "public"
|
|
129
|
+
// }
|
|
130
|
+
// };
|
|
131
|
+
// mainClass.body.push(csProperty);
|
|
132
|
+
// }
|
|
133
|
+
// var extensionClassName = entity.typeName + "Extensions";
|
|
134
|
+
// var extensionClass = defineType(extensionClassName,
|
|
135
|
+
// b => {
|
|
136
|
+
// b.typeDefinition.isStatic = true;
|
|
137
|
+
// b.typeDefinition.isPartial = true;
|
|
138
|
+
// for (const staticProperty of entity.staticProperties) {
|
|
139
|
+
// if (staticProperty.comment) {
|
|
140
|
+
// const commentNode: SyntaxNode = {
|
|
141
|
+
// nodeType: NodeType.Comment,
|
|
142
|
+
// comment: { lines: ["<summary>", ...splitMultiline(staticProperty.comment), "</summary>"] }
|
|
143
|
+
// };
|
|
144
|
+
// b.typeDefinition.body.push(commentNode);
|
|
145
|
+
// }
|
|
146
|
+
// b.addMethod(
|
|
147
|
+
// staticProperty.name,
|
|
148
|
+
// { ...sysTypes.varType, typeArguments: [staticProperty.type] },
|
|
149
|
+
// b => {
|
|
150
|
+
// b.method.isStatic = true;
|
|
151
|
+
// b.addParameter("b", objBuilderType(
|
|
152
|
+
// {
|
|
153
|
+
// name: "ClassDef",
|
|
154
|
+
// typeArguments: [
|
|
155
|
+
// { name: entity.typeName }]
|
|
156
|
+
// }), true)
|
|
157
|
+
// b.setBody(
|
|
158
|
+
// b => {
|
|
159
|
+
// b.return(b => b.call("b", "Get", [
|
|
160
|
+
// b => b.stringLiteral(staticProperty.name)
|
|
161
|
+
// ]));
|
|
162
|
+
// });
|
|
163
|
+
// }
|
|
164
|
+
// )
|
|
165
|
+
// }
|
|
166
|
+
// for (const method of entity.methods) {
|
|
167
|
+
// b.addMethod(
|
|
168
|
+
// method.name,
|
|
169
|
+
// { ...sysTypes.varType, typeArguments: [method.signature.returnType] },
|
|
170
|
+
// b => {
|
|
171
|
+
// b.addParameter("b", objBuilderType({ name: entity.typeName }), true);
|
|
172
|
+
// let parameters: Parameter[] = method.signature.parameters.map(x => {
|
|
173
|
+
// return {
|
|
174
|
+
// name: x.name,
|
|
175
|
+
// type: { ...sysTypes.varType, typeArguments: [x.type] }
|
|
176
|
+
// };
|
|
177
|
+
// })
|
|
178
|
+
// b.method.parameters?.push(...parameters);
|
|
179
|
+
// b.setBody(
|
|
180
|
+
// b => {
|
|
181
|
+
// b.return(b => b.call("b", "Call", [
|
|
182
|
+
// b => b.stringLiteral(method.name),
|
|
183
|
+
// ...parameters.map(p => {
|
|
184
|
+
// let paramBuilder: (nb: NodeBuilder) => SyntaxNode;
|
|
185
|
+
// paramBuilder = (nb => nb.identifier(p.name));
|
|
186
|
+
// return paramBuilder;
|
|
187
|
+
// })
|
|
188
|
+
// ]));
|
|
189
|
+
// });
|
|
190
|
+
// });
|
|
191
|
+
// }
|
|
192
|
+
// if (entity.staticMethods) {
|
|
193
|
+
// for (const method of entity.staticMethods) {
|
|
194
|
+
// if (method.comment) {
|
|
195
|
+
// const methodComment: SyntaxNode = {
|
|
196
|
+
// nodeType: NodeType.Comment,
|
|
197
|
+
// comment: { lines: ["<summary>", ...splitMultiline(method.comment), "</summary>"] }
|
|
198
|
+
// };
|
|
199
|
+
// for (const parameter of method.signature.parameters) {
|
|
200
|
+
// if (parameter.comment) {
|
|
201
|
+
// var lines = splitMultiline(parameter.comment);
|
|
202
|
+
// lines[0] = `<param name="${toCSharpValidParameterName(parameter.name)}"> ${lines[0]}`
|
|
203
|
+
// if (lines.length > 1) {
|
|
204
|
+
// for (let paragraphIndex = 1; paragraphIndex < lines.length; paragraphIndex++) {
|
|
205
|
+
// lines[paragraphIndex] = `<para>${lines[paragraphIndex]}</para>`
|
|
206
|
+
// //console.log(paragraphIndex);
|
|
207
|
+
// }
|
|
208
|
+
// }
|
|
209
|
+
// lines[lines.length - 1] = `${lines[lines.length - 1]}</param>`
|
|
210
|
+
// methodComment.comment.lines.push(...lines);
|
|
211
|
+
// //methodComment.comment.lines.push(`<param name="${csgen.toCSharpValidParameterName(parameter.name)}">${ parameter.comment}</param>`)
|
|
212
|
+
// }
|
|
213
|
+
// }
|
|
214
|
+
// if (method.signature.returnsComment) {
|
|
215
|
+
// var returnCommentLines = splitMultiline(method.signature.returnsComment);
|
|
216
|
+
// returnCommentLines[0] = `<returns>${returnCommentLines[0]}`
|
|
217
|
+
// returnCommentLines[returnCommentLines.length - 1] = `${returnCommentLines[returnCommentLines.length - 1]}</returns>`
|
|
218
|
+
// methodComment.comment.lines.push(...returnCommentLines);
|
|
219
|
+
// }
|
|
220
|
+
// b.typeDefinition.body.push(methodComment);
|
|
221
|
+
// }
|
|
222
|
+
// b.addMethod(
|
|
223
|
+
// method.name,
|
|
224
|
+
// { ...sysTypes.varType, typeArguments: [method.signature.returnType] },
|
|
225
|
+
// b => {
|
|
226
|
+
// b.addParameter("b", objBuilderType(
|
|
227
|
+
// {
|
|
228
|
+
// name: "ClassDef",
|
|
229
|
+
// typeArguments: [
|
|
230
|
+
// { name: entity.typeName }]
|
|
231
|
+
// }), true)
|
|
232
|
+
// let parameters: Parameter[] = method.signature.parameters.map(x => {
|
|
233
|
+
// return {
|
|
234
|
+
// name: toCSharpValidParameterName(x.name),
|
|
235
|
+
// type: { ...sysTypes.varType, typeArguments: [x.type] },
|
|
236
|
+
// isParams: x.rest
|
|
237
|
+
// };
|
|
238
|
+
// });
|
|
239
|
+
// b.method.parameters?.push(...parameters);
|
|
240
|
+
// b.method.isStatic = true;
|
|
241
|
+
// b.setBody(
|
|
242
|
+
// b => {
|
|
243
|
+
// b.return(b => b.call("b", "Call", [
|
|
244
|
+
// b => b.stringLiteral(method.name),
|
|
245
|
+
// ...parameters.map(p => {
|
|
246
|
+
// let paramBuilder: (nb: NodeBuilder) => SyntaxNode;
|
|
247
|
+
// paramBuilder = (nb => nb.identifier(p.name));
|
|
248
|
+
// return paramBuilder;
|
|
249
|
+
// })
|
|
250
|
+
// ]));
|
|
251
|
+
// });
|
|
252
|
+
// });
|
|
253
|
+
// }
|
|
254
|
+
// }
|
|
255
|
+
// for (const constructor of entity.constructors) {
|
|
256
|
+
// const variants = getAllParamCombinations(constructor);
|
|
257
|
+
// for (let constructorVariant of variants) {
|
|
258
|
+
// b.addMethod(
|
|
259
|
+
// "New",
|
|
260
|
+
// { ...sysTypes.varType, typeArguments: [mainClass] },
|
|
261
|
+
// b => {
|
|
262
|
+
// b.method.isStatic = true;
|
|
263
|
+
// b.addParameter("b", objBuilderType(
|
|
264
|
+
// {
|
|
265
|
+
// name: "ClassDef",
|
|
266
|
+
// typeArguments: [{ name: mainClass.name }]
|
|
267
|
+
// }), true);
|
|
268
|
+
// let parameters: Parameter[] = constructorVariant.parameters.map(x => ({
|
|
269
|
+
// name: x.name,
|
|
270
|
+
// type: { ...sysTypes.varType, typeArguments: [x.type] }
|
|
271
|
+
// }));
|
|
272
|
+
// b.method.parameters?.push(...parameters);
|
|
273
|
+
// b.setBody(
|
|
274
|
+
// b => {
|
|
275
|
+
// b.return(
|
|
276
|
+
// b => b.call("b", "New-ToBeImplementedOnObjBuilder", [
|
|
277
|
+
// ...parameters.map(p => {
|
|
278
|
+
// let paramBuilder: (nb: NodeBuilder) => SyntaxNode;
|
|
279
|
+
// paramBuilder = (nb => nb.identifier(p.name));
|
|
280
|
+
// return paramBuilder;
|
|
281
|
+
// })
|
|
282
|
+
// ]));
|
|
283
|
+
// });
|
|
284
|
+
// });
|
|
285
|
+
// }
|
|
286
|
+
// }
|
|
287
|
+
// });
|
|
288
|
+
// return { mainClass, extensionClass: extensionClass.definition };
|
|
289
|
+
// }
|
|
290
|
+
// export function tsTypeToCsTypes(tsType: TypeScriptApi.TypeScriptType): TypeReference[] {
|
|
291
|
+
// var outTypes: TypeReference[] = []
|
|
292
|
+
// for (var tsSubtype of tsType) {
|
|
293
|
+
// switch (tsSubtype.kind) {
|
|
294
|
+
// case "numberLiteral": {
|
|
295
|
+
// throw new Error("Literal cannot be directly converted to C# type.")
|
|
296
|
+
// }
|
|
297
|
+
// break;
|
|
298
|
+
// case "stringLiteral": {
|
|
299
|
+
// throw new Error("Literal cannot be directly converted to C# type.")
|
|
300
|
+
// }
|
|
301
|
+
// break;
|
|
302
|
+
// case "boolean": {
|
|
303
|
+
// outTypes.push(systemBool)
|
|
304
|
+
// }
|
|
305
|
+
// break;
|
|
306
|
+
// case "string": {
|
|
307
|
+
// outTypes.push(systemString)
|
|
308
|
+
// }
|
|
309
|
+
// break;
|
|
310
|
+
// case "namedType": {
|
|
311
|
+
// outTypes.push({ name: tsSubtype.name })
|
|
312
|
+
// }
|
|
313
|
+
// break;
|
|
314
|
+
// case "void": {
|
|
315
|
+
// outTypes.push(systemVoid)
|
|
316
|
+
// }
|
|
317
|
+
// break;
|
|
318
|
+
// case "function": {
|
|
319
|
+
// // Function signature can result in multiple types because each single parameter and return type can be union
|
|
320
|
+
// var outSignatures: fnSignature[] = []
|
|
321
|
+
// var returnTypes = tsTypeToCsTypes(tsSubtype.returnType);
|
|
322
|
+
// //outSignatures = returnTypes.map(x => ({ returnType: x, parameters: [] }))
|
|
323
|
+
// var parameters = tsSubtype.parameters;
|
|
324
|
+
// var eachParamTypes: TypeReference[][] = []
|
|
325
|
+
// for (var parameter of tsSubtype.parameters) {
|
|
326
|
+
// if (parameter.type.every(x => x.kind == "stringLiteral")) {
|
|
327
|
+
// eachParamTypes.push([systemString])
|
|
328
|
+
// }
|
|
329
|
+
// else {
|
|
330
|
+
// var paramTypes = tsTypeToCsTypes(parameter.type);
|
|
331
|
+
// eachParamTypes.push(paramTypes)
|
|
332
|
+
// }
|
|
333
|
+
// }
|
|
334
|
+
// var cartesianTypes = cartesianProduct(eachParamTypes);
|
|
335
|
+
// console.log(JSON.stringify(cartesianTypes));
|
|
336
|
+
// for (var returnType of returnTypes) {
|
|
337
|
+
// for (var cartesianType of cartesianTypes) {
|
|
338
|
+
// outSignatures.push({
|
|
339
|
+
// returnType,
|
|
340
|
+
// parameters: cartesianType.map(
|
|
341
|
+
// (type, index) => ({ paramName: parameters.at(index)!.name, type }))
|
|
342
|
+
// })
|
|
343
|
+
// }
|
|
344
|
+
// }
|
|
345
|
+
// for (var outSignature of outSignatures) {
|
|
346
|
+
// if (outSignature.returnType.name == systemVoid.name) {
|
|
347
|
+
// var csAction = { ...systemAction, typeArguments: outSignature.parameters.map(x => x.type) }
|
|
348
|
+
// outTypes.push(csAction)
|
|
349
|
+
// }
|
|
350
|
+
// else {
|
|
351
|
+
// var csFunc = { ...systemFunc, typeArguments: [...outSignature.parameters.map(x => x.type), outSignature.returnType] }
|
|
352
|
+
// outTypes.push(csFunc)
|
|
353
|
+
// }
|
|
354
|
+
// }
|
|
355
|
+
// console.log(JSON.stringify(outSignatures));
|
|
356
|
+
// }
|
|
357
|
+
// break;
|
|
358
|
+
// throw new Error("Type conversion not supported")
|
|
359
|
+
// }
|
|
360
|
+
// }
|
|
361
|
+
// return outTypes;
|
|
362
|
+
// }
|
|
363
|
+
//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AwB;AACxB,6BAA6B;AAC7B,4EAA4E;AAC5E,0DAA0D;AAC1D,wBAAwB;AACxB,oBAAoB;AAEpB,yEAAyE;AACzE,+DAA+D;AAE/D,wDAAwD;AACxD,kEAAkE;AAClE,+CAA+C;AAC/C,0CAA0C;AAC1C,6DAA6D;AAC7D,sGAAsG;AACtG,6BAA6B;AAC7B,wBAAwB;AACxB,oBAAoB;AAEpB,4DAA4D;AAC5D,6EAA6E;AAC7E,sHAAsH;AACtH,kDAAkD;AAClD,wBAAwB;AACxB,6BAA6B;AAC7B,gJAAgJ;AAChJ,gDAAgD;AAChD,wBAAwB;AACxB,oBAAoB;AAEpB,8DAA8D;AAC9D,gBAAgB;AAChB,yBAAyB;AACzB,mEAAmE;AACnE,YAAY;AACZ,QAAQ;AAER,uBAAuB;AACvB,IAAI"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@qwebsolutions/metapsi-generator",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Generates strongly-typed C# builder APIs from TypeScript type declarations and web-component manifests.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc --build",
|
|
24
|
+
"clean": "tsc --build --clean",
|
|
25
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"typescript": ">=5.0.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^24.13.3",
|
|
32
|
+
"typescript": "^5.9.3"
|
|
33
|
+
}
|
|
34
|
+
}
|