@riverbankcms/sdk 0.4.3 → 0.5.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 +84 -0
- package/dist/cli/index.js +3463 -120
- package/dist/cli/index.js.map +1 -1
- package/dist/client/analytics.js +1 -1
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/analytics.mjs +1 -1
- package/dist/client/analytics.mjs.map +1 -1
- package/dist/client/bookings.js +6 -6
- package/dist/client/bookings.js.map +1 -1
- package/dist/client/bookings.mjs +6 -6
- package/dist/client/bookings.mjs.map +1 -1
- package/dist/client/client.d.mts +2 -2
- package/dist/client/client.d.ts +2 -2
- package/dist/client/client.js +1379 -519
- package/dist/client/client.js.map +1 -1
- package/dist/client/client.mjs +1379 -519
- package/dist/client/client.mjs.map +1 -1
- package/dist/client/hooks.d.mts +2 -2
- package/dist/client/hooks.d.ts +2 -2
- package/dist/client/hooks.js +26 -11
- package/dist/client/hooks.js.map +1 -1
- package/dist/client/hooks.mjs +26 -11
- package/dist/client/hooks.mjs.map +1 -1
- package/dist/client/rendering/client.js +20 -14
- package/dist/client/rendering/client.js.map +1 -1
- package/dist/client/rendering/client.mjs +20 -14
- package/dist/client/rendering/client.mjs.map +1 -1
- package/dist/client/usePage-BTPnCuWC.d.mts +6511 -0
- package/dist/client/usePage-BXjk8BhD.d.mts +6704 -0
- package/dist/client/usePage-BafOS9UT.d.mts +6512 -0
- package/dist/client/usePage-BiOReg0_.d.ts +6704 -0
- package/dist/client/usePage-Bnx-kA6x.d.mts +6670 -0
- package/dist/client/usePage-DoPI6b8V.d.ts +6511 -0
- package/dist/client/usePage-QNWArrVO.d.ts +6670 -0
- package/dist/client/usePage-fBgPB6Oq.d.ts +6512 -0
- package/dist/server/{Layout-CXI_VkhN.d.ts → Layout-BClXUTsd.d.mts} +4 -4
- package/dist/server/{Layout-p6f3TLw9.d.mts → Layout-UXGjXv8M.d.ts} +4 -4
- package/dist/server/{chunk-6JBKKV3G.js → chunk-2KCF2DNK.js} +30 -10
- package/dist/server/chunk-2KCF2DNK.js.map +1 -0
- package/dist/server/chunk-5STV4MWD.js +189 -0
- package/dist/server/chunk-5STV4MWD.js.map +1 -0
- package/dist/server/{chunk-VHDDXCK6.js → chunk-7UPVCT3K.js} +1206 -496
- package/dist/server/chunk-7UPVCT3K.js.map +1 -0
- package/dist/server/{chunk-7DS4Q3GA.mjs → chunk-AEFWG657.mjs} +3 -3
- package/dist/server/chunk-AEFWG657.mjs.map +1 -0
- package/dist/server/{chunk-USQF2XTU.mjs → chunk-BYBJA6SP.mjs} +26 -11
- package/dist/server/chunk-BYBJA6SP.mjs.map +1 -0
- package/dist/server/{chunk-ES6QDZUX.mjs → chunk-C6FIJC7T.mjs} +2 -2
- package/dist/server/{chunk-N3PX76AP.mjs → chunk-CMABGYGI.mjs} +269 -135
- package/dist/server/chunk-CMABGYGI.mjs.map +1 -0
- package/dist/server/{chunk-TO7FD6TQ.js → chunk-I2D7KOEA.js} +4 -4
- package/dist/server/{chunk-TO7FD6TQ.js.map → chunk-I2D7KOEA.js.map} +1 -1
- package/dist/server/{chunk-R5B6IOFQ.js → chunk-KA74YRK6.js} +269 -135
- package/dist/server/chunk-KA74YRK6.js.map +1 -0
- package/dist/server/chunk-KFLZGNPO.mjs +189 -0
- package/dist/server/chunk-KFLZGNPO.mjs.map +1 -0
- package/dist/server/chunk-L5EA4FXU.mjs +134 -0
- package/dist/server/chunk-L5EA4FXU.mjs.map +1 -0
- package/dist/server/{chunk-U2NI3TS3.mjs → chunk-LNOUXALA.mjs} +1135 -425
- package/dist/server/chunk-LNOUXALA.mjs.map +1 -0
- package/dist/server/{chunk-24F6FTCI.mjs → chunk-OSF34JTQ.mjs} +4 -4
- package/dist/server/{chunk-G35R7N7B.js → chunk-P3NNN73G.js} +3 -3
- package/dist/server/{chunk-G35R7N7B.js.map → chunk-P3NNN73G.js.map} +1 -1
- package/dist/server/{chunk-I6K5REFT.mjs → chunk-P4K63SBZ.mjs} +24 -4
- package/dist/server/chunk-P4K63SBZ.mjs.map +1 -0
- package/dist/server/{chunk-HOY77YBF.js → chunk-RVDS7VSP.js} +5 -5
- package/dist/server/chunk-RVDS7VSP.js.map +1 -0
- package/dist/server/{chunk-2SSEBAHC.js → chunk-TT5JWA4X.js} +9 -9
- package/dist/server/{chunk-2SSEBAHC.js.map → chunk-TT5JWA4X.js.map} +1 -1
- package/dist/server/chunk-VSFQRHYZ.js +134 -0
- package/dist/server/chunk-VSFQRHYZ.js.map +1 -0
- package/dist/server/{chunk-EGTDJ4PL.js → chunk-YYO3RIFO.js} +26 -11
- package/dist/server/chunk-YYO3RIFO.js.map +1 -0
- package/dist/server/{chunk-OP2GHK27.mjs → chunk-Z5ZA6Q4D.mjs} +2 -2
- package/dist/server/{components-Dhiemsjd.d.ts → components-BmaJxgCV.d.mts} +20 -75
- package/dist/server/{components-C75e4poV.d.mts → components-DppHY5oD.d.ts} +20 -75
- package/dist/server/components.d.mts +11 -8
- package/dist/server/components.d.ts +11 -8
- package/dist/server/components.js +5 -4
- package/dist/server/components.js.map +1 -1
- package/dist/server/components.mjs +4 -3
- package/dist/server/config-validation.d.mts +3 -3
- package/dist/server/config-validation.d.ts +3 -3
- package/dist/server/config-validation.js +9 -5
- package/dist/server/config-validation.js.map +1 -1
- package/dist/server/config-validation.mjs +8 -4
- package/dist/server/config.d.mts +243 -5
- package/dist/server/config.d.ts +243 -5
- package/dist/server/config.js +72 -5
- package/dist/server/config.js.map +1 -1
- package/dist/server/config.mjs +72 -5
- package/dist/server/config.mjs.map +1 -1
- package/dist/server/core-DsNWrl3o.d.mts +44 -0
- package/dist/server/core-DsNWrl3o.d.ts +44 -0
- package/dist/server/data.d.mts +4 -3
- package/dist/server/data.d.ts +4 -3
- package/dist/server/data.js +3 -3
- package/dist/server/data.mjs +2 -2
- package/dist/server/{index-CAwBj3-A.d.ts → index-Bucs6UqG.d.mts} +2 -1
- package/dist/server/{index-C6o9LPvq.d.mts → index-Cp7tJuRt.d.ts} +2 -1
- package/dist/server/index.d.mts +84 -6
- package/dist/server/index.d.ts +84 -6
- package/dist/server/index.js +91 -2
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +90 -1
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/link-DjxLyC82.d.mts +23 -0
- package/dist/server/link-DjxLyC82.d.ts +23 -0
- package/dist/server/{loadContent-CdXfuCuE.d.mts → loadContent-BS-3wesN.d.mts} +4 -4
- package/dist/server/{loadContent-CsvQRoxb.d.ts → loadContent-Buvmudee.d.ts} +4 -4
- package/dist/server/{loadPage-p3AWwwrd.d.mts → loadPage-B8mQUUSo.d.mts} +5 -46
- package/dist/server/loadPage-DNQTTRHL.mjs +11 -0
- package/dist/server/{loadPage-BA0HiT-6.d.ts → loadPage-DP3nrHBi.d.ts} +5 -46
- package/dist/server/loadPage-IDGVDFBB.js +11 -0
- package/dist/server/{loadPage-DLC7DJZP.js.map → loadPage-IDGVDFBB.js.map} +1 -1
- package/dist/server/metadata.d.mts +6 -4
- package/dist/server/metadata.d.ts +6 -4
- package/dist/server/navigation.d.mts +199 -29
- package/dist/server/navigation.d.ts +199 -29
- package/dist/server/navigation.js +27 -43
- package/dist/server/navigation.js.map +1 -1
- package/dist/server/navigation.mjs +20 -36
- package/dist/server/navigation.mjs.map +1 -1
- package/dist/server/rendering/server.d.mts +8 -6
- package/dist/server/rendering/server.d.ts +8 -6
- package/dist/server/rendering/server.js +7 -6
- package/dist/server/rendering/server.js.map +1 -1
- package/dist/server/rendering/server.mjs +6 -5
- package/dist/server/rendering.d.mts +14 -10
- package/dist/server/rendering.d.ts +14 -10
- package/dist/server/rendering.js +9 -8
- package/dist/server/rendering.js.map +1 -1
- package/dist/server/rendering.mjs +8 -7
- package/dist/server/richTextSchema-DURiozvD.d.mts +62 -0
- package/dist/server/richTextSchema-DURiozvD.d.ts +62 -0
- package/dist/server/routing.d.mts +178 -11
- package/dist/server/routing.d.ts +178 -11
- package/dist/server/routing.js +95 -2
- package/dist/server/routing.js.map +1 -1
- package/dist/server/routing.mjs +94 -1
- package/dist/server/routing.mjs.map +1 -1
- package/dist/server/{schema-Bpy9N5ZI.d.mts → schema-Z6-afHJG.d.mts} +1 -1
- package/dist/server/{schema-Bpy9N5ZI.d.ts → schema-Z6-afHJG.d.ts} +1 -1
- package/dist/server/server.d.mts +9 -7
- package/dist/server/server.d.ts +9 -7
- package/dist/server/server.js +6 -6
- package/dist/server/server.mjs +5 -5
- package/dist/server/theme-bridge.js +8 -8
- package/dist/server/theme-bridge.mjs +2 -2
- package/dist/server/{types-Dj8B3QRb.d.ts → types-1cLz0vnq.d.mts} +55 -2
- package/dist/server/{types-txWsSxN7.d.mts → types-BjgZt8xJ.d.mts} +63 -2
- package/dist/server/{types-CdhKJrB0.d.mts → types-BvcJU7zk.d.ts} +55 -2
- package/dist/server/{types-BWQ-TohG.d.ts → types-CVykEqXN.d.ts} +289 -83
- package/dist/server/{types-CL916r6x.d.ts → types-DLBhEPSt.d.ts} +63 -2
- package/dist/server/{types-BLf-hE50.d.mts → types-Dsu9wsUh.d.mts} +289 -83
- package/dist/server/{validation-DzvDwwRo.d.mts → validation-BGuRo8P1.d.mts} +18 -5
- package/dist/server/{validation-CoU8uAiu.d.ts → validation-DU2YE7u5.d.ts} +18 -5
- package/package.json +5 -1
- package/dist/server/chunk-6JBKKV3G.js.map +0 -1
- package/dist/server/chunk-7DS4Q3GA.mjs.map +0 -1
- package/dist/server/chunk-EGTDJ4PL.js.map +0 -1
- package/dist/server/chunk-HOY77YBF.js.map +0 -1
- package/dist/server/chunk-I6K5REFT.mjs.map +0 -1
- package/dist/server/chunk-LCYGQDAB.mjs +0 -835
- package/dist/server/chunk-LCYGQDAB.mjs.map +0 -1
- package/dist/server/chunk-N3PX76AP.mjs.map +0 -1
- package/dist/server/chunk-R5B6IOFQ.js.map +0 -1
- package/dist/server/chunk-TNYU5EIO.js +0 -835
- package/dist/server/chunk-TNYU5EIO.js.map +0 -1
- package/dist/server/chunk-U2NI3TS3.mjs.map +0 -1
- package/dist/server/chunk-USQF2XTU.mjs.map +0 -1
- package/dist/server/chunk-VHDDXCK6.js.map +0 -1
- package/dist/server/loadPage-DLC7DJZP.js +0 -11
- package/dist/server/loadPage-GEGN4UAL.mjs +0 -11
- /package/dist/server/{chunk-ES6QDZUX.mjs.map → chunk-C6FIJC7T.mjs.map} +0 -0
- /package/dist/server/{chunk-24F6FTCI.mjs.map → chunk-OSF34JTQ.mjs.map} +0 -0
- /package/dist/server/{chunk-OP2GHK27.mjs.map → chunk-Z5ZA6Q4D.mjs.map} +0 -0
- /package/dist/server/{loadPage-GEGN4UAL.mjs.map → loadPage-DNQTTRHL.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/will/Projects/Business/cms/builder/packages/sdk/dist/server/config.js","../../src/config/index.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B;AACA;AC4EO,SAAS,YAAA,CAAa,MAAA,EAAkD;AAC7E,EAAA,OAAO,MAAA;AACT;AAuCO,SAAS,mBAAA,CAAoB,MAAA,EAAsC;AACxE,EAAA,OAAO,MAAA;AACT;ADhHA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,q4DAAC","file":"/Users/will/Projects/Business/cms/builder/packages/sdk/dist/server/config.js","sourcesContent":[null,"/**\n * SDK Site Configuration\n *\n * Types and utilities for defining site-level configuration\n * that SDK sites expose to the dashboard.\n */\n\nimport type { RiverbankSiteConfig, ContentConfig } from './types';\n\n// Types\nexport type {\n RiverbankSiteConfig,\n SiteStyleConfig,\n SectionBackground,\n SectionOptionsConfig,\n ContainerOptionsConfig,\n SectionSpacing,\n ContainerMaxWidth,\n ContainerAlignment,\n SdkThemeConfig,\n SdkThemePalette,\n SdkCustomBlock,\n FieldSelectOption,\n BlockFieldConfig,\n BlockFieldOptionsMap,\n BlockFieldExtension,\n BlockFieldExtensionsMap,\n FieldDefinition,\n // Content scaffolding types\n ContentConfig,\n ContentTypeConfig,\n PageConfig,\n EntryConfig,\n BlockConfig,\n NavigationMenuConfig,\n NavigationItemConfig,\n NavigationLinkType,\n SiteSettingsConfig,\n} from './types';\n\n// Validation schemas\nexport {\n riverbankSiteConfigSchema,\n siteStyleConfigSchema,\n sectionBackgroundSchema,\n sectionSpacingSchema,\n containerMaxWidthSchema,\n containerAlignmentSchema,\n sectionOptionsSchema,\n containerOptionsSchema,\n sdkThemeConfigSchema,\n sdkThemePaletteSchema,\n sdkCustomBlockSchema,\n fieldSelectOptionSchema,\n blockFieldConfigSchema,\n blockFieldOptionsSchema,\n blockFieldExtensionSchema,\n blockFieldExtensionsSchema,\n // Content scaffolding schemas\n contentConfigSchema,\n} from './validation';\n\n// Content validation schemas for more granular use\nexport {\n contentTypeConfigSchema,\n pageConfigSchema,\n entryConfigSchema,\n navigationMenuConfigSchema,\n navigationItemConfigSchema,\n siteSettingsConfigSchema,\n blockConfigSchema,\n} from './content-validation';\n\nexport type {\n ValidatedRiverbankSiteConfig,\n ValidatedSdkCustomBlock,\n ContentConfigInput,\n ContentConfigOutput,\n} from './validation';\n\n// Block kind types (single source of truth from @riverbankcms/blocks)\nexport {\n SYSTEM_BLOCK_KINDS,\n type SystemBlockKind,\n type CustomBlockKind,\n type BlockKind,\n} from '../types';\n\n/**\n * Helper function to define a Builder site configuration with type checking.\n *\n * @example\n * ```typescript\n * import { defineConfig } from '@riverbankcms/sdk/config';\n *\n * export default defineConfig({\n * siteId: '123e4567-e89b-12d3-a456-426614174000',\n * theme: {\n * palette: {\n * primary: '#6d28d9',\n * },\n * },\n * styles: {\n * sectionBackgrounds: [\n * { id: 'primary', label: 'Purple', token: 'primary' },\n * ],\n * },\n * });\n * ```\n */\nexport function defineConfig(config: RiverbankSiteConfig): RiverbankSiteConfig {\n return config;\n}\n\n/**\n * Helper function to define content scaffolding configuration with type checking.\n *\n * This can be used to define content configuration in a separate file,\n * which is then imported into riverbank.config.ts.\n *\n * @example\n * ```typescript\n * // content.config.ts\n * import { defineContentConfig } from '@riverbankcms/sdk/config';\n *\n * export const contentConfig = defineContentConfig({\n * contentTypes: [\n * {\n * key: 'testimonial',\n * name: 'Testimonial',\n * hasPages: false,\n * fields: [\n * { id: 'quote', type: 'richText', label: 'Quote', required: true },\n * ],\n * },\n * ],\n * pages: [\n * { identifier: 'home', title: 'Home', path: '/' },\n * ],\n * });\n *\n * // riverbank.config.ts\n * import { defineConfig } from '@riverbankcms/sdk/config';\n * import { contentConfig } from './content.config';\n *\n * export default defineConfig({\n * siteId: '...',\n * content: contentConfig,\n * });\n * ```\n */\nexport function defineContentConfig(config: ContentConfig): ContentConfig {\n return config;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/Users/will/Projects/Business/cms/builder/packages/sdk/dist/server/config.js","../../src/config/typed-entries.ts","../../src/config/index.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B;AACA;AC8KO,SAAS,sBAAA,CAGd,MAAA,EAAwD;AACxD,EAAA,OAAO,MAAA;AACT;AAwDO,SAAS,WAAA,CAId,WAAA,EACA,KAAA,EACa;AACb,EAAA,OAAO;AAAA,IACL,GAAG,KAAA;AAAA,IACH,WAAA,EAAa,WAAA,CAAY;AAAA,EAC3B,CAAA;AACF;AA2BO,IAAM,OAAA,EAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpB,KAAA,CAAA,EAAoB;AAClB,IAAA,OAAO,EAAE,IAAA,EAAM,KAAA,EAAO,OAAA,EAAS,CAAC,EAAE,CAAA;AAAA,EACpC,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,SAAA,CAAU,IAAA,EAA0B;AAClC,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,KAAA;AAAA,MACN,OAAA,EAAS;AAAA,QACP;AAAA,UACE,IAAA,EAAM,WAAA;AAAA,UACN,OAAA,EAAS,KAAA,EAAO,CAAC,EAAE,IAAA,EAAM,MAAA,EAAQ,KAAK,CAAC,EAAA,EAAI,CAAC;AAAA,QAC9C;AAAA,MACF;AAAA,IACF,CAAA;AAAA,EACF,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,GAAA,CAAI,OAAA,EAAmC;AACrC,IAAA,OAAO,EAAE,IAAA,EAAM,KAAA,EAAO,QAAQ,CAAA;AAAA,EAChC,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,OAAA,CAAQ,KAAA,EAA8B,IAAA,EAA0B;AAC9D,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,SAAA;AAAA,MACN,KAAA,EAAO,EAAE,MAAM,CAAA;AAAA,MACf,OAAA,EAAS,CAAC,EAAE,IAAA,EAAM,MAAA,EAAQ,KAAK,CAAC;AAAA,IAClC,CAAA;AAAA,EACF;AACF,CAAA;ADzQA;AACA;AEiCO,SAAS,YAAA,CAAa,MAAA,EAAkD;AAC7E,EAAA,OAAO,MAAA;AACT;AAuCO,SAAS,mBAAA,CAAoB,MAAA,EAAsC;AACxE,EAAA,OAAO,MAAA;AACT;AFrEA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,0/DAAC","file":"/Users/will/Projects/Business/cms/builder/packages/sdk/dist/server/config.js","sourcesContent":[null,"/**\n * Type-Safe Content Entries\n *\n * This module provides type-safe helpers for defining content types and entries\n * in SDK site configurations. When used with `as const`, TypeScript can infer\n * the exact shape of entry data from the content type's field definitions.\n *\n * @example\n * ```typescript\n * import { defineTypedContentType, createEntry, tiptap } from '@riverbankcms/sdk/config';\n *\n * // Define content type with `as const` for type inference\n * export const testimonialType = defineTypedContentType({\n * key: 'testimonial',\n * name: 'Testimonial',\n * hasPages: false,\n * fields: [\n * { id: 'name', type: 'text', label: 'Name', required: true, multiline: false },\n * { id: 'quote', type: 'richText', label: 'Quote', required: true, format: 'html' },\n * ],\n * } as const);\n *\n * // Create entry with full type safety\n * const entry = createEntry(testimonialType, {\n * identifier: 'testimonial-1',\n * data: {\n * name: 'John Doe', // TypeScript knows this is string\n * quote: tiptap.paragraph('Great service!'), // TypeScript knows this is TipTapNode\n * },\n * });\n * ```\n */\n\nimport type {\n FieldDefinition,\n TextFieldDefinition,\n RichTextFieldDefinition,\n MediaFieldDefinition,\n BooleanFieldDefinition,\n NumberFieldDefinition,\n DateFieldDefinition,\n TimeFieldDefinition,\n DateTimeFieldDefinition,\n SlugFieldDefinition,\n UrlFieldDefinition,\n LinkFieldDefinition,\n SelectFieldDefinition,\n ReferenceFieldDefinition,\n RepeaterFieldDefinition,\n GroupFieldDefinition,\n ModalFieldDefinition,\n TabGroupFieldDefinition,\n PresetOrCustomFieldDefinition,\n ContentTypeSelectFieldDefinition,\n EntryPickerFieldDefinition,\n TipTapNode,\n Media,\n LinkValue,\n} from '@riverbankcms/blocks';\nimport type { ContentTypeConfig, EntryConfig } from './content-types';\n\n// Re-export value types for convenience\nexport type { TipTapNode, Media, LinkValue } from '@riverbankcms/blocks';\nexport type {\n InternalLinkValue,\n ExternalLinkValue,\n CustomLinkValue,\n} from '@riverbankcms/blocks';\n\n// =============================================================================\n// Type Infrastructure\n// =============================================================================\n\n/**\n * Infers the data object shape from tabGroup tabs (flattens all tab fields).\n * TabGroup fields flatten all their tab fields into a single data object.\n */\ntype InferDataFromTabs<Tabs extends readonly { fields: readonly FieldDefinition[] }[]> =\n InferDataFromFields<Tabs[number]['fields']>;\n\n// NOTE: Polymorphic repeater type inference would require a helper like this,\n// but TypeScript's mapped types don't distribute correctly over union keys\n// when nested inside conditional types. Left as documentation for future work.\n// type PolymorphicItemData<K, IT> = K extends string\n// ? K extends keyof IT\n// ? IT[K] extends { fields: infer F extends readonly FieldDefinition[] }\n// ? { _type: K } & InferDataFromFields<F>\n// : never\n// : never\n// : never;\n\n/**\n * Maps a field definition to its TypeScript value type.\n * Uses conditional types to infer the correct type based on field.type.\n *\n * Coverage:\n * - Simple primitives: text, boolean, number\n * - Complex types: richText (TipTapNode), media (Media | null), link (LinkValue | null)\n * - Date/time: date, time, datetime (all ISO strings)\n * - String-value: slug, url, reference, presetOrCustom, contentTypeSelect\n * - Select: single (string) vs multiple (string[])\n * - Entry picker: string | null\n * - Nested: group, modal (nested InferDataFromFields)\n * - Repeater: monomorphic (array) and polymorphic (discriminated union array)\n * - TabGroup: flattened fields from all tabs\n */\nexport type FieldValueType<F extends FieldDefinition> =\n // Simple primitives - use specific field types for better inference\n F extends TextFieldDefinition ? string :\n F extends BooleanFieldDefinition ? boolean :\n F extends NumberFieldDefinition ? number :\n // Complex types\n F extends RichTextFieldDefinition ? TipTapNode :\n F extends MediaFieldDefinition ? Media | null :\n F extends LinkFieldDefinition ? LinkValue | null :\n // Date/time types (all stored as ISO strings)\n F extends DateFieldDefinition ? string :\n F extends TimeFieldDefinition ? string :\n F extends DateTimeFieldDefinition ? string :\n // String-value types\n F extends SlugFieldDefinition ? string :\n F extends UrlFieldDefinition ? string :\n F extends ReferenceFieldDefinition ? string :\n F extends PresetOrCustomFieldDefinition ? string :\n F extends ContentTypeSelectFieldDefinition ? string :\n // Select: check multiple flag first (more specific match)\n F extends SelectFieldDefinition & { multiple: true } ? string[] :\n F extends SelectFieldDefinition ? string :\n // Entry picker\n F extends EntryPickerFieldDefinition ? string | null :\n // Nested types (group, modal)\n F extends GroupFieldDefinition & { schema: { fields: infer GF } } ?\n GF extends readonly FieldDefinition[] ? InferDataFromFields<GF> : never :\n F extends ModalFieldDefinition & { schema: { fields: infer MF } } ?\n MF extends readonly FieldDefinition[] ? InferDataFromFields<MF> : never :\n // Repeater types (polymorphic first - more specific, then monomorphic)\n // TODO: Polymorphic repeaters need more complex type distribution.\n // For now, return unknown[] - the runtime data is still correct.\n F extends { type: 'repeater'; polymorphic: true } ? unknown[] :\n F extends RepeaterFieldDefinition & { schema: { fields: infer RF } } ?\n RF extends readonly FieldDefinition[] ? InferDataFromFields<RF>[] : never :\n // TabGroup (flattens all tab fields)\n F extends TabGroupFieldDefinition & { tabs: infer T } ?\n T extends readonly { fields: readonly FieldDefinition[] }[] ?\n InferDataFromTabs<T> : never :\n // Fallback for unknown types\n unknown;\n\n/**\n * Infers the data object shape from an array of field definitions.\n * Required fields are non-optional, optional fields are `| undefined`.\n *\n * @example\n * ```typescript\n * const fields = [\n * { id: 'name', type: 'text', required: true },\n * { id: 'bio', type: 'text', required: false },\n * ] as const;\n *\n * type Data = InferDataFromFields<typeof fields>;\n * // { name: string; bio: string | undefined }\n * ```\n */\nexport type InferDataFromFields<Fields extends readonly FieldDefinition[]> = {\n [F in Fields[number] as F['id']]: F extends { required: true }\n ? FieldValueType<F>\n : FieldValueType<F> | undefined;\n};\n\n// =============================================================================\n// TypedContentType\n// =============================================================================\n\n/**\n * A content type definition with preserved field types for type inference.\n * Extends ContentTypeConfig to ensure all required fields are present.\n * The generic parameters capture the literal types from `as const`.\n */\nexport interface TypedContentType<\n K extends string = string,\n F extends readonly FieldDefinition[] = readonly FieldDefinition[]\n> extends Omit<ContentTypeConfig, 'key' | 'fields'> {\n key: K;\n fields: F;\n}\n\n/**\n * Define a content type with preserved field types for type inference.\n *\n * IMPORTANT: Use `as const` on the config object to enable type inference.\n * Without `as const`, TypeScript widens literal types and inference won't work.\n *\n * @param config - The content type configuration\n * @returns The same config object with preserved types\n *\n * @example\n * ```typescript\n * export const testimonialType = defineTypedContentType({\n * key: 'testimonial',\n * name: 'Testimonial',\n * hasPages: false,\n * fields: [\n * { id: 'name', type: 'text', label: 'Name', required: true, multiline: false },\n * { id: 'quote', type: 'richText', label: 'Quote', required: true, format: 'html' },\n * ],\n * } as const);\n * ```\n */\nexport function defineTypedContentType<\n K extends string,\n F extends readonly FieldDefinition[]\n>(config: TypedContentType<K, F>): TypedContentType<K, F> {\n return config;\n}\n\n// =============================================================================\n// TypedEntryConfig and createEntry\n// =============================================================================\n\n/**\n * Entry configuration with typed data field.\n * Used internally by createEntry to enforce type safety.\n */\nexport interface TypedEntryConfig<Data extends Record<string, unknown>> {\n /** Unique identifier for this entry. Required for SDK sync. */\n identifier: string;\n /** Title for the entry */\n title?: string;\n /** Slug for routable entries */\n slug?: string;\n /** Status: 'draft' or 'published' */\n status?: 'draft' | 'published';\n /** Summary/description */\n summary?: string;\n /** SEO meta title */\n metaTitle?: string;\n /** SEO meta description */\n metaDescription?: string;\n /** Entry data matching the content type's field definitions */\n data: Data;\n}\n\n/**\n * Create a type-safe content entry for a typed content type.\n *\n * The data field is validated against the content type's field definitions.\n * TypeScript will error if:\n * - A required field is missing\n * - A field name is misspelled\n * - A field value has the wrong type\n * - An extra field is provided (with strict mode)\n *\n * @param contentType - The typed content type definition\n * @param entry - The entry configuration with typed data\n * @returns EntryConfig compatible with SDK content configuration\n *\n * @example\n * ```typescript\n * const entry = createEntry(testimonialType, {\n * identifier: 'testimonial-1',\n * title: 'John Doe',\n * status: 'published',\n * data: {\n * name: 'John Doe',\n * quote: tiptap.paragraph('Great service!'),\n * },\n * });\n * ```\n */\nexport function createEntry<\n K extends string,\n F extends readonly FieldDefinition[]\n>(\n contentType: TypedContentType<K, F>,\n entry: TypedEntryConfig<InferDataFromFields<F>>\n): EntryConfig {\n return {\n ...entry,\n contentType: contentType.key,\n };\n}\n\n// =============================================================================\n// TipTap Helpers\n// =============================================================================\n\n/**\n * Helpers for creating TipTap document structures.\n *\n * Use these helpers when populating richText fields to avoid manually\n * constructing the TipTap JSON structure.\n *\n * @example\n * ```typescript\n * // Simple paragraph\n * const body = tiptap.paragraph('Hello, world!');\n *\n * // Empty document\n * const emptyDoc = tiptap.empty();\n *\n * // Complex document\n * const doc = tiptap.doc([\n * tiptap.heading(1, 'Welcome'),\n * { type: 'paragraph', content: [{ type: 'text', text: 'Introduction...' }] },\n * ]);\n * ```\n */\nexport const tiptap = {\n /**\n * Create an empty TipTap document.\n *\n * @returns An empty TipTap document node\n */\n empty(): TipTapNode {\n return { type: 'doc', content: [] };\n },\n\n /**\n * Create a TipTap document with a single paragraph.\n *\n * @param text - The paragraph text content\n * @returns A TipTap document with one paragraph\n */\n paragraph(text: string): TipTapNode {\n return {\n type: 'doc',\n content: [\n {\n type: 'paragraph',\n content: text ? [{ type: 'text', text }] : [],\n },\n ],\n };\n },\n\n /**\n * Create a TipTap document with custom content nodes.\n *\n * @param content - Array of TipTap nodes to include in the document\n * @returns A TipTap document wrapping the content\n */\n doc(content: TipTapNode[]): TipTapNode {\n return { type: 'doc', content };\n },\n\n /**\n * Create a heading node.\n *\n * Note: This returns a heading node, not a document. Use with tiptap.doc()\n * to create a complete document.\n *\n * @param level - Heading level (1-6)\n * @param text - Heading text content\n * @returns A TipTap heading node\n */\n heading(level: 1 | 2 | 3 | 4 | 5 | 6, text: string): TipTapNode {\n return {\n type: 'heading',\n attrs: { level },\n content: [{ type: 'text', text }],\n };\n },\n};\n","/**\n * SDK Site Configuration\n *\n * Types and utilities for defining site-level configuration\n * that SDK sites expose to the dashboard.\n */\n\nimport type { RiverbankSiteConfig, ContentConfig } from './types';\n\n// Types\nexport type {\n RiverbankSiteConfig,\n SiteStyleConfig,\n SectionBackground,\n SectionOptionsConfig,\n ContainerOptionsConfig,\n SectionSpacing,\n ContainerMaxWidth,\n ContainerAlignment,\n SdkThemeConfig,\n SdkThemePalette,\n SdkCustomBlock,\n FieldSelectOption,\n BlockFieldConfig,\n BlockFieldOptionsMap,\n BlockFieldExtension,\n BlockFieldExtensionsMap,\n FieldDefinition,\n // Content scaffolding types\n ContentConfig,\n ContentTypeConfig,\n PageConfig,\n EntryConfig,\n BlockConfig,\n NavigationMenuConfig,\n NavigationItemConfig,\n NavigationLinkType,\n SiteSettingsConfig,\n} from './types';\n\n// Validation schemas\nexport {\n riverbankSiteConfigSchema,\n siteStyleConfigSchema,\n sectionBackgroundSchema,\n sectionSpacingSchema,\n containerMaxWidthSchema,\n containerAlignmentSchema,\n sectionOptionsSchema,\n containerOptionsSchema,\n sdkThemeConfigSchema,\n sdkThemePaletteSchema,\n sdkCustomBlockSchema,\n fieldSelectOptionSchema,\n blockFieldConfigSchema,\n blockFieldOptionsSchema,\n blockFieldExtensionSchema,\n blockFieldExtensionsSchema,\n // Content scaffolding schemas\n contentConfigSchema,\n} from './validation';\n\n// Content validation schemas for more granular use\nexport {\n contentTypeConfigSchema,\n pageConfigSchema,\n entryConfigSchema,\n navigationMenuConfigSchema,\n navigationItemConfigSchema,\n siteSettingsConfigSchema,\n blockConfigSchema,\n} from './content-validation';\n\nexport type {\n ValidatedRiverbankSiteConfig,\n ValidatedSdkCustomBlock,\n ContentConfigInput,\n ContentConfigOutput,\n} from './validation';\n\n// Block kind types (single source of truth from @riverbankcms/blocks)\nexport {\n SYSTEM_BLOCK_KINDS,\n type SystemBlockKind,\n type CustomBlockKind,\n type BlockKind,\n} from '../types';\n\n// Type-safe content entry helpers\nexport {\n defineTypedContentType,\n createEntry,\n tiptap,\n type TypedContentType,\n type TypedEntryConfig,\n type InferDataFromFields,\n type FieldValueType,\n} from './typed-entries';\n\n// Re-export value types for convenience when building entry data\nexport type {\n TipTapNode,\n Media,\n LinkValue,\n InternalLinkValue,\n ExternalLinkValue,\n CustomLinkValue,\n} from './typed-entries';\n\n/**\n * Helper function to define a Builder site configuration with type checking.\n *\n * @example\n * ```typescript\n * import { defineConfig } from '@riverbankcms/sdk/config';\n *\n * export default defineConfig({\n * siteId: '123e4567-e89b-12d3-a456-426614174000',\n * theme: {\n * palette: {\n * primary: '#6d28d9',\n * },\n * },\n * styles: {\n * sectionBackgrounds: [\n * { id: 'primary', label: 'Purple', token: 'primary' },\n * ],\n * },\n * });\n * ```\n */\nexport function defineConfig(config: RiverbankSiteConfig): RiverbankSiteConfig {\n return config;\n}\n\n/**\n * Helper function to define content scaffolding configuration with type checking.\n *\n * This can be used to define content configuration in a separate file,\n * which is then imported into riverbank.config.ts.\n *\n * @example\n * ```typescript\n * // content.config.ts\n * import { defineContentConfig } from '@riverbankcms/sdk/config';\n *\n * export const contentConfig = defineContentConfig({\n * contentTypes: [\n * {\n * key: 'testimonial',\n * name: 'Testimonial',\n * hasPages: false,\n * fields: [\n * { id: 'quote', type: 'richText', label: 'Quote', required: true },\n * ],\n * },\n * ],\n * pages: [\n * { identifier: 'home', title: 'Home', path: '/' },\n * ],\n * });\n *\n * // riverbank.config.ts\n * import { defineConfig } from '@riverbankcms/sdk/config';\n * import { contentConfig } from './content.config';\n *\n * export default defineConfig({\n * siteId: '...',\n * content: contentConfig,\n * });\n * ```\n */\nexport function defineContentConfig(config: ContentConfig): ContentConfig {\n return config;\n}\n"]}
|
package/dist/server/config.mjs
CHANGED
|
@@ -23,15 +23,79 @@ import {
|
|
|
23
23
|
sectionSpacingSchema,
|
|
24
24
|
siteSettingsConfigSchema,
|
|
25
25
|
siteStyleConfigSchema
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-P4K63SBZ.mjs";
|
|
27
27
|
import {
|
|
28
28
|
SYSTEM_BLOCK_KINDS
|
|
29
29
|
} from "./chunk-D2QLTPUJ.mjs";
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-LNOUXALA.mjs";
|
|
31
|
+
import "./chunk-AEFWG657.mjs";
|
|
32
|
+
import "./chunk-BYBJA6SP.mjs";
|
|
33
33
|
import "./chunk-BJTO5JO5.mjs";
|
|
34
34
|
|
|
35
|
+
// src/config/typed-entries.ts
|
|
36
|
+
function defineTypedContentType(config) {
|
|
37
|
+
return config;
|
|
38
|
+
}
|
|
39
|
+
function createEntry(contentType, entry) {
|
|
40
|
+
return {
|
|
41
|
+
...entry,
|
|
42
|
+
contentType: contentType.key
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
var tiptap = {
|
|
46
|
+
/**
|
|
47
|
+
* Create an empty TipTap document.
|
|
48
|
+
*
|
|
49
|
+
* @returns An empty TipTap document node
|
|
50
|
+
*/
|
|
51
|
+
empty() {
|
|
52
|
+
return { type: "doc", content: [] };
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* Create a TipTap document with a single paragraph.
|
|
56
|
+
*
|
|
57
|
+
* @param text - The paragraph text content
|
|
58
|
+
* @returns A TipTap document with one paragraph
|
|
59
|
+
*/
|
|
60
|
+
paragraph(text) {
|
|
61
|
+
return {
|
|
62
|
+
type: "doc",
|
|
63
|
+
content: [
|
|
64
|
+
{
|
|
65
|
+
type: "paragraph",
|
|
66
|
+
content: text ? [{ type: "text", text }] : []
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* Create a TipTap document with custom content nodes.
|
|
73
|
+
*
|
|
74
|
+
* @param content - Array of TipTap nodes to include in the document
|
|
75
|
+
* @returns A TipTap document wrapping the content
|
|
76
|
+
*/
|
|
77
|
+
doc(content) {
|
|
78
|
+
return { type: "doc", content };
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Create a heading node.
|
|
82
|
+
*
|
|
83
|
+
* Note: This returns a heading node, not a document. Use with tiptap.doc()
|
|
84
|
+
* to create a complete document.
|
|
85
|
+
*
|
|
86
|
+
* @param level - Heading level (1-6)
|
|
87
|
+
* @param text - Heading text content
|
|
88
|
+
* @returns A TipTap heading node
|
|
89
|
+
*/
|
|
90
|
+
heading(level, text) {
|
|
91
|
+
return {
|
|
92
|
+
type: "heading",
|
|
93
|
+
attrs: { level },
|
|
94
|
+
content: [{ type: "text", text }]
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
35
99
|
// src/config/index.ts
|
|
36
100
|
function defineConfig(config) {
|
|
37
101
|
return config;
|
|
@@ -51,8 +115,10 @@ export {
|
|
|
51
115
|
containerOptionsSchema,
|
|
52
116
|
contentConfigSchema,
|
|
53
117
|
contentTypeConfigSchema,
|
|
118
|
+
createEntry,
|
|
54
119
|
defineConfig,
|
|
55
120
|
defineContentConfig,
|
|
121
|
+
defineTypedContentType,
|
|
56
122
|
entryConfigSchema,
|
|
57
123
|
fieldSelectOptionSchema,
|
|
58
124
|
navigationItemConfigSchema,
|
|
@@ -66,6 +132,7 @@ export {
|
|
|
66
132
|
sectionOptionsSchema,
|
|
67
133
|
sectionSpacingSchema,
|
|
68
134
|
siteSettingsConfigSchema,
|
|
69
|
-
siteStyleConfigSchema
|
|
135
|
+
siteStyleConfigSchema,
|
|
136
|
+
tiptap
|
|
70
137
|
};
|
|
71
138
|
//# sourceMappingURL=config.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/config/index.ts"],"sourcesContent":["/**\n * SDK Site Configuration\n *\n * Types and utilities for defining site-level configuration\n * that SDK sites expose to the dashboard.\n */\n\nimport type { RiverbankSiteConfig, ContentConfig } from './types';\n\n// Types\nexport type {\n RiverbankSiteConfig,\n SiteStyleConfig,\n SectionBackground,\n SectionOptionsConfig,\n ContainerOptionsConfig,\n SectionSpacing,\n ContainerMaxWidth,\n ContainerAlignment,\n SdkThemeConfig,\n SdkThemePalette,\n SdkCustomBlock,\n FieldSelectOption,\n BlockFieldConfig,\n BlockFieldOptionsMap,\n BlockFieldExtension,\n BlockFieldExtensionsMap,\n FieldDefinition,\n // Content scaffolding types\n ContentConfig,\n ContentTypeConfig,\n PageConfig,\n EntryConfig,\n BlockConfig,\n NavigationMenuConfig,\n NavigationItemConfig,\n NavigationLinkType,\n SiteSettingsConfig,\n} from './types';\n\n// Validation schemas\nexport {\n riverbankSiteConfigSchema,\n siteStyleConfigSchema,\n sectionBackgroundSchema,\n sectionSpacingSchema,\n containerMaxWidthSchema,\n containerAlignmentSchema,\n sectionOptionsSchema,\n containerOptionsSchema,\n sdkThemeConfigSchema,\n sdkThemePaletteSchema,\n sdkCustomBlockSchema,\n fieldSelectOptionSchema,\n blockFieldConfigSchema,\n blockFieldOptionsSchema,\n blockFieldExtensionSchema,\n blockFieldExtensionsSchema,\n // Content scaffolding schemas\n contentConfigSchema,\n} from './validation';\n\n// Content validation schemas for more granular use\nexport {\n contentTypeConfigSchema,\n pageConfigSchema,\n entryConfigSchema,\n navigationMenuConfigSchema,\n navigationItemConfigSchema,\n siteSettingsConfigSchema,\n blockConfigSchema,\n} from './content-validation';\n\nexport type {\n ValidatedRiverbankSiteConfig,\n ValidatedSdkCustomBlock,\n ContentConfigInput,\n ContentConfigOutput,\n} from './validation';\n\n// Block kind types (single source of truth from @riverbankcms/blocks)\nexport {\n SYSTEM_BLOCK_KINDS,\n type SystemBlockKind,\n type CustomBlockKind,\n type BlockKind,\n} from '../types';\n\n/**\n * Helper function to define a Builder site configuration with type checking.\n *\n * @example\n * ```typescript\n * import { defineConfig } from '@riverbankcms/sdk/config';\n *\n * export default defineConfig({\n * siteId: '123e4567-e89b-12d3-a456-426614174000',\n * theme: {\n * palette: {\n * primary: '#6d28d9',\n * },\n * },\n * styles: {\n * sectionBackgrounds: [\n * { id: 'primary', label: 'Purple', token: 'primary' },\n * ],\n * },\n * });\n * ```\n */\nexport function defineConfig(config: RiverbankSiteConfig): RiverbankSiteConfig {\n return config;\n}\n\n/**\n * Helper function to define content scaffolding configuration with type checking.\n *\n * This can be used to define content configuration in a separate file,\n * which is then imported into riverbank.config.ts.\n *\n * @example\n * ```typescript\n * // content.config.ts\n * import { defineContentConfig } from '@riverbankcms/sdk/config';\n *\n * export const contentConfig = defineContentConfig({\n * contentTypes: [\n * {\n * key: 'testimonial',\n * name: 'Testimonial',\n * hasPages: false,\n * fields: [\n * { id: 'quote', type: 'richText', label: 'Quote', required: true },\n * ],\n * },\n * ],\n * pages: [\n * { identifier: 'home', title: 'Home', path: '/' },\n * ],\n * });\n *\n * // riverbank.config.ts\n * import { defineConfig } from '@riverbankcms/sdk/config';\n * import { contentConfig } from './content.config';\n *\n * export default defineConfig({\n * siteId: '...',\n * content: contentConfig,\n * });\n * ```\n */\nexport function defineContentConfig(config: ContentConfig): ContentConfig {\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8GO,SAAS,aAAa,QAAkD;AAC7E,SAAO;AACT;AAuCO,SAAS,oBAAoB,QAAsC;AACxE,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/config/typed-entries.ts","../../src/config/index.ts"],"sourcesContent":["/**\n * Type-Safe Content Entries\n *\n * This module provides type-safe helpers for defining content types and entries\n * in SDK site configurations. When used with `as const`, TypeScript can infer\n * the exact shape of entry data from the content type's field definitions.\n *\n * @example\n * ```typescript\n * import { defineTypedContentType, createEntry, tiptap } from '@riverbankcms/sdk/config';\n *\n * // Define content type with `as const` for type inference\n * export const testimonialType = defineTypedContentType({\n * key: 'testimonial',\n * name: 'Testimonial',\n * hasPages: false,\n * fields: [\n * { id: 'name', type: 'text', label: 'Name', required: true, multiline: false },\n * { id: 'quote', type: 'richText', label: 'Quote', required: true, format: 'html' },\n * ],\n * } as const);\n *\n * // Create entry with full type safety\n * const entry = createEntry(testimonialType, {\n * identifier: 'testimonial-1',\n * data: {\n * name: 'John Doe', // TypeScript knows this is string\n * quote: tiptap.paragraph('Great service!'), // TypeScript knows this is TipTapNode\n * },\n * });\n * ```\n */\n\nimport type {\n FieldDefinition,\n TextFieldDefinition,\n RichTextFieldDefinition,\n MediaFieldDefinition,\n BooleanFieldDefinition,\n NumberFieldDefinition,\n DateFieldDefinition,\n TimeFieldDefinition,\n DateTimeFieldDefinition,\n SlugFieldDefinition,\n UrlFieldDefinition,\n LinkFieldDefinition,\n SelectFieldDefinition,\n ReferenceFieldDefinition,\n RepeaterFieldDefinition,\n GroupFieldDefinition,\n ModalFieldDefinition,\n TabGroupFieldDefinition,\n PresetOrCustomFieldDefinition,\n ContentTypeSelectFieldDefinition,\n EntryPickerFieldDefinition,\n TipTapNode,\n Media,\n LinkValue,\n} from '@riverbankcms/blocks';\nimport type { ContentTypeConfig, EntryConfig } from './content-types';\n\n// Re-export value types for convenience\nexport type { TipTapNode, Media, LinkValue } from '@riverbankcms/blocks';\nexport type {\n InternalLinkValue,\n ExternalLinkValue,\n CustomLinkValue,\n} from '@riverbankcms/blocks';\n\n// =============================================================================\n// Type Infrastructure\n// =============================================================================\n\n/**\n * Infers the data object shape from tabGroup tabs (flattens all tab fields).\n * TabGroup fields flatten all their tab fields into a single data object.\n */\ntype InferDataFromTabs<Tabs extends readonly { fields: readonly FieldDefinition[] }[]> =\n InferDataFromFields<Tabs[number]['fields']>;\n\n// NOTE: Polymorphic repeater type inference would require a helper like this,\n// but TypeScript's mapped types don't distribute correctly over union keys\n// when nested inside conditional types. Left as documentation for future work.\n// type PolymorphicItemData<K, IT> = K extends string\n// ? K extends keyof IT\n// ? IT[K] extends { fields: infer F extends readonly FieldDefinition[] }\n// ? { _type: K } & InferDataFromFields<F>\n// : never\n// : never\n// : never;\n\n/**\n * Maps a field definition to its TypeScript value type.\n * Uses conditional types to infer the correct type based on field.type.\n *\n * Coverage:\n * - Simple primitives: text, boolean, number\n * - Complex types: richText (TipTapNode), media (Media | null), link (LinkValue | null)\n * - Date/time: date, time, datetime (all ISO strings)\n * - String-value: slug, url, reference, presetOrCustom, contentTypeSelect\n * - Select: single (string) vs multiple (string[])\n * - Entry picker: string | null\n * - Nested: group, modal (nested InferDataFromFields)\n * - Repeater: monomorphic (array) and polymorphic (discriminated union array)\n * - TabGroup: flattened fields from all tabs\n */\nexport type FieldValueType<F extends FieldDefinition> =\n // Simple primitives - use specific field types for better inference\n F extends TextFieldDefinition ? string :\n F extends BooleanFieldDefinition ? boolean :\n F extends NumberFieldDefinition ? number :\n // Complex types\n F extends RichTextFieldDefinition ? TipTapNode :\n F extends MediaFieldDefinition ? Media | null :\n F extends LinkFieldDefinition ? LinkValue | null :\n // Date/time types (all stored as ISO strings)\n F extends DateFieldDefinition ? string :\n F extends TimeFieldDefinition ? string :\n F extends DateTimeFieldDefinition ? string :\n // String-value types\n F extends SlugFieldDefinition ? string :\n F extends UrlFieldDefinition ? string :\n F extends ReferenceFieldDefinition ? string :\n F extends PresetOrCustomFieldDefinition ? string :\n F extends ContentTypeSelectFieldDefinition ? string :\n // Select: check multiple flag first (more specific match)\n F extends SelectFieldDefinition & { multiple: true } ? string[] :\n F extends SelectFieldDefinition ? string :\n // Entry picker\n F extends EntryPickerFieldDefinition ? string | null :\n // Nested types (group, modal)\n F extends GroupFieldDefinition & { schema: { fields: infer GF } } ?\n GF extends readonly FieldDefinition[] ? InferDataFromFields<GF> : never :\n F extends ModalFieldDefinition & { schema: { fields: infer MF } } ?\n MF extends readonly FieldDefinition[] ? InferDataFromFields<MF> : never :\n // Repeater types (polymorphic first - more specific, then monomorphic)\n // TODO: Polymorphic repeaters need more complex type distribution.\n // For now, return unknown[] - the runtime data is still correct.\n F extends { type: 'repeater'; polymorphic: true } ? unknown[] :\n F extends RepeaterFieldDefinition & { schema: { fields: infer RF } } ?\n RF extends readonly FieldDefinition[] ? InferDataFromFields<RF>[] : never :\n // TabGroup (flattens all tab fields)\n F extends TabGroupFieldDefinition & { tabs: infer T } ?\n T extends readonly { fields: readonly FieldDefinition[] }[] ?\n InferDataFromTabs<T> : never :\n // Fallback for unknown types\n unknown;\n\n/**\n * Infers the data object shape from an array of field definitions.\n * Required fields are non-optional, optional fields are `| undefined`.\n *\n * @example\n * ```typescript\n * const fields = [\n * { id: 'name', type: 'text', required: true },\n * { id: 'bio', type: 'text', required: false },\n * ] as const;\n *\n * type Data = InferDataFromFields<typeof fields>;\n * // { name: string; bio: string | undefined }\n * ```\n */\nexport type InferDataFromFields<Fields extends readonly FieldDefinition[]> = {\n [F in Fields[number] as F['id']]: F extends { required: true }\n ? FieldValueType<F>\n : FieldValueType<F> | undefined;\n};\n\n// =============================================================================\n// TypedContentType\n// =============================================================================\n\n/**\n * A content type definition with preserved field types for type inference.\n * Extends ContentTypeConfig to ensure all required fields are present.\n * The generic parameters capture the literal types from `as const`.\n */\nexport interface TypedContentType<\n K extends string = string,\n F extends readonly FieldDefinition[] = readonly FieldDefinition[]\n> extends Omit<ContentTypeConfig, 'key' | 'fields'> {\n key: K;\n fields: F;\n}\n\n/**\n * Define a content type with preserved field types for type inference.\n *\n * IMPORTANT: Use `as const` on the config object to enable type inference.\n * Without `as const`, TypeScript widens literal types and inference won't work.\n *\n * @param config - The content type configuration\n * @returns The same config object with preserved types\n *\n * @example\n * ```typescript\n * export const testimonialType = defineTypedContentType({\n * key: 'testimonial',\n * name: 'Testimonial',\n * hasPages: false,\n * fields: [\n * { id: 'name', type: 'text', label: 'Name', required: true, multiline: false },\n * { id: 'quote', type: 'richText', label: 'Quote', required: true, format: 'html' },\n * ],\n * } as const);\n * ```\n */\nexport function defineTypedContentType<\n K extends string,\n F extends readonly FieldDefinition[]\n>(config: TypedContentType<K, F>): TypedContentType<K, F> {\n return config;\n}\n\n// =============================================================================\n// TypedEntryConfig and createEntry\n// =============================================================================\n\n/**\n * Entry configuration with typed data field.\n * Used internally by createEntry to enforce type safety.\n */\nexport interface TypedEntryConfig<Data extends Record<string, unknown>> {\n /** Unique identifier for this entry. Required for SDK sync. */\n identifier: string;\n /** Title for the entry */\n title?: string;\n /** Slug for routable entries */\n slug?: string;\n /** Status: 'draft' or 'published' */\n status?: 'draft' | 'published';\n /** Summary/description */\n summary?: string;\n /** SEO meta title */\n metaTitle?: string;\n /** SEO meta description */\n metaDescription?: string;\n /** Entry data matching the content type's field definitions */\n data: Data;\n}\n\n/**\n * Create a type-safe content entry for a typed content type.\n *\n * The data field is validated against the content type's field definitions.\n * TypeScript will error if:\n * - A required field is missing\n * - A field name is misspelled\n * - A field value has the wrong type\n * - An extra field is provided (with strict mode)\n *\n * @param contentType - The typed content type definition\n * @param entry - The entry configuration with typed data\n * @returns EntryConfig compatible with SDK content configuration\n *\n * @example\n * ```typescript\n * const entry = createEntry(testimonialType, {\n * identifier: 'testimonial-1',\n * title: 'John Doe',\n * status: 'published',\n * data: {\n * name: 'John Doe',\n * quote: tiptap.paragraph('Great service!'),\n * },\n * });\n * ```\n */\nexport function createEntry<\n K extends string,\n F extends readonly FieldDefinition[]\n>(\n contentType: TypedContentType<K, F>,\n entry: TypedEntryConfig<InferDataFromFields<F>>\n): EntryConfig {\n return {\n ...entry,\n contentType: contentType.key,\n };\n}\n\n// =============================================================================\n// TipTap Helpers\n// =============================================================================\n\n/**\n * Helpers for creating TipTap document structures.\n *\n * Use these helpers when populating richText fields to avoid manually\n * constructing the TipTap JSON structure.\n *\n * @example\n * ```typescript\n * // Simple paragraph\n * const body = tiptap.paragraph('Hello, world!');\n *\n * // Empty document\n * const emptyDoc = tiptap.empty();\n *\n * // Complex document\n * const doc = tiptap.doc([\n * tiptap.heading(1, 'Welcome'),\n * { type: 'paragraph', content: [{ type: 'text', text: 'Introduction...' }] },\n * ]);\n * ```\n */\nexport const tiptap = {\n /**\n * Create an empty TipTap document.\n *\n * @returns An empty TipTap document node\n */\n empty(): TipTapNode {\n return { type: 'doc', content: [] };\n },\n\n /**\n * Create a TipTap document with a single paragraph.\n *\n * @param text - The paragraph text content\n * @returns A TipTap document with one paragraph\n */\n paragraph(text: string): TipTapNode {\n return {\n type: 'doc',\n content: [\n {\n type: 'paragraph',\n content: text ? [{ type: 'text', text }] : [],\n },\n ],\n };\n },\n\n /**\n * Create a TipTap document with custom content nodes.\n *\n * @param content - Array of TipTap nodes to include in the document\n * @returns A TipTap document wrapping the content\n */\n doc(content: TipTapNode[]): TipTapNode {\n return { type: 'doc', content };\n },\n\n /**\n * Create a heading node.\n *\n * Note: This returns a heading node, not a document. Use with tiptap.doc()\n * to create a complete document.\n *\n * @param level - Heading level (1-6)\n * @param text - Heading text content\n * @returns A TipTap heading node\n */\n heading(level: 1 | 2 | 3 | 4 | 5 | 6, text: string): TipTapNode {\n return {\n type: 'heading',\n attrs: { level },\n content: [{ type: 'text', text }],\n };\n },\n};\n","/**\n * SDK Site Configuration\n *\n * Types and utilities for defining site-level configuration\n * that SDK sites expose to the dashboard.\n */\n\nimport type { RiverbankSiteConfig, ContentConfig } from './types';\n\n// Types\nexport type {\n RiverbankSiteConfig,\n SiteStyleConfig,\n SectionBackground,\n SectionOptionsConfig,\n ContainerOptionsConfig,\n SectionSpacing,\n ContainerMaxWidth,\n ContainerAlignment,\n SdkThemeConfig,\n SdkThemePalette,\n SdkCustomBlock,\n FieldSelectOption,\n BlockFieldConfig,\n BlockFieldOptionsMap,\n BlockFieldExtension,\n BlockFieldExtensionsMap,\n FieldDefinition,\n // Content scaffolding types\n ContentConfig,\n ContentTypeConfig,\n PageConfig,\n EntryConfig,\n BlockConfig,\n NavigationMenuConfig,\n NavigationItemConfig,\n NavigationLinkType,\n SiteSettingsConfig,\n} from './types';\n\n// Validation schemas\nexport {\n riverbankSiteConfigSchema,\n siteStyleConfigSchema,\n sectionBackgroundSchema,\n sectionSpacingSchema,\n containerMaxWidthSchema,\n containerAlignmentSchema,\n sectionOptionsSchema,\n containerOptionsSchema,\n sdkThemeConfigSchema,\n sdkThemePaletteSchema,\n sdkCustomBlockSchema,\n fieldSelectOptionSchema,\n blockFieldConfigSchema,\n blockFieldOptionsSchema,\n blockFieldExtensionSchema,\n blockFieldExtensionsSchema,\n // Content scaffolding schemas\n contentConfigSchema,\n} from './validation';\n\n// Content validation schemas for more granular use\nexport {\n contentTypeConfigSchema,\n pageConfigSchema,\n entryConfigSchema,\n navigationMenuConfigSchema,\n navigationItemConfigSchema,\n siteSettingsConfigSchema,\n blockConfigSchema,\n} from './content-validation';\n\nexport type {\n ValidatedRiverbankSiteConfig,\n ValidatedSdkCustomBlock,\n ContentConfigInput,\n ContentConfigOutput,\n} from './validation';\n\n// Block kind types (single source of truth from @riverbankcms/blocks)\nexport {\n SYSTEM_BLOCK_KINDS,\n type SystemBlockKind,\n type CustomBlockKind,\n type BlockKind,\n} from '../types';\n\n// Type-safe content entry helpers\nexport {\n defineTypedContentType,\n createEntry,\n tiptap,\n type TypedContentType,\n type TypedEntryConfig,\n type InferDataFromFields,\n type FieldValueType,\n} from './typed-entries';\n\n// Re-export value types for convenience when building entry data\nexport type {\n TipTapNode,\n Media,\n LinkValue,\n InternalLinkValue,\n ExternalLinkValue,\n CustomLinkValue,\n} from './typed-entries';\n\n/**\n * Helper function to define a Builder site configuration with type checking.\n *\n * @example\n * ```typescript\n * import { defineConfig } from '@riverbankcms/sdk/config';\n *\n * export default defineConfig({\n * siteId: '123e4567-e89b-12d3-a456-426614174000',\n * theme: {\n * palette: {\n * primary: '#6d28d9',\n * },\n * },\n * styles: {\n * sectionBackgrounds: [\n * { id: 'primary', label: 'Purple', token: 'primary' },\n * ],\n * },\n * });\n * ```\n */\nexport function defineConfig(config: RiverbankSiteConfig): RiverbankSiteConfig {\n return config;\n}\n\n/**\n * Helper function to define content scaffolding configuration with type checking.\n *\n * This can be used to define content configuration in a separate file,\n * which is then imported into riverbank.config.ts.\n *\n * @example\n * ```typescript\n * // content.config.ts\n * import { defineContentConfig } from '@riverbankcms/sdk/config';\n *\n * export const contentConfig = defineContentConfig({\n * contentTypes: [\n * {\n * key: 'testimonial',\n * name: 'Testimonial',\n * hasPages: false,\n * fields: [\n * { id: 'quote', type: 'richText', label: 'Quote', required: true },\n * ],\n * },\n * ],\n * pages: [\n * { identifier: 'home', title: 'Home', path: '/' },\n * ],\n * });\n *\n * // riverbank.config.ts\n * import { defineConfig } from '@riverbankcms/sdk/config';\n * import { contentConfig } from './content.config';\n *\n * export default defineConfig({\n * siteId: '...',\n * content: contentConfig,\n * });\n * ```\n */\nexport function defineContentConfig(config: ContentConfig): ContentConfig {\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgNO,SAAS,uBAGd,QAAwD;AACxD,SAAO;AACT;AAwDO,SAAS,YAId,aACA,OACa;AACb,SAAO;AAAA,IACL,GAAG;AAAA,IACH,aAAa,YAAY;AAAA,EAC3B;AACF;AA2BO,IAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpB,QAAoB;AAClB,WAAO,EAAE,MAAM,OAAO,SAAS,CAAC,EAAE;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,UAAU,MAA0B;AAClC,WAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,QACP;AAAA,UACE,MAAM;AAAA,UACN,SAAS,OAAO,CAAC,EAAE,MAAM,QAAQ,KAAK,CAAC,IAAI,CAAC;AAAA,QAC9C;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAI,SAAmC;AACrC,WAAO,EAAE,MAAM,OAAO,QAAQ;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,QAAQ,OAA8B,MAA0B;AAC9D,WAAO;AAAA,MACL,MAAM;AAAA,MACN,OAAO,EAAE,MAAM;AAAA,MACf,SAAS,CAAC,EAAE,MAAM,QAAQ,KAAK,CAAC;AAAA,IAClC;AAAA,EACF;AACF;;;ACvOO,SAAS,aAAa,QAAkD;AAC7E,SAAO;AACT;AAuCO,SAAS,oBAAoB,QAAsC;AACxE,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const colorTokens: readonly ["background/base", "background/elevated", "surface/base", "surface/subtle", "surface/inverted", "content/primary", "content/secondary", "accent/primary", "accent/secondary", "border/base"];
|
|
4
|
+
declare const typographyTokens: readonly ["display/hero", "display/section", "heading/large", "heading/medium", "heading/small", "body/normal", "body/small", "caption"];
|
|
5
|
+
declare const spacingTokens: readonly ["none", "3xs", "2xs", "xs", "sm", "md", "lg", "xl", "2xl", "3xl"];
|
|
6
|
+
declare const radiusTokens: readonly ["none", "xs", "sm", "md", "lg", "pill", "full"];
|
|
7
|
+
declare const shadowTokens: readonly ["none", "soft", "medium", "strong"];
|
|
8
|
+
type ThemeTokens = {
|
|
9
|
+
color: Record<(typeof colorTokens)[number], string>;
|
|
10
|
+
typography: Record<(typeof typographyTokens)[number], {
|
|
11
|
+
fontSize: string;
|
|
12
|
+
lineHeight: string;
|
|
13
|
+
fontWeight?: string;
|
|
14
|
+
}>;
|
|
15
|
+
spacing: Record<(typeof spacingTokens)[number], string>;
|
|
16
|
+
radius: Record<(typeof radiusTokens)[number], string>;
|
|
17
|
+
shadow: Record<(typeof shadowTokens)[number], string>;
|
|
18
|
+
palette: Record<string, string>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type RouteMapEntry = string | {
|
|
22
|
+
path?: string | null;
|
|
23
|
+
href?: string | null;
|
|
24
|
+
url?: string | null;
|
|
25
|
+
draftPath?: string | null;
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
};
|
|
28
|
+
type RouteMap = Record<string, RouteMapEntry>;
|
|
29
|
+
type TransformContext = {
|
|
30
|
+
theme: ThemeTokens;
|
|
31
|
+
locale?: string;
|
|
32
|
+
routes?: RouteMap;
|
|
33
|
+
};
|
|
34
|
+
type TransformHandler<TOptions = unknown> = (value: unknown, options: TOptions, context: TransformContext) => unknown;
|
|
35
|
+
type TransformDefinition<TOptions = unknown> = {
|
|
36
|
+
id: string;
|
|
37
|
+
summary?: string;
|
|
38
|
+
kind: "formatter" | "collection" | "string" | "html";
|
|
39
|
+
schema?: z.ZodType<TOptions>;
|
|
40
|
+
run: TransformHandler<TOptions>;
|
|
41
|
+
};
|
|
42
|
+
type TransformRegistry = Map<string, TransformDefinition<any>>;
|
|
43
|
+
|
|
44
|
+
export type { RouteMap as R, TransformRegistry as T, ThemeTokens as a };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const colorTokens: readonly ["background/base", "background/elevated", "surface/base", "surface/subtle", "surface/inverted", "content/primary", "content/secondary", "accent/primary", "accent/secondary", "border/base"];
|
|
4
|
+
declare const typographyTokens: readonly ["display/hero", "display/section", "heading/large", "heading/medium", "heading/small", "body/normal", "body/small", "caption"];
|
|
5
|
+
declare const spacingTokens: readonly ["none", "3xs", "2xs", "xs", "sm", "md", "lg", "xl", "2xl", "3xl"];
|
|
6
|
+
declare const radiusTokens: readonly ["none", "xs", "sm", "md", "lg", "pill", "full"];
|
|
7
|
+
declare const shadowTokens: readonly ["none", "soft", "medium", "strong"];
|
|
8
|
+
type ThemeTokens = {
|
|
9
|
+
color: Record<(typeof colorTokens)[number], string>;
|
|
10
|
+
typography: Record<(typeof typographyTokens)[number], {
|
|
11
|
+
fontSize: string;
|
|
12
|
+
lineHeight: string;
|
|
13
|
+
fontWeight?: string;
|
|
14
|
+
}>;
|
|
15
|
+
spacing: Record<(typeof spacingTokens)[number], string>;
|
|
16
|
+
radius: Record<(typeof radiusTokens)[number], string>;
|
|
17
|
+
shadow: Record<(typeof shadowTokens)[number], string>;
|
|
18
|
+
palette: Record<string, string>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type RouteMapEntry = string | {
|
|
22
|
+
path?: string | null;
|
|
23
|
+
href?: string | null;
|
|
24
|
+
url?: string | null;
|
|
25
|
+
draftPath?: string | null;
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
};
|
|
28
|
+
type RouteMap = Record<string, RouteMapEntry>;
|
|
29
|
+
type TransformContext = {
|
|
30
|
+
theme: ThemeTokens;
|
|
31
|
+
locale?: string;
|
|
32
|
+
routes?: RouteMap;
|
|
33
|
+
};
|
|
34
|
+
type TransformHandler<TOptions = unknown> = (value: unknown, options: TOptions, context: TransformContext) => unknown;
|
|
35
|
+
type TransformDefinition<TOptions = unknown> = {
|
|
36
|
+
id: string;
|
|
37
|
+
summary?: string;
|
|
38
|
+
kind: "formatter" | "collection" | "string" | "html";
|
|
39
|
+
schema?: z.ZodType<TOptions>;
|
|
40
|
+
run: TransformHandler<TOptions>;
|
|
41
|
+
};
|
|
42
|
+
type TransformRegistry = Map<string, TransformDefinition<any>>;
|
|
43
|
+
|
|
44
|
+
export type { RouteMap as R, TransformRegistry as T, ThemeTokens as a };
|
package/dist/server/data.d.mts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { P as PageOutline, S as SdkCustomBlock } from './schema-
|
|
1
|
+
import { P as PageOutline, S as SdkCustomBlock } from './schema-Z6-afHJG.mjs';
|
|
2
2
|
import { P as PrefetchContext, R as ResolvedBlockData, D as DataLoaderOverrides } from './types-CbagRQ_7.mjs';
|
|
3
3
|
export { B as BlockLoaderMap, a as DataLoaderContext, b as DataLoaderFn } from './types-CbagRQ_7.mjs';
|
|
4
|
-
import { R as RiverbankClient } from './types-
|
|
4
|
+
import { R as RiverbankClient } from './types-1cLz0vnq.mjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import './blockKinds-B6MWzNWp.mjs';
|
|
7
|
-
import './types-
|
|
7
|
+
import './types-Dsu9wsUh.mjs';
|
|
8
8
|
import '@riverbankcms/ai';
|
|
9
|
+
import './link-DjxLyC82.mjs';
|
|
9
10
|
import '@riverbankcms/media-storage-supabase';
|
|
10
11
|
import '@riverbankcms/db';
|
|
11
12
|
|
package/dist/server/data.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { P as PageOutline, S as SdkCustomBlock } from './schema-
|
|
1
|
+
import { P as PageOutline, S as SdkCustomBlock } from './schema-Z6-afHJG.js';
|
|
2
2
|
import { P as PrefetchContext, R as ResolvedBlockData, D as DataLoaderOverrides } from './types-DuQCNVV0.js';
|
|
3
3
|
export { B as BlockLoaderMap, a as DataLoaderContext, b as DataLoaderFn } from './types-DuQCNVV0.js';
|
|
4
|
-
import { R as RiverbankClient } from './types-
|
|
4
|
+
import { R as RiverbankClient } from './types-BvcJU7zk.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import './blockKinds-B6MWzNWp.js';
|
|
7
|
-
import './types-
|
|
7
|
+
import './types-CVykEqXN.js';
|
|
8
8
|
import '@riverbankcms/ai';
|
|
9
|
+
import './link-DjxLyC82.js';
|
|
9
10
|
import '@riverbankcms/media-storage-supabase';
|
|
10
11
|
import '@riverbankcms/db';
|
|
11
12
|
|
package/dist/server/data.js
CHANGED
|
@@ -5,13 +5,13 @@ var _chunkY7347JMZjs = require('./chunk-Y7347JMZ.js');
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('./chunk-
|
|
8
|
+
var _chunkRVDS7VSPjs = require('./chunk-RVDS7VSP.js');
|
|
9
|
+
require('./chunk-YYO3RIFO.js');
|
|
10
10
|
require('./chunk-DGUM43GV.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
exports.SUPPORTED_LOADER_ENDPOINTS =
|
|
16
|
+
exports.SUPPORTED_LOADER_ENDPOINTS = _chunkRVDS7VSPjs.SUPPORTED_LOADER_ENDPOINTS; exports.executeCodeLoaders = _chunkY7347JMZjs.executeCodeLoaders; exports.mergeLoaderResults = _chunkY7347JMZjs.mergeLoaderResults; exports.prefetchBlockData = _chunkRVDS7VSPjs.prefetchBlockData;
|
|
17
17
|
//# sourceMappingURL=data.js.map
|
package/dist/server/data.mjs
CHANGED
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
SUPPORTED_LOADER_ENDPOINTS,
|
|
7
7
|
prefetchBlockData
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-AEFWG657.mjs";
|
|
9
|
+
import "./chunk-BYBJA6SP.mjs";
|
|
10
10
|
import "./chunk-BJTO5JO5.mjs";
|
|
11
11
|
export {
|
|
12
12
|
SUPPORTED_LOADER_ENDPOINTS,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { a as RiverbankClientConfig, R as RiverbankClient } from './types-
|
|
1
|
+
import { a as RiverbankClientConfig, R as RiverbankClient } from './types-1cLz0vnq.mjs';
|
|
2
|
+
import './schema-Z6-afHJG.mjs';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Create a Riverbank CMS client for fetching content
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { a as RiverbankClientConfig, R as RiverbankClient } from './types-
|
|
1
|
+
import { a as RiverbankClientConfig, R as RiverbankClient } from './types-BvcJU7zk.js';
|
|
2
|
+
import './schema-Z6-afHJG.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Create a Riverbank CMS client for fetching content
|
package/dist/server/index.d.mts
CHANGED
|
@@ -1,17 +1,66 @@
|
|
|
1
|
-
export { c as createRiverbankClient } from './index-
|
|
2
|
-
export { E as EntriesResponse, c as EntriesResponseWithMeta, b as EntryResponse, P as PageResponse, d as PaginationMeta, R as RiverbankClient, a as RiverbankClientConfig, S as SiteResponse } from './types-
|
|
3
|
-
import { A as APIEndpoints, b as APICallParams } from './types-
|
|
4
|
-
import './schema-
|
|
5
|
-
export {
|
|
1
|
+
export { c as createRiverbankClient } from './index-Bucs6UqG.mjs';
|
|
2
|
+
export { E as EntriesResponse, c as EntriesResponseWithMeta, b as EntryResponse, P as PageResponse, d as PaginationMeta, R as RiverbankClient, a as RiverbankClientConfig, S as SiteResponse } from './types-1cLz0vnq.mjs';
|
|
3
|
+
import { A as APIEndpoints, b as APICallParams } from './types-Dsu9wsUh.mjs';
|
|
4
|
+
import './schema-Z6-afHJG.mjs';
|
|
5
|
+
export { g as ContainerAlignment, f as ContainerMaxWidth, d as ContainerOptionsConfig, R as RiverbankSiteConfig, b as SectionBackground, c as SectionOptionsConfig, e as SectionSpacing, S as SiteStyleConfig } from './types-BjgZt8xJ.mjs';
|
|
6
6
|
export { B as BlockKind, C as CustomBlockKind, S as SYSTEM_BLOCK_KINDS, a as SystemBlockKind } from './blockKinds-B6MWzNWp.mjs';
|
|
7
7
|
import '@riverbankcms/ai';
|
|
8
8
|
import 'zod';
|
|
9
|
+
import './link-DjxLyC82.mjs';
|
|
9
10
|
import '@riverbankcms/media-storage-supabase';
|
|
10
11
|
import '@riverbankcms/db';
|
|
11
12
|
|
|
13
|
+
/**
|
|
14
|
+
* API Response Envelope Types
|
|
15
|
+
*
|
|
16
|
+
* Provides standardized response format for all API endpoints:
|
|
17
|
+
* - Success: { success: true, data, meta }
|
|
18
|
+
* - Error: { success: false, error: { code, message, requestId, ... } }
|
|
19
|
+
*/
|
|
20
|
+
type ApiVersion = '2025-01-01';
|
|
21
|
+
interface ResponseMeta {
|
|
22
|
+
requestId: string;
|
|
23
|
+
timestamp: string;
|
|
24
|
+
apiVersion: ApiVersion;
|
|
25
|
+
deprecations?: DeprecationWarning[];
|
|
26
|
+
}
|
|
27
|
+
interface DeprecationWarning {
|
|
28
|
+
feature: string;
|
|
29
|
+
message: string;
|
|
30
|
+
sunsetDate: string;
|
|
31
|
+
alternative?: string;
|
|
32
|
+
}
|
|
33
|
+
interface ApiResponse<TData> {
|
|
34
|
+
success: true;
|
|
35
|
+
data: TData;
|
|
36
|
+
meta: ResponseMeta;
|
|
37
|
+
}
|
|
38
|
+
type ApiErrorCode = 'auth:unauthenticated' | 'auth:token_expired' | 'auth:token_invalid' | 'auth:forbidden' | 'auth:mfa_required' | 'auth:sudo_required' | 'auth:insufficient_permissions' | 'auth:impersonation_restricted' | 'validation:invalid_input' | 'validation:missing_field' | 'validation:invalid_format' | 'validation:payload_too_large' | 'resource:not_found' | 'resource:already_exists' | 'resource:conflict' | 'resource:gone' | 'rate_limit:exceeded' | 'billing:payment_required' | 'billing:plan_limit_exceeded' | 'server:internal_error' | 'server:unavailable' | 'external:service_error';
|
|
39
|
+
interface FieldError {
|
|
40
|
+
field: string;
|
|
41
|
+
code: string;
|
|
42
|
+
message: string;
|
|
43
|
+
}
|
|
44
|
+
interface ApiError {
|
|
45
|
+
success: false;
|
|
46
|
+
error: {
|
|
47
|
+
code: ApiErrorCode;
|
|
48
|
+
message: string;
|
|
49
|
+
requestId: string;
|
|
50
|
+
timestamp: string;
|
|
51
|
+
status: number;
|
|
52
|
+
fieldErrors?: FieldError[];
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
type ApiResult<TData> = ApiResponse<TData> | ApiError;
|
|
56
|
+
|
|
12
57
|
type EndpointResponse<E extends keyof APIEndpoints> = APIEndpoints[E]['response'];
|
|
13
58
|
type ApiResponseFor<E extends keyof APIEndpoints> = EndpointResponse<E> extends undefined ? void : NonNullable<EndpointResponse<E>>;
|
|
14
|
-
|
|
59
|
+
/**
|
|
60
|
+
* API client that returns typed envelope responses.
|
|
61
|
+
* Consumers must use isApiSuccess/isApiError type guards or unwrapResponse helper.
|
|
62
|
+
*/
|
|
63
|
+
type ApiClient = <E extends keyof APIEndpoints>(params: APICallParams<E>) => Promise<ApiResult<ApiResponseFor<E>>>;
|
|
15
64
|
|
|
16
65
|
declare const API_ENDPOINTS: {
|
|
17
66
|
readonly aiContentUpdateChat: {
|
|
@@ -186,6 +235,27 @@ declare const API_ENDPOINTS: {
|
|
|
186
235
|
readonly tags: ["site-{siteId}", "api-keys", "access-logs"];
|
|
187
236
|
readonly responseKind: "json";
|
|
188
237
|
};
|
|
238
|
+
readonly listManagementKeys: {
|
|
239
|
+
readonly path: "/sites/{siteId}/api-keys/management";
|
|
240
|
+
readonly method: "GET";
|
|
241
|
+
readonly auth: "user";
|
|
242
|
+
readonly tags: ["site-{siteId}", "api-keys", "management-keys"];
|
|
243
|
+
readonly responseKind: "json";
|
|
244
|
+
};
|
|
245
|
+
readonly createManagementKey: {
|
|
246
|
+
readonly path: "/sites/{siteId}/api-keys/management";
|
|
247
|
+
readonly method: "POST";
|
|
248
|
+
readonly auth: "user";
|
|
249
|
+
readonly tags: ["site-{siteId}", "api-keys", "management-keys"];
|
|
250
|
+
readonly responseKind: "json";
|
|
251
|
+
};
|
|
252
|
+
readonly revokeManagementKey: {
|
|
253
|
+
readonly path: "/sites/{siteId}/api-keys/management";
|
|
254
|
+
readonly method: "DELETE";
|
|
255
|
+
readonly auth: "user";
|
|
256
|
+
readonly tags: ["site-{siteId}", "api-keys", "management-keys"];
|
|
257
|
+
readonly responseKind: "json";
|
|
258
|
+
};
|
|
189
259
|
readonly getBookingSettings: {
|
|
190
260
|
readonly path: "/sites/{siteId}/bookings/settings";
|
|
191
261
|
readonly method: "GET";
|
|
@@ -1435,6 +1505,14 @@ declare const API_ENDPOINTS: {
|
|
|
1435
1505
|
readonly auth: "public";
|
|
1436
1506
|
readonly responseKind: "json";
|
|
1437
1507
|
};
|
|
1508
|
+
readonly resolveEventOccurrence: {
|
|
1509
|
+
readonly path: "/public/sites/{siteId}/events/occurrences/resolve";
|
|
1510
|
+
readonly method: "GET";
|
|
1511
|
+
readonly revalidate: 60;
|
|
1512
|
+
readonly tags: ["public-events-{siteId}", "event-occurrence"];
|
|
1513
|
+
readonly auth: "public";
|
|
1514
|
+
readonly responseKind: "json";
|
|
1515
|
+
};
|
|
1438
1516
|
readonly registerForEvent: {
|
|
1439
1517
|
readonly path: "/public/sites/{siteId}/events/register";
|
|
1440
1518
|
readonly method: "POST";
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,17 +1,66 @@
|
|
|
1
|
-
export { c as createRiverbankClient } from './index-
|
|
2
|
-
export { E as EntriesResponse, c as EntriesResponseWithMeta, b as EntryResponse, P as PageResponse, d as PaginationMeta, R as RiverbankClient, a as RiverbankClientConfig, S as SiteResponse } from './types-
|
|
3
|
-
import { A as APIEndpoints, b as APICallParams } from './types-
|
|
4
|
-
import './schema-
|
|
5
|
-
export {
|
|
1
|
+
export { c as createRiverbankClient } from './index-Cp7tJuRt.js';
|
|
2
|
+
export { E as EntriesResponse, c as EntriesResponseWithMeta, b as EntryResponse, P as PageResponse, d as PaginationMeta, R as RiverbankClient, a as RiverbankClientConfig, S as SiteResponse } from './types-BvcJU7zk.js';
|
|
3
|
+
import { A as APIEndpoints, b as APICallParams } from './types-CVykEqXN.js';
|
|
4
|
+
import './schema-Z6-afHJG.js';
|
|
5
|
+
export { g as ContainerAlignment, f as ContainerMaxWidth, d as ContainerOptionsConfig, R as RiverbankSiteConfig, b as SectionBackground, c as SectionOptionsConfig, e as SectionSpacing, S as SiteStyleConfig } from './types-DLBhEPSt.js';
|
|
6
6
|
export { B as BlockKind, C as CustomBlockKind, S as SYSTEM_BLOCK_KINDS, a as SystemBlockKind } from './blockKinds-B6MWzNWp.js';
|
|
7
7
|
import '@riverbankcms/ai';
|
|
8
8
|
import 'zod';
|
|
9
|
+
import './link-DjxLyC82.js';
|
|
9
10
|
import '@riverbankcms/media-storage-supabase';
|
|
10
11
|
import '@riverbankcms/db';
|
|
11
12
|
|
|
13
|
+
/**
|
|
14
|
+
* API Response Envelope Types
|
|
15
|
+
*
|
|
16
|
+
* Provides standardized response format for all API endpoints:
|
|
17
|
+
* - Success: { success: true, data, meta }
|
|
18
|
+
* - Error: { success: false, error: { code, message, requestId, ... } }
|
|
19
|
+
*/
|
|
20
|
+
type ApiVersion = '2025-01-01';
|
|
21
|
+
interface ResponseMeta {
|
|
22
|
+
requestId: string;
|
|
23
|
+
timestamp: string;
|
|
24
|
+
apiVersion: ApiVersion;
|
|
25
|
+
deprecations?: DeprecationWarning[];
|
|
26
|
+
}
|
|
27
|
+
interface DeprecationWarning {
|
|
28
|
+
feature: string;
|
|
29
|
+
message: string;
|
|
30
|
+
sunsetDate: string;
|
|
31
|
+
alternative?: string;
|
|
32
|
+
}
|
|
33
|
+
interface ApiResponse<TData> {
|
|
34
|
+
success: true;
|
|
35
|
+
data: TData;
|
|
36
|
+
meta: ResponseMeta;
|
|
37
|
+
}
|
|
38
|
+
type ApiErrorCode = 'auth:unauthenticated' | 'auth:token_expired' | 'auth:token_invalid' | 'auth:forbidden' | 'auth:mfa_required' | 'auth:sudo_required' | 'auth:insufficient_permissions' | 'auth:impersonation_restricted' | 'validation:invalid_input' | 'validation:missing_field' | 'validation:invalid_format' | 'validation:payload_too_large' | 'resource:not_found' | 'resource:already_exists' | 'resource:conflict' | 'resource:gone' | 'rate_limit:exceeded' | 'billing:payment_required' | 'billing:plan_limit_exceeded' | 'server:internal_error' | 'server:unavailable' | 'external:service_error';
|
|
39
|
+
interface FieldError {
|
|
40
|
+
field: string;
|
|
41
|
+
code: string;
|
|
42
|
+
message: string;
|
|
43
|
+
}
|
|
44
|
+
interface ApiError {
|
|
45
|
+
success: false;
|
|
46
|
+
error: {
|
|
47
|
+
code: ApiErrorCode;
|
|
48
|
+
message: string;
|
|
49
|
+
requestId: string;
|
|
50
|
+
timestamp: string;
|
|
51
|
+
status: number;
|
|
52
|
+
fieldErrors?: FieldError[];
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
type ApiResult<TData> = ApiResponse<TData> | ApiError;
|
|
56
|
+
|
|
12
57
|
type EndpointResponse<E extends keyof APIEndpoints> = APIEndpoints[E]['response'];
|
|
13
58
|
type ApiResponseFor<E extends keyof APIEndpoints> = EndpointResponse<E> extends undefined ? void : NonNullable<EndpointResponse<E>>;
|
|
14
|
-
|
|
59
|
+
/**
|
|
60
|
+
* API client that returns typed envelope responses.
|
|
61
|
+
* Consumers must use isApiSuccess/isApiError type guards or unwrapResponse helper.
|
|
62
|
+
*/
|
|
63
|
+
type ApiClient = <E extends keyof APIEndpoints>(params: APICallParams<E>) => Promise<ApiResult<ApiResponseFor<E>>>;
|
|
15
64
|
|
|
16
65
|
declare const API_ENDPOINTS: {
|
|
17
66
|
readonly aiContentUpdateChat: {
|
|
@@ -186,6 +235,27 @@ declare const API_ENDPOINTS: {
|
|
|
186
235
|
readonly tags: ["site-{siteId}", "api-keys", "access-logs"];
|
|
187
236
|
readonly responseKind: "json";
|
|
188
237
|
};
|
|
238
|
+
readonly listManagementKeys: {
|
|
239
|
+
readonly path: "/sites/{siteId}/api-keys/management";
|
|
240
|
+
readonly method: "GET";
|
|
241
|
+
readonly auth: "user";
|
|
242
|
+
readonly tags: ["site-{siteId}", "api-keys", "management-keys"];
|
|
243
|
+
readonly responseKind: "json";
|
|
244
|
+
};
|
|
245
|
+
readonly createManagementKey: {
|
|
246
|
+
readonly path: "/sites/{siteId}/api-keys/management";
|
|
247
|
+
readonly method: "POST";
|
|
248
|
+
readonly auth: "user";
|
|
249
|
+
readonly tags: ["site-{siteId}", "api-keys", "management-keys"];
|
|
250
|
+
readonly responseKind: "json";
|
|
251
|
+
};
|
|
252
|
+
readonly revokeManagementKey: {
|
|
253
|
+
readonly path: "/sites/{siteId}/api-keys/management";
|
|
254
|
+
readonly method: "DELETE";
|
|
255
|
+
readonly auth: "user";
|
|
256
|
+
readonly tags: ["site-{siteId}", "api-keys", "management-keys"];
|
|
257
|
+
readonly responseKind: "json";
|
|
258
|
+
};
|
|
189
259
|
readonly getBookingSettings: {
|
|
190
260
|
readonly path: "/sites/{siteId}/bookings/settings";
|
|
191
261
|
readonly method: "GET";
|
|
@@ -1435,6 +1505,14 @@ declare const API_ENDPOINTS: {
|
|
|
1435
1505
|
readonly auth: "public";
|
|
1436
1506
|
readonly responseKind: "json";
|
|
1437
1507
|
};
|
|
1508
|
+
readonly resolveEventOccurrence: {
|
|
1509
|
+
readonly path: "/public/sites/{siteId}/events/occurrences/resolve";
|
|
1510
|
+
readonly method: "GET";
|
|
1511
|
+
readonly revalidate: 60;
|
|
1512
|
+
readonly tags: ["public-events-{siteId}", "event-occurrence"];
|
|
1513
|
+
readonly auth: "public";
|
|
1514
|
+
readonly responseKind: "json";
|
|
1515
|
+
};
|
|
1438
1516
|
readonly registerForEvent: {
|
|
1439
1517
|
readonly path: "/public/sites/{siteId}/events/register";
|
|
1440
1518
|
readonly method: "POST";
|