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.
Files changed (93) hide show
  1. package/dist/_dts-chunks/{collections-handler.d-DjgO74Wt.d.ts → collections-handler.d-B3iNFGJv.d.ts} +135 -120
  2. package/dist/_dts-chunks/{config.d-DNwsDnjs.d.ts → config.d-D8eInFE5.d.ts} +13 -1
  3. package/dist/_dts-chunks/{define-component.d-BUgTHmt3.d.ts → define-component.d-COeEsUOT.d.ts} +2 -2
  4. package/dist/_dts-chunks/{index.d-axCAzZ7m.d.ts → index.d-qjDq8N63.d.ts} +5 -5
  5. package/dist/actions/index.mjs +15 -15
  6. package/dist/api/auth-state.mjs +21 -21
  7. package/dist/api/collections-schema-detail.mjs +21 -21
  8. package/dist/api/collections-schema-export.mjs +21 -21
  9. package/dist/api/collections-schema.mjs +21 -21
  10. package/dist/api/components-detail.mjs +21 -21
  11. package/dist/api/components.mjs +21 -21
  12. package/dist/api/email-providers-default.mjs +21 -21
  13. package/dist/api/email-providers-detail.mjs +21 -21
  14. package/dist/api/email-providers-test.mjs +21 -21
  15. package/dist/api/email-providers.mjs +21 -21
  16. package/dist/api/email-send-template.mjs +23 -23
  17. package/dist/api/email-send.mjs +23 -23
  18. package/dist/api/email-templates-detail.mjs +21 -21
  19. package/dist/api/email-templates-layout.mjs +21 -21
  20. package/dist/api/email-templates-preview.mjs +21 -21
  21. package/dist/api/email-templates.mjs +21 -21
  22. package/dist/api/media-bulk.mjs +17 -17
  23. package/dist/api/media-folders.mjs +21 -21
  24. package/dist/api/media-handlers.d.ts +2 -2
  25. package/dist/api/media-handlers.mjs +21 -21
  26. package/dist/api/media.mjs +21 -21
  27. package/dist/api/singles-detail.mjs +21 -21
  28. package/dist/api/singles-schema-detail.mjs +21 -21
  29. package/dist/api/singles.mjs +21 -21
  30. package/dist/api/storage-upload-url.mjs +21 -21
  31. package/dist/api/uploads.mjs +27 -26
  32. package/dist/auth/index.mjs +6 -6
  33. package/dist/{boot-apply-PQSYLDIN.mjs → boot-apply-OE3D3KNU.mjs} +1 -1
  34. package/dist/{chunk-IZWPRDC3.mjs → chunk-2QSGNGOB.mjs} +1 -1
  35. package/dist/{chunk-DP3G27G5.mjs → chunk-35LAHTCU.mjs} +12 -2
  36. package/dist/{chunk-DNNG377Z.mjs → chunk-463A2UDH.mjs} +79 -13
  37. package/dist/{chunk-V4EQTOA4.mjs → chunk-4HUQNXVM.mjs} +2 -2
  38. package/dist/{chunk-VJ66NCL4.mjs → chunk-6C3CST4Q.mjs} +53 -4
  39. package/dist/{chunk-PKMABBB5.mjs → chunk-6GWK77EN.mjs} +1 -1
  40. package/dist/{chunk-XZKLBMN6.mjs → chunk-A75OLKXP.mjs} +44 -16
  41. package/dist/{chunk-TS7GHTG2.mjs → chunk-A7GGVOIV.mjs} +1 -1
  42. package/dist/{chunk-INV7QKLG.mjs → chunk-BZ2EOLXR.mjs} +1 -1
  43. package/dist/{chunk-X7TXCYYN.mjs → chunk-DQGQMP5F.mjs} +46 -26
  44. package/dist/{chunk-2W3DVD7S.mjs → chunk-ERTNRSP3.mjs} +1 -1
  45. package/dist/{chunk-UJ2IMJ4W.mjs → chunk-HREB7UR4.mjs} +10 -4
  46. package/dist/{chunk-NSEFNNU4.mjs → chunk-ILETUFUD.mjs} +302 -105
  47. package/dist/{chunk-A3WPLSDT.mjs → chunk-INTLFB63.mjs} +1 -1
  48. package/dist/{chunk-SBACDPNX.mjs → chunk-JCQMC6HH.mjs} +216 -27
  49. package/dist/{chunk-3FA7FKAV.mjs → chunk-JGVOZSXS.mjs} +58 -4
  50. package/dist/{chunk-M52VMPGA.mjs → chunk-KZFYCMBL.mjs} +1 -1
  51. package/dist/{chunk-W5KKPZT5.mjs → chunk-L7BXB5H3.mjs} +2 -2
  52. package/dist/{chunk-B2GV2BWH.mjs → chunk-MF4S2WSM.mjs} +2 -2
  53. package/dist/{chunk-R6JJQHFC.mjs → chunk-NXA6FD7R.mjs} +1 -1
  54. package/dist/{chunk-XGI4EMS3.mjs → chunk-OPACR7PX.mjs} +3 -3
  55. package/dist/{chunk-2OALJTK6.mjs → chunk-OV4WR3EC.mjs} +22 -42
  56. package/dist/{chunk-YZNBLFIW.mjs → chunk-RH3QV6E6.mjs} +3 -3
  57. package/dist/{chunk-LDKCUMHK.mjs → chunk-RQ3N4DIB.mjs} +2 -2
  58. package/dist/{chunk-YV4Y7SDL.mjs → chunk-TGBLNY5L.mjs} +2 -2
  59. package/dist/{chunk-GZ6DCQKC.mjs → chunk-TVG3WU6C.mjs} +5 -3
  60. package/dist/{chunk-AK6Z23OX.mjs → chunk-UGB6MLR6.mjs} +274 -45
  61. package/dist/{chunk-2Q2SX2CS.mjs → chunk-V5DUKEYT.mjs} +2 -2
  62. package/dist/{chunk-UOP63Q54.mjs → chunk-WRGCEERR.mjs} +1 -1
  63. package/dist/{chunk-O3QHXMOX.mjs → chunk-XCT6CROA.mjs} +23 -19
  64. package/dist/{chunk-P7NH2OSC.mjs → chunk-ZDNGCKSZ.mjs} +78 -49
  65. package/dist/cli/nextly.mjs +1 -1
  66. package/dist/cli/utils/index.d.ts +2 -2
  67. package/dist/cli/utils/index.mjs +1 -1
  68. package/dist/{component-schema-service-5577KVW6.mjs → component-schema-service-HUAQQ4H5.mjs} +2 -2
  69. package/dist/config.d.ts +3 -3
  70. package/dist/database/index.d.ts +2 -2
  71. package/dist/database/index.mjs +3 -3
  72. package/dist/database/seeders/index.mjs +18 -18
  73. package/dist/{db-sync-demote-LJGKLB3S.mjs → db-sync-demote-M7IEFD6N.mjs} +6 -6
  74. package/dist/{db-sync-promote-B26VSYQF.mjs → db-sync-promote-2MCB5JRZ.mjs} +6 -6
  75. package/dist/{dynamic-collection-schema-service-IEXTPIZ7.mjs → dynamic-collection-schema-service-FIRWOXZI.mjs} +2 -2
  76. package/dist/{factory-IWMBKUJM.mjs → factory-UGJGOZZ7.mjs} +2 -2
  77. package/dist/index.d.ts +16 -11
  78. package/dist/index.mjs +24 -55
  79. package/dist/{permissions-3DZZQZMI.mjs → permissions-KH3WCGAR.mjs} +16 -16
  80. package/dist/{pipeline-YOML7SWF.mjs → pipeline-JLANATHU.mjs} +10 -10
  81. package/dist/{preview-ZZTR3QGS.mjs → preview-3RSMZITY.mjs} +3 -3
  82. package/dist/{program-PW6UB2ZC.mjs → program-6V6HLEUI.mjs} +27 -27
  83. package/dist/{register-SF6E6FVU.mjs → register-FCUTHDS5.mjs} +17 -17
  84. package/dist/{reload-config-HWQ4G5MM.mjs → reload-config-52GWTPZG.mjs} +10 -10
  85. package/dist/{routeHandler-UNMMJIBM.mjs → routeHandler-FP26UQPJ.mjs} +26 -26
  86. package/dist/{runtime-schema-generator-NRA6A6Z6.mjs → runtime-schema-generator-NQOLDUDG.mjs} +2 -2
  87. package/dist/runtime.d.ts +2 -2
  88. package/dist/runtime.mjs +26 -26
  89. package/dist/{super-admin-G5ZK5F4T.mjs → super-admin-XZAU4VQM.mjs} +16 -16
  90. package/dist/{system-table-service-WGSRVEGT.mjs → system-table-service-5FIVIALU.mjs} +5 -5
  91. package/dist/{users-7KELGRYJ.mjs → users-K2NJTF55.mjs} +15 -15
  92. package/package.json +8 -8
  93. /package/dist/{first-run-QIVKWJIF.mjs → first-run-2UDWZK5X.mjs} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CollectionRegistryService
3
- } from "./chunk-3FA7FKAV.mjs";
3
+ } from "./chunk-JGVOZSXS.mjs";
4
4
  import {
5
5
  getAdapterFromDI,
6
6
  getCollectionRegistryFromDI,
@@ -27,29 +27,29 @@ import {
27
27
  getProductionNotifier,
28
28
  noopMigrationJournal,
29
29
  noopPreRenameExecutor
30
- } from "./chunk-AK6Z23OX.mjs";
30
+ } from "./chunk-UGB6MLR6.mjs";
31
31
  import {
32
32
  previewDesiredSchema
33
- } from "./chunk-GZ6DCQKC.mjs";
33
+ } from "./chunk-TVG3WU6C.mjs";
34
34
  import {
35
35
  RealClassifier,
36
36
  RegexRenameDetector,
37
37
  countNulls,
38
38
  countRows
39
- } from "./chunk-SBACDPNX.mjs";
39
+ } from "./chunk-JCQMC6HH.mjs";
40
40
  import {
41
41
  ComponentSchemaService
42
- } from "./chunk-V4EQTOA4.mjs";
42
+ } from "./chunk-4HUQNXVM.mjs";
43
43
  import {
44
44
  resolveSingleTableName
45
45
  } from "./chunk-I4JMR3UR.mjs";
46
46
  import {
47
47
  DynamicCollectionSchemaService,
48
48
  DynamicCollectionValidationService
49
- } from "./chunk-XZKLBMN6.mjs";
49
+ } from "./chunk-A75OLKXP.mjs";
50
50
  import {
51
51
  generateRuntimeSchema
52
- } from "./chunk-IZWPRDC3.mjs";
52
+ } from "./chunk-2QSGNGOB.mjs";
53
53
  import {
54
54
  calculateSchemaHash
55
55
  } from "./chunk-5HMZ644B.mjs";
@@ -65,11 +65,11 @@ import {
65
65
  listRoleSlugsForUser,
66
66
  validatePasswordStrength,
67
67
  verifyPassword
68
- } from "./chunk-W5KKPZT5.mjs";
68
+ } from "./chunk-L7BXB5H3.mjs";
69
69
  import {
70
70
  BaseService,
71
71
  normalizeDbTimestamp
72
- } from "./chunk-2W3DVD7S.mjs";
72
+ } from "./chunk-ERTNRSP3.mjs";
73
73
  import {
74
74
  apiKeys,
75
75
  apiKeys2,
@@ -90,13 +90,13 @@ import {
90
90
  userRoles,
91
91
  userRoles2,
92
92
  userRoles3
93
- } from "./chunk-TS7GHTG2.mjs";
93
+ } from "./chunk-A7GGVOIV.mjs";
94
94
  import {
95
95
  createAdapterFromEnv
96
- } from "./chunk-DP3G27G5.mjs";
96
+ } from "./chunk-35LAHTCU.mjs";
97
97
  import {
98
98
  env
99
- } from "./chunk-UJ2IMJ4W.mjs";
99
+ } from "./chunk-HREB7UR4.mjs";
100
100
  import {
101
101
  deleteImageSizes,
102
102
  generateImageSizes,
@@ -288,7 +288,7 @@ var AuthService = class extends BaseService {
288
288
  }
289
289
  let newUser;
290
290
  try {
291
- const userService = new (await import("./users-7KELGRYJ.mjs")).UsersService(this.adapter, this.logger);
291
+ const userService = new (await import("./users-K2NJTF55.mjs")).UsersService(this.adapter, this.logger);
292
292
  newUser = await userService.createLocalUser({
293
293
  email: userData.email,
294
294
  name: userData.name ?? "User",
@@ -3524,7 +3524,8 @@ var DynamicCollectionService = class extends BaseService {
3524
3524
  const schemaCode = this.schemaService.generateSchemaCode(
3525
3525
  tableName,
3526
3526
  normalizedName,
3527
- userDefinedFields
3527
+ userDefinedFields,
3528
+ { hasStatus: data.status === true }
3528
3529
  );
3529
3530
  const schemaHash = this.generateSchemaHash(userDefinedFields);
3530
3531
  const metadata = {
@@ -3643,7 +3644,8 @@ var DynamicCollectionService = class extends BaseService {
3643
3644
  schemaCode = this.schemaService.generateSchemaCode(
3644
3645
  collection.tableName,
3645
3646
  collectionName,
3646
- userDefinedFields
3647
+ userDefinedFields,
3648
+ { hasStatus }
3647
3649
  );
3648
3650
  schemaFileName = `${collectionName}.ts`;
3649
3651
  metadataUpdates.fields = userDefinedFields;
@@ -3910,10 +3912,7 @@ var CollectionFileManager = class {
3910
3912
  this.metadataFetcher = fetcher;
3911
3913
  }
3912
3914
  registerSchema(collectionName, schema) {
3913
- this.schemaRegistry.set(
3914
- `dc_${collectionName.replace(/-/g, "_")}`,
3915
- schema
3916
- );
3915
+ this.schemaRegistry.set(`dc_${collectionName.replace(/-/g, "_")}`, schema);
3917
3916
  }
3918
3917
  registerSchemas(schemas) {
3919
3918
  console.log(
@@ -3943,6 +3942,15 @@ var CollectionFileManager = class {
3943
3942
  refreshSchema(tableName, freshTable) {
3944
3943
  this.schemaRegistry.set(tableName, freshTable);
3945
3944
  }
3945
+ /**
3946
+ * Drop the slug-keyed cache entry so the lazy fetcher rebuilds the Drizzle
3947
+ * table from current `dynamic_collections` state. See `refreshSchema` for
3948
+ * the tableName-keyed variant used when the new table is already built.
3949
+ */
3950
+ invalidateSchemaForSlug(collectionName) {
3951
+ const schemaKey = `dc_${collectionName.replace(/-/g, "_")}`;
3952
+ this.schemaRegistry.delete(schemaKey);
3953
+ }
3946
3954
  async saveArtifacts(artifacts) {
3947
3955
  await fs.mkdir(this.schemasDir, { recursive: true });
3948
3956
  await fs.mkdir(this.migrationsDir, { recursive: true });
@@ -4160,6 +4168,10 @@ var CollectionService = class extends BaseService {
4160
4168
  registerDynamicSchemas(schemas) {
4161
4169
  this.metadataService.registerDynamicSchemas(schemas);
4162
4170
  }
4171
+ /** Drop the cached Drizzle schema for one slug so the next load rebuilds it. */
4172
+ invalidateSchemaForSlug(collectionName) {
4173
+ this.metadataService.invalidateSchemaForSlug(collectionName);
4174
+ }
4163
4175
  /**
4164
4176
  * Create a new collection
4165
4177
  *
@@ -5432,10 +5444,7 @@ var SchemaGenerator = class {
5432
5444
  lines.push(`}, (table) => [`);
5433
5445
  for (const field of indexedFields) {
5434
5446
  if (!isDataField(field)) continue;
5435
- const indexDef = this.generateIndexDefinition(
5436
- field,
5437
- tableName
5438
- );
5447
+ const indexDef = this.generateIndexDefinition(field, tableName);
5439
5448
  if (indexDef) {
5440
5449
  lines.push(indexDef);
5441
5450
  }
@@ -5488,8 +5497,8 @@ var SchemaGenerator = class {
5488
5497
  ].join("\n");
5489
5498
  }
5490
5499
  return [
5491
- ` createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),`,
5492
- ` updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow().$onUpdate(() => new Date()),`
5500
+ ` createdAt: timestamp("created_at", { withTimezone: false }).notNull().defaultNow(),`,
5501
+ ` updatedAt: timestamp("updated_at", { withTimezone: false }).notNull().defaultNow().$onUpdate(() => new Date()),`
5493
5502
  ].join("\n");
5494
5503
  }
5495
5504
  /**
@@ -5756,7 +5765,7 @@ var SchemaGenerator = class {
5756
5765
  const tsOptions = tsType.options ? `, ${tsType.options}` : "";
5757
5766
  return ` updatedAt: ${tsType.fn}("updated_at"${tsOptions}).notNull().$defaultFn(() => new Date()).$onUpdate(() => new Date()),`;
5758
5767
  }
5759
- return ` updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow().$onUpdate(() => new Date()),`;
5768
+ return ` updatedAt: timestamp("updated_at", { withTimezone: false }).notNull().defaultNow().$onUpdate(() => new Date()),`;
5760
5769
  }
5761
5770
  // ============================================================
5762
5771
  // Singles Relations Generation
@@ -7719,7 +7728,7 @@ var CollectionMetadataService = class extends BaseService {
7719
7728
  */
7720
7729
  async registerRuntimeSchema(tableName, fields, options) {
7721
7730
  try {
7722
- const { generateRuntimeSchema: generateRuntimeSchema2 } = await import("./runtime-schema-generator-NRA6A6Z6.mjs");
7731
+ const { generateRuntimeSchema: generateRuntimeSchema2 } = await import("./runtime-schema-generator-NQOLDUDG.mjs");
7723
7732
  const dialect = this.adapter.getCapabilities().dialect;
7724
7733
  const { table } = generateRuntimeSchema2(tableName, fields, dialect, {
7725
7734
  status: options?.hasStatus === true
@@ -7753,6 +7762,10 @@ var CollectionMetadataService = class extends BaseService {
7753
7762
  registerDynamicSchemas(schemas) {
7754
7763
  this.fileManager.registerSchemas(schemas);
7755
7764
  }
7765
+ /** Drop the cached Drizzle schema for one slug so the next load rebuilds it. */
7766
+ invalidateSchemaForSlug(collectionName) {
7767
+ this.fileManager.invalidateSchemaForSlug(collectionName);
7768
+ }
7756
7769
  /**
7757
7770
  * Create a new collection.
7758
7771
  * Generates schema, migration files, and registers the collection.
@@ -10297,6 +10310,10 @@ var CollectionMutationService = class extends BaseService {
10297
10310
  }
10298
10311
  }
10299
10312
  }
10313
+ /** Resolve the physical table for a collection, honoring `dbName` overrides. */
10314
+ resolveTableName(collection, slug) {
10315
+ return collection?.tableName || getTableName(slug);
10316
+ }
10300
10317
  /**
10301
10318
  * Wrapper around checkFieldUniqueness that matches the QueryDatabaseParams
10302
10319
  * signature expected by CollectionHookService.buildPrebuiltHookContext.
@@ -10403,6 +10420,10 @@ var CollectionMutationService = class extends BaseService {
10403
10420
  const storedHooks = this.hookService.getStoredHooks(
10404
10421
  collection
10405
10422
  );
10423
+ const tableName = this.resolveTableName(
10424
+ collection,
10425
+ params.collectionName
10426
+ );
10406
10427
  const sharedContext = { ...params.context };
10407
10428
  const beforeOpArgs = await this.hookService.hookRegistry.executeBeforeOperation({
10408
10429
  collection: params.collectionName,
@@ -10566,11 +10587,9 @@ var CollectionMutationService = class extends BaseService {
10566
10587
  }
10567
10588
  const entry = {};
10568
10589
  await this.adapter.transaction(async (tx) => {
10569
- const rawEntry = await tx.insert(
10570
- getTableName(params.collectionName),
10571
- entryData,
10572
- { returning: "*" }
10573
- );
10590
+ const rawEntry = await tx.insert(tableName, entryData, {
10591
+ returning: "*"
10592
+ });
10574
10593
  for (const [key, value] of Object.entries(
10575
10594
  rawEntry
10576
10595
  )) {
@@ -10579,7 +10598,7 @@ var CollectionMutationService = class extends BaseService {
10579
10598
  if (this.componentDataService && Object.keys(componentFieldData).length > 0) {
10580
10599
  await this.componentDataService.saveComponentDataInTransaction(tx, {
10581
10600
  parentId: entry.id,
10582
- parentTable: getTableName(params.collectionName),
10601
+ parentTable: tableName,
10583
10602
  fields,
10584
10603
  data: componentFieldData
10585
10604
  });
@@ -10699,6 +10718,10 @@ var CollectionMutationService = class extends BaseService {
10699
10718
  const storedHooks = this.hookService.getStoredHooks(
10700
10719
  collection
10701
10720
  );
10721
+ const tableName = this.resolveTableName(
10722
+ collection,
10723
+ params.collectionName
10724
+ );
10702
10725
  const sharedContext = { ...params.context };
10703
10726
  const beforeOpArgs = await this.hookService.hookRegistry.executeBeforeOperation({
10704
10727
  collection: params.collectionName,
@@ -10857,7 +10880,6 @@ var CollectionMutationService = class extends BaseService {
10857
10880
  })
10858
10881
  );
10859
10882
  }
10860
- const tableName = getTableName(params.collectionName);
10861
10883
  await this.adapter.transaction(async (tx) => {
10862
10884
  const updatePayload = { ...finalData, updatedAt: /* @__PURE__ */ new Date() };
10863
10885
  const isMysql = this.dialect === "mysql";
@@ -11011,6 +11033,10 @@ var CollectionMutationService = class extends BaseService {
11011
11033
  const storedHooks = this.hookService.getStoredHooks(
11012
11034
  collection
11013
11035
  );
11036
+ const tableName = this.resolveTableName(
11037
+ collection,
11038
+ params.collectionName
11039
+ );
11014
11040
  const sharedContext = { ...params.context };
11015
11041
  await this.hookService.hookRegistry.executeBeforeOperation({
11016
11042
  collection: params.collectionName,
@@ -11046,7 +11072,7 @@ var CollectionMutationService = class extends BaseService {
11046
11072
  const collectionFields = collection.schemaDefinition?.fields || collection.fields || [];
11047
11073
  await this.componentDataService.deleteComponentData({
11048
11074
  parentId: params.entryId,
11049
- parentTable: getTableName(params.collectionName),
11075
+ parentTable: tableName,
11050
11076
  fields: collectionFields
11051
11077
  });
11052
11078
  }
@@ -11126,7 +11152,6 @@ var CollectionMutationService = class extends BaseService {
11126
11152
  if (accessDenied) {
11127
11153
  return accessDenied;
11128
11154
  }
11129
- const tableName = getTableName(params.collectionName);
11130
11155
  const collection = await this.collectionService.getCollection(
11131
11156
  params.collectionName
11132
11157
  );
@@ -11134,6 +11159,10 @@ var CollectionMutationService = class extends BaseService {
11134
11159
  const storedHooks = this.hookService.getStoredHooks(
11135
11160
  collection
11136
11161
  );
11162
+ const tableName = this.resolveTableName(
11163
+ collection,
11164
+ params.collectionName
11165
+ );
11137
11166
  const sharedContext = {};
11138
11167
  const beforeOpArgs = await this.hookService.hookRegistry.executeBeforeOperation({
11139
11168
  collection: params.collectionName,
@@ -11272,7 +11301,17 @@ var CollectionMutationService = class extends BaseService {
11272
11301
  */
11273
11302
  async updateEntryInTransaction(tx, params, body) {
11274
11303
  try {
11275
- const tableName = getTableName(params.collectionName);
11304
+ const collection = await this.collectionService.getCollection(
11305
+ params.collectionName
11306
+ );
11307
+ const fields = collection.schemaDefinition?.fields || collection.fields || [];
11308
+ const storedHooks = this.hookService.getStoredHooks(
11309
+ collection
11310
+ );
11311
+ const tableName = this.resolveTableName(
11312
+ collection,
11313
+ params.collectionName
11314
+ );
11276
11315
  const existingEntry = await tx.selectOne(
11277
11316
  tableName,
11278
11317
  {
@@ -11297,13 +11336,6 @@ var CollectionMutationService = class extends BaseService {
11297
11336
  if (accessDenied) {
11298
11337
  return accessDenied;
11299
11338
  }
11300
- const collection = await this.collectionService.getCollection(
11301
- params.collectionName
11302
- );
11303
- const fields = collection.schemaDefinition?.fields || collection.fields || [];
11304
- const storedHooks = this.hookService.getStoredHooks(
11305
- collection
11306
- );
11307
11339
  const sharedContext = {};
11308
11340
  const beforeOpArgs = await this.hookService.hookRegistry.executeBeforeOperation({
11309
11341
  collection: params.collectionName,
@@ -11457,7 +11489,16 @@ var CollectionMutationService = class extends BaseService {
11457
11489
  */
11458
11490
  async deleteEntryInTransaction(tx, params) {
11459
11491
  try {
11460
- const tableName = getTableName(params.collectionName);
11492
+ const collection = await this.collectionService.getCollection(
11493
+ params.collectionName
11494
+ );
11495
+ const storedHooks = this.hookService.getStoredHooks(
11496
+ collection
11497
+ );
11498
+ const tableName = this.resolveTableName(
11499
+ collection,
11500
+ params.collectionName
11501
+ );
11461
11502
  const entry = await tx.selectOne(tableName, {
11462
11503
  where: this.whereEq("id", params.entryId)
11463
11504
  });
@@ -11473,12 +11514,6 @@ var CollectionMutationService = class extends BaseService {
11473
11514
  if (accessDenied) {
11474
11515
  return accessDenied;
11475
11516
  }
11476
- const collection = await this.collectionService.getCollection(
11477
- params.collectionName
11478
- );
11479
- const storedHooks = this.hookService.getStoredHooks(
11480
- collection
11481
- );
11482
11517
  const sharedContext = {};
11483
11518
  await this.hookService.hookRegistry.executeBeforeOperation({
11484
11519
  collection: params.collectionName,
@@ -11584,7 +11619,6 @@ var CollectionMutationService = class extends BaseService {
11584
11619
  */
11585
11620
  async createSingleEntryInTransaction(tx, params, body, skipHooks) {
11586
11621
  try {
11587
- const tableName = getTableName(params.collectionName);
11588
11622
  const collection = await this.collectionService.getCollection(
11589
11623
  params.collectionName
11590
11624
  );
@@ -11592,6 +11626,10 @@ var CollectionMutationService = class extends BaseService {
11592
11626
  const storedHooks = this.hookService.getStoredHooks(
11593
11627
  collection
11594
11628
  );
11629
+ const tableName = this.resolveTableName(
11630
+ collection,
11631
+ params.collectionName
11632
+ );
11595
11633
  let currentData = { ...body };
11596
11634
  const sharedContext = {};
11597
11635
  if (!skipHooks) {
@@ -11745,13 +11783,26 @@ var CollectionMutationService = class extends BaseService {
11745
11783
  */
11746
11784
  async updateSingleEntryInTransaction(tx, params, entryId, body, skipHooks) {
11747
11785
  try {
11748
- const tableName = getTableName(params.collectionName);
11786
+ const collection = await this.collectionService.getCollection(
11787
+ params.collectionName
11788
+ );
11789
+ const fields = collection.schemaDefinition?.fields || collection.fields || [];
11790
+ const storedHooks = this.hookService.getStoredHooks(
11791
+ collection
11792
+ );
11793
+ const tableName = this.resolveTableName(
11794
+ collection,
11795
+ params.collectionName
11796
+ );
11749
11797
  const ownerConstraint = await this.accessService.getOwnerConstraint(
11750
11798
  params.collectionName,
11751
11799
  "update",
11752
11800
  params.user
11753
11801
  );
11754
- const fetchWhere = ownerConstraint ? this.whereAnd({ id: entryId, [ownerConstraint.field]: ownerConstraint.value }) : this.whereEq("id", entryId);
11802
+ const fetchWhere = ownerConstraint ? this.whereAnd({
11803
+ id: entryId,
11804
+ [ownerConstraint.field]: ownerConstraint.value
11805
+ }) : this.whereEq("id", entryId);
11755
11806
  const existingEntry = await tx.selectOne(
11756
11807
  tableName,
11757
11808
  { where: fetchWhere }
@@ -11764,9 +11815,6 @@ var CollectionMutationService = class extends BaseService {
11764
11815
  data: null
11765
11816
  };
11766
11817
  }
11767
- const collection = await this.collectionService.getCollection(
11768
- params.collectionName
11769
- );
11770
11818
  const accessRules = this.accessService.getAccessRules(
11771
11819
  collection
11772
11820
  );
@@ -11782,10 +11830,6 @@ var CollectionMutationService = class extends BaseService {
11782
11830
  };
11783
11831
  }
11784
11832
  }
11785
- const fields = collection.schemaDefinition?.fields || collection.fields || [];
11786
- const storedHooks = this.hookService.getStoredHooks(
11787
- collection
11788
- );
11789
11833
  let currentData = { ...body };
11790
11834
  const sharedContext = {};
11791
11835
  if (!skipHooks) {
@@ -11954,13 +11998,22 @@ var CollectionMutationService = class extends BaseService {
11954
11998
  */
11955
11999
  async deleteSingleEntryInTransaction(tx, params, entryId, skipHooks) {
11956
12000
  try {
11957
- const tableName = getTableName(params.collectionName);
12001
+ const collection = await this.collectionService.getCollection(
12002
+ params.collectionName
12003
+ );
12004
+ const tableName = this.resolveTableName(
12005
+ collection,
12006
+ params.collectionName
12007
+ );
11958
12008
  const ownerConstraint = await this.accessService.getOwnerConstraint(
11959
12009
  params.collectionName,
11960
12010
  "delete",
11961
12011
  params.user
11962
12012
  );
11963
- const fetchWhere = ownerConstraint ? this.whereAnd({ id: entryId, [ownerConstraint.field]: ownerConstraint.value }) : this.whereEq("id", entryId);
12013
+ const fetchWhere = ownerConstraint ? this.whereAnd({
12014
+ id: entryId,
12015
+ [ownerConstraint.field]: ownerConstraint.value
12016
+ }) : this.whereEq("id", entryId);
11964
12017
  const entry = await tx.selectOne(tableName, {
11965
12018
  where: fetchWhere
11966
12019
  });
@@ -11972,9 +12025,6 @@ var CollectionMutationService = class extends BaseService {
11972
12025
  data: null
11973
12026
  };
11974
12027
  }
11975
- const collection = await this.collectionService.getCollection(
11976
- params.collectionName
11977
- );
11978
12028
  const accessRules = this.accessService.getAccessRules(
11979
12029
  collection
11980
12030
  );
@@ -14402,6 +14452,98 @@ var CollectionEntryService = class extends BaseService {
14402
14452
 
14403
14453
  // src/domains/collections/services/collection-relationship-service.ts
14404
14454
  import { eq as eq11, inArray as inArray6, sql as sql5 } from "drizzle-orm";
14455
+
14456
+ // src/shared/lib/get-base-url.ts
14457
+ function getBaseUrl(override) {
14458
+ const raw = override?.trim() || env.NEXT_PUBLIC_APP_URL?.trim();
14459
+ const url = raw || "http://localhost:3000";
14460
+ return url.replace(/\/+$/, "");
14461
+ }
14462
+
14463
+ // src/lib/media-variant.ts
14464
+ function getMediaVariant(media, name, options = {}) {
14465
+ if (!media) return void 0;
14466
+ const { fallback, preferThumbnail = true } = options;
14467
+ const sizes = media.sizes ?? null;
14468
+ if (sizes) {
14469
+ const direct = sizes[name];
14470
+ if (direct?.url) return direct.url;
14471
+ if (fallback) {
14472
+ const fb = sizes[fallback];
14473
+ if (fb?.url) return fb.url;
14474
+ }
14475
+ }
14476
+ if (preferThumbnail && media.thumbnailUrl) return media.thumbnailUrl;
14477
+ return media.url;
14478
+ }
14479
+ function getSmallestMediaVariant(media) {
14480
+ if (!media) return void 0;
14481
+ const sizes = media.sizes ?? null;
14482
+ if (sizes) {
14483
+ const entries = Object.values(sizes).filter(
14484
+ (v) => v?.url && v.width && v.height
14485
+ );
14486
+ if (entries.length > 0) {
14487
+ const smallest = entries.reduce(
14488
+ (acc, cur) => (cur.width ?? 0) * (cur.height ?? 0) < (acc.width ?? 0) * (acc.height ?? 0) ? cur : acc
14489
+ );
14490
+ return smallest.url;
14491
+ }
14492
+ }
14493
+ return media.thumbnailUrl ?? media.url;
14494
+ }
14495
+ function getMediaBaseUrl() {
14496
+ return getBaseUrl();
14497
+ }
14498
+ function isAbsoluteUrl(url) {
14499
+ return /^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(url);
14500
+ }
14501
+ function toAbsoluteMediaUrl(url, baseUrl) {
14502
+ if (!url) return url;
14503
+ if (isAbsoluteUrl(url)) return url;
14504
+ const resolvedBase = baseUrl ?? getMediaBaseUrl();
14505
+ const path3 = url.startsWith("/") ? url : `/${url}`;
14506
+ return `${resolvedBase}${path3}`;
14507
+ }
14508
+ function normalizeSizes(value) {
14509
+ if (value && typeof value === "object" && !Array.isArray(value)) {
14510
+ return value;
14511
+ }
14512
+ if (typeof value === "string") {
14513
+ try {
14514
+ const parsed = JSON.parse(value);
14515
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
14516
+ return parsed;
14517
+ }
14518
+ } catch {
14519
+ }
14520
+ }
14521
+ return null;
14522
+ }
14523
+ function absolutizeMediaUrls(row, baseUrl) {
14524
+ const hasSizesKey = "sizes" in row;
14525
+ const normalizedSizes = normalizeSizes(row.sizes);
14526
+ let absolutizedSizes = normalizedSizes;
14527
+ if (normalizedSizes) {
14528
+ absolutizedSizes = Object.fromEntries(
14529
+ Object.entries(normalizedSizes).map(([name, variant]) => [
14530
+ name,
14531
+ variant && typeof variant === "object" ? {
14532
+ ...variant,
14533
+ url: toAbsoluteMediaUrl(variant.url ?? null, baseUrl)
14534
+ } : variant
14535
+ ])
14536
+ );
14537
+ }
14538
+ return {
14539
+ ...row,
14540
+ url: toAbsoluteMediaUrl(row.url ?? null, baseUrl),
14541
+ thumbnailUrl: toAbsoluteMediaUrl(row.thumbnailUrl ?? null, baseUrl),
14542
+ ...hasSizesKey ? { sizes: absolutizedSizes } : {}
14543
+ };
14544
+ }
14545
+
14546
+ // src/domains/collections/services/collection-relationship-service.ts
14405
14547
  var DEFAULT_RELATIONSHIP_DEPTH = 2;
14406
14548
  var MAX_RELATIONSHIP_DEPTH = 5;
14407
14549
  function isRelationshipField3(field) {
@@ -15327,7 +15469,10 @@ var CollectionRelationshipService = class extends BaseService {
15327
15469
  return [];
15328
15470
  }
15329
15471
  const rows = await this.db.select().from(mediaTable).where(inArray6(mediaTable.id, ids));
15330
- return rows.map((row) => keysToCamelCase(row));
15472
+ return rows.map((row) => {
15473
+ const camel = keysToCamelCase(row);
15474
+ return absolutizeMediaUrls(camel);
15475
+ });
15331
15476
  } catch (error) {
15332
15477
  console.error("Failed to fetch media by IDs:", error);
15333
15478
  return [];
@@ -15751,7 +15896,8 @@ var CollectionsHandler = class {
15751
15896
  const fields = typeof result.fields === "string" ? JSON.parse(result.fields) : result.fields;
15752
15897
  return {
15753
15898
  fields,
15754
- tableName: result.table_name,
15899
+ tableName: result.tableName,
15900
+ // SQLite returns 0/1 for booleans; PG/MySQL return real booleans.
15755
15901
  status: result.status === true || result.status === 1
15756
15902
  };
15757
15903
  }
@@ -18383,8 +18529,8 @@ var MediaService2 = class {
18383
18529
  width: data.width,
18384
18530
  height: data.height,
18385
18531
  duration: data.duration,
18386
- url: data.url,
18387
- thumbnailUrl: data.thumbnailUrl,
18532
+ url: toAbsoluteMediaUrl(data.url),
18533
+ thumbnailUrl: toAbsoluteMediaUrl(data.thumbnailUrl),
18388
18534
  altText: data.altText,
18389
18535
  caption: data.caption,
18390
18536
  tags: data.tags,
@@ -19760,7 +19906,8 @@ async function buildFullDesiredSchema() {
19760
19906
  desired.collections[c.slug] = {
19761
19907
  slug: c.slug,
19762
19908
  tableName: c.tableName,
19763
- fields: c.fields ?? []
19909
+ fields: c.fields ?? [],
19910
+ status: c.status === true
19764
19911
  };
19765
19912
  }
19766
19913
  } catch {
@@ -19775,7 +19922,8 @@ async function buildFullDesiredSchema() {
19775
19922
  desired.singles[s.slug] = {
19776
19923
  slug: s.slug,
19777
19924
  tableName: s.tableName,
19778
- fields: s.fields ?? []
19925
+ fields: s.fields ?? [],
19926
+ status: s.status === true
19779
19927
  };
19780
19928
  }
19781
19929
  } catch {
@@ -19809,9 +19957,7 @@ function shouldLogF14HintReceipt(hints) {
19809
19957
  function formatToastSummary(summary) {
19810
19958
  const parts = [];
19811
19959
  if (summary.added) {
19812
- parts.push(
19813
- `${summary.added} field${summary.added === 1 ? "" : "s"} added`
19814
- );
19960
+ parts.push(`${summary.added} field${summary.added === 1 ? "" : "s"} added`);
19815
19961
  }
19816
19962
  if (summary.renamed) parts.push(`${summary.renamed} renamed`);
19817
19963
  if (summary.changed) parts.push(`${summary.changed} changed`);
@@ -19888,7 +20034,9 @@ var COLLECTIONS_METHODS = {
19888
20034
  // Bare doc body (no { data } wrapper).
19889
20035
  execute: async (svc, p) => {
19890
20036
  requireParam(p, "collectionName");
19891
- const result = await svc.getCollection({ collectionName: p.collectionName });
20037
+ const result = await svc.getCollection({
20038
+ collectionName: p.collectionName
20039
+ });
19892
20040
  const collection = unwrapServiceResult(result, {
19893
20041
  slug: p.collectionName
19894
20042
  });
@@ -19957,7 +20105,10 @@ var COLLECTIONS_METHODS = {
19957
20105
  desired.collections[p.collectionName] = {
19958
20106
  slug: p.collectionName,
19959
20107
  tableName,
19960
- fields
20108
+ fields,
20109
+ // Carry the Draft/Published flag so previewDesiredSchema injects
20110
+ // the `status` column into the desired snapshot.
20111
+ status: collection.status === true
19961
20112
  };
19962
20113
  const pipelinePreview = await previewDesiredSchema({
19963
20114
  desired,
@@ -20039,7 +20190,10 @@ var COLLECTIONS_METHODS = {
20039
20190
  desired.collections[p.collectionName] = {
20040
20191
  slug: p.collectionName,
20041
20192
  tableName,
20042
- fields
20193
+ fields,
20194
+ // Mirror previewSchemaChanges so apply diffs against the same
20195
+ // desired schema preview classified.
20196
+ status: collection.status === true
20043
20197
  };
20044
20198
  const adapter = getAdapterFromDI();
20045
20199
  if (!adapter) {
@@ -20146,7 +20300,7 @@ var COLLECTIONS_METHODS = {
20146
20300
  );
20147
20301
  }
20148
20302
  try {
20149
- const { bumpSchemaVersion } = await import("./routeHandler-UNMMJIBM.mjs");
20303
+ const { bumpSchemaVersion } = await import("./routeHandler-FP26UQPJ.mjs");
20150
20304
  bumpSchemaVersion();
20151
20305
  } catch {
20152
20306
  }
@@ -20169,7 +20323,7 @@ var COLLECTIONS_METHODS = {
20169
20323
  sort = sortOrder === "desc" ? `-${p.sortBy}` : String(p.sortBy);
20170
20324
  }
20171
20325
  const rawLimit = p.limit;
20172
- const status = p.status === "all" || p.status === "draft" || p.status === "published" ? p.status : void 0;
20326
+ const status = p.status === "all" || p.status === "draft" || p.status === "published" ? p.status : "all";
20173
20327
  const result = await svc.listEntries({
20174
20328
  collectionName: p.collectionName,
20175
20329
  page: p.page !== void 0 ? parseInt(String(p.page), 10) : void 0,
@@ -20193,7 +20347,7 @@ var COLLECTIONS_METHODS = {
20193
20347
  // `{ totalDocs }` internally; we translate at the boundary.
20194
20348
  execute: async (svc, p) => {
20195
20349
  requireParam(p, "collectionName");
20196
- const status = p.status === "all" || p.status === "draft" || p.status === "published" ? p.status : void 0;
20350
+ const status = p.status === "all" || p.status === "draft" || p.status === "published" ? p.status : "all";
20197
20351
  const result = await svc.countEntries({
20198
20352
  collectionName: p.collectionName,
20199
20353
  search: p.search,
@@ -20233,7 +20387,7 @@ var COLLECTIONS_METHODS = {
20233
20387
  if (!p.collectionName || !p.entryId) {
20234
20388
  throw new Error("collectionName and entryId parameters are required");
20235
20389
  }
20236
- const status = p.status === "all" || p.status === "draft" || p.status === "published" ? p.status : void 0;
20390
+ const status = p.status === "all" || p.status === "draft" || p.status === "published" ? p.status : "all";
20237
20391
  const result = await svc.getEntry({
20238
20392
  collectionName: p.collectionName,
20239
20393
  entryId: p.entryId,
@@ -20443,11 +20597,24 @@ function registerComponentRuntimeSchema(adapter, dialect, tableName, fields) {
20443
20597
  tableName,
20444
20598
  fields
20445
20599
  );
20600
+ const registry = getSchemaRegistryFromDI();
20601
+ if (registry) {
20602
+ registry.registerDynamicSchema(tableName, runtimeTable);
20603
+ return;
20604
+ }
20446
20605
  const resolver = adapter.tableResolver;
20447
20606
  if (resolver && typeof resolver.registerDynamicSchema === "function") {
20448
20607
  resolver.registerDynamicSchema(tableName, runtimeTable);
20608
+ return;
20449
20609
  }
20450
- } catch {
20610
+ console.warn(
20611
+ `[registerComponentRuntimeSchema] No SchemaRegistry available for '${tableName}'. Component queries may reference old column names until next server restart.`
20612
+ );
20613
+ } catch (err) {
20614
+ const msg = err instanceof Error ? err.message : String(err);
20615
+ console.warn(
20616
+ `[registerComponentRuntimeSchema] In-memory schema refresh failed for '${tableName}': ${msg}. Component queries may reference old column names until next server restart.`
20617
+ );
20451
20618
  }
20452
20619
  }
20453
20620
  var COMPONENTS_METHODS = {
@@ -20576,10 +20743,7 @@ var COMPONENTS_METHODS = {
20576
20743
  );
20577
20744
  }
20578
20745
  }
20579
- const updated = await svc.registry.updateComponent(
20580
- slug,
20581
- updateData
20582
- );
20746
+ const updated = await svc.registry.updateComponent(slug, updateData);
20583
20747
  return respondMutation(`Component "${slug}" updated.`, updated);
20584
20748
  }
20585
20749
  },
@@ -20609,14 +20773,21 @@ var COMPONENTS_METHODS = {
20609
20773
  tableName,
20610
20774
  fields
20611
20775
  };
20612
- const pipelinePreview = await previewDesiredSchema({ desired, db, dialect });
20613
- const legacyShape = await translatePipelinePreviewToLegacy(pipelinePreview, {
20614
- tableName,
20615
- currentFields,
20616
- newFields: fields,
20776
+ const pipelinePreview = await previewDesiredSchema({
20777
+ desired,
20617
20778
  db,
20618
20779
  dialect
20619
20780
  });
20781
+ const legacyShape = await translatePipelinePreviewToLegacy(
20782
+ pipelinePreview,
20783
+ {
20784
+ tableName,
20785
+ currentFields,
20786
+ newFields: fields,
20787
+ db,
20788
+ dialect
20789
+ }
20790
+ );
20620
20791
  const renamed = pipelinePreview.candidates.map((c) => ({
20621
20792
  table: c.tableName,
20622
20793
  from: c.fromColumn,
@@ -20696,7 +20867,9 @@ var COMPONENTS_METHODS = {
20696
20867
  uiTargetSlug: slug
20697
20868
  });
20698
20869
  if (!result.success) {
20699
- throw new Error(result.error?.message ?? "Failed to apply schema changes");
20870
+ throw new Error(
20871
+ result.error?.message ?? "Failed to apply schema changes"
20872
+ );
20700
20873
  }
20701
20874
  try {
20702
20875
  await adapter.update(
@@ -20715,7 +20888,12 @@ var COMPONENTS_METHODS = {
20715
20888
  `[applyComponentSchemaChanges] Post-apply metadata write failed for '${slug}': ${msg}.`
20716
20889
  );
20717
20890
  }
20718
- registerComponentRuntimeSchema(adapter, dialect, tableName, fields);
20891
+ registerComponentRuntimeSchema(
20892
+ adapter,
20893
+ dialect,
20894
+ tableName,
20895
+ fields
20896
+ );
20719
20897
  const newSchemaVersion = currentVersion + 1;
20720
20898
  void schemaVersion;
20721
20899
  return respondAction(`Schema applied for component '${slug}'`, {
@@ -21208,7 +21386,7 @@ var SINGLES_METHODS = {
21208
21386
  if (tableExists) {
21209
21387
  migrationStatus = "applied";
21210
21388
  try {
21211
- const { generateRuntimeSchema: generateRuntimeSchema2 } = await import("./runtime-schema-generator-NRA6A6Z6.mjs");
21389
+ const { generateRuntimeSchema: generateRuntimeSchema2 } = await import("./runtime-schema-generator-NQOLDUDG.mjs");
21212
21390
  const dialect = adapter.getCapabilities().dialect;
21213
21391
  const { table: runtimeTable } = generateRuntimeSchema2(
21214
21392
  tableName,
@@ -21281,7 +21459,7 @@ var SINGLES_METHODS = {
21281
21459
  execute: async (svc, p) => {
21282
21460
  const slug = requireParam(p, "slug", "Single slug");
21283
21461
  const richTextFormat = parseRichTextFormat(p.richTextFormat);
21284
- const status = p.status === "all" || p.status === "draft" || p.status === "published" ? p.status : void 0;
21462
+ const status = p.status === "all" || p.status === "draft" || p.status === "published" ? p.status : "all";
21285
21463
  const result = await svc.entry.get(slug, {
21286
21464
  depth: toNumber(p.depth),
21287
21465
  locale: p.locale,
@@ -21486,7 +21664,7 @@ var SINGLES_METHODS = {
21486
21664
  if (tableExistsAfter) {
21487
21665
  migrationStatus = "applied";
21488
21666
  try {
21489
- const { generateRuntimeSchema: generateRuntimeSchema2 } = await import("./runtime-schema-generator-NRA6A6Z6.mjs");
21667
+ const { generateRuntimeSchema: generateRuntimeSchema2 } = await import("./runtime-schema-generator-NQOLDUDG.mjs");
21490
21668
  const dialect = adapter.getCapabilities().dialect;
21491
21669
  const { table: runtimeTable } = generateRuntimeSchema2(
21492
21670
  tableName,
@@ -21548,16 +21726,26 @@ var SINGLES_METHODS = {
21548
21726
  desired.singles[slug] = {
21549
21727
  slug,
21550
21728
  tableName,
21551
- fields
21729
+ fields,
21730
+ // Carry the Draft/Published flag so previewDesiredSchema injects
21731
+ // the `status` column into the desired snapshot.
21732
+ status: single.status === true
21552
21733
  };
21553
- const pipelinePreview = await previewDesiredSchema({ desired, db, dialect });
21554
- const legacyShape = await translatePipelinePreviewToLegacy(pipelinePreview, {
21555
- tableName,
21556
- currentFields,
21557
- newFields: fields,
21734
+ const pipelinePreview = await previewDesiredSchema({
21735
+ desired,
21558
21736
  db,
21559
21737
  dialect
21560
21738
  });
21739
+ const legacyShape = await translatePipelinePreviewToLegacy(
21740
+ pipelinePreview,
21741
+ {
21742
+ tableName,
21743
+ currentFields,
21744
+ newFields: fields,
21745
+ db,
21746
+ dialect
21747
+ }
21748
+ );
21561
21749
  const renamed = pipelinePreview.candidates.map((c) => ({
21562
21750
  table: c.tableName,
21563
21751
  from: c.fromColumn,
@@ -21607,7 +21795,10 @@ var SINGLES_METHODS = {
21607
21795
  desired.singles[slug] = {
21608
21796
  slug,
21609
21797
  tableName,
21610
- fields
21798
+ fields,
21799
+ // Mirror previewSingleSchemaChanges so apply diffs against the
21800
+ // same desired schema.
21801
+ status: single.status === true
21611
21802
  };
21612
21803
  const promptDispatcher = new BrowserPromptDispatcher(
21613
21804
  renameResolutions ?? [],
@@ -21635,7 +21826,9 @@ var SINGLES_METHODS = {
21635
21826
  uiTargetSlug: slug
21636
21827
  });
21637
21828
  if (!result.success) {
21638
- throw new Error(result.error?.message ?? "Failed to apply schema changes");
21829
+ throw new Error(
21830
+ result.error?.message ?? "Failed to apply schema changes"
21831
+ );
21639
21832
  }
21640
21833
  try {
21641
21834
  await adapter.update(
@@ -25338,6 +25531,10 @@ export {
25338
25531
  transformRichTextFields,
25339
25532
  resolveStatusFilter,
25340
25533
  CollectionEntryService,
25534
+ getBaseUrl,
25535
+ getMediaVariant,
25536
+ getSmallestMediaVariant,
25537
+ toAbsoluteMediaUrl,
25341
25538
  CollectionRelationshipService,
25342
25539
  clampLimit2,
25343
25540
  parseWhereQuery,