@x12i/static-memorix 2.0.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 (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +431 -0
  3. package/dist/cli.d.ts +17 -0
  4. package/dist/cli.js +278 -0
  5. package/dist/config.d.ts +39 -0
  6. package/dist/config.js +109 -0
  7. package/dist/engine/aliases.d.ts +32 -0
  8. package/dist/engine/aliases.js +74 -0
  9. package/dist/engine/associations.d.ts +26 -0
  10. package/dist/engine/associations.js +60 -0
  11. package/dist/engine/identity.d.ts +22 -0
  12. package/dist/engine/identity.js +50 -0
  13. package/dist/engine/inventory.d.ts +29 -0
  14. package/dist/engine/inventory.js +133 -0
  15. package/dist/engine/lists.d.ts +18 -0
  16. package/dist/engine/lists.js +62 -0
  17. package/dist/engine/narratives.d.ts +16 -0
  18. package/dist/engine/narratives.js +67 -0
  19. package/dist/engine/objectTypes.d.ts +11 -0
  20. package/dist/engine/objectTypes.js +71 -0
  21. package/dist/engine/query.d.ts +38 -0
  22. package/dist/engine/query.js +191 -0
  23. package/dist/engine/records.d.ts +23 -0
  24. package/dist/engine/records.js +152 -0
  25. package/dist/engine/snapshots.d.ts +17 -0
  26. package/dist/engine/snapshots.js +110 -0
  27. package/dist/engine/write.d.ts +30 -0
  28. package/dist/engine/write.js +163 -0
  29. package/dist/routes/helpers.d.ts +4 -0
  30. package/dist/routes/helpers.js +29 -0
  31. package/dist/routes/index.d.ts +2 -0
  32. package/dist/routes/index.js +402 -0
  33. package/dist/server.d.ts +15 -0
  34. package/dist/server.js +130 -0
  35. package/dist/storage/InMemoryStore.d.ts +31 -0
  36. package/dist/storage/InMemoryStore.js +242 -0
  37. package/dist/storage/fs.d.ts +6 -0
  38. package/dist/storage/fs.js +54 -0
  39. package/dist/types.d.ts +88 -0
  40. package/dist/types.js +37 -0
  41. package/guides/demo-app.md +527 -0
  42. package/guides/managing-json-files.md +384 -0
  43. package/guides/running-the-service.md +269 -0
  44. package/guides/using-the-api.md +265 -0
  45. package/mocks/data/admin/snapshots.json +52 -0
  46. package/mocks/data/assets/analysis.json +14 -0
  47. package/mocks/data/assets/decisions.json +14 -0
  48. package/mocks/data/assets/events.json +4 -0
  49. package/mocks/data/assets/snapshots.json +49 -0
  50. package/mocks/data/findings/analysis.json +4 -0
  51. package/mocks/data/findings/decisions.json +4 -0
  52. package/mocks/data/findings/events.json +3 -0
  53. package/mocks/data/findings/snapshots.json +21 -0
  54. package/mocks/data/marketing/snapshots.json +75 -0
  55. package/mocks/data/memory/memory.json +31 -0
  56. package/mocks/data/product/snapshots.json +84 -0
  57. package/mocks/data/system/inventory.json +8 -0
  58. package/mocks/data/users/snapshots.json +5 -0
  59. package/mocks/demo.html +828 -0
  60. package/mocks/metadata/agents.json +7 -0
  61. package/mocks/metadata/lists/assets-default.json +22 -0
  62. package/mocks/metadata/lists/backlog.json +10 -0
  63. package/mocks/metadata/lists/findings-default.json +9 -0
  64. package/mocks/metadata/lists/my-plate.json +10 -0
  65. package/mocks/metadata/lists/this-week.json +10 -0
  66. package/mocks/metadata/narratives/admin.json +7 -0
  67. package/mocks/metadata/narratives/assets.json +17 -0
  68. package/mocks/metadata/narratives/findings.json +7 -0
  69. package/mocks/metadata/narratives/marketing.json +17 -0
  70. package/mocks/metadata/narratives/product.json +12 -0
  71. package/mocks/metadata/object-types/admin.json +6 -0
  72. package/mocks/metadata/object-types/assets.json +9 -0
  73. package/mocks/metadata/object-types/findings.json +8 -0
  74. package/mocks/metadata/object-types/marketing.json +6 -0
  75. package/mocks/metadata/object-types/memory.json +6 -0
  76. package/mocks/metadata/object-types/product.json +6 -0
  77. package/mocks/metadata/object-types/users.json +13 -0
  78. package/mocks/metadata/write-descriptors/admin-task-write.json +20 -0
  79. package/mocks/metadata/write-descriptors/assets-analysis-write.json +14 -0
  80. package/mocks/metadata/write-descriptors/marketing-task-write.json +20 -0
  81. package/mocks/metadata/write-descriptors/memory-write.json +14 -0
  82. package/mocks/metadata/write-descriptors/product-task-write.json +20 -0
  83. package/package.json +67 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "agents": [
3
+ { "id": "agent-1", "name": "Discovery Agent", "role": "ingestion" },
4
+ { "id": "agent-2", "name": "Analysis Agent", "role": "enrichment" },
5
+ { "id": "agent-3", "name": "Decision Agent", "role": "remediation" }
6
+ ]
7
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "id": "assets-default",
3
+ "entity": "assets",
4
+ "entityName": "assets",
5
+ "baseContentType": "snapshots",
6
+ "fields": [
7
+ "recordId",
8
+ "entityId",
9
+ "severity",
10
+ "status"
11
+ ],
12
+ "extensions": [
13
+ "analysis",
14
+ "decisions"
15
+ ],
16
+ "sort": {
17
+ "severity": -1,
18
+ "entityId": 1
19
+ },
20
+ "query": {},
21
+ "listId": "assets-default"
22
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "id": "backlog",
3
+ "entity": "product",
4
+ "entityName": "product",
5
+ "baseContentType": "snapshots",
6
+ "fields": ["recordId", "title", "status", "priority", "owner", "dueDate"],
7
+ "sort": {},
8
+ "query": {},
9
+ "listId": "backlog"
10
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "id": "findings-default",
3
+ "entity": "findings",
4
+ "entityName": "findings",
5
+ "baseContentType": "snapshots",
6
+ "fields": ["recordId", "entityId", "severity", "status"],
7
+ "sort": { "severity": -1 },
8
+ "query": {}
9
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "id": "my-plate",
3
+ "entity": "product",
4
+ "entityName": "product",
5
+ "baseContentType": "snapshots",
6
+ "fields": ["recordId", "title", "status", "priority", "owner", "dueDate"],
7
+ "sort": { "priority": -1 },
8
+ "query": {},
9
+ "listId": "my-plate"
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "id": "this-week",
3
+ "entity": "product",
4
+ "entityName": "product",
5
+ "baseContentType": "snapshots",
6
+ "fields": ["recordId", "title", "status", "priority", "owner", "dueDate"],
7
+ "sort": { "dueDate": 1 },
8
+ "query": {},
9
+ "listId": "this-week"
10
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "q1-review": {
3
+ "key": "q1-review",
4
+ "label": "Q1 Review",
5
+ "description": "Reconciling first quarter expenses and contracts."
6
+ }
7
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "has-vulns": {
3
+ "key": "has-vulns",
4
+ "label": "Has Vulnerabilities",
5
+ "description": "Asset carries at least one known vulnerability."
6
+ },
7
+ "exposed-public": {
8
+ "key": "exposed-public",
9
+ "label": "Exposed Publicly",
10
+ "description": "Asset is reachable from the public internet."
11
+ },
12
+ "critical-owner": {
13
+ "key": "critical-owner",
14
+ "label": "Critical Owner",
15
+ "description": "Owned by a business-critical team."
16
+ }
17
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "high-severity": {
3
+ "key": "high-severity",
4
+ "label": "High Severity",
5
+ "description": "Finding scored at high severity."
6
+ }
7
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "blog-content": {
3
+ "key": "blog-content",
4
+ "label": "Blog Content",
5
+ "description": "Writing and publishing blog posts."
6
+ },
7
+ "website-refresh": {
8
+ "key": "website-refresh",
9
+ "label": "Website Refresh",
10
+ "description": "Content for the redesigned site."
11
+ },
12
+ "launch-prep": {
13
+ "key": "launch-prep",
14
+ "label": "Launch Prep",
15
+ "description": "Launch week content and outreach."
16
+ }
17
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "website-refresh": {
3
+ "key": "website-refresh",
4
+ "label": "Website Refresh",
5
+ "description": "Redesigning the public-facing site."
6
+ },
7
+ "launch-prep": {
8
+ "key": "launch-prep",
9
+ "label": "Launch Prep",
10
+ "description": "Getting ready for public launch."
11
+ }
12
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "admin",
3
+ "summary": "Keeping the lights on.",
4
+ "catalogRelations": [],
5
+ "rootPropertyCatalog": []
6
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "assets",
3
+ "summary": "Infrastructure assets discovered and analyzed by Memorix.",
4
+ "catalogRelations": [
5
+ { "sourceProperty": "linkedAssetId", "targetObject": "assets", "targetProperty": "recordId", "relationType": "self-link" },
6
+ { "sourceProperty": "ownerId", "targetObject": "agents", "targetProperty": "id", "relationType": "ownership" }
7
+ ],
8
+ "rootPropertyCatalog": []
9
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "findings",
3
+ "summary": "Security findings surfaced from analysis pipelines.",
4
+ "catalogRelations": [
5
+ { "sourceProperty": "assetId", "targetObject": "assets", "targetProperty": "recordId", "relationType": "belongs-to" }
6
+ ],
7
+ "rootPropertyCatalog": []
8
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "marketing",
3
+ "summary": "Getting people to see the thing.",
4
+ "catalogRelations": [],
5
+ "rootPropertyCatalog": []
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "memory",
3
+ "summary": "The fourth tier of data alongside entities, events, and knowledge. Memory collections are keyed by memoryId.",
4
+ "catalogRelations": [],
5
+ "rootPropertyCatalog": []
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "product",
3
+ "summary": "Building the thing.",
4
+ "catalogRelations": [],
5
+ "rootPropertyCatalog": []
6
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "users",
3
+ "summary": "People who can be assigned to tasks.",
4
+ "catalogRelations": [
5
+ {
6
+ "sourceProperty": "assigneeId",
7
+ "targetObject": "product",
8
+ "targetProperty": "recordId",
9
+ "relationType": "assigned-to"
10
+ }
11
+ ],
12
+ "rootPropertyCatalog": []
13
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "writeDescriptorId": "admin-task-write",
3
+ "targetCollection": "admin/snapshots",
4
+ "schema": {
5
+ "type": "object",
6
+ "required": ["recordId", "title"],
7
+ "properties": {
8
+ "recordId": { "type": "string" },
9
+ "title": { "type": "string" },
10
+ "status": { "type": "string" },
11
+ "priority": { "type": "string" },
12
+ "owner": { "type": "string" },
13
+ "area": { "type": "string" },
14
+ "assigneeId": { "type": "string" },
15
+ "dueDate": { "type": "string" },
16
+ "notes": { "type": "string" },
17
+ "chat": { "type": "array" }
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "writeDescriptorId": "assets-analysis-write",
3
+ "targetCollection": "assets/analysis",
4
+ "schema": {
5
+ "type": "object",
6
+ "required": ["recordId"],
7
+ "properties": {
8
+ "recordId": { "type": "string" },
9
+ "analysisType": { "type": "string" },
10
+ "score": { "type": "number" },
11
+ "notes": { "type": "array" }
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "writeDescriptorId": "marketing-task-write",
3
+ "targetCollection": "marketing/snapshots",
4
+ "schema": {
5
+ "type": "object",
6
+ "required": ["recordId", "title"],
7
+ "properties": {
8
+ "recordId": { "type": "string" },
9
+ "title": { "type": "string" },
10
+ "status": { "type": "string" },
11
+ "priority": { "type": "string" },
12
+ "owner": { "type": "string" },
13
+ "area": { "type": "string" },
14
+ "assigneeId": { "type": "string" },
15
+ "dueDate": { "type": "string" },
16
+ "notes": { "type": "string" },
17
+ "chat": { "type": "array" }
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "writeDescriptorId": "memory-write",
3
+ "targetCollection": "memory/memory",
4
+ "schema": {
5
+ "type": "object",
6
+ "required": ["memoryId"],
7
+ "properties": {
8
+ "memoryId": { "type": "string" },
9
+ "kind": { "type": "string" },
10
+ "summary": { "type": "string" },
11
+ "createdAt": { "type": "string" }
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "writeDescriptorId": "product-task-write",
3
+ "targetCollection": "product/snapshots",
4
+ "schema": {
5
+ "type": "object",
6
+ "required": ["recordId", "title"],
7
+ "properties": {
8
+ "recordId": { "type": "string" },
9
+ "title": { "type": "string" },
10
+ "status": { "type": "string" },
11
+ "priority": { "type": "string" },
12
+ "owner": { "type": "string" },
13
+ "area": { "type": "string" },
14
+ "assigneeId": { "type": "string" },
15
+ "dueDate": { "type": "string" },
16
+ "notes": { "type": "string" },
17
+ "chat": { "type": "array" }
18
+ }
19
+ }
20
+ }
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@x12i/static-memorix",
3
+ "version": "2.0.0",
4
+ "description": "Static mock server providing full API parity for the Memorix Explorer API.",
5
+ "type": "module",
6
+ "main": "dist/server.js",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/server.d.ts",
10
+ "import": "./dist/server.js"
11
+ },
12
+ "./config": {
13
+ "types": "./dist/config.d.ts",
14
+ "import": "./dist/config.js"
15
+ }
16
+ },
17
+ "bin": {
18
+ "static-memorix": "dist/cli.js",
19
+ "memorix-explorer": "dist/cli.js"
20
+ },
21
+ "scripts": {
22
+ "build": "tsc -p tsconfig.json",
23
+ "start": "node dist/cli.js",
24
+ "dev": "node --experimental-strip-types cli.ts",
25
+ "test": "npm run build && node --test tests/*.test.mjs",
26
+ "typecheck": "tsc -p tsconfig.json --noEmit",
27
+ "prepack": "npm run build",
28
+ "postpack": "true"
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "mocks",
33
+ "guides",
34
+ "LICENSE",
35
+ "README.md"
36
+ ],
37
+ "dependencies": {
38
+ "fastify": "^5.10.0",
39
+ "mingo": "^6.4.12"
40
+ },
41
+ "devDependencies": {
42
+ "@types/node": "^20.14.0",
43
+ "typescript": "^5.5.0"
44
+ },
45
+ "license": "MIT",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/x12i/static-memorix.git"
49
+ },
50
+ "homepage": "https://github.com/x12i/static-memorix#readme",
51
+ "bugs": {
52
+ "url": "https://github.com/x12i/static-memorix/issues"
53
+ },
54
+ "keywords": [
55
+ "mock",
56
+ "api",
57
+ "memorix",
58
+ "explorer",
59
+ "fastify",
60
+ "test-server",
61
+ "development-tools",
62
+ "static"
63
+ ],
64
+ "engines": {
65
+ "node": ">=20.0.0"
66
+ }
67
+ }