nextly 0.0.1 → 0.0.2-alpha.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 (268) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +122 -0
  3. package/dist/_dts-chunks/collections-handler.d-DjgO74Wt.d.ts +20540 -0
  4. package/dist/_dts-chunks/config.d-DNwsDnjs.d.ts +2589 -0
  5. package/dist/_dts-chunks/define-component.d-BUgTHmt3.d.ts +1149 -0
  6. package/dist/_dts-chunks/image-processor.d-OO1PmMrv.d.ts +335 -0
  7. package/dist/_dts-chunks/index.d-axCAzZ7m.d.ts +17842 -0
  8. package/dist/_dts-chunks/media.d-DjDOZo4B.d.ts +117 -0
  9. package/dist/_dts-chunks/on-error.d-CHIKWNxd.d.ts +38 -0
  10. package/dist/_dts-chunks/storage.d-BUhQ2we_.d.ts +404 -0
  11. package/dist/actions/index.d.ts +239 -0
  12. package/dist/actions/index.mjs +281 -0
  13. package/dist/api/auth-state.d.ts +5 -0
  14. package/dist/api/auth-state.mjs +131 -0
  15. package/dist/api/collections-schema-detail.d.ts +56 -0
  16. package/dist/api/collections-schema-detail.mjs +244 -0
  17. package/dist/api/collections-schema-export.d.ts +56 -0
  18. package/dist/api/collections-schema-export.mjs +129 -0
  19. package/dist/api/collections-schema.d.ts +59 -0
  20. package/dist/api/collections-schema.mjs +207 -0
  21. package/dist/api/components-detail.d.ts +50 -0
  22. package/dist/api/components-detail.mjs +132 -0
  23. package/dist/api/components.d.ts +69 -0
  24. package/dist/api/components.mjs +144 -0
  25. package/dist/api/email-providers-default.d.ts +40 -0
  26. package/dist/api/email-providers-default.mjs +75 -0
  27. package/dist/api/email-providers-detail.d.ts +81 -0
  28. package/dist/api/email-providers-detail.mjs +109 -0
  29. package/dist/api/email-providers-test.d.ts +43 -0
  30. package/dist/api/email-providers-test.mjs +114 -0
  31. package/dist/api/email-providers.d.ts +69 -0
  32. package/dist/api/email-providers.mjs +110 -0
  33. package/dist/api/email-send-template.d.ts +41 -0
  34. package/dist/api/email-send-template.mjs +58 -0
  35. package/dist/api/email-send.d.ts +42 -0
  36. package/dist/api/email-send.mjs +58 -0
  37. package/dist/api/email-templates-detail.d.ts +74 -0
  38. package/dist/api/email-templates-detail.mjs +112 -0
  39. package/dist/api/email-templates-layout.d.ts +55 -0
  40. package/dist/api/email-templates-layout.mjs +92 -0
  41. package/dist/api/email-templates-preview.d.ts +48 -0
  42. package/dist/api/email-templates-preview.mjs +93 -0
  43. package/dist/api/email-templates.d.ts +61 -0
  44. package/dist/api/email-templates.mjs +118 -0
  45. package/dist/api/health.d.ts +68 -0
  46. package/dist/api/health.mjs +67 -0
  47. package/dist/api/index.d.ts +54 -0
  48. package/dist/api/index.mjs +16 -0
  49. package/dist/api/media-bulk.d.ts +74 -0
  50. package/dist/api/media-bulk.mjs +196 -0
  51. package/dist/api/media-folders.d.ts +112 -0
  52. package/dist/api/media-folders.mjs +187 -0
  53. package/dist/api/media-handlers.d.ts +102 -0
  54. package/dist/api/media-handlers.mjs +437 -0
  55. package/dist/api/media.d.ts +117 -0
  56. package/dist/api/media.mjs +242 -0
  57. package/dist/api/singles-detail.d.ts +87 -0
  58. package/dist/api/singles-detail.mjs +170 -0
  59. package/dist/api/singles-schema-detail.d.ts +54 -0
  60. package/dist/api/singles-schema-detail.mjs +182 -0
  61. package/dist/api/singles.d.ts +34 -0
  62. package/dist/api/singles.mjs +94 -0
  63. package/dist/api/storage-upload-url.d.ts +48 -0
  64. package/dist/api/storage-upload-url.mjs +202 -0
  65. package/dist/api/uploads.d.ts +109 -0
  66. package/dist/api/uploads.mjs +359 -0
  67. package/dist/auth/index.d.ts +425 -0
  68. package/dist/auth/index.mjs +199 -0
  69. package/dist/boot-apply-PQSYLDIN.mjs +7 -0
  70. package/dist/chunk-2OALJTK6.mjs +489 -0
  71. package/dist/chunk-2Q2SX2CS.mjs +365 -0
  72. package/dist/chunk-2TFX4ND3.mjs +13 -0
  73. package/dist/chunk-2TWPDSYD.mjs +87 -0
  74. package/dist/chunk-2W3DVD7S.mjs +647 -0
  75. package/dist/chunk-2ZFKXPQM.mjs +88 -0
  76. package/dist/chunk-3FA7FKAV.mjs +832 -0
  77. package/dist/chunk-3NZ2KMBL.mjs +58 -0
  78. package/dist/chunk-4MJLT6PZ.mjs +0 -0
  79. package/dist/chunk-56WO4WX7.mjs +0 -0
  80. package/dist/chunk-5APFUGAD.mjs +89 -0
  81. package/dist/chunk-5HMZ644B.mjs +108 -0
  82. package/dist/chunk-67GXH6PR.mjs +32 -0
  83. package/dist/chunk-6JNEPWRW.mjs +14368 -0
  84. package/dist/chunk-6NFHQIJD.mjs +45 -0
  85. package/dist/chunk-7P6ASYW6.mjs +9 -0
  86. package/dist/chunk-A3WPLSDT.mjs +1364 -0
  87. package/dist/chunk-AGJ6F2T3.mjs +144 -0
  88. package/dist/chunk-AK6Z23OX.mjs +1464 -0
  89. package/dist/chunk-APKKRD2G.mjs +102 -0
  90. package/dist/chunk-B2GV2BWH.mjs +73 -0
  91. package/dist/chunk-D5HQBNUB.mjs +74 -0
  92. package/dist/chunk-DNNG377Z.mjs +204 -0
  93. package/dist/chunk-DP3G27G5.mjs +135 -0
  94. package/dist/chunk-DV6WVX2Q.mjs +0 -0
  95. package/dist/chunk-DXGGXIUZ.mjs +57 -0
  96. package/dist/chunk-EGXBZCGC.mjs +943 -0
  97. package/dist/chunk-ERCNLX3V.mjs +176 -0
  98. package/dist/chunk-FQULBZ53.mjs +850 -0
  99. package/dist/chunk-G2AA4QLC.mjs +262 -0
  100. package/dist/chunk-GDBJ5JCU.mjs +488 -0
  101. package/dist/chunk-GJNSJU4S.mjs +19 -0
  102. package/dist/chunk-GZ6DCQKC.mjs +69 -0
  103. package/dist/chunk-H26B4FYG.mjs +167 -0
  104. package/dist/chunk-I4JMR3UR.mjs +21 -0
  105. package/dist/chunk-INV7QKLG.mjs +508 -0
  106. package/dist/chunk-IUDOC7N7.mjs +46 -0
  107. package/dist/chunk-IZWPRDC3.mjs +206 -0
  108. package/dist/chunk-KIMNCZGV.mjs +15 -0
  109. package/dist/chunk-L6HW2DA7.mjs +15 -0
  110. package/dist/chunk-LAZXX4HR.mjs +100 -0
  111. package/dist/chunk-LDKCUMHK.mjs +95 -0
  112. package/dist/chunk-LRXMECUA.mjs +0 -0
  113. package/dist/chunk-M52VMPGA.mjs +119 -0
  114. package/dist/chunk-MGUWEEI6.mjs +160 -0
  115. package/dist/chunk-NRUWQ5Z7.mjs +419 -0
  116. package/dist/chunk-NSEFNNU4.mjs +25360 -0
  117. package/dist/chunk-NTHVDFGO.mjs +138 -0
  118. package/dist/chunk-O3QHXMOX.mjs +3166 -0
  119. package/dist/chunk-P7NH2OSC.mjs +2605 -0
  120. package/dist/chunk-PKMABBB5.mjs +184 -0
  121. package/dist/chunk-PWS6XGJK.mjs +76 -0
  122. package/dist/chunk-R6JJQHFC.mjs +20 -0
  123. package/dist/chunk-RJLLGGPG.mjs +0 -0
  124. package/dist/chunk-SBACDPNX.mjs +689 -0
  125. package/dist/chunk-TO5AFLVQ.mjs +124 -0
  126. package/dist/chunk-TS7GHTG2.mjs +5436 -0
  127. package/dist/chunk-UJ2IMJ4W.mjs +133 -0
  128. package/dist/chunk-UOP63Q54.mjs +102 -0
  129. package/dist/chunk-UUOFWCM6.mjs +78 -0
  130. package/dist/chunk-V4EQTOA4.mjs +893 -0
  131. package/dist/chunk-VJ66NCL4.mjs +193 -0
  132. package/dist/chunk-VQJQHVEV.mjs +29 -0
  133. package/dist/chunk-VTJADRO3.mjs +141 -0
  134. package/dist/chunk-VWF3JO32.mjs +0 -0
  135. package/dist/chunk-W4MGXIRR.mjs +27 -0
  136. package/dist/chunk-W5KKPZT5.mjs +1204 -0
  137. package/dist/chunk-WD34YQ6T.mjs +381 -0
  138. package/dist/chunk-WZBYMYVW.mjs +14 -0
  139. package/dist/chunk-X23WKS3Z.mjs +50 -0
  140. package/dist/chunk-X7TXCYYN.mjs +6496 -0
  141. package/dist/chunk-XGI4EMS3.mjs +140 -0
  142. package/dist/chunk-XZKLBMN6.mjs +1153 -0
  143. package/dist/chunk-YB7INWPY.mjs +0 -0
  144. package/dist/chunk-YV4Y7SDL.mjs +83 -0
  145. package/dist/chunk-YZNBLFIW.mjs +1688 -0
  146. package/dist/chunk-YZZCTONM.mjs +263 -0
  147. package/dist/chunk-ZE6A3FYH.mjs +289 -0
  148. package/dist/cli/nextly.mjs +68 -0
  149. package/dist/cli/utils/index.d.ts +449 -0
  150. package/dist/cli/utils/index.mjs +49 -0
  151. package/dist/component-schema-service-5577KVW6.mjs +11 -0
  152. package/dist/config-loader-23YEMC3Z.mjs +23 -0
  153. package/dist/config.d.ts +44 -0
  154. package/dist/config.mjs +109 -0
  155. package/dist/container-ORGFGYSZ.mjs +9 -0
  156. package/dist/database/index.d.ts +12 -0
  157. package/dist/database/index.mjs +40 -0
  158. package/dist/database/seeders/index.d.ts +93 -0
  159. package/dist/database/seeders/index.mjs +47 -0
  160. package/dist/db-sync-demote-LJGKLB3S.mjs +117 -0
  161. package/dist/db-sync-promote-B26VSYQF.mjs +113 -0
  162. package/dist/dev-reload-broadcaster-B73IQ53V.mjs +25 -0
  163. package/dist/dist-M2NOU37V.mjs +19 -0
  164. package/dist/drizzle-kit-lazy-D2M2PXR2.mjs +13 -0
  165. package/dist/dynamic-collection-schema-service-IEXTPIZ7.mjs +8 -0
  166. package/dist/errors/index.d.ts +159 -0
  167. package/dist/errors/index.mjs +10 -0
  168. package/dist/factory-IWMBKUJM.mjs +15 -0
  169. package/dist/first-run-QIVKWJIF.mjs +63 -0
  170. package/dist/fresh-push-NR67DC3R.mjs +8 -0
  171. package/dist/index.d.ts +4175 -0
  172. package/dist/index.mjs +1336 -0
  173. package/dist/local-plugin-PTET4NAT.mjs +7 -0
  174. package/dist/logger-NU46DXNY.mjs +15 -0
  175. package/dist/logger-YE4TC7ZN.mjs +9 -0
  176. package/dist/migration-journal-EP532Y4L.mjs +139 -0
  177. package/dist/migrations/mysql/0000_eager_sentry.sql +174 -0
  178. package/dist/migrations/mysql/0001_soft_giant_girl.sql +27 -0
  179. package/dist/migrations/mysql/0002_media_table.sql +24 -0
  180. package/dist/migrations/mysql/0003_dynamic_singles.sql +37 -0
  181. package/dist/migrations/mysql/0004_dynamic_components.sql +35 -0
  182. package/dist/migrations/mysql/0005_user_management_tables.sql +92 -0
  183. package/dist/migrations/mysql/0006_api_keys.sql +36 -0
  184. package/dist/migrations/mysql/0007_general_settings.sql +20 -0
  185. package/dist/migrations/mysql/0008_site_settings_logo_url.sql +9 -0
  186. package/dist/migrations/mysql/0009_activity_log.sql +30 -0
  187. package/dist/migrations/mysql/0010_site_settings_sidebar.sql +13 -0
  188. package/dist/migrations/mysql/0011_missing_tables_and_columns.sql +54 -0
  189. package/dist/migrations/mysql/0012_image_sizes_and_focal_point.sql +30 -0
  190. package/dist/migrations/mysql/0012_media_folders.sql +43 -0
  191. package/dist/migrations/mysql/0013_user_brute_force_protection.sql +31 -0
  192. package/dist/migrations/mysql/0014_email_template_attachments.sql +12 -0
  193. package/dist/migrations/mysql/0015_media_uploaded_by_nullable.sql +15 -0
  194. package/dist/migrations/mysql/20260429_000000_000_initial_journal.sql +22 -0
  195. package/dist/migrations/mysql/20260501_000000_journal_batch.sql +17 -0
  196. package/dist/migrations/mysql/20260501_000001_audit_log.sql +24 -0
  197. package/dist/migrations/mysql/20260504_000000_nextly_meta.sql +21 -0
  198. package/dist/migrations/mysql/meta/0000_snapshot.json +1005 -0
  199. package/dist/migrations/mysql/meta/0001_snapshot.json +1099 -0
  200. package/dist/migrations/mysql/meta/_journal.json +41 -0
  201. package/dist/migrations/postgresql/0000_misty_king_bedlam.sql +169 -0
  202. package/dist/migrations/postgresql/0001_perpetual_captain_marvel.sql +8 -0
  203. package/dist/migrations/postgresql/0002_sad_spectrum.sql +16 -0
  204. package/dist/migrations/postgresql/0003_hesitant_ultron.sql +17 -0
  205. package/dist/migrations/postgresql/0004_media_table.sql +24 -0
  206. package/dist/migrations/postgresql/0005_media_folders.sql +36 -0
  207. package/dist/migrations/postgresql/0006_dynamic_collections_update.sql +50 -0
  208. package/dist/migrations/postgresql/0007_dynamic_singles.sql +38 -0
  209. package/dist/migrations/postgresql/0008_dynamic_components.sql +37 -0
  210. package/dist/migrations/postgresql/0009_user_management_tables.sql +95 -0
  211. package/dist/migrations/postgresql/0010_api_keys.sql +34 -0
  212. package/dist/migrations/postgresql/0011_general_settings.sql +20 -0
  213. package/dist/migrations/postgresql/0012_site_settings_logo_url.sql +9 -0
  214. package/dist/migrations/postgresql/0013_activity_log.sql +29 -0
  215. package/dist/migrations/postgresql/0014_image_sizes_and_focal_point.sql +33 -0
  216. package/dist/migrations/postgresql/0014_site_settings_sidebar.sql +13 -0
  217. package/dist/migrations/postgresql/0015_user_brute_force_protection.sql +29 -0
  218. package/dist/migrations/postgresql/0016_email_template_attachments.sql +12 -0
  219. package/dist/migrations/postgresql/0017_media_uploaded_by_nullable.sql +15 -0
  220. package/dist/migrations/postgresql/20260429_000000_000_initial_journal.sql +24 -0
  221. package/dist/migrations/postgresql/20260501_000000_journal_batch.sql +17 -0
  222. package/dist/migrations/postgresql/20260501_000001_audit_log.sql +24 -0
  223. package/dist/migrations/postgresql/20260504_000000_nextly_meta.sql +22 -0
  224. package/dist/migrations/postgresql/meta/0000_snapshot.json +1286 -0
  225. package/dist/migrations/postgresql/meta/0001_snapshot.json +1407 -0
  226. package/dist/migrations/postgresql/meta/0002_snapshot.json +1552 -0
  227. package/dist/migrations/postgresql/meta/0003_snapshot.json +1695 -0
  228. package/dist/migrations/postgresql/meta/0010_snapshot.json +2345 -0
  229. package/dist/migrations/postgresql/meta/_journal.json +90 -0
  230. package/dist/migrations/sqlite/0000_api_keys.sql +34 -0
  231. package/dist/migrations/sqlite/0001_general_settings.sql +20 -0
  232. package/dist/migrations/sqlite/0002_site_settings_logo_url.sql +9 -0
  233. package/dist/migrations/sqlite/0003_activity_log.sql +29 -0
  234. package/dist/migrations/sqlite/0004_image_sizes_and_focal_point.sql +29 -0
  235. package/dist/migrations/sqlite/0004_site_settings_sidebar.sql +11 -0
  236. package/dist/migrations/sqlite/0005_user_brute_force_protection.sql +29 -0
  237. package/dist/migrations/sqlite/0006_email_template_attachments.sql +12 -0
  238. package/dist/migrations/sqlite/0007_media_uploaded_by_nullable.sql +111 -0
  239. package/dist/migrations/sqlite/20260429_000000_000_initial_journal.sql +24 -0
  240. package/dist/migrations/sqlite/20260501_000000_journal_batch.sql +19 -0
  241. package/dist/migrations/sqlite/20260501_000001_audit_log.sql +24 -0
  242. package/dist/migrations/sqlite/20260504_000000_nextly_meta.sql +21 -0
  243. package/dist/migrations/sqlite/20260505_000000_user_management_tables.sql +77 -0
  244. package/dist/next.d.ts +57 -0
  245. package/dist/next.mjs +55 -0
  246. package/dist/observability/index.d.ts +87 -0
  247. package/dist/observability/index.mjs +57 -0
  248. package/dist/permissions-3DZZQZMI.mjs +39 -0
  249. package/dist/pipeline-YOML7SWF.mjs +29 -0
  250. package/dist/preview-ZZTR3QGS.mjs +9 -0
  251. package/dist/program-PW6UB2ZC.mjs +5934 -0
  252. package/dist/reconcile-single-tables-7ENVXJGB.mjs +7 -0
  253. package/dist/register-SF6E6FVU.mjs +49 -0
  254. package/dist/reload-config-HWQ4G5MM.mjs +23 -0
  255. package/dist/resolve-single-table-name-JSOMUB3R.mjs +7 -0
  256. package/dist/routeHandler-UNMMJIBM.mjs +77 -0
  257. package/dist/runtime-schema-generator-NRA6A6Z6.mjs +8 -0
  258. package/dist/runtime.d.ts +120 -0
  259. package/dist/runtime.mjs +73 -0
  260. package/dist/schema-hash-FMMG6VPJ.mjs +13 -0
  261. package/dist/schema-registry-EQ36FZDP.mjs +7 -0
  262. package/dist/scripts/load-env.mjs +42 -0
  263. package/dist/storage/index.d.ts +566 -0
  264. package/dist/storage/index.mjs +45 -0
  265. package/dist/super-admin-G5ZK5F4T.mjs +39 -0
  266. package/dist/system-table-service-WGSRVEGT.mjs +17 -0
  267. package/dist/users-7KELGRYJ.mjs +38 -0
  268. package/package.json +308 -9
@@ -0,0 +1,12 @@
1
+ export { A as AdapterConfig, a as AdapterType, D as DbError, b as DbErrorKind, H as HealthCheckResult, i as checkAdapterHealth, j as createAdapter, k as createAdapterFromEnv, o as env, p as getDialectTables, q as healthCheck, r as isDbError, s as schema, t as toDbError, v as validateDatabaseEnv, w as withDbErrors } from '../_dts-chunks/index.d-axCAzZ7m.d.ts';
2
+ import 'drizzle-orm';
3
+ import 'drizzle-orm/pg-core';
4
+ import '../_dts-chunks/collections-handler.d-DjgO74Wt.d.ts';
5
+ import '@nextlyhq/adapter-drizzle';
6
+ import '@nextlyhq/adapter-drizzle/types';
7
+ import 'react';
8
+ import '../_dts-chunks/media.d-DjDOZo4B.d.ts';
9
+ import 'zod';
10
+ import '../_dts-chunks/image-processor.d-OO1PmMrv.d.ts';
11
+ import 'drizzle-orm/mysql-core';
12
+ import 'drizzle-orm/sqlite-core';
@@ -0,0 +1,40 @@
1
+ import {
2
+ getDialectTables,
3
+ schema_exports,
4
+ withDbErrors
5
+ } from "../chunk-TS7GHTG2.mjs";
6
+ import "../chunk-H26B4FYG.mjs";
7
+ import {
8
+ checkAdapterHealth,
9
+ createAdapter,
10
+ createAdapterFromEnv,
11
+ validateDatabaseEnv
12
+ } from "../chunk-DP3G27G5.mjs";
13
+ import "../chunk-DV6WVX2Q.mjs";
14
+ import {
15
+ env
16
+ } from "../chunk-UJ2IMJ4W.mjs";
17
+ import {
18
+ healthCheck
19
+ } from "../chunk-LAZXX4HR.mjs";
20
+ import "../chunk-D5HQBNUB.mjs";
21
+ import {
22
+ DbError,
23
+ isDbError,
24
+ toDbError
25
+ } from "../chunk-NRUWQ5Z7.mjs";
26
+ import "../chunk-7P6ASYW6.mjs";
27
+ export {
28
+ DbError,
29
+ checkAdapterHealth,
30
+ createAdapter,
31
+ createAdapterFromEnv,
32
+ env,
33
+ getDialectTables,
34
+ healthCheck,
35
+ isDbError,
36
+ schema_exports as schema,
37
+ toDbError,
38
+ validateDatabaseEnv,
39
+ withDbErrors
40
+ };
@@ -0,0 +1,93 @@
1
+ import { DrizzleAdapter } from '@nextlyhq/adapter-drizzle';
2
+
3
+ /**
4
+ * Re-export the existing seeder logic from scripts
5
+ * This module provides a programmatic API for the seed script
6
+ */
7
+
8
+ /**
9
+ * Type for adapters that support getDrizzle() method
10
+ */
11
+ type AdapterWithDrizzle$2 = {
12
+ getDrizzle(schema?: Record<string, unknown>): unknown;
13
+ dialect: string;
14
+ };
15
+ interface SeederResult {
16
+ success: boolean;
17
+ created: number;
18
+ skipped: number;
19
+ errors: number;
20
+ total: number;
21
+ errorMessages?: string[];
22
+ }
23
+ /**
24
+ * Seed CRUD permissions for core resources
25
+ * This is the programmatic version of scripts/seed-permissions.ts
26
+ *
27
+ * @param adapter - Database adapter instance
28
+ * @param options - Optional configuration
29
+ * @returns Promise<SeederResult>
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * const result = await seedPermissions(adapter, { silent: true });
34
+ * if (result.success) {
35
+ * console.log(`Created ${result.created} permissions`);
36
+ * }
37
+ * ```
38
+ */
39
+ declare function seedPermissions(adapter: DrizzleAdapter | AdapterWithDrizzle$2, options?: {
40
+ resources?: readonly string[];
41
+ actions?: readonly string[];
42
+ silent?: boolean;
43
+ }): Promise<SeederResult>;
44
+
45
+ /**
46
+ * Type for adapters that support getDrizzle() method
47
+ */
48
+ type AdapterWithDrizzle$1 = {
49
+ getDrizzle(schema?: Record<string, unknown>): unknown;
50
+ dialect: string;
51
+ };
52
+ declare function seedSuperAdmin(adapter: DrizzleAdapter | AdapterWithDrizzle$1, options?: {
53
+ email?: string;
54
+ password?: string;
55
+ name?: string;
56
+ silent?: boolean;
57
+ }): Promise<SeederResult>;
58
+
59
+ /**
60
+ * Type for adapters that support getDrizzle() method
61
+ */
62
+ type AdapterWithDrizzle = {
63
+ getDrizzle(): unknown;
64
+ dialect: string;
65
+ };
66
+
67
+ /**
68
+ * Run the system bootstrap seeders: permissions and (optionally) the
69
+ * discovers or runs a user-provided `nextly.seed.ts` — that path is
70
+ * now Payload-style: the project ships its own seed function under
71
+ * `src/endpoints/seed/index.ts` and an auth-gated POST route at
72
+ * `src/app/admin/api/seed/route.ts` invokes it. End users trigger
73
+ * the seed via the admin UI, not via boot-time magic. See
74
+ * tasks/nextly-dev-tasks/24-payload-alignment-and-fixes.md phase 3.
75
+ *
76
+ * @param adapter - Database adapter instance
77
+ * @param options - Optional configuration
78
+ * @returns Combined SeederResult
79
+ */
80
+ declare function seedAll(adapter: DrizzleAdapter | AdapterWithDrizzle, options?: {
81
+ silent?: boolean;
82
+ /** Super admin email (default: admin@example.com) */
83
+ superAdminEmail?: string;
84
+ /** Super admin password (default: Admin@123456) */
85
+ superAdminPassword?: string;
86
+ /** Super admin name (default: Super Admin) */
87
+ superAdminName?: string;
88
+ /** Skip super admin seeding (default: false) */
89
+ skipSuperAdmin?: boolean;
90
+ }): Promise<SeederResult>;
91
+
92
+ export { seedAll, seedPermissions, seedSuperAdmin };
93
+ export type { SeederResult };
@@ -0,0 +1,47 @@
1
+ import {
2
+ seedAll
3
+ } from "../../chunk-B2GV2BWH.mjs";
4
+ import {
5
+ seedPermissions
6
+ } from "../../chunk-UOP63Q54.mjs";
7
+ import {
8
+ seedSuperAdmin
9
+ } from "../../chunk-PKMABBB5.mjs";
10
+ import "../../chunk-NSEFNNU4.mjs";
11
+ import "../../chunk-3FA7FKAV.mjs";
12
+ import "../../chunk-AGJ6F2T3.mjs";
13
+ import "../../chunk-KIMNCZGV.mjs";
14
+ import "../../chunk-AK6Z23OX.mjs";
15
+ import "../../chunk-INV7QKLG.mjs";
16
+ import "../../chunk-GZ6DCQKC.mjs";
17
+ import "../../chunk-SBACDPNX.mjs";
18
+ import "../../chunk-RJLLGGPG.mjs";
19
+ import "../../chunk-V4EQTOA4.mjs";
20
+ import "../../chunk-I4JMR3UR.mjs";
21
+ import "../../chunk-XZKLBMN6.mjs";
22
+ import "../../chunk-IZWPRDC3.mjs";
23
+ import "../../chunk-DNNG377Z.mjs";
24
+ import "../../chunk-5HMZ644B.mjs";
25
+ import "../../chunk-W5KKPZT5.mjs";
26
+ import "../../chunk-56WO4WX7.mjs";
27
+ import "../../chunk-2W3DVD7S.mjs";
28
+ import "../../chunk-TS7GHTG2.mjs";
29
+ import "../../chunk-H26B4FYG.mjs";
30
+ import "../../chunk-DP3G27G5.mjs";
31
+ import "../../chunk-DV6WVX2Q.mjs";
32
+ import "../../chunk-UJ2IMJ4W.mjs";
33
+ import "../../chunk-EGXBZCGC.mjs";
34
+ import "../../chunk-G2AA4QLC.mjs";
35
+ import "../../chunk-4MJLT6PZ.mjs";
36
+ import "../../chunk-IUDOC7N7.mjs";
37
+ import "../../chunk-LAZXX4HR.mjs";
38
+ import "../../chunk-D5HQBNUB.mjs";
39
+ import "../../chunk-NRUWQ5Z7.mjs";
40
+ import "../../chunk-VTJADRO3.mjs";
41
+ import "../../chunk-5APFUGAD.mjs";
42
+ import "../../chunk-7P6ASYW6.mjs";
43
+ export {
44
+ seedAll,
45
+ seedPermissions,
46
+ seedSuperAdmin
47
+ };
@@ -0,0 +1,117 @@
1
+ import {
2
+ serializeCollection
3
+ } from "./chunk-6NFHQIJD.mjs";
4
+ import {
5
+ createAdapter,
6
+ validateDatabaseEnv
7
+ } from "./chunk-M52VMPGA.mjs";
8
+ import {
9
+ loadConfig
10
+ } from "./chunk-ZE6A3FYH.mjs";
11
+ import "./chunk-GDBJ5JCU.mjs";
12
+ import "./chunk-FQULBZ53.mjs";
13
+ import {
14
+ CollectionRegistryService
15
+ } from "./chunk-3FA7FKAV.mjs";
16
+ import "./chunk-5HMZ644B.mjs";
17
+ import "./chunk-2W3DVD7S.mjs";
18
+ import "./chunk-TS7GHTG2.mjs";
19
+ import "./chunk-H26B4FYG.mjs";
20
+ import "./chunk-DP3G27G5.mjs";
21
+ import "./chunk-DV6WVX2Q.mjs";
22
+ import "./chunk-UJ2IMJ4W.mjs";
23
+ import "./chunk-4MJLT6PZ.mjs";
24
+ import "./chunk-LAZXX4HR.mjs";
25
+ import "./chunk-D5HQBNUB.mjs";
26
+ import "./chunk-NRUWQ5Z7.mjs";
27
+ import "./chunk-7P6ASYW6.mjs";
28
+
29
+ // src/cli/commands/db-sync-demote.ts
30
+ import { createHash } from "crypto";
31
+ import * as p from "@clack/prompts";
32
+ async function loadNextlyConfig(cwd) {
33
+ return loadConfig({ cwd });
34
+ }
35
+ async function runDemote(slug, context) {
36
+ const { logger } = context;
37
+ let config;
38
+ try {
39
+ const result = await loadNextlyConfig(context.cwd);
40
+ config = result.config;
41
+ } catch (err) {
42
+ logger.error(
43
+ `Could not load nextly config: ${err instanceof Error ? err.message : String(err)}`
44
+ );
45
+ process.exit(1);
46
+ }
47
+ const collections = config.collections ?? [];
48
+ const collection = collections.find((c) => c.slug === slug);
49
+ if (!collection) {
50
+ logger.error(
51
+ `Collection '${slug}' not found in nextly.config.ts collections.`
52
+ );
53
+ process.exit(1);
54
+ }
55
+ const env = validateDatabaseEnv();
56
+ if (!env.valid) {
57
+ logger.error(env.errors.join("; "));
58
+ process.exit(1);
59
+ }
60
+ const adapter = await createAdapter({ logger });
61
+ const registry = new CollectionRegistryService(
62
+ adapter,
63
+ {
64
+ info: (msg) => logger.debug(msg),
65
+ warn: (msg) => logger.warn(msg),
66
+ error: (msg) => logger.error(msg),
67
+ debug: (msg) => logger.debug(msg)
68
+ }
69
+ );
70
+ const fields = collection.fields ?? [];
71
+ p.note(
72
+ serializeCollection({ slug, fields }),
73
+ `About to move '${slug}' to UI source`
74
+ );
75
+ const confirm2 = await p.confirm({
76
+ message: "Write to dynamic_collections so the Schema Builder can edit it?"
77
+ });
78
+ if (p.isCancel(confirm2) || !confirm2) {
79
+ logger.info("Demote cancelled.");
80
+ return;
81
+ }
82
+ const existing = await registry.getCollectionBySlug(slug);
83
+ if (existing) {
84
+ await registry.updateCollection(slug, {
85
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
86
+ fields,
87
+ source: "ui"
88
+ });
89
+ logger.info(`Updated existing UI record for '${slug}'.`);
90
+ } else {
91
+ const tableName = collection.dbName ?? `dc_${slug}`;
92
+ const fieldsJson = JSON.stringify(fields);
93
+ const schemaHash = createHash("sha256").update(fieldsJson).digest("hex");
94
+ await registry.registerCollection({
95
+ slug,
96
+ labels: {
97
+ singular: collection.labels?.singular ?? collection.label ?? slug,
98
+ plural: collection.labels?.plural ?? slug
99
+ },
100
+ tableName,
101
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
102
+ fields,
103
+ source: "ui",
104
+ schemaHash,
105
+ ...collection.description !== void 0 && {
106
+ description: collection.description
107
+ },
108
+ configPath: "demoted-from-code"
109
+ });
110
+ }
111
+ logger.info(
112
+ `Collection '${slug}' written to UI source. Remove its entry from your nextly.config.ts collections array, then restart dev server.`
113
+ );
114
+ }
115
+ export {
116
+ runDemote
117
+ };
@@ -0,0 +1,113 @@
1
+ import {
2
+ serializeCollection
3
+ } from "./chunk-6NFHQIJD.mjs";
4
+ import {
5
+ createAdapter,
6
+ validateDatabaseEnv
7
+ } from "./chunk-M52VMPGA.mjs";
8
+ import {
9
+ CollectionRegistryService
10
+ } from "./chunk-3FA7FKAV.mjs";
11
+ import "./chunk-5HMZ644B.mjs";
12
+ import "./chunk-2W3DVD7S.mjs";
13
+ import "./chunk-TS7GHTG2.mjs";
14
+ import "./chunk-H26B4FYG.mjs";
15
+ import "./chunk-DP3G27G5.mjs";
16
+ import "./chunk-DV6WVX2Q.mjs";
17
+ import "./chunk-UJ2IMJ4W.mjs";
18
+ import "./chunk-4MJLT6PZ.mjs";
19
+ import "./chunk-LAZXX4HR.mjs";
20
+ import "./chunk-D5HQBNUB.mjs";
21
+ import "./chunk-NRUWQ5Z7.mjs";
22
+ import "./chunk-7P6ASYW6.mjs";
23
+
24
+ // src/cli/commands/db-sync-promote.ts
25
+ import { appendFileSync, existsSync } from "fs";
26
+ import * as p from "@clack/prompts";
27
+ async function runPromote(slug, context) {
28
+ const { logger } = context;
29
+ const env = validateDatabaseEnv();
30
+ if (!env.valid) {
31
+ logger.error(env.errors.join("; "));
32
+ process.exit(1);
33
+ }
34
+ const adapter = await createAdapter({ logger });
35
+ const registry = new CollectionRegistryService(
36
+ adapter,
37
+ {
38
+ info: (msg) => logger.debug(msg),
39
+ warn: (msg) => logger.warn(msg),
40
+ error: (msg) => logger.error(msg),
41
+ debug: (msg) => logger.debug(msg)
42
+ }
43
+ );
44
+ const record = await registry.getCollectionBySlug(slug);
45
+ if (!record) {
46
+ logger.error(
47
+ `Collection '${slug}' not found in UI source (dynamic_collections).`
48
+ );
49
+ process.exit(1);
50
+ }
51
+ const fields = record.fields ?? [];
52
+ const code = serializeCollection({ slug, fields });
53
+ const action = await p.select({
54
+ message: `Preview generated code for '${slug}'. Action?`,
55
+ options: [
56
+ { value: "preview", label: "Show preview" },
57
+ { value: "accept", label: "Append to nextly.config.ts" },
58
+ { value: "decline", label: "Cancel" }
59
+ ]
60
+ });
61
+ if (p.isCancel(action) || action === "decline") {
62
+ logger.info("Promote cancelled.");
63
+ return;
64
+ }
65
+ if (action === "preview") {
66
+ p.note(code, "Generated code");
67
+ const confirm2 = await p.confirm({
68
+ message: "Append this to nextly.config.ts and delete the UI record?"
69
+ });
70
+ if (p.isCancel(confirm2) || !confirm2) {
71
+ logger.info("Promote cancelled.");
72
+ return;
73
+ }
74
+ }
75
+ const configPath = findConfigFile(context.cwd);
76
+ if (!configPath) {
77
+ logger.warn(
78
+ "Could not locate nextly.config.ts. The snippet is printed below; paste it into the collections array manually."
79
+ );
80
+ logger.info(code);
81
+ } else {
82
+ const snippet = [
83
+ "",
84
+ `// Promoted from UI source on ${(/* @__PURE__ */ new Date()).toISOString()}.`,
85
+ "// Move this entry into your collections array:",
86
+ ...code.split("\n").map((line) => `// ${line}`),
87
+ ""
88
+ ].join("\n");
89
+ appendFileSync(configPath, snippet);
90
+ logger.info(`Appended commented snippet to ${configPath}.`);
91
+ }
92
+ await registry.deleteCollection(slug);
93
+ logger.info(
94
+ `Collection '${slug}' removed from UI source. Move the snippet into your collections array, then restart dev server.`
95
+ );
96
+ }
97
+ function findConfigFile(cwd) {
98
+ const candidates = [
99
+ "nextly.config.ts",
100
+ "nextly.config.js",
101
+ "nextly.config.mjs",
102
+ "src/nextly.config.ts",
103
+ "src/nextly.config.js"
104
+ ];
105
+ for (const candidate of candidates) {
106
+ const full = `${cwd}/${candidate}`;
107
+ if (existsSync(full)) return full;
108
+ }
109
+ return null;
110
+ }
111
+ export {
112
+ runPromote
113
+ };
@@ -0,0 +1,25 @@
1
+ import "./chunk-7P6ASYW6.mjs";
2
+
3
+ // src/runtime/dev-reload-broadcaster.ts
4
+ var g = globalThis;
5
+ function ctls() {
6
+ if (!g.__nextly_sseCtrl) g.__nextly_sseCtrl = /* @__PURE__ */ new Set();
7
+ return g.__nextly_sseCtrl;
8
+ }
9
+ function subscribeDevReload(ctrl) {
10
+ ctls().add(ctrl);
11
+ return () => ctls().delete(ctrl);
12
+ }
13
+ function broadcastDevReload() {
14
+ for (const ctrl of ctls()) {
15
+ try {
16
+ ctrl.enqueue("event: schema-reload\ndata: {}\n\n");
17
+ } catch {
18
+ ctls().delete(ctrl);
19
+ }
20
+ }
21
+ }
22
+ export {
23
+ broadcastDevReload,
24
+ subscribeDevReload
25
+ };
@@ -0,0 +1,19 @@
1
+ import {
2
+ capture,
3
+ classifyError,
4
+ getStatus,
5
+ init,
6
+ resetConsent,
7
+ setEnabled,
8
+ shutdown
9
+ } from "./chunk-6JNEPWRW.mjs";
10
+ import "./chunk-7P6ASYW6.mjs";
11
+ export {
12
+ capture,
13
+ classifyError,
14
+ getStatus,
15
+ init,
16
+ resetConsent,
17
+ setEnabled,
18
+ shutdown
19
+ };
@@ -0,0 +1,13 @@
1
+ import {
2
+ getDrizzleKitForDialect,
3
+ getMySQLDrizzleKit,
4
+ getPgDrizzleKit,
5
+ getSQLiteDrizzleKit
6
+ } from "./chunk-3NZ2KMBL.mjs";
7
+ import "./chunk-7P6ASYW6.mjs";
8
+ export {
9
+ getDrizzleKitForDialect,
10
+ getMySQLDrizzleKit,
11
+ getPgDrizzleKit,
12
+ getSQLiteDrizzleKit
13
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ DynamicCollectionSchemaService
3
+ } from "./chunk-XZKLBMN6.mjs";
4
+ import "./chunk-UJ2IMJ4W.mjs";
5
+ import "./chunk-7P6ASYW6.mjs";
6
+ export {
7
+ DynamicCollectionSchemaService
8
+ };
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Canonical NextlyError codes and their HTTP status mappings.
3
+ *
4
+ * Plugin codes outside this enum must always pass an explicit `statusCode`
5
+ * to the NextlyError constructor (no enum lookup happens for unknown codes).
6
+ */
7
+ declare const NEXTLY_ERROR_STATUS: {
8
+ readonly VALIDATION_ERROR: 400;
9
+ readonly INVALID_INPUT: 400;
10
+ readonly AUTH_REQUIRED: 401;
11
+ readonly AUTH_INVALID_CREDENTIALS: 401;
12
+ readonly TOKEN_EXPIRED: 401;
13
+ readonly FORBIDDEN: 403;
14
+ readonly NOT_FOUND: 404;
15
+ readonly CONFLICT: 409;
16
+ readonly DUPLICATE: 409;
17
+ readonly RATE_LIMITED: 429;
18
+ readonly PAYLOAD_TOO_LARGE: 413;
19
+ readonly UNSUPPORTED_MEDIA_TYPE: 415;
20
+ readonly INTERNAL_ERROR: 500;
21
+ readonly DATABASE_ERROR: 500;
22
+ readonly EXTERNAL_SERVICE_ERROR: 502;
23
+ readonly SERVICE_UNAVAILABLE: 503;
24
+ };
25
+ type NextlyErrorCode = keyof typeof NEXTLY_ERROR_STATUS;
26
+
27
+ /**
28
+ * Structured public payloads attached to NextlyError instances.
29
+ *
30
+ * `publicData` lives in HTTP response bodies and Server Action results.
31
+ * It is safe by construction — never contains rejected values, identifiers
32
+ * the caller didn't already provide, or operator-only context.
33
+ */
34
+ type ValidationPublicData = {
35
+ errors: Array<{
36
+ /** Dotted/bracketed path: "user.email", "items[2].quantity" */
37
+ path: string;
38
+ /** Stable machine code: "INVALID_FORMAT" | "REQUIRED" | "TOO_LOW" | ... */
39
+ code: string;
40
+ /** Complete sentence, ends with a period: "Must be a valid email address." */
41
+ message: string;
42
+ }>;
43
+ };
44
+ type RateLimitPublicData = {
45
+ retryAfterSeconds?: number;
46
+ };
47
+ type PublicData = ValidationPublicData | RateLimitPublicData | undefined;
48
+
49
+ /**
50
+ * Code accepted by NextlyError: canonical codes get autocomplete, but plugin
51
+ * authors may use any UPPER_SNAKE string. The `(string & {})` trick preserves
52
+ * the literal union for IntelliSense without collapsing to plain `string`.
53
+ */
54
+ type NextlyErrorCodeLike = NextlyErrorCode | (string & {});
55
+ type NextlyErrorOpts = {
56
+ code: NextlyErrorCodeLike;
57
+ publicMessage: string;
58
+ publicData?: PublicData;
59
+ messageKey?: string;
60
+ logMessage?: string;
61
+ logContext?: Record<string, unknown>;
62
+ statusCode?: number;
63
+ cause?: Error;
64
+ };
65
+ type NextlyErrorResponseJSON = {
66
+ code: string;
67
+ message: string;
68
+ messageKey?: string;
69
+ data?: PublicData;
70
+ requestId: string;
71
+ };
72
+ /**
73
+ * Unified error class for Nextly. Used at every throw site across services,
74
+ * direct API, auth, and plugins. Carries two distinct payloads:
75
+ *
76
+ * - Public (`code`, `publicMessage`, `publicData`, `statusCode`, `messageKey`)
77
+ * sent in HTTP responses and Server Action results.
78
+ * - Log (`logMessage`, `logContext`, `cause`, stack trace)
79
+ * written to the server logger; never serialised to the wire.
80
+ *
81
+ * Use the static factories (notFound, forbidden, validation, ...) for the
82
+ * common cases. Use the free-form constructor for plugin codes or one-off
83
+ * shapes.
84
+ */
85
+ declare class NextlyError extends Error {
86
+ readonly code: NextlyErrorCodeLike;
87
+ readonly statusCode: number;
88
+ readonly publicMessage: string;
89
+ readonly publicData?: PublicData;
90
+ readonly messageKey?: string;
91
+ readonly logMessage?: string;
92
+ readonly logContext?: Record<string, unknown>;
93
+ readonly cause?: Error;
94
+ readonly timestamp: Date;
95
+ constructor(opts: NextlyErrorOpts);
96
+ private static resolveStatusCode;
97
+ /** HTTP-safe JSON. Strips logMessage / logContext / cause / stack. */
98
+ toResponseJSON(requestId: string): NextlyErrorResponseJSON;
99
+ /** Operator-facing JSON for log lines. Includes everything. */
100
+ toLogJSON(requestId: string): Record<string, unknown>;
101
+ static invalidCredentials(opts?: {
102
+ logContext?: Record<string, unknown>;
103
+ }): NextlyError;
104
+ static authRequired(opts?: {
105
+ logContext?: Record<string, unknown>;
106
+ }): NextlyError;
107
+ static notFound(opts?: {
108
+ logContext?: Record<string, unknown>;
109
+ }): NextlyError;
110
+ static forbidden(opts?: {
111
+ logContext?: Record<string, unknown>;
112
+ }): NextlyError;
113
+ static validation(opts: {
114
+ errors: ValidationPublicData["errors"];
115
+ logContext?: Record<string, unknown>;
116
+ }): NextlyError;
117
+ static conflict(opts?: {
118
+ reason?: "version" | "state";
119
+ logContext?: Record<string, unknown>;
120
+ }): NextlyError;
121
+ static duplicate(opts?: {
122
+ logContext?: Record<string, unknown>;
123
+ }): NextlyError;
124
+ static rateLimited(opts?: {
125
+ retryAfterSeconds?: number;
126
+ logContext?: Record<string, unknown>;
127
+ }): NextlyError;
128
+ static internal(opts?: {
129
+ cause?: Error;
130
+ logContext?: Record<string, unknown>;
131
+ }): NextlyError;
132
+ static serviceUnavailable(opts?: {
133
+ logMessage?: string;
134
+ cause?: Error;
135
+ logContext?: Record<string, unknown>;
136
+ }): NextlyError;
137
+ /**
138
+ * Convert a DbError (or arbitrary unknown thrown by the DB layer) to a
139
+ * NextlyError with a generic public message and rich logContext. Used by
140
+ * `withDbErrors` for auto-conversion (Pattern A) and by services that
141
+ * catch DB errors at boundaries (Pattern B). Spec §8.2 mapping table.
142
+ *
143
+ * Never leaks DB driver text, constraint names, or table names into
144
+ * `publicMessage`. All DB context goes into `logContext`. The original
145
+ * DbError is preserved as `cause`.
146
+ */
147
+ static fromDatabaseError(error: unknown): NextlyError;
148
+ static is(err: unknown): err is NextlyError;
149
+ static isCode(err: unknown, code: NextlyErrorCodeLike): err is NextlyError;
150
+ static isNotFound(err: unknown): err is NextlyError;
151
+ static isValidation(err: unknown): err is NextlyError;
152
+ static isAuthRequired(err: unknown): err is NextlyError;
153
+ static isForbidden(err: unknown): err is NextlyError;
154
+ static isConflict(err: unknown): err is NextlyError;
155
+ static isRateLimited(err: unknown): err is NextlyError;
156
+ }
157
+
158
+ export { NEXTLY_ERROR_STATUS, NextlyError };
159
+ export type { NextlyErrorCode, NextlyErrorResponseJSON, PublicData, RateLimitPublicData, ValidationPublicData };
@@ -0,0 +1,10 @@
1
+ import "../chunk-4MJLT6PZ.mjs";
2
+ import {
3
+ NEXTLY_ERROR_STATUS,
4
+ NextlyError
5
+ } from "../chunk-NRUWQ5Z7.mjs";
6
+ import "../chunk-7P6ASYW6.mjs";
7
+ export {
8
+ NEXTLY_ERROR_STATUS,
9
+ NextlyError
10
+ };
@@ -0,0 +1,15 @@
1
+ import {
2
+ checkAdapterHealth,
3
+ createAdapter,
4
+ createAdapterFromEnv,
5
+ validateDatabaseEnv
6
+ } from "./chunk-DP3G27G5.mjs";
7
+ import "./chunk-DV6WVX2Q.mjs";
8
+ import "./chunk-UJ2IMJ4W.mjs";
9
+ import "./chunk-7P6ASYW6.mjs";
10
+ export {
11
+ checkAdapterHealth,
12
+ createAdapter,
13
+ createAdapterFromEnv,
14
+ validateDatabaseEnv
15
+ };