nextly 0.0.2-alpha.7 → 0.0.2-alpha.9

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 (106) hide show
  1. package/dist/_dts-chunks/{collections-handler.d-DAGa4oyr.d.ts → collections-handler.d-B3iNFGJv.d.ts} +4 -2
  2. package/dist/_dts-chunks/{config.d-gCEU-kSb.d.ts → config.d-D8eInFE5.d.ts} +1 -1
  3. package/dist/_dts-chunks/{define-component.d-B5ffJpKw.d.ts → define-component.d-COeEsUOT.d.ts} +2 -2
  4. package/dist/_dts-chunks/{index.d-CknEcQSu.d.ts → index.d-qjDq8N63.d.ts} +5 -5
  5. package/dist/actions/index.mjs +16 -16
  6. package/dist/api/auth-state.mjs +23 -23
  7. package/dist/api/collections-schema-detail.mjs +23 -23
  8. package/dist/api/collections-schema-export.mjs +23 -23
  9. package/dist/api/collections-schema.mjs +24 -24
  10. package/dist/api/components-detail.mjs +24 -24
  11. package/dist/api/components.mjs +24 -24
  12. package/dist/api/email-providers-default.mjs +24 -24
  13. package/dist/api/email-providers-detail.mjs +25 -25
  14. package/dist/api/email-providers-test.mjs +25 -25
  15. package/dist/api/email-providers.mjs +26 -26
  16. package/dist/api/email-send-template.mjs +26 -26
  17. package/dist/api/email-send.mjs +26 -26
  18. package/dist/api/email-templates-detail.mjs +25 -25
  19. package/dist/api/email-templates-layout.mjs +25 -25
  20. package/dist/api/email-templates-preview.mjs +26 -26
  21. package/dist/api/email-templates.mjs +26 -26
  22. package/dist/api/health.mjs +2 -2
  23. package/dist/api/index.mjs +2 -2
  24. package/dist/api/media-bulk.mjs +20 -20
  25. package/dist/api/media-folders.mjs +24 -24
  26. package/dist/api/media-handlers.d.ts +2 -2
  27. package/dist/api/media-handlers.mjs +25 -25
  28. package/dist/api/media.mjs +25 -25
  29. package/dist/api/singles-detail.mjs +25 -25
  30. package/dist/api/singles-schema-detail.mjs +24 -24
  31. package/dist/api/singles.mjs +23 -23
  32. package/dist/api/storage-upload-url.mjs +24 -24
  33. package/dist/api/uploads.mjs +29 -28
  34. package/dist/auth/index.mjs +7 -7
  35. package/dist/{boot-apply-5EFSWAMW.mjs → boot-apply-TDOMT356.mjs} +1 -1
  36. package/dist/{chunk-UB4CALU5.mjs → chunk-2QSGNGOB.mjs} +1 -1
  37. package/dist/{chunk-DP3G27G5.mjs → chunk-35LAHTCU.mjs} +12 -2
  38. package/dist/{chunk-L5FA2FAY.mjs → chunk-463A2UDH.mjs} +6 -3
  39. package/dist/{chunk-JXZITQPZ.mjs → chunk-4HUQNXVM.mjs} +1 -1
  40. package/dist/{chunk-CLBPXLO3.mjs → chunk-4LLOFW52.mjs} +27 -23
  41. package/dist/{chunk-NRUWQ5Z7.mjs → chunk-5WWWJCKI.mjs} +3 -5
  42. package/dist/{chunk-HVH4J6S6.mjs → chunk-7MA6UATK.mjs} +27 -25
  43. package/dist/{chunk-LP2CDTCR.mjs → chunk-A75OLKXP.mjs} +1 -1
  44. package/dist/{chunk-L3SZUFF4.mjs → chunk-AKK5Q5SX.mjs} +1 -1
  45. package/dist/{chunk-3NUAFSDX.mjs → chunk-DWV7GUKQ.mjs} +1 -1
  46. package/dist/{chunk-D72XH3BG.mjs → chunk-ERJGWWPB.mjs} +2 -2
  47. package/dist/{chunk-SSRCS4NR.mjs → chunk-FI2Z2B2J.mjs} +5 -5
  48. package/dist/{chunk-EBDAFQUX.mjs → chunk-GJIHOHY5.mjs} +2 -2
  49. package/dist/{chunk-RKXTA5KC.mjs → chunk-HLTSQIP6.mjs} +79 -50
  50. package/dist/{chunk-UJ2IMJ4W.mjs → chunk-HREB7UR4.mjs} +10 -4
  51. package/dist/{chunk-66ZNVKTF.mjs → chunk-HSIAXEYF.mjs} +274 -45
  52. package/dist/{chunk-QOH5I67F.mjs → chunk-JAOH2TTZ.mjs} +3 -3
  53. package/dist/{chunk-J4KHGYOM.mjs → chunk-JCQMC6HH.mjs} +69 -2
  54. package/dist/{chunk-LPVOTXNV.mjs → chunk-KLICUQPV.mjs} +1 -1
  55. package/dist/{chunk-ZVN3JILF.mjs → chunk-KPCSDPFQ.mjs} +103 -21
  56. package/dist/{chunk-M52VMPGA.mjs → chunk-KZFYCMBL.mjs} +1 -1
  57. package/dist/{chunk-FQH647CT.mjs → chunk-NJ3LXLSJ.mjs} +53 -4
  58. package/dist/{chunk-MWW7OUDL.mjs → chunk-OVQCDNU3.mjs} +23 -43
  59. package/dist/{chunk-INV7QKLG.mjs → chunk-PAWMG5BR.mjs} +1 -1
  60. package/dist/{chunk-2W3DVD7S.mjs → chunk-PFRMIEJ3.mjs} +1 -1
  61. package/dist/{chunk-WZBYMYVW.mjs → chunk-QPYR3TC4.mjs} +1 -1
  62. package/dist/{chunk-NAP3TDS6.mjs → chunk-SWVNFKWD.mjs} +2 -2
  63. package/dist/{chunk-KSKKIZDP.mjs → chunk-TFCPZ7PG.mjs} +4 -4
  64. package/dist/{chunk-JWAH6ROD.mjs → chunk-TVG3WU6C.mjs} +1 -1
  65. package/dist/{chunk-7YKKCBOC.mjs → chunk-V2W7G5GC.mjs} +3 -3
  66. package/dist/{chunk-RNKZALZE.mjs → chunk-VH4BX2QH.mjs} +5 -5
  67. package/dist/{chunk-TK76W55J.mjs → chunk-X3OHQBMZ.mjs} +6 -2
  68. package/dist/{chunk-TO5AFLVQ.mjs → chunk-XIKEJO27.mjs} +1 -1
  69. package/dist/{chunk-ZE6A3FYH.mjs → chunk-YG2HSZC4.mjs} +1 -1
  70. package/dist/{chunk-VQJQHVEV.mjs → chunk-YLRZTPSK.mjs} +1 -1
  71. package/dist/{chunk-TS7GHTG2.mjs → chunk-YXZH65YV.mjs} +2 -2
  72. package/dist/{chunk-GJNSJU4S.mjs → chunk-Z52OQOZH.mjs} +1 -1
  73. package/dist/cli/nextly.mjs +1 -1
  74. package/dist/cli/utils/index.d.ts +2 -2
  75. package/dist/cli/utils/index.mjs +3 -3
  76. package/dist/{component-schema-service-JOQIBQGK.mjs → component-schema-service-HUAQQ4H5.mjs} +2 -2
  77. package/dist/{config-loader-23YEMC3Z.mjs → config-loader-MUFY6UMU.mjs} +2 -2
  78. package/dist/config.d.ts +3 -3
  79. package/dist/database/index.d.ts +2 -2
  80. package/dist/database/index.mjs +4 -4
  81. package/dist/database/seeders/index.mjs +19 -19
  82. package/dist/{db-sync-demote-Z2HOXRZN.mjs → db-sync-demote-2DAQZXLD.mjs} +8 -8
  83. package/dist/{db-sync-promote-FKWZSRYC.mjs → db-sync-promote-SBTPSUEJ.mjs} +7 -7
  84. package/dist/{dynamic-collection-schema-service-KMOP5PGD.mjs → dynamic-collection-schema-service-FIRWOXZI.mjs} +2 -2
  85. package/dist/errors/index.d.ts +2 -0
  86. package/dist/errors/index.mjs +1 -1
  87. package/dist/{factory-IWMBKUJM.mjs → factory-UGJGOZZ7.mjs} +2 -2
  88. package/dist/index.d.ts +16 -11
  89. package/dist/index.mjs +25 -56
  90. package/dist/observability/index.mjs +1 -1
  91. package/dist/{permissions-YZSSFHU4.mjs → permissions-YEODB733.mjs} +17 -17
  92. package/dist/{pipeline-2DWG7LSN.mjs → pipeline-URL33V42.mjs} +11 -11
  93. package/dist/{preview-H6CJBMCP.mjs → preview-3RSMZITY.mjs} +3 -3
  94. package/dist/{program-CEFDADQM.mjs → program-TOV63II7.mjs} +29 -29
  95. package/dist/{register-G6I4N6QM.mjs → register-O2CJDFCK.mjs} +18 -18
  96. package/dist/reload-config-5P3IUF6O.mjs +23 -0
  97. package/dist/{routeHandler-ROBRMRZA.mjs → routeHandler-P2KXM7MH.mjs} +30 -30
  98. package/dist/{runtime-schema-generator-MOPQWGJP.mjs → runtime-schema-generator-NQOLDUDG.mjs} +2 -2
  99. package/dist/runtime.d.ts +2 -2
  100. package/dist/runtime.mjs +30 -30
  101. package/dist/{super-admin-WSTXAZSS.mjs → super-admin-6LWRM36J.mjs} +17 -17
  102. package/dist/{system-table-service-WGSRVEGT.mjs → system-table-service-FIX3AVKW.mjs} +6 -6
  103. package/dist/{users-NFD7IUFT.mjs → users-Q773BQCU.mjs} +16 -16
  104. package/package.json +8 -8
  105. package/dist/reload-config-VUEIQP5W.mjs +0 -23
  106. /package/dist/{first-run-QIVKWJIF.mjs → first-run-2JTNWFEG.mjs} +0 -0
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  routeAuthRequest
3
- } from "./chunk-TK76W55J.mjs";
3
+ } from "./chunk-X3OHQBMZ.mjs";
4
4
  import {
5
5
  POST
6
- } from "./chunk-SSRCS4NR.mjs";
6
+ } from "./chunk-FI2Z2B2J.mjs";
7
7
  import {
8
8
  readJsonBody
9
- } from "./chunk-VQJQHVEV.mjs";
9
+ } from "./chunk-YLRZTPSK.mjs";
10
10
  import {
11
11
  POST as POST2
12
- } from "./chunk-RNKZALZE.mjs";
12
+ } from "./chunk-VH4BX2QH.mjs";
13
13
  import {
14
14
  createJsonErrorResponse,
15
15
  isErrorResponse,
@@ -18,10 +18,10 @@ import {
18
18
  requireCollectionAccess,
19
19
  requirePermission,
20
20
  toNextlyAuthError
21
- } from "./chunk-7YKKCBOC.mjs";
21
+ } from "./chunk-V2W7G5GC.mjs";
22
22
  import {
23
23
  nextlyValidationFromZod
24
- } from "./chunk-GJNSJU4S.mjs";
24
+ } from "./chunk-Z52OQOZH.mjs";
25
25
  import {
26
26
  getForegroundForBackground,
27
27
  hexToHslTriplet,
@@ -41,16 +41,16 @@ import {
41
41
  } from "./chunk-APKKRD2G.mjs";
42
42
  import {
43
43
  withErrorHandler
44
- } from "./chunk-TO5AFLVQ.mjs";
44
+ } from "./chunk-XIKEJO27.mjs";
45
45
  import {
46
46
  ensureHmrListener,
47
47
  getCachedNextly
48
- } from "./chunk-RKXTA5KC.mjs";
48
+ } from "./chunk-HLTSQIP6.mjs";
49
49
  import {
50
50
  getService,
51
51
  isServicesRegistered,
52
52
  registerServices
53
- } from "./chunk-HVH4J6S6.mjs";
53
+ } from "./chunk-7MA6UATK.mjs";
54
54
  import {
55
55
  readOrGenerateRequestId
56
56
  } from "./chunk-67GXH6PR.mjs";
@@ -61,20 +61,20 @@ import {
61
61
  ImageSizeService,
62
62
  ServiceDispatcher,
63
63
  parseWhereQuery
64
- } from "./chunk-ZVN3JILF.mjs";
64
+ } from "./chunk-KPCSDPFQ.mjs";
65
65
  import {
66
66
  containsSuperAdminRole,
67
67
  hasSuperAdminExcluding,
68
68
  isSuperAdmin,
69
69
  listEffectivePermissions
70
- } from "./chunk-NAP3TDS6.mjs";
70
+ } from "./chunk-SWVNFKWD.mjs";
71
71
  import {
72
72
  BaseService,
73
73
  withTimezoneFormatting
74
- } from "./chunk-2W3DVD7S.mjs";
74
+ } from "./chunk-PFRMIEJ3.mjs";
75
75
  import {
76
76
  getDialectTables
77
- } from "./chunk-TS7GHTG2.mjs";
77
+ } from "./chunk-YXZH65YV.mjs";
78
78
  import {
79
79
  nextlyMigrationJournalMysql,
80
80
  nextlyMigrationJournalPg,
@@ -82,7 +82,7 @@ import {
82
82
  } from "./chunk-H26B4FYG.mjs";
83
83
  import {
84
84
  env
85
- } from "./chunk-UJ2IMJ4W.mjs";
85
+ } from "./chunk-HREB7UR4.mjs";
86
86
  import {
87
87
  getImageProcessor,
88
88
  getMediaStorage
@@ -99,7 +99,7 @@ import {
99
99
  } from "./chunk-D5HQBNUB.mjs";
100
100
  import {
101
101
  NextlyError
102
- } from "./chunk-NRUWQ5Z7.mjs";
102
+ } from "./chunk-5WWWJCKI.mjs";
103
103
 
104
104
  // src/api/api-keys.ts
105
105
  import { z } from "zod";
@@ -2154,8 +2154,8 @@ function buildAuthRouterDeps(getService2) {
2154
2154
  }
2155
2155
  },
2156
2156
  createSuperAdmin: async (data) => {
2157
- const { seedPermissions } = await import("./permissions-YZSSFHU4.mjs");
2158
- const { seedSuperAdmin } = await import("./super-admin-WSTXAZSS.mjs");
2157
+ const { seedPermissions } = await import("./permissions-YEODB733.mjs");
2158
+ const { seedSuperAdmin } = await import("./super-admin-6LWRM36J.mjs");
2159
2159
  const adapter = getService2("adapter");
2160
2160
  await seedPermissions(adapter, { silent: true });
2161
2161
  const result = await seedSuperAdmin(adapter, {
@@ -2180,7 +2180,7 @@ function buildAuthRouterDeps(getService2) {
2180
2180
  };
2181
2181
  },
2182
2182
  seedPermissions: async () => {
2183
- const { seedPermissions } = await import("./permissions-YZSSFHU4.mjs");
2183
+ const { seedPermissions } = await import("./permissions-YEODB733.mjs");
2184
2184
  const adapter = getService2("adapter");
2185
2185
  await seedPermissions(adapter, { silent: true });
2186
2186
  },
@@ -2336,10 +2336,8 @@ async function ensureServicesInitialized() {
2336
2336
  if (nextlyConfig.users) serviceConfig.users = nextlyConfig.users;
2337
2337
  if (nextlyConfig.admin) serviceConfig.admin = nextlyConfig.admin;
2338
2338
  if (nextlyConfig.auth) serviceConfig.auth = nextlyConfig.auth;
2339
- if (nextlyConfig.security)
2340
- serviceConfig.security = nextlyConfig.security;
2341
- if (nextlyConfig.apiKeys)
2342
- serviceConfig.apiKeys = nextlyConfig.apiKeys;
2339
+ if (nextlyConfig.security) serviceConfig.security = nextlyConfig.security;
2340
+ if (nextlyConfig.apiKeys) serviceConfig.apiKeys = nextlyConfig.apiKeys;
2343
2341
  if (nextlyConfig.db) {
2344
2342
  const dbConfig = nextlyConfig.db;
2345
2343
  if (dbConfig.schemasDir) serviceConfig.schemasDir = dbConfig.schemasDir;
@@ -2347,6 +2345,12 @@ async function ensureServicesInitialized() {
2347
2345
  serviceConfig.migrationsDir = dbConfig.migrationsDir;
2348
2346
  }
2349
2347
  }
2348
+ if (process.env.NODE_ENV === "development" && // eslint-disable-next-line turbo/no-undeclared-env-vars
2349
+ process.env.NEXTLY_DISABLE_INSTRUMENTATION_WARNING !== "1") {
2350
+ console.warn(
2351
+ "[nextly] Cold-boot triggered by an incoming request \u2014 no instrumentation.ts detected. Each Next.js worker will now independently run schema introspection and permission seeding against your database, multiplying connection load. Add an `instrumentation.ts` at your project root (see https://nextly.dev/docs/getting-started/instrumentation) to fold this into a single worker-warmup. Suppress with NEXTLY_DISABLE_INSTRUMENTATION_WARNING=1."
2352
+ );
2353
+ }
2350
2354
  await registerServices(serviceConfig);
2351
2355
  try {
2352
2356
  const emailTemplateService = getService("emailTemplateService");
@@ -2392,7 +2396,7 @@ async function ensureServicesInitialized() {
2392
2396
  } else {
2393
2397
  console.log("[Auth Handler] Services auto-initialized with defaults");
2394
2398
  }
2395
- const { runBootTimeApplyIfDev } = await import("./boot-apply-5EFSWAMW.mjs");
2399
+ const { runBootTimeApplyIfDev } = await import("./boot-apply-TDOMT356.mjs");
2396
2400
  await runBootTimeApplyIfDev({ caller: "auth-handler" });
2397
2401
  ensureHmrListener();
2398
2402
  }
@@ -186,9 +186,7 @@ var DB_ERROR_MAPPING = {
186
186
  publicMessage: "An unexpected error occurred."
187
187
  }
188
188
  };
189
- var NEXTLY_ERROR_BRAND = Symbol.for(
190
- "nextly/NextlyError"
191
- );
189
+ var NEXTLY_ERROR_BRAND = Symbol.for("nextly/NextlyError");
192
190
  function hasBrand(value) {
193
191
  if (value === null || typeof value !== "object" && typeof value !== "function") {
194
192
  return false;
@@ -265,8 +263,8 @@ var NextlyError = class _NextlyError extends Error {
265
263
  // ────────────────────────────────────────────────────────────────────
266
264
  static invalidCredentials(opts) {
267
265
  return new _NextlyError({
268
- code: "AUTH_INVALID_CREDENTIALS",
269
- publicMessage: "Invalid email or password.",
266
+ code: opts?.code || "",
267
+ publicMessage: opts?.publicMessage || "",
270
268
  logMessage: "Login failed",
271
269
  logContext: opts?.logContext
272
270
  });
@@ -2,7 +2,7 @@ import {
2
2
  ComponentRegistryService,
3
3
  PermissionSeedService,
4
4
  SingleRegistryService
5
- } from "./chunk-KSKKIZDP.mjs";
5
+ } from "./chunk-TFCPZ7PG.mjs";
6
6
  import {
7
7
  AccessControlService,
8
8
  ApiKeyService,
@@ -26,27 +26,28 @@ import {
26
26
  UserService,
27
27
  buildContext,
28
28
  consoleLogger,
29
+ getBaseUrl,
29
30
  getHookRegistry,
30
31
  keysToCamelCase,
31
32
  keysToSnakeCase,
32
33
  resolveStatusFilter,
33
34
  sanitizeEntryData
34
- } from "./chunk-ZVN3JILF.mjs";
35
+ } from "./chunk-KPCSDPFQ.mjs";
35
36
  import {
36
37
  CollectionRegistryService
37
- } from "./chunk-D72XH3BG.mjs";
38
+ } from "./chunk-ERJGWWPB.mjs";
38
39
  import {
39
40
  ComponentSchemaService
40
- } from "./chunk-JXZITQPZ.mjs";
41
+ } from "./chunk-4HUQNXVM.mjs";
41
42
  import {
42
43
  hasPermission,
43
44
  isSuperAdmin,
44
45
  listEffectivePermissions,
45
46
  listRoleSlugsForUser
46
- } from "./chunk-NAP3TDS6.mjs";
47
+ } from "./chunk-SWVNFKWD.mjs";
47
48
  import {
48
49
  BaseService
49
- } from "./chunk-2W3DVD7S.mjs";
50
+ } from "./chunk-PFRMIEJ3.mjs";
50
51
  import {
51
52
  emailProvidersMysql,
52
53
  emailProvidersPg,
@@ -60,14 +61,14 @@ import {
60
61
  siteSettingsMysql,
61
62
  siteSettingsPg,
62
63
  siteSettingsSqlite
63
- } from "./chunk-TS7GHTG2.mjs";
64
+ } from "./chunk-YXZH65YV.mjs";
64
65
  import {
65
66
  createAdapterFromEnv,
66
67
  validateDatabaseEnv
67
- } from "./chunk-DP3G27G5.mjs";
68
+ } from "./chunk-35LAHTCU.mjs";
68
69
  import {
69
70
  env
70
- } from "./chunk-UJ2IMJ4W.mjs";
71
+ } from "./chunk-HREB7UR4.mjs";
71
72
  import {
72
73
  initializeMediaStorage
73
74
  } from "./chunk-EGXBZCGC.mjs";
@@ -77,7 +78,7 @@ import {
77
78
  import {
78
79
  NextlyError,
79
80
  toDbError
80
- } from "./chunk-NRUWQ5Z7.mjs";
81
+ } from "./chunk-5WWWJCKI.mjs";
81
82
  import {
82
83
  isComponentField
83
84
  } from "./chunk-5APFUGAD.mjs";
@@ -3772,12 +3773,13 @@ var EmailService = class extends BaseService {
3772
3773
  // Private: Helpers
3773
3774
  // ============================================================
3774
3775
  /**
3775
- * Get the base URL for email links.
3776
- * Priority: emailConfig.baseUrl > NEXT_PUBLIC_APP_URL > localhost
3776
+ * Get the base URL for email links. Delegates to the shared `getBaseUrl`
3777
+ * helper so email templates and absolutized media URLs resolve through
3778
+ * the same priority chain (emailConfig.baseUrl > NEXT_PUBLIC_APP_URL >
3779
+ * localhost).
3777
3780
  */
3778
3781
  getBaseUrl() {
3779
- const url = this.emailConfig?.baseUrl ?? env.NEXT_PUBLIC_APP_URL ?? "http://localhost:3000";
3780
- return url.replace(/\/$/, "");
3782
+ return getBaseUrl(this.emailConfig?.baseUrl);
3781
3783
  }
3782
3784
  /**
3783
3785
  * Get the application name for email templates.
@@ -5900,7 +5902,7 @@ async function initializeSchemaRegistry(adapter) {
5900
5902
  registry.registerStaticSchemas(getDialectTables(dialect));
5901
5903
  adapter.setTableResolver(registry);
5902
5904
  try {
5903
- const { ensureFirstRunSetup } = await import("./first-run-QIVKWJIF.mjs");
5905
+ const { ensureFirstRunSetup } = await import("./first-run-2JTNWFEG.mjs");
5904
5906
  await ensureFirstRunSetup({
5905
5907
  adapter,
5906
5908
  logger: {
@@ -5920,7 +5922,7 @@ async function initializeSchemaRegistry(adapter) {
5920
5922
  adapter,
5921
5923
  "dynamic_collections",
5922
5924
  async (tableName, fields, hasStatus) => {
5923
- const { generateRuntimeSchema } = await import("./runtime-schema-generator-MOPQWGJP.mjs");
5925
+ const { generateRuntimeSchema } = await import("./runtime-schema-generator-NQOLDUDG.mjs");
5924
5926
  const { table } = generateRuntimeSchema(
5925
5927
  tableName,
5926
5928
  fields,
@@ -5934,7 +5936,7 @@ async function initializeSchemaRegistry(adapter) {
5934
5936
  adapter,
5935
5937
  "dynamic_singles",
5936
5938
  async (tableName, fields, hasStatus) => {
5937
- const { generateRuntimeSchema } = await import("./runtime-schema-generator-MOPQWGJP.mjs");
5939
+ const { generateRuntimeSchema } = await import("./runtime-schema-generator-NQOLDUDG.mjs");
5938
5940
  const { table } = generateRuntimeSchema(
5939
5941
  tableName,
5940
5942
  fields,
@@ -5948,7 +5950,7 @@ async function initializeSchemaRegistry(adapter) {
5948
5950
  adapter,
5949
5951
  "dynamic_components",
5950
5952
  async (tableName, fields) => {
5951
- const { ComponentSchemaService: ComponentSchemaService2 } = await import("./component-schema-service-JOQIBQGK.mjs");
5953
+ const { ComponentSchemaService: ComponentSchemaService2 } = await import("./component-schema-service-HUAQQ4H5.mjs");
5952
5954
  const compSchemaService = new ComponentSchemaService2(dialect);
5953
5955
  const runtimeTable = compSchemaService.generateRuntimeSchema(
5954
5956
  tableName,
@@ -5973,7 +5975,7 @@ async function registerConfigTablesInResolver(registry, config, adapter, logger)
5973
5975
  const baseTableName = dbName ?? slug.replace(/-/g, "_");
5974
5976
  const tableName = baseTableName.startsWith("dc_") ? baseTableName : `dc_${baseTableName}`;
5975
5977
  const hasStatus = collection.status === true;
5976
- const { generateRuntimeSchema } = await import("./runtime-schema-generator-MOPQWGJP.mjs");
5978
+ const { generateRuntimeSchema } = await import("./runtime-schema-generator-NQOLDUDG.mjs");
5977
5979
  const { table } = generateRuntimeSchema(
5978
5980
  tableName,
5979
5981
  fields,
@@ -5996,7 +5998,7 @@ async function registerConfigTablesInResolver(registry, config, adapter, logger)
5996
5998
  if (!slug || !Array.isArray(fields) || fields.length === 0) continue;
5997
5999
  const tableName = resolveSingleTableName({ slug, dbName });
5998
6000
  const hasStatus = single.status === true;
5999
- const { generateRuntimeSchema } = await import("./runtime-schema-generator-MOPQWGJP.mjs");
6001
+ const { generateRuntimeSchema } = await import("./runtime-schema-generator-NQOLDUDG.mjs");
6000
6002
  const { table } = generateRuntimeSchema(
6001
6003
  tableName,
6002
6004
  fields,
@@ -6119,8 +6121,8 @@ ${errorDetails}`);
6119
6121
  `Auto-syncing ${collectionsNeedingTableSync.length} collection table(s)...`
6120
6122
  );
6121
6123
  try {
6122
- const { applyDesiredSchema } = await import("./pipeline-2DWG7LSN.mjs");
6123
- const { generateRuntimeSchema } = await import("./runtime-schema-generator-MOPQWGJP.mjs");
6124
+ const { applyDesiredSchema } = await import("./pipeline-URL33V42.mjs");
6125
+ const { generateRuntimeSchema } = await import("./runtime-schema-generator-NQOLDUDG.mjs");
6124
6126
  const collectionsToSyncSet = new Set(collectionsNeedingTableSync);
6125
6127
  const desiredCollections = {};
6126
6128
  const slugsAfterFilter = [];
@@ -6250,7 +6252,7 @@ ${errorDetails}`);
6250
6252
  `Auto-syncing ${componentsNeedingTableSync.length} component table(s)...`
6251
6253
  );
6252
6254
  try {
6253
- const { ComponentSchemaService: CompSchemaService } = await import("./component-schema-service-JOQIBQGK.mjs");
6255
+ const { ComponentSchemaService: CompSchemaService } = await import("./component-schema-service-HUAQQ4H5.mjs");
6254
6256
  const dialect = adapter.getCapabilities().dialect;
6255
6257
  const compSchemaService = new CompSchemaService(dialect);
6256
6258
  for (const slug of componentsNeedingTableSync) {
@@ -6342,7 +6344,7 @@ async function syncCodeFirstSingles(adapter, logger, transformedConfig) {
6342
6344
  async function reconcileSingleTablesForBoot(adapter, logger, transformedConfig) {
6343
6345
  try {
6344
6346
  const { reconcileSingleTables } = await import("./reconcile-single-tables-7ENVXJGB.mjs");
6345
- const { DynamicCollectionSchemaService } = await import("./dynamic-collection-schema-service-KMOP5PGD.mjs");
6347
+ const { DynamicCollectionSchemaService } = await import("./dynamic-collection-schema-service-FIRWOXZI.mjs");
6346
6348
  const schemaService = new DynamicCollectionSchemaService();
6347
6349
  const singleRegistry = container.get(
6348
6350
  "singleRegistryService"
@@ -6392,7 +6394,7 @@ async function reconcileSingleTablesForBoot(adapter, logger, transformedConfig)
6392
6394
  if (tableExists) {
6393
6395
  try {
6394
6396
  const dialect = adapter.getCapabilities().dialect;
6395
- const { generateRuntimeSchema: genRt } = await import("./runtime-schema-generator-MOPQWGJP.mjs");
6397
+ const { generateRuntimeSchema: genRt } = await import("./runtime-schema-generator-NQOLDUDG.mjs");
6396
6398
  const { table } = genRt(single.tableName, fields, dialect, {
6397
6399
  status: hasStatus
6398
6400
  });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  env
3
- } from "./chunk-UJ2IMJ4W.mjs";
3
+ } from "./chunk-HREB7UR4.mjs";
4
4
 
5
5
  // src/domains/dynamic-collections/services/dynamic-collection-validation-service.ts
6
6
  import safeRegex from "safe-regex2";
@@ -5,7 +5,7 @@ async function runBootTimeApplyIfDev(opts) {
5
5
  if (process.env.NEXTLY_DISABLE_BOOT_APPLY === "1") return;
6
6
  const label = callerLabel(opts?.caller);
7
7
  try {
8
- const { reloadNextlyConfig } = await import("./reload-config-VUEIQP5W.mjs");
8
+ const { reloadNextlyConfig } = await import("./reload-config-5P3IUF6O.mjs");
9
9
  await reloadNextlyConfig();
10
10
  } catch (err) {
11
11
  const msg = err instanceof Error ? err.message : String(err);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ServiceContainer
3
- } from "./chunk-ZVN3JILF.mjs";
3
+ } from "./chunk-KPCSDPFQ.mjs";
4
4
 
5
5
  // src/database/seeders/super-admin.ts
6
6
  var DEFAULT_SUPER_ADMIN = {
@@ -4,11 +4,11 @@ import {
4
4
  } from "./chunk-5HMZ644B.mjs";
5
5
  import {
6
6
  BaseService
7
- } from "./chunk-2W3DVD7S.mjs";
7
+ } from "./chunk-PFRMIEJ3.mjs";
8
8
  import {
9
9
  NextlyError,
10
10
  toDbError
11
- } from "./chunk-NRUWQ5Z7.mjs";
11
+ } from "./chunk-5WWWJCKI.mjs";
12
12
 
13
13
  // src/services/lib/resource-slug-guard.ts
14
14
  async function findSlugOwner(adapter, slug) {
@@ -2,16 +2,16 @@ import {
2
2
  isErrorResponse,
3
3
  requireAuthentication,
4
4
  toNextlyAuthError
5
- } from "./chunk-7YKKCBOC.mjs";
5
+ } from "./chunk-V2W7G5GC.mjs";
6
6
  import {
7
7
  nextlyValidationFromZod
8
- } from "./chunk-GJNSJU4S.mjs";
8
+ } from "./chunk-Z52OQOZH.mjs";
9
9
  import {
10
10
  withErrorHandler
11
- } from "./chunk-TO5AFLVQ.mjs";
11
+ } from "./chunk-XIKEJO27.mjs";
12
12
  import {
13
13
  getCachedNextly
14
- } from "./chunk-RKXTA5KC.mjs";
14
+ } from "./chunk-HLTSQIP6.mjs";
15
15
  import {
16
16
  respondAction
17
17
  } from "./chunk-IUDOC7N7.mjs";
@@ -20,7 +20,7 @@ import {
20
20
  } from "./chunk-D5HQBNUB.mjs";
21
21
  import {
22
22
  NextlyError
23
- } from "./chunk-NRUWQ5Z7.mjs";
23
+ } from "./chunk-5WWWJCKI.mjs";
24
24
 
25
25
  // src/api/email-send.ts
26
26
  import { z } from "zod";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  seedPermissions
3
- } from "./chunk-LPVOTXNV.mjs";
3
+ } from "./chunk-KLICUQPV.mjs";
4
4
  import {
5
5
  seedSuperAdmin
6
- } from "./chunk-3NUAFSDX.mjs";
6
+ } from "./chunk-DWV7GUKQ.mjs";
7
7
 
8
8
  // src/database/seeders/index.ts
9
9
  async function seedAll(adapter, options) {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  reloadNextlyConfig,
3
3
  resolveCollectionTableName
4
- } from "./chunk-MWW7OUDL.mjs";
4
+ } from "./chunk-OVQCDNU3.mjs";
5
5
  import {
6
6
  runBootTimeApplyIfDev
7
- } from "./chunk-L3SZUFF4.mjs";
7
+ } from "./chunk-AKK5Q5SX.mjs";
8
8
  import {
9
9
  buildClaims,
10
10
  signAccessToken
@@ -14,7 +14,7 @@ import {
14
14
  isServicesRegistered,
15
15
  registerServices,
16
16
  shutdownServices
17
- } from "./chunk-HVH4J6S6.mjs";
17
+ } from "./chunk-7MA6UATK.mjs";
18
18
  import {
19
19
  AuthService,
20
20
  PermissionService,
@@ -22,10 +22,10 @@ import {
22
22
  RoleService,
23
23
  UserAccountService,
24
24
  transformRichTextFields
25
- } from "./chunk-ZVN3JILF.mjs";
25
+ } from "./chunk-KPCSDPFQ.mjs";
26
26
  import {
27
27
  env
28
- } from "./chunk-UJ2IMJ4W.mjs";
28
+ } from "./chunk-HREB7UR4.mjs";
29
29
  import {
30
30
  getImageProcessor
31
31
  } from "./chunk-EGXBZCGC.mjs";
@@ -34,7 +34,7 @@ import {
34
34
  } from "./chunk-D5HQBNUB.mjs";
35
35
  import {
36
36
  NextlyError
37
- } from "./chunk-NRUWQ5Z7.mjs";
37
+ } from "./chunk-5WWWJCKI.mjs";
38
38
 
39
39
  // src/direct-api/namespaces/auth.ts
40
40
  async function login(ctx, args) {
@@ -2235,29 +2235,41 @@ async function runDriftCheck(args) {
2235
2235
  const { adapter, collections, logger } = args;
2236
2236
  const deps = await resolveDeps(args.deps);
2237
2237
  if (collections.length === 0) return { kind: "clean" };
2238
- const previewPromises = collections.map(async (collection) => {
2239
- try {
2240
- const preview = await deps.previewDesiredSchema({
2241
- desired: {
2242
- collections: {
2243
- [collection.slug]: collection
2238
+ const DRIFT_CONCURRENCY = 3;
2239
+ const results = [];
2240
+ let cursor = 0;
2241
+ const worker = async () => {
2242
+ while (cursor < collections.length) {
2243
+ const myIndex = cursor++;
2244
+ const collection = collections[myIndex];
2245
+ try {
2246
+ const preview = await deps.previewDesiredSchema({
2247
+ desired: {
2248
+ collections: {
2249
+ [collection.slug]: collection
2250
+ },
2251
+ singles: {},
2252
+ components: {}
2244
2253
  },
2245
- singles: {},
2246
- components: {}
2247
- },
2248
- db: adapter.getDrizzle(),
2249
- dialect: adapter.dialect
2250
- });
2251
- return { ok: true, opCount: preview.operations.length };
2252
- } catch (err) {
2253
- const msg = err instanceof Error ? err.message : String(err);
2254
- logger.debug?.(
2255
- `[nextly] Drift preview failed for '${collection.slug}': ${msg} (continuing).`
2256
- );
2257
- return { ok: false, error: msg };
2254
+ db: adapter.getDrizzle(),
2255
+ dialect: adapter.dialect
2256
+ });
2257
+ results[myIndex] = { ok: true, opCount: preview.operations.length };
2258
+ } catch (err) {
2259
+ const msg = err instanceof Error ? err.message : String(err);
2260
+ logger.debug?.(
2261
+ `[nextly] Drift preview failed for '${collection.slug}': ${msg} (continuing).`
2262
+ );
2263
+ results[myIndex] = { ok: false, error: msg };
2264
+ }
2258
2265
  }
2259
- });
2260
- const results = await Promise.all(previewPromises);
2266
+ };
2267
+ await Promise.all(
2268
+ Array.from(
2269
+ { length: Math.min(DRIFT_CONCURRENCY, collections.length) },
2270
+ () => worker()
2271
+ )
2272
+ );
2261
2273
  let pendingOps = 0;
2262
2274
  let failureCount = 0;
2263
2275
  for (const r of results) {
@@ -2279,7 +2291,7 @@ async function resolveDeps(injected) {
2279
2291
  if (injected?.previewDesiredSchema) {
2280
2292
  return injected;
2281
2293
  }
2282
- const { previewDesiredSchema } = await import("./preview-H6CJBMCP.mjs");
2294
+ const { previewDesiredSchema } = await import("./preview-3RSMZITY.mjs");
2283
2295
  return {
2284
2296
  previewDesiredSchema: injected?.previewDesiredSchema ?? previewDesiredSchema
2285
2297
  };
@@ -2344,35 +2356,52 @@ function ensureHmrListener() {
2344
2356
  const url = process.env.NEXTLY_HMR_URL_OVERRIDE ?? `${protocol}://localhost:${port}${prefix}/_next/webpack-hmr`;
2345
2357
  g.__nextly_hmrWs = new WebSocket(url);
2346
2358
  g.__nextly_hmrWs.onmessage = (event) => {
2347
- if (g.__nextly_hmrReload instanceof Promise) return;
2348
2359
  if (typeof event.data !== "string") return;
2349
- let data;
2350
- try {
2351
- data = JSON.parse(event.data);
2352
- } catch {
2353
- return;
2354
- }
2355
- if (typeof data !== "object" || data === null) return;
2356
- const record = data;
2357
- const isServerChange = record.type === "serverComponentChanges" || record.action === "serverComponentChanges";
2358
- if (isServerChange) {
2359
- if (!(g.__nextly_hmrReload instanceof Promise)) {
2360
- const reload = (async () => {
2361
- try {
2362
- const { reloadNextlyConfig: reloadNextlyConfig2 } = await import("./reload-config-VUEIQP5W.mjs");
2363
- await reloadNextlyConfig2();
2364
- } catch {
2365
- }
2366
- })();
2367
- markHmrReloadInFlight(reload);
2368
- }
2369
- }
2360
+ handleHmrMessage(event.data);
2370
2361
  };
2371
2362
  g.__nextly_hmrWs.onerror = () => {
2372
2363
  };
2373
2364
  } catch {
2374
2365
  }
2375
2366
  }
2367
+ var HMR_DEBOUNCE_MS = 300;
2368
+ var debounceCache = globalThis;
2369
+ var _reloaderFn = null;
2370
+ async function getReloader() {
2371
+ if (_reloaderFn) return _reloaderFn;
2372
+ const { reloadNextlyConfig: reloadNextlyConfig2 } = await import("./reload-config-5P3IUF6O.mjs");
2373
+ return reloadNextlyConfig2;
2374
+ }
2375
+ function scheduleReload() {
2376
+ if (g.__nextly_hmrReload instanceof Promise) return;
2377
+ if (debounceCache.__nextly_hmrDebounce) {
2378
+ clearTimeout(debounceCache.__nextly_hmrDebounce);
2379
+ }
2380
+ debounceCache.__nextly_hmrDebounce = setTimeout(() => {
2381
+ delete debounceCache.__nextly_hmrDebounce;
2382
+ if (g.__nextly_hmrReload instanceof Promise) return;
2383
+ const reload = (async () => {
2384
+ try {
2385
+ const reloadFn = await getReloader();
2386
+ await reloadFn();
2387
+ } catch {
2388
+ }
2389
+ })();
2390
+ markHmrReloadInFlight(reload);
2391
+ }, HMR_DEBOUNCE_MS);
2392
+ }
2393
+ function handleHmrMessage(raw) {
2394
+ let data;
2395
+ try {
2396
+ data = JSON.parse(raw);
2397
+ } catch {
2398
+ return;
2399
+ }
2400
+ if (typeof data !== "object" || data === null) return;
2401
+ const record = data;
2402
+ const isServerChange = record.type === "serverComponentChanges" || record.action === "serverComponentChanges";
2403
+ if (isServerChange) scheduleReload();
2404
+ }
2376
2405
  function consumeHmrReloadFlag() {
2377
2406
  if (g.__nextly_hmrReload === true) {
2378
2407
  g.__nextly_hmrReload = false;
@@ -10,10 +10,16 @@ var _envSchema = z.object({
10
10
  // SQLite-specific path (alternative to DATABASE_URL for SQLite)
11
11
  SQLITE_PATH: z.string().optional(),
12
12
  // Pooling & timeouts
13
- DB_POOL_MAX: z.coerce.number().int().min(1).default(20),
14
- DB_POOL_MIN: z.coerce.number().int().min(0).default(2),
15
- DB_POOL_IDLE_TIMEOUT: z.coerce.number().int().min(1e3).default(3e4),
16
- DB_QUERY_TIMEOUT: z.coerce.number().int().min(1e3).default(15e3),
13
+ // Phase 1 fix: these used to carry zod defaults, but the defaults silently
14
+ // overrode the adapter's intentional cold-start-friendly defaults (e.g.
15
+ // the Postgres adapter's `min: 0` for Neon auto-suspend recovery — see
16
+ // packages/adapter-postgres/src/index.ts:140-148). Make them optional so
17
+ // the factory's `??` chain can fall through to adapter-level defaults
18
+ // when the operator hasn't set anything.
19
+ DB_POOL_MAX: z.coerce.number().int().min(1).optional(),
20
+ DB_POOL_MIN: z.coerce.number().int().min(0).optional(),
21
+ DB_POOL_IDLE_TIMEOUT: z.coerce.number().int().min(1e3).optional(),
22
+ DB_QUERY_TIMEOUT: z.coerce.number().int().min(1e3).optional(),
17
23
  DB_HEALTHCHECK_INTERVAL_MS: z.coerce.number().int().min(1e3).default(3e4),
18
24
  DB_SNAKE_CASE: z.coerce.boolean().default(false),
19
25
  // URLs