rimecms 0.30.2 → 0.31.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.
Files changed (191) hide show
  1. package/README.md +2 -40
  2. package/dist/.rime-modules.d.ts +23 -0
  3. package/dist/.rime-modules.json +1 -0
  4. package/dist/adapter-sqlite/generate-schema/column.server.js +1 -4
  5. package/dist/adapter-sqlite/generate-schema/write.server.js +7 -9
  6. package/dist/core/areas/config/builder.server.d.ts +0 -1
  7. package/dist/core/collections/auth/hooks/before-upsert/augment-fields-password.server.d.ts +1 -1
  8. package/dist/core/collections/config/builder.server.d.ts +0 -1
  9. package/dist/core/collections/upload/hooks/convert-base64.server.d.ts +1 -1
  10. package/dist/core/collections/upload/hooks/extract-path.server.d.ts +1 -1
  11. package/dist/core/collections/upload/hooks/handle-path-creation.server.d.ts +1 -1
  12. package/dist/core/collections/upload/hooks/process-file-upload.server.d.ts +1 -1
  13. package/dist/core/config/auth/better-auth-hooks.server.js +6 -3
  14. package/dist/core/config/auth/better-auth.server.d.ts +3 -3
  15. package/dist/core/config/client/augment-plugins.d.ts +1 -5
  16. package/dist/core/config/client/augment-plugins.js +3 -3
  17. package/dist/core/config/client/build-config.d.ts +1 -5
  18. package/dist/core/config/config-context.server.d.ts +1 -1
  19. package/dist/core/config/server/augment-plugins.server.d.ts +2 -42
  20. package/dist/core/config/server/augment-plugins.server.js +11 -6
  21. package/dist/core/config/server/build-config.server.d.ts +9 -4007
  22. package/dist/core/config/types.d.ts +12 -11
  23. package/dist/core/dev/cache/index.server.js +1 -1
  24. package/dist/core/dev/cli/build/index.d.ts +1 -0
  25. package/dist/core/dev/cli/build/index.js +10 -5
  26. package/dist/core/dev/cli/build/templates.d.ts +1 -1
  27. package/dist/core/dev/cli/build/templates.js +10 -7
  28. package/dist/core/dev/cli/clear/index.server.js +2 -0
  29. package/dist/core/dev/cli/generate-manifest/index.server.d.ts +17 -0
  30. package/dist/core/dev/cli/generate-manifest/index.server.js +221 -0
  31. package/dist/core/dev/cli/index.js +43 -0
  32. package/dist/core/dev/cli/init/index.server.js +13 -6
  33. package/dist/core/dev/cli/init/templates.d.ts +1 -1
  34. package/dist/core/dev/cli/init/templates.js +13 -4
  35. package/dist/core/dev/cli/util/package-manager.server.js +29 -26
  36. package/dist/core/dev/constants.d.ts +21 -2
  37. package/dist/core/dev/constants.js +26 -0
  38. package/dist/core/dev/generate/routes/common.server.js +4 -7
  39. package/dist/core/dev/generate/routes/index.server.js +25 -4
  40. package/dist/core/dev/generate/runtime/index.server.d.ts +40 -0
  41. package/dist/core/dev/generate/runtime/index.server.js +85 -0
  42. package/dist/core/dev/generate/runtime/parse-exports.server.d.ts +7 -0
  43. package/dist/core/dev/generate/runtime/parse-exports.server.js +40 -0
  44. package/dist/core/dev/generate/sanitize/index.server.d.ts +0 -7
  45. package/dist/core/dev/generate/sanitize/index.server.js +57 -5
  46. package/dist/core/dev/generate/types/index.server.js +21 -20
  47. package/dist/core/dev/vite/index.server.js +227 -33
  48. package/dist/core/ensure.server.d.ts +4 -3
  49. package/dist/core/ensure.server.js +8 -8
  50. package/dist/core/fields/builders/boolean-builder.d.ts +1 -2
  51. package/dist/core/fields/builders/field-builder.d.ts +11 -6
  52. package/dist/core/fields/builders/field-builder.js +12 -5
  53. package/dist/core/fields/builders/form-field-builder.d.ts +11 -14
  54. package/dist/core/fields/builders/form-field-builder.js +17 -15
  55. package/dist/core/fields/util.js +1 -1
  56. package/dist/core/handlers/index.js +2 -2
  57. package/dist/core/operations/blocks/extract.server.js +1 -1
  58. package/dist/core/operations/hooks/before-read/process-document-fields.server.js +3 -3
  59. package/dist/core/operations/hooks/before-upsert/data-config-map.server.d.ts +1 -1
  60. package/dist/core/operations/hooks/before-upsert/handle-new-version.server.d.ts +1 -1
  61. package/dist/core/operations/hooks/before-upsert/original-config-map.server.d.ts +1 -1
  62. package/dist/core/operations/hooks/before-upsert/set-default-values.server.d.ts +1 -1
  63. package/dist/core/operations/hooks/before-upsert/set-default-values.server.js +3 -3
  64. package/dist/core/operations/hooks/before-upsert/validate-fields.server.d.ts +1 -1
  65. package/dist/core/operations/hooks/before-upsert/validate-fields.server.js +7 -7
  66. package/dist/core/operations/hooks/index.server.d.ts +0 -4
  67. package/dist/core/operations/hooks/index.server.js +0 -4
  68. package/dist/core/operations/shared/fallback-data-from-original.js +1 -1
  69. package/dist/core/operations/tree/extract.server.js +1 -1
  70. package/dist/core/plugins/api-init/index.d.ts +2 -0
  71. package/dist/core/plugins/api-init/index.js +1 -0
  72. package/dist/core/plugins/api-init/{index.server.d.ts → module.server.d.ts} +0 -1
  73. package/dist/core/plugins/api-init/{index.server.js → module.server.js} +2 -3
  74. package/dist/core/plugins/cache/index.d.ts +2 -5
  75. package/dist/core/plugins/cache/index.js +1 -21
  76. package/dist/core/plugins/cache/module.d.ts +4 -0
  77. package/dist/core/plugins/cache/module.js +22 -0
  78. package/dist/core/plugins/cache/{index.server.d.ts → module.server.d.ts} +1 -2
  79. package/dist/core/plugins/cache/{index.server.js → module.server.js} +0 -1
  80. package/dist/core/plugins/index.d.ts +1 -8
  81. package/dist/core/plugins/index.js +0 -3
  82. package/dist/core/plugins/mailer/index.d.ts +2 -0
  83. package/dist/core/plugins/mailer/index.js +1 -0
  84. package/dist/core/plugins/mailer/{index.server.d.ts → module.server.d.ts} +0 -1
  85. package/dist/core/plugins/mailer/{index.server.js → module.server.js} +0 -1
  86. package/dist/core/plugins/sse/index.d.ts +2 -0
  87. package/dist/core/plugins/sse/index.js +1 -0
  88. package/dist/core/plugins/sse/{index.server.d.ts → module.server.d.ts} +0 -1
  89. package/dist/core/plugins/sse/{index.server.js → module.server.js} +0 -1
  90. package/dist/core/rime.server.d.ts +16 -16
  91. package/dist/fields/blocks/index.d.ts +1 -1
  92. package/dist/fields/blocks/index.js +5 -2
  93. package/dist/fields/checkbox/index.d.ts +1 -1
  94. package/dist/fields/checkbox/index.js +3 -2
  95. package/dist/fields/combobox/index.d.ts +1 -1
  96. package/dist/fields/combobox/index.js +4 -2
  97. package/dist/fields/date/index.d.ts +2 -2
  98. package/dist/fields/date/index.js +7 -5
  99. package/dist/fields/email/index.d.ts +3 -3
  100. package/dist/fields/email/index.js +9 -8
  101. package/dist/fields/group/component/Group.svelte +1 -1
  102. package/dist/fields/group/index.d.ts +1 -1
  103. package/dist/fields/group/index.js +4 -2
  104. package/dist/fields/link/index.d.ts +1 -1
  105. package/dist/fields/link/index.js +63 -56
  106. package/dist/fields/link/module.server.d.ts +2 -0
  107. package/dist/fields/link/{runtime.server.js → module.server.js} +0 -8
  108. package/dist/fields/number/index.d.ts +1 -1
  109. package/dist/fields/number/index.js +3 -2
  110. package/dist/fields/radio/index.d.ts +1 -1
  111. package/dist/fields/radio/index.js +4 -2
  112. package/dist/fields/relation/index.d.ts +2 -6
  113. package/dist/fields/relation/index.js +64 -75
  114. package/dist/fields/relation/{runtime.d.ts → module.d.ts} +2 -2
  115. package/dist/fields/relation/module.js +4 -0
  116. package/dist/fields/relation/module.server.d.ts +5 -0
  117. package/dist/fields/relation/{runtime.server.js → module.server.js} +3 -6
  118. package/dist/fields/rich-text/index.d.ts +1 -1
  119. package/dist/fields/rich-text/index.js +3 -2
  120. package/dist/fields/select/index.d.ts +1 -1
  121. package/dist/fields/select/index.js +4 -1
  122. package/dist/fields/slug/index.d.ts +1 -1
  123. package/dist/fields/slug/index.js +3 -2
  124. package/dist/fields/tabs/index.d.ts +1 -1
  125. package/dist/fields/tabs/index.js +10 -2
  126. package/dist/fields/text/index.d.ts +1 -1
  127. package/dist/fields/text/index.js +3 -2
  128. package/dist/fields/textarea/index.d.ts +1 -1
  129. package/dist/fields/textarea/index.js +3 -2
  130. package/dist/fields/time/index.d.ts +1 -1
  131. package/dist/fields/time/index.js +3 -2
  132. package/dist/fields/toggle/index.d.ts +1 -1
  133. package/dist/fields/toggle/index.js +3 -3
  134. package/dist/fields/tree/index.d.ts +1 -1
  135. package/dist/fields/tree/index.js +4 -2
  136. package/dist/index.d.ts +3 -3
  137. package/dist/index.js +3 -3
  138. package/dist/panel/components/fields/RenderFields.svelte +1 -1
  139. package/dist/panel/context/collection.svelte.js +5 -3
  140. package/dist/panel/context/config.svelte.d.ts +2 -2
  141. package/dist/panel/context/documentForm.svelte.d.ts +2 -2
  142. package/dist/panel/context/documentForm.svelte.js +47 -28
  143. package/dist/panel/context/form.svelte.js +3 -3
  144. package/dist/panel/context/live.svelte.js +1 -1
  145. package/dist/panel/pages/auth/sign-in/SignIn.svelte +6 -1
  146. package/dist/server.d.ts +4 -4
  147. package/dist/server.js +4 -4
  148. package/dist/types.d.ts +1 -1
  149. package/dist/util/doc.js +1 -1
  150. package/package.json +2 -9
  151. package/dist/fields/blocks/index.server.d.ts +0 -3
  152. package/dist/fields/blocks/index.server.js +0 -5
  153. package/dist/fields/checkbox/index.server.d.ts +0 -3
  154. package/dist/fields/checkbox/index.server.js +0 -3
  155. package/dist/fields/combobox/index.server.d.ts +0 -3
  156. package/dist/fields/combobox/index.server.js +0 -4
  157. package/dist/fields/date/index.server.d.ts +0 -3
  158. package/dist/fields/date/index.server.js +0 -3
  159. package/dist/fields/email/index.server.d.ts +0 -4
  160. package/dist/fields/email/index.server.js +0 -3
  161. package/dist/fields/group/index.server.d.ts +0 -2
  162. package/dist/fields/group/index.server.js +0 -12
  163. package/dist/fields/index.server.d.ts +0 -14
  164. package/dist/fields/index.server.js +0 -65
  165. package/dist/fields/link/runtime.server.d.ts +0 -5
  166. package/dist/fields/number/index.server.d.ts +0 -3
  167. package/dist/fields/number/index.server.js +0 -3
  168. package/dist/fields/radio/index.server.d.ts +0 -3
  169. package/dist/fields/radio/index.server.js +0 -4
  170. package/dist/fields/relation/runtime.js +0 -4
  171. package/dist/fields/relation/runtime.server.d.ts +0 -8
  172. package/dist/fields/rich-text/index.server.d.ts +0 -3
  173. package/dist/fields/rich-text/index.server.js +0 -3
  174. package/dist/fields/select/index.server.d.ts +0 -3
  175. package/dist/fields/select/index.server.js +0 -4
  176. package/dist/fields/slug/index.server.d.ts +0 -3
  177. package/dist/fields/slug/index.server.js +0 -3
  178. package/dist/fields/tabs/index.server.d.ts +0 -3
  179. package/dist/fields/tabs/index.server.js +0 -18
  180. package/dist/fields/text/index.server.d.ts +0 -3
  181. package/dist/fields/text/index.server.js +0 -3
  182. package/dist/fields/textarea/index.server.d.ts +0 -3
  183. package/dist/fields/textarea/index.server.js +0 -3
  184. package/dist/fields/time/index.server.d.ts +0 -3
  185. package/dist/fields/time/index.server.js +0 -3
  186. package/dist/fields/toggle/index.server.d.ts +0 -3
  187. package/dist/fields/toggle/index.server.js +0 -3
  188. package/dist/fields/tree/index.server.d.ts +0 -3
  189. package/dist/fields/tree/index.server.js +0 -4
  190. /package/dist/fields/link/{runtime.d.ts → module.d.ts} +0 -0
  191. /package/dist/fields/link/{runtime.js → module.js} +0 -0
package/README.md CHANGED
@@ -76,44 +76,6 @@ The `rime init` command will automatically:
76
76
  - Install dependencies.
77
77
  - Push initial schema
78
78
 
79
- > [!NOTE]
80
- > Please check that these files have been properly configured:
81
-
82
- ```ts
83
- // vite.config.ts
84
- import { defineConfig } from 'vite';
85
- import { sveltekit } from '@sveltejs/kit/vite';
86
- import { rime } from 'rimecms/vite';
87
-
88
- export default defineConfig({
89
- plugins: [rime(), sveltekit()]
90
- });
91
- ```
92
-
93
- ```typescript
94
- // src/hooks.server.ts (should be created)
95
- import config from '$lib/+rime.generated/rime.config.server.js';
96
- import { handlers } from 'rimecms/server';
97
- import { sequence } from '@sveltejs/kit/hooks';
98
-
99
- export const handle = sequence(...(await handlers(config)));
100
- ```
101
-
102
- ```
103
- #.env
104
- BETTER_AUTH_SECRET=super_secret
105
- PUBLIC_RIME_URL=http://localhost:5173
106
-
107
- RIME_LOG_TO_FILE=true
108
- RIME_LOG_LEVEL=DEBUG
109
-
110
- # RIME_CACHE_ENABLED=false
111
- # RIME_SMTP_USER=user@mail.com
112
- # RIME_SMTP_PASSWORD=supersecret
113
- # RIME_SMTP_HOST=smtphost.com
114
- # RIME_SMTP_PORT=465
115
- ```
116
-
117
79
  ### 3. Create the first admin user
118
80
 
119
81
  ```bash
@@ -129,7 +91,7 @@ curl -v POST http://localhost:5173/api/init \
129
91
  ## Configuration Example
130
92
 
131
93
  ```typescript
132
- // ./src/lib/+rime/rime.config.ts
94
+ // ./src/lib/+rime/rime.config.server.ts
133
95
  import { rime, Collection, Area } from '$rime/config';
134
96
  import { adapterSqlite } from 'rimecms/adapter-sqlite';
135
97
  import { Settings2 } from '@lucide/svelte';
@@ -245,7 +207,7 @@ npx rime build
245
207
  npx rime build -d # to copy the database directory
246
208
  ```
247
209
 
248
- It's doing bascically `vite build` under the hood and create the polka server file inside an app directory, plus giving some info on how to run it.
210
+ It's doing bascically `vite build` under the hood and create the server file inside an app directory, plus giving some info on how to run it.
249
211
 
250
212
  ## ROADMAP
251
213
 
@@ -0,0 +1,23 @@
1
+ declare module '$rime/modules/rimecms/core/plugins/sse' {
2
+ export * from 'rimecms/dist/core/plugins/sse/module.server.js';
3
+ }
4
+
5
+ declare module '$rime/modules/rimecms/core/plugins/cache' {
6
+ export * from 'rimecms/dist/core/plugins/cache/module.server.js';
7
+ }
8
+
9
+ declare module '$rime/modules/rimecms/core/plugins/mailer' {
10
+ export * from 'rimecms/dist/core/plugins/mailer/module.server.js';
11
+ }
12
+
13
+ declare module '$rime/modules/rimecms/core/plugins/api-init' {
14
+ export * from 'rimecms/dist/core/plugins/api-init/module.server.js';
15
+ }
16
+
17
+ declare module '$rime/modules/rimecms/fields/relation' {
18
+ export * from 'rimecms/dist/fields/relation/module.server.js';
19
+ }
20
+
21
+ declare module '$rime/modules/rimecms/fields/link' {
22
+ export * from 'rimecms/dist/fields/link/module.server.js';
23
+ }
@@ -0,0 +1 @@
1
+ {"core/plugins/sse":{"server":"core/plugins/sse/module.server.js"},"core/plugins/cache":{"client":"core/plugins/cache/module.js","server":"core/plugins/cache/module.server.js"},"core/plugins/mailer":{"server":"core/plugins/mailer/module.server.js"},"core/plugins/api-init":{"server":"core/plugins/api-init/module.server.js"},"fields/relation":{"client":"fields/relation/module.js","server":"fields/relation/module.server.js"},"fields/link":{"client":"fields/link/module.js","server":"fields/link/module.server.js"}}
@@ -66,10 +66,7 @@ export function toSchemaColumn(field, parentPath) {
66
66
  // reading it off the generic FormField base needs a narrow cast, same as
67
67
  // each field's own toSchema did today by typing against its concrete field.
68
68
  const { unique, required } = field.get;
69
- // `dataType` is implemented by every leaf field builder but isn't declared
70
- // on the FormFieldBuilder base (see the comment there) — narrow cast here.
71
- const dataType = field.dataType;
72
- const columnExpr = COLUMN_EXPR[dataType](snake);
69
+ const columnExpr = COLUMN_EXPR[field.dataType](snake);
73
70
  const referencesStr = field._references ? templateReferences(field._references) : '';
74
71
  const defaultValue = RESOLVE_DEFAULT[field.type]?.(field);
75
72
  const suffix = templateUniqueRequired({ unique, required }, defaultValue);
@@ -1,19 +1,19 @@
1
1
  import cache from '../../core/dev/cache/index.server.js';
2
2
  import { getPackageManager } from '../../core/dev/cli/util/package-manager.server.js';
3
+ import { schemaPath } from '../../core/dev/constants.js';
3
4
  import { logger } from '../../core/logger/index.server.js';
4
5
  import fs from 'fs';
5
6
  import { spawnSync } from 'node:child_process';
6
7
  import path from 'node:path';
7
- const OUTPUT_DIR = '+rime.generated';
8
8
  const write = (schema) => {
9
9
  const cachedSchema = cache.get('schema');
10
10
  if (cachedSchema && cachedSchema === schema) {
11
11
  return;
12
12
  }
13
- const outputPath = path.join('./src/lib', OUTPUT_DIR);
14
- const outputFile = path.join(outputPath, 'schema.server.ts');
15
- if (!fs.existsSync(outputPath)) {
16
- fs.mkdirSync(outputPath);
13
+ const outputFile = schemaPath();
14
+ const outputDir = path.dirname(outputFile);
15
+ if (!fs.existsSync(outputDir)) {
16
+ fs.mkdirSync(outputDir, { recursive: true });
17
17
  }
18
18
  try {
19
19
  fs.writeFileSync(outputFile, schema);
@@ -30,20 +30,18 @@ const write = (schema) => {
30
30
  deno: 'npx'
31
31
  };
32
32
  const command = commandMap[pm];
33
- logger.info('[✓] Schema: generated at src/lib/server/schema.ts');
34
- console.log('============================================================');
33
+ logger.info(`[✓] Schema: generated at ${outputFile}`);
35
34
  console.log(`\n ⚡︎ ${command} drizzle-kit generate \n`);
36
35
  const generateResult = spawnSync(command, ['drizzle-kit', 'generate'], { stdio: 'inherit' });
37
36
  if (generateResult.error || generateResult.status !== 0) {
38
37
  throw new Error('drizzle-kit generate failed');
39
38
  }
40
- console.log('\n============================================================');
41
39
  console.log(`\n ⚡︎ ${command} drizzle-kit migrate \n`);
42
40
  const migrateResult = spawnSync(command, ['drizzle-kit', 'migrate'], { stdio: 'inherit' });
43
41
  if (migrateResult.error || migrateResult.status !== 0) {
44
42
  throw new Error('drizzle-kit migrate failed');
45
43
  }
46
- console.log('\n============================================================');
44
+ console.log('\n');
47
45
  // Only mark the schema as in sync once generate + migrate both actually
48
46
  // succeeded — otherwise a future run with an unchanged schema string would
49
47
  // skip re-running drizzle-kit and the DB would stay silently out of sync.
@@ -8,7 +8,6 @@ export declare const hook: {
8
8
  beforeUpsert: <S extends import("../../types/doc").DocType = "raw">(handler: import("../../operations/hooks/index.server.js").Hook<S, "create" | "update", "before">) => import("../../operations/hooks/index.server.js").Hook<S, "create" | "update", "before">;
9
9
  beforeUpdate: <S extends import("../../types/doc").DocType = "raw">(handler: import("../../operations/hooks/index.server.js").Hook<S, "update", "before">) => import("../../operations/hooks/index.server.js").Hook<S, "update", "before">;
10
10
  beforeDelete: <S extends import("../../types/doc").DocType = "raw">(handler: import("../../operations/hooks/index.server.js").Hook<S, "delete", "before">) => import("../../operations/hooks/index.server.js").Hook<S, "delete", "before">;
11
- afterRead: <S extends import("../../types/doc").DocType = "raw">(handler: import("../../operations/hooks/index.server.js").Hook<S, "read", "after">) => import("../../operations/hooks/index.server.js").Hook<S, "read", "after">;
12
11
  afterCreate: <S extends import("../../types/doc").DocType = "raw">(handler: import("../../operations/hooks/index.server.js").Hook<S, "create", "after">) => import("../../operations/hooks/index.server.js").Hook<S, "create", "after">;
13
12
  afterUpsert: <S extends import("../../types/doc").DocType = "raw">(handler: import("../../operations/hooks/index.server.js").Hook<S, "create" | "update", "after">) => import("../../operations/hooks/index.server.js").Hook<S, "create" | "update", "after">;
14
13
  afterUpdate: <S extends import("../../types/doc").DocType = "raw">(handler: import("../../operations/hooks/index.server.js").Hook<S, "update", "after">) => import("../../operations/hooks/index.server.js").Hook<S, "update", "after">;
@@ -3,4 +3,4 @@
3
3
  * add fields password and confirmPassword
4
4
  * to add validations
5
5
  */
6
- export declare const augmentFieldsPassword: import("../../../../operations/hooks/index.server.js").Hook<"auth", "update" | "create", "before">;
6
+ export declare const augmentFieldsPassword: import("../../../../operations/hooks/index.server.js").Hook<"auth", "create" | "update", "before">;
@@ -8,7 +8,6 @@ export declare const hook: {
8
8
  beforeUpsert: <S extends import("../../types/doc.js").DocType = "raw">(handler: import("../../operations/hooks/index.server.js").Hook<S, "create" | "update", "before">) => import("../../operations/hooks/index.server.js").Hook<S, "create" | "update", "before">;
9
9
  beforeUpdate: <S extends import("../../types/doc.js").DocType = "raw">(handler: import("../../operations/hooks/index.server.js").Hook<S, "update", "before">) => import("../../operations/hooks/index.server.js").Hook<S, "update", "before">;
10
10
  beforeDelete: <S extends import("../../types/doc.js").DocType = "raw">(handler: import("../../operations/hooks/index.server.js").Hook<S, "delete", "before">) => import("../../operations/hooks/index.server.js").Hook<S, "delete", "before">;
11
- afterRead: <S extends import("../../types/doc.js").DocType = "raw">(handler: import("../../operations/hooks/index.server.js").Hook<S, "read", "after">) => import("../../operations/hooks/index.server.js").Hook<S, "read", "after">;
12
11
  afterCreate: <S extends import("../../types/doc.js").DocType = "raw">(handler: import("../../operations/hooks/index.server.js").Hook<S, "create", "after">) => import("../../operations/hooks/index.server.js").Hook<S, "create", "after">;
13
12
  afterUpsert: <S extends import("../../types/doc.js").DocType = "raw">(handler: import("../../operations/hooks/index.server.js").Hook<S, "create" | "update", "after">) => import("../../operations/hooks/index.server.js").Hook<S, "create" | "update", "after">;
14
13
  afterUpdate: <S extends import("../../types/doc.js").DocType = "raw">(handler: import("../../operations/hooks/index.server.js").Hook<S, "update", "after">) => import("../../operations/hooks/index.server.js").Hook<S, "update", "after">;
@@ -10,4 +10,4 @@
10
10
  * @param args Hook arguments containing the document to process
11
11
  * @returns Updated args object with converted file data
12
12
  */
13
- export declare const castBase64ToFile: import("../../../operations/hooks/index.server.js").Hook<"upload", "update" | "create", "before">;
13
+ export declare const castBase64ToFile: import("../../../operations/hooks/index.server.js").Hook<"upload", "create" | "update", "before">;
@@ -3,4 +3,4 @@
3
3
  * the function normalize and validate path ({slug}_directories.id).
4
4
  * Then extract parent, name from the given path.
5
5
  */
6
- export declare const exctractPath: import("../../../operations/hooks/index.server.js").Hook<"directory", "update" | "create", "before">;
6
+ export declare const exctractPath: import("../../../operations/hooks/index.server.js").Hook<"directory", "create" | "update", "before">;
@@ -3,4 +3,4 @@
3
3
  * the function get the document _path and check if it exists,
4
4
  * if it doesn't it create {upload_slug}_directories entries recursively
5
5
  */
6
- export declare const handlePathCreation: import("../../../operations/hooks/index.server.js").Hook<"upload", "update" | "create", "before">;
6
+ export declare const handlePathCreation: import("../../../operations/hooks/index.server.js").Hook<"upload", "create" | "update", "before">;
@@ -17,4 +17,4 @@
17
17
  * - Cleans up image variations
18
18
  * - Nullifies related document fields
19
19
  */
20
- export declare const processFileUpload: import("../../../operations/hooks/index.server.js").Hook<"upload", "update" | "create", "before">;
20
+ export declare const processFileUpload: import("../../../operations/hooks/index.server.js").Hook<"upload", "create" | "update", "before">;
@@ -74,7 +74,7 @@ const handleUserCreation = async (ctx) => {
74
74
  /**
75
75
  * Create the collection document
76
76
  */
77
- const [error] = await trycatch(() => event.locals.rime
77
+ const [error, userData] = await trycatch(() => event.locals.rime
78
78
  .collection(ctx.body.type)
79
79
  .system(event.locals.isInit)
80
80
  .create({
@@ -89,7 +89,7 @@ const handleUserCreation = async (ctx) => {
89
89
  }
90
90
  }));
91
91
  // If error clean up session/account/user created
92
- // Would be great to do it with the admin plugin,
92
+ // note: would be cleaner to do it with the admin plugin, not possible at the moment
93
93
  if (error) {
94
94
  console.log(error);
95
95
  logger.error(error.message);
@@ -105,6 +105,8 @@ const handleUserCreation = async (ctx) => {
105
105
  await rime.adapter.db.delete(authUsersTable).where(eq(authUsersTable.id, user.id));
106
106
  throw new APIError('BAD_REQUEST');
107
107
  }
108
+ // Return rime user data
109
+ return userData;
108
110
  };
109
111
  /****************************************************/
110
112
  /* Before Hooks
@@ -131,6 +133,7 @@ export const betterAuthAfterHook = createAuthMiddleware(async (ctx) => {
131
133
  }
132
134
  // Handle sign-up
133
135
  if (ctx.path.startsWith('/sign-up')) {
134
- return await handleUserCreation(ctx);
136
+ await handleUserCreation(ctx);
137
+ return await getUserAttributes(ctx);
135
138
  }
136
139
  });
@@ -1,4 +1,4 @@
1
- import type { MailerActions } from '../../plugins/mailer/index.server.js';
1
+ import type { MailerActions } from '../../plugins/mailer/module.server.js';
2
2
  import type { ConfigContext } from '../../rime.server.js';
3
3
  import type { Config } from '../../../types.js';
4
4
  export declare function getBaseAuthConfig<const C extends Config>(ctx: {
@@ -1752,13 +1752,13 @@ export declare function getBaseAuthConfig<const C extends Config>(ctx: {
1752
1752
  $Infer: {
1753
1753
  body: ({
1754
1754
  permission: {
1755
- readonly user?: ("update" | "create" | "delete" | "list" | "get" | "set-role" | "ban" | "impersonate" | "set-password")[] | undefined;
1755
+ readonly user?: ("create" | "update" | "delete" | "list" | "get" | "set-role" | "ban" | "impersonate" | "set-password")[] | undefined;
1756
1756
  readonly session?: ("delete" | "list" | "revoke")[] | undefined;
1757
1757
  };
1758
1758
  permissions?: never | undefined;
1759
1759
  } | {
1760
1760
  permissions: {
1761
- readonly user?: ("update" | "create" | "delete" | "list" | "get" | "set-role" | "ban" | "impersonate" | "set-password")[] | undefined;
1761
+ readonly user?: ("create" | "update" | "delete" | "list" | "get" | "set-role" | "ban" | "impersonate" | "set-password")[] | undefined;
1762
1762
  readonly session?: ("delete" | "list" | "revoke")[] | undefined;
1763
1763
  };
1764
1764
  permission?: never | undefined;
@@ -1,8 +1,4 @@
1
1
  import type { SanitizedConfigClient } from '../types.js';
2
2
  export declare const augmentPlugins: <const T extends SanitizedConfigClient>(config: T) => T & {
3
- readonly plugins: (import("../../plugins/index.js").PluginClient | {
4
- readonly name: "cache/client";
5
- readonly type: "client";
6
- readonly configure: <const C extends SanitizedConfigClient>(config: C) => C;
7
- })[];
3
+ readonly plugins: any[];
8
4
  };
@@ -1,6 +1,6 @@
1
- import { cacheClient } from '../../plugins/cache/index.js';
1
+ import { cache } from '../../plugins/cache/index.js';
2
2
  export const augmentPlugins = (config) => {
3
- const plugins = [cacheClient(), ...(config.plugins || [])];
3
+ const plugins = [cache(), ...(config.plugins || [])];
4
4
  for (const plugin of plugins) {
5
5
  if ('configure' in plugin && typeof plugin.configure === 'function') {
6
6
  config = plugin.configure(config);
@@ -8,6 +8,6 @@ export const augmentPlugins = (config) => {
8
8
  }
9
9
  return {
10
10
  ...config,
11
- plugins: plugins.filter((p) => p.type === 'client')
11
+ plugins
12
12
  };
13
13
  };
@@ -37,9 +37,5 @@ export declare const buildConfigClient: <C extends SanitizedConfigClient>(config
37
37
  } & {
38
38
  readonly collections: readonly import("../types.js").BuiltCollection[];
39
39
  } & {
40
- readonly plugins: (import("../../plugins/index.js").PluginClient | {
41
- readonly name: "cache/client";
42
- readonly type: "client";
43
- readonly configure: <const C_1 extends SanitizedConfigClient>(config: C_1) => C_1;
44
- })[];
40
+ readonly plugins: any[];
45
41
  };
@@ -54,7 +54,7 @@ export declare function createConfigContext<const C extends Config>(config: Buil
54
54
  /**
55
55
  * Retrieves either an area or collection configuration by its slug
56
56
  */
57
- getBySlug: (slug: string) => import("../../types.js").BuiltArea | import("../../types.js").BuiltCollection;
57
+ getBySlug: (slug: string) => import("../../types.js").BuiltCollection | import("../../types.js").BuiltArea;
58
58
  /**
59
59
  * Checks if a slug represents a collection
60
60
  */
@@ -1,45 +1,5 @@
1
1
  import type { Config } from '../types.js';
2
+ import type { Plugin } from '../../plugins/index.js';
2
3
  export declare const augmentPluginsServer: <const T extends Config>(config: T) => T & {
3
- readonly $plugins: readonly [{
4
- readonly name: "sse";
5
- readonly type: "server";
6
- readonly actions: {
7
- readonly broadcast: (data: import("../../plugins/sse/types").ContentUpdatePayload) => void;
8
- };
9
- readonly routes: {
10
- readonly '/api/sse': {
11
- readonly GET: import("@sveltejs/kit").RequestHandler;
12
- };
13
- };
14
- }, {
15
- readonly name: "cache";
16
- readonly type: "server";
17
- readonly configure: <const C extends Config>(config: C) => C;
18
- readonly routes: {
19
- readonly '/api/clear-cache': {
20
- readonly POST: () => Response;
21
- };
22
- };
23
- readonly actions: import("../../plugins/cache/index.server.js").CacheActions;
24
- readonly handler: import("@sveltejs/kit").Handle;
25
- }, ...(import("../../plugins").Plugin | {
26
- readonly name: "apiInit";
27
- readonly type: "server";
28
- readonly routes: {
29
- readonly '/api/init': {
30
- readonly POST: import("@sveltejs/kit").RequestHandler;
31
- };
32
- };
33
- } | {
34
- readonly name: "mailer";
35
- readonly type: "server";
36
- readonly actions: {
37
- readonly sendMail: (args: {
38
- to: string;
39
- subject: string;
40
- text: string;
41
- html?: string;
42
- }) => Promise<import("nodemailer/lib/smtp-transport").SentMessageInfo>;
43
- };
44
- })[]];
4
+ readonly $plugins: Plugin[];
45
5
  };
@@ -1,9 +1,8 @@
1
1
  import { dev } from '$app/environment';
2
- import { apiInit } from '../../plugins/api-init/index.server.js';
3
- import { cache } from '../../plugins/cache/index.server.js';
4
- import { mailer } from '../../plugins/mailer/index.server.js';
5
- import { sse } from '../../plugins/sse/index.server.js';
6
- // export type WithPluginsServer<T> = T & { $plugins: ReturnType<Plugin>[] };
2
+ import { apiInit } from '../../plugins/api-init/index.js';
3
+ import { cache } from '../../plugins/cache/index.js';
4
+ import { mailer } from '../../plugins/mailer/index.js';
5
+ import { sse } from '../../plugins/sse/index.js';
7
6
  export const augmentPluginsServer = (config) => {
8
7
  //
9
8
  const corePluginsServer = [
@@ -16,7 +15,13 @@ export const augmentPluginsServer = (config) => {
16
15
  // Mailer plugin
17
16
  ...(config.$smtp ? [mailer(config.$smtp)] : [])
18
17
  ];
19
- const plugins = [...corePluginsServer, ...(config.$plugins || [])];
18
+ // Widened to Plugin[] on purpose: each factory's own `as const satisfies Plugin` return
19
+ // keeps a precise literal shape (no `handler` key at all on sse's, no `actions` on
20
+ // apiInit's, ...) — left as a tuple, downstream code reading `.handler`/`.actions` off
21
+ // the union fails to typecheck even though both are optional on Plugin. Doesn't affect
22
+ // build-config.server.ts's ExtractCustomPlugins/InferCorePlugins, which infer off the
23
+ // pre-augmentation config type, not this array.
24
+ const plugins = [...corePluginsServer, ...(config.plugins || [])];
20
25
  let configWithPlugins = config;
21
26
  for (const plugin of plugins) {
22
27
  if ('configure' in plugin && typeof plugin.configure === 'function') {