@x12i/memorix-service 0.2.0 → 3.0.1

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.
@@ -0,0 +1,199 @@
1
+ import { resolveScope } from "../request-scope.js";
2
+ import { ServiceError } from "../errors.js";
3
+ import { collectJourneyObservations, queryJourneyMatrix, resolveJourneyEvidence, } from "../journey/collect.js";
4
+ import { listExpectedSlots, queryJourneyCoverage, } from "../journey/coverage.js";
5
+ /** In-memory evidence cache keyed by opaque ref → observation set fingerprint (request-scoped via query). */
6
+ const evidenceCache = new Map();
7
+ function cacheKey(orgId, objectType, runId, recordId) {
8
+ return `${orgId}|${objectType}|${runId ?? ""}|${recordId ?? ""}`;
9
+ }
10
+ export async function registerDataJourneyRoutes(app, platform) {
11
+ app.get("/api/data-journey/object-types", async (req) => {
12
+ const scope = resolveScope(req);
13
+ const effective = platform.metadata.resolveEffective(scope.agentIds);
14
+ const objectTypes = (effective.effective ?? [])
15
+ .filter((e) => e.kind === "object-types")
16
+ .map((e) => {
17
+ const d = e.definition;
18
+ return {
19
+ objectType: d.objectType ?? d.id ?? e.id,
20
+ label: d.name ?? d.objectType ?? d.id ?? e.id,
21
+ };
22
+ });
23
+ // Dedup
24
+ const seen = new Set();
25
+ const list = objectTypes.filter((o) => {
26
+ const id = String(o.objectType);
27
+ if (seen.has(id))
28
+ return false;
29
+ seen.add(id);
30
+ return true;
31
+ });
32
+ return { scope, objectTypes: list };
33
+ });
34
+ app.get("/api/data-journey/journeys", async (req) => {
35
+ const scope = resolveScope(req);
36
+ const q = req.query;
37
+ if (!q.objectType) {
38
+ throw new ServiceError("VALIDATION", "objectType required", 400);
39
+ }
40
+ const ports = platform.portsFor(scope);
41
+ const runs = await ports.pipeline.listRuns({ limit: 50 });
42
+ return {
43
+ scope,
44
+ objectType: q.objectType,
45
+ recordId: q.recordId ?? null,
46
+ journeys: [
47
+ {
48
+ kind: "latest-run",
49
+ runId: runs[0]?.runId ?? null,
50
+ label: "Latest pipeline run",
51
+ },
52
+ ...runs.slice(0, 20).map((r) => ({
53
+ kind: "run",
54
+ runId: r.runId,
55
+ status: r.status,
56
+ pipelineId: r.pipelineId,
57
+ label: `Run ${r.runId}`,
58
+ })),
59
+ ...(q.recordId
60
+ ? [
61
+ {
62
+ kind: "record",
63
+ recordId: q.recordId,
64
+ label: `Record ${q.recordId}`,
65
+ },
66
+ ]
67
+ : []),
68
+ {
69
+ kind: "fixture",
70
+ fixtureName: "procedures-proc-2",
71
+ objectType: "procedures",
72
+ recordId: "PROC-2",
73
+ label: "Golden fixture PROC-2 (procedures)",
74
+ },
75
+ ],
76
+ };
77
+ });
78
+ app.post("/api/data-journey/matrix/query", async (req) => {
79
+ const scope = resolveScope(req);
80
+ const body = (req.body ?? {});
81
+ if (body.basis?.kind === "fixture" && !body.basis.fixtureName) {
82
+ body.basis.fixtureName = "procedures-proc-2";
83
+ body.objectType = body.objectType ?? "procedures";
84
+ body.basis.recordId = body.basis.recordId ?? "PROC-2";
85
+ }
86
+ const collected = await collectJourneyObservations(platform, scope, {
87
+ objectType: body.objectType,
88
+ runId: body.basis?.runId,
89
+ recordId: body.basis?.recordId,
90
+ fixtureName: body.basis?.fixtureName,
91
+ });
92
+ const key = cacheKey(scope.orgId, body.objectType, body.basis?.runId ?? collected.basis.runId, body.basis?.recordId ?? collected.basis.recordId);
93
+ evidenceCache.set(key, {
94
+ observations: collected.observations,
95
+ expires: Date.now() + 5 * 60_000,
96
+ });
97
+ const { projectMatrix } = await import("@x12i/memorix-data-journey");
98
+ return projectMatrix(collected.observations, {
99
+ objectType: body.objectType,
100
+ basis: {
101
+ ...collected.basis,
102
+ kind: body.basis?.kind ??
103
+ collected.basis.kind,
104
+ },
105
+ granularity: body.granularity ?? "root",
106
+ includeValues: body.includeValues ?? false,
107
+ includeSystem: body.includeSystem ?? false,
108
+ includeRawProperties: body.includeRawProperties ?? false,
109
+ expandPath: body.expandPath,
110
+ scope: { orgId: scope.orgId, agentIds: scope.agentIds },
111
+ partialReasons: collected.partialReasons,
112
+ });
113
+ });
114
+ app.post("/api/data-journey/matrix/columns/query", async (req) => {
115
+ const scope = resolveScope(req);
116
+ const body = (req.body ?? {});
117
+ if (body.basis?.kind === "fixture" && !body.basis.fixtureName) {
118
+ body.basis.fixtureName = "procedures-proc-2";
119
+ body.objectType = body.objectType ?? "procedures";
120
+ }
121
+ return queryJourneyMatrix(platform, scope, {
122
+ ...body,
123
+ granularity: "property",
124
+ expandPath: body.parentPath,
125
+ });
126
+ });
127
+ app.post("/api/data-journey/matrix/cells/query", async (req) => {
128
+ const scope = resolveScope(req);
129
+ const body = (req.body ?? {});
130
+ if (body.basis?.kind === "fixture" && !body.basis.fixtureName) {
131
+ body.basis.fixtureName = "procedures-proc-2";
132
+ body.objectType = body.objectType ?? "procedures";
133
+ }
134
+ const matrix = await queryJourneyMatrix(platform, scope, {
135
+ ...body,
136
+ granularity: "property",
137
+ includeRawProperties: body.includeRawProperties ?? true,
138
+ });
139
+ const rowSet = body.rowIds ? new Set(body.rowIds) : null;
140
+ const colSet = body.columnIds ? new Set(body.columnIds) : null;
141
+ const cells = matrix.cells.filter((c) => {
142
+ if (rowSet && !rowSet.has(c.rowId))
143
+ return false;
144
+ if (colSet && !colSet.has(c.columnId))
145
+ return false;
146
+ return true;
147
+ });
148
+ return { scope, cells, truth: matrix.truth };
149
+ });
150
+ app.get("/api/data-journey/evidence/:evidenceRef", async (req) => {
151
+ const scope = resolveScope(req);
152
+ const { evidenceRef } = req.params;
153
+ const q = req.query;
154
+ if (!q.objectType) {
155
+ throw new ServiceError("VALIDATION", "objectType query required", 400);
156
+ }
157
+ const key = cacheKey(scope.orgId, q.objectType, q.runId, q.recordId);
158
+ let cached = evidenceCache.get(key);
159
+ if (!cached || cached.expires < Date.now()) {
160
+ const collected = await collectJourneyObservations(platform, scope, {
161
+ objectType: q.objectType,
162
+ runId: q.runId,
163
+ recordId: q.recordId,
164
+ fixtureName: q.fixtureName,
165
+ });
166
+ cached = {
167
+ observations: collected.observations,
168
+ expires: Date.now() + 5 * 60_000,
169
+ };
170
+ evidenceCache.set(key, cached);
171
+ }
172
+ const decoded = decodeURIComponent(evidenceRef);
173
+ const detail = resolveJourneyEvidence(cached.observations, decoded, q.includeValues === "true");
174
+ if (!detail) {
175
+ throw new ServiceError("NOT_FOUND", "evidence not found", 404);
176
+ }
177
+ return { scope, evidence: detail };
178
+ });
179
+ app.get("/api/data-journey/expected-slots", async (req) => {
180
+ const scope = resolveScope(req);
181
+ const q = req.query;
182
+ if (!q.objectType) {
183
+ throw new ServiceError("VALIDATION", "objectType required", 400);
184
+ }
185
+ return listExpectedSlots(platform, scope, {
186
+ objectType: q.objectType,
187
+ viewIds: q.viewIds
188
+ ? q.viewIds.split(",").map((s) => s.trim()).filter(Boolean)
189
+ : undefined,
190
+ fixtureName: q.fixtureName,
191
+ });
192
+ });
193
+ app.post("/api/data-journey/coverage", async (req) => {
194
+ const scope = resolveScope(req);
195
+ const body = (req.body ?? {});
196
+ return queryJourneyCoverage(platform, scope, body);
197
+ });
198
+ }
199
+ //# sourceMappingURL=data-journey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-journey.js","sourceRoot":"","sources":["../../src/routes/data-journey.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAEhC,6GAA6G;AAC7G,MAAM,aAAa,GAAG,IAAI,GAAG,EAG1B,CAAC;AAEJ,SAAS,QAAQ,CAAC,KAAa,EAAE,UAAkB,EAAE,KAAc,EAAE,QAAiB;IACpF,OAAO,GAAG,KAAK,IAAI,UAAU,IAAI,KAAK,IAAI,EAAE,IAA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G,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;gBAC3D,CAAC,CAAC,SAAS;YACb,WAAW,EAAE,CAAC,CAAC,WAAW;SAC3B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,IAAI,CAAC,4BAA4B,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACnD,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAChC,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAa3B,CAAC;QACF,OAAO,oBAAoB,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAa,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "servers": [
9
9
  {
10
- "url": "http://127.0.0.1:5000"
10
+ "url": "http://127.0.0.1:5100"
11
11
  }
12
12
  ],
13
13
  "tags": [
@@ -37,6 +37,10 @@
37
37
  },
38
38
  {
39
39
  "name": "Intelligence"
40
+ },
41
+ {
42
+ "name": "DataJourney",
43
+ "description": "Evidence cone and expected-vs-filled coverage (read-only)"
40
44
  }
41
45
  ],
42
46
  "paths": {
@@ -5338,6 +5342,406 @@
5338
5342
  }
5339
5343
  }
5340
5344
  }
5345
+ },
5346
+ "/api/data-journey/object-types": {
5347
+ "get": {
5348
+ "tags": [
5349
+ "DataJourney"
5350
+ ],
5351
+ "summary": "List object types for journey selector",
5352
+ "parameters": [
5353
+ {
5354
+ "in": "header",
5355
+ "name": "x-memorix-org-id",
5356
+ "required": true,
5357
+ "schema": {
5358
+ "type": "string"
5359
+ }
5360
+ },
5361
+ {
5362
+ "in": "header",
5363
+ "name": "x-memorix-agent-ids",
5364
+ "required": true,
5365
+ "schema": {
5366
+ "type": "string"
5367
+ }
5368
+ }
5369
+ ],
5370
+ "responses": {
5371
+ "200": {
5372
+ "description": "objectTypes list"
5373
+ }
5374
+ }
5375
+ }
5376
+ },
5377
+ "/api/data-journey/journeys": {
5378
+ "get": {
5379
+ "tags": [
5380
+ "DataJourney"
5381
+ ],
5382
+ "summary": "List journey bases (runs, record, fixture)",
5383
+ "parameters": [
5384
+ {
5385
+ "in": "header",
5386
+ "name": "x-memorix-org-id",
5387
+ "required": true,
5388
+ "schema": {
5389
+ "type": "string"
5390
+ }
5391
+ },
5392
+ {
5393
+ "in": "header",
5394
+ "name": "x-memorix-agent-ids",
5395
+ "required": true,
5396
+ "schema": {
5397
+ "type": "string"
5398
+ }
5399
+ },
5400
+ {
5401
+ "in": "query",
5402
+ "name": "objectType",
5403
+ "required": true,
5404
+ "schema": {
5405
+ "type": "string"
5406
+ }
5407
+ },
5408
+ {
5409
+ "in": "query",
5410
+ "name": "recordId",
5411
+ "schema": {
5412
+ "type": "string"
5413
+ }
5414
+ }
5415
+ ],
5416
+ "responses": {
5417
+ "200": {
5418
+ "description": "journeys"
5419
+ }
5420
+ }
5421
+ }
5422
+ },
5423
+ "/api/data-journey/matrix/query": {
5424
+ "post": {
5425
+ "tags": [
5426
+ "DataJourney"
5427
+ ],
5428
+ "summary": "Project evidence cone matrix",
5429
+ "parameters": [
5430
+ {
5431
+ "in": "header",
5432
+ "name": "x-memorix-org-id",
5433
+ "required": true,
5434
+ "schema": {
5435
+ "type": "string"
5436
+ }
5437
+ },
5438
+ {
5439
+ "in": "header",
5440
+ "name": "x-memorix-agent-ids",
5441
+ "required": true,
5442
+ "schema": {
5443
+ "type": "string"
5444
+ }
5445
+ }
5446
+ ],
5447
+ "requestBody": {
5448
+ "required": true,
5449
+ "content": {
5450
+ "application/json": {
5451
+ "schema": {
5452
+ "type": "object",
5453
+ "required": [
5454
+ "objectType"
5455
+ ],
5456
+ "properties": {
5457
+ "objectType": {
5458
+ "type": "string"
5459
+ },
5460
+ "basis": {
5461
+ "type": "object"
5462
+ },
5463
+ "granularity": {
5464
+ "type": "string",
5465
+ "enum": [
5466
+ "root",
5467
+ "content",
5468
+ "property"
5469
+ ]
5470
+ },
5471
+ "includeValues": {
5472
+ "type": "boolean"
5473
+ },
5474
+ "includeRawProperties": {
5475
+ "type": "boolean"
5476
+ },
5477
+ "includeSystem": {
5478
+ "type": "boolean"
5479
+ }
5480
+ }
5481
+ }
5482
+ }
5483
+ }
5484
+ },
5485
+ "responses": {
5486
+ "200": {
5487
+ "description": "MatrixResponse"
5488
+ }
5489
+ }
5490
+ }
5491
+ },
5492
+ "/api/data-journey/matrix/columns/query": {
5493
+ "post": {
5494
+ "tags": [
5495
+ "DataJourney"
5496
+ ],
5497
+ "summary": "Lazy column expansion",
5498
+ "parameters": [
5499
+ {
5500
+ "in": "header",
5501
+ "name": "x-memorix-org-id",
5502
+ "required": true,
5503
+ "schema": {
5504
+ "type": "string"
5505
+ }
5506
+ },
5507
+ {
5508
+ "in": "header",
5509
+ "name": "x-memorix-agent-ids",
5510
+ "required": true,
5511
+ "schema": {
5512
+ "type": "string"
5513
+ }
5514
+ }
5515
+ ],
5516
+ "responses": {
5517
+ "200": {
5518
+ "description": "columns"
5519
+ }
5520
+ }
5521
+ }
5522
+ },
5523
+ "/api/data-journey/matrix/cells/query": {
5524
+ "post": {
5525
+ "tags": [
5526
+ "DataJourney"
5527
+ ],
5528
+ "summary": "Viewport cells",
5529
+ "parameters": [
5530
+ {
5531
+ "in": "header",
5532
+ "name": "x-memorix-org-id",
5533
+ "required": true,
5534
+ "schema": {
5535
+ "type": "string"
5536
+ }
5537
+ },
5538
+ {
5539
+ "in": "header",
5540
+ "name": "x-memorix-agent-ids",
5541
+ "required": true,
5542
+ "schema": {
5543
+ "type": "string"
5544
+ }
5545
+ }
5546
+ ],
5547
+ "responses": {
5548
+ "200": {
5549
+ "description": "cells"
5550
+ }
5551
+ }
5552
+ }
5553
+ },
5554
+ "/api/data-journey/expected-slots": {
5555
+ "get": {
5556
+ "tags": [
5557
+ "DataJourney"
5558
+ ],
5559
+ "summary": "Descriptor-expected journey paths (views)",
5560
+ "parameters": [
5561
+ {
5562
+ "in": "header",
5563
+ "name": "x-memorix-org-id",
5564
+ "required": true,
5565
+ "schema": {
5566
+ "type": "string"
5567
+ }
5568
+ },
5569
+ {
5570
+ "in": "header",
5571
+ "name": "x-memorix-agent-ids",
5572
+ "required": true,
5573
+ "schema": {
5574
+ "type": "string"
5575
+ }
5576
+ },
5577
+ {
5578
+ "in": "query",
5579
+ "name": "objectType",
5580
+ "required": true,
5581
+ "schema": {
5582
+ "type": "string"
5583
+ }
5584
+ },
5585
+ {
5586
+ "in": "query",
5587
+ "name": "fixtureName",
5588
+ "schema": {
5589
+ "type": "string"
5590
+ }
5591
+ },
5592
+ {
5593
+ "in": "query",
5594
+ "name": "viewIds",
5595
+ "schema": {
5596
+ "type": "string"
5597
+ }
5598
+ }
5599
+ ],
5600
+ "responses": {
5601
+ "200": {
5602
+ "description": "expectedSlots"
5603
+ }
5604
+ }
5605
+ }
5606
+ },
5607
+ "/api/data-journey/coverage": {
5608
+ "post": {
5609
+ "tags": [
5610
+ "DataJourney"
5611
+ ],
5612
+ "summary": "Expected (views) vs filled (evidence)",
5613
+ "parameters": [
5614
+ {
5615
+ "in": "header",
5616
+ "name": "x-memorix-org-id",
5617
+ "required": true,
5618
+ "schema": {
5619
+ "type": "string"
5620
+ }
5621
+ },
5622
+ {
5623
+ "in": "header",
5624
+ "name": "x-memorix-agent-ids",
5625
+ "required": true,
5626
+ "schema": {
5627
+ "type": "string"
5628
+ }
5629
+ }
5630
+ ],
5631
+ "requestBody": {
5632
+ "required": true,
5633
+ "content": {
5634
+ "application/json": {
5635
+ "schema": {
5636
+ "type": "object",
5637
+ "required": [
5638
+ "objectType"
5639
+ ],
5640
+ "properties": {
5641
+ "objectType": {
5642
+ "type": "string"
5643
+ },
5644
+ "basis": {
5645
+ "type": "object"
5646
+ },
5647
+ "viewIds": {
5648
+ "type": "array",
5649
+ "items": {
5650
+ "type": "string"
5651
+ }
5652
+ },
5653
+ "includeMatrix": {
5654
+ "type": "boolean"
5655
+ }
5656
+ }
5657
+ }
5658
+ }
5659
+ }
5660
+ },
5661
+ "responses": {
5662
+ "200": {
5663
+ "description": "coverage + optional matrix"
5664
+ }
5665
+ }
5666
+ }
5667
+ },
5668
+ "/api/data-journey/evidence/{evidenceRef}": {
5669
+ "get": {
5670
+ "tags": [
5671
+ "DataJourney"
5672
+ ],
5673
+ "summary": "Cell evidence detail",
5674
+ "parameters": [
5675
+ {
5676
+ "in": "header",
5677
+ "name": "x-memorix-org-id",
5678
+ "required": true,
5679
+ "schema": {
5680
+ "type": "string"
5681
+ }
5682
+ },
5683
+ {
5684
+ "in": "header",
5685
+ "name": "x-memorix-agent-ids",
5686
+ "required": true,
5687
+ "schema": {
5688
+ "type": "string"
5689
+ }
5690
+ },
5691
+ {
5692
+ "in": "path",
5693
+ "name": "evidenceRef",
5694
+ "required": true,
5695
+ "schema": {
5696
+ "type": "string"
5697
+ }
5698
+ },
5699
+ {
5700
+ "in": "query",
5701
+ "name": "objectType",
5702
+ "required": true,
5703
+ "schema": {
5704
+ "type": "string"
5705
+ }
5706
+ },
5707
+ {
5708
+ "in": "query",
5709
+ "name": "includeValues",
5710
+ "schema": {
5711
+ "type": "string"
5712
+ }
5713
+ },
5714
+ {
5715
+ "in": "query",
5716
+ "name": "fixtureName",
5717
+ "schema": {
5718
+ "type": "string"
5719
+ }
5720
+ },
5721
+ {
5722
+ "in": "query",
5723
+ "name": "runId",
5724
+ "schema": {
5725
+ "type": "string"
5726
+ }
5727
+ },
5728
+ {
5729
+ "in": "query",
5730
+ "name": "recordId",
5731
+ "schema": {
5732
+ "type": "string"
5733
+ }
5734
+ }
5735
+ ],
5736
+ "responses": {
5737
+ "200": {
5738
+ "description": "evidence"
5739
+ },
5740
+ "404": {
5741
+ "description": "not found"
5742
+ }
5743
+ }
5744
+ }
5341
5745
  }
5342
5746
  },
5343
5747
  "components": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x12i/memorix-service",
3
- "version": "0.2.0",
3
+ "version": "3.0.1",
4
4
  "description": "Memorix production service composition root — one versioned API over accepted packages (Phase 10 / G10).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -32,16 +32,18 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@fastify/cors": "^10.0.1",
35
- "@x12i/memorix-data": "^0.2.0",
36
- "@x12i/memorix-format": "^2.3.3",
37
- "@x12i/memorix-intelligence": "^0.1.0",
38
- "@x12i/memorix-mapping": "^0.1.2",
39
- "@x12i/memorix-memory": "^0.1.0",
40
- "@x12i/memorix-metadata": "^0.2.0",
41
- "@x12i/memorix-metadata-runtime": "^0.2.0",
42
- "@x12i/memorix-pipeline": "^2.0.0",
43
- "@x12i/memorix-relationship-store": "^0.1.2",
44
- "@x12i/memorix-relationships": "^0.1.0",
35
+ "@x12i/memorix-data": "^3.0.1",
36
+ "@x12i/api-live-view": "^1.0.2",
37
+ "@x12i/memorix-data-journey": "^3.0.1",
38
+ "@x12i/memorix-format": "^3.0.1",
39
+ "@x12i/memorix-intelligence": "^3.0.1",
40
+ "@x12i/memorix-mapping": "^3.0.1",
41
+ "@x12i/memorix-memory": "^3.0.1",
42
+ "@x12i/memorix-metadata": "^3.0.1",
43
+ "@x12i/memorix-metadata-runtime": "^3.0.1",
44
+ "@x12i/memorix-pipeline": "^3.0.1",
45
+ "@x12i/memorix-relationship-store": "^3.0.1",
46
+ "@x12i/memorix-relationships": "^3.0.1",
45
47
  "fastify": "^5.1.0",
46
48
  "mongodb": "^6.21.0"
47
49
  },