includio-cms 0.0.52 → 0.0.53

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.
@@ -25,6 +25,7 @@
25
25
  import DeviceDesktop from '@tabler/icons-svelte/icons/device-desktop';
26
26
  import { getEntryVersionStatus } from './utils.js';
27
27
  import type { UpdateEntryVersionCommandType } from '../../../core/server/entries/operations/update.js';
28
+ import { getRawCollectionEntryLabel } from '../../utils/entryLabel.js';
28
29
 
29
30
  const contentLanguage = getContentLanguage();
30
31
  const remotes = getRemotes();
@@ -125,14 +126,7 @@
125
126
  href: `/admin/collections/${collection.slug}`
126
127
  },
127
128
  {
128
- label:
129
- collection.entryAdminTitle && entry.publishedVersion
130
- ? (
131
- getAtPath(entry.publishedVersion.data, collection.entryAdminTitle) as
132
- | Record<string, string>
133
- | undefined
134
- )?.[contentLanguage.current] || entry.id
135
- : entry.id
129
+ label: getRawCollectionEntryLabel(entry, collection, contentLanguage.current)
136
130
  }
137
131
  ]
138
132
  : [
@@ -44,7 +44,7 @@ export const getRawEntry = query(z.object({
44
44
  return getRawEntryOperation(input);
45
45
  });
46
46
  export const getEntryForEntryPage = query(z.string(), async (id) => {
47
- const parsedIdentifier = z.string().uuid().safeParse(id);
47
+ const parsedIdentifier = z.uuid().safeParse(id);
48
48
  const isUUID = parsedIdentifier.success;
49
49
  if (isUUID) {
50
50
  const uuid = parsedIdentifier.data;
@@ -57,7 +57,15 @@ export const getEntryForEntryPage = query(z.string(), async (id) => {
57
57
  if (!config) {
58
58
  throw new Error(`Singleton with slug "${slug}" not found`);
59
59
  }
60
- return getRawEntryOrThrow({ slug });
60
+ const entry = await getRawEntry({ slug });
61
+ if (entry) {
62
+ return entry;
63
+ }
64
+ await createEntryOperation({
65
+ slug: config.slug,
66
+ type: 'singleton'
67
+ });
68
+ return await getRawEntryOrThrow({ slug });
61
69
  }
62
70
  });
63
71
  const updateEntryVersionCommandSchema = z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "includio-cms",
3
- "version": "0.0.52",
3
+ "version": "0.0.53",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",