@azure/arm-deviceprovisioningservices 5.0.0 → 5.0.1

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.
@@ -6,24 +6,22 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
  import { __awaiter } from "tslib";
9
- import { record } from "@azure-tools/test-recorder";
10
- const recorderEnvSetup = {
11
- replaceableVariables: {
12
- AZURE_CLIENT_ID: "azure_client_id",
13
- AZURE_CLIENT_SECRET: "azure_client_secret",
14
- AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
15
- SUBSCRIPTION_ID: "azure_subscription_id"
16
- },
17
- customizationsOnRecordings: [
18
- (recording) => recording.replace(/"access_token":"[^"]*"/g, `"access_token":"access_token"`)
19
- ],
20
- queryParametersToSkip: []
9
+ import { Recorder } from "@azure-tools/test-recorder";
10
+ const replaceableVariables = {
11
+ AZURE_CLIENT_ID: "azure_client_id",
12
+ AZURE_CLIENT_SECRET: "azure_client_secret",
13
+ AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
14
+ SUBSCRIPTION_ID: "azure_subscription_id"
15
+ };
16
+ const recorderOptions = {
17
+ envSetupForPlayback: replaceableVariables
21
18
  };
22
19
  describe("My test", () => {
23
20
  let recorder;
24
21
  beforeEach(function () {
25
22
  return __awaiter(this, void 0, void 0, function* () {
26
- recorder = record(this, recorderEnvSetup);
23
+ recorder = new Recorder(this.currentTest);
24
+ yield recorder.start(recorderOptions);
27
25
  });
28
26
  });
29
27
  afterEach(function () {
@@ -1 +1 @@
1
- {"version":3,"file":"sampleTest.js","sourceRoot":"","sources":["../../test/sampleTest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAEH,OAAO,EAEL,MAAM,EAGP,MAAM,4BAA4B,CAAC;AAGpC,MAAM,gBAAgB,GAA6B;IACjD,oBAAoB,EAAE;QACpB,eAAe,EAAE,iBAAiB;QAClC,mBAAmB,EAAE,qBAAqB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EH,SAAS,CAAC;;YACR,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC;KAAA,CAAC,CAAC;IAEH,EAAE,CAAC,aAAa,EAAE;;YAChB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACjC,CAAC;KAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "sdk-type": "mgmt",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "A generated SDK for IotDpsClient.",
6
- "version": "5.0.0",
6
+ "version": "5.0.1",
7
7
  "engines": {
8
8
  "node": ">=12.0.0"
9
9
  },
@@ -28,7 +28,7 @@
28
28
  "module": "./dist-esm/src/index.js",
29
29
  "types": "./types/arm-deviceprovisioningservices.d.ts",
30
30
  "devDependencies": {
31
- "@microsoft/api-extractor": "^7.18.11",
31
+ "@microsoft/api-extractor": "7.18.11",
32
32
  "@rollup/plugin-commonjs": "^21.0.1",
33
33
  "@rollup/plugin-json": "^4.1.0",
34
34
  "@rollup/plugin-multi-entry": "^4.1.0",
@@ -40,9 +40,13 @@
40
40
  "uglify-js": "^3.4.9",
41
41
  "rimraf": "^3.0.0",
42
42
  "@azure/identity": "^2.0.1",
43
- "@azure-tools/test-recorder": "^1.0.0",
43
+ "@azure-tools/test-recorder": "^2.0.0",
44
+ "@azure-tools/test-credential": "^1.0.0",
44
45
  "mocha": "^7.1.1",
45
- "cross-env": "^7.0.2"
46
+ "@types/chai": "^4.2.8",
47
+ "chai": "^4.2.0",
48
+ "cross-env": "^7.0.2",
49
+ "@azure/dev-tool": "^1.0.0"
46
50
  },
47
51
  "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/deviceprovisioningservices/arm-deviceprovisioningservices",
48
52
  "repository": {
@@ -93,7 +97,7 @@
93
97
  "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node",
94
98
  "unit-test:browser": "echo skipped",
95
99
  "integration-test": "npm run integration-test:node && npm run integration-test:browser",
96
- "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js",
100
+ "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'",
97
101
  "integration-test:browser": "echo skipped",
98
102
  "docs": "echo skipped"
99
103
  },
@@ -107,4 +111,4 @@
107
111
  ]
108
112
  },
109
113
  "autoPublish": true
110
- }
114
+ }
@@ -8,6 +8,11 @@
8
8
 
9
9
  import * as coreClient from "@azure/core-client";
10
10
  import * as coreRestPipeline from "@azure/core-rest-pipeline";
11
+ import {
12
+ PipelineRequest,
13
+ PipelineResponse,
14
+ SendRequest
15
+ } from "@azure/core-rest-pipeline";
11
16
  import * as coreAuth from "@azure/core-auth";
12
17
  import {
13
18
  OperationsImpl,
@@ -53,7 +58,7 @@ export class IotDpsClient extends coreClient.ServiceClient {
53
58
  credential: credentials
54
59
  };
55
60
 
56
- const packageDetails = `azsdk-js-arm-deviceprovisioningservices/5.0.0`;
61
+ const packageDetails = `azsdk-js-arm-deviceprovisioningservices/5.0.1`;
57
62
  const userAgentPrefix =
58
63
  options.userAgentOptions && options.userAgentOptions.userAgentPrefix
59
64
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
@@ -104,6 +109,35 @@ export class IotDpsClient extends coreClient.ServiceClient {
104
109
  this.operations = new OperationsImpl(this);
105
110
  this.dpsCertificate = new DpsCertificateImpl(this);
106
111
  this.iotDpsResource = new IotDpsResourceImpl(this);
112
+ this.addCustomApiVersionPolicy(options.apiVersion);
113
+ }
114
+
115
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
116
+ private addCustomApiVersionPolicy(apiVersion?: string) {
117
+ if (!apiVersion) {
118
+ return;
119
+ }
120
+ const apiVersionPolicy = {
121
+ name: "CustomApiVersionPolicy",
122
+ async sendRequest(
123
+ request: PipelineRequest,
124
+ next: SendRequest
125
+ ): Promise<PipelineResponse> {
126
+ const param = request.url.split("?");
127
+ if (param.length > 1) {
128
+ const newParams = param[1].split("&").map((item) => {
129
+ if (item.indexOf("api-version") > -1) {
130
+ return item.replace(/(?<==).*$/, apiVersion);
131
+ } else {
132
+ return item;
133
+ }
134
+ });
135
+ request.url = param[0] + "?" + newParams.join("&");
136
+ }
137
+ return next(request);
138
+ }
139
+ };
140
+ this.pipeline.addPolicy(apiVersionPolicy);
107
141
  }
108
142
 
109
143
  operations: Operations;
@@ -365,6 +365,8 @@ export declare class IotDpsClient extends coreClient.ServiceClient {
365
365
  * @param options The parameter options
366
366
  */
367
367
  constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: IotDpsClientOptionalParams);
368
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
369
+ private addCustomApiVersionPolicy;
368
370
  operations: Operations;
369
371
  dpsCertificate: DpsCertificate;
370
372
  iotDpsResource: IotDpsResource;
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.22.1"
8
+ "packageVersion": "7.18.11"
9
9
  }
10
10
  ]
11
11
  }