@undefineds.co/models 0.2.34 → 0.2.36
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/README.md +13 -16
- package/dist/agent.repository.d.ts +48 -0
- package/dist/agent.repository.js +1 -1
- package/dist/agent.schema.d.ts +24 -0
- package/dist/agent.schema.js +16 -5
- package/dist/ai-config/index.d.ts +28 -2
- package/dist/ai-config/index.js +154 -13
- package/dist/ai-model.schema.js +11 -12
- package/dist/ai-provider.schema.d.ts +4 -0
- package/dist/ai-provider.schema.js +11 -10
- package/dist/ai-runtime.schema.d.ts +4 -4
- package/dist/ai-runtime.schema.js +43 -45
- package/dist/approval.schema.d.ts +0 -1
- package/dist/approval.schema.js +2 -11
- package/dist/audit.schema.d.ts +0 -1
- package/dist/audit.schema.js +2 -11
- package/dist/automation-rule.schema.d.ts +63 -0
- package/dist/automation-rule.schema.js +51 -0
- package/dist/bin/udfs.js +3 -3
- package/dist/chat.repository.d.ts +4 -4
- package/dist/chat.repository.js +1 -1
- package/dist/chat.schema.d.ts +2 -2
- package/dist/chat.schema.js +3 -4
- package/dist/chat.utils.d.ts +7 -0
- package/dist/chat.utils.js +35 -6
- package/dist/contact.repository.d.ts +4 -4
- package/dist/contact.repository.js +1 -1
- package/dist/contact.schema.d.ts +2 -2
- package/dist/contact.schema.js +2 -3
- package/dist/credential.schema.js +21 -22
- package/dist/delivery.schema.d.ts +81 -0
- package/dist/delivery.schema.js +64 -0
- package/dist/evidence.schema.d.ts +38 -0
- package/dist/evidence.schema.js +46 -0
- package/dist/favorite/favorite.schema.d.ts +3 -5
- package/dist/favorite/favorite.schema.js +2 -3
- package/dist/favorite/starred-sync.d.ts +1 -1
- package/dist/favorite/starred-sync.js +11 -13
- package/dist/fixtures/contracts-chat-contact.js +3 -3
- package/dist/grant.schema.d.ts +2 -3
- package/dist/grant.schema.js +6 -9
- package/dist/idea.schema.d.ts +32 -0
- package/dist/idea.schema.js +36 -0
- package/dist/inbox-notification.schema.js +1 -2
- package/dist/index.d.ts +19 -14
- package/dist/index.js +20 -18
- package/dist/issue.repository.js +1 -1
- package/dist/issue.schema.js +1 -2
- package/dist/knowledge/knowledge-folder.schema.d.ts +1 -1
- package/dist/knowledge/knowledge-folder.schema.js +1 -1
- package/dist/message.repository.d.ts +7 -15
- package/dist/message.repository.js +1 -1
- package/dist/message.schema.d.ts +7 -11
- package/dist/message.schema.js +10 -12
- package/dist/namespaces.d.ts +0 -2
- package/dist/namespaces.js +122 -92
- package/dist/pod-storage-descriptor.d.ts +0 -6
- package/dist/pod-storage-descriptor.js +11 -12
- package/dist/profile.repository.d.ts +2 -2
- package/dist/profile.repository.js +2 -2
- package/dist/report.schema.d.ts +58 -0
- package/dist/report.schema.js +73 -0
- package/dist/repository.d.ts +15 -4
- package/dist/repository.js +16 -5
- package/dist/resource-id-defaults.d.ts +1 -12
- package/dist/resource-id-defaults.js +65 -72
- package/dist/resource-refs.d.ts +25 -0
- package/dist/resource-refs.js +45 -0
- package/dist/run.schema.d.ts +13 -17
- package/dist/run.schema.js +12 -13
- package/dist/schedule.schema.d.ts +56 -0
- package/dist/schedule.schema.js +46 -0
- package/dist/schema.d.ts +273 -194
- package/dist/schema.js +18 -10
- package/dist/session/index.d.ts +1 -1
- package/dist/session/index.js +1 -1
- package/dist/session/session.schema.d.ts +4 -6
- package/dist/session/session.schema.js +5 -16
- package/dist/session.repository.d.ts +8 -8
- package/dist/session.repository.js +1 -1
- package/dist/settings/settings.schema.d.ts +2 -0
- package/dist/settings/settings.schema.js +8 -3
- package/dist/sidecar/persistence-mapping.d.ts +1 -1
- package/dist/sidecar/sidecar-events.d.ts +36 -36
- package/dist/skill.schema.d.ts +39 -0
- package/dist/skill.schema.js +31 -0
- package/dist/task.schema.d.ts +22 -32
- package/dist/task.schema.js +17 -25
- package/dist/thread.repository.d.ts +4 -8
- package/dist/thread.repository.js +1 -1
- package/dist/thread.schema.d.ts +9 -10
- package/dist/thread.schema.js +24 -13
- package/dist/types/collaboration-blocks.d.ts +3 -1
- package/dist/types/message-block.d.ts +3 -1
- package/dist/vocab/chat.vocab.d.ts +1 -1
- package/dist/vocab/chat.vocab.js +1 -1
- package/dist/vocab/contact.vocab.d.ts +1 -1
- package/dist/vocab/contact.vocab.js +1 -1
- package/dist/vocab/index.d.ts +2 -0
- package/dist/vocab/index.js +2 -0
- package/dist/vocab/message.vocab.d.ts +1 -1
- package/dist/vocab/message.vocab.js +1 -1
- package/dist/vocab/session.vocab.d.ts +16 -0
- package/dist/vocab/session.vocab.js +17 -0
- package/dist/vocab/sidecar.vocab.d.ts +19 -1
- package/dist/vocab/sidecar.vocab.js +22 -4
- package/dist/vocab/thread.vocab.d.ts +1 -0
- package/dist/vocab/thread.vocab.js +1 -0
- package/dist/vocab/workflow.vocab.d.ts +135 -0
- package/dist/vocab/workflow.vocab.js +136 -0
- package/package.json +3 -3
- package/skills/solid-modeling/SKILL.md +57 -17
- package/dist/file/file.schema.d.ts +0 -60
- package/dist/file/file.schema.js +0 -53
- package/dist/file/index.d.ts +0 -1
- package/dist/file/index.js +0 -1
- package/dist/matrix.repository.d.ts +0 -183
- package/dist/matrix.repository.js +0 -20
- package/dist/matrix.schema.d.ts +0 -136
- package/dist/matrix.schema.js +0 -100
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { id, podTable, string, uri } from "@undefineds.co/drizzle-solid";
|
|
2
|
-
import {
|
|
2
|
+
import { UDFS } from "./namespaces.js";
|
|
3
3
|
export const aiProviderResource = podTable("aiProvider", {
|
|
4
|
-
id: id("id"),
|
|
5
|
-
displayName: string("displayName").predicate(
|
|
6
|
-
baseUrl: string("baseUrl").predicate(
|
|
7
|
-
proxyUrl: string("proxyUrl").predicate(
|
|
8
|
-
hasModel: uri("hasModel").predicate(
|
|
9
|
-
defaultModel: uri("defaultModel").predicate(
|
|
4
|
+
id: id("id").default("{key}.ttl"),
|
|
5
|
+
displayName: string("displayName").predicate(UDFS.displayName),
|
|
6
|
+
baseUrl: string("baseUrl").predicate(UDFS.baseUrl),
|
|
7
|
+
proxyUrl: string("proxyUrl").predicate(UDFS.proxyUrl),
|
|
8
|
+
hasModel: uri("hasModel").predicate(UDFS.hasModel).link("aiModel"),
|
|
9
|
+
defaultModel: uri("defaultModel").predicate(UDFS.defaultModel).link("aiModel"),
|
|
10
|
+
supportsBackend: string("supportsBackend").predicate(UDFS.supportsBackend),
|
|
11
|
+
rotationPolicy: string("rotationPolicy").predicate(UDFS.rotationPolicy),
|
|
10
12
|
}, {
|
|
11
13
|
base: "/settings/providers/",
|
|
12
|
-
type:
|
|
13
|
-
namespace:
|
|
14
|
-
subjectTemplate: "{id}.ttl",
|
|
14
|
+
type: UDFS.Provider,
|
|
15
|
+
namespace: UDFS,
|
|
15
16
|
});
|
|
16
17
|
// Compatibility alias. New model code should prefer `aiProviderResource`.
|
|
17
18
|
export const aiProviderTable = aiProviderResource;
|
|
@@ -27,11 +27,11 @@ export declare const indexedFileResource: import("@undefineds.co/drizzle-solid/d
|
|
|
27
27
|
}>>;
|
|
28
28
|
export declare const agentStatusResource: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
|
|
29
29
|
id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
|
|
30
|
-
|
|
30
|
+
agent: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
31
31
|
status: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
32
32
|
startedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
|
|
33
33
|
lastActivityAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
|
|
34
|
-
|
|
34
|
+
currentTask: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
35
35
|
errorMessage: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
36
36
|
}>>;
|
|
37
37
|
export declare const aiConfigTable: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
|
|
@@ -63,11 +63,11 @@ export declare const indexedFileTable: import("@undefineds.co/drizzle-solid/dist
|
|
|
63
63
|
}>>;
|
|
64
64
|
export declare const agentStatusTable: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
|
|
65
65
|
id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
|
|
66
|
-
|
|
66
|
+
agent: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
67
67
|
status: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
68
68
|
startedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
|
|
69
69
|
lastActivityAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
|
|
70
|
-
|
|
70
|
+
currentTask: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
71
71
|
errorMessage: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
72
72
|
}>>;
|
|
73
73
|
export type AIConfigRow = typeof aiConfigResource.$inferSelect;
|
|
@@ -1,61 +1,59 @@
|
|
|
1
1
|
import { id, integer, podTable, string, timestamp, uri } from '@undefineds.co/drizzle-solid';
|
|
2
|
+
import { agentResource } from './agent.schema.js';
|
|
2
3
|
import { aiModelResource } from './ai-model.schema.js';
|
|
3
|
-
import {
|
|
4
|
+
import { UDFS } from './namespaces.js';
|
|
5
|
+
import { taskResource } from './task.schema.js';
|
|
4
6
|
export const aiConfigResource = podTable('aiConfig', {
|
|
5
|
-
id: id('id'),
|
|
6
|
-
embeddingModel: uri('embeddingModel').predicate(
|
|
7
|
-
previousModel: uri('previousModel').predicate(
|
|
8
|
-
migrationStatus: string('migrationStatus').predicate(
|
|
9
|
-
migrationProgress: integer('migrationProgress').predicate(
|
|
10
|
-
updatedAt: timestamp('updatedAt').predicate(
|
|
7
|
+
id: id('id').default('config.ttl#{key}'),
|
|
8
|
+
embeddingModel: uri('embeddingModel').predicate(UDFS.embeddingModel).link(aiModelResource),
|
|
9
|
+
previousModel: uri('previousModel').predicate(UDFS.previousModel).link(aiModelResource),
|
|
10
|
+
migrationStatus: string('migrationStatus').predicate(UDFS.migrationStatus),
|
|
11
|
+
migrationProgress: integer('migrationProgress').predicate(UDFS.migrationProgress),
|
|
12
|
+
updatedAt: timestamp('updatedAt').predicate(UDFS.updatedAt),
|
|
11
13
|
}, {
|
|
12
|
-
base: '/settings/ai/
|
|
13
|
-
type:
|
|
14
|
-
namespace:
|
|
15
|
-
subjectTemplate: '#{id}',
|
|
14
|
+
base: '/settings/ai/',
|
|
15
|
+
type: UDFS.AIConfig,
|
|
16
|
+
namespace: UDFS,
|
|
16
17
|
});
|
|
17
18
|
export const vectorStoreResource = podTable('vectorStore', {
|
|
18
|
-
id: id('id'),
|
|
19
|
-
name: string('name').predicate(
|
|
20
|
-
container: uri('container').predicate(
|
|
21
|
-
chunkingStrategy: string('chunkingStrategy').predicate(
|
|
22
|
-
status: string('status').predicate(
|
|
23
|
-
createdAt: timestamp('createdAt').predicate(
|
|
24
|
-
lastActiveAt: timestamp('lastActiveAt').predicate(
|
|
19
|
+
id: id('id').default('vector-stores.ttl#{key}'),
|
|
20
|
+
name: string('name').predicate(UDFS.name),
|
|
21
|
+
container: uri('container').predicate(UDFS.container),
|
|
22
|
+
chunkingStrategy: string('chunkingStrategy').predicate(UDFS.chunkingStrategy),
|
|
23
|
+
status: string('status').predicate(UDFS.status),
|
|
24
|
+
createdAt: timestamp('createdAt').predicate(UDFS.createdAt),
|
|
25
|
+
lastActiveAt: timestamp('lastActiveAt').predicate(UDFS.lastActiveAt),
|
|
25
26
|
}, {
|
|
26
|
-
base: '/settings/ai/
|
|
27
|
-
type:
|
|
28
|
-
namespace:
|
|
29
|
-
subjectTemplate: '#{id}',
|
|
27
|
+
base: '/settings/ai/',
|
|
28
|
+
type: UDFS.VectorStore,
|
|
29
|
+
namespace: UDFS,
|
|
30
30
|
});
|
|
31
31
|
export const indexedFileResource = podTable('indexedFile', {
|
|
32
|
-
id: id('id'),
|
|
33
|
-
fileUrl: uri('fileUrl').predicate(
|
|
34
|
-
vectorId: integer('vectorId').predicate(
|
|
35
|
-
chunkingStrategy: string('chunkingStrategy').predicate(
|
|
36
|
-
status: string('status').predicate(
|
|
37
|
-
usageBytes: integer('usageBytes').predicate(
|
|
38
|
-
lastError: string('lastError').predicate(
|
|
39
|
-
indexedAt: timestamp('indexedAt').predicate(
|
|
32
|
+
id: id('id').default('indexed-files.ttl#{key}'),
|
|
33
|
+
fileUrl: uri('fileUrl').predicate(UDFS.fileUrl),
|
|
34
|
+
vectorId: integer('vectorId').predicate(UDFS.vectorId),
|
|
35
|
+
chunkingStrategy: string('chunkingStrategy').predicate(UDFS.chunkingStrategy),
|
|
36
|
+
status: string('status').predicate(UDFS.status),
|
|
37
|
+
usageBytes: integer('usageBytes').predicate(UDFS.usageBytes),
|
|
38
|
+
lastError: string('lastError').predicate(UDFS.lastError),
|
|
39
|
+
indexedAt: timestamp('indexedAt').predicate(UDFS.indexedAt),
|
|
40
40
|
}, {
|
|
41
|
-
base: '/settings/ai/
|
|
42
|
-
type:
|
|
43
|
-
namespace:
|
|
44
|
-
subjectTemplate: '#{id}',
|
|
41
|
+
base: '/settings/ai/',
|
|
42
|
+
type: UDFS.IndexedFile,
|
|
43
|
+
namespace: UDFS,
|
|
45
44
|
});
|
|
46
45
|
export const agentStatusResource = podTable('agentStatus', {
|
|
47
|
-
id: id('id'),
|
|
48
|
-
|
|
49
|
-
status: string('status').predicate(
|
|
50
|
-
startedAt: timestamp('startedAt').predicate(
|
|
51
|
-
lastActivityAt: timestamp('lastActivityAt').predicate(
|
|
52
|
-
|
|
53
|
-
errorMessage: string('errorMessage').predicate(
|
|
46
|
+
id: id('id').default('agent-status.ttl#{key}'),
|
|
47
|
+
agent: uri('agent').predicate(UDFS.agent).link(agentResource),
|
|
48
|
+
status: string('status').predicate(UDFS.status),
|
|
49
|
+
startedAt: timestamp('startedAt').predicate(UDFS.startedAt),
|
|
50
|
+
lastActivityAt: timestamp('lastActivityAt').predicate(UDFS.lastActivityAt),
|
|
51
|
+
currentTask: uri('currentTask').predicate(UDFS.task).link(taskResource),
|
|
52
|
+
errorMessage: string('errorMessage').predicate(UDFS.errorMessage),
|
|
54
53
|
}, {
|
|
55
|
-
base: '/settings/ai/
|
|
56
|
-
type:
|
|
57
|
-
namespace:
|
|
58
|
-
subjectTemplate: '#{id}',
|
|
54
|
+
base: '/settings/ai/',
|
|
55
|
+
type: UDFS.AgentStatus,
|
|
56
|
+
namespace: UDFS,
|
|
59
57
|
});
|
|
60
58
|
// Compatibility aliases. New model code should prefer `*Resource`.
|
|
61
59
|
export const aiConfigTable = aiConfigResource;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare function buildApprovalSubjectPath(approvalId: string, createdAt?: Date | string | number): string;
|
|
2
1
|
export declare function extractApprovalIdFromApprovalRef(approvalRef: string | null | undefined): string | null;
|
|
3
2
|
export declare const approvalResource: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
|
|
4
3
|
id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
|
package/dist/approval.schema.js
CHANGED
|
@@ -3,23 +3,15 @@ import { ODRL, UDFS, DCTerms } from './namespaces.js';
|
|
|
3
3
|
import { chatResource } from './chat.schema.js';
|
|
4
4
|
import { threadResource } from './thread.schema.js';
|
|
5
5
|
import { asPodResourceTemplateTarget } from './repository.js';
|
|
6
|
-
export function buildApprovalSubjectPath(approvalId, createdAt = new Date()) {
|
|
7
|
-
const date = createdAt instanceof Date ? createdAt : new Date(createdAt);
|
|
8
|
-
const safeDate = Number.isFinite(date.getTime()) ? date : new Date();
|
|
9
|
-
const yyyy = String(safeDate.getUTCFullYear());
|
|
10
|
-
const mm = String(safeDate.getUTCMonth() + 1).padStart(2, '0');
|
|
11
|
-
const dd = String(safeDate.getUTCDate()).padStart(2, '0');
|
|
12
|
-
return `/.data/approvals/${yyyy}/${mm}/${dd}.ttl#${encodeURIComponent(approvalId)}`;
|
|
13
|
-
}
|
|
14
6
|
export function extractApprovalIdFromApprovalRef(approvalRef) {
|
|
15
7
|
if (approvalRef && !/[/:#]/.test(approvalRef)) {
|
|
16
8
|
return approvalRef;
|
|
17
9
|
}
|
|
18
|
-
return extractPodResourceTemplateValue(asPodResourceTemplateTarget(approvalResource), approvalRef);
|
|
10
|
+
return extractPodResourceTemplateValue(asPodResourceTemplateTarget(approvalResource), approvalRef, 'key');
|
|
19
11
|
}
|
|
20
12
|
// Approval request resource (separate from Solid inbox notifications).
|
|
21
13
|
export const approvalResource = podTable('approval', {
|
|
22
|
-
id: id('id'),
|
|
14
|
+
id: id('id').default('{yyyy}/{MM}/{dd}.ttl#{key}'),
|
|
23
15
|
// Relations
|
|
24
16
|
session: uri('session').predicate(UDFS.session).notNull(),
|
|
25
17
|
chat: uri('chat').predicate(UDFS.conversation).link(chatResource),
|
|
@@ -51,7 +43,6 @@ export const approvalResource = podTable('approval', {
|
|
|
51
43
|
sparqlEndpoint: '/.data/approvals/-/sparql',
|
|
52
44
|
type: UDFS.ApprovalRequest,
|
|
53
45
|
namespace: UDFS,
|
|
54
|
-
subjectTemplate: '{yyyy}/{MM}/{dd}.ttl#{id}',
|
|
55
46
|
});
|
|
56
47
|
// Compatibility alias. New model code should prefer `approvalResource`.
|
|
57
48
|
export const approvalTable = approvalResource;
|
package/dist/audit.schema.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare function buildAuditSubjectPath(auditId: string, createdAt?: Date | string | number): string;
|
|
2
1
|
export declare const auditResource: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
|
|
3
2
|
id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
|
|
4
3
|
action: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
|
package/dist/audit.schema.js
CHANGED
|
@@ -3,19 +3,11 @@ import { UDFS, DCTerms } from './namespaces.js';
|
|
|
3
3
|
import { chatResource } from './chat.schema.js';
|
|
4
4
|
import { threadResource } from './thread.schema.js';
|
|
5
5
|
import { asPodResourceTemplateTarget } from './repository.js';
|
|
6
|
-
export function buildAuditSubjectPath(auditId, createdAt = new Date()) {
|
|
7
|
-
const date = createdAt instanceof Date ? createdAt : new Date(createdAt);
|
|
8
|
-
const safeDate = Number.isFinite(date.getTime()) ? date : new Date();
|
|
9
|
-
const yyyy = String(safeDate.getUTCFullYear());
|
|
10
|
-
const mm = String(safeDate.getUTCMonth() + 1).padStart(2, '0');
|
|
11
|
-
const dd = String(safeDate.getUTCDate()).padStart(2, '0');
|
|
12
|
-
return `/.data/audits/${yyyy}/${mm}/${dd}.ttl#${encodeURIComponent(auditId)}`;
|
|
13
|
-
}
|
|
14
6
|
// Append-only audit entry resource (separate from Solid inbox notifications).
|
|
15
7
|
// Audit entries are independent events; session/chat/thread are optional relations,
|
|
16
8
|
// not storage ownership boundaries.
|
|
17
9
|
export const auditResource = podTable('audit', {
|
|
18
|
-
id: id('id'),
|
|
10
|
+
id: id('id').default('{yyyy}/{MM}/{dd}.ttl#{key}'),
|
|
19
11
|
// Audit action
|
|
20
12
|
action: string('action').predicate(UDFS.action).notNull(),
|
|
21
13
|
// Actor identity (WebID semantics)
|
|
@@ -40,13 +32,12 @@ export const auditResource = podTable('audit', {
|
|
|
40
32
|
sparqlEndpoint: '/.data/audits/-/sparql',
|
|
41
33
|
type: UDFS.AuditEntry,
|
|
42
34
|
namespace: UDFS,
|
|
43
|
-
subjectTemplate: '{yyyy}/{MM}/{dd}.ttl#{id}',
|
|
44
35
|
});
|
|
45
36
|
export function extractAuditIdFromAuditRef(auditRef) {
|
|
46
37
|
if (auditRef && !/[/:#]/.test(auditRef)) {
|
|
47
38
|
return auditRef;
|
|
48
39
|
}
|
|
49
|
-
return extractPodResourceTemplateValue(asPodResourceTemplateTarget(auditResource), auditRef);
|
|
40
|
+
return extractPodResourceTemplateValue(asPodResourceTemplateTarget(auditResource), auditRef, 'key');
|
|
50
41
|
}
|
|
51
42
|
// Compatibility alias. New model code should prefer `auditResource`.
|
|
52
43
|
export const auditTable = auditResource;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export type AutomationRuleStatusType = 'active' | 'paused' | 'disabled' | 'failed' | 'archived';
|
|
2
|
+
export type AutomationRuleKindType = 'event' | 'schedule' | 'manual';
|
|
3
|
+
export declare const AutomationRuleStatus: {
|
|
4
|
+
readonly ACTIVE: "active";
|
|
5
|
+
readonly PAUSED: "paused";
|
|
6
|
+
readonly DISABLED: "disabled";
|
|
7
|
+
readonly FAILED: "failed";
|
|
8
|
+
readonly ARCHIVED: "archived";
|
|
9
|
+
};
|
|
10
|
+
export declare const AutomationRuleKind: {
|
|
11
|
+
readonly EVENT: "event";
|
|
12
|
+
readonly SCHEDULE: "schedule";
|
|
13
|
+
readonly MANUAL: "manual";
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* AutomationRule resource.
|
|
17
|
+
*
|
|
18
|
+
* AutomationRule owns policy/condition/action wiring. The executable work
|
|
19
|
+
* remains in Task, time-based triggering remains in Schedule, and each concrete
|
|
20
|
+
* attempt remains in Run.
|
|
21
|
+
*
|
|
22
|
+
* The id template is intentionally left unset. Callers must provide an exact
|
|
23
|
+
* base-relative id until the durable storage path is designed.
|
|
24
|
+
*/
|
|
25
|
+
export declare const automationRuleResource: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
|
|
26
|
+
id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
|
|
27
|
+
title: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
|
|
28
|
+
description: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
29
|
+
status: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
|
|
30
|
+
ruleKind: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
|
|
31
|
+
task: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
32
|
+
schedule: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
33
|
+
source: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
34
|
+
target: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
35
|
+
condition: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
|
|
36
|
+
actions: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
|
|
37
|
+
metadata: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
|
|
38
|
+
lastTriggeredAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
|
|
39
|
+
lastRunStatus: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
40
|
+
createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
|
|
41
|
+
updatedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
|
|
42
|
+
}>>;
|
|
43
|
+
export declare const automationRuleTable: import("@undefineds.co/drizzle-solid/dist/core/schema").PodTableWithColumns<import("@undefineds.co/drizzle-solid/dist/core/schema").ResolvedColumns<{
|
|
44
|
+
id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
|
|
45
|
+
title: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
|
|
46
|
+
description: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
47
|
+
status: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
|
|
48
|
+
ruleKind: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, true>;
|
|
49
|
+
task: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
50
|
+
schedule: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
51
|
+
source: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
52
|
+
target: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
53
|
+
condition: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
|
|
54
|
+
actions: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
|
|
55
|
+
metadata: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
|
|
56
|
+
lastTriggeredAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
|
|
57
|
+
lastRunStatus: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
58
|
+
createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
|
|
59
|
+
updatedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
|
|
60
|
+
}>>;
|
|
61
|
+
export type AutomationRuleRow = typeof automationRuleResource.$inferSelect;
|
|
62
|
+
export type AutomationRuleInsert = typeof automationRuleResource.$inferInsert;
|
|
63
|
+
export type AutomationRuleUpdate = typeof automationRuleResource.$inferUpdate;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { id, object, podTable, string, text, timestamp, uri } from '@undefineds.co/drizzle-solid';
|
|
2
|
+
import { AS, DCTerms, UDFS } from './namespaces.js';
|
|
3
|
+
import { scheduleResource } from './schedule.schema.js';
|
|
4
|
+
import { taskResource } from './task.schema.js';
|
|
5
|
+
export const AutomationRuleStatus = {
|
|
6
|
+
ACTIVE: 'active',
|
|
7
|
+
PAUSED: 'paused',
|
|
8
|
+
DISABLED: 'disabled',
|
|
9
|
+
FAILED: 'failed',
|
|
10
|
+
ARCHIVED: 'archived',
|
|
11
|
+
};
|
|
12
|
+
export const AutomationRuleKind = {
|
|
13
|
+
EVENT: 'event',
|
|
14
|
+
SCHEDULE: 'schedule',
|
|
15
|
+
MANUAL: 'manual',
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* AutomationRule resource.
|
|
19
|
+
*
|
|
20
|
+
* AutomationRule owns policy/condition/action wiring. The executable work
|
|
21
|
+
* remains in Task, time-based triggering remains in Schedule, and each concrete
|
|
22
|
+
* attempt remains in Run.
|
|
23
|
+
*
|
|
24
|
+
* The id template is intentionally left unset. Callers must provide an exact
|
|
25
|
+
* base-relative id until the durable storage path is designed.
|
|
26
|
+
*/
|
|
27
|
+
export const automationRuleResource = podTable('automation_rule', {
|
|
28
|
+
id: id('id'),
|
|
29
|
+
title: string('title').predicate(DCTerms.title).notNull(),
|
|
30
|
+
description: text('description').predicate(DCTerms.description),
|
|
31
|
+
status: string('status').predicate(UDFS.status).notNull().default(AutomationRuleStatus.ACTIVE),
|
|
32
|
+
ruleKind: string('ruleKind').predicate(UDFS.ruleKind).notNull().default(AutomationRuleKind.EVENT),
|
|
33
|
+
task: uri('task').predicate(UDFS.task).link(taskResource),
|
|
34
|
+
schedule: uri('schedule').predicate(UDFS.schedule).link(scheduleResource),
|
|
35
|
+
source: uri('source').predicate(DCTerms.source),
|
|
36
|
+
target: uri('target').predicate(AS.target),
|
|
37
|
+
condition: object('condition').predicate(UDFS.condition),
|
|
38
|
+
actions: object('actions').predicate(UDFS.actions),
|
|
39
|
+
metadata: object('metadata').predicate(UDFS.metadata),
|
|
40
|
+
lastTriggeredAt: timestamp('lastTriggeredAt').predicate(UDFS.lastTriggeredAt),
|
|
41
|
+
lastRunStatus: string('lastRunStatus').predicate(UDFS.lastRunStatus),
|
|
42
|
+
createdAt: timestamp('createdAt').predicate(DCTerms.created).notNull().defaultNow(),
|
|
43
|
+
updatedAt: timestamp('updatedAt').predicate(DCTerms.modified).notNull().defaultNow(),
|
|
44
|
+
}, {
|
|
45
|
+
base: '/.data/',
|
|
46
|
+
sparqlEndpoint: '/.data/-/sparql',
|
|
47
|
+
type: UDFS.AutomationRule,
|
|
48
|
+
namespace: UDFS,
|
|
49
|
+
});
|
|
50
|
+
// Compatibility alias. New model code should prefer `automationRuleResource`.
|
|
51
|
+
export const automationRuleTable = automationRuleResource;
|
package/dist/bin/udfs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createPodStorage, podSchema,
|
|
2
|
+
import { createPodStorage, podSchema, UDFS, } from '../index.js';
|
|
3
3
|
async function main(argv) {
|
|
4
4
|
const [area, action, ...rest] = argv;
|
|
5
5
|
if (!area || area === 'help' || area === '--help' || area === '-h') {
|
|
@@ -249,7 +249,7 @@ function coerceResolvedConsensusPayload(payload) {
|
|
|
249
249
|
if (!isRecord(payload) || payload.status !== 'resolved')
|
|
250
250
|
return null;
|
|
251
251
|
const schemaUri = stringField(payload, 'schemaUri') ?? stringField(payload, 'uri');
|
|
252
|
-
if (schemaUri !==
|
|
252
|
+
if (schemaUri !== UDFS.Credential)
|
|
253
253
|
return null;
|
|
254
254
|
if (!isRecord(payload.fieldMapping))
|
|
255
255
|
return null;
|
|
@@ -297,7 +297,7 @@ function buildConsensusResult(input) {
|
|
|
297
297
|
};
|
|
298
298
|
const resolved = {
|
|
299
299
|
status: 'resolved',
|
|
300
|
-
schemaUri:
|
|
300
|
+
schemaUri: UDFS.Credential,
|
|
301
301
|
fieldMapping: {
|
|
302
302
|
service: input.fieldMapping?.service ?? 'infra',
|
|
303
303
|
providerId: input.fieldMapping?.providerId ?? 'cloudflare',
|
|
@@ -12,7 +12,7 @@ export declare const chatRepository: import("@undefineds.co/drizzle-solid/dist/c
|
|
|
12
12
|
participants: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"array", "uri", false, false>;
|
|
13
13
|
metadata: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
|
|
14
14
|
lastActiveAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
|
|
15
|
-
|
|
15
|
+
lastMessage: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
16
16
|
lastMessagePreview: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
17
17
|
createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
|
|
18
18
|
updatedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
|
|
@@ -30,7 +30,7 @@ export declare const chatRepository: import("@undefineds.co/drizzle-solid/dist/c
|
|
|
30
30
|
participants: string[];
|
|
31
31
|
metadata: Record<string, unknown>;
|
|
32
32
|
lastActiveAt: Date;
|
|
33
|
-
|
|
33
|
+
lastMessage: string;
|
|
34
34
|
lastMessagePreview: string;
|
|
35
35
|
createdAt: Date;
|
|
36
36
|
updatedAt: Date;
|
|
@@ -48,7 +48,7 @@ export declare const chatRepository: import("@undefineds.co/drizzle-solid/dist/c
|
|
|
48
48
|
participants?: string[] | undefined;
|
|
49
49
|
metadata?: Record<string, unknown> | undefined;
|
|
50
50
|
lastActiveAt?: Date | undefined;
|
|
51
|
-
|
|
51
|
+
lastMessage?: string | undefined;
|
|
52
52
|
lastMessagePreview?: string | undefined;
|
|
53
53
|
createdAt?: Date | undefined;
|
|
54
54
|
updatedAt?: Date | undefined;
|
|
@@ -66,7 +66,7 @@ export declare const chatRepository: import("@undefineds.co/drizzle-solid/dist/c
|
|
|
66
66
|
participants?: string[] | null | undefined;
|
|
67
67
|
metadata?: Record<string, unknown> | null | undefined;
|
|
68
68
|
lastActiveAt?: Date | null | undefined;
|
|
69
|
-
|
|
69
|
+
lastMessage?: string | null | undefined;
|
|
70
70
|
lastMessagePreview?: string | null | undefined;
|
|
71
71
|
createdAt?: Date | undefined;
|
|
72
72
|
updatedAt?: Date | undefined;
|
package/dist/chat.repository.js
CHANGED
|
@@ -2,7 +2,7 @@ import { definePodRepository } from './repository.js';
|
|
|
2
2
|
import { chatResource } from './chat.schema.js';
|
|
3
3
|
export const chatRepository = definePodRepository({
|
|
4
4
|
namespace: 'chat',
|
|
5
|
-
|
|
5
|
+
resource: chatResource,
|
|
6
6
|
searchableFields: ['title', 'description'],
|
|
7
7
|
defaultSort: { field: 'lastActiveAt', direction: 'desc' },
|
|
8
8
|
});
|
package/dist/chat.schema.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export declare const chatResource: import("@undefineds.co/drizzle-solid/dist/cor
|
|
|
39
39
|
participants: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"array", "uri", false, false>;
|
|
40
40
|
metadata: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
|
|
41
41
|
lastActiveAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
|
|
42
|
-
|
|
42
|
+
lastMessage: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
43
43
|
lastMessagePreview: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
44
44
|
createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
|
|
45
45
|
updatedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
|
|
@@ -58,7 +58,7 @@ export declare const chatTable: import("@undefineds.co/drizzle-solid/dist/core/s
|
|
|
58
58
|
participants: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"array", "uri", false, false>;
|
|
59
59
|
metadata: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"object", null, false, false>;
|
|
60
60
|
lastActiveAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, false, false>;
|
|
61
|
-
|
|
61
|
+
lastMessage: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
62
62
|
lastMessagePreview: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, false, false>;
|
|
63
63
|
createdAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
|
|
64
64
|
updatedAt: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"datetime", null, true, true>;
|
package/dist/chat.schema.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { boolean, object, podTable, string, text, timestamp, uri, id, integer } from '@undefineds.co/drizzle-solid';
|
|
2
2
|
import { UDFS, DCTerms, SCHEMA, MEETING, WF } from './namespaces.js';
|
|
3
|
-
import { chatResourceId } from './resource-id-defaults.js';
|
|
4
3
|
export const ChatStatus = {
|
|
5
4
|
ACTIVE: 'active',
|
|
6
5
|
ARCHIVED: 'archived',
|
|
@@ -24,7 +23,7 @@ export const ChatStatus = {
|
|
|
24
23
|
* - Threads stored as fragments in same file: /.data/chat/{id}/index.ttl#{threadId}
|
|
25
24
|
*/
|
|
26
25
|
export const chatResource = podTable('chats', {
|
|
27
|
-
id: id('id').default(
|
|
26
|
+
id: id('id').default('{key}/index.ttl#this'),
|
|
28
27
|
// Display
|
|
29
28
|
title: string('title').predicate(DCTerms.title).notNull(),
|
|
30
29
|
description: string('description').predicate(DCTerms.description),
|
|
@@ -41,13 +40,13 @@ export const chatResource = podTable('chats', {
|
|
|
41
40
|
participants: uri('participants')
|
|
42
41
|
.array()
|
|
43
42
|
.predicate(WF.participant),
|
|
44
|
-
//
|
|
43
|
+
// Opaque protocol/local/UI metadata only. Shared relations must be explicit URI fields.
|
|
45
44
|
metadata: object('metadata').predicate(UDFS.metadata),
|
|
46
45
|
// Last activity
|
|
47
46
|
lastActiveAt: timestamp('lastActiveAt').predicate(UDFS.lastActiveAt),
|
|
48
47
|
// Latest-message pointer. Do not reuse WF.message here: WF.message is the
|
|
49
48
|
// Solid Chat containment relation used by message.chat inverse links.
|
|
50
|
-
|
|
49
|
+
lastMessage: uri('lastMessage').predicate(UDFS.lastMessage),
|
|
51
50
|
lastMessagePreview: text('lastMessagePreview').predicate(SCHEMA.text),
|
|
52
51
|
// Timestamps
|
|
53
52
|
createdAt: timestamp('createdAt').predicate(DCTerms.created).notNull().defaultNow(),
|
package/dist/chat.utils.d.ts
CHANGED
|
@@ -3,7 +3,14 @@ export interface ChatThreadRef {
|
|
|
3
3
|
chatId: string | null;
|
|
4
4
|
threadId: string | null;
|
|
5
5
|
}
|
|
6
|
+
export interface ChatTargetRef {
|
|
7
|
+
chatId: string | null;
|
|
8
|
+
threadId: string | null;
|
|
9
|
+
messageId: string | null;
|
|
10
|
+
}
|
|
6
11
|
export declare function extractChatIdFromChatRef(chatRef: string | null | undefined): string | null;
|
|
12
|
+
export declare function buildChatTargetRef(chatIdOrRef: string): string;
|
|
7
13
|
export declare function extractThreadIdFromThreadRef(threadRef: string | null | undefined): string | null;
|
|
8
14
|
export declare function extractChatThreadRef(uri: string | null | undefined): ChatThreadRef;
|
|
15
|
+
export declare function extractChatTargetRef(uri: string | null | undefined): ChatTargetRef;
|
|
9
16
|
export declare function resolveThreadChatId(thread: Pick<Record<string, unknown>, 'chat'> | null | undefined): string | null;
|
package/dist/chat.utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { parsePodResourceRef } from '@undefineds.co/drizzle-solid';
|
|
2
|
-
import {
|
|
1
|
+
import { normalizePodDataResourceId, parsePodResourceRef } from '@undefineds.co/drizzle-solid';
|
|
2
|
+
import { chatResource } from './chat.schema.js';
|
|
3
3
|
export const toTimestamp = (value, fallback = 0) => {
|
|
4
4
|
if (value instanceof Date)
|
|
5
5
|
return value.getTime();
|
|
@@ -19,7 +19,11 @@ export function extractChatIdFromChatRef(chatRef) {
|
|
|
19
19
|
const direct = resourceId.match(/^([^/]+)\/index\.ttl#this$/);
|
|
20
20
|
if (direct)
|
|
21
21
|
return decodeURIComponent(direct[1]);
|
|
22
|
-
|
|
22
|
+
const chatPath = normalizePodDataResourceId(resourceId).match(/^chat\/(.+)\/index\.ttl#this$/);
|
|
23
|
+
return chatPath?.[1] ? decodeURIComponent(chatPath[1]) : null;
|
|
24
|
+
}
|
|
25
|
+
export function buildChatTargetRef(chatIdOrRef) {
|
|
26
|
+
return `/.data/chat/${chatResource.buildId({ id: extractChatIdFromChatRef(chatIdOrRef) ?? chatIdOrRef })}`;
|
|
23
27
|
}
|
|
24
28
|
export function extractThreadIdFromThreadRef(threadRef) {
|
|
25
29
|
if (!threadRef)
|
|
@@ -36,13 +40,38 @@ export function extractChatThreadRef(uri) {
|
|
|
36
40
|
return { chatId: null, threadId: null };
|
|
37
41
|
const parsed = parsePodResourceRef({ config: { base: '/.data/' } }, uri);
|
|
38
42
|
const resourceId = parsed?.resourceId ?? uri;
|
|
43
|
+
const normalized = normalizePodDataResourceId(resourceId);
|
|
44
|
+
const chatThread = normalized.match(/^chat\/(.+)\/index\.ttl#([^#/]+)$/);
|
|
39
45
|
return {
|
|
40
|
-
chatId:
|
|
41
|
-
? surfaceIdFromCommandResourceId(resourceId)
|
|
42
|
-
: null,
|
|
46
|
+
chatId: chatThread?.[1] ? decodeURIComponent(chatThread[1]) : null,
|
|
43
47
|
threadId: extractThreadIdFromThreadRef(resourceId),
|
|
44
48
|
};
|
|
45
49
|
}
|
|
50
|
+
export function extractChatTargetRef(uri) {
|
|
51
|
+
if (!uri)
|
|
52
|
+
return { chatId: null, threadId: null, messageId: null };
|
|
53
|
+
const parsed = parsePodResourceRef({ config: { base: '/.data/' } }, uri);
|
|
54
|
+
const resourceId = parsed?.resourceId ?? uri;
|
|
55
|
+
const normalized = normalizePodDataResourceId(resourceId);
|
|
56
|
+
const chatThread = normalized.match(/^chat\/(.+)\/index\.ttl#([^#/]+)$/);
|
|
57
|
+
if (chatThread?.[1]) {
|
|
58
|
+
const fragment = chatThread[2];
|
|
59
|
+
return {
|
|
60
|
+
chatId: decodeURIComponent(chatThread[1]),
|
|
61
|
+
threadId: fragment === 'this' ? null : decodeURIComponent(fragment),
|
|
62
|
+
messageId: null,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const message = normalized.match(/^chat\/(.+)\/\d{4}\/\d{2}\/\d{2}\/messages\.ttl#([^#/]+)$/);
|
|
66
|
+
if (message?.[1]) {
|
|
67
|
+
return {
|
|
68
|
+
chatId: decodeURIComponent(message[1]),
|
|
69
|
+
threadId: null,
|
|
70
|
+
messageId: message[2] ? decodeURIComponent(message[2]) : null,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return { chatId: null, threadId: null, messageId: null };
|
|
74
|
+
}
|
|
46
75
|
export function resolveThreadChatId(thread) {
|
|
47
76
|
return extractChatIdFromChatRef(typeof thread?.chat === 'string' ? thread.chat : null);
|
|
48
77
|
}
|
|
@@ -2,7 +2,7 @@ export declare const contactRepository: import("@undefineds.co/drizzle-solid/dis
|
|
|
2
2
|
id: import("@undefineds.co/drizzle-solid/dist/core/schema").PodStringColumn<false, false>;
|
|
3
3
|
name: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
|
|
4
4
|
avatarUrl: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, false, false>;
|
|
5
|
-
|
|
5
|
+
entity: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, true, false>;
|
|
6
6
|
rdfType: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"uri", null, true, true>;
|
|
7
7
|
contactType: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"string", null, true, false>;
|
|
8
8
|
isPublic: import("@undefineds.co/drizzle-solid/dist/core/schema").ColumnBuilder<"boolean", null, false, true>;
|
|
@@ -23,7 +23,7 @@ export declare const contactRepository: import("@undefineds.co/drizzle-solid/dis
|
|
|
23
23
|
id: string;
|
|
24
24
|
name: string;
|
|
25
25
|
avatarUrl: string;
|
|
26
|
-
|
|
26
|
+
entity: string;
|
|
27
27
|
rdfType: string;
|
|
28
28
|
contactType: string;
|
|
29
29
|
isPublic: boolean;
|
|
@@ -42,7 +42,7 @@ export declare const contactRepository: import("@undefineds.co/drizzle-solid/dis
|
|
|
42
42
|
lastSyncedAt: Date;
|
|
43
43
|
}, {
|
|
44
44
|
name: string;
|
|
45
|
-
|
|
45
|
+
entity: string;
|
|
46
46
|
contactType: string;
|
|
47
47
|
id?: string | undefined;
|
|
48
48
|
avatarUrl?: string | undefined;
|
|
@@ -65,7 +65,7 @@ export declare const contactRepository: import("@undefineds.co/drizzle-solid/dis
|
|
|
65
65
|
id?: string | null | undefined;
|
|
66
66
|
name?: string | undefined;
|
|
67
67
|
avatarUrl?: string | null | undefined;
|
|
68
|
-
|
|
68
|
+
entity?: string | undefined;
|
|
69
69
|
rdfType?: string | undefined;
|
|
70
70
|
contactType?: string | undefined;
|
|
71
71
|
isPublic?: boolean | null | undefined;
|
|
@@ -2,7 +2,7 @@ import { definePodRepository } from './repository.js';
|
|
|
2
2
|
import { contactResource } from './contact.schema.js';
|
|
3
3
|
export const contactRepository = definePodRepository({
|
|
4
4
|
namespace: 'contact',
|
|
5
|
-
|
|
5
|
+
resource: contactResource,
|
|
6
6
|
searchableFields: ['name', 'alias', 'note'],
|
|
7
7
|
defaultSort: { field: 'name', direction: 'asc' },
|
|
8
8
|
});
|