@businessdash/sdk 0.9.80 → 0.9.90
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 +133 -949
- package/assets/{biab-sw.js → bd-sw.js} +2 -2
- package/dist/account-core/index.d.ts +1 -1
- package/dist/account-core/index.d.ts.map +1 -1
- package/dist/adapters-revalidate.d.ts +2 -2
- package/dist/adapters-revalidate.js +2 -2
- package/dist/adapters-revalidate.js.map +1 -1
- package/dist/analytics-core.d.ts +6 -6
- package/dist/analytics-core.d.ts.map +1 -1
- package/dist/analytics-core.js +4 -4
- package/dist/analytics-core.js.map +1 -1
- package/dist/analytics-server.d.ts +6 -6
- package/dist/analytics-server.d.ts.map +1 -1
- package/dist/analytics-server.js +5 -5
- package/dist/auth-handler.d.ts +14 -14
- package/dist/auth-handler.d.ts.map +1 -1
- package/dist/auth-handler.js +16 -16
- package/dist/auth-handler.js.map +1 -1
- package/dist/auth-links.d.ts +2 -2
- package/dist/auth-links.d.ts.map +1 -1
- package/dist/auth-links.js +2 -2
- package/dist/auth-links.js.map +1 -1
- package/dist/{biab-forms.css → bd-forms.css} +158 -158
- package/dist/cli.d.ts +4 -4
- package/dist/cli.js +78 -78
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +158 -147
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +156 -137
- package/dist/client.js.map +1 -1
- package/dist/consent-core/index.cjs +2 -2
- package/dist/consent-core/index.d.ts +2 -2
- package/dist/consent-core/index.d.ts.map +1 -1
- package/dist/consent-core/index.js +10 -8
- package/dist/consent-core/index.js.map +1 -1
- package/dist/contracts.d.ts +411 -52
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +89 -15
- package/dist/contracts.js.map +1 -1
- package/dist/data-model-schema.d.ts +15 -15
- package/dist/data-model-schema.d.ts.map +1 -1
- package/dist/data-model-schema.js +19 -17
- package/dist/data-model-schema.js.map +1 -1
- package/dist/distribution.d.ts +5 -5
- package/dist/distribution.d.ts.map +1 -1
- package/dist/distribution.js +4 -4
- package/dist/element.d.ts +36 -36
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +43 -43
- package/dist/element.js.map +1 -1
- package/dist/embed-protocol.d.ts +11 -11
- package/dist/embed-protocol.d.ts.map +1 -1
- package/dist/embed-protocol.js +1 -1
- package/dist/embed-protocol.js.map +1 -1
- package/dist/errors.d.ts +15 -15
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +18 -18
- package/dist/errors.js.map +1 -1
- package/dist/forms-core/autocomplete.d.ts +3 -3
- package/dist/forms-core/autocomplete.d.ts.map +1 -1
- package/dist/forms-core/autocomplete.js +2 -2
- package/dist/forms-core/controller.d.ts +10 -10
- package/dist/forms-core/controller.d.ts.map +1 -1
- package/dist/forms-core/controller.js +4 -4
- package/dist/forms-core/controller.js.map +1 -1
- package/dist/forms-core/elements.d.ts +4 -4
- package/dist/forms-core/elements.d.ts.map +1 -1
- package/dist/forms-core/elements.js +7 -7
- package/dist/forms-core/elements.js.map +1 -1
- package/dist/forms-core/formula.d.ts +1 -1
- package/dist/forms-core/formula.js +1 -1
- package/dist/forms-core/index.d.ts +6 -6
- package/dist/forms-core/index.d.ts.map +1 -1
- package/dist/forms-core/index.js +5 -5
- package/dist/forms-core/index.js.map +1 -1
- package/dist/forms-core/units.d.ts +1 -1
- package/dist/forms-core/units.js +1 -1
- package/dist/forms-core/us-states.d.ts +1 -1
- package/dist/forms-core/us-states.js +1 -1
- package/dist/forms-core/validation.d.ts +12 -3
- package/dist/forms-core/validation.d.ts.map +1 -1
- package/dist/forms-core/validation.js +152 -17
- package/dist/forms-core/validation.js.map +1 -1
- package/dist/forms.d.ts +2 -2
- package/dist/forms.d.ts.map +1 -1
- package/dist/forms.js +2 -2
- package/dist/forms.js.map +1 -1
- package/dist/framework-support.js +1 -1
- package/dist/framework-support.js.map +1 -1
- package/dist/gallery-types.d.ts +1 -1
- package/dist/graphql.d.ts +3 -3
- package/dist/graphql.d.ts.map +1 -1
- package/dist/graphql.js +3 -3
- package/dist/graphql.js.map +1 -1
- package/dist/index.cjs +351 -272
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/legal-core/index.cjs +8 -8
- package/dist/legal-core/index.d.ts +3 -3
- package/dist/legal-core/index.d.ts.map +1 -1
- package/dist/legal-core/index.js +11 -11
- package/dist/legal-core/index.js.map +1 -1
- package/dist/marketing-core/index.d.ts +51 -1
- package/dist/marketing-core/index.d.ts.map +1 -1
- package/dist/marketing-core/index.js +35 -0
- package/dist/marketing-core/index.js.map +1 -1
- package/dist/marketing-schema.d.ts +9 -9
- package/dist/marketing-schema.d.ts.map +1 -1
- package/dist/marketing-schema.js +1 -1
- package/dist/mcp.d.ts +4 -4
- package/dist/mcp.js +4 -4
- package/dist/native.d.ts +6 -6
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js +4 -4
- package/dist/native.js.map +1 -1
- package/dist/next-revalidate.d.ts +8 -8
- package/dist/next-revalidate.d.ts.map +1 -1
- package/dist/next-revalidate.js +7 -7
- package/dist/next-revalidate.js.map +1 -1
- package/dist/notifications-core/index.d.ts +1 -1
- package/dist/notifications-core/index.js +1 -1
- package/dist/parallel-pages.d.ts +4 -4
- package/dist/parallel-pages.d.ts.map +1 -1
- package/dist/parallel-pages.js +5 -5
- package/dist/parallel-pages.js.map +1 -1
- package/dist/portal-core/index.d.ts +1 -1
- package/dist/portal-core/index.js +1 -1
- package/dist/proxy.d.ts +18 -18
- package/dist/proxy.d.ts.map +1 -1
- package/dist/proxy.js +10 -10
- package/dist/proxy.js.map +1 -1
- package/dist/push-core/index.cjs +6 -2
- package/dist/push-core/index.d.ts +1 -1
- package/dist/push-core/index.d.ts.map +1 -1
- package/dist/push-core/index.js +6 -2
- package/dist/push-core/index.js.map +1 -1
- package/dist/react-analytics.d.ts +14 -14
- package/dist/react-analytics.d.ts.map +1 -1
- package/dist/react-analytics.js +15 -15
- package/dist/react-analytics.js.map +1 -1
- package/dist/react-attribution.d.ts +2 -2
- package/dist/react-attribution.d.ts.map +1 -1
- package/dist/react-attribution.js +1 -1
- package/dist/react-marketing.js +5 -5
- package/dist/react-marketing.js.map +1 -1
- package/dist/react.d.ts +38 -61
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +247 -261
- package/dist/react.js.map +1 -1
- package/dist/reserved-paths.d.ts +2 -2
- package/dist/reserved-paths.js +3 -3
- package/dist/reserved-paths.js.map +1 -1
- package/dist/revalidate-verify.d.ts +3 -3
- package/dist/revalidate-verify.d.ts.map +1 -1
- package/dist/revalidate-verify.js +1 -1
- package/dist/revalidate-verify.js.map +1 -1
- package/dist/sdk.d.ts +51 -45
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +48 -50
- package/dist/sdk.js.map +1 -1
- package/dist/seed-core/index.js +8 -8
- package/dist/seed-core/index.js.map +1 -1
- package/dist/seo-core/blog.d.ts +1 -1
- package/dist/seo-core/blog.js +1 -1
- package/dist/seo-core/blog.js.map +1 -1
- package/dist/seo-core/index.cjs +2 -2
- package/dist/seo-core/index.js +1 -1
- package/dist/seo-core/index.js.map +1 -1
- package/dist/seo.d.ts +1 -1
- package/dist/seo.d.ts.map +1 -1
- package/dist/seo.js +1 -1
- package/dist/seo.js.map +1 -1
- package/dist/sitemap-core/index.cjs +5 -5
- package/dist/sitemap-core/index.d.ts +13 -5
- package/dist/sitemap-core/index.d.ts.map +1 -1
- package/dist/sitemap-core/index.js +4 -4
- package/dist/sitemap-core/index.js.map +1 -1
- package/dist/socials.d.ts +6 -6
- package/dist/socials.d.ts.map +1 -1
- package/dist/socials.js +5 -5
- package/dist/socials.js.map +1 -1
- package/dist/solid-compat.d.ts +1 -1
- package/dist/solid-compat.js +4 -4
- package/dist/solid-compat.js.map +1 -1
- package/dist/store-core/index.d.ts +1 -1
- package/dist/vanilla.d.ts +12 -12
- package/dist/vanilla.d.ts.map +1 -1
- package/dist/vanilla.js +192 -145
- package/dist/vanilla.js.map +1 -1
- package/openapi.json +264 -1
- package/package.json +8 -8
- package/src/account-core/index.ts +1 -1
- package/src/adapters-revalidate.ts +3 -3
- package/src/analytics-core.ts +8 -8
- package/src/analytics-server.ts +6 -6
- package/src/angular/{biab-form.component.ts → bd-form.component.ts} +269 -161
- package/src/angular/headless.ts +12 -12
- package/src/angular/index.ts +9 -9
- package/src/auth-handler.ts +22 -22
- package/src/auth-links.ts +2 -2
- package/src/cli.ts +81 -81
- package/src/client.ts +218 -193
- package/src/consent-core/index.ts +10 -8
- package/src/contracts.ts +99 -15
- package/src/data-model-schema.ts +29 -26
- package/src/distribution.ts +5 -5
- package/src/element.ts +54 -54
- package/src/embed-protocol.ts +14 -14
- package/src/errors.ts +27 -27
- package/src/forms-core/autocomplete.ts +3 -3
- package/src/forms-core/controller.ts +12 -12
- package/src/forms-core/elements.ts +7 -7
- package/src/forms-core/formula.ts +1 -1
- package/src/forms-core/index.ts +8 -8
- package/src/forms-core/units.ts +1 -1
- package/src/forms-core/us-states.ts +1 -1
- package/src/forms-core/validation.ts +158 -14
- package/src/forms.ts +2 -2
- package/src/framework-support.ts +1 -1
- package/src/gallery-types.ts +1 -1
- package/src/graphql.ts +4 -4
- package/src/index.ts +38 -38
- package/src/legal-core/index.ts +12 -12
- package/src/marketing-core/index.ts +62 -0
- package/src/marketing-schema.ts +9 -9
- package/src/mcp.ts +4 -4
- package/src/native.ts +14 -14
- package/src/next-revalidate.ts +10 -10
- package/src/notifications-core/index.ts +1 -1
- package/src/parallel-pages.ts +6 -6
- package/src/portal-core/index.ts +1 -1
- package/src/proxy.ts +28 -28
- package/src/push-core/index.ts +11 -5
- package/src/qwik.tsx +262 -166
- package/src/react-analytics.tsx +17 -17
- package/src/react-attribution.tsx +2 -2
- package/src/react-marketing.tsx +5 -5
- package/src/react.tsx +541 -500
- package/src/reserved-paths.ts +3 -3
- package/src/revalidate-verify.ts +5 -5
- package/src/sdk.ts +131 -101
- package/src/seed-core/index.ts +8 -8
- package/src/seo-core/blog.ts +2 -2
- package/src/seo-core/index.ts +1 -1
- package/src/seo.ts +1 -1
- package/src/sitemap-core/index.ts +17 -9
- package/src/socials.ts +6 -6
- package/src/solid-compat.tsx +5 -5
- package/src/solid-surfaces.tsx +28 -28
- package/src/solid.tsx +264 -175
- package/src/store-core/index.ts +1 -1
- package/src/styles/{biab-forms.css → bd-forms.css} +158 -158
- package/src/svelte/{BiabForm.svelte → BdForm.svelte} +240 -173
- package/src/svelte/context.ts +16 -16
- package/src/svelte/headless.ts +10 -10
- package/src/svelte/index.ts +16 -16
- package/src/vanilla.ts +250 -169
- package/src/vue/{BiabForm.vue → BdForm.vue} +270 -157
- package/src/vue/headless.ts +11 -11
- package/src/vue/index.ts +26 -26
package/dist/cli.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* `
|
|
3
|
+
* `bd` CLI entry point.
|
|
4
4
|
*
|
|
5
5
|
* Two independent flows, deliberately sharing nothing but transport
|
|
6
6
|
* conventions — a website's content shape and an org's database shape are
|
|
7
7
|
* different artifacts, with different review cadence and blast radius.
|
|
8
8
|
*
|
|
9
|
-
* WEBSITE CONTENT (`
|
|
9
|
+
* WEBSITE CONTENT (`bd.config.{ts,mjs,js}`):
|
|
10
10
|
* - `sync-schema` — resolve the config, compute the canonical SHA-256,
|
|
11
11
|
* POST to the draft-schema endpoint. Idempotent.
|
|
12
12
|
* - `sync-content` — walk `<contentSync.rootDir>/<locale>/<page>/
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* Per-row failures are reported but don't abort.
|
|
15
15
|
* - `print-schema` — resolved schema + checksum, no upload.
|
|
16
16
|
*
|
|
17
|
-
* CUSTOM DATABASE (`
|
|
17
|
+
* CUSTOM DATABASE (`bd.data-model.config.{ts,mjs,js}`):
|
|
18
18
|
* - `view-data-model` — what's LIVE (not what was last pushed — the
|
|
19
19
|
* dashboard writes this model too). `--diff` for the
|
|
20
20
|
* migration plan, `--out` to scaffold a config.
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
* change record contents, so its backup and confirmation guards are
|
|
37
37
|
* load-bearing.
|
|
38
38
|
*
|
|
39
|
-
* Auth: `
|
|
39
|
+
* Auth: `BD_API_KEY`, `BD_SITE_ID`, and `BD_PACKAGE_API_BASE_URL` from
|
|
40
40
|
* the environment (or a `.env` / `.env.local` in the cwd). Scopes:
|
|
41
41
|
* `marketing:write_schema` / `marketing:write_content` for the website flow;
|
|
42
42
|
* `metadata:read_schema` (view/plan), `metadata:write_schema` (push), and
|
|
@@ -75,29 +75,29 @@ const SEED_CONFIG_CANDIDATES = [
|
|
|
75
75
|
"businessdash.seed.ts",
|
|
76
76
|
"businessdash.seed.mjs",
|
|
77
77
|
"businessdash.seed.js",
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
78
|
+
"bd.seed.ts",
|
|
79
|
+
"bd.seed.mjs",
|
|
80
|
+
"bd.seed.js",
|
|
81
81
|
];
|
|
82
82
|
/** Config candidates per flow. The marketing and data-model configs are
|
|
83
83
|
* deliberately different files: different artifacts, different blast radius.
|
|
84
|
-
* `businessdash.*` names are preferred going forward; the `
|
|
84
|
+
* `businessdash.*` names are preferred going forward; the `bd.*` names
|
|
85
85
|
* remain a permanent filesystem contract with every existing consumer. */
|
|
86
86
|
const MARKETING_CONFIG_CANDIDATES = [
|
|
87
87
|
"businessdash.config.ts",
|
|
88
88
|
"businessdash.config.mjs",
|
|
89
89
|
"businessdash.config.js",
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
90
|
+
"bd.config.ts",
|
|
91
|
+
"bd.config.mjs",
|
|
92
|
+
"bd.config.js",
|
|
93
93
|
];
|
|
94
94
|
const DATA_MODEL_CONFIG_CANDIDATES = [
|
|
95
95
|
"businessdash.data-model.config.ts",
|
|
96
96
|
"businessdash.data-model.config.mjs",
|
|
97
97
|
"businessdash.data-model.config.js",
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
98
|
+
"bd.data-model.config.ts",
|
|
99
|
+
"bd.data-model.config.mjs",
|
|
100
|
+
"bd.data-model.config.js",
|
|
101
101
|
];
|
|
102
102
|
// V7-styled output: matches the dashboard's status-pill colors so the
|
|
103
103
|
// CLI feels like the same product (✓ = "done" green-accent, ⚠ =
|
|
@@ -112,7 +112,7 @@ const fg = {
|
|
|
112
112
|
bold: (s) => (USE_COLOR ? `\x1b[1m${s}\x1b[0m` : s),
|
|
113
113
|
};
|
|
114
114
|
function logStep(msg) {
|
|
115
|
-
console.log(`[
|
|
115
|
+
console.log(`[bd] ${msg}`);
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
118
|
* A single progress line for long, batched work.
|
|
@@ -145,7 +145,7 @@ function makeProgress(total) {
|
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
function logError(msg) {
|
|
148
|
-
console.error(`[
|
|
148
|
+
console.error(`[bd] ${msg}`);
|
|
149
149
|
}
|
|
150
150
|
function parseEnvFile(path) {
|
|
151
151
|
if (!existsSync(path))
|
|
@@ -196,7 +196,7 @@ function findDataModelConfigPath(cwd, override) {
|
|
|
196
196
|
return findConfigPath(cwd, override, DATA_MODEL_CONFIG_CANDIDATES, "Create one with `defineDataModel({...})` exported as default.");
|
|
197
197
|
}
|
|
198
198
|
/**
|
|
199
|
-
* Load the consumer's `
|
|
199
|
+
* Load the consumer's `bd.config.*`. Supports .ts (via the
|
|
200
200
|
* consumer's tsx / ts-node setup — we only invoke if `--require tsx`
|
|
201
201
|
* or `tsx`/`ts-node` registered the loader), .mjs (native ESM), and
|
|
202
202
|
* .js (CJS or ESM depending on package.json).
|
|
@@ -226,7 +226,7 @@ async function loadConfig(configPath) {
|
|
|
226
226
|
function normalizeBaseUrl(input) {
|
|
227
227
|
let next = input.trim();
|
|
228
228
|
if (!/^https?:\/\//i.test(next)) {
|
|
229
|
-
throw new Error(`
|
|
229
|
+
throw new Error(`BD_PACKAGE_API_BASE_URL must start with http(s):// — got "${input}".`);
|
|
230
230
|
}
|
|
231
231
|
if (!next.endsWith("/api/package/v1") && !next.endsWith("/api/package/v1/")) {
|
|
232
232
|
// Accept either the bare host or the full prefix; canonicalize to
|
|
@@ -246,7 +246,7 @@ async function cmdSyncSchema(opts) {
|
|
|
246
246
|
const schema = await loadConfig(opts.configPath);
|
|
247
247
|
const artifact = schema.toJSONSchema();
|
|
248
248
|
const checksum = await schema.checksum();
|
|
249
|
-
// Reject any `contentSync.pages[].pageKey` that collides with a
|
|
249
|
+
// Reject any `contentSync.pages[].pageKey` that collides with a BD
|
|
250
250
|
// platform-reserved route. Catches the misconfiguration before any
|
|
251
251
|
// upload happens.
|
|
252
252
|
const declaredPages = schema.contentSync?.pages ?? [];
|
|
@@ -263,16 +263,16 @@ async function cmdSyncSchema(opts) {
|
|
|
263
263
|
logStep("--dry-run was set, skipping upload.");
|
|
264
264
|
return;
|
|
265
265
|
}
|
|
266
|
-
const apiKey = opts.env["
|
|
267
|
-
const siteId = opts.env["
|
|
268
|
-
const rawBase = opts.env["
|
|
269
|
-
opts.env["
|
|
266
|
+
const apiKey = opts.env["BD_API_KEY"];
|
|
267
|
+
const siteId = opts.env["BD_SITE_ID"];
|
|
268
|
+
const rawBase = opts.env["BD_PACKAGE_API_BASE_URL"] ??
|
|
269
|
+
opts.env["NEXT_PUBLIC_BD_PACKAGE_API_BASE_URL"];
|
|
270
270
|
if (!apiKey)
|
|
271
|
-
throw new Error("Missing
|
|
271
|
+
throw new Error("Missing BD_API_KEY in env or .env.local.");
|
|
272
272
|
if (!siteId)
|
|
273
|
-
throw new Error("Missing
|
|
273
|
+
throw new Error("Missing BD_SITE_ID in env or .env.local.");
|
|
274
274
|
if (!rawBase) {
|
|
275
|
-
throw new Error("Missing
|
|
275
|
+
throw new Error("Missing BD_PACKAGE_API_BASE_URL in env or .env.local (e.g. https://your-host.tld/api/package/v1).");
|
|
276
276
|
}
|
|
277
277
|
const baseUrl = normalizeBaseUrl(rawBase);
|
|
278
278
|
const target = `${baseUrl}/sites/${encodeURIComponent(siteId)}/marketing/draft-schema`;
|
|
@@ -349,16 +349,16 @@ async function loadDataModelConfig(configPath) {
|
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
351
|
function resolveApiTarget(env) {
|
|
352
|
-
const apiKey = env["
|
|
353
|
-
const siteId = env["
|
|
354
|
-
const rawBase = env["
|
|
355
|
-
env["
|
|
352
|
+
const apiKey = env["BD_API_KEY"];
|
|
353
|
+
const siteId = env["BD_SITE_ID"];
|
|
354
|
+
const rawBase = env["BD_PACKAGE_API_BASE_URL"] ??
|
|
355
|
+
env["NEXT_PUBLIC_BD_PACKAGE_API_BASE_URL"];
|
|
356
356
|
if (!apiKey)
|
|
357
|
-
throw new Error("Missing
|
|
357
|
+
throw new Error("Missing BD_API_KEY in env or .env.local.");
|
|
358
358
|
if (!siteId)
|
|
359
|
-
throw new Error("Missing
|
|
359
|
+
throw new Error("Missing BD_SITE_ID in env or .env.local.");
|
|
360
360
|
if (!rawBase) {
|
|
361
|
-
throw new Error("Missing
|
|
361
|
+
throw new Error("Missing BD_PACKAGE_API_BASE_URL in env or .env.local (e.g. https://your-host.tld/api/package/v1).");
|
|
362
362
|
}
|
|
363
363
|
return { baseUrl: normalizeBaseUrl(rawBase), apiKey, siteId };
|
|
364
364
|
}
|
|
@@ -489,7 +489,7 @@ async function cmdViewDataModel(opts) {
|
|
|
489
489
|
* Commit the file next to your code and it becomes a Drizzle/Convex-style
|
|
490
490
|
* snapshot: deterministic ordering means successive exports git-diff cleanly,
|
|
491
491
|
* so an AI agent (or a human) can read the collection's state and how it
|
|
492
|
-
* changed over time without querying
|
|
492
|
+
* changed over time without querying BD live. It also re-seeds a fresh org —
|
|
493
493
|
* the `schema` half is the same shape `sync-data-model` pushes, the `records`
|
|
494
494
|
* half is the same shape `sync-records` ingests.
|
|
495
495
|
*/
|
|
@@ -505,7 +505,7 @@ async function cmdExportDataModel(opts) {
|
|
|
505
505
|
? isAbsolute(opts.out)
|
|
506
506
|
? opts.out
|
|
507
507
|
: resolve(opts.cwd, opts.out)
|
|
508
|
-
: resolve(opts.cwd, "
|
|
508
|
+
: resolve(opts.cwd, "bd.data-model.snapshot.json");
|
|
509
509
|
writeFileSync(outPath, `${JSON.stringify(seed, null, 2)}\n`, "utf8");
|
|
510
510
|
const c = seed.counts;
|
|
511
511
|
logStep(`${fg.green("✓")} Wrote ${outPath}`);
|
|
@@ -546,7 +546,7 @@ async function cmdExportGraphqlSchema(opts) {
|
|
|
546
546
|
? isAbsolute(opts.out)
|
|
547
547
|
? opts.out
|
|
548
548
|
: resolve(opts.cwd, opts.out)
|
|
549
|
-
: resolve(opts.cwd, "
|
|
549
|
+
: resolve(opts.cwd, "bd.data-model.graphql");
|
|
550
550
|
writeFileSync(outPath, sdl, "utf8");
|
|
551
551
|
const typeCount = (sdl.match(/^type \w/gm) ?? []).length;
|
|
552
552
|
logStep(`${fg.green("✓")} Wrote ${outPath}`);
|
|
@@ -559,9 +559,9 @@ async function cmdExportGraphqlSchema(opts) {
|
|
|
559
559
|
*/
|
|
560
560
|
function renderConfigModule(objects) {
|
|
561
561
|
const lines = [
|
|
562
|
-
"// Generated by `
|
|
562
|
+
"// Generated by `bd view-data-model --out`.",
|
|
563
563
|
"// This is your org's live data model, as code. Edit it, push it with",
|
|
564
|
-
"// `
|
|
564
|
+
"// `bd sync-data-model`, then promote in the dashboard.",
|
|
565
565
|
"",
|
|
566
566
|
'import { createSchema, defineCollection, defineField } from "@businessdash/sdk";',
|
|
567
567
|
"",
|
|
@@ -1292,7 +1292,7 @@ async function cmdWipeDatabase(opts) {
|
|
|
1292
1292
|
}
|
|
1293
1293
|
}
|
|
1294
1294
|
else if (keep.length === 0) {
|
|
1295
|
-
logStep(fg.dim("Schema draft unchanged — all collections were removed from the config. Remove or edit
|
|
1295
|
+
logStep(fg.dim("Schema draft unchanged — all collections were removed from the config. Remove or edit bd.data-model.config.ts to rebuild."));
|
|
1296
1296
|
}
|
|
1297
1297
|
console.log("");
|
|
1298
1298
|
logStep(`${fg.green("✓")} Data wiped for ${removed.map((o) => String(o["nameSingular"] ?? "?")).join(", ")}.`);
|
|
@@ -1433,7 +1433,7 @@ async function postSectionBatch(input) {
|
|
|
1433
1433
|
catch {
|
|
1434
1434
|
const looksHtml = /^\s*<(?:!doctype|html|head|body)/i.test(bodyText);
|
|
1435
1435
|
if (looksHtml) {
|
|
1436
|
-
message = `${message} (server returned an HTML page, not JSON — the bulk-upsert route may not exist on this host yet. Make sure
|
|
1436
|
+
message = `${message} (server returned an HTML page, not JSON — the bulk-upsert route may not exist on this host yet. Make sure BD is deployed with the marketing/sections endpoint, and that BD_PACKAGE_API_BASE_URL points at the right host.)`;
|
|
1437
1437
|
}
|
|
1438
1438
|
else if (bodyText.trim()) {
|
|
1439
1439
|
message = `${message} — ${bodyText.slice(0, 240).trim()}`;
|
|
@@ -1480,7 +1480,7 @@ async function cmdSyncContent(opts) {
|
|
|
1480
1480
|
for (const w of warnings) {
|
|
1481
1481
|
console.log(` ${fg.amber("⚠")} ${fg.dim(w.message)}`);
|
|
1482
1482
|
}
|
|
1483
|
-
// Reject content syncs that target a
|
|
1483
|
+
// Reject content syncs that target a BD-reserved pageKey. We dedupe
|
|
1484
1484
|
// so we report each offending key once rather than per-file.
|
|
1485
1485
|
const reservedKeys = Array.from(new Set(items
|
|
1486
1486
|
.filter((it) => isReservedPagePath(it.pageKey))
|
|
@@ -1502,16 +1502,16 @@ async function cmdSyncContent(opts) {
|
|
|
1502
1502
|
}
|
|
1503
1503
|
return;
|
|
1504
1504
|
}
|
|
1505
|
-
const apiKey = opts.env["
|
|
1506
|
-
const siteId = opts.env["
|
|
1507
|
-
const rawBase = opts.env["
|
|
1508
|
-
opts.env["
|
|
1505
|
+
const apiKey = opts.env["BD_API_KEY"];
|
|
1506
|
+
const siteId = opts.env["BD_SITE_ID"];
|
|
1507
|
+
const rawBase = opts.env["BD_PACKAGE_API_BASE_URL"] ??
|
|
1508
|
+
opts.env["NEXT_PUBLIC_BD_PACKAGE_API_BASE_URL"];
|
|
1509
1509
|
if (!apiKey)
|
|
1510
|
-
throw new Error("Missing
|
|
1510
|
+
throw new Error("Missing BD_API_KEY in env or .env.local.");
|
|
1511
1511
|
if (!siteId)
|
|
1512
|
-
throw new Error("Missing
|
|
1512
|
+
throw new Error("Missing BD_SITE_ID in env or .env.local.");
|
|
1513
1513
|
if (!rawBase) {
|
|
1514
|
-
throw new Error("Missing
|
|
1514
|
+
throw new Error("Missing BD_PACKAGE_API_BASE_URL in env or .env.local (e.g. https://your-host.tld/api/package/v1).");
|
|
1515
1515
|
}
|
|
1516
1516
|
const baseUrl = normalizeBaseUrl(rawBase);
|
|
1517
1517
|
const BATCH_SIZE = 64; // well under the server's 256 cap; smaller = faster failure feedback
|
|
@@ -1573,27 +1573,27 @@ async function cmdSyncContent(opts) {
|
|
|
1573
1573
|
}
|
|
1574
1574
|
}
|
|
1575
1575
|
function printHelp() {
|
|
1576
|
-
console.log(`
|
|
1576
|
+
console.log(`bd — Business In A Box developer CLI
|
|
1577
1577
|
|
|
1578
|
-
Run via your package runner —
|
|
1579
|
-
npx
|
|
1578
|
+
Run via your package runner — bd is a package bin, not a global:
|
|
1579
|
+
npx bd <command> (or: pnpm exec bd <command>)
|
|
1580
1580
|
|
|
1581
|
-
WEBSITE CONTENT (
|
|
1582
|
-
npx
|
|
1583
|
-
npx
|
|
1584
|
-
npx
|
|
1581
|
+
WEBSITE CONTENT (bd.config.ts)
|
|
1582
|
+
npx bd sync-schema [--config path] [--dry-run]
|
|
1583
|
+
npx bd sync-content [--config path] [--dry-run] [--lax] [--note "first import"]
|
|
1584
|
+
npx bd print-schema [--config path]
|
|
1585
1585
|
|
|
1586
|
-
CUSTOM DATABASE (
|
|
1587
|
-
npx
|
|
1588
|
-
npx
|
|
1589
|
-
npx
|
|
1590
|
-
npx
|
|
1591
|
-
npx
|
|
1592
|
-
npx
|
|
1593
|
-
npx
|
|
1594
|
-
npx
|
|
1595
|
-
npx
|
|
1596
|
-
npx
|
|
1586
|
+
CUSTOM DATABASE (bd.data-model.config.ts)
|
|
1587
|
+
npx bd view-data-model [--json] [--diff] [--out path] [--prune]
|
|
1588
|
+
npx bd print-data-model [--config path]
|
|
1589
|
+
npx bd export-data-model [--out path] [--schema-only]
|
|
1590
|
+
npx bd export-graphql-schema [--out path] [--include-standard]
|
|
1591
|
+
npx bd sync-data-model [--config path] [--dry-run] [--prune] [--forms [slugs]] [--no-forms] [--note "..."]
|
|
1592
|
+
npx bd sync-records [--records-dir path] [--dry-run]
|
|
1593
|
+
npx bd seed [--config path] [--dry-run] [--yes]
|
|
1594
|
+
npx bd wipe-collections --collections name-a,name-b [--dry-run]
|
|
1595
|
+
npx bd wipe-database --collections name-a,name-b [--config path] [--dry-run] [--yes]
|
|
1596
|
+
npx bd wipe-database --all [--config path] [--dry-run] [--yes]
|
|
1597
1597
|
|
|
1598
1598
|
seed run businessdash.seed.ts — schema, records, static collections,
|
|
1599
1599
|
products, blog posts and coupons, in dependency order. Products and
|
|
@@ -1601,18 +1601,18 @@ CUSTOM DATABASE (biab.data-model.config.ts)
|
|
|
1601
1601
|
promote in the dashboard. A destructive schema plan refuses unless
|
|
1602
1602
|
you pass --yes. Same code path as runSeed() from @businessdash/sdk/seed.
|
|
1603
1603
|
|
|
1604
|
-
view what's LIVE in
|
|
1604
|
+
view what's LIVE in BD right now (the dashboard can change it too, so
|
|
1605
1605
|
this is not just "what I last pushed")
|
|
1606
1606
|
print what your local config resolves to — no network
|
|
1607
1607
|
export pull the WHOLE custom database — schema + records + relations — into
|
|
1608
|
-
one portable snapshot (default: ./
|
|
1608
|
+
one portable snapshot (default: ./bd.data-model.snapshot.json).
|
|
1609
1609
|
Deterministic order, so committing it gives a git-diffable history an
|
|
1610
|
-
AI agent can read without querying
|
|
1610
|
+
AI agent can read without querying BD. Re-seeds a fresh org via
|
|
1611
1611
|
sync-data-model (schema) + sync-records (rows). --schema-only skips
|
|
1612
1612
|
the row scan. Needs metadata:read_schema + metadata:read_records.
|
|
1613
1613
|
export-graphql-schema
|
|
1614
1614
|
render a GraphQL SDL schema of your custom collections (default:
|
|
1615
|
-
./
|
|
1615
|
+
./bd.data-model.graphql) — every object a type, relations as lists,
|
|
1616
1616
|
SELECTs as enums where valid. Feed it to GraphQL codegen or commit it
|
|
1617
1617
|
as a typed contract. Schema only; this does not run a GraphQL server.
|
|
1618
1618
|
--include-standard also emits standard CRM types. Needs
|
|
@@ -1620,7 +1620,7 @@ CUSTOM DATABASE (biab.data-model.config.ts)
|
|
|
1620
1620
|
sync push your config to the draft slot. Prints the migration plan first;
|
|
1621
1621
|
nothing changes until you promote in the dashboard.
|
|
1622
1622
|
|
|
1623
|
-
seed upsert rows from JSON (default dir: ./
|
|
1623
|
+
seed upsert rows from JSON (default dir: ./bd-records). Each file is an
|
|
1624
1624
|
array of { object, universalIdentifier, values, relations? }; identity
|
|
1625
1625
|
is what makes re-running converge instead of duplicating. relations
|
|
1626
1626
|
links rows by the TARGET row's universalIdentifier, e.g.
|
|
@@ -1650,16 +1650,16 @@ CUSTOM DATABASE (biab.data-model.config.ts)
|
|
|
1650
1650
|
--no-forms push only collections. Generated forms are created inactive on
|
|
1651
1651
|
promotion and must be activated separately in the dashboard.
|
|
1652
1652
|
|
|
1653
|
-
npx
|
|
1653
|
+
npx bd help
|
|
1654
1654
|
|
|
1655
1655
|
Environment (read from process.env, .env, or .env.local in the cwd):
|
|
1656
|
-
|
|
1656
|
+
BD_API_KEY API key. Website flow needs marketing:write_schema
|
|
1657
1657
|
/ marketing:write_content. Data-model flow needs
|
|
1658
1658
|
metadata:read_schema (view/plan) and
|
|
1659
1659
|
metadata:write_schema (push) or
|
|
1660
1660
|
metadata:write_records (seed/wipe).
|
|
1661
|
-
|
|
1662
|
-
|
|
1661
|
+
BD_SITE_ID UUID of the site to publish to
|
|
1662
|
+
BD_PACKAGE_API_BASE_URL Host URL (any path; the CLI canonicalises
|
|
1663
1663
|
to "<origin>/api/package/v1" automatically).
|
|
1664
1664
|
Use the APEX host — e.g. https://biab.app, NOT
|
|
1665
1665
|
https://www.biab.app. A www→apex redirect makes
|
|
@@ -1675,8 +1675,8 @@ two interactive confirmations. wipe-database combines a data wipe with a
|
|
|
1675
1675
|
pruned schema push for developer convenience.
|
|
1676
1676
|
|
|
1677
1677
|
Config files (override either with --config path):
|
|
1678
|
-
|
|
1679
|
-
|
|
1678
|
+
bd.config.ts → defineSiteMarketingSchema (website content)
|
|
1679
|
+
bd.data-model.config.ts → createFormSchemaOrchestrator / createSchema
|
|
1680
1680
|
|
|
1681
1681
|
sync-content also reads the optional \`contentSync\` field on your
|
|
1682
1682
|
defineSiteMarketingSchema({...}) call. Minimal form (default layout
|
|
@@ -1719,7 +1719,7 @@ function parseArgs(argv) {
|
|
|
1719
1719
|
diff: false,
|
|
1720
1720
|
out: null,
|
|
1721
1721
|
prune: false,
|
|
1722
|
-
recordsDir: "
|
|
1722
|
+
recordsDir: "bd-records",
|
|
1723
1723
|
forms: "prompt",
|
|
1724
1724
|
collections: [],
|
|
1725
1725
|
yes: false,
|