@treeseed/sdk 0.1.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -506
- 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 +28 -0
- package/dist/index.js +91 -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/deploy-runtime.d.ts +18 -0
- package/dist/platform/deploy-runtime.js +78 -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 +161 -0
- package/dist/platform/plugins.d.ts +6 -0
- package/dist/platform/plugins.js +38 -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 +35 -22
- package/dist/scripts/aggregate-book.js +121 -0
- package/dist/scripts/build-dist.js +54 -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 -6
- 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/utils/agents/contracts/messages.d.ts +88 -0
- package/dist/utils/agents/contracts/messages.js +138 -0
- package/dist/utils/agents/contracts/run.d.ts +20 -0
- package/dist/utils/agents/contracts/run.js +0 -0
- package/dist/utils/agents/runtime-types.d.ts +117 -0
- package/dist/utils/agents/runtime-types.js +4 -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 +111 -5
- package/scripts/verify-driver.mjs +29 -0
- package/dist/scripts/.ts-run-1775630384291-crtqr3izsa.js +0 -22
- package/dist/scripts/.ts-run-1775630388025-vnjle0z75a.js +0 -129
- package/dist/scripts/assert-release-tag-version.d.ts +0 -1
- package/dist/scripts/build-dist.d.ts +0 -1
- package/dist/scripts/fixture-tools.d.ts +0 -5
- 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
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TREESEED_DEFAULT_PLUGIN_PACKAGE,
|
|
3
|
+
TREESEED_DEFAULT_PLUGIN_REFERENCES,
|
|
4
|
+
TREESEED_DEFAULT_PROVIDER_SELECTIONS
|
|
5
|
+
} from "./plugins/constants.js";
|
|
6
|
+
import {
|
|
7
|
+
getTreeseedAgentProviderSelections,
|
|
8
|
+
getTreeseedDeployConfig,
|
|
9
|
+
getTreeseedDeployProvider,
|
|
10
|
+
getTreeseedDocsProvider,
|
|
11
|
+
getTreeseedFormsProvider,
|
|
12
|
+
getTreeseedOperationsProvider,
|
|
13
|
+
getTreeseedSiteProvider,
|
|
14
|
+
isTreeseedSmtpEnabled,
|
|
15
|
+
isTreeseedTurnstileEnabled,
|
|
16
|
+
resetTreeseedDeployConfigForTests
|
|
17
|
+
} from "./deploy-runtime.js";
|
|
18
|
+
import { defineTreeseedPlugin } from "./plugins/plugin.js";
|
|
19
|
+
import { loadTreeseedPluginRuntime, loadTreeseedPlugins, resolveTreeseedGraphRankingProvider } from "./plugins/runtime.js";
|
|
20
|
+
export {
|
|
21
|
+
TREESEED_DEFAULT_PLUGIN_PACKAGE,
|
|
22
|
+
TREESEED_DEFAULT_PLUGIN_REFERENCES,
|
|
23
|
+
TREESEED_DEFAULT_PROVIDER_SELECTIONS,
|
|
24
|
+
defineTreeseedPlugin,
|
|
25
|
+
getTreeseedAgentProviderSelections,
|
|
26
|
+
getTreeseedDeployConfig,
|
|
27
|
+
getTreeseedDeployProvider,
|
|
28
|
+
getTreeseedDocsProvider,
|
|
29
|
+
getTreeseedFormsProvider,
|
|
30
|
+
getTreeseedOperationsProvider,
|
|
31
|
+
getTreeseedSiteProvider,
|
|
32
|
+
isTreeseedSmtpEnabled,
|
|
33
|
+
isTreeseedTurnstileEnabled,
|
|
34
|
+
loadTreeseedPluginRuntime,
|
|
35
|
+
loadTreeseedPlugins,
|
|
36
|
+
resetTreeseedDeployConfigForTests,
|
|
37
|
+
resolveTreeseedGraphRankingProvider
|
|
38
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { parseSiteConfig } from './utils/site-config-schema.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TreeseedTenantConfig } from '../contracts.ts';
|
|
2
|
+
declare function resolveTenantRoot(): string;
|
|
3
|
+
export declare function defineTreeseedTenant<T>(tenantConfig: T): T;
|
|
4
|
+
export declare function loadTreeseedManifest(manifestPath?: string): TreeseedTenantConfig;
|
|
5
|
+
export declare const loadTreeseedTenantManifest: typeof loadTreeseedManifest;
|
|
6
|
+
export declare const resolveTreeseedTenantRoot: typeof resolveTenantRoot;
|
|
7
|
+
export declare function getTenantContentRoot(tenantConfig: Pick<TreeseedTenantConfig, 'content'>, collectionName: string): string;
|
|
8
|
+
export declare function tenantFeatureEnabled(tenantConfig: Pick<TreeseedTenantConfig, 'features'>, featureName: string): boolean;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { parse as parseYaml } from "yaml";
|
|
5
|
+
import { normalizeAliasedRecord } from "../../field-aliases.js";
|
|
6
|
+
function resolvePackageRoot() {
|
|
7
|
+
const moduleUrl = typeof import.meta?.url === "string" ? import.meta.url : null;
|
|
8
|
+
if (!moduleUrl) {
|
|
9
|
+
return process.cwd();
|
|
10
|
+
}
|
|
11
|
+
return resolve(dirname(fileURLToPath(moduleUrl)), "../..");
|
|
12
|
+
}
|
|
13
|
+
const packageRoot = resolvePackageRoot();
|
|
14
|
+
const packageFixtureRoot = resolve(packageRoot, ".fixtures", "treeseed-fixtures", "sites", "working-site");
|
|
15
|
+
const explicitTenantRoot = process.env.TREESEED_TENANT_ROOT ? resolve(process.env.TREESEED_TENANT_ROOT) : null;
|
|
16
|
+
const manifestFieldAliases = {
|
|
17
|
+
siteConfigPath: { key: "siteConfigPath", aliases: ["site_config_path"] }
|
|
18
|
+
};
|
|
19
|
+
const manifestContentFieldAliases = {
|
|
20
|
+
pages: { key: "pages", aliases: ["page_root", "pages_root"] },
|
|
21
|
+
notes: { key: "notes", aliases: ["notes_root"] },
|
|
22
|
+
questions: { key: "questions", aliases: ["questions_root"] },
|
|
23
|
+
objectives: { key: "objectives", aliases: ["objectives_root"] },
|
|
24
|
+
people: { key: "people", aliases: ["people_root"] },
|
|
25
|
+
agents: { key: "agents", aliases: ["agents_root"] },
|
|
26
|
+
books: { key: "books", aliases: ["books_root"] },
|
|
27
|
+
docs: { key: "docs", aliases: ["knowledge", "knowledge_root", "docs_root"] }
|
|
28
|
+
};
|
|
29
|
+
const manifestOverrideFieldAliases = {
|
|
30
|
+
pagesRoot: { key: "pagesRoot", aliases: ["pages_root"] },
|
|
31
|
+
stylesRoot: { key: "stylesRoot", aliases: ["styles_root"] },
|
|
32
|
+
componentsRoot: { key: "componentsRoot", aliases: ["components_root"] }
|
|
33
|
+
};
|
|
34
|
+
function pathWithin(parent, candidate) {
|
|
35
|
+
const normalizedParent = resolve(parent);
|
|
36
|
+
const normalizedCandidate = resolve(candidate);
|
|
37
|
+
return normalizedCandidate === normalizedParent || normalizedCandidate.startsWith(`${normalizedParent}/`);
|
|
38
|
+
}
|
|
39
|
+
function collectTenantRootCandidates(start) {
|
|
40
|
+
const candidates = [];
|
|
41
|
+
let current = resolve(start);
|
|
42
|
+
while (true) {
|
|
43
|
+
candidates.push(
|
|
44
|
+
current,
|
|
45
|
+
resolve(current, ".fixtures", "treeseed-fixtures", "sites", "working-site"),
|
|
46
|
+
resolve(current, "fixture")
|
|
47
|
+
);
|
|
48
|
+
const parent = resolve(current, "..");
|
|
49
|
+
if (parent === current) {
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
current = parent;
|
|
53
|
+
}
|
|
54
|
+
return candidates;
|
|
55
|
+
}
|
|
56
|
+
function uniqueCandidates(entries) {
|
|
57
|
+
return [...new Set(entries.map((entry) => resolve(entry)))];
|
|
58
|
+
}
|
|
59
|
+
function tenantRootCandidates() {
|
|
60
|
+
const cwd = resolve(process.cwd());
|
|
61
|
+
const cwdCandidates = collectTenantRootCandidates(cwd);
|
|
62
|
+
const packageCandidates = collectTenantRootCandidates(packageRoot);
|
|
63
|
+
if (explicitTenantRoot) {
|
|
64
|
+
return uniqueCandidates([explicitTenantRoot, ...cwdCandidates, packageFixtureRoot, ...packageCandidates]);
|
|
65
|
+
}
|
|
66
|
+
if (pathWithin(packageRoot, cwd)) {
|
|
67
|
+
return uniqueCandidates([packageFixtureRoot, ...cwdCandidates, ...packageCandidates]);
|
|
68
|
+
}
|
|
69
|
+
return uniqueCandidates([...cwdCandidates, packageFixtureRoot, ...packageCandidates]);
|
|
70
|
+
}
|
|
71
|
+
function resolveTenantPath(manifestPath) {
|
|
72
|
+
if (existsSync(manifestPath)) {
|
|
73
|
+
return resolve(manifestPath);
|
|
74
|
+
}
|
|
75
|
+
const candidates = tenantRootCandidates().map((root) => resolve(root, manifestPath));
|
|
76
|
+
for (const candidate of candidates) {
|
|
77
|
+
if (existsSync(candidate)) {
|
|
78
|
+
return candidate;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
throw new Error(
|
|
82
|
+
`Unable to resolve Treeseed tenant manifest at "${manifestPath}" from ${process.cwd()} or ${packageFixtureRoot}.`
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
function resolveTenantRoot() {
|
|
86
|
+
const candidates = tenantRootCandidates();
|
|
87
|
+
for (const candidate of candidates) {
|
|
88
|
+
if (existsSync(resolve(candidate, "src/manifest.yaml"))) {
|
|
89
|
+
return candidate;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
throw new Error(
|
|
93
|
+
`Unable to resolve a Treeseed tenant root from ${process.cwd()} or ${packageFixtureRoot}.`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
function defineTreeseedTenant(tenantConfig) {
|
|
97
|
+
return tenantConfig;
|
|
98
|
+
}
|
|
99
|
+
function loadTreeseedManifest(manifestPath = "./src/manifest.yaml") {
|
|
100
|
+
const resolvedManifestPath = resolveTenantPath(manifestPath);
|
|
101
|
+
const tenantRoot = resolve(dirname(resolvedManifestPath), "..");
|
|
102
|
+
const parsed = normalizeAliasedRecord(
|
|
103
|
+
manifestFieldAliases,
|
|
104
|
+
parseYaml(readFileSync(resolvedManifestPath, "utf8"))
|
|
105
|
+
);
|
|
106
|
+
const content = normalizeAliasedRecord(
|
|
107
|
+
manifestContentFieldAliases,
|
|
108
|
+
parsed.content ?? {}
|
|
109
|
+
);
|
|
110
|
+
const overrides = parsed.overrides ? normalizeAliasedRecord(
|
|
111
|
+
manifestOverrideFieldAliases,
|
|
112
|
+
parsed.overrides
|
|
113
|
+
) : void 0;
|
|
114
|
+
const tenantConfig = defineTreeseedTenant({
|
|
115
|
+
...parsed,
|
|
116
|
+
siteConfigPath: resolve(tenantRoot, parsed.siteConfigPath),
|
|
117
|
+
content: Object.fromEntries(
|
|
118
|
+
Object.entries(content ?? {}).map(([collectionName, rootPath]) => [
|
|
119
|
+
collectionName,
|
|
120
|
+
resolve(tenantRoot, String(rootPath))
|
|
121
|
+
])
|
|
122
|
+
),
|
|
123
|
+
overrides: overrides ? {
|
|
124
|
+
pagesRoot: overrides.pagesRoot ? resolve(tenantRoot, overrides.pagesRoot) : void 0,
|
|
125
|
+
stylesRoot: overrides.stylesRoot ? resolve(tenantRoot, overrides.stylesRoot) : void 0,
|
|
126
|
+
componentsRoot: overrides.componentsRoot ? resolve(tenantRoot, overrides.componentsRoot) : void 0
|
|
127
|
+
} : void 0
|
|
128
|
+
});
|
|
129
|
+
Object.defineProperty(tenantConfig, "__tenantRoot", {
|
|
130
|
+
value: tenantRoot,
|
|
131
|
+
enumerable: false
|
|
132
|
+
});
|
|
133
|
+
return tenantConfig;
|
|
134
|
+
}
|
|
135
|
+
const loadTreeseedTenantManifest = loadTreeseedManifest;
|
|
136
|
+
const resolveTreeseedTenantRoot = resolveTenantRoot;
|
|
137
|
+
function getTenantContentRoot(tenantConfig, collectionName) {
|
|
138
|
+
const root = tenantConfig.content[collectionName];
|
|
139
|
+
if (!root) {
|
|
140
|
+
throw new Error(`Unknown tenant content collection: ${collectionName}`);
|
|
141
|
+
}
|
|
142
|
+
return root;
|
|
143
|
+
}
|
|
144
|
+
function tenantFeatureEnabled(tenantConfig, featureName) {
|
|
145
|
+
return tenantConfig.features?.[featureName] !== false;
|
|
146
|
+
}
|
|
147
|
+
export {
|
|
148
|
+
defineTreeseedTenant,
|
|
149
|
+
getTenantContentRoot,
|
|
150
|
+
loadTreeseedManifest,
|
|
151
|
+
loadTreeseedTenantManifest,
|
|
152
|
+
resolveTreeseedTenantRoot,
|
|
153
|
+
tenantFeatureEnabled
|
|
154
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { loadTreeseedManifest } from "./config.js";
|
|
3
|
+
import { parseSiteConfig } from "../utils/site-config-schema.js";
|
|
4
|
+
const injectedTenantConfig = typeof __TREESEED_TENANT_CONFIG__ !== "undefined" ? __TREESEED_TENANT_CONFIG__ : null;
|
|
5
|
+
const injectedProjectRoot = typeof __TREESEED_PROJECT_ROOT__ !== "undefined" ? __TREESEED_PROJECT_ROOT__ : null;
|
|
6
|
+
const injectedSiteConfig = typeof __TREESEED_SITE_CONFIG__ !== "undefined" ? __TREESEED_SITE_CONFIG__ : null;
|
|
7
|
+
const RUNTIME_TENANT = injectedTenantConfig ?? loadTreeseedManifest();
|
|
8
|
+
const RUNTIME_PROJECT_ROOT = injectedProjectRoot ?? process.cwd();
|
|
9
|
+
const RUNTIME_SITE_CONFIG = injectedSiteConfig ?? (() => {
|
|
10
|
+
try {
|
|
11
|
+
return parseSiteConfig(readFileSync(RUNTIME_TENANT.siteConfigPath, "utf8"));
|
|
12
|
+
} catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
})();
|
|
16
|
+
export {
|
|
17
|
+
RUNTIME_PROJECT_ROOT,
|
|
18
|
+
RUNTIME_SITE_CONFIG,
|
|
19
|
+
RUNTIME_TENANT
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tenant/config.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./tenant/config.js";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { TreeseedBookDefinition, TreeseedTenantConfig } from '../contracts.ts';
|
|
2
|
+
interface DocsLibraryDownload {
|
|
3
|
+
downloadFileName: string;
|
|
4
|
+
downloadHref: string;
|
|
5
|
+
downloadTitle: string;
|
|
6
|
+
}
|
|
7
|
+
interface TenantBookRuntime {
|
|
8
|
+
BOOKS: TreeseedBookDefinition[];
|
|
9
|
+
BOOKS_LINK: {
|
|
10
|
+
label: string;
|
|
11
|
+
link: string;
|
|
12
|
+
};
|
|
13
|
+
TREESEED_LINKS: {
|
|
14
|
+
home: string;
|
|
15
|
+
};
|
|
16
|
+
TREESEED_LIBRARY_DOWNLOAD: DocsLibraryDownload;
|
|
17
|
+
}
|
|
18
|
+
export declare function buildTenantBookRuntime(tenantConfig: Pick<TreeseedTenantConfig, 'content'>, options?: {
|
|
19
|
+
projectRoot?: string;
|
|
20
|
+
docsHomePath?: string;
|
|
21
|
+
docsLibraryDownload?: DocsLibraryDownload;
|
|
22
|
+
}): TenantBookRuntime;
|
|
23
|
+
export declare const BOOKS: TreeseedBookDefinition[], BOOKS_LINK: {
|
|
24
|
+
label: string;
|
|
25
|
+
link: string;
|
|
26
|
+
}, TREESEED_LINKS: {
|
|
27
|
+
home: string;
|
|
28
|
+
}, TREESEED_LIBRARY_DOWNLOAD: DocsLibraryDownload;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { parse as parseYaml } from "yaml";
|
|
4
|
+
import { getTenantContentRoot } from "../tenant/config.js";
|
|
5
|
+
import { RUNTIME_PROJECT_ROOT, RUNTIME_TENANT } from "../tenant/runtime-config.js";
|
|
6
|
+
function sortPaths(paths) {
|
|
7
|
+
return [...paths].sort((left, right) => left.localeCompare(right, void 0, { numeric: true, sensitivity: "base" }));
|
|
8
|
+
}
|
|
9
|
+
function collectMarkdownFiles(rootPath) {
|
|
10
|
+
const stats = statSync(rootPath);
|
|
11
|
+
if (stats.isFile()) {
|
|
12
|
+
return [rootPath];
|
|
13
|
+
}
|
|
14
|
+
return sortPaths(
|
|
15
|
+
readdirSync(rootPath, { withFileTypes: true }).flatMap((entry) => {
|
|
16
|
+
const fullPath = path.join(rootPath, entry.name);
|
|
17
|
+
if (entry.isDirectory()) {
|
|
18
|
+
return collectMarkdownFiles(fullPath);
|
|
19
|
+
}
|
|
20
|
+
if (entry.isFile() && (entry.name.endsWith(".md") || entry.name.endsWith(".mdx"))) {
|
|
21
|
+
return [fullPath];
|
|
22
|
+
}
|
|
23
|
+
return [];
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
function parseFrontmatter(filePath) {
|
|
28
|
+
const raw = readFileSync(filePath, "utf8");
|
|
29
|
+
const match = raw.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
30
|
+
if (!match) {
|
|
31
|
+
throw new Error(`Book content entry is missing frontmatter: ${filePath}`);
|
|
32
|
+
}
|
|
33
|
+
return parseYaml(match[1]);
|
|
34
|
+
}
|
|
35
|
+
function inferDocsLibraryDownload(book) {
|
|
36
|
+
const title = book?.title ? `${book.title} Library` : "Knowledge Library";
|
|
37
|
+
return {
|
|
38
|
+
downloadFileName: "treeseed-knowledge.md",
|
|
39
|
+
downloadHref: "/books/treeseed-knowledge.md",
|
|
40
|
+
downloadTitle: title
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function buildTenantBookRuntime(tenantConfig, options = {}) {
|
|
44
|
+
const projectRoot = options.projectRoot ?? process.cwd();
|
|
45
|
+
const booksContentRoot = path.resolve(projectRoot, getTenantContentRoot(tenantConfig, "books"));
|
|
46
|
+
const books = collectMarkdownFiles(booksContentRoot).map((filePath) => {
|
|
47
|
+
const frontmatter = parseFrontmatter(filePath);
|
|
48
|
+
return {
|
|
49
|
+
...frontmatter,
|
|
50
|
+
id: path.basename(filePath, path.extname(filePath))
|
|
51
|
+
};
|
|
52
|
+
}).sort((left, right) => left.order - right.order);
|
|
53
|
+
const docsHomePath = options.docsHomePath ?? "/knowledge/";
|
|
54
|
+
const docsLibraryDownload = options.docsLibraryDownload ?? inferDocsLibraryDownload(tenantConfig);
|
|
55
|
+
return {
|
|
56
|
+
BOOKS: books,
|
|
57
|
+
BOOKS_LINK: {
|
|
58
|
+
label: "Books",
|
|
59
|
+
link: docsHomePath
|
|
60
|
+
},
|
|
61
|
+
TREESEED_LINKS: {
|
|
62
|
+
home: docsHomePath
|
|
63
|
+
},
|
|
64
|
+
TREESEED_LIBRARY_DOWNLOAD: docsLibraryDownload
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const runtime = buildTenantBookRuntime(RUNTIME_TENANT, {
|
|
68
|
+
projectRoot: RUNTIME_PROJECT_ROOT,
|
|
69
|
+
docsLibraryDownload: {
|
|
70
|
+
downloadFileName: "treeseed-knowledge.md",
|
|
71
|
+
downloadHref: "/books/treeseed-knowledge.md",
|
|
72
|
+
downloadTitle: "TreeSeed Knowledge Library"
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const { BOOKS, BOOKS_LINK, TREESEED_LINKS, TREESEED_LIBRARY_DOWNLOAD } = runtime;
|
|
76
|
+
export {
|
|
77
|
+
BOOKS,
|
|
78
|
+
BOOKS_LINK,
|
|
79
|
+
TREESEED_LIBRARY_DOWNLOAD,
|
|
80
|
+
TREESEED_LINKS,
|
|
81
|
+
buildTenantBookRuntime
|
|
82
|
+
};
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { parse as parseYaml } from 'yaml';
|
|
2
|
+
import { normalizeAliasedRecord } from '../../field-aliases.js';
|
|
3
|
+
|
|
4
|
+
/** @typedef {import('../../field-aliases.js').TreeseedFieldAliasRegistry} TreeseedFieldAliasRegistry */
|
|
5
|
+
|
|
6
|
+
function isRecord(value) {
|
|
7
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function expectRecord(value, path) {
|
|
11
|
+
if (!isRecord(value)) {
|
|
12
|
+
throw new Error(`Expected ${path} to be an object.`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function expectString(value, path) {
|
|
19
|
+
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
20
|
+
throw new Error(`Expected ${path} to be a non-empty string.`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return value.trim();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function optionalString(value, path) {
|
|
27
|
+
if (value === undefined || value === null || value === '') {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return expectString(value, path);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function optionalBoolean(value, path) {
|
|
35
|
+
if (value === undefined || value === null) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (typeof value !== 'boolean') {
|
|
40
|
+
throw new Error(`Expected ${path} to be a boolean.`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function optionalRecord(value, path) {
|
|
47
|
+
if (value === undefined || value === null) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return expectRecord(value, path);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function stringArray(value, path) {
|
|
55
|
+
if (value === undefined || value === null) {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (!Array.isArray(value)) {
|
|
60
|
+
throw new Error(`Expected ${path} to be an array.`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return value.map((entry, index) => expectString(entry, `${path}[${index}]`));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function parseMenuGroups(value, path) {
|
|
67
|
+
if (!Array.isArray(value)) {
|
|
68
|
+
throw new Error(`Expected ${path} to be an array.`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return value.map((group, groupIndex) => {
|
|
72
|
+
const parsedGroup = expectRecord(group, `${path}[${groupIndex}]`);
|
|
73
|
+
const items = parsedGroup.items;
|
|
74
|
+
if (!Array.isArray(items) || items.length === 0) {
|
|
75
|
+
throw new Error(`Expected ${path}[${groupIndex}].items to contain at least one menu item.`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
label: expectString(parsedGroup.label, `${path}[${groupIndex}].label`),
|
|
80
|
+
items: items.map((item, itemIndex) => {
|
|
81
|
+
const parsedItem = expectRecord(item, `${path}[${groupIndex}].items[${itemIndex}]`);
|
|
82
|
+
return {
|
|
83
|
+
label: expectString(parsedItem.label, `${path}[${groupIndex}].items[${itemIndex}].label`),
|
|
84
|
+
href: expectString(parsedItem.href, `${path}[${groupIndex}].items[${itemIndex}].href`),
|
|
85
|
+
};
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function parseContactRouting(value, path) {
|
|
92
|
+
const parsedValue = expectRecord(value ?? {}, path);
|
|
93
|
+
const keys = ['default', 'question', 'feedback', 'collaboration', 'issue'];
|
|
94
|
+
|
|
95
|
+
return Object.fromEntries(
|
|
96
|
+
keys.flatMap((key) => {
|
|
97
|
+
if (!(key in parsedValue)) {
|
|
98
|
+
return [];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return [[key, stringArray(parsedValue[key], `${path}.${key}`)]];
|
|
102
|
+
}),
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function parseTheme(value, path) {
|
|
107
|
+
const theme = optionalRecord(value, path);
|
|
108
|
+
if (!theme) {
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const surfaces = optionalRecord(theme.surfaces, `${path}.surfaces`);
|
|
113
|
+
const text = optionalRecord(theme.text, `${path}.text`);
|
|
114
|
+
const border = optionalRecord(theme.border, `${path}.border`);
|
|
115
|
+
const accent = optionalRecord(theme.accent, `${path}.accent`);
|
|
116
|
+
const info = optionalRecord(theme.info, `${path}.info`);
|
|
117
|
+
const warm = optionalRecord(theme.warm, `${path}.warm`);
|
|
118
|
+
|
|
119
|
+
return {
|
|
120
|
+
surfaces: surfaces
|
|
121
|
+
? {
|
|
122
|
+
background: optionalString(surfaces.background, `${path}.surfaces.background`),
|
|
123
|
+
backgroundElevated: optionalString(
|
|
124
|
+
surfaces.backgroundElevated,
|
|
125
|
+
`${path}.surfaces.backgroundElevated`,
|
|
126
|
+
),
|
|
127
|
+
backgroundSoft: optionalString(surfaces.backgroundSoft, `${path}.surfaces.backgroundSoft`),
|
|
128
|
+
panel: optionalString(surfaces.panel, `${path}.surfaces.panel`),
|
|
129
|
+
panelStrong: optionalString(surfaces.panelStrong, `${path}.surfaces.panelStrong`),
|
|
130
|
+
}
|
|
131
|
+
: undefined,
|
|
132
|
+
text: text
|
|
133
|
+
? {
|
|
134
|
+
body: optionalString(text.body, `${path}.text.body`),
|
|
135
|
+
muted: optionalString(text.muted, `${path}.text.muted`),
|
|
136
|
+
soft: optionalString(text.soft, `${path}.text.soft`),
|
|
137
|
+
}
|
|
138
|
+
: undefined,
|
|
139
|
+
border: border
|
|
140
|
+
? {
|
|
141
|
+
base: optionalString(border.base, `${path}.border.base`),
|
|
142
|
+
strong: optionalString(border.strong, `${path}.border.strong`),
|
|
143
|
+
grid: optionalString(border.grid, `${path}.border.grid`),
|
|
144
|
+
}
|
|
145
|
+
: undefined,
|
|
146
|
+
accent: accent
|
|
147
|
+
? {
|
|
148
|
+
base: optionalString(accent.base, `${path}.accent.base`),
|
|
149
|
+
strong: optionalString(accent.strong, `${path}.accent.strong`),
|
|
150
|
+
soft: optionalString(accent.soft, `${path}.accent.soft`),
|
|
151
|
+
}
|
|
152
|
+
: undefined,
|
|
153
|
+
info: info
|
|
154
|
+
? {
|
|
155
|
+
base: optionalString(info.base, `${path}.info.base`),
|
|
156
|
+
strong: optionalString(info.strong, `${path}.info.strong`),
|
|
157
|
+
soft: optionalString(info.soft, `${path}.info.soft`),
|
|
158
|
+
}
|
|
159
|
+
: undefined,
|
|
160
|
+
warm: warm
|
|
161
|
+
? {
|
|
162
|
+
base: optionalString(warm.base, `${path}.warm.base`),
|
|
163
|
+
strong: optionalString(warm.strong, `${path}.warm.strong`),
|
|
164
|
+
}
|
|
165
|
+
: undefined,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** @type {TreeseedFieldAliasRegistry} */
|
|
170
|
+
const siteFieldAliases = {
|
|
171
|
+
siteUrl: { key: 'siteUrl', aliases: ['site_url'] },
|
|
172
|
+
githubRepository: { key: 'githubRepository', aliases: ['github_repository'] },
|
|
173
|
+
discordLink: { key: 'discordLink', aliases: ['discord_link'] },
|
|
174
|
+
headerMenu: { key: 'headerMenu', aliases: ['header_menu'] },
|
|
175
|
+
footerMenu: { key: 'footerMenu', aliases: ['footer_menu'] },
|
|
176
|
+
emailNotifications: { key: 'emailNotifications', aliases: ['email_notifications'] },
|
|
177
|
+
projectStage: { key: 'projectStage', aliases: ['project_stage'] },
|
|
178
|
+
projectStageDetail: { key: 'projectStageDetail', aliases: ['project_stage_detail'] },
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/** @type {TreeseedFieldAliasRegistry} */
|
|
182
|
+
const pageDefaultsFieldAliases = {
|
|
183
|
+
pageLayout: { key: 'pageLayout', aliases: ['page_layout'] },
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
/** @type {TreeseedFieldAliasRegistry} */
|
|
187
|
+
const agentDefaultsFieldAliases = {
|
|
188
|
+
runtimeStatus: { key: 'runtimeStatus', aliases: ['runtime_status'] },
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/** @type {TreeseedFieldAliasRegistry} */
|
|
192
|
+
const formsFieldAliases = {
|
|
193
|
+
apiBaseUrl: { key: 'apiBaseUrl', aliases: ['api_base_url'] },
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/** @type {TreeseedFieldAliasRegistry} */
|
|
197
|
+
const emailNotificationFieldAliases = {
|
|
198
|
+
contactRouting: { key: 'contactRouting', aliases: ['contact_routing'] },
|
|
199
|
+
subscribeRecipients: { key: 'subscribeRecipients', aliases: ['subscribe_recipients'] },
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* @param {string} source
|
|
204
|
+
*/
|
|
205
|
+
export function parseSiteConfig(source) {
|
|
206
|
+
const parsed = expectRecord(parseYaml(source), 'config');
|
|
207
|
+
const site = normalizeAliasedRecord(siteFieldAliases, expectRecord(parsed.site, 'site'));
|
|
208
|
+
const models = expectRecord(parsed.models ?? {}, 'models');
|
|
209
|
+
const pageModel = expectRecord(models.pages ?? {}, 'models.pages');
|
|
210
|
+
const noteModel = expectRecord(models.notes ?? {}, 'models.notes');
|
|
211
|
+
const questionModel = expectRecord(models.questions ?? {}, 'models.questions');
|
|
212
|
+
const objectiveModel = expectRecord(models.objectives ?? {}, 'models.objectives');
|
|
213
|
+
const peopleModel = expectRecord(models.people ?? {}, 'models.people');
|
|
214
|
+
const agentModel = expectRecord(models.agents ?? {}, 'models.agents');
|
|
215
|
+
const bookModel = expectRecord(models.books ?? {}, 'models.books');
|
|
216
|
+
const docsModel = expectRecord(models.docs ?? {}, 'models.docs');
|
|
217
|
+
const pageDefaults = normalizeAliasedRecord(pageDefaultsFieldAliases, expectRecord(pageModel.defaults ?? {}, 'models.pages.defaults'));
|
|
218
|
+
const noteDefaults = expectRecord(noteModel.defaults ?? {}, 'models.notes.defaults');
|
|
219
|
+
const questionDefaults = expectRecord(questionModel.defaults ?? {}, 'models.questions.defaults');
|
|
220
|
+
const objectiveDefaults = expectRecord(objectiveModel.defaults ?? {}, 'models.objectives.defaults');
|
|
221
|
+
const peopleDefaults = expectRecord(peopleModel.defaults ?? {}, 'models.people.defaults');
|
|
222
|
+
const agentDefaults = normalizeAliasedRecord(agentDefaultsFieldAliases, expectRecord(agentModel.defaults ?? {}, 'models.agents.defaults'));
|
|
223
|
+
const bookDefaults = expectRecord(bookModel.defaults ?? {}, 'models.books.defaults');
|
|
224
|
+
const docsDefaults = expectRecord(docsModel.defaults ?? {}, 'models.docs.defaults');
|
|
225
|
+
const logo = expectRecord(site.logo, 'site.logo');
|
|
226
|
+
const forms = normalizeAliasedRecord(formsFieldAliases, expectRecord(site.forms ?? {}, 'site.forms'));
|
|
227
|
+
const emailNotifications = normalizeAliasedRecord(
|
|
228
|
+
emailNotificationFieldAliases,
|
|
229
|
+
expectRecord(site.emailNotifications, 'site.emailNotifications'),
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
return {
|
|
233
|
+
site: {
|
|
234
|
+
logo: {
|
|
235
|
+
src: expectString(logo.src, 'site.logo.src'),
|
|
236
|
+
alt: expectString(logo.alt, 'site.logo.alt'),
|
|
237
|
+
},
|
|
238
|
+
name: expectString(site.name, 'site.name'),
|
|
239
|
+
statement: expectString(site.statement, 'site.statement'),
|
|
240
|
+
siteUrl: expectString(site.siteUrl, 'site.siteUrl'),
|
|
241
|
+
githubRepository: expectString(site.githubRepository, 'site.githubRepository'),
|
|
242
|
+
discordLink: expectString(site.discordLink, 'site.discordLink'),
|
|
243
|
+
headerMenu: parseMenuGroups(site.headerMenu, 'site.headerMenu'),
|
|
244
|
+
footerMenu: parseMenuGroups(site.footerMenu, 'site.footerMenu'),
|
|
245
|
+
forms: {
|
|
246
|
+
apiBaseUrl: optionalString(forms.apiBaseUrl, 'site.forms.apiBaseUrl'),
|
|
247
|
+
},
|
|
248
|
+
emailNotifications: {
|
|
249
|
+
contactRouting: parseContactRouting(
|
|
250
|
+
emailNotifications.contactRouting,
|
|
251
|
+
'site.emailNotifications.contactRouting',
|
|
252
|
+
),
|
|
253
|
+
subscribeRecipients: stringArray(
|
|
254
|
+
emailNotifications.subscribeRecipients,
|
|
255
|
+
'site.emailNotifications.subscribeRecipients',
|
|
256
|
+
),
|
|
257
|
+
},
|
|
258
|
+
summary: expectString(site.summary, 'site.summary'),
|
|
259
|
+
projectStage: expectString(site.projectStage, 'site.projectStage'),
|
|
260
|
+
projectStageDetail: expectString(site.projectStageDetail, 'site.projectStageDetail'),
|
|
261
|
+
theme: parseTheme(site.theme, 'site.theme'),
|
|
262
|
+
},
|
|
263
|
+
models: {
|
|
264
|
+
pages: {
|
|
265
|
+
defaults: {
|
|
266
|
+
pageLayout: optionalString(pageDefaults.pageLayout, 'models.pages.defaults.pageLayout'),
|
|
267
|
+
status: optionalString(pageDefaults.status, 'models.pages.defaults.status'),
|
|
268
|
+
stage: optionalString(pageDefaults.stage, 'models.pages.defaults.stage'),
|
|
269
|
+
audience: stringArray(pageDefaults.audience, 'models.pages.defaults.audience'),
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
notes: {
|
|
273
|
+
defaults: {
|
|
274
|
+
author: optionalString(noteDefaults.author, 'models.notes.defaults.author'),
|
|
275
|
+
draft: optionalBoolean(noteDefaults.draft, 'models.notes.defaults.draft'),
|
|
276
|
+
tags: stringArray(noteDefaults.tags, 'models.notes.defaults.tags'),
|
|
277
|
+
status: optionalString(noteDefaults.status, 'models.notes.defaults.status'),
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
questions: {
|
|
281
|
+
defaults: {
|
|
282
|
+
draft: optionalBoolean(questionDefaults.draft, 'models.questions.defaults.draft'),
|
|
283
|
+
tags: stringArray(questionDefaults.tags, 'models.questions.defaults.tags'),
|
|
284
|
+
status: optionalString(questionDefaults.status, 'models.questions.defaults.status'),
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
objectives: {
|
|
288
|
+
defaults: {
|
|
289
|
+
draft: optionalBoolean(objectiveDefaults.draft, 'models.objectives.defaults.draft'),
|
|
290
|
+
tags: stringArray(objectiveDefaults.tags, 'models.objectives.defaults.tags'),
|
|
291
|
+
status: optionalString(objectiveDefaults.status, 'models.objectives.defaults.status'),
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
people: {
|
|
295
|
+
defaults: {
|
|
296
|
+
status: optionalString(peopleDefaults.status, 'models.people.defaults.status'),
|
|
297
|
+
tags: stringArray(peopleDefaults.tags, 'models.people.defaults.tags'),
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
agents: {
|
|
301
|
+
defaults: {
|
|
302
|
+
tags: stringArray(agentDefaults.tags, 'models.agents.defaults.tags'),
|
|
303
|
+
runtimeStatus: optionalString(
|
|
304
|
+
agentDefaults.runtimeStatus,
|
|
305
|
+
'models.agents.defaults.runtimeStatus',
|
|
306
|
+
),
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
books: {
|
|
310
|
+
defaults: {
|
|
311
|
+
tags: stringArray(bookDefaults.tags, 'models.books.defaults.tags'),
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
docs: {
|
|
315
|
+
defaults: {
|
|
316
|
+
tags: stringArray(docsDefaults.tags, 'models.docs.defaults.tags'),
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
};
|
|
321
|
+
}
|