@xleddyl/nuxt-cms 0.1.56 → 0.1.58

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/dist/module.json +1 -1
  2. package/dist/module.mjs +57 -5
  3. package/dist/runtime/app/components/cms/BlocksField.vue +19 -1
  4. package/dist/runtime/app/components/cms/MediaField.vue +14 -1
  5. package/dist/runtime/app/composables/cms-media-keys.d.ts +4 -0
  6. package/dist/runtime/app/composables/cms-media-keys.js +21 -0
  7. package/dist/runtime/app/composables/cms-query.js +57 -4
  8. package/dist/runtime/assets/main.css +1 -1
  9. package/dist/runtime/seed.js +9 -2
  10. package/dist/runtime/server/api/collection.get.js +2 -1
  11. package/dist/runtime/server/api/item.get.js +6 -4
  12. package/dist/runtime/server/api/item.put.js +5 -4
  13. package/dist/runtime/server/plugins/migrate-libsql.js +2 -2
  14. package/dist/runtime/server/routes/graphql.js +2 -0
  15. package/dist/runtime/server/utils/db-d1.d.ts +2 -0
  16. package/dist/runtime/server/utils/db-d1.js +5 -0
  17. package/dist/runtime/server/utils/db-libsql.d.ts +2 -0
  18. package/dist/runtime/server/utils/db-libsql.js +5 -0
  19. package/dist/runtime/server/utils/db-postgres.d.ts +2 -0
  20. package/dist/runtime/server/utils/db-postgres.js +8 -0
  21. package/dist/runtime/server/utils/db-sqlite.d.ts +2 -0
  22. package/dist/runtime/server/utils/db-sqlite.js +8 -0
  23. package/dist/runtime/server/utils/graphql.js +3 -4
  24. package/dist/runtime/server/utils/libsql-migrations.d.ts +16 -0
  25. package/dist/runtime/server/utils/libsql-migrations.js +35 -0
  26. package/dist/runtime/server/utils/media-check.d.ts +2 -0
  27. package/dist/runtime/server/utils/media-check.js +20 -0
  28. package/dist/runtime/server/utils/media-references.d.ts +10 -0
  29. package/dist/runtime/server/utils/media-references.js +50 -0
  30. package/dist/runtime/server/utils/migrate.d.ts +1 -0
  31. package/dist/runtime/server/utils/migrate.js +7 -0
  32. package/dist/runtime/server/utils/page-rows.d.ts +51 -0
  33. package/dist/runtime/server/utils/page-rows.js +223 -0
  34. package/dist/runtime/server/utils/page-storage.d.ts +11 -0
  35. package/dist/runtime/server/utils/page-storage.js +42 -0
  36. package/dist/runtime/shared/index.d.ts +7 -0
  37. package/dist/runtime/shared/index.js +21 -0
  38. package/package.json +1 -1
@@ -191,6 +191,7 @@ export function localizeBlocks(field, value, locale, defaultLocale) {
191
191
  if (!Array.isArray(value)) return value;
192
192
  return value.map((item) => localizeBlock(field, item, locale, defaultLocale));
193
193
  }
194
+ export const CMS_GRAPHQL_BATCH_LIMIT = 20;
194
195
  export function entryTabs(entry) {
195
196
  return entry.tabs?.length ? entry.tabs : [];
196
197
  }
@@ -258,6 +259,26 @@ export function pageAllFields(entry) {
258
259
  }
259
260
  return fields;
260
261
  }
262
+ export function pageColumnFields(entry) {
263
+ const fields = {};
264
+ for (const key of entry.columns ?? []) {
265
+ const field = entry.fields[key];
266
+ if (field) fields[key] = field;
267
+ }
268
+ return fields;
269
+ }
270
+ export function pageRowFields(entry) {
271
+ const columns = new Set(entry.columns ?? []);
272
+ return Object.fromEntries(
273
+ Object.entries(pageAllFields(entry)).filter(([key]) => !columns.has(key))
274
+ );
275
+ }
276
+ export function pageFieldsTableName(name) {
277
+ return `${name}_fields`;
278
+ }
279
+ export function pageMediaTableName(name) {
280
+ return `${name}_media`;
281
+ }
261
282
  export function entryFieldsFor(entry, path) {
262
283
  if (entry.kind !== "page") return entry.fields;
263
284
  return path ? pageFields(entry, path) : pageAllFields(entry);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xleddyl/nuxt-cms",
3
- "version": "0.1.56",
3
+ "version": "0.1.58",
4
4
  "description": "Lightweight CMS that ships with your Nuxt app: runs on the Nitro server, content types defined in code, /cms admin panel, GraphQL API, SQLite or Postgres. No external CMS needed!",
5
5
  "license": "MIT",
6
6
  "author": "Edoardo Alberti (https://github.com/xleddyl)",