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

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 (73) hide show
  1. package/CHANGELOG.md +24 -2
  2. package/LICENSE +1 -1
  3. package/README.md +18 -7
  4. package/dist/index.js +111 -41
  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.d.ts +2 -0
  9. package/dist-esm/samples-dev/dashboardsCreateOrUpdateSample.d.ts.map +1 -0
  10. package/dist-esm/samples-dev/dashboardsCreateOrUpdateSample.js +46 -0
  11. package/dist-esm/samples-dev/dashboardsCreateOrUpdateSample.js.map +1 -0
  12. package/dist-esm/samples-dev/dashboardsDeleteSample.d.ts +2 -0
  13. package/dist-esm/samples-dev/dashboardsDeleteSample.d.ts.map +1 -0
  14. package/dist-esm/samples-dev/dashboardsDeleteSample.js +31 -0
  15. package/dist-esm/samples-dev/dashboardsDeleteSample.js.map +1 -0
  16. package/dist-esm/samples-dev/dashboardsGetSample.d.ts +2 -0
  17. package/dist-esm/samples-dev/dashboardsGetSample.d.ts.map +1 -0
  18. package/dist-esm/samples-dev/dashboardsGetSample.js +31 -0
  19. package/dist-esm/samples-dev/dashboardsGetSample.js.map +1 -0
  20. package/dist-esm/samples-dev/dashboardsListByResourceGroupSample.d.ts +2 -0
  21. package/dist-esm/samples-dev/dashboardsListByResourceGroupSample.d.ts.map +1 -0
  22. package/dist-esm/samples-dev/dashboardsListByResourceGroupSample.js +44 -0
  23. package/dist-esm/samples-dev/dashboardsListByResourceGroupSample.js.map +1 -0
  24. package/dist-esm/samples-dev/dashboardsListBySubscriptionSample.d.ts +2 -0
  25. package/dist-esm/samples-dev/dashboardsListBySubscriptionSample.d.ts.map +1 -0
  26. package/dist-esm/samples-dev/dashboardsListBySubscriptionSample.js +43 -0
  27. package/dist-esm/samples-dev/dashboardsListBySubscriptionSample.js.map +1 -0
  28. package/dist-esm/samples-dev/dashboardsUpdateSample.d.ts +2 -0
  29. package/dist-esm/samples-dev/dashboardsUpdateSample.d.ts.map +1 -0
  30. package/dist-esm/samples-dev/dashboardsUpdateSample.js +34 -0
  31. package/dist-esm/samples-dev/dashboardsUpdateSample.js.map +1 -0
  32. package/dist-esm/samples-dev/listTenantConfigurationViolationsListSample.d.ts +2 -0
  33. package/dist-esm/samples-dev/listTenantConfigurationViolationsListSample.d.ts.map +1 -0
  34. package/dist-esm/samples-dev/listTenantConfigurationViolationsListSample.js +43 -0
  35. package/dist-esm/samples-dev/listTenantConfigurationViolationsListSample.js.map +1 -0
  36. package/dist-esm/samples-dev/operationsListSample.d.ts +2 -0
  37. package/dist-esm/samples-dev/operationsListSample.d.ts.map +1 -0
  38. package/dist-esm/samples-dev/operationsListSample.js +43 -0
  39. package/dist-esm/samples-dev/operationsListSample.js.map +1 -0
  40. package/dist-esm/samples-dev/tenantConfigurationsCreateSample.d.ts +2 -0
  41. package/dist-esm/samples-dev/tenantConfigurationsCreateSample.d.ts.map +1 -0
  42. package/dist-esm/samples-dev/tenantConfigurationsCreateSample.js +33 -0
  43. package/dist-esm/samples-dev/tenantConfigurationsCreateSample.js.map +1 -0
  44. package/dist-esm/samples-dev/tenantConfigurationsDeleteSample.d.ts +2 -0
  45. package/dist-esm/samples-dev/tenantConfigurationsDeleteSample.d.ts.map +1 -0
  46. package/dist-esm/samples-dev/tenantConfigurationsDeleteSample.js +30 -0
  47. package/dist-esm/samples-dev/tenantConfigurationsDeleteSample.js.map +1 -0
  48. package/dist-esm/samples-dev/tenantConfigurationsGetSample.d.ts +2 -0
  49. package/dist-esm/samples-dev/tenantConfigurationsGetSample.d.ts.map +1 -0
  50. package/dist-esm/samples-dev/tenantConfigurationsGetSample.js +30 -0
  51. package/dist-esm/samples-dev/tenantConfigurationsGetSample.js.map +1 -0
  52. package/dist-esm/samples-dev/tenantConfigurationsListSample.d.ts +2 -0
  53. package/dist-esm/samples-dev/tenantConfigurationsListSample.d.ts.map +1 -0
  54. package/dist-esm/samples-dev/tenantConfigurationsListSample.js +43 -0
  55. package/dist-esm/samples-dev/tenantConfigurationsListSample.js.map +1 -0
  56. package/dist-esm/src/models/index.d.ts +7 -5
  57. package/dist-esm/src/models/index.d.ts.map +1 -1
  58. package/dist-esm/src/models/index.js +1 -0
  59. package/dist-esm/src/models/index.js.map +1 -1
  60. package/dist-esm/src/portal.d.ts +2 -0
  61. package/dist-esm/src/portal.d.ts.map +1 -1
  62. package/dist-esm/src/portal.js +49 -2
  63. package/dist-esm/src/portal.js.map +1 -1
  64. package/dist-esm/test/sampleTest.js +11 -13
  65. package/dist-esm/test/sampleTest.js.map +1 -1
  66. package/package.json +49 -20
  67. package/review/arm-portal.api.md +7 -7
  68. package/rollup.config.js +6 -72
  69. package/src/models/index.ts +6 -5
  70. package/src/portal.ts +61 -2
  71. package/tsconfig.json +19 -5
  72. package/types/arm-portal.d.ts +9 -5
  73. package/types/tsdoc-metadata.json +1 -1
package/rollup.config.js CHANGED
@@ -14,62 +14,14 @@ import json from "@rollup/plugin-json";
14
14
 
15
15
  import nodeBuiltins from "builtin-modules";
16
16
 
17
- /**
18
- * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api.
19
- *
20
- * NOTE: this manual configuration is only needed because OpenTelemetry uses an
21
- * __exportStar downleveled helper function to declare its exports which confuses
22
- * rollup's automatic discovery mechanism.
23
- *
24
- * @returns an object reference that can be `...`'d into your cjs() configuration.
25
- */
26
- export function openTelemetryCommonJs() {
27
- const namedExports = {};
28
-
29
- for (const key of [
30
- "@opentelemetry/api",
31
- "@azure/core-tracing/node_modules/@opentelemetry/api"
32
- ]) {
33
- namedExports[key] = [
34
- "SpanKind",
35
- "TraceFlags",
36
- "getSpan",
37
- "setSpan",
38
- "SpanStatusCode",
39
- "getSpanContext",
40
- "setSpanContext"
41
- ];
42
- }
43
-
44
- const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"];
45
-
46
- for (const version of releasedOpenTelemetryVersions) {
47
- namedExports[
48
- // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path.
49
- `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js`
50
- ] = [
51
- "SpanKind",
52
- "TraceFlags",
53
- "getSpan",
54
- "setSpan",
55
- "StatusCode",
56
- "CanonicalCode",
57
- "getSpanContext",
58
- "setSpanContext"
59
- ];
60
- }
61
-
62
- return namedExports;
63
- }
64
-
65
17
  // #region Warning Handler
66
18
 
67
19
  /**
68
- * A function that can determine whether a rollupwarning should be ignored. If
20
+ * A function that can determine whether a rollup warning should be ignored. If
69
21
  * the function returns `true`, then the warning will not be displayed.
70
22
  */
71
23
 
72
- function ignoreNiseSinonEvalWarnings(warning) {
24
+ function ignoreNiseSinonEval(warning) {
73
25
  return (
74
26
  warning.code === "EVAL" &&
75
27
  warning.id &&
@@ -78,17 +30,14 @@ function ignoreNiseSinonEvalWarnings(warning) {
78
30
  );
79
31
  }
80
32
 
81
- function ignoreChaiCircularDependencyWarnings(warning) {
33
+ function ignoreChaiCircularDependency(warning) {
82
34
  return (
83
35
  warning.code === "CIRCULAR_DEPENDENCY" &&
84
36
  warning.importer && warning.importer.includes("node_modules/chai") === true
85
37
  );
86
38
  }
87
39
 
88
- const warningInhibitors = [
89
- ignoreChaiCircularDependencyWarnings,
90
- ignoreNiseSinonEvalWarnings
91
- ];
40
+ const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval];
92
41
 
93
42
  /**
94
43
  * Construct a warning handler for the shared rollup configuration
@@ -122,22 +71,7 @@ function makeBrowserTestConfig() {
122
71
  nodeResolve({
123
72
  mainFields: ["module", "browser"]
124
73
  }),
125
- cjs({
126
- namedExports: {
127
- // Chai's strange internal architecture makes it impossible to statically
128
- // analyze its exports.
129
- chai: [
130
- "version",
131
- "use",
132
- "util",
133
- "config",
134
- "expect",
135
- "should",
136
- "assert"
137
- ],
138
- ...openTelemetryCommonJs()
139
- }
140
- }),
74
+ cjs(),
141
75
  json(),
142
76
  sourcemaps()
143
77
  //viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
@@ -173,7 +107,7 @@ export function makeConfig(pkg, options) {
173
107
  ],
174
108
  output: { file: "dist/index.js", format: "cjs", sourcemap: true },
175
109
  preserveSymlinks: false,
176
- plugins: [sourcemaps(), nodeResolve(), cjs()]
110
+ plugins: [sourcemaps(), nodeResolve()]
177
111
  };
178
112
 
179
113
  const config = [baseConfig];
@@ -233,26 +233,27 @@ export interface MarkdownPartMetadataSettingsContentSettings {
233
233
  }
234
234
 
235
235
  /** Markdown part metadata. */
236
- export type MarkdownPartMetadata = DashboardPartMetadata & {
236
+ export interface MarkdownPartMetadata extends DashboardPartMetadata {
237
237
  /** Polymorphic discriminator, which specifies the different types this object can be */
238
238
  type: "Extension/HubsExtension/PartType/MarkdownPart";
239
239
  /** Input to dashboard part. */
240
240
  inputs?: Record<string, unknown>[];
241
241
  /** Markdown part settings. */
242
242
  settings?: MarkdownPartMetadataSettings;
243
- };
243
+ }
244
244
 
245
245
  /** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */
246
- export type ProxyResource = Resource & {};
246
+ export interface ProxyResource extends Resource {}
247
247
 
248
248
  /** Tenant configuration. */
249
- export type Configuration = ProxyResource & {
249
+ export interface Configuration extends ProxyResource {
250
250
  /** When flag is set to true Markdown tile will require external storage configuration (URI). The inline content configuration will be prohibited. */
251
251
  enforcePrivateMarkdownStorage?: boolean;
252
- };
252
+ }
253
253
 
254
254
  /** Known values of {@link ConfigurationName} that the service accepts. */
255
255
  export enum KnownConfigurationName {
256
+ /** Default */
256
257
  Default = "default"
257
258
  }
258
259
 
package/src/portal.ts CHANGED
@@ -7,6 +7,12 @@
7
7
  */
8
8
 
9
9
  import * as coreClient from "@azure/core-client";
10
+ import * as coreRestPipeline from "@azure/core-rest-pipeline";
11
+ import {
12
+ PipelineRequest,
13
+ PipelineResponse,
14
+ SendRequest
15
+ } from "@azure/core-rest-pipeline";
10
16
  import * as coreAuth from "@azure/core-auth";
11
17
  import {
12
18
  OperationsImpl,
@@ -55,7 +61,7 @@ export class Portal extends coreClient.ServiceClient {
55
61
  credential: credentials
56
62
  };
57
63
 
58
- const packageDetails = `azsdk-js-arm-portal/1.0.0-beta.1`;
64
+ const packageDetails = `azsdk-js-arm-portal/1.0.0-beta.4`;
59
65
  const userAgentPrefix =
60
66
  options.userAgentOptions && options.userAgentOptions.userAgentPrefix
61
67
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
@@ -70,9 +76,33 @@ export class Portal extends coreClient.ServiceClient {
70
76
  userAgentOptions: {
71
77
  userAgentPrefix
72
78
  },
73
- baseUri: options.endpoint || "https://management.azure.com"
79
+ baseUri:
80
+ options.endpoint ?? options.baseUri ?? "https://management.azure.com"
74
81
  };
75
82
  super(optionsWithDefaults);
83
+
84
+ if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
85
+ const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
86
+ const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
87
+ (pipelinePolicy) =>
88
+ pipelinePolicy.name ===
89
+ coreRestPipeline.bearerTokenAuthenticationPolicyName
90
+ );
91
+ if (!bearerTokenAuthenticationPolicyFound) {
92
+ this.pipeline.removePolicy({
93
+ name: coreRestPipeline.bearerTokenAuthenticationPolicyName
94
+ });
95
+ this.pipeline.addPolicy(
96
+ coreRestPipeline.bearerTokenAuthenticationPolicy({
97
+ scopes: `${optionsWithDefaults.baseUri}/.default`,
98
+ challengeCallbacks: {
99
+ authorizeRequestOnChallenge:
100
+ coreClient.authorizeRequestOnClaimChallenge
101
+ }
102
+ })
103
+ );
104
+ }
105
+ }
76
106
  // Parameter assignments
77
107
  this.subscriptionId = subscriptionId;
78
108
 
@@ -85,6 +115,35 @@ export class Portal extends coreClient.ServiceClient {
85
115
  this.listTenantConfigurationViolations = new ListTenantConfigurationViolationsImpl(
86
116
  this
87
117
  );
118
+ this.addCustomApiVersionPolicy(options.apiVersion);
119
+ }
120
+
121
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
122
+ private addCustomApiVersionPolicy(apiVersion?: string) {
123
+ if (!apiVersion) {
124
+ return;
125
+ }
126
+ const apiVersionPolicy = {
127
+ name: "CustomApiVersionPolicy",
128
+ async sendRequest(
129
+ request: PipelineRequest,
130
+ next: SendRequest
131
+ ): Promise<PipelineResponse> {
132
+ const param = request.url.split("?");
133
+ if (param.length > 1) {
134
+ const newParams = param[1].split("&").map((item) => {
135
+ if (item.indexOf("api-version") > -1) {
136
+ return "api-version=" + apiVersion;
137
+ } else {
138
+ return item;
139
+ }
140
+ });
141
+ request.url = param[0] + "?" + newParams.join("&");
142
+ }
143
+ return next(request);
144
+ }
145
+ };
146
+ this.pipeline.addPolicy(apiVersionPolicy);
88
147
  }
89
148
 
90
149
  operations: Operations;
package/tsconfig.json CHANGED
@@ -9,11 +9,25 @@
9
9
  "esModuleInterop": true,
10
10
  "allowSyntheticDefaultImports": true,
11
11
  "forceConsistentCasingInFileNames": true,
12
- "lib": ["es6", "dom"],
12
+ "lib": [
13
+ "es6",
14
+ "dom"
15
+ ],
13
16
  "declaration": true,
14
17
  "outDir": "./dist-esm",
15
- "importHelpers": true
18
+ "importHelpers": true,
19
+ "paths": {
20
+ "@azure/arm-portal": [
21
+ "./src/index"
22
+ ]
23
+ }
16
24
  },
17
- "include": ["./src/**/*.ts", "./test/**/*.ts"],
18
- "exclude": ["node_modules"]
19
- }
25
+ "include": [
26
+ "./src/**/*.ts",
27
+ "./test/**/*.ts",
28
+ "samples-dev/**/*.ts"
29
+ ],
30
+ "exclude": [
31
+ "node_modules"
32
+ ]
33
+ }
@@ -3,10 +3,10 @@ import * as coreClient from '@azure/core-client';
3
3
  import { PagedAsyncIterableIterator } from '@azure/core-paging';
4
4
 
5
5
  /** Tenant configuration. */
6
- export declare type Configuration = ProxyResource & {
6
+ export declare interface Configuration extends ProxyResource {
7
7
  /** When flag is set to true Markdown tile will require external storage configuration (URI). The inline content configuration will be prohibited. */
8
8
  enforcePrivateMarkdownStorage?: boolean;
9
- };
9
+ }
10
10
 
11
11
  /** List of tenant configurations. */
12
12
  export declare interface ConfigurationList {
@@ -235,6 +235,7 @@ export declare interface ErrorResponse {
235
235
 
236
236
  /** Known values of {@link ConfigurationName} that the service accepts. */
237
237
  export declare enum KnownConfigurationName {
238
+ /** Default */
238
239
  Default = "default"
239
240
  }
240
241
 
@@ -262,14 +263,14 @@ export declare interface ListTenantConfigurationViolationsListOptionalParams ext
262
263
  export declare type ListTenantConfigurationViolationsListResponse = ViolationsList;
263
264
 
264
265
  /** Markdown part metadata. */
265
- export declare type MarkdownPartMetadata = DashboardPartMetadata & {
266
+ export declare interface MarkdownPartMetadata extends DashboardPartMetadata {
266
267
  /** Polymorphic discriminator, which specifies the different types this object can be */
267
268
  type: "Extension/HubsExtension/PartType/MarkdownPart";
268
269
  /** Input to dashboard part. */
269
270
  inputs?: Record<string, unknown>[];
270
271
  /** Markdown part settings. */
271
272
  settings?: MarkdownPartMetadataSettings;
272
- };
273
+ }
273
274
 
274
275
  /** Markdown part settings. */
275
276
  export declare interface MarkdownPartMetadataSettings {
@@ -346,6 +347,8 @@ export declare class Portal extends coreClient.ServiceClient {
346
347
  * @param options The parameter options
347
348
  */
348
349
  constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: PortalOptionalParams);
350
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
351
+ private addCustomApiVersionPolicy;
349
352
  operations: Operations;
350
353
  dashboards: Dashboards;
351
354
  tenantConfigurations: TenantConfigurations;
@@ -363,7 +366,8 @@ export declare interface PortalOptionalParams extends coreClient.ServiceClientOp
363
366
  }
364
367
 
365
368
  /** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */
366
- export declare type ProxyResource = Resource & {};
369
+ export declare interface ProxyResource extends Resource {
370
+ }
367
371
 
368
372
  /** Common fields that are returned in the response for all Azure Resource Manager resources */
369
373
  export declare interface Resource {
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.18.19"
8
+ "packageVersion": "7.18.11"
9
9
  }
10
10
  ]
11
11
  }