@azure-tools/typespec-ts 0.53.2 → 0.53.3-alpha.20260526.1
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 +9 -0
- package/dist/src/framework/hooks/binder.js +2 -2
- package/dist/src/framework/hooks/binder.js.map +1 -1
- package/dist/src/framework/load-static-helpers.js +1 -1
- package/dist/src/framework/load-static-helpers.js.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.js +4 -3
- package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
- package/dist/src/utils/operationUtil.d.ts +1 -1
- package/dist/src/utils/operationUtil.d.ts.map +1 -1
- package/dist/src/utils/operationUtil.js +5 -1
- package/dist/src/utils/operationUtil.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/framework/hooks/binder.ts +2 -2
- package/src/framework/load-static-helpers.ts +1 -1
- package/src/modular/helpers/operationHelpers.ts +16 -3
- package/src/utils/operationUtil.ts +8 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-ts",
|
|
3
|
-
"version": "0.53.
|
|
3
|
+
"version": "0.53.3-alpha.20260526.1",
|
|
4
4
|
"description": "An experimental TypeSpec emitter for TypeScript RLC",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"@typespec/spector": "0.1.0-dev.4",
|
|
23
23
|
"@typespec/spec-api": "0.1.0-dev.3",
|
|
24
24
|
"@typespec/tspd": "0.74.2",
|
|
25
|
-
"@azure-tools/azure-http-specs": "0.1.0-alpha.41-dev.
|
|
25
|
+
"@azure-tools/azure-http-specs": "0.1.0-alpha.41-dev.1",
|
|
26
26
|
"@azure-tools/typespec-autorest": "^0.68.0",
|
|
27
27
|
"@azure-tools/typespec-azure-core": "^0.68.0",
|
|
28
28
|
"@azure-tools/typespec-azure-resource-manager": "^0.68.0",
|
|
29
|
-
"@azure-tools/typespec-client-generator-core": "^0.68.
|
|
29
|
+
"@azure-tools/typespec-client-generator-core": "^0.68.2",
|
|
30
30
|
"@azure/abort-controller": "^2.1.2",
|
|
31
31
|
"@azure/core-auth": "^1.6.0",
|
|
32
32
|
"@azure/core-lro": "^3.1.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"@azure-tools/typespec-azure-core": "^0.68.0",
|
|
68
|
-
"@azure-tools/typespec-client-generator-core": "^0.68.
|
|
68
|
+
"@azure-tools/typespec-client-generator-core": "^0.68.2",
|
|
69
69
|
"@typespec/compiler": "^1.12.0",
|
|
70
70
|
"@typespec/http": "^1.12.0",
|
|
71
71
|
"@typespec/rest": "^0.82.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@typespec/xml": "^0.82.0"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@azure-tools/rlc-common": "
|
|
76
|
+
"@azure-tools/rlc-common": "0.53.3-alpha.20260526.1",
|
|
77
77
|
"fast-xml-parser": "^4.5.0",
|
|
78
78
|
"fs-extra": "^11.1.0",
|
|
79
79
|
"lodash": "^4.17.21",
|
|
@@ -124,10 +124,10 @@
|
|
|
124
124
|
"generate-and-run:modular": "npm run generate-tsp-only:modular && npm run integration-test:alone:modular && npm run stop-test-server -- -p 3002",
|
|
125
125
|
"generate-and-run:azure-modular": "npm run generate-tsp-only:azure-modular && npm run integration-test:alone:azure-modular && npm run stop-test-server -- -p 3002",
|
|
126
126
|
"generate-tsp-only": "npm run generate-tsp-only:azure-rlc && npm run generate-tsp-only:rlc &&npm run generate-tsp-only:azure-modular && npm run generate-tsp-only:modular",
|
|
127
|
-
"generate-tsp-only:rlc": "npx tsx ./test/commands/gen-
|
|
128
|
-
"generate-tsp-only:azure-rlc": "npx tsx ./test/commands/gen-
|
|
129
|
-
"generate-tsp-only:modular": "npx tsx ./test/commands/gen-
|
|
130
|
-
"generate-tsp-only:azure-modular": "npx tsx ./test/commands/gen-
|
|
127
|
+
"generate-tsp-only:rlc": "npx tsx ./test/commands/gen-spector.js --tag=rlc",
|
|
128
|
+
"generate-tsp-only:azure-rlc": "npx tsx ./test/commands/gen-spector.js --tag=azure-rlc",
|
|
129
|
+
"generate-tsp-only:modular": "npx tsx ./test/commands/gen-spector.js --tag=modular",
|
|
130
|
+
"generate-tsp-only:azure-modular": "npx tsx ./test/commands/gen-spector.js --tag=azure-modular",
|
|
131
131
|
"regen-test-baselines": "npm run generate-tsp-only",
|
|
132
132
|
"integration-test:alone": "npm run integration-test:alone:rlc && npm run integration-test:alone:azure-rlc && npm run integration-test:alone:modular && npm run integration-test:alone:azure-modular",
|
|
133
133
|
"integration-test:alone:rlc": "vitest run --project integration-rlc",
|
|
@@ -223,7 +223,7 @@ class BinderImp implements Binder {
|
|
|
223
223
|
* that has a polyfill variant (-browser.mts or -react-native.mts sibling),
|
|
224
224
|
* or undefined if subpath imports are disabled or no variant exists.
|
|
225
225
|
* e.g. "src/static-helpers/serialization/get-binary-response.ts"
|
|
226
|
-
* -> "#platform/static-helpers/serialization/get-binary-response
|
|
226
|
+
* -> "#platform/static-helpers/serialization/get-binary-response"
|
|
227
227
|
*/
|
|
228
228
|
private getPlatformImportSpecifier(
|
|
229
229
|
declarationSourceFile: SourceFile
|
|
@@ -242,7 +242,7 @@ class BinderImp implements Binder {
|
|
|
242
242
|
);
|
|
243
243
|
if (!hasBrowserVariant && !hasReactNativeVariant) return undefined;
|
|
244
244
|
const relativePath = filePath.substring(srcIndex + "/src/".length);
|
|
245
|
-
return "#platform/" + relativePath.replace(/\.ts$/, "
|
|
245
|
+
return "#platform/" + relativePath.replace(/\.ts$/, "");
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
/**
|
|
@@ -129,7 +129,7 @@ export async function loadStaticHelpers(
|
|
|
129
129
|
!specifier.includes("-browser") &&
|
|
130
130
|
!specifier.includes("-react-native")
|
|
131
131
|
) {
|
|
132
|
-
i.setModuleSpecifier("#platform/static-helpers/platform-types
|
|
132
|
+
i.setModuleSpecifier("#platform/static-helpers/platform-types");
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
});
|
|
@@ -452,7 +452,12 @@ export function getDeserializePrivateFunction(
|
|
|
452
452
|
deserializedType,
|
|
453
453
|
deserializedRoot,
|
|
454
454
|
true,
|
|
455
|
-
isBinaryPayload(
|
|
455
|
+
isBinaryPayload(
|
|
456
|
+
context,
|
|
457
|
+
response.type!.__raw!,
|
|
458
|
+
contentTypes,
|
|
459
|
+
getEncodeForType(response.type!)
|
|
460
|
+
)
|
|
456
461
|
? "binary"
|
|
457
462
|
: getEncodeForType(deserializedType)
|
|
458
463
|
)}${multipartCastSuffix}`
|
|
@@ -1760,7 +1765,12 @@ function buildBodyParameter(
|
|
|
1760
1765
|
bodyParameter.type,
|
|
1761
1766
|
bodyNameExpression,
|
|
1762
1767
|
!bodyParameter.optional,
|
|
1763
|
-
isBinaryPayload(
|
|
1768
|
+
isBinaryPayload(
|
|
1769
|
+
context,
|
|
1770
|
+
bodyParameter.__raw!,
|
|
1771
|
+
bodyParameter.contentTypes,
|
|
1772
|
+
getEncodeForType(bodyParameter.type)
|
|
1773
|
+
)
|
|
1764
1774
|
? "binary"
|
|
1765
1775
|
: getEncodeForType(bodyParameter.type),
|
|
1766
1776
|
undefined,
|
|
@@ -3266,7 +3276,10 @@ export function checkWrapNonModelReturn(
|
|
|
3266
3276
|
|
|
3267
3277
|
// bytes with binary content type → binary wrap (isBinary=true)
|
|
3268
3278
|
// HLC: bytes → binary payload → separate binary handling
|
|
3269
|
-
if (
|
|
3279
|
+
if (
|
|
3280
|
+
type.__raw &&
|
|
3281
|
+
isBinaryPayload(context, type.__raw, contentTypes, getEncodeForType(type))
|
|
3282
|
+
) {
|
|
3270
3283
|
return { shouldWrap: true, isBinary: true };
|
|
3271
3284
|
}
|
|
3272
3285
|
|
|
@@ -193,11 +193,18 @@ export function isDefinedStatusCode(statusCodes: HttpStatusCodesEntry) {
|
|
|
193
193
|
export function isBinaryPayload(
|
|
194
194
|
dpgContext: SdkContext,
|
|
195
195
|
body: Type,
|
|
196
|
-
contentType: string | string[]
|
|
196
|
+
contentType: string | string[],
|
|
197
|
+
encode?: string
|
|
197
198
|
) {
|
|
198
199
|
const knownMediaTypes: KnownMediaType[] = (
|
|
199
200
|
Array.isArray(contentType) ? contentType : [contentType]
|
|
200
201
|
).map((ct) => knownMediaType(ct));
|
|
202
|
+
|
|
203
|
+
// When encode is "bytes" treat as binary.
|
|
204
|
+
if (encode === "bytes") {
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
|
|
201
208
|
for (const type of knownMediaTypes) {
|
|
202
209
|
if (type === KnownMediaType.Binary && isByteOrByteUnion(dpgContext, body)) {
|
|
203
210
|
return true;
|