@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/src/angular/headless.ts
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
type ChatSnapshot,
|
|
24
24
|
createChatController,
|
|
25
25
|
} from "../chat-core/index.js";
|
|
26
|
-
import {
|
|
26
|
+
import { BdApiClient } from "../client.js";
|
|
27
27
|
import {
|
|
28
28
|
createPortalController,
|
|
29
29
|
type PortalSnapshot,
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
type CheckoutSnapshot,
|
|
55
55
|
createCheckoutController,
|
|
56
56
|
} from "../checkout-core/index.js";
|
|
57
|
-
import {
|
|
57
|
+
import { createBdClient } from "../sdk.js";
|
|
58
58
|
|
|
59
59
|
import type {
|
|
60
60
|
BlogCommentPostInput,
|
|
@@ -132,7 +132,7 @@ export function createStorefront(
|
|
|
132
132
|
options: CreateStorefrontOptions,
|
|
133
133
|
): StorefrontHandle {
|
|
134
134
|
const controller = createStoreController({
|
|
135
|
-
client: new
|
|
135
|
+
client: new BdApiClient({
|
|
136
136
|
apiKey: options.apiKey,
|
|
137
137
|
baseUrl: options.baseUrl,
|
|
138
138
|
}),
|
|
@@ -170,7 +170,7 @@ export type ChatHandle = {
|
|
|
170
170
|
/** Headless Front Desk chat — the native alternative to `<Chatbot>`. */
|
|
171
171
|
export function createChat(options: CreateChatOptions): ChatHandle {
|
|
172
172
|
const controller = createChatController({
|
|
173
|
-
client: new
|
|
173
|
+
client: new BdApiClient({
|
|
174
174
|
apiKey: options.apiKey,
|
|
175
175
|
baseUrl: options.baseUrl,
|
|
176
176
|
}),
|
|
@@ -208,7 +208,7 @@ export type BlogHandle = {
|
|
|
208
208
|
/** Headless blog — the native alternative to `<Blog>`. */
|
|
209
209
|
export function createBlog(options: CreateBlogOptions): BlogHandle {
|
|
210
210
|
const controller = createBlogController({
|
|
211
|
-
client: new
|
|
211
|
+
client: new BdApiClient({
|
|
212
212
|
apiKey: options.apiKey,
|
|
213
213
|
baseUrl: options.baseUrl,
|
|
214
214
|
}),
|
|
@@ -244,7 +244,7 @@ export function createCheckout(
|
|
|
244
244
|
options: CreateCheckoutOptions,
|
|
245
245
|
): CheckoutHandle {
|
|
246
246
|
const controller = createCheckoutController({
|
|
247
|
-
client: new
|
|
247
|
+
client: new BdApiClient({
|
|
248
248
|
apiKey: options.apiKey,
|
|
249
249
|
baseUrl: options.baseUrl,
|
|
250
250
|
}),
|
|
@@ -288,7 +288,7 @@ export function createFollowers(
|
|
|
288
288
|
options: CreateFollowersOptions,
|
|
289
289
|
): FollowersHandle {
|
|
290
290
|
const controller = createFollowersController({
|
|
291
|
-
client:
|
|
291
|
+
client: createBdClient({
|
|
292
292
|
apiKey: options.token,
|
|
293
293
|
siteId: options.siteId,
|
|
294
294
|
...(options.baseUrl ? { baseUrl: options.baseUrl } : {}),
|
|
@@ -325,7 +325,7 @@ export type CreateMarketingOptions = {
|
|
|
325
325
|
/** Headless marketing pages — the index, plus one page at a time. */
|
|
326
326
|
export function createMarketing(options: CreateMarketingOptions) {
|
|
327
327
|
const controller = createMarketingController({
|
|
328
|
-
client:
|
|
328
|
+
client: createBdClient({
|
|
329
329
|
apiKey: options.token,
|
|
330
330
|
siteId: options.siteId,
|
|
331
331
|
...(options.baseUrl ? { baseUrl: options.baseUrl } : {}),
|
|
@@ -351,7 +351,7 @@ export type CreateVerifyOptions = {
|
|
|
351
351
|
export function createVerify(options: CreateVerifyOptions) {
|
|
352
352
|
const { apiKey, baseUrl, ...rest } = options;
|
|
353
353
|
const controller = createVerifyController({
|
|
354
|
-
client: new
|
|
354
|
+
client: new BdApiClient({ apiKey, baseUrl }),
|
|
355
355
|
...rest,
|
|
356
356
|
});
|
|
357
357
|
const { state, dispose } = bridge(controller);
|
|
@@ -386,7 +386,7 @@ export type CreatePortalOptions = {
|
|
|
386
386
|
*/
|
|
387
387
|
export function createPortal(options: CreatePortalOptions) {
|
|
388
388
|
const controller = createPortalController({
|
|
389
|
-
client: new
|
|
389
|
+
client: new BdApiClient({
|
|
390
390
|
apiKey: options.apiKey,
|
|
391
391
|
baseUrl: options.baseUrl,
|
|
392
392
|
}),
|
|
@@ -453,7 +453,7 @@ import {
|
|
|
453
453
|
* `.html`, which keeps it inside this package's typecheck.
|
|
454
454
|
*/
|
|
455
455
|
@Component({
|
|
456
|
-
selector: "
|
|
456
|
+
selector: "bd-social-links",
|
|
457
457
|
standalone: true,
|
|
458
458
|
template: `
|
|
459
459
|
<ul *ngIf="rows.length" [attr.style]="listStyle">
|
|
@@ -499,7 +499,7 @@ import {
|
|
|
499
499
|
</ul>
|
|
500
500
|
`,
|
|
501
501
|
})
|
|
502
|
-
export class
|
|
502
|
+
export class BdSocialLinksComponent {
|
|
503
503
|
/** The company profile's `socials` record. */
|
|
504
504
|
@Input() set socials(value: unknown) {
|
|
505
505
|
this.rows = resolveSocialLinks(value, { color: this.color });
|
package/src/angular/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@businessdash/sdk/angular` — public entry for the Angular `<
|
|
2
|
+
* `@businessdash/sdk/angular` — public entry for the Angular `<bd-form>` binding.
|
|
3
3
|
*
|
|
4
4
|
* Ship mode: SOURCE. The component is shipped as plain TypeScript and compiled
|
|
5
5
|
* by the consumer's own Angular toolchain (no ng-packagr / Angular Package
|
|
6
6
|
* Format here — APF would force a build step and an `@angular/*` peer footprint
|
|
7
|
-
* onto this SDK). The consumer adds `
|
|
8
|
-
* component's `imports` (or provides {@link
|
|
9
|
-
* root) and drops `<
|
|
7
|
+
* onto this SDK). The consumer adds `BdFormComponent` to a standalone
|
|
8
|
+
* component's `imports` (or provides {@link provideBdClient} once at the app
|
|
9
|
+
* root) and drops `<bd-form slug="…">` into any template.
|
|
10
10
|
*
|
|
11
11
|
* Everything framework-agnostic (the controller, validation, condition + field
|
|
12
12
|
* primitives, and the SDK form types) is re-exported from `@businessdash/sdk/forms`;
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} from "./
|
|
18
|
+
BD_CLIENT,
|
|
19
|
+
BdFormComponent,
|
|
20
|
+
BdFormNodeComponent,
|
|
21
|
+
provideBdClient,
|
|
22
|
+
} from "./bd-form.component.js";
|
|
23
23
|
|
|
24
24
|
// Re-export the headless core (controller + validation + SDK form types) so a
|
|
25
25
|
// consumer reaches the full forms surface from the single `/angular` entry.
|
package/src/auth-handler.ts
CHANGED
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Usage (Next.js App Router):
|
|
7
7
|
*
|
|
8
|
-
* // app/api/
|
|
8
|
+
* // app/api/bd-auth/[...bd]/route.ts
|
|
9
9
|
* import { createAuthHandler } from "@businessdash/sdk";
|
|
10
10
|
*
|
|
11
11
|
* const handler = createAuthHandler({
|
|
12
|
-
* baseUrl: process.env.
|
|
13
|
-
* apiKey: process.env.
|
|
14
|
-
* callbackUrl: "https://my-site.com/api/
|
|
12
|
+
* baseUrl: process.env.BD_PACKAGE_API_BASE_URL!,
|
|
13
|
+
* apiKey: process.env.BD_API_KEY!,
|
|
14
|
+
* callbackUrl: "https://my-site.com/api/bd-auth/callback",
|
|
15
15
|
* });
|
|
16
16
|
*
|
|
17
17
|
* export const GET = handler.GET;
|
|
18
18
|
* export const POST = handler.POST;
|
|
19
19
|
*
|
|
20
20
|
* Then drop <SignIn />, <SignUp />, <SignOut /> into your pages — they call
|
|
21
|
-
* `/api/
|
|
21
|
+
* `/api/bd-auth/sign-in?intent=sign-in` etc., which 302s through the
|
|
22
22
|
* platform-hosted auth page and back to `callbackUrl`. The handler exchanges
|
|
23
23
|
* the code,
|
|
24
24
|
* sets the session cookie, and redirects the user to `returnTo`.
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
|
|
27
27
|
import { Temporal } from "@js-temporal/polyfill";
|
|
28
28
|
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
29
|
+
import { BdApiClient, type BdApiClientOptions } from "./client.js";
|
|
30
|
+
import { BdApiError } from "./errors.js";
|
|
31
31
|
|
|
32
|
-
export const DEFAULT_AUTH_COOKIE_NAME = "
|
|
33
|
-
export const DEFAULT_AUTH_BASE_PATH = "/api/
|
|
32
|
+
export const DEFAULT_AUTH_COOKIE_NAME = "bd_session";
|
|
33
|
+
export const DEFAULT_AUTH_BASE_PATH = "/api/bd-auth";
|
|
34
34
|
|
|
35
35
|
export type CreateAuthHandlerOptions = {
|
|
36
|
-
/**
|
|
36
|
+
/** BD platform base URL — e.g. https://app.bd.com/api/package/v1 */
|
|
37
37
|
baseUrl: string;
|
|
38
38
|
/** Org-bound package API key (server-side secret). */
|
|
39
39
|
apiKey: string;
|
|
@@ -46,7 +46,7 @@ export type CreateAuthHandlerOptions = {
|
|
|
46
46
|
defaultReturnTo?: string;
|
|
47
47
|
/** Where to send the user after sign-out. Defaults to "/". */
|
|
48
48
|
signOutReturnTo?: string;
|
|
49
|
-
/** Cookie name. Defaults to "
|
|
49
|
+
/** Cookie name. Defaults to "bd_session". */
|
|
50
50
|
cookieName?: string;
|
|
51
51
|
/**
|
|
52
52
|
* Cookie domain. Leave undefined to scope to current host. Set if you want
|
|
@@ -55,11 +55,11 @@ export type CreateAuthHandlerOptions = {
|
|
|
55
55
|
cookieDomain?: string;
|
|
56
56
|
/**
|
|
57
57
|
* The base path this handler is mounted at — used to derive sub-routes.
|
|
58
|
-
* Defaults to "/api/
|
|
58
|
+
* Defaults to "/api/bd-auth". Must match the route file location.
|
|
59
59
|
*/
|
|
60
60
|
basePath?: string;
|
|
61
61
|
/** Optional fetch override (testing, edge runtimes). */
|
|
62
|
-
fetch?:
|
|
62
|
+
fetch?: BdApiClientOptions["fetch"];
|
|
63
63
|
/**
|
|
64
64
|
* Origin sent on every server-to-server request to the platform. Defaults
|
|
65
65
|
* to the origin of `callbackUrl`. Override only when your dev/prod hosts
|
|
@@ -131,11 +131,11 @@ function decodeReturnTo(state: string | null): string | null {
|
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* Returned as plain text so failed redirects show a readable page instead of
|
|
134
|
-
* Next.js's empty 500 from an uncaught `
|
|
134
|
+
* Next.js's empty 500 from an uncaught `BdApiError`.
|
|
135
135
|
*/
|
|
136
136
|
function authStartFailureResponse(error: unknown): Response {
|
|
137
137
|
let detail = "";
|
|
138
|
-
if (error instanceof
|
|
138
|
+
if (error instanceof BdApiError) {
|
|
139
139
|
const fromBody =
|
|
140
140
|
error.body &&
|
|
141
141
|
typeof error.body === "object" &&
|
|
@@ -153,9 +153,9 @@ function authStartFailureResponse(error: unknown): Response {
|
|
|
153
153
|
detail +=
|
|
154
154
|
"Signing in requires API scope tenant_auth:public (it is on by default in Site Builder → Developer).\n";
|
|
155
155
|
detail +=
|
|
156
|
-
"If scope is included but this still fails, deploy the latest
|
|
156
|
+
"If scope is included but this still fails, deploy the latest BD app (pinned-site keys were broken on tenant auth routes) or use an org-wide key (no “Pin to current site”).\n";
|
|
157
157
|
detail +=
|
|
158
|
-
"Platform operators issuing keys separately: include tenant_auth under Scopes. Re-issue the key, set
|
|
158
|
+
"Platform operators issuing keys separately: include tenant_auth under Scopes. Re-issue the key, set BD_API_KEY, redeploy.";
|
|
159
159
|
}
|
|
160
160
|
const status =
|
|
161
161
|
error.status >= 400 && error.status <= 599 ? error.status : 502;
|
|
@@ -193,7 +193,7 @@ export function createAuthHandler(
|
|
|
193
193
|
return undefined;
|
|
194
194
|
}
|
|
195
195
|
})();
|
|
196
|
-
const client = new
|
|
196
|
+
const client = new BdApiClient({
|
|
197
197
|
baseUrl: options.baseUrl,
|
|
198
198
|
apiKey: options.apiKey,
|
|
199
199
|
...(options.fetch ? { fetch: options.fetch } : {}),
|
|
@@ -284,7 +284,7 @@ export function createAuthHandler(
|
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
// /password-reset (POST { email } → 200 ok). Always succeeds from the
|
|
287
|
-
// caller's perspective; the
|
|
287
|
+
// caller's perspective; the BD endpoint only emails when the address
|
|
288
288
|
// belongs to a member of the org bound to this handler's API key.
|
|
289
289
|
if (subroute === "password-reset" && request.method === "POST") {
|
|
290
290
|
let payload: { email?: unknown; returnTo?: unknown };
|
|
@@ -337,12 +337,12 @@ export async function getTenantSession(input: {
|
|
|
337
337
|
cookieValue: string | null | undefined;
|
|
338
338
|
baseUrl: string;
|
|
339
339
|
apiKey: string;
|
|
340
|
-
/** Required when the API key has Allowed Host set; see {@link
|
|
340
|
+
/** Required when the API key has Allowed Host set; see {@link BdApiClientOptions.siteOrigin}. */
|
|
341
341
|
siteOrigin?: string;
|
|
342
|
-
fetch?:
|
|
342
|
+
fetch?: BdApiClientOptions["fetch"];
|
|
343
343
|
}) {
|
|
344
344
|
if (!input.cookieValue) return null;
|
|
345
|
-
const client = new
|
|
345
|
+
const client = new BdApiClient({
|
|
346
346
|
baseUrl: input.baseUrl,
|
|
347
347
|
apiKey: input.apiKey,
|
|
348
348
|
...(input.fetch ? { fetch: input.fetch } : {}),
|
package/src/auth-links.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
/** Where `createAuthHandler` is mounted unless the consumer says otherwise. */
|
|
13
|
-
export const DEFAULT_AUTH_BASE_PATH = "/api/
|
|
13
|
+
export const DEFAULT_AUTH_BASE_PATH = "/api/bd-auth";
|
|
14
14
|
|
|
15
15
|
export type AuthHrefOptions = {
|
|
16
16
|
/** Where to send the user after auth completes. */
|
|
@@ -37,7 +37,7 @@ export function buildAuthHref(
|
|
|
37
37
|
/** Local-storage bookkeeping for the "this browser already subscribed" hint. */
|
|
38
38
|
export type LocalFollow = { email: string; at: number };
|
|
39
39
|
|
|
40
|
-
export const FOLLOWER_STORE_PREFIX = "
|
|
40
|
+
export const FOLLOWER_STORE_PREFIX = "bd.followers.";
|
|
41
41
|
|
|
42
42
|
export function followerStoreKey(siteId: string): string {
|
|
43
43
|
return `${FOLLOWER_STORE_PREFIX}${siteId}`;
|
package/src/cli.ts
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
|
|
@@ -98,31 +98,31 @@ const SEED_CONFIG_CANDIDATES = [
|
|
|
98
98
|
"businessdash.seed.ts",
|
|
99
99
|
"businessdash.seed.mjs",
|
|
100
100
|
"businessdash.seed.js",
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
101
|
+
"bd.seed.ts",
|
|
102
|
+
"bd.seed.mjs",
|
|
103
|
+
"bd.seed.js",
|
|
104
104
|
];
|
|
105
105
|
type Command = (typeof COMMANDS)[number];
|
|
106
106
|
|
|
107
107
|
/** Config candidates per flow. The marketing and data-model configs are
|
|
108
108
|
* deliberately different files: different artifacts, different blast radius.
|
|
109
|
-
* `businessdash.*` names are preferred going forward; the `
|
|
109
|
+
* `businessdash.*` names are preferred going forward; the `bd.*` names
|
|
110
110
|
* remain a permanent filesystem contract with every existing consumer. */
|
|
111
111
|
const MARKETING_CONFIG_CANDIDATES = [
|
|
112
112
|
"businessdash.config.ts",
|
|
113
113
|
"businessdash.config.mjs",
|
|
114
114
|
"businessdash.config.js",
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
115
|
+
"bd.config.ts",
|
|
116
|
+
"bd.config.mjs",
|
|
117
|
+
"bd.config.js",
|
|
118
118
|
];
|
|
119
119
|
const DATA_MODEL_CONFIG_CANDIDATES = [
|
|
120
120
|
"businessdash.data-model.config.ts",
|
|
121
121
|
"businessdash.data-model.config.mjs",
|
|
122
122
|
"businessdash.data-model.config.js",
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
"
|
|
123
|
+
"bd.data-model.config.ts",
|
|
124
|
+
"bd.data-model.config.mjs",
|
|
125
|
+
"bd.data-model.config.js",
|
|
126
126
|
];
|
|
127
127
|
|
|
128
128
|
// V7-styled output: matches the dashboard's status-pill colors so the
|
|
@@ -139,7 +139,7 @@ const fg = {
|
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
function logStep(msg: string): void {
|
|
142
|
-
console.log(`[
|
|
142
|
+
console.log(`[bd] ${msg}`);
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
/**
|
|
@@ -174,7 +174,7 @@ function makeProgress(total: number): {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
function logError(msg: string): void {
|
|
177
|
-
console.error(`[
|
|
177
|
+
console.error(`[bd] ${msg}`);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
function parseEnvFile(path: string): Record<string, string> {
|
|
@@ -236,7 +236,7 @@ function findDataModelConfigPath(cwd: string, override?: string): string {
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
/**
|
|
239
|
-
* Load the consumer's `
|
|
239
|
+
* Load the consumer's `bd.config.*`. Supports .ts (via the
|
|
240
240
|
* consumer's tsx / ts-node setup — we only invoke if `--require tsx`
|
|
241
241
|
* or `tsx`/`ts-node` registered the loader), .mjs (native ESM), and
|
|
242
242
|
* .js (CJS or ESM depending on package.json).
|
|
@@ -277,7 +277,7 @@ function normalizeBaseUrl(input: string): string {
|
|
|
277
277
|
let next = input.trim();
|
|
278
278
|
if (!/^https?:\/\//i.test(next)) {
|
|
279
279
|
throw new Error(
|
|
280
|
-
`
|
|
280
|
+
`BD_PACKAGE_API_BASE_URL must start with http(s):// — got "${input}".`,
|
|
281
281
|
);
|
|
282
282
|
}
|
|
283
283
|
if (!next.endsWith("/api/package/v1") && !next.endsWith("/api/package/v1/")) {
|
|
@@ -305,7 +305,7 @@ async function cmdSyncSchema(opts: {
|
|
|
305
305
|
const artifact = schema.toJSONSchema();
|
|
306
306
|
const checksum = await schema.checksum();
|
|
307
307
|
|
|
308
|
-
// Reject any `contentSync.pages[].pageKey` that collides with a
|
|
308
|
+
// Reject any `contentSync.pages[].pageKey` that collides with a BD
|
|
309
309
|
// platform-reserved route. Catches the misconfiguration before any
|
|
310
310
|
// upload happens.
|
|
311
311
|
const declaredPages = schema.contentSync?.pages ?? [];
|
|
@@ -331,16 +331,16 @@ async function cmdSyncSchema(opts: {
|
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
const apiKey = opts.env["
|
|
335
|
-
const siteId = opts.env["
|
|
334
|
+
const apiKey = opts.env["BD_API_KEY"];
|
|
335
|
+
const siteId = opts.env["BD_SITE_ID"];
|
|
336
336
|
const rawBase =
|
|
337
|
-
opts.env["
|
|
338
|
-
opts.env["
|
|
339
|
-
if (!apiKey) throw new Error("Missing
|
|
340
|
-
if (!siteId) throw new Error("Missing
|
|
337
|
+
opts.env["BD_PACKAGE_API_BASE_URL"] ??
|
|
338
|
+
opts.env["NEXT_PUBLIC_BD_PACKAGE_API_BASE_URL"];
|
|
339
|
+
if (!apiKey) throw new Error("Missing BD_API_KEY in env or .env.local.");
|
|
340
|
+
if (!siteId) throw new Error("Missing BD_SITE_ID in env or .env.local.");
|
|
341
341
|
if (!rawBase) {
|
|
342
342
|
throw new Error(
|
|
343
|
-
"Missing
|
|
343
|
+
"Missing BD_PACKAGE_API_BASE_URL in env or .env.local (e.g. https://your-host.tld/api/package/v1).",
|
|
344
344
|
);
|
|
345
345
|
}
|
|
346
346
|
|
|
@@ -456,16 +456,16 @@ async function loadDataModelConfig(
|
|
|
456
456
|
type ApiTarget = { baseUrl: string; apiKey: string; siteId: string };
|
|
457
457
|
|
|
458
458
|
function resolveApiTarget(env: Record<string, string>): ApiTarget {
|
|
459
|
-
const apiKey = env["
|
|
460
|
-
const siteId = env["
|
|
459
|
+
const apiKey = env["BD_API_KEY"];
|
|
460
|
+
const siteId = env["BD_SITE_ID"];
|
|
461
461
|
const rawBase =
|
|
462
|
-
env["
|
|
463
|
-
env["
|
|
464
|
-
if (!apiKey) throw new Error("Missing
|
|
465
|
-
if (!siteId) throw new Error("Missing
|
|
462
|
+
env["BD_PACKAGE_API_BASE_URL"] ??
|
|
463
|
+
env["NEXT_PUBLIC_BD_PACKAGE_API_BASE_URL"];
|
|
464
|
+
if (!apiKey) throw new Error("Missing BD_API_KEY in env or .env.local.");
|
|
465
|
+
if (!siteId) throw new Error("Missing BD_SITE_ID in env or .env.local.");
|
|
466
466
|
if (!rawBase) {
|
|
467
467
|
throw new Error(
|
|
468
|
-
"Missing
|
|
468
|
+
"Missing BD_PACKAGE_API_BASE_URL in env or .env.local (e.g. https://your-host.tld/api/package/v1).",
|
|
469
469
|
);
|
|
470
470
|
}
|
|
471
471
|
return { baseUrl: normalizeBaseUrl(rawBase), apiKey, siteId };
|
|
@@ -665,7 +665,7 @@ async function cmdViewDataModel(opts: {
|
|
|
665
665
|
* Commit the file next to your code and it becomes a Drizzle/Convex-style
|
|
666
666
|
* snapshot: deterministic ordering means successive exports git-diff cleanly,
|
|
667
667
|
* so an AI agent (or a human) can read the collection's state and how it
|
|
668
|
-
* changed over time without querying
|
|
668
|
+
* changed over time without querying BD live. It also re-seeds a fresh org —
|
|
669
669
|
* the `schema` half is the same shape `sync-data-model` pushes, the `records`
|
|
670
670
|
* half is the same shape `sync-records` ingests.
|
|
671
671
|
*/
|
|
@@ -698,7 +698,7 @@ async function cmdExportDataModel(opts: {
|
|
|
698
698
|
? isAbsolute(opts.out)
|
|
699
699
|
? opts.out
|
|
700
700
|
: resolve(opts.cwd, opts.out)
|
|
701
|
-
: resolve(opts.cwd, "
|
|
701
|
+
: resolve(opts.cwd, "bd.data-model.snapshot.json");
|
|
702
702
|
writeFileSync(outPath, `${JSON.stringify(seed, null, 2)}\n`, "utf8");
|
|
703
703
|
|
|
704
704
|
const c = seed.counts;
|
|
@@ -763,7 +763,7 @@ async function cmdExportGraphqlSchema(opts: {
|
|
|
763
763
|
? isAbsolute(opts.out)
|
|
764
764
|
? opts.out
|
|
765
765
|
: resolve(opts.cwd, opts.out)
|
|
766
|
-
: resolve(opts.cwd, "
|
|
766
|
+
: resolve(opts.cwd, "bd.data-model.graphql");
|
|
767
767
|
writeFileSync(outPath, sdl, "utf8");
|
|
768
768
|
|
|
769
769
|
const typeCount = (sdl.match(/^type \w/gm) ?? []).length;
|
|
@@ -794,9 +794,9 @@ function renderConfigModule(
|
|
|
794
794
|
}>,
|
|
795
795
|
): string {
|
|
796
796
|
const lines: string[] = [
|
|
797
|
-
"// Generated by `
|
|
797
|
+
"// Generated by `bd view-data-model --out`.",
|
|
798
798
|
"// This is your org's live data model, as code. Edit it, push it with",
|
|
799
|
-
"// `
|
|
799
|
+
"// `bd sync-data-model`, then promote in the dashboard.",
|
|
800
800
|
"",
|
|
801
801
|
'import { createSchema, defineCollection, defineField } from "@businessdash/sdk";',
|
|
802
802
|
"",
|
|
@@ -1880,7 +1880,7 @@ async function cmdWipeDatabase(opts: {
|
|
|
1880
1880
|
} else if (keep.length === 0) {
|
|
1881
1881
|
logStep(
|
|
1882
1882
|
fg.dim(
|
|
1883
|
-
"Schema draft unchanged — all collections were removed from the config. Remove or edit
|
|
1883
|
+
"Schema draft unchanged — all collections were removed from the config. Remove or edit bd.data-model.config.ts to rebuild.",
|
|
1884
1884
|
),
|
|
1885
1885
|
);
|
|
1886
1886
|
}
|
|
@@ -2087,7 +2087,7 @@ async function postSectionBatch(input: {
|
|
|
2087
2087
|
} catch {
|
|
2088
2088
|
const looksHtml = /^\s*<(?:!doctype|html|head|body)/i.test(bodyText);
|
|
2089
2089
|
if (looksHtml) {
|
|
2090
|
-
message = `${message} (server returned an HTML page, not JSON — the bulk-upsert route may not exist on this host yet. Make sure
|
|
2090
|
+
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.)`;
|
|
2091
2091
|
} else if (bodyText.trim()) {
|
|
2092
2092
|
message = `${message} — ${bodyText.slice(0, 240).trim()}`;
|
|
2093
2093
|
}
|
|
@@ -2152,7 +2152,7 @@ async function cmdSyncContent(opts: {
|
|
|
2152
2152
|
console.log(` ${fg.amber("⚠")} ${fg.dim(w.message)}`);
|
|
2153
2153
|
}
|
|
2154
2154
|
|
|
2155
|
-
// Reject content syncs that target a
|
|
2155
|
+
// Reject content syncs that target a BD-reserved pageKey. We dedupe
|
|
2156
2156
|
// so we report each offending key once rather than per-file.
|
|
2157
2157
|
const reservedKeys = Array.from(
|
|
2158
2158
|
new Set(
|
|
@@ -2185,16 +2185,16 @@ async function cmdSyncContent(opts: {
|
|
|
2185
2185
|
return;
|
|
2186
2186
|
}
|
|
2187
2187
|
|
|
2188
|
-
const apiKey = opts.env["
|
|
2189
|
-
const siteId = opts.env["
|
|
2188
|
+
const apiKey = opts.env["BD_API_KEY"];
|
|
2189
|
+
const siteId = opts.env["BD_SITE_ID"];
|
|
2190
2190
|
const rawBase =
|
|
2191
|
-
opts.env["
|
|
2192
|
-
opts.env["
|
|
2193
|
-
if (!apiKey) throw new Error("Missing
|
|
2194
|
-
if (!siteId) throw new Error("Missing
|
|
2191
|
+
opts.env["BD_PACKAGE_API_BASE_URL"] ??
|
|
2192
|
+
opts.env["NEXT_PUBLIC_BD_PACKAGE_API_BASE_URL"];
|
|
2193
|
+
if (!apiKey) throw new Error("Missing BD_API_KEY in env or .env.local.");
|
|
2194
|
+
if (!siteId) throw new Error("Missing BD_SITE_ID in env or .env.local.");
|
|
2195
2195
|
if (!rawBase) {
|
|
2196
2196
|
throw new Error(
|
|
2197
|
-
"Missing
|
|
2197
|
+
"Missing BD_PACKAGE_API_BASE_URL in env or .env.local (e.g. https://your-host.tld/api/package/v1).",
|
|
2198
2198
|
);
|
|
2199
2199
|
}
|
|
2200
2200
|
|
|
@@ -2278,27 +2278,27 @@ async function cmdSyncContent(opts: {
|
|
|
2278
2278
|
}
|
|
2279
2279
|
|
|
2280
2280
|
function printHelp(): void {
|
|
2281
|
-
console.log(`
|
|
2282
|
-
|
|
2283
|
-
Run via your package runner —
|
|
2284
|
-
npx
|
|
2285
|
-
|
|
2286
|
-
WEBSITE CONTENT (
|
|
2287
|
-
npx
|
|
2288
|
-
npx
|
|
2289
|
-
npx
|
|
2290
|
-
|
|
2291
|
-
CUSTOM DATABASE (
|
|
2292
|
-
npx
|
|
2293
|
-
npx
|
|
2294
|
-
npx
|
|
2295
|
-
npx
|
|
2296
|
-
npx
|
|
2297
|
-
npx
|
|
2298
|
-
npx
|
|
2299
|
-
npx
|
|
2300
|
-
npx
|
|
2301
|
-
npx
|
|
2281
|
+
console.log(`bd — Business In A Box developer CLI
|
|
2282
|
+
|
|
2283
|
+
Run via your package runner — bd is a package bin, not a global:
|
|
2284
|
+
npx bd <command> (or: pnpm exec bd <command>)
|
|
2285
|
+
|
|
2286
|
+
WEBSITE CONTENT (bd.config.ts)
|
|
2287
|
+
npx bd sync-schema [--config path] [--dry-run]
|
|
2288
|
+
npx bd sync-content [--config path] [--dry-run] [--lax] [--note "first import"]
|
|
2289
|
+
npx bd print-schema [--config path]
|
|
2290
|
+
|
|
2291
|
+
CUSTOM DATABASE (bd.data-model.config.ts)
|
|
2292
|
+
npx bd view-data-model [--json] [--diff] [--out path] [--prune]
|
|
2293
|
+
npx bd print-data-model [--config path]
|
|
2294
|
+
npx bd export-data-model [--out path] [--schema-only]
|
|
2295
|
+
npx bd export-graphql-schema [--out path] [--include-standard]
|
|
2296
|
+
npx bd sync-data-model [--config path] [--dry-run] [--prune] [--forms [slugs]] [--no-forms] [--note "..."]
|
|
2297
|
+
npx bd sync-records [--records-dir path] [--dry-run]
|
|
2298
|
+
npx bd seed [--config path] [--dry-run] [--yes]
|
|
2299
|
+
npx bd wipe-collections --collections name-a,name-b [--dry-run]
|
|
2300
|
+
npx bd wipe-database --collections name-a,name-b [--config path] [--dry-run] [--yes]
|
|
2301
|
+
npx bd wipe-database --all [--config path] [--dry-run] [--yes]
|
|
2302
2302
|
|
|
2303
2303
|
seed run businessdash.seed.ts — schema, records, static collections,
|
|
2304
2304
|
products, blog posts and coupons, in dependency order. Products and
|
|
@@ -2306,18 +2306,18 @@ CUSTOM DATABASE (biab.data-model.config.ts)
|
|
|
2306
2306
|
promote in the dashboard. A destructive schema plan refuses unless
|
|
2307
2307
|
you pass --yes. Same code path as runSeed() from @businessdash/sdk/seed.
|
|
2308
2308
|
|
|
2309
|
-
view what's LIVE in
|
|
2309
|
+
view what's LIVE in BD right now (the dashboard can change it too, so
|
|
2310
2310
|
this is not just "what I last pushed")
|
|
2311
2311
|
print what your local config resolves to — no network
|
|
2312
2312
|
export pull the WHOLE custom database — schema + records + relations — into
|
|
2313
|
-
one portable snapshot (default: ./
|
|
2313
|
+
one portable snapshot (default: ./bd.data-model.snapshot.json).
|
|
2314
2314
|
Deterministic order, so committing it gives a git-diffable history an
|
|
2315
|
-
AI agent can read without querying
|
|
2315
|
+
AI agent can read without querying BD. Re-seeds a fresh org via
|
|
2316
2316
|
sync-data-model (schema) + sync-records (rows). --schema-only skips
|
|
2317
2317
|
the row scan. Needs metadata:read_schema + metadata:read_records.
|
|
2318
2318
|
export-graphql-schema
|
|
2319
2319
|
render a GraphQL SDL schema of your custom collections (default:
|
|
2320
|
-
./
|
|
2320
|
+
./bd.data-model.graphql) — every object a type, relations as lists,
|
|
2321
2321
|
SELECTs as enums where valid. Feed it to GraphQL codegen or commit it
|
|
2322
2322
|
as a typed contract. Schema only; this does not run a GraphQL server.
|
|
2323
2323
|
--include-standard also emits standard CRM types. Needs
|
|
@@ -2325,7 +2325,7 @@ CUSTOM DATABASE (biab.data-model.config.ts)
|
|
|
2325
2325
|
sync push your config to the draft slot. Prints the migration plan first;
|
|
2326
2326
|
nothing changes until you promote in the dashboard.
|
|
2327
2327
|
|
|
2328
|
-
seed upsert rows from JSON (default dir: ./
|
|
2328
|
+
seed upsert rows from JSON (default dir: ./bd-records). Each file is an
|
|
2329
2329
|
array of { object, universalIdentifier, values, relations? }; identity
|
|
2330
2330
|
is what makes re-running converge instead of duplicating. relations
|
|
2331
2331
|
links rows by the TARGET row's universalIdentifier, e.g.
|
|
@@ -2355,16 +2355,16 @@ CUSTOM DATABASE (biab.data-model.config.ts)
|
|
|
2355
2355
|
--no-forms push only collections. Generated forms are created inactive on
|
|
2356
2356
|
promotion and must be activated separately in the dashboard.
|
|
2357
2357
|
|
|
2358
|
-
npx
|
|
2358
|
+
npx bd help
|
|
2359
2359
|
|
|
2360
2360
|
Environment (read from process.env, .env, or .env.local in the cwd):
|
|
2361
|
-
|
|
2361
|
+
BD_API_KEY API key. Website flow needs marketing:write_schema
|
|
2362
2362
|
/ marketing:write_content. Data-model flow needs
|
|
2363
2363
|
metadata:read_schema (view/plan) and
|
|
2364
2364
|
metadata:write_schema (push) or
|
|
2365
2365
|
metadata:write_records (seed/wipe).
|
|
2366
|
-
|
|
2367
|
-
|
|
2366
|
+
BD_SITE_ID UUID of the site to publish to
|
|
2367
|
+
BD_PACKAGE_API_BASE_URL Host URL (any path; the CLI canonicalises
|
|
2368
2368
|
to "<origin>/api/package/v1" automatically).
|
|
2369
2369
|
Use the APEX host — e.g. https://biab.app, NOT
|
|
2370
2370
|
https://www.biab.app. A www→apex redirect makes
|
|
@@ -2380,8 +2380,8 @@ two interactive confirmations. wipe-database combines a data wipe with a
|
|
|
2380
2380
|
pruned schema push for developer convenience.
|
|
2381
2381
|
|
|
2382
2382
|
Config files (override either with --config path):
|
|
2383
|
-
|
|
2384
|
-
|
|
2383
|
+
bd.config.ts → defineSiteMarketingSchema (website content)
|
|
2384
|
+
bd.data-model.config.ts → createFormSchemaOrchestrator / createSchema
|
|
2385
2385
|
|
|
2386
2386
|
sync-content also reads the optional \`contentSync\` field on your
|
|
2387
2387
|
defineSiteMarketingSchema({...}) call. Minimal form (default layout
|
|
@@ -2444,7 +2444,7 @@ function parseArgs(argv: string[]): ParsedArgs {
|
|
|
2444
2444
|
diff: false,
|
|
2445
2445
|
out: null,
|
|
2446
2446
|
prune: false,
|
|
2447
|
-
recordsDir: "
|
|
2447
|
+
recordsDir: "bd-records",
|
|
2448
2448
|
forms: "prompt",
|
|
2449
2449
|
collections: [],
|
|
2450
2450
|
yes: false,
|