@donotdev/core 0.2.1 → 0.2.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.
Files changed (59) hide show
  1. package/functions/index.js +13 -13
  2. package/i18n/locales/eager/dndev_ar.json +4 -0
  3. package/i18n/locales/eager/dndev_da.json +4 -0
  4. package/i18n/locales/eager/dndev_de.json +4 -0
  5. package/i18n/locales/eager/dndev_en.json +4 -0
  6. package/i18n/locales/eager/dndev_es.json +4 -0
  7. package/i18n/locales/eager/dndev_fr.json +4 -0
  8. package/i18n/locales/eager/dndev_it.json +4 -0
  9. package/i18n/locales/eager/dndev_ja.json +4 -0
  10. package/i18n/locales/eager/dndev_ko.json +4 -0
  11. package/i18n/locales/eager/dndev_nl.json +4 -0
  12. package/i18n/locales/eager/dndev_pl.json +636 -0
  13. package/i18n/locales/eager/dndev_pt.json +4 -0
  14. package/i18n/locales/eager/dndev_zh.json +4 -0
  15. package/i18n/locales/lazy/auth_ar.json +5 -2
  16. package/i18n/locales/lazy/auth_da.json +5 -2
  17. package/i18n/locales/lazy/auth_de.json +5 -2
  18. package/i18n/locales/lazy/auth_en.json +5 -2
  19. package/i18n/locales/lazy/auth_es.json +5 -2
  20. package/i18n/locales/lazy/auth_fr.json +5 -2
  21. package/i18n/locales/lazy/auth_it.json +5 -2
  22. package/i18n/locales/lazy/auth_ja.json +5 -2
  23. package/i18n/locales/lazy/auth_ko.json +5 -2
  24. package/i18n/locales/lazy/auth_nl.json +5 -2
  25. package/i18n/locales/lazy/auth_pl.json +195 -0
  26. package/i18n/locales/lazy/auth_pt.json +5 -2
  27. package/i18n/locales/lazy/auth_zh.json +5 -2
  28. package/i18n/locales/lazy/billing_pl.json +93 -0
  29. package/i18n/locales/lazy/blog_pl.json +9 -0
  30. package/i18n/locales/lazy/cookies_pl.json +35 -0
  31. package/i18n/locales/lazy/crud_ar.json +40 -3
  32. package/i18n/locales/lazy/crud_da.json +39 -4
  33. package/i18n/locales/lazy/crud_de.json +40 -3
  34. package/i18n/locales/lazy/crud_en.json +38 -4
  35. package/i18n/locales/lazy/crud_es.json +40 -3
  36. package/i18n/locales/lazy/crud_fr.json +39 -3
  37. package/i18n/locales/lazy/crud_it.json +40 -3
  38. package/i18n/locales/lazy/crud_ja.json +40 -3
  39. package/i18n/locales/lazy/crud_ko.json +40 -3
  40. package/i18n/locales/lazy/crud_nl.json +39 -4
  41. package/i18n/locales/lazy/crud_pl.json +582 -0
  42. package/i18n/locales/lazy/crud_pt.json +39 -4
  43. package/i18n/locales/lazy/crud_zh.json +39 -4
  44. package/i18n/locales/lazy/homeTemplate_pl.json +52 -0
  45. package/i18n/locales/lazy/legalNotice_de.json +55 -0
  46. package/i18n/locales/lazy/legalNotice_pl.json +55 -0
  47. package/i18n/locales/lazy/oauth_pl.json +11 -0
  48. package/i18n/locales/lazy/privacy_pl.json +178 -0
  49. package/i18n/locales/lazy/terms_pl.json +200 -0
  50. package/index.d.ts +899 -165
  51. package/index.js +6 -6
  52. package/next/index.d.ts +129 -4
  53. package/next/index.js +527 -152
  54. package/next/runtime.js +3 -0
  55. package/package.json +5 -3
  56. package/server.d.ts +759 -139
  57. package/server.js +1 -1
  58. package/symbol-index.json +1 -1
  59. package/vite/index.js +68 -68
package/next/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { ICrudAdapter, AnyEntity, EntitySeoRecord, EntitySeoOptions, EntitySeo, LanguageRouting, languageUrls } from '@donotdev/core/server';
2
3
 
3
4
  /**
4
5
  * Footer mode constants - DRY single source of truth
@@ -886,7 +887,11 @@ interface NextConfigOptions {
886
887
  generateAppPages?: boolean;
887
888
  /** Routing mode for Next.js */
888
889
  routingMode?: 'pages' | 'app';
889
- /** Generate authentication middleware */
890
+ /**
891
+ * Generate `src/proxy.next.ts`: server-side redirects for pages whose PageMeta sets
892
+ * `auth`, when the auth session lives in cookies (Supabase `createBrowserClient`).
893
+ * @default true
894
+ */
890
895
  generateMiddleware?: boolean;
891
896
  };
892
897
  /** Internationalization configuration (uses DRY I18nOptions) */
@@ -963,7 +968,7 @@ interface NextMetadata {
963
968
  *
964
969
  * @example
965
970
  * ```tsx
966
- * // app/layout.tsx
971
+ * // app/layout.next.tsx
967
972
  * import { getMetadataForPath } from '@donotdev/core/next';
968
973
  *
969
974
  * export async function generateMetadata() {
@@ -987,5 +992,125 @@ declare function getMetadataForPath(
987
992
  */
988
993
  declare function clearMetadataCache(): void;
989
994
 
990
- export { clearMetadataCache, defineNextConfig, definePostCSSConfig, getMetadataForPath };
991
- export type { NextConfigOptions };
995
+
996
+ /** One public route, as written by the build into a generated SEO route. */
997
+ interface PublicRoute {
998
+ /** Route path in React Router syntax (`/produits/:slug`) */
999
+ path: string;
1000
+ /** Collection whose published records fill the `:param` segment. Required for dynamic routes. */
1001
+ collection?: string;
1002
+ }
1003
+
1004
+ /** One public route of the sitemap. */
1005
+ interface SitemapRoute extends PublicRoute {
1006
+ /** Pre-computed lastmod (blog posts), ISO date */
1007
+ lastModified?: string;
1008
+ /** 0.0–1.0 */
1009
+ priority?: number;
1010
+ changeFrequency?: SitemapEntry['changeFrequency'];
1011
+ }
1012
+
1013
+ /** Sitemap entry. */
1014
+ interface SitemapEntry {
1015
+ url: string;
1016
+ lastModified?: string;
1017
+ changeFrequency?:
1018
+ | 'always'
1019
+ | 'hourly'
1020
+ | 'daily'
1021
+ | 'weekly'
1022
+ | 'monthly'
1023
+ | 'yearly'
1024
+ | 'never';
1025
+ priority?: number;
1026
+ /** URL of the same page in every language (2+ languages) */
1027
+ alternates?: { languages: Record<string, string> };
1028
+ }
1029
+
1030
+ /** What the generated sitemap route passes besides its routes. */
1031
+ interface SitemapContext {
1032
+ /** Absolute production URL, no trailing slash */
1033
+ baseUrl: string;
1034
+ /** App languages (one language: one URL per page, no alternates) */
1035
+ routing: LanguageRouting;
1036
+ /** Public (anonymous) CRUD reader; required when a route lists records (`collection`) */
1037
+ crud?: ICrudAdapter;
1038
+ /** `languageUrls` from @donotdev/core/server */
1039
+ languageUrls: typeof languageUrls;
1040
+ /** `HIDDEN_STATUSES` from @donotdev/core/server: records with these statuses are not listed */
1041
+ hiddenStatuses: readonly string[];
1042
+ }
1043
+
1044
+ /**
1045
+ * Build the sitemap entries: static routes, plus one URL per published record of each
1046
+ * single-param route's collection; with 2+ languages once per language URL, with alternates.
1047
+ *
1048
+ * @throws When a dynamic route has no collection or several params, or the read fails
1049
+ */
1050
+ declare function buildSitemap(
1051
+ routes: readonly SitemapRoute[],
1052
+ context: SitemapContext
1053
+ ): Promise<SitemapEntry[]>;
1054
+
1055
+ /** Serialize sitemap entries to sitemap.xml (with hreflang alternates). */
1056
+ declare function formatSitemapXml(entries: readonly SitemapEntry[]): string;
1057
+
1058
+ /** One public route of llms.txt, as written by the build. */
1059
+ interface LlmsTxtRoute extends PublicRoute {
1060
+ /** Page label in the app's language (static routes; a dynamic route uses each record's title) */
1061
+ title?: string;
1062
+ /** Page description in the app's language (static routes) */
1063
+ description?: string;
1064
+ /** Section heading (static default: the pages heading; dynamic default: the entity's plural name) */
1065
+ section?: string;
1066
+ }
1067
+
1068
+ /** Build-written part of llms.txt. */
1069
+ interface LlmsTxtSource {
1070
+ /** Site name (appConfig.app.name) */
1071
+ name: string;
1072
+ /** Site summary (appConfig.app.description) */
1073
+ summary?: string;
1074
+ /** Absolute production URL, no trailing slash */
1075
+ baseUrl: string;
1076
+ /** Heading of the static pages section, in the app's language */
1077
+ pagesHeading: string;
1078
+ /** Same routes as the sitemap, in sitemap order */
1079
+ routes: readonly LlmsTxtRoute[];
1080
+ /** Entity i18n namespace (`entity-product`) → plural name in the app's language */
1081
+ entityHeadings: Readonly<Record<string, string>>;
1082
+ /** App default language: record titles/descriptions are formatted in it */
1083
+ language: string;
1084
+ /** Entity namespaces and `crud` in `language` (namespace → translation JSON) */
1085
+ translations: Readonly<Record<string, Record<string, unknown>>>;
1086
+ }
1087
+
1088
+ /** What the generated llms.txt route passes besides the build-written source. */
1089
+ interface LlmsTxtContext {
1090
+ /** The app's entity definitions (`import * as entities from 'entities'`) */
1091
+ entities: Readonly<Record<string, unknown>>;
1092
+ /** Public (anonymous) CRUD reader; required when a route lists records (`collection`) */
1093
+ crud?: ICrudAdapter;
1094
+ /** `deriveEntitySeo` from @donotdev/core/server */
1095
+ deriveEntitySeo: (
1096
+ entity: AnyEntity,
1097
+ data: EntitySeoRecord,
1098
+ options: EntitySeoOptions
1099
+ ) => EntitySeo;
1100
+ /** `HIDDEN_STATUSES` from @donotdev/core/server: records with these statuses are not listed */
1101
+ hiddenStatuses: readonly string[];
1102
+ }
1103
+
1104
+ /**
1105
+ * Build the app's llms.txt: the sitemap's pages, static ones under the pages heading,
1106
+ * entity records under their entity's plural name with their `deriveEntitySeo` title.
1107
+ *
1108
+ * @throws When a static route has no label, a collection has no entity definition or
1109
+ * heading, a published record has no title, or the read fails
1110
+ */
1111
+ declare function buildLlmsTxt(
1112
+ source: LlmsTxtSource & LlmsTxtContext
1113
+ ): Promise<string>;
1114
+
1115
+ export { buildLlmsTxt, buildSitemap, clearMetadataCache, defineNextConfig, definePostCSSConfig, formatSitemapXml, getMetadataForPath };
1116
+ export type { LlmsTxtContext, LlmsTxtRoute, LlmsTxtSource, NextConfigOptions, PublicRoute, SitemapContext, SitemapEntry, SitemapRoute };