@12-apps/marketplace 1.18.1 → 1.19.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 +12 -0
- package/README.md +1 -1
- package/dist/{chunk-BLHZ3MRB.js → chunk-RS2QKQ6S.js} +2 -2
- package/dist/{chunk-MDEIRGNL.js → chunk-S2ISELNJ.js} +113 -99
- package/dist/chunk-S2ISELNJ.js.map +1 -0
- package/dist/{engine-DRRhAjZK.d.ts → engine-CaiVufoP.d.ts} +29 -4
- package/dist/hono/index.d.ts +1 -1
- package/dist/hono/index.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/manifest/server.d.ts +1 -1
- package/dist/manifest/server.js +2 -2
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +2 -2
- package/package.json +1 -1
- package/src/core/bulk.ts +9 -4
- package/src/core/catalogue-job.ts +7 -3
- package/src/core/link-target-port.ts +27 -0
- package/src/core/menu-links.ts +21 -0
- package/src/core/ports.ts +3 -3
- package/src/index.ts +1 -0
- package/dist/chunk-MDEIRGNL.js.map +0 -1
- /package/dist/{chunk-BLHZ3MRB.js.map → chunk-RS2QKQ6S.js.map} +0 -0
|
@@ -17,6 +17,32 @@ type MarketplaceLifecycleAnswer = "moved" | "unchanged" | {
|
|
|
17
17
|
reason: string;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Where a menu link really points (FUT-6258). A host whose catalog lets one
|
|
22
|
+
* item be a variation of another can be handed an id that is the variation
|
|
23
|
+
* itself, with no variation named: a link stored that way names neither the
|
|
24
|
+
* item nor the variation the SKU means. The host answers where such an id
|
|
25
|
+
* points, and the engine stores that pair.
|
|
26
|
+
*/
|
|
27
|
+
/** A link's stored target: the catalog item, and the variation of it the SKU names. */
|
|
28
|
+
interface MarketplaceLinkTarget {
|
|
29
|
+
menuItemId: string;
|
|
30
|
+
variationId: string;
|
|
31
|
+
}
|
|
32
|
+
/** The order port's optional half for link targets. */
|
|
33
|
+
interface LinkTargetOrderPort {
|
|
34
|
+
/**
|
|
35
|
+
* OPTIONAL. Where a link naming these catalog ids with no variation really
|
|
36
|
+
* points: for each id that is a variation of another item, that item and the
|
|
37
|
+
* variation; an id left out is stored as named. Asked ONCE per write, in
|
|
38
|
+
* bulk, before every menu-link write the engine makes (`upsertMenuLinks`,
|
|
39
|
+
* `setMenuLink`, the publish auto-link); the answer is then checked as any
|
|
40
|
+
* named pair is (`catalogHas`, `catalogHasVariation`). Absent: every link is
|
|
41
|
+
* stored exactly as named.
|
|
42
|
+
*/
|
|
43
|
+
resolveLinkTarget?(clientId: string, subjectRefs: readonly string[]): Promise<ReadonlyMap<string, MarketplaceLinkTarget>>;
|
|
44
|
+
}
|
|
45
|
+
|
|
20
46
|
/**
|
|
21
47
|
* The order-side vocabulary the host's order port speaks: what a resolved line
|
|
22
48
|
* is, what the queue shows, what a person stated, and why an order or a
|
|
@@ -227,7 +253,7 @@ interface MarketplaceAdmissionRequest {
|
|
|
227
253
|
* transition has already been claimed and committed when they are called, and
|
|
228
254
|
* a host that fails its half must not un-decide the acceptance.
|
|
229
255
|
*/
|
|
230
|
-
interface MarketplaceOrderPort extends LogisticsOrderPort {
|
|
256
|
+
interface MarketplaceOrderPort extends LogisticsOrderPort, LinkTargetOrderPort {
|
|
231
257
|
/**
|
|
232
258
|
* Judge a decision BEFORE its claim commits, inside the claim's
|
|
233
259
|
* transaction: the stock check (and the draw) of an accept, anything the
|
|
@@ -240,8 +266,7 @@ interface MarketplaceOrderPort extends LogisticsOrderPort {
|
|
|
240
266
|
/**
|
|
241
267
|
* Turn a normalized order into whatever this host sells; hand back its id.
|
|
242
268
|
* `db` is the ingest's transaction client (the host's `transaction` port):
|
|
243
|
-
* write the order through it
|
|
244
|
-
* commit together or not at all.
|
|
269
|
+
* write the order through it: the order and the engine's acceptance row commit together or not at all.
|
|
245
270
|
*/
|
|
246
271
|
create(clientId: string, order: NormalizedMarketplaceOrder, lines: readonly ResolvedOrderLine[], db: MarketplaceDb): Promise<string>;
|
|
247
272
|
/** Does this catalog id exist and belong to this tenant? */
|
|
@@ -2086,4 +2111,4 @@ interface MarketplaceEngine extends MarketplaceCourierEngine, MarketplaceConform
|
|
|
2086
2111
|
*/
|
|
2087
2112
|
declare function createMarketplaceEngine(config: MarketplaceEngineConfig): MarketplaceEngine;
|
|
2088
2113
|
|
|
2089
|
-
export { type IngestionTarget as $, type AcceptanceDecision as A, type BulkProblem as B, type CancellationFailureReason as C, type CatalogueStatus as D, type CatalogueTarget as E, type DecideManyResult as F, type DecidedRow as G, type DecisionInput as H, type DecisionProblem as I, type DecisionProblemCode as J, type DecisionResult as K, type DeliveryOutcome as L, type DisputeAnswerInput as M, type DisputeAnswerJobPayload as N, type DisputeAnswerOutcome as O, DisputeAnswerRetryError as P, type DisputeAnswerView as Q, type DisputeRefusalCode as R, type DisputeRow as S, type DisputeStatus as T, type ExpirySweepResult as U, type FetchOrderJobPayload as V, type FetchOrderOutcome as W, FetchOrderRetryError as X, type InformStatusInput as Y, type IngestResult as Z, type IngestSettings as _, type AcceptanceStatus as a,
|
|
2114
|
+
export { type IngestionTarget as $, type AcceptanceDecision as A, type BulkProblem as B, type CancellationFailureReason as C, type CatalogueStatus as D, type CatalogueTarget as E, type DecideManyResult as F, type DecidedRow as G, type DecisionInput as H, type DecisionProblem as I, type DecisionProblemCode as J, type DecisionResult as K, type DeliveryOutcome as L, type DisputeAnswerInput as M, type DisputeAnswerJobPayload as N, type DisputeAnswerOutcome as O, DisputeAnswerRetryError as P, type DisputeAnswerView as Q, type DisputeRefusalCode as R, type DisputeRow as S, type DisputeStatus as T, type ExpirySweepResult as U, type FetchOrderJobPayload as V, type FetchOrderOutcome as W, FetchOrderRetryError as X, type InformStatusInput as Y, type IngestResult as Z, type IngestSettings as _, type AcceptanceStatus as a, type VerifyDeliveryCodeInput as a$, type IntegrationRowInput as a0, type LinkFailure as a1, type LinkFinished as a2, type LinkPendingView as a3, type LinkRefusalCode as a4, type LinkTargetOrderPort as a5, MARKETPLACE_ACKNOWLEDGE_JOB as a6, MARKETPLACE_AVAILABILITY_JOB as a7, MARKETPLACE_CANCELLATION_REASONS_JOB as a8, MARKETPLACE_CATALOGUE_JOB as a9, type MarketplaceOrderState as aA, type MarketplaceOrderSummary as aB, type MarketplacePorts as aC, type MarketplaceRefusal as aD, type MarketplaceSecretsPort as aE, type MenuLinkRowInput as aF, OUTBOUND_GIVE_UP_MS as aG, OUTBOUND_STALE_MS as aH, type OutboundAction as aI, type OutboundAttempt as aJ, type OutboundJobPayload as aK, type OutboundOutcome as aL, OutboundRetryError as aM, type OutboundSweepResult as aN, type PauseOutcome as aO, type PauseStoreInput as aP, type PauseStoreResult as aQ, type PendingAcceptance as aR, type PendingInboxEvent as aS, type ResolvedOrderLine as aT, type ResumeOutcome as aU, STORE_PAUSE_LEASE_MS as aV, type SaveMarketplaceIntegrationInput as aW, type StoreAvailabilityView as aX, type StorePauseFailureCode as aY, type StorePauseState as aZ, type StorePauseWanted as a_, MARKETPLACE_DISPUTE_ANSWER_JOB as aa, MARKETPLACE_FETCH_ORDER_JOB as ab, MARKETPLACE_OUTBOUND_JOB as ac, type MarketplaceAdmission as ad, type MarketplaceAdmissionRequest as ae, type MarketplaceAdmissionResult as af, type MarketplaceAuditEntry as ag, type MarketplaceAuditPort as ah, type MarketplaceAuthMode as ai, type MarketplaceCataloguePort as aj, type MarketplaceClockPort as ak, type MarketplaceConformityEngine as al, type MarketplaceDb as am, type MarketplaceDeliveryCodeEngine as an, type MarketplaceDisputeEngine as ao, type MarketplaceDisputeView as ap, type MarketplaceEngine as aq, type MarketplaceEngineConfig as ar, type MarketplaceEnqueuePort as as, type MarketplaceIntegrationView as at, type MarketplaceLifecycleAnswer as au, type MarketplaceLifecycleFacts as av, type MarketplaceLinkTarget as aw, type MarketplaceLogger as ax, type MarketplaceMenuLinkView as ay, type MarketplaceOrderPort as az, type AcknowledgeJobPayload as b, availabilityDedupeKey as b0, catalogueDedupeKey as b1, createMarketplaceEngine as b2, disputeView as b3, outboundDedupeKey as b4, type AcknowledgeOutcome as c, AcknowledgeRetryError as d, type AnswerDisputeResult as e, type AvailabilityJobPayload as f, type AvailabilityOutcome as g, AvailabilityRetryError as h, type AvailabilitySweepResult as i, type BulkProblemCode as j, type BulkResult as k, type CancellationReasonsJobPayload as l, type CancellationReasonsOutcome as m, CancellationReasonsRetryError as n, type CancellationStatus as o, type CatalogueAction as p, type CatalogueActionResult as q, type CatalogueDocumentResult as r, type CatalogueFailedAction as s, type CatalogueFailureCode as t, type CatalogueJobPayload as u, type CatalogueOutcome as v, type CataloguePublicationView as w, type CataloguePublishInput as x, type CatalogueRefusalCode as y, CatalogueRetryError as z };
|
package/dist/hono/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hono, Context } from 'hono';
|
|
2
2
|
import { ApiMarketplace, MarketplaceApiConfig, MarketplaceActor } from '../server/index.js';
|
|
3
|
-
import '../engine-
|
|
3
|
+
import '../engine-CaiVufoP.js';
|
|
4
4
|
import '../adapter-ZpAWKoCk.js';
|
|
5
5
|
import '@12-apps/wiring';
|
|
6
6
|
import 'zod';
|
package/dist/hono/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AcceptanceDecision, a as AcceptanceStatus, b as AcknowledgeJobPayload, c as AcknowledgeOutcome, d as AcknowledgeRetryError, e as AnswerDisputeResult, f as AvailabilityJobPayload, g as AvailabilityOutcome, h as AvailabilityRetryError, i as AvailabilitySweepResult, B as BulkProblem, j as BulkProblemCode, k as BulkResult, C as CancellationFailureReason, l as CancellationReasonsJobPayload, m as CancellationReasonsOutcome, n as CancellationReasonsRetryError, o as CancellationStatus, p as CatalogueAction, q as CatalogueActionResult, r as CatalogueDocumentResult, s as CatalogueFailedAction, t as CatalogueFailureCode, u as CatalogueJobPayload, v as CatalogueOutcome, w as CataloguePublicationView, x as CataloguePublishInput, y as CatalogueRefusalCode, z as CatalogueRetryError, D as CatalogueStatus, E as CatalogueTarget, F as DecideManyResult, G as DecidedRow, H as DecisionInput, I as DecisionProblem, J as DecisionProblemCode, K as DecisionResult, L as DeliveryOutcome, M as DisputeAnswerInput, N as DisputeAnswerJobPayload, O as DisputeAnswerOutcome, P as DisputeAnswerRetryError, Q as DisputeAnswerView, R as DisputeRefusalCode, S as DisputeRow, T as DisputeStatus, U as ExpirySweepResult, V as FetchOrderJobPayload, W as FetchOrderOutcome, X as FetchOrderRetryError, Y as InformStatusInput, Z as IngestResult, _ as IngestSettings, $ as IngestionTarget, a0 as IntegrationRowInput, a1 as LinkFailure, a2 as LinkFinished, a3 as LinkPendingView, a4 as LinkRefusalCode, a5 as
|
|
1
|
+
export { A as AcceptanceDecision, a as AcceptanceStatus, b as AcknowledgeJobPayload, c as AcknowledgeOutcome, d as AcknowledgeRetryError, e as AnswerDisputeResult, f as AvailabilityJobPayload, g as AvailabilityOutcome, h as AvailabilityRetryError, i as AvailabilitySweepResult, B as BulkProblem, j as BulkProblemCode, k as BulkResult, C as CancellationFailureReason, l as CancellationReasonsJobPayload, m as CancellationReasonsOutcome, n as CancellationReasonsRetryError, o as CancellationStatus, p as CatalogueAction, q as CatalogueActionResult, r as CatalogueDocumentResult, s as CatalogueFailedAction, t as CatalogueFailureCode, u as CatalogueJobPayload, v as CatalogueOutcome, w as CataloguePublicationView, x as CataloguePublishInput, y as CatalogueRefusalCode, z as CatalogueRetryError, D as CatalogueStatus, E as CatalogueTarget, F as DecideManyResult, G as DecidedRow, H as DecisionInput, I as DecisionProblem, J as DecisionProblemCode, K as DecisionResult, L as DeliveryOutcome, M as DisputeAnswerInput, N as DisputeAnswerJobPayload, O as DisputeAnswerOutcome, P as DisputeAnswerRetryError, Q as DisputeAnswerView, R as DisputeRefusalCode, S as DisputeRow, T as DisputeStatus, U as ExpirySweepResult, V as FetchOrderJobPayload, W as FetchOrderOutcome, X as FetchOrderRetryError, Y as InformStatusInput, Z as IngestResult, _ as IngestSettings, $ as IngestionTarget, a0 as IntegrationRowInput, a1 as LinkFailure, a2 as LinkFinished, a3 as LinkPendingView, a4 as LinkRefusalCode, a5 as LinkTargetOrderPort, a6 as MARKETPLACE_ACKNOWLEDGE_JOB, a7 as MARKETPLACE_AVAILABILITY_JOB, a8 as MARKETPLACE_CANCELLATION_REASONS_JOB, a9 as MARKETPLACE_CATALOGUE_JOB, aa as MARKETPLACE_DISPUTE_ANSWER_JOB, ab as MARKETPLACE_FETCH_ORDER_JOB, ac as MARKETPLACE_OUTBOUND_JOB, ad as MarketplaceAdmission, ae as MarketplaceAdmissionRequest, af as MarketplaceAdmissionResult, ag as MarketplaceAuditEntry, ah as MarketplaceAuditPort, ai as MarketplaceAuthMode, aj as MarketplaceCataloguePort, ak as MarketplaceClockPort, al as MarketplaceConformityEngine, am as MarketplaceDb, an as MarketplaceDeliveryCodeEngine, ao as MarketplaceDisputeEngine, ap as MarketplaceDisputeView, aq as MarketplaceEngine, ar as MarketplaceEngineConfig, as as MarketplaceEnqueuePort, at as MarketplaceIntegrationView, au as MarketplaceLifecycleAnswer, av as MarketplaceLifecycleFacts, aw as MarketplaceLinkTarget, ax as MarketplaceLogger, ay as MarketplaceMenuLinkView, az as MarketplaceOrderPort, aA as MarketplaceOrderState, aB as MarketplaceOrderSummary, aC as MarketplacePorts, aD as MarketplaceRefusal, aE as MarketplaceSecretsPort, aF as MenuLinkRowInput, aG as OUTBOUND_GIVE_UP_MS, aH as OUTBOUND_STALE_MS, aI as OutboundAction, aJ as OutboundAttempt, aK as OutboundJobPayload, aL as OutboundOutcome, aM as OutboundRetryError, aN as OutboundSweepResult, aO as PauseOutcome, aP as PauseStoreInput, aQ as PauseStoreResult, aR as PendingAcceptance, aS as PendingInboxEvent, aT as ResolvedOrderLine, aU as ResumeOutcome, aV as STORE_PAUSE_LEASE_MS, aW as SaveMarketplaceIntegrationInput, aX as StoreAvailabilityView, aY as StorePauseFailureCode, aZ as StorePauseState, a_ as StorePauseWanted, a$ as VerifyDeliveryCodeInput, b0 as availabilityDedupeKey, b1 as catalogueDedupeKey, b2 as createMarketplaceEngine, b3 as disputeView, b4 as outboundDedupeKey } from './engine-CaiVufoP.js';
|
|
2
2
|
import { c as MarketplaceAdapter, n as MarketplaceProvider, o as CancellationReason } from './adapter-ZpAWKoCk.js';
|
|
3
3
|
export { A as AdapterCallContext, p as AdapterGrant, q as AdapterTokenCache, r as AppLinkCallContext, s as CancellationOutcome, t as CancellationRequestInput, u as CatalogueCallContext, v as CatalogueFailure, w as CatalogueImage, x as CatalogueItem, e as CatalogueItemOut, y as CatalogueItemRef, C as CatalogueMenuEntry, b as CatalogueMenuOptions, z as CataloguePublishResult, B as CatalogueReadContext, D as CatalogueReadNotice, E as CatalogueReadRefusalCode, G as CatalogueReadResult, H as CatalogueReadWarning, I as CatalogueReadWarningCode, f as CatalogueReader, J as CatalogueSnapshot, K as CatalogueSnapshotCategory, L as CatalogueSnapshotItem, Q as CatalogueSnapshotOption, R as CatalogueSnapshotOptionGroup, T as CatalogueStoredImage, U as CatalogueWarningCode, V as CourierTrackingCallResult, W as CourierTrackingResult, X as DeliveryCodeAnswer, Y as DisputeAlternative, Z as DisputeAlternativeType, _ as DisputeAnswer, $ as DisputeAnswerResult, a0 as DisputeFailureCode, a1 as DisputeItem, a2 as DisputeOutcome, a3 as DisputeReason, F as FetchOrderResult, a4 as InformLogisticsInput, a5 as LOGISTICS_STEPS, a6 as LinkCallContext, a7 as LinkCode, a8 as LinkGrant, a9 as LinkResult, aa as LinkedMerchant, ab as LogisticsDriver, ac as LogisticsStep, ad as LogisticsVehicle, ae as MarketplaceAcknowledgement, af as MarketplaceAppCredentialsPort, h as MarketplaceAppLinking, M as MarketplaceAvailability, ag as MarketplaceCapabilities, ah as MarketplaceCatalogue, ai as MarketplaceCourier, aj as MarketplaceCourierAnswer, i as MarketplaceCourierApi, ak as MarketplaceCourierEngine, al as MarketplaceCourierFacts, am as MarketplaceCourierStep, an as MarketplaceCourierTracking, ao as MarketplaceCourierVehicle, ap as MarketplaceCredentials, aq as MarketplaceDeliveredBy, ar as MarketplaceDiscountSponsor, as as MarketplaceDisputeApi, at as MarketplaceDisputeChange, au as MarketplaceDisputeDelegate, av as MarketplaceHttp, aw as MarketplaceHttpRequest, ax as MarketplaceHttpResponse, ay as MarketplaceLifecycle, az as MarketplaceLinkAttemptDelegate, g as MarketplaceLinking, m as MarketplaceLogistics, aA as MarketplaceOrderType, aB as MarketplacePaymentMethod, aC as NormalizedAddress, aD as NormalizedBuyer, j as NormalizedCourierEvent, aE as NormalizedDisputeEvent, aF as NormalizedDisputeOpened, aG as NormalizedDisputeSettled, N as NormalizedEvent, aH as NormalizedLineOption, a as NormalizedMarketplaceOrder, aI as NormalizedOrderDiscount, aJ as NormalizedOrderFee, aK as NormalizedOrderLine, aL as NormalizedPaymentMethod, aM as NormalizedPayments, aN as OrderCancellationReason, aO as OrderCancellationReasonsResult, aP as OutboundOrderRef, O as OutboundResult, aQ as PROVIDER_ID_PATTERN, aR as PickupCodeCallResult, aS as PickupCodeValidation, aT as PresenceProbe, P as PullCatalogue, d as PushCatalogue, aU as StatusFacts, aV as StatusStep, l as StorePauseRef, S as StorePauseRequest, k as StorePauseResult, aW as ValidatePickupCodeInput, aX as answered, aY as centsFromMajor, aZ as normalizedLineTotalCents, a_ as outboundResultOf, a$ as tokenGrantResultOf } from './adapter-ZpAWKoCk.js';
|
|
4
4
|
|
package/dist/index.js
CHANGED
|
@@ -81,6 +81,7 @@ import {
|
|
|
81
81
|
requestsFirst,
|
|
82
82
|
requeueOwedFetch,
|
|
83
83
|
resolveIngestionTarget,
|
|
84
|
+
resolveLinkTargets,
|
|
84
85
|
resolveReason,
|
|
85
86
|
resolveTenantByMerchant,
|
|
86
87
|
runAcknowledge,
|
|
@@ -104,7 +105,7 @@ import {
|
|
|
104
105
|
upsertLink,
|
|
105
106
|
validatePickupCode,
|
|
106
107
|
viewOf
|
|
107
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-S2ISELNJ.js";
|
|
108
109
|
import {
|
|
109
110
|
centsFromMajor
|
|
110
111
|
} from "./chunk-WN2EK4KX.js";
|
|
@@ -329,12 +330,13 @@ async function upsertMenuLinks(ctx, input) {
|
|
|
329
330
|
...duplicates(input.rows, (row) => `${row.provider}\0${row.externalSku}`, "links", "externalSku"),
|
|
330
331
|
...unknownProviders(ctx, input.rows, "links")
|
|
331
332
|
];
|
|
332
|
-
|
|
333
|
+
const targets = await resolveLinkTargets(ctx, input.clientId, input.rows);
|
|
334
|
+
for (const [index, row] of targets.entries()) problems.push(...await linkRowProblems(ctx, input.clientId, row, index));
|
|
333
335
|
if (problems.length > 0) return { kind: "refused", problems };
|
|
334
336
|
const validateOnly = input.validateOnly === true;
|
|
335
337
|
const written = await inTransaction(ctx, validateOnly, async (db) => {
|
|
336
338
|
const rows = [];
|
|
337
|
-
for (const row of
|
|
339
|
+
for (const row of targets) rows.push(await upsertLink(db, { clientId: input.clientId, ...row }));
|
|
338
340
|
return rows;
|
|
339
341
|
});
|
|
340
342
|
return { kind: "saved", validateOnly, rows: written ?? [] };
|