Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export function transformOptions(model: CodeModel): RLCOptions {
dependencyInfo,
productDocLink,
azureArm,
flavor,
flavor
} = getAutorestOptions();
const options: RLCOptions = {};
const options: RLCOptions = { moduleKind: "cjs" };
Copy link
Copy Markdown
Member

@MaryGao MaryGao Mar 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to clarify some details, there are two main changes

  • changed to esm
  • upgrade our build/test dependencies and steps

Are the two changes coupled with each other? Will the HLC need to adopt this? I mean if HLC won't adopt, can old code run correctly in SDK repo?

options.includeShortcuts = rlcShortcut;
options.multiClient = multiClient;
options.batch = batch;
Expand All @@ -37,11 +37,8 @@ export function transformOptions(model: CodeModel): RLCOptions {
title: model.info.title ?? model.language.default.name,
description: model.info.description
};
const {
addCredentials,
credentialScopes,
credentialKeyHeaderName
} = getSecurityInfoFromModel(model.security);
const { addCredentials, credentialScopes, credentialKeyHeaderName } =
getSecurityInfoFromModel(model.security);
options.addCredentials = addCredentials;
options.credentialScopes = credentialScopes;
options.credentialKeyHeaderName = credentialKeyHeaderName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const getArmReadmes = (): SpecDefinition[] => {
"package-managedapplications-2018-06",
"package-deploymentscripts-2019-10-preview"
];
return armTags.map(tag => ({
return armTags.map((tag) => ({
path: joinPath(
`${__dirname}`,
"..",
Expand All @@ -47,10 +47,7 @@ const getArmReadmes = (): SpecDefinition[] => {
AutorestParams.NotAzureSdkForJs,
`--tag=${tag}`
]
: [
AutorestParams.NotAzureSdkForJs,
`--tag=${tag}`
],
: [AutorestParams.NotAzureSdkForJs, `--tag=${tag}`],
outputFolderName: `arm-${tag}`,
buildTag: "ci_1"
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("BodyComplex Rest Client", () => {
});

describe("Swagger Complex Type BAT", () => {
describe("Basic Types Operations", function() {
describe("Basic Types Operations", function () {
it("should get and put valid basic type properties", async () => {
const result = await client.path("/complex/basic/valid").get();
try {
Expand Down Expand Up @@ -98,12 +98,13 @@ describe("BodyComplex Rest Client", () => {
});
});

describe("Primitive Types Operations", function() {
describe("Primitive Types Operations", function () {
it("should handle getComplexPolymorphismDotSyntax", async () => {
const result = await client.path("/complex/primitive/double").put({
body: {
field1: 3e-100,
field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose: -5e-57
field_56_zeros_after_the_dot_and_negative_zero_before_dot_and_this_is_a_long_field_name_on_purpose:
-5e-57
}
});

Expand Down Expand Up @@ -301,7 +302,7 @@ describe("BodyComplex Rest Client", () => {
assert.equal(resultPut.status, "200");
});

it("should get and put valid duration properties", async function() {
it("should get and put valid duration properties", async function () {
const durationString = "P123DT22H14M12.011S";
const result = await client.path("/complex/primitive/duration").get();

Expand Down Expand Up @@ -345,7 +346,7 @@ describe("BodyComplex Rest Client", () => {
});
});

describe("Array Types Operations", function() {
describe("Array Types Operations", function () {
it("should get valid array type properties", async () => {
const testArray: string[] = [
"1, 2, 3, 4",
Expand Down Expand Up @@ -399,7 +400,7 @@ describe("BodyComplex Rest Client", () => {
});
});

describe("Dictionary Types Operations", function() {
describe("Dictionary Types Operations", function () {
it("should get and put valid dictionary type properties", async () => {
const testDictionary: { [propertyName: string]: any } = {
txt: "notepad",
Expand Down Expand Up @@ -472,7 +473,7 @@ describe("BodyComplex Rest Client", () => {
});
});

describe("Complex Types with Inheritance Operations", function() {
describe("Complex Types with Inheritance Operations", function () {
const siamese: Siamese = {
breed: "persian",
color: "green",
Expand Down Expand Up @@ -501,7 +502,7 @@ describe("BodyComplex Rest Client", () => {
});
});

describe("Complex Types with ReadOnly Properties", function() {
describe("Complex Types with ReadOnly Properties", function () {
it("should get and put complex types with readonly properties", async () => {
const result = await client
.path("/complex/readonlyproperty/valid")
Expand All @@ -523,7 +524,7 @@ describe("BodyComplex Rest Client", () => {
});
});

describe("Complex Types with Polymorphism Operations", function() {
describe("Complex Types with Polymorphism Operations", function () {
function isSawShark(fish: FishOutput): fish is SawsharkOutput {
return fish.fishtype === "sawshark";
}
Expand Down Expand Up @@ -686,7 +687,7 @@ describe("BodyComplex Rest Client", () => {
]);
});

it("should get valid polymorphic properties", async function() {
it("should get valid polymorphic properties", async function () {
const result = await client.path("/complex/polymorphism/valid").get();

if (isUnexpected(result)) {
Expand Down Expand Up @@ -748,7 +749,7 @@ describe("BodyComplex Rest Client", () => {
assert.equal(resultPut.status, "200");
});

it("should throw when required fields are omitted from polymorphic types", async function() {
it("should throw when required fields are omitted from polymorphic types", async function () {
const badFish = {
fishtype: "sawshark",
species: "snaggle toothed",
Expand Down Expand Up @@ -854,7 +855,7 @@ describe("BodyComplex Rest Client", () => {
siblings: outputSiblings
};

it("should get complicated polymorphic types", async function() {
it("should get complicated polymorphic types", async function () {
const result = await client
.path("/complex/polymorphism/complicated")
.get();
Expand All @@ -875,15 +876,15 @@ describe("BodyComplex Rest Client", () => {
assert.deepEqual(result.body, outputSalmon);
});

it("should put complicated polymorphic types", async function() {
it("should put complicated polymorphic types", async function () {
const result = await client
.path("/complex/polymorphism/complicated")
.put({ body: inputSalmon });

assert.equal(result.status, "200");
});

it("should put polymorphic types missing discriminator", async function() {
it("should put polymorphic types missing discriminator", async function () {
const regularSalmon = {
fishtype: "salmon",
location: "alaska",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"name": "@msinternal/body-complex-rest",
"sdk-type": "client",
"author": "Microsoft Corporation",
"version": "1.0.0-preview1",
"description": "A generated SDK for BodyComplexRestClient.",
"keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"],
"license": "MIT",
"engines": {
"node": ">=18.0.0"
},
"sideEffects": false,
"autoPublish": false,
"main": "dist/index.js",
"module": "./dist-esm/index.js",
"types": "./types/body-complex-rest.d.ts",
"repository": "github:Azure/azure-sdk-for-js",
"bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" },
"keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"],
"author": "Microsoft Corporation",
"license": "MIT",
"files": [
"dist/",
"dist-esm/",
Expand All @@ -19,60 +21,41 @@
"LICENSE",
"review/*"
],
"engines": { "node": ">=18.0.0" },
"scripts": {
"build:browser": "echo skipped.",
"build:node": "echo skipped.",
"build:samples": "echo skipped.",
"build:test": "echo skipped.",
"build:debug": "echo skipped.",
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"*.{js,json}\" ",
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
"execute:samples": "echo skipped",
"extract-api": "rimraf review && mkdirp ./review && api-extractor run --local",
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"*.{js,json}\" ",
"generate:client": "autorest --typescript swagger/README.md && npm run format",
"integration-test:browser": "echo skipped",
"integration-test:node": "echo skipped",
"integration-test": "echo skipped",
"lint:fix": "eslint package.json api-extractor.json src --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json src --ext .ts",
"pack": "npm pack 2>&1",
"test:browser": "echo skipped",
"test:node": "echo skipped",
"test": "echo \"Error: no test specified\" && exit 1",
"unit-test": "echo skipped",
"unit-test:node": "echo skipped",
"unit-test:browser": "echo skipped",
"build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api",
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js"
},
"sideEffects": false,
"autoPublish": false,
"dependencies": {
"@azure/core-auth": "^1.6.0",
"@azure-rest/core-client": "^1.2.0",
"@azure/core-rest-pipeline": "^1.14.0",
"@azure/core-auth": "^1.6.0",
"@azure/core-rest-pipeline": "^1.5.0",
"@azure/logger": "^1.0.0",
"tslib": "^2.2.0"
"tslib": "^2.6.2"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.31.1",
"autorest": "latest",
"@types/node": "^18.0.0",
"dotenv": "^16.0.0",
"eslint": "^8.0.0",
"@microsoft/api-extractor": "^7.40.3",
"@types/node": "^18.0.0",
"eslint": "^8.55.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"mkdirp": "^2.1.2",
"prettier": "^3.1.0",
"rimraf": "^5.0.0",
"source-map-support": "^0.5.9",
"typescript": "~5.3.3",
"autorest": "latest",
"source-map-support": "^0.5.9",
"uglify-js": "^3.4.9",
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-multi-entry": "^6.0.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"rollup": "^2.66.1",
"rollup-plugin-sourcemaps": "^0.6.3",
"uglify-js": "^3.4.9"
"rollup-plugin-sourcemaps": "^0.6.3"
},
"scripts": {
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
"extract-api": "rimraf review && mkdirp ./review && api-extractor run --local",
"pack": "npm pack 2>&1",
"lint": "eslint package.json api-extractor.json src --ext .ts",
"lint:fix": "eslint package.json api-extractor.json src --ext .ts --fix --fix-type [problem,suggestion]",
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"*.{js,json}\" \"test/**/*.ts\" \"samples-dev/**/*.ts\"",
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"*.{js,json}\" \"test/**/*.ts\" \"samples-dev/**/*.ts\"",
"build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api",
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js"
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"name": "@msinternal/body-file",
"sdk-type": "client",
"author": "Microsoft Corporation",
"version": "1.0.0-preview1",
"description": "A generated SDK for BodyFile.",
"keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"],
"license": "MIT",
"engines": {
"node": ">=18.0.0"
},
"sideEffects": false,
"autoPublish": false,
"main": "dist/index.js",
"module": "./dist-esm/index.js",
"types": "./types/body-file.d.ts",
"repository": "github:Azure/azure-sdk-for-js",
"bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" },
"keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"],
"author": "Microsoft Corporation",
"license": "MIT",
"files": [
"dist/",
"dist-esm/",
Expand All @@ -19,60 +21,41 @@
"LICENSE",
"review/*"
],
"engines": { "node": ">=18.0.0" },
"scripts": {
"build:browser": "echo skipped.",
"build:node": "echo skipped.",
"build:samples": "echo skipped.",
"build:test": "echo skipped.",
"build:debug": "echo skipped.",
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"*.{js,json}\" ",
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
"execute:samples": "echo skipped",
"extract-api": "rimraf review && mkdirp ./review && api-extractor run --local",
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"*.{js,json}\" ",
"generate:client": "autorest --typescript swagger/README.md && npm run format",
"integration-test:browser": "echo skipped",
"integration-test:node": "echo skipped",
"integration-test": "echo skipped",
"lint:fix": "eslint package.json api-extractor.json src --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json src --ext .ts",
"pack": "npm pack 2>&1",
"test:browser": "echo skipped",
"test:node": "echo skipped",
"test": "echo \"Error: no test specified\" && exit 1",
"unit-test": "echo skipped",
"unit-test:node": "echo skipped",
"unit-test:browser": "echo skipped",
"build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api",
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js"
},
"sideEffects": false,
"autoPublish": false,
"dependencies": {
"@azure/core-auth": "^1.6.0",
"@azure-rest/core-client": "^1.2.0",
"@azure/core-rest-pipeline": "^1.14.0",
"@azure/core-auth": "^1.6.0",
"@azure/core-rest-pipeline": "^1.5.0",
"@azure/logger": "^1.0.0",
"tslib": "^2.2.0"
"tslib": "^2.6.2"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.31.1",
"autorest": "latest",
"@types/node": "^18.0.0",
"dotenv": "^16.0.0",
"eslint": "^8.0.0",
"@microsoft/api-extractor": "^7.40.3",
"@types/node": "^18.0.0",
"eslint": "^8.55.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"mkdirp": "^2.1.2",
"prettier": "^3.1.0",
"rimraf": "^5.0.0",
"source-map-support": "^0.5.9",
"typescript": "~5.3.3",
"autorest": "latest",
"source-map-support": "^0.5.9",
"uglify-js": "^3.4.9",
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-multi-entry": "^6.0.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"rollup": "^2.66.1",
"rollup-plugin-sourcemaps": "^0.6.3",
"uglify-js": "^3.4.9"
"rollup-plugin-sourcemaps": "^0.6.3"
},
"scripts": {
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
"extract-api": "rimraf review && mkdirp ./review && api-extractor run --local",
"pack": "npm pack 2>&1",
"lint": "eslint package.json api-extractor.json src --ext .ts",
"lint:fix": "eslint package.json api-extractor.json src --ext .ts --fix --fix-type [problem,suggestion]",
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"*.{js,json}\" \"test/**/*.ts\" \"samples-dev/**/*.ts\"",
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"*.{js,json}\" \"test/**/*.ts\" \"samples-dev/**/*.ts\"",
"build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api",
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js"
}
}
Loading