@azure-tools/typespec-ts 0.54.0-alpha.20260601.2 → 0.54.0-dev.4
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 +0 -11
- package/README.md +0 -4
- package/dist/src/contextManager.js +3 -3
- package/dist/src/contextManager.js.map +1 -1
- package/dist/src/framework/hooks/binder.js +19 -20
- package/dist/src/framework/hooks/binder.js.map +1 -1
- package/dist/src/framework/hooks/sdkTypes.js +1 -2
- package/dist/src/framework/hooks/sdkTypes.js.map +1 -1
- package/dist/src/framework/load-static-helpers.js +7 -8
- package/dist/src/framework/load-static-helpers.js.map +1 -1
- package/dist/src/framework/reference.js +1 -1
- package/dist/src/framework/reference.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +34 -45
- package/dist/src/index.js.map +1 -1
- package/dist/src/modular/buildClassicalClient.js +14 -15
- package/dist/src/modular/buildClassicalClient.js.map +1 -1
- package/dist/src/modular/buildClassicalOperationGroups.js +4 -3
- package/dist/src/modular/buildClassicalOperationGroups.js.map +1 -1
- package/dist/src/modular/buildClientContext.js +1 -2
- package/dist/src/modular/buildClientContext.js.map +1 -1
- package/dist/src/modular/buildModularOptions.js +4 -5
- package/dist/src/modular/buildModularOptions.js.map +1 -1
- package/dist/src/modular/buildOperations.js +1 -2
- package/dist/src/modular/buildOperations.js.map +1 -1
- package/dist/src/modular/buildProjectFiles.js +1 -2
- package/dist/src/modular/buildProjectFiles.js.map +1 -1
- package/dist/src/modular/buildRestorePoller.js +1 -2
- package/dist/src/modular/buildRestorePoller.js.map +1 -1
- package/dist/src/modular/buildRootIndex.d.ts.map +1 -1
- package/dist/src/modular/buildRootIndex.js +9 -14
- package/dist/src/modular/buildRootIndex.js.map +1 -1
- package/dist/src/modular/buildSubpathIndex.js +1 -2
- package/dist/src/modular/buildSubpathIndex.js.map +1 -1
- package/dist/src/modular/emitLoggerFile.js +2 -2
- package/dist/src/modular/emitLoggerFile.js.map +1 -1
- package/dist/src/modular/emitModels.js +32 -46
- package/dist/src/modular/emitModels.js.map +1 -1
- package/dist/src/modular/emitModelsOptions.js +1 -1
- package/dist/src/modular/emitModelsOptions.js.map +1 -1
- package/dist/src/modular/emitSamples.js +34 -30
- package/dist/src/modular/emitSamples.js.map +1 -1
- package/dist/src/modular/emitTests.js +4 -6
- package/dist/src/modular/emitTests.js.map +1 -1
- package/dist/src/modular/helpers/classicalOperationHelpers.js +42 -42
- package/dist/src/modular/helpers/classicalOperationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/clientHelpers.js +20 -25
- package/dist/src/modular/helpers/clientHelpers.js.map +1 -1
- package/dist/src/modular/helpers/clientOptionHelpers.js +1 -1
- package/dist/src/modular/helpers/clientOptionHelpers.js.map +1 -1
- package/dist/src/modular/helpers/exampleValueHelpers.d.ts.map +1 -1
- package/dist/src/modular/helpers/exampleValueHelpers.js +39 -32
- package/dist/src/modular/helpers/exampleValueHelpers.js.map +1 -1
- package/dist/src/modular/helpers/namingHelpers.js +3 -5
- package/dist/src/modular/helpers/namingHelpers.js.map +1 -1
- package/dist/src/modular/helpers/operationHelpers.js +75 -99
- package/dist/src/modular/helpers/operationHelpers.js.map +1 -1
- package/dist/src/modular/helpers/typeHelpers.js +3 -5
- package/dist/src/modular/helpers/typeHelpers.js.map +1 -1
- package/dist/src/modular/serialization/buildDeserializerFunction.js +11 -14
- package/dist/src/modular/serialization/buildDeserializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/buildSerializerFunction.js +17 -20
- package/dist/src/modular/serialization/buildSerializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/buildXmlSerializerFunction.js +31 -40
- package/dist/src/modular/serialization/buildXmlSerializerFunction.js.map +1 -1
- package/dist/src/modular/serialization/serializeUtils.d.ts.map +1 -1
- package/dist/src/modular/serialization/serializeUtils.js +24 -25
- package/dist/src/modular/serialization/serializeUtils.js.map +1 -1
- package/dist/src/modular/type-expressions/get-enum-expression.js +1 -2
- package/dist/src/modular/type-expressions/get-enum-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-model-expression.js +5 -6
- package/dist/src/modular/type-expressions/get-model-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-nullable-expression.js +2 -3
- package/dist/src/modular/type-expressions/get-nullable-expression.js.map +1 -1
- package/dist/src/modular/type-expressions/get-type-expression.js +2 -4
- package/dist/src/modular/type-expressions/get-type-expression.js.map +1 -1
- package/dist/src/rlc-common/buildClient.js +26 -30
- package/dist/src/rlc-common/buildClient.js.map +1 -1
- package/dist/src/rlc-common/buildClientDefinitions.js +6 -5
- package/dist/src/rlc-common/buildClientDefinitions.js.map +1 -1
- package/dist/src/rlc-common/buildIndexFile.js +2 -3
- package/dist/src/rlc-common/buildIndexFile.js.map +1 -1
- package/dist/src/rlc-common/buildIsUnexpectedHelper.js +12 -10
- package/dist/src/rlc-common/buildIsUnexpectedHelper.js.map +1 -1
- package/dist/src/rlc-common/buildLogger.js +1 -2
- package/dist/src/rlc-common/buildLogger.js.map +1 -1
- package/dist/src/rlc-common/buildMethodShortcuts.js +1 -1
- package/dist/src/rlc-common/buildMethodShortcuts.js.map +1 -1
- package/dist/src/rlc-common/buildObjectTypes.js +38 -60
- package/dist/src/rlc-common/buildObjectTypes.js.map +1 -1
- package/dist/src/rlc-common/buildParameterTypes.js +12 -15
- package/dist/src/rlc-common/buildParameterTypes.js.map +1 -1
- package/dist/src/rlc-common/buildPollingHelper.js +7 -8
- package/dist/src/rlc-common/buildPollingHelper.js.map +1 -1
- package/dist/src/rlc-common/buildResponseTypes.js +4 -5
- package/dist/src/rlc-common/buildResponseTypes.js.map +1 -1
- package/dist/src/rlc-common/helpers/apiVersionUtil.js +5 -6
- package/dist/src/rlc-common/helpers/apiVersionUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/importsUtil.js +9 -12
- package/dist/src/rlc-common/helpers/importsUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/nameConstructors.js +2 -4
- package/dist/src/rlc-common/helpers/nameConstructors.js.map +1 -1
- package/dist/src/rlc-common/helpers/nameUtils.js +9 -10
- package/dist/src/rlc-common/helpers/nameUtils.js.map +1 -1
- package/dist/src/rlc-common/helpers/operationHelpers.js +10 -21
- package/dist/src/rlc-common/helpers/operationHelpers.js.map +1 -1
- package/dist/src/rlc-common/helpers/packageUtil.js +3 -6
- package/dist/src/rlc-common/helpers/packageUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/schemaHelpers.js +2 -6
- package/dist/src/rlc-common/helpers/schemaHelpers.js.map +1 -1
- package/dist/src/rlc-common/helpers/typeUtil.js +4 -8
- package/dist/src/rlc-common/helpers/typeUtil.js.map +1 -1
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js +4 -7
- package/dist/src/rlc-common/helpers/valueGenerationUtil.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js +2 -3
- package/dist/src/rlc-common/metadata/buildApiExtractorConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildChangelogFile.js +1 -2
- package/dist/src/rlc-common/metadata/buildChangelogFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildESLintConfig.js +3 -4
- package/dist/src/rlc-common/metadata/buildESLintConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildPackageFile.js +19 -23
- package/dist/src/rlc-common/metadata/buildPackageFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildReadmeFile.js +25 -25
- package/dist/src/rlc-common/metadata/buildReadmeFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildRollupConfig.js +1 -2
- package/dist/src/rlc-common/metadata/buildRollupConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js +3 -4
- package/dist/src/rlc-common/metadata/buildSampleEnvFile.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildTestConfig.js +3 -4
- package/dist/src/rlc-common/metadata/buildTestConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildTsConfig.js +6 -8
- package/dist/src/rlc-common/metadata/buildTsConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildVitestConfig.js +2 -3
- package/dist/src/rlc-common/metadata/buildVitestConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/buildWarpConfig.js +2 -3
- package/dist/src/rlc-common/metadata/buildWarpConfig.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js +1 -1
- package/dist/src/rlc-common/metadata/packageJson/azurePackageCommon.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js +2 -3
- package/dist/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.js.map +1 -1
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js +2 -2
- package/dist/src/rlc-common/metadata/packageJson/packageCommon.js.map +1 -1
- package/dist/src/rlc-common/metadata/utils.js +1 -2
- package/dist/src/rlc-common/metadata/utils.js.map +1 -1
- package/dist/src/rlc-common/test/buildRecordedClient.js +2 -3
- package/dist/src/rlc-common/test/buildRecordedClient.js.map +1 -1
- package/dist/src/rlc-common/test/buildSampleTest.js +2 -3
- package/dist/src/rlc-common/test/buildSampleTest.js.map +1 -1
- package/dist/src/rlc-common/test/buildSnippets.js +4 -5
- package/dist/src/rlc-common/test/buildSnippets.js.map +1 -1
- package/dist/src/rlc-common/transformSampleGroups.js +23 -23
- package/dist/src/rlc-common/transformSampleGroups.js.map +1 -1
- package/dist/src/transform/transform.js +20 -18
- package/dist/src/transform/transform.js.map +1 -1
- package/dist/src/transform/transformApiVersionInfo.js +7 -7
- package/dist/src/transform/transformApiVersionInfo.js.map +1 -1
- package/dist/src/transform/transformHelperFunctionDetails.js +2 -3
- package/dist/src/transform/transformHelperFunctionDetails.js.map +1 -1
- package/dist/src/transform/transformParameters.js +15 -22
- package/dist/src/transform/transformParameters.js.map +1 -1
- package/dist/src/transform/transformPaths.js +9 -12
- package/dist/src/transform/transformPaths.js.map +1 -1
- package/dist/src/transform/transformResponses.js +10 -14
- package/dist/src/transform/transformResponses.js.map +1 -1
- package/dist/src/transform/transformSchemas.js +17 -22
- package/dist/src/transform/transformSchemas.js.map +1 -1
- package/dist/src/transform/transfromRLCOptions.js +23 -22
- package/dist/src/transform/transfromRLCOptions.js.map +1 -1
- package/dist/src/utils/clientUtils.js +6 -11
- package/dist/src/utils/clientUtils.js.map +1 -1
- package/dist/src/utils/credentialUtils.js +1 -2
- package/dist/src/utils/credentialUtils.js.map +1 -1
- package/dist/src/utils/crossLanguageDef.js +6 -6
- package/dist/src/utils/crossLanguageDef.js.map +1 -1
- package/dist/src/utils/emitUtil.js +1 -1
- package/dist/src/utils/emitUtil.js.map +1 -1
- package/dist/src/utils/fileSystemUtils.d.ts +2 -0
- package/dist/src/utils/fileSystemUtils.d.ts.map +1 -1
- package/dist/src/utils/fileSystemUtils.js +24 -5
- package/dist/src/utils/fileSystemUtils.js.map +1 -1
- package/dist/src/utils/importHelper.js +1 -2
- package/dist/src/utils/importHelper.js.map +1 -1
- package/dist/src/utils/modelUtils.js +78 -104
- package/dist/src/utils/modelUtils.js.map +1 -1
- package/dist/src/utils/namespaceUtils.js +4 -5
- package/dist/src/utils/namespaceUtils.js.map +1 -1
- package/dist/src/utils/operationUtil.js +38 -46
- package/dist/src/utils/operationUtil.js.map +1 -1
- package/dist/src/utils/parameterUtils.js +7 -11
- package/dist/src/utils/parameterUtils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +38 -41
- package/src/index.ts +11 -10
- package/src/modular/buildRootIndex.ts +0 -1
- package/src/modular/emitSamples.ts +1 -3
- package/src/modular/helpers/exampleValueHelpers.ts +2 -6
- package/src/modular/serialization/serializeUtils.ts +0 -1
- package/src/rlc-common/buildClientDefinitions.ts +1 -0
- package/src/utils/fileSystemUtils.ts +29 -5
- package/static/static-helpers/pollingHelpers.ts +3 -3
- package/static/static-helpers/serialization/get-binary-response-browser.mts +3 -1
- package/static/static-helpers/serialization/get-binary-stream-response-browser.mts +1 -3
- package/static/static-helpers/serialization/xml-helpers.ts +1 -1
- package/static/static-helpers/simplePollerHelpers.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-ts",
|
|
3
|
-
"version": "0.54.0-
|
|
3
|
+
"version": "0.54.0-dev.4",
|
|
4
4
|
"description": "An experimental TypeSpec emitter for TypeScript RLC",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@azure-rest/core-client": "^2.3.1",
|
|
21
|
-
"@typespec/http-specs": "0.1.0-alpha.37-dev.
|
|
22
|
-
"@typespec/spector": "0.1.0-dev.
|
|
23
|
-
"@typespec/spec-api": "0.1.0-dev.
|
|
24
|
-
"@typespec/tspd": "0.74.2",
|
|
25
|
-
"@azure-tools/azure-http-specs": "0.1.0-alpha.41-dev.
|
|
26
|
-
"@azure-tools/typespec-autorest": "^0.68.0",
|
|
27
|
-
"@azure-tools/typespec-azure-core": "^0.68.0",
|
|
28
|
-
"@azure-tools/typespec-azure-resource-manager": "^0.68.0",
|
|
29
|
-
"@azure-tools/typespec-client-generator-core": "^0.68.
|
|
21
|
+
"@typespec/http-specs": "^0.1.0-alpha.37 || >=0.1.0-alpha.38-dev <0.1.0-alpha.38",
|
|
22
|
+
"@typespec/spector": "^0.1.0-alpha.25 || >=0.1.0-alpha.26-dev <0.1.0-alpha.26",
|
|
23
|
+
"@typespec/spec-api": "^0.1.0-alpha.14 || >=0.1.0-alpha.15-dev <0.1.0-alpha.15",
|
|
24
|
+
"@typespec/tspd": "^0.74.2 || >=0.75.0-dev <0.75.0",
|
|
25
|
+
"@azure-tools/azure-http-specs": "^0.1.0-alpha.40 || >=0.1.0-alpha.41-dev <0.1.0-alpha.41",
|
|
26
|
+
"@azure-tools/typespec-autorest": "^0.68.0 || >=0.69.0-dev <0.69.0",
|
|
27
|
+
"@azure-tools/typespec-azure-core": "^0.68.0 || >=0.69.0-dev <0.69.0",
|
|
28
|
+
"@azure-tools/typespec-azure-resource-manager": "^0.68.0 || >=0.69.0-dev <0.69.0",
|
|
29
|
+
"@azure-tools/typespec-client-generator-core": "^0.68.4 || >=0.69.0-dev <0.69.0",
|
|
30
30
|
"@azure/abort-controller": "^2.1.2",
|
|
31
31
|
"@azure/core-auth": "^1.6.0",
|
|
32
32
|
"@azure/core-lro": "^3.1.0",
|
|
@@ -34,53 +34,45 @@
|
|
|
34
34
|
"@azure/core-rest-pipeline": "^1.14.0",
|
|
35
35
|
"@azure/core-util": "^1.4.0",
|
|
36
36
|
"@azure/logger": "^1.0.4",
|
|
37
|
-
"@types/chai": "^4.3.1",
|
|
38
|
-
"@types/fs-extra": "^9.0.13",
|
|
39
37
|
"@types/lodash": "^4.17.4",
|
|
40
38
|
"@typescript-eslint/eslint-plugin": "^8.28.0",
|
|
41
|
-
"@typescript-eslint/parser": "^8.
|
|
39
|
+
"@typescript-eslint/parser": "^8.58.1",
|
|
42
40
|
"@typespec/compiler": "^1.12.0",
|
|
43
41
|
"@typespec/http": "^1.12.0",
|
|
44
42
|
"@typespec/openapi": "^1.12.0",
|
|
45
|
-
"@typespec/rest": "^0.82.0",
|
|
46
|
-
"@typespec/
|
|
47
|
-
"@typespec/
|
|
48
|
-
"@typespec/
|
|
49
|
-
"
|
|
50
|
-
"chalk": "^4.0.0",
|
|
51
|
-
"cross-env": "^7.0.3",
|
|
43
|
+
"@typespec/rest": "^0.82.0 || >=0.83.0-dev <0.83.0",
|
|
44
|
+
"@typespec/versioning": "^0.82.0 || >=0.83.0-dev <0.83.0",
|
|
45
|
+
"@typespec/xml": "^0.82.0 || >=0.83.0-dev <0.83.0",
|
|
46
|
+
"@typespec/ts-http-runtime": "0.3.5",
|
|
47
|
+
"cross-env": "^10.1.0",
|
|
52
48
|
"eslint-plugin-require-extensions": "0.1.3",
|
|
53
49
|
"mkdirp": "^3.0.1",
|
|
54
50
|
"npm-run-all": "~4.1.5",
|
|
55
|
-
"prettier": "^3.
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"@
|
|
60
|
-
"
|
|
61
|
-
"@microsoft/api-extractor": "^7.47.5",
|
|
62
|
-
"tsx": "^4.16.5",
|
|
51
|
+
"prettier": "^3.8.1",
|
|
52
|
+
"vitest": "^4.1.3",
|
|
53
|
+
"vite": "^8.0.8",
|
|
54
|
+
"@vitest/coverage-v8": "^4.1.3",
|
|
55
|
+
"@microsoft/api-extractor": "^7.58.1",
|
|
56
|
+
"tsx": "^4.21.0",
|
|
63
57
|
"@types/js-yaml": "^4.0.9",
|
|
64
58
|
"js-yaml": "^4.1.0"
|
|
65
59
|
},
|
|
66
60
|
"peerDependencies": {
|
|
67
|
-
"@azure-tools/typespec-azure-core": "^0.68.0",
|
|
68
|
-
"@azure-tools/typespec-client-generator-core": "^0.68.
|
|
61
|
+
"@azure-tools/typespec-azure-core": "^0.68.0 || >=0.69.0-dev <0.69.0",
|
|
62
|
+
"@azure-tools/typespec-client-generator-core": "^0.68.4 || >=0.69.0-dev <0.69.0",
|
|
69
63
|
"@typespec/compiler": "^1.12.0",
|
|
70
64
|
"@typespec/http": "^1.12.0",
|
|
71
|
-
"@typespec/rest": "^0.82.0",
|
|
72
|
-
"@typespec/versioning": "^0.82.0",
|
|
73
|
-
"@typespec/xml": "^0.82.0"
|
|
65
|
+
"@typespec/rest": "^0.82.0 || >=0.83.0-dev <0.83.0",
|
|
66
|
+
"@typespec/versioning": "^0.82.0 || >=0.83.0-dev <0.83.0",
|
|
67
|
+
"@typespec/xml": "^0.82.0 || >=0.83.0-dev <0.83.0"
|
|
74
68
|
},
|
|
75
69
|
"dependencies": {
|
|
76
|
-
"fast-xml-parser": "^
|
|
77
|
-
"fs-extra": "^11.1.0",
|
|
70
|
+
"fast-xml-parser": "^5.7.0",
|
|
78
71
|
"handlebars": "^4.7.7",
|
|
79
72
|
"lodash": "^4.17.21",
|
|
80
|
-
"prettier": "^3.
|
|
73
|
+
"prettier": "^3.8.1",
|
|
81
74
|
"ts-morph": "^23.0.0",
|
|
82
|
-
"tslib": "^2.3.1"
|
|
83
|
-
"@azure-tools/rlc-common": "0.54.0-alpha.20260601.2"
|
|
75
|
+
"tslib": "^2.3.1"
|
|
84
76
|
},
|
|
85
77
|
"files": [
|
|
86
78
|
"src",
|
|
@@ -90,10 +82,14 @@
|
|
|
90
82
|
"LICENSE",
|
|
91
83
|
"static/**"
|
|
92
84
|
],
|
|
85
|
+
"repository": {
|
|
86
|
+
"type": "git",
|
|
87
|
+
"url": "git+https://github.com/Azure/typespec-azure.git"
|
|
88
|
+
},
|
|
93
89
|
"bugs": {
|
|
94
|
-
"url": "https://github.com/Azure/
|
|
90
|
+
"url": "https://github.com/Azure/typespec-azure/issues"
|
|
95
91
|
},
|
|
96
|
-
"homepage": "https://github.com/Azure/
|
|
92
|
+
"homepage": "https://github.com/Azure/typespec-azure/tree/main/packages/typespec-ts/",
|
|
97
93
|
"scripts": {
|
|
98
94
|
"test-next": "vitest run --project test-next",
|
|
99
95
|
"test-next:coverage": "vitest run --project test-next --coverage",
|
|
@@ -104,10 +100,11 @@
|
|
|
104
100
|
"test:standard": "npm run test-next && npm run copy:typespec && npm run unit-test&& npm run integration-test-ci:rlc && npm run integration-test-ci:modular",
|
|
105
101
|
"lint": "eslint src --ext .ts --max-warnings=0",
|
|
106
102
|
"lint:fix": "eslint src --fix --ext .ts",
|
|
103
|
+
"check:tree": "tsx ./test/commands/check-clean-tree.ts",
|
|
104
|
+
"test:ts:e2e": "npm run copy:typespec && npm run integration-test-ci:azure-rlc && npm run integration-test-ci:azure-modular",
|
|
107
105
|
"format": "npm run -s prettier -- --write",
|
|
108
106
|
"check-format": "npm run prettier -- --check",
|
|
109
107
|
"prettier": "prettier --config ./.prettierrc \"{src,test,static}/**/*.ts\" \"!test/**/generated/**/*.ts\"",
|
|
110
|
-
"check:tree": "node --loader ts-node/esm ./test/commands/check-clean-tree.ts",
|
|
111
108
|
"integration-test-ci": "npm-run-all copy:typespec integration-test-ci:rlc integration-test-ci:azure-rlc integration-test-ci:modular integration-test-ci:azure-modular",
|
|
112
109
|
"integration-test-ci:sequential": "npm-run-all --serial copy:typespec integration-test-ci:modular && npm run integration-test-ci:modular",
|
|
113
110
|
"integration-test-ci:rlc": "npm-run-all --silent -p start-test-server:rlc --race generate-and-run:rlc",
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
import * as fsextra from "fs-extra";
|
|
5
4
|
import {
|
|
6
5
|
AzureCoreDependencies,
|
|
7
6
|
AzureIdentityDependencies,
|
|
@@ -9,7 +8,11 @@ import {
|
|
|
9
8
|
DefaultCoreDependencies,
|
|
10
9
|
AzureTestDependencies
|
|
11
10
|
} from "./modular/external-dependencies.js";
|
|
12
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
clearDirectory,
|
|
13
|
+
emptyDir,
|
|
14
|
+
pathExists
|
|
15
|
+
} from "./utils/fileSystemUtils.js";
|
|
13
16
|
import { EmitContext, Program } from "@typespec/compiler";
|
|
14
17
|
import { GenerationDirDetail, SdkContext } from "./utils/interfaces.js";
|
|
15
18
|
import {
|
|
@@ -234,7 +237,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
234
237
|
program
|
|
235
238
|
);
|
|
236
239
|
}
|
|
237
|
-
const hasTestFolder = await
|
|
240
|
+
const hasTestFolder = await pathExists(
|
|
238
241
|
join(dpgContext.generationPathDetail?.metadataDir ?? "", "test")
|
|
239
242
|
);
|
|
240
243
|
options.generateTest =
|
|
@@ -250,12 +253,10 @@ export async function $onEmit(context: EmitContext) {
|
|
|
250
253
|
const customizationFolder = join(projectRoot, "generated");
|
|
251
254
|
const srcGeneratedFolder = join(projectRoot, "src", "generated");
|
|
252
255
|
// if customization folder exists, use it as sources root
|
|
253
|
-
const finalCustomizationFolder = (await
|
|
254
|
-
srcGeneratedFolder
|
|
255
|
-
))
|
|
256
|
+
const finalCustomizationFolder = (await pathExists(srcGeneratedFolder))
|
|
256
257
|
? srcGeneratedFolder
|
|
257
258
|
: customizationFolder;
|
|
258
|
-
const sourcesRoot = (await
|
|
259
|
+
const sourcesRoot = (await pathExists(finalCustomizationFolder))
|
|
259
260
|
? finalCustomizationFolder
|
|
260
261
|
: join(projectRoot, "src");
|
|
261
262
|
return {
|
|
@@ -267,7 +268,7 @@ export async function $onEmit(context: EmitContext) {
|
|
|
267
268
|
}
|
|
268
269
|
|
|
269
270
|
async function clearSrcFolder() {
|
|
270
|
-
await
|
|
271
|
+
await emptyDir(
|
|
271
272
|
dpgContext.generationPathDetail?.modularSourcesDir ??
|
|
272
273
|
dpgContext.generationPathDetail?.rlcSourcesDir ??
|
|
273
274
|
""
|
|
@@ -280,8 +281,8 @@ export async function $onEmit(context: EmitContext) {
|
|
|
280
281
|
dpgContext.generationPathDetail?.rootDir ?? "",
|
|
281
282
|
"samples-dev"
|
|
282
283
|
);
|
|
283
|
-
if (await
|
|
284
|
-
await
|
|
284
|
+
if (await pathExists(samplesDevPath)) {
|
|
285
|
+
await emptyDir(samplesDevPath);
|
|
285
286
|
}
|
|
286
287
|
}
|
|
287
288
|
}
|
|
@@ -198,9 +198,7 @@ export function serializeExampleValue(value: SdkExampleValue): string {
|
|
|
198
198
|
.replace(/\n/g, "\\n")
|
|
199
199
|
.replace(/\r/g, "\\r")
|
|
200
200
|
.replace(/\t/g, "\\t")
|
|
201
|
-
.replace(/\f/g, "\\f")
|
|
202
|
-
.replace(/>/g, ">")
|
|
203
|
-
.replace(/</g, "<")}"`;
|
|
201
|
+
.replace(/\f/g, "\\f")}"`;
|
|
204
202
|
break;
|
|
205
203
|
}
|
|
206
204
|
break;
|
|
@@ -743,9 +741,7 @@ export function generateAssertionsForValue(
|
|
|
743
741
|
.replace(/\n/g, "\\n")
|
|
744
742
|
.replace(/\r/g, "\\r")
|
|
745
743
|
.replace(/\t/g, "\\t")
|
|
746
|
-
.replace(/\f/g, "\\f")
|
|
747
|
-
.replace(/>/g, ">")
|
|
748
|
-
.replace(/</g, "<")}"`;
|
|
744
|
+
.replace(/\f/g, "\\f")}"`;
|
|
749
745
|
assertions.push(`assert.strictEqual(${path}, ${retValue});`);
|
|
750
746
|
break;
|
|
751
747
|
}
|
|
@@ -1,21 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { readdir, rm } from "fs/promises";
|
|
1
|
+
import { mkdir, readdir, rm, stat } from "fs/promises";
|
|
3
2
|
import { resolve } from "path";
|
|
4
3
|
import { NoTarget, Program } from "@typespec/compiler";
|
|
5
4
|
import { reportDiagnostic } from "../lib.js";
|
|
6
5
|
|
|
6
|
+
export async function pathExists(targetPath: string): Promise<boolean> {
|
|
7
|
+
try {
|
|
8
|
+
await stat(targetPath);
|
|
9
|
+
return true;
|
|
10
|
+
} catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function emptyDir(dirPath: string): Promise<void> {
|
|
16
|
+
let entries: string[];
|
|
17
|
+
try {
|
|
18
|
+
entries = await readdir(dirPath);
|
|
19
|
+
} catch {
|
|
20
|
+
await mkdir(dirPath, { recursive: true });
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
await Promise.all(
|
|
25
|
+
entries.map((entry) =>
|
|
26
|
+
rm(resolve(dirPath, entry), { recursive: true, force: true })
|
|
27
|
+
)
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
7
31
|
export async function clearDirectory(
|
|
8
32
|
dirPath: string,
|
|
9
33
|
excludeNames: string[] = [],
|
|
10
34
|
program?: Program
|
|
11
35
|
): Promise<void> {
|
|
12
|
-
if (!(await
|
|
36
|
+
if (!(await pathExists(dirPath))) {
|
|
13
37
|
return;
|
|
14
38
|
}
|
|
15
39
|
|
|
16
40
|
// If no exclude names, just use regular emptyDir for efficiency
|
|
17
41
|
if (excludeNames.length === 0) {
|
|
18
|
-
await
|
|
42
|
+
await emptyDir(dirPath);
|
|
19
43
|
return;
|
|
20
44
|
}
|
|
21
45
|
|
|
@@ -42,6 +66,6 @@ export async function clearDirectory(
|
|
|
42
66
|
target: NoTarget
|
|
43
67
|
});
|
|
44
68
|
}
|
|
45
|
-
await
|
|
69
|
+
await emptyDir(dirPath);
|
|
46
70
|
}
|
|
47
71
|
}
|
|
@@ -5,7 +5,9 @@ import { HttpResponse, StreamableMethod } from "@azure-rest/core-client";
|
|
|
5
5
|
* to bypass Core's default response handling. This works around an issue where binary bodies in Core
|
|
6
6
|
* are coerced into UTF-8, regardless of whether the body is valid UTF-8 or not.
|
|
7
7
|
*/
|
|
8
|
-
export async function getBinaryResponse(
|
|
8
|
+
export async function getBinaryResponse(
|
|
9
|
+
streamableMethod: StreamableMethod,
|
|
10
|
+
): Promise<HttpResponse & { body?: Uint8Array }> {
|
|
9
11
|
const response = await streamableMethod.asBrowserStream();
|
|
10
12
|
|
|
11
13
|
if (response.body === undefined) {
|
|
@@ -7,9 +7,7 @@ import { NodeReadableStream } from "../platform-types-browser.mjs";
|
|
|
7
7
|
* Error handling is left to the caller so that generated deserializers can apply
|
|
8
8
|
* operation-specific error deserialization (per-status-code details, exception headers, etc.).
|
|
9
9
|
*/
|
|
10
|
-
export async function getBinaryStreamResponse(
|
|
11
|
-
streamableMethod: StreamableMethod
|
|
12
|
-
): Promise<
|
|
10
|
+
export async function getBinaryStreamResponse(streamableMethod: StreamableMethod): Promise<
|
|
13
11
|
HttpResponse & {
|
|
14
12
|
blobBody?: Promise<Blob>;
|
|
15
13
|
readableStreamBody?: NodeReadableStream;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
+
import { stringToUint8Array, uint8ArrayToString } from "@azure/core-util";
|
|
4
5
|
import { XMLBuilder, XMLParser, XmlBuilderOptions } from "fast-xml-parser";
|
|
5
|
-
import { uint8ArrayToString, stringToUint8Array } from "@azure/core-util";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* XML serialization options for a property or model
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PollerLike, OperationState, CancelOnProgress } from "@azure/core-lro";
|
|
2
1
|
import { AbortSignalLike } from "@azure/abort-controller";
|
|
2
|
+
import { CancelOnProgress, OperationState, PollerLike } from "@azure/core-lro";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A simple poller that can be used to poll a long running operation.
|