@azure/arm-templatespecs 2.0.2-alpha.20221026.1 → 2.1.0-alpha.20221128.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 (40) hide show
  1. package/CHANGELOG.md +10 -11
  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/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 +12 -8
  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/templateSpecVersions.d.ts.map +1 -1
  15. package/dist-esm/src/operations/templateSpecVersions.js +19 -7
  16. package/dist-esm/src/operations/templateSpecVersions.js.map +1 -1
  17. package/dist-esm/src/operations/templateSpecs.d.ts.map +1 -1
  18. package/dist-esm/src/operations/templateSpecs.js +37 -14
  19. package/dist-esm/src/operations/templateSpecs.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/templateSpecsClient.d.ts +2 -0
  25. package/dist-esm/src/templateSpecsClient.d.ts.map +1 -1
  26. package/dist-esm/src/templateSpecsClient.js +49 -18
  27. package/dist-esm/src/templateSpecsClient.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 +12 -8
  31. package/review/arm-templatespecs.api.md +18 -19
  32. package/src/index.ts +1 -0
  33. package/src/models/index.ts +12 -8
  34. package/src/operations/templateSpecVersions.ts +23 -9
  35. package/src/operations/templateSpecs.ts +46 -17
  36. package/src/pagingHelper.ts +39 -0
  37. package/src/templateSpecsClient.ts +60 -20
  38. package/tsconfig.json +1 -13
  39. package/types/arm-templatespecs.d.ts +23 -8
  40. package/types/tsdoc-metadata.json +1 -1
@@ -8,6 +8,11 @@
8
8
 
9
9
  import * as coreClient from "@azure/core-client";
10
10
  import * as coreRestPipeline from "@azure/core-rest-pipeline";
11
+ import {
12
+ PipelineRequest,
13
+ PipelineResponse,
14
+ SendRequest
15
+ } from "@azure/core-rest-pipeline";
11
16
  import * as coreAuth from "@azure/core-auth";
12
17
  import { TemplateSpecsImpl, TemplateSpecVersionsImpl } from "./operations";
13
18
  import { TemplateSpecs, TemplateSpecVersions } from "./operationsInterfaces";
@@ -45,47 +50,53 @@ export class TemplateSpecsClient extends coreClient.ServiceClient {
45
50
  credential: credentials
46
51
  };
47
52
 
48
- const packageDetails = `azsdk-js-arm-templatespecs/2.0.2`;
53
+ const packageDetails = `azsdk-js-arm-templatespecs/2.1.0`;
49
54
  const userAgentPrefix =
50
55
  options.userAgentOptions && options.userAgentOptions.userAgentPrefix
51
56
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
52
57
  : `${packageDetails}`;
53
58
 
54
- if (!options.credentialScopes) {
55
- options.credentialScopes = ["https://management.azure.com/.default"];
56
- }
57
59
  const optionsWithDefaults = {
58
60
  ...defaults,
59
61
  ...options,
60
62
  userAgentOptions: {
61
63
  userAgentPrefix
62
64
  },
63
- baseUri:
65
+ endpoint:
64
66
  options.endpoint ?? options.baseUri ?? "https://management.azure.com"
65
67
  };
66
68
  super(optionsWithDefaults);
67
69
 
70
+ let bearerTokenAuthenticationPolicyFound: boolean = false;
68
71
  if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
69
72
  const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
70
- const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
73
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
71
74
  (pipelinePolicy) =>
72
75
  pipelinePolicy.name ===
73
76
  coreRestPipeline.bearerTokenAuthenticationPolicyName
74
77
  );
75
- if (!bearerTokenAuthenticationPolicyFound) {
76
- this.pipeline.removePolicy({
77
- name: coreRestPipeline.bearerTokenAuthenticationPolicyName
78
- });
79
- this.pipeline.addPolicy(
80
- coreRestPipeline.bearerTokenAuthenticationPolicy({
81
- scopes: `${optionsWithDefaults.baseUri}/.default`,
82
- challengeCallbacks: {
83
- authorizeRequestOnChallenge:
84
- coreClient.authorizeRequestOnClaimChallenge
85
- }
86
- })
87
- );
88
- }
78
+ }
79
+ if (
80
+ !options ||
81
+ !options.pipeline ||
82
+ options.pipeline.getOrderedPolicies().length == 0 ||
83
+ !bearerTokenAuthenticationPolicyFound
84
+ ) {
85
+ this.pipeline.removePolicy({
86
+ name: coreRestPipeline.bearerTokenAuthenticationPolicyName
87
+ });
88
+ this.pipeline.addPolicy(
89
+ coreRestPipeline.bearerTokenAuthenticationPolicy({
90
+ credential: credentials,
91
+ scopes:
92
+ optionsWithDefaults.credentialScopes ??
93
+ `${optionsWithDefaults.endpoint}/.default`,
94
+ challengeCallbacks: {
95
+ authorizeRequestOnChallenge:
96
+ coreClient.authorizeRequestOnClaimChallenge
97
+ }
98
+ })
99
+ );
89
100
  }
90
101
  // Parameter assignments
91
102
  this.subscriptionId = subscriptionId;
@@ -95,6 +106,35 @@ export class TemplateSpecsClient extends coreClient.ServiceClient {
95
106
  this.apiVersion = options.apiVersion || "2021-05-01";
96
107
  this.templateSpecs = new TemplateSpecsImpl(this);
97
108
  this.templateSpecVersions = new TemplateSpecVersionsImpl(this);
109
+ this.addCustomApiVersionPolicy(options.apiVersion);
110
+ }
111
+
112
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
113
+ private addCustomApiVersionPolicy(apiVersion?: string) {
114
+ if (!apiVersion) {
115
+ return;
116
+ }
117
+ const apiVersionPolicy = {
118
+ name: "CustomApiVersionPolicy",
119
+ async sendRequest(
120
+ request: PipelineRequest,
121
+ next: SendRequest
122
+ ): Promise<PipelineResponse> {
123
+ const param = request.url.split("?");
124
+ if (param.length > 1) {
125
+ const newParams = param[1].split("&").map((item) => {
126
+ if (item.indexOf("api-version") > -1) {
127
+ return "api-version=" + apiVersion;
128
+ } else {
129
+ return item;
130
+ }
131
+ });
132
+ request.url = param[0] + "?" + newParams.join("&");
133
+ }
134
+ return next(request);
135
+ }
136
+ };
137
+ this.pipeline.addPolicy(apiVersionPolicy);
98
138
  }
99
139
 
100
140
  templateSpecs: TemplateSpecs;
package/tsconfig.json CHANGED
@@ -26,20 +26,8 @@
26
26
  "./src/**/*.ts",
27
27
  "./test/**/*.ts",
28
28
  "samples-dev/**/*.ts",
29
- "./test/**/*.ts",
30
- "samples-dev/**/*.ts",
31
- "./test/**/*.ts",
32
- "samples-dev/**/*.ts",
33
- "./test/**/*.ts",
34
- "samples-dev/**/*.ts",
35
- "./test/**/*.ts",
36
- "samples-dev/**/*.ts",
37
- "./test/**/*.ts",
38
- "samples-dev/**/*.ts",
39
- "./test/**/*.ts",
40
- "samples-dev/**/*.ts"
41
29
  ],
42
30
  "exclude": [
43
31
  "node_modules"
44
32
  ]
45
- }
33
+ }
@@ -81,11 +81,24 @@ export declare interface ErrorResponse {
81
81
  readonly additionalInfo?: ErrorAdditionalInfo[];
82
82
  }
83
83
 
84
+ /**
85
+ * Given a result page from a pageable operation, returns a
86
+ * continuation token that can be used to begin paging from
87
+ * that point later.
88
+ * @param page A result object from calling .byPage() on a paged operation.
89
+ * @returns The continuation token that can be passed into byPage().
90
+ */
91
+ export declare function getContinuationToken(page: unknown): string | undefined;
92
+
84
93
  /** Known values of {@link CreatedByType} that the service accepts. */
85
94
  export declare enum KnownCreatedByType {
95
+ /** User */
86
96
  User = "User",
97
+ /** Application */
87
98
  Application = "Application",
99
+ /** ManagedIdentity */
88
100
  ManagedIdentity = "ManagedIdentity",
101
+ /** Key */
89
102
  Key = "Key"
90
103
  }
91
104
 
@@ -120,7 +133,7 @@ export declare interface SystemData {
120
133
  }
121
134
 
122
135
  /** Template Spec object. */
123
- export declare type TemplateSpec = AzureResourceBase & {
136
+ export declare interface TemplateSpec extends AzureResourceBase {
124
137
  /** The location of the Template Spec. It cannot be changed after Template Spec creation. It must be one of the supported Azure locations. */
125
138
  location: string;
126
139
  /** Resource tags. */
@@ -140,7 +153,7 @@ export declare type TemplateSpec = AzureResourceBase & {
140
153
  readonly versions?: {
141
154
  [propertyName: string]: TemplateSpecVersionInfo;
142
155
  };
143
- };
156
+ }
144
157
 
145
158
  /**
146
159
  * Defines values for TemplateSpecExpandKind. \
@@ -206,6 +219,8 @@ export declare class TemplateSpecsClient extends coreClient.ServiceClient {
206
219
  * @param options The parameter options
207
220
  */
208
221
  constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: TemplateSpecsClientOptionalParams);
222
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
223
+ private addCustomApiVersionPolicy;
209
224
  templateSpecs: TemplateSpecs;
210
225
  templateSpecVersions: TemplateSpecVersions;
211
226
  }
@@ -303,15 +318,15 @@ export declare interface TemplateSpecsUpdateOptionalParams extends coreClient.Op
303
318
  export declare type TemplateSpecsUpdateResponse = TemplateSpec;
304
319
 
305
320
  /** Template Spec properties to be updated (only tags are currently supported). */
306
- export declare type TemplateSpecUpdateModel = AzureResourceBase & {
321
+ export declare interface TemplateSpecUpdateModel extends AzureResourceBase {
307
322
  /** Resource tags. */
308
323
  tags?: {
309
324
  [propertyName: string]: string;
310
325
  };
311
- };
326
+ }
312
327
 
313
328
  /** Template Spec Version object. */
314
- export declare type TemplateSpecVersion = AzureResourceBase & {
329
+ export declare interface TemplateSpecVersion extends AzureResourceBase {
315
330
  /** The location of the Template Spec Version. It must match the location of the parent Template Spec. */
316
331
  location: string;
317
332
  /** Resource tags. */
@@ -328,7 +343,7 @@ export declare type TemplateSpecVersion = AzureResourceBase & {
328
343
  mainTemplate?: Record<string, unknown>;
329
344
  /** The Azure Resource Manager template UI definition content. */
330
345
  uiFormDefinition?: Record<string, unknown>;
331
- };
346
+ }
332
347
 
333
348
  /** High-level information about a Template Spec version. */
334
349
  export declare interface TemplateSpecVersionInfo {
@@ -447,11 +462,11 @@ export declare interface TemplateSpecVersionsUpdateOptionalParams extends coreCl
447
462
  export declare type TemplateSpecVersionsUpdateResponse = TemplateSpecVersion;
448
463
 
449
464
  /** Template Spec Version properties to be updated (only tags are currently supported). */
450
- export declare type TemplateSpecVersionUpdateModel = AzureResourceBase & {
465
+ export declare interface TemplateSpecVersionUpdateModel extends AzureResourceBase {
451
466
  /** Resource tags. */
452
467
  tags?: {
453
468
  [propertyName: string]: string;
454
469
  };
455
- };
470
+ }
456
471
 
457
472
  export { }
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.31.2"
8
+ "packageVersion": "7.33.5"
9
9
  }
10
10
  ]
11
11
  }