@lafken/event 0.11.8 → 0.11.9

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,4 +1,4 @@
1
- import type { BucketNames, DynamoTableNames, EventBusNames, LambdaMetadata, LambdaProps } from '@lafken/common';
1
+ import type { BucketNames, DynamoTableNames, EventBusNames, EventRuleReferenceNames, LambdaMetadata, LambdaProps } from '@lafken/common';
2
2
  export interface EventRuleBaseProps {
3
3
  /**
4
4
  * Maximum event age.
@@ -39,6 +39,15 @@ export interface EventRuleBaseProps {
39
39
  * }
40
40
  */
41
41
  lambda?: LambdaProps;
42
+ /**
43
+ * Registers this Event Rule as a named global reference, allowing other resources
44
+ * to access its attributes (e.g. execution ARN, endpoint URL) by reference name.
45
+ *
46
+ * @example
47
+ * // Register the API under a reference name
48
+ * ref: 'event-rule'
49
+ */
50
+ ref?: EventRuleReferenceNames;
42
51
  }
43
52
  export type S3DetailType = 'Object Created' | 'Object Deleted';
44
53
  export type S3ObjectKey = {
@@ -41,7 +41,9 @@ class EventRuleResolver {
41
41
  });
42
42
  new resolver_1.ResourceOutput(eventBus, eventBusProps.outputs);
43
43
  }
44
- eventBus.isGlobal('event-bus', eventBusProps.busName);
44
+ if (eventBusProps.ref) {
45
+ eventBus.register('event-bus', eventBusProps.ref);
46
+ }
45
47
  this.eventBuses[eventBusProps.busName] = {
46
48
  eventBus: eventBus,
47
49
  extend: eventBusProps.extend,
@@ -1,6 +1,6 @@
1
1
  import type { CloudwatchEventBus } from '@cdktn/provider-aws/lib/cloudwatch-event-bus';
2
2
  import type { DataAwsCloudwatchEventBus } from '@cdktn/provider-aws/lib/data-aws-cloudwatch-event-bus';
3
- import type { EventBusNames, ResourceOutputType } from '@lafken/common';
3
+ import type { EventBusNames, EventBusReferenceNames, ResourceOutputType } from '@lafken/common';
4
4
  import type { AppStack } from '@lafken/resolver';
5
5
  export type BusOutputAttributes = 'arn' | 'id';
6
6
  interface ExtendProps<T> {
@@ -28,6 +28,15 @@ export interface EventRuleResolverBaseProps {
28
28
  * is always provisioned automatically.
29
29
  */
30
30
  busName: EventBusNames;
31
+ /**
32
+ * Registers this Event bus as a named global reference, allowing other resources
33
+ * to access its attributes (e.g. execution ARN) by reference name.
34
+ *
35
+ * @example
36
+ * // Register the API under a reference name
37
+ * ref: 'event-bus'
38
+ */
39
+ ref?: EventBusReferenceNames;
31
40
  }
32
41
  export interface InternalEventRuleResolverProps extends EventRuleResolverBaseProps {
33
42
  isExternal?: never;
@@ -2,8 +2,8 @@ import { CloudwatchEventRule } from '@cdktn/provider-aws/lib/cloudwatch-event-ru
2
2
  import { type AppModule } from '@lafken/resolver';
3
3
  import type { RuleProps } from './rule.types';
4
4
  declare const Rule_base: (new (...args: any[]) => {
5
- isGlobal(module: import("@lafken/common").ModuleGlobalReferenceNames | (string & {}), id: string): void;
6
- isDependent(resolveDependency: () => void): void;
5
+ register(namespaces: import("@lafken/common").RegisterNamespaces | (string & {}), id: string): void;
6
+ onResolve(callback: () => void): void;
7
7
  readonly node: import("constructs").Node;
8
8
  with(...mixins: import("constructs").IMixin[]): import("constructs").IConstruct;
9
9
  toString(): string;
@@ -15,7 +15,9 @@ class Rule extends resolver_1.lafkenResource.make(cloudwatch_event_rule_1.Cloudw
15
15
  eventPattern: cdktn_1.Fn.jsonencode(Rule.getEvent(handler)),
16
16
  });
17
17
  this.props = props;
18
- this.isGlobal(scope.id, id);
18
+ if (props.handler.ref) {
19
+ this.register('event-rule', props.handler.ref);
20
+ }
19
21
  this.addEventTarget(id);
20
22
  }
21
23
  addEventTarget(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lafken/event",
3
- "version": "0.11.8",
3
+ "version": "0.11.9",
4
4
  "private": false,
5
5
  "description": "Define EventBridge event listeners using TypeScript decorators - serverless event-driven infrastructure",
6
6
  "keywords": [
@@ -49,26 +49,26 @@
49
49
  ],
50
50
  "dependencies": {
51
51
  "reflect-metadata": "^0.2.2",
52
- "@lafken/resolver": "0.11.8"
52
+ "@lafken/resolver": "0.11.9"
53
53
  },
54
54
  "devDependencies": {
55
- "@cdktn/provider-aws": "^23.5.0",
56
- "@swc/core": "^1.15.21",
57
- "@swc/helpers": "^0.5.20",
58
- "@vitest/runner": "^4.1.2",
55
+ "@cdktn/provider-aws": "^23.9.0",
56
+ "@swc/core": "^1.15.30",
57
+ "@swc/helpers": "^0.5.21",
58
+ "@vitest/runner": "^4.1.5",
59
59
  "cdktn": "^0.22.1",
60
60
  "cdktn-vitest": "^1.0.0",
61
61
  "constructs": "^10.6.0",
62
- "typescript": "6.0.2",
62
+ "typescript": "6.0.3",
63
63
  "unplugin-swc": "^1.5.9",
64
- "vitest": "^4.1.2",
65
- "@lafken/common": "0.11.8"
64
+ "vitest": "^4.1.5",
65
+ "@lafken/common": "0.11.9"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "@cdktn/provider-aws": ">=23.0.0",
69
69
  "cdktn": ">=0.22.0",
70
70
  "constructs": "^10.4.5",
71
- "@lafken/common": "0.11.8"
71
+ "@lafken/common": "0.11.9"
72
72
  },
73
73
  "engines": {
74
74
  "node": ">=20.19"