@cavelang/cli 0.34.0 → 0.35.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 +2 -2
- package/dist/internal/automate/main.d.ts.map +1 -1
- package/dist/internal/automate/main.js +2 -0
- package/dist/internal/automate/main.js.map +1 -1
- package/dist/internal/connect/declared.d.ts +225 -0
- package/dist/internal/connect/declared.d.ts.map +1 -0
- package/dist/internal/connect/declared.js +521 -0
- package/dist/internal/connect/declared.js.map +1 -0
- package/dist/internal/connect/index.d.ts +4 -2
- package/dist/internal/connect/index.d.ts.map +1 -1
- package/dist/internal/connect/index.js +3 -1
- package/dist/internal/connect/index.js.map +1 -1
- package/dist/internal/connect/main.d.ts.map +1 -1
- package/dist/internal/connect/main.js +352 -10
- package/dist/internal/connect/main.js.map +1 -1
- package/dist/internal/connect/run.d.ts +47 -1
- package/dist/internal/connect/run.d.ts.map +1 -1
- package/dist/internal/connect/run.js +81 -33
- package/dist/internal/connect/run.js.map +1 -1
- package/dist/internal/connect/source.d.ts +33 -2
- package/dist/internal/connect/source.d.ts.map +1 -1
- package/dist/internal/connect/source.js +168 -8
- package/dist/internal/connect/source.js.map +1 -1
- package/dist/internal/connect/template.d.ts +18 -0
- package/dist/internal/connect/template.d.ts.map +1 -1
- package/dist/internal/connect/template.js +28 -0
- package/dist/internal/connect/template.js.map +1 -1
- package/dist/internal/ingest/main.d.ts.map +1 -1
- package/dist/internal/ingest/main.js +2 -1
- package/dist/internal/ingest/main.js.map +1 -1
- package/dist/internal/mcp/main.d.ts.map +1 -1
- package/dist/internal/mcp/main.js +2 -0
- package/dist/internal/mcp/main.js.map +1 -1
- package/dist/internal/rules/rule.d.ts.map +1 -1
- package/dist/internal/rules/rule.js +1 -22
- package/dist/internal/rules/rule.js.map +1 -1
- package/dist/internal/view/main.d.ts.map +1 -1
- package/dist/internal/view/main.js +2 -1
- package/dist/internal/view/main.js.map +1 -1
- package/dist/src/cli.d.ts +14 -0
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +161 -38
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands.d.ts +2 -2
- package/dist/src/commands.js +2 -2
- package/dist/src/commands.js.map +1 -1
- package/dist/src/dispatch.d.ts.map +1 -1
- package/dist/src/dispatch.js +7 -1
- package/dist/src/dispatch.js.map +1 -1
- package/dist/src/doctor.d.ts +1 -1
- package/dist/src/doctor.d.ts.map +1 -1
- package/dist/src/doctor.js +26 -1
- package/dist/src/doctor.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/package.json +19 -19
- package/src/cli.ts +187 -36
- package/src/commands.ts +2 -2
- package/src/dispatch.ts +7 -1
- package/src/doctor.ts +28 -2
- package/src/index.ts +1 -1
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declared sources (spec §23.4) — a `cave connect` invocation persisted
|
|
3
|
+
* in-band as ordinary attribute claims on a `source/<name>` entity:
|
|
4
|
+
*
|
|
5
|
+
* ```cave
|
|
6
|
+
* source/people HAS path: people.csv
|
|
7
|
+
* source/people HAS map: people.map.cave
|
|
8
|
+
* source/people HAS key: id
|
|
9
|
+
* source/verbs HAS path: verbs.cave ; a .cave file needs no map
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* The entity is the one §26.3 already uses for source policy, so
|
|
13
|
+
* `source/people HAS reliability: 80%` applies to what the source yields:
|
|
14
|
+
* declared sources stamp `@src:<name>/<key>` and keep their digests under
|
|
15
|
+
* `source/<name>/<key>` (`declaredNaming`), the stamp and the entity
|
|
16
|
+
* mirroring each other. Paths resolve against the store's directory — a
|
|
17
|
+
* store and its sources travel together — never the working directory.
|
|
18
|
+
*
|
|
19
|
+
* `assemble` follows every declared source of a store synchronously, which
|
|
20
|
+
* is what a CAVE text file used as `--db` needs (spec §13.7): the file and
|
|
21
|
+
* what it declares are one store. `cave connect` with no source runs the
|
|
22
|
+
* same declarations against a SQLite store, URLs included.
|
|
23
|
+
*/
|
|
24
|
+
import { existsSync, mkdtempSync, readFileSync, rmSync } from 'node:fs';
|
|
25
|
+
import { tmpdir } from 'node:os';
|
|
26
|
+
import { dirname, extname, join, resolve } from 'node:path';
|
|
27
|
+
import { LocateError, open } from '@cavelang/store';
|
|
28
|
+
import * as Source from "./source.js";
|
|
29
|
+
import * as Template from "./template.js";
|
|
30
|
+
import { bookkeepingKey, connect, currentDigestsUnder, currentRowsUnder, declaredNaming, digestOf, hasDigest, provenanceContext, retireRun } from "./run.js";
|
|
31
|
+
/** Entity prefix of source declarations and policy (spec §26.3). */
|
|
32
|
+
export const prefix = 'source/';
|
|
33
|
+
/** The declaration attributes, one per `cave connect` option. */
|
|
34
|
+
export const attributes = ['path', 'map', 'key', 'format', 'delimiter', 'table', 'sql', 'records'];
|
|
35
|
+
const isAttribute = (name) => attributes.includes(name);
|
|
36
|
+
/**
|
|
37
|
+
* The current, positive `source/…` attribute rows — declarations, policy,
|
|
38
|
+
* and bookkeeping — read with one indexed range query rather than a scan
|
|
39
|
+
* of every belief, since discovery reads them after every source.
|
|
40
|
+
*/
|
|
41
|
+
const sourceRows = (store) => currentRowsUnder(store, prefix).filter(row => row.verb === 'HAS' && row.conf > 0 && row.negated === 0);
|
|
42
|
+
/**
|
|
43
|
+
* A stored attribute value as declared: the store keeps a literal's
|
|
44
|
+
* delimiters (`"SELECT …"`, `` `?name IS person, …` ``), and a path, a
|
|
45
|
+
* query, or an inline mapping is the text inside them.
|
|
46
|
+
*/
|
|
47
|
+
export const unwrap = (value) => (value.startsWith('"') && value.endsWith('"') && value.length >= 2) ||
|
|
48
|
+
(value.startsWith('`') && value.endsWith('`') && value.length >= 2) ?
|
|
49
|
+
value.slice(1, -1) :
|
|
50
|
+
value;
|
|
51
|
+
/** Every `source/<name>` attribute claim current in the store, grouped by source — complete or not. */
|
|
52
|
+
export const deltasOf = (store) => {
|
|
53
|
+
// Several belief series may speak about one attribute (the root file
|
|
54
|
+
// and a followed source stamp differently): the newest current claim
|
|
55
|
+
// wins, so what was asserted last is what runs.
|
|
56
|
+
const byName = new Map();
|
|
57
|
+
for (const row of sourceRows(store)) {
|
|
58
|
+
if (row.attribute === null || row.value_text === null || !isAttribute(row.attribute)) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const name = row.subject.slice(prefix.length);
|
|
62
|
+
if (name === '') {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const fields = byName.get(name) ?? {};
|
|
66
|
+
const seen = fields[row.attribute];
|
|
67
|
+
if (seen === undefined || seen.tx < row.tx) {
|
|
68
|
+
fields[row.attribute] = { value: unwrap(row.value_text), tx: row.tx };
|
|
69
|
+
}
|
|
70
|
+
byName.set(name, fields);
|
|
71
|
+
}
|
|
72
|
+
return [...byName]
|
|
73
|
+
.map(([name, fields]) => ({
|
|
74
|
+
name,
|
|
75
|
+
fields: Object.fromEntries(Object.entries(fields).map(([attribute, entry]) => [attribute, entry.value]))
|
|
76
|
+
}))
|
|
77
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
78
|
+
};
|
|
79
|
+
/** A delta applied over a known declaration; a source without a `path` is not declared. */
|
|
80
|
+
export const merge = (known, delta) => {
|
|
81
|
+
const fields = { ...known === undefined ? {} : known, ...delta.fields, name: delta.name };
|
|
82
|
+
return fields.path === undefined ? undefined : fields;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* The store's declared sources: every `source/<name>` whose current belief
|
|
86
|
+
* carries a positive `path`, with the other declaration attributes that
|
|
87
|
+
* are current alongside it. Retracting the `path` (`… @ 0%`) removes the
|
|
88
|
+
* source; superseding it moves it.
|
|
89
|
+
*/
|
|
90
|
+
export const declaredSources = (store) => deltasOf(store).flatMap(delta => {
|
|
91
|
+
const declared = merge(undefined, delta);
|
|
92
|
+
return declared === undefined ? [] : [declared];
|
|
93
|
+
});
|
|
94
|
+
/**
|
|
95
|
+
* The sources a CAVE text declares, read without touching any store: the
|
|
96
|
+
* text is replayed into a scratch in-memory store. This is how an overlay
|
|
97
|
+
* or a dry run discovers what a followed `.cave` source declares in turn,
|
|
98
|
+
* before anything is appended.
|
|
99
|
+
*/
|
|
100
|
+
export const declaredIn = (text) => declarationsIn(text).flatMap(delta => {
|
|
101
|
+
const declared = merge(undefined, delta);
|
|
102
|
+
return declared === undefined ? [] : [declared];
|
|
103
|
+
});
|
|
104
|
+
/**
|
|
105
|
+
* Every source declaration attribute a CAVE text carries, complete or
|
|
106
|
+
* partial: a followed `.cave` source may change just the map or key of a
|
|
107
|
+
* source the store already declares, and that delta must reach whatever
|
|
108
|
+
* reads declarations without appending (`discover`, `--name`).
|
|
109
|
+
*/
|
|
110
|
+
export const declarationsIn = (text) => {
|
|
111
|
+
const scratch = open();
|
|
112
|
+
try {
|
|
113
|
+
scratch.ingest(text);
|
|
114
|
+
return deltasOf(scratch);
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
scratch.close();
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
/** Where a declared path points: URLs as they are, files against the store's directory. */
|
|
121
|
+
export const resolvePath = (path, dir) => Source.isUrl(path) ? path : resolve(dir, path);
|
|
122
|
+
/** A mapping-free CAVE text source: the file is its own template (all prelude). */
|
|
123
|
+
export const isCave = (declared) => declared.format === 'cave' || (declared.format === undefined && extname(declared.path).toLowerCase() === '.cave');
|
|
124
|
+
/**
|
|
125
|
+
* A value as a POSIX shell argument: bare when it is only word characters
|
|
126
|
+
* and path punctuation, otherwise double-quoted with the four characters
|
|
127
|
+
* a double-quoted shell word still interprets (`"`, `\\`, `$`, `` ` ``)
|
|
128
|
+
* escaped — so a listed invocation pastes back whatever the path or SQL
|
|
129
|
+
* carries.
|
|
130
|
+
*/
|
|
131
|
+
const argument = (value) => /^[A-Za-z0-9_./:@%+=,-]+$/.test(value) ? value : `"${value.replace(/["\\$`]/g, char => `\\${char}`)}"`;
|
|
132
|
+
/** The declaration as the equivalent `cave connect` invocation, for listings. */
|
|
133
|
+
export const describe = (declared) => {
|
|
134
|
+
const parts = [argument(declared.path)];
|
|
135
|
+
for (const attribute of attributes) {
|
|
136
|
+
if (attribute === 'path')
|
|
137
|
+
continue;
|
|
138
|
+
const value = declared[attribute];
|
|
139
|
+
if (value !== undefined) {
|
|
140
|
+
parts.push(`--${attribute} ${argument(value)}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return `${declared.name}: ${parts.join(' ')}`;
|
|
144
|
+
};
|
|
145
|
+
/** The store directory a root path implies: the file's directory, or the working directory for `:memory:`. */
|
|
146
|
+
export const directoryOf = (root) => root === ':memory:' || root === '' ? process.cwd() : dirname(resolve(root));
|
|
147
|
+
const sourceOptions = (declared, fetchImpl) => ({
|
|
148
|
+
...declared.format === undefined || declared.format === 'cave' ? {} : { format: declared.format },
|
|
149
|
+
...declared.delimiter === undefined ? {} : { delimiter: declared.delimiter },
|
|
150
|
+
...declared.table === undefined ? {} : { table: declared.table },
|
|
151
|
+
...declared.sql === undefined ? {} : { sql: declared.sql },
|
|
152
|
+
...declared.records === undefined ? {} : { records: declared.records },
|
|
153
|
+
...fetchImpl === undefined ? {} : { fetchImpl }
|
|
154
|
+
});
|
|
155
|
+
/** The declaration's content, for change detection between passes of one run. */
|
|
156
|
+
export const signature = (declared) => JSON.stringify(attributes.map(attribute => declared[attribute] ?? null));
|
|
157
|
+
/** Bookkeeping attribute recording which declaration a source was last run under. */
|
|
158
|
+
export const declarationAttribute = 'connect-declaration';
|
|
159
|
+
/** Digest of a declaration — what a run records, and what `followed` compares. */
|
|
160
|
+
export const declarationDigest = (declared) => digestOf(signature(declared));
|
|
161
|
+
/**
|
|
162
|
+
* @returns `true` when the store followed the source under exactly this
|
|
163
|
+
* declaration: every run records the declaration's digest on the source
|
|
164
|
+
* entity (`source/<name> HAS connect-declaration: …`), so a source
|
|
165
|
+
* re-declared since — a local file that became a URL, say — is not
|
|
166
|
+
* followed, whatever digests its earlier version left behind.
|
|
167
|
+
*/
|
|
168
|
+
export const followed = (store, declared) => recordedDeclaration(store, declared.name) === declarationDigest(declared);
|
|
169
|
+
/** A selection and everything it owns, transitively — what a named watch must watch. */
|
|
170
|
+
export const closure = (store, names) => {
|
|
171
|
+
const owners = ownership(store);
|
|
172
|
+
const selected = new Set(names);
|
|
173
|
+
const queue = [...names];
|
|
174
|
+
for (let owner = queue.shift(); owner !== undefined; owner = queue.shift()) {
|
|
175
|
+
for (const name of owners.get(owner) ?? []) {
|
|
176
|
+
if (!selected.has(name)) {
|
|
177
|
+
selected.add(name);
|
|
178
|
+
queue.push(name);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return declaredSources(store).filter(declared => selected.has(declared.name));
|
|
183
|
+
};
|
|
184
|
+
const validate = (declared) => {
|
|
185
|
+
if (declared.name.includes('/')) {
|
|
186
|
+
// `source/team/admin` is also record `admin` of source `team`: the
|
|
187
|
+
// digest entity and the stamp would collide (spec §23.4).
|
|
188
|
+
throw new Error(`source names are one path segment — source/${declared.name} would collide with record ${JSON.stringify(declared.name.split('/').slice(1).join('/'))} of source/${declared.name.split('/')[0]}`);
|
|
189
|
+
}
|
|
190
|
+
if (declared.format !== undefined && declared.format !== 'cave' && !Source.formats.includes(declared.format)) {
|
|
191
|
+
throw new Error(`unknown format ${JSON.stringify(declared.format)} — one of ${[...Source.formats, 'cave'].join(', ')}`);
|
|
192
|
+
}
|
|
193
|
+
if (declared.delimiter !== undefined && declared.delimiter.length !== 1) {
|
|
194
|
+
throw new Error('delimiter must be a single character');
|
|
195
|
+
}
|
|
196
|
+
if (!isCave(declared) && declared.map === undefined) {
|
|
197
|
+
throw new Error('a map is required — declare `HAS map: <template.cave>` (a .cave source needs none)');
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
const parseTemplate = (text, label) => {
|
|
201
|
+
const { mapping, problems } = Template.parse(text);
|
|
202
|
+
if (mapping === undefined) {
|
|
203
|
+
throw new Error(`${label}:\n${problems.map(problem => ` ${problem}`).join('\n')}`);
|
|
204
|
+
}
|
|
205
|
+
return mapping;
|
|
206
|
+
};
|
|
207
|
+
const urlRefused = (source) => new Error(`${source}: URL sources are followed by cave connect, not when assembling a text store`);
|
|
208
|
+
const prepared = (declared, dir, mapping, loaded) => ({
|
|
209
|
+
declared,
|
|
210
|
+
mapping,
|
|
211
|
+
records: loaded?.records ?? [],
|
|
212
|
+
...loaded?.spans === undefined ? {} : { spans: loaded.spans },
|
|
213
|
+
...loaded === undefined ? {} : { source: declared.path },
|
|
214
|
+
cave: loaded === undefined
|
|
215
|
+
});
|
|
216
|
+
const caveLabel = 'the .cave source does not parse';
|
|
217
|
+
/** The mapping template: the declared map file, or the `.cave` source itself. */
|
|
218
|
+
const mappingSync = (declared, dir) => {
|
|
219
|
+
validate(declared);
|
|
220
|
+
if (isCave(declared)) {
|
|
221
|
+
if (Source.isUrl(declared.path)) {
|
|
222
|
+
throw urlRefused(declared.path);
|
|
223
|
+
}
|
|
224
|
+
return { mapping: parseTemplate(readFileSync(resolvePath(declared.path, dir), 'utf8'), caveLabel), cave: true };
|
|
225
|
+
}
|
|
226
|
+
// A file that exists is the mapping, whatever its name looks like; only
|
|
227
|
+
// otherwise is the text read as an inline template.
|
|
228
|
+
const mapPath = resolvePath(declared.map, dir);
|
|
229
|
+
return !existsSync(mapPath) && Template.isInline(declared.map) ?
|
|
230
|
+
{ mapping: parseTemplate(Template.inlineDocument(declared.map), 'inline mapping'), cave: false } :
|
|
231
|
+
{ mapping: parseTemplate(readFileSync(mapPath, 'utf8'), `mapping ${declared.map}`), cave: false };
|
|
232
|
+
};
|
|
233
|
+
const mappingAsync = async (declared, dir, fetchImpl) => {
|
|
234
|
+
if (isCave(declared) && Source.isUrl(declared.path)) {
|
|
235
|
+
validate(declared);
|
|
236
|
+
const { text } = await Source.fetchText(declared.path, sourceOptions(declared, fetchImpl));
|
|
237
|
+
return { mapping: parseTemplate(text, caveLabel), cave: true };
|
|
238
|
+
}
|
|
239
|
+
return mappingSync(declared, dir);
|
|
240
|
+
};
|
|
241
|
+
/** Loads a declared source synchronously — local files only (`assemble`); a URL is refused. */
|
|
242
|
+
export const prepareSync = (declared, dir) => {
|
|
243
|
+
if (Source.isUrl(declared.path)) {
|
|
244
|
+
throw urlRefused(declared.path);
|
|
245
|
+
}
|
|
246
|
+
const { mapping, cave } = mappingSync(declared, dir);
|
|
247
|
+
return prepared(declared, dir, mapping, cave ? undefined : Source.loadSync(resolvePath(declared.path, dir), sourceOptions(declared)));
|
|
248
|
+
};
|
|
249
|
+
/** Loads a declared source, URLs included — a `.cave` URL is fetched and parsed as the template (`cave connect`). */
|
|
250
|
+
export const prepare = async (declared, dir, fetchImpl) => {
|
|
251
|
+
const { mapping, cave } = await mappingAsync(declared, dir, fetchImpl);
|
|
252
|
+
return prepared(declared, dir, mapping, cave ? undefined : await Source.load(resolvePath(declared.path, dir), sourceOptions(declared, fetchImpl)));
|
|
253
|
+
};
|
|
254
|
+
/** How often one source may be re-declared within a pass before it is a cycle, not convergence. */
|
|
255
|
+
const redeclarationLimit = 20;
|
|
256
|
+
const noFixedPoint = (name) => `source/${name} keeps being re-declared — no fixed point after ${redeclarationLimit} re-declarations`;
|
|
257
|
+
/** Counts a source's declaration versions within one pass and refuses a cycle. */
|
|
258
|
+
export const versionCounter = () => {
|
|
259
|
+
const versions = new Map();
|
|
260
|
+
return name => {
|
|
261
|
+
const count = (versions.get(name) ?? 0) + 1;
|
|
262
|
+
versions.set(name, count);
|
|
263
|
+
if (count > redeclarationLimit) {
|
|
264
|
+
throw new Error(noFixedPoint(name));
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* Loads every declared source of the store without leaving anything in
|
|
270
|
+
* it, URLs included, and returns the exact sequence a pass would run —
|
|
271
|
+
* a source re-declared along the way appears again, later. Nothing is
|
|
272
|
+
* simulated: the sources run through the real pass against a private
|
|
273
|
+
* snapshot of the store, each exactly once as it is discovered, and the
|
|
274
|
+
* declarations are read from that copy as they stand after each run; so
|
|
275
|
+
* precedence, deltas, retractions, and what an unchanged source skips
|
|
276
|
+
* come out exactly as in the pass, and the real database holds no lock
|
|
277
|
+
* while sources load. `force` replays every text (the overlay applies
|
|
278
|
+
* everything it loads); `prune` retracts what vanished records declared.
|
|
279
|
+
*/
|
|
280
|
+
export const discover = async (origin, root, options = {}) => (await discovery(origin, root, options)).sequence;
|
|
281
|
+
/**
|
|
282
|
+
* The declaration state an overlay depends on: the current row of every
|
|
283
|
+
* `source/…` claim key — effective declarations, shadowed series, partial
|
|
284
|
+
* deltas, bookkeeping, and the provenance ownership follows — keyed by
|
|
285
|
+
* claim key. Any change a writer makes to those inputs, even one that
|
|
286
|
+
* leaves every effective declaration and owner the same, changes it.
|
|
287
|
+
*/
|
|
288
|
+
export const declarationState = (store) => new Map(currentRowsUnder(store, prefix).map(row => [row.claim_key, row.id]));
|
|
289
|
+
/** Whether two declaration snapshots agree, name by name. */
|
|
290
|
+
export const sameDeclarations = (a, b) => a.size === b.size && [...a].every(([name, signature]) => b.get(name) === signature);
|
|
291
|
+
/** How many times an overlay rediscovers when the declarations changed underneath it. */
|
|
292
|
+
export const overlayAttempts = 3;
|
|
293
|
+
export const staleOverlay = () => new Error(`the declared sources changed while the overlay loaded them, ${overlayAttempts} times over — retry when the store is quiet`);
|
|
294
|
+
/** `discover`, also returning the declarations the snapshot started from. */
|
|
295
|
+
export const discovery = async (origin, root, options = {}) => {
|
|
296
|
+
const dir = directoryOf(root);
|
|
297
|
+
// Everything runs against a private snapshot of the store: the real
|
|
298
|
+
// database holds no lock while sources load (a URL may take a minute),
|
|
299
|
+
// and the copy is simply discarded. The baseline and the selection come
|
|
300
|
+
// from that same snapshot, so they agree with each other.
|
|
301
|
+
const { store, dispose } = snapshot(origin);
|
|
302
|
+
try {
|
|
303
|
+
const baseline = declarationState(store);
|
|
304
|
+
const names = declaredSources(store).map(declared => declared.name);
|
|
305
|
+
if (options.only !== undefined && !names.includes(options.only)) {
|
|
306
|
+
throw new Error(`no declared source/${options.only}` +
|
|
307
|
+
(names.length === 0 ? ' — the store declares no sources' : ` — declared: ${names.join(', ')}`));
|
|
308
|
+
}
|
|
309
|
+
// The selection starts as the named source and everything it already
|
|
310
|
+
// owns, so a parent that fails to load does not hide its descendants.
|
|
311
|
+
const allowed = options.only === undefined ? undefined : new Set(closure(store, [options.only]).map(declared => declared.name));
|
|
312
|
+
const sequence = [];
|
|
313
|
+
const done = new Map();
|
|
314
|
+
const version = versionCounter();
|
|
315
|
+
let seen = signatures(declaredSources(store));
|
|
316
|
+
for (;;) {
|
|
317
|
+
const current = declaredSources(store);
|
|
318
|
+
// A selection grows by what the replayed sources changed — added,
|
|
319
|
+
// re-declared, or retracted declarations alike; what they own is
|
|
320
|
+
// added as each one runs, below.
|
|
321
|
+
if (allowed !== undefined) {
|
|
322
|
+
for (const name of changedNames(seen, signatures(current)))
|
|
323
|
+
allowed.add(name);
|
|
324
|
+
}
|
|
325
|
+
seen = signatures(current);
|
|
326
|
+
const next = current.find(declared => (allowed === undefined || allowed.has(declared.name)) && done.get(declared.name) !== signature(declared));
|
|
327
|
+
if (next === undefined) {
|
|
328
|
+
return { sequence, baseline };
|
|
329
|
+
}
|
|
330
|
+
version(next.name);
|
|
331
|
+
done.set(next.name, signature(next));
|
|
332
|
+
// The name rule holds for every declaration, skipped ones included.
|
|
333
|
+
validate(next);
|
|
334
|
+
// Followed means followed under this very declaration: a version a
|
|
335
|
+
// replayed source produced, or one assembly replaced, is new. A source
|
|
336
|
+
// already loaded in this discovery is never skipped again — a
|
|
337
|
+
// declaration that went away and came back must run again, after the
|
|
338
|
+
// intervening version.
|
|
339
|
+
if (options.skipFollowed === true && !sequence.some(ready => ready.declared.name === next.name) && followed(store, next)) {
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
const loaded = await prepare(next, dir, options.fetchImpl);
|
|
343
|
+
sequence.push(loaded);
|
|
344
|
+
run(store, loaded, { force: options.force === true, prune: options.prune === true });
|
|
345
|
+
if (allowed !== undefined) {
|
|
346
|
+
// Ownership only changes when a source runs: one pass for this one.
|
|
347
|
+
for (const name of ownedDeclarations(store, loaded.declared.name))
|
|
348
|
+
allowed.add(name);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
finally {
|
|
353
|
+
dispose();
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
/** A private, disposable copy of a store — an exact snapshot in a temporary file, opened writable. */
|
|
357
|
+
const snapshot = (origin) => {
|
|
358
|
+
const capability = origin.adapter.capabilities.backup;
|
|
359
|
+
if (capability === undefined) {
|
|
360
|
+
throw new Error(`cave connect: SQLite adapter ${JSON.stringify(origin.adapter.name)} cannot snapshot a store for discovery`);
|
|
361
|
+
}
|
|
362
|
+
const dir = mkdtempSync(join(tmpdir(), 'cave-discover-'));
|
|
363
|
+
const path = join(dir, 'snapshot.db');
|
|
364
|
+
try {
|
|
365
|
+
capability.write(origin.db, path);
|
|
366
|
+
const store = open(path, { registry: origin.baseRegistry(), access: 'no-migrate' });
|
|
367
|
+
return {
|
|
368
|
+
store,
|
|
369
|
+
dispose: () => {
|
|
370
|
+
store.close();
|
|
371
|
+
rmSync(dir, { recursive: true, force: true });
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
catch (error) {
|
|
376
|
+
// A failed copy must not leave a database-sized directory behind.
|
|
377
|
+
rmSync(dir, { recursive: true, force: true });
|
|
378
|
+
throw error;
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* Names of the sources whose current declaration claims a followed source
|
|
383
|
+
* owns — appended under its run — so a selection keeps a source's
|
|
384
|
+
* descendants even when its run changed nothing.
|
|
385
|
+
*/
|
|
386
|
+
export const ownedDeclarations = (store, owner) => [...ownership(store).get(owner) ?? []].sort();
|
|
387
|
+
/**
|
|
388
|
+
* Who owns which declarations, in one pass over the current declaration
|
|
389
|
+
* rows: the prelude runs as `<owner>`, a record as `<owner>/<key>`, so a
|
|
390
|
+
* mapping that emits declarations per record owns them through its
|
|
391
|
+
* records.
|
|
392
|
+
*/
|
|
393
|
+
export const ownership = (store) => {
|
|
394
|
+
const owners = new Map();
|
|
395
|
+
for (const row of sourceRows(store)) {
|
|
396
|
+
if (row.attribute === null || !isAttribute(row.attribute)) {
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
for (const run of store.provenanceOf(row)?.runs ?? []) {
|
|
400
|
+
const owner = run.split('/')[0];
|
|
401
|
+
const owned = owners.get(owner) ?? new Set();
|
|
402
|
+
owned.add(row.subject.slice(prefix.length));
|
|
403
|
+
owners.set(owner, owned);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return owners;
|
|
407
|
+
};
|
|
408
|
+
/** Declaration signatures by name. */
|
|
409
|
+
export const signatures = (declared) => new Map(declared.map(entry => [entry.name, signature(entry)]));
|
|
410
|
+
/** Names whose declaration was added, changed, or removed between two snapshots. */
|
|
411
|
+
export const changedNames = (before, after) => [...new Set([...before.keys(), ...after.keys()])].filter(name => before.get(name) !== after.get(name));
|
|
412
|
+
/** The digest of the declaration a source was last run under, if any. */
|
|
413
|
+
export const recordedDeclaration = (store, name) => {
|
|
414
|
+
// The connector's own series, by exact claim key: an authored claim with
|
|
415
|
+
// the same attribute, or one a source emitted, is another series.
|
|
416
|
+
const row = store.currentBelief(bookkeepingKey(`${prefix}${name}`, declarationAttribute));
|
|
417
|
+
return row !== undefined && row.conf > 0 && row.negated === 0 ? row.value_text ?? undefined : undefined;
|
|
418
|
+
};
|
|
419
|
+
/** @returns `true` when any digest bookkeeping exists for the source — its prelude's or a record's — read by range, not by scanning history. */
|
|
420
|
+
const hasAnyDigest = (store, name) => {
|
|
421
|
+
const naming = declaredNaming(name);
|
|
422
|
+
return hasDigest(store, naming.unit()) || currentDigestsUnder(store, naming.recordPrefix).length > 0;
|
|
423
|
+
};
|
|
424
|
+
/**
|
|
425
|
+
* One pass of a prepared declared source under `declaredNaming` (spec
|
|
426
|
+
* §23.4), recording the declaration it ran under. A source whose
|
|
427
|
+
* declaration changed since its last run — another path, key, query, or
|
|
428
|
+
* record selector — prunes as it runs: records the new version does not
|
|
429
|
+
* produce are retired, since the per-record diff never visits them. A
|
|
430
|
+
* source that was followed without a recorded declaration (digests, no
|
|
431
|
+
* marker) is treated as changed, conservatively.
|
|
432
|
+
*/
|
|
433
|
+
export const run = (store, ready, options = {}) =>
|
|
434
|
+
// One transaction: a transition that retires the former unit and then
|
|
435
|
+
// fails to ingest its replacement (a prelude the registry refuses, say)
|
|
436
|
+
// rolls the retirement back, keeping the last good data.
|
|
437
|
+
store.transaction(() => {
|
|
438
|
+
const previous = recordedDeclaration(store, ready.declared.name);
|
|
439
|
+
const transition = previous === undefined ?
|
|
440
|
+
hasAnyDigest(store, ready.declared.name) :
|
|
441
|
+
previous !== declarationDigest(ready.declared);
|
|
442
|
+
// A .cave source that became a record source: its prelude unit is no
|
|
443
|
+
// longer a lifecycle unit the pass would diff, so it is retired whole —
|
|
444
|
+
// and the pass below runs forced, since the old prelude digest would
|
|
445
|
+
// otherwise pass a same-text prelude off as unchanged.
|
|
446
|
+
const retired = transition && !ready.cave ? retireRun(store, declaredNaming(ready.declared.name).run()) : 0;
|
|
447
|
+
const passed = connect(store, ready.mapping, ready.records, {
|
|
448
|
+
name: ready.declared.name,
|
|
449
|
+
naming: declaredNaming(ready.declared.name),
|
|
450
|
+
// A .cave source is data that changes: claims it no longer yields retract.
|
|
451
|
+
preludeLifecycle: ready.cave,
|
|
452
|
+
...ready.source === undefined ? {} : { source: ready.source },
|
|
453
|
+
...ready.spans === undefined ? {} : { spans: ready.spans },
|
|
454
|
+
...ready.declared.key === undefined ? {} : { key: ready.declared.key },
|
|
455
|
+
force: options.force === true || transition,
|
|
456
|
+
prune: options.prune === true || transition
|
|
457
|
+
});
|
|
458
|
+
const report = retired === 0 ? passed : { ...passed, retracted: passed.retracted + retired };
|
|
459
|
+
if (!followed(store, ready.declared)) {
|
|
460
|
+
store.ingest(`${prefix}${ready.declared.name} HAS ${declarationAttribute}: ${declarationDigest(ready.declared)} @${provenanceContext}`);
|
|
461
|
+
}
|
|
462
|
+
return report;
|
|
463
|
+
});
|
|
464
|
+
/**
|
|
465
|
+
* Follows every declared source of the store, the ones the followed
|
|
466
|
+
* sources declare in turn included, until none is left. `root` is the
|
|
467
|
+
* store's own file (or `:memory:`): paths resolve against its directory
|
|
468
|
+
* and the root file itself is never re-read as a source, so a file that
|
|
469
|
+
* declares itself, directly or through a cycle, is loaded exactly once —
|
|
470
|
+
* one file under several names, with different mappings say, is followed
|
|
471
|
+
* under each. URL sources are skipped, not errors: fetching cannot be
|
|
472
|
+
* synchronous, and `cave connect` follows them. Other failures are
|
|
473
|
+
* `LocateError`s — the store is incomplete without its sources, exactly
|
|
474
|
+
* as with a text file that does not parse.
|
|
475
|
+
*/
|
|
476
|
+
export const assemble = (store, root, options = {}) => {
|
|
477
|
+
const dir = directoryOf(root);
|
|
478
|
+
const done = new Map();
|
|
479
|
+
const self = root === ':memory:' || root === '' ? undefined : resolve(root);
|
|
480
|
+
const assembled = [];
|
|
481
|
+
const version = versionCounter();
|
|
482
|
+
// Declarations are re-read after every followed source: a .cave source
|
|
483
|
+
// may declare a source the root does not, or re-declare one the root
|
|
484
|
+
// does (a newer path, say) — the current declaration is what runs, and a
|
|
485
|
+
// source whose declaration changed runs again, its earlier claims
|
|
486
|
+
// retracted by the ordinary diff-on-change.
|
|
487
|
+
for (;;) {
|
|
488
|
+
const next = declaredSources(store).find(declared => done.get(declared.name) !== signature(declared));
|
|
489
|
+
if (next === undefined) {
|
|
490
|
+
return assembled;
|
|
491
|
+
}
|
|
492
|
+
try {
|
|
493
|
+
version(next.name);
|
|
494
|
+
}
|
|
495
|
+
catch (error) {
|
|
496
|
+
throw new LocateError(error instanceof Error ? error.message : String(error));
|
|
497
|
+
}
|
|
498
|
+
done.set(next.name, signature(next));
|
|
499
|
+
try {
|
|
500
|
+
// The name rule holds for every declaration, skipped ones included.
|
|
501
|
+
validate(next);
|
|
502
|
+
}
|
|
503
|
+
catch (error) {
|
|
504
|
+
throw new LocateError(`${prefix}${next.name} (${next.path}): ${error instanceof Error ? error.message : String(error)}`);
|
|
505
|
+
}
|
|
506
|
+
if (Source.isUrl(next.path) || resolvePath(next.path, dir) === self) {
|
|
507
|
+
continue;
|
|
508
|
+
}
|
|
509
|
+
try {
|
|
510
|
+
const report = run(store, prepareSync(next, dir), { force: options.force === true });
|
|
511
|
+
if (report.failures.length > 0) {
|
|
512
|
+
throw new Error(report.failures.map(failure => `${failure.record}: ${failure.problems.join('; ')}`).join('\n'));
|
|
513
|
+
}
|
|
514
|
+
assembled.push({ declared: next, report });
|
|
515
|
+
}
|
|
516
|
+
catch (error) {
|
|
517
|
+
throw new LocateError(`${prefix}${next.name} (${next.path}): ${error instanceof Error ? error.message : String(error)}`);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
//# sourceMappingURL=declared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declared.js","sourceRoot":"","sources":["../../src/declared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEnD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,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AE,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC,CAAA;YACpF,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;YACjH,CAAC;YACD,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;QAC5C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,WAAW,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,MAAM,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAC1H,CAAC;IACH,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -19,8 +19,10 @@
|
|
|
19
19
|
*/
|
|
20
20
|
export * as Source from './source.ts';
|
|
21
21
|
export * as Template from './template.ts';
|
|
22
|
-
export
|
|
23
|
-
export
|
|
22
|
+
export * as Declared from './declared.ts';
|
|
23
|
+
export { assemble } from './declared.ts';
|
|
24
|
+
export { adHocNaming, bookkeepingKey, connect, currentDigestsUnder, currentRowsUnder, declaredNaming, digestAttribute, digestOf, federatedQuery, hasDigest, isConnected, provenanceContext, retireRun } from './run.ts';
|
|
25
|
+
export type { ConnectOptions, Failure, FederatedOutcome, Naming, Report } from './run.ts';
|
|
24
26
|
export { runConnect } from './main.ts';
|
|
25
27
|
export type { RunContext as ConnectRunContext, ScheduleLike, WatchLike } from './main.ts';
|
|
26
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACvN,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACtC,YAAY,EAAE,UAAU,IAAI,iBAAiB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
*/
|
|
20
20
|
export * as Source from "./source.js";
|
|
21
21
|
export * as Template from "./template.js";
|
|
22
|
-
export
|
|
22
|
+
export * as Declared from "./declared.js";
|
|
23
|
+
export { assemble } from "./declared.js";
|
|
24
|
+
export { adHocNaming, bookkeepingKey, connect, currentDigestsUnder, currentRowsUnder, declaredNaming, digestAttribute, digestOf, federatedQuery, hasDigest, isConnected, provenanceContext, retireRun } from "./run.js";
|
|
23
25
|
export { runConnect } from "./main.js";
|
|
24
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEvN,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAoGrC,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,cAAc,CAAA;IACvC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,cAAc,CAAA;IACvC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;IAC7B,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,SAAS,CAAA;IACrC,oEAAoE;IACpE,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAA;IAChC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;CACrD,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,CACtB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,KAAK,IAAI,KAChE;IAAE,KAAK,IAAI,IAAI,CAAA;CAAE,CAAA;AAEtB,MAAM,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAA;AA+hBtF,eAAO,MAAM,UAAU,GAAU,MAAM,SAAS,MAAM,EAAE,EAAE,UAAS,UAAe,KAAG,OAAO,CAAC,MAAM,CAwFlG,CAAA"}
|