@nymbalhq/platform 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/dist/chunk-2PLYK5RU.js +5861 -0
- package/dist/chunk-2PLYK5RU.js.map +1 -0
- package/dist/{chunk-PW6ILJF7.js → chunk-QN56IB4G.js} +146 -10
- package/dist/chunk-QN56IB4G.js.map +1 -0
- package/dist/db/schema/index.d.ts +3798 -2050
- package/dist/db/schema/index.js +1 -2
- package/dist/index.d.ts +423 -21
- package/dist/index.js +1647 -1873
- package/dist/index.js.map +1 -1
- package/dist/register-UUQ64HZP.js +8 -0
- package/migrations/postgres/0008_event_correlation.sql +6 -0
- package/migrations/postgres/0009_settings.sql +13 -0
- package/migrations/postgres/0010_catch_up_index.sql +2 -0
- package/migrations/postgres/0011_audit_entries.sql +27 -0
- package/migrations/postgres/0012_event_subject.sql +27 -0
- package/migrations/postgres/meta/0008_snapshot.json +1625 -0
- package/migrations/postgres/meta/0009_snapshot.json +1705 -0
- package/migrations/postgres/meta/0010_snapshot.json +1732 -0
- package/migrations/postgres/meta/0011_snapshot.json +1887 -0
- package/migrations/postgres/meta/0012_snapshot.json +1926 -0
- package/migrations/postgres/meta/_journal.json +35 -0
- package/migrations/sqlite/0008_event_correlation.sql +7 -0
- package/migrations/sqlite/0009_settings.sql +13 -0
- package/migrations/sqlite/0010_catch_up_index.sql +2 -0
- package/migrations/sqlite/0011_audit_entries.sql +26 -0
- package/migrations/sqlite/0012_event_subject.sql +27 -0
- package/migrations/sqlite/meta/0008_snapshot.json +1485 -0
- package/migrations/sqlite/meta/0009_snapshot.json +1571 -0
- package/migrations/sqlite/meta/0010_snapshot.json +1580 -0
- package/migrations/sqlite/meta/0011_snapshot.json +1705 -0
- package/migrations/sqlite/meta/0012_snapshot.json +1728 -0
- package/migrations/sqlite/meta/_journal.json +35 -0
- package/package.json +29 -23
- package/dist/chunk-2GFZHF5W.js +0 -2647
- package/dist/chunk-2GFZHF5W.js.map +0 -1
- package/dist/chunk-PW6ILJF7.js.map +0 -1
- package/dist/chunk-PZ5AY32C.js +0 -10
- package/dist/register-FJA7YJV3.js +0 -8
- package/dist/register-FJA7YJV3.js.map +0 -1
- /package/dist/{chunk-PZ5AY32C.js.map → register-UUQ64HZP.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NymbalConfig } from '@nymbalhq/config';
|
|
2
|
-
import { Logger, DocumentStoreAdapter, EventBusAdapter, MediaStorage, Product, ProductStatus, ProductType, ProductMedia, Variant, VariantDimensions, VariantOption, VariantStatus, Category, Customer, Role, CustomerAddress, Order, OrderStatus, Address, OrderLineItem, CaptureMethod, OrderHistoryEntry, OrderRefundStatus, OrderRefund, InventoryReservation, StockAdjustmentReason, StockAdjustment, Review, ReviewModerationStatus, NymbalEvent, Cart, HealthReport, PutOptions, QueryParams, QueryResult, EventHandler, SubscriptionConfig, Subscription, NymbalEnvironment, NymbalEventType, NymbalEventMap, CommerceSlotAdapters, SecurityAdapter, AiAdapter, PaymentsAdapter, ProductSnapshot, CartItem, StockStatus, PaymentIntent, CheckoutPayment, SearchParams, SearchResult, SearchAdapter, OrderPayment, Refund,
|
|
3
|
-
export { MediaStorage } from '@nymbalhq/types';
|
|
2
|
+
import { Logger, DocumentStoreAdapter, EventBusAdapter, MediaStorage, Product, ProductStatus, ProductType, ProductMedia, Variant, VariantDimensions, VariantOption, VariantStatus, Category, Customer, Role, CustomerAddress, Order, OrderStatus, Address, OrderLineItem, CaptureMethod, OrderHistoryEntry, OrderRefundStatus, OrderRefund, InventoryReservation, StockAdjustmentReason, StockAdjustment, Review, ReviewModerationStatus, NymbalEvent, Cart, AuditSubject, AuditActor, AuditOutcome, AuditEntry, HealthReport, PutOptions, QueryParams, QueryResult, EventHandler, SubscriptionConfig, Subscription, NymbalEnvironment, NymbalEventType, NymbalEventMap, RequestAuth, AdapterSetting, CommerceSlotAdapters, SecurityAdapter, AiAdapter, PaymentsAdapter, ProductSnapshot, CartItem, StockStatus, PaymentIntent, CheckoutPayment, SearchParams, SearchResult, SearchAdapter, OrderPayment, Refund, CommerceSlot, HttpAdapter, Slot, ProviderPackageModule, RateLimitAction, EmailAdapter, ReviewsAdapter, AnalyticsAdapter, ShippingAdapter, TaxAdapter, HealthStatus } from '@nymbalhq/types';
|
|
3
|
+
export { MediaStorage, buildSecurityHeaders, isValidCorrelationId } from '@nymbalhq/types';
|
|
4
4
|
import BetterSqlite3 from 'better-sqlite3';
|
|
5
5
|
import pg from 'pg';
|
|
6
6
|
import { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
|
@@ -8,6 +8,7 @@ import { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
|
|
8
8
|
import { sqliteSchema, postgresSchema } from './db/schema/index.js';
|
|
9
9
|
import { JWTPayload } from 'jose';
|
|
10
10
|
import { ZodTypeAny } from 'zod';
|
|
11
|
+
import { DestinationStream } from 'pino';
|
|
11
12
|
import 'drizzle-orm/sqlite-core';
|
|
12
13
|
import 'drizzle-orm/pg-core';
|
|
13
14
|
|
|
@@ -172,6 +173,12 @@ declare function createCategoryRepository$1(store: CommandStore): {
|
|
|
172
173
|
insertMany(items: CategoryInsert$1[]): Promise<void>;
|
|
173
174
|
};
|
|
174
175
|
|
|
176
|
+
/** One page of a walk over a table by primary key: the rows whose id is above `after`, at most `limit` of them. */
|
|
177
|
+
interface KeysetPage {
|
|
178
|
+
after?: string;
|
|
179
|
+
limit: number;
|
|
180
|
+
}
|
|
181
|
+
|
|
175
182
|
interface ProductInsert {
|
|
176
183
|
id: string;
|
|
177
184
|
slug: string;
|
|
@@ -207,6 +214,8 @@ interface ProductRepository extends StoreRepository {
|
|
|
207
214
|
limit?: number;
|
|
208
215
|
offset?: number;
|
|
209
216
|
}): Promise<Product[]>;
|
|
217
|
+
/** Rows by id after `page.after`: a walk over the table that a concurrent write cannot make skip a row. */
|
|
218
|
+
listPage(tx: ReadTx, page: KeysetPage): Promise<Product[]>;
|
|
210
219
|
insert(tx: Tx, p: ProductInsert): Promise<void>;
|
|
211
220
|
update(tx: Tx, id: string, patch: ProductUpdate): Promise<void>;
|
|
212
221
|
delete(tx: Tx, id: string): Promise<void>;
|
|
@@ -274,6 +283,8 @@ interface CategoryRepository extends StoreRepository {
|
|
|
274
283
|
findById(tx: ReadTx, id: string): Promise<Category | null>;
|
|
275
284
|
findBySlug(tx: ReadTx, slug: string): Promise<Category | null>;
|
|
276
285
|
list(tx: ReadTx): Promise<Category[]>;
|
|
286
|
+
/** Rows by id after `page.after`: a walk over the table that a concurrent write cannot make skip a row. */
|
|
287
|
+
listPage(tx: ReadTx, page: KeysetPage): Promise<Category[]>;
|
|
277
288
|
insert(tx: Tx, c: CategoryInsert): Promise<void>;
|
|
278
289
|
update(tx: Tx, id: string, patch: CategoryUpdate): Promise<void>;
|
|
279
290
|
delete(tx: Tx, id: string): Promise<void>;
|
|
@@ -326,6 +337,8 @@ interface CustomerRepository extends StoreRepository {
|
|
|
326
337
|
limit?: number;
|
|
327
338
|
offset?: number;
|
|
328
339
|
}): Promise<CustomerWithHash[]>;
|
|
340
|
+
/** Rows by id after `page.after`: a walk over the table that a concurrent write cannot make skip a row. */
|
|
341
|
+
listPage(tx: ReadTx, page: KeysetPage): Promise<CustomerWithHash[]>;
|
|
329
342
|
insert(tx: Tx, c: CustomerInsert): Promise<void>;
|
|
330
343
|
update(tx: Tx, id: string, patch: CustomerUpdate): Promise<void>;
|
|
331
344
|
incrementStats(tx: Tx, id: string, deltaOrders: number, deltaSpentMinor: number, updatedAt: Date): Promise<void>;
|
|
@@ -409,6 +422,8 @@ interface OrderRepository extends StoreRepository {
|
|
|
409
422
|
limit?: number;
|
|
410
423
|
offset?: number;
|
|
411
424
|
}): Promise<Order[]>;
|
|
425
|
+
/** Rows by id after `page.after`: a walk over the table that a concurrent write cannot make skip a row. */
|
|
426
|
+
listPage(tx: ReadTx, page: KeysetPage): Promise<Order[]>;
|
|
412
427
|
insert(tx: Tx, o: OrderInsert): Promise<void>;
|
|
413
428
|
setStatus(tx: Tx, id: string, status: OrderStatus, updatedAt: Date): Promise<void>;
|
|
414
429
|
/** Sets `status` only while the order is still `from`; false when it was not, so a concurrent writer got there
|
|
@@ -518,9 +533,15 @@ interface ReviewInsert {
|
|
|
518
533
|
moderationStatus?: ReviewModerationStatus;
|
|
519
534
|
submittedAt: Date;
|
|
520
535
|
}
|
|
536
|
+
/** Where a page of a product's reviews starts: after this review, in the newest-first, then id-descending order. */
|
|
537
|
+
interface ReviewKey {
|
|
538
|
+
submittedAt: string;
|
|
539
|
+
id: string;
|
|
540
|
+
}
|
|
521
541
|
interface ReviewRepository extends StoreRepository {
|
|
522
542
|
findById(tx: ReadTx, id: string): Promise<Review | null>;
|
|
523
|
-
|
|
543
|
+
/** Newest first, ties by id descending; `after` is the last review of the previous page. */
|
|
544
|
+
listByProduct(tx: ReadTx, productId: string, status?: ReviewModerationStatus, limit?: number, after?: ReviewKey): Promise<Review[]>;
|
|
524
545
|
listByStatus(tx: ReadTx, status: ReviewModerationStatus, limit?: number): Promise<Review[]>;
|
|
525
546
|
insert(tx: Tx, r: ReviewInsert): Promise<void>;
|
|
526
547
|
setModerationStatus(tx: Tx, id: string, status: ReviewModerationStatus, moderatedBy: string, moderatedAt: Date): Promise<void>;
|
|
@@ -542,12 +563,29 @@ interface ProcessedEventRepository extends StoreRepository {
|
|
|
542
563
|
}
|
|
543
564
|
declare function createProcessedEventRepository(store: CommandStore): ProcessedEventRepository;
|
|
544
565
|
|
|
566
|
+
/** The record an event is about: what `events.subject_type` and `events.subject_id` hold. */
|
|
567
|
+
interface EventSubject {
|
|
568
|
+
type: string;
|
|
569
|
+
id: string;
|
|
570
|
+
}
|
|
571
|
+
|
|
545
572
|
interface LoggedEvent {
|
|
546
573
|
seq: number;
|
|
547
574
|
event: NymbalEvent<unknown>;
|
|
548
575
|
deliveredAt: Date | null;
|
|
549
576
|
attempts: number;
|
|
550
577
|
deadAt: Date | null;
|
|
578
|
+
createdAt: Date;
|
|
579
|
+
}
|
|
580
|
+
/** Filters for reading the log. A type glob's `*` matches any run of characters, dots included (`order.*`). */
|
|
581
|
+
interface EventLogFilter {
|
|
582
|
+
/** Type globs; an event matches when its type matches any of them. */
|
|
583
|
+
types?: string[];
|
|
584
|
+
/** Appended at or after. */
|
|
585
|
+
since?: Date;
|
|
586
|
+
/** Appended before. */
|
|
587
|
+
until?: Date;
|
|
588
|
+
limit: number;
|
|
551
589
|
}
|
|
552
590
|
interface EventLogRepository extends StoreRepository {
|
|
553
591
|
/** Appends in array order, so `seq` follows publish order. */
|
|
@@ -560,6 +598,33 @@ interface EventLogRepository extends StoreRepository {
|
|
|
560
598
|
/** Deletes delivered events delivered before `at`; returns how many. Undelivered and dead events are never deleted. */
|
|
561
599
|
deleteDeliveredBefore(tx: Tx, at: Date): Promise<number>;
|
|
562
600
|
listAll(tx: ReadTx): Promise<LoggedEvent[]>;
|
|
601
|
+
/** One correlation id's events, by `seq`. */
|
|
602
|
+
queryByCorrelation(tx: ReadTx, correlationId: string, filter: EventLogFilter): Promise<LoggedEvent[]>;
|
|
603
|
+
/** Events above `seq`, by `seq`. */
|
|
604
|
+
listAfter(tx: ReadTx, seq: number, filter: Pick<EventLogFilter, 'types' | 'limit'>): Promise<LoggedEvent[]>;
|
|
605
|
+
/** The highest `seq` in the log, or 0 when it is empty. */
|
|
606
|
+
maxSeq(tx: ReadTx): Promise<number>;
|
|
607
|
+
/**
|
|
608
|
+
* What a read-model rebuild re-applies after its swap: every event that is not dead and was delivered at or after
|
|
609
|
+
* `since`, or not yet delivered, by `seq`. `afterSeq` and `limit` page through them.
|
|
610
|
+
*/
|
|
611
|
+
listForCatchUp(tx: ReadTx, since: Date, page?: {
|
|
612
|
+
afterSeq?: number;
|
|
613
|
+
limit?: number;
|
|
614
|
+
}): Promise<LoggedEvent[]>;
|
|
615
|
+
/** Delivered events delivered before `at`, by `seq`: what retention may archive. Undelivered and dead events never are. */
|
|
616
|
+
listDeliveredBefore(tx: ReadTx, at: Date, limit: number): Promise<LoggedEvent[]>;
|
|
617
|
+
/** Deletes the delivered events with these `seq`s; returns how many. */
|
|
618
|
+
deleteSeqs(tx: Tx, seqs: number[]): Promise<number>;
|
|
619
|
+
/**
|
|
620
|
+
* The events whose subject is one of `subjects`, by `seq`: those appended at or before `until`, above `afterSeq`, at
|
|
621
|
+
* most `limit`.
|
|
622
|
+
*/
|
|
623
|
+
listBySubjects(tx: ReadTx, subjects: EventSubject[], page: {
|
|
624
|
+
until?: Date;
|
|
625
|
+
afterSeq?: number;
|
|
626
|
+
limit: number;
|
|
627
|
+
}): Promise<LoggedEvent[]>;
|
|
563
628
|
}
|
|
564
629
|
declare function createEventLogRepository(store: CommandStore): EventLogRepository;
|
|
565
630
|
|
|
@@ -604,6 +669,91 @@ interface CartRepository extends StoreRepository {
|
|
|
604
669
|
}
|
|
605
670
|
declare function createCartRepository(store: CommandStore): CartRepository;
|
|
606
671
|
|
|
672
|
+
/** A row of `settings`: a secret's ciphertext with its IV, tag and key id, or a non-secret's `plain` value. */
|
|
673
|
+
interface SettingRow {
|
|
674
|
+
slot: string;
|
|
675
|
+
path: string;
|
|
676
|
+
ciphertext: Buffer | null;
|
|
677
|
+
plain: string | null;
|
|
678
|
+
iv: Buffer | null;
|
|
679
|
+
tag: Buffer | null;
|
|
680
|
+
keyId: string | null;
|
|
681
|
+
updatedAt: Date;
|
|
682
|
+
updatedBy: string | null;
|
|
683
|
+
}
|
|
684
|
+
interface SettingsRepository extends StoreRepository {
|
|
685
|
+
list(tx: ReadTx): Promise<SettingRow[]>;
|
|
686
|
+
get(tx: ReadTx, slot: string, path: string): Promise<SettingRow | undefined>;
|
|
687
|
+
/** Inserts the row, or replaces the one at its slot and path. */
|
|
688
|
+
put(tx: Tx, row: SettingRow): Promise<void>;
|
|
689
|
+
/** Whether a row was there to delete. */
|
|
690
|
+
delete(tx: Tx, slot: string, path: string): Promise<boolean>;
|
|
691
|
+
/** Every row, or those of one slot, or one path of it; how many went. */
|
|
692
|
+
clear(tx: Tx, filter?: {
|
|
693
|
+
slot?: string;
|
|
694
|
+
path?: string;
|
|
695
|
+
}): Promise<number>;
|
|
696
|
+
}
|
|
697
|
+
declare function createSettingsRepository(store: CommandStore): SettingsRepository;
|
|
698
|
+
|
|
699
|
+
interface AuditEntryInsert {
|
|
700
|
+
id: string;
|
|
701
|
+
at: Date;
|
|
702
|
+
actor: AuditActor;
|
|
703
|
+
command: string;
|
|
704
|
+
subjects: AuditSubject[];
|
|
705
|
+
correlationId: string | null;
|
|
706
|
+
idempotencyKey: string | null;
|
|
707
|
+
requestHash: string | null;
|
|
708
|
+
outcome: AuditOutcome;
|
|
709
|
+
responseStatus: number | null;
|
|
710
|
+
/** Kept only on a keyed `applied` row, to answer its replays. */
|
|
711
|
+
responseBody: unknown;
|
|
712
|
+
}
|
|
713
|
+
/** A keyed `applied` row: what its replays answer. */
|
|
714
|
+
interface AppliedEntry {
|
|
715
|
+
requestHash: string | null;
|
|
716
|
+
subjects: AuditSubject[];
|
|
717
|
+
responseStatus: number;
|
|
718
|
+
responseBody: unknown;
|
|
719
|
+
}
|
|
720
|
+
/** A position in the (at, id) order the entries are listed in. */
|
|
721
|
+
interface AuditCursor {
|
|
722
|
+
at: string;
|
|
723
|
+
id: string;
|
|
724
|
+
}
|
|
725
|
+
interface AuditQuery {
|
|
726
|
+
/** `kind:id`, a kind alone, or an actor id. */
|
|
727
|
+
actor?: string;
|
|
728
|
+
command?: string;
|
|
729
|
+
/** A subject's id. */
|
|
730
|
+
subject?: string;
|
|
731
|
+
correlation?: string;
|
|
732
|
+
outcome?: AuditOutcome;
|
|
733
|
+
/** From `since` inclusive to `until` exclusive. */
|
|
734
|
+
since?: Date;
|
|
735
|
+
until?: Date;
|
|
736
|
+
/** `desc`: newest first, the entries before `cursor`; `asc`: oldest first, the entries after it. */
|
|
737
|
+
order: 'asc' | 'desc';
|
|
738
|
+
cursor?: AuditCursor;
|
|
739
|
+
limit: number;
|
|
740
|
+
}
|
|
741
|
+
/** Appends one entry in `tx`. Entries are never updated or deleted (the tables' triggers refuse it). */
|
|
742
|
+
declare function appendAuditEntry(tx: Tx, e: AuditEntryInsert): Promise<void>;
|
|
743
|
+
/** The `applied` entry `actorId` made of `command` under `key`, if any. */
|
|
744
|
+
declare function findAppliedByKey(tx: ReadTx, actorId: string, command: string, key: string): Promise<AppliedEntry | null>;
|
|
745
|
+
/** Entries matching `q`, in its order, at most `q.limit`; never a stored response body. */
|
|
746
|
+
declare function listAuditEntries(tx: ReadTx, q: AuditQuery): Promise<AuditEntry[]>;
|
|
747
|
+
type AuditFilter = Omit<AuditQuery, 'order' | 'cursor' | 'limit'>;
|
|
748
|
+
/** Every entry matching `filter`, oldest first, one read per page: what both exports print, a line each. */
|
|
749
|
+
declare function auditEntriesInOrder(store: CommandStore, filter: AuditFilter, pageSize?: number): AsyncGenerator<AuditEntry>;
|
|
750
|
+
interface AuditEntryRepository extends StoreRepository {
|
|
751
|
+
append(tx: Tx, entry: AuditEntryInsert): Promise<void>;
|
|
752
|
+
findAppliedByKey(tx: ReadTx, actorId: string, command: string, key: string): Promise<AppliedEntry | null>;
|
|
753
|
+
list(tx: ReadTx, query: AuditQuery): Promise<AuditEntry[]>;
|
|
754
|
+
}
|
|
755
|
+
declare function createAuditEntryRepository(store: CommandStore): AuditEntryRepository;
|
|
756
|
+
|
|
607
757
|
interface Repositories {
|
|
608
758
|
product: ProductRepository;
|
|
609
759
|
variant: VariantRepository;
|
|
@@ -621,6 +771,8 @@ interface Repositories {
|
|
|
621
771
|
processedEvent: ProcessedEventRepository;
|
|
622
772
|
eventLog: EventLogRepository;
|
|
623
773
|
cart: CartRepository;
|
|
774
|
+
settings: SettingsRepository;
|
|
775
|
+
auditEntry: AuditEntryRepository;
|
|
624
776
|
}
|
|
625
777
|
declare function buildRepositories(commandStore: CommandStore, _documentStore: DocumentStoreAdapter): Repositories;
|
|
626
778
|
|
|
@@ -640,6 +792,8 @@ declare class InMemoryDocumentStore implements DocumentStoreAdapter {
|
|
|
640
792
|
query<T>(collection: string, params: QueryParams): Promise<QueryResult<T>>;
|
|
641
793
|
batchGet<T>(collection: string, keys: string[]): Promise<Map<string, T>>;
|
|
642
794
|
batchPut<T>(collection: string, items: Map<string, T>): Promise<void>;
|
|
795
|
+
/** Builds the new contents in a map of their own and swaps it in, so a reader sees one set or the other. */
|
|
796
|
+
replaceCollection<T>(collection: string, entries: AsyncIterable<[string, T]>): Promise<void>;
|
|
643
797
|
close(): Promise<void>;
|
|
644
798
|
}
|
|
645
799
|
|
|
@@ -724,12 +878,51 @@ interface CreatePublisherOptions {
|
|
|
724
878
|
}
|
|
725
879
|
declare function createEventPublisher(opts: CreatePublisherOptions): EventPublisher;
|
|
726
880
|
|
|
881
|
+
/** Runs `fn` with `id` as the correlation id of every event it publishes, across its awaits, and returns its result. */
|
|
882
|
+
declare function runWithCorrelation<T>(id: string, fn: () => T): T;
|
|
883
|
+
declare function currentCorrelationId(): string | undefined;
|
|
884
|
+
/** A fresh id for one run of work that starts outside HTTP (a sweep, an import): `<origin>:<uuidv7>`. */
|
|
885
|
+
declare function newCorrelationId(origin: string): string;
|
|
886
|
+
|
|
887
|
+
type Actor = AuditActor;
|
|
888
|
+
/** Runs `fn` as `actor`, across its awaits, and returns its result. */
|
|
889
|
+
declare function runAsActor<T>(actor: Actor, fn: () => T): T;
|
|
890
|
+
declare function currentActor(): Actor | undefined;
|
|
891
|
+
/** A request's actor from its principal. A guest is anonymous: a cart's token is a credential, never an id. */
|
|
892
|
+
declare function actorOf(auth: RequestAuth | undefined): Actor;
|
|
893
|
+
|
|
894
|
+
declare const audit: {
|
|
895
|
+
/**
|
|
896
|
+
* A service names the command it runs and the records it touches. It writes nothing itself: the open command's
|
|
897
|
+
* entry carries them. Call it before the command can refuse, so a refusal is recorded as the command's.
|
|
898
|
+
*/
|
|
899
|
+
note(command: string, subjects?: readonly AuditSubject[]): void;
|
|
900
|
+
};
|
|
901
|
+
/**
|
|
902
|
+
* Runs `fn` as one command, `command` (or, when undefined, the first command a service notes). Inside an open command
|
|
903
|
+
* it joins that one. A refusal thrown out of `fn` is recorded as the command's `refused` entry.
|
|
904
|
+
*/
|
|
905
|
+
declare function auditedCommand<T>(store: CommandStore, command: string | undefined, fn: () => Promise<T>): Promise<T>;
|
|
906
|
+
|
|
727
907
|
interface IdempotencyOptions {
|
|
728
908
|
repo: ProcessedEventRepository;
|
|
729
909
|
logger?: Logger;
|
|
730
910
|
}
|
|
731
911
|
declare function withIdempotency<T = unknown>(handlerName: string, handler: EventHandler<T>, { repo, logger }: IdempotencyOptions): EventHandler<T>;
|
|
732
912
|
|
|
913
|
+
/** A settings row as the fill uses it: decrypted, or a non-secret's plain value. */
|
|
914
|
+
interface SettingValue {
|
|
915
|
+
slot: string;
|
|
916
|
+
path: string;
|
|
917
|
+
value: string;
|
|
918
|
+
}
|
|
919
|
+
type SettingSource = 'config' | 'env' | 'settings';
|
|
920
|
+
/**
|
|
921
|
+
* The slot's config block with each declared path resolved as block, then its declared env, then this slot's row
|
|
922
|
+
* (the deploy always wins). Nothing undeclared is added and `block` is not changed.
|
|
923
|
+
*/
|
|
924
|
+
declare function fillFromSettings(slot: string, block: Record<string, unknown>, declared: readonly AdapterSetting[], rows: readonly SettingValue[], env: NodeJS.ProcessEnv): Record<string, unknown>;
|
|
925
|
+
|
|
733
926
|
/** One adapter per commerce slot. */
|
|
734
927
|
type CommerceAdapters = CommerceSlotAdapters;
|
|
735
928
|
/** Adapters a project hands `createApp`, each for a slot whose provider is `custom`. */
|
|
@@ -748,6 +941,10 @@ interface BuildAdaptersDeps {
|
|
|
748
941
|
injected?: InjectedAdapters;
|
|
749
942
|
/** The payments adapter `createApp` resolved before it opened the store. */
|
|
750
943
|
payments: PaymentsAdapter;
|
|
944
|
+
/** The security adapter `createApp` resolved before it opened the store. */
|
|
945
|
+
security: SecurityAdapter;
|
|
946
|
+
/** The values Settings hold for the slots' declared fields, decrypted: what fills what the config leaves unset. */
|
|
947
|
+
settings?: readonly SettingValue[];
|
|
751
948
|
}
|
|
752
949
|
declare function buildAdapters(deps: BuildAdaptersDeps): Promise<AdapterRegistry>;
|
|
753
950
|
|
|
@@ -1141,6 +1338,15 @@ interface BuildServicesDeps {
|
|
|
1141
1338
|
}
|
|
1142
1339
|
declare function buildServices(deps: BuildServicesDeps): ServiceRegistry;
|
|
1143
1340
|
|
|
1341
|
+
/** A slot whose provider package declares settings. */
|
|
1342
|
+
interface DeclaredSlot {
|
|
1343
|
+
slot: CommerceSlot;
|
|
1344
|
+
provider: string;
|
|
1345
|
+
declared: readonly AdapterSetting[];
|
|
1346
|
+
}
|
|
1347
|
+
/** A store from before migration 0008 has no `settings` relation: it holds no settings. */
|
|
1348
|
+
declare function isMissingSettingsTable(error: unknown): boolean;
|
|
1349
|
+
|
|
1144
1350
|
interface RegisterAllRoutesDeps {
|
|
1145
1351
|
config: NymbalConfig;
|
|
1146
1352
|
adapter: HttpAdapter;
|
|
@@ -1150,6 +1356,8 @@ interface RegisterAllRoutesDeps {
|
|
|
1150
1356
|
documentStore: DocumentStoreAdapter;
|
|
1151
1357
|
eventBus: EventBusAdapter;
|
|
1152
1358
|
publisher: EventPublisher;
|
|
1359
|
+
/** The slots whose provider packages declare settings, as the store booted with them. */
|
|
1360
|
+
settingsSlots: readonly DeclaredSlot[];
|
|
1153
1361
|
/** The admin's dist directory, or null for a 404 that says how to build it; undefined serves no admin. */
|
|
1154
1362
|
adminRoot?: string | null | undefined;
|
|
1155
1363
|
}
|
|
@@ -1166,6 +1374,16 @@ interface RouteSchema {
|
|
|
1166
1374
|
params?: ZodTypeAny;
|
|
1167
1375
|
query?: ZodTypeAny;
|
|
1168
1376
|
body?: ZodTypeAny;
|
|
1377
|
+
/**
|
|
1378
|
+
* Every route but a GET says what its audit entry names it: the command it runs when it changes the store's records,
|
|
1379
|
+
* or null when it changes none an audit covers (a cart, a session, a ticket).
|
|
1380
|
+
*/
|
|
1381
|
+
command?: string | null;
|
|
1382
|
+
/**
|
|
1383
|
+
* The command moves money through the payments provider. A keyed one does not run inside the key's transaction:
|
|
1384
|
+
* the service commits its own steps around the provider call, so what it holds is committed before money moves.
|
|
1385
|
+
*/
|
|
1386
|
+
provider?: true;
|
|
1169
1387
|
}
|
|
1170
1388
|
declare const routeSchemas: Record<string, RouteSchema>;
|
|
1171
1389
|
|
|
@@ -1240,6 +1458,10 @@ interface CartAbandonmentSweeperDeps {
|
|
|
1240
1458
|
*/
|
|
1241
1459
|
declare function startCartAbandonmentSweeper(deps: CartAbandonmentSweeperDeps): SweeperHandle;
|
|
1242
1460
|
|
|
1461
|
+
/** Where retention writes events before it deletes them: one object per batch, private to the operator. */
|
|
1462
|
+
interface EventArchiveWriter {
|
|
1463
|
+
put(key: string, body: Uint8Array, contentType: string): Promise<void>;
|
|
1464
|
+
}
|
|
1243
1465
|
interface EventRetentionSweeperDeps {
|
|
1244
1466
|
store: CommandStore;
|
|
1245
1467
|
eventLog: EventLogRepository;
|
|
@@ -1247,24 +1469,40 @@ interface EventRetentionSweeperDeps {
|
|
|
1247
1469
|
logger: Logger;
|
|
1248
1470
|
retentionDays?: number;
|
|
1249
1471
|
intervalMs?: number;
|
|
1472
|
+
/** When set, delivered events past retention are archived here first, and deleted only once the put succeeds. */
|
|
1473
|
+
archive?: EventArchiveWriter;
|
|
1250
1474
|
}
|
|
1251
|
-
/**
|
|
1475
|
+
/**
|
|
1476
|
+
* Deletes delivered events and processed-event records older than the window; undelivered and dead events stay. With
|
|
1477
|
+
* an archive, events go to it in `seq`-ordered batches first.
|
|
1478
|
+
*/
|
|
1252
1479
|
declare function startEventRetentionSweeper(deps: EventRetentionSweeperDeps): SweeperHandle;
|
|
1253
1480
|
|
|
1254
1481
|
interface ProviderPackage {
|
|
1255
1482
|
/** The adapter package, which exports `createAdapter(ctx: AdapterContext)`. */
|
|
1256
1483
|
package: string;
|
|
1257
|
-
/** The provider SDK the package peers, which the project installs beside it. */
|
|
1258
|
-
sdk
|
|
1484
|
+
/** The provider SDK the package peers, which the project installs beside it; none when it talks HTTP itself. */
|
|
1485
|
+
sdk?: string;
|
|
1259
1486
|
}
|
|
1487
|
+
type Packages<P extends ProviderPackage> = Readonly<Record<string, P>>;
|
|
1260
1488
|
/**
|
|
1261
1489
|
* The providers that live in their own package, by slot then provider. The kernel imports a package only when the
|
|
1262
1490
|
* config names its provider; `native`, `none`, `custom` and the kernel's own primitives (`in-memory`, `in-process`,
|
|
1263
|
-
* `local-fs`) have no entry.
|
|
1491
|
+
* `local-fs`) have no entry. Every package peers its provider's SDK but the security ones, which call an HTTP API.
|
|
1264
1492
|
*/
|
|
1265
|
-
declare const PROVIDER_PACKAGES: Readonly<Partial<Record<Slot,
|
|
1493
|
+
declare const PROVIDER_PACKAGES: Readonly<Partial<Record<Exclude<Slot, 'security'>, Packages<Required<ProviderPackage>>>>> & {
|
|
1494
|
+
readonly security: Packages<ProviderPackage>;
|
|
1495
|
+
};
|
|
1266
1496
|
/** The command that installs `packages` with the project's package manager, as `packageManager` picks it. */
|
|
1267
1497
|
declare function installLine(packages: readonly string[], env: NodeJS.ProcessEnv, cwd: string): string;
|
|
1498
|
+
type ProviderModule = ProviderPackageModule;
|
|
1499
|
+
/**
|
|
1500
|
+
* The module of a provider that lives in its own package, imported from the kernel as `loadProviderAdapter` imports
|
|
1501
|
+
* it, or `undefined` when the provider is built in. A missing package or SDK is a `ConfigError`
|
|
1502
|
+
* (`adapter.package_missing`) carrying the install line, a module with no `createAdapter` is `adapter.package_invalid`,
|
|
1503
|
+
* and any other load error is rethrown as it is.
|
|
1504
|
+
*/
|
|
1505
|
+
declare function importProviderPackage(slot: Slot, provider: string, env: NodeJS.ProcessEnv): Promise<ProviderModule | undefined>;
|
|
1268
1506
|
|
|
1269
1507
|
/**
|
|
1270
1508
|
* v0.1 security adapter.
|
|
@@ -1294,7 +1532,6 @@ declare class RateLimiter {
|
|
|
1294
1532
|
reset(): void;
|
|
1295
1533
|
}
|
|
1296
1534
|
|
|
1297
|
-
declare function buildSecurityHeaders(security: SecurityConfigLike): Record<string, string>;
|
|
1298
1535
|
declare const CSRF_COOKIE = "nymbal.csrf";
|
|
1299
1536
|
declare const CSRF_HEADER = "x-csrf-token";
|
|
1300
1537
|
|
|
@@ -1347,6 +1584,8 @@ interface CreateLoggerOptions {
|
|
|
1347
1584
|
level?: string;
|
|
1348
1585
|
pretty?: boolean;
|
|
1349
1586
|
base?: Record<string, unknown>;
|
|
1587
|
+
/** Where the JSON lines go instead of stdout; a destination is never pretty-printed. */
|
|
1588
|
+
destination?: DestinationStream;
|
|
1350
1589
|
}
|
|
1351
1590
|
declare function createLogger(options?: CreateLoggerOptions): Logger;
|
|
1352
1591
|
|
|
@@ -1375,9 +1614,9 @@ interface DiagnoseOptions {
|
|
|
1375
1614
|
}
|
|
1376
1615
|
/**
|
|
1377
1616
|
* Checks a project without changing it: its config, the packages its providers live in, the command store and its
|
|
1378
|
-
* migrations, and the health of every commerce slot and primitive. It builds what `createApp`
|
|
1379
|
-
* registry and constructors, and nothing more: no warm-up, no relay, no sweeper, no migrator,
|
|
1380
|
-
* primitive's `initialize()
|
|
1617
|
+
* migrations, and the health of every commerce slot, the security slot and every primitive. It builds what `createApp`
|
|
1618
|
+
* builds, through the same registry and constructors, and nothing more: no warm-up, no relay, no sweeper, no migrator,
|
|
1619
|
+
* no seed, and no primitive's `initialize()` (the security adapter's makes no request). The command store is opened read-only. Every connection is closed before it returns.
|
|
1381
1620
|
*/
|
|
1382
1621
|
declare function diagnose(input: NymbalConfig, options?: DiagnoseOptions): Promise<DiagnosisReport>;
|
|
1383
1622
|
|
|
@@ -1388,6 +1627,13 @@ interface SeedDeps {
|
|
|
1388
1627
|
eventBus: EventBusAdapter;
|
|
1389
1628
|
logger: Logger;
|
|
1390
1629
|
version: string;
|
|
1630
|
+
/**
|
|
1631
|
+
* When given, each product's image is generated and written here, and the product points at the stored copy
|
|
1632
|
+
* instead of the third-party placeholder host: a store measured or run offline then serves its own images.
|
|
1633
|
+
*/
|
|
1634
|
+
media?: MediaStorage;
|
|
1635
|
+
/** The search index to rebuild with the document store; without it the next start's rebuild fills it. */
|
|
1636
|
+
search?: SearchAdapter;
|
|
1391
1637
|
}
|
|
1392
1638
|
interface SeedResult {
|
|
1393
1639
|
categories: number;
|
|
@@ -1400,19 +1646,174 @@ interface SeedResult {
|
|
|
1400
1646
|
}
|
|
1401
1647
|
declare function runSeed(deps: SeedDeps): Promise<SeedResult>;
|
|
1402
1648
|
|
|
1403
|
-
|
|
1649
|
+
/** The binary columns of an encrypted settings row. */
|
|
1650
|
+
interface EncryptedValue {
|
|
1651
|
+
ciphertext: Buffer;
|
|
1652
|
+
iv: Buffer;
|
|
1653
|
+
tag: Buffer;
|
|
1654
|
+
}
|
|
1655
|
+
/** The same columns as a driver hands them back (a Buffer, or a Uint8Array). */
|
|
1656
|
+
interface StoredCipher {
|
|
1657
|
+
ciphertext: Uint8Array | null;
|
|
1658
|
+
iv: Uint8Array | null;
|
|
1659
|
+
tag: Uint8Array | null;
|
|
1660
|
+
}
|
|
1661
|
+
/** The environment variable holding the master key, and the one `nymbal secrets rotate` reads the old key from. */
|
|
1662
|
+
declare const SECRETS_KEY_ENV = "NYMBAL_SECRETS_KEY";
|
|
1663
|
+
declare const SECRETS_KEY_OLD_ENV = "NYMBAL_SECRETS_KEY_OLD";
|
|
1664
|
+
/** AES-256-GCM under a fresh IV, bound to `aad` (`<slot>:<path>`), so a row moved to another field fails to decrypt. */
|
|
1665
|
+
declare function encrypt(key: Buffer, aad: string, plaintext: string): EncryptedValue;
|
|
1666
|
+
/** The plaintext, or a throw when the key, the AAD or any byte of the row is not what encrypted it. */
|
|
1667
|
+
declare function decrypt(key: Buffer, aad: string, row: StoredCipher): string;
|
|
1668
|
+
/** The first 8 hex characters of the key's SHA-256: which key a row was written under, without the key. */
|
|
1669
|
+
declare function keyId(key: Buffer): string;
|
|
1670
|
+
type SecretsKey = {
|
|
1671
|
+
ok: true;
|
|
1672
|
+
key: Buffer;
|
|
1673
|
+
id: string;
|
|
1674
|
+
} | {
|
|
1675
|
+
ok: false;
|
|
1676
|
+
reason: 'missing' | 'malformed';
|
|
1677
|
+
};
|
|
1678
|
+
/** The master key in `env[name]`: 32 bytes as base64, else why it cannot be used. */
|
|
1679
|
+
declare function readSecretsKey(env: NodeJS.ProcessEnv, name?: string): SecretsKey;
|
|
1680
|
+
/** What to tell an operator about a key `readSecretsKey` refused, naming the variable and never its value. */
|
|
1681
|
+
declare function keyProblem(reason: 'missing' | 'malformed', name?: string): string;
|
|
1682
|
+
/** The AAD of a settings row. */
|
|
1683
|
+
declare function settingAad(slot: string, path: string): string;
|
|
1684
|
+
|
|
1685
|
+
/** `text` with every secret in the set replaced by `***`. */
|
|
1686
|
+
declare function scrub(text: string): string;
|
|
1687
|
+
|
|
1688
|
+
/**
|
|
1689
|
+
* One subscription of a projection: the bus delivers live events to it, and a read-model rebuild calls it directly in
|
|
1690
|
+
* its catch-up, so a failure there is seen rather than logged by the bus.
|
|
1691
|
+
*/
|
|
1692
|
+
interface DerivedHandler {
|
|
1693
|
+
name: string;
|
|
1694
|
+
types: readonly string[];
|
|
1695
|
+
handle: EventHandler;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
/** A document of a collection, under its key. */
|
|
1699
|
+
interface DocumentWrite {
|
|
1700
|
+
collection: string;
|
|
1701
|
+
key: string;
|
|
1702
|
+
doc: unknown;
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
type ReadModelName = 'catalogue' | 'orders' | 'customers' | 'search';
|
|
1706
|
+
interface RebuildDeps {
|
|
1404
1707
|
config: NymbalConfig;
|
|
1708
|
+
store: CommandStore;
|
|
1405
1709
|
repos: Repositories;
|
|
1406
|
-
|
|
1710
|
+
/** Where the document models are rebuilt and caught up. */
|
|
1711
|
+
documentStore: DocumentStoreAdapter;
|
|
1712
|
+
/** Where the search model is rebuilt and caught up; the search model cannot be rebuilt without it. */
|
|
1713
|
+
search?: SearchAdapter;
|
|
1407
1714
|
logger: Logger;
|
|
1408
|
-
|
|
1715
|
+
/** Rows per page read from the command store. */
|
|
1716
|
+
pageSize?: number;
|
|
1717
|
+
/** Called before each page is read. */
|
|
1718
|
+
onPage?: (page: {
|
|
1719
|
+
model: ReadModelName;
|
|
1720
|
+
table: string;
|
|
1721
|
+
page: number;
|
|
1722
|
+
}) => void | Promise<void>;
|
|
1723
|
+
}
|
|
1724
|
+
/** What a rebuilder reads with: the command store in pages, each page a read of its own. */
|
|
1725
|
+
interface RebuildContext {
|
|
1726
|
+
deps: RebuildDeps;
|
|
1727
|
+
pages<T extends {
|
|
1728
|
+
id: string;
|
|
1729
|
+
}>(table: string, read: (tx: ReadTx, page: KeysetPage) => Promise<T[]>): AsyncIterable<T[]>;
|
|
1730
|
+
}
|
|
1731
|
+
interface ReadModel {
|
|
1732
|
+
name: ReadModelName;
|
|
1733
|
+
/** Where its documents go: document-store collections, or the search adapter. */
|
|
1734
|
+
target: 'documents' | 'search';
|
|
1735
|
+
/** The document-store collections it owns; the search model owns none. */
|
|
1736
|
+
collections: readonly string[];
|
|
1737
|
+
/** Every document of the model, from the authoritative tables. A search model writes to `SEARCH_INDEX`. */
|
|
1738
|
+
rebuild(ctx: RebuildContext): AsyncIterable<DocumentWrite>;
|
|
1739
|
+
/** The live projections that keep the model, bound to `deps`' document store and search adapter. */
|
|
1740
|
+
handlers(deps: RebuildDeps): DerivedHandler[];
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
/** Every derived read model, in the order a rebuild of all of them runs. */
|
|
1744
|
+
declare const READ_MODELS: readonly ReadModel[];
|
|
1745
|
+
declare const READ_MODEL_NAMES: readonly ReadModelName[];
|
|
1746
|
+
/**
|
|
1747
|
+
* How long before the rebuild started a delivery may be stamped and still be caught up. The relay stamps
|
|
1748
|
+
* `delivered_at` on its own host's clock, which can run behind this process's; re-applying an event costs little,
|
|
1749
|
+
* skipping one loses a write.
|
|
1750
|
+
*/
|
|
1751
|
+
declare const CATCH_UP_MARGIN_MS: number;
|
|
1752
|
+
interface CatchUpFailure {
|
|
1753
|
+
seq: number;
|
|
1754
|
+
eventId: string;
|
|
1755
|
+
type: string;
|
|
1756
|
+
handler: string;
|
|
1757
|
+
error: string;
|
|
1758
|
+
}
|
|
1759
|
+
interface RebuildReportEntry {
|
|
1760
|
+
model: ReadModelName;
|
|
1761
|
+
/** Each collection swapped in and the documents it was given (the search model's is `index`). */
|
|
1762
|
+
collections: Array<{
|
|
1763
|
+
name: string;
|
|
1764
|
+
documents: number;
|
|
1765
|
+
}>;
|
|
1766
|
+
/** Logged events re-applied after the swap. */
|
|
1767
|
+
caughtUpEvents: number;
|
|
1768
|
+
/** Catch-up events a handler failed on: the model is swapped all the same. */
|
|
1769
|
+
failures: CatchUpFailure[];
|
|
1770
|
+
ms: number;
|
|
1771
|
+
/** Set when the search adapter has no `replaceAll`: it was given every document, and kept any others it held. */
|
|
1772
|
+
note?: string;
|
|
1409
1773
|
}
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1774
|
+
type RebuildReport = RebuildReportEntry[];
|
|
1775
|
+
/** A rebuilder failed: nothing was swapped, so every read model keeps its old contents. */
|
|
1776
|
+
declare class RebuildError extends Error {
|
|
1777
|
+
readonly model: ReadModelName;
|
|
1778
|
+
constructor(model: ReadModelName, cause: unknown);
|
|
1779
|
+
}
|
|
1780
|
+
/**
|
|
1781
|
+
* Rebuilds `names` from the command store's tables: every model is read first, then each is swapped in (atomically
|
|
1782
|
+
* per collection) and caught up with the events delivered since its read began. A rebuilder that throws rejects with
|
|
1783
|
+
* a `RebuildError` before anything is swapped. Catch-up failures are in the report.
|
|
1784
|
+
*/
|
|
1785
|
+
declare function rebuild(names: readonly ReadModelName[], deps: RebuildDeps): Promise<RebuildReport>;
|
|
1786
|
+
interface CollectionDiff {
|
|
1787
|
+
name: string;
|
|
1788
|
+
added: number;
|
|
1789
|
+
changed: number;
|
|
1790
|
+
removed: number;
|
|
1791
|
+
}
|
|
1792
|
+
interface ReadModelDiff {
|
|
1793
|
+
model: ReadModelName;
|
|
1794
|
+
collections: CollectionDiff[];
|
|
1795
|
+
/** Why the model was not compared, when it was not. */
|
|
1796
|
+
skipped?: string;
|
|
1414
1797
|
}
|
|
1415
|
-
|
|
1798
|
+
/** Rebuilds `name` into memory and counts, per collection, what differs from the live read model; writes nothing. */
|
|
1799
|
+
declare function diffReadModel(name: ReadModelName, deps: RebuildDeps): Promise<ReadModelDiff>;
|
|
1800
|
+
|
|
1801
|
+
interface OpenReadModelsOptions {
|
|
1802
|
+
logger: Logger;
|
|
1803
|
+
/** The project's own adapters, for a `custom` search slot. */
|
|
1804
|
+
adapters?: InjectedAdapters;
|
|
1805
|
+
sqlitePath?: string;
|
|
1806
|
+
postgresUrl?: string;
|
|
1807
|
+
env?: NodeJS.ProcessEnv;
|
|
1808
|
+
}
|
|
1809
|
+
/**
|
|
1810
|
+
* What a rebuild outside the server needs, built as `createApp` builds it: the command store (writable), the document
|
|
1811
|
+
* store and the search adapter. No bus, relay, sweeper or other slot. `close()` closes what it opened.
|
|
1812
|
+
*/
|
|
1813
|
+
declare function openReadModels(config: NymbalConfig, options: OpenReadModelsOptions): Promise<{
|
|
1814
|
+
deps: RebuildDeps;
|
|
1815
|
+
close(): Promise<void>;
|
|
1816
|
+
}>;
|
|
1416
1817
|
|
|
1417
1818
|
interface SeedCategory {
|
|
1418
1819
|
slug: string;
|
|
@@ -1438,4 +1839,5 @@ interface LocalFsMediaStorageOptions {
|
|
|
1438
1839
|
declare const LOCAL_FS_MEDIA_CAPABILITIES: readonly string[];
|
|
1439
1840
|
declare function createLocalFsMediaStorage(options: LocalFsMediaStorageOptions): MediaStorage;
|
|
1440
1841
|
|
|
1441
|
-
export {
|
|
1842
|
+
export { CATCH_UP_MARGIN_MS, CSRF_COOKIE, CSRF_HEADER, InMemoryDocumentStore, InProcessEventBus, LOCAL_FS_MEDIA_CAPABILITIES, PROVIDER_PACKAGES, PROVIDER_REFUND_REASON, READ_MODELS, READ_MODEL_NAMES, REDIS_DEFAULTS, RateLimiter, RebuildError, SECRETS_KEY_ENV, SECRETS_KEY_OLD_ENV, actorOf, appendAuditEntry, audit, auditEntriesInOrder, auditedCommand, buildAdapters, buildRepositories, buildServices, createApp, createAuditEntryRepository, createAuthService, createCartRepository, createCartService, createCategoryRepository, createCategoryService, createCheckoutService, createCommandStore, createCustomerRepository, createCustomerService, createEventBuilder, createEventLogRepository, createEventPublisher, createInventoryReservationRepository, createInventoryService, createCategoryRepository$1 as createLegacyCategoryRepository, createProductRepository$1 as createLegacyProductRepository, createLocalFsMediaStorage, createLogger, createMiddlewareSecurityAdapter, createNativeAiAdapter, createNativeAnalyticsAdapter, createNativeEmailAdapter, createNativeReviewsAdapter, createNativeSearchAdapter, createNativeShippingAdapter, createNativeStubPaymentsAdapter, createNativeTaxAdapter, createOrderHistoryRepository, createOrderRefundRepository, createOrderRepository, createOrderSequenceRepository, createOrderService, createPlatform, createProcessedEventRepository, createProductCategoryRepository, createProductRepository, createProductService, createRefreshTokenRepository, createRefundService, createRelay, createReviewRepository, createSearchService, createSettingsRepository, createStockAdjustmentRepository, createVariantRepository, currentActor, currentCorrelationId, decrypt, diagnose, diffReadModel, encodeSearchCursor, encrypt, fillFromSettings, findAppliedByKey, importProviderPackage, installLine, isMissingSettingsTable, keyId, keyProblem, listAuditEntries, newCorrelationId, openReadModels, orderPayment, rawClients, readSecretsKey, rebuild, refreshRefunded, registerAdminStaticRoute, registerAllRoutes, registerHandlers, resolvePrimitives, routeSchemas, runAsActor, runMigrations, runSeed, runWithCorrelation, scrub, seedCategories, seedProducts, settingAad, settlementOf, sqliteFile, startCartAbandonmentSweeper, startEventRetentionSweeper, startInventoryReservationSweeper, withIdempotency };
|
|
1843
|
+
export type { AbandonedCart, AbandonedWindow, Actor, AdapterRegistry, AppliedEntry, AttachHttpOptions, AuditCursor, AuditEntryInsert, AuditEntryRepository, AuditFilter, AuditQuery, AuthService, AuthTokens, BeginCheckoutInput, BeginCheckoutResult, BuildAdaptersDeps, BuildServicesDeps, CapabilitiesReport, CapabilitySlot, CapturedPayment, CartRepository, CartService, CatchUpFailure, CategoryCreateInput, CategoryInsert, CategoryRepository, CategoryService, CategoryUpdate, CategoryUpdateInput, CheckoutService, CollectionDiff, CommandStore, CommandStoreOptions, CommerceAdapters, CreateAppOptions, CreateAuthServiceDeps, CreateCartServiceDeps, CreateCheckoutServiceDeps, CreateInventoryServiceDeps, CreateLoggerOptions, CreateOrderServiceDeps, CreatePlatformOptions, CreateProductServiceDeps, CreatePublisherOptions, CreateRefundServiceDeps, CreateRelayOptions, CustomerInsert, CustomerJwtPayload, CustomerRepository, CustomerService, CustomerUpdate, CustomerWithHash, DiagnoseOptions, DiagnosisCheck, DiagnosisReport, DiagnosisStatus, EncryptedValue, EventArchiveWriter, EventBuilderContext, EventLogFilter, EventLogRepository, EventPublisher, EventRetentionSweeperDeps, FinalizeResult, IdempotencyOptions, ImportCustomerInput, InMemoryDocumentStoreOptions, InProcessEventBusOptions, InjectedAdapters, InventoryReservationRepository, InventoryService, KeysetPage, CategoryInsert$1 as LegacyCategoryInsert, CategoryRow as LegacyCategoryRow, ProductInsert$1 as LegacyProductInsert, ProductRow as LegacyProductRow, LocalFsMediaStorageOptions, LoggedEvent, MakeEventOptions, ManualPayments, MigrateOptions, NativeEmailAdapterConfig, NymbalApp, OpenReadModelsOptions, OrderCapture, OrderCreateDraftInput, OrderHistoryInsert, OrderHistoryRepository, OrderImportInput, OrderInsert, OrderRefundInsert, OrderRefundRepository, OrderRepository, OrderSequenceRepository, OrderService, Platform, PlatformConnectionOptions, PostgresClient, Primitives, ProcessedEventRepository, ProductCategoryRepository, ProductCreateInput, ProductInsert, ProductRepository, ProductService, ProductUpdate, ProductUpdateInput, ProfileUpdate, ProviderPackage, PublishOptions, RawClients, ReadModel, ReadModelDiff, ReadModelName, ReadTx, RebuildDeps, RebuildReport, RebuildReportEntry, RefreshTokenInsert, RefreshTokenRepository, RefreshTokenRow, RefundInput, RefundResult, RefundService, RegisterAllRoutesDeps, RegisterHandlersDeps, RegisterInput, Relay, Repositories, ReservationInsert, ReserveStockResult, ResolvePrimitivesOptions, ReviewInsert, ReviewKey, ReviewRepository, RouteSchema, SearchService, SecretsKey, SeedCategory, SeedDeps, SeedProduct, SeedResult, ServiceRegistry, SettingRow, SettingSource, SettingValue, SettingsRepository, Settlement, SlotCapabilities, SqliteClient, StockAdjustmentInsert, StockAdjustmentRepository, StoreRepository, StoredCipher, SweeperHandle, Tx, VariantInsert, VariantRepository, VariantUpdate };
|