@astrale-os/kernel-dsl 0.2.0-beta.25 → 0.2.0-beta.26

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.
@@ -2,6 +2,8 @@ import { json } from '@astrale-os/kernel-dsl/value';
2
2
  import { asDomainSchema } from '../model/schema.js';
3
3
  import { digestDomainSchemaBytes } from './domain.digest.js';
4
4
  import { canonicalizeDomainSchema } from './domain.js';
5
+ // Only canonical schemas created here own a retained revision, never caller-owned input.
6
+ const revisions = new WeakMap();
5
7
  export function canonicalDomainSchema(value) {
6
8
  return canonicalDomainSchemaAfterValidation(value);
7
9
  }
@@ -10,8 +12,9 @@ export function canonicalDomainSchemaAfterValidation(value) {
10
12
  const schema = asDomainSchema(canonicalizeDomainSchema(value));
11
13
  const bytes = json.encode(schema);
12
14
  const revision = digestDomainSchemaBytes(bytes);
15
+ revisions.set(schema, revision);
13
16
  return Object.freeze({ schema, bytes, revision });
14
17
  }
15
18
  export function revisionOfDomainSchema(schema) {
16
- return canonicalDomainSchema(schema).revision;
19
+ return revisions.get(schema) ?? canonicalDomainSchema(schema).revision;
17
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrale-os/kernel-dsl",
3
- "version": "0.2.0-beta.25",
3
+ "version": "0.2.0-beta.26",
4
4
  "description": "Astrale Kernel DSL - Schema authoring, inference, and IR serialization",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {