@azure/communication-common 2.4.2-alpha.20260210.1 → 2.4.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 (90) hide show
  1. package/README.md +1 -1
  2. package/dist/browser/credential/communicationAccessKeyCredentialPolicy.d.ts.map +1 -1
  3. package/dist/browser/credential/communicationAccessKeyCredentialPolicy.js +6 -10
  4. package/dist/browser/credential/communicationAccessKeyCredentialPolicy.js.map +1 -1
  5. package/dist/browser/entraTokenCredential.d.ts.map +1 -1
  6. package/dist/browser/entraTokenCredential.js +12 -7
  7. package/dist/browser/entraTokenCredential.js.map +1 -1
  8. package/dist/browser/index.d.ts +3 -3
  9. package/dist/browser/index.d.ts.map +1 -1
  10. package/dist/browser/index.js.map +1 -1
  11. package/dist/commonjs/autoRefreshTokenCredential.js +110 -95
  12. package/dist/commonjs/autoRefreshTokenCredential.js.map +7 -1
  13. package/dist/commonjs/azureCommunicationTokenCredential.js +64 -47
  14. package/dist/commonjs/azureCommunicationTokenCredential.js.map +7 -1
  15. package/dist/commonjs/communicationTokenCredential.js +16 -5
  16. package/dist/commonjs/communicationTokenCredential.js.map +7 -1
  17. package/dist/commonjs/credential/clientArguments.js +46 -40
  18. package/dist/commonjs/credential/clientArguments.js.map +7 -1
  19. package/dist/commonjs/credential/communicationAccessKeyCredentialPolicy.d.ts.map +1 -1
  20. package/dist/commonjs/credential/communicationAccessKeyCredentialPolicy.js +53 -42
  21. package/dist/commonjs/credential/communicationAccessKeyCredentialPolicy.js.map +7 -1
  22. package/dist/commonjs/credential/communicationAuthPolicy.js +39 -26
  23. package/dist/commonjs/credential/communicationAuthPolicy.js.map +7 -1
  24. package/dist/commonjs/credential/connectionString.js +39 -28
  25. package/dist/commonjs/credential/connectionString.js.map +7 -1
  26. package/dist/commonjs/credential/index.js +28 -10
  27. package/dist/commonjs/credential/index.js.map +7 -1
  28. package/dist/commonjs/entraTokenCredential.d.ts.map +1 -1
  29. package/dist/commonjs/entraTokenCredential.js +137 -113
  30. package/dist/commonjs/entraTokenCredential.js.map +7 -1
  31. package/dist/commonjs/identifierModelSerializer.js +172 -159
  32. package/dist/commonjs/identifierModelSerializer.js.map +7 -1
  33. package/dist/commonjs/identifierModels.js +183 -205
  34. package/dist/commonjs/identifierModels.js.map +7 -1
  35. package/dist/commonjs/index.d.ts +3 -3
  36. package/dist/commonjs/index.d.ts.map +1 -1
  37. package/dist/commonjs/index.js +35 -12
  38. package/dist/commonjs/index.js.map +7 -1
  39. package/dist/commonjs/staticTokenCredential.js +36 -20
  40. package/dist/commonjs/staticTokenCredential.js.map +7 -1
  41. package/dist/commonjs/tokenParser.js +33 -13
  42. package/dist/commonjs/tokenParser.js.map +7 -1
  43. package/dist/commonjs/tsdoc-metadata.json +1 -1
  44. package/dist/esm/credential/communicationAccessKeyCredentialPolicy.d.ts.map +1 -1
  45. package/dist/esm/credential/communicationAccessKeyCredentialPolicy.js +6 -10
  46. package/dist/esm/credential/communicationAccessKeyCredentialPolicy.js.map +1 -1
  47. package/dist/esm/entraTokenCredential.d.ts.map +1 -1
  48. package/dist/esm/entraTokenCredential.js +12 -7
  49. package/dist/esm/entraTokenCredential.js.map +1 -1
  50. package/dist/esm/index.d.ts +3 -3
  51. package/dist/esm/index.d.ts.map +1 -1
  52. package/dist/esm/index.js.map +1 -1
  53. package/dist/react-native/credential/communicationAccessKeyCredentialPolicy.d.ts.map +1 -1
  54. package/dist/react-native/credential/communicationAccessKeyCredentialPolicy.js +6 -10
  55. package/dist/react-native/credential/communicationAccessKeyCredentialPolicy.js.map +1 -1
  56. package/dist/react-native/entraTokenCredential.d.ts.map +1 -1
  57. package/dist/react-native/entraTokenCredential.js +12 -7
  58. package/dist/react-native/entraTokenCredential.js.map +1 -1
  59. package/dist/react-native/index.d.ts +3 -3
  60. package/dist/react-native/index.d.ts.map +1 -1
  61. package/dist/react-native/index.js.map +1 -1
  62. package/package.json +30 -37
  63. package/dist/browser/credential/cryptoUtils-browser.d.mts.map +0 -1
  64. package/dist/browser/credential/cryptoUtils-browser.mjs.map +0 -1
  65. package/dist/browser/credential/cryptoUtils.d.ts +0 -3
  66. package/dist/browser/credential/cryptoUtils.js +0 -19
  67. package/dist/browser/credential/encodeUtils-browser.d.mts +0 -4
  68. package/dist/browser/credential/encodeUtils-browser.d.mts.map +0 -1
  69. package/dist/browser/credential/encodeUtils-browser.mjs +0 -19
  70. package/dist/browser/credential/encodeUtils-browser.mjs.map +0 -1
  71. package/dist/commonjs/credential/cryptoUtils.d.ts +0 -3
  72. package/dist/commonjs/credential/cryptoUtils.d.ts.map +0 -1
  73. package/dist/commonjs/credential/cryptoUtils.js +0 -14
  74. package/dist/commonjs/credential/cryptoUtils.js.map +0 -1
  75. package/dist/esm/credential/cryptoUtils.d.ts +0 -3
  76. package/dist/esm/credential/cryptoUtils.d.ts.map +0 -1
  77. package/dist/esm/credential/cryptoUtils.js +0 -9
  78. package/dist/esm/credential/cryptoUtils.js.map +0 -1
  79. package/dist/esm/credential/encodeUtils-browser.d.mts +0 -4
  80. package/dist/esm/credential/encodeUtils-browser.d.mts.map +0 -1
  81. package/dist/esm/credential/encodeUtils-browser.mjs +0 -19
  82. package/dist/esm/credential/encodeUtils-browser.mjs.map +0 -1
  83. package/dist/react-native/credential/cryptoUtils.d.ts +0 -3
  84. package/dist/react-native/credential/cryptoUtils.d.ts.map +0 -1
  85. package/dist/react-native/credential/cryptoUtils.js +0 -9
  86. package/dist/react-native/credential/cryptoUtils.js.map +0 -1
  87. package/dist/react-native/credential/encodeUtils-browser.d.mts +0 -4
  88. package/dist/react-native/credential/encodeUtils-browser.d.mts.map +0 -1
  89. package/dist/react-native/credential/encodeUtils-browser.mjs +0 -19
  90. package/dist/react-native/credential/encodeUtils-browser.mjs.map +0 -1
@@ -1,5 +1,16 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- //# sourceMappingURL=communicationTokenCredential.js.map
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var communicationTokenCredential_exports = {};
15
+ module.exports = __toCommonJS(communicationTokenCredential_exports);
16
+ //# sourceMappingURL=communicationTokenCredential.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"communicationTokenCredential.js","sourceRoot":"","sources":["../../src/communicationTokenCredential.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { AccessToken } from \"@azure/core-auth\";\n\nexport type TokenCredential = Pick<CommunicationTokenCredential, \"getToken\" | \"dispose\">;\n\n/**\n * Options for `CommunicationTokenCredential`'s `getToken` function.\n */\nexport interface CommunicationGetTokenOptions {\n /**\n * An implementation of `AbortSignalLike` to cancel the operation.\n */\n abortSignal?: AbortSignalLike;\n}\n\n/**\n * The Azure Communication Services token credential.\n */\nexport interface CommunicationTokenCredential {\n /**\n * Gets an `AccessToken` for the user. Throws if already disposed.\n * @param options - Additional options.\n */\n getToken(options?: CommunicationGetTokenOptions): Promise<AccessToken>;\n /**\n * Disposes the CommunicationTokenCredential and cancels any internal auto-refresh operation.\n */\n dispose(): void;\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/communicationTokenCredential.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { AccessToken } from \"@azure/core-auth\";\n\nexport type TokenCredential = Pick<CommunicationTokenCredential, \"getToken\" | \"dispose\">;\n\n/**\n * Options for `CommunicationTokenCredential`'s `getToken` function.\n */\nexport interface CommunicationGetTokenOptions {\n /**\n * An implementation of `AbortSignalLike` to cancel the operation.\n */\n abortSignal?: AbortSignalLike;\n}\n\n/**\n * The Azure Communication Services token credential.\n */\nexport interface CommunicationTokenCredential {\n /**\n * Gets an `AccessToken` for the user. Throws if already disposed.\n * @param options - Additional options.\n */\n getToken(options?: CommunicationGetTokenOptions): Promise<AccessToken>;\n /**\n * Disposes the CommunicationTokenCredential and cancels any internal auto-refresh operation.\n */\n dispose(): void;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -1,48 +1,54 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.parseClientArguments = exports.isKeyCredential = void 0;
6
- const core_auth_1 = require("@azure/core-auth");
7
- const connectionString_js_1 = require("./connectionString.js");
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var clientArguments_exports = {};
19
+ __export(clientArguments_exports, {
20
+ isKeyCredential: () => isKeyCredential,
21
+ parseClientArguments: () => parseClientArguments
22
+ });
23
+ module.exports = __toCommonJS(clientArguments_exports);
24
+ var import_core_auth = require("@azure/core-auth");
25
+ var import_connectionString = require("./connectionString.js");
8
26
  const isValidEndpoint = (host) => {
9
- const url = new URL(host);
10
- return (!!url.protocol?.match(/^http[s]?/) &&
11
- url.host !== undefined &&
12
- url.host !== "" &&
13
- (url.pathname === undefined || url.pathname === "" || url.pathname === "/"));
27
+ const url = new URL(host);
28
+ return !!url.protocol?.match(/^http[s]?/) && url.host !== void 0 && url.host !== "" && (url.pathname === void 0 || url.pathname === "" || url.pathname === "/");
14
29
  };
15
30
  const assertValidEndpoint = (host) => {
16
- if (!isValidEndpoint(host)) {
17
- throw new Error(`Invalid endpoint url ${host}`);
18
- }
31
+ if (!isValidEndpoint(host)) {
32
+ throw new Error(`Invalid endpoint url ${host}`);
33
+ }
19
34
  };
20
- /**
21
- * Checks whether a value is a KeyCredential.
22
- *
23
- * @param credential - The credential being checked.
24
- */
25
35
  const isKeyCredential = (credential) => {
26
- const castCredential = credential;
27
- return (castCredential &&
28
- typeof castCredential.key === "string" &&
29
- castCredential.getToken === undefined);
36
+ const castCredential = credential;
37
+ return castCredential && typeof castCredential.key === "string" && castCredential.getToken === void 0;
30
38
  };
31
- exports.isKeyCredential = isKeyCredential;
32
- /**
33
- * Parses arguments passed to a communication client.
34
- * @hidden
35
- */
36
39
  const parseClientArguments = (connectionStringOrUrl, credentialOrOptions) => {
37
- if ((0, exports.isKeyCredential)(credentialOrOptions) || (0, core_auth_1.isTokenCredential)(credentialOrOptions)) {
38
- assertValidEndpoint(connectionStringOrUrl);
39
- return { url: connectionStringOrUrl, credential: credentialOrOptions };
40
- }
41
- else {
42
- const { endpoint: host, credential } = (0, connectionString_js_1.parseConnectionString)(connectionStringOrUrl);
43
- assertValidEndpoint(host);
44
- return { url: host, credential };
45
- }
40
+ if (isKeyCredential(credentialOrOptions) || (0, import_core_auth.isTokenCredential)(credentialOrOptions)) {
41
+ assertValidEndpoint(connectionStringOrUrl);
42
+ return { url: connectionStringOrUrl, credential: credentialOrOptions };
43
+ } else {
44
+ const { endpoint: host, credential } = (0, import_connectionString.parseConnectionString)(connectionStringOrUrl);
45
+ assertValidEndpoint(host);
46
+ return { url: host, credential };
47
+ }
46
48
  };
47
- exports.parseClientArguments = parseClientArguments;
48
- //# sourceMappingURL=clientArguments.js.map
49
+ // Annotate the CommonJS export names for ESM import in node:
50
+ 0 && (module.exports = {
51
+ isKeyCredential,
52
+ parseClientArguments
53
+ });
54
+ //# sourceMappingURL=clientArguments.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"clientArguments.js","sourceRoot":"","sources":["../../../src/credential/clientArguments.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,gDAA+F;AAC/F,+DAA8D;AAE9D,MAAM,eAAe,GAAG,CAAC,IAAY,EAAW,EAAE;IAChD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IAE1B,OAAO,CACL,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC;QAClC,GAAG,CAAC,IAAI,KAAK,SAAS;QACtB,GAAG,CAAC,IAAI,KAAK,EAAE;QACf,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,GAAG,CAAC,QAAQ,KAAK,EAAE,IAAI,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,CAC5E,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAQ,EAAE;IACjD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,wBAAwB,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACI,MAAM,eAAe,GAAG,CAAC,UAAmB,EAA+B,EAAE;IAClF,MAAM,cAAc,GAAG,UAGtB,CAAC;IACF,OAAO,CACL,cAAc;QACd,OAAO,cAAc,CAAC,GAAG,KAAK,QAAQ;QACtC,cAAc,CAAC,QAAQ,KAAK,SAAS,CACtC,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,eAAe,mBAU1B;AAWF;;;GAGG;AACI,MAAM,oBAAoB,GAAG,CAClC,qBAA6B,EAC7B,mBAA6B,EACV,EAAE;IACrB,IAAI,IAAA,uBAAe,EAAC,mBAAmB,CAAC,IAAI,IAAA,6BAAiB,EAAC,mBAAmB,CAAC,EAAE,CAAC;QACnF,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;QAC3C,OAAO,EAAE,GAAG,EAAE,qBAAqB,EAAE,UAAU,EAAE,mBAAmB,EAAE,CAAC;IACzE,CAAC;SAAM,CAAC;QACN,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAA,2CAAqB,EAAC,qBAAqB,CAAC,CAAC;QACpF,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IACnC,CAAC;AACH,CAAC,CAAC;AAZW,QAAA,oBAAoB,wBAY/B","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { type KeyCredential, type TokenCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { parseConnectionString } from \"./connectionString.js\";\n\nconst isValidEndpoint = (host: string): boolean => {\n const url = new URL(host);\n\n return (\n !!url.protocol?.match(/^http[s]?/) &&\n url.host !== undefined &&\n url.host !== \"\" &&\n (url.pathname === undefined || url.pathname === \"\" || url.pathname === \"/\")\n );\n};\n\nconst assertValidEndpoint = (host: string): void => {\n if (!isValidEndpoint(host)) {\n throw new Error(`Invalid endpoint url ${host}`);\n }\n};\n\n/**\n * Checks whether a value is a KeyCredential.\n *\n * @param credential - The credential being checked.\n */\nexport const isKeyCredential = (credential: unknown): credential is KeyCredential => {\n const castCredential = credential as {\n key: unknown;\n getToken: unknown;\n };\n return (\n castCredential &&\n typeof castCredential.key === \"string\" &&\n castCredential.getToken === undefined\n );\n};\n\n/**\n * The URL and credential from parsing the arguments of a communication client.\n * @hidden\n */\nexport type UrlWithCredential = {\n url: string;\n credential: TokenCredential | KeyCredential;\n};\n\n/**\n * Parses arguments passed to a communication client.\n * @hidden\n */\nexport const parseClientArguments = (\n connectionStringOrUrl: string,\n credentialOrOptions?: unknown,\n): UrlWithCredential => {\n if (isKeyCredential(credentialOrOptions) || isTokenCredential(credentialOrOptions)) {\n assertValidEndpoint(connectionStringOrUrl);\n return { url: connectionStringOrUrl, credential: credentialOrOptions };\n } else {\n const { endpoint: host, credential } = parseConnectionString(connectionStringOrUrl);\n assertValidEndpoint(host);\n return { url: host, credential };\n }\n};\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/credential/clientArguments.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { type KeyCredential, type TokenCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { parseConnectionString } from \"./connectionString.js\";\n\nconst isValidEndpoint = (host: string): boolean => {\n const url = new URL(host);\n\n return (\n !!url.protocol?.match(/^http[s]?/) &&\n url.host !== undefined &&\n url.host !== \"\" &&\n (url.pathname === undefined || url.pathname === \"\" || url.pathname === \"/\")\n );\n};\n\nconst assertValidEndpoint = (host: string): void => {\n if (!isValidEndpoint(host)) {\n throw new Error(`Invalid endpoint url ${host}`);\n }\n};\n\n/**\n * Checks whether a value is a KeyCredential.\n *\n * @param credential - The credential being checked.\n */\nexport const isKeyCredential = (credential: unknown): credential is KeyCredential => {\n const castCredential = credential as {\n key: unknown;\n getToken: unknown;\n };\n return (\n castCredential &&\n typeof castCredential.key === \"string\" &&\n castCredential.getToken === undefined\n );\n};\n\n/**\n * The URL and credential from parsing the arguments of a communication client.\n * @hidden\n */\nexport type UrlWithCredential = {\n url: string;\n credential: TokenCredential | KeyCredential;\n};\n\n/**\n * Parses arguments passed to a communication client.\n * @hidden\n */\nexport const parseClientArguments = (\n connectionStringOrUrl: string,\n credentialOrOptions?: unknown,\n): UrlWithCredential => {\n if (isKeyCredential(credentialOrOptions) || isTokenCredential(credentialOrOptions)) {\n assertValidEndpoint(connectionStringOrUrl);\n return { url: connectionStringOrUrl, credential: credentialOrOptions };\n } else {\n const { endpoint: host, credential } = parseConnectionString(connectionStringOrUrl);\n assertValidEndpoint(host);\n return { url: host, credential };\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAA4E;AAC5E,8BAAsC;AAEtC,MAAM,kBAAkB,CAAC,SAA0B;AACjD,QAAM,MAAM,IAAI,IAAI,IAAI;AAExB,SACE,CAAC,CAAC,IAAI,UAAU,MAAM,WAAW,KACjC,IAAI,SAAS,UACb,IAAI,SAAS,OACZ,IAAI,aAAa,UAAa,IAAI,aAAa,MAAM,IAAI,aAAa;AAE3E;AAEA,MAAM,sBAAsB,CAAC,SAAuB;AAClD,MAAI,CAAC,gBAAgB,IAAI,GAAG;AAC1B,UAAM,IAAI,MAAM,wBAAwB,IAAI,EAAE;AAAA,EAChD;AACF;AAOO,MAAM,kBAAkB,CAAC,eAAqD;AACnF,QAAM,iBAAiB;AAIvB,SACE,kBACA,OAAO,eAAe,QAAQ,YAC9B,eAAe,aAAa;AAEhC;AAeO,MAAM,uBAAuB,CAClC,uBACA,wBACsB;AACtB,MAAI,gBAAgB,mBAAmB,SAAK,oCAAkB,mBAAmB,GAAG;AAClF,wBAAoB,qBAAqB;AACzC,WAAO,EAAE,KAAK,uBAAuB,YAAY,oBAAoB;AAAA,EACvE,OAAO;AACL,UAAM,EAAE,UAAU,MAAM,WAAW,QAAI,+CAAsB,qBAAqB;AAClF,wBAAoB,IAAI;AACxB,WAAO,EAAE,KAAK,MAAM,WAAW;AAAA,EACjC;AACF;",
6
+ "names": []
7
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"communicationAccessKeyCredentialPolicy.d.ts","sourceRoot":"","sources":["../../../src/credential/communicationAccessKeyCredentialPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAStD;;;;;GAKG;AACH,wBAAgB,4CAA4C,CAC1D,UAAU,EAAE,aAAa,GACxB,cAAc,CAgChB"}
1
+ {"version":3,"file":"communicationAccessKeyCredentialPolicy.d.ts","sourceRoot":"","sources":["../../../src/credential/communicationAccessKeyCredentialPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAStD;;;;;GAKG;AACH,wBAAgB,4CAA4C,CAC1D,UAAU,EAAE,aAAa,GACxB,cAAc,CA4BhB"}
@@ -1,45 +1,56 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.createCommunicationAccessKeyCredentialPolicy = createCommunicationAccessKeyCredentialPolicy;
6
- const cryptoUtils_js_1 = require("./cryptoUtils.js");
7
- const core_util_1 = require("@azure/core-util");
8
- /**
9
- * CommunicationKeyCredentialPolicy provides a means of signing requests made through
10
- * the SmsClient.
11
- */
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var communicationAccessKeyCredentialPolicy_exports = {};
19
+ __export(communicationAccessKeyCredentialPolicy_exports, {
20
+ createCommunicationAccessKeyCredentialPolicy: () => createCommunicationAccessKeyCredentialPolicy
21
+ });
22
+ module.exports = __toCommonJS(communicationAccessKeyCredentialPolicy_exports);
23
+ var import_core_util = require("@azure/core-util");
12
24
  const communicationAccessKeyCredentialPolicy = "CommunicationAccessKeyCredentialPolicy";
13
- /**
14
- * Creates an HTTP pipeline policy to authenticate a request using a `KeyCredential`.
15
- * @hidden
16
- *
17
- * @param credential - The key credential.
18
- */
19
25
  function createCommunicationAccessKeyCredentialPolicy(credential) {
20
- return {
21
- name: communicationAccessKeyCredentialPolicy,
22
- async sendRequest(request, next) {
23
- const verb = request.method.toUpperCase();
24
- const utcNow = new Date().toUTCString();
25
- const contentHash = await (0, cryptoUtils_js_1.shaHash)(request.body?.toString() || "");
26
- const dateHeader = "x-ms-date";
27
- const signedHeaders = `${dateHeader};host;x-ms-content-sha256`;
28
- const url = new URL(request.url);
29
- const query = url.searchParams.toString();
30
- const urlPathAndQuery = query ? `${url.pathname}?${query}` : url.pathname;
31
- const port = url.port;
32
- const hostAndPort = port ? `${url.host}:${port}` : url.host;
33
- const stringToSign = `${verb}\n${urlPathAndQuery}\n${utcNow};${hostAndPort};${contentHash}`;
34
- const signature = await (0, cryptoUtils_js_1.shaHMAC)(credential.key, stringToSign);
35
- if (core_util_1.isNodeLike) {
36
- request.headers.set("Host", hostAndPort || "");
37
- }
38
- request.headers.set(dateHeader, utcNow);
39
- request.headers.set("x-ms-content-sha256", contentHash);
40
- request.headers.set("Authorization", `HMAC-SHA256 SignedHeaders=${signedHeaders}&Signature=${signature}`);
41
- return next(request);
42
- },
43
- };
26
+ return {
27
+ name: communicationAccessKeyCredentialPolicy,
28
+ async sendRequest(request, next) {
29
+ const verb = request.method.toUpperCase();
30
+ const utcNow = (/* @__PURE__ */ new Date()).toUTCString();
31
+ const contentHash = await (0, import_core_util.computeSha256Hash)(request.body?.toString() || "", "base64");
32
+ const dateHeader = "x-ms-date";
33
+ const signedHeaders = `${dateHeader};host;x-ms-content-sha256`;
34
+ const url = new URL(request.url);
35
+ const query = url.searchParams.toString();
36
+ const urlPathAndQuery = query ? `${url.pathname}?${query}` : url.pathname;
37
+ const stringToSign = `${verb}
38
+ ${urlPathAndQuery}
39
+ ${utcNow};${url.host};${contentHash}`;
40
+ const signature = await (0, import_core_util.computeSha256Hmac)(credential.key, stringToSign, "base64");
41
+ request.headers.set("Host", url.host);
42
+ request.headers.set(dateHeader, utcNow);
43
+ request.headers.set("x-ms-content-sha256", contentHash);
44
+ request.headers.set(
45
+ "Authorization",
46
+ `HMAC-SHA256 SignedHeaders=${signedHeaders}&Signature=${signature}`
47
+ );
48
+ return next(request);
49
+ }
50
+ };
44
51
  }
45
- //# sourceMappingURL=communicationAccessKeyCredentialPolicy.js.map
52
+ // Annotate the CommonJS export names for ESM import in node:
53
+ 0 && (module.exports = {
54
+ createCommunicationAccessKeyCredentialPolicy
55
+ });
56
+ //# sourceMappingURL=communicationAccessKeyCredentialPolicy.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"communicationAccessKeyCredentialPolicy.js","sourceRoot":"","sources":["../../../src/credential/communicationAccessKeyCredentialPolicy.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAwBlC,oGAkCC;AAlDD,qDAAoD;AAEpD,gDAA8C;AAE9C;;;GAGG;AACH,MAAM,sCAAsC,GAAG,wCAAwC,CAAC;AAExF;;;;;GAKG;AACH,SAAgB,4CAA4C,CAC1D,UAAyB;IAEzB,OAAO;QACL,IAAI,EAAE,sCAAsC;QAC5C,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;YAC3D,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YAC1C,MAAM,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YACxC,MAAM,WAAW,GAAG,MAAM,IAAA,wBAAO,EAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YAClE,MAAM,UAAU,GAAG,WAAW,CAAC;YAC/B,MAAM,aAAa,GAAG,GAAG,UAAU,2BAA2B,CAAC;YAE/D,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACjC,MAAM,KAAK,GAAG,GAAG,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;YAC1C,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,QAAQ,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC;YAC1E,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;YACtB,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;YAE5D,MAAM,YAAY,GAAG,GAAG,IAAI,KAAK,eAAe,KAAK,MAAM,IAAI,WAAW,IAAI,WAAW,EAAE,CAAC;YAC5F,MAAM,SAAS,GAAG,MAAM,IAAA,wBAAO,EAAC,UAAU,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;YAE9D,IAAI,sBAAU,EAAE,CAAC;gBACf,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,IAAI,EAAE,CAAC,CAAC;YACjD,CAAC;YAED,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;YACxC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;YACxD,OAAO,CAAC,OAAO,CAAC,GAAG,CACjB,eAAe,EACf,6BAA6B,aAAa,cAAc,SAAS,EAAE,CACpE,CAAC;YACF,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 type {\n PipelinePolicy,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { shaHMAC, shaHash } from \"./cryptoUtils.js\";\nimport type { KeyCredential } from \"@azure/core-auth\";\nimport { isNodeLike } from \"@azure/core-util\";\n\n/**\n * CommunicationKeyCredentialPolicy provides a means of signing requests made through\n * the SmsClient.\n */\nconst communicationAccessKeyCredentialPolicy = \"CommunicationAccessKeyCredentialPolicy\";\n\n/**\n * Creates an HTTP pipeline policy to authenticate a request using a `KeyCredential`.\n * @hidden\n *\n * @param credential - The key credential.\n */\nexport function createCommunicationAccessKeyCredentialPolicy(\n credential: KeyCredential,\n): PipelinePolicy {\n return {\n name: communicationAccessKeyCredentialPolicy,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n const verb = request.method.toUpperCase();\n const utcNow = new Date().toUTCString();\n const contentHash = await shaHash(request.body?.toString() || \"\");\n const dateHeader = \"x-ms-date\";\n const signedHeaders = `${dateHeader};host;x-ms-content-sha256`;\n\n const url = new URL(request.url);\n const query = url.searchParams.toString();\n const urlPathAndQuery = query ? `${url.pathname}?${query}` : url.pathname;\n const port = url.port;\n const hostAndPort = port ? `${url.host}:${port}` : url.host;\n\n const stringToSign = `${verb}\\n${urlPathAndQuery}\\n${utcNow};${hostAndPort};${contentHash}`;\n const signature = await shaHMAC(credential.key, stringToSign);\n\n if (isNodeLike) {\n request.headers.set(\"Host\", hostAndPort || \"\");\n }\n\n request.headers.set(dateHeader, utcNow);\n request.headers.set(\"x-ms-content-sha256\", contentHash);\n request.headers.set(\n \"Authorization\",\n `HMAC-SHA256 SignedHeaders=${signedHeaders}&Signature=${signature}`,\n );\n return next(request);\n },\n };\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/credential/communicationAccessKeyCredentialPolicy.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n PipelinePolicy,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport type { KeyCredential } from \"@azure/core-auth\";\nimport { computeSha256Hash, computeSha256Hmac } from \"@azure/core-util\";\n\n/**\n * CommunicationKeyCredentialPolicy provides a means of signing requests made through\n * the SmsClient.\n */\nconst communicationAccessKeyCredentialPolicy = \"CommunicationAccessKeyCredentialPolicy\";\n\n/**\n * Creates an HTTP pipeline policy to authenticate a request using a `KeyCredential`.\n * @hidden\n *\n * @param credential - The key credential.\n */\nexport function createCommunicationAccessKeyCredentialPolicy(\n credential: KeyCredential,\n): PipelinePolicy {\n return {\n name: communicationAccessKeyCredentialPolicy,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n const verb = request.method.toUpperCase();\n const utcNow = new Date().toUTCString();\n const contentHash = await computeSha256Hash(request.body?.toString() || \"\", \"base64\");\n const dateHeader = \"x-ms-date\";\n const signedHeaders = `${dateHeader};host;x-ms-content-sha256`;\n\n const url = new URL(request.url);\n const query = url.searchParams.toString();\n const urlPathAndQuery = query ? `${url.pathname}?${query}` : url.pathname;\n\n const stringToSign = `${verb}\\n${urlPathAndQuery}\\n${utcNow};${url.host};${contentHash}`;\n const signature = await computeSha256Hmac(credential.key, stringToSign, \"base64\");\n\n // Host is a forbidden header in browsers (silently ignored), but needed in Node.js\n request.headers.set(\"Host\", url.host);\n request.headers.set(dateHeader, utcNow);\n request.headers.set(\"x-ms-content-sha256\", contentHash);\n request.headers.set(\n \"Authorization\",\n `HMAC-SHA256 SignedHeaders=${signedHeaders}&Signature=${signature}`,\n );\n return next(request);\n },\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,uBAAqD;AAMrD,MAAM,yCAAyC;AAQxC,SAAS,6CACd,YACgB;AAChB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,YAAY,SAA0B,MAA8C;AACxF,YAAM,OAAO,QAAQ,OAAO,YAAY;AACxC,YAAM,UAAS,oBAAI,KAAK,GAAE,YAAY;AACtC,YAAM,cAAc,UAAM,oCAAkB,QAAQ,MAAM,SAAS,KAAK,IAAI,QAAQ;AACpF,YAAM,aAAa;AACnB,YAAM,gBAAgB,GAAG,UAAU;AAEnC,YAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;AAC/B,YAAM,QAAQ,IAAI,aAAa,SAAS;AACxC,YAAM,kBAAkB,QAAQ,GAAG,IAAI,QAAQ,IAAI,KAAK,KAAK,IAAI;AAEjE,YAAM,eAAe,GAAG,IAAI;AAAA,EAAK,eAAe;AAAA,EAAK,MAAM,IAAI,IAAI,IAAI,IAAI,WAAW;AACtF,YAAM,YAAY,UAAM,oCAAkB,WAAW,KAAK,cAAc,QAAQ;AAGhF,cAAQ,QAAQ,IAAI,QAAQ,IAAI,IAAI;AACpC,cAAQ,QAAQ,IAAI,YAAY,MAAM;AACtC,cAAQ,QAAQ,IAAI,uBAAuB,WAAW;AACtD,cAAQ,QAAQ;AAAA,QACd;AAAA,QACA,6BAA6B,aAAa,cAAc,SAAS;AAAA,MACnE;AACA,aAAO,KAAK,OAAO;AAAA,IACrB;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -1,28 +1,41 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.createCommunicationAuthPolicy = createCommunicationAuthPolicy;
6
- const core_rest_pipeline_1 = require("@azure/core-rest-pipeline");
7
- const core_auth_1 = require("@azure/core-auth");
8
- const communicationAccessKeyCredentialPolicy_js_1 = require("./communicationAccessKeyCredentialPolicy.js");
9
- /**
10
- * Creates a pipeline policy to authenticate request based
11
- * on the credential passed in.
12
- * @hidden
13
- *
14
- * @param credential - The KeyCredential or TokenCredential.
15
- */
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var communicationAuthPolicy_exports = {};
19
+ __export(communicationAuthPolicy_exports, {
20
+ createCommunicationAuthPolicy: () => createCommunicationAuthPolicy
21
+ });
22
+ module.exports = __toCommonJS(communicationAuthPolicy_exports);
23
+ var import_core_rest_pipeline = require("@azure/core-rest-pipeline");
24
+ var import_core_auth = require("@azure/core-auth");
25
+ var import_communicationAccessKeyCredentialPolicy = require("./communicationAccessKeyCredentialPolicy.js");
16
26
  function createCommunicationAuthPolicy(credential) {
17
- if ((0, core_auth_1.isTokenCredential)(credential)) {
18
- const policyOptions = {
19
- credential: credential,
20
- scopes: ["https://communication.azure.com//.default"],
21
- };
22
- return (0, core_rest_pipeline_1.bearerTokenAuthenticationPolicy)(policyOptions);
23
- }
24
- else {
25
- return (0, communicationAccessKeyCredentialPolicy_js_1.createCommunicationAccessKeyCredentialPolicy)(credential);
26
- }
27
+ if ((0, import_core_auth.isTokenCredential)(credential)) {
28
+ const policyOptions = {
29
+ credential,
30
+ scopes: ["https://communication.azure.com//.default"]
31
+ };
32
+ return (0, import_core_rest_pipeline.bearerTokenAuthenticationPolicy)(policyOptions);
33
+ } else {
34
+ return (0, import_communicationAccessKeyCredentialPolicy.createCommunicationAccessKeyCredentialPolicy)(credential);
35
+ }
27
36
  }
28
- //# sourceMappingURL=communicationAuthPolicy.js.map
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ createCommunicationAuthPolicy
40
+ });
41
+ //# sourceMappingURL=communicationAuthPolicy.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"communicationAuthPolicy.js","sourceRoot":"","sources":["../../../src/credential/communicationAuthPolicy.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAgBlC,sEAYC;AA1BD,kEAImC;AACnC,gDAA+F;AAC/F,2GAA2G;AAC3G;;;;;;GAMG;AACH,SAAgB,6BAA6B,CAC3C,UAA2C;IAE3C,IAAI,IAAA,6BAAiB,EAAC,UAAU,CAAC,EAAE,CAAC;QAClC,MAAM,aAAa,GAA2C;YAC5D,UAAU,EAAE,UAAU;YACtB,MAAM,EAAE,CAAC,2CAA2C,CAAC;SACtD,CAAC;QACF,OAAO,IAAA,oDAA+B,EAAC,aAAa,CAAC,CAAC;IACxD,CAAC;SAAM,CAAC;QACN,OAAO,IAAA,wFAA4C,EAAC,UAAU,CAAC,CAAC;IAClE,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n type BearerTokenAuthenticationPolicyOptions,\n type PipelinePolicy,\n bearerTokenAuthenticationPolicy,\n} from \"@azure/core-rest-pipeline\";\nimport { type KeyCredential, type TokenCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { createCommunicationAccessKeyCredentialPolicy } from \"./communicationAccessKeyCredentialPolicy.js\";\n/**\n * Creates a pipeline policy to authenticate request based\n * on the credential passed in.\n * @hidden\n *\n * @param credential - The KeyCredential or TokenCredential.\n */\nexport function createCommunicationAuthPolicy(\n credential: KeyCredential | TokenCredential,\n): PipelinePolicy {\n if (isTokenCredential(credential)) {\n const policyOptions: BearerTokenAuthenticationPolicyOptions = {\n credential: credential,\n scopes: [\"https://communication.azure.com//.default\"],\n };\n return bearerTokenAuthenticationPolicy(policyOptions);\n } else {\n return createCommunicationAccessKeyCredentialPolicy(credential);\n }\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/credential/communicationAuthPolicy.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n type BearerTokenAuthenticationPolicyOptions,\n type PipelinePolicy,\n bearerTokenAuthenticationPolicy,\n} from \"@azure/core-rest-pipeline\";\nimport { type KeyCredential, type TokenCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { createCommunicationAccessKeyCredentialPolicy } from \"./communicationAccessKeyCredentialPolicy.js\";\n/**\n * Creates a pipeline policy to authenticate request based\n * on the credential passed in.\n * @hidden\n *\n * @param credential - The KeyCredential or TokenCredential.\n */\nexport function createCommunicationAuthPolicy(\n credential: KeyCredential | TokenCredential,\n): PipelinePolicy {\n if (isTokenCredential(credential)) {\n const policyOptions: BearerTokenAuthenticationPolicyOptions = {\n credential: credential,\n scopes: [\"https://communication.azure.com//.default\"],\n };\n return bearerTokenAuthenticationPolicy(policyOptions);\n } else {\n return createCommunicationAccessKeyCredentialPolicy(credential);\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gCAIO;AACP,uBAA4E;AAC5E,oDAA6D;AAQtD,SAAS,8BACd,YACgB;AAChB,UAAI,oCAAkB,UAAU,GAAG;AACjC,UAAM,gBAAwD;AAAA,MAC5D;AAAA,MACA,QAAQ,CAAC,2CAA2C;AAAA,IACtD;AACA,eAAO,2DAAgC,aAAa;AAAA,EACtD,OAAO;AACL,eAAO,4FAA6C,UAAU;AAAA,EAChE;AACF;",
6
+ "names": []
7
+ }
@@ -1,33 +1,44 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.parseConnectionString = void 0;
6
- const core_auth_1 = require("@azure/core-auth");
7
- // TODO: update when connection string format is finalized
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var connectionString_exports = {};
19
+ __export(connectionString_exports, {
20
+ parseConnectionString: () => parseConnectionString
21
+ });
22
+ module.exports = __toCommonJS(connectionString_exports);
23
+ var import_core_auth = require("@azure/core-auth");
8
24
  const CONNECTION_STRING_REGEX = /endpoint=(.*);accesskey=(.*)/i;
9
25
  const tryParseConnectionString = (s) => {
10
- const match = s.match(CONNECTION_STRING_REGEX);
11
- if (match?.[1] && match[2]) {
12
- return { endpoint: match[1], credential: new core_auth_1.AzureKeyCredential(match[2]) };
13
- }
14
- return undefined;
26
+ const match = s.match(CONNECTION_STRING_REGEX);
27
+ if (match?.[1] && match[2]) {
28
+ return { endpoint: match[1], credential: new import_core_auth.AzureKeyCredential(match[2]) };
29
+ }
30
+ return void 0;
15
31
  };
16
- /**
17
- * Returns an EndpointCredential to easily access properties of the connection string.
18
- * @hidden
19
- *
20
- * @param connectionString - The connection string to parse
21
- * @returns Object to access the endpoint and the credentials
22
- */
23
32
  const parseConnectionString = (connectionString) => {
24
- const parsedConnectionString = tryParseConnectionString(connectionString);
25
- if (parsedConnectionString) {
26
- return parsedConnectionString;
27
- }
28
- else {
29
- throw new Error(`Invalid connection string ${connectionString}`);
30
- }
33
+ const parsedConnectionString = tryParseConnectionString(connectionString);
34
+ if (parsedConnectionString) {
35
+ return parsedConnectionString;
36
+ } else {
37
+ throw new Error(`Invalid connection string ${connectionString}`);
38
+ }
31
39
  };
32
- exports.parseConnectionString = parseConnectionString;
33
- //# sourceMappingURL=connectionString.js.map
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ parseConnectionString
43
+ });
44
+ //# sourceMappingURL=connectionString.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"connectionString.js","sourceRoot":"","sources":["../../../src/credential/connectionString.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,gDAA0E;AAiB1E,0DAA0D;AAC1D,MAAM,uBAAuB,GAAG,+BAA+B,CAAC;AAEhE,MAAM,wBAAwB,GAAG,CAAC,CAAS,EAAkC,EAAE;IAC7E,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC/C,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,8BAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9E,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AACF;;;;;;GAMG;AACI,MAAM,qBAAqB,GAAG,CAAC,gBAAwB,EAAsB,EAAE;IACpF,MAAM,sBAAsB,GAAG,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;IAC1E,IAAI,sBAAsB,EAAE,CAAC;QAC3B,OAAO,sBAAsB,CAAC;IAChC,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,6BAA6B,gBAAgB,EAAE,CAAC,CAAC;IACnE,CAAC;AACH,CAAC,CAAC;AAPW,QAAA,qBAAqB,yBAOhC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzureKeyCredential, type KeyCredential } from \"@azure/core-auth\";\n/**\n * Represents different properties of connection string\n * using format \"/endpoint=(.*);accesskey=(.*)\".\n * @hidden\n */\nexport interface EndpointCredential {\n /**\n * The endpoint as string\n */\n endpoint: string;\n /**\n * The access key represented as a KeyCredential object\n */\n credential: KeyCredential;\n}\n\n// TODO: update when connection string format is finalized\nconst CONNECTION_STRING_REGEX = /endpoint=(.*);accesskey=(.*)/i;\n\nconst tryParseConnectionString = (s: string): EndpointCredential | undefined => {\n const match = s.match(CONNECTION_STRING_REGEX);\n if (match?.[1] && match[2]) {\n return { endpoint: match[1], credential: new AzureKeyCredential(match[2]) };\n }\n return undefined;\n};\n/**\n * Returns an EndpointCredential to easily access properties of the connection string.\n * @hidden\n *\n * @param connectionString - The connection string to parse\n * @returns Object to access the endpoint and the credentials\n */\nexport const parseConnectionString = (connectionString: string): EndpointCredential => {\n const parsedConnectionString = tryParseConnectionString(connectionString);\n if (parsedConnectionString) {\n return parsedConnectionString;\n } else {\n throw new Error(`Invalid connection string ${connectionString}`);\n }\n};\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/credential/connectionString.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AzureKeyCredential, type KeyCredential } from \"@azure/core-auth\";\n/**\n * Represents different properties of connection string\n * using format \"/endpoint=(.*);accesskey=(.*)\".\n * @hidden\n */\nexport interface EndpointCredential {\n /**\n * The endpoint as string\n */\n endpoint: string;\n /**\n * The access key represented as a KeyCredential object\n */\n credential: KeyCredential;\n}\n\n// TODO: update when connection string format is finalized\nconst CONNECTION_STRING_REGEX = /endpoint=(.*);accesskey=(.*)/i;\n\nconst tryParseConnectionString = (s: string): EndpointCredential | undefined => {\n const match = s.match(CONNECTION_STRING_REGEX);\n if (match?.[1] && match[2]) {\n return { endpoint: match[1], credential: new AzureKeyCredential(match[2]) };\n }\n return undefined;\n};\n/**\n * Returns an EndpointCredential to easily access properties of the connection string.\n * @hidden\n *\n * @param connectionString - The connection string to parse\n * @returns Object to access the endpoint and the credentials\n */\nexport const parseConnectionString = (connectionString: string): EndpointCredential => {\n const parsedConnectionString = tryParseConnectionString(connectionString);\n if (parsedConnectionString) {\n return parsedConnectionString;\n } else {\n throw new Error(`Invalid connection string ${connectionString}`);\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAuD;AAkBvD,MAAM,0BAA0B;AAEhC,MAAM,2BAA2B,CAAC,MAA8C;AAC9E,QAAM,QAAQ,EAAE,MAAM,uBAAuB;AAC7C,MAAI,QAAQ,CAAC,KAAK,MAAM,CAAC,GAAG;AAC1B,WAAO,EAAE,UAAU,MAAM,CAAC,GAAG,YAAY,IAAI,oCAAmB,MAAM,CAAC,CAAC,EAAE;AAAA,EAC5E;AACA,SAAO;AACT;AAQO,MAAM,wBAAwB,CAAC,qBAAiD;AACrF,QAAM,yBAAyB,yBAAyB,gBAAgB;AACxE,MAAI,wBAAwB;AAC1B,WAAO;AAAA,EACT,OAAO;AACL,UAAM,IAAI,MAAM,6BAA6B,gBAAgB,EAAE;AAAA,EACjE;AACF;",
6
+ "names": []
7
+ }
@@ -1,10 +1,28 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- const tslib_1 = require("tslib");
6
- tslib_1.__exportStar(require("./communicationAccessKeyCredentialPolicy.js"), exports);
7
- tslib_1.__exportStar(require("./communicationAuthPolicy.js"), exports);
8
- tslib_1.__exportStar(require("./clientArguments.js"), exports);
9
- tslib_1.__exportStar(require("./connectionString.js"), exports);
10
- //# sourceMappingURL=index.js.map
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var credential_exports = {};
16
+ module.exports = __toCommonJS(credential_exports);
17
+ __reExport(credential_exports, require("./communicationAccessKeyCredentialPolicy.js"), module.exports);
18
+ __reExport(credential_exports, require("./communicationAuthPolicy.js"), module.exports);
19
+ __reExport(credential_exports, require("./clientArguments.js"), module.exports);
20
+ __reExport(credential_exports, require("./connectionString.js"), module.exports);
21
+ // Annotate the CommonJS export names for ESM import in node:
22
+ 0 && (module.exports = {
23
+ ...require("./communicationAccessKeyCredentialPolicy.js"),
24
+ ...require("./communicationAuthPolicy.js"),
25
+ ...require("./clientArguments.js"),
26
+ ...require("./connectionString.js")
27
+ });
28
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/credential/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC,sFAA4D;AAC5D,uEAA6C;AAC7C,+DAAqC;AACrC,gEAAsC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from \"./communicationAccessKeyCredentialPolicy.js\";\nexport * from \"./communicationAuthPolicy.js\";\nexport * from \"./clientArguments.js\";\nexport * from \"./connectionString.js\";\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/credential/index.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from \"./communicationAccessKeyCredentialPolicy.js\";\nexport * from \"./communicationAuthPolicy.js\";\nexport * from \"./clientArguments.js\";\nexport * from \"./connectionString.js\";\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAGA,+BAAc,wDAHd;AAIA,+BAAc,yCAJd;AAKA,+BAAc,iCALd;AAMA,+BAAc,kCANd;",
6
+ "names": []
7
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"entraTokenCredential.d.ts","sourceRoot":"","sources":["../../src/entraTokenCredential.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EACL,KAAK,eAAe,IAAI,kBAAkB,EAC1C,KAAK,4BAA4B,EAClC,MAAM,mCAAmC,CAAC;AAiB3C,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,wCAAwC;IACvD;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,eAAe,EAAE,eAAe,CAAC;IACjC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,oBAAqB,YAAW,kBAAkB;IASjD,OAAO,CAAC,OAAO;IAR3B,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,MAAM,CAGZ;IACF,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAa;gBAEX,OAAO,EAAE,wCAAwC;IAYxD,QAAQ,CAAC,OAAO,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,WAAW,CAAC;YAoBrE,gBAAgB;IAmCvB,OAAO,IAAI,IAAI;YAOR,kBAAkB;IA8BhC,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,8BAA8B;CAiBvC"}
1
+ {"version":3,"file":"entraTokenCredential.d.ts","sourceRoot":"","sources":["../../src/entraTokenCredential.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EACL,KAAK,eAAe,IAAI,kBAAkB,EAC1C,KAAK,4BAA4B,EAClC,MAAM,mCAAmC,CAAC;AAwB3C,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,wCAAwC;IACvD;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,eAAe,EAAE,eAAe,CAAC;IACjC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,oBAAqB,YAAW,kBAAkB;IASjD,OAAO,CAAC,OAAO;IAR3B,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,MAAM,CAGZ;IACF,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAa;gBAEX,OAAO,EAAE,wCAAwC;IAYxD,QAAQ,CAAC,OAAO,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,WAAW,CAAC;YAoBrE,gBAAgB;IAmCvB,OAAO,IAAI,IAAI;YAOR,kBAAkB;IA8BhC,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,8BAA8B;CAmBvC"}