@12-apps/marketplace 1.11.0 → 1.13.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 +134 -1
- package/README.md +49 -3
- package/dist/99food/index.d.ts +2 -2
- package/dist/99food/index.js +2 -2
- package/dist/{adapter-CD0SfdVS.d.ts → adapter-CQ4QiZPi.d.ts} +327 -174
- package/dist/{chunk-TVZU4HNT.js → chunk-4J2KJ3ZW.js} +1 -1
- package/dist/{chunk-TVZU4HNT.js.map → chunk-4J2KJ3ZW.js.map} +1 -1
- package/dist/{chunk-YWMEIMO3.js → chunk-CEWTV2TC.js} +176 -40
- package/dist/chunk-CEWTV2TC.js.map +1 -0
- package/dist/{chunk-DCWOQ5PN.js → chunk-NFJQQWG4.js} +2 -2
- package/dist/{chunk-OS4TSIFU.js → chunk-W57TITU4.js} +2 -2
- package/dist/{client-11sncog4.d.ts → client-CCSnylou.d.ts} +1 -1
- package/dist/{engine-C_3RK8wC.d.ts → engine-1KlJ_8jK.d.ts} +34 -5
- package/dist/hono/index.d.ts +2 -2
- package/dist/hono/index.js +2 -2
- package/dist/ifood/index.d.ts +20 -2
- package/dist/ifood/index.js +349 -125
- package/dist/ifood/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +162 -65
- package/dist/index.js.map +1 -1
- package/dist/keeta/index.d.ts +2 -18
- package/dist/keeta/index.js +12 -3
- package/dist/keeta/index.js.map +1 -1
- package/dist/manifest/server.d.ts +2 -2
- package/dist/manifest/server.js +2 -2
- package/dist/rappi/index.d.ts +1 -1
- package/dist/rappi/index.js +1 -1
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +2 -2
- package/package.json +1 -1
- package/src/core/adapter.ts +8 -1
- package/src/core/connection-stamp.ts +61 -0
- package/src/core/courier-port.ts +100 -0
- package/src/core/courier.ts +153 -0
- package/src/core/engine.ts +4 -1
- package/src/core/fetch-order.ts +54 -12
- package/src/core/integration.ts +19 -4
- package/src/core/lifecycle.ts +27 -4
- package/src/core/outbound-queue.ts +24 -11
- package/src/core/outbound.ts +8 -6
- package/src/core/pickup-code.ts +136 -0
- package/src/core/pipeline.ts +15 -6
- package/src/core/ports.ts +23 -1
- package/src/core/status-store.ts +2 -3
- package/src/core/types.ts +56 -4
- package/src/ifood/courier.ts +210 -0
- package/src/ifood/fetch-order.ts +103 -0
- package/src/ifood/index.ts +9 -1
- package/src/ifood/normalize.ts +30 -3
- package/src/index.ts +16 -0
- package/src/keeta/normalize.ts +21 -6
- package/dist/chunk-YWMEIMO3.js.map +0 -1
- /package/dist/{chunk-DCWOQ5PN.js.map → chunk-NFJQQWG4.js.map} +0 -0
- /package/dist/{chunk-OS4TSIFU.js.map → chunk-W57TITU4.js.map} +0 -0
package/src/keeta/normalize.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { outboundResultOf, type AdapterCallContext } from "../core/adapter";
|
|
2
|
-
import { pick } from "../core/payload-read";
|
|
3
|
-
import type { NormalizedEvent, NormalizedMarketplaceOrder } from "../core/types";
|
|
2
|
+
import { firstDate, pick } from "../core/payload-read";
|
|
3
|
+
import type { MarketplaceCourierStep, NormalizedEvent, NormalizedMarketplaceOrder } from "../core/types";
|
|
4
4
|
import { isStop, openDeliveryCall, type OpenDeliveryDialect } from "../open-delivery/client";
|
|
5
5
|
import { normalizeOpenDeliveryEventAs, normalizeOpenDeliveryOrderAs } from "../open-delivery/normalize";
|
|
6
6
|
|
|
@@ -12,15 +12,26 @@ import { normalizeOpenDeliveryEventAs, normalizeOpenDeliveryOrderAs } from "../o
|
|
|
12
12
|
*
|
|
13
13
|
* Events (Keeta's order guide, read 2026-11-26): `CREATED` → fetch;
|
|
14
14
|
* `CANCELLED` (with a JSON-string `metadata` carrying `reason` and `code`) →
|
|
15
|
-
* cancelled; `DISPATCHED`, `CONCLUDED` → lifecycle
|
|
15
|
+
* cancelled; `DISPATCHED`, `CONCLUDED` → lifecycle; `RIDER_ARRIVED_AT_STORE`,
|
|
16
|
+
* `ORDER_COLLECTED` → courier steps (the second a lifecycle too). Keeta has NO
|
|
16
17
|
* `CANCELLATION_REQUEST_DENIED`: a store's request that Keeta does not grant
|
|
17
18
|
* produces no event, so it ends TIMEOUT at the adapter's answer window. The
|
|
18
|
-
* rest (`CONFIRMED`, `READY_FOR_PICKUP`, `PICKUP_ONGOING`,
|
|
19
|
-
* `RIDER_ARRIVED_AT_STORE`, `ORDER_COLLECTED`, `DELIVERED`,
|
|
19
|
+
* rest (`CONFIRMED`, `READY_FOR_PICKUP`, `PICKUP_ONGOING`, `DELIVERED`,
|
|
20
20
|
* `CANCELLATION_REQUESTED`, `USER_REFUND_REQUEST`, `REFUNDED`,
|
|
21
21
|
* `REFUND_FAILED`, `RECOMMENDED_PREPARATION_START`) are recorded and IGNORED.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Keeta's rider events as courier steps (FUT-5665). ESTIMATED: the event names
|
|
26
|
+
* are Keeta's order guide's (read 2026-11-26), their meaning is read off the
|
|
27
|
+
* names; they carry no rider's name, photo or vehicle. `PICKUP_ONGOING` is left
|
|
28
|
+
* IGNORED: whether it means "on the way" or "at the counter" is not stated.
|
|
29
|
+
*/
|
|
30
|
+
const KEETA_COURIER_STEP_OF: Readonly<Record<string, MarketplaceCourierStep>> = {
|
|
31
|
+
RIDER_ARRIVED_AT_STORE: "ARRIVED_AT_ORIGIN",
|
|
32
|
+
ORDER_COLLECTED: "COLLECTED",
|
|
33
|
+
};
|
|
34
|
+
|
|
24
35
|
/** The provider id Keeta is registered under. Uppercase: the column's CHECK holds that shape. */
|
|
25
36
|
export const KEETA_PROVIDER = "KEETA";
|
|
26
37
|
|
|
@@ -31,7 +42,11 @@ const DECRYPT_BATCH = 50;
|
|
|
31
42
|
|
|
32
43
|
/** Normalize one webhook `Event`. Null only when it names no order. */
|
|
33
44
|
export function normalizeKeetaEvent(payload: unknown): NormalizedEvent | null {
|
|
34
|
-
|
|
45
|
+
const event = normalizeOpenDeliveryEventAs(KEETA_PROVIDER, payload);
|
|
46
|
+
const step = event ? KEETA_COURIER_STEP_OF[event.eventType] : undefined;
|
|
47
|
+
if (!event || !step) return event;
|
|
48
|
+
const courier = { step, at: firstDate(payload, [["createdAt"]]), courier: null, returning: null };
|
|
49
|
+
return { ...event, courier, ...(step === "COLLECTED" ? { lifecycle: "COLLECTED" as const } : {}) };
|
|
35
50
|
}
|
|
36
51
|
|
|
37
52
|
/** Normalize one `Order`, after {@link revealKeetaOrder}. Null when it carries no id or no line. */
|