@azure-tools/rlc-common 0.30.0 → 0.31.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/.rush/temp/package-deps_build.json +17 -17
- package/.rush/temp/shrinkwrap-deps.json +9 -9
- package/CHANGELOG.md +19 -0
- package/dist/buildClient.js +4 -5
- package/dist/buildClient.js.map +1 -1
- package/dist/buildClientDefinitions.js +1 -2
- package/dist/buildClientDefinitions.js.map +1 -1
- package/dist/buildIndexFile.js +1 -2
- package/dist/buildIndexFile.js.map +1 -1
- package/dist/buildIsUnexpectedHelper.js +8 -6
- package/dist/buildIsUnexpectedHelper.js.map +1 -1
- package/dist/buildLogger.js +1 -2
- package/dist/buildLogger.js.map +1 -1
- package/dist/buildMethodShortcuts.js +2 -2
- package/dist/buildMethodShortcuts.js.map +1 -1
- package/dist/buildObjectTypes.js +51 -16
- package/dist/buildObjectTypes.js.map +1 -1
- package/dist/buildPaginateHelper.js +1 -2
- package/dist/buildPaginateHelper.js.map +1 -1
- package/dist/buildParameterTypes.js +16 -5
- package/dist/buildParameterTypes.js.map +1 -1
- package/dist/buildPollingHelper.js +1 -2
- package/dist/buildPollingHelper.js.map +1 -1
- package/dist/buildResponseTypes.js +13 -4
- package/dist/buildResponseTypes.js.map +1 -1
- package/dist/buildSamples.js +1 -2
- package/dist/buildSamples.js.map +1 -1
- package/dist/buildSchemaType.js +2 -3
- package/dist/buildSchemaType.js.map +1 -1
- package/dist/buildSerializeHelper.js +1 -2
- package/dist/buildSerializeHelper.js.map +1 -1
- package/dist/buildTopLevelIndexFile.js +1 -2
- package/dist/buildTopLevelIndexFile.js.map +1 -1
- package/dist/helpers/apiVersionUtil.js +2 -3
- package/dist/helpers/apiVersionUtil.js.map +1 -1
- package/dist/helpers/importsUtil.js +6 -7
- package/dist/helpers/importsUtil.js.map +1 -1
- package/dist/helpers/nameConstructors.js +8 -9
- package/dist/helpers/nameConstructors.js.map +1 -1
- package/dist/helpers/nameUtils.js +7 -7
- package/dist/helpers/nameUtils.js.map +1 -1
- package/dist/helpers/operationHelpers.js +19 -15
- package/dist/helpers/operationHelpers.js.map +1 -1
- package/dist/helpers/pathUtils.js +1 -2
- package/dist/helpers/pathUtils.js.map +1 -1
- package/dist/helpers/schemaHelpers.js +5 -6
- package/dist/helpers/schemaHelpers.js.map +1 -1
- package/dist/helpers/shortcutMethods.js +1 -2
- package/dist/helpers/shortcutMethods.js.map +1 -1
- package/dist/helpers/typeUtil.js +18 -18
- package/dist/helpers/typeUtil.js.map +1 -1
- package/dist/helpers/valueGenerationUtil.js +1 -2
- package/dist/helpers/valueGenerationUtil.js.map +1 -1
- package/dist/metadata/buildApiExtractorConfig.js +1 -2
- package/dist/metadata/buildApiExtractorConfig.js.map +1 -1
- package/dist/metadata/buildBrowserConfig.js +1 -2
- package/dist/metadata/buildBrowserConfig.js.map +1 -1
- package/dist/metadata/buildESLintConfig.js +1 -2
- package/dist/metadata/buildESLintConfig.js.map +1 -1
- package/dist/metadata/buildLicenseFile.js +1 -2
- package/dist/metadata/buildLicenseFile.js.map +1 -1
- package/dist/metadata/buildPackageFile.js +12 -5
- package/dist/metadata/buildPackageFile.js.map +1 -1
- package/dist/metadata/buildReadmeFile.js +158 -8
- package/dist/metadata/buildReadmeFile.js.map +1 -1
- package/dist/metadata/buildRollupConfig.js +1 -2
- package/dist/metadata/buildRollupConfig.js.map +1 -1
- package/dist/metadata/buildTsConfig.js +3 -4
- package/dist/metadata/buildTsConfig.js.map +1 -1
- package/dist/metadata/buildVitestConfig.js +5 -4
- package/dist/metadata/buildVitestConfig.js.map +1 -1
- package/dist/metadata/packageJson/azurePackageCommon.js +44 -12
- package/dist/metadata/packageJson/azurePackageCommon.js.map +1 -1
- package/dist/metadata/packageJson/buildAzureMonorepoPackage.js +62 -15
- package/dist/metadata/packageJson/buildAzureMonorepoPackage.js.map +1 -1
- package/dist/metadata/packageJson/buildAzureStandalonePackage.js +32 -8
- package/dist/metadata/packageJson/buildAzureStandalonePackage.js.map +1 -1
- package/dist/metadata/packageJson/buildFlavorlessPackage.js +19 -5
- package/dist/metadata/packageJson/buildFlavorlessPackage.js.map +1 -1
- package/dist/metadata/packageJson/packageCommon.js +41 -12
- package/dist/metadata/packageJson/packageCommon.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/test/buildKarmaConfig.js +1 -2
- package/dist/test/buildKarmaConfig.js.map +1 -1
- package/dist/test/buildRecordedClient.js +6 -3
- package/dist/test/buildRecordedClient.js.map +1 -1
- package/dist/test/buildSampleTest.js +1 -2
- package/dist/test/buildSampleTest.js.map +1 -1
- package/dist/test/template.js +27 -10
- package/dist/test/template.js.map +1 -1
- package/dist/transformSampleGroups.js +1 -2
- package/dist/transformSampleGroups.js.map +1 -1
- package/dist-esm/buildClient.js +2 -2
- package/dist-esm/buildClient.js.map +1 -1
- package/dist-esm/metadata/buildPackageFile.js +2 -1
- package/dist-esm/metadata/buildPackageFile.js.map +1 -1
- package/dist-esm/metadata/buildReadmeFile.js +157 -6
- package/dist-esm/metadata/buildReadmeFile.js.map +1 -1
- package/dist-esm/metadata/buildTsConfig.js +2 -2
- package/dist-esm/metadata/buildTsConfig.js.map +1 -1
- package/dist-esm/metadata/buildVitestConfig.js +4 -2
- package/dist-esm/metadata/buildVitestConfig.js.map +1 -1
- package/dist-esm/metadata/packageJson/azurePackageCommon.js +4 -3
- package/dist-esm/metadata/packageJson/azurePackageCommon.js.map +1 -1
- package/dist-esm/metadata/packageJson/buildAzureMonorepoPackage.js +8 -4
- package/dist-esm/metadata/packageJson/buildAzureMonorepoPackage.js.map +1 -1
- package/dist-esm/metadata/packageJson/packageCommon.js +1 -1
- package/dist-esm/metadata/packageJson/packageCommon.js.map +1 -1
- package/dist-esm/package.json +1 -1
- package/dist-esm/test/buildRecordedClient.js +4 -1
- package/dist-esm/test/buildRecordedClient.js.map +1 -1
- package/dist-esm/test/template.js +27 -10
- package/dist-esm/test/template.js.map +1 -1
- package/package.json +2 -2
- package/src/buildClient.ts +4 -2
- package/src/helpers/schemaHelpers.ts +1 -1
- package/src/interfaces.ts +2 -0
- package/src/metadata/buildPackageFile.ts +2 -1
- package/src/metadata/buildReadmeFile.ts +165 -6
- package/src/metadata/buildTsConfig.ts +2 -2
- package/src/metadata/buildVitestConfig.ts +4 -2
- package/src/metadata/packageJson/azurePackageCommon.ts +4 -3
- package/src/metadata/packageJson/buildAzureMonorepoPackage.ts +8 -4
- package/src/metadata/packageJson/packageCommon.ts +2 -1
- package/src/test/buildRecordedClient.ts +4 -1
- package/src/test/template.ts +27 -10
- package/test/integration/packageJson.spec.ts +2 -2
- package/tsconfig-cjs.json +1 -1
- package/types/helpers/schemaHelpers.d.ts +2 -2
- package/types/helpers/typeUtil.d.ts +1 -1
- package/types/interfaces.d.ts +1 -0
- package/types/metadata/packageJson/packageCommon.d.ts +1 -0
- package/types/test/template.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildAzureMonorepoPackage.js","sourceRoot":"","sources":["../../../src/metadata/packageJson/buildAzureMonorepoPackage.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAE3B,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AAOjC;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAA+B;IACvE,MAAM,WAAW,GAAG;QAClB,GAAG,2BAA2B,CAAC,MAAM,CAAC;QACtC,GAAG,4BAA4B,CAAC,MAAM,CAAC;QACvC,OAAO,EAAE,uBAAuB,CAAC,MAAM,CAAC;QACxC,GAAG,iBAAiB,CAAC,MAAM,CAAC;KAC7B,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAAC,MAA+B;IAC1E,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACzD,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACzD,OAAO;QACL,YAAY,EAAE;YACZ,GAAG,2BAA2B,CAAC,MAAM,CAAC;SACvC;QACD,eAAe,EAAE;YACf,GAAG,8BAA8B,CAAC,MAAM,CAAC;YACzC,iBAAiB,EAAE,QAAQ;YAC3B,gCAAgC,EAAE,QAAQ;YAC1C,GAAG,kBAAkB;YACrB,GAAG,kBAAkB;SACtB;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACzC,MAA+B;IAE/B,MAAM,QAAQ,GAAwB;QACpC,aAAa,EAAE,EAAE;KAClB,CAAC;IAEF,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IAChD,KAAK,MAAM,cAAc,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;QACpD,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC;YAC1B,IAAI,EAAE,cAAc;YACpB,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"buildAzureMonorepoPackage.js","sourceRoot":"","sources":["../../../src/metadata/packageJson/buildAzureMonorepoPackage.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAE3B,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AAOjC;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAA+B;IACvE,MAAM,WAAW,GAAG;QAClB,GAAG,2BAA2B,CAAC,MAAM,CAAC;QACtC,GAAG,4BAA4B,CAAC,MAAM,CAAC;QACvC,OAAO,EAAE,uBAAuB,CAAC,MAAM,CAAC;QACxC,GAAG,iBAAiB,CAAC,MAAM,CAAC;KAC7B,CAAC;IAEF,OAAO,WAAW,CAAC;AACr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AC1C,uBAAuB,EAAE,cAAc;QACvC,iBAAiB,EAAE,cAAc;QACjC,cAAc,EACZ,sGAAsG;QACxG,UAAU,EACR,uHAAuH;QACzH,IAAI,EAAE,iFAAiF;QACvF,MAAM,EACJ,iHAAiH;QACnH,GAAG,UAAU;QACb,GAAG,UAAU;KACd,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,EAAE,UAAU,EAA2B;IAC5D,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO;QACL,YAAY,EAAE,kDAAkD;QAChE,KAAK,EACH,sEAAsE;QACxE,WAAW,EACT,kFAAkF;QACpF,IAAI,EAAE,iIAAiI;QACvI,mBAAmB,EACjB,0DAA0D;QAC5D,gBAAgB,EAAE,0BAA0B;KAC7C,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,EAAE,UAAU,EAA2B;IAC5D,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO;QACL,KAAK,EACH,iGAAiG;QACnG,YAAY,EAAE,qDAAqD;QACnE,YAAY,EAAE,iCAAiC;QAC/C,aAAa,EACX,6DAA6D;QAC/D,0BAA0B,EAAE,2BAA2B;QACvD,uBAAuB,EACrB,mFAAmF;QACrF,gBAAgB,EACd,gHAAgH;QAClH,mBAAmB,EAAE,2BAA2B;KACjD,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageCommon.js","sourceRoot":"","sources":["../../../src/metadata/packageJson/packageCommon.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"packageCommon.js","sourceRoot":"","sources":["../../../src/metadata/packageJson/packageCommon.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAclC;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAA+B;IAClE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C/F,GAAG,CAAC,SAAS,IAAI,WAAW,CAAC;KAC9B,CAAC;AACJ,CAAC"}
|
package/dist-esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@azure-tools/rlc-common","version":"0.
|
|
1
|
+
{"name":"@azure-tools/rlc-common","version":"0.31.0","description":"","type":"module","main":"dist/index.js","module":"dist-esm/index.js","exports":{".":{"types":"./types/index.d.ts","require":"./dist/index.js","import":"./dist-esm/index.js"}},"types":"./types/index.d.ts","scripts":{"lint":"eslint src --ext .ts --max-warnings=0","lint:fix":"eslint src --fix --ext .ts","format":"npm run -s prettier -- --write","check-format":"npm run prettier -- --check","prettier":"prettier --config ./.prettierrc \"src/**/*.ts\"","build":"rimraf --glob dist/* dist-esm/* types/* && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && node publishPackage.js","build:cjs":"rimraf --glob dist/* dist-esm/* types/* && tsc -p tsconfig-cjs.json && node publishPackage.js","build:esm":"rimraf --glob dist/* dist-esm/* types/* && tsc -p tsconfig.json && node publishPackage.js","test":"npm run unit-test","unit-test":"cross-env TS_NODE_PROJECT=tsconfig.json mocha -r ts-node/register --loader=ts-node/esm --experimental-specifier-resolution=node test/**/*.spec.ts"},"keywords":[],"author":"","license":"ISC","dependencies":{"ts-morph":"^15.1.0","lodash":"^4.17.21","handlebars":"^4.7.7"},"devDependencies":{"@types/node":"^18.0.0","eslint":"^8.9.0","prettier":"^3.1.0","typescript":"~5.5.3","rimraf":"^5.0.0","@types/lodash":"^4.14.182","fs-extra":"^10.0.0","@types/fs-extra":"^8.1.0","ts-node":"^10.7.0","mocha":"^10.2.0","chai":"^4.3.7","@types/chai":"^4.3.4","@types/mocha":"^10.0.1","@typescript-eslint/eslint-plugin":"^6.8.0","@typescript-eslint/parser":"^6.8.0","eslint-plugin-require-extensions":"0.1.3","cross-env":"7.0.3"},"bugs":{"url":"https://github.com/Azure/autorest.typescript/issues"},"homepage":"https://github.com/Azure/autorest.typescript/tree/main/packages/rlc-common/"}
|
|
@@ -8,7 +8,10 @@ export function buildRecordedClientFile(model) {
|
|
|
8
8
|
});
|
|
9
9
|
return {
|
|
10
10
|
path: "test/public/utils/recordedClient.ts",
|
|
11
|
-
content: recordedClientFileContents({
|
|
11
|
+
content: recordedClientFileContents({
|
|
12
|
+
isEsm: model.options?.moduleKind === "esm",
|
|
13
|
+
isCjs: model.options?.moduleKind === "cjs"
|
|
14
|
+
})
|
|
12
15
|
};
|
|
13
16
|
}
|
|
14
17
|
//# sourceMappingURL=buildRecordedClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildRecordedClient.js","sourceRoot":"","sources":["../../src/test/buildRecordedClient.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,0CAA0C;AAC1C,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,MAAM,UAAU,uBAAuB,CAAC,KAAe;IACrD,MAAM,0BAA0B,GAAG,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE;QACpE,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IACH,OAAO;QACL,IAAI,EAAE,qCAAqC;QAC3C,OAAO,EAAE,0BAA0B,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"buildRecordedClient.js","sourceRoot":"","sources":["../../src/test/buildRecordedClient.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,0CAA0C;AAC1C,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,MAAM,UAAU,uBAAuB,CAAC,KAAe;IACrD,MAAM,0BAA0B,GAAG,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE;QACpE,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IACH,OAAO;QACL,IAAI,EAAE,qCAAqC;QAC3C,OAAO,EAAE,0BAA0B,CAAC;YAClC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,UAAU,KAAK,KAAK;YAC1C,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,UAAU,KAAK,KAAK;SAC3C,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -126,31 +126,48 @@ module.exports = function (config) {
|
|
|
126
126
|
};
|
|
127
127
|
`;
|
|
128
128
|
export const recordedClientContent = `
|
|
129
|
+
|
|
130
|
+
{{#if isEsm}}
|
|
131
|
+
import {
|
|
132
|
+
Recorder,
|
|
133
|
+
RecorderStartOptions,
|
|
134
|
+
VitestTestContext,
|
|
135
|
+
} from "@azure-tools/test-recorder";
|
|
136
|
+
{{/if}}
|
|
137
|
+
|
|
138
|
+
{{#if isCjs}}
|
|
129
139
|
import { Context } from "mocha";
|
|
130
140
|
import { Recorder, RecorderStartOptions } from "@azure-tools/test-recorder";
|
|
141
|
+
{{/if}}
|
|
131
142
|
|
|
132
|
-
const
|
|
133
|
-
ENDPOINT: "https://endpoint",
|
|
134
|
-
AZURE_CLIENT_ID: "azure_client_id",
|
|
135
|
-
AZURE_CLIENT_SECRET: "azure_client_secret",
|
|
136
|
-
AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
|
|
143
|
+
const replaceableVariables: Record<string, string> = {
|
|
137
144
|
SUBSCRIPTION_ID: "azure_subscription_id"
|
|
138
145
|
};
|
|
139
146
|
|
|
140
147
|
const recorderEnvSetup: RecorderStartOptions = {
|
|
141
|
-
envSetupForPlayback
|
|
148
|
+
envSetupForPlayback: replaceableVariables,
|
|
142
149
|
};
|
|
143
150
|
|
|
144
151
|
/**
|
|
145
|
-
* creates the recorder and reads the environment variables from the \`.env\` file.
|
|
146
|
-
* Should be called first in the test suite to make sure environment variables are
|
|
147
|
-
* read before they are being used.
|
|
148
|
-
*/
|
|
152
|
+
* creates the recorder and reads the environment variables from the \`.env\` file.
|
|
153
|
+
* Should be called first in the test suite to make sure environment variables are
|
|
154
|
+
* read before they are being used.
|
|
155
|
+
*/
|
|
156
|
+
{{#if isEsm}}
|
|
157
|
+
export async function createRecorder(context: VitestTestContext): Promise<Recorder> {
|
|
158
|
+
const recorder = new Recorder(context);
|
|
159
|
+
await recorder.start(recorderEnvSetup);
|
|
160
|
+
return recorder;
|
|
161
|
+
}
|
|
162
|
+
{{/if}}
|
|
163
|
+
|
|
164
|
+
{{#if isCjs}}
|
|
149
165
|
export async function createRecorder(context: Context): Promise<Recorder> {
|
|
150
166
|
const recorder = new Recorder(context.currentTest);
|
|
151
167
|
await recorder.start(recorderEnvSetup);
|
|
152
168
|
return recorder;
|
|
153
169
|
}
|
|
170
|
+
{{/if}}
|
|
154
171
|
`;
|
|
155
172
|
export const sampleTestContent = `
|
|
156
173
|
{{#if isEsm}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/test/template.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8H1B,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/test/template.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8H1B,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CpC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BhC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/rlc-common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@types/node": "^18.0.0",
|
|
26
26
|
"eslint": "^8.9.0",
|
|
27
27
|
"prettier": "^3.1.0",
|
|
28
|
-
"typescript": "~5.
|
|
28
|
+
"typescript": "~5.5.3",
|
|
29
29
|
"rimraf": "^5.0.0",
|
|
30
30
|
"@types/lodash": "^4.14.182",
|
|
31
31
|
"fs-extra": "^10.0.0",
|
package/src/buildClient.ts
CHANGED
|
@@ -345,9 +345,11 @@ export function getClientFactoryBody(
|
|
|
345
345
|
} else {
|
|
346
346
|
endpointUrl = `options.endpoint ?? options.baseUrl ?? "${endpoint}"`;
|
|
347
347
|
}
|
|
348
|
-
|
|
349
|
-
|
|
348
|
+
|
|
349
|
+
if (!model.options.isModularLibrary && !clientPackageName.endsWith("-rest")) {
|
|
350
|
+
clientPackageName += "-rest";
|
|
350
351
|
}
|
|
352
|
+
|
|
351
353
|
const userAgentInfoStatement =
|
|
352
354
|
"const userAgentInfo = `azsdk-js-" +
|
|
353
355
|
clientPackageName +
|
package/src/interfaces.ts
CHANGED
|
@@ -366,6 +366,8 @@ export interface OperationResponse {
|
|
|
366
366
|
operationName: string;
|
|
367
367
|
path: string;
|
|
368
368
|
responses: ResponseMetadata[];
|
|
369
|
+
// Check if the default response is one of superset of non-default responses
|
|
370
|
+
isDefaultSupersetOfOthers?: boolean;
|
|
369
371
|
}
|
|
370
372
|
export interface ResponseMetadata {
|
|
371
373
|
statusCode: string;
|
|
@@ -26,7 +26,8 @@ export function buildPackageFile(
|
|
|
26
26
|
withSamples: model.options?.generateSample === true,
|
|
27
27
|
withTests: model.options?.generateTest === true,
|
|
28
28
|
nameWithoutScope: model.options?.packageDetails?.nameWithoutScope,
|
|
29
|
-
exports
|
|
29
|
+
exports,
|
|
30
|
+
azureArm: model.options?.azureArm
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
let packageInfo: Record<string, any> = buildFlavorlessPackage(config);
|
|
@@ -7,7 +7,7 @@ import { RLCModel } from "../interfaces.js";
|
|
|
7
7
|
import hbs from "handlebars";
|
|
8
8
|
import { NameType, normalizeName } from "../helpers/nameUtils.js";
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const azureReadmeRLCTemplate = `# {{ clientDescriptiveName }} library for JavaScript
|
|
11
11
|
|
|
12
12
|
{{ description }}
|
|
13
13
|
|
|
@@ -84,6 +84,147 @@ setLogLevel("info");
|
|
|
84
84
|
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
|
|
85
85
|
`;
|
|
86
86
|
|
|
87
|
+
const azureReadmeModularTemplate = `# {{ clientDescriptiveName }} library for JavaScript
|
|
88
|
+
|
|
89
|
+
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for {{ clientDescriptiveName }}.
|
|
90
|
+
|
|
91
|
+
{{ description }}
|
|
92
|
+
|
|
93
|
+
{{#if packageSourceURL}}
|
|
94
|
+
[Source code]({{ packageSourceURL }}) |
|
|
95
|
+
{{/if}}
|
|
96
|
+
{{#if packageNPMURL}}
|
|
97
|
+
[Package (NPM)]({{ packageNPMURL }}) |
|
|
98
|
+
{{/if}}
|
|
99
|
+
{{#if apiRefURL}}
|
|
100
|
+
[API reference documentation]({{ apiRefURL }}) |
|
|
101
|
+
{{/if}}
|
|
102
|
+
{{#if samplesURL}}
|
|
103
|
+
[Samples]({{samplesURL}})
|
|
104
|
+
{{/if}}
|
|
105
|
+
|
|
106
|
+
## Getting started
|
|
107
|
+
|
|
108
|
+
### Currently supported environments
|
|
109
|
+
|
|
110
|
+
- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
|
|
111
|
+
- Latest versions of Safari, Chrome, Edge and Firefox.
|
|
112
|
+
|
|
113
|
+
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
|
|
114
|
+
|
|
115
|
+
{{#if azure}}
|
|
116
|
+
### Prerequisites
|
|
117
|
+
|
|
118
|
+
- An [Azure subscription][azure_sub].
|
|
119
|
+
{{/if}}
|
|
120
|
+
|
|
121
|
+
{{#if isReleasablePackage}}
|
|
122
|
+
### Install the \`{{ clientPackageName }}\` package
|
|
123
|
+
|
|
124
|
+
Install the {{ clientDescriptiveName }} library for JavaScript with \`npm\`:
|
|
125
|
+
|
|
126
|
+
\`\`\`bash
|
|
127
|
+
npm install {{ clientPackageName }}
|
|
128
|
+
\`\`\`
|
|
129
|
+
{{/if}}
|
|
130
|
+
|
|
131
|
+
{{#if azure}}
|
|
132
|
+
{{#if addCredentials}}
|
|
133
|
+
### Create and authenticate a \`{{ clientClassName}}\`
|
|
134
|
+
|
|
135
|
+
To create a client object to access the {{ serviceName }} API, you will need the \`endpoint\` of your {{ serviceName }} resource and a \`credential\`. The {{ clientDescriptiveName }} can use Azure Active Directory credentials to authenticate.
|
|
136
|
+
You can find the endpoint for your {{ serviceName }} resource in the [Azure Portal][azure_portal].
|
|
137
|
+
|
|
138
|
+
You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token).
|
|
139
|
+
|
|
140
|
+
To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the \`@azure/identity\` package:
|
|
141
|
+
|
|
142
|
+
\`\`\`bash
|
|
143
|
+
npm install @azure/identity
|
|
144
|
+
\`\`\`
|
|
145
|
+
|
|
146
|
+
You will also need to **register a new AAD application and grant access to {{ serviceName}}** by assigning the suitable role to your service principal (note: roles such as \`"Owner"\` will not grant the necessary permissions).
|
|
147
|
+
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: \`AZURE_CLIENT_ID\`, \`AZURE_TENANT_ID\`, \`AZURE_CLIENT_SECRET\`.
|
|
148
|
+
|
|
149
|
+
For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).
|
|
150
|
+
|
|
151
|
+
{{#if azureArm}}
|
|
152
|
+
\`\`\`javascript
|
|
153
|
+
const { {{ clientClassName }} } = require("{{ clientPackageName }}");
|
|
154
|
+
const { DefaultAzureCredential } = require("@azure/identity");
|
|
155
|
+
// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details.
|
|
156
|
+
|
|
157
|
+
const subscriptionId = "00000000-0000-0000-0000-000000000000";
|
|
158
|
+
const client = new {{ clientClassName }}(new DefaultAzureCredential(), subscriptionId);
|
|
159
|
+
|
|
160
|
+
// For client-side applications running in the browser, use this code instead:
|
|
161
|
+
// const credential = new InteractiveBrowserCredential({
|
|
162
|
+
// tenantId: "<YOUR_TENANT_ID>",
|
|
163
|
+
// clientId: "<YOUR_CLIENT_ID>"
|
|
164
|
+
// });
|
|
165
|
+
// const client = new {{ clientClassName }}(credential, subscriptionId);
|
|
166
|
+
\`\`\`
|
|
167
|
+
{{else}}
|
|
168
|
+
\`\`\`javascript
|
|
169
|
+
const { {{ clientClassName }} } = require("{{ clientPackageName }}");
|
|
170
|
+
const { DefaultAzureCredential } = require("@azure/identity");
|
|
171
|
+
// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details.
|
|
172
|
+
|
|
173
|
+
const client = new {{ clientClassName }}("<endpoint>", new DefaultAzureCredential());
|
|
174
|
+
// For client-side applications running in the browser, use this code instead:
|
|
175
|
+
// const credential = new InteractiveBrowserCredential({
|
|
176
|
+
// tenantId: "<YOUR_TENANT_ID>",
|
|
177
|
+
// clientId: "<YOUR_CLIENT_ID>"
|
|
178
|
+
// });
|
|
179
|
+
// const client = new {{ clientClassName }}("<endpoint>", credential);
|
|
180
|
+
\`\`\`
|
|
181
|
+
{{/if}}
|
|
182
|
+
{{/if}}{{/if}}
|
|
183
|
+
|
|
184
|
+
### JavaScript Bundle
|
|
185
|
+
To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling).
|
|
186
|
+
|
|
187
|
+
## Key concepts
|
|
188
|
+
|
|
189
|
+
### {{ clientClassName }}
|
|
190
|
+
|
|
191
|
+
\`{{ clientClassName }}\` is the primary interface for developers using the {{ clientDescriptiveName }} library. Explore the methods on this client object to understand the different features of the {{ serviceName }} service that you can access.
|
|
192
|
+
|
|
193
|
+
{{#if azure}}
|
|
194
|
+
## Troubleshooting
|
|
195
|
+
|
|
196
|
+
### Logging
|
|
197
|
+
|
|
198
|
+
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the \`AZURE_LOG_LEVEL\` environment variable to \`info\`. Alternatively, logging can be enabled at runtime by calling \`setLogLevel\` in the \`@azure/logger\`:
|
|
199
|
+
|
|
200
|
+
\`\`\`javascript
|
|
201
|
+
const { setLogLevel } = require("@azure/logger");
|
|
202
|
+
setLogLevel("info");
|
|
203
|
+
\`\`\`
|
|
204
|
+
|
|
205
|
+
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs]({{ repoURL }}/tree/main/sdk/core/logger).
|
|
206
|
+
|
|
207
|
+
{{#if samplesURL}}
|
|
208
|
+
## Next steps
|
|
209
|
+
|
|
210
|
+
Please take a look at the [samples]({{ samplesURL }}) directory for detailed examples on how to use this library.
|
|
211
|
+
{{/if}}
|
|
212
|
+
|
|
213
|
+
## Contributing
|
|
214
|
+
|
|
215
|
+
If you'd like to contribute to this library, please read the [contributing guide]({{ contributingGuideURL }}) to learn more about how to build and test the code.
|
|
216
|
+
|
|
217
|
+
## Related projects
|
|
218
|
+
|
|
219
|
+
- [{{ projectName }}]({{ repoURL }})
|
|
220
|
+
|
|
221
|
+
[azure_sub]: https://azure.microsoft.com/free/
|
|
222
|
+
[azure_portal]: https://portal.azure.com
|
|
223
|
+
{{#if identityPackageURL}}[azure_identity]: {{ identityPackageURL }}
|
|
224
|
+
{{/if}}[defaultazurecredential]: {{ identityPackageURL }}#defaultazurecredential
|
|
225
|
+
{{/if}}
|
|
226
|
+
`;
|
|
227
|
+
|
|
87
228
|
const nonBrandedReadmeTemplate = `# {{ clientDescriptiveName }} library for JavaScript
|
|
88
229
|
|
|
89
230
|
{{ description }}
|
|
@@ -114,7 +255,7 @@ Key links:
|
|
|
114
255
|
|
|
115
256
|
### Install the \`{{ clientPackageName }}\` package
|
|
116
257
|
|
|
117
|
-
Install the {{ clientDescriptiveName }}
|
|
258
|
+
Install the {{ clientDescriptiveName }} library for JavaScript with \`npm\`:
|
|
118
259
|
|
|
119
260
|
\`\`\`bash
|
|
120
261
|
npm install {{ clientPackageName }}
|
|
@@ -160,13 +301,21 @@ interface Metadata {
|
|
|
160
301
|
apiRefURL?: string;
|
|
161
302
|
/** Check if the rp is management plane */
|
|
162
303
|
azureArm?: boolean;
|
|
304
|
+
/** Whether the package being generated is for an Azure service */
|
|
305
|
+
azure: boolean;
|
|
306
|
+
/** Indicates if the package is a test/releasable package. */
|
|
307
|
+
isReleasablePackage?: boolean;
|
|
308
|
+
/** The link to the contributing guide in the repository */
|
|
309
|
+
contributingGuideURL?: string;
|
|
163
310
|
}
|
|
164
311
|
|
|
165
312
|
export function buildReadmeFile(model: RLCModel) {
|
|
166
313
|
const metadata = createMetadata(model) ?? {};
|
|
167
314
|
const readmeFileContents = hbs.compile(
|
|
168
315
|
model.options?.flavor === "azure"
|
|
169
|
-
?
|
|
316
|
+
? model.options.isModularLibrary
|
|
317
|
+
? azureReadmeModularTemplate
|
|
318
|
+
: azureReadmeRLCTemplate
|
|
170
319
|
: nonBrandedReadmeTemplate,
|
|
171
320
|
{ noEscape: true }
|
|
172
321
|
);
|
|
@@ -193,7 +342,8 @@ function createMetadata(model: RLCModel): Metadata | undefined {
|
|
|
193
342
|
dependencyInfo,
|
|
194
343
|
multiClient,
|
|
195
344
|
batch,
|
|
196
|
-
serviceInfo
|
|
345
|
+
serviceInfo,
|
|
346
|
+
isTypeSpecTest
|
|
197
347
|
} = model.options;
|
|
198
348
|
|
|
199
349
|
const azureHuh =
|
|
@@ -219,7 +369,9 @@ function createMetadata(model: RLCModel): Metadata | undefined {
|
|
|
219
369
|
serviceName,
|
|
220
370
|
clientClassName,
|
|
221
371
|
clientPackageName: clientPackageName,
|
|
222
|
-
clientDescriptiveName:
|
|
372
|
+
clientDescriptiveName: model.options.isModularLibrary
|
|
373
|
+
? `${serviceName} client`
|
|
374
|
+
: `${serviceName} REST client`,
|
|
223
375
|
description: serviceInfo?.description ?? packageDetails.description,
|
|
224
376
|
serviceDocURL: productDocLink,
|
|
225
377
|
packageSourceURL: packageSourceURL,
|
|
@@ -231,7 +383,14 @@ function createMetadata(model: RLCModel): Metadata | undefined {
|
|
|
231
383
|
dependencyDescription: dependencyInfo?.description,
|
|
232
384
|
dependencyLink: dependencyInfo?.link,
|
|
233
385
|
hasMultiClients: multiClient && batch && batch.length > 1,
|
|
234
|
-
azureArm: Boolean(model.options.azureArm)
|
|
386
|
+
azureArm: Boolean(model.options.azureArm),
|
|
387
|
+
azure: azureHuh,
|
|
388
|
+
isReleasablePackage: !isTypeSpecTest,
|
|
389
|
+
repoURL: repoURL,
|
|
390
|
+
projectName: azureHuh ? "Microsoft Azure SDK for JavaScript" : undefined,
|
|
391
|
+
identityPackageURL: repoURL && `${repoURL}/tree/main/sdk/identity/identity`,
|
|
392
|
+
addCredentials: model.options.addCredentials,
|
|
393
|
+
contributingGuideURL: repoURL && `${repoURL}/blob/main/CONTRIBUTING.md`
|
|
235
394
|
};
|
|
236
395
|
}
|
|
237
396
|
|
|
@@ -9,7 +9,7 @@ const restLevelTsConfigInAzureSdkForJs: (
|
|
|
9
9
|
) => Record<string, any> = function (model: RLCModel) {
|
|
10
10
|
if (model.options?.moduleKind === "esm") {
|
|
11
11
|
return {
|
|
12
|
-
extends: "../../../tsconfig
|
|
12
|
+
extends: "../../../tsconfig",
|
|
13
13
|
compilerOptions: {
|
|
14
14
|
module: "NodeNext",
|
|
15
15
|
moduleResolution: "NodeNext",
|
|
@@ -25,7 +25,7 @@ const restLevelTsConfigInAzureSdkForJs: (
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
return {
|
|
28
|
-
extends: "../../../tsconfig
|
|
28
|
+
extends: "../../../tsconfig",
|
|
29
29
|
compilerOptions: {
|
|
30
30
|
outDir: "./dist-esm",
|
|
31
31
|
declarationDir: "./types"
|
|
@@ -27,7 +27,8 @@ const nodeConfig = `export default defineConfig({
|
|
|
27
27
|
"provider": "istanbul",
|
|
28
28
|
"reporter": ["text", "json", "html"],
|
|
29
29
|
"reportsDirectory": "coverage"
|
|
30
|
-
}
|
|
30
|
+
},
|
|
31
|
+
testTimeout: 1200000,
|
|
31
32
|
}
|
|
32
33
|
});`;
|
|
33
34
|
|
|
@@ -68,7 +69,8 @@ export default defineConfig({
|
|
|
68
69
|
"provider": "istanbul",
|
|
69
70
|
"reporter": ["text", "json", "html"],
|
|
70
71
|
"reportsDirectory": "coverage-browser"
|
|
71
|
-
}
|
|
72
|
+
},
|
|
73
|
+
testTimeout: 1200000,
|
|
72
74
|
}
|
|
73
75
|
});`;
|
|
74
76
|
|
|
@@ -44,7 +44,7 @@ export function getAzurePackageDependencies({
|
|
|
44
44
|
if (hasLro) {
|
|
45
45
|
dependencies = {
|
|
46
46
|
...dependencies,
|
|
47
|
-
"@azure/core-lro": "3.0.0",
|
|
47
|
+
"@azure/core-lro": "^3.0.0",
|
|
48
48
|
"@azure/abort-controller": "^2.1.2"
|
|
49
49
|
};
|
|
50
50
|
}
|
|
@@ -77,7 +77,8 @@ function getAzureCjsCommonInfo({
|
|
|
77
77
|
`types/${nameWithoutScope ?? name}.d.ts`,
|
|
78
78
|
"README.md",
|
|
79
79
|
"LICENSE",
|
|
80
|
-
"review/*"
|
|
80
|
+
"review/*",
|
|
81
|
+
"CHANGELOG.md"
|
|
81
82
|
]
|
|
82
83
|
};
|
|
83
84
|
}
|
|
@@ -87,7 +88,7 @@ function getAzureEsmCommonInfo({ moduleKind }: AzurePackageInfoConfig) {
|
|
|
87
88
|
return {};
|
|
88
89
|
}
|
|
89
90
|
return {
|
|
90
|
-
files: ["dist", "README.md", "LICENSE", "review/*"]
|
|
91
|
+
files: ["dist", "README.md", "LICENSE", "review/*", "CHANGELOG.md"]
|
|
91
92
|
};
|
|
92
93
|
}
|
|
93
94
|
|
|
@@ -66,7 +66,7 @@ export function getAzureMonorepoPackageInfo(
|
|
|
66
66
|
for (const clientFilePath of config.clientFilePaths) {
|
|
67
67
|
metadata.constantPaths.push({
|
|
68
68
|
path: clientFilePath,
|
|
69
|
-
prefix: "
|
|
69
|
+
prefix: "userAgentInfo"
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -75,7 +75,7 @@ export function getAzureMonorepoPackageInfo(
|
|
|
75
75
|
return {
|
|
76
76
|
...commonPackageInfo,
|
|
77
77
|
...getAzureCommonPackageInfo(config),
|
|
78
|
-
"sdk-type": "client"
|
|
78
|
+
"sdk-type": `${config.azureArm ? "mgmt" : "client"}`,
|
|
79
79
|
repository: "github:Azure/azure-sdk-for-js",
|
|
80
80
|
bugs: {
|
|
81
81
|
url: "https://github.com/Azure/azure-sdk-for-js/issues"
|
|
@@ -194,10 +194,14 @@ function getAzureMonorepoScripts(config: AzureMonorepoInfoConfig) {
|
|
|
194
194
|
...getCommonPackageScripts(config),
|
|
195
195
|
audit:
|
|
196
196
|
"node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
|
|
197
|
-
"build:samples":
|
|
197
|
+
"build:samples": config.withSamples
|
|
198
|
+
? "dev-tool samples publish --force"
|
|
199
|
+
: "echo skipped",
|
|
198
200
|
"check-format":
|
|
199
201
|
'dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore "src/**/*.{ts,cts,mts}" "test/**/*.{ts,cts,mts}" "*.{js,cjs,mjs,json}"',
|
|
200
|
-
"execute:samples":
|
|
202
|
+
"execute:samples": config.withSamples
|
|
203
|
+
? "dev-tool samples run samples-dev"
|
|
204
|
+
: "echo skipped",
|
|
201
205
|
"extract-api":
|
|
202
206
|
"rimraf review && mkdirp ./review && dev-tool run extract-api",
|
|
203
207
|
format:
|
|
@@ -10,6 +10,7 @@ export interface PackageCommonInfoConfig {
|
|
|
10
10
|
withTests: boolean;
|
|
11
11
|
withSamples: boolean;
|
|
12
12
|
exports?: Record<string, any>;
|
|
13
|
+
azureArm?: boolean;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -45,7 +46,7 @@ export function getCommonPackageDevDependencies(
|
|
|
45
46
|
prettier: "^3.2.5",
|
|
46
47
|
rimraf: "^5.0.5",
|
|
47
48
|
mkdirp: "^3.0.1",
|
|
48
|
-
typescript: "~5.
|
|
49
|
+
typescript: "~5.5.3",
|
|
49
50
|
...getEsmDevDependencies(config)
|
|
50
51
|
};
|
|
51
52
|
}
|
|
@@ -10,6 +10,9 @@ export function buildRecordedClientFile(model: RLCModel) {
|
|
|
10
10
|
});
|
|
11
11
|
return {
|
|
12
12
|
path: "test/public/utils/recordedClient.ts",
|
|
13
|
-
content: recordedClientFileContents({
|
|
13
|
+
content: recordedClientFileContents({
|
|
14
|
+
isEsm: model.options?.moduleKind === "esm",
|
|
15
|
+
isCjs: model.options?.moduleKind === "cjs"
|
|
16
|
+
})
|
|
14
17
|
};
|
|
15
18
|
}
|
package/src/test/template.ts
CHANGED
|
@@ -127,31 +127,48 @@ module.exports = function (config) {
|
|
|
127
127
|
`;
|
|
128
128
|
|
|
129
129
|
export const recordedClientContent = `
|
|
130
|
+
|
|
131
|
+
{{#if isEsm}}
|
|
132
|
+
import {
|
|
133
|
+
Recorder,
|
|
134
|
+
RecorderStartOptions,
|
|
135
|
+
VitestTestContext,
|
|
136
|
+
} from "@azure-tools/test-recorder";
|
|
137
|
+
{{/if}}
|
|
138
|
+
|
|
139
|
+
{{#if isCjs}}
|
|
130
140
|
import { Context } from "mocha";
|
|
131
141
|
import { Recorder, RecorderStartOptions } from "@azure-tools/test-recorder";
|
|
142
|
+
{{/if}}
|
|
132
143
|
|
|
133
|
-
const
|
|
134
|
-
ENDPOINT: "https://endpoint",
|
|
135
|
-
AZURE_CLIENT_ID: "azure_client_id",
|
|
136
|
-
AZURE_CLIENT_SECRET: "azure_client_secret",
|
|
137
|
-
AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
|
|
144
|
+
const replaceableVariables: Record<string, string> = {
|
|
138
145
|
SUBSCRIPTION_ID: "azure_subscription_id"
|
|
139
146
|
};
|
|
140
147
|
|
|
141
148
|
const recorderEnvSetup: RecorderStartOptions = {
|
|
142
|
-
envSetupForPlayback
|
|
149
|
+
envSetupForPlayback: replaceableVariables,
|
|
143
150
|
};
|
|
144
151
|
|
|
145
152
|
/**
|
|
146
|
-
* creates the recorder and reads the environment variables from the \`.env\` file.
|
|
147
|
-
* Should be called first in the test suite to make sure environment variables are
|
|
148
|
-
* read before they are being used.
|
|
149
|
-
*/
|
|
153
|
+
* creates the recorder and reads the environment variables from the \`.env\` file.
|
|
154
|
+
* Should be called first in the test suite to make sure environment variables are
|
|
155
|
+
* read before they are being used.
|
|
156
|
+
*/
|
|
157
|
+
{{#if isEsm}}
|
|
158
|
+
export async function createRecorder(context: VitestTestContext): Promise<Recorder> {
|
|
159
|
+
const recorder = new Recorder(context);
|
|
160
|
+
await recorder.start(recorderEnvSetup);
|
|
161
|
+
return recorder;
|
|
162
|
+
}
|
|
163
|
+
{{/if}}
|
|
164
|
+
|
|
165
|
+
{{#if isCjs}}
|
|
150
166
|
export async function createRecorder(context: Context): Promise<Recorder> {
|
|
151
167
|
const recorder = new Recorder(context.currentTest);
|
|
152
168
|
await recorder.start(recorderEnvSetup);
|
|
153
169
|
return recorder;
|
|
154
170
|
}
|
|
171
|
+
{{/if}}
|
|
155
172
|
`;
|
|
156
173
|
|
|
157
174
|
export const sampleTestContent = `
|
|
@@ -128,7 +128,7 @@ describe("Package file generation", () => {
|
|
|
128
128
|
constantPaths: [
|
|
129
129
|
{
|
|
130
130
|
path: "src/msinternal/test.ts",
|
|
131
|
-
prefix: "
|
|
131
|
+
prefix: "userAgentInfo"
|
|
132
132
|
}
|
|
133
133
|
]
|
|
134
134
|
};
|
|
@@ -151,7 +151,7 @@ describe("Package file generation", () => {
|
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
153
|
path: "src/msinternal/test.ts",
|
|
154
|
-
prefix: "
|
|
154
|
+
prefix: "userAgentInfo"
|
|
155
155
|
}
|
|
156
156
|
]
|
|
157
157
|
};
|