@auriclabs/events-infra 0.1.0 → 0.3.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @auriclabs/events-infra@0.1.0 build /home/runner/work/packages/packages/packages/events-infra
2
+ > @auriclabs/events-infra@0.3.0 build /home/runner/work/packages/packages/packages/events-infra
3
3
  > tsdown src/index.ts --format cjs,esm --dts --tsconfig tsconfig.build.json --no-hash
4
4
 
5
5
  [tsdown] Node.js v20.20.1 is deprecated. Support will be removed in the next minor release. Please upgrade to Node.js 22.18.0 or later.
@@ -7,19 +7,19 @@
7
7
  ℹ entry: src/index.ts
8
8
  ℹ tsconfig: tsconfig.build.json
9
9
  ℹ Build start
10
- ℹ [CJS] dist/index.cjs 1.14 kB │ gzip: 0.57 kB
11
- ℹ [CJS] 1 files, total: 1.14 kB
12
- ℹ [ESM] dist/index.mjs 1.03 kB │ gzip: 0.54 kB
13
- ℹ [ESM] dist/index.mjs.map 2.18 kB │ gzip: 0.95 kB
14
- ℹ [ESM] dist/index.d.mts.map 0.52 kB │ gzip: 0.27 kB
15
- ℹ [ESM] dist/index.d.mts 0.77 kB │ gzip: 0.33 kB
16
- ℹ [ESM] 4 files, total: 4.50 kB
17
- [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugin `rolldown-plugin-dts:generate`. See https://rolldown.rs/options/checks#plugintimings for more details.
18
-
10
+ ℹ [CJS] dist/index.cjs 1.22 kB │ gzip: 0.59 kB
11
+ ℹ [CJS] 1 files, total: 1.22 kB
19
12
  ℹ [CJS] dist/index.d.cts.map 0.52 kB │ gzip: 0.27 kB
20
13
  ℹ [CJS] dist/index.d.cts 0.77 kB │ gzip: 0.33 kB
21
14
  ℹ [CJS] 2 files, total: 1.29 kB
22
- ✔ Build complete in 11027ms
23
15
  [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugin `rolldown-plugin-dts:generate`. See https://rolldown.rs/options/checks#plugintimings for more details.
24
16
 
25
- ✔ Build complete in 11028ms
17
+ ✔ Build complete in 10963ms
18
+ ℹ [ESM] dist/index.mjs 1.11 kB │ gzip: 0.56 kB
19
+ ℹ [ESM] dist/index.mjs.map 2.32 kB │ gzip: 0.99 kB
20
+ ℹ [ESM] dist/index.d.mts.map 0.52 kB │ gzip: 0.27 kB
21
+ ℹ [ESM] dist/index.d.mts 0.77 kB │ gzip: 0.33 kB
22
+ ℹ [ESM] 4 files, total: 4.72 kB
23
+ [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugin `rolldown-plugin-dts:generate`. See https://rolldown.rs/options/checks#plugintimings for more details.
24
+
25
+ ✔ Build complete in 10968ms
package/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # @auriclabs/events-infra
2
+
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9614859: Add tenantId to EventRecord and a tenantIndex GSI on the event store for tenant-scoped
8
+ queries.
9
+
10
+ ## 0.2.0
11
+
12
+ ### Minor Changes
13
+
14
+ - eeb513b: Add @auriclabs/events-infra package with SST infrastructure components for event bus,
15
+ event listeners, and event store.
package/dist/index.cjs CHANGED
@@ -4,13 +4,17 @@ function createEventStore(name, options) {
4
4
  return new sst.aws.Dynamo(name, {
5
5
  fields: {
6
6
  pk: "string",
7
- sk: "string"
7
+ sk: "string",
8
+ tenantId: "string"
8
9
  },
9
10
  primaryIndex: {
10
11
  hashKey: "pk",
11
12
  rangeKey: "sk"
12
13
  },
13
- globalIndexes: {},
14
+ globalIndexes: { tenantIndex: {
15
+ hashKey: "tenantId",
16
+ rangeKey: "pk"
17
+ } },
14
18
  stream: "new-and-old-images",
15
19
  transform: { table: {
16
20
  tableClass: "STANDARD_INFREQUENT_ACCESS",
package/dist/index.mjs CHANGED
@@ -3,13 +3,17 @@ function createEventStore(name, options) {
3
3
  return new sst.aws.Dynamo(name, {
4
4
  fields: {
5
5
  pk: "string",
6
- sk: "string"
6
+ sk: "string",
7
+ tenantId: "string"
7
8
  },
8
9
  primaryIndex: {
9
10
  hashKey: "pk",
10
11
  rangeKey: "sk"
11
12
  },
12
- globalIndexes: {},
13
+ globalIndexes: { tenantIndex: {
14
+ hashKey: "tenantId",
15
+ rangeKey: "pk"
16
+ } },
13
17
  stream: "new-and-old-images",
14
18
  transform: { table: {
15
19
  tableClass: "STANDARD_INFREQUENT_ACCESS",
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/event-store.ts","../src/event-bus.ts","../src/event-listeners.ts"],"sourcesContent":["export interface CreateEventStoreOptions {\n transform?: {\n table?: Record<string, unknown>;\n };\n}\n\nexport function createEventStore(name: string, options?: CreateEventStoreOptions) {\n return new sst.aws.Dynamo(name, {\n fields: {\n pk: 'string',\n sk: 'string',\n },\n primaryIndex: {\n hashKey: 'pk',\n rangeKey: 'sk',\n },\n globalIndexes: {},\n stream: 'new-and-old-images',\n transform: {\n table: {\n tableClass: 'STANDARD_INFREQUENT_ACCESS',\n ...options?.transform?.table,\n },\n },\n });\n}\n","export function createEventBus(name: string) {\n return new sst.aws.Bus(name);\n}\n","export interface SubscribeEventStreamConfig {\n table: sst.aws.Dynamo;\n bus: sst.aws.Bus;\n listenerQueues: sst.aws.Queue[];\n handlerPath: string;\n}\n\nexport function subscribeEventStream(config: SubscribeEventStreamConfig) {\n const { table, bus, listenerQueues, handlerPath } = config;\n\n table.subscribe(\n 'EventStoreTableStream',\n {\n handler: handlerPath,\n link: [bus, ...listenerQueues],\n environment: {\n QUEUE_URL_LIST: $jsonStringify(listenerQueues.map((queue) => queue.url)),\n },\n },\n {\n filters: [\n {\n dynamodb: {\n NewImage: {\n itemType: { S: ['event'] },\n },\n },\n },\n ],\n },\n );\n}\n"],"mappings":";AAMA,SAAgB,iBAAiB,MAAc,SAAmC;AAChF,QAAO,IAAI,IAAI,IAAI,OAAO,MAAM;EAC9B,QAAQ;GACN,IAAI;GACJ,IAAI;GACL;EACD,cAAc;GACZ,SAAS;GACT,UAAU;GACX;EACD,eAAe,EAAE;EACjB,QAAQ;EACR,WAAW,EACT,OAAO;GACL,YAAY;GACZ,GAAG,SAAS,WAAW;GACxB,EACF;EACF,CAAC;;;;ACxBJ,SAAgB,eAAe,MAAc;AAC3C,QAAO,IAAI,IAAI,IAAI,IAAI,KAAK;;;;ACM9B,SAAgB,qBAAqB,QAAoC;CACvE,MAAM,EAAE,OAAO,KAAK,gBAAgB,gBAAgB;AAEpD,OAAM,UACJ,yBACA;EACE,SAAS;EACT,MAAM,CAAC,KAAK,GAAG,eAAe;EAC9B,aAAa,EACX,gBAAgB,eAAe,eAAe,KAAK,UAAU,MAAM,IAAI,CAAC,EACzE;EACF,EACD,EACE,SAAS,CACP,EACE,UAAU,EACR,UAAU,EACR,UAAU,EAAE,GAAG,CAAC,QAAQ,EAAE,EAC3B,EACF,EACF,CACF,EACF,CACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/event-store.ts","../src/event-bus.ts","../src/event-listeners.ts"],"sourcesContent":["export interface CreateEventStoreOptions {\n transform?: {\n table?: Record<string, unknown>;\n };\n}\n\nexport function createEventStore(name: string, options?: CreateEventStoreOptions) {\n return new sst.aws.Dynamo(name, {\n fields: {\n pk: 'string',\n sk: 'string',\n tenantId: 'string',\n },\n primaryIndex: {\n hashKey: 'pk',\n rangeKey: 'sk',\n },\n globalIndexes: {\n tenantIndex: { hashKey: 'tenantId', rangeKey: 'pk' },\n },\n stream: 'new-and-old-images',\n transform: {\n table: {\n tableClass: 'STANDARD_INFREQUENT_ACCESS',\n ...options?.transform?.table,\n },\n },\n });\n}\n","export function createEventBus(name: string) {\n return new sst.aws.Bus(name);\n}\n","export interface SubscribeEventStreamConfig {\n table: sst.aws.Dynamo;\n bus: sst.aws.Bus;\n listenerQueues: sst.aws.Queue[];\n handlerPath: string;\n}\n\nexport function subscribeEventStream(config: SubscribeEventStreamConfig) {\n const { table, bus, listenerQueues, handlerPath } = config;\n\n table.subscribe(\n 'EventStoreTableStream',\n {\n handler: handlerPath,\n link: [bus, ...listenerQueues],\n environment: {\n QUEUE_URL_LIST: $jsonStringify(listenerQueues.map((queue) => queue.url)),\n },\n },\n {\n filters: [\n {\n dynamodb: {\n NewImage: {\n itemType: { S: ['event'] },\n },\n },\n },\n ],\n },\n );\n}\n"],"mappings":";AAMA,SAAgB,iBAAiB,MAAc,SAAmC;AAChF,QAAO,IAAI,IAAI,IAAI,OAAO,MAAM;EAC9B,QAAQ;GACN,IAAI;GACJ,IAAI;GACJ,UAAU;GACX;EACD,cAAc;GACZ,SAAS;GACT,UAAU;GACX;EACD,eAAe,EACb,aAAa;GAAE,SAAS;GAAY,UAAU;GAAM,EACrD;EACD,QAAQ;EACR,WAAW,EACT,OAAO;GACL,YAAY;GACZ,GAAG,SAAS,WAAW;GACxB,EACF;EACF,CAAC;;;;AC3BJ,SAAgB,eAAe,MAAc;AAC3C,QAAO,IAAI,IAAI,IAAI,IAAI,KAAK;;;;ACM9B,SAAgB,qBAAqB,QAAoC;CACvE,MAAM,EAAE,OAAO,KAAK,gBAAgB,gBAAgB;AAEpD,OAAM,UACJ,yBACA;EACE,SAAS;EACT,MAAM,CAAC,KAAK,GAAG,eAAe;EAC9B,aAAa,EACX,gBAAgB,eAAe,eAAe,KAAK,UAAU,MAAM,IAAI,CAAC,EACzE;EACF,EACD,EACE,SAAS,CACP,EACE,UAAU,EACR,UAAU,EACR,UAAU,EAAE,GAAG,CAAC,QAAQ,EAAE,EAC3B,EACF,EACF,CACF,EACF,CACF"}
@@ -0,0 +1,3 @@
1
+ import sstConfig from '@auriclabs/eslint-config/sst';
2
+
3
+ export default sstConfig;
package/package.json CHANGED
@@ -1,16 +1,14 @@
1
1
  {
2
2
  "name": "@auriclabs/events-infra",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "SST infrastructure helpers for DynamoDB event stores",
5
5
  "prettier": "@auriclabs/prettier-config",
6
- "main": "dist/index.cjs",
7
- "module": "dist/index.mjs",
8
- "types": "dist/index.d.mts",
6
+ "main": "src/index.ts",
7
+ "types": "src/index.ts",
9
8
  "exports": {
10
9
  ".": {
11
- "types": "./dist/index.d.mts",
12
- "import": "./dist/index.mjs",
13
- "require": "./dist/index.cjs"
10
+ "types": "./src/index.ts",
11
+ "default": "./src/index.ts"
14
12
  }
15
13
  },
16
14
  "keywords": [],
@@ -9,12 +9,15 @@ export function createEventStore(name: string, options?: CreateEventStoreOptions
9
9
  fields: {
10
10
  pk: 'string',
11
11
  sk: 'string',
12
+ tenantId: 'string',
12
13
  },
13
14
  primaryIndex: {
14
15
  hashKey: 'pk',
15
16
  rangeKey: 'sk',
16
17
  },
17
- globalIndexes: {},
18
+ globalIndexes: {
19
+ tenantIndex: { hashKey: 'tenantId', rangeKey: 'pk' },
20
+ },
18
21
  stream: 'new-and-old-images',
19
22
  transform: {
20
23
  table: {