@omgbase/core 0.15.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/core/ingest.d.ts +2 -0
- package/dist/src/core/ingest.js +13 -0
- package/dist/src/core/read/document.d.ts +9 -8
- package/dist/src/core/read/document.js +0 -2
- package/dist/src/core/store/gc.d.ts +13 -1
- package/dist/src/core/store/gc.js +24 -5
- package/dist/src/core/store/size.d.ts +79 -0
- package/dist/src/core/store/size.js +232 -0
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.js +5 -1
- package/dist/src/mcp/arguments.d.ts +10 -2
- package/dist/src/mcp/arguments.js +37 -3
- package/dist/src/mcp/errors.d.ts +1 -1
- package/dist/src/mcp/reference.d.ts +1 -1
- package/dist/src/mcp/reference.js +63 -10
- package/dist/src/mcp/server.d.ts +34 -1
- package/dist/src/mcp/server.js +158 -46
- package/dist/src/mutate/canonical.d.ts +27 -0
- package/dist/src/mutate/canonical.js +138 -0
- package/dist/src/mutate/effects.d.ts +58 -8
- package/dist/src/mutate/effects.js +312 -43
- package/dist/src/mutate/known-ids.d.ts +19 -0
- package/dist/src/mutate/known-ids.js +47 -7
- package/dist/src/mutate/ops.d.ts +1 -0
- package/dist/src/mutate/ops.js +20 -1
- package/dist/src/mutate/plan.d.ts +26 -16
- package/dist/src/mutate/plan.js +152 -112
- package/dist/src/mutate/select.d.ts +78 -0
- package/dist/src/mutate/select.js +903 -0
- package/dist/src/mutate/tree.d.ts +2 -2
- package/dist/src/oqx-js/context.d.ts +9 -2
- package/dist/src/oqx-js/context.js +74 -28
- package/dist/src/oqx-js/names.d.ts +40 -0
- package/dist/src/oqx-js/names.js +347 -0
- package/dist/src/oqx-js/planner.d.ts +3 -3
- package/dist/src/oqx-js/planner.js +17 -9
- package/dist/src/oqx-js/root-row.d.ts +15 -4
- package/dist/src/oqx-js/root-row.js +18 -10
- package/dist/src/oqx-js/run.d.ts +45 -1
- package/dist/src/oqx-js/run.js +114 -32
- package/dist/src/oqx-js/sql/translate.js +1 -1
- package/dist/src/spec-versions.d.ts +5 -5
- package/dist/src/spec-versions.js +4 -4
- package/dist/src/sync/observe.js +9 -3
- package/dist/src/version.d.ts +7 -2
- package/dist/src/version.js +5 -2
- package/package.json +2 -2
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type Query } from "@omgbase/oqx";
|
|
2
|
+
import type { Store } from "../core/store/store.js";
|
|
3
|
+
import { type Effect } from "./effects.js";
|
|
4
|
+
import { MutationError } from "./tree.js";
|
|
5
|
+
import { type FixRequest } from "./canonical.js";
|
|
6
|
+
/** The implicit bound on a selection without `expect.max` (hits beyond it are `selection_too_large`). */
|
|
7
|
+
export declare const SELECTION_CEILING = 1000;
|
|
8
|
+
export interface SelectionExpect {
|
|
9
|
+
max: number;
|
|
10
|
+
}
|
|
11
|
+
/** The seventh digested member of a plan's core (§11.4): the selector and its templates AS GIVEN, the hits it bound. */
|
|
12
|
+
export interface Selection {
|
|
13
|
+
query: string;
|
|
14
|
+
expect?: SelectionExpect;
|
|
15
|
+
templates: unknown[];
|
|
16
|
+
cardinality: number;
|
|
17
|
+
/** the hit ids, result order */
|
|
18
|
+
identities: string[];
|
|
19
|
+
}
|
|
20
|
+
/** Where an expanded effect came from (every error from one carries both, §11.8); a plain effect's
|
|
21
|
+
* expressions (3.2) have a row but no template. */
|
|
22
|
+
export interface EffectOrigin {
|
|
23
|
+
template_index?: number;
|
|
24
|
+
row: {
|
|
25
|
+
id: string;
|
|
26
|
+
path: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface CompiledSelection {
|
|
30
|
+
/** the concrete, validated effects: hits × templates */
|
|
31
|
+
effects: Effect[];
|
|
32
|
+
selection: Selection;
|
|
33
|
+
/** expanded index → its origin */
|
|
34
|
+
origins: EffectOrigin[];
|
|
35
|
+
}
|
|
36
|
+
/** (3.2) A plain request compiled: the concrete effects and, when any effect carried an expression, the list as written. */
|
|
37
|
+
export interface CompiledPlain {
|
|
38
|
+
effects: Effect[];
|
|
39
|
+
/** the effects AS WRITTEN — present only when at least one slot was an expression (the intent record's `templates`) */
|
|
40
|
+
templates?: unknown[];
|
|
41
|
+
/** effect index → the row its expressions were read from (sparse; literal effects have none) */
|
|
42
|
+
origins: (EffectOrigin | undefined)[];
|
|
43
|
+
}
|
|
44
|
+
/** The admission pass's refusal: `filter_invalid { reason, hint: "selection" }`. */
|
|
45
|
+
export declare function selectionInvalid(message: string, data?: Record<string, unknown>): MutationError;
|
|
46
|
+
/**
|
|
47
|
+
* `"-> <expr>"` → `{ oqx: "<expr>" }` — or, when the expression is a bare
|
|
48
|
+
* string literal or a template literal without interpolation, the literal
|
|
49
|
+
* itself (constant folding: `-> "x"` and `"x"` plan identically, and
|
|
50
|
+
* `-> "-> note"` is how a literal that begins with the leader is spelled).
|
|
51
|
+
* A parse error is `filter_invalid { hint: "selection" }` with its offset
|
|
52
|
+
* counted from the start of the written string (past the leader).
|
|
53
|
+
*/
|
|
54
|
+
export declare function desugarLeader(v: string, here: string): unknown;
|
|
55
|
+
/**
|
|
56
|
+
* Desugar one effect or template as written (§11.8 "Sugar"), before the shape
|
|
57
|
+
* check and the admission: in every slot that admits an expression — the
|
|
58
|
+
* strings `markdown`, `to`, `path`, `separator`, `at.before` / `at.after`,
|
|
59
|
+
* the JSON `value`, each top-level `create.frontmatter` value, a target's `id`
|
|
60
|
+
* / `path`, and a whole target (`into`, `target`, `targets[k]`) — a string
|
|
61
|
+
* beginning `-> ` becomes `{ oqx }` (or folds to its literal); a `-> ` string
|
|
62
|
+
* anywhere else (`expect`, `field`, `op`, a section's `heading_id`, …) is
|
|
63
|
+
* refused. Every other string is literal data, with no escaping and no `${`
|
|
64
|
+
* scanning; a string nested inside a `value` or a frontmatter value is data
|
|
65
|
+
* (the slot is the top-level value, as for `{ oqx }`). Shape problems are the
|
|
66
|
+
* shape check's.
|
|
67
|
+
*/
|
|
68
|
+
export declare function desugarEffect(raw: unknown, index: number, request?: FixRequest): unknown;
|
|
69
|
+
/**
|
|
70
|
+
* Compile `{ select, expect?, effects: templates }` into the concrete effects
|
|
71
|
+
* (§11.8): admit statically, rewrite, run once over one snapshot with
|
|
72
|
+
* `limit = bound + 1`, refuse a selection beyond the bound, bind every hit to
|
|
73
|
+
* every template. Reads only.
|
|
74
|
+
*/
|
|
75
|
+
export declare function compileSelection(store: Store, repoId: string, select: unknown, expectRaw: unknown, templatesRaw: unknown): CompiledSelection;
|
|
76
|
+
/** The query a selector request compiles to (admission + rewrite, before any row is read) — `print` it to see what runs. */
|
|
77
|
+
export declare function selectionQuery(select: unknown, templates: unknown): Query;
|
|
78
|
+
export declare function compilePlain(store: Store, repoId: string, raw: unknown): CompiledPlain;
|