@haneinfo/references 0.0.0-stage → 0.1.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.
- package/LICENSE +14 -0
- package/README.md +133 -2
- package/agent-guide.md +22 -0
- package/dist/config.d.ts +16 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +41 -0
- package/dist/config.js.map +1 -0
- package/dist/controller.d.ts +18 -0
- package/dist/controller.d.ts.map +1 -0
- package/dist/controller.js +137 -0
- package/dist/controller.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-tools.d.ts +48 -0
- package/dist/mcp-tools.d.ts.map +1 -0
- package/dist/mcp-tools.js +185 -0
- package/dist/mcp-tools.js.map +1 -0
- package/dist/module.d.ts +6 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +54 -0
- package/dist/module.js.map +1 -0
- package/dist/plugin.d.ts +28 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +86 -0
- package/dist/plugin.js.map +1 -0
- package/dist/service.d.ts +68 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +415 -0
- package/dist/service.js.map +1 -0
- package/dist/store.d.ts +59 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +97 -0
- package/dist/store.js.map +1 -0
- package/haneinfo.plugin.json +68 -0
- package/package.json +67 -3
- package/plugin.d.ts +1 -0
- package/plugin.js +1 -0
- package/prisma/references.prisma +18 -0
- package/prisma/references.sql +20 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "haneinfo.plugin/v1",
|
|
3
|
+
"id": "references",
|
|
4
|
+
"displayName": "Object references and links",
|
|
5
|
+
"cardinality": "singleton",
|
|
6
|
+
"distribution": "official",
|
|
7
|
+
"engine": {
|
|
8
|
+
"haneinfoPluginApi": "^1.23.0",
|
|
9
|
+
"node": ">=22.0.0",
|
|
10
|
+
"frameworks": {
|
|
11
|
+
"@nestjs/common": "^11.0.5",
|
|
12
|
+
"@nestjs/core": "^11.0.5",
|
|
13
|
+
"@prisma/client": "^6.2.0"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"provides": ["haneinfo.references"],
|
|
17
|
+
"requires": ["haneinfo.prisma", "haneinfo.principal-context", "haneinfo.state-machine-runtime"],
|
|
18
|
+
"optionalRequires": ["haneinfo.rbac-policy", "haneinfo.identity-store"],
|
|
19
|
+
"configSchema": {
|
|
20
|
+
"configRef": "references"
|
|
21
|
+
},
|
|
22
|
+
"facets": {
|
|
23
|
+
"backend": {
|
|
24
|
+
"modulePath": "./dist/module.js",
|
|
25
|
+
"exportName": "ReferencesModule",
|
|
26
|
+
"controllerRoutes": ["references"],
|
|
27
|
+
"providerTokens": ["haneinfo.references"],
|
|
28
|
+
"mcpTools": [
|
|
29
|
+
{
|
|
30
|
+
"name": "list_links",
|
|
31
|
+
"requiredScopes": ["{namespace}:references:read"],
|
|
32
|
+
"description": "Read-only, user-bound list of links whose other end the user can read; unreadable ends never appear or count. Cards and notes are $userContent."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "get_link_graph",
|
|
36
|
+
"requiredScopes": ["{namespace}:references:read"],
|
|
37
|
+
"description": "Read-only, user-bound bounded impact graph that never traverses unreadable objects. Cards and notes are $userContent."
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "create_link",
|
|
41
|
+
"requiredScopes": ["{namespace}:references:write"],
|
|
42
|
+
"description": "User-bound link creation with the HTTP checks (write the source, read the target); idempotent. Agents cannot remove links."
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"agentGuide": "./agent-guide.md",
|
|
46
|
+
"events": [
|
|
47
|
+
{
|
|
48
|
+
"type": "references.linked",
|
|
49
|
+
"schemaVersion": 1,
|
|
50
|
+
"description": "A link was created, in its transaction; payload includes linkId, kind, from, to, userId, at and historyIds."
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"type": "references.unlinked",
|
|
54
|
+
"schemaVersion": 1,
|
|
55
|
+
"description": "A link was removed, in its transaction; payload includes linkId, kind, from, to, userId, at and historyIds."
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"prisma": {
|
|
60
|
+
"owns": ["ObjectLink"],
|
|
61
|
+
"schemaFragment": "prisma/references.prisma",
|
|
62
|
+
"schemaDigest": "sha256:89376ca7a30dd06e34e449906e75c2133499fdc3db12e78c52465663b627b0d9"
|
|
63
|
+
},
|
|
64
|
+
"permissions": {
|
|
65
|
+
"definitions": ["references:link:admin"]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haneinfo/references",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Directed, typed links between objects with permission-filtered reverse lookups, preview cards and bounded impact graphs.",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"prisma",
|
|
9
|
+
"agent-guide.md",
|
|
10
|
+
"haneinfo.plugin.json",
|
|
11
|
+
"plugin.js",
|
|
12
|
+
"plugin.d.ts",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"type": "commonjs",
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"default": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./plugin": {
|
|
24
|
+
"types": "./dist/plugin.d.ts",
|
|
25
|
+
"default": "./dist/plugin.js"
|
|
26
|
+
},
|
|
27
|
+
"./haneinfo.plugin.json": "./haneinfo.plugin.json",
|
|
28
|
+
"./agent-guide.md": "./agent-guide.md",
|
|
29
|
+
"./package.json": "./package.json",
|
|
30
|
+
"./prisma/references.prisma": "./prisma/references.prisma",
|
|
31
|
+
"./prisma/references.sql": "./prisma/references.sql"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@haneinfo/plugin-api": "1.24.0"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@haneinfo/common": "^0.3.4 || ^0.4.0 || ^0.5.0",
|
|
38
|
+
"@haneinfo/plugin-host-nest": "^2.1.0",
|
|
39
|
+
"@nestjs/common": "^11.0.0",
|
|
40
|
+
"@nestjs/core": "^11.0.0",
|
|
41
|
+
"@prisma/client": "^6.19.0",
|
|
42
|
+
"zod": "^4.4.0",
|
|
43
|
+
"@haneinfo/plugin-api": "^1.23.0",
|
|
44
|
+
"@haneinfo/state-machine": "^0.21.0 || ^0.22.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@nestjs/common": "^11.0.0",
|
|
48
|
+
"@nestjs/core": "^11.0.0",
|
|
49
|
+
"@prisma/client": "^6.19.0",
|
|
50
|
+
"@types/node": "^24.13.0",
|
|
51
|
+
"typescript": "^5.9.3",
|
|
52
|
+
"vitest": "^4.1.11",
|
|
53
|
+
"zod": "^4.4.0",
|
|
54
|
+
"@haneinfo/common": "0.5.0",
|
|
55
|
+
"@haneinfo/plugin-host-nest": "2.1.0",
|
|
56
|
+
"@haneinfo/plugin-testkit": "2.3.0",
|
|
57
|
+
"@haneinfo/state-machine": "0.22.0"
|
|
58
|
+
},
|
|
59
|
+
"license": "UNLICENSED",
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"registry": "https://registry.npmjs.org/",
|
|
62
|
+
"access": "public"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsc -p tsconfig.build.json",
|
|
66
|
+
"dev": "tsc -p tsconfig.build.json --watch",
|
|
67
|
+
"test": "vitest run",
|
|
68
|
+
"typecheck": "tsc --noEmit"
|
|
69
|
+
}
|
|
6
70
|
}
|
package/plugin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/plugin';
|
package/plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/plugin.js');
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// Directed, typed edge between two objects (`<type>:<id>` ends). No foreign keys: object types are
|
|
2
|
+
/// generic, and each type's provider deletes the edges of an object it permanently removes. @internal
|
|
3
|
+
model ObjectLink {
|
|
4
|
+
id String @id
|
|
5
|
+
fromType String @map("from_type")
|
|
6
|
+
fromId String @map("from_id")
|
|
7
|
+
toType String @map("to_type")
|
|
8
|
+
toId String @map("to_id")
|
|
9
|
+
kind String
|
|
10
|
+
note String?
|
|
11
|
+
createdBy String @map("created_by")
|
|
12
|
+
createdAt DateTime @default(now()) @map("created_at")
|
|
13
|
+
|
|
14
|
+
@@unique([fromType, fromId, toType, toId, kind])
|
|
15
|
+
@@index([fromType, fromId, createdAt])
|
|
16
|
+
@@index([toType, toId, createdAt])
|
|
17
|
+
@@map("object_links")
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- @haneinfo/references: directed, typed links between objects. No foreign keys: the object type is
|
|
2
|
+
-- generic, so providers delete an object's edges when they permanently remove it.
|
|
3
|
+
CREATE TABLE object_links (
|
|
4
|
+
id TEXT NOT NULL,
|
|
5
|
+
from_type TEXT NOT NULL,
|
|
6
|
+
from_id TEXT NOT NULL,
|
|
7
|
+
to_type TEXT NOT NULL,
|
|
8
|
+
to_id TEXT NOT NULL,
|
|
9
|
+
kind TEXT NOT NULL,
|
|
10
|
+
note TEXT,
|
|
11
|
+
created_by TEXT NOT NULL,
|
|
12
|
+
created_at TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
13
|
+
CONSTRAINT object_links_pkey PRIMARY KEY (id),
|
|
14
|
+
CONSTRAINT object_links_not_self_check CHECK (NOT (from_type = to_type AND from_id = to_id))
|
|
15
|
+
);
|
|
16
|
+
CREATE UNIQUE INDEX object_links_from_type_from_id_to_type_to_id_kind_key
|
|
17
|
+
ON object_links (from_type, from_id, to_type, to_id, kind);
|
|
18
|
+
-- Outgoing and incoming lookups (both directions are indexed for reverse queries).
|
|
19
|
+
CREATE INDEX object_links_from_type_from_id_created_at_idx ON object_links (from_type, from_id, created_at);
|
|
20
|
+
CREATE INDEX object_links_to_type_to_id_created_at_idx ON object_links (to_type, to_id, created_at);
|