@voyantjs/catalog 0.57.0 → 0.59.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/README.md +14 -0
- package/dist/adapter/booking-forwarding.d.ts +46 -0
- package/dist/adapter/booking-forwarding.d.ts.map +1 -0
- package/dist/adapter/booking-forwarding.js +1 -0
- package/dist/adapter/contract.d.ts +10 -32
- package/dist/adapter/contract.d.ts.map +1 -1
- package/dist/adapter/contract.test.js +76 -0
- package/dist/adapter/schemas.d.ts +272 -0
- package/dist/adapter/schemas.d.ts.map +1 -0
- package/dist/adapter/schemas.js +199 -0
- package/dist/adapter/schemas.test.d.ts +2 -0
- package/dist/adapter/schemas.test.d.ts.map +1 -0
- package/dist/adapter/schemas.test.js +273 -0
- package/dist/booking-engine/book.d.ts +7 -1
- package/dist/booking-engine/book.d.ts.map +1 -1
- package/dist/booking-engine/book.js +6 -1
- package/dist/booking-engine/cancel.d.ts +4 -1
- package/dist/booking-engine/cancel.d.ts.map +1 -1
- package/dist/booking-engine/cancel.js +3 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/package.json +9 -4
package/README.md
CHANGED
|
@@ -25,6 +25,7 @@ pnpm add @voyantjs/catalog
|
|
|
25
25
|
- **`./drift/events`** — drift event types for upstream change detection.
|
|
26
26
|
- **`./events/taxonomy`** — catalog event names + visibility-filtered payload builders, emitted via `@voyantjs/core/events` and consumed by the existing webhook pipeline.
|
|
27
27
|
- **`./adapter/contract`** — public source-adapter contract. Voyant Connect, third-party providers, operator-built adapters all implement this.
|
|
28
|
+
- **`./adapter/schemas`** — zod schemas for source-adapter runtime payloads. Use these at HTTP, queue, RPC, and adapter boundaries instead of re-declaring validators.
|
|
28
29
|
- **`./booking-engine`** — quote/book services plus the Hono route module that backs `@voyantjs/catalog-react/booking-engine` and `@voyantjs/bookings-ui/journey`.
|
|
29
30
|
|
|
30
31
|
## Architectural rules
|
|
@@ -64,6 +65,19 @@ export const productCatalogPolicy = defineFieldPolicy([
|
|
|
64
65
|
|
|
65
66
|
See `docs/architecture/catalog-architecture.md` for the full contract and worked examples.
|
|
66
67
|
|
|
68
|
+
## Source-adapter runtime validation
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { reserveRequestSchema } from "@voyantjs/catalog/adapter/schemas"
|
|
72
|
+
import type { ReserveRequest } from "@voyantjs/catalog/adapter/contract"
|
|
73
|
+
|
|
74
|
+
const request: ReserveRequest = reserveRequestSchema.parse(await req.json())
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Reserve and cancel requests may include a `scope` matching live resolution plus
|
|
78
|
+
an `idempotency_key`; cancel results may return `status: "pending"` with
|
|
79
|
+
`pending_channel` for async upstream workflows.
|
|
80
|
+
|
|
67
81
|
## BookingJourney HTTP routes
|
|
68
82
|
|
|
69
83
|
`@voyantjs/catalog` exports `createCatalogBookingHonoModule(...)` and
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface SourceAdapterRequestScope {
|
|
2
|
+
locale: string;
|
|
3
|
+
audience: string;
|
|
4
|
+
market: string;
|
|
5
|
+
currency?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ReserveRequest {
|
|
8
|
+
entity_module: string;
|
|
9
|
+
entity_id: string;
|
|
10
|
+
parameters: Record<string, unknown>;
|
|
11
|
+
/** Customer / passenger identity, vertical-shaped. */
|
|
12
|
+
party?: Record<string, unknown>;
|
|
13
|
+
/** Payment intent for verticals that distinguish hold vs ticket. */
|
|
14
|
+
payment_intent?: Record<string, unknown>;
|
|
15
|
+
/** Per-request scope. Mirrors `LiveResolveRequest.scope`. */
|
|
16
|
+
scope?: SourceAdapterRequestScope;
|
|
17
|
+
/** Replay-safe write key. Same key on retries means same upstream effect. */
|
|
18
|
+
idempotency_key?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ReserveResult {
|
|
21
|
+
/** Upstream order / booking identifier — used as `source_ref` in snapshots. */
|
|
22
|
+
upstream_ref: string;
|
|
23
|
+
/** Status returned by the upstream system. */
|
|
24
|
+
status: "held" | "confirmed" | "ticketed" | "failed";
|
|
25
|
+
/** Opaque per-vertical payload echoed back to the snapshot graph. */
|
|
26
|
+
upstream_payload?: Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
export interface CancelRequest {
|
|
29
|
+
upstream_ref: string;
|
|
30
|
+
reason?: string;
|
|
31
|
+
/** Per-request scope. Mirrors `LiveResolveRequest.scope`. */
|
|
32
|
+
scope?: SourceAdapterRequestScope;
|
|
33
|
+
/** Replay-safe write key. Same key on retries means same upstream effect. */
|
|
34
|
+
idempotency_key?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface CancelResult {
|
|
37
|
+
status: "cancelled" | "pending" | "refused" | "failed";
|
|
38
|
+
refund_amount?: number;
|
|
39
|
+
refund_currency?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Free-text channel through which an async cancellation was submitted
|
|
42
|
+
* when `status` is "pending" (email, partner portal, batch, etc.).
|
|
43
|
+
*/
|
|
44
|
+
pending_channel?: string;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=booking-forwarding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking-forwarding.d.ts","sourceRoot":"","sources":["../../src/adapter/booking-forwarding.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACnC,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,oEAAoE;IACpE,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACxC,6DAA6D;IAC7D,KAAK,CAAC,EAAE,yBAAyB,CAAA;IACjC,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,+EAA+E;IAC/E,YAAY,EAAE,MAAM,CAAA;IACpB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,CAAA;IACpD,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC3C;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,6DAA6D;IAC7D,KAAK,CAAC,EAAE,yBAAyB,CAAA;IACjC,6EAA6E;IAC7E,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAA;IACtD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import type { CatalogDriftEvent } from "../drift/events.js";
|
|
18
18
|
import type { Provenance } from "../provenance.js";
|
|
19
|
+
import type { CancelRequest, CancelResult, ReserveRequest, ReserveResult, SourceAdapterRequestScope } from "./booking-forwarding.js";
|
|
20
|
+
export type { CancelRequest, CancelResult, ReserveRequest, ReserveResult, SourceAdapterRequestScope, } from "./booking-forwarding.js";
|
|
19
21
|
/**
|
|
20
22
|
* Capability declaration. Adapters return their capabilities at registration
|
|
21
23
|
* so the catalog plane can route operations correctly and fail fast on
|
|
@@ -38,6 +40,13 @@ export interface AdapterCapabilities {
|
|
|
38
40
|
supportsDriftDetection: boolean;
|
|
39
41
|
/** Whether the adapter forwards bookings to the upstream source. */
|
|
40
42
|
supportsBookingForwarding: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether `cancel` returns a terminal upstream status synchronously.
|
|
45
|
+
* When false, the adapter may return `status: "pending"` and drive the
|
|
46
|
+
* final transition later through drift, polling, or connector-specific
|
|
47
|
+
* reconciliation.
|
|
48
|
+
*/
|
|
49
|
+
supportsSyncCancellation?: boolean;
|
|
41
50
|
/** Post-book operations the adapter supports (modify, cancel, status, refund). */
|
|
42
51
|
postBookOperations: ReadonlyArray<"modify" | "cancel" | "status" | "refund" | "exchange" | "void">;
|
|
43
52
|
/**
|
|
@@ -131,12 +140,7 @@ export interface DiscoveryPage {
|
|
|
131
140
|
export interface LiveResolveRequest {
|
|
132
141
|
ids: string[];
|
|
133
142
|
/** Variant scope for the request (mirrors the resolver's scope). */
|
|
134
|
-
scope:
|
|
135
|
-
locale: string;
|
|
136
|
-
audience: string;
|
|
137
|
-
market: string;
|
|
138
|
-
currency?: string;
|
|
139
|
-
};
|
|
143
|
+
scope: SourceAdapterRequestScope;
|
|
140
144
|
/** Date range or other vertical-specific parameters. */
|
|
141
145
|
parameters?: Record<string, unknown>;
|
|
142
146
|
}
|
|
@@ -222,32 +226,6 @@ export interface GetContentResult {
|
|
|
222
226
|
/** ETag-style marker for HTTP-cache revalidation on the next pull. */
|
|
223
227
|
etag?: string;
|
|
224
228
|
}
|
|
225
|
-
export interface ReserveRequest {
|
|
226
|
-
entity_module: string;
|
|
227
|
-
entity_id: string;
|
|
228
|
-
parameters: Record<string, unknown>;
|
|
229
|
-
/** Customer / passenger identity, vertical-shaped. */
|
|
230
|
-
party?: Record<string, unknown>;
|
|
231
|
-
/** Payment intent for verticals that distinguish hold vs ticket. */
|
|
232
|
-
payment_intent?: Record<string, unknown>;
|
|
233
|
-
}
|
|
234
|
-
export interface ReserveResult {
|
|
235
|
-
/** Upstream order / booking identifier — used as `source_ref` in snapshots. */
|
|
236
|
-
upstream_ref: string;
|
|
237
|
-
/** Status returned by the upstream system. */
|
|
238
|
-
status: "held" | "confirmed" | "ticketed" | "failed";
|
|
239
|
-
/** Opaque per-vertical payload echoed back to the snapshot graph. */
|
|
240
|
-
upstream_payload?: Record<string, unknown>;
|
|
241
|
-
}
|
|
242
|
-
export interface CancelRequest {
|
|
243
|
-
upstream_ref: string;
|
|
244
|
-
reason?: string;
|
|
245
|
-
}
|
|
246
|
-
export interface CancelResult {
|
|
247
|
-
status: "cancelled" | "refused" | "failed";
|
|
248
|
-
refund_amount?: number;
|
|
249
|
-
refund_currency?: string;
|
|
250
|
-
}
|
|
251
229
|
/**
|
|
252
230
|
* Push-booking request — when a booking commits locally on a syndicated
|
|
253
231
|
* owned product, the channel push pipeline calls `pushBooking` for each
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/adapter/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/adapter/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,aAAa,EACb,yBAAyB,EAC1B,MAAM,yBAAyB,CAAA;AAEhC,YAAY,EACV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,aAAa,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@@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { cancelRequestSchema, reserveRequestSchema } from "./schemas.js";
|
|
2
3
|
describe("AdapterCapabilities — content fetch declaration", () => {
|
|
3
4
|
it("accepts adapters that omit supportsContentFetch (backward compatible)", () => {
|
|
4
5
|
const cap = {
|
|
@@ -136,3 +137,78 @@ describe("SourceAdapter — getContent capability gating", () => {
|
|
|
136
137
|
expect(result.content_schema_version).toBe("products/v1");
|
|
137
138
|
});
|
|
138
139
|
});
|
|
140
|
+
describe("ReserveRequest / CancelRequest scoped write shape", () => {
|
|
141
|
+
it("round-trips reserve requests with request scope and idempotency key", () => {
|
|
142
|
+
const request = {
|
|
143
|
+
entity_module: "products",
|
|
144
|
+
entity_id: "prod_abc",
|
|
145
|
+
parameters: { departureId: "dep_1" },
|
|
146
|
+
party: { travelers: 2 },
|
|
147
|
+
scope: {
|
|
148
|
+
locale: "en-GB",
|
|
149
|
+
audience: "customer",
|
|
150
|
+
market: "GB",
|
|
151
|
+
currency: "GBP",
|
|
152
|
+
},
|
|
153
|
+
idempotency_key: "reserve_abc",
|
|
154
|
+
};
|
|
155
|
+
expect(reserveRequestSchema.parse(request)).toEqual(request);
|
|
156
|
+
});
|
|
157
|
+
it("round-trips cancel requests with request scope and idempotency key", () => {
|
|
158
|
+
const request = {
|
|
159
|
+
upstream_ref: "booking_abc",
|
|
160
|
+
reason: "customer_request",
|
|
161
|
+
scope: {
|
|
162
|
+
locale: "en-GB",
|
|
163
|
+
audience: "customer",
|
|
164
|
+
market: "GB",
|
|
165
|
+
currency: "GBP",
|
|
166
|
+
},
|
|
167
|
+
idempotency_key: "cancel_abc",
|
|
168
|
+
};
|
|
169
|
+
expect(cancelRequestSchema.parse(request)).toEqual(request);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
describe("SourceAdapter — cancellation capability declaration", () => {
|
|
173
|
+
it("typechecks sync cancellation adapters that return terminal statuses", async () => {
|
|
174
|
+
const adapter = {
|
|
175
|
+
kind: "sync-cancel",
|
|
176
|
+
capabilities: {
|
|
177
|
+
verticals: ["products"],
|
|
178
|
+
supportsLiveResolution: false,
|
|
179
|
+
supportsDriftDetection: false,
|
|
180
|
+
supportsBookingForwarding: true,
|
|
181
|
+
supportsSyncCancellation: true,
|
|
182
|
+
postBookOperations: ["cancel"],
|
|
183
|
+
},
|
|
184
|
+
async cancel() {
|
|
185
|
+
return { status: "cancelled", refund_amount: 100, refund_currency: "GBP" };
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
await expect(adapter.cancel({ connection_id: "conn_1" }, { upstream_ref: "up_1" })).resolves.toEqual({
|
|
189
|
+
status: "cancelled",
|
|
190
|
+
refund_amount: 100,
|
|
191
|
+
refund_currency: "GBP",
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
it("typechecks async cancellation adapters that return pending", async () => {
|
|
195
|
+
const adapter = {
|
|
196
|
+
kind: "async-cancel",
|
|
197
|
+
capabilities: {
|
|
198
|
+
verticals: ["products"],
|
|
199
|
+
supportsLiveResolution: false,
|
|
200
|
+
supportsDriftDetection: true,
|
|
201
|
+
supportsBookingForwarding: true,
|
|
202
|
+
supportsSyncCancellation: false,
|
|
203
|
+
postBookOperations: ["cancel"],
|
|
204
|
+
},
|
|
205
|
+
async cancel() {
|
|
206
|
+
return { status: "pending", pending_channel: "partner portal" };
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
await expect(adapter.cancel({ connection_id: "conn_1" }, { upstream_ref: "up_1" })).resolves.toEqual({
|
|
210
|
+
status: "pending",
|
|
211
|
+
pending_channel: "partner portal",
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
});
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { SourceAdapter } from "./contract.js";
|
|
3
|
+
export declare const postBookOperationSchema: z.ZodEnum<{
|
|
4
|
+
modify: "modify";
|
|
5
|
+
cancel: "cancel";
|
|
6
|
+
status: "status";
|
|
7
|
+
refund: "refund";
|
|
8
|
+
exchange: "exchange";
|
|
9
|
+
void: "void";
|
|
10
|
+
}>;
|
|
11
|
+
export declare const adapterCapabilitiesSchema: z.ZodObject<{
|
|
12
|
+
verticals: z.ZodArray<z.ZodString>;
|
|
13
|
+
supportsLiveResolution: z.ZodBoolean;
|
|
14
|
+
supportsDriftDetection: z.ZodBoolean;
|
|
15
|
+
supportsBookingForwarding: z.ZodBoolean;
|
|
16
|
+
supportsSyncCancellation: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
postBookOperations: z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
18
|
+
modify: "modify";
|
|
19
|
+
cancel: "cancel";
|
|
20
|
+
status: "status";
|
|
21
|
+
refund: "refund";
|
|
22
|
+
exchange: "exchange";
|
|
23
|
+
void: "void";
|
|
24
|
+
}>>>;
|
|
25
|
+
cacheTtlSeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
26
|
+
supportsContentFetch: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
supportedContentLocales: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
28
|
+
holdReleaseGraceMs: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
supportsBookingPush: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
supportsAvailabilityPush: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
supportsContentPush: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export declare const connectionStateSchema: z.ZodEnum<{
|
|
34
|
+
active: "active";
|
|
35
|
+
paused: "paused";
|
|
36
|
+
disconnected: "disconnected";
|
|
37
|
+
error: "error";
|
|
38
|
+
}>;
|
|
39
|
+
export declare const sourceAdapterContextSchema: z.ZodObject<{
|
|
40
|
+
connection_id: z.ZodString;
|
|
41
|
+
credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
42
|
+
tenant_id: z.ZodOptional<z.ZodString>;
|
|
43
|
+
correlation_id: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
export declare const sourceFreshnessSchema: z.ZodNullable<z.ZodEnum<{
|
|
46
|
+
sync: "sync";
|
|
47
|
+
event: "event";
|
|
48
|
+
request: "request";
|
|
49
|
+
static: "static";
|
|
50
|
+
}>>;
|
|
51
|
+
export declare const provenanceSchema: z.ZodObject<{
|
|
52
|
+
source_kind: z.ZodString;
|
|
53
|
+
source_provider: z.ZodOptional<z.ZodString>;
|
|
54
|
+
source_connection_id: z.ZodOptional<z.ZodString>;
|
|
55
|
+
source_ref: z.ZodOptional<z.ZodString>;
|
|
56
|
+
source_freshness: z.ZodNullable<z.ZodEnum<{
|
|
57
|
+
sync: "sync";
|
|
58
|
+
event: "event";
|
|
59
|
+
request: "request";
|
|
60
|
+
static: "static";
|
|
61
|
+
}>>;
|
|
62
|
+
last_sourced_at: z.ZodOptional<z.ZodDate>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export declare const catalogProjectionSchema: z.ZodObject<{
|
|
65
|
+
entity_module: z.ZodString;
|
|
66
|
+
entity_id: z.ZodString;
|
|
67
|
+
provenance: z.ZodObject<{
|
|
68
|
+
source_kind: z.ZodString;
|
|
69
|
+
source_provider: z.ZodOptional<z.ZodString>;
|
|
70
|
+
source_connection_id: z.ZodOptional<z.ZodString>;
|
|
71
|
+
source_ref: z.ZodOptional<z.ZodString>;
|
|
72
|
+
source_freshness: z.ZodNullable<z.ZodEnum<{
|
|
73
|
+
sync: "sync";
|
|
74
|
+
event: "event";
|
|
75
|
+
request: "request";
|
|
76
|
+
static: "static";
|
|
77
|
+
}>>;
|
|
78
|
+
last_sourced_at: z.ZodOptional<z.ZodDate>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
fields: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
export declare const discoveryCursorSchema: z.ZodCustom<string | undefined, string | undefined>;
|
|
83
|
+
export declare const discoveryPageSchema: z.ZodObject<{
|
|
84
|
+
projections: z.ZodArray<z.ZodObject<{
|
|
85
|
+
entity_module: z.ZodString;
|
|
86
|
+
entity_id: z.ZodString;
|
|
87
|
+
provenance: z.ZodObject<{
|
|
88
|
+
source_kind: z.ZodString;
|
|
89
|
+
source_provider: z.ZodOptional<z.ZodString>;
|
|
90
|
+
source_connection_id: z.ZodOptional<z.ZodString>;
|
|
91
|
+
source_ref: z.ZodOptional<z.ZodString>;
|
|
92
|
+
source_freshness: z.ZodNullable<z.ZodEnum<{
|
|
93
|
+
sync: "sync";
|
|
94
|
+
event: "event";
|
|
95
|
+
request: "request";
|
|
96
|
+
static: "static";
|
|
97
|
+
}>>;
|
|
98
|
+
last_sourced_at: z.ZodOptional<z.ZodDate>;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
fields: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
101
|
+
}, z.core.$strip>>;
|
|
102
|
+
next_cursor: z.ZodCustom<string | undefined, string | undefined>;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
export declare const liveResolveScopeSchema: z.ZodObject<{
|
|
105
|
+
locale: z.ZodString;
|
|
106
|
+
audience: z.ZodString;
|
|
107
|
+
market: z.ZodString;
|
|
108
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
export declare const sourceAdapterRequestScopeSchema: z.ZodObject<{
|
|
111
|
+
locale: z.ZodString;
|
|
112
|
+
audience: z.ZodString;
|
|
113
|
+
market: z.ZodString;
|
|
114
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
export declare const liveResolveRequestSchema: z.ZodObject<{
|
|
117
|
+
ids: z.ZodArray<z.ZodString>;
|
|
118
|
+
scope: z.ZodObject<{
|
|
119
|
+
locale: z.ZodString;
|
|
120
|
+
audience: z.ZodString;
|
|
121
|
+
market: z.ZodString;
|
|
122
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
125
|
+
}, z.core.$strip>;
|
|
126
|
+
export declare const liveResolveFailedReasonSchema: z.ZodEnum<{
|
|
127
|
+
timeout: "timeout";
|
|
128
|
+
error: "error";
|
|
129
|
+
not_found: "not_found";
|
|
130
|
+
unavailable: "unavailable";
|
|
131
|
+
departure_not_found: "departure_not_found";
|
|
132
|
+
departure_unavailable: "departure_unavailable";
|
|
133
|
+
unsupported: "unsupported";
|
|
134
|
+
}>;
|
|
135
|
+
export declare const liveResolveResultSchema: z.ZodObject<{
|
|
136
|
+
values: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
137
|
+
failed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
138
|
+
timeout: "timeout";
|
|
139
|
+
error: "error";
|
|
140
|
+
not_found: "not_found";
|
|
141
|
+
unavailable: "unavailable";
|
|
142
|
+
departure_not_found: "departure_not_found";
|
|
143
|
+
departure_unavailable: "departure_unavailable";
|
|
144
|
+
unsupported: "unsupported";
|
|
145
|
+
}>>>;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
export declare const getContentRequestSchema: z.ZodObject<{
|
|
148
|
+
entity_module: z.ZodString;
|
|
149
|
+
entity_id: z.ZodString;
|
|
150
|
+
locale: z.ZodString;
|
|
151
|
+
market: z.ZodOptional<z.ZodString>;
|
|
152
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
153
|
+
}, z.core.$strip>;
|
|
154
|
+
export declare const getContentResultSchema: z.ZodObject<{
|
|
155
|
+
entity_module: z.ZodString;
|
|
156
|
+
entity_id: z.ZodString;
|
|
157
|
+
source_ref: z.ZodString;
|
|
158
|
+
returned_locale: z.ZodString;
|
|
159
|
+
machine_translated: z.ZodOptional<z.ZodBoolean>;
|
|
160
|
+
content: z.ZodUnknown;
|
|
161
|
+
content_schema_version: z.ZodString;
|
|
162
|
+
source_updated_at: z.ZodOptional<z.ZodDate>;
|
|
163
|
+
fresh_until: z.ZodOptional<z.ZodDate>;
|
|
164
|
+
etag: z.ZodOptional<z.ZodString>;
|
|
165
|
+
}, z.core.$strip>;
|
|
166
|
+
export declare const reserveRequestSchema: z.ZodObject<{
|
|
167
|
+
entity_module: z.ZodString;
|
|
168
|
+
entity_id: z.ZodString;
|
|
169
|
+
parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
170
|
+
party: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
171
|
+
payment_intent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
172
|
+
scope: z.ZodOptional<z.ZodObject<{
|
|
173
|
+
locale: z.ZodString;
|
|
174
|
+
audience: z.ZodString;
|
|
175
|
+
market: z.ZodString;
|
|
176
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
177
|
+
}, z.core.$strip>>;
|
|
178
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
179
|
+
}, z.core.$strip>;
|
|
180
|
+
export declare const reserveStatusSchema: z.ZodEnum<{
|
|
181
|
+
held: "held";
|
|
182
|
+
confirmed: "confirmed";
|
|
183
|
+
ticketed: "ticketed";
|
|
184
|
+
failed: "failed";
|
|
185
|
+
}>;
|
|
186
|
+
export declare const reserveResultSchema: z.ZodObject<{
|
|
187
|
+
upstream_ref: z.ZodString;
|
|
188
|
+
status: z.ZodEnum<{
|
|
189
|
+
held: "held";
|
|
190
|
+
confirmed: "confirmed";
|
|
191
|
+
ticketed: "ticketed";
|
|
192
|
+
failed: "failed";
|
|
193
|
+
}>;
|
|
194
|
+
upstream_payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
195
|
+
}, z.core.$strip>;
|
|
196
|
+
export declare const cancelRequestSchema: z.ZodObject<{
|
|
197
|
+
upstream_ref: z.ZodString;
|
|
198
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
199
|
+
scope: z.ZodOptional<z.ZodObject<{
|
|
200
|
+
locale: z.ZodString;
|
|
201
|
+
audience: z.ZodString;
|
|
202
|
+
market: z.ZodString;
|
|
203
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
204
|
+
}, z.core.$strip>>;
|
|
205
|
+
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
206
|
+
}, z.core.$strip>;
|
|
207
|
+
export declare const cancelStatusSchema: z.ZodEnum<{
|
|
208
|
+
failed: "failed";
|
|
209
|
+
cancelled: "cancelled";
|
|
210
|
+
pending: "pending";
|
|
211
|
+
refused: "refused";
|
|
212
|
+
}>;
|
|
213
|
+
export declare const cancelResultSchema: z.ZodObject<{
|
|
214
|
+
status: z.ZodEnum<{
|
|
215
|
+
failed: "failed";
|
|
216
|
+
cancelled: "cancelled";
|
|
217
|
+
pending: "pending";
|
|
218
|
+
refused: "refused";
|
|
219
|
+
}>;
|
|
220
|
+
refund_amount: z.ZodOptional<z.ZodNumber>;
|
|
221
|
+
refund_currency: z.ZodOptional<z.ZodString>;
|
|
222
|
+
pending_channel: z.ZodOptional<z.ZodString>;
|
|
223
|
+
}, z.core.$strip>;
|
|
224
|
+
export declare const pushBookingRequestSchema: z.ZodObject<{
|
|
225
|
+
idempotencyKey: z.ZodString;
|
|
226
|
+
bookingId: z.ZodString;
|
|
227
|
+
bookingItemId: z.ZodOptional<z.ZodString>;
|
|
228
|
+
externalProductId: z.ZodString;
|
|
229
|
+
externalRateId: z.ZodOptional<z.ZodString>;
|
|
230
|
+
externalCategoryId: z.ZodOptional<z.ZodString>;
|
|
231
|
+
channelId: z.ZodString;
|
|
232
|
+
contractPolicy: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
233
|
+
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
234
|
+
}, z.core.$strip>;
|
|
235
|
+
export declare const pushBookingResultSchema: z.ZodObject<{
|
|
236
|
+
upstreamRef: z.ZodString;
|
|
237
|
+
externalReference: z.ZodOptional<z.ZodString>;
|
|
238
|
+
externalStatus: z.ZodOptional<z.ZodString>;
|
|
239
|
+
upstreamPayload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
240
|
+
}, z.core.$strip>;
|
|
241
|
+
export declare const pushAvailabilityRequestSchema: z.ZodObject<{
|
|
242
|
+
channelId: z.ZodString;
|
|
243
|
+
externalProductId: z.ZodString;
|
|
244
|
+
externalRateId: z.ZodOptional<z.ZodString>;
|
|
245
|
+
externalCategoryId: z.ZodOptional<z.ZodString>;
|
|
246
|
+
slotId: z.ZodString;
|
|
247
|
+
productId: z.ZodString;
|
|
248
|
+
optionId: z.ZodOptional<z.ZodString>;
|
|
249
|
+
startsAt: z.ZodUnion<readonly [z.ZodDate, z.ZodString]>;
|
|
250
|
+
remainingPax: z.ZodNumber;
|
|
251
|
+
source: z.ZodString;
|
|
252
|
+
}, z.core.$strip>;
|
|
253
|
+
export declare const pushAvailabilityResultSchema: z.ZodObject<{
|
|
254
|
+
externalStatus: z.ZodOptional<z.ZodString>;
|
|
255
|
+
upstreamPayload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
256
|
+
}, z.core.$strip>;
|
|
257
|
+
export declare const pushContentRequestSchema: z.ZodObject<{
|
|
258
|
+
channelId: z.ZodString;
|
|
259
|
+
externalProductId: z.ZodString;
|
|
260
|
+
productId: z.ZodString;
|
|
261
|
+
contentHash: z.ZodString;
|
|
262
|
+
content: z.ZodUnknown;
|
|
263
|
+
contentSchemaVersion: z.ZodOptional<z.ZodString>;
|
|
264
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
265
|
+
}, z.core.$strip>;
|
|
266
|
+
export declare const pushContentResultSchema: z.ZodObject<{
|
|
267
|
+
externalStatus: z.ZodOptional<z.ZodString>;
|
|
268
|
+
upstreamPayload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
269
|
+
acknowledgedHash: z.ZodOptional<z.ZodString>;
|
|
270
|
+
}, z.core.$strip>;
|
|
271
|
+
export declare const sourceAdapterSchema: z.ZodCustom<SourceAdapter, SourceAdapter>;
|
|
272
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/adapter/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAalD,eAAO,MAAM,uBAAuB;;;;;;;EAOlC,CAAA;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;iBAcpC,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;EAAwD,CAAA;AAE1F,eAAO,MAAM,0BAA0B;;;;;iBAKrC,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;GAA4D,CAAA;AAE9F,eAAO,MAAM,gBAAgB;;;;;;;;;;;;iBAO3B,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;iBAKlC,CAAA;AAEF,eAAO,MAAM,qBAAqB,qDAEjC,CAAA;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;iBAG9B,CAAA;AAEF,eAAO,MAAM,sBAAsB;;;;;iBAKjC,CAAA;AAEF,eAAO,MAAM,+BAA+B;;;;;iBAAyB,CAAA;AAErE,eAAO,MAAM,wBAAwB;;;;;;;;;iBAInC,CAAA;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;EAQxC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;iBAGlC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;iBAMlC,CAAA;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;iBAWjC,CAAA;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;iBAQ/B,CAAA;AAEF,eAAO,MAAM,mBAAmB;;;;;EAAsD,CAAA;AAEtF,eAAO,MAAM,mBAAmB;;;;;;;;;iBAI9B,CAAA;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;iBAK9B,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;EAAwD,CAAA;AAEvF,eAAO,MAAM,kBAAkB;;;;;;;;;;iBAK7B,CAAA;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;iBAUnC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;iBAKlC,CAAA;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;iBAWxC,CAAA;AAEF,eAAO,MAAM,4BAA4B;;;iBAGvC,CAAA;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;iBAQnC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;iBAIlC,CAAA;AAEF,eAAO,MAAM,mBAAmB,2CAsB/B,CAAA"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const recordSchema = z.record(z.string(), z.unknown());
|
|
3
|
+
const localeSchema = z.string().regex(/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$/);
|
|
4
|
+
const currencySchema = z.string().length(3);
|
|
5
|
+
const dateOrStringSchema = z.union([z.date(), z.string()]);
|
|
6
|
+
const catalogVerticalSchema = z.string();
|
|
7
|
+
const isRecord = (value) => typeof value === "object" && value !== null;
|
|
8
|
+
const optionalFunction = (value) => value === undefined || typeof value === "function";
|
|
9
|
+
export const postBookOperationSchema = z.enum([
|
|
10
|
+
"modify",
|
|
11
|
+
"cancel",
|
|
12
|
+
"status",
|
|
13
|
+
"refund",
|
|
14
|
+
"exchange",
|
|
15
|
+
"void",
|
|
16
|
+
]);
|
|
17
|
+
export const adapterCapabilitiesSchema = z.object({
|
|
18
|
+
verticals: z.array(catalogVerticalSchema),
|
|
19
|
+
supportsLiveResolution: z.boolean(),
|
|
20
|
+
supportsDriftDetection: z.boolean(),
|
|
21
|
+
supportsBookingForwarding: z.boolean(),
|
|
22
|
+
supportsSyncCancellation: z.boolean().optional(),
|
|
23
|
+
postBookOperations: z.array(postBookOperationSchema).readonly(),
|
|
24
|
+
cacheTtlSeconds: z.number().int().min(0).nullable().optional(),
|
|
25
|
+
supportsContentFetch: z.boolean().optional(),
|
|
26
|
+
supportedContentLocales: z.array(localeSchema).readonly().optional(),
|
|
27
|
+
holdReleaseGraceMs: z.number().int().min(0).optional(),
|
|
28
|
+
supportsBookingPush: z.boolean().optional(),
|
|
29
|
+
supportsAvailabilityPush: z.boolean().optional(),
|
|
30
|
+
supportsContentPush: z.boolean().optional(),
|
|
31
|
+
});
|
|
32
|
+
export const connectionStateSchema = z.enum(["active", "paused", "disconnected", "error"]);
|
|
33
|
+
export const sourceAdapterContextSchema = z.object({
|
|
34
|
+
connection_id: z.string(),
|
|
35
|
+
credentials: z.record(z.string(), z.string()).optional(),
|
|
36
|
+
tenant_id: z.string().optional(),
|
|
37
|
+
correlation_id: z.string().optional(),
|
|
38
|
+
});
|
|
39
|
+
export const sourceFreshnessSchema = z.enum(["sync", "event", "request", "static"]).nullable();
|
|
40
|
+
export const provenanceSchema = z.object({
|
|
41
|
+
source_kind: z.string(),
|
|
42
|
+
source_provider: z.string().optional(),
|
|
43
|
+
source_connection_id: z.string().optional(),
|
|
44
|
+
source_ref: z.string().optional(),
|
|
45
|
+
source_freshness: sourceFreshnessSchema,
|
|
46
|
+
last_sourced_at: z.date().optional(),
|
|
47
|
+
});
|
|
48
|
+
export const catalogProjectionSchema = z.object({
|
|
49
|
+
entity_module: catalogVerticalSchema,
|
|
50
|
+
entity_id: z.string(),
|
|
51
|
+
provenance: provenanceSchema,
|
|
52
|
+
fields: recordSchema,
|
|
53
|
+
});
|
|
54
|
+
export const discoveryCursorSchema = z.custom((value) => value === undefined || typeof value === "string");
|
|
55
|
+
export const discoveryPageSchema = z.object({
|
|
56
|
+
projections: z.array(catalogProjectionSchema),
|
|
57
|
+
next_cursor: discoveryCursorSchema,
|
|
58
|
+
});
|
|
59
|
+
export const liveResolveScopeSchema = z.object({
|
|
60
|
+
locale: localeSchema,
|
|
61
|
+
audience: z.string(),
|
|
62
|
+
market: z.string(),
|
|
63
|
+
currency: currencySchema.optional(),
|
|
64
|
+
});
|
|
65
|
+
export const sourceAdapterRequestScopeSchema = liveResolveScopeSchema;
|
|
66
|
+
export const liveResolveRequestSchema = z.object({
|
|
67
|
+
ids: z.array(z.string()),
|
|
68
|
+
scope: liveResolveScopeSchema,
|
|
69
|
+
parameters: recordSchema.optional(),
|
|
70
|
+
});
|
|
71
|
+
export const liveResolveFailedReasonSchema = z.enum([
|
|
72
|
+
"timeout",
|
|
73
|
+
"not_found",
|
|
74
|
+
"unavailable",
|
|
75
|
+
"departure_not_found",
|
|
76
|
+
"departure_unavailable",
|
|
77
|
+
"unsupported",
|
|
78
|
+
"error",
|
|
79
|
+
]);
|
|
80
|
+
export const liveResolveResultSchema = z.object({
|
|
81
|
+
values: z.record(z.string(), recordSchema),
|
|
82
|
+
failed: z.record(z.string(), liveResolveFailedReasonSchema).optional(),
|
|
83
|
+
});
|
|
84
|
+
export const getContentRequestSchema = z.object({
|
|
85
|
+
entity_module: catalogVerticalSchema,
|
|
86
|
+
entity_id: z.string(),
|
|
87
|
+
locale: localeSchema,
|
|
88
|
+
market: z.string().optional(),
|
|
89
|
+
currency: currencySchema.optional(),
|
|
90
|
+
});
|
|
91
|
+
export const getContentResultSchema = z.object({
|
|
92
|
+
entity_module: catalogVerticalSchema,
|
|
93
|
+
entity_id: z.string(),
|
|
94
|
+
source_ref: z.string(),
|
|
95
|
+
returned_locale: localeSchema,
|
|
96
|
+
machine_translated: z.boolean().optional(),
|
|
97
|
+
content: z.unknown(),
|
|
98
|
+
content_schema_version: z.string(),
|
|
99
|
+
source_updated_at: z.date().optional(),
|
|
100
|
+
fresh_until: z.date().optional(),
|
|
101
|
+
etag: z.string().optional(),
|
|
102
|
+
});
|
|
103
|
+
export const reserveRequestSchema = z.object({
|
|
104
|
+
entity_module: catalogVerticalSchema,
|
|
105
|
+
entity_id: z.string(),
|
|
106
|
+
parameters: recordSchema,
|
|
107
|
+
party: recordSchema.optional(),
|
|
108
|
+
payment_intent: recordSchema.optional(),
|
|
109
|
+
scope: sourceAdapterRequestScopeSchema.optional(),
|
|
110
|
+
idempotency_key: z.string().optional(),
|
|
111
|
+
});
|
|
112
|
+
export const reserveStatusSchema = z.enum(["held", "confirmed", "ticketed", "failed"]);
|
|
113
|
+
export const reserveResultSchema = z.object({
|
|
114
|
+
upstream_ref: z.string(),
|
|
115
|
+
status: reserveStatusSchema,
|
|
116
|
+
upstream_payload: recordSchema.optional(),
|
|
117
|
+
});
|
|
118
|
+
export const cancelRequestSchema = z.object({
|
|
119
|
+
upstream_ref: z.string(),
|
|
120
|
+
reason: z.string().optional(),
|
|
121
|
+
scope: sourceAdapterRequestScopeSchema.optional(),
|
|
122
|
+
idempotency_key: z.string().optional(),
|
|
123
|
+
});
|
|
124
|
+
export const cancelStatusSchema = z.enum(["cancelled", "pending", "refused", "failed"]);
|
|
125
|
+
export const cancelResultSchema = z.object({
|
|
126
|
+
status: cancelStatusSchema,
|
|
127
|
+
refund_amount: z.number().optional(),
|
|
128
|
+
refund_currency: currencySchema.optional(),
|
|
129
|
+
pending_channel: z.string().optional(),
|
|
130
|
+
});
|
|
131
|
+
export const pushBookingRequestSchema = z.object({
|
|
132
|
+
idempotencyKey: z.string(),
|
|
133
|
+
bookingId: z.string(),
|
|
134
|
+
bookingItemId: z.string().optional(),
|
|
135
|
+
externalProductId: z.string(),
|
|
136
|
+
externalRateId: z.string().optional(),
|
|
137
|
+
externalCategoryId: z.string().optional(),
|
|
138
|
+
channelId: z.string(),
|
|
139
|
+
contractPolicy: recordSchema.optional(),
|
|
140
|
+
payload: recordSchema,
|
|
141
|
+
});
|
|
142
|
+
export const pushBookingResultSchema = z.object({
|
|
143
|
+
upstreamRef: z.string(),
|
|
144
|
+
externalReference: z.string().optional(),
|
|
145
|
+
externalStatus: z.string().optional(),
|
|
146
|
+
upstreamPayload: recordSchema.optional(),
|
|
147
|
+
});
|
|
148
|
+
export const pushAvailabilityRequestSchema = z.object({
|
|
149
|
+
channelId: z.string(),
|
|
150
|
+
externalProductId: z.string(),
|
|
151
|
+
externalRateId: z.string().optional(),
|
|
152
|
+
externalCategoryId: z.string().optional(),
|
|
153
|
+
slotId: z.string(),
|
|
154
|
+
productId: z.string(),
|
|
155
|
+
optionId: z.string().optional(),
|
|
156
|
+
startsAt: dateOrStringSchema,
|
|
157
|
+
remainingPax: z.number().int().min(0),
|
|
158
|
+
source: z.string(),
|
|
159
|
+
});
|
|
160
|
+
export const pushAvailabilityResultSchema = z.object({
|
|
161
|
+
externalStatus: z.string().optional(),
|
|
162
|
+
upstreamPayload: recordSchema.optional(),
|
|
163
|
+
});
|
|
164
|
+
export const pushContentRequestSchema = z.object({
|
|
165
|
+
channelId: z.string(),
|
|
166
|
+
externalProductId: z.string(),
|
|
167
|
+
productId: z.string(),
|
|
168
|
+
contentHash: z.string(),
|
|
169
|
+
content: z.unknown(),
|
|
170
|
+
contentSchemaVersion: z.string().optional(),
|
|
171
|
+
locale: localeSchema.optional(),
|
|
172
|
+
});
|
|
173
|
+
export const pushContentResultSchema = z.object({
|
|
174
|
+
externalStatus: z.string().optional(),
|
|
175
|
+
upstreamPayload: recordSchema.optional(),
|
|
176
|
+
acknowledgedHash: z.string().optional(),
|
|
177
|
+
});
|
|
178
|
+
export const sourceAdapterSchema = z.custom((value) => {
|
|
179
|
+
if (!isRecord(value) || typeof value.kind !== "string")
|
|
180
|
+
return false;
|
|
181
|
+
if (!adapterCapabilitiesSchema.safeParse(value.capabilities).success)
|
|
182
|
+
return false;
|
|
183
|
+
return [
|
|
184
|
+
"connect",
|
|
185
|
+
"pause",
|
|
186
|
+
"disconnect",
|
|
187
|
+
"getState",
|
|
188
|
+
"discover",
|
|
189
|
+
"freshnessCheck",
|
|
190
|
+
"liveResolve",
|
|
191
|
+
"getContent",
|
|
192
|
+
"reserve",
|
|
193
|
+
"cancel",
|
|
194
|
+
"pushBooking",
|
|
195
|
+
"pushAvailability",
|
|
196
|
+
"pushContent",
|
|
197
|
+
"onDrift",
|
|
198
|
+
].every((key) => optionalFunction(value[key]));
|
|
199
|
+
}, { message: "Invalid source adapter" });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.test.d.ts","sourceRoot":"","sources":["../../src/adapter/schemas.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { adapterCapabilitiesSchema, cancelRequestSchema, cancelResultSchema, catalogProjectionSchema, connectionStateSchema, discoveryCursorSchema, discoveryPageSchema, getContentRequestSchema, getContentResultSchema, liveResolveRequestSchema, liveResolveResultSchema, provenanceSchema, pushAvailabilityRequestSchema, pushAvailabilityResultSchema, pushBookingRequestSchema, pushBookingResultSchema, pushContentRequestSchema, pushContentResultSchema, reserveRequestSchema, reserveResultSchema, sourceAdapterContextSchema, sourceAdapterRequestScopeSchema, sourceAdapterSchema, } from "./schemas.js";
|
|
3
|
+
const typeChecks = [
|
|
4
|
+
true,
|
|
5
|
+
true,
|
|
6
|
+
true,
|
|
7
|
+
true,
|
|
8
|
+
true,
|
|
9
|
+
true,
|
|
10
|
+
true,
|
|
11
|
+
true,
|
|
12
|
+
true,
|
|
13
|
+
true,
|
|
14
|
+
true,
|
|
15
|
+
true,
|
|
16
|
+
true,
|
|
17
|
+
true,
|
|
18
|
+
true,
|
|
19
|
+
true,
|
|
20
|
+
true,
|
|
21
|
+
true,
|
|
22
|
+
true,
|
|
23
|
+
true,
|
|
24
|
+
true,
|
|
25
|
+
true,
|
|
26
|
+
true,
|
|
27
|
+
];
|
|
28
|
+
void typeChecks;
|
|
29
|
+
const capabilities = {
|
|
30
|
+
verticals: ["products"],
|
|
31
|
+
supportsLiveResolution: true,
|
|
32
|
+
supportsDriftDetection: true,
|
|
33
|
+
supportsBookingForwarding: true,
|
|
34
|
+
supportsSyncCancellation: false,
|
|
35
|
+
postBookOperations: ["cancel", "status"],
|
|
36
|
+
cacheTtlSeconds: 300,
|
|
37
|
+
supportsContentFetch: true,
|
|
38
|
+
supportedContentLocales: ["en-GB", "ro-RO"],
|
|
39
|
+
holdReleaseGraceMs: 1000,
|
|
40
|
+
supportsBookingPush: true,
|
|
41
|
+
supportsAvailabilityPush: true,
|
|
42
|
+
supportsContentPush: true,
|
|
43
|
+
};
|
|
44
|
+
const context = {
|
|
45
|
+
connection_id: "conn_123",
|
|
46
|
+
credentials: { apiKey: "secret" },
|
|
47
|
+
tenant_id: "tenant_1",
|
|
48
|
+
correlation_id: "corr_1",
|
|
49
|
+
};
|
|
50
|
+
const provenance = {
|
|
51
|
+
source_kind: "direct:tui",
|
|
52
|
+
source_provider: "tui",
|
|
53
|
+
source_connection_id: "conn_123",
|
|
54
|
+
source_ref: "TUI-123",
|
|
55
|
+
source_freshness: "sync",
|
|
56
|
+
last_sourced_at: new Date("2026-01-01T00:00:00Z"),
|
|
57
|
+
};
|
|
58
|
+
const projection = {
|
|
59
|
+
entity_module: "products",
|
|
60
|
+
entity_id: "prod_123",
|
|
61
|
+
provenance,
|
|
62
|
+
fields: { title: "Sample tour", country: "RO" },
|
|
63
|
+
};
|
|
64
|
+
const discoveryPage = {
|
|
65
|
+
projections: [projection],
|
|
66
|
+
next_cursor: "cursor_2",
|
|
67
|
+
};
|
|
68
|
+
const liveResolveRequest = {
|
|
69
|
+
ids: ["prod_123"],
|
|
70
|
+
scope: {
|
|
71
|
+
locale: "en-GB",
|
|
72
|
+
audience: "customer",
|
|
73
|
+
market: "GB",
|
|
74
|
+
currency: "GBP",
|
|
75
|
+
},
|
|
76
|
+
parameters: { departureId: "dep_1" },
|
|
77
|
+
};
|
|
78
|
+
const sourceAdapterRequestScope = liveResolveRequest.scope;
|
|
79
|
+
const liveResolveResult = {
|
|
80
|
+
values: {
|
|
81
|
+
prod_123: {
|
|
82
|
+
price: { amount: "100.00", currency: "GBP" },
|
|
83
|
+
remainingPax: 4,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
failed: { prod_missing: "not_found" },
|
|
87
|
+
};
|
|
88
|
+
const getContentRequest = {
|
|
89
|
+
entity_module: "products",
|
|
90
|
+
entity_id: "prod_123",
|
|
91
|
+
locale: "ro-RO",
|
|
92
|
+
market: "RO",
|
|
93
|
+
currency: "RON",
|
|
94
|
+
};
|
|
95
|
+
const getContentResult = {
|
|
96
|
+
entity_module: "products",
|
|
97
|
+
entity_id: "prod_123",
|
|
98
|
+
source_ref: "TUI-123",
|
|
99
|
+
returned_locale: "en-GB",
|
|
100
|
+
machine_translated: false,
|
|
101
|
+
content: { product: { title: "Sample tour" } },
|
|
102
|
+
content_schema_version: "products/v1",
|
|
103
|
+
source_updated_at: new Date("2026-01-02T00:00:00Z"),
|
|
104
|
+
fresh_until: new Date("2026-01-03T00:00:00Z"),
|
|
105
|
+
etag: "etag-1",
|
|
106
|
+
};
|
|
107
|
+
const reserveRequest = {
|
|
108
|
+
entity_module: "products",
|
|
109
|
+
entity_id: "prod_123",
|
|
110
|
+
parameters: { departureId: "dep_1" },
|
|
111
|
+
party: { travelers: 2 },
|
|
112
|
+
payment_intent: { type: "hold" },
|
|
113
|
+
scope: sourceAdapterRequestScope,
|
|
114
|
+
idempotency_key: "reserve_123",
|
|
115
|
+
};
|
|
116
|
+
const reserveResult = {
|
|
117
|
+
upstream_ref: "booking_123",
|
|
118
|
+
status: "held",
|
|
119
|
+
upstream_payload: { holdToken: "hold_1" },
|
|
120
|
+
};
|
|
121
|
+
const cancelRequest = {
|
|
122
|
+
upstream_ref: "booking_123",
|
|
123
|
+
reason: "customer_request",
|
|
124
|
+
scope: sourceAdapterRequestScope,
|
|
125
|
+
idempotency_key: "cancel_123",
|
|
126
|
+
};
|
|
127
|
+
const cancelResult = {
|
|
128
|
+
status: "pending",
|
|
129
|
+
pending_channel: "partner portal",
|
|
130
|
+
};
|
|
131
|
+
const pushBookingRequest = {
|
|
132
|
+
idempotencyKey: "idem_1",
|
|
133
|
+
bookingId: "book_1",
|
|
134
|
+
bookingItemId: "item_1",
|
|
135
|
+
externalProductId: "EXT-1",
|
|
136
|
+
externalRateId: "RATE-1",
|
|
137
|
+
externalCategoryId: "CAT-1",
|
|
138
|
+
channelId: "channel_1",
|
|
139
|
+
contractPolicy: { commission: 0.1 },
|
|
140
|
+
payload: { travelers: 2 },
|
|
141
|
+
};
|
|
142
|
+
const pushBookingResult = {
|
|
143
|
+
upstreamRef: "upstream_1",
|
|
144
|
+
externalReference: "CONF-1",
|
|
145
|
+
externalStatus: "confirmed",
|
|
146
|
+
upstreamPayload: { ok: true },
|
|
147
|
+
};
|
|
148
|
+
const pushAvailabilityRequest = {
|
|
149
|
+
channelId: "channel_1",
|
|
150
|
+
externalProductId: "EXT-1",
|
|
151
|
+
externalRateId: "RATE-1",
|
|
152
|
+
externalCategoryId: "CAT-1",
|
|
153
|
+
slotId: "slot_1",
|
|
154
|
+
productId: "prod_123",
|
|
155
|
+
optionId: "opt_1",
|
|
156
|
+
startsAt: new Date("2026-02-01T10:00:00Z"),
|
|
157
|
+
remainingPax: 8,
|
|
158
|
+
source: "booking",
|
|
159
|
+
};
|
|
160
|
+
const pushAvailabilityResult = {
|
|
161
|
+
externalStatus: "updated",
|
|
162
|
+
upstreamPayload: { ok: true },
|
|
163
|
+
};
|
|
164
|
+
const pushContentRequest = {
|
|
165
|
+
channelId: "channel_1",
|
|
166
|
+
externalProductId: "EXT-1",
|
|
167
|
+
productId: "prod_123",
|
|
168
|
+
contentHash: "hash_123",
|
|
169
|
+
content: { product: { title: "Sample tour" } },
|
|
170
|
+
contentSchemaVersion: "products/v1",
|
|
171
|
+
locale: "en-GB",
|
|
172
|
+
};
|
|
173
|
+
const pushContentResult = {
|
|
174
|
+
externalStatus: "updated",
|
|
175
|
+
upstreamPayload: { ok: true },
|
|
176
|
+
acknowledgedHash: "hash_123",
|
|
177
|
+
};
|
|
178
|
+
const sourceAdapter = {
|
|
179
|
+
kind: "direct:tui",
|
|
180
|
+
capabilities,
|
|
181
|
+
async connect() { },
|
|
182
|
+
async getState() {
|
|
183
|
+
return "active";
|
|
184
|
+
},
|
|
185
|
+
async discover() {
|
|
186
|
+
return discoveryPage;
|
|
187
|
+
},
|
|
188
|
+
async getContent(_ctx, request) {
|
|
189
|
+
return { ...getContentResult, entity_id: request.entity_id };
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
const roundTripCases = [
|
|
193
|
+
["adapterCapabilitiesSchema", adapterCapabilitiesSchema, capabilities],
|
|
194
|
+
["connectionStateSchema", connectionStateSchema, "active"],
|
|
195
|
+
["sourceAdapterContextSchema", sourceAdapterContextSchema, context],
|
|
196
|
+
["provenanceSchema", provenanceSchema, provenance],
|
|
197
|
+
["catalogProjectionSchema", catalogProjectionSchema, projection],
|
|
198
|
+
["discoveryCursorSchema", discoveryCursorSchema, "cursor_2"],
|
|
199
|
+
["discoveryPageSchema", discoveryPageSchema, discoveryPage],
|
|
200
|
+
["sourceAdapterRequestScopeSchema", sourceAdapterRequestScopeSchema, sourceAdapterRequestScope],
|
|
201
|
+
["liveResolveRequestSchema", liveResolveRequestSchema, liveResolveRequest],
|
|
202
|
+
["liveResolveResultSchema", liveResolveResultSchema, liveResolveResult],
|
|
203
|
+
["getContentRequestSchema", getContentRequestSchema, getContentRequest],
|
|
204
|
+
["getContentResultSchema", getContentResultSchema, getContentResult],
|
|
205
|
+
["reserveRequestSchema", reserveRequestSchema, reserveRequest],
|
|
206
|
+
["reserveResultSchema", reserveResultSchema, reserveResult],
|
|
207
|
+
["cancelRequestSchema", cancelRequestSchema, cancelRequest],
|
|
208
|
+
["cancelResultSchema", cancelResultSchema, cancelResult],
|
|
209
|
+
["pushBookingRequestSchema", pushBookingRequestSchema, pushBookingRequest],
|
|
210
|
+
["pushBookingResultSchema", pushBookingResultSchema, pushBookingResult],
|
|
211
|
+
["pushAvailabilityRequestSchema", pushAvailabilityRequestSchema, pushAvailabilityRequest],
|
|
212
|
+
["pushAvailabilityResultSchema", pushAvailabilityResultSchema, pushAvailabilityResult],
|
|
213
|
+
["pushContentRequestSchema", pushContentRequestSchema, pushContentRequest],
|
|
214
|
+
["pushContentResultSchema", pushContentResultSchema, pushContentResult],
|
|
215
|
+
["sourceAdapterSchema", sourceAdapterSchema, sourceAdapter],
|
|
216
|
+
];
|
|
217
|
+
const invalidCases = [
|
|
218
|
+
["adapterCapabilitiesSchema", adapterCapabilitiesSchema, { ...capabilities, verticals: [123] }],
|
|
219
|
+
["connectionStateSchema", connectionStateSchema, "reconnecting"],
|
|
220
|
+
["sourceAdapterContextSchema", sourceAdapterContextSchema, { credentials: { apiKey: "secret" } }],
|
|
221
|
+
["provenanceSchema", provenanceSchema, { ...provenance, source_freshness: "live" }],
|
|
222
|
+
["catalogProjectionSchema", catalogProjectionSchema, { ...projection, entity_module: 123 }],
|
|
223
|
+
["discoveryCursorSchema", discoveryCursorSchema, 123],
|
|
224
|
+
["discoveryPageSchema", discoveryPageSchema, { projections: [{ fields: {} }] }],
|
|
225
|
+
[
|
|
226
|
+
"sourceAdapterRequestScopeSchema",
|
|
227
|
+
sourceAdapterRequestScopeSchema,
|
|
228
|
+
{ ...sourceAdapterRequestScope, currency: "GB" },
|
|
229
|
+
],
|
|
230
|
+
[
|
|
231
|
+
"liveResolveRequestSchema",
|
|
232
|
+
liveResolveRequestSchema,
|
|
233
|
+
{ ...liveResolveRequest, scope: { ...liveResolveRequest.scope, locale: "not_locale" } },
|
|
234
|
+
],
|
|
235
|
+
["liveResolveResultSchema", liveResolveResultSchema, { values: {}, failed: { prod_1: "gone" } }],
|
|
236
|
+
["getContentRequestSchema", getContentRequestSchema, { ...getContentRequest, currency: "EU" }],
|
|
237
|
+
[
|
|
238
|
+
"getContentResultSchema",
|
|
239
|
+
getContentResultSchema,
|
|
240
|
+
{ ...getContentResult, content_schema_version: undefined },
|
|
241
|
+
],
|
|
242
|
+
["reserveRequestSchema", reserveRequestSchema, { ...reserveRequest, parameters: undefined }],
|
|
243
|
+
["reserveResultSchema", reserveResultSchema, { ...reserveResult, status: "pending" }],
|
|
244
|
+
["cancelRequestSchema", cancelRequestSchema, { reason: "customer_request" }],
|
|
245
|
+
["cancelResultSchema", cancelResultSchema, { ...cancelResult, refund_currency: "GB" }],
|
|
246
|
+
[
|
|
247
|
+
"pushBookingRequestSchema",
|
|
248
|
+
pushBookingRequestSchema,
|
|
249
|
+
{ ...pushBookingRequest, payload: undefined },
|
|
250
|
+
],
|
|
251
|
+
["pushBookingResultSchema", pushBookingResultSchema, { externalStatus: "confirmed" }],
|
|
252
|
+
[
|
|
253
|
+
"pushAvailabilityRequestSchema",
|
|
254
|
+
pushAvailabilityRequestSchema,
|
|
255
|
+
{ ...pushAvailabilityRequest, remainingPax: -1 },
|
|
256
|
+
],
|
|
257
|
+
["pushAvailabilityResultSchema", pushAvailabilityResultSchema, { upstreamPayload: "ok" }],
|
|
258
|
+
[
|
|
259
|
+
"pushContentRequestSchema",
|
|
260
|
+
pushContentRequestSchema,
|
|
261
|
+
{ ...pushContentRequest, locale: "not_locale" },
|
|
262
|
+
],
|
|
263
|
+
["pushContentResultSchema", pushContentResultSchema, { acknowledgedHash: 123 }],
|
|
264
|
+
["sourceAdapterSchema", sourceAdapterSchema, { ...sourceAdapter, discover: "yes" }],
|
|
265
|
+
];
|
|
266
|
+
describe("catalog source-adapter schemas", () => {
|
|
267
|
+
it.each(roundTripCases)("parses %s fixtures without changing shape", (_name, schema, value) => {
|
|
268
|
+
expect(schema.parse(value)).toEqual(value);
|
|
269
|
+
});
|
|
270
|
+
it.each(invalidCases)("rejects invalid %s fixtures", (_name, schema, value) => {
|
|
271
|
+
expect(schema.safeParse(value).success).toBe(false);
|
|
272
|
+
});
|
|
273
|
+
});
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* joined at read time via the shared `booking_id` text column.
|
|
15
15
|
*/
|
|
16
16
|
import type { AnyDrizzleDb } from "@voyantjs/db";
|
|
17
|
-
import type { SourceAdapterContext } from "../adapter/contract.js";
|
|
17
|
+
import type { SourceAdapterContext, SourceAdapterRequestScope } from "../adapter/contract.js";
|
|
18
18
|
import { type PricingBasis, type SelectBookingCatalogSnapshot } from "../snapshot/schema.js";
|
|
19
19
|
import type { OwnedBookingHandlerRegistry } from "./owned-handler.js";
|
|
20
20
|
import type { SourceAdapterRegistry } from "./registry.js";
|
|
@@ -69,6 +69,12 @@ export interface BookEntityRequest {
|
|
|
69
69
|
market?: string;
|
|
70
70
|
currency?: string;
|
|
71
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* Per-request supplier scope forwarded to `SourceAdapter.reserve`.
|
|
74
|
+
* Kept separate from `contentScope`: this controls upstream write
|
|
75
|
+
* semantics, while `contentScope` controls snapshot-content capture.
|
|
76
|
+
*/
|
|
77
|
+
adapterScope?: SourceAdapterRequestScope;
|
|
72
78
|
}
|
|
73
79
|
export interface BookEntityResult {
|
|
74
80
|
bookingId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"book.d.ts","sourceRoot":"","sources":["../../src/booking-engine/book.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAIhD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"book.d.ts","sourceRoot":"","sources":["../../src/booking-engine/book.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAIhD,OAAO,KAAK,EAEV,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,4BAA4B,EAClC,MAAM,uBAAuB,CAAA;AAS9B,OAAO,KAAK,EAAE,2BAA2B,EAAE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,CAAA;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,qBAAqB,CAAA;IAC/B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,2BAA2B,CAAA;IAC3C;;;;;;;;;;;;;;;OAeG;IACH,sBAAsB,CAAC,EAAE,uBAAuB,CAAA;CACjD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,UAAU,CAC9B,EAAE,EAAE,YAAY,EAChB,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,gBAAgB,CAAC,CAiL3B;AAoID,YAAY,EAAE,4BAA4B,EAAE,CAAA"}
|
|
@@ -20,6 +20,9 @@ import { bookingCatalogSnapshotTable, } from "../snapshot/schema.js";
|
|
|
20
20
|
import { BookingEngineError, QUOTE_NOT_FOUND, QuoteExpiredError, QuoteMismatchError, ReserveFailedError, } from "./errors.js";
|
|
21
21
|
import { OWNED_SOURCE_KIND } from "./owned-handler.js";
|
|
22
22
|
import { catalogQuotesTable } from "./schema.js";
|
|
23
|
+
function paymentIntentToAdapterRecord(intent) {
|
|
24
|
+
return { ...intent };
|
|
25
|
+
}
|
|
23
26
|
/**
|
|
24
27
|
* Book the row referenced by `quoteId`. End-to-end: validate quote,
|
|
25
28
|
* dispatch `adapter.reserve`, capture snapshot, mark quote consumed.
|
|
@@ -122,7 +125,9 @@ export async function bookEntity(db, deps, request) {
|
|
|
122
125
|
entity_id: quote.entity_id,
|
|
123
126
|
parameters: request.parameters ?? {},
|
|
124
127
|
party: request.party,
|
|
125
|
-
payment_intent: paymentIntent,
|
|
128
|
+
payment_intent: paymentIntentToAdapterRecord(paymentIntent),
|
|
129
|
+
scope: request.adapterScope,
|
|
130
|
+
idempotency_key: request.idempotencyKey,
|
|
126
131
|
};
|
|
127
132
|
const reserveResult = await adapter.reserve(request.adapterContext, reserveRequest);
|
|
128
133
|
if (reserveResult.status === "failed") {
|
|
@@ -8,19 +8,22 @@
|
|
|
8
8
|
* decoupling from `packages/bookings`.
|
|
9
9
|
*/
|
|
10
10
|
import type { AnyDrizzleDb } from "@voyantjs/db";
|
|
11
|
-
import type { CancelResult, SourceAdapterContext } from "../adapter/contract.js";
|
|
11
|
+
import type { CancelResult, SourceAdapterContext, SourceAdapterRequestScope } from "../adapter/contract.js";
|
|
12
12
|
import type { SourceAdapterRegistry } from "./registry.js";
|
|
13
13
|
export interface CancelEntityRequest {
|
|
14
14
|
bookingId: string;
|
|
15
15
|
entityModule: string;
|
|
16
16
|
entityId: string;
|
|
17
17
|
reason?: string;
|
|
18
|
+
scope?: SourceAdapterRequestScope;
|
|
19
|
+
idempotencyKey?: string;
|
|
18
20
|
adapterContext: SourceAdapterContext;
|
|
19
21
|
}
|
|
20
22
|
export interface CancelEntityResult {
|
|
21
23
|
status: CancelResult["status"];
|
|
22
24
|
refundAmount?: number;
|
|
23
25
|
refundCurrency?: string;
|
|
26
|
+
pendingChannel?: string;
|
|
24
27
|
/** The snapshot row's id — exposed for callers that want to log the cancel against it. */
|
|
25
28
|
snapshotId: string;
|
|
26
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancel.d.ts","sourceRoot":"","sources":["../../src/booking-engine/cancel.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAGhD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"cancel.d.ts","sourceRoot":"","sources":["../../src/booking-engine/cancel.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAGhD,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAA;AAO/B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAE1D,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,yBAAyB,CAAA;IACjC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,cAAc,EAAE,oBAAoB,CAAA;CACrC;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAA;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,0FAA0F;IAC1F,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,qBAAqB,CAAA;CAChC;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,EAAE,EAAE,YAAY,EAChB,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,kBAAkB,CAAC,CA2B7B"}
|
|
@@ -31,11 +31,14 @@ export async function cancelEntity(db, deps, request) {
|
|
|
31
31
|
const result = await adapter.cancel(request.adapterContext, {
|
|
32
32
|
upstream_ref: snapshot.source_ref ?? snapshot.id,
|
|
33
33
|
reason: request.reason,
|
|
34
|
+
scope: request.scope,
|
|
35
|
+
idempotency_key: request.idempotencyKey,
|
|
34
36
|
});
|
|
35
37
|
return {
|
|
36
38
|
status: result.status,
|
|
37
39
|
refundAmount: result.refund_amount,
|
|
38
40
|
refundCurrency: result.refund_currency,
|
|
41
|
+
pendingChannel: result.pending_channel,
|
|
39
42
|
snapshotId: snapshot.id,
|
|
40
43
|
};
|
|
41
44
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { ADAPTER_RATE_LIMITED, type AdapterCapabilities, AdapterRateLimitedError, CAPABILITY_NOT_SUPPORTED, type CancelRequest, type CancelResult, CapabilityNotSupportedError, type CatalogProjection, type ConnectionState, type DiscoveryCursor, type DiscoveryPage, type GetContentRequest, type GetContentResult, type LiveResolveRequest, type LiveResolveResult, type PushAvailabilityRequest, type PushAvailabilityResult, type PushBookingRequest, type PushBookingResult, type PushContentRequest, type PushContentResult, type ReserveRequest, type ReserveResult, type SourceAdapter, type SourceAdapterContext, } from "./adapter/contract.js";
|
|
1
|
+
export { ADAPTER_RATE_LIMITED, type AdapterCapabilities, AdapterRateLimitedError, CAPABILITY_NOT_SUPPORTED, type CancelRequest, type CancelResult, CapabilityNotSupportedError, type CatalogProjection, type ConnectionState, type DiscoveryCursor, type DiscoveryPage, type GetContentRequest, type GetContentResult, type LiveResolveRequest, type LiveResolveResult, type PushAvailabilityRequest, type PushAvailabilityResult, type PushBookingRequest, type PushBookingResult, type PushContentRequest, type PushContentResult, type ReserveRequest, type ReserveResult, type SourceAdapter, type SourceAdapterContext, type SourceAdapterRequestScope, } from "./adapter/contract.js";
|
|
2
|
+
export * from "./adapter/schemas.js";
|
|
2
3
|
export { type CatalogBookingAdapterContextInput, type CatalogBookingBookBody, type CatalogBookingBookTransformInput, type CatalogBookingCommittedEvent, type CatalogBookingContentScopeInput, type CatalogBookingDraftBody, type CatalogBookingDraftConsumedError, type CatalogBookingHoldPlaceBody, type CatalogBookingHoldReleaseBody, type CatalogBookingHoldTtlInput, type CatalogBookingProvenance, type CatalogBookingProvenanceInput, type CatalogBookingQuoteBody, type CatalogBookingQuoteTransformInput, type CatalogBookingRoutesOptions, createCatalogBookingHonoModule, createCatalogBookingRoutes, } from "./booking-engine/routes.js";
|
|
3
4
|
export * from "./contract.js";
|
|
4
5
|
export { blocksBookings, type CatalogDriftEvent, type ContentDriftEvent, type ContentDriftKind, type FieldDrift, maxDriftSeverity, } from "./drift/events.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,2BAA2B,EAC3B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,2BAA2B,EAC3B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,GAC/B,MAAM,uBAAuB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AAGpC,OAAO,EACL,KAAK,iCAAiC,EACtC,KAAK,sBAAsB,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oB,EACpB,KAAK,iCAAiC,EACtC,sBAAsB,GACvB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,qBAAqB,GAC3B,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,6BAA6B,EAC7B,cAAc,EACd,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,YAAY,GACb,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACL,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,kBAAkB,GACnB,MAAM,qCAAqC,CAAA;AAE5C,OAAO,EACL,2BAA2B,EAC3B,KAAK,4BAA4B,EACjC,KAAK,YAAY,EACjB,gBAAgB,EAChB,KAAK,4BAA4B,GAClC,MAAM,sBAAsB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Field-policy contract — the load-bearing schema decision.
|
|
2
2
|
// Public source-adapter contract.
|
|
3
3
|
export { ADAPTER_RATE_LIMITED, AdapterRateLimitedError, CAPABILITY_NOT_SUPPORTED, CapabilityNotSupportedError, } from "./adapter/contract.js";
|
|
4
|
+
export * from "./adapter/schemas.js";
|
|
4
5
|
// BookingJourney HTTP contract — root export matches the Hono module pattern
|
|
5
6
|
// used by the vertical packages while keeping the ./booking-engine subpath.
|
|
6
7
|
export { createCatalogBookingHonoModule, createCatalogBookingRoutes, } from "./booking-engine/routes.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/catalog",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -79,6 +79,11 @@
|
|
|
79
79
|
"import": "./dist/adapter/contract.js",
|
|
80
80
|
"default": "./dist/adapter/contract.js"
|
|
81
81
|
},
|
|
82
|
+
"./adapter/schemas": {
|
|
83
|
+
"types": "./dist/adapter/schemas.d.ts",
|
|
84
|
+
"import": "./dist/adapter/schemas.js",
|
|
85
|
+
"default": "./dist/adapter/schemas.js"
|
|
86
|
+
},
|
|
82
87
|
"./services/overlay": {
|
|
83
88
|
"types": "./dist/services/overlay-service.d.ts",
|
|
84
89
|
"import": "./dist/services/overlay-service.js",
|
|
@@ -140,9 +145,9 @@
|
|
|
140
145
|
"drizzle-orm": "^0.45.2",
|
|
141
146
|
"hono": "^4.12.10",
|
|
142
147
|
"zod": "^4.1.4",
|
|
143
|
-
"@voyantjs/core": "0.
|
|
144
|
-
"@voyantjs/db": "0.
|
|
145
|
-
"@voyantjs/hono": "0.
|
|
148
|
+
"@voyantjs/core": "0.59.0",
|
|
149
|
+
"@voyantjs/db": "0.59.0",
|
|
150
|
+
"@voyantjs/hono": "0.59.0"
|
|
146
151
|
},
|
|
147
152
|
"devDependencies": {
|
|
148
153
|
"drizzle-kit": "^0.31.10",
|