@azure/app-configuration 1.3.2-alpha.20220401.1 → 1.4.0-alpha.20220407.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 (50) hide show
  1. package/CHANGELOG.md +11 -7
  2. package/dist/index.js +153 -374
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/appConfigCredential.js +24 -30
  5. package/dist-esm/src/appConfigCredential.js.map +1 -1
  6. package/dist-esm/src/appConfigurationClient.js +48 -63
  7. package/dist-esm/src/appConfigurationClient.js.map +1 -1
  8. package/dist-esm/src/generated/src/appConfiguration.js +47 -89
  9. package/dist-esm/src/generated/src/appConfiguration.js.map +1 -1
  10. package/dist-esm/src/generated/src/index.js +0 -1
  11. package/dist-esm/src/generated/src/index.js.map +1 -1
  12. package/dist-esm/src/generated/src/models/index.js +78 -1
  13. package/dist-esm/src/generated/src/models/index.js.map +1 -1
  14. package/dist-esm/src/generated/src/models/mappers.js.map +1 -1
  15. package/dist-esm/src/generated/src/models/parameters.js +7 -8
  16. package/dist-esm/src/generated/src/models/parameters.js.map +1 -1
  17. package/dist-esm/src/internal/helpers.js +33 -18
  18. package/dist-esm/src/internal/helpers.js.map +1 -1
  19. package/dist-esm/src/internal/synctokenpolicy.js +9 -18
  20. package/dist-esm/src/internal/synctokenpolicy.js.map +1 -1
  21. package/dist-esm/src/internal/tracingHelpers.js +1 -1
  22. package/dist-esm/src/internal/tracingHelpers.js.map +1 -1
  23. package/dist-esm/src/models.js.map +1 -1
  24. package/dist-esm/test/internal/helpers.spec.js +3 -12
  25. package/dist-esm/test/internal/helpers.spec.js.map +1 -1
  26. package/dist-esm/test/internal/http.spec.js +2 -14
  27. package/dist-esm/test/internal/http.spec.js.map +1 -1
  28. package/dist-esm/test/internal/node/throttlingRetryPolicy.spec.js +6 -5
  29. package/dist-esm/test/internal/node/throttlingRetryPolicy.spec.js.map +1 -1
  30. package/dist-esm/test/internal/tracingHelpers.spec.js.map +1 -1
  31. package/dist-esm/test/public/auth.spec.js +1 -1
  32. package/dist-esm/test/public/auth.spec.js.map +1 -1
  33. package/dist-esm/test/public/etags.spec.js +1 -2
  34. package/dist-esm/test/public/etags.spec.js.map +1 -1
  35. package/dist-esm/test/public/index.readonlytests.spec.js +6 -1
  36. package/dist-esm/test/public/index.readonlytests.spec.js.map +1 -1
  37. package/dist-esm/test/public/index.spec.js +23 -8
  38. package/dist-esm/test/public/index.spec.js.map +1 -1
  39. package/dist-esm/test/public/secretReference.spec.js.map +1 -1
  40. package/dist-esm/test/public/throwOrNotThrow.spec.js +1 -1
  41. package/dist-esm/test/public/throwOrNotThrow.spec.js.map +1 -1
  42. package/dist-esm/test/public/utils/testHelpers.js.map +1 -1
  43. package/package.json +10 -2
  44. package/types/app-configuration.d.ts +5 -13
  45. package/dist-esm/src/generated/src/appConfigurationContext.js +0 -46
  46. package/dist-esm/src/generated/src/appConfigurationContext.js.map +0 -1
  47. package/dist-esm/src/policies/throttlingRetryPolicy.js +0 -126
  48. package/dist-esm/src/policies/throttlingRetryPolicy.js.map +0 -1
  49. package/dist-esm/test/internal/throttlingRetryPolicyTests.spec.js +0 -145
  50. package/dist-esm/test/internal/throttlingRetryPolicyTests.spec.js.map +0 -1
@@ -1,37 +1,31 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- import { URLBuilder, } from "@azure/core-http";
4
3
  import { sha256Digest, sha256Hmac } from "./internal/cryptoHelpers";
5
4
  /**
6
- * @internal
5
+ * Create an HTTP pipeline policy to authenticate a request
6
+ * using an `AzureKeyCredential` for AppConfig.
7
7
  */
8
- export class AppConfigCredential {
9
- constructor(credential, secret) {
10
- this.credential = credential;
11
- this.secret = secret;
12
- }
13
- /**
14
- * Signs a request with the values provided in the credential and secret parameter.
15
- *
16
- * @param webResource - The WebResource to be signed.
17
- * @returns The signed request object.
18
- */
19
- async signRequest(webResource) {
20
- const verb = webResource.method.toUpperCase();
21
- const utcNow = new Date().toUTCString();
22
- const contentHash = await sha256Digest(webResource.body || "");
23
- const signedHeaders = "x-ms-date;host;x-ms-content-sha256";
24
- const url = URLBuilder.parse(webResource.url);
25
- const query = url.getQuery();
26
- const urlPathAndQuery = `${url.getPath()}${query ? "?" + query : ""}`;
27
- const stringToSign = `${verb}\n${urlPathAndQuery}\n${utcNow};${url.getHost()};${contentHash}`;
28
- const signature = await sha256Hmac(this.secret, stringToSign);
29
- webResource.headers.set("x-ms-date", utcNow);
30
- webResource.headers.set("x-ms-content-sha256", contentHash);
31
- // Syntax for Authorization header
32
- // Reference - https://docs.microsoft.com/en-us/azure/azure-app-configuration/rest-api-authentication-hmac#syntax
33
- webResource.headers.set("Authorization", `HMAC-SHA256 Credential=${this.credential}&SignedHeaders=${signedHeaders}&Signature=${signature}`);
34
- return webResource;
35
- }
8
+ export function appConfigKeyCredentialPolicy(credential, secret) {
9
+ return {
10
+ name: "AppConfigKeyCredentialPolicy",
11
+ async sendRequest(request, next) {
12
+ var _a;
13
+ const verb = request.method;
14
+ const utcNow = new Date().toUTCString();
15
+ const contentHash = await sha256Digest(((_a = request.body) === null || _a === void 0 ? void 0 : _a.toString()) || "");
16
+ const signedHeaders = "x-ms-date;host;x-ms-content-sha256";
17
+ const url = new URL(request.url);
18
+ const query = url.search;
19
+ const urlPathAndQuery = query ? `${url.pathname}${query}` : url.pathname;
20
+ const stringToSign = `${verb}\n${urlPathAndQuery}\n${utcNow};${url.host};${contentHash}`;
21
+ const signature = await sha256Hmac(secret, stringToSign);
22
+ request.headers.set("x-ms-date", utcNow);
23
+ request.headers.set("x-ms-content-sha256", contentHash);
24
+ // Syntax for Authorization header
25
+ // Reference - https://docs.microsoft.com/en-us/azure/azure-app-configuration/rest-api-authentication-hmac#syntax
26
+ request.headers.set("Authorization", `HMAC-SHA256 Credential=${credential}&SignedHeaders=${signedHeaders}&Signature=${signature}`);
27
+ return next(request);
28
+ },
29
+ };
36
30
  }
37
31
  //# sourceMappingURL=appConfigCredential.js.map
@@ -1 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,EAAE,MAAM,CAAC,CAAC;QAC7C,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;QAC5D,kCAAkC;QAClC,iHAAiH;QACjH,WAAW,CAAC,OAAO,CAAC,GAAG,CACrB,eAAe,EACf,0BAA0B,IAAI,CAAC,UAAU,kBAAkB,aAAa,cAAc,SAAS,EAAE,CAClG,CAAC;QACF,OAAO,WAAW,CAAC;IACrB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n ServiceClientCredentials,\n WebResource,\n URLBuilder,\n WebResourceLike,\n} from \"@azure/core-http\";\nimport { sha256Digest, sha256Hmac } from \"./internal/cryptoHelpers\";\n\n/**\n * @internal\n */\nexport class AppConfigCredential implements ServiceClientCredentials {\n private credential: string;\n private secret: string;\n\n constructor(credential: string, secret: string) {\n this.credential = credential;\n this.secret = secret;\n }\n\n /**\n * Signs a request with the values provided in the credential and secret parameter.\n *\n * @param webResource - The WebResource to be signed.\n * @returns The signed request object.\n */\n async signRequest(webResource: WebResourceLike): Promise<WebResource> {\n const verb = webResource.method.toUpperCase();\n const utcNow = new Date().toUTCString();\n\n const contentHash = await sha256Digest(webResource.body || \"\");\n\n const signedHeaders = \"x-ms-date;host;x-ms-content-sha256\";\n\n const url = URLBuilder.parse(webResource.url);\n const query = url.getQuery();\n const urlPathAndQuery = `${url.getPath()}${query ? \"?\" + query : \"\"}`;\n\n const stringToSign = `${verb}\\n${urlPathAndQuery}\\n${utcNow};${url.getHost()};${contentHash}`;\n\n const signature = await sha256Hmac(this.secret, stringToSign);\n\n webResource.headers.set(\"x-ms-date\", utcNow);\n webResource.headers.set(\"x-ms-content-sha256\", contentHash);\n // Syntax for Authorization header\n // Reference - https://docs.microsoft.com/en-us/azure/azure-app-configuration/rest-api-authentication-hmac#syntax\n webResource.headers.set(\n \"Authorization\",\n `HMAC-SHA256 Credential=${this.credential}&SignedHeaders=${signedHeaders}&Signature=${signature}`\n );\n return webResource;\n }\n}\n"]}
1
+ {"version":3,"file":"appConfigCredential.js","sourceRoot":"","sources":["../../src/appConfigCredential.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEpE;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAAC,UAAkB,EAAE,MAAc;IAC7E,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;;YAC3D,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;YAC5B,MAAM,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YACxC,MAAM,WAAW,GAAG,MAAM,YAAY,CAAC,CAAA,MAAA,OAAO,CAAC,IAAI,0CAAE,QAAQ,EAAE,KAAI,EAAE,CAAC,CAAC;YACvE,MAAM,aAAa,GAAG,oCAAoC,CAAC;YAC3D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACjC,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC;YACzB,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,QAAQ,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC;YACzE,MAAM,YAAY,GAAG,GAAG,IAAI,KAAK,eAAe,KAAK,MAAM,IAAI,GAAG,CAAC,IAAI,IAAI,WAAW,EAAE,CAAC;YACzF,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;YAEzD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;YACzC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;YACxD,kCAAkC;YAClC,iHAAiH;YACjH,OAAO,CAAC,OAAO,CAAC,GAAG,CACjB,eAAe,EACf,0BAA0B,UAAU,kBAAkB,aAAa,cAAc,SAAS,EAAE,CAC7F,CAAC;YAEF,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n PipelinePolicy,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { sha256Digest, sha256Hmac } from \"./internal/cryptoHelpers\";\n\n/**\n * Create an HTTP pipeline policy to authenticate a request\n * using an `AzureKeyCredential` for AppConfig.\n */\nexport function appConfigKeyCredentialPolicy(credential: string, secret: string): PipelinePolicy {\n return {\n name: \"AppConfigKeyCredentialPolicy\",\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n const verb = request.method;\n const utcNow = new Date().toUTCString();\n const contentHash = await sha256Digest(request.body?.toString() || \"\");\n const signedHeaders = \"x-ms-date;host;x-ms-content-sha256\";\n const url = new URL(request.url);\n const query = url.search;\n const urlPathAndQuery = query ? `${url.pathname}${query}` : url.pathname;\n const stringToSign = `${verb}\\n${urlPathAndQuery}\\n${utcNow};${url.host};${contentHash}`;\n const signature = await sha256Hmac(secret, stringToSign);\n\n request.headers.set(\"x-ms-date\", utcNow);\n request.headers.set(\"x-ms-content-sha256\", contentHash);\n // Syntax for Authorization header\n // Reference - https://docs.microsoft.com/en-us/azure/azure-app-configuration/rest-api-authentication-hmac#syntax\n request.headers.set(\n \"Authorization\",\n `HMAC-SHA256 Credential=${credential}&SignedHeaders=${signedHeaders}&Signature=${signature}`\n );\n\n return next(request);\n },\n };\n}\n"]}
@@ -3,22 +3,19 @@
3
3
  import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
4
4
  // https://azure.github.io/azure-sdk/typescript_design.html#ts-config-lib
5
5
  /// <reference lib="esnext.asynciterable" />
6
- import { AppConfigCredential } from "./appConfigCredential";
6
+ import { appConfigKeyCredentialPolicy } from "./appConfigCredential";
7
7
  import { AppConfiguration } from "./generated/src/appConfiguration";
8
- import { isTokenCredential, exponentialRetryPolicy, systemErrorRetryPolicy, getDefaultUserAgentValue as getCoreHttpDefaultUserAgentValue, userAgentPolicy, } from "@azure/core-http";
9
- import { throttlingRetryPolicy } from "./policies/throttlingRetryPolicy";
8
+ import { isTokenCredential } from "@azure/core-auth";
10
9
  import "@azure/core-asynciterator-polyfill";
11
- import { checkAndFormatIfAndIfNoneMatch, extractAfterTokenFromNextLink, formatFiltersAndSelect, makeConfigurationSettingEmpty, transformKeyValueResponse, transformKeyValueResponseWithStatusCode, transformKeyValue, formatAcceptDateTime, formatFieldsForSelect, serializeAsConfigurationSettingParam, } from "./internal/helpers";
12
- import { tracingPolicy } from "@azure/core-http";
10
+ import { assertResponse, checkAndFormatIfAndIfNoneMatch, extractAfterTokenFromNextLink, formatAcceptDateTime, formatFieldsForSelect, formatFiltersAndSelect, makeConfigurationSettingEmpty, serializeAsConfigurationSettingParam, transformKeyValue, transformKeyValueResponse, transformKeyValueResponseWithStatusCode, } from "./internal/helpers";
13
11
  import { trace as traceFromTracingHelpers } from "./internal/tracingHelpers";
14
- import { syncTokenPolicy, SyncTokens } from "./internal/synctokenpolicy";
15
- const packageName = "azsdk-js-app-configuration";
12
+ import { SyncTokens, syncTokenPolicy } from "./internal/synctokenpolicy";
13
+ import { deserializationPolicy, deserializationPolicyName, } from "@azure/core-client";
14
+ import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
16
15
  /**
17
- * This constant should always be the same as the package.json's version - we use it when forming the
18
- * User - Agent header. There's a unit test that makes sure it always stays in sync.
19
16
  * @internal
20
17
  */
21
- export const packageVersion = "1.3.2";
18
+ export const packageVersion = "1.4.0-beta.1";
22
19
  const apiVersion = "1.0";
23
20
  const ConnectionStringRegex = /Endpoint=(.*);Id=(.*);Secret=(.*)/;
24
21
  const deserializationContentTypes = {
@@ -40,24 +37,35 @@ export class AppConfigurationClient {
40
37
  let appConfigOptions = {};
41
38
  let appConfigCredential;
42
39
  let appConfigEndpoint;
40
+ let authPolicy;
43
41
  if (isTokenCredential(tokenCredentialOrOptions)) {
44
42
  appConfigOptions = options || {};
45
43
  appConfigCredential = tokenCredentialOrOptions;
46
- appConfigEndpoint = connectionStringOrEndpoint;
44
+ appConfigEndpoint = connectionStringOrEndpoint.endsWith("/")
45
+ ? connectionStringOrEndpoint.slice(0, -1)
46
+ : connectionStringOrEndpoint;
47
+ authPolicy = bearerTokenAuthenticationPolicy({
48
+ scopes: `${appConfigEndpoint}/.default`,
49
+ credential: appConfigCredential,
50
+ });
47
51
  }
48
52
  else {
49
53
  appConfigOptions = tokenCredentialOrOptions || {};
50
54
  const regexMatch = connectionStringOrEndpoint === null || connectionStringOrEndpoint === void 0 ? void 0 : connectionStringOrEndpoint.match(ConnectionStringRegex);
51
55
  if (regexMatch) {
52
- appConfigCredential = new AppConfigCredential(regexMatch[2], regexMatch[3]);
53
56
  appConfigEndpoint = regexMatch[1];
57
+ authPolicy = appConfigKeyCredentialPolicy(regexMatch[2], regexMatch[3]);
54
58
  }
55
59
  else {
56
60
  throw new Error(`Invalid connection string. Valid connection strings should match the regex '${ConnectionStringRegex.source}'.`);
57
61
  }
58
62
  }
59
63
  this._syncTokens = appConfigOptions.syncTokens || new SyncTokens();
60
- this.client = new AppConfiguration(appConfigCredential, appConfigEndpoint, apiVersion, getGeneratedClientOptions(appConfigEndpoint, this._syncTokens, appConfigOptions));
64
+ this.client = new AppConfiguration(appConfigEndpoint, apiVersion, appConfigOptions);
65
+ this.client.pipeline.addPolicy(authPolicy, { phase: "Sign" });
66
+ this.client.pipeline.addPolicy(syncTokenPolicy(this._syncTokens), { afterPhase: "Retry" });
67
+ this.client.pipeline.removePolicy({ name: deserializationPolicyName });
68
+ this.client.pipeline.addPolicy(deserializationPolicy({ expectedContentTypes: deserializationContentTypes }), { phase: "Deserialize" });
61
69
  }
62
70
  /**
63
71
  * Add a setting into the Azure App Configuration service, failing if it
@@ -74,7 +82,9 @@ export class AppConfigurationClient {
74
82
  return this._trace("addConfigurationSetting", options, async (newOptions) => {
75
83
  const keyValue = serializeAsConfigurationSettingParam(configurationSetting);
76
84
  const originalResponse = await this.client.putKeyValue(configurationSetting.key, Object.assign({ ifNoneMatch: "*", label: configurationSetting.label, entity: keyValue }, newOptions));
77
- return transformKeyValueResponse(originalResponse);
85
+ const response = transformKeyValueResponse(originalResponse);
86
+ assertResponse(response);
87
+ return response;
78
88
  });
79
89
  }
80
90
  /**
@@ -89,8 +99,13 @@ export class AppConfigurationClient {
89
99
  */
90
100
  deleteConfigurationSetting(id, options = {}) {
91
101
  return this._trace("deleteConfigurationSetting", options, async (newOptions) => {
92
- const originalResponse = await this.client.deleteKeyValue(id.key, Object.assign(Object.assign({ label: id.label }, newOptions), checkAndFormatIfAndIfNoneMatch(id, options)));
93
- return transformKeyValueResponseWithStatusCode(originalResponse);
102
+ let status;
103
+ const originalResponse = await this.client.deleteKeyValue(id.key, Object.assign(Object.assign(Object.assign({ label: id.label }, newOptions), checkAndFormatIfAndIfNoneMatch(id, options)), { onResponse: (response) => {
104
+ status = response.status;
105
+ } }));
106
+ const response = transformKeyValueResponseWithStatusCode(originalResponse, status);
107
+ assertResponse(response);
108
+ return response;
94
109
  });
95
110
  }
96
111
  /**
@@ -105,8 +120,11 @@ export class AppConfigurationClient {
105
120
  */
106
121
  async getConfigurationSetting(id, options = {}) {
107
122
  return this._trace("getConfigurationSetting", options, async (newOptions) => {
108
- const originalResponse = await this.client.getKeyValue(id.key, Object.assign(Object.assign(Object.assign(Object.assign({}, newOptions), { label: id.label, select: formatFieldsForSelect(options.fields) }), formatAcceptDateTime(options)), checkAndFormatIfAndIfNoneMatch(id, options)));
109
- const response = transformKeyValueResponseWithStatusCode(originalResponse);
123
+ let status;
124
+ const originalResponse = await this.client.getKeyValue(id.key, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, newOptions), { label: id.label, select: formatFieldsForSelect(options.fields) }), formatAcceptDateTime(options)), checkAndFormatIfAndIfNoneMatch(id, options)), { onResponse: (response) => {
125
+ status = response.status;
126
+ } }));
127
+ const response = transformKeyValueResponseWithStatusCode(originalResponse, status);
110
128
  // 304 only comes back if the user has passed a conditional option in their
111
129
  // request _and_ the remote object has the same etag as what the user passed.
112
130
  if (response.statusCode === 304) {
@@ -116,6 +134,7 @@ export class AppConfigurationClient {
116
134
  // and now we'll undefine all the other properties that are not HTTP related
117
135
  makeConfigurationSettingEmpty(response);
118
136
  }
137
+ assertResponse(response);
119
138
  return response;
120
139
  });
121
140
  }
@@ -245,9 +264,9 @@ export class AppConfigurationClient {
245
264
  }));
246
265
  yield __await(yield* __asyncDelegator(__asyncValues(this.createListRevisionsPageFromResponse(currentResponse))));
247
266
  while (currentResponse.nextLink) {
248
- currentResponse = yield __await(this._trace("listRevisions", options, (newOptions) => {
267
+ currentResponse = (yield __await(this._trace("listRevisions", options, (newOptions) => {
249
268
  return this.client.getRevisions(Object.assign(Object.assign(Object.assign(Object.assign({}, newOptions), formatAcceptDateTime(options)), formatFiltersAndSelect(options)), { after: extractAfterTokenFromNextLink(currentResponse.nextLink) }));
250
- }));
269
+ })));
251
270
  if (!currentResponse.items) {
252
271
  break;
253
272
  }
@@ -274,8 +293,9 @@ export class AppConfigurationClient {
274
293
  async setConfigurationSetting(configurationSetting, options = {}) {
275
294
  return this._trace("setConfigurationSetting", options, async (newOptions) => {
276
295
  const keyValue = serializeAsConfigurationSettingParam(configurationSetting);
277
- const response = await this.client.putKeyValue(configurationSetting.key, Object.assign(Object.assign(Object.assign({}, newOptions), { label: configurationSetting.label, entity: keyValue }), checkAndFormatIfAndIfNoneMatch(configurationSetting, options)));
278
- return transformKeyValueResponse(response);
296
+ const response = transformKeyValueResponse(await this.client.putKeyValue(configurationSetting.key, Object.assign(Object.assign(Object.assign({}, newOptions), { label: configurationSetting.label, entity: keyValue }), checkAndFormatIfAndIfNoneMatch(configurationSetting, options))));
297
+ assertResponse(response);
298
+ return response;
279
299
  });
280
300
  }
281
301
  /**
@@ -284,14 +304,16 @@ export class AppConfigurationClient {
284
304
  */
285
305
  async setReadOnly(id, readOnly, options = {}) {
286
306
  return this._trace("setReadOnly", options, async (newOptions) => {
307
+ let response;
287
308
  if (readOnly) {
288
- const response = await this.client.putLock(id.key, Object.assign(Object.assign(Object.assign({}, newOptions), { label: id.label }), checkAndFormatIfAndIfNoneMatch(id, options)));
289
- return transformKeyValueResponse(response);
309
+ response = await this.client.putLock(id.key, Object.assign(Object.assign(Object.assign({}, newOptions), { label: id.label }), checkAndFormatIfAndIfNoneMatch(id, options)));
290
310
  }
291
311
  else {
292
- const response = await this.client.deleteLock(id.key, Object.assign(Object.assign(Object.assign({}, newOptions), { label: id.label }), checkAndFormatIfAndIfNoneMatch(id, options)));
293
- return transformKeyValueResponse(response);
312
+ response = await this.client.deleteLock(id.key, Object.assign(Object.assign(Object.assign({}, newOptions), { label: id.label }), checkAndFormatIfAndIfNoneMatch(id, options)));
294
313
  }
314
+ response = transformKeyValueResponse(response);
315
+ assertResponse(response);
316
+ return response;
295
317
  });
296
318
  }
297
319
  /**
@@ -303,41 +325,4 @@ export class AppConfigurationClient {
303
325
  this._syncTokens.addSyncTokenFromHeaderValue(syncToken);
304
326
  }
305
327
  }
306
- /**
307
- * Gets the options for the generated AppConfigurationClient
308
- * @internal
309
- */
310
- export function getGeneratedClientOptions(endpoint, syncTokens, internalAppConfigOptions) {
311
- const retryPolicies = [
312
- exponentialRetryPolicy(),
313
- systemErrorRetryPolicy(),
314
- throttlingRetryPolicy(internalAppConfigOptions.retryOptions),
315
- ];
316
- const userAgent = getUserAgentPrefix(internalAppConfigOptions.userAgentOptions &&
317
- internalAppConfigOptions.userAgentOptions.userAgentPrefix);
318
- return {
319
- endpoint,
320
- deserializationContentTypes,
321
- // we'll add in our own custom retry policies
322
- noRetryPolicy: true,
323
- requestPolicyFactories: (defaults) => [
324
- tracingPolicy({ userAgent }),
325
- syncTokenPolicy(syncTokens),
326
- userAgentPolicy({ value: userAgent }),
327
- ...retryPolicies,
328
- ...defaults,
329
- ],
330
- generateClientRequestIdHeader: true,
331
- };
332
- }
333
- /**
334
- * @internal
335
- */
336
- export function getUserAgentPrefix(userSuppliedUserAgent) {
337
- const appConfigDefaultUserAgent = `${packageName}/${packageVersion} ${getCoreHttpDefaultUserAgentValue()}`;
338
- if (!userSuppliedUserAgent) {
339
- return appConfigDefaultUserAgent;
340
- }
341
- return `${userSuppliedUserAgent} ${appConfigDefaultUserAgent}`;
342
- }
343
328
  //# sourceMappingURL=appConfigurationClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"appConfigurationClient.js","sourceRoot":"","sources":["../../src/appConfigurationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,yEAAyE;AACzE,4CAA4C;AAE5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EAGtB,wBAAwB,IAAI,gCAAgC,EAC5D,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAGzE,OAAO,oCAAoC,CAAC;AAwB5C,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC7B,sBAAsB,EACtB,6BAA6B,EAC7B,yBAAyB,EACzB,uCAAuC,EACvC,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,oCAAoC,GACrC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,IAAI,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAK7E,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,4B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,qBAAqB,IAAI,yBAAyB,EAAE,CAAC;AACjE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// https://azure.github.io/azure-sdk/typescript_design.html#ts-config-lib\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport { AppConfigCredential } from \"./appConfigCredential\";\nimport { AppConfiguration } from \"./generated/src/appConfiguration\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport {\n isTokenCredential,\n exponentialRetryPolicy,\n systemErrorRetryPolicy,\n ServiceClientCredentials,\n UserAgentOptions,\n getDefaultUserAgentValue as getCoreHttpDefaultUserAgentValue,\n userAgentPolicy,\n} from \"@azure/core-http\";\nimport { throttlingRetryPolicy } from \"./policies/throttlingRetryPolicy\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\nimport \"@azure/core-asynciterator-polyfill\";\n\nimport {\n AddConfigurationSettingOptions,\n AddConfigurationSettingParam,\n AddConfigurationSettingResponse,\n ConfigurationSetting,\n ConfigurationSettingId,\n DeleteConfigurationSettingOptions,\n DeleteConfigurationSettingResponse,\n GetConfigurationSettingOptions,\n GetConfigurationSettingResponse,\n ListConfigurationSettingPage,\n ListConfigurationSettingsOptions,\n ListRevisionsOptions,\n ListRevisionsPage,\n PageSettings,\n RetryOptions,\n SetConfigurationSettingOptions,\n SetConfigurationSettingParam,\n SetConfigurationSettingResponse,\n SetReadOnlyOptions,\n SetReadOnlyResponse,\n} from \"./models\";\nimport {\n checkAndFormatIfAndIfNoneMatch,\n extractAfterTokenFromNextLink,\n formatFiltersAndSelect,\n makeConfigurationSettingEmpty,\n transformKeyValueResponse,\n transformKeyValueResponseWithStatusCode,\n transformKeyValue,\n formatAcceptDateTime,\n formatFieldsForSelect,\n serializeAsConfigurationSettingParam,\n} from \"./internal/helpers\";\nimport { tracingPolicy } from \"@azure/core-http\";\nimport { trace as traceFromTracingHelpers } from \"./internal/tracingHelpers\";\nimport {\n AppConfigurationGetKeyValuesResponse,\n AppConfigurationOptionalParams as GeneratedAppConfigurationClientOptions,\n} from \"./generated/src/models\";\nimport { syncTokenPolicy, SyncTokens } from \"./internal/synctokenpolicy\";\nimport { FeatureFlagValue } from \"./featureFlag\";\nimport { SecretReferenceValue } from \"./secretReference\";\n\nconst packageName = \"azsdk-js-app-configuration\";\n\n/**\n * This constant should always be the same as the package.json's version - we use it when forming the\n * User - Agent header. There's a unit test that makes sure it always stays in sync.\n * @internal\n */\nexport const packageVersion = \"1.3.2\";\nconst apiVersion = \"1.0\";\nconst ConnectionStringRegex = /Endpoint=(.*);Id=(.*);Secret=(.*)/;\nconst deserializationContentTypes = {\n json: [\n \"application/vnd.microsoft.appconfig.kvset+json\",\n \"application/vnd.microsoft.appconfig.kv+json\",\n \"application/vnd.microsoft.appconfig.kvs+json\",\n \"application/vnd.microsoft.appconfig.keyset+json\",\n \"application/vnd.microsoft.appconfig.revs+json\",\n ],\n};\n\n/**\n * Provides configuration options for AppConfigurationClient.\n */\nexport interface AppConfigurationClientOptions {\n // NOTE: AppConfigurationClient is currently using it's own version of the ThrottlingRetryPolicy\n // which we are going to unify with core-http. When we do that we can have this options\n // interface extend PipelineOptions, and also switch over to using`createPipelineFromOptions`\n // which will auto-create all of these policies and remove a lot of code.\n //\n // In the meantime we'll just deal with having our own interface that's compatible with PipelineOptions\n // for the small subset we absolutely need to support.\n\n /**\n * Options for adding user agent details to outgoing requests.\n */\n userAgentOptions?: UserAgentOptions;\n\n /**\n * Options that control how to retry failed requests.\n */\n retryOptions?: RetryOptions;\n}\n\n/**\n * Provides internal configuration options for AppConfigurationClient.\n * @internal\n */\nexport interface InternalAppConfigurationClientOptions extends AppConfigurationClientOptions {\n /**\n * The sync token cache to use for this client.\n * NOTE: this is an internal option, not for general client usage.\n */\n syncTokens?: SyncTokens;\n}\n\n/**\n * Client for the Azure App Configuration service.\n */\nexport class AppConfigurationClient {\n private client: AppConfiguration;\n private _syncTokens: SyncTokens;\n // (for tests)\n private _trace = traceFromTracingHelpers;\n\n /**\n * Initializes a new instance of the AppConfigurationClient class.\n * @param connectionString - Connection string needed for a client to connect to Azure.\n * @param options - Options for the AppConfigurationClient.\n */\n constructor(connectionString: string, options?: AppConfigurationClientOptions);\n /**\n * Initializes a new instance of the AppConfigurationClient class using\n * a TokenCredential.\n * @param endpoint - The endpoint of the App Configuration service (ex: https://sample.azconfig.io).\n * @param tokenCredential - An object that implements the `TokenCredential` interface used to authenticate requests to the service. Use the \\@azure/identity package to create a credential that suits your needs.\n * @param options - Options for the AppConfigurationClient.\n */\n constructor(\n endpoint: string,\n tokenCredential: TokenCredential,\n options?: AppConfigurationClientOptions\n );\n constructor(\n connectionStringOrEndpoint: string,\n tokenCredentialOrOptions?: TokenCredential | AppConfigurationClientOptions,\n options?: AppConfigurationClientOptions\n ) {\n let appConfigOptions: InternalAppConfigurationClientOptions = {};\n let appConfigCredential: ServiceClientCredentials | TokenCredential;\n let appConfigEndpoint: string;\n\n if (isTokenCredential(tokenCredentialOrOptions)) {\n appConfigOptions = (options as InternalAppConfigurationClientOptions) || {};\n appConfigCredential = tokenCredentialOrOptions;\n appConfigEndpoint = connectionStringOrEndpoint;\n } else {\n appConfigOptions = (tokenCredentialOrOptions as InternalAppConfigurationClientOptions) || {};\n const regexMatch = connectionStringOrEndpoint?.match(ConnectionStringRegex);\n if (regexMatch) {\n appConfigCredential = new AppConfigCredential(regexMatch[2], regexMatch[3]);\n appConfigEndpoint = regexMatch[1];\n } else {\n throw new Error(\n `Invalid connection string. Valid connection strings should match the regex '${ConnectionStringRegex.source}'.`\n );\n }\n }\n\n this._syncTokens = appConfigOptions.syncTokens || new SyncTokens();\n\n this.client = new AppConfiguration(\n appConfigCredential,\n appConfigEndpoint,\n apiVersion,\n getGeneratedClientOptions(appConfigEndpoint, this._syncTokens, appConfigOptions)\n );\n }\n\n /**\n * Add a setting into the Azure App Configuration service, failing if it\n * already exists.\n *\n * Example usage:\n * ```ts\n * const result = await client.addConfigurationSetting({ key: \"MyKey\", label: \"MyLabel\", value: \"MyValue\" });\n * ```\n * @param configurationSetting - A configuration setting.\n * @param options - Optional parameters for the request.\n */\n addConfigurationSetting(\n configurationSetting:\n | AddConfigurationSettingParam\n | AddConfigurationSettingParam<FeatureFlagValue>\n | AddConfigurationSettingParam<SecretReferenceValue>,\n options: AddConfigurationSettingOptions = {}\n ): Promise<AddConfigurationSettingResponse> {\n return this._trace(\"addConfigurationSetting\", options, async (newOptions) => {\n const keyValue = serializeAsConfigurationSettingParam(configurationSetting);\n const originalResponse = await this.client.putKeyValue(configurationSetting.key, {\n ifNoneMatch: \"*\",\n label: configurationSetting.label,\n entity: keyValue,\n ...newOptions,\n });\n return transformKeyValueResponse(originalResponse);\n });\n }\n\n /**\n * Delete a setting from the Azure App Configuration service\n *\n * Example usage:\n * ```ts\n * const deletedSetting = await client.deleteConfigurationSetting({ key: \"MyKey\", label: \"MyLabel\" });\n * ```\n * @param id - The id of the configuration setting to delete.\n * @param options - Optional parameters for the request (ex: etag, label)\n */\n deleteConfigurationSetting(\n id: ConfigurationSettingId,\n options: DeleteConfigurationSettingOptions = {}\n ): Promise<DeleteConfigurationSettingResponse> {\n return this._trace(\"deleteConfigurationSetting\", options, async (newOptions) => {\n const originalResponse = await this.client.deleteKeyValue(id.key, {\n label: id.label,\n ...newOptions,\n ...checkAndFormatIfAndIfNoneMatch(id, options),\n });\n\n return transformKeyValueResponseWithStatusCode(originalResponse);\n });\n }\n\n /**\n * Gets a setting from the Azure App Configuration service.\n *\n * Example code:\n * ```ts\n * const setting = await client.getConfigurationSetting({ key: \"MyKey\", label: \"MyLabel\" });\n * ```\n * @param id - The id of the configuration setting to get.\n * @param options - Optional parameters for the request.\n */\n async getConfigurationSetting(\n id: ConfigurationSettingId,\n options: GetConfigurationSettingOptions = {}\n ): Promise<GetConfigurationSettingResponse> {\n return this._trace(\"getConfigurationSetting\", options, async (newOptions) => {\n const originalResponse = await this.client.getKeyValue(id.key, {\n ...newOptions,\n label: id.label,\n select: formatFieldsForSelect(options.fields),\n ...formatAcceptDateTime(options),\n ...checkAndFormatIfAndIfNoneMatch(id, options),\n });\n\n const response: GetConfigurationSettingResponse =\n transformKeyValueResponseWithStatusCode(originalResponse);\n\n // 304 only comes back if the user has passed a conditional option in their\n // request _and_ the remote object has the same etag as what the user passed.\n if (response.statusCode === 304) {\n // this is one of our few 'required' fields so we'll make sure it does get initialized\n // with a value\n response.key = id.key;\n\n // and now we'll undefine all the other properties that are not HTTP related\n makeConfigurationSettingEmpty(response);\n }\n\n return response;\n });\n }\n\n /**\n * Lists settings from the Azure App Configuration service, optionally\n * filtered by key names, labels and accept datetime.\n *\n * Example code:\n * ```ts\n * const allSettingsWithLabel = client.listConfigurationSettings({ labelFilter: \"MyLabel\" });\n * ```\n * @param options - Optional parameters for the request.\n */\n listConfigurationSettings(\n options: ListConfigurationSettingsOptions = {}\n ): PagedAsyncIterableIterator<ConfigurationSetting, ListConfigurationSettingPage, PageSettings> {\n const iter = this.getListConfigurationSettingsIterator(options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: PageSettings = {}) => {\n // The appconfig service doesn't currently support letting you select a page size\n // so we're ignoring their setting for now.\n return this.listConfigurationSettingsByPage({\n ...options,\n continuationToken: settings.continuationToken,\n });\n },\n };\n }\n\n private async *getListConfigurationSettingsIterator(\n options: ListConfigurationSettingsOptions\n ): AsyncIterableIterator<ConfigurationSetting> {\n for await (const page of this.listConfigurationSettingsByPage(options)) {\n for (const configurationSetting of page.items) {\n yield configurationSetting;\n }\n }\n }\n\n private async *listConfigurationSettingsByPage(\n options: ListConfigurationSettingsOptions & PageSettings = {}\n ): AsyncIterableIterator<ListConfigurationSettingPage> {\n let currentResponse = await this._trace(\n \"listConfigurationSettings\",\n options,\n async (newOptions) => {\n const response = await this.client.getKeyValues({\n ...newOptions,\n ...formatAcceptDateTime(options),\n ...formatFiltersAndSelect(options),\n after: options.continuationToken,\n });\n\n return response;\n }\n );\n\n yield* this.createListConfigurationPageFromResponse(currentResponse);\n\n while (currentResponse.nextLink) {\n currentResponse = await this._trace(\n \"listConfigurationSettings\",\n options,\n // TODO: same code up above. Unify.\n async (newOptions) => {\n const response = await this.client.getKeyValues({\n ...newOptions,\n ...formatAcceptDateTime(options),\n ...formatFiltersAndSelect(options),\n after: extractAfterTokenFromNextLink(currentResponse.nextLink!),\n });\n\n return response;\n }\n );\n\n if (!currentResponse.items) {\n break;\n }\n\n yield* this.createListConfigurationPageFromResponse(currentResponse);\n }\n }\n\n private *createListConfigurationPageFromResponse(\n currentResponse: AppConfigurationGetKeyValuesResponse\n ): Generator<ListConfigurationSettingPage> {\n yield {\n ...currentResponse,\n items: currentResponse.items != null ? currentResponse.items.map(transformKeyValue) : [],\n continuationToken: currentResponse.nextLink\n ? extractAfterTokenFromNextLink(currentResponse.nextLink)\n : undefined,\n };\n }\n\n /**\n * Lists revisions of a set of keys, optionally filtered by key names,\n * labels and accept datetime.\n *\n * Example code:\n * ```ts\n * const revisionsIterator = client.listRevisions({ keys: [\"MyKey\"] });\n * ```\n * @param options - Optional parameters for the request.\n */\n listRevisions(\n options?: ListRevisionsOptions\n ): PagedAsyncIterableIterator<ConfigurationSetting, ListRevisionsPage, PageSettings> {\n const iter = this.getListRevisionsIterator(options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: PageSettings = {}) => {\n // The appconfig service doesn't currently support letting you select a page size\n // so we're ignoring their setting for now.\n return this.listRevisionsByPage({\n ...options,\n continuationToken: settings.continuationToken,\n });\n },\n };\n }\n\n private async *getListRevisionsIterator(\n options?: ListRevisionsOptions\n ): AsyncIterableIterator<ConfigurationSetting> {\n for await (const page of this.listRevisionsByPage(options)) {\n for (const item of page.items) {\n yield item;\n }\n }\n }\n\n private async *listRevisionsByPage(\n options: ListRevisionsOptions & PageSettings = {}\n ): AsyncIterableIterator<ListRevisionsPage> {\n let currentResponse = await this._trace(\"listRevisions\", options, async (newOptions) => {\n const response = await this.client.getRevisions({\n ...newOptions,\n ...formatAcceptDateTime(options),\n ...formatFiltersAndSelect(newOptions),\n after: options.continuationToken,\n });\n\n return response;\n });\n\n yield* this.createListRevisionsPageFromResponse(currentResponse);\n\n while (currentResponse.nextLink) {\n currentResponse = await this._trace(\"listRevisions\", options, (newOptions) => {\n return this.client.getRevisions({\n ...newOptions,\n ...formatAcceptDateTime(options),\n ...formatFiltersAndSelect(options),\n after: extractAfterTokenFromNextLink(currentResponse.nextLink!),\n });\n });\n\n if (!currentResponse.items) {\n break;\n }\n\n yield* this.createListRevisionsPageFromResponse(currentResponse);\n }\n }\n\n private *createListRevisionsPageFromResponse(\n currentResponse: AppConfigurationGetKeyValuesResponse\n ) {\n yield {\n ...currentResponse,\n items: currentResponse.items != null ? currentResponse.items.map(transformKeyValue) : [],\n continuationToken: currentResponse.nextLink\n ? extractAfterTokenFromNextLink(currentResponse.nextLink)\n : undefined,\n };\n }\n\n /**\n * Sets the value of a key in the Azure App Configuration service, allowing for an optional etag.\n * @param key - The name of the key.\n * @param configurationSetting - A configuration value.\n * @param options - Optional parameters for the request.\n *\n * Example code:\n * ```ts\n * await client.setConfigurationSetting({ key: \"MyKey\", value: \"MyValue\" });\n * ```\n */\n async setConfigurationSetting(\n configurationSetting:\n | SetConfigurationSettingParam\n | SetConfigurationSettingParam<FeatureFlagValue>\n | SetConfigurationSettingParam<SecretReferenceValue>,\n options: SetConfigurationSettingOptions = {}\n ): Promise<SetConfigurationSettingResponse> {\n return this._trace(\"setConfigurationSetting\", options, async (newOptions) => {\n const keyValue = serializeAsConfigurationSettingParam(configurationSetting);\n const response = await this.client.putKeyValue(configurationSetting.key, {\n ...newOptions,\n label: configurationSetting.label,\n entity: keyValue,\n ...checkAndFormatIfAndIfNoneMatch(configurationSetting, options),\n });\n\n return transformKeyValueResponse(response);\n });\n }\n\n /**\n * Sets or clears a key's read-only status.\n * @param id - The id of the configuration setting to modify.\n */\n async setReadOnly(\n id: ConfigurationSettingId,\n readOnly: boolean,\n options: SetReadOnlyOptions = {}\n ): Promise<SetReadOnlyResponse> {\n return this._trace(\"setReadOnly\", options, async (newOptions) => {\n if (readOnly) {\n const response = await this.client.putLock(id.key, {\n ...newOptions,\n label: id.label,\n ...checkAndFormatIfAndIfNoneMatch(id, options),\n });\n\n return transformKeyValueResponse(response);\n } else {\n const response = await this.client.deleteLock(id.key, {\n ...newOptions,\n label: id.label,\n ...checkAndFormatIfAndIfNoneMatch(id, options),\n });\n\n return transformKeyValueResponse(response);\n }\n });\n }\n\n /**\n * Adds an external synchronization token to ensure service requests receive up-to-date values.\n *\n * @param syncToken - The synchronization token value.\n */\n updateSyncToken(syncToken: string): void {\n this._syncTokens.addSyncTokenFromHeaderValue(syncToken);\n }\n}\n/**\n * Gets the options for the generated AppConfigurationClient\n * @internal\n */\nexport function getGeneratedClientOptions(\n endpoint: string,\n syncTokens: SyncTokens,\n internalAppConfigOptions: InternalAppConfigurationClientOptions\n): GeneratedAppConfigurationClientOptions {\n const retryPolicies = [\n exponentialRetryPolicy(),\n systemErrorRetryPolicy(),\n throttlingRetryPolicy(internalAppConfigOptions.retryOptions),\n ];\n\n const userAgent = getUserAgentPrefix(\n internalAppConfigOptions.userAgentOptions &&\n internalAppConfigOptions.userAgentOptions.userAgentPrefix\n );\n\n return {\n endpoint,\n deserializationContentTypes,\n // we'll add in our own custom retry policies\n noRetryPolicy: true,\n requestPolicyFactories: (defaults) => [\n tracingPolicy({ userAgent }),\n syncTokenPolicy(syncTokens),\n userAgentPolicy({ value: userAgent }),\n ...retryPolicies,\n ...defaults,\n ],\n generateClientRequestIdHeader: true,\n };\n}\n\n/**\n * @internal\n */\nexport function getUserAgentPrefix(userSuppliedUserAgent: string | undefined): string {\n const appConfigDefaultUserAgent = `${packageName}/${packageVersion} ${getCoreHttpDefaultUserAgentValue()}`;\n\n if (!userSuppliedUserAgent) {\n return appConfigDefaultUserAgent;\n }\n\n return `${userSuppliedUserAgent} ${appConfigDefaultUserAgent}`;\n}\n"]}
1
+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AoB,CAAC,KAAK,EACjC,MAAM,EAAE,QAAQ,KACb,8BAA8B,CAAC,oBAAoB,EAAE,OAAO,CAAC,EAChE,CACH,CAAC;YACF,cAAc,CAAC,QAAQ,CAAC,CAAC;YACzB,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,WAAW,CACf,EAA0B,EAC1B,QAAiB,EACjB,UAA8B,EAAE;QAEhC,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE;YAC9D,IAAI,QAAQ,CAAC;YACb,IAAI,QAAQ,EAAE;gBACZ,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,gDACtC,UAAU,KACb,KAAK,EAAE,EAAE,CAAC,KAAK,KACZ,8BAA8B,CAAC,EAAE,EAAE,OAAO,CAAC,EAC9C,CAAC;aACJ;iBAAM;gBACL,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,gDACzC,UAAU,KACb,KAAK,EAAE,EAAE,CAAC,KAAK,KACZ,8BAA8B,CAAC,EAAE,EAAE,OAAO,CAAC,EAC9C,CAAC;aACJ;YACD,QAAQ,GAAG,yBAAyB,CAAC,QAAQ,CAAC,CAAC;YAC/C,cAAc,CAAC,QAAQ,CAAC,CAAC;YACzB,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,eAAe,CAAC,SAAiB;QAC/B,IAAI,CAAC,WAAW,CAAC,2BAA2B,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// https://azure.github.io/azure-sdk/typescript_design.html#ts-config-lib\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport { appConfigKeyCredentialPolicy } from \"./appConfigCredential\";\nimport { AppConfiguration } from \"./generated/src/appConfiguration\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { TokenCredential, isTokenCredential } from \"@azure/core-auth\";\n\nimport \"@azure/core-asynciterator-polyfill\";\n\nimport {\n AddConfigurationSettingOptions,\n AddConfigurationSettingParam,\n AddConfigurationSettingResponse,\n ConfigurationSetting,\n ConfigurationSettingId,\n DeleteConfigurationSettingOptions,\n DeleteConfigurationSettingResponse,\n GetConfigurationSettingOptions,\n GetConfigurationSettingResponse,\n HttpResponseField,\n ListConfigurationSettingPage,\n ListConfigurationSettingsOptions,\n ListRevisionsOptions,\n ListRevisionsPage,\n PageSettings,\n SetConfigurationSettingOptions,\n SetConfigurationSettingParam,\n SetConfigurationSettingResponse,\n SetReadOnlyOptions,\n SetReadOnlyResponse,\n} from \"./models\";\nimport {\n assertResponse,\n checkAndFormatIfAndIfNoneMatch,\n extractAfterTokenFromNextLink,\n formatAcceptDateTime,\n formatFieldsForSelect,\n formatFiltersAndSelect,\n makeConfigurationSettingEmpty,\n serializeAsConfigurationSettingParam,\n transformKeyValue,\n transformKeyValueResponse,\n transformKeyValueResponseWithStatusCode,\n} from \"./internal/helpers\";\nimport { trace as traceFromTracingHelpers } from \"./internal/tracingHelpers\";\nimport {\n AppConfigurationGetKeyValuesHeaders,\n AppConfigurationGetRevisionsHeaders,\n GetKeyValuesResponse,\n GetRevisionsResponse,\n} from \"./generated/src/models\";\nimport { SyncTokens, syncTokenPolicy } from \"./internal/synctokenpolicy\";\nimport { FeatureFlagValue } from \"./featureFlag\";\nimport { SecretReferenceValue } from \"./secretReference\";\nimport {\n CommonClientOptions,\n deserializationPolicy,\n deserializationPolicyName,\n} from \"@azure/core-client\";\nimport { PipelinePolicy, bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * @internal\n */\nexport const packageVersion = \"1.4.0-beta.1\";\nconst apiVersion = \"1.0\";\nconst ConnectionStringRegex = /Endpoint=(.*);Id=(.*);Secret=(.*)/;\nconst deserializationContentTypes = {\n json: [\n \"application/vnd.microsoft.appconfig.kvset+json\",\n \"application/vnd.microsoft.appconfig.kv+json\",\n \"application/vnd.microsoft.appconfig.kvs+json\",\n \"application/vnd.microsoft.appconfig.keyset+json\",\n \"application/vnd.microsoft.appconfig.revs+json\",\n ],\n};\n\n/**\n * Provides configuration options for AppConfigurationClient.\n */\nexport interface AppConfigurationClientOptions extends CommonClientOptions {}\n\n/**\n * Provides internal configuration options for AppConfigurationClient.\n * @internal\n */\nexport interface InternalAppConfigurationClientOptions extends AppConfigurationClientOptions {\n /**\n * The sync token cache to use for this client.\n * NOTE: this is an internal option, not for general client usage.\n */\n syncTokens?: SyncTokens;\n}\n\n/**\n * Client for the Azure App Configuration service.\n */\nexport class AppConfigurationClient {\n private client: AppConfiguration;\n private _syncTokens: SyncTokens;\n // (for tests)\n private _trace = traceFromTracingHelpers;\n\n /**\n * Initializes a new instance of the AppConfigurationClient class.\n * @param connectionString - Connection string needed for a client to connect to Azure.\n * @param options - Options for the AppConfigurationClient.\n */\n constructor(connectionString: string, options?: AppConfigurationClientOptions);\n /**\n * Initializes a new instance of the AppConfigurationClient class using\n * a TokenCredential.\n * @param endpoint - The endpoint of the App Configuration service (ex: https://sample.azconfig.io).\n * @param tokenCredential - An object that implements the `TokenCredential` interface used to authenticate requests to the service. Use the \\@azure/identity package to create a credential that suits your needs.\n * @param options - Options for the AppConfigurationClient.\n */\n constructor(\n endpoint: string,\n tokenCredential: TokenCredential,\n options?: AppConfigurationClientOptions\n );\n constructor(\n connectionStringOrEndpoint: string,\n tokenCredentialOrOptions?: TokenCredential | AppConfigurationClientOptions,\n options?: AppConfigurationClientOptions\n ) {\n let appConfigOptions: InternalAppConfigurationClientOptions = {};\n let appConfigCredential: TokenCredential;\n let appConfigEndpoint: string;\n let authPolicy: PipelinePolicy;\n\n if (isTokenCredential(tokenCredentialOrOptions)) {\n appConfigOptions = (options as InternalAppConfigurationClientOptions) || {};\n appConfigCredential = tokenCredentialOrOptions;\n appConfigEndpoint = connectionStringOrEndpoint.endsWith(\"/\")\n ? connectionStringOrEndpoint.slice(0, -1)\n : connectionStringOrEndpoint;\n authPolicy = bearerTokenAuthenticationPolicy({\n scopes: `${appConfigEndpoint}/.default`,\n credential: appConfigCredential,\n });\n } else {\n appConfigOptions = (tokenCredentialOrOptions as InternalAppConfigurationClientOptions) || {};\n const regexMatch = connectionStringOrEndpoint?.match(ConnectionStringRegex);\n if (regexMatch) {\n appConfigEndpoint = regexMatch[1];\n authPolicy = appConfigKeyCredentialPolicy(regexMatch[2], regexMatch[3]);\n } else {\n throw new Error(\n `Invalid connection string. Valid connection strings should match the regex '${ConnectionStringRegex.source}'.`\n );\n }\n }\n\n this._syncTokens = appConfigOptions.syncTokens || new SyncTokens();\n this.client = new AppConfiguration(appConfigEndpoint, apiVersion, appConfigOptions);\n this.client.pipeline.addPolicy(authPolicy, { phase: \"Sign\" });\n this.client.pipeline.addPolicy(syncTokenPolicy(this._syncTokens), { afterPhase: \"Retry\" });\n this.client.pipeline.removePolicy({ name: deserializationPolicyName });\n this.client.pipeline.addPolicy(\n deserializationPolicy({ expectedContentTypes: deserializationContentTypes }),\n { phase: \"Deserialize\" }\n );\n }\n\n /**\n * Add a setting into the Azure App Configuration service, failing if it\n * already exists.\n *\n * Example usage:\n * ```ts\n * const result = await client.addConfigurationSetting({ key: \"MyKey\", label: \"MyLabel\", value: \"MyValue\" });\n * ```\n * @param configurationSetting - A configuration setting.\n * @param options - Optional parameters for the request.\n */\n addConfigurationSetting(\n configurationSetting:\n | AddConfigurationSettingParam\n | AddConfigurationSettingParam<FeatureFlagValue>\n | AddConfigurationSettingParam<SecretReferenceValue>,\n options: AddConfigurationSettingOptions = {}\n ): Promise<AddConfigurationSettingResponse> {\n return this._trace(\"addConfigurationSetting\", options, async (newOptions) => {\n const keyValue = serializeAsConfigurationSettingParam(configurationSetting);\n const originalResponse = await this.client.putKeyValue(configurationSetting.key, {\n ifNoneMatch: \"*\",\n label: configurationSetting.label,\n entity: keyValue,\n ...newOptions,\n });\n const response = transformKeyValueResponse(originalResponse);\n assertResponse(response);\n return response;\n });\n }\n\n /**\n * Delete a setting from the Azure App Configuration service\n *\n * Example usage:\n * ```ts\n * const deletedSetting = await client.deleteConfigurationSetting({ key: \"MyKey\", label: \"MyLabel\" });\n * ```\n * @param id - The id of the configuration setting to delete.\n * @param options - Optional parameters for the request (ex: etag, label)\n */\n deleteConfigurationSetting(\n id: ConfigurationSettingId,\n options: DeleteConfigurationSettingOptions = {}\n ): Promise<DeleteConfigurationSettingResponse> {\n return this._trace(\"deleteConfigurationSetting\", options, async (newOptions) => {\n let status;\n const originalResponse = await this.client.deleteKeyValue(id.key, {\n label: id.label,\n ...newOptions,\n ...checkAndFormatIfAndIfNoneMatch(id, options),\n onResponse: (response) => {\n status = response.status;\n },\n });\n\n const response = transformKeyValueResponseWithStatusCode(originalResponse, status);\n assertResponse(response);\n return response;\n });\n }\n\n /**\n * Gets a setting from the Azure App Configuration service.\n *\n * Example code:\n * ```ts\n * const setting = await client.getConfigurationSetting({ key: \"MyKey\", label: \"MyLabel\" });\n * ```\n * @param id - The id of the configuration setting to get.\n * @param options - Optional parameters for the request.\n */\n async getConfigurationSetting(\n id: ConfigurationSettingId,\n options: GetConfigurationSettingOptions = {}\n ): Promise<GetConfigurationSettingResponse> {\n return this._trace(\"getConfigurationSetting\", options, async (newOptions) => {\n let status;\n const originalResponse = await this.client.getKeyValue(id.key, {\n ...newOptions,\n label: id.label,\n select: formatFieldsForSelect(options.fields),\n ...formatAcceptDateTime(options),\n ...checkAndFormatIfAndIfNoneMatch(id, options),\n onResponse: (response) => {\n status = response.status;\n },\n });\n\n const response = transformKeyValueResponseWithStatusCode(originalResponse, status);\n\n // 304 only comes back if the user has passed a conditional option in their\n // request _and_ the remote object has the same etag as what the user passed.\n if (response.statusCode === 304) {\n // this is one of our few 'required' fields so we'll make sure it does get initialized\n // with a value\n response.key = id.key;\n\n // and now we'll undefine all the other properties that are not HTTP related\n makeConfigurationSettingEmpty(response);\n }\n assertResponse(response);\n return response;\n });\n }\n\n /**\n * Lists settings from the Azure App Configuration service, optionally\n * filtered by key names, labels and accept datetime.\n *\n * Example code:\n * ```ts\n * const allSettingsWithLabel = client.listConfigurationSettings({ labelFilter: \"MyLabel\" });\n * ```\n * @param options - Optional parameters for the request.\n */\n listConfigurationSettings(\n options: ListConfigurationSettingsOptions = {}\n ): PagedAsyncIterableIterator<ConfigurationSetting, ListConfigurationSettingPage, PageSettings> {\n const iter = this.getListConfigurationSettingsIterator(options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: PageSettings = {}) => {\n // The appconfig service doesn't currently support letting you select a page size\n // so we're ignoring their setting for now.\n return this.listConfigurationSettingsByPage({\n ...options,\n continuationToken: settings.continuationToken,\n });\n },\n };\n }\n\n private async *getListConfigurationSettingsIterator(\n options: ListConfigurationSettingsOptions\n ): AsyncIterableIterator<ConfigurationSetting> {\n for await (const page of this.listConfigurationSettingsByPage(options)) {\n for (const configurationSetting of page.items) {\n yield configurationSetting;\n }\n }\n }\n\n private async *listConfigurationSettingsByPage(\n options: ListConfigurationSettingsOptions & PageSettings = {}\n ): AsyncIterableIterator<ListConfigurationSettingPage> {\n let currentResponse = await this._trace(\n \"listConfigurationSettings\",\n options,\n async (newOptions) => {\n const response = await this.client.getKeyValues({\n ...newOptions,\n ...formatAcceptDateTime(options),\n ...formatFiltersAndSelect(options),\n after: options.continuationToken,\n });\n\n return response as GetKeyValuesResponse &\n HttpResponseField<AppConfigurationGetKeyValuesHeaders>;\n }\n );\n\n yield* this.createListConfigurationPageFromResponse(currentResponse);\n\n while (currentResponse.nextLink) {\n currentResponse = await this._trace(\n \"listConfigurationSettings\",\n options,\n // TODO: same code up above. Unify.\n async (newOptions) => {\n const response = await this.client.getKeyValues({\n ...newOptions,\n ...formatAcceptDateTime(options),\n ...formatFiltersAndSelect(options),\n after: extractAfterTokenFromNextLink(currentResponse.nextLink!),\n });\n\n return response as GetKeyValuesResponse &\n HttpResponseField<AppConfigurationGetKeyValuesHeaders>;\n }\n );\n\n if (!currentResponse.items) {\n break;\n }\n\n yield* this.createListConfigurationPageFromResponse(currentResponse);\n }\n }\n\n private *createListConfigurationPageFromResponse(\n currentResponse: GetKeyValuesResponse & HttpResponseField<AppConfigurationGetKeyValuesHeaders>\n ): Generator<ListConfigurationSettingPage> {\n yield {\n ...currentResponse,\n items: currentResponse.items != null ? currentResponse.items.map(transformKeyValue) : [],\n continuationToken: currentResponse.nextLink\n ? extractAfterTokenFromNextLink(currentResponse.nextLink)\n : undefined,\n };\n }\n\n /**\n * Lists revisions of a set of keys, optionally filtered by key names,\n * labels and accept datetime.\n *\n * Example code:\n * ```ts\n * const revisionsIterator = client.listRevisions({ keys: [\"MyKey\"] });\n * ```\n * @param options - Optional parameters for the request.\n */\n listRevisions(\n options?: ListRevisionsOptions\n ): PagedAsyncIterableIterator<ConfigurationSetting, ListRevisionsPage, PageSettings> {\n const iter = this.getListRevisionsIterator(options);\n\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: PageSettings = {}) => {\n // The appconfig service doesn't currently support letting you select a page size\n // so we're ignoring their setting for now.\n return this.listRevisionsByPage({\n ...options,\n continuationToken: settings.continuationToken,\n });\n },\n };\n }\n\n private async *getListRevisionsIterator(\n options?: ListRevisionsOptions\n ): AsyncIterableIterator<ConfigurationSetting> {\n for await (const page of this.listRevisionsByPage(options)) {\n for (const item of page.items) {\n yield item;\n }\n }\n }\n\n private async *listRevisionsByPage(\n options: ListRevisionsOptions & PageSettings = {}\n ): AsyncIterableIterator<ListRevisionsPage> {\n let currentResponse = await this._trace(\"listRevisions\", options, async (newOptions) => {\n const response = await this.client.getRevisions({\n ...newOptions,\n ...formatAcceptDateTime(options),\n ...formatFiltersAndSelect(newOptions),\n after: options.continuationToken,\n });\n\n return response as GetRevisionsResponse &\n HttpResponseField<AppConfigurationGetRevisionsHeaders>;\n });\n\n yield* this.createListRevisionsPageFromResponse(currentResponse);\n\n while (currentResponse.nextLink) {\n currentResponse = (await this._trace(\"listRevisions\", options, (newOptions) => {\n return this.client.getRevisions({\n ...newOptions,\n ...formatAcceptDateTime(options),\n ...formatFiltersAndSelect(options),\n after: extractAfterTokenFromNextLink(currentResponse.nextLink!),\n });\n })) as GetRevisionsResponse & HttpResponseField<AppConfigurationGetRevisionsHeaders>;\n\n if (!currentResponse.items) {\n break;\n }\n\n yield* this.createListRevisionsPageFromResponse(currentResponse);\n }\n }\n\n private *createListRevisionsPageFromResponse(\n currentResponse: GetKeyValuesResponse & HttpResponseField<AppConfigurationGetKeyValuesHeaders>\n ) {\n yield {\n ...currentResponse,\n items: currentResponse.items != null ? currentResponse.items.map(transformKeyValue) : [],\n continuationToken: currentResponse.nextLink\n ? extractAfterTokenFromNextLink(currentResponse.nextLink)\n : undefined,\n };\n }\n\n /**\n * Sets the value of a key in the Azure App Configuration service, allowing for an optional etag.\n * @param key - The name of the key.\n * @param configurationSetting - A configuration value.\n * @param options - Optional parameters for the request.\n *\n * Example code:\n * ```ts\n * await client.setConfigurationSetting({ key: \"MyKey\", value: \"MyValue\" });\n * ```\n */\n async setConfigurationSetting(\n configurationSetting:\n | SetConfigurationSettingParam\n | SetConfigurationSettingParam<FeatureFlagValue>\n | SetConfigurationSettingParam<SecretReferenceValue>,\n options: SetConfigurationSettingOptions = {}\n ): Promise<SetConfigurationSettingResponse> {\n return this._trace(\"setConfigurationSetting\", options, async (newOptions) => {\n const keyValue = serializeAsConfigurationSettingParam(configurationSetting);\n const response = transformKeyValueResponse(\n await this.client.putKeyValue(configurationSetting.key, {\n ...newOptions,\n label: configurationSetting.label,\n entity: keyValue,\n ...checkAndFormatIfAndIfNoneMatch(configurationSetting, options),\n })\n );\n assertResponse(response);\n return response;\n });\n }\n\n /**\n * Sets or clears a key's read-only status.\n * @param id - The id of the configuration setting to modify.\n */\n async setReadOnly(\n id: ConfigurationSettingId,\n readOnly: boolean,\n options: SetReadOnlyOptions = {}\n ): Promise<SetReadOnlyResponse> {\n return this._trace(\"setReadOnly\", options, async (newOptions) => {\n let response;\n if (readOnly) {\n response = await this.client.putLock(id.key, {\n ...newOptions,\n label: id.label,\n ...checkAndFormatIfAndIfNoneMatch(id, options),\n });\n } else {\n response = await this.client.deleteLock(id.key, {\n ...newOptions,\n label: id.label,\n ...checkAndFormatIfAndIfNoneMatch(id, options),\n });\n }\n response = transformKeyValueResponse(response);\n assertResponse(response);\n return response;\n });\n }\n\n /**\n * Adds an external synchronization token to ensure service requests receive up-to-date values.\n *\n * @param syncToken - The synchronization token value.\n */\n updateSyncToken(syncToken: string): void {\n this._syncTokens.addSyncTokenFromHeaderValue(syncToken);\n }\n}\n"]}