@x12i/memorix-descriptors 1.4.2 → 1.5.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.
Files changed (180) hide show
  1. package/README.md +17 -10
  2. package/dist/admin/create-admin.d.ts +20 -0
  3. package/dist/admin/create-admin.d.ts.map +1 -1
  4. package/dist/admin/create-admin.js +38 -2
  5. package/dist/admin/create-admin.js.map +1 -1
  6. package/dist/catalog/ids.d.ts +7 -0
  7. package/dist/catalog/ids.d.ts.map +1 -1
  8. package/dist/catalog/ids.js +13 -0
  9. package/dist/catalog/ids.js.map +1 -1
  10. package/dist/catalox/client.d.ts.map +1 -1
  11. package/dist/catalox/client.js +26 -1
  12. package/dist/catalox/client.js.map +1 -1
  13. package/dist/cli/index.js +146 -3
  14. package/dist/cli/index.js.map +1 -1
  15. package/dist/env/load-env-file.d.ts +7 -0
  16. package/dist/env/load-env-file.d.ts.map +1 -0
  17. package/dist/env/load-env-file.js +74 -0
  18. package/dist/env/load-env-file.js.map +1 -0
  19. package/dist/index.d.ts +9 -2
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +5 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/migration/apply.d.ts +21 -0
  24. package/dist/migration/apply.d.ts.map +1 -0
  25. package/dist/migration/apply.js +102 -0
  26. package/dist/migration/apply.js.map +1 -0
  27. package/dist/migration/backup.d.ts +8 -0
  28. package/dist/migration/backup.d.ts.map +1 -0
  29. package/dist/migration/backup.js +27 -0
  30. package/dist/migration/backup.js.map +1 -0
  31. package/dist/migration/classify.d.ts +6 -0
  32. package/dist/migration/classify.d.ts.map +1 -0
  33. package/dist/migration/classify.js +67 -0
  34. package/dist/migration/classify.js.map +1 -0
  35. package/dist/migration/ensure-canonical-catalogs.d.ts +4 -0
  36. package/dist/migration/ensure-canonical-catalogs.d.ts.map +1 -0
  37. package/dist/migration/ensure-canonical-catalogs.js +101 -0
  38. package/dist/migration/ensure-canonical-catalogs.js.map +1 -0
  39. package/dist/migration/generate-descriptors.d.ts +22 -0
  40. package/dist/migration/generate-descriptors.d.ts.map +1 -0
  41. package/dist/migration/generate-descriptors.js +234 -0
  42. package/dist/migration/generate-descriptors.js.map +1 -0
  43. package/dist/migration/index.d.ts +13 -0
  44. package/dist/migration/index.d.ts.map +1 -0
  45. package/dist/migration/index.js +12 -0
  46. package/dist/migration/index.js.map +1 -0
  47. package/dist/migration/inspect.d.ts +9 -0
  48. package/dist/migration/inspect.d.ts.map +1 -0
  49. package/dist/migration/inspect.js +57 -0
  50. package/dist/migration/inspect.js.map +1 -0
  51. package/dist/migration/load-snapshot.d.ts +15 -0
  52. package/dist/migration/load-snapshot.d.ts.map +1 -0
  53. package/dist/migration/load-snapshot.js +83 -0
  54. package/dist/migration/load-snapshot.js.map +1 -0
  55. package/dist/migration/mongo-inventory.d.ts +20 -0
  56. package/dist/migration/mongo-inventory.d.ts.map +1 -0
  57. package/dist/migration/mongo-inventory.js +95 -0
  58. package/dist/migration/mongo-inventory.js.map +1 -0
  59. package/dist/migration/object-type-specs.d.ts +17 -0
  60. package/dist/migration/object-type-specs.d.ts.map +1 -0
  61. package/dist/migration/object-type-specs.js +58 -0
  62. package/dist/migration/object-type-specs.js.map +1 -0
  63. package/dist/migration/plan.d.ts +4 -0
  64. package/dist/migration/plan.d.ts.map +1 -0
  65. package/dist/migration/plan.js +136 -0
  66. package/dist/migration/plan.js.map +1 -0
  67. package/dist/migration/reset.d.ts +17 -0
  68. package/dist/migration/reset.d.ts.map +1 -0
  69. package/dist/migration/reset.js +73 -0
  70. package/dist/migration/reset.js.map +1 -0
  71. package/dist/migration/types.d.ts +76 -0
  72. package/dist/migration/types.d.ts.map +1 -0
  73. package/dist/migration/types.js +17 -0
  74. package/dist/migration/types.js.map +1 -0
  75. package/dist/migration/validate-plan.d.ts +15 -0
  76. package/dist/migration/validate-plan.d.ts.map +1 -0
  77. package/dist/migration/validate-plan.js +112 -0
  78. package/dist/migration/validate-plan.js.map +1 -0
  79. package/dist/migration/verify.d.ts +15 -0
  80. package/dist/migration/verify.d.ts.map +1 -0
  81. package/dist/migration/verify.js +27 -0
  82. package/dist/migration/verify.js.map +1 -0
  83. package/dist/mutations/common.d.ts +7 -4
  84. package/dist/mutations/common.d.ts.map +1 -1
  85. package/dist/mutations/common.js +54 -3
  86. package/dist/mutations/common.js.map +1 -1
  87. package/dist/mutations/entity.d.ts.map +1 -1
  88. package/dist/mutations/entity.js +5 -1
  89. package/dist/mutations/entity.js.map +1 -1
  90. package/dist/mutations/execute.d.ts.map +1 -1
  91. package/dist/mutations/execute.js +9 -1
  92. package/dist/mutations/execute.js.map +1 -1
  93. package/dist/mutations/item.d.ts.map +1 -1
  94. package/dist/mutations/item.js +5 -1
  95. package/dist/mutations/item.js.map +1 -1
  96. package/dist/mutations/list.js +8 -1
  97. package/dist/mutations/list.js.map +1 -1
  98. package/dist/source/action-drafts.d.ts +17 -0
  99. package/dist/source/action-drafts.d.ts.map +1 -0
  100. package/dist/source/action-drafts.js +191 -0
  101. package/dist/source/action-drafts.js.map +1 -0
  102. package/dist/source/aliases.d.ts +23 -0
  103. package/dist/source/aliases.d.ts.map +1 -0
  104. package/dist/source/aliases.js +60 -0
  105. package/dist/source/aliases.js.map +1 -0
  106. package/dist/source/catalog-health.d.ts +17 -0
  107. package/dist/source/catalog-health.d.ts.map +1 -0
  108. package/dist/source/catalog-health.js +87 -0
  109. package/dist/source/catalog-health.js.map +1 -0
  110. package/dist/source/envelope.d.ts +29 -0
  111. package/dist/source/envelope.d.ts.map +1 -0
  112. package/dist/source/envelope.js +125 -0
  113. package/dist/source/envelope.js.map +1 -0
  114. package/dist/source/graph.d.ts +12 -0
  115. package/dist/source/graph.d.ts.map +1 -0
  116. package/dist/source/graph.js +148 -0
  117. package/dist/source/graph.js.map +1 -0
  118. package/dist/source/guards.d.ts +7 -0
  119. package/dist/source/guards.d.ts.map +1 -0
  120. package/dist/source/guards.js +74 -0
  121. package/dist/source/guards.js.map +1 -0
  122. package/dist/source/index.d.ts +14 -0
  123. package/dist/source/index.d.ts.map +1 -0
  124. package/dist/source/index.js +14 -0
  125. package/dist/source/index.js.map +1 -0
  126. package/dist/source/inspectable.d.ts +11 -0
  127. package/dist/source/inspectable.d.ts.map +1 -0
  128. package/dist/source/inspectable.js +167 -0
  129. package/dist/source/inspectable.js.map +1 -0
  130. package/dist/source/reconcile-source.d.ts +10 -0
  131. package/dist/source/reconcile-source.d.ts.map +1 -0
  132. package/dist/source/reconcile-source.js +40 -0
  133. package/dist/source/reconcile-source.js.map +1 -0
  134. package/dist/source/registry.d.ts +9 -0
  135. package/dist/source/registry.d.ts.map +1 -0
  136. package/dist/source/registry.js +121 -0
  137. package/dist/source/registry.js.map +1 -0
  138. package/dist/source/snapshot.d.ts +15 -0
  139. package/dist/source/snapshot.d.ts.map +1 -0
  140. package/dist/source/snapshot.js +160 -0
  141. package/dist/source/snapshot.js.map +1 -0
  142. package/dist/source/types.d.ts +222 -0
  143. package/dist/source/types.d.ts.map +1 -0
  144. package/dist/source/types.js +2 -0
  145. package/dist/source/types.js.map +1 -0
  146. package/dist/source/validation.d.ts +12 -0
  147. package/dist/source/validation.d.ts.map +1 -0
  148. package/dist/source/validation.js +229 -0
  149. package/dist/source/validation.js.map +1 -0
  150. package/dist/tests/canonical-metadata.test.d.ts +2 -0
  151. package/dist/tests/canonical-metadata.test.d.ts.map +1 -0
  152. package/dist/tests/canonical-metadata.test.js +198 -0
  153. package/dist/tests/canonical-metadata.test.js.map +1 -0
  154. package/dist/tests/source-aware.test.d.ts +2 -0
  155. package/dist/tests/source-aware.test.d.ts.map +1 -0
  156. package/dist/tests/source-aware.test.js +227 -0
  157. package/dist/tests/source-aware.test.js.map +1 -0
  158. package/dist/types/canonical-v2.d.ts +164 -0
  159. package/dist/types/canonical-v2.d.ts.map +1 -0
  160. package/dist/types/canonical-v2.js +6 -0
  161. package/dist/types/canonical-v2.js.map +1 -0
  162. package/dist/types/index.d.ts +25 -2
  163. package/dist/types/index.d.ts.map +1 -1
  164. package/dist/validation/canonical-contamination.d.ts +6 -0
  165. package/dist/validation/canonical-contamination.d.ts.map +1 -0
  166. package/dist/validation/canonical-contamination.js +71 -0
  167. package/dist/validation/canonical-contamination.js.map +1 -0
  168. package/dist/validation/canonical-metadata-validation.d.ts +13 -0
  169. package/dist/validation/canonical-metadata-validation.d.ts.map +1 -0
  170. package/dist/validation/canonical-metadata-validation.js +248 -0
  171. package/dist/validation/canonical-metadata-validation.js.map +1 -0
  172. package/dist/validation/canonical-v2-validation.d.ts +8 -0
  173. package/dist/validation/canonical-v2-validation.d.ts.map +1 -0
  174. package/dist/validation/canonical-v2-validation.js +273 -0
  175. package/dist/validation/canonical-v2-validation.js.map +1 -0
  176. package/docs/MEMORIX-CATALOX-CATALOG-MAP.md +589 -0
  177. package/docs/MEMORIX-CATALOX-CONTRACTS.md +17 -10
  178. package/docs/MEMORIX-DATABASE-CONVENTIONS.md +10 -7
  179. package/docs/MEMORIX-OBJECT-TYPES-AND-TARGETS.md +207 -0
  180. package/package.json +9 -1
@@ -42,16 +42,19 @@ Packages resolve `memorix-entities`, `memorix-events`, collection names, and ent
42
42
  └─────────────────────────────────────────────────────────────┘
43
43
  ```
44
44
 
45
- ## Target types
45
+ ## Storage targets (Mongo tier)
46
46
 
47
- Every Memorix record belongs to exactly one **target**:
47
+ Every Memorix **record** belongs to exactly one **storage target**. This is independent of the **catalog object type** name (`assets`, `vulnerabilities`, …) declared in Catalox — see [MEMORIX-OBJECT-TYPES-AND-TARGETS.md](./MEMORIX-OBJECT-TYPES-AND-TARGETS.md).
48
48
 
49
- | Target | Database | Typical use |
50
- |--------|----------|-------------|
51
- | `entity` | `memorix-entities` | Stable domain objects (vulnerability, asset, group, ) |
52
- | `event` | `memorix-events` | Occurrences, detections, or timeline entries |
49
+ | Target | Database | Typical catalog object types |
50
+ |--------|----------|------------------------------|
51
+ | `entity` | `memorix-entities` | `assets`, `variabilities-groups`, subnets, … |
52
+ | `event` | `memorix-events` | `vulnerabilities` (findings), timeline entries |
53
+ | `knowledge` | `memorix-knowledge` | Curated knowledge payloads (when wired) |
53
54
 
54
- Tools must declare which target they read or write. Do not mix entity and event documents in the same collection.
55
+ Tools must declare which target they read or write. Do not mix entity- and event-target documents in the same collection.
56
+
57
+ > **Naming trap:** Database `memorix-entities` means **target = entity**, not “every Memorix object type”. Object types with `target: "event"` live in `memorix-events` even if UI calls them “entities”.
55
58
 
56
59
  ## Environment variables
57
60
 
@@ -0,0 +1,207 @@
1
+ # Memorix object types, storage targets, and naming
2
+
3
+ **Canonical terminology** for the Memorix stack. Use this document when reading or writing code, Catalox catalog ids, Mongo env vars, and UI copy.
4
+
5
+ If a name contains **`entity`**, check which row of [§2](#2-glossary) it belongs to — **five different meanings** are in play today.
6
+
7
+ **Related:** [MEMORIX-CATALOX-CATALOG-MAP.md](./MEMORIX-CATALOX-CATALOG-MAP.md) (Firestore catalogs), [MEMORIX-CATALOX-CONTRACTS.md](./MEMORIX-CATALOX-CONTRACTS.md) (descriptor JSON), [MEMORIX-DATABASE-CONVENTIONS.md](./MEMORIX-DATABASE-CONVENTIONS.md) (Mongo layout).
8
+
9
+ ---
10
+
11
+ ## 1. Mental model (two layers)
12
+
13
+ ```text
14
+ ┌─────────────────────────────────────────────────────────────────────────┐
15
+ │ CATALOX (metadata) — appId: memorix │
16
+ │ │
17
+ │ Catalog object type = one registered domain in memorix-entity- │
18
+ │ descriptors (field: entityName today) │
19
+ │ e.g. assets, vulnerabilities, variabilities- │
20
+ │ groups │
21
+ │ │
22
+ │ Each object type has: │
23
+ │ • storage target → entity | event | knowledge │
24
+ │ • list / item views → memorix-list- / memorix-item-descriptors │
25
+ │ • content types → snapshots, scoped, … → Mongo collections │
26
+ └───────────────────────────────┬─────────────────────────────────────────┘
27
+ │ descriptor-driven reads/writes
28
+
29
+ ┌─────────────────────────────────────────────────────────────────────────┐
30
+ │ MONGODB (payload) — separate databases per storage target │
31
+ │ │
32
+ │ target "entity" → DB memorix-entities (env: MEMORIX_ENTITIES_DB) │
33
+ │ target "event" → DB memorix-events (env: MEMORIX_EVENTS_DB) │
34
+ │ target "knowledge" → DB memorix-knowledge (env: MEMORIX_KNOWLEDGE_DB)│
35
+ │ │
36
+ │ Collection naming: {objectName}-{contentType} e.g. assets-snapshots │
37
+ │ Record identity: entityId | eventId | knowledgeId on envelope │
38
+ └─────────────────────────────────────────────────────────────────────────┘
39
+ ```
40
+
41
+ **Rule:** A **catalog object type** is declared in Catalox. A **Mongo record** is stored under the **target database** chosen by that type’s `target` field. The word “entity” must not be used loosely for both.
42
+
43
+ ---
44
+
45
+ ## 2. Glossary
46
+
47
+ | Term (use in new docs) | Code / config name today | Meaning | Example |
48
+ |------------------------|--------------------------|---------|---------|
49
+ | **Storage target** | `MemorixTarget`, `target` | Which Memorix **Mongo database role** holds payload for this object type | `vulnerabilities` → `target: "event"` → `memorix-events` |
50
+ | **Catalog object type** | `entityName` on descriptor; `objectName` in inventory | Kebab-case **domain id** registered in `memorix-entity-descriptors` | `assets`, `variabilities-groups` |
51
+ | **Object type descriptor** | `MemorixEntityDescriptor` (type name is legacy) | Catalox item in `memorix-entity-descriptors` describing one catalog object type | item id `assets` |
52
+ | **Content type** | key under `contentTypes` | Named slice of data for an object type; drives collection suffix | `snapshots` → `assets-snapshots` |
53
+ | **List view** | list descriptor `entity` field | Tabular descriptor bound to one object type | `assets-main-list` → object type `assets` |
54
+ | **Item view** | item descriptor `entity` field | Detail descriptor bound to one object type | `asset-detail-item` |
55
+ | **Record** | Mongo document | Payload row with `data` + identity field(s) | one row in `vulnerabilities-snapshots` |
56
+ | **Knowledge artifact** | `knowledge` catalog item | Separate track (`knowledgeId`), not an object type descriptor | `skill-asset-context-analysis` |
57
+
58
+ ### 2.1 Storage targets (the three tiers)
59
+
60
+ | Target | Default Mongo DB | Primary identity field | What belongs here |
61
+ |--------|------------------|------------------------|-------------------|
62
+ | `entity` | `memorix-entities` | `entityId` | Stable inventory-style objects (assets, groups, subnets, …) |
63
+ | `event` | `memorix-events` | `eventId` (descriptor may still allow `entityId` in identity block) | Findings, detections, timeline-oriented vulns |
64
+ | `knowledge` | `memorix-knowledge` | `knowledgeId` | Curated facts, skills, playbooks (ecosystem rollout coordinated across packages) |
65
+
66
+ **Why three targets:** Same **object type name** could theoretically exist on different tiers; in practice each catalog object type picks **one** `target` so completion, inventory, and Xronox resolve the correct database.
67
+
68
+ **Shipped examples:**
69
+
70
+ | Catalog object type (`entityName`) | Storage target | Mongo DB |
71
+ |-----------------------------------|----------------|----------|
72
+ | `assets` | `entity` | `memorix-entities` |
73
+ | `variabilities-groups` | `entity` | `memorix-entities` |
74
+ | `vulnerabilities` | `event` | `memorix-events` |
75
+
76
+ ---
77
+
78
+ ## 3. What is overloaded today (“entity” mess)
79
+
80
+ The same word **entity** refers to different concepts. This table is the root cause of confusion.
81
+
82
+ | # | Name | Layer | What it actually is | Common mistake |
83
+ |---|------|-------|---------------------|----------------|
84
+ | A | **`target: "entity"`** | Descriptor + Mongo | Storage tier / DB role | Calling every catalog object type an “entity” |
85
+ | B | **`entityName`** | Descriptor JSON | **Catalog object type** id | Thinking it only applies when `target === "entity"` |
86
+ | C | **`memorix-entity-descriptors`** | Catalox catalog id | Registry of **all** object type descriptors (entity + event + knowledge targets) | Assuming the catalog only describes `target: "entity"` types |
87
+ | D | **`memorix-entities`** (Mongo DB) | Mongo | Database for **target entity** payload | Confusing with catalog id (E) or object types (B) |
88
+ | E | **`memorix-entities`** (Catalox catalog) | Firestore legacy | Inferred schema samples (`dataDescriptors`), **not** object type descriptors | Treating as source of truth for retrieval |
89
+ | F | **`entityId`** | Mongo envelope | Record identity field (used across targets in places) | Assuming “entityId ⇒ target entity” (vuln items use `entityId` while `target` is `event`) |
90
+ | G | **`cataloxObjects`** | Inventory API | Count of distinct **catalog object types** (`objectName` / `entityName`) | Sounds like Catalox “entities” catalog (E) |
91
+
92
+ **Inventory / reconcile** partially uses clearer language: **`objectName`** = parsed from `assets-snapshots` → object type `assets`, aligned with descriptor `entityName`. Prefer **object type** in prose; treat `entityName` as a legacy field name.
93
+
94
+ ---
95
+
96
+ ## 4. Correct sentences (copy-paste patterns)
97
+
98
+ | Instead of… | Write… |
99
+ |-------------|--------|
100
+ | “The vulnerabilities **entity**” (ambiguous) | “The **catalog object type** `vulnerabilities`” or “vulnerabilities **object type**” |
101
+ | “Stored in the entities database” | “Stored with **target** `event` in **`memorix-events`**” |
102
+ | “Entity descriptor catalog” | “**Object type descriptor** catalog (`memorix-entity-descriptors`)” |
103
+ | “Catalox entities catalog” | “Legacy **`memorix-entities`** inference catalog (deprecated)” |
104
+ | “Entity collection `assets-snapshots`” | “Mongo collection for object type **assets**, content type **snapshots**” |
105
+ | “9 entities in Catalox” (legacy catalog) | “9 **inferred object type rows** in legacy catalog `memorix-entities`” |
106
+ | “Discovery lists entities” | “Discovery lists **catalog object types** from `memorix-entity-descriptors`” |
107
+
108
+ ---
109
+
110
+ ## 5. Catalog object types vs Catalox catalogs
111
+
112
+ Do not confuse **catalog object types** (domain ids) with **Catalox catalog ids** (Firestore buckets).
113
+
114
+ | Catalox `catalogId` | Holds | Relates to object types? |
115
+ |-------------------|-------|---------------------------|
116
+ | `memorix-entity-descriptors` | One item per **catalog object type** | **Yes** — source of truth |
117
+ | `memorix-list-descriptors` | List/workspace/slice views | References object type via `entity` field |
118
+ | `memorix-item-descriptors` | Detail views | References object type via `entity` field |
119
+ | `memorix-completion-mappings` | Enrichment jobs | References `entityType` (= object type name) |
120
+ | `memorix-inventory-policies` | Ignored Mongo collections | Per **target** + collection |
121
+ | `memorix-entities` | **Legacy** inference only | Parallel naming to Mongo DB — **misleading** |
122
+ | `memorix_entity_content_types` | **Legacy** global content-type registry | Superseded by per–object-type `contentTypes` |
123
+ | `knowledge` | Knowledge **artifacts** | Not the same as object types (separate product surface) |
124
+
125
+ There is **no** separate Catalox catalog per storage target. Target is a **field on each object type descriptor**.
126
+
127
+ ---
128
+
129
+ ## 6. Collection naming ties object type + content type
130
+
131
+ ```text
132
+ {objectName}-{contentType}
133
+ │ │
134
+ │ └── content type key (snapshots, scoped, …)
135
+ └── catalog object type (same as entityName / inventory objectName)
136
+ ```
137
+
138
+ Parser: `parseMemorixCollectionName` — last hyphen splits object type from content type.
139
+
140
+ Inventory row: `(target, databaseName, objectName, contentType, collectionName)`.
141
+
142
+ ---
143
+
144
+ ## 7. Rename roadmap (recommended — not yet applied in code)
145
+
146
+ Goal: **one public noun** for domain types (**catalog object type** / **object type**), **target** only for Mongo tier, and **no catalog id** that sounds like Mongo `memorix-entities`.
147
+
148
+ | Current | Proposed | Scope | Breaking? | Why |
149
+ |---------|----------|-------|-----------|-----|
150
+ | `entityName` (descriptor) | `objectType` or `objectName` | JSON + TS | **Yes** — major | Name matches inventory and collection parser |
151
+ | `MemorixEntityDescriptor` | `MemorixObjectTypeDescriptor` | TS export | **Yes** | Type describes any target, not only `entity` |
152
+ | `memorix-entity-descriptors` | `memorix-object-type-descriptors` | Catalox catalog id + seeds | **Yes** — migration | Removes false “entity-only” implication |
153
+ | `entity` (list/item descriptor field) | `objectType` | JSON | **Yes** | Align with object-type vocabulary |
154
+ | `entityType` (completion mapping) | `objectType` | JSON | **Yes** | Same |
155
+ | `cataloxObjects` (inventory summary) | `declaredObjectTypes` | API | **Yes** | Accurate count label |
156
+ | `registerEntityDescriptor` | `registerObjectTypeDescriptor` | API | **Yes** | Admin method names |
157
+ | Catalox `memorix-entities` | Deprecate → `memorix-mongo-schema-inference` (or delete) | Firestore | Medium | Stops collision with Mongo DB name |
158
+ | Mongo DB `memorix-entities` | Keep (or `memorix-object-store-entity` long-term) | Mongo | **Very high** | Industry-wide env vars; document only unless cluster migration |
159
+ | `entityId` on records | Keep; document per-target | Mongo | High | Widespread; vuln stack already uses `entityId` on event target |
160
+
161
+ **Phased approach:**
162
+
163
+ 1. **Docs + UI copy** — adopt §4 patterns immediately (this repo: done in linked docs).
164
+ 2. **Additive aliases** — accept `objectType` alongside `entityName` in validators (non-breaking).
165
+ 3. **Catalox catalog migration** — dual-write / seed both catalog ids, switch retrieval, retire old id.
166
+ 4. **Remove legacy** `memorix-entities` and `memorix_entity_content_types` Firestore catalogs when no consumer lists them.
167
+
168
+ ---
169
+
170
+ ## 8. API and code map (today)
171
+
172
+ | Concept | Where in `@x12i/memorix-descriptors` |
173
+ |---------|--------------------------------------|
174
+ | Storage target | `MemorixTarget` in `src/types/index.ts` |
175
+ | Object type id | `entityName` on descriptors; `objectName` in `src/reconcile/inventory-types.ts` |
176
+ | Target → Mongo DB | `resolveMemorixDbName` in `src/collections/mongo-env.ts` |
177
+ | Collection parse | `parseMemorixCollectionName` in `src/collections/parse.ts` |
178
+ | Declared slots | `buildDeclaredSlots` in `src/reconcile/unified-inventory.ts` (`objectName: entity.entityName`) |
179
+ | Catalog ids | `src/catalog/ids.ts` |
180
+
181
+ Retrieval discovery: lists **`memorix-entity-descriptors`** → returns summaries with `entityName` (treat as **object type** in UI).
182
+
183
+ ---
184
+
185
+ ## 9. FAQ
186
+
187
+ **Q: Is `vulnerabilities` an entity or an event?**
188
+ A: It is a **catalog object type** named `vulnerabilities` with **storage target** `event`. Colloquially “vulnerability entity” is wrong in strict terms; say “vulnerability object type” or “vulnerabilities (event target)”.
189
+
190
+ **Q: Why does the descriptor catalog id say `entity`?**
191
+ A: Historical naming from when only `memorix-entities` Mongo tier existed. The catalog now holds object types for **all** targets. Rename planned (§7).
192
+
193
+ **Q: What should Explorer show in a type picker?**
194
+ A: **Object types** from discovery (`entityName`), with badge for **target** (`entity` / `event` / `knowledge`) and DB name — not “Entities” as a single bucket.
195
+
196
+ **Q: Does `knowledge` catalog replace object types?**
197
+ A: No. `knowledge` catalog holds **artifacts** (`knowledgeId`). Object types with `target: "knowledge"` would still be declared in `memorix-entity-descriptors` when that tier is fully wired.
198
+
199
+ ---
200
+
201
+ ## 10. Checklist for authors
202
+
203
+ - [ ] Used **storage target** for `entity` | `event` | `knowledge` and Mongo DB choice
204
+ - [ ] Used **catalog object type** / **object type** for `assets`, `vulnerabilities`, etc.
205
+ - [ ] Did not refer to legacy Catalox `memorix-entities` as descriptor source of truth
206
+ - [ ] Distinguished Mongo **`memorix-entities`** (database) from catalog **`memorix-entity-descriptors`**
207
+ - [ ] Did not imply `memorix-entity-descriptors` only applies to `target: "entity"`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x12i/memorix-descriptors",
3
- "version": "1.4.2",
3
+ "version": "1.5.0",
4
4
  "description": "Manage Memorix entity, list, and item descriptors in Catalox",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -45,6 +45,13 @@
45
45
  "test:live": "vitest run src/tests/live",
46
46
  "test:all": "vitest run",
47
47
  "validate:seeds": "node scripts/validate-descriptor-seeds.mjs",
48
+ "memorix:metadata:inspect": "tsx scripts/memorix-metadata/inspect.ts",
49
+ "memorix:metadata:plan": "tsx scripts/memorix-metadata/plan.ts",
50
+ "memorix:metadata:validate-plan": "tsx scripts/memorix-metadata/validate-plan.ts",
51
+ "memorix:metadata:apply": "tsx scripts/memorix-metadata/apply.ts",
52
+ "memorix:metadata:cleanup-legacy": "tsx scripts/memorix-metadata/cleanup-legacy.ts",
53
+ "memorix:metadata:verify": "tsx scripts/memorix-metadata/verify.ts",
54
+ "memorix:metadata:reset": "tsx scripts/memorix-metadata/reset.ts",
48
55
  "prepublishOnly": "npm run build"
49
56
  },
50
57
  "engines": {
@@ -60,6 +67,7 @@
60
67
  "@x12i/catalox": "^5.0.0",
61
68
  "@x12i/xronox": "^3.9.0",
62
69
  "dotenv": "^16.4.5",
70
+ "tsx": "^4.19.0",
63
71
  "typescript": "^5.6.0",
64
72
  "vitest": "^2.1.0"
65
73
  },