@azure/event-hubs 5.12.0-alpha.20240516.2 → 5.12.0-alpha.20240520.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- import { isLoopbackAddress, parseConnectionString } from "@azure/core-amqp";
3
+ import { parseConnectionString } from "@azure/core-amqp";
4
4
  /**
5
5
  * Parses given connection string into the different properties applicable to Azure Event Hubs.
6
6
  * The properties are useful to then construct an EventHubProducerClient or an EventHubConsumerClient.
@@ -29,7 +29,7 @@ export function parseEventHubConnectionString(connectionString) {
29
29
  /**
30
30
  * @internal
31
31
  */
32
- function validateProperties(endpoint, sharedAccessSignature, sharedAccessKey, sharedAccessKeyName, useDevelopmentEmulator) {
32
+ function validateProperties(endpoint, sharedAccessSignature, sharedAccessKey, sharedAccessKeyName) {
33
33
  if (!endpoint) {
34
34
  throw new Error("Connection string should have an Endpoint key.");
35
35
  }
@@ -44,8 +44,5 @@ function validateProperties(endpoint, sharedAccessSignature, sharedAccessKey, sh
44
44
  else if (!sharedAccessKey && sharedAccessKeyName) {
45
45
  throw new Error("Connection string with SharedAccessKeyName should have SharedAccessKey as well.");
46
46
  }
47
- if (useDevelopmentEmulator === "true" && !isLoopbackAddress(endpoint)) {
48
- throw new Error("Connection string should either has a loopback address or not have UseDevelopmentEmulator.");
49
- }
50
47
  }
51
48
  //# sourceMappingURL=connectionStringUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"connectionStringUtils.js","sourceRoot":"","sources":["../../../src/util/connectionStringUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AA+C5E;;;;;GAKG;AACH,MAAM,UAAU,6BAA6B,CAC3C,gBAAwB;IAExB,MAAM,YAAY,GAAG,qBAAqB,CAOvC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E,CAAC,CAAC;IAC7F,CAAC;SAAM,IAAI,CAAC,eAAe,IAAI,mBAAmB,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;IACJ,CAAC;IAED,IAAI,sBAAsB,KAAK,MAAM,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtE,MAAM,IAAI,KAAK,CACb,4FAA4F,CAC7F,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isLoopbackAddress, parseConnectionString } from \"@azure/core-amqp\";\n\n/**\n * The set of properties that comprise an Event Hub connection string.\n */\nexport interface EventHubConnectionStringProperties {\n /**\n * The fully qualified Event Hub 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 an EventHubProducerClient or an EventHubConsumerClient.\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 event hub instance 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 eventHubName?: 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 * This should be true only if the connection string contains the slug \";UseDevelopmentEmulator=true\"\n * and the endpoint is a loopback address.\n */\n useDevelopmentEmulator?: boolean;\n}\n\n/**\n * Parses given connection string into the different properties applicable to Azure Event Hubs.\n * The properties are useful to then construct an EventHubProducerClient or an EventHubConsumerClient.\n * @param connectionString - The connection string associated with the Shared Access Policy created\n * for the Event Hubs namespace.\n */\nexport function parseEventHubConnectionString(\n connectionString: string,\n): Readonly<EventHubConnectionStringProperties> {\n const parsedResult = parseConnectionString<{\n Endpoint: string;\n EntityPath?: string;\n SharedAccessSignature?: string;\n SharedAccessKey?: string;\n SharedAccessKeyName?: string;\n UseDevelopmentEmulator?: string;\n }>(connectionString);\n\n validateProperties(\n parsedResult.Endpoint,\n parsedResult.SharedAccessSignature,\n parsedResult.SharedAccessKey,\n parsedResult.SharedAccessKeyName,\n );\n\n const output: EventHubConnectionStringProperties = {\n fullyQualifiedNamespace: (parsedResult.Endpoint.match(\".*://([^/]*)\") || [])[1],\n endpoint: parsedResult.Endpoint,\n };\n\n if (parsedResult.EntityPath) {\n output.eventHubName = parsedResult.EntityPath;\n }\n\n if (parsedResult.SharedAccessSignature) {\n output.sharedAccessSignature = parsedResult.SharedAccessSignature;\n }\n\n if (parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n output.sharedAccessKey = parsedResult.SharedAccessKey;\n output.sharedAccessKeyName = parsedResult.SharedAccessKeyName;\n }\n\n return output;\n}\n\n/**\n * @internal\n */\nfunction validateProperties(\n endpoint?: string,\n sharedAccessSignature?: string,\n sharedAccessKey?: string,\n sharedAccessKeyName?: string,\n useDevelopmentEmulator?: string,\n): void {\n if (!endpoint) {\n throw new Error(\"Connection string should have an Endpoint key.\");\n }\n\n if (sharedAccessSignature) {\n if (sharedAccessKey || sharedAccessKeyName) {\n throw new Error(\n \"Connection string cannot have both SharedAccessSignature and SharedAccessKey keys.\",\n );\n }\n } else if (sharedAccessKey && !sharedAccessKeyName) {\n throw new Error(\"Connection string with SharedAccessKey should have SharedAccessKeyName.\");\n } else if (!sharedAccessKey && sharedAccessKeyName) {\n throw new Error(\n \"Connection string with SharedAccessKeyName should have SharedAccessKey as well.\",\n );\n }\n\n if (useDevelopmentEmulator === \"true\" && !isLoopbackAddress(endpoint)) {\n throw new Error(\n \"Connection string should either has a loopback address or not have UseDevelopmentEmulator.\",\n );\n }\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;AA+CzD;;;;;GAKG;AACH,MAAM,UAAU,6BAA6B,CAC3C,gBAAwB;IAExB,MAAM,YAAY,GAAG,qBAAqB,CAOvC,gBAAgB,CAAC,CAAC;IAErB,kBAAkB,CAChB,YAAY,CAAC,QAAQ,EACrB,YAAY,CAAC,qBAAqB,EAClC,YAAY,CAAC,eAAe,EAC5B,YAAY,CAAC,mBAAmB,CACjC,CAAC;IAEF,MAAM,MAAM,GAAuC;QACjD,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;IAEF,IAAI,YAAY,CAAC,UAAU,EAAE,CAAC;QAC5B,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC,UAAU,CAAC;IAChD,CAAC;IAED,IAAI,YAAY,CAAC,qBAAqB,EAAE,CAAC;QACvC,MAAM,CAAC,qBAAqB,GAAG,YAAY,CAAC,qBAAqB,CAAC;IACpE,CAAC;IAED,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;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CACzB,QAAiB,EACjB,qBAA8B,EAC9B,eAAwB,EACxB,mBAA4B;IAE5B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,qBAAqB,EAAE,CAAC;QAC1B,IAAI,eAAe,IAAI,mBAAmB,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,IAAI,eAAe,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;SAAM,IAAI,CAAC,eAAe,IAAI,mBAAmB,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CACb,iFAAiF,CAClF,CAAC;IACJ,CAAC;AACH,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 an Event Hub connection string.\n */\nexport interface EventHubConnectionStringProperties {\n /**\n * The fully qualified Event Hub 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 an EventHubProducerClient or an EventHubConsumerClient.\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 event hub instance 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 eventHubName?: 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 * This should be true only if the connection string contains the slug \";UseDevelopmentEmulator=true\"\n * and the endpoint is a loopback address.\n */\n useDevelopmentEmulator?: boolean;\n}\n\n/**\n * Parses given connection string into the different properties applicable to Azure Event Hubs.\n * The properties are useful to then construct an EventHubProducerClient or an EventHubConsumerClient.\n * @param connectionString - The connection string associated with the Shared Access Policy created\n * for the Event Hubs namespace.\n */\nexport function parseEventHubConnectionString(\n connectionString: string,\n): Readonly<EventHubConnectionStringProperties> {\n const parsedResult = parseConnectionString<{\n Endpoint: string;\n EntityPath?: string;\n SharedAccessSignature?: string;\n SharedAccessKey?: string;\n SharedAccessKeyName?: string;\n UseDevelopmentEmulator?: string;\n }>(connectionString);\n\n validateProperties(\n parsedResult.Endpoint,\n parsedResult.SharedAccessSignature,\n parsedResult.SharedAccessKey,\n parsedResult.SharedAccessKeyName,\n );\n\n const output: EventHubConnectionStringProperties = {\n fullyQualifiedNamespace: (parsedResult.Endpoint.match(\".*://([^/]*)\") || [])[1],\n endpoint: parsedResult.Endpoint,\n };\n\n if (parsedResult.EntityPath) {\n output.eventHubName = parsedResult.EntityPath;\n }\n\n if (parsedResult.SharedAccessSignature) {\n output.sharedAccessSignature = parsedResult.SharedAccessSignature;\n }\n\n if (parsedResult.SharedAccessKey && parsedResult.SharedAccessKeyName) {\n output.sharedAccessKey = parsedResult.SharedAccessKey;\n output.sharedAccessKeyName = parsedResult.SharedAccessKeyName;\n }\n\n return output;\n}\n\n/**\n * @internal\n */\nfunction validateProperties(\n endpoint?: string,\n sharedAccessSignature?: string,\n sharedAccessKey?: string,\n sharedAccessKeyName?: string,\n): void {\n if (!endpoint) {\n throw new Error(\"Connection string should have an Endpoint key.\");\n }\n\n if (sharedAccessSignature) {\n if (sharedAccessKey || sharedAccessKeyName) {\n throw new Error(\n \"Connection string cannot have both SharedAccessSignature and SharedAccessKey keys.\",\n );\n }\n } else if (sharedAccessKey && !sharedAccessKeyName) {\n throw new Error(\"Connection string with SharedAccessKey should have SharedAccessKeyName.\");\n } else if (!sharedAccessKey && sharedAccessKeyName) {\n throw new Error(\n \"Connection string with SharedAccessKeyName should have SharedAccessKey as well.\",\n );\n }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@azure/event-hubs",
3
3
  "sdk-type": "client",
4
- "version": "5.12.0-alpha.20240516.2",
4
+ "version": "5.12.0-alpha.20240520.4",
5
5
  "description": "Azure Event Hubs SDK for JS.",
6
6
  "author": "Microsoft Corporation",
7
7
  "license": "MIT",
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.43.5"
8
+ "packageVersion": "7.43.7"
9
9
  }
10
10
  ]
11
11
  }