nextjs-cms 0.9.30 → 0.9.31
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/pages.d.ts +3 -3
- package/dist/api/client.d.ts +30 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +82 -0
- package/dist/api/index.d.ts +1 -974
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +0 -13
- package/dist/api/lib/serverActions.d.ts +13 -49
- package/dist/api/lib/serverActions.d.ts.map +1 -1
- package/dist/api/lib/serverActions.js +103 -31
- package/dist/api/root.d.ts +18 -1916
- package/dist/api/root.d.ts.map +1 -1
- package/dist/api/root.js +18 -83
- package/dist/api/routers/config.d.ts.map +1 -1
- package/dist/api/routers/gallery.d.ts +1 -0
- package/dist/api/routers/gallery.d.ts.map +1 -1
- package/dist/api/routers/gallery.js +36 -8
- package/dist/api/routers/hasItemsSection.d.ts +5 -30
- 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 +3 -15
- package/dist/api/routers/simpleSection.d.ts.map +1 -1
- package/dist/api/server.d.ts +2748 -0
- package/dist/api/server.d.ts.map +1 -0
- package/dist/api/server.js +100 -0
- package/dist/api/trpc/error-logging.d.ts +14 -0
- package/dist/api/trpc/error-logging.d.ts.map +1 -0
- package/dist/api/trpc/error-logging.js +75 -0
- package/dist/api/trpc/root.d.ts +3 -3
- 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/navigation.d.ts +3 -3
- package/dist/api/trpc/routers/simpleSection.d.ts.map +1 -1
- package/dist/api/trpc/server.d.ts +9 -9
- package/dist/api/trpc/server.d.ts.map +1 -1
- package/dist/api/utils/async-caller-proxy.d.ts +2 -0
- package/dist/api/utils/async-caller-proxy.d.ts.map +1 -0
- package/dist/api/utils/async-caller-proxy.js +36 -0
- package/dist/api/utils/lazy-caller-proxy.d.ts +2 -0
- package/dist/api/utils/lazy-caller-proxy.d.ts.map +1 -0
- package/dist/api/utils/lazy-caller-proxy.js +36 -0
- package/dist/api/utils/router-types.d.ts +7 -0
- package/dist/api/utils/router-types.d.ts.map +1 -0
- package/dist/api/utils/router-types.js +0 -0
- package/dist/auth/trpc.d.ts +1 -1
- package/dist/auth/trpc.d.ts.map +1 -1
- package/dist/auth/trpc.js +0 -1
- 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 +29 -24
- 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/sections/category.d.ts +42 -42
- package/dist/core/sections/hasItems.d.ts +42 -42
- package/dist/core/sections/section.d.ts +22 -22
- package/dist/core/sections/simple.d.ts +8 -8
- package/dist/plugins/loader.d.ts +3 -1
- package/dist/plugins/loader.d.ts.map +1 -1
- package/dist/plugins/loader.js +28 -6
- package/dist/plugins/manifest.d.ts +28 -0
- package/dist/plugins/manifest.d.ts.map +1 -0
- package/dist/plugins/manifest.js +83 -0
- package/dist/plugins/registry.d.ts +22 -0
- package/dist/plugins/registry.d.ts.map +1 -0
- package/dist/plugins/registry.js +25 -0
- package/dist/translations/client.d.ts +4 -4
- package/dist/utils/log.d.ts +18 -0
- package/dist/utils/log.d.ts.map +1 -0
- package/dist/utils/log.js +28 -0
- package/package.json +3 -3
- package/dist/core/fields/dateRange.d.ts +0 -115
- package/dist/core/fields/dateRange.d.ts.map +0 -1
- package/dist/core/fields/dateRange.js +0 -149
- package/dist/translations/locale-cookie.d.ts +0 -24
- package/dist/translations/locale-cookie.d.ts.map +0 -1
- package/dist/translations/locale-cookie.js +0 -44
- package/dist/translations/locale-utils.d.ts +0 -8
- package/dist/translations/locale-utils.d.ts.map +0 -1
- package/dist/translations/locale-utils.js +0 -11
- package/dist/translations/localization.d.ts +0 -40
- package/dist/translations/localization.d.ts.map +0 -1
- package/dist/translations/localization.js +0 -48
- package/dist/validators/dateRange.d.ts +0 -11
- package/dist/validators/dateRange.d.ts.map +0 -1
- package/dist/validators/dateRange.js +0 -16
|
@@ -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,KAAK,SAAS,YAAY;IAC/D,OAAO,CAAC,EAAE,0BAA0B,CAAC,KAAK,CAAC,CAAA;IAC3C,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;CACjE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,KAAK,SAAS,YAAY,GAAG,EAAE,EAAE,IAAI,GAAE,uBAAuB,CAAC,KAAK,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"server.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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAAt4/B,CAAC;;;;;+BAAuE,CAAC;;;;;;+BAA6G,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAtFl4B,OAAO,CAAC,SAAS,CAAC;EAqFvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-caller-proxy.d.ts","sourceRoot":"","sources":["../../../src/api/utils/async-caller-proxy.ts"],"names":[],"mappings":"AAWA,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAyB1F"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const resolveCallerPath = (root, path) => {
|
|
2
|
+
let current = root;
|
|
3
|
+
for (const key of path) {
|
|
4
|
+
if (!current || (typeof current !== 'object' && typeof current !== 'function')) {
|
|
5
|
+
return undefined;
|
|
6
|
+
}
|
|
7
|
+
current = current[key];
|
|
8
|
+
}
|
|
9
|
+
return current;
|
|
10
|
+
};
|
|
11
|
+
export function createAsyncCallerProxy(getCaller) {
|
|
12
|
+
const callProcedure = async (path, args) => {
|
|
13
|
+
const caller = await getCaller();
|
|
14
|
+
const proc = resolveCallerPath(caller, path);
|
|
15
|
+
if (typeof proc !== 'function') {
|
|
16
|
+
throw new Error(`tRPC procedure not found: ${path.join('.')}`);
|
|
17
|
+
}
|
|
18
|
+
return proc(...args);
|
|
19
|
+
};
|
|
20
|
+
const createCallerProxy = (path = []) => {
|
|
21
|
+
const proxyTarget = (...args) => callProcedure(path, args);
|
|
22
|
+
return new Proxy(proxyTarget, {
|
|
23
|
+
get(_target, prop) {
|
|
24
|
+
if (prop === 'then')
|
|
25
|
+
return undefined;
|
|
26
|
+
if (typeof prop !== 'string')
|
|
27
|
+
return undefined;
|
|
28
|
+
return createCallerProxy([...path, prop]);
|
|
29
|
+
},
|
|
30
|
+
apply(_target, _thisArg, args) {
|
|
31
|
+
return callProcedure(path, args);
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
return createCallerProxy();
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy-caller-proxy.d.ts","sourceRoot":"","sources":["../../../src/api/utils/lazy-caller-proxy.ts"],"names":[],"mappings":"AAWA,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAyBzF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const resolveCallerPath = (root, path) => {
|
|
2
|
+
let current = root;
|
|
3
|
+
for (const key of path) {
|
|
4
|
+
if (!current || (typeof current !== 'object' && typeof current !== 'function')) {
|
|
5
|
+
return undefined;
|
|
6
|
+
}
|
|
7
|
+
current = current[key];
|
|
8
|
+
}
|
|
9
|
+
return current;
|
|
10
|
+
};
|
|
11
|
+
export function createLazyCallerProxy(getCaller) {
|
|
12
|
+
const callProcedure = async (path, args) => {
|
|
13
|
+
const caller = await getCaller();
|
|
14
|
+
const proc = resolveCallerPath(caller, path);
|
|
15
|
+
if (typeof proc !== 'function') {
|
|
16
|
+
throw new Error(`tRPC procedure not found: ${path.join('.')}`);
|
|
17
|
+
}
|
|
18
|
+
return proc(...args);
|
|
19
|
+
};
|
|
20
|
+
const createCallerProxy = (path = []) => {
|
|
21
|
+
const proxyTarget = (...args) => callProcedure(path, args);
|
|
22
|
+
return new Proxy(proxyTarget, {
|
|
23
|
+
get(_target, prop) {
|
|
24
|
+
if (prop === 'then')
|
|
25
|
+
return undefined;
|
|
26
|
+
if (typeof prop !== 'string')
|
|
27
|
+
return undefined;
|
|
28
|
+
return createCallerProxy([...path, prop]);
|
|
29
|
+
},
|
|
30
|
+
apply(_target, _thisArg, args) {
|
|
31
|
+
return callProcedure(path, args);
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
return createCallerProxy();
|
|
36
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AnyRouter } from '@trpc/server';
|
|
2
|
+
import type { CoreRouters } from '../root.js';
|
|
3
|
+
export type RouterRecord = Record<string, AnyRouter>;
|
|
4
|
+
export type NonConflictingRouterRecord<TUser extends RouterRecord> = Extract<keyof TUser, keyof CoreRouters> extends never ? TUser : {
|
|
5
|
+
[K in keyof TUser]: K extends keyof CoreRouters ? never : TUser[K];
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=router-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-types.d.ts","sourceRoot":"","sources":["../../../src/api/utils/router-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAEpD,MAAM,MAAM,0BAA0B,CAAC,KAAK,SAAS,YAAY,IAC7D,OAAO,CAAC,MAAM,KAAK,EAAE,MAAM,WAAW,CAAC,SAAS,KAAK,GAC/C,KAAK,GACL;KACK,CAAC,IAAI,MAAM,KAAK,GAAG,CAAC,SAAS,MAAM,WAAW,GAAG,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;CACrE,CAAA"}
|
|
File without changes
|
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<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;AAK5C;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAO,QAAQ,CAAC,GAAG,CA6E/C,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":"AAw3EA,wBAAsB,cAAc,CAAC,SAAS,UAAQ,iBAoBrD"}
|
|
@@ -192,7 +192,12 @@ function generateFieldSQL(input) {
|
|
|
192
192
|
else if (!input.defaultValue) {
|
|
193
193
|
fieldSQL += ' DEFAULT NULL';
|
|
194
194
|
}
|
|
195
|
-
if (input.defaultValue !== null && input.defaultValue !== undefined) {
|
|
195
|
+
if (input.defaultValue !== null && input.defaultValue !== undefined && input.required) {
|
|
196
|
+
// Only add sql default when the field is required,
|
|
197
|
+
// to allow null values in non-required fields
|
|
198
|
+
// with defaultValue prop set.
|
|
199
|
+
// Example: Admin cleared the defaultValue of
|
|
200
|
+
// non-required field and submits.
|
|
196
201
|
fieldSQL += ` DEFAULT '${input.defaultValue}'`;
|
|
197
202
|
}
|
|
198
203
|
return fieldSQL;
|
|
@@ -384,17 +389,17 @@ function buildLocaleFieldConfig() {
|
|
|
384
389
|
});
|
|
385
390
|
}
|
|
386
391
|
async function createEditorPhotosTable(localized) {
|
|
387
|
-
await db.execute(sql `
|
|
388
|
-
CREATE TABLE IF NOT EXISTS \`editor_photos\` (
|
|
389
|
-
\`photo\` VARCHAR(100) NOT NULL PRIMARY KEY,
|
|
390
|
-
\`section\` VARCHAR(100) NOT NULL,
|
|
391
|
-
\`item_id\` VARCHAR(50) NOT NULL,
|
|
392
|
-
\`field\` VARCHAR(100) NOT NULL,
|
|
393
|
-
\`meta\` LONGTEXT,
|
|
394
|
-
${localized ? sql `\`locale\` VARCHAR(10) NOT NULL,` : sql ``}
|
|
395
|
-
\`linked\` BOOLEAN DEFAULT false,
|
|
396
|
-
\`created_at\` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
397
|
-
)
|
|
392
|
+
await db.execute(sql `
|
|
393
|
+
CREATE TABLE IF NOT EXISTS \`editor_photos\` (
|
|
394
|
+
\`photo\` VARCHAR(100) NOT NULL PRIMARY KEY,
|
|
395
|
+
\`section\` VARCHAR(100) NOT NULL,
|
|
396
|
+
\`item_id\` VARCHAR(50) NOT NULL,
|
|
397
|
+
\`field\` VARCHAR(100) NOT NULL,
|
|
398
|
+
\`meta\` LONGTEXT,
|
|
399
|
+
${localized ? sql `\`locale\` VARCHAR(10) NOT NULL,` : sql ``}
|
|
400
|
+
\`linked\` BOOLEAN DEFAULT false,
|
|
401
|
+
\`created_at\` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
402
|
+
)
|
|
398
403
|
`);
|
|
399
404
|
}
|
|
400
405
|
async function ensureEditorPhotosLocaleColumn(defaultLocaleCode, knownColumns) {
|
|
@@ -988,22 +993,22 @@ const main = async (s) => {
|
|
|
988
993
|
* Let's see if the table `__nextjs_cms_tables` exists in the database.
|
|
989
994
|
* If it doesn't, we'll create it using the same schema as `NextJsCmsTablesTable`.
|
|
990
995
|
*/
|
|
991
|
-
await db.execute(sql `
|
|
992
|
-
CREATE TABLE IF NOT EXISTS __nextjs_cms_tables (
|
|
993
|
-
name VARCHAR(100) NOT NULL PRIMARY KEY,
|
|
994
|
-
section VARCHAR(200),
|
|
995
|
-
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
996
|
-
)
|
|
996
|
+
await db.execute(sql `
|
|
997
|
+
CREATE TABLE IF NOT EXISTS __nextjs_cms_tables (
|
|
998
|
+
name VARCHAR(100) NOT NULL PRIMARY KEY,
|
|
999
|
+
section VARCHAR(200),
|
|
1000
|
+
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
1001
|
+
)
|
|
997
1002
|
`);
|
|
998
1003
|
/**
|
|
999
1004
|
* Persistent key/value store for CMS-level state that must survive config removal.
|
|
1000
1005
|
*/
|
|
1001
|
-
await db.execute(sql `
|
|
1002
|
-
CREATE TABLE IF NOT EXISTS __nextjs_cms_config (
|
|
1003
|
-
\`key\` VARCHAR(100) NOT NULL PRIMARY KEY,
|
|
1004
|
-
\`value\` LONGTEXT,
|
|
1005
|
-
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
|
1006
|
-
)
|
|
1006
|
+
await db.execute(sql `
|
|
1007
|
+
CREATE TABLE IF NOT EXISTS __nextjs_cms_config (
|
|
1008
|
+
\`key\` VARCHAR(100) NOT NULL PRIMARY KEY,
|
|
1009
|
+
\`value\` LONGTEXT,
|
|
1010
|
+
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
|
1011
|
+
)
|
|
1007
1012
|
`);
|
|
1008
1013
|
await db.execute(sql `ALTER TABLE \`__nextjs_cms_config\` MODIFY COLUMN \`value\` LONGTEXT`);
|
|
1009
1014
|
/**
|
|
@@ -22,12 +22,12 @@ export class MysqlTableChecker extends DbTableChecker {
|
|
|
22
22
|
return _tables;
|
|
23
23
|
}
|
|
24
24
|
static async getColumns(tableName) {
|
|
25
|
-
const statement = sql `
|
|
26
|
-
SELECT COLUMN_NAME
|
|
27
|
-
FROM information_schema.COLUMNS c
|
|
28
|
-
inner join information_schema.TABLES t ON t.TABLE_NAME = c.TABLE_NAME
|
|
29
|
-
WHERE t.TABLE_SCHEMA = DATABASE()
|
|
30
|
-
AND c.TABLE_SCHEMA = DATABASE()
|
|
25
|
+
const statement = sql `
|
|
26
|
+
SELECT COLUMN_NAME
|
|
27
|
+
FROM information_schema.COLUMNS c
|
|
28
|
+
inner join information_schema.TABLES t ON t.TABLE_NAME = c.TABLE_NAME
|
|
29
|
+
WHERE t.TABLE_SCHEMA = DATABASE()
|
|
30
|
+
AND c.TABLE_SCHEMA = DATABASE()
|
|
31
31
|
AND t.TABLE_NAME = ${tableName}`;
|
|
32
32
|
const _cols = [];
|
|
33
33
|
const _res = await db.execute(statement);
|
|
@@ -84,10 +84,10 @@ export class MysqlTableChecker extends DbTableChecker {
|
|
|
84
84
|
fullTextKeys.push({ name: key, columns: _fullTextKeyMap[key] });
|
|
85
85
|
}
|
|
86
86
|
// Foreign keys should be retrieved from information_schema
|
|
87
|
-
const [foreignKeys] = await db.execute(sql `
|
|
88
|
-
SELECT COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME
|
|
89
|
-
FROM information_schema.KEY_COLUMN_USAGE
|
|
90
|
-
WHERE TABLE_NAME = ${table} AND CONSTRAINT_NAME != 'PRIMARY' AND REFERENCED_TABLE_NAME IS NOT NULL;
|
|
87
|
+
const [foreignKeys] = await db.execute(sql `
|
|
88
|
+
SELECT COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME
|
|
89
|
+
FROM information_schema.KEY_COLUMN_USAGE
|
|
90
|
+
WHERE TABLE_NAME = ${table} AND CONSTRAINT_NAME != 'PRIMARY' AND REFERENCED_TABLE_NAME IS NOT NULL;
|
|
91
91
|
`);
|
|
92
92
|
return { primaryKeys, uniqueKeys, indexKeys, foreignKeys, fullTextKeys };
|
|
93
93
|
}
|
|
@@ -460,15 +460,15 @@ export class SectionFactory {
|
|
|
460
460
|
importErr.message.includes('Cannot find module') &&
|
|
461
461
|
importErr.message.includes('.section')) {
|
|
462
462
|
this.sectionProcessingErrors[file] ??= [];
|
|
463
|
-
this.sectionProcessingErrors[file].push(`❌ Invalid section import detected.
|
|
464
|
-
|
|
465
|
-
Sections MUST use extensionless relative imports:
|
|
466
|
-
|
|
467
|
-
✅ import exampleSection from './example.section'
|
|
468
|
-
❌ import exampleSection from './example.section.ts'
|
|
469
|
-
❌ import exampleSection from './example.section.js'
|
|
470
|
-
|
|
471
|
-
This file is bundled with esbuild, so Node never resolves the import directly.
|
|
463
|
+
this.sectionProcessingErrors[file].push(`❌ Invalid section import detected.
|
|
464
|
+
|
|
465
|
+
Sections MUST use extensionless relative imports:
|
|
466
|
+
|
|
467
|
+
✅ import exampleSection from './example.section'
|
|
468
|
+
❌ import exampleSection from './example.section.ts'
|
|
469
|
+
❌ import exampleSection from './example.section.js'
|
|
470
|
+
|
|
471
|
+
This file is bundled with esbuild, so Node never resolves the import directly.
|
|
472
472
|
If you added an extension manually, remove it.`);
|
|
473
473
|
this.errorCount++;
|
|
474
474
|
continue;
|
|
@@ -417,15 +417,15 @@ export class SectionFactory {
|
|
|
417
417
|
importErr.message.includes('Cannot find module') &&
|
|
418
418
|
importErr.message.includes('.section')) {
|
|
419
419
|
this.sectionProcessingErrors[file] ??= [];
|
|
420
|
-
this.sectionProcessingErrors[file].push(`❌ Invalid section import detected.
|
|
421
|
-
|
|
422
|
-
Sections MUST use extensionless relative imports:
|
|
423
|
-
|
|
424
|
-
✅ import exampleSection from './example.section'
|
|
425
|
-
❌ import exampleSection from './example.section.ts'
|
|
426
|
-
❌ import exampleSection from './example.section.js'
|
|
427
|
-
|
|
428
|
-
This file is bundled with jiti, so Node never resolves the import directly.
|
|
420
|
+
this.sectionProcessingErrors[file].push(`❌ Invalid section import detected.
|
|
421
|
+
|
|
422
|
+
Sections MUST use extensionless relative imports:
|
|
423
|
+
|
|
424
|
+
✅ import exampleSection from './example.section'
|
|
425
|
+
❌ import exampleSection from './example.section.ts'
|
|
426
|
+
❌ import exampleSection from './example.section.js'
|
|
427
|
+
|
|
428
|
+
This file is bundled with jiti, so Node never resolves the import directly.
|
|
429
429
|
If you added an extension manually, remove it.`);
|
|
430
430
|
this.errorCount++;
|
|
431
431
|
continue;
|