includio-cms 0.16.0 → 0.18.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.
- package/CHANGELOG.md +80 -0
- package/DOCS.md +1 -1
- package/dist/admin/api/rest/routes/collections.js +1 -1
- package/dist/admin/api/rest/routes/entries.js +1 -1
- package/dist/admin/api/rest/routes/singletons.js +1 -1
- package/dist/admin/remote/entry.remote.js +20 -3
- package/dist/admin/remote/invite.d.ts +1 -1
- package/dist/admin/remote/preview.remote.js +10 -2
- package/dist/admin/remote/reorder.js +1 -1
- package/dist/admin/remote/shop.remote.d.ts +18 -18
- package/dist/cms/runtime/api.d.ts +10 -6
- package/dist/cms/runtime/api.js +7 -7
- package/dist/components/ui/accordion/accordion.svelte.d.ts +1 -1
- package/dist/components/ui/calendar/calendar.svelte.d.ts +1 -1
- package/dist/components/ui/command/command-dialog.svelte.d.ts +1 -1
- package/dist/components/ui/command/command-input.svelte.d.ts +1 -1
- package/dist/components/ui/command/command.svelte.d.ts +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte.d.ts +1 -1
- package/dist/components/ui/input/input.svelte.d.ts +1 -1
- package/dist/components/ui/input-group/input-group-input.svelte.d.ts +1 -1
- package/dist/components/ui/input-group/input-group-textarea.svelte.d.ts +1 -1
- package/dist/components/ui/radio-group/radio-group.svelte.d.ts +1 -1
- package/dist/components/ui/sidebar/sidebar-input.svelte.d.ts +1 -1
- package/dist/components/ui/tabs/tabs.svelte.d.ts +1 -1
- package/dist/components/ui/textarea/textarea.svelte.d.ts +1 -1
- package/dist/components/ui/toggle-group/toggle-group-item.svelte.d.ts +1 -1
- package/dist/components/ui/toggle-group/toggle-group.svelte.d.ts +1 -1
- package/dist/core/server/entries/operations/create.js +1 -1
- package/dist/core/server/entries/operations/get.d.ts +20 -16
- package/dist/core/server/entries/operations/get.js +45 -214
- package/dist/core/server/entries/operations/resolveEntry.d.ts +94 -0
- package/dist/core/server/entries/operations/resolveEntry.js +210 -0
- package/dist/core/server/entries/operations/update.js +1 -1
- package/dist/core/server/fields/populateEntry.d.ts +9 -1
- package/dist/core/server/fields/populateEntry.js +22 -18
- package/dist/core/server/fields/resolveRelationFields.d.ts +2 -1
- package/dist/core/server/fields/resolveRelationFields.js +140 -34
- package/dist/core/server/fields/resolveRichtextLinks.d.ts +2 -1
- package/dist/core/server/fields/resolveRichtextLinks.js +2 -1
- package/dist/core/server/fields/resolveUrlFields.d.ts +2 -1
- package/dist/core/server/fields/resolveUrlFields.js +6 -5
- package/dist/core/server/generator/generator.js +17 -14
- package/dist/entity/index.js +1 -1
- package/dist/shop/server/populate.d.ts +2 -1
- package/dist/shop/server/populate.js +2 -1
- package/dist/sveltekit/server/index.d.ts +1 -1
- package/dist/sveltekit/server/index.js +1 -1
- package/dist/types/plugins.d.ts +6 -2
- package/dist/updates/0.17.0/index.d.ts +2 -0
- package/dist/updates/0.17.0/index.js +78 -0
- package/dist/updates/index.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export const update = {
|
|
2
|
+
version: '0.17.0',
|
|
3
|
+
date: '2026-04-29',
|
|
4
|
+
description: '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.',
|
|
5
|
+
features: [
|
|
6
|
+
'`resolveEntry({ id?, collection?, locale?, status?, populate? })` — kanoniczny resolver pojedynczego entry; `id` lub `collection` wymagane. Default locale = `cms.languages[0]`, default status = `published`. Zwraca null gdy locale/status nie ma versionu (strict, brak fallback).',
|
|
7
|
+
'`resolveEntries({ collection, locale?, status?, ids?, filter?, orderBy?, limit?, offset?, populate? })` — kanoniczny lister; pokrywa wszystkie use case starego `getEntries`.',
|
|
8
|
+
'`countEntries({ collection, locale?, status?, ids?, filter? })` — zlicza entries pasujące do kryteriów (per locale, per status). Bez populate (tani DB count).',
|
|
9
|
+
'`PopulateConfig` — typ public: `{ maxDepth?: number; fields?: Record<string, false> }`. Per-field opt-out (`{ author: false }` → raw ID). Default maxDepth = 5 (soft cap).',
|
|
10
|
+
'Cycle detection w nested populate — A → B → A nie wybucha; powtórzony entryId zachowuje raw ID zamiast dalszej rekurencji.',
|
|
11
|
+
'Status cascade — draft entry z `status: "draft"` populuje draft relations (jeśli istnieją w tym samym locale). Published cascade do published nested.',
|
|
12
|
+
'`status: "scheduled"` — dostępne w resolverze. Use case: strona z odliczaniem (countdown) do launchu produktu/postu. `entry._publishedAt` daje datę przyszłej publikacji.'
|
|
13
|
+
],
|
|
14
|
+
fixes: [
|
|
15
|
+
'Locale spójny w całym call chain — żaden field-level resolver nie hardcoduje już lokalizacji ani nie używa innego defaultu niż top-level resolver. Stara fragmentacja (`resolveRelationFields` defaultowało do `getEntries` published-only) usunięta.',
|
|
16
|
+
'Recursion guard — głęboka kolekcja relacji (≥ 6 poziomów) nie wybucha już stackiem. Soft maxDepth=5 + cycle detection.',
|
|
17
|
+
'Strict locale — brak ukrytego fallbacku do `cms.languages[0]` w nested resolverach (był różnie w każdym field-resolverze).'
|
|
18
|
+
],
|
|
19
|
+
breakingChanges: [
|
|
20
|
+
'**REMOVED z public API**: `getEntry`, `getEntries`, `getEntryOrThrow`, `getRawEntry`, `getRawEntries`, `getRawEntryOrThrow`, `getDbEntry`, `getDbEntries`, `populateEntryData`. Wszystkie te funkcje były dotąd re-exportowane przez `includio-cms/server` i `includio-cms`. **Zamień na `resolveEntry`/`resolveEntries`/`countEntries`** zgodnie z migration table niżej. Nie ma deprecated wrappera — hard remove zgodnie z polityką lean-v1 (wszystkie breakingy PRZED v1.0).',
|
|
21
|
+
'**Rename arg `language` → `locale`** w `resolveEntry`/`resolveEntries`/`countEntries`. Stare API używało `language`, nowe `locale` (semantycznie bardziej precyzyjne; wartość bez zmian — `cms.languages[N]`).',
|
|
22
|
+
'**Rename arg `slug` → `collection`** w resolverach. Stare API używało `slug` (co konfundowało z slugiem entry). Nowe: `collection: "posts"`. Singletons też używają `collection: "settings"` (cms.getBySlug obejmuje obie typy).',
|
|
23
|
+
'**`status` enum zwężony** z `"published" | "draft" | "scheduled" | "archived"` do `"published" | "draft" | "scheduled"`. `archived` nie jest już dostępny w resolverze (to filter listy, nie fetch by id) — admin używa internal `_getRawEntries` envelope.',
|
|
24
|
+
'**Plugin `populateResolver` 3-arg signature** — custom field plugin `populateResolver(value, field)` ma teraz 3-ci arg `ctx: PopulateCtx` (locale, status, depth, visited, populate, entryId). Plugin API jest `@experimental`, więc breaking dopuszczalne. Migracja: zaktualizuj sygnaturę. Stary 2-arg call zostaje wywołany ale ignoruje cascade — najlepiej dodać 3-ci arg.',
|
|
25
|
+
'**`PopulateConfig`** wymagany dla opt-out — wcześniej populate był all-or-nothing.',
|
|
26
|
+
'**`populatePreviewData` (admin remote)** używa teraz internal `_populate` zamiast `populateEntryData`. Public API niezmienione, ale jeśli importowałeś `populateEntryData` jako helper — usuń.',
|
|
27
|
+
'**Internal renames** — `_getRawEntry/ies`, `_getDbEntry/ies`, `_getRawEntryOrThrow`. Funkcje pozostają dostępne dla admin REST i remote, ale **NIE** są re-exportowane przez `includio-cms/server`. Userland code MUSI przejść na `resolveEntry`/`resolveEntries`.'
|
|
28
|
+
],
|
|
29
|
+
notes: `Migration table:
|
|
30
|
+
|
|
31
|
+
| Old | New |
|
|
32
|
+
|---|---|
|
|
33
|
+
| \`getEntry({ slug, id, language, status })\` | \`resolveEntry({ collection: slug, id, locale: language, status })\` |
|
|
34
|
+
| \`getEntry({ slug, language })\` (singleton) | \`resolveEntry({ collection: slug, locale: language })\` |
|
|
35
|
+
| \`getEntries({ slug, language, status, ids?, limit?, offset? })\` | \`resolveEntries({ collection: slug, locale: language, status, ids?, limit?, offset? })\` |
|
|
36
|
+
| \`getEntryOrThrow(opts)\` | \`const e = await resolveEntry(opts); if (!e) throw new Error('Entry not found');\` |
|
|
37
|
+
| \`getRawEntry/ies(...)\` | INTERNAL — niedostępne. Jeśli potrzebujesz envelope z per-language draft/published versions, zbuduj custom REST endpoint po stronie aplikacji. |
|
|
38
|
+
| \`getDbEntry/ies(...)\` | INTERNAL — niedostępne. Userland NIE powinien używać raw DB queries; przejdź na \`resolveEntry/ies\`. |
|
|
39
|
+
| \`populateEntryData(data, fields, language, entryId?)\` | INTERNAL — admin preview używa wewnątrz. |
|
|
40
|
+
|
|
41
|
+
Before/after:
|
|
42
|
+
|
|
43
|
+
\`\`\`ts
|
|
44
|
+
// PRZED (0.16):
|
|
45
|
+
import { getEntry, getEntries } from 'includio-cms/server';
|
|
46
|
+
const post = await getEntry({ slug: 'posts', id: postId, language: 'pl' });
|
|
47
|
+
const all = await getEntries({ slug: 'posts', language: 'pl', limit: 10 });
|
|
48
|
+
|
|
49
|
+
// PO (0.17):
|
|
50
|
+
import { resolveEntry, resolveEntries } from 'includio-cms/server';
|
|
51
|
+
const post = await resolveEntry({ collection: 'posts', id: postId, locale: 'pl' });
|
|
52
|
+
const all = await resolveEntries({ collection: 'posts', locale: 'pl', limit: 10 });
|
|
53
|
+
\`\`\`
|
|
54
|
+
|
|
55
|
+
Populate opt-out:
|
|
56
|
+
|
|
57
|
+
\`\`\`ts
|
|
58
|
+
// Pomiń populate dla pojedynczego pola (zwróć raw ID zamiast Entry):
|
|
59
|
+
const post = await resolveEntry({
|
|
60
|
+
collection: 'posts',
|
|
61
|
+
id: postId,
|
|
62
|
+
locale: 'pl',
|
|
63
|
+
populate: { fields: { author: false } }
|
|
64
|
+
});
|
|
65
|
+
console.log(post.author); // 'a1' (string, nie Entry)
|
|
66
|
+
|
|
67
|
+
// Ogranicz głębokość rekursji:
|
|
68
|
+
const post = await resolveEntry({
|
|
69
|
+
collection: 'posts',
|
|
70
|
+
id: postId,
|
|
71
|
+
locale: 'pl',
|
|
72
|
+
populate: { maxDepth: 1 }
|
|
73
|
+
});
|
|
74
|
+
// post.author = pełen Entry, post.author.featuredPost = raw ID (depth 2)
|
|
75
|
+
\`\`\`
|
|
76
|
+
|
|
77
|
+
Brak SQL migration. Stary code używający usuniętych funkcji rzuci ImportError przy \`pnpm i && pnpm build\` — wszystko w userland kodzie wyłapie się TS-em od razu.`
|
|
78
|
+
};
|
package/dist/updates/index.js
CHANGED
|
@@ -51,7 +51,8 @@ import { update as update0153 } from './0.15.3/index.js';
|
|
|
51
51
|
import { update as update0154 } from './0.15.4/index.js';
|
|
52
52
|
import { update as update0155 } from './0.15.5/index.js';
|
|
53
53
|
import { update as update0160 } from './0.16.0/index.js';
|
|
54
|
-
|
|
54
|
+
import { update as update0170 } from './0.17.0/index.js';
|
|
55
|
+
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, update0145, update0146, update0150, update0151, update0152, update0153, update0154, update0155, update0160, update0170];
|
|
55
56
|
export const getUpdatesFrom = (fromVersion) => {
|
|
56
57
|
const fromParts = fromVersion.split('.').map(Number);
|
|
57
58
|
return updates.filter((update) => {
|