@gradientedge/cdk-utils-azure 2.48.0 → 2.50.0

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.
@@ -18,13 +18,10 @@ import { AzureEventHandlerProps, EventHandlerEventGridSubscription, EventHandler
18
18
  * | `true` | `true` | Look up both. Cross-stack pattern where the producer/owner of the queue is a different stack (e.g. `WebhookEventHandler` consuming a queue created by `WebhookGateway`). |
19
19
  * | `false` | `true` | **Invalid** — construct-time error. You cannot resolve an existing queue under a namespace the construct is creating. |
20
20
  *
21
- * The top-level `serviceBus.useExisting` flag is retained as a deprecated alias that sets both
22
- * per-resource flags to the same value, so existing callers continue to work unchanged.
23
- *
24
21
  * ## Authorization and the `EVENT_INGEST_SERVICE_BUS` connection string
25
22
  *
26
23
  * When the construct owns the queue (`queue.useExisting=false`), it provisions a per-queue
27
- * authorization rule named `${id}-listen-send` with `Listen + Send` rights, and the function app's
24
+ * authorization rule named `listen-send` (scoped to the queue) with `Listen + Send` rights, and the function app's
28
25
  * `EVENT_INGEST_SERVICE_BUS` connection string is sourced from that rule. This avoids granting the
29
26
  * function app access to sibling queues when the namespace is shared.
30
27
  *
@@ -99,8 +96,6 @@ export declare class AzureEventHandler extends AzureFunctionApp {
99
96
  /**
100
97
  * @summary Resolve effective `useExisting` flags for the Service Bus namespace and queue.
101
98
  *
102
- * Per-resource flags (`namespace.useExisting`, `queue.useExisting`) take precedence over the
103
- * deprecated top-level `serviceBus.useExisting`, which is treated as an alias that sets both.
104
99
  * Throws if the invalid combination (namespace.useExisting=false + queue.useExisting=true) is
105
100
  * requested — a queue cannot be looked up under a namespace the construct is about to create.
106
101
  */
@@ -19,13 +19,10 @@ import { AzureFunctionApp } from '../function-app/index.js';
19
19
  * | `true` | `true` | Look up both. Cross-stack pattern where the producer/owner of the queue is a different stack (e.g. `WebhookEventHandler` consuming a queue created by `WebhookGateway`). |
20
20
  * | `false` | `true` | **Invalid** — construct-time error. You cannot resolve an existing queue under a namespace the construct is creating. |
21
21
  *
22
- * The top-level `serviceBus.useExisting` flag is retained as a deprecated alias that sets both
23
- * per-resource flags to the same value, so existing callers continue to work unchanged.
24
- *
25
22
  * ## Authorization and the `EVENT_INGEST_SERVICE_BUS` connection string
26
23
  *
27
24
  * When the construct owns the queue (`queue.useExisting=false`), it provisions a per-queue
28
- * authorization rule named `${id}-listen-send` with `Listen + Send` rights, and the function app's
25
+ * authorization rule named `listen-send` (scoped to the queue) with `Listen + Send` rights, and the function app's
29
26
  * `EVENT_INGEST_SERVICE_BUS` connection string is sourced from that rule. This avoids granting the
30
27
  * function app access to sibling queues when the namespace is shared.
31
28
  *
@@ -137,20 +134,12 @@ export class AzureEventHandler extends AzureFunctionApp {
137
134
  /**
138
135
  * @summary Resolve effective `useExisting` flags for the Service Bus namespace and queue.
139
136
  *
140
- * Per-resource flags (`namespace.useExisting`, `queue.useExisting`) take precedence over the
141
- * deprecated top-level `serviceBus.useExisting`, which is treated as an alias that sets both.
142
137
  * Throws if the invalid combination (namespace.useExisting=false + queue.useExisting=true) is
143
138
  * requested — a queue cannot be looked up under a namespace the construct is about to create.
144
139
  */
145
140
  resolveServiceBusUseExisting() {
146
- // TODO: remove `deprecatedServiceBusUseExisting` and the `?? deprecatedServiceBusUseExisting`
147
- // fallbacks once all callers have migrated to the per-resource flags
148
- // (see EventHandlerServiceBusProps.useExisting in types.ts).
149
- const deprecatedServiceBusUseExisting = this.props.serviceBus?.useExisting;
150
- const namespaceUseExisting = this.props.serviceBus?.namespace?.useExisting;
151
- const queueUseExisting = this.props.serviceBus?.queue?.useExisting;
152
- const namespace = namespaceUseExisting ?? deprecatedServiceBusUseExisting ?? false;
153
- const queue = queueUseExisting ?? deprecatedServiceBusUseExisting ?? false;
141
+ const namespace = this.props.serviceBus?.namespace?.useExisting ?? false;
142
+ const queue = this.props.serviceBus?.queue?.useExisting ?? false;
154
143
  if (!namespace && queue) {
155
144
  throw new Error(`[${this.id}] invalid serviceBus configuration: queue.useExisting=true requires namespace.useExisting=true ` +
156
145
  `(cannot resolve an existing queue under a namespace the construct is creating).`);
@@ -231,8 +220,11 @@ export class AzureEventHandler extends AzureFunctionApp {
231
220
  const namespaceResourceGroupName = useExistingFlags.namespace
232
221
  ? (this.props.serviceBus?.namespace?.resourceGroupName ?? this.resourceGroup.name)
233
222
  : this.resourceGroup.name;
223
+ // Azure caps `authorizationRuleName` at 50 chars. The rule's scope is the queue itself
224
+ // (`…/namespaces/<ns>/queues/<queue>/authorizationRules/<rule>`), so a literal name is
225
+ // unambiguous and avoids hitting the cap on long stack ids.
234
226
  this.serviceBus.queueAuthorizationRule = this.serviceBusManager.createServiceBusQueueAuthorizationRule(this.id, this, {
235
- authorizationRuleName: `${this.id}-listen-send`,
227
+ authorizationRuleName: 'listen-send',
236
228
  namespaceName: this.serviceBus.namespace.name,
237
229
  queueName: this.serviceBus.queue.name,
238
230
  resourceGroupName: namespaceResourceGroupName,
@@ -61,14 +61,6 @@ export interface EventHandlerServiceBusProps {
61
61
  namespace?: EventHandlerServiceBusNamespaceProps;
62
62
  /** Service Bus queue properties (extends {@link ServiceBusQueueProps} with `useExisting`) */
63
63
  queue?: EventHandlerServiceBusQueueProps;
64
- /**
65
- * Convenience alias that sets both `namespace.useExisting` and `queue.useExisting` to the same value.
66
- * @deprecated Prefer `namespace.useExisting` and `queue.useExisting` individually. Retained as an alias
67
- * so existing callers (e.g. WebhookEventHandler) continue to compile unchanged.
68
- * TODO: remove once all callers have migrated to the per-resource flags. Also remove the
69
- * resolution fallback in `resolveServiceBusUseExisting()` in main.ts.
70
- */
71
- useExisting?: boolean;
72
64
  }
73
65
  /**
74
66
  * Provisioned Service Bus resources for the event handler
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils-azure",
3
- "version": "2.48.0",
3
+ "version": "2.50.0",
4
4
  "description": "Azure Pulumi utilities for @gradientedge/cdk-utils",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",