@x12i/memorix-format 3.0.3 → 3.0.4

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 (43) hide show
  1. package/CHANGELOG.md +65 -65
  2. package/README.md +78 -78
  3. package/dist/base/concept.d.ts +4 -0
  4. package/dist/base/concept.d.ts.map +1 -1
  5. package/dist/base/concept.js +5 -1
  6. package/dist/base/concept.js.map +1 -1
  7. package/dist/cli.js +36 -36
  8. package/dist/v2/identity.d.ts +19 -0
  9. package/dist/v2/identity.d.ts.map +1 -0
  10. package/dist/v2/identity.js +39 -0
  11. package/dist/v2/identity.js.map +1 -0
  12. package/dist/v2/index.d.ts +1 -0
  13. package/dist/v2/index.d.ts.map +1 -1
  14. package/dist/v2/index.js +1 -0
  15. package/dist/v2/index.js.map +1 -1
  16. package/docs/association-format.md +47 -47
  17. package/docs/memorix-format-requirements.md +54 -54
  18. package/docs/memorix-format.md +68 -68
  19. package/docs/memorix-record-v2.md +102 -101
  20. package/docs/memorix-workflow-format.md +126 -126
  21. package/docs/migrate-present-to-v2.md +49 -49
  22. package/examples/invalid-record.json +11 -11
  23. package/examples/v2/activity-events-snapshots.json +31 -31
  24. package/examples/v2/people-discovery.json +26 -26
  25. package/examples/v2/people-snapshots-employee.json +27 -27
  26. package/examples/v2/playbooks-knowledge.json +27 -27
  27. package/examples/v2/work-items-analysis.json +26 -26
  28. package/examples/v2/work-items-context.json +32 -32
  29. package/examples/v2/work-items-decisions.json +26 -26
  30. package/examples/v2/work-items-raw.json +37 -37
  31. package/examples/v2/work-items-relationships-candidate.json +38 -38
  32. package/examples/v2/work-items-snapshots-lifecycle.json +31 -31
  33. package/examples/v2/work-items-snapshots-lightweight-refs.json +34 -34
  34. package/examples/v2/work-items-snapshots.json +28 -28
  35. package/examples/v2/work-items-workflow.json +28 -28
  36. package/examples/valid-snapshot.json +30 -30
  37. package/meta/associated-conventions.json +59 -59
  38. package/meta/content-type-profiles.json +27 -27
  39. package/meta/content-types.json +80 -80
  40. package/meta/envelope.json +104 -104
  41. package/meta/inventory/managed-descriptors.json +78 -78
  42. package/meta/open-buckets.json +24 -24
  43. package/package.json +77 -77
package/CHANGELOG.md CHANGED
@@ -1,65 +1,65 @@
1
- ## 3.0.3
2
-
3
- - Add `nexum` content-type vocabulary for write-record mode nexum records.
4
-
5
- ## 3.0.2
6
-
7
- - Docs: README install pins + stack/live/core-service references.
8
-
9
- ## 3.0.1
10
-
11
- - Patch release: README/port-map alignment, live-view wiring where applicable.
12
-
13
- # Changelog
14
-
15
- ## 2.3.3
16
-
17
- - Gate G4: authoritative relationship storage = central per-category collections (Candidate C).
18
- - Option A root `associated*` lightweight refs remain **format-valid**; they are **not** the selected authoritative storage model.
19
- - Sibling `relationships` content remains format-valid; not selected as authoritative storage.
20
-
21
- ## 2.3.2
22
-
23
- - Lightweight relationship refs **require** `relationshipDefinitionId` + `recordId` (`relationshipId` optional/derivable).
24
- - Thin Gate G2 in-memory Mongo-style roundtrip + composition characterization.
25
- - DEL-ASSOC-COPIED wording: reject copied payloads only (Option A remains valid).
26
-
27
- ## 2.3.1
28
-
29
- - Gate G2 corrections: `migratePresentToV2` returns `{ v2, extractedRelationships, warnings }` — never silently drops resolvable association `recordId`s.
30
- - Option A associated*: lightweight refs allowed; copied payload rejected (`V2-ASSOC-COPIED`). Physical storage still pending G4.
31
- - Revision helpers: `applySuccessfulMutation`, `checkExpectedRevision`, `nextRevision`.
32
- - Negative format + discriminator-default tests; migration semantics doc.
33
-
34
- ## 2.3.0
35
-
36
- - **memorix-record/2**: `validateMemorixRecordV2`, `migratePresentToV2`, CLI `validate-v2` / `migrate-to-v2` / `profiles-v2`.
37
- - Golden examples under `examples/v2/`; docs: `docs/memorix-record-v2.md`.
38
- - Present envelope remains default for existing writer/pipeline; opt in with `MEMORIX_RECORD_FORMAT=v2`.
39
- - `@x12i/memorix-base-format` remains a dependency for present validation; scheduled to become a temporary re-export then delete (Phase 0 deletion ledger).
40
-
41
- ## 2.2.3
42
-
43
- - Docs hygiene: drop identity-era appendix and ebook correction notes; association doc is a thin present-tense stub pointing at `meta/associated-conventions.json` + pipeline ops docs.
44
-
45
- ## 2.2.0
46
-
47
- - Depends on `@x12i/memorix-base-format@^1.2.0` (`concept._extIdentifier`, `_system.state`).
48
- - `migrate` / `migrateMemorixRecord`: transform legacy/transitional envelopes → present format and validate.
49
- - Re-exports `buildExtIdentifier`, `readConceptExtIdentifier`, record-state helpers.
50
-
51
- ## 2.1.0
52
-
53
- - Meta-metadata in packaged `meta/` JSON; inventory under `meta/inventory/`.
54
- - Profiles / known buckets / SCOPE load from those files.
55
-
56
- ## 2.0.0
57
-
58
- Breaking relative to 1.0.0:
59
-
60
- - Depends on `@x12i/memorix-base-format` for the fixed skeleton.
61
- - Product rules live only in this package as profiles / layered checks.
62
-
63
- ## 1.0.0
64
-
65
- Initial release (monolithic validator).
1
+ ## 3.0.3
2
+
3
+ - Add `nexum` content-type vocabulary for write-record mode nexum records.
4
+
5
+ ## 3.0.2
6
+
7
+ - Docs: README install pins + stack/live/core-service references.
8
+
9
+ ## 3.0.1
10
+
11
+ - Patch release: README/port-map alignment, live-view wiring where applicable.
12
+
13
+ # Changelog
14
+
15
+ ## 2.3.3
16
+
17
+ - Gate G4: authoritative relationship storage = central per-category collections (Candidate C).
18
+ - Option A root `associated*` lightweight refs remain **format-valid**; they are **not** the selected authoritative storage model.
19
+ - Sibling `relationships` content remains format-valid; not selected as authoritative storage.
20
+
21
+ ## 2.3.2
22
+
23
+ - Lightweight relationship refs **require** `relationshipDefinitionId` + `recordId` (`relationshipId` optional/derivable).
24
+ - Thin Gate G2 in-memory Mongo-style roundtrip + composition characterization.
25
+ - DEL-ASSOC-COPIED wording: reject copied payloads only (Option A remains valid).
26
+
27
+ ## 2.3.1
28
+
29
+ - Gate G2 corrections: `migratePresentToV2` returns `{ v2, extractedRelationships, warnings }` — never silently drops resolvable association `recordId`s.
30
+ - Option A associated*: lightweight refs allowed; copied payload rejected (`V2-ASSOC-COPIED`). Physical storage still pending G4.
31
+ - Revision helpers: `applySuccessfulMutation`, `checkExpectedRevision`, `nextRevision`.
32
+ - Negative format + discriminator-default tests; migration semantics doc.
33
+
34
+ ## 2.3.0
35
+
36
+ - **memorix-record/2**: `validateMemorixRecordV2`, `migratePresentToV2`, CLI `validate-v2` / `migrate-to-v2` / `profiles-v2`.
37
+ - Golden examples under `examples/v2/`; docs: `docs/memorix-record-v2.md`.
38
+ - Present envelope remains default for existing writer/pipeline; opt in with `MEMORIX_RECORD_FORMAT=v2`.
39
+ - `@x12i/memorix-base-format` remains a dependency for present validation; scheduled to become a temporary re-export then delete (Phase 0 deletion ledger).
40
+
41
+ ## 2.2.3
42
+
43
+ - Docs hygiene: drop identity-era appendix and ebook correction notes; association doc is a thin present-tense stub pointing at `meta/associated-conventions.json` + pipeline ops docs.
44
+
45
+ ## 2.2.0
46
+
47
+ - Depends on `@x12i/memorix-base-format@^1.2.0` (`concept._extIdentifier`, `_system.state`).
48
+ - `migrate` / `migrateMemorixRecord`: transform legacy/transitional envelopes → present format and validate.
49
+ - Re-exports `buildExtIdentifier`, `readConceptExtIdentifier`, record-state helpers.
50
+
51
+ ## 2.1.0
52
+
53
+ - Meta-metadata in packaged `meta/` JSON; inventory under `meta/inventory/`.
54
+ - Profiles / known buckets / SCOPE load from those files.
55
+
56
+ ## 2.0.0
57
+
58
+ Breaking relative to 1.0.0:
59
+
60
+ - Depends on `@x12i/memorix-base-format` for the fixed skeleton.
61
+ - Product rules live only in this package as profiles / layered checks.
62
+
63
+ ## 1.0.0
64
+
65
+ Initial release (monolithic validator).
package/README.md CHANGED
@@ -1,78 +1,78 @@
1
- # `@x12i/memorix-format`
2
-
3
- Canonical **memorix-record/2** validation, migration, and CLI for Memorix.
4
-
5
- Object / content **types** belong in agent metadata — this package is the **envelope** SoT (shape of every stored subject content document), not product vocabulary.
6
-
7
- ## Install
8
-
9
- ```bash
10
- npm install @x12i/memorix-format@3.0.2
11
- ```
12
-
13
- | Audience | Use this package? |
14
- |----------|-------------------|
15
- | Remote app | Optional — validate offline / in CI |
16
- | Platform / writers / pipelines | **Yes** |
17
-
18
- ## API status
19
-
20
- | API | Status |
21
- |-----|--------|
22
- | `validateMemorixRecordV2`, CLI `validate-v2` / `migrate-to-v2` | **Current** SoT for platform work |
23
- | Present-envelope helpers | Migration / compat only |
24
-
25
- **Exports:** `.` · `./validate` · `./profiles` · `./types` · `./v2`
26
-
27
- ## Quick V2 example
28
-
29
- ```json
30
- {
31
- "format": "memorix-record/2",
32
- "recordId": "wi-100",
33
- "revision": 3,
34
- "objectType": "work-items",
35
- "contentType": "snapshots",
36
- "dataCategory": "entity",
37
- "concept": {
38
- "title": "Prepare quarterly operations review",
39
- "identifiers": {
40
- "primary": { "kind": "workItemId", "value": "WI-100", "issuer": "opx-source" }
41
- }
42
- },
43
- "data": { "status": "in-progress", "priority": "normal" },
44
- "_system": {
45
- "state": "active",
46
- "createdAt": "2026-01-10T10:00:00.000Z",
47
- "modifiedAt": "2026-01-15T12:00:00.000Z"
48
- }
49
- }
50
- ```
51
-
52
- ```bash
53
- npx memorix-format validate-v2 examples/v2
54
- npx memorix-format migrate-to-v2 ./present.json \
55
- --object-type=work-items --content-type=snapshots --data-category=entity
56
- ```
57
-
58
- ```ts
59
- import { validateMemorixRecordV2 } from "@x12i/memorix-format/v2";
60
-
61
- const result = validateMemorixRecordV2(doc);
62
- if (!result.ok) throw new Error(result.errors.join("; "));
63
- ```
64
-
65
- ## Hard rules (format)
66
-
67
- - V2 rejects **copied** related-record payloads in the document.
68
- - Authoritative navigation between subjects is **four-field relationship links** (`@x12i/memorix-relationships`), not embedded `associated*`.
69
-
70
- ## Docs
71
-
72
- - [`docs/memorix-record-v2.md`](./docs/memorix-record-v2.md) · [`meta/`](./meta/)
73
- - Ebook: [Format for Dummies](../memorix-docs/01-format-for-dummies/)
74
- - Hub: [https://docs.memorix.x12i.com](https://docs.memorix.x12i.com)
75
-
76
- ```bash
77
- npm test
78
- ```
1
+ # `@x12i/memorix-format`
2
+
3
+ Canonical **memorix-record/2** validation, migration, and CLI for Memorix.
4
+
5
+ Object / content **types** belong in agent metadata — this package is the **envelope** SoT (shape of every stored subject content document), not product vocabulary.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @x12i/memorix-format@3.0.2
11
+ ```
12
+
13
+ | Audience | Use this package? |
14
+ |----------|-------------------|
15
+ | Remote app | Optional — validate offline / in CI |
16
+ | Platform / writers / pipelines | **Yes** |
17
+
18
+ ## API status
19
+
20
+ | API | Status |
21
+ |-----|--------|
22
+ | `validateMemorixRecordV2`, CLI `validate-v2` / `migrate-to-v2` | **Current** SoT for platform work |
23
+ | Present-envelope helpers | Migration / compat only |
24
+
25
+ **Exports:** `.` · `./validate` · `./profiles` · `./types` · `./v2`
26
+
27
+ ## Quick V2 example
28
+
29
+ ```json
30
+ {
31
+ "format": "memorix-record/2",
32
+ "recordId": "wi-100",
33
+ "revision": 3,
34
+ "objectType": "work-items",
35
+ "contentType": "snapshots",
36
+ "dataCategory": "entity",
37
+ "concept": {
38
+ "title": "Prepare quarterly operations review",
39
+ "identifiers": {
40
+ "primary": { "kind": "workItemId", "value": "WI-100", "issuer": "opx-source" }
41
+ }
42
+ },
43
+ "data": { "status": "in-progress", "priority": "normal" },
44
+ "_system": {
45
+ "state": "active",
46
+ "createdAt": "2026-01-10T10:00:00.000Z",
47
+ "modifiedAt": "2026-01-15T12:00:00.000Z"
48
+ }
49
+ }
50
+ ```
51
+
52
+ ```bash
53
+ npx memorix-format validate-v2 examples/v2
54
+ npx memorix-format migrate-to-v2 ./present.json \
55
+ --object-type=work-items --content-type=snapshots --data-category=entity
56
+ ```
57
+
58
+ ```ts
59
+ import { validateMemorixRecordV2 } from "@x12i/memorix-format/v2";
60
+
61
+ const result = validateMemorixRecordV2(doc);
62
+ if (!result.ok) throw new Error(result.errors.join("; "));
63
+ ```
64
+
65
+ ## Hard rules (format)
66
+
67
+ - V2 rejects **copied** related-record payloads in the document.
68
+ - Authoritative navigation between subjects is **four-field relationship links** (`@x12i/memorix-relationships`), not embedded `associated*`.
69
+
70
+ ## Docs
71
+
72
+ - [`docs/memorix-record-v2.md`](./docs/memorix-record-v2.md) · [`meta/`](./meta/)
73
+ - Ebook: [Format for Dummies](../memorix-docs/01-format-for-dummies/)
74
+ - Hub: [https://docs.memorix.x12i.com](https://docs.memorix.x12i.com)
75
+
76
+ ```bash
77
+ npm test
78
+ ```
@@ -6,6 +6,10 @@ export declare const buildIdentityString: typeof buildExtIdentifierKey;
6
6
  export declare function buildExtIdentifier(kind: string, value: string, extra?: Record<string, string>): MemorixExtIdentifier;
7
7
  /** @deprecated Use buildExtIdentifier */
8
8
  export declare function buildConceptIdentifier(kind: string, value: string, extra?: Record<string, string>): MemorixExtIdentifier;
9
+ /**
10
+ * Subject identity. Mongo `_id` is never used — it is a storage key, not recordId.
11
+ * Legacy `identity.recordId` / `identity.targetId` remain for present-format inspect only.
12
+ */
9
13
  export declare function readRecordId(record: JsonObject): string;
10
14
  export declare function readConceptExtIdentifier(record: JsonObject): {
11
15
  kind: string;
@@ -1 +1 @@
1
- {"version":3,"file":"concept.d.ts","sourceRoot":"","sources":["../../src/base/concept.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAMnE,6EAA6E;AAC7E,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAoBxF;AAED,4CAA4C;AAC5C,eAAO,MAAM,mBAAmB,8BAAwB,CAAC;AAEzD,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACjC,oBAAoB,CAStB;AAED,yCAAyC;AACzC,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE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AAG,MAAM,CAQvD;AASD,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,UAAU,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAatD;AAED,+CAA+C;AAC/C,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,UAAU,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAGxC;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAIvE"}
@@ -39,6 +39,10 @@ export function buildExtIdentifier(kind, value, extra = {}) {
39
39
  export function buildConceptIdentifier(kind, value, extra = {}) {
40
40
  return buildExtIdentifier(kind, value, extra);
41
41
  }
42
+ /**
43
+ * Subject identity. Mongo `_id` is never used — it is a storage key, not recordId.
44
+ * Legacy `identity.recordId` / `identity.targetId` remain for present-format inspect only.
45
+ */
42
46
  export function readRecordId(record) {
43
47
  const root = stringifyId(record.recordId);
44
48
  if (root)
@@ -47,7 +51,7 @@ export function readRecordId(record) {
47
51
  if (isPlainObject(identity)) {
48
52
  return stringifyId(identity.recordId) ?? stringifyId(identity.targetId) ?? "";
49
53
  }
50
- return stringifyId(record._id) ?? "";
54
+ return "";
51
55
  }
52
56
  function readExtIdentifierObject(concept) {
53
57
  if (isPlainObject(concept._extIdentifier))
@@ -1 +1 @@
1
- {"version":3,"file":"concept.js","sourceRoot":"","sources":["../../src/base/concept.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,SAAS,GAAG,KAAK,CAAC;AACxB,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEzC,6EAA6E;AAC7E,MAAM,UAAU,qBAAqB,CAAC,UAAmC;IACvE,MAAM,IAAI,GAAG,WAAW,CAAC,U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C,MAAM,CAAC,CAAC;IAC7C,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAkB;IACjD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAC/B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9C,OAAO,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC;AACjD,CAAC"}
package/dist/cli.js CHANGED
@@ -28,42 +28,42 @@ function docsDir() {
28
28
  return candidates[0];
29
29
  }
30
30
  function printHelp() {
31
- console.log(`memorix-format <command> [options]
32
-
33
- Memorix format package.
34
-
35
- Present envelope (legacy product path):
36
- validate [path|-] Validate present format (base + profiles)
37
- migrate [path|-] Transform legacy → present format
38
-
39
- memorix-record/2 (Gate G2 SoT for new platform work):
40
- validate-v2 [path|-] Validate memorix-record/2
41
- migrate-to-v2 [path|-]
42
- Present/legacy → memorix-record/2
43
- Requires: --object-type --content-type --data-category
44
-
45
- Other:
46
- inspect [path|-] Summarize root categories (via base)
47
- docs [name] List or print packaged docs
48
- profiles List built-in present profiles
49
- profiles-v2 List V2 content-type profiles
50
- version
51
- help
52
-
53
- Options:
54
- --profile=<name> Present: ${BUILTIN_PROFILES.join(" | ")}
55
- --object-type=<name> Object type
56
- --content-type=<ct> Content type
57
- --data-category=<cat> V2 migrate: entity | event | knowledge
58
- --meta=<file> Custom ContentTypeMeta JSON (present validate)
59
- --allow-legacy Warn on legacy roots (compat)
60
- --reject-legacy Fail on legacy roots
61
- --out=<dir|file> migrate / migrate-to-v2 output
62
- --in-place Overwrite input files
63
- --revision=<n> migrate-to-v2 default revision (default 1)
64
- --issuer=<id> migrate-to-v2 default identifier issuer
65
- --strict
66
- --json
31
+ console.log(`memorix-format <command> [options]
32
+
33
+ Memorix format package.
34
+
35
+ Present envelope (legacy product path):
36
+ validate [path|-] Validate present format (base + profiles)
37
+ migrate [path|-] Transform legacy → present format
38
+
39
+ memorix-record/2 (Gate G2 SoT for new platform work):
40
+ validate-v2 [path|-] Validate memorix-record/2
41
+ migrate-to-v2 [path|-]
42
+ Present/legacy → memorix-record/2
43
+ Requires: --object-type --content-type --data-category
44
+
45
+ Other:
46
+ inspect [path|-] Summarize root categories (via base)
47
+ docs [name] List or print packaged docs
48
+ profiles List built-in present profiles
49
+ profiles-v2 List V2 content-type profiles
50
+ version
51
+ help
52
+
53
+ Options:
54
+ --profile=<name> Present: ${BUILTIN_PROFILES.join(" | ")}
55
+ --object-type=<name> Object type
56
+ --content-type=<ct> Content type
57
+ --data-category=<cat> V2 migrate: entity | event | knowledge
58
+ --meta=<file> Custom ContentTypeMeta JSON (present validate)
59
+ --allow-legacy Warn on legacy roots (compat)
60
+ --reject-legacy Fail on legacy roots
61
+ --out=<dir|file> migrate / migrate-to-v2 output
62
+ --in-place Overwrite input files
63
+ --revision=<n> migrate-to-v2 default revision (default 1)
64
+ --issuer=<id> migrate-to-v2 default identifier issuer
65
+ --strict
66
+ --json
67
67
  `);
68
68
  }
69
69
  function readFlag(args, name) {
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Collision-safe source-ID adoption for memorix-record/2.
3
+ * Bare provider values are never subject identity.
4
+ */
5
+ export declare const EXPLICIT_RECORD_ID_KIND = "recordId";
6
+ export type AdoptedIdentifier = {
7
+ kind: string;
8
+ value: string;
9
+ issuer?: string;
10
+ };
11
+ /** `{issuer}/{kind}/{value}` — two sources emitting the same value stay distinct. */
12
+ export declare function adoptedRecordId(identifier: AdoptedIdentifier): string;
13
+ /**
14
+ * True when a source identifier is being used as the org-wide subject id.
15
+ * `kind: "recordId"` with value equal to recordId is explicit identity, not adoption.
16
+ */
17
+ export declare function isCollisionUnsafeAdoption(recordId: string, primary: AdoptedIdentifier | undefined | null): boolean;
18
+ export declare function issuerRequired(primary: AdoptedIdentifier | undefined | null): boolean;
19
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/v2/identity.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,uBAAuB,aAAa,CAAC;AAElD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,UAAU,EAAE,iBAAiB,GAAG,MAAM,CAWrE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,iBAAiB,GAAG,SAAS,GAAG,IAAI,GAC5C,OAAO,CAOT;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAGrF"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Collision-safe source-ID adoption for memorix-record/2.
3
+ * Bare provider values are never subject identity.
4
+ */
5
+ export const EXPLICIT_RECORD_ID_KIND = "recordId";
6
+ /** `{issuer}/{kind}/{value}` — two sources emitting the same value stay distinct. */
7
+ export function adoptedRecordId(identifier) {
8
+ const issuer = identifier.issuer?.trim();
9
+ const kind = identifier.kind.trim();
10
+ const value = identifier.value.trim();
11
+ if (!issuer) {
12
+ throw new Error("adoptedRecordId requires issuer");
13
+ }
14
+ if (!kind || !value) {
15
+ throw new Error("adoptedRecordId requires kind and value");
16
+ }
17
+ return `${issuer}/${kind}/${value}`;
18
+ }
19
+ /**
20
+ * True when a source identifier is being used as the org-wide subject id.
21
+ * `kind: "recordId"` with value equal to recordId is explicit identity, not adoption.
22
+ */
23
+ export function isCollisionUnsafeAdoption(recordId, primary) {
24
+ if (!primary)
25
+ return false;
26
+ const kind = typeof primary.kind === "string" ? primary.kind.trim() : "";
27
+ const value = typeof primary.value === "string" ? primary.value.trim() : "";
28
+ if (!kind || !value)
29
+ return false;
30
+ if (kind === EXPLICIT_RECORD_ID_KIND)
31
+ return false;
32
+ return recordId.trim() === value;
33
+ }
34
+ export function issuerRequired(primary) {
35
+ if (!primary)
36
+ return true;
37
+ return primary.kind?.trim() !== EXPLICIT_RECORD_ID_KIND;
38
+ }
39
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../../src/v2/identity.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;AAQlD,qFAAqF;AACrF,MAAM,UAAU,eAAe,CAAC,UAA6B;IAC3D,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;IACzC,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACpC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IACtC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,GAAG,MAAM,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAAgB,EAChB,OAA6C;IAE7C,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,MAAM,IAAI,GAAG,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,MAAM,KAAK,GAAG,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5E,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IAClC,IAAI,IAAI,KAAK,uBAAuB;QAAE,OAAO,KAAK,CAAC;IACnD,OAAO,QAAQ,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAA6C;IAC1E,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,OAAO,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,uBAAuB,CAAC;AAC1D,CAAC"}
@@ -2,6 +2,7 @@ export type { ContentDiscriminator, ContentTypeProfileV2, MemorixConceptV2, Memo
2
2
  export { MEMORIX_RECORD_FORMAT_V2 } from "./types.js";
3
3
  export { BUILTIN_CONTENT_PROFILES, DATA_CATEGORIES, RECORD_STATES, V2_FIXED_ROOTS, V2_SNAPSHOT_BUCKETS, resolveContentProfile, } from "./profiles.js";
4
4
  export { validateMemorixRecordV2, validateMemorixRecordsV2 } from "./validate.js";
5
+ export { EXPLICIT_RECORD_ID_KIND, adoptedRecordId, isCollisionUnsafeAdoption, issuerRequired, type AdoptedIdentifier, } from "./identity.js";
5
6
  export { migratePresentToV2, migratePresentToV2Record, migratePresentRecordsToV2, type MigratePresentToV2Options, type MigratePresentToV2Result, type ExtractedRelationship, } from "./migrate-present.js";
6
7
  export { applySuccessfulMutation, checkExpectedRevision, nextRevision, type RevisionCheckResult, } from "./revision.js";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v2/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAElF,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,yBAAyB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,YAAY,EACZ,KAAK,mBAAmB,GACzB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/v2/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAElF,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,yBAAyB,EACzB,cAAc,EACd,KAAK,iBAAiB,GACvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,yBAAyB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,YAAY,EACZ,KAAK,mBAAmB,GACzB,MAAM,eAAe,CAAC"}
package/dist/v2/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { MEMORIX_RECORD_FORMAT_V2 } from "./types.js";
2
2
  export { BUILTIN_CONTENT_PROFILES, DATA_CATEGORIES, RECORD_STATES, V2_FIXED_ROOTS, V2_SNAPSHOT_BUCKETS, resolveContentProfile, } from "./profiles.js";
3
3
  export { validateMemorixRecordV2, validateMemorixRecordsV2 } from "./validate.js";
4
+ export { EXPLICIT_RECORD_ID_KIND, adoptedRecordId, isCollisionUnsafeAdoption, issuerRequired, } from "./identity.js";
4
5
  export { migratePresentToV2, migratePresentToV2Record, migratePresentRecordsToV2, } from "./migrate-present.js";
5
6
  export { applySuccessfulMutation, checkExpectedRevision, nextRevision, } from "./revision.js";
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v2/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAElF,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,yBAAyB,GAI1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,YAAY,GAEb,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/v2/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAElF,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,yBAAyB,EACzB,cAAc,GAEf,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,yBAAyB,GAI1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,YAAY,GAEb,MAAM,eAAe,CAAC"}
@@ -1,47 +1,47 @@
1
- # Association format
2
-
3
- Associated content is stored as **root-level open buckets** on snapshot records using the reserved `associated` prefix.
4
-
5
- **Normative naming / forms:** packaged [`meta/associated-conventions.json`](../meta/associated-conventions.json).
6
- **Operational detail** (presets, apply, enrichment orchestration): [`memorix-pipeline/docs/association-format.md`](../../memorix-pipeline/docs/association-format.md) and [running-associations.md](../../memorix-pipeline/docs/running-associations.md).
7
-
8
- This package validates association **shape** (ASSOC rules in [memorix-format-requirements.md](./memorix-format-requirements.md)); it does not invent object-type names.
9
-
10
- ---
11
-
12
- ## Core rule
13
-
14
- Association is always **snapshot-first**:
15
-
16
- 1. Start from the source object’s snapshot.
17
- 2. Match a target **snapshot** (`*-snapshots`).
18
- 3. Use the matched snapshot’s `recordId` to fetch non-snapshot content (`discovery`, `analysis`, `decisions`, …).
19
- 4. Copy flat content into an `associated…` array on the source snapshot.
20
-
21
- Never join a source snapshot directly to a non-snapshot collection by business keys.
22
-
23
- ---
24
-
25
- ## Naming
26
-
27
- | Form | Pattern | Example (abstract) |
28
- |---|---|---|
29
- | Legacy short names | `associatedData`, `associatedDiscovery`, … | still present on older records |
30
- | v2 content | `associated<ObjectType><ContentType>` | `associatedItemGroupsAnalysis` |
31
- | Ranked top | `associatedTop<ObjectType><ContentType>` | `associatedTopItemsAnalysis` |
32
- | Enrichment copy | `associated<ObjectType>Enrichment` | `associatedItemGroupsEnrichment` |
33
-
34
- Object-type segments come from Catalox descriptors — not from this format package.
35
-
36
- ---
37
-
38
- ## Payload rules
39
-
40
- - Associated properties are **arrays of plain objects** (linked payloads), never full envelopes.
41
- - On **memorix-record/2**, root `associated*` may hold **lightweight refs only** (Option A — format-valid): `relationshipDefinitionId` + `recordId`, optional `relationshipId`. Copied related business payload is rejected.
42
- - **Authoritative relationship storage (Gate G4)** is centralized per-category collections (Candidate C), not Option A roots or sibling `relationships` content. See `@x12i/memorix-relationship-store` (archived decision: `.tmp/housekeeping-2026-07-23/docs/re-factoring-and-opx-agent/RELATIONSHIP-STORAGE-DECISION.md`).
43
-
44
- - **Omit** the property when empty — never write `[]`.
45
- - Prefer traceability in optional item-level `_system.association` (v2) rather than wrapping envelopes.
46
-
47
- See requirements **ASSOC-*** and the pipeline association doc for matching / payload forms.
1
+ # Association format
2
+
3
+ Associated content is stored as **root-level open buckets** on snapshot records using the reserved `associated` prefix.
4
+
5
+ **Normative naming / forms:** packaged [`meta/associated-conventions.json`](../meta/associated-conventions.json).
6
+ **Operational detail** (presets, apply, enrichment orchestration): [`memorix-pipeline/docs/association-format.md`](../../memorix-pipeline/docs/association-format.md) and [running-associations.md](../../memorix-pipeline/docs/running-associations.md).
7
+
8
+ This package validates association **shape** (ASSOC rules in [memorix-format-requirements.md](./memorix-format-requirements.md)); it does not invent object-type names.
9
+
10
+ ---
11
+
12
+ ## Core rule
13
+
14
+ Association is always **snapshot-first**:
15
+
16
+ 1. Start from the source object’s snapshot.
17
+ 2. Match a target **snapshot** (`*-snapshots`).
18
+ 3. Use the matched snapshot’s `recordId` to fetch non-snapshot content (`discovery`, `analysis`, `decisions`, …).
19
+ 4. Copy flat content into an `associated…` array on the source snapshot.
20
+
21
+ Never join a source snapshot directly to a non-snapshot collection by business keys.
22
+
23
+ ---
24
+
25
+ ## Naming
26
+
27
+ | Form | Pattern | Example (abstract) |
28
+ |---|---|---|
29
+ | Legacy short names | `associatedData`, `associatedDiscovery`, … | still present on older records |
30
+ | v2 content | `associated<ObjectType><ContentType>` | `associatedItemGroupsAnalysis` |
31
+ | Ranked top | `associatedTop<ObjectType><ContentType>` | `associatedTopItemsAnalysis` |
32
+ | Enrichment copy | `associated<ObjectType>Enrichment` | `associatedItemGroupsEnrichment` |
33
+
34
+ Object-type segments come from Catalox descriptors — not from this format package.
35
+
36
+ ---
37
+
38
+ ## Payload rules
39
+
40
+ - Associated properties are **arrays of plain objects** (linked payloads), never full envelopes.
41
+ - On **memorix-record/2**, root `associated*` may hold **lightweight refs only** (Option A — format-valid): `relationshipDefinitionId` + `recordId`, optional `relationshipId`. Copied related business payload is rejected.
42
+ - **Authoritative relationship storage (Gate G4)** is centralized per-category collections (Candidate C), not Option A roots or sibling `relationships` content. See `@x12i/memorix-relationship-store` (archived decision: `.tmp/housekeeping-2026-07-23/docs/re-factoring-and-opx-agent/RELATIONSHIP-STORAGE-DECISION.md`).
43
+
44
+ - **Omit** the property when empty — never write `[]`.
45
+ - Prefer traceability in optional item-level `_system.association` (v2) rather than wrapping envelopes.
46
+
47
+ See requirements **ASSOC-*** and the pipeline association doc for matching / payload forms.