@capixjs/transport-queue 0.1.0-beta.2 → 0.1.0-beta.3
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/README.md +30 -26
- package/dist/adapters/sqs.d.ts +79 -0
- package/dist/adapters/sqs.d.ts.map +1 -0
- package/dist/adapters/sqs.js +133 -0
- package/dist/adapters/sqs.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -41,42 +41,46 @@ import { MemoryQueueAdapter } from '@capixjs/transport-queue';
|
|
|
41
41
|
const adapter = new MemoryQueueAdapter();
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
###
|
|
44
|
+
### `BullMQAdapter` (Redis)
|
|
45
|
+
|
|
46
|
+
Ships with the package; requires `bullmq` and `ioredis` at runtime:
|
|
45
47
|
|
|
46
48
|
```ts
|
|
47
|
-
import {
|
|
48
|
-
import type { QueueAdapter, QueueMessage } from '@capixjs/transport-queue';
|
|
49
|
+
import { BullMQAdapter } from '@capixjs/transport-queue';
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const adapter = new BullMQAdapter({
|
|
52
|
+
connection: { host: 'localhost', port: 6379 },
|
|
53
|
+
concurrency: 10,
|
|
54
|
+
});
|
|
55
|
+
```
|
|
53
56
|
|
|
54
|
-
|
|
55
|
-
const worker = new Worker(queue, async (job) => handler(job.data as QueueMessage), {
|
|
56
|
-
connection: { host: 'localhost', port: 6379 },
|
|
57
|
-
});
|
|
58
|
-
this.workers.set(queue, worker);
|
|
59
|
-
}
|
|
57
|
+
### `SqsQueueAdapter` (Amazon SQS)
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
if (!this.queues.has(queue)) {
|
|
63
|
-
this.queues.set(queue, new Queue(queue, { connection: { host: 'localhost', port: 6379 } }));
|
|
64
|
-
}
|
|
65
|
-
await this.queues.get(queue)!.add(msg.capability, msg);
|
|
66
|
-
}
|
|
59
|
+
Ships with the package; pass an [`@aws-sdk/client-sqs`](https://www.npmjs.com/package/@aws-sdk/client-sqs) aggregated client (nothing is bundled):
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
}
|
|
61
|
+
```ts
|
|
62
|
+
import { SQS } from '@aws-sdk/client-sqs';
|
|
63
|
+
import { SqsQueueAdapter } from '@capixjs/transport-queue';
|
|
64
|
+
|
|
65
|
+
const adapter = new SqsQueueAdapter({
|
|
66
|
+
client: new SQS({ region: 'eu-west-1' }),
|
|
67
|
+
queueUrls: { jobs: process.env.JOBS_QUEUE_URL! },
|
|
68
|
+
onResult: (msg, result) => {
|
|
69
|
+
if (!result.ok) console.error(`job ${msg.id} failed:`, result.error);
|
|
70
|
+
},
|
|
71
|
+
});
|
|
75
72
|
```
|
|
76
73
|
|
|
74
|
+
Semantics:
|
|
75
|
+
- **Success** → the message is deleted.
|
|
76
|
+
- **Failed result** (validation, guard, resolver error) → the message is *not* deleted; SQS redelivers it after the visibility timeout, and your queue's redrive policy / dead-letter queue caps the retries.
|
|
77
|
+
- **Unparseable body** → deleted and reported via `onError` — a poison message would otherwise redeliver forever.
|
|
78
|
+
- **FIFO queues** (`.fifo` URLs) automatically get `MessageGroupId` (the capability name) and `MessageDeduplicationId` (the message id).
|
|
79
|
+
- **`stop()`** drains in-flight handlers, then leaves anything the long poll delivers late for redelivery.
|
|
80
|
+
|
|
77
81
|
### Custom adapters
|
|
78
82
|
|
|
79
|
-
Implement the `QueueAdapter` interface to connect to
|
|
83
|
+
Implement the `QueueAdapter` interface to connect to Faktory, NATS, or any queue system:
|
|
80
84
|
|
|
81
85
|
```ts
|
|
82
86
|
import type { QueueAdapter, QueueMessage } from '@capixjs/transport-queue';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sqs.ts — Amazon SQS adapter for the queue transport.
|
|
3
|
+
*
|
|
4
|
+
* Structurally typed against the AWS SDK v3 aggregated client
|
|
5
|
+
* (`new SQS({ region })` from @aws-sdk/client-sqs) — nothing is bundled.
|
|
6
|
+
*
|
|
7
|
+
* Semantics:
|
|
8
|
+
* - success → the message is deleted
|
|
9
|
+
* - failed result → the message is NOT deleted; SQS redelivers it after
|
|
10
|
+
* the queue's visibility timeout, and the queue's redrive policy / DLQ
|
|
11
|
+
* caps the retries (same retry-by-requeue model as the BullMQ adapter)
|
|
12
|
+
* - handler throw → not deleted (retry), reported via onError
|
|
13
|
+
* - unparseable body → deleted and reported — a poison message would
|
|
14
|
+
* otherwise redeliver forever
|
|
15
|
+
* - FIFO queues (URL ends in .fifo) get MessageGroupId = capability and
|
|
16
|
+
* MessageDeduplicationId = message id automatically
|
|
17
|
+
*/
|
|
18
|
+
import type { QueueAdapter, QueueMessage, QueueResult } from '../types.js';
|
|
19
|
+
/** The subset of @aws-sdk/client-sqs's aggregated SQS client the adapter uses. */
|
|
20
|
+
export type SqsClientLike = {
|
|
21
|
+
sendMessage(params: {
|
|
22
|
+
QueueUrl: string;
|
|
23
|
+
MessageBody: string;
|
|
24
|
+
MessageGroupId?: string;
|
|
25
|
+
MessageDeduplicationId?: string;
|
|
26
|
+
}): Promise<unknown>;
|
|
27
|
+
receiveMessage(params: {
|
|
28
|
+
QueueUrl: string;
|
|
29
|
+
MaxNumberOfMessages?: number;
|
|
30
|
+
WaitTimeSeconds?: number;
|
|
31
|
+
}): Promise<{
|
|
32
|
+
Messages?: Array<{
|
|
33
|
+
Body?: string;
|
|
34
|
+
ReceiptHandle?: string;
|
|
35
|
+
}>;
|
|
36
|
+
}>;
|
|
37
|
+
deleteMessage(params: {
|
|
38
|
+
QueueUrl: string;
|
|
39
|
+
ReceiptHandle: string;
|
|
40
|
+
}): Promise<unknown>;
|
|
41
|
+
};
|
|
42
|
+
export type SqsQueueAdapterOptions = {
|
|
43
|
+
/** An @aws-sdk/client-sqs aggregated client (or anything shaped like one). */
|
|
44
|
+
client: SqsClientLike;
|
|
45
|
+
/** Capix queue name → SQS queue URL. Every queue used must be mapped. */
|
|
46
|
+
queueUrls: Record<string, string>;
|
|
47
|
+
/** Long-poll wait per receive, in seconds. Default: 20 (SQS maximum). */
|
|
48
|
+
waitTimeSeconds?: number;
|
|
49
|
+
/** Messages fetched per receive (processed concurrently). Default: 10. */
|
|
50
|
+
maxMessages?: number;
|
|
51
|
+
/** Pause after a failed receive before retrying, in ms. Default: 5_000. */
|
|
52
|
+
errorBackoffMs?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Called with the result of every processed message — including failed
|
|
55
|
+
* capability invocations (`result.ok === false`), which stay in the queue
|
|
56
|
+
* for redelivery. Use this to observe background-job failures.
|
|
57
|
+
*/
|
|
58
|
+
onResult?: (msg: QueueMessage, result: QueueResult) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Called for infrastructure-level failures: receive errors (msg is null),
|
|
61
|
+
* unparseable message bodies, or a throwing handler.
|
|
62
|
+
* Defaults to logging via console.error.
|
|
63
|
+
*/
|
|
64
|
+
onError?: (msg: QueueMessage | null, err: unknown) => void;
|
|
65
|
+
};
|
|
66
|
+
export declare class SqsQueueAdapter implements QueueAdapter {
|
|
67
|
+
private readonly options;
|
|
68
|
+
private running;
|
|
69
|
+
private readonly inFlight;
|
|
70
|
+
constructor(options: SqsQueueAdapterOptions);
|
|
71
|
+
private url;
|
|
72
|
+
private reportError;
|
|
73
|
+
enqueue(queueName: string, msg: QueueMessage): Promise<void>;
|
|
74
|
+
start(queueName: string, onMessage: (msg: QueueMessage) => Promise<QueueResult>): Promise<void>;
|
|
75
|
+
private pollLoop;
|
|
76
|
+
private handleMessage;
|
|
77
|
+
stop(): Promise<void>;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=sqs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqs.d.ts","s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AAY,EAAE,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC5D;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,EAAE,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5D,CAAC;AAEF,qBAAa,eAAgB,YAAW,YAAY;IAClD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IACjD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA4B;gBAEzC,OAAO,EAAE,sBAAsB;IAI3C,OAAO,CAAC,GAAG;IAWX,OAAO,CAAC,WAAW;IAQb,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAY5D,KAAK,CACT,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC,WAAW,CAAC,GACrD,OAAO,CAAC,IAAI,CAAC;YAQF,QAAQ;YAqCR,aAAa;IAsCrB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAO5B"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sqs.ts — Amazon SQS adapter for the queue transport.
|
|
3
|
+
*
|
|
4
|
+
* Structurally typed against the AWS SDK v3 aggregated client
|
|
5
|
+
* (`new SQS({ region })` from @aws-sdk/client-sqs) — nothing is bundled.
|
|
6
|
+
*
|
|
7
|
+
* Semantics:
|
|
8
|
+
* - success → the message is deleted
|
|
9
|
+
* - failed result → the message is NOT deleted; SQS redelivers it after
|
|
10
|
+
* the queue's visibility timeout, and the queue's redrive policy / DLQ
|
|
11
|
+
* caps the retries (same retry-by-requeue model as the BullMQ adapter)
|
|
12
|
+
* - handler throw → not deleted (retry), reported via onError
|
|
13
|
+
* - unparseable body → deleted and reported — a poison message would
|
|
14
|
+
* otherwise redeliver forever
|
|
15
|
+
* - FIFO queues (URL ends in .fifo) get MessageGroupId = capability and
|
|
16
|
+
* MessageDeduplicationId = message id automatically
|
|
17
|
+
*/
|
|
18
|
+
export class SqsQueueAdapter {
|
|
19
|
+
options;
|
|
20
|
+
running = false;
|
|
21
|
+
inFlight = new Set();
|
|
22
|
+
constructor(options) {
|
|
23
|
+
this.options = options;
|
|
24
|
+
}
|
|
25
|
+
url(queueName) {
|
|
26
|
+
const url = this.options.queueUrls[queueName];
|
|
27
|
+
if (url === undefined) {
|
|
28
|
+
throw new Error(`[capix] SqsQueueAdapter: no queue URL configured for '${queueName}'. ` +
|
|
29
|
+
`Add it to queueUrls: { '${queueName}': 'https://sqs.<region>.amazonaws.com/...' }`);
|
|
30
|
+
}
|
|
31
|
+
return url;
|
|
32
|
+
}
|
|
33
|
+
reportError(msg, err) {
|
|
34
|
+
if (this.options.onError) {
|
|
35
|
+
this.options.onError(msg, err);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
console.error('[capix:sqs] Error:', err);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async enqueue(queueName, msg) {
|
|
42
|
+
const QueueUrl = this.url(queueName);
|
|
43
|
+
await this.options.client.sendMessage({
|
|
44
|
+
QueueUrl,
|
|
45
|
+
MessageBody: JSON.stringify(msg),
|
|
46
|
+
// FIFO queues require a group id and deduplication id
|
|
47
|
+
...(QueueUrl.endsWith('.fifo')
|
|
48
|
+
? { MessageGroupId: msg.capability, MessageDeduplicationId: msg.id }
|
|
49
|
+
: {}),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
async start(queueName, onMessage) {
|
|
53
|
+
const QueueUrl = this.url(queueName); // fail fast on unmapped queues
|
|
54
|
+
this.running = true;
|
|
55
|
+
// The loop runs detached; stop() flips `running` and drains inFlight.
|
|
56
|
+
void this.pollLoop(QueueUrl, onMessage);
|
|
57
|
+
console.log(`[capix] Queue transport processing: ${queueName} (SQS)`);
|
|
58
|
+
}
|
|
59
|
+
async pollLoop(QueueUrl, onMessage) {
|
|
60
|
+
while (this.running) {
|
|
61
|
+
let received;
|
|
62
|
+
try {
|
|
63
|
+
received = await this.options.client.receiveMessage({
|
|
64
|
+
QueueUrl,
|
|
65
|
+
MaxNumberOfMessages: this.options.maxMessages ?? 10,
|
|
66
|
+
WaitTimeSeconds: this.options.waitTimeSeconds ?? 20,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
this.reportError(null, err);
|
|
71
|
+
await new Promise((r) => setTimeout(r, this.options.errorBackoffMs ?? 5_000));
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
// Stopped while the long poll was in flight: leave the messages
|
|
75
|
+
// untouched — SQS redelivers them after the visibility timeout.
|
|
76
|
+
if (!this.running)
|
|
77
|
+
return;
|
|
78
|
+
const messages = received.Messages ?? [];
|
|
79
|
+
if (messages.length === 0)
|
|
80
|
+
continue;
|
|
81
|
+
const batch = Promise.all(messages.map((m) => this.handleMessage(QueueUrl, m, onMessage))).then(() => undefined);
|
|
82
|
+
this.inFlight.add(batch);
|
|
83
|
+
try {
|
|
84
|
+
await batch;
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
this.inFlight.delete(batch);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async handleMessage(QueueUrl, raw, onMessage) {
|
|
92
|
+
const ReceiptHandle = raw.ReceiptHandle;
|
|
93
|
+
if (ReceiptHandle === undefined)
|
|
94
|
+
return;
|
|
95
|
+
let msg;
|
|
96
|
+
try {
|
|
97
|
+
const parsed = JSON.parse(raw.Body ?? '');
|
|
98
|
+
if (typeof parsed !== 'object' || parsed === null || typeof parsed.capability !== 'string') {
|
|
99
|
+
throw new Error('message body is not a QueueMessage');
|
|
100
|
+
}
|
|
101
|
+
msg = parsed;
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
// Poison message: delete it or it redelivers forever
|
|
105
|
+
this.reportError(null, err);
|
|
106
|
+
await this.options.client.deleteMessage({ QueueUrl, ReceiptHandle }).catch((e) => {
|
|
107
|
+
this.reportError(null, e);
|
|
108
|
+
});
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
const result = await onMessage(msg);
|
|
113
|
+
this.options.onResult?.(msg, result);
|
|
114
|
+
if (result.ok) {
|
|
115
|
+
await this.options.client.deleteMessage({ QueueUrl, ReceiptHandle });
|
|
116
|
+
}
|
|
117
|
+
// ok: false → leave in the queue; visibility timeout drives the retry
|
|
118
|
+
}
|
|
119
|
+
catch (err) {
|
|
120
|
+
// Unexpected handler throw (the engine returns errors as results) —
|
|
121
|
+
// leave the message for redelivery and report
|
|
122
|
+
this.reportError(msg, err);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
async stop() {
|
|
126
|
+
this.running = false;
|
|
127
|
+
// Drain messages whose handlers are mid-flight; do NOT wait for the
|
|
128
|
+
// long poll itself — that could take waitTimeSeconds to return, and
|
|
129
|
+
// any messages it delivers after stop are left for redelivery.
|
|
130
|
+
await Promise.all([...this.inFlight]);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=sqs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqs.js","sourceRoot":"","sources":["../../src/adapters/sqs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA6CH,MAAM,OAAO,eAAe;IACT,OAAO,CAAyB;IACzC,OAAO,GAAG,KAAK,CAAC;IACP,QAAQ,GAAG,IAAI,GAAG,EAAiB,CAAC;IAErD,YAAY,OAA+B;QACzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEO,GAAG,CAAC,SAAiB;QAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,MAAM,IAA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AAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,oEAAoE;YACpE,8CAA8C;YAC9C,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,oEAAoE;QACpE,oEAAoE;QACpE,+DAA+D;QAC/D,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxC,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { queueTransport, createQueueClient } from './transport.js';
|
|
2
2
|
export { MemoryQueueAdapter } from './adapters/memory.js';
|
|
3
3
|
export { BullMQAdapter } from './adapters/bullmq.js';
|
|
4
|
+
export { SqsQueueAdapter } from './adapters/sqs.js';
|
|
4
5
|
export type { QueueAdapter, QueueMessage, QueueResult } from './types.js';
|
|
5
6
|
export type { QueueTransportOptions } from './transport.js';
|
|
6
7
|
export type { MemoryQueueAdapterOptions } from './adapters/memory.js';
|
|
7
8
|
export type { BullMQAdapterOptions } from './adapters/bullmq.js';
|
|
9
|
+
export type { SqsQueueAdapterOptions, SqsClientLike } from './adapters/sqs.js';
|
|
8
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAqB,sBAAsB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAA0B,sBAAsB,CAAC;AACzE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC1E,YAAY,EAAE,qBAAqB,EAAE,MAAa,gBAAgB,CAAC;AACnE,YAAY,EAAE,yBAAyB,EAAE,MAAS,sBAAsB,CAAC;AACzE,YAAY,EAAE,oBAAoB,EAAE,MAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAqB,sBAAsB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAA0B,sBAAsB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAwB,mBAAmB,CAAC;AACtE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC1E,YAAY,EAAE,qBAAqB,EAAE,MAAa,gBAAgB,CAAC;AACnE,YAAY,EAAE,yBAAyB,EAAE,MAAS,sBAAsB,CAAC;AACzE,YAAY,EAAE,oBAAoB,EAAE,MAAc,sBAAsB,CAAC;AACzE,YAAY,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { queueTransport, createQueueClient } from './transport.js';
|
|
2
2
|
export { MemoryQueueAdapter } from './adapters/memory.js';
|
|
3
3
|
export { BullMQAdapter } from './adapters/bullmq.js';
|
|
4
|
+
export { SqsQueueAdapter } from './adapters/sqs.js';
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAqB,sBAAsB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAA0B,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAqB,sBAAsB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAA0B,sBAAsB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAwB,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capixjs/transport-queue",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.3",
|
|
4
4
|
"description": "Message queue transport for Capix (BullMQ + in-memory)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"typescript": "^5.5.0",
|
|
65
65
|
"vitest": "^1.6.0",
|
|
66
66
|
"zod": "^4.0.0",
|
|
67
|
-
"@capixjs/core": "0.1.0-beta.
|
|
67
|
+
"@capixjs/core": "0.1.0-beta.3"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build": "tsc",
|