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":"client.d.ts","sourceRoot":"","sources":["../../src/translations/client.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AA2BvD,QAAA,MACI,OAAO
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/translations/client.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGqC,CAAA;AAEtD,iBAAS,aAAa,IAAI;IAAE,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,GAAG,EAAE,KAAK,GAAG,KAAK,CAAA;CAAE,CAIzE;AAED,KAAK,uBAAuB,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;IACpD,QAAQ,EAAE,SAAS,CAAA;CACtB,CAAA;AAID,wBAAgB,kBAAkB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,uBAAuB,qBAWvG;AAED,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cookie used to persist locale on the login page (no session).
|
|
3
|
+
* Read by auth layout when unauthenticated; set by login-page locale dropdown.
|
|
4
|
+
*/
|
|
5
|
+
export declare const LOCALE_COOKIE_NAME = "nextjs-cms-locale";
|
|
6
|
+
/**
|
|
7
|
+
* Set the login-page locale cookie (client-only).
|
|
8
|
+
* Call when user changes language on the login page; auth layout reads it when no session.
|
|
9
|
+
*/
|
|
10
|
+
export declare function setLoginPageLocaleCookie(locale: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* Mark that user explicitly changed locale on login page.
|
|
13
|
+
* Used to determine whether to send locale to server on login.
|
|
14
|
+
*/
|
|
15
|
+
export declare function markLocaleChangedOnLogin(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Check if user explicitly changed locale on login page.
|
|
18
|
+
*/
|
|
19
|
+
export declare function wasLocaleChangedOnLogin(): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Clear the locale changed flag after login.
|
|
22
|
+
*/
|
|
23
|
+
export declare function clearLocaleChangedOnLogin(): void;
|
|
24
|
+
//# sourceMappingURL=locale-cookie.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-cookie.d.ts","sourceRoot":"","sources":["../../src/translations/locale-cookie.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,kBAAkB,sBAAsB,CAAA;AASrD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAG7D;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAG/C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,OAAO,CAGjD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAGhD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cookie used to persist locale on the login page (no session).
|
|
3
|
+
* Read by auth layout when unauthenticated; set by login-page locale dropdown.
|
|
4
|
+
*/
|
|
5
|
+
export const LOCALE_COOKIE_NAME = 'nextjs-cms-locale';
|
|
6
|
+
/**
|
|
7
|
+
* SessionStorage key to track if user explicitly changed locale on login page.
|
|
8
|
+
*/
|
|
9
|
+
const LOCALE_CHANGED_KEY = 'nextjs-cms-locale-changed';
|
|
10
|
+
const MAX_AGE_YEAR = 60 * 60 * 24 * 365;
|
|
11
|
+
/**
|
|
12
|
+
* Set the login-page locale cookie (client-only).
|
|
13
|
+
* Call when user changes language on the login page; auth layout reads it when no session.
|
|
14
|
+
*/
|
|
15
|
+
export function setLoginPageLocaleCookie(locale) {
|
|
16
|
+
if (typeof document === 'undefined')
|
|
17
|
+
return;
|
|
18
|
+
document.cookie = `${LOCALE_COOKIE_NAME}=${encodeURIComponent(locale)}; path=/; max-age=${MAX_AGE_YEAR}; SameSite=Lax`;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Mark that user explicitly changed locale on login page.
|
|
22
|
+
* Used to determine whether to send locale to server on login.
|
|
23
|
+
*/
|
|
24
|
+
export function markLocaleChangedOnLogin() {
|
|
25
|
+
if (typeof sessionStorage === 'undefined')
|
|
26
|
+
return;
|
|
27
|
+
sessionStorage.setItem(LOCALE_CHANGED_KEY, 'true');
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Check if user explicitly changed locale on login page.
|
|
31
|
+
*/
|
|
32
|
+
export function wasLocaleChangedOnLogin() {
|
|
33
|
+
if (typeof sessionStorage === 'undefined')
|
|
34
|
+
return false;
|
|
35
|
+
return sessionStorage.getItem(LOCALE_CHANGED_KEY) === 'true';
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Clear the locale changed flag after login.
|
|
39
|
+
*/
|
|
40
|
+
export function clearLocaleChangedOnLogin() {
|
|
41
|
+
if (typeof sessionStorage === 'undefined')
|
|
42
|
+
return;
|
|
43
|
+
sessionStorage.removeItem(LOCALE_CHANGED_KEY);
|
|
44
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Locale codes that use RTL layout. Used for `dir` and font selection. */
|
|
2
|
+
export declare const RTL_LOCALES: Set<string>;
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the effective locale from the user's stored locale, supported list, and fallback.
|
|
5
|
+
* Used in layouts to determine `html` lang and `I18nProviderClient` locale.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveLocale(userLocale: string | undefined, supported: readonly string[], fallback: string): string;
|
|
8
|
+
//# sourceMappingURL=locale-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-utils.d.ts","sourceRoot":"","sources":["../../src/translations/locale-utils.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,eAAO,MAAM,WAAW,aAA0B,CAAA;AAElD;;;GAGG;AACH,wBAAgB,aAAa,CACzB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,QAAQ,EAAE,MAAM,GACjB,MAAM,CAGR"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Locale codes that use RTL layout. Used for `dir` and font selection. */
|
|
2
|
+
export const RTL_LOCALES = new Set(['ar']);
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the effective locale from the user's stored locale, supported list, and fallback.
|
|
5
|
+
* Used in layouts to determine `html` lang and `I18nProviderClient` locale.
|
|
6
|
+
*/
|
|
7
|
+
export function resolveLocale(userLocale, supported, fallback) {
|
|
8
|
+
if (!userLocale)
|
|
9
|
+
return fallback;
|
|
10
|
+
return supported.includes(userLocale) ? userLocale : fallback;
|
|
11
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Localization utilities for resolving localized strings.
|
|
3
|
+
* Supports Payload CMS-style translations where developers can provide
|
|
4
|
+
* translations directly in field labels and section titles.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A localized string can be either:
|
|
8
|
+
* - A plain string (backward compatible)
|
|
9
|
+
* - An object with language codes as keys and translated strings as values
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Single language (backward compatible)
|
|
14
|
+
* label: 'Title'
|
|
15
|
+
*
|
|
16
|
+
* // Multiple languages
|
|
17
|
+
* label: {
|
|
18
|
+
* en: 'Title',
|
|
19
|
+
* ar: 'العنوان'
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export type LocalizedString = string | Record<string, string>;
|
|
24
|
+
/**
|
|
25
|
+
* Resolve a localized string to a specific locale.
|
|
26
|
+
* If the string is a plain string, it's returned as-is.
|
|
27
|
+
* If it's an object, the value for the given locale is returned.
|
|
28
|
+
* Falls back to the first available language or the fallback locale if the requested locale is not found.
|
|
29
|
+
*
|
|
30
|
+
* @param localized - The localized string (string or object with language codes)
|
|
31
|
+
* @param locale - The target locale code (e.g., 'en', 'ar')
|
|
32
|
+
* @param fallbackLocale - The fallback locale code if the requested locale is not found
|
|
33
|
+
* @returns The resolved string for the given locale
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveLocalizedString(localized: LocalizedString | undefined, locale: string, fallbackLocale?: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Check if a value is a localized string object (not a plain string)
|
|
38
|
+
*/
|
|
39
|
+
export declare function isLocalizedObject(value: LocalizedString | undefined): value is Record<string, string>;
|
|
40
|
+
//# sourceMappingURL=localization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localization.d.ts","sourceRoot":"","sources":["../../src/translations/localization.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAE7D;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAClC,SAAS,EAAE,eAAe,GAAG,SAAS,EACtC,MAAM,EAAE,MAAM,EACd,cAAc,GAAE,MAAa,GAC9B,MAAM,CA8BR;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAErG"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Localization utilities for resolving localized strings.
|
|
3
|
+
* Supports Payload CMS-style translations where developers can provide
|
|
4
|
+
* translations directly in field labels and section titles.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a localized string to a specific locale.
|
|
8
|
+
* If the string is a plain string, it's returned as-is.
|
|
9
|
+
* If it's an object, the value for the given locale is returned.
|
|
10
|
+
* Falls back to the first available language or the fallback locale if the requested locale is not found.
|
|
11
|
+
*
|
|
12
|
+
* @param localized - The localized string (string or object with language codes)
|
|
13
|
+
* @param locale - The target locale code (e.g., 'en', 'ar')
|
|
14
|
+
* @param fallbackLocale - The fallback locale code if the requested locale is not found
|
|
15
|
+
* @returns The resolved string for the given locale
|
|
16
|
+
*/
|
|
17
|
+
export function resolveLocalizedString(localized, locale, fallbackLocale = 'en') {
|
|
18
|
+
if (!localized) {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
// If it's a plain string, return as-is (backward compatible)
|
|
22
|
+
if (typeof localized === 'string') {
|
|
23
|
+
return localized;
|
|
24
|
+
}
|
|
25
|
+
// If it's an object, resolve based on locale
|
|
26
|
+
if (typeof localized === 'object') {
|
|
27
|
+
// Try the requested locale first
|
|
28
|
+
if (localized[locale]) {
|
|
29
|
+
return localized[locale];
|
|
30
|
+
}
|
|
31
|
+
// Try the fallback locale
|
|
32
|
+
if (localized[fallbackLocale]) {
|
|
33
|
+
return localized[fallbackLocale];
|
|
34
|
+
}
|
|
35
|
+
// Fall back to the first available language
|
|
36
|
+
const firstKey = Object.keys(localized)[0];
|
|
37
|
+
if (firstKey && localized[firstKey]) {
|
|
38
|
+
return localized[firstKey];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return '';
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Check if a value is a localized string object (not a plain string)
|
|
45
|
+
*/
|
|
46
|
+
export function isLocalizedObject(value) {
|
|
47
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
48
|
+
}
|