@bilig/workbook 0.59.0 → 0.62.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 +98 -57
- package/dist/check.js +3 -0
- package/dist/check.js.map +1 -1
- package/dist/describe.d.ts +6 -0
- package/dist/describe.js +8 -0
- package/dist/describe.js.map +1 -1
- package/dist/features.d.ts +108 -0
- package/dist/features.js +208 -0
- package/dist/features.js.map +1 -0
- package/dist/find.d.ts +41 -0
- package/dist/find.js +250 -5
- package/dist/find.js.map +1 -1
- package/dist/formula.d.ts +7 -0
- package/dist/formula.js +49 -6
- package/dist/formula.js.map +1 -1
- package/dist/guards.js +32 -0
- package/dist/guards.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/input.d.ts +16 -0
- package/dist/input.js +119 -0
- package/dist/input.js.map +1 -1
- package/dist/model.d.ts +2 -1
- package/dist/model.js +25 -1
- package/dist/model.js.map +1 -1
- package/dist/plan-data.d.ts +13 -0
- package/dist/plan-data.js +212 -0
- package/dist/plan-data.js.map +1 -0
- package/dist/requirements.d.ts +30 -2
- package/dist/requirements.js +80 -1
- package/dist/requirements.js.map +1 -1
- package/dist/result.d.ts +4 -2
- package/dist/result.js +7 -0
- package/dist/result.js.map +1 -1
- package/dist/run.d.ts +5 -3
- package/dist/run.js +81 -42
- package/dist/run.js.map +1 -1
- package/dist/verify.d.ts +3 -2
- package/dist/verify.js +74 -3
- package/dist/verify.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -26,52 +26,56 @@ import {
|
|
|
26
26
|
formula,
|
|
27
27
|
planWorkbookAction,
|
|
28
28
|
runWorkbookPlan,
|
|
29
|
+
toPlanData,
|
|
29
30
|
verifyPlan,
|
|
30
|
-
|
|
31
|
+
verifyPlanData,
|
|
32
|
+
} from '@bilig/workbook'
|
|
31
33
|
|
|
32
34
|
export const model = defineModel({
|
|
33
|
-
name:
|
|
35
|
+
name: 'generic-row-calculator',
|
|
34
36
|
|
|
35
37
|
find(workbook) {
|
|
36
38
|
const table = workbook.findTable({
|
|
37
|
-
headers: [
|
|
38
|
-
})
|
|
39
|
+
headers: ['Item', 'Quantity', 'Rate', 'Status', 'Total'],
|
|
40
|
+
})
|
|
39
41
|
const rows = workbook.findRows({
|
|
40
42
|
table,
|
|
41
|
-
where: { column:
|
|
42
|
-
})
|
|
43
|
+
where: { column: 'Status', op: 'eq', value: 'ready' },
|
|
44
|
+
})
|
|
43
45
|
|
|
44
46
|
return {
|
|
45
47
|
table,
|
|
46
48
|
rows,
|
|
47
|
-
quantity: rows.column(
|
|
48
|
-
rate: rows.column(
|
|
49
|
-
total: rows.column(
|
|
50
|
-
}
|
|
49
|
+
quantity: rows.column('Quantity'),
|
|
50
|
+
rate: rows.column('Rate'),
|
|
51
|
+
total: rows.column('Total'),
|
|
52
|
+
}
|
|
51
53
|
},
|
|
52
54
|
|
|
53
55
|
checks({ refs, workbook }) {
|
|
54
|
-
return [workbook.check.exists(refs.table), workbook.check.noFormulaErrors(refs.total)]
|
|
56
|
+
return [workbook.check.exists(refs.table), workbook.check.noFormulaErrors(refs.total)]
|
|
55
57
|
},
|
|
56
58
|
|
|
57
59
|
actions: {
|
|
58
60
|
recompute({ refs, workbook }) {
|
|
59
|
-
const expected = formula.multiply(refs.quantity, refs.rate)
|
|
60
|
-
workbook.writeFormula(refs.total, expected)
|
|
61
|
-
workbook.check.formulaEquals(refs.total, expected)
|
|
61
|
+
const expected = formula.multiply(refs.quantity, refs.rate)
|
|
62
|
+
workbook.writeFormula(refs.total, expected)
|
|
63
|
+
workbook.check.formulaEquals(refs.total, expected)
|
|
62
64
|
},
|
|
63
65
|
},
|
|
64
|
-
})
|
|
66
|
+
})
|
|
65
67
|
|
|
66
|
-
const planned = planWorkbookAction(model,
|
|
67
|
-
if (planned.status ===
|
|
68
|
+
const planned = planWorkbookAction(model, 'recompute')
|
|
69
|
+
if (planned.status === 'failed') throw new Error(planned.errors[0]?.message)
|
|
68
70
|
|
|
69
|
-
const staticProof = verifyPlan(planned.plan)
|
|
70
|
-
const requirements = describeRuntimeRequirements(planned.plan)
|
|
71
|
-
const planForLogs = describePlan(planned.plan)
|
|
71
|
+
const staticProof = verifyPlan(planned.plan)
|
|
72
|
+
const requirements = describeRuntimeRequirements(planned.plan)
|
|
73
|
+
const planForLogs = describePlan(planned.plan)
|
|
74
|
+
const transportedPlan = JSON.parse(JSON.stringify(toPlanData(planned.plan)))
|
|
75
|
+
const transportProof = verifyPlanData(transportedPlan)
|
|
72
76
|
|
|
73
|
-
const result = await runWorkbookPlan(
|
|
74
|
-
const resultForLogs = describeRunResult(result)
|
|
77
|
+
const result = await runWorkbookPlan(transportedPlan, adapter)
|
|
78
|
+
const resultForLogs = describeRunResult(result)
|
|
75
79
|
```
|
|
76
80
|
|
|
77
81
|
That is the core flow:
|
|
@@ -82,7 +86,8 @@ That is the core flow:
|
|
|
82
86
|
4. An action builds workbook intent.
|
|
83
87
|
5. `verifyPlan` checks the plan without running an engine.
|
|
84
88
|
6. `describeRuntimeRequirements` tells an adapter what it must apply, read, and prove.
|
|
85
|
-
7. `
|
|
89
|
+
7. `toPlanData` makes the plan JSON-safe for handoff.
|
|
90
|
+
8. `runWorkbookPlan` applies either the in-memory plan or transported plan data through a runtime-owned adapter and returns a boring result with check proof and apply proof when the adapter provides it.
|
|
86
91
|
|
|
87
92
|
## Public Contract
|
|
88
93
|
|
|
@@ -91,18 +96,21 @@ The main API is intentionally small:
|
|
|
91
96
|
- model: `defineModel`, `inspectModel`, `planWorkbookAction`, `buildWorkbookActionPlan`
|
|
92
97
|
- selectors: `findTable`, `findColumn`, `findRange`, `findName`, `findRows`, `find`
|
|
93
98
|
- checks: `check.exists`, `check.noFormulaErrors`, `check.valueEquals`, `check.formulaEquals`, `check.custom`
|
|
94
|
-
- formulas: `formula.add`, `formula.subtract`, `formula.multiply`, `formula.divide`, `formula.sum`, `formula.call`, `formula.raw`, `formula.text`
|
|
99
|
+
- formulas: `formula.add`, `formula.subtract`, `formula.multiply`, `formula.divide`, `formula.sum`, `formula.call`, `formula.raw`, `formula.text`, `formula.labels`
|
|
100
|
+
- input: `checkInput`, `normalizeWorkbookActionInputDescription`
|
|
95
101
|
- proof: `verifyPlan`, `verifyModel`, `verifyWorkbookReadbacks`
|
|
96
|
-
- descriptions: `describeModel`, `describeRef`, `describePlan`, `describePlanResult`, `describeRuntimeRequirements`, `describeRunResult`
|
|
102
|
+
- descriptions: `describeModel`, `describeRef`, `describePlan`, `describePlanResult`, `describeRuntimeRequirements`, `checkRuntimeAdapter`, `describeRunResult`
|
|
103
|
+
- transport data: `isWorkbookRefData`, `toWorkbookRefData`, `collectWorkbookRefData`, `hydrateWorkbookRef`, `hydrateWorkbookRefs`, `toPlanData`, `isPlanData`, `hydratePlanData`, `verifyPlanData`
|
|
97
104
|
- runtime handoff: `runWorkbookPlan`, `runWorkbookAction`, `WorkbookRunAdapter`
|
|
98
105
|
- low-level language: `WorkbookOp`, `WorkbookTxn`, `EngineOp`, `EngineOpBatch`, `isEngineOpBatch`
|
|
99
106
|
|
|
100
107
|
Stable data helpers are exported for generic tool builders:
|
|
101
108
|
|
|
102
109
|
- `workbookRefKinds`, `isWorkbookRefKind`, `isWorkbookRef`
|
|
110
|
+
- `isWorkbookRefData`, `toWorkbookRefData`, `collectWorkbookRefData`, `hydrateWorkbookRef`, `hydrateWorkbookRefs`
|
|
103
111
|
- `workbookRowOperators`, `workbookRowOperatorValueTypes`, `isWorkbookRowOperator`, `isWorkbookRowValueCompatible`
|
|
104
112
|
- `builtInWorkbookCheckKinds`, `isBuiltInWorkbookCheckKind`
|
|
105
|
-
- `workbookActionInputDescriptionKinds`, `isWorkbookActionInputDescriptionKind`, `isWorkbookActionInputDescription`, `isWorkbookActionInput`
|
|
113
|
+
- `workbookActionInputDescriptionKinds`, `isWorkbookActionInputDescriptionKind`, `isWorkbookActionInputDescription`, `isWorkbookActionInput`, `checkInput`
|
|
106
114
|
- `workbookRunErrorCodes`, `isWorkbookRunErrorCode`
|
|
107
115
|
|
|
108
116
|
## Selectors
|
|
@@ -121,18 +129,44 @@ agents.
|
|
|
121
129
|
|
|
122
130
|
Refs are frozen data. Helpers such as `table.column("Total")` and
|
|
123
131
|
`rows.column("Total")` are non-enumerable, so JSON descriptions stay data-first.
|
|
132
|
+
Use `toWorkbookRefData` or `describeRef` when a ref must cross a JSON boundary.
|
|
133
|
+
Use `hydrateWorkbookRef` or `hydrateWorkbookRefs` after transport to regain the
|
|
134
|
+
local helpers. `verifyPlanData(describePlan(plan))` checks transported plan data
|
|
135
|
+
without requiring the consumer's private `refs` object shape.
|
|
136
|
+
|
|
137
|
+
For full action handoff, use `toPlanData(plan)` before JSON transport. A runtime
|
|
138
|
+
can call `hydratePlanData(data)` to regain frozen refs and helper methods, or
|
|
139
|
+
pass the data directly to `describeRuntimeRequirements(data)` and
|
|
140
|
+
`runWorkbookPlan(data, adapter)`. The hydrated plan exposes
|
|
141
|
+
`refs: { refsUsed }` instead of the consumer's private model-shaped `refs`
|
|
142
|
+
object, so transported execution stays generic.
|
|
143
|
+
|
|
144
|
+
## Action Input
|
|
145
|
+
|
|
146
|
+
Action input is JSON-safe data, not a schema-framework object. Action metadata
|
|
147
|
+
can describe generic input with `json`, `object`, `array`, `string`, `number`,
|
|
148
|
+
`boolean`, and `null` kinds. `checkInput(description, value)` returns a plain
|
|
149
|
+
`{ status, input, issues }` result so an agent can reject malformed tool payloads
|
|
150
|
+
before running workbook model code. Omitted input is valid unless the top-level
|
|
151
|
+
description sets `required: true`, so agents can distinguish an optional payload
|
|
152
|
+
from a malformed payload. `planWorkbookAction` uses the same check when an action
|
|
153
|
+
declares input metadata.
|
|
124
154
|
|
|
125
155
|
## Formulas
|
|
126
156
|
|
|
127
157
|
`@bilig/workbook` creates formula expressions. `@bilig/formula` parses and
|
|
128
158
|
normalizes formula text. `@bilig/core` or an app runtime calculates it.
|
|
129
159
|
|
|
130
|
-
Formula helpers keep formula text
|
|
131
|
-
formula write includes
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
160
|
+
Formula helpers keep formula text, workbook dependencies, and formula labels
|
|
161
|
+
separate. A planned formula write includes the formula string, the refs used to
|
|
162
|
+
build it, and a `labels` array mapping each formula token to the workbook ref it
|
|
163
|
+
represents. Runtime adapters use those labels to materialize table columns,
|
|
164
|
+
filtered rows, names, and ranges without reverse-engineering hidden JS helpers.
|
|
165
|
+
For custom formula text, use `formula.raw(source, { inputs })`; pass
|
|
166
|
+
`labels: [{ name, ref }]` when the raw formula uses custom tokens. For
|
|
167
|
+
spreadsheet string literals, use `formula.text(value)`. Bare strings are not
|
|
168
|
+
formula operands because agents should not guess whether a string is code, a
|
|
169
|
+
label, a named range, or user text.
|
|
136
170
|
|
|
137
171
|
## Runtime Adapter
|
|
138
172
|
|
|
@@ -141,25 +175,31 @@ named range, or user text.
|
|
|
141
175
|
```ts
|
|
142
176
|
const adapter = {
|
|
143
177
|
apply(plan) {
|
|
144
|
-
const ops = materializeForThisRuntime(plan)
|
|
178
|
+
const ops = materializeForThisRuntime(plan)
|
|
145
179
|
return {
|
|
146
|
-
status:
|
|
180
|
+
status: 'applied',
|
|
147
181
|
previewOps: ops,
|
|
148
182
|
appliedOps: ops,
|
|
149
|
-
proof: { source:
|
|
150
|
-
undo: { id:
|
|
151
|
-
}
|
|
183
|
+
proof: { source: 'runtime', opCount: ops.length },
|
|
184
|
+
undo: { id: 'undo-1' },
|
|
185
|
+
}
|
|
152
186
|
},
|
|
153
187
|
read(targets, plan) {
|
|
154
|
-
return targets.map((target) => ({ target, value: 12 }))
|
|
188
|
+
return targets.map((target) => ({ target, value: 12 }))
|
|
155
189
|
},
|
|
156
190
|
verifyChecks(checks, plan) {
|
|
157
|
-
return checks.map((entry) => ({ ...entry, status:
|
|
191
|
+
return checks.map((entry) => ({ ...entry, status: 'passed' }))
|
|
158
192
|
},
|
|
159
|
-
}
|
|
193
|
+
}
|
|
160
194
|
```
|
|
161
195
|
|
|
162
|
-
`runWorkbookPlan`
|
|
196
|
+
`runWorkbookPlan` accepts either a live plan or transported plan data and
|
|
197
|
+
refuses to call `apply` if static plan verification fails or if the adapter is
|
|
198
|
+
missing a required method. Use `checkRuntimeAdapter(planOrRequirements,
|
|
199
|
+
adapter)` when an agent wants to check `apply`, `read`, and `verifyChecks`
|
|
200
|
+
coverage before calling the runtime. Check-only plans do not require `apply`;
|
|
201
|
+
when runtime requirements contain only `read` or `verifyCheck`, `runWorkbookPlan`
|
|
202
|
+
skips mutation and verifies the declared checks directly.
|
|
163
203
|
If an adapter returns both `previewOps` and `appliedOps`, the result reports
|
|
164
204
|
whether they matched. If the adapter returns neither, the run records an
|
|
165
205
|
unverified apply fact. Use `runWorkbookPlan(plan, adapter, { requireApplyProof:
|
|
@@ -170,30 +210,31 @@ Readback checks attach proof to passed checks, such as
|
|
|
170
210
|
Generic check verifiers may only change `status` or add JSON-safe `proof`; they
|
|
171
211
|
cannot rewrite the check contract.
|
|
172
212
|
If runtime apply succeeds but readback or check proof fails, the failed result
|
|
173
|
-
still carries `changed` and `undo` when the adapter returned
|
|
174
|
-
failed result before apply
|
|
213
|
+
still carries `changed` and `undo` when the adapter returned applied ops or undo
|
|
214
|
+
metadata. A failed result before apply, or a failed apply that reports
|
|
215
|
+
`appliedOps: []` without undo metadata, uses `changed: []`.
|
|
175
216
|
|
|
176
217
|
The result is deliberately plain:
|
|
177
218
|
|
|
178
219
|
```ts
|
|
179
220
|
type WorkbookRunResult =
|
|
180
221
|
| {
|
|
181
|
-
status:
|
|
182
|
-
apply?: WorkbookRunApplySummary
|
|
183
|
-
changed: WorkbookChangeSummary[]
|
|
184
|
-
checks: WorkbookCheckResult[]
|
|
185
|
-
undo?: WorkbookUndoRef
|
|
186
|
-
unverified?: WorkbookRunUnverified[]
|
|
222
|
+
status: 'done'
|
|
223
|
+
apply?: WorkbookRunApplySummary
|
|
224
|
+
changed: WorkbookChangeSummary[]
|
|
225
|
+
checks: WorkbookCheckResult[]
|
|
226
|
+
undo?: WorkbookUndoRef
|
|
227
|
+
unverified?: WorkbookRunUnverified[]
|
|
187
228
|
}
|
|
188
229
|
| {
|
|
189
|
-
status:
|
|
190
|
-
errors: WorkbookRunError[]
|
|
191
|
-
apply?: WorkbookRunApplySummary
|
|
192
|
-
changed: WorkbookChangeSummary[]
|
|
193
|
-
checks: WorkbookCheckResult[]
|
|
194
|
-
undo?: WorkbookUndoRef
|
|
195
|
-
unverified?: WorkbookRunUnverified[]
|
|
196
|
-
}
|
|
230
|
+
status: 'failed'
|
|
231
|
+
errors: WorkbookRunError[]
|
|
232
|
+
apply?: WorkbookRunApplySummary
|
|
233
|
+
changed: WorkbookChangeSummary[]
|
|
234
|
+
checks: WorkbookCheckResult[]
|
|
235
|
+
undo?: WorkbookUndoRef
|
|
236
|
+
unverified?: WorkbookRunUnverified[]
|
|
237
|
+
}
|
|
197
238
|
```
|
|
198
239
|
|
|
199
240
|
## Low-Level Ops
|
package/dist/check.js
CHANGED
|
@@ -52,6 +52,7 @@ function createWorkbookCheck(options) {
|
|
|
52
52
|
? Object.freeze({
|
|
53
53
|
...options.expectation,
|
|
54
54
|
inputs: Object.freeze([...options.expectation.inputs]),
|
|
55
|
+
labels: Object.freeze(options.expectation.labels.map((label) => Object.freeze({ ...label }))),
|
|
55
56
|
})
|
|
56
57
|
: Object.freeze({ ...options.expectation });
|
|
57
58
|
return Object.freeze({
|
|
@@ -98,6 +99,7 @@ export function createWorkbookCheckApi(record) {
|
|
|
98
99
|
formulaEquals(target, value, options = {}) {
|
|
99
100
|
const source = formula.source(value);
|
|
100
101
|
const inputs = formula.inputs(value);
|
|
102
|
+
const labels = formula.labels(value);
|
|
101
103
|
return planned({
|
|
102
104
|
kind: 'formulaEquals',
|
|
103
105
|
target,
|
|
@@ -106,6 +108,7 @@ export function createWorkbookCheckApi(record) {
|
|
|
106
108
|
kind: 'formulaEquals',
|
|
107
109
|
formula: source,
|
|
108
110
|
inputs,
|
|
111
|
+
labels,
|
|
109
112
|
},
|
|
110
113
|
});
|
|
111
114
|
},
|
package/dist/check.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.js","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqB,MAAM,iBAAiB,CAAA;AAEnE,OAAO,EAAE,OAAO,EAA+B,MAAM,cAAc,CAAA;AA4BnE,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC;IACrD,QAAQ;IACR,iBAAiB;IACjB,aAAa;IACb,eAAe;CAC8B,CAAC,CAAA;AAEhD,MAAM,UAAU,0BAA0B,CAAC,KAAc;IACvD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAA;AAC9F,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,IAAY,EAAE,MAAmB,EAAE,OAAe;IAC1F,OAAO,mBAAmB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAA;AACvD,CAAC;AAMD,SAAS,YAAY,CAAC,KAAa,EAAE,IAAY;IAC/C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;IAC5B,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,kBAAkB,CAAC,CAAA;IAC3D,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAmB;IAC9C,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;IAC1E,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,MAAM,CAAC,GAAgB;IAC9B,OAAO,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F,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAqB,sBAAsB,EAAE,CAAA"}
|
package/dist/describe.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export type WorkbookActionCommandDescription = {
|
|
|
52
52
|
readonly target: WorkbookRefDescription;
|
|
53
53
|
readonly formula: string;
|
|
54
54
|
readonly inputs: readonly WorkbookRefDescription[];
|
|
55
|
+
readonly labels: readonly WorkbookFormulaLabelDescription[];
|
|
55
56
|
} | {
|
|
56
57
|
readonly kind: 'writeValue';
|
|
57
58
|
readonly target: WorkbookRefDescription;
|
|
@@ -91,7 +92,12 @@ export type WorkbookCheckExpectationDescription = {
|
|
|
91
92
|
readonly kind: 'formulaEquals';
|
|
92
93
|
readonly formula: string;
|
|
93
94
|
readonly inputs: readonly WorkbookRefDescription[];
|
|
95
|
+
readonly labels: readonly WorkbookFormulaLabelDescription[];
|
|
94
96
|
};
|
|
97
|
+
export interface WorkbookFormulaLabelDescription {
|
|
98
|
+
readonly name: string;
|
|
99
|
+
readonly ref: WorkbookRefDescription;
|
|
100
|
+
}
|
|
95
101
|
export interface WorkbookActionPlanDescription {
|
|
96
102
|
readonly modelName: string;
|
|
97
103
|
readonly actionName: string;
|
package/dist/describe.js
CHANGED
|
@@ -70,6 +70,7 @@ function describeCommand(command) {
|
|
|
70
70
|
target: describeRef(command.target),
|
|
71
71
|
formula: command.formula,
|
|
72
72
|
inputs: command.inputs.map(describeRef),
|
|
73
|
+
labels: command.labels.map(describeFormulaLabel),
|
|
73
74
|
};
|
|
74
75
|
case 'writeValue':
|
|
75
76
|
return {
|
|
@@ -98,6 +99,12 @@ function describeCommand(command) {
|
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
101
|
}
|
|
102
|
+
function describeFormulaLabel(label) {
|
|
103
|
+
return {
|
|
104
|
+
name: label.name,
|
|
105
|
+
ref: describeRef(label.ref),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
101
108
|
function describeChange(change) {
|
|
102
109
|
return {
|
|
103
110
|
kind: change.kind,
|
|
@@ -128,6 +135,7 @@ function describeExpectation(expectation) {
|
|
|
128
135
|
kind: 'formulaEquals',
|
|
129
136
|
formula: expectation.formula,
|
|
130
137
|
inputs: expectation.inputs.map(describeRef),
|
|
138
|
+
labels: expectation.labels.map(describeFormulaLabel),
|
|
131
139
|
};
|
|
132
140
|
}
|
|
133
141
|
}
|
package/dist/describe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../src/describe.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,YAAY,GAOb,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"describe.js","sourceRoot":"","sources":["../src/describe.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,YAAY,GAOb,MAAM,YAAY,CAAA;AAyMnB,MAAM,UAAU,aAAa,CAC3B,KAAmC;IAEnC,OAAO,YAAY,CAAC,KAAK,CAAC,CAAA;AAC5B,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAqB;IAC7C,OAAO;QACL,IAAI,EAAE,OAAO;QACb,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,KAAK,EAAE,EAAE,GAAG,GAAG,CAAC,KAAK,EAAE;KACxB,CAAA;AACH,CAAC;AAED,SAAS,eAAe,CAAC,GAAoB;IAC3C,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,IAAI,EAAE,GAAG,CAAC,IAAI;KACf,CAAA;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAqB;IAC7C,OAAO;QACL,IAAI,EAAE,OAAO;QACb,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CA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AAkB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtG,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { CellRangeRef, CellStylePatch, CellStyleRecord, LiteralInput } from '@bilig/protocol';
|
|
2
|
+
import { type WorkbookActionInput, type WorkbookActionInputDescription } from './input.js';
|
|
3
|
+
import type { EngineOp } from './ops.js';
|
|
4
|
+
import type { WorkbookUndoRef } from './result.js';
|
|
5
|
+
export type WorkbookFeatureId = string;
|
|
6
|
+
export type WorkbookCommandCategory = 'command' | 'operation' | 'mutation';
|
|
7
|
+
export type WorkbookCommandExecutionMode = 'preview' | 'apply' | 'applyAndVerify';
|
|
8
|
+
export type WorkbookCommandReceiptStatus = 'previewed' | 'applied' | 'rejected' | 'noop';
|
|
9
|
+
export type WorkbookProjectionInterceptorPoint = 'cellDisplay' | 'cellStyle' | 'rangeChrome' | 'rowVisibility' | 'beforeCommand' | 'commandMetadata';
|
|
10
|
+
export type WorkbookUiContributionSlot = 'toolbar' | 'sidePanel' | 'floatingOverlay' | 'status';
|
|
11
|
+
export interface WorkbookFeatureLifecycleContext {
|
|
12
|
+
readonly featureId: WorkbookFeatureId;
|
|
13
|
+
readonly activeFeatures: readonly WorkbookFeatureId[];
|
|
14
|
+
}
|
|
15
|
+
export interface WorkbookCommandDescriptor {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly featureId: WorkbookFeatureId;
|
|
18
|
+
readonly category: WorkbookCommandCategory;
|
|
19
|
+
readonly label: string;
|
|
20
|
+
readonly description?: string;
|
|
21
|
+
readonly input?: WorkbookActionInputDescription;
|
|
22
|
+
}
|
|
23
|
+
export interface WorkbookCommandRequest {
|
|
24
|
+
readonly featureId: WorkbookFeatureId;
|
|
25
|
+
readonly commandId: string;
|
|
26
|
+
readonly category?: WorkbookCommandCategory;
|
|
27
|
+
readonly mode?: WorkbookCommandExecutionMode;
|
|
28
|
+
readonly input?: WorkbookActionInput;
|
|
29
|
+
}
|
|
30
|
+
export interface WorkbookCommandReceipt {
|
|
31
|
+
readonly status: WorkbookCommandReceiptStatus;
|
|
32
|
+
readonly featureId: WorkbookFeatureId;
|
|
33
|
+
readonly commandId: string;
|
|
34
|
+
readonly category: WorkbookCommandCategory;
|
|
35
|
+
readonly previewOps?: readonly EngineOp[];
|
|
36
|
+
readonly appliedOps?: readonly EngineOp[];
|
|
37
|
+
readonly undo?: WorkbookUndoRef;
|
|
38
|
+
readonly changedRanges?: readonly CellRangeRef[];
|
|
39
|
+
readonly proof?: WorkbookActionInput;
|
|
40
|
+
readonly message?: string;
|
|
41
|
+
readonly metadata?: WorkbookActionInput;
|
|
42
|
+
readonly errors?: readonly string[];
|
|
43
|
+
}
|
|
44
|
+
export interface WorkbookCellDisplayProjection {
|
|
45
|
+
readonly value?: LiteralInput;
|
|
46
|
+
readonly text?: string;
|
|
47
|
+
readonly metadata?: WorkbookActionInput;
|
|
48
|
+
}
|
|
49
|
+
export interface WorkbookCellStyleProjection {
|
|
50
|
+
readonly style?: CellStylePatch | CellStyleRecord;
|
|
51
|
+
readonly metadata?: WorkbookActionInput;
|
|
52
|
+
}
|
|
53
|
+
export interface WorkbookRangeChromeProjection {
|
|
54
|
+
readonly id: string;
|
|
55
|
+
readonly featureId: WorkbookFeatureId;
|
|
56
|
+
readonly source: 'workbook-metadata' | 'command-preview' | 'runtime';
|
|
57
|
+
readonly range: CellRangeRef;
|
|
58
|
+
readonly role: string;
|
|
59
|
+
readonly label?: string;
|
|
60
|
+
readonly metadata?: WorkbookActionInput;
|
|
61
|
+
}
|
|
62
|
+
export interface WorkbookRowVisibilityProjection {
|
|
63
|
+
readonly hidden?: boolean;
|
|
64
|
+
readonly metadata?: WorkbookActionInput;
|
|
65
|
+
}
|
|
66
|
+
export interface WorkbookCommandMetadataProjection {
|
|
67
|
+
readonly label?: string;
|
|
68
|
+
readonly changedRanges?: readonly CellRangeRef[];
|
|
69
|
+
readonly semanticTargets?: readonly WorkbookActionInput[];
|
|
70
|
+
readonly metadata?: WorkbookActionInput;
|
|
71
|
+
}
|
|
72
|
+
export interface WorkbookProjectionContext {
|
|
73
|
+
readonly featureId: WorkbookFeatureId;
|
|
74
|
+
}
|
|
75
|
+
export interface WorkbookProjectionInterceptorRegistration {
|
|
76
|
+
readonly id: string;
|
|
77
|
+
readonly featureId: WorkbookFeatureId;
|
|
78
|
+
readonly point: WorkbookProjectionInterceptorPoint;
|
|
79
|
+
readonly priority?: number;
|
|
80
|
+
readonly label?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface WorkbookUiContribution {
|
|
83
|
+
readonly id: string;
|
|
84
|
+
readonly featureId: WorkbookFeatureId;
|
|
85
|
+
readonly slot: WorkbookUiContributionSlot;
|
|
86
|
+
readonly label: string;
|
|
87
|
+
readonly order?: number;
|
|
88
|
+
readonly metadata?: WorkbookActionInput;
|
|
89
|
+
}
|
|
90
|
+
export interface WorkbookFeatureRegistration {
|
|
91
|
+
readonly commands: readonly WorkbookCommandDescriptor[];
|
|
92
|
+
readonly projectionInterceptors: readonly WorkbookProjectionInterceptorRegistration[];
|
|
93
|
+
readonly uiContributions: readonly WorkbookUiContribution[];
|
|
94
|
+
}
|
|
95
|
+
export interface WorkbookFeaturePlugin extends WorkbookFeatureRegistration {
|
|
96
|
+
readonly id: WorkbookFeatureId;
|
|
97
|
+
readonly version: string;
|
|
98
|
+
readonly dependsOn?: readonly WorkbookFeatureId[];
|
|
99
|
+
readonly register?: (context: WorkbookFeatureLifecycleContext) => void;
|
|
100
|
+
readonly activate?: (context: WorkbookFeatureLifecycleContext) => void;
|
|
101
|
+
readonly dispose?: (context: WorkbookFeatureLifecycleContext) => void;
|
|
102
|
+
}
|
|
103
|
+
export declare function normalizeWorkbookFeatureId(value: string, label?: string): WorkbookFeatureId;
|
|
104
|
+
export declare function defineWorkbookFeaturePlugin(plugin: WorkbookFeaturePlugin): WorkbookFeaturePlugin;
|
|
105
|
+
export declare function normalizeWorkbookCommandDescriptor(descriptor: WorkbookCommandDescriptor, expectedFeatureId?: WorkbookFeatureId): WorkbookCommandDescriptor;
|
|
106
|
+
export declare function normalizeWorkbookCommandReceipt(receipt: WorkbookCommandReceipt): WorkbookCommandReceipt;
|
|
107
|
+
export declare function isWorkbookCommandReceipt(value: unknown): value is WorkbookCommandReceipt;
|
|
108
|
+
export declare function workbookCommandReceiptOpsMatch(receipt: Pick<WorkbookCommandReceipt, 'previewOps' | 'appliedOps'>): boolean | null;
|