@12-apps/marketplace 1.1.0 → 1.3.0
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/ADOPTING.md +37 -7
- package/README.md +238 -4
- package/dist/99food/en-US.d.ts +19 -0
- package/dist/99food/en-US.js +23 -0
- package/dist/99food/en-US.js.map +1 -0
- package/dist/99food/index.d.ts +162 -0
- package/dist/99food/index.js +444 -0
- package/dist/99food/index.js.map +1 -0
- package/dist/99food/pt-BR.d.ts +23 -0
- package/dist/99food/pt-BR.js +23 -0
- package/dist/99food/pt-BR.js.map +1 -0
- package/dist/{adapter-BggtVFf9.d.ts → adapter-0l_EmuJA.d.ts} +206 -2
- package/dist/{chunk-NGNEL4HS.js → chunk-AYYBRQJV.js} +52 -4
- package/dist/chunk-AYYBRQJV.js.map +1 -0
- package/dist/chunk-BD7DS3XM.js +78 -0
- package/dist/chunk-BD7DS3XM.js.map +1 -0
- package/dist/chunk-M2V4RFMA.js +23 -0
- package/dist/chunk-M2V4RFMA.js.map +1 -0
- package/dist/{chunk-7BYVGNU5.js → chunk-RVBTARIY.js} +1 -1
- package/dist/chunk-RVBTARIY.js.map +1 -0
- package/dist/chunk-XUAFXNOH.js +1604 -0
- package/dist/chunk-XUAFXNOH.js.map +1 -0
- package/dist/{engine-KrgZ4pA4.d.ts → engine-CZsP8KWd.d.ts} +278 -2
- package/dist/hono/index.d.ts +2 -2
- package/dist/hono/index.js +2 -2
- package/dist/ifood/index.d.ts +16 -12
- package/dist/ifood/index.js +248 -121
- package/dist/ifood/index.js.map +1 -1
- package/dist/index.d.ts +30 -4
- package/dist/index.js +189 -346
- package/dist/index.js.map +1 -1
- package/dist/manifest/server.d.ts +4 -2
- package/dist/manifest/server.js +2 -2
- package/dist/rappi/en-US.d.ts +14 -0
- package/dist/rappi/en-US.js +18 -0
- package/dist/rappi/en-US.js.map +1 -0
- package/dist/rappi/index.d.ts +190 -0
- package/dist/rappi/index.js +359 -0
- package/dist/rappi/index.js.map +1 -0
- package/dist/rappi/pt-BR.d.ts +18 -0
- package/dist/rappi/pt-BR.js +18 -0
- package/dist/rappi/pt-BR.js.map +1 -0
- package/dist/server/index.d.ts +19 -8
- package/dist/server/index.js +4 -2
- package/package.json +26 -2
- package/prisma/marketplace.prisma +97 -2
- package/prisma/migrations/20261113120000_marketplace_catalogue/migration.sql +97 -0
- package/src/99food/catalogue.ts +117 -0
- package/src/99food/copy.ts +36 -0
- package/src/99food/en-US.ts +19 -0
- package/src/99food/index.ts +125 -0
- package/src/99food/normalize.ts +263 -0
- package/src/99food/outbound.ts +220 -0
- package/src/99food/pt-BR.ts +23 -0
- package/src/core/adapter.ts +27 -2
- package/src/core/catalogue-category.ts +119 -0
- package/src/core/catalogue-ids.ts +23 -0
- package/src/core/catalogue-job.ts +332 -0
- package/src/core/catalogue-port.ts +173 -0
- package/src/core/catalogue-store.ts +172 -0
- package/src/core/catalogue-sweep.ts +43 -0
- package/src/core/catalogue.ts +226 -0
- package/src/core/decisions.ts +16 -4
- package/src/core/engine.ts +54 -0
- package/src/core/fetch-order.ts +253 -0
- package/src/core/inbox.ts +8 -2
- package/src/core/ingest.ts +10 -2
- package/src/core/integration.ts +30 -1
- package/src/core/order-fetch-marks.ts +63 -0
- package/src/core/outbound-sweep.ts +7 -2
- package/src/core/outbound.ts +22 -2
- package/src/core/payload-read.ts +101 -0
- package/src/core/pipeline.ts +64 -15
- package/src/core/ports.ts +36 -0
- package/src/core/types.ts +14 -0
- package/src/ifood/catalogue.ts +273 -0
- package/src/ifood/index.ts +4 -0
- package/src/ifood/normalize.ts +15 -88
- package/src/ifood/outbound.ts +9 -6
- package/src/index.ts +49 -1
- package/src/rappi/copy.ts +39 -0
- package/src/rappi/en-US.ts +14 -0
- package/src/rappi/index.ts +161 -0
- package/src/rappi/normalize.ts +314 -0
- package/src/rappi/outbound.ts +182 -0
- package/src/rappi/pt-BR.ts +18 -0
- package/src/server/index.ts +1 -0
- package/src/server/jobs.ts +71 -8
- package/dist/chunk-7BYVGNU5.js.map +0 -1
- package/dist/chunk-DVIRN42O.js +0 -707
- package/dist/chunk-DVIRN42O.js.map +0 -1
- package/dist/chunk-NGNEL4HS.js.map +0 -1
package/dist/chunk-DVIRN42O.js
DELETED
|
@@ -1,707 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__name
|
|
3
|
-
} from "./chunk-7QVYU63E.js";
|
|
4
|
-
|
|
5
|
-
// src/core/types.ts
|
|
6
|
-
var PROVIDER_ID_PATTERN = /^[A-Z][A-Z0-9_]*$/u;
|
|
7
|
-
|
|
8
|
-
// src/core/registry.ts
|
|
9
|
-
var MarketplaceAdapterRegistrationError = class extends Error {
|
|
10
|
-
static {
|
|
11
|
-
__name(this, "MarketplaceAdapterRegistrationError");
|
|
12
|
-
}
|
|
13
|
-
constructor(message) {
|
|
14
|
-
super(`@12-apps/marketplace: ${message}`);
|
|
15
|
-
this.name = "MarketplaceAdapterRegistrationError";
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
function assertReasons(adapter) {
|
|
19
|
-
const codes = /* @__PURE__ */ new Set();
|
|
20
|
-
for (const reason of adapter.cancellationReasons()) {
|
|
21
|
-
if (reason.code.trim() === "") {
|
|
22
|
-
throw new MarketplaceAdapterRegistrationError(`${adapter.provider} declares a reason with a blank code.`);
|
|
23
|
-
}
|
|
24
|
-
if (codes.has(reason.code)) {
|
|
25
|
-
throw new MarketplaceAdapterRegistrationError(
|
|
26
|
-
`${adapter.provider} declares the reason code "${reason.code}" twice.`
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
codes.add(reason.code);
|
|
30
|
-
}
|
|
31
|
-
if (adapter.capabilities.apiCancel && codes.size === 0) {
|
|
32
|
-
throw new MarketplaceAdapterRegistrationError(
|
|
33
|
-
`${adapter.provider} can cancel through its API but declares no reason to cancel with.`
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
__name(assertReasons, "assertReasons");
|
|
38
|
-
function createAdapterRegistry(adapters) {
|
|
39
|
-
if (adapters.length === 0) {
|
|
40
|
-
throw new MarketplaceAdapterRegistrationError("an engine needs at least one adapter.");
|
|
41
|
-
}
|
|
42
|
-
const byProvider = /* @__PURE__ */ new Map();
|
|
43
|
-
for (const adapter of adapters) {
|
|
44
|
-
if (!PROVIDER_ID_PATTERN.test(adapter.provider)) {
|
|
45
|
-
throw new MarketplaceAdapterRegistrationError(
|
|
46
|
-
`provider id "${adapter.provider}" must be uppercase letters, digits and underscores.`
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
if (byProvider.has(adapter.provider)) {
|
|
50
|
-
throw new MarketplaceAdapterRegistrationError(`two adapters claim "${adapter.provider}".`);
|
|
51
|
-
}
|
|
52
|
-
assertReasons(adapter);
|
|
53
|
-
byProvider.set(adapter.provider, adapter);
|
|
54
|
-
}
|
|
55
|
-
const providers = [...byProvider.keys()];
|
|
56
|
-
return {
|
|
57
|
-
get: /* @__PURE__ */ __name((provider) => byProvider.get(provider) ?? null, "get"),
|
|
58
|
-
has: /* @__PURE__ */ __name((provider) => byProvider.has(provider), "has"),
|
|
59
|
-
providers: /* @__PURE__ */ __name(() => providers, "providers")
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
__name(createAdapterRegistry, "createAdapterRegistry");
|
|
63
|
-
function resolveReason(adapter, code) {
|
|
64
|
-
const reasons = adapter.cancellationReasons();
|
|
65
|
-
if (code === null || code === void 0) return reasons[0] ?? null;
|
|
66
|
-
return reasons.find((reason) => reason.code === code) ?? null;
|
|
67
|
-
}
|
|
68
|
-
__name(resolveReason, "resolveReason");
|
|
69
|
-
function suggestReason(adapter, input) {
|
|
70
|
-
const reasons = adapter.cancellationReasons();
|
|
71
|
-
if (input.itemUnavailable) {
|
|
72
|
-
const unavailable = reasons.find((reason) => reason.itemUnavailable);
|
|
73
|
-
if (unavailable) return unavailable;
|
|
74
|
-
}
|
|
75
|
-
return reasons[0] ?? null;
|
|
76
|
-
}
|
|
77
|
-
__name(suggestReason, "suggestReason");
|
|
78
|
-
|
|
79
|
-
// src/core/outbound-queue.ts
|
|
80
|
-
var MARKETPLACE_OUTBOUND_JOB = "marketplace.outbound";
|
|
81
|
-
function outboundDedupeKey(payload) {
|
|
82
|
-
return `${MARKETPLACE_OUTBOUND_JOB}:${payload.action}:${payload.orderId}`;
|
|
83
|
-
}
|
|
84
|
-
__name(outboundDedupeKey, "outboundDedupeKey");
|
|
85
|
-
async function enqueueOutbound(ctx, payload, provider, dedupeKey = outboundDedupeKey(payload)) {
|
|
86
|
-
const adapter = ctx.registry.get(provider);
|
|
87
|
-
if (!adapter) return false;
|
|
88
|
-
const able = payload.action === "confirm" ? adapter.capabilities.apiConfirm : adapter.capabilities.apiCancel;
|
|
89
|
-
if (!able) return false;
|
|
90
|
-
const outcome = await ctx.ports.enqueue.enqueue(MARKETPLACE_OUTBOUND_JOB, payload, { dedupeKey });
|
|
91
|
-
if (!outcome.enqueued) {
|
|
92
|
-
ctx.ports.logger.warn(
|
|
93
|
-
`${MARKETPLACE_OUTBOUND_JOB}: ${payload.action} for order ${payload.orderId} was not queued; the outbound sweep will re-queue it` + (outcome.reason ? ` (${outcome.reason})` : "")
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
return outcome.enqueued;
|
|
97
|
-
}
|
|
98
|
-
__name(enqueueOutbound, "enqueueOutbound");
|
|
99
|
-
|
|
100
|
-
// src/core/cancellation-outcome.ts
|
|
101
|
-
async function tell(ctx, what, orderId, call) {
|
|
102
|
-
try {
|
|
103
|
-
await call();
|
|
104
|
-
} catch (error) {
|
|
105
|
-
ctx.ports.logger.error(
|
|
106
|
-
`marketplace.cancellation: order ${orderId} ${what} but the host's half failed: ` + (error instanceof Error ? error.message : String(error))
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
__name(tell, "tell");
|
|
111
|
-
function requestsFirst(ctx) {
|
|
112
|
-
return ctx.ports.order.onCancellationConfirmed !== void 0;
|
|
113
|
-
}
|
|
114
|
-
__name(requestsFirst, "requestsFirst");
|
|
115
|
-
async function rejectConfirmed(db, orderId, now) {
|
|
116
|
-
await db.marketplaceAcceptance.updateMany({
|
|
117
|
-
where: { orderId, status: "AWAITING" },
|
|
118
|
-
data: { status: "REJECTED", acknowledgedAt: now }
|
|
119
|
-
});
|
|
120
|
-
await db.marketplaceAcceptance.updateMany({
|
|
121
|
-
where: { orderId, status: { in: ["ACCEPTED", "EXPIRED"] } },
|
|
122
|
-
data: { status: "REJECTED" }
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
__name(rejectConfirmed, "rejectConfirmed");
|
|
126
|
-
async function confirmedToHost(ctx, clientId, orderId) {
|
|
127
|
-
if (await tellCancellationConfirmed(ctx, clientId, orderId)) return;
|
|
128
|
-
await ctx.ports.order.onRefused(clientId, orderId, "CANCELLED");
|
|
129
|
-
}
|
|
130
|
-
__name(confirmedToHost, "confirmedToHost");
|
|
131
|
-
async function tellCancellationConfirmed(ctx, clientId, orderId) {
|
|
132
|
-
const hook = ctx.ports.order.onCancellationConfirmed;
|
|
133
|
-
if (!hook) return false;
|
|
134
|
-
await tell(ctx, "was cancelled on the store's request", orderId, () => hook.call(ctx.ports.order, clientId, orderId));
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
__name(tellCancellationConfirmed, "tellCancellationConfirmed");
|
|
138
|
-
async function tellCancellationFailed(ctx, clientId, orderId, reason) {
|
|
139
|
-
const hook = ctx.ports.order.onCancellationFailed;
|
|
140
|
-
if (!hook) return;
|
|
141
|
-
await tell(
|
|
142
|
-
ctx,
|
|
143
|
-
`had its cancellation request fail (${reason})`,
|
|
144
|
-
orderId,
|
|
145
|
-
() => hook.call(ctx.ports.order, clientId, orderId, reason)
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
__name(tellCancellationFailed, "tellCancellationFailed");
|
|
149
|
-
function cancellationWindowMs(ctx, adapter) {
|
|
150
|
-
return ctx.ports.cancellationWindowMs ?? adapter.capabilities.cancellationAnswerWindowMs ?? null;
|
|
151
|
-
}
|
|
152
|
-
__name(cancellationWindowMs, "cancellationWindowMs");
|
|
153
|
-
function failedRequestData(reason) {
|
|
154
|
-
return { cancellationStatus: "FAILED", cancellationFailureReason: reason };
|
|
155
|
-
}
|
|
156
|
-
__name(failedRequestData, "failedRequestData");
|
|
157
|
-
|
|
158
|
-
// src/core/cancellation.ts
|
|
159
|
-
function noStandingRequest(cancellationStatus) {
|
|
160
|
-
return cancellationStatus === null || cancellationStatus === "FAILED";
|
|
161
|
-
}
|
|
162
|
-
__name(noStandingRequest, "noStandingRequest");
|
|
163
|
-
var NO_STANDING_REQUEST = { OR: [{ cancellationStatus: null }, { cancellationStatus: "FAILED" }] };
|
|
164
|
-
var CLAIM_SELECT = {
|
|
165
|
-
orderId: true,
|
|
166
|
-
provider: true,
|
|
167
|
-
status: true,
|
|
168
|
-
cancellationStatus: true,
|
|
169
|
-
lineSkus: true
|
|
170
|
-
};
|
|
171
|
-
function notPendingProblem(row, path, allowed = ["AWAITING"]) {
|
|
172
|
-
if (!row) return { path: [...path, "orderId"], code: "NOT_FOUND" };
|
|
173
|
-
if (allowed.includes(row.status) && noStandingRequest(row.cancellationStatus)) return null;
|
|
174
|
-
const status = row.status;
|
|
175
|
-
return { path: [...path, "orderId"], code: status === "EXPIRED" ? "EXPIRED" : "ALREADY_DECIDED", status };
|
|
176
|
-
}
|
|
177
|
-
__name(notPendingProblem, "notPendingProblem");
|
|
178
|
-
function lineSkusOf(row) {
|
|
179
|
-
return Array.isArray(row.lineSkus) ? new Set(row.lineSkus.map(String)) : null;
|
|
180
|
-
}
|
|
181
|
-
__name(lineSkusOf, "lineSkusOf");
|
|
182
|
-
function skuProblems(reason, skus, row, path) {
|
|
183
|
-
if (reason?.needsItems && skus.length === 0) return [{ path: [...path, "offendingSkus"], code: "ITEMS_REQUIRED" }];
|
|
184
|
-
const known = lineSkusOf(row);
|
|
185
|
-
if (!known) return [];
|
|
186
|
-
return skus.flatMap(
|
|
187
|
-
(sku, index) => known.has(sku) ? [] : [{ path: [...path, "offendingSkus", index], code: "UNKNOWN_ITEM" }]
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
__name(skuProblems, "skuProblems");
|
|
191
|
-
function invalidReasonProblem(adapter, reason, code, path) {
|
|
192
|
-
if (code === null || code === void 0 || reason) return null;
|
|
193
|
-
const validCodes = adapter.cancellationReasons().map((candidate) => candidate.code);
|
|
194
|
-
return { path: [...path, "reasonCode"], code: "INVALID_REASON", validCodes };
|
|
195
|
-
}
|
|
196
|
-
__name(invalidReasonProblem, "invalidReasonProblem");
|
|
197
|
-
function planCancellation(adapter, input, row, path) {
|
|
198
|
-
if (!adapter) return { status: null, reason: null, skus: [] };
|
|
199
|
-
const reason = resolveReason(adapter, input.reasonCode);
|
|
200
|
-
const invalid = invalidReasonProblem(adapter, reason, input.reasonCode, path);
|
|
201
|
-
if (invalid) return [invalid];
|
|
202
|
-
const skus = [...new Set(input.offendingSkus ?? [])];
|
|
203
|
-
const problems = skuProblems(reason, skus, row, path);
|
|
204
|
-
if (problems.length > 0) return problems;
|
|
205
|
-
const { apiCancel, cancelAfterAccept } = adapter.capabilities;
|
|
206
|
-
const canAsk = apiCancel && reason !== null && (row.status === "AWAITING" || cancelAfterAccept);
|
|
207
|
-
return { status: canAsk ? "PENDING" : "FAILED", reason, skus };
|
|
208
|
-
}
|
|
209
|
-
__name(planCancellation, "planCancellation");
|
|
210
|
-
function refusalData(plan, fromStatus, now) {
|
|
211
|
-
return {
|
|
212
|
-
status: "REJECTED",
|
|
213
|
-
// An accepted row keeps the instant it was accepted; a row leaving the
|
|
214
|
-
// clock is acknowledged now (the table's CHECK pairs the two).
|
|
215
|
-
...fromStatus === "AWAITING" ? { acknowledgedAt: now } : {},
|
|
216
|
-
cancellationStatus: plan.status,
|
|
217
|
-
cancellationReasonCode: plan.reason?.code ?? null,
|
|
218
|
-
cancellationOffendingSkus: plan.skus.length > 0 ? plan.skus : null,
|
|
219
|
-
cancellationRequestedAt: plan.status === "PENDING" ? now : null,
|
|
220
|
-
cancellationFailureReason: plan.status === "FAILED" ? "REFUSED" : null
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
__name(refusalData, "refusalData");
|
|
224
|
-
function requestData(plan, now) {
|
|
225
|
-
return {
|
|
226
|
-
cancellationStatus: plan.status,
|
|
227
|
-
cancellationReasonCode: plan.reason?.code ?? null,
|
|
228
|
-
cancellationOffendingSkus: plan.skus.length > 0 ? plan.skus : null,
|
|
229
|
-
cancellationRequestedAt: plan.status === "PENDING" ? now : null,
|
|
230
|
-
cancellationFailureReason: plan.status === "FAILED" ? "REFUSED" : null
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
__name(requestData, "requestData");
|
|
234
|
-
async function failCancellationRequest(ctx, input) {
|
|
235
|
-
const db = await ctx.ports.db();
|
|
236
|
-
const where = { clientId: input.clientId, provider: input.provider, externalOrderId: input.externalOrderId };
|
|
237
|
-
const row = await db.marketplaceAcceptance.findFirst({ where, select: { orderId: true } });
|
|
238
|
-
if (!row) return false;
|
|
239
|
-
const moved = await db.marketplaceAcceptance.updateMany({
|
|
240
|
-
where: { ...where, cancellationStatus: { in: ["PENDING", "REQUESTED"] } },
|
|
241
|
-
data: failedRequestData("REFUSED")
|
|
242
|
-
});
|
|
243
|
-
if (moved.count === 0) return false;
|
|
244
|
-
ctx.ports.publishChanged(input.clientId);
|
|
245
|
-
await tellCancellationFailed(ctx, input.clientId, row.orderId, "REFUSED");
|
|
246
|
-
return true;
|
|
247
|
-
}
|
|
248
|
-
__name(failCancellationRequest, "failCancellationRequest");
|
|
249
|
-
|
|
250
|
-
// src/core/outbound-sweep.ts
|
|
251
|
-
var OUTBOUND_STALE_MS = 10 * 6e4;
|
|
252
|
-
var OUTBOUND_GIVE_UP_MS = 24 * 60 * 6e4;
|
|
253
|
-
var WAITING = ["PENDING", "REQUESTED"];
|
|
254
|
-
var OWED_SELECT = { clientId: true, orderId: true, provider: true };
|
|
255
|
-
function sweepDedupeKey(action, orderId, now) {
|
|
256
|
-
return `${MARKETPLACE_OUTBOUND_JOB}:${action}:${orderId}:sweep:${now.getTime()}`;
|
|
257
|
-
}
|
|
258
|
-
__name(sweepDedupeKey, "sweepDedupeKey");
|
|
259
|
-
async function requeue(ctx, rows, action, now) {
|
|
260
|
-
let queued = 0;
|
|
261
|
-
for (const row of rows) {
|
|
262
|
-
const payload = { clientId: row.clientId, orderId: row.orderId, action };
|
|
263
|
-
if (await enqueueOutbound(ctx, payload, row.provider, sweepDedupeKey(action, row.orderId, now))) queued += 1;
|
|
264
|
-
}
|
|
265
|
-
return queued;
|
|
266
|
-
}
|
|
267
|
-
__name(requeue, "requeue");
|
|
268
|
-
async function failAsTimeout(ctx, rows) {
|
|
269
|
-
const db = await ctx.ports.db();
|
|
270
|
-
let failed = 0;
|
|
271
|
-
for (const row of rows) {
|
|
272
|
-
const moved = await db.marketplaceAcceptance.updateMany({
|
|
273
|
-
where: { orderId: row.orderId, clientId: row.clientId, cancellationStatus: { in: WAITING } },
|
|
274
|
-
data: failedRequestData("TIMEOUT")
|
|
275
|
-
});
|
|
276
|
-
if (moved.count === 0) continue;
|
|
277
|
-
failed += 1;
|
|
278
|
-
ctx.ports.publishChanged(row.clientId);
|
|
279
|
-
await tellCancellationFailed(ctx, row.clientId, row.orderId, "TIMEOUT");
|
|
280
|
-
}
|
|
281
|
-
return failed;
|
|
282
|
-
}
|
|
283
|
-
__name(failAsTimeout, "failAsTimeout");
|
|
284
|
-
async function waitingSince(ctx, cutoff, statuses, provider) {
|
|
285
|
-
const db = await ctx.ports.db();
|
|
286
|
-
return await db.marketplaceAcceptance.findMany({
|
|
287
|
-
where: { ...provider ? { provider } : {}, cancellationStatus: { in: statuses }, cancellationRequestedAt: { lt: cutoff } },
|
|
288
|
-
select: OWED_SELECT
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
__name(waitingSince, "waitingSince");
|
|
292
|
-
async function expireUnanswered(ctx, now) {
|
|
293
|
-
if (!requestsFirst(ctx)) return 0;
|
|
294
|
-
let expired = 0;
|
|
295
|
-
for (const provider of ctx.registry.providers()) {
|
|
296
|
-
const adapter = ctx.registry.get(provider);
|
|
297
|
-
const window = adapter ? cancellationWindowMs(ctx, adapter) : null;
|
|
298
|
-
if (window === null) continue;
|
|
299
|
-
const cutoff = new Date(now.getTime() - window);
|
|
300
|
-
expired += await failAsTimeout(ctx, await waitingSince(ctx, cutoff, WAITING, provider));
|
|
301
|
-
}
|
|
302
|
-
return expired;
|
|
303
|
-
}
|
|
304
|
-
__name(expireUnanswered, "expireUnanswered");
|
|
305
|
-
async function sweepOutbound(ctx, now) {
|
|
306
|
-
const db = await ctx.ports.db();
|
|
307
|
-
const stale = new Date(now.getTime() - OUTBOUND_STALE_MS);
|
|
308
|
-
const giveUp = new Date(now.getTime() - OUTBOUND_GIVE_UP_MS);
|
|
309
|
-
const timedOut = await expireUnanswered(ctx, now);
|
|
310
|
-
const givenUp = await failAsTimeout(ctx, await waitingSince(ctx, giveUp, requestsFirst(ctx) ? WAITING : ["PENDING"]));
|
|
311
|
-
const cancellations = await db.marketplaceAcceptance.findMany({
|
|
312
|
-
where: { cancellationStatus: "PENDING", cancellationRequestedAt: { lt: stale, gte: giveUp } },
|
|
313
|
-
select: OWED_SELECT
|
|
314
|
-
});
|
|
315
|
-
const confirms = await db.marketplaceAcceptance.findMany({
|
|
316
|
-
where: {
|
|
317
|
-
status: "ACCEPTED",
|
|
318
|
-
confirmedAt: null,
|
|
319
|
-
confirmFailedAt: null,
|
|
320
|
-
acknowledgedAt: { lt: stale, gte: giveUp },
|
|
321
|
-
// An accept the store asked to cancel is not confirmed while the request waits.
|
|
322
|
-
...NO_STANDING_REQUEST
|
|
323
|
-
},
|
|
324
|
-
select: OWED_SELECT
|
|
325
|
-
});
|
|
326
|
-
const requeued = await requeue(ctx, cancellations, "requestCancellation", now) + await requeue(ctx, confirms, "confirm", now);
|
|
327
|
-
if (givenUp > 0) ctx.ports.logger.error(`marketplace.outbound-sweep: gave up on ${givenUp} cancellation request(s).`);
|
|
328
|
-
return { requeued, givenUp, timedOut };
|
|
329
|
-
}
|
|
330
|
-
__name(sweepOutbound, "sweepOutbound");
|
|
331
|
-
|
|
332
|
-
// src/core/integration.ts
|
|
333
|
-
var VIEW_SELECT = {
|
|
334
|
-
provider: true,
|
|
335
|
-
enabled: true,
|
|
336
|
-
environment: true,
|
|
337
|
-
status: true,
|
|
338
|
-
externalMerchantId: true,
|
|
339
|
-
autoAccept: true,
|
|
340
|
-
ackSlaSeconds: true,
|
|
341
|
-
credentials: true,
|
|
342
|
-
lastEventAt: true,
|
|
343
|
-
lastVerifiedAt: true,
|
|
344
|
-
archivedAt: true
|
|
345
|
-
};
|
|
346
|
-
function toView(row) {
|
|
347
|
-
return {
|
|
348
|
-
provider: row.provider,
|
|
349
|
-
enabled: row.enabled,
|
|
350
|
-
environment: row.environment,
|
|
351
|
-
status: row.status,
|
|
352
|
-
externalMerchantId: row.externalMerchantId,
|
|
353
|
-
autoAccept: row.autoAccept,
|
|
354
|
-
ackSlaSeconds: row.ackSlaSeconds,
|
|
355
|
-
connected: row.credentials !== "",
|
|
356
|
-
lastEventAt: row.lastEventAt,
|
|
357
|
-
lastVerifiedAt: row.lastVerifiedAt,
|
|
358
|
-
archivedAt: row.archivedAt ?? null
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
__name(toView, "toView");
|
|
362
|
-
async function listMarketplaceIntegrations(ctx, clientId, options = {}) {
|
|
363
|
-
const db = await ctx.ports.db();
|
|
364
|
-
const rows = await db.marketplaceIntegration.findMany({
|
|
365
|
-
where: {
|
|
366
|
-
clientId,
|
|
367
|
-
...options.providers ? { provider: { in: [...options.providers] } } : {},
|
|
368
|
-
...options.includeArchived ? {} : { archivedAt: null }
|
|
369
|
-
},
|
|
370
|
-
select: VIEW_SELECT,
|
|
371
|
-
orderBy: { provider: "asc" }
|
|
372
|
-
});
|
|
373
|
-
return rows.map(toView);
|
|
374
|
-
}
|
|
375
|
-
__name(listMarketplaceIntegrations, "listMarketplaceIntegrations");
|
|
376
|
-
async function saveMarketplaceIntegration(ctx, input, db) {
|
|
377
|
-
const sealed = input.credentials ? ctx.ports.secrets.seal(JSON.stringify(input.credentials)) : void 0;
|
|
378
|
-
const mutable = {
|
|
379
|
-
...input.enabled === void 0 ? {} : { enabled: input.enabled },
|
|
380
|
-
...input.environment === void 0 ? {} : { environment: input.environment },
|
|
381
|
-
...input.externalMerchantId === void 0 ? {} : { externalMerchantId: input.externalMerchantId },
|
|
382
|
-
...input.autoAccept === void 0 ? {} : { autoAccept: input.autoAccept },
|
|
383
|
-
...input.ackSlaSeconds === void 0 ? {} : { ackSlaSeconds: input.ackSlaSeconds },
|
|
384
|
-
...sealed === void 0 ? {} : { credentials: sealed, status: "UNVERIFIED" }
|
|
385
|
-
};
|
|
386
|
-
const row = await db.marketplaceIntegration.upsert({
|
|
387
|
-
where: { clientId_provider: { clientId: input.clientId, provider: input.provider } },
|
|
388
|
-
create: {
|
|
389
|
-
clientId: input.clientId,
|
|
390
|
-
provider: input.provider,
|
|
391
|
-
credentials: sealed ?? "",
|
|
392
|
-
ackSlaSeconds: ctx.ports.defaultAckSlaSeconds,
|
|
393
|
-
...mutable
|
|
394
|
-
},
|
|
395
|
-
update: mutable,
|
|
396
|
-
select: VIEW_SELECT
|
|
397
|
-
});
|
|
398
|
-
return toView(row);
|
|
399
|
-
}
|
|
400
|
-
__name(saveMarketplaceIntegration, "saveMarketplaceIntegration");
|
|
401
|
-
async function resolveIngestionTarget(ctx, clientId, provider) {
|
|
402
|
-
const db = await ctx.ports.db();
|
|
403
|
-
const row = await db.marketplaceIntegration.findUnique({
|
|
404
|
-
where: { clientId_provider: { clientId, provider } },
|
|
405
|
-
select: { enabled: true, autoAccept: true, ackSlaSeconds: true, credentials: true, archivedAt: true }
|
|
406
|
-
});
|
|
407
|
-
if (!row || row.archivedAt) return null;
|
|
408
|
-
return {
|
|
409
|
-
enabled: row.enabled,
|
|
410
|
-
autoAccept: row.autoAccept,
|
|
411
|
-
ackSlaSeconds: row.ackSlaSeconds,
|
|
412
|
-
// An unopenable blob must not read as "no secret configured" — that would
|
|
413
|
-
// turn a key-rotation problem into an endpoint that accepts unsigned
|
|
414
|
-
// deliveries. The secrets port throws instead, and the caller answers 401.
|
|
415
|
-
webhookSecret: row.credentials === "" ? null : openCredentials(ctx, row.credentials).webhookSecret
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
__name(resolveIngestionTarget, "resolveIngestionTarget");
|
|
419
|
-
function openCredentials(ctx, sealed) {
|
|
420
|
-
const parsed = JSON.parse(ctx.ports.secrets.open(sealed));
|
|
421
|
-
if (typeof parsed !== "object" || parsed === null) {
|
|
422
|
-
throw new Error("Stored marketplace credentials are not an object.");
|
|
423
|
-
}
|
|
424
|
-
const record = parsed;
|
|
425
|
-
return {
|
|
426
|
-
clientId: String(record.clientId ?? ""),
|
|
427
|
-
clientSecret: String(record.clientSecret ?? ""),
|
|
428
|
-
webhookSecret: record.webhookSecret ? String(record.webhookSecret) : null
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
__name(openCredentials, "openCredentials");
|
|
432
|
-
async function resolveTenantByMerchant(ctx, provider, externalMerchantId) {
|
|
433
|
-
const db = await ctx.ports.db();
|
|
434
|
-
const rows = await db.marketplaceIntegration.findMany({
|
|
435
|
-
where: { provider, externalMerchantId, archivedAt: null },
|
|
436
|
-
select: { clientId: true },
|
|
437
|
-
take: 1
|
|
438
|
-
});
|
|
439
|
-
return rows[0]?.clientId ?? null;
|
|
440
|
-
}
|
|
441
|
-
__name(resolveTenantByMerchant, "resolveTenantByMerchant");
|
|
442
|
-
async function markMarketplaceEventSeen(db, clientId, provider, at) {
|
|
443
|
-
await db.marketplaceIntegration.updateMany({
|
|
444
|
-
where: { clientId, provider },
|
|
445
|
-
data: { lastEventAt: at }
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
__name(markMarketplaceEventSeen, "markMarketplaceEventSeen");
|
|
449
|
-
async function readOutboundConnection(ctx, clientId, provider) {
|
|
450
|
-
const db = await ctx.ports.db();
|
|
451
|
-
const row = await db.marketplaceIntegration.findUnique({
|
|
452
|
-
where: { clientId_provider: { clientId, provider } },
|
|
453
|
-
select: { environment: true, credentials: true }
|
|
454
|
-
});
|
|
455
|
-
if (!row || row.credentials === "") return null;
|
|
456
|
-
return {
|
|
457
|
-
environment: row.environment === "PRODUCTION" ? "PRODUCTION" : "SANDBOX",
|
|
458
|
-
credentials: openCredentials(ctx, row.credentials)
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
__name(readOutboundConnection, "readOutboundConnection");
|
|
462
|
-
|
|
463
|
-
// src/core/outbound.ts
|
|
464
|
-
var OutboundRetryError = class extends Error {
|
|
465
|
-
static {
|
|
466
|
-
__name(this, "OutboundRetryError");
|
|
467
|
-
}
|
|
468
|
-
constructor(message) {
|
|
469
|
-
super(message);
|
|
470
|
-
this.name = "OutboundRetryError";
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
var ROW_SELECT = {
|
|
474
|
-
orderId: true,
|
|
475
|
-
provider: true,
|
|
476
|
-
externalOrderId: true,
|
|
477
|
-
externalDisplayId: true,
|
|
478
|
-
status: true,
|
|
479
|
-
confirmedAt: true,
|
|
480
|
-
confirmFailedAt: true,
|
|
481
|
-
cancellationStatus: true,
|
|
482
|
-
cancellationReasonCode: true,
|
|
483
|
-
cancellationOffendingSkus: true,
|
|
484
|
-
cancellationRequestedAt: true,
|
|
485
|
-
preparationMinutes: true,
|
|
486
|
-
createdAt: true
|
|
487
|
-
};
|
|
488
|
-
function refOf(row) {
|
|
489
|
-
return {
|
|
490
|
-
externalOrderId: row.externalOrderId,
|
|
491
|
-
externalDisplayId: row.externalDisplayId,
|
|
492
|
-
hostOrderCode: row.orderId,
|
|
493
|
-
placedAt: row.createdAt
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
__name(refOf, "refOf");
|
|
497
|
-
function confirmSkip(row, adapter) {
|
|
498
|
-
if (row.status !== "ACCEPTED") return `the order is ${row.status}, not ACCEPTED`;
|
|
499
|
-
if (row.cancellationStatus !== null && row.cancellationStatus !== "FAILED") {
|
|
500
|
-
return `a cancellation request is ${row.cancellationStatus}`;
|
|
501
|
-
}
|
|
502
|
-
if (row.confirmedAt || row.confirmFailedAt) return "the confirm is already stamped";
|
|
503
|
-
if (!adapter.capabilities.apiConfirm) return "the marketplace has no confirm API";
|
|
504
|
-
return null;
|
|
505
|
-
}
|
|
506
|
-
__name(confirmSkip, "confirmSkip");
|
|
507
|
-
async function stampConfirm(ctx, row, succeeded, now) {
|
|
508
|
-
const db = await ctx.ports.db();
|
|
509
|
-
await db.marketplaceAcceptance.updateMany({
|
|
510
|
-
where: { orderId: row.orderId, confirmedAt: null, confirmFailedAt: null },
|
|
511
|
-
data: succeeded ? { confirmedAt: now } : { confirmFailedAt: now }
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
__name(stampConfirm, "stampConfirm");
|
|
515
|
-
async function stampCancellation(ctx, row, status, clientId) {
|
|
516
|
-
if (status === "CONFIRMED") return stampConfirmedCancellation(ctx, row, clientId);
|
|
517
|
-
const db = await ctx.ports.db();
|
|
518
|
-
const data = status === "FAILED" ? failedRequestData("REFUSED") : { cancellationStatus: status };
|
|
519
|
-
const moved = await db.marketplaceAcceptance.updateMany({
|
|
520
|
-
where: { orderId: row.orderId, cancellationStatus: "PENDING" },
|
|
521
|
-
data
|
|
522
|
-
});
|
|
523
|
-
if (moved.count > 0 && status === "FAILED") await tellCancellationFailed(ctx, clientId, row.orderId, "REFUSED");
|
|
524
|
-
}
|
|
525
|
-
__name(stampCancellation, "stampCancellation");
|
|
526
|
-
async function stampConfirmedCancellation(ctx, row, clientId) {
|
|
527
|
-
const now = ctx.ports.clock.now();
|
|
528
|
-
const moved = await ctx.ports.transaction(async (tx) => {
|
|
529
|
-
const confirmed = await tx.marketplaceAcceptance.updateMany({
|
|
530
|
-
where: { orderId: row.orderId, cancellationStatus: { in: ["PENDING", "FAILED"] } },
|
|
531
|
-
data: { cancellationStatus: "CONFIRMED", cancellationFailureReason: null }
|
|
532
|
-
});
|
|
533
|
-
if (confirmed.count === 0) return false;
|
|
534
|
-
await rejectConfirmed(tx, row.orderId, now);
|
|
535
|
-
return true;
|
|
536
|
-
});
|
|
537
|
-
if (!moved) return;
|
|
538
|
-
try {
|
|
539
|
-
await confirmedToHost(ctx, clientId, row.orderId);
|
|
540
|
-
} catch (error) {
|
|
541
|
-
ctx.ports.logger.error(
|
|
542
|
-
`marketplace.outbound: order ${row.orderId} was cancelled on the store's request but the host's half failed: ` + (error instanceof Error ? error.message : String(error))
|
|
543
|
-
);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
__name(stampConfirmedCancellation, "stampConfirmedCancellation");
|
|
547
|
-
async function connectionFor(ctx, clientId, provider) {
|
|
548
|
-
try {
|
|
549
|
-
return await readOutboundConnection(ctx, clientId, provider) ?? "no credentials on file";
|
|
550
|
-
} catch (error) {
|
|
551
|
-
return `credentials do not open: ${error instanceof Error ? error.message : String(error)}`;
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
__name(connectionFor, "connectionFor");
|
|
555
|
-
async function settle(ctx, payload, row, result, attempt, succeed, fail) {
|
|
556
|
-
if (result.kind === "accepted") {
|
|
557
|
-
await succeed();
|
|
558
|
-
ctx.ports.publishChanged(payload.clientId);
|
|
559
|
-
return { kind: "done", action: payload.action };
|
|
560
|
-
}
|
|
561
|
-
const reason = result.kind === "refused" ? `refused ${result.status}: ${result.message}` : result.reason;
|
|
562
|
-
if (result.kind === "retry" && attempt.attempt < attempt.maxAttempts) {
|
|
563
|
-
throw new OutboundRetryError(`${payload.action} for order ${row.orderId}: ${reason}`);
|
|
564
|
-
}
|
|
565
|
-
await fail();
|
|
566
|
-
ctx.ports.logger.error(`marketplace.outbound: ${payload.action} for order ${row.orderId} failed: ${reason}`);
|
|
567
|
-
ctx.ports.publishChanged(payload.clientId);
|
|
568
|
-
return { kind: "failed", action: payload.action, reason };
|
|
569
|
-
}
|
|
570
|
-
__name(settle, "settle");
|
|
571
|
-
async function runConfirm(ctx, payload, row, adapter, attempt) {
|
|
572
|
-
const skip = confirmSkip(row, adapter);
|
|
573
|
-
if (skip) return { kind: "skipped", reason: skip };
|
|
574
|
-
const now = ctx.ports.clock.now();
|
|
575
|
-
const connection = await connectionFor(ctx, payload.clientId, row.provider);
|
|
576
|
-
const result = typeof connection === "string" ? { kind: "refused", status: 0, message: connection } : await adapter.confirm(
|
|
577
|
-
{ http: ctx.ports.http, tokens: ctx.tokens, now, ...connection },
|
|
578
|
-
refOf(row),
|
|
579
|
-
// The stated preparation time, for a marketplace whose confirm takes one.
|
|
580
|
-
{ preparationMinutes: adapter.capabilities.confirmTakesPreparationTime ? row.preparationMinutes : null }
|
|
581
|
-
);
|
|
582
|
-
return settle(
|
|
583
|
-
ctx,
|
|
584
|
-
payload,
|
|
585
|
-
row,
|
|
586
|
-
result,
|
|
587
|
-
attempt,
|
|
588
|
-
() => stampConfirm(ctx, row, true, now),
|
|
589
|
-
() => stampConfirm(ctx, row, false, now)
|
|
590
|
-
);
|
|
591
|
-
}
|
|
592
|
-
__name(runConfirm, "runConfirm");
|
|
593
|
-
function pastWindow(ctx, row, adapter) {
|
|
594
|
-
if (!requestsFirst(ctx)) return false;
|
|
595
|
-
const window = cancellationWindowMs(ctx, adapter);
|
|
596
|
-
if (window === null || row.cancellationRequestedAt === null) return false;
|
|
597
|
-
return ctx.ports.clock.now().getTime() - row.cancellationRequestedAt.getTime() > window;
|
|
598
|
-
}
|
|
599
|
-
__name(pastWindow, "pastWindow");
|
|
600
|
-
function skusOf(row) {
|
|
601
|
-
return Array.isArray(row.cancellationOffendingSkus) ? row.cancellationOffendingSkus.map(String) : [];
|
|
602
|
-
}
|
|
603
|
-
__name(skusOf, "skusOf");
|
|
604
|
-
async function runCancellation(ctx, payload, row, adapter, attempt) {
|
|
605
|
-
if (row.cancellationStatus !== "PENDING") {
|
|
606
|
-
return { kind: "skipped", reason: `the request is ${row.cancellationStatus ?? "absent"}, not PENDING` };
|
|
607
|
-
}
|
|
608
|
-
if (pastWindow(ctx, row, adapter)) {
|
|
609
|
-
await failAsTimeout(ctx, [{ clientId: payload.clientId, orderId: row.orderId, provider: row.provider }]);
|
|
610
|
-
return { kind: "failed", action: payload.action, reason: "past the marketplace's answer window" };
|
|
611
|
-
}
|
|
612
|
-
const reason = resolveReason(adapter, row.cancellationReasonCode);
|
|
613
|
-
const connection = await connectionFor(ctx, payload.clientId, row.provider);
|
|
614
|
-
let result;
|
|
615
|
-
if (!reason) result = { kind: "refused", status: 0, message: "the stored reason is not the marketplace's" };
|
|
616
|
-
else if (typeof connection === "string") result = { kind: "refused", status: 0, message: connection };
|
|
617
|
-
else {
|
|
618
|
-
result = await adapter.requestCancellation(
|
|
619
|
-
{ http: ctx.ports.http, tokens: ctx.tokens, now: ctx.ports.clock.now(), ...connection },
|
|
620
|
-
refOf(row),
|
|
621
|
-
{ reason, text: "", mode: "MANUAL", offendingSkus: skusOf(row) }
|
|
622
|
-
);
|
|
623
|
-
}
|
|
624
|
-
const taken = adapter.capabilities.asyncCancellationOutcome ? "REQUESTED" : "CONFIRMED";
|
|
625
|
-
return settle(
|
|
626
|
-
ctx,
|
|
627
|
-
payload,
|
|
628
|
-
row,
|
|
629
|
-
result,
|
|
630
|
-
attempt,
|
|
631
|
-
() => stampCancellation(ctx, row, taken, payload.clientId),
|
|
632
|
-
() => stampCancellation(ctx, row, "FAILED", payload.clientId)
|
|
633
|
-
);
|
|
634
|
-
}
|
|
635
|
-
__name(runCancellation, "runCancellation");
|
|
636
|
-
async function stampLastAttemptFailure(ctx, payload, error) {
|
|
637
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
638
|
-
const db = await ctx.ports.db();
|
|
639
|
-
const moved = await (payload.action === "confirm" ? db.marketplaceAcceptance.updateMany({
|
|
640
|
-
where: { orderId: payload.orderId, clientId: payload.clientId, confirmedAt: null, confirmFailedAt: null },
|
|
641
|
-
data: { confirmFailedAt: ctx.ports.clock.now() }
|
|
642
|
-
}) : db.marketplaceAcceptance.updateMany({
|
|
643
|
-
where: { orderId: payload.orderId, clientId: payload.clientId, cancellationStatus: "PENDING" },
|
|
644
|
-
data: failedRequestData("REFUSED")
|
|
645
|
-
}));
|
|
646
|
-
ctx.ports.logger.error(`marketplace.outbound: ${payload.action} for order ${payload.orderId} failed: ${reason}`);
|
|
647
|
-
ctx.ports.publishChanged(payload.clientId);
|
|
648
|
-
if (payload.action === "requestCancellation" && moved.count > 0) {
|
|
649
|
-
await tellCancellationFailed(ctx, payload.clientId, payload.orderId, "REFUSED");
|
|
650
|
-
}
|
|
651
|
-
return { kind: "failed", action: payload.action, reason };
|
|
652
|
-
}
|
|
653
|
-
__name(stampLastAttemptFailure, "stampLastAttemptFailure");
|
|
654
|
-
async function runOnce(ctx, payload, attempt) {
|
|
655
|
-
const db = await ctx.ports.db();
|
|
656
|
-
const row = await db.marketplaceAcceptance.findFirst({
|
|
657
|
-
where: { orderId: payload.orderId, clientId: payload.clientId },
|
|
658
|
-
select: ROW_SELECT
|
|
659
|
-
});
|
|
660
|
-
if (!row) return { kind: "skipped", reason: "no acceptance for this order" };
|
|
661
|
-
const adapter = ctx.registry.get(row.provider);
|
|
662
|
-
if (!adapter) return { kind: "skipped", reason: `no adapter for ${row.provider}` };
|
|
663
|
-
return payload.action === "confirm" ? runConfirm(ctx, payload, row, adapter, attempt) : runCancellation(ctx, payload, row, adapter, attempt);
|
|
664
|
-
}
|
|
665
|
-
__name(runOnce, "runOnce");
|
|
666
|
-
async function runOutbound(ctx, payload, attempt) {
|
|
667
|
-
try {
|
|
668
|
-
return await runOnce(ctx, payload, attempt);
|
|
669
|
-
} catch (error) {
|
|
670
|
-
if (error instanceof OutboundRetryError || attempt.attempt < attempt.maxAttempts) throw error;
|
|
671
|
-
return stampLastAttemptFailure(ctx, payload, error);
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
__name(runOutbound, "runOutbound");
|
|
675
|
-
|
|
676
|
-
export {
|
|
677
|
-
requestsFirst,
|
|
678
|
-
rejectConfirmed,
|
|
679
|
-
tellCancellationConfirmed,
|
|
680
|
-
tellCancellationFailed,
|
|
681
|
-
PROVIDER_ID_PATTERN,
|
|
682
|
-
MarketplaceAdapterRegistrationError,
|
|
683
|
-
createAdapterRegistry,
|
|
684
|
-
resolveReason,
|
|
685
|
-
suggestReason,
|
|
686
|
-
NO_STANDING_REQUEST,
|
|
687
|
-
CLAIM_SELECT,
|
|
688
|
-
notPendingProblem,
|
|
689
|
-
planCancellation,
|
|
690
|
-
refusalData,
|
|
691
|
-
requestData,
|
|
692
|
-
failCancellationRequest,
|
|
693
|
-
listMarketplaceIntegrations,
|
|
694
|
-
saveMarketplaceIntegration,
|
|
695
|
-
resolveIngestionTarget,
|
|
696
|
-
resolveTenantByMerchant,
|
|
697
|
-
markMarketplaceEventSeen,
|
|
698
|
-
MARKETPLACE_OUTBOUND_JOB,
|
|
699
|
-
outboundDedupeKey,
|
|
700
|
-
enqueueOutbound,
|
|
701
|
-
OUTBOUND_STALE_MS,
|
|
702
|
-
OUTBOUND_GIVE_UP_MS,
|
|
703
|
-
sweepOutbound,
|
|
704
|
-
OutboundRetryError,
|
|
705
|
-
runOutbound
|
|
706
|
-
};
|
|
707
|
-
//# sourceMappingURL=chunk-DVIRN42O.js.map
|