includio-cms 0.18.0 → 0.20.0

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.
Files changed (66) hide show
  1. package/API.md +409 -0
  2. package/CHANGELOG.md +98 -1
  3. package/DOCS.md +1 -1
  4. package/README.md +62 -0
  5. package/ROADMAP.md +1 -0
  6. package/dist/admin/api/rest/handler.d.ts +4 -0
  7. package/dist/admin/api/rest/handler.js +4 -0
  8. package/dist/admin/client/index.d.ts +2 -0
  9. package/dist/admin/client/index.js +4 -0
  10. package/dist/ai-claude/index.d.ts +9 -0
  11. package/dist/ai-claude/index.js +23 -7
  12. package/dist/ai-openai/index.d.ts +9 -0
  13. package/dist/ai-openai/index.js +28 -9
  14. package/dist/components/ui/input-group/input-group-input.svelte.d.ts +1 -1
  15. package/dist/components/ui/sidebar/sidebar-input.svelte.d.ts +1 -1
  16. package/dist/core/cms.d.ts +4 -0
  17. package/dist/core/cms.js +4 -0
  18. package/dist/core/index.d.ts +2 -0
  19. package/dist/core/index.js +2 -0
  20. package/dist/core/server/consentLogs/operations/create.d.ts +4 -0
  21. package/dist/core/server/consentLogs/operations/create.js +4 -0
  22. package/dist/core/server/fields/utils/resolveMedia.d.ts +5 -2
  23. package/dist/core/server/fields/utils/resolveMedia.js +2 -2
  24. package/dist/core/server/forms/submissions/operations/create.d.ts +7 -0
  25. package/dist/core/server/forms/submissions/operations/create.js +4 -0
  26. package/dist/core/server/forms/submissions/utils/parseMultipart.d.ts +4 -0
  27. package/dist/core/server/forms/submissions/utils/parseMultipart.js +4 -0
  28. package/dist/db-postgres/index.d.ts +6 -0
  29. package/dist/db-postgres/index.js +7 -0
  30. package/dist/email-nodemailer/index.d.ts +9 -0
  31. package/dist/email-nodemailer/index.js +28 -6
  32. package/dist/entity/index.d.ts +4 -0
  33. package/dist/entity/index.js +4 -0
  34. package/dist/files-local/index.d.ts +5 -0
  35. package/dist/files-local/index.js +5 -0
  36. package/dist/index.d.ts +0 -2
  37. package/dist/index.js +0 -1
  38. package/dist/server/auth.d.ts +4 -0
  39. package/dist/server/auth.js +4 -0
  40. package/dist/shop/client/index.d.ts +4 -0
  41. package/dist/shop/client/index.js +4 -0
  42. package/dist/sveltekit/config.d.ts +20 -0
  43. package/dist/sveltekit/config.js +20 -0
  44. package/dist/sveltekit/server/handle.d.ts +4 -0
  45. package/dist/sveltekit/server/handle.js +4 -0
  46. package/dist/sveltekit/server/index.d.ts +1 -0
  47. package/dist/sveltekit/server/index.js +2 -0
  48. package/dist/sveltekit/server/layout.d.ts +4 -0
  49. package/dist/sveltekit/server/layout.js +4 -0
  50. package/dist/sveltekit/server/preview.d.ts +4 -0
  51. package/dist/sveltekit/server/preview.js +4 -0
  52. package/dist/types/adapters/ai.d.ts +8 -0
  53. package/dist/types/adapters/db.d.ts +9 -0
  54. package/dist/types/adapters/email.d.ts +6 -0
  55. package/dist/types/adapters/files.d.ts +5 -0
  56. package/dist/types/index.d.ts +1 -0
  57. package/dist/types/index.js +1 -0
  58. package/dist/types/plugins.d.ts +8 -0
  59. package/dist/updates/{0.17.0 → 0.18.0}/index.js +1 -1
  60. package/dist/updates/0.19.0/index.d.ts +2 -0
  61. package/dist/updates/0.19.0/index.js +40 -0
  62. package/dist/updates/0.20.0/index.d.ts +2 -0
  63. package/dist/updates/0.20.0/index.js +54 -0
  64. package/dist/updates/index.js +4 -2
  65. package/package.json +20 -71
  66. /package/dist/updates/{0.17.0 → 0.18.0}/index.d.ts +0 -0
package/API.md ADDED
@@ -0,0 +1,409 @@
1
+ # includio-cms — Public API v0.20.0
2
+
3
+ > Auto-generated by `scripts/generate-api-md.ts`. Do not edit by hand.
4
+
5
+ Entry points: **15** · Stable: **345** · Experimental: **2**
6
+
7
+ Tags:
8
+ - `@public` — frozen for v1.0; semver-protected.
9
+ - `@experimental` — may change in 1.x without breaking semver.
10
+ - `@internal` — implementation detail; not listed here, do not import.
11
+
12
+ ## Stable
13
+
14
+ ### `includio-cms`
15
+
16
+ - `createEntityAPI(cms: CMS, opts?: EntityAPIOptions): <inferred>` — Creates a high-level Entity API (CRUD + publish/archive) bound to a CMS instance and a user.
17
+ - `getAuth(): <inferred>` — Returns the underlying `better-auth` instance from the initialized CMS.
18
+ - `getCMS(): CMS` — Returns the singleton CMS instance. Must be called after `includioCMS()` initializes the CMS in `hooks.server.ts`.
19
+ - `interface ResolvedMedia`
20
+ - `resolveMediaWithStyles(mediaIds: string[], styles?: ImageFieldStyle[]): Promise<Record<string, ResolvedMedia>>` — Resolve media files by IDs and generate image styles. Useful for plugins resolving media references (e.g. photo-grid).
21
+
22
+ ### `includio-cms/core`
23
+
24
+ - `createEntityAPI(cms: CMS, opts?: EntityAPIOptions): <inferred>` — Creates a high-level Entity API (CRUD + publish/archive) bound to a CMS instance and a user.
25
+ - `getAuth(): <inferred>` — Returns the underlying `better-auth` instance from the initialized CMS.
26
+ - `getCMS(): CMS` — Returns the singleton CMS instance. Must be called after `includioCMS()` initializes the CMS in `hooks.server.ts`.
27
+ - `interface ResolvedMedia`
28
+ - `resolveMediaWithStyles(mediaIds: string[], styles?: ImageFieldStyle[]): Promise<Record<string, ResolvedMedia>>` — Resolve media files by IDs and generate image styles. Useful for plugins resolving media references (e.g. photo-grid).
29
+
30
+ ### `includio-cms/types`
31
+
32
+ - `interface AccordionNode`
33
+ - `interface ApiKeyConfig`
34
+ - `interface ArrayField`
35
+ - `interface AuthConfig`
36
+ - `interface BaseField`
37
+ - `interface BlocksField`
38
+ - `interface BooleanField`
39
+ - `interface Breadcrumb`
40
+ - `interface CardNode`
41
+ - `interface CheckboxesField`
42
+ - `interface CMSConfig`
43
+ - `interface CmsContext`
44
+ - `interface CollectionConfig`
45
+ - `type ColumnRatio = | '1fr 1fr' | '2fr 1fr' | '1fr 2fr' | '3fr 1fr' | '1fr 3fr' | '1fr 1fr 1fr'`
46
+ - `interface ColumnsNode`
47
+ - `interface ConfigBase`
48
+ - `interface ConsentLogData`
49
+ - `interface ContentField`
50
+ - `interface CustomField`
51
+ - `interface DateField`
52
+ - `interface DateTimeField`
53
+ - `type Entry = { _id: string; _slug: string; _type: EntryType; _publishedAt?: Date | null; _url?: string; _sortO...`
54
+ - `type EntryStatus = (typeof entryStatuses)[number]`
55
+ - `type EntryType = (typeof entryTypes)[number]`
56
+ - `type EntryVersionStatus = (typeof entryVersionStatuses)[number]`
57
+ - `type Field = | TextField | ContentField | NumberField | BooleanField | DateField | DateTimeField | FileField |...`
58
+ - `interface FieldCondition`
59
+ - `type FieldType = | 'text' | 'content' | 'number' | 'boolean' | 'date' | 'datetime' | 'file' | 'media' | 'select' |...`
60
+ - `interface FileField`
61
+ - `type FlatImageFieldData = MediaFile & { _styles: Record<string, ImageStyle>; _blurDataUrl?: string | null; }`
62
+ - `type FlatMediaFieldData = FlatImageFieldData | FlatVideoFieldData`
63
+ - `type FlatVideoFieldData = MediaFile & { _styles: Record<string, VideoStyle>; _transcript: MediaFile | null; _audioDescripti...`
64
+ - `interface FormBaseField`
65
+ - `interface FormCheckboxField`
66
+ - `interface FormConfig`
67
+ - `interface FormEmailField`
68
+ - `type FormField = | FormTextField | FormEmailField | FormTextareaField | FormCheckboxField | FormSelectField | Form...`
69
+ - `type FormFieldType = 'text' | 'email' | 'textarea' | 'checkbox' | 'select' | 'file'`
70
+ - `interface FormSelectField`
71
+ - `interface FormSubmission`
72
+ - `interface FormTextareaField`
73
+ - `interface FormTextField`
74
+ - `type IconName = keyof typeof iconMap`
75
+ - `interface ImageFieldData`
76
+ - `interface ImageFieldStyle`
77
+ - `interface ImageStyle`
78
+ - `type Language = 'en' | 'pl'`
79
+ - `type Layout = LayoutPreset | LayoutNode[]`
80
+ - `type LayoutNode = SectionNode | ColumnsNode | CardNode | AccordionNode | StackNode`
81
+ - `type LayoutNodeType = 'section' | 'columns' | 'card' | 'accordion' | 'stack'`
82
+ - `type LayoutPreset = | 'sidebar-right' | 'two-column' | { preset: 'sidebar-right'; sidebar: string[] } | { preset: 'tw...`
83
+ - `type Localized = Partial<Record<InterfaceLanguage, string>> | string`
84
+ - `interface MediaField`
85
+ - `type MediaFieldData = ImageFieldData | VideoFieldData`
86
+ - `interface MediaFile`
87
+ - `type MediaFileType = 'image' | 'video' | 'audio' | 'pdf' | 'other'`
88
+ - `interface MediaTag`
89
+ - `interface NumberField`
90
+ - `interface ObjectField`
91
+ - `type ObjectFieldData = { _id?: string; _slug?: string; } & Record<string, unknown>`
92
+ - `interface RadioField`
93
+ - `interface RelationField`
94
+ - `type RelationFieldData = string | string[]`
95
+ - `interface SCFigureAttrs`
96
+ - `interface SCInlineBlockAttrs`
97
+ - `interface SCMark`
98
+ - `interface SCNode`
99
+ - `interface SCTypedInlineBlock`
100
+ - `interface SCVideoAttrs`
101
+ - `interface SectionNode`
102
+ - `interface SelectField`
103
+ - `interface SeoField`
104
+ - `interface SeoFieldData`
105
+ - `interface ShopField`
106
+ - `interface ShopFieldData`
107
+ - `type SimpleArrayItemType = 'text' | 'number' | 'url'`
108
+ - `interface SingleConfig`
109
+ - `interface SlugField`
110
+ - `interface StackNode`
111
+ - `interface StructuredContentDoc`
112
+ - `interface TextField`
113
+ - `interface TypographyConfig`
114
+ - `interface UrlField`
115
+ - `type UrlFieldData = { id?: string; url: Record<string, string>; text?: Record<string, string>; newTab?: boolean; rel?...`
116
+ - `interface UserData`
117
+ - `interface VideoFieldData`
118
+ - `interface VideoFieldStyle`
119
+ - `interface VideoStyle`
120
+ - `type VideoStyleStatus = 'pending' | 'processing' | 'done' | 'failed'`
121
+
122
+ ### `includio-cms/admin/client`
123
+
124
+ - `const AcceptInvitePage: LegacyComponentType`
125
+ - `const AdminAfterLoginLayout: LegacyComponentType`
126
+ - `const AdminLayout: LegacyComponentType`
127
+ - `const Badge: LegacyComponentType`
128
+ - `buildCustomFieldsMap(...plugins: PluginConfig[]): Map<string, CustomFieldDefinition>` — Build a Map<fieldType, CustomFieldDefinition> from plugin configs.
129
+ - `const Button: LegacyComponentType`
130
+ - `Card`
131
+ - `const CollectionPage: LegacyComponentType`
132
+ - `const DashboardPage: LegacyComponentType`
133
+ - `Dialog`
134
+ - `const EntryPage: LegacyComponentType`
135
+ - `const FileMiniature: LegacyComponentType`
136
+ - `const FormPage: LegacyComponentType`
137
+ - `const FormSubmissionPage: LegacyComponentType`
138
+ - `getContentLanguage`
139
+ - `getCustomFields(): Map<string, CustomFieldDefinition>`
140
+ - `getLocalizedLabel(label: Localized | undefined, lang: InterfaceLanguage): string`
141
+ - `getRemotes(): typeof remotes`
142
+ - `const Input: LegacyComponentType`
143
+ - `const Label: LegacyComponentType`
144
+ - `const LoginPage: LegacyComponentType`
145
+ - `const MaintenancePage: LegacyComponentType`
146
+ - `const MediaPage: LegacyComponentType`
147
+ - `const MediaSelector: LegacyComponentType`
148
+ - `const ResetPasswordPage: LegacyComponentType`
149
+ - `const Separator: LegacyComponentType`
150
+ - `const ShippingMethodEditPage: LegacyComponentType`
151
+ - `const ShippingMethodNewPage: LegacyComponentType`
152
+ - `const ShippingMethodsListPage: LegacyComponentType`
153
+ - `const ShopOrderDetailPage: LegacyComponentType`
154
+ - `const ShopOrdersListPage: LegacyComponentType`
155
+ - `const ShopProductsListPage: LegacyComponentType`
156
+ - `const Skeleton: LegacyComponentType`
157
+ - `Tabs`
158
+ - `Tooltip`
159
+ - `useField(form: SuperForm<Record<string, unknown>>, path: FormPathLeaves<Record<string, unknown>>): <inferred>` — Simplified wrapper around sveltekit-superforms' formFieldProxy.
160
+ - `useInterfaceLanguage(): <inferred>`
161
+ - `const UsersPage: LegacyComponentType`
162
+
163
+ ### `includio-cms/admin/remote`
164
+
165
+ - `const archiveEntryCommand: <inferred>`
166
+ - `const bulkDeleteMediaFiles: <inferred>`
167
+ - `const bulkSetMediaFileTags: <inferred>`
168
+ - `const cancelShipmentForOrderCmd: <inferred>`
169
+ - `const countMediaFiles: <inferred>`
170
+ - `const createEntry: <inferred>`
171
+ - `const createMediaTag: <inferred>`
172
+ - `const createShipmentForOrderCmd: <inferred>`
173
+ - `const createShippingMethodCmd: <inferred>`
174
+ - `const deleteEntryCommand: <inferred>`
175
+ - `const deleteFormSubmission: <inferred>`
176
+ - `const deleteFormSubmissions: <inferred>`
177
+ - `const deleteMediaFile: <inferred>`
178
+ - `const deleteMediaTag: <inferred>`
179
+ - `const deleteShippingMethodCmd: <inferred>`
180
+ - `const deleteShopDataForEntry: <inferred>`
181
+ - `const exportFormSubmissions: <inferred>`
182
+ - `const findMediaReferences: <inferred>`
183
+ - `const generateAltText: <inferred>`
184
+ - `const getAltOverview: <inferred>`
185
+ - `const getCollection: <inferred>`
186
+ - `const getCollections: <inferred>`
187
+ - `const getEmailConfigured: <inferred>`
188
+ - `const getEntries: <inferred>`
189
+ - `const getEntry: <inferred>`
190
+ - `const getEntryForEntryPage: <inferred>`
191
+ - `const getEntryLabels: <inferred>`
192
+ - `const getEntryVersion: <inferred>`
193
+ - `const getFileById: <inferred>`
194
+ - `const getForm: <inferred>`
195
+ - `const getForms: <inferred>`
196
+ - `const getFormSubmission: <inferred>`
197
+ - `const getFormSubmissions: <inferred>`
198
+ - `const getLanguages: <inferred>`
199
+ - `const getMedia: <inferred>`
200
+ - `const getMediaFiles: <inferred>`
201
+ - `const getMediaTags: <inferred>`
202
+ - `const getMediaTagsWithCounts: <inferred>`
203
+ - `const getOrderForAdmin: <inferred>`
204
+ - `const getRawEntries: <inferred>`
205
+ - `const getRawEntry: <inferred>`
206
+ - `const getRecentActivity: <inferred>`
207
+ - `const getRecentEntries: <inferred>`
208
+ - `const getRecordBySlug: <inferred>`
209
+ - `const getShippingMethodForAdmin: <inferred>`
210
+ - `const getShopConfig: <inferred>`
211
+ - `const getShopDataForEntry: <inferred>`
212
+ - `const getShopEnabled: <inferred>`
213
+ - `const getSingles: <inferred>`
214
+ - `const getSubmissionsOverview: <inferred>`
215
+ - `const isAIAvailable: <inferred>`
216
+ - `const listOrdersAdmin: <inferred>`
217
+ - `const listShippingMethodsAdmin: <inferred>`
218
+ - `const listShopableCollections: <inferred>`
219
+ - `const listShopProductEntries: <inferred>`
220
+ - `const populatePreviewData: <inferred>`
221
+ - `const regenerateVideoPoster: <inferred>`
222
+ - `const renameMediaFile: <inferred>`
223
+ - `const reorderEntriesCommand: <inferred>`
224
+ - `const reorderShippingMethodsCmd: <inferred>`
225
+ - `const resendOrderEmailCmd: <inferred>`
226
+ - `const setFocalPoint: <inferred>`
227
+ - `const setMediaFileAlt: <inferred>`
228
+ - `const setMediaFileTags: <inferred>`
229
+ - `const unarchiveEntryCommand: <inferred>`
230
+ - `const updateEntryCommand: <inferred>`
231
+ - `const updateEntryVersionCommand: <inferred>`
232
+ - `const updateFormSubmission: <inferred>`
233
+ - `const updateMediaAccessibility: <inferred>`
234
+ - `const updateMediaTag: <inferred>`
235
+ - `const updateOrderStatusCmd: <inferred>`
236
+ - `const updateShippingMethodCmd: <inferred>`
237
+ - `const upsertShopDataForEntry: <inferred>`
238
+
239
+ ### `includio-cms/sveltekit`
240
+
241
+ - `const CmsProvider: LegacyComponentType`
242
+ - `defineCollection(config: CollectionInput): CollectionConfig` — Defines a collection (multi-entry content type).
243
+ - `defineConfig(config: CMSConfig): CMSConfig` — Defines the root CMS configuration. Pass to `includioCMS()` in `hooks.server.ts`.
244
+ - `defineForm(config: FormConfig): FormConfig` — Defines a public form (submitted via `/api/forms/[slug]/submit`).
245
+ - `defineObject(config: Omit<ObjectField, 'type'>): ObjectField` — Defines a reusable object field (nested record). Use inside `fields[]`.
246
+ - `defineSingle(config: SingleInput): SingleConfig` — Defines a singleton (single-entry content type, e.g. site settings).
247
+ - `enableHybridEditing(): <inferred>` — Call in a layout/component script to enable data-hybrid-path rendering for all descendant HybridTarget/Image/Video.
248
+ - `extractBlocks(doc: StructuredContentDoc, type?: string): SCNode[]` — Extract block-level nodes, optionally filtered by type.
249
+ - `extractInlineBlocks(doc: StructuredContentDoc, blockType?: string): SCInlineBlockAttrs[]` — Extract inline block nodes, optionally filtered by blockType.
250
+ - `extractMediaRefs(doc: StructuredContentDoc): MediaRef[]` — Extract media references from figure/video/image nodes.
251
+ - `extractText(doc: StructuredContentDoc): string` — Extract all plain text from doc (useful for excerpts, search indexing).
252
+ - `getCustomFields(): Map<string, CustomFieldDefinition>`
253
+ - `getLink(link: string | { url: string | Record<string, string> } |..., language?: string): string` — Resolves a link value to a URL string.
254
+ - `getRemotes(): typeof remotes`
255
+ - `const HybridTarget: LegacyComponentType`
256
+ - `const Image: LegacyComponentType`
257
+ - `isImageFieldData(media: MediaFieldData): media is ImageFieldData`
258
+ - `isVideoFieldData(media: MediaFieldData): media is VideoFieldData`
259
+ - `const Media: LegacyComponentType`
260
+ - `const Preview: LegacyComponentType`
261
+ - `setCustomFields(defs: Map<string, CustomFieldDefinition>): <inferred>`
262
+ - `setPreferMp4(value: boolean): <inferred>`
263
+ - `setRemotes(data: typeof remotes): <inferred>`
264
+ - `const StructuredContent: LegacyComponentType`
265
+ - `structuredToHtml(doc: StructuredContentDoc, options: StructuredToHtmlOptions = {}): string` — Convert a StructuredContentDoc to an HTML string.
266
+ - `const Video: LegacyComponentType`
267
+
268
+ ### `includio-cms/sveltekit/server`
269
+
270
+ - `cmsLayoutLoad(event: RequestEvent): <inferred>` — Returns `cmsContext` from `event.locals` for use in a SvelteKit layout `load`. Drop into your `+layout.server.ts`.
271
+ - `countEntries(opts: CountEntriesOptions): Promise<number>` — Count entries matching the same filters as `resolveEntries`, without populating.
272
+ - `type CountEntriesOptions = Omit< ResolveEntriesOptions, 'limit' | 'offset' | 'populate' | 'orderBy' | 'dataOrderBy' >`
273
+ - `const createConsentLog: <inferred>`
274
+ - `const createFormSubmission: <inferred>`
275
+ - `createRestApiHandler(): <inferred>` — REST API handler factory. Returns `{ GET, POST, PUT, DELETE }` `RequestHandler`s authenticated via `x-api-key` header. Mount in `src/routes/admin/api/rest/[...restPath]/+server.ts`.
276
+ - `getPreviewEntry(event: RequestEvent, options: { language: string }): Promise<Entry | null>` — Resolves the preview entry from a `?preview=<versionId>` query param. Requires an authenticated session — throws `Unauthorized` otherwise.
277
+ - `includioCMS(cmsConfig: CMSConfig): Handle[]` — SvelteKit `Handle[]` array that initializes the CMS, generates runtime artifacts, wires auth/admin guards, and exposes `event.locals.cmsContext`. Compose with `sequence()` in `hooks.server.ts`.
278
+ - `parseFormDataForSubmission(formData: FormData, fields: FormField[]): Promise<Record<string, unknown>>` — Parses multipart `FormData` into a typed record of field values, handling file uploads via the configured files adapter.
279
+ - `type PopulateConfig = { /** Hard cap on relation depth. Default 5. Use `0` to keep all relations as raw IDs. */ maxDept...` — Recursion + per-field opt-out config for relation population.
280
+ - `resolveEntries(opts: ResolveEntriesOptions): Promise<Entry[]>` — Fetch a list of populated Entries from a collection (or singleton with multiple instances).
281
+ - `interface ResolveEntriesOptions`
282
+ - `resolveEntry(opts: ResolveEntryOptions): Promise<Entry | null>` — Fetch a single populated Entry.
283
+ - `interface ResolveEntryOptions`
284
+ - `type ResolveStatus = 'published' | 'draft' | 'scheduled'` — Status filter for `resolveEntry`/`resolveEntries`/`countEntries`.
285
+
286
+ ### `includio-cms/db-postgres`
287
+
288
+ - `const account: <inferred>`
289
+ - `const accountRelations: <inferred>`
290
+ - `const consentLogsTable: <inferred>`
291
+ - `type DatabaseAdapterWithDrizzle = DatabaseAdapter & { _drizzle: ReturnType<typeof drizzle<typeof schema>>; }`
292
+ - `const entriesTable: <inferred>`
293
+ - `const entryVersionsTable: <inferred>`
294
+ - `const formSubmissionsTable: <inferred>`
295
+ - `const imageStylesTable: <inferred>`
296
+ - `type InpostParcelSize = 'A' | 'B' | 'C'`
297
+ - `type InpostServiceType = | 'inpost_locker_standard' | 'inpost_locker_express' | 'inpost_courier_standard' | 'inpost_courie...`
298
+ - `const invitation: <inferred>`
299
+ - `const mediaFilesTable: <inferred>`
300
+ - `const mediaFileTagsTable: <inferred>`
301
+ - `const mediaTagsTable: <inferred>`
302
+ - `pg(config: Config): DatabaseAdapterWithDrizzle` — Postgres database adapter (drizzle + `postgres`).
303
+ - `const session: <inferred>`
304
+ - `const sessionRelations: <inferred>`
305
+ - `interface ShippingCarrierConfig`
306
+ - `type ShopCarrierType = 'none' | 'inpost' | string`
307
+ - `const shopOrderItemsTable: <inferred>`
308
+ - `const shopOrdersTable: <inferred>`
309
+ - `const shopOrderStatusHistoryTable: <inferred>`
310
+ - `const shopPaymentsTable: <inferred>`
311
+ - `type ShopPaymentStatus = 'pending' | 'paid' | 'failed' | 'refunded' | 'cancelled'`
312
+ - `const shopProductsTable: <inferred>`
313
+ - `const shopProductVariantsTable: <inferred>`
314
+ - `const shopShippingMethodsTable: <inferred>`
315
+ - `const shopStockReservationsTable: <inferred>`
316
+ - `const user: <inferred>`
317
+ - `const userRelations: <inferred>`
318
+ - `const verification: <inferred>`
319
+ - `const videoStylesTable: <inferred>`
320
+
321
+ ### `includio-cms/shop`
322
+
323
+ - `interface CarrierAdapter`
324
+ - `interface CarrierEvent`
325
+ - `interface ConsentConfig`
326
+ - `type Currency = 'PLN'`
327
+ - `defineShop(config: ShopConfig): ResolvedShopConfig`
328
+ - `type GeowidgetConfigPreset = | 'parcelcollect' | 'parcelsend' | 'parcelcollect247' | string`
329
+ - `type I18nText = { [lang: string]: string; }`
330
+ - `inpostAdapter(opts: InpostAdapterOptions): CarrierAdapter`
331
+ - `interface InpostAdapterOptions`
332
+ - `type InpostEnvironment = 'production' | 'sandbox'` — InPost Points API — public, no auth required. Used to validate that a parcel
333
+ - `interface InpostSenderAddress`
334
+ - `manualAdapter(opts: ManualPaymentAdapterOptions = {}): PaymentAdapter` — Manual payment adapter — order goes to awaitingPayment, admin marks as paid later
335
+ - `interface OrderRef`
336
+ - `type OrderStatus = | 'new' | 'awaitingPayment' | 'paid' | 'preparing' | 'sent' | 'done' | 'cancelled' | 'paymentReje...`
337
+ - `interface PaymentAdapter`
338
+ - `interface PaymentCreateContext`
339
+ - `interface PaymentCreateResult`
340
+ - `interface PaymentEvent`
341
+ - `payuAdapter(opts: PayuAdapterOptions): PaymentAdapter`
342
+ - `interface PayuAdapterOptions`
343
+ - `interface ResolvedShopConfig`
344
+ - `interface ShipmentCreateInput`
345
+ - `interface ShipmentCreateResult`
346
+ - `interface ShipmentLabel`
347
+ - `interface ShopConfig`
348
+ - `interface ShopFeatures`
349
+
350
+ ### `includio-cms/shop/client`
351
+
352
+ - `interface CartItemRef`
353
+ - `interface CartLine`
354
+ - `interface CartSnapshot`
355
+ - `interface CheckoutInput`
356
+ - `interface CheckoutResult`
357
+ - `createOrderState(opts: CreateOrderStateOptions): OrderState`
358
+ - `interface CreateOrderStateOptions`
359
+ - `createShopClient(options: ShopClientOptions = {}): ShopClient`
360
+ - `const DEFAULT_LABELS_PL: OrderStatusLabels`
361
+ - `const InpostPicker: LegacyComponentType`
362
+ - `interface OrderDetailResponse`
363
+ - `type OrderPaymentPhase = 'idle' | 'polling' | 'retrying' | 'refreshing'`
364
+ - `type OrderState = OrderStateImpl`
365
+ - `const OrderStatus: LegacyComponentType`
366
+ - `interface OrderStatusLabels`
367
+ - `interface RefreshPaymentResult`
368
+ - `interface RetryPaymentResult`
369
+ - `interface ShippingMethodPublic`
370
+ - `interface ShopClient`
371
+ - `interface ShopClientOptions`
372
+
373
+ ### `includio-cms/shop/http`
374
+
375
+ - `createCarrierConfigHandler(): { GET: RequestHandler }` — Public endpoint that returns front-end facing carrier widget descriptor for
376
+ - `createCarrierWebhookHandler(): { POST: RequestHandler }` — Public webhook receiver for carrier events (e.g. ShipX `shipment_status_changed`).
377
+ - `createCartHandler(): { GET: RequestHandler; POST: RequestHandler; PATCH: RequestHandler; DELETE: R...`
378
+ - `createCheckoutHandler(): { POST: RequestHandler }`
379
+ - `createOrderHandler(): { GET: RequestHandler }`
380
+ - `createPaymentWebhookHandler(): { POST: RequestHandler }`
381
+ - `createRefreshPaymentHandler(): { POST: RequestHandler }`
382
+ - `createRetryPaymentHandler(): { POST: RequestHandler }`
383
+ - `createShipmentLabelHandler(): { GET: RequestHandler }` — Admin-only PDF proxy that streams the carrier label without exposing the
384
+ - `createShippingMethodsHandler(): { GET: RequestHandler }`
385
+
386
+ ### `includio-cms/files-local`
387
+
388
+ - `const fullDir: <inferred>`
389
+ - `local(config?: LocalFilesConfig): FilesAdapter` — Local-disk files adapter. Stores uploads under `./static/uploads` (dev) or `/data/uploads` (prod).
390
+ - `interface LocalFilesConfig`
391
+
392
+ ### `includio-cms/email-nodemailer`
393
+
394
+ - `nodemailerAdapter(options: Options): EmailAdapter` — SMTP email adapter built on `nodemailer`.
395
+
396
+ ### `includio-cms/ai-openai`
397
+
398
+ - `openAIAdapter(config: AIConfig): AIAdapter` — OpenAI AI adapter for `generateAltText`.
399
+
400
+ ### `includio-cms/ai-claude`
401
+
402
+ - `claudeAdapter(config: AIConfig): AIAdapter` — Anthropic Claude AI adapter for `generateAltText`.
403
+
404
+ ## Experimental
405
+
406
+ ### `includio-cms/types`
407
+
408
+ - `interface CustomFieldDefinition` — Defines a custom field type contributed by a plugin.
409
+ - `interface PluginConfig` — CMS plugin configuration — register custom field types and CRUD lifecycle hooks.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,104 @@
3
3
  All notable changes to includio-cms are documented here.
4
4
  Generated from `src/lib/updates/` — do not edit manually.
5
5
 
6
- ## 0.17.0 — 2026-04-29
6
+ ## 0.20.0 — 2026-04-29
7
+
8
+ API Surface Lock — exports trim 26→15, JSDoc tagi (`@public`/`@experimental`/`@internal`), autogenerowany `API.md`. Powierzchnia publiczna zamrożona w v1.0 — w 1.x tylko `@experimental` może się zmienić bez breaking semver.
9
+
10
+ ### Added
11
+ - `API.md` w root — autogenerowany przez `scripts/generate-api-md.ts` (ts-morph). 15 entry pointów, ~345 stable, 2 experimental. Skrypt wpięty w `prepublishOnly`.
12
+ - Wszystkie publiczne `define*` helpery (`defineConfig`, `defineCollection`, `defineSingle`, `defineForm`, `defineObject`) oznaczone `@public`.
13
+ - `getCMS`, `getAuth`, `createEntityAPI`, `resolveMediaWithStyles`, `includioCMS`, `cmsLayoutLoad`, `getPreviewEntry`, `createFormSubmission`, `parseFormDataForSubmission`, `createConsentLog`, `createRestApiHandler` — `@public`.
14
+ - `PluginConfig` + `CustomFieldDefinition` oznaczone `@experimental` — plugin hooks API finalizujemy w 1.x.
15
+
16
+ ### Breaking
17
+ - **`package.json` exports trim 26→15.** Usunięte / scalone entry pointy poniżej. Każdy import wymaga jednorazowej migracji (znajdź-i-zamień).
18
+ - `includio-cms/admin` → `includio-cms/types` (typy `UserData`, `Breadcrumb` przeniesione do publicznych typów).
19
+ - `includio-cms/admin/helpers` → `includio-cms/admin/client` (re-eksport — zmień tylko ścieżkę importu).
20
+ - `includio-cms/admin/ui` → `includio-cms/admin/client` (re-eksport — zmień tylko ścieżkę importu).
21
+ - `includio-cms/admin/client/account` → `includio-cms/admin/client` (re-eksport — `AccountPage` dostępny pod nową ścieżką).
22
+ - `includio-cms/admin/api/*` (wildcard) → **usunięte**. Były to internalsy (media-gc, upload, transcode, replace) — nie powinny być publiczne. Brak migracji.
23
+ - `includio-cms/admin/api/rest/handler` → `includio-cms/sveltekit/server` (`createRestApiHandler` — zmień ścieżkę importu).
24
+ - `includio-cms/admin/client/*.svelte` (wildcard) → użyj nazwanych eksportów z `includio-cms/admin/client`.
25
+ - `includio-cms/sveltekit/components/*.svelte` (wildcard) → użyj nazwanych eksportów z `includio-cms/sveltekit`.
26
+ - `includio-cms/db-postgres/schema-core` + `includio-cms/db-postgres/schema-shop` + `includio-cms/auth-schema` → `includio-cms/db-postgres` (jeden barrel — wszystkie tabele, w tym auth, dostępne pod jedną ścieżką).
27
+ - `includio-cms/auth` → `includio-cms/core` (`getAuth` — zmień ścieżkę importu).
28
+ - `includio-cms/entity` → `includio-cms/core` (`createEntityAPI` — zmień ścieżkę importu).
29
+ - `includio-cms/shop/svelte` → `includio-cms/shop/client` (`OrderStatus`, `InpostPicker`, `DEFAULT_LABELS_PL`, `OrderStatusLabels` — zmień ścieżkę importu).
30
+ - `includio-cms/updates` → **usunięte** (internal CLI tooling, nigdy nie powinno być w runtime API).
31
+
32
+ ### Notes
33
+
34
+ Migracja (znajdź-i-zamień):
35
+
36
+ ```bash
37
+ # Przykładowe sed'y (dostosuj do swojego edytora):
38
+ sed -i '' "s|'includio-cms/admin/helpers'|'includio-cms/admin/client'|g" src/**/*.ts
39
+ sed -i '' "s|'includio-cms/admin/ui'|'includio-cms/admin/client'|g" src/**/*.ts
40
+ sed -i '' "s|'includio-cms/auth'|'includio-cms/core'|g" src/**/*.ts
41
+ sed -i '' "s|'includio-cms/entity'|'includio-cms/core'|g" src/**/*.ts
42
+ sed -i '' "s|'includio-cms/shop/svelte'|'includio-cms/shop/client'|g" src/**/*.ts
43
+ sed -i '' "s|'includio-cms/auth-schema'|'includio-cms/db-postgres'|g" src/**/*.ts
44
+ sed -i '' "s|'includio-cms/db-postgres/schema-core'|'includio-cms/db-postgres'|g" src/**/*.ts
45
+ sed -i '' "s|'includio-cms/db-postgres/schema-shop'|'includio-cms/db-postgres'|g" src/**/*.ts
46
+ sed -i '' "s|'includio-cms/admin/api/rest/handler'|'includio-cms/sveltekit/server'|g" src/**/*.ts
47
+ ```
48
+
49
+ Po migracji uruchom `pnpm check` — TypeScript zweryfikuje czy wszystkie symbole są dostępne pod nową ścieżką.
50
+
51
+ API Surface freeze v1.0:
52
+
53
+ - **`@public`** — stabilne, semver-protected w v1.0. Breaking change wymaga major bump.
54
+ - **`@experimental`** — może się zmienić w 1.x bez breaking semver (np. `PluginConfig` — plugin hooks API).
55
+ - **`@internal`** — implementation detail, NIE importować. Nie listowane w `API.md`.
56
+
57
+ Pełna lista publicznych symboli per entry point: `API.md` w root paczki (regenerowany przy każdym `npm publish`).
58
+
59
+ Brak SQL migration. Zmiana czysto package-level.
60
+
61
+ ## 0.19.0 — 2026-04-29
62
+
63
+ Adapter contracts final + 3rd-party SDKs (`@anthropic-ai/sdk`, `openai`, `nodemailer`) przeniesione do `peerDependenciesMeta` jako optional. Adapter typy + factory oznaczone `@public` JSDoc. README sekcja "Writing your own adapter".
64
+
65
+ ### Added
66
+ - Adapter typy (`DatabaseAdapter`, `FilesAdapter`, `EmailAdapter`, `AIAdapter`) finalne, oznaczone `@public` JSDoc — stabilna powierzchnia kontraktu, TypeScript egzekwuje surface.
67
+ - Factory funkcje adapterów (`pg`, `local`, `nodemailerAdapter`, `openAIAdapter`, `claudeAdapter`) oznaczone `@public`.
68
+ - README sekcja "Writing your own adapter" + przykład bazujący na `db-postgres` + tabela optional peer dependencies.
69
+ - Lazy import 3 SDK (`@anthropic-ai/sdk`, `openai`, `nodemailer`) w factory adapterach — SDK nie ładuje się dopóki adapter nie jest faktycznie użyty.
70
+
71
+ ### Fixed
72
+ - Bundle slim — instalacja `includio-cms` w czystym projekcie nie ciąga już ~7-9MB SDK (anthropic + openai + nodemailer). Zostają w peer optional, doinstalowane tylko gdy faktycznie potrzebne.
73
+
74
+ ### Breaking
75
+ - **`@anthropic-ai/sdk`, `openai`, `nodemailer` przeniesione z `dependencies` do `peerDependenciesMeta` jako optional**. Userland używający `email-nodemailer`/`ai-openai`/`ai-claude` musi sam doinstalować odpowiedni SDK: `pnpm add nodemailer`, `pnpm add openai`, `pnpm add @anthropic-ai/sdk`. Brak peer = throw przy pierwszym użyciu adaptera (`generateAltText`/`sendMail`) z czytelnym komunikatem co doinstalować.
76
+ - **`runed` przeniesione z `peerDependenciesMeta.optional` do required peer**. `runed` jest hard-importowane w admin UI (PersistedState), więc opcjonalność była fikcyjna — userland uruchamiający admin BEZ `runed` dostawał crash przy bootcie. Teraz peer wymaga jawnej instalacji (lub pozostaje pulled przez SvelteKit projektu).
77
+
78
+ ### Notes
79
+
80
+ Migracja:
81
+
82
+ 1. Dodaj wymagane peer SDK do swojego `package.json`:
83
+
84
+ ```bash
85
+ # Jeśli używasz nodemailerAdapter:
86
+ pnpm add nodemailer
87
+
88
+ # Jeśli używasz openAIAdapter:
89
+ pnpm add openai
90
+
91
+ # Jeśli używasz claudeAdapter:
92
+ pnpm add @anthropic-ai/sdk
93
+ ```
94
+
95
+ 2. `runed` był już peer wcześniej, ale teraz nie jest optional — upewnij się że jest zainstalowane (zwykle pulled przez SvelteKit). Jeśli `pnpm install` zgłasza missing peer, dodaj jawnie: `pnpm add runed`.
96
+
97
+ Brak SQL migration. Zmiana czysto package-level.
98
+
99
+ Pisanie własnych adapterów:
100
+
101
+ Wszystkie 4 typy adapterów (`DatabaseAdapter`, `FilesAdapter`, `EmailAdapter`, `AIAdapter`) mają teraz `@public` kontrakty. Patrz README sekcja "Writing your own adapter" + przykład bazujący na `db-postgres`.
102
+
103
+ ## 0.18.0 — 2026-04-29
7
104
 
8
105
  Konsolidacja entry resolverów — kanoniczny `resolveEntry()` / `resolveEntries()` / `countEntries()` w jednym public API. Locale strict, cycle detection, populate config per-field opt-out + maxDepth. Hard remove starych funkcji (getEntry, getEntries, getRawEntry/ies, getDbEntry/ies, populateEntryData) z public surface — przeniesione do internal lub całkowicie usunięte.
9
106
 
package/DOCS.md CHANGED
@@ -1,4 +1,4 @@
1
- # Includio CMS Documentation (v0.18.0)
1
+ # Includio CMS Documentation (v0.20.0)
2
2
 
3
3
  > This file is auto-generated from the docs site. For the latest version, update the package.
4
4
 
package/README.md CHANGED
@@ -38,6 +38,68 @@ export default defineConfig({
38
38
 
39
39
  See the [full documentation](/docs) for installation, configuration, and usage.
40
40
 
41
+ ## Writing your own adapter
42
+
43
+ `includio-cms` ships with default adapters (`db-postgres`, `files-local`, `email-nodemailer`, `ai-openai`, `ai-claude`). Each is a factory returning an object that implements a `@public` contract from `includio-cms/types`. Build your own by implementing the same interface — TypeScript will enforce the surface.
44
+
45
+ Four adapter contracts:
46
+
47
+ - `DatabaseAdapter` — entries, versions, media, tags, form submissions, consent logs.
48
+ - `FilesAdapter` — file upload/download/list, optional private files (e.g. shop receipts).
49
+ - `EmailAdapter` — `sendMail`, default from address/name.
50
+ - `AIAdapter` — currently `generateAltText(fileId)`.
51
+
52
+ Source of truth: [`src/lib/types/adapters/`](src/lib/types/adapters/).
53
+
54
+ ### Minimal custom DB adapter (sketch)
55
+
56
+ ```ts
57
+ import type { DatabaseAdapter } from 'includio-cms/types';
58
+
59
+ export function myDbAdapter(config: { connection: string }): DatabaseAdapter {
60
+ // ...connect, prepare your client...
61
+ return {
62
+ createEntry: async (data) => { /* ... */ },
63
+ getEntries: async (opts) => { /* ... */ },
64
+ countEntries: async (opts) => { /* ... */ },
65
+ updateEntry: async (data) => { /* ... */ },
66
+ archiveEntry: async (data) => { /* ... */ },
67
+ deleteEntry: async (data) => { /* ... */ },
68
+ createEntryVersion: async (data) => { /* ... */ },
69
+ updateEntryVersion: async (data) => { /* ... */ },
70
+ getEntryVersions: async (data) => { /* ... */ },
71
+ deleteEntryVersion: async (data) => { /* ... */ },
72
+ // ...form submissions, media files, image/video styles, tags, consent logs...
73
+ };
74
+ }
75
+ ```
76
+
77
+ Wire it in `cms.config.ts`:
78
+
79
+ ```ts
80
+ import { defineConfig } from 'includio-cms/sveltekit';
81
+ import { myDbAdapter } from './my-adapter.js';
82
+
83
+ export default defineConfig({
84
+ db: myDbAdapter({ connection: process.env.MY_DB_URL! }),
85
+ // ...
86
+ });
87
+ ```
88
+
89
+ Reference implementation: [`src/lib/db-postgres/index.ts`](src/lib/db-postgres/index.ts) (drizzle + `postgres`).
90
+
91
+ ### Optional peer dependencies
92
+
93
+ The default email + AI adapters depend on third-party SDKs that **are not installed by default**. If you use them, install the peer:
94
+
95
+ | Adapter | Required peer | Install |
96
+ | ------------------------- | ------------------------ | -------------------------------------- |
97
+ | `email-nodemailer` | `nodemailer` | `pnpm add nodemailer` |
98
+ | `ai-openai` | `openai` | `pnpm add openai` |
99
+ | `ai-claude` | `@anthropic-ai/sdk` | `pnpm add @anthropic-ai/sdk` |
100
+
101
+ Each SDK is loaded lazily on first call. Missing peer throws a clear error at runtime — install it and the adapter wakes up.
102
+
41
103
  ## Links
42
104
 
43
105
  - [Full Documentation](DOCS.md)
package/ROADMAP.md CHANGED
@@ -338,6 +338,7 @@
338
338
 
339
339
  > 13 faz w ~16 sesjach, droga 0.16 → 1.0.0. Lean scope: stabilizacja, security, testy, docs, audit + polish shopa. Bez nowych feature'ów.
340
340
 
341
+ - [x] `[breaking]` `[P0]` API surface lock — exports trim 26→15, JSDoc tagi (@public/@internal/@experimental), `API.md` autogenerated (0.20.0) <!-- files: package.json, scripts/generate-api-md.ts -->
341
342
  - [ ] `[fix]` `[P1]` Select field — `defaultValue` propagacja do zod schema (full repro: `ideas/post-v1/select-field-defaultvalue-bug.md`); fix planowany w Fazie 12 (RC)
342
343
 
343
344
  ## v1.x — Post-v1.0 deferred
@@ -1,4 +1,8 @@
1
1
  import { type RequestHandler } from '@sveltejs/kit';
2
+ /**
3
+ * REST API handler factory. Returns `{ GET, POST, PUT, DELETE }` `RequestHandler`s authenticated via `x-api-key` header. Mount in `src/routes/admin/api/rest/[...restPath]/+server.ts`.
4
+ * @public
5
+ */
2
6
  export declare function createRestApiHandler(): {
3
7
  GET: RequestHandler;
4
8
  POST: RequestHandler;
@@ -49,6 +49,10 @@ function matchRoute(method, path) {
49
49
  }
50
50
  return null;
51
51
  }
52
+ /**
53
+ * REST API handler factory. Returns `{ GET, POST, PUT, DELETE }` `RequestHandler`s authenticated via `x-api-key` header. Mount in `src/routes/admin/api/rest/[...restPath]/+server.ts`.
54
+ * @public
55
+ */
52
56
  export function createRestApiHandler() {
53
57
  function handle(method) {
54
58
  return async (event) => {
@@ -18,3 +18,5 @@ export { default as ShippingMethodNewPage } from './shop/shipping-method-new-pag
18
18
  export { default as ShippingMethodEditPage } from './shop/shipping-method-edit-page.svelte';
19
19
  export { default as ShopOrdersListPage } from './shop/shop-orders-list-page.svelte';
20
20
  export { default as ShopOrderDetailPage } from './shop/shop-order-detail-page.svelte';
21
+ export * from '../helpers/index.js';
22
+ export * from '../ui/index.js';
@@ -18,3 +18,7 @@ export { default as ShippingMethodNewPage } from './shop/shipping-method-new-pag
18
18
  export { default as ShippingMethodEditPage } from './shop/shipping-method-edit-page.svelte';
19
19
  export { default as ShopOrdersListPage } from './shop/shop-orders-list-page.svelte';
20
20
  export { default as ShopOrderDetailPage } from './shop/shop-order-detail-page.svelte';
21
+ // Folded from `./admin/helpers` (dropped as separate export in 0.20.0)
22
+ export * from '../helpers/index.js';
23
+ // Folded from `./admin/ui` (dropped as separate export in 0.20.0)
24
+ export * from '../ui/index.js';
@@ -1,2 +1,11 @@
1
1
  import type { AIAdapter, AIConfig } from '../types/adapters/ai.js';
2
+ /**
3
+ * Anthropic Claude AI adapter for `generateAltText`.
4
+ *
5
+ * `@anthropic-ai/sdk` is an **optional peer dependency** — install it in your
6
+ * project (`pnpm add @anthropic-ai/sdk`) when using this adapter. SDK loads
7
+ * lazily on first call; missing peer throws a clear error.
8
+ *
9
+ * @public
10
+ */
2
11
  export declare function claudeAdapter(config: AIConfig): AIAdapter;