@geekmidas/events 10.0.0-alpha.2 → 10.0.0-alpha.21

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 (136) 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-BMWZ3s5q.mjs → SQSSubscriber-BXLE_1L3.mjs} +73 -7
  8. package/dist/SQSSubscriber-BXLE_1L3.mjs.map +1 -0
  9. package/dist/{SQSSubscriber-YXPlg2rm.cjs → SQSSubscriber-DtRUaZB3.cjs} +91 -14
  10. package/dist/SQSSubscriber-DtRUaZB3.cjs.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 +39 -46
  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 +38 -47
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/pgboss/index.cjs +98 -21
  28. package/dist/pgboss/index.cjs.map +1 -1
  29. package/dist/pgboss/index.d.cts +11 -10
  30. package/dist/pgboss/index.d.cts.map +1 -1
  31. package/dist/pgboss/index.d.mts +11 -10
  32. package/dist/pgboss/index.d.mts.map +1 -1
  33. package/dist/pgboss/index.mjs +95 -21
  34. package/dist/pgboss/index.mjs.map +1 -1
  35. package/dist/rabbitmq/index.cjs +135 -22
  36. package/dist/rabbitmq/index.cjs.map +1 -1
  37. package/dist/rabbitmq/index.d.cts +11 -10
  38. package/dist/rabbitmq/index.d.cts.map +1 -1
  39. package/dist/rabbitmq/index.d.mts +11 -10
  40. package/dist/rabbitmq/index.d.mts.map +1 -1
  41. package/dist/rabbitmq/index.mjs +130 -22
  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 +106 -34
  46. package/dist/sns/index.cjs.map +1 -1
  47. package/dist/sns/index.d.cts +14 -11
  48. package/dist/sns/index.d.cts.map +1 -1
  49. package/dist/sns/index.d.mts +14 -11
  50. package/dist/sns/index.d.mts.map +1 -1
  51. package/dist/sns/index.mjs +88 -18
  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 +34 -24
  62. package/dist/sqs/index.cjs.map +1 -1
  63. package/dist/sqs/index.d.cts +19 -11
  64. package/dist/sqs/index.d.cts.map +1 -1
  65. package/dist/sqs/index.d.mts +19 -11
  66. package/dist/sqs/index.d.mts.map +1 -1
  67. package/dist/sqs/index.mjs +22 -15
  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-BcZjLxVV.cjs +51 -0
  78. package/dist/types-BcZjLxVV.cjs.map +1 -0
  79. package/dist/types-Bk5JM6MP.mjs +40 -0
  80. package/dist/types-Bk5JM6MP.mjs.map +1 -0
  81. package/dist/types-gGaoT8qc.d.cts +149 -0
  82. package/dist/types-gGaoT8qc.d.cts.map +1 -0
  83. package/dist/types-gGaoT8qc.d.mts +149 -0
  84. package/dist/types-gGaoT8qc.d.mts.map +1 -0
  85. package/package.json +12 -12
  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-Byv8N9ma.cjs.map +0 -1
  133. package/dist/types-CYDt-2RQ.mjs +0 -18
  134. package/dist/types-CYDt-2RQ.mjs.map +0 -1
  135. package/dist/types-DycjsYms.d.mts +0 -67
  136. package/dist/types-DycjsYms.d.mts.map +0 -1
@@ -1,113 +0,0 @@
1
- const require_chunk = require('./chunk-CsX-DzYB.cjs');
2
- const require_types = require('./types-Byv8N9ma.cjs');
3
- const amqplib = require_chunk.__toESM(require("amqplib"));
4
-
5
- //#region src/rabbitmq/RabbitMQConnection.ts
6
- var RabbitMQConnection = class RabbitMQConnection {
7
- type = require_types.EventPublisherType.RabbitMQ;
8
- connection;
9
- channel;
10
- connecting;
11
- config;
12
- constructor(config) {
13
- this.config = {
14
- ...config,
15
- exchange: config.exchange || "geekmidas.events",
16
- exchangeType: config.exchangeType || "topic",
17
- timeout: config.timeout ?? 5e3,
18
- exchangeOptions: {
19
- durable: true,
20
- ...config.exchangeOptions
21
- }
22
- };
23
- }
24
- /**
25
- * Create a RabbitMQConnection from a connection string
26
- * Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000
27
- */
28
- static async fromConnectionString(connectionString) {
29
- const url = new URL(connectionString);
30
- const params = url.searchParams;
31
- const baseUrl = `amqp://${url.username ? `${url.username}:${url.password}@` : ""}${url.host}${url.pathname}`;
32
- const timeoutParam = params.get("timeout");
33
- const config = {
34
- url: baseUrl,
35
- exchange: params.get("exchange") || "geekmidas.events",
36
- exchangeType: params.get("type") || "topic",
37
- timeout: timeoutParam ? Number.parseInt(timeoutParam, 10) : void 0
38
- };
39
- const connection = new RabbitMQConnection(config);
40
- await connection.connect();
41
- return connection;
42
- }
43
- async connect() {
44
- if (this.channel) return;
45
- if (this.connecting) {
46
- await this.connecting;
47
- return;
48
- }
49
- this.connecting = (async () => {
50
- try {
51
- const connection = await amqplib.default.connect(this.config.url, { timeout: this.config.timeout });
52
- const channel = await connection.createChannel();
53
- await channel.assertExchange(this.config.exchange, this.config.exchangeType, this.config.exchangeOptions);
54
- connection.on("error", (_err) => {
55
- this.cleanup();
56
- });
57
- connection.on("close", () => {
58
- this.cleanup();
59
- });
60
- this.connection = connection;
61
- this.channel = channel;
62
- } catch (error) {
63
- this.cleanup();
64
- throw error;
65
- }
66
- })();
67
- await this.connecting;
68
- this.connecting = void 0;
69
- }
70
- async close() {
71
- try {
72
- await this.channel?.close();
73
- await this.connection?.close();
74
- } catch (_error) {} finally {
75
- this.cleanup();
76
- }
77
- }
78
- isConnected() {
79
- return !!this.channel;
80
- }
81
- cleanup() {
82
- this.channel = void 0;
83
- this.connection = void 0;
84
- this.connecting = void 0;
85
- }
86
- /**
87
- * Get the underlying channel for publishing/subscribing
88
- */
89
- get amqpChannel() {
90
- return this.channel;
91
- }
92
- /**
93
- * Get the exchange name for this connection
94
- */
95
- get exchangeName() {
96
- return this.config.exchange;
97
- }
98
- /**
99
- * Get the exchange type for this connection
100
- */
101
- get exchangeType() {
102
- return this.config.exchangeType;
103
- }
104
- };
105
-
106
- //#endregion
107
- Object.defineProperty(exports, 'RabbitMQConnection', {
108
- enumerable: true,
109
- get: function () {
110
- return RabbitMQConnection;
111
- }
112
- });
113
- //# sourceMappingURL=RabbitMQConnection-BKEdCUro.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RabbitMQConnection-BKEdCUro.cjs","names":["EventPublisherType","config: RabbitMQConnectionConfig","connectionString: string","_err: Error"],"sources":["../src/rabbitmq/RabbitMQConnection.ts"],"sourcesContent":["import amqplib from 'amqplib';\nimport type { EventConnection } from '../types';\nimport { EventPublisherType } from '../types';\n\nexport interface RabbitMQConnectionConfig {\n\turl: string;\n\texchange?: string;\n\texchangeType?: 'topic' | 'direct' | 'fanout' | 'headers';\n\texchangeOptions?: amqplib.Options.AssertExchange;\n\ttimeout?: number; // Connection timeout in milliseconds (default: 5000)\n}\n\nexport class RabbitMQConnection implements EventConnection {\n\treadonly type = EventPublisherType.RabbitMQ;\n\tprivate connection?: amqplib.ChannelModel;\n\tprivate channel?: amqplib.Channel;\n\tprivate connecting?: Promise<void>;\n\tprivate config: Required<\n\t\tPick<RabbitMQConnectionConfig, 'exchange' | 'exchangeType' | 'timeout'>\n\t> &\n\t\tRabbitMQConnectionConfig;\n\n\tconstructor(config: RabbitMQConnectionConfig) {\n\t\tthis.config = {\n\t\t\t...config,\n\t\t\texchange: config.exchange || 'geekmidas.events',\n\t\t\texchangeType: config.exchangeType || 'topic',\n\t\t\ttimeout: config.timeout ?? 5000,\n\t\t\texchangeOptions: {\n\t\t\t\tdurable: true,\n\t\t\t\t...config.exchangeOptions,\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Create a RabbitMQConnection from a connection string\n\t * Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000\n\t */\n\tstatic async fromConnectionString(\n\t\tconnectionString: string,\n\t): Promise<RabbitMQConnection> {\n\t\tconst url = new URL(connectionString);\n\t\tconst params = url.searchParams;\n\n\t\t// Extract connection URL without query params\n\t\tconst baseUrl = `amqp://${url.username ? `${url.username}:${url.password}@` : ''}${url.host}${url.pathname}`;\n\n\t\tconst timeoutParam = params.get('timeout');\n\t\tconst config: RabbitMQConnectionConfig = {\n\t\t\turl: baseUrl,\n\t\t\texchange: params.get('exchange') || 'geekmidas.events',\n\t\t\texchangeType: (params.get('type') as any) || 'topic',\n\t\t\ttimeout: timeoutParam ? Number.parseInt(timeoutParam, 10) : undefined,\n\t\t};\n\n\t\tconst connection = new RabbitMQConnection(config);\n\t\tawait connection.connect();\n\t\treturn connection;\n\t}\n\n\tasync connect(): Promise<void> {\n\t\tif (this.channel) return;\n\n\t\t// Prevent multiple simultaneous connection attempts\n\t\tif (this.connecting) {\n\t\t\tawait this.connecting;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.connecting = (async () => {\n\t\t\ttry {\n\t\t\t\tconst connection = await amqplib.connect(this.config.url, {\n\t\t\t\t\ttimeout: this.config.timeout,\n\t\t\t\t});\n\t\t\t\tconst channel = await connection.createChannel();\n\n\t\t\t\t// Assert the exchange exists\n\t\t\t\tawait channel.assertExchange(\n\t\t\t\t\tthis.config.exchange!,\n\t\t\t\t\tthis.config.exchangeType!,\n\t\t\t\t\tthis.config.exchangeOptions,\n\t\t\t\t);\n\n\t\t\t\t// Handle connection errors\n\t\t\t\tconnection.on('error', (_err: Error) => {\n\t\t\t\t\tthis.cleanup();\n\t\t\t\t});\n\n\t\t\t\tconnection.on('close', () => {\n\t\t\t\t\tthis.cleanup();\n\t\t\t\t});\n\n\t\t\t\t// Only set after successful setup\n\t\t\t\tthis.connection = connection;\n\t\t\t\tthis.channel = channel;\n\t\t\t} catch (error) {\n\t\t\t\tthis.cleanup();\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t})();\n\n\t\tawait this.connecting;\n\t\tthis.connecting = undefined;\n\t}\n\n\tasync close(): Promise<void> {\n\t\ttry {\n\t\t\tawait this.channel?.close();\n\t\t\tawait this.connection?.close();\n\t\t} catch (_error) {\n\t\t\t// Ignore errors during close\n\t\t} finally {\n\t\t\tthis.cleanup();\n\t\t}\n\t}\n\n\tisConnected(): boolean {\n\t\treturn !!this.channel;\n\t}\n\n\tprivate cleanup(): void {\n\t\tthis.channel = undefined;\n\t\tthis.connection = undefined;\n\t\tthis.connecting = undefined;\n\t}\n\n\t/**\n\t * Get the underlying channel for publishing/subscribing\n\t */\n\tget amqpChannel(): amqplib.Channel | undefined {\n\t\treturn this.channel;\n\t}\n\n\t/**\n\t * Get the exchange name for this connection\n\t */\n\tget exchangeName(): string {\n\t\treturn this.config.exchange;\n\t}\n\n\t/**\n\t * Get the exchange type for this connection\n\t */\n\tget exchangeType(): string {\n\t\treturn this.config.exchangeType;\n\t}\n}\n"],"mappings":";;;;;AAYA,IAAa,qBAAb,MAAa,mBAA8C;CAC1D,AAAS,OAAOA,iCAAmB;CACnC,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CAKR,YAAYC,QAAkC;AAC7C,OAAK,SAAS;GACb,GAAG;GACH,UAAU,OAAO,YAAY;GAC7B,cAAc,OAAO,gBAAgB;GACrC,SAAS,OAAO,WAAW;GAC3B,iBAAiB;IAChB,SAAS;IACT,GAAG,OAAO;GACV;EACD;CACD;;;;;CAMD,aAAa,qBACZC,kBAC8B;EAC9B,MAAM,MAAM,IAAI,IAAI;EACpB,MAAM,SAAS,IAAI;EAGnB,MAAM,WAAW,SAAS,IAAI,YAAY,EAAE,IAAI,SAAS,GAAG,IAAI,SAAS,KAAK,GAAG,EAAE,IAAI,KAAK,EAAE,IAAI,SAAS;EAE3G,MAAM,eAAe,OAAO,IAAI,UAAU;EAC1C,MAAMD,SAAmC;GACxC,KAAK;GACL,UAAU,OAAO,IAAI,WAAW,IAAI;GACpC,cAAe,OAAO,IAAI,OAAO,IAAY;GAC7C,SAAS,eAAe,OAAO,SAAS,cAAc,GAAG;EACzD;EAED,MAAM,aAAa,IAAI,mBAAmB;AAC1C,QAAM,WAAW,SAAS;AAC1B,SAAO;CACP;CAED,MAAM,UAAyB;AAC9B,MAAI,KAAK,QAAS;AAGlB,MAAI,KAAK,YAAY;AACpB,SAAM,KAAK;AACX;EACA;AAED,OAAK,aAAa,CAAC,YAAY;AAC9B,OAAI;IACH,MAAM,aAAa,MAAM,gBAAQ,QAAQ,KAAK,OAAO,KAAK,EACzD,SAAS,KAAK,OAAO,QACrB,EAAC;IACF,MAAM,UAAU,MAAM,WAAW,eAAe;AAGhD,UAAM,QAAQ,eACb,KAAK,OAAO,UACZ,KAAK,OAAO,cACZ,KAAK,OAAO,gBACZ;AAGD,eAAW,GAAG,SAAS,CAACE,SAAgB;AACvC,UAAK,SAAS;IACd,EAAC;AAEF,eAAW,GAAG,SAAS,MAAM;AAC5B,UAAK,SAAS;IACd,EAAC;AAGF,SAAK,aAAa;AAClB,SAAK,UAAU;GACf,SAAQ,OAAO;AACf,SAAK,SAAS;AACd,UAAM;GACN;EACD,IAAG;AAEJ,QAAM,KAAK;AACX,OAAK;CACL;CAED,MAAM,QAAuB;AAC5B,MAAI;AACH,SAAM,KAAK,SAAS,OAAO;AAC3B,SAAM,KAAK,YAAY,OAAO;EAC9B,SAAQ,QAAQ,CAEhB,UAAS;AACT,QAAK,SAAS;EACd;CACD;CAED,cAAuB;AACtB,WAAS,KAAK;CACd;CAED,AAAQ,UAAgB;AACvB,OAAK;AACL,OAAK;AACL,OAAK;CACL;;;;CAKD,IAAI,cAA2C;AAC9C,SAAO,KAAK;CACZ;;;;CAKD,IAAI,eAAuB;AAC1B,SAAO,KAAK,OAAO;CACnB;;;;CAKD,IAAI,eAAuB;AAC1B,SAAO,KAAK,OAAO;CACnB;AACD"}
@@ -1,4 +0,0 @@
1
- require('./types-Byv8N9ma.cjs');
2
- const require_RabbitMQConnection = require('./RabbitMQConnection-BKEdCUro.cjs');
3
-
4
- exports.RabbitMQConnection = require_RabbitMQConnection.RabbitMQConnection;
@@ -1,4 +0,0 @@
1
- import "./types-CYDt-2RQ.mjs";
2
- import { RabbitMQConnection } from "./RabbitMQConnection-DJgUPc19.mjs";
3
-
4
- export { RabbitMQConnection };
@@ -1,107 +0,0 @@
1
- import { EventPublisherType } from "./types-CYDt-2RQ.mjs";
2
- import amqplib from "amqplib";
3
-
4
- //#region src/rabbitmq/RabbitMQConnection.ts
5
- var RabbitMQConnection = class RabbitMQConnection {
6
- type = EventPublisherType.RabbitMQ;
7
- connection;
8
- channel;
9
- connecting;
10
- config;
11
- constructor(config) {
12
- this.config = {
13
- ...config,
14
- exchange: config.exchange || "geekmidas.events",
15
- exchangeType: config.exchangeType || "topic",
16
- timeout: config.timeout ?? 5e3,
17
- exchangeOptions: {
18
- durable: true,
19
- ...config.exchangeOptions
20
- }
21
- };
22
- }
23
- /**
24
- * Create a RabbitMQConnection from a connection string
25
- * Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000
26
- */
27
- static async fromConnectionString(connectionString) {
28
- const url = new URL(connectionString);
29
- const params = url.searchParams;
30
- const baseUrl = `amqp://${url.username ? `${url.username}:${url.password}@` : ""}${url.host}${url.pathname}`;
31
- const timeoutParam = params.get("timeout");
32
- const config = {
33
- url: baseUrl,
34
- exchange: params.get("exchange") || "geekmidas.events",
35
- exchangeType: params.get("type") || "topic",
36
- timeout: timeoutParam ? Number.parseInt(timeoutParam, 10) : void 0
37
- };
38
- const connection = new RabbitMQConnection(config);
39
- await connection.connect();
40
- return connection;
41
- }
42
- async connect() {
43
- if (this.channel) return;
44
- if (this.connecting) {
45
- await this.connecting;
46
- return;
47
- }
48
- this.connecting = (async () => {
49
- try {
50
- const connection = await amqplib.connect(this.config.url, { timeout: this.config.timeout });
51
- const channel = await connection.createChannel();
52
- await channel.assertExchange(this.config.exchange, this.config.exchangeType, this.config.exchangeOptions);
53
- connection.on("error", (_err) => {
54
- this.cleanup();
55
- });
56
- connection.on("close", () => {
57
- this.cleanup();
58
- });
59
- this.connection = connection;
60
- this.channel = channel;
61
- } catch (error) {
62
- this.cleanup();
63
- throw error;
64
- }
65
- })();
66
- await this.connecting;
67
- this.connecting = void 0;
68
- }
69
- async close() {
70
- try {
71
- await this.channel?.close();
72
- await this.connection?.close();
73
- } catch (_error) {} finally {
74
- this.cleanup();
75
- }
76
- }
77
- isConnected() {
78
- return !!this.channel;
79
- }
80
- cleanup() {
81
- this.channel = void 0;
82
- this.connection = void 0;
83
- this.connecting = void 0;
84
- }
85
- /**
86
- * Get the underlying channel for publishing/subscribing
87
- */
88
- get amqpChannel() {
89
- return this.channel;
90
- }
91
- /**
92
- * Get the exchange name for this connection
93
- */
94
- get exchangeName() {
95
- return this.config.exchange;
96
- }
97
- /**
98
- * Get the exchange type for this connection
99
- */
100
- get exchangeType() {
101
- return this.config.exchangeType;
102
- }
103
- };
104
-
105
- //#endregion
106
- export { RabbitMQConnection };
107
- //# sourceMappingURL=RabbitMQConnection-DJgUPc19.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RabbitMQConnection-DJgUPc19.mjs","names":["config: RabbitMQConnectionConfig","connectionString: string","_err: Error"],"sources":["../src/rabbitmq/RabbitMQConnection.ts"],"sourcesContent":["import amqplib from 'amqplib';\nimport type { EventConnection } from '../types';\nimport { EventPublisherType } from '../types';\n\nexport interface RabbitMQConnectionConfig {\n\turl: string;\n\texchange?: string;\n\texchangeType?: 'topic' | 'direct' | 'fanout' | 'headers';\n\texchangeOptions?: amqplib.Options.AssertExchange;\n\ttimeout?: number; // Connection timeout in milliseconds (default: 5000)\n}\n\nexport class RabbitMQConnection implements EventConnection {\n\treadonly type = EventPublisherType.RabbitMQ;\n\tprivate connection?: amqplib.ChannelModel;\n\tprivate channel?: amqplib.Channel;\n\tprivate connecting?: Promise<void>;\n\tprivate config: Required<\n\t\tPick<RabbitMQConnectionConfig, 'exchange' | 'exchangeType' | 'timeout'>\n\t> &\n\t\tRabbitMQConnectionConfig;\n\n\tconstructor(config: RabbitMQConnectionConfig) {\n\t\tthis.config = {\n\t\t\t...config,\n\t\t\texchange: config.exchange || 'geekmidas.events',\n\t\t\texchangeType: config.exchangeType || 'topic',\n\t\t\ttimeout: config.timeout ?? 5000,\n\t\t\texchangeOptions: {\n\t\t\t\tdurable: true,\n\t\t\t\t...config.exchangeOptions,\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * Create a RabbitMQConnection from a connection string\n\t * Format: rabbitmq://user:pass@host:port/vhost?exchange=name&type=topic&timeout=5000\n\t */\n\tstatic async fromConnectionString(\n\t\tconnectionString: string,\n\t): Promise<RabbitMQConnection> {\n\t\tconst url = new URL(connectionString);\n\t\tconst params = url.searchParams;\n\n\t\t// Extract connection URL without query params\n\t\tconst baseUrl = `amqp://${url.username ? `${url.username}:${url.password}@` : ''}${url.host}${url.pathname}`;\n\n\t\tconst timeoutParam = params.get('timeout');\n\t\tconst config: RabbitMQConnectionConfig = {\n\t\t\turl: baseUrl,\n\t\t\texchange: params.get('exchange') || 'geekmidas.events',\n\t\t\texchangeType: (params.get('type') as any) || 'topic',\n\t\t\ttimeout: timeoutParam ? Number.parseInt(timeoutParam, 10) : undefined,\n\t\t};\n\n\t\tconst connection = new RabbitMQConnection(config);\n\t\tawait connection.connect();\n\t\treturn connection;\n\t}\n\n\tasync connect(): Promise<void> {\n\t\tif (this.channel) return;\n\n\t\t// Prevent multiple simultaneous connection attempts\n\t\tif (this.connecting) {\n\t\t\tawait this.connecting;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.connecting = (async () => {\n\t\t\ttry {\n\t\t\t\tconst connection = await amqplib.connect(this.config.url, {\n\t\t\t\t\ttimeout: this.config.timeout,\n\t\t\t\t});\n\t\t\t\tconst channel = await connection.createChannel();\n\n\t\t\t\t// Assert the exchange exists\n\t\t\t\tawait channel.assertExchange(\n\t\t\t\t\tthis.config.exchange!,\n\t\t\t\t\tthis.config.exchangeType!,\n\t\t\t\t\tthis.config.exchangeOptions,\n\t\t\t\t);\n\n\t\t\t\t// Handle connection errors\n\t\t\t\tconnection.on('error', (_err: Error) => {\n\t\t\t\t\tthis.cleanup();\n\t\t\t\t});\n\n\t\t\t\tconnection.on('close', () => {\n\t\t\t\t\tthis.cleanup();\n\t\t\t\t});\n\n\t\t\t\t// Only set after successful setup\n\t\t\t\tthis.connection = connection;\n\t\t\t\tthis.channel = channel;\n\t\t\t} catch (error) {\n\t\t\t\tthis.cleanup();\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t})();\n\n\t\tawait this.connecting;\n\t\tthis.connecting = undefined;\n\t}\n\n\tasync close(): Promise<void> {\n\t\ttry {\n\t\t\tawait this.channel?.close();\n\t\t\tawait this.connection?.close();\n\t\t} catch (_error) {\n\t\t\t// Ignore errors during close\n\t\t} finally {\n\t\t\tthis.cleanup();\n\t\t}\n\t}\n\n\tisConnected(): boolean {\n\t\treturn !!this.channel;\n\t}\n\n\tprivate cleanup(): void {\n\t\tthis.channel = undefined;\n\t\tthis.connection = undefined;\n\t\tthis.connecting = undefined;\n\t}\n\n\t/**\n\t * Get the underlying channel for publishing/subscribing\n\t */\n\tget amqpChannel(): amqplib.Channel | undefined {\n\t\treturn this.channel;\n\t}\n\n\t/**\n\t * Get the exchange name for this connection\n\t */\n\tget exchangeName(): string {\n\t\treturn this.config.exchange;\n\t}\n\n\t/**\n\t * Get the exchange type for this connection\n\t */\n\tget exchangeType(): string {\n\t\treturn this.config.exchangeType;\n\t}\n}\n"],"mappings":";;;;AAYA,IAAa,qBAAb,MAAa,mBAA8C;CAC1D,AAAS,OAAO,mBAAmB;CACnC,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CAKR,YAAYA,QAAkC;AAC7C,OAAK,SAAS;GACb,GAAG;GACH,UAAU,OAAO,YAAY;GAC7B,cAAc,OAAO,gBAAgB;GACrC,SAAS,OAAO,WAAW;GAC3B,iBAAiB;IAChB,SAAS;IACT,GAAG,OAAO;GACV;EACD;CACD;;;;;CAMD,aAAa,qBACZC,kBAC8B;EAC9B,MAAM,MAAM,IAAI,IAAI;EACpB,MAAM,SAAS,IAAI;EAGnB,MAAM,WAAW,SAAS,IAAI,YAAY,EAAE,IAAI,SAAS,GAAG,IAAI,SAAS,KAAK,GAAG,EAAE,IAAI,KAAK,EAAE,IAAI,SAAS;EAE3G,MAAM,eAAe,OAAO,IAAI,UAAU;EAC1C,MAAMD,SAAmC;GACxC,KAAK;GACL,UAAU,OAAO,IAAI,WAAW,IAAI;GACpC,cAAe,OAAO,IAAI,OAAO,IAAY;GAC7C,SAAS,eAAe,OAAO,SAAS,cAAc,GAAG;EACzD;EAED,MAAM,aAAa,IAAI,mBAAmB;AAC1C,QAAM,WAAW,SAAS;AAC1B,SAAO;CACP;CAED,MAAM,UAAyB;AAC9B,MAAI,KAAK,QAAS;AAGlB,MAAI,KAAK,YAAY;AACpB,SAAM,KAAK;AACX;EACA;AAED,OAAK,aAAa,CAAC,YAAY;AAC9B,OAAI;IACH,MAAM,aAAa,MAAM,QAAQ,QAAQ,KAAK,OAAO,KAAK,EACzD,SAAS,KAAK,OAAO,QACrB,EAAC;IACF,MAAM,UAAU,MAAM,WAAW,eAAe;AAGhD,UAAM,QAAQ,eACb,KAAK,OAAO,UACZ,KAAK,OAAO,cACZ,KAAK,OAAO,gBACZ;AAGD,eAAW,GAAG,SAAS,CAACE,SAAgB;AACvC,UAAK,SAAS;IACd,EAAC;AAEF,eAAW,GAAG,SAAS,MAAM;AAC5B,UAAK,SAAS;IACd,EAAC;AAGF,SAAK,aAAa;AAClB,SAAK,UAAU;GACf,SAAQ,OAAO;AACf,SAAK,SAAS;AACd,UAAM;GACN;EACD,IAAG;AAEJ,QAAM,KAAK;AACX,OAAK;CACL;CAED,MAAM,QAAuB;AAC5B,MAAI;AACH,SAAM,KAAK,SAAS,OAAO;AAC3B,SAAM,KAAK,YAAY,OAAO;EAC9B,SAAQ,QAAQ,CAEhB,UAAS;AACT,QAAK,SAAS;EACd;CACD;CAED,cAAuB;AACtB,WAAS,KAAK;CACd;CAED,AAAQ,UAAgB;AACvB,OAAK;AACL,OAAK;AACL,OAAK;CACL;;;;CAKD,IAAI,cAA2C;AAC9C,SAAO,KAAK;CACZ;;;;CAKD,IAAI,eAAuB;AAC1B,SAAO,KAAK,OAAO;CACnB;;;;CAKD,IAAI,eAAuB;AAC1B,SAAO,KAAK,OAAO;CACnB;AACD"}
@@ -1,75 +0,0 @@
1
- const require_chunk = require('./chunk-CsX-DzYB.cjs');
2
- const require_types = require('./types-Byv8N9ma.cjs');
3
- const require_snsUrl = require('./snsUrl-f2gU3CzK.cjs');
4
- const __aws_sdk_client_sns = require_chunk.__toESM(require("@aws-sdk/client-sns"));
5
-
6
- //#region src/sns/SNSConnection.ts
7
- var SNSConnection = class SNSConnection {
8
- type = require_types.EventPublisherType.SNS;
9
- client;
10
- connected = false;
11
- config;
12
- constructor(config) {
13
- this.config = config;
14
- const clientConfig = {
15
- region: config.region,
16
- endpoint: config.endpoint,
17
- credentials: config.credentials
18
- };
19
- this.client = new __aws_sdk_client_sns.SNSClient(clientConfig);
20
- }
21
- /**
22
- * Create an SNSConnection from a connection string
23
- * Format: sns://?topicArn=arn:aws:sns:region:account:topic&region=us-east-1&endpoint=http://localhost:4566
24
- */
25
- static async fromConnectionString(connectionString) {
26
- const { topicArn, region, endpoint } = require_snsUrl.parse(connectionString);
27
- const params = new URL(connectionString).searchParams;
28
- const config = {
29
- topicArn,
30
- region,
31
- endpoint
32
- };
33
- const accessKeyId = params.get("accessKeyId");
34
- const secretAccessKey = params.get("secretAccessKey");
35
- if (accessKeyId && secretAccessKey) config.credentials = {
36
- accessKeyId,
37
- secretAccessKey,
38
- sessionToken: params.get("sessionToken") || void 0
39
- };
40
- const connection = new SNSConnection(config);
41
- await connection.connect();
42
- return connection;
43
- }
44
- async connect() {
45
- this.connected = true;
46
- }
47
- async close() {
48
- this.client.destroy();
49
- this.connected = false;
50
- }
51
- isConnected() {
52
- return this.connected;
53
- }
54
- /**
55
- * Get the underlying SNS client
56
- */
57
- get snsClient() {
58
- return this.client;
59
- }
60
- /**
61
- * Get the topic ARN for this connection
62
- */
63
- get topicArn() {
64
- return this.config.topicArn;
65
- }
66
- };
67
-
68
- //#endregion
69
- Object.defineProperty(exports, 'SNSConnection', {
70
- enumerable: true,
71
- get: function () {
72
- return SNSConnection;
73
- }
74
- });
75
- //# sourceMappingURL=SNSConnection-B2K86hpz.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SNSConnection-B2K86hpz.cjs","names":["EventPublisherType","config: SNSConnectionConfig","clientConfig: SNSClientConfig","SNSClient","connectionString: string"],"sources":["../src/sns/SNSConnection.ts"],"sourcesContent":["import { SNSClient, type SNSClientConfig } from '@aws-sdk/client-sns';\nimport type { EventConnection } from '../types';\nimport { EventPublisherType } from '../types';\nimport * as snsUrl from './snsUrl';\n\nexport interface SNSConnectionConfig {\n\ttopicArn: string;\n\tregion?: string;\n\tendpoint?: string; // Custom endpoint (e.g., for LocalStack)\n\tcredentials?: {\n\t\taccessKeyId: string;\n\t\tsecretAccessKey: string;\n\t\tsessionToken?: string;\n\t};\n}\n\nexport class SNSConnection implements EventConnection {\n\treadonly type = EventPublisherType.SNS;\n\tprivate client: SNSClient;\n\tprivate connected = false;\n\tprivate config: SNSConnectionConfig;\n\n\tconstructor(config: SNSConnectionConfig) {\n\t\tthis.config = config;\n\n\t\tconst clientConfig: SNSClientConfig = {\n\t\t\tregion: config.region,\n\t\t\tendpoint: config.endpoint,\n\t\t\tcredentials: config.credentials,\n\t\t};\n\n\t\tthis.client = new SNSClient(clientConfig);\n\t}\n\n\t/**\n\t * Create an SNSConnection from a connection string\n\t * Format: sns://?topicArn=arn:aws:sns:region:account:topic&region=us-east-1&endpoint=http://localhost:4566\n\t */\n\tstatic async fromConnectionString(\n\t\tconnectionString: string,\n\t): Promise<SNSConnection> {\n\t\t// Through the codec, not a second hand-rolled parse: the deploy target\n\t\t// composes these with `snsUrl.build`, and a string it cannot read back is\n\t\t// exactly the drift one shared module rules out.\n\t\tconst { topicArn, region, endpoint } = snsUrl.parse(connectionString);\n\t\tconst params = new URL(connectionString).searchParams;\n\n\t\tconst config: SNSConnectionConfig = {\n\t\t\ttopicArn,\n\t\t\tregion,\n\t\t\tendpoint,\n\t\t};\n\n\t\t// Credentials are not part of the address — see `snsUrl` — but a caller\n\t\t// may still pin them here, so they are read beside it rather than in it.\n\t\tconst accessKeyId = params.get('accessKeyId');\n\t\tconst secretAccessKey = params.get('secretAccessKey');\n\t\tif (accessKeyId && secretAccessKey) {\n\t\t\tconfig.credentials = {\n\t\t\t\taccessKeyId,\n\t\t\t\tsecretAccessKey,\n\t\t\t\tsessionToken: params.get('sessionToken') || undefined,\n\t\t\t};\n\t\t}\n\n\t\tconst connection = new SNSConnection(config);\n\t\tawait connection.connect();\n\t\treturn connection;\n\t}\n\n\tasync connect(): Promise<void> {\n\t\t// SNS doesn't have a traditional connection, but we mark as connected\n\t\tthis.connected = true;\n\t}\n\n\tasync close(): Promise<void> {\n\t\tthis.client.destroy();\n\t\tthis.connected = false;\n\t}\n\n\tisConnected(): boolean {\n\t\treturn this.connected;\n\t}\n\n\t/**\n\t * Get the underlying SNS client\n\t */\n\tget snsClient(): SNSClient {\n\t\treturn this.client;\n\t}\n\n\t/**\n\t * Get the topic ARN for this connection\n\t */\n\tget topicArn(): string {\n\t\treturn this.config.topicArn;\n\t}\n}\n"],"mappings":";;;;;;AAgBA,IAAa,gBAAb,MAAa,cAAyC;CACrD,AAAS,OAAOA,iCAAmB;CACnC,AAAQ;CACR,AAAQ,YAAY;CACpB,AAAQ;CAER,YAAYC,QAA6B;AACxC,OAAK,SAAS;EAEd,MAAMC,eAAgC;GACrC,QAAQ,OAAO;GACf,UAAU,OAAO;GACjB,aAAa,OAAO;EACpB;AAED,OAAK,SAAS,IAAIC,+BAAU;CAC5B;;;;;CAMD,aAAa,qBACZC,kBACyB;EAIzB,MAAM,EAAE,UAAU,QAAQ,UAAU,GAAG,qBAAa,iBAAiB;EACrE,MAAM,SAAS,IAAI,IAAI,kBAAkB;EAEzC,MAAMH,SAA8B;GACnC;GACA;GACA;EACA;EAID,MAAM,cAAc,OAAO,IAAI,cAAc;EAC7C,MAAM,kBAAkB,OAAO,IAAI,kBAAkB;AACrD,MAAI,eAAe,gBAClB,QAAO,cAAc;GACpB;GACA;GACA,cAAc,OAAO,IAAI,eAAe;EACxC;EAGF,MAAM,aAAa,IAAI,cAAc;AACrC,QAAM,WAAW,SAAS;AAC1B,SAAO;CACP;CAED,MAAM,UAAyB;AAE9B,OAAK,YAAY;CACjB;CAED,MAAM,QAAuB;AAC5B,OAAK,OAAO,SAAS;AACrB,OAAK,YAAY;CACjB;CAED,cAAuB;AACtB,SAAO,KAAK;CACZ;;;;CAKD,IAAI,YAAuB;AAC1B,SAAO,KAAK;CACZ;;;;CAKD,IAAI,WAAmB;AACtB,SAAO,KAAK,OAAO;CACnB;AACD"}
@@ -1,5 +0,0 @@
1
- import "./types-CYDt-2RQ.mjs";
2
- import "./snsUrl-CifYhPAa.mjs";
3
- import { SNSConnection } from "./SNSConnection-v9jjF99w.mjs";
4
-
5
- export { SNSConnection };
@@ -1,5 +0,0 @@
1
- require('./types-Byv8N9ma.cjs');
2
- require('./snsUrl-f2gU3CzK.cjs');
3
- const require_SNSConnection = require('./SNSConnection-B2K86hpz.cjs');
4
-
5
- exports.SNSConnection = require_SNSConnection.SNSConnection;
@@ -1,69 +0,0 @@
1
- import { EventPublisherType } from "./types-CYDt-2RQ.mjs";
2
- import { parse } from "./snsUrl-CifYhPAa.mjs";
3
- import { SNSClient } from "@aws-sdk/client-sns";
4
-
5
- //#region src/sns/SNSConnection.ts
6
- var SNSConnection = class SNSConnection {
7
- type = EventPublisherType.SNS;
8
- client;
9
- connected = false;
10
- config;
11
- constructor(config) {
12
- this.config = config;
13
- const clientConfig = {
14
- region: config.region,
15
- endpoint: config.endpoint,
16
- credentials: config.credentials
17
- };
18
- this.client = new SNSClient(clientConfig);
19
- }
20
- /**
21
- * Create an SNSConnection from a connection string
22
- * Format: sns://?topicArn=arn:aws:sns:region:account:topic&region=us-east-1&endpoint=http://localhost:4566
23
- */
24
- static async fromConnectionString(connectionString) {
25
- const { topicArn, region, endpoint } = parse(connectionString);
26
- const params = new URL(connectionString).searchParams;
27
- const config = {
28
- topicArn,
29
- region,
30
- endpoint
31
- };
32
- const accessKeyId = params.get("accessKeyId");
33
- const secretAccessKey = params.get("secretAccessKey");
34
- if (accessKeyId && secretAccessKey) config.credentials = {
35
- accessKeyId,
36
- secretAccessKey,
37
- sessionToken: params.get("sessionToken") || void 0
38
- };
39
- const connection = new SNSConnection(config);
40
- await connection.connect();
41
- return connection;
42
- }
43
- async connect() {
44
- this.connected = true;
45
- }
46
- async close() {
47
- this.client.destroy();
48
- this.connected = false;
49
- }
50
- isConnected() {
51
- return this.connected;
52
- }
53
- /**
54
- * Get the underlying SNS client
55
- */
56
- get snsClient() {
57
- return this.client;
58
- }
59
- /**
60
- * Get the topic ARN for this connection
61
- */
62
- get topicArn() {
63
- return this.config.topicArn;
64
- }
65
- };
66
-
67
- //#endregion
68
- export { SNSConnection };
69
- //# sourceMappingURL=SNSConnection-v9jjF99w.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SNSConnection-v9jjF99w.mjs","names":["config: SNSConnectionConfig","clientConfig: SNSClientConfig","connectionString: string"],"sources":["../src/sns/SNSConnection.ts"],"sourcesContent":["import { SNSClient, type SNSClientConfig } from '@aws-sdk/client-sns';\nimport type { EventConnection } from '../types';\nimport { EventPublisherType } from '../types';\nimport * as snsUrl from './snsUrl';\n\nexport interface SNSConnectionConfig {\n\ttopicArn: string;\n\tregion?: string;\n\tendpoint?: string; // Custom endpoint (e.g., for LocalStack)\n\tcredentials?: {\n\t\taccessKeyId: string;\n\t\tsecretAccessKey: string;\n\t\tsessionToken?: string;\n\t};\n}\n\nexport class SNSConnection implements EventConnection {\n\treadonly type = EventPublisherType.SNS;\n\tprivate client: SNSClient;\n\tprivate connected = false;\n\tprivate config: SNSConnectionConfig;\n\n\tconstructor(config: SNSConnectionConfig) {\n\t\tthis.config = config;\n\n\t\tconst clientConfig: SNSClientConfig = {\n\t\t\tregion: config.region,\n\t\t\tendpoint: config.endpoint,\n\t\t\tcredentials: config.credentials,\n\t\t};\n\n\t\tthis.client = new SNSClient(clientConfig);\n\t}\n\n\t/**\n\t * Create an SNSConnection from a connection string\n\t * Format: sns://?topicArn=arn:aws:sns:region:account:topic&region=us-east-1&endpoint=http://localhost:4566\n\t */\n\tstatic async fromConnectionString(\n\t\tconnectionString: string,\n\t): Promise<SNSConnection> {\n\t\t// Through the codec, not a second hand-rolled parse: the deploy target\n\t\t// composes these with `snsUrl.build`, and a string it cannot read back is\n\t\t// exactly the drift one shared module rules out.\n\t\tconst { topicArn, region, endpoint } = snsUrl.parse(connectionString);\n\t\tconst params = new URL(connectionString).searchParams;\n\n\t\tconst config: SNSConnectionConfig = {\n\t\t\ttopicArn,\n\t\t\tregion,\n\t\t\tendpoint,\n\t\t};\n\n\t\t// Credentials are not part of the address — see `snsUrl` — but a caller\n\t\t// may still pin them here, so they are read beside it rather than in it.\n\t\tconst accessKeyId = params.get('accessKeyId');\n\t\tconst secretAccessKey = params.get('secretAccessKey');\n\t\tif (accessKeyId && secretAccessKey) {\n\t\t\tconfig.credentials = {\n\t\t\t\taccessKeyId,\n\t\t\t\tsecretAccessKey,\n\t\t\t\tsessionToken: params.get('sessionToken') || undefined,\n\t\t\t};\n\t\t}\n\n\t\tconst connection = new SNSConnection(config);\n\t\tawait connection.connect();\n\t\treturn connection;\n\t}\n\n\tasync connect(): Promise<void> {\n\t\t// SNS doesn't have a traditional connection, but we mark as connected\n\t\tthis.connected = true;\n\t}\n\n\tasync close(): Promise<void> {\n\t\tthis.client.destroy();\n\t\tthis.connected = false;\n\t}\n\n\tisConnected(): boolean {\n\t\treturn this.connected;\n\t}\n\n\t/**\n\t * Get the underlying SNS client\n\t */\n\tget snsClient(): SNSClient {\n\t\treturn this.client;\n\t}\n\n\t/**\n\t * Get the topic ARN for this connection\n\t */\n\tget topicArn(): string {\n\t\treturn this.config.topicArn;\n\t}\n}\n"],"mappings":";;;;;AAgBA,IAAa,gBAAb,MAAa,cAAyC;CACrD,AAAS,OAAO,mBAAmB;CACnC,AAAQ;CACR,AAAQ,YAAY;CACpB,AAAQ;CAER,YAAYA,QAA6B;AACxC,OAAK,SAAS;EAEd,MAAMC,eAAgC;GACrC,QAAQ,OAAO;GACf,UAAU,OAAO;GACjB,aAAa,OAAO;EACpB;AAED,OAAK,SAAS,IAAI,UAAU;CAC5B;;;;;CAMD,aAAa,qBACZC,kBACyB;EAIzB,MAAM,EAAE,UAAU,QAAQ,UAAU,GAAG,MAAa,iBAAiB;EACrE,MAAM,SAAS,IAAI,IAAI,kBAAkB;EAEzC,MAAMF,SAA8B;GACnC;GACA;GACA;EACA;EAID,MAAM,cAAc,OAAO,IAAI,cAAc;EAC7C,MAAM,kBAAkB,OAAO,IAAI,kBAAkB;AACrD,MAAI,eAAe,gBAClB,QAAO,cAAc;GACpB;GACA;GACA,cAAc,OAAO,IAAI,eAAe;EACxC;EAGF,MAAM,aAAa,IAAI,cAAc;AACrC,QAAM,WAAW,SAAS;AAC1B,SAAO;CACP;CAED,MAAM,UAAyB;AAE9B,OAAK,YAAY;CACjB;CAED,MAAM,QAAuB;AAC5B,OAAK,OAAO,SAAS;AACrB,OAAK,YAAY;CACjB;CAED,cAAuB;AACtB,SAAO,KAAK;CACZ;;;;CAKD,IAAI,YAAuB;AAC1B,SAAO,KAAK;CACZ;;;;CAKD,IAAI,WAAmB;AACtB,SAAO,KAAK,OAAO;CACnB;AACD"}
@@ -1,69 +0,0 @@
1
- import { EventPublisherType } from "./types-CYDt-2RQ.mjs";
2
- import { parse } from "./sqsUrl-CbAsBFHI.mjs";
3
- import { SQSClient } from "@aws-sdk/client-sqs";
4
-
5
- //#region src/sqs/SQSConnection.ts
6
- var SQSConnection = class SQSConnection {
7
- type = EventPublisherType.SQS;
8
- client;
9
- connected = false;
10
- constructor(config) {
11
- this.config = config;
12
- this.config = config;
13
- const clientConfig = {
14
- region: config.region,
15
- endpoint: config.endpoint,
16
- credentials: config.credentials
17
- };
18
- this.client = new SQSClient(clientConfig);
19
- }
20
- /**
21
- * Create an SQSConnection from a connection string
22
- * Format: sqs://?queueUrl=https://sqs.region.amazonaws.com/accountId/queueName&region=us-east-1&endpoint=http://localhost:4566
23
- */
24
- static async fromConnectionString(connectionString) {
25
- const { queueUrl, region, endpoint } = parse(connectionString);
26
- const params = new URL(connectionString).searchParams;
27
- const config = {
28
- queueUrl,
29
- region,
30
- endpoint
31
- };
32
- const accessKeyId = params.get("accessKeyId");
33
- const secretAccessKey = params.get("secretAccessKey");
34
- if (accessKeyId && secretAccessKey) config.credentials = {
35
- accessKeyId,
36
- secretAccessKey,
37
- sessionToken: params.get("sessionToken") || void 0
38
- };
39
- const connection = new SQSConnection(config);
40
- await connection.connect();
41
- return connection;
42
- }
43
- async connect() {
44
- this.connected = true;
45
- }
46
- async close() {
47
- this.client.destroy();
48
- this.connected = false;
49
- }
50
- isConnected() {
51
- return this.connected;
52
- }
53
- /**
54
- * Get the underlying SQS client
55
- */
56
- get sqsClient() {
57
- return this.client;
58
- }
59
- /**
60
- * Get the queue URL for this connection
61
- */
62
- get queueUrl() {
63
- return this.config.queueUrl;
64
- }
65
- };
66
-
67
- //#endregion
68
- export { SQSConnection };
69
- //# sourceMappingURL=SQSConnection-4tBMkVZE.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SQSConnection-4tBMkVZE.mjs","names":["config: SQSConnectionConfig","clientConfig: SQSClientConfig","connectionString: string"],"sources":["../src/sqs/SQSConnection.ts"],"sourcesContent":["import { SQSClient, type SQSClientConfig } from '@aws-sdk/client-sqs';\nimport type { EventConnection } from '../types';\nimport { EventPublisherType } from '../types';\nimport * as sqsUrl from './sqsUrl';\n\nexport interface SQSConnectionConfig {\n\tqueueUrl: string;\n\tregion?: string;\n\tendpoint?: string; // Custom endpoint (e.g., for LocalStack)\n\tcredentials?: {\n\t\taccessKeyId: string;\n\t\tsecretAccessKey: string;\n\t\tsessionToken?: string;\n\t};\n}\n\nexport class SQSConnection implements EventConnection {\n\treadonly type = EventPublisherType.SQS;\n\tprivate client: SQSClient;\n\tprivate connected = false;\n\n\tconstructor(readonly config: SQSConnectionConfig) {\n\t\tthis.config = config;\n\n\t\tconst clientConfig: SQSClientConfig = {\n\t\t\tregion: config.region,\n\t\t\tendpoint: config.endpoint,\n\t\t\tcredentials: config.credentials,\n\t\t};\n\n\t\tthis.client = new SQSClient(clientConfig);\n\t}\n\n\t/**\n\t * Create an SQSConnection from a connection string\n\t * Format: sqs://?queueUrl=https://sqs.region.amazonaws.com/accountId/queueName&region=us-east-1&endpoint=http://localhost:4566\n\t */\n\tstatic async fromConnectionString(\n\t\tconnectionString: string,\n\t): Promise<SQSConnection> {\n\t\t// Through the codec, not a second hand-rolled parse: the deploy target\n\t\t// composes these with `sqsUrl.build`, and a string it cannot read back is\n\t\t// exactly the drift one shared module rules out.\n\t\tconst { queueUrl, region, endpoint } = sqsUrl.parse(connectionString);\n\t\tconst params = new URL(connectionString).searchParams;\n\n\t\tconst config: SQSConnectionConfig = {\n\t\t\tqueueUrl,\n\t\t\tregion,\n\t\t\tendpoint,\n\t\t};\n\n\t\t// Credentials are not part of the address — see `sqsUrl` — but a caller\n\t\t// may still pin them here, so they are read beside it rather than in it.\n\t\tconst accessKeyId = params.get('accessKeyId');\n\t\tconst secretAccessKey = params.get('secretAccessKey');\n\t\tif (accessKeyId && secretAccessKey) {\n\t\t\tconfig.credentials = {\n\t\t\t\taccessKeyId,\n\t\t\t\tsecretAccessKey,\n\t\t\t\tsessionToken: params.get('sessionToken') || undefined,\n\t\t\t};\n\t\t}\n\n\t\tconst connection = new SQSConnection(config);\n\t\tawait connection.connect();\n\t\treturn connection;\n\t}\n\n\tasync connect(): Promise<void> {\n\t\t// SQS doesn't have a traditional connection, but we mark as connected\n\t\tthis.connected = true;\n\t}\n\n\tasync close(): Promise<void> {\n\t\tthis.client.destroy();\n\t\tthis.connected = false;\n\t}\n\n\tisConnected(): boolean {\n\t\treturn this.connected;\n\t}\n\n\t/**\n\t * Get the underlying SQS client\n\t */\n\tget sqsClient(): SQSClient {\n\t\treturn this.client;\n\t}\n\n\t/**\n\t * Get the queue URL for this connection\n\t */\n\tget queueUrl(): string {\n\t\treturn this.config.queueUrl;\n\t}\n}\n"],"mappings":";;;;;AAgBA,IAAa,gBAAb,MAAa,cAAyC;CACrD,AAAS,OAAO,mBAAmB;CACnC,AAAQ;CACR,AAAQ,YAAY;CAEpB,YAAqBA,QAA6B;EAA7B;AACpB,OAAK,SAAS;EAEd,MAAMC,eAAgC;GACrC,QAAQ,OAAO;GACf,UAAU,OAAO;GACjB,aAAa,OAAO;EACpB;AAED,OAAK,SAAS,IAAI,UAAU;CAC5B;;;;;CAMD,aAAa,qBACZC,kBACyB;EAIzB,MAAM,EAAE,UAAU,QAAQ,UAAU,GAAG,MAAa,iBAAiB;EACrE,MAAM,SAAS,IAAI,IAAI,kBAAkB;EAEzC,MAAMF,SAA8B;GACnC;GACA;GACA;EACA;EAID,MAAM,cAAc,OAAO,IAAI,cAAc;EAC7C,MAAM,kBAAkB,OAAO,IAAI,kBAAkB;AACrD,MAAI,eAAe,gBAClB,QAAO,cAAc;GACpB;GACA;GACA,cAAc,OAAO,IAAI,eAAe;EACxC;EAGF,MAAM,aAAa,IAAI,cAAc;AACrC,QAAM,WAAW,SAAS;AAC1B,SAAO;CACP;CAED,MAAM,UAAyB;AAE9B,OAAK,YAAY;CACjB;CAED,MAAM,QAAuB;AAC5B,OAAK,OAAO,SAAS;AACrB,OAAK,YAAY;CACjB;CAED,cAAuB;AACtB,SAAO,KAAK;CACZ;;;;CAKD,IAAI,YAAuB;AAC1B,SAAO,KAAK;CACZ;;;;CAKD,IAAI,WAAmB;AACtB,SAAO,KAAK,OAAO;CACnB;AACD"}
@@ -1,5 +0,0 @@
1
- require('./types-Byv8N9ma.cjs');
2
- require('./sqsUrl-CdisN3GU.cjs');
3
- const require_SQSConnection = require('./SQSConnection-BaC7rGhI.cjs');
4
-
5
- exports.SQSConnection = require_SQSConnection.SQSConnection;
@@ -1,75 +0,0 @@
1
- const require_chunk = require('./chunk-CsX-DzYB.cjs');
2
- const require_types = require('./types-Byv8N9ma.cjs');
3
- const require_sqsUrl = require('./sqsUrl-CdisN3GU.cjs');
4
- const __aws_sdk_client_sqs = require_chunk.__toESM(require("@aws-sdk/client-sqs"));
5
-
6
- //#region src/sqs/SQSConnection.ts
7
- var SQSConnection = class SQSConnection {
8
- type = require_types.EventPublisherType.SQS;
9
- client;
10
- connected = false;
11
- constructor(config) {
12
- this.config = config;
13
- this.config = config;
14
- const clientConfig = {
15
- region: config.region,
16
- endpoint: config.endpoint,
17
- credentials: config.credentials
18
- };
19
- this.client = new __aws_sdk_client_sqs.SQSClient(clientConfig);
20
- }
21
- /**
22
- * Create an SQSConnection from a connection string
23
- * Format: sqs://?queueUrl=https://sqs.region.amazonaws.com/accountId/queueName&region=us-east-1&endpoint=http://localhost:4566
24
- */
25
- static async fromConnectionString(connectionString) {
26
- const { queueUrl, region, endpoint } = require_sqsUrl.parse(connectionString);
27
- const params = new URL(connectionString).searchParams;
28
- const config = {
29
- queueUrl,
30
- region,
31
- endpoint
32
- };
33
- const accessKeyId = params.get("accessKeyId");
34
- const secretAccessKey = params.get("secretAccessKey");
35
- if (accessKeyId && secretAccessKey) config.credentials = {
36
- accessKeyId,
37
- secretAccessKey,
38
- sessionToken: params.get("sessionToken") || void 0
39
- };
40
- const connection = new SQSConnection(config);
41
- await connection.connect();
42
- return connection;
43
- }
44
- async connect() {
45
- this.connected = true;
46
- }
47
- async close() {
48
- this.client.destroy();
49
- this.connected = false;
50
- }
51
- isConnected() {
52
- return this.connected;
53
- }
54
- /**
55
- * Get the underlying SQS client
56
- */
57
- get sqsClient() {
58
- return this.client;
59
- }
60
- /**
61
- * Get the queue URL for this connection
62
- */
63
- get queueUrl() {
64
- return this.config.queueUrl;
65
- }
66
- };
67
-
68
- //#endregion
69
- Object.defineProperty(exports, 'SQSConnection', {
70
- enumerable: true,
71
- get: function () {
72
- return SQSConnection;
73
- }
74
- });
75
- //# sourceMappingURL=SQSConnection-BaC7rGhI.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SQSConnection-BaC7rGhI.cjs","names":["EventPublisherType","config: SQSConnectionConfig","clientConfig: SQSClientConfig","SQSClient","connectionString: string"],"sources":["../src/sqs/SQSConnection.ts"],"sourcesContent":["import { SQSClient, type SQSClientConfig } from '@aws-sdk/client-sqs';\nimport type { EventConnection } from '../types';\nimport { EventPublisherType } from '../types';\nimport * as sqsUrl from './sqsUrl';\n\nexport interface SQSConnectionConfig {\n\tqueueUrl: string;\n\tregion?: string;\n\tendpoint?: string; // Custom endpoint (e.g., for LocalStack)\n\tcredentials?: {\n\t\taccessKeyId: string;\n\t\tsecretAccessKey: string;\n\t\tsessionToken?: string;\n\t};\n}\n\nexport class SQSConnection implements EventConnection {\n\treadonly type = EventPublisherType.SQS;\n\tprivate client: SQSClient;\n\tprivate connected = false;\n\n\tconstructor(readonly config: SQSConnectionConfig) {\n\t\tthis.config = config;\n\n\t\tconst clientConfig: SQSClientConfig = {\n\t\t\tregion: config.region,\n\t\t\tendpoint: config.endpoint,\n\t\t\tcredentials: config.credentials,\n\t\t};\n\n\t\tthis.client = new SQSClient(clientConfig);\n\t}\n\n\t/**\n\t * Create an SQSConnection from a connection string\n\t * Format: sqs://?queueUrl=https://sqs.region.amazonaws.com/accountId/queueName&region=us-east-1&endpoint=http://localhost:4566\n\t */\n\tstatic async fromConnectionString(\n\t\tconnectionString: string,\n\t): Promise<SQSConnection> {\n\t\t// Through the codec, not a second hand-rolled parse: the deploy target\n\t\t// composes these with `sqsUrl.build`, and a string it cannot read back is\n\t\t// exactly the drift one shared module rules out.\n\t\tconst { queueUrl, region, endpoint } = sqsUrl.parse(connectionString);\n\t\tconst params = new URL(connectionString).searchParams;\n\n\t\tconst config: SQSConnectionConfig = {\n\t\t\tqueueUrl,\n\t\t\tregion,\n\t\t\tendpoint,\n\t\t};\n\n\t\t// Credentials are not part of the address — see `sqsUrl` — but a caller\n\t\t// may still pin them here, so they are read beside it rather than in it.\n\t\tconst accessKeyId = params.get('accessKeyId');\n\t\tconst secretAccessKey = params.get('secretAccessKey');\n\t\tif (accessKeyId && secretAccessKey) {\n\t\t\tconfig.credentials = {\n\t\t\t\taccessKeyId,\n\t\t\t\tsecretAccessKey,\n\t\t\t\tsessionToken: params.get('sessionToken') || undefined,\n\t\t\t};\n\t\t}\n\n\t\tconst connection = new SQSConnection(config);\n\t\tawait connection.connect();\n\t\treturn connection;\n\t}\n\n\tasync connect(): Promise<void> {\n\t\t// SQS doesn't have a traditional connection, but we mark as connected\n\t\tthis.connected = true;\n\t}\n\n\tasync close(): Promise<void> {\n\t\tthis.client.destroy();\n\t\tthis.connected = false;\n\t}\n\n\tisConnected(): boolean {\n\t\treturn this.connected;\n\t}\n\n\t/**\n\t * Get the underlying SQS client\n\t */\n\tget sqsClient(): SQSClient {\n\t\treturn this.client;\n\t}\n\n\t/**\n\t * Get the queue URL for this connection\n\t */\n\tget queueUrl(): string {\n\t\treturn this.config.queueUrl;\n\t}\n}\n"],"mappings":";;;;;;AAgBA,IAAa,gBAAb,MAAa,cAAyC;CACrD,AAAS,OAAOA,iCAAmB;CACnC,AAAQ;CACR,AAAQ,YAAY;CAEpB,YAAqBC,QAA6B;EAA7B;AACpB,OAAK,SAAS;EAEd,MAAMC,eAAgC;GACrC,QAAQ,OAAO;GACf,UAAU,OAAO;GACjB,aAAa,OAAO;EACpB;AAED,OAAK,SAAS,IAAIC,+BAAU;CAC5B;;;;;CAMD,aAAa,qBACZC,kBACyB;EAIzB,MAAM,EAAE,UAAU,QAAQ,UAAU,GAAG,qBAAa,iBAAiB;EACrE,MAAM,SAAS,IAAI,IAAI,kBAAkB;EAEzC,MAAMH,SAA8B;GACnC;GACA;GACA;EACA;EAID,MAAM,cAAc,OAAO,IAAI,cAAc;EAC7C,MAAM,kBAAkB,OAAO,IAAI,kBAAkB;AACrD,MAAI,eAAe,gBAClB,QAAO,cAAc;GACpB;GACA;GACA,cAAc,OAAO,IAAI,eAAe;EACxC;EAGF,MAAM,aAAa,IAAI,cAAc;AACrC,QAAM,WAAW,SAAS;AAC1B,SAAO;CACP;CAED,MAAM,UAAyB;AAE9B,OAAK,YAAY;CACjB;CAED,MAAM,QAAuB;AAC5B,OAAK,OAAO,SAAS;AACrB,OAAK,YAAY;CACjB;CAED,cAAuB;AACtB,SAAO,KAAK;CACZ;;;;CAKD,IAAI,YAAuB;AAC1B,SAAO,KAAK;CACZ;;;;CAKD,IAAI,WAAmB;AACtB,SAAO,KAAK,OAAO;CACnB;AACD"}
@@ -1,5 +0,0 @@
1
- import "./types-CYDt-2RQ.mjs";
2
- import "./sqsUrl-CbAsBFHI.mjs";
3
- import { SQSConnection } from "./SQSConnection-4tBMkVZE.mjs";
4
-
5
- export { SQSConnection };
@@ -1 +0,0 @@
1
- {"version":3,"file":"SQSSubscriber-BMWZ3s5q.mjs","names":["connection: SQSConnection","options: SQSSubscriberOptions","messages: TMessage['type'][]","listener: (payload: TMessage) => Promise<void>","messages: Message[]","body: string","receiptHandle: string","ms: number"],"sources":["../src/sqs/SQSSubscriber.ts"],"sourcesContent":["import {\n\tDeleteMessageCommand,\n\ttype Message,\n\tReceiveMessageCommand,\n} from '@aws-sdk/client-sqs';\nimport type { EventSubscriber, PublishableMessage } from '../types';\nimport type { SQSConnection } from './SQSConnection';\n\nexport interface SQSSubscriberOptions {\n\twaitTimeSeconds?: number; // SQS long polling (default: 20)\n\tmaxMessages?: number; // Max messages per poll (default: 10)\n\texpectedTopicArn?: string; // Optional: verify messages are from specific SNS topic\n}\n\n/**\n * SQS Subscriber - receives messages from an SQS queue\n *\n * This subscriber can receive:\n * 1. Direct SQS messages\n * 2. SNS messages that were pushed to the queue (SNS → SQS pattern)\n *\n * When receiving SNS messages, it:\n * - Automatically detects and parses the SNS wrapper format\n * - Filters by TopicArn (if expectedTopicArn is provided)\n * - Filters by message type\n * - Processes the actual message payload\n */\nexport class SQSSubscriber<TMessage extends PublishableMessage<string, any>>\n\timplements EventSubscriber<TMessage>\n{\n\tprivate polling = false;\n\tprivate messageTypes: Set<TMessage['type']> = new Set();\n\tprivate listener?: (payload: TMessage) => Promise<void>;\n\tprivate options: Required<SQSSubscriberOptions>;\n\n\tconstructor(\n\t\tprivate connection: SQSConnection,\n\t\toptions: SQSSubscriberOptions = {},\n\t) {\n\t\tthis.options = {\n\t\t\twaitTimeSeconds: options.waitTimeSeconds ?? 20,\n\t\t\tmaxMessages: options.maxMessages ?? 10,\n\t\t\texpectedTopicArn: options.expectedTopicArn ?? '',\n\t\t};\n\t}\n\n\tasync subscribe(\n\t\tmessages: TMessage['type'][],\n\t\tlistener: (payload: TMessage) => Promise<void>,\n\t): Promise<void> {\n\t\tthis.messageTypes = new Set(messages);\n\t\tthis.listener = listener;\n\n\t\tif (!this.connection.isConnected()) {\n\t\t\tawait this.connection.connect();\n\t\t}\n\n\t\tthis.polling = true;\n\t\tthis.poll();\n\t}\n\n\tstop(): void {\n\t\tthis.polling = false;\n\t}\n\n\tprivate async poll(): Promise<void> {\n\t\twhile (this.polling) {\n\t\t\ttry {\n\t\t\t\tconst command = new ReceiveMessageCommand({\n\t\t\t\t\tQueueUrl: this.connection.queueUrl,\n\t\t\t\t\tMaxNumberOfMessages: this.options.maxMessages,\n\t\t\t\t\tWaitTimeSeconds: this.options.waitTimeSeconds,\n\t\t\t\t\tMessageAttributeNames: ['All'],\n\t\t\t\t});\n\n\t\t\t\tconst response = await this.connection.sqsClient.send(command);\n\n\t\t\t\tif (response.Messages && response.Messages.length > 0) {\n\t\t\t\t\tawait this.processMessages(response.Messages);\n\t\t\t\t}\n\t\t\t} catch (_error) {\n\t\t\t\tawait this.sleep(1000);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async processMessages(messages: Message[]): Promise<void> {\n\t\tfor (const message of messages) {\n\t\t\ttry {\n\t\t\t\tif (!message.Body) continue;\n\n\t\t\t\t// Try to parse as SNS message first\n\t\t\t\tconst parsedMessage = this.parseMessage(message.Body);\n\n\t\t\t\tif (!parsedMessage) {\n\t\t\t\t\t// Not a valid message format\n\t\t\t\t\tawait this.deleteMessage(message.ReceiptHandle!);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst { payload, messageType, topicArn } = parsedMessage;\n\n\t\t\t\t// If expectedTopicArn is set, verify the message is from that topic\n\t\t\t\tif (this.options.expectedTopicArn && topicArn) {\n\t\t\t\t\tif (topicArn !== this.options.expectedTopicArn) {\n\t\t\t\t\t\tawait this.deleteMessage(message.ReceiptHandle!);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Check if we're subscribed to this message type\n\t\t\t\tif (\n\t\t\t\t\tmessageType &&\n\t\t\t\t\tthis.messageTypes.has(messageType as TMessage['type'])\n\t\t\t\t) {\n\t\t\t\t\t// Call listener\n\t\t\t\t\tif (this.listener) {\n\t\t\t\t\t\tawait this.listener(payload as TMessage);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Delete message after successful processing\n\t\t\t\t\tawait this.deleteMessage(message.ReceiptHandle!);\n\t\t\t\t} else {\n\t\t\t\t\t// Delete messages we're not subscribed to\n\t\t\t\t\tawait this.deleteMessage(message.ReceiptHandle!);\n\t\t\t\t}\n\t\t\t} catch (_error) {\n\t\t\t\t// Message will become visible again\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Parse message body - handles both direct SQS messages and SNS-wrapped messages\n\t */\n\tprivate parseMessage(body: string): {\n\t\tpayload: unknown;\n\t\tmessageType: string | undefined;\n\t\ttopicArn?: string;\n\t} | null {\n\t\ttry {\n\t\t\tconst parsed = JSON.parse(body);\n\n\t\t\t// Check if this is an SNS notification wrapper\n\t\t\tif (parsed.Type === 'Notification' && parsed.Message) {\n\t\t\t\t// This is an SNS message\n\t\t\t\tconst snsMessage = JSON.parse(parsed.Message);\n\t\t\t\tconst messageType =\n\t\t\t\t\tparsed.MessageAttributes?.type?.Value || snsMessage.type;\n\n\t\t\t\treturn {\n\t\t\t\t\tpayload: snsMessage,\n\t\t\t\t\tmessageType,\n\t\t\t\t\ttopicArn: parsed.TopicArn,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// This is a direct SQS message\n\t\t\treturn {\n\t\t\t\tpayload: parsed,\n\t\t\t\tmessageType: parsed.type,\n\t\t\t};\n\t\t} catch (_error) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tprivate async deleteMessage(receiptHandle: string): Promise<void> {\n\t\ttry {\n\t\t\tconst command = new DeleteMessageCommand({\n\t\t\t\tQueueUrl: this.connection.queueUrl,\n\t\t\t\tReceiptHandle: receiptHandle,\n\t\t\t});\n\t\t\tawait this.connection.sqsClient.send(command);\n\t\t} catch (_error) {}\n\t}\n\n\tprivate sleep(ms: number): Promise<void> {\n\t\treturn new Promise((resolve) => setTimeout(resolve, ms));\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,IAAa,gBAAb,MAEA;CACC,AAAQ,UAAU;CAClB,AAAQ,+BAAsC,IAAI;CAClD,AAAQ;CACR,AAAQ;CAER,YACSA,YACRC,UAAgC,CAAE,GACjC;EAFO;AAGR,OAAK,UAAU;GACd,iBAAiB,QAAQ,mBAAmB;GAC5C,aAAa,QAAQ,eAAe;GACpC,kBAAkB,QAAQ,oBAAoB;EAC9C;CACD;CAED,MAAM,UACLC,UACAC,UACgB;AAChB,OAAK,eAAe,IAAI,IAAI;AAC5B,OAAK,WAAW;AAEhB,OAAK,KAAK,WAAW,aAAa,CACjC,OAAM,KAAK,WAAW,SAAS;AAGhC,OAAK,UAAU;AACf,OAAK,MAAM;CACX;CAED,OAAa;AACZ,OAAK,UAAU;CACf;CAED,MAAc,OAAsB;AACnC,SAAO,KAAK,QACX,KAAI;GACH,MAAM,UAAU,IAAI,sBAAsB;IACzC,UAAU,KAAK,WAAW;IAC1B,qBAAqB,KAAK,QAAQ;IAClC,iBAAiB,KAAK,QAAQ;IAC9B,uBAAuB,CAAC,KAAM;GAC9B;GAED,MAAM,WAAW,MAAM,KAAK,WAAW,UAAU,KAAK,QAAQ;AAE9D,OAAI,SAAS,YAAY,SAAS,SAAS,SAAS,EACnD,OAAM,KAAK,gBAAgB,SAAS,SAAS;EAE9C,SAAQ,QAAQ;AAChB,SAAM,KAAK,MAAM,IAAK;EACtB;CAEF;CAED,MAAc,gBAAgBC,UAAoC;AACjE,OAAK,MAAM,WAAW,SACrB,KAAI;AACH,QAAK,QAAQ,KAAM;GAGnB,MAAM,gBAAgB,KAAK,aAAa,QAAQ,KAAK;AAErD,QAAK,eAAe;AAEnB,UAAM,KAAK,cAAc,QAAQ,cAAe;AAChD;GACA;GAED,MAAM,EAAE,SAAS,aAAa,UAAU,GAAG;AAG3C,OAAI,KAAK,QAAQ,oBAAoB,UACpC;QAAI,aAAa,KAAK,QAAQ,kBAAkB;AAC/C,WAAM,KAAK,cAAc,QAAQ,cAAe;AAChD;IACA;;AAIF,OACC,eACA,KAAK,aAAa,IAAI,YAAgC,EACrD;AAED,QAAI,KAAK,SACR,OAAM,KAAK,SAAS,QAAoB;AAIzC,UAAM,KAAK,cAAc,QAAQ,cAAe;GAChD,MAEA,OAAM,KAAK,cAAc,QAAQ,cAAe;EAEjD,SAAQ,QAAQ,CAEhB;CAEF;;;;CAKD,AAAQ,aAAaC,MAIZ;AACR,MAAI;GACH,MAAM,SAAS,KAAK,MAAM,KAAK;AAG/B,OAAI,OAAO,SAAS,kBAAkB,OAAO,SAAS;IAErD,MAAM,aAAa,KAAK,MAAM,OAAO,QAAQ;IAC7C,MAAM,cACL,OAAO,mBAAmB,MAAM,SAAS,WAAW;AAErD,WAAO;KACN,SAAS;KACT;KACA,UAAU,OAAO;IACjB;GACD;AAGD,UAAO;IACN,SAAS;IACT,aAAa,OAAO;GACpB;EACD,SAAQ,QAAQ;AAChB,UAAO;EACP;CACD;CAED,MAAc,cAAcC,eAAsC;AACjE,MAAI;GACH,MAAM,UAAU,IAAI,qBAAqB;IACxC,UAAU,KAAK,WAAW;IAC1B,eAAe;GACf;AACD,SAAM,KAAK,WAAW,UAAU,KAAK,QAAQ;EAC7C,SAAQ,QAAQ,CAAE;CACnB;CAED,AAAQ,MAAMC,IAA2B;AACxC,SAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,GAAG;CACvD;AACD"}