@ductape/mcp 0.1.42 → 0.1.43
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/dist/index.js +16 -6
- package/package.json +1 -1
- package/src/index.ts +16 -6
package/dist/index.js
CHANGED
|
@@ -188,11 +188,20 @@ SETUP — register once in AppModule:
|
|
|
188
188
|
accessKey: process.env.DUCTAPE_ACCESS_KEY,
|
|
189
189
|
product: 'my-product', // optional default — overridable per controller
|
|
190
190
|
env: process.env.NODE_ENV === 'production' ? 'prd' : 'snd',
|
|
191
|
+
redisUrl: process.env.REDIS_URL, // REQUIRED when using events.dispatch() or @Events.Dispatch
|
|
191
192
|
}),
|
|
192
193
|
],
|
|
193
194
|
})
|
|
194
195
|
export class AppModule {}
|
|
195
196
|
|
|
197
|
+
IMPORTANT — redisUrl:
|
|
198
|
+
ALL *.dispatch() calls (actions.dispatch, features.dispatch, events.dispatch, databases.dispatch,
|
|
199
|
+
storage.dispatch, graph.dispatch, notifications.dispatch, messageBrokers.dispatch, quotas.dispatch,
|
|
200
|
+
fallback.dispatch, etc.) enqueue jobs via BullMQ, which requires a Redis connection.
|
|
201
|
+
Without redisUrl ANY dispatch() call throws "Queues not configured. dispatch() requires a queue connection."
|
|
202
|
+
Set REDIS_URL (e.g. redis://localhost:6379 or a managed Redis connection string) and pass it as redisUrl.
|
|
203
|
+
*.run(), events.produce(), and @Events.Consumer do NOT require Redis — only dispatch() does.
|
|
204
|
+
|
|
196
205
|
// Async (e.g. pulling key from ConfigService):
|
|
197
206
|
DuctapeModule.forRootAsync({
|
|
198
207
|
imports: [ConfigModule],
|
|
@@ -201,6 +210,7 @@ SETUP — register once in AppModule:
|
|
|
201
210
|
accessKey: cfg.get('DUCTAPE_ACCESS_KEY'),
|
|
202
211
|
product: cfg.get('DUCTAPE_PRODUCT'),
|
|
203
212
|
env: cfg.get('DUCTAPE_ENV'),
|
|
213
|
+
redisUrl: cfg.get('REDIS_URL'), // required for dispatch
|
|
204
214
|
}),
|
|
205
215
|
})
|
|
206
216
|
|
|
@@ -258,7 +268,7 @@ FOR MESSAGING (events.produce / events.consume / events.dispatch):
|
|
|
258
268
|
@Events.Produce({ event: 'broker-tag:topic-tag' })
|
|
259
269
|
emitOrderCreated(payload: { orderId: string }) { return payload; }
|
|
260
270
|
|
|
261
|
-
Dispatch (scheduled or immediate) —
|
|
271
|
+
Dispatch (scheduled or immediate) — REQUIRES redisUrl in DuctapeModule.forIntegration:
|
|
262
272
|
@Events.Dispatch({ broker: 'order-events', event: 'order-events:order-created', schedule: { every: 60000 } })
|
|
263
273
|
dispatchHeartbeat(payload: { message: { ping: boolean } }) { return payload; }
|
|
264
274
|
|
|
@@ -273,6 +283,7 @@ FOR MESSAGING (events.produce / events.consume / events.dispatch):
|
|
|
273
283
|
}
|
|
274
284
|
// method return takes precedence over decorator schedule; use sdk.events.dispatch() directly
|
|
275
285
|
// when even the broker/event must vary at call time.
|
|
286
|
+
// ALL *.dispatch() calls require redisUrl — BullMQ over Redis. Without it dispatch throws.
|
|
276
287
|
|
|
277
288
|
Consume (method decorator — method is called for each incoming message):
|
|
278
289
|
@Events.Consumer({ event: 'order-events:order-created' })
|
|
@@ -491,7 +502,7 @@ ALL params are passed as a JSON array in positional order matching the SDK signa
|
|
|
491
502
|
messageBrokers.delete [product_tag, broker_tag]
|
|
492
503
|
messageBrokers.topics.create ← FORBIDDEN with publishable key. Use ductape_cli instead:
|
|
493
504
|
ductape_cli("events topics create -f topic.json")
|
|
494
|
-
topic.json: { tag, name,
|
|
505
|
+
topic.json: { tag: "broker-tag:topic-tag", name, description?, sample?, idempotent?, queueUrls?: [{ env_slug, url }] }
|
|
495
506
|
← Always required before consuming. For SQS: must include queueUrls per env.
|
|
496
507
|
← For Pub/Sub, Kafka, RabbitMQ, Redis, NATS: the first produce call auto-registers the topic,
|
|
497
508
|
but you should still create it explicitly so consumers can subscribe before any produce occurs.
|
|
@@ -2456,12 +2467,11 @@ Import (register an EXISTING cloud resource):
|
|
|
2456
2467
|
|
|
2457
2468
|
topic.json schema:
|
|
2458
2469
|
{
|
|
2459
|
-
"tag": "order-created",
|
|
2470
|
+
"tag": "order-events:order-created", // ALWAYS "broker-tag:topic-tag" — full event string
|
|
2460
2471
|
"name": "Order Created",
|
|
2461
|
-
"
|
|
2462
|
-
"description": "...", // optional
|
|
2472
|
+
"description": "...", // optional
|
|
2463
2473
|
"sample": { "orderId": "string", "total": 0 }, // expected message shape
|
|
2464
|
-
"idempotent": false,
|
|
2474
|
+
"idempotent": false, // optional — deduplicates by idempotency_key when true
|
|
2465
2475
|
// AWS SQS only — per-env queue URL:
|
|
2466
2476
|
"queueUrls": [
|
|
2467
2477
|
{ "env_slug": "snd", "url": "https://sqs.us-east-1.amazonaws.com/123/queue-snd" },
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -199,11 +199,20 @@ SETUP — register once in AppModule:
|
|
|
199
199
|
accessKey: process.env.DUCTAPE_ACCESS_KEY,
|
|
200
200
|
product: 'my-product', // optional default — overridable per controller
|
|
201
201
|
env: process.env.NODE_ENV === 'production' ? 'prd' : 'snd',
|
|
202
|
+
redisUrl: process.env.REDIS_URL, // REQUIRED when using events.dispatch() or @Events.Dispatch
|
|
202
203
|
}),
|
|
203
204
|
],
|
|
204
205
|
})
|
|
205
206
|
export class AppModule {}
|
|
206
207
|
|
|
208
|
+
IMPORTANT — redisUrl:
|
|
209
|
+
ALL *.dispatch() calls (actions.dispatch, features.dispatch, events.dispatch, databases.dispatch,
|
|
210
|
+
storage.dispatch, graph.dispatch, notifications.dispatch, messageBrokers.dispatch, quotas.dispatch,
|
|
211
|
+
fallback.dispatch, etc.) enqueue jobs via BullMQ, which requires a Redis connection.
|
|
212
|
+
Without redisUrl ANY dispatch() call throws "Queues not configured. dispatch() requires a queue connection."
|
|
213
|
+
Set REDIS_URL (e.g. redis://localhost:6379 or a managed Redis connection string) and pass it as redisUrl.
|
|
214
|
+
*.run(), events.produce(), and @Events.Consumer do NOT require Redis — only dispatch() does.
|
|
215
|
+
|
|
207
216
|
// Async (e.g. pulling key from ConfigService):
|
|
208
217
|
DuctapeModule.forRootAsync({
|
|
209
218
|
imports: [ConfigModule],
|
|
@@ -212,6 +221,7 @@ SETUP — register once in AppModule:
|
|
|
212
221
|
accessKey: cfg.get('DUCTAPE_ACCESS_KEY'),
|
|
213
222
|
product: cfg.get('DUCTAPE_PRODUCT'),
|
|
214
223
|
env: cfg.get('DUCTAPE_ENV'),
|
|
224
|
+
redisUrl: cfg.get('REDIS_URL'), // required for dispatch
|
|
215
225
|
}),
|
|
216
226
|
})
|
|
217
227
|
|
|
@@ -269,7 +279,7 @@ FOR MESSAGING (events.produce / events.consume / events.dispatch):
|
|
|
269
279
|
@Events.Produce({ event: 'broker-tag:topic-tag' })
|
|
270
280
|
emitOrderCreated(payload: { orderId: string }) { return payload; }
|
|
271
281
|
|
|
272
|
-
Dispatch (scheduled or immediate) —
|
|
282
|
+
Dispatch (scheduled or immediate) — REQUIRES redisUrl in DuctapeModule.forIntegration:
|
|
273
283
|
@Events.Dispatch({ broker: 'order-events', event: 'order-events:order-created', schedule: { every: 60000 } })
|
|
274
284
|
dispatchHeartbeat(payload: { message: { ping: boolean } }) { return payload; }
|
|
275
285
|
|
|
@@ -284,6 +294,7 @@ FOR MESSAGING (events.produce / events.consume / events.dispatch):
|
|
|
284
294
|
}
|
|
285
295
|
// method return takes precedence over decorator schedule; use sdk.events.dispatch() directly
|
|
286
296
|
// when even the broker/event must vary at call time.
|
|
297
|
+
// ALL *.dispatch() calls require redisUrl — BullMQ over Redis. Without it dispatch throws.
|
|
287
298
|
|
|
288
299
|
Consume (method decorator — method is called for each incoming message):
|
|
289
300
|
@Events.Consumer({ event: 'order-events:order-created' })
|
|
@@ -502,7 +513,7 @@ ALL params are passed as a JSON array in positional order matching the SDK signa
|
|
|
502
513
|
messageBrokers.delete [product_tag, broker_tag]
|
|
503
514
|
messageBrokers.topics.create ← FORBIDDEN with publishable key. Use ductape_cli instead:
|
|
504
515
|
ductape_cli("events topics create -f topic.json")
|
|
505
|
-
topic.json: { tag, name,
|
|
516
|
+
topic.json: { tag: "broker-tag:topic-tag", name, description?, sample?, idempotent?, queueUrls?: [{ env_slug, url }] }
|
|
506
517
|
← Always required before consuming. For SQS: must include queueUrls per env.
|
|
507
518
|
← For Pub/Sub, Kafka, RabbitMQ, Redis, NATS: the first produce call auto-registers the topic,
|
|
508
519
|
but you should still create it explicitly so consumers can subscribe before any produce occurs.
|
|
@@ -2529,12 +2540,11 @@ Import (register an EXISTING cloud resource):
|
|
|
2529
2540
|
|
|
2530
2541
|
topic.json schema:
|
|
2531
2542
|
{
|
|
2532
|
-
"tag": "order-created",
|
|
2543
|
+
"tag": "order-events:order-created", // ALWAYS "broker-tag:topic-tag" — full event string
|
|
2533
2544
|
"name": "Order Created",
|
|
2534
|
-
"
|
|
2535
|
-
"description": "...", // optional
|
|
2545
|
+
"description": "...", // optional
|
|
2536
2546
|
"sample": { "orderId": "string", "total": 0 }, // expected message shape
|
|
2537
|
-
"idempotent": false,
|
|
2547
|
+
"idempotent": false, // optional — deduplicates by idempotency_key when true
|
|
2538
2548
|
// AWS SQS only — per-env queue URL:
|
|
2539
2549
|
"queueUrls": [
|
|
2540
2550
|
{ "env_slug": "snd", "url": "https://sqs.us-east-1.amazonaws.com/123/queue-snd" },
|