includio-cms 0.14.3 → 0.14.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
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.14.4 — 2026-03-31
7
+
8
+ Improved type generation — select/checkboxes emit union types, fields with defaultValue are non-optional
9
+
10
+ ### Added
11
+ - Type generation: select and checkboxes fields now emit string literal union types instead of generic `string`/`string[]`
12
+ - Type generation: fields with `defaultValue` are now treated as guaranteed (non-optional) in generated TypeScript types
13
+
6
14
  ## 0.14.3 — 2026-03-27
7
15
 
8
16
  Background maintenance system — automatic style generation, poster regeneration, video transcoding, orphan cleanup on configurable schedule
package/DOCS.md CHANGED
@@ -1,4 +1,4 @@
1
- # Includio CMS Documentation (v0.14.3)
1
+ # Includio CMS Documentation (v0.14.4)
2
2
 
3
3
  > This file is auto-generated from the docs site. For the latest version, update the package.
4
4
 
package/ROADMAP.md CHANGED
@@ -300,7 +300,7 @@
300
300
  ## Backlog
301
301
 
302
302
  - [ ] `[feature]` `[P1]` Server-side pagination API (formalize 0.1.0 fix)
303
- - [ ] `[feature]` `[P1]` Improved type generation <!-- files: src/lib/core/server/generator/ -->
303
+ - [x] `[feature]` `[P1]` Improved type generation — union types for select/checkboxes, defaultValue makes fields non-optional <!-- files: src/lib/core/server/generator/ -->
304
304
  - [ ] `[feature]` `[P1]` Proper filtering API (SQL-level, not JS post-query)
305
305
  - [ ] `[feature]` `[P1]` Ban/unban UI — reason + expiry, `banUser`/`unbanUser` <!-- files: src/lib/admin/client/users/ban-user-dialog.svelte -->
306
306
  - [ ] `[feature]` `[P1]` Impersonation UI — impersonate/stop bar <!-- files: src/lib/admin/client/users/impersonation-bar.svelte -->
@@ -1,5 +1,8 @@
1
1
  import { toPascalCase } from './utils.js';
2
2
  let _customFields = new Map();
3
+ function isGuaranteed(f) {
4
+ return !!(f.required || f.type === 'seo' || f.defaultValue !== undefined);
5
+ }
3
6
  export function setGeneratorCustomFields(customFields) {
4
7
  _customFields = customFields;
5
8
  }
@@ -27,10 +30,12 @@ function getFieldTypeAsString(field) {
27
30
  const name = toPascalCase(field.collection);
28
31
  return field.multiple ? `${name}[]` : name;
29
32
  }
30
- case 'select':
31
- return field.multiple ? 'string[]' : 'string';
33
+ case 'select': {
34
+ const union = field.options.map((opt) => `'${opt.value.trim()}'`).join(' | ');
35
+ return field.multiple ? `(${union})[]` : union;
36
+ }
32
37
  case 'checkboxes':
33
- return 'string[]';
38
+ return `(${field.options.map((opt) => `'${opt.value.trim()}'`).join(' | ')})[]`;
34
39
  case 'number':
35
40
  return 'number';
36
41
  case 'boolean':
@@ -38,7 +43,7 @@ function getFieldTypeAsString(field) {
38
43
  case 'object':
39
44
  return `{
40
45
  slug: '${field.slug}';
41
- data: {${field.fields.map((f) => ` ${f.slug}${f.required ? '' : '?'}: ${getFieldTypeAsString(f)}`).join(';\n')}};
46
+ data: {${field.fields.map((f) => ` ${f.slug}${isGuaranteed(f) ? '' : '?'}: ${getFieldTypeAsString(f)}`).join(';\n')}};
42
47
  }`;
43
48
  case 'blocks':
44
49
  return `
@@ -47,7 +52,7 @@ function getFieldTypeAsString(field) {
47
52
  .map((f) => `
48
53
  {
49
54
  slug: '${f.slug}';
50
- data: {${f.fields.map((f) => ` ${f.slug}${f.required ? '' : '?'}: ${getFieldTypeAsString(f)}`).join(';\n')}};
55
+ data: {${f.fields.map((f) => ` ${f.slug}${isGuaranteed(f) ? '' : '?'}: ${getFieldTypeAsString(f)}`).join(';\n')}};
51
56
  }
52
57
  `)
53
58
  .join(' | ')}
@@ -91,12 +96,12 @@ function getFieldTypeAsString(field) {
91
96
  }
92
97
  export function generateTsTypeFromFields(fields) {
93
98
  return `{
94
- ${fields.map((f) => ` ${f.slug}${f.required || f.type === 'seo' ? '' : '?'}: ${getFieldTypeAsString(f)}`).join(';\n')};
99
+ ${fields.map((f) => ` ${f.slug}${isGuaranteed(f) ? '' : '?'}: ${getFieldTypeAsString(f)}`).join(';\n')};
95
100
  }`;
96
101
  }
97
102
  export function generateFlatTsTypeFromFields(fields) {
98
103
  return `{
99
- ${fields.map((f) => ` ${f.slug}${f.required || f.type === 'seo' ? '' : '?'}: ${getFlatFieldTypeAsString(f)}`).join(';\n')};
104
+ ${fields.map((f) => ` ${f.slug}${isGuaranteed(f) ? '' : '?'}: ${getFlatFieldTypeAsString(f)}`).join(';\n')};
100
105
  }`;
101
106
  }
102
107
  function getFlatFieldTypeAsString(field) {
@@ -114,7 +119,7 @@ function getFlatFieldTypeAsString(field) {
114
119
  case 'object':
115
120
  return `{
116
121
  _slug: '${field.slug}';
117
- ${field.fields.map((f) => `${f.slug}${f.required ? '' : '?'}: ${getFlatFieldTypeAsString(f)}`).join(';\n')};
122
+ ${field.fields.map((f) => `${f.slug}${isGuaranteed(f) ? '' : '?'}: ${getFlatFieldTypeAsString(f)}`).join(';\n')};
118
123
  }`;
119
124
  case 'blocks':
120
125
  return `
@@ -123,7 +128,7 @@ function getFlatFieldTypeAsString(field) {
123
128
  .map((f) => `
124
129
  {
125
130
  _slug: '${f.slug}';
126
- ${f.fields.map((f) => `${f.slug}${f.required ? '' : '?'}: ${getFlatFieldTypeAsString(f)}`).join(';\n')};
131
+ ${f.fields.map((f) => `${f.slug}${isGuaranteed(f) ? '' : '?'}: ${getFlatFieldTypeAsString(f)}`).join(';\n')};
127
132
  }
128
133
  `)
129
134
  .join(' | ')}
@@ -134,6 +139,6 @@ function getFlatFieldTypeAsString(field) {
134
139
  }
135
140
  export function generateInlineBlockTypeString(block) {
136
141
  return `{
137
- ${block.fields.map((f) => ` ${f.slug}${f.required ? '' : '?'}: ${getFlatFieldTypeAsString(f)}`).join(';\n')};
142
+ ${block.fields.map((f) => ` ${f.slug}${isGuaranteed(f) ? '' : '?'}: ${getFlatFieldTypeAsString(f)}`).join(';\n')};
138
143
  }`;
139
144
  }
@@ -0,0 +1,2 @@
1
+ import type { CmsUpdate } from '../index.js';
2
+ export declare const update: CmsUpdate;
@@ -0,0 +1,11 @@
1
+ export const update = {
2
+ version: '0.14.4',
3
+ date: '2026-03-31',
4
+ description: 'Improved type generation — select/checkboxes emit union types, fields with defaultValue are non-optional',
5
+ features: [
6
+ 'Type generation: select and checkboxes fields now emit string literal union types instead of generic `string`/`string[]`',
7
+ 'Type generation: fields with `defaultValue` are now treated as guaranteed (non-optional) in generated TypeScript types'
8
+ ],
9
+ fixes: [],
10
+ breakingChanges: []
11
+ };
@@ -41,7 +41,8 @@ import { update as update0140 } from './0.14.0/index.js';
41
41
  import { update as update0141 } from './0.14.1/index.js';
42
42
  import { update as update0142 } from './0.14.2/index.js';
43
43
  import { update as update0143 } from './0.14.3/index.js';
44
- export const updates = [update0065, update0066, update0067, update0068, update0069, update010, update011, update012, update013, update014, update015, update020, update022, update050, update051, update052, update053, update054, update055, update056, update057, update058, update060, update061, update062, update070, update071, update072, update073, update080, update090, update0100, update0110, update0120, update0130, update0131, update0132, update0133, update0134, update0140, update0141, update0142, update0143];
44
+ import { update as update0144 } from './0.14.4/index.js';
45
+ export const updates = [update0065, update0066, update0067, update0068, update0069, update010, update011, update012, update013, update014, update015, update020, update022, update050, update051, update052, update053, update054, update055, update056, update057, update058, update060, update061, update062, update070, update071, update072, update073, update080, update090, update0100, update0110, update0120, update0130, update0131, update0132, update0133, update0134, update0140, update0141, update0142, update0143, update0144];
45
46
  export const getUpdatesFrom = (fromVersion) => {
46
47
  const fromParts = fromVersion.split('.').map(Number);
47
48
  return updates.filter((update) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "includio-cms",
3
- "version": "0.14.3",
3
+ "version": "0.14.4",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",