@azure-tools/typespec-ts 0.33.0 → 0.34.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.
- package/CHANGELOG.md +37 -0
- package/dist/src/framework/declaration.js.map +1 -1
- package/dist/src/framework/dependency.d.ts +25 -0
- package/dist/src/framework/dependency.d.ts.map +1 -1
- package/dist/src/framework/hooks/binder.d.ts +1 -1
- package/dist/src/framework/hooks/binder.d.ts.map +1 -1
- package/dist/src/framework/hooks/binder.js +16 -12
- package/dist/src/framework/hooks/binder.js.map +1 -1
- package/dist/src/framework/hooks/sdkTypes.d.ts +4 -2
- package/dist/src/framework/hooks/sdkTypes.d.ts.map +1 -1
- package/dist/src/framework/hooks/sdkTypes.js +43 -8
- package/dist/src/framework/hooks/sdkTypes.js.map +1 -1
- package/dist/src/framework/refkey.js +1 -1
- package/dist/src/framework/refkey.js.map +1 -1
- package/dist/src/framework/sample.js +1 -1
- package/dist/src/framework/sample.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +81 -24
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +37 -3
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +26 -1
- package/dist/src/lib.js.map +1 -1
- package/dist/src/modular/buildClassicalClient.d.ts +2 -2
- package/dist/src/modular/buildClassicalClient.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalClient.js +25 -61
- package/dist/src/modular/buildClassicalClient.js.map +1 -1
- package/dist/src/modular/buildClassicalOperationGroups.d.ts.map +1 -1
- package/dist/src/modular/buildClassicalOperationGroups.js +0 -7
- package/dist/src/modular/buildClassicalOperationGroups.js.map +1 -1
- package/dist/src/modular/buildClientContext.d.ts +7 -3
- package/dist/src/modular/buildClientContext.d.ts.map +1 -1
- package/dist/src/modular/buildClientContext.js +58 -38
- package/dist/src/modular/buildClientContext.js.map +1 -1
- package/dist/src/modular/buildCodeModel.d.ts +18 -0
- package/dist/src/modular/buildCodeModel.d.ts.map +1 -1
- package/dist/src/modular/buildCodeModel.js +95 -42
- package/dist/src/modular/buildCodeModel.js.map +1 -1
- package/dist/src/modular/buildOperations.d.ts +3 -4
- package/dist/src/modular/buildOperations.d.ts.map +1 -1
- package/dist/src/modular/buildOperations.js +24 -45
- package/dist/src/modular/buildOperations.js.map +1 -1
- package/dist/src/modular/buildProjectFiles.d.ts.map +1 -1
- package/dist/src/modular/buildProjectFiles.js +3 -1
- package/dist/src/modular/buildProjectFiles.js.map +1 -1
- package/dist/src/modular/buildRestorePoller.js +1 -1
- package/dist/src/modular/buildRestorePoller.js.map +1 -1
- package/dist/src/modular/buildRootIndex.d.ts +5 -0
- package/dist/src/modular/buildRootIndex.d.ts.map +1 -1
- package/dist/src/modular/buildRootIndex.js +62 -17
- package/dist/src/modular/buildRootIndex.js.map +1 -1
- package/dist/src/modular/buildSubpathIndex.d.ts +1 -1
- package/dist/src/modular/buildSubpathIndex.d.ts.map +1 -1
- package/dist/src/modular/buildSubpathIndex.js +11 -10
- package/dist/src/modular/buildSubpathIndex.js.map +1 -1
- package/dist/src/modular/emitModels.d.ts +13 -28
- package/dist/src/modular/emitModels.d.ts.map +1 -1
- package/dist/src/modular/emitModels.js +435 -240
- package/dist/src/modular/emitModels.js.map +1 -1
- package/dist/src/modular/emitModelsOptions.d.ts +26 -0
- package/dist/src/modular/emitModelsOptions.d.ts.map +1 -0
- package/dist/src/modular/emitModelsOptions.js +106 -0
- package/dist/src/modular/emitModelsOptions.js.map +1 -0
- package/dist/src/modular/emitSamples.d.ts +7 -0
- package/dist/src/modular/emitSamples.d.ts.map +1 -0
- package/dist/src/modular/emitSamples.js +354 -0
- package/dist/src/modular/emitSamples.js.map +1 -0
- package/dist/src/modular/external-dependencies.d.ts +7 -0
- package/dist/src/modular/external-dependencies.d.ts.map +1 -1
- package/dist/src/modular/external-dependencies.js +58 -1
- package/dist/src/modular/external-dependencies.js.map +1 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.js +2 -2
- package/dist/src/modular/helpers/classicalOperationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.d.ts +13 -6
- package/dist/src/modular/helpers/clientHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.js +117 -48
- package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
- package/dist/src/modular/helpers/namingHelpers.d.ts +3 -2
- package/dist/src/modular/helpers/namingHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/namingHelpers.js +3 -0
- package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.d.ts +9 -11
- package/dist/src/modular/helpers/operationHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.js +255 -408
- package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.d.ts +12 -0
- package/dist/src/modular/helpers/typeHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.js +30 -6
- package/dist/src/modular/helpers/typeHelpers.js.map +1 -1
- package/dist/src/modular/modularCodeModel.d.ts +2 -1
- package/dist/src/modular/modularCodeModel.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.d.ts +5 -0
- package/dist/src/modular/serialization/buildDeserializerFunction.d.ts.map +1 -0
- package/dist/src/modular/serialization/buildDeserializerFunction.js +327 -0
- package/dist/src/modular/serialization/buildDeserializerFunction.js.map +1 -0
- package/dist/src/modular/serialization/buildSerializerFunction.d.ts +4 -3
- package/dist/src/modular/serialization/buildSerializerFunction.d.ts.map +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.js +285 -102
- package/dist/src/modular/serialization/buildSerializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/serializeUtils.d.ts +15 -0
- package/dist/src/modular/serialization/serializeUtils.d.ts.map +1 -0
- package/dist/src/modular/serialization/serializeUtils.js +102 -0
- package/dist/src/modular/serialization/serializeUtils.js.map +1 -0
- package/dist/src/modular/type-expressions/get-credential-expression.d.ts +3 -0
- package/dist/src/modular/type-expressions/get-credential-expression.d.ts.map +1 -0
- package/dist/src/modular/type-expressions/get-credential-expression.js +17 -0
- package/dist/src/modular/type-expressions/get-credential-expression.js.map +1 -0
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts +6 -0
- package/dist/src/modular/type-expressions/get-enum-expression.d.ts.map +1 -0
- package/dist/src/modular/type-expressions/get-enum-expression.js +18 -0
- package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -0
- package/dist/src/modular/type-expressions/get-model-expression.d.ts +9 -0
- package/dist/src/modular/type-expressions/get-model-expression.d.ts.map +1 -0
- package/dist/src/modular/type-expressions/get-model-expression.js +42 -0
- package/dist/src/modular/type-expressions/get-model-expression.js.map +1 -0
- package/dist/src/modular/type-expressions/get-type-expression.d.ts +8 -0
- package/dist/src/modular/type-expressions/get-type-expression.d.ts.map +1 -0
- package/dist/src/modular/type-expressions/get-type-expression.js +94 -0
- package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -0
- package/dist/src/modular/type-expressions/get-union-expression.d.ts +5 -0
- package/dist/src/modular/type-expressions/get-union-expression.d.ts.map +1 -0
- package/dist/src/modular/type-expressions/get-union-expression.js +13 -0
- package/dist/src/modular/type-expressions/get-union-expression.js.map +1 -0
- package/dist/src/modular/type-expressions/utils.d.ts +5 -0
- package/dist/src/modular/type-expressions/utils.d.ts.map +1 -0
- package/dist/src/modular/type-expressions/utils.js +9 -0
- package/dist/src/modular/type-expressions/utils.js.map +1 -0
- package/dist/src/transform/transform.js +1 -1
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/transform/transformApiVersionInfo.js +1 -1
- package/dist/src/transform/transformApiVersionInfo.js.map +1 -1
- package/dist/src/transform/transformParameters.js +1 -1
- package/dist/src/transform/transformParameters.js.map +1 -1
- package/dist/src/transform/transformSchemas.d.ts.map +1 -1
- package/dist/src/transform/transformSchemas.js +3 -3
- package/dist/src/transform/transformSchemas.js.map +1 -1
- package/dist/src/utils/clientUtils.d.ts.map +1 -1
- package/dist/src/utils/clientUtils.js +1 -4
- package/dist/src/utils/clientUtils.js.map +1 -1
- package/dist/src/utils/credentialUtils.d.ts +5 -0
- package/dist/src/utils/credentialUtils.d.ts.map +1 -1
- package/dist/src/utils/credentialUtils.js +36 -4
- package/dist/src/utils/credentialUtils.js.map +1 -1
- package/dist/src/utils/modelUtils.d.ts.map +1 -1
- package/dist/src/utils/modelUtils.js +28 -43
- package/dist/src/utils/modelUtils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -26
- package/src/framework/declaration.ts +0 -1
- package/src/framework/dependency.ts +25 -0
- package/src/framework/hooks/binder.ts +19 -14
- package/src/framework/hooks/sdkTypes.ts +53 -13
- package/src/framework/refkey.ts +1 -1
- package/src/framework/sample.ts +1 -1
- package/src/index.ts +96 -25
- package/src/lib.ts +26 -3
- package/src/modular/buildClassicalClient.ts +30 -97
- package/src/modular/buildClassicalOperationGroups.ts +0 -14
- package/src/modular/buildClientContext.ts +90 -50
- package/src/modular/buildCodeModel.ts +118 -47
- package/src/modular/buildOperations.ts +41 -76
- package/src/modular/buildProjectFiles.ts +4 -2
- package/src/modular/buildRestorePoller.ts +1 -1
- package/src/modular/buildRootIndex.ts +75 -35
- package/src/modular/buildSubpathIndex.ts +13 -11
- package/src/modular/emitModels.ts +588 -326
- package/src/modular/emitModelsOptions.ts +161 -0
- package/src/modular/emitSamples.ts +481 -0
- package/src/modular/external-dependencies.ts +59 -1
- package/src/modular/helpers/classicalOperationHelpers.ts +6 -2
- package/src/modular/helpers/clientHelpers.ts +182 -76
- package/src/modular/helpers/namingHelpers.ts +14 -2
- package/src/modular/helpers/operationHelpers.ts +356 -638
- package/src/modular/helpers/typeHelpers.ts +38 -6
- package/src/modular/modularCodeModel.ts +3 -0
- package/src/modular/serialization/buildDeserializerFunction.ts +492 -0
- package/src/modular/serialization/buildSerializerFunction.ts +434 -141
- package/src/modular/serialization/serializeUtils.ts +143 -0
- package/src/modular/type-expressions/get-credential-expression.ts +18 -0
- package/src/modular/type-expressions/get-enum-expression.ts +28 -0
- package/src/modular/type-expressions/get-model-expression.ts +63 -0
- package/src/modular/type-expressions/get-type-expression.ts +111 -0
- package/src/modular/type-expressions/get-union-expression.ts +20 -0
- package/src/modular/type-expressions/utils.ts +15 -0
- package/src/transform/transform.ts +2 -2
- package/src/transform/transformApiVersionInfo.ts +2 -2
- package/src/transform/transformParameters.ts +1 -1
- package/src/transform/transformSchemas.ts +9 -8
- package/src/utils/clientUtils.ts +2 -12
- package/src/utils/credentialUtils.ts +43 -3
- package/src/utils/modelUtils.ts +32 -41
- package/static/static-helpers/serialization/serializers.ts +60 -0
- package/dist/src/modular/buildSerializeUtils.d.ts +0 -14
- package/dist/src/modular/buildSerializeUtils.d.ts.map +0 -1
- package/dist/src/modular/buildSerializeUtils.js +0 -534
- package/dist/src/modular/buildSerializeUtils.js.map +0 -1
- package/src/modular/buildSerializeUtils.ts +0 -749
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
## 0.34.0 (2024-11-11)
|
|
2
|
+
|
|
3
|
+
- [Feature] Generate knownable api version and fix flattening enum issue. Please refer to [#2889](https://github.com/Azure/autorest.typescript/pull/2889)
|
|
4
|
+
- [Feature] Switch to use vendored version for rimraf, mkdirp, and uglify-js in JS repo. Please refer to [#2886](https://github.com/Azure/autorest.typescript/pull/2886)
|
|
5
|
+
- [Feature] Models generation related follow up on the binder work. Please refer to [#2878](https://github.com/Azure/autorest.typescript/pull/2878)
|
|
6
|
+
- [Feature] Remove core-http dependency. Please refer to [#2874](https://github.com/Azure/autorest.typescript/pull/2874)
|
|
7
|
+
- [Feature] Upgrade cadl-ranch version to v0.15.0. Please refer to [#2872](https://github.com/Azure/autorest.typescript/pull/2872)
|
|
8
|
+
- [Feature] Generate healthInsights_radiologyinsights code with isModularLibrary: true. Please refer to [#2871](https://github.com/Azure/autorest.typescript/pull/2871)
|
|
9
|
+
- [Feature] Support the allowReserved for path parameter in Modular. Please refer to [#2858](https://github.com/Azure/autorest.typescript/pull/2858)
|
|
10
|
+
- [Feature] Upgrade compiler to v0.61.x and tcgc in Oct. Please refer to [#2854](https://github.com/Azure/autorest.typescript/pull/2854)
|
|
11
|
+
- [Feature] Upgrade azure-rest/core-client to 2.3.1 in RLC and Modular. Please refer to [#2851](https://github.com/Azure/autorest.typescript/pull/2851)
|
|
12
|
+
- [Feature] Switch to doc from description since description is deprecated. Please refer to [#2850](https://github.com/Azure/autorest.typescript/pull/2850)
|
|
13
|
+
- [Feature] Support hookTimeout config generation in vitest.config.ts and vitest.…. Please refer to [#2847](https://github.com/Azure/autorest.typescript/pull/2847)
|
|
14
|
+
- [Feature] Support sample.env generation in rlc-common for typespec-ts. Please refer to [#2845](https://github.com/Azure/autorest.typescript/pull/2845)
|
|
15
|
+
- [Feature] Use dev-tool command in tshy for monorepo. Please refer to [#2843](https://github.com/Azure/autorest.typescript/pull/2843)
|
|
16
|
+
- [Feature] Remove the import logic of paging. Please refer to [#2837](https://github.com/Azure/autorest.typescript/pull/2837)
|
|
17
|
+
- [Feature] Config Nightly CI improvement with forcing run. Please refer to [#2829](https://github.com/Azure/autorest.typescript/pull/2829)
|
|
18
|
+
- [Feature] Upgrade typescript to 5.6.2. Please refer to [#2824](https://github.com/Azure/autorest.typescript/pull/2824)
|
|
19
|
+
- [Feature] Stop exporting api layer for MPG. Please refer to [#2823](https://github.com/Azure/autorest.typescript/pull/2823)
|
|
20
|
+
- [Feature] Upgrade compiler to v0.60.x and tcgc in Sep. Please refer to [#2819](https://github.com/Azure/autorest.typescript/pull/2819)
|
|
21
|
+
- [Feature] Bump emitter version to v0.33. Please refer to [#2804](https://github.com/Azure/autorest.typescript/pull/2804)
|
|
22
|
+
- [Feature] Remove core-paging dependency in RLC. Please refer to [#2785](https://github.com/Azure/autorest.typescript/pull/2785)
|
|
23
|
+
- [Feature] Update the finalStateVia config for LRO operations. Please refer to [#2783](https://github.com/Azure/autorest.typescript/pull/2783)
|
|
24
|
+
- [Feature] Sample generation for MPG for cliassical client. Please refer to [#2770](https://github.com/Azure/autorest.typescript/pull/2770)
|
|
25
|
+
- [Feature] Use binder to manage model dependency and support model deserializer with partially adopt to tcgc sdkPackage. Please refer to [#2759](https://github.com/Azure/autorest.typescript/pull/2759)
|
|
26
|
+
- [Feature] Upgrade dev dependency prettier to version 3.3.3 in generated packages. Please refer to [#2675](https://github.com/Azure/autorest.typescript/pull/2675)
|
|
27
|
+
- [Bugfix] Fix UserAgentInfo and Constantpaths issues. Please refer to [#2888](https://github.com/Azure/autorest.typescript/pull/2888)
|
|
28
|
+
- [Bugfix] Adjust the key link format for modular readme. Please refer to [#2885](https://github.com/Azure/autorest.typescript/pull/2885)
|
|
29
|
+
- [Bugfix] Fix the sample issue with escaped chars. Please refer to [#2875](https://github.com/Azure/autorest.typescript/pull/2875)
|
|
30
|
+
- [Bugfix] Fix static-helper relative path. Please refer to [#2873](https://github.com/Azure/autorest.typescript/pull/2873)
|
|
31
|
+
- [Bugfix] Codegen crashed as NYI Serialization of anonymous types. Please refer to [#2870](https://github.com/Azure/autorest.typescript/pull/2870)
|
|
32
|
+
- [Bugfix] Fix the optional body parameter issues. Please refer to [#2868](https://github.com/Azure/autorest.typescript/pull/2868)
|
|
33
|
+
- [Bugfix] Remove "./" from tsconfig's include/exclude as they are not needed. Please refer to [#2849](https://github.com/Azure/autorest.typescript/pull/2849)
|
|
34
|
+
- [Bugfix] Fix the generation path of logger.ts. Please refer to [#2848](https://github.com/Azure/autorest.typescript/pull/2848)
|
|
35
|
+
- [Bugfix] Support encode int as string. Please refer to [#2838](https://github.com/Azure/autorest.typescript/pull/2838)
|
|
36
|
+
- [Bugfix] Should generate samples for spread cases. Please refer to [#2833](https://github.com/Azure/autorest.typescript/pull/2833)
|
|
37
|
+
|
|
1
38
|
## 0.33.0 (2024-09-06)
|
|
2
39
|
|
|
3
40
|
- [Feature] Fix body optionality default parameter to true for implicit body. Please refer to [#2731](https://github.com/Azure/autorest.typescript/pull/2731)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declaration.js","sourceRoot":"","sources":["../../../src/framework/declaration.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,aAAa,EAMd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AA4ClD,MAAM,UAAU,cAAc,CAC5B,UAAsB,EACtB,WAAkC,EAClC,MAAe;IAEf,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAE3B,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,gCAAgC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAC9D,CAAC;IACJ,CAAC;IAED,MAAM,YAAY,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"declaration.js","sourceRoot":"","sources":["../../../src/framework/declaration.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,aAAa,EAMd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AA4ClD,MAAM,UAAU,cAAc,CAC5B,UAAsB,EACtB,WAAkC,EAClC,MAAe;IAEf,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAE3B,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,gCAAgC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAC9D,CAAC;IACJ,CAAC;IAED,MAAM,YAAY,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC7E,MAAM,sBAAsB,GAAG,MAAM,CAAC,gBAAgB,CACpD,YAAY,EACZ,WAAW,CAAC,IAAI,EAChB,UAAU,CACX,CAAC;IAEF,2CAA2C;IAC3C,MAAM,kBAAkB,GAAG,EAAE,GAAG,WAAW,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC;IAE5E,QAAQ,kBAAkB,CAAC,IAAI,EAAE,CAAC;QAChC,KAAK,aAAa,CAAC,KAAK;YACtB,OAAO,UAAU,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;QACjD,KAAK,aAAa,CAAC,IAAI;YACrB,OAAO,UAAU,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAChD,KAAK,aAAa,CAAC,QAAQ;YACzB,OAAO,UAAU,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;QACpD,KAAK,aAAa,CAAC,SAAS;YAC1B,OAAO,UAAU,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;QACrD,KAAK,aAAa,CAAC,SAAS;YAC1B,OAAO,UAAU,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;QACrD;YACE,MAAM,IAAI,KAAK,CACb,gCAAiC,kBAA0B,CAAC,IAAI,EAAE,CACnE,CAAC;IACN,CAAC;AACH,CAAC"}
|
|
@@ -39,6 +39,11 @@ export interface CoreDependencies extends Record<string, ReferenceableSymbol> {
|
|
|
39
39
|
name: "OperationOptions";
|
|
40
40
|
module: string;
|
|
41
41
|
};
|
|
42
|
+
StreamableMethod: {
|
|
43
|
+
kind: "externalDependency";
|
|
44
|
+
name: "StreamableMethod";
|
|
45
|
+
module: string;
|
|
46
|
+
};
|
|
42
47
|
PathUncheckedResponse: {
|
|
43
48
|
kind: "externalDependency";
|
|
44
49
|
name: "PathUncheckedResponse";
|
|
@@ -69,6 +74,26 @@ export interface CoreDependencies extends Record<string, ReferenceableSymbol> {
|
|
|
69
74
|
name: "stringToUint8Array";
|
|
70
75
|
module: string;
|
|
71
76
|
};
|
|
77
|
+
isKeyCredential: {
|
|
78
|
+
kind: "externalDependency";
|
|
79
|
+
name: "isKeyCredential";
|
|
80
|
+
module: string;
|
|
81
|
+
};
|
|
82
|
+
KeyCredential: {
|
|
83
|
+
kind: "externalDependency";
|
|
84
|
+
name: "KeyCredential";
|
|
85
|
+
module: string;
|
|
86
|
+
};
|
|
87
|
+
TokenCredential: {
|
|
88
|
+
kind: "externalDependency";
|
|
89
|
+
name: "TokenCredential";
|
|
90
|
+
module: string;
|
|
91
|
+
};
|
|
92
|
+
ErrorModel: {
|
|
93
|
+
kind: "externalDependency";
|
|
94
|
+
name: "ErrorModel";
|
|
95
|
+
module: string;
|
|
96
|
+
};
|
|
72
97
|
}
|
|
73
98
|
export type CoreDependency = keyof CoreDependencies;
|
|
74
99
|
//# sourceMappingURL=dependency.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency.d.ts","sourceRoot":"","sources":["../../../src/framework/dependency.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;CACpC;AAED,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GACjD,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC;IAC3E,MAAM,EAAE;QAAE,IAAI,EAAE,oBAAoB,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACvE,aA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,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,eAAe,EAAE;QACf,IAAI,EAAE,oBAAoB,CAAC;QAC3B,IAAI,EAAE,iBAAiB,CAAC;QACxB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,UAAU,EAAE;QACV,IAAI,EAAE,oBAAoB,CAAC;QAC3B,IAAI,EAAE,YAAY,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,gBAAgB,CAAC"}
|
|
@@ -20,7 +20,7 @@ export interface Binder {
|
|
|
20
20
|
*/
|
|
21
21
|
trackDeclaration(refkey: unknown, name: string, sourceFile: SourceFile): string;
|
|
22
22
|
resolveReference(refkey: unknown): string;
|
|
23
|
-
resolveAllReferences(): void;
|
|
23
|
+
resolveAllReferences(sourceRoot: string): void;
|
|
24
24
|
}
|
|
25
25
|
export declare function provideBinder(project: Project, options?: BinderOptions): Binder;
|
|
26
26
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binder.d.ts","sourceRoot":"","sources":["../../../../src/framework/hooks/binder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAIV,OAAO,EACR,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAGL,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"binder.d.ts","sourceRoot":"","sources":["../../../../src/framework/hooks/binder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAIV,OAAO,EACR,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAGL,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AAInC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,MAAM;IACrB;;;;;;OAMG;IACH,gBAAgB,CACd,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,UAAU,GACrB,MAAM,CAAC;IACV,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;IAC1C,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAChD;AA2RD,wBAAgB,aAAa,CAC3B,OAAO,EAAE,OAAO,EAChB,OAAO,GAAE,aAAkB,GAC1B,MAAM,CAIR;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC"}
|
|
@@ -3,7 +3,9 @@ import { provideContext, useContext } from "../../contextManager.js";
|
|
|
3
3
|
import { provideDependencies, useDependencies } from "./useDependencies.js";
|
|
4
4
|
import { refkey } from "../refkey.js";
|
|
5
5
|
import { isStaticHelperMetadata, SourceFileSymbol } from "../load-static-helpers.js";
|
|
6
|
-
|
|
6
|
+
import path from "path/posix";
|
|
7
|
+
import { normalizePath } from "@typespec/compiler";
|
|
8
|
+
const PLACEHOLDER_PREFIX = "__PLACEHOLDER_";
|
|
7
9
|
class BinderImp {
|
|
8
10
|
constructor(project, options = {}) {
|
|
9
11
|
var _a;
|
|
@@ -84,7 +86,7 @@ class BinderImp {
|
|
|
84
86
|
* @returns The serialized placeholder string.
|
|
85
87
|
*/
|
|
86
88
|
serializePlaceholder(refkey) {
|
|
87
|
-
return `${PLACEHOLDER_PREFIX}${String(refkey)}
|
|
89
|
+
return `${PLACEHOLDER_PREFIX}${String(refkey)}__`;
|
|
88
90
|
}
|
|
89
91
|
/**
|
|
90
92
|
* Adds an import declaration to a source file.
|
|
@@ -130,17 +132,18 @@ class BinderImp {
|
|
|
130
132
|
/**
|
|
131
133
|
* Applies all tracked imports to their respective source files.
|
|
132
134
|
*/
|
|
133
|
-
resolveAllReferences() {
|
|
134
|
-
|
|
135
|
+
resolveAllReferences(sourceRoot) {
|
|
136
|
+
this.project.getSourceFiles().map((file) => {
|
|
135
137
|
this.resolveDeclarationReferences(file);
|
|
136
138
|
this.resolveDependencyReferences(file);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
const importStructures = this.imports.get(file);
|
|
140
|
+
if (importStructures) {
|
|
141
|
+
for (const importStructure of importStructures) {
|
|
142
|
+
file.addImportDeclaration(importStructure);
|
|
143
|
+
}
|
|
141
144
|
}
|
|
142
|
-
}
|
|
143
|
-
this.cleanUnreferencedHelpers();
|
|
145
|
+
});
|
|
146
|
+
this.cleanUnreferencedHelpers(sourceRoot);
|
|
144
147
|
}
|
|
145
148
|
resolveDependencyReferences(file) {
|
|
146
149
|
var _a;
|
|
@@ -194,7 +197,7 @@ class BinderImp {
|
|
|
194
197
|
}
|
|
195
198
|
this.references.get(refkey).add(sourceFile);
|
|
196
199
|
}
|
|
197
|
-
cleanUnreferencedHelpers() {
|
|
200
|
+
cleanUnreferencedHelpers(sourceRoot) {
|
|
198
201
|
const usedHelperFiles = new Set();
|
|
199
202
|
for (const helper of this.staticHelpers.values()) {
|
|
200
203
|
const sourceFile = helper[SourceFileSymbol];
|
|
@@ -208,7 +211,8 @@ class BinderImp {
|
|
|
208
211
|
}
|
|
209
212
|
}
|
|
210
213
|
this.project
|
|
211
|
-
|
|
214
|
+
//normalizae the final path to adapt to different systems
|
|
215
|
+
.getSourceFiles(normalizePath(path.join(sourceRoot, "static-helpers/**/*.ts")))
|
|
212
216
|
.filter((helperFile) => !usedHelperFiles.has(helperFile))
|
|
213
217
|
.forEach((helperFile) => helperFile.delete());
|
|
214
218
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binder.js","sourceRoot":"","sources":["../../../../src/framework/hooks/binder.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EAGd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"binder.js","sourceRoot":"","sources":["../../../../src/framework/hooks/binder.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EAGd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AA8BnD,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAE5C,MAAM,SAAS;IASb,YAAY,OAAgB,EAAE,UAAyB,EAAE;;QARjD,iBAAY,GAAG,IAAI,GAAG,EAA4B,CAAC;QACnD,eAAU,GAAG,IAAI,GAAG,EAA4B,CAAC;QACjD,YAAO,GAAG,IAAI,GAAG,EAA4C,CAAC;QAC9D,wBAAmB,GAAG,IAAI,GAAG,EAA2B,CAAC;QAM/D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,mBAAmB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QA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UAAU,SAAS;IACvB,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;GAKG;AACH,SAAS,kBAAkB,CACzB,UAAsB,EACtB,WAAmB,EACnB,KAAa;IAEb,MAAM,QAAQ,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;IAC1C,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,GAAG,CAAC,CAAC;IACzD,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACnD,UAAU,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,2BAA2B,CAClC,UAAsB,EACtB,WAAmB;IAEnB,OAAO,UAAU,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACH,SAAS,YAAY,CAAC,MAAc;IAClC,OAAO,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,kBAAkB,CAAC,UAAsB;IAChD,OAAO,UAAU,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { SdkHttpOperation, SdkPackage, SdkServiceMethod, SdkType } from "@azure-tools/typespec-client-generator-core";
|
|
2
1
|
import { Operation, Type } from "@typespec/compiler";
|
|
2
|
+
import { SdkHttpOperation, SdkServiceMethod, SdkType } from "@azure-tools/typespec-client-generator-core";
|
|
3
|
+
import { SdkContext } from "../../utils/interfaces.js";
|
|
4
|
+
export declare const emitQueue: Set<SdkType>;
|
|
3
5
|
export interface SdkTypeContext {
|
|
4
6
|
operations: Map<Type, SdkServiceMethod<SdkHttpOperation>>;
|
|
5
7
|
types: Map<Type, SdkType>;
|
|
@@ -8,5 +10,5 @@ export declare function useSdkTypes(): {
|
|
|
8
10
|
(type: Operation): SdkServiceMethod<SdkHttpOperation>;
|
|
9
11
|
(type: Type): SdkType;
|
|
10
12
|
};
|
|
11
|
-
export declare function provideSdkTypes(
|
|
13
|
+
export declare function provideSdkTypes(context: SdkContext): void;
|
|
12
14
|
//# sourceMappingURL=sdkTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdkTypes.d.ts","sourceRoot":"","sources":["../../../../src/framework/hooks/sdkTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"sdkTypes.d.ts","sourceRoot":"","sources":["../../../../src/framework/hooks/sdkTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAwB,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAEL,gBAAgB,EAChB,gBAAgB,EAChB,OAAO,EAER,MAAM,6CAA6C,CAAC;AAIrD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,eAAO,MAAM,SAAS,EAAE,GAAG,CAAC,OAAO,CAAsB,CAAC;AAE1D,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC1D,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;CAC3B;AAED,wBAAgB,WAAW;WAIC,SAAS,GAAG,gBAAgB,CAAC,gBAAgB,CAAC;WAC9C,IAAI,GAAG,OAAO;EA6BzC;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,QAqElD"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { getClientType } from "@azure-tools/typespec-client-generator-core";
|
|
2
1
|
import { getNamespaceFullName } from "@typespec/compiler";
|
|
2
|
+
import { getClientType } from "@azure-tools/typespec-client-generator-core";
|
|
3
3
|
import { provideContext, useContext } from "../../contextManager.js";
|
|
4
|
+
import { visitPackageTypes } from "../../modular/emitModels.js";
|
|
5
|
+
export const emitQueue = new Set();
|
|
4
6
|
export function useSdkTypes() {
|
|
5
7
|
const sdkTypesContext = useContext("sdkTypes");
|
|
6
8
|
const { tcgcContext } = useContext("emitContext");
|
|
@@ -23,18 +25,47 @@ export function useSdkTypes() {
|
|
|
23
25
|
}
|
|
24
26
|
return getSdkType;
|
|
25
27
|
}
|
|
26
|
-
export function provideSdkTypes(
|
|
28
|
+
export function provideSdkTypes(context) {
|
|
29
|
+
const { sdkPackage } = context;
|
|
27
30
|
const sdkTypesContext = {
|
|
28
31
|
operations: new Map(),
|
|
29
32
|
types: new Map()
|
|
30
33
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
visitPackageTypes(context);
|
|
35
|
+
for (const sdkModel of emitQueue) {
|
|
36
|
+
switch (sdkModel.kind) {
|
|
37
|
+
case "model":
|
|
38
|
+
sdkModel.properties.forEach((prop) => {
|
|
39
|
+
sdkTypesContext.types.set(prop.type.__raw, prop.type);
|
|
40
|
+
});
|
|
41
|
+
if (sdkModel.discriminatedSubtypes) {
|
|
42
|
+
Object.values(sdkModel.discriminatedSubtypes).forEach((subtype) => {
|
|
43
|
+
sdkTypesContext.types.set(subtype.__raw, subtype);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
break;
|
|
47
|
+
case "enum":
|
|
48
|
+
if (sdkModel.__raw) {
|
|
49
|
+
sdkTypesContext.types.set(sdkModel.__raw, sdkModel);
|
|
50
|
+
}
|
|
51
|
+
break;
|
|
52
|
+
case "union":
|
|
53
|
+
sdkModel.variantTypes.forEach((v) => {
|
|
54
|
+
if (v.__raw) {
|
|
55
|
+
sdkTypesContext.types.set(v.__raw, v);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
break;
|
|
59
|
+
case "array":
|
|
60
|
+
sdkTypesContext.types.set(sdkModel.valueType.__raw, sdkModel.valueType);
|
|
61
|
+
break;
|
|
62
|
+
case "dict":
|
|
63
|
+
sdkTypesContext.types.set(sdkModel.valueType.__raw, sdkModel.valueType);
|
|
64
|
+
break;
|
|
65
|
+
case "nullable":
|
|
66
|
+
sdkTypesContext.types.set(sdkModel.type.__raw, sdkModel.type);
|
|
67
|
+
break;
|
|
34
68
|
}
|
|
35
|
-
sdkTypesContext.types.set(sdkEnum.__raw, sdkEnum);
|
|
36
|
-
}
|
|
37
|
-
for (const sdkModel of sdkPackage.models) {
|
|
38
69
|
if (!sdkModel.__raw) {
|
|
39
70
|
continue;
|
|
40
71
|
}
|
|
@@ -46,6 +77,10 @@ export function provideSdkTypes(sdkPackage) {
|
|
|
46
77
|
continue;
|
|
47
78
|
}
|
|
48
79
|
sdkTypesContext.operations.set(method.__raw, method);
|
|
80
|
+
// Visit the parameters of the method to add them to the types map
|
|
81
|
+
method.parameters.forEach((param) => {
|
|
82
|
+
sdkTypesContext.types.set(param.type.__raw, param.type);
|
|
83
|
+
});
|
|
49
84
|
}
|
|
50
85
|
}
|
|
51
86
|
provideContext("sdkTypes", sdkTypesContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdkTypes.js","sourceRoot":"","sources":["../../../../src/framework/hooks/sdkTypes.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"sdkTypes.js","sourceRoot":"","sources":["../../../../src/framework/hooks/sdkTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAKL,aAAa,EACd,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGhE,MAAM,CAAC,MAAM,SAAS,GAAiB,IAAI,GAAG,EAAW,CAAC;AAO1D,MAAM,UAAU,WA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,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,CAAC;aAAM,CAAC;YACN,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refkey.js","sourceRoot":"","sources":["../../../src/framework/refkey.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG,IAAI,OAAO,EAAmB,CAAC;AACjD,IAAI,KAAK,GAAG,CAAC,CAAC;AAEd,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,KAAK,EAAE,EAAE,CAAC;IAC1B,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAE1B,OAAO,GAAG,CAAC;AACb,CAAC;AAKD,SAAS,MAAM,CAAC,KAAc;IAC5B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,YAAY,CAAC,KAAK,CAAW,CAAC;IACvC,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,EAAY,CAAC;IACvC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAG,IAAe;IACvC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"refkey.js","sourceRoot":"","sources":["../../../src/framework/refkey.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG,IAAI,OAAO,EAAmB,CAAC;AACjD,IAAI,KAAK,GAAG,CAAC,CAAC;AAEd,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,KAAK,EAAE,EAAE,CAAC;IAC1B,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAE1B,OAAO,GAAG,CAAC;AACb,CAAC;AAKD,SAAS,MAAM,CAAC,KAAc;IAC5B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,YAAY,CAAC,KAAK,CAAW,CAAC;IACvC,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,EAAY,CAAC;IACvC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAG,IAAe;IACvC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -50,7 +50,7 @@ const modelReference = resolveReference(modelType);
|
|
|
50
50
|
sourceFile2.addStatements(`${functionReference}();`);
|
|
51
51
|
sourceFile2.addStatements(`let obj: ${modelReference} = { id: 1 };`);
|
|
52
52
|
// Apply imports to ensure correct references
|
|
53
|
-
binder.resolveAllReferences();
|
|
53
|
+
binder.resolveAllReferences("/modularPackageFolder/src");
|
|
54
54
|
// Output the generated files
|
|
55
55
|
console.log("// test.ts");
|
|
56
56
|
console.log(sourceFile.getFullText());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sample.js","sourceRoot":"","sources":["../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AAC,aAAa,CAAC,GAAG,iBAAiB,KAAK,CAAC,CAAC;AACrD,WAAW,CAAC,aAAa,CAAC,YAAY,cAAc,eAAe,CAAC,CAAC;AAErE,6CAA6C;AAC7C,MAAM,CAAC,oBAAoB,CAAC,2BAA2B,CAAC,CAAC;AAEzD,6BAA6B;AAC7B,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAC1B,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;AACtC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AAC3B,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC;AAEvC,SAAS;AACT,UAAU;AACV,0BAA0B;AAC1B,kBAAkB;AAClB,IAAI;AAEJ,gCAAgC;AAChC,kCAAkC;AAClC,IAAI;AAEJ,cAAc;AACd,oDAAoD;AAEpD,gBAAgB;AAChB,oCAAoC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { EmitContext } from "@typespec/compiler";
|
|
2
2
|
import { SdkContext } from "./utils/interfaces.js";
|
|
3
|
+
import { SourceFile } from "ts-morph";
|
|
3
4
|
export * from "./lib.js";
|
|
4
5
|
export declare function $onEmit(context: EmitContext): Promise<void>;
|
|
6
|
+
export declare function removeUnusedImports(file: SourceFile): Promise<void>;
|
|
5
7
|
export declare function createContextWithDefaultOptions(context: EmitContext<Record<string, any>>): Promise<SdkContext>;
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAW,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAuB,UAAU,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAW,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAuB,UAAU,EAAE,MAAM,uBAAuB,CAAC;AA+CxE,OAAO,EAAW,UAAU,EAAE,MAAM,UAAU,CAAC;AA2B/C,cAAc,UAAU,CAAC;AAEzB,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,iBA+UjD;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,UAAU,iBAyBzD;AAED,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GACxC,OAAO,CAAC,UAAU,CAAC,CAyBrB"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
import * as fsextra from "fs-extra";
|
|
4
|
-
import { AzureCoreDependencies, AzurePollingDependencies, DefaultCoreDependencies } from "./modular/external-dependencies.js";
|
|
4
|
+
import { AzureCoreDependencies, AzureIdentityDependencies, AzurePollingDependencies, DefaultCoreDependencies } from "./modular/external-dependencies.js";
|
|
5
5
|
import { PagingHelpers, PollingHelpers, SerializationHelpers } from "./modular/static-helpers-metadata.js";
|
|
6
|
-
import { buildApiExtractorConfig, buildClient, buildClientDefinitions, buildEsLintConfig, buildIndexFile, buildIsUnexpectedHelper, buildLicenseFile, buildLogger, buildPackageFile, buildParameterTypes, buildPollingHelper, buildPaginateHelper as buildRLCPaginateHelper, buildReadmeFile, buildRecordedClientFile, buildResponseTypes, buildRollupConfig, buildSampleTest, buildSamples, buildSerializeHelper, buildTopLevelIndex, buildTsConfig, buildTsTestBrowserConfig, buildVitestConfig, getClientName, hasUnexpectedHelper, isAzurePackage, updatePackageFile } from "@azure-tools/rlc-common";
|
|
7
|
-
import { buildModels, buildModelsOptions } from "./modular/emitModels.js";
|
|
6
|
+
import { buildApiExtractorConfig, buildClient, buildClientDefinitions, buildEsLintConfig, buildIndexFile, buildIsUnexpectedHelper, buildLicenseFile, buildLogger, buildPackageFile, buildParameterTypes, buildPollingHelper, buildPaginateHelper as buildRLCPaginateHelper, buildReadmeFile, buildRecordedClientFile, buildResponseTypes, buildRollupConfig, buildSampleTest, buildSamples, buildSerializeHelper, buildTopLevelIndex, buildTsConfig, buildTsTestBrowserConfig, buildVitestConfig, getClientName, hasUnexpectedHelper, isAzurePackage, updatePackageFile, buildSampleEnvFile } from "@azure-tools/rlc-common";
|
|
8
7
|
import { buildRootIndex, buildSubClientIndexFile } from "./modular/buildRootIndex.js";
|
|
9
8
|
import { emitContentByBuilder, emitModels } from "./utils/emitUtil.js";
|
|
10
9
|
import { provideContext, useContext } from "./contextManager.js";
|
|
11
10
|
import { Project } from "ts-morph";
|
|
12
11
|
import { buildClassicOperationFiles } from "./modular/buildClassicalOperationGroups.js";
|
|
13
12
|
import { buildClassicalClient } from "./modular/buildClassicalClient.js";
|
|
14
|
-
import { buildClientContext } from "./modular/buildClientContext.js";
|
|
13
|
+
import { getClientContextPath, buildClientContext } from "./modular/buildClientContext.js";
|
|
14
|
+
import { buildApiOptions } from "./modular/emitModelsOptions.js";
|
|
15
15
|
import { buildOperationFiles } from "./modular/buildOperations.js";
|
|
16
16
|
import { buildRestorePoller } from "./modular/buildRestorePoller.js";
|
|
17
|
-
import { buildSerializeUtils } from "./modular/buildSerializeUtils.js";
|
|
18
17
|
import { buildSubpathIndexFile } from "./modular/buildSubpathIndex.js";
|
|
19
18
|
import { createSdkContext } from "@azure-tools/typespec-client-generator-core";
|
|
20
19
|
import { emitCodeModel } from "./modular/buildCodeModel.js";
|
|
21
20
|
import { emitLoggerFile } from "./modular/emitLoggerFile.js";
|
|
22
21
|
import { emitSerializerHelpersFile } from "./modular/buildHelperSerializers.js";
|
|
23
|
-
import {
|
|
22
|
+
import { emitTypes } from "./modular/emitModels.js";
|
|
24
23
|
import { existsSync } from "fs";
|
|
25
24
|
import { getModuleExports } from "./modular/buildProjectFiles.js";
|
|
26
25
|
import { getRLCClients } from "./utils/clientUtils.js";
|
|
@@ -30,6 +29,7 @@ import { provideBinder } from "./framework/hooks/binder.js";
|
|
|
30
29
|
import { provideSdkTypes } from "./framework/hooks/sdkTypes.js";
|
|
31
30
|
import { transformRLCModel } from "./transform/transform.js";
|
|
32
31
|
import { transformRLCOptions } from "./transform/transfromRLCOptions.js";
|
|
32
|
+
import { emitSamples } from "./modular/emitSamples.js";
|
|
33
33
|
export * from "./lib.js";
|
|
34
34
|
export async function $onEmit(context) {
|
|
35
35
|
/** Shared status */
|
|
@@ -48,7 +48,6 @@ export async function $onEmit(context) {
|
|
|
48
48
|
compilerContext: context,
|
|
49
49
|
tcgcContext: dpgContext
|
|
50
50
|
});
|
|
51
|
-
provideSdkTypes(dpgContext.sdkPackage);
|
|
52
51
|
const { modularSourcesDir } = await calculateGenerationDir(rlcOptions);
|
|
53
52
|
const staticHelpers = await loadStaticHelpers(outputProject, {
|
|
54
53
|
...SerializationHelpers,
|
|
@@ -56,7 +55,11 @@ export async function $onEmit(context) {
|
|
|
56
55
|
...PollingHelpers
|
|
57
56
|
}, { sourcesDir: modularSourcesDir });
|
|
58
57
|
const extraDependencies = isAzurePackage({ options: rlcOptions })
|
|
59
|
-
? {
|
|
58
|
+
? {
|
|
59
|
+
...AzurePollingDependencies,
|
|
60
|
+
...AzureCoreDependencies,
|
|
61
|
+
...AzureIdentityDependencies
|
|
62
|
+
}
|
|
60
63
|
: { ...DefaultCoreDependencies };
|
|
61
64
|
const binder = provideBinder(outputProject, {
|
|
62
65
|
staticHelpers,
|
|
@@ -64,6 +67,7 @@ export async function $onEmit(context) {
|
|
|
64
67
|
...extraDependencies
|
|
65
68
|
}
|
|
66
69
|
});
|
|
70
|
+
provideSdkTypes(dpgContext);
|
|
67
71
|
const rlcCodeModels = [];
|
|
68
72
|
let modularCodeModel;
|
|
69
73
|
// 1. Enrich the dpg context with path detail and common options
|
|
@@ -161,27 +165,33 @@ export async function $onEmit(context) {
|
|
|
161
165
|
overwrite: true
|
|
162
166
|
});
|
|
163
167
|
const isMultiClients = modularCodeModel.clients.length > 1;
|
|
168
|
+
emitTypes(dpgContext, { sourceRoot: modularSourcesRoot });
|
|
169
|
+
buildSubpathIndexFile(modularCodeModel, "models");
|
|
170
|
+
// Enable modular sample generation when explicitly set to true or MPG
|
|
171
|
+
if ((emitterOptions === null || emitterOptions === void 0 ? void 0 : emitterOptions.generateSample) === true) {
|
|
172
|
+
const samples = emitSamples(dpgContext);
|
|
173
|
+
// Refine the rlc sample generation logic
|
|
174
|
+
// TODO: remember to remove this out when RLC is splitted from Modular
|
|
175
|
+
if (samples.length > 0) {
|
|
176
|
+
dpgContext.rlcOptions.generateSample = true;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
164
179
|
for (const subClient of modularCodeModel.clients) {
|
|
165
|
-
|
|
166
|
-
buildModelsOptions(subClient, modularCodeModel);
|
|
167
|
-
if (!env["EXPERIMENTAL_TYPESPEC_TS_SERIALIZATION"])
|
|
168
|
-
buildSerializeUtils(modularCodeModel);
|
|
169
|
-
// build operation files
|
|
180
|
+
buildApiOptions(dpgContext, subClient, modularCodeModel);
|
|
170
181
|
buildOperationFiles(subClient, dpgContext, modularCodeModel);
|
|
171
182
|
buildClientContext(subClient, dpgContext, modularCodeModel);
|
|
172
|
-
buildSubpathIndexFile(subClient, modularCodeModel, "models");
|
|
173
183
|
buildRestorePoller(modularCodeModel, subClient);
|
|
174
184
|
if ((_c = dpgContext.rlcOptions) === null || _c === void 0 ? void 0 : _c.hierarchyClient) {
|
|
175
|
-
buildSubpathIndexFile(
|
|
185
|
+
buildSubpathIndexFile(modularCodeModel, "api", subClient);
|
|
176
186
|
}
|
|
177
187
|
else {
|
|
178
|
-
buildSubpathIndexFile(
|
|
188
|
+
buildSubpathIndexFile(modularCodeModel, "api", subClient, {
|
|
179
189
|
exportIndex: true
|
|
180
190
|
});
|
|
181
191
|
}
|
|
182
192
|
buildClassicalClient(subClient, dpgContext, modularCodeModel);
|
|
183
193
|
buildClassicOperationFiles(dpgContext, modularCodeModel, subClient);
|
|
184
|
-
buildSubpathIndexFile(
|
|
194
|
+
buildSubpathIndexFile(modularCodeModel, "classic", subClient, {
|
|
185
195
|
exportIndex: true,
|
|
186
196
|
interfaceOnly: true
|
|
187
197
|
});
|
|
@@ -190,15 +200,22 @@ export async function $onEmit(context) {
|
|
|
190
200
|
}
|
|
191
201
|
buildRootIndex(subClient, modularCodeModel, rootIndexFile);
|
|
192
202
|
}
|
|
193
|
-
binder.resolveAllReferences();
|
|
203
|
+
binder.resolveAllReferences(modularSourcesRoot);
|
|
194
204
|
for (const file of project.getSourceFiles()) {
|
|
195
|
-
file.fixMissingImports({}, {
|
|
205
|
+
file.fixMissingImports({}, {
|
|
206
|
+
importModuleSpecifierEnding: "js",
|
|
207
|
+
importModuleSpecifierPreference: "relative",
|
|
208
|
+
includePackageJsonAutoImports: "off",
|
|
209
|
+
excludeLibrarySymbolsInNavTo: true
|
|
210
|
+
});
|
|
211
|
+
await removeUnusedImports(file);
|
|
196
212
|
file.fixUnusedIdentifiers();
|
|
197
213
|
await emitContentByBuilder(program, () => ({ content: file.getFullText(), path: file.getFilePath() }), modularCodeModel);
|
|
198
214
|
}
|
|
199
215
|
}
|
|
200
216
|
async function generateMetadataAndTest() {
|
|
201
217
|
var _a, _b, _c, _d, _e;
|
|
218
|
+
const project = useContext("outputProject");
|
|
202
219
|
if (rlcCodeModels.length === 0 || !rlcCodeModels[0]) {
|
|
203
220
|
return;
|
|
204
221
|
}
|
|
@@ -215,7 +232,8 @@ export async function $onEmit(context) {
|
|
|
215
232
|
buildRollupConfig,
|
|
216
233
|
buildApiExtractorConfig,
|
|
217
234
|
buildReadmeFile,
|
|
218
|
-
buildLicenseFile
|
|
235
|
+
buildLicenseFile,
|
|
236
|
+
buildSampleEnvFile
|
|
219
237
|
];
|
|
220
238
|
if (option.moduleKind === "esm") {
|
|
221
239
|
commonBuilders.push((model) => buildVitestConfig(model, "node"));
|
|
@@ -235,7 +253,8 @@ export async function $onEmit(context) {
|
|
|
235
253
|
...modularPackageInfo,
|
|
236
254
|
dependencies: {
|
|
237
255
|
"@azure/core-util": "^1.9.2"
|
|
238
|
-
}
|
|
256
|
+
},
|
|
257
|
+
clientContextPaths: getRelativeContextPaths(modularCodeModel)
|
|
239
258
|
};
|
|
240
259
|
}
|
|
241
260
|
}
|
|
@@ -244,7 +263,6 @@ export async function $onEmit(context) {
|
|
|
244
263
|
// build metadata relevant files
|
|
245
264
|
await emitContentByBuilder(program, commonBuilders, rlcClient, (_c = dpgContext.generationPathDetail) === null || _c === void 0 ? void 0 : _c.metadataDir);
|
|
246
265
|
if (option.isModularLibrary) {
|
|
247
|
-
const project = useContext("outputProject");
|
|
248
266
|
for (const file of project.getSourceFiles()) {
|
|
249
267
|
await emitContentByBuilder(program, () => ({ content: file.getFullText(), path: file.getFilePath() }), modularCodeModel);
|
|
250
268
|
}
|
|
@@ -259,12 +277,45 @@ export async function $onEmit(context) {
|
|
|
259
277
|
await emitContentByBuilder(program, [buildRecordedClientFile, buildSampleTest], rlcClient, (_e = dpgContext.generationPathDetail) === null || _e === void 0 ? void 0 : _e.metadataDir);
|
|
260
278
|
}
|
|
261
279
|
}
|
|
280
|
+
function getRelativeContextPaths(codeModel) {
|
|
281
|
+
return codeModel.clients
|
|
282
|
+
.map((subClient) => getClientContextPath(subClient, codeModel))
|
|
283
|
+
.map((path) => path.substring(path.indexOf("src")));
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
export async function removeUnusedImports(file) {
|
|
287
|
+
file.getImportDeclarations().map((importDeclaration) => {
|
|
288
|
+
importDeclaration.getFullText();
|
|
289
|
+
importDeclaration.getNamedImports().map((namedImport) => {
|
|
290
|
+
namedImport.getFullText();
|
|
291
|
+
if (namedImport
|
|
292
|
+
.getNameNode()
|
|
293
|
+
.findReferencesAsNodes()
|
|
294
|
+
.filter((n) => {
|
|
295
|
+
return n.getSourceFile().getFilePath() === file.getFilePath();
|
|
296
|
+
}).length === 1) {
|
|
297
|
+
namedImport.remove();
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
if (importDeclaration.getNamedImports().length === 0) {
|
|
301
|
+
importDeclaration.remove();
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
file.getExportDeclarations().map((exportDeclaration) => {
|
|
305
|
+
if (exportDeclaration.getNamedExports().length === 0) {
|
|
306
|
+
exportDeclaration.remove();
|
|
307
|
+
}
|
|
308
|
+
});
|
|
262
309
|
}
|
|
263
310
|
export async function createContextWithDefaultOptions(context) {
|
|
311
|
+
var _a, _b;
|
|
312
|
+
const flattenUnionAsEnum = context.options["experimentalExtensibleEnums"] === undefined
|
|
313
|
+
? isArm(context)
|
|
314
|
+
: context.options["experimentalExtensibleEnums"];
|
|
264
315
|
const tcgcSettings = {
|
|
265
316
|
"generate-protocol-methods": true,
|
|
266
317
|
"generate-convenience-methods": true,
|
|
267
|
-
"flatten-union-as-enum":
|
|
318
|
+
"flatten-union-as-enum": flattenUnionAsEnum,
|
|
268
319
|
emitters: [
|
|
269
320
|
{
|
|
270
321
|
main: "@azure-tools/typespec-ts",
|
|
@@ -276,6 +327,12 @@ export async function createContextWithDefaultOptions(context) {
|
|
|
276
327
|
...context.options,
|
|
277
328
|
...tcgcSettings
|
|
278
329
|
};
|
|
279
|
-
return (await createSdkContext(context));
|
|
330
|
+
return (await createSdkContext(context, (_b = (_a = context.program.emitters[0]) === null || _a === void 0 ? void 0 : _a.metadata.name) !== null && _b !== void 0 ? _b : "@azure-tools/typespec-ts"));
|
|
331
|
+
}
|
|
332
|
+
// TODO: should be removed once tcgc issue is resolved https://github.com/Azure/typespec-azure/issues/1794
|
|
333
|
+
function isArm(context) {
|
|
334
|
+
var _a, _b;
|
|
335
|
+
const packageName = (_b = ((_a = context === null || context === void 0 ? void 0 : context.options["packageDetails"]) !== null && _a !== void 0 ? _a : {})["name"]) !== null && _b !== void 0 ? _b : "";
|
|
336
|
+
return packageName === null || packageName === void 0 ? void 0 : packageName.startsWith("@azure/arm-");
|
|
280
337
|
}
|
|
281
338
|
//# sourceMappingURL=index.js.map
|