@azure-tools/typespec-ts 0.53.2-alpha.20260524.2 → 0.53.3
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/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 +5 -5
- 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",
|
|
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": "0.53.
|
|
76
|
+
"@azure-tools/rlc-common": "^0.53.3",
|
|
77
77
|
"fast-xml-parser": "^4.5.0",
|
|
78
78
|
"fs-extra": "^11.1.0",
|
|
79
79
|
"lodash": "^4.17.21",
|
|
@@ -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;
|