@azure/service-bus 7.10.0-alpha.20250102.1 → 7.10.0-alpha.20250106.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"connectionStringUtils.d.ts","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACnD;;;;OAIG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAChC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,MAAM,GACvB,oCAAoC,CAyCtC"}
1
+ {"version":3,"file":"connectionStringUtils.d.ts","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACnD;;;;OAIG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAChC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,MAAM,GACvB,oCAAoC,CA+CtC"}
@@ -23,8 +23,13 @@ export function parseServiceBusConnectionString(connectionString) {
23
23
  else if (!parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {
24
24
  throw new Error("Connection string with SharedAccessKeyName should have SharedAccessKey as well.");
25
25
  }
26
+ const fullyQualifiedNamespace = parsedResult.Endpoint.includes("0:0:0:0:0:0:0:1")
27
+ ? "0:0:0:0:0:0:0:1"
28
+ : parsedResult.Endpoint.includes("::1")
29
+ ? "::1"
30
+ : (parsedResult.Endpoint.match(".*://([^/:]*)") || [])[1];
26
31
  const output = {
27
- fullyQualifiedNamespace: (parsedResult.Endpoint.match(".*://([^/]*)") || [])[1],
32
+ fullyQualifiedNamespace,
28
33
  endpoint: parsedResult.Endpoint,
29
34
  };
30
35
  if (parsedResult.EntityPath) {
@@ -1 +1 @@
1
- {"version":3,"file":"connectionStringUtils.js","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AA2CzD;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAC7C,gBAAwB;IAExB,MAAM,YAAY,GAAG,qBAAqB,CAMvC,gBAAgB,CAAC,CAAC;IACrB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,IAAI,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;YACrE,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,IAAI,YAAY,CAAC,eAAe,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;SAAM,IAAI,CAAC,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAyC;QACnD,uBAAuB,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/E,QAAQ,EAAE,YAAY,CAAC,QAAQ;KAChC,CAAC;IACF,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;QAC5B,MAAM,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;IAC9C,CAAC;IACD,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,MAAM,CAAC,qBAAqB,GAAG,YAAY,CAAC,qBAAqB,CAAC;IACpE,CAAC;IACD,IAAI,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QACrE,MAAM,CAAC,eAAe,GAAG,YAAY,CAAC,eAAe,CAAC;QACtD,MAAM,CAAC,mBAAmB,GAAG,YAAY,CAAC,mBAAmB,CAAC;IAChE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { parseConnectionString } from \"@azure/core-amqp\";\n\n/**\n * The set of properties that comprise a Service Bus connection string.\n */\nexport interface ServiceBusConnectionStringProperties {\n /**\n * The fully qualified Service Bus namespace extracted from the \"Endpoint\" in the\n * connection string. This is likely to be similar to `{yournamespace}.servicebus.windows.net`.\n * This is typically used to construct the ServiceBusClient.\n */\n fullyQualifiedNamespace: string;\n /**\n * The value for \"Endpoint\" in the connection string.\n */\n endpoint: string;\n /**\n * The value for \"EntityPath\" in the connection string which would be the name of the queue or\n * topic associated with the connection string.\n * Connection string from a Shared Access Policy created at the namespace level\n * will not have the EntityPath in it.\n */\n entityPath?: string;\n /**\n * The value for \"SharedAccessKey\" in the connection string. This along with the \"SharedAccessKeyName\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKey?: string;\n /**\n * The value for \"SharedAccessKeyName\" in the connection string. This along with the \"SharedAccessKey\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKeyName?: string;\n /**\n * The value for \"SharedAccessSignature\" in the connection string. This is typically not present in the\n * connection string generated for a Shared Access Policy. It is instead generated by the\n * user and appended to the connection string for ease of use.\n */\n sharedAccessSignature?: string;\n}\n\n/**\n * Parses given connection string into the different properties applicable to Azure Service Bus.\n * The properties are useful to then construct a ServiceBusClient.\n * @param connectionString - The connection string associated with the Shared Access Policy created\n * for the Service Bus namespace, queue or topic.\n */\nexport function parseServiceBusConnectionString(\n connectionString: string,\n): ServiceBusConnectionStringProperties {\n const parsedResult = parseConnectionString<{\n Endpoint: string;\n EntityPath?: string;\n SharedAccessSignature?: string;\n SharedAccessKey?: string;\n SharedAccessKeyName?: string;\n }>(connectionString);\n if (!parsedResult.Endpoint) {\n throw new Error(\"Connection string should have an Endpoint key.\");\n }\n\n if (parsedResult.SharedAccessSignature) {\n if (parsedResult.SharedAccessKey || parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string cannot have both SharedAccessSignature and SharedAccessKey keys.\",\n );\n }\n } else if (parsedResult.SharedAccessKey && !parsedResult.SharedAccessKeyName) {\n throw new Error(\"Connection string with SharedAccessKey should have SharedAccessKeyName.\");\n } else if (!parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string with SharedAccessKeyName should have SharedAccessKey as well.\",\n );\n }\n\n const output: ServiceBusConnectionStringProperties = {\n fullyQualifiedNamespace: (parsedResult.Endpoint.match(\".*://([^/]*)\") || [])[1],\n endpoint: parsedResult.Endpoint,\n };\n if (parsedResult.EntityPath) {\n output.entityPath = parsedResult.EntityPath;\n }\n if (parsedResult.SharedAccessSignature) {\n output.sharedAccessSignature = parsedResult.SharedAccessSignature;\n }\n if (parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n output.sharedAccessKey = parsedResult.SharedAccessKey;\n output.sharedAccessKeyName = parsedResult.SharedAccessKeyName;\n }\n return output;\n}\n"]}
1
+ {"version":3,"file":"connectionStringUtils.js","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AA2CzD;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAC7C,gBAAwB;IAExB,MAAM,YAAY,GAAG,qBAAqB,CAMvC,gBAAgB,CAAC,CAAC;IACrB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,IAAI,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;YACrE,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,IAAI,YAAY,CAAC,eAAe,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;SAAM,IAAI,CAAC,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;IACJ,CAAC;IAED,MAAM,uBAAuB,GAAG,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QAC/E,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;YACrC,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9D,MAAM,MAAM,GAAyC;QACnD,uBAAuB;QACvB,QAAQ,EAAE,YAAY,CAAC,QAAQ;KAChC,CAAC;IACF,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;QAC5B,MAAM,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;IAC9C,CAAC;IACD,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,MAAM,CAAC,qBAAqB,GAAG,YAAY,CAAC,qBAAqB,CAAC;IACpE,CAAC;IACD,IAAI,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QACrE,MAAM,CAAC,eAAe,GAAG,YAAY,CAAC,eAAe,CAAC;QACtD,MAAM,CAAC,mBAAmB,GAAG,YAAY,CAAC,mBAAmB,CAAC;IAChE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { parseConnectionString } from \"@azure/core-amqp\";\n\n/**\n * The set of properties that comprise a Service Bus connection string.\n */\nexport interface ServiceBusConnectionStringProperties {\n /**\n * The fully qualified Service Bus namespace extracted from the \"Endpoint\" in the\n * connection string. This is likely to be similar to `{yournamespace}.servicebus.windows.net`.\n * This is typically used to construct the ServiceBusClient.\n */\n fullyQualifiedNamespace: string;\n /**\n * The value for \"Endpoint\" in the connection string.\n */\n endpoint: string;\n /**\n * The value for \"EntityPath\" in the connection string which would be the name of the queue or\n * topic associated with the connection string.\n * Connection string from a Shared Access Policy created at the namespace level\n * will not have the EntityPath in it.\n */\n entityPath?: string;\n /**\n * The value for \"SharedAccessKey\" in the connection string. This along with the \"SharedAccessKeyName\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKey?: string;\n /**\n * The value for \"SharedAccessKeyName\" in the connection string. This along with the \"SharedAccessKey\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKeyName?: string;\n /**\n * The value for \"SharedAccessSignature\" in the connection string. This is typically not present in the\n * connection string generated for a Shared Access Policy. It is instead generated by the\n * user and appended to the connection string for ease of use.\n */\n sharedAccessSignature?: string;\n}\n\n/**\n * Parses given connection string into the different properties applicable to Azure Service Bus.\n * The properties are useful to then construct a ServiceBusClient.\n * @param connectionString - The connection string associated with the Shared Access Policy created\n * for the Service Bus namespace, queue or topic.\n */\nexport function parseServiceBusConnectionString(\n connectionString: string,\n): ServiceBusConnectionStringProperties {\n const parsedResult = parseConnectionString<{\n Endpoint: string;\n EntityPath?: string;\n SharedAccessSignature?: string;\n SharedAccessKey?: string;\n SharedAccessKeyName?: string;\n }>(connectionString);\n if (!parsedResult.Endpoint) {\n throw new Error(\"Connection string should have an Endpoint key.\");\n }\n\n if (parsedResult.SharedAccessSignature) {\n if (parsedResult.SharedAccessKey || parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string cannot have both SharedAccessSignature and SharedAccessKey keys.\",\n );\n }\n } else if (parsedResult.SharedAccessKey && !parsedResult.SharedAccessKeyName) {\n throw new Error(\"Connection string with SharedAccessKey should have SharedAccessKeyName.\");\n } else if (!parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string with SharedAccessKeyName should have SharedAccessKey as well.\",\n );\n }\n\n const fullyQualifiedNamespace = parsedResult.Endpoint.includes(\"0:0:0:0:0:0:0:1\")\n ? \"0:0:0:0:0:0:0:1\"\n : parsedResult.Endpoint.includes(\"::1\")\n ? \"::1\"\n : (parsedResult.Endpoint.match(\".*://([^/:]*)\") || [])[1];\n\n const output: ServiceBusConnectionStringProperties = {\n fullyQualifiedNamespace,\n endpoint: parsedResult.Endpoint,\n };\n if (parsedResult.EntityPath) {\n output.entityPath = parsedResult.EntityPath;\n }\n if (parsedResult.SharedAccessSignature) {\n output.sharedAccessSignature = parsedResult.SharedAccessSignature;\n }\n if (parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n output.sharedAccessKey = parsedResult.SharedAccessKey;\n output.sharedAccessKeyName = parsedResult.SharedAccessKeyName;\n }\n return output;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"connectionStringUtils.d.ts","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACnD;;;;OAIG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAChC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,MAAM,GACvB,oCAAoC,CAyCtC"}
1
+ {"version":3,"file":"connectionStringUtils.d.ts","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACnD;;;;OAIG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAChC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,MAAM,GACvB,oCAAoC,CA+CtC"}
@@ -26,8 +26,13 @@ function parseServiceBusConnectionString(connectionString) {
26
26
  else if (!parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {
27
27
  throw new Error("Connection string with SharedAccessKeyName should have SharedAccessKey as well.");
28
28
  }
29
+ const fullyQualifiedNamespace = parsedResult.Endpoint.includes("0:0:0:0:0:0:0:1")
30
+ ? "0:0:0:0:0:0:0:1"
31
+ : parsedResult.Endpoint.includes("::1")
32
+ ? "::1"
33
+ : (parsedResult.Endpoint.match(".*://([^/:]*)") || [])[1];
29
34
  const output = {
30
- fullyQualifiedNamespace: (parsedResult.Endpoint.match(".*://([^/]*)") || [])[1],
35
+ fullyQualifiedNamespace,
31
36
  endpoint: parsedResult.Endpoint,
32
37
  };
33
38
  if (parsedResult.EntityPath) {
@@ -1 +1 @@
1
- {"version":3,"file":"connectionStringUtils.js","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAmDlC,0EA2CC;AA5FD,gDAAyD;AA2CzD;;;;;GAKG;AACH,SAAgB,+BAA+B,CAC7C,gBAAwB;IAExB,MAAM,YAAY,GAAG,IAAA,iCAAqB,EAMvC,gBAAgB,CAAC,CAAC;IACrB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,IAAI,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;YACrE,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,IAAI,YAAY,CAAC,eAAe,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;SAAM,IAAI,CAAC,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAyC;QACnD,uBAAuB,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/E,QAAQ,EAAE,YAAY,CAAC,QAAQ;KAChC,CAAC;IACF,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;QAC5B,MAAM,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;IAC9C,CAAC;IACD,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,MAAM,CAAC,qBAAqB,GAAG,YAAY,CAAC,qBAAqB,CAAC;IACpE,CAAC;IACD,IAAI,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QACrE,MAAM,CAAC,eAAe,GAAG,YAAY,CAAC,eAAe,CAAC;QACtD,MAAM,CAAC,mBAAmB,GAAG,YAAY,CAAC,mBAAmB,CAAC;IAChE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { parseConnectionString } from \"@azure/core-amqp\";\n\n/**\n * The set of properties that comprise a Service Bus connection string.\n */\nexport interface ServiceBusConnectionStringProperties {\n /**\n * The fully qualified Service Bus namespace extracted from the \"Endpoint\" in the\n * connection string. This is likely to be similar to `{yournamespace}.servicebus.windows.net`.\n * This is typically used to construct the ServiceBusClient.\n */\n fullyQualifiedNamespace: string;\n /**\n * The value for \"Endpoint\" in the connection string.\n */\n endpoint: string;\n /**\n * The value for \"EntityPath\" in the connection string which would be the name of the queue or\n * topic associated with the connection string.\n * Connection string from a Shared Access Policy created at the namespace level\n * will not have the EntityPath in it.\n */\n entityPath?: string;\n /**\n * The value for \"SharedAccessKey\" in the connection string. This along with the \"SharedAccessKeyName\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKey?: string;\n /**\n * The value for \"SharedAccessKeyName\" in the connection string. This along with the \"SharedAccessKey\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKeyName?: string;\n /**\n * The value for \"SharedAccessSignature\" in the connection string. This is typically not present in the\n * connection string generated for a Shared Access Policy. It is instead generated by the\n * user and appended to the connection string for ease of use.\n */\n sharedAccessSignature?: string;\n}\n\n/**\n * Parses given connection string into the different properties applicable to Azure Service Bus.\n * The properties are useful to then construct a ServiceBusClient.\n * @param connectionString - The connection string associated with the Shared Access Policy created\n * for the Service Bus namespace, queue or topic.\n */\nexport function parseServiceBusConnectionString(\n connectionString: string,\n): ServiceBusConnectionStringProperties {\n const parsedResult = parseConnectionString<{\n Endpoint: string;\n EntityPath?: string;\n SharedAccessSignature?: string;\n SharedAccessKey?: string;\n SharedAccessKeyName?: string;\n }>(connectionString);\n if (!parsedResult.Endpoint) {\n throw new Error(\"Connection string should have an Endpoint key.\");\n }\n\n if (parsedResult.SharedAccessSignature) {\n if (parsedResult.SharedAccessKey || parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string cannot have both SharedAccessSignature and SharedAccessKey keys.\",\n );\n }\n } else if (parsedResult.SharedAccessKey && !parsedResult.SharedAccessKeyName) {\n throw new Error(\"Connection string with SharedAccessKey should have SharedAccessKeyName.\");\n } else if (!parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string with SharedAccessKeyName should have SharedAccessKey as well.\",\n );\n }\n\n const output: ServiceBusConnectionStringProperties = {\n fullyQualifiedNamespace: (parsedResult.Endpoint.match(\".*://([^/]*)\") || [])[1],\n endpoint: parsedResult.Endpoint,\n };\n if (parsedResult.EntityPath) {\n output.entityPath = parsedResult.EntityPath;\n }\n if (parsedResult.SharedAccessSignature) {\n output.sharedAccessSignature = parsedResult.SharedAccessSignature;\n }\n if (parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n output.sharedAccessKey = parsedResult.SharedAccessKey;\n output.sharedAccessKeyName = parsedResult.SharedAccessKeyName;\n }\n return output;\n}\n"]}
1
+ {"version":3,"file":"connectionStringUtils.js","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAmDlC,0EAiDC;AAlGD,gDAAyD;AA2CzD;;;;;GAKG;AACH,SAAgB,+BAA+B,CAC7C,gBAAwB;IAExB,MAAM,YAAY,GAAG,IAAA,iCAAqB,EAMvC,gBAAgB,CAAC,CAAC;IACrB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,IAAI,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;YACrE,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,IAAI,YAAY,CAAC,eAAe,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;SAAM,IAAI,CAAC,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;IACJ,CAAC;IAED,MAAM,uBAAuB,GAAG,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QAC/E,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;YACrC,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9D,MAAM,MAAM,GAAyC;QACnD,uBAAuB;QACvB,QAAQ,EAAE,YAAY,CAAC,QAAQ;KAChC,CAAC;IACF,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;QAC5B,MAAM,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;IAC9C,CAAC;IACD,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,MAAM,CAAC,qBAAqB,GAAG,YAAY,CAAC,qBAAqB,CAAC;IACpE,CAAC;IACD,IAAI,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QACrE,MAAM,CAAC,eAAe,GAAG,YAAY,CAAC,eAAe,CAAC;QACtD,MAAM,CAAC,mBAAmB,GAAG,YAAY,CAAC,mBAAmB,CAAC;IAChE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { parseConnectionString } from \"@azure/core-amqp\";\n\n/**\n * The set of properties that comprise a Service Bus connection string.\n */\nexport interface ServiceBusConnectionStringProperties {\n /**\n * The fully qualified Service Bus namespace extracted from the \"Endpoint\" in the\n * connection string. This is likely to be similar to `{yournamespace}.servicebus.windows.net`.\n * This is typically used to construct the ServiceBusClient.\n */\n fullyQualifiedNamespace: string;\n /**\n * The value for \"Endpoint\" in the connection string.\n */\n endpoint: string;\n /**\n * The value for \"EntityPath\" in the connection string which would be the name of the queue or\n * topic associated with the connection string.\n * Connection string from a Shared Access Policy created at the namespace level\n * will not have the EntityPath in it.\n */\n entityPath?: string;\n /**\n * The value for \"SharedAccessKey\" in the connection string. This along with the \"SharedAccessKeyName\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKey?: string;\n /**\n * The value for \"SharedAccessKeyName\" in the connection string. This along with the \"SharedAccessKey\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKeyName?: string;\n /**\n * The value for \"SharedAccessSignature\" in the connection string. This is typically not present in the\n * connection string generated for a Shared Access Policy. It is instead generated by the\n * user and appended to the connection string for ease of use.\n */\n sharedAccessSignature?: string;\n}\n\n/**\n * Parses given connection string into the different properties applicable to Azure Service Bus.\n * The properties are useful to then construct a ServiceBusClient.\n * @param connectionString - The connection string associated with the Shared Access Policy created\n * for the Service Bus namespace, queue or topic.\n */\nexport function parseServiceBusConnectionString(\n connectionString: string,\n): ServiceBusConnectionStringProperties {\n const parsedResult = parseConnectionString<{\n Endpoint: string;\n EntityPath?: string;\n SharedAccessSignature?: string;\n SharedAccessKey?: string;\n SharedAccessKeyName?: string;\n }>(connectionString);\n if (!parsedResult.Endpoint) {\n throw new Error(\"Connection string should have an Endpoint key.\");\n }\n\n if (parsedResult.SharedAccessSignature) {\n if (parsedResult.SharedAccessKey || parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string cannot have both SharedAccessSignature and SharedAccessKey keys.\",\n );\n }\n } else if (parsedResult.SharedAccessKey && !parsedResult.SharedAccessKeyName) {\n throw new Error(\"Connection string with SharedAccessKey should have SharedAccessKeyName.\");\n } else if (!parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string with SharedAccessKeyName should have SharedAccessKey as well.\",\n );\n }\n\n const fullyQualifiedNamespace = parsedResult.Endpoint.includes(\"0:0:0:0:0:0:0:1\")\n ? \"0:0:0:0:0:0:0:1\"\n : parsedResult.Endpoint.includes(\"::1\")\n ? \"::1\"\n : (parsedResult.Endpoint.match(\".*://([^/:]*)\") || [])[1];\n\n const output: ServiceBusConnectionStringProperties = {\n fullyQualifiedNamespace,\n endpoint: parsedResult.Endpoint,\n };\n if (parsedResult.EntityPath) {\n output.entityPath = parsedResult.EntityPath;\n }\n if (parsedResult.SharedAccessSignature) {\n output.sharedAccessSignature = parsedResult.SharedAccessSignature;\n }\n if (parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n output.sharedAccessKey = parsedResult.SharedAccessKey;\n output.sharedAccessKeyName = parsedResult.SharedAccessKeyName;\n }\n return output;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"connectionStringUtils.d.ts","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACnD;;;;OAIG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAChC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,MAAM,GACvB,oCAAoC,CAyCtC"}
1
+ {"version":3,"file":"connectionStringUtils.d.ts","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACnD;;;;OAIG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAChC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,MAAM,GACvB,oCAAoC,CA+CtC"}
@@ -23,8 +23,13 @@ export function parseServiceBusConnectionString(connectionString) {
23
23
  else if (!parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {
24
24
  throw new Error("Connection string with SharedAccessKeyName should have SharedAccessKey as well.");
25
25
  }
26
+ const fullyQualifiedNamespace = parsedResult.Endpoint.includes("0:0:0:0:0:0:0:1")
27
+ ? "0:0:0:0:0:0:0:1"
28
+ : parsedResult.Endpoint.includes("::1")
29
+ ? "::1"
30
+ : (parsedResult.Endpoint.match(".*://([^/:]*)") || [])[1];
26
31
  const output = {
27
- fullyQualifiedNamespace: (parsedResult.Endpoint.match(".*://([^/]*)") || [])[1],
32
+ fullyQualifiedNamespace,
28
33
  endpoint: parsedResult.Endpoint,
29
34
  };
30
35
  if (parsedResult.EntityPath) {
@@ -1 +1 @@
1
- {"version":3,"file":"connectionStringUtils.js","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AA2CzD;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAC7C,gBAAwB;IAExB,MAAM,YAAY,GAAG,qBAAqB,CAMvC,gBAAgB,CAAC,CAAC;IACrB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,IAAI,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;YACrE,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,IAAI,YAAY,CAAC,eAAe,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;SAAM,IAAI,CAAC,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAyC;QACnD,uBAAuB,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/E,QAAQ,EAAE,YAAY,CAAC,QAAQ;KAChC,CAAC;IACF,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;QAC5B,MAAM,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;IAC9C,CAAC;IACD,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,MAAM,CAAC,qBAAqB,GAAG,YAAY,CAAC,qBAAqB,CAAC;IACpE,CAAC;IACD,IAAI,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QACrE,MAAM,CAAC,eAAe,GAAG,YAAY,CAAC,eAAe,CAAC;QACtD,MAAM,CAAC,mBAAmB,GAAG,YAAY,CAAC,mBAAmB,CAAC;IAChE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { parseConnectionString } from \"@azure/core-amqp\";\n\n/**\n * The set of properties that comprise a Service Bus connection string.\n */\nexport interface ServiceBusConnectionStringProperties {\n /**\n * The fully qualified Service Bus namespace extracted from the \"Endpoint\" in the\n * connection string. This is likely to be similar to `{yournamespace}.servicebus.windows.net`.\n * This is typically used to construct the ServiceBusClient.\n */\n fullyQualifiedNamespace: string;\n /**\n * The value for \"Endpoint\" in the connection string.\n */\n endpoint: string;\n /**\n * The value for \"EntityPath\" in the connection string which would be the name of the queue or\n * topic associated with the connection string.\n * Connection string from a Shared Access Policy created at the namespace level\n * will not have the EntityPath in it.\n */\n entityPath?: string;\n /**\n * The value for \"SharedAccessKey\" in the connection string. This along with the \"SharedAccessKeyName\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKey?: string;\n /**\n * The value for \"SharedAccessKeyName\" in the connection string. This along with the \"SharedAccessKey\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKeyName?: string;\n /**\n * The value for \"SharedAccessSignature\" in the connection string. This is typically not present in the\n * connection string generated for a Shared Access Policy. It is instead generated by the\n * user and appended to the connection string for ease of use.\n */\n sharedAccessSignature?: string;\n}\n\n/**\n * Parses given connection string into the different properties applicable to Azure Service Bus.\n * The properties are useful to then construct a ServiceBusClient.\n * @param connectionString - The connection string associated with the Shared Access Policy created\n * for the Service Bus namespace, queue or topic.\n */\nexport function parseServiceBusConnectionString(\n connectionString: string,\n): ServiceBusConnectionStringProperties {\n const parsedResult = parseConnectionString<{\n Endpoint: string;\n EntityPath?: string;\n SharedAccessSignature?: string;\n SharedAccessKey?: string;\n SharedAccessKeyName?: string;\n }>(connectionString);\n if (!parsedResult.Endpoint) {\n throw new Error(\"Connection string should have an Endpoint key.\");\n }\n\n if (parsedResult.SharedAccessSignature) {\n if (parsedResult.SharedAccessKey || parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string cannot have both SharedAccessSignature and SharedAccessKey keys.\",\n );\n }\n } else if (parsedResult.SharedAccessKey && !parsedResult.SharedAccessKeyName) {\n throw new Error(\"Connection string with SharedAccessKey should have SharedAccessKeyName.\");\n } else if (!parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string with SharedAccessKeyName should have SharedAccessKey as well.\",\n );\n }\n\n const output: ServiceBusConnectionStringProperties = {\n fullyQualifiedNamespace: (parsedResult.Endpoint.match(\".*://([^/]*)\") || [])[1],\n endpoint: parsedResult.Endpoint,\n };\n if (parsedResult.EntityPath) {\n output.entityPath = parsedResult.EntityPath;\n }\n if (parsedResult.SharedAccessSignature) {\n output.sharedAccessSignature = parsedResult.SharedAccessSignature;\n }\n if (parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n output.sharedAccessKey = parsedResult.SharedAccessKey;\n output.sharedAccessKeyName = parsedResult.SharedAccessKeyName;\n }\n return output;\n}\n"]}
1
+ {"version":3,"file":"connectionStringUtils.js","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AA2CzD;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAC7C,gBAAwB;IAExB,MAAM,YAAY,GAAG,qBAAqB,CAMvC,gBAAgB,CAAC,CAAC;IACrB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,IAAI,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;YACrE,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,IAAI,YAAY,CAAC,eAAe,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;SAAM,IAAI,CAAC,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;IACJ,CAAC;IAED,MAAM,uBAAuB,GAAG,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QAC/E,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;YACrC,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9D,MAAM,MAAM,GAAyC;QACnD,uBAAuB;QACvB,QAAQ,EAAE,YAAY,CAAC,QAAQ;KAChC,CAAC;IACF,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;QAC5B,MAAM,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;IAC9C,CAAC;IACD,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,MAAM,CAAC,qBAAqB,GAAG,YAAY,CAAC,qBAAqB,CAAC;IACpE,CAAC;IACD,IAAI,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QACrE,MAAM,CAAC,eAAe,GAAG,YAAY,CAAC,eAAe,CAAC;QACtD,MAAM,CAAC,mBAAmB,GAAG,YAAY,CAAC,mBAAmB,CAAC;IAChE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { parseConnectionString } from \"@azure/core-amqp\";\n\n/**\n * The set of properties that comprise a Service Bus connection string.\n */\nexport interface ServiceBusConnectionStringProperties {\n /**\n * The fully qualified Service Bus namespace extracted from the \"Endpoint\" in the\n * connection string. This is likely to be similar to `{yournamespace}.servicebus.windows.net`.\n * This is typically used to construct the ServiceBusClient.\n */\n fullyQualifiedNamespace: string;\n /**\n * The value for \"Endpoint\" in the connection string.\n */\n endpoint: string;\n /**\n * The value for \"EntityPath\" in the connection string which would be the name of the queue or\n * topic associated with the connection string.\n * Connection string from a Shared Access Policy created at the namespace level\n * will not have the EntityPath in it.\n */\n entityPath?: string;\n /**\n * The value for \"SharedAccessKey\" in the connection string. This along with the \"SharedAccessKeyName\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKey?: string;\n /**\n * The value for \"SharedAccessKeyName\" in the connection string. This along with the \"SharedAccessKey\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKeyName?: string;\n /**\n * The value for \"SharedAccessSignature\" in the connection string. This is typically not present in the\n * connection string generated for a Shared Access Policy. It is instead generated by the\n * user and appended to the connection string for ease of use.\n */\n sharedAccessSignature?: string;\n}\n\n/**\n * Parses given connection string into the different properties applicable to Azure Service Bus.\n * The properties are useful to then construct a ServiceBusClient.\n * @param connectionString - The connection string associated with the Shared Access Policy created\n * for the Service Bus namespace, queue or topic.\n */\nexport function parseServiceBusConnectionString(\n connectionString: string,\n): ServiceBusConnectionStringProperties {\n const parsedResult = parseConnectionString<{\n Endpoint: string;\n EntityPath?: string;\n SharedAccessSignature?: string;\n SharedAccessKey?: string;\n SharedAccessKeyName?: string;\n }>(connectionString);\n if (!parsedResult.Endpoint) {\n throw new Error(\"Connection string should have an Endpoint key.\");\n }\n\n if (parsedResult.SharedAccessSignature) {\n if (parsedResult.SharedAccessKey || parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string cannot have both SharedAccessSignature and SharedAccessKey keys.\",\n );\n }\n } else if (parsedResult.SharedAccessKey && !parsedResult.SharedAccessKeyName) {\n throw new Error(\"Connection string with SharedAccessKey should have SharedAccessKeyName.\");\n } else if (!parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string with SharedAccessKeyName should have SharedAccessKey as well.\",\n );\n }\n\n const fullyQualifiedNamespace = parsedResult.Endpoint.includes(\"0:0:0:0:0:0:0:1\")\n ? \"0:0:0:0:0:0:0:1\"\n : parsedResult.Endpoint.includes(\"::1\")\n ? \"::1\"\n : (parsedResult.Endpoint.match(\".*://([^/:]*)\") || [])[1];\n\n const output: ServiceBusConnectionStringProperties = {\n fullyQualifiedNamespace,\n endpoint: parsedResult.Endpoint,\n };\n if (parsedResult.EntityPath) {\n output.entityPath = parsedResult.EntityPath;\n }\n if (parsedResult.SharedAccessSignature) {\n output.sharedAccessSignature = parsedResult.SharedAccessSignature;\n }\n if (parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n output.sharedAccessKey = parsedResult.SharedAccessKey;\n output.sharedAccessKeyName = parsedResult.SharedAccessKeyName;\n }\n return output;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"connectionStringUtils.d.ts","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACnD;;;;OAIG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAChC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,MAAM,GACvB,oCAAoC,CAyCtC"}
1
+ {"version":3,"file":"connectionStringUtils.d.ts","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACnD;;;;OAIG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAChC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,MAAM,GACvB,oCAAoC,CA+CtC"}
@@ -23,8 +23,13 @@ export function parseServiceBusConnectionString(connectionString) {
23
23
  else if (!parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {
24
24
  throw new Error("Connection string with SharedAccessKeyName should have SharedAccessKey as well.");
25
25
  }
26
+ const fullyQualifiedNamespace = parsedResult.Endpoint.includes("0:0:0:0:0:0:0:1")
27
+ ? "0:0:0:0:0:0:0:1"
28
+ : parsedResult.Endpoint.includes("::1")
29
+ ? "::1"
30
+ : (parsedResult.Endpoint.match(".*://([^/:]*)") || [])[1];
26
31
  const output = {
27
- fullyQualifiedNamespace: (parsedResult.Endpoint.match(".*://([^/]*)") || [])[1],
32
+ fullyQualifiedNamespace,
28
33
  endpoint: parsedResult.Endpoint,
29
34
  };
30
35
  if (parsedResult.EntityPath) {
@@ -1 +1 @@
1
- {"version":3,"file":"connectionStringUtils.js","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AA2CzD;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAC7C,gBAAwB;IAExB,MAAM,YAAY,GAAG,qBAAqB,CAMvC,gBAAgB,CAAC,CAAC;IACrB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,IAAI,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;YACrE,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,IAAI,YAAY,CAAC,eAAe,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;SAAM,IAAI,CAAC,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAyC;QACnD,uBAAuB,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/E,QAAQ,EAAE,YAAY,CAAC,QAAQ;KAChC,CAAC;IACF,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;QAC5B,MAAM,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;IAC9C,CAAC;IACD,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,MAAM,CAAC,qBAAqB,GAAG,YAAY,CAAC,qBAAqB,CAAC;IACpE,CAAC;IACD,IAAI,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QACrE,MAAM,CAAC,eAAe,GAAG,YAAY,CAAC,eAAe,CAAC;QACtD,MAAM,CAAC,mBAAmB,GAAG,YAAY,CAAC,mBAAmB,CAAC;IAChE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { parseConnectionString } from \"@azure/core-amqp\";\n\n/**\n * The set of properties that comprise a Service Bus connection string.\n */\nexport interface ServiceBusConnectionStringProperties {\n /**\n * The fully qualified Service Bus namespace extracted from the \"Endpoint\" in the\n * connection string. This is likely to be similar to `{yournamespace}.servicebus.windows.net`.\n * This is typically used to construct the ServiceBusClient.\n */\n fullyQualifiedNamespace: string;\n /**\n * The value for \"Endpoint\" in the connection string.\n */\n endpoint: string;\n /**\n * The value for \"EntityPath\" in the connection string which would be the name of the queue or\n * topic associated with the connection string.\n * Connection string from a Shared Access Policy created at the namespace level\n * will not have the EntityPath in it.\n */\n entityPath?: string;\n /**\n * The value for \"SharedAccessKey\" in the connection string. This along with the \"SharedAccessKeyName\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKey?: string;\n /**\n * The value for \"SharedAccessKeyName\" in the connection string. This along with the \"SharedAccessKey\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKeyName?: string;\n /**\n * The value for \"SharedAccessSignature\" in the connection string. This is typically not present in the\n * connection string generated for a Shared Access Policy. It is instead generated by the\n * user and appended to the connection string for ease of use.\n */\n sharedAccessSignature?: string;\n}\n\n/**\n * Parses given connection string into the different properties applicable to Azure Service Bus.\n * The properties are useful to then construct a ServiceBusClient.\n * @param connectionString - The connection string associated with the Shared Access Policy created\n * for the Service Bus namespace, queue or topic.\n */\nexport function parseServiceBusConnectionString(\n connectionString: string,\n): ServiceBusConnectionStringProperties {\n const parsedResult = parseConnectionString<{\n Endpoint: string;\n EntityPath?: string;\n SharedAccessSignature?: string;\n SharedAccessKey?: string;\n SharedAccessKeyName?: string;\n }>(connectionString);\n if (!parsedResult.Endpoint) {\n throw new Error(\"Connection string should have an Endpoint key.\");\n }\n\n if (parsedResult.SharedAccessSignature) {\n if (parsedResult.SharedAccessKey || parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string cannot have both SharedAccessSignature and SharedAccessKey keys.\",\n );\n }\n } else if (parsedResult.SharedAccessKey && !parsedResult.SharedAccessKeyName) {\n throw new Error(\"Connection string with SharedAccessKey should have SharedAccessKeyName.\");\n } else if (!parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string with SharedAccessKeyName should have SharedAccessKey as well.\",\n );\n }\n\n const output: ServiceBusConnectionStringProperties = {\n fullyQualifiedNamespace: (parsedResult.Endpoint.match(\".*://([^/]*)\") || [])[1],\n endpoint: parsedResult.Endpoint,\n };\n if (parsedResult.EntityPath) {\n output.entityPath = parsedResult.EntityPath;\n }\n if (parsedResult.SharedAccessSignature) {\n output.sharedAccessSignature = parsedResult.SharedAccessSignature;\n }\n if (parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n output.sharedAccessKey = parsedResult.SharedAccessKey;\n output.sharedAccessKeyName = parsedResult.SharedAccessKeyName;\n }\n return output;\n}\n"]}
1
+ {"version":3,"file":"connectionStringUtils.js","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AA2CzD;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAC7C,gBAAwB;IAExB,MAAM,YAAY,GAAG,qBAAqB,CAMvC,gBAAgB,CAAC,CAAC;IACrB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,IAAI,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;YACrE,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,IAAI,YAAY,CAAC,eAAe,IAAI,CAAC,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;SAAM,IAAI,CAAC,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;IACJ,CAAC;IAED,MAAM,uBAAuB,GAAG,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QAC/E,CAAC,CAAC,iBAAiB;QACnB,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;YACrC,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9D,MAAM,MAAM,GAAyC;QACnD,uBAAuB;QACvB,QAAQ,EAAE,YAAY,CAAC,QAAQ;KAChC,CAAC;IACF,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;QAC5B,MAAM,CAAC,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC;IAC9C,CAAC;IACD,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,MAAM,CAAC,qBAAqB,GAAG,YAAY,CAAC,qBAAqB,CAAC;IACpE,CAAC;IACD,IAAI,YAAY,CAAC,eAAe,IAAI,YAAY,CAAC,mBAAmB,EAAE,CAAC;QACrE,MAAM,CAAC,eAAe,GAAG,YAAY,CAAC,eAAe,CAAC;QACtD,MAAM,CAAC,mBAAmB,GAAG,YAAY,CAAC,mBAAmB,CAAC;IAChE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { parseConnectionString } from \"@azure/core-amqp\";\n\n/**\n * The set of properties that comprise a Service Bus connection string.\n */\nexport interface ServiceBusConnectionStringProperties {\n /**\n * The fully qualified Service Bus namespace extracted from the \"Endpoint\" in the\n * connection string. This is likely to be similar to `{yournamespace}.servicebus.windows.net`.\n * This is typically used to construct the ServiceBusClient.\n */\n fullyQualifiedNamespace: string;\n /**\n * The value for \"Endpoint\" in the connection string.\n */\n endpoint: string;\n /**\n * The value for \"EntityPath\" in the connection string which would be the name of the queue or\n * topic associated with the connection string.\n * Connection string from a Shared Access Policy created at the namespace level\n * will not have the EntityPath in it.\n */\n entityPath?: string;\n /**\n * The value for \"SharedAccessKey\" in the connection string. This along with the \"SharedAccessKeyName\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKey?: string;\n /**\n * The value for \"SharedAccessKeyName\" in the connection string. This along with the \"SharedAccessKey\"\n * in the connection string is used to generate a SharedAccessSignature which can be used authorize\n * the connection to the service.\n */\n sharedAccessKeyName?: string;\n /**\n * The value for \"SharedAccessSignature\" in the connection string. This is typically not present in the\n * connection string generated for a Shared Access Policy. It is instead generated by the\n * user and appended to the connection string for ease of use.\n */\n sharedAccessSignature?: string;\n}\n\n/**\n * Parses given connection string into the different properties applicable to Azure Service Bus.\n * The properties are useful to then construct a ServiceBusClient.\n * @param connectionString - The connection string associated with the Shared Access Policy created\n * for the Service Bus namespace, queue or topic.\n */\nexport function parseServiceBusConnectionString(\n connectionString: string,\n): ServiceBusConnectionStringProperties {\n const parsedResult = parseConnectionString<{\n Endpoint: string;\n EntityPath?: string;\n SharedAccessSignature?: string;\n SharedAccessKey?: string;\n SharedAccessKeyName?: string;\n }>(connectionString);\n if (!parsedResult.Endpoint) {\n throw new Error(\"Connection string should have an Endpoint key.\");\n }\n\n if (parsedResult.SharedAccessSignature) {\n if (parsedResult.SharedAccessKey || parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string cannot have both SharedAccessSignature and SharedAccessKey keys.\",\n );\n }\n } else if (parsedResult.SharedAccessKey && !parsedResult.SharedAccessKeyName) {\n throw new Error(\"Connection string with SharedAccessKey should have SharedAccessKeyName.\");\n } else if (!parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n throw new Error(\n \"Connection string with SharedAccessKeyName should have SharedAccessKey as well.\",\n );\n }\n\n const fullyQualifiedNamespace = parsedResult.Endpoint.includes(\"0:0:0:0:0:0:0:1\")\n ? \"0:0:0:0:0:0:0:1\"\n : parsedResult.Endpoint.includes(\"::1\")\n ? \"::1\"\n : (parsedResult.Endpoint.match(\".*://([^/:]*)\") || [])[1];\n\n const output: ServiceBusConnectionStringProperties = {\n fullyQualifiedNamespace,\n endpoint: parsedResult.Endpoint,\n };\n if (parsedResult.EntityPath) {\n output.entityPath = parsedResult.EntityPath;\n }\n if (parsedResult.SharedAccessSignature) {\n output.sharedAccessSignature = parsedResult.SharedAccessSignature;\n }\n if (parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n output.sharedAccessKey = parsedResult.SharedAccessKey;\n output.sharedAccessKeyName = parsedResult.SharedAccessKeyName;\n }\n return output;\n}\n"]}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@azure/service-bus",
3
3
  "sdk-type": "client",
4
4
  "author": "Microsoft Corporation",
5
- "version": "7.10.0-alpha.20250102.1",
5
+ "version": "7.10.0-alpha.20250106.1",
6
6
  "license": "MIT",
7
7
  "description": "Azure Service Bus SDK for JavaScript",
8
8
  "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicebus/service-bus/",