rimecms 0.27.6 → 0.28.1

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 (206) hide show
  1. package/dist/adapter-sqlite/{area.js → area.server.js} +2 -2
  2. package/dist/adapter-sqlite/{blocks.d.ts → blocks.server.d.ts} +1 -1
  3. package/dist/adapter-sqlite/{blocks.js → blocks.server.js} +1 -1
  4. package/dist/adapter-sqlite/{collection.js → collection.server.js} +17 -8
  5. package/dist/adapter-sqlite/generate-schema/write.server.js +2 -2
  6. package/dist/adapter-sqlite/index.server.d.ts +8 -8
  7. package/dist/adapter-sqlite/index.server.js +7 -7
  8. package/dist/adapter-sqlite/{orderBy.js → orderBy.server.js} +1 -1
  9. package/dist/adapter-sqlite/{relations.d.ts → relations.server.d.ts} +1 -1
  10. package/dist/adapter-sqlite/{relations.js → relations.server.js} +1 -1
  11. package/dist/adapter-sqlite/{transform.js → transform.server.js} +2 -3
  12. package/dist/adapter-sqlite/{tree.d.ts → tree.server.d.ts} +1 -1
  13. package/dist/adapter-sqlite/{tree.js → tree.server.js} +1 -1
  14. package/dist/adapter-sqlite/url.server.d.ts +1 -1
  15. package/dist/core/areas/local-api.server.d.ts +1 -1
  16. package/dist/core/areas/local-api.server.js +1 -0
  17. package/dist/core/collections/api/delete.server.js +1 -1
  18. package/dist/core/collections/api/get.server.js +1 -1
  19. package/dist/core/collections/api/getById.server.js +3 -1
  20. package/dist/core/collections/config/augment-panel.d.ts +13 -0
  21. package/dist/core/collections/config/augment-panel.js +19 -0
  22. package/dist/core/collections/config/augment-upload.server.d.ts +1 -0
  23. package/dist/core/collections/config/augment-upload.server.js +1 -0
  24. package/dist/core/collections/config/builder.js +3 -1
  25. package/dist/core/collections/config/builder.server.js +3 -1
  26. package/dist/core/collections/local-api.server.js +3 -1
  27. package/dist/core/collections/operations/findById.js +3 -1
  28. package/dist/core/collections/upload/hooks/convert-base64.server.js +1 -1
  29. package/dist/core/config/auth/better-auth.server.d.ts +3 -3
  30. package/dist/core/config/auth/better-auth.server.js +1 -1
  31. package/dist/core/config/client/augment-panel.d.ts +4 -4
  32. package/dist/core/config/client/build-config.d.ts +5 -5
  33. package/dist/core/config/server/augment-directories.server.js +3 -3
  34. package/dist/core/config/server/augment-staff.server.d.ts +1 -1
  35. package/dist/core/config/server/augment-staff.server.js +1 -1
  36. package/dist/core/config/server/build-config.server.d.ts +12 -12
  37. package/dist/core/config/server/build-config.server.js +1 -1
  38. package/dist/core/config/server/{validate.js → validate.server.js} +61 -29
  39. package/dist/core/config/server/{write.js → write.server.js} +1 -1
  40. package/dist/core/config/shared/augment-icons.d.ts +1 -2
  41. package/dist/core/config/shared/get-staff-collection.d.ts +1 -1
  42. package/dist/core/config/shared/upload-directories.js +1 -1
  43. package/dist/core/config/types.d.ts +20 -8
  44. package/dist/core/dev/cli/build/templates.d.ts +1 -1
  45. package/dist/core/dev/cli/build/templates.js +5 -2
  46. package/dist/core/dev/cli/generate/{index.js → index.server.js} +13 -9
  47. package/dist/core/dev/cli/index.js +11 -6
  48. package/dist/core/dev/cli/init/{index.js → index.server.js} +68 -25
  49. package/dist/core/dev/cli/init/{packageManagerUtil.js → package-manager-util.server.js} +5 -5
  50. package/dist/core/dev/generate/routes/{area.d.ts → area.server.d.ts} +1 -1
  51. package/dist/core/dev/generate/routes/{area.js → area.server.js} +1 -1
  52. package/dist/core/dev/generate/routes/{collection.d.ts → collection.server.d.ts} +1 -1
  53. package/dist/core/dev/generate/routes/{collection.js → collection.server.js} +1 -1
  54. package/dist/core/dev/generate/routes/{common.d.ts → common.server.d.ts} +1 -1
  55. package/dist/core/dev/generate/routes/{common.js → common.server.js} +3 -3
  56. package/dist/core/dev/generate/routes/{index.js → index.server.js} +5 -5
  57. package/dist/core/dev/generate/routes/{util.js → util.server.js} +1 -1
  58. package/dist/core/dev/generate/types/{index.js → index.server.js} +1 -1
  59. package/dist/core/dev/vite/{index.js → index.server.js} +8 -4
  60. package/dist/core/fields/util.d.ts +13 -0
  61. package/dist/core/fields/util.js +77 -4
  62. package/dist/core/i18n/en/common.d.ts +1 -0
  63. package/dist/core/i18n/en/common.js +1 -0
  64. package/dist/core/i18n/fr/common.d.ts +1 -0
  65. package/dist/core/i18n/fr/common.js +1 -0
  66. package/dist/core/operations/hooks/before-read/populate-url.server.js +10 -2
  67. package/dist/core/operations/hooks/before-upsert/handle-new-version.server.js +2 -2
  68. package/dist/core/operations/relations/diff.server.d.ts +1 -1
  69. package/dist/core/operations/relations/extract.server.d.ts +1 -1
  70. package/dist/core/rime.server.d.ts +6 -6
  71. package/dist/core/rime.server.js +15 -14
  72. package/dist/fields/blocks/component/Block.svelte +13 -19
  73. package/dist/fields/blocks/component/Blocks.svelte +6 -13
  74. package/dist/fields/group/component/Group.svelte +6 -13
  75. package/dist/fields/number/component/number.css +2 -0
  76. package/dist/fields/relation/component/default/Default.svelte +1 -7
  77. package/dist/fields/relation/component/upload/upload.css +1 -10
  78. package/dist/fields/relation/index.d.ts +21 -6
  79. package/dist/fields/relation/index.js +41 -11
  80. package/dist/fields/rich-text/component/RichText.svelte +4 -4
  81. package/dist/fields/rich-text/component/bubble-menu/bubble-menu.svelte +6 -6
  82. package/dist/fields/rich-text/component/bubble-menu/bubble-menu.svelte.d.ts +2 -0
  83. package/dist/fields/rich-text/component/drag-handle/drag-handle.css +1 -0
  84. package/dist/fields/rich-text/component/styles/rich-text.css +0 -7
  85. package/dist/fields/rich-text/core/features/resource/resource.svelte +2 -9
  86. package/dist/fields/rich-text/core/features/upload/upload.svelte +5 -12
  87. package/dist/fields/rich-text/core/render-rich-text.svelte +5 -3
  88. package/dist/fields/rich-text/index.d.ts +1 -1
  89. package/dist/fields/select/component/Select.svelte +5 -11
  90. package/dist/fields/tabs/index.d.ts +1 -0
  91. package/dist/fields/tabs/index.js +3 -0
  92. package/dist/fields/textarea/component/TextArea.svelte +5 -13
  93. package/dist/fields/tree/component/TreeBlock.svelte +12 -18
  94. package/dist/fields/types.d.ts +3 -2
  95. package/dist/live.d.ts +2 -1
  96. package/dist/live.js +2 -1
  97. package/dist/panel/components/fields/Error.svelte +1 -7
  98. package/dist/panel/components/sections/collection/Empty.svelte +1 -0
  99. package/dist/panel/components/sections/collection/folder/Folder.svelte +7 -16
  100. package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +1 -1
  101. package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +22 -12
  102. package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte +4 -5
  103. package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte +41 -33
  104. package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte.d.ts +4 -0
  105. package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +14 -16
  106. package/dist/panel/components/sections/collection/header/ButtonCreate.svelte.d.ts +2 -0
  107. package/dist/panel/components/sections/collection/header/DisplayMode.svelte +10 -10
  108. package/dist/panel/components/sections/collection/header/SearchInput.svelte +2 -8
  109. package/dist/panel/components/sections/collection/list/CollectionList.svelte +32 -3
  110. package/dist/panel/components/sections/collection/list/header/Header.svelte +3 -9
  111. package/dist/panel/components/sections/collection/list/row/Row.svelte +34 -24
  112. package/dist/panel/components/sections/collection/list/row/Row.svelte.d.ts +9 -0
  113. package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte +11 -1
  114. package/dist/panel/components/sections/document/ButtonStatus.svelte +3 -11
  115. package/dist/panel/components/sections/document/Document.svelte +22 -41
  116. package/dist/panel/components/sections/document/Document.svelte.d.ts +0 -1
  117. package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +11 -21
  118. package/dist/panel/components/sections/live/LiveEdit.svelte +114 -0
  119. package/dist/panel/components/sections/live/LiveEdit.svelte.d.ts +32 -0
  120. package/dist/panel/components/sections/live/LiveEditPanel.svelte +53 -0
  121. package/dist/panel/components/sections/live/LiveEditPanel.svelte.d.ts +11 -0
  122. package/dist/panel/components/sections/live/LiveFloatingUI.svelte +106 -0
  123. package/dist/panel/components/sections/live/LiveFloatingUI.svelte.d.ts +12 -0
  124. package/dist/panel/components/sections/live/Provider.svelte +4 -4
  125. package/dist/panel/components/sections/live/Provider.svelte.d.ts +5 -3
  126. package/dist/panel/components/sections/live/live-edit-panel.css +12 -0
  127. package/dist/panel/components/ui/breadcrumb/BreadCrumb.svelte +2 -9
  128. package/dist/panel/components/ui/button/button.svelte +35 -54
  129. package/dist/panel/components/ui/calendar/calendar.css +11 -0
  130. package/dist/panel/components/ui/card-document/card-document.svelte +21 -14
  131. package/dist/panel/components/ui/card-resource/card-resource.svelte +8 -14
  132. package/dist/panel/components/ui/checkbox/checkbox.svelte +1 -1
  133. package/dist/panel/components/ui/command/command-group.css +1 -0
  134. package/dist/panel/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +1 -7
  135. package/dist/panel/components/ui/input/input.svelte +13 -23
  136. package/dist/panel/components/ui/label/label.css +0 -1
  137. package/dist/panel/components/ui/nav/NavItemButton.svelte +2 -8
  138. package/dist/panel/components/ui/page-header/PageHeader.svelte +6 -13
  139. package/dist/panel/components/ui/radio-group/radio-group.css +2 -0
  140. package/dist/panel/components/ui/scroll-area/scroll-area.css +0 -4
  141. package/dist/panel/components/ui/sheet/sheet.css +0 -16
  142. package/dist/panel/components/ui/tabs/tabs.css +7 -0
  143. package/dist/panel/context/collection.svelte.d.ts +0 -4
  144. package/dist/panel/context/collection.svelte.js +0 -3
  145. package/dist/panel/context/documentForm.svelte.js +1 -0
  146. package/dist/panel/context/live.svelte.d.ts +8 -20
  147. package/dist/panel/context/live.svelte.js +65 -35
  148. package/dist/panel/context/livePanel.svelte.d.ts +11 -0
  149. package/dist/panel/context/livePanel.svelte.js +8 -0
  150. package/dist/panel/pages/auth/forgot-password/ForgotPassword.svelte +1 -7
  151. package/dist/panel/pages/collection/Collection.svelte +3 -1
  152. package/dist/panel/pages/dashboard/Dashboard.svelte +52 -28
  153. package/dist/panel/pages/dashboard/DashboardCollection.svelte +91 -0
  154. package/dist/panel/pages/dashboard/DashboardCollection.svelte.d.ts +9 -0
  155. package/dist/panel/pages/dashboard/load.server.js +30 -14
  156. package/dist/panel/pages/dashboard/types.d.ts +1 -0
  157. package/dist/panel/pages/live/Live.svelte +244 -67
  158. package/dist/panel/pages/live/Live.svelte.d.ts +9 -1
  159. package/dist/panel/pages/live/load.server.js +14 -1
  160. package/dist/panel/style/index.css +562 -8
  161. package/dist/panel/style/mixins/index.css +1 -3
  162. package/dist/panel/util/upload.d.ts +1 -1
  163. package/dist/util/object.js +3 -0
  164. package/package.json +12 -10
  165. package/dist/panel/components/sections/document/FloatingUI.svelte +0 -81
  166. package/dist/panel/components/sections/document/FloatingUI.svelte.d.ts +0 -8
  167. package/dist/panel/components/sections/live/SidePanel.svelte +0 -61
  168. package/dist/panel/components/sections/live/SidePanel.svelte.d.ts +0 -14
  169. package/dist/panel/components/sections/live/side-panel.css +0 -15
  170. /package/dist/adapter-sqlite/{area.d.ts → area.server.d.ts} +0 -0
  171. /package/dist/adapter-sqlite/{collection.d.ts → collection.server.d.ts} +0 -0
  172. /package/dist/adapter-sqlite/{orderBy.d.ts → orderBy.server.d.ts} +0 -0
  173. /package/dist/adapter-sqlite/{transform.d.ts → transform.server.d.ts} +0 -0
  174. /package/dist/adapter-sqlite/{types.d.ts → types.server.d.ts} +0 -0
  175. /package/dist/adapter-sqlite/{types.js → types.server.js} +0 -0
  176. /package/dist/adapter-sqlite/{util.d.ts → util.server.d.ts} +0 -0
  177. /package/dist/adapter-sqlite/{util.js → util.server.js} +0 -0
  178. /package/dist/adapter-sqlite/{where.d.ts → where.server.d.ts} +0 -0
  179. /package/dist/adapter-sqlite/{where.js → where.server.js} +0 -0
  180. /package/dist/adapter-sqlite/{with.d.ts → with.server.d.ts} +0 -0
  181. /package/dist/adapter-sqlite/{with.js → with.server.js} +0 -0
  182. /package/dist/core/collections/upload/util/{converter.d.ts → converter.server.d.ts} +0 -0
  183. /package/dist/core/collections/upload/util/{converter.js → converter.server.js} +0 -0
  184. /package/dist/core/config/auth/{better-auth-hooks.d.ts → better-auth-hooks.server.d.ts} +0 -0
  185. /package/dist/core/config/auth/{better-auth-hooks.js → better-auth-hooks.server.js} +0 -0
  186. /package/dist/core/config/server/{augment-cors.d.ts → augment-cors.server.d.ts} +0 -0
  187. /package/dist/core/config/server/{augment-cors.js → augment-cors.server.js} +0 -0
  188. /package/dist/core/config/server/{validate.d.ts → validate.server.d.ts} +0 -0
  189. /package/dist/core/config/server/{write.d.ts → write.server.d.ts} +0 -0
  190. /package/dist/core/dev/cache/{index.d.ts → index.server.d.ts} +0 -0
  191. /package/dist/core/dev/cache/{index.js → index.server.js} +0 -0
  192. /package/dist/core/dev/cli/clear/{index.d.ts → index.server.d.ts} +0 -0
  193. /package/dist/core/dev/cli/clear/{index.js → index.server.js} +0 -0
  194. /package/dist/core/dev/cli/generate/{index.d.ts → index.server.d.ts} +0 -0
  195. /package/dist/core/dev/cli/init/{getPackageName.d.ts → get-package-info.server.d.ts} +0 -0
  196. /package/dist/core/dev/cli/init/{getPackageName.js → get-package-info.server.js} +0 -0
  197. /package/dist/core/dev/cli/init/{index.d.ts → index.server.d.ts} +0 -0
  198. /package/dist/core/dev/cli/init/{packageManagerUtil.d.ts → package-manager-util.server.d.ts} +0 -0
  199. /package/dist/core/dev/generate/routes/{custom-css.d.ts → custom-css.server.d.ts} +0 -0
  200. /package/dist/core/dev/generate/routes/{custom-css.js → custom-css.server.js} +0 -0
  201. /package/dist/core/dev/generate/routes/{index.d.ts → index.server.d.ts} +0 -0
  202. /package/dist/core/dev/generate/routes/{util.d.ts → util.server.d.ts} +0 -0
  203. /package/dist/core/dev/generate/sanitize/{index.d.ts → index.server.d.ts} +0 -0
  204. /package/dist/core/dev/generate/sanitize/{index.js → index.server.js} +0 -0
  205. /package/dist/core/dev/generate/types/{index.d.ts → index.server.d.ts} +0 -0
  206. /package/dist/core/dev/vite/{index.d.ts → index.server.d.ts} +0 -0
@@ -5,8 +5,8 @@ import { RimeError } from '../core/errors/index.js';
5
5
  import { withLocalesSuffix, withVersionsSuffix } from '../core/naming.js';
6
6
  import { createBlankDocument } from '../util/doc.js';
7
7
  import { eq } from 'drizzle-orm';
8
- import * as adapterUtil from './util.js';
9
- import { buildWithParam } from './with.js';
8
+ import * as adapterUtil from './util.server.js';
9
+ import { buildWithParam } from './with.server.js';
10
10
  /**
11
11
  * Creates an area facade for SQLite adapter operations with CRUD functionality.
12
12
  * Handles both versioned and non-versioned areas with support for localization.
@@ -1,4 +1,4 @@
1
- import type { GenericAdapteFacadeArgs } from './types.js';
1
+ import type { GenericAdapteFacadeArgs } from './types.server.js';
2
2
  import type { GenericBlock } from '../core/types/doc.js';
3
3
  import type { WithOptional } from '../util/types.js';
4
4
  declare const createBlocksFacade: ({ db, tables }: GenericAdapteFacadeArgs) => {
@@ -2,7 +2,7 @@ import { withLocalesSuffix } from '../core/naming.js';
2
2
  import { and, eq, getTableColumns } from 'drizzle-orm';
3
3
  import { omit } from '../util/object.js';
4
4
  import { toPascalCase } from '../util/string.js';
5
- import { generatePK, transformDataToSchema } from './util.js';
5
+ import { generatePK, transformDataToSchema } from './util.server.js';
6
6
  const createBlocksFacade = ({ db, tables }) => {
7
7
  const buildBlockTableName = (slug, blockName) => `${slug}Blocks${toPascalCase(blockName)}`;
8
8
  const update = async ({ parentSlug, block, locale }) => {
@@ -5,10 +5,10 @@ import { withDirectoriesSuffix, withLocalesSuffix, withVersionsSuffix } from '..
5
5
  import { trycatchSync } from '../util/function.js';
6
6
  import { and, desc, eq } from 'drizzle-orm';
7
7
  import { RimeError } from '../core/errors/index.js';
8
- import { buildOrderByParam } from './orderBy.js';
9
- import * as adapterUtil from './util.js';
10
- import { buildWhereParam } from './where.js';
11
- import { buildWithParam } from './with.js';
8
+ import { buildOrderByParam } from './orderBy.server.js';
9
+ import * as adapterUtil from './util.server.js';
10
+ import { buildWhereParam } from './where.server.js';
11
+ import { buildWithParam } from './with.server.js';
12
12
  /**
13
13
  * Creates a collection facade for SQLite adapter operations with CRUD functionality.
14
14
  * Handles both versioned and non-versioned collections with support for localization.
@@ -19,15 +19,17 @@ const createCollectionFacade = (args) => {
19
19
  * Retrieves a document by its ID from a collection. For versioned collections,
20
20
  * returns either a specific version (if versionId is provided) or the latest/published version.
21
21
  */
22
- const findById = async ({ slug, id, versionId, locale, draft }) => {
22
+ const findById = async ({ slug, id, versionId, select, locale, draft }) => {
23
23
  const config = configCtx.collections[slug];
24
24
  const isVersioned = !!config.versions;
25
25
  const table = tables[slug];
26
26
  if (!isVersioned) {
27
27
  // Original implementation for non-versioned collections
28
- const withParam = buildWithParam({ slug, locale, tables, config });
28
+ const withParam = buildWithParam({ slug, select, locale, tables, config });
29
+ const selectColumns = adapterUtil.columnsParams({ table: tables[slug], select });
29
30
  //@ts-expect-error slug is a table for sure
30
31
  const doc = await db.query[slug].findFirst({
32
+ columns: selectColumns,
31
33
  where: eq(table.id, id),
32
34
  with: withParam
33
35
  });
@@ -39,14 +41,21 @@ const createCollectionFacade = (args) => {
39
41
  else {
40
42
  // Implementation for versioned collections
41
43
  const versionsTable = withVersionsSuffix(slug);
42
- const withParam = buildWithParam({ slug: versionsTable, locale, tables, config });
44
+ const withParam = buildWithParam({ slug: versionsTable, select, locale, tables, config });
45
+ const rootSelectColumns = adapterUtil.columnsParams({ table: tables[slug], select });
46
+ const versionSelectColumns = adapterUtil.columnsParams({
47
+ table: tables[versionsTable],
48
+ select
49
+ });
43
50
  // Build params based
44
51
  // if version Id get the specifi version
45
52
  // else get the published or the latest, depending on the draft param
46
53
  const params = {
54
+ columns: rootSelectColumns,
47
55
  where: eq(table.id, id),
48
56
  with: {
49
57
  [versionsTable]: {
58
+ columns: versionSelectColumns,
50
59
  with: withParam,
51
60
  ...(versionId
52
61
  ? {
@@ -67,7 +76,7 @@ const createCollectionFacade = (args) => {
67
76
  if (!doc || !doc[versionsTable] || doc[versionsTable].length === 0) {
68
77
  throw new RimeError(RimeError.NOT_FOUND);
69
78
  }
70
- return adapterUtil.mergeRawDocumentWithVersion(doc, versionsTable);
79
+ return adapterUtil.mergeRawDocumentWithVersion(doc, versionsTable, select);
71
80
  }
72
81
  };
73
82
  /**
@@ -1,5 +1,5 @@
1
- import cache from '../../core/dev/cache/index.js';
2
- import { getPackageManager } from '../../core/dev/cli/init/packageManagerUtil';
1
+ import cache from '../../core/dev/cache/index.server.js';
2
+ import { getPackageManager } from '../../core/dev/cli/init/package-manager-util.server.js';
3
3
  import { logger } from '../../core/logger/index.server.js';
4
4
  import fs from 'fs';
5
5
  import { spawnSync } from 'node:child_process';
@@ -3,18 +3,18 @@ import type { ConfigContext } from '../core/rime.server.js';
3
3
  import type { GetRegisterType } from '../index.js';
4
4
  import type { Dic } from '../util/types.js';
5
5
  import { LibSQLDatabase } from 'drizzle-orm/libsql';
6
- import createAreaFacade from './area.js';
6
+ import createAreaFacade from './area.server.js';
7
7
  import createAuthFacade from './auth.server.js';
8
- import createBlocksFacade from './blocks.js';
9
- import createCollectionFacade from './collection.js';
8
+ import createBlocksFacade from './blocks.server.js';
9
+ import createCollectionFacade from './collection.server.js';
10
10
  import generateSchema from './generate-schema/index.server.js';
11
11
  import type { RelationFieldsMap } from './generate-schema/relations/definition.server.js';
12
- import createRelationsFacade from './relations.js';
13
- import { transformerFacade } from './transform.js';
14
- import createTreeFacade from './tree.js';
15
- import type { GenericTable } from './types.js';
12
+ import createRelationsFacade from './relations.server.js';
13
+ import { transformerFacade } from './transform.server.js';
14
+ import createTreeFacade from './tree.server.js';
15
+ import type { GenericTable } from './types.server.js';
16
16
  import { updateDocumentUrl } from './url.server.js';
17
- import { updateTableRecord } from './util.js';
17
+ import { updateTableRecord } from './util.server.js';
18
18
  type Schema = GetRegisterType<'Schema'>;
19
19
  export declare function adapterSqlite(database: string): {
20
20
  createAdapter: <C extends Config>(configCtx: ConfigContext<C>) => Promise<Adapter>;
@@ -1,15 +1,15 @@
1
1
  import { drizzle, LibSQLDatabase } from 'drizzle-orm/libsql';
2
2
  import path from 'path';
3
- import createAreaFacade from './area.js';
3
+ import createAreaFacade from './area.server.js';
4
4
  import createAuthFacade from './auth.server.js';
5
- import createBlocksFacade from './blocks.js';
6
- import createCollectionFacade from './collection.js';
5
+ import createBlocksFacade from './blocks.server.js';
6
+ import createCollectionFacade from './collection.server.js';
7
7
  import generateSchema from './generate-schema/index.server.js';
8
- import createRelationsFacade from './relations.js';
9
- import { transformerFacade } from './transform.js';
10
- import createTreeFacade from './tree.js';
8
+ import createRelationsFacade from './relations.server.js';
9
+ import { transformerFacade } from './transform.server.js';
10
+ import createTreeFacade from './tree.server.js';
11
11
  import { updateDocumentUrl } from './url.server.js';
12
- import { updateTableRecord } from './util.js';
12
+ import { updateTableRecord } from './util.server.js';
13
13
  export function adapterSqlite(database) {
14
14
  //
15
15
  return {
@@ -2,7 +2,7 @@ import { logger } from '../core/logger/index.server.js';
2
2
  import { withLocalesSuffix, withVersionsSuffix } from '../core/naming.js';
3
3
  import { asc, desc, getTableColumns, sql } from 'drizzle-orm';
4
4
  import { getTableConfig } from 'drizzle-orm/sqlite-core';
5
- import { pathToDatabaseColumn } from './util.js';
5
+ import { pathToDatabaseColumn } from './util.server.js';
6
6
  export const buildOrderByParam = ({ slug, locale, tables, config, by }) => {
7
7
  const hasVersions = !!config.versions;
8
8
  const getOrderFunc = (str) => {
@@ -1,4 +1,4 @@
1
- import type { GenericAdapteFacadeArgs } from './types.js';
1
+ import type { GenericAdapteFacadeArgs } from './types.server.js';
2
2
  import type { Relation } from '../fields/relation/index.js';
3
3
  declare const createRelationsFacade: ({ db, tables }: GenericAdapteFacadeArgs) => {
4
4
  create: Create;
@@ -1,6 +1,6 @@
1
1
  import { omit } from '../util/object.js';
2
2
  import { and, eq, getTableColumns, inArray, isNull, or } from 'drizzle-orm';
3
- import { transformDataToSchema } from './util.js';
3
+ import { transformDataToSchema } from './util.server.js';
4
4
  const createRelationsFacade = ({ db, tables }) => {
5
5
  //
6
6
  const deleteFromPaths = async ({ parentSlug, ownerId, paths, locale }) => {
@@ -6,7 +6,7 @@ import { logger } from '../core/logger/index.server.js';
6
6
  import { extractFieldName } from '../fields/tree/util.js';
7
7
  import { isObjectLiteral, omit } from '../util/object.js';
8
8
  import { getBlocksTableNames, getTreeTableNames, makeBlockTableSlug, makeTreeTableSlug } from './generate-schema/util.js';
9
- import { transformDatabaseColumnsToPaths } from './util.js';
9
+ import { transformDatabaseColumnsToPaths } from './util.server.js';
10
10
  /**
11
11
  * Facade responsible of converting raw database document
12
12
  * with relations, blocks, locales,... related rows
@@ -24,8 +24,7 @@ export const transformerFacade = (args) => {
24
24
  const tableName = isVersioned ? withVersionsSuffix(slug) : slug;
25
25
  const tableNameRelationFields = `${tableName}Rels`;
26
26
  const tableNameLocales = withLocalesSuffix(tableName);
27
- const isLive = event.url.pathname.startsWith('/live');
28
- const isPanel = event.url.pathname.startsWith('/panel') || isLive;
27
+ const isPanel = event.url.pathname.startsWith('/panel');
29
28
  let docAPI;
30
29
  if (configCtx.isCollection(slug)) {
31
30
  docAPI = rime.collection(slug);
@@ -1,4 +1,4 @@
1
- import type { GenericAdapteFacadeArgs } from './types.js';
1
+ import type { GenericAdapteFacadeArgs } from './types.server.js';
2
2
  import type { TreeBlock } from '../core/types/doc.js';
3
3
  import type { WithRequired } from '../util/types.js';
4
4
  declare const createTreeFacade: ({ db, tables }: GenericAdapteFacadeArgs) => {
@@ -3,7 +3,7 @@ import { extractFieldName } from '../fields/tree/util.js';
3
3
  import { and, eq, getTableColumns } from 'drizzle-orm';
4
4
  import { omit } from '../util/object.js';
5
5
  import { toPascalCase } from '../util/string.js';
6
- import { generatePK, transformDataToSchema } from './util.js';
6
+ import { generatePK, transformDataToSchema } from './util.server.js';
7
7
  const createTreeFacade = ({ db, tables }) => {
8
8
  //
9
9
  const buildBlockTableName = (slug, blockPath) => {
@@ -1,7 +1,7 @@
1
1
  import type { GetRegisterType } from '../index.js';
2
2
  import type { BuiltArea, BuiltCollection } from '../types.js';
3
3
  import type { LibSQLDatabase } from 'drizzle-orm/libsql';
4
- import type { GenericTables } from './types.js';
4
+ import type { GenericTables } from './types.server.js';
5
5
  type Params = {
6
6
  id: string;
7
7
  versionId?: string;
@@ -54,7 +54,7 @@ declare class AreaAPI<Doc extends GenericDoc = GenericDoc> {
54
54
  * // Get the latest version including draft
55
55
  * const doc = await rime.area('settings').find({ draft: true })
56
56
  */
57
- find(args: APIMethodArgs<typeof find>): Promise<Doc>;
57
+ find(args?: APIMethodArgs<typeof find>): Promise<Doc>;
58
58
  /**
59
59
  * Updates an area document with the provided data
60
60
  *
@@ -67,6 +67,7 @@ class AreaAPI {
67
67
  * const doc = await rime.area('settings').find({ draft: true })
68
68
  */
69
69
  find(args) {
70
+ args = args || {};
70
71
  const { locale, select = [], depth = 0, versionId, draft } = args;
71
72
  const params = {
72
73
  locale: this.#fallbackLocale(locale),
@@ -1,4 +1,4 @@
1
- import { normalizeQuery } from '../../../adapter-sqlite/util.js';
1
+ import { normalizeQuery } from '../../../adapter-sqlite/util.server.js';
2
2
  import { PARAMS } from '../../constant.js';
3
3
  import { handleError } from '../../errors/handler.server.js';
4
4
  import { trycatch } from '../../../util/function.js';
@@ -1,4 +1,4 @@
1
- import { normalizeQuery } from '../../../adapter-sqlite/util.js';
1
+ import { normalizeQuery } from '../../../adapter-sqlite/util.server.js';
2
2
  import { PARAMS } from '../../constant.js';
3
3
  import { handleError } from '../../errors/handler.server.js';
4
4
  import { trycatch } from '../../../util/function.js';
@@ -12,12 +12,14 @@ export default function (slug) {
12
12
  const versionId = event.url.searchParams.get(PARAMS.VERSION_ID) || undefined;
13
13
  const draft = paramDraft ? paramDraft === 'true' : undefined;
14
14
  const depth = typeof paramDepth === 'string' ? parseInt(paramDepth) : 0;
15
+ const select = event.url.searchParams.get(PARAMS.SELECT)?.split(',') || undefined;
15
16
  const [error, document] = await trycatch(() => rime.collection(slug).findById({
16
17
  id,
17
18
  locale: rime.getLocale(),
18
19
  depth,
19
20
  draft,
20
- versionId
21
+ versionId,
22
+ select
21
23
  }));
22
24
  if (error) {
23
25
  return handleError(error, { context: 'api' });
@@ -0,0 +1,13 @@
1
+ import type { CollectionPanelConfig, UploadConfig } from '../../config/types';
2
+ type Input = {
3
+ panel?: CollectionPanelConfig;
4
+ upload?: UploadConfig;
5
+ };
6
+ type WithPanel<T> = T & {
7
+ panel: CollectionPanelConfig;
8
+ };
9
+ /**
10
+ * Set panel to the defined one, or fallback to default
11
+ */
12
+ export declare const augmentPanel: <T extends Input>(config: T) => WithPanel<T>;
13
+ export {};
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Set panel to the defined one, or fallback to default
3
+ */
4
+ export const augmentPanel = (config) => {
5
+ function addPanel() {
6
+ return {
7
+ ...(config.panel || {}),
8
+ dashboard: {
9
+ maxEntries: 8,
10
+ layout: config.upload ? 'grid' : 'rows',
11
+ ...(config.panel && config.panel.dashboard ? config.panel.dashboard : {})
12
+ }
13
+ };
14
+ }
15
+ return {
16
+ ...config,
17
+ panel: addPanel()
18
+ };
19
+ };
@@ -2,5 +2,6 @@ import type { Collection } from '../../config/types.js';
2
2
  import { type WithNormalizedUpload } from './augment-upload.js';
3
3
  /**
4
4
  * Override _path field to add foreign key constraints
5
+ * @TODO why exactly
5
6
  */
6
7
  export declare const augmentUploadServer: <T extends Collection<any>>(config: T) => WithNormalizedUpload<T>;
@@ -3,6 +3,7 @@ import { withDirectoriesSuffix } from '../../naming.js';
3
3
  import { augmentUpload } from './augment-upload.js';
4
4
  /**
5
5
  * Override _path field to add foreign key constraints
6
+ * @TODO why exactly
6
7
  */
7
8
  export const augmentUploadServer = (config) => {
8
9
  const collection = augmentUpload(config);
@@ -9,6 +9,7 @@ import { access } from '../../../util/index.js';
9
9
  import { toKebabCase } from '../../../util/string.js';
10
10
  import { FileText } from '@lucide/svelte';
11
11
  import { augmentLabel } from './augment-label.js';
12
+ import { augmentPanel } from './augment-panel.js';
12
13
  import { augmentThumbnail } from './augment-thumbnail.js';
13
14
  export const create = (slug, incomingConfig) => {
14
15
  //
@@ -22,7 +23,8 @@ export const create = (slug, incomingConfig) => {
22
23
  const withAuth = augmentAuth(withUrl);
23
24
  const withMetas = augmentMetas(withAuth);
24
25
  const withTitle = augmentTitle(withMetas);
25
- const augmented = augmentThumbnail(withTitle);
26
+ const withPanel = augmentPanel(withTitle);
27
+ const augmented = augmentThumbnail(withPanel);
26
28
  return {
27
29
  type: 'collection',
28
30
  slug: augmented.slug,
@@ -10,6 +10,7 @@ import { Hooks } from '../../operations/hooks/index.server.js';
10
10
  import { toKebabCase } from '../../../util/string.js';
11
11
  import { FileText } from '@lucide/svelte';
12
12
  import { augmentLabel } from './augment-label.js';
13
+ import { augmentPanel } from './augment-panel.js';
13
14
  import { augmentThumbnail } from './augment-thumbnail.js';
14
15
  export const create = (slug, incomingConfig) => {
15
16
  //
@@ -20,7 +21,8 @@ export const create = (slug, incomingConfig) => {
20
21
  const withNested = augmentNestedServer(withUpload);
21
22
  const withVersions = augmentVersions(withNested);
22
23
  const withUrl = augmentUrl(withVersions);
23
- const withAuth = augmentAuthServer(withUrl);
24
+ const withPanel = augmentPanel(withUrl);
25
+ const withAuth = augmentAuthServer(withPanel);
24
26
  const withMetas = augmentMetas(withAuth);
25
27
  const withHooks = augmentHooks(withMetas);
26
28
  const withTitle = augmentTitle(withHooks);
@@ -190,7 +190,7 @@ class CollectionAPI {
190
190
  * });
191
191
  */
192
192
  findById(args) {
193
- const { id, versionId, locale, draft, depth = 0 } = args;
193
+ const { id, versionId, locale, select, draft, depth = 0 } = args;
194
194
  if (!id) {
195
195
  throw new RimeError(RimeError.NOT_FOUND);
196
196
  }
@@ -202,6 +202,7 @@ class CollectionAPI {
202
202
  event: this.#event,
203
203
  draft,
204
204
  depth,
205
+ select,
205
206
  isSystemOperation: this.isSystemOperation
206
207
  };
207
208
  if (this.#event.locals.cacheEnabled && !this.isSystemOperation) {
@@ -211,6 +212,7 @@ class CollectionAPI {
211
212
  userRoles: this.#event.locals.user?.roles,
212
213
  id,
213
214
  versionId,
215
+ select,
214
216
  depth,
215
217
  draft,
216
218
  locale
@@ -29,12 +29,14 @@ export const findById = async (args) => {
29
29
  select,
30
30
  draft
31
31
  });
32
+ const hasSelect = select && Array.isArray(select) && select.length;
32
33
  let document = await event.locals.rime.adapter.transform.doc({
33
34
  doc: documentRaw,
34
35
  slug: config.slug,
35
36
  locale,
36
37
  event,
37
- depth
38
+ depth,
39
+ withBlank: !hasSelect
38
40
  });
39
41
  for (const hook of config.$hooks?.beforeRead || []) {
40
42
  const result = await hook({
@@ -1,4 +1,4 @@
1
- import { jsonFileToFile } from '../util/converter.js';
1
+ import { jsonFileToFile } from '../util/converter.server.js';
2
2
  import { RimeError } from '../../../errors/index.js';
3
3
  import { Hooks } from '../../../operations/hooks/index.server.js';
4
4
  import { isFile } from '../../../../util/file.js';
@@ -1140,7 +1140,7 @@ export declare function getBaseAuthConfig<const C extends Config>(ctx: {
1140
1140
  $Infer: {
1141
1141
  body: {
1142
1142
  userId: string;
1143
- role: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[];
1143
+ role: "user" | "admin" | "staff" | ("user" | "admin" | "staff")[];
1144
1144
  };
1145
1145
  };
1146
1146
  };
@@ -1220,7 +1220,7 @@ export declare function getBaseAuthConfig<const C extends Config>(ctx: {
1220
1220
  email: string;
1221
1221
  password?: string | undefined;
1222
1222
  name: string;
1223
- role?: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[] | undefined;
1223
+ role?: "user" | "admin" | "staff" | ("user" | "admin" | "staff")[] | undefined;
1224
1224
  data?: Record<string, any> | undefined;
1225
1225
  };
1226
1226
  };
@@ -1764,7 +1764,7 @@ export declare function getBaseAuthConfig<const C extends Config>(ctx: {
1764
1764
  permission?: never | undefined;
1765
1765
  }) & {
1766
1766
  userId?: string | undefined;
1767
- role?: "user" | "staff" | "admin" | undefined;
1767
+ role?: "user" | "admin" | "staff" | undefined;
1768
1768
  };
1769
1769
  };
1770
1770
  };
@@ -1,7 +1,7 @@
1
1
  import { dev } from '$app/environment';
2
2
  import { env } from '$env/dynamic/public';
3
3
  import { admin as adminPlugin, apiKey } from 'better-auth/plugins';
4
- import { betterAuthAfterHook, betterAuthBeforeHook } from './better-auth-hooks.js';
4
+ import { betterAuthAfterHook, betterAuthBeforeHook } from './better-auth-hooks.server.js';
5
5
  import { accessControl, admin, staff, user } from './better-auth-permissions.js';
6
6
  export function getBaseAuthConfig(ctx) {
7
7
  const betterAuthOptions = {
@@ -11,16 +11,16 @@ export declare const augmentPanel: <const T extends {
11
11
  icon: import("svelte").Component<import("@lucide/svelte").IconProps>;
12
12
  }[], {
13
13
  readonly label: "content";
14
- readonly icon: import("svelte").Component<import("@lucide/svelte").IconProps, {}, "">;
14
+ readonly icon: import("svelte").Component<import("@lucide/svelte").LucideProps, {}, "">;
15
15
  }, {
16
16
  readonly label: "system";
17
- readonly icon: import("svelte").Component<import("@lucide/svelte").IconProps, {}, "">;
17
+ readonly icon: import("svelte").Component<import("@lucide/svelte").LucideProps, {}, "">;
18
18
  }, {
19
19
  readonly label: "collections";
20
- readonly icon: import("svelte").Component<import("@lucide/svelte").IconProps, {}, "">;
20
+ readonly icon: import("svelte").Component<import("@lucide/svelte").LucideProps, {}, "">;
21
21
  }, {
22
22
  readonly label: "areas";
23
- readonly icon: import("svelte").Component<import("@lucide/svelte").IconProps, {}, "">;
23
+ readonly icon: import("svelte").Component<import("@lucide/svelte").LucideProps, {}, "">;
24
24
  }];
25
25
  };
26
26
  readonly components: {
@@ -2,7 +2,7 @@ import type { SanitizedConfigClient } from '../types.js';
2
2
  export declare const buildConfigClient: <C extends SanitizedConfigClient>(config: C) => C & {
3
3
  readonly collections: readonly [import("../types.js").BuiltCollection, ...import("../types.js").BuiltCollection[]];
4
4
  } & {
5
- readonly icons: import("../../../util/types.js").Dic<import("svelte").Component<import("@lucide/svelte").IconProps, {}, string>>;
5
+ readonly icons: import("../../../util/types.js").Dic<import("svelte").Component<import("@lucide/svelte").LucideProps, {}, string>>;
6
6
  } & {
7
7
  readonly panel: {
8
8
  readonly routes: Record<string, import("../types.js").CustomPanelRoute>;
@@ -13,16 +13,16 @@ export declare const buildConfigClient: <C extends SanitizedConfigClient>(config
13
13
  icon: import("svelte").Component<import("@lucide/svelte").IconProps>;
14
14
  }[], {
15
15
  readonly label: "content";
16
- readonly icon: import("svelte").Component<import("@lucide/svelte").IconProps, {}, "">;
16
+ readonly icon: import("svelte").Component<import("@lucide/svelte").LucideProps, {}, "">;
17
17
  }, {
18
18
  readonly label: "system";
19
- readonly icon: import("svelte").Component<import("@lucide/svelte").IconProps, {}, "">;
19
+ readonly icon: import("svelte").Component<import("@lucide/svelte").LucideProps, {}, "">;
20
20
  }, {
21
21
  readonly label: "collections";
22
- readonly icon: import("svelte").Component<import("@lucide/svelte").IconProps, {}, "">;
22
+ readonly icon: import("svelte").Component<import("@lucide/svelte").LucideProps, {}, "">;
23
23
  }, {
24
24
  readonly label: "areas";
25
- readonly icon: import("svelte").Component<import("@lucide/svelte").IconProps, {}, "">;
25
+ readonly icon: import("svelte").Component<import("@lucide/svelte").LucideProps, {}, "">;
26
26
  }];
27
27
  };
28
28
  readonly components: {
@@ -1,6 +1,6 @@
1
- import { augmentHooks } from '../../collections/config/augment-hooks.server';
2
- import { exctractPath } from '../../collections/upload/hooks/extract-path.server';
3
- import { prepareDirectoryChildren, updateDirectoryChildren } from '../../collections/upload/hooks/update-directory-children.server';
1
+ import { augmentHooks } from '../../collections/config/augment-hooks.server.js';
2
+ import { exctractPath } from '../../collections/upload/hooks/extract-path.server.js';
3
+ import { prepareDirectoryChildren, updateDirectoryChildren } from '../../collections/upload/hooks/update-directory-children.server.js';
4
4
  import { isUploadConfig } from '../../collections/upload/util/config.js';
5
5
  import { makeUploadDirectoriesCollectionClient } from '../shared/upload-directories';
6
6
  export const augmentDirectoriesServer = (config) => {
@@ -3,5 +3,5 @@ export declare const augmentStaffServer: <const T extends {
3
3
  collections?: BuiltCollection[];
4
4
  staff?: Config["staff"];
5
5
  }>(config: T) => T & {
6
- readonly collections: readonly [BuiltCollection, ...BuiltCollection[]];
6
+ readonly collections: readonly [...BuiltCollection[], BuiltCollection];
7
7
  };
@@ -2,5 +2,5 @@ import { getStaffCollection } from '../shared/get-staff-collection.js';
2
2
  import { Collection } from './index.server.js';
3
3
  export const augmentStaffServer = (config) => {
4
4
  const staff = Collection.create('staff', getStaffCollection(config.staff));
5
- return { ...config, collections: [staff, ...(config.collections || [])] };
5
+ return { ...config, collections: [...(config.collections || []), staff] };
6
6
  };