includio-cms 0.37.2 → 0.37.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.
Files changed (42) hide show
  1. package/API.md +3 -2
  2. package/CHANGELOG.md +19 -0
  3. package/DOCS.md +1 -1
  4. package/ROADMAP.md +21 -0
  5. package/dist/core/cms.d.ts +4 -1
  6. package/dist/core/cms.js +9 -2
  7. package/dist/core/fields/slugPath.d.ts +1 -1
  8. package/dist/core/fields/slugPath.js +3 -2
  9. package/dist/core/i18n/localeUrl.d.ts +20 -0
  10. package/dist/core/i18n/localeUrl.js +36 -0
  11. package/dist/core/server/entries/operations/get.js +1 -1
  12. package/dist/core/server/entries/operations/resolveEntry.d.ts +4 -2
  13. package/dist/core/server/entries/operations/resolveEntry.js +25 -43
  14. package/dist/core/server/entries/operations/versionResolve.d.ts +39 -0
  15. package/dist/core/server/entries/operations/versionResolve.js +52 -0
  16. package/dist/core/server/fields/populateSelect.d.ts +22 -0
  17. package/dist/core/server/fields/populateSelect.js +28 -0
  18. package/dist/core/server/fields/resolveRelationFields.d.ts +8 -8
  19. package/dist/core/server/fields/resolveRelationFields.js +135 -113
  20. package/dist/core/server/fields/resolveRichtextLinks.js +1 -1
  21. package/dist/core/server/fields/resolveUrlFields.js +1 -1
  22. package/dist/core/server/fields/slugResolver.d.ts +2 -2
  23. package/dist/core/server/fields/slugResolver.js +12 -4
  24. package/dist/core/server/generator/generator.js +60 -1
  25. package/dist/db-postgres/index.js +48 -0
  26. package/dist/db-postgres/schema/entry.js +2 -2
  27. package/dist/db-postgres/schema/entryVersion.js +5 -2
  28. package/dist/db-postgres/schema/mediaFileTag.js +4 -2
  29. package/dist/sveltekit/server/handle.js +5 -5
  30. package/dist/types/adapters/db.d.ts +13 -1
  31. package/dist/types/cms.d.ts +3 -2
  32. package/dist/types/cms.schema.d.ts +22 -0
  33. package/dist/types/cms.schema.js +15 -3
  34. package/dist/types/collections.d.ts +3 -0
  35. package/dist/types/entries.d.ts +2 -0
  36. package/dist/types/fields.d.ts +12 -0
  37. package/dist/types/languages.d.ts +13 -0
  38. package/dist/types/languages.js +2 -1
  39. package/dist/updates/0.37.4/index.d.ts +2 -0
  40. package/dist/updates/0.37.4/index.js +17 -0
  41. package/dist/updates/index.js +3 -1
  42. package/package.json +1 -1
@@ -22,6 +22,11 @@ export declare const cmsConfigSchema: z.ZodObject<{
22
22
  code: z.ZodString;
23
23
  label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
24
24
  default: z.ZodOptional<z.ZodBoolean>;
25
+ url: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
26
+ pathPrefix: z.ZodString;
27
+ }, z.core.$strip>, z.ZodObject<{
28
+ host: z.ZodString;
29
+ }, z.core.$strip>]>>;
25
30
  }, z.core.$loose>]>>;
26
31
  collections: z.ZodOptional<z.ZodArray<z.ZodObject<{
27
32
  entryAdminTitle: z.ZodOptional<z.ZodString>;
@@ -31,6 +36,10 @@ export declare const cmsConfigSchema: z.ZodObject<{
31
36
  }, z.core.$strip>>;
32
37
  orderable: z.ZodOptional<z.ZodBoolean>;
33
38
  listColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
39
+ defaultPopulate: z.ZodOptional<z.ZodObject<{
40
+ select: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
+ depth: z.ZodOptional<z.ZodNumber>;
42
+ }, z.core.$strip>>;
34
43
  slug: z.ZodString;
35
44
  sidebarIcon: z.ZodOptional<z.ZodString>;
36
45
  previewUrl: z.ZodOptional<z.ZodString>;
@@ -256,6 +265,10 @@ export declare const _internal: {
256
265
  }, z.core.$strip>>;
257
266
  orderable: z.ZodOptional<z.ZodBoolean>;
258
267
  listColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
268
+ defaultPopulate: z.ZodOptional<z.ZodObject<{
269
+ select: z.ZodOptional<z.ZodArray<z.ZodString>>;
270
+ depth: z.ZodOptional<z.ZodNumber>;
271
+ }, z.core.$strip>>;
259
272
  slug: z.ZodString;
260
273
  sidebarIcon: z.ZodOptional<z.ZodString>;
261
274
  previewUrl: z.ZodOptional<z.ZodString>;
@@ -382,6 +395,11 @@ export declare const _internal: {
382
395
  code: z.ZodString;
383
396
  label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
384
397
  default: z.ZodOptional<z.ZodBoolean>;
398
+ url: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
399
+ pathPrefix: z.ZodString;
400
+ }, z.core.$strip>, z.ZodObject<{
401
+ host: z.ZodString;
402
+ }, z.core.$strip>]>>;
385
403
  }, z.core.$loose>]>>;
386
404
  collections: z.ZodOptional<z.ZodArray<z.ZodObject<{
387
405
  entryAdminTitle: z.ZodOptional<z.ZodString>;
@@ -391,6 +409,10 @@ export declare const _internal: {
391
409
  }, z.core.$strip>>;
392
410
  orderable: z.ZodOptional<z.ZodBoolean>;
393
411
  listColumns: z.ZodOptional<z.ZodArray<z.ZodString>>;
412
+ defaultPopulate: z.ZodOptional<z.ZodObject<{
413
+ select: z.ZodOptional<z.ZodArray<z.ZodString>>;
414
+ depth: z.ZodOptional<z.ZodNumber>;
415
+ }, z.core.$strip>>;
394
416
  slug: z.ZodString;
395
417
  sidebarIcon: z.ZodOptional<z.ZodString>;
396
418
  previewUrl: z.ZodOptional<z.ZodString>;
@@ -24,7 +24,13 @@ const languageEntrySchema = z.union([
24
24
  message: "must be a 2-letter ISO code (e.g. 'en' or 'pl-PL')"
25
25
  }),
26
26
  label: localizedSchema.optional(),
27
- default: z.boolean().optional()
27
+ default: z.boolean().optional(),
28
+ url: z
29
+ .union([
30
+ z.object({ pathPrefix: z.string().startsWith('/') }),
31
+ z.object({ host: z.string() })
32
+ ])
33
+ .optional()
28
34
  })
29
35
  .passthrough()
30
36
  ]);
@@ -73,6 +79,10 @@ const optionItemSchema = z.object({
73
79
  label: localizedSchema.optional(),
74
80
  value: z.string()
75
81
  });
82
+ const relationPopulateSchema = z.object({
83
+ select: z.array(z.string()).optional(),
84
+ depth: z.number().int().min(0).optional()
85
+ });
76
86
  const fieldSchema = z.lazy(() => z.discriminatedUnion('type', [
77
87
  // text
78
88
  z
@@ -192,7 +202,8 @@ const fieldSchema = z.lazy(() => z.discriminatedUnion('type', [
192
202
  type: z.literal('relation'),
193
203
  collection: z.string().min(1, { message: 'relation.collection is required' }),
194
204
  multiple: z.boolean().optional(),
195
- displayField: z.string().optional()
205
+ displayField: z.string().optional(),
206
+ populate: relationPopulateSchema.optional()
196
207
  })
197
208
  .passthrough(),
198
209
  // object
@@ -375,7 +386,8 @@ const collectionSchema = z
375
386
  })
376
387
  .optional(),
377
388
  orderable: z.boolean().optional(),
378
- listColumns: z.array(z.string()).optional()
389
+ listColumns: z.array(z.string()).optional(),
390
+ defaultPopulate: relationPopulateSchema.optional()
379
391
  })
380
392
  .passthrough();
381
393
  const singleSchema = z
@@ -1,5 +1,6 @@
1
1
  import type { ConfigBase } from './config.js';
2
2
  import type { Localized } from './languages.js';
3
+ import type { RelationPopulate } from './fields.js';
3
4
  export interface CollectionConfig extends ConfigBase {
4
5
  entryAdminTitle?: string;
5
6
  labels?: {
@@ -8,6 +9,8 @@ export interface CollectionConfig extends ConfigBase {
8
9
  };
9
10
  orderable?: boolean;
10
11
  listColumns?: string[];
12
+ /** Domyślna chuda populacja dla każdej relacji wskazującej tę kolekcję. Nadpisywalna przez `RelationField.populate`. @public */
13
+ defaultPopulate?: RelationPopulate;
11
14
  }
12
15
  export interface CollectionConfigWithType extends CollectionConfig {
13
16
  type: 'collection';
@@ -54,6 +54,8 @@ export interface DbEntryVersion {
54
54
  publishedAt: Date | null;
55
55
  publishedBy: string | null;
56
56
  }
57
+ /** Metadane wersji bez pola `data` (do wyboru wersji bez ściągania blobu JSON). */
58
+ export type DbEntryVersionMeta = Omit<DbEntryVersion, 'data'>;
57
59
  export interface DbEntryVersionInsert {
58
60
  entryId: string;
59
61
  lang: string;
@@ -156,12 +156,24 @@ export interface CheckboxesField extends BaseField {
156
156
  }[];
157
157
  defaultValue?: string | string[];
158
158
  }
159
+ /**
160
+ * Chuda populacja relacji: allowlist populowanych pól + cap głębokości.
161
+ * @public
162
+ */
163
+ export interface RelationPopulate {
164
+ /** Allowlist slugów top-level pól docelowej kolekcji. Omit = wszystkie pola. */
165
+ select?: string[];
166
+ /** Cap rekurencji poddrzewa. 0 = relacje w środku zostają surowym ID. Nadpisuje globalny maxDepth. */
167
+ depth?: number;
168
+ }
159
169
  export interface RelationField extends BaseField {
160
170
  type: 'relation';
161
171
  collection: string;
162
172
  multiple?: boolean;
163
173
  displayField?: string;
164
174
  defaultValue?: string | string[];
175
+ /** Domyślna chuda populacja tego pola. Nadpisuje `defaultPopulate` kolekcji docelowej. @public */
176
+ populate?: RelationPopulate;
165
177
  }
166
178
  export type RelationFieldData = string | string[];
167
179
  export interface ObjectField extends BaseField {
@@ -1,4 +1,17 @@
1
1
  import type { locales } from '../paraglide/runtime.js';
2
2
  export type Language = 'en' | 'pl';
3
+ /** Wpis `cms.config.languages`: kod ISO albo obiekt z domyślnością/strategią URL. */
4
+ export type LanguageEntry = string | {
5
+ code: string;
6
+ label?: Localized;
7
+ default?: boolean;
8
+ url?: {
9
+ pathPrefix?: string;
10
+ } | {
11
+ host?: string;
12
+ };
13
+ };
14
+ /** Kod locale z wpisu (string lub `{ code }`). */
15
+ export declare const languageCode: (l: LanguageEntry) => string;
3
16
  export type InterfaceLanguage = (typeof locales)[number];
4
17
  export type Localized = Partial<Record<InterfaceLanguage, string>> | string;
@@ -1 +1,2 @@
1
- export {};
1
+ /** Kod locale z wpisu (string lub `{ code }`). */
2
+ export const languageCode = (l) => (typeof l === 'string' ? l : l.code);
@@ -0,0 +1,2 @@
1
+ import type { CmsUpdate } from '../index.js';
2
+ export declare const update: CmsUpdate;
@@ -0,0 +1,17 @@
1
+ export const update = {
2
+ version: '0.37.4',
3
+ date: '2026-07-20',
4
+ description: 'Wydajność populacji: chude relacje/listy (opt-in `select`/`populate`) + mniejszy over-fetch wersji + indeksy ścieżki treści. Wyszło z diagnozy wolnych podstron u pod-zwrotnikami (bloki-listy ciągnące pełne media/relacje).',
5
+ features: [
6
+ '**Chuda populacja relacji (`select`/`depth`) — trzy warstwy.** Na polu relacji `populate: { select: ["title", "hero"], depth: 0 }`, na kolekcji docelowej `defaultPopulate`, oraz per-call `resolveEntry(s)({ populate: { select, fields } })`. Precedencja: call > pole > kolekcja > pełna populacja (domyślnie, wstecznie zgodnie). `select` tnie także pola **media** — galeria nie jest już populowana, gdy widok czyta tylko `heroImage`. Meta (`_id/_slug/_url/...`) zawsze obecne.',
7
+ '**`resolveEntries({ populate: { select: [...] } })` dla list/bloków.** Chudy widok listy bez ciągnięcia pełnego drzewa każdego wpisu (media + relacje).'
8
+ ],
9
+ fixes: [
10
+ '**Mniejszy over-fetch wersji.** Wybór wersji czyta teraz tylko metadane (`getEntryVersionsMeta`, bez kolumny `data`), a pełne dane hydratują się wyłącznie dla wybranej wersji (`getEntryVersionData`). Wcześniej każda relacja/wpis ciągnął pełny JSON wszystkich swoich wersji i wybierał najnowszą w JS — koszt mnożony przez głębokość i liczbę wpisów.',
11
+ '**Indeksy ścieżki treści.** `entry(slug)`, `entry(type)`, `entry_version(entry_id, lang, version_number)`, `entry_version(entry_id, published_at)`, `media_file_tag(tag_id)`. Aplikowane przy `db:push`.'
12
+ ],
13
+ breakingChanges: [
14
+ '**Kontrakt `DatabaseAdapter`: nowe wymagane metody `getEntryVersionsMeta` + `getEntryVersionData`.** Dotyczy wyłącznie własnych implementacji adaptera DB (oficjalny `db-postgres` zaktualizowany). `getEntryVersions` (pełne wersje) pozostaje bez zmian.'
15
+ ],
16
+ notes: 'Indeksy z tego wydania wchodzą przy najbliższym `pnpm db:push` w projekcie klienta — brak osobnej migracji SQL.'
17
+ };
@@ -78,6 +78,7 @@ import { update as update0369 } from './0.36.9/index.js';
78
78
  import { update as update0370 } from './0.37.0/index.js';
79
79
  import { update as update0371 } from './0.37.1/index.js';
80
80
  import { update as update0372 } from './0.37.2/index.js';
81
+ import { update as update0374 } from './0.37.4/index.js';
81
82
  export const updates = [
82
83
  update0065,
83
84
  update0066,
@@ -158,7 +159,8 @@ export const updates = [
158
159
  update0369,
159
160
  update0370,
160
161
  update0371,
161
- update0372
162
+ update0372,
163
+ update0374
162
164
  ];
163
165
  export const getUpdatesFrom = (fromVersion) => {
164
166
  const fromParts = fromVersion.split('.').map(Number);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "includio-cms",
3
- "version": "0.37.2",
3
+ "version": "0.37.4",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",