@azure/arm-healthbot 2.0.1-alpha.20221128.1 → 2.1.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +7 -5
  2. package/dist/index.js +140 -40
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.min.js +1 -1
  5. package/dist/index.min.js.map +1 -1
  6. package/dist-esm/src/healthbotClient.d.ts +2 -0
  7. package/dist-esm/src/healthbotClient.d.ts.map +1 -1
  8. package/dist-esm/src/healthbotClient.js +49 -18
  9. package/dist-esm/src/healthbotClient.js.map +1 -1
  10. package/dist-esm/src/index.d.ts +1 -0
  11. package/dist-esm/src/index.d.ts.map +1 -1
  12. package/dist-esm/src/index.js +1 -0
  13. package/dist-esm/src/index.js.map +1 -1
  14. package/dist-esm/src/models/index.d.ts +8 -4
  15. package/dist-esm/src/models/index.d.ts.map +1 -1
  16. package/dist-esm/src/models/index.js +4 -0
  17. package/dist-esm/src/models/index.js.map +1 -1
  18. package/dist-esm/src/operations/bots.d.ts.map +1 -1
  19. package/dist-esm/src/operations/bots.js +37 -14
  20. package/dist-esm/src/operations/bots.js.map +1 -1
  21. package/dist-esm/src/operations/operations.d.ts.map +1 -1
  22. package/dist-esm/src/operations/operations.js +19 -7
  23. package/dist-esm/src/operations/operations.js.map +1 -1
  24. package/dist-esm/src/pagingHelper.d.ts +13 -0
  25. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  26. package/dist-esm/src/pagingHelper.js +32 -0
  27. package/dist-esm/src/pagingHelper.js.map +1 -0
  28. package/dist-esm/test/sampleTest.js +11 -13
  29. package/dist-esm/test/sampleTest.js.map +1 -1
  30. package/package.json +13 -9
  31. package/review/arm-healthbot.api.md +9 -10
  32. package/src/healthbotClient.ts +60 -20
  33. package/src/index.ts +1 -0
  34. package/src/models/index.ts +8 -4
  35. package/src/operations/bots.ts +46 -17
  36. package/src/operations/operations.ts +21 -8
  37. package/src/pagingHelper.ts +39 -0
  38. package/types/arm-healthbot.d.ts +19 -4
package/CHANGELOG.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # Release History
2
-
3
- ## 2.0.1 (2022-04-26)
4
-
2
+
3
+ ## 2.1.0 (2022-11-25)
4
+
5
5
  **Features**
6
6
 
7
- - Bug fix
8
-
7
+ - Added Interface HealthBot
8
+ - Added Interface TrackedResource
9
+
10
+
9
11
  ## 2.0.0 (2022-01-13)
10
12
 
11
13
  The package of @azure/arm-healthbot is using our next generation design principles since version 2.0.0, which contains breaking changes.
package/dist/index.js CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var tslib = require('tslib');
5
6
  var coreClient = require('@azure/core-client');
6
7
  var coreRestPipeline = require('@azure/core-rest-pipeline');
7
- var tslib = require('tslib');
8
8
  var coreLro = require('@azure/core-lro');
9
9
 
10
10
  function _interopNamespace(e) {
@@ -28,6 +28,38 @@ function _interopNamespace(e) {
28
28
  var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
29
29
  var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipeline);
30
30
 
31
+ /*
32
+ * Copyright (c) Microsoft Corporation.
33
+ * Licensed under the MIT License.
34
+ *
35
+ * Code generated by Microsoft (R) AutoRest Code Generator.
36
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
37
+ */
38
+ const pageMap = new WeakMap();
39
+ /**
40
+ * Given a result page from a pageable operation, returns a
41
+ * continuation token that can be used to begin paging from
42
+ * that point later.
43
+ * @param page A result object from calling .byPage() on a paged operation.
44
+ * @returns The continuation token that can be passed into byPage().
45
+ */
46
+ function getContinuationToken(page) {
47
+ var _a;
48
+ if (typeof page !== "object" || page === null) {
49
+ return undefined;
50
+ }
51
+ return (_a = pageMap.get(page)) === null || _a === void 0 ? void 0 : _a.continuationToken;
52
+ }
53
+ function setContinuationToken(page, continuationToken) {
54
+ var _a;
55
+ if (typeof page !== "object" || page === null || !continuationToken) {
56
+ return;
57
+ }
58
+ const pageInfo = (_a = pageMap.get(page)) !== null && _a !== void 0 ? _a : {};
59
+ pageInfo.continuationToken = continuationToken;
60
+ pageMap.set(page, pageInfo);
61
+ }
62
+
31
63
  /*
32
64
  * Copyright (c) Microsoft Corporation.
33
65
  * Licensed under the MIT License.
@@ -38,9 +70,13 @@ var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipelin
38
70
  /** Known values of {@link IdentityType} that the service accepts. */
39
71
  exports.KnownIdentityType = void 0;
40
72
  (function (KnownIdentityType) {
73
+ /** User */
41
74
  KnownIdentityType["User"] = "User";
75
+ /** Application */
42
76
  KnownIdentityType["Application"] = "Application";
77
+ /** ManagedIdentity */
43
78
  KnownIdentityType["ManagedIdentity"] = "ManagedIdentity";
79
+ /** Key */
44
80
  KnownIdentityType["Key"] = "Key";
45
81
  })(exports.KnownIdentityType || (exports.KnownIdentityType = {}));
46
82
 
@@ -738,20 +774,31 @@ class BotsImpl {
738
774
  [Symbol.asyncIterator]() {
739
775
  return this;
740
776
  },
741
- byPage: () => {
742
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
777
+ byPage: (settings) => {
778
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
779
+ throw new Error("maxPageSize is not supported by this operation.");
780
+ }
781
+ return this.listByResourceGroupPagingPage(resourceGroupName, options, settings);
743
782
  }
744
783
  };
745
784
  }
746
- listByResourceGroupPagingPage(resourceGroupName, options) {
785
+ listByResourceGroupPagingPage(resourceGroupName, options, settings) {
747
786
  return tslib.__asyncGenerator(this, arguments, function* listByResourceGroupPagingPage_1() {
748
- let result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
749
- yield yield tslib.__await(result.value || []);
750
- let continuationToken = result.nextLink;
787
+ let result;
788
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
789
+ if (!continuationToken) {
790
+ result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
791
+ let page = result.value || [];
792
+ continuationToken = result.nextLink;
793
+ setContinuationToken(page, continuationToken);
794
+ yield yield tslib.__await(page);
795
+ }
751
796
  while (continuationToken) {
752
797
  result = yield tslib.__await(this._listByResourceGroupNext(resourceGroupName, continuationToken, options));
753
798
  continuationToken = result.nextLink;
754
- yield yield tslib.__await(result.value || []);
799
+ let page = result.value || [];
800
+ setContinuationToken(page, continuationToken);
801
+ yield yield tslib.__await(page);
755
802
  }
756
803
  });
757
804
  }
@@ -786,20 +833,31 @@ class BotsImpl {
786
833
  [Symbol.asyncIterator]() {
787
834
  return this;
788
835
  },
789
- byPage: () => {
790
- return this.listPagingPage(options);
836
+ byPage: (settings) => {
837
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
838
+ throw new Error("maxPageSize is not supported by this operation.");
839
+ }
840
+ return this.listPagingPage(options, settings);
791
841
  }
792
842
  };
793
843
  }
794
- listPagingPage(options) {
844
+ listPagingPage(options, settings) {
795
845
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
796
- let result = yield tslib.__await(this._list(options));
797
- yield yield tslib.__await(result.value || []);
798
- let continuationToken = result.nextLink;
846
+ let result;
847
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
848
+ if (!continuationToken) {
849
+ result = yield tslib.__await(this._list(options));
850
+ let page = result.value || [];
851
+ continuationToken = result.nextLink;
852
+ setContinuationToken(page, continuationToken);
853
+ yield yield tslib.__await(page);
854
+ }
799
855
  while (continuationToken) {
800
856
  result = yield tslib.__await(this._listNext(continuationToken, options));
801
857
  continuationToken = result.nextLink;
802
- yield yield tslib.__await(result.value || []);
858
+ let page = result.value || [];
859
+ setContinuationToken(page, continuationToken);
860
+ yield yield tslib.__await(page);
803
861
  }
804
862
  });
805
863
  }
@@ -1189,20 +1247,31 @@ class OperationsImpl {
1189
1247
  [Symbol.asyncIterator]() {
1190
1248
  return this;
1191
1249
  },
1192
- byPage: () => {
1193
- return this.listPagingPage(options);
1250
+ byPage: (settings) => {
1251
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1252
+ throw new Error("maxPageSize is not supported by this operation.");
1253
+ }
1254
+ return this.listPagingPage(options, settings);
1194
1255
  }
1195
1256
  };
1196
1257
  }
1197
- listPagingPage(options) {
1258
+ listPagingPage(options, settings) {
1198
1259
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
1199
- let result = yield tslib.__await(this._list(options));
1200
- yield yield tslib.__await(result.value || []);
1201
- let continuationToken = result.nextLink;
1260
+ let result;
1261
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1262
+ if (!continuationToken) {
1263
+ result = yield tslib.__await(this._list(options));
1264
+ let page = result.value || [];
1265
+ continuationToken = result.nextLink;
1266
+ setContinuationToken(page, continuationToken);
1267
+ yield yield tslib.__await(page);
1268
+ }
1202
1269
  while (continuationToken) {
1203
1270
  result = yield tslib.__await(this._listNext(continuationToken, options));
1204
1271
  continuationToken = result.nextLink;
1205
- yield yield tslib.__await(result.value || []);
1272
+ let page = result.value || [];
1273
+ setContinuationToken(page, continuationToken);
1274
+ yield yield tslib.__await(page);
1206
1275
  }
1207
1276
  });
1208
1277
  }
@@ -1290,7 +1359,7 @@ class HealthbotClient extends coreClient__namespace.ServiceClient {
1290
1359
  * @param options The parameter options
1291
1360
  */
1292
1361
  constructor(credentials, subscriptionId, options) {
1293
- var _a, _b;
1362
+ var _a, _b, _c;
1294
1363
  if (credentials === undefined) {
1295
1364
  throw new Error("'credentials' cannot be null");
1296
1365
  }
@@ -1305,32 +1374,34 @@ class HealthbotClient extends coreClient__namespace.ServiceClient {
1305
1374
  requestContentType: "application/json; charset=utf-8",
1306
1375
  credential: credentials
1307
1376
  };
1308
- const packageDetails = `azsdk-js-arm-healthbot/2.0.1`;
1377
+ const packageDetails = `azsdk-js-arm-healthbot/2.1.0`;
1309
1378
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
1310
1379
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
1311
1380
  : `${packageDetails}`;
1312
- if (!options.credentialScopes) {
1313
- options.credentialScopes = ["https://management.azure.com/.default"];
1314
- }
1315
1381
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
1316
1382
  userAgentPrefix
1317
- }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
1383
+ }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
1318
1384
  super(optionsWithDefaults);
1385
+ let bearerTokenAuthenticationPolicyFound = false;
1319
1386
  if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
1320
1387
  const pipelinePolicies = options.pipeline.getOrderedPolicies();
1321
- const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
1388
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
1322
1389
  coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName);
1323
- if (!bearerTokenAuthenticationPolicyFound) {
1324
- this.pipeline.removePolicy({
1325
- name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
1326
- });
1327
- this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
1328
- scopes: `${optionsWithDefaults.baseUri}/.default`,
1329
- challengeCallbacks: {
1330
- authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
1331
- }
1332
- }));
1333
- }
1390
+ }
1391
+ if (!options ||
1392
+ !options.pipeline ||
1393
+ options.pipeline.getOrderedPolicies().length == 0 ||
1394
+ !bearerTokenAuthenticationPolicyFound) {
1395
+ this.pipeline.removePolicy({
1396
+ name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
1397
+ });
1398
+ this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
1399
+ credential: credentials,
1400
+ scopes: (_c = optionsWithDefaults.credentialScopes) !== null && _c !== void 0 ? _c : `${optionsWithDefaults.endpoint}/.default`,
1401
+ challengeCallbacks: {
1402
+ authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
1403
+ }
1404
+ }));
1334
1405
  }
1335
1406
  // Parameter assignments
1336
1407
  this.subscriptionId = subscriptionId;
@@ -1339,8 +1410,37 @@ class HealthbotClient extends coreClient__namespace.ServiceClient {
1339
1410
  this.apiVersion = options.apiVersion || "2021-06-10";
1340
1411
  this.bots = new BotsImpl(this);
1341
1412
  this.operations = new OperationsImpl(this);
1413
+ this.addCustomApiVersionPolicy(options.apiVersion);
1414
+ }
1415
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
1416
+ addCustomApiVersionPolicy(apiVersion) {
1417
+ if (!apiVersion) {
1418
+ return;
1419
+ }
1420
+ const apiVersionPolicy = {
1421
+ name: "CustomApiVersionPolicy",
1422
+ sendRequest(request, next) {
1423
+ return tslib.__awaiter(this, void 0, void 0, function* () {
1424
+ const param = request.url.split("?");
1425
+ if (param.length > 1) {
1426
+ const newParams = param[1].split("&").map((item) => {
1427
+ if (item.indexOf("api-version") > -1) {
1428
+ return "api-version=" + apiVersion;
1429
+ }
1430
+ else {
1431
+ return item;
1432
+ }
1433
+ });
1434
+ request.url = param[0] + "?" + newParams.join("&");
1435
+ }
1436
+ return next(request);
1437
+ });
1438
+ }
1439
+ };
1440
+ this.pipeline.addPolicy(apiVersionPolicy);
1342
1441
  }
1343
1442
  }
1344
1443
 
1345
1444
  exports.HealthbotClient = HealthbotClient;
1445
+ exports.getContinuationToken = getContinuationToken;
1346
1446
  //# sourceMappingURL=index.js.map