@fire-spark/local 0.29.0 → 0.31.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +118 -6
  2. package/dist/index.js +1179 -237
  3. package/package.json +4 -4
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { KeyObject } from "node:crypto";
4
4
  import { Order, OrderLine, OrderRedeem, OrderRedemptionStep, OrderTotals } from "@fire-spark/types";
5
5
  //#region src/constants.d.ts
6
6
  /** Forward-only SQLite schema version (`meta.schema_version`). */
7
- declare const LOCAL_SCHEMA_VERSION = 1;
7
+ declare const LOCAL_SCHEMA_VERSION = 2;
8
8
  /** Envelope `schema_version` of every upstream event this runtime writes. */
9
9
  declare const LOCAL_EVENT_SCHEMA_VERSION = 1;
10
10
  /** Upstream batch cap (§4.5): whichever of the two is hit first. */
@@ -43,6 +43,11 @@ declare const LOCAL_CREDENTIALS_SECTION = "credentials";
43
43
  declare const LOCAL_ORIGIN_HEADER = "x-firespark-origin";
44
44
  /** Payment methods that work with no internet (cash today). */
45
45
  declare const LOCAL_OFFLINE_PAYMENT_METHODS: readonly ["CASH"];
46
+ /**
47
+ * Charged by the device's own terminal (§5): allowed while the node still
48
+ * reaches the internet, so the pinpad can reach its acquirer.
49
+ */
50
+ declare const LOCAL_DEVICE_PAYMENT_METHODS: readonly ["PIN_PAD"];
46
51
  declare const LOCAL_UPSTREAM_EVENT_TYPES: readonly ["order.created", "order.updated", "order.placed", "payment.tender_recorded", "payment.tender_voided", "payment.tender_refunded", "fulfillment.status_changed", "injection.completed", "pos.cash_event", "pos.session_opened", "pos.session_closed", "analytics.relay", "device.health", "device.log", "node.state_applied"];
47
52
  declare const LOCAL_MODES: readonly ["BOOTING", "ONLINE", "DEGRADED", "LOCAL", "RECOVERING", "DRAINING", "BLOCKED"];
48
53
  /**
@@ -52,6 +57,17 @@ declare const LOCAL_MODES: readonly ["BOOTING", "ONLINE", "DEGRADED", "LOCAL", "
52
57
  * forgotten cart never stops the store.
53
58
  */
54
59
  declare const DRAIN_HOLD_MS = 60000;
60
+ /**
61
+ * Once DRAINING reaches `drain_max_min`, carts idle this long count as
62
+ * expired too, so only carts someone is still working on keep the node.
63
+ */
64
+ declare const DRAIN_CAPPED_CART_IDLE_MS: number;
65
+ /**
66
+ * Failed cloud answers (retry or rejection) after which an event is
67
+ * quarantined: still retried at the longest backoff, never dropped, but no
68
+ * longer holding the hand-back (§4.3).
69
+ */
70
+ declare const LOCAL_QUARANTINE_AFTER_ATTEMPTS = 12;
55
71
  /** Modes in which this node serves the storefront itself (§4.6). */
56
72
  declare const LOCAL_SERVING_MODES: readonly ["LOCAL", "RECOVERING", "DRAINING"];
57
73
  //#endregion
@@ -82,6 +98,13 @@ interface LocalFailoverSettings {
82
98
  local_after_failures: number;
83
99
  recover_after_successes: number;
84
100
  p95_threshold_ms: number;
101
+ /** An open local cart idle this long is expired (never placed here). */
102
+ local_cart_ttl_min: number;
103
+ /**
104
+ * Longest DRAINING before the node stops taking new carts and expires
105
+ * idle ones, so the hand-back to the cloud cannot stall forever.
106
+ */
107
+ drain_max_min: number;
85
108
  }
86
109
  interface LocalNodeSettings {
87
110
  failover: LocalFailoverSettings;
@@ -132,7 +155,7 @@ declare const inTransaction: <T>(db: LocalDatabase, fn: () => T) => T;
132
155
  //#endregion
133
156
  //#region src/db/meta.d.ts
134
157
  /** Keys kept in `meta` (§4.2). */
135
- type LocalMetaKey = "node_uid" | "identity" | "scope_key" | "state_seq" | "state_root" | "state_algo" | "state_sections" | "state_verified_at" | "schema_version" | "mode" | "connectivity" | "upstream_cursor" | "downstream_cursor" | "credentials_hash" | "settings";
158
+ type LocalMetaKey = "node_uid" | "identity" | "scope_key" | "state_seq" | "state_root" | "state_algo" | "state_sections" | "state_verified_at" | "schema_version" | "mode" | "connectivity" | "upstream_cursor" | "downstream_cursor" | "credentials_hash" | "settings" | "draining_since";
136
159
  declare const getMeta: (db: LocalDatabase, key: LocalMetaKey) => string | null;
137
160
  declare const setMeta: (db: LocalDatabase, key: LocalMetaKey, value: string) => void;
138
161
  /** The state version the node runs on, or null before the first load. */
@@ -184,6 +207,8 @@ interface LocalEventRow {
184
207
  next_attempt_at: string | null;
185
208
  last_error: string | null;
186
209
  cloud_result: string | null;
210
+ /** Set once the event keeps failing; it no longer holds DRAINING. */
211
+ quarantined_at: string | null;
187
212
  }
188
213
  //#endregion
189
214
  //#region src/events/eventLog.d.ts
@@ -200,9 +225,16 @@ declare const appendEvent: (db: LocalDatabase, input: AppendEventInput, context:
200
225
  event: LocalEventRow;
201
226
  created: boolean;
202
227
  };
228
+ /**
229
+ * Unsynced events. `blocking` leaves out quarantined events and the later
230
+ * events of their aggregates (held behind them by per-aggregate order):
231
+ * those keep retrying but no longer hold DRAINING → ONLINE.
232
+ */
203
233
  declare const countUnsyncedEvents: (db: LocalDatabase) => {
204
234
  pending: number;
205
235
  oldestPendingAt: string | null;
236
+ blocking: number;
237
+ quarantined: number;
206
238
  };
207
239
  declare const listEvents: (db: LocalDatabase) => LocalEventRow[];
208
240
  //#endregion
@@ -583,6 +615,8 @@ type ModeInput = {
583
615
  snapshotVerified: boolean;
584
616
  integrityOk: boolean;
585
617
  cloudReachable: boolean;
618
+ /** Mode written before the restart, if any. */
619
+ previousMode?: LocalMode | null;
586
620
  } | {
587
621
  type: "probe";
588
622
  ok: boolean;
@@ -689,6 +723,7 @@ type UpstreamOutcome = {
689
723
  status: "rejected";
690
724
  code: string | null;
691
725
  retried: number;
726
+ rest: number;
692
727
  } | {
693
728
  status: "unreachable";
694
729
  error: string;
@@ -696,17 +731,30 @@ type UpstreamOutcome = {
696
731
  status: "unauthorized";
697
732
  code: string | null;
698
733
  };
734
+ interface QuarantinedEvent {
735
+ event_id: string;
736
+ seq: number;
737
+ type: string;
738
+ aggregate: {
739
+ type: string;
740
+ id: string;
741
+ };
742
+ attempts: number;
743
+ code: string;
744
+ }
699
745
  interface UpstreamOptions {
700
746
  now?: () => Date;
701
747
  limits?: BatchLimits;
702
748
  random?: () => number;
749
+ /** Called once per event when it is quarantined (alert / log). */
750
+ onQuarantine?: (event: QuarantinedEvent) => void;
703
751
  }
704
752
  /**
705
753
  * Applies the cloud's per-event results in one transaction: accepted,
706
754
  * duplicate and needs_review become synced; retry (or a missing result)
707
755
  * backs off that event only.
708
756
  */
709
- declare const applyBatchResults: (db: LocalDatabase, batch: UpstreamBatch, response: BatchResponse, now: Date, random?: () => number) => {
757
+ declare const applyBatchResults: (db: LocalDatabase, batch: UpstreamBatch, response: BatchResponse, now: Date, random?: () => number, options?: UpstreamOptions) => {
710
758
  synced: number;
711
759
  retried: number;
712
760
  };
@@ -833,7 +881,14 @@ declare const priceOrder: <T extends PricedOrder>(order: T, state: OrderState) =
833
881
  * and its schedule, prices, fees and checkout rules at this state version.
834
882
  * Exact Big.js comparisons; nothing is rounded.
835
883
  */
836
- declare const checkOrder: (order: PricedOrder, state: OrderState, at: Date) => OrderCheck;
884
+ /**
885
+ * `checkout: false` skips customer/shipping/billing fields, like the
886
+ * cloud's `orders/validate` for a body without the customer (the SDK's
887
+ * `validateOrder`); place always checks them on the stored cart.
888
+ */
889
+ declare const checkOrder: (order: PricedOrder, state: OrderState, at: Date, options?: {
890
+ checkout?: boolean;
891
+ }) => OrderCheck;
837
892
  //#endregion
838
893
  //#region src/ops/disk.d.ts
839
894
  type DiskLevel = "ok" | "warning" | "critical";
@@ -898,8 +953,10 @@ interface CreateOrderBody {
898
953
  scheduled_at?: string | null;
899
954
  }
900
955
  type UpdateOrderBody = Partial<Omit<CreateOrderBody, "id">>;
901
- /** `POST orders/:id/place` body: cash only on a local node. */
956
+ /** `POST orders/:id/place` body on a local node. */
902
957
  interface PlaceOrderBody {
958
+ /** DRAFT intent from `PUT orders/:id/payment-intent`. */
959
+ intent_id?: string;
903
960
  payment_id?: string;
904
961
  /** Decimal string; defaults to the exact total (no change). */
905
962
  tendered?: string;
@@ -928,6 +985,10 @@ interface OrderServiceOptions {
928
985
  onWrite?: () => void;
929
986
  /** False while DRAINING holds new carts back for the cloud. */
930
987
  admitsNewOrders?: () => boolean;
988
+ /** Idle time after which an open local cart is expired (ms). */
989
+ cartIdleLimitMs?: () => number;
990
+ /** The node reaches the internet (a pinpad can reach its acquirer). */
991
+ internetReachable?: () => boolean;
931
992
  }
932
993
  /**
933
994
  * Builds the local order service: create, update, place (cash) and
@@ -941,6 +1002,9 @@ declare const createOrderService: (options: OrderServiceOptions) => {
941
1002
  validate: (orderId: string) => OrderCheck;
942
1003
  place: (orderId: string, body?: PlaceOrderBody, deviceId?: string | null) => PlaceOrderResult;
943
1004
  changeFulfillment: (orderId: string, to: string, actor?: Record<string, unknown>) => import("@fire-spark/types").Order;
1005
+ putIntent: (orderId: string, body: Record<string, unknown>) => import("@fire-spark/types").Order;
1006
+ deleteIntent: (orderId: string) => import("@fire-spark/types").Order;
1007
+ recordPayment: (orderId: string, raw: Record<string, unknown>) => import("@fire-spark/types").Order;
944
1008
  };
945
1009
  type OrderService = ReturnType<typeof createOrderService>;
946
1010
  //#endregion
@@ -961,6 +1025,8 @@ interface StorefrontHandlerOptions {
961
1025
  mode: () => LocalMode;
962
1026
  settings: () => LocalNodeSettings;
963
1027
  now?: () => Date;
1028
+ /** The node reaches the internet (device pinpads are offered). */
1029
+ internetReachable?: () => boolean;
964
1030
  }
965
1031
  /**
966
1032
  * The storefront API served by the node itself (§4.6): `(Request) =>
@@ -1069,6 +1135,8 @@ interface LocalRuntimeOptions {
1069
1135
  image?: Record<string, string>;
1070
1136
  /** LAN address the cloud points `<node_uid>.<domain>` at (§4.7). */
1071
1137
  lanIp?: string | null;
1138
+ /** Structured log line (one JSON object per call in the container). */
1139
+ log?: (event: string, fields?: Record<string, unknown>) => void;
1072
1140
  }
1073
1141
  /**
1074
1142
  * One local node: opens and migrates SQLite, verifies the cached state,
@@ -1115,6 +1183,9 @@ declare const createLocalRuntime: (options: LocalRuntimeOptions) => {
1115
1183
  validate: (orderId: string) => OrderCheck;
1116
1184
  place: (orderId: string, body?: PlaceOrderBody, deviceId?: string | null) => PlaceOrderResult;
1117
1185
  changeFulfillment: (orderId: string, to: string, actor?: Record<string, unknown>) => import("@fire-spark/types").Order;
1186
+ putIntent: (orderId: string, body: Record<string, unknown>) => import("@fire-spark/types").Order;
1187
+ deleteIntent: (orderId: string) => import("@fire-spark/types").Order;
1188
+ recordPayment: (orderId: string, raw: Record<string, unknown>) => import("@fire-spark/types").Order;
1118
1189
  };
1119
1190
  handle: (request: Request) => Promise<Response>;
1120
1191
  boot: () => {
@@ -1241,6 +1312,14 @@ declare const createLocalRuntime: (options: LocalRuntimeOptions) => {
1241
1312
  start: () => void;
1242
1313
  stop: () => void;
1243
1314
  close: () => void;
1315
+ drain: {
1316
+ onTransition: (transition: ModeTransition) => void;
1317
+ drainingFor: () => number | null;
1318
+ capped: () => boolean;
1319
+ admitsNewOrders: () => boolean;
1320
+ cartIdleLimitMs: () => number;
1321
+ paymentIdleLimitMs: () => number;
1322
+ };
1244
1323
  settings: () => LocalNodeSettings;
1245
1324
  };
1246
1325
  type LocalRuntime = ReturnType<typeof createLocalRuntime>;
@@ -1530,6 +1609,9 @@ declare const createLocalNode: (options: LocalNodeOptions) => {
1530
1609
  validate: (orderId: string) => OrderCheck;
1531
1610
  place: (orderId: string, body?: PlaceOrderBody, deviceId?: string | null) => PlaceOrderResult;
1532
1611
  changeFulfillment: (orderId: string, to: string, actor?: Record<string, unknown>) => import("@fire-spark/types").Order;
1612
+ putIntent: (orderId: string, body: Record<string, unknown>) => import("@fire-spark/types").Order;
1613
+ deleteIntent: (orderId: string) => import("@fire-spark/types").Order;
1614
+ recordPayment: (orderId: string, raw: Record<string, unknown>) => import("@fire-spark/types").Order;
1533
1615
  };
1534
1616
  handle: (request: Request) => Promise<Response>;
1535
1617
  boot: () => {
@@ -1656,6 +1738,14 @@ declare const createLocalNode: (options: LocalNodeOptions) => {
1656
1738
  start: () => void;
1657
1739
  stop: () => void;
1658
1740
  close: () => void;
1741
+ drain: {
1742
+ onTransition: (transition: ModeTransition) => void;
1743
+ drainingFor: () => number | null;
1744
+ capped: () => boolean;
1745
+ admitsNewOrders: () => boolean;
1746
+ cartIdleLimitMs: () => number;
1747
+ paymentIdleLimitMs: () => number;
1748
+ };
1659
1749
  settings: () => LocalNodeSettings;
1660
1750
  } | null;
1661
1751
  };
@@ -1774,6 +1864,9 @@ declare const publishedLocalNode: () => {
1774
1864
  validate: (orderId: string) => OrderCheck;
1775
1865
  place: (orderId: string, body?: PlaceOrderBody, deviceId?: string | null) => PlaceOrderResult;
1776
1866
  changeFulfillment: (orderId: string, to: string, actor?: Record<string, unknown>) => import("@fire-spark/types").Order;
1867
+ putIntent: (orderId: string, body: Record<string, unknown>) => import("@fire-spark/types").Order;
1868
+ deleteIntent: (orderId: string) => import("@fire-spark/types").Order;
1869
+ recordPayment: (orderId: string, raw: Record<string, unknown>) => import("@fire-spark/types").Order;
1777
1870
  };
1778
1871
  handle: (request: Request) => Promise<Response>;
1779
1872
  boot: () => {
@@ -1900,6 +1993,14 @@ declare const publishedLocalNode: () => {
1900
1993
  start: () => void;
1901
1994
  stop: () => void;
1902
1995
  close: () => void;
1996
+ drain: {
1997
+ onTransition: (transition: ModeTransition) => void;
1998
+ drainingFor: () => number | null;
1999
+ capped: () => boolean;
2000
+ admitsNewOrders: () => boolean;
2001
+ cartIdleLimitMs: () => number;
2002
+ paymentIdleLimitMs: () => number;
2003
+ };
1903
2004
  settings: () => LocalNodeSettings;
1904
2005
  } | null;
1905
2006
  } | null;
@@ -2009,6 +2110,9 @@ declare const startLocalNodeFromEnv: (env?: Env) => {
2009
2110
  validate: (orderId: string) => OrderCheck;
2010
2111
  place: (orderId: string, body?: PlaceOrderBody, deviceId?: string | null) => PlaceOrderResult;
2011
2112
  changeFulfillment: (orderId: string, to: string, actor?: Record<string, unknown>) => import("@fire-spark/types").Order;
2113
+ putIntent: (orderId: string, body: Record<string, unknown>) => import("@fire-spark/types").Order;
2114
+ deleteIntent: (orderId: string) => import("@fire-spark/types").Order;
2115
+ recordPayment: (orderId: string, raw: Record<string, unknown>) => import("@fire-spark/types").Order;
2012
2116
  };
2013
2117
  handle: (request: Request) => Promise<Response>;
2014
2118
  boot: () => {
@@ -2135,8 +2239,16 @@ declare const startLocalNodeFromEnv: (env?: Env) => {
2135
2239
  start: () => void;
2136
2240
  stop: () => void;
2137
2241
  close: () => void;
2242
+ drain: {
2243
+ onTransition: (transition: ModeTransition) => void;
2244
+ drainingFor: () => number | null;
2245
+ capped: () => boolean;
2246
+ admitsNewOrders: () => boolean;
2247
+ cartIdleLimitMs: () => number;
2248
+ paymentIdleLimitMs: () => number;
2249
+ };
2138
2250
  settings: () => LocalNodeSettings;
2139
2251
  } | null;
2140
2252
  };
2141
2253
  //#endregion
2142
- export { type AdminRequest, type AppendEventInput, type BatchResponse, CLOUD_STOREFRONT_AUDIENCE, CREDENTIALS_PATH, type CloudClient, CloudHttpError, type CreateOrderBody, DEFAULT_CLOUD_URL, DEFAULT_LOCAL_SETTINGS, DEFAULT_TLS_DOMAIN, DRAIN_HOLD_MS, type DeviceAuth, type DiskLevel, type DiskStatus, type DownstreamHandlers, ENROLL_PATH, type EcPrivateJwk, type EcPublicJwk, type EnrollInput, GATEWAY_CERTIFICATE_TAG, GATEWAY_ROUTE_ID, GATEWAY_TARGET_VAR, type GatewayRoutes, type GatewaySwitch, type GatewayTarget, type JwtClaims, LOCAL_BACKUP_INTERVAL_MS, LOCAL_BACKUP_KEEP, LOCAL_BATCH_MAX_BYTES, LOCAL_BATCH_MAX_EVENTS, LOCAL_BATCH_OVERHEAD_BYTES, LOCAL_CREDENTIALS_INFO, LOCAL_CREDENTIALS_SECTION, LOCAL_DEVICE_TOKEN_AUDIENCE, LOCAL_DEVICE_TOKEN_TTL_SECONDS, LOCAL_DISK_CRITICAL_RATIO, LOCAL_DISK_WARNING_RATIO, LOCAL_DOWNSTREAM_PAGE, LOCAL_EVENT_MAX_PAYLOAD_BYTES, LOCAL_EVENT_SCHEMA_VERSION, LOCAL_MODES, LOCAL_NODE_GLOBAL, LOCAL_OFFLINE_PAYMENT_METHODS, LOCAL_ORIGIN_HEADER, LOCAL_PLACED_FULFILLMENT_STATUS, LOCAL_RELAY_HEADER, LOCAL_RETRY_MAX_MS, LOCAL_RETRY_MIN_MS, LOCAL_SCHEMA_VERSION, LOCAL_SERVING_MODES, LOCAL_SYNC_INTERVAL_MS, LOCAL_UPSTREAM_EVENT_TYPES, type LocalConnectivity, type LocalDatabase, type LocalEventPayload, type LocalEventRow, type LocalFailoverSettings, type LocalMetaKey, type LocalMode, type LocalNode, type LocalNodeOptions, type LocalNodePhase, type LocalNodeSettings, type LocalNodeStatus, type LocalOrder, type LocalPrincipal, type LocalRuntime, LocalRuntimeError, type LocalRuntimeOptions, type LocalUpstreamEventType, type LocalWriteContext, type ModeController, type ModeInput, type ModeState, NODE_ASSERTION_AUDIENCE_PATH, NODE_ASSERTION_TTL_SECONDS, type NodeCredentials, type NodeCsr, type NodeIdentity, type NodeKeys, type NodeTls, type NodeTlsStatus, type NodeTlsView, type OpenLocalDatabaseOptions, type OrderActor, type OrderService, type PendingOrderRow, type PlaceOrderBody, type PlaceOrderResult, type SealedCredentials, type StateManifestResponse, type StorefrontHandler, TLS_CERTIFICATE_PATH, TLS_CSR_PATH, type UpdateOrderBody, type UpstreamOutcome, appendEvent, applyBatchResults, applyInbox, applySnapshot, backupDatabase, buildNodeCsr, caddyAdminRequest, cancelJob, checkIntegrity, checkOrder, collectHealthSample, countUnsyncedEvents, createCloudClient, createCloudRelay, createCredentialStore, createDeviceAuth, createDownstreamHandlers, createGatewaySwitch, createLocalNode, createLocalRuntime, createModeController, createNodeTls, createOrderService, createStorefrontHandler, createUpstreamSync, decodeJwt, diskLevel, drainUpstream, enrollNode, enrollmentCodeHash, enrollmentJwks, findEventByIdempotencyKey, formatDisplayNumber, gatewayTargetFor, generateNodeKeys, getMeta, hashDeviceSecret, importSigningKey, importVerifyKey, inTransaction, initialModeState, isDeviceRevoked, isLocalRuntimeError, isNodeHostname, isServingMode, jwkThumbprint, listBackups, listEvents, listModeChanges, listPendingOrders, loadOrCreateControlToken, loadOrCreateNodeKeys, localMessage, localNodeOptionsFromEnv, matchesControlToken, migrateLocalDatabase, nextDisplayNumber, nextMode, openCredentials, openLocalDatabase, payloadHashOf, pickLocale, pinLookupHash, priceOrder, publicJwkOf, publishedLocalNode, pullDownstream, readDiskStatus, readLocalSettings, readNetworkInfo, readNodeIdentity, readOrderState, readPendingOrder, readStateRef, retryDelayMs, revokeDevice, runDueJobs, saveNodeIdentity, scheduleJob, selectBatch, sendNextBatch, setMeta, signEs256, startLocalNodeFromEnv, syncSnapshot, targetOfRoute, uuidv7, verifyBlob, verifyCachedSnapshot, verifyEs256, verifyManifest, verifyPinHash };
2254
+ export { type AdminRequest, type AppendEventInput, type BatchResponse, CLOUD_STOREFRONT_AUDIENCE, CREDENTIALS_PATH, type CloudClient, CloudHttpError, type CreateOrderBody, DEFAULT_CLOUD_URL, DEFAULT_LOCAL_SETTINGS, DEFAULT_TLS_DOMAIN, DRAIN_CAPPED_CART_IDLE_MS, DRAIN_HOLD_MS, type DeviceAuth, type DiskLevel, type DiskStatus, type DownstreamHandlers, ENROLL_PATH, type EcPrivateJwk, type EcPublicJwk, type EnrollInput, GATEWAY_CERTIFICATE_TAG, GATEWAY_ROUTE_ID, GATEWAY_TARGET_VAR, type GatewayRoutes, type GatewaySwitch, type GatewayTarget, type JwtClaims, LOCAL_BACKUP_INTERVAL_MS, LOCAL_BACKUP_KEEP, LOCAL_BATCH_MAX_BYTES, LOCAL_BATCH_MAX_EVENTS, LOCAL_BATCH_OVERHEAD_BYTES, LOCAL_CREDENTIALS_INFO, LOCAL_CREDENTIALS_SECTION, LOCAL_DEVICE_PAYMENT_METHODS, LOCAL_DEVICE_TOKEN_AUDIENCE, LOCAL_DEVICE_TOKEN_TTL_SECONDS, LOCAL_DISK_CRITICAL_RATIO, LOCAL_DISK_WARNING_RATIO, LOCAL_DOWNSTREAM_PAGE, LOCAL_EVENT_MAX_PAYLOAD_BYTES, LOCAL_EVENT_SCHEMA_VERSION, LOCAL_MODES, LOCAL_NODE_GLOBAL, LOCAL_OFFLINE_PAYMENT_METHODS, LOCAL_ORIGIN_HEADER, LOCAL_PLACED_FULFILLMENT_STATUS, LOCAL_QUARANTINE_AFTER_ATTEMPTS, LOCAL_RELAY_HEADER, LOCAL_RETRY_MAX_MS, LOCAL_RETRY_MIN_MS, LOCAL_SCHEMA_VERSION, LOCAL_SERVING_MODES, LOCAL_SYNC_INTERVAL_MS, LOCAL_UPSTREAM_EVENT_TYPES, type LocalConnectivity, type LocalDatabase, type LocalEventPayload, type LocalEventRow, type LocalFailoverSettings, type LocalMetaKey, type LocalMode, type LocalNode, type LocalNodeOptions, type LocalNodePhase, type LocalNodeSettings, type LocalNodeStatus, type LocalOrder, type LocalPrincipal, type LocalRuntime, LocalRuntimeError, type LocalRuntimeOptions, type LocalUpstreamEventType, type LocalWriteContext, type ModeController, type ModeInput, type ModeState, NODE_ASSERTION_AUDIENCE_PATH, NODE_ASSERTION_TTL_SECONDS, type NodeCredentials, type NodeCsr, type NodeIdentity, type NodeKeys, type NodeTls, type NodeTlsStatus, type NodeTlsView, type OpenLocalDatabaseOptions, type OrderActor, type OrderService, type PendingOrderRow, type PlaceOrderBody, type PlaceOrderResult, type SealedCredentials, type StateManifestResponse, type StorefrontHandler, TLS_CERTIFICATE_PATH, TLS_CSR_PATH, type UpdateOrderBody, type UpstreamOutcome, appendEvent, applyBatchResults, applyInbox, applySnapshot, backupDatabase, buildNodeCsr, caddyAdminRequest, cancelJob, checkIntegrity, checkOrder, collectHealthSample, countUnsyncedEvents, createCloudClient, createCloudRelay, createCredentialStore, createDeviceAuth, createDownstreamHandlers, createGatewaySwitch, createLocalNode, createLocalRuntime, createModeController, createNodeTls, createOrderService, createStorefrontHandler, createUpstreamSync, decodeJwt, diskLevel, drainUpstream, enrollNode, enrollmentCodeHash, enrollmentJwks, findEventByIdempotencyKey, formatDisplayNumber, gatewayTargetFor, generateNodeKeys, getMeta, hashDeviceSecret, importSigningKey, importVerifyKey, inTransaction, initialModeState, isDeviceRevoked, isLocalRuntimeError, isNodeHostname, isServingMode, jwkThumbprint, listBackups, listEvents, listModeChanges, listPendingOrders, loadOrCreateControlToken, loadOrCreateNodeKeys, localMessage, localNodeOptionsFromEnv, matchesControlToken, migrateLocalDatabase, nextDisplayNumber, nextMode, openCredentials, openLocalDatabase, payloadHashOf, pickLocale, pinLookupHash, priceOrder, publicJwkOf, publishedLocalNode, pullDownstream, readDiskStatus, readLocalSettings, readNetworkInfo, readNodeIdentity, readOrderState, readPendingOrder, readStateRef, retryDelayMs, revokeDevice, runDueJobs, saveNodeIdentity, scheduleJob, selectBatch, sendNextBatch, setMeta, signEs256, startLocalNodeFromEnv, syncSnapshot, targetOfRoute, uuidv7, verifyBlob, verifyCachedSnapshot, verifyEs256, verifyManifest, verifyPinHash };