@azure-tools/typespec-ts 0.50.2 → 0.50.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/src/framework/hooks/binder.d.ts +1 -1
  3. package/dist/src/framework/hooks/binder.d.ts.map +1 -1
  4. package/dist/src/framework/hooks/binder.js +11 -3
  5. package/dist/src/framework/hooks/binder.js.map +1 -1
  6. package/dist/src/framework/load-static-helpers.d.ts +3 -0
  7. package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
  8. package/dist/src/framework/load-static-helpers.js +49 -38
  9. package/dist/src/framework/load-static-helpers.js.map +1 -1
  10. package/dist/src/index.d.ts.map +1 -1
  11. package/dist/src/index.js +19 -10
  12. package/dist/src/index.js.map +1 -1
  13. package/dist/src/lib.d.ts +7 -0
  14. package/dist/src/lib.d.ts.map +1 -1
  15. package/dist/src/lib.js +5 -0
  16. package/dist/src/lib.js.map +1 -1
  17. package/dist/src/modular/buildOperations.d.ts.map +1 -1
  18. package/dist/src/modular/buildOperations.js +1 -1
  19. package/dist/src/modular/buildOperations.js.map +1 -1
  20. package/dist/src/modular/emitModels.d.ts +8 -0
  21. package/dist/src/modular/emitModels.d.ts.map +1 -1
  22. package/dist/src/modular/emitModels.js +32 -2
  23. package/dist/src/modular/emitModels.js.map +1 -1
  24. package/dist/src/modular/emitSamples.js +9 -4
  25. package/dist/src/modular/emitSamples.js.map +1 -1
  26. package/dist/src/modular/emitTests.d.ts +7 -0
  27. package/dist/src/modular/emitTests.d.ts.map +1 -0
  28. package/dist/src/modular/emitTests.js +160 -0
  29. package/dist/src/modular/emitTests.js.map +1 -0
  30. package/dist/src/modular/external-dependencies.d.ts +42 -0
  31. package/dist/src/modular/external-dependencies.d.ts.map +1 -1
  32. package/dist/src/modular/external-dependencies.js +42 -0
  33. package/dist/src/modular/external-dependencies.js.map +1 -1
  34. package/dist/src/modular/helpers/exampleValueHelpers.d.ts +83 -0
  35. package/dist/src/modular/helpers/exampleValueHelpers.d.ts.map +1 -0
  36. package/dist/src/modular/helpers/exampleValueHelpers.js +631 -0
  37. package/dist/src/modular/helpers/exampleValueHelpers.js.map +1 -0
  38. package/dist/src/modular/helpers/operationHelpers.d.ts +22 -2
  39. package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
  40. package/dist/src/modular/helpers/operationHelpers.js +178 -9
  41. package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
  42. package/dist/src/modular/static-helpers-metadata.d.ts +12 -0
  43. package/dist/src/modular/static-helpers-metadata.d.ts.map +1 -1
  44. package/dist/src/modular/static-helpers-metadata.js +12 -0
  45. package/dist/src/modular/static-helpers-metadata.js.map +1 -1
  46. package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -1
  47. package/dist/src/transform/transfromRLCOptions.js +10 -0
  48. package/dist/src/transform/transfromRLCOptions.js.map +1 -1
  49. package/dist/tsconfig.tsbuildinfo +1 -1
  50. package/package.json +2 -2
  51. package/src/framework/hooks/binder.ts +15 -5
  52. package/src/framework/load-static-helpers.ts +79 -51
  53. package/src/index.ts +22 -7
  54. package/src/lib.ts +13 -0
  55. package/src/modular/buildOperations.ts +2 -1
  56. package/src/modular/emitModels.ts +47 -2
  57. package/src/modular/emitSamples.ts +7 -1
  58. package/src/modular/emitTests.ts +227 -0
  59. package/src/modular/external-dependencies.ts +43 -0
  60. package/src/modular/helpers/exampleValueHelpers.ts +940 -0
  61. package/src/modular/helpers/operationHelpers.ts +229 -17
  62. package/src/modular/static-helpers-metadata.ts +13 -0
  63. package/src/transform/transfromRLCOptions.ts +14 -0
  64. package/static/static-helpers/serialization/get-binary-response-body-browser.mts +22 -0
  65. package/static/static-helpers/serialization/get-binary-response-body.ts +24 -0
  66. package/static/test-helpers/recordedClient.ts +30 -0
@@ -1,10 +1,10 @@
1
- import { FunctionDeclarationStructure, OptionalKind } from "ts-morph";
1
+ import { FunctionDeclarationStructure, OptionalKind, TypeAliasDeclarationStructure } from "ts-morph";
2
2
  import { ServiceOperation } from "../../utils/operationUtil.js";
3
3
  import { ModelOverrideOptions } from "../serialization/serializeUtils.js";
4
4
  import { SdkContext } from "../../utils/interfaces.js";
5
5
  import { SdkClientType, SdkHttpOperation, SdkHttpParameter, SdkLroPagingServiceMethod, SdkLroServiceMethod, SdkMethod, SdkModelPropertyType, SdkModelType, SdkPagingServiceMethod, SdkServiceResponseHeader, SdkType } from "@azure-tools/typespec-client-generator-core";
6
6
  export declare function getSendPrivateFunction(dpgContext: SdkContext, method: [string[], ServiceOperation], clientType: string, client?: SdkClientType<SdkHttpOperation>): OptionalKind<FunctionDeclarationStructure>;
7
- export declare function getDeserializePrivateFunction(context: SdkContext, operation: ServiceOperation): OptionalKind<FunctionDeclarationStructure>;
7
+ export declare function getDeserializePrivateFunction(context: SdkContext, method: [string[], ServiceOperation]): OptionalKind<FunctionDeclarationStructure>;
8
8
  /**
9
9
  * Generates a private function to deserialize response headers.
10
10
  * Only generated when response headers are present and include-headers-in-response
@@ -82,4 +82,24 @@ export declare function getExpectedStatuses(operation: ServiceOperation): string
82
82
  * @returns Array of unique response headers
83
83
  */
84
84
  export declare function getResponseHeaders(responses: SdkHttpOperation["responses"]): SdkServiceResponseHeader[];
85
+ /**
86
+ * Returns the name for a non-model response wrapper type.
87
+ * The name follows the pattern: {OperationGroupName}{MethodName}Response
88
+ * @param method - The method tuple [prefixes, operation]
89
+ */
90
+ export declare function getOperationResponseTypeName(method: [string[], ServiceOperation]): string;
91
+ /**
92
+ * Determines whether wrapping the non-model return type is needed for an operation.
93
+ * Returns an object with `shouldWrap` (whether to wrap) and `isBinary` (whether it's a binary response).
94
+ */
95
+ export declare function checkWrapNonModelReturn(context: SdkContext, operation: ServiceOperation): {
96
+ shouldWrap: boolean;
97
+ isBinary: boolean;
98
+ };
99
+ /**
100
+ * Builds a TypeAliasDeclarationStructure for the non-model response wrapper type.
101
+ * - For binary responses: { blobBody?: Promise<Blob>; readableStreamBody?: NodeJS.ReadableStream }
102
+ * - For other non-model responses: { body: <type> }
103
+ */
104
+ export declare function buildNonModelResponseTypeDeclaration(context: SdkContext, method: [string[], ServiceOperation], isBinary: boolean): TypeAliasDeclarationStructure;
85
105
  //# 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,EAGb,MAAM,UAAU,CAAC;AAoBlB,OAAO,EAOL,gBAAgB,EAIjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAIL,oBAAoB,EACrB,MAAM,oCAAoC,CAAC;AA8B5C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAKL,aAAa,EAGb,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,EACzB,mBAAmB,EACnB,SAAS,EAET,oBAAoB,EACpB,YAAY,EACZ,sBAAsB,EACtB,wBAAwB,EACxB,OAAO,EACR,MAAM,6CAA6C,CAAC;AAqBrD,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,gBAAgB,CAAC,EACpC,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,GACvC,YAAY,CAAC,4BAA4B,CAAC,CA2D5C;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,gBAAgB,GAC1B,YAAY,CAAC,4BAA4B,CAAC,CAkO5C;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,gBAAgB,GAC1B,YAAY,CAAC,4BAA4B,CAAC,GAAG,SAAS,CA+CxD;AAwHD;;;GAGG;AACH,wBAAgB,6CAA6C,CAC3D,OAAO,EAAE,UAAU,EACnB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B,qBAAqB,CACnC,EAAE,EAAE,SAAS,CAAC,gBAAgB,CAAC,GAC9B,EAAE,IAAI,sBAAsB,CAAC,gBAAgB,CAAC,CAEhD;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,OAAO,EAAE,GAClB,oBAAoB,EAAE,CAqBxB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,EAAE,CAOxD;AAgDD,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,gBAAgB,GAAG,oBAAoB,EACjD,YAAY,CAAC,EAAE,MAAM,UAStB;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,gBAAgB,GAAG,oBAAoB,EACjD,YAAY,CAAC,EAAE,MAAM,UAiBtB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,gBAAgB,GAAG,MAAM,CAkBvE;AA+BD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAC,GACvC,wBAAwB,EAAE,CAY5B"}
1
+ {"version":3,"file":"operationHelpers.d.ts","sourceRoot":"","sources":["../../../../src/modular/helpers/operationHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,YAAY,EAGZ,6BAA6B,EAC9B,MAAM,UAAU,CAAC;AAoBlB,OAAO,EAOL,gBAAgB,EAIjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAIL,oBAAoB,EACrB,MAAM,oCAAoC,CAAC;AA8B5C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAKL,aAAa,EAGb,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,EACzB,mBAAmB,EACnB,SAAS,EAET,oBAAoB,EACpB,YAAY,EACZ,sBAAsB,EACtB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AS,EAAE,gBAAgB,GAAG,MAAM,CAkBvE;AA+BD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAC,GACvC,wBAAwB,EAAE,CAY5B;AAqGD;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,gBAAgB,CAAC,GACnC,MAAM,CAOR;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,gBAAgB,GAC1B;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAoC5C;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,gBAAgB,CAAC,EACpC,QAAQ,EAAE,OAAO,GAChB,6BAA6B,CAkC/B"}
@@ -76,15 +76,22 @@ export function getSendPrivateFunction(dpgContext, method, clientType, client) {
76
76
  statements
77
77
  };
78
78
  }
79
- export function getDeserializePrivateFunction(context, operation) {
79
+ export function getDeserializePrivateFunction(context, method) {
80
80
  var _a, _b, _c, _d, _e, _f, _g, _h;
81
+ const operation = method[1];
81
82
  const { name } = getOperationName(operation);
82
83
  const dependencies = useDependencies();
83
84
  const PathUncheckedResponseReference = resolveReference(dependencies.PathUncheckedResponse);
85
+ // Check if we need to wrap the non-model return type
86
+ const { shouldWrap, isBinary } = checkWrapNonModelReturn(context, operation);
87
+ // For binary wrap, the deserializer receives a StreamableMethod directly
88
+ const resultParamType = shouldWrap && isBinary
89
+ ? resolveReference(dependencies.StreamableMethod)
90
+ : PathUncheckedResponseReference;
84
91
  const parameters = [
85
92
  {
86
93
  name: "result",
87
- type: PathUncheckedResponseReference
94
+ type: resultParamType
88
95
  }
89
96
  ];
90
97
  const isLroOnly = isLroOnlyOperation(operation);
@@ -106,6 +113,13 @@ export function getDeserializePrivateFunction(context, operation) {
106
113
  type: getTypeExpression(context, restResponse.type)
107
114
  };
108
115
  }
116
+ else if (shouldWrap) {
117
+ // Use the wrapper response type name (resolved via binder for cross-file imports)
118
+ returnType = {
119
+ name: getOperationResponseTypeName(method),
120
+ type: resolveReference(refkey(operation, "response"))
121
+ };
122
+ }
109
123
  else if (response.type) {
110
124
  returnType = {
111
125
  name: (_b = response.name) !== null && _b !== void 0 ? _b : "",
@@ -124,8 +138,11 @@ export function getDeserializePrivateFunction(context, operation) {
124
138
  };
125
139
  const statements = [];
126
140
  const createRestErrorReference = resolveReference(dependencies.createRestError);
127
- statements.push(`const expectedStatuses = ${getExpectedStatuses(operation)};`);
128
- statements.push(`if(!expectedStatuses.includes(result.status)){`, `${getExceptionThrowStatement(context, operation)}`, "}");
141
+ // For binary wrap, parameter is StreamableMethod - skip status check
142
+ if (!(shouldWrap && isBinary)) {
143
+ statements.push(`const expectedStatuses = ${getExpectedStatuses(operation)};`);
144
+ statements.push(`if(!expectedStatuses.includes(result.status)){`, `${getExceptionThrowStatement(context, operation)}`, "}");
145
+ }
129
146
  const deserializedType = isLroOnly || isLroAndPaging
130
147
  ? (_d = (_c = operation === null || operation === void 0 ? void 0 : operation.lroMetadata) === null || _c === void 0 ? void 0 : _c.finalResponse) === null || _d === void 0 ? void 0 : _d.result
131
148
  : isPagingOnly && (restResponse === null || restResponse === void 0 ? void 0 : restResponse.type)
@@ -220,6 +237,28 @@ export function getDeserializePrivateFunction(context, operation) {
220
237
  nameOnly: true,
221
238
  skipDiscriminatedUnionSuffix: false
222
239
  });
240
+ // Handle wrap-non-model-return for non-LRO, non-paging operations
241
+ if (shouldWrap) {
242
+ if (isBinary) {
243
+ const getBinaryResponseBodyReference = resolveReference(SerializationHelpers.getBinaryResponseBody);
244
+ const deserializeError = getExceptionDetails(context, operation).defaultDeserializer;
245
+ const deserializeErrorStr = deserializeError
246
+ ? `, ${deserializeError}`
247
+ : "";
248
+ statements.push(`return ${getBinaryResponseBodyReference}(result, ${getExpectedStatuses(operation)}${deserializeErrorStr});
249
+ `);
250
+ }
251
+ else {
252
+ // Non-model response: wrap with body property
253
+ // Generate the appropriate deserialization for the body value
254
+ const bodyValue = deserializeResponseValue(context, deserializedType, "result.body", true, getEncodeForType(deserializedType));
255
+ statements.push(`return { body: ${bodyValue} };`);
256
+ }
257
+ return {
258
+ ...functionStatement,
259
+ statements
260
+ };
261
+ }
223
262
  if (deserializeFunctionName) {
224
263
  statements.push(`return ${deserializeFunctionName}(${deserializedRoot})${multipartCastSuffix}`);
225
264
  }
@@ -630,8 +669,17 @@ export function getOperationFunction(context, method, clientType) {
630
669
  if (response.type) {
631
670
  bodyType = getTypeExpression(context, response.type);
632
671
  }
672
+ // Check if we need to wrap the non-model return type
673
+ const { shouldWrap: wrapReturn, isBinary: wrapReturnIsBinary } = checkWrapNonModelReturn(context, operation);
633
674
  let returnType = { name: "", type: "void" };
634
- if (response.type) {
675
+ if (wrapReturn) {
676
+ // Use the wrapper response type name (resolved via binder for cross-file imports)
677
+ returnType = {
678
+ name: getOperationResponseTypeName(method),
679
+ type: resolveReference(refkey(operation, "response"))
680
+ };
681
+ }
682
+ else if (response.type) {
635
683
  const type = response.type;
636
684
  // If feature flag enabled, we'll append the response headers to the operation response type.
637
685
  if (type.kind === "model" &&
@@ -705,6 +753,17 @@ export function getOperationFunction(context, method, clientType) {
705
753
  const paramNames = new Set(parameters.map((p) => p.name));
706
754
  const resultVarName = generateLocallyUniqueName("result", paramNames);
707
755
  const parameterList = parameters.map((p) => p.name).join(", ");
756
+ // For binary wrap, pass the StreamableMethod directly to the deserializer.
757
+ // The deserializer uses asBrowserStream()/asNodeStream() to build the wrapper.
758
+ if (wrapReturn && wrapReturnIsBinary) {
759
+ const streamableMethodVarName = generateLocallyUniqueName("streamableMethod", paramNames);
760
+ statements.push(`const ${streamableMethodVarName} = _${name}Send(${parameterList});`);
761
+ statements.push(`return _${name}Deserialize(${streamableMethodVarName});`);
762
+ return {
763
+ ...functionStatement,
764
+ statements
765
+ };
766
+ }
708
767
  // When storage-compat is enabled, set up the onResponse interceptor before sending
709
768
  const storageCompatVarName = generateLocallyUniqueName("_storageCompat", paramNames);
710
769
  if (isStorageCompatEnabled) {
@@ -1060,7 +1119,8 @@ function getHeaderAndBodyParameters(dpgContext, operation, optionalParamName = "
1060
1119
  // Specially handle the type for headers because we only allow string/number/boolean values
1061
1120
  function buildHeaderParameter(program, paramMap, param, optionalParamName = "options") {
1062
1121
  const paramName = param.name;
1063
- if (!param.optional && isTypeNullable(param.type) === true) {
1122
+ const effectiveOptional = getEffectiveOptional(param);
1123
+ if (!effectiveOptional && isTypeNullable(param.type) === true) {
1064
1124
  reportDiagnostic(program, {
1065
1125
  code: "nullable-required-header",
1066
1126
  target: NoTarget
@@ -1068,7 +1128,7 @@ function buildHeaderParameter(program, paramMap, param, optionalParamName = "opt
1068
1128
  return paramMap;
1069
1129
  }
1070
1130
  const conditions = [];
1071
- if (param.optional) {
1131
+ if (effectiveOptional) {
1072
1132
  conditions.push(`${optionalParamName}?.${paramName} !== undefined`);
1073
1133
  }
1074
1134
  if (isTypeNullable(param.type) === true) {
@@ -1222,8 +1282,32 @@ function getContentTypeValue(param, optionalParamName = "options") {
1222
1282
  : `${optionalParamName}.` + param.name + " as any"}`;
1223
1283
  }
1224
1284
  }
1285
+ /**
1286
+ * Gets the effective optionality for an HTTP parameter by checking
1287
+ * the linked method parameter via methodParameterSegments.
1288
+ * This is needed because @@override can change a method parameter's
1289
+ * optionality without updating the HTTP parameter's optional flag.
1290
+ * For client-level parameters (onClient), preserve the HTTP parameter's own flag.
1291
+ */
1292
+ function getEffectiveOptional(param) {
1293
+ var _a, _b;
1294
+ // For client-level parameters, the HTTP parameter's optional flag is authoritative
1295
+ if (param.onClient) {
1296
+ return Boolean(param.optional);
1297
+ }
1298
+ // For method-level parameters with a direct mapping to a single method param,
1299
+ // use the method parameter's optional flag (correctly reflects @@override changes)
1300
+ if (((_a = param.methodParameterSegments) === null || _a === void 0 ? void 0 : _a.length) === 1 &&
1301
+ ((_b = param.methodParameterSegments[0]) === null || _b === void 0 ? void 0 : _b.length) === 1) {
1302
+ const methodParam = param.methodParameterSegments[0][0];
1303
+ if (methodParam) {
1304
+ return Boolean(methodParam.optional);
1305
+ }
1306
+ }
1307
+ return Boolean(param.optional);
1308
+ }
1225
1309
  function isRequired(param) {
1226
- return !param.optional;
1310
+ return !getEffectiveOptional(param);
1227
1311
  }
1228
1312
  function getRequired(context, param, serializedName) {
1229
1313
  const clientValue = `${param.onClient ? "context." : ""}${param.name}`;
@@ -1243,7 +1327,7 @@ function isConstant(param) {
1243
1327
  return param.kind === "constant";
1244
1328
  }
1245
1329
  function isOptional(param) {
1246
- return Boolean(param.optional);
1330
+ return getEffectiveOptional(param);
1247
1331
  }
1248
1332
  function getOptional(context, param, optionalParamName, serializedName) {
1249
1333
  const paramName = `${param.onClient ? "context." : `${optionalParamName}?.`}${param.name}`;
@@ -2042,4 +2126,89 @@ function buildHeaderOnlyResponseValue(context, headers) {
2042
2126
  });
2043
2127
  return `{ ${props.join(", ")} }`;
2044
2128
  }
2129
+ /**
2130
+ * Returns the name for a non-model response wrapper type.
2131
+ * The name follows the pattern: {OperationGroupName}{MethodName}Response
2132
+ * @param method - The method tuple [prefixes, operation]
2133
+ */
2134
+ export function getOperationResponseTypeName(method) {
2135
+ const prefixes = method[0];
2136
+ const operation = method[1];
2137
+ const prefix = !operation.name.includes("_")
2138
+ ? getClassicalLayerPrefix(prefixes, NameType.Interface)
2139
+ : "";
2140
+ return `${prefix}${normalizeName(operation.name, NameType.Interface)}Response`;
2141
+ }
2142
+ /**
2143
+ * Determines whether wrapping the non-model return type is needed for an operation.
2144
+ * Returns an object with `shouldWrap` (whether to wrap) and `isBinary` (whether it's a binary response).
2145
+ */
2146
+ export function checkWrapNonModelReturn(context, operation) {
2147
+ var _a, _b, _c;
2148
+ const noWrap = { shouldWrap: false, isBinary: false };
2149
+ // Only for non-LRO, non-paging normal operations
2150
+ if (isLroOnlyOperation(operation) ||
2151
+ isLroAndPagingOperation(operation) ||
2152
+ isPagingOnlyOperation(operation)) {
2153
+ return noWrap;
2154
+ }
2155
+ // Only if the feature flag is enabled
2156
+ if (!((_a = context.rlcOptions) === null || _a === void 0 ? void 0 : _a.wrapNonModelReturn)) {
2157
+ return noWrap;
2158
+ }
2159
+ const response = operation.response;
2160
+ if (!response.type) {
2161
+ return noWrap; // void return type - no wrap needed
2162
+ }
2163
+ const type = response.type;
2164
+ const contentTypes = (_c = (_b = operation.operation.responses[0]) === null || _b === void 0 ? void 0 : _b.contentTypes) !== null && _c !== void 0 ? _c : [];
2165
+ // Check if it's a binary (bytes with binary content type) response
2166
+ if (type.__raw && isBinaryPayload(context, type.__raw, contentTypes)) {
2167
+ return { shouldWrap: true, isBinary: true };
2168
+ }
2169
+ // Check if it's a non-model, non-record type (array, scalar, enum, etc.)
2170
+ if (type.kind !== "model" && type.kind !== "dict") {
2171
+ return { shouldWrap: true, isBinary: false };
2172
+ }
2173
+ return noWrap;
2174
+ }
2175
+ /**
2176
+ * Builds a TypeAliasDeclarationStructure for the non-model response wrapper type.
2177
+ * - For binary responses: { blobBody?: Promise<Blob>; readableStreamBody?: NodeJS.ReadableStream }
2178
+ * - For other non-model responses: { body: <type> }
2179
+ */
2180
+ export function buildNonModelResponseTypeDeclaration(context, method, isBinary) {
2181
+ const typeName = getOperationResponseTypeName(method);
2182
+ const operation = method[1];
2183
+ let typeBody;
2184
+ if (isBinary) {
2185
+ typeBody = `{
2186
+ /**
2187
+ * BROWSER ONLY
2188
+ *
2189
+ * The response body as a browser Blob.
2190
+ * Always \`undefined\` in node.js.
2191
+ */
2192
+ blobBody?: Promise<Blob>;
2193
+ /**
2194
+ * NODEJS ONLY
2195
+ *
2196
+ * The response body as a node.js Readable stream.
2197
+ * Always \`undefined\` in the browser.
2198
+ */
2199
+ readableStreamBody?: NodeJS.ReadableStream;
2200
+ }`;
2201
+ }
2202
+ else {
2203
+ const returnType = getTypeExpression(context, operation.response.type);
2204
+ typeBody = `{ body: ${returnType} }`;
2205
+ }
2206
+ return {
2207
+ kind: StructureKind.TypeAlias,
2208
+ name: typeName,
2209
+ type: typeBody,
2210
+ isExported: true,
2211
+ leadingTrivia: "\n"
2212
+ };
2213
+ }
2045
2214
  //# sourceMappingURL=operationHelpers.js.map