@azure/arm-changeanalysis 2.0.2-alpha.20221026.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 (43) hide show
  1. package/CHANGELOG.md +8 -11
  2. package/dist/index.js +166 -35
  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/azureChangeAnalysisManagementClient.d.ts +2 -0
  7. package/dist-esm/src/azureChangeAnalysisManagementClient.d.ts.map +1 -1
  8. package/dist-esm/src/azureChangeAnalysisManagementClient.js +54 -6
  9. package/dist-esm/src/azureChangeAnalysisManagementClient.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 +10 -3
  15. package/dist-esm/src/models/index.d.ts.map +1 -1
  16. package/dist-esm/src/models/index.js +6 -0
  17. package/dist-esm/src/models/index.js.map +1 -1
  18. package/dist-esm/src/operations/changes.d.ts.map +1 -1
  19. package/dist-esm/src/operations/changes.js +37 -14
  20. package/dist-esm/src/operations/changes.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/operations/resourceChanges.d.ts.map +1 -1
  25. package/dist-esm/src/operations/resourceChanges.js +19 -7
  26. package/dist-esm/src/operations/resourceChanges.js.map +1 -1
  27. package/dist-esm/src/pagingHelper.d.ts +13 -0
  28. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  29. package/dist-esm/src/pagingHelper.js +32 -0
  30. package/dist-esm/src/pagingHelper.js.map +1 -0
  31. package/dist-esm/test/sampleTest.js +11 -13
  32. package/dist-esm/test/sampleTest.js.map +1 -1
  33. package/package.json +14 -10
  34. package/review/arm-changeanalysis.api.md +7 -9
  35. package/src/azureChangeAnalysisManagementClient.ts +69 -5
  36. package/src/index.ts +1 -0
  37. package/src/models/index.ts +9 -3
  38. package/src/operations/changes.ts +52 -25
  39. package/src/operations/operations.ts +21 -8
  40. package/src/operations/resourceChanges.ts +27 -8
  41. package/src/pagingHelper.ts +39 -0
  42. package/types/arm-changeanalysis.d.ts +21 -3
  43. package/types/tsdoc-metadata.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,15 +1,12 @@
1
1
  # Release History
2
-
3
- ## 2.0.2 (Unreleased)
4
-
5
- ### Features Added
6
-
7
- ### Breaking Changes
8
-
9
- ### Bugs Fixed
10
-
11
- ### Other Changes
12
-
2
+
3
+ ## 2.1.0 (2022-11-17)
4
+
5
+ **Features**
6
+
7
+ - Added Interface Change
8
+ - Added Interface ProxyResource
9
+
13
10
  ## 2.0.1 (2022-04-11)
14
11
 
15
12
  - Bug fix
package/dist/index.js CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var coreClient = require('@azure/core-client');
6
5
  var tslib = require('tslib');
6
+ var coreClient = require('@azure/core-client');
7
+ var coreRestPipeline = require('@azure/core-rest-pipeline');
7
8
 
8
9
  function _interopNamespace(e) {
9
10
  if (e && e.__esModule) return e;
@@ -24,6 +25,39 @@ function _interopNamespace(e) {
24
25
  }
25
26
 
26
27
  var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
28
+ var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipeline);
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 a result page from a pageable operation, returns a
40
+ * continuation token that can be used to begin paging from
41
+ * that point later.
42
+ * @param page A result object from calling .byPage() on a paged operation.
43
+ * @returns The continuation token that can be passed into byPage().
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
+ }
27
61
 
28
62
  /*
29
63
  * Copyright (c) Microsoft Corporation.
@@ -35,15 +69,21 @@ var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
35
69
  /** Known values of {@link ChangeType} that the service accepts. */
36
70
  exports.KnownChangeType = void 0;
37
71
  (function (KnownChangeType) {
72
+ /** Add */
38
73
  KnownChangeType["Add"] = "Add";
74
+ /** Remove */
39
75
  KnownChangeType["Remove"] = "Remove";
76
+ /** Update */
40
77
  KnownChangeType["Update"] = "Update";
41
78
  })(exports.KnownChangeType || (exports.KnownChangeType = {}));
42
79
  /** Known values of {@link Level} that the service accepts. */
43
80
  exports.KnownLevel = void 0;
44
81
  (function (KnownLevel) {
82
+ /** Noisy */
45
83
  KnownLevel["Noisy"] = "Noisy";
84
+ /** Normal */
46
85
  KnownLevel["Normal"] = "Normal";
86
+ /** Important */
47
87
  KnownLevel["Important"] = "Important";
48
88
  })(exports.KnownLevel || (exports.KnownLevel = {}));
49
89
 
@@ -579,20 +619,31 @@ class OperationsImpl {
579
619
  [Symbol.asyncIterator]() {
580
620
  return this;
581
621
  },
582
- byPage: () => {
583
- return this.listPagingPage(options);
622
+ byPage: (settings) => {
623
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
624
+ throw new Error("maxPageSize is not supported by this operation.");
625
+ }
626
+ return this.listPagingPage(options, settings);
584
627
  }
585
628
  };
586
629
  }
587
- listPagingPage(options) {
630
+ listPagingPage(options, settings) {
588
631
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
589
- let result = yield tslib.__await(this._list(options));
590
- yield yield tslib.__await(result.value || []);
591
- let continuationToken = result.nextLink;
632
+ let result;
633
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
634
+ if (!continuationToken) {
635
+ result = yield tslib.__await(this._list(options));
636
+ let page = result.value || [];
637
+ continuationToken = result.nextLink;
638
+ setContinuationToken(page, continuationToken);
639
+ yield yield tslib.__await(page);
640
+ }
592
641
  while (continuationToken) {
593
642
  result = yield tslib.__await(this._listNext(continuationToken, options));
594
643
  continuationToken = result.nextLink;
595
- yield yield tslib.__await(result.value || []);
644
+ let page = result.value || [];
645
+ setContinuationToken(page, continuationToken);
646
+ yield yield tslib.__await(page);
596
647
  }
597
648
  });
598
649
  }
@@ -700,20 +751,31 @@ class ResourceChangesImpl {
700
751
  [Symbol.asyncIterator]() {
701
752
  return this;
702
753
  },
703
- byPage: () => {
704
- return this.listPagingPage(resourceId, startTime, endTime, options);
754
+ byPage: (settings) => {
755
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
756
+ throw new Error("maxPageSize is not supported by this operation.");
757
+ }
758
+ return this.listPagingPage(resourceId, startTime, endTime, options, settings);
705
759
  }
706
760
  };
707
761
  }
708
- listPagingPage(resourceId, startTime, endTime, options) {
762
+ listPagingPage(resourceId, startTime, endTime, options, settings) {
709
763
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
710
- let result = yield tslib.__await(this._list(resourceId, startTime, endTime, options));
711
- yield yield tslib.__await(result.value || []);
712
- let continuationToken = result.nextLink;
764
+ let result;
765
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
766
+ if (!continuationToken) {
767
+ result = yield tslib.__await(this._list(resourceId, startTime, endTime, options));
768
+ let page = result.value || [];
769
+ continuationToken = result.nextLink;
770
+ setContinuationToken(page, continuationToken);
771
+ yield yield tslib.__await(page);
772
+ }
713
773
  while (continuationToken) {
714
774
  result = yield tslib.__await(this._listNext(resourceId, startTime, endTime, continuationToken, options));
715
775
  continuationToken = result.nextLink;
716
- yield yield tslib.__await(result.value || []);
776
+ let page = result.value || [];
777
+ setContinuationToken(page, continuationToken);
778
+ yield yield tslib.__await(page);
717
779
  }
718
780
  });
719
781
  }
@@ -837,20 +899,31 @@ class ChangesImpl {
837
899
  [Symbol.asyncIterator]() {
838
900
  return this;
839
901
  },
840
- byPage: () => {
841
- return this.listChangesByResourceGroupPagingPage(resourceGroupName, startTime, endTime, options);
902
+ byPage: (settings) => {
903
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
904
+ throw new Error("maxPageSize is not supported by this operation.");
905
+ }
906
+ return this.listChangesByResourceGroupPagingPage(resourceGroupName, startTime, endTime, options, settings);
842
907
  }
843
908
  };
844
909
  }
845
- listChangesByResourceGroupPagingPage(resourceGroupName, startTime, endTime, options) {
910
+ listChangesByResourceGroupPagingPage(resourceGroupName, startTime, endTime, options, settings) {
846
911
  return tslib.__asyncGenerator(this, arguments, function* listChangesByResourceGroupPagingPage_1() {
847
- let result = yield tslib.__await(this._listChangesByResourceGroup(resourceGroupName, startTime, endTime, options));
848
- yield yield tslib.__await(result.value || []);
849
- let continuationToken = result.nextLink;
912
+ let result;
913
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
914
+ if (!continuationToken) {
915
+ result = yield tslib.__await(this._listChangesByResourceGroup(resourceGroupName, startTime, endTime, options));
916
+ let page = result.value || [];
917
+ continuationToken = result.nextLink;
918
+ setContinuationToken(page, continuationToken);
919
+ yield yield tslib.__await(page);
920
+ }
850
921
  while (continuationToken) {
851
922
  result = yield tslib.__await(this._listChangesByResourceGroupNext(resourceGroupName, startTime, endTime, continuationToken, options));
852
923
  continuationToken = result.nextLink;
853
- yield yield tslib.__await(result.value || []);
924
+ let page = result.value || [];
925
+ setContinuationToken(page, continuationToken);
926
+ yield yield tslib.__await(page);
854
927
  }
855
928
  });
856
929
  }
@@ -888,20 +961,31 @@ class ChangesImpl {
888
961
  [Symbol.asyncIterator]() {
889
962
  return this;
890
963
  },
891
- byPage: () => {
892
- return this.listChangesBySubscriptionPagingPage(startTime, endTime, options);
964
+ byPage: (settings) => {
965
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
966
+ throw new Error("maxPageSize is not supported by this operation.");
967
+ }
968
+ return this.listChangesBySubscriptionPagingPage(startTime, endTime, options, settings);
893
969
  }
894
970
  };
895
971
  }
896
- listChangesBySubscriptionPagingPage(startTime, endTime, options) {
972
+ listChangesBySubscriptionPagingPage(startTime, endTime, options, settings) {
897
973
  return tslib.__asyncGenerator(this, arguments, function* listChangesBySubscriptionPagingPage_1() {
898
- let result = yield tslib.__await(this._listChangesBySubscription(startTime, endTime, options));
899
- yield yield tslib.__await(result.value || []);
900
- let continuationToken = result.nextLink;
974
+ let result;
975
+ let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
976
+ if (!continuationToken) {
977
+ result = yield tslib.__await(this._listChangesBySubscription(startTime, endTime, options));
978
+ let page = result.value || [];
979
+ continuationToken = result.nextLink;
980
+ setContinuationToken(page, continuationToken);
981
+ yield yield tslib.__await(page);
982
+ }
901
983
  while (continuationToken) {
902
984
  result = yield tslib.__await(this._listChangesBySubscriptionNext(startTime, endTime, continuationToken, options));
903
985
  continuationToken = result.nextLink;
904
- yield yield tslib.__await(result.value || []);
986
+ let page = result.value || [];
987
+ setContinuationToken(page, continuationToken);
988
+ yield yield tslib.__await(page);
905
989
  }
906
990
  });
907
991
  }
@@ -1083,7 +1167,7 @@ class AzureChangeAnalysisManagementClient extends coreClient__namespace.ServiceC
1083
1167
  * @param options The parameter options
1084
1168
  */
1085
1169
  constructor(credentials, subscriptionId, options) {
1086
- var _a, _b;
1170
+ var _a, _b, _c;
1087
1171
  if (credentials === undefined) {
1088
1172
  throw new Error("'credentials' cannot be null");
1089
1173
  }
@@ -1098,17 +1182,35 @@ class AzureChangeAnalysisManagementClient extends coreClient__namespace.ServiceC
1098
1182
  requestContentType: "application/json; charset=utf-8",
1099
1183
  credential: credentials
1100
1184
  };
1101
- const packageDetails = `azsdk-js-arm-changeanalysis/2.0.2`;
1185
+ const packageDetails = `azsdk-js-arm-changeanalysis/2.1.0`;
1102
1186
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
1103
1187
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
1104
1188
  : `${packageDetails}`;
1105
- if (!options.credentialScopes) {
1106
- options.credentialScopes = ["https://management.azure.com/.default"];
1107
- }
1108
1189
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
1109
1190
  userAgentPrefix
1110
- }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
1191
+ }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
1111
1192
  super(optionsWithDefaults);
1193
+ let bearerTokenAuthenticationPolicyFound = false;
1194
+ if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
1195
+ const pipelinePolicies = options.pipeline.getOrderedPolicies();
1196
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
1197
+ coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName);
1198
+ }
1199
+ if (!options ||
1200
+ !options.pipeline ||
1201
+ options.pipeline.getOrderedPolicies().length == 0 ||
1202
+ !bearerTokenAuthenticationPolicyFound) {
1203
+ this.pipeline.removePolicy({
1204
+ name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
1205
+ });
1206
+ this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
1207
+ credential: credentials,
1208
+ scopes: (_c = optionsWithDefaults.credentialScopes) !== null && _c !== void 0 ? _c : `${optionsWithDefaults.endpoint}/.default`,
1209
+ challengeCallbacks: {
1210
+ authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
1211
+ }
1212
+ }));
1213
+ }
1112
1214
  // Parameter assignments
1113
1215
  this.subscriptionId = subscriptionId;
1114
1216
  // Assigning values to Constant parameters
@@ -1117,8 +1219,37 @@ class AzureChangeAnalysisManagementClient extends coreClient__namespace.ServiceC
1117
1219
  this.operations = new OperationsImpl(this);
1118
1220
  this.resourceChanges = new ResourceChangesImpl(this);
1119
1221
  this.changes = new ChangesImpl(this);
1222
+ this.addCustomApiVersionPolicy(options.apiVersion);
1223
+ }
1224
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
1225
+ addCustomApiVersionPolicy(apiVersion) {
1226
+ if (!apiVersion) {
1227
+ return;
1228
+ }
1229
+ const apiVersionPolicy = {
1230
+ name: "CustomApiVersionPolicy",
1231
+ sendRequest(request, next) {
1232
+ return tslib.__awaiter(this, void 0, void 0, function* () {
1233
+ const param = request.url.split("?");
1234
+ if (param.length > 1) {
1235
+ const newParams = param[1].split("&").map((item) => {
1236
+ if (item.indexOf("api-version") > -1) {
1237
+ return "api-version=" + apiVersion;
1238
+ }
1239
+ else {
1240
+ return item;
1241
+ }
1242
+ });
1243
+ request.url = param[0] + "?" + newParams.join("&");
1244
+ }
1245
+ return next(request);
1246
+ });
1247
+ }
1248
+ };
1249
+ this.pipeline.addPolicy(apiVersionPolicy);
1120
1250
  }
1121
1251
  }
1122
1252
 
1123
1253
  exports.AzureChangeAnalysisManagementClient = AzureChangeAnalysisManagementClient;
1254
+ exports.getContinuationToken = getContinuationToken;
1124
1255
  //# sourceMappingURL=index.js.map