@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 +0,0 @@
1
- {"version":3,"file":"SQSSubscriber-YXPlg2rm.cjs","names":["connection: SQSConnection","options: SQSSubscriberOptions","messages: TMessage['type'][]","listener: (payload: TMessage) => Promise<void>","ReceiveMessageCommand","messages: Message[]","body: string","receiptHandle: string","DeleteMessageCommand","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,IAAIC,2CAAsB;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,IAAIC,0CAAqB;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"}
@@ -1,11 +0,0 @@
1
- //#region rolldown:runtime
2
- var __defProp = Object.defineProperty;
3
- var __export = (target, all) => {
4
- for (var name in all) __defProp(target, name, {
5
- get: all[name],
6
- enumerable: true
7
- });
8
- };
9
-
10
- //#endregion
11
- export { __export };
@@ -1,61 +0,0 @@
1
- import { __export } from "./chunk-CWFgIw0j.cjs";
2
-
3
- //#region src/sns/snsUrl.d.ts
4
- declare namespace snsUrl_d_exports {
5
- export { MalformedTopicUrl, MissingTopicArn, SnsAddress, UnexpectedTopicScheme, build, parse };
6
- }
7
- /**
8
- * The `sns://` connection-string codec — how a topic is addressed as one string.
9
- *
10
- * The twin of `sqsUrl`, and separate from it for the same reason `gs://` would
11
- * be separate from `s3://`: a topic ARN and a queue URL are different
12
- * vocabularies, and a shared codec would have to contain both. What they share
13
- * is only the rule that a construct provides one string.
14
- *
15
- * Both directions live here so they cannot drift: `parse(build(x))` is `x`.
16
- */
17
- /** What an SNS connection string addresses. */
18
- interface SnsAddress {
19
- topicArn: string;
20
- /** Read off the topic, never inherited: a topic may live in another region. */
21
- region?: string;
22
- /** Set for SNS-compatible backends such as LocalStack. */
23
- endpoint?: string;
24
- /**
25
- * The queue a subscriber drains.
26
- *
27
- * Present only on the subscriber's string: fan-out delivers to a queue per
28
- * subscriber, so the publisher's string names the topic and nothing else.
29
- */
30
- queueName?: string;
31
- }
32
- /**
33
- * Compose an address into a connection string.
34
- *
35
- * Credentials never appear, for the same reason they never appear in an
36
- * `s3://` URL: the SDK resolves them from its own chain.
37
- */
38
- declare function build(address: SnsAddress): string;
39
- /** Parse a connection string back into an address. */
40
- declare function parse(connectionString: string): SnsAddress;
41
- /** The string is not a URL at all. */
42
- declare class MalformedTopicUrl extends Error {
43
- readonly url: string;
44
- constructor(url: string);
45
- }
46
- /** The string is a URL, but not an `sns://` one. */
47
- declare class UnexpectedTopicScheme extends Error {
48
- readonly url: string;
49
- readonly expected: string;
50
- readonly actual: string;
51
- constructor(url: string, expected: string, actual: string);
52
- }
53
- /** An `sns://` string with no topic names nothing. */
54
- declare class MissingTopicArn extends Error {
55
- readonly url: string;
56
- constructor(url: string);
57
- }
58
- //# sourceMappingURL=snsUrl.d.ts.map
59
- //#endregion
60
- export { MalformedTopicUrl, MissingTopicArn, SnsAddress, UnexpectedTopicScheme, build, parse, snsUrl_d_exports };
61
- //# sourceMappingURL=snsUrl-ASdc0D1v.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"snsUrl-ASdc0D1v.d.cts","names":[],"sources":["../src/sns/snsUrl.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;UAYiB,UAAA;EAAA,QAAA,EAAA,MAAU;EAuBX;EAcA,MAAA,CAAA,EAAK,MAAA;EA4BR;EAQA,QAAA,CAAA,EAAA,MAAA;EAcA;;;;;;;;;;;;;;iBAhEG,KAAA,UAAe;;iBAcf,KAAA,4BAAiC;;cA4BpC,iBAAA,SAA0B,KAAK;;;;;cAQ/B,qBAAA,SAA8B,KAAK;;;;;;;cAcnC,eAAA,SAAwB,KAAK"}
@@ -1,79 +0,0 @@
1
- import { __export } from "./chunk-B9dir_RE.mjs";
2
-
3
- //#region src/sns/snsUrl.ts
4
- var snsUrl_exports = {};
5
- __export(snsUrl_exports, {
6
- MalformedTopicUrl: () => MalformedTopicUrl,
7
- MissingTopicArn: () => MissingTopicArn,
8
- UnexpectedTopicScheme: () => UnexpectedTopicScheme,
9
- build: () => build,
10
- parse: () => parse
11
- });
12
- const SCHEME = "sns:";
13
- /**
14
- * Compose an address into a connection string.
15
- *
16
- * Credentials never appear, for the same reason they never appear in an
17
- * `s3://` URL: the SDK resolves them from its own chain.
18
- */
19
- function build(address) {
20
- const { topicArn, region, endpoint, queueName } = address;
21
- if (!topicArn) throw new MissingTopicArn("");
22
- const url = new URL(`${SCHEME}//`);
23
- url.searchParams.set("topicArn", topicArn);
24
- if (region) url.searchParams.set("region", region);
25
- if (endpoint) url.searchParams.set("endpoint", endpoint);
26
- if (queueName) url.searchParams.set("queueName", queueName);
27
- return url.toString();
28
- }
29
- /** Parse a connection string back into an address. */
30
- function parse(connectionString) {
31
- let parsed;
32
- try {
33
- parsed = new URL(connectionString);
34
- } catch {
35
- throw new MalformedTopicUrl(connectionString);
36
- }
37
- if (parsed.protocol !== SCHEME) throw new UnexpectedTopicScheme(connectionString, SCHEME, parsed.protocol);
38
- const topicArn = parsed.searchParams.get("topicArn");
39
- if (!topicArn) throw new MissingTopicArn(connectionString);
40
- const region = parsed.searchParams.get("region") ?? void 0;
41
- const endpoint = parsed.searchParams.get("endpoint") ?? void 0;
42
- const queueName = parsed.searchParams.get("queueName") ?? void 0;
43
- return {
44
- topicArn,
45
- ...region ? { region } : {},
46
- ...endpoint ? { endpoint } : {},
47
- ...queueName ? { queueName } : {}
48
- };
49
- }
50
- /** The string is not a URL at all. */
51
- var MalformedTopicUrl = class extends Error {
52
- constructor(url) {
53
- super(`'${url}' is not a valid connection string.`);
54
- this.url = url;
55
- this.name = "MalformedTopicUrl";
56
- }
57
- };
58
- /** The string is a URL, but not an `sns://` one. */
59
- var UnexpectedTopicScheme = class extends Error {
60
- constructor(url, expected, actual) {
61
- super(`Expected a '${expected}//' connection string and got '${actual}//' in '${url}'.`);
62
- this.url = url;
63
- this.expected = expected;
64
- this.actual = actual;
65
- this.name = "UnexpectedTopicScheme";
66
- }
67
- };
68
- /** An `sns://` string with no topic names nothing. */
69
- var MissingTopicArn = class extends Error {
70
- constructor(url) {
71
- super(url ? `'${url}' names no topic: an sns:// connection string needs ?topicArn=.` : "An sns:// connection string needs a topicArn.");
72
- this.url = url;
73
- this.name = "MissingTopicArn";
74
- }
75
- };
76
-
77
- //#endregion
78
- export { MalformedTopicUrl, MissingTopicArn, UnexpectedTopicScheme, build, parse, snsUrl_exports };
79
- //# sourceMappingURL=snsUrl-CifYhPAa.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"snsUrl-CifYhPAa.mjs","names":["address: SnsAddress","connectionString: string","parsed: URL","url: string","expected: string","actual: string"],"sources":["../src/sns/snsUrl.ts"],"sourcesContent":["/**\n * The `sns://` connection-string codec — how a topic is addressed as one string.\n *\n * The twin of `sqsUrl`, and separate from it for the same reason `gs://` would\n * be separate from `s3://`: a topic ARN and a queue URL are different\n * vocabularies, and a shared codec would have to contain both. What they share\n * is only the rule that a construct provides one string.\n *\n * Both directions live here so they cannot drift: `parse(build(x))` is `x`.\n */\n\n/** What an SNS connection string addresses. */\nexport interface SnsAddress {\n\ttopicArn: string;\n\t/** Read off the topic, never inherited: a topic may live in another region. */\n\tregion?: string;\n\t/** Set for SNS-compatible backends such as LocalStack. */\n\tendpoint?: string;\n\t/**\n\t * The queue a subscriber drains.\n\t *\n\t * Present only on the subscriber's string: fan-out delivers to a queue per\n\t * subscriber, so the publisher's string names the topic and nothing else.\n\t */\n\tqueueName?: string;\n}\n\nconst SCHEME = 'sns:';\n\n/**\n * Compose an address into a connection string.\n *\n * Credentials never appear, for the same reason they never appear in an\n * `s3://` URL: the SDK resolves them from its own chain.\n */\nexport function build(address: SnsAddress): string {\n\tconst { topicArn, region, endpoint, queueName } = address;\n\tif (!topicArn) throw new MissingTopicArn('');\n\n\tconst url = new URL(`${SCHEME}//`);\n\turl.searchParams.set('topicArn', topicArn);\n\tif (region) url.searchParams.set('region', region);\n\tif (endpoint) url.searchParams.set('endpoint', endpoint);\n\tif (queueName) url.searchParams.set('queueName', queueName);\n\n\treturn url.toString();\n}\n\n/** Parse a connection string back into an address. */\nexport function parse(connectionString: string): SnsAddress {\n\tlet parsed: URL;\n\ttry {\n\t\tparsed = new URL(connectionString);\n\t} catch {\n\t\tthrow new MalformedTopicUrl(connectionString);\n\t}\n\n\tif (parsed.protocol !== SCHEME) {\n\t\tthrow new UnexpectedTopicScheme(connectionString, SCHEME, parsed.protocol);\n\t}\n\n\tconst topicArn = parsed.searchParams.get('topicArn');\n\tif (!topicArn) throw new MissingTopicArn(connectionString);\n\n\tconst region = parsed.searchParams.get('region') ?? undefined;\n\tconst endpoint = parsed.searchParams.get('endpoint') ?? undefined;\n\tconst queueName = parsed.searchParams.get('queueName') ?? undefined;\n\n\treturn {\n\t\ttopicArn,\n\t\t...(region ? { region } : {}),\n\t\t...(endpoint ? { endpoint } : {}),\n\t\t...(queueName ? { queueName } : {}),\n\t};\n}\n\n/** The string is not a URL at all. */\nexport class MalformedTopicUrl extends Error {\n\tconstructor(readonly url: string) {\n\t\tsuper(`'${url}' is not a valid connection string.`);\n\t\tthis.name = 'MalformedTopicUrl';\n\t}\n}\n\n/** The string is a URL, but not an `sns://` one. */\nexport class UnexpectedTopicScheme 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 = 'UnexpectedTopicScheme';\n\t}\n}\n\n/** An `sns://` string with no topic names nothing. */\nexport class MissingTopicArn extends Error {\n\tconstructor(readonly url: string) {\n\t\tsuper(\n\t\t\turl\n\t\t\t\t? `'${url}' names no topic: an sns:// connection string needs ?topicArn=.`\n\t\t\t\t: 'An sns:// connection string needs a topicArn.',\n\t\t);\n\t\tthis.name = 'MissingTopicArn';\n\t}\n}\n"],"mappings":";;;;;;;;;;;AA2BA,MAAM,SAAS;;;;;;;AAQf,SAAgB,MAAMA,SAA6B;CAClD,MAAM,EAAE,UAAU,QAAQ,UAAU,WAAW,GAAG;AAClD,MAAK,SAAU,OAAM,IAAI,gBAAgB;CAEzC,MAAM,MAAM,IAAI,KAAK,EAAE,OAAO;AAC9B,KAAI,aAAa,IAAI,YAAY,SAAS;AAC1C,KAAI,OAAQ,KAAI,aAAa,IAAI,UAAU,OAAO;AAClD,KAAI,SAAU,KAAI,aAAa,IAAI,YAAY,SAAS;AACxD,KAAI,UAAW,KAAI,aAAa,IAAI,aAAa,UAAU;AAE3D,QAAO,IAAI,UAAU;AACrB;;AAGD,SAAgB,MAAMC,kBAAsC;CAC3D,IAAIC;AACJ,KAAI;AACH,WAAS,IAAI,IAAI;CACjB,QAAO;AACP,QAAM,IAAI,kBAAkB;CAC5B;AAED,KAAI,OAAO,aAAa,OACvB,OAAM,IAAI,sBAAsB,kBAAkB,QAAQ,OAAO;CAGlE,MAAM,WAAW,OAAO,aAAa,IAAI,WAAW;AACpD,MAAK,SAAU,OAAM,IAAI,gBAAgB;CAEzC,MAAM,SAAS,OAAO,aAAa,IAAI,SAAS;CAChD,MAAM,WAAW,OAAO,aAAa,IAAI,WAAW;CACpD,MAAM,YAAY,OAAO,aAAa,IAAI,YAAY;AAEtD,QAAO;EACN;EACA,GAAI,SAAS,EAAE,OAAQ,IAAG,CAAE;EAC5B,GAAI,WAAW,EAAE,SAAU,IAAG,CAAE;EAChC,GAAI,YAAY,EAAE,UAAW,IAAG,CAAE;CAClC;AACD;;AAGD,IAAa,oBAAb,cAAuC,MAAM;CAC5C,YAAqBC,KAAa;AACjC,SAAO,GAAG,IAAI,qCAAqC;EAD/B;AAEpB,OAAK,OAAO;CACZ;AACD;;AAGD,IAAa,wBAAb,cAA2C,MAAM;CAChD,YACUA,KACAC,UACAC,QACR;AACD,SACE,cAAc,SAAS,iCAAiC,OAAO,UAAU,IAAI,IAC9E;EANQ;EACA;EACA;AAKT,OAAK,OAAO;CACZ;AACD;;AAGD,IAAa,kBAAb,cAAqC,MAAM;CAC1C,YAAqBF,KAAa;AACjC,QACC,OACI,GAAG,IAAI,mEACR,gDACH;EALmB;AAMpB,OAAK,OAAO;CACZ;AACD"}
@@ -1,61 +0,0 @@
1
- import { __export } from "./chunk-B9dir_RE.mjs";
2
-
3
- //#region src/sns/snsUrl.d.ts
4
- declare namespace snsUrl_d_exports {
5
- export { MalformedTopicUrl, MissingTopicArn, SnsAddress, UnexpectedTopicScheme, build, parse };
6
- }
7
- /**
8
- * The `sns://` connection-string codec — how a topic is addressed as one string.
9
- *
10
- * The twin of `sqsUrl`, and separate from it for the same reason `gs://` would
11
- * be separate from `s3://`: a topic ARN and a queue URL are different
12
- * vocabularies, and a shared codec would have to contain both. What they share
13
- * is only the rule that a construct provides one string.
14
- *
15
- * Both directions live here so they cannot drift: `parse(build(x))` is `x`.
16
- */
17
- /** What an SNS connection string addresses. */
18
- interface SnsAddress {
19
- topicArn: string;
20
- /** Read off the topic, never inherited: a topic may live in another region. */
21
- region?: string;
22
- /** Set for SNS-compatible backends such as LocalStack. */
23
- endpoint?: string;
24
- /**
25
- * The queue a subscriber drains.
26
- *
27
- * Present only on the subscriber's string: fan-out delivers to a queue per
28
- * subscriber, so the publisher's string names the topic and nothing else.
29
- */
30
- queueName?: string;
31
- }
32
- /**
33
- * Compose an address into a connection string.
34
- *
35
- * Credentials never appear, for the same reason they never appear in an
36
- * `s3://` URL: the SDK resolves them from its own chain.
37
- */
38
- declare function build(address: SnsAddress): string;
39
- /** Parse a connection string back into an address. */
40
- declare function parse(connectionString: string): SnsAddress;
41
- /** The string is not a URL at all. */
42
- declare class MalformedTopicUrl extends Error {
43
- readonly url: string;
44
- constructor(url: string);
45
- }
46
- /** The string is a URL, but not an `sns://` one. */
47
- declare class UnexpectedTopicScheme extends Error {
48
- readonly url: string;
49
- readonly expected: string;
50
- readonly actual: string;
51
- constructor(url: string, expected: string, actual: string);
52
- }
53
- /** An `sns://` string with no topic names nothing. */
54
- declare class MissingTopicArn extends Error {
55
- readonly url: string;
56
- constructor(url: string);
57
- }
58
- //# sourceMappingURL=snsUrl.d.ts.map
59
- //#endregion
60
- export { MalformedTopicUrl, MissingTopicArn, SnsAddress, UnexpectedTopicScheme, build, parse, snsUrl_d_exports };
61
- //# sourceMappingURL=snsUrl-FRbRcwF0.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"snsUrl-FRbRcwF0.d.mts","names":[],"sources":["../src/sns/snsUrl.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;UAYiB,UAAA;EAAA,QAAA,EAAA,MAAU;EAuBX;EAcA,MAAA,CAAA,EAAK,MAAA;EA4BR;EAQA,QAAA,CAAA,EAAA,MAAA;EAcA;;;;;;;;;;;;;;iBAhEG,KAAA,UAAe;;iBAcf,KAAA,4BAAiC;;cA4BpC,iBAAA,SAA0B,KAAK;;;;;cAQ/B,qBAAA,SAA8B,KAAK;;;;;;;cAcnC,eAAA,SAAwB,KAAK"}
@@ -1,114 +0,0 @@
1
- const require_chunk = require('./chunk-CsX-DzYB.cjs');
2
-
3
- //#region src/sns/snsUrl.ts
4
- var snsUrl_exports = {};
5
- require_chunk.__export(snsUrl_exports, {
6
- MalformedTopicUrl: () => MalformedTopicUrl,
7
- MissingTopicArn: () => MissingTopicArn,
8
- UnexpectedTopicScheme: () => UnexpectedTopicScheme,
9
- build: () => build,
10
- parse: () => parse
11
- });
12
- const SCHEME = "sns:";
13
- /**
14
- * Compose an address into a connection string.
15
- *
16
- * Credentials never appear, for the same reason they never appear in an
17
- * `s3://` URL: the SDK resolves them from its own chain.
18
- */
19
- function build(address) {
20
- const { topicArn, region, endpoint, queueName } = address;
21
- if (!topicArn) throw new MissingTopicArn("");
22
- const url = new URL(`${SCHEME}//`);
23
- url.searchParams.set("topicArn", topicArn);
24
- if (region) url.searchParams.set("region", region);
25
- if (endpoint) url.searchParams.set("endpoint", endpoint);
26
- if (queueName) url.searchParams.set("queueName", queueName);
27
- return url.toString();
28
- }
29
- /** Parse a connection string back into an address. */
30
- function parse(connectionString) {
31
- let parsed;
32
- try {
33
- parsed = new URL(connectionString);
34
- } catch {
35
- throw new MalformedTopicUrl(connectionString);
36
- }
37
- if (parsed.protocol !== SCHEME) throw new UnexpectedTopicScheme(connectionString, SCHEME, parsed.protocol);
38
- const topicArn = parsed.searchParams.get("topicArn");
39
- if (!topicArn) throw new MissingTopicArn(connectionString);
40
- const region = parsed.searchParams.get("region") ?? void 0;
41
- const endpoint = parsed.searchParams.get("endpoint") ?? void 0;
42
- const queueName = parsed.searchParams.get("queueName") ?? void 0;
43
- return {
44
- topicArn,
45
- ...region ? { region } : {},
46
- ...endpoint ? { endpoint } : {},
47
- ...queueName ? { queueName } : {}
48
- };
49
- }
50
- /** The string is not a URL at all. */
51
- var MalformedTopicUrl = class extends Error {
52
- constructor(url) {
53
- super(`'${url}' is not a valid connection string.`);
54
- this.url = url;
55
- this.name = "MalformedTopicUrl";
56
- }
57
- };
58
- /** The string is a URL, but not an `sns://` one. */
59
- var UnexpectedTopicScheme = class extends Error {
60
- constructor(url, expected, actual) {
61
- super(`Expected a '${expected}//' connection string and got '${actual}//' in '${url}'.`);
62
- this.url = url;
63
- this.expected = expected;
64
- this.actual = actual;
65
- this.name = "UnexpectedTopicScheme";
66
- }
67
- };
68
- /** An `sns://` string with no topic names nothing. */
69
- var MissingTopicArn = class extends Error {
70
- constructor(url) {
71
- super(url ? `'${url}' names no topic: an sns:// connection string needs ?topicArn=.` : "An sns:// connection string needs a topicArn.");
72
- this.url = url;
73
- this.name = "MissingTopicArn";
74
- }
75
- };
76
-
77
- //#endregion
78
- Object.defineProperty(exports, 'MalformedTopicUrl', {
79
- enumerable: true,
80
- get: function () {
81
- return MalformedTopicUrl;
82
- }
83
- });
84
- Object.defineProperty(exports, 'MissingTopicArn', {
85
- enumerable: true,
86
- get: function () {
87
- return MissingTopicArn;
88
- }
89
- });
90
- Object.defineProperty(exports, 'UnexpectedTopicScheme', {
91
- enumerable: true,
92
- get: function () {
93
- return UnexpectedTopicScheme;
94
- }
95
- });
96
- Object.defineProperty(exports, 'build', {
97
- enumerable: true,
98
- get: function () {
99
- return build;
100
- }
101
- });
102
- Object.defineProperty(exports, 'parse', {
103
- enumerable: true,
104
- get: function () {
105
- return parse;
106
- }
107
- });
108
- Object.defineProperty(exports, 'snsUrl_exports', {
109
- enumerable: true,
110
- get: function () {
111
- return snsUrl_exports;
112
- }
113
- });
114
- //# sourceMappingURL=snsUrl-f2gU3CzK.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"snsUrl-f2gU3CzK.cjs","names":["address: SnsAddress","connectionString: string","parsed: URL","url: string","expected: string","actual: string"],"sources":["../src/sns/snsUrl.ts"],"sourcesContent":["/**\n * The `sns://` connection-string codec — how a topic is addressed as one string.\n *\n * The twin of `sqsUrl`, and separate from it for the same reason `gs://` would\n * be separate from `s3://`: a topic ARN and a queue URL are different\n * vocabularies, and a shared codec would have to contain both. What they share\n * is only the rule that a construct provides one string.\n *\n * Both directions live here so they cannot drift: `parse(build(x))` is `x`.\n */\n\n/** What an SNS connection string addresses. */\nexport interface SnsAddress {\n\ttopicArn: string;\n\t/** Read off the topic, never inherited: a topic may live in another region. */\n\tregion?: string;\n\t/** Set for SNS-compatible backends such as LocalStack. */\n\tendpoint?: string;\n\t/**\n\t * The queue a subscriber drains.\n\t *\n\t * Present only on the subscriber's string: fan-out delivers to a queue per\n\t * subscriber, so the publisher's string names the topic and nothing else.\n\t */\n\tqueueName?: string;\n}\n\nconst SCHEME = 'sns:';\n\n/**\n * Compose an address into a connection string.\n *\n * Credentials never appear, for the same reason they never appear in an\n * `s3://` URL: the SDK resolves them from its own chain.\n */\nexport function build(address: SnsAddress): string {\n\tconst { topicArn, region, endpoint, queueName } = address;\n\tif (!topicArn) throw new MissingTopicArn('');\n\n\tconst url = new URL(`${SCHEME}//`);\n\turl.searchParams.set('topicArn', topicArn);\n\tif (region) url.searchParams.set('region', region);\n\tif (endpoint) url.searchParams.set('endpoint', endpoint);\n\tif (queueName) url.searchParams.set('queueName', queueName);\n\n\treturn url.toString();\n}\n\n/** Parse a connection string back into an address. */\nexport function parse(connectionString: string): SnsAddress {\n\tlet parsed: URL;\n\ttry {\n\t\tparsed = new URL(connectionString);\n\t} catch {\n\t\tthrow new MalformedTopicUrl(connectionString);\n\t}\n\n\tif (parsed.protocol !== SCHEME) {\n\t\tthrow new UnexpectedTopicScheme(connectionString, SCHEME, parsed.protocol);\n\t}\n\n\tconst topicArn = parsed.searchParams.get('topicArn');\n\tif (!topicArn) throw new MissingTopicArn(connectionString);\n\n\tconst region = parsed.searchParams.get('region') ?? undefined;\n\tconst endpoint = parsed.searchParams.get('endpoint') ?? undefined;\n\tconst queueName = parsed.searchParams.get('queueName') ?? undefined;\n\n\treturn {\n\t\ttopicArn,\n\t\t...(region ? { region } : {}),\n\t\t...(endpoint ? { endpoint } : {}),\n\t\t...(queueName ? { queueName } : {}),\n\t};\n}\n\n/** The string is not a URL at all. */\nexport class MalformedTopicUrl extends Error {\n\tconstructor(readonly url: string) {\n\t\tsuper(`'${url}' is not a valid connection string.`);\n\t\tthis.name = 'MalformedTopicUrl';\n\t}\n}\n\n/** The string is a URL, but not an `sns://` one. */\nexport class UnexpectedTopicScheme 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 = 'UnexpectedTopicScheme';\n\t}\n}\n\n/** An `sns://` string with no topic names nothing. */\nexport class MissingTopicArn extends Error {\n\tconstructor(readonly url: string) {\n\t\tsuper(\n\t\t\turl\n\t\t\t\t? `'${url}' names no topic: an sns:// connection string needs ?topicArn=.`\n\t\t\t\t: 'An sns:// connection string needs a topicArn.',\n\t\t);\n\t\tthis.name = 'MissingTopicArn';\n\t}\n}\n"],"mappings":";;;;;;;;;;;AA2BA,MAAM,SAAS;;;;;;;AAQf,SAAgB,MAAMA,SAA6B;CAClD,MAAM,EAAE,UAAU,QAAQ,UAAU,WAAW,GAAG;AAClD,MAAK,SAAU,OAAM,IAAI,gBAAgB;CAEzC,MAAM,MAAM,IAAI,KAAK,EAAE,OAAO;AAC9B,KAAI,aAAa,IAAI,YAAY,SAAS;AAC1C,KAAI,OAAQ,KAAI,aAAa,IAAI,UAAU,OAAO;AAClD,KAAI,SAAU,KAAI,aAAa,IAAI,YAAY,SAAS;AACxD,KAAI,UAAW,KAAI,aAAa,IAAI,aAAa,UAAU;AAE3D,QAAO,IAAI,UAAU;AACrB;;AAGD,SAAgB,MAAMC,kBAAsC;CAC3D,IAAIC;AACJ,KAAI;AACH,WAAS,IAAI,IAAI;CACjB,QAAO;AACP,QAAM,IAAI,kBAAkB;CAC5B;AAED,KAAI,OAAO,aAAa,OACvB,OAAM,IAAI,sBAAsB,kBAAkB,QAAQ,OAAO;CAGlE,MAAM,WAAW,OAAO,aAAa,IAAI,WAAW;AACpD,MAAK,SAAU,OAAM,IAAI,gBAAgB;CAEzC,MAAM,SAAS,OAAO,aAAa,IAAI,SAAS;CAChD,MAAM,WAAW,OAAO,aAAa,IAAI,WAAW;CACpD,MAAM,YAAY,OAAO,aAAa,IAAI,YAAY;AAEtD,QAAO;EACN;EACA,GAAI,SAAS,EAAE,OAAQ,IAAG,CAAE;EAC5B,GAAI,WAAW,EAAE,SAAU,IAAG,CAAE;EAChC,GAAI,YAAY,EAAE,UAAW,IAAG,CAAE;CAClC;AACD;;AAGD,IAAa,oBAAb,cAAuC,MAAM;CAC5C,YAAqBC,KAAa;AACjC,SAAO,GAAG,IAAI,qCAAqC;EAD/B;AAEpB,OAAK,OAAO;CACZ;AACD;;AAGD,IAAa,wBAAb,cAA2C,MAAM;CAChD,YACUA,KACAC,UACAC,QACR;AACD,SACE,cAAc,SAAS,iCAAiC,OAAO,UAAU,IAAI,IAC9E;EANQ;EACA;EACA;AAKT,OAAK,OAAO;CACZ;AACD;;AAGD,IAAa,kBAAb,cAAqC,MAAM;CAC1C,YAAqBF,KAAa;AACjC,QACC,OACI,GAAG,IAAI,mEACR,gDACH;EALmB;AAMpB,OAAK,OAAO;CACZ;AACD"}
@@ -1,60 +0,0 @@
1
- import { __export } from "./chunk-B9dir_RE.mjs";
2
-
3
- //#region src/sqs/sqsUrl.d.ts
4
- declare namespace sqsUrl_d_exports {
5
- export { MalformedQueueUrl, MissingQueueUrl, SqsAddress, UnexpectedQueueScheme, build, parse };
6
- }
7
- /**
8
- * The `sqs://` connection-string codec — how a queue is addressed as one string.
9
- *
10
- * It lives beside the client rather than in a neutral package because
11
- * `queueUrl`, `region`, and `endpoint` are SQS's vocabulary. The neutral layer
12
- * knows only that a queue provides *one* connection string; what that string
13
- * says is between the component that composes it and the publisher that parses
14
- * it. The `pgboss://` form sits beside its own client and shares nothing here.
15
- *
16
- * Both directions live in this module so they cannot drift: `parse(build(x))`
17
- * is `x`, and the deploy target composing a string it cannot parse back is the
18
- * failure this shape rules out.
19
- */
20
- /** What an SQS connection string addresses. */
21
- interface SqsAddress {
22
- queueUrl: string;
23
- /** Read off the queue, never inherited: a queue may live in another region. */
24
- region?: string;
25
- /** Set for SQS-compatible backends such as LocalStack. */
26
- endpoint?: string;
27
- /** Largest batch the publisher may send in one call. */
28
- maxBatchSize?: number;
29
- }
30
- /**
31
- * Compose an address into a connection string.
32
- *
33
- * Credentials never appear. The AWS SDK resolves them from its own chain — an
34
- * execution role deployed, environment locally — so the string stays safe to log
35
- * and identical across environments that differ only in who is calling.
36
- */
37
- declare function build(address: SqsAddress): string;
38
- /** Parse a connection string back into an address. */
39
- declare function parse(connectionString: string): SqsAddress;
40
- /** The string is not a URL at all. */
41
- declare class MalformedQueueUrl extends Error {
42
- readonly url: string;
43
- constructor(url: string);
44
- }
45
- /** The string is a URL, but not an `sqs://` one. */
46
- declare class UnexpectedQueueScheme extends Error {
47
- readonly url: string;
48
- readonly expected: string;
49
- readonly actual: string;
50
- constructor(url: string, expected: string, actual: string);
51
- }
52
- /** An `sqs://` string with no queue names nothing. */
53
- declare class MissingQueueUrl extends Error {
54
- readonly url: string;
55
- constructor(url: string);
56
- }
57
- //# sourceMappingURL=sqsUrl.d.ts.map
58
- //#endregion
59
- export { MalformedQueueUrl, MissingQueueUrl, SqsAddress, UnexpectedQueueScheme, build, parse, sqsUrl_d_exports };
60
- //# sourceMappingURL=sqsUrl-BV6zS-mi.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sqsUrl-BV6zS-mi.d.mts","names":[],"sources":["../src/sqs/sqsUrl.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;AAeA;AAmBA;AAgBgB,UAnCC,UAAA,CAmCgC;EA4BpC,QAAA,EAAA,MAAA;EAQA;EAcA,MAAA,CAAA,EAAA,MAAA;;;;;;;;;;;;;iBAlEG,KAAA,UAAe;;iBAgBf,KAAA,4BAAiC;;cA4BpC,iBAAA,SAA0B,KAAK;;;;;cAQ/B,qBAAA,SAA8B,KAAK;;;;;;;cAcnC,eAAA,SAAwB,KAAK"}
@@ -1,80 +0,0 @@
1
- import { __export } from "./chunk-B9dir_RE.mjs";
2
-
3
- //#region src/sqs/sqsUrl.ts
4
- var sqsUrl_exports = {};
5
- __export(sqsUrl_exports, {
6
- MalformedQueueUrl: () => MalformedQueueUrl,
7
- MissingQueueUrl: () => MissingQueueUrl,
8
- UnexpectedQueueScheme: () => UnexpectedQueueScheme,
9
- build: () => build,
10
- parse: () => parse
11
- });
12
- const SCHEME = "sqs:";
13
- /**
14
- * Compose an address into a connection string.
15
- *
16
- * Credentials never appear. The AWS SDK resolves them from its own chain — an
17
- * execution role deployed, environment locally — so the string stays safe to log
18
- * and identical across environments that differ only in who is calling.
19
- */
20
- function build(address) {
21
- const { queueUrl, region, endpoint, maxBatchSize } = address;
22
- if (!queueUrl) throw new MissingQueueUrl("");
23
- const url = new URL(`${SCHEME}//`);
24
- url.searchParams.set("queueUrl", queueUrl);
25
- if (region) url.searchParams.set("region", region);
26
- if (endpoint) url.searchParams.set("endpoint", endpoint);
27
- if (maxBatchSize !== void 0) url.searchParams.set("maxBatchSize", String(maxBatchSize));
28
- return url.toString();
29
- }
30
- /** Parse a connection string back into an address. */
31
- function parse(connectionString) {
32
- let parsed;
33
- try {
34
- parsed = new URL(connectionString);
35
- } catch {
36
- throw new MalformedQueueUrl(connectionString);
37
- }
38
- if (parsed.protocol !== SCHEME) throw new UnexpectedQueueScheme(connectionString, SCHEME, parsed.protocol);
39
- const queueUrl = parsed.searchParams.get("queueUrl");
40
- if (!queueUrl) throw new MissingQueueUrl(connectionString);
41
- const region = parsed.searchParams.get("region") ?? void 0;
42
- const endpoint = parsed.searchParams.get("endpoint") ?? void 0;
43
- const batch = parsed.searchParams.get("maxBatchSize");
44
- return {
45
- queueUrl,
46
- ...region ? { region } : {},
47
- ...endpoint ? { endpoint } : {},
48
- ...batch ? { maxBatchSize: Number(batch) } : {}
49
- };
50
- }
51
- /** The string is not a URL at all. */
52
- var MalformedQueueUrl = class extends Error {
53
- constructor(url) {
54
- super(`'${url}' is not a valid connection string.`);
55
- this.url = url;
56
- this.name = "MalformedQueueUrl";
57
- }
58
- };
59
- /** The string is a URL, but not an `sqs://` one. */
60
- var UnexpectedQueueScheme = class extends Error {
61
- constructor(url, expected, actual) {
62
- super(`Expected a '${expected}//' connection string and got '${actual}//' in '${url}'.`);
63
- this.url = url;
64
- this.expected = expected;
65
- this.actual = actual;
66
- this.name = "UnexpectedQueueScheme";
67
- }
68
- };
69
- /** An `sqs://` string with no queue names nothing. */
70
- var MissingQueueUrl = class extends Error {
71
- constructor(url) {
72
- super(url ? `'${url}' names no queue: an sqs:// connection string needs ?queueUrl=.` : "An sqs:// connection string needs a queueUrl.");
73
- this.url = url;
74
- this.name = "MissingQueueUrl";
75
- }
76
- };
77
-
78
- //#endregion
79
- export { MalformedQueueUrl, MissingQueueUrl, UnexpectedQueueScheme, build, parse, sqsUrl_exports };
80
- //# sourceMappingURL=sqsUrl-CbAsBFHI.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sqsUrl-CbAsBFHI.mjs","names":["address: SqsAddress","connectionString: string","parsed: URL","url: string","expected: string","actual: string"],"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,MAAMA,SAA6B;CAClD,MAAM,EAAE,UAAU,QAAQ,UAAU,cAAc,GAAG;AACrD,MAAK,SAAU,OAAM,IAAI,gBAAgB;CAEzC,MAAM,MAAM,IAAI,KAAK,EAAE,OAAO;AAC9B,KAAI,aAAa,IAAI,YAAY,SAAS;AAC1C,KAAI,OAAQ,KAAI,aAAa,IAAI,UAAU,OAAO;AAClD,KAAI,SAAU,KAAI,aAAa,IAAI,YAAY,SAAS;AACxD,KAAI,wBACH,KAAI,aAAa,IAAI,gBAAgB,OAAO,aAAa,CAAC;AAG3D,QAAO,IAAI,UAAU;AACrB;;AAGD,SAAgB,MAAMC,kBAAsC;CAC3D,IAAIC;AACJ,KAAI;AACH,WAAS,IAAI,IAAI;CACjB,QAAO;AACP,QAAM,IAAI,kBAAkB;CAC5B;AAED,KAAI,OAAO,aAAa,OACvB,OAAM,IAAI,sBAAsB,kBAAkB,QAAQ,OAAO;CAGlE,MAAM,WAAW,OAAO,aAAa,IAAI,WAAW;AACpD,MAAK,SAAU,OAAM,IAAI,gBAAgB;CAEzC,MAAM,SAAS,OAAO,aAAa,IAAI,SAAS;CAChD,MAAM,WAAW,OAAO,aAAa,IAAI,WAAW;CACpD,MAAM,QAAQ,OAAO,aAAa,IAAI,eAAe;AAErD,QAAO;EACN;EACA,GAAI,SAAS,EAAE,OAAQ,IAAG,CAAE;EAC5B,GAAI,WAAW,EAAE,SAAU,IAAG,CAAE;EAChC,GAAI,QAAQ,EAAE,cAAc,OAAO,MAAM,CAAE,IAAG,CAAE;CAChD;AACD;;AAGD,IAAa,oBAAb,cAAuC,MAAM;CAC5C,YAAqBC,KAAa;AACjC,SAAO,GAAG,IAAI,qCAAqC;EAD/B;AAEpB,OAAK,OAAO;CACZ;AACD;;AAGD,IAAa,wBAAb,cAA2C,MAAM;CAChD,YACUA,KACAC,UACAC,QACR;AACD,SACE,cAAc,SAAS,iCAAiC,OAAO,UAAU,IAAI,IAC9E;EANQ;EACA;EACA;AAKT,OAAK,OAAO;CACZ;AACD;;AAGD,IAAa,kBAAb,cAAqC,MAAM;CAC1C,YAAqBF,KAAa;AACjC,QACC,OACI,GAAG,IAAI,mEACR,gDACH;EALmB;AAMpB,OAAK,OAAO;CACZ;AACD"}
@@ -1,115 +0,0 @@
1
- const require_chunk = require('./chunk-CsX-DzYB.cjs');
2
-
3
- //#region src/sqs/sqsUrl.ts
4
- var sqsUrl_exports = {};
5
- require_chunk.__export(sqsUrl_exports, {
6
- MalformedQueueUrl: () => MalformedQueueUrl,
7
- MissingQueueUrl: () => MissingQueueUrl,
8
- UnexpectedQueueScheme: () => UnexpectedQueueScheme,
9
- build: () => build,
10
- parse: () => parse
11
- });
12
- const SCHEME = "sqs:";
13
- /**
14
- * Compose an address into a connection string.
15
- *
16
- * Credentials never appear. The AWS SDK resolves them from its own chain — an
17
- * execution role deployed, environment locally — so the string stays safe to log
18
- * and identical across environments that differ only in who is calling.
19
- */
20
- function build(address) {
21
- const { queueUrl, region, endpoint, maxBatchSize } = address;
22
- if (!queueUrl) throw new MissingQueueUrl("");
23
- const url = new URL(`${SCHEME}//`);
24
- url.searchParams.set("queueUrl", queueUrl);
25
- if (region) url.searchParams.set("region", region);
26
- if (endpoint) url.searchParams.set("endpoint", endpoint);
27
- if (maxBatchSize !== void 0) url.searchParams.set("maxBatchSize", String(maxBatchSize));
28
- return url.toString();
29
- }
30
- /** Parse a connection string back into an address. */
31
- function parse(connectionString) {
32
- let parsed;
33
- try {
34
- parsed = new URL(connectionString);
35
- } catch {
36
- throw new MalformedQueueUrl(connectionString);
37
- }
38
- if (parsed.protocol !== SCHEME) throw new UnexpectedQueueScheme(connectionString, SCHEME, parsed.protocol);
39
- const queueUrl = parsed.searchParams.get("queueUrl");
40
- if (!queueUrl) throw new MissingQueueUrl(connectionString);
41
- const region = parsed.searchParams.get("region") ?? void 0;
42
- const endpoint = parsed.searchParams.get("endpoint") ?? void 0;
43
- const batch = parsed.searchParams.get("maxBatchSize");
44
- return {
45
- queueUrl,
46
- ...region ? { region } : {},
47
- ...endpoint ? { endpoint } : {},
48
- ...batch ? { maxBatchSize: Number(batch) } : {}
49
- };
50
- }
51
- /** The string is not a URL at all. */
52
- var MalformedQueueUrl = class extends Error {
53
- constructor(url) {
54
- super(`'${url}' is not a valid connection string.`);
55
- this.url = url;
56
- this.name = "MalformedQueueUrl";
57
- }
58
- };
59
- /** The string is a URL, but not an `sqs://` one. */
60
- var UnexpectedQueueScheme = class extends Error {
61
- constructor(url, expected, actual) {
62
- super(`Expected a '${expected}//' connection string and got '${actual}//' in '${url}'.`);
63
- this.url = url;
64
- this.expected = expected;
65
- this.actual = actual;
66
- this.name = "UnexpectedQueueScheme";
67
- }
68
- };
69
- /** An `sqs://` string with no queue names nothing. */
70
- var MissingQueueUrl = class extends Error {
71
- constructor(url) {
72
- super(url ? `'${url}' names no queue: an sqs:// connection string needs ?queueUrl=.` : "An sqs:// connection string needs a queueUrl.");
73
- this.url = url;
74
- this.name = "MissingQueueUrl";
75
- }
76
- };
77
-
78
- //#endregion
79
- Object.defineProperty(exports, 'MalformedQueueUrl', {
80
- enumerable: true,
81
- get: function () {
82
- return MalformedQueueUrl;
83
- }
84
- });
85
- Object.defineProperty(exports, 'MissingQueueUrl', {
86
- enumerable: true,
87
- get: function () {
88
- return MissingQueueUrl;
89
- }
90
- });
91
- Object.defineProperty(exports, 'UnexpectedQueueScheme', {
92
- enumerable: true,
93
- get: function () {
94
- return UnexpectedQueueScheme;
95
- }
96
- });
97
- Object.defineProperty(exports, 'build', {
98
- enumerable: true,
99
- get: function () {
100
- return build;
101
- }
102
- });
103
- Object.defineProperty(exports, 'parse', {
104
- enumerable: true,
105
- get: function () {
106
- return parse;
107
- }
108
- });
109
- Object.defineProperty(exports, 'sqsUrl_exports', {
110
- enumerable: true,
111
- get: function () {
112
- return sqsUrl_exports;
113
- }
114
- });
115
- //# sourceMappingURL=sqsUrl-CdisN3GU.cjs.map