zod-codegen 1.6.1 → 1.6.2
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/.github/workflows/ci.yml +1 -1
- package/CHANGELOG.md +5 -0
- package/dist/src/services/code-generator.service.d.ts.map +1 -1
- package/dist/src/services/code-generator.service.js +17 -19
- package/examples/petstore/type.ts +10 -8
- package/generated/type.ts +7 -4
- package/package.json +11 -13
- package/src/services/code-generator.service.ts +142 -114
package/.github/workflows/ci.yml
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## <small>1.6.2 (2026-01-19)</small>
|
|
2
|
+
|
|
3
|
+
- fix: improve URL construction and filter undefined query params (#58) ([b9c3d32](https://github.com/julienandreu/zod-codegen/commit/b9c3d32)), closes [#58](https://github.com/julienandreu/zod-codegen/issues/58)
|
|
4
|
+
- chore(deps): bump the dev-dependencies group across 1 directory with 5 updates (#57) ([30110fd](https://github.com/julienandreu/zod-codegen/commit/30110fd)), closes [#57](https://github.com/julienandreu/zod-codegen/issues/57)
|
|
5
|
+
|
|
1
6
|
## <small>1.6.1 (2026-01-09)</small>
|
|
2
7
|
|
|
3
8
|
- Merge pull request #55 from julienandreu/fix/integration-tests-timeout ([1e48796](https://github.com/julienandreu/zod-codegen/commit/1e48796)), closes [#55](https://github.com/julienandreu/zod-codegen/issues/55)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-generator.service.d.ts","sourceRoot":"","sources":["../../../src/services/code-generator.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,8BAA8B,CAAC;AAC/E,OAAO,KAAK,EAAmB,eAAe,EAAgB,MAAM,kBAAkB,CAAC;AACvF,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAWjE,qBAAa,8BAA+B,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AAO,CAAC,oBAAoB;IAyE5B,OAAO,CAAC,8BAA8B;IActC,OAAO,CAAC,wBAAwB;IAyBhC,OAAO,CAAC,yBAAyB;IA8BjC,OAAO,CAAC,wBAAwB;IAYhC,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,kBAAkB;IA8B1B;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAmB3B;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IAiFlC,OAAO,CAAC,eAAe;CAuCxB"}
|
|
@@ -161,22 +161,26 @@ export class TypeScriptCodeGeneratorService {
|
|
|
161
161
|
], ts.factory.createTypeReferenceNode(ts.factory.createIdentifier('Promise'), [
|
|
162
162
|
ts.factory.createTypeReferenceNode(ts.factory.createIdentifier('T'), undefined),
|
|
163
163
|
]), ts.factory.createBlock([
|
|
164
|
-
//
|
|
164
|
+
// Create initial URL object that we will use to build the final URL
|
|
165
165
|
ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList([
|
|
166
|
-
ts.factory.createVariableDeclaration(ts.factory.createIdentifier('baseUrl'), undefined, undefined, ts.factory.
|
|
167
|
-
ts.factory.
|
|
168
|
-
ts.factory.
|
|
166
|
+
ts.factory.createVariableDeclaration(ts.factory.createIdentifier('baseUrl'), undefined, undefined, ts.factory.createNewExpression(ts.factory.createIdentifier('URL'), undefined, [
|
|
167
|
+
ts.factory.createIdentifier('path'),
|
|
168
|
+
ts.factory.createPropertyAccessExpression(ts.factory.createThis(), ts.factory.createPrivateIdentifier('#baseUrl')),
|
|
169
169
|
])),
|
|
170
170
|
], ts.NodeFlags.Const)),
|
|
171
171
|
ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList([
|
|
172
172
|
ts.factory.createVariableDeclaration(ts.factory.createIdentifier('url'), undefined, undefined, ts.factory.createConditionalExpression(ts.factory.createBinaryExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('options'), ts.factory.createIdentifier('params')), ts.factory.createToken(ts.SyntaxKind.AmpersandAmpersandToken), ts.factory.createBinaryExpression(ts.factory.createPropertyAccessExpression(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('Object'), ts.factory.createIdentifier('keys')), undefined, [
|
|
173
173
|
ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('options'), ts.factory.createIdentifier('params')),
|
|
174
|
-
]), ts.factory.createIdentifier('length')), ts.factory.createToken(ts.SyntaxKind.GreaterThanToken), ts.factory.createNumericLiteral('0'))), undefined, (()
|
|
175
|
-
|
|
176
|
-
ts.factory.createIdentifier('baseUrl'),
|
|
177
|
-
]);
|
|
178
|
-
const forEachCall = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('Object'), ts.factory.createIdentifier('entries')), undefined, [
|
|
174
|
+
]), ts.factory.createIdentifier('length')), ts.factory.createToken(ts.SyntaxKind.GreaterThanToken), ts.factory.createNumericLiteral('0'))), undefined, ts.factory.createCallExpression(ts.factory.createParenthesizedExpression(ts.factory.createArrowFunction(undefined, undefined, [], undefined, ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), ts.factory.createBlock([
|
|
175
|
+
ts.factory.createExpressionStatement(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('Object'), ts.factory.createIdentifier('entries')), undefined, [
|
|
179
176
|
ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('options'), ts.factory.createIdentifier('params')),
|
|
177
|
+
]), ts.factory.createIdentifier('filter')), undefined, [
|
|
178
|
+
ts.factory.createArrowFunction(undefined, undefined, [
|
|
179
|
+
ts.factory.createParameterDeclaration(undefined, undefined, ts.factory.createArrayBindingPattern([
|
|
180
|
+
ts.factory.createBindingElement(undefined, undefined, ts.factory.createIdentifier(''), undefined),
|
|
181
|
+
ts.factory.createBindingElement(undefined, undefined, ts.factory.createIdentifier('value'), undefined),
|
|
182
|
+
]), undefined, undefined),
|
|
183
|
+
], undefined, ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), ts.factory.createBinaryExpression(ts.factory.createIdentifier('value'), ts.SyntaxKind.ExclamationEqualsEqualsToken, ts.factory.createIdentifier('undefined'))),
|
|
180
184
|
]), ts.factory.createIdentifier('forEach')), undefined, [
|
|
181
185
|
ts.factory.createArrowFunction(undefined, undefined, [
|
|
182
186
|
ts.factory.createParameterDeclaration(undefined, undefined, ts.factory.createArrayBindingPattern([
|
|
@@ -184,20 +188,14 @@ export class TypeScriptCodeGeneratorService {
|
|
|
184
188
|
ts.factory.createBindingElement(undefined, undefined, ts.factory.createIdentifier('value'), undefined),
|
|
185
189
|
]), undefined, undefined),
|
|
186
190
|
], undefined, ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), ts.factory.createBlock([
|
|
187
|
-
ts.factory.createExpressionStatement(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createPropertyAccessExpression(
|
|
191
|
+
ts.factory.createExpressionStatement(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('baseUrl'), ts.factory.createIdentifier('searchParams')), ts.factory.createIdentifier('set')), undefined, [
|
|
188
192
|
ts.factory.createIdentifier('key'),
|
|
189
193
|
ts.factory.createCallExpression(ts.factory.createIdentifier('String'), undefined, [ts.factory.createIdentifier('value')]),
|
|
190
194
|
])),
|
|
191
195
|
], false)),
|
|
192
|
-
])
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
ts.factory.createExpressionStatement(forEachCall),
|
|
196
|
-
ts.factory.createReturnStatement(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(urlObj, ts.factory.createIdentifier('toString')), undefined, [])),
|
|
197
|
-
], false))), undefined, []);
|
|
198
|
-
})(), undefined, ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createNewExpression(ts.factory.createIdentifier('URL'), undefined, [
|
|
199
|
-
ts.factory.createIdentifier('baseUrl'),
|
|
200
|
-
]), ts.factory.createIdentifier('toString')), undefined, []))),
|
|
196
|
+
])),
|
|
197
|
+
ts.factory.createReturnStatement(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('baseUrl'), ts.factory.createIdentifier('toString')), undefined, [])),
|
|
198
|
+
], true))), undefined, []), undefined, ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('baseUrl'), ts.factory.createIdentifier('toString')), undefined, []))),
|
|
201
199
|
], ts.NodeFlags.Const)),
|
|
202
200
|
// Get base request options (headers, signal, credentials, etc.)
|
|
203
201
|
ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList([
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
2
|
-
// Built with zod-codegen@1.
|
|
3
|
-
// Latest edit:
|
|
2
|
+
// Built with zod-codegen@1.6.1
|
|
3
|
+
// Latest edit: Mon, 19 Jan 2026 14:27:35 GMT
|
|
4
4
|
// Source file: ./samples/swagger-petstore.yaml
|
|
5
5
|
/* eslint-disable */
|
|
6
6
|
// @ts-nocheck
|
|
@@ -126,16 +126,18 @@ export default class SwaggerPetstoreOpenAPI30 {
|
|
|
126
126
|
path: string,
|
|
127
127
|
options: _params___Record_string__string___number___boolean___data___unknown__contentType___string__headers___Record_string__string__ = {},
|
|
128
128
|
): Promise<T> {
|
|
129
|
-
const baseUrl =
|
|
129
|
+
const baseUrl = new URL(path, this.#baseUrl);
|
|
130
130
|
const url =
|
|
131
131
|
options.params && Object.keys(options.params).length > 0
|
|
132
132
|
? (() => {
|
|
133
|
-
Object.entries(options.params)
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
Object.entries(options.params)
|
|
134
|
+
.filter(([, value]) => value !== undefined)
|
|
135
|
+
.forEach(([key, value]) => {
|
|
136
|
+
baseUrl.searchParams.set(key, String(value));
|
|
137
|
+
});
|
|
138
|
+
return baseUrl.toString();
|
|
137
139
|
})()
|
|
138
|
-
:
|
|
140
|
+
: baseUrl.toString();
|
|
139
141
|
const baseOptions = this.getBaseRequestOptions();
|
|
140
142
|
const contentType =
|
|
141
143
|
options.contentType === 'application/x-www-form-urlencoded'
|
package/generated/type.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
2
|
-
// Built with zod-codegen@1.6.
|
|
3
|
-
// Latest edit:
|
|
2
|
+
// Built with zod-codegen@1.6.2
|
|
3
|
+
// Latest edit: Mon, 19 Jan 2026 15:14:43 GMT
|
|
4
4
|
// Source file: ./samples/swagger-petstore.yaml
|
|
5
5
|
/* eslint-disable */
|
|
6
6
|
// @ts-nocheck
|
|
@@ -114,8 +114,11 @@ export default class SwaggerPetstoreOpenAPI30 {
|
|
|
114
114
|
return response;
|
|
115
115
|
}
|
|
116
116
|
protected async makeRequest<T>(method: string, path: string, options: _params___Record_string__string___number___boolean___data___unknown__contentType___string__headers___Record_string__string__ = {}): Promise<T> {
|
|
117
|
-
const baseUrl =
|
|
118
|
-
const url = options.params && Object.keys(options.params).length > 0 ? (() => {
|
|
117
|
+
const baseUrl = new URL(path, this.#baseUrl);
|
|
118
|
+
const url = options.params && Object.keys(options.params).length > 0 ? (() => {
|
|
119
|
+
Object.entries(options.params).filter(([, value]) => value !== undefined).forEach(([key, value]) => { baseUrl.searchParams.set(key, String(value)); });
|
|
120
|
+
return baseUrl.toString();
|
|
121
|
+
})() : baseUrl.toString();
|
|
119
122
|
const baseOptions = this.getBaseRequestOptions();
|
|
120
123
|
const contentType = options.contentType === 'application/x-www-form-urlencoded' ? 'application/x-www-form-urlencoded' : 'application/json';
|
|
121
124
|
const baseHeaders = baseOptions.headers !== undefined ? baseOptions.headers : {};
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"openapi-types": "^12.1.3",
|
|
14
14
|
"openapi-typescript": "^7.10.1",
|
|
15
15
|
"path-to-regexp": "^8.3.0",
|
|
16
|
-
"prettier": "^3.
|
|
16
|
+
"prettier": "^3.8.0",
|
|
17
17
|
"typescript": "^5.9.3",
|
|
18
18
|
"url-pattern": "^1.0.3",
|
|
19
19
|
"yargs": "^18.0.0",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"@types/jest": "^30.0.0",
|
|
42
42
|
"@types/js-yaml": "^4.0.9",
|
|
43
43
|
"@types/jsonpath": "^0.2.4",
|
|
44
|
-
"@types/node": "^25.0.
|
|
44
|
+
"@types/node": "^25.0.9",
|
|
45
45
|
"@types/yargs": "^17.0.35",
|
|
46
|
-
"@vitest/coverage-v8": "^4.0.
|
|
46
|
+
"@vitest/coverage-v8": "^4.0.17",
|
|
47
47
|
"cross-env": "^10.1.0",
|
|
48
48
|
"eslint": "^9.39.2",
|
|
49
49
|
"eslint-config-prettier": "^10.1.8",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"lint-staged": "^16.2.7",
|
|
52
52
|
"semantic-release": "^25.0.2",
|
|
53
53
|
"ts-node": "^10.9.2",
|
|
54
|
-
"typescript-eslint": "^8.
|
|
55
|
-
"undici": "^7.
|
|
54
|
+
"typescript-eslint": "^8.53.0",
|
|
55
|
+
"undici": "^7.18.2",
|
|
56
56
|
"vitest": "^4.0.14"
|
|
57
57
|
},
|
|
58
58
|
"homepage": "https://github.com/julienandreu/zod-codegen",
|
|
@@ -75,13 +75,11 @@
|
|
|
75
75
|
"node": ">=18.0.0"
|
|
76
76
|
},
|
|
77
77
|
"overrides": {
|
|
78
|
-
"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
"tar": "^7.5.2",
|
|
84
|
-
"yargs": "^18.0.0"
|
|
78
|
+
"tar": "^7.5.3",
|
|
79
|
+
"diff": "^8.0.3",
|
|
80
|
+
"@actions/http-client": {
|
|
81
|
+
"undici": "^7.18.0"
|
|
82
|
+
}
|
|
85
83
|
},
|
|
86
84
|
"scripts": {
|
|
87
85
|
"audit:fix": "npm audit fix",
|
|
@@ -107,5 +105,5 @@
|
|
|
107
105
|
"release": "semantic-release",
|
|
108
106
|
"release:dry": "semantic-release --dry-run"
|
|
109
107
|
},
|
|
110
|
-
"version": "1.6.
|
|
108
|
+
"version": "1.6.2"
|
|
111
109
|
}
|
|
@@ -336,7 +336,7 @@ export class TypeScriptCodeGeneratorService implements CodeGenerator, SchemaBuil
|
|
|
336
336
|
]),
|
|
337
337
|
ts.factory.createBlock(
|
|
338
338
|
[
|
|
339
|
-
//
|
|
339
|
+
// Create initial URL object that we will use to build the final URL
|
|
340
340
|
ts.factory.createVariableStatement(
|
|
341
341
|
undefined,
|
|
342
342
|
ts.factory.createVariableDeclarationList(
|
|
@@ -345,17 +345,11 @@ export class TypeScriptCodeGeneratorService implements CodeGenerator, SchemaBuil
|
|
|
345
345
|
ts.factory.createIdentifier('baseUrl'),
|
|
346
346
|
undefined,
|
|
347
347
|
undefined,
|
|
348
|
-
ts.factory.
|
|
349
|
-
ts.factory.
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
),
|
|
354
|
-
ts.factory.createTemplateMiddle('', ''),
|
|
355
|
-
),
|
|
356
|
-
ts.factory.createTemplateSpan(
|
|
357
|
-
ts.factory.createIdentifier('path'),
|
|
358
|
-
ts.factory.createTemplateTail('', ''),
|
|
348
|
+
ts.factory.createNewExpression(ts.factory.createIdentifier('URL'), undefined, [
|
|
349
|
+
ts.factory.createIdentifier('path'),
|
|
350
|
+
ts.factory.createPropertyAccessExpression(
|
|
351
|
+
ts.factory.createThis(),
|
|
352
|
+
ts.factory.createPrivateIdentifier('#baseUrl'),
|
|
359
353
|
),
|
|
360
354
|
]),
|
|
361
355
|
),
|
|
@@ -400,121 +394,155 @@ export class TypeScriptCodeGeneratorService implements CodeGenerator, SchemaBuil
|
|
|
400
394
|
),
|
|
401
395
|
),
|
|
402
396
|
undefined,
|
|
403
|
-
(
|
|
404
|
-
|
|
405
|
-
ts.factory.
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
ts.factory.createIdentifier('entries'),
|
|
413
|
-
),
|
|
414
|
-
undefined,
|
|
415
|
-
[
|
|
416
|
-
ts.factory.createPropertyAccessExpression(
|
|
417
|
-
ts.factory.createIdentifier('options'),
|
|
418
|
-
ts.factory.createIdentifier('params'),
|
|
419
|
-
),
|
|
420
|
-
],
|
|
421
|
-
),
|
|
422
|
-
ts.factory.createIdentifier('forEach'),
|
|
423
|
-
),
|
|
424
|
-
undefined,
|
|
425
|
-
[
|
|
426
|
-
ts.factory.createArrowFunction(
|
|
427
|
-
undefined,
|
|
428
|
-
undefined,
|
|
397
|
+
ts.factory.createCallExpression(
|
|
398
|
+
ts.factory.createParenthesizedExpression(
|
|
399
|
+
ts.factory.createArrowFunction(
|
|
400
|
+
undefined,
|
|
401
|
+
undefined,
|
|
402
|
+
[],
|
|
403
|
+
undefined,
|
|
404
|
+
ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken),
|
|
405
|
+
ts.factory.createBlock(
|
|
429
406
|
[
|
|
430
|
-
ts.factory.
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
ts.factory.createBindingElement(
|
|
435
|
-
undefined,
|
|
436
|
-
undefined,
|
|
437
|
-
ts.factory.createIdentifier('key'),
|
|
438
|
-
undefined,
|
|
439
|
-
),
|
|
440
|
-
ts.factory.createBindingElement(
|
|
441
|
-
undefined,
|
|
442
|
-
undefined,
|
|
443
|
-
ts.factory.createIdentifier('value'),
|
|
444
|
-
undefined,
|
|
445
|
-
),
|
|
446
|
-
]),
|
|
447
|
-
undefined,
|
|
448
|
-
undefined,
|
|
449
|
-
),
|
|
450
|
-
],
|
|
451
|
-
undefined,
|
|
452
|
-
ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken),
|
|
453
|
-
ts.factory.createBlock(
|
|
454
|
-
[
|
|
455
|
-
ts.factory.createExpressionStatement(
|
|
456
|
-
ts.factory.createCallExpression(
|
|
457
|
-
ts.factory.createPropertyAccessExpression(
|
|
407
|
+
ts.factory.createExpressionStatement(
|
|
408
|
+
ts.factory.createCallExpression(
|
|
409
|
+
ts.factory.createPropertyAccessExpression(
|
|
410
|
+
ts.factory.createCallExpression(
|
|
458
411
|
ts.factory.createPropertyAccessExpression(
|
|
459
|
-
|
|
460
|
-
|
|
412
|
+
ts.factory.createCallExpression(
|
|
413
|
+
ts.factory.createPropertyAccessExpression(
|
|
414
|
+
ts.factory.createIdentifier('Object'),
|
|
415
|
+
ts.factory.createIdentifier('entries'),
|
|
416
|
+
),
|
|
417
|
+
undefined,
|
|
418
|
+
[
|
|
419
|
+
ts.factory.createPropertyAccessExpression(
|
|
420
|
+
ts.factory.createIdentifier('options'),
|
|
421
|
+
ts.factory.createIdentifier('params'),
|
|
422
|
+
),
|
|
423
|
+
],
|
|
424
|
+
),
|
|
425
|
+
ts.factory.createIdentifier('filter'),
|
|
461
426
|
),
|
|
462
|
-
|
|
427
|
+
undefined,
|
|
428
|
+
[
|
|
429
|
+
ts.factory.createArrowFunction(
|
|
430
|
+
undefined,
|
|
431
|
+
undefined,
|
|
432
|
+
[
|
|
433
|
+
ts.factory.createParameterDeclaration(
|
|
434
|
+
undefined,
|
|
435
|
+
undefined,
|
|
436
|
+
ts.factory.createArrayBindingPattern([
|
|
437
|
+
ts.factory.createBindingElement(
|
|
438
|
+
undefined,
|
|
439
|
+
undefined,
|
|
440
|
+
ts.factory.createIdentifier(''),
|
|
441
|
+
undefined,
|
|
442
|
+
),
|
|
443
|
+
ts.factory.createBindingElement(
|
|
444
|
+
undefined,
|
|
445
|
+
undefined,
|
|
446
|
+
ts.factory.createIdentifier('value'),
|
|
447
|
+
undefined,
|
|
448
|
+
),
|
|
449
|
+
]),
|
|
450
|
+
undefined,
|
|
451
|
+
undefined,
|
|
452
|
+
),
|
|
453
|
+
],
|
|
454
|
+
undefined,
|
|
455
|
+
ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken),
|
|
456
|
+
ts.factory.createBinaryExpression(
|
|
457
|
+
ts.factory.createIdentifier('value'),
|
|
458
|
+
ts.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
459
|
+
ts.factory.createIdentifier('undefined'),
|
|
460
|
+
),
|
|
461
|
+
),
|
|
462
|
+
],
|
|
463
463
|
),
|
|
464
|
-
|
|
465
|
-
[
|
|
466
|
-
ts.factory.createIdentifier('key'),
|
|
467
|
-
ts.factory.createCallExpression(
|
|
468
|
-
ts.factory.createIdentifier('String'),
|
|
469
|
-
undefined,
|
|
470
|
-
[ts.factory.createIdentifier('value')],
|
|
471
|
-
),
|
|
472
|
-
],
|
|
464
|
+
ts.factory.createIdentifier('forEach'),
|
|
473
465
|
),
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
466
|
+
undefined,
|
|
467
|
+
[
|
|
468
|
+
ts.factory.createArrowFunction(
|
|
469
|
+
undefined,
|
|
470
|
+
undefined,
|
|
471
|
+
[
|
|
472
|
+
ts.factory.createParameterDeclaration(
|
|
473
|
+
undefined,
|
|
474
|
+
undefined,
|
|
475
|
+
ts.factory.createArrayBindingPattern([
|
|
476
|
+
ts.factory.createBindingElement(
|
|
477
|
+
undefined,
|
|
478
|
+
undefined,
|
|
479
|
+
ts.factory.createIdentifier('key'),
|
|
480
|
+
undefined,
|
|
481
|
+
),
|
|
482
|
+
ts.factory.createBindingElement(
|
|
483
|
+
undefined,
|
|
484
|
+
undefined,
|
|
485
|
+
ts.factory.createIdentifier('value'),
|
|
486
|
+
undefined,
|
|
487
|
+
),
|
|
488
|
+
]),
|
|
489
|
+
undefined,
|
|
490
|
+
undefined,
|
|
491
|
+
),
|
|
492
|
+
],
|
|
493
|
+
undefined,
|
|
494
|
+
ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken),
|
|
495
|
+
ts.factory.createBlock(
|
|
496
|
+
[
|
|
497
|
+
ts.factory.createExpressionStatement(
|
|
498
|
+
ts.factory.createCallExpression(
|
|
499
|
+
ts.factory.createPropertyAccessExpression(
|
|
500
|
+
ts.factory.createPropertyAccessExpression(
|
|
501
|
+
ts.factory.createIdentifier('baseUrl'),
|
|
502
|
+
ts.factory.createIdentifier('searchParams'),
|
|
503
|
+
),
|
|
504
|
+
ts.factory.createIdentifier('set'),
|
|
505
|
+
),
|
|
506
|
+
undefined,
|
|
507
|
+
[
|
|
508
|
+
ts.factory.createIdentifier('key'),
|
|
509
|
+
ts.factory.createCallExpression(
|
|
510
|
+
ts.factory.createIdentifier('String'),
|
|
511
|
+
undefined,
|
|
512
|
+
[ts.factory.createIdentifier('value')],
|
|
513
|
+
),
|
|
514
|
+
],
|
|
515
|
+
),
|
|
516
|
+
),
|
|
517
|
+
],
|
|
518
|
+
false,
|
|
519
|
+
),
|
|
498
520
|
),
|
|
499
|
-
|
|
500
|
-
|
|
521
|
+
],
|
|
522
|
+
),
|
|
523
|
+
),
|
|
524
|
+
ts.factory.createReturnStatement(
|
|
525
|
+
ts.factory.createCallExpression(
|
|
526
|
+
ts.factory.createPropertyAccessExpression(
|
|
527
|
+
ts.factory.createIdentifier('baseUrl'),
|
|
528
|
+
ts.factory.createIdentifier('toString'),
|
|
501
529
|
),
|
|
530
|
+
undefined,
|
|
531
|
+
[],
|
|
502
532
|
),
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
533
|
+
),
|
|
534
|
+
],
|
|
535
|
+
true,
|
|
506
536
|
),
|
|
507
537
|
),
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
538
|
+
),
|
|
539
|
+
undefined,
|
|
540
|
+
[],
|
|
541
|
+
),
|
|
512
542
|
undefined,
|
|
513
543
|
ts.factory.createCallExpression(
|
|
514
544
|
ts.factory.createPropertyAccessExpression(
|
|
515
|
-
ts.factory.
|
|
516
|
-
ts.factory.createIdentifier('baseUrl'),
|
|
517
|
-
]),
|
|
545
|
+
ts.factory.createIdentifier('baseUrl'),
|
|
518
546
|
ts.factory.createIdentifier('toString'),
|
|
519
547
|
),
|
|
520
548
|
undefined,
|