nextjs-cms 0.9.36 → 0.9.38
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/LICENSE +21 -21
- package/README.md +279 -279
- package/dist/api/actions/files.d.ts.map +1 -1
- package/dist/api/actions/pages.d.ts +4 -3
- package/dist/api/actions/pages.d.ts.map +1 -1
- package/dist/api/actions/pages.js +1 -0
- package/dist/api/index.d.ts +974 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +13 -0
- package/dist/api/lib/serverActions.d.ts +49 -13
- package/dist/api/lib/serverActions.d.ts.map +1 -1
- package/dist/api/lib/serverActions.js +31 -103
- package/dist/api/root.d.ts +1916 -18
- package/dist/api/root.d.ts.map +1 -1
- package/dist/api/root.js +83 -18
- package/dist/api/routers/config.d.ts.map +1 -1
- package/dist/api/routers/gallery.d.ts +0 -1
- package/dist/api/routers/gallery.d.ts.map +1 -1
- package/dist/api/routers/gallery.js +8 -36
- package/dist/api/routers/hasItemsSection.d.ts +30 -5
- package/dist/api/routers/hasItemsSection.d.ts.map +1 -1
- package/dist/api/routers/navigation.d.ts +3 -3
- package/dist/api/routers/simpleSection.d.ts +15 -3
- package/dist/api/routers/simpleSection.d.ts.map +1 -1
- package/dist/api/trpc/root.d.ts +41 -7
- package/dist/api/trpc/root.d.ts.map +1 -1
- package/dist/api/trpc/routers/config.d.ts.map +1 -1
- package/dist/api/trpc/routers/hasItemsSection.d.ts.map +1 -1
- package/dist/api/trpc/routers/logs.d.ts +37 -4
- package/dist/api/trpc/routers/logs.d.ts.map +1 -1
- package/dist/api/trpc/routers/logs.js +92 -43
- package/dist/api/trpc/routers/navigation.d.ts +4 -3
- package/dist/api/trpc/routers/navigation.d.ts.map +1 -1
- package/dist/api/trpc/routers/simpleSection.d.ts.map +1 -1
- package/dist/api/trpc/server.d.ts +123 -21
- package/dist/api/trpc/server.d.ts.map +1 -1
- package/dist/auth/trpc.d.ts +1 -1
- package/dist/auth/trpc.d.ts.map +1 -1
- package/dist/auth/trpc.js +1 -0
- package/dist/cli/lib/db-config.js +10 -10
- package/dist/cli/lib/update-sections.d.ts.map +1 -1
- package/dist/cli/lib/update-sections.js +67 -34
- package/dist/core/config/config-loader.d.ts +2 -2
- package/dist/core/db/table-checker/MysqlTable.js +10 -10
- package/dist/core/factories/section-factory-with-esbuild.js +9 -9
- package/dist/core/factories/section-factory-with-jiti.js +9 -9
- package/dist/core/fields/date-range.d.ts +4 -4
- package/dist/core/fields/dateRange.d.ts +115 -0
- package/dist/core/fields/dateRange.d.ts.map +1 -0
- package/dist/core/fields/dateRange.js +149 -0
- package/dist/core/fields/slug.d.ts +55 -3
- package/dist/core/fields/slug.d.ts.map +1 -1
- package/dist/core/fields/slug.js +56 -2
- package/dist/core/sections/category.d.ts +4 -4
- package/dist/core/sections/hasItems.d.ts +4 -4
- package/dist/core/sections/section.d.ts +3 -3
- package/dist/core/sections/simple.d.ts +4 -4
- package/dist/logging/event-labels.d.ts +11 -0
- package/dist/logging/event-labels.d.ts.map +1 -0
- package/dist/logging/event-labels.js +14 -0
- package/dist/logging/log.d.ts +1 -1
- package/dist/logging/log.d.ts.map +1 -1
- package/dist/translations/base/en.d.ts +36 -0
- package/dist/translations/base/en.d.ts.map +1 -1
- package/dist/translations/base/en.js +36 -0
- package/dist/translations/client.d.ts +436 -4
- package/dist/translations/client.d.ts.map +1 -1
- package/dist/translations/locale-cookie.d.ts +24 -0
- package/dist/translations/locale-cookie.d.ts.map +1 -0
- package/dist/translations/locale-cookie.js +44 -0
- package/dist/translations/locale-utils.d.ts +8 -0
- package/dist/translations/locale-utils.d.ts.map +1 -0
- package/dist/translations/locale-utils.js +11 -0
- package/dist/translations/localization.d.ts +40 -0
- package/dist/translations/localization.d.ts.map +1 -0
- package/dist/translations/localization.js +48 -0
- package/dist/translations/server.d.ts +436 -4
- package/dist/translations/server.d.ts.map +1 -1
- package/dist/validators/dateRange.d.ts +11 -0
- package/dist/validators/dateRange.d.ts.map +1 -0
- package/dist/validators/dateRange.js +16 -0
- package/package.json +10 -3
- package/dist/api/client.d.ts +0 -30
- package/dist/api/client.d.ts.map +0 -1
- package/dist/api/client.js +0 -82
- package/dist/api/server.d.ts +0 -2748
- package/dist/api/server.d.ts.map +0 -1
- package/dist/api/server.js +0 -100
- package/dist/api/trpc/error-logging.d.ts +0 -14
- package/dist/api/trpc/error-logging.d.ts.map +0 -1
- package/dist/api/trpc/error-logging.js +0 -75
- package/dist/api/utils/async-caller-proxy.d.ts +0 -2
- package/dist/api/utils/async-caller-proxy.d.ts.map +0 -1
- package/dist/api/utils/async-caller-proxy.js +0 -36
- package/dist/api/utils/lazy-caller-proxy.d.ts +0 -2
- package/dist/api/utils/lazy-caller-proxy.d.ts.map +0 -1
- package/dist/api/utils/lazy-caller-proxy.js +0 -36
- package/dist/api/utils/router-types.d.ts +0 -7
- package/dist/api/utils/router-types.d.ts.map +0 -1
- package/dist/api/utils/router-types.js +0 -0
- package/dist/plugins/manifest.d.ts +0 -28
- package/dist/plugins/manifest.d.ts.map +0 -1
- package/dist/plugins/manifest.js +0 -83
- package/dist/plugins/registry.d.ts +0 -22
- package/dist/plugins/registry.d.ts.map +0 -1
- package/dist/plugins/registry.js +0 -25
- package/dist/utils/log.d.ts +0 -18
- package/dist/utils/log.d.ts.map +0 -1
- package/dist/utils/log.js +0 -28
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/api/trpc/server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAUjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAEvF,MAAM,WAAW,uBAAuB,CAAC,K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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAtFj2B,OAAO,CAAC,SAAS,CAAC;EAqFvD"}
|
package/dist/auth/trpc.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import type { TRPCLink } from '@trpc/client';
|
|
|
2
2
|
/**
|
|
3
3
|
* tRPC link that refreshes the token if it's expired
|
|
4
4
|
*/
|
|
5
|
-
export declare const refreshTokenLink: () => TRPCLink
|
|
5
|
+
export declare const refreshTokenLink: () => TRPCLink</*AppRouter*/ any>;
|
|
6
6
|
//# sourceMappingURL=trpc.d.ts.map
|
package/dist/auth/trpc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trpc.d.ts","sourceRoot":"","sources":["../../src/auth/trpc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"trpc.d.ts","sourceRoot":"","sources":["../../src/auth/trpc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAM5C;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAO,QAAQ,CAAC,aAAa,CAAC,GAAG,CA6E7D,CAAA"}
|
package/dist/auth/trpc.js
CHANGED
|
@@ -140,16 +140,16 @@ export async function dbConfigSetup(options) {
|
|
|
140
140
|
/**
|
|
141
141
|
* Prepare new environment variables block
|
|
142
142
|
*/
|
|
143
|
-
const newEnvBlock = `
|
|
144
|
-
|
|
145
|
-
####
|
|
146
|
-
# generated by the init script
|
|
147
|
-
####
|
|
148
|
-
DB_HOST=${dbHost}
|
|
149
|
-
DB_PORT=${dbPort}
|
|
150
|
-
DB_NAME=${dbName}
|
|
151
|
-
DB_USER=${dbUser}
|
|
152
|
-
DB_PASSWORD='${dbPassword}'
|
|
143
|
+
const newEnvBlock = `
|
|
144
|
+
|
|
145
|
+
####
|
|
146
|
+
# generated by the init script
|
|
147
|
+
####
|
|
148
|
+
DB_HOST=${dbHost}
|
|
149
|
+
DB_PORT=${dbPort}
|
|
150
|
+
DB_NAME=${dbName}
|
|
151
|
+
DB_USER=${dbUser}
|
|
152
|
+
DB_PASSWORD='${dbPassword}'
|
|
153
153
|
`;
|
|
154
154
|
/**
|
|
155
155
|
* Append the new credentials to the .env file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-sections.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/update-sections.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-sections.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/update-sections.ts"],"names":[],"mappings":"AAumFA,wBAAsB,cAAc,CAAC,SAAS,UAAQ,iBAoBrD"}
|
|
@@ -508,17 +508,17 @@ function buildLocaleFieldConfig() {
|
|
|
508
508
|
});
|
|
509
509
|
}
|
|
510
510
|
async function createEditorPhotosTable(localized) {
|
|
511
|
-
await db.execute(sql `
|
|
512
|
-
CREATE TABLE IF NOT EXISTS \`editor_photos\` (
|
|
513
|
-
\`photo\` VARCHAR(100) NOT NULL PRIMARY KEY,
|
|
514
|
-
\`section\` VARCHAR(100) NOT NULL,
|
|
515
|
-
\`item_id\` VARCHAR(50) NOT NULL,
|
|
516
|
-
\`field\` VARCHAR(100) NOT NULL,
|
|
517
|
-
\`meta\` LONGTEXT,
|
|
518
|
-
${localized ? sql `\`locale\` VARCHAR(10) NOT NULL,` : sql ``}
|
|
519
|
-
\`linked\` BOOLEAN DEFAULT false,
|
|
520
|
-
\`created_at\` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
521
|
-
)
|
|
511
|
+
await db.execute(sql `
|
|
512
|
+
CREATE TABLE IF NOT EXISTS \`editor_photos\` (
|
|
513
|
+
\`photo\` VARCHAR(100) NOT NULL PRIMARY KEY,
|
|
514
|
+
\`section\` VARCHAR(100) NOT NULL,
|
|
515
|
+
\`item_id\` VARCHAR(50) NOT NULL,
|
|
516
|
+
\`field\` VARCHAR(100) NOT NULL,
|
|
517
|
+
\`meta\` LONGTEXT,
|
|
518
|
+
${localized ? sql `\`locale\` VARCHAR(10) NOT NULL,` : sql ``}
|
|
519
|
+
\`linked\` BOOLEAN DEFAULT false,
|
|
520
|
+
\`created_at\` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
521
|
+
)
|
|
522
522
|
`);
|
|
523
523
|
}
|
|
524
524
|
async function ensureEditorPhotosLocaleColumn(defaultLocaleCode, knownColumns) {
|
|
@@ -1134,24 +1134,24 @@ const main = async (spinnerObject) => {
|
|
|
1134
1134
|
* Let's see if the table `__nextjs_cms_tables` exists in the database.
|
|
1135
1135
|
* If it doesn't, we'll create it using the same schema as `NextJsCmsTablesTable`.
|
|
1136
1136
|
*/
|
|
1137
|
-
await db.execute(sql `
|
|
1138
|
-
CREATE TABLE IF NOT EXISTS __nextjs_cms_tables (
|
|
1139
|
-
name VARCHAR(100) NOT NULL PRIMARY KEY,
|
|
1140
|
-
section VARCHAR(200),
|
|
1141
|
-
config LONGTEXT,
|
|
1142
|
-
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
1143
|
-
)
|
|
1137
|
+
await db.execute(sql `
|
|
1138
|
+
CREATE TABLE IF NOT EXISTS __nextjs_cms_tables (
|
|
1139
|
+
name VARCHAR(100) NOT NULL PRIMARY KEY,
|
|
1140
|
+
section VARCHAR(200),
|
|
1141
|
+
config LONGTEXT,
|
|
1142
|
+
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
1143
|
+
)
|
|
1144
1144
|
`);
|
|
1145
1145
|
await ensureTableRegistryConfigColumn();
|
|
1146
1146
|
/**
|
|
1147
1147
|
* Persistent key/value store for CMS-level state that must survive config removal.
|
|
1148
1148
|
*/
|
|
1149
|
-
await db.execute(sql `
|
|
1150
|
-
CREATE TABLE IF NOT EXISTS __nextjs_cms_config (
|
|
1151
|
-
\`key\` VARCHAR(100) NOT NULL PRIMARY KEY,
|
|
1152
|
-
\`value\` LONGTEXT,
|
|
1153
|
-
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
|
1154
|
-
)
|
|
1149
|
+
await db.execute(sql `
|
|
1150
|
+
CREATE TABLE IF NOT EXISTS __nextjs_cms_config (
|
|
1151
|
+
\`key\` VARCHAR(100) NOT NULL PRIMARY KEY,
|
|
1152
|
+
\`value\` LONGTEXT,
|
|
1153
|
+
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
|
1154
|
+
)
|
|
1155
1155
|
`);
|
|
1156
1156
|
await db.execute(sql `ALTER TABLE \`__nextjs_cms_config\` MODIFY COLUMN \`value\` LONGTEXT`);
|
|
1157
1157
|
/**
|
|
@@ -1186,38 +1186,63 @@ const main = async (spinnerObject) => {
|
|
|
1186
1186
|
fields: getLocalizedAssetFields(s.fieldConfigs),
|
|
1187
1187
|
});
|
|
1188
1188
|
if (s.db.table.endsWith(RESERVED_TABLE_SUFFIX)) {
|
|
1189
|
-
configurationErrors.push(
|
|
1189
|
+
configurationErrors.push({
|
|
1190
|
+
kind: 'reservedLocalizationName',
|
|
1191
|
+
message: `Section '${s.name}': table name '${s.db.table}' ends with reserved suffix '${RESERVED_TABLE_SUFFIX}'.`,
|
|
1192
|
+
});
|
|
1190
1193
|
}
|
|
1191
1194
|
for (const field of s.fields) {
|
|
1192
1195
|
if (field.name === RESERVED_COLUMN_NAME) {
|
|
1193
|
-
configurationErrors.push(
|
|
1196
|
+
configurationErrors.push({
|
|
1197
|
+
kind: 'reservedLocalizationName',
|
|
1198
|
+
message: `Section '${s.name}', field '${field.name}': field name '${RESERVED_COLUMN_NAME}' is reserved.`,
|
|
1199
|
+
});
|
|
1194
1200
|
}
|
|
1195
1201
|
if (field.destinationDb) {
|
|
1196
1202
|
if (field.destinationDb.table.endsWith(RESERVED_TABLE_SUFFIX)) {
|
|
1197
|
-
configurationErrors.push(
|
|
1203
|
+
configurationErrors.push({
|
|
1204
|
+
kind: 'reservedLocalizationName',
|
|
1205
|
+
message: `Section '${s.name}', field '${field.name}': destinationDb.table '${field.destinationDb.table}' ends with reserved suffix '${RESERVED_TABLE_SUFFIX}'.`,
|
|
1206
|
+
});
|
|
1198
1207
|
}
|
|
1199
1208
|
if (field.destinationDb.itemIdentifier === RESERVED_COLUMN_NAME ||
|
|
1200
1209
|
field.destinationDb.selectIdentifier === RESERVED_COLUMN_NAME) {
|
|
1201
|
-
configurationErrors.push(
|
|
1210
|
+
configurationErrors.push({
|
|
1211
|
+
kind: 'reservedLocalizationName',
|
|
1212
|
+
message: `Section '${s.name}', field '${field.name}': destinationDb identifier column name '${RESERVED_COLUMN_NAME}' is reserved.`,
|
|
1213
|
+
});
|
|
1202
1214
|
}
|
|
1203
1215
|
}
|
|
1204
1216
|
if (isExternalSelectDbField(field)) {
|
|
1205
1217
|
const ownerSectionName = managedSectionTables.get(field.db.table);
|
|
1206
1218
|
if (ownerSectionName) {
|
|
1207
|
-
configurationErrors.push(
|
|
1219
|
+
configurationErrors.push({
|
|
1220
|
+
kind: 'managedSectionTable',
|
|
1221
|
+
message: `Section '${s.name}', field '${field.name}': db.table '${field.db.table}' belongs to managed section '${ownerSectionName}'. Use the 'section' prop instead of 'db' so update-sections does not treat the section table as an external lookup table.`,
|
|
1222
|
+
});
|
|
1223
|
+
continue;
|
|
1208
1224
|
}
|
|
1209
1225
|
if (field.db.table.endsWith(RESERVED_TABLE_SUFFIX)) {
|
|
1210
|
-
configurationErrors.push(
|
|
1226
|
+
configurationErrors.push({
|
|
1227
|
+
kind: 'reservedLocalizationName',
|
|
1228
|
+
message: `Section '${s.name}', field '${field.name}': db.table '${field.db.table}' ends with reserved suffix '${RESERVED_TABLE_SUFFIX}'.`,
|
|
1229
|
+
});
|
|
1211
1230
|
}
|
|
1212
1231
|
const reservedColumns = [field.db.identifier, field.db.label, field.db.orderBy].filter((column) => column === RESERVED_COLUMN_NAME);
|
|
1213
1232
|
if (reservedColumns.length > 0) {
|
|
1214
|
-
configurationErrors.push(
|
|
1233
|
+
configurationErrors.push({
|
|
1234
|
+
kind: 'reservedLocalizationName',
|
|
1235
|
+
message: `Section '${s.name}', field '${field.name}': db column name '${RESERVED_COLUMN_NAME}' is reserved.`,
|
|
1236
|
+
});
|
|
1215
1237
|
}
|
|
1216
1238
|
}
|
|
1217
1239
|
}
|
|
1218
1240
|
const galleryForValidation = await s.getGallery();
|
|
1219
1241
|
if (galleryForValidation?.db.tableName && galleryForValidation.db.tableName.endsWith(RESERVED_TABLE_SUFFIX)) {
|
|
1220
|
-
configurationErrors.push(
|
|
1242
|
+
configurationErrors.push({
|
|
1243
|
+
kind: 'reservedLocalizationName',
|
|
1244
|
+
message: `Section '${s.name}': gallery table '${galleryForValidation.db.tableName}' ends with reserved suffix '${RESERVED_TABLE_SUFFIX}'.`,
|
|
1245
|
+
});
|
|
1221
1246
|
}
|
|
1222
1247
|
/**
|
|
1223
1248
|
* Generate the Drizzle schema for the table
|
|
@@ -1539,9 +1564,17 @@ const main = async (spinnerObject) => {
|
|
|
1539
1564
|
* Reject the run before schema writes if any section configuration is unsafe.
|
|
1540
1565
|
*/
|
|
1541
1566
|
if (configurationErrors.length > 0) {
|
|
1567
|
+
const guidance = [];
|
|
1568
|
+
if (configurationErrors.some((error) => error.kind === 'reservedLocalizationName')) {
|
|
1569
|
+
guidance.push(`The suffix '${RESERVED_TABLE_SUFFIX}' and the column name '${RESERVED_COLUMN_NAME}' are reserved for the localization system.`);
|
|
1570
|
+
}
|
|
1571
|
+
if (configurationErrors.some((error) => error.kind === 'managedSectionTable')) {
|
|
1572
|
+
guidance.push(`Section-managed tables must be referenced with the 'section' prop.`);
|
|
1573
|
+
}
|
|
1574
|
+
guidance.push('Please update cms.config.ts and re-run.');
|
|
1542
1575
|
spinnerObject.stop(`update-sections aborted: ${configurationErrors.length} configuration conflict(s) detected.\n` +
|
|
1543
|
-
configurationErrors.map((
|
|
1544
|
-
`\n\
|
|
1576
|
+
configurationErrors.map((error) => ` - ${error.message}`).join('\n') +
|
|
1577
|
+
`\n\n${guidance.join(' ')}`);
|
|
1545
1578
|
throw new Error('update-sections: configuration conflicts detected');
|
|
1546
1579
|
}
|
|
1547
1580
|
/**
|