@donotdev/core 0.0.13 → 0.0.15
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/eslint/index.js +1 -1
- package/functions/index.d.ts +1083 -3
- package/functions/index.js +11 -1
- package/i18n/locales/eager/dndev_ar.json +0 -139
- package/i18n/locales/eager/dndev_de.json +0 -139
- package/i18n/locales/eager/dndev_en.json +5 -139
- package/i18n/locales/eager/dndev_es.json +0 -139
- package/i18n/locales/eager/dndev_fr.json +0 -139
- package/i18n/locales/eager/dndev_it.json +47 -186
- package/i18n/locales/eager/dndev_ja.json +0 -139
- package/i18n/locales/eager/dndev_ko.json +0 -139
- package/i18n/locales/lazy/crud_ar.json +195 -0
- package/i18n/locales/lazy/crud_de.json +195 -0
- package/i18n/locales/lazy/crud_en.json +412 -0
- package/i18n/locales/lazy/crud_es.json +195 -0
- package/i18n/locales/lazy/crud_fr.json +195 -0
- package/i18n/locales/lazy/crud_it.json +195 -0
- package/i18n/locales/lazy/crud_ja.json +195 -0
- package/i18n/locales/lazy/crud_ko.json +195 -0
- package/i18n/locales/lazy/oauth_ar.json +11 -11
- package/i18n/locales/lazy/oauth_de.json +11 -11
- package/i18n/locales/lazy/oauth_en.json +11 -11
- package/i18n/locales/lazy/oauth_es.json +11 -11
- package/i18n/locales/lazy/oauth_fr.json +11 -11
- package/i18n/locales/lazy/oauth_it.json +11 -11
- package/i18n/locales/lazy/oauth_ja.json +11 -11
- package/i18n/locales/lazy/oauth_ko.json +11 -11
- package/index.d.ts +6636 -6348
- package/index.js +37 -37
- package/next/index.d.ts +209 -154
- package/next/index.js +20 -20
- package/package.json +1 -1
- package/server.d.ts +4787 -3940
- package/server.js +1 -1
- package/vite/index.d.ts +209 -154
- package/vite/index.js +2 -2
package/functions/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type Platform$1 = 'browser' | 'node' | 'neutral'
|
|
2
5
|
type Format = 'iife' | 'cjs' | 'esm'
|
|
3
6
|
type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'local-css' | 'text' | 'ts' | 'tsx'
|
|
4
7
|
type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'
|
|
@@ -25,7 +28,7 @@ interface CommonOptions {
|
|
|
25
28
|
/** Documentation: https://esbuild.github.io/api/#supported */
|
|
26
29
|
supported?: Record<string, boolean>
|
|
27
30
|
/** Documentation: https://esbuild.github.io/api/#platform */
|
|
28
|
-
platform?: Platform
|
|
31
|
+
platform?: Platform$1
|
|
29
32
|
|
|
30
33
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
|
31
34
|
mangleProps?: RegExp
|
|
@@ -687,6 +690,1060 @@ declare global {
|
|
|
687
690
|
}
|
|
688
691
|
}
|
|
689
692
|
|
|
693
|
+
// packages/core/types/src/auth/constants.ts
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
// =============================================================================
|
|
698
|
+
// User Role Constants
|
|
699
|
+
// =============================================================================
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Standard user role names
|
|
703
|
+
* Apps can override these by providing their own role constants
|
|
704
|
+
*
|
|
705
|
+
* @version 0.0.1
|
|
706
|
+
* @since 0.0.1
|
|
707
|
+
* @author AMBROISE PARK Consulting
|
|
708
|
+
*/
|
|
709
|
+
declare const USER_ROLES = {
|
|
710
|
+
GUEST: 'guest',
|
|
711
|
+
USER: 'user',
|
|
712
|
+
ADMIN: 'admin',
|
|
713
|
+
SUPER: 'super',
|
|
714
|
+
} as const;
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Type for user role names
|
|
718
|
+
* Apps can extend this with their own custom roles
|
|
719
|
+
*
|
|
720
|
+
* @version 0.0.1
|
|
721
|
+
* @since 0.0.1
|
|
722
|
+
* @author AMBROISE PARK Consulting
|
|
723
|
+
*/
|
|
724
|
+
type UserRole = (typeof USER_ROLES)[keyof typeof USER_ROLES] | string;
|
|
725
|
+
|
|
726
|
+
// =============================================================================
|
|
727
|
+
// Subscription Tier Constants
|
|
728
|
+
// =============================================================================
|
|
729
|
+
|
|
730
|
+
/**
|
|
731
|
+
* Standard subscription tier names
|
|
732
|
+
* Apps can override these by providing their own tier constants
|
|
733
|
+
*
|
|
734
|
+
* @version 0.0.1
|
|
735
|
+
* @since 0.0.1
|
|
736
|
+
* @author AMBROISE PARK Consulting
|
|
737
|
+
*/
|
|
738
|
+
declare const SUBSCRIPTION_TIERS = {
|
|
739
|
+
FREE: 'free',
|
|
740
|
+
PRO: 'pro',
|
|
741
|
+
PREMIUM: 'premium',
|
|
742
|
+
} as const;
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* Type for subscription tier names
|
|
746
|
+
* Apps can extend this with their own custom tiers
|
|
747
|
+
*
|
|
748
|
+
* @version 0.0.1
|
|
749
|
+
* @since 0.0.1
|
|
750
|
+
* @author AMBROISE PARK Consulting
|
|
751
|
+
*/
|
|
752
|
+
type SubscriptionTier =
|
|
753
|
+
| (typeof SUBSCRIPTION_TIERS)[keyof typeof SUBSCRIPTION_TIERS]
|
|
754
|
+
| string;
|
|
755
|
+
|
|
756
|
+
// packages/core/types/src/common/index.ts
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
// =============================================================================
|
|
761
|
+
// PLATFORM CONSTANTS
|
|
762
|
+
// =============================================================================
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* Supported platform identifiers
|
|
766
|
+
* @constant
|
|
767
|
+
*/
|
|
768
|
+
declare const PLATFORMS = {
|
|
769
|
+
VITE: 'vite',
|
|
770
|
+
NEXTJS: 'nextjs',
|
|
771
|
+
UNKNOWN: 'unknown',
|
|
772
|
+
} as const;
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Platform type derived from PLATFORMS constant
|
|
776
|
+
*/
|
|
777
|
+
type Platform = (typeof PLATFORMS)[keyof typeof PLATFORMS];
|
|
778
|
+
|
|
779
|
+
// =============================================================================
|
|
780
|
+
// ENVIRONMENT CONSTANTS
|
|
781
|
+
// =============================================================================
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Supported environment modes
|
|
785
|
+
* @constant
|
|
786
|
+
*/
|
|
787
|
+
declare const ENVIRONMENTS = {
|
|
788
|
+
DEVELOPMENT: 'development',
|
|
789
|
+
PRODUCTION: 'production',
|
|
790
|
+
TEST: 'test',
|
|
791
|
+
} as const;
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Environment mode type derived from ENVIRONMENTS constant
|
|
795
|
+
*/
|
|
796
|
+
type EnvironmentMode = (typeof ENVIRONMENTS)[keyof typeof ENVIRONMENTS];
|
|
797
|
+
|
|
798
|
+
// =============================================================================
|
|
799
|
+
// CONTEXT CONSTANTS
|
|
800
|
+
// =============================================================================
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Supported execution contexts
|
|
804
|
+
* @constant
|
|
805
|
+
*/
|
|
806
|
+
declare const CONTEXTS = {
|
|
807
|
+
CLIENT: 'client',
|
|
808
|
+
SERVER: 'server',
|
|
809
|
+
BUILD: 'build',
|
|
810
|
+
} as const;
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Context type derived from CONTEXTS constant
|
|
814
|
+
*/
|
|
815
|
+
type Context = (typeof CONTEXTS)[keyof typeof CONTEXTS];
|
|
816
|
+
|
|
817
|
+
// =============================================================================
|
|
818
|
+
// STORAGE CONSTANTS
|
|
819
|
+
// =============================================================================
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* Supported storage backend types
|
|
823
|
+
* @constant
|
|
824
|
+
*/
|
|
825
|
+
declare const STORAGE_TYPES = {
|
|
826
|
+
LOCAL: 'localStorage',
|
|
827
|
+
SESSION: 'sessionStorage',
|
|
828
|
+
INDEXED_DB: 'indexedDB',
|
|
829
|
+
MEMORY: 'memory',
|
|
830
|
+
} as const;
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* Storage type derived from STORAGE_TYPES constant
|
|
834
|
+
*/
|
|
835
|
+
type StorageType = (typeof STORAGE_TYPES)[keyof typeof STORAGE_TYPES];
|
|
836
|
+
|
|
837
|
+
// =============================================================================
|
|
838
|
+
// PWA CONSTANTS
|
|
839
|
+
// =============================================================================
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* PWA display modes
|
|
843
|
+
* @constant
|
|
844
|
+
*/
|
|
845
|
+
declare const PWA_DISPLAY_MODES = {
|
|
846
|
+
STANDALONE: 'standalone',
|
|
847
|
+
FULLSCREEN: 'fullscreen',
|
|
848
|
+
MINIMAL_UI: 'minimal-ui',
|
|
849
|
+
BROWSER: 'browser',
|
|
850
|
+
} as const;
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* PWA display mode type derived from PWA_DISPLAY_MODES constant
|
|
854
|
+
*/
|
|
855
|
+
type PWADisplayMode =
|
|
856
|
+
(typeof PWA_DISPLAY_MODES)[keyof typeof PWA_DISPLAY_MODES];
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* PWA asset types
|
|
860
|
+
* @constant
|
|
861
|
+
*/
|
|
862
|
+
declare const PWA_ASSET_TYPES = {
|
|
863
|
+
MANIFEST: 'manifest',
|
|
864
|
+
SERVICE_WORKER: 'service-worker',
|
|
865
|
+
ICON: 'icon',
|
|
866
|
+
} as const;
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* PWA asset type derived from PWA_ASSET_TYPES constant
|
|
870
|
+
*/
|
|
871
|
+
type PWAAssetType =
|
|
872
|
+
(typeof PWA_ASSET_TYPES)[keyof typeof PWA_ASSET_TYPES];
|
|
873
|
+
|
|
874
|
+
// =============================================================================
|
|
875
|
+
// ROUTE DISCOVERY CONSTANTS
|
|
876
|
+
// =============================================================================
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* Route discovery sources
|
|
880
|
+
* @constant
|
|
881
|
+
*/
|
|
882
|
+
declare const ROUTE_SOURCES = {
|
|
883
|
+
AUTO: 'auto-discovery',
|
|
884
|
+
MANUAL: 'manual',
|
|
885
|
+
HYBRID: 'hybrid',
|
|
886
|
+
} as const;
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* Route source type derived from ROUTE_SOURCES constant
|
|
890
|
+
*/
|
|
891
|
+
type RouteSource = (typeof ROUTE_SOURCES)[keyof typeof ROUTE_SOURCES];
|
|
892
|
+
|
|
893
|
+
// =============================================================================
|
|
894
|
+
// AUTHENTICATION TYPES
|
|
895
|
+
// =============================================================================
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* Page-level authentication requirements
|
|
899
|
+
* @description Used in PageMeta and NavigationRoute for route-level auth
|
|
900
|
+
*/
|
|
901
|
+
type PageAuth =
|
|
902
|
+
| boolean
|
|
903
|
+
| {
|
|
904
|
+
/** Whether authentication is required */
|
|
905
|
+
required?: boolean;
|
|
906
|
+
/** Required user role */
|
|
907
|
+
role?: UserRole;
|
|
908
|
+
/** Required subscription tier */
|
|
909
|
+
tier?: SubscriptionTier;
|
|
910
|
+
/** Custom validation function */
|
|
911
|
+
validate?: (role: string, tier: string) => boolean;
|
|
912
|
+
};
|
|
913
|
+
|
|
914
|
+
// =============================================================================
|
|
915
|
+
// PAGE METADATA TYPES
|
|
916
|
+
// =============================================================================
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Page metadata interface for route discovery and configuration
|
|
920
|
+
*
|
|
921
|
+
* @remarks
|
|
922
|
+
* **ALL PROPERTIES ARE OPTIONAL** - Framework provides smart defaults:
|
|
923
|
+
*
|
|
924
|
+
* - `auth`: false (public) by default - YOU must specify auth requirements explicitly
|
|
925
|
+
* - `title`: Auto-extracted from filename (ShowcasePage → "Showcase")
|
|
926
|
+
* - `entity`: Auto-extracted from path (pages/showcase/ → "showcase")
|
|
927
|
+
* - `action`: Auto-extracted from filename patterns (ListPage → "list", FormPage → "form")
|
|
928
|
+
* - `route`: Only needed for custom paths or dynamic routes like :id, :slug
|
|
929
|
+
*
|
|
930
|
+
* @example Simple page (no meta needed):
|
|
931
|
+
* ```tsx
|
|
932
|
+
* export function HomePage() {
|
|
933
|
+
* return <PageContainer>...</PageContainer>;
|
|
934
|
+
* }
|
|
935
|
+
* // Framework provides: auth=false, title from home.title, entity=home
|
|
936
|
+
* ```
|
|
937
|
+
*
|
|
938
|
+
* @example Dynamic route (string format - explicit path):
|
|
939
|
+
* ```tsx
|
|
940
|
+
* export const meta: PageMeta = {
|
|
941
|
+
* route: '/blog/:slug' // Creates /blog/:slug
|
|
942
|
+
* };
|
|
943
|
+
* // Framework provides: auth=false, title from blog.title, entity=blog
|
|
944
|
+
* ```
|
|
945
|
+
*
|
|
946
|
+
* @example Dynamic route (object format - auto-generates base path):
|
|
947
|
+
* ```tsx
|
|
948
|
+
* export const meta: PageMeta = {
|
|
949
|
+
* route: { params: ['id'] } // Creates /myRoute/:id (base path from file location)
|
|
950
|
+
* };
|
|
951
|
+
* // For file at pages/myRoute/DetailPage.tsx → route becomes /myRoute/:id
|
|
952
|
+
* ```
|
|
953
|
+
*
|
|
954
|
+
* @example Auth-required (developer must be explicit):
|
|
955
|
+
* ```tsx
|
|
956
|
+
* export const meta: PageMeta = {
|
|
957
|
+
* auth: { required: true } // YOU decide what needs auth
|
|
958
|
+
* };
|
|
959
|
+
* ```
|
|
960
|
+
*/
|
|
961
|
+
interface PageMeta {
|
|
962
|
+
/** Authentication requirements for this route */
|
|
963
|
+
auth?: PageAuth;
|
|
964
|
+
|
|
965
|
+
/** Route configuration - just define the exact path you want */
|
|
966
|
+
route?: string | { params?: string[] };
|
|
967
|
+
|
|
968
|
+
/** Page title (optional - framework auto-extracts from filename if not provided) */
|
|
969
|
+
title?: string;
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* Translation/SEO namespace for this page
|
|
973
|
+
* @description Used for meta tags and translations
|
|
974
|
+
*/
|
|
975
|
+
namespace?: string;
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* Icon for navigation (optional - framework provides smart defaults)
|
|
979
|
+
* @description **ONLY lucide-react JSX components** - extracted as component name string at build time for tree-shaking.
|
|
980
|
+
*
|
|
981
|
+
* **RESTRICTIONS:**
|
|
982
|
+
* - ✅ Only: `<Rocket />`, `<ShoppingCart />`, `<Home />` (lucide-react JSX components)
|
|
983
|
+
* - ❌ NOT: Emojis (`"🚀"`), strings (`"Rocket"`), or custom ReactNode
|
|
984
|
+
*
|
|
985
|
+
* **Why?** This is for build-time extraction and tree-shaking. The component name is extracted and stored as a string.
|
|
986
|
+
*
|
|
987
|
+
* **For flexible icons** (emojis, strings, custom components), use the `Icon` component directly in your JSX, not in PageMeta.
|
|
988
|
+
*
|
|
989
|
+
* @example
|
|
990
|
+
* ```tsx
|
|
991
|
+
* import { Rocket } from 'lucide-react';
|
|
992
|
+
* export const meta: PageMeta = {
|
|
993
|
+
* icon: <Rocket /> // ✅ Correct - lucide-react component
|
|
994
|
+
* };
|
|
995
|
+
* ```
|
|
996
|
+
*
|
|
997
|
+
* @example
|
|
998
|
+
* ```tsx
|
|
999
|
+
* // ❌ WRONG - Don't use emojis or strings in PageMeta
|
|
1000
|
+
* export const meta: PageMeta = {
|
|
1001
|
+
* icon: "🚀" // ❌ Not supported in PageMeta
|
|
1002
|
+
* };
|
|
1003
|
+
* ```
|
|
1004
|
+
*/
|
|
1005
|
+
icon?: ReactNode;
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1008
|
+
* Hide from navigation menu (default: false - shows in navigation)
|
|
1009
|
+
* @description Set to true to exclude this route from navigation menus
|
|
1010
|
+
* @default false
|
|
1011
|
+
* @example
|
|
1012
|
+
* ```tsx
|
|
1013
|
+
* export const meta: PageMeta = {
|
|
1014
|
+
* hideFromMenu: true // Won't appear in HeaderNavigation, Sidebar, etc.
|
|
1015
|
+
* };
|
|
1016
|
+
* ```
|
|
1017
|
+
*/
|
|
1018
|
+
hideFromMenu?: boolean;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* Route metadata (discovery-generated)
|
|
1023
|
+
* @description Complete route metadata including auto-discovered fields from RouteDiscovery
|
|
1024
|
+
*
|
|
1025
|
+
* This extends PageMeta with fields that are automatically discovered from file paths:
|
|
1026
|
+
* - `entity`: Auto-extracted from path (pages/showcase/ → "showcase")
|
|
1027
|
+
* - `action`: Auto-extracted from filename patterns (ListPage → "list", FormPage → "form")
|
|
1028
|
+
*
|
|
1029
|
+
* These fields are always present in discovered routes but cannot be set in PageMeta.
|
|
1030
|
+
*
|
|
1031
|
+
* @version 0.0.1
|
|
1032
|
+
* @since 0.0.1
|
|
1033
|
+
* @author AMBROISE PARK Consulting
|
|
1034
|
+
*/
|
|
1035
|
+
interface RouteMeta extends PageMeta {
|
|
1036
|
+
/** Entity/domain grouping - auto-discovered from file path (not user-configurable) */
|
|
1037
|
+
entity?: string;
|
|
1038
|
+
/** Action type for route categorization - auto-discovered from filename patterns (not user-configurable) */
|
|
1039
|
+
action?: string | null;
|
|
1040
|
+
/** File path where route was discovered */
|
|
1041
|
+
file?: string;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
// =============================================================================
|
|
1045
|
+
// PLUGIN CONFIGURATION TYPES
|
|
1046
|
+
// =============================================================================
|
|
1047
|
+
|
|
1048
|
+
/**
|
|
1049
|
+
* i18n Plugin Configuration
|
|
1050
|
+
* @description Configuration for internationalization system
|
|
1051
|
+
*/
|
|
1052
|
+
interface I18nPluginConfig {
|
|
1053
|
+
/** Mapping of language → namespace → loader function */
|
|
1054
|
+
mapping: Record<string, Record<string, () => Promise<any>>>;
|
|
1055
|
+
/** List of available language codes */
|
|
1056
|
+
languages: string[];
|
|
1057
|
+
/** List of eagerly loaded namespace identifiers */
|
|
1058
|
+
eager: string[];
|
|
1059
|
+
/** Fallback language code */
|
|
1060
|
+
fallback: string;
|
|
1061
|
+
/** Preloaded translation content (optional) */
|
|
1062
|
+
content?: Record<string, Record<string, any>>;
|
|
1063
|
+
/** Storage configuration */
|
|
1064
|
+
storage: {
|
|
1065
|
+
/** Storage backend type */
|
|
1066
|
+
type: StorageType;
|
|
1067
|
+
/** Storage key prefix */
|
|
1068
|
+
prefix: string;
|
|
1069
|
+
/** Time-to-live in seconds */
|
|
1070
|
+
ttl: number;
|
|
1071
|
+
/** Whether to encrypt stored data */
|
|
1072
|
+
encryption: boolean;
|
|
1073
|
+
/** Maximum storage size in bytes */
|
|
1074
|
+
maxSize: number;
|
|
1075
|
+
};
|
|
1076
|
+
/** Performance configuration */
|
|
1077
|
+
performance: {
|
|
1078
|
+
/** Maximum cache size */
|
|
1079
|
+
cacheSize: number;
|
|
1080
|
+
/** Error cache TTL in seconds */
|
|
1081
|
+
errorCacheTTL: number;
|
|
1082
|
+
};
|
|
1083
|
+
/** Discovery manifest metadata */
|
|
1084
|
+
manifest: {
|
|
1085
|
+
/** Total number of translation files */
|
|
1086
|
+
totalFiles: number;
|
|
1087
|
+
/** Total number of namespaces */
|
|
1088
|
+
totalNamespaces: number;
|
|
1089
|
+
/** Total number of languages */
|
|
1090
|
+
totalLanguages: number;
|
|
1091
|
+
/** Number of eagerly loaded namespaces */
|
|
1092
|
+
eagerNamespaces: number;
|
|
1093
|
+
/** ISO timestamp of generation */
|
|
1094
|
+
generatedAt: string;
|
|
1095
|
+
};
|
|
1096
|
+
/** Whether debug mode is enabled */
|
|
1097
|
+
debug: boolean;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* Routes Plugin Configuration
|
|
1102
|
+
* @description Complete route configuration populated by discovery system
|
|
1103
|
+
*/
|
|
1104
|
+
interface RoutesPluginConfig {
|
|
1105
|
+
/**
|
|
1106
|
+
* Array of discovered routes
|
|
1107
|
+
* @description All routes discovered by the route discovery system
|
|
1108
|
+
*/
|
|
1109
|
+
mapping: Array<{
|
|
1110
|
+
/**
|
|
1111
|
+
* URL path for the route (platform-agnostic)
|
|
1112
|
+
* @description The URL path that users see in their browser
|
|
1113
|
+
* @example '/showcase/layouts', '/users/:id', '/dashboard'
|
|
1114
|
+
*/
|
|
1115
|
+
path: string;
|
|
1116
|
+
|
|
1117
|
+
/**
|
|
1118
|
+
* Lazy component reference (Vite-specific)
|
|
1119
|
+
* @description React.lazy() component for code splitting
|
|
1120
|
+
* @example lazy(() => import("/src/pages/showcase/LayoutsPage"))
|
|
1121
|
+
*/
|
|
1122
|
+
component: any;
|
|
1123
|
+
|
|
1124
|
+
/**
|
|
1125
|
+
* Absolute file system path (Next.js-specific)
|
|
1126
|
+
* @description The absolute path to the component file
|
|
1127
|
+
* @example '/src/pages/showcase/LayoutsPage.tsx'
|
|
1128
|
+
*/
|
|
1129
|
+
importPath: string;
|
|
1130
|
+
|
|
1131
|
+
/**
|
|
1132
|
+
* Export name for named exports
|
|
1133
|
+
* @example 'HomePage', 'AboutPage'
|
|
1134
|
+
*/
|
|
1135
|
+
exportName?: string;
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* Authentication configuration (platform-agnostic)
|
|
1139
|
+
* @description Defines whether the route requires authentication
|
|
1140
|
+
*/
|
|
1141
|
+
auth: PageAuth;
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
* Route metadata (platform-agnostic)
|
|
1145
|
+
* @description Additional information about the route, including auto-discovered fields
|
|
1146
|
+
*/
|
|
1147
|
+
meta: RouteMeta;
|
|
1148
|
+
}>;
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* Discovery metadata and statistics
|
|
1152
|
+
* @description Information about the route discovery process
|
|
1153
|
+
*/
|
|
1154
|
+
manifest: {
|
|
1155
|
+
/** Total number of discovered routes */
|
|
1156
|
+
totalRoutes: number;
|
|
1157
|
+
/** Number of routes requiring authentication */
|
|
1158
|
+
authRequired: number;
|
|
1159
|
+
/** Number of public routes */
|
|
1160
|
+
publicRoutes: number;
|
|
1161
|
+
/** Source of routes (auto-discovery vs manual) */
|
|
1162
|
+
source: RouteSource;
|
|
1163
|
+
/** ISO timestamp when routes were generated */
|
|
1164
|
+
generatedAt: string;
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
/**
|
|
1169
|
+
* Themes Plugin Configuration
|
|
1170
|
+
* @description Configuration for theme discovery and management
|
|
1171
|
+
*/
|
|
1172
|
+
interface ThemesPluginConfig {
|
|
1173
|
+
/** Mapping of theme names to theme configurations */
|
|
1174
|
+
mapping: Record<string, any>;
|
|
1175
|
+
/** Array of discovered themes */
|
|
1176
|
+
discovered: Array<{
|
|
1177
|
+
/** Theme identifier */
|
|
1178
|
+
name: string;
|
|
1179
|
+
/** Human-readable theme name */
|
|
1180
|
+
displayName: string;
|
|
1181
|
+
/** Whether this is a dark theme */
|
|
1182
|
+
isDark: boolean;
|
|
1183
|
+
/** Theme metadata */
|
|
1184
|
+
meta: {
|
|
1185
|
+
/** Icon identifier */
|
|
1186
|
+
icon: string;
|
|
1187
|
+
/** Theme description */
|
|
1188
|
+
description?: string;
|
|
1189
|
+
/** Theme category */
|
|
1190
|
+
category?: string;
|
|
1191
|
+
/** Theme author */
|
|
1192
|
+
author?: string;
|
|
1193
|
+
/** Additional metadata */
|
|
1194
|
+
[key: string]: any;
|
|
1195
|
+
};
|
|
1196
|
+
/** Source file path */
|
|
1197
|
+
source: string;
|
|
1198
|
+
/** Whether theme is essential (cannot be disabled) */
|
|
1199
|
+
essential: boolean;
|
|
1200
|
+
}>;
|
|
1201
|
+
/** CSS custom property variables */
|
|
1202
|
+
variables: Record<string, string>;
|
|
1203
|
+
/** Utility class mappings */
|
|
1204
|
+
utilities: Record<string, Record<string, string>>;
|
|
1205
|
+
/** Discovery manifest metadata */
|
|
1206
|
+
manifest: {
|
|
1207
|
+
/** Total number of discovered themes */
|
|
1208
|
+
totalThemes: number;
|
|
1209
|
+
/** Total number of CSS variables */
|
|
1210
|
+
totalVariables: number;
|
|
1211
|
+
/** Total number of utility classes */
|
|
1212
|
+
totalUtilities: number;
|
|
1213
|
+
/** ISO timestamp of generation */
|
|
1214
|
+
generatedAt: string;
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* Assets Plugin Configuration
|
|
1220
|
+
* @description Configuration for static asset management
|
|
1221
|
+
*/
|
|
1222
|
+
interface AssetsPluginConfig {
|
|
1223
|
+
/** Mapping of asset paths to asset metadata */
|
|
1224
|
+
mapping: Record<string, any>;
|
|
1225
|
+
/** SVG content of logo.svg for inline rendering with CSS variable theming */
|
|
1226
|
+
logoSvgContent?: string | null;
|
|
1227
|
+
/** Discovery manifest metadata */
|
|
1228
|
+
manifest: {
|
|
1229
|
+
/** Total number of discovered assets */
|
|
1230
|
+
totalAssets: number;
|
|
1231
|
+
/** ISO timestamp of generation */
|
|
1232
|
+
generatedAt: string;
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
/**
|
|
1237
|
+
* PWA Plugin Configuration
|
|
1238
|
+
* @description Configuration for Progressive Web App features
|
|
1239
|
+
*/
|
|
1240
|
+
interface PWAPluginConfig {
|
|
1241
|
+
/** Array of PWA assets */
|
|
1242
|
+
assets: Array<{
|
|
1243
|
+
/** Type of PWA asset */
|
|
1244
|
+
type: PWAAssetType;
|
|
1245
|
+
/** Asset file path */
|
|
1246
|
+
path: string;
|
|
1247
|
+
/** Asset file size in bytes */
|
|
1248
|
+
size?: number;
|
|
1249
|
+
/** Asset content (for inline assets) */
|
|
1250
|
+
content?: any;
|
|
1251
|
+
/** Asset format (for images) */
|
|
1252
|
+
format?: string;
|
|
1253
|
+
/** Asset purpose (for icons) */
|
|
1254
|
+
purpose?: string;
|
|
1255
|
+
}>;
|
|
1256
|
+
/** PWA manifest configuration */
|
|
1257
|
+
manifest: {
|
|
1258
|
+
/** Application name */
|
|
1259
|
+
name: string;
|
|
1260
|
+
/** Short application name */
|
|
1261
|
+
short_name: string;
|
|
1262
|
+
/** Application description */
|
|
1263
|
+
description: string;
|
|
1264
|
+
/** Start URL */
|
|
1265
|
+
start_url: string;
|
|
1266
|
+
/** Display mode */
|
|
1267
|
+
display: PWADisplayMode;
|
|
1268
|
+
/** Background color */
|
|
1269
|
+
background_color: string;
|
|
1270
|
+
/** Theme color */
|
|
1271
|
+
theme_color: string;
|
|
1272
|
+
/** Array of app icons */
|
|
1273
|
+
icons: Array<{
|
|
1274
|
+
/** Icon source path */
|
|
1275
|
+
src: string;
|
|
1276
|
+
/** Icon sizes (e.g., '192x192') */
|
|
1277
|
+
sizes: string;
|
|
1278
|
+
/** Icon MIME type */
|
|
1279
|
+
type: string;
|
|
1280
|
+
/** Icon purpose (e.g., 'any', 'maskable') */
|
|
1281
|
+
purpose: string;
|
|
1282
|
+
}>;
|
|
1283
|
+
};
|
|
1284
|
+
/** Discovery manifest metadata */
|
|
1285
|
+
manifestInfo: {
|
|
1286
|
+
/** Total number of PWA assets */
|
|
1287
|
+
totalAssets: number;
|
|
1288
|
+
/** Total number of icons */
|
|
1289
|
+
totalIcons: number;
|
|
1290
|
+
/** Whether service worker is present */
|
|
1291
|
+
hasServiceWorker: boolean;
|
|
1292
|
+
/** ISO timestamp of generation */
|
|
1293
|
+
generatedAt: string;
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
/**
|
|
1298
|
+
* Features Plugin Configuration
|
|
1299
|
+
* @description Configuration for feature discovery and enablement
|
|
1300
|
+
*
|
|
1301
|
+
* @remarks
|
|
1302
|
+
* This interface defines the structure for feature discovery data that is populated
|
|
1303
|
+
* at build time and made available at runtime for feature availability checking.
|
|
1304
|
+
*
|
|
1305
|
+
* @example
|
|
1306
|
+
* ```typescript
|
|
1307
|
+
* // Generated by feature discovery system
|
|
1308
|
+
* const featuresConfig: FeaturesPluginConfig = {
|
|
1309
|
+
* available: ['auth', 'billing', 'i18n', 'oauth'],
|
|
1310
|
+
* enabled: ['auth', 'i18n'],
|
|
1311
|
+
* overridden: false
|
|
1312
|
+
* };
|
|
1313
|
+
* ```
|
|
1314
|
+
*/
|
|
1315
|
+
interface FeaturesPluginConfig {
|
|
1316
|
+
/**
|
|
1317
|
+
* List of all available features discovered in packages/features/
|
|
1318
|
+
* @example ['auth', 'billing', 'i18n', 'oauth']
|
|
1319
|
+
*/
|
|
1320
|
+
available: string[];
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
// =============================================================================
|
|
1324
|
+
// FRAMEWORK CONFIGURATION
|
|
1325
|
+
// =============================================================================
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* Complete DoNotDev framework configuration structure
|
|
1329
|
+
* @description Single source of truth for all framework configuration
|
|
1330
|
+
*
|
|
1331
|
+
* @remarks
|
|
1332
|
+
* All discovery plugins add their data to this unified config.
|
|
1333
|
+
* Available at runtime via globalThis._DNDEV_CONFIG_ or window._DNDEV_CONFIG_
|
|
1334
|
+
*/
|
|
1335
|
+
interface DndevFrameworkConfig {
|
|
1336
|
+
/** Framework platform (Vite or Next.js) */
|
|
1337
|
+
platform: Platform;
|
|
1338
|
+
/** Current environment mode */
|
|
1339
|
+
mode: EnvironmentMode;
|
|
1340
|
+
/** Framework version */
|
|
1341
|
+
version: string;
|
|
1342
|
+
/** Execution context */
|
|
1343
|
+
context: Context;
|
|
1344
|
+
/** Unix timestamp of config generation */
|
|
1345
|
+
timestamp: number;
|
|
1346
|
+
/** i18n plugin configuration (optional) */
|
|
1347
|
+
i18n?: I18nPluginConfig;
|
|
1348
|
+
/** Routes plugin configuration (optional) */
|
|
1349
|
+
routes?: RoutesPluginConfig;
|
|
1350
|
+
/** Themes plugin configuration (optional) */
|
|
1351
|
+
themes?: ThemesPluginConfig;
|
|
1352
|
+
/** Assets plugin configuration (optional) */
|
|
1353
|
+
assets?: AssetsPluginConfig;
|
|
1354
|
+
/** PWA plugin configuration (optional) */
|
|
1355
|
+
pwa?: PWAPluginConfig;
|
|
1356
|
+
/** Features plugin configuration (optional) */
|
|
1357
|
+
features?: FeaturesPluginConfig;
|
|
1358
|
+
/** Environment variables (VITE_* variables from .env files) */
|
|
1359
|
+
env?: Record<string, string>;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
// =============================================================================
|
|
1363
|
+
// GLOBAL AUGMENTATIONS
|
|
1364
|
+
// =============================================================================
|
|
1365
|
+
|
|
1366
|
+
declare global {
|
|
1367
|
+
interface Window {
|
|
1368
|
+
/**
|
|
1369
|
+
* Single source of truth for all DoNotDev framework configuration
|
|
1370
|
+
* @description Set by platform detection and populated by discovery plugins
|
|
1371
|
+
*/
|
|
1372
|
+
_DNDEV_CONFIG_?: DndevFrameworkConfig;
|
|
1373
|
+
|
|
1374
|
+
/**
|
|
1375
|
+
* Global store registry for singleton Zustand stores
|
|
1376
|
+
* @description Ensures single instance across code-split chunks
|
|
1377
|
+
*/
|
|
1378
|
+
_DNDEV_STORES_?: Record<string, any>;
|
|
1379
|
+
|
|
1380
|
+
/** PapaParse CSV parser library (external) */
|
|
1381
|
+
Papa?: {
|
|
1382
|
+
parse: (input: string | File, config?: any) => any;
|
|
1383
|
+
unparse: (data: any[], config?: any) => string;
|
|
1384
|
+
};
|
|
1385
|
+
|
|
1386
|
+
/** Sentry error tracking library (external) */
|
|
1387
|
+
Sentry?: {
|
|
1388
|
+
captureException: (error: unknown) => void;
|
|
1389
|
+
withScope: (callback: (scope: any) => void) => void;
|
|
1390
|
+
getClient: () => { close: () => Promise<boolean> } | undefined;
|
|
1391
|
+
};
|
|
1392
|
+
|
|
1393
|
+
/**
|
|
1394
|
+
* Google APIs (Maps, One Tap, etc.)
|
|
1395
|
+
* @description Unified type for all Google services
|
|
1396
|
+
*/
|
|
1397
|
+
google?: {
|
|
1398
|
+
/** Google Maps API */
|
|
1399
|
+
maps?: {
|
|
1400
|
+
places?: {
|
|
1401
|
+
AutocompleteService: new () => any;
|
|
1402
|
+
PlacesService: new (element: HTMLElement) => any;
|
|
1403
|
+
PlacesServiceStatus: {
|
|
1404
|
+
OK: string;
|
|
1405
|
+
};
|
|
1406
|
+
};
|
|
1407
|
+
[key: string]: any;
|
|
1408
|
+
};
|
|
1409
|
+
/** Google Identity Services (One Tap) */
|
|
1410
|
+
accounts?: {
|
|
1411
|
+
id?: {
|
|
1412
|
+
initialize: (config: any) => void;
|
|
1413
|
+
prompt: (callback?: (notification: any) => void) => void;
|
|
1414
|
+
cancel?: () => void;
|
|
1415
|
+
disableAutoSelect?: () => void;
|
|
1416
|
+
};
|
|
1417
|
+
};
|
|
1418
|
+
[key: string]: any;
|
|
1419
|
+
};
|
|
1420
|
+
|
|
1421
|
+
/** FedCM Identity Credential API */
|
|
1422
|
+
IdentityCredential?: any;
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
namespace NodeJS {
|
|
1426
|
+
interface ProcessEnv {
|
|
1427
|
+
/** Serialized framework config for Node.js environment */
|
|
1428
|
+
_DNDEV_CONFIG_?: string;
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
namespace globalThis {
|
|
1433
|
+
/** Framework configuration (same as window._DNDEV_CONFIG_) */
|
|
1434
|
+
var _DNDEV_CONFIG_: DndevFrameworkConfig | undefined;
|
|
1435
|
+
/** Store registry (same as window._DNDEV_STORES_) */
|
|
1436
|
+
var _DNDEV_STORES_: Record<string, any> | undefined;
|
|
1437
|
+
|
|
1438
|
+
// Third-party framework globals (not owned by DoNotDev)
|
|
1439
|
+
var __vite_plugin_react_preamble_installed__: boolean | undefined;
|
|
1440
|
+
var __vite_hmr_port: number | undefined;
|
|
1441
|
+
var __NEXT_DATA__: any | undefined;
|
|
1442
|
+
var __REACT_QUERY_CLIENT__: any | undefined;
|
|
1443
|
+
var __REACT_QUERY_PROVIDER__: any | undefined;
|
|
1444
|
+
var __DNDEV_DEBUG: boolean | undefined;
|
|
1445
|
+
var __FIREBASE_DEMO_MODE__: boolean | undefined;
|
|
1446
|
+
// gc is already defined by Node.js globals - removed to avoid TS 5.9+ conflict
|
|
1447
|
+
var getAvailableThemes: (() => string[]) | undefined;
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
// packages/core/types/src/functions/functionTypes.ts
|
|
1452
|
+
|
|
1453
|
+
|
|
1454
|
+
|
|
1455
|
+
// =============================================================================
|
|
1456
|
+
// DEPLOYMENT CONFIGURATION TYPES (for functions.yaml generation)
|
|
1457
|
+
// =============================================================================
|
|
1458
|
+
|
|
1459
|
+
/**
|
|
1460
|
+
* Memory allocation options for Cloud Functions
|
|
1461
|
+
*
|
|
1462
|
+
* @version 0.0.1
|
|
1463
|
+
* @since 0.0.1
|
|
1464
|
+
* @author AMBROISE PARK Consulting
|
|
1465
|
+
*/
|
|
1466
|
+
type FunctionMemory =
|
|
1467
|
+
| '128MB'
|
|
1468
|
+
| '256MB'
|
|
1469
|
+
| '512MB'
|
|
1470
|
+
| '1GB'
|
|
1471
|
+
| '2GB'
|
|
1472
|
+
| '4GB'
|
|
1473
|
+
| '8GB';
|
|
1474
|
+
|
|
1475
|
+
/**
|
|
1476
|
+
* Function trigger types
|
|
1477
|
+
*
|
|
1478
|
+
* @version 0.0.1
|
|
1479
|
+
* @since 0.0.1
|
|
1480
|
+
* @author AMBROISE PARK Consulting
|
|
1481
|
+
*/
|
|
1482
|
+
type FunctionTrigger =
|
|
1483
|
+
| 'callable'
|
|
1484
|
+
| 'http'
|
|
1485
|
+
| 'pubsub'
|
|
1486
|
+
| 'firestore'
|
|
1487
|
+
| 'auth'
|
|
1488
|
+
| 'storage'
|
|
1489
|
+
| 'scheduled';
|
|
1490
|
+
|
|
1491
|
+
/**
|
|
1492
|
+
* Function-level deployment metadata
|
|
1493
|
+
* @description Per-function configuration for Firebase deployment (like PageMeta for pages)
|
|
1494
|
+
*
|
|
1495
|
+
* @version 0.0.1
|
|
1496
|
+
* @since 0.0.1
|
|
1497
|
+
* @author AMBROISE PARK Consulting
|
|
1498
|
+
*/
|
|
1499
|
+
interface FunctionMeta {
|
|
1500
|
+
/** Custom entry point name (defaults to export name) */
|
|
1501
|
+
entryPoint?: string;
|
|
1502
|
+
/** Deployment regions (overrides app defaults) */
|
|
1503
|
+
region?: string[];
|
|
1504
|
+
/** Platform version */
|
|
1505
|
+
platform?: 'gcfv1' | 'gcfv2';
|
|
1506
|
+
/** Category label for organization */
|
|
1507
|
+
category?: 'auth' | 'crud' | 'analytics' | 'scheduled' | 'webhook' | string;
|
|
1508
|
+
/** Additional labels */
|
|
1509
|
+
labels?: Record<string, string>;
|
|
1510
|
+
/** Trigger type (defaults to 'callable') */
|
|
1511
|
+
trigger?: FunctionTrigger;
|
|
1512
|
+
/** For scheduled functions - cron expression */
|
|
1513
|
+
schedule?: string;
|
|
1514
|
+
/** Memory allocation */
|
|
1515
|
+
memory?: FunctionMemory;
|
|
1516
|
+
/** Timeout in seconds */
|
|
1517
|
+
timeoutSeconds?: number;
|
|
1518
|
+
/** Minimum instances (for cold start optimization) */
|
|
1519
|
+
minInstances?: number;
|
|
1520
|
+
/** Maximum instances */
|
|
1521
|
+
maxInstances?: number;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
/**
|
|
1525
|
+
* CRUD entity configuration for auto-generation
|
|
1526
|
+
*
|
|
1527
|
+
* @version 0.0.1
|
|
1528
|
+
* @since 0.0.1
|
|
1529
|
+
* @author AMBROISE PARK Consulting
|
|
1530
|
+
*/
|
|
1531
|
+
interface CrudConfig {
|
|
1532
|
+
/** Entity collection names to generate CRUD for */
|
|
1533
|
+
entities: string[];
|
|
1534
|
+
/** Override defaults for all CRUD functions */
|
|
1535
|
+
defaults?: Partial<FunctionMeta>;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
/**
|
|
1539
|
+
* App-level defaults for all functions
|
|
1540
|
+
*
|
|
1541
|
+
* @version 0.0.1
|
|
1542
|
+
* @since 0.0.1
|
|
1543
|
+
* @author AMBROISE PARK Consulting
|
|
1544
|
+
*/
|
|
1545
|
+
interface FunctionDefaults {
|
|
1546
|
+
/** Default deployment regions */
|
|
1547
|
+
region?: string[];
|
|
1548
|
+
/** Default platform version */
|
|
1549
|
+
platform?: 'gcfv1' | 'gcfv2';
|
|
1550
|
+
/** App label for all functions */
|
|
1551
|
+
labels?: Record<string, string>;
|
|
1552
|
+
/** Default memory allocation */
|
|
1553
|
+
memory?: FunctionMemory;
|
|
1554
|
+
/** Default timeout in seconds */
|
|
1555
|
+
timeoutSeconds?: number;
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
/**
|
|
1559
|
+
* Complete functions configuration for an app
|
|
1560
|
+
* @description Single config file pattern for functions.yaml generation
|
|
1561
|
+
*
|
|
1562
|
+
* @example
|
|
1563
|
+
* ```typescript
|
|
1564
|
+
* export const functionsConfig: FunctionsConfig = {
|
|
1565
|
+
* defaults: {
|
|
1566
|
+
* region: ['europe-west1'],
|
|
1567
|
+
* platform: 'gcfv2',
|
|
1568
|
+
* labels: { app: 'myapp' },
|
|
1569
|
+
* },
|
|
1570
|
+
* functions: {
|
|
1571
|
+
* setCustomClaims: { category: 'auth' },
|
|
1572
|
+
* getDashboardMetrics: { category: 'analytics', memory: '512MB' },
|
|
1573
|
+
* },
|
|
1574
|
+
* crud: {
|
|
1575
|
+
* entities: ['car', 'customer', 'inquiry'],
|
|
1576
|
+
* },
|
|
1577
|
+
* };
|
|
1578
|
+
* ```
|
|
1579
|
+
*
|
|
1580
|
+
* @version 0.0.1
|
|
1581
|
+
* @since 0.0.1
|
|
1582
|
+
* @author AMBROISE PARK Consulting
|
|
1583
|
+
*/
|
|
1584
|
+
interface FunctionsConfig {
|
|
1585
|
+
/** App-level defaults applied to all functions */
|
|
1586
|
+
defaults?: FunctionDefaults;
|
|
1587
|
+
/** Static functions configuration (non-CRUD) */
|
|
1588
|
+
functions?: Record<string, FunctionMeta>;
|
|
1589
|
+
/** CRUD auto-generation configuration */
|
|
1590
|
+
crud?: CrudConfig;
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
type $MergeBy<T, K> = Omit<T, keyof K> & K;
|
|
1594
|
+
|
|
1595
|
+
type $PreservedValue<Value, Fallback> = [Value] extends [never] ? Fallback : Value;
|
|
1596
|
+
|
|
1597
|
+
/**
|
|
1598
|
+
* This interface can be augmented by users to add types to `i18next` default TypeOptions.
|
|
1599
|
+
*
|
|
1600
|
+
* Usage:
|
|
1601
|
+
* ```ts
|
|
1602
|
+
* // i18next.d.ts
|
|
1603
|
+
* import 'i18next';
|
|
1604
|
+
* declare module 'i18next' {
|
|
1605
|
+
* interface CustomTypeOptions {
|
|
1606
|
+
* defaultNS: 'custom';
|
|
1607
|
+
* returnNull: false;
|
|
1608
|
+
* returnObjects: false;
|
|
1609
|
+
* nsSeparator: ':';
|
|
1610
|
+
* keySeparator: '.';
|
|
1611
|
+
* compatibilityJSON: 'v4';
|
|
1612
|
+
* allowObjectInHTMLChildren: false;
|
|
1613
|
+
* resources: {
|
|
1614
|
+
* custom: {
|
|
1615
|
+
* foo: 'foo';
|
|
1616
|
+
* };
|
|
1617
|
+
* };
|
|
1618
|
+
* }
|
|
1619
|
+
* }
|
|
1620
|
+
* ```
|
|
1621
|
+
*/
|
|
1622
|
+
interface CustomTypeOptions {}
|
|
1623
|
+
|
|
1624
|
+
type TypeOptions = $MergeBy<
|
|
1625
|
+
{
|
|
1626
|
+
/** @see {InitOptions.returnNull} */
|
|
1627
|
+
returnNull: false;
|
|
1628
|
+
|
|
1629
|
+
/** @see {InitOptions.returnEmptyString} */
|
|
1630
|
+
returnEmptyString: true;
|
|
1631
|
+
|
|
1632
|
+
/** @see {InitOptions.returnObjects} */
|
|
1633
|
+
returnObjects: false;
|
|
1634
|
+
|
|
1635
|
+
/** @see {InitOptions.keySeparator} */
|
|
1636
|
+
keySeparator: '.';
|
|
1637
|
+
|
|
1638
|
+
/** @see {InitOptions.nsSeparator} */
|
|
1639
|
+
nsSeparator: ':';
|
|
1640
|
+
|
|
1641
|
+
/** @see {InitOptions.pluralSeparator} */
|
|
1642
|
+
pluralSeparator: '_';
|
|
1643
|
+
|
|
1644
|
+
/** @see {InitOptions.contextSeparator} */
|
|
1645
|
+
contextSeparator: '_';
|
|
1646
|
+
|
|
1647
|
+
/** @see {InitOptions.defaultNS} */
|
|
1648
|
+
defaultNS: 'translation';
|
|
1649
|
+
|
|
1650
|
+
/** @see {InitOptions.fallbackNS} */
|
|
1651
|
+
fallbackNS: false;
|
|
1652
|
+
|
|
1653
|
+
/** @see {InitOptions.compatibilityJSON} */
|
|
1654
|
+
compatibilityJSON: 'v4';
|
|
1655
|
+
|
|
1656
|
+
/** @see {InitOptions.resources} */
|
|
1657
|
+
resources: object;
|
|
1658
|
+
|
|
1659
|
+
/**
|
|
1660
|
+
* Flag that allows HTML elements to receive objects. This is only useful for React applications
|
|
1661
|
+
* where you pass objects to HTML elements so they can be replaced to their respective interpolation
|
|
1662
|
+
* values (mostly with Trans component)
|
|
1663
|
+
*/
|
|
1664
|
+
allowObjectInHTMLChildren: false;
|
|
1665
|
+
|
|
1666
|
+
/**
|
|
1667
|
+
* Flag that enables strict key checking even if a `defaultValue` has been provided.
|
|
1668
|
+
* This ensures all calls of `t` function don't accidentally use implicitly missing keys.
|
|
1669
|
+
*/
|
|
1670
|
+
strictKeyChecks: false;
|
|
1671
|
+
|
|
1672
|
+
/**
|
|
1673
|
+
* Prefix for interpolation
|
|
1674
|
+
*/
|
|
1675
|
+
interpolationPrefix: '{{';
|
|
1676
|
+
|
|
1677
|
+
/**
|
|
1678
|
+
* Suffix for interpolation
|
|
1679
|
+
*/
|
|
1680
|
+
interpolationSuffix: '}}';
|
|
1681
|
+
|
|
1682
|
+
/** @see {InterpolationOptions.unescapePrefix} */
|
|
1683
|
+
unescapePrefix: '-';
|
|
1684
|
+
|
|
1685
|
+
/** @see {InterpolationOptions.unescapeSuffix} */
|
|
1686
|
+
unescapeSuffix: '';
|
|
1687
|
+
|
|
1688
|
+
/**
|
|
1689
|
+
* Use a proxy-based selector to select a translation.
|
|
1690
|
+
*
|
|
1691
|
+
* Enables features like go-to definition, and better DX/faster autocompletion
|
|
1692
|
+
* for TypeScript developers.
|
|
1693
|
+
*
|
|
1694
|
+
* If you're working with an especially large set of translations and aren't
|
|
1695
|
+
* using context, you set `enableSelector` to `"optimize"` and i18next won't do
|
|
1696
|
+
* any type-level processing of your translations at all.
|
|
1697
|
+
*
|
|
1698
|
+
* With `enableSelector` set to `"optimize"`, i18next is capable of supporting
|
|
1699
|
+
* arbitrarily large/deep translation sets without causing any IDE slowdown
|
|
1700
|
+
* whatsoever.
|
|
1701
|
+
*
|
|
1702
|
+
* @default false
|
|
1703
|
+
*/
|
|
1704
|
+
enableSelector: false;
|
|
1705
|
+
},
|
|
1706
|
+
CustomTypeOptions
|
|
1707
|
+
>;
|
|
1708
|
+
|
|
1709
|
+
type FlatNamespace = $PreservedValue<keyof TypeOptions['resources'], string>;
|
|
1710
|
+
type Namespace<T = FlatNamespace> = T | readonly T[];
|
|
1711
|
+
|
|
1712
|
+
interface ReportNamespaces {
|
|
1713
|
+
addUsedNamespaces(namespaces: Namespace): void;
|
|
1714
|
+
getUsedNamespaces(): string[];
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
declare module 'i18next' {
|
|
1718
|
+
// interface i18n {
|
|
1719
|
+
// reportNamespaces?: ReportNamespaces;
|
|
1720
|
+
// }
|
|
1721
|
+
interface CustomInstanceExtensions {
|
|
1722
|
+
reportNamespaces?: ReportNamespaces;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
type ObjectOrNever = TypeOptions['allowObjectInHTMLChildren'] extends true
|
|
1727
|
+
? Record<string, unknown>
|
|
1728
|
+
: never;
|
|
1729
|
+
|
|
1730
|
+
type ReactI18NextChildren = React.ReactNode | ObjectOrNever;
|
|
1731
|
+
|
|
1732
|
+
declare module 'react' {
|
|
1733
|
+
namespace JSX {
|
|
1734
|
+
interface IntrinsicAttributes {
|
|
1735
|
+
i18nIsDynamicList?: boolean;
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
interface HTMLAttributes<T> {
|
|
1740
|
+
// This union is inspired by the typings for React.ReactNode. We do this to fix "This JSX tag's 'children' prop
|
|
1741
|
+
// expects a single child of type 'ReactI18NextChildren', but multiple children were provided":
|
|
1742
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/5a1e9f91ed0143adede394adb3f540e650455f71/types/react/index.d.ts#L268
|
|
1743
|
+
children?: ReactI18NextChildren | Iterable<ReactI18NextChildren>;
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
|
|
690
1747
|
// packages/core/config/functions/index.d.ts
|
|
691
1748
|
/**
|
|
692
1749
|
* @fileoverview Type Definitions for esbuild Configuration
|
|
@@ -748,5 +1805,28 @@ declare function createAppFunctionsConfig(
|
|
|
748
1805
|
options?: EsbuildOptions
|
|
749
1806
|
): BuildOptions;
|
|
750
1807
|
|
|
751
|
-
|
|
1808
|
+
/**
|
|
1809
|
+
* Generate functions.yaml content from config
|
|
1810
|
+
*
|
|
1811
|
+
* @version 0.0.1
|
|
1812
|
+
* @since 0.0.1
|
|
1813
|
+
* @author AMBROISE PARK Consulting
|
|
1814
|
+
*/
|
|
1815
|
+
declare function generateFunctionsYaml(config: FunctionsConfig): string;
|
|
1816
|
+
|
|
1817
|
+
/**
|
|
1818
|
+
* Generate yaml and return metadata
|
|
1819
|
+
*
|
|
1820
|
+
* @version 0.0.1
|
|
1821
|
+
* @since 0.0.1
|
|
1822
|
+
* @author AMBROISE PARK Consulting
|
|
1823
|
+
*/
|
|
1824
|
+
declare function generateFunctionsYamlWithInfo(config: FunctionsConfig): {
|
|
1825
|
+
yaml: string;
|
|
1826
|
+
functions: string[];
|
|
1827
|
+
staticFunctions: string[];
|
|
1828
|
+
crudFunctions: string[];
|
|
1829
|
+
};
|
|
1830
|
+
|
|
1831
|
+
export { createAppFunctionsConfig, createFunctionsEsbuildConfig, createRootFunctionsConfig, generateFunctionsYaml, generateFunctionsYamlWithInfo };
|
|
752
1832
|
export type { EsbuildOptions };
|