@cruba/crubal 0.0.0-stage → 0.1.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 (63) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +69 -2
  3. package/dist/bin/crubal.d.ts +2 -0
  4. package/dist/bin/crubal.js +37 -0
  5. package/dist/bin/crubal.js.map +1 -0
  6. package/dist/src/browser.d.ts +10 -0
  7. package/dist/src/browser.js +13 -0
  8. package/dist/src/browser.js.map +1 -0
  9. package/dist/src/canonical.d.ts +6 -0
  10. package/dist/src/canonical.js +47 -0
  11. package/dist/src/canonical.js.map +1 -0
  12. package/dist/src/conditions.d.ts +22 -0
  13. package/dist/src/conditions.js +175 -0
  14. package/dist/src/conditions.js.map +1 -0
  15. package/dist/src/corpus.d.ts +8 -0
  16. package/dist/src/corpus.js +673 -0
  17. package/dist/src/corpus.js.map +1 -0
  18. package/dist/src/defs.d.ts +116 -0
  19. package/dist/src/defs.js +530 -0
  20. package/dist/src/defs.js.map +1 -0
  21. package/dist/src/dictionary.d.ts +50 -0
  22. package/dist/src/dictionary.js +498 -0
  23. package/dist/src/dictionary.js.map +1 -0
  24. package/dist/src/exchange.d.ts +45 -0
  25. package/dist/src/exchange.js +321 -0
  26. package/dist/src/exchange.js.map +1 -0
  27. package/dist/src/index.d.ts +15 -0
  28. package/dist/src/index.js +17 -0
  29. package/dist/src/index.js.map +1 -0
  30. package/dist/src/lex.d.ts +21 -0
  31. package/dist/src/lex.js +142 -0
  32. package/dist/src/lex.js.map +1 -0
  33. package/dist/src/migrate.d.ts +88 -0
  34. package/dist/src/migrate.js +191 -0
  35. package/dist/src/migrate.js.map +1 -0
  36. package/dist/src/model.d.ts +36 -0
  37. package/dist/src/model.js +32 -0
  38. package/dist/src/model.js.map +1 -0
  39. package/dist/src/packages.d.ts +25 -0
  40. package/dist/src/packages.js +98 -0
  41. package/dist/src/packages.js.map +1 -0
  42. package/dist/src/print-text.d.ts +7 -0
  43. package/dist/src/print-text.js +194 -0
  44. package/dist/src/print-text.js.map +1 -0
  45. package/dist/src/read-text.d.ts +8 -0
  46. package/dist/src/read-text.js +317 -0
  47. package/dist/src/read-text.js.map +1 -0
  48. package/dist/src/rules.d.ts +64 -0
  49. package/dist/src/rules.js +486 -0
  50. package/dist/src/rules.js.map +1 -0
  51. package/dist/src/store.d.ts +133 -0
  52. package/dist/src/store.js +396 -0
  53. package/dist/src/store.js.map +1 -0
  54. package/dist/src/tree.d.ts +32 -0
  55. package/dist/src/tree.js +123 -0
  56. package/dist/src/tree.js.map +1 -0
  57. package/dist/src/units.d.ts +4 -0
  58. package/dist/src/units.js +37 -0
  59. package/dist/src/units.js.map +1 -0
  60. package/dist/src/views.d.ts +114 -0
  61. package/dist/src/views.js +436 -0
  62. package/dist/src/views.js.map +1 -0
  63. package/package.json +58 -4
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Chris Thompson
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
package/README.md CHANGED
@@ -1,3 +1,70 @@
1
- # Temporary Holding Version
1
+ # @cruba/crubal
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The CRUBAL reference implementation. Pure functions, JSON in and JSON out, so a compiled core can replace
4
+ the internals later behind the same API.
5
+
6
+ **Level reached: Views**, every chapter of the spec (1–13). Conformance claim: `CRUBAL 2 · Views · corpus 2026-10-14`.
7
+
8
+ - **Reader:** the text form and JSON both ways, facet types, unknown keys kept exactly, plain-words refusals
9
+ with line numbers.
10
+ - **Dictionary:** full definitions, publish checks on facets and classes, resolution by meet, alias and unit
11
+ folding, value checks against facets and worn classes.
12
+ - **Rules:** rule blocks and facet shortcuts, publish checks (layered by address, no contradictions, one
13
+ spelling), and an engine that runs writes in order: refused, held, filled (including a failing gate's
14
+ `-`), derived (templates with `??` and `?`, rollups), flagged, incomplete, complete and completeness, with
15
+ value-state tests and global uniqueness.
16
+
17
+ - **Store:** hash-linked logs with redaction, intake through receive contracts (map, value maps, aliases,
18
+ shapes, ignore, keep-raw; raw bytes and their hash kept), landing by the trust order with alternatives,
19
+ matching parts before minting rows, evidence validation (independent witnesses, vetoes, version-split
20
+ proposals), and migration recipes with restamping and a review queue.
21
+
22
+ - **Exchange:** contract publish checks (parts per kind, defined facets, real values in value maps,
23
+ credentials as names only), runs in steps (`who` with roles, needs, map out with nested paths, value maps
24
+ and literals, act once per payload), receive runs that compare with the record and land by trust or as
25
+ suggestions, offer and take where only the overlap flows and a person's values are never overridden,
26
+ border wrappers verified against the presenter's key and its log, and package checks (prefixes, trust
27
+ entries, extending without changing).
28
+
29
+ - **Views:** shapes as maps into slots (addresses, aggregates over lower levels, templates, required
30
+ slots), views with selection, context (`of`), pins, hides, order and pages, filters as sub-indexes with
31
+ range and value buckets and counts that follow the other picks, indexable landing pages, audiences and
32
+ `shown to` rules (new and unknown values never public), roles that narrow an audience, the portable shape,
33
+ and read sets that decide which rows a write makes stale.
34
+
35
+ It passes every corpus folder (87 cases).
36
+
37
+ Store also checks Ed25519 signatures against the owner's published key, replays intake records from their
38
+ kept bytes (deterministically, keeping earlier outcomes), reviews unknown and new values by key across all
39
+ records and proposes candidate facets by recurrence, keeps non-UTF-8 payloads as base64, and lands values by
40
+ the package's own trust order and facets' orders.
41
+
42
+ ```sh
43
+ npm test # unit tests and the Reader corpus
44
+ node bin/crubal.ts test ../../corpus --level views # the corpus runner, case by case
45
+ node bin/crubal.ts read data.crubal --defs facets.crubal
46
+ node bin/crubal.ts print data.json --defs facets.crubal [--plain]
47
+ ```
48
+
49
+ Needs Node 23.6 or later (it runs the TypeScript directly).
50
+
51
+ | File | Does |
52
+ |---|---|
53
+ | `src/tree.ts` | lines, comments, indentation, the pair separator (chapter 2.1) |
54
+ | `src/lex.ts` | quoting, details and short lists (2.5–2.7) |
55
+ | `src/defs.ts` | what the Reader needs from definitions: types, how many, units, rows, levels (4.2, 4.5, 11.2) |
56
+ | `src/read-text.ts` | text to the JSON form (2, 3) |
57
+ | `src/print-text.ts` | the JSON form to canonical text (2.9) |
58
+ | `src/canonical.ts` | canonical JSON with sets sorted (3.9) |
59
+ | `src/dictionary.ts` | definitions as JSON, publish checks, resolution, folding, value checks (4, 5) |
60
+ | `src/conditions.ts` | conditions with three-valued empties (6.3) |
61
+ | `src/units.ts` | a starter units table, until the standard units package exists |
62
+ | `src/rules.ts` | rules, shortcuts, rule-set checks and the write engine (6) |
63
+ | `src/store.ts` | logs, receive contracts and intake, landing and trust, part matching, evidence (8, 9) |
64
+ | `src/migrate.ts` | migration recipes, checks and restamping (10) |
65
+ | `src/exchange.ts` | contract checks, runs, offer and take, borders (7, 8.5.1) |
66
+ | `src/packages.ts` | package files: prefixes, trust entries, extending (11) |
67
+ | `src/views.ts` | shapes, views, filters, audiences and roles, projections and staleness (12) |
68
+ | `src/corpus.ts` | the conformance runner (13) |
69
+
70
+ Next: make the repo public, publish `@cruba/crubal`, and start crubal.com.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ // crubal: read, print and test CRUBAL.
3
+ // crubal test <corpus> [--level reader] run a level's corpus folders
4
+ // crubal read <file> --defs <file>... text to JSON
5
+ // crubal print <file.json> --defs <file>... JSON to text
6
+ import { readFileSync } from "node:fs";
7
+ import { canonical, emptyDictionary, printText, readDefinitions, readText, runCorpus } from "../src/index.js";
8
+ const [cmd, target, ...rest] = process.argv.slice(2);
9
+ const flag = (name) => rest.flatMap((a, i) => (a === name ? [rest[i + 1]] : []));
10
+ function dictionary() {
11
+ const dict = emptyDictionary();
12
+ for (const f of flag("--defs"))
13
+ readDefinitions(readFileSync(f, "utf8"), dict);
14
+ return dict;
15
+ }
16
+ if (cmd === "test" && target) {
17
+ const level = flag("--level")[0] ?? "reader";
18
+ const results = runCorpus(target, level);
19
+ for (const r of results)
20
+ console.log(`${r.pass ? "pass" : "FAIL"} ${r.folder}/${r.name}${r.detail ? ` ${r.detail}` : ""}`);
21
+ const failed = results.filter((r) => !r.pass).length;
22
+ console.log(`\n${results.length - failed}/${results.length} passed (${level})`);
23
+ process.exit(failed ? 1 : 0);
24
+ }
25
+ else if (cmd === "read" && target) {
26
+ const dict = dictionary();
27
+ const w = readText(readFileSync(target, "utf8"), dict);
28
+ console.log(rest.includes("--canonical") ? canonical(w, dict) : JSON.stringify(w, null, 2));
29
+ }
30
+ else if (cmd === "print" && target) {
31
+ console.log(printText(JSON.parse(readFileSync(target, "utf8")), dictionary(), rest.includes("--plain") ? "plain" : "full"));
32
+ }
33
+ else {
34
+ console.log("usage: crubal test <corpus> [--level reader] | crubal read <file> --defs <file> | crubal print <file.json> --defs <file>");
35
+ process.exit(2);
36
+ }
37
+ //# sourceMappingURL=crubal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crubal.js","sourceRoot":"","sources":["../../bin/crubal.ts"],"names":[],"mappings":";AACA,uCAAuC;AACvC,yEAAyE;AACzE,0DAA0D;AAC1D,2DAA2D;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG9G,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACrD,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEnG,SAAS,UAAU;IACjB,MAAM,IAAI,GAAG,eAAe,EAAE,CA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C;IACvD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC9F,CAAC;KAAM,IAAI,GAAG,KAAK,OAAO,IAAI,MAAM,EAAE,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAY,EAAE,UAAU,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AACzI,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,GAAG,CAAC,0HAA0H,CAAC,CAAC;IACxI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
@@ -0,0 +1,10 @@
1
+ export { CrubalError, readTree } from "./tree.ts";
2
+ export { readDefinitions, emptyDictionary, type ClassDef, type Dictionary, type Facet } from "./defs.ts";
3
+ export { readText } from "./read-text.ts";
4
+ export { printText, type PrintMode } from "./print-text.ts";
5
+ export { canonical, serialize } from "./canonical.ts";
6
+ export { checkWrapper, type Wrapper, type Record, type Json } from "./model.ts";
7
+ export { checkPackage, checkRecord, facetJson, foldKey, foldRecord, resolve, resolvedJson, type Outcome } from "./dictionary.ts";
8
+ export { evaluate, parseCondition, type Truth } from "./conditions.ts";
9
+ export { checkRules, Engine, readRules, shortcutRules, type Result, type Rule } from "./rules.ts";
10
+ export { checkViews, readViews, Views } from "./views.ts";
@@ -0,0 +1,13 @@
1
+ // @cruba/crubal/browser: the pure levels, with nothing from Node (no file system, no crypto). For pages,
2
+ // playgrounds and edge runtimes. Store and Exchange need Node's crypto and stay in the main entry.
3
+ export { CrubalError, readTree } from "./tree.js";
4
+ export { readDefinitions, emptyDictionary } from "./defs.js";
5
+ export { readText } from "./read-text.js";
6
+ export { printText } from "./print-text.js";
7
+ export { canonical, serialize } from "./canonical.js";
8
+ export { checkWrapper } from "./model.js";
9
+ export { checkPackage, checkRecord, facetJson, foldKey, foldRecord, resolve, resolvedJson } from "./dictionary.js";
10
+ export { evaluate, parseCondition } from "./conditions.js";
11
+ export { checkRules, Engine, readRules, shortcutRules } from "./rules.js";
12
+ export { checkViews, readViews, Views } from "./views.js";
13
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA,yGAAyG;AACzG,mGAAmG;AAEnG,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,eAAe,EAA8C,MAAM,WAAW,CAAC;AACzG,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAkB,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAwC,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAgB,MAAM,iBAAiB,CAAC;AACjI,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAc,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAA0B,MAAM,YAAY,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Dictionary } from "./defs.ts";
2
+ import type { Json, Wrapper } from "./model.ts";
3
+ /** Serialize with sorted keys. Numbers in CRUBAL JSON are strings, so JSON.stringify's number form is enough. */
4
+ export declare function serialize(v: Json): string;
5
+ /** The canonical form of a wrapper, as a string. */
6
+ export declare function canonical(w: Wrapper, dict: Dictionary): string;
@@ -0,0 +1,47 @@
1
+ // canonical.ts: canonical JSON (spec chapter 3.9). Sets are sorted, ordered lists keep their order, and
2
+ // the result is serialized RFC 8785 style: object keys sorted by UTF-16 code units, no white space.
3
+ const isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
4
+ /** Serialize with sorted keys. Numbers in CRUBAL JSON are strings, so JSON.stringify's number form is enough. */
5
+ export function serialize(v) {
6
+ if (Array.isArray(v))
7
+ return `[${v.map(serialize).join(",")}]`;
8
+ if (isObj(v)) {
9
+ const keys = Object.keys(v).sort();
10
+ return `{${keys.map((k) => `${JSON.stringify(k)}:${serialize(v[k])}`).join(",")}}`;
11
+ }
12
+ return JSON.stringify(v);
13
+ }
14
+ function sortSets(v, f, dict) {
15
+ if (!f)
16
+ return v;
17
+ if (Array.isArray(v)) {
18
+ const items = v.map((item) => (f.type === "compound" ? fields(item, f.children, dict) : item));
19
+ return f.ordered ? items : [...items].sort((a, b) => (serialize(a) < serialize(b) ? -1 : serialize(a) > serialize(b) ? 1 : 0));
20
+ }
21
+ if (f.type === "compound")
22
+ return fields(v, f.children, dict);
23
+ return v;
24
+ }
25
+ function fields(v, within, dict) {
26
+ if (!isObj(v))
27
+ return v;
28
+ const out = {};
29
+ for (const [k, x] of Object.entries(v)) {
30
+ const f = within ? within.get(k) : dict.facets.get(k);
31
+ out[k] = sortSets(x, f, dict);
32
+ }
33
+ return out;
34
+ }
35
+ /** The canonical form of a wrapper, as a string. */
36
+ export function canonical(w, dict) {
37
+ const records = w.records.map((r) => {
38
+ const out = { ...r };
39
+ out.values = fields(r.values, null, dict);
40
+ if (r.parts) {
41
+ out.parts = r.parts.map((p) => (isObj(p) && isObj(p.values) ? { ...p, values: fields(p.values, null, dict) } : p));
42
+ }
43
+ return out;
44
+ });
45
+ return serialize({ ...w, records });
46
+ }
47
+ //# sourceMappingURL=canonical.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical.js","sourceRoot":"","sources":["../../src/canonical.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,oGAAoG;AAKpG,MAAM,KAAK,GAAG,CAAC,CAAmB,EAAmB,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAEjH,iHAAiH;AACjH,MAAM,UAAU,SAAS,CAAC,CAAO;IAC/B,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAC/D,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACb,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACnC,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,CAAS,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAC7F,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC;AAED,SAAS,QAAQ,CAAC,CAAO,EAAE,CAAoB,EAAE,IAAgB;IAC/D,IAAI,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IACjB,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,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GAAG,CAAC;AACb,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,SAAS,CAAC,CAAU,EAAE,IAAgB;IACpD,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QAClC,MAAM,GAAG,GAAe,EAAE,GAAI,CAA2B,EAAE,CAAC;QAC5D,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;YACZ,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACrH,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;IACH,OAAO,SAAS,CAAC,EAAE,GAAI,CAA2B,EAAE,OAAO,EAAgB,CAAC,CAAC;AAC/E,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { JsonObject } from "./model.ts";
2
+ export type Truth = true | false | "undetermined";
3
+ /** What a condition can know beyond values: each address's states (6.3.2). */
4
+ export type StateOf = (path: string) => Set<string>;
5
+ export declare const STATES: Set<string>;
6
+ export type Expr = {
7
+ op: "and" | "or";
8
+ a: Expr;
9
+ b: Expr;
10
+ } | {
11
+ op: "not";
12
+ a: Expr;
13
+ } | {
14
+ op: "test";
15
+ path: string;
16
+ verb: string;
17
+ arg: string;
18
+ };
19
+ export declare function parseCondition(text: string, line?: number): Expr;
20
+ export declare function evaluate(e: Expr, values: JsonObject, states?: StateOf): Truth;
21
+ /** The keys a condition reads, for layering checks. */
22
+ export declare function reads(e: Expr): string[];
@@ -0,0 +1,175 @@
1
+ // conditions.ts: the condition language (spec chapter 6.3) with three-valued empties (6.3.1). A test on
2
+ // an absent or unknown value is undetermined; `-` makes a test false, except `is -`. The Dictionary level
3
+ // uses it for class lines' `when`; the Rules level for rules.
4
+ import { CrubalError } from "./tree.js";
5
+ export const STATES = new Set(["confirmed", "contradicted", "unobserved", "conflicted", "new", "held", "adopted", "suggested"]);
6
+ const VERBS = [" shown to ", " may ", " wears ", " is not ", " is ", " in ", " has", " before ", " after ", " over ", " under "];
7
+ /** Split on a word outside parentheses and quotes. */
8
+ function splitWord(s, word) {
9
+ const out = [];
10
+ let depth = 0;
11
+ let quoted = false;
12
+ let cur = "";
13
+ for (let i = 0; i < s.length; i++) {
14
+ const ch = s[i];
15
+ if (ch === '"')
16
+ quoted = !quoted;
17
+ if (!quoted && ch === "(")
18
+ depth++;
19
+ if (!quoted && ch === ")")
20
+ depth--;
21
+ if (!quoted && depth === 0 && s.startsWith(word, i)) {
22
+ out.push(cur);
23
+ cur = "";
24
+ i += word.length - 1;
25
+ continue;
26
+ }
27
+ cur += ch;
28
+ }
29
+ out.push(cur);
30
+ return out.map((x) => x.trim());
31
+ }
32
+ export function parseCondition(text, line) {
33
+ const s = text.trim();
34
+ const ors = splitWord(s, " or ");
35
+ if (ors.length > 1)
36
+ return ors.map((x) => parseCondition(x, line)).reduce((a, b) => ({ op: "or", a, b }));
37
+ const ands = splitWord(s, " and ");
38
+ if (ands.length > 1)
39
+ return ands.map((x) => parseCondition(x, line)).reduce((a, b) => ({ op: "and", a, b }));
40
+ if (s.startsWith("not "))
41
+ return { op: "not", a: parseCondition(s.slice(4), line) };
42
+ if (s.startsWith("(") && s.endsWith(")"))
43
+ return parseCondition(s.slice(1, -1), line);
44
+ for (const v of VERBS) {
45
+ const at = s.indexOf(v);
46
+ if (at > 0)
47
+ return { op: "test", path: s.slice(0, at).trim(), verb: v.trim(), arg: s.slice(at + v.length).trim() };
48
+ }
49
+ if (s.endsWith(" has"))
50
+ return { op: "test", path: s.slice(0, -4).trim(), verb: "has", arg: "" };
51
+ throw new CrubalError(`can't read the condition "${text}"`, line);
52
+ }
53
+ const isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
54
+ const unq = (s) => (s.startsWith('"') ? JSON.parse(s) : s);
55
+ /** The plain text of a value, for comparing with what a condition writes. */
56
+ function plain(v) {
57
+ if (typeof v === "string")
58
+ return v;
59
+ if (typeof v === "boolean")
60
+ return v ? "yes" : "no";
61
+ if (isObj(v)) {
62
+ if ("$value" in v)
63
+ return plain(v.$value);
64
+ if ("$link" in v)
65
+ return `&${v.$link}`;
66
+ if ("$qty" in v)
67
+ return `${v.$qty}${v.unit}`;
68
+ if ("$money" in v)
69
+ return `${v.$money}${v.currency}`;
70
+ }
71
+ return JSON.stringify(v);
72
+ }
73
+ function emptyOf(v) {
74
+ if (v === undefined)
75
+ return "absent";
76
+ if (isObj(v) && "$empty" in v)
77
+ return v.$empty === "unknown" ? "unknown" : "n/a";
78
+ return null;
79
+ }
80
+ /** A path's value, including aggregates: `count of languages`, `least of prices`, `most of …`, `sum of …`. */
81
+ function valueAt(values, path) {
82
+ const agg = path.match(/^(count|least|most|sum) of (.+)$/);
83
+ if (!agg)
84
+ return values[path];
85
+ const v = values[agg[2]];
86
+ const items = v === undefined || emptyOf(v) ? [] : Array.isArray(v) ? v : [v];
87
+ if (agg[1] === "count")
88
+ return String(items.length);
89
+ if (!items.length)
90
+ return undefined;
91
+ const nums = items.map((x) => Number.parseFloat(plain(x)));
92
+ if (agg[1] === "least")
93
+ return String(Math.min(...nums));
94
+ if (agg[1] === "most")
95
+ return String(Math.max(...nums));
96
+ return String(nums.reduce((a, b) => a + b, 0));
97
+ }
98
+ function test(e, values, states) {
99
+ if (e.verb === "is" && STATES.has(e.arg))
100
+ return states ? states(e.path).has(e.arg) : false;
101
+ // `caller may run listing`, `caller wears Staff` (chapter 7.6): what the caller is, not a value.
102
+ if (e.verb === "may" || e.verb === "wears")
103
+ return states ? states(e.path).has(`${e.verb}:${e.arg}`) : false;
104
+ // `cost shown to staff` declares visibility (chapter 12.4); views apply it, so as a check it holds.
105
+ if (e.verb === "shown to")
106
+ return true;
107
+ const v = valueAt(values, e.path);
108
+ const empty = emptyOf(v);
109
+ if (e.verb === "has") {
110
+ if (empty)
111
+ return false;
112
+ if (!e.arg)
113
+ return true;
114
+ const items = Array.isArray(v) ? v : [v];
115
+ return items.some((x) => plain(x) === unq(e.arg));
116
+ }
117
+ if (e.verb === "is" && e.arg === "_")
118
+ return empty === "unknown";
119
+ if (e.verb === "is" && e.arg === "-")
120
+ return empty === "n/a";
121
+ if (empty === "absent" || empty === "unknown")
122
+ return "undetermined";
123
+ if (empty === "n/a")
124
+ return false;
125
+ const items = (Array.isArray(v) ? v : [v]).map(plain);
126
+ if (e.verb === "is")
127
+ return items.includes(unq(e.arg));
128
+ if (e.verb === "is not")
129
+ return !items.includes(unq(e.arg));
130
+ if (e.verb === "in") {
131
+ const range = e.arg.match(/^(-?[\d.]+)\.\.(-?[\d.]+)$/);
132
+ if (range)
133
+ return items.some((x) => Number.parseFloat(x) >= Number(range[1]) && Number.parseFloat(x) <= Number(range[2]));
134
+ const set = e.arg.split(",").map((x) => unq(x.trim()));
135
+ return items.some((x) => set.includes(x));
136
+ }
137
+ const n = Number.parseFloat(items[0] ?? "");
138
+ const m = Number.parseFloat(e.arg);
139
+ if (e.verb === "over")
140
+ return n > m;
141
+ if (e.verb === "under")
142
+ return n < m;
143
+ if (e.verb === "before")
144
+ return (items[0] ?? "") < e.arg;
145
+ if (e.verb === "after")
146
+ return (items[0] ?? "") > e.arg;
147
+ return "undetermined";
148
+ }
149
+ export function evaluate(e, values, states) {
150
+ if (e.op === "test")
151
+ return test(e, values, states);
152
+ if (e.op === "not") {
153
+ const a = evaluate(e.a, values, states);
154
+ return a === "undetermined" ? a : !a;
155
+ }
156
+ const a = evaluate(e.a, values, states);
157
+ const b = evaluate(e.b, values, states);
158
+ if (e.op === "and") {
159
+ if (a === false || b === false)
160
+ return false;
161
+ return a === true && b === true ? true : "undetermined";
162
+ }
163
+ if (a === true || b === true)
164
+ return true;
165
+ return a === false && b === false ? false : "undetermined";
166
+ }
167
+ /** The keys a condition reads, for layering checks. */
168
+ export function reads(e) {
169
+ if (e.op === "test")
170
+ return [e.path];
171
+ if (e.op === "not")
172
+ return reads(e.a);
173
+ return [...reads(e.a), ...reads(e.b)];
174
+ }
175
+ //# sourceMappingURL=conditions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditions.js","sourceRoot":"","sources":["../../src/conditions.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,0GAA0G;AAC1G,8DAA8D;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAOxC,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;AAOhI,MAAM,KAAK,GAAG,CAAC,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAEjI,sDAAsD;AACtD,SAAS,SAAS,CAAC,CAAS,EAAE,IAAY;IACxC,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAW,CAAC;QAC1B,IAAI,E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GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export type CaseResult = {
2
+ folder: string;
3
+ name: string;
4
+ pass: boolean;
5
+ detail?: string;
6
+ };
7
+ /** Run one level's corpus folders under `root`. */
8
+ export declare function runCorpus(root: string, level: string): CaseResult[];