nextly 0.0.2-alpha.1 → 0.0.2-alpha.10
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.
- package/dist/_dts-chunks/{collections-handler.d-DjgO74Wt.d.ts → collections-handler.d-B3iNFGJv.d.ts} +135 -120
- package/dist/_dts-chunks/{config.d-DNwsDnjs.d.ts → config.d-D8eInFE5.d.ts} +13 -1
- package/dist/_dts-chunks/{define-component.d-BUgTHmt3.d.ts → define-component.d-COeEsUOT.d.ts} +2 -2
- package/dist/_dts-chunks/{index.d-axCAzZ7m.d.ts → index.d-qjDq8N63.d.ts} +5 -5
- package/dist/actions/index.mjs +15 -15
- package/dist/api/auth-state.mjs +21 -21
- package/dist/api/collections-schema-detail.mjs +21 -21
- package/dist/api/collections-schema-export.mjs +21 -21
- package/dist/api/collections-schema.mjs +21 -21
- package/dist/api/components-detail.mjs +21 -21
- package/dist/api/components.mjs +21 -21
- package/dist/api/email-providers-default.mjs +21 -21
- package/dist/api/email-providers-detail.mjs +21 -21
- package/dist/api/email-providers-test.mjs +21 -21
- package/dist/api/email-providers.mjs +21 -21
- package/dist/api/email-send-template.mjs +23 -23
- package/dist/api/email-send.mjs +23 -23
- package/dist/api/email-templates-detail.mjs +21 -21
- package/dist/api/email-templates-layout.mjs +21 -21
- package/dist/api/email-templates-preview.mjs +21 -21
- package/dist/api/email-templates.mjs +21 -21
- package/dist/api/media-bulk.mjs +17 -17
- package/dist/api/media-folders.mjs +21 -21
- package/dist/api/media-handlers.d.ts +2 -2
- package/dist/api/media-handlers.mjs +21 -21
- package/dist/api/media.mjs +21 -21
- package/dist/api/singles-detail.mjs +21 -21
- package/dist/api/singles-schema-detail.mjs +21 -21
- package/dist/api/singles.mjs +21 -21
- package/dist/api/storage-upload-url.mjs +21 -21
- package/dist/api/uploads.mjs +27 -26
- package/dist/auth/index.mjs +6 -6
- package/dist/{boot-apply-PQSYLDIN.mjs → boot-apply-OE3D3KNU.mjs} +1 -1
- package/dist/{chunk-IZWPRDC3.mjs → chunk-2QSGNGOB.mjs} +1 -1
- package/dist/{chunk-DP3G27G5.mjs → chunk-35LAHTCU.mjs} +12 -2
- package/dist/{chunk-DNNG377Z.mjs → chunk-463A2UDH.mjs} +79 -13
- package/dist/{chunk-V4EQTOA4.mjs → chunk-4HUQNXVM.mjs} +2 -2
- package/dist/{chunk-VJ66NCL4.mjs → chunk-6C3CST4Q.mjs} +53 -4
- package/dist/{chunk-PKMABBB5.mjs → chunk-6GWK77EN.mjs} +1 -1
- package/dist/{chunk-XZKLBMN6.mjs → chunk-A75OLKXP.mjs} +44 -16
- package/dist/{chunk-TS7GHTG2.mjs → chunk-A7GGVOIV.mjs} +1 -1
- package/dist/{chunk-INV7QKLG.mjs → chunk-BZ2EOLXR.mjs} +1 -1
- package/dist/{chunk-X7TXCYYN.mjs → chunk-DQGQMP5F.mjs} +46 -26
- package/dist/{chunk-2W3DVD7S.mjs → chunk-ERTNRSP3.mjs} +1 -1
- package/dist/{chunk-UJ2IMJ4W.mjs → chunk-HREB7UR4.mjs} +10 -4
- package/dist/{chunk-NSEFNNU4.mjs → chunk-ILETUFUD.mjs} +302 -105
- package/dist/{chunk-A3WPLSDT.mjs → chunk-INTLFB63.mjs} +1 -1
- package/dist/{chunk-SBACDPNX.mjs → chunk-JCQMC6HH.mjs} +216 -27
- package/dist/{chunk-3FA7FKAV.mjs → chunk-JGVOZSXS.mjs} +58 -4
- package/dist/{chunk-M52VMPGA.mjs → chunk-KZFYCMBL.mjs} +1 -1
- package/dist/{chunk-W5KKPZT5.mjs → chunk-L7BXB5H3.mjs} +2 -2
- package/dist/{chunk-B2GV2BWH.mjs → chunk-MF4S2WSM.mjs} +2 -2
- package/dist/{chunk-R6JJQHFC.mjs → chunk-NXA6FD7R.mjs} +1 -1
- package/dist/{chunk-XGI4EMS3.mjs → chunk-OPACR7PX.mjs} +3 -3
- package/dist/{chunk-2OALJTK6.mjs → chunk-OV4WR3EC.mjs} +22 -42
- package/dist/{chunk-YZNBLFIW.mjs → chunk-RH3QV6E6.mjs} +3 -3
- package/dist/{chunk-LDKCUMHK.mjs → chunk-RQ3N4DIB.mjs} +2 -2
- package/dist/{chunk-YV4Y7SDL.mjs → chunk-TGBLNY5L.mjs} +2 -2
- package/dist/{chunk-GZ6DCQKC.mjs → chunk-TVG3WU6C.mjs} +5 -3
- package/dist/{chunk-AK6Z23OX.mjs → chunk-UGB6MLR6.mjs} +274 -45
- package/dist/{chunk-2Q2SX2CS.mjs → chunk-V5DUKEYT.mjs} +2 -2
- package/dist/{chunk-UOP63Q54.mjs → chunk-WRGCEERR.mjs} +1 -1
- package/dist/{chunk-O3QHXMOX.mjs → chunk-XCT6CROA.mjs} +23 -19
- package/dist/{chunk-P7NH2OSC.mjs → chunk-ZDNGCKSZ.mjs} +78 -49
- package/dist/cli/nextly.mjs +1 -1
- package/dist/cli/utils/index.d.ts +2 -2
- package/dist/cli/utils/index.mjs +1 -1
- package/dist/{component-schema-service-5577KVW6.mjs → component-schema-service-HUAQQ4H5.mjs} +2 -2
- package/dist/config.d.ts +3 -3
- package/dist/database/index.d.ts +2 -2
- package/dist/database/index.mjs +3 -3
- package/dist/database/seeders/index.mjs +18 -18
- package/dist/{db-sync-demote-LJGKLB3S.mjs → db-sync-demote-M7IEFD6N.mjs} +6 -6
- package/dist/{db-sync-promote-B26VSYQF.mjs → db-sync-promote-2MCB5JRZ.mjs} +6 -6
- package/dist/{dynamic-collection-schema-service-IEXTPIZ7.mjs → dynamic-collection-schema-service-FIRWOXZI.mjs} +2 -2
- package/dist/{factory-IWMBKUJM.mjs → factory-UGJGOZZ7.mjs} +2 -2
- package/dist/index.d.ts +16 -11
- package/dist/index.mjs +24 -55
- package/dist/{permissions-3DZZQZMI.mjs → permissions-KH3WCGAR.mjs} +16 -16
- package/dist/{pipeline-YOML7SWF.mjs → pipeline-JLANATHU.mjs} +10 -10
- package/dist/{preview-ZZTR3QGS.mjs → preview-3RSMZITY.mjs} +3 -3
- package/dist/{program-PW6UB2ZC.mjs → program-6V6HLEUI.mjs} +27 -27
- package/dist/{register-SF6E6FVU.mjs → register-FCUTHDS5.mjs} +17 -17
- package/dist/{reload-config-HWQ4G5MM.mjs → reload-config-52GWTPZG.mjs} +10 -10
- package/dist/{routeHandler-UNMMJIBM.mjs → routeHandler-FP26UQPJ.mjs} +26 -26
- package/dist/{runtime-schema-generator-NRA6A6Z6.mjs → runtime-schema-generator-NQOLDUDG.mjs} +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.mjs +26 -26
- package/dist/{super-admin-G5ZK5F4T.mjs → super-admin-XZAU4VQM.mjs} +16 -16
- package/dist/{system-table-service-WGSRVEGT.mjs → system-table-service-5FIVIALU.mjs} +5 -5
- package/dist/{users-7KELGRYJ.mjs → users-K2NJTF55.mjs} +15 -15
- package/package.json +8 -8
- /package/dist/{first-run-QIVKWJIF.mjs → first-run-2UDWZK5X.mjs} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
env
|
|
3
|
-
} from "./chunk-
|
|
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";
|
|
@@ -336,14 +336,20 @@ var DynamicCollectionSchemaService = class {
|
|
|
336
336
|
}).filter(Boolean).join(",\n");
|
|
337
337
|
const allColumnDefs = [];
|
|
338
338
|
if (this.dialect === "mysql") {
|
|
339
|
-
allColumnDefs.push(
|
|
339
|
+
allColumnDefs.push(
|
|
340
|
+
` ${this.quoteIdentifier("id")} varchar(36) PRIMARY KEY NOT NULL`
|
|
341
|
+
);
|
|
340
342
|
} else {
|
|
341
|
-
allColumnDefs.push(
|
|
343
|
+
allColumnDefs.push(
|
|
344
|
+
` ${this.quoteIdentifier("id")} text PRIMARY KEY NOT NULL`
|
|
345
|
+
);
|
|
342
346
|
}
|
|
343
347
|
const hasTitleField = fields.some((f) => f.name === "title");
|
|
344
348
|
if (!hasTitleField) {
|
|
345
349
|
if (this.dialect === "mysql") {
|
|
346
|
-
allColumnDefs.push(
|
|
350
|
+
allColumnDefs.push(
|
|
351
|
+
` ${this.quoteIdentifier("title")} varchar(255) NOT NULL`
|
|
352
|
+
);
|
|
347
353
|
} else {
|
|
348
354
|
allColumnDefs.push(` ${this.quoteIdentifier("title")} text NOT NULL`);
|
|
349
355
|
}
|
|
@@ -351,7 +357,9 @@ var DynamicCollectionSchemaService = class {
|
|
|
351
357
|
const hasSlugField = fields.some((f) => f.name === "slug");
|
|
352
358
|
if (!hasSlugField) {
|
|
353
359
|
if (this.dialect === "mysql") {
|
|
354
|
-
allColumnDefs.push(
|
|
360
|
+
allColumnDefs.push(
|
|
361
|
+
` ${this.quoteIdentifier("slug")} varchar(255) NOT NULL`
|
|
362
|
+
);
|
|
355
363
|
} else {
|
|
356
364
|
allColumnDefs.push(` ${this.quoteIdentifier("slug")} text NOT NULL`);
|
|
357
365
|
}
|
|
@@ -375,20 +383,34 @@ var DynamicCollectionSchemaService = class {
|
|
|
375
383
|
}
|
|
376
384
|
}
|
|
377
385
|
if (checks.length > 0) {
|
|
378
|
-
allColumnDefs.push(
|
|
386
|
+
allColumnDefs.push(
|
|
387
|
+
` CONSTRAINT ${this.quoteIdentifier(`chk_${tableName}_validation`)} CHECK (${checks.join(" AND ")})`
|
|
388
|
+
);
|
|
379
389
|
}
|
|
380
390
|
for (const c of constraints) {
|
|
381
391
|
allColumnDefs.push(c);
|
|
382
392
|
}
|
|
383
393
|
if (this.dialect === "sqlite") {
|
|
384
|
-
allColumnDefs.push(
|
|
385
|
-
|
|
394
|
+
allColumnDefs.push(
|
|
395
|
+
` ${this.quoteIdentifier("created_at")} integer DEFAULT (strftime('%s', 'now')) NOT NULL`
|
|
396
|
+
);
|
|
397
|
+
allColumnDefs.push(
|
|
398
|
+
` ${this.quoteIdentifier("updated_at")} integer DEFAULT (strftime('%s', 'now')) NOT NULL`
|
|
399
|
+
);
|
|
386
400
|
} else if (this.dialect === "mysql") {
|
|
387
|
-
allColumnDefs.push(
|
|
388
|
-
|
|
401
|
+
allColumnDefs.push(
|
|
402
|
+
` ${this.quoteIdentifier("created_at")} timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL`
|
|
403
|
+
);
|
|
404
|
+
allColumnDefs.push(
|
|
405
|
+
` ${this.quoteIdentifier("updated_at")} timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL`
|
|
406
|
+
);
|
|
389
407
|
} else {
|
|
390
|
-
allColumnDefs.push(
|
|
391
|
-
|
|
408
|
+
allColumnDefs.push(
|
|
409
|
+
` ${this.quoteIdentifier("created_at")} timestamp DEFAULT now() NOT NULL`
|
|
410
|
+
);
|
|
411
|
+
allColumnDefs.push(
|
|
412
|
+
` ${this.quoteIdentifier("updated_at")} timestamp DEFAULT now() NOT NULL`
|
|
413
|
+
);
|
|
392
414
|
}
|
|
393
415
|
let sql = `-- Create dynamic collection: ${tableName}
|
|
394
416
|
CREATE TABLE IF NOT EXISTS ${this.quoteIdentifier(tableName)} (
|
|
@@ -478,7 +500,7 @@ ${allColumnDefs.join(",\n")}
|
|
|
478
500
|
statements.push(
|
|
479
501
|
`ALTER TABLE ${this.quoteIdentifier(tableName)} ADD COLUMN ${this.quoteIdentifier("status")} ${statusType} DEFAULT 'draft' NOT NULL;`
|
|
480
502
|
);
|
|
481
|
-
} else if (wasStatus &&
|
|
503
|
+
} else if (wasStatus && options?.hasStatus === false) {
|
|
482
504
|
statements.push(
|
|
483
505
|
`ALTER TABLE ${this.quoteIdentifier(tableName)} DROP COLUMN ${this.quoteIdentifier("status")};`
|
|
484
506
|
);
|
|
@@ -679,9 +701,12 @@ ${allColumnDefs.join(",\n")}
|
|
|
679
701
|
return true;
|
|
680
702
|
}
|
|
681
703
|
/**
|
|
682
|
-
* Generate TypeScript/Drizzle schema code for a collection
|
|
704
|
+
* Generate TypeScript/Drizzle schema code for a collection. Pass
|
|
705
|
+
* `hasStatus: true` for Draft/Published collections so the generated
|
|
706
|
+
* file includes the `status` column — without it, `drizzle-kit
|
|
707
|
+
* pushSchema` later sees the live `status` column as extra and drops it.
|
|
683
708
|
*/
|
|
684
|
-
generateSchemaCode(tableName, collectionName, fields) {
|
|
709
|
+
generateSchemaCode(tableName, collectionName, fields, options) {
|
|
685
710
|
const dialectConfig = this.getDialectConfig();
|
|
686
711
|
const jsonbFieldTypes = [
|
|
687
712
|
"json",
|
|
@@ -750,6 +775,9 @@ import { relations } from 'drizzle-orm';`;
|
|
|
750
775
|
const allIndexes = fieldIndexes ? ` createdAtIdx: index('idx_${tableName}_created_at').on(table.createdAt),
|
|
751
776
|
${fieldIndexes}` : ` createdAtIdx: index('idx_${tableName}_created_at').on(table.createdAt),`;
|
|
752
777
|
const timestampColumns = this.generateTimestampColumnsForDialect();
|
|
778
|
+
const statusColumn = options?.hasStatus ? this.dialect === "sqlite" ? ` status: text('status').notNull().default('draft'),
|
|
779
|
+
` : ` status: varchar('status', { length: 20 }).notNull().default('draft'),
|
|
780
|
+
` : "";
|
|
753
781
|
return `${imports}
|
|
754
782
|
|
|
755
783
|
/**
|
|
@@ -761,7 +789,7 @@ export const ${tableName} = ${dialectConfig.tableFunction}('${tableName}', {
|
|
|
761
789
|
title: text('title').notNull(),
|
|
762
790
|
slug: text('slug').notNull(),
|
|
763
791
|
${columns}
|
|
764
|
-
${timestampColumns}
|
|
792
|
+
${statusColumn}${timestampColumns}
|
|
765
793
|
}, (table) => ({
|
|
766
794
|
slugIdx: uniqueIndex('idx_${tableName}_slug').on(table.slug),
|
|
767
795
|
${allIndexes}
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
ComponentRegistryService,
|
|
3
3
|
PermissionSeedService,
|
|
4
4
|
SingleRegistryService
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-RH3QV6E6.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-
|
|
35
|
+
} from "./chunk-ILETUFUD.mjs";
|
|
35
36
|
import {
|
|
36
37
|
CollectionRegistryService
|
|
37
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-JGVOZSXS.mjs";
|
|
38
39
|
import {
|
|
39
40
|
ComponentSchemaService
|
|
40
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-4HUQNXVM.mjs";
|
|
41
42
|
import {
|
|
42
43
|
hasPermission,
|
|
43
44
|
isSuperAdmin,
|
|
44
45
|
listEffectivePermissions,
|
|
45
46
|
listRoleSlugsForUser
|
|
46
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-L7BXB5H3.mjs";
|
|
47
48
|
import {
|
|
48
49
|
BaseService
|
|
49
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-ERTNRSP3.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-
|
|
64
|
+
} from "./chunk-A7GGVOIV.mjs";
|
|
64
65
|
import {
|
|
65
66
|
createAdapterFromEnv,
|
|
66
67
|
validateDatabaseEnv
|
|
67
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-35LAHTCU.mjs";
|
|
68
69
|
import {
|
|
69
70
|
env
|
|
70
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-HREB7UR4.mjs";
|
|
71
72
|
import {
|
|
72
73
|
initializeMediaStorage
|
|
73
74
|
} from "./chunk-EGXBZCGC.mjs";
|
|
@@ -577,7 +578,8 @@ function registerCollectionServices(ctx) {
|
|
|
577
578
|
const fields = typeof result.fields === "string" ? JSON.parse(result.fields) : result.fields;
|
|
578
579
|
return {
|
|
579
580
|
fields,
|
|
580
|
-
tableName: result.
|
|
581
|
+
tableName: result.tableName,
|
|
582
|
+
// SQLite returns 0/1 for booleans; PG/MySQL return real booleans.
|
|
581
583
|
status: result.status === true || result.status === 1
|
|
582
584
|
};
|
|
583
585
|
}
|
|
@@ -3771,12 +3773,13 @@ var EmailService = class extends BaseService {
|
|
|
3771
3773
|
// Private: Helpers
|
|
3772
3774
|
// ============================================================
|
|
3773
3775
|
/**
|
|
3774
|
-
* Get the base URL for email links.
|
|
3775
|
-
*
|
|
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).
|
|
3776
3780
|
*/
|
|
3777
3781
|
getBaseUrl() {
|
|
3778
|
-
|
|
3779
|
-
return url.replace(/\/$/, "");
|
|
3782
|
+
return getBaseUrl(this.emailConfig?.baseUrl);
|
|
3780
3783
|
}
|
|
3781
3784
|
/**
|
|
3782
3785
|
* Get the application name for email templates.
|
|
@@ -5899,7 +5902,7 @@ async function initializeSchemaRegistry(adapter) {
|
|
|
5899
5902
|
registry.registerStaticSchemas(getDialectTables(dialect));
|
|
5900
5903
|
adapter.setTableResolver(registry);
|
|
5901
5904
|
try {
|
|
5902
|
-
const { ensureFirstRunSetup } = await import("./first-run-
|
|
5905
|
+
const { ensureFirstRunSetup } = await import("./first-run-2UDWZK5X.mjs");
|
|
5903
5906
|
await ensureFirstRunSetup({
|
|
5904
5907
|
adapter,
|
|
5905
5908
|
logger: {
|
|
@@ -5919,7 +5922,7 @@ async function initializeSchemaRegistry(adapter) {
|
|
|
5919
5922
|
adapter,
|
|
5920
5923
|
"dynamic_collections",
|
|
5921
5924
|
async (tableName, fields, hasStatus) => {
|
|
5922
|
-
const { generateRuntimeSchema } = await import("./runtime-schema-generator-
|
|
5925
|
+
const { generateRuntimeSchema } = await import("./runtime-schema-generator-NQOLDUDG.mjs");
|
|
5923
5926
|
const { table } = generateRuntimeSchema(
|
|
5924
5927
|
tableName,
|
|
5925
5928
|
fields,
|
|
@@ -5933,7 +5936,7 @@ async function initializeSchemaRegistry(adapter) {
|
|
|
5933
5936
|
adapter,
|
|
5934
5937
|
"dynamic_singles",
|
|
5935
5938
|
async (tableName, fields, hasStatus) => {
|
|
5936
|
-
const { generateRuntimeSchema } = await import("./runtime-schema-generator-
|
|
5939
|
+
const { generateRuntimeSchema } = await import("./runtime-schema-generator-NQOLDUDG.mjs");
|
|
5937
5940
|
const { table } = generateRuntimeSchema(
|
|
5938
5941
|
tableName,
|
|
5939
5942
|
fields,
|
|
@@ -5947,7 +5950,7 @@ async function initializeSchemaRegistry(adapter) {
|
|
|
5947
5950
|
adapter,
|
|
5948
5951
|
"dynamic_components",
|
|
5949
5952
|
async (tableName, fields) => {
|
|
5950
|
-
const { ComponentSchemaService: ComponentSchemaService2 } = await import("./component-schema-service-
|
|
5953
|
+
const { ComponentSchemaService: ComponentSchemaService2 } = await import("./component-schema-service-HUAQQ4H5.mjs");
|
|
5951
5954
|
const compSchemaService = new ComponentSchemaService2(dialect);
|
|
5952
5955
|
const runtimeTable = compSchemaService.generateRuntimeSchema(
|
|
5953
5956
|
tableName,
|
|
@@ -5972,7 +5975,7 @@ async function registerConfigTablesInResolver(registry, config, adapter, logger)
|
|
|
5972
5975
|
const baseTableName = dbName ?? slug.replace(/-/g, "_");
|
|
5973
5976
|
const tableName = baseTableName.startsWith("dc_") ? baseTableName : `dc_${baseTableName}`;
|
|
5974
5977
|
const hasStatus = collection.status === true;
|
|
5975
|
-
const { generateRuntimeSchema } = await import("./runtime-schema-generator-
|
|
5978
|
+
const { generateRuntimeSchema } = await import("./runtime-schema-generator-NQOLDUDG.mjs");
|
|
5976
5979
|
const { table } = generateRuntimeSchema(
|
|
5977
5980
|
tableName,
|
|
5978
5981
|
fields,
|
|
@@ -5995,7 +5998,7 @@ async function registerConfigTablesInResolver(registry, config, adapter, logger)
|
|
|
5995
5998
|
if (!slug || !Array.isArray(fields) || fields.length === 0) continue;
|
|
5996
5999
|
const tableName = resolveSingleTableName({ slug, dbName });
|
|
5997
6000
|
const hasStatus = single.status === true;
|
|
5998
|
-
const { generateRuntimeSchema } = await import("./runtime-schema-generator-
|
|
6001
|
+
const { generateRuntimeSchema } = await import("./runtime-schema-generator-NQOLDUDG.mjs");
|
|
5999
6002
|
const { table } = generateRuntimeSchema(
|
|
6000
6003
|
tableName,
|
|
6001
6004
|
fields,
|
|
@@ -6031,6 +6034,18 @@ async function syncCodeFirstCollections(adapter, logger, transformedConfig) {
|
|
|
6031
6034
|
const collectionRegistry = container.get(
|
|
6032
6035
|
"collectionRegistryService"
|
|
6033
6036
|
);
|
|
6037
|
+
if (container.has("collectionService")) {
|
|
6038
|
+
try {
|
|
6039
|
+
const collectionService = container.get("collectionService");
|
|
6040
|
+
collectionRegistry.setOnTableNameChanged((slug) => {
|
|
6041
|
+
collectionService.invalidateSchemaForSlug(slug);
|
|
6042
|
+
});
|
|
6043
|
+
} catch (err) {
|
|
6044
|
+
logger.warn?.(
|
|
6045
|
+
`[registerServices] Could not wire tableName-change cache invalidation: ${err instanceof Error ? err.message : String(err)}`
|
|
6046
|
+
);
|
|
6047
|
+
}
|
|
6048
|
+
}
|
|
6034
6049
|
const codeFirstConfigs = transformedConfig.collections.map((collection) => ({
|
|
6035
6050
|
slug: collection.slug,
|
|
6036
6051
|
labels: {
|
|
@@ -6083,8 +6098,13 @@ ${errorDetails}`);
|
|
|
6083
6098
|
...syncResult.created,
|
|
6084
6099
|
...syncResult.updated
|
|
6085
6100
|
];
|
|
6101
|
+
const collectionsBySlug = new Map(
|
|
6102
|
+
(transformedConfig.collections ?? []).map((c) => [c.slug, c])
|
|
6103
|
+
);
|
|
6086
6104
|
for (const slug of syncResult.unchanged) {
|
|
6087
|
-
const
|
|
6105
|
+
const collection = collectionsBySlug.get(slug);
|
|
6106
|
+
const baseTableName = collection?.dbName ?? slug.replace(/-/g, "_");
|
|
6107
|
+
const tableName = baseTableName.startsWith("dc_") ? baseTableName : `dc_${baseTableName}`;
|
|
6088
6108
|
try {
|
|
6089
6109
|
const tableExists = await adapter.tableExists(tableName);
|
|
6090
6110
|
if (!tableExists) {
|
|
@@ -6101,8 +6121,8 @@ ${errorDetails}`);
|
|
|
6101
6121
|
`Auto-syncing ${collectionsNeedingTableSync.length} collection table(s)...`
|
|
6102
6122
|
);
|
|
6103
6123
|
try {
|
|
6104
|
-
const { applyDesiredSchema } = await import("./pipeline-
|
|
6105
|
-
const { generateRuntimeSchema } = await import("./runtime-schema-generator-
|
|
6124
|
+
const { applyDesiredSchema } = await import("./pipeline-JLANATHU.mjs");
|
|
6125
|
+
const { generateRuntimeSchema } = await import("./runtime-schema-generator-NQOLDUDG.mjs");
|
|
6106
6126
|
const collectionsToSyncSet = new Set(collectionsNeedingTableSync);
|
|
6107
6127
|
const desiredCollections = {};
|
|
6108
6128
|
const slugsAfterFilter = [];
|
|
@@ -6232,7 +6252,7 @@ ${errorDetails}`);
|
|
|
6232
6252
|
`Auto-syncing ${componentsNeedingTableSync.length} component table(s)...`
|
|
6233
6253
|
);
|
|
6234
6254
|
try {
|
|
6235
|
-
const { ComponentSchemaService: CompSchemaService } = await import("./component-schema-service-
|
|
6255
|
+
const { ComponentSchemaService: CompSchemaService } = await import("./component-schema-service-HUAQQ4H5.mjs");
|
|
6236
6256
|
const dialect = adapter.getCapabilities().dialect;
|
|
6237
6257
|
const compSchemaService = new CompSchemaService(dialect);
|
|
6238
6258
|
for (const slug of componentsNeedingTableSync) {
|
|
@@ -6324,7 +6344,7 @@ async function syncCodeFirstSingles(adapter, logger, transformedConfig) {
|
|
|
6324
6344
|
async function reconcileSingleTablesForBoot(adapter, logger, transformedConfig) {
|
|
6325
6345
|
try {
|
|
6326
6346
|
const { reconcileSingleTables } = await import("./reconcile-single-tables-7ENVXJGB.mjs");
|
|
6327
|
-
const { DynamicCollectionSchemaService } = await import("./dynamic-collection-schema-service-
|
|
6347
|
+
const { DynamicCollectionSchemaService } = await import("./dynamic-collection-schema-service-FIRWOXZI.mjs");
|
|
6328
6348
|
const schemaService = new DynamicCollectionSchemaService();
|
|
6329
6349
|
const singleRegistry = container.get(
|
|
6330
6350
|
"singleRegistryService"
|
|
@@ -6374,7 +6394,7 @@ async function reconcileSingleTablesForBoot(adapter, logger, transformedConfig)
|
|
|
6374
6394
|
if (tableExists) {
|
|
6375
6395
|
try {
|
|
6376
6396
|
const dialect = adapter.getCapabilities().dialect;
|
|
6377
|
-
const { generateRuntimeSchema: genRt } = await import("./runtime-schema-generator-
|
|
6397
|
+
const { generateRuntimeSchema: genRt } = await import("./runtime-schema-generator-NQOLDUDG.mjs");
|
|
6378
6398
|
const { table } = genRt(single.tableName, fields, dialect, {
|
|
6379
6399
|
status: hasStatus
|
|
6380
6400
|
});
|
|
@@ -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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|