@crubal/engine 0.0.0-stage → 0.4.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.
Files changed (114) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +97 -2
  3. package/dist/bin/crubal.d.ts +2 -0
  4. package/dist/bin/crubal.js +103 -0
  5. package/dist/bin/crubal.js.map +1 -0
  6. package/dist/src/access.d.ts +149 -0
  7. package/dist/src/access.js +584 -0
  8. package/dist/src/access.js.map +1 -0
  9. package/dist/src/acts.d.ts +531 -0
  10. package/dist/src/acts.js +1466 -0
  11. package/dist/src/acts.js.map +1 -0
  12. package/dist/src/address.d.ts +29 -0
  13. package/dist/src/address.js +59 -0
  14. package/dist/src/address.js.map +1 -0
  15. package/dist/src/arrival.d.ts +55 -0
  16. package/dist/src/arrival.js +127 -0
  17. package/dist/src/arrival.js.map +1 -0
  18. package/dist/src/browser.d.ts +10 -0
  19. package/dist/src/browser.js +13 -0
  20. package/dist/src/browser.js.map +1 -0
  21. package/dist/src/bundle.d.ts +74 -0
  22. package/dist/src/bundle.js +1108 -0
  23. package/dist/src/bundle.js.map +1 -0
  24. package/dist/src/canonical.d.ts +6 -0
  25. package/dist/src/canonical.js +47 -0
  26. package/dist/src/canonical.js.map +1 -0
  27. package/dist/src/carriers.d.ts +7 -0
  28. package/dist/src/carriers.js +33 -0
  29. package/dist/src/carriers.js.map +1 -0
  30. package/dist/src/conditions.d.ts +28 -0
  31. package/dist/src/conditions.js +227 -0
  32. package/dist/src/conditions.js.map +1 -0
  33. package/dist/src/corpus.d.ts +8 -0
  34. package/dist/src/corpus.js +1207 -0
  35. package/dist/src/corpus.js.map +1 -0
  36. package/dist/src/defs.d.ts +174 -0
  37. package/dist/src/defs.js +690 -0
  38. package/dist/src/defs.js.map +1 -0
  39. package/dist/src/dictionary.d.ts +77 -0
  40. package/dist/src/dictionary.js +629 -0
  41. package/dist/src/dictionary.js.map +1 -0
  42. package/dist/src/exchange.d.ts +259 -0
  43. package/dist/src/exchange.js +1088 -0
  44. package/dist/src/exchange.js.map +1 -0
  45. package/dist/src/forms.d.ts +16 -0
  46. package/dist/src/forms.js +181 -0
  47. package/dist/src/forms.js.map +1 -0
  48. package/dist/src/index.d.ts +32 -0
  49. package/dist/src/index.js +34 -0
  50. package/dist/src/index.js.map +1 -0
  51. package/dist/src/lex.d.ts +21 -0
  52. package/dist/src/lex.js +142 -0
  53. package/dist/src/lex.js.map +1 -0
  54. package/dist/src/lifecycle.d.ts +92 -0
  55. package/dist/src/lifecycle.js +451 -0
  56. package/dist/src/lifecycle.js.map +1 -0
  57. package/dist/src/log.d.ts +91 -0
  58. package/dist/src/log.js +629 -0
  59. package/dist/src/log.js.map +1 -0
  60. package/dist/src/migrate.d.ts +129 -0
  61. package/dist/src/migrate.js +415 -0
  62. package/dist/src/migrate.js.map +1 -0
  63. package/dist/src/model.d.ts +81 -0
  64. package/dist/src/model.js +188 -0
  65. package/dist/src/model.js.map +1 -0
  66. package/dist/src/packages.d.ts +372 -0
  67. package/dist/src/packages.js +1158 -0
  68. package/dist/src/packages.js.map +1 -0
  69. package/dist/src/print-text.d.ts +7 -0
  70. package/dist/src/print-text.js +223 -0
  71. package/dist/src/print-text.js.map +1 -0
  72. package/dist/src/publish.d.ts +27 -0
  73. package/dist/src/publish.js +279 -0
  74. package/dist/src/publish.js.map +1 -0
  75. package/dist/src/read-text.d.ts +10 -0
  76. package/dist/src/read-text.js +400 -0
  77. package/dist/src/read-text.js.map +1 -0
  78. package/dist/src/records.d.ts +32 -0
  79. package/dist/src/records.js +104 -0
  80. package/dist/src/records.js.map +1 -0
  81. package/dist/src/review.d.ts +22 -0
  82. package/dist/src/review.js +198 -0
  83. package/dist/src/review.js.map +1 -0
  84. package/dist/src/rules.d.ts +101 -0
  85. package/dist/src/rules.js +670 -0
  86. package/dist/src/rules.js.map +1 -0
  87. package/dist/src/schedule.d.ts +24 -0
  88. package/dist/src/schedule.js +126 -0
  89. package/dist/src/schedule.js.map +1 -0
  90. package/dist/src/std-packages.d.ts +9 -0
  91. package/dist/src/std-packages.js +268 -0
  92. package/dist/src/std-packages.js.map +1 -0
  93. package/dist/src/store.d.ts +191 -0
  94. package/dist/src/store.js +671 -0
  95. package/dist/src/store.js.map +1 -0
  96. package/dist/src/surface.d.ts +47 -0
  97. package/dist/src/surface.js +92 -0
  98. package/dist/src/surface.js.map +1 -0
  99. package/dist/src/tree.d.ts +35 -0
  100. package/dist/src/tree.js +159 -0
  101. package/dist/src/tree.js.map +1 -0
  102. package/dist/src/units-table.d.ts +1 -0
  103. package/dist/src/units-table.js +200 -0
  104. package/dist/src/units-table.js.map +1 -0
  105. package/dist/src/units.d.ts +42 -0
  106. package/dist/src/units.js +98 -0
  107. package/dist/src/units.js.map +1 -0
  108. package/dist/src/versions.d.ts +10 -0
  109. package/dist/src/versions.js +27 -0
  110. package/dist/src/versions.js.map +1 -0
  111. package/dist/src/views.d.ts +372 -0
  112. package/dist/src/views.js +1170 -0
  113. package/dist/src/views.js.map +1 -0
  114. package/package.json +60 -4
@@ -0,0 +1,531 @@
1
+ import type { Json, JsonObject } from "./model.ts";
2
+ import { type Node } from "./tree.ts";
3
+ import { type Facet } from "./defs.ts";
4
+ /** A reference an act's lines may make: the record in hand's facet, a context record (or its facet), a found
5
+ * record's facet, or the route's row's column. */
6
+ export type ActRef = {
7
+ record: string;
8
+ } | {
9
+ context: string;
10
+ facet?: string;
11
+ } | {
12
+ found: string;
13
+ facet?: string;
14
+ } | {
15
+ route: string;
16
+ column: string;
17
+ }
18
+ /** Revision 44: what the act was given, by its name. */
19
+ | {
20
+ given: string;
21
+ };
22
+ /** What a pick in a find compares a facet with: a literal, or a reference. */
23
+ export type ActPickValue = {
24
+ literal: string;
25
+ } | {
26
+ caller: true;
27
+ } | {
28
+ self: true;
29
+ } | ActRef;
30
+ export type ActPick = {
31
+ facet: string;
32
+ value: ActPickValue;
33
+ line: number;
34
+ };
35
+ /** The next label in a series (revision 26): the prefix, one more than the highest number the kind's facet
36
+ * carries after it, three digits, the suffix when given. */
37
+ export type ActSeries = {
38
+ prefix: ActRef | {
39
+ literal: string;
40
+ };
41
+ in: {
42
+ kind: string;
43
+ facet: string;
44
+ };
45
+ suffix?: ActRef;
46
+ };
47
+ /** What a set writes: a literal, a link to a found or context record, a reference's value, the moment, or the
48
+ * next in a series. */
49
+ export type ActSource = {
50
+ literal: string;
51
+ } | {
52
+ link: string;
53
+ } | {
54
+ now: true;
55
+ } | {
56
+ caller: true;
57
+ } | {
58
+ none: true;
59
+ } | {
60
+ owner: true;
61
+ } | {
62
+ run: true;
63
+ } | {
64
+ person: true;
65
+ } | {
66
+ next: ActSeries;
67
+ } | {
68
+ sum: ActSum;
69
+ } | ActRef;
70
+ /** Revision 45: one number added to or taken from another, each a reference or a number (`given.count - record.qty`,
71
+ * `record.movedCount + 1`). A reference that holds nothing reads as 0; one that holds no number refuses the act. */
72
+ export type ActOperand = {
73
+ number: number;
74
+ } | ActRef;
75
+ /** Revision 52: `*` multiplies; one side at most is money or a quantity, and the product keeps what it is of. */
76
+ export type ActSum = {
77
+ left: ActOperand;
78
+ op: "+" | "-" | "*";
79
+ right: ActOperand;
80
+ };
81
+ export type ActSet = {
82
+ facet: string;
83
+ source: ActSource;
84
+ line: number;
85
+ };
86
+ export type ActMint = {
87
+ kind: string;
88
+ sets: ActSet[];
89
+ line: number;
90
+ };
91
+ export type ActFind = {
92
+ name: string;
93
+ take: "first" | "all";
94
+ kind: string;
95
+ where: ActPick[];
96
+ order?: {
97
+ facet: string;
98
+ dir: "after" | "before";
99
+ };
100
+ /** Revision 26: the record made when a `first` find answered nothing. */
101
+ mint?: ActMint;
102
+ line: number;
103
+ };
104
+ /** Revision 26: the row of a compound facet on a record taken by its rule. */
105
+ export type ActRoute = {
106
+ name: string;
107
+ /** The compound facet the rows are read from: a context record's or the record in hand's. */
108
+ rows: ActRef;
109
+ /** The column holding each row's condition (6.3). */
110
+ by: string;
111
+ /** Whose values the conditions read, the later laid over the earlier: `record`, `record.<link facet>`. */
112
+ over: ActRef[];
113
+ /** A row holding its column's count or more of the records the picks admit is passed over. */
114
+ keep?: {
115
+ column: string;
116
+ kind: string;
117
+ where: ActPick[];
118
+ };
119
+ line: number;
120
+ };
121
+ /** Revision 26: the records of a kind the picks admit, counted, for a `when` to read by name. */
122
+ export type ActCount = {
123
+ name: string;
124
+ kind: string;
125
+ where: ActPick[];
126
+ line: number;
127
+ };
128
+ /** A term of a `when`: a reference or a count's name, with an optional number added, or a number. */
129
+ export type ActTerm = {
130
+ ref: ActRef;
131
+ plus?: number;
132
+ } | {
133
+ count: string;
134
+ plus?: number;
135
+ } | {
136
+ number: number;
137
+ };
138
+ /** What a then writes on a found record (revision 39: a link, a value copied or the facet cleared, as a set's). */
139
+ export type ActThenValue = {
140
+ literal: string;
141
+ } | {
142
+ now: true;
143
+ } | {
144
+ none: true;
145
+ } | {
146
+ link: string;
147
+ } | {
148
+ caller: true;
149
+ } | {
150
+ person: true;
151
+ } | {
152
+ sum: ActSum;
153
+ } | ActRef;
154
+ /** One comparison of a `when`. */
155
+ export type ActCond = {
156
+ left: ActTerm;
157
+ op: "=" | "!=" | "<" | ">" | "<=" | ">=";
158
+ right: ActTerm;
159
+ }
160
+ /** Revision 47: `has <ref>` holds where the reference holds a value; `no <ref>` where it holds none. */
161
+ | {
162
+ has: ActRef;
163
+ lacks?: true; /** Revision 54: `<ref> is <word>`, `<ref> is not <word>`: the value as written. */
164
+ is?: string;
165
+ };
166
+ /** A `when`: its first comparison, and (revision 45) those joined to it by `and`, all of which must hold. */
167
+ export type ActWhen = ActCond & {
168
+ and?: ActCond[];
169
+ };
170
+ /** Revision 45: a record the act makes when it lands, whatever its finds answered: `<name> -> <kind> [when …]`,
171
+ * its set lines beneath as a mint's. */
172
+ export type ActMake = {
173
+ name: string;
174
+ kind: string;
175
+ when?: ActWhen;
176
+ sets: ActSet[];
177
+ line: number;
178
+ };
179
+ export type ActThenSet = {
180
+ found: string;
181
+ facet: string;
182
+ value: ActThenValue;
183
+ };
184
+ /** Revision 47: another act run when this one has landed: `[<utility>/]<act> on record|<found> [when …]`. */
185
+ /** Revision 49: `with` gives the act run what it is given, a literal or a reference read as this act stood. */
186
+ export type ActAlso = {
187
+ utility?: string;
188
+ act: string;
189
+ on: string; /** Revision 52: run on the place's authority, the person not asked. */
190
+ asPlace?: true;
191
+ with?: {
192
+ name: string;
193
+ value: {
194
+ literal: string;
195
+ } | ActRef;
196
+ }[];
197
+ when?: ActWhen;
198
+ line: number;
199
+ };
200
+ /** An act another runs, on its record, with what it is given. */
201
+ export type ActRun = {
202
+ utility?: string;
203
+ act: string;
204
+ id: string;
205
+ asPlace?: true;
206
+ given?: {
207
+ [name: string]: Json;
208
+ };
209
+ };
210
+ export type ActThen = {
211
+ /** Absent (revision 39): the writes are made whenever the act lands. */
212
+ when?: ActWhen;
213
+ sets: ActThenSet[];
214
+ /** Revision 47: `archive <record|found>` or `restore <record|found>`: the record's standing, in place of sets. */
215
+ stand?: {
216
+ to: "archived" | "active";
217
+ on: string;
218
+ reason?: string;
219
+ };
220
+ /** Revision 26: a send run only when the condition held. */
221
+ send?: {
222
+ verb: string;
223
+ words: string;
224
+ };
225
+ line: number;
226
+ };
227
+ /** Revision 42: what the record in hand must hold (or, with `no`, lack) for the act to land; its own words when
228
+ * it is refused. */
229
+ /** Revision 51: `is` says what the value must be (`=`) or must not be (`!=`), a literal compared as text. */
230
+ export type ActNeed = {
231
+ facet: string;
232
+ lacks?: true;
233
+ is?: {
234
+ op: "=" | "!=";
235
+ value: string;
236
+ };
237
+ words?: string;
238
+ line: number;
239
+ };
240
+ /** Revision 44: a value the act is given by the person pressing it. Its type is a facet's (`as`), so what asks
241
+ * for it and what refuses it are the facet's own; `from` is what the question opens on, `default` what it takes
242
+ * when the person says nothing (and then it need not be asked). */
243
+ export type ActGiven = {
244
+ name: string;
245
+ facet: string;
246
+ words?: string;
247
+ from?: ActRef;
248
+ default?: string;
249
+ line: number;
250
+ };
251
+ export type Act = {
252
+ name: string;
253
+ version: string;
254
+ utility: string;
255
+ /** Revision 26: the act of the same utility this one stands in for. */
256
+ replaces?: string;
257
+ label?: string;
258
+ describe?: string;
259
+ on: string;
260
+ /** Revision 35: the act may land on fewer than the record holds, where its level declares its quantity. */
261
+ takes?: "share";
262
+ context: string[];
263
+ /** Revision 42: read before anything else; the first that fails stops the act before any write. */
264
+ needs?: ActNeed[];
265
+ /** Revision 44: what the act is given, each asked of the person unless it has a default. */
266
+ given?: ActGiven[];
267
+ route?: ActRoute;
268
+ finds: ActFind[];
269
+ counts: ActCount[];
270
+ sets: ActSet[];
271
+ thens: ActThen[];
272
+ /** Revision 45: the records the act makes when it lands. */
273
+ makes?: ActMake[];
274
+ /** Revision 47: the acts run when this one has landed. */
275
+ also?: ActAlso[];
276
+ /** Revision 49: the acts run before this one lands, each on its record; one that refuses stops this act. */
277
+ first?: ActAlso[];
278
+ /** A transport verb the app provides and the words after it, carried unchanged. */
279
+ send?: {
280
+ verb: string;
281
+ words: string;
282
+ };
283
+ /** When the act counts as landed: at once, or when its send reports. */
284
+ lands: "now" | "reports";
285
+ /** Revision 31: the post the act lands when the record in hand or an ancestor is followed (15.1). */
286
+ tells?: ActTells;
287
+ line: number;
288
+ };
289
+ /** `tells: post as filed`, its set lines beneath: the kind made, the aspect it answers, the values it takes. */
290
+ export type ActTells = {
291
+ kind: string;
292
+ aspect: string;
293
+ sets: ActSet[];
294
+ line: number;
295
+ };
296
+ /** `given.count != record.qty and record.qty > 0` (revision 45: `!=`, and comparisons joined by `and`). */
297
+ export declare function readWhen(text: string, line: number, routes?: Set<string>, counts?: Set<string>): ActWhen;
298
+ /** Read one `act:` block (15). */
299
+ export declare function readAct(node: Node): Act;
300
+ /** What an act's checks read; `strict` at publish for a package extending nothing, and in force at install. */
301
+ export type ActEnv = {
302
+ utilities: {
303
+ name: string;
304
+ acts: {
305
+ name: string;
306
+ }[];
307
+ }[];
308
+ levels: Set<string>;
309
+ kinds: Set<string>;
310
+ facets: Set<string>;
311
+ /** The facet itself, when the dictionary is at hand: a compound's columns and a link's type are checked by it. */
312
+ facetOf?: (key: string) => Facet | undefined;
313
+ /** The aspects the kinds declare under `follow:` (revision 31), which an act's `tells:` may answer. */
314
+ aspects?: Set<string>;
315
+ /** Revision 35: level → the facet that is its quantity (a kind's `shares:`), which `takes: share` needs. */
316
+ shares?: Map<string, string>;
317
+ /** In force (11.4): a telling whose aspect no kind in force declares is inert, never a refusal, since nobody
318
+ * can follow by an aspect nobody declares; the kind that declares it may land later. Refused at publish only. */
319
+ inertTelling?: boolean;
320
+ strict: boolean;
321
+ here: string;
322
+ };
323
+ /** Every term a `when` reads, its `and`s among them. */
324
+ export declare const termsOf: (w: ActWhen | undefined) => ActTerm[];
325
+ /** The checks (15.3). */
326
+ export declare function checkActList(acts: Act[], env: ActEnv): void;
327
+ /** A record as the act reads it: its id, its values, and its parent (`of`, 1.1) when it has one. */
328
+ export type ActRecord = {
329
+ id: string;
330
+ values: JsonObject;
331
+ of?: string;
332
+ };
333
+ export type ActInput = {
334
+ record: ActRecord;
335
+ /** The context records, by kind. */
336
+ context: {
337
+ [kind: string]: ActRecord;
338
+ };
339
+ /** The records the record in hand links to, by link facet (`record.of` → the product), for a route's `over`. */
340
+ linked?: {
341
+ [facet: string]: ActRecord;
342
+ };
343
+ /** The row the route took, when it routes. */
344
+ route?: {
345
+ index: number;
346
+ row: JsonObject;
347
+ };
348
+ /** What each find answered (or minted), by name: one or more records; a `first` find answered takes the first. */
349
+ found: {
350
+ [name: string]: ActRecord[];
351
+ };
352
+ /** The counts answered, by name (the records of the kind the picks admit, as the host counted them). */
353
+ counts?: {
354
+ [name: string]: number;
355
+ };
356
+ /** The labels a series reads, by `<kind>.<facet>`: what the kind's facet carries today. */
357
+ labels?: {
358
+ [kindFacet: string]: string[];
359
+ };
360
+ /** The moment, as the host stamps it. */
361
+ now: string;
362
+ /** The person running the act (revision 29): what `link caller` links to. */
363
+ caller?: string;
364
+ /** The owner the act lands at (revision 31): what a told post's `owner` source carries. */
365
+ owner?: string;
366
+ /** The act run's id (revision 31): what a told post's `run` source carries. */
367
+ run?: string;
368
+ /** Revision 44: what the act was given, by name, defaults filled (`givenOf`). */
369
+ given?: {
370
+ [name: string]: Json;
371
+ };
372
+ /** Revision 44: the facets, so a given its facet refuses stops the act before any write. */
373
+ facetOf?: (key: string) => Facet | undefined;
374
+ /** Revision 48: the names of the act's makes, which a link may name; `actWrites` fills it. */
375
+ made?: string[];
376
+ /** The facets that are marks (revision 34): those a marked filter in force names. A mark is taken once. */
377
+ marks?: string[];
378
+ };
379
+ export type ActWrites = {
380
+ ok: true;
381
+ record: JsonObject;
382
+ /** The record's facets a set clears (`none`, revision 29): taken off, since a value is never null. */
383
+ clear: string[];
384
+ /** Each found record's writes; `clear` (revision 39) the facets a then gives back, taken off as the record's are. */
385
+ then: {
386
+ id: string;
387
+ values: JsonObject;
388
+ clear?: string[];
389
+ }[];
390
+ /** Revision 45: the records to make, in the order written, for the host to make in the act's own entry;
391
+ * present where the act declares a make. */
392
+ makes?: {
393
+ name: string;
394
+ kind: string;
395
+ values: JsonObject;
396
+ }[];
397
+ /** Revision 47: the records whose standing the act changes, for the host to write in the act's own entry;
398
+ * present where a then archives or restores. */
399
+ stands?: {
400
+ id: string;
401
+ to: "archived" | "active";
402
+ reason?: string;
403
+ }[];
404
+ /** Revision 47: the acts to run once this one has landed, each on its record; present where the act says also. */
405
+ also?: ActRun[];
406
+ sends: {
407
+ verb: string;
408
+ words: string;
409
+ }[];
410
+ } | {
411
+ ok: false;
412
+ why: string;
413
+ };
414
+ /** Whether a `when` holds as the input stands: every comparison of it. A term that reads no number holds nowhere. */
415
+ export declare const whenHolds: (when: ActWhen | undefined, on: ActInput) => boolean;
416
+ /** The rows a route reads, as the record carries them: a compound's rows, each an object. */
417
+ export declare function routeRowsOf(r: ActRoute, i: Pick<ActInput, "record" | "context" | "found" | "route">): JsonObject[];
418
+ /** The picks of a route's count for one row, resolved for the host to run (the row's columns read as the row
419
+ * being weighed). */
420
+ export declare function routeCountPicksOf(r: ActRoute, i: Omit<ActInput, "found" | "now" | "route"> & {
421
+ found?: ActInput["found"];
422
+ }, row: JsonObject): {
423
+ facet: string;
424
+ value: Json | undefined;
425
+ }[];
426
+ export type Routed = {
427
+ ok: true;
428
+ index: number;
429
+ row: JsonObject;
430
+ why: string;
431
+ } | {
432
+ ok: false;
433
+ why: string;
434
+ };
435
+ /** The row a route takes (15.1): the rack in order, each row's condition over the values laid as `over` says; the
436
+ * last row the catch-all; a row whose count is its keep or more passed over. `counts` are the host's answers to
437
+ * `routeCountPicksOf` per row, when the route keeps. Pure. */
438
+ export declare function routeOf(r: ActRoute, i: Omit<ActInput, "found" | "route"> & {
439
+ found?: ActInput["found"];
440
+ }, counts?: (number | undefined)[]): Routed;
441
+ /** The next label in a series (15.1): the prefix, one more than the highest number carried after it, three
442
+ * digits, the suffix when given. Pure. */
443
+ export declare function nextInSeries(prefix: string, suffix: string | undefined, labels: string[]): string;
444
+ /** The values a mint makes (15.1), given the row taken, the context and the labels its series reads. Pure. */
445
+ export declare function mintValuesOf(f: ActFind, i: ActInput): {
446
+ ok: true;
447
+ kind: string;
448
+ values: JsonObject;
449
+ } | {
450
+ ok: false;
451
+ why: string;
452
+ };
453
+ /** The post an act tells when it lands followed (15.1, revision 31): the kind, the aspect and the values, given the
454
+ * owner and the act run's id. The app asks `followersOn` first; with no follower on the record or its ancestors,
455
+ * nothing is made. Pure. */
456
+ export declare function tellsValuesOf(a: Act, i: ActInput): {
457
+ ok: true;
458
+ kind: string;
459
+ aspect: string;
460
+ values: JsonObject;
461
+ } | {
462
+ ok: false;
463
+ why: string;
464
+ };
465
+ /** What an act is given (15.1, revision 44), from what the person said: each given takes what was said, else its
466
+ * default. `asks` names the ones still to ask (no word said and no default); `opens` is what each question opens
467
+ * on (what was said, else its `from` as the record and the context stand, else its default). With the facets at
468
+ * hand (`facetOf`), a value its facet refuses is `refused` with its words, and is not among the values: a word
469
+ * where a number goes, a number outside the facet's range, a choice the facet lacks. Pure. */
470
+ export declare function givenOf(a: Pick<Act, "given">, told: {
471
+ [name: string]: Json | undefined;
472
+ }, i: Pick<ActInput, "record" | "context">, facetOf?: (key: string) => Facet | undefined): {
473
+ values: {
474
+ [name: string]: Json;
475
+ };
476
+ asks: string[];
477
+ opens: {
478
+ [name: string]: Json;
479
+ };
480
+ refused: {
481
+ name: string;
482
+ why: string;
483
+ }[];
484
+ };
485
+ /** The writes an act makes when it lands (15): pure, given what the finds answered or minted. A `first` find
486
+ * that answered nothing stops the act with the reason, before any write. */
487
+ export declare function actWrites(a: Act, i: ActInput): ActWrites;
488
+ /**
489
+ * A share of a record (revision 35): `take` of the quantity its level declares. All of it is the record itself;
490
+ * fewer is a split, the count the new record takes and the count the first keeps, for the host to write in the
491
+ * act's own entry (a new record of the same level under the same parent, carrying every value of the first).
492
+ * None, more than it holds, or a count that is no whole number is refused.
493
+ */
494
+ export declare function shareOf(record: ActRecord, facet: string, take: number): {
495
+ ok: true;
496
+ whole: true;
497
+ } | {
498
+ ok: true;
499
+ whole: false;
500
+ taken: string;
501
+ rest: string;
502
+ } | {
503
+ ok: false;
504
+ why: string;
505
+ };
506
+ /**
507
+ * The facets that are marks (12.3, revision 34): those a marked filter names. A host hands them to `actWrites`
508
+ * so a second write to a mark is refused where the act lands.
509
+ */
510
+ export declare function markFacets(filters: Iterable<{
511
+ facet: string;
512
+ marked?: boolean;
513
+ }>): string[];
514
+ /** Revision 49: the acts to run before this one lands, each on its record. The host runs them in order, stops
515
+ * the act with the reason of the first that refuses, and reads the act's finds again before it lands. */
516
+ export declare function firstOf(a: Act, i: ActInput): ActRun[];
517
+ /** The picks of a find or a count resolved for the host to run: a literal, or the referenced value as it stands.
518
+ * A pick's facet may be `<link>.<facet>`, carried as written for the host to hop. */
519
+ export declare function findPicksOf(f: {
520
+ where: ActPick[];
521
+ }, i: Omit<ActInput, "found" | "now"> & {
522
+ found?: ActInput["found"];
523
+ }): {
524
+ facet: string;
525
+ value: Json | undefined;
526
+ }[];
527
+ export declare const whenJson: (w: ActWhen) => JsonObject;
528
+ export declare function actJson(a: Act): JsonObject;
529
+ export declare const whenText: (w: JsonObject) => string;
530
+ /** The text of an act's JSON form, as the bundle prints it back. */
531
+ export declare function actText(a: JsonObject): string[];