@ductape/mcp 0.1.20 → 0.1.21

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 (3) hide show
  1. package/dist/index.js +32 -13
  2. package/package.json +1 -1
  3. package/src/index.ts +32 -13
package/dist/index.js CHANGED
@@ -2063,25 +2063,44 @@ Import (register an EXISTING cloud resource):
2063
2063
  List topics on a broker:
2064
2064
  ductape_execute("messageBrokers.topics.list", [product_tag, "broker-tag"])
2065
2065
 
2066
- ━━━ RUNTIME: PRODUCE AND CONSUME ━━━
2066
+ ━━━ STEP 3: PRODUCE AND CONSUME — WRITTEN IN APPLICATION CODE ━━━
2067
2067
 
2068
- Produce (publish a message):
2069
- CALL ductape_generate_payload FIRST (operation_family="messaging", method="produce")
2070
- messageBrokers.produce [{ product, env, event: "broker_tag:topic_tag", message: { key: value } }]
2071
- Idempotent publish (deduplicates by key, default TTL 86400 s):
2072
- messageBrokers.publishIdempotent [{ product, env, event, message, idempotency_key, ttl? }]
2068
+ There is NO admin command or file to declare producers/consumers.
2069
+ There is NO "create producer" step before writing code.
2070
+ Producers and consumers are registered automatically by the SDK the first time your code calls
2071
+ produce/consume you do not pre-declare them.
2072
+
2073
+ The entire producer/consumer contract is the code you write in your controllers or services:
2073
2074
 
2074
- Consume (subscribe):
2075
- messageBrokers.consume [{ product, env, event: "broker_tag:topic_tag",
2076
- callback: async (message) => { ... } }]
2075
+ Produce (publish a message) — write in your service/controller:
2076
+ CALL ductape_generate_payload FIRST (operation_family="messaging", method="produce")
2077
+ await ductape.events.produce({
2078
+ product: "my-product",
2079
+ env: "prd",
2080
+ event: "broker_tag:topic_tag", // "broker_tag:topic_tag" — always colon-separated
2081
+ message: { key: value },
2082
+ });
2083
+ Idempotent publish (deduplicates by key):
2084
+ await ductape.events.publishIdempotent({ product, env, event, message, idempotencyKey, idempotencyTtl? })
2085
+
2086
+ Consume (subscribe) — write in your service/controller:
2087
+ await ductape.events.consume({
2088
+ product: "my-product",
2089
+ env: "prd",
2090
+ event: "broker_tag:topic_tag",
2091
+ callback: async (message) => { /* handle message */ },
2092
+ });
2077
2093
  Callback errors are re-thrown so the broker can nack/retry.
2078
2094
 
2079
- Background dispatch with scheduling:
2080
- messageBrokers.dispatch [{ product, env, broker, event, input: { message },
2081
- schedule?: { start_at?, cron?, every?, limit?, endDate?, tz? } }]
2095
+ Background dispatch with scheduling — write in your service/controller:
2096
+ await ductape.events.dispatch({ product, env, broker, event, input: { message },
2097
+ schedule?: { start_at?, cron?, every?, limit?, endDate?, tz? } })
2082
2098
  → CALL ductape_generate_payload FIRST (operation_family="messaging", method="dispatch")
2083
2099
 
2084
- Event format string: "broker_tag:topic_tag" always colon-separated.
2100
+ For the four standard producer declarations (match-state, match-report, projection-updated,
2101
+ notification), write these produce calls in the relevant application service methods — there is
2102
+ no separate configuration file or CLI step. The SDK creates the producer metadata on first call.
2103
+
2085
2104
  Message payload is AES-encrypted before the tracking API call — tracking never sees plaintext.
2086
2105
 
2087
2106
  ━━━ OBSERVABILITY ━━━
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ductape/mcp",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "MCP server that exposes Ductape SDK operations via the backend proxy",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -2132,25 +2132,44 @@ Import (register an EXISTING cloud resource):
2132
2132
  List topics on a broker:
2133
2133
  ductape_execute("messageBrokers.topics.list", [product_tag, "broker-tag"])
2134
2134
 
2135
- ━━━ RUNTIME: PRODUCE AND CONSUME ━━━
2135
+ ━━━ STEP 3: PRODUCE AND CONSUME — WRITTEN IN APPLICATION CODE ━━━
2136
2136
 
2137
- Produce (publish a message):
2138
- CALL ductape_generate_payload FIRST (operation_family="messaging", method="produce")
2139
- messageBrokers.produce [{ product, env, event: "broker_tag:topic_tag", message: { key: value } }]
2140
- Idempotent publish (deduplicates by key, default TTL 86400 s):
2141
- messageBrokers.publishIdempotent [{ product, env, event, message, idempotency_key, ttl? }]
2137
+ There is NO admin command or file to declare producers/consumers.
2138
+ There is NO "create producer" step before writing code.
2139
+ Producers and consumers are registered automatically by the SDK the first time your code calls
2140
+ produce/consume you do not pre-declare them.
2141
+
2142
+ The entire producer/consumer contract is the code you write in your controllers or services:
2142
2143
 
2143
- Consume (subscribe):
2144
- messageBrokers.consume [{ product, env, event: "broker_tag:topic_tag",
2145
- callback: async (message) => { ... } }]
2144
+ Produce (publish a message) — write in your service/controller:
2145
+ CALL ductape_generate_payload FIRST (operation_family="messaging", method="produce")
2146
+ await ductape.events.produce({
2147
+ product: "my-product",
2148
+ env: "prd",
2149
+ event: "broker_tag:topic_tag", // "broker_tag:topic_tag" — always colon-separated
2150
+ message: { key: value },
2151
+ });
2152
+ Idempotent publish (deduplicates by key):
2153
+ await ductape.events.publishIdempotent({ product, env, event, message, idempotencyKey, idempotencyTtl? })
2154
+
2155
+ Consume (subscribe) — write in your service/controller:
2156
+ await ductape.events.consume({
2157
+ product: "my-product",
2158
+ env: "prd",
2159
+ event: "broker_tag:topic_tag",
2160
+ callback: async (message) => { /* handle message */ },
2161
+ });
2146
2162
  Callback errors are re-thrown so the broker can nack/retry.
2147
2163
 
2148
- Background dispatch with scheduling:
2149
- messageBrokers.dispatch [{ product, env, broker, event, input: { message },
2150
- schedule?: { start_at?, cron?, every?, limit?, endDate?, tz? } }]
2164
+ Background dispatch with scheduling — write in your service/controller:
2165
+ await ductape.events.dispatch({ product, env, broker, event, input: { message },
2166
+ schedule?: { start_at?, cron?, every?, limit?, endDate?, tz? } })
2151
2167
  → CALL ductape_generate_payload FIRST (operation_family="messaging", method="dispatch")
2152
2168
 
2153
- Event format string: "broker_tag:topic_tag" always colon-separated.
2169
+ For the four standard producer declarations (match-state, match-report, projection-updated,
2170
+ notification), write these produce calls in the relevant application service methods — there is
2171
+ no separate configuration file or CLI step. The SDK creates the producer metadata on first call.
2172
+
2154
2173
  Message payload is AES-encrypted before the tracking API call — tracking never sees plaintext.
2155
2174
 
2156
2175
  ━━━ OBSERVABILITY ━━━