@notionx/core 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/rate-limit.js.map +1 -1
- package/dist/auth/routes/google-callback.js.map +1 -1
- package/dist/auth/routes/google.js.map +1 -1
- package/dist/auth/routes/index.js.map +1 -1
- package/dist/auth/routes/verify-email.js.map +1 -1
- package/dist/auth/routes/viewer.js.map +1 -1
- package/dist/auth/turnstile.js.map +1 -1
- package/dist/auth/user-session.d.ts +1 -1
- package/dist/auth/user-session.js.map +1 -1
- package/dist/auth/users.js.map +1 -1
- package/dist/content/index.d.ts +3 -2
- package/dist/content/index.js +176 -60
- package/dist/content/index.js.map +1 -1
- package/dist/content/localized.d.ts +67 -0
- package/dist/content/localized.js +170 -0
- package/dist/content/localized.js.map +1 -0
- package/dist/content/revalidate.d.ts +2 -1
- package/dist/content/revalidate.js +5 -28
- package/dist/content/revalidate.js.map +1 -1
- package/dist/content/search-index.d.ts +1 -1
- package/dist/content/search-index.js.map +1 -1
- package/dist/content/search.d.ts +2 -5
- package/dist/content/search.js +3 -32
- package/dist/content/search.js.map +1 -1
- package/dist/email/index.js.map +1 -1
- package/dist/{env-C5qu-0R-.d.ts → env-hoez1e-n.d.ts} +0 -4
- package/dist/i18n/index.d.ts +18 -24
- package/dist/i18n/index.js +29 -54
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/admin/index.js.map +1 -1
- package/dist/media/index.js +3 -2
- package/dist/media/index.js.map +1 -1
- package/dist/media/routes/index.js +0 -1
- package/dist/media/routes/index.js.map +1 -1
- package/dist/media/routes/notion-media.js +0 -1
- package/dist/media/routes/notion-media.js.map +1 -1
- package/dist/notion/config.d.ts +1 -4
- package/dist/notion/config.js +1 -23
- package/dist/notion/config.js.map +1 -1
- package/dist/notion/content-cache.d.ts +1 -1
- package/dist/notion/generic-source.js +0 -1
- package/dist/notion/generic-source.js.map +1 -1
- package/dist/notion/index.d.ts +4 -4
- package/dist/notion/index.js +8 -23
- package/dist/notion/index.js.map +1 -1
- package/dist/notion/mappers.js.map +1 -1
- package/dist/notion/media.d.ts +1 -1
- package/dist/notion/media.js +1 -1
- package/dist/notion/media.js.map +1 -1
- package/dist/notion/property-mappers.d.ts +2 -1
- package/dist/notion/property-mappers.js +7 -0
- package/dist/notion/property-mappers.js.map +1 -1
- package/dist/notion/routes/index.d.ts +1 -1
- package/dist/notion/routes/index.js +0 -1
- package/dist/notion/routes/index.js.map +1 -1
- package/dist/notion/routes/webhook.d.ts +1 -1
- package/dist/notion/routes/webhook.js +0 -1
- package/dist/notion/routes/webhook.js.map +1 -1
- package/dist/notion/types.d.ts +1 -73
- package/dist/notion/webhook.d.ts +1 -1
- package/dist/notion/webhook.js +0 -1
- package/dist/notion/webhook.js.map +1 -1
- package/dist/pages/index.d.ts +117 -0
- package/dist/pages/index.js +487 -0
- package/dist/pages/index.js.map +1 -0
- package/dist/platform/current.d.ts +1 -1
- package/dist/platform/current.js.map +1 -1
- package/dist/platform/index.d.ts +1 -1
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/runtime.d.ts +1 -1
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/routes/cdn.js.map +1 -1
- package/dist/storage/routes/files.js.map +1 -1
- package/dist/storage/routes/index.js.map +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.js +1 -2
- package/dist/util/index.js.map +1 -1
- package/dist/worker/index.js +0 -1
- package/dist/worker/index.js.map +1 -1
- package/dist/worker/routes/content-revalidate.d.ts +1 -1
- package/dist/worker/routes/health.js.map +1 -1
- package/dist/worker/routes/index.d.ts +1 -1
- package/dist/worker/routes/index.js.map +1 -1
- package/package.json +14 -1
package/dist/i18n/index.js
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
// src/i18n/config.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function isAppLocale(value) {
|
|
5
|
-
return supportedLocales.includes(value);
|
|
2
|
+
function defineI18nConfig(config) {
|
|
3
|
+
return config;
|
|
6
4
|
}
|
|
7
|
-
function
|
|
8
|
-
return
|
|
5
|
+
function isSupportedLocale(config, value) {
|
|
6
|
+
return config.supportedLocales.includes(value);
|
|
9
7
|
}
|
|
10
|
-
function
|
|
11
|
-
return
|
|
8
|
+
function localesForExpansion(config, locale) {
|
|
9
|
+
return locale && isSupportedLocale(config, locale) ? [locale] : [...config.supportedLocales];
|
|
12
10
|
}
|
|
13
|
-
function
|
|
14
|
-
const
|
|
11
|
+
function localizedPath(locale, path) {
|
|
12
|
+
const normalized = path.startsWith("/") ? path : `/${path}`;
|
|
13
|
+
return `/${locale}${normalized}`;
|
|
14
|
+
}
|
|
15
|
+
function localizedDetailPath(locale, listPath, slug) {
|
|
16
|
+
const normalizedListPath = listPath.replace(/\/+$/, "");
|
|
17
|
+
const normalizedSlug = slug.replace(/^\/+/, "");
|
|
18
|
+
return localizedPath(locale, `${normalizedListPath}/${normalizedSlug}`);
|
|
19
|
+
}
|
|
20
|
+
function expandLocalizedPaths(input) {
|
|
21
|
+
const locales = localesForExpansion(input.config, input.locale);
|
|
15
22
|
const expanded = [];
|
|
16
|
-
for (const path of paths) {
|
|
17
|
-
if (
|
|
23
|
+
for (const path of input.paths) {
|
|
24
|
+
if (!input.shouldLocalize || input.shouldLocalize(path)) {
|
|
18
25
|
for (const currentLocale of locales) {
|
|
19
|
-
expanded.push(
|
|
26
|
+
expanded.push(localizedPath(currentLocale, path));
|
|
20
27
|
}
|
|
21
28
|
continue;
|
|
22
29
|
}
|
|
@@ -26,48 +33,16 @@ function expandLocalizedMoviePaths(paths, locale) {
|
|
|
26
33
|
}
|
|
27
34
|
|
|
28
35
|
// src/i18n/messages.ts
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
backToList: "\u8FD4\u56DE\u7535\u5F71\u5217\u8868",
|
|
32
|
-
releaseDate: "\u4E0A\u6620\u65F6\u95F4",
|
|
33
|
-
director: "\u5BFC\u6F14",
|
|
34
|
-
actors: "\u6F14\u5458",
|
|
35
|
-
noSummary: "\u6682\u65E0\u5267\u60C5\u7B80\u4ECB\u3002",
|
|
36
|
-
unknownYear: "\u672A\u77E5\u5E74\u4EFD",
|
|
37
|
-
unknownReleaseDate: "\u672A\u77E5\u4E0A\u6620\u65F6\u95F4",
|
|
38
|
-
searchPlaceholder: "\u641C\u7D22\u7247\u540D\u3001\u6B63\u6587\u3001\u5BFC\u6F14\u3001\u6F14\u5458\u3001\u7C7B\u578B",
|
|
39
|
-
noSearchResults: "\u6CA1\u6709\u5339\u914D\u7684\u7535\u5F71\u3002",
|
|
40
|
-
itemLabel: "\u90E8\u5F71\u7247",
|
|
41
|
-
notionLink: "Notion",
|
|
42
|
-
admin: "Admin",
|
|
43
|
-
languageLabel: "\u8BED\u8A00"
|
|
44
|
-
},
|
|
45
|
-
"en-US": {
|
|
46
|
-
backToList: "Back to movies",
|
|
47
|
-
releaseDate: "Release date",
|
|
48
|
-
director: "Director",
|
|
49
|
-
actors: "Cast",
|
|
50
|
-
noSummary: "No synopsis yet.",
|
|
51
|
-
unknownYear: "Unknown year",
|
|
52
|
-
unknownReleaseDate: "Unknown release date",
|
|
53
|
-
searchPlaceholder: "Search titles, body, director, cast, or genre",
|
|
54
|
-
noSearchResults: "No movies matched your search.",
|
|
55
|
-
itemLabel: "movies",
|
|
56
|
-
notionLink: "Notion",
|
|
57
|
-
admin: "Admin",
|
|
58
|
-
languageLabel: "Language"
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
function getMovieUiMessages(locale) {
|
|
62
|
-
return movieUiMessages[locale];
|
|
36
|
+
function getLocaleMessages(messages, locale) {
|
|
37
|
+
return messages[locale];
|
|
63
38
|
}
|
|
64
39
|
export {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
40
|
+
defineI18nConfig,
|
|
41
|
+
expandLocalizedPaths,
|
|
42
|
+
getLocaleMessages,
|
|
43
|
+
isSupportedLocale,
|
|
44
|
+
localesForExpansion,
|
|
45
|
+
localizedDetailPath,
|
|
46
|
+
localizedPath
|
|
72
47
|
};
|
|
73
48
|
//# sourceMappingURL=index.js.map
|
package/dist/i18n/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i18n/config.ts","../../src/i18n/messages.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["../../src/i18n/config.ts","../../src/i18n/messages.ts"],"sourcesContent":["export type I18nConfig<TLocale extends string = string> = {\n supportedLocales: readonly TLocale[];\n defaultLocale: TLocale;\n};\n\nexport function defineI18nConfig<const TLocale extends string>(\n config: I18nConfig<TLocale>\n) {\n return config;\n}\n\nexport function isSupportedLocale<TLocale extends string>(\n config: I18nConfig<TLocale>,\n value: string\n): value is TLocale {\n return (config.supportedLocales as readonly string[]).includes(value);\n}\n\nexport function localesForExpansion<TLocale extends string>(\n config: I18nConfig<TLocale>,\n locale?: string\n) {\n return locale && isSupportedLocale(config, locale)\n ? [locale]\n : [...config.supportedLocales];\n}\n\nexport function localizedPath(locale: string, path: string) {\n const normalized = path.startsWith(\"/\") ? path : `/${path}`;\n return `/${locale}${normalized}`;\n}\n\nexport function localizedDetailPath(\n locale: string,\n listPath: string,\n slug: string\n) {\n const normalizedListPath = listPath.replace(/\\/+$/, \"\");\n const normalizedSlug = slug.replace(/^\\/+/, \"\");\n return localizedPath(locale, `${normalizedListPath}/${normalizedSlug}`);\n}\n\nexport function expandLocalizedPaths<TLocale extends string>(input: {\n paths: readonly string[];\n config: I18nConfig<TLocale>;\n locale?: string;\n shouldLocalize?: (path: string) => boolean;\n}) {\n const locales = localesForExpansion(input.config, input.locale);\n const expanded: string[] = [];\n\n for (const path of input.paths) {\n if (!input.shouldLocalize || input.shouldLocalize(path)) {\n for (const currentLocale of locales) {\n expanded.push(localizedPath(currentLocale, path));\n }\n continue;\n }\n expanded.push(path);\n }\n\n return Array.from(new Set(expanded));\n}\n","export type LocaleMessages<\n TLocale extends string = string,\n TMessages extends object = Record<string, string>,\n> = Record<TLocale, TMessages>;\n\nexport function getLocaleMessages<\n TLocale extends string,\n TMessages extends object,\n>(messages: LocaleMessages<TLocale, TMessages>, locale: TLocale): TMessages {\n return messages[locale];\n}\n"],"mappings":";AAKO,SAAS,iBACd,QACA;AACA,SAAO;AACT;AAEO,SAAS,kBACd,QACA,OACkB;AAClB,SAAQ,OAAO,iBAAuC,SAAS,KAAK;AACtE;AAEO,SAAS,oBACd,QACA,QACA;AACA,SAAO,UAAU,kBAAkB,QAAQ,MAAM,IAC7C,CAAC,MAAM,IACP,CAAC,GAAG,OAAO,gBAAgB;AACjC;AAEO,SAAS,cAAc,QAAgB,MAAc;AAC1D,QAAM,aAAa,KAAK,WAAW,GAAG,IAAI,OAAO,IAAI,IAAI;AACzD,SAAO,IAAI,MAAM,GAAG,UAAU;AAChC;AAEO,SAAS,oBACd,QACA,UACA,MACA;AACA,QAAM,qBAAqB,SAAS,QAAQ,QAAQ,EAAE;AACtD,QAAM,iBAAiB,KAAK,QAAQ,QAAQ,EAAE;AAC9C,SAAO,cAAc,QAAQ,GAAG,kBAAkB,IAAI,cAAc,EAAE;AACxE;AAEO,SAAS,qBAA6C,OAK1D;AACD,QAAM,UAAU,oBAAoB,MAAM,QAAQ,MAAM,MAAM;AAC9D,QAAM,WAAqB,CAAC;AAE5B,aAAW,QAAQ,MAAM,OAAO;AAC9B,QAAI,CAAC,MAAM,kBAAkB,MAAM,eAAe,IAAI,GAAG;AACvD,iBAAW,iBAAiB,SAAS;AACnC,iBAAS,KAAK,cAAc,eAAe,IAAI,CAAC;AAAA,MAClD;AACA;AAAA,IACF;AACA,aAAS,KAAK,IAAI;AAAA,EACpB;AAEA,SAAO,MAAM,KAAK,IAAI,IAAI,QAAQ,CAAC;AACrC;;;ACzDO,SAAS,kBAGd,UAA8C,QAA4B;AAC1E,SAAO,SAAS,MAAM;AACxB;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -491,7 +491,6 @@ function readProcessEnv() {
|
|
|
491
491
|
const env2 = {
|
|
492
492
|
NOTION_TOKEN: process.env.NOTION_TOKEN,
|
|
493
493
|
NOTION_DATA_SOURCE_ID: process.env.NOTION_DATA_SOURCE_ID,
|
|
494
|
-
NOTION_MOVIES_DATA_SOURCE_ID: process.env.NOTION_MOVIES_DATA_SOURCE_ID,
|
|
495
494
|
NOTION_API_BASE_URL: process.env.NOTION_API_BASE_URL,
|
|
496
495
|
NOTION_EDIT_BASE_URL: process.env.NOTION_EDIT_BASE_URL,
|
|
497
496
|
NOTION_WEBHOOK_VERIFICATION_TOKEN: process.env.NOTION_WEBHOOK_VERIFICATION_TOKEN
|