@azure-tools/typespec-python 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/dist/scripts/copy-scripts.d.ts +2 -0
- package/dist/scripts/copy-scripts.d.ts.map +1 -0
- package/dist/scripts/copy-scripts.js +24 -0
- package/dist/scripts/copy-scripts.js.map +1 -0
- package/dist/src/emitter.d.ts +0 -2
- package/dist/src/emitter.d.ts.map +1 -1
- package/dist/src/emitter.js +2 -102
- package/dist/src/emitter.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/package.json +14 -11
- package/scripts/__pycache__/venvtools.cpython-310.pyc +0 -0
- package/scripts/copy-scripts.ts +26 -0
- package/scripts/eng/pylintrc +2 -1
- package/dist/src/code-model.d.ts +0 -4
- package/dist/src/code-model.d.ts.map +0 -1
- package/dist/src/code-model.js +0 -190
- package/dist/src/code-model.js.map +0 -1
- package/dist/src/external-process.d.ts +0 -20
- package/dist/src/external-process.d.ts.map +0 -1
- package/dist/src/external-process.js +0 -44
- package/dist/src/external-process.js.map +0 -1
- package/dist/src/http.d.ts +0 -7
- package/dist/src/http.d.ts.map +0 -1
- package/dist/src/http.js +0 -266
- package/dist/src/http.js.map +0 -1
- package/dist/src/types.d.ts +0 -36
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -489
- package/dist/src/types.js.map +0 -1
- package/dist/src/utils.d.ts +0 -26
- package/dist/src/utils.d.ts.map +0 -1
- package/dist/src/utils.js +0 -151
- package/dist/src/utils.js.map +0 -1
- package/generator/LICENSE +0 -21
- package/generator/README.md +0 -1
- package/generator/dev_requirements.txt +0 -5
- package/generator/pygen/__init__.py +0 -107
- package/generator/pygen/_version.py +0 -7
- package/generator/pygen/black.py +0 -69
- package/generator/pygen/codegen/__init__.py +0 -338
- package/generator/pygen/codegen/_utils.py +0 -16
- package/generator/pygen/codegen/models/__init__.py +0 -204
- package/generator/pygen/codegen/models/base.py +0 -186
- package/generator/pygen/codegen/models/base_builder.py +0 -119
- package/generator/pygen/codegen/models/client.py +0 -430
- package/generator/pygen/codegen/models/code_model.py +0 -237
- package/generator/pygen/codegen/models/combined_type.py +0 -149
- package/generator/pygen/codegen/models/constant_type.py +0 -129
- package/generator/pygen/codegen/models/credential_types.py +0 -214
- package/generator/pygen/codegen/models/dictionary_type.py +0 -127
- package/generator/pygen/codegen/models/enum_type.py +0 -238
- package/generator/pygen/codegen/models/imports.py +0 -291
- package/generator/pygen/codegen/models/list_type.py +0 -143
- package/generator/pygen/codegen/models/lro_operation.py +0 -142
- package/generator/pygen/codegen/models/lro_paging_operation.py +0 -32
- package/generator/pygen/codegen/models/model_type.py +0 -362
- package/generator/pygen/codegen/models/operation.py +0 -530
- package/generator/pygen/codegen/models/operation_group.py +0 -184
- package/generator/pygen/codegen/models/paging_operation.py +0 -155
- package/generator/pygen/codegen/models/parameter.py +0 -412
- package/generator/pygen/codegen/models/parameter_list.py +0 -387
- package/generator/pygen/codegen/models/primitive_types.py +0 -659
- package/generator/pygen/codegen/models/property.py +0 -171
- package/generator/pygen/codegen/models/request_builder.py +0 -189
- package/generator/pygen/codegen/models/request_builder_parameter.py +0 -115
- package/generator/pygen/codegen/models/response.py +0 -348
- package/generator/pygen/codegen/models/utils.py +0 -23
- package/generator/pygen/codegen/serializers/__init__.py +0 -574
- package/generator/pygen/codegen/serializers/base_serializer.py +0 -21
- package/generator/pygen/codegen/serializers/builder_serializer.py +0 -1513
- package/generator/pygen/codegen/serializers/client_serializer.py +0 -295
- package/generator/pygen/codegen/serializers/enum_serializer.py +0 -15
- package/generator/pygen/codegen/serializers/general_serializer.py +0 -213
- package/generator/pygen/codegen/serializers/import_serializer.py +0 -127
- package/generator/pygen/codegen/serializers/metadata_serializer.py +0 -198
- package/generator/pygen/codegen/serializers/model_init_serializer.py +0 -33
- package/generator/pygen/codegen/serializers/model_serializer.py +0 -300
- package/generator/pygen/codegen/serializers/operation_groups_serializer.py +0 -89
- package/generator/pygen/codegen/serializers/operations_init_serializer.py +0 -44
- package/generator/pygen/codegen/serializers/parameter_serializer.py +0 -221
- package/generator/pygen/codegen/serializers/patch_serializer.py +0 -19
- package/generator/pygen/codegen/serializers/request_builders_serializer.py +0 -52
- package/generator/pygen/codegen/serializers/sample_serializer.py +0 -168
- package/generator/pygen/codegen/serializers/test_serializer.py +0 -293
- package/generator/pygen/codegen/serializers/types_serializer.py +0 -31
- package/generator/pygen/codegen/serializers/utils.py +0 -68
- package/generator/pygen/codegen/templates/client.py.jinja2 +0 -37
- package/generator/pygen/codegen/templates/client_container.py.jinja2 +0 -12
- package/generator/pygen/codegen/templates/config.py.jinja2 +0 -73
- package/generator/pygen/codegen/templates/config_container.py.jinja2 +0 -16
- package/generator/pygen/codegen/templates/conftest.py.jinja2 +0 -28
- package/generator/pygen/codegen/templates/enum.py.jinja2 +0 -13
- package/generator/pygen/codegen/templates/enum_container.py.jinja2 +0 -10
- package/generator/pygen/codegen/templates/init.py.jinja2 +0 -24
- package/generator/pygen/codegen/templates/keywords.jinja2 +0 -19
- package/generator/pygen/codegen/templates/lro_operation.py.jinja2 +0 -16
- package/generator/pygen/codegen/templates/lro_paging_operation.py.jinja2 +0 -18
- package/generator/pygen/codegen/templates/macros.jinja2 +0 -12
- package/generator/pygen/codegen/templates/metadata.json.jinja2 +0 -167
- package/generator/pygen/codegen/templates/model_base.py.jinja2 +0 -1158
- package/generator/pygen/codegen/templates/model_container.py.jinja2 +0 -13
- package/generator/pygen/codegen/templates/model_dpg.py.jinja2 +0 -98
- package/generator/pygen/codegen/templates/model_init.py.jinja2 +0 -28
- package/generator/pygen/codegen/templates/model_msrest.py.jinja2 +0 -92
- package/generator/pygen/codegen/templates/operation.py.jinja2 +0 -21
- package/generator/pygen/codegen/templates/operation_group.py.jinja2 +0 -75
- package/generator/pygen/codegen/templates/operation_groups_container.py.jinja2 +0 -20
- package/generator/pygen/codegen/templates/operation_tools.jinja2 +0 -81
- package/generator/pygen/codegen/templates/operations_folder_init.py.jinja2 +0 -17
- package/generator/pygen/codegen/templates/packaging_templates/CHANGELOG.md.jinja2 +0 -6
- package/generator/pygen/codegen/templates/packaging_templates/LICENSE.jinja2 +0 -21
- package/generator/pygen/codegen/templates/packaging_templates/MANIFEST.in.jinja2 +0 -8
- package/generator/pygen/codegen/templates/packaging_templates/README.md.jinja2 +0 -107
- package/generator/pygen/codegen/templates/packaging_templates/dev_requirements.txt.jinja2 +0 -9
- package/generator/pygen/codegen/templates/packaging_templates/setup.py.jinja2 +0 -108
- package/generator/pygen/codegen/templates/paging_operation.py.jinja2 +0 -21
- package/generator/pygen/codegen/templates/patch.py.jinja2 +0 -19
- package/generator/pygen/codegen/templates/pkgutil_init.py.jinja2 +0 -1
- package/generator/pygen/codegen/templates/request_builder.py.jinja2 +0 -28
- package/generator/pygen/codegen/templates/request_builders.py.jinja2 +0 -10
- package/generator/pygen/codegen/templates/rest_init.py.jinja2 +0 -12
- package/generator/pygen/codegen/templates/sample.py.jinja2 +0 -44
- package/generator/pygen/codegen/templates/serialization.py.jinja2 +0 -2115
- package/generator/pygen/codegen/templates/test.py.jinja2 +0 -50
- package/generator/pygen/codegen/templates/testpreparer.py.jinja2 +0 -26
- package/generator/pygen/codegen/templates/types.py.jinja2 +0 -8
- package/generator/pygen/codegen/templates/validation.py.jinja2 +0 -38
- package/generator/pygen/codegen/templates/vendor.py.jinja2 +0 -96
- package/generator/pygen/codegen/templates/version.py.jinja2 +0 -4
- package/generator/pygen/m2r.py +0 -65
- package/generator/pygen/postprocess/__init__.py +0 -183
- package/generator/pygen/postprocess/get_all.py +0 -19
- package/generator/pygen/postprocess/venvtools.py +0 -75
- package/generator/pygen/preprocess/__init__.py +0 -509
- package/generator/pygen/preprocess/helpers.py +0 -27
- package/generator/pygen/preprocess/python_mappings.py +0 -224
- package/generator/pygen/utils.py +0 -160
- package/generator/pygen.egg-info/PKG-INFO +0 -25
- package/generator/pygen.egg-info/SOURCES.txt +0 -66
- package/generator/pygen.egg-info/dependency_links.txt +0 -1
- package/generator/pygen.egg-info/requires.txt +0 -4
- package/generator/pygen.egg-info/top_level.txt +0 -1
- package/generator/requirements.txt +0 -12
- package/generator/setup.py +0 -55
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-scripts.d.ts","sourceRoot":"","sources":["../../scripts/copy-scripts.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import fsExtra from "fs-extra";
|
|
2
|
+
import { dirname, join, posix, win32 } from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
const force = process.argv[2] === "--force";
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
function copyAndCreateDir(sourceDir, destDir) {
|
|
7
|
+
// Delete the destination directory if it exists
|
|
8
|
+
if (fsExtra.existsSync(destDir)) {
|
|
9
|
+
if (force)
|
|
10
|
+
fsExtra.removeSync(destDir);
|
|
11
|
+
else
|
|
12
|
+
process.exit(0);
|
|
13
|
+
}
|
|
14
|
+
// Copy the source directory to the destination directory
|
|
15
|
+
fsExtra.copySync(sourceDir, destDir, {
|
|
16
|
+
filter: (src) => {
|
|
17
|
+
return !src.replaceAll(win32.sep, posix.sep).includes("/test/");
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const typespecModulePath = join(__dirname, "..", "node_modules", "@typespec", "http-client-python");
|
|
22
|
+
// Copy the generator directory
|
|
23
|
+
copyAndCreateDir(join(typespecModulePath, "generator"), join(__dirname, "..", "generator"));
|
|
24
|
+
//# sourceMappingURL=copy-scripts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-scripts.js","sourceRoot":"","sources":["../../scripts/copy-scripts.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,KAAK,GAAY,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;AACrD,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,SAAS,gBAAgB,CAAC,SAAiB,EAAE,OAAe;IACxD,gDAAgD;IAChD,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9B,IAAI,KAAK;YAAE,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;;YAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IAED,yDAAyD;IACzD,OAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,EAAE;QACjC,MAAM,EAAE,CAAC,GAAW,EAAE,EAAE;YACpB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACpE,CAAC;KACJ,CAAC,CAAC;AACP,CAAC;AAED,MAAM,kBAAkB,GAAW,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,oBAAoB,CAAC,CAAC;AAE5G,+BAA+B;AAC/B,gBAAgB,CAAC,IAAI,CAAC,kBAAkB,EAAE,WAAW,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC"}
|
package/dist/src/emitter.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { EmitContext } from "@typespec/compiler";
|
|
2
|
-
import { SdkContext } from "@azure-tools/typespec-client-generator-core";
|
|
3
2
|
import { PythonEmitterOptions } from "./lib.js";
|
|
4
|
-
export declare function getModelsMode(context: SdkContext): "dpg" | "none";
|
|
5
3
|
export declare function $onEmit(context: EmitContext<PythonEmitterOptions>): Promise<void>;
|
|
6
4
|
//# sourceMappingURL=emitter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,
|
|
1
|
+
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAGhD,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,oBAAoB,CAAC,iBAEvE"}
|
package/dist/src/emitter.js
CHANGED
|
@@ -1,105 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { saveCodeModelAsYaml } from "./external-process.js";
|
|
3
|
-
import { dirname } from "path";
|
|
4
|
-
import { fileURLToPath } from "url";
|
|
5
|
-
import { execSync } from "child_process";
|
|
6
|
-
import { emitCodeModel } from "./code-model.js";
|
|
7
|
-
import { removeUnderscoresFromNamespace } from "./utils.js";
|
|
8
|
-
import path from "path";
|
|
9
|
-
import fs from "fs";
|
|
10
|
-
export function getModelsMode(context) {
|
|
11
|
-
const specifiedModelsMode = context.emitContext.options["models-mode"];
|
|
12
|
-
if (specifiedModelsMode) {
|
|
13
|
-
const modelModes = ["dpg", "none"];
|
|
14
|
-
if (modelModes.includes(specifiedModelsMode)) {
|
|
15
|
-
return specifiedModelsMode;
|
|
16
|
-
}
|
|
17
|
-
throw new Error(`Need to specify models mode with the following values: ${modelModes.join(", ")}`);
|
|
18
|
-
}
|
|
19
|
-
return "dpg";
|
|
20
|
-
}
|
|
21
|
-
function addDefaultOptions(sdkContext) {
|
|
22
|
-
const defaultOptions = {
|
|
23
|
-
"package-version": "1.0.0b1",
|
|
24
|
-
"generate-packaging-files": true,
|
|
25
|
-
"flavor": undefined,
|
|
26
|
-
};
|
|
27
|
-
sdkContext.emitContext.options = {
|
|
28
|
-
...defaultOptions,
|
|
29
|
-
...sdkContext.emitContext.options,
|
|
30
|
-
};
|
|
31
|
-
const options = sdkContext.emitContext.options;
|
|
32
|
-
options["models-mode"] = getModelsMode(sdkContext);
|
|
33
|
-
if (options["generate-packaging-files"]) {
|
|
34
|
-
options["package-mode"] = sdkContext.arm ? "azure-mgmt" : "azure-dataplane";
|
|
35
|
-
}
|
|
36
|
-
if (!options["package-name"]) {
|
|
37
|
-
options["package-name"] = removeUnderscoresFromNamespace(sdkContext.sdkPackage.rootNamespace.toLowerCase()).replace(/\./g, "-");
|
|
38
|
-
}
|
|
39
|
-
if (options.flavor !== "azure") {
|
|
40
|
-
// if they pass in a flavor other than azure, we want to ignore the value
|
|
41
|
-
options.flavor = undefined;
|
|
42
|
-
}
|
|
43
|
-
if (!options.flavor && sdkContext.emitContext.emitterOutputDir.includes("azure")) {
|
|
44
|
-
options.flavor = "azure";
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
async function createPythonSdkContext(context) {
|
|
48
|
-
return {
|
|
49
|
-
...(await createSdkContext(context, "@azure-tools/typespec-python", {
|
|
50
|
-
additionalDecorators: ["TypeSpec\\.@encodedName"],
|
|
51
|
-
})),
|
|
52
|
-
__endpointPathParameters: [],
|
|
53
|
-
};
|
|
54
|
-
}
|
|
1
|
+
import { $onEmit as httpClientPythonOnEmit } from "@typespec/http-client-python";
|
|
55
2
|
export async function $onEmit(context) {
|
|
56
|
-
|
|
57
|
-
const sdkContext = await createPythonSdkContext(context);
|
|
58
|
-
const root = path.join(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
59
|
-
const outputDir = context.emitterOutputDir;
|
|
60
|
-
const yamlMap = emitCodeModel(sdkContext);
|
|
61
|
-
addDefaultOptions(sdkContext);
|
|
62
|
-
const yamlPath = await saveCodeModelAsYaml("typespec-python-yaml-map", yamlMap);
|
|
63
|
-
let venvPath = path.join(root, "venv");
|
|
64
|
-
if (fs.existsSync(path.join(venvPath, "bin"))) {
|
|
65
|
-
venvPath = path.join(venvPath, "bin", "python");
|
|
66
|
-
}
|
|
67
|
-
else if (fs.existsSync(path.join(venvPath, "Scripts"))) {
|
|
68
|
-
venvPath = path.join(venvPath, "Scripts", "python.exe");
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
throw new Error("Virtual environment doesn't exist.");
|
|
72
|
-
}
|
|
73
|
-
const commandArgs = [
|
|
74
|
-
venvPath,
|
|
75
|
-
`${root}/scripts/run_tsp.py`,
|
|
76
|
-
`--output-folder=${outputDir}`,
|
|
77
|
-
`--cadl-file=${yamlPath}`,
|
|
78
|
-
];
|
|
79
|
-
const resolvedOptions = sdkContext.emitContext.options;
|
|
80
|
-
if (resolvedOptions["packaging-files-config"]) {
|
|
81
|
-
const keyValuePairs = Object.entries(resolvedOptions["packaging-files-config"]).map(([key, value]) => {
|
|
82
|
-
return `${key}:${value}`;
|
|
83
|
-
});
|
|
84
|
-
commandArgs.push(`--packaging-files-config='${keyValuePairs.join("|")}'`);
|
|
85
|
-
resolvedOptions["packaging-files-config"] = undefined;
|
|
86
|
-
}
|
|
87
|
-
if (resolvedOptions["package-pprint-name"] !== undefined &&
|
|
88
|
-
!resolvedOptions["package-pprint-name"].startsWith('"')) {
|
|
89
|
-
resolvedOptions["package-pprint-name"] = `"${resolvedOptions["package-pprint-name"]}"`;
|
|
90
|
-
}
|
|
91
|
-
for (const [key, value] of Object.entries(resolvedOptions)) {
|
|
92
|
-
commandArgs.push(`--${key}=${value}`);
|
|
93
|
-
}
|
|
94
|
-
if (sdkContext.arm === true) {
|
|
95
|
-
commandArgs.push("--azure-arm=true");
|
|
96
|
-
}
|
|
97
|
-
if (resolvedOptions.flavor === "azure") {
|
|
98
|
-
commandArgs.push("--emit-cross-language-definition-file=true");
|
|
99
|
-
}
|
|
100
|
-
commandArgs.push("--from-typespec=true");
|
|
101
|
-
if (!program.compilerOptions.noEmit && !program.hasError()) {
|
|
102
|
-
execSync(commandArgs.join(" "));
|
|
103
|
-
}
|
|
3
|
+
httpClientPythonOnEmit(context);
|
|
104
4
|
}
|
|
105
5
|
//# sourceMappingURL=emitter.js.map
|
package/dist/src/emitter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../src/emitter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"emitter.js","sourceRoot":"","sources":["../../src/emitter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEjF,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,OAA0C;IACpE,sBAAsB,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/src/index.js
CHANGED
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-python",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec emitter for Python SDKs",
|
|
6
6
|
"homepage": "https://github.com/Azure/autorest.python",
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
"files": [
|
|
30
30
|
"dist/**",
|
|
31
31
|
"!dist/test/**",
|
|
32
|
-
"generator/**",
|
|
33
32
|
"scripts/**"
|
|
34
33
|
],
|
|
35
34
|
"peerDependencies": {
|
|
36
35
|
"@azure-tools/typespec-azure-core": ">=0.46.0 <1.0.0",
|
|
37
36
|
"@azure-tools/typespec-azure-resource-manager": ">=0.46.0 <1.0.0",
|
|
38
37
|
"@azure-tools/typespec-autorest": ">=0.46.0 <1.0.0",
|
|
39
|
-
"@azure-tools/typespec-client-generator-core": ">=0.46.
|
|
38
|
+
"@azure-tools/typespec-client-generator-core": ">=0.46.2 <1.0.0",
|
|
40
39
|
"@azure-tools/typespec-azure-rulesets": ">=0.46.0 <3.0.0",
|
|
41
40
|
"@typespec/compiler": ">=0.60.0 <1.0.0",
|
|
42
41
|
"@typespec/http": ">=0.60.0 <1.0.0",
|
|
42
|
+
"@typespec/http-client-python": ">=0.2.0 <1.0.0",
|
|
43
43
|
"@typespec/rest": ">=0.60.0 <1.0.0",
|
|
44
44
|
"@typespec/versioning": ">=0.60.0 <1.0.0",
|
|
45
45
|
"@typespec/openapi": ">=0.60.0 <1.0.0"
|
|
@@ -48,13 +48,14 @@
|
|
|
48
48
|
"js-yaml": "~4.1.0",
|
|
49
49
|
"@typespec/openapi3": "~0.60.0",
|
|
50
50
|
"semver": "~7.6.2",
|
|
51
|
-
"tsx": "4.17.0"
|
|
51
|
+
"tsx": "4.17.0",
|
|
52
|
+
"fs-extra": "~11.2.0"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@azure-tools/typespec-azure-resource-manager": "~0.46.0",
|
|
55
56
|
"@azure-tools/typespec-autorest": "~0.46.0",
|
|
56
|
-
"@azure-tools/cadl-ranch-expect": "~0.15.
|
|
57
|
-
"@azure-tools/cadl-ranch-specs": "~0.37.
|
|
57
|
+
"@azure-tools/cadl-ranch-expect": "~0.15.4",
|
|
58
|
+
"@azure-tools/cadl-ranch-specs": "~0.37.2",
|
|
58
59
|
"@types/js-yaml": "~4.0.5",
|
|
59
60
|
"@types/node": "~22.5.4",
|
|
60
61
|
"@types/yargs": "~17.0.33",
|
|
@@ -66,14 +67,16 @@
|
|
|
66
67
|
"typescript": "~5.6.2",
|
|
67
68
|
"typescript-eslint": "^8.5.0",
|
|
68
69
|
"@azure-tools/typespec-azure-core": "~0.46.0",
|
|
69
|
-
"@azure-tools/typespec-client-generator-core": "0.46.
|
|
70
|
+
"@azure-tools/typespec-client-generator-core": "~0.46.2",
|
|
70
71
|
"@typespec/compiler": "~0.60.0",
|
|
71
72
|
"@typespec/http": "~0.60.0",
|
|
72
73
|
"@typespec/rest": "~0.60.0",
|
|
73
74
|
"@typespec/versioning": "~0.60.0",
|
|
74
|
-
"@azure-tools/typespec-azure-rulesets": "0.46.0",
|
|
75
|
+
"@azure-tools/typespec-azure-rulesets": "~0.46.0",
|
|
75
76
|
"yargs": "~17.7.2",
|
|
76
|
-
"chalk": "5.3.0"
|
|
77
|
+
"chalk": "5.3.0",
|
|
78
|
+
"@typespec/http-client-python": "~0.2.0",
|
|
79
|
+
"@types/fs-extra": "11.0.4"
|
|
77
80
|
},
|
|
78
81
|
"scripts": {
|
|
79
82
|
"clean": "rimraf ./dist ./temp ./venv ./node_modules",
|
|
@@ -82,8 +85,8 @@
|
|
|
82
85
|
"lint": "tsx ./scripts/eng/lint.ts",
|
|
83
86
|
"lint:fix": "eslint . --fix --ext .ts",
|
|
84
87
|
"format": "npx prettier **/*.ts --write && tsx ./scripts/eng/format.ts",
|
|
85
|
-
"install": "tsx ./scripts/run-python3.ts ./scripts/install.py",
|
|
88
|
+
"install": "tsx ./scripts/copy-scripts.ts --force && tsx ./scripts/run-python3.ts ./scripts/install.py",
|
|
86
89
|
"regenerate": "tsx ./scripts/eng/regenerate.ts",
|
|
87
|
-
"test": "
|
|
90
|
+
"test": "tsx ./scripts/eng/run-tests.ts"
|
|
88
91
|
}
|
|
89
92
|
}
|
|
Binary file
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import fsExtra from "fs-extra";
|
|
2
|
+
import { dirname, join, posix, win32 } from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
|
|
5
|
+
const force: boolean = process.argv[2] === "--force";
|
|
6
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
|
|
8
|
+
function copyAndCreateDir(sourceDir: string, destDir: string) {
|
|
9
|
+
// Delete the destination directory if it exists
|
|
10
|
+
if (fsExtra.existsSync(destDir)) {
|
|
11
|
+
if (force) fsExtra.removeSync(destDir);
|
|
12
|
+
else process.exit(0);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Copy the source directory to the destination directory
|
|
16
|
+
fsExtra.copySync(sourceDir, destDir, {
|
|
17
|
+
filter: (src: string) => {
|
|
18
|
+
return !src.replaceAll(win32.sep, posix.sep).includes("/test/");
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const typespecModulePath: string = join(__dirname, "..", "node_modules", "@typespec", "http-client-python");
|
|
24
|
+
|
|
25
|
+
// Copy the generator directory
|
|
26
|
+
copyAndCreateDir(join(typespecModulePath, "generator"), join(__dirname, "..", "generator"));
|
package/scripts/eng/pylintrc
CHANGED
|
@@ -15,8 +15,9 @@ enable=useless-suppression
|
|
|
15
15
|
# locally-disabled: Warning locally suppressed using disable-msg
|
|
16
16
|
# cyclic-import: because of https://github.com/PyCQA/pylint/issues/850
|
|
17
17
|
# too-many-arguments: Due to the nature of the CLI many commands have large arguments set which reflect in large arguments set in corresponding methods.
|
|
18
|
+
# too-many-lines: Due to code generation many files end up with too many lines.
|
|
18
19
|
# Let's black deal with bad-continuation
|
|
19
|
-
disable=useless-object-inheritance,missing-docstring,locally-disabled,fixme,cyclic-import,too-many-arguments,invalid-name,duplicate-code,too-few-public-methods,consider-using-f-string,super-with-arguments,redefined-builtin,import-outside-toplevel,client-suffix-needed,unnecessary-dunder-call,unnecessary-ellipsis,disallowed-name,consider-using-max-builtin
|
|
20
|
+
disable=useless-object-inheritance,missing-docstring,locally-disabled,fixme,cyclic-import,too-many-arguments,invalid-name,duplicate-code,too-few-public-methods,consider-using-f-string,super-with-arguments,redefined-builtin,import-outside-toplevel,client-suffix-needed,unnecessary-dunder-call,unnecessary-ellipsis,disallowed-name,consider-using-max-builtin,too-many-lines,parse-error,useless-suppression,unknown-option-value
|
|
20
21
|
|
|
21
22
|
[FORMAT]
|
|
22
23
|
max-line-length=120
|
package/dist/src/code-model.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { SdkServiceOperation } from "@azure-tools/typespec-client-generator-core";
|
|
2
|
-
import { PythonSdkContext } from "./lib.js";
|
|
3
|
-
export declare function emitCodeModel<TServiceOperation extends SdkServiceOperation>(sdkContext: PythonSdkContext<TServiceOperation>): Record<string, any>;
|
|
4
|
-
//# sourceMappingURL=code-model.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code-model.d.ts","sourceRoot":"","sources":["../../src/code-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAWH,mBAAmB,EAGtB,MAAM,6CAA6C,CAAC;AAIrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAgM5C,wBAAgB,aAAa,CAAC,iBAAiB,SAAS,mBAAmB,EACvE,UAAU,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,uBAuClD"}
|
package/dist/src/code-model.js
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { UsageFlags, getCrossLanguagePackageId, } from "@azure-tools/typespec-client-generator-core";
|
|
2
|
-
import { KnownTypes, disableGenerationMap, emitEndpointType, getType, simpleTypesMap, typesMap } from "./types.js";
|
|
3
|
-
import { emitParamBase, getImplementation, removeUnderscoresFromNamespace } from "./utils.js";
|
|
4
|
-
import { emitBasicHttpMethod, emitLroHttpMethod, emitLroPagingHttpMethod, emitPagingHttpMethod } from "./http.js";
|
|
5
|
-
import { ignoreDiagnostics } from "@typespec/compiler";
|
|
6
|
-
function emitBasicMethod(context, rootClient, method, operationGroupName) {
|
|
7
|
-
if (method.operation.kind !== "http")
|
|
8
|
-
throw new Error("We only support HTTP operations right now");
|
|
9
|
-
switch (method.operation.kind) {
|
|
10
|
-
case "http":
|
|
11
|
-
return emitBasicHttpMethod(context, rootClient, method, operationGroupName);
|
|
12
|
-
default:
|
|
13
|
-
throw new Error("We only support HTTP operations right now");
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function emitLroMethod(context, rootClient, method, operationGroupName) {
|
|
17
|
-
if (method.operation.kind !== "http")
|
|
18
|
-
throw new Error("We only support HTTP operations right now");
|
|
19
|
-
switch (method.operation.kind) {
|
|
20
|
-
case "http":
|
|
21
|
-
return emitLroHttpMethod(context, rootClient, method, operationGroupName);
|
|
22
|
-
default:
|
|
23
|
-
throw new Error("We only support HTTP operations right now");
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function emitPagingMethod(context, rootClient, method, operationGroupName) {
|
|
27
|
-
if (method.operation.kind !== "http")
|
|
28
|
-
throw new Error("We only support HTTP operations right now");
|
|
29
|
-
switch (method.operation.kind) {
|
|
30
|
-
case "http":
|
|
31
|
-
return emitPagingHttpMethod(context, rootClient, method, operationGroupName);
|
|
32
|
-
default:
|
|
33
|
-
throw new Error("We only support HTTP operations right now");
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function emitLroPagingMethod(context, rootClient, method, operationGroupName) {
|
|
37
|
-
if (method.operation.kind !== "http")
|
|
38
|
-
throw new Error("We only support HTTP operations right now");
|
|
39
|
-
switch (method.operation.kind) {
|
|
40
|
-
case "http":
|
|
41
|
-
return emitLroPagingHttpMethod(context, rootClient, method, operationGroupName);
|
|
42
|
-
default:
|
|
43
|
-
throw new Error("We only support HTTP operations right now");
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function emitMethodParameter(context, parameter) {
|
|
47
|
-
if (parameter.kind === "endpoint") {
|
|
48
|
-
if (parameter.type.kind === "union") {
|
|
49
|
-
for (const endpointVal of parameter.type.variantTypes) {
|
|
50
|
-
return emitEndpointType(context, endpointVal);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
return emitEndpointType(context, parameter.type);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
const base = {
|
|
58
|
-
...emitParamBase(context, parameter),
|
|
59
|
-
implementation: getImplementation(context, parameter),
|
|
60
|
-
clientDefaultValue: parameter.clientDefaultValue,
|
|
61
|
-
location: parameter.kind,
|
|
62
|
-
};
|
|
63
|
-
if (parameter.isApiVersionParam) {
|
|
64
|
-
return [
|
|
65
|
-
{
|
|
66
|
-
...base,
|
|
67
|
-
location: "query",
|
|
68
|
-
wireName: "api-version",
|
|
69
|
-
in_docstring: false,
|
|
70
|
-
},
|
|
71
|
-
];
|
|
72
|
-
}
|
|
73
|
-
return [base];
|
|
74
|
-
}
|
|
75
|
-
function emitMethod(context, rootClient, method, operationGroupName) {
|
|
76
|
-
switch (method.kind) {
|
|
77
|
-
case "basic":
|
|
78
|
-
return emitBasicMethod(context, rootClient, method, operationGroupName);
|
|
79
|
-
case "lro":
|
|
80
|
-
return emitLroMethod(context, rootClient, method, operationGroupName);
|
|
81
|
-
case "paging":
|
|
82
|
-
return emitPagingMethod(context, rootClient, method, operationGroupName);
|
|
83
|
-
default:
|
|
84
|
-
return emitLroPagingMethod(context, rootClient, method, operationGroupName);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
function emitOperationGroups(context, client, rootClient, prefix) {
|
|
88
|
-
const operationGroups = [];
|
|
89
|
-
for (const method of client.methods) {
|
|
90
|
-
if (method.kind === "clientaccessor") {
|
|
91
|
-
const operationGroup = method.response;
|
|
92
|
-
const name = `${prefix}${operationGroup.name}`;
|
|
93
|
-
let operations = [];
|
|
94
|
-
for (const method of operationGroup.methods) {
|
|
95
|
-
if (method.kind === "clientaccessor")
|
|
96
|
-
continue;
|
|
97
|
-
operations = operations.concat(emitMethod(context, rootClient, method, name));
|
|
98
|
-
}
|
|
99
|
-
operationGroups.push({
|
|
100
|
-
name: name,
|
|
101
|
-
className: name,
|
|
102
|
-
propertyName: operationGroup.name,
|
|
103
|
-
operations: operations,
|
|
104
|
-
operationGroups: emitOperationGroups(context, operationGroup, rootClient, name),
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
// root client should deal with mixin operation group
|
|
109
|
-
if (prefix === "") {
|
|
110
|
-
let operations = [];
|
|
111
|
-
for (const method of client.methods) {
|
|
112
|
-
if (method.kind === "clientaccessor")
|
|
113
|
-
continue;
|
|
114
|
-
operations = operations.concat(emitMethod(context, rootClient, method, ""));
|
|
115
|
-
}
|
|
116
|
-
if (operations.length > 0) {
|
|
117
|
-
operationGroups.push({
|
|
118
|
-
name: "",
|
|
119
|
-
className: "",
|
|
120
|
-
propertyName: "",
|
|
121
|
-
operations: operations,
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return operationGroups.length > 0 ? operationGroups : undefined;
|
|
126
|
-
}
|
|
127
|
-
function emitClient(context, client) {
|
|
128
|
-
if (client.initialization) {
|
|
129
|
-
context.__endpointPathParameters = [];
|
|
130
|
-
}
|
|
131
|
-
const parameters = client.initialization?.properties.map((x) => emitMethodParameter(context, x)).reduce((a, b) => [...a, ...b]) ??
|
|
132
|
-
[];
|
|
133
|
-
const endpointParameter = client.initialization?.properties.find((x) => x.kind === "endpoint");
|
|
134
|
-
const operationGroups = emitOperationGroups(context, client, client, "");
|
|
135
|
-
let url;
|
|
136
|
-
if (endpointParameter?.type.kind === "union") {
|
|
137
|
-
url = endpointParameter.type.variantTypes[0].serverUrl;
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
url = endpointParameter?.type.serverUrl;
|
|
141
|
-
}
|
|
142
|
-
return {
|
|
143
|
-
name: client.name,
|
|
144
|
-
description: client.description ?? "",
|
|
145
|
-
parameters,
|
|
146
|
-
operationGroups,
|
|
147
|
-
url,
|
|
148
|
-
apiVersions: client.apiVersions,
|
|
149
|
-
arm: context.arm,
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
export function emitCodeModel(sdkContext) {
|
|
153
|
-
// Get types
|
|
154
|
-
const sdkPackage = sdkContext.sdkPackage;
|
|
155
|
-
const codeModel = {
|
|
156
|
-
namespace: removeUnderscoresFromNamespace(sdkPackage.rootNamespace).toLowerCase(),
|
|
157
|
-
clients: [],
|
|
158
|
-
subnamespaceToClients: {},
|
|
159
|
-
};
|
|
160
|
-
for (const client of sdkPackage.clients) {
|
|
161
|
-
codeModel["clients"].push(emitClient(sdkContext, client));
|
|
162
|
-
if (client.nameSpace === sdkPackage.rootNamespace) {
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
codeModel["subnamespaceToClients"][client.nameSpace] = emitClient(sdkContext, client);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
// loop through models and enums since there may be some orphaned models needs to be generated
|
|
169
|
-
for (const model of sdkPackage.models) {
|
|
170
|
-
if (model.name === "" ||
|
|
171
|
-
((model.usage & UsageFlags.Spread) > 0 &&
|
|
172
|
-
(model.usage & UsageFlags.Input) === 0 &&
|
|
173
|
-
(model.usage & UsageFlags.Output) === 0)) {
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
if (!disableGenerationMap.has(model)) {
|
|
177
|
-
getType(sdkContext, model);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
for (const sdkEnum of sdkPackage.enums) {
|
|
181
|
-
if (sdkEnum.usage === UsageFlags.ApiVersionEnum) {
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
getType(sdkContext, sdkEnum);
|
|
185
|
-
}
|
|
186
|
-
codeModel["types"] = [...typesMap.values(), ...Object.values(KnownTypes), ...simpleTypesMap.values()];
|
|
187
|
-
codeModel["crossLanguagePackageId"] = ignoreDiagnostics(getCrossLanguagePackageId(sdkContext));
|
|
188
|
-
return codeModel;
|
|
189
|
-
}
|
|
190
|
-
//# sourceMappingURL=code-model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code-model.js","sourceRoot":"","sources":["../../src/code-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAYH,UAAU,EACV,yBAAyB,GAC5B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACnH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;AAC9F,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAElH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,SAAS,eAAe,CACpB,OAA4C,EAC5C,UAA4C,EAC5C,MAAgD,EAChD,kBAA0B;IAE1B,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,KAAK,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IACnG,QAAQ,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QAC5B,KAAK,MAAM;YACP,OAAO,mBAAmB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAC;QAChF;YACI,MAAM,IAAI,KAAK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CAAC,IAAI,KAAK,EAAE;YACjB,CAAC,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC;gBAClC,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC;gBACtC,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAC9C,CAAC;YACC,SAAS;QACb,CAAC;QACD,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACnC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC/B,CAAC;IACL,CAAC;IACD,KAAK,MAAM,OAAO,IAAI,UAAU,CAAC,KAAK,EAAE,CAAC;QACrC,IAAI,OAAO,CAAC,KAAK,KAAK,UAAU,CAAC,cAAc,EAAE,CAAC;YAC9C,SAAS;QACb,CAAC;QACD,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IACD,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC;IACtG,SAAS,CAAC,wBAAwB,CAAC,GAAG,iBAAiB,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC,CAAC;IAC/F,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ChildProcess, SpawnOptions } from "child_process";
|
|
2
|
-
export declare function createTempPath(extension: string, prefix?: string): string;
|
|
3
|
-
/**
|
|
4
|
-
* Save the given codemodel in a yaml file.
|
|
5
|
-
* @param name Name of the codemodel. To give a guide to the temp file name.
|
|
6
|
-
* @param codemodel Codemodel to save
|
|
7
|
-
* @return the absolute path to the created codemodel.
|
|
8
|
-
*/
|
|
9
|
-
export declare function saveCodeModelAsYaml(name: string, codemodel: unknown): Promise<string>;
|
|
10
|
-
/**
|
|
11
|
-
* Start external process async
|
|
12
|
-
* @param command Command to run. This is the just the executable path or name.
|
|
13
|
-
* @param args Command arguments.
|
|
14
|
-
* @param options Options
|
|
15
|
-
*/
|
|
16
|
-
export declare function execAsync(command: string, args: string[], options?: SpawnOptions): Promise<{
|
|
17
|
-
exitCode: number;
|
|
18
|
-
proc: ChildProcess;
|
|
19
|
-
}>;
|
|
20
|
-
//# sourceMappingURL=external-process.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"external-process.d.ts","sourceRoot":"","sources":["../../src/external-process.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAS,YAAY,EAAE,MAAM,eAAe,CAAC;AAQlE,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,GAAE,MAAW,UAEpE;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAM3F;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAC3B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,YAAiB,GAC3B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC,CAcnD"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { joinPaths } from "@typespec/compiler";
|
|
2
|
-
import { spawn } from "child_process";
|
|
3
|
-
import { randomUUID } from "crypto";
|
|
4
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
5
|
-
import jsyaml from "js-yaml";
|
|
6
|
-
import os from "os";
|
|
7
|
-
const cadlCodeGenTempDir = joinPaths(os.tmpdir(), "cadl-codegen");
|
|
8
|
-
export function createTempPath(extension, prefix = "") {
|
|
9
|
-
return joinPaths(cadlCodeGenTempDir, prefix + randomUUID() + extension);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Save the given codemodel in a yaml file.
|
|
13
|
-
* @param name Name of the codemodel. To give a guide to the temp file name.
|
|
14
|
-
* @param codemodel Codemodel to save
|
|
15
|
-
* @return the absolute path to the created codemodel.
|
|
16
|
-
*/
|
|
17
|
-
export async function saveCodeModelAsYaml(name, codemodel) {
|
|
18
|
-
await mkdir(cadlCodeGenTempDir, { recursive: true });
|
|
19
|
-
const filename = createTempPath(".yaml", name);
|
|
20
|
-
const yamlStr = jsyaml.dump(codemodel);
|
|
21
|
-
await writeFile(filename, yamlStr);
|
|
22
|
-
return filename;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Start external process async
|
|
26
|
-
* @param command Command to run. This is the just the executable path or name.
|
|
27
|
-
* @param args Command arguments.
|
|
28
|
-
* @param options Options
|
|
29
|
-
*/
|
|
30
|
-
export async function execAsync(command, args, options = {}) {
|
|
31
|
-
const child = spawn(command, args, { stdio: "inherit", ...options });
|
|
32
|
-
return new Promise((resolve, reject) => {
|
|
33
|
-
child.on("error", (error) => {
|
|
34
|
-
reject(error);
|
|
35
|
-
});
|
|
36
|
-
child.on("exit", (exitCode) => {
|
|
37
|
-
resolve({
|
|
38
|
-
exitCode: exitCode ?? -1,
|
|
39
|
-
proc: child,
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=external-process.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"external-process.js","sourceRoot":"","sources":["../../src/external-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAgB,KAAK,EAAgB,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MA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E,QAAQ,IAAI,CAAC,CAAC;gBACxB,IAAI,EAAE,KAAK;aACd,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/src/http.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SdkBasicServiceMethod, SdkClientType, SdkHttpOperation, SdkLroPagingServiceMethod, SdkLroServiceMethod, SdkPagingServiceMethod } from "@azure-tools/typespec-client-generator-core";
|
|
2
|
-
import { PythonSdkContext } from "./lib.js";
|
|
3
|
-
export declare function emitBasicHttpMethod(context: PythonSdkContext<SdkHttpOperation>, rootClient: SdkClientType<SdkHttpOperation>, method: SdkBasicServiceMethod<SdkHttpOperation>, operationGroupName: string): Record<string, any>[];
|
|
4
|
-
export declare function emitLroHttpMethod(context: PythonSdkContext<SdkHttpOperation>, rootClient: SdkClientType<SdkHttpOperation>, method: SdkLroServiceMethod<SdkHttpOperation>, operationGroupName: string): Record<string, any>[];
|
|
5
|
-
export declare function emitPagingHttpMethod(context: PythonSdkContext<SdkHttpOperation>, rootClient: SdkClientType<SdkHttpOperation>, method: SdkPagingServiceMethod<SdkHttpOperation>, operationGroupName: string): Record<string, any>[];
|
|
6
|
-
export declare function emitLroPagingHttpMethod(context: PythonSdkContext<SdkHttpOperation>, rootClient: SdkClientType<SdkHttpOperation>, method: SdkLroPagingServiceMethod<SdkHttpOperation>, operationGroupName: string): Record<string, any>[];
|
|
7
|
-
//# sourceMappingURL=http.d.ts.map
|
package/dist/src/http.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EAErB,aAAa,EAEb,gBAAgB,EAEhB,yBAAyB,EACzB,mBAAmB,EACnB,sBAAsB,EAOzB,MAAM,6CAA6C,CAAC;AAYrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC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