includio-cms 0.36.3 → 0.36.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/API.md CHANGED
@@ -1,4 +1,4 @@
1
- # includio-cms — Public API v0.36.3
1
+ # includio-cms — Public API v0.36.4
2
2
 
3
3
  > Auto-generated by `scripts/generate-api-md.ts`. Do not edit by hand.
4
4
 
package/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
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.36.4 — 2026-06-11
7
+
8
+ Lista wpisów kolekcji — fix: URL pod nazwą wpisu (oraz wyszukiwarka i ostrzeżenia a11y) znikał, gdy początkowy draft v1 różnił się od późniejszej opublikowanej treści (np. slug ustawiony dopiero po publikacji). Ujednolicono precedencję wyboru wersji w jednym helperze (published-first), spójnie z resztą admina.
9
+
10
+ ### Fixed
11
+ - `getVersionData` w liście kolekcji (`collection-entries.svelte`) preferowało draft przed published. `draftVersions[lang]` to najnowsza wersja z `publishedAt == null` — co może być przestarzałym początkowym draftem (v1), starszym niż najnowsza publikacja, gdy późniejsze edycje szły tylko przez publikację. Efekt: subtytuł URL czytał pusty/nieaktualny slug z v1 i znikał, mimo że opublikowana wersja miała slug. Naprawione przez nowy SSOT `getRawEntryVersionData(entry, language)` z precedencją published-first (requested lang published → draft, potem any lang published → draft) — spójną z `getRawCollectionEntryLabelWithLanguage`, custom columns i edytorem wpisu.
12
+ - Ten sam helper zasila też tekst wyszukiwarki (`getSearchText`) i ostrzeżenia a11y (`countA11yWarnings`) — wcześniej również czytały przestarzały draft. `columnData` uproszczone (redundantny published-first override usunięty).
13
+ - `extractEntryUrl` przekazuje teraz `language` do `resolveEntryUrl` — bez efektu dla płaskiego slug, ale poprawne dla projektów wielojęzycznych ze zlokalizowanym slugiem. Dodany regression test (`entryVersionData.spec.ts`) odtwarzający scenariusz pustego draftu v1 + opublikowanego sluga.
14
+
6
15
  ## 0.36.3 — 2026-06-11
7
16
 
8
17
  Relacje opcjonalne — fix: niewybrana relacja (pole bez `required`) blokowała zapis wpisu („Invalid input: expected string, received null") albo wywalała populację przy pustym stringu. Teraz „brak wyboru" działa w obie strony — Zod akceptuje null/""/undefined, a populacja pomija puste wartości.
package/DOCS.md CHANGED
@@ -1,4 +1,4 @@
1
- # Includio CMS Documentation (v0.36.3)
1
+ # Includio CMS Documentation (v0.36.4)
2
2
 
3
3
  > This file is auto-generated from the docs site. For the latest version, update the package.
4
4
 
@@ -1,5 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { getCollectionEntryDisplayLabel } from '../../utils/entryLabel.js';
3
+ import { getRawEntryVersionData } from '../../utils/entryVersionData.js';
3
4
  import { getEntryThumbnail, type MediaThumbnailLookup } from '../../utils/entryThumbnail.js';
4
5
  import { arrayMove } from '../../utils/arrayMove.js';
5
6
  import { getRemotes } from '../../../sveltekit/index.js';
@@ -426,15 +427,7 @@
426
427
  }
427
428
 
428
429
  function getVersionData(entry: RawEntry): Record<string, unknown> | undefined {
429
- const lang = interfaceLanguage.current;
430
- const draft = entry.draftVersions[lang];
431
- const published = entry.publishedVersions[lang];
432
- if (draft?.data) return draft.data as Record<string, unknown>;
433
- if (published?.data) return published.data as Record<string, unknown>;
434
- // Fallback: any lang
435
- for (const v of Object.values(entry.draftVersions)) if (v?.data) return v.data as Record<string, unknown>;
436
- for (const v of Object.values(entry.publishedVersions)) if (v?.data) return v.data as Record<string, unknown>;
437
- return undefined;
430
+ return getRawEntryVersionData(entry, interfaceLanguage.current);
438
431
  }
439
432
 
440
433
  function getSearchText(entry: RawEntry): string {
@@ -467,7 +460,8 @@
467
460
  return resolveEntryUrl({
468
461
  slugField: collection.slugField,
469
462
  pathTemplate: collection.pathTemplate,
470
- data: data as Record<string, unknown>
463
+ data: data as Record<string, unknown>,
464
+ language: interfaceLanguage.current
471
465
  });
472
466
  }
473
467
 
@@ -560,9 +554,9 @@
560
554
 
561
555
  function mapEntryToRow(entry: RawEntry, lookup: Record<string, string> = {}, mediaThumbs: MediaThumbnailLookup = {}): CollectionDataTableRow {
562
556
  const data = getVersionData(entry) || {};
563
- // For custom columns, prefer published data (complete) over draft (may be partial)
564
- const lang = interfaceLanguage.current;
565
- const columnData = entry.publishedVersions[lang]?.data || entry.draftVersions[lang]?.data || data;
557
+ // getVersionData is already published-first (see getRawEntryVersionData),
558
+ // so it doubles as the source for custom columns.
559
+ const columnData = data;
566
560
  const customData: Record<string, unknown> = {};
567
561
  if (collection.listColumns) {
568
562
  for (const fieldSlug of collection.listColumns) {
@@ -0,0 +1,17 @@
1
+ import type { RawEntry } from '../../types/entries.js';
2
+ /**
3
+ * Effective entry data for the admin collection list.
4
+ *
5
+ * Resolves the version whose data the list should display for a raw entry,
6
+ * with **published-first** precedence: requested language published → draft,
7
+ * then any other language published → draft. Returns `undefined` only when the
8
+ * entry has no usable version data at all.
9
+ *
10
+ * Why published-first: `draftVersions[lang]` is the latest version with
11
+ * `publishedAt == null`, which can be an *older* lingering draft (e.g. the
12
+ * initial v1) when later edits were published without re-saving a draft. The
13
+ * rest of the admin (entry label, custom columns, entry editor) already prefers
14
+ * published — this keeps the URL subtitle, search text and a11y warnings
15
+ * consistent with it. Mirrors {@link getRawCollectionEntryLabelWithLanguage}.
16
+ */
17
+ export declare function getRawEntryVersionData(entry: RawEntry, language: string): Record<string, unknown> | undefined;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Effective entry data for the admin collection list.
3
+ *
4
+ * Resolves the version whose data the list should display for a raw entry,
5
+ * with **published-first** precedence: requested language published → draft,
6
+ * then any other language published → draft. Returns `undefined` only when the
7
+ * entry has no usable version data at all.
8
+ *
9
+ * Why published-first: `draftVersions[lang]` is the latest version with
10
+ * `publishedAt == null`, which can be an *older* lingering draft (e.g. the
11
+ * initial v1) when later edits were published without re-saving a draft. The
12
+ * rest of the admin (entry label, custom columns, entry editor) already prefers
13
+ * published — this keeps the URL subtitle, search text and a11y warnings
14
+ * consistent with it. Mirrors {@link getRawCollectionEntryLabelWithLanguage}.
15
+ */
16
+ export function getRawEntryVersionData(entry, language) {
17
+ for (const bucket of [entry.publishedVersions, entry.draftVersions]) {
18
+ const data = bucket?.[language]?.data;
19
+ if (data)
20
+ return data;
21
+ }
22
+ for (const bucket of [entry.publishedVersions, entry.draftVersions]) {
23
+ for (const version of Object.values(bucket ?? {})) {
24
+ if (version?.data)
25
+ return version.data;
26
+ }
27
+ }
28
+ return undefined;
29
+ }
@@ -0,0 +1,2 @@
1
+ import type { CmsUpdate } from '../index.js';
2
+ export declare const update: CmsUpdate;
@@ -0,0 +1,12 @@
1
+ export const update = {
2
+ version: '0.36.4',
3
+ date: '2026-06-11',
4
+ description: 'Lista wpisów kolekcji — fix: URL pod nazwą wpisu (oraz wyszukiwarka i ostrzeżenia a11y) znikał, gdy początkowy draft v1 różnił się od późniejszej opublikowanej treści (np. slug ustawiony dopiero po publikacji). Ujednolicono precedencję wyboru wersji w jednym helperze (published-first), spójnie z resztą admina.',
5
+ features: [],
6
+ fixes: [
7
+ '`getVersionData` w liście kolekcji (`collection-entries.svelte`) preferowało draft przed published. `draftVersions[lang]` to najnowsza wersja z `publishedAt == null` — co może być przestarzałym początkowym draftem (v1), starszym niż najnowsza publikacja, gdy późniejsze edycje szły tylko przez publikację. Efekt: subtytuł URL czytał pusty/nieaktualny slug z v1 i znikał, mimo że opublikowana wersja miała slug. Naprawione przez nowy SSOT `getRawEntryVersionData(entry, language)` z precedencją published-first (requested lang published → draft, potem any lang published → draft) — spójną z `getRawCollectionEntryLabelWithLanguage`, custom columns i edytorem wpisu.',
8
+ 'Ten sam helper zasila też tekst wyszukiwarki (`getSearchText`) i ostrzeżenia a11y (`countA11yWarnings`) — wcześniej również czytały przestarzały draft. `columnData` uproszczone (redundantny published-first override usunięty).',
9
+ '`extractEntryUrl` przekazuje teraz `language` do `resolveEntryUrl` — bez efektu dla płaskiego slug, ale poprawne dla projektów wielojęzycznych ze zlokalizowanym slugiem. Dodany regression test (`entryVersionData.spec.ts`) odtwarzający scenariusz pustego draftu v1 + opublikowanego sluga.'
10
+ ],
11
+ breakingChanges: []
12
+ };
@@ -70,6 +70,7 @@ import { update as update0360 } from './0.36.0/index.js';
70
70
  import { update as update0361 } from './0.36.1/index.js';
71
71
  import { update as update0362 } from './0.36.2/index.js';
72
72
  import { update as update0363 } from './0.36.3/index.js';
73
+ import { update as update0364 } from './0.36.4/index.js';
73
74
  export const updates = [
74
75
  update0065,
75
76
  update0066,
@@ -142,7 +143,8 @@ export const updates = [
142
143
  update0360,
143
144
  update0361,
144
145
  update0362,
145
- update0363
146
+ update0363,
147
+ update0364
146
148
  ];
147
149
  export const getUpdatesFrom = (fromVersion) => {
148
150
  const fromParts = fromVersion.split('.').map(Number);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "includio-cms",
3
- "version": "0.36.3",
3
+ "version": "0.36.4",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",