@treeseed/sdk 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -494
- package/dist/{src/cli-tools.d.ts → cli-tools.d.ts} +1 -1
- package/dist/cli-tools.js +5 -3
- package/dist/{src/content-store.d.ts → content-store.d.ts} +3 -2
- package/dist/content-store.js +52 -20
- package/dist/{src/d1-store.d.ts → d1-store.d.ts} +62 -1
- package/dist/d1-store.js +625 -65
- package/dist/field-aliases.d.ts +11 -0
- package/dist/field-aliases.js +41 -0
- package/dist/graph/build.d.ts +19 -0
- package/dist/graph/build.js +949 -0
- package/dist/graph/dsl.d.ts +2 -0
- package/dist/graph/dsl.js +243 -0
- package/dist/graph/query.d.ts +47 -0
- package/dist/graph/query.js +447 -0
- package/dist/graph/ranking.d.ts +3 -0
- package/dist/graph/ranking.js +483 -0
- package/dist/graph/schema.d.ts +142 -0
- package/dist/graph/schema.js +133 -0
- package/dist/graph.d.ts +52 -0
- package/dist/graph.js +133 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +90 -2
- package/dist/model-registry.d.ts +8 -0
- package/dist/model-registry.js +351 -25
- package/dist/operations/providers/default.d.ts +10 -0
- package/dist/operations/providers/default.js +514 -0
- package/dist/operations/runtime.d.ts +7 -0
- package/dist/operations/runtime.js +60 -0
- package/dist/operations/services/config-runtime.d.ts +269 -0
- package/dist/operations/services/config-runtime.js +1397 -0
- package/dist/operations/services/d1-migration.d.ts +6 -0
- package/dist/operations/services/d1-migration.js +89 -0
- package/dist/operations/services/deploy.d.ts +371 -0
- package/dist/operations/services/deploy.js +981 -0
- package/dist/operations/services/git-workflow.d.ts +49 -0
- package/dist/operations/services/git-workflow.js +218 -0
- package/dist/operations/services/github-automation.d.ts +156 -0
- package/dist/operations/services/github-automation.js +256 -0
- package/dist/operations/services/local-dev.d.ts +9 -0
- package/dist/operations/services/local-dev.js +106 -0
- package/dist/operations/services/mailpit-runtime.d.ts +4 -0
- package/dist/operations/services/mailpit-runtime.js +59 -0
- package/dist/operations/services/railway-deploy.d.ts +53 -0
- package/dist/operations/services/railway-deploy.js +123 -0
- package/dist/operations/services/runtime-paths.d.ts +19 -0
- package/dist/operations/services/runtime-paths.js +54 -0
- package/dist/operations/services/runtime-tools.d.ts +117 -0
- package/dist/operations/services/runtime-tools.js +358 -0
- package/dist/operations/services/save-deploy-preflight.d.ts +34 -0
- package/dist/operations/services/save-deploy-preflight.js +76 -0
- package/dist/operations/services/template-registry.d.ts +88 -0
- package/dist/operations/services/template-registry.js +407 -0
- package/dist/operations/services/watch-dev.d.ts +21 -0
- package/dist/operations/services/watch-dev.js +284 -0
- package/dist/operations/services/workspace-preflight.d.ts +40 -0
- package/dist/operations/services/workspace-preflight.js +165 -0
- package/dist/operations/services/workspace-save.d.ts +42 -0
- package/dist/operations/services/workspace-save.js +235 -0
- package/dist/operations/services/workspace-tools.d.ts +16 -0
- package/dist/operations/services/workspace-tools.js +270 -0
- package/dist/operations-registry.d.ts +5 -0
- package/dist/operations-registry.js +68 -0
- package/dist/operations-types.d.ts +71 -0
- package/dist/operations-types.js +17 -0
- package/dist/operations.d.ts +6 -0
- package/dist/operations.js +16 -0
- package/dist/platform/books-data.d.ts +1 -0
- package/dist/platform/books-data.js +1 -0
- package/dist/platform/contracts.d.ts +158 -0
- package/dist/platform/contracts.js +0 -0
- package/dist/platform/deploy/config.d.ts +4 -0
- package/dist/platform/deploy/config.js +222 -0
- package/dist/platform/deploy-config.d.ts +1 -0
- package/dist/platform/deploy-config.js +1 -0
- package/dist/platform/env.yaml +394 -0
- package/dist/platform/environment.d.ts +130 -0
- package/dist/platform/environment.js +331 -0
- package/dist/platform/plugin.d.ts +2 -0
- package/dist/platform/plugin.js +4 -0
- package/dist/platform/plugins/constants.d.ts +22 -0
- package/dist/platform/plugins/constants.js +29 -0
- package/dist/platform/plugins/plugin.d.ts +51 -0
- package/dist/platform/plugins/plugin.js +6 -0
- package/dist/platform/plugins/runtime.d.ts +35 -0
- package/dist/platform/plugins/runtime.js +142 -0
- package/dist/platform/plugins.d.ts +5 -0
- package/dist/platform/plugins.js +16 -0
- package/dist/platform/site-config-schema.js +1 -0
- package/dist/platform/tenant/config.d.ts +9 -0
- package/dist/platform/tenant/config.js +154 -0
- package/dist/platform/tenant/runtime-config.d.ts +4 -0
- package/dist/platform/tenant/runtime-config.js +20 -0
- package/dist/platform/tenant-config.d.ts +1 -0
- package/dist/platform/tenant-config.js +1 -0
- package/dist/platform/utils/books-data.d.ts +29 -0
- package/dist/platform/utils/books-data.js +82 -0
- package/dist/platform/utils/site-config-schema.js +321 -0
- package/dist/remote.d.ts +175 -0
- package/dist/remote.js +202 -0
- package/dist/runtime.js +50 -3
- package/dist/scripts/aggregate-book.js +121 -0
- package/dist/scripts/build-dist.js +57 -13
- package/dist/scripts/build-tenant-worker.js +36 -0
- package/dist/scripts/cleanup-markdown.js +373 -0
- package/dist/scripts/cli-test-fixtures.js +48 -0
- package/dist/scripts/config-treeseed.js +95 -0
- package/dist/scripts/ensure-mailpit.js +29 -0
- package/dist/scripts/local-dev.js +129 -0
- package/dist/scripts/logs-mailpit.js +2 -0
- package/dist/scripts/patch-starlight-content-path.js +172 -0
- package/dist/scripts/release-verify.js +34 -5
- package/dist/scripts/run-fixture-astro-command.js +18 -0
- package/dist/scripts/scaffold-site.js +65 -0
- package/dist/scripts/stop-mailpit.js +5 -0
- package/dist/scripts/sync-dev-vars.js +6 -0
- package/dist/scripts/sync-template.js +20 -0
- package/dist/scripts/template-catalog.test.js +100 -0
- package/dist/scripts/template-command.js +31 -0
- package/dist/scripts/tenant-astro-command.js +3 -0
- package/dist/scripts/tenant-build.js +16 -0
- package/dist/scripts/tenant-check.js +7 -0
- package/dist/scripts/tenant-d1-migrate-local.js +11 -0
- package/dist/scripts/tenant-deploy.js +180 -0
- package/dist/scripts/tenant-destroy.js +104 -0
- package/dist/scripts/tenant-dev.js +171 -0
- package/dist/scripts/tenant-lint.js +4 -0
- package/dist/scripts/tenant-test.js +4 -0
- package/dist/scripts/test-cloudflare-local.js +212 -0
- package/dist/scripts/test-scaffold.js +314 -0
- package/dist/scripts/test-smoke.js +71 -13
- package/dist/scripts/treeseed-assert-release-tag-version.js +21 -0
- package/dist/scripts/treeseed-build-dist.js +134 -0
- package/dist/scripts/treeseed-publish-package.js +19 -0
- package/dist/scripts/treeseed-release-verify.js +131 -0
- package/dist/scripts/treeseed-run-ts.js +45 -0
- package/dist/scripts/validate-templates.js +6 -0
- package/dist/scripts/verify-driver.js +29 -0
- package/dist/scripts/workflow-commands.test.js +39 -0
- package/dist/scripts/workspace-close.js +24 -0
- package/dist/scripts/workspace-command-e2e.js +718 -0
- package/dist/scripts/workspace-lint.js +9 -0
- package/dist/scripts/workspace-preflight.js +22 -0
- package/dist/scripts/workspace-publish-changed-packages.js +16 -0
- package/dist/scripts/workspace-release-verify.js +81 -0
- package/dist/scripts/workspace-release.js +42 -0
- package/dist/scripts/workspace-save.js +124 -0
- package/dist/scripts/workspace-start-warning.js +3 -0
- package/dist/scripts/workspace-start.js +71 -0
- package/dist/scripts/workspace-test-unit.js +4 -0
- package/dist/scripts/workspace-test.js +11 -0
- package/dist/sdk-fields.d.ts +11 -0
- package/dist/sdk-fields.js +169 -0
- package/dist/sdk-filters.d.ts +4 -0
- package/dist/sdk-filters.js +12 -15
- package/dist/sdk-types.d.ts +796 -0
- package/dist/sdk-types.js +7 -1
- package/dist/sdk-version.d.ts +2 -0
- package/dist/sdk-version.js +42 -0
- package/dist/sdk.d.ts +215 -0
- package/dist/sdk.js +235 -11
- package/dist/stores/cursor-store.js +9 -3
- package/dist/stores/lease-store.js +8 -2
- package/dist/{src/stores → stores}/message-store.d.ts +1 -1
- package/dist/stores/message-store.js +27 -3
- package/dist/stores/operational-store.d.ts +24 -0
- package/dist/stores/operational-store.js +279 -0
- package/dist/stores/run-store.js +8 -1
- package/dist/stores/subscription-store.js +7 -5
- package/dist/template-catalog.d.ts +13 -0
- package/dist/template-catalog.js +141 -0
- package/dist/treeseed/services/compose.yml +7 -0
- package/dist/treeseed/template-catalog/catalog.fixture.json +55 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/astro.config.d.ts +2 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/astro.config.ts +3 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/package.json +32 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/config.yaml +40 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content/empty/.gitkeep +1 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content/knowledge/handbook/index.mdx +11 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content/pages/welcome.mdx +11 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content.config.d.ts +1 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content.config.ts +3 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/env.yaml +1 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/manifest.yaml +19 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/treeseed.site.yaml +26 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/tsconfig.json +9 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template.config.json +90 -0
- package/dist/verification.d.ts +20 -0
- package/dist/verification.js +98 -0
- package/dist/workflow/operations.d.ts +396 -0
- package/dist/workflow/operations.js +841 -0
- package/dist/workflow-state.d.ts +56 -0
- package/dist/workflow-state.js +195 -0
- package/dist/workflow-support.d.ts +9 -0
- package/dist/workflow-support.js +176 -0
- package/dist/workflow.d.ts +111 -0
- package/dist/workflow.js +97 -0
- package/package.json +97 -5
- package/scripts/verify-driver.mjs +29 -0
- package/dist/scripts/.ts-run-1775616845195-odh4xzphk3l.js +0 -22
- package/dist/scripts/.ts-run-1775616848931-9386s6kwrl.js +0 -126
- package/dist/scripts/assert-release-tag-version.d.ts +0 -1
- package/dist/scripts/build-dist.d.ts +0 -1
- package/dist/scripts/package-tools.d.ts +0 -15
- package/dist/scripts/publish-package.d.ts +0 -1
- package/dist/scripts/release-verify.d.ts +0 -1
- package/dist/scripts/test-smoke.d.ts +0 -1
- package/dist/src/index.d.ts +0 -6
- package/dist/src/model-registry.d.ts +0 -4
- package/dist/src/sdk-filters.d.ts +0 -4
- package/dist/src/sdk-types.d.ts +0 -285
- package/dist/src/sdk.d.ts +0 -109
- package/dist/test/test-fixture.d.ts +0 -1
- package/dist/test/utils/envelopes.test.d.ts +0 -1
- package/dist/test/utils/sdk.test.d.ts +0 -1
- package/dist/vitest.config.d.ts +0 -2
- /package/dist/{src/frontmatter.d.ts → frontmatter.d.ts} +0 -0
- /package/dist/{src/git-runtime.d.ts → git-runtime.d.ts} +0 -0
- /package/dist/{src/runtime.d.ts → runtime.d.ts} +0 -0
- /package/dist/{src/stores → stores}/cursor-store.d.ts +0 -0
- /package/dist/{src/stores → stores}/envelopes.d.ts +0 -0
- /package/dist/{src/stores → stores}/helpers.d.ts +0 -0
- /package/dist/{src/stores → stores}/lease-store.d.ts +0 -0
- /package/dist/{src/stores → stores}/run-store.d.ts +0 -0
- /package/dist/{src/stores → stores}/subscription-store.d.ts +0 -0
- /package/dist/{src/types → types}/agents.d.ts +0 -0
- /package/dist/{src/types → types}/cloudflare.d.ts +0 -0
- /package/dist/{src/wrangler-d1.d.ts → wrangler-d1.d.ts} +0 -0
package/dist/model-registry.js
CHANGED
|
@@ -1,19 +1,52 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { resolveSdkRepoRoot } from "./runtime.js";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { validateModelFieldAliases } from "./sdk-fields.js";
|
|
4
|
+
function contentRoot(repoRoot) {
|
|
5
|
+
return process.env.TREESEED_AGENT_CONTENT_ROOT ? path.resolve(process.env.TREESEED_AGENT_CONTENT_ROOT) : path.resolve(resolveSdkRepoRoot(repoRoot), "src", "content");
|
|
5
6
|
}
|
|
6
|
-
function
|
|
7
|
-
|
|
7
|
+
function field(key, options = {}) {
|
|
8
|
+
return { key, ...options };
|
|
9
|
+
}
|
|
10
|
+
function deriveFieldLists(fields) {
|
|
11
|
+
const entries = Object.entries(fields);
|
|
12
|
+
return {
|
|
13
|
+
filterableFields: entries.filter(([, binding]) => binding.filterable).map(([key]) => key),
|
|
14
|
+
sortableFields: entries.filter(([, binding]) => binding.sortable).map(([key]) => key)
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function graph(config) {
|
|
18
|
+
return config;
|
|
19
|
+
}
|
|
20
|
+
function buildBuiltinModelRegistry(repoRoot) {
|
|
21
|
+
const root = contentRoot(repoRoot);
|
|
8
22
|
return {
|
|
9
23
|
page: {
|
|
10
24
|
name: "page",
|
|
11
25
|
aliases: ["pages"],
|
|
12
26
|
storage: "content",
|
|
13
27
|
operations: ["get", "read", "search", "follow", "pick", "create", "update"],
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
28
|
+
graph: graph({
|
|
29
|
+
entityType: "Page",
|
|
30
|
+
titleField: "title",
|
|
31
|
+
enableSections: true
|
|
32
|
+
}),
|
|
33
|
+
fields: {
|
|
34
|
+
title: field("title", { filterable: true, sortable: true, contentKeys: ["title"], writeContentKey: "title" }),
|
|
35
|
+
slug: field("slug", { filterable: true, contentKeys: ["slug"], writeContentKey: "slug" }),
|
|
36
|
+
status: field("status", { filterable: true, contentKeys: ["status"], writeContentKey: "status" }),
|
|
37
|
+
audience: field("audience", { filterable: true, comparableAs: "string_array", contentKeys: ["audience"], writeContentKey: "audience" }),
|
|
38
|
+
updated_at: field("updated_at", { aliases: ["updated", "updatedAt"], filterable: true, sortable: true, comparableAs: "date", contentKeys: ["updated_at", "updated", "updatedAt"], writeContentKey: "updated_at" }),
|
|
39
|
+
created_at: field("created_at", { aliases: ["createdAt"], comparableAs: "date", contentKeys: ["created_at", "createdAt", "date"], writeContentKey: "created_at" })
|
|
40
|
+
},
|
|
41
|
+
...deriveFieldLists({
|
|
42
|
+
title: field("title", { filterable: true, sortable: true, contentKeys: ["title"], writeContentKey: "title" }),
|
|
43
|
+
slug: field("slug", { filterable: true, contentKeys: ["slug"], writeContentKey: "slug" }),
|
|
44
|
+
status: field("status", { filterable: true, contentKeys: ["status"], writeContentKey: "status" }),
|
|
45
|
+
audience: field("audience", { filterable: true, comparableAs: "string_array", contentKeys: ["audience"], writeContentKey: "audience" }),
|
|
46
|
+
updated_at: field("updated_at", { aliases: ["updated", "updatedAt"], filterable: true, sortable: true, comparableAs: "date", contentKeys: ["updated_at", "updated", "updatedAt"], writeContentKey: "updated_at" }),
|
|
47
|
+
created_at: field("created_at", { aliases: ["createdAt"], comparableAs: "date", contentKeys: ["created_at", "createdAt", "date"], writeContentKey: "created_at" })
|
|
48
|
+
}),
|
|
49
|
+
pickField: "updated_at",
|
|
17
50
|
contentCollection: "pages",
|
|
18
51
|
contentDir: path.join(root, "pages")
|
|
19
52
|
},
|
|
@@ -22,8 +55,22 @@ function buildModelRegistry() {
|
|
|
22
55
|
aliases: ["notes"],
|
|
23
56
|
storage: "content",
|
|
24
57
|
operations: ["get", "read", "search", "follow", "pick", "create", "update"],
|
|
25
|
-
|
|
26
|
-
|
|
58
|
+
graph: graph({
|
|
59
|
+
entityType: "Note",
|
|
60
|
+
titleField: "title",
|
|
61
|
+
tagField: "tags",
|
|
62
|
+
enableSections: true
|
|
63
|
+
}),
|
|
64
|
+
fields: {
|
|
65
|
+
title: field("title", { filterable: true, sortable: true, contentKeys: ["title"], writeContentKey: "title" }),
|
|
66
|
+
status: field("status", { filterable: true, contentKeys: ["status"], writeContentKey: "status" }),
|
|
67
|
+
author: field("author", { filterable: true, contentKeys: ["author"], writeContentKey: "author" }),
|
|
68
|
+
tags: field("tags", { filterable: true, comparableAs: "string_array", contentKeys: ["tags"], writeContentKey: "tags" }),
|
|
69
|
+
date: field("date", { filterable: true, sortable: true, comparableAs: "date", contentKeys: ["date"], writeContentKey: "date" }),
|
|
70
|
+
updated_at: field("updated_at", { aliases: ["updated", "updatedAt"], sortable: true, filterable: true, comparableAs: "date", contentKeys: ["updated_at", "updated", "updatedAt"], writeContentKey: "updated_at" })
|
|
71
|
+
},
|
|
72
|
+
filterableFields: ["title", "status", "author", "tags", "date", "updated_at"],
|
|
73
|
+
sortableFields: ["title", "date", "updated_at"],
|
|
27
74
|
pickField: "date",
|
|
28
75
|
contentCollection: "notes",
|
|
29
76
|
contentDir: path.join(root, "notes")
|
|
@@ -33,8 +80,29 @@ function buildModelRegistry() {
|
|
|
33
80
|
aliases: ["questions"],
|
|
34
81
|
storage: "content",
|
|
35
82
|
operations: ["get", "read", "search", "follow", "pick", "create", "update"],
|
|
36
|
-
|
|
37
|
-
|
|
83
|
+
graph: graph({
|
|
84
|
+
entityType: "Question",
|
|
85
|
+
titleField: "title",
|
|
86
|
+
tagField: "tags",
|
|
87
|
+
enableSections: true,
|
|
88
|
+
referenceFields: [
|
|
89
|
+
{ field: "related_objectives", edgeType: "REFERENCES", targetModels: ["objective"], multiple: true },
|
|
90
|
+
{ field: "related_books", edgeType: "REFERENCES", targetModels: ["book"], multiple: true },
|
|
91
|
+
{ field: "primary_contributor", edgeType: "REFERENCES", targetModels: ["person", "agent"] }
|
|
92
|
+
]
|
|
93
|
+
}),
|
|
94
|
+
fields: {
|
|
95
|
+
title: field("title", { filterable: true, sortable: true, contentKeys: ["title"], writeContentKey: "title" }),
|
|
96
|
+
status: field("status", { filterable: true, contentKeys: ["status"], writeContentKey: "status" }),
|
|
97
|
+
tags: field("tags", { filterable: true, comparableAs: "string_array", contentKeys: ["tags"], writeContentKey: "tags" }),
|
|
98
|
+
date: field("date", { filterable: true, sortable: true, comparableAs: "date", contentKeys: ["date"], writeContentKey: "date" }),
|
|
99
|
+
question_type: field("question_type", { aliases: ["questionType"], filterable: true, contentKeys: ["question_type", "questionType"], writeContentKey: "question_type" }),
|
|
100
|
+
related_objectives: field("related_objectives", { aliases: ["relatedObjectives"], filterable: true, comparableAs: "string_array", contentKeys: ["related_objectives", "relatedObjectives"], writeContentKey: "related_objectives" }),
|
|
101
|
+
related_books: field("related_books", { aliases: ["relatedBooks"], filterable: true, comparableAs: "string_array", contentKeys: ["related_books", "relatedBooks"], writeContentKey: "related_books" }),
|
|
102
|
+
updated_at: field("updated_at", { aliases: ["updated", "updatedAt"], sortable: true, comparableAs: "date", contentKeys: ["updated_at", "updated", "updatedAt"], writeContentKey: "updated_at" })
|
|
103
|
+
},
|
|
104
|
+
filterableFields: ["title", "status", "tags", "date", "question_type", "related_objectives", "related_books"],
|
|
105
|
+
sortableFields: ["title", "date", "updated_at"],
|
|
38
106
|
pickField: "date",
|
|
39
107
|
contentCollection: "questions",
|
|
40
108
|
contentDir: path.join(root, "questions")
|
|
@@ -44,8 +112,22 @@ function buildModelRegistry() {
|
|
|
44
112
|
aliases: ["books"],
|
|
45
113
|
storage: "content",
|
|
46
114
|
operations: ["get", "read", "search", "follow", "pick", "create", "update"],
|
|
47
|
-
|
|
48
|
-
|
|
115
|
+
graph: graph({
|
|
116
|
+
entityType: "Book",
|
|
117
|
+
titleField: "title",
|
|
118
|
+
tagField: "tags",
|
|
119
|
+
enableSections: true
|
|
120
|
+
}),
|
|
121
|
+
fields: {
|
|
122
|
+
title: field("title", { filterable: true, sortable: true, contentKeys: ["title"], writeContentKey: "title" }),
|
|
123
|
+
slug: field("slug", { filterable: true, contentKeys: ["slug"], writeContentKey: "slug" }),
|
|
124
|
+
tags: field("tags", { filterable: true, comparableAs: "string_array", contentKeys: ["tags"], writeContentKey: "tags" }),
|
|
125
|
+
section_label: field("section_label", { aliases: ["sectionLabel"], filterable: true, contentKeys: ["section_label", "sectionLabel"], writeContentKey: "section_label" }),
|
|
126
|
+
order: field("order", { sortable: true, comparableAs: "number", contentKeys: ["order"], writeContentKey: "order" }),
|
|
127
|
+
updated_at: field("updated_at", { aliases: ["updated", "updatedAt"], sortable: true, comparableAs: "date", contentKeys: ["updated_at", "updated", "updatedAt"], writeContentKey: "updated_at" })
|
|
128
|
+
},
|
|
129
|
+
filterableFields: ["title", "slug", "tags", "section_label"],
|
|
130
|
+
sortableFields: ["title", "order", "updated_at"],
|
|
49
131
|
pickField: "order",
|
|
50
132
|
contentCollection: "books",
|
|
51
133
|
contentDir: path.join(root, "books")
|
|
@@ -55,9 +137,21 @@ function buildModelRegistry() {
|
|
|
55
137
|
aliases: ["knowledge-base", "docs"],
|
|
56
138
|
storage: "content",
|
|
57
139
|
operations: ["get", "read", "search", "follow", "pick", "create", "update"],
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
140
|
+
graph: graph({
|
|
141
|
+
entityType: "Knowledge",
|
|
142
|
+
titleField: "title",
|
|
143
|
+
tagField: "tags",
|
|
144
|
+
enableSections: true
|
|
145
|
+
}),
|
|
146
|
+
fields: {
|
|
147
|
+
title: field("title", { filterable: true, sortable: true, contentKeys: ["title"], writeContentKey: "title" }),
|
|
148
|
+
tags: field("tags", { filterable: true, comparableAs: "string_array", contentKeys: ["tags"], writeContentKey: "tags" }),
|
|
149
|
+
updated_at: field("updated_at", { aliases: ["updated", "updatedAt"], filterable: true, sortable: true, comparableAs: "date", contentKeys: ["updated_at", "updated", "updatedAt"], writeContentKey: "updated_at" }),
|
|
150
|
+
slug: field("slug", { filterable: true, contentKeys: ["slug"], writeContentKey: "slug" })
|
|
151
|
+
},
|
|
152
|
+
filterableFields: ["title", "tags", "updated_at", "slug"],
|
|
153
|
+
sortableFields: ["title", "updated_at"],
|
|
154
|
+
pickField: "updated_at",
|
|
61
155
|
contentCollection: "docs",
|
|
62
156
|
contentDir: path.join(root, "knowledge")
|
|
63
157
|
},
|
|
@@ -66,8 +160,29 @@ function buildModelRegistry() {
|
|
|
66
160
|
aliases: ["objectives"],
|
|
67
161
|
storage: "content",
|
|
68
162
|
operations: ["get", "read", "search", "follow", "pick", "create", "update"],
|
|
69
|
-
|
|
70
|
-
|
|
163
|
+
graph: graph({
|
|
164
|
+
entityType: "Objective",
|
|
165
|
+
titleField: "title",
|
|
166
|
+
tagField: "tags",
|
|
167
|
+
enableSections: true,
|
|
168
|
+
referenceFields: [
|
|
169
|
+
{ field: "related_questions", edgeType: "REFERENCES", targetModels: ["question"], multiple: true },
|
|
170
|
+
{ field: "related_books", edgeType: "REFERENCES", targetModels: ["book"], multiple: true },
|
|
171
|
+
{ field: "primary_contributor", edgeType: "REFERENCES", targetModels: ["person", "agent"] }
|
|
172
|
+
]
|
|
173
|
+
}),
|
|
174
|
+
fields: {
|
|
175
|
+
title: field("title", { filterable: true, sortable: true, contentKeys: ["title"], writeContentKey: "title" }),
|
|
176
|
+
status: field("status", { filterable: true, contentKeys: ["status"], writeContentKey: "status" }),
|
|
177
|
+
tags: field("tags", { filterable: true, comparableAs: "string_array", contentKeys: ["tags"], writeContentKey: "tags" }),
|
|
178
|
+
date: field("date", { filterable: true, sortable: true, comparableAs: "date", contentKeys: ["date"], writeContentKey: "date" }),
|
|
179
|
+
time_horizon: field("time_horizon", { aliases: ["timeHorizon"], filterable: true, contentKeys: ["time_horizon", "timeHorizon"], writeContentKey: "time_horizon" }),
|
|
180
|
+
related_questions: field("related_questions", { aliases: ["relatedQuestions"], filterable: true, comparableAs: "string_array", contentKeys: ["related_questions", "relatedQuestions"], writeContentKey: "related_questions" }),
|
|
181
|
+
related_books: field("related_books", { aliases: ["relatedBooks"], filterable: true, comparableAs: "string_array", contentKeys: ["related_books", "relatedBooks"], writeContentKey: "related_books" }),
|
|
182
|
+
updated_at: field("updated_at", { aliases: ["updated", "updatedAt"], sortable: true, comparableAs: "date", contentKeys: ["updated_at", "updated", "updatedAt"], writeContentKey: "updated_at" })
|
|
183
|
+
},
|
|
184
|
+
filterableFields: ["title", "status", "tags", "date", "time_horizon", "related_questions", "related_books"],
|
|
185
|
+
sortableFields: ["title", "date", "updated_at"],
|
|
71
186
|
pickField: "date",
|
|
72
187
|
contentCollection: "objectives",
|
|
73
188
|
contentDir: path.join(root, "objectives")
|
|
@@ -77,9 +192,27 @@ function buildModelRegistry() {
|
|
|
77
192
|
aliases: ["people", "persons"],
|
|
78
193
|
storage: "content",
|
|
79
194
|
operations: ["get", "read", "search", "follow", "pick", "create", "update"],
|
|
195
|
+
graph: graph({
|
|
196
|
+
entityType: "Person",
|
|
197
|
+
titleField: "name",
|
|
198
|
+
tagField: "tags",
|
|
199
|
+
enableSections: true,
|
|
200
|
+
referenceFields: [
|
|
201
|
+
{ field: "related_questions", edgeType: "REFERENCES", targetModels: ["question"], multiple: true },
|
|
202
|
+
{ field: "related_objectives", edgeType: "REFERENCES", targetModels: ["objective"], multiple: true }
|
|
203
|
+
]
|
|
204
|
+
}),
|
|
205
|
+
fields: {
|
|
206
|
+
name: field("name", { filterable: true, sortable: true, contentKeys: ["name"], writeContentKey: "name" }),
|
|
207
|
+
role: field("role", { filterable: true, contentKeys: ["role"], writeContentKey: "role" }),
|
|
208
|
+
affiliation: field("affiliation", { filterable: true, contentKeys: ["affiliation"], writeContentKey: "affiliation" }),
|
|
209
|
+
status: field("status", { filterable: true, contentKeys: ["status"], writeContentKey: "status" }),
|
|
210
|
+
tags: field("tags", { filterable: true, comparableAs: "string_array", contentKeys: ["tags"], writeContentKey: "tags" }),
|
|
211
|
+
updated_at: field("updated_at", { aliases: ["updated", "updatedAt"], sortable: true, comparableAs: "date", contentKeys: ["updated_at", "updated", "updatedAt"], writeContentKey: "updated_at" })
|
|
212
|
+
},
|
|
80
213
|
filterableFields: ["name", "role", "affiliation", "status", "tags"],
|
|
81
|
-
sortableFields: ["name", "
|
|
82
|
-
pickField: "
|
|
214
|
+
sortableFields: ["name", "updated_at"],
|
|
215
|
+
pickField: "updated_at",
|
|
83
216
|
contentCollection: "people",
|
|
84
217
|
contentDir: path.join(root, "people")
|
|
85
218
|
},
|
|
@@ -88,6 +221,13 @@ function buildModelRegistry() {
|
|
|
88
221
|
aliases: ["subscriptions", "subscriber", "subscribers"],
|
|
89
222
|
storage: "d1",
|
|
90
223
|
operations: ["get", "read", "search", "follow", "pick", "create", "update"],
|
|
224
|
+
fields: {
|
|
225
|
+
email: field("email", { filterable: true, sortable: true, dbColumns: ["email", "lookup_key"], writeDbColumn: "email" }),
|
|
226
|
+
status: field("status", { filterable: true, dbColumns: ["status"], writeDbColumn: "status" }),
|
|
227
|
+
source: field("source", { filterable: true, dbColumns: ["source"], payloadPaths: ["$.source"], writeDbColumn: "source" }),
|
|
228
|
+
created_at: field("created_at", { aliases: ["createdAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["created_at"], writeDbColumn: "created_at" }),
|
|
229
|
+
updated_at: field("updated_at", { aliases: ["updatedAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["updated_at"], writeDbColumn: "updated_at" })
|
|
230
|
+
},
|
|
91
231
|
filterableFields: ["email", "status", "source", "created_at", "updated_at"],
|
|
92
232
|
sortableFields: ["email", "created_at", "updated_at"],
|
|
93
233
|
pickField: "updated_at"
|
|
@@ -97,18 +237,138 @@ function buildModelRegistry() {
|
|
|
97
237
|
aliases: ["messages"],
|
|
98
238
|
storage: "d1",
|
|
99
239
|
operations: ["get", "read", "search", "follow", "pick", "create", "update"],
|
|
240
|
+
fields: {
|
|
241
|
+
type: field("type", { filterable: true, dbColumns: ["type", "message_type"], writeDbColumn: "type" }),
|
|
242
|
+
status: field("status", { filterable: true, dbColumns: ["status"], writeDbColumn: "status" }),
|
|
243
|
+
related_model: field("related_model", { aliases: ["relatedModel"], filterable: true, dbColumns: ["related_model"], writeDbColumn: "related_model" }),
|
|
244
|
+
related_id: field("related_id", { aliases: ["relatedId"], filterable: true, dbColumns: ["related_id"], writeDbColumn: "related_id" }),
|
|
245
|
+
priority: field("priority", { filterable: true, sortable: true, comparableAs: "number", dbColumns: ["priority"], writeDbColumn: "priority" }),
|
|
246
|
+
available_at: field("available_at", { aliases: ["availableAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["available_at"], writeDbColumn: "available_at" }),
|
|
247
|
+
created_at: field("created_at", { aliases: ["createdAt"], sortable: true, comparableAs: "date", dbColumns: ["created_at"], writeDbColumn: "created_at" }),
|
|
248
|
+
updated_at: field("updated_at", { aliases: ["updatedAt"], sortable: true, comparableAs: "date", dbColumns: ["updated_at"], writeDbColumn: "updated_at" })
|
|
249
|
+
},
|
|
100
250
|
filterableFields: ["type", "status", "related_model", "related_id", "priority", "available_at"],
|
|
101
251
|
sortableFields: ["priority", "available_at", "created_at", "updated_at"],
|
|
102
252
|
pickField: "available_at"
|
|
103
253
|
},
|
|
254
|
+
work_day: {
|
|
255
|
+
name: "work_day",
|
|
256
|
+
aliases: ["work_days", "workday"],
|
|
257
|
+
storage: "d1",
|
|
258
|
+
operations: ["get", "read", "search", "create", "update"],
|
|
259
|
+
fields: {
|
|
260
|
+
project_id: field("project_id", { aliases: ["projectId"], filterable: true, dbColumns: ["project_id"], writeDbColumn: "project_id" }),
|
|
261
|
+
state: field("state", { filterable: true, dbColumns: ["state"], writeDbColumn: "state" }),
|
|
262
|
+
started_at: field("started_at", { aliases: ["startedAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["started_at"], writeDbColumn: "started_at" }),
|
|
263
|
+
updated_at: field("updated_at", { aliases: ["updatedAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["updated_at"], writeDbColumn: "updated_at" })
|
|
264
|
+
},
|
|
265
|
+
filterableFields: ["project_id", "state", "started_at", "updated_at"],
|
|
266
|
+
sortableFields: ["started_at", "updated_at"],
|
|
267
|
+
pickField: "updated_at"
|
|
268
|
+
},
|
|
269
|
+
task: {
|
|
270
|
+
name: "task",
|
|
271
|
+
aliases: ["tasks"],
|
|
272
|
+
storage: "d1",
|
|
273
|
+
operations: ["get", "read", "search", "pick", "create", "update"],
|
|
274
|
+
fields: {
|
|
275
|
+
work_day_id: field("work_day_id", { aliases: ["workDayId"], filterable: true, dbColumns: ["work_day_id"], writeDbColumn: "work_day_id" }),
|
|
276
|
+
agent_id: field("agent_id", { aliases: ["agentId"], filterable: true, dbColumns: ["agent_id"], writeDbColumn: "agent_id" }),
|
|
277
|
+
type: field("type", { filterable: true, dbColumns: ["type"], writeDbColumn: "type" }),
|
|
278
|
+
state: field("state", { filterable: true, dbColumns: ["state"], writeDbColumn: "state" }),
|
|
279
|
+
priority: field("priority", { filterable: true, sortable: true, comparableAs: "number", dbColumns: ["priority"], writeDbColumn: "priority" }),
|
|
280
|
+
idempotency_key: field("idempotency_key", { aliases: ["idempotencyKey"], filterable: true, dbColumns: ["idempotency_key"], writeDbColumn: "idempotency_key" }),
|
|
281
|
+
available_at: field("available_at", { aliases: ["availableAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["available_at"], writeDbColumn: "available_at" }),
|
|
282
|
+
updated_at: field("updated_at", { aliases: ["updatedAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["updated_at"], writeDbColumn: "updated_at" })
|
|
283
|
+
},
|
|
284
|
+
filterableFields: ["work_day_id", "agent_id", "type", "state", "priority", "idempotency_key", "available_at", "updated_at"],
|
|
285
|
+
sortableFields: ["priority", "available_at", "updated_at"],
|
|
286
|
+
pickField: "available_at"
|
|
287
|
+
},
|
|
288
|
+
task_event: {
|
|
289
|
+
name: "task_event",
|
|
290
|
+
aliases: ["task_events"],
|
|
291
|
+
storage: "d1",
|
|
292
|
+
operations: ["get", "read", "search", "create"],
|
|
293
|
+
fields: {
|
|
294
|
+
task_id: field("task_id", { aliases: ["taskId"], filterable: true, dbColumns: ["task_id"], writeDbColumn: "task_id" }),
|
|
295
|
+
kind: field("kind", { filterable: true, dbColumns: ["kind"], writeDbColumn: "kind" }),
|
|
296
|
+
seq: field("seq", { filterable: true, sortable: true, comparableAs: "number", dbColumns: ["seq"], writeDbColumn: "seq" }),
|
|
297
|
+
created_at: field("created_at", { aliases: ["createdAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["created_at"], writeDbColumn: "created_at" })
|
|
298
|
+
},
|
|
299
|
+
filterableFields: ["task_id", "kind", "seq", "created_at"],
|
|
300
|
+
sortableFields: ["seq", "created_at"],
|
|
301
|
+
pickField: "created_at"
|
|
302
|
+
},
|
|
303
|
+
task_output: {
|
|
304
|
+
name: "task_output",
|
|
305
|
+
aliases: ["task_outputs"],
|
|
306
|
+
storage: "d1",
|
|
307
|
+
operations: ["get", "read", "search", "create"],
|
|
308
|
+
fields: {
|
|
309
|
+
task_id: field("task_id", { aliases: ["taskId"], filterable: true, dbColumns: ["task_id"], writeDbColumn: "task_id" }),
|
|
310
|
+
created_at: field("created_at", { aliases: ["createdAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["created_at"], writeDbColumn: "created_at" })
|
|
311
|
+
},
|
|
312
|
+
filterableFields: ["task_id", "created_at"],
|
|
313
|
+
sortableFields: ["created_at"],
|
|
314
|
+
pickField: "created_at"
|
|
315
|
+
},
|
|
316
|
+
graph_run: {
|
|
317
|
+
name: "graph_run",
|
|
318
|
+
aliases: ["graph_runs"],
|
|
319
|
+
storage: "d1",
|
|
320
|
+
operations: ["get", "read", "search", "create"],
|
|
321
|
+
fields: {
|
|
322
|
+
work_day_id: field("work_day_id", { aliases: ["workDayId"], filterable: true, dbColumns: ["work_day_id"], writeDbColumn: "work_day_id" }),
|
|
323
|
+
graph_version: field("graph_version", { aliases: ["graphVersion"], filterable: true, sortable: true, dbColumns: ["graph_version"], writeDbColumn: "graph_version" }),
|
|
324
|
+
created_at: field("created_at", { aliases: ["createdAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["created_at"], writeDbColumn: "created_at" })
|
|
325
|
+
},
|
|
326
|
+
filterableFields: ["work_day_id", "graph_version", "created_at"],
|
|
327
|
+
sortableFields: ["created_at"],
|
|
328
|
+
pickField: "created_at"
|
|
329
|
+
},
|
|
330
|
+
report: {
|
|
331
|
+
name: "report",
|
|
332
|
+
aliases: ["reports"],
|
|
333
|
+
storage: "d1",
|
|
334
|
+
operations: ["get", "read", "search", "create", "update"],
|
|
335
|
+
fields: {
|
|
336
|
+
work_day_id: field("work_day_id", { aliases: ["workDayId"], filterable: true, dbColumns: ["work_day_id"], writeDbColumn: "work_day_id" }),
|
|
337
|
+
kind: field("kind", { filterable: true, dbColumns: ["kind"], writeDbColumn: "kind" }),
|
|
338
|
+
sent_at: field("sent_at", { aliases: ["sentAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["sent_at"], writeDbColumn: "sent_at" }),
|
|
339
|
+
created_at: field("created_at", { aliases: ["createdAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["created_at"], writeDbColumn: "created_at" })
|
|
340
|
+
},
|
|
341
|
+
filterableFields: ["work_day_id", "kind", "sent_at", "created_at"],
|
|
342
|
+
sortableFields: ["sent_at", "created_at"],
|
|
343
|
+
pickField: "created_at"
|
|
344
|
+
},
|
|
104
345
|
agent: {
|
|
105
346
|
name: "agent",
|
|
106
347
|
aliases: ["agents"],
|
|
107
348
|
storage: "content",
|
|
108
349
|
operations: ["get", "read", "search", "follow", "pick", "create", "update"],
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
350
|
+
graph: graph({
|
|
351
|
+
entityType: "Agent",
|
|
352
|
+
titleField: "name",
|
|
353
|
+
tagField: "tags",
|
|
354
|
+
enableSections: true,
|
|
355
|
+
referenceFields: [
|
|
356
|
+
{ field: "related_questions", edgeType: "REFERENCES", targetModels: ["question"], multiple: true },
|
|
357
|
+
{ field: "related_objectives", edgeType: "REFERENCES", targetModels: ["objective"], multiple: true }
|
|
358
|
+
]
|
|
359
|
+
}),
|
|
360
|
+
fields: {
|
|
361
|
+
name: field("name", { sortable: true, contentKeys: ["name"], writeContentKey: "name" }),
|
|
362
|
+
slug: field("slug", { filterable: true, sortable: true, contentKeys: ["slug"], writeContentKey: "slug" }),
|
|
363
|
+
runtime_status: field("runtime_status", { aliases: ["runtimeStatus"], filterable: true, contentKeys: ["runtime_status", "runtimeStatus"], writeContentKey: "runtime_status" }),
|
|
364
|
+
tags: field("tags", { filterable: true, comparableAs: "string_array", contentKeys: ["tags"], writeContentKey: "tags" }),
|
|
365
|
+
operator: field("operator", { filterable: true, contentKeys: ["operator"], writeContentKey: "operator" }),
|
|
366
|
+
updated_at: field("updated_at", { aliases: ["updated", "updatedAt"], sortable: true, comparableAs: "date", contentKeys: ["updated_at", "updated", "updatedAt"], writeContentKey: "updated_at" }),
|
|
367
|
+
enabled: field("enabled", { aliases: ["is_enabled"], filterable: true, comparableAs: "boolean", contentKeys: ["enabled", "is_enabled"], writeContentKey: "enabled" })
|
|
368
|
+
},
|
|
369
|
+
filterableFields: ["slug", "runtime_status", "tags", "operator", "enabled"],
|
|
370
|
+
sortableFields: ["name", "slug", "updated_at"],
|
|
371
|
+
pickField: "updated_at",
|
|
112
372
|
contentCollection: "agents",
|
|
113
373
|
contentDir: path.join(root, "agents")
|
|
114
374
|
},
|
|
@@ -117,6 +377,13 @@ function buildModelRegistry() {
|
|
|
117
377
|
aliases: ["agent_runs", "run", "runs"],
|
|
118
378
|
storage: "d1",
|
|
119
379
|
operations: ["get", "read", "search", "follow", "create", "update"],
|
|
380
|
+
fields: {
|
|
381
|
+
run_id: field("run_id", { aliases: ["runId"], filterable: true, dbColumns: ["run_id", "record_key"], writeDbColumn: "run_id" }),
|
|
382
|
+
agent_slug: field("agent_slug", { aliases: ["agentSlug"], filterable: true, dbColumns: ["agent_slug", "lookup_key"], writeDbColumn: "agent_slug" }),
|
|
383
|
+
status: field("status", { filterable: true, dbColumns: ["status"], writeDbColumn: "status" }),
|
|
384
|
+
started_at: field("started_at", { aliases: ["startedAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["started_at", "created_at"], writeDbColumn: "started_at" }),
|
|
385
|
+
finished_at: field("finished_at", { aliases: ["finishedAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["finished_at"], payloadPaths: ["$.finishedAt"], writeDbColumn: "finished_at" })
|
|
386
|
+
},
|
|
120
387
|
filterableFields: ["run_id", "agent_slug", "status", "started_at", "finished_at"],
|
|
121
388
|
sortableFields: ["started_at", "finished_at"],
|
|
122
389
|
pickField: "started_at"
|
|
@@ -126,6 +393,12 @@ function buildModelRegistry() {
|
|
|
126
393
|
aliases: ["agent_cursors", "cursor", "cursors"],
|
|
127
394
|
storage: "d1",
|
|
128
395
|
operations: ["get", "read", "search", "follow", "create", "update"],
|
|
396
|
+
fields: {
|
|
397
|
+
agent_slug: field("agent_slug", { aliases: ["agentSlug"], filterable: true, sortable: true, dbColumns: ["agent_slug"], writeDbColumn: "agent_slug" }),
|
|
398
|
+
cursor_key: field("cursor_key", { aliases: ["cursorKey"], filterable: true, sortable: true, dbColumns: ["cursor_key"], writeDbColumn: "cursor_key" }),
|
|
399
|
+
cursor_value: field("cursor_value", { aliases: ["cursorValue"], filterable: true, dbColumns: ["cursor_value"], payloadPaths: ["$.cursorValue"], writeDbColumn: "cursor_value" }),
|
|
400
|
+
updated_at: field("updated_at", { aliases: ["updatedAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["updated_at"], writeDbColumn: "updated_at" })
|
|
401
|
+
},
|
|
129
402
|
filterableFields: ["agent_slug", "cursor_key", "cursor_value", "updated_at"],
|
|
130
403
|
sortableFields: ["updated_at", "agent_slug", "cursor_key"],
|
|
131
404
|
pickField: "updated_at"
|
|
@@ -135,15 +408,64 @@ function buildModelRegistry() {
|
|
|
135
408
|
aliases: ["content_leases", "lease", "leases"],
|
|
136
409
|
storage: "d1",
|
|
137
410
|
operations: ["get", "read", "search", "follow", "create", "update"],
|
|
411
|
+
fields: {
|
|
412
|
+
model: field("model", { filterable: true, dbColumns: ["model"], writeDbColumn: "model" }),
|
|
413
|
+
item_key: field("item_key", { aliases: ["itemKey"], filterable: true, dbColumns: ["item_key"], writeDbColumn: "item_key" }),
|
|
414
|
+
claimed_by: field("claimed_by", { aliases: ["claimedBy"], filterable: true, dbColumns: ["claimed_by"], writeDbColumn: "claimed_by" }),
|
|
415
|
+
claimed_at: field("claimed_at", { aliases: ["claimedAt"], sortable: true, comparableAs: "date", dbColumns: ["claimed_at"], writeDbColumn: "claimed_at" }),
|
|
416
|
+
lease_expires_at: field("lease_expires_at", { aliases: ["leaseExpiresAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["lease_expires_at"], writeDbColumn: "lease_expires_at" })
|
|
417
|
+
},
|
|
138
418
|
filterableFields: ["model", "item_key", "claimed_by", "lease_expires_at"],
|
|
139
419
|
sortableFields: ["lease_expires_at", "claimed_at"],
|
|
140
420
|
pickField: "lease_expires_at"
|
|
141
421
|
}
|
|
142
422
|
};
|
|
143
423
|
}
|
|
424
|
+
function normalizeDefinition(definition) {
|
|
425
|
+
const normalizedFields = Object.fromEntries(
|
|
426
|
+
Object.entries(definition.fields ?? {}).map(([canonicalKey, binding]) => [
|
|
427
|
+
canonicalKey,
|
|
428
|
+
{
|
|
429
|
+
...binding,
|
|
430
|
+
key: canonicalKey,
|
|
431
|
+
aliases: [...new Set((binding.aliases ?? []).map((alias) => alias.trim().toLowerCase()).filter(Boolean))],
|
|
432
|
+
contentKeys: [...new Set(binding.contentKeys ?? [])],
|
|
433
|
+
dbColumns: [...new Set(binding.dbColumns ?? [])],
|
|
434
|
+
payloadPaths: [...new Set(binding.payloadPaths ?? [])]
|
|
435
|
+
}
|
|
436
|
+
])
|
|
437
|
+
);
|
|
438
|
+
const normalized = {
|
|
439
|
+
...definition,
|
|
440
|
+
name: definition.name.trim(),
|
|
441
|
+
aliases: [...new Set((definition.aliases ?? []).map((alias) => alias.trim().toLowerCase()).filter(Boolean))],
|
|
442
|
+
fields: normalizedFields,
|
|
443
|
+
filterableFields: [...new Set(definition.filterableFields ?? Object.entries(normalizedFields).filter(([, binding]) => binding.filterable).map(([key]) => key))],
|
|
444
|
+
sortableFields: [...new Set(definition.sortableFields ?? Object.entries(normalizedFields).filter(([, binding]) => binding.sortable).map(([key]) => key))]
|
|
445
|
+
};
|
|
446
|
+
validateModelFieldAliases(normalized);
|
|
447
|
+
return normalized;
|
|
448
|
+
}
|
|
449
|
+
function mergeModelRegistries(baseRegistry, definitions = []) {
|
|
450
|
+
const registry = { ...baseRegistry };
|
|
451
|
+
for (const rawDefinition of definitions) {
|
|
452
|
+
const definition = normalizeDefinition(rawDefinition);
|
|
453
|
+
if (!definition.name) {
|
|
454
|
+
throw new Error("SDK model definitions require a non-empty name.");
|
|
455
|
+
}
|
|
456
|
+
registry[definition.name] = definition;
|
|
457
|
+
}
|
|
458
|
+
return registry;
|
|
459
|
+
}
|
|
460
|
+
function buildModelRegistry(definitions = []) {
|
|
461
|
+
return mergeModelRegistries(buildBuiltinModelRegistry(), definitions);
|
|
462
|
+
}
|
|
463
|
+
function buildScopedModelRegistry(repoRoot, definitions = []) {
|
|
464
|
+
return mergeModelRegistries(buildBuiltinModelRegistry(repoRoot), definitions);
|
|
465
|
+
}
|
|
466
|
+
const BUILTIN_MODEL_REGISTRY = buildBuiltinModelRegistry();
|
|
144
467
|
const MODEL_REGISTRY = buildModelRegistry();
|
|
145
|
-
function resolveModelDefinition(model) {
|
|
146
|
-
const registry = buildModelRegistry();
|
|
468
|
+
function resolveModelDefinition(model, registry = MODEL_REGISTRY) {
|
|
147
469
|
const directMatch = registry[model];
|
|
148
470
|
if (directMatch) {
|
|
149
471
|
return directMatch;
|
|
@@ -158,7 +480,11 @@ function resolveModelDefinition(model) {
|
|
|
158
480
|
return aliasMatch;
|
|
159
481
|
}
|
|
160
482
|
export {
|
|
483
|
+
BUILTIN_MODEL_REGISTRY,
|
|
161
484
|
MODEL_REGISTRY,
|
|
485
|
+
buildBuiltinModelRegistry,
|
|
162
486
|
buildModelRegistry,
|
|
487
|
+
buildScopedModelRegistry,
|
|
488
|
+
mergeModelRegistries,
|
|
163
489
|
resolveModelDefinition
|
|
164
490
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TreeseedOperationImplementation, TreeseedOperationMetadata, TreeseedOperationProvider } from '../../operations-types.ts';
|
|
2
|
+
export declare class DefaultTreeseedOperationsProvider implements TreeseedOperationProvider {
|
|
3
|
+
readonly id = "default";
|
|
4
|
+
private readonly operations;
|
|
5
|
+
constructor();
|
|
6
|
+
listOperations(): TreeseedOperationImplementation<Record<string, unknown>, Record<string, unknown>>[];
|
|
7
|
+
findOperation(name: string | null | undefined): TreeseedOperationImplementation<Record<string, unknown>, Record<string, unknown>> | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function createDefaultTreeseedOperationsProvider(): DefaultTreeseedOperationsProvider;
|
|
10
|
+
export declare function listDefaultOperationMetadata(): TreeseedOperationMetadata[];
|