@datafn/server 0.1.3 → 0.1.5-maint.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 +0 -48
- package/dist/index.cjs +461 -1355
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -269
- package/dist/index.d.ts +5 -269
- package/dist/index.js +464 -1303
- package/dist/index.js.map +1 -1
- package/package.json +10 -16
- package/dist/placement.cjs +0 -143
- package/dist/placement.cjs.map +0 -1
- package/dist/placement.d.cts +0 -49
- package/dist/placement.d.ts +0 -49
- package/dist/placement.js +0 -139
- package/dist/placement.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { DATAFN_REQUEST_ACTIONS, DATAFN_REQUEST_PROTOCOL_VERSION, DATAFN_REQUEST_PROTOCOL_VERSIONS, DATAFN_STRUCTURAL_SELECTOR_POSITIONS, DatafnRequestAction, DatafnRequestProtocolVersion, DatafnResourceSelector, ParsedDatafnMutation, ParsedDatafnQuery, ParsedDatafnRequest, ParsedDatafnTransactStep, StructuralResourceSelection, collectStructuralResourceSelectors, extractStructuralResourceSelectors, isDatafnRequestAction, parseDatafnRequest } from '@datafn/core';
|
|
1
|
+
import { DatafnPlugin, DatafnSchema as DatafnSchema$1 } from '@datafn/core';
|
|
3
2
|
import { ObservationEvent, ObservabilityInput, ObservabilityConfigInput } from '@superfunctions/observability';
|
|
4
3
|
import { DatafnSchema, DatafnPlugin as DatafnPlugin$1 } from '@datafn/core/types';
|
|
5
4
|
import { Route, Router } from '@superfunctions/http';
|
|
6
5
|
import { ConditionalKVStoreAdapter, IndexedDirectoryStoreAdapter, Adapter, AtomicKVStoreAdapter, RuntimeStores, RowLevelNamespaceConfig } from '@superfunctions/db';
|
|
7
6
|
import { DatafnError } from '@datafn/core/errors';
|
|
8
|
-
export { DatafnPlacementConstraint, DatafnPlacementConstraintContext, DatafnPlacementDecision, DatafnPlacementDecisionSource, DatafnPlacementLocation, DatafnPlacementRankingInput, DatafnPlacementRegionCandidate, DatafnPlacementSelectionInput, rankDatafnPlacementRegions, readDatafnCloudflarePlacementLocation, selectDatafnPlacementRegion } from './placement.js';
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* SearchProvider interface for server-side search integration.
|
|
@@ -69,98 +67,6 @@ interface DatafnLogger {
|
|
|
69
67
|
debug(message: string, context?: Record<string, unknown>): void;
|
|
70
68
|
}
|
|
71
69
|
|
|
72
|
-
interface DatafnRouteIdentity {
|
|
73
|
-
/** Opaque authenticated subject; never derived from routing headers. */
|
|
74
|
-
subject: string;
|
|
75
|
-
namespace: string;
|
|
76
|
-
sessionBinding?: string;
|
|
77
|
-
/** Optional upstream session deadline bounds the grant. */
|
|
78
|
-
expiresAt?: number;
|
|
79
|
-
}
|
|
80
|
-
interface DatafnRouteTicketClaims {
|
|
81
|
-
version: 1;
|
|
82
|
-
issuer: string;
|
|
83
|
-
audience: string;
|
|
84
|
-
subject: string;
|
|
85
|
-
namespace: string;
|
|
86
|
-
regionId: string;
|
|
87
|
-
epoch: number;
|
|
88
|
-
scopes: DatafnRouteScope[];
|
|
89
|
-
issuedAt: number;
|
|
90
|
-
notBefore: number;
|
|
91
|
-
expiresAt: number;
|
|
92
|
-
ticketId: string;
|
|
93
|
-
sessionBinding?: string;
|
|
94
|
-
}
|
|
95
|
-
interface DatafnRouteTicketSigner {
|
|
96
|
-
sign(claims: DatafnRouteTicketClaims): Promise<string> | string;
|
|
97
|
-
}
|
|
98
|
-
interface DatafnRouteTicketVerifier {
|
|
99
|
-
verify(ticket: string): Promise<DatafnRouteTicketClaims> | DatafnRouteTicketClaims;
|
|
100
|
-
}
|
|
101
|
-
interface DatafnRouteTicketEvent {
|
|
102
|
-
type: "issued" | "accepted" | "rejected" | "renewal_failed";
|
|
103
|
-
code?: string;
|
|
104
|
-
}
|
|
105
|
-
declare function routeTicketError(code: "DATAFN_ROUTE_TICKET_INVALID" | "DATAFN_ROUTE_TICKET_EXPIRED" | "DATAFN_ROUTE_TICKET_REVOKED" | "DATAFN_ROUTE_FORBIDDEN" | "DATAFN_ROUTE_RATE_LIMITED"): DatafnRoutingError;
|
|
106
|
-
/** Separate signing domain and key ring from DATA-1 internal request assertions. */
|
|
107
|
-
declare function createDatafnHmacRouteTickets(input: {
|
|
108
|
-
activeKeyId: string;
|
|
109
|
-
/** At least 32 bytes of cryptographically random key material per key. */
|
|
110
|
-
keys: Record<string, string | Uint8Array>;
|
|
111
|
-
}): DatafnRouteTicketSigner & DatafnRouteTicketVerifier;
|
|
112
|
-
interface DatafnRegionalEndpoint {
|
|
113
|
-
httpUrl: string;
|
|
114
|
-
wsUrl?: string;
|
|
115
|
-
/** Unique audience per environment/cell endpoint. */
|
|
116
|
-
audience: string;
|
|
117
|
-
}
|
|
118
|
-
interface DatafnRouteBootstrapConfig {
|
|
119
|
-
directory: DatafnPlacementDirectoryAdapter;
|
|
120
|
-
authenticate(request: Request): Promise<DatafnRouteIdentity> | DatafnRouteIdentity;
|
|
121
|
-
resolveEndpoint(placement: DatafnNamespacePlacement): Promise<DatafnRegionalEndpoint> | DatafnRegionalEndpoint;
|
|
122
|
-
/** Application-owned authorization selects operations; never accept requested scopes verbatim. */
|
|
123
|
-
authorize(identity: DatafnRouteIdentity): Promise<readonly DatafnRouteScope[]> | readonly DatafnRouteScope[];
|
|
124
|
-
signer: DatafnRouteTicketSigner;
|
|
125
|
-
issuer: string;
|
|
126
|
-
ttlMs?: number;
|
|
127
|
-
now?: () => number;
|
|
128
|
-
onEvent?(event: DatafnRouteTicketEvent): void;
|
|
129
|
-
}
|
|
130
|
-
/** Mount at one canonical, authenticated POST endpoint. Request body/region headers are ignored. */
|
|
131
|
-
declare function createDatafnRouteBootstrap(config: DatafnRouteBootstrapConfig): (request: Request) => Promise<Response>;
|
|
132
|
-
interface DatafnRegionalTicketRuntime {
|
|
133
|
-
/** Browser HTTP/WS origins. An Origin header is rejected unless explicitly allowed. */
|
|
134
|
-
allowedOrigins?: readonly string[];
|
|
135
|
-
verifier: DatafnRouteTicketVerifier;
|
|
136
|
-
issuer: string;
|
|
137
|
-
audience: string;
|
|
138
|
-
/** Validates application credentials separately from the route grant. Also used on WS handshakes. */
|
|
139
|
-
authenticate(request: Request): Promise<DatafnRouteIdentity> | DatafnRouteIdentity;
|
|
140
|
-
/** Checks ticket/session revocation on each HTTP request and WS admission. False rejects. */
|
|
141
|
-
isActive?(claims: DatafnRouteTicketClaims): Promise<boolean> | boolean;
|
|
142
|
-
/** Optional provider-neutral limiter before plugin authorization/execution. */
|
|
143
|
-
allowRequest?(claims: DatafnRouteTicketClaims): Promise<boolean> | boolean;
|
|
144
|
-
now?: () => number;
|
|
145
|
-
/** Future issuance/not-before tolerance only. Expiry is never extended. Default 5 seconds. */
|
|
146
|
-
clockSkewMs?: number;
|
|
147
|
-
onEvent?(event: DatafnRouteTicketEvent): void;
|
|
148
|
-
}
|
|
149
|
-
/** The adapter must negotiate only datafn-sync-v1, never echo the ticket subprotocol. */
|
|
150
|
-
declare function readDatafnRouteTicket(request: Request, websocket?: boolean): string | undefined;
|
|
151
|
-
declare function validateDatafnRouteTicket(input: {
|
|
152
|
-
request: Request;
|
|
153
|
-
namespace: string;
|
|
154
|
-
regionId: string;
|
|
155
|
-
scope: DatafnRouteScope;
|
|
156
|
-
runtime: DatafnRegionalTicketRuntime;
|
|
157
|
-
}): Promise<DatafnRouteTicketClaims>;
|
|
158
|
-
/** Wrap regional HTTP ingress, including preflight. No credentials/cookies or wildcard origins. */
|
|
159
|
-
declare function withDatafnRegionalCors(handler: (request: Request) => Promise<Response>, options: {
|
|
160
|
-
origins: readonly string[];
|
|
161
|
-
headers?: readonly string[];
|
|
162
|
-
}): (request: Request) => Promise<Response>;
|
|
163
|
-
|
|
164
70
|
type DatafnPlacementState = "active" | "moving" | "tombstoned";
|
|
165
71
|
interface DatafnNamespacePlacement {
|
|
166
72
|
namespace: string;
|
|
@@ -251,8 +157,6 @@ interface DatafnRoutingEvent {
|
|
|
251
157
|
}
|
|
252
158
|
interface DatafnPlacementRuntimeConfig {
|
|
253
159
|
directory: DatafnPlacementDirectoryAdapter;
|
|
254
|
-
/** Opt-in public ingress: requires a route ticket or a valid internal assertion. */
|
|
255
|
-
routeTickets?: DatafnRegionalTicketRuntime;
|
|
256
160
|
requireRoutingAssertion?: boolean;
|
|
257
161
|
assertionVerifier?: DatafnRoutingAssertionVerifier;
|
|
258
162
|
replayStore?: DatafnRoutingReplayStore;
|
|
@@ -266,7 +170,7 @@ interface DatafnPlacementRuntimeConfig {
|
|
|
266
170
|
declare const DATAFN_ROUTING_ASSERTION_HEADER = "x-datafn-routing-assertion";
|
|
267
171
|
declare const DATAFN_ROUTING_INTERNAL_HEADERS: readonly ["x-datafn-routing-assertion", "x-datafn-routing-namespace", "x-datafn-routing-region", "x-datafn-routing-epoch"];
|
|
268
172
|
declare class DatafnRoutingError extends Error {
|
|
269
|
-
readonly code: "
|
|
173
|
+
readonly code: "DATAFN_PLACEMENT_NOT_FOUND" | "DATAFN_PLACEMENT_UNAVAILABLE" | "DATAFN_REGION_MISMATCH" | "DATAFN_NAMESPACE_MOVING" | "DATAFN_CELL_UNAVAILABLE" | "DATAFN_ROUTING_ASSERTION_INVALID" | "DATAFN_ROUTING_RETRY_EXHAUSTED" | "DATAFN_PAYLOAD_TOO_LARGE";
|
|
270
174
|
readonly status: number;
|
|
271
175
|
readonly retryable: boolean;
|
|
272
176
|
readonly executionStarted: boolean;
|
|
@@ -303,15 +207,12 @@ declare function claimDatafnNamespacePlacement(input: {
|
|
|
303
207
|
interface DatafnPlacementValidationResult {
|
|
304
208
|
placement: DatafnNamespacePlacement;
|
|
305
209
|
assertion?: DatafnRoutingAssertionClaims;
|
|
306
|
-
ticket?: DatafnRouteTicketClaims;
|
|
307
210
|
}
|
|
308
211
|
declare function validateDatafnPlacement(input: {
|
|
309
212
|
namespace: string;
|
|
310
213
|
regionId: string;
|
|
311
214
|
runtime: DatafnPlacementRuntimeConfig;
|
|
312
215
|
request?: Request;
|
|
313
|
-
/** Server-selected operation; custom routes default to the custom scope. */
|
|
314
|
-
scope?: DatafnRouteScope;
|
|
315
216
|
/** Trusted in-process execution has no externally supplied assertion. */
|
|
316
217
|
trustedInternal?: boolean;
|
|
317
218
|
}): Promise<DatafnPlacementValidationResult>;
|
|
@@ -491,7 +392,7 @@ interface ExecutionTimingEvent {
|
|
|
491
392
|
}
|
|
492
393
|
|
|
493
394
|
type DataFnEventType = 'datafn.authorization.denied' | 'datafn.payload.rejected' | 'datafn.rate_limited' | 'datafn.request.failed' | 'datafn.retention.pruned' | 'datafn.retention.prune_failed';
|
|
494
|
-
type DataFnAction =
|
|
395
|
+
type DataFnAction = 'status' | 'query' | 'mutation' | 'transact' | 'seed' | 'clone' | 'pull' | 'push' | 'reconcile' | 'search';
|
|
495
396
|
interface DataFnRequestEventMetadata extends Record<string, unknown> {
|
|
496
397
|
action?: DataFnAction;
|
|
497
398
|
path?: string;
|
|
@@ -697,12 +598,6 @@ interface WebSocketClient {
|
|
|
697
598
|
*/
|
|
698
599
|
interface WsAuthContext {
|
|
699
600
|
namespace: string;
|
|
700
|
-
/** Set only by the validated regional handshake. */
|
|
701
|
-
routeTicket?: {
|
|
702
|
-
id: string;
|
|
703
|
-
expiresAt: number;
|
|
704
|
-
now?: () => number;
|
|
705
|
-
};
|
|
706
601
|
/** Optional actor identity for principal-targeted invalidation. */
|
|
707
602
|
actorId?: string;
|
|
708
603
|
/** Optional resolved principal IDs for principal-targeted invalidation. */
|
|
@@ -928,9 +823,7 @@ interface DatafnServerConfig<TContext = any> {
|
|
|
928
823
|
/** Public-link plugin instance used to register share-link routes and resolve link principals. */
|
|
929
824
|
publicLinks?: DatafnPublicLinksPlugin;
|
|
930
825
|
/** Authorizes each DataFn action after context creation and before route execution. */
|
|
931
|
-
authorize?: (ctx: TContext
|
|
932
|
-
parsedBody?: unknown;
|
|
933
|
-
}, action: "status" | "query" | "mutation" | "transact" | "seed" | "clone" | "pull" | "push" | "reconcile" | "search", payload: unknown) => Promise<boolean> | boolean;
|
|
826
|
+
authorize?: (ctx: TContext, action: "status" | "query" | "mutation" | "transact" | "seed" | "clone" | "pull" | "push" | "reconcile" | "search", payload: unknown) => Promise<boolean> | boolean;
|
|
934
827
|
/** Static context or request-scoped context factory passed to authorization, namespace resolution, route handlers, and hooks. */
|
|
935
828
|
context?: TContext | ((request: Request) => Promise<TContext> | TContext);
|
|
936
829
|
/** Request, query, mutation, and validation limits enforced by DataFn routes. */
|
|
@@ -1049,8 +942,6 @@ interface DatafnServer<TContext = any> {
|
|
|
1049
942
|
addRoutedClient(client: WebSocketClient, authContext: WsAuthContext, handshakeRequest?: Request): Promise<boolean>;
|
|
1050
943
|
/** Closes stale sessions so clients reconnect through the canonical gateway. */
|
|
1051
944
|
fenceNamespace(namespace: string, minimumEpoch?: number): number;
|
|
1052
|
-
/** Immediately revoke an admitted route ticket across this process. */
|
|
1053
|
-
revokeRouteTicket(ticketId: string): number;
|
|
1054
945
|
removeClient(client: WebSocketClient): void;
|
|
1055
946
|
handleMessage(client: WebSocketClient, data: string): void;
|
|
1056
947
|
/** REL-007: Called by WS transport on native pong frame receipt. */
|
|
@@ -1105,105 +996,6 @@ interface DatafnApp {
|
|
|
1105
996
|
*/
|
|
1106
997
|
declare function datafn(config: DatafnAppConfig): DatafnApp;
|
|
1107
998
|
|
|
1108
|
-
/**
|
|
1109
|
-
* Adapter-resolved namespace storage plan.
|
|
1110
|
-
*
|
|
1111
|
-
* The logical contract lives in `@datafn/core`. This module binds that
|
|
1112
|
-
* contract to the installed PostgreSQL schema and fails closed when the
|
|
1113
|
-
* catalog contains unknown DataFn-owned namespace storage.
|
|
1114
|
-
*/
|
|
1115
|
-
|
|
1116
|
-
declare const POSTGRES_NAMESPACE_STORAGE_CATALOG_SQL: string;
|
|
1117
|
-
type DatafnNamespaceStorageErrorCode = "DATAFN_NAMESPACE_STORAGE_UNSUPPORTED" | "DATAFN_NAMESPACE_STORAGE_VERSION_MISMATCH" | "DATAFN_NAMESPACE_STORAGE_INCOMPLETE" | "DATAFN_NAMESPACE_STORAGE_UNKNOWN" | "DATAFN_NAMESPACE_STORAGE_INVALID";
|
|
1118
|
-
declare class DatafnNamespaceStorageError extends Error {
|
|
1119
|
-
readonly code: DatafnNamespaceStorageErrorCode;
|
|
1120
|
-
readonly details?: unknown;
|
|
1121
|
-
constructor(input: {
|
|
1122
|
-
code: DatafnNamespaceStorageErrorCode;
|
|
1123
|
-
message: string;
|
|
1124
|
-
details?: unknown;
|
|
1125
|
-
});
|
|
1126
|
-
}
|
|
1127
|
-
interface NamespaceStorageCatalogRelation {
|
|
1128
|
-
readonly name: string;
|
|
1129
|
-
readonly columns: readonly string[];
|
|
1130
|
-
/** Valid, non-partial indexes, with expression and INCLUDE columns excluded. */
|
|
1131
|
-
readonly indexes?: readonly {
|
|
1132
|
-
columns: readonly string[];
|
|
1133
|
-
unique: boolean;
|
|
1134
|
-
primary?: boolean;
|
|
1135
|
-
}[];
|
|
1136
|
-
}
|
|
1137
|
-
interface NamespaceStorageCatalog {
|
|
1138
|
-
readonly dialect: "postgres";
|
|
1139
|
-
readonly relations: readonly NamespaceStorageCatalogRelation[];
|
|
1140
|
-
}
|
|
1141
|
-
interface NamespaceStorageEntry {
|
|
1142
|
-
readonly logicalRole: NamespaceStorageLogicalRole | "application";
|
|
1143
|
-
readonly ownership: NamespaceStorageOwnership;
|
|
1144
|
-
readonly relation: string;
|
|
1145
|
-
readonly quotedRelation: string;
|
|
1146
|
-
readonly namespaceColumn: string;
|
|
1147
|
-
readonly quotedNamespaceColumn: string;
|
|
1148
|
-
readonly operations: readonly NamespaceStorageOperation[];
|
|
1149
|
-
readonly copyOrder: number;
|
|
1150
|
-
readonly present: boolean;
|
|
1151
|
-
}
|
|
1152
|
-
interface NamespaceStoragePlan {
|
|
1153
|
-
readonly manifestVersion: typeof DATAFN_NAMESPACE_STORAGE_MANIFEST_VERSION;
|
|
1154
|
-
readonly schemaVersion: typeof DATAFN_NAMESPACE_STORAGE_SCHEMA_VERSION;
|
|
1155
|
-
readonly dialect: "postgres";
|
|
1156
|
-
readonly entries: readonly NamespaceStorageEntry[];
|
|
1157
|
-
}
|
|
1158
|
-
interface ApplicationNamespaceStorageEntry {
|
|
1159
|
-
readonly relation: string;
|
|
1160
|
-
readonly namespaceColumn: string;
|
|
1161
|
-
readonly operations?: readonly NamespaceStorageOperation[];
|
|
1162
|
-
readonly copyOrder?: number;
|
|
1163
|
-
}
|
|
1164
|
-
declare function quotePostgresIdentifier(identifier: string): string;
|
|
1165
|
-
declare function namespacedInternalTableRoles(): Readonly<Record<string, NamespaceStorageLogicalRole>>;
|
|
1166
|
-
declare function resolveNamespaceStoragePlan(input: {
|
|
1167
|
-
schema: DatafnSchema$1;
|
|
1168
|
-
catalog: NamespaceStorageCatalog;
|
|
1169
|
-
manifestVersion?: string;
|
|
1170
|
-
schemaVersion?: string;
|
|
1171
|
-
}): NamespaceStoragePlan;
|
|
1172
|
-
declare function selectNamespaceStorageEntries(plan: NamespaceStoragePlan, operation: NamespaceStorageOperation): readonly NamespaceStorageEntry[];
|
|
1173
|
-
declare function composeNamespaceStoragePlan(plan: NamespaceStoragePlan, applicationEntries: readonly ApplicationNamespaceStorageEntry[]): NamespaceStoragePlan;
|
|
1174
|
-
declare const POSTGRES_NAMESPACE_STORAGE_INDEX_SQL: string;
|
|
1175
|
-
type PostgresNamespaceStorageQuery = (sql: string) => Promise<readonly {
|
|
1176
|
-
table_name: string;
|
|
1177
|
-
column_name?: string;
|
|
1178
|
-
index_columns?: readonly string[];
|
|
1179
|
-
index_unique?: boolean;
|
|
1180
|
-
index_primary?: boolean;
|
|
1181
|
-
}[]>;
|
|
1182
|
-
declare function inspectPostgresNamespaceStorage(query: PostgresNamespaceStorageQuery): Promise<NamespaceStorageCatalog>;
|
|
1183
|
-
declare function assertInternalNamespaceStorageMetadataComplete(): void;
|
|
1184
|
-
declare function drainNamespaceStorage(input: {
|
|
1185
|
-
adapter: Adapter;
|
|
1186
|
-
plan: NamespaceStoragePlan;
|
|
1187
|
-
namespace: string;
|
|
1188
|
-
runtime: DatafnMultiRegionRuntimeConfig;
|
|
1189
|
-
logger?: DatafnLogger;
|
|
1190
|
-
}): Promise<{
|
|
1191
|
-
processed: number;
|
|
1192
|
-
pending: number;
|
|
1193
|
-
}>;
|
|
1194
|
-
|
|
1195
|
-
/**
|
|
1196
|
-
* Drain every permission-directory outbox row for one namespace.
|
|
1197
|
-
* Used by tenant move/backup tooling after writes are fenced.
|
|
1198
|
-
*/
|
|
1199
|
-
declare function drainNamespacePermissionDirectoryOutbox(db: Adapter, namespace: string, runtime: DatafnMultiRegionRuntimeConfig, logger?: DatafnLogger, options?: {
|
|
1200
|
-
limit?: number;
|
|
1201
|
-
maxRounds?: number;
|
|
1202
|
-
}): Promise<{
|
|
1203
|
-
processed: number;
|
|
1204
|
-
pending: number;
|
|
1205
|
-
}>;
|
|
1206
|
-
|
|
1207
999
|
/**
|
|
1208
1000
|
* GET /datafn/status endpoint
|
|
1209
1001
|
* Returns server metadata, capabilities, limits, and schema hash
|
|
@@ -1221,60 +1013,4 @@ interface StatusResult {
|
|
|
1221
1013
|
serverTimeMs: number;
|
|
1222
1014
|
}
|
|
1223
1015
|
|
|
1224
|
-
|
|
1225
|
-
interface AncestorInactiveCursor {
|
|
1226
|
-
resource: string;
|
|
1227
|
-
afterId: string | null;
|
|
1228
|
-
}
|
|
1229
|
-
interface RecomputeAncestorInactiveOptions {
|
|
1230
|
-
namespace: string;
|
|
1231
|
-
batchSize?: number;
|
|
1232
|
-
/** Maximum ancestor nodes visited per row; exceeding the bound fails explicitly. */
|
|
1233
|
-
maxGraphNodes?: number;
|
|
1234
|
-
cursor?: AncestorInactiveCursor | null;
|
|
1235
|
-
dryRun?: boolean;
|
|
1236
|
-
logger?: DatafnLogger;
|
|
1237
|
-
}
|
|
1238
|
-
interface RecomputeAncestorInactiveResult {
|
|
1239
|
-
scanned: number;
|
|
1240
|
-
updated: number;
|
|
1241
|
-
/** Mismatches not written because their compare-and-set lost a race. */
|
|
1242
|
-
skipped: number;
|
|
1243
|
-
/** Null once every dependent resource in the namespace has been visited. */
|
|
1244
|
-
nextCursor: AncestorInactiveCursor | null;
|
|
1245
|
-
}
|
|
1246
|
-
/**
|
|
1247
|
-
* Ordered list of resources that own the runtime-maintained
|
|
1248
|
-
* `isAncestorInactive` field for `schema`.
|
|
1249
|
-
*/
|
|
1250
|
-
declare function ancestorInactiveResources(schema: DatafnSchema$1): string[];
|
|
1251
|
-
/**
|
|
1252
|
-
* Recomputes `isAncestorInactive` for one batch of records in `namespace`,
|
|
1253
|
-
* resolving each record against the current state of its parents. Rows are
|
|
1254
|
-
* visited in ascending id order per resource so the sweep is deterministic and
|
|
1255
|
-
* resumable via `nextCursor`. Ancestor flags are derived from primary state,
|
|
1256
|
-
* with bounded traversal and explicit cycle/malformed-link errors. Quiesce
|
|
1257
|
-
* ancestor/link mutations during repair; compare-and-set guards only the
|
|
1258
|
-
* derived value on each row, not an atomic snapshot of the entire graph.
|
|
1259
|
-
*/
|
|
1260
|
-
declare function recomputeAncestorInactive(adapter: Adapter, schema: DatafnSchema$1, options: RecomputeAncestorInactiveOptions): Promise<RecomputeAncestorInactiveResult>;
|
|
1261
|
-
interface RecomputeAncestorInactiveAllResult {
|
|
1262
|
-
scanned: number;
|
|
1263
|
-
updated: number;
|
|
1264
|
-
/** Mismatches not written because their compare-and-set lost a race. */
|
|
1265
|
-
skipped: number;
|
|
1266
|
-
sweeps: number;
|
|
1267
|
-
/** False when `maxSweeps` was reached while the last sweep changed or skipped rows. */
|
|
1268
|
-
converged: boolean;
|
|
1269
|
-
}
|
|
1270
|
-
/**
|
|
1271
|
-
* Runs full namespace sweeps of {@link recomputeAncestorInactive} until a
|
|
1272
|
-
* sweep produces no updates or skipped writes, verifying the prior sweep.
|
|
1273
|
-
* Bounded by `maxSweeps`; check `converged`
|
|
1274
|
-
* and rerun if it is false. Dry runs perform a single sweep.
|
|
1275
|
-
*/
|
|
1276
|
-
declare function recomputeAncestorInactiveAll(adapter: Adapter, schema: DatafnSchema$1, options: Omit<RecomputeAncestorInactiveOptions, "cursor"> & {
|
|
1277
|
-
maxSweeps?: number;
|
|
1278
|
-
}): Promise<RecomputeAncestorInactiveAllResult>;
|
|
1279
|
-
|
|
1280
|
-
export { type AncestorInactiveCursor, type ApplicationNamespaceStorageEntry, AtomicSequenceStore, ChainedSequenceStore, type CreateDatafnPublicLinkInput, type CrossResourceSearchParams, DATAFN_MULTI_REGION_CAPABILITY, DATAFN_ROUTING_ASSERTION_HEADER, DATAFN_ROUTING_INTERNAL_HEADERS, type DataFnAction, type DataFnAuthorizationDeniedEvent, type DataFnAuthorizationDeniedMetadata, type DataFnEvent, type DataFnEventMap, type DataFnEventType, type DataFnPayloadRejectedEvent, type DataFnPayloadRejectedMetadata, type DataFnRateLimitedEvent, type DataFnRateLimitedMetadata, type DataFnRequestEventMetadata, type DataFnRequestFailedEvent, type DataFnRequestFailedMetadata, type DataFnRetentionPruneFailedEvent, type DataFnRetentionPruneFailedMetadata, type DataFnRetentionPrunedEvent, type DataFnRetentionPrunedMetadata, DatabaseSequenceStore, type DatafnApp, type DatafnAppConfig, type DatafnAppServerConfig, type DatafnComposableRoute, type DatafnExecutor, type DatafnExecutorAction, DatafnExecutorError, type DatafnGatewayCellRegistry, type DatafnGatewayDispatcher, type DatafnGatewayRouter, type DatafnGatewayRouterConfig, type DatafnMultiRegionDirectory, type DatafnMultiRegionPluginConfig, type DatafnMultiRegionRuntimeConfig, type DatafnNamespaceMigrationContext, type DatafnNamespaceMigrationHooks, type DatafnNamespaceMigrationState, type DatafnNamespacePlacement, DatafnNamespaceStorageError, type DatafnNamespaceStorageErrorCode, type DatafnPermissionDirectoryGrant, type DatafnPlacementDirectoryAdapter, type DatafnPlacementRuntimeConfig, type DatafnPlacementState, type DatafnPluginAuthorizationInput, type DatafnPluginAuthorizationResult, type DatafnPluginRoutePlacement, type DatafnPluginRoutePlacementResult, type DatafnPublicLinkAuthorizationInput, type DatafnPublicLinkGrant, DatafnPublicLinkInputError, type DatafnPublicLinkPrincipal, type DatafnPublicLinkRecord, type DatafnPublicLinkShareLevel, type DatafnPublicLinkShareScope, type DatafnPublicLinksPlugin, type DatafnPublicLinksPluginConfig, type DatafnRegionalEndpoint, type DatafnRegionalTicketRuntime, type DatafnRouteBootstrapConfig, type DatafnRouteHeaderEntries, type DatafnRouteHeaderInput, type DatafnRouteHeaders, type DatafnRouteHookInput, type DatafnRouteHooks, type DatafnRouteIdentity, type DatafnRouteResponseHook, type DatafnRouteTicketClaims, type DatafnRouteTicketEvent, type DatafnRouteTicketSigner, type DatafnRouteTicketVerifier, type DatafnRoutingAssertionClaims, type DatafnRoutingAssertionSigner, type DatafnRoutingAssertionVerifier, DatafnRoutingError, type DatafnRoutingEvent, type DatafnRoutingEventType, type DatafnRoutingReplayStore, type DatafnServer, type DatafnServerConfig, type NamespaceStorageCatalog, type NamespaceStorageCatalogRelation, type NamespaceStorageEntry, type NamespaceStoragePlan, POSTGRES_NAMESPACE_STORAGE_CATALOG_SQL, POSTGRES_NAMESPACE_STORAGE_INDEX_SQL, type PostgresNamespaceStorageQuery, type RateLimitConfig, type RecomputeAncestorInactiveAllResult, type RecomputeAncestorInactiveOptions, type RecomputeAncestorInactiveResult, type SearchProvider, type SearchResult, type SearchResultItem, type SequenceStore, type SequenceStorePolicy, type StatusResult, ancestorInactiveResources, assertInternalNamespaceStorageMetadataComplete, claimDatafnNamespacePlacement, composeNamespaceStoragePlan, createConditionalKvDatafnPlacementDirectory, createDatafnGatewayRouter, createDatafnHmacRouteTickets, createDatafnHmacRoutingAssertions, createDatafnMultiRegionPlugin, createDatafnPublicLinksPlugin, createDatafnRouteBootstrap, createDatafnServer, createMemoryDatafnPlacementDirectory, createMemoryDatafnRoutingReplayStore, createSequenceStore, datafn, datafnMultiRegionPlugin, drainNamespacePermissionDirectoryOutbox, drainNamespaceStorage, inspectPostgresNamespaceStorage, migrateDatafnNamespace, namespacedInternalTableRoles, quotePostgresIdentifier, readDatafnPublicLinkToken, readDatafnRouteTicket, recomputeAncestorInactive, recomputeAncestorInactiveAll, resolveDatafnPublicLink, resolveNamespaceStoragePlan, routeTicketError, selectNamespaceStorageEntries, validateDatafnPlacement, validateDatafnRouteTicket, validateDatafnRoutingBodyLimit, withDatafnPublicLinksSchema, withDatafnRegionalCors, withDatafnRoutingAssertion };
|
|
1016
|
+
export { AtomicSequenceStore, ChainedSequenceStore, type CreateDatafnPublicLinkInput, type CrossResourceSearchParams, DATAFN_MULTI_REGION_CAPABILITY, DATAFN_ROUTING_ASSERTION_HEADER, DATAFN_ROUTING_INTERNAL_HEADERS, type DataFnAction, type DataFnAuthorizationDeniedEvent, type DataFnAuthorizationDeniedMetadata, type DataFnEvent, type DataFnEventMap, type DataFnEventType, type DataFnPayloadRejectedEvent, type DataFnPayloadRejectedMetadata, type DataFnRateLimitedEvent, type DataFnRateLimitedMetadata, type DataFnRequestEventMetadata, type DataFnRequestFailedEvent, type DataFnRequestFailedMetadata, type DataFnRetentionPruneFailedEvent, type DataFnRetentionPruneFailedMetadata, type DataFnRetentionPrunedEvent, type DataFnRetentionPrunedMetadata, DatabaseSequenceStore, type DatafnApp, type DatafnAppConfig, type DatafnAppServerConfig, type DatafnComposableRoute, type DatafnExecutor, type DatafnExecutorAction, DatafnExecutorError, type DatafnGatewayCellRegistry, type DatafnGatewayDispatcher, type DatafnGatewayRouter, type DatafnGatewayRouterConfig, type DatafnMultiRegionDirectory, type DatafnMultiRegionPluginConfig, type DatafnMultiRegionRuntimeConfig, type DatafnNamespaceMigrationContext, type DatafnNamespaceMigrationHooks, type DatafnNamespaceMigrationState, type DatafnNamespacePlacement, type DatafnPermissionDirectoryGrant, type DatafnPlacementDirectoryAdapter, type DatafnPlacementRuntimeConfig, type DatafnPlacementState, type DatafnPluginAuthorizationInput, type DatafnPluginAuthorizationResult, type DatafnPluginRoutePlacement, type DatafnPluginRoutePlacementResult, type DatafnPublicLinkAuthorizationInput, type DatafnPublicLinkGrant, DatafnPublicLinkInputError, type DatafnPublicLinkPrincipal, type DatafnPublicLinkRecord, type DatafnPublicLinkShareLevel, type DatafnPublicLinkShareScope, type DatafnPublicLinksPlugin, type DatafnPublicLinksPluginConfig, type DatafnRouteHeaderEntries, type DatafnRouteHeaderInput, type DatafnRouteHeaders, type DatafnRouteHookInput, type DatafnRouteHooks, type DatafnRouteResponseHook, type DatafnRoutingAssertionClaims, type DatafnRoutingAssertionSigner, type DatafnRoutingAssertionVerifier, DatafnRoutingError, type DatafnRoutingEvent, type DatafnRoutingEventType, type DatafnRoutingReplayStore, type DatafnServer, type DatafnServerConfig, type RateLimitConfig, type SearchProvider, type SearchResult, type SearchResultItem, type SequenceStore, type SequenceStorePolicy, type StatusResult, claimDatafnNamespacePlacement, createConditionalKvDatafnPlacementDirectory, createDatafnGatewayRouter, createDatafnHmacRoutingAssertions, createDatafnMultiRegionPlugin, createDatafnPublicLinksPlugin, createDatafnServer, createMemoryDatafnPlacementDirectory, createMemoryDatafnRoutingReplayStore, createSequenceStore, datafn, datafnMultiRegionPlugin, migrateDatafnNamespace, readDatafnPublicLinkToken, resolveDatafnPublicLink, validateDatafnPlacement, validateDatafnRoutingBodyLimit, withDatafnPublicLinksSchema, withDatafnRoutingAssertion };
|