Skip to content

Commit e05d84b

Browse files
v-jiaodiMaryGaoMary Gao
authored
Fix the missing parameters in operation options (#3502)
* fix issue #3501 * add ut * update * revert change * update * format * update ut * revert * fix * Update the test cases and remove useless codes --------- Co-authored-by: Mary Gao <yanmeigao1210@gmail.com> Co-authored-by: Mary Gao <marygao@microsoft.com>
1 parent 3029c64 commit e05d84b

25 files changed

Lines changed: 1093 additions & 9 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) Microsoft Corporation.
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Azure KeyVault client library for JavaScript
2+
3+
This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure KeyVault client.
4+
5+
Azure Key Vault Secrets
6+
7+
Key links:
8+
9+
- [Package (NPM)](https://www.npmjs.com/package/@azure/keyvault-secrets)
10+
- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/keyvault-secrets?view=azure-node-preview)
11+
12+
## Getting started
13+
14+
### Currently supported environments
15+
16+
- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
17+
- Latest versions of Safari, Chrome, Edge and Firefox.
18+
19+
See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
20+
21+
### Prerequisites
22+
23+
- An [Azure subscription][azure_sub].
24+
25+
### Install the `@azure/keyvault-secrets` package
26+
27+
Install the Azure KeyVault client library for JavaScript with `npm`:
28+
29+
```bash
30+
npm install @azure/keyvault-secrets
31+
```
32+
33+
34+
35+
### JavaScript Bundle
36+
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).
37+
38+
## Key concepts
39+
40+
### KeyVaultClient
41+
42+
`KeyVaultClient` is the primary interface for developers using the Azure KeyVault client library. Explore the methods on this client object to understand the different features of the Azure KeyVault service that you can access.
43+
44+
## Troubleshooting
45+
46+
### Logging
47+
48+
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`:
49+
50+
```ts
51+
import { setLogLevel } from "@azure/logger";
52+
53+
setLogLevel("info");
54+
```
55+
56+
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).
57+
58+
59+
## Contributing
60+
61+
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
62+
63+
## Related projects
64+
65+
- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
66+
67+
[azure_sub]: https://azure.microsoft.com/free/
68+
[azure_portal]: https://portal.azure.com
69+
[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity
70+
[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
"mainEntryPointFilePath": "dist/esm/index.d.ts",
4+
"docModel": { "enabled": true },
5+
"apiReport": { "enabled": true, "reportFolder": "./review" },
6+
"dtsRollup": {
7+
"enabled": true,
8+
"untrimmedFilePath": "",
9+
"publicTrimmedFilePath": "dist/keyvault-secrets.d.ts"
10+
},
11+
"messages": {
12+
"tsdocMessageReporting": { "default": { "logLevel": "none" } },
13+
"extractorMessageReporting": {
14+
"ae-missing-release-tag": { "logLevel": "none" },
15+
"ae-unresolved-link": { "logLevel": "none" }
16+
}
17+
}
18+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import azsdkEslint from "@azure/eslint-plugin-azure-sdk";
2+
3+
export default azsdkEslint.config([
4+
{
5+
rules: {
6+
"@azure/azure-sdk/ts-modules-only-named": "warn",
7+
"@azure/azure-sdk/ts-package-json-types": "warn",
8+
"@azure/azure-sdk/ts-package-json-engine-is-present": "warn",
9+
"@azure/azure-sdk/ts-package-json-files-required": "off",
10+
"@azure/azure-sdk/ts-package-json-main-is-cjs": "off",
11+
"tsdoc/syntax": "warn"
12+
}
13+
}
14+
]);
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"name": "@azure/keyvault-secrets",
3+
"version": "1.0.0-beta.1",
4+
"description": "Azure Key Vault Secrets",
5+
"engines": {
6+
"node": ">=20.0.0"
7+
},
8+
"sideEffects": false,
9+
"autoPublish": false,
10+
"tshy": {
11+
"exports": {
12+
"./package.json": "./package.json",
13+
".": "./src/index.ts",
14+
"./api": "./src/api/index.ts"
15+
},
16+
"dialects": [
17+
"esm",
18+
"commonjs"
19+
],
20+
"esmDialects": [
21+
"browser",
22+
"react-native"
23+
],
24+
"selfLink": false
25+
},
26+
"type": "module",
27+
"browser": "./dist/browser/index.js",
28+
"react-native": "./dist/react-native/index.js",
29+
"keywords": [
30+
"node",
31+
"azure",
32+
"cloud",
33+
"typescript",
34+
"browser",
35+
"isomorphic"
36+
],
37+
"author": "Microsoft Corporation",
38+
"license": "MIT",
39+
"files": [
40+
"dist/",
41+
"!dist/**/*.d.*ts.map",
42+
"README.md",
43+
"LICENSE"
44+
],
45+
"dependencies": {
46+
"@azure/core-util": "^1.9.2",
47+
"@azure-rest/core-client": "^2.3.1",
48+
"@azure/core-auth": "^1.6.0",
49+
"@azure/core-rest-pipeline": "^1.5.0",
50+
"@azure/logger": "^1.0.0",
51+
"tslib": "^2.6.2"
52+
},
53+
"devDependencies": {
54+
"dotenv": "^16.0.0",
55+
"@types/node": "^20.0.0",
56+
"eslint": "^9.9.0",
57+
"typescript": "~5.8.2",
58+
"tshy": "^2.0.0",
59+
"@microsoft/api-extractor": "^7.40.3",
60+
"rimraf": "^5.0.5",
61+
"mkdirp": "^3.0.1"
62+
},
63+
"scripts": {
64+
"clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log",
65+
"extract-api": "rimraf review && mkdirp ./review && api-extractor run --local",
66+
"pack": "npm pack 2>&1",
67+
"lint": "eslint package.json api-extractor.json src",
68+
"lint:fix": "eslint package.json api-extractor.json src --fix --fix-type [problem,suggestion]",
69+
"build": "npm run clean && tshy && npm run extract-api"
70+
},
71+
"exports": {
72+
"./package.json": "./package.json",
73+
".": {
74+
"browser": {
75+
"types": "./dist/browser/index.d.ts",
76+
"default": "./dist/browser/index.js"
77+
},
78+
"react-native": {
79+
"types": "./dist/react-native/index.d.ts",
80+
"default": "./dist/react-native/index.js"
81+
},
82+
"import": {
83+
"types": "./dist/esm/index.d.ts",
84+
"default": "./dist/esm/index.js"
85+
},
86+
"require": {
87+
"types": "./dist/commonjs/index.d.ts",
88+
"default": "./dist/commonjs/index.js"
89+
}
90+
},
91+
"./api": {
92+
"browser": {
93+
"types": "./dist/browser/api/index.d.ts",
94+
"default": "./dist/browser/api/index.js"
95+
},
96+
"react-native": {
97+
"types": "./dist/react-native/api/index.d.ts",
98+
"default": "./dist/react-native/api/index.js"
99+
},
100+
"import": {
101+
"types": "./dist/esm/api/index.d.ts",
102+
"default": "./dist/esm/api/index.js"
103+
},
104+
"require": {
105+
"types": "./dist/commonjs/api/index.d.ts",
106+
"default": "./dist/commonjs/api/index.js"
107+
}
108+
}
109+
},
110+
"main": "./dist/commonjs/index.js",
111+
"types": "./dist/commonjs/index.d.ts",
112+
"module": "./dist/esm/index.js"
113+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## API Report File for "@azure/keyvault-secrets"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
import { ClientOptions } from '@azure-rest/core-client';
8+
import { OperationOptions } from '@azure-rest/core-client';
9+
import { Pipeline } from '@azure/core-rest-pipeline';
10+
11+
// @public
12+
export interface GetSecretOptionalParams extends OperationOptions {
13+
}
14+
15+
// @public (undocumented)
16+
export class KeyVaultClient {
17+
constructor(endpointParam: string, apiVersion: string, options?: KeyVaultClientOptionalParams);
18+
getSecret(secretName: string, secretVersion: string, options?: GetSecretOptionalParams): Promise<void>;
19+
readonly pipeline: Pipeline;
20+
}
21+
22+
// @public
23+
export interface KeyVaultClientOptionalParams extends ClientOptions {
24+
}
25+
26+
// (No @packageDocumentation comment for this package)
27+
28+
```
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
import nodeResolve from "@rollup/plugin-node-resolve";
5+
import cjs from "@rollup/plugin-commonjs";
6+
import sourcemaps from "rollup-plugin-sourcemaps";
7+
import multiEntry from "@rollup/plugin-multi-entry";
8+
import json from "@rollup/plugin-json";
9+
10+
import nodeBuiltins from "builtin-modules";
11+
12+
// #region Warning Handler
13+
14+
/**
15+
* A function that can determine whether a rollup warning should be ignored. If
16+
* the function returns `true`, then the warning will not be displayed.
17+
*/
18+
19+
function ignoreNiseSinonEval(warning) {
20+
return (
21+
warning.code === "EVAL" &&
22+
warning.id &&
23+
(warning.id.includes("node_modules/nise") ||
24+
warning.id.includes("node_modules/sinon")) === true
25+
);
26+
}
27+
28+
function ignoreChaiCircularDependency(warning) {
29+
return (
30+
warning.code === "CIRCULAR_DEPENDENCY" &&
31+
warning.importer &&
32+
warning.importer.includes("node_modules/chai") === true
33+
);
34+
}
35+
36+
const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval];
37+
38+
/**
39+
* Construct a warning handler for the shared rollup configuration
40+
* that ignores certain warnings that are not relevant to testing.
41+
*/
42+
function makeOnWarnForTesting() {
43+
return (warning, warn) => {
44+
// If every inhibitor returns false (i.e. no inhibitors), then show the warning
45+
if (warningInhibitors.every((inhib) => !inhib(warning))) {
46+
warn(warning);
47+
}
48+
};
49+
}
50+
51+
// #endregion
52+
53+
function makeBrowserTestConfig() {
54+
const config = {
55+
input: {
56+
include: ["dist-esm/test/**/*.spec.js"],
57+
exclude: ["dist-esm/test/**/node/**"],
58+
},
59+
output: {
60+
file: `dist-test/index.browser.js`,
61+
format: "umd",
62+
sourcemap: true,
63+
},
64+
preserveSymlinks: false,
65+
plugins: [
66+
multiEntry({ exports: false }),
67+
nodeResolve({
68+
mainFields: ["module", "browser"],
69+
}),
70+
cjs(),
71+
json(),
72+
sourcemaps(),
73+
//viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
74+
],
75+
onwarn: makeOnWarnForTesting(),
76+
// Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0,
77+
// rollup started respecting the "sideEffects" field in package.json. Since
78+
// our package.json sets "sideEffects=false", this also applies to test
79+
// code, which causes all tests to be removed by tree-shaking.
80+
treeshake: false,
81+
};
82+
83+
return config;
84+
}
85+
86+
const defaultConfigurationOptions = {
87+
disableBrowserBundle: false,
88+
};
89+
90+
export function makeConfig(pkg, options) {
91+
options = {
92+
...defaultConfigurationOptions,
93+
...(options || {}),
94+
};
95+
96+
const baseConfig = {
97+
// Use the package's module field if it has one
98+
input: pkg["module"] || "dist-esm/src/index.js",
99+
external: [
100+
...nodeBuiltins,
101+
...Object.keys(pkg.dependencies),
102+
...Object.keys(pkg.devDependencies),
103+
],
104+
output: { file: "dist/index.js", format: "cjs", sourcemap: true },
105+
preserveSymlinks: false,
106+
plugins: [sourcemaps(), nodeResolve()],
107+
};
108+
109+
const config = [baseConfig];
110+
111+
if (!options.disableBrowserBundle) {
112+
config.push(makeBrowserTestConfig());
113+
}
114+
115+
return config;
116+
}
117+
118+
export default makeConfig(require("./package.json"));
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Feel free to add your own environment variables.

0 commit comments

Comments
 (0)