@azure-tools/typespec-ts 0.50.0 → 0.50.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/src/index.d.ts.map +1 -1
  3. package/dist/src/index.js +40 -16
  4. package/dist/src/index.js.map +1 -1
  5. package/dist/src/lib.d.ts +6 -0
  6. package/dist/src/lib.d.ts.map +1 -1
  7. package/dist/src/lib.js +5 -0
  8. package/dist/src/lib.js.map +1 -1
  9. package/dist/src/modular/buildRootIndex.d.ts.map +1 -1
  10. package/dist/src/modular/buildRootIndex.js +19 -33
  11. package/dist/src/modular/buildRootIndex.js.map +1 -1
  12. package/dist/src/modular/buildSubpathIndex.d.ts +7 -0
  13. package/dist/src/modular/buildSubpathIndex.d.ts.map +1 -1
  14. package/dist/src/modular/buildSubpathIndex.js +44 -14
  15. package/dist/src/modular/buildSubpathIndex.js.map +1 -1
  16. package/dist/src/modular/helpers/operationHelpers.d.ts +2 -1
  17. package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
  18. package/dist/src/modular/helpers/operationHelpers.js +108 -14
  19. package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
  20. package/dist/src/modular/static-helpers-metadata.d.ts +17 -0
  21. package/dist/src/modular/static-helpers-metadata.d.ts.map +1 -1
  22. package/dist/src/modular/static-helpers-metadata.js +17 -0
  23. package/dist/src/modular/static-helpers-metadata.js.map +1 -1
  24. package/dist/src/transform/transfromRLCOptions.d.ts.map +1 -1
  25. package/dist/src/transform/transfromRLCOptions.js +3 -1
  26. package/dist/src/transform/transfromRLCOptions.js.map +1 -1
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +2 -2
  29. package/src/index.ts +68 -19
  30. package/src/lib.ts +12 -0
  31. package/src/modular/buildRootIndex.ts +67 -63
  32. package/src/modular/buildSubpathIndex.ts +75 -34
  33. package/src/modular/helpers/operationHelpers.ts +143 -8
  34. package/src/modular/static-helpers-metadata.ts +18 -0
  35. package/src/transform/transfromRLCOptions.ts +3 -1
  36. package/static/static-helpers/storageCompatResponse.ts +90 -0
@@ -57,8 +57,9 @@ export function buildSubpathIndexFile(emitterOptions, subpath, clientMap, option
57
57
  if (filePath === indexFile.getFilePath()) {
58
58
  continue;
59
59
  }
60
- let namedExports = [...file.getExportedDeclarations().entries()]
61
- .filter((exDeclaration) => {
60
+ let filteredDeclarations = [
61
+ ...file.getExportedDeclarations().entries()
62
+ ].filter((exDeclaration) => {
62
63
  if (exDeclaration[0].startsWith("_")) {
63
64
  return false;
64
65
  }
@@ -75,24 +76,53 @@ export function buildSubpathIndexFile(emitterOptions, subpath, clientMap, option
75
76
  }
76
77
  return true;
77
78
  });
78
- })
79
- .map((exDeclaration) => {
80
- return exDeclaration[0];
81
79
  });
82
80
  // Skip to export PagedResult and BuildPagedAsyncIteratorOptions
83
81
  if (filePath.endsWith("pagingTypes.ts")) {
84
- namedExports = namedExports.filter((ex) => !["PagedResult", "BuildPagedAsyncIteratorOptions"].includes(ex));
82
+ filteredDeclarations = filteredDeclarations.filter(([name]) => !["PagedResult", "BuildPagedAsyncIteratorOptions"].includes(name));
85
83
  }
86
- if (namedExports.length > 0) {
87
- indexFile.addExportDeclaration({
88
- moduleSpecifier: `.${filePath
89
- .replace(indexFile.getDirectoryPath(), "")
90
- .replace(/\\/g, "/")
91
- .replace(".ts", "")}.js`,
92
- namedExports
93
- });
84
+ if (filteredDeclarations.length > 0) {
85
+ const moduleSpecifier = `.${filePath
86
+ .replace(indexFile.getDirectoryPath(), "")
87
+ .replace(/\\/g, "/")
88
+ .replace(".ts", "")}.js`;
89
+ partitionAndEmitExports(indexFile, moduleSpecifier, filteredDeclarations);
94
90
  }
95
91
  }
96
92
  }
97
93
  }
94
+ export function isTypeOnlyNode(node) {
95
+ const kind = node.getKindName();
96
+ return kind === "InterfaceDeclaration" || kind === "TypeAliasDeclaration";
97
+ }
98
+ /**
99
+ * Partition declaration entries into type-only and value exports in a single pass,
100
+ * then emit both export declarations on the index file.
101
+ */
102
+ export function partitionAndEmitExports(indexFile, moduleSpecifier, entries, mapName = (n) => n) {
103
+ const typeOnlyExports = [];
104
+ const valueExports = [];
105
+ for (const [name, decls] of entries) {
106
+ const mapped = mapName(name);
107
+ if (decls.every(isTypeOnlyNode)) {
108
+ typeOnlyExports.push(mapped);
109
+ }
110
+ else {
111
+ valueExports.push(mapped);
112
+ }
113
+ }
114
+ if (typeOnlyExports.length > 0) {
115
+ indexFile.addExportDeclaration({
116
+ isTypeOnly: true,
117
+ moduleSpecifier,
118
+ namedExports: typeOnlyExports
119
+ });
120
+ }
121
+ if (valueExports.length > 0) {
122
+ indexFile.addExportDeclaration({
123
+ moduleSpecifier,
124
+ namedExports: valueExports
125
+ });
126
+ }
127
+ }
98
128
  //# sourceMappingURL=buildSubpathIndex.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildSubpathIndex.js","sourceRoot":"","sources":["../../../src/modular/buildSubpathIndex.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAQlD,MAAM,UAAU,qBAAqB,CACnC,cAAqC,EACrC,OAAe,EACf,SAA0D,EAC1D,UAAwC,EAAE;;IAE1C,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,SAAS;QACzB,CAAC,CAAC,CAAC,MAAA,uBAAuB,CAAC,SAAS,CAAC,CAAC,SAAS,mCAAI,EAAE,CAAC;QACtD,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,OAAO,GAAG,cAAc,CAAC,cAAc,CAAC,UAAU,CAAC;IACzD,+DAA+D;IAC/D,MAAM,SAAS,GAAG,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAAC;IAC5D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AC;QAC/B,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,SAAS,CAAC,oBAAoB,CAAC;YAC7B,UAAU,EAAE,IAAI;YAChB,eAAe;YACf,YAAY,EAAE,eAAe;SAC9B,CAAC,CAAC;IACL,CAAC;IACD,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5B,SAAS,CAAC,oBAAoB,CAAC;YAC7B,eAAe;YACf,YAAY,EAAE,YAAY;SAC3B,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -7,7 +7,8 @@ export declare function getSendPrivateFunction(dpgContext: SdkContext, method: [
7
7
  export declare function getDeserializePrivateFunction(context: SdkContext, operation: ServiceOperation): OptionalKind<FunctionDeclarationStructure>;
8
8
  /**
9
9
  * Generates a private function to deserialize response headers.
10
- * Only generated when response headers are present and include-headers-in-response is enabled.
10
+ * Only generated when response headers are present and include-headers-in-response
11
+ * or enable-storage-compat is enabled.
11
12
  */
12
13
  export declare function getDeserializeHeadersPrivateFunction(context: SdkContext, operation: ServiceOperation): OptionalKind<FunctionDeclarationStructure> | undefined;
13
14
  /**
@@ -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;AAmBlB,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,o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AAC,SAAS,EAAE,gBAAgB,GAAG,MAAM,CAkBvE;AA+BD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAC,GACvC,wBAAwB,EAAE,CAW5B"}
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,SAAS,EAAE,gBAAgB,GAC1B,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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,6 +1,6 @@
1
1
  import { StructureKind } from "ts-morph";
2
2
  import { NoTarget } from "@typespec/compiler";
3
- import { PagingHelpers, PollingHelpers, SerializationHelpers, UrlTemplateHelpers, XmlHelpers } from "../static-helpers-metadata.js";
3
+ import { PagingHelpers, PollingHelpers, SerializationHelpers, StorageCompatHelpers, UrlTemplateHelpers, XmlHelpers } from "../static-helpers-metadata.js";
4
4
  import { getNullableValidType, isSpreadBodyParameter, isTypeNullable } from "./typeHelpers.js";
5
5
  import { getClassicalLayerPrefix, getOperationName, generateLocallyUniqueName } from "./namingHelpers.js";
6
6
  import { getCollectionFormatHelper, hasCollectionFormatInfo, isBinaryPayload, isXmlPayload, isMultipartPayload, hasDualFormatSupport, getCollectionFormatParseHelper, getCollectionFormatFromArrayEncoding, KnownCollectionFormat } from "../../utils/operationUtil.js";
@@ -24,6 +24,14 @@ import { useContext } from "../../contextManager.js";
24
24
  import { getHeaderClientOptions, getRestErrorCodeHeader } from "./clientOptionHelpers.js";
25
25
  import { isExtensibleEnum } from "../type-expressions/get-enum-expression.js";
26
26
  import { emitInlineModel } from "../type-expressions/get-model-expression.js";
27
+ /**
28
+ * Checks whether a header should be skipped during serialization/deserialization.
29
+ * A header is skipped when it has the "headerCollectionPrefix" client option set,
30
+ * which indicates it uses a prefix-based dictionary pattern not handled by standard ser/deser.
31
+ */
32
+ function shouldSkipHeaderSerialization(header) {
33
+ return getClientOptions(header, "headerCollectionPrefix") !== undefined;
34
+ }
27
35
  export function getSendPrivateFunction(dpgContext, method, clientType, client) {
28
36
  const operation = method[1];
29
37
  const parameters = getOperationSignatureParameters(dpgContext, method, clientType);
@@ -238,14 +246,17 @@ export function getDeserializePrivateFunction(context, operation) {
238
246
  }
239
247
  /**
240
248
  * Generates a private function to deserialize response headers.
241
- * Only generated when response headers are present and include-headers-in-response is enabled.
249
+ * Only generated when response headers are present and include-headers-in-response
250
+ * or enable-storage-compat is enabled.
242
251
  */
243
252
  export function getDeserializeHeadersPrivateFunction(context, operation) {
244
- var _a;
253
+ var _a, _b;
245
254
  const responseHeaders = getResponseHeaders(operation.operation.responses);
246
255
  const isResponseHeadersEnabled = ((_a = context.rlcOptions) === null || _a === void 0 ? void 0 : _a.includeHeadersInResponse) === true;
247
- // Only generate if headers exist and feature is enabled
248
- if (responseHeaders.length === 0 || !isResponseHeadersEnabled) {
256
+ const isStorageCompatEnabled = ((_b = context.rlcOptions) === null || _b === void 0 ? void 0 : _b.enableStorageCompat) === true;
257
+ // Only generate if headers exist and a relevant feature is enabled
258
+ if (responseHeaders.length === 0 ||
259
+ (!isResponseHeadersEnabled && !isStorageCompatEnabled)) {
249
260
  return undefined;
250
261
  }
251
262
  const { name } = getOperationName(operation);
@@ -349,6 +360,8 @@ function getExceptionResponseHeaders(exceptions) {
349
360
  const headerMap = new Map();
350
361
  for (const exception of exceptions !== null && exceptions !== void 0 ? exceptions : []) {
351
362
  for (const header of (_a = exception.headers) !== null && _a !== void 0 ? _a : []) {
363
+ if (shouldSkipHeaderSerialization(header))
364
+ continue;
352
365
  const key = (_b = header.serializedName) !== null && _b !== void 0 ? _b : header.name;
353
366
  if (!headerMap.has(key)) {
354
367
  headerMap.set(key, header);
@@ -588,7 +601,7 @@ function getOperationSignatureParameters(context, method, clientType) {
588
601
  * This operation builds and returns the function declaration for an operation.
589
602
  */
590
603
  export function getOperationFunction(context, method, clientType) {
591
- var _a, _b, _c, _d;
604
+ var _a, _b, _c, _d, _e;
592
605
  const operation = method[1];
593
606
  // Extract required parameters
594
607
  const parameters = getOperationSignatureParameters(context, method, clientType);
@@ -610,6 +623,13 @@ export function getOperationFunction(context, method, clientType) {
610
623
  const responseHeaders = getResponseHeaders(operation.operation.responses);
611
624
  const hasHeaderOnlyResponse = !response.type && responseHeaders.length > 0;
612
625
  const isResponseHeadersEnabled = ((_a = context.rlcOptions) === null || _a === void 0 ? void 0 : _a.includeHeadersInResponse) === true;
626
+ const isStorageCompatEnabled = ((_b = context.rlcOptions) === null || _b === void 0 ? void 0 : _b.enableStorageCompat) === true;
627
+ // Track the raw body type separately for storage-compat (before header merging)
628
+ const hasResponseBody = !!response.type;
629
+ let bodyType = "void";
630
+ if (response.type) {
631
+ bodyType = getTypeExpression(context, response.type);
632
+ }
613
633
  let returnType = { name: "", type: "void" };
614
634
  if (response.type) {
615
635
  const type = response.type;
@@ -619,13 +639,13 @@ export function getOperationFunction(context, method, clientType) {
619
639
  isResponseHeadersEnabled) {
620
640
  // Build a composite type that includes both model and additional header properties
621
641
  returnType = {
622
- name: (_b = type.name) !== null && _b !== void 0 ? _b : "",
642
+ name: (_c = type.name) !== null && _c !== void 0 ? _c : "",
623
643
  type: `${buildCompositeResponseType(context, type, responseHeaders)}`
624
644
  };
625
645
  }
626
646
  else {
627
647
  returnType = {
628
- name: (_c = type.name) !== null && _c !== void 0 ? _c : "",
648
+ name: (_d = type.name) !== null && _d !== void 0 ? _d : "",
629
649
  type: getTypeExpression(context, type)
630
650
  };
631
651
  }
@@ -637,6 +657,35 @@ export function getOperationFunction(context, method, clientType) {
637
657
  type: `${buildHeaderOnlyResponseType(context, responseHeaders)}`
638
658
  };
639
659
  }
660
+ // When storage-compat is enabled, wrap the return type with StorageCompatResponseInfo
661
+ // Use the raw body type (not the header-augmented return type) for TBody
662
+ let finalReturnType = returnType.type;
663
+ if (isStorageCompatEnabled) {
664
+ const storageCompatInfoRef = resolveReference(StorageCompatHelpers.StorageCompatResponseInfo);
665
+ const headersType = responseHeaders.length > 0
666
+ ? buildHeaderOnlyResponseType(context, responseHeaders)
667
+ : "Record<string, unknown>";
668
+ if (!hasResponseBody) {
669
+ if (responseHeaders.length > 0) {
670
+ // Void with headers — headers at top level + StorageCompatResponseInfo
671
+ finalReturnType = `${headersType} & ${storageCompatInfoRef}<undefined, ${headersType}>`;
672
+ }
673
+ else {
674
+ // Void without headers — just StorageCompatResponseInfo
675
+ finalReturnType = `${storageCompatInfoRef}<undefined, ${headersType}>`;
676
+ }
677
+ }
678
+ else {
679
+ if (responseHeaders.length > 0) {
680
+ // Body with headers — headers + body + StorageCompatResponseInfo at top level
681
+ finalReturnType = `${headersType} & ${bodyType} & ${storageCompatInfoRef}<${bodyType}, ${headersType}>`;
682
+ }
683
+ else {
684
+ // Body without headers — body + StorageCompatResponseInfo
685
+ finalReturnType = `${bodyType} & ${storageCompatInfoRef}<${bodyType}, ${headersType}>`;
686
+ }
687
+ }
688
+ }
640
689
  const { name, fixme = [] } = getOperationName(operation);
641
690
  const functionStatement = {
642
691
  kind: StructureKind.Function,
@@ -649,25 +698,56 @@ export function getOperationFunction(context, method, clientType) {
649
698
  name,
650
699
  propertyName: normalizeName(operation.name, NameType.Property),
651
700
  parameters,
652
- returnType: `Promise<${returnType.type}>`
701
+ returnType: `Promise<${finalReturnType}>`
653
702
  };
654
703
  const statements = [];
655
704
  // Generate unique local variable names that don't conflict with parameter names
656
705
  const paramNames = new Set(parameters.map((p) => p.name));
657
706
  const resultVarName = generateLocallyUniqueName("result", paramNames);
658
707
  const parameterList = parameters.map((p) => p.name).join(", ");
708
+ // When storage-compat is enabled, set up the onResponse interceptor before sending
709
+ const storageCompatVarName = generateLocallyUniqueName("_storageCompat", paramNames);
710
+ if (isStorageCompatEnabled) {
711
+ const createOnResponseRef = resolveReference(StorageCompatHelpers.createStorageCompatOnResponse);
712
+ statements.push(`const ${storageCompatVarName} = ${createOnResponseRef}(${optionalParamName}.onResponse);`);
713
+ }
714
+ // Build the parameterList for the send call, injecting onResponse when storage-compat is enabled
715
+ const sendParameterList = isStorageCompatEnabled
716
+ ? parameterList.replace(optionalParamName, `{...${optionalParamName}, onResponse: ${storageCompatVarName}.onResponse}`)
717
+ : parameterList;
659
718
  // Special case for binary-only bodies: use helper to call streaming methods so that Core doesn't poison the response body by
660
719
  // doing a UTF-8 decode on the raw bytes.
661
- if (((_d = response === null || response === void 0 ? void 0 : response.type) === null || _d === void 0 ? void 0 : _d.kind) === "bytes" && response.type.encode === "bytes") {
720
+ if (((_e = response === null || response === void 0 ? void 0 : response.type) === null || _e === void 0 ? void 0 : _e.kind) === "bytes" && response.type.encode === "bytes") {
662
721
  const streamableMethodVarName = generateLocallyUniqueName("streamableMethod", paramNames);
663
- statements.push(`const ${streamableMethodVarName} = _${name}Send(${parameterList});`);
722
+ statements.push(`const ${streamableMethodVarName} = _${name}Send(${sendParameterList});`);
664
723
  statements.push(`const ${resultVarName} = await ${resolveReference(SerializationHelpers.getBinaryResponse)}(${streamableMethodVarName});`);
665
724
  }
666
725
  else {
667
- statements.push(`const ${resultVarName} = await _${name}Send(${parameterList});`);
726
+ statements.push(`const ${resultVarName} = await _${name}Send(${sendParameterList});`);
668
727
  }
669
728
  // If the response has headers and the feature flag to include headers in response is enabled, build the headers object and include it in the return value
670
- if (responseHeaders.length > 0 && isResponseHeadersEnabled) {
729
+ if (isStorageCompatEnabled) {
730
+ // Storage-compat mode: wrap the return value with _response metadata using captured PipelineResponse
731
+ const addStorageCompatRef = resolveReference(StorageCompatHelpers.addStorageCompatResponse);
732
+ const parsedBodyVarName = generateLocallyUniqueName("parsedBody", paramNames);
733
+ const parsedHeadersVarName = generateLocallyUniqueName("parsedHeaders", paramNames);
734
+ // Deserialize body
735
+ if (!hasResponseBody) {
736
+ statements.push(`await _${name}Deserialize(${resultVarName});`);
737
+ }
738
+ else {
739
+ statements.push(`const ${parsedBodyVarName} = await _${name}Deserialize(${resultVarName});`);
740
+ }
741
+ // Deserialize headers if present
742
+ if (responseHeaders.length > 0) {
743
+ statements.push(`const ${parsedHeadersVarName} = _${name}DeserializeHeaders(${resultVarName});`);
744
+ }
745
+ // Build the return statement using captured PipelineResponse
746
+ const bodyArg = !hasResponseBody ? "undefined" : parsedBodyVarName;
747
+ const headersArg = responseHeaders.length > 0 ? parsedHeadersVarName : "{}";
748
+ statements.push(`return ${addStorageCompatRef}(${storageCompatVarName}.getRawResponse()!, ${bodyArg}, ${headersArg});`);
749
+ }
750
+ else if (responseHeaders.length > 0 && isResponseHeadersEnabled) {
671
751
  const headersVarName = generateLocallyUniqueName("headers", paramNames);
672
752
  statements.push(`const ${headersVarName} = _${name}DeserializeHeaders(result);`);
673
753
  // If there is no body payload just return the headers
@@ -943,6 +1023,10 @@ function getHeaderAndBodyParameters(dpgContext, operation, optionalParamName = "
943
1023
  (param.name === "contentType" || param.name === "accept")) {
944
1024
  continue;
945
1025
  }
1026
+ // Skip headers marked with headerCollectionPrefix client option
1027
+ if (shouldSkipHeaderSerialization(param)) {
1028
+ continue;
1029
+ }
946
1030
  // Check if this parameter still exists in the corresponding method params (after override)
947
1031
  if (param.methodParameterSegments &&
948
1032
  param.methodParameterSegments.length > 0) {
@@ -1880,6 +1964,8 @@ export function getResponseHeaders(responses) {
1880
1964
  const headerMap = new Map();
1881
1965
  for (const response of responses !== null && responses !== void 0 ? responses : []) {
1882
1966
  for (const header of (_a = response.headers) !== null && _a !== void 0 ? _a : []) {
1967
+ if (shouldSkipHeaderSerialization(header))
1968
+ continue;
1883
1969
  const key = (_b = header.serializedName) !== null && _b !== void 0 ? _b : header.name;
1884
1970
  if (!headerMap.has(key)) {
1885
1971
  headerMap.set(key, header);
@@ -1898,7 +1984,15 @@ export function getResponseHeaders(responses) {
1898
1984
  */
1899
1985
  function buildCompositeResponseType(context, modelType, headers) {
1900
1986
  const allParents = getAllAncestors(modelType);
1901
- const modelProps = getAllProperties(context, modelType, allParents);
1987
+ const modelProps = getAllProperties(context, modelType, allParents).filter((property) => {
1988
+ // Skip model properties that are headers with headerCollectionPrefix
1989
+ if (property.__raw &&
1990
+ isHeader(context.program, property.__raw) &&
1991
+ shouldSkipHeaderSerialization(property)) {
1992
+ return false;
1993
+ }
1994
+ return true;
1995
+ });
1902
1996
  // Collect header property names already in the model to avoid duplicates
1903
1997
  const modelHeaderNames = new Set();
1904
1998
  for (const property of modelProps) {