@geekmidas/events 10.0.0-alpha.12 → 10.0.0-alpha.13

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.
Files changed (134) hide show
  1. package/dist/PgBossConnection-CywKoAZU.cjs +2 -0
  2. package/dist/PgBossConnection-DjoqT84r.mjs +2 -0
  3. package/dist/RabbitMQConnection-C9eccBL8.cjs +2 -0
  4. package/dist/RabbitMQConnection-CAp7VqyT.mjs +2 -0
  5. package/dist/SNSConnection-BWDC1wAF.cjs +2 -0
  6. package/dist/SNSConnection-ezQvVrDv.mjs +2 -0
  7. package/dist/{SQSSubscriber-YXPlg2rm.cjs → SQSSubscriber-DLPZCzFE.cjs} +91 -14
  8. package/dist/SQSSubscriber-DLPZCzFE.cjs.map +1 -0
  9. package/dist/{SQSSubscriber-BMWZ3s5q.mjs → SQSSubscriber-cpo624qU.mjs} +73 -7
  10. package/dist/SQSSubscriber-cpo624qU.mjs.map +1 -0
  11. package/dist/basic/index.cjs +7 -8
  12. package/dist/basic/index.cjs.map +1 -1
  13. package/dist/basic/index.d.cts +4 -10
  14. package/dist/basic/index.d.cts.map +1 -1
  15. package/dist/basic/index.d.mts +4 -10
  16. package/dist/basic/index.d.mts.map +1 -1
  17. package/dist/basic/index.mjs +5 -6
  18. package/dist/basic/index.mjs.map +1 -1
  19. package/dist/index.cjs +33 -41
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +5 -9
  22. package/dist/index.d.cts.map +1 -1
  23. package/dist/index.d.mts +5 -9
  24. package/dist/index.d.mts.map +1 -1
  25. package/dist/index.mjs +32 -41
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/pgboss/index.cjs +86 -19
  28. package/dist/pgboss/index.cjs.map +1 -1
  29. package/dist/pgboss/index.d.cts +5 -10
  30. package/dist/pgboss/index.d.cts.map +1 -1
  31. package/dist/pgboss/index.d.mts +5 -10
  32. package/dist/pgboss/index.d.mts.map +1 -1
  33. package/dist/pgboss/index.mjs +83 -18
  34. package/dist/pgboss/index.mjs.map +1 -1
  35. package/dist/rabbitmq/index.cjs +123 -20
  36. package/dist/rabbitmq/index.cjs.map +1 -1
  37. package/dist/rabbitmq/index.d.cts +5 -10
  38. package/dist/rabbitmq/index.d.cts.map +1 -1
  39. package/dist/rabbitmq/index.d.mts +5 -10
  40. package/dist/rabbitmq/index.d.mts.map +1 -1
  41. package/dist/rabbitmq/index.mjs +118 -19
  42. package/dist/rabbitmq/index.mjs.map +1 -1
  43. package/dist/{chunk-CsX-DzYB.cjs → rolldown-runtime-C0BPl7ul.cjs} +17 -16
  44. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  45. package/dist/sns/index.cjs +92 -33
  46. package/dist/sns/index.cjs.map +1 -1
  47. package/dist/sns/index.d.cts +6 -11
  48. package/dist/sns/index.d.cts.map +1 -1
  49. package/dist/sns/index.d.mts +6 -11
  50. package/dist/sns/index.d.mts.map +1 -1
  51. package/dist/sns/index.mjs +74 -16
  52. package/dist/sns/index.mjs.map +1 -1
  53. package/dist/sns/snsUrl.cjs +91 -6
  54. package/dist/sns/snsUrl.cjs.map +1 -0
  55. package/dist/sns/snsUrl.d.cts +57 -2
  56. package/dist/sns/snsUrl.d.cts.map +1 -0
  57. package/dist/sns/snsUrl.d.mts +57 -2
  58. package/dist/sns/snsUrl.d.mts.map +1 -0
  59. package/dist/sns/snsUrl.mjs +81 -2
  60. package/dist/sns/snsUrl.mjs.map +1 -0
  61. package/dist/sqs/index.cjs +19 -20
  62. package/dist/sqs/index.cjs.map +1 -1
  63. package/dist/sqs/index.d.cts +6 -11
  64. package/dist/sqs/index.d.cts.map +1 -1
  65. package/dist/sqs/index.d.mts +6 -11
  66. package/dist/sqs/index.d.mts.map +1 -1
  67. package/dist/sqs/index.mjs +7 -10
  68. package/dist/sqs/index.mjs.map +1 -1
  69. package/dist/sqs/sqsUrl.cjs +92 -6
  70. package/dist/sqs/sqsUrl.cjs.map +1 -0
  71. package/dist/sqs/sqsUrl.d.cts +56 -2
  72. package/dist/sqs/sqsUrl.d.cts.map +1 -0
  73. package/dist/sqs/sqsUrl.d.mts +56 -2
  74. package/dist/sqs/sqsUrl.d.mts.map +1 -0
  75. package/dist/sqs/sqsUrl.mjs +82 -2
  76. package/dist/sqs/sqsUrl.mjs.map +1 -0
  77. package/dist/types-C15FC0qp.mjs +18 -0
  78. package/dist/{types-Byv8N9ma.cjs.map → types-C15FC0qp.mjs.map} +1 -1
  79. package/dist/types-DXNwyRyg.cjs +23 -0
  80. package/dist/{types-CYDt-2RQ.mjs.map → types-DXNwyRyg.cjs.map} +1 -1
  81. package/dist/types-lnM-qoe_.d.cts +140 -0
  82. package/dist/types-lnM-qoe_.d.cts.map +1 -0
  83. package/dist/types-lnM-qoe_.d.mts +140 -0
  84. package/dist/types-lnM-qoe_.d.mts.map +1 -0
  85. package/package.json +3 -3
  86. package/dist/PgBossConnection-23soZ_aM.cjs +0 -80
  87. package/dist/PgBossConnection-23soZ_aM.cjs.map +0 -1
  88. package/dist/PgBossConnection-CCXhoNzb.cjs +0 -4
  89. package/dist/PgBossConnection-DvNbd4Zk.mjs +0 -74
  90. package/dist/PgBossConnection-DvNbd4Zk.mjs.map +0 -1
  91. package/dist/PgBossConnection-_gdM40JB.mjs +0 -4
  92. package/dist/RabbitMQConnection-BKEdCUro.cjs +0 -113
  93. package/dist/RabbitMQConnection-BKEdCUro.cjs.map +0 -1
  94. package/dist/RabbitMQConnection-CCOqDDnb.cjs +0 -4
  95. package/dist/RabbitMQConnection-DJEyM-Bu.mjs +0 -4
  96. package/dist/RabbitMQConnection-DJgUPc19.mjs +0 -107
  97. package/dist/RabbitMQConnection-DJgUPc19.mjs.map +0 -1
  98. package/dist/SNSConnection-B2K86hpz.cjs +0 -75
  99. package/dist/SNSConnection-B2K86hpz.cjs.map +0 -1
  100. package/dist/SNSConnection-BVo84FeW.mjs +0 -5
  101. package/dist/SNSConnection-DIHRjrQF.cjs +0 -5
  102. package/dist/SNSConnection-v9jjF99w.mjs +0 -69
  103. package/dist/SNSConnection-v9jjF99w.mjs.map +0 -1
  104. package/dist/SQSConnection-4tBMkVZE.mjs +0 -69
  105. package/dist/SQSConnection-4tBMkVZE.mjs.map +0 -1
  106. package/dist/SQSConnection-BBLAvF-1.cjs +0 -5
  107. package/dist/SQSConnection-BaC7rGhI.cjs +0 -75
  108. package/dist/SQSConnection-BaC7rGhI.cjs.map +0 -1
  109. package/dist/SQSConnection-DbavOq8_.mjs +0 -5
  110. package/dist/SQSSubscriber-BMWZ3s5q.mjs.map +0 -1
  111. package/dist/SQSSubscriber-YXPlg2rm.cjs.map +0 -1
  112. package/dist/chunk-B9dir_RE.mjs +0 -11
  113. package/dist/snsUrl-ASdc0D1v.d.cts +0 -61
  114. package/dist/snsUrl-ASdc0D1v.d.cts.map +0 -1
  115. package/dist/snsUrl-CifYhPAa.mjs +0 -79
  116. package/dist/snsUrl-CifYhPAa.mjs.map +0 -1
  117. package/dist/snsUrl-FRbRcwF0.d.mts +0 -61
  118. package/dist/snsUrl-FRbRcwF0.d.mts.map +0 -1
  119. package/dist/snsUrl-f2gU3CzK.cjs +0 -114
  120. package/dist/snsUrl-f2gU3CzK.cjs.map +0 -1
  121. package/dist/sqsUrl-BV6zS-mi.d.mts +0 -60
  122. package/dist/sqsUrl-BV6zS-mi.d.mts.map +0 -1
  123. package/dist/sqsUrl-CbAsBFHI.mjs +0 -80
  124. package/dist/sqsUrl-CbAsBFHI.mjs.map +0 -1
  125. package/dist/sqsUrl-CdisN3GU.cjs +0 -115
  126. package/dist/sqsUrl-CdisN3GU.cjs.map +0 -1
  127. package/dist/sqsUrl-DZDPHxIk.d.cts +0 -60
  128. package/dist/sqsUrl-DZDPHxIk.d.cts.map +0 -1
  129. package/dist/types-BmixGrOD.d.cts +0 -67
  130. package/dist/types-BmixGrOD.d.cts.map +0 -1
  131. package/dist/types-Byv8N9ma.cjs +0 -24
  132. package/dist/types-CYDt-2RQ.mjs +0 -18
  133. package/dist/types-DycjsYms.d.mts +0 -67
  134. package/dist/types-DycjsYms.d.mts.map +0 -1
@@ -1,7 +1,6 @@
1
- import { EventConnection, EventPublisher, EventPublisherType, EventSubscriber, PublishableMessage } from "../types-DycjsYms.mjs";
2
- import { SqsAddress, sqsUrl_d_exports } from "../sqsUrl-BV6zS-mi.mjs";
1
+ import { i as EventSubscriber, n as EventPublisher, r as EventPublisherType, s as PublishableMessage, t as EventConnection } from "../types-lnM-qoe_.mjs";
2
+ import { SqsAddress, t as sqsUrl_d_exports } from "./sqsUrl.mjs";
3
3
  import { SQSClient } from "@aws-sdk/client-sqs";
4
-
5
4
  //#region src/sqs/SQSConnection.d.ts
6
5
  interface SQSConnectionConfig {
7
6
  queueUrl: string;
@@ -13,7 +12,7 @@ interface SQSConnectionConfig {
13
12
  sessionToken?: string;
14
13
  };
15
14
  }
16
- declare class SQSConnection implements EventConnection {
15
+ export declare class SQSConnection implements EventConnection {
17
16
  readonly config: SQSConnectionConfig;
18
17
  readonly type = EventPublisherType.SQS;
19
18
  private client;
@@ -36,13 +35,12 @@ declare class SQSConnection implements EventConnection {
36
35
  */
37
36
  get queueUrl(): string;
38
37
  }
39
- //# sourceMappingURL=SQSConnection.d.ts.map
40
38
  //#endregion
41
39
  //#region src/sqs/SQSPublisher.d.ts
42
40
  interface SQSPublisherOptions {
43
41
  maxBatchSize?: number;
44
42
  }
45
- declare class SQSPublisher<TMessage extends PublishableMessage<string, any>> implements EventPublisher<TMessage> {
43
+ export declare class SQSPublisher<TMessage extends PublishableMessage<string, any>> implements EventPublisher<TMessage> {
46
44
  readonly connection: SQSConnection;
47
45
  readonly options: Required<SQSPublisherOptions>;
48
46
  constructor(connection: SQSConnection, options?: SQSPublisherOptions);
@@ -55,7 +53,6 @@ declare class SQSPublisher<TMessage extends PublishableMessage<string, any>> imp
55
53
  private sendBatch;
56
54
  close(): Promise<void>;
57
55
  }
58
- //# sourceMappingURL=SQSPublisher.d.ts.map
59
56
  //#endregion
60
57
  //#region src/sqs/SQSSubscriber.d.ts
61
58
  interface SQSSubscriberOptions {
@@ -76,7 +73,7 @@ interface SQSSubscriberOptions {
76
73
  * - Filters by message type
77
74
  * - Processes the actual message payload
78
75
  */
79
- declare class SQSSubscriber<TMessage extends PublishableMessage<string, any>> implements EventSubscriber<TMessage> {
76
+ export declare class SQSSubscriber<TMessage extends PublishableMessage<string, any>> implements EventSubscriber<TMessage> {
80
77
  private connection;
81
78
  private polling;
82
79
  private messageTypes;
@@ -94,8 +91,6 @@ declare class SQSSubscriber<TMessage extends PublishableMessage<string, any>> im
94
91
  private deleteMessage;
95
92
  private sleep;
96
93
  }
97
- //# sourceMappingURL=SQSSubscriber.d.ts.map
98
-
99
94
  //#endregion
100
- export { SQSConnection, SQSConnectionConfig, SQSPublisher, SQSPublisherOptions, SQSSubscriber, SQSSubscriberOptions, SqsAddress, sqsUrl_d_exports as sqsUrl };
95
+ export { type SQSConnectionConfig, type SQSPublisherOptions, type SQSSubscriberOptions, type SqsAddress, sqsUrl_d_exports as sqsUrl };
101
96
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/sqs/SQSConnection.ts","../../src/sqs/SQSPublisher.ts","../../src/sqs/SQSSubscriber.ts"],"sourcesContent":[],"mappings":";;;;;UAKiB,mBAAA;;EAAA,MAAA,CAAA,EAAA,MAAA;EAWJ,QAAA,CAAA,EAAA,MAAc;EAAA,WAAA,CAAA,EAAA;IAKG,WAAA,EAAA,MAAA;IAJhB,eAAA,EAAA,MAAA;IAIgB,YAAA,CAAA,EAAA,MAAA;EAAmB,CAAA;;AAgD/B,cArDL,aAAA,YAAyB,eAqDpB,CAAA;EAAO,SAKT,MAAA,EArDc,mBAqDd;EAAO,SAYL,IAAA,GArEJ,kBAAA,CAAA,GAAA;EAqEa,QAtEW,MAAA;EAAe,QAAA,SAAA;sBAKvB;;;ACZ9B;AAIA;EAAyB,OAAA,oBAAA,CAAA,gBAAA,EAAA,MAAA,CAAA,ED0BrB,OC1BqB,CD0Bb,aC1Ba,CAAA;EAAA,OAAkB,CAAA,CAAA,EDwDzB,OCxDyB,CAAA,IAAA,CAAA;EAAkB,KAClC,CAAA,CAAA,ED4DX,OC5DW,CAAA,IAAA,CAAA;EAAQ,WAKZ,CAAA,CAAA,EAAA,OAAA;EAAa;;;EAAA,IACzB,SAAA,CAAA,CAAA,EDkEO,SClEP;EAAwB;;;EAae,IAApB,QAAA,CAAA,CAAA,EAAA,MAAA;;;;;UAxBb,mBAAA;;;ADJA,cCQJ,YDRuB,CAAA,iBCQO,kBDRP,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,YCSxB,cDTwB,CCST,QDTS,CAAA,CAAA;EAWvB,SAAA,UAAc,ECGJ,aDHI;EAAA,SAAA,OAAA,ECAR,QDAQ,CCAC,mBDAD,CAAA;EAAA,WAKG,CAAA,UAAA,ECFP,aDEO,EAAA,OAAA,CAAA,ECDnB,mBDCmB;EAAmB;;;;EAkBtC,OA8BO,oBAAA,CAAA,iBCrCC,kBDqCD,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,gBAAA,EAAA,MAAA,CAAA,ECpCY,ODoCZ,CCpCoB,YDoCpB,CCpCiC,QDoCjC,CAAA,CAAA;EAAO,OAKT,CAAA,QAAA,ECxBS,QDwBT,EAAA,CAAA,ECxBsB,ODwBtB,CAAA,IAAA,CAAA;EAAO,QAYL,SAAA;EAAS,KAtEW,CAAA,CAAA,ECoFtB,ODpFsB,CAAA,IAAA,CAAA;AAAe;;;;UERpC,oBAAA;;;EFHA,gBAAA,CAAA,EAAA,MAAmB;AAWpC;;;;;;;;;;;AAAqD;;;cEWxC,+BAA+B,4CAChC,gBAAgB;EDnBX,QAAA,UAAA;EAIJ,QAAA,OAAY;EAAA,QAAA,YAAA;EAAA,QAAkB,QAAA;EAAkB,QAClC,OAAA;EAAQ,WAKZ,CAAA,UAAA,ECiBD,aDjBC,EAAA,OAAA,CAAA,ECkBZ,oBDlBY;EAAa,SAHR,CAAA,QAAA,EC+BhB,QD/BgB,CAAA,MAAA,CAAA,EAAA,EAAA,QAAA,EAAA,CAAA,OAAA,ECgCN,QDhCM,EAAA,GCgCO,ODhCP,CAAA,IAAA,CAAA,CAAA,ECiCxB,ODjCwB,CAAA,IAAA,CAAA;EAAmB,IAA5B,CAAA,CAAA,EAAA,IAAA;EAAQ,QAGJ,IAAA;EAAa,QACzB,eAAA;EAAwB;;;EAae,QAApB,YAAA;EAAO,QAiBZ,aAAA;EAAQ,QAAK,KAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/sqs/SQSConnection.ts","../../src/sqs/SQSPublisher.ts","../../src/sqs/SQSSubscriber.ts"],"mappings":";;;;UAKiB;EAChB;EACA;EACA;EACA;IACC;IACA;IACA;;;qBAIW,yBAAyB;WAKhB,QAAQ;WAJpB,OAAI,mBAAA;UACL;UACA;EAEa,YAAA,QAAQ;;;;;SAgBhB,qBACZ,2BACE,QAAQ;EA8BL,WAAW;EAKX,SAAS;EAKf;;;;MAOI,aAAa;;;;MAOb;;;;UCpFY;EAChB;;qBAGY,aAAa,iBAAiB,4CAC/B,eAAe;WAKhB,YAAY;WAHb,SAAS,SAAS;EAGjB,YAAA,YAAY,eACrB,UAAS;;;;;SAWG,qBACZ,iBAAiB,iCAChB,2BAA2B,QAAQ,aAAa;EAiB5C,QAAQ,UAAU,aAAa;UAcvB;EAoCR,SAAS;;;;UC5FC;EAChB;EACA;EACA;;;;;;;;;;;;;;;qBAgBY,cAAc,iBAAiB,4CAChC,gBAAgB;UAQlB;UAND;UACA;UACA;UACA;EAGC,YAAA,YAAY,eACpB,UAAS;EASJ,UACL,UAAU,oBACV,WAAW,SAAS,aAAa,gBAC/B;EAYH;UAIc;UAqBA;;;;UAiDN;UAgCM;UAUN"}
@@ -1,12 +1,10 @@
1
- import "../types-CYDt-2RQ.mjs";
2
- import { sqsUrl_exports } from "../sqsUrl-CbAsBFHI.mjs";
3
- import { SQSConnection } from "../SQSConnection-4tBMkVZE.mjs";
4
- import { SQSSubscriber } from "../SQSSubscriber-BMWZ3s5q.mjs";
1
+ import { t as sqsUrl_exports } from "./sqsUrl.mjs";
2
+ import { n as SQSConnection, t as SQSSubscriber } from "../SQSSubscriber-cpo624qU.mjs";
5
3
  import { SendMessageBatchCommand } from "@aws-sdk/client-sqs";
6
4
  import chunk from "lodash.chunk";
7
-
8
5
  //#region src/sqs/SQSPublisher.ts
9
6
  var SQSPublisher = class SQSPublisher {
7
+ connection;
10
8
  options;
11
9
  constructor(connection, options = {}) {
12
10
  this.connection = connection;
@@ -17,10 +15,9 @@ var SQSPublisher = class SQSPublisher {
17
15
  * Format: sqs://?queueUrl=https://sqs.region.amazonaws.com/accountId/queueName&region=us-east-1&endpoint=http://localhost:4566&maxBatchSize=10
18
16
  */
19
17
  static async fromConnectionString(connectionString) {
20
- const url = new URL(connectionString);
21
- const params = url.searchParams;
22
- const { SQSConnection: SQSConnection$1 } = await import("../SQSConnection-DbavOq8_.mjs");
23
- const connection = await SQSConnection$1.fromConnectionString(connectionString);
18
+ const params = new URL(connectionString).searchParams;
19
+ const { SQSConnection } = await import("../SQSSubscriber-cpo624qU.mjs").then((n) => n.r);
20
+ const connection = await SQSConnection.fromConnectionString(connectionString);
24
21
  const options = { maxBatchSize: params.get("maxBatchSize") ? Number.parseInt(params.get("maxBatchSize"), 10) : void 0 };
25
22
  return new SQSPublisher(connection, options);
26
23
  }
@@ -55,7 +52,7 @@ var SQSPublisher = class SQSPublisher {
55
52
  }
56
53
  async close() {}
57
54
  };
58
-
59
55
  //#endregion
60
56
  export { SQSConnection, SQSPublisher, SQSSubscriber, sqsUrl_exports as sqsUrl };
57
+
61
58
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["connection: SQSConnection","options: SQSPublisherOptions","connectionString: string","messages: TMessage[]","entries: SendMessageBatchRequestEntry[]","input: SendMessageBatchCommandInput"],"sources":["../../src/sqs/SQSPublisher.ts"],"sourcesContent":["import {\n\tSendMessageBatchCommand,\n\ttype SendMessageBatchCommandInput,\n\ttype SendMessageBatchRequestEntry,\n} from '@aws-sdk/client-sqs';\nimport chunk from 'lodash.chunk';\nimport type { EventPublisher, PublishableMessage } from '../types';\nimport type { SQSConnection } from './SQSConnection';\n\nexport interface SQSPublisherOptions {\n\tmaxBatchSize?: number; // Default: 10 (SQS limit)\n}\n\nexport class SQSPublisher<TMessage extends PublishableMessage<string, any>>\n\timplements EventPublisher<TMessage>\n{\n\treadonly options: Required<SQSPublisherOptions>;\n\n\tconstructor(\n\t\treadonly connection: SQSConnection,\n\t\toptions: SQSPublisherOptions = {},\n\t) {\n\t\tthis.options = {\n\t\t\tmaxBatchSize: options.maxBatchSize ?? 10, // SQS limit\n\t\t};\n\t}\n\n\t/**\n\t * Create an SQSPublisher from a connection string\n\t * Format: sqs://?queueUrl=https://sqs.region.amazonaws.com/accountId/queueName&region=us-east-1&endpoint=http://localhost:4566&maxBatchSize=10\n\t */\n\tstatic async fromConnectionString<\n\t\tTMessage extends PublishableMessage<string, any>,\n\t>(connectionString: string): Promise<SQSPublisher<TMessage>> {\n\t\tconst url = new URL(connectionString);\n\t\tconst params = url.searchParams;\n\n\t\tconst { SQSConnection } = await import('./SQSConnection');\n\t\tconst connection =\n\t\t\tawait SQSConnection.fromConnectionString(connectionString);\n\n\t\tconst options: SQSPublisherOptions = {\n\t\t\tmaxBatchSize: params.get('maxBatchSize')\n\t\t\t\t? Number.parseInt(params.get('maxBatchSize')!, 10)\n\t\t\t\t: undefined,\n\t\t};\n\n\t\treturn new SQSPublisher<TMessage>(connection, options);\n\t}\n\n\tasync publish(messages: TMessage[]): Promise<void> {\n\t\tif (messages.length === 0) return;\n\n\t\tif (!this.connection.isConnected()) {\n\t\t\tawait this.connection.connect();\n\t\t}\n\n\t\t// Split messages into batches (SQS limit is 10 messages per batch)\n\t\tconst batches = chunk(messages, this.options.maxBatchSize);\n\n\t\t// Send all batches\n\t\tawait Promise.all(batches.map((batch) => this.sendBatch(batch)));\n\t}\n\n\tprivate async sendBatch(messages: TMessage[]): Promise<void> {\n\t\tconst entries: SendMessageBatchRequestEntry[] = messages.map(\n\t\t\t(message, index) => ({\n\t\t\t\tId: `${index}`,\n\t\t\t\tMessageBody: JSON.stringify({\n\t\t\t\t\ttype: message.type,\n\t\t\t\t\tpayload: message.payload,\n\t\t\t\t}),\n\t\t\t\tMessageAttributes: {\n\t\t\t\t\ttype: {\n\t\t\t\t\t\tDataType: 'String',\n\t\t\t\t\t\tStringValue: message.type,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\n\t\tconst input: SendMessageBatchCommandInput = {\n\t\t\tQueueUrl: this.connection.queueUrl,\n\t\t\tEntries: entries,\n\t\t};\n\n\t\tconst command = new SendMessageBatchCommand(input);\n\t\tconst response = await this.connection.sqsClient.send(command);\n\n\t\t// Check for failures\n\t\tif (response.Failed && response.Failed.length > 0) {\n\t\t\tconst errors = response.Failed.map(\n\t\t\t\t(f) => `${f.Id}: ${f.Code} - ${f.Message}`,\n\t\t\t).join(', ');\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to send ${response.Failed.length} messages: ${errors}`,\n\t\t\t);\n\t\t}\n\t}\n\n\tasync close(): Promise<void> {\n\t\t// Publisher doesn't own the connection\n\t\t// Connection should be closed by whoever created it\n\t}\n}\n"],"mappings":";;;;;;;;AAaA,IAAa,eAAb,MAAa,aAEb;CACC,AAAS;CAET,YACUA,YACTC,UAA+B,CAAE,GAChC;EAFQ;AAGT,OAAK,UAAU,EACd,cAAc,QAAQ,gBAAgB,GACtC;CACD;;;;;CAMD,aAAa,qBAEXC,kBAA2D;EAC5D,MAAM,MAAM,IAAI,IAAI;EACpB,MAAM,SAAS,IAAI;EAEnB,MAAM,EAAE,gCAAe,GAAG,MAAM,OAAO;EACvC,MAAM,aACL,MAAM,gBAAc,qBAAqB,iBAAiB;EAE3D,MAAMD,UAA+B,EACpC,cAAc,OAAO,IAAI,eAAe,GACrC,OAAO,SAAS,OAAO,IAAI,eAAe,EAAG,GAAG,UAEnD;AAED,SAAO,IAAI,aAAuB,YAAY;CAC9C;CAED,MAAM,QAAQE,UAAqC;AAClD,MAAI,SAAS,WAAW,EAAG;AAE3B,OAAK,KAAK,WAAW,aAAa,CACjC,OAAM,KAAK,WAAW,SAAS;EAIhC,MAAM,UAAU,MAAM,UAAU,KAAK,QAAQ,aAAa;AAG1D,QAAM,QAAQ,IAAI,QAAQ,IAAI,CAAC,UAAU,KAAK,UAAU,MAAM,CAAC,CAAC;CAChE;CAED,MAAc,UAAUA,UAAqC;EAC5D,MAAMC,UAA0C,SAAS,IACxD,CAAC,SAAS,WAAW;GACpB,KAAK,EAAE,MAAM;GACb,aAAa,KAAK,UAAU;IAC3B,MAAM,QAAQ;IACd,SAAS,QAAQ;GACjB,EAAC;GACF,mBAAmB,EAClB,MAAM;IACL,UAAU;IACV,aAAa,QAAQ;GACrB,EACD;EACD,GACD;EAED,MAAMC,QAAsC;GAC3C,UAAU,KAAK,WAAW;GAC1B,SAAS;EACT;EAED,MAAM,UAAU,IAAI,wBAAwB;EAC5C,MAAM,WAAW,MAAM,KAAK,WAAW,UAAU,KAAK,QAAQ;AAG9D,MAAI,SAAS,UAAU,SAAS,OAAO,SAAS,GAAG;GAClD,MAAM,SAAS,SAAS,OAAO,IAC9B,CAAC,OAAO,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,KAAK,EAAE,QAAQ,EACzC,CAAC,KAAK,KAAK;AACZ,SAAM,IAAI,OACR,iBAAiB,SAAS,OAAO,OAAO,aAAa,OAAO;EAE9D;CACD;CAED,MAAM,QAAuB,CAG5B;AACD"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/sqs/SQSPublisher.ts"],"sourcesContent":["import {\n\tSendMessageBatchCommand,\n\ttype SendMessageBatchCommandInput,\n\ttype SendMessageBatchRequestEntry,\n} from '@aws-sdk/client-sqs';\nimport chunk from 'lodash.chunk';\nimport type { EventPublisher, PublishableMessage } from '../types';\nimport type { SQSConnection } from './SQSConnection';\n\nexport interface SQSPublisherOptions {\n\tmaxBatchSize?: number; // Default: 10 (SQS limit)\n}\n\nexport class SQSPublisher<TMessage extends PublishableMessage<string, any>>\n\timplements EventPublisher<TMessage>\n{\n\treadonly options: Required<SQSPublisherOptions>;\n\n\tconstructor(\n\t\treadonly connection: SQSConnection,\n\t\toptions: SQSPublisherOptions = {},\n\t) {\n\t\tthis.options = {\n\t\t\tmaxBatchSize: options.maxBatchSize ?? 10, // SQS limit\n\t\t};\n\t}\n\n\t/**\n\t * Create an SQSPublisher from a connection string\n\t * Format: sqs://?queueUrl=https://sqs.region.amazonaws.com/accountId/queueName&region=us-east-1&endpoint=http://localhost:4566&maxBatchSize=10\n\t */\n\tstatic async fromConnectionString<\n\t\tTMessage extends PublishableMessage<string, any>,\n\t>(connectionString: string): Promise<SQSPublisher<TMessage>> {\n\t\tconst url = new URL(connectionString);\n\t\tconst params = url.searchParams;\n\n\t\tconst { SQSConnection } = await import('./SQSConnection');\n\t\tconst connection =\n\t\t\tawait SQSConnection.fromConnectionString(connectionString);\n\n\t\tconst options: SQSPublisherOptions = {\n\t\t\tmaxBatchSize: params.get('maxBatchSize')\n\t\t\t\t? Number.parseInt(params.get('maxBatchSize')!, 10)\n\t\t\t\t: undefined,\n\t\t};\n\n\t\treturn new SQSPublisher<TMessage>(connection, options);\n\t}\n\n\tasync publish(messages: TMessage[]): Promise<void> {\n\t\tif (messages.length === 0) return;\n\n\t\tif (!this.connection.isConnected()) {\n\t\t\tawait this.connection.connect();\n\t\t}\n\n\t\t// Split messages into batches (SQS limit is 10 messages per batch)\n\t\tconst batches = chunk(messages, this.options.maxBatchSize);\n\n\t\t// Send all batches\n\t\tawait Promise.all(batches.map((batch) => this.sendBatch(batch)));\n\t}\n\n\tprivate async sendBatch(messages: TMessage[]): Promise<void> {\n\t\tconst entries: SendMessageBatchRequestEntry[] = messages.map(\n\t\t\t(message, index) => ({\n\t\t\t\tId: `${index}`,\n\t\t\t\tMessageBody: JSON.stringify({\n\t\t\t\t\ttype: message.type,\n\t\t\t\t\tpayload: message.payload,\n\t\t\t\t}),\n\t\t\t\tMessageAttributes: {\n\t\t\t\t\ttype: {\n\t\t\t\t\t\tDataType: 'String',\n\t\t\t\t\t\tStringValue: message.type,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\n\t\tconst input: SendMessageBatchCommandInput = {\n\t\t\tQueueUrl: this.connection.queueUrl,\n\t\t\tEntries: entries,\n\t\t};\n\n\t\tconst command = new SendMessageBatchCommand(input);\n\t\tconst response = await this.connection.sqsClient.send(command);\n\n\t\t// Check for failures\n\t\tif (response.Failed && response.Failed.length > 0) {\n\t\t\tconst errors = response.Failed.map(\n\t\t\t\t(f) => `${f.Id}: ${f.Code} - ${f.Message}`,\n\t\t\t).join(', ');\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to send ${response.Failed.length} messages: ${errors}`,\n\t\t\t);\n\t\t}\n\t}\n\n\tasync close(): Promise<void> {\n\t\t// Publisher doesn't own the connection\n\t\t// Connection should be closed by whoever created it\n\t}\n}\n"],"mappings":";;;;;AAaA,IAAa,eAAb,MAAa,aAEb;CAIW;CAHV;CAEA,YACC,YACA,UAA+B,CAAC,GAC/B;EAFQ,KAAA,aAAA;EAGT,KAAK,UAAU,EACd,cAAc,QAAQ,gBAAgB,GACvC;CACD;;;;;CAMA,aAAa,qBAEX,kBAA2D;EAE5D,MAAM,SAAS,IADC,IAAI,gBACH,CAAC,CAAC;EAEnB,MAAM,EAAE,kBAAkB,MAAM,OAAO,gCAAkB,CAAA,MAAA,MAAA,EAAA,CAAA;EACzD,MAAM,aACL,MAAM,cAAc,qBAAqB,gBAAgB;EAE1D,MAAM,UAA+B,EACpC,cAAc,OAAO,IAAI,cAAc,IACpC,OAAO,SAAS,OAAO,IAAI,cAAc,GAAI,EAAE,IAC/C,KAAA,EACJ;EAEA,OAAO,IAAI,aAAuB,YAAY,OAAO;CACtD;CAEA,MAAM,QAAQ,UAAqC;EAClD,IAAI,SAAS,WAAW,GAAG;EAE3B,IAAI,CAAC,KAAK,WAAW,YAAY,GAChC,MAAM,KAAK,WAAW,QAAQ;EAI/B,MAAM,UAAU,MAAM,UAAU,KAAK,QAAQ,YAAY;EAGzD,MAAM,QAAQ,IAAI,QAAQ,KAAK,UAAU,KAAK,UAAU,KAAK,CAAC,CAAC;CAChE;CAEA,MAAc,UAAU,UAAqC;EAC5D,MAAM,UAA0C,SAAS,KACvD,SAAS,WAAW;GACpB,IAAI,GAAG;GACP,aAAa,KAAK,UAAU;IAC3B,MAAM,QAAQ;IACd,SAAS,QAAQ;GAClB,CAAC;GACD,mBAAmB,EAClB,MAAM;IACL,UAAU;IACV,aAAa,QAAQ;GACtB,EACD;EACD,EACD;EAEA,MAAM,QAAsC;GAC3C,UAAU,KAAK,WAAW;GAC1B,SAAS;EACV;EAEA,MAAM,UAAU,IAAI,wBAAwB,KAAK;EACjD,MAAM,WAAW,MAAM,KAAK,WAAW,UAAU,KAAK,OAAO;EAG7D,IAAI,SAAS,UAAU,SAAS,OAAO,SAAS,GAAG;GAClD,MAAM,SAAS,SAAS,OAAO,KAC7B,MAAM,GAAG,EAAE,GAAG,IAAI,EAAE,KAAK,KAAK,EAAE,SAClC,CAAC,CAAC,KAAK,IAAI;GACX,MAAM,IAAI,MACT,kBAAkB,SAAS,OAAO,OAAO,aAAa,QACvD;EACD;CACD;CAEA,MAAM,QAAuB,CAG7B;AACD"}
@@ -1,7 +1,93 @@
1
- const require_sqsUrl = require('../sqsUrl-CdisN3GU.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/sqs/sqsUrl.ts
3
+ var sqsUrl_exports = /* @__PURE__ */ require("../rolldown-runtime-C0BPl7ul.cjs").__exportAll({
4
+ MalformedQueueUrl: () => MalformedQueueUrl,
5
+ MissingQueueUrl: () => MissingQueueUrl,
6
+ UnexpectedQueueScheme: () => UnexpectedQueueScheme,
7
+ build: () => build,
8
+ parse: () => parse
9
+ });
10
+ const SCHEME = "sqs:";
11
+ /**
12
+ * Compose an address into a connection string.
13
+ *
14
+ * Credentials never appear. The AWS SDK resolves them from its own chain — an
15
+ * execution role deployed, environment locally — so the string stays safe to log
16
+ * and identical across environments that differ only in who is calling.
17
+ */
18
+ function build(address) {
19
+ const { queueUrl, region, endpoint, maxBatchSize } = address;
20
+ if (!queueUrl) throw new MissingQueueUrl("");
21
+ const url = new URL(`${SCHEME}//`);
22
+ url.searchParams.set("queueUrl", queueUrl);
23
+ if (region) url.searchParams.set("region", region);
24
+ if (endpoint) url.searchParams.set("endpoint", endpoint);
25
+ if (maxBatchSize !== void 0) url.searchParams.set("maxBatchSize", String(maxBatchSize));
26
+ return url.toString();
27
+ }
28
+ /** Parse a connection string back into an address. */
29
+ function parse(connectionString) {
30
+ let parsed;
31
+ try {
32
+ parsed = new URL(connectionString);
33
+ } catch {
34
+ throw new MalformedQueueUrl(connectionString);
35
+ }
36
+ if (parsed.protocol !== SCHEME) throw new UnexpectedQueueScheme(connectionString, SCHEME, parsed.protocol);
37
+ const queueUrl = parsed.searchParams.get("queueUrl");
38
+ if (!queueUrl) throw new MissingQueueUrl(connectionString);
39
+ const region = parsed.searchParams.get("region") ?? void 0;
40
+ const endpoint = parsed.searchParams.get("endpoint") ?? void 0;
41
+ const batch = parsed.searchParams.get("maxBatchSize");
42
+ return {
43
+ queueUrl,
44
+ ...region ? { region } : {},
45
+ ...endpoint ? { endpoint } : {},
46
+ ...batch ? { maxBatchSize: Number(batch) } : {}
47
+ };
48
+ }
49
+ /** The string is not a URL at all. */
50
+ var MalformedQueueUrl = class extends Error {
51
+ url;
52
+ constructor(url) {
53
+ super(`'${url}' is not a valid connection string.`);
54
+ this.url = url;
55
+ this.name = "MalformedQueueUrl";
56
+ }
57
+ };
58
+ /** The string is a URL, but not an `sqs://` one. */
59
+ var UnexpectedQueueScheme = class extends Error {
60
+ url;
61
+ expected;
62
+ actual;
63
+ constructor(url, expected, actual) {
64
+ super(`Expected a '${expected}//' connection string and got '${actual}//' in '${url}'.`);
65
+ this.url = url;
66
+ this.expected = expected;
67
+ this.actual = actual;
68
+ this.name = "UnexpectedQueueScheme";
69
+ }
70
+ };
71
+ /** An `sqs://` string with no queue names nothing. */
72
+ var MissingQueueUrl = class extends Error {
73
+ url;
74
+ constructor(url) {
75
+ super(url ? `'${url}' names no queue: an sqs:// connection string needs ?queueUrl=.` : "An sqs:// connection string needs a queueUrl.");
76
+ this.url = url;
77
+ this.name = "MissingQueueUrl";
78
+ }
79
+ };
80
+ //#endregion
81
+ exports.MalformedQueueUrl = MalformedQueueUrl;
82
+ exports.MissingQueueUrl = MissingQueueUrl;
83
+ exports.UnexpectedQueueScheme = UnexpectedQueueScheme;
84
+ exports.build = build;
85
+ exports.parse = parse;
86
+ Object.defineProperty(exports, "sqsUrl_exports", {
87
+ enumerable: true,
88
+ get: function() {
89
+ return sqsUrl_exports;
90
+ }
91
+ });
2
92
 
3
- exports.MalformedQueueUrl = require_sqsUrl.MalformedQueueUrl;
4
- exports.MissingQueueUrl = require_sqsUrl.MissingQueueUrl;
5
- exports.UnexpectedQueueScheme = require_sqsUrl.UnexpectedQueueScheme;
6
- exports.build = require_sqsUrl.build;
7
- exports.parse = require_sqsUrl.parse;
93
+ //# sourceMappingURL=sqsUrl.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqsUrl.cjs","names":[],"sources":["../../src/sqs/sqsUrl.ts"],"sourcesContent":["/**\n * The `sqs://` connection-string codec — how a queue is addressed as one string.\n *\n * It lives beside the client rather than in a neutral package because\n * `queueUrl`, `region`, and `endpoint` are SQS's vocabulary. The neutral layer\n * knows only that a queue provides *one* connection string; what that string\n * says is between the component that composes it and the publisher that parses\n * it. The `pgboss://` form sits beside its own client and shares nothing here.\n *\n * Both directions live in this module so they cannot drift: `parse(build(x))`\n * is `x`, and the deploy target composing a string it cannot parse back is the\n * failure this shape rules out.\n */\n\n/** What an SQS connection string addresses. */\nexport interface SqsAddress {\n\tqueueUrl: string;\n\t/** Read off the queue, never inherited: a queue may live in another region. */\n\tregion?: string;\n\t/** Set for SQS-compatible backends such as LocalStack. */\n\tendpoint?: string;\n\t/** Largest batch the publisher may send in one call. */\n\tmaxBatchSize?: number;\n}\n\nconst SCHEME = 'sqs:';\n\n/**\n * Compose an address into a connection string.\n *\n * Credentials never appear. The AWS SDK resolves them from its own chain — an\n * execution role deployed, environment locally — so the string stays safe to log\n * and identical across environments that differ only in who is calling.\n */\nexport function build(address: SqsAddress): string {\n\tconst { queueUrl, region, endpoint, maxBatchSize } = address;\n\tif (!queueUrl) throw new MissingQueueUrl('');\n\n\tconst url = new URL(`${SCHEME}//`);\n\turl.searchParams.set('queueUrl', queueUrl);\n\tif (region) url.searchParams.set('region', region);\n\tif (endpoint) url.searchParams.set('endpoint', endpoint);\n\tif (maxBatchSize !== undefined) {\n\t\turl.searchParams.set('maxBatchSize', String(maxBatchSize));\n\t}\n\n\treturn url.toString();\n}\n\n/** Parse a connection string back into an address. */\nexport function parse(connectionString: string): SqsAddress {\n\tlet parsed: URL;\n\ttry {\n\t\tparsed = new URL(connectionString);\n\t} catch {\n\t\tthrow new MalformedQueueUrl(connectionString);\n\t}\n\n\tif (parsed.protocol !== SCHEME) {\n\t\tthrow new UnexpectedQueueScheme(connectionString, SCHEME, parsed.protocol);\n\t}\n\n\tconst queueUrl = parsed.searchParams.get('queueUrl');\n\tif (!queueUrl) throw new MissingQueueUrl(connectionString);\n\n\tconst region = parsed.searchParams.get('region') ?? undefined;\n\tconst endpoint = parsed.searchParams.get('endpoint') ?? undefined;\n\tconst batch = parsed.searchParams.get('maxBatchSize');\n\n\treturn {\n\t\tqueueUrl,\n\t\t...(region ? { region } : {}),\n\t\t...(endpoint ? { endpoint } : {}),\n\t\t...(batch ? { maxBatchSize: Number(batch) } : {}),\n\t};\n}\n\n/** The string is not a URL at all. */\nexport class MalformedQueueUrl extends Error {\n\tconstructor(readonly url: string) {\n\t\tsuper(`'${url}' is not a valid connection string.`);\n\t\tthis.name = 'MalformedQueueUrl';\n\t}\n}\n\n/** The string is a URL, but not an `sqs://` one. */\nexport class UnexpectedQueueScheme extends Error {\n\tconstructor(\n\t\treadonly url: string,\n\t\treadonly expected: string,\n\t\treadonly actual: string,\n\t) {\n\t\tsuper(\n\t\t\t`Expected a '${expected}//' connection string and got '${actual}//' in '${url}'.`,\n\t\t);\n\t\tthis.name = 'UnexpectedQueueScheme';\n\t}\n}\n\n/** An `sqs://` string with no queue names nothing. */\nexport class MissingQueueUrl extends Error {\n\tconstructor(readonly url: string) {\n\t\tsuper(\n\t\t\turl\n\t\t\t\t? `'${url}' names no queue: an sqs:// connection string needs ?queueUrl=.`\n\t\t\t\t: 'An sqs:// connection string needs a queueUrl.',\n\t\t);\n\t\tthis.name = 'MissingQueueUrl';\n\t}\n}\n"],"mappings":";;;;;;;;;AAyBA,MAAM,SAAS;;;;;;;;AASf,SAAgB,MAAM,SAA6B;CAClD,MAAM,EAAE,UAAU,QAAQ,UAAU,iBAAiB;CACrD,IAAI,CAAC,UAAU,MAAM,IAAI,gBAAgB,EAAE;CAE3C,MAAM,MAAM,IAAI,IAAI,GAAG,OAAO,GAAG;CACjC,IAAI,aAAa,IAAI,YAAY,QAAQ;CACzC,IAAI,QAAQ,IAAI,aAAa,IAAI,UAAU,MAAM;CACjD,IAAI,UAAU,IAAI,aAAa,IAAI,YAAY,QAAQ;CACvD,IAAI,iBAAiB,KAAA,GACpB,IAAI,aAAa,IAAI,gBAAgB,OAAO,YAAY,CAAC;CAG1D,OAAO,IAAI,SAAS;AACrB;;AAGA,SAAgB,MAAM,kBAAsC;CAC3D,IAAI;CACJ,IAAI;EACH,SAAS,IAAI,IAAI,gBAAgB;CAClC,QAAQ;EACP,MAAM,IAAI,kBAAkB,gBAAgB;CAC7C;CAEA,IAAI,OAAO,aAAa,QACvB,MAAM,IAAI,sBAAsB,kBAAkB,QAAQ,OAAO,QAAQ;CAG1E,MAAM,WAAW,OAAO,aAAa,IAAI,UAAU;CACnD,IAAI,CAAC,UAAU,MAAM,IAAI,gBAAgB,gBAAgB;CAEzD,MAAM,SAAS,OAAO,aAAa,IAAI,QAAQ,KAAK,KAAA;CACpD,MAAM,WAAW,OAAO,aAAa,IAAI,UAAU,KAAK,KAAA;CACxD,MAAM,QAAQ,OAAO,aAAa,IAAI,cAAc;CAEpD,OAAO;EACN;EACA,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;EAC3B,GAAI,WAAW,EAAE,SAAS,IAAI,CAAC;EAC/B,GAAI,QAAQ,EAAE,cAAc,OAAO,KAAK,EAAE,IAAI,CAAC;CAChD;AACD;;AAGA,IAAa,oBAAb,cAAuC,MAAM;CACvB;CAArB,YAAY,KAAsB;EACjC,MAAM,IAAI,IAAI,oCAAoC;EAD9B,KAAA,MAAA;EAEpB,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,wBAAb,cAA2C,MAAM;CAEtC;CACA;CACA;CAHV,YACC,KACA,UACA,QACC;EACD,MACC,eAAe,SAAS,iCAAiC,OAAO,UAAU,IAAI,GAC/E;EANS,KAAA,MAAA;EACA,KAAA,WAAA;EACA,KAAA,SAAA;EAKT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,kBAAb,cAAqC,MAAM;CACrB;CAArB,YAAY,KAAsB;EACjC,MACC,MACG,IAAI,IAAI,mEACR,+CACJ;EALoB,KAAA,MAAA;EAMpB,KAAK,OAAO;CACb;AACD"}
@@ -1,2 +1,56 @@
1
- import { MalformedQueueUrl, MissingQueueUrl, SqsAddress, UnexpectedQueueScheme, build, parse } from "../sqsUrl-DZDPHxIk.cjs";
2
- export { MalformedQueueUrl, MissingQueueUrl, SqsAddress, UnexpectedQueueScheme, build, parse };
1
+ declare namespace sqsUrl_d_exports {
2
+ export { MalformedQueueUrl, MissingQueueUrl, SqsAddress, UnexpectedQueueScheme, build, parse };
3
+ }
4
+ /**
5
+ * The `sqs://` connection-string codec — how a queue is addressed as one string.
6
+ *
7
+ * It lives beside the client rather than in a neutral package because
8
+ * `queueUrl`, `region`, and `endpoint` are SQS's vocabulary. The neutral layer
9
+ * knows only that a queue provides *one* connection string; what that string
10
+ * says is between the component that composes it and the publisher that parses
11
+ * it. The `pgboss://` form sits beside its own client and shares nothing here.
12
+ *
13
+ * Both directions live in this module so they cannot drift: `parse(build(x))`
14
+ * is `x`, and the deploy target composing a string it cannot parse back is the
15
+ * failure this shape rules out.
16
+ */
17
+ /** What an SQS connection string addresses. */
18
+ export interface SqsAddress {
19
+ queueUrl: string;
20
+ /** Read off the queue, never inherited: a queue may live in another region. */
21
+ region?: string;
22
+ /** Set for SQS-compatible backends such as LocalStack. */
23
+ endpoint?: string;
24
+ /** Largest batch the publisher may send in one call. */
25
+ maxBatchSize?: number;
26
+ }
27
+ /**
28
+ * Compose an address into a connection string.
29
+ *
30
+ * Credentials never appear. The AWS SDK resolves them from its own chain — an
31
+ * execution role deployed, environment locally — so the string stays safe to log
32
+ * and identical across environments that differ only in who is calling.
33
+ */
34
+ export declare function build(address: SqsAddress): string;
35
+ /** Parse a connection string back into an address. */
36
+ export declare function parse(connectionString: string): SqsAddress;
37
+ /** The string is not a URL at all. */
38
+ export declare class MalformedQueueUrl extends Error {
39
+ readonly url: string;
40
+ constructor(url: string);
41
+ }
42
+ /** The string is a URL, but not an `sqs://` one. */
43
+ export declare class UnexpectedQueueScheme extends Error {
44
+ readonly url: string;
45
+ readonly expected: string;
46
+ readonly actual: string;
47
+ constructor(url: string, expected: string, actual: string);
48
+ }
49
+ /** An `sqs://` string with no queue names nothing. */
50
+ export declare class MissingQueueUrl extends Error {
51
+ readonly url: string;
52
+ constructor(url: string);
53
+ }
54
+ //#endregion
55
+ export { sqsUrl_d_exports as t };
56
+ //# sourceMappingURL=sqsUrl.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqsUrl.d.cts","names":[],"sources":["../../src/sqs/sqsUrl.ts"],"mappings":";;;;;;;;;;;;;;;;;iBAeiB;EAChB;;EAEA;;EAEA;;EAEA;;;;;;;;;wBAYe,MAAM,SAAS;;wBAgBf,MAAM,2BAA2B;;qBA4BpC,0BAA0B;WACjB;EAAA,YAAA;;;qBAOT,8BAA8B;WAEhC;WACA;WACA;EAFA,YAAA,aACA,kBACA;;;qBAUE,wBAAwB;WACf;EAAA,YAAA"}
@@ -1,2 +1,56 @@
1
- import { MalformedQueueUrl, MissingQueueUrl, SqsAddress, UnexpectedQueueScheme, build, parse } from "../sqsUrl-BV6zS-mi.mjs";
2
- export { MalformedQueueUrl, MissingQueueUrl, SqsAddress, UnexpectedQueueScheme, build, parse };
1
+ declare namespace sqsUrl_d_exports {
2
+ export { MalformedQueueUrl, MissingQueueUrl, SqsAddress, UnexpectedQueueScheme, build, parse };
3
+ }
4
+ /**
5
+ * The `sqs://` connection-string codec — how a queue is addressed as one string.
6
+ *
7
+ * It lives beside the client rather than in a neutral package because
8
+ * `queueUrl`, `region`, and `endpoint` are SQS's vocabulary. The neutral layer
9
+ * knows only that a queue provides *one* connection string; what that string
10
+ * says is between the component that composes it and the publisher that parses
11
+ * it. The `pgboss://` form sits beside its own client and shares nothing here.
12
+ *
13
+ * Both directions live in this module so they cannot drift: `parse(build(x))`
14
+ * is `x`, and the deploy target composing a string it cannot parse back is the
15
+ * failure this shape rules out.
16
+ */
17
+ /** What an SQS connection string addresses. */
18
+ export interface SqsAddress {
19
+ queueUrl: string;
20
+ /** Read off the queue, never inherited: a queue may live in another region. */
21
+ region?: string;
22
+ /** Set for SQS-compatible backends such as LocalStack. */
23
+ endpoint?: string;
24
+ /** Largest batch the publisher may send in one call. */
25
+ maxBatchSize?: number;
26
+ }
27
+ /**
28
+ * Compose an address into a connection string.
29
+ *
30
+ * Credentials never appear. The AWS SDK resolves them from its own chain — an
31
+ * execution role deployed, environment locally — so the string stays safe to log
32
+ * and identical across environments that differ only in who is calling.
33
+ */
34
+ export declare function build(address: SqsAddress): string;
35
+ /** Parse a connection string back into an address. */
36
+ export declare function parse(connectionString: string): SqsAddress;
37
+ /** The string is not a URL at all. */
38
+ export declare class MalformedQueueUrl extends Error {
39
+ readonly url: string;
40
+ constructor(url: string);
41
+ }
42
+ /** The string is a URL, but not an `sqs://` one. */
43
+ export declare class UnexpectedQueueScheme extends Error {
44
+ readonly url: string;
45
+ readonly expected: string;
46
+ readonly actual: string;
47
+ constructor(url: string, expected: string, actual: string);
48
+ }
49
+ /** An `sqs://` string with no queue names nothing. */
50
+ export declare class MissingQueueUrl extends Error {
51
+ readonly url: string;
52
+ constructor(url: string);
53
+ }
54
+ //#endregion
55
+ export { sqsUrl_d_exports as t };
56
+ //# sourceMappingURL=sqsUrl.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqsUrl.d.mts","names":[],"sources":["../../src/sqs/sqsUrl.ts"],"mappings":";;;;;;;;;;;;;;;;;iBAeiB;EAChB;;EAEA;;EAEA;;EAEA;;;;;;;;;wBAYe,MAAM,SAAS;;wBAgBf,MAAM,2BAA2B;;qBA4BpC,0BAA0B;WACjB;EAAA,YAAA;;;qBAOT,8BAA8B;WAEhC;WACA;WACA;EAFA,YAAA,aACA,kBACA;;;qBAUE,wBAAwB;WACf;EAAA,YAAA"}
@@ -1,3 +1,83 @@
1
- import { MalformedQueueUrl, MissingQueueUrl, UnexpectedQueueScheme, build, parse } from "../sqsUrl-CbAsBFHI.mjs";
1
+ import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
+ //#region src/sqs/sqsUrl.ts
3
+ var sqsUrl_exports = /* @__PURE__ */ __exportAll({
4
+ MalformedQueueUrl: () => MalformedQueueUrl,
5
+ MissingQueueUrl: () => MissingQueueUrl,
6
+ UnexpectedQueueScheme: () => UnexpectedQueueScheme,
7
+ build: () => build,
8
+ parse: () => parse
9
+ });
10
+ const SCHEME = "sqs:";
11
+ /**
12
+ * Compose an address into a connection string.
13
+ *
14
+ * Credentials never appear. The AWS SDK resolves them from its own chain — an
15
+ * execution role deployed, environment locally — so the string stays safe to log
16
+ * and identical across environments that differ only in who is calling.
17
+ */
18
+ function build(address) {
19
+ const { queueUrl, region, endpoint, maxBatchSize } = address;
20
+ if (!queueUrl) throw new MissingQueueUrl("");
21
+ const url = new URL(`${SCHEME}//`);
22
+ url.searchParams.set("queueUrl", queueUrl);
23
+ if (region) url.searchParams.set("region", region);
24
+ if (endpoint) url.searchParams.set("endpoint", endpoint);
25
+ if (maxBatchSize !== void 0) url.searchParams.set("maxBatchSize", String(maxBatchSize));
26
+ return url.toString();
27
+ }
28
+ /** Parse a connection string back into an address. */
29
+ function parse(connectionString) {
30
+ let parsed;
31
+ try {
32
+ parsed = new URL(connectionString);
33
+ } catch {
34
+ throw new MalformedQueueUrl(connectionString);
35
+ }
36
+ if (parsed.protocol !== SCHEME) throw new UnexpectedQueueScheme(connectionString, SCHEME, parsed.protocol);
37
+ const queueUrl = parsed.searchParams.get("queueUrl");
38
+ if (!queueUrl) throw new MissingQueueUrl(connectionString);
39
+ const region = parsed.searchParams.get("region") ?? void 0;
40
+ const endpoint = parsed.searchParams.get("endpoint") ?? void 0;
41
+ const batch = parsed.searchParams.get("maxBatchSize");
42
+ return {
43
+ queueUrl,
44
+ ...region ? { region } : {},
45
+ ...endpoint ? { endpoint } : {},
46
+ ...batch ? { maxBatchSize: Number(batch) } : {}
47
+ };
48
+ }
49
+ /** The string is not a URL at all. */
50
+ var MalformedQueueUrl = class extends Error {
51
+ url;
52
+ constructor(url) {
53
+ super(`'${url}' is not a valid connection string.`);
54
+ this.url = url;
55
+ this.name = "MalformedQueueUrl";
56
+ }
57
+ };
58
+ /** The string is a URL, but not an `sqs://` one. */
59
+ var UnexpectedQueueScheme = class extends Error {
60
+ url;
61
+ expected;
62
+ actual;
63
+ constructor(url, expected, actual) {
64
+ super(`Expected a '${expected}//' connection string and got '${actual}//' in '${url}'.`);
65
+ this.url = url;
66
+ this.expected = expected;
67
+ this.actual = actual;
68
+ this.name = "UnexpectedQueueScheme";
69
+ }
70
+ };
71
+ /** An `sqs://` string with no queue names nothing. */
72
+ var MissingQueueUrl = class extends Error {
73
+ url;
74
+ constructor(url) {
75
+ super(url ? `'${url}' names no queue: an sqs:// connection string needs ?queueUrl=.` : "An sqs:// connection string needs a queueUrl.");
76
+ this.url = url;
77
+ this.name = "MissingQueueUrl";
78
+ }
79
+ };
80
+ //#endregion
81
+ export { MalformedQueueUrl, MissingQueueUrl, UnexpectedQueueScheme, build, parse, sqsUrl_exports as t };
2
82
 
3
- export { MalformedQueueUrl, MissingQueueUrl, UnexpectedQueueScheme, build, parse };
83
+ //# sourceMappingURL=sqsUrl.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqsUrl.mjs","names":[],"sources":["../../src/sqs/sqsUrl.ts"],"sourcesContent":["/**\n * The `sqs://` connection-string codec — how a queue is addressed as one string.\n *\n * It lives beside the client rather than in a neutral package because\n * `queueUrl`, `region`, and `endpoint` are SQS's vocabulary. The neutral layer\n * knows only that a queue provides *one* connection string; what that string\n * says is between the component that composes it and the publisher that parses\n * it. The `pgboss://` form sits beside its own client and shares nothing here.\n *\n * Both directions live in this module so they cannot drift: `parse(build(x))`\n * is `x`, and the deploy target composing a string it cannot parse back is the\n * failure this shape rules out.\n */\n\n/** What an SQS connection string addresses. */\nexport interface SqsAddress {\n\tqueueUrl: string;\n\t/** Read off the queue, never inherited: a queue may live in another region. */\n\tregion?: string;\n\t/** Set for SQS-compatible backends such as LocalStack. */\n\tendpoint?: string;\n\t/** Largest batch the publisher may send in one call. */\n\tmaxBatchSize?: number;\n}\n\nconst SCHEME = 'sqs:';\n\n/**\n * Compose an address into a connection string.\n *\n * Credentials never appear. The AWS SDK resolves them from its own chain — an\n * execution role deployed, environment locally — so the string stays safe to log\n * and identical across environments that differ only in who is calling.\n */\nexport function build(address: SqsAddress): string {\n\tconst { queueUrl, region, endpoint, maxBatchSize } = address;\n\tif (!queueUrl) throw new MissingQueueUrl('');\n\n\tconst url = new URL(`${SCHEME}//`);\n\turl.searchParams.set('queueUrl', queueUrl);\n\tif (region) url.searchParams.set('region', region);\n\tif (endpoint) url.searchParams.set('endpoint', endpoint);\n\tif (maxBatchSize !== undefined) {\n\t\turl.searchParams.set('maxBatchSize', String(maxBatchSize));\n\t}\n\n\treturn url.toString();\n}\n\n/** Parse a connection string back into an address. */\nexport function parse(connectionString: string): SqsAddress {\n\tlet parsed: URL;\n\ttry {\n\t\tparsed = new URL(connectionString);\n\t} catch {\n\t\tthrow new MalformedQueueUrl(connectionString);\n\t}\n\n\tif (parsed.protocol !== SCHEME) {\n\t\tthrow new UnexpectedQueueScheme(connectionString, SCHEME, parsed.protocol);\n\t}\n\n\tconst queueUrl = parsed.searchParams.get('queueUrl');\n\tif (!queueUrl) throw new MissingQueueUrl(connectionString);\n\n\tconst region = parsed.searchParams.get('region') ?? undefined;\n\tconst endpoint = parsed.searchParams.get('endpoint') ?? undefined;\n\tconst batch = parsed.searchParams.get('maxBatchSize');\n\n\treturn {\n\t\tqueueUrl,\n\t\t...(region ? { region } : {}),\n\t\t...(endpoint ? { endpoint } : {}),\n\t\t...(batch ? { maxBatchSize: Number(batch) } : {}),\n\t};\n}\n\n/** The string is not a URL at all. */\nexport class MalformedQueueUrl extends Error {\n\tconstructor(readonly url: string) {\n\t\tsuper(`'${url}' is not a valid connection string.`);\n\t\tthis.name = 'MalformedQueueUrl';\n\t}\n}\n\n/** The string is a URL, but not an `sqs://` one. */\nexport class UnexpectedQueueScheme extends Error {\n\tconstructor(\n\t\treadonly url: string,\n\t\treadonly expected: string,\n\t\treadonly actual: string,\n\t) {\n\t\tsuper(\n\t\t\t`Expected a '${expected}//' connection string and got '${actual}//' in '${url}'.`,\n\t\t);\n\t\tthis.name = 'UnexpectedQueueScheme';\n\t}\n}\n\n/** An `sqs://` string with no queue names nothing. */\nexport class MissingQueueUrl extends Error {\n\tconstructor(readonly url: string) {\n\t\tsuper(\n\t\t\turl\n\t\t\t\t? `'${url}' names no queue: an sqs:// connection string needs ?queueUrl=.`\n\t\t\t\t: 'An sqs:// connection string needs a queueUrl.',\n\t\t);\n\t\tthis.name = 'MissingQueueUrl';\n\t}\n}\n"],"mappings":";;;;;;;;;AAyBA,MAAM,SAAS;;;;;;;;AASf,SAAgB,MAAM,SAA6B;CAClD,MAAM,EAAE,UAAU,QAAQ,UAAU,iBAAiB;CACrD,IAAI,CAAC,UAAU,MAAM,IAAI,gBAAgB,EAAE;CAE3C,MAAM,MAAM,IAAI,IAAI,GAAG,OAAO,GAAG;CACjC,IAAI,aAAa,IAAI,YAAY,QAAQ;CACzC,IAAI,QAAQ,IAAI,aAAa,IAAI,UAAU,MAAM;CACjD,IAAI,UAAU,IAAI,aAAa,IAAI,YAAY,QAAQ;CACvD,IAAI,iBAAiB,KAAA,GACpB,IAAI,aAAa,IAAI,gBAAgB,OAAO,YAAY,CAAC;CAG1D,OAAO,IAAI,SAAS;AACrB;;AAGA,SAAgB,MAAM,kBAAsC;CAC3D,IAAI;CACJ,IAAI;EACH,SAAS,IAAI,IAAI,gBAAgB;CAClC,QAAQ;EACP,MAAM,IAAI,kBAAkB,gBAAgB;CAC7C;CAEA,IAAI,OAAO,aAAa,QACvB,MAAM,IAAI,sBAAsB,kBAAkB,QAAQ,OAAO,QAAQ;CAG1E,MAAM,WAAW,OAAO,aAAa,IAAI,UAAU;CACnD,IAAI,CAAC,UAAU,MAAM,IAAI,gBAAgB,gBAAgB;CAEzD,MAAM,SAAS,OAAO,aAAa,IAAI,QAAQ,KAAK,KAAA;CACpD,MAAM,WAAW,OAAO,aAAa,IAAI,UAAU,KAAK,KAAA;CACxD,MAAM,QAAQ,OAAO,aAAa,IAAI,cAAc;CAEpD,OAAO;EACN;EACA,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;EAC3B,GAAI,WAAW,EAAE,SAAS,IAAI,CAAC;EAC/B,GAAI,QAAQ,EAAE,cAAc,OAAO,KAAK,EAAE,IAAI,CAAC;CAChD;AACD;;AAGA,IAAa,oBAAb,cAAuC,MAAM;CACvB;CAArB,YAAY,KAAsB;EACjC,MAAM,IAAI,IAAI,oCAAoC;EAD9B,KAAA,MAAA;EAEpB,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,wBAAb,cAA2C,MAAM;CAEtC;CACA;CACA;CAHV,YACC,KACA,UACA,QACC;EACD,MACC,eAAe,SAAS,iCAAiC,OAAO,UAAU,IAAI,GAC/E;EANS,KAAA,MAAA;EACA,KAAA,WAAA;EACA,KAAA,SAAA;EAKT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,kBAAb,cAAqC,MAAM;CACrB;CAArB,YAAY,KAAsB;EACjC,MACC,MACG,IAAI,IAAI,mEACR,+CACJ;EALoB,KAAA,MAAA;EAMpB,KAAK,OAAO;CACb;AACD"}
@@ -0,0 +1,18 @@
1
+ //#region src/types.ts
2
+ /**
3
+ * Event publisher/subscriber types
4
+ */
5
+ let EventPublisherType = /* @__PURE__ */ function(EventPublisherType) {
6
+ EventPublisherType["Basic"] = "basic";
7
+ EventPublisherType["EventBridge"] = "eventbridge";
8
+ EventPublisherType["SQS"] = "sqs";
9
+ EventPublisherType["SNS"] = "sns";
10
+ EventPublisherType["Kafka"] = "kafka";
11
+ EventPublisherType["RabbitMQ"] = "rabbitmq";
12
+ EventPublisherType["PgBoss"] = "pgboss";
13
+ return EventPublisherType;
14
+ }({});
15
+ //#endregion
16
+ export { EventPublisherType as t };
17
+
18
+ //# sourceMappingURL=types-C15FC0qp.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-Byv8N9ma.cjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { InferStandardSchema } from '@geekmidas/schema';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\n\n/**\n * Represents a publishable event message with a type and payload.\n *\n * @template TType - The event type/name (e.g., 'user.created')\n * @template TPayload - The event payload data\n */\nexport type PublishableMessage<TType extends string, TPayload> = {\n\ttype: TType;\n\tpayload: TPayload;\n};\n\n/**\n * Event publisher/subscriber types\n */\nexport enum EventPublisherType {\n\tBasic = 'basic',\n\tEventBridge = 'eventbridge',\n\tSQS = 'sqs',\n\tSNS = 'sns',\n\tKafka = 'kafka',\n\tRabbitMQ = 'rabbitmq',\n\tPgBoss = 'pgboss',\n}\n\n/**\n * Base interface for event connections\n * Connections manage the underlying transport (RabbitMQ channel, SQS client, etc.)\n */\nexport interface EventConnection {\n\treadonly type: EventPublisherType;\n\tconnect(): Promise<void>;\n\tclose(): Promise<void>;\n\tisConnected(): boolean;\n}\n\n/**\n * Interface for event publishers that handle the actual publishing of events.\n * Implementations can send to EventBridge, SQS, Kafka, or any other event system.\n *\n * @template TMessage - The union type of all publishable messages\n */\nexport type EventPublisher<TMessage extends PublishableMessage<string, any>> = {\n\tpublish: (message: TMessage[]) => Promise<void>;\n};\n\n/**\n * Interface for event subscribers that handle receiving and processing events.\n *\n * @template TMessage - The union type of all publishable messages\n */\nexport type EventSubscriber<TMessage extends PublishableMessage<string, any>> =\n\t{\n\t\tsubscribe: (\n\t\t\tmessages: TMessage['type'][],\n\t\t\tlistener: (payload: TMessage) => Promise<void>,\n\t\t) => Promise<void>;\n\t};\n/**\n * Utility type to extract the message from EventPublisher\n */\nexport type ExtractPublisherMessage<T> =\n\tT extends EventPublisher<infer M> ? M : never;\n\nexport type MappedEvent<\n\tT extends EventPublisher<any> | undefined,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n> = {\n\ttype: ExtractPublisherMessage<T>['type'];\n\tpayload: (\n\t\tctx: InferStandardSchema<OutSchema>,\n\t) => ExtractPublisherMessage<T>['payload'];\n\twhen?: (ctx: InferStandardSchema<OutSchema>) => boolean;\n};\n"],"mappings":";;;;;AAiBA,IAAY,oEAAL;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AACA"}
1
+ {"version":3,"file":"types-C15FC0qp.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { InferStandardSchema } from '@geekmidas/schema';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\n\n/**\n * Represents a publishable event message with a type and payload.\n *\n * @template TType - The event type/name (e.g., 'user.created')\n * @template TPayload - The event payload data\n */\nexport type PublishableMessage<TType extends string, TPayload> = {\n\ttype: TType;\n\tpayload: TPayload;\n};\n\n/**\n * Event publisher/subscriber types\n */\nexport enum EventPublisherType {\n\tBasic = 'basic',\n\tEventBridge = 'eventbridge',\n\tSQS = 'sqs',\n\tSNS = 'sns',\n\tKafka = 'kafka',\n\tRabbitMQ = 'rabbitmq',\n\tPgBoss = 'pgboss',\n}\n\n/**\n * Base interface for event connections\n * Connections manage the underlying transport (RabbitMQ channel, SQS client, etc.)\n */\nexport interface EventConnection {\n\treadonly type: EventPublisherType;\n\tconnect(): Promise<void>;\n\tclose(): Promise<void>;\n\tisConnected(): boolean;\n}\n\n/**\n * Interface for event publishers that handle the actual publishing of events.\n * Implementations can send to EventBridge, SQS, Kafka, or any other event system.\n *\n * @template TMessage - The union type of all publishable messages\n */\nexport type EventPublisher<TMessage extends PublishableMessage<string, any>> = {\n\tpublish: (message: TMessage[]) => Promise<void>;\n};\n\n/**\n * Interface for event subscribers that handle receiving and processing events.\n *\n * @template TMessage - The union type of all publishable messages\n */\nexport type EventSubscriber<TMessage extends PublishableMessage<string, any>> =\n\t{\n\t\tsubscribe: (\n\t\t\tmessages: TMessage['type'][],\n\t\t\tlistener: (payload: TMessage) => Promise<void>,\n\t\t) => Promise<void>;\n\t};\n/**\n * Utility type to extract the message from EventPublisher\n */\nexport type ExtractPublisherMessage<T> =\n\tT extends EventPublisher<infer M> ? M : never;\n\nexport type MappedEvent<\n\tT extends EventPublisher<any> | undefined,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n> = {\n\ttype: ExtractPublisherMessage<T>['type'];\n\tpayload: (\n\t\tctx: InferStandardSchema<OutSchema>,\n\t) => ExtractPublisherMessage<T>['payload'];\n\twhen?: (ctx: InferStandardSchema<OutSchema>) => boolean;\n};\n"],"mappings":";;;;AAiBA,IAAY,qBAAL,yBAAA,oBAAA;CACN,mBAAA,WAAA;CACA,mBAAA,iBAAA;CACA,mBAAA,SAAA;CACA,mBAAA,SAAA;CACA,mBAAA,WAAA;CACA,mBAAA,cAAA;CACA,mBAAA,YAAA;;AACD,EAAA,CAAA,CAAA"}
@@ -0,0 +1,23 @@
1
+ //#region src/types.ts
2
+ /**
3
+ * Event publisher/subscriber types
4
+ */
5
+ let EventPublisherType = /* @__PURE__ */ function(EventPublisherType) {
6
+ EventPublisherType["Basic"] = "basic";
7
+ EventPublisherType["EventBridge"] = "eventbridge";
8
+ EventPublisherType["SQS"] = "sqs";
9
+ EventPublisherType["SNS"] = "sns";
10
+ EventPublisherType["Kafka"] = "kafka";
11
+ EventPublisherType["RabbitMQ"] = "rabbitmq";
12
+ EventPublisherType["PgBoss"] = "pgboss";
13
+ return EventPublisherType;
14
+ }({});
15
+ //#endregion
16
+ Object.defineProperty(exports, "EventPublisherType", {
17
+ enumerable: true,
18
+ get: function() {
19
+ return EventPublisherType;
20
+ }
21
+ });
22
+
23
+ //# sourceMappingURL=types-DXNwyRyg.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-CYDt-2RQ.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { InferStandardSchema } from '@geekmidas/schema';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\n\n/**\n * Represents a publishable event message with a type and payload.\n *\n * @template TType - The event type/name (e.g., 'user.created')\n * @template TPayload - The event payload data\n */\nexport type PublishableMessage<TType extends string, TPayload> = {\n\ttype: TType;\n\tpayload: TPayload;\n};\n\n/**\n * Event publisher/subscriber types\n */\nexport enum EventPublisherType {\n\tBasic = 'basic',\n\tEventBridge = 'eventbridge',\n\tSQS = 'sqs',\n\tSNS = 'sns',\n\tKafka = 'kafka',\n\tRabbitMQ = 'rabbitmq',\n\tPgBoss = 'pgboss',\n}\n\n/**\n * Base interface for event connections\n * Connections manage the underlying transport (RabbitMQ channel, SQS client, etc.)\n */\nexport interface EventConnection {\n\treadonly type: EventPublisherType;\n\tconnect(): Promise<void>;\n\tclose(): Promise<void>;\n\tisConnected(): boolean;\n}\n\n/**\n * Interface for event publishers that handle the actual publishing of events.\n * Implementations can send to EventBridge, SQS, Kafka, or any other event system.\n *\n * @template TMessage - The union type of all publishable messages\n */\nexport type EventPublisher<TMessage extends PublishableMessage<string, any>> = {\n\tpublish: (message: TMessage[]) => Promise<void>;\n};\n\n/**\n * Interface for event subscribers that handle receiving and processing events.\n *\n * @template TMessage - The union type of all publishable messages\n */\nexport type EventSubscriber<TMessage extends PublishableMessage<string, any>> =\n\t{\n\t\tsubscribe: (\n\t\t\tmessages: TMessage['type'][],\n\t\t\tlistener: (payload: TMessage) => Promise<void>,\n\t\t) => Promise<void>;\n\t};\n/**\n * Utility type to extract the message from EventPublisher\n */\nexport type ExtractPublisherMessage<T> =\n\tT extends EventPublisher<infer M> ? M : never;\n\nexport type MappedEvent<\n\tT extends EventPublisher<any> | undefined,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n> = {\n\ttype: ExtractPublisherMessage<T>['type'];\n\tpayload: (\n\t\tctx: InferStandardSchema<OutSchema>,\n\t) => ExtractPublisherMessage<T>['payload'];\n\twhen?: (ctx: InferStandardSchema<OutSchema>) => boolean;\n};\n"],"mappings":";;;;AAiBA,IAAY,oEAAL;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AACA"}
1
+ {"version":3,"file":"types-DXNwyRyg.cjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { InferStandardSchema } from '@geekmidas/schema';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\n\n/**\n * Represents a publishable event message with a type and payload.\n *\n * @template TType - The event type/name (e.g., 'user.created')\n * @template TPayload - The event payload data\n */\nexport type PublishableMessage<TType extends string, TPayload> = {\n\ttype: TType;\n\tpayload: TPayload;\n};\n\n/**\n * Event publisher/subscriber types\n */\nexport enum EventPublisherType {\n\tBasic = 'basic',\n\tEventBridge = 'eventbridge',\n\tSQS = 'sqs',\n\tSNS = 'sns',\n\tKafka = 'kafka',\n\tRabbitMQ = 'rabbitmq',\n\tPgBoss = 'pgboss',\n}\n\n/**\n * Base interface for event connections\n * Connections manage the underlying transport (RabbitMQ channel, SQS client, etc.)\n */\nexport interface EventConnection {\n\treadonly type: EventPublisherType;\n\tconnect(): Promise<void>;\n\tclose(): Promise<void>;\n\tisConnected(): boolean;\n}\n\n/**\n * Interface for event publishers that handle the actual publishing of events.\n * Implementations can send to EventBridge, SQS, Kafka, or any other event system.\n *\n * @template TMessage - The union type of all publishable messages\n */\nexport type EventPublisher<TMessage extends PublishableMessage<string, any>> = {\n\tpublish: (message: TMessage[]) => Promise<void>;\n};\n\n/**\n * Interface for event subscribers that handle receiving and processing events.\n *\n * @template TMessage - The union type of all publishable messages\n */\nexport type EventSubscriber<TMessage extends PublishableMessage<string, any>> =\n\t{\n\t\tsubscribe: (\n\t\t\tmessages: TMessage['type'][],\n\t\t\tlistener: (payload: TMessage) => Promise<void>,\n\t\t) => Promise<void>;\n\t};\n/**\n * Utility type to extract the message from EventPublisher\n */\nexport type ExtractPublisherMessage<T> =\n\tT extends EventPublisher<infer M> ? M : never;\n\nexport type MappedEvent<\n\tT extends EventPublisher<any> | undefined,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n> = {\n\ttype: ExtractPublisherMessage<T>['type'];\n\tpayload: (\n\t\tctx: InferStandardSchema<OutSchema>,\n\t) => ExtractPublisherMessage<T>['payload'];\n\twhen?: (ctx: InferStandardSchema<OutSchema>) => boolean;\n};\n"],"mappings":";;;;AAiBA,IAAY,qBAAL,yBAAA,oBAAA;CACN,mBAAA,WAAA;CACA,mBAAA,iBAAA;CACA,mBAAA,SAAA;CACA,mBAAA,SAAA;CACA,mBAAA,WAAA;CACA,mBAAA,cAAA;CACA,mBAAA,YAAA;;AACD,EAAA,CAAA,CAAA"}