@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.
- package/LICENSE +21 -0
- package/README.md +13 -2
- package/dist/contracts/message-handling.d.ts +128 -0
- package/dist/contracts/message-handling.d.ts.map +1 -0
- package/dist/contracts/message-handling.js +4 -0
- package/dist/contracts/message-handling.js.map +1 -0
- package/dist/contracts/queue-api.d.ts +255 -0
- package/dist/contracts/queue-api.d.ts.map +1 -0
- package/dist/contracts/queue-api.js +18 -0
- package/dist/contracts/queue-api.js.map +1 -0
- package/dist/contracts/queue-config.d.ts +87 -0
- package/dist/contracts/queue-config.d.ts.map +1 -0
- package/dist/contracts/queue-config.js +7 -0
- package/dist/contracts/queue-config.js.map +1 -0
- package/dist/contracts/queue-consumer.d.ts +30 -0
- package/dist/contracts/queue-consumer.d.ts.map +1 -0
- package/dist/contracts/queue-consumer.js +15 -0
- package/dist/contracts/queue-consumer.js.map +1 -0
- package/dist/contracts/queue-domain.d.ts +171 -0
- package/dist/contracts/queue-domain.d.ts.map +1 -0
- package/dist/contracts/queue-domain.js +137 -0
- package/dist/contracts/queue-domain.js.map +1 -0
- package/dist/contracts/queue-poller.d.ts +169 -0
- package/dist/contracts/queue-poller.d.ts.map +1 -0
- package/dist/contracts/queue-poller.js +10 -0
- package/dist/contracts/queue-poller.js.map +1 -0
- package/dist/contracts/queue-producer.d.ts +23 -0
- package/dist/contracts/queue-producer.d.ts.map +1 -0
- package/dist/contracts/queue-producer.js +5 -0
- package/dist/contracts/queue-producer.js.map +1 -0
- package/dist/contracts/topic.d.ts +47 -0
- package/dist/contracts/topic.d.ts.map +1 -0
- package/dist/contracts/topic.js +34 -0
- package/dist/contracts/topic.js.map +1 -0
- package/dist/implementation/queue-api-live.d.ts +16 -0
- package/dist/implementation/queue-api-live.d.ts.map +1 -0
- package/dist/implementation/queue-api-live.js +326 -0
- package/dist/implementation/queue-api-live.js.map +1 -0
- package/dist/implementation/queue-config-live.d.ts +37 -0
- package/dist/implementation/queue-config-live.d.ts.map +1 -0
- package/dist/implementation/queue-config-live.js +99 -0
- package/dist/implementation/queue-config-live.js.map +1 -0
- package/dist/implementation/queue-consumer-live.d.ts +14 -0
- package/dist/implementation/queue-consumer-live.d.ts.map +1 -0
- package/dist/implementation/queue-consumer-live.js +56 -0
- package/dist/implementation/queue-consumer-live.js.map +1 -0
- package/dist/implementation/queue-live.d.ts +15 -0
- package/dist/implementation/queue-live.d.ts.map +1 -0
- package/dist/implementation/queue-live.js +16 -0
- package/dist/implementation/queue-live.js.map +1 -0
- package/dist/implementation/queue-poller-live.d.ts +14 -0
- package/dist/implementation/queue-poller-live.d.ts.map +1 -0
- package/dist/implementation/queue-poller-live.js +66 -0
- package/dist/implementation/queue-poller-live.js.map +1 -0
- package/dist/implementation/queue-producer-live.d.ts +9 -0
- package/dist/implementation/queue-producer-live.d.ts.map +1 -0
- package/dist/implementation/queue-producer-live.js +54 -0
- package/dist/implementation/queue-producer-live.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/cloud-event.d.ts +46 -0
- package/dist/internal/cloud-event.d.ts.map +1 -0
- package/dist/internal/cloud-event.js +140 -0
- package/dist/internal/cloud-event.js.map +1 -0
- package/dist/internal/lease.d.ts +23 -0
- package/dist/internal/lease.d.ts.map +1 -0
- package/dist/internal/lease.js +44 -0
- package/dist/internal/lease.js.map +1 -0
- package/dist/internal/multipart.d.ts +23 -0
- package/dist/internal/multipart.d.ts.map +1 -0
- package/dist/internal/multipart.js +205 -0
- package/dist/internal/multipart.js.map +1 -0
- package/dist/internal/process.d.ts +25 -0
- package/dist/internal/process.d.ts.map +1 -0
- package/dist/internal/process.js +95 -0
- package/dist/internal/process.js.map +1 -0
- package/dist/internal/queue-protocol.d.ts +38 -0
- package/dist/internal/queue-protocol.d.ts.map +1 -0
- package/dist/internal/queue-protocol.js +119 -0
- package/dist/internal/queue-protocol.js.map +1 -0
- package/dist/internal/version.d.ts +4 -0
- package/dist/internal/version.d.ts.map +1 -0
- package/dist/internal/version.js +4 -0
- package/dist/internal/version.js.map +1 -0
- package/dist/retry-policy.d.ts +26 -0
- package/dist/retry-policy.d.ts.map +1 -0
- package/dist/retry-policy.js +34 -0
- package/dist/retry-policy.js.map +1 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +2 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/test-queue.d.ts +74 -0
- package/dist/testing/test-queue.d.ts.map +1 -0
- package/dist/testing/test-queue.js +253 -0
- package/dist/testing/test-queue.js.map +1 -0
- package/package.json +59 -3
- package/src/contracts/message-handling.ts +68 -0
- package/src/contracts/queue-api.ts +199 -0
- package/src/contracts/queue-config.ts +47 -0
- package/src/contracts/queue-consumer.ts +40 -0
- package/src/contracts/queue-domain.ts +202 -0
- package/src/contracts/queue-poller.ts +76 -0
- package/src/contracts/queue-producer.ts +40 -0
- package/src/contracts/topic.ts +76 -0
- package/src/implementation/queue-api-live.ts +637 -0
- package/src/implementation/queue-config-live.ts +178 -0
- package/src/implementation/queue-consumer-live.ts +112 -0
- package/src/implementation/queue-live.ts +32 -0
- package/src/implementation/queue-poller-live.ts +130 -0
- package/src/implementation/queue-producer-live.ts +89 -0
- package/src/index.ts +19 -0
- package/src/internal/cloud-event.ts +244 -0
- package/src/internal/lease.ts +84 -0
- package/src/internal/multipart.ts +240 -0
- package/src/internal/process.ts +194 -0
- package/src/internal/queue-protocol.ts +169 -0
- package/src/internal/version.ts +5 -0
- package/src/retry-policy.ts +48 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/test-queue.ts +469 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/** Name of a queue topic: letters, digits, `_` and `-`. */
|
|
3
|
+
export declare const TopicName: Schema.brand<Schema.String, "TopicName">;
|
|
4
|
+
/** Name of a queue topic: letters, digits, `_` and `-`. */
|
|
5
|
+
export type TopicName = typeof TopicName.Type;
|
|
6
|
+
/** Name of a consumer group; each group receives every message of a topic once. */
|
|
7
|
+
export declare const ConsumerGroupName: Schema.brand<Schema.String, "ConsumerGroupName">;
|
|
8
|
+
/** Name of a consumer group; each group receives every message of a topic once. */
|
|
9
|
+
export type ConsumerGroupName = typeof ConsumerGroupName.Type;
|
|
10
|
+
/** Identifier the queue assigns to a message when it accepts it. */
|
|
11
|
+
export declare const MessageId: Schema.brand<Schema.NonEmptyString, "MessageId">;
|
|
12
|
+
/** Identifier the queue assigns to a message when it accepts it. */
|
|
13
|
+
export type MessageId = typeof MessageId.Type;
|
|
14
|
+
/** Proof of one lease on a message; acknowledging or extending the lease requires it. */
|
|
15
|
+
export declare const ReceiptHandle: Schema.brand<Schema.NonEmptyString, "ReceiptHandle">;
|
|
16
|
+
/** Proof of one lease on a message. */
|
|
17
|
+
export type ReceiptHandle = typeof ReceiptHandle.Type;
|
|
18
|
+
/** Key the queue uses to drop duplicate publishes of the same logical message. */
|
|
19
|
+
export declare const IdempotencyKey: Schema.brand<Schema.NonEmptyString, "IdempotencyKey">;
|
|
20
|
+
/** Key the queue uses to drop duplicate publishes of the same logical message. */
|
|
21
|
+
export type IdempotencyKey = typeof IdempotencyKey.Type;
|
|
22
|
+
/**
|
|
23
|
+
* **Experimental.** Key that serializes processing: at most one message per key is leased at a
|
|
24
|
+
* time, and messages published while one is in flight may be coalesced into it.
|
|
25
|
+
*/
|
|
26
|
+
export declare const ConcurrencyKey: Schema.brand<Schema.NonEmptyString, "ConcurrencyKey">;
|
|
27
|
+
/** **Experimental.** Key that serializes processing of messages that share it. */
|
|
28
|
+
export type ConcurrencyKey = typeof ConcurrencyKey.Type;
|
|
29
|
+
/** Where a consumer group with no stored position starts reading a topic. */
|
|
30
|
+
export declare const CursorFallback: Schema.Literals<readonly ["earliest", "latest"]>;
|
|
31
|
+
/** Where a consumer group with no stored position starts reading a topic. */
|
|
32
|
+
export type CursorFallback = typeof CursorFallback.Type;
|
|
33
|
+
declare const MessageHandle_base: Schema.Class<MessageHandle, Schema.Struct<{
|
|
34
|
+
readonly topic: Schema.brand<Schema.String, "TopicName">;
|
|
35
|
+
readonly consumerGroup: Schema.brand<Schema.String, "ConsumerGroupName">;
|
|
36
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "MessageId">;
|
|
37
|
+
readonly receiptHandle: Schema.brand<Schema.NonEmptyString, "ReceiptHandle">;
|
|
38
|
+
/** Region that issued the lease; follow-up calls must go to the same region. */
|
|
39
|
+
readonly region: Schema.brand<Schema.String, "VercelRegion">;
|
|
40
|
+
}>, {}>;
|
|
41
|
+
/** Everything needed to acknowledge a leased message or change its visibility. */
|
|
42
|
+
export declare class MessageHandle extends MessageHandle_base {
|
|
43
|
+
}
|
|
44
|
+
/** **Experimental.** Present when a handler run is a rerun caused by coalesced messages. */
|
|
45
|
+
export declare const ExperimentalCoalesced: Schema.Struct<{
|
|
46
|
+
/** Which rerun of this delivery is executing, from 1. */
|
|
47
|
+
readonly rerun: Schema.Int;
|
|
48
|
+
/** How many messages had been coalesced into this delivery when its acknowledgment was refused. */
|
|
49
|
+
readonly coalescedCount: Schema.Int;
|
|
50
|
+
}>;
|
|
51
|
+
declare const MessageMetadata_base: Schema.Class<MessageMetadata, Schema.Struct<{
|
|
52
|
+
readonly messageId: Schema.brand<Schema.NonEmptyString, "MessageId">;
|
|
53
|
+
/** Number of times the message has been delivered, including this delivery (from 1). */
|
|
54
|
+
readonly deliveryCount: Schema.Int;
|
|
55
|
+
readonly createdAt: Schema.DateTimeUtc;
|
|
56
|
+
/** When the message expires and stops being delivered, set by its retention. */
|
|
57
|
+
readonly expiresAt: Schema.DateTimeUtc;
|
|
58
|
+
readonly topic: Schema.brand<Schema.String, "TopicName">;
|
|
59
|
+
readonly consumerGroup: Schema.brand<Schema.String, "ConsumerGroupName">;
|
|
60
|
+
readonly region: Schema.brand<Schema.String, "VercelRegion">;
|
|
61
|
+
/** **Experimental.** How many handoffs preceded this delivery. */
|
|
62
|
+
readonly experimentalHandoffCount: Schema.optionalKey<Schema.Int>;
|
|
63
|
+
readonly experimentalCoalesced: Schema.optionalKey<Schema.Struct<{
|
|
64
|
+
/** Which rerun of this delivery is executing, from 1. */
|
|
65
|
+
readonly rerun: Schema.Int;
|
|
66
|
+
/** How many messages had been coalesced into this delivery when its acknowledgment was refused. */
|
|
67
|
+
readonly coalescedCount: Schema.Int;
|
|
68
|
+
}>>;
|
|
69
|
+
}>, {}>;
|
|
70
|
+
/** Facts about one delivery of a message, passed to message handlers. */
|
|
71
|
+
export declare class MessageMetadata extends MessageMetadata_base {
|
|
72
|
+
}
|
|
73
|
+
declare const ReceivedMessage_base: Schema.Class<ReceivedMessage, Schema.Struct<{
|
|
74
|
+
readonly handle: typeof MessageHandle;
|
|
75
|
+
readonly metadata: typeof MessageMetadata;
|
|
76
|
+
readonly contentType: Schema.String;
|
|
77
|
+
readonly body: Schema.Uint8Array;
|
|
78
|
+
}>, {}>;
|
|
79
|
+
/** A leased message as returned by the queue, before its payload is decoded. */
|
|
80
|
+
export declare class ReceivedMessage extends ReceivedMessage_base {
|
|
81
|
+
}
|
|
82
|
+
declare const MessageNotFound_base: Schema.Class<MessageNotFound, Schema.TaggedStruct<"MessageNotFound", {
|
|
83
|
+
readonly messageId: Schema.String;
|
|
84
|
+
}>, import("effect/Cause").YieldableError>;
|
|
85
|
+
/** The message does not exist, or has expired (HTTP 404). */
|
|
86
|
+
export declare class MessageNotFound extends MessageNotFound_base {
|
|
87
|
+
}
|
|
88
|
+
declare const MessageLocked_base: Schema.Class<MessageLocked, Schema.TaggedStruct<"MessageLocked", {
|
|
89
|
+
/** Delay the queue suggested before retrying, when it sent one. */
|
|
90
|
+
readonly retryAfter: Schema.Option<Schema.Duration>;
|
|
91
|
+
}>, import("effect/Cause").YieldableError>;
|
|
92
|
+
/** Another consumer holds the lease; retry once it is released. */
|
|
93
|
+
export declare class MessageLocked extends MessageLocked_base {
|
|
94
|
+
}
|
|
95
|
+
declare const ConcurrencyCoalescedPending_base: Schema.Class<ConcurrencyCoalescedPending, Schema.TaggedStruct<"ConcurrencyCoalescedPending", {
|
|
96
|
+
readonly coalescedCount: Schema.Int;
|
|
97
|
+
}>, import("effect/Cause").YieldableError>;
|
|
98
|
+
/**
|
|
99
|
+
* **Experimental.** The acknowledgment was refused because messages with the same concurrency key
|
|
100
|
+
* were coalesced into this delivery after it started.
|
|
101
|
+
*/
|
|
102
|
+
export declare class ConcurrencyCoalescedPending extends ConcurrencyCoalescedPending_base {
|
|
103
|
+
}
|
|
104
|
+
declare const MessageUnavailable_base: Schema.Class<MessageUnavailable, Schema.TaggedStruct<"MessageUnavailable", {
|
|
105
|
+
readonly message: Schema.String;
|
|
106
|
+
}>, import("effect/Cause").YieldableError>;
|
|
107
|
+
/** The message exists but cannot be leased or settled right now, for no more specific reason. */
|
|
108
|
+
export declare class MessageUnavailable extends MessageUnavailable_base {
|
|
109
|
+
}
|
|
110
|
+
declare const MessageNotAvailable_base: Schema.Class<MessageNotAvailable, Schema.TaggedStruct<"MessageNotAvailable", {
|
|
111
|
+
readonly messageId: Schema.String;
|
|
112
|
+
readonly reason: Schema.Union<readonly [typeof MessageLocked, typeof ConcurrencyCoalescedPending, typeof MessageUnavailable]>;
|
|
113
|
+
}>, import("effect/Cause").YieldableError>;
|
|
114
|
+
/** The message cannot be leased or settled by this consumer (HTTP 409). */
|
|
115
|
+
export declare class MessageNotAvailable extends MessageNotAvailable_base {
|
|
116
|
+
}
|
|
117
|
+
declare const MessageAlreadyProcessed_base: Schema.Class<MessageAlreadyProcessed, Schema.TaggedStruct<"MessageAlreadyProcessed", {
|
|
118
|
+
readonly messageId: Schema.String;
|
|
119
|
+
}>, import("effect/Cause").YieldableError>;
|
|
120
|
+
/** The message was already acknowledged by this consumer group (HTTP 410). */
|
|
121
|
+
export declare class MessageAlreadyProcessed extends MessageAlreadyProcessed_base {
|
|
122
|
+
}
|
|
123
|
+
declare const MessageCorrupted_base: Schema.Class<MessageCorrupted, Schema.TaggedStruct<"MessageCorrupted", {
|
|
124
|
+
readonly messageId: Schema.String;
|
|
125
|
+
readonly message: Schema.String;
|
|
126
|
+
}>, import("effect/Cause").YieldableError>;
|
|
127
|
+
/** The queue returned a message whose headers or body could not be read. */
|
|
128
|
+
export declare class MessageCorrupted extends MessageCorrupted_base {
|
|
129
|
+
}
|
|
130
|
+
declare const ConsumerDiscoveryFailed_base: Schema.Class<ConsumerDiscoveryFailed, Schema.TaggedStruct<"ConsumerDiscoveryFailed", {
|
|
131
|
+
readonly message: Schema.String;
|
|
132
|
+
}>, import("effect/Cause").YieldableError>;
|
|
133
|
+
/**
|
|
134
|
+
* The queue could not reach the deployment that consumes this topic (HTTP 502,
|
|
135
|
+
* `consumer_discovery_failed`), usually because the pinned deployment is gone.
|
|
136
|
+
*/
|
|
137
|
+
export declare class ConsumerDiscoveryFailed extends ConsumerDiscoveryFailed_base {
|
|
138
|
+
}
|
|
139
|
+
declare const ConsumerRegistryNotConfigured_base: Schema.Class<ConsumerRegistryNotConfigured, Schema.TaggedStruct<"ConsumerRegistryNotConfigured", {
|
|
140
|
+
readonly message: Schema.String;
|
|
141
|
+
}>, import("effect/Cause").YieldableError>;
|
|
142
|
+
/**
|
|
143
|
+
* The project has no consumer registry, so messages cannot be routed to consumers (HTTP 503,
|
|
144
|
+
* `consumer_registry_not_configured`).
|
|
145
|
+
*/
|
|
146
|
+
export declare class ConsumerRegistryNotConfigured extends ConsumerRegistryNotConfigured_base {
|
|
147
|
+
}
|
|
148
|
+
declare const BatchSizeOutOfRange_base: Schema.Class<BatchSizeOutOfRange, Schema.TaggedStruct<"BatchSizeOutOfRange", {
|
|
149
|
+
readonly size: Schema.Int;
|
|
150
|
+
readonly maximum: Schema.Int;
|
|
151
|
+
}>, import("effect/Cause").YieldableError>;
|
|
152
|
+
/** A batch send had no entries or more than the queue's limit of 100. */
|
|
153
|
+
export declare class BatchSizeOutOfRange extends BatchSizeOutOfRange_base {
|
|
154
|
+
}
|
|
155
|
+
declare const PayloadEncodeFailed_base: Schema.Class<PayloadEncodeFailed, Schema.TaggedStruct<"PayloadEncodeFailed", {
|
|
156
|
+
readonly topic: Schema.String;
|
|
157
|
+
readonly message: Schema.String;
|
|
158
|
+
}>, import("effect/Cause").YieldableError>;
|
|
159
|
+
/** A payload did not match its topic's schema when it was published. */
|
|
160
|
+
export declare class PayloadEncodeFailed extends PayloadEncodeFailed_base {
|
|
161
|
+
}
|
|
162
|
+
declare const PayloadDecodeFailed_base: Schema.Class<PayloadDecodeFailed, Schema.TaggedStruct<"PayloadDecodeFailed", {
|
|
163
|
+
readonly topic: Schema.String;
|
|
164
|
+
readonly messageId: Schema.String;
|
|
165
|
+
readonly message: Schema.String;
|
|
166
|
+
}>, import("effect/Cause").YieldableError>;
|
|
167
|
+
/** A delivered message body did not match its topic's schema. */
|
|
168
|
+
export declare class PayloadDecodeFailed extends PayloadDecodeFailed_base {
|
|
169
|
+
}
|
|
170
|
+
export {};
|
|
171
|
+
//# sourceMappingURL=queue-domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue-domain.d.ts","sourceRoot":"","sources":["../../src/contracts/queue-domain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,2DAA2D;AAC3D,eAAO,MAAM,SAAS,0CAErB,CAAC;AAEF,2DAA2D;AAC3D,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAC;AAE9C,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,kDAE7B,CAAC;AAEF,mFAAmF;AACnF,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;AAE9D,oEAAoE;AACpE,eAAO,MAAM,SAAS,kDAAwD,CAAC;AAE/E,oEAAoE;AACpE,MAAM,MAAM,SAAS,G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AoB,SAAQ,wBAMxC;CAAG;;;;AAEJ,8EAA8E;AAC9E,qBAAa,uBAAwB,SAAQ,4BAK5C;CAAG;;;;;AAEJ,4EAA4E;AAC5E,qBAAa,gBAAiB,SAAQ,qBAGpC;CAAG;;;;AAEL;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,4BAK5C;CAAG;;;;AAEJ;;;GAGG;AACH,qBAAa,6BAA8B,SAAQ,kCAKlD;CAAG;;;;;AAEJ,yEAAyE;AACzE,qBAAa,mBAAoB,SAAQ,wBAMxC;CAAG;;;;;AAEJ,wEAAwE;AACxE,qBAAa,mBAAoB,SAAQ,wBAMxC;CAAG;;;;;;AAEJ,iEAAiE;AACjE,qBAAa,mBAAoB,SAAQ,wBAOxC;CAAG"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { VercelRegion } from "@panorama-industries/effect-vercel-core";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
/** Name of a queue topic: letters, digits, `_` and `-`. */
|
|
4
|
+
export const TopicName = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_-]+$/)).pipe(Schema.brand("TopicName"));
|
|
5
|
+
/** Name of a consumer group; each group receives every message of a topic once. */
|
|
6
|
+
export const ConsumerGroupName = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_-]+$/)).pipe(Schema.brand("ConsumerGroupName"));
|
|
7
|
+
/** Identifier the queue assigns to a message when it accepts it. */
|
|
8
|
+
export const MessageId = Schema.NonEmptyString.pipe(Schema.brand("MessageId"));
|
|
9
|
+
/** Proof of one lease on a message; acknowledging or extending the lease requires it. */
|
|
10
|
+
export const ReceiptHandle = Schema.NonEmptyString.pipe(Schema.brand("ReceiptHandle"));
|
|
11
|
+
/** Key the queue uses to drop duplicate publishes of the same logical message. */
|
|
12
|
+
export const IdempotencyKey = Schema.NonEmptyString.pipe(Schema.brand("IdempotencyKey"));
|
|
13
|
+
/**
|
|
14
|
+
* **Experimental.** Key that serializes processing: at most one message per key is leased at a
|
|
15
|
+
* time, and messages published while one is in flight may be coalesced into it.
|
|
16
|
+
*/
|
|
17
|
+
export const ConcurrencyKey = Schema.NonEmptyString.pipe(Schema.brand("ConcurrencyKey"));
|
|
18
|
+
/** Where a consumer group with no stored position starts reading a topic. */
|
|
19
|
+
export const CursorFallback = Schema.Literals(["earliest", "latest"]);
|
|
20
|
+
/** Everything needed to acknowledge a leased message or change its visibility. */
|
|
21
|
+
export class MessageHandle extends Schema.Class("@effect-vercel/queue/MessageHandle")({
|
|
22
|
+
topic: TopicName,
|
|
23
|
+
consumerGroup: ConsumerGroupName,
|
|
24
|
+
messageId: MessageId,
|
|
25
|
+
receiptHandle: ReceiptHandle,
|
|
26
|
+
/** Region that issued the lease; follow-up calls must go to the same region. */
|
|
27
|
+
region: VercelRegion,
|
|
28
|
+
}) {
|
|
29
|
+
}
|
|
30
|
+
/** **Experimental.** Present when a handler run is a rerun caused by coalesced messages. */
|
|
31
|
+
export const ExperimentalCoalesced = Schema.Struct({
|
|
32
|
+
/** Which rerun of this delivery is executing, from 1. */
|
|
33
|
+
rerun: Schema.Int,
|
|
34
|
+
/** How many messages had been coalesced into this delivery when its acknowledgment was refused. */
|
|
35
|
+
coalescedCount: Schema.Int,
|
|
36
|
+
});
|
|
37
|
+
/** Facts about one delivery of a message, passed to message handlers. */
|
|
38
|
+
export class MessageMetadata extends Schema.Class("@effect-vercel/queue/MessageMetadata")({
|
|
39
|
+
messageId: MessageId,
|
|
40
|
+
/** Number of times the message has been delivered, including this delivery (from 1). */
|
|
41
|
+
deliveryCount: Schema.Int,
|
|
42
|
+
createdAt: Schema.DateTimeUtc,
|
|
43
|
+
/** When the message expires and stops being delivered, set by its retention. */
|
|
44
|
+
expiresAt: Schema.DateTimeUtc,
|
|
45
|
+
topic: TopicName,
|
|
46
|
+
consumerGroup: ConsumerGroupName,
|
|
47
|
+
region: VercelRegion,
|
|
48
|
+
/** **Experimental.** How many handoffs preceded this delivery. */
|
|
49
|
+
experimentalHandoffCount: Schema.optionalKey(Schema.Int),
|
|
50
|
+
experimentalCoalesced: Schema.optionalKey(ExperimentalCoalesced),
|
|
51
|
+
}) {
|
|
52
|
+
}
|
|
53
|
+
/** A leased message as returned by the queue, before its payload is decoded. */
|
|
54
|
+
export class ReceivedMessage extends Schema.Class("@effect-vercel/queue/ReceivedMessage")({
|
|
55
|
+
handle: MessageHandle,
|
|
56
|
+
metadata: MessageMetadata,
|
|
57
|
+
contentType: Schema.String,
|
|
58
|
+
body: Schema.Uint8Array,
|
|
59
|
+
}) {
|
|
60
|
+
}
|
|
61
|
+
/** The message does not exist, or has expired (HTTP 404). */
|
|
62
|
+
export class MessageNotFound extends Schema.TaggedError()("MessageNotFound", {
|
|
63
|
+
messageId: Schema.String,
|
|
64
|
+
}) {
|
|
65
|
+
}
|
|
66
|
+
/** Another consumer holds the lease; retry once it is released. */
|
|
67
|
+
export class MessageLocked extends Schema.TaggedError()("MessageLocked", {
|
|
68
|
+
/** Delay the queue suggested before retrying, when it sent one. */
|
|
69
|
+
retryAfter: Schema.Option(Schema.Duration),
|
|
70
|
+
}) {
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* **Experimental.** The acknowledgment was refused because messages with the same concurrency key
|
|
74
|
+
* were coalesced into this delivery after it started.
|
|
75
|
+
*/
|
|
76
|
+
export class ConcurrencyCoalescedPending extends Schema.TaggedError()("ConcurrencyCoalescedPending", {
|
|
77
|
+
coalescedCount: Schema.Int,
|
|
78
|
+
}) {
|
|
79
|
+
}
|
|
80
|
+
/** The message exists but cannot be leased or settled right now, for no more specific reason. */
|
|
81
|
+
export class MessageUnavailable extends Schema.TaggedError()("MessageUnavailable", {
|
|
82
|
+
message: Schema.String,
|
|
83
|
+
}) {
|
|
84
|
+
}
|
|
85
|
+
/** The message cannot be leased or settled by this consumer (HTTP 409). */
|
|
86
|
+
export class MessageNotAvailable extends Schema.TaggedError()("MessageNotAvailable", {
|
|
87
|
+
messageId: Schema.String,
|
|
88
|
+
reason: Schema.Union([MessageLocked, ConcurrencyCoalescedPending, MessageUnavailable]),
|
|
89
|
+
}) {
|
|
90
|
+
}
|
|
91
|
+
/** The message was already acknowledged by this consumer group (HTTP 410). */
|
|
92
|
+
export class MessageAlreadyProcessed extends Schema.TaggedError()("MessageAlreadyProcessed", {
|
|
93
|
+
messageId: Schema.String,
|
|
94
|
+
}) {
|
|
95
|
+
}
|
|
96
|
+
/** The queue returned a message whose headers or body could not be read. */
|
|
97
|
+
export class MessageCorrupted extends Schema.TaggedError()("MessageCorrupted", {
|
|
98
|
+
messageId: Schema.String,
|
|
99
|
+
message: Schema.String,
|
|
100
|
+
}) {
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The queue could not reach the deployment that consumes this topic (HTTP 502,
|
|
104
|
+
* `consumer_discovery_failed`), usually because the pinned deployment is gone.
|
|
105
|
+
*/
|
|
106
|
+
export class ConsumerDiscoveryFailed extends Schema.TaggedError()("ConsumerDiscoveryFailed", {
|
|
107
|
+
message: Schema.String,
|
|
108
|
+
}) {
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The project has no consumer registry, so messages cannot be routed to consumers (HTTP 503,
|
|
112
|
+
* `consumer_registry_not_configured`).
|
|
113
|
+
*/
|
|
114
|
+
export class ConsumerRegistryNotConfigured extends Schema.TaggedError()("ConsumerRegistryNotConfigured", {
|
|
115
|
+
message: Schema.String,
|
|
116
|
+
}) {
|
|
117
|
+
}
|
|
118
|
+
/** A batch send had no entries or more than the queue's limit of 100. */
|
|
119
|
+
export class BatchSizeOutOfRange extends Schema.TaggedError()("BatchSizeOutOfRange", {
|
|
120
|
+
size: Schema.Int,
|
|
121
|
+
maximum: Schema.Int,
|
|
122
|
+
}) {
|
|
123
|
+
}
|
|
124
|
+
/** A payload did not match its topic's schema when it was published. */
|
|
125
|
+
export class PayloadEncodeFailed extends Schema.TaggedError()("PayloadEncodeFailed", {
|
|
126
|
+
topic: Schema.String,
|
|
127
|
+
message: Schema.String,
|
|
128
|
+
}) {
|
|
129
|
+
}
|
|
130
|
+
/** A delivered message body did not match its topic's schema. */
|
|
131
|
+
export class PayloadDecodeFailed extends Schema.TaggedError()("PayloadDecodeFailed", {
|
|
132
|
+
topic: Schema.String,
|
|
133
|
+
messageId: Schema.String,
|
|
134
|
+
message: Schema.String,
|
|
135
|
+
}) {
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=queue-domain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue-domain.js","sourceRoot":"","sources":["../../src/contracts/queue-domain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,2DAA2D;AAC3D,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CACrF,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAC1B,CAAC;AAKF,mFAAmF;AACnF,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAC7F,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAClC,CAAC;AAKF,oEAAoE;AACpE,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;AAK/E,yFAAyF;AACzF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;AAKvF,kFAAkF;AAClF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,C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M,CAAC,MAAM;CACzB,CACF;CAAG;AAEJ,4EAA4E;AAC5E,MAAM,OAAO,gBAAiB,SAAQ,MAAM,CAAC,WAAW,EAAoB,CAAC,kBAAkB,EAAE;IAC/F,SAAS,EAAE,MAAM,CAAC,MAAM;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CAAC;CAAG;AAEL;;;GAGG;AACH,MAAM,OAAO,uBAAwB,SAAQ,MAAM,CAAC,WAAW,EAA2B,CACxF,yBAAyB,EACzB;IACE,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CACF;CAAG;AAEJ;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,MAAM,CAAC,WAAW,EAAiC,CACpG,+BAA+B,EAC/B;IACE,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CACF;CAAG;AAEJ,yEAAyE;AACzE,MAAM,OAAO,mBAAoB,SAAQ,MAAM,CAAC,WAAW,EAAuB,CAChF,qBAAqB,EACrB;IACE,IAAI,EAAE,MAAM,CAAC,GAAG;IAChB,OAAO,EAAE,MAAM,CAAC,GAAG;CACpB,CACF;CAAG;AAEJ,wEAAwE;AACxE,MAAM,OAAO,mBAAoB,SAAQ,MAAM,CAAC,WAAW,EAAuB,CAChF,qBAAqB,EACrB;IACE,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CACF;CAAG;AAEJ,iEAAiE;AACjE,MAAM,OAAO,mBAAoB,SAAQ,MAAM,CAAC,WAAW,EAAuB,CAChF,qBAAqB,EACrB;IACE,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,SAAS,EAAE,MAAM,CAAC,MAAM;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CACF;CAAG"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { Effect } from "effect";
|
|
2
|
+
import { Context, Data } from "effect";
|
|
3
|
+
import type { ConsumeOptions, MessageHandler } from "./message-handling.ts";
|
|
4
|
+
import type { QueueLeaseError, QueueRequestError, ReceiveByIdOptions, ReceiveOptions } from "./queue-api.ts";
|
|
5
|
+
import type { ConsumerGroupName, MessageCorrupted, MessageId } from "./queue-domain.ts";
|
|
6
|
+
import type { Topic } from "./topic.ts";
|
|
7
|
+
/** What a poll did. */
|
|
8
|
+
export type ReceiveOutcome = Data.TaggedEnum<{
|
|
9
|
+
/** This many messages were leased and handled. */
|
|
10
|
+
Processed: {
|
|
11
|
+
readonly count: number;
|
|
12
|
+
};
|
|
13
|
+
/** The consumer group had nothing to deliver. */
|
|
14
|
+
Empty: {};
|
|
15
|
+
/** The requested message does not exist or has expired. */
|
|
16
|
+
NotFound: {
|
|
17
|
+
readonly messageId: MessageId;
|
|
18
|
+
};
|
|
19
|
+
/** Another consumer holds the requested message. */
|
|
20
|
+
NotAvailable: {
|
|
21
|
+
readonly messageId: MessageId;
|
|
22
|
+
};
|
|
23
|
+
/** The requested message was already acknowledged by this consumer group. */
|
|
24
|
+
AlreadyProcessed: {
|
|
25
|
+
readonly messageId: MessageId;
|
|
26
|
+
};
|
|
27
|
+
}>;
|
|
28
|
+
/** Constructors and matchers for {@link ReceiveOutcome}. */
|
|
29
|
+
export declare const ReceiveOutcome: {
|
|
30
|
+
readonly $is: <Tag extends "AlreadyProcessed" | "Empty" | "NotAvailable" | "NotFound" | "Processed">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
31
|
+
readonly _tag: "AlreadyProcessed";
|
|
32
|
+
readonly messageId: MessageId;
|
|
33
|
+
}, {
|
|
34
|
+
readonly _tag: Tag;
|
|
35
|
+
}> | Extract<{
|
|
36
|
+
readonly _tag: "Empty";
|
|
37
|
+
}, {
|
|
38
|
+
readonly _tag: Tag;
|
|
39
|
+
}> | Extract<{
|
|
40
|
+
readonly _tag: "NotAvailable";
|
|
41
|
+
readonly messageId: MessageId;
|
|
42
|
+
}, {
|
|
43
|
+
readonly _tag: Tag;
|
|
44
|
+
}> | Extract<{
|
|
45
|
+
readonly _tag: "NotFound";
|
|
46
|
+
readonly messageId: MessageId;
|
|
47
|
+
}, {
|
|
48
|
+
readonly _tag: Tag;
|
|
49
|
+
}> | Extract<{
|
|
50
|
+
readonly _tag: "Processed";
|
|
51
|
+
readonly count: number;
|
|
52
|
+
}, {
|
|
53
|
+
readonly _tag: Tag;
|
|
54
|
+
}>;
|
|
55
|
+
readonly $match: {
|
|
56
|
+
<Cases extends { readonly [Tag in "AlreadyProcessed" | "Empty" | "NotAvailable" | "NotFound" | "Processed"]: (args: Extract<{
|
|
57
|
+
readonly _tag: "AlreadyProcessed";
|
|
58
|
+
readonly messageId: MessageId;
|
|
59
|
+
} | {
|
|
60
|
+
readonly _tag: "Empty";
|
|
61
|
+
} | {
|
|
62
|
+
readonly _tag: "NotAvailable";
|
|
63
|
+
readonly messageId: MessageId;
|
|
64
|
+
} | {
|
|
65
|
+
readonly _tag: "NotFound";
|
|
66
|
+
readonly messageId: MessageId;
|
|
67
|
+
} | {
|
|
68
|
+
readonly _tag: "Processed";
|
|
69
|
+
readonly count: number;
|
|
70
|
+
}, {
|
|
71
|
+
readonly _tag: Tag;
|
|
72
|
+
}>) => any; }>(cases: Cases): (value: {
|
|
73
|
+
readonly _tag: "AlreadyProcessed";
|
|
74
|
+
readonly messageId: MessageId;
|
|
75
|
+
} | {
|
|
76
|
+
readonly _tag: "Empty";
|
|
77
|
+
} | {
|
|
78
|
+
readonly _tag: "NotAvailable";
|
|
79
|
+
readonly messageId: MessageId;
|
|
80
|
+
} | {
|
|
81
|
+
readonly _tag: "NotFound";
|
|
82
|
+
readonly messageId: MessageId;
|
|
83
|
+
} | {
|
|
84
|
+
readonly _tag: "Processed";
|
|
85
|
+
readonly count: number;
|
|
86
|
+
}) => import("effect/Unify").Unify<ReturnType<Cases["AlreadyProcessed" | "Empty" | "NotAvailable" | "NotFound" | "Processed"]>>;
|
|
87
|
+
<Cases extends { readonly [Tag in "AlreadyProcessed" | "Empty" | "NotAvailable" | "NotFound" | "Processed"]: (args: Extract<{
|
|
88
|
+
readonly _tag: "AlreadyProcessed";
|
|
89
|
+
readonly messageId: MessageId;
|
|
90
|
+
} | {
|
|
91
|
+
readonly _tag: "Empty";
|
|
92
|
+
} | {
|
|
93
|
+
readonly _tag: "NotAvailable";
|
|
94
|
+
readonly messageId: MessageId;
|
|
95
|
+
} | {
|
|
96
|
+
readonly _tag: "NotFound";
|
|
97
|
+
readonly messageId: MessageId;
|
|
98
|
+
} | {
|
|
99
|
+
readonly _tag: "Processed";
|
|
100
|
+
readonly count: number;
|
|
101
|
+
}, {
|
|
102
|
+
readonly _tag: Tag;
|
|
103
|
+
}>) => any; }>(value: {
|
|
104
|
+
readonly _tag: "AlreadyProcessed";
|
|
105
|
+
readonly messageId: MessageId;
|
|
106
|
+
} | {
|
|
107
|
+
readonly _tag: "Empty";
|
|
108
|
+
} | {
|
|
109
|
+
readonly _tag: "NotAvailable";
|
|
110
|
+
readonly messageId: MessageId;
|
|
111
|
+
} | {
|
|
112
|
+
readonly _tag: "NotFound";
|
|
113
|
+
readonly messageId: MessageId;
|
|
114
|
+
} | {
|
|
115
|
+
readonly _tag: "Processed";
|
|
116
|
+
readonly count: number;
|
|
117
|
+
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["AlreadyProcessed" | "Empty" | "NotAvailable" | "NotFound" | "Processed"]>>;
|
|
118
|
+
};
|
|
119
|
+
readonly AlreadyProcessed: Data.TaggedEnum.ConstructorFrom<{
|
|
120
|
+
readonly _tag: "AlreadyProcessed";
|
|
121
|
+
readonly messageId: MessageId;
|
|
122
|
+
}, "_tag">;
|
|
123
|
+
readonly Empty: Data.TaggedEnum.ConstructorFrom<{
|
|
124
|
+
readonly _tag: "Empty";
|
|
125
|
+
}, "_tag">;
|
|
126
|
+
readonly NotAvailable: Data.TaggedEnum.ConstructorFrom<{
|
|
127
|
+
readonly _tag: "NotAvailable";
|
|
128
|
+
readonly messageId: MessageId;
|
|
129
|
+
}, "_tag">;
|
|
130
|
+
readonly NotFound: Data.TaggedEnum.ConstructorFrom<{
|
|
131
|
+
readonly _tag: "NotFound";
|
|
132
|
+
readonly messageId: MessageId;
|
|
133
|
+
}, "_tag">;
|
|
134
|
+
readonly Processed: Data.TaggedEnum.ConstructorFrom<{
|
|
135
|
+
readonly _tag: "Processed";
|
|
136
|
+
readonly count: number;
|
|
137
|
+
}, "_tag">;
|
|
138
|
+
};
|
|
139
|
+
/** Options for one poll: lease options plus how to handle the leased messages. */
|
|
140
|
+
export type PollOptions<E, R> = ConsumeOptions<E, R> & Pick<ReceiveOptions, "limit" | "cursorFallback" | "region"> & {
|
|
141
|
+
/**
|
|
142
|
+
* How many leased messages are handled at once. Default: `"unbounded"`. Messages waiting their
|
|
143
|
+
* turn keep their leases renewed, so a lower value never lets a lease expire. In a function,
|
|
144
|
+
* keep `limit × handler time / concurrency` well under `maxDuration`.
|
|
145
|
+
*/
|
|
146
|
+
readonly concurrency?: number | "unbounded";
|
|
147
|
+
};
|
|
148
|
+
/** Options for polling one message by identifier. */
|
|
149
|
+
export type PollByIdOptions<E, R> = ConsumeOptions<E, R> & Pick<ReceiveByIdOptions, "region">;
|
|
150
|
+
declare const QueuePoller_base: Context.ServiceClass<QueuePoller, "@effect-vercel/queue/QueuePoller", {
|
|
151
|
+
/**
|
|
152
|
+
* Lease up to `limit` messages and handle them, concurrently by default.
|
|
153
|
+
*
|
|
154
|
+
* @returns The outcome, or the handler's error when the error policy answered `Fail`. Also
|
|
155
|
+
* fails with `MessageNotFound` or `MessageNotAvailable` when a lease was lost before the
|
|
156
|
+
* message could be acknowledged.
|
|
157
|
+
*/
|
|
158
|
+
readonly receive: <A, I, E, R, R2 = never>(topic: Topic<A, I>, consumerGroup: ConsumerGroupName, handle: MessageHandler<A, E, R>, options?: PollOptions<E, R2>) => Effect.Effect<ReceiveOutcome, E | QueueLeaseError | MessageCorrupted, R | R2>;
|
|
159
|
+
/** Lease one message by identifier and handle it. */
|
|
160
|
+
readonly receiveById: <A, I, E, R, R2 = never>(topic: Topic<A, I>, consumerGroup: ConsumerGroupName, messageId: MessageId, handle: MessageHandler<A, E, R>, options?: PollByIdOptions<E, R2>) => Effect.Effect<ReceiveOutcome, E | QueueRequestError | MessageCorrupted, R | R2>;
|
|
161
|
+
}>;
|
|
162
|
+
/**
|
|
163
|
+
* Pulls messages from a consumer group and handles them, for workloads that run outside push
|
|
164
|
+
* delivery such as workers and cron jobs.
|
|
165
|
+
*/
|
|
166
|
+
export declare class QueuePoller extends QueuePoller_base {
|
|
167
|
+
}
|
|
168
|
+
export {};
|
|
169
|
+
//# sourceMappingURL=queue-poller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue-poller.d.ts","sourceRoot":"","sources":["../../src/contracts/queue-poller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,uBAAuB;AACvB,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC;IAC3C,kDAAkD;IAClD,SAAS,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,iDAAiD;IACjD,KAAK,EAAE,EAAE,CAAC;IACV,2DAA2D;IAC3D,QAAQ,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;KAAE,CAAC;IAC5C,oDAAoD;IACpD,YAAY,EAAE;QAA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AC,EAAE,WAAW,CAAC,CAAC,EAAE,EAAE,CAAC,KACzB,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,GAAG,eAAe,GAAG,gBAAgB,EAAE,CAAC,GAAG,EAAE,CAAC;IAElF,qDAAqD;0BAC/B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,KAAK,EAC3C,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAClB,aAAa,EAAE,iBAAiB,EAChC,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC/B,OAAO,CAAC,EAAE,eAAe,CAAC,CAAC,EAAE,EAAE,CAAC,KAC7B,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,GAAG,iBAAiB,GAAG,gBAAgB,EAAE,CAAC,GAAG,EAAE,CAAC;;AA5BxF;;;GAGG;AACH,qBAAa,WAAY,SAAQ,gBA0BM;CAAG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Context, Data } from "effect";
|
|
2
|
+
/** Constructors and matchers for {@link ReceiveOutcome}. */
|
|
3
|
+
export const ReceiveOutcome = Data.taggedEnum();
|
|
4
|
+
/**
|
|
5
|
+
* Pulls messages from a consumer group and handles them, for workloads that run outside push
|
|
6
|
+
* delivery such as workers and cron jobs.
|
|
7
|
+
*/
|
|
8
|
+
export class QueuePoller extends Context.Service()("@effect-vercel/queue/QueuePoller") {
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=queue-poller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue-poller.js","sourceRoot":"","sources":["../../src/contracts/queue-poller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AA0BvC,4DAA4D;AAC5D,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,UAAU,EAAkB,CAAC;AAgBhE;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAO,CAAC,OAAO,EA0B7C,CAAC,kCAAkC,CAAC;CAAG"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Array, Effect } from "effect";
|
|
2
|
+
import { Context } from "effect";
|
|
3
|
+
import type { BatchSendResult, PublishOptions, QueueSendBatchError, QueueSendError, SendResult } from "./queue-api.ts";
|
|
4
|
+
import type { PayloadEncodeFailed } from "./queue-domain.ts";
|
|
5
|
+
import type { Topic } from "./topic.ts";
|
|
6
|
+
/** One payload of a batch send with its publish options. */
|
|
7
|
+
export interface BatchEntry<A> extends PublishOptions {
|
|
8
|
+
readonly payload: A;
|
|
9
|
+
}
|
|
10
|
+
declare const QueueProducer_base: Context.ServiceClass<QueueProducer, "@effect-vercel/queue/QueueProducer", {
|
|
11
|
+
/** Encode a payload with its topic's schema and publish it, in a `vqs.send` producer span. */
|
|
12
|
+
readonly send: <A, I>(topic: Topic<A, I>, payload: A, options?: PublishOptions) => Effect.Effect<SendResult, QueueSendError | PayloadEncodeFailed>;
|
|
13
|
+
/**
|
|
14
|
+
* Encode and publish 1 to 100 payloads in one request. Inspect every result: a batch can mix
|
|
15
|
+
* sent, deferred and failed entries.
|
|
16
|
+
*/
|
|
17
|
+
readonly sendBatch: <A, I>(topic: Topic<A, I>, entries: Array.NonEmptyReadonlyArray<BatchEntry<A>>) => Effect.Effect<ReadonlyArray<BatchSendResult>, QueueSendBatchError | PayloadEncodeFailed>;
|
|
18
|
+
}>;
|
|
19
|
+
/** Publishes typed payloads to topics. */
|
|
20
|
+
export declare class QueueProducer extends QueueProducer_base {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=queue-producer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue-producer.d.ts","sourceRoot":"","sources":["../../src/contracts/queue-producer.ts"],"names":[],"mappings":"AA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B/C,CAAC,oCAAoC,CAAC;CAAG"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { TopicName } from "./queue-domain.ts";
|
|
3
|
+
/**
|
|
4
|
+
* A queue topic and the schema of its payloads, shared by the code that publishes to it and the
|
|
5
|
+
* code that consumes it.
|
|
6
|
+
*
|
|
7
|
+
* @template A - Payload type handlers receive and producers send.
|
|
8
|
+
* @template I - Encoded form of the payload before it is serialized to bytes.
|
|
9
|
+
*/
|
|
10
|
+
export interface Topic<A, I = A> {
|
|
11
|
+
readonly name: TopicName;
|
|
12
|
+
/** Schema of the payload, as given by the topic's author. */
|
|
13
|
+
readonly schema: Schema.Codec<A, I>;
|
|
14
|
+
/** Content type sent with every message of this topic. */
|
|
15
|
+
readonly contentType: string;
|
|
16
|
+
/** Converts between the payload and the bytes stored in the queue. */
|
|
17
|
+
readonly wire: Schema.Codec<A, Uint8Array>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Define a topic whose payloads travel as JSON (`application/json`).
|
|
21
|
+
*
|
|
22
|
+
* @param name - Topic name; an invalid name is a defect raised where the topic is defined.
|
|
23
|
+
* @param schema - Payload schema; its encoded form must be JSON-serializable.
|
|
24
|
+
*/
|
|
25
|
+
declare const json: <A, I>(name: string, schema: Schema.Codec<A, I>) => Topic<A, I>;
|
|
26
|
+
/**
|
|
27
|
+
* Define a topic whose payloads are raw bytes (`application/octet-stream`).
|
|
28
|
+
*
|
|
29
|
+
* @param name - Topic name; an invalid name is a defect raised where the topic is defined.
|
|
30
|
+
*/
|
|
31
|
+
declare const bytes: (name: string) => Topic<Uint8Array>;
|
|
32
|
+
/** Constructors for {@link Topic} definitions. */
|
|
33
|
+
export declare const Topic: {
|
|
34
|
+
json: typeof json;
|
|
35
|
+
bytes: typeof bytes;
|
|
36
|
+
};
|
|
37
|
+
/** Type helpers for {@link Topic}. */
|
|
38
|
+
export declare namespace Topic {
|
|
39
|
+
/** Any topic, regardless of payload type. */
|
|
40
|
+
type Any = Topic<any, any>;
|
|
41
|
+
/** Payload type of a topic, like `Schema.Type`. */
|
|
42
|
+
type Type<T extends Any> = T extends Topic<infer A, any> ? A : never;
|
|
43
|
+
/** Encoded payload type of a topic, like `Schema.Encoded`. */
|
|
44
|
+
type Encoded<T extends Any> = T extends Topic<any, infer I> ? I : never;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=topic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topic.d.ts","sourceRoot":"","sources":["../../src/contracts/topic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAwB,MAAM,QAAQ,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,WAAW,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAEzB,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEpC,0DAA0D;IAC1D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;CAC5C;AAeD;;;;;GAKG;AACH,QAAA,MAAM,IAAI,GAAI,CAAC,EAAE,CAAC,QAAQ,MAAM,UAAU,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAKvE,CAAC;AAEH;;;;GAIG;AACH,QAAA,MAAM,KAAK,SAAU,MAAM,KAAG,KAAK,CAAC,UAAU,CAK5C,CAAC;AAEH,kDAAkD;AAClD,eAAO,MAAM,KAAK;;;CAAkB,CAAC;AAErC,sCAAsC;AACtC,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,6CAA6C;IAC7C,KAAY,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAElC,mDAAmD;IACnD,KAAY,IAAI,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAE5E,8DAA8D;IAC9D,KAAY,OAAO,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CAChF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Schema, SchemaTransformation } from "effect";
|
|
2
|
+
import { TopicName } from "./queue-domain.js";
|
|
3
|
+
const utf8Encoder = new TextEncoder();
|
|
4
|
+
const utf8Decoder = new TextDecoder();
|
|
5
|
+
const Utf8String = Schema.Uint8Array.pipe(Schema.decodeTo(Schema.String, SchemaTransformation.transform({
|
|
6
|
+
decode: (bytes) => utf8Decoder.decode(bytes),
|
|
7
|
+
encode: (text) => utf8Encoder.encode(text),
|
|
8
|
+
})));
|
|
9
|
+
/**
|
|
10
|
+
* Define a topic whose payloads travel as JSON (`application/json`).
|
|
11
|
+
*
|
|
12
|
+
* @param name - Topic name; an invalid name is a defect raised where the topic is defined.
|
|
13
|
+
* @param schema - Payload schema; its encoded form must be JSON-serializable.
|
|
14
|
+
*/
|
|
15
|
+
const json = (name, schema) => ({
|
|
16
|
+
name: TopicName.make(name),
|
|
17
|
+
schema,
|
|
18
|
+
contentType: "application/json",
|
|
19
|
+
wire: Utf8String.pipe(Schema.decodeTo(Schema.fromJsonString(schema))),
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Define a topic whose payloads are raw bytes (`application/octet-stream`).
|
|
23
|
+
*
|
|
24
|
+
* @param name - Topic name; an invalid name is a defect raised where the topic is defined.
|
|
25
|
+
*/
|
|
26
|
+
const bytes = (name) => ({
|
|
27
|
+
name: TopicName.make(name),
|
|
28
|
+
schema: Schema.Uint8Array,
|
|
29
|
+
contentType: "application/octet-stream",
|
|
30
|
+
wire: Schema.Uint8Array,
|
|
31
|
+
});
|
|
32
|
+
/** Constructors for {@link Topic} definitions. */
|
|
33
|
+
export const Topic = { json, bytes };
|
|
34
|
+
//# sourceMappingURL=topic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topic.js","sourceRoot":"","sources":["../../src/contracts/topic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAsB9C,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AACtC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AAEtC,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CACvC,MAAM,CAAC,QAAQ,CACb,MAAM,CAAC,MAAM,EACb,oBAAoB,CAAC,SAAS,CAAqB;IACjD,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC;IAC5C,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;CAC3C,CAAC,CACH,CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,IAAI,GAAG,CAAO,IAAY,EAAE,MAA0B,EAAe,EAAE,CAAC,CAAC;IAC7E,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;IAC1B,MAAM;IACN,WAAW,EAAE,kBAAkB;IAC/B,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;CACtE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