@mnmal-ai/substrate 1.0.0-alpha.2 → 1.0.0-alpha.4
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 +1 -1
- package/dist/{dataset-BQ8egGl5.js → dataset-Bd18RP3O.js} +1 -1
- package/dist/pg-edges-store-DKPYyd8l.js +381 -0
- package/dist/{plugin-QuJN9pG_.js → plugin-BG8E04wi.js} +42 -5
- package/dist/recall-bootstrap.js +1 -1
- package/dist/recall.d.ts +8 -0
- package/dist/recall.js +2 -2
- package/dist/{src-DWm0iA88.js → src-DQ1U9Yhs.js} +2 -2
- package/dist/substrate-admin.js +1 -1
- package/dist/substrate.js +6 -380
- package/dist/testing.d.ts +312 -2
- package/dist/testing.js +3 -1
- package/package.json +19 -19
package/dist/testing.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { C as Id, E as Row, _ as EdgesStore, b as ActorIdentity, f as CanDeleteResult, g as EdgeWriteInput, h as EdgeRef, l as PackEnvelope, m as EdgePatch, n as FieldDef, p as Edge, u as Schema } from "./schema-g4FQLr0V.js";
|
|
2
2
|
import { a as RuntimeErrors, n as ResolveObservation, r as ResolverStat, s as SlowRequest, t as ProcessStat } from "./runtime-metrics-DwpDJ8vz.js";
|
|
3
|
-
import { $ as PolicyProbeContext, A as ScheduledTask, B as StartOpts, C as QualifiedFrame, D as RegistryEntryInput, E as RegistryEntry, F as HttpMethod, G as WsConnection, H as SubstrateResponse, I as PluginRouter, K as WsHandler, P as HttpHandler, Q as PolicyDecision, R as RequestObserver, St as WriteResult, T as RegistryBase, U as SubstrateServer, V as SubstrateRequest, Y as Identity, _t as ReadResult, a as EngineHandle, ct as Dataset, dt as DropResult, et as RequestContext, g as NamespaceConfig, gt as ReadParams, lt as DatasetRegistry, mt as FilterCapabilities, n as DropParticipant, o as EngineInput, p as KernelPlugin, st as ConditionalUpdateResult, t as CoordinatorPlugin, ut as DeleteResult, w as Registry$1, xt as WriteOptions, yt as UpdateFieldRef, z as RuntimeOp } from "./plugin-t2g2wX0b.js";
|
|
3
|
+
import { $ as PolicyProbeContext, A as ScheduledTask, B as StartOpts, C as QualifiedFrame, D as RegistryEntryInput, E as RegistryEntry, F as HttpMethod, G as WsConnection, H as SubstrateResponse, I as PluginRouter, K as WsHandler, P as HttpHandler, Q as PolicyDecision, R as RequestObserver, St as WriteResult, T as RegistryBase, U as SubstrateServer, V as SubstrateRequest, Y as Identity, _t as ReadResult, a as EngineHandle, ct as Dataset, dt as DropResult, et as RequestContext, g as NamespaceConfig, gt as ReadParams, lt as DatasetRegistry, mt as FilterCapabilities, n as DropParticipant, o as EngineInput, p as KernelPlugin, st as ConditionalUpdateResult, t as CoordinatorPlugin, ut as DeleteResult, vt as TxScopeHandles, w as Registry$1, xt as WriteOptions, yt as UpdateFieldRef, z as RuntimeOp } from "./plugin-t2g2wX0b.js";
|
|
4
4
|
import { a as WsResponseFrame, f as IdempotencyStore, l as SweepDeps, s as BridgeRegistry, u as SweepState } from "./ws-C72iVS5T.js";
|
|
5
5
|
import { t as Embedder } from "./types-8c0gtnd2.js";
|
|
6
|
+
import { Sql, TransactionSql } from "postgres";
|
|
6
7
|
//#region ../../packages/substrate-compose/src/auth.d.ts
|
|
7
8
|
type JwtAlg = 'RS256' | 'ES256' | 'HS256' | 'EdDSA';
|
|
8
9
|
interface AuthKey {
|
|
@@ -1022,6 +1023,315 @@ interface ComposeResult {
|
|
|
1022
1023
|
}
|
|
1023
1024
|
export declare function compose(opts: ComposeOpts): Promise<ComposeResult>;
|
|
1024
1025
|
//#endregion
|
|
1026
|
+
//#region ../../packages/substrate-dataset-pg/src/migrate.d.ts
|
|
1027
|
+
/**
|
|
1028
|
+
* Public migration shape accepted by the runner. Either supply both
|
|
1029
|
+
* `txStatements` + (optional) `concurrentStatements`, OR a legacy
|
|
1030
|
+
* `statements` bucket — the runner treats `statements` as `txStatements`
|
|
1031
|
+
* with no concurrent statements. Mixing `statements` and `txStatements`
|
|
1032
|
+
* is a configuration error.
|
|
1033
|
+
*/
|
|
1034
|
+
type MigrationInput = {
|
|
1035
|
+
readonly version: string;
|
|
1036
|
+
readonly txStatements: ReadonlyArray<string>;
|
|
1037
|
+
readonly concurrentStatements?: ReadonlyArray<string>;
|
|
1038
|
+
readonly statements?: never;
|
|
1039
|
+
} | {
|
|
1040
|
+
readonly version: string;
|
|
1041
|
+
readonly statements: ReadonlyArray<string>;
|
|
1042
|
+
readonly txStatements?: never;
|
|
1043
|
+
readonly concurrentStatements?: never;
|
|
1044
|
+
};
|
|
1045
|
+
interface RunMigrationsOptions {
|
|
1046
|
+
/**
|
|
1047
|
+
* When true, drop the `migrations` tracking table before running.
|
|
1048
|
+
* Forces every migration to re-apply on this call. Intended for tests
|
|
1049
|
+
* that DROP schema objects between runs and need the framework to
|
|
1050
|
+
* recreate them; production paths should never set this.
|
|
1051
|
+
*/
|
|
1052
|
+
force?: boolean;
|
|
1053
|
+
/**
|
|
1054
|
+
* Override the `SUBSTRATE_ENFORCE_UUID_CHECK=true` env-var gate for the gated
|
|
1055
|
+
* UUID-format CHECK constraint migration (0002). Defaults to whatever the
|
|
1056
|
+
* env says. Tests that need to exercise the constrained path explicitly
|
|
1057
|
+
* pass `true`; tests that need to opt out of an env-set gate pass `false`.
|
|
1058
|
+
* Production bootstraps shouldn't pass this — let the env decide.
|
|
1059
|
+
*/
|
|
1060
|
+
enforceUuidCheck?: boolean;
|
|
1061
|
+
}
|
|
1062
|
+
export declare function runMigrations(sql: Sql, opts?: RunMigrationsOptions): Promise<void>;
|
|
1063
|
+
/**
|
|
1064
|
+
* One `field.list({ indexed: true })` or `field.json({ indexed: true })` field
|
|
1065
|
+
* that should be backed by a GIN over `(body -> field)`.
|
|
1066
|
+
*/
|
|
1067
|
+
interface IndexedListField {
|
|
1068
|
+
readonly namespace: string;
|
|
1069
|
+
readonly type: string;
|
|
1070
|
+
readonly field: string;
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* Derives the tracked, idempotent CONCURRENTLY GIN migration for one indexed
|
|
1074
|
+
* field. The version key uses the raw ns/type/field.
|
|
1075
|
+
*/
|
|
1076
|
+
export declare function deriveListIndexMigration(f: IndexedListField): MigrationInput;
|
|
1077
|
+
/**
|
|
1078
|
+
* Applies migrations derived from field definitions through the same tracked,
|
|
1079
|
+
* advisory-locked machinery as the static list. Called after plugins load,
|
|
1080
|
+
* since `runMigrations` has no field-def knowledge. Idempotent: applied
|
|
1081
|
+
* versions are skipped.
|
|
1082
|
+
*/
|
|
1083
|
+
export declare function runDerivedMigrations(sql: Sql, derived: ReadonlyArray<MigrationInput>): Promise<void>;
|
|
1084
|
+
//#endregion
|
|
1085
|
+
//#region ../../packages/substrate-dataset-pg/src/tx-scope.d.ts
|
|
1086
|
+
type PgHandle = Sql | TransactionSql;
|
|
1087
|
+
//#endregion
|
|
1088
|
+
//#region ../../packages/substrate-dataset-pg/src/pg-edges-store.d.ts
|
|
1089
|
+
interface PgEdgesStoreOptions {
|
|
1090
|
+
sql: Sql;
|
|
1091
|
+
/** Injected clock for tests. Defaults to `() => new Date()`. */
|
|
1092
|
+
now?: () => Date;
|
|
1093
|
+
/**
|
|
1094
|
+
* Per-statement batch size for chunked admin deletes. Defaults to
|
|
1095
|
+
* {@link DEFAULT_DROP_BATCH_SIZE}.
|
|
1096
|
+
*/
|
|
1097
|
+
dropBatchSize?: number;
|
|
1098
|
+
}
|
|
1099
|
+
interface InternalPgEdgesStoreOptions {
|
|
1100
|
+
sql: PgHandle;
|
|
1101
|
+
now: () => Date;
|
|
1102
|
+
inTx: boolean;
|
|
1103
|
+
/**
|
|
1104
|
+
* Tx-bound instances inherit their parent's txScopeId. The public
|
|
1105
|
+
* constructor derives it from the Sql reference.
|
|
1106
|
+
*/
|
|
1107
|
+
txScopeId?: string;
|
|
1108
|
+
dropBatchSize?: number;
|
|
1109
|
+
}
|
|
1110
|
+
export declare class PgEdgesStore implements EdgesStore {
|
|
1111
|
+
#private;
|
|
1112
|
+
readonly txScopeId: string;
|
|
1113
|
+
constructor(options: PgEdgesStoreOptions | InternalPgEdgesStoreOptions);
|
|
1114
|
+
write(input: EdgeWriteInput): Promise<Edge>;
|
|
1115
|
+
tombstone(id: string, at?: Date): Promise<void>;
|
|
1116
|
+
/**
|
|
1117
|
+
* Hard-deletes tombstoned edges whose `deleted_at` is older than
|
|
1118
|
+
* `olderThan`. Called by the sweep loop. Returns the number deleted.
|
|
1119
|
+
*/
|
|
1120
|
+
purgeTombstonedEdges(opts: {
|
|
1121
|
+
olderThan: Date;
|
|
1122
|
+
}): Promise<{
|
|
1123
|
+
deleted: number;
|
|
1124
|
+
}>;
|
|
1125
|
+
update(patch: EdgePatch): Promise<void>;
|
|
1126
|
+
readNextBatch(cursorId: string | null, size: number): Promise<{
|
|
1127
|
+
edges: Edge[];
|
|
1128
|
+
lastId: string | null;
|
|
1129
|
+
}>;
|
|
1130
|
+
findEdgesTo(ref: EdgeRef): Promise<Edge[]>;
|
|
1131
|
+
findEdgesToMany(refs: readonly EdgeRef[]): Promise<Edge[]>;
|
|
1132
|
+
findEdgesFrom(ref: EdgeRef): Promise<Edge[]>;
|
|
1133
|
+
findEdgesTouchingNamespace(namespace: string, limit: number): Promise<Edge[]>;
|
|
1134
|
+
findEdgesTouchingType(namespace: string, type: string, limit: number): Promise<Edge[]>;
|
|
1135
|
+
namespacesLinkedTo(namespace: string, type?: string): Promise<string[]>;
|
|
1136
|
+
/**
|
|
1137
|
+
* Chunked physical delete of every edge touching `namespace`, at most
|
|
1138
|
+
* `dropBatchSize` rows per statement, so a large delete does not hold every
|
|
1139
|
+
* row lock at once. Returns the number deleted.
|
|
1140
|
+
*
|
|
1141
|
+
* Outside a tx each batch auto-commits. Inside a caller's tx the batches
|
|
1142
|
+
* stay in it, so a throw still rolls back the whole drop.
|
|
1143
|
+
*/
|
|
1144
|
+
dropEdgesByNamespace(namespace: string, within?: readonly string[]): Promise<number>;
|
|
1145
|
+
/**
|
|
1146
|
+
* Chunked physical delete of every edge touching `(namespace, type)`.
|
|
1147
|
+
* See {@link dropEdgesByNamespace} for the lock-hold + tx semantics.
|
|
1148
|
+
*/
|
|
1149
|
+
dropEdgesByType(namespace: string, type: string, within?: readonly string[]): Promise<number>;
|
|
1150
|
+
canDelete(ref: EdgeRef): Promise<CanDeleteResult>;
|
|
1151
|
+
findBlocked(): Promise<Edge[]>;
|
|
1152
|
+
/**
|
|
1153
|
+
* `sql.begin`-backed atomicity. Same flattening pattern as PgDataset —
|
|
1154
|
+
* nested re-entry skips the inner begin and runs on the existing tx handle
|
|
1155
|
+
* so an inner throw propagates to the outer `sql.begin` for rollback.
|
|
1156
|
+
*/
|
|
1157
|
+
withTransaction<T>(fn: (tx: EdgesStore) => Promise<T>): Promise<T>;
|
|
1158
|
+
/**
|
|
1159
|
+
* Engine-only. Returns a tx-bound clone on the supplied `TransactionSql`,
|
|
1160
|
+
* for `PgDataset.withScopedTransaction`. The caller has verified
|
|
1161
|
+
* the txScopeIds match.
|
|
1162
|
+
*/
|
|
1163
|
+
_enlistInTx(txSql: PgHandle): PgEdgesStore;
|
|
1164
|
+
}
|
|
1165
|
+
//#endregion
|
|
1166
|
+
//#region ../../packages/substrate-dataset-pg/src/pg-sql/primitives.d.ts
|
|
1167
|
+
/**
|
|
1168
|
+
* A body key mirrored into a dedicated column on `rows`, so filters and
|
|
1169
|
+
* sorts on it hit an index instead of extracting from JSONB.
|
|
1170
|
+
*
|
|
1171
|
+
* `column` is a BARE column name, not a qualified `r.<col>` fragment: taking a
|
|
1172
|
+
* fragment from a caller would put caller text into `sql.unsafe`.
|
|
1173
|
+
*/
|
|
1174
|
+
interface PromotedBodyColumn {
|
|
1175
|
+
column: string;
|
|
1176
|
+
kind: 'boolean' | 'text';
|
|
1177
|
+
}
|
|
1178
|
+
type PromotedBodyColumnMap = Readonly<Record<string, PromotedBodyColumn>>;
|
|
1179
|
+
//#endregion
|
|
1180
|
+
//#region ../../packages/substrate-dataset-pg/src/pg-dataset.d.ts
|
|
1181
|
+
/**
|
|
1182
|
+
* Returns the declared FieldDef for a type's field, or undefined when unknown
|
|
1183
|
+
* (body-key sorts then fall back to text compare). Lets the SQL builders cast
|
|
1184
|
+
* body values by declared kind, so `count` sorts 2 before 10 — see
|
|
1185
|
+
* `resolveBodyOrderByCast`.
|
|
1186
|
+
*/
|
|
1187
|
+
type FieldDefLookup = (type: string, field: string) => FieldDef | undefined;
|
|
1188
|
+
interface PgDatasetOptions {
|
|
1189
|
+
namespace: string;
|
|
1190
|
+
sql: Sql;
|
|
1191
|
+
/**
|
|
1192
|
+
* Optional sibling `PgEdgesStore` to enlist into this dataset's substrate
|
|
1193
|
+
* transactions. When supplied, MUST share the same `Sql` pool (verified
|
|
1194
|
+
* via `txScopeId === txScopeIdFor(sql)`); the dataset throws on
|
|
1195
|
+
* construction otherwise.
|
|
1196
|
+
*
|
|
1197
|
+
* When supplied, `withScopedTransaction` yields a tx-bound edges store
|
|
1198
|
+
* on the same `TransactionSql` as the tx-bound datasets. When omitted, it
|
|
1199
|
+
* yields `edges: null` and the engine runs edge ops in a separate tx.
|
|
1200
|
+
*/
|
|
1201
|
+
edgesStore?: PgEdgesStore;
|
|
1202
|
+
/**
|
|
1203
|
+
* Optional field-def lookup so orderBy + cursor compares on body fields can
|
|
1204
|
+
* cast to the declared scalar pg type (numeric / timestamptz / boolean)
|
|
1205
|
+
* instead of falling back to lexicographic text compare. When omitted, every
|
|
1206
|
+
* body-key orderBy compares as text.
|
|
1207
|
+
*
|
|
1208
|
+
* A cast sort cannot use an index on the uncast `(body ->> 'field')`
|
|
1209
|
+
* expression; it needs a matching cast expression index.
|
|
1210
|
+
*/
|
|
1211
|
+
fieldDefLookup?: FieldDefLookup;
|
|
1212
|
+
/**
|
|
1213
|
+
* Body keys mirrored into dedicated columns on `rows`, so filters and
|
|
1214
|
+
* sorts on them use an index instead of extracting from JSONB.
|
|
1215
|
+
*
|
|
1216
|
+
* None by default. A namespace declares its own (`NamespaceDefinition`'s
|
|
1217
|
+
* `promotedColumns`), and the plugin that declares them adds the columns in
|
|
1218
|
+
* its kernel migrations: the engine creates none. Three things that bite:
|
|
1219
|
+
*
|
|
1220
|
+
* - Filters and sorts route to the column and ONLY the column, so a column
|
|
1221
|
+
* added over existing rows must be backfilled from the body first, or
|
|
1222
|
+
* those rows miss every filter. Reads return the body.
|
|
1223
|
+
* - `column` is a BARE name (`'severity'`, not `'r.severity'`) and is
|
|
1224
|
+
* validated as an identifier at construction, because it is interpolated
|
|
1225
|
+
* into SQL as an identifier.
|
|
1226
|
+
* - Text columns sort and range-compare `COLLATE "C"`, so an index meant
|
|
1227
|
+
* to serve those must be built `COLLATE "C"` too.
|
|
1228
|
+
*/
|
|
1229
|
+
promotedColumns?: PromotedBodyColumnMap;
|
|
1230
|
+
}
|
|
1231
|
+
interface InternalPgSubstrateDatasetOptions {
|
|
1232
|
+
namespace: string;
|
|
1233
|
+
sql: PgHandle;
|
|
1234
|
+
inTx: boolean;
|
|
1235
|
+
/**
|
|
1236
|
+
* Tx-bound instances reuse the root's txScopeId so one substrate never
|
|
1237
|
+
* advertises two ids. The public constructor derives it from the Sql.
|
|
1238
|
+
*/
|
|
1239
|
+
txScopeId?: string;
|
|
1240
|
+
edgesStore?: PgEdgesStore;
|
|
1241
|
+
fieldDefLookup?: FieldDefLookup;
|
|
1242
|
+
/** See `PgDatasetOptions.promotedColumns`. */
|
|
1243
|
+
promotedColumns?: PromotedBodyColumnMap;
|
|
1244
|
+
}
|
|
1245
|
+
export declare class PgDataset implements Dataset {
|
|
1246
|
+
#private;
|
|
1247
|
+
readonly namespace: string;
|
|
1248
|
+
readonly capabilities: FilterCapabilities;
|
|
1249
|
+
readonly txScopeId: string;
|
|
1250
|
+
constructor(options: PgDatasetOptions | InternalPgSubstrateDatasetOptions);
|
|
1251
|
+
/**
|
|
1252
|
+
* Reads rows of `type` per the §5.2 filter contract (where / orderBy /
|
|
1253
|
+
* cursor / limit). Every value is bound through a parameterised slot.
|
|
1254
|
+
*
|
|
1255
|
+
* Body values extract as text and are cast for comparison only; the filter
|
|
1256
|
+
* validator has already rejected type mismatches.
|
|
1257
|
+
*/
|
|
1258
|
+
read(type: string, params: ReadParams): Promise<ReadResult>;
|
|
1259
|
+
write(type: string, rows: Row[], options?: WriteOptions): Promise<WriteResult>;
|
|
1260
|
+
tombstone(type: string, ids: Id[]): Promise<DeleteResult>;
|
|
1261
|
+
purge(type: string, ids: Id[]): Promise<DeleteResult>;
|
|
1262
|
+
/**
|
|
1263
|
+
* Hard-deletes tombstoned rows whose `deleted_at` is older than `olderThan`,
|
|
1264
|
+
* across ALL namespaces (the table is substrate-shared). Called by the sweep
|
|
1265
|
+
* loop. Returns the number of rows deleted.
|
|
1266
|
+
*
|
|
1267
|
+
* Short-id mappings are left in place, as in `purge()`: a row id can
|
|
1268
|
+
* reappear after a tombstone + rewrite.
|
|
1269
|
+
*/
|
|
1270
|
+
purgeTombstonedRows(opts: {
|
|
1271
|
+
olderThan: Date;
|
|
1272
|
+
}): Promise<{
|
|
1273
|
+
deleted: number;
|
|
1274
|
+
}>;
|
|
1275
|
+
/**
|
|
1276
|
+
* Hard-delete every row for `type` in this namespace, including tombstoned
|
|
1277
|
+
* rows (`deleted_at IS NOT NULL`). Short-id mappings for that type are
|
|
1278
|
+
* removed in the same logical operation. Both deletes run through `this.#sql`
|
|
1279
|
+
* so they participate in any surrounding `withTransaction` boundary.
|
|
1280
|
+
*/
|
|
1281
|
+
dropType(type: string): Promise<DropResult>;
|
|
1282
|
+
/**
|
|
1283
|
+
* Hard-delete every row across all types in this namespace, including
|
|
1284
|
+
* tombstoned rows. Short-id mappings for all types are removed too.
|
|
1285
|
+
*/
|
|
1286
|
+
dropNamespace(): Promise<DropResult>;
|
|
1287
|
+
/**
|
|
1288
|
+
* Compare-and-update (spec §5.12): merges `updates` into the live row only
|
|
1289
|
+
* if every `match` field equals its expected value. Returns `matched` and
|
|
1290
|
+
* the updated row.
|
|
1291
|
+
*
|
|
1292
|
+
* One `UPDATE ... WHERE <pk> AND <match>`, so the row lock makes exactly one
|
|
1293
|
+
* of N concurrent callers match. `_deletedAt` and `id` are dropped from
|
|
1294
|
+
* `updates`.
|
|
1295
|
+
*/
|
|
1296
|
+
conditionalUpdate(type: string, id: Id, match: Record<string, unknown>, updates: Record<string, unknown>, actor?: ActorIdentity, now?: Date): Promise<ConditionalUpdateResult>;
|
|
1297
|
+
updateField(ref: UpdateFieldRef, fieldName: string, value: unknown): Promise<void>;
|
|
1298
|
+
/**
|
|
1299
|
+
* `sql.begin`-backed atomicity. Spec §5.3 / G1.
|
|
1300
|
+
*
|
|
1301
|
+
* Nested calls flatten: postgres.js's `begin` inside a `begin` would create
|
|
1302
|
+
* a savepoint (inner rolls back independently of outer), which is stricter
|
|
1303
|
+
* than the G1 contract promises. To match the memory impl — where an inner
|
|
1304
|
+
* throw tears down outer writes too — we detect the re-entry via `#inTx`
|
|
1305
|
+
* and skip the nested begin entirely. The inner throw then propagates to
|
|
1306
|
+
* the outer `sql.begin`, which rolls back the whole thing.
|
|
1307
|
+
*/
|
|
1308
|
+
withTransaction<T>(fn: (tx: Dataset) => Promise<T>): Promise<T>;
|
|
1309
|
+
/**
|
|
1310
|
+
* Runs `fn` in one pg transaction with a tx-bound dataset per requested
|
|
1311
|
+
* namespace (and the edges store, when wired), all on one `TransactionSql`.
|
|
1312
|
+
* A throw rolls back every namespace. Spec §5.3.
|
|
1313
|
+
*
|
|
1314
|
+
* Nested calls flatten onto the current transaction rather than opening a
|
|
1315
|
+
* savepoint.
|
|
1316
|
+
*/
|
|
1317
|
+
withScopedTransaction<T>(namespaces: ReadonlyArray<string>, fn: (handles: TxScopeHandles) => Promise<T>): Promise<T>;
|
|
1318
|
+
/**
|
|
1319
|
+
* See `Dataset.withAdvisoryLock`. Excludes every session on the
|
|
1320
|
+
* database, across processes. On a tx-bound instance the lock is
|
|
1321
|
+
* `pg_advisory_xact_lock` on the transaction's own connection, held until
|
|
1322
|
+
* it commits or rolls back: a session lock would need a second connection
|
|
1323
|
+
* beside the open transaction.
|
|
1324
|
+
*/
|
|
1325
|
+
withAdvisoryLock<T>(key: string, fn: () => Promise<T>): Promise<T>;
|
|
1326
|
+
allocateShortId(type: string): Promise<number>;
|
|
1327
|
+
bindShortId(type: string, shortId: number, rowId: string): Promise<void>;
|
|
1328
|
+
resolveShortId(type: string, shortId: number): Promise<string | null>;
|
|
1329
|
+
getShortIdForRow(type: string, rowId: string): Promise<number | null>;
|
|
1330
|
+
forNamespace(namespace: string): Dataset;
|
|
1331
|
+
private materialize;
|
|
1332
|
+
private extractOriginalId;
|
|
1333
|
+
}
|
|
1334
|
+
//#endregion
|
|
1025
1335
|
//#region ../../packages/substrate-dataset-pg/src/testing.d.ts
|
|
1026
1336
|
/**
|
|
1027
1337
|
* Safety rails for pg integration tests. Shared by every package whose suites
|
|
@@ -1242,4 +1552,4 @@ export declare class MemorySubstrateServer implements SubstrateServer {
|
|
|
1242
1552
|
*/
|
|
1243
1553
|
export declare function matchRoute(registered: string, actual: string): Record<string, string> | null;
|
|
1244
1554
|
//#endregion
|
|
1245
|
-
export type { AuthConfig, ComposeResult, MemoryWsClient };
|
|
1555
|
+
export type { AuthConfig, ComposeResult, FieldDefLookup, IndexedListField, MemoryWsClient, PgDatasetOptions, PgEdgesStoreOptions };
|
package/dist/testing.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
2
|
import { N as MemoryEdgesStore, P as loadPlugins, at as WS_REASON_SERVER_RESTART, c as MemoryDataset, rt as signHs256, s as compose } from "./src-CHp3QyqB.js";
|
|
3
|
+
import { a as runDerivedMigrations, o as runMigrations, r as deriveListIndexMigration, t as PgDataset } from "./src-CXKnqeTW.js";
|
|
4
|
+
import { t as PgEdgesStore } from "./pg-edges-store-DKPYyd8l.js";
|
|
3
5
|
import { t as FakeEmbedder } from "./fake-DUVtKVSE.js";
|
|
4
6
|
import { randomUUID } from "node:crypto";
|
|
5
7
|
import postgres from "postgres";
|
|
@@ -699,4 +701,4 @@ var MemorySubstrateServer = class {
|
|
|
699
701
|
};
|
|
700
702
|
|
|
701
703
|
//#endregion
|
|
702
|
-
export { AlreadyStartedError, FakeEmbedder, MemoryDataset, MemoryEdgesStore, MemorySubstrateServer, UnknownWsPathError, WsClosedError, announcePgGating, assertCannotWriteOutsideTestDatabases, assertNotSuperuser, assertTestDatabase, compose, createMemoryWsPair, interpretSuperuserProbe, loadPlugins, matchRoute, pgTestSchemaName, pgTestSchemaUrl, preparePgTestSchema, publicLeftoverWarning, reachFailureMessage, signHs256 };
|
|
704
|
+
export { AlreadyStartedError, FakeEmbedder, MemoryDataset, MemoryEdgesStore, MemorySubstrateServer, PgDataset, PgEdgesStore, UnknownWsPathError, WsClosedError, announcePgGating, assertCannotWriteOutsideTestDatabases, assertNotSuperuser, assertTestDatabase, compose, createMemoryWsPair, deriveListIndexMigration, interpretSuperuserProbe, loadPlugins, matchRoute, pgTestSchemaName, pgTestSchemaUrl, preparePgTestSchema, publicLeftoverWarning, reachFailureMessage, runDerivedMigrations, runMigrations, signHs256 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mnmal-ai/substrate",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.4",
|
|
4
4
|
"description": "Substrate — an agent-first typed-data server: the substrate and substrate-admin binaries, the built-in plugins and the SDK subpaths.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -36,24 +36,24 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@inquirer/prompts": "^8.7.2",
|
|
39
|
-
"@mnmal-ai/substrate-bootstrap": "1.0.0-alpha.
|
|
40
|
-
"@mnmal-ai/substrate-client": "1.0.0-alpha.
|
|
41
|
-
"@mnmal-ai/substrate-compose": "1.0.0-alpha.
|
|
42
|
-
"@mnmal-ai/substrate-config": "1.0.0-alpha.
|
|
43
|
-
"@mnmal-ai/substrate-core": "1.0.0-alpha.
|
|
44
|
-
"@mnmal-ai/substrate-dataset-memory": "1.0.0-alpha.
|
|
45
|
-
"@mnmal-ai/substrate-dataset-pg": "1.0.0-alpha.
|
|
46
|
-
"@mnmal-ai/substrate-embedder": "1.0.0-alpha.
|
|
47
|
-
"@mnmal-ai/substrate-filter": "1.0.0-alpha.
|
|
48
|
-
"@mnmal-ai/substrate-pack": "1.0.0-alpha.
|
|
49
|
-
"@mnmal-ai/substrate-policy": "1.0.0-alpha.
|
|
50
|
-
"@mnmal-ai/substrate-proposals": "1.0.0-alpha.
|
|
51
|
-
"@mnmal-ai/substrate-recall": "1.0.0-alpha.
|
|
52
|
-
"@mnmal-ai/substrate-sdk": "1.0.0-alpha.
|
|
53
|
-
"@mnmal-ai/substrate-sentinel-client": "1.0.0-alpha.
|
|
54
|
-
"@mnmal-ai/substrate-server-fastify": "1.0.0-alpha.
|
|
55
|
-
"@mnmal-ai/substrate-server-memory": "1.0.0-alpha.
|
|
56
|
-
"@mnmal-ai/substrate-types": "1.0.0-alpha.
|
|
39
|
+
"@mnmal-ai/substrate-bootstrap": "1.0.0-alpha.4",
|
|
40
|
+
"@mnmal-ai/substrate-client": "1.0.0-alpha.4",
|
|
41
|
+
"@mnmal-ai/substrate-compose": "1.0.0-alpha.4",
|
|
42
|
+
"@mnmal-ai/substrate-config": "1.0.0-alpha.4",
|
|
43
|
+
"@mnmal-ai/substrate-core": "1.0.0-alpha.4",
|
|
44
|
+
"@mnmal-ai/substrate-dataset-memory": "1.0.0-alpha.4",
|
|
45
|
+
"@mnmal-ai/substrate-dataset-pg": "1.0.0-alpha.4",
|
|
46
|
+
"@mnmal-ai/substrate-embedder": "1.0.0-alpha.4",
|
|
47
|
+
"@mnmal-ai/substrate-filter": "1.0.0-alpha.4",
|
|
48
|
+
"@mnmal-ai/substrate-pack": "1.0.0-alpha.4",
|
|
49
|
+
"@mnmal-ai/substrate-policy": "1.0.0-alpha.4",
|
|
50
|
+
"@mnmal-ai/substrate-proposals": "1.0.0-alpha.4",
|
|
51
|
+
"@mnmal-ai/substrate-recall": "1.0.0-alpha.4",
|
|
52
|
+
"@mnmal-ai/substrate-sdk": "1.0.0-alpha.4",
|
|
53
|
+
"@mnmal-ai/substrate-sentinel-client": "1.0.0-alpha.4",
|
|
54
|
+
"@mnmal-ai/substrate-server-fastify": "1.0.0-alpha.4",
|
|
55
|
+
"@mnmal-ai/substrate-server-memory": "1.0.0-alpha.4",
|
|
56
|
+
"@mnmal-ai/substrate-types": "1.0.0-alpha.4",
|
|
57
57
|
"@types/node": "^26.6.4",
|
|
58
58
|
"@types/semver": "^7.5.0",
|
|
59
59
|
"@types/ws": "^8.18.1",
|