@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 @@
|
|
|
1
|
+
{"version":3,"file":"ApiEntities.d.ts","sourceRoot":"../src/","sources":["ApiEntities.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
// export type ApiTypeReference = {
|
|
2
|
+
// name: string,
|
|
3
|
+
// namespace?: string,
|
|
4
|
+
// typeArguments?: ApiTypeReference[]
|
|
5
|
+
// }
|
|
6
|
+
export {};
|
|
7
|
+
// export type ApiParameter = {
|
|
8
|
+
// name: string,
|
|
9
|
+
// type: ApiTypeReference,
|
|
10
|
+
// optional: boolean,
|
|
11
|
+
// rest: boolean,
|
|
12
|
+
// comment?: string
|
|
13
|
+
// }
|
|
14
|
+
// export type ApiFnSignature = {
|
|
15
|
+
// returnType: ApiTypeReference,
|
|
16
|
+
// parameters: ApiParameter[]
|
|
17
|
+
// returnsComment: string
|
|
18
|
+
// }
|
|
19
|
+
// export type ApiMethod = {
|
|
20
|
+
// name: string,
|
|
21
|
+
// signature: ApiFnSignature,
|
|
22
|
+
// comment?: string
|
|
23
|
+
// }
|
|
24
|
+
// export type ApiProperty = {
|
|
25
|
+
// name: string,
|
|
26
|
+
// type: ApiTypeReference,
|
|
27
|
+
// comment?: string
|
|
28
|
+
// }
|
|
29
|
+
// // Why did I use TypeScriptFnSignature as opposed to ApiFnSignature?
|
|
30
|
+
// // export type ApiEntityDefinition = {
|
|
31
|
+
// // //keyword: "interface" | "class"
|
|
32
|
+
// // typeName: string,
|
|
33
|
+
// // // When 'new' can be called
|
|
34
|
+
// // constructors: tsTypes.TypeScriptFnSignature[],
|
|
35
|
+
// // // when interface is also itself a method
|
|
36
|
+
// // callables: tsTypes.TypeScriptFnSignature[],
|
|
37
|
+
// // //staticMethods: TypeScriptFnSignature[]
|
|
38
|
+
// // properties: ApiProperty[],
|
|
39
|
+
// // methods: ApiMethod[]
|
|
40
|
+
// // staticProperties: ApiProperty[],
|
|
41
|
+
// // staticMethods: ApiMethod[]
|
|
42
|
+
// // }
|
|
43
|
+
// export type ApiEntityDefinition = {
|
|
44
|
+
// //keyword: "interface" | "class"
|
|
45
|
+
// typeName: string,
|
|
46
|
+
// // When 'new' can be called
|
|
47
|
+
// constructors: ApiFnSignature[],
|
|
48
|
+
// // when interface is also itself a method
|
|
49
|
+
// callables: ApiFnSignature[],
|
|
50
|
+
// //staticMethods: TypeScriptFnSignature[]
|
|
51
|
+
// properties: ApiProperty[],
|
|
52
|
+
// methods: ApiMethod[]
|
|
53
|
+
// staticProperties: ApiProperty[],
|
|
54
|
+
// staticMethods: ApiMethod[]
|
|
55
|
+
// }
|
|
56
|
+
// export function getTsTypeVariants(tsType: tsTypes.TypeScriptTypeReference): tsTypes.TypeScriptTypeReference[] {
|
|
57
|
+
// switch (tsType.kind) {
|
|
58
|
+
// case "union":
|
|
59
|
+
// {
|
|
60
|
+
// return tsType.types.flatMap(x => getTsTypeVariants(x));
|
|
61
|
+
// }
|
|
62
|
+
// case "array":
|
|
63
|
+
// {
|
|
64
|
+
// return getTsTypeVariants(tsType.type).flatMap(
|
|
65
|
+
// x => {
|
|
66
|
+
// let itemVariants = getTsTypeVariants(x);
|
|
67
|
+
// return itemVariants.map(x => ({ kind: "array", type: x }))
|
|
68
|
+
// })
|
|
69
|
+
// }
|
|
70
|
+
// default:
|
|
71
|
+
// {
|
|
72
|
+
// return [tsType];
|
|
73
|
+
// }
|
|
74
|
+
// }
|
|
75
|
+
// }
|
|
76
|
+
// // For declaring properties -> must translate do a direct equivalent, otherwise just use 'object'
|
|
77
|
+
// // For property setters -> one type can translate to multiple setters, "SetTop"/"SetBottom", SetValue(string)/SetValue(int) etc
|
|
78
|
+
// // For parameters -> one type can translate to multiple *function overloads*, DoStuff(int), DoStuff(int,string), DoStuff(int, string[])
|
|
79
|
+
// export function getMethodOverrideVariants(signature: tsTypes.TypeScriptFnSignature): tsTypes.TypeScriptFnSignature[] {
|
|
80
|
+
// let outMethods: tsTypes.TypeScriptFnSignature[] = [{ ...signature, parameters: [] }]
|
|
81
|
+
// for (const parameter of signature.parameters) {
|
|
82
|
+
// let updatedOutMethods: tsTypes.TypeScriptFnSignature[] = []
|
|
83
|
+
// if (parameter.optional || parameter.rest) {
|
|
84
|
+
// for (let prevSignature of outMethods) {
|
|
85
|
+
// let newSignature = { ...prevSignature };
|
|
86
|
+
// //newSignature.parameters = [... newSignature.parameters, { name: parameter.name, type: [csType] }]
|
|
87
|
+
// updatedOutMethods.push(newSignature)
|
|
88
|
+
// //newSignature.parameters.push({name: parameter.name, type: tsTypeToCsTypes(paramType))
|
|
89
|
+
// }
|
|
90
|
+
// }
|
|
91
|
+
// let tsTypes = getTsTypeVariants(parameter.type)
|
|
92
|
+
// for (let tsTypeVariant of tsTypes) {
|
|
93
|
+
// for (let prevSignature of outMethods) {
|
|
94
|
+
// let newSignature = { ...prevSignature };
|
|
95
|
+
// newSignature.parameters = [...newSignature.parameters, {
|
|
96
|
+
// name: parameter.name,
|
|
97
|
+
// type: tsTypeVariant,
|
|
98
|
+
// optional: parameter.optional,
|
|
99
|
+
// rest: parameter.rest,
|
|
100
|
+
// comment: parameter.comment
|
|
101
|
+
// }]
|
|
102
|
+
// updatedOutMethods.push(newSignature)
|
|
103
|
+
// //newSignature.parameters.push({name: parameter.name, type: tsTypeToCsTypes(paramType))
|
|
104
|
+
// }
|
|
105
|
+
// //console.log(parameter.name + " " + paramType.kind)
|
|
106
|
+
// }
|
|
107
|
+
// outMethods = [...updatedOutMethods];
|
|
108
|
+
// // console.log("outMethods")
|
|
109
|
+
// // console.log(JSON.stringify(outMethods))
|
|
110
|
+
// }
|
|
111
|
+
// return outMethods;
|
|
112
|
+
// }
|
|
113
|
+
// type ApiConverter = {
|
|
114
|
+
// convertType: (type: tsTypes.TypeScriptTypeReference, options: ConvertTypeOptions) => ApiTypeReference
|
|
115
|
+
// addMethod: (apiMethod: ApiMethod, apiDefinition: ApiEntityDefinition) => void
|
|
116
|
+
// addProperty: (property: ApiProperty, apiDefinition: ApiEntityDefinition) => void
|
|
117
|
+
// convertMethod: (method: tsTypes.TypeScriptMethod, options: ConvertMethodOptions) => ApiMethod
|
|
118
|
+
// convertReturnType: (signature: tsTypes.TypeScriptFnSignature, converterOptions: ConvertReturnTypeOptions) => ApiTypeReference
|
|
119
|
+
// convertParameterType: (signature: tsTypes.TypeScriptFnSignature, parameter: tsTypes.TypeScriptParameter, options: ConvertParameterTypeOptions) => ApiTypeReference
|
|
120
|
+
// convertProperty: (property: tsTypes.TypeScriptProperty, options: ConvertPropertyOptions) => ApiProperty
|
|
121
|
+
// convertPropertyType: (property: tsTypes.TypeScriptProperty, options: ConvertPropertyTypeOptions) => ApiTypeReference
|
|
122
|
+
// convertFnSignature: (fn: tsTypes.TypeScriptFnSignature, converterOptions: ConvertFnSignatureOptions) => ApiFnSignature
|
|
123
|
+
// }
|
|
124
|
+
// type ConvertReturnTypeOptions = {
|
|
125
|
+
// onConvertType?: (type: tsTypes.TypeScriptTypeReference, apiConverter?: ApiConverter) => ApiTypeReference
|
|
126
|
+
// }
|
|
127
|
+
// type ConvertParameterTypeOptions = {
|
|
128
|
+
// onConvertType?: (type: tsTypes.TypeScriptTypeReference, apiConverter?: ApiConverter) => ApiTypeReference
|
|
129
|
+
// }
|
|
130
|
+
// type ConvertPropertyOptions = {
|
|
131
|
+
// onConvertType?: (type: tsTypes.TypeScriptTypeReference, apiConverter?: ApiConverter) => ApiTypeReference
|
|
132
|
+
// }
|
|
133
|
+
// type ConvertPropertyTypeOptions = {
|
|
134
|
+
// onConvertType?: (type: tsTypes.TypeScriptTypeReference, apiConverter?: ApiConverter) => ApiTypeReference
|
|
135
|
+
// }
|
|
136
|
+
// type ConvertTypeOptions = {
|
|
137
|
+
// onConvertFnSignature?: (fn: tsTypes.TypeScriptFnSignature, apiConverter: ApiConverter) => ApiFnSignature
|
|
138
|
+
// onConvertReturnType?: (signature: tsTypes.TypeScriptFnSignature, apiConverter?: ApiConverter) => ApiTypeReference
|
|
139
|
+
// onConvertParameterType?: (signature: tsTypes.TypeScriptFnSignature, parameter: tsTypes.TypeScriptParameter, apiConverter?: ApiConverter) => ApiTypeReference
|
|
140
|
+
// onOverwriteType?: (type: tsTypes.TypeScriptTypeReference, apiConverter?: ApiConverter) => ApiTypeReference | undefined
|
|
141
|
+
// }
|
|
142
|
+
// type ConvertApiOptions = {
|
|
143
|
+
// onMethod?: (method: tsTypes.TypeScriptMethod, apiDefinition: ApiEntityDefinition, apiConverter?: ApiConverter) => void
|
|
144
|
+
// onProperty?: (property: tsTypes.TypeScriptProperty, apiDefinition: ApiEntityDefinition, apiConverter?: ApiConverter) => void
|
|
145
|
+
// }
|
|
146
|
+
// type ConvertMethodOptions = {
|
|
147
|
+
// onConvertFnSignature?: (fn: tsTypes.TypeScriptFnSignature, apiConverter: ApiConverter) => ApiFnSignature
|
|
148
|
+
// onConvertReturnType?: (signature: tsTypes.TypeScriptFnSignature, apiConverter?: ApiConverter) => ApiTypeReference
|
|
149
|
+
// onConvertParameterType?: (signature: tsTypes.TypeScriptFnSignature, parameter: tsTypes.TypeScriptParameter, apiConverter?: ApiConverter) => ApiTypeReference
|
|
150
|
+
// }
|
|
151
|
+
// type ConvertFnSignatureOptions = {
|
|
152
|
+
// onConvertReturnType?: (signature: tsTypes.TypeScriptFnSignature, apiConverter?: ApiConverter) => ApiTypeReference
|
|
153
|
+
// onConvertParameterType?: (signature: tsTypes.TypeScriptFnSignature, parameter: tsTypes.TypeScriptParameter, apiConverter?: ApiConverter) => ApiTypeReference
|
|
154
|
+
// onConvertType?: (type: tsTypes.TypeScriptTypeReference, apiConverter?: ApiConverter) => ApiTypeReference
|
|
155
|
+
// }
|
|
156
|
+
// // type ApiConverterOptions = {
|
|
157
|
+
// // onConvertType?: (type: csgen.TypeScriptTypeReference, apiConverter?: ApiConverter) => ApiTypeReference
|
|
158
|
+
// // onConvertMethod?: (method: csgen.TypeScriptMethod, apiConverter: ApiConverter) => ApiMethod
|
|
159
|
+
// // onConvertReturnType?: (signature: csgen.TypeScriptFnSignature, apiConverter?: ApiConverter) => ApiTypeReference
|
|
160
|
+
// // onConvertParameterType?: (signature: csgen.TypeScriptFnSignature, parameter: csgen.TypeScriptParameter, apiConverter?: ApiConverter) => ApiTypeReference
|
|
161
|
+
// // onConvertProperty?: (property: csgen.TypeScriptProperty, apiConverter?: ApiConverter) => ApiProperty
|
|
162
|
+
// // onConvertPropertyType?: (property: csgen.TypeScriptProperty, apiConverter?: ApiConverter) => ApiTypeReference
|
|
163
|
+
// // onConvertFnSignature?: (fn: csgen.TypeScriptFnSignature, apiConverter?: ApiConverter) => ApiFnSignature
|
|
164
|
+
// // }
|
|
165
|
+
// export function ToApiDefinition(
|
|
166
|
+
// tsDef: tsTypes.TypeScriptEntityDefinition,
|
|
167
|
+
// options: ConvertApiOptions
|
|
168
|
+
// ): ApiEntityDefinition {
|
|
169
|
+
// const apiDefinition: ApiEntityDefinition = {
|
|
170
|
+
// typeName: tsDef.typeName,
|
|
171
|
+
// callables: [],
|
|
172
|
+
// constructors: [],
|
|
173
|
+
// methods: [],
|
|
174
|
+
// properties: [],
|
|
175
|
+
// staticMethods: [],
|
|
176
|
+
// staticProperties: []
|
|
177
|
+
// }
|
|
178
|
+
// // function applyOptions(converter: ApiConverter, options: ApiConverterOptions) : ApiConverter{
|
|
179
|
+
// // if(options.onConvertReturnType){
|
|
180
|
+
// // converter.convertReturnType = (signature) =>
|
|
181
|
+
// // {
|
|
182
|
+
// // return options!.onConvertReturnType!(signature)
|
|
183
|
+
// // }
|
|
184
|
+
// // }
|
|
185
|
+
// // if(options.onAddMethod) {
|
|
186
|
+
// // converter.addMethod = (method, definition, _options) =>
|
|
187
|
+
// // {
|
|
188
|
+
// // var plm = options!.onAddMethod!(method, apiDefinition);
|
|
189
|
+
// // }
|
|
190
|
+
// // }
|
|
191
|
+
// // return converter;
|
|
192
|
+
// // }
|
|
193
|
+
// const apiConverter: ApiConverter = {
|
|
194
|
+
// addMethod(apiMethod, apiDefinition) {
|
|
195
|
+
// apiDefinition.methods.push(apiMethod)
|
|
196
|
+
// },
|
|
197
|
+
// addProperty(apiProperty, apiDefinition) {
|
|
198
|
+
// apiDefinition.properties.push(apiProperty)
|
|
199
|
+
// },
|
|
200
|
+
// convertMethod(method, options) {
|
|
201
|
+
// let convertSignature = options.onConvertFnSignature;
|
|
202
|
+
// if (!convertSignature) {
|
|
203
|
+
// convertSignature = (signature, apiConverter) => this.convertFnSignature(signature, options)
|
|
204
|
+
// }
|
|
205
|
+
// let apiSignature = convertSignature(method.signature, { ...this })
|
|
206
|
+
// return {
|
|
207
|
+
// name: method.name,
|
|
208
|
+
// comment: method.comment,
|
|
209
|
+
// signature: apiSignature
|
|
210
|
+
// };
|
|
211
|
+
// },
|
|
212
|
+
// convertFnSignature(tsSignature, options) {
|
|
213
|
+
// let convertType = options.onConvertType;
|
|
214
|
+
// if (!convertType) {
|
|
215
|
+
// convertType = (type, converter) => this.convertType(type, {})
|
|
216
|
+
// }
|
|
217
|
+
// let convertReturnType = options.onConvertReturnType;
|
|
218
|
+
// if (!convertReturnType) {
|
|
219
|
+
// convertReturnType = (signature, converter) => convertType(signature.returnType);
|
|
220
|
+
// }
|
|
221
|
+
// var convertParameterType = options.onConvertParameterType;
|
|
222
|
+
// if (!convertParameterType) {
|
|
223
|
+
// convertParameterType = (signature, parameter, converter) => convertType(parameter.type)
|
|
224
|
+
// }
|
|
225
|
+
// var returnType = tsSignature.returnType.kind == "empty" ? { name: "void" } : convertReturnType(tsSignature, this)
|
|
226
|
+
// var signature: ApiFnSignature = {
|
|
227
|
+
// returnType: returnType,
|
|
228
|
+
// returnsComment: tsSignature.returnsComment,
|
|
229
|
+
// parameters: tsSignature.parameters.map(x => ({
|
|
230
|
+
// name: x.name,
|
|
231
|
+
// optional: x.optional,
|
|
232
|
+
// rest: x.rest,
|
|
233
|
+
// type: convertParameterType!(tsSignature, x, { ...this }),
|
|
234
|
+
// comment: x.comment
|
|
235
|
+
// }))
|
|
236
|
+
// }
|
|
237
|
+
// return signature;
|
|
238
|
+
// },
|
|
239
|
+
// convertParameterType(signature, parameter, convertParameterTypeOptions) {
|
|
240
|
+
// if (convertParameterTypeOptions.onConvertType) {
|
|
241
|
+
// return convertParameterTypeOptions.onConvertType(parameter.type, this)
|
|
242
|
+
// }
|
|
243
|
+
// else {
|
|
244
|
+
// return this.convertType(parameter.type, {})
|
|
245
|
+
// }
|
|
246
|
+
// // let convertParameter = convertParameterTypeOptions.onConvertType;
|
|
247
|
+
// // if (!convertParameter) {
|
|
248
|
+
// // convertParameter = (signature, parameter, converter) => {
|
|
249
|
+
// // var convertType = converterOptions.onConvertType;
|
|
250
|
+
// // if (!convertType)
|
|
251
|
+
// // convertType = (type, converter) => this.convertType(type, converterOptions)
|
|
252
|
+
// // return convertType(parameter.type);
|
|
253
|
+
// // }
|
|
254
|
+
// // }
|
|
255
|
+
// // return convertParameter(signature, parameter, { ...this })
|
|
256
|
+
// },
|
|
257
|
+
// convertProperty(property, converterOptions) {
|
|
258
|
+
// var propertyType = converterOptions.onConvertType
|
|
259
|
+
// ? converterOptions.onConvertType(property.type, this)
|
|
260
|
+
// : this.convertType(property.type, {});
|
|
261
|
+
// return {
|
|
262
|
+
// name: property.name,
|
|
263
|
+
// comment: property.comment,
|
|
264
|
+
// type: propertyType
|
|
265
|
+
// }
|
|
266
|
+
// },
|
|
267
|
+
// convertPropertyType(property, converterOptions) {
|
|
268
|
+
// var propertyType = converterOptions.onConvertType
|
|
269
|
+
// ? converterOptions.onConvertType(property.type, this)
|
|
270
|
+
// : this.convertType(property.type, {});
|
|
271
|
+
// return propertyType;
|
|
272
|
+
// },
|
|
273
|
+
// convertReturnType(signature, convertReturnTypeOptions) {
|
|
274
|
+
// if (convertReturnTypeOptions.onConvertType) {
|
|
275
|
+
// return convertReturnTypeOptions.onConvertType(signature.returnType)
|
|
276
|
+
// }
|
|
277
|
+
// else
|
|
278
|
+
// return this.convertType(signature.returnType, {})
|
|
279
|
+
// },
|
|
280
|
+
// convertType(tsType, convertTypeOptions): ApiTypeReference {
|
|
281
|
+
// if (convertTypeOptions.onOverwriteType) {
|
|
282
|
+
// const outType = convertTypeOptions!.onOverwriteType!(tsType, this);
|
|
283
|
+
// if (outType)
|
|
284
|
+
// return outType;
|
|
285
|
+
// }
|
|
286
|
+
// // return convertTypeOptions.onConvertType(tsType, this);
|
|
287
|
+
// // let convertParameterType = converterOptions.onConvertParameterType;
|
|
288
|
+
// // if (!convertParameterType) {
|
|
289
|
+
// // convertParameterType = (signature, parameter, apiConverter) => this.convertParameterType(signature, parameter, coverterop);
|
|
290
|
+
// // }
|
|
291
|
+
// // let convertReturnType = converterOptions.onConvertReturnType;
|
|
292
|
+
// // if (!convertReturnType) {
|
|
293
|
+
// // convertReturnType = (signature, apiConverter) => this.convertReturnType(signature, {});
|
|
294
|
+
// // }
|
|
295
|
+
// // var onConvertType = converterOptions.onConvertType;
|
|
296
|
+
// // if (!onConvertType) {
|
|
297
|
+
// // onConvertType = (nestedType) => {
|
|
298
|
+
// // var equivalent = this.convertType(nestedType, {})// GetDirectCSharpTypeEquivalent(nestedType)
|
|
299
|
+
// // // if (equivalent == "no-equivalent")
|
|
300
|
+
// // // throw `Type conversion not supported ${nestedType.kind}`
|
|
301
|
+
// // return equivalent
|
|
302
|
+
// // }
|
|
303
|
+
// // }
|
|
304
|
+
// switch (tsType.kind) {
|
|
305
|
+
// case "boolean": {
|
|
306
|
+
// return csgen.systemBool;
|
|
307
|
+
// }
|
|
308
|
+
// case "string":
|
|
309
|
+
// case "stringLiteral":
|
|
310
|
+
// {
|
|
311
|
+
// return csgen.systemString
|
|
312
|
+
// }
|
|
313
|
+
// case "namedType":
|
|
314
|
+
// {
|
|
315
|
+
// return { name: tsType.name }
|
|
316
|
+
// }
|
|
317
|
+
// case "genericType":
|
|
318
|
+
// {
|
|
319
|
+
// return { name: tsType.name, typeArguments: tsType.typeArguments.map(t => this.convertType(t, convertTypeOptions)) }
|
|
320
|
+
// }
|
|
321
|
+
// case "bigint": {
|
|
322
|
+
// return { name: "BigInteger", namespace: "System.Numerics" }
|
|
323
|
+
// }
|
|
324
|
+
// case "union": {
|
|
325
|
+
// if (tsType.types.length < 2)
|
|
326
|
+
// throw tsType;
|
|
327
|
+
// let notEmpty = tsType.types.filter(x => x.kind != "empty");
|
|
328
|
+
// if (notEmpty.every(x => x.kind == "stringLiteral" || x.kind == "string")) {
|
|
329
|
+
// return csgen.systemString;
|
|
330
|
+
// }
|
|
331
|
+
// if (notEmpty.every(x => x.kind == "boolean")) {
|
|
332
|
+
// return csgen.systemBool
|
|
333
|
+
// }
|
|
334
|
+
// if (notEmpty.length == 1 && notEmpty[0].kind == "namedType") {
|
|
335
|
+
// return { name: notEmpty[0].name }
|
|
336
|
+
// }
|
|
337
|
+
// if (notEmpty.length == 1 && notEmpty[0].kind == "function") {
|
|
338
|
+
// if (notEmpty[0].overloads.length != 1)
|
|
339
|
+
// throw notEmpty[0];
|
|
340
|
+
// // 'redirect' to "function" case
|
|
341
|
+
// return this.convertType(notEmpty[0], convertTypeOptions)
|
|
342
|
+
// // if (convertTypeOptions.onConvertFnSignature) {
|
|
343
|
+
// // return convertTypeOptions.onConvertFnSignature(notEmpty[0].overloads[0], { ...this })
|
|
344
|
+
// // }
|
|
345
|
+
// // else return this.convertFnSignature(notEmpty[0].overloads[0], {})
|
|
346
|
+
// }
|
|
347
|
+
// }
|
|
348
|
+
// case "array": {
|
|
349
|
+
// if (tsType.kind == "array") { // it is
|
|
350
|
+
// let csItemType = this.convertType(tsType.type, {});
|
|
351
|
+
// return { ...csgen.systemCollectionsGenericList, typeArguments: [csItemType] }
|
|
352
|
+
// }
|
|
353
|
+
// }
|
|
354
|
+
// case "function": {
|
|
355
|
+
// if (tsType.kind == "function") {
|
|
356
|
+
// if (tsType.overloads.length != 1)
|
|
357
|
+
// throw tsType;
|
|
358
|
+
// const signature = tsType.overloads[0];
|
|
359
|
+
// let typeArguments = signature.parameters.map(p => {
|
|
360
|
+
// if (convertTypeOptions.onConvertParameterType) {
|
|
361
|
+
// return convertTypeOptions.onConvertParameterType(signature, p, { ...this })
|
|
362
|
+
// }
|
|
363
|
+
// else {
|
|
364
|
+
// return this.convertType(p.type, convertTypeOptions)
|
|
365
|
+
// }
|
|
366
|
+
// })
|
|
367
|
+
// if (signature.returnType.kind == "empty") {
|
|
368
|
+
// return { ...csgen.systemAction, typeArguments }
|
|
369
|
+
// }
|
|
370
|
+
// else {
|
|
371
|
+
// const returnType = convertTypeOptions.onConvertReturnType
|
|
372
|
+
// ? convertTypeOptions.onConvertReturnType(signature, { ...this })
|
|
373
|
+
// : this.convertType(signature.returnType, convertTypeOptions)
|
|
374
|
+
// //const returnType = convertReturnType!(signature, { ...this });
|
|
375
|
+
// typeArguments = [returnType, ...typeArguments]
|
|
376
|
+
// return { ...csgen.systemFunc, typeArguments }
|
|
377
|
+
// //throw typeArguments
|
|
378
|
+
// }
|
|
379
|
+
// }
|
|
380
|
+
// }
|
|
381
|
+
// }
|
|
382
|
+
// throw tsType;
|
|
383
|
+
// },
|
|
384
|
+
// }
|
|
385
|
+
// //}
|
|
386
|
+
// // if (!apiConverter) apiConverter = {}
|
|
387
|
+
// // if (!apiConverter.onConvertType)
|
|
388
|
+
// // apiConverter.onConvertType = (tsType: csgen.TypeScriptTypeReference, apiConverter?: ApiConverter) => {
|
|
389
|
+
// // switch (tsType.kind) {
|
|
390
|
+
// // case "boolean": {
|
|
391
|
+
// // return csgen.systemBool;
|
|
392
|
+
// // }
|
|
393
|
+
// // case "string":
|
|
394
|
+
// // case "stringLiteral":
|
|
395
|
+
// // {
|
|
396
|
+
// // return csgen.systemString
|
|
397
|
+
// // }
|
|
398
|
+
// // case "namedType":
|
|
399
|
+
// // {
|
|
400
|
+
// // return { name: tsType.name }
|
|
401
|
+
// // }
|
|
402
|
+
// // case "bigint": {
|
|
403
|
+
// // return { name: "BigInteger", namespace: "System.Numerics" }
|
|
404
|
+
// // }
|
|
405
|
+
// // case "union": {
|
|
406
|
+
// // if (tsType.types.length < 2)
|
|
407
|
+
// // throw tsType;
|
|
408
|
+
// // let notEmpty = tsType.types.filter(x => x.kind != "empty");
|
|
409
|
+
// // if (notEmpty.every(x => x.kind == "stringLiteral" || x.kind == "string")) {
|
|
410
|
+
// // return csgen.systemString;
|
|
411
|
+
// // }
|
|
412
|
+
// // if (notEmpty.every(x => x.kind == "boolean")) {
|
|
413
|
+
// // return csgen.systemBool
|
|
414
|
+
// // }
|
|
415
|
+
// // if (notEmpty.length == 1 && notEmpty[0].kind == "namedType") {
|
|
416
|
+
// // return { name: notEmpty[0].name }
|
|
417
|
+
// // }
|
|
418
|
+
// // if (notEmpty.length == 1 && notEmpty[0].kind == "function") {
|
|
419
|
+
// // if (notEmpty[0].overloads.length != 1)
|
|
420
|
+
// // throw notEmpty[0];
|
|
421
|
+
// // return apiConverter!.onConvertType!(notEmpty[0], apiConverter)
|
|
422
|
+
// // }
|
|
423
|
+
// // }
|
|
424
|
+
// // case "array": {
|
|
425
|
+
// // if (tsType.kind == "array") { // it is
|
|
426
|
+
// // let csItemType = apiConverter!.onConvertType!(tsType.type, apiConverter);
|
|
427
|
+
// // return { ...csgen.systemCollectionsGenericList, typeArguments: [csItemType] }
|
|
428
|
+
// // }
|
|
429
|
+
// // }
|
|
430
|
+
// // case "function": {
|
|
431
|
+
// // if (tsType.kind == "function") {
|
|
432
|
+
// // if (tsType.overloads.length != 1)
|
|
433
|
+
// // throw tsType;
|
|
434
|
+
// // const signature = tsType.overloads[0];
|
|
435
|
+
// // let typeArguments = signature.parameters.map(p => {
|
|
436
|
+
// // //return apiConverter.onConvertMethodParameterType!(t.type);
|
|
437
|
+
// // return apiConverter!.onConvertParameterType!(signature, p, apiConverter);
|
|
438
|
+
// // })
|
|
439
|
+
// // if (signature.returnType.kind == "empty") {
|
|
440
|
+
// // return { ...csgen.systemAction, typeArguments }
|
|
441
|
+
// // }
|
|
442
|
+
// // else {
|
|
443
|
+
// // const returnType = apiConverter!.onConvertReturnType!(signature, apiConverter);
|
|
444
|
+
// // typeArguments = [returnType, ...typeArguments]
|
|
445
|
+
// // return { ...csgen.systemFunc, typeArguments }
|
|
446
|
+
// // }
|
|
447
|
+
// // }
|
|
448
|
+
// // }
|
|
449
|
+
// // }
|
|
450
|
+
// // throw tsType;
|
|
451
|
+
// // }
|
|
452
|
+
// // if (!apiConverter.onAddProperty) apiConverter.onAddProperty = () => "add-default";
|
|
453
|
+
// // if (!apiConverter.onConvertPropertyType) apiConverter.onConvertPropertyType = (property, apiConverter) => {
|
|
454
|
+
// // let tsReturnType = GetDirectCSharpTypeEquivalent(property.type);
|
|
455
|
+
// // if (tsReturnType == "no-equivalent")
|
|
456
|
+
// // throw `Cannot convert property type ${property.name} ${property.type.kind}`
|
|
457
|
+
// // return tsReturnType;
|
|
458
|
+
// // }
|
|
459
|
+
// // if (!apiConverter.onConvertProperty) apiConverter.onConvertProperty = (property, apiConverter) => {
|
|
460
|
+
// // let apiProperty: ApiProperty = {
|
|
461
|
+
// // name: property.name,
|
|
462
|
+
// // comment: property.comment,
|
|
463
|
+
// // type: apiConverter!.onConvertPropertyType!(property, apiConverter)
|
|
464
|
+
// // }
|
|
465
|
+
// // return apiProperty
|
|
466
|
+
// // }
|
|
467
|
+
// // if (!apiConverter.onAddMethod) apiConverter.onAddMethod = () => "add-default";
|
|
468
|
+
// // if (!apiConverter?.onConvertReturnType) apiConverter.onConvertReturnType = (signature, apiConverter) => {
|
|
469
|
+
// // let tsReturnType = GetDirectCSharpTypeEquivalent(signature.returnType);
|
|
470
|
+
// // if (tsReturnType == "no-equivalent")
|
|
471
|
+
// // throw `Cannot convert return type ${signature.returnType.kind}`
|
|
472
|
+
// // return { name: tsReturnType.name, namespace: tsReturnType.namespace }
|
|
473
|
+
// // }
|
|
474
|
+
// // if (!apiConverter?.onConvertParameterType) apiConverter.onConvertParameterType = (method, parameter, apiConverter) => {
|
|
475
|
+
// // let tsReturnType = GetDirectCSharpTypeEquivalent(parameter.type);
|
|
476
|
+
// // if (tsReturnType == "no-equivalent")
|
|
477
|
+
// // throw `Cannot convert type for parameter ${parameter.name}`
|
|
478
|
+
// // return { name: tsReturnType.name, namespace: tsReturnType.namespace }
|
|
479
|
+
// // }
|
|
480
|
+
// // if (!apiConverter.onConvertMethod) apiConverter.onConvertMethod = (method, apiConverter) => {
|
|
481
|
+
// // return ({
|
|
482
|
+
// // name: method.name,
|
|
483
|
+
// // comment: method.comment,
|
|
484
|
+
// // signature: {
|
|
485
|
+
// // returnType: apiConverter!.onConvertReturnType!(method.signature, apiConverter),
|
|
486
|
+
// // returnsComment: method.signature.returnsComment,
|
|
487
|
+
// // parameters: method.signature.parameters.map(x => ({
|
|
488
|
+
// // name: x.name,
|
|
489
|
+
// // optional: x.optional,
|
|
490
|
+
// // rest: x.rest,
|
|
491
|
+
// // type: apiConverter!.onConvertParameterType!(method.signature, x, apiConverter),
|
|
492
|
+
// // comment: x.comment
|
|
493
|
+
// // }))
|
|
494
|
+
// // }
|
|
495
|
+
// // })
|
|
496
|
+
// // }
|
|
497
|
+
// for (const tsMethod of tsDef.methods) {
|
|
498
|
+
// if (options?.onMethod) {
|
|
499
|
+
// options.onMethod(tsMethod, apiDefinition, apiConverter)
|
|
500
|
+
// }
|
|
501
|
+
// else {
|
|
502
|
+
// let apiMethod = apiConverter.convertMethod(tsMethod, {});
|
|
503
|
+
// apiConverter.addMethod(apiMethod, apiDefinition)
|
|
504
|
+
// }
|
|
505
|
+
// }
|
|
506
|
+
// for (const tsProperty of tsDef.properties) {
|
|
507
|
+
// if (options?.onProperty) {
|
|
508
|
+
// options.onProperty(tsProperty, apiDefinition, apiConverter);
|
|
509
|
+
// }
|
|
510
|
+
// else {
|
|
511
|
+
// const apiProperty = apiConverter.convertProperty(tsProperty, {})
|
|
512
|
+
// apiConverter.addProperty(apiProperty, apiDefinition);
|
|
513
|
+
// }
|
|
514
|
+
// }
|
|
515
|
+
// return apiDefinition;
|
|
516
|
+
// }
|
|
517
|
+
//# sourceMappingURL=ApiEntities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiEntities.js","sourceRoot":"../src/","sources":["ApiEntities.ts"],"names":[],"mappings":"AACA,mCAAmC;AACnC,oBAAoB;AACpB,0BAA0B;AAC1B,yCAAyC;AACzC,IAAI;;AAEJ,+BAA+B;AAC/B,oBAAoB;AACpB,8BAA8B;AAC9B,yBAAyB;AACzB,qBAAqB;AACrB,uBAAuB;AACvB,IAAI;AAEJ,iCAAiC;AACjC,oCAAoC;AACpC,iCAAiC;AACjC,6BAA6B;AAC7B,IAAI;AAEJ,4BAA4B;AAC5B,oBAAoB;AACpB,iCAAiC;AACjC,uBAAuB;AACvB,IAAI;AAEJ,8BAA8B;AAC9B,oBAAoB;AACpB,8BAA8B;AAC9B,uBAAuB;AACvB,IAAI;AAEJ,uEAAuE;AAEvE,yCAAyC;AACzC,0CAA0C;AAC1C,2BAA2B;AAC3B,qCAAqC;AACrC,wDAAwD;AACxD,mDAAmD;AACnD,qDAAqD;AACrD,kDAAkD;AAClD,oCAAoC;AACpC,8BAA8B;AAC9B,0CAA0C;AAC1C,oCAAoC;AACpC,OAAO;AAEP,sCAAsC;AACtC,uCAAuC;AACvC,wBAAwB;AACxB,kCAAkC;AAClC,sCAAsC;AACtC,gDAAgD;AAChD,mCAAmC;AACnC,+CAA+C;AAC/C,iCAAiC;AACjC,2BAA2B;AAC3B,uCAAuC;AACvC,iCAAiC;AACjC,IAAI;AAEJ,kHAAkH;AAClH,6BAA6B;AAC7B,wBAAwB;AACxB,gBAAgB;AAChB,0EAA0E;AAC1E,gBAAgB;A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oCAAoC;AACpC,0CAA0C;AAC1C,8BAA8B;AAC9B,qGAAqG;AACrG,sEAAsE;AACtE,yEAAyE;AACzE,uCAAuC;AACvC,+CAA+C;AAC/C,uCAAuC;AACvC,yGAAyG;AACzG,4CAA4C;AAC5C,yBAAyB;AACzB,mBAAmB;AACnB,gBAAgB;AAChB,WAAW;AAEX,8CAA8C;AAC9C,mCAAmC;AACnC,sEAAsE;AACtE,YAAY;AACZ,iBAAiB;AACjB,wEAAwE;AACxE,+DAA+D;AAC/D,YAAY;AACZ,QAAQ;AAER,mDAAmD;AACnD,qCAAqC;AACrC,2EAA2E;AAC3E,YAAY;AACZ,iBAAiB;AACjB,+EAA+E;AAC/E,oEAAoE;AACpE,YAAY;AACZ,QAAQ;AAER,4BAA4B;AAC5B,IAAI"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as csgen from "./CSharpContracts.js";
|
|
2
|
+
import * as types from "./Types.js";
|
|
3
|
+
/**
|
|
4
|
+
* This one keeps track of method calls separately from generated API method names
|
|
5
|
+
*/
|
|
6
|
+
export declare namespace ApiGeneratorModel {
|
|
7
|
+
type Class = {
|
|
8
|
+
className: string;
|
|
9
|
+
properties: types.GeneratorModel.Property[];
|
|
10
|
+
methods: types.GeneratorModel.Method[];
|
|
11
|
+
comment: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare namespace ApiResolverModel {
|
|
15
|
+
type Class = {
|
|
16
|
+
name: string;
|
|
17
|
+
properties: types.ResolverModel.Property[];
|
|
18
|
+
methods: types.ResolverModel.Method[];
|
|
19
|
+
comment: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare namespace ApiExpandedModel {
|
|
23
|
+
type Class = {
|
|
24
|
+
name: string;
|
|
25
|
+
properties: types.ExpandedModel.Property[];
|
|
26
|
+
methods: types.ExpandedModel.Method[];
|
|
27
|
+
comment: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export declare namespace ApiUnionModel {
|
|
31
|
+
type Class = {
|
|
32
|
+
name: string;
|
|
33
|
+
properties: types.UnionModel.Property[];
|
|
34
|
+
methods: types.UnionModel.Method[];
|
|
35
|
+
comment: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Universal mapper for as many C# named types as possible
|
|
40
|
+
* @param flatType
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
export declare function getNamedType(flatType: {
|
|
44
|
+
kind: "namedType";
|
|
45
|
+
name: string;
|
|
46
|
+
module?: string;
|
|
47
|
+
}): csgen.TypeReference;
|
|
48
|
+
export declare function splitMultiline(text: string): string[];
|
|
49
|
+
export declare function capitalize(s: string): string;
|
|
50
|
+
export declare function toCSharpValidName(name: string): string;
|
|
51
|
+
export declare function getSetterFnName(propertyName: string, toLiteralValue?: string): string;
|
|
52
|
+
export declare function toCSharpValidParameterName(name: string): string;
|
|
53
|
+
export declare function escapeReservedKeyword(name: string): string;
|
|
54
|
+
export declare function toResolverApiModel(apiModel: ApiExpandedModel.Class): ApiResolverModel.Class;
|
|
55
|
+
/**
|
|
56
|
+
* This one keeps track of method calls separately from generated API method names
|
|
57
|
+
* @param resolverModel
|
|
58
|
+
* @returns
|
|
59
|
+
*/
|
|
60
|
+
export declare function toGeneratorApiModel(resolverModel: ApiResolverModel.Class): ApiGeneratorModel.Class;
|
|
61
|
+
/**
|
|
62
|
+
* Expands union types for properties and all method parameters
|
|
63
|
+
*/
|
|
64
|
+
export declare function toExpandedApiModel(apiUnionModel: ApiUnionModel.Class): ApiExpandedModel.Class;
|
|
65
|
+
export declare function resolveObviousPropertyMappings(properties: types.ResolverModel.Property[]): void;
|
|
66
|
+
export declare function resolveObviousMethodMappings(methods: types.ResolverModel.Method[]): void;
|
|
67
|
+
export declare function resolveObviousTypeMappings(csResolverModel: ApiResolverModel.Class): void;
|
|
68
|
+
//# sourceMappingURL=ApiModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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