@altopelago/aeon-aes 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/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # @altopelago/aeon-aes
2
+
3
+ Assignment Event Stream emission and supporting AEON path utilities.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @altopelago/aeon-aes
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { emitAssignmentEvents } from '@altopelago/aeon-aes';
15
+
16
+ const result = emitAssignmentEvents('answer = 42');
17
+
18
+ if (result.errors.length === 0) {
19
+ console.log(result.events);
20
+ }
21
+ ```
22
+
23
+ Use this package when you need direct access to emitted AEON assignment events.
24
+ If you want the stable application-facing entry point, prefer `@altopelago/aeon-core`.
@@ -0,0 +1,3 @@
1
+ import type { TypeAnnotation } from '@altopelago/aeon-parser';
2
+ export declare function formatDatatypeAnnotation(datatype: TypeAnnotation): string;
3
+ //# sourceMappingURL=datatype.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datatype.d.ts","sourceRoot":"","sources":["../src/datatype.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAYzE"}
@@ -0,0 +1,14 @@
1
+ export function formatDatatypeAnnotation(datatype) {
2
+ const name = datatype.name;
3
+ const generics = datatype.genericArgs.length > 0
4
+ ? `<${datatype.genericArgs.join(', ')}>`
5
+ : '';
6
+ const radixBase = datatype.radixBase != null
7
+ ? `[${datatype.radixBase}]`
8
+ : '';
9
+ const separators = datatype.separators.length > 0
10
+ ? datatype.separators.map((separator) => `[${separator}]`).join('')
11
+ : '';
12
+ return `${name}${generics}${radixBase}${separators}`;
13
+ }
14
+ //# sourceMappingURL=datatype.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datatype.js","sourceRoot":"","sources":["../src/datatype.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,wBAAwB,CAAC,QAAwB;IAC7D,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;IAC3B,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;QAC5C,CAAC,CAAC,IAAI,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;QACxC,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,IAAI,IAAI;QACxC,CAAC,CAAC,IAAI,QAAQ,CAAC,SAAS,GAAG;QAC3B,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC;QAC7C,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QACnE,CAAC,CAAC,EAAE,CAAC;IACT,OAAO,GAAG,IAAI,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,EAAE,CAAC;AACzD,CAAC"}
@@ -0,0 +1,77 @@
1
+ import type { Span } from '@altopelago/aeon-lexer';
2
+ import type { Value, TypeAnnotation } from '@altopelago/aeon-parser';
3
+ import { type CanonicalPath, type PathResolutionResult, PathResolutionError } from './paths.js';
4
+ /**
5
+ * Assignment Event - emitted for each binding
6
+ *
7
+ * This is the core semantic unit of AEON. Each binding produces exactly one event.
8
+ * Events are emitted in document order and contain the original AST values
9
+ * without any transformation or evaluation.
10
+ */
11
+ export interface AssignmentEvent {
12
+ /** Canonical path to the binding (e.g., $.config.db.host) */
13
+ readonly path: CanonicalPath;
14
+ /** Derived wildcard path for dispatch ergonomics (e.g., config.db.items[*]) */
15
+ readonly normalizedPath?: string;
16
+ /** Local key name (e.g., "host") */
17
+ readonly key: string;
18
+ /** Original AST value node - NOT evaluated or transformed */
19
+ readonly value: Value;
20
+ /** Source location of the binding */
21
+ readonly span: Span;
22
+ /** Datatype hint if present (e.g., "int32") */
23
+ readonly datatype?: string;
24
+ /** Attributes if present */
25
+ readonly annotations?: ReadonlyMap<string, AttributeEntry>;
26
+ }
27
+ /**
28
+ * Attribute entry
29
+ */
30
+ export interface AttributeEntry {
31
+ readonly value: Value;
32
+ readonly datatype?: string;
33
+ readonly annotations?: ReadonlyMap<string, AttributeEntry>;
34
+ }
35
+ /**
36
+ * Event emission result
37
+ *
38
+ * Note: errors may include both EventEmissionError and PathResolutionError
39
+ * (propagated from the resolution phase for fail-closed semantics).
40
+ */
41
+ export interface EventEmissionResult {
42
+ readonly events: readonly AssignmentEvent[];
43
+ readonly errors: readonly (EventEmissionError | PathResolutionError)[];
44
+ }
45
+ /**
46
+ * Event emission error (should be rare - indicates internal inconsistency)
47
+ */
48
+ export declare class EventEmissionError extends Error {
49
+ readonly span: Span;
50
+ readonly code: string;
51
+ constructor(message: string, span: Span, code?: string);
52
+ }
53
+ /**
54
+ * Event emission options
55
+ */
56
+ export interface EventEmissionOptions {
57
+ /**
58
+ * Enable recovery mode: emit events for valid bindings even if errors exist.
59
+ * Default: false (fail-closed - no events on any error)
60
+ */
61
+ readonly recovery?: boolean;
62
+ }
63
+ /**
64
+ * Emit Assignment Events from resolved bindings
65
+ *
66
+ * This is a projection step - it transforms resolved bindings into events
67
+ * without any evaluation, resolution, or transformation of values.
68
+ *
69
+ * Events are emitted in document order (the order bindings appear in source).
70
+ *
71
+ * **Fail-closed behavior**: If the resolution result contains any errors,
72
+ * this function returns an empty event array (unless recovery mode is enabled).
73
+ * This ensures downstream consumers never receive a partial event stream.
74
+ */
75
+ export declare function emitEvents(resolved: PathResolutionResult, options?: EventEmissionOptions): EventEmissionResult;
76
+ export { TypeAnnotation };
77
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sour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AC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,GAAE,MAAsB;CAMxE;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CACtB,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,GAAE,oBAAyB,GACnC,mBAAmB,CAyBrB;AAyDD,OAAO,EAAE,cAAc,EAAE,CAAC"}
package/dist/events.js ADDED
@@ -0,0 +1,97 @@
1
+ import { formatNormalizedPath, } from './paths.js';
2
+ import { formatDatatypeAnnotation } from './datatype.js';
3
+ /**
4
+ * Event emission error (should be rare - indicates internal inconsistency)
5
+ */
6
+ export class EventEmissionError extends Error {
7
+ span;
8
+ code;
9
+ constructor(message, span, code = 'EVENT_ERROR') {
10
+ super(message);
11
+ this.name = 'EventEmissionError';
12
+ this.span = span;
13
+ this.code = code;
14
+ }
15
+ }
16
+ /**
17
+ * Emit Assignment Events from resolved bindings
18
+ *
19
+ * This is a projection step - it transforms resolved bindings into events
20
+ * without any evaluation, resolution, or transformation of values.
21
+ *
22
+ * Events are emitted in document order (the order bindings appear in source).
23
+ *
24
+ * **Fail-closed behavior**: If the resolution result contains any errors,
25
+ * this function returns an empty event array (unless recovery mode is enabled).
26
+ * This ensures downstream consumers never receive a partial event stream.
27
+ */
28
+ export function emitEvents(resolved, options = {}) {
29
+ // Propagate resolution errors to event emission result
30
+ const allErrors = [...resolved.errors];
31
+ // FAIL-CLOSED: If there are resolution errors and recovery is not enabled,
32
+ // return empty events. This is a non-negotiable safety requirement.
33
+ if (resolved.errors.length > 0 && !options.recovery) {
34
+ return {
35
+ events: [],
36
+ errors: allErrors,
37
+ };
38
+ }
39
+ // Emit one event per resolved binding, in document order
40
+ // The bindings are already in document order from the path resolver
41
+ const events = [];
42
+ for (const canonicalBinding of resolved.bindings) {
43
+ const event = createEvent(canonicalBinding);
44
+ events.push(event);
45
+ }
46
+ return {
47
+ events,
48
+ errors: allErrors,
49
+ };
50
+ }
51
+ /**
52
+ * Create an AssignmentEvent from a CanonicalBinding
53
+ */
54
+ function createEvent(cb) {
55
+ const binding = cb.binding;
56
+ // Build base event
57
+ const event = {
58
+ path: cb.path,
59
+ normalizedPath: formatNormalizedPath(cb.path),
60
+ key: binding.key,
61
+ value: binding.value,
62
+ span: cb.span,
63
+ };
64
+ // Add optional datatype if present
65
+ if (binding.datatype) {
66
+ event.datatype = formatDatatypeAnnotation(binding.datatype);
67
+ }
68
+ // Add annotations if attributes present
69
+ if (binding.attributes.length > 0) {
70
+ event.annotations =
71
+ buildAnnotations(binding.attributes);
72
+ }
73
+ return event;
74
+ }
75
+ /**
76
+ * Build annotations map from attributes
77
+ */
78
+ function buildAnnotations(attributes) {
79
+ const result = new Map();
80
+ for (const attr of attributes) {
81
+ for (const [key, entry] of attr.entries) {
82
+ const attrEntry = {
83
+ value: entry.value,
84
+ };
85
+ if (entry.datatype) {
86
+ attrEntry.datatype = formatDatatypeAnnotation(entry.datatype);
87
+ }
88
+ const nestedAnnotations = buildAnnotations(entry.attributes);
89
+ if (nestedAnnotations.size > 0) {
90
+ attrEntry.annotations = nestedAnnotations;
91
+ }
92
+ result.set(key, attrEntry);
93
+ }
94
+ }
95
+ return result;
96
+ }
97
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAEA,OAAO,EAKH,oBAAoB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AA8CzD;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAChC,IAAI,CAAO;IACX,IAAI,CAAS;IAEtB,YAAY,OAAe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 export * from './paths.js';
7
+ export * from './events.js';
8
+ export * from './references.js';
9
+ export * from './modes.js';
10
+ export * from './resolve.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @altopelago/aeon-aes - AEON Assignment Event Stream Package
3
+ *
4
+ * Produces Assignment Events from parsed AEON documents.
5
+ */
6
+ export * from './paths.js';
7
+ export * from './events.js';
8
+ export * from './references.js';
9
+ export * from './modes.js';
10
+ export * from './resolve.js';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Phase 7 — Mode Enforcement
3
+ *
4
+ * Enforces:
5
+ * - Transport vs Strict mode typing rules
6
+ * - Toggle typing rules (no semantic toggle unless typed)
7
+ * - Header correctness
8
+ *
9
+ * Non-negotiable constraints:
10
+ * - No coercion, ever
11
+ * - No schema execution
12
+ * - No reference resolution
13
+ * - Fail-closed by default
14
+ */
15
+ import type { Span } from '@altopelago/aeon-lexer';
16
+ import type { Header } from '@altopelago/aeon-parser';
17
+ import type { AssignmentEvent } from './events.js';
18
+ /**
19
+ * Document mode
20
+ */
21
+ export type Mode = 'transport' | 'strict' | 'custom';
22
+ export type DatatypePolicy = 'reserved_only' | 'allow_custom';
23
+ /**
24
+ * Mode enforcement error codes
25
+ */
26
+ export type ModeEnforcementErrorCode = 'UNTYPED_VALUE_IN_STRICT_MODE' | 'UNTYPED_TOGGLE_LITERAL' | 'CUSTOM_TOGGLE_ALIAS_NOT_ALLOWED' | 'DATATYPE_LITERAL_MISMATCH' | 'CUSTOM_DATATYPE_NOT_ALLOWED' | 'INVALID_NODE_HEAD_DATATYPE' | 'HEADER_CONFLICT';
27
+ /**
28
+ * Mode enforcement error
29
+ */
30
+ export declare class ModeEnforcementError extends Error {
31
+ readonly span: Span;
32
+ readonly code: ModeEnforcementErrorCode;
33
+ readonly path: string;
34
+ constructor(message: string, span: Span, code: ModeEnforcementErrorCode, path: string);
35
+ }
36
+ /**
37
+ * Error: Untyped value in typed mode
38
+ */
39
+ export declare class UntypedValueInStrictModeError extends ModeEnforcementError {
40
+ constructor(span: Span, path: string);
41
+ }
42
+ /**
43
+ * Error: toggle literal requires :toggle in typed mode
44
+ */
45
+ export declare class UntypedToggleLiteralError extends ModeEnforcementError {
46
+ constructor(span: Span, path: string);
47
+ }
48
+ export declare class CustomToggleAliasNotAllowedError extends ModeEnforcementError {
49
+ constructor(span: Span, path: string, datatype: string);
50
+ }
51
+ /**
52
+ * Error: Structured header and shorthand header used together
53
+ */
54
+ export declare class HeaderConflictError extends ModeEnforcementError {
55
+ constructor(span: Span);
56
+ }
57
+ /**
58
+ * Error: Reserved datatype annotation does not match literal/container kind
59
+ */
60
+ export declare class DatatypeLiteralMismatchError extends ModeEnforcementError {
61
+ constructor(span: Span, path: string, datatype: string, actualKind: string, expectedKinds: readonly string[]);
62
+ }
63
+ export declare class InvalidCustomDatatypeBracketShapeError extends ModeEnforcementError {
64
+ constructor(span: Span, path: string, datatype: string, actualKind: string);
65
+ }
66
+ export declare class IncompatibleCustomDatatypeAdornmentsError extends ModeEnforcementError {
67
+ constructor(span: Span, path: string, datatype: string, actualKind: string);
68
+ }
69
+ /**
70
+ * Error: Custom datatype is not permitted by typed-mode datatype policy
71
+ */
72
+ export declare class CustomDatatypeNotAllowedError extends ModeEnforcementError {
73
+ constructor(span: Span, path: string, datatype: string);
74
+ }
75
+ /**
76
+ * Error: Node head datatype must remain :node in strict mode
77
+ */
78
+ export declare class InvalidNodeHeadDatatypeError extends ModeEnforcementError {
79
+ constructor(span: Span, path: string, datatype: string);
80
+ }
81
+ /**
82
+ * Mode enforcement options
83
+ */
84
+ export interface ModeEnforcementOptions {
85
+ /** Enable recovery mode (return events even with errors) */
86
+ readonly recovery?: boolean;
87
+ /** Explicit datatype compatibility override for typed modes */
88
+ readonly datatypePolicy?: DatatypePolicy;
89
+ }
90
+ /**
91
+ * Mode enforcement result
92
+ */
93
+ export interface ModeEnforcementResult {
94
+ /** Events (empty if errors and not in recovery mode) */
95
+ readonly events: readonly AssignmentEvent[];
96
+ /** Mode enforcement errors */
97
+ readonly errors: readonly ModeEnforcementError[];
98
+ }
99
+ /**
100
+ * Extract mode from header
101
+ */
102
+ export declare function extractMode(header: Header | null): Mode;
103
+ /**
104
+ * Enforce mode constraints on events
105
+ *
106
+ * In typed modes (`strict` and `custom`):
107
+ * - Every binding must have an explicit type annotation
108
+ *
109
+ * In strict mode only:
110
+ * - Untyped toggle literals (yes/no/on/off) require :toggle type
111
+ *
112
+ * In transport mode:
113
+ * - Untyped values are allowed (stay raw, no semantic interpretation)
114
+ * - Explicit datatype annotations are still validated for compatibility
115
+ * - Custom datatype labels are accepted by default
116
+ */
117
+ export declare function enforceMode(events: readonly AssignmentEvent[], header: Header | null, options?: ModeEnforcementOptions): ModeEnforcementResult;
118
+ export declare function validateMode(_mode: Mode): readonly ModeEnforcementError[];
119
+ export declare function datatypeHasGenericArgs(datatype: string): boolean;
120
+ //# sourceMappingURL=modes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modes.d.ts","sourceRoot":"","sources":["../src/modes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wB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