@sellable/mcp 0.1.546 → 0.1.547

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.
@@ -151,18 +151,7 @@ export async function attachSequence(input) {
151
151
  // (`CampaignOffer.sequenceTemplate`). The workflow-tables endpoint
152
152
  // writes to `WorkflowTable.config.sequenceTemplate`, which the UI
153
153
  // doesn't read — hitting it on a campaign table is silently wrong.
154
- let campaignOfferId = null;
155
- try {
156
- const tableMeta = await api.get(`/api/v3/workflow-tables/${input.tableId}?mode=meta`);
157
- const rawCampaignId = tableMeta?.table?.config?.campaignOfferId;
158
- if (typeof rawCampaignId === "string" && rawCampaignId.length > 0) {
159
- campaignOfferId = rawCampaignId;
160
- }
161
- }
162
- catch {
163
- // Fall back to workflow-tables path on meta-fetch failure —
164
- // non-campaign tables won't have the field set anyway.
165
- }
154
+ const campaignOfferId = await resolveCampaignOfferIdForTable(api, input.tableId);
166
155
  const endpoint = campaignOfferId
167
156
  ? `/api/v3/campaigns/${campaignOfferId}/sequence`
168
157
  : `/api/v3/workflow-tables/${input.tableId}/sequence`;
@@ -191,6 +180,32 @@ export async function attachSequence(input) {
191
180
  throw error;
192
181
  }
193
182
  }
183
+ async function resolveCampaignOfferIdForTable(api, tableId) {
184
+ try {
185
+ const tableMeta = await api.get(`/api/v3/workflow-tables/${tableId}?mode=meta`);
186
+ const rawCampaignId = tableMeta?.table?.config?.campaignOfferId;
187
+ if (typeof rawCampaignId === "string" && rawCampaignId.length > 0) {
188
+ return rawCampaignId;
189
+ }
190
+ }
191
+ catch {
192
+ // Continue to the inventory fallback below.
193
+ }
194
+ try {
195
+ const tableInventory = await api.get("/api/v3/mcp/tables?limit=500");
196
+ const matchingTable = tableInventory?.tables?.find((table) => {
197
+ return table?.id === tableId;
198
+ });
199
+ const rawCampaignId = matchingTable?.campaignOfferId;
200
+ if (typeof rawCampaignId === "string" && rawCampaignId.length > 0) {
201
+ return rawCampaignId;
202
+ }
203
+ }
204
+ catch {
205
+ // Fall back to workflow-tables path on inventory failure.
206
+ }
207
+ return null;
208
+ }
194
209
  export async function attachRecommendedSequence(input) {
195
210
  const api = getApi();
196
211
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellable/mcp",
3
- "version": "0.1.546",
3
+ "version": "0.1.547",
4
4
  "type": "module",
5
5
  "description": "Sellable MCP server for Claude Code, Codex, and Hermes campaign workflows",
6
6
  "main": "dist/index.js",