@undefineds.co/models 0.2.34 → 0.2.37

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 (120) hide show
  1. package/README.md +13 -16
  2. package/dist/agent.repository.d.ts +48 -0
  3. package/dist/agent.repository.js +1 -1
  4. package/dist/agent.schema.d.ts +24 -0
  5. package/dist/agent.schema.js +16 -5
  6. package/dist/ai-config/index.d.ts +28 -2
  7. package/dist/ai-config/index.js +154 -13
  8. package/dist/ai-model.schema.js +11 -12
  9. package/dist/ai-provider.schema.d.ts +4 -0
  10. package/dist/ai-provider.schema.js +11 -10
  11. package/dist/ai-runtime.schema.d.ts +4 -4
  12. package/dist/ai-runtime.schema.js +43 -45
  13. package/dist/approval.schema.d.ts +0 -1
  14. package/dist/approval.schema.js +2 -11
  15. package/dist/audit.schema.d.ts +0 -1
  16. package/dist/audit.schema.js +2 -11
  17. package/dist/automation-rule.schema.d.ts +63 -0
  18. package/dist/automation-rule.schema.js +51 -0
  19. package/dist/bin/udfs.js +3 -3
  20. package/dist/chat.repository.d.ts +4 -4
  21. package/dist/chat.repository.js +1 -1
  22. package/dist/chat.schema.d.ts +2 -2
  23. package/dist/chat.schema.js +3 -4
  24. package/dist/chat.utils.d.ts +7 -0
  25. package/dist/chat.utils.js +35 -6
  26. package/dist/contact.repository.d.ts +4 -4
  27. package/dist/contact.repository.js +1 -1
  28. package/dist/contact.schema.d.ts +2 -2
  29. package/dist/contact.schema.js +2 -3
  30. package/dist/credential.schema.js +21 -22
  31. package/dist/delivery.schema.d.ts +81 -0
  32. package/dist/delivery.schema.js +64 -0
  33. package/dist/evidence.schema.d.ts +40 -0
  34. package/dist/evidence.schema.js +48 -0
  35. package/dist/favorite/favorite.schema.d.ts +3 -5
  36. package/dist/favorite/favorite.schema.js +2 -3
  37. package/dist/favorite/starred-sync.d.ts +1 -1
  38. package/dist/favorite/starred-sync.js +11 -13
  39. package/dist/fixtures/contracts-chat-contact.js +3 -3
  40. package/dist/grant.schema.d.ts +2 -3
  41. package/dist/grant.schema.js +6 -9
  42. package/dist/idea.schema.d.ts +32 -0
  43. package/dist/idea.schema.js +36 -0
  44. package/dist/inbox-notification.schema.js +1 -2
  45. package/dist/index.d.ts +19 -14
  46. package/dist/index.js +20 -18
  47. package/dist/issue.repository.js +1 -1
  48. package/dist/issue.schema.js +1 -2
  49. package/dist/knowledge/knowledge-folder.schema.d.ts +1 -1
  50. package/dist/knowledge/knowledge-folder.schema.js +1 -1
  51. package/dist/message.repository.d.ts +8 -12
  52. package/dist/message.repository.js +1 -1
  53. package/dist/message.schema.d.ts +11 -9
  54. package/dist/message.schema.js +29 -13
  55. package/dist/namespaces.d.ts +0 -2
  56. package/dist/namespaces.js +121 -92
  57. package/dist/pod-storage-descriptor.d.ts +0 -6
  58. package/dist/pod-storage-descriptor.js +11 -12
  59. package/dist/profile.repository.d.ts +2 -2
  60. package/dist/profile.repository.js +2 -2
  61. package/dist/report.schema.d.ts +58 -0
  62. package/dist/report.schema.js +73 -0
  63. package/dist/repository.d.ts +15 -4
  64. package/dist/repository.js +16 -5
  65. package/dist/resource-id-defaults.d.ts +1 -12
  66. package/dist/resource-id-defaults.js +65 -72
  67. package/dist/resource-refs.d.ts +25 -0
  68. package/dist/resource-refs.js +45 -0
  69. package/dist/run.schema.d.ts +13 -17
  70. package/dist/run.schema.js +12 -13
  71. package/dist/schedule.schema.d.ts +56 -0
  72. package/dist/schedule.schema.js +46 -0
  73. package/dist/schema.d.ts +275 -192
  74. package/dist/schema.js +18 -10
  75. package/dist/session/index.d.ts +1 -1
  76. package/dist/session/index.js +1 -1
  77. package/dist/session/session.schema.d.ts +4 -6
  78. package/dist/session/session.schema.js +5 -16
  79. package/dist/session.repository.d.ts +8 -8
  80. package/dist/session.repository.js +1 -1
  81. package/dist/settings/settings.schema.d.ts +2 -0
  82. package/dist/settings/settings.schema.js +8 -3
  83. package/dist/sidecar/persistence-mapping.d.ts +1 -1
  84. package/dist/sidecar/sidecar-events.d.ts +36 -36
  85. package/dist/skill.schema.d.ts +39 -0
  86. package/dist/skill.schema.js +31 -0
  87. package/dist/task.schema.d.ts +22 -32
  88. package/dist/task.schema.js +17 -25
  89. package/dist/thread.repository.d.ts +8 -8
  90. package/dist/thread.repository.js +1 -1
  91. package/dist/thread.schema.d.ts +15 -10
  92. package/dist/thread.schema.js +32 -13
  93. package/dist/types/collaboration-blocks.d.ts +3 -1
  94. package/dist/types/message-block.d.ts +3 -1
  95. package/dist/vocab/chat.vocab.d.ts +1 -1
  96. package/dist/vocab/chat.vocab.js +1 -1
  97. package/dist/vocab/contact.vocab.d.ts +1 -1
  98. package/dist/vocab/contact.vocab.js +1 -1
  99. package/dist/vocab/index.d.ts +2 -0
  100. package/dist/vocab/index.js +2 -0
  101. package/dist/vocab/message.vocab.d.ts +2 -1
  102. package/dist/vocab/message.vocab.js +2 -1
  103. package/dist/vocab/session.vocab.d.ts +16 -0
  104. package/dist/vocab/session.vocab.js +17 -0
  105. package/dist/vocab/sidecar.vocab.d.ts +19 -1
  106. package/dist/vocab/sidecar.vocab.js +22 -4
  107. package/dist/vocab/thread.vocab.d.ts +2 -0
  108. package/dist/vocab/thread.vocab.js +2 -0
  109. package/dist/vocab/workflow.vocab.d.ts +135 -0
  110. package/dist/vocab/workflow.vocab.js +136 -0
  111. package/package.json +3 -3
  112. package/skills/solid-modeling/SKILL.md +70 -17
  113. package/dist/file/file.schema.d.ts +0 -60
  114. package/dist/file/file.schema.js +0 -53
  115. package/dist/file/index.d.ts +0 -1
  116. package/dist/file/index.js +0 -1
  117. package/dist/matrix.repository.d.ts +0 -183
  118. package/dist/matrix.repository.js +0 -20
  119. package/dist/matrix.schema.d.ts +0 -136
  120. package/dist/matrix.schema.js +0 -100
@@ -0,0 +1,136 @@
1
+ import { AS, DCTerms, SCHEMA, UDFS } from '../namespaces.js';
2
+ export const TaskVocab = {
3
+ title: DCTerms.title,
4
+ instruction: UDFS.instruction,
5
+ prompt: UDFS.prompt,
6
+ issue: UDFS.issue,
7
+ message: UDFS.message,
8
+ workspace: UDFS.workspace,
9
+ status: UDFS.status,
10
+ priority: UDFS.priority,
11
+ assignedTo: UDFS.assignedTo,
12
+ source: UDFS.source,
13
+ metadata: UDFS.metadata,
14
+ createdAt: DCTerms.created,
15
+ updatedAt: DCTerms.modified,
16
+ };
17
+ export const ScheduleVocab = {
18
+ task: UDFS.task,
19
+ status: UDFS.status,
20
+ scheduleKind: UDFS.scheduleKind,
21
+ cron: UDFS.cron,
22
+ intervalSeconds: UDFS.intervalSeconds,
23
+ timezone: UDFS.timezone,
24
+ startsAt: UDFS.startsAt,
25
+ nextRunAt: UDFS.nextRunAt,
26
+ lastRunAt: UDFS.lastRunAt,
27
+ metadata: UDFS.metadata,
28
+ createdAt: DCTerms.created,
29
+ updatedAt: DCTerms.modified,
30
+ };
31
+ export const AutomationRuleVocab = {
32
+ title: DCTerms.title,
33
+ description: DCTerms.description,
34
+ status: UDFS.status,
35
+ ruleKind: UDFS.ruleKind,
36
+ task: UDFS.task,
37
+ schedule: UDFS.schedule,
38
+ source: UDFS.source,
39
+ target: UDFS.target,
40
+ condition: UDFS.condition,
41
+ actions: UDFS.actions,
42
+ metadata: UDFS.metadata,
43
+ lastTriggeredAt: UDFS.lastTriggeredAt,
44
+ lastRunStatus: UDFS.lastRunStatus,
45
+ createdAt: DCTerms.created,
46
+ updatedAt: DCTerms.modified,
47
+ };
48
+ export const DeliveryVocab = {
49
+ kind: UDFS.deliveryKind,
50
+ status: UDFS.status,
51
+ task: UDFS.task,
52
+ source: UDFS.source,
53
+ target: AS.target,
54
+ chat: UDFS.conversation,
55
+ thread: UDFS.inThread,
56
+ targetThread: UDFS.targetThread,
57
+ targetSession: UDFS.targetSession,
58
+ actor: AS.actor,
59
+ object: AS.object,
60
+ objective: UDFS.objective,
61
+ payload: UDFS.payload,
62
+ projection: UDFS.projection,
63
+ projectedRole: UDFS.projectedRole,
64
+ metadata: UDFS.metadata,
65
+ error: UDFS.error,
66
+ createdAt: DCTerms.created,
67
+ dispatchedAt: UDFS.startedAt,
68
+ consumedAt: UDFS.consumedAt,
69
+ completedAt: UDFS.completedAt,
70
+ updatedAt: DCTerms.modified,
71
+ };
72
+ export const RunVocab = {
73
+ task: UDFS.task,
74
+ delivery: UDFS.delivery,
75
+ trigger: UDFS.trigger,
76
+ input: UDFS.input,
77
+ thread: UDFS.inThread,
78
+ workspace: UDFS.workspace,
79
+ status: UDFS.status,
80
+ runner: UDFS.runner,
81
+ prompt: UDFS.prompt,
82
+ externalRunId: UDFS.externalRunId,
83
+ leaseOwner: UDFS.leaseOwner,
84
+ leaseExpiresAt: UDFS.leaseExpiresAt,
85
+ heartbeatAt: UDFS.heartbeatAt,
86
+ cancelRequestedAt: UDFS.cancelRequestedAt,
87
+ error: UDFS.error,
88
+ metadata: UDFS.metadata,
89
+ createdAt: DCTerms.created,
90
+ startedAt: UDFS.startedAt,
91
+ completedAt: UDFS.completedAt,
92
+ updatedAt: DCTerms.modified,
93
+ };
94
+ export const EvidenceVocab = {
95
+ evidenceKind: UDFS.evidenceKind,
96
+ about: SCHEMA.about,
97
+ issue: UDFS.issue,
98
+ task: UDFS.task,
99
+ delivery: UDFS.delivery,
100
+ run: UDFS.run,
101
+ thread: UDFS.inThread,
102
+ summary: DCTerms.abstract,
103
+ source: DCTerms.source,
104
+ actor: DCTerms.creator,
105
+ outcome: UDFS.outcome,
106
+ metadata: UDFS.metadata,
107
+ createdAt: DCTerms.created,
108
+ };
109
+ export const ReportVocab = {
110
+ reportKind: UDFS.reportKind,
111
+ status: UDFS.status,
112
+ outcome: UDFS.outcome,
113
+ about: SCHEMA.about,
114
+ issue: UDFS.issue,
115
+ task: UDFS.task,
116
+ delivery: UDFS.delivery,
117
+ run: UDFS.run,
118
+ thread: UDFS.inThread,
119
+ evidence: UDFS.evidence,
120
+ summary: DCTerms.abstract,
121
+ reviewer: SCHEMA.reviewedBy,
122
+ actor: DCTerms.creator,
123
+ source: DCTerms.source,
124
+ metricFacts: UDFS.metricFacts,
125
+ metadata: UDFS.metadata,
126
+ createdAt: DCTerms.created,
127
+ publishedAt: DCTerms.issued,
128
+ updatedAt: DCTerms.modified,
129
+ };
130
+ export const RunStepVocab = {
131
+ run: UDFS.run,
132
+ stepType: UDFS.stepType,
133
+ message: DCTerms.description,
134
+ payload: UDFS.payload,
135
+ createdAt: DCTerms.created,
136
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@undefineds.co/models",
3
- "version": "0.2.34",
3
+ "version": "0.2.37",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -86,7 +86,7 @@
86
86
  "dependencies": {
87
87
  "@comunica/query-sparql-solid": "^4.0.2",
88
88
  "@inrupt/vocab-common-rdf": "^1.0.5",
89
- "@undefineds.co/drizzle-solid": "^0.3.13",
89
+ "@undefineds.co/drizzle-solid": "^0.3.14",
90
90
  "n3": "^1.26.0",
91
91
  "zod": "^3.22.4"
92
92
  },
@@ -96,7 +96,7 @@
96
96
  "vitest": "^1.6.0"
97
97
  },
98
98
  "peerDependencies": {
99
- "@undefineds.co/drizzle-solid": "^0.3.13"
99
+ "@undefineds.co/drizzle-solid": "^0.3.14"
100
100
  },
101
101
  "packageManager": "yarn@1.22.22",
102
102
  "files": [
@@ -14,6 +14,11 @@ cross-app semantics.
14
14
  Model the Pod as a Linked Data graph, not as a relational database with foreign
15
15
  keys.
16
16
 
17
+ - Treat Solid resources and files as first-class. A document, report, spec,
18
+ plan, image, JSONL export, or source artifact can be the durable subject.
19
+ - RDF/TTL is not "just auxiliary"; it is the structured graph representation of
20
+ resource metadata and relations. Use it where cross-client lookup, routing,
21
+ audit, synchronization, or recovery needs structured facts.
17
22
  - Use RDF/Pod relation fields for URI references.
18
23
  - Use local ids only for UI state, runtime protocol keys, function parameters,
19
24
  or the random key passed into an id default function.
@@ -24,12 +29,40 @@ keys.
24
29
  `replyTo`, `workspace`, `task`, `run`, `agent`.
25
30
  - UI-only state stays outside the Pod. Durable shared state belongs in the Pod.
26
31
 
32
+ ## File-Primary vs Control-Primary Resources
33
+
34
+ Before adding a schema, decide what the resource fundamentally is.
35
+
36
+ - File-primary resources have a meaningful body: markdown, JSONL, source file,
37
+ artifact, uploaded file, or generated report. Examples include `Spec`,
38
+ `Plan`, `Report`, and most `Evidence`.
39
+ - For file-primary resources, model only queryable metadata: aboutness, kind,
40
+ status or outcome, abstract/summary when it is needed for indexing,
41
+ actor/reviewer, evidence links, revision, and relations to the controlling
42
+ issue/task/run.
43
+ - Evidence is file-primary when the proof body is a log, diff, patch,
44
+ transcript, screenshot, or report. Keep the body as a Pod file and store only
45
+ queryable metadata in TTL; use `schema:about` for the control object and
46
+ `dcterms:source` for the concrete evidence file when needed.
47
+ - Do not create a parallel model just because a file needs metadata. Add schema
48
+ fields only for facts that must be searched, joined, synchronized, audited, or
49
+ used for routing/recovery across clients.
50
+ - Control-primary resources are execution/control state and should be
51
+ structured model-first. Examples include `Issue`, `Task`, `Delivery`, `Run`,
52
+ `RunStep`, `ApprovalRequest`, and `AutonomyGrant`.
53
+ - A control-primary resource may link to file-primary artifacts; it should not
54
+ inline long-form design, logs, or reports when those are better represented
55
+ as files with metadata.
56
+
27
57
  ## Package Ownership
28
58
 
29
59
  `@undefineds.co/models` owns durable shared model semantics. `drizzle-solid`
30
60
  owns the ORM/resource machinery. Product shells such as Xpod, LinX desktop,
31
61
  CLI, mobile, or workers should not duplicate shared schemas.
32
62
 
63
+ - This skill is maintained and released by `@undefineds.co/models`. Product
64
+ repos should consume the released skill/plugin instead of keeping their own
65
+ divergent Solid modeling rules.
33
66
  - If a resource/schema/repository already exists in `models`, consume it.
34
67
  - If a product needs a missing shared query, mutation, or id helper, add it to
35
68
  `models` first with tests, then call it from the product shell.
@@ -54,8 +87,23 @@ Do not hand-parse shared business TTL when a resource schema exists.
54
87
  `updateByLocator`, and `deleteByLocator` are legacy compatibility surfaces.
55
88
  - Raw Solid client or `fetch` access is acceptable only for protocol-level
56
89
  adapters where no shared business resource exists yet.
57
-
58
- ## Ids, Defaults, and Subject Templates
90
+ - Product shells should trust the typed `SolidDatabase` contract. Do not add
91
+ application-layer probes such as `typeof db.findById === 'function'`,
92
+ `db.updateById?.(...)`, or `typeof db.resolveResourceIri === 'function'`.
93
+ If a required ORM method is missing, fix `drizzle-solid`, the shared
94
+ repository in `models`, or the test mock.
95
+ - `db.resolveResourceIri` is a generic drizzle-solid resolver for turning a
96
+ schema resource plus an exact target into a full Pod IRI. Treat it as a
97
+ low-level adapter escape hatch, not as the default product API.
98
+ - If a shared `models` resource exists, product shells should call
99
+ resource-owned helpers such as `resource.buildId(...)`,
100
+ `resource.buildIri(webIdOrPodUrl, ...)`, or
101
+ `resource.buildIriForDatabase(db, ...)` instead of directly calling
102
+ `db.resolveResourceIri`, importing `buildModelResource*` compatibility
103
+ wrappers, or reimplementing Pod base discovery. Reusable business target
104
+ construction belongs in `models` repositories/helpers, not in product shells.
105
+
106
+ ## Ids and Defaults
59
107
 
60
108
  The durable `id` is base-relative. It is not a fragment id.
61
109
 
@@ -66,18 +114,14 @@ function should return the full base-relative resource id.
66
114
  Examples:
67
115
 
68
116
  ```ts
69
- chatResourceId('default') === 'default/index.ttl#this'
70
- messageResourceId('msg_1', row) === 'chat/default/2026/05/18/messages.ttl#msg_1'
71
- runResourceId('run_1', row) === 'task/secretary/2026/05/18/runs.ttl#run_1'
117
+ chatResource.buildId({ id: 'default' }) === 'default/index.ttl#this'
118
+ messageResource.buildId({ id: 'msg_1', ...row }) === 'chat/default/2026/05/18/messages.ttl#msg_1'
119
+ runResource.buildId({ id: 'run_1', ...row }) === 'task/secretary/2026/05/18/runs.ttl#run_1'
72
120
  ```
73
121
 
74
- Do not combine a full id default with a `subjectTemplate` that reparses or
75
- wraps the same id. Exact ids should resolve directly against `base`.
76
-
77
- Keep `subjectTemplate` only for simple resources where the id field is the
78
- stable storage key and the template has no hidden dependency on another
79
- resource. Prefer a default id function once the template needs parent paths,
80
- date buckets, fragments, or associated resource ids.
122
+ Do not configure legacy subject templates in `models`. Storage paths belong in
123
+ the `id.default(...)` definition or in a caller-provided exact id. Exact ids
124
+ should resolve directly against `base`.
81
125
 
82
126
  If a user passes an explicit id, treat it as exact. Do not reinterpret it as a
83
127
  random key or fragment id.
@@ -129,9 +173,11 @@ Use these concepts consistently across products:
129
173
  user is talking with.
130
174
  - `Task`: task-style command surface, parallel to Chat. It describes recurring,
131
175
  triggered, or one-off task intent.
132
- - `Thread`: concrete timeline/place under a Chat or Task.
133
- - `Message`: human/runtime communication item in a Thread, linked to the Chat
134
- or Task surface when useful.
176
+ - `Thread`: implicit concrete timeline/place under exactly one command surface:
177
+ Chat for conversation timelines, or Task for task execution timelines.
178
+ - `Message`: human/runtime communication item in a command scope. It usually
179
+ belongs to a Chat, but task/runtime messages may belong to a Task or Thread
180
+ scope without inventing a Chat.
135
181
  - `Run`: one concrete execution attempt by an Agent Runtime.
136
182
  - `RunStep`: append-only execution facts for a Run.
137
183
 
@@ -145,11 +191,18 @@ Align with graph semantics:
145
191
 
146
192
  | Concept | Preferred RDF direction | Typical predicate |
147
193
  |---|---|---|
194
+ | resource belongs to command scope | `resource -> scope` | `udfs:inScope` |
148
195
  | chat contains message | `chat -> message` | `wf:message` / project vocabulary |
196
+ | chat owns thread | `thread -> chat` | `sioc:has_parent` for compatibility |
149
197
  | thread contains message | `thread -> message` | `sioc:has_member` or equivalent |
150
198
  | reply points to original | `replyMessage -> originalMessage` | `sioc:has_reply` / project predicate |
151
199
  | author/maker | `message -> maker` | `foaf:maker` |
152
200
 
201
+ Use `udfs:inScope` for LinX product semantics when a Thread or Message can
202
+ belong to either Chat or Task. Preserve Solid Chat compatibility by also writing
203
+ `sioc:has_parent` for Chat-scoped Threads and `wf:message` for Chat-scoped
204
+ Messages. Do not stretch Solid Chat predicates to mean Task ownership.
205
+
153
206
  When inverse predicates are supported, use them for read/write symmetry. If the
154
207
  ORM cannot safely express the inverse write, put the relation writer in the
155
208
  repository and cover it with integration tests.
@@ -160,7 +213,7 @@ Use `Resource` names for shared models.
160
213
 
161
214
  - Export `chatResource`, `messageResource`, `taskResource`, `runResource`.
162
215
  - Keep `chatTable`-style aliases only for compatibility while downstream code
163
- migrates.
216
+ migrates; do not use them in new examples or new shared-model code.
164
217
  - New shared-model code should prefer `solidResources` over table registries.
165
218
 
166
219
  ## Testing Expectations
@@ -168,7 +221,7 @@ Use `Resource` names for shared models.
168
221
  For shared schema changes, verify both ergonomics and graph semantics:
169
222
 
170
223
  1. Unit tests for id/default helpers and URI builders.
171
- 2. Resource tests that assert exact-id mode or the intended `subjectTemplate`.
224
+ 2. Resource tests that assert exact-id mode and the intended `id.default(...)`.
172
225
  3. Repository or Pod integration tests for relation read/write behavior.
173
226
  4. Assertions that produced IRIs contain no unresolved template placeholders.
174
227
 
@@ -1,60 +0,0 @@
1
- /**
2
- * @deprecated 文件管理应由 xpod 处理,Pod 本身就是文件系统。
3
- * 标签、索引等元数据功能由 xpod sidecar 提供。
4
- * 此 schema 将在未来版本中移除。
5
- *
6
- * File resource
7
- * 文件管理模型 - 基于 Solid Pod 存储
8
- *
9
- * 参考标准:
10
- * - Schema.org MediaObject
11
- * - Schema.org CreativeWork
12
- * - LDP NonRDFSource (实际文件)
13
- *
14
- * 注意:此 resource 存储文件元数据,实际文件内容存储在 Pod 的文件系统中
15
- */
16
- export declare const fileResource: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
17
- id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
18
- name: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
19
- description: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
20
- mimeType: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
21
- size: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"integer", null, true, false>;
22
- hash: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
23
- podUri: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
24
- localPath: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
25
- syncStatus: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
26
- lastSyncedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
27
- owner: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
28
- sharedWith: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
29
- folder: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
30
- tags: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
31
- createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
32
- modifiedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
33
- deletedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
34
- starred: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"boolean", null, false, true>;
35
- pinnedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
36
- }>>;
37
- export declare const fileTable: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
38
- id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
39
- name: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
40
- description: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
41
- mimeType: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
42
- size: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"integer", null, true, false>;
43
- hash: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
44
- podUri: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
45
- localPath: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
46
- syncStatus: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
47
- lastSyncedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
48
- owner: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
49
- sharedWith: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
50
- folder: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
51
- tags: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
52
- createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
53
- modifiedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
54
- deletedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
55
- starred: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"boolean", null, false, true>;
56
- pinnedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
57
- }>>;
58
- export type FileRow = typeof fileResource.$inferSelect;
59
- export type FileInsert = typeof fileResource.$inferInsert;
60
- export type FileUpdate = typeof fileResource.$inferUpdate;
@@ -1,53 +0,0 @@
1
- import { podTable, string, timestamp, integer, boolean, id } from "@undefineds.co/drizzle-solid";
2
- import { UDFS, DCTerms, SCHEMA } from "../namespaces.js";
3
- /**
4
- * @deprecated 文件管理应由 xpod 处理,Pod 本身就是文件系统。
5
- * 标签、索引等元数据功能由 xpod sidecar 提供。
6
- * 此 schema 将在未来版本中移除。
7
- *
8
- * File resource
9
- * 文件管理模型 - 基于 Solid Pod 存储
10
- *
11
- * 参考标准:
12
- * - Schema.org MediaObject
13
- * - Schema.org CreativeWork
14
- * - LDP NonRDFSource (实际文件)
15
- *
16
- * 注意:此 resource 存储文件元数据,实际文件内容存储在 Pod 的文件系统中
17
- */
18
- export const fileResource = podTable("file", {
19
- // 基础信息
20
- id: id("id"),
21
- name: string("name").predicate(SCHEMA.name).notNull(), // 文件名
22
- description: string("description").predicate(SCHEMA.description), // 文件描述
23
- // 文件属性
24
- mimeType: string("mimeType").predicate(SCHEMA.encodingFormat).notNull(), // MIME 类型
25
- size: integer("size").predicate(SCHEMA.fileSize).notNull(), // 文件大小(字节)
26
- hash: string("hash").predicate(UDFS.fileHash), // 文件哈希(SHA-256)
27
- // 存储位置
28
- podUri: string("podUri").predicate(DCTerms.identifier).notNull(), // Pod 中的 URI
29
- localPath: string("localPath").predicate(UDFS.localPath), // 本地路径(如果已下载)
30
- // 同步状态
31
- syncStatus: string("syncStatus").predicate(UDFS.syncStatus).notNull().default("synced"), // synced, pending, conflict, error
32
- lastSyncedAt: timestamp("lastSyncedAt").predicate(DCTerms.modified), // 最后同步时间
33
- // 所有者和权限
34
- owner: string("owner").predicate(DCTerms.creator).notNull(), // 所有者 WebID
35
- sharedWith: string("sharedWith").predicate(UDFS.participants), // 共享给的用户 WebID 列表(JSON)
36
- // 分类和标签
37
- folder: string("folder").predicate(UDFS.conversation), // 所属文件夹 URI
38
- tags: string("tags").predicate(DCTerms.subject), // 标签(JSON 数组)
39
- // 时间戳
40
- createdAt: timestamp("createdAt").predicate(DCTerms.created).notNull().defaultNow(),
41
- modifiedAt: timestamp("modifiedAt").predicate(DCTerms.modified).notNull().defaultNow(),
42
- deletedAt: timestamp("deletedAt").predicate(UDFS.deletedAt), // 软删除时间
43
- // UI 状态
44
- starred: boolean("starred").predicate(UDFS.favorite).default(false), // 是否加星标
45
- pinnedAt: timestamp("pinnedAt").predicate(UDFS.pinnedAt), // 置顶时间
46
- }, {
47
- base: '/.data/files/', // LDP Container
48
- sparqlEndpoint: '/.data/files/-/sparql',
49
- type: SCHEMA.MediaObject,
50
- namespace: UDFS,
51
- });
52
- // Compatibility alias. New model code should prefer `fileResource`.
53
- export const fileTable = fileResource;
@@ -1 +0,0 @@
1
- export { fileResource, fileTable, type FileRow, type FileInsert, type FileUpdate } from "./file.schema";
@@ -1 +0,0 @@
1
- export { fileResource, fileTable } from "./file.schema.js";
@@ -1,183 +0,0 @@
1
- export declare const matrixAccountRepository: import("@undefineds.co/drizzle-solid/dist/core/repository").PodRepositoryDescriptor<import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
2
- id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
3
- matrixUserId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
4
- webId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, true, false>;
5
- displayName: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
6
- avatarUrl: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
7
- deviceId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
8
- accessTokenHash: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
9
- metadata: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
10
- createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
11
- updatedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
12
- }>>, {
13
- id: string;
14
- matrixUserId: string;
15
- webId: string;
16
- displayName: string;
17
- avatarUrl: string;
18
- deviceId: string;
19
- accessTokenHash: string;
20
- metadata: Record<string, unknown>;
21
- createdAt: Date;
22
- updatedAt: Date;
23
- }, {
24
- matrixUserId: string;
25
- webId: string;
26
- id?: string | undefined;
27
- displayName?: string | undefined;
28
- avatarUrl?: string | undefined;
29
- deviceId?: string | undefined;
30
- accessTokenHash?: string | undefined;
31
- metadata?: Record<string, unknown> | undefined;
32
- createdAt?: Date | undefined;
33
- updatedAt?: Date | undefined;
34
- }, {
35
- id?: string | null | undefined;
36
- matrixUserId?: string | undefined;
37
- webId?: string | undefined;
38
- displayName?: string | null | undefined;
39
- avatarUrl?: string | null | undefined;
40
- deviceId?: string | null | undefined;
41
- accessTokenHash?: string | null | undefined;
42
- metadata?: Record<string, unknown> | null | undefined;
43
- createdAt?: Date | undefined;
44
- updatedAt?: Date | undefined;
45
- }, Record<string, unknown>>;
46
- export declare const matrixRoomRepository: import("@undefineds.co/drizzle-solid/dist/core/repository").PodRepositoryDescriptor<import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
47
- id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
48
- matrixRoomId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
49
- canonicalAlias: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
50
- name: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
51
- topic: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
52
- creator: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
53
- visibility: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
54
- roomVersion: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, true>;
55
- federate: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"boolean", null, false, true>;
56
- chat: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
57
- members: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"array", "uri", false, false>;
58
- metadata: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
59
- createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
60
- updatedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
61
- }>>, {
62
- id: string;
63
- matrixRoomId: string;
64
- canonicalAlias: string;
65
- name: string;
66
- topic: string;
67
- creator: string;
68
- visibility: string;
69
- roomVersion: string;
70
- federate: boolean;
71
- chat: string;
72
- members: string[];
73
- metadata: Record<string, unknown>;
74
- createdAt: Date;
75
- updatedAt: Date;
76
- }, {
77
- matrixRoomId: string;
78
- id?: string | undefined;
79
- canonicalAlias?: string | undefined;
80
- name?: string | undefined;
81
- topic?: string | undefined;
82
- creator?: string | undefined;
83
- visibility?: string | undefined;
84
- roomVersion?: string | undefined;
85
- federate?: boolean | undefined;
86
- chat?: string | undefined;
87
- members?: string[] | undefined;
88
- metadata?: Record<string, unknown> | undefined;
89
- createdAt?: Date | undefined;
90
- updatedAt?: Date | undefined;
91
- }, {
92
- id?: string | null | undefined;
93
- matrixRoomId?: string | undefined;
94
- canonicalAlias?: string | null | undefined;
95
- name?: string | null | undefined;
96
- topic?: string | null | undefined;
97
- creator?: string | null | undefined;
98
- visibility?: string | undefined;
99
- roomVersion?: string | null | undefined;
100
- federate?: boolean | null | undefined;
101
- chat?: string | null | undefined;
102
- members?: string[] | null | undefined;
103
- metadata?: Record<string, unknown> | null | undefined;
104
- createdAt?: Date | undefined;
105
- updatedAt?: Date | undefined;
106
- }, Record<string, unknown>>;
107
- export declare const matrixEventRepository: import("@undefineds.co/drizzle-solid/dist/core/repository").PodRepositoryDescriptor<import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
108
- id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
109
- matrixEventId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
110
- matrixRoomId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
111
- room: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
112
- type: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
113
- stateKey: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
114
- sender: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
115
- senderWebId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
116
- originServerTs: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"integer", null, true, false>;
117
- depth: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"integer", null, true, true>;
118
- txnId: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
119
- content: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, true, false>;
120
- unsigned: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
121
- redacts: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
122
- relatedMessage: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
123
- metadata: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
124
- createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
125
- updatedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
126
- }>>, {
127
- id: string;
128
- matrixEventId: string;
129
- matrixRoomId: string;
130
- room: string;
131
- type: string;
132
- stateKey: string;
133
- sender: string;
134
- senderWebId: string;
135
- originServerTs: number;
136
- depth: number;
137
- txnId: string;
138
- content: Record<string, unknown>;
139
- unsigned: Record<string, unknown>;
140
- redacts: string;
141
- relatedMessage: string;
142
- metadata: Record<string, unknown>;
143
- createdAt: Date;
144
- updatedAt: Date;
145
- }, {
146
- matrixEventId: string;
147
- matrixRoomId: string;
148
- type: string;
149
- sender: string;
150
- originServerTs: number;
151
- content: Record<string, unknown>;
152
- id?: string | undefined;
153
- room?: string | undefined;
154
- stateKey?: string | undefined;
155
- senderWebId?: string | undefined;
156
- depth?: number | undefined;
157
- txnId?: string | undefined;
158
- unsigned?: Record<string, unknown> | undefined;
159
- redacts?: string | undefined;
160
- relatedMessage?: string | undefined;
161
- metadata?: Record<string, unknown> | undefined;
162
- createdAt?: Date | undefined;
163
- updatedAt?: Date | undefined;
164
- }, {
165
- id?: string | null | undefined;
166
- matrixEventId?: string | undefined;
167
- matrixRoomId?: string | undefined;
168
- room?: string | null | undefined;
169
- type?: string | undefined;
170
- stateKey?: string | null | undefined;
171
- sender?: string | undefined;
172
- senderWebId?: string | null | undefined;
173
- originServerTs?: number | undefined;
174
- depth?: number | undefined;
175
- txnId?: string | null | undefined;
176
- content?: Record<string, unknown> | undefined;
177
- unsigned?: Record<string, unknown> | null | undefined;
178
- redacts?: string | null | undefined;
179
- relatedMessage?: string | null | undefined;
180
- metadata?: Record<string, unknown> | null | undefined;
181
- createdAt?: Date | undefined;
182
- updatedAt?: Date | null | undefined;
183
- }, Record<string, unknown>>;
@@ -1,20 +0,0 @@
1
- import { definePodRepository } from './repository.js';
2
- import { matrixAccountResource, matrixEventResource, matrixRoomResource, } from './matrix.schema.js';
3
- export const matrixAccountRepository = definePodRepository({
4
- namespace: 'matrixAccount',
5
- table: matrixAccountResource,
6
- searchableFields: ['matrixUserId', 'displayName'],
7
- defaultSort: { field: 'updatedAt', direction: 'desc' },
8
- });
9
- export const matrixRoomRepository = definePodRepository({
10
- namespace: 'matrixRoom',
11
- table: matrixRoomResource,
12
- searchableFields: ['matrixRoomId', 'canonicalAlias', 'name', 'topic'],
13
- defaultSort: { field: 'updatedAt', direction: 'desc' },
14
- });
15
- export const matrixEventRepository = definePodRepository({
16
- namespace: 'matrixEvent',
17
- table: matrixEventResource,
18
- searchableFields: ['matrixEventId', 'matrixRoomId', 'type', 'txnId'],
19
- defaultSort: { field: 'originServerTs', direction: 'asc' },
20
- });