@panorama-industries/effect-vercel-queue 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -2
  3. package/dist/contracts/message-handling.d.ts +128 -0
  4. package/dist/contracts/message-handling.d.ts.map +1 -0
  5. package/dist/contracts/message-handling.js +4 -0
  6. package/dist/contracts/message-handling.js.map +1 -0
  7. package/dist/contracts/queue-api.d.ts +255 -0
  8. package/dist/contracts/queue-api.d.ts.map +1 -0
  9. package/dist/contracts/queue-api.js +18 -0
  10. package/dist/contracts/queue-api.js.map +1 -0
  11. package/dist/contracts/queue-config.d.ts +87 -0
  12. package/dist/contracts/queue-config.d.ts.map +1 -0
  13. package/dist/contracts/queue-config.js +7 -0
  14. package/dist/contracts/queue-config.js.map +1 -0
  15. package/dist/contracts/queue-consumer.d.ts +30 -0
  16. package/dist/contracts/queue-consumer.d.ts.map +1 -0
  17. package/dist/contracts/queue-consumer.js +15 -0
  18. package/dist/contracts/queue-consumer.js.map +1 -0
  19. package/dist/contracts/queue-domain.d.ts +171 -0
  20. package/dist/contracts/queue-domain.d.ts.map +1 -0
  21. package/dist/contracts/queue-domain.js +137 -0
  22. package/dist/contracts/queue-domain.js.map +1 -0
  23. package/dist/contracts/queue-poller.d.ts +169 -0
  24. package/dist/contracts/queue-poller.d.ts.map +1 -0
  25. package/dist/contracts/queue-poller.js +10 -0
  26. package/dist/contracts/queue-poller.js.map +1 -0
  27. package/dist/contracts/queue-producer.d.ts +23 -0
  28. package/dist/contracts/queue-producer.d.ts.map +1 -0
  29. package/dist/contracts/queue-producer.js +5 -0
  30. package/dist/contracts/queue-producer.js.map +1 -0
  31. package/dist/contracts/topic.d.ts +47 -0
  32. package/dist/contracts/topic.d.ts.map +1 -0
  33. package/dist/contracts/topic.js +34 -0
  34. package/dist/contracts/topic.js.map +1 -0
  35. package/dist/implementation/queue-api-live.d.ts +16 -0
  36. package/dist/implementation/queue-api-live.d.ts.map +1 -0
  37. package/dist/implementation/queue-api-live.js +326 -0
  38. package/dist/implementation/queue-api-live.js.map +1 -0
  39. package/dist/implementation/queue-config-live.d.ts +37 -0
  40. package/dist/implementation/queue-config-live.d.ts.map +1 -0
  41. package/dist/implementation/queue-config-live.js +99 -0
  42. package/dist/implementation/queue-config-live.js.map +1 -0
  43. package/dist/implementation/queue-consumer-live.d.ts +14 -0
  44. package/dist/implementation/queue-consumer-live.d.ts.map +1 -0
  45. package/dist/implementation/queue-consumer-live.js +56 -0
  46. package/dist/implementation/queue-consumer-live.js.map +1 -0
  47. package/dist/implementation/queue-live.d.ts +15 -0
  48. package/dist/implementation/queue-live.d.ts.map +1 -0
  49. package/dist/implementation/queue-live.js +16 -0
  50. package/dist/implementation/queue-live.js.map +1 -0
  51. package/dist/implementation/queue-poller-live.d.ts +14 -0
  52. package/dist/implementation/queue-poller-live.d.ts.map +1 -0
  53. package/dist/implementation/queue-poller-live.js +66 -0
  54. package/dist/implementation/queue-poller-live.js.map +1 -0
  55. package/dist/implementation/queue-producer-live.d.ts +9 -0
  56. package/dist/implementation/queue-producer-live.d.ts.map +1 -0
  57. package/dist/implementation/queue-producer-live.js +54 -0
  58. package/dist/implementation/queue-producer-live.js.map +1 -0
  59. package/dist/index.d.ts +16 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.js +16 -0
  62. package/dist/index.js.map +1 -0
  63. package/dist/internal/cloud-event.d.ts +46 -0
  64. package/dist/internal/cloud-event.d.ts.map +1 -0
  65. package/dist/internal/cloud-event.js +140 -0
  66. package/dist/internal/cloud-event.js.map +1 -0
  67. package/dist/internal/lease.d.ts +23 -0
  68. package/dist/internal/lease.d.ts.map +1 -0
  69. package/dist/internal/lease.js +44 -0
  70. package/dist/internal/lease.js.map +1 -0
  71. package/dist/internal/multipart.d.ts +23 -0
  72. package/dist/internal/multipart.d.ts.map +1 -0
  73. package/dist/internal/multipart.js +205 -0
  74. package/dist/internal/multipart.js.map +1 -0
  75. package/dist/internal/process.d.ts +25 -0
  76. package/dist/internal/process.d.ts.map +1 -0
  77. package/dist/internal/process.js +95 -0
  78. package/dist/internal/process.js.map +1 -0
  79. package/dist/internal/queue-protocol.d.ts +38 -0
  80. package/dist/internal/queue-protocol.d.ts.map +1 -0
  81. package/dist/internal/queue-protocol.js +119 -0
  82. package/dist/internal/queue-protocol.js.map +1 -0
  83. package/dist/internal/version.d.ts +4 -0
  84. package/dist/internal/version.d.ts.map +1 -0
  85. package/dist/internal/version.js +4 -0
  86. package/dist/internal/version.js.map +1 -0
  87. package/dist/retry-policy.d.ts +26 -0
  88. package/dist/retry-policy.d.ts.map +1 -0
  89. package/dist/retry-policy.js +34 -0
  90. package/dist/retry-policy.js.map +1 -0
  91. package/dist/testing/index.d.ts +2 -0
  92. package/dist/testing/index.d.ts.map +1 -0
  93. package/dist/testing/index.js +2 -0
  94. package/dist/testing/index.js.map +1 -0
  95. package/dist/testing/test-queue.d.ts +74 -0
  96. package/dist/testing/test-queue.d.ts.map +1 -0
  97. package/dist/testing/test-queue.js +253 -0
  98. package/dist/testing/test-queue.js.map +1 -0
  99. package/package.json +59 -3
  100. package/src/contracts/message-handling.ts +68 -0
  101. package/src/contracts/queue-api.ts +199 -0
  102. package/src/contracts/queue-config.ts +47 -0
  103. package/src/contracts/queue-consumer.ts +40 -0
  104. package/src/contracts/queue-domain.ts +202 -0
  105. package/src/contracts/queue-poller.ts +76 -0
  106. package/src/contracts/queue-producer.ts +40 -0
  107. package/src/contracts/topic.ts +76 -0
  108. package/src/implementation/queue-api-live.ts +637 -0
  109. package/src/implementation/queue-config-live.ts +178 -0
  110. package/src/implementation/queue-consumer-live.ts +112 -0
  111. package/src/implementation/queue-live.ts +32 -0
  112. package/src/implementation/queue-poller-live.ts +130 -0
  113. package/src/implementation/queue-producer-live.ts +89 -0
  114. package/src/index.ts +19 -0
  115. package/src/internal/cloud-event.ts +244 -0
  116. package/src/internal/lease.ts +84 -0
  117. package/src/internal/multipart.ts +240 -0
  118. package/src/internal/process.ts +194 -0
  119. package/src/internal/queue-protocol.ts +169 -0
  120. package/src/internal/version.ts +5 -0
  121. package/src/retry-policy.ts +48 -0
  122. package/src/testing/index.ts +1 -0
  123. package/src/testing/test-queue.ts +469 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Panorama Industries
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,14 @@
1
- # Temporary Holding Version
1
+ # @panorama-industries/effect-vercel-queue
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Effect-native client for [Vercel Queues](https://vercel.com/docs/queues): typed topics, producers,
4
+ push and poll consumers. Part of [effect-vercel](https://github.com/panorama-industries/effect-vercel).
5
+
6
+ ```bash
7
+ pnpm add @panorama-industries/effect-vercel-queue effect
8
+ ```
9
+
10
+ ## Requirements
11
+
12
+ - `effect` `^4.0.6` (peer dependency)
13
+ - Vercel CLI `59.26.0` or above
14
+ - ESM only
@@ -0,0 +1,128 @@
1
+ import type { Duration, Effect } from "effect";
2
+ import { Data } from "effect";
3
+ import type { ConcurrencyCoalescedPending, MessageMetadata, PayloadDecodeFailed } from "./queue-domain.ts";
4
+ /** What to do with a message whose handler failed. */
5
+ export type RetryDirective = Data.TaggedEnum<{
6
+ /** Acknowledge the message so it is never delivered again. */
7
+ Acknowledge: {};
8
+ /** Release the lease and redeliver the message after `delay`. */
9
+ RetryAfter: {
10
+ readonly delay: Duration.Duration;
11
+ };
12
+ /**
13
+ * **Experimental.** End the lease now and redeliver immediately. A handoff counts toward neither
14
+ * the queue's retry backoff nor its maximum attempts; past the queue's bound it is an ordinary
15
+ * retry.
16
+ */
17
+ ExperimentalHandoff: {};
18
+ /**
19
+ * Leave the message to the queue's own redelivery. Push consumers answer HTTP 500; pollers return
20
+ * the handler's error and let the lease expire.
21
+ */
22
+ Fail: {};
23
+ }>;
24
+ /** Constructors and matchers for {@link RetryDirective}. */
25
+ export declare const RetryDirective: {
26
+ readonly $is: <Tag extends "Acknowledge" | "ExperimentalHandoff" | "Fail" | "RetryAfter">(tag: Tag) => (u: unknown) => u is Extract<{
27
+ readonly _tag: "Acknowledge";
28
+ }, {
29
+ readonly _tag: Tag;
30
+ }> | Extract<{
31
+ readonly _tag: "ExperimentalHandoff";
32
+ }, {
33
+ readonly _tag: Tag;
34
+ }> | Extract<{
35
+ readonly _tag: "Fail";
36
+ }, {
37
+ readonly _tag: Tag;
38
+ }> | Extract<{
39
+ readonly _tag: "RetryAfter";
40
+ readonly delay: Duration.Duration;
41
+ }, {
42
+ readonly _tag: Tag;
43
+ }>;
44
+ readonly $match: {
45
+ <Cases extends { readonly [Tag in "Acknowledge" | "ExperimentalHandoff" | "Fail" | "RetryAfter"]: (args: Extract<{
46
+ readonly _tag: "Acknowledge";
47
+ } | {
48
+ readonly _tag: "ExperimentalHandoff";
49
+ } | {
50
+ readonly _tag: "Fail";
51
+ } | {
52
+ readonly _tag: "RetryAfter";
53
+ readonly delay: Duration.Duration;
54
+ }, {
55
+ readonly _tag: Tag;
56
+ }>) => any; }>(cases: Cases): (value: {
57
+ readonly _tag: "Acknowledge";
58
+ } | {
59
+ readonly _tag: "ExperimentalHandoff";
60
+ } | {
61
+ readonly _tag: "Fail";
62
+ } | {
63
+ readonly _tag: "RetryAfter";
64
+ readonly delay: Duration.Duration;
65
+ }) => import("effect/Unify").Unify<ReturnType<Cases["Acknowledge" | "ExperimentalHandoff" | "Fail" | "RetryAfter"]>>;
66
+ <Cases extends { readonly [Tag in "Acknowledge" | "ExperimentalHandoff" | "Fail" | "RetryAfter"]: (args: Extract<{
67
+ readonly _tag: "Acknowledge";
68
+ } | {
69
+ readonly _tag: "ExperimentalHandoff";
70
+ } | {
71
+ readonly _tag: "Fail";
72
+ } | {
73
+ readonly _tag: "RetryAfter";
74
+ readonly delay: Duration.Duration;
75
+ }, {
76
+ readonly _tag: Tag;
77
+ }>) => any; }>(value: {
78
+ readonly _tag: "Acknowledge";
79
+ } | {
80
+ readonly _tag: "ExperimentalHandoff";
81
+ } | {
82
+ readonly _tag: "Fail";
83
+ } | {
84
+ readonly _tag: "RetryAfter";
85
+ readonly delay: Duration.Duration;
86
+ }, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Acknowledge" | "ExperimentalHandoff" | "Fail" | "RetryAfter"]>>;
87
+ };
88
+ readonly Acknowledge: Data.TaggedEnum.ConstructorFrom<{
89
+ readonly _tag: "Acknowledge";
90
+ }, "_tag">;
91
+ readonly ExperimentalHandoff: Data.TaggedEnum.ConstructorFrom<{
92
+ readonly _tag: "ExperimentalHandoff";
93
+ }, "_tag">;
94
+ readonly Fail: Data.TaggedEnum.ConstructorFrom<{
95
+ readonly _tag: "Fail";
96
+ }, "_tag">;
97
+ readonly RetryAfter: Data.TaggedEnum.ConstructorFrom<{
98
+ readonly _tag: "RetryAfter";
99
+ readonly delay: Duration.Duration;
100
+ }, "_tag">;
101
+ };
102
+ /**
103
+ * Processes one delivered payload. Succeeding acknowledges the message; failing hands the error to
104
+ * {@link ConsumeOptions.onError}.
105
+ */
106
+ export type MessageHandler<A, E, R> = (payload: A, metadata: MessageMetadata) => Effect.Effect<void, E, R>;
107
+ /** Failures a consumer's error policy can receive besides the handler's own errors. */
108
+ export type ConsumeFailure = PayloadDecodeFailed | ConcurrencyCoalescedPending;
109
+ /** How a consumer holds leases and reacts to failures. */
110
+ export interface ConsumeOptions<E, R = never> {
111
+ /**
112
+ * How long a lease lasts before it must be renewed. The consumer renews it in the background
113
+ * while the handler runs. Default: 5 minutes.
114
+ */
115
+ readonly visibilityTimeout?: Duration.Input;
116
+ /**
117
+ * Choose a {@link RetryDirective} for a failed handler, an undecodable payload, or an
118
+ * acknowledgment refused after the coalesced reruns are used up. Default: `Fail`. Defects always
119
+ * mean `Fail`.
120
+ */
121
+ readonly onError?: (error: E | ConsumeFailure, metadata: MessageMetadata) => Effect.Effect<RetryDirective, never, R>;
122
+ /**
123
+ * **Experimental.** Rerun the handler, with the lease still held, up to this many times when its
124
+ * acknowledgment is refused because messages were coalesced into the delivery. Default: 0.
125
+ */
126
+ readonly experimentalMaxCoalescedReruns?: number;
127
+ }
128
+ //# sourceMappingURL=message-handling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-handling.d.ts","sourceRoot":"","sources":["../../src/contracts/message-handling.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,KAAK,EACV,2BAA2B,EAC3B,eAAe,EACf,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAE3B,sDAAsD;AACtD,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC;IAC3C,8DAA8D;IAC9D,WAAW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etryDirective}. */
3
+ export const RetryDirective = Data.taggedEnum();
4
+ //# sourceMappingURL=message-handling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-handling.js","sourceRoot":"","sources":["../../src/contracts/message-handling.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AA2B9B,4DAA4D;AAC5D,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,UAAU,EAAkB,CAAC"}
@@ -0,0 +1,255 @@
1
+ import type { VercelApiError, VercelRegion } from "@panorama-industries/effect-vercel-core";
2
+ import type { Array, Duration, Effect, Option } from "effect";
3
+ import { Context, Data, Schema } from "effect";
4
+ import type { BatchSizeOutOfRange, ConcurrencyKey, ConsumerDiscoveryFailed, ConsumerGroupName, ConsumerRegistryNotConfigured, CursorFallback, IdempotencyKey, MessageAlreadyProcessed, MessageCorrupted, MessageHandle, MessageId, MessageNotAvailable, MessageNotFound, ReceivedMessage, TopicName } from "./queue-domain.ts";
5
+ /** Maximum number of messages one receive call may lease: an integer from 1 to 10. */
6
+ export declare const ReceiveLimit: Schema.brand<Schema.Int, "ReceiveLimit">;
7
+ /** Maximum number of messages one receive call may lease: an integer from 1 to 10. */
8
+ export type ReceiveLimit = typeof ReceiveLimit.Type;
9
+ /** Options for publishing one message, shared by single and batch sends. */
10
+ export interface PublishOptions {
11
+ /** Drops a later publish carrying the same key while the first is retained. */
12
+ readonly idempotencyKey?: IdempotencyKey;
13
+ /** How long the message is kept: 1 minute to 7 days, default 24 hours. */
14
+ readonly retention?: Duration.Input;
15
+ /** Delay before the message becomes visible: up to 7 days and never beyond its retention. */
16
+ readonly delay?: Duration.Input;
17
+ /** Custom headers stored with the message. */
18
+ readonly headers?: Readonly<Record<string, string>>;
19
+ /** **Experimental.** See {@link ConcurrencyKey}. */
20
+ readonly experimentalConcurrencyKey?: ConcurrencyKey;
21
+ }
22
+ /** A serialized message ready to publish. */
23
+ export interface OutgoingMessage extends PublishOptions {
24
+ readonly body: Uint8Array;
25
+ readonly contentType: string;
26
+ }
27
+ /** Outcome of publishing one message. */
28
+ export type SendResult = Data.TaggedEnum<{
29
+ /** The queue accepted the message and assigned it an identifier. */
30
+ Sent: {
31
+ readonly messageId: MessageId;
32
+ };
33
+ /** The queue accepted the message for deferred processing; it has no identifier yet. */
34
+ Deferred: {};
35
+ }>;
36
+ /** Constructors and matchers for {@link SendResult}. */
37
+ export declare const SendResult: {
38
+ readonly $is: <Tag extends "Deferred" | "Sent">(tag: Tag) => (u: unknown) => u is Extract<{
39
+ readonly _tag: "Deferred";
40
+ }, {
41
+ readonly _tag: Tag;
42
+ }> | Extract<{
43
+ readonly _tag: "Sent";
44
+ readonly messageId: MessageId;
45
+ }, {
46
+ readonly _tag: Tag;
47
+ }>;
48
+ readonly $match: {
49
+ <Cases extends { readonly [Tag in "Deferred" | "Sent"]: (args: Extract<{
50
+ readonly _tag: "Deferred";
51
+ } | {
52
+ readonly _tag: "Sent";
53
+ readonly messageId: MessageId;
54
+ }, {
55
+ readonly _tag: Tag;
56
+ }>) => any; }>(cases: Cases): (value: {
57
+ readonly _tag: "Deferred";
58
+ } | {
59
+ readonly _tag: "Sent";
60
+ readonly messageId: MessageId;
61
+ }) => import("effect/Unify").Unify<ReturnType<Cases["Deferred" | "Sent"]>>;
62
+ <Cases extends { readonly [Tag in "Deferred" | "Sent"]: (args: Extract<{
63
+ readonly _tag: "Deferred";
64
+ } | {
65
+ readonly _tag: "Sent";
66
+ readonly messageId: MessageId;
67
+ }, {
68
+ readonly _tag: Tag;
69
+ }>) => any; }>(value: {
70
+ readonly _tag: "Deferred";
71
+ } | {
72
+ readonly _tag: "Sent";
73
+ readonly messageId: MessageId;
74
+ }, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Deferred" | "Sent"]>>;
75
+ };
76
+ readonly Deferred: Data.TaggedEnum.ConstructorFrom<{
77
+ readonly _tag: "Deferred";
78
+ }, "_tag">;
79
+ readonly Sent: Data.TaggedEnum.ConstructorFrom<{
80
+ readonly _tag: "Sent";
81
+ readonly messageId: MessageId;
82
+ }, "_tag">;
83
+ };
84
+ /**
85
+ * Outcome for one entry of a batch send, in input order.
86
+ *
87
+ * A request-level failure returns no per-entry results and may happen after the queue accepted
88
+ * some entries; set an idempotency key on every entry from the first attempt to make retries safe.
89
+ */
90
+ export type BatchSendResult = Data.TaggedEnum<{
91
+ Sent: {
92
+ readonly messageId: MessageId;
93
+ };
94
+ Deferred: {};
95
+ /** The queue rejected this entry; the others may still have been accepted. */
96
+ Failed: {
97
+ readonly status: number;
98
+ readonly message: string;
99
+ /** Whether publishing this entry again may succeed. */
100
+ readonly retryable: boolean;
101
+ };
102
+ }>;
103
+ /** Constructors and matchers for {@link BatchSendResult}. */
104
+ export declare const BatchSendResult: {
105
+ readonly $is: <Tag extends "Deferred" | "Failed" | "Sent">(tag: Tag) => (u: unknown) => u is Extract<{
106
+ readonly _tag: "Deferred";
107
+ }, {
108
+ readonly _tag: Tag;
109
+ }> | Extract<{
110
+ readonly _tag: "Failed";
111
+ readonly status: number;
112
+ readonly message: string;
113
+ readonly retryable: boolean;
114
+ }, {
115
+ readonly _tag: Tag;
116
+ }> | Extract<{
117
+ readonly _tag: "Sent";
118
+ readonly messageId: MessageId;
119
+ }, {
120
+ readonly _tag: Tag;
121
+ }>;
122
+ readonly $match: {
123
+ <Cases extends { readonly [Tag in "Deferred" | "Failed" | "Sent"]: (args: Extract<{
124
+ readonly _tag: "Deferred";
125
+ } | {
126
+ readonly _tag: "Failed";
127
+ readonly status: number;
128
+ readonly message: string;
129
+ readonly retryable: boolean;
130
+ } | {
131
+ readonly _tag: "Sent";
132
+ readonly messageId: MessageId;
133
+ }, {
134
+ readonly _tag: Tag;
135
+ }>) => any; }>(cases: Cases): (value: {
136
+ readonly _tag: "Deferred";
137
+ } | {
138
+ readonly _tag: "Failed";
139
+ readonly status: number;
140
+ readonly message: string;
141
+ readonly retryable: boolean;
142
+ } | {
143
+ readonly _tag: "Sent";
144
+ readonly messageId: MessageId;
145
+ }) => import("effect/Unify").Unify<ReturnType<Cases["Deferred" | "Failed" | "Sent"]>>;
146
+ <Cases extends { readonly [Tag in "Deferred" | "Failed" | "Sent"]: (args: Extract<{
147
+ readonly _tag: "Deferred";
148
+ } | {
149
+ readonly _tag: "Failed";
150
+ readonly status: number;
151
+ readonly message: string;
152
+ readonly retryable: boolean;
153
+ } | {
154
+ readonly _tag: "Sent";
155
+ readonly messageId: MessageId;
156
+ }, {
157
+ readonly _tag: Tag;
158
+ }>) => any; }>(value: {
159
+ readonly _tag: "Deferred";
160
+ } | {
161
+ readonly _tag: "Failed";
162
+ readonly status: number;
163
+ readonly message: string;
164
+ readonly retryable: boolean;
165
+ } | {
166
+ readonly _tag: "Sent";
167
+ readonly messageId: MessageId;
168
+ }, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Deferred" | "Failed" | "Sent"]>>;
169
+ };
170
+ readonly Deferred: Data.TaggedEnum.ConstructorFrom<{
171
+ readonly _tag: "Deferred";
172
+ }, "_tag">;
173
+ readonly Failed: Data.TaggedEnum.ConstructorFrom<{
174
+ readonly _tag: "Failed";
175
+ readonly status: number;
176
+ readonly message: string;
177
+ readonly retryable: boolean;
178
+ }, "_tag">;
179
+ readonly Sent: Data.TaggedEnum.ConstructorFrom<{
180
+ readonly _tag: "Sent";
181
+ readonly messageId: MessageId;
182
+ }, "_tag">;
183
+ };
184
+ /** Result of extending a lease with an experimental handoff request. */
185
+ export declare const HandoffOutcome: Schema.Literals<readonly ["accepted", "not_immediate", "limit_reached"]>;
186
+ /** Result of extending a lease with an experimental handoff request. */
187
+ export type HandoffOutcome = typeof HandoffOutcome.Type;
188
+ /** Options for leasing messages from a consumer group. */
189
+ export interface ReceiveOptions {
190
+ /** Maximum messages to lease; the queue's default is 1. */
191
+ readonly limit?: ReceiveLimit;
192
+ /** How long leased messages stay invisible to other consumers. */
193
+ readonly visibilityTimeout?: Duration.Input;
194
+ /** Where a consumer group with no stored position starts reading. */
195
+ readonly cursorFallback?: CursorFallback;
196
+ /** Region to receive from; defaults to `QueueConfig.region`. */
197
+ readonly region?: VercelRegion;
198
+ }
199
+ /** Options for leasing one message by identifier. */
200
+ export interface ReceiveByIdOptions {
201
+ readonly visibilityTimeout?: Duration.Input;
202
+ /** Region that holds the message; defaults to `QueueConfig.region`. */
203
+ readonly region?: VercelRegion;
204
+ }
205
+ /** Failures every queue call can report. */
206
+ export type QueueRequestError = VercelApiError | ConsumerRegistryNotConfigured;
207
+ /** Failures of publishing. */
208
+ export type QueueSendError = QueueRequestError | ConsumerDiscoveryFailed;
209
+ /** Failures of publishing a batch. */
210
+ export type QueueSendBatchError = QueueSendError | BatchSizeOutOfRange;
211
+ /** Failures of leasing a specific message. */
212
+ export type QueueReceiveByIdError = QueueRequestError | MessageNotFound | MessageNotAvailable | MessageAlreadyProcessed | MessageCorrupted;
213
+ /** Failures of settling a lease: acknowledging it or changing its visibility. */
214
+ export type QueueLeaseError = QueueRequestError | MessageNotFound | MessageNotAvailable;
215
+ declare const QueueApi_base: Context.ServiceClass<QueueApi, "@effect-vercel/queue/QueueApi", {
216
+ /** Publish one message (`POST /api/v3/topic/{topic}`). */
217
+ readonly send: (topic: TopicName, message: OutgoingMessage) => Effect.Effect<SendResult, QueueSendError>;
218
+ /** Publish 1 to 100 messages in one request (`POST /api/v3/topic/{topic}/batch`). */
219
+ readonly sendBatch: (topic: TopicName, messages: Array.NonEmptyReadonlyArray<OutgoingMessage>) => Effect.Effect<ReadonlyArray<BatchSendResult>, QueueSendBatchError>;
220
+ /**
221
+ * Lease the next available messages of a consumer group. An empty array means the queue had
222
+ * nothing to deliver.
223
+ */
224
+ readonly receive: (topic: TopicName, consumerGroup: ConsumerGroupName, options?: ReceiveOptions) => Effect.Effect<ReadonlyArray<ReceivedMessage>, QueueRequestError | MessageCorrupted>;
225
+ /** Lease one message by identifier, as push delivery does for messages sent without a body. */
226
+ readonly receiveById: (topic: TopicName, consumerGroup: ConsumerGroupName, messageId: MessageId, options?: ReceiveByIdOptions) => Effect.Effect<ReceivedMessage, QueueReceiveByIdError>;
227
+ /**
228
+ * Acknowledge a leased message so the consumer group never receives it again.
229
+ *
230
+ * `experimentalIfCoalesced` acknowledges only if no more than that many messages have been
231
+ * coalesced into the delivery; otherwise it fails with `ConcurrencyCoalescedPending`.
232
+ */
233
+ readonly acknowledge: (handle: MessageHandle, options?: {
234
+ readonly experimentalIfCoalesced?: number;
235
+ }) => Effect.Effect<void, QueueLeaseError>;
236
+ /**
237
+ * Set how long a leased message stays invisible, counted from now. A zero timeout releases the
238
+ * lease for immediate redelivery.
239
+ *
240
+ * @returns The handoff outcome when `experimentalHandoff` was requested, otherwise none.
241
+ */
242
+ readonly changeVisibility: (handle: MessageHandle, visibilityTimeout: Duration.Input, options?: {
243
+ readonly experimentalHandoff?: boolean;
244
+ }) => Effect.Effect<Option.Option<HandoffOutcome>, QueueLeaseError>;
245
+ }>;
246
+ /**
247
+ * The Vercel Queues HTTP API, one operation per endpoint, with bodies as bytes.
248
+ *
249
+ * Most code uses `QueueProducer`, `QueueConsumer` or `QueuePoller`, which add typed topics, leases
250
+ * and tracing on top of this service.
251
+ */
252
+ export declare class QueueApi extends QueueApi_base {
253
+ }
254
+ export {};
255
+ //# sourceMappingURL=queue-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-api.d.ts","sourceRoot":"","sources":["../../src/contracts/queue-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE/C,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,uBAAuB,EACvB,iBAAiB,EACjB,6BAA6B,EAC7B,cAAc,EACd,c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;;;;OAKG;0BACmB,CACpB,MAAM,EAAE,aAAa,EACrB,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAA;KAAE,KACpD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CAAC;IAEzC;;;;;OAKG;+BACwB,CACzB,MAAM,EAAE,aAAa,EACrB,iBAAiB,EAAE,QAAQ,CAAC,KAAK,EACjC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;KAAE,KACjD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,eAAe,CAAC;;AA5DtE;;;;;GAKG;AACH,qBAAa,QAAS,SAAQ,aAwDM;CAAG"}
@@ -0,0 +1,18 @@
1
+ import { Context, Data, Schema } from "effect";
2
+ /** Maximum number of messages one receive call may lease: an integer from 1 to 10. */
3
+ export const ReceiveLimit = Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 10 })).pipe(Schema.brand("ReceiveLimit"));
4
+ /** Constructors and matchers for {@link SendResult}. */
5
+ export const SendResult = Data.taggedEnum();
6
+ /** Constructors and matchers for {@link BatchSendResult}. */
7
+ export const BatchSendResult = Data.taggedEnum();
8
+ /** Result of extending a lease with an experimental handoff request. */
9
+ export const HandoffOutcome = Schema.Literals(["accepted", "not_immediate", "limit_reached"]);
10
+ /**
11
+ * The Vercel Queues HTTP API, one operation per endpoint, with bodies as bytes.
12
+ *
13
+ * Most code uses `QueueProducer`, `QueueConsumer` or `QueuePoller`, which add typed topics, leases
14
+ * and tracing on top of this service.
15
+ */
16
+ export class QueueApi extends Context.Service()("@effect-vercel/queue/QueueApi") {
17
+ }
18
+ //# sourceMappingURL=queue-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-api.js","sourceRoot":"","sources":["../../src/contracts/queue-api.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAoB/C,sFAAsF;AACtF,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAC9F,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAC7B,CAAC;AAqCF,wDAAwD;AACxD,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAc,CAAC;AAoBxD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,EAAmB,CAAC;AAElE,wEAAwE;AACxE,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,UAAU,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC;AAgD9F;;;;;GAKG;AACH,MAAM,OAAO,QAAS,SAAQ,OAAO,CAAC,OAAO,EAwD1C,CAAC,+BAA+B,CAAC;CAAG"}
@@ -0,0 +1,87 @@
1
+ import type { DeploymentId, VercelRegion } from "@panorama-industries/effect-vercel-core";
2
+ import type { Option, Redacted } from "effect";
3
+ import { Context, Data } from "effect";
4
+ /** How the client authenticates to the queue service. */
5
+ export type QueueAuth = Data.TaggedEnum<{
6
+ /** Use the Vercel OIDC token of the current request (production and `vercel env pull`). */
7
+ Oidc: {};
8
+ /** Use a fixed bearer token, such as the local broker's `VERCEL_QUEUE_TOKEN`. */
9
+ Token: {
10
+ readonly token: Redacted.Redacted<string>;
11
+ };
12
+ }>;
13
+ /** Constructors and matchers for {@link QueueAuth}. */
14
+ export declare const QueueAuth: {
15
+ readonly $is: <Tag extends "Oidc" | "Token">(tag: Tag) => (u: unknown) => u is Extract<{
16
+ readonly _tag: "Oidc";
17
+ }, {
18
+ readonly _tag: Tag;
19
+ }> | Extract<{
20
+ readonly _tag: "Token";
21
+ readonly token: Redacted.Redacted<string>;
22
+ }, {
23
+ readonly _tag: Tag;
24
+ }>;
25
+ readonly $match: {
26
+ <Cases extends { readonly [Tag in "Oidc" | "Token"]: (args: Extract<{
27
+ readonly _tag: "Oidc";
28
+ } | {
29
+ readonly _tag: "Token";
30
+ readonly token: Redacted.Redacted<string>;
31
+ }, {
32
+ readonly _tag: Tag;
33
+ }>) => any; }>(cases: Cases): (value: {
34
+ readonly _tag: "Oidc";
35
+ } | {
36
+ readonly _tag: "Token";
37
+ readonly token: Redacted.Redacted<string>;
38
+ }) => import("effect/Unify").Unify<ReturnType<Cases["Oidc" | "Token"]>>;
39
+ <Cases extends { readonly [Tag in "Oidc" | "Token"]: (args: Extract<{
40
+ readonly _tag: "Oidc";
41
+ } | {
42
+ readonly _tag: "Token";
43
+ readonly token: Redacted.Redacted<string>;
44
+ }, {
45
+ readonly _tag: Tag;
46
+ }>) => any; }>(value: {
47
+ readonly _tag: "Oidc";
48
+ } | {
49
+ readonly _tag: "Token";
50
+ readonly token: Redacted.Redacted<string>;
51
+ }, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Oidc" | "Token"]>>;
52
+ };
53
+ readonly Oidc: Data.TaggedEnum.ConstructorFrom<{
54
+ readonly _tag: "Oidc";
55
+ }, "_tag">;
56
+ readonly Token: Data.TaggedEnum.ConstructorFrom<{
57
+ readonly _tag: "Token";
58
+ readonly token: Redacted.Redacted<string>;
59
+ }, "_tag">;
60
+ };
61
+ declare const QueueConfig_base: Context.ServiceClass<QueueConfig, "@effect-vercel/queue/QueueConfig", {
62
+ /** Region for sends and receives that do not name one. */
63
+ readonly region: VercelRegion;
64
+ /**
65
+ * Base URL of the queue service in a region; the client appends `/api/v3/...`. The default is
66
+ * `https://{region}.vercel-queue.com`; the local broker ignores the region.
67
+ */
68
+ readonly baseUrl: (region: VercelRegion) => URL;
69
+ readonly auth: QueueAuth;
70
+ /**
71
+ * Deployment sent with consumer calls (receive, acknowledge, change visibility) so the queue
72
+ * routes them to this deployment's consumer registration. None for the local broker.
73
+ */
74
+ readonly deploymentId: Option.Option<DeploymentId>;
75
+ /**
76
+ * Whether sends are pinned to {@link deploymentId}, so only this deployment's consumers receive
77
+ * them. Pinning is the default on Vercel; turning it off lets newer deployments consume.
78
+ */
79
+ readonly pinSends: boolean;
80
+ /** Extra headers sent with every request. */
81
+ readonly headers: Readonly<Record<string, string>>;
82
+ }>;
83
+ /** Where and as whom the queue client talks to Vercel Queues. */
84
+ export declare class QueueConfig extends QueueConfig_base {
85
+ }
86
+ export {};
87
+ //# sourceMappingURL=queue-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-config.d.ts","sourceRoot":"","sources":["../../src/contracts/queue-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAC1F,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEvC,yDAAyD;AACzD,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;IACtC,2FAA2F;IAC3F,IAAI,EAAE,EAAE,CAAC;IACT,iFAAiF;IACjF,KAAK,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC;CACtD,CAAC,CAAC;AAEH,uDAAuD;AACvD,eAAO,MAAM,SAAS;;;;;;;wBAJK,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;;;;;;;;;4BAAzB,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;;;;;;;;;;;;;4BAAzB,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;wBAAzB,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;;CAIC,CAAC;;IAMlD,0DAA0D;qBACzC,YAAY;IAE7B;;;OAGG;sBACe,CAAC,MAAM,EAAE,YAAY,KAAK,GAAG;mBAEhC,SAAS;IAExB;;;OAGG;2BACoB,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;IAElD;;;OAGG;uBACgB,OAAO;IAE1B,6CAA6C;sBAC3B,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;AA5BtD,iEAAiE;AACjE,qBAAa,WAAY,SAAQ,gBA6BM;CAAG"}
@@ -0,0 +1,7 @@
1
+ import { Context, Data } from "effect";
2
+ /** Constructors and matchers for {@link QueueAuth}. */
3
+ export const QueueAuth = Data.taggedEnum();
4
+ /** Where and as whom the queue client talks to Vercel Queues. */
5
+ export class QueueConfig extends Context.Service()("@effect-vercel/queue/QueueConfig") {
6
+ }
7
+ //# sourceMappingURL=queue-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-config.js","sourceRoot":"","sources":["../../src/contracts/queue-config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAUvC,uDAAuD;AACvD,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,EAAa,CAAC;AAEtD,iEAAiE;AACjE,MAAM,OAAO,WAAY,SAAQ,OAAO,CAAC,OAAO,EA6B7C,CAAC,kCAAkC,CAAC;CAAG"}
@@ -0,0 +1,30 @@
1
+ import type { Effect } from "effect";
2
+ import type { HttpServerRequest, HttpServerResponse } from "effect/http";
3
+ import { Context } from "effect";
4
+ import type { ConsumeOptions, MessageHandler } from "./message-handling.ts";
5
+ import type { Topic } from "./topic.ts";
6
+ declare const QueueConsumer_base: Context.ServiceClass<QueueConsumer, "@effect-vercel/queue/QueueConsumer", {
7
+ /**
8
+ * Build the HTTP handler for a push-delivered topic.
9
+ *
10
+ * Accepts structured (`com.vercel.queue.v1beta`) and binary (`com.vercel.queue.v2beta`)
11
+ * CloudEvents. Responds 200 when the message was processed or was already settled elsewhere,
12
+ * 400 for a malformed CloudEvent, and 500 to request redelivery.
13
+ */
14
+ readonly handler: <A, I, E, R, R2 = never>(topic: Topic<A, I>, handle: MessageHandler<A, E, R>, options?: ConsumeOptions<E, R2>) => Effect.Effect<HttpServerResponse.HttpServerResponse, never, HttpServerRequest.HttpServerRequest | R | R2>;
15
+ }>;
16
+ /**
17
+ * Handles push deliveries: Vercel Queues calls a function route with a CloudEvent, and the route
18
+ * leases, processes and settles the message.
19
+ *
20
+ * ```ts
21
+ * export const POST = HttpEffect.toWebHandlerLayer(
22
+ * QueueConsumer.use((consumer) => consumer.handler(Orders, fulfil)),
23
+ * AppLayer,
24
+ * ).handler;
25
+ * ```
26
+ */
27
+ export declare class QueueConsumer extends QueueConsumer_base {
28
+ }
29
+ export {};
30
+ //# sourceMappingURL=queue-consumer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-consumer.d.ts","sourceRoot":"","sources":["../../src/contracts/queue-consumer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEzE,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;;IAgBpC;;;;;;OAMG;sBACe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,KAAK,EACvC,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAClB,MAAM,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC/B,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,EAAE,CAAC,KAC5B,MAAM,CAAC,MAAM,CAChB,kBAAkB,CAAC,kBAAkB,EACrC,KAAK,EACL,iBAAiB,CAAC,iBAAiB,GAAG,CAAC,GAAG,EAAE,CAC7C;;AA7BL;;;;;;;;;;GAUG;AACH,qBAAa,aAAc,SAAQ,kBAoBM;CAAG"}
@@ -0,0 +1,15 @@
1
+ import { Context } from "effect";
2
+ /**
3
+ * Handles push deliveries: Vercel Queues calls a function route with a CloudEvent, and the route
4
+ * leases, processes and settles the message.
5
+ *
6
+ * ```ts
7
+ * export const POST = HttpEffect.toWebHandlerLayer(
8
+ * QueueConsumer.use((consumer) => consumer.handler(Orders, fulfil)),
9
+ * AppLayer,
10
+ * ).handler;
11
+ * ```
12
+ */
13
+ export class QueueConsumer extends Context.Service()("@effect-vercel/queue/QueueConsumer") {
14
+ }
15
+ //# sourceMappingURL=queue-consumer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-consumer.js","sourceRoot":"","sources":["../../src/contracts/queue-consumer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAKjC;;;;;;;;;;GAUG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAO,CAAC,OAAO,EAoB/C,CAAC,oCAAoC,CAAC;CAAG"}