@azure/arm-portal 1.0.0-beta.4 → 1.0.0-beta.5

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 (65) hide show
  1. package/CHANGELOG.md +13 -3
  2. package/LICENSE +1 -1
  3. package/README.md +1 -1
  4. package/dist/index.js +143 -58
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.js +1 -1
  7. package/dist/index.min.js.map +1 -1
  8. package/dist-esm/samples-dev/dashboardsCreateOrUpdateSample.js +11 -3
  9. package/dist-esm/samples-dev/dashboardsCreateOrUpdateSample.js.map +1 -1
  10. package/dist-esm/samples-dev/dashboardsDeleteSample.js +11 -3
  11. package/dist-esm/samples-dev/dashboardsDeleteSample.js.map +1 -1
  12. package/dist-esm/samples-dev/dashboardsGetSample.js +11 -3
  13. package/dist-esm/samples-dev/dashboardsGetSample.js.map +1 -1
  14. package/dist-esm/samples-dev/dashboardsListByResourceGroupSample.js +11 -3
  15. package/dist-esm/samples-dev/dashboardsListByResourceGroupSample.js.map +1 -1
  16. package/dist-esm/samples-dev/dashboardsListBySubscriptionSample.js +10 -2
  17. package/dist-esm/samples-dev/dashboardsListBySubscriptionSample.js.map +1 -1
  18. package/dist-esm/samples-dev/dashboardsUpdateSample.js +11 -3
  19. package/dist-esm/samples-dev/dashboardsUpdateSample.js.map +1 -1
  20. package/dist-esm/samples-dev/listTenantConfigurationViolationsListSample.js +10 -2
  21. package/dist-esm/samples-dev/listTenantConfigurationViolationsListSample.js.map +1 -1
  22. package/dist-esm/samples-dev/operationsListSample.js +10 -2
  23. package/dist-esm/samples-dev/operationsListSample.js.map +1 -1
  24. package/dist-esm/samples-dev/tenantConfigurationsCreateSample.js +10 -2
  25. package/dist-esm/samples-dev/tenantConfigurationsCreateSample.js.map +1 -1
  26. package/dist-esm/samples-dev/tenantConfigurationsDeleteSample.js +10 -2
  27. package/dist-esm/samples-dev/tenantConfigurationsDeleteSample.js.map +1 -1
  28. package/dist-esm/samples-dev/tenantConfigurationsGetSample.js +10 -2
  29. package/dist-esm/samples-dev/tenantConfigurationsGetSample.js.map +1 -1
  30. package/dist-esm/samples-dev/tenantConfigurationsListSample.js +10 -2
  31. package/dist-esm/samples-dev/tenantConfigurationsListSample.js.map +1 -1
  32. package/dist-esm/src/index.d.ts +1 -0
  33. package/dist-esm/src/index.d.ts.map +1 -1
  34. package/dist-esm/src/index.js +1 -0
  35. package/dist-esm/src/index.js.map +1 -1
  36. package/dist-esm/src/operations/dashboards.d.ts.map +1 -1
  37. package/dist-esm/src/operations/dashboards.js +37 -16
  38. package/dist-esm/src/operations/dashboards.js.map +1 -1
  39. package/dist-esm/src/operations/listTenantConfigurationViolations.d.ts.map +1 -1
  40. package/dist-esm/src/operations/listTenantConfigurationViolations.js +19 -8
  41. package/dist-esm/src/operations/listTenantConfigurationViolations.js.map +1 -1
  42. package/dist-esm/src/operations/operations.d.ts.map +1 -1
  43. package/dist-esm/src/operations/operations.js +19 -8
  44. package/dist-esm/src/operations/operations.js.map +1 -1
  45. package/dist-esm/src/operations/tenantConfigurations.d.ts.map +1 -1
  46. package/dist-esm/src/operations/tenantConfigurations.js +19 -8
  47. package/dist-esm/src/operations/tenantConfigurations.js.map +1 -1
  48. package/dist-esm/src/pagingHelper.d.ts +13 -0
  49. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  50. package/dist-esm/src/pagingHelper.js +32 -0
  51. package/dist-esm/src/pagingHelper.js.map +1 -0
  52. package/dist-esm/src/portal.d.ts.map +1 -1
  53. package/dist-esm/src/portal.js +20 -18
  54. package/dist-esm/src/portal.js.map +1 -1
  55. package/package.json +8 -6
  56. package/review/arm-portal.api.md +3 -0
  57. package/src/index.ts +1 -0
  58. package/src/operations/dashboards.ts +46 -19
  59. package/src/operations/listTenantConfigurationViolations.ts +21 -9
  60. package/src/operations/operations.ts +21 -9
  61. package/src/operations/tenantConfigurations.ts +21 -9
  62. package/src/pagingHelper.ts +39 -0
  63. package/src/portal.ts +26 -20
  64. package/types/arm-portal.d.ts +9 -0
  65. package/types/tsdoc-metadata.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Release History
2
-
2
+
3
+ ## 1.0.0-beta.5 (2023-02-02)
4
+
5
+ **Features**
6
+
7
+ - Exposes `getContinuationToken` helper function to extract continuation token
8
+
9
+ **Bugs Fixed**
10
+
11
+ - A series of small bug fixs relevant to authentication and apiVersion policy
12
+
3
13
  ## 1.0.0-beta.4 (2022-07-08)
4
14
 
5
15
  **Features**
@@ -8,13 +18,13 @@
8
18
  - Added Interface MarkdownPartMetadata
9
19
  - Added Interface ProxyResource
10
20
 
11
- ### 1.0.0-beta.3 (2022-04-28)
21
+ ## 1.0.0-beta.3 (2022-04-28)
12
22
 
13
23
  **Features**
14
24
 
15
25
  - Bug fix
16
26
 
17
- ### 1.0.0-beta.2 (2021-11-30)
27
+ ## 1.0.0-beta.2 (2021-11-30)
18
28
 
19
29
  The package of @azure/arm-portal is using our next generation design principles since version 1.0.0-beta.2, which contains breaking changes.
20
30
 
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2022 Microsoft
3
+ Copyright (c) 2023 Microsoft
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -13,7 +13,7 @@ Allows creation and deletion of Azure Shared Dashboards.
13
13
 
14
14
  ### Currently supported environments
15
15
 
16
- - [LTS versions of Node.js](https://nodejs.org/about/releases/)
16
+ - [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
17
17
  - Latest versions of Safari, Chrome, Edge and Firefox.
18
18
 
19
19
  See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
package/dist/index.js CHANGED
@@ -27,6 +27,38 @@ function _interopNamespace(e) {
27
27
  var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
28
28
  var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipeline);
29
29
 
30
+ /*
31
+ * Copyright (c) Microsoft Corporation.
32
+ * Licensed under the MIT License.
33
+ *
34
+ * Code generated by Microsoft (R) AutoRest Code Generator.
35
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
36
+ */
37
+ const pageMap = new WeakMap();
38
+ /**
39
+ * Given the last `.value` produced by the `byPage` iterator,
40
+ * returns a continuation token that can be used to begin paging from
41
+ * that point later.
42
+ * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
43
+ * @returns The continuation token that can be passed into byPage() during future calls.
44
+ */
45
+ function getContinuationToken(page) {
46
+ var _a;
47
+ if (typeof page !== "object" || page === null) {
48
+ return undefined;
49
+ }
50
+ return (_a = pageMap.get(page)) === null || _a === void 0 ? void 0 : _a.continuationToken;
51
+ }
52
+ function setContinuationToken(page, continuationToken) {
53
+ var _a;
54
+ if (typeof page !== "object" || page === null || !continuationToken) {
55
+ return;
56
+ }
57
+ const pageInfo = (_a = pageMap.get(page)) !== null && _a !== void 0 ? _a : {};
58
+ pageInfo.continuationToken = continuationToken;
59
+ pageMap.set(page, pageInfo);
60
+ }
61
+
30
62
  /*
31
63
  * Copyright (c) Microsoft Corporation.
32
64
  * Licensed under the MIT License.
@@ -841,20 +873,31 @@ class OperationsImpl {
841
873
  [Symbol.asyncIterator]() {
842
874
  return this;
843
875
  },
844
- byPage: () => {
845
- return this.listPagingPage(options);
876
+ byPage: (settings) => {
877
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
878
+ throw new Error("maxPageSize is not supported by this operation.");
879
+ }
880
+ return this.listPagingPage(options, settings);
846
881
  }
847
882
  };
848
883
  }
849
- listPagingPage(options) {
884
+ listPagingPage(options, settings) {
850
885
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
851
- let result = yield tslib.__await(this._list(options));
852
- yield yield tslib.__await(result.value || []);
853
- let continuationToken = result.nextLink;
886
+ let result;
887
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
888
+ if (!continuationToken) {
889
+ result = yield tslib.__await(this._list(options));
890
+ let page = result.value || [];
891
+ continuationToken = result.nextLink;
892
+ setContinuationToken(page, continuationToken);
893
+ yield yield tslib.__await(page);
894
+ }
854
895
  while (continuationToken) {
855
896
  result = yield tslib.__await(this._listNext(continuationToken, options));
856
897
  continuationToken = result.nextLink;
857
- yield yield tslib.__await(result.value || []);
898
+ let page = result.value || [];
899
+ setContinuationToken(page, continuationToken);
900
+ yield yield tslib.__await(page);
858
901
  }
859
902
  });
860
903
  }
@@ -921,7 +964,6 @@ const listNextOperationSpec$2 = {
921
964
  bodyMapper: ErrorResponse
922
965
  }
923
966
  },
924
- queryParameters: [apiVersion],
925
967
  urlParameters: [$host, nextLink],
926
968
  headerParameters: [accept],
927
969
  serializer: serializer$3
@@ -958,20 +1000,31 @@ class DashboardsImpl {
958
1000
  [Symbol.asyncIterator]() {
959
1001
  return this;
960
1002
  },
961
- byPage: () => {
962
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
1003
+ byPage: (settings) => {
1004
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1005
+ throw new Error("maxPageSize is not supported by this operation.");
1006
+ }
1007
+ return this.listByResourceGroupPagingPage(resourceGroupName, options, settings);
963
1008
  }
964
1009
  };
965
1010
  }
966
- listByResourceGroupPagingPage(resourceGroupName, options) {
1011
+ listByResourceGroupPagingPage(resourceGroupName, options, settings) {
967
1012
  return tslib.__asyncGenerator(this, arguments, function* listByResourceGroupPagingPage_1() {
968
- let result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
969
- yield yield tslib.__await(result.value || []);
970
- let continuationToken = result.nextLink;
1013
+ let result;
1014
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1015
+ if (!continuationToken) {
1016
+ result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
1017
+ let page = result.value || [];
1018
+ continuationToken = result.nextLink;
1019
+ setContinuationToken(page, continuationToken);
1020
+ yield yield tslib.__await(page);
1021
+ }
971
1022
  while (continuationToken) {
972
1023
  result = yield tslib.__await(this._listByResourceGroupNext(resourceGroupName, continuationToken, options));
973
1024
  continuationToken = result.nextLink;
974
- yield yield tslib.__await(result.value || []);
1025
+ let page = result.value || [];
1026
+ setContinuationToken(page, continuationToken);
1027
+ yield yield tslib.__await(page);
975
1028
  }
976
1029
  });
977
1030
  }
@@ -1006,20 +1059,31 @@ class DashboardsImpl {
1006
1059
  [Symbol.asyncIterator]() {
1007
1060
  return this;
1008
1061
  },
1009
- byPage: () => {
1010
- return this.listBySubscriptionPagingPage(options);
1062
+ byPage: (settings) => {
1063
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1064
+ throw new Error("maxPageSize is not supported by this operation.");
1065
+ }
1066
+ return this.listBySubscriptionPagingPage(options, settings);
1011
1067
  }
1012
1068
  };
1013
1069
  }
1014
- listBySubscriptionPagingPage(options) {
1070
+ listBySubscriptionPagingPage(options, settings) {
1015
1071
  return tslib.__asyncGenerator(this, arguments, function* listBySubscriptionPagingPage_1() {
1016
- let result = yield tslib.__await(this._listBySubscription(options));
1017
- yield yield tslib.__await(result.value || []);
1018
- let continuationToken = result.nextLink;
1072
+ let result;
1073
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1074
+ if (!continuationToken) {
1075
+ result = yield tslib.__await(this._listBySubscription(options));
1076
+ let page = result.value || [];
1077
+ continuationToken = result.nextLink;
1078
+ setContinuationToken(page, continuationToken);
1079
+ yield yield tslib.__await(page);
1080
+ }
1019
1081
  while (continuationToken) {
1020
1082
  result = yield tslib.__await(this._listBySubscriptionNext(continuationToken, options));
1021
1083
  continuationToken = result.nextLink;
1022
- yield yield tslib.__await(result.value || []);
1084
+ let page = result.value || [];
1085
+ setContinuationToken(page, continuationToken);
1086
+ yield yield tslib.__await(page);
1023
1087
  }
1024
1088
  });
1025
1089
  }
@@ -1253,7 +1317,6 @@ const listByResourceGroupNextOperationSpec = {
1253
1317
  bodyMapper: ErrorResponse
1254
1318
  }
1255
1319
  },
1256
- queryParameters: [apiVersion],
1257
1320
  urlParameters: [
1258
1321
  $host,
1259
1322
  nextLink,
@@ -1274,7 +1337,6 @@ const listBySubscriptionNextOperationSpec = {
1274
1337
  bodyMapper: ErrorResponse
1275
1338
  }
1276
1339
  },
1277
- queryParameters: [apiVersion],
1278
1340
  urlParameters: [
1279
1341
  $host,
1280
1342
  nextLink,
@@ -1314,20 +1376,31 @@ class TenantConfigurationsImpl {
1314
1376
  [Symbol.asyncIterator]() {
1315
1377
  return this;
1316
1378
  },
1317
- byPage: () => {
1318
- return this.listPagingPage(options);
1379
+ byPage: (settings) => {
1380
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1381
+ throw new Error("maxPageSize is not supported by this operation.");
1382
+ }
1383
+ return this.listPagingPage(options, settings);
1319
1384
  }
1320
1385
  };
1321
1386
  }
1322
- listPagingPage(options) {
1387
+ listPagingPage(options, settings) {
1323
1388
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
1324
- let result = yield tslib.__await(this._list(options));
1325
- yield yield tslib.__await(result.value || []);
1326
- let continuationToken = result.nextLink;
1389
+ let result;
1390
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1391
+ if (!continuationToken) {
1392
+ result = yield tslib.__await(this._list(options));
1393
+ let page = result.value || [];
1394
+ continuationToken = result.nextLink;
1395
+ setContinuationToken(page, continuationToken);
1396
+ yield yield tslib.__await(page);
1397
+ }
1327
1398
  while (continuationToken) {
1328
1399
  result = yield tslib.__await(this._listNext(continuationToken, options));
1329
1400
  continuationToken = result.nextLink;
1330
- yield yield tslib.__await(result.value || []);
1401
+ let page = result.value || [];
1402
+ setContinuationToken(page, continuationToken);
1403
+ yield yield tslib.__await(page);
1331
1404
  }
1332
1405
  });
1333
1406
  }
@@ -1473,7 +1546,6 @@ const listNextOperationSpec$1 = {
1473
1546
  bodyMapper: ErrorResponse
1474
1547
  }
1475
1548
  },
1476
- queryParameters: [apiVersion],
1477
1549
  urlParameters: [$host, nextLink],
1478
1550
  headerParameters: [accept],
1479
1551
  serializer: serializer$1
@@ -1509,20 +1581,31 @@ class ListTenantConfigurationViolationsImpl {
1509
1581
  [Symbol.asyncIterator]() {
1510
1582
  return this;
1511
1583
  },
1512
- byPage: () => {
1513
- return this.listPagingPage(options);
1584
+ byPage: (settings) => {
1585
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1586
+ throw new Error("maxPageSize is not supported by this operation.");
1587
+ }
1588
+ return this.listPagingPage(options, settings);
1514
1589
  }
1515
1590
  };
1516
1591
  }
1517
- listPagingPage(options) {
1592
+ listPagingPage(options, settings) {
1518
1593
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
1519
- let result = yield tslib.__await(this._list(options));
1520
- yield yield tslib.__await(result.value || []);
1521
- let continuationToken = result.nextLink;
1594
+ let result;
1595
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
1596
+ if (!continuationToken) {
1597
+ result = yield tslib.__await(this._list(options));
1598
+ let page = result.value || [];
1599
+ continuationToken = result.nextLink;
1600
+ setContinuationToken(page, continuationToken);
1601
+ yield yield tslib.__await(page);
1602
+ }
1522
1603
  while (continuationToken) {
1523
1604
  result = yield tslib.__await(this._listNext(continuationToken, options));
1524
1605
  continuationToken = result.nextLink;
1525
- yield yield tslib.__await(result.value || []);
1606
+ let page = result.value || [];
1607
+ setContinuationToken(page, continuationToken);
1608
+ yield yield tslib.__await(page);
1526
1609
  }
1527
1610
  });
1528
1611
  }
@@ -1589,7 +1672,6 @@ const listNextOperationSpec = {
1589
1672
  bodyMapper: ErrorResponse
1590
1673
  }
1591
1674
  },
1592
- queryParameters: [apiVersion],
1593
1675
  urlParameters: [$host, nextLink],
1594
1676
  headerParameters: [accept],
1595
1677
  serializer
@@ -1611,7 +1693,7 @@ class Portal extends coreClient__namespace.ServiceClient {
1611
1693
  * @param options The parameter options
1612
1694
  */
1613
1695
  constructor(credentials, subscriptionId, options) {
1614
- var _a, _b;
1696
+ var _a, _b, _c;
1615
1697
  if (credentials === undefined) {
1616
1698
  throw new Error("'credentials' cannot be null");
1617
1699
  }
@@ -1626,32 +1708,34 @@ class Portal extends coreClient__namespace.ServiceClient {
1626
1708
  requestContentType: "application/json; charset=utf-8",
1627
1709
  credential: credentials
1628
1710
  };
1629
- const packageDetails = `azsdk-js-arm-portal/1.0.0-beta.4`;
1711
+ const packageDetails = `azsdk-js-arm-portal/1.0.0-beta.5`;
1630
1712
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
1631
1713
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
1632
1714
  : `${packageDetails}`;
1633
- if (!options.credentialScopes) {
1634
- options.credentialScopes = ["https://management.azure.com/.default"];
1635
- }
1636
1715
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
1637
1716
  userAgentPrefix
1638
- }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
1717
+ }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
1639
1718
  super(optionsWithDefaults);
1719
+ let bearerTokenAuthenticationPolicyFound = false;
1640
1720
  if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
1641
1721
  const pipelinePolicies = options.pipeline.getOrderedPolicies();
1642
- const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
1722
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
1643
1723
  coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName);
1644
- if (!bearerTokenAuthenticationPolicyFound) {
1645
- this.pipeline.removePolicy({
1646
- name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
1647
- });
1648
- this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
1649
- scopes: `${optionsWithDefaults.baseUri}/.default`,
1650
- challengeCallbacks: {
1651
- authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
1652
- }
1653
- }));
1654
- }
1724
+ }
1725
+ if (!options ||
1726
+ !options.pipeline ||
1727
+ options.pipeline.getOrderedPolicies().length == 0 ||
1728
+ !bearerTokenAuthenticationPolicyFound) {
1729
+ this.pipeline.removePolicy({
1730
+ name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
1731
+ });
1732
+ this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
1733
+ credential: credentials,
1734
+ scopes: (_c = optionsWithDefaults.credentialScopes) !== null && _c !== void 0 ? _c : `${optionsWithDefaults.endpoint}/.default`,
1735
+ challengeCallbacks: {
1736
+ authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
1737
+ }
1738
+ }));
1655
1739
  }
1656
1740
  // Parameter assignments
1657
1741
  this.subscriptionId = subscriptionId;
@@ -1694,4 +1778,5 @@ class Portal extends coreClient__namespace.ServiceClient {
1694
1778
  }
1695
1779
 
1696
1780
  exports.Portal = Portal;
1781
+ exports.getContinuationToken = getContinuationToken;
1697
1782
  //# sourceMappingURL=index.js.map