@altopelago/sansa 0.9.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/CHANGELOG.md ADDED
@@ -0,0 +1,41 @@
1
+ # Changelog
2
+
3
+ All notable changes to this package are documented here.
4
+
5
+ This project follows Semantic Versioning while it remains pre-1.0. Minor
6
+ versions may still include breaking changes when the SANSA specifications move.
7
+
8
+ ## 0.9.0 - 2026-07-24
9
+
10
+ Initial public pre-1.0 release of `@altopelago/sansa`.
11
+
12
+ ### Added
13
+
14
+ - SANSA Address parser and canonical renderer.
15
+ - SANSA Resolve over host-supplied namespace adapters.
16
+ - SANSA.Query parser and bounded evaluator.
17
+ - Shared AEON Value Semantics minimum consumer operations.
18
+ - Query CLI and browser workbench for technical testing.
19
+ - Host-neutral JSON fixture support for the Query tool.
20
+ - Optional AEON TypeScript Core integration for `.aeon` fixtures.
21
+ - CTS runners for value semantics, address parsing, resolve, and query.
22
+ - Address stress-test fixtures for legal and illegal SANSA cases.
23
+ - Capability metadata in `docs/capabilities.json`.
24
+
25
+ ### Experimental
26
+
27
+ - Query `validation` policy.
28
+ - `SANSA.Transform` helpers: `objectFrom` and `fieldsFrom`.
29
+ - Browser Query workbench for technical exploration.
30
+
31
+ ### Security
32
+
33
+ - Public release repository hardening docs: security policy, governance,
34
+ contributing guide, and code of conduct.
35
+ - CI, dependency review, Dependabot, pinned GitHub Actions, and package
36
+ dry-run verification.
37
+
38
+ ### Notes
39
+
40
+ - SANSA is versioned independently from AEON.
41
+ - Query and transform surfaces are still expected to evolve before 1.0.
@@ -0,0 +1,28 @@
1
+ # Code of Conduct
2
+
3
+ This repository expects respectful, good-faith participation.
4
+
5
+ ## Expected behavior
6
+
7
+ - be respectful in issues, pull requests, reviews, and discussions
8
+ - assume good intent while still being precise and honest
9
+ - keep technical disagreement focused on the work, not the person
10
+ - avoid harassment, abuse, intimidation, dogpiling, or personal attacks
11
+ - avoid publishing private or sensitive information without consent
12
+
13
+ ## Scope
14
+
15
+ This applies to repository spaces such as issues, pull requests, reviews, and
16
+ other project communication channels attached to this codebase.
17
+
18
+ ## Enforcement
19
+
20
+ The repository is maintained under the single-maintainer model described in
21
+ [GOVERNANCE.md](./GOVERNANCE.md). The maintainer may moderate discussion,
22
+ request changes in behavior, lock conversations, or remove contributions that
23
+ do not meet these expectations.
24
+
25
+ ## Reporting
26
+
27
+ If conduct in this repository crosses a line, report it through the most direct
28
+ maintainer-visible channel available for the repository context.
@@ -0,0 +1,52 @@
1
+ # Contributing
2
+
3
+ SANSA is public and readable, but this repository is not run as a standard
4
+ open-contribution project.
5
+
6
+ The governance model is described in [GOVERNANCE.md](./GOVERNANCE.md). The short
7
+ version is:
8
+
9
+ - implementation authority lives in this repo
10
+ - release and merge authority stay with the maintainer
11
+ - outside pull requests are not assumed to be part of the default workflow
12
+
13
+ ## What is welcome
14
+
15
+ - clear bug reports
16
+ - reproducible address parsing, resolve, or query mismatches
17
+ - CTS gaps and parity findings
18
+ - documentation fixes
19
+ - forks, downstream tooling, and independent implementations
20
+
21
+ ## Before opening a pull request
22
+
23
+ - do not assume an unsolicited PR will be merged
24
+ - prefer opening an issue first for non-trivial changes
25
+ - if the change touches parser behavior, resolver behavior, query evaluation,
26
+ CTS, diagnostics, or security behavior, include the concrete failing case and
27
+ expected outcome
28
+ - keep changes narrowly scoped and avoid bundling unrelated cleanup
29
+ - make sure tracked files do not introduce local filesystem paths into the
30
+ public repo
31
+
32
+ ## Development expectations
33
+
34
+ - run `npm test` for normal package changes
35
+ - run `npm run cts` for conformance-affecting changes
36
+ - run `npm run cts:query:experimental` when touching experimental Query or
37
+ Transform behavior
38
+ - run `npm run stress` when changing address parsing or selector behavior
39
+ - keep parser, resolver, and diagnostic behavior deterministic
40
+ - avoid changing package metadata or release surfaces casually
41
+
42
+ ## Good contribution shape
43
+
44
+ - a minimal repro
45
+ - the intended contract or authority surface
46
+ - focused code changes
47
+ - tests or CTS/corpus additions that lock the behavior in
48
+
49
+ ## Security issues
50
+
51
+ Do not use normal public issues for suspected vulnerabilities. Follow
52
+ [SECURITY.md](./SECURITY.md) instead.
package/GOVERNANCE.md ADDED
@@ -0,0 +1,35 @@
1
+ # Governance
2
+
3
+ This repository is maintained under a single-maintainer model.
4
+
5
+ ## Maintainer model
6
+
7
+ - the `sansa` implementation surface is maintained by one primary maintainer
8
+ - roadmap, release, and merge authority stay with the maintainer
9
+ - public visibility does not imply shared governance
10
+
11
+ ## Contribution model
12
+
13
+ - the source may be published publicly
14
+ - outside code contributions are not part of the default workflow
15
+ - pull requests should not be assumed to be accepted or reviewed as a normal
16
+ governance path
17
+ - changes are maintained directly by the maintainer unless an invited
18
+ collaboration is made explicit
19
+ - forks, independent implementations, downstream tooling, and ecosystem
20
+ experiments are encouraged
21
+ - alternate implementations should track the published specification and
22
+ conformance authority surfaces where applicable
23
+
24
+ ## Authority boundaries
25
+
26
+ - implementation authority for this JavaScript package lives in this repo
27
+ - specification authority lives in `aeonite-org/aeonite-specs`
28
+ - conformance authority lives in `aeonite-org/aeonite-cts`
29
+ - host implementations decide which SANSA surfaces and semantics they expose
30
+
31
+ ## Practical expectation
32
+
33
+ The public `sansa` repo should be readable, stable, and honest about its
34
+ maintenance model. It should not imply an open contribution process that the
35
+ project does not intend to run.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Patrik
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # SANSA
2
+
3
+ Shared Semantic Address NameSpace Abstraction (SANSA) address, resolve, and query parser/evaluator model.
4
+
5
+ This package is the first implementation package for SANSA Address, SANSA Resolve, and SANSA.Query. It parses and renders SANSA address expressions, resolves those expressions against a host-supplied namespace adapter, parses the SANSA.Query clause and expression surfaces, and evaluates a bounded query subset over host-neutral bindings. It also exposes the Shared AEON Value Semantics minimum consumer contract used by Query for ordinary scalar, equality, and ordering behavior. It does not inspect host values directly beyond host-exposed binding metadata, apply host-specific authorization, or assign semantics to qualifiers.
6
+
7
+ Implementation capability metadata is recorded in [docs/capabilities.json](docs/capabilities.json). The package currently advertises `AEON.ValueSemantics`, `SANSA.Addressing`, `SANSA.Resolve`, `SANSA.Query`, Query budget controls, the experimental `validation` Query policy, and experimental `SANSA.Transform` library extensions for `objectFrom` and `fieldsFrom`.
8
+
9
+ ## Current Scope
10
+
11
+ - root selectors: `$`, `?`
12
+ - member selectors: `.name`, `.["quoted.name"]`
13
+ - positional selectors: `[0]`, `[2..5]`, `[2..]`, `[..5]`
14
+ - parent selector: `.^`
15
+ - attribute address-space selector: `.@`
16
+ - local address-space selector: `.<"namespace">`
17
+ - expansion selectors: `.*`, `.**`
18
+ - filters: `#type`, `%kind`
19
+ - name pattern selector: `.("pattern")`
20
+ - qualified address literals with top-level qualifier unions
21
+ - structural resolve over host bindings with exact selectors, parent traversal, position ranges, expansion selectors, name patterns, semantic type filters, and representation kind filters
22
+ - deterministic preorder descendant expansion with explicit attribute and local address-space traversal
23
+ - SANSA.Query parsing for `from`, `where`, `order by`, `offset`, `limit`, and `select`
24
+ - query comment stripping, clause-order validation, and canonical query rendering
25
+ - SANSA.Query expression parsing for resolution expressions, literals, comparisons, Boolean operators, membership, cardinality operators, function-call shape, and projection shape
26
+ - SANSA.Query evaluation for `from`, Boolean `where`, `order by`, `offset`, `limit`, and `select` over literals, resolution expressions, comparisons, Boolean operators, membership, cardinality predicates, built-in string functions, function-like operators, and projection expressions
27
+
28
+ Host implementations decide which qualifier surface they accept. This parser accepts the SANSA qualifier grammar and preserves it structurally.
29
+
30
+ Host implementations also decide which address spaces they expose during resolution. Attribute and local address-space traversal are entered explicitly with `.@` and `.<"namespace">`. They fail explicitly unless the host exposes those capabilities through the resolve namespace adapter or binding model.
31
+
32
+ Resolve returns ordered Binding Sets. Supported selectors that miss on one branch contribute no bindings for that branch; unsupported or forbidden operations fail explicitly. The resolver preserves duplicate traversal occurrences and does not deduplicate by address. Parent traversal from the effective resolution root resolves empty by default, but callers can request stricter policy diagnostics with `failOnParentFromEffectiveRoot: true` or forbid parent traversal entirely with `parentTraversal: "forbid"`.
33
+
34
+ Name patterns use `?` for one Unicode code point and `*` for zero or more Unicode code points. Within the decoded pattern payload, `\?`, `\*`, and `\\` match literal question mark, asterisk, and backslash characters respectively.
35
+
36
+ The current API and AST contract is documented in [docs/api-contract.md](docs/api-contract.md).
37
+
38
+ The CTS runner covers address parsing, resolve behavior, query parsing, and query evaluation:
39
+
40
+ ```bash
41
+ npm run cts
42
+ npm run cts:value-semantics
43
+ npm run cts:resolve
44
+ npm run cts:query
45
+ npm run cts:query:experimental
46
+ ```
47
+
48
+ The default Query CTS lane runs core conformance and skips experimental extension cases. `cts:query:experimental` includes experimental extension coverage.
49
+
50
+ ## Query Tool
51
+
52
+ The package includes a standalone query tool for exercising SANSA.Query against
53
+ AEON source or a host-neutral JSON namespace fixture:
54
+
55
+ ```bash
56
+ npm run query -- --query 'from $.inventory.items.* where contains(.sku, "B") select .sku'
57
+ ```
58
+
59
+ The default CLI fixture is [fixtures/query-inventory.json](fixtures/query-inventory.json),
60
+ which keeps `sansa-query` self-contained after package install. `.aeon` fixture
61
+ support is optional and uses an AEON TypeScript Core runtime when one is
62
+ available.
63
+
64
+ For browser-based technical testing, run the Query Workbench:
65
+
66
+ ```bash
67
+ npm run query:web
68
+ ```
69
+
70
+ Then open `http://127.0.0.1:4173/tools/query-web/`.
71
+
72
+ Full CLI, workbench, Query semantics, and recipe details live in
73
+ [docs/query-tool.md](docs/query-tool.md).
74
+
75
+ ## Release Notes
76
+
77
+ Release history lives in [CHANGELOG.md](CHANGELOG.md).
78
+
79
+ ## API
80
+
81
+ ```js
82
+ import {
83
+ evaluateQuery,
84
+ evaluateValueSemanticsOperation,
85
+ parseAddress,
86
+ parseQuery,
87
+ parseQueryExpression,
88
+ renderAddress,
89
+ resolveAddress
90
+ } from "@altopelago/sansa";
91
+
92
+ const result = parseAddress('$.inventory:csv[","]');
93
+
94
+ if (result.ok) {
95
+ console.log(result.address.canonical);
96
+ console.log(renderAddress(result.address));
97
+ }
98
+
99
+ const root = {
100
+ address: "$",
101
+ children: [
102
+ {
103
+ name: "inventory",
104
+ address: "$.inventory",
105
+ children: [
106
+ { name: "sku", address: "$.inventory.sku", semanticType: "string", representationKind: "string" }
107
+ ]
108
+ }
109
+ ]
110
+ };
111
+
112
+ const resolved = resolveAddress("$.inventory.*#string", { root });
113
+
114
+ if (resolved.ok) {
115
+ console.log(resolved.bindings.map((binding) => binding.address));
116
+ }
117
+
118
+ const query = parseQuery('from $.inventory.items.*\nwhere .qty >= 1\nselect .sku');
119
+
120
+ if (query.ok) {
121
+ console.log(query.query.canonical);
122
+ }
123
+
124
+ const expression = parseQueryExpression('any(.roles.* == "admin")');
125
+
126
+ if (expression.ok) {
127
+ console.log(expression.expression.type);
128
+ }
129
+
130
+ const evaluated = evaluateQuery('from $.inventory.items.*\nselect .sku', { root });
131
+
132
+ if (evaluated.ok) {
133
+ console.log(evaluated.results.length);
134
+ console.log(evaluated.results[0]?.address);
135
+ }
136
+
137
+ const ordinary = evaluateValueSemanticsOperation("isValue", {
138
+ value: { category: "finiteNumber", value: "42" }
139
+ });
140
+
141
+ if (ordinary.ok) {
142
+ console.log(ordinary.value);
143
+ }
144
+ ```
145
+
146
+ Each query result carries the source candidate `address` when the namespace exposes one. The projected selection or object lives in `result.value`.
package/SECURITY.md ADDED
@@ -0,0 +1,38 @@
1
+ # Security Policy
2
+
3
+ SANSA includes parsing, address resolution, query evaluation, fixture adapters,
4
+ and development tools. Security-sensitive reports should be handled privately
5
+ where possible.
6
+
7
+ ## Reporting a vulnerability
8
+
9
+ - do not open a public GitHub issue for a suspected vulnerability
10
+ - prefer GitHub private vulnerability reporting for this repository when it is
11
+ available
12
+ - include a minimal reproduction, affected surface, expected impact, and any
13
+ known workarounds
14
+
15
+ ## Good report content
16
+
17
+ - affected package surface, API, command, or tool
18
+ - exact input, address, query, or fixture that triggers the issue
19
+ - whether the issue affects parsing, resolution, query evaluation, fixture
20
+ loading, optional AEON runtime integration, or trust boundaries
21
+ - whether the behavior is spec, CTS, or implementation specific
22
+
23
+ ## Scope examples
24
+
25
+ Security-relevant reports may include:
26
+
27
+ - trust-boundary violations
28
+ - unsafe address resolution behavior
29
+ - selector or query behavior that escapes an intended host boundary
30
+ - parser or evaluator denial-of-service vectors such as pathological inputs or
31
+ unbounded work
32
+ - fixture loading or workbench behavior that exposes unintended local data
33
+
34
+ ## Disclosure
35
+
36
+ Please allow time for triage and mitigation before public disclosure. Once a
37
+ fix or mitigation exists, public documentation can follow in the normal repo
38
+ history.