@auriclabs/events-infra 1.0.0 → 1.0.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,5 +1,5 @@
1
1
 
2
- > @auriclabs/events-infra@1.0.0 build /home/runner/work/packages/packages/packages/events-infra
2
+ > @auriclabs/events-infra@1.0.1 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.
@@ -12,17 +12,14 @@
12
12
  ℹ [CJS] dist/index.d.cts.map 0.76 kB │ gzip: 0.33 kB
13
13
  ℹ [CJS] dist/index.d.cts 1.15 kB │ gzip: 0.43 kB
14
14
  ℹ [CJS] 2 files, total: 1.90 kB
15
- [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugins. Here is a breakdown:
16
- - rolldown-plugin-dts:generate (51%)
17
- - tsdown:external (43%)
18
- See https://rolldown.rs/options/checks#plugintimings for more details.
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.
19
16
 
20
- ✔ Build complete in 6241ms
17
+ ✔ Build complete in 4824ms
21
18
  ℹ [ESM] dist/index.mjs 1.89 kB │ gzip: 0.90 kB
22
- ℹ [ESM] dist/index.mjs.map 4.04 kB │ gzip: 1.65 kB
19
+ ℹ [ESM] dist/index.mjs.map 4.04 kB │ gzip: 1.64 kB
23
20
  ℹ [ESM] dist/index.d.mts.map 0.76 kB │ gzip: 0.33 kB
24
21
  ℹ [ESM] dist/index.d.mts 1.15 kB │ gzip: 0.43 kB
25
22
  ℹ [ESM] 4 files, total: 7.83 kB
26
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.
27
24
 
28
- ✔ Build complete in 6242ms
25
+ ✔ Build complete in 4826ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @auriclabs/events-infra
2
2
 
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - df1699e: Change default dlqRetries from 3 to 1 in createEventQueue to reduce FIFO message group
8
+ blocking time on failures.
9
+ - Updated dependencies [adb821b]
10
+ - @auriclabs/events@0.4.1
11
+
3
12
  ## 1.0.0
4
13
 
5
14
  ### Minor Changes
package/dist/index.cjs CHANGED
@@ -45,7 +45,7 @@ function subscribeEventStream(config) {
45
45
  //#endregion
46
46
  //#region src/event-queue.ts
47
47
  function createEventQueue(name, subscriber, options) {
48
- const { batchSize = 10, visibilityTimeout = "30 seconds", dlqRetries = 3 } = options ?? {};
48
+ const { batchSize = 10, visibilityTimeout = "30 seconds", dlqRetries = 1 } = options ?? {};
49
49
  const dlq = new sst.aws.Queue(`${name}DLQ`, { fifo: true });
50
50
  const queue = new sst.aws.Queue(name, {
51
51
  fifo: true,
package/dist/index.mjs CHANGED
@@ -44,7 +44,7 @@ function subscribeEventStream(config) {
44
44
  //#endregion
45
45
  //#region src/event-queue.ts
46
46
  function createEventQueue(name, subscriber, options) {
47
- const { batchSize = 10, visibilityTimeout = "30 seconds", dlqRetries = 3 } = options ?? {};
47
+ const { batchSize = 10, visibilityTimeout = "30 seconds", dlqRetries = 1 } = options ?? {};
48
48
  const dlq = new sst.aws.Queue(`${name}DLQ`, { fifo: true });
49
49
  const queue = new sst.aws.Queue(name, {
50
50
  fifo: true,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/event-store.ts","../src/event-bus.ts","../src/event-listeners.ts","../src/event-queue.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","import { createRequire } from 'module';\n\nconst require = createRequire(import.meta.url);\n\nexport interface SubscribeEventStreamConfig {\n table: sst.aws.Dynamo;\n bus?: sst.aws.Bus;\n listenerQueues: sst.aws.Queue[];\n}\n\nexport function subscribeEventStream(config: SubscribeEventStreamConfig) {\n const { table, bus, listenerQueues } = config;\n\n const streamHandlerPath = require.resolve('@auriclabs/events/stream-handler');\n const handler = streamHandlerPath.replace(/\\.[^.]+$/, '') + '.handler';\n\n const environment: Record<string, $util.Input<string>> = {\n QUEUE_URL_LIST: $jsonStringify(listenerQueues.map((queue) => queue.url)),\n };\n\n if (bus) {\n environment.EVENT_BUS_NAME = bus.name;\n }\n\n table.subscribe(\n 'EventStoreTableStream',\n {\n handler,\n link: [...(bus ? [bus] : []), ...listenerQueues],\n environment,\n },\n {\n filters: [\n {\n dynamodb: {\n NewImage: {\n itemType: { S: ['event'] },\n },\n },\n },\n ],\n },\n );\n}\n","export interface CreateEventQueueOptions {\n batchSize?: number;\n visibilityTimeout?: string;\n dlqRetries?: number;\n}\n\nexport function createEventQueue(\n name: string,\n subscriber: {\n handler: string;\n [key: string]: unknown;\n },\n options?: CreateEventQueueOptions,\n): { queue: sst.aws.Queue; dlq: sst.aws.Queue } {\n const { batchSize = 10, visibilityTimeout = '30 seconds', dlqRetries = 3 } = options ?? {};\n\n const dlq = new sst.aws.Queue(`${name}DLQ`, {\n fifo: true,\n });\n\n const queue = new sst.aws.Queue(name, {\n fifo: true,\n visibilityTimeout,\n dlq: {\n queue: dlq.arn,\n retry: dlqRetries,\n },\n });\n\n queue.subscribe(subscri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IAAI,MAAM,MAAM;EACpC,MAAM;EACN;EACA,KAAK;GACH,OAAO,IAAI;GACX,OAAO;GACR;EACF,CAAC;AAEF,OAAM,UAAU,YAAY,EAC1B,OAAO;EACL,MAAM;EACN,kBAAkB;EACnB,EACF,CAAC;AAEF,QAAO;EAAE;EAAO;EAAK"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/event-store.ts","../src/event-bus.ts","../src/event-listeners.ts","../src/event-queue.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","import { createRequire } from 'module';\n\nconst require = createRequire(import.meta.url);\n\nexport interface SubscribeEventStreamConfig {\n table: sst.aws.Dynamo;\n bus?: sst.aws.Bus;\n listenerQueues: sst.aws.Queue[];\n}\n\nexport function subscribeEventStream(config: SubscribeEventStreamConfig) {\n const { table, bus, listenerQueues } = config;\n\n const streamHandlerPath = require.resolve('@auriclabs/events/stream-handler');\n const handler = streamHandlerPath.replace(/\\.[^.]+$/, '') + '.handler';\n\n const environment: Record<string, $util.Input<string>> = {\n QUEUE_URL_LIST: $jsonStringify(listenerQueues.map((queue) => queue.url)),\n };\n\n if (bus) {\n environment.EVENT_BUS_NAME = bus.name;\n }\n\n table.subscribe(\n 'EventStoreTableStream',\n {\n handler,\n link: [...(bus ? [bus] : []), ...listenerQueues],\n environment,\n },\n {\n filters: [\n {\n dynamodb: {\n NewImage: {\n itemType: { S: ['event'] },\n },\n },\n },\n ],\n },\n );\n}\n","export interface CreateEventQueueOptions {\n batchSize?: number;\n visibilityTimeout?: string;\n dlqRetries?: number;\n}\n\nexport function createEventQueue(\n name: string,\n subscriber: {\n handler: string;\n [key: string]: unknown;\n },\n options?: CreateEventQueueOptions,\n): { queue: sst.aws.Queue; dlq: sst.aws.Queue } {\n const { batchSize = 10, visibilityTimeout = '30 seconds', dlqRetries = 1 } = options ?? {};\n\n const dlq = new sst.aws.Queue(`${name}DLQ`, {\n fifo: true,\n });\n\n const queue = new sst.aws.Queue(name, {\n fifo: true,\n visibilityTimeout,\n dlq: {\n queue: dlq.arn,\n retry: dlqRetries,\n },\n });\n\n queue.subscribe(subscriber, {\n batch: {\n size: batchSize,\n partialResponses: true,\n },\n });\n\n return { queue, dlq };\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;;;;ACC9B,MAAM,UAAU,cAAc,OAAO,KAAK,IAAI;AAQ9C,SAAgB,qBAAqB,QAAoC;CACvE,MAAM,EAAE,OAAO,KAAK,mBAAmB;CAGvC,MAAM,UADoB,QAAQ,QAAQ,mCAAmC,CAC3C,QAAQ,YAAY,GAAG,GAAG;CAE5D,MAAM,cAAmD,EACvD,gBAAgB,eAAe,eAAe,KAAK,UAAU,MAAM,IAAI,CAAC,EACzE;AAED,KAAI,IACF,aAAY,iBAAiB,IAAI;AAGnC,OAAM,UACJ,yBACA;EACE;EACA,MAAM,CAAC,GAAI,MAAM,CAAC,IAAI,GAAG,EAAE,EAAG,GAAG,eAAe;EAChD;EACD,EACD,EACE,SAAS,CACP,EACE,UAAU,EACR,UAAU,EACR,UAAU,EAAE,GAAG,CAAC,QAAQ,EAAE,EAC3B,EACF,EACF,CACF,EACF,CACF;;;;ACpCH,SAAgB,iBACd,MACA,YAIA,SAC8C;CAC9C,MAAM,EAAE,YAAY,IAAI,oBAAoB,cAAc,aAAa,MAAM,WAAW,EAAE;CAE1F,MAAM,MAAM,IAAI,IAAI,IAAI,MAAM,GAAG,KAAK,MAAM,EAC1C,MAAM,MACP,CAAC;CAEF,MAAM,QAAQ,IAAI,IAAI,IAAI,MAAM,MAAM;EACpC,MAAM;EACN;EACA,KAAK;GACH,OAAO,IAAI;GACX,OAAO;GACR;EACF,CAAC;AAEF,OAAM,UAAU,YAAY,EAC1B,OAAO;EACL,MAAM;EACN,kBAAkB;EACnB,EACF,CAAC;AAEF,QAAO;EAAE;EAAO;EAAK"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auriclabs/events-infra",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "SST infrastructure helpers for DynamoDB event stores",
5
5
  "prettier": "@auriclabs/prettier-config",
6
6
  "main": "src/index.ts",
@@ -18,11 +18,11 @@
18
18
  "dependencies": {},
19
19
  "devDependencies": {
20
20
  "sst": "^4.3.7",
21
- "@auriclabs/events": "0.4.0",
21
+ "@auriclabs/events": "0.4.1",
22
22
  "@auriclabs/sst-types": "0.1.0"
23
23
  },
24
24
  "peerDependencies": {
25
- "@auriclabs/events": "^0.4.0",
25
+ "@auriclabs/events": "^0.4.1",
26
26
  "@auriclabs/sst-types": "^0.1.0",
27
27
  "sst": "^4.3.7"
28
28
  },
@@ -12,7 +12,7 @@ export function createEventQueue(
12
12
  },
13
13
  options?: CreateEventQueueOptions,
14
14
  ): { queue: sst.aws.Queue; dlq: sst.aws.Queue } {
15
- const { batchSize = 10, visibilityTimeout = '30 seconds', dlqRetries = 3 } = options ?? {};
15
+ const { batchSize = 10, visibilityTimeout = '30 seconds', dlqRetries = 1 } = options ?? {};
16
16
 
17
17
  const dlq = new sst.aws.Queue(`${name}DLQ`, {
18
18
  fifo: true,