@azure-tools/typespec-ts 0.36.0 → 0.37.0-alpha.20241230.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 (146) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/src/contextManager.d.ts +1 -2
  3. package/dist/src/contextManager.d.ts.map +1 -1
  4. package/dist/src/contextManager.js.map +1 -1
  5. package/dist/src/framework/load-static-helpers.d.ts +2 -1
  6. package/dist/src/framework/load-static-helpers.d.ts.map +1 -1
  7. package/dist/src/framework/load-static-helpers.js +17 -0
  8. package/dist/src/framework/load-static-helpers.js.map +1 -1
  9. package/dist/src/index.d.ts.map +1 -1
  10. package/dist/src/index.js +31 -29
  11. package/dist/src/index.js.map +1 -1
  12. package/dist/src/lib.js +1 -1
  13. package/dist/src/lib.js.map +1 -1
  14. package/dist/src/metaTree.d.ts +0 -5
  15. package/dist/src/metaTree.d.ts.map +1 -1
  16. package/dist/src/modular/buildClassicalClient.d.ts +3 -2
  17. package/dist/src/modular/buildClassicalClient.d.ts.map +1 -1
  18. package/dist/src/modular/buildClassicalClient.js +64 -62
  19. package/dist/src/modular/buildClassicalClient.js.map +1 -1
  20. package/dist/src/modular/buildClassicalOperationGroups.d.ts +3 -2
  21. package/dist/src/modular/buildClassicalOperationGroups.d.ts.map +1 -1
  22. package/dist/src/modular/buildClassicalOperationGroups.js +35 -27
  23. package/dist/src/modular/buildClassicalOperationGroups.js.map +1 -1
  24. package/dist/src/modular/buildClientContext.d.ts +4 -3
  25. package/dist/src/modular/buildClientContext.d.ts.map +1 -1
  26. package/dist/src/modular/buildClientContext.js +84 -35
  27. package/dist/src/modular/buildClientContext.js.map +1 -1
  28. package/dist/src/modular/buildModularOptions.d.ts +7 -0
  29. package/dist/src/modular/buildModularOptions.d.ts.map +1 -0
  30. package/dist/src/modular/buildModularOptions.js +16 -0
  31. package/dist/src/modular/buildModularOptions.js.map +1 -0
  32. package/dist/src/modular/buildOperations.d.ts +6 -4
  33. package/dist/src/modular/buildOperations.d.ts.map +1 -1
  34. package/dist/src/modular/buildOperations.js +56 -55
  35. package/dist/src/modular/buildOperations.js.map +1 -1
  36. package/dist/src/modular/buildProjectFiles.d.ts +3 -2
  37. package/dist/src/modular/buildProjectFiles.d.ts.map +1 -1
  38. package/dist/src/modular/buildProjectFiles.js +18 -16
  39. package/dist/src/modular/buildProjectFiles.js.map +1 -1
  40. package/dist/src/modular/buildRestorePoller.d.ts +4 -2
  41. package/dist/src/modular/buildRestorePoller.d.ts.map +1 -1
  42. package/dist/src/modular/buildRestorePoller.js +22 -18
  43. package/dist/src/modular/buildRestorePoller.js.map +1 -1
  44. package/dist/src/modular/buildRootIndex.d.ts +4 -3
  45. package/dist/src/modular/buildRootIndex.d.ts.map +1 -1
  46. package/dist/src/modular/buildRootIndex.js +40 -31
  47. package/dist/src/modular/buildRootIndex.js.map +1 -1
  48. package/dist/src/modular/buildSubpathIndex.d.ts +4 -2
  49. package/dist/src/modular/buildSubpathIndex.d.ts.map +1 -1
  50. package/dist/src/modular/buildSubpathIndex.js +8 -5
  51. package/dist/src/modular/buildSubpathIndex.js.map +1 -1
  52. package/dist/src/modular/emitLoggerFile.d.ts +2 -3
  53. package/dist/src/modular/emitLoggerFile.d.ts.map +1 -1
  54. package/dist/src/modular/emitLoggerFile.js +4 -4
  55. package/dist/src/modular/emitLoggerFile.js.map +1 -1
  56. package/dist/src/modular/emitModels.d.ts +1 -2
  57. package/dist/src/modular/emitModels.d.ts.map +1 -1
  58. package/dist/src/modular/emitModels.js +10 -3
  59. package/dist/src/modular/emitModels.js.map +1 -1
  60. package/dist/src/modular/emitModelsOptions.d.ts +3 -24
  61. package/dist/src/modular/emitModelsOptions.d.ts.map +1 -1
  62. package/dist/src/modular/emitModelsOptions.js +10 -86
  63. package/dist/src/modular/emitModelsOptions.js.map +1 -1
  64. package/dist/src/modular/emitSamples.js +2 -1
  65. package/dist/src/modular/emitSamples.js.map +1 -1
  66. package/dist/src/modular/helpers/classicalOperationHelpers.d.ts +3 -3
  67. package/dist/src/modular/helpers/classicalOperationHelpers.d.ts.map +1 -1
  68. package/dist/src/modular/helpers/classicalOperationHelpers.js +40 -50
  69. package/dist/src/modular/helpers/classicalOperationHelpers.js.map +1 -1
  70. package/dist/src/modular/helpers/clientHelpers.d.ts +11 -8
  71. package/dist/src/modular/helpers/clientHelpers.d.ts.map +1 -1
  72. package/dist/src/modular/helpers/clientHelpers.js +87 -60
  73. package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
  74. package/dist/src/modular/helpers/namingHelpers.d.ts +4 -7
  75. package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -1
  76. package/dist/src/modular/helpers/namingHelpers.js +3 -26
  77. package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
  78. package/dist/src/modular/helpers/operationHelpers.d.ts +21 -20
  79. package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
  80. package/dist/src/modular/helpers/operationHelpers.js +336 -291
  81. package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
  82. package/dist/src/modular/helpers/typeHelpers.d.ts +4 -25
  83. package/dist/src/modular/helpers/typeHelpers.d.ts.map +1 -1
  84. package/dist/src/modular/helpers/typeHelpers.js +6 -218
  85. package/dist/src/modular/helpers/typeHelpers.js.map +1 -1
  86. package/dist/src/modular/interfaces.d.ts +15 -8
  87. package/dist/src/modular/interfaces.d.ts.map +1 -1
  88. package/dist/src/modular/serialization/buildDeserializerFunction.d.ts.map +1 -1
  89. package/dist/src/modular/serialization/buildDeserializerFunction.js +1 -2
  90. package/dist/src/modular/serialization/buildDeserializerFunction.js.map +1 -1
  91. package/dist/src/modular/serialization/buildSerializerFunction.d.ts.map +1 -1
  92. package/dist/src/modular/serialization/buildSerializerFunction.js +1 -2
  93. package/dist/src/modular/serialization/buildSerializerFunction.js.map +1 -1
  94. package/dist/src/modular/serialization/serializeUtils.d.ts +8 -5
  95. package/dist/src/modular/serialization/serializeUtils.d.ts.map +1 -1
  96. package/dist/src/modular/serialization/serializeUtils.js +22 -22
  97. package/dist/src/modular/serialization/serializeUtils.js.map +1 -1
  98. package/dist/src/utils/clientUtils.d.ts +3 -1
  99. package/dist/src/utils/clientUtils.d.ts.map +1 -1
  100. package/dist/src/utils/clientUtils.js +10 -0
  101. package/dist/src/utils/clientUtils.js.map +1 -1
  102. package/dist/src/utils/operationUtil.d.ts +6 -2
  103. package/dist/src/utils/operationUtil.d.ts.map +1 -1
  104. package/dist/src/utils/operationUtil.js +66 -7
  105. package/dist/src/utils/operationUtil.js.map +1 -1
  106. package/dist/tsconfig.tsbuildinfo +1 -1
  107. package/package.json +3 -3
  108. package/src/contextManager.ts +1 -2
  109. package/src/framework/load-static-helpers.ts +24 -1
  110. package/src/index.ts +65 -37
  111. package/src/lib.ts +1 -1
  112. package/src/metaTree.ts +0 -6
  113. package/src/modular/buildClassicalClient.ts +97 -99
  114. package/src/modular/buildClassicalOperationGroups.ts +53 -47
  115. package/src/modular/buildClientContext.ts +101 -44
  116. package/src/modular/buildModularOptions.ts +27 -0
  117. package/src/modular/buildOperations.ts +91 -78
  118. package/src/modular/buildProjectFiles.ts +24 -21
  119. package/src/modular/buildRestorePoller.ts +39 -23
  120. package/src/modular/buildRootIndex.ts +51 -42
  121. package/src/modular/buildSubpathIndex.ts +16 -7
  122. package/src/modular/emitLoggerFile.ts +12 -10
  123. package/src/modular/emitModels.ts +15 -7
  124. package/src/modular/emitModelsOptions.ts +18 -125
  125. package/src/modular/emitSamples.ts +2 -3
  126. package/src/modular/helpers/classicalOperationHelpers.ts +50 -75
  127. package/src/modular/helpers/clientHelpers.ts +107 -73
  128. package/src/modular/helpers/namingHelpers.ts +6 -65
  129. package/src/modular/helpers/operationHelpers.ts +506 -384
  130. package/src/modular/helpers/typeHelpers.ts +11 -267
  131. package/src/modular/interfaces.ts +16 -8
  132. package/src/modular/serialization/buildDeserializerFunction.ts +1 -6
  133. package/src/modular/serialization/buildSerializerFunction.ts +1 -2
  134. package/src/modular/serialization/serializeUtils.ts +31 -30
  135. package/src/utils/clientUtils.ts +23 -1
  136. package/src/utils/operationUtil.ts +106 -14
  137. package/dist/src/modular/buildCodeModel.d.ts +0 -34
  138. package/dist/src/modular/buildCodeModel.d.ts.map +0 -1
  139. package/dist/src/modular/buildCodeModel.js +0 -1489
  140. package/dist/src/modular/buildCodeModel.js.map +0 -1
  141. package/dist/src/modular/modularCodeModel.d.ts +0 -166
  142. package/dist/src/modular/modularCodeModel.d.ts.map +0 -1
  143. package/dist/src/modular/modularCodeModel.js +0 -2
  144. package/dist/src/modular/modularCodeModel.js.map +0 -1
  145. package/src/modular/buildCodeModel.ts +0 -1965
  146. package/src/modular/modularCodeModel.ts +0 -211
@@ -1,29 +1,27 @@
1
1
  import { Scope, StructureKind } from "ts-morph";
2
2
  import { NameType, normalizeName } from "@azure-tools/rlc-common";
3
3
  import { buildUserAgentOptions, getClientParametersDeclaration } from "./helpers/clientHelpers.js";
4
- import { getClassicalClientName, getClassicalLayerPrefix, getClientName } from "./helpers/namingHelpers.js";
4
+ import { getClassicalClientName, getClientName } from "./helpers/namingHelpers.js";
5
5
  import { getDocsFromDescription } from "./helpers/docsHelpers.js";
6
6
  import { getOperationFunction } from "./helpers/operationHelpers.js";
7
- import { isRLCMultiEndpoint } from "../utils/clientUtils.js";
7
+ import { getModularClientOptions, isRLCMultiEndpoint } from "../utils/clientUtils.js";
8
8
  import { resolveReference } from "../framework/reference.js";
9
- import { shouldPromoteSubscriptionId } from "./helpers/classicalOperationHelpers.js";
10
9
  import { useDependencies } from "../framework/hooks/useDependencies.js";
11
- export function buildClassicalClient(_client, dpgContext, codeModel) {
12
- var _a;
13
- const { description, tcgcClient: client } = _client;
10
+ import { getMethodHierarchiesMap } from "../utils/operationUtil.js";
11
+ export function buildClassicalClient(dpgContext, client, emitterOptions) {
14
12
  const dependencies = useDependencies();
15
13
  const modularClientName = getClientName(client);
16
14
  const classicalClientName = `${getClassicalClientName(client)}`;
17
- const classicalParams = getClientParametersDeclaration(_client, dpgContext, {
15
+ const classicalParams = getClientParametersDeclaration(client, dpgContext, {
18
16
  requiredOnly: true
19
17
  });
20
- const contextParams = getClientParametersDeclaration(_client, dpgContext, {
21
- onClientOnly: true,
18
+ const contextParams = getClientParametersDeclaration(client, dpgContext, {
19
+ onClientOnly: false,
22
20
  requiredOnly: true
23
21
  });
24
- const srcPath = codeModel.modularOptions.sourceRoot;
25
- const subfolder = (_a = _client.subfolder) !== null && _a !== void 0 ? _a : "";
26
- const clientFile = codeModel.project.createSourceFile(`${srcPath}/${subfolder !== "" ? subfolder + "/" : ""}${normalizeName(classicalClientName, NameType.File)}.ts`);
22
+ const srcPath = emitterOptions.modularOptions.sourceRoot;
23
+ const { subfolder, rlcClientName } = getModularClientOptions(dpgContext, client);
24
+ const clientFile = emitterOptions.project.createSourceFile(`${srcPath}/${subfolder && subfolder !== "" ? subfolder + "/" : ""}${normalizeName(classicalClientName, NameType.File)}.ts`);
27
25
  clientFile.addExportDeclaration({
28
26
  namedExports: [`${classicalClientName}OptionalParams`],
29
27
  moduleSpecifier: `./api/${normalizeName(modularClientName, NameType.File)}Context.js`
@@ -36,14 +34,14 @@ export function buildClassicalClient(_client, dpgContext, codeModel) {
36
34
  if (isRLCMultiEndpoint(dpgContext)) {
37
35
  clientClass.addProperty({
38
36
  name: "_client",
39
- type: `Client.${_client.rlcClientName}`,
37
+ type: `Client.${rlcClientName}`,
40
38
  scope: Scope.Private
41
39
  });
42
40
  }
43
41
  else {
44
42
  clientClass.addProperty({
45
43
  name: "_client",
46
- type: `${_client.rlcClientName}`,
44
+ type: `${rlcClientName}`,
47
45
  scope: Scope.Private
48
46
  });
49
47
  }
@@ -57,14 +55,14 @@ export function buildClassicalClient(_client, dpgContext, codeModel) {
57
55
  });
58
56
  // TODO: We may need to generate constructor overloads at some point. Here we'd do that.
59
57
  const constructor = clientClass.addConstructor({
60
- docs: getDocsFromDescription(description),
58
+ docs: getDocsFromDescription(client.doc),
61
59
  parameters: classicalParams
62
60
  });
63
61
  const paramNames = (contextParams !== null && contextParams !== void 0 ? contextParams : [])
64
62
  .map((p) => p.name)
65
63
  .map((x) => {
66
64
  if (x === "options") {
67
- return `{...options, userAgentOptions: ${buildUserAgentOptions(constructor, codeModel, "azsdk-js-client")}}`;
65
+ return `{...options, userAgentOptions: ${buildUserAgentOptions(constructor, emitterOptions, "azsdk-js-client")}}`;
68
66
  }
69
67
  else {
70
68
  return x;
@@ -74,14 +72,14 @@ export function buildClassicalClient(_client, dpgContext, codeModel) {
74
72
  `this._client = create${modularClientName}(${paramNames.join(",")});`
75
73
  ]);
76
74
  constructor.addStatements(`this.pipeline = this._client.pipeline;`);
77
- buildClientOperationGroups(clientFile, _client, dpgContext, clientClass);
78
- importAllApis(clientFile, srcPath, subfolder);
75
+ buildClientOperationGroups(clientFile, client, dpgContext, clientClass);
76
+ importAllApis(clientFile, srcPath, subfolder !== null && subfolder !== void 0 ? subfolder : "");
79
77
  clientFile.fixUnusedIdentifiers();
80
78
  return clientFile;
81
79
  }
82
80
  function importAllApis(clientFile, srcPath, subfolder) {
83
81
  const project = clientFile.getProject();
84
- const apiModels = project.getSourceFile(`${srcPath}/${subfolder !== "" ? subfolder + "/" : ""}api/index.ts`);
82
+ const apiModels = project.getSourceFile(`${srcPath}/${subfolder && subfolder !== "" ? subfolder + "/" : ""}api/index.ts`);
85
83
  if (!apiModels) {
86
84
  return;
87
85
  }
@@ -91,58 +89,62 @@ function importAllApis(clientFile, srcPath, subfolder) {
91
89
  namedImports: exported
92
90
  });
93
91
  }
92
+ function generateMethod(context, clientType, method) {
93
+ var _a, _b, _c, _d;
94
+ const declarations = getOperationFunction(context, method, clientType);
95
+ const result = {
96
+ docs: declarations.docs,
97
+ name: (_b = (_a = declarations.propertyName) !== null && _a !== void 0 ? _a : declarations.name) !== null && _b !== void 0 ? _b : "FIXME",
98
+ kind: StructureKind.Method,
99
+ returnType: declarations.returnType,
100
+ parameters: (_c = declarations.parameters) === null || _c === void 0 ? void 0 : _c.filter((p) => p.name !== "context"),
101
+ statements: `return ${declarations.name}(${[
102
+ "this._client",
103
+ ...[
104
+ (_d = declarations.parameters) === null || _d === void 0 ? void 0 : _d.map((p) => p.name).filter((p) => p !== "context")
105
+ ]
106
+ ].join(",")})`
107
+ };
108
+ return result;
109
+ }
94
110
  function buildClientOperationGroups(clientFile, client, dpgContext, clientClass) {
95
- var _a, _b, _c;
111
+ var _a, _b;
96
112
  let clientType = "Client";
97
- const subfolder = (_a = client.subfolder) !== null && _a !== void 0 ? _a : "";
113
+ const { subfolder } = getModularClientOptions(dpgContext, client);
98
114
  if (subfolder && subfolder !== "") {
99
115
  clientType = `Client.${clientClass.getName()}`;
100
116
  }
101
- for (const operationGroup of client.operationGroups) {
102
- const groupName = normalizeName((_b = operationGroup.namespaceHierarchies[0]) !== null && _b !== void 0 ? _b : operationGroup.propertyName, NameType.Property);
103
- // TODO: remove this logic once client-level parameter design is finalized
104
- // https://github.com/Azure/autorest.typescript/issues/2618
105
- const hasSubscriptionIdPromoted = shouldPromoteSubscriptionId(dpgContext, operationGroup);
106
- if (groupName === "") {
107
- operationGroup.operations.forEach((op) => {
108
- var _a, _b, _c, _d;
109
- const declarations = getOperationFunction(dpgContext, op, clientType);
110
- const method = {
111
- docs: declarations.docs,
112
- name: (_b = (_a = declarations.propertyName) !== null && _a !== void 0 ? _a : declarations.name) !== null && _b !== void 0 ? _b : "FIXME",
113
- kind: StructureKind.Method,
114
- returnType: declarations.returnType,
115
- parameters: (_c = declarations.parameters) === null || _c === void 0 ? void 0 : _c.filter((p) => p.name !== "context"),
116
- statements: `return ${declarations.name}(${[
117
- "this._client",
118
- ...[
119
- (_d = declarations.parameters) === null || _d === void 0 ? void 0 : _d.map((p) => p.name).filter((p) => p !== "context")
120
- ]
121
- ].join(",")})`
122
- };
117
+ const methodMap = getMethodHierarchiesMap(dpgContext, client);
118
+ for (const [prefixKey, operations] of methodMap) {
119
+ const prefixes = prefixKey.split("/");
120
+ if (prefixKey === "") {
121
+ operations.forEach((op) => {
122
+ const method = generateMethod(dpgContext, clientType, [prefixes, op]);
123
123
  clientClass.addMethod(method);
124
124
  });
125
- continue;
126
125
  }
127
- const operationName = `get${getClassicalLayerPrefix(operationGroup, NameType.Interface, "", 0)}Operations`;
128
- const propertyType = `${getClassicalLayerPrefix(operationGroup, NameType.Interface, "", 0)}Operations`;
129
- const existProperty = clientClass.getProperties().filter((p) => {
130
- return p.getName() === groupName;
131
- });
132
- if (!existProperty || existProperty.length === 0) {
133
- clientFile.addImportDeclaration({
134
- namedImports: [operationName, propertyType],
135
- moduleSpecifier: `./classic/${getClassicalLayerPrefix(operationGroup, NameType.File, "/", 0)}/index.js`
136
- });
137
- clientClass.addProperty({
138
- name: groupName,
139
- type: propertyType,
140
- scope: Scope.Public,
141
- isReadonly: true,
142
- docs: ["The operation groups for " + operationGroup.propertyName]
126
+ else {
127
+ const groupName = normalizeName((_a = prefixes[0]) !== null && _a !== void 0 ? _a : "", NameType.Property);
128
+ const operationName = `get${normalizeName(groupName, NameType.OperationGroup)}Operations`;
129
+ const propertyType = `${normalizeName(groupName, NameType.OperationGroup)}Operations`;
130
+ const existProperty = clientClass.getProperties().filter((p) => {
131
+ return p.getName() === groupName;
143
132
  });
144
- (_c = clientClass
145
- .getConstructors()[0]) === null || _c === void 0 ? void 0 : _c.addStatements(`this.${groupName} = get${getClassicalLayerPrefix(operationGroup, NameType.Interface, "", 0)}Operations(this._client${hasSubscriptionIdPromoted ? ", subscriptionId" : ""})`);
133
+ if (!existProperty || existProperty.length === 0) {
134
+ clientFile.addImportDeclaration({
135
+ namedImports: [operationName, propertyType],
136
+ moduleSpecifier: `./classic/${normalizeName(groupName, NameType.File)}/index.js`
137
+ });
138
+ clientClass.addProperty({
139
+ name: groupName,
140
+ type: propertyType,
141
+ scope: Scope.Public,
142
+ isReadonly: true,
143
+ docs: ["The operation groups for " + groupName]
144
+ });
145
+ (_b = clientClass
146
+ .getConstructors()[0]) === null || _b === void 0 ? void 0 : _b.addStatements(`this.${groupName} = get${normalizeName(groupName, NameType.OperationGroup)}Operations(this._client)`);
147
+ }
146
148
  }
147
149
  }
148
150
  }
@@ -1 +1 @@
1
- {"version":3,"file":"buildClassicalClient.js","sourceRoot":"","sources":["../../../src/modular/buildClassicalClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,EAEL,aAAa,EACd,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,EACd,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,MAAM,UAAU,oBAAoB,CAClC,OAAe,EACf,UAAsB,EACtB,SAA2B;;IAE3B,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACpD,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,MAAM,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAChD,MAAM,mBAAmB,GAAG,GAAG,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC;IAChE,MAAM,eAAe,GAAG,8BAA8B,CAAC,OAAO,EAAE,UAAU,EAAE;QAC1E,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;IACH,MAAM,aAAa,GAAG,8BAA8B,CAAC,OAAO,EAAE,UA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BAC9B,YAAY,EAAE,CAAC,aAAa,EAAE,YAAY,CAAC;gBAC3C,eAAe,EAAE,aAAa,uBAAuB,CACnD,cAAc,EACd,QAAQ,CAAC,IAAI,EACb,GAAG,EACH,CAAC,CACF,WAAW;aACb,CAAC,CAAC;YACH,WAAW,CAAC,WAAW,CAAC;gBACtB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE,KAAK,CAAC,MAAM;gBACnB,UAAU,EAAE,IAAI;gBAChB,IAAI,EAAE,CAAC,2BAA2B,GAAG,cAAc,CAAC,YAAY,CAAC;aAClE,CAAC,CAAC;YACH,MAAA,WAAW;iBACR,eAAe,EAAE,CAAC,CAAC,CAAC,0CACnB,aAAa,CACb,QAAQ,SAAS,SAAS,uBAAuB,CAC/C,cAAc,EACd,QAAQ,CAAC,SAAS,EAClB,EAAE,EACF,CAAC,CACF,0BACC,yBAAyB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,EACnD,GAAG,CACJ,CAAC;QACN,CAAC;IACH,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"buildClassicalClient.js","sourceRoot":"","sources":["../../../src/modular/buildClassicalClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,EAEL,aAAa,EACd,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,aAAa,EACd,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,C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Ac,CACxB,0BAA0B,CAC5B,CAAC;YACN,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { SourceFile } from "ts-morph";
2
- import { Client, ModularCodeModel } from "./modularCodeModel.js";
2
+ import { ModularEmitterOptions } from "./interfaces.js";
3
3
  import { SdkContext } from "../utils/interfaces.js";
4
- export declare function buildClassicOperationFiles(dpgContext: SdkContext, codeModel: ModularCodeModel, client: Client): Map<string, SourceFile>;
4
+ import { SdkClientType, SdkServiceOperation } from "@azure-tools/typespec-client-generator-core";
5
+ export declare function buildClassicOperationFiles(dpgContext: SdkContext, client: SdkClientType<SdkServiceOperation>, emitterOptions: ModularEmitterOptions): Map<string, SourceFile>;
5
6
  //# sourceMappingURL=buildClassicalOperationGroups.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildClassicalOperationGroups.d.ts","sourceRoot":"","sources":["../../../src/modular/buildClassicalOperationGroups.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC,OAAO,EACL,MAAM,EACN,gBAAgB,EAEjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,MAAM,2BA6Ef"}
1
+ {"version":3,"file":"buildClassicalOperationGroups.d.ts","sourceRoot":"","sources":["../../../src/modular/buildClassicalOperationGroups.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EACL,aAAa,EACb,mBAAmB,EACpB,MAAM,6CAA6C,CAAC;AAGrD,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,aAAa,CAAC,mBAAmB,CAAC,EAC1C,cAAc,EAAE,qBAAqB,2BAqFtC"}
@@ -1,53 +1,61 @@
1
1
  import { NameType } from "@azure-tools/rlc-common";
2
2
  import { getClassicalOperation } from "./helpers/classicalOperationHelpers.js";
3
3
  import { getClassicalLayerPrefix } from "./helpers/namingHelpers.js";
4
- export function buildClassicOperationFiles(dpgContext, codeModel, client) {
4
+ import { getMethodHierarchiesMap } from "../utils/operationUtil.js";
5
+ import { getModularClientOptions } from "../utils/clientUtils.js";
6
+ export function buildClassicOperationFiles(dpgContext, client, emitterOptions) {
5
7
  var _a, _b;
8
+ // const sdkPackage = dpgContext.sdkPackage;
9
+ const { subfolder } = getModularClientOptions(dpgContext, client);
6
10
  const classicOperationFiles = new Map();
7
- for (const operationGroup of client.operationGroups) {
8
- if (operationGroup.namespaceHierarchies.length > 0) {
9
- const classicOperationFileName = operationGroup.namespaceHierarchies.length > 0
10
- ? `${getClassicalLayerPrefix(operationGroup, NameType.File, "/", operationGroup.namespaceHierarchies.length - 1)}/index`
11
+ const methodMap = getMethodHierarchiesMap(dpgContext, client);
12
+ for (const [prefixKey, operations] of methodMap) {
13
+ const prefixes = prefixKey.split("/");
14
+ if (prefixes.length > 0 && prefixKey !== "") {
15
+ const classicOperationFileName = prefixes.length > 0
16
+ ? `${getClassicalLayerPrefix(prefixes, NameType.File, "/", prefixes.length - 1)}/index`
11
17
  : // When the program has no operation groups defined all operations are put
12
18
  // into a nameless operation group. We'll call this operations.
13
19
  "index";
14
- const subfolder = client.subfolder;
15
- const srcPath = codeModel.modularOptions.sourceRoot;
16
- const classicFile = (_a = classicOperationFiles.get(classicOperationFileName)) !== null && _a !== void 0 ? _a : codeModel.project.createSourceFile(`${srcPath}/${subfolder && subfolder !== "" ? subfolder + "/" : ""}classic/${classicOperationFileName}.ts`);
17
- getClassicalOperation(dpgContext, client, classicFile, operationGroup);
18
- importApis(classicFile, client, codeModel, operationGroup);
20
+ const srcPath = emitterOptions.modularOptions.sourceRoot;
21
+ const classicFile = (_a = classicOperationFiles.get(classicOperationFileName)) !== null && _a !== void 0 ? _a : emitterOptions.project.createSourceFile(`${srcPath}/${subfolder && subfolder !== "" ? subfolder + "/" : ""}classic/${classicOperationFileName}.ts`);
22
+ getClassicalOperation(dpgContext, client, classicFile, [
23
+ prefixes,
24
+ operations
25
+ ]);
26
+ importApis(dpgContext, classicFile, client, emitterOptions, prefixes);
19
27
  // We need to import the paging helpers and types explicitly because ts-morph may not be able to find them.
20
28
  classicOperationFiles.set(classicOperationFileName, classicFile);
21
29
  }
22
30
  }
23
- for (const operationGroup of client.operationGroups) {
24
- if (operationGroup.namespaceHierarchies.length > 0) {
25
- for (let layer = 0; layer < operationGroup.namespaceHierarchies.length - 1; layer++) {
26
- const classicOperationFileName = operationGroup.namespaceHierarchies.length > 0
27
- ? `${getClassicalLayerPrefix(operationGroup, NameType.File, "/", layer)}/index`
31
+ for (const [prefixKey, operations] of methodMap) {
32
+ const prefixes = prefixKey.split("/");
33
+ if (prefixes.length > 0 && prefixKey !== "") {
34
+ for (let layer = 0; layer < prefixes.length - 1; layer++) {
35
+ const classicOperationFileName = prefixes.length > 0
36
+ ? `${getClassicalLayerPrefix(prefixes, NameType.File, "/", layer)}/index`
28
37
  : // When the program has no operation groups defined all operations are put
29
38
  // into a nameless operation group. We'll call this operations.
30
39
  "index";
31
- const subfolder = client.subfolder;
32
- const srcPath = codeModel.modularOptions.sourceRoot;
33
- const classicFile = (_b = classicOperationFiles.get(classicOperationFileName)) !== null && _b !== void 0 ? _b : codeModel.project.createSourceFile(`${srcPath}/${subfolder && subfolder !== "" ? subfolder + "/" : ""}classic/${classicOperationFileName}.ts`);
34
- getClassicalOperation(dpgContext, client, classicFile, operationGroup, layer);
35
- importApis(classicFile, client, codeModel, operationGroup, layer);
40
+ const srcPath = emitterOptions.modularOptions.sourceRoot;
41
+ const classicFile = (_b = classicOperationFiles.get(classicOperationFileName)) !== null && _b !== void 0 ? _b : emitterOptions.project.createSourceFile(`${srcPath}/${subfolder && subfolder !== "" ? subfolder + "/" : ""}classic/${classicOperationFileName}.ts`);
42
+ getClassicalOperation(dpgContext, client, classicFile, [prefixes, operations], layer);
43
+ importApis(dpgContext, classicFile, client, emitterOptions, prefixes, layer);
36
44
  classicOperationFiles.set(classicOperationFileName, classicFile);
37
45
  }
38
46
  }
39
47
  }
40
48
  return classicOperationFiles;
41
49
  }
42
- function importApis(classicFile, client, modularCodeModel, operationGroup, layer = operationGroup.namespaceHierarchies.length - 1) {
43
- const classicOperationFileName = operationGroup.namespaceHierarchies.length > 0
44
- ? `${getClassicalLayerPrefix(operationGroup, NameType.File, "/", layer)}/index`
50
+ function importApis(context, classicFile, client, emitterOptions, prefixes, layer = prefixes.length - 1) {
51
+ const { subfolder } = getModularClientOptions(context, client);
52
+ const classicOperationFileName = prefixes.length > 0 && prefixes[0] !== ""
53
+ ? `${getClassicalLayerPrefix(prefixes, NameType.File, "/", layer)}/index`
45
54
  : // When the program has no operation groups defined all operations are put
46
55
  // into a nameless operation group. We'll call this operations.
47
56
  "index";
48
- const subfolder = client.subfolder;
49
- const srcPath = modularCodeModel.modularOptions.sourceRoot;
50
- const apiFile = modularCodeModel.project.getSourceFile(`${srcPath}/${subfolder && subfolder !== "" ? subfolder + "/" : ""}api/${classicOperationFileName}.ts`);
57
+ const srcPath = emitterOptions.modularOptions.sourceRoot;
58
+ const apiFile = emitterOptions.project.getSourceFile(`${srcPath}/${subfolder && subfolder !== "" ? subfolder + "/" : ""}api/${classicOperationFileName}.ts`);
51
59
  if (!apiFile) {
52
60
  return;
53
61
  }
@@ -61,7 +69,7 @@ function importApis(classicFile, client, modularCodeModel, operationGroup, layer
61
69
  })[0];
62
70
  if (exported.length > 0 && !existApiImport) {
63
71
  classicFile.addImportDeclaration({
64
- moduleSpecifier: `${"../".repeat(operationGroup.namespaceHierarchies.length + 1)}api/${classicOperationFileName}.js`,
72
+ moduleSpecifier: `${"../".repeat(prefixes.length + 1)}api/${classicOperationFileName}.js`,
65
73
  namedImports: exported
66
74
  });
67
75
  }
@@ -1 +1 @@
1
- {"version":3,"file":"buildClassicalOperationGroups.js","sourceRoot":"","sources":["../../../src/modular/buildClassicalOperationGroups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAQrE,MAAM,UAAU,0BAA0B,CACxC,UAAsB,EACtB,SAA2B,EAC3B,MAAc;;IAEd,MAAM,qBAAqB,GAA4B,IAAI,GAAG,EAG3D,CAAC;IACJ,KAAK,MAAM,cAAc,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;QACpD,IAAI,cAAc,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnD,MAAM,wBAAwB,GAC5B,cAAc,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC;gBAC5C,CAAC,CAAC,GAAG,uBAAuB,CACxB,cAAc,EACd,QAAQ,CAAC,IAAI,EACb,GAAG,EACH,cAAc,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAC/C,QAAQ;gBACX,CAAC,CAAC,0EAA0E;oBAC1E,+DAA+D;oBAC/D,OAAO,CAAC;YAEd,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;YACnC,MAAM,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC,UAAU,CAAC;YACpD,MAAM,WAAW,GACf,MAAA,qBAAqB,CAAC,GAAG,CAAC,wBAAwB,CAAC,mCACnD,SAAS,CAAC,OAAO,CAAC,gBAAgB,CAChC,GAAG,OAAO,IACR,SAAS,IAAI,SAAS,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,EACpD,WAAW,wBAAwB,KAAK,CACzC,CAAC;YACJ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ularCodeModel.js";
1
+ import { ModularEmitterOptions } from "./interfaces.js";
2
2
  import { SdkContext } from "../utils/interfaces.js";
3
3
  import { SourceFile } from "ts-morph";
4
+ import { SdkClientType, SdkServiceOperation } from "@azure-tools/typespec-client-generator-core";
4
5
  /**
5
6
  * This function gets the path of the file containing the modular client context
6
7
  */
7
- export declare function getClientContextPath(_client: Client, codeModel: ModularCodeModel): string;
8
+ export declare function getClientContextPath(context: SdkContext, client: SdkClientType<SdkServiceOperation>, emitterOptions: ModularEmitterOptions): string;
8
9
  /**
9
10
  * This function creates the file containing the modular client context
10
11
  */
11
- export declare function buildClientContext(_client: Client, dpgContext: SdkContext, codeModel: ModularCodeModel): SourceFile;
12
+ export declare function buildClientContext(dpgContext: SdkContext, client: SdkClientType<SdkServiceOperation>, emitterOptions: ModularEmitterOptions): SourceFile;
12
13
  //# sourceMappingURL=buildClientContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildClientContext.d.ts","sourceRoot":"","sources":["../../../src/modular/buildClientContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAejE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAYtC;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,gBAAgB,GAC1B,MAAM,CAQR;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,gBAAgB,GAC1B,UAAU,CAiJZ"}
1
+ {"version":3,"file":"buildClientContext.d.ts","sourceRoot":"","sources":["../../../src/modular/buildClientContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAexD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAOtC,OAAO,EACL,aAAa,EAGb,mBAAmB,EACpB,MAAM,6CAA6C,CAAC;AAGrD;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,aAAa,CAAC,mBAAmB,CAAC,EAC1C,cAAc,EAAE,qBAAqB,GACpC,MAAM,CAQR;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,aAAa,CAAC,mBAAmB,CAAC,EAC1C,cAAc,EAAE,qBAAqB,GACpC,UAAU,CAsMZ"}
@@ -6,45 +6,66 @@ import { getTypeExpression } from "./type-expressions/get-type-expression.js";
6
6
  import { resolveReference } from "../framework/reference.js";
7
7
  import { useDependencies } from "../framework/hooks/useDependencies.js";
8
8
  import { buildEnumTypes, getApiVersionEnum } from "./emitModels.js";
9
+ import { getModularClientOptions } from "../utils/clientUtils.js";
9
10
  /**
10
11
  * This function gets the path of the file containing the modular client context
11
12
  */
12
- export function getClientContextPath(_client, codeModel) {
13
- const { subfolder, tcgcClient: client } = _client;
13
+ export function getClientContextPath(context, client, emitterOptions) {
14
+ const { subfolder } = getModularClientOptions(context, client);
14
15
  const name = getClientName(client);
15
- const srcPath = codeModel.modularOptions.sourceRoot;
16
+ const srcPath = emitterOptions.modularOptions.sourceRoot;
16
17
  const contentPath = `${srcPath}/${subfolder && subfolder !== "" ? subfolder + "/" : ""}api/${normalizeName(name, NameType.File)}Context.ts`;
17
18
  return contentPath;
18
19
  }
19
20
  /**
20
21
  * This function creates the file containing the modular client context
21
22
  */
22
- export function buildClientContext(_client, dpgContext, codeModel) {
23
- const { description, tcgcClient: client } = _client;
23
+ export function buildClientContext(dpgContext, client, emitterOptions) {
24
+ var _a;
24
25
  const dependencies = useDependencies();
25
26
  const name = getClientName(client);
26
- const requiredParams = getClientParametersDeclaration(_client, dpgContext, {
27
+ const { rlcClientName } = getModularClientOptions(dpgContext, client);
28
+ const requiredParams = getClientParametersDeclaration(client, dpgContext, {
27
29
  onClientOnly: false,
28
- requiredOnly: true
30
+ requiredOnly: true,
31
+ apiVersionAsRequired: true
29
32
  });
30
- const clientContextFile = codeModel.project.createSourceFile(getClientContextPath(_client, codeModel));
33
+ const clientContextFile = emitterOptions.project.createSourceFile(getClientContextPath(dpgContext, client, emitterOptions));
31
34
  clientContextFile.addInterface({
32
35
  isExported: true,
33
- name: `${_client.rlcClientName}`,
36
+ name: `${rlcClientName}`,
34
37
  extends: [resolveReference(dependencies.Client)],
35
- docs: getDocsFromDescription(description)
38
+ docs: getDocsFromDescription(client.doc),
39
+ properties: getClientParameters(client, dpgContext, {
40
+ onClientOnly: false,
41
+ requiredOnly: true,
42
+ apiVersionAsRequired: true
43
+ })
44
+ .filter((p) => {
45
+ const clientParamName = getClientParameterName(p);
46
+ return (clientParamName !== "endpointParam" &&
47
+ clientParamName !== "credential");
48
+ })
49
+ .map((p) => {
50
+ return {
51
+ name: getClientParameterName(p),
52
+ type: getTypeExpression(dpgContext, p.type),
53
+ hasQuestionToken: false,
54
+ docs: getDocsWithKnownVersion(dpgContext, p)
55
+ };
56
+ })
36
57
  });
37
58
  clientContextFile.addInterface({
38
59
  name: `${name}ClientOptionalParams`,
39
60
  isExported: true,
40
61
  extends: [resolveReference(dependencies.ClientOptions)],
41
- properties: getClientParameters(_client, dpgContext, {
62
+ properties: getClientParameters(client, dpgContext, {
42
63
  optionalOnly: true
43
64
  })
44
65
  .filter((p) => p.name !== "endpoint")
45
66
  .map((p) => {
46
67
  return {
47
- name: normalizeName(p.name, NameType.Parameter),
68
+ name: getClientParameterName(p),
48
69
  type: p.name.toLowerCase() === "apiversion"
49
70
  ? "string"
50
71
  : getTypeExpression(dpgContext, p.type),
@@ -56,24 +77,29 @@ export function buildClientContext(_client, dpgContext, codeModel) {
56
77
  });
57
78
  // TODO use binder here
58
79
  // (for now) now logger for unbranded pkgs
59
- if (isAzurePackage(codeModel)) {
80
+ if (isAzurePackage(emitterOptions)) {
60
81
  clientContextFile.addImportDeclaration({
61
- moduleSpecifier: codeModel.clients.length > 1 ? "../../logger.js" : "../logger.js",
82
+ moduleSpecifier: dpgContext.sdkPackage.clients.length > 1
83
+ ? "../../logger.js"
84
+ : "../logger.js",
62
85
  namedImports: ["logger"]
63
86
  });
64
87
  }
65
88
  const factoryFunction = clientContextFile.addFunction({
66
- docs: getDocsFromDescription(description),
89
+ docs: getDocsFromDescription(client.doc),
67
90
  name: `create${name}`,
68
- returnType: `${_client.rlcClientName}`,
69
- parameters: requiredParams,
91
+ returnType: `${rlcClientName}`,
92
+ parameters: getClientParametersDeclaration(client, dpgContext, {
93
+ onClientOnly: false,
94
+ requiredOnly: true
95
+ }),
70
96
  isExported: true
71
97
  });
72
- const endpointParam = buildGetClientEndpointParam(factoryFunction, dpgContext, _client);
73
- const credentialParam = buildGetClientCredentialParam(_client, codeModel);
74
- const optionsParam = buildGetClientOptionsParam(factoryFunction, codeModel, endpointParam);
98
+ const endpointParam = buildGetClientEndpointParam(factoryFunction, dpgContext, client);
99
+ const credentialParam = buildGetClientCredentialParam(client, emitterOptions);
100
+ const optionsParam = buildGetClientOptionsParam(factoryFunction, emitterOptions, endpointParam);
75
101
  factoryFunction.addStatements(`const clientContext = ${resolveReference(dependencies.getClient)}(${endpointParam}, ${credentialParam}, ${optionsParam});`);
76
- const { customHttpAuthHeaderName, customHttpAuthSharedKeyPrefix } = codeModel.options;
102
+ const { customHttpAuthHeaderName, customHttpAuthSharedKeyPrefix } = emitterOptions.options;
77
103
  if (customHttpAuthHeaderName && customHttpAuthSharedKeyPrefix) {
78
104
  factoryFunction.addStatements(`
79
105
  if(${resolveReference(dependencies.isKeyCredential)}(credential)) {
@@ -88,12 +114,23 @@ export function buildClientContext(_client, dpgContext, codeModel) {
88
114
  `);
89
115
  }
90
116
  let apiVersionPolicyStatement = `clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" });`;
91
- if (dpgContext.hasApiVersionInClient) {
92
- const apiVersionParam = getClientParameters(_client, dpgContext).find((x) => x.isApiVersionParam && x.kind === "method");
93
- if (apiVersionParam) {
94
- if (apiVersionParam.clientDefaultValue) {
95
- apiVersionPolicyStatement += `const apiVersion = options.apiVersion ?? "${apiVersionParam.clientDefaultValue}";`;
96
- }
117
+ const apiVersionParam = getClientParameters(client, dpgContext).find((x) => x.isApiVersionParam);
118
+ const endpointParameter = getClientParameters(client, dpgContext, {
119
+ onClientOnly: false,
120
+ requiredOnly: true,
121
+ skipEndpointTemplate: true
122
+ }).find((x) => x.kind === "endpoint");
123
+ if (apiVersionParam) {
124
+ const templateArguments = endpointParameter && endpointParameter.type.kind === "endpoint"
125
+ ? endpointParameter.type.templateArguments
126
+ : endpointParameter && endpointParameter.type.kind === "union"
127
+ ? (_a = endpointParameter.type.variantTypes[0]) === null || _a === void 0 ? void 0 : _a.templateArguments
128
+ : [];
129
+ const apiVersionInEndpoint = templateArguments && templateArguments.find((p) => p.isApiVersionParam);
130
+ if (!apiVersionInEndpoint && apiVersionParam.clientDefaultValue) {
131
+ apiVersionPolicyStatement += `const apiVersion = options.apiVersion ?? "${apiVersionParam.clientDefaultValue}";`;
132
+ }
133
+ if (apiVersionParam.kind === "method") {
97
134
  apiVersionPolicyStatement += `
98
135
  clientContext.pipeline.addPolicy({
99
136
  name: 'ClientApiVersionPolicy',
@@ -112,20 +149,32 @@ export function buildClientContext(_client, dpgContext, codeModel) {
112
149
  });`;
113
150
  }
114
151
  }
115
- else if (isAzurePackage(codeModel)) {
152
+ else if (isAzurePackage(emitterOptions)) {
116
153
  apiVersionPolicyStatement += `
117
- if (options.apiVersion) {
118
- logger.warning("This client does not support client api-version, please change it at the operation level");
119
- }`;
154
+ if (options.apiVersion) {
155
+ logger.warning("This client does not support client api-version, please change it at the operation level");
156
+ }`;
120
157
  }
121
158
  else {
122
159
  apiVersionPolicyStatement += `
123
- if (options.apiVersion) {
124
- console.warn("This client does not support client api-version, please change it at the operation level");
125
- }`;
160
+ if (options.apiVersion) {
161
+ console.warn("This client does not support client api-version, please change it at the operation level");
162
+ }`;
126
163
  }
127
164
  factoryFunction.addStatements(apiVersionPolicyStatement);
128
- factoryFunction.addStatements("return clientContext;");
165
+ const contextRequiredParam = requiredParams.filter((p) => p.name !== "endpointParam" &&
166
+ p.name !== "credential" &&
167
+ p.name !== "options");
168
+ if (contextRequiredParam.length) {
169
+ factoryFunction.addStatements(`return { ...clientContext, ${contextRequiredParam
170
+ .map((p) => {
171
+ return p.name;
172
+ })
173
+ .join(", ")}} as ${rlcClientName};`);
174
+ }
175
+ else {
176
+ factoryFunction.addStatements(`return clientContext;`);
177
+ }
129
178
  clientContextFile.fixMissingImports({}, { importModuleSpecifierEnding: "js" });
130
179
  clientContextFile.fixUnusedIdentifiers();
131
180
  return clientContextFile;