@riverbankcms/sdk 0.70.2 → 0.70.4
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 +29 -0
- package/dist/_dts/api/src/contentTypes.d.ts +2 -1
- package/dist/_dts/block-form/src/client/index.d.ts +1 -1
- package/dist/_dts/block-form/src/fields/types.d.ts +14 -2
- package/dist/_dts/block-form/src/registry/schemas.d.ts +2 -0
- package/dist/_dts/block-form/src/widgets/MediaField/mediaFieldDefaults.d.ts +2 -2
- package/dist/_dts/block-form/src/widgets/MediaField/mediaFieldSchema.d.ts +2 -2
- package/dist/_dts/blocks/src/lib/media.d.ts +1 -1
- package/dist/_dts/blocks/src/system/blocks/appointment-booking.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/blog-listing.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/cart.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/checkout.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/collection.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/cta-full.d.ts +1 -30727
- package/dist/_dts/blocks/src/system/blocks/events/event-spotlight.d.ts +11 -30827
- package/dist/_dts/blocks/src/system/blocks/faq.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/file-download.d.ts +3 -3
- package/dist/_dts/blocks/src/system/blocks/gifting.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/media-text.d.ts +106 -1
- package/dist/_dts/blocks/src/system/blocks/product-detail.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/product-list.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/blocks/shop.d.ts +1829 -149
- package/dist/_dts/blocks/src/system/defineBlock.d.ts +3 -3
- package/dist/_dts/blocks/src/system/fragments/library/card.d.ts +2 -30793
- package/dist/_dts/blocks/src/system/fragments/library/ctaRow.d.ts +2 -30727
- package/dist/_dts/blocks/src/system/fragments/library/feedbackCallout.d.ts +2 -30779
- package/dist/_dts/blocks/src/system/fragments/library/heroCtaRow.d.ts +33 -30743
- package/dist/_dts/blocks/src/system/fragments/library/sectionState.d.ts +2 -30770
- package/dist/_dts/blocks/src/system/fragments/types.d.ts +8 -7
- package/dist/_dts/blocks/src/system/manifest/derivedContent.d.ts +7 -5
- package/dist/_dts/blocks/src/system/manifest/fieldValidation/index.d.ts +1 -1
- package/dist/_dts/blocks/src/system/manifest/schema.d.ts +192 -3
- package/dist/_dts/blocks/src/system/runtime/nodes/file-download.d.ts +1 -1
- package/dist/_dts/content-model/src/content-types/schema.d.ts +7 -0
- package/dist/_dts/content-model/src/contentManifest.d.ts +4 -1
- package/dist/_dts/content-model/src/templates/bindingTypeCompatibility.d.ts +1 -1
- package/dist/_dts/core/src/index.d.ts +1 -1
- package/dist/_dts/core/src/planner.d.ts +4 -0
- package/dist/_dts/db/src/generated/supabase/database.types.d.ts +53 -20
- package/dist/_dts/editor-blocks/src/index.d.ts +1 -1
- package/dist/_dts/editor-blocks/src/media/MediaField.d.ts +6 -5
- package/dist/_dts/media-core/src/videoSlotPolicy.d.ts +0 -1
- package/dist/_dts/media-editor/src/context.d.ts +4 -1
- package/dist/_dts/media-react/src/hooks/useApiMediaUploader.d.ts +8 -1
- package/dist/_dts/media-react/src/index.d.ts +1 -5
- package/dist/_dts/preview-next/src/client/widgets/PreviewMediaField.d.ts +2 -1
- package/dist/_dts/preview-next/src/client/widgets/widgetOverrides.d.ts +1 -0
- package/dist/_dts/sdk/src/cli/commands/delete.d.ts +3 -0
- package/dist/_dts/sdk/src/cli/commands/style.d.ts +18 -0
- package/dist/_dts/sdk/src/cli/helpers.d.ts +8 -33
- package/dist/_dts/sdk/src/cli/site-commands/oneOffCommands.d.ts +81 -0
- package/dist/_dts/sdk/src/components.d.ts +2 -1
- package/dist/_dts/sdk/src/config/field-definitions.d.ts +6 -2
- package/dist/_dts/sdk/src/config/typed-entries.d.ts +4 -2
- package/dist/_dts/sdk/src/contracts/system-block-content.d.ts +2 -1
- package/dist/_dts/sdk/src/manifest/prompt/examples/cta.d.ts +5 -5
- package/dist/_dts/sdk/src/manifest/prompt/examples/features-grid.d.ts +2 -2
- package/dist/_dts/sdk/src/manifest/prompt/examples/hero.d.ts +2 -2
- package/dist/_dts/sdk/src/manifest/prompt/examples/pricing.d.ts +10 -10
- package/dist/_dts/sdk/src/manifest/prompt/examples/testimonials.d.ts +4 -4
- package/dist/_dts/sdk/src/manifest/validation/output-schema.d.ts +11 -1
- package/dist/_dts/sdk/src/next/types.d.ts +4 -2
- package/dist/_dts/sdk/src/public-api/contracts.d.ts +2 -1
- package/dist/_dts/sdk/src/rendering/index.d.ts +2 -1
- package/dist/_dts/sdk/src/rendering/overrideResolution.d.ts +10 -0
- package/dist/_dts/sdk/src/rendering/overrides.d.ts +12 -0
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/cli/index.mjs +1072 -289
- package/dist/cli/init-docs/content/workflow-preview-mode.md +167 -0
- package/dist/client/client.mjs +443 -403
- package/dist/client/hooks.mjs +172 -121
- package/dist/client/rendering/client.mjs +148 -112
- package/dist/client/rendering/islands.mjs +80 -31
- package/dist/client/rendering.mjs +25531 -25481
- package/dist/preview-next/client/runtime.mjs +394 -1136
- package/dist/server/components.mjs +229 -171
- package/dist/server/config-template-validation.mjs +31 -1
- package/dist/server/config-validation.mjs +172 -121
- package/dist/server/config.mjs +172 -121
- package/dist/server/data.mjs +172 -121
- package/dist/server/index.mjs +1 -1
- package/dist/server/next.mjs +301 -174
- package/dist/server/page-converter.mjs +379 -185
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering/server.mjs +219 -171
- package/dist/server/rendering.mjs +229 -171
- package/dist/server/routing.mjs +175 -124
- package/dist/server/server.mjs +173 -122
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -3257,6 +3257,35 @@ export default Page;
|
|
|
3257
3257
|
export { generateMetadata };
|
|
3258
3258
|
```
|
|
3259
3259
|
|
|
3260
|
+
### Lazy Block Overrides
|
|
3261
|
+
|
|
3262
|
+
Eager `blockOverrides` remain supported and are a good fit for small server-safe components. For client-heavy or rarely used custom blocks, register a lazy override so `createCatchAllPage()` resolves only the override modules needed by the page or entry template being rendered:
|
|
3263
|
+
|
|
3264
|
+
```tsx
|
|
3265
|
+
// src/app/[[...slug]]/page.tsx
|
|
3266
|
+
import { createCatchAllPage } from '@riverbankcms/sdk/next';
|
|
3267
|
+
import { defineLazyBlockOverride } from '@riverbankcms/sdk/rendering';
|
|
3268
|
+
import { getRiverbankClient } from '@/lib/builder-client';
|
|
3269
|
+
import config from '@/riverbank.config';
|
|
3270
|
+
|
|
3271
|
+
const { Page, generateMetadata } = createCatchAllPage({
|
|
3272
|
+
getClient: getRiverbankClient,
|
|
3273
|
+
config,
|
|
3274
|
+
blockOverrides: {
|
|
3275
|
+
'custom.quiz': defineLazyBlockOverride(async () =>
|
|
3276
|
+
import('@/components/blocks/QuizBlock').then((module) => module.QuizBlock)
|
|
3277
|
+
),
|
|
3278
|
+
},
|
|
3279
|
+
});
|
|
3280
|
+
|
|
3281
|
+
export default Page;
|
|
3282
|
+
export { generateMetadata };
|
|
3283
|
+
```
|
|
3284
|
+
|
|
3285
|
+
Keep the `import()` inside the lazy factory. Wrapping a component that was imported at the top of the route file is still eager from the bundler's point of view and will not slim the catch-all route graph. Lazy factories must be wrapped with `defineLazyBlockOverride()`; raw promise-returning functions are not treated as lazy overrides.
|
|
3286
|
+
|
|
3287
|
+
`createCatchAllPage()` filters and resolves lazy overrides per rendered page, so unused factories are not invoked. Next.js still builds the client-reference manifest from the static catch-all route graph, though, so a static `import('./HeavyClientBlock')` inside the route graph can still appear in internal build manifests even when that block is not on the current page. For client-heavy blocks, keep the server override wrapper small and put ALTCHA/forms/booking widgets behind block-local client boundaries, then verify the production build artifacts for the specific site.
|
|
3288
|
+
|
|
3260
3289
|
This single call replaces ~160 lines of typical boilerplate that handles:
|
|
3261
3290
|
- Path resolution from URL slugs
|
|
3262
3291
|
- Content loading (pages and entries)
|
|
@@ -3,7 +3,8 @@ import type { ApiClient } from './request';
|
|
|
3
3
|
export type PublicContentTypeFieldMeta = {
|
|
4
4
|
id: string;
|
|
5
5
|
type: string;
|
|
6
|
-
mediaKinds: Array<'image' | 'video' | 'audio'
|
|
6
|
+
mediaKinds: Array<'image' | 'video' | 'audio'> | null;
|
|
7
|
+
fileKinds: Array<'document' | 'spreadsheet' | 'archive' | 'audio'> | null;
|
|
7
8
|
};
|
|
8
9
|
export type PublicContentTypeMeta = {
|
|
9
10
|
key: string;
|
|
@@ -10,7 +10,7 @@ export type { ManifestAdapterOptions, ManifestAdapterResult, ManifestFormSource,
|
|
|
10
10
|
export { createManifestValidation } from '../manifest/manifestFormAdapter';
|
|
11
11
|
export { formatPublishBlockedMessage, formatRecoveryConflictSummary, formatRecoveryConflictTitle, deriveBlockDraftSaveability, formatUnfinishedBlocksSummary, normalizeManifestIssueMessage, recoveryConflictCopy, shouldShowBlockFieldValidation, unfinishedBlockCopy, validateBlockManifest, validateBlockManifestIssues, validateBlockManifestValues, } from './blockDraftSaveability';
|
|
12
12
|
export type { BlockDraftSaveability, BlockDraftValidationIssue, BlockManifestValidationMode, } from './blockDraftSaveability';
|
|
13
|
-
export type { BaseFieldConfig, FieldConfig, TextFieldConfig, NumberFieldConfig, RichTextFieldConfig, MediaFieldConfig, BooleanFieldConfig, DateFieldConfig, TimeFieldConfig, DateTimeFieldConfig, SlugFieldConfig, UrlFieldConfig, LinkFieldConfig, SelectFieldConfig, ReferenceFieldConfig, GroupFieldConfig, RepeaterFieldConfig, ButtonFieldConfig, ContentTypeSelectFieldConfig, EntryPickerFieldConfig, } from '../fields/types';
|
|
13
|
+
export type { BaseFieldConfig, FieldConfig, TextFieldConfig, NumberFieldConfig, RichTextFieldConfig, MediaFieldConfig, FileFieldConfig, BooleanFieldConfig, DateFieldConfig, TimeFieldConfig, DateTimeFieldConfig, SlugFieldConfig, UrlFieldConfig, LinkFieldConfig, SelectFieldConfig, ReferenceFieldConfig, GroupFieldConfig, RepeaterFieldConfig, ButtonFieldConfig, ContentTypeSelectFieldConfig, EntryPickerFieldConfig, } from '../fields/types';
|
|
14
14
|
export { createManifestFormAdapter } from '../manifest/manifestFormAdapter';
|
|
15
15
|
export { PaletteProvider, usePalette } from '../palette/PaletteContext';
|
|
16
16
|
export { SdkConfigProvider, useSdkConfig, useBlockFieldOptions } from '../sdk-config';
|
|
@@ -11,6 +11,8 @@ import type { FieldDefinition } from '../../../blocks/src/index';
|
|
|
11
11
|
import type { ZodTypeAny } from 'zod';
|
|
12
12
|
import type { TabGroupFieldConfig } from '../widgets/TabGroupField/types';
|
|
13
13
|
import type { PresetOrCustomFieldConfig } from '../widgets/PresetOrCustomField/types';
|
|
14
|
+
export type MediaKind = 'image' | 'video' | 'audio';
|
|
15
|
+
export type FileFieldKind = 'document' | 'spreadsheet' | 'archive' | 'audio';
|
|
14
16
|
/**
|
|
15
17
|
* Base configuration for all field types
|
|
16
18
|
*/
|
|
@@ -58,9 +60,19 @@ export interface RichTextFieldConfig extends BaseFieldConfig {
|
|
|
58
60
|
*/
|
|
59
61
|
export interface MediaFieldConfig extends BaseFieldConfig {
|
|
60
62
|
type: 'media';
|
|
61
|
-
mediaKinds?:
|
|
63
|
+
mediaKinds?: MediaKind[];
|
|
62
64
|
aspectRatio?: string;
|
|
63
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Public file field configuration.
|
|
68
|
+
*
|
|
69
|
+
* File fields are media-backed internally but carry file/download intent for
|
|
70
|
+
* editor upload policy, picker filtering, and future file-specific workflows.
|
|
71
|
+
*/
|
|
72
|
+
export interface FileFieldConfig extends BaseFieldConfig {
|
|
73
|
+
type: 'file';
|
|
74
|
+
fileKinds?: FileFieldKind[];
|
|
75
|
+
}
|
|
64
76
|
/**
|
|
65
77
|
* Boolean field configuration
|
|
66
78
|
*/
|
|
@@ -220,4 +232,4 @@ export interface EntryPickerFieldConfig extends BaseFieldConfig {
|
|
|
220
232
|
/**
|
|
221
233
|
* Union of all field configuration types
|
|
222
234
|
*/
|
|
223
|
-
export type FieldConfig = TextFieldConfig | NumberFieldConfig | RichTextFieldConfig | MediaFieldConfig | BooleanFieldConfig | DateFieldConfig | TimeFieldConfig | DateTimeFieldConfig | SlugFieldConfig | UrlFieldConfig | LinkFieldConfig | SelectFieldConfig | ReferenceFieldConfig | GroupFieldConfig | ModalFieldConfig | RepeaterFieldConfig | ButtonFieldConfig | TabGroupFieldConfig | PresetOrCustomFieldConfig | ContentTypeSelectFieldConfig | EntryPickerFieldConfig;
|
|
235
|
+
export type FieldConfig = TextFieldConfig | NumberFieldConfig | RichTextFieldConfig | MediaFieldConfig | FileFieldConfig | BooleanFieldConfig | DateFieldConfig | TimeFieldConfig | DateTimeFieldConfig | SlugFieldConfig | UrlFieldConfig | LinkFieldConfig | SelectFieldConfig | ReferenceFieldConfig | GroupFieldConfig | ModalFieldConfig | RepeaterFieldConfig | ButtonFieldConfig | TabGroupFieldConfig | PresetOrCustomFieldConfig | ContentTypeSelectFieldConfig | EntryPickerFieldConfig;
|
|
@@ -63,6 +63,7 @@ export declare const SCHEMA_BUILDERS: {
|
|
|
63
63
|
readonly link: typeof buildLinkFieldSchema;
|
|
64
64
|
readonly richText: typeof buildRichTextFieldSchema;
|
|
65
65
|
readonly media: typeof buildMediaFieldSchema;
|
|
66
|
+
readonly file: typeof buildMediaFieldSchema;
|
|
66
67
|
readonly tabGroup: typeof buildTabGroupFieldSchema;
|
|
67
68
|
readonly presetOrCustom: typeof buildPresetOrCustomFieldSchema;
|
|
68
69
|
readonly reference: typeof buildReferenceFieldSchema;
|
|
@@ -85,6 +86,7 @@ export declare const DEFAULT_VALUE_BUILDERS: {
|
|
|
85
86
|
readonly link: typeof getLinkFieldDefault;
|
|
86
87
|
readonly richText: typeof getRichTextFieldDefaultValue;
|
|
87
88
|
readonly media: typeof getMediaFieldDefaultValue;
|
|
89
|
+
readonly file: typeof getMediaFieldDefaultValue;
|
|
88
90
|
readonly tabGroup: typeof getTabGroupFieldDefault;
|
|
89
91
|
readonly presetOrCustom: typeof getPresetOrCustomFieldDefault;
|
|
90
92
|
readonly reference: typeof getReferenceFieldDefault;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { MediaFieldConfig } from '../../fields/types';
|
|
1
|
+
import type { FileFieldConfig, MediaFieldConfig } from '../../fields/types';
|
|
2
2
|
/**
|
|
3
3
|
* Get default value for media field
|
|
4
4
|
* Media fields default to null (no media selected)
|
|
5
5
|
*/
|
|
6
|
-
export declare function getMediaFieldDefaultValue(_config: MediaFieldConfig): null;
|
|
6
|
+
export declare function getMediaFieldDefaultValue(_config: MediaFieldConfig | FileFieldConfig): null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { MediaFieldConfig } from '../../fields/types';
|
|
1
|
+
import type { FileFieldConfig, MediaFieldConfig } from '../../fields/types';
|
|
2
2
|
/**
|
|
3
3
|
* Build Zod validation schema for media field
|
|
4
4
|
* Validates media object structure or null
|
|
5
5
|
*/
|
|
6
|
-
export declare function buildMediaFieldSchema(config: MediaFieldConfig): import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
|
|
6
|
+
export declare function buildMediaFieldSchema(config: MediaFieldConfig | FileFieldConfig): import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
2
|
export declare const MEDIA_TYPE_DISCRIMINANTS: readonly ["image", "video", "audio", "document", "spreadsheet", "archive"];
|
|
3
3
|
export type MediaTypeDiscriminant = typeof MEDIA_TYPE_DISCRIMINANTS[number];
|
|
4
|
-
export declare const PUBLIC_DOWNLOAD_MEDIA_TYPES: readonly ["document", "spreadsheet", "archive", "audio"
|
|
4
|
+
export declare const PUBLIC_DOWNLOAD_MEDIA_TYPES: readonly ["document", "spreadsheet", "archive", "audio"];
|
|
5
5
|
export type PublicDownloadMediaType = typeof PUBLIC_DOWNLOAD_MEDIA_TYPES[number];
|
|
6
6
|
export declare function isMediaTypeDiscriminant(value: unknown): value is MediaTypeDiscriminant;
|
|
7
7
|
export declare function mediaTypeDiscriminantFromMimeType(mimeType: string): MediaTypeDiscriminant | null;
|