@azure-tools/typespec-rust 0.1.0

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 (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -0
  3. package/dist/src/codegen/cargotoml.d.ts +3 -0
  4. package/dist/src/codegen/cargotoml.d.ts.map +1 -0
  5. package/dist/src/codegen/cargotoml.js +22 -0
  6. package/dist/src/codegen/cargotoml.js.map +1 -0
  7. package/dist/src/codegen/clients.d.ts +7 -0
  8. package/dist/src/codegen/clients.d.ts.map +1 -0
  9. package/dist/src/codegen/clients.js +514 -0
  10. package/dist/src/codegen/clients.js.map +1 -0
  11. package/dist/src/codegen/codeGenerator.d.ts +14 -0
  12. package/dist/src/codegen/codeGenerator.d.ts.map +1 -0
  13. package/dist/src/codegen/codeGenerator.js +46 -0
  14. package/dist/src/codegen/codeGenerator.js.map +1 -0
  15. package/dist/src/codegen/context.d.ts +10 -0
  16. package/dist/src/codegen/context.d.ts.map +1 -0
  17. package/dist/src/codegen/context.js +75 -0
  18. package/dist/src/codegen/context.js.map +1 -0
  19. package/dist/src/codegen/enums.d.ts +4 -0
  20. package/dist/src/codegen/enums.d.ts.map +1 -0
  21. package/dist/src/codegen/enums.js +48 -0
  22. package/dist/src/codegen/enums.js.map +1 -0
  23. package/dist/src/codegen/helpers.d.ts +18 -0
  24. package/dist/src/codegen/helpers.d.ts.map +1 -0
  25. package/dist/src/codegen/helpers.js +133 -0
  26. package/dist/src/codegen/helpers.js.map +1 -0
  27. package/dist/src/codegen/lib.d.ts +3 -0
  28. package/dist/src/codegen/lib.d.ts.map +1 -0
  29. package/dist/src/codegen/lib.js +37 -0
  30. package/dist/src/codegen/lib.js.map +1 -0
  31. package/dist/src/codegen/mod.d.ts +3 -0
  32. package/dist/src/codegen/mod.d.ts.map +1 -0
  33. package/dist/src/codegen/mod.js +20 -0
  34. package/dist/src/codegen/mod.js.map +1 -0
  35. package/dist/src/codegen/models.d.ts +4 -0
  36. package/dist/src/codegen/models.d.ts.map +1 -0
  37. package/dist/src/codegen/models.js +45 -0
  38. package/dist/src/codegen/models.js.map +1 -0
  39. package/dist/src/codegen/use.d.ts +11 -0
  40. package/dist/src/codegen/use.d.ts.map +1 -0
  41. package/dist/src/codegen/use.js +105 -0
  42. package/dist/src/codegen/use.js.map +1 -0
  43. package/dist/src/codemodel/client.d.ts +137 -0
  44. package/dist/src/codemodel/client.d.ts.map +1 -0
  45. package/dist/src/codemodel/client.js +146 -0
  46. package/dist/src/codemodel/client.js.map +1 -0
  47. package/dist/src/codemodel/crate.d.ts +24 -0
  48. package/dist/src/codemodel/crate.d.ts.map +1 -0
  49. package/dist/src/codemodel/crate.js +53 -0
  50. package/dist/src/codemodel/crate.js.map +1 -0
  51. package/dist/src/codemodel/index.d.ts +5 -0
  52. package/dist/src/codemodel/index.d.ts.map +1 -0
  53. package/dist/src/codemodel/index.js +9 -0
  54. package/dist/src/codemodel/index.js.map +1 -0
  55. package/dist/src/codemodel/method.d.ts +32 -0
  56. package/dist/src/codemodel/method.d.ts.map +1 -0
  57. package/dist/src/codemodel/method.js +33 -0
  58. package/dist/src/codemodel/method.js.map +1 -0
  59. package/dist/src/codemodel/types.d.ts +224 -0
  60. package/dist/src/codemodel/types.d.ts.map +1 -0
  61. package/dist/src/codemodel/types.js +248 -0
  62. package/dist/src/codemodel/types.js.map +1 -0
  63. package/dist/src/emitter.d.ts +5 -0
  64. package/dist/src/emitter.d.ts.map +1 -0
  65. package/dist/src/emitter.js +45 -0
  66. package/dist/src/emitter.js.map +1 -0
  67. package/dist/src/index.d.ts +3 -0
  68. package/dist/src/index.d.ts.map +1 -0
  69. package/dist/src/index.js +7 -0
  70. package/dist/src/index.js.map +1 -0
  71. package/dist/src/lib.d.ts +13 -0
  72. package/dist/src/lib.d.ts.map +1 -0
  73. package/dist/src/lib.js +24 -0
  74. package/dist/src/lib.js.map +1 -0
  75. package/dist/src/tcgcadapter/adapter.d.ts +25 -0
  76. package/dist/src/tcgcadapter/adapter.d.ts.map +1 -0
  77. package/dist/src/tcgcadapter/adapter.js +617 -0
  78. package/dist/src/tcgcadapter/adapter.js.map +1 -0
  79. package/dist/src/tcgcadapter/helpers.d.ts +4 -0
  80. package/dist/src/tcgcadapter/helpers.d.ts.map +1 -0
  81. package/dist/src/tcgcadapter/helpers.js +45 -0
  82. package/dist/src/tcgcadapter/helpers.js.map +1 -0
  83. package/dist/src/tcgcadapter/naming.d.ts +2 -0
  84. package/dist/src/tcgcadapter/naming.d.ts.map +1 -0
  85. package/dist/src/tcgcadapter/naming.js +27 -0
  86. package/dist/src/tcgcadapter/naming.js.map +1 -0
  87. package/package.json +87 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # TypeSpec Rust Generator
2
+
3
+ The TypeSpec Rust generator is intended to be used with the TypeSpec compiler.
4
+
5
+ # Contributing
6
+ This project welcomes contributions and suggestions. Most contributions require you to agree to a
7
+ Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
8
+ the rights to use your contribution. For details, visit https://cla.microsoft.com.
9
+
10
+ When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
11
+ a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
12
+ provided by the bot. You will only need to do this once across all repos using our CLA.
13
+
14
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
15
+ For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
16
+ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
@@ -0,0 +1,3 @@
1
+ import * as rust from '../codemodel/index.js';
2
+ export declare function emitCargoToml(crate: rust.Crate): string;
3
+ //# sourceMappingURL=cargotoml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cargotoml.d.ts","sourceRoot":"","sources":["../../../src/codegen/cargotoml.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAG9C,wBAAgB,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,MAAM,CAevD"}
@@ -0,0 +1,22 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ // emits the Cargo.toml file for this crate
6
+ export function emitCargoToml(crate) {
7
+ let content = `[package]\nname = "${crate.name}"\nversion = "${crate.version}"\n`;
8
+ content += 'authors.workspace = true\n';
9
+ content += 'edition.workspace = true\n';
10
+ content += 'license.workspace = true\n';
11
+ content += 'repository.workspace = true\n';
12
+ content += 'rust-version.workspace = true\n';
13
+ if (crate.dependencies.length > 0) {
14
+ content += '\n[dependencies]\n';
15
+ for (const dependency of crate.dependencies) {
16
+ // dependency versions are managed by the workspace's Cargo.toml file
17
+ content += `${dependency.name} = { workspace = true }\n`;
18
+ }
19
+ }
20
+ return content;
21
+ }
22
+ //# sourceMappingURL=cargotoml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cargotoml.js","sourceRoot":"","sources":["../../../src/codegen/cargotoml.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAI/F,2CAA2C;AAC3C,MAAM,UAAU,aAAa,CAAC,KAAiB;IAC7C,IAAI,OAAO,GAAG,sBAAsB,KAAK,CAAC,IAAI,iBAAiB,KAAK,CAAC,OAAO,KAAK,CAAC;IAClF,OAAO,IAAI,4BAA4B,CAAC;IACxC,OAAO,IAAI,4BAA4B,CAAC;IACxC,OAAO,IAAI,4BAA4B,CAAC;IACxC,OAAO,IAAI,+BAA+B,CAAC;IAC3C,OAAO,IAAI,iCAAiC,CAAC;IAC7C,IAAI,KAAK,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;QACjC,OAAO,IAAI,oBAAoB,CAAC;QAChC,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,YAAY,EAAE;YAC3C,qEAAqE;YACrE,OAAO,IAAI,GAAG,UAAU,CAAC,IAAI,2BAA2B,CAAC;SAC1D;KACF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import * as rust from '../codemodel/index.js';
2
+ export interface ClientFiles {
3
+ readonly name: string;
4
+ readonly content: string;
5
+ }
6
+ export declare function emitClients(crate: rust.Crate): Array<ClientFiles>;
7
+ //# sourceMappingURL=clients.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../../../src/codegen/clients.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAG9C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,CAqMjE"}
@@ -0,0 +1,514 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import * as codegen from '@azure-tools/codegen';
6
+ import * as helpers from './helpers.js';
7
+ import { Use } from './use.js';
8
+ // emits the content for all client files
9
+ export function emitClients(crate) {
10
+ const clientFiles = new Array();
11
+ if (crate.clients.length === 0) {
12
+ return clientFiles;
13
+ }
14
+ const clientMods = new Array();
15
+ // emit the clients, one file per client
16
+ for (const client of crate.clients) {
17
+ const use = new Use();
18
+ const indentation = new helpers.indentation();
19
+ let pubInClients = '';
20
+ if (!client.constructable) {
21
+ // the constructable client will need access to these fields
22
+ pubInClients = 'pub(in crate::generated::clients) ';
23
+ }
24
+ let body = `pub struct ${client.name} {\n`;
25
+ for (const field of client.fields) {
26
+ use.addForType(field.type);
27
+ body += `${indentation.get()}${pubInClients}${field.name}: ${helpers.getTypeDeclaration(field.type)},\n`;
28
+ }
29
+ use.addType('azure_core', 'Pipeline');
30
+ body += `${indentation.get()}${pubInClients}pipeline: Pipeline,\n`;
31
+ body += '}\n\n'; // end client
32
+ if (client.constructable) {
33
+ body += '#[derive(Clone, Debug)]\n';
34
+ body += `pub struct ${client.constructable.options.type.name}`;
35
+ if (client.constructable.options.type.fields.length > 0) {
36
+ body += ' {\n';
37
+ for (const field of client.constructable.options.type.fields) {
38
+ use.addForType(field.type);
39
+ body += `${indentation.get()}${field.name}: ${helpers.getTypeDeclaration(field.type)},\n`;
40
+ }
41
+ body += '}\n\n'; // end client options
42
+ }
43
+ else {
44
+ body += ';\n\n';
45
+ }
46
+ }
47
+ body += `impl ${client.name} {\n`;
48
+ if (client.constructable) {
49
+ // this is an instantiable client, so we need to emit client options and constructors
50
+ use.addType('azure_core', 'Result');
51
+ for (let i = 0; i < client.constructable.constructors.length; ++i) {
52
+ const constructor = client.constructable.constructors[i];
53
+ body += `${indentation.get()}pub fn ${constructor.name}(${getConstructorParamsSig(constructor.parameters, client.constructable.options, use)}) -> Result<Self> {\n`;
54
+ // by convention, the endpoint param is always the first ctor param
55
+ const endpointParamName = constructor.parameters[0].name;
56
+ body += `${indentation.push().get()}let mut ${endpointParamName} = Url::parse(${endpointParamName}.as_ref())?;\n`;
57
+ body += `${indentation.get()}${endpointParamName}.query_pairs_mut().clear();\n`;
58
+ // if there's a credential param, create the necessary auth policy
59
+ const authPolicy = getAuthPolicy(constructor, use);
60
+ if (authPolicy) {
61
+ body += `${indentation.get()}${authPolicy}\n`;
62
+ }
63
+ body += `${indentation.get()}let options = options.unwrap_or_default();\n`;
64
+ body += `${indentation.get()}Ok(Self {\n`;
65
+ // propagate any client option fields to the client initializer
66
+ indentation.push();
67
+ for (const field of getClientOptionsFields(client.constructable.options)) {
68
+ body += `${indentation.get()}${field.name}: options.${field.name},\n`;
69
+ }
70
+ body += `${indentation.get()}${endpointParamName},\n`;
71
+ body += `${indentation.get()}pipeline: Pipeline::new(\n`;
72
+ body += `${indentation.push().get()}option_env!("CARGO_PKG_NAME"),\n`;
73
+ body += `${indentation.get()}option_env!("CARGO_PKG_VERSION"),\n`;
74
+ body += `${indentation.get()}options.client_options,\n`;
75
+ body += `${indentation.get()}Vec::default(),\n`;
76
+ body += `${indentation.get()}${authPolicy ? 'vec![auth_policy]' : 'Vec::default()'},\n`;
77
+ body += `${indentation.pop().get()}),\n`; // end Pipeline::new
78
+ body += `${indentation.pop().get()}})\n`; // end Ok
79
+ body += `${indentation.pop().get()}}\n`; // end constructor
80
+ // ensure extra new-line between ctors and/or client methods
81
+ if (i + 1 < client.constructable.constructors.length || client.methods.length > 0) {
82
+ body += '\n';
83
+ }
84
+ }
85
+ }
86
+ for (let i = 0; i < client.methods.length; ++i) {
87
+ const method = client.methods[i];
88
+ let returnType;
89
+ let async = 'async ';
90
+ // NOTE: when methodBody is called, the starting indentation
91
+ // will be correct for the current scope, so there's no need
92
+ // for the callee to indent right away.
93
+ let methodBody;
94
+ use.addForType(method.returns);
95
+ switch (method.kind) {
96
+ case 'async':
97
+ returnType = helpers.getTypeDeclaration(method.returns);
98
+ methodBody = (indentation) => {
99
+ return getAsyncMethodBody(indentation, use, client, method);
100
+ };
101
+ break;
102
+ case 'clientaccessor':
103
+ async = '';
104
+ returnType = method.returns.name;
105
+ methodBody = (indentation) => {
106
+ return getClientAccessorMethodBody(indentation, method);
107
+ };
108
+ break;
109
+ }
110
+ body += `${indentation.get()}${helpers.formatDocComment(method.docs)}`;
111
+ body += `${indentation.get()}${helpers.emitPub(method.pub)}${async}fn ${method.name}(${getMethodParamsSig(method, use)}) -> ${returnType} {\n`;
112
+ body += `${indentation.push().get()}${methodBody(indentation)}\n`;
113
+ body += `${indentation.pop().get()}}\n`; // end method
114
+ if (i + 1 < client.methods.length) {
115
+ body += '\n';
116
+ }
117
+ }
118
+ body += '}\n\n'; // end client impl
119
+ if (client.constructable) {
120
+ // emit the builder function for client options
121
+ const clientOptionsType = client.constructable.options;
122
+ const builderTypeName = getOptionsBuilderTypeName(clientOptionsType, false);
123
+ body += `impl ${clientOptionsType.type.name} {\n`;
124
+ body += `${indentation.get()}pub fn builder() -> builders::${builderTypeName} {\n`;
125
+ body += `${indentation.push().get()}builders::${builderTypeName}::new()\n`;
126
+ body += `${indentation.pop().get()}}\n`;
127
+ body += '}\n\n'; // end impl
128
+ // emit default trait impl for client options type
129
+ body += `impl Default for ${clientOptionsType.type.name} {\n`;
130
+ body += `${indentation.get()}fn default() -> Self {\n`;
131
+ body += `${indentation.push().get()}Self {\n`;
132
+ indentation.push();
133
+ for (const field of clientOptionsType.type.fields) {
134
+ if (!field.defaultValue) {
135
+ throw new Error(`missing default value for struct field ${clientOptionsType.type.name}.${field.name}`);
136
+ }
137
+ body += `${indentation.get()}${field.name}: ${field.defaultValue},\n`;
138
+ }
139
+ body += `${indentation.pop().get()}}\n`;
140
+ body += `${indentation.pop().get()}}\n`;
141
+ body += '}\n\n'; // end impl
142
+ body += createClientOptionsBuilderImpl(indentation, clientOptionsType, use);
143
+ }
144
+ // emit method options
145
+ for (let i = 0; i < client.methods.length; ++i) {
146
+ const method = client.methods[i];
147
+ if (method.kind === 'clientaccessor') {
148
+ continue;
149
+ }
150
+ body += '#[derive(Clone, Debug, Default)]\n';
151
+ body += `${helpers.emitPub(method.pub)}struct ${helpers.getTypeDeclaration(method.options.type)} {\n`;
152
+ for (const field of method.options.type.fields) {
153
+ use.addForType(field.type);
154
+ body += `${indentation.get()}${field.name}: ${helpers.getTypeDeclaration(field.type)},\n`;
155
+ }
156
+ body += '}\n\n'; // end options
157
+ body += `impl${getLifetimeAnnotation(method.options.type)}${helpers.getTypeDeclaration(method.options.type)} {\n`;
158
+ body += `${indentation.get()}pub fn builder() -> builders::${getOptionsBuilderTypeName(method.options, true)} {\n`;
159
+ body += `${indentation.push().get()}builders::${getOptionsBuilderTypeName(method.options, false)}::new()\n`;
160
+ body += `${indentation.pop().get()}}\n`; // end builder()
161
+ body += '}\n'; // end options impl
162
+ if (i + 1 < client.methods.length) {
163
+ body += '\n';
164
+ }
165
+ }
166
+ body += '\n';
167
+ body += createPubModBuilders(client, use);
168
+ let content = helpers.contentPreamble();
169
+ content += use.text();
170
+ content += body;
171
+ const clientMod = codegen.deconstruct(client.name).join('_');
172
+ clientFiles.push({ name: `${clientMod}.rs`, content: content });
173
+ clientMods.push(clientMod);
174
+ }
175
+ // now emit the mod.rs file for the clients
176
+ let content = helpers.contentPreamble();
177
+ const sortedMods = clientMods.sort((a, b) => { return helpers.sortAscending(a, b); });
178
+ for (const clientMod of sortedMods) {
179
+ content += `pub mod ${clientMod};\n`;
180
+ }
181
+ clientFiles.push({ name: 'mod.rs', content: content });
182
+ return clientFiles;
183
+ }
184
+ function getConstructorParamsSig(params, options, use) {
185
+ const paramsSig = new Array();
186
+ for (const param of params) {
187
+ use.addForType(param.type);
188
+ paramsSig.push(`${param.name}: ${helpers.getTypeDeclaration(param.type)}`);
189
+ }
190
+ paramsSig.push(`options: ${helpers.getTypeDeclaration(options)}`);
191
+ return paramsSig.join(', ');
192
+ }
193
+ function getMethodParamsSig(method, use) {
194
+ const paramsSig = new Array();
195
+ paramsSig.push(formatParamTypeName(method.self));
196
+ for (const param of method.params) {
197
+ if (param.type.kind === 'literal') {
198
+ // literal params are embedded directly in the code (e.g. accept header param)
199
+ continue;
200
+ }
201
+ // don't add client params to the method param sig
202
+ if (method.kind !== 'clientaccessor' && param.location === 'method') {
203
+ use.addForType(param.type);
204
+ paramsSig.push(`${param.name}: ${formatParamTypeName(param)}`);
205
+ }
206
+ }
207
+ if (method.kind !== 'clientaccessor') {
208
+ paramsSig.push(`options: ${helpers.getTypeDeclaration(method.options, true)}`);
209
+ }
210
+ return paramsSig.join(', ');
211
+ }
212
+ // creates the auth policy if the ctor contains a credential param.
213
+ // the policy will be named auth_policy.
214
+ function getAuthPolicy(ctor, use) {
215
+ for (const param of ctor.parameters) {
216
+ if (param.type.kind === 'arc' && param.type.type.kind === 'tokenCredential') {
217
+ use.addType('azure_core', 'BearerTokenCredentialPolicy');
218
+ const scopes = new Array();
219
+ for (const scope of param.type.type.scopes) {
220
+ scopes.push(`"${scope}"`);
221
+ }
222
+ return `let auth_policy: Arc<dyn Policy> = Arc::new(BearerTokenCredentialPolicy::new(credential, vec![${scopes.join(', ')}]));`;
223
+ }
224
+ }
225
+ return undefined;
226
+ }
227
+ function formatParamTypeName(param) {
228
+ let format = '';
229
+ if (param.ref) {
230
+ format = '&';
231
+ }
232
+ if (param.mut) {
233
+ format += 'mut ';
234
+ }
235
+ if (param.type) {
236
+ format += helpers.getTypeDeclaration(param.type);
237
+ }
238
+ else {
239
+ format += param.name;
240
+ }
241
+ return format;
242
+ }
243
+ function createClientOptionsBuilderImpl(indentation, options, use) {
244
+ use.addType('azure_core::builders', 'ClientOptionsBuilder');
245
+ use.addTypes('azure_core', ['Policy', 'RetryOptions', /*'TelemetryOptions', */ 'TransportOptions']);
246
+ use.addType('std::sync', 'Arc');
247
+ const emitWithMethod = function (indentation, name, into) {
248
+ let withPolicies = `${indentation.get()}fn with_${name}<P>(mut self, ${name}: P) -> Self `;
249
+ withPolicies += `where P: Into<${into}>, Self: Sized {\n`;
250
+ withPolicies += `${indentation.push().get()}self.client_options.set_${name}(${name});\n`;
251
+ withPolicies += `${indentation.get()}self\n`;
252
+ withPolicies += `${indentation.pop().get()}}\n\n`;
253
+ return withPolicies;
254
+ };
255
+ let implBuilder = `impl ClientOptionsBuilder for ${options.type.name} {\n`;
256
+ implBuilder += emitWithMethod(indentation, 'per_call_policies', 'Vec<Arc<dyn Policy>>');
257
+ implBuilder += emitWithMethod(indentation, 'per_try_policies', 'Vec<Arc<dyn Policy>>');
258
+ implBuilder += emitWithMethod(indentation, 'retry', 'RetryOptions');
259
+ // TODO: https://github.com/Azure/azure-sdk-for-rust/issues/1753
260
+ //implBuilder += emitWithMethod(indentation, 'telemetry', 'TelemetryOptions');
261
+ implBuilder += emitWithMethod(indentation, 'transport', 'TransportOptions');
262
+ implBuilder += '}\n\n';
263
+ return implBuilder;
264
+ }
265
+ function createPubModBuilders(client, use) {
266
+ const indentation = new helpers.indentation();
267
+ let body = 'pub mod builders {\n';
268
+ body += `${indentation.get()}use super::*;\n\n`;
269
+ const emitNewFunction = function (indentation, options) {
270
+ let newFunction = `${indentation.push().get()}pub(super) fn new() -> Self {\n`;
271
+ newFunction += `${indentation.push().get()}Self {\n`;
272
+ newFunction += `${indentation.push().get()}options: ${options.type.name}::default(),\n`;
273
+ newFunction += `${indentation.pop().get()}}\n`;
274
+ newFunction += `${indentation.pop().get()}}\n\n`;
275
+ return newFunction;
276
+ };
277
+ const emitBuildMethod = function (indentation, options) {
278
+ let buildMethod = `${indentation.get()}pub fn build(&self) -> ${options.type.name} {\n`;
279
+ buildMethod += `${indentation.push().get()}self.options.clone()\n`;
280
+ buildMethod += `${indentation.pop().get()}}\n`;
281
+ return buildMethod;
282
+ };
283
+ if (client.constructable) {
284
+ // emit the builder type for client options
285
+ const clientOptionsType = client.constructable.options;
286
+ const builderTypeName = getOptionsBuilderTypeName(clientOptionsType, false);
287
+ body += `${indentation.get()}pub struct ${builderTypeName} {\n`;
288
+ body += `${indentation.push().get()}options: ${clientOptionsType.type.name},\n`;
289
+ body += `${indentation.pop().get()}}\n\n`; // end struct
290
+ body += `${indentation.get()}impl ${builderTypeName} {\n`;
291
+ body += emitNewFunction(indentation, clientOptionsType);
292
+ body += emitBuildMethod(indentation, clientOptionsType);
293
+ for (const field of getClientOptionsFields(client.constructable.options)) {
294
+ let typeName = helpers.getTypeDeclaration(field.type);
295
+ let into = '';
296
+ if (field.type.kind === 'String') {
297
+ // for Strings, we define these as "impl Into<String>" so that passing a str will just work
298
+ typeName = `impl Into<${typeName}>`;
299
+ into = '.into()';
300
+ }
301
+ body += `\n${indentation.get()}pub fn with_${field.name}(mut self, ${field.name}: ${typeName}) -> Self {\n`;
302
+ body += `${indentation.push().get()}self.options.${field.name} = ${field.name}${into};\n`;
303
+ body += `${indentation.get()}self\n`;
304
+ body += `${indentation.pop().get()}}\n`;
305
+ }
306
+ body += `${indentation.pop().get()}}\n\n`; // end impl
307
+ }
308
+ // emit the client method options builders
309
+ for (let i = 0; i < client.methods.length; ++i) {
310
+ const method = client.methods[i];
311
+ if (method.kind === 'clientaccessor') {
312
+ continue;
313
+ }
314
+ use.addType('azure_core', 'Context');
315
+ use.addType('azure_core::builders', 'ClientMethodOptionsBuilder');
316
+ const optionsBuilderTypeName = getOptionsBuilderTypeName(method.options, true);
317
+ body += `${indentation.get()}pub struct ${optionsBuilderTypeName} {\n`;
318
+ body += `${indentation.push().get()}options: ${helpers.getTypeDeclaration(method.options.type)},\n`;
319
+ body += `${indentation.pop().get()}}\n\n`; // end struct
320
+ body += `${indentation.get()}impl ${getOptionsBuilderTypeName(method.options, 'anonymous')} {\n`;
321
+ body += emitNewFunction(indentation, method.options);
322
+ body += emitBuildMethod(indentation, method.options);
323
+ body += `${indentation.pop().get()}}\n\n`; // end impl
324
+ body += `${indentation.get()}impl${getLifetimeAnnotation(method.options.type)}ClientMethodOptionsBuilder${getLifetimeAnnotation(method.options.type)}for ${optionsBuilderTypeName} {\n`;
325
+ body += `${indentation.push().get()}fn with_context(mut self, context: &${getLifetimeName(method.options.type)}Context) -> Self {\n`;
326
+ body += `${indentation.push().get()}self.options.${getClientMethodOptionsFieldName(method.options)}.set_context(context);\n`;
327
+ body += `${indentation.get()}self\n`;
328
+ body += `${indentation.pop().get()}}\n`; // end with_context
329
+ body += `${indentation.pop().get()}}\n`; // end ClientMethodOptionsBuilder impl
330
+ if (i + 1 < client.methods.length) {
331
+ body += '\n';
332
+ }
333
+ }
334
+ body += '}\n'; // end pub mod builders
335
+ return body;
336
+ }
337
+ function getOptionsBuilderTypeName(option, withLifetime) {
338
+ if (!withLifetime || !option.type.lifetime) {
339
+ return `${option.type.name}Builder`;
340
+ }
341
+ else if (withLifetime === 'anonymous') {
342
+ return `${option.type.name}Builder${helpers.AnonymousLifetimeAnnotation}`;
343
+ }
344
+ return `${option.type.name}Builder${helpers.getGenericLifetimeAnnotation(option.type.lifetime)}`;
345
+ }
346
+ // returns a filtered array of struct fields from the client options types
347
+ function getClientOptionsFields(option) {
348
+ const fields = new Array();
349
+ for (const field of option.type.fields) {
350
+ if (helpers.getTypeDeclaration(field.type) === 'ClientOptions') {
351
+ // azure_core::ClientOptions is passed to Pipeline::new so skip it
352
+ continue;
353
+ }
354
+ fields.push(field);
355
+ }
356
+ return fields;
357
+ }
358
+ function getClientMethodOptionsFieldName(option) {
359
+ for (const field of option.type.fields) {
360
+ // startsWith to ignore possible lifetime annotation suffix
361
+ if (helpers.getTypeDeclaration(field.type).startsWith('ClientMethodOptions')) {
362
+ return field.name;
363
+ }
364
+ }
365
+ throw new Error(`didn't find ClientMethodOptions field in ${option.type.name}`);
366
+ }
367
+ function getLifetimeAnnotation(type) {
368
+ if (type.lifetime) {
369
+ return `${helpers.getGenericLifetimeAnnotation(type.lifetime)} `;
370
+ }
371
+ return ' ';
372
+ }
373
+ function getLifetimeName(type) {
374
+ if (type.lifetime) {
375
+ return `${type.lifetime.name} `;
376
+ }
377
+ return ' ';
378
+ }
379
+ function getEndpointFieldName(client) {
380
+ // find the endpoint field. it's the only one that's
381
+ // a Url. the name will be uniform across clients
382
+ let endpointFieldName;
383
+ for (const field of client.fields) {
384
+ if (field.type.kind === 'Url') {
385
+ endpointFieldName = field.name;
386
+ }
387
+ else if (endpointFieldName) {
388
+ throw new Error(`found multiple URL fields in client ${client.name} which is unexpected`);
389
+ }
390
+ }
391
+ if (!endpointFieldName) {
392
+ throw new Error(`didn't find URI field for client ${client.name}`);
393
+ }
394
+ return endpointFieldName;
395
+ }
396
+ function getClientAccessorMethodBody(indentation, clientAccessor) {
397
+ let body = `${clientAccessor.returns.name} {\n`;
398
+ const endpointFieldName = getEndpointFieldName(clientAccessor.returns);
399
+ body += `${indentation.push().get()}${endpointFieldName}: self.${endpointFieldName}.clone(),\n`;
400
+ body += `${indentation.get()}pipeline: self.pipeline.clone(),\n`;
401
+ body += `${indentation.pop().get()}}`;
402
+ return body;
403
+ }
404
+ function getAsyncMethodBody(indentation, use, client, method) {
405
+ use.addTypes('azure_core', ['AsClientMethodOptions', 'Method', 'Request']);
406
+ let body = 'let options = options.unwrap_or_default();\n';
407
+ body += `${indentation.get()}let mut ctx = options.method_options.context();\n`;
408
+ body += `${indentation.get()}let mut url = self.${getEndpointFieldName(client)}.clone();\n`;
409
+ // collect and sort all the header/path/query params
410
+ const headerParams = new Array();
411
+ const pathParams = new Array();
412
+ const queryParams = new Array();
413
+ for (const param of method.params) {
414
+ switch (param.kind) {
415
+ case 'header':
416
+ case 'headerCollection':
417
+ headerParams.push(param);
418
+ break;
419
+ case 'path':
420
+ pathParams.push(param);
421
+ break;
422
+ case 'query':
423
+ case 'queryCollection':
424
+ queryParams.push(param);
425
+ break;
426
+ }
427
+ }
428
+ headerParams.sort((a, b) => { return helpers.sortAscending(a.header, b.header); });
429
+ pathParams.sort((a, b) => { return helpers.sortAscending(a.segment, b.segment); });
430
+ queryParams.sort((a, b) => { return helpers.sortAscending(a.key, b.key); });
431
+ let path = `"${method.httpPath}"`;
432
+ if (pathParams.length > 0) {
433
+ // we have path params that need to have their segments replaced with the param values
434
+ body += `${indentation.get()}let mut path = String::from(${path});\n`;
435
+ for (const pathParam of pathParams) {
436
+ body += `${indentation.get()}path = path.replace("{${pathParam.segment}}", &${getHeaderPathQueryParamValue(pathParam)});\n`;
437
+ }
438
+ path = '&path';
439
+ }
440
+ body += `${indentation.get()}url.set_path(${path});\n`;
441
+ for (const queryParam of queryParams) {
442
+ if (queryParam.kind === 'queryCollection' && queryParam.format === 'multi') {
443
+ const valueVar = queryParam.name[0];
444
+ body += `${indentation.get()}for ${valueVar} in ${queryParam.name}.iter() {\n`;
445
+ body += `${indentation.push().get()}url.query_pairs_mut().append_pair("${queryParam.key}", ${valueVar});\n`;
446
+ body += `${indentation.pop().get()}}\n`;
447
+ }
448
+ else {
449
+ body += `${indentation.get()}url.query_pairs_mut().append_pair("${queryParam.key}", &${getHeaderPathQueryParamValue(queryParam)});\n`;
450
+ }
451
+ }
452
+ body += `${indentation.get()}let mut request = Request::new(url, Method::${codegen.capitalize(method.httpMethod)});\n`;
453
+ for (const headerParam of headerParams) {
454
+ body += `${indentation.get()}request.insert_header("${headerParam.header.toLowerCase()}", ${getHeaderPathQueryParamValue(headerParam)});\n`;
455
+ }
456
+ const bodyParam = getBodyParameter(method);
457
+ if (bodyParam) {
458
+ body += `${indentation.get()}request.set_body(${bodyParam.name});\n`;
459
+ }
460
+ body += `${indentation.get()}self.pipeline.send(&mut ctx, &mut request).await\n`;
461
+ return body;
462
+ }
463
+ function getBodyParameter(method) {
464
+ let bodyParam;
465
+ for (const param of method.params) {
466
+ if (param.kind === 'body') {
467
+ if (bodyParam) {
468
+ throw new Error(`method ${method.name} has multiple body parameters`);
469
+ }
470
+ bodyParam = param;
471
+ }
472
+ }
473
+ return bodyParam;
474
+ }
475
+ function getHeaderPathQueryParamValue(param) {
476
+ let paramName = '';
477
+ if (param.location === 'client') {
478
+ paramName = 'self.';
479
+ }
480
+ if (param.kind === 'headerCollection' || param.kind === 'queryCollection') {
481
+ if (param.format === 'multi') {
482
+ throw new Error('multi should have been handled outside getHeaderPathQueryParamValue');
483
+ }
484
+ return `${param.name}.join("${getCollectionDelimiter(param.format)}")`;
485
+ }
486
+ switch (param.type.kind) {
487
+ case 'String':
488
+ paramName += param.name;
489
+ break;
490
+ case 'implTrait':
491
+ // only done for method params so no need to include paramName prefix
492
+ return `${param.name}.into()`;
493
+ case 'literal':
494
+ return `"${param.type.value}"`;
495
+ default:
496
+ throw new Error(`unhandled ${param.kind} param type kind ${param.type.kind}`);
497
+ }
498
+ return paramName;
499
+ }
500
+ function getCollectionDelimiter(format) {
501
+ switch (format) {
502
+ case 'csv':
503
+ return ',';
504
+ case 'pipes':
505
+ return '|';
506
+ case 'ssv':
507
+ return ' ';
508
+ case 'tsv':
509
+ return '\t';
510
+ default:
511
+ throw new Error(`unhandled collection format ${format}`);
512
+ }
513
+ }
514
+ //# sourceMappingURL=clients.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clients.js","sourceRoot":"","sources":["../../../src/codegen/clients.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAS/B,yCAAyC;AACzC,MAAM,UAAU,WAAW,CAAC,KAAiB;IAC3C,MAAM,WAAW,GAAG,IAAI,KAAK,EAAe,CAAC;IAC7C,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QAC9B,OAAO,W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