@ductape/mcp 0.1.41 → 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 +19 -7
- package/package.json +1 -1
- package/src/index.ts +19 -7
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.
|
|
@@ -1097,6 +1108,7 @@ const ADMIN_SUBCOMMANDS = [
|
|
|
1097
1108
|
'link', 'unlink', 'init',
|
|
1098
1109
|
'products', 'apps',
|
|
1099
1110
|
'resources',
|
|
1111
|
+
'events',
|
|
1100
1112
|
'cloud',
|
|
1101
1113
|
'secrets',
|
|
1102
1114
|
'generate',
|
|
@@ -2455,12 +2467,11 @@ Import (register an EXISTING cloud resource):
|
|
|
2455
2467
|
|
|
2456
2468
|
topic.json schema:
|
|
2457
2469
|
{
|
|
2458
|
-
"tag": "order-created",
|
|
2470
|
+
"tag": "order-events:order-created", // ALWAYS "broker-tag:topic-tag" — full event string
|
|
2459
2471
|
"name": "Order Created",
|
|
2460
|
-
"
|
|
2461
|
-
"description": "...", // optional
|
|
2472
|
+
"description": "...", // optional
|
|
2462
2473
|
"sample": { "orderId": "string", "total": 0 }, // expected message shape
|
|
2463
|
-
"idempotent": false,
|
|
2474
|
+
"idempotent": false, // optional — deduplicates by idempotency_key when true
|
|
2464
2475
|
// AWS SQS only — per-env queue URL:
|
|
2465
2476
|
"queueUrls": [
|
|
2466
2477
|
{ "env_slug": "snd", "url": "https://sqs.us-east-1.amazonaws.com/123/queue-snd" },
|
|
@@ -3223,9 +3234,10 @@ const cliInputSchema = z.object({
|
|
|
3223
3234
|
command: z.string().describe('The ductape CLI command to run, without the leading "ductape" word. ' +
|
|
3224
3235
|
'Examples: "products list", "products create --name \\"My Product\\" --tag my-product", ' +
|
|
3225
3236
|
'"apps list", "apps create -f app.json", "resources storage list", ' +
|
|
3237
|
+
'"events topics create -f topic.json", "events topics list --tag broker-tag", ' +
|
|
3226
3238
|
'"cloud connections list", "link --product my-product --env dev".\n\n' +
|
|
3227
3239
|
'Use this tool for administrative operations: creating or updating products, apps, ' +
|
|
3228
|
-
'resources (databases, storage, caches…), cloud connections, secrets, ' +
|
|
3240
|
+
'resources (databases, storage, caches…), event broker topics, cloud connections, secrets, ' +
|
|
3229
3241
|
'and for apply/migrate workflows.\n\n' +
|
|
3230
3242
|
'Note: environments, app actions, features, quotas, fallbacks, and jobs are configured ' +
|
|
3231
3243
|
'in the Workbench UI — there are no CLI commands for them.\n\n' +
|
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.
|
|
@@ -1146,6 +1157,7 @@ const ADMIN_SUBCOMMANDS = [
|
|
|
1146
1157
|
'link', 'unlink', 'init',
|
|
1147
1158
|
'products', 'apps',
|
|
1148
1159
|
'resources',
|
|
1160
|
+
'events',
|
|
1149
1161
|
'cloud',
|
|
1150
1162
|
'secrets',
|
|
1151
1163
|
'generate',
|
|
@@ -2528,12 +2540,11 @@ Import (register an EXISTING cloud resource):
|
|
|
2528
2540
|
|
|
2529
2541
|
topic.json schema:
|
|
2530
2542
|
{
|
|
2531
|
-
"tag": "order-created",
|
|
2543
|
+
"tag": "order-events:order-created", // ALWAYS "broker-tag:topic-tag" — full event string
|
|
2532
2544
|
"name": "Order Created",
|
|
2533
|
-
"
|
|
2534
|
-
"description": "...", // optional
|
|
2545
|
+
"description": "...", // optional
|
|
2535
2546
|
"sample": { "orderId": "string", "total": 0 }, // expected message shape
|
|
2536
|
-
"idempotent": false,
|
|
2547
|
+
"idempotent": false, // optional — deduplicates by idempotency_key when true
|
|
2537
2548
|
// AWS SQS only — per-env queue URL:
|
|
2538
2549
|
"queueUrls": [
|
|
2539
2550
|
{ "env_slug": "snd", "url": "https://sqs.us-east-1.amazonaws.com/123/queue-snd" },
|
|
@@ -3303,9 +3314,10 @@ const cliInputSchema = z.object({
|
|
|
3303
3314
|
'The ductape CLI command to run, without the leading "ductape" word. ' +
|
|
3304
3315
|
'Examples: "products list", "products create --name \\"My Product\\" --tag my-product", ' +
|
|
3305
3316
|
'"apps list", "apps create -f app.json", "resources storage list", ' +
|
|
3317
|
+
'"events topics create -f topic.json", "events topics list --tag broker-tag", ' +
|
|
3306
3318
|
'"cloud connections list", "link --product my-product --env dev".\n\n' +
|
|
3307
3319
|
'Use this tool for administrative operations: creating or updating products, apps, ' +
|
|
3308
|
-
'resources (databases, storage, caches…), cloud connections, secrets, ' +
|
|
3320
|
+
'resources (databases, storage, caches…), event broker topics, cloud connections, secrets, ' +
|
|
3309
3321
|
'and for apply/migrate workflows.\n\n' +
|
|
3310
3322
|
'Note: environments, app actions, features, quotas, fallbacks, and jobs are configured ' +
|
|
3311
3323
|
'in the Workbench UI — there are no CLI commands for them.\n\n' +
|