@altopelago/aeon-sdk 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,36 @@
1
+ # @altopelago/aeon-sdk
2
+
3
+ Application-facing convenience layer for common AEON read/write flows.
4
+
5
+ ## Quick Start
6
+
7
+ ```ts
8
+ import { readAeonChecked, writeAeon } from '@altopelago/aeon-sdk';
9
+
10
+ const parsed = readAeonChecked('greeting:string = "Hello"');
11
+ console.log(parsed.finalized.document);
12
+
13
+ const emitted = writeAeon({ app: 'todo', version: 1 });
14
+ console.log(emitted.text);
15
+ ```
16
+
17
+ ## What This Package Does
18
+
19
+ - wraps common read flows around `@altopelago/aeon-core` and `@altopelago/aeon-finalize`
20
+ - wraps object emission via `@altopelago/aeon-canonical`
21
+ - exposes a canonical-path event index for app code and examples
22
+
23
+ ## API
24
+
25
+ - `readAeon(input, options?)`
26
+ - `readAeonChecked(input, options?)`
27
+ - `readAeonStrictCustom(input)`
28
+ - `writeAeon(object, options?)`
29
+ - `formatPath(path)`
30
+ - `indexEventsByPath(events)`
31
+
32
+ ## Notes
33
+
34
+ - Prefer this package for simple application examples.
35
+ - Use `@altopelago/aeon-core` when you only need compile-only behavior.
36
+ - Use `@altopelago/aeon-runtime` when you need the full orchestrated runtime pipeline.
@@ -0,0 +1,22 @@
1
+ import { formatPath, type CompileOptions, type CompileResult } from '@altopelago/aeon-core';
2
+ import { type FinalizeJsonResult, type FinalizeOptions } from '@altopelago/aeon-finalize';
3
+ import { type EmitObjectOptions, type EmitResult } from '@altopelago/aeon-canonical';
4
+ export interface ReadAeonOptions {
5
+ readonly compile?: CompileOptions;
6
+ readonly finalize?: FinalizeOptions;
7
+ }
8
+ export interface ReadAeonResult {
9
+ readonly compile: CompileResult;
10
+ readonly finalized: FinalizeJsonResult;
11
+ }
12
+ export interface ReadAeonCheckedResult extends ReadAeonResult {
13
+ readonly eventsByPath: ReadonlyMap<string, CompileResult['events'][number]>;
14
+ }
15
+ export declare function readAeon(input: string, options?: ReadAeonOptions): ReadAeonResult;
16
+ export declare function indexEventsByPath(events: readonly CompileResult['events'][number][]): ReadonlyMap<string, CompileResult['events'][number]>;
17
+ export declare function readAeonChecked(input: string, options?: ReadAeonOptions): ReadAeonCheckedResult;
18
+ export declare function readAeonStrictCustom(input: string): ReadAeonCheckedResult;
19
+ export declare function writeAeon(object: Readonly<Record<string, unknown>>, options?: EmitObjectOptions): EmitResult;
20
+ export { formatPath };
21
+ export type { CompileOptions, CompileResult, FinalizeOptions, FinalizeJsonResult, EmitObjectOptions, EmitResult, };
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,UAAU,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrG,OAAO,EAAgB,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACxG,OAAO,EAAkB,KAAK,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAErG,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC;CACrC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;CACxC;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;CAC7E;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,cAAc,CAcrF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,aAAa,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAE1I;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,qBAAqB,CAiBnG;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,qBAAqB,CAKzE;AAED,wBAAgB,SAAS,CACvB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,OAAO,GAAE,iBAAsB,GAC9B,UAAU,CAEZ;AAED,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,YAAY,EACV,cAAc,EACd,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,GACX,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,46 @@
1
+ import { compile, formatPath } from '@altopelago/aeon-core';
2
+ import { finalizeJson } from '@altopelago/aeon-finalize';
3
+ import { emitFromObject } from '@altopelago/aeon-canonical';
4
+ export function readAeon(input, options = {}) {
5
+ const compileResult = compile(input, {
6
+ ...(options.compile ?? {}),
7
+ });
8
+ const finalized = finalizeJson(compileResult.events, {
9
+ mode: 'strict',
10
+ ...(options.finalize ?? {}),
11
+ });
12
+ return {
13
+ compile: compileResult,
14
+ finalized,
15
+ };
16
+ }
17
+ export function indexEventsByPath(events) {
18
+ return new Map(events.map((event) => [formatPath(event.path), event]));
19
+ }
20
+ export function readAeonChecked(input, options = {}) {
21
+ const result = readAeon(input, options);
22
+ if (result.compile.errors.length > 0) {
23
+ const summary = result.compile.errors.map((error) => `${error.code}: ${error.message}`).join('\n');
24
+ throw new Error(`AEON compile failed with ${result.compile.errors.length} error(s):\n${summary}`);
25
+ }
26
+ const finalizeErrors = result.finalized.meta?.errors ?? [];
27
+ if (finalizeErrors.length > 0) {
28
+ const summary = finalizeErrors.map((error) => error.message).join('\n');
29
+ throw new Error(`AEON finalize failed with ${finalizeErrors.length} error(s):\n${summary}`);
30
+ }
31
+ return {
32
+ ...result,
33
+ eventsByPath: indexEventsByPath(result.compile.events),
34
+ };
35
+ }
36
+ export function readAeonStrictCustom(input) {
37
+ return readAeonChecked(input, {
38
+ compile: { datatypePolicy: 'allow_custom' },
39
+ finalize: { mode: 'strict' },
40
+ });
41
+ }
42
+ export function writeAeon(object, options = {}) {
43
+ return emitFromObject(object, options);
44
+ }
45
+ export { formatPath };
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAA2C,MAAM,uBAAuB,CAAC;AACrG,OAAO,EAAE,YAAY,EAAiD,MAAM,2BAA2B,CAAC;AACxG,OAAO,EAAE,cAAc,EAA2C,MAAM,4BAA4B,CAAC;AAgBrG,MAAM,UAAU,QAAQ,CAAC,KAAa,EAAE,UAA2B,EAAE;IACnE,MAAM,aAAa,GAAG,OAAO,CAAC,KAAK,EAAE;QACnC,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;KAC3B,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,YAAY,CAAC,aAAa,CAAC,MAAM,EAAE;QACnD,IAAI,EAAE,QAAQ;QACd,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;KAC5B,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,aAAa;QACtB,SAAS;KACV,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAkD;IAClF,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAA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AAQ,EAAE;KAC7B,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,SAAS,CACvB,MAAyC,EACzC,UAA6B,EAAE;IAE/B,OAAO,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@altopelago/aeon-sdk",
3
+ "version": "0.9.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "!dist/**/*.test.d.ts",
16
+ "!dist/**/*.test.d.ts.map",
17
+ "!dist/**/*.test.js",
18
+ "!dist/**/*.test.js.map"
19
+ ],
20
+ "dependencies": {
21
+ "@altopelago/aeon-core": "0.9.0",
22
+ "@altopelago/aeon-finalize": "0.9.0",
23
+ "@altopelago/aeon-canonical": "0.9.0"
24
+ },
25
+ "scripts": {
26
+ "build": "tsc -p tsconfig.json",
27
+ "test": "node --test dist/*.test.js",
28
+ "clean": "rm -rf dist",
29
+ "typecheck": "tsc -p tsconfig.json --noEmit"
30
+ }
31
+ }