@azure-tools/typespec-ts 0.21.0 → 0.22.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/CHANGELOG.md +10 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +1 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/modular/buildCodeModel.d.ts.map +1 -1
- package/dist/src/modular/buildCodeModel.js +65 -42
- package/dist/src/modular/buildCodeModel.js.map +1 -1
- package/dist/src/modular/buildOperations.d.ts +1 -0
- package/dist/src/modular/buildOperations.d.ts.map +1 -1
- package/dist/src/modular/buildOperations.js +25 -3
- package/dist/src/modular/buildOperations.js.map +1 -1
- package/dist/src/modular/buildProjectFiles.js +7 -7
- package/dist/src/modular/buildProjectFiles.js.map +1 -1
- package/dist/src/modular/buildSerializeUtils.d.ts +14 -0
- package/dist/src/modular/buildSerializeUtils.d.ts.map +1 -0
- package/dist/src/modular/buildSerializeUtils.js +526 -0
- package/dist/src/modular/buildSerializeUtils.js.map +1 -0
- package/dist/src/modular/helpers/operationHelpers.d.ts +27 -4
- package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.js +91 -22
- package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
- package/dist/src/modular/modularCodeModel.d.ts +7 -0
- package/dist/src/modular/modularCodeModel.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -20
- package/src/index.ts +2 -0
- package/src/modular/buildCodeModel.ts +91 -43
- package/src/modular/buildOperations.ts +59 -3
- package/src/modular/buildProjectFiles.ts +8 -8
- package/src/modular/buildSerializeUtils.ts +740 -0
- package/src/modular/helpers/operationHelpers.ts +135 -28
- package/src/modular/modularCodeModel.ts +7 -0
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
import { toPascalCase } from "../utils/casingUtils.js";
|
|
2
|
+
import { getResponseMapping, getRequestModelMapping, serializeRequestValue, deserializeResponseValue, getAllAncestors } from "./helpers/operationHelpers.js";
|
|
3
|
+
import { StructureKind } from "ts-morph";
|
|
4
|
+
import { addImportToSpecifier, addImportsToFiles, clearImportSets } from "@azure-tools/rlc-common";
|
|
5
|
+
import { UsageFlags } from "@typespec/compiler";
|
|
6
|
+
/**
|
|
7
|
+
* This function creates serialize and deserialize utils for special unions and that are used in the operation.
|
|
8
|
+
*/
|
|
9
|
+
export function buildSerializeUtils(model) {
|
|
10
|
+
const serializeUtilFiles = [];
|
|
11
|
+
for (const serializeType of ["serialize", "deserialize"]) {
|
|
12
|
+
const usageCondition = serializeType === "serialize" ? UsageFlags.Input : UsageFlags.Output;
|
|
13
|
+
const specialUnions = model.types.filter((t) => { var _a; return isSpecialHandledUnion(t) && ((_a = t.usage) !== null && _a !== void 0 ? _a : 0) & usageCondition; });
|
|
14
|
+
if (specialUnions.length === 0) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
clearImportSets(model.runtimeImports);
|
|
18
|
+
const utilsFile = model.project.createSourceFile(`${model.modularOptions.sourceRoot}/utils/${serializeType}Util.ts`);
|
|
19
|
+
specialUnions.forEach((su) => {
|
|
20
|
+
var _a;
|
|
21
|
+
let types = su.types;
|
|
22
|
+
if (su.type === "list") {
|
|
23
|
+
types = (_a = su.elementType) === null || _a === void 0 ? void 0 : _a.types;
|
|
24
|
+
}
|
|
25
|
+
const unionDeserializeTypes = types === null || types === void 0 ? void 0 : types.filter((et) => {
|
|
26
|
+
return isSpecialUnionVariant(et);
|
|
27
|
+
});
|
|
28
|
+
unionDeserializeTypes === null || unionDeserializeTypes === void 0 ? void 0 : unionDeserializeTypes.forEach((et) => {
|
|
29
|
+
if (serializeType === "serialize") {
|
|
30
|
+
// getTypePredictFunction(
|
|
31
|
+
// utilsFile,
|
|
32
|
+
// et,
|
|
33
|
+
// serializeType,
|
|
34
|
+
// getTypeUnionName(su, false, model.runtimeImports, serializeType)
|
|
35
|
+
// );
|
|
36
|
+
getTypeSerializeFunction(utilsFile, et, serializeType, model.runtimeImports);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
// getTypePredictFunction(
|
|
40
|
+
// utilsFile,
|
|
41
|
+
// et,
|
|
42
|
+
// serializeType,
|
|
43
|
+
// getTypeUnionName(su, true, model.runtimeImports, serializeType)
|
|
44
|
+
// );
|
|
45
|
+
getTypeDeserializeFunction(utilsFile, et, serializeType, model.runtimeImports);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const deserializeFunctionName = getDeserializeFunctionName(su, serializeType, model.runtimeImports);
|
|
49
|
+
if (serializeType === "serialize") {
|
|
50
|
+
deserializeUnionTypesFunction(utilsFile, unionDeserializeTypes !== null && unionDeserializeTypes !== void 0 ? unionDeserializeTypes : [], deserializeFunctionName, serializeType, getTypeUnionName(su, false, model.runtimeImports, serializeType), getTypeUnionName(su, true, model.runtimeImports, serializeType), su.discriminator, su.isPolymorphicBaseModel);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
deserializeUnionTypesFunction(utilsFile, unionDeserializeTypes !== null && unionDeserializeTypes !== void 0 ? unionDeserializeTypes : [], deserializeFunctionName, serializeType, getTypeUnionName(su, true, model.runtimeImports, serializeType), getTypeUnionName(su, false, model.runtimeImports, serializeType), su.discriminator, su.isPolymorphicBaseModel);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
addImportsToFiles(model.runtimeImports, utilsFile, {
|
|
57
|
+
rlcIndex: "../rest/index.js",
|
|
58
|
+
modularModel: "../models/models.js"
|
|
59
|
+
});
|
|
60
|
+
serializeUtilFiles.push(utilsFile);
|
|
61
|
+
}
|
|
62
|
+
return serializeUtilFiles;
|
|
63
|
+
}
|
|
64
|
+
export function getDeserializeFunctionName(type, serializeType, runtimeImports) {
|
|
65
|
+
const typeUnionNames = getTypeUnionName(type, false, runtimeImports, serializeType);
|
|
66
|
+
const deserializeFunctionName = `${serializeType}${toPascalCase(formalizeTypeUnionName(typeUnionNames !== null && typeUnionNames !== void 0 ? typeUnionNames : ""))}`;
|
|
67
|
+
return deserializeFunctionName;
|
|
68
|
+
}
|
|
69
|
+
function formalizeTypeUnionName(typeUnionName) {
|
|
70
|
+
return typeUnionName
|
|
71
|
+
.replace(/\[\]/g, "Array")
|
|
72
|
+
.replace(/ /g, "")
|
|
73
|
+
.replace(/\|/g, "And");
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
* In general, we have two kinds of basic special union variants.
|
|
78
|
+
* 1. datetime type
|
|
79
|
+
* 2. bytes type
|
|
80
|
+
* If we consider model type, we have the following three type.
|
|
81
|
+
* 3. model with property of datetime type.
|
|
82
|
+
* 4. model with property of binary array type.
|
|
83
|
+
* 5. model that has different property name between rest layer and modular layer.
|
|
84
|
+
* 6. nested model i.e. model with property that is a model with one of the above three conditions.
|
|
85
|
+
* If we consider array type, with all the above 6 types as the element types.
|
|
86
|
+
*/
|
|
87
|
+
const specialVariantMap = new Map();
|
|
88
|
+
export function isSpecialUnionVariant(t, variantStack = []) {
|
|
89
|
+
var _a, _b, _c, _d, _e;
|
|
90
|
+
if (variantStack.length <= 0) {
|
|
91
|
+
variantStack.push(t);
|
|
92
|
+
}
|
|
93
|
+
const ancestors = getAllAncestors(t);
|
|
94
|
+
if (specialVariantMap.has(t)) {
|
|
95
|
+
variantStack.pop();
|
|
96
|
+
return (_a = specialVariantMap.get(t)) !== null && _a !== void 0 ? _a : false;
|
|
97
|
+
}
|
|
98
|
+
if (t.type === "datetime" ||
|
|
99
|
+
t.type === "byte-array" ||
|
|
100
|
+
(t.type === "model" &&
|
|
101
|
+
((_c = (_b = t.properties) === null || _b === void 0 ? void 0 : _b.filter((p) => {
|
|
102
|
+
return !(variantStack.includes(p.type) ||
|
|
103
|
+
ancestors.includes(p.type) ||
|
|
104
|
+
(p.type.type === "list" &&
|
|
105
|
+
p.type.elementType &&
|
|
106
|
+
(variantStack.includes(p.type.elementType) ||
|
|
107
|
+
ancestors.includes(p.type.elementType))));
|
|
108
|
+
})) === null || _c === void 0 ? void 0 : _c.some((p) => p.clientName !== p.restApiName ||
|
|
109
|
+
isSpecialUnionVariant(p.type, [...variantStack, p.type])))) ||
|
|
110
|
+
isPolymorphicUnion(t) ||
|
|
111
|
+
(t.type === "list" &&
|
|
112
|
+
t.elementType &&
|
|
113
|
+
!variantStack.includes(t.elementType) &&
|
|
114
|
+
!ancestors.includes(t.elementType) &&
|
|
115
|
+
isSpecialUnionVariant(t.elementType, [...variantStack, t.elementType])) ||
|
|
116
|
+
(t.type === "combined" &&
|
|
117
|
+
((_e = (_d = t.types) === null || _d === void 0 ? void 0 : _d.filter((p) => {
|
|
118
|
+
return !(variantStack.includes(p) || ancestors.includes(p));
|
|
119
|
+
})) === null || _e === void 0 ? void 0 : _e.some((p) => {
|
|
120
|
+
return isSpecialUnionVariant(p, [...variantStack, p]);
|
|
121
|
+
})))) {
|
|
122
|
+
specialVariantMap.set(t, true);
|
|
123
|
+
variantStack.pop();
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
variantStack.pop();
|
|
127
|
+
specialVariantMap.set(t, false);
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
export function isNormalUnion(t) {
|
|
131
|
+
var _a, _b;
|
|
132
|
+
return (t.type === "combined" &&
|
|
133
|
+
!((_b = (_a = t.types) === null || _a === void 0 ? void 0 : _a.some((p) => {
|
|
134
|
+
return isSpecialUnionVariant(p);
|
|
135
|
+
})) !== null && _b !== void 0 ? _b : false));
|
|
136
|
+
}
|
|
137
|
+
export function isDiscriminatedUnion(t) {
|
|
138
|
+
var _a, _b;
|
|
139
|
+
return (t.type === "combined" &&
|
|
140
|
+
(t.discriminator ? true : false) &&
|
|
141
|
+
((_b = (_a = t.types) === null || _a === void 0 ? void 0 : _a.some((p) => {
|
|
142
|
+
return isSpecialUnionVariant(p);
|
|
143
|
+
})) !== null && _b !== void 0 ? _b : false));
|
|
144
|
+
}
|
|
145
|
+
export function isSpecialHandledUnion(t) {
|
|
146
|
+
return isDiscriminatedUnion(t) || isPolymorphicUnion(t);
|
|
147
|
+
}
|
|
148
|
+
const polymorphicUnionMap = new Map();
|
|
149
|
+
export function isPolymorphicUnion(t) {
|
|
150
|
+
var _a, _b, _c;
|
|
151
|
+
if (polymorphicUnionMap.has(t)) {
|
|
152
|
+
return (_a = polymorphicUnionMap.get(t)) !== null && _a !== void 0 ? _a : false;
|
|
153
|
+
}
|
|
154
|
+
const ancestors = getAllAncestors(t);
|
|
155
|
+
if (t.type === "model" &&
|
|
156
|
+
t.isPolymorphicBaseModel &&
|
|
157
|
+
((_c = (_b = t.types) === null || _b === void 0 ? void 0 : _b.filter((p) => {
|
|
158
|
+
return !ancestors.includes(p);
|
|
159
|
+
})) === null || _c === void 0 ? void 0 : _c.some((p) => {
|
|
160
|
+
return isSpecialUnionVariant(p);
|
|
161
|
+
}))) {
|
|
162
|
+
polymorphicUnionMap.set(t, true);
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
polymorphicUnionMap.set(t, false);
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
function getTypeUnionName(type, fromRest, runtimeImports, serializeType) {
|
|
169
|
+
var _a, _b, _c;
|
|
170
|
+
const types = type.types;
|
|
171
|
+
if (type.type === "list") {
|
|
172
|
+
types === ((_a = type.elementType) === null || _a === void 0 ? void 0 : _a.types);
|
|
173
|
+
}
|
|
174
|
+
if (type.name) {
|
|
175
|
+
const typeName = (fromRest && type.alias ? type.alias : type.name) +
|
|
176
|
+
(fromRest ? (serializeType === "serialize" ? "Rest" : "Output") : "");
|
|
177
|
+
if (fromRest && runtimeImports) {
|
|
178
|
+
addImportToSpecifier("rlcIndex", runtimeImports, ((_b = type.alias) !== null && _b !== void 0 ? _b : type.name) +
|
|
179
|
+
(serializeType === "serialize"
|
|
180
|
+
? " as " + ((_c = type.alias) !== null && _c !== void 0 ? _c : type.name) + "Rest"
|
|
181
|
+
: "Output"));
|
|
182
|
+
}
|
|
183
|
+
else if (runtimeImports) {
|
|
184
|
+
addImportToSpecifier("modularModel", runtimeImports, type.name);
|
|
185
|
+
}
|
|
186
|
+
return typeName;
|
|
187
|
+
}
|
|
188
|
+
return types === null || types === void 0 ? void 0 : types.map((t) => {
|
|
189
|
+
var _a, _b, _c, _d, _e;
|
|
190
|
+
if (t.type === "list" && ((_a = t.elementType) === null || _a === void 0 ? void 0 : _a.type) === "model") {
|
|
191
|
+
if (fromRest && t.elementType.name && runtimeImports) {
|
|
192
|
+
addImportToSpecifier("rlcIndex", runtimeImports, ((_b = t.elementType.alias) !== null && _b !== void 0 ? _b : t.elementType.name) +
|
|
193
|
+
(serializeType === "serialize"
|
|
194
|
+
? " as " + t.elementType.name + "Rest"
|
|
195
|
+
: "Output"));
|
|
196
|
+
}
|
|
197
|
+
else if (t.elementType.name && runtimeImports) {
|
|
198
|
+
addImportToSpecifier("modularModel", runtimeImports, t.elementType.name);
|
|
199
|
+
}
|
|
200
|
+
return (((_c = t.elementType.alias) !== null && _c !== void 0 ? _c : t.elementType.name) +
|
|
201
|
+
(fromRest
|
|
202
|
+
? serializeType === "serialize"
|
|
203
|
+
? "Rest"
|
|
204
|
+
: "Output"
|
|
205
|
+
: "") +
|
|
206
|
+
"[]");
|
|
207
|
+
}
|
|
208
|
+
if (fromRest && t.name && runtimeImports) {
|
|
209
|
+
addImportToSpecifier("rlcIndex", runtimeImports, ((_d = t.alias) !== null && _d !== void 0 ? _d : t.name) +
|
|
210
|
+
(serializeType === "serialize"
|
|
211
|
+
? " as " + ((_e = t.alias) !== null && _e !== void 0 ? _e : t.name) + "Rest"
|
|
212
|
+
: "Output"));
|
|
213
|
+
}
|
|
214
|
+
else if (t.name && runtimeImports) {
|
|
215
|
+
addImportToSpecifier("modularModel", runtimeImports, t.name);
|
|
216
|
+
}
|
|
217
|
+
return t.name
|
|
218
|
+
? (fromRest && t.alias ? t.alias : t.name) +
|
|
219
|
+
(fromRest
|
|
220
|
+
? serializeType === "serialize"
|
|
221
|
+
? "Rest"
|
|
222
|
+
: "Output"
|
|
223
|
+
: "")
|
|
224
|
+
: getMappedType(t.type, fromRest);
|
|
225
|
+
}).join(" | ");
|
|
226
|
+
}
|
|
227
|
+
function getMappedType(modularType, fromRest) {
|
|
228
|
+
switch (modularType) {
|
|
229
|
+
case "datetime":
|
|
230
|
+
return fromRest ? "string" : "Date";
|
|
231
|
+
case "byte-array":
|
|
232
|
+
return fromRest ? "string" : "Uint8Array";
|
|
233
|
+
default:
|
|
234
|
+
return modularType;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function getTypeDeserializeFunction(sourceFile, type, serializeType, runtimeImports) {
|
|
238
|
+
var _a, _b, _c, _d, _e, _f;
|
|
239
|
+
const statements = [];
|
|
240
|
+
if (isSpecialHandledUnion(type)) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (type.type === "model" && type.name) {
|
|
244
|
+
addImportToSpecifier("rlcIndex", runtimeImports, `${type.name}Output`);
|
|
245
|
+
addImportToSpecifier("modularModel", runtimeImports, type.name);
|
|
246
|
+
const functionStatement = {
|
|
247
|
+
kind: StructureKind.Function,
|
|
248
|
+
docs: [`${serializeType} function for ${type.name}`],
|
|
249
|
+
name: `${serializeType}${toPascalCase(type.name)}`,
|
|
250
|
+
parameters: [{ name: "obj", type: `${type.name}Output` }],
|
|
251
|
+
returnType: type.name
|
|
252
|
+
};
|
|
253
|
+
if (type.properties) {
|
|
254
|
+
statements.push(`return {${getResponseMapping(type, "obj", runtimeImports)}};`);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
statements.push(`return {};`);
|
|
258
|
+
}
|
|
259
|
+
functionStatement.statements = statements.join("\n");
|
|
260
|
+
if (!hasDuplicateFunction(sourceFile, functionStatement)) {
|
|
261
|
+
if (sourceFile
|
|
262
|
+
.getFunctions()
|
|
263
|
+
.some((f) => f.getName() === functionStatement.name)) {
|
|
264
|
+
addOverload(sourceFile, type.name + "Output", functionStatement);
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
sourceFile.addFunction(functionStatement);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
else if (type.type === "list" &&
|
|
272
|
+
((_a = type.elementType) === null || _a === void 0 ? void 0 : _a.type) === "model" &&
|
|
273
|
+
type.elementType.name) {
|
|
274
|
+
addImportToSpecifier("rlcIndex", runtimeImports, `${type.elementType.name}Output`);
|
|
275
|
+
addImportToSpecifier("modularModel", runtimeImports, type.elementType.name);
|
|
276
|
+
const functionStatement = {
|
|
277
|
+
kind: StructureKind.Function,
|
|
278
|
+
docs: [`${serializeType} function for ${type.elementType.name} array`],
|
|
279
|
+
name: `${serializeType}${toPascalCase(type.elementType.name)}Array`,
|
|
280
|
+
parameters: [{ name: "obj", type: type.elementType.name + "Output[]" }],
|
|
281
|
+
returnType: type.elementType.name + "[]"
|
|
282
|
+
};
|
|
283
|
+
statements.push(`return (obj || []).map(item => { return {${getResponseMapping(type.elementType, "item", runtimeImports)}}})`);
|
|
284
|
+
functionStatement.statements = statements.join("\n");
|
|
285
|
+
if (!hasDuplicateFunction(sourceFile, functionStatement)) {
|
|
286
|
+
if (sourceFile
|
|
287
|
+
.getFunctions()
|
|
288
|
+
.some((f) => f.getName() === functionStatement.name)) {
|
|
289
|
+
addOverload(sourceFile, (_b = type.elementType.name) !== null && _b !== void 0 ? _b : "Output[]", functionStatement);
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
sourceFile.addFunction(functionStatement);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
else if (type.type === "datetime") {
|
|
297
|
+
const functionStatement = {
|
|
298
|
+
kind: StructureKind.Function,
|
|
299
|
+
docs: [`${serializeType} function for ${type.type}`],
|
|
300
|
+
name: `${serializeType}${toPascalCase(getMappedType(type.type) +
|
|
301
|
+
(serializeType === "deserialize" ? "Rest" : ""))}`,
|
|
302
|
+
parameters: [{ name: "obj", type: "string" }],
|
|
303
|
+
returnType: "Date"
|
|
304
|
+
};
|
|
305
|
+
statements.push(`return new Date(obj);`);
|
|
306
|
+
functionStatement.statements = statements.join("\n");
|
|
307
|
+
if (!hasDuplicateFunction(sourceFile, functionStatement)) {
|
|
308
|
+
if (sourceFile
|
|
309
|
+
.getFunctions()
|
|
310
|
+
.some((f) => f.getName() === functionStatement.name)) {
|
|
311
|
+
addOverload(sourceFile, (_c = type.name) !== null && _c !== void 0 ? _c : "", functionStatement);
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
sourceFile.addFunction(functionStatement);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
else if (type.type === "byte-array") {
|
|
319
|
+
const functionStatement = {
|
|
320
|
+
kind: StructureKind.Function,
|
|
321
|
+
docs: [`${serializeType} function for ${type.type}`],
|
|
322
|
+
name: `${serializeType}${toPascalCase(getMappedType((_d = type.name) !== null && _d !== void 0 ? _d : "byte-array") +
|
|
323
|
+
(serializeType === "deserialize" ? "Rest" : ""))}`,
|
|
324
|
+
parameters: [{ name: "obj", type: "string" }],
|
|
325
|
+
returnType: "Uint8Array"
|
|
326
|
+
};
|
|
327
|
+
statements.push(`return ${deserializeResponseValue(type, "obj", runtimeImports, true, [type], (_e = type.format) !== null && _e !== void 0 ? _e : "base64")}`);
|
|
328
|
+
functionStatement.statements = statements.join("\n");
|
|
329
|
+
if (!hasDuplicateFunction(sourceFile, functionStatement)) {
|
|
330
|
+
if (sourceFile
|
|
331
|
+
.getFunctions()
|
|
332
|
+
.some((f) => f.getName() === functionStatement.name)) {
|
|
333
|
+
addOverload(sourceFile, (_f = type.name) !== null && _f !== void 0 ? _f : "", functionStatement);
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
sourceFile.addFunction(functionStatement);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function getTypeSerializeFunction(sourceFile, type, serializeType, runtimeImports) {
|
|
342
|
+
var _a, _b, _c;
|
|
343
|
+
const statements = [];
|
|
344
|
+
if (isSpecialHandledUnion(type)) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
if (type.type === "model" && type.name) {
|
|
348
|
+
const typeName = type.name + "Rest";
|
|
349
|
+
addImportToSpecifier("rlcIndex", runtimeImports, `${type.name} as ${typeName}`);
|
|
350
|
+
addImportToSpecifier("modularModel", runtimeImports, type.name);
|
|
351
|
+
const functionStatement = {
|
|
352
|
+
kind: StructureKind.Function,
|
|
353
|
+
docs: [`${serializeType} function for ${type.name}`],
|
|
354
|
+
name: `${serializeType}${toPascalCase(type.name)}`,
|
|
355
|
+
parameters: [{ name: "obj", type: `${type.name}` }],
|
|
356
|
+
returnType: typeName
|
|
357
|
+
};
|
|
358
|
+
if (type.properties) {
|
|
359
|
+
statements.push(`return {${getRequestModelMapping(type, "obj", runtimeImports).join(", ")}};`);
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
statements.push(`return {};`);
|
|
363
|
+
}
|
|
364
|
+
functionStatement.statements = statements.join("\n");
|
|
365
|
+
if (!hasDuplicateFunction(sourceFile, functionStatement)) {
|
|
366
|
+
if (sourceFile
|
|
367
|
+
.getFunctions()
|
|
368
|
+
.some((f) => f.getName() === functionStatement.name)) {
|
|
369
|
+
addOverload(sourceFile, typeName, functionStatement);
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
sourceFile.addFunction(functionStatement);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
else if (type.type === "list" &&
|
|
377
|
+
((_a = type.elementType) === null || _a === void 0 ? void 0 : _a.type) === "model" &&
|
|
378
|
+
type.elementType.name) {
|
|
379
|
+
const typeName = type.elementType.name + "Rest";
|
|
380
|
+
addImportToSpecifier("rlcIndex", runtimeImports, `${type.elementType.name} as ${typeName}`);
|
|
381
|
+
addImportToSpecifier("modularModel", runtimeImports, type.elementType.name);
|
|
382
|
+
const functionStatement = {
|
|
383
|
+
kind: StructureKind.Function,
|
|
384
|
+
docs: [`${serializeType} function for ${type.elementType.name} array`],
|
|
385
|
+
name: `${serializeType}${toPascalCase(type.elementType.name)}Array`,
|
|
386
|
+
parameters: [{ name: "obj", type: type.elementType.name + "[]" }],
|
|
387
|
+
returnType: `${typeName}[]`
|
|
388
|
+
};
|
|
389
|
+
statements.push(`return (obj || []).map(item => { return {${getRequestModelMapping(type.elementType, "item", runtimeImports).join(", ")}}})`);
|
|
390
|
+
functionStatement.statements = statements.join("\n");
|
|
391
|
+
if (!hasDuplicateFunction(sourceFile, functionStatement)) {
|
|
392
|
+
if (sourceFile
|
|
393
|
+
.getFunctions()
|
|
394
|
+
.some((f) => f.getName() === functionStatement.name)) {
|
|
395
|
+
addOverload(sourceFile, `${typeName}[]`, functionStatement);
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
sourceFile.addFunction(functionStatement);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
else if (type.type === "datetime") {
|
|
403
|
+
const functionStatement = {
|
|
404
|
+
kind: StructureKind.Function,
|
|
405
|
+
docs: [`${serializeType} function for ${type.type}`],
|
|
406
|
+
name: `${serializeType}${toPascalCase(getMappedType(type.type) +
|
|
407
|
+
(serializeType === "deserialize" ? "Rest" : ""))}`,
|
|
408
|
+
parameters: [{ name: "obj", type: "Date" }],
|
|
409
|
+
returnType: "string"
|
|
410
|
+
};
|
|
411
|
+
statements.push(`return ${serializeRequestValue(type, "obj", runtimeImports, true)}`);
|
|
412
|
+
functionStatement.statements = statements.join("\n");
|
|
413
|
+
if (!hasDuplicateFunction(sourceFile, functionStatement)) {
|
|
414
|
+
if (sourceFile
|
|
415
|
+
.getFunctions()
|
|
416
|
+
.some((f) => f.getName() === functionStatement.name)) {
|
|
417
|
+
addOverload(sourceFile, (_b = type.name) !== null && _b !== void 0 ? _b : "", functionStatement);
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
sourceFile.addFunction(functionStatement);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
else if (type.type === "byte-array") {
|
|
425
|
+
const functionStatement = {
|
|
426
|
+
kind: StructureKind.Function,
|
|
427
|
+
docs: [`${serializeType} function for ${type.type}`],
|
|
428
|
+
name: `${serializeType}${toPascalCase(getMappedType(type.type) +
|
|
429
|
+
(serializeType === "deserialize" ? "Rest" : ""))}`,
|
|
430
|
+
parameters: [{ name: "obj", type: "Uint8Array" }],
|
|
431
|
+
returnType: "string"
|
|
432
|
+
};
|
|
433
|
+
statements.push(`return ${serializeRequestValue(type, "obj", runtimeImports, true)}`);
|
|
434
|
+
functionStatement.statements = statements.join("\n");
|
|
435
|
+
if (!hasDuplicateFunction(sourceFile, functionStatement)) {
|
|
436
|
+
if (sourceFile
|
|
437
|
+
.getFunctions()
|
|
438
|
+
.some((f) => f.getName() === functionStatement.name)) {
|
|
439
|
+
addOverload(sourceFile, (_c = type.name) !== null && _c !== void 0 ? _c : "", functionStatement);
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
sourceFile.addFunction(functionStatement);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
function addOverload(sourceFile, typeName, functionStatement) {
|
|
448
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
449
|
+
const existFunction = sourceFile.getFunction((_a = functionStatement.name) !== null && _a !== void 0 ? _a : "");
|
|
450
|
+
if (existFunction && existFunction.getOverloads().length === 0) {
|
|
451
|
+
existFunction.addOverload({
|
|
452
|
+
kind: StructureKind.FunctionOverload,
|
|
453
|
+
parameters: existFunction.getParameters().map((p) => {
|
|
454
|
+
var _a;
|
|
455
|
+
return {
|
|
456
|
+
name: p.getName(),
|
|
457
|
+
type: (_a = p.getTypeNode()) === null || _a === void 0 ? void 0 : _a.getText()
|
|
458
|
+
};
|
|
459
|
+
}),
|
|
460
|
+
returnType: (_b = existFunction.getReturnTypeNode()) === null || _b === void 0 ? void 0 : _b.getText(),
|
|
461
|
+
docs: existFunction.getJsDocs().map((d) => {
|
|
462
|
+
return { description: d.getInnerText() };
|
|
463
|
+
})
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
existFunction === null || existFunction === void 0 ? void 0 : existFunction.addOverload({
|
|
467
|
+
kind: StructureKind.FunctionOverload,
|
|
468
|
+
parameters: [
|
|
469
|
+
{
|
|
470
|
+
name: "obj",
|
|
471
|
+
type: typeName
|
|
472
|
+
}
|
|
473
|
+
],
|
|
474
|
+
docs: functionStatement.docs,
|
|
475
|
+
returnType: functionStatement.returnType
|
|
476
|
+
});
|
|
477
|
+
const implementationParameter = (_d = sourceFile
|
|
478
|
+
.getFunction((_c = functionStatement.name) !== null && _c !== void 0 ? _c : "")) === null || _d === void 0 ? void 0 : _d.getParameters();
|
|
479
|
+
if (implementationParameter && implementationParameter.length > 0) {
|
|
480
|
+
const oldTypes = (_f = (_e = implementationParameter[0]) === null || _e === void 0 ? void 0 : _e.getTypeNode()) === null || _f === void 0 ? void 0 : _f.getText().split(" | ");
|
|
481
|
+
const newTypes = typeName.split(" | ").concat(oldTypes !== null && oldTypes !== void 0 ? oldTypes : []);
|
|
482
|
+
const newTypeSet = new Set(newTypes);
|
|
483
|
+
(_g = implementationParameter[0]) === null || _g === void 0 ? void 0 : _g.setType(Array.from(newTypeSet).join(" | "));
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
function hasDuplicateFunction(sourceFile, functionStatement) {
|
|
487
|
+
return sourceFile.getFunctions().some((f) => {
|
|
488
|
+
var _a, _b;
|
|
489
|
+
const paramTypes = f.getParameters().map((param) => {
|
|
490
|
+
return param.getName() + param.getType().getText();
|
|
491
|
+
});
|
|
492
|
+
const funcParamTypes = (_a = functionStatement.parameters) === null || _a === void 0 ? void 0 : _a.map((param) => {
|
|
493
|
+
return param.name + param.type;
|
|
494
|
+
});
|
|
495
|
+
return (f.getName() === functionStatement.name &&
|
|
496
|
+
paramTypes.join().includes((_b = funcParamTypes === null || funcParamTypes === void 0 ? void 0 : funcParamTypes.join()) !== null && _b !== void 0 ? _b : ""));
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
function deserializeUnionTypesFunction(sourceFile, unionDeserializeTypes, deserializeFunctionName, serializeType, typeUnionNamesOutput, typeUnionNames, discriminator, isPolymorphicBaseModel) {
|
|
500
|
+
var _a, _b, _c, _d;
|
|
501
|
+
const functionStatement = {
|
|
502
|
+
kind: StructureKind.Function,
|
|
503
|
+
docs: [`${serializeType} function for ${typeUnionNamesOutput}`],
|
|
504
|
+
name: deserializeFunctionName,
|
|
505
|
+
parameters: [{ name: "obj", type: typeUnionNamesOutput }],
|
|
506
|
+
returnType: typeUnionNames,
|
|
507
|
+
isExported: true
|
|
508
|
+
};
|
|
509
|
+
const statements = [];
|
|
510
|
+
statements.push(`switch (obj.${discriminator}) {`);
|
|
511
|
+
for (const type of unionDeserializeTypes) {
|
|
512
|
+
const functionName = toPascalCase((_a = type.name) !== null && _a !== void 0 ? _a : (((_b = type.elementType) === null || _b === void 0 ? void 0 : _b.name)
|
|
513
|
+
? type.elementType.name + "Array"
|
|
514
|
+
: getMappedType(type.type) +
|
|
515
|
+
(serializeType === "deserialize" ? "Rest" : "")));
|
|
516
|
+
statements.push(`case "${type.discriminatorValue}": return ${serializeType}${functionName}(obj${isPolymorphicBaseModel
|
|
517
|
+
? " as " + ((_c = type.name) !== null && _c !== void 0 ? _c : ((_d = type.elementType) === null || _d === void 0 ? void 0 : _d.name) + "[]")
|
|
518
|
+
: ""}); `);
|
|
519
|
+
}
|
|
520
|
+
statements.push("default: return obj; }");
|
|
521
|
+
functionStatement.statements = statements.join("\n");
|
|
522
|
+
if (!hasDuplicateFunction(sourceFile, functionStatement)) {
|
|
523
|
+
sourceFile.addFunction(functionStatement);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
//# sourceMappingURL=buildSerializeUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildSerializeUtils.js","sourceRoot":"","sources":["../../../src/modular/buildSerializeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,eAAe,EAChB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAGL,aAAa,EACd,MAAM,UAAU,CAAC;AAClB,OAAO,EAEL,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAuB;IACzD,MAAM,kBAAkB,GAAG,EAAE,CAAC;IAC9B,KAAK,MAAM,aAAa,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,EAAE;QACxD,MAAM,cAAc,GAClB,aAAa,KAAK,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;QACvE,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CACtC,CAAC,CAAC,EAAE,EAAE,WAAC,OAAA,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,MAAA,CAAC,CAAC,KAAK,mCAAI,CAAC,CAAC,GAAG,cAAc,CAAA,EAAA,CACnE,CAAC;QACF,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,SAAS;SACV;QACD,eAAe,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACtC,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAC9C,GAAG,KAAK,CAAC,cAAc,CAAC,UAAU,UAAU,aAAa,SAAS,CACnE,CAAC;QAEF,aAAa,CAAC,OAAO,CAAC,CA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D,UAAU,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;KAC3C;AACH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FunctionDeclarationStructure, OptionalKind } from "ts-morph";
|
|
2
|
-
import { Client, ModularCodeModel, Operation, Property, Type } from "../modularCodeModel.js";
|
|
2
|
+
import { Client, ModularCodeModel, Operation, Parameter, Property, Type } from "../modularCodeModel.js";
|
|
3
3
|
import { Imports as RuntimeImports } from "@azure-tools/rlc-common";
|
|
4
4
|
import { SdkContext } from "@azure-tools/typespec-client-generator-core";
|
|
5
5
|
export declare function getSendPrivateFunction(dpgContext: SdkContext, operation: Operation, clientType: string, runtimeImports: RuntimeImports): OptionalKind<FunctionDeclarationStructure>;
|
|
@@ -9,15 +9,38 @@ export declare function getDeserializePrivateFunction(operation: Operation, need
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function getOperationFunction(operation: Operation, clientType: string): OptionalKind<FunctionDeclarationStructure>;
|
|
11
11
|
export declare function getOperationOptionsName(operation: Operation, includeGroupName?: boolean): string;
|
|
12
|
+
/**
|
|
13
|
+
* This function helps with renames, translating client names to rest api names
|
|
14
|
+
*/
|
|
15
|
+
export declare function getParameterMap(param: Parameter | Property, runtimeImports: RuntimeImports): string;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* This function helps translating an HLC request to RLC request,
|
|
19
|
+
* extracting properties from body and headers and building the RLC response object
|
|
20
|
+
*/
|
|
21
|
+
export declare function getRequestModelMapping(modelPropertyType: Type, propertyPath: string | undefined, runtimeImports: RuntimeImports, typeStack?: Type[]): string[];
|
|
12
22
|
/**
|
|
13
23
|
* This function helps translating an RLC response to an HLC response,
|
|
14
24
|
* extracting properties from body and headers and building the HLC response object
|
|
15
25
|
*/
|
|
16
26
|
export declare function getResponseMapping(type: Type, propertyPath: string | undefined, runtimeImports: RuntimeImports, typeStack?: Type[]): string[];
|
|
17
|
-
|
|
27
|
+
/**
|
|
28
|
+
* This function helps converting strings into JS complex types recursively.
|
|
29
|
+
* We need to drill down into Array elements to make sure that the element type is
|
|
30
|
+
* deserialized correctly
|
|
31
|
+
*/
|
|
32
|
+
export declare function deserializeResponseValue(type: Type, restValue: string, runtimeImports: RuntimeImports, required: boolean, typeStack?: Type[], format?: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* This function helps converting strings into JS complex types recursively.
|
|
35
|
+
* We need to drill down into Array elements to make sure that the element type is
|
|
36
|
+
* deserialized correctly
|
|
37
|
+
*/
|
|
38
|
+
export declare function serializeRequestValue(type: Type, clientValue: string, runtimeImports: RuntimeImports, required: boolean, typeStack?: Type[], format?: string): string;
|
|
39
|
+
export declare function hasLROOperation(codeModel: ModularCodeModel, needRLC?: boolean): boolean;
|
|
18
40
|
export declare function isLROOperation(op: Operation): boolean;
|
|
19
|
-
export declare function hasPagingOperation(client: Client): boolean;
|
|
20
|
-
export declare function hasPagingOperation(codeModel: ModularCodeModel): boolean;
|
|
41
|
+
export declare function hasPagingOperation(client: Client, needRLC?: boolean): boolean;
|
|
42
|
+
export declare function hasPagingOperation(codeModel: ModularCodeModel, needRLC?: boolean): boolean;
|
|
21
43
|
export declare function isPagingOperation(op: Operation): boolean;
|
|
22
44
|
export declare function getAllProperties(type: Type, parents?: Type[]): Property[];
|
|
45
|
+
export declare function getAllAncestors(type: Type): Type[];
|
|
23
46
|
//# sourceMappingURL=operationHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operationHelpers.d.ts","sourceRoot":"","sources":["../../../../src/modular/helpers/operationHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,YAAY,EAEb,MAAM,UAAU,CAAC;AAElB,OAAO,EAEL,MAAM,EACN,gBAAgB,EAChB,SAAS,
|
|
1
|
+
{"version":3,"file":"operationHelpers.d.ts","sourceRoot":"","sources":["../../../../src/modular/helpers/operationHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,Y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