includio-cms 0.37.3 → 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 (38) 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 -1
  5. package/dist/core/server/entries/operations/resolveEntry.d.ts +4 -2
  6. package/dist/core/server/entries/operations/resolveEntry.js +24 -42
  7. package/dist/core/server/entries/operations/versionResolve.d.ts +39 -0
  8. package/dist/core/server/entries/operations/versionResolve.js +52 -0
  9. package/dist/core/server/fields/populateSelect.d.ts +22 -0
  10. package/dist/core/server/fields/populateSelect.js +28 -0
  11. package/dist/core/server/fields/resolveRelationFields.d.ts +8 -8
  12. package/dist/core/server/fields/resolveRelationFields.js +135 -113
  13. package/dist/db-postgres/index.js +48 -0
  14. package/dist/db-postgres/schema/entry.js +2 -2
  15. package/dist/db-postgres/schema/entryVersion.js +5 -2
  16. package/dist/db-postgres/schema/mediaFileTag.js +4 -2
  17. package/dist/paraglide/messages/_index.d.ts +36 -3
  18. package/dist/paraglide/messages/_index.js +71 -3
  19. package/dist/paraglide/messages/en.d.ts +5 -0
  20. package/dist/paraglide/messages/en.js +14 -0
  21. package/dist/paraglide/messages/pl.d.ts +5 -0
  22. package/dist/paraglide/messages/pl.js +14 -0
  23. package/dist/types/adapters/db.d.ts +13 -1
  24. package/dist/types/cms.schema.d.ts +12 -0
  25. package/dist/types/cms.schema.js +8 -2
  26. package/dist/types/collections.d.ts +3 -0
  27. package/dist/types/entries.d.ts +2 -0
  28. package/dist/types/fields.d.ts +12 -0
  29. package/dist/updates/0.37.4/index.d.ts +2 -0
  30. package/dist/updates/0.37.4/index.js +17 -0
  31. package/dist/updates/index.js +3 -1
  32. package/package.json +1 -1
  33. package/dist/paraglide/messages/hello_world.d.ts +0 -5
  34. package/dist/paraglide/messages/hello_world.js +0 -33
  35. package/dist/paraglide/messages/login_hello.d.ts +0 -16
  36. package/dist/paraglide/messages/login_hello.js +0 -34
  37. package/dist/paraglide/messages/login_please_login.d.ts +0 -16
  38. package/dist/paraglide/messages/login_please_login.js +0 -34
@@ -79,6 +79,10 @@ const optionItemSchema = z.object({
79
79
  label: localizedSchema.optional(),
80
80
  value: z.string()
81
81
  });
82
+ const relationPopulateSchema = z.object({
83
+ select: z.array(z.string()).optional(),
84
+ depth: z.number().int().min(0).optional()
85
+ });
82
86
  const fieldSchema = z.lazy(() => z.discriminatedUnion('type', [
83
87
  // text
84
88
  z
@@ -198,7 +202,8 @@ const fieldSchema = z.lazy(() => z.discriminatedUnion('type', [
198
202
  type: z.literal('relation'),
199
203
  collection: z.string().min(1, { message: 'relation.collection is required' }),
200
204
  multiple: z.boolean().optional(),
201
- displayField: z.string().optional()
205
+ displayField: z.string().optional(),
206
+ populate: relationPopulateSchema.optional()
202
207
  })
203
208
  .passthrough(),
204
209
  // object
@@ -381,7 +386,8 @@ const collectionSchema = z
381
386
  })
382
387
  .optional(),
383
388
  orderable: z.boolean().optional(),
384
- listColumns: z.array(z.string()).optional()
389
+ listColumns: z.array(z.string()).optional(),
390
+ defaultPopulate: relationPopulateSchema.optional()
385
391
  })
386
392
  .passthrough();
387
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 {
@@ -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.3",
3
+ "version": "0.37.4",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",
@@ -1,5 +0,0 @@
1
- export function hello_world(inputs: {
2
- name: NonNullable<unknown>;
3
- }, options?: {
4
- locale?: "en" | "pl";
5
- }): string;
@@ -1,33 +0,0 @@
1
- /* eslint-disable */
2
- import { getLocale, trackMessageCall, experimentalMiddlewareLocaleSplitting, isServer } from '../runtime.js';
3
-
4
- const en_hello_world = /** @type {(inputs: { name: NonNullable<unknown> }) => string} */ (i) => {
5
- return `Hello, ${i.name} from en!`
6
- };
7
-
8
- const pl_hello_world = /** @type {(inputs: { name: NonNullable<unknown> }) => string} */ (i) => {
9
- return `Hello, ${i.name} from pl!`
10
- };
11
-
12
- /**
13
- * This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
14
- *
15
- * - Changing this function will be over-written by the next build.
16
- *
17
- * - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
18
- * use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
19
- *
20
- * @param {{ name: NonNullable<unknown> }} inputs
21
- * @param {{ locale?: "en" | "pl" }} options
22
- * @returns {string}
23
- */
24
- /* @__NO_SIDE_EFFECTS__ */
25
- export const hello_world = (inputs, options = {}) => {
26
- if (experimentalMiddlewareLocaleSplitting && isServer === false) {
27
- return /** @type {any} */ (globalThis).__paraglide_ssr.hello_world(inputs)
28
- }
29
- const locale = options.locale ?? getLocale()
30
- trackMessageCall("hello_world", locale)
31
- if (locale === "en") return en_hello_world(inputs)
32
- return pl_hello_world(inputs)
33
- };
@@ -1,16 +0,0 @@
1
- export { login_hello as login.hello };
2
- /**
3
- * This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
4
- *
5
- * - Changing this function will be over-written by the next build.
6
- *
7
- * - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
8
- * use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
9
- *
10
- * @param {{}} inputs
11
- * @param {{ locale?: "en" | "pl" }} options
12
- * @returns {string}
13
- */
14
- declare function login_hello(inputs?: {}, options?: {
15
- locale?: "en" | "pl";
16
- }): string;
@@ -1,34 +0,0 @@
1
- /* eslint-disable */
2
- import { getLocale, trackMessageCall, experimentalMiddlewareLocaleSplitting, isServer } from '../runtime.js';
3
-
4
- const en_login_hello = /** @type {(inputs: {}) => string} */ () => {
5
- return `Welcome back`
6
- };
7
-
8
- const pl_login_hello = /** @type {(inputs: {}) => string} */ () => {
9
- return `Witaj ponownie`
10
- };
11
-
12
- /**
13
- * This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
14
- *
15
- * - Changing this function will be over-written by the next build.
16
- *
17
- * - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
18
- * use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
19
- *
20
- * @param {{}} inputs
21
- * @param {{ locale?: "en" | "pl" }} options
22
- * @returns {string}
23
- */
24
- /* @__NO_SIDE_EFFECTS__ */
25
- const login_hello = (inputs = {}, options = {}) => {
26
- if (experimentalMiddlewareLocaleSplitting && isServer === false) {
27
- return /** @type {any} */ (globalThis).__paraglide_ssr.login_hello(inputs)
28
- }
29
- const locale = options.locale ?? getLocale()
30
- trackMessageCall("login_hello", locale)
31
- if (locale === "en") return en_login_hello(inputs)
32
- return pl_login_hello(inputs)
33
- };
34
- export { login_hello as "login.hello" }
@@ -1,16 +0,0 @@
1
- export { login_please_login as login.please_login };
2
- /**
3
- * This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
4
- *
5
- * - Changing this function will be over-written by the next build.
6
- *
7
- * - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
8
- * use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
9
- *
10
- * @param {{}} inputs
11
- * @param {{ locale?: "en" | "pl" }} options
12
- * @returns {string}
13
- */
14
- declare function login_please_login(inputs?: {}, options?: {
15
- locale?: "en" | "pl";
16
- }): string;
@@ -1,34 +0,0 @@
1
- /* eslint-disable */
2
- import { getLocale, trackMessageCall, experimentalMiddlewareLocaleSplitting, isServer } from '../runtime.js';
3
-
4
- const en_login_please_login = /** @type {(inputs: {}) => string} */ () => {
5
- return `Login to your account`
6
- };
7
-
8
- const pl_login_please_login = /** @type {(inputs: {}) => string} */ () => {
9
- return `Zaloguj się na swoje konto`
10
- };
11
-
12
- /**
13
- * This function has been compiled by [Paraglide JS](https://inlang.com/m/gerre34r).
14
- *
15
- * - Changing this function will be over-written by the next build.
16
- *
17
- * - If you want to change the translations, you can either edit the source files e.g. `en.json`, or
18
- * use another inlang app like [Fink](https://inlang.com/m/tdozzpar) or the [VSCode extension Sherlock](https://inlang.com/m/r7kp499g).
19
- *
20
- * @param {{}} inputs
21
- * @param {{ locale?: "en" | "pl" }} options
22
- * @returns {string}
23
- */
24
- /* @__NO_SIDE_EFFECTS__ */
25
- const login_please_login = (inputs = {}, options = {}) => {
26
- if (experimentalMiddlewareLocaleSplitting && isServer === false) {
27
- return /** @type {any} */ (globalThis).__paraglide_ssr.login_please_login(inputs)
28
- }
29
- const locale = options.locale ?? getLocale()
30
- trackMessageCall("login_please_login", locale)
31
- if (locale === "en") return en_login_please_login(inputs)
32
- return pl_login_please_login(inputs)
33
- };
34
- export { login_please_login as "login.please_login" }