@azure/arm-powerbiembedded 2.0.2-alpha.20221128.1 → 2.0.2

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 +6 -6
  2. package/dist/index.js +100 -30
  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/index.d.ts +1 -0
  7. package/dist-esm/src/index.d.ts.map +1 -1
  8. package/dist-esm/src/index.js +1 -0
  9. package/dist-esm/src/index.js.map +1 -1
  10. package/dist-esm/src/models/index.d.ts +4 -0
  11. package/dist-esm/src/models/index.d.ts.map +1 -1
  12. package/dist-esm/src/models/index.js +4 -0
  13. package/dist-esm/src/models/index.js.map +1 -1
  14. package/dist-esm/src/operations/workspaceCollections.d.ts.map +1 -1
  15. package/dist-esm/src/operations/workspaceCollections.js +16 -8
  16. package/dist-esm/src/operations/workspaceCollections.js.map +1 -1
  17. package/dist-esm/src/operations/workspaces.d.ts.map +1 -1
  18. package/dist-esm/src/operations/workspaces.js +8 -4
  19. package/dist-esm/src/operations/workspaces.js.map +1 -1
  20. package/dist-esm/src/pagingHelper.d.ts +13 -0
  21. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  22. package/dist-esm/src/pagingHelper.js +32 -0
  23. package/dist-esm/src/pagingHelper.js.map +1 -0
  24. package/dist-esm/src/powerBIEmbeddedManagementClient.d.ts +2 -0
  25. package/dist-esm/src/powerBIEmbeddedManagementClient.d.ts.map +1 -1
  26. package/dist-esm/src/powerBIEmbeddedManagementClient.js +48 -17
  27. package/dist-esm/src/powerBIEmbeddedManagementClient.js.map +1 -1
  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-powerbiembedded.api.md +3 -4
  32. package/src/index.ts +1 -0
  33. package/src/models/index.ts +4 -0
  34. package/src/operations/workspaceCollections.ts +25 -11
  35. package/src/operations/workspaces.ts +11 -5
  36. package/src/pagingHelper.ts +39 -0
  37. package/src/powerBIEmbeddedManagementClient.ts +59 -19
  38. package/types/arm-powerbiembedded.d.ts +15 -0
package/CHANGELOG.md CHANGED
@@ -1,21 +1,21 @@
1
1
  # Release History
2
2
 
3
- ## 2.0.2 (Unreleased)
3
+ ## 2.0.2 (2022-12-05)
4
4
 
5
- ### Features Added
5
+ **Features**
6
6
 
7
- ### Breaking Changes
7
+ - Exposes `getContinuationToken` helper function to extract continuation token
8
8
 
9
- ### Bugs Fixed
9
+ **Bugs Fixed**
10
10
 
11
- ### Other Changes
11
+ - A series of small bug fixs relevant to authentication and apiVersion policy
12
12
 
13
13
  ## 2.0.1 (2022-04-28)
14
14
 
15
15
  **Features**
16
16
 
17
17
  - Bug fix
18
-
18
+
19
19
  ## 2.0.0 (2022-01-20)
20
20
 
21
21
  The package of @azure/arm-powerbiembedded 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,29 @@ 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
+
31
54
  /*
32
55
  * Copyright (c) Microsoft Corporation.
33
56
  * Licensed under the MIT License.
@@ -38,17 +61,21 @@ var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipelin
38
61
  /** Known values of {@link AzureSkuName} that the service accepts. */
39
62
  exports.KnownAzureSkuName = void 0;
40
63
  (function (KnownAzureSkuName) {
64
+ /** S1 */
41
65
  KnownAzureSkuName["S1"] = "S1";
42
66
  })(exports.KnownAzureSkuName || (exports.KnownAzureSkuName = {}));
43
67
  /** Known values of {@link AzureSkuTier} that the service accepts. */
44
68
  exports.KnownAzureSkuTier = void 0;
45
69
  (function (KnownAzureSkuTier) {
70
+ /** Standard */
46
71
  KnownAzureSkuTier["Standard"] = "Standard";
47
72
  })(exports.KnownAzureSkuTier || (exports.KnownAzureSkuTier = {}));
48
73
  /** Known values of {@link CheckNameReason} that the service accepts. */
49
74
  exports.KnownCheckNameReason = void 0;
50
75
  (function (KnownCheckNameReason) {
76
+ /** Unavailable */
51
77
  KnownCheckNameReason["Unavailable"] = "Unavailable";
78
+ /** Invalid */
52
79
  KnownCheckNameReason["Invalid"] = "Invalid";
53
80
  })(exports.KnownCheckNameReason || (exports.KnownCheckNameReason = {}));
54
81
 
@@ -700,14 +727,18 @@ class WorkspaceCollectionsImpl {
700
727
  [Symbol.asyncIterator]() {
701
728
  return this;
702
729
  },
703
- byPage: () => {
704
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
730
+ byPage: (settings) => {
731
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
732
+ throw new Error("maxPageSize is not supported by this operation.");
733
+ }
734
+ return this.listByResourceGroupPagingPage(resourceGroupName, options, settings);
705
735
  }
706
736
  };
707
737
  }
708
- listByResourceGroupPagingPage(resourceGroupName, options) {
738
+ listByResourceGroupPagingPage(resourceGroupName, options, _settings) {
709
739
  return tslib.__asyncGenerator(this, arguments, function* listByResourceGroupPagingPage_1() {
710
- let result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
740
+ let result;
741
+ result = yield tslib.__await(this._listByResourceGroup(resourceGroupName, options));
711
742
  yield yield tslib.__await(result.value || []);
712
743
  });
713
744
  }
@@ -742,14 +773,18 @@ class WorkspaceCollectionsImpl {
742
773
  [Symbol.asyncIterator]() {
743
774
  return this;
744
775
  },
745
- byPage: () => {
746
- return this.listBySubscriptionPagingPage(options);
776
+ byPage: (settings) => {
777
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
778
+ throw new Error("maxPageSize is not supported by this operation.");
779
+ }
780
+ return this.listBySubscriptionPagingPage(options, settings);
747
781
  }
748
782
  };
749
783
  }
750
- listBySubscriptionPagingPage(options) {
784
+ listBySubscriptionPagingPage(options, _settings) {
751
785
  return tslib.__asyncGenerator(this, arguments, function* listBySubscriptionPagingPage_1() {
752
- let result = yield tslib.__await(this._listBySubscription(options));
786
+ let result;
787
+ result = yield tslib.__await(this._listBySubscription(options));
753
788
  yield yield tslib.__await(result.value || []);
754
789
  });
755
790
  }
@@ -1153,14 +1188,18 @@ class WorkspacesImpl {
1153
1188
  [Symbol.asyncIterator]() {
1154
1189
  return this;
1155
1190
  },
1156
- byPage: () => {
1157
- return this.listPagingPage(resourceGroupName, workspaceCollectionName, options);
1191
+ byPage: (settings) => {
1192
+ if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
1193
+ throw new Error("maxPageSize is not supported by this operation.");
1194
+ }
1195
+ return this.listPagingPage(resourceGroupName, workspaceCollectionName, options, settings);
1158
1196
  }
1159
1197
  };
1160
1198
  }
1161
- listPagingPage(resourceGroupName, workspaceCollectionName, options) {
1199
+ listPagingPage(resourceGroupName, workspaceCollectionName, options, _settings) {
1162
1200
  return tslib.__asyncGenerator(this, arguments, function* listPagingPage_1() {
1163
- let result = yield tslib.__await(this._list(resourceGroupName, workspaceCollectionName, options));
1201
+ let result;
1202
+ result = yield tslib.__await(this._list(resourceGroupName, workspaceCollectionName, options));
1164
1203
  yield yield tslib.__await(result.value || []);
1165
1204
  });
1166
1205
  }
@@ -1232,7 +1271,7 @@ class PowerBIEmbeddedManagementClient extends coreClient__namespace.ServiceClien
1232
1271
  * @param options The parameter options
1233
1272
  */
1234
1273
  constructor(credentials, subscriptionId, options) {
1235
- var _a, _b;
1274
+ var _a, _b, _c;
1236
1275
  if (credentials === undefined) {
1237
1276
  throw new Error("'credentials' cannot be null");
1238
1277
  }
@@ -1251,28 +1290,30 @@ class PowerBIEmbeddedManagementClient extends coreClient__namespace.ServiceClien
1251
1290
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
1252
1291
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
1253
1292
  : `${packageDetails}`;
1254
- if (!options.credentialScopes) {
1255
- options.credentialScopes = ["https://management.azure.com/.default"];
1256
- }
1257
1293
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
1258
1294
  userAgentPrefix
1259
- }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
1295
+ }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
1260
1296
  super(optionsWithDefaults);
1297
+ let bearerTokenAuthenticationPolicyFound = false;
1261
1298
  if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
1262
1299
  const pipelinePolicies = options.pipeline.getOrderedPolicies();
1263
- const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
1300
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
1264
1301
  coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName);
1265
- if (!bearerTokenAuthenticationPolicyFound) {
1266
- this.pipeline.removePolicy({
1267
- name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
1268
- });
1269
- this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
1270
- scopes: `${optionsWithDefaults.baseUri}/.default`,
1271
- challengeCallbacks: {
1272
- authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
1273
- }
1274
- }));
1275
- }
1302
+ }
1303
+ if (!options ||
1304
+ !options.pipeline ||
1305
+ options.pipeline.getOrderedPolicies().length == 0 ||
1306
+ !bearerTokenAuthenticationPolicyFound) {
1307
+ this.pipeline.removePolicy({
1308
+ name: coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName
1309
+ });
1310
+ this.pipeline.addPolicy(coreRestPipeline__namespace.bearerTokenAuthenticationPolicy({
1311
+ credential: credentials,
1312
+ scopes: (_c = optionsWithDefaults.credentialScopes) !== null && _c !== void 0 ? _c : `${optionsWithDefaults.endpoint}/.default`,
1313
+ challengeCallbacks: {
1314
+ authorizeRequestOnChallenge: coreClient__namespace.authorizeRequestOnClaimChallenge
1315
+ }
1316
+ }));
1276
1317
  }
1277
1318
  // Parameter assignments
1278
1319
  this.subscriptionId = subscriptionId;
@@ -1281,6 +1322,34 @@ class PowerBIEmbeddedManagementClient extends coreClient__namespace.ServiceClien
1281
1322
  this.apiVersion = options.apiVersion || "2016-01-29";
1282
1323
  this.workspaceCollections = new WorkspaceCollectionsImpl(this);
1283
1324
  this.workspaces = new WorkspacesImpl(this);
1325
+ this.addCustomApiVersionPolicy(options.apiVersion);
1326
+ }
1327
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
1328
+ addCustomApiVersionPolicy(apiVersion) {
1329
+ if (!apiVersion) {
1330
+ return;
1331
+ }
1332
+ const apiVersionPolicy = {
1333
+ name: "CustomApiVersionPolicy",
1334
+ sendRequest(request, next) {
1335
+ return tslib.__awaiter(this, void 0, void 0, function* () {
1336
+ const param = request.url.split("?");
1337
+ if (param.length > 1) {
1338
+ const newParams = param[1].split("&").map((item) => {
1339
+ if (item.indexOf("api-version") > -1) {
1340
+ return "api-version=" + apiVersion;
1341
+ }
1342
+ else {
1343
+ return item;
1344
+ }
1345
+ });
1346
+ request.url = param[0] + "?" + newParams.join("&");
1347
+ }
1348
+ return next(request);
1349
+ });
1350
+ }
1351
+ };
1352
+ this.pipeline.addPolicy(apiVersionPolicy);
1284
1353
  }
1285
1354
  /**
1286
1355
  * Indicates which operations can be performed by the Power BI Resource Provider.
@@ -1310,4 +1379,5 @@ const getAvailableOperationsOperationSpec = {
1310
1379
  };
1311
1380
 
1312
1381
  exports.PowerBIEmbeddedManagementClient = PowerBIEmbeddedManagementClient;
1382
+ exports.getContinuationToken = getContinuationToken;
1313
1383
  //# sourceMappingURL=index.js.map