@donotdev/core 0.0.11 → 0.0.13

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 (42) hide show
  1. package/functions/index.js +1 -1
  2. package/i18n/locales/eager/dndev_ar.json +122 -106
  3. package/i18n/locales/eager/dndev_de.json +122 -106
  4. package/i18n/locales/eager/dndev_en.json +122 -106
  5. package/i18n/locales/eager/dndev_es.json +122 -106
  6. package/i18n/locales/eager/dndev_fr.json +122 -106
  7. package/i18n/locales/eager/dndev_it.json +122 -106
  8. package/i18n/locales/eager/dndev_ja.json +122 -106
  9. package/i18n/locales/eager/dndev_ko.json +122 -106
  10. package/i18n/locales/lazy/auth_ar.json +121 -0
  11. package/i18n/locales/lazy/auth_de.json +121 -0
  12. package/i18n/locales/lazy/auth_en.json +121 -0
  13. package/i18n/locales/lazy/auth_es.json +121 -0
  14. package/i18n/locales/lazy/auth_fr.json +121 -0
  15. package/i18n/locales/lazy/auth_it.json +121 -0
  16. package/i18n/locales/lazy/auth_ja.json +121 -0
  17. package/i18n/locales/lazy/auth_ko.json +121 -0
  18. package/i18n/locales/lazy/billing_ar.json +12 -2
  19. package/i18n/locales/lazy/billing_de.json +12 -2
  20. package/i18n/locales/lazy/billing_en.json +12 -2
  21. package/i18n/locales/lazy/billing_es.json +12 -2
  22. package/i18n/locales/lazy/billing_fr.json +12 -2
  23. package/i18n/locales/lazy/billing_it.json +12 -2
  24. package/i18n/locales/lazy/billing_ja.json +12 -2
  25. package/i18n/locales/lazy/billing_ko.json +12 -2
  26. package/i18n/locales/lazy/oauth_ar.json +11 -0
  27. package/i18n/locales/lazy/oauth_de.json +11 -0
  28. package/i18n/locales/lazy/oauth_en.json +11 -0
  29. package/i18n/locales/lazy/oauth_es.json +11 -0
  30. package/i18n/locales/lazy/oauth_fr.json +11 -0
  31. package/i18n/locales/lazy/oauth_it.json +11 -0
  32. package/i18n/locales/lazy/oauth_ja.json +11 -0
  33. package/i18n/locales/lazy/oauth_ko.json +11 -0
  34. package/index.d.ts +1140 -107
  35. package/index.js +41 -41
  36. package/next/index.d.ts +10 -1
  37. package/next/index.js +20 -20
  38. package/package.json +2 -2
  39. package/server.d.ts +944 -580
  40. package/server.js +1 -575
  41. package/vite/index.d.ts +10 -1
  42. package/vite/index.js +23 -16
package/server.d.ts CHANGED
@@ -2,6 +2,8 @@ import * as React from 'react';
2
2
  import { ReactNode, ComponentType } from 'react';
3
3
  export { ReactNode } from 'react';
4
4
  import * as v from 'valibot';
5
+ export * from '@donotdev/schemas/server';
6
+ export { global } from '@donotdev/schemas/server';
5
7
 
6
8
  // Types
7
9
 
@@ -2953,6 +2955,7 @@ declare const USER_ROLES: {
2953
2955
  readonly GUEST: "guest";
2954
2956
  readonly USER: "user";
2955
2957
  readonly ADMIN: "admin";
2958
+ readonly SUPER: "super";
2956
2959
  };
2957
2960
  /**
2958
2961
  * Override user roles for custom app needs
@@ -4357,7 +4360,7 @@ type PageAuth = boolean | {
4357
4360
  * // Framework provides: auth=false, title from home.title, entity=home
4358
4361
  * ```
4359
4362
  *
4360
- * @example Dynamic route (just define the path you want):
4363
+ * @example Dynamic route (string format - explicit path):
4361
4364
  * ```tsx
4362
4365
  * export const meta: PageMeta = {
4363
4366
  * route: '/blog/:slug' // Creates /blog/:slug
@@ -4365,6 +4368,14 @@ type PageAuth = boolean | {
4365
4368
  * // Framework provides: auth=false, title from blog.title, entity=blog
4366
4369
  * ```
4367
4370
  *
4371
+ * @example Dynamic route (object format - auto-generates base path):
4372
+ * ```tsx
4373
+ * export const meta: PageMeta = {
4374
+ * route: { params: ['id'] } // Creates /myRoute/:id (base path from file location)
4375
+ * };
4376
+ * // For file at pages/myRoute/DetailPage.tsx → route becomes /myRoute/:id
4377
+ * ```
4378
+ *
4368
4379
  * @example Auth-required (developer must be explicit):
4369
4380
  * ```tsx
4370
4381
  * export const meta: PageMeta = {
@@ -5609,6 +5620,12 @@ interface BillingAPI {
5609
5620
  */
5610
5621
  status: FeatureStatus;
5611
5622
  error: string | null;
5623
+ /**
5624
+ * Whether a billing operation is in progress.
5625
+ * For redirect operations (checkout, portal), the hook automatically shows
5626
+ * a fullscreen overlay with operation-specific messaging.
5627
+ */
5628
+ loading: boolean;
5612
5629
  checkout: (options: CheckoutOptions) => Promise<StripeCheckoutResponse>;
5613
5630
  cancelSubscription: () => Promise<{
5614
5631
  success: boolean;
@@ -6495,6 +6512,133 @@ interface CanAPI {
6495
6512
  has: (permission: string) => boolean;
6496
6513
  }
6497
6514
 
6515
+ /**
6516
+ * @fileoverview Aggregation Types
6517
+ * @description Types for generic entity aggregation/analytics functions
6518
+ *
6519
+ * @version 0.0.1
6520
+ * @since 0.0.1
6521
+ * @author AMBROISE PARK Consulting
6522
+ */
6523
+ /** Supported aggregation operations */
6524
+ type AggregateOperation = 'count' | 'sum' | 'avg' | 'min' | 'max';
6525
+ /** Filter operators for aggregation */
6526
+ type AggregateFilterOperator = '==' | '!=' | '>' | '<' | '>=' | '<=';
6527
+ /**
6528
+ * Single metric definition for aggregation
6529
+ *
6530
+ * @example
6531
+ * ```typescript
6532
+ * // Count all documents
6533
+ * { field: '*', operation: 'count', as: 'total' }
6534
+ *
6535
+ * // Sum a numeric field
6536
+ * { field: 'price', operation: 'sum', as: 'totalValue' }
6537
+ *
6538
+ * // Count with filter
6539
+ * {
6540
+ * field: '*',
6541
+ * operation: 'count',
6542
+ * as: 'availableCount',
6543
+ * filter: { field: 'status', operator: '==', value: 'available' }
6544
+ * }
6545
+ * ```
6546
+ */
6547
+ interface MetricDefinition {
6548
+ /** Field to aggregate ('*' for count all) */
6549
+ field: string;
6550
+ /** Aggregation operation */
6551
+ operation: AggregateOperation;
6552
+ /** Output name for this metric */
6553
+ as: string;
6554
+ /** Optional filter for this metric */
6555
+ filter?: {
6556
+ field: string;
6557
+ operator: AggregateFilterOperator;
6558
+ value: any;
6559
+ };
6560
+ }
6561
+ /**
6562
+ * Group by definition for aggregation
6563
+ *
6564
+ * @example
6565
+ * ```typescript
6566
+ * {
6567
+ * field: 'status',
6568
+ * metrics: [
6569
+ * { field: '*', operation: 'count', as: 'count' },
6570
+ * { field: 'price', operation: 'sum', as: 'value' },
6571
+ * ]
6572
+ * }
6573
+ * ```
6574
+ */
6575
+ interface GroupByDefinition {
6576
+ /** Field to group by */
6577
+ field: string;
6578
+ /** Metrics to compute per group */
6579
+ metrics: MetricDefinition[];
6580
+ }
6581
+ /**
6582
+ * Aggregation configuration for entity analytics
6583
+ *
6584
+ * @example
6585
+ * ```typescript
6586
+ * const carsAnalyticsConfig: AggregateConfig = {
6587
+ * metrics: [
6588
+ * { field: '*', operation: 'count', as: 'total' },
6589
+ * { field: 'price', operation: 'sum', as: 'totalValue' },
6590
+ * { field: 'price', operation: 'avg', as: 'avgPrice' },
6591
+ * ],
6592
+ * groupBy: [
6593
+ * {
6594
+ * field: 'status',
6595
+ * metrics: [
6596
+ * { field: '*', operation: 'count', as: 'count' },
6597
+ * { field: 'price', operation: 'sum', as: 'value' },
6598
+ * ],
6599
+ * },
6600
+ * ],
6601
+ * where: [['isActive', '==', true]],
6602
+ * };
6603
+ * ```
6604
+ */
6605
+ interface AggregateConfig {
6606
+ /** Top-level metrics (computed on entire collection) */
6607
+ metrics?: MetricDefinition[];
6608
+ /** Group by configurations */
6609
+ groupBy?: GroupByDefinition[];
6610
+ /** Optional global filters */
6611
+ where?: Array<[string, any, any]>;
6612
+ }
6613
+ /**
6614
+ * Request payload for aggregate function calls
6615
+ */
6616
+ interface AggregateRequest {
6617
+ /** Optional runtime filters (merged with config filters) */
6618
+ where?: Array<[string, any, any]>;
6619
+ /** Optional date range filter */
6620
+ dateRange?: {
6621
+ field: string;
6622
+ start?: string;
6623
+ end?: string;
6624
+ };
6625
+ }
6626
+ /**
6627
+ * Response from aggregate function
6628
+ */
6629
+ interface AggregateResponse {
6630
+ /** Computed top-level metrics */
6631
+ metrics: Record<string, number | null>;
6632
+ /** Grouped metrics by field */
6633
+ groups: Record<string, Record<string, Record<string, number | null>>>;
6634
+ /** Metadata about the aggregation */
6635
+ meta: {
6636
+ collection: string;
6637
+ totalDocs: number;
6638
+ computedAt: string;
6639
+ };
6640
+ }
6641
+
6498
6642
  /**
6499
6643
  * @fileoverview CRUD Constants
6500
6644
  * @description Constants for CRUD domain. Defines visibility levels for entity fields and supported field types for entities.
@@ -6505,11 +6649,33 @@ interface CanAPI {
6505
6649
  */
6506
6650
  /**
6507
6651
  * Visibility levels for entity fields (runtime constants)
6652
+ * Controls who can SEE this field in responses
6653
+ * - guest: Everyone (even unauthenticated)
6654
+ * - user: Authenticated users (users see both guest and user fields)
6655
+ * - admin: Admins only
6656
+ * - technical: Internal/system fields (shown as read-only in edit forms)
6657
+ * - hidden: Never shown in UI, only exists in DB (passwords, tokens, API keys)
6508
6658
  */
6509
6659
  declare const VISIBILITY: {
6660
+ readonly GUEST: "guest";
6510
6661
  readonly USER: "user";
6511
6662
  readonly ADMIN: "admin";
6512
6663
  readonly TECHNICAL: "technical";
6664
+ readonly HIDDEN: "hidden";
6665
+ };
6666
+ /**
6667
+ * Editable levels for entity fields (runtime constants)
6668
+ * Controls who can MODIFY this field
6669
+ * - true: Anyone who can see the field
6670
+ * - false: Nobody (read-only)
6671
+ * - 'admin': Only admins
6672
+ * - 'create-only': Editable on create, read-only after
6673
+ */
6674
+ declare const EDITABLE: {
6675
+ readonly TRUE: true;
6676
+ readonly FALSE: false;
6677
+ readonly ADMIN: "admin";
6678
+ readonly CREATE_ONLY: "create-only";
6513
6679
  };
6514
6680
  /**
6515
6681
  * Supported field types for entities (runtime constants)
@@ -6519,7 +6685,7 @@ declare const VISIBILITY: {
6519
6685
  * @since 0.0.1
6520
6686
  * @author AMBROISE PARK Consulting
6521
6687
  */
6522
- declare const FIELD_TYPES: readonly ["address", "array", "avatar", "badge", "boolean", "checkbox", "color", "date", "datetime-local", "email", "file", "geopoint", "hidden", "image", "map", "month", "multiselect", "number", "password", "radio", "reference", "range", "reset", "select", "submit", "tel", "text", "textarea", "time", "timestamp", "url", "week"];
6688
+ declare const FIELD_TYPES: readonly ["address", "array", "avatar", "badge", "boolean", "checkbox", "color", "combobox", "date", "datetime-local", "email", "file", "geopoint", "hidden", "image", "images", "map", "month", "multiselect", "number", "password", "radio", "reference", "range", "reset", "select", "submit", "switch", "tel", "text", "textarea", "time", "timestamp", "toggle", "url", "week"];
6523
6689
 
6524
6690
  /**
6525
6691
  * @fileoverview Schema-Related Type Definitions
@@ -6540,13 +6706,31 @@ declare const FIELD_TYPES: readonly ["address", "array", "avatar", "badge", "boo
6540
6706
  declare const FIRESTORE_ID_PATTERN: RegExp;
6541
6707
  /**
6542
6708
  * Visibility level for entity fields
6543
- * Controls who can see and edit a field
6709
+ * Controls who can SEE a field
6710
+ * - 'guest': Everyone (even unauthenticated)
6711
+ * - 'user': Authenticated users only (users see both guest and user fields)
6712
+ * - 'admin': Admins only
6713
+ * - 'technical': Internal/system fields (shown as read-only in edit forms)
6714
+ * - 'hidden': Never shown in UI, only exists in DB (passwords, tokens, API keys)
6544
6715
  *
6545
6716
  * @version 0.0.1
6546
6717
  * @since 0.0.1
6547
6718
  * @author AMBROISE PARK Consulting
6548
6719
  */
6549
6720
  type Visibility = (typeof VISIBILITY)[keyof typeof VISIBILITY];
6721
+ /**
6722
+ * Editable level for entity fields
6723
+ * Controls who can MODIFY a field
6724
+ * - true: Anyone who can see the field
6725
+ * - false: Nobody (read-only)
6726
+ * - 'admin': Only admins can edit
6727
+ * - 'create-only': Editable on create, read-only after
6728
+ *
6729
+ * @version 0.0.1
6730
+ * @since 0.0.1
6731
+ * @author AMBROISE PARK Consulting
6732
+ */
6733
+ type Editable = (typeof EDITABLE)[keyof typeof EDITABLE];
6550
6734
  /**
6551
6735
  * Supported field types for entities
6552
6736
  * These determine the UI components and validation rules used for each field
@@ -6556,6 +6740,14 @@ type Visibility = (typeof VISIBILITY)[keyof typeof VISIBILITY];
6556
6740
  * @author AMBROISE PARK Consulting
6557
6741
  */
6558
6742
  type FieldType = (typeof FIELD_TYPES)[number];
6743
+ /**
6744
+ * Picture type for image fields
6745
+ * Represents uploaded image with full and thumbnail URLs
6746
+ */
6747
+ interface Picture {
6748
+ fullUrl: string;
6749
+ thumbUrl: string;
6750
+ }
6559
6751
  /**
6560
6752
  * Maps field types to their corresponding TypeScript types
6561
6753
  * Used for type-safe form handling
@@ -6576,6 +6768,7 @@ type FieldTypeToValue = {
6576
6768
  badge: string;
6577
6769
  boolean: boolean;
6578
6770
  checkbox: boolean;
6771
+ combobox: string;
6579
6772
  color: string;
6580
6773
  date: string;
6581
6774
  'datetime-local': string;
@@ -6586,7 +6779,8 @@ type FieldTypeToValue = {
6586
6779
  lng: number;
6587
6780
  };
6588
6781
  hidden: string;
6589
- image: File | null;
6782
+ image: Picture | null;
6783
+ images: Picture[];
6590
6784
  map: Record<string, any>;
6591
6785
  month: string;
6592
6786
  multiselect: string[];
@@ -6603,6 +6797,8 @@ type FieldTypeToValue = {
6603
6797
  textarea: string;
6604
6798
  time: string;
6605
6799
  timestamp: string;
6800
+ toggle: boolean;
6801
+ switch: string | boolean;
6606
6802
  url: string;
6607
6803
  week: string;
6608
6804
  };
@@ -6619,6 +6815,32 @@ type ValueTypeForField<T extends FieldType> = FieldTypeToValue[T];
6619
6815
  * Enhanced validation rules with type checking
6620
6816
  * @template T - The field type
6621
6817
  *
6818
+ * @example
6819
+ * ```typescript
6820
+ * // Select field with dropdown options
6821
+ * validation: {
6822
+ * required: true,
6823
+ * options: [
6824
+ * { value: 'active', label: 'Active' },
6825
+ * { value: 'inactive', label: 'Inactive' }
6826
+ * ]
6827
+ * }
6828
+ *
6829
+ * // Text field with length validation
6830
+ * validation: {
6831
+ * required: true,
6832
+ * minLength: 3,
6833
+ * maxLength: 100
6834
+ * }
6835
+ *
6836
+ * // Number field with range validation
6837
+ * validation: {
6838
+ * required: true,
6839
+ * min: 0,
6840
+ * max: 1000
6841
+ * }
6842
+ * ```
6843
+ *
6622
6844
  * @version 0.0.1
6623
6845
  * @since 0.0.1
6624
6846
  * @author AMBROISE PARK Consulting
@@ -6636,11 +6858,48 @@ interface ValidationRules<T extends FieldType = FieldType> {
6636
6858
  maxLength?: T extends 'text' | 'textarea' | 'password' | 'email' | 'url' | 'tel' ? number : never;
6637
6859
  /** Regex pattern (for text fields) */
6638
6860
  pattern?: T extends 'text' | 'textarea' | 'password' | 'email' | 'url' | 'tel' ? string : never;
6639
- /** Options for select, multiselect, and radio fields */
6640
- options?: T extends 'select' | 'multiselect' | 'radio' ? Array<{
6861
+ /**
6862
+ * Options for select, multiselect, and radio fields.
6863
+ * Can be:
6864
+ * - An array of option objects
6865
+ * - A function that returns an array (receives form values for dynamic options)
6866
+ * - A range object for numeric sequences (e.g., years)
6867
+ *
6868
+ * @example
6869
+ * ```typescript
6870
+ * // Static array
6871
+ * options: [
6872
+ * { value: 'active', label: 'Active' },
6873
+ * { value: 'inactive', label: 'Inactive' }
6874
+ * ]
6875
+ *
6876
+ * // Dynamic function
6877
+ * options: (formValues) => {
6878
+ * return getModelsForMake(formValues.make);
6879
+ * }
6880
+ *
6881
+ * // Range for years (most common use case)
6882
+ * options: { type: 'range', start: 1995, end: 2024, step: 1, reverse: true }
6883
+ * ```
6884
+ */
6885
+ options?: T extends 'select' | 'multiselect' | 'radio' | 'combobox' ? Array<{
6886
+ value: string;
6887
+ label: string;
6888
+ }> | ((formValues?: Record<string, any>) => Array<{
6641
6889
  value: string;
6642
6890
  label: string;
6643
- }> : never;
6891
+ }>) | {
6892
+ /** Range type - generates numeric sequence */
6893
+ type: 'range';
6894
+ /** Start value (inclusive) */
6895
+ start: number;
6896
+ /** End value (inclusive) */
6897
+ end: number;
6898
+ /** Step increment (default: 1) */
6899
+ step?: number;
6900
+ /** Reverse order (default: false) - true for years (newest first) */
6901
+ reverse?: boolean;
6902
+ } : never;
6644
6903
  /** Collection name for reference fields */
6645
6904
  reference?: T extends 'reference' ? string : never;
6646
6905
  /** Whether the field is nullable */
@@ -6756,20 +7015,59 @@ interface FormConfig {
6756
7015
  }
6757
7016
  /**
6758
7017
  * Definition of a single entity field
7018
+ * @template T - The field type for type-safe validation and value inference
6759
7019
  *
6760
- * @version 0.0.1
7020
+ * @example
7021
+ * ```typescript
7022
+ * // Text field - TypeScript knows value is string
7023
+ * name: {
7024
+ * type: 'text',
7025
+ * visibility: 'user',
7026
+ * validation: { required: true, minLength: 3 }
7027
+ * }
7028
+ *
7029
+ * // Select field with dropdown options
7030
+ * status: {
7031
+ * type: 'select',
7032
+ * visibility: 'user',
7033
+ * validation: {
7034
+ * required: true,
7035
+ * options: [
7036
+ * { value: 'active', label: 'Active' },
7037
+ * { value: 'inactive', label: 'Inactive' }
7038
+ * ]
7039
+ * }
7040
+ * }
7041
+ * ```
7042
+ *
7043
+ * **Note:** For `select`, `multiselect`, and `radio` fields, dropdown options must be defined in `validation.options` as an array of `{ value: string, label: string }` objects.
7044
+ *
7045
+ * @version 0.0.2
6761
7046
  * @since 0.0.1
6762
7047
  * @author AMBROISE PARK Consulting
6763
7048
  */
6764
- interface EntityField {
7049
+ interface EntityField<T extends FieldType = FieldType> {
6765
7050
  /** The field type, which determines the UI component and validation */
6766
- type: FieldType;
6767
- /** Who can see and edit this field */
7051
+ type: T;
7052
+ /**
7053
+ * Who can SEE this field
7054
+ * - 'guest': Everyone (even unauthenticated)
7055
+ * - 'user': Authenticated users only (users see both guest and user fields)
7056
+ * - 'admin': Admins only
7057
+ * - 'technical': Internal/system fields (shown as read-only in edit forms)
7058
+ * - 'hidden': Never shown in UI, only exists in DB (passwords, tokens, API keys)
7059
+ */
6768
7060
  visibility: Visibility;
6769
- /** Validation rules for this field */
6770
- validation?: ValidationRules;
6771
- /** Whether the field should be hidden in the UI */
6772
- hidden?: boolean;
7061
+ /**
7062
+ * Who can MODIFY this field
7063
+ * - true: Anyone who can see the field (default)
7064
+ * - false: Nobody (read-only display)
7065
+ * - 'admin': Only admins can edit
7066
+ * - 'create-only': Editable on create, read-only after
7067
+ */
7068
+ editable?: Editable;
7069
+ /** Validation rules for this field. For select/multiselect/radio fields, include `options` array here. */
7070
+ validation?: ValidationRules<T>;
6773
7071
  /** Whether the field is internationalized */
6774
7072
  i18n?: boolean;
6775
7073
  /** Display label for the field */
@@ -6781,9 +7079,9 @@ interface EntityField {
6781
7079
  /** Field name this field depends on */
6782
7080
  field: string;
6783
7081
  /** Value that should trigger this field to show */
6784
- value?: any;
7082
+ value?: ValueTypeForField<FieldType>;
6785
7083
  /** Custom condition function */
6786
- condition?: (formData: any) => boolean;
7084
+ condition?: (formData: Record<string, unknown>) => boolean;
6787
7085
  };
6788
7086
  /** Field grouping for layout */
6789
7087
  group?: {
@@ -6798,25 +7096,42 @@ interface EntityField {
6798
7096
  /** Whether group is collapsed by default */
6799
7097
  collapsed?: boolean;
6800
7098
  };
7099
+ /** UI options for field rendering */
7100
+ options?: {
7101
+ /** Placeholder text */
7102
+ placeholder?: string;
7103
+ /** CSS class name */
7104
+ className?: string;
7105
+ /** Field-specific options (e.g., creatable for combobox) */
7106
+ fieldSpecific?: Record<string, unknown>;
7107
+ };
6801
7108
  }
6802
7109
  /**
6803
7110
  * Base fields that all entities should have
6804
7111
  *
6805
- * @version 0.0.1
7112
+ * @version 0.0.3
6806
7113
  * @since 0.0.1
6807
7114
  * @author AMBROISE PARK Consulting
6808
7115
  */
6809
7116
  interface BaseEntityFields {
6810
7117
  /** Unique identifier for the entity */
6811
- id: EntityField;
7118
+ id: EntityField<'text'>;
6812
7119
  /** When the entity was created */
6813
- createdAt: EntityField;
7120
+ createdAt: EntityField<'timestamp'>;
6814
7121
  /** When the entity was last updated */
6815
- updatedAt: EntityField;
7122
+ updatedAt: EntityField<'timestamp'>;
6816
7123
  /** Who created the entity */
6817
- createdById: EntityField;
7124
+ createdById: EntityField<'reference'>;
6818
7125
  /** Who last updated the entity */
6819
- updatedById: EntityField;
7126
+ updatedById: EntityField<'reference'>;
7127
+ /**
7128
+ * Publication status for draft/publish/delete workflow
7129
+ * - 'draft': Document is incomplete, hidden from non-admin
7130
+ * - 'available': Document is published and visible (default)
7131
+ * - 'deleted': Soft-deleted, hidden from non-admin
7132
+ * - Consumer can extend with additional statuses (e.g., 'reserved', 'sold')
7133
+ */
7134
+ status: EntityField<'select'>;
6820
7135
  }
6821
7136
  /**
6822
7137
  * Definition of a business entity without base fields
@@ -7088,23 +7403,37 @@ interface ListEntitiesResponse {
7088
7403
  interface CrudAPI<T = unknown> {
7089
7404
  /**
7090
7405
  * Unified feature status - single source of truth for CRUD state.
7091
- * Replaces deprecated `loading` boolean flag.
7092
7406
  * - `initializing`: CRUD is loading/initializing
7093
7407
  * - `ready`: CRUD fully operational
7094
7408
  * - `degraded`: CRUD unavailable (feature not installed/consent not given)
7095
7409
  * - `error`: CRUD encountered error
7096
7410
  */
7097
7411
  status: FeatureStatus;
7412
+ /** Current data (from get/subscribe) */
7098
7413
  data: T | null;
7414
+ /** Loading state for async operations */
7415
+ loading: boolean;
7416
+ /** Last error encountered */
7099
7417
  error: Error | null;
7418
+ /** Fetch single document by ID */
7100
7419
  get: (id: string) => Promise<T | null>;
7420
+ /** Set/replace document by ID */
7101
7421
  set: (id: string, data: T) => Promise<void>;
7422
+ /** Partial update document by ID */
7102
7423
  update: (id: string, data: Partial<T>) => Promise<void>;
7424
+ /** Delete document by ID */
7103
7425
  delete: (id: string) => Promise<void>;
7426
+ /** Add new document (auto-generated ID) */
7104
7427
  add: (data: T) => Promise<string>;
7428
+ /** Query collection with filters */
7105
7429
  query: (options: any) => Promise<T[]>;
7430
+ /** Subscribe to document changes */
7106
7431
  subscribe: (id: string, callback: (data: T | null, error?: Error) => void) => () => void;
7432
+ /** Subscribe to collection changes */
7107
7433
  subscribeToCollection: (options: any, callback: (data: T[], error?: Error) => void) => () => void;
7434
+ /** Invalidate cache for this collection (TanStack Query) */
7435
+ invalidate: () => Promise<void>;
7436
+ /** Whether CRUD is available and operational */
7108
7437
  isAvailable: boolean;
7109
7438
  }
7110
7439
 
@@ -8853,6 +9182,10 @@ interface UIFieldOptions<T extends FieldType = FieldType> {
8853
9182
  defaultCountry?: string;
8854
9183
  /** Whether to show country flags */
8855
9184
  showFlags?: boolean;
9185
+ /** Preferred country codes to show at the top of the list (e.g., ['FR', 'US', 'GB']) */
9186
+ preferredCountries?: string[];
9187
+ /** Custom list of country codes to show (if provided, only these countries are shown) */
9188
+ countries?: string[];
8856
9189
  } : T extends 'address' ? {
8857
9190
  /**
8858
9191
  * Whether to enable Google Maps autocomplete (default: false)
@@ -8861,32 +9194,37 @@ interface UIFieldOptions<T extends FieldType = FieldType> {
8861
9194
  enableGoogleMaps?: boolean;
8862
9195
  /** Whether to extract district code for Paris addresses */
8863
9196
  extractDistrictCode?: boolean;
8864
- } : never;
8865
- }
8866
- /**
8867
- * Complete field configuration combining schema definition with UI options
9197
+ } : T extends 'combobox' ? {
9198
+ /** Enable creating new values by typing */
9199
+ creatable?: boolean;
9200
+ } : T extends 'switch' ? {
9201
+ /** Label shown when switch is off/unchecked */
9202
+ uncheckedLabel?: string;
9203
+ /** Label shown when switch is on/checked */
9204
+ checkedLabel?: string;
9205
+ /** Value stored when switch is off (default: false) */
9206
+ uncheckedValue?: string | boolean;
9207
+ /** Value stored when switch is on (default: true) */
9208
+ checkedValue?: string | boolean;
9209
+ } : Record<string, unknown>;
9210
+ }
9211
+ /**
9212
+ * Complete field configuration for form rendering
9213
+ * Extends EntityField with runtime properties (name, value, defaultValue)
8868
9214
  * @template T - The field type
8869
9215
  *
8870
- * @version 0.0.1
9216
+ * @version 0.0.2
8871
9217
  * @since 0.0.1
8872
9218
  * @author AMBROISE PARK Consulting
8873
9219
  */
8874
- interface FieldConfig<T extends FieldType = FieldType> {
8875
- /** Field identifier - required business logic */
9220
+ interface FieldConfig<T extends FieldType = FieldType> extends Omit<EntityField<T>, 'options'> {
9221
+ /** Field identifier - required for form binding */
8876
9222
  name: string;
8877
- /** Field type - required business logic */
8878
- type: T;
8879
- /** Field label - required business logic */
9223
+ /** Field label - auto-generated from name if not provided in EntityField */
8880
9224
  label: string;
8881
- /** Whether field is required - smart default: false */
9225
+ /** Whether field is required - convenience prop extracted from validation.required */
8882
9226
  required?: boolean;
8883
- /** Field visibility - smart default: 'user' */
8884
- visibility?: 'user' | 'admin' | 'technical';
8885
- /** Whether the field should be hidden in the UI - smart default: false */
8886
- hidden?: boolean;
8887
- /** Field validation rules - smart default: schemas package handles it */
8888
- validation?: ValidationRules<T>;
8889
- /** UI-specific configuration */
9227
+ /** UI-specific configuration - extends EntityField.options with UI features */
8890
9228
  options?: UIFieldOptions<T>;
8891
9229
  /** Current field value */
8892
9230
  value?: ValueTypeForField<T>;
@@ -9048,6 +9386,108 @@ interface ModalActions {
9048
9386
  /** Close the modal */
9049
9387
  closeModal: () => void;
9050
9388
  }
9389
+ /**
9390
+ * Phase of the redirect overlay progression
9391
+ *
9392
+ * @version 0.0.1
9393
+ * @since 0.0.1
9394
+ * @author AMBROISE PARK Consulting
9395
+ */
9396
+ type RedirectOverlayPhase = 'connecting' | 'preparing' | 'redirecting' | 'timeout';
9397
+ /**
9398
+ * Billing-specific redirect operations
9399
+ *
9400
+ * @version 0.0.1
9401
+ * @since 0.0.1
9402
+ * @author AMBROISE PARK Consulting
9403
+ */
9404
+ type BillingRedirectOperation = 'stripe-checkout' | 'stripe-portal';
9405
+ /**
9406
+ * Auth partner redirect operations - DRY derived from AUTH_PARTNERS schema
9407
+ * Format: `oauth-${partnerId}` for OAuth partners, `auth-${partnerId}` for auth-only
9408
+ *
9409
+ * @version 0.0.1
9410
+ * @since 0.0.1
9411
+ * @author AMBROISE PARK Consulting
9412
+ */
9413
+ type AuthRedirectOperation = `oauth-${AuthPartnerId}` | `auth-${AuthPartnerId}`;
9414
+ /**
9415
+ * OAuth partner redirect operations - DRY derived from OAUTH_PARTNERS schema
9416
+ * Format: `oauth-api-${partnerId}` for API-only OAuth partners
9417
+ *
9418
+ * @version 0.0.1
9419
+ * @since 0.0.1
9420
+ * @author AMBROISE PARK Consulting
9421
+ */
9422
+ type OAuthRedirectOperation = `oauth-api-${OAuthPartnerId}`;
9423
+ /**
9424
+ * All redirect operations - Union of billing, auth, and OAuth operations
9425
+ * Extensible via string intersection for custom operations
9426
+ *
9427
+ * @version 0.0.1
9428
+ * @since 0.0.1
9429
+ * @author AMBROISE PARK Consulting
9430
+ */
9431
+ type RedirectOperation = BillingRedirectOperation | AuthRedirectOperation | OAuthRedirectOperation | (string & {});
9432
+ /**
9433
+ * Configuration for redirect overlay (optional overrides)
9434
+ *
9435
+ * @version 0.0.1
9436
+ * @since 0.0.1
9437
+ * @author AMBROISE PARK Consulting
9438
+ */
9439
+ interface RedirectOverlayConfig {
9440
+ /** i18n namespace to use (default: inferred from operation) */
9441
+ namespace?: string;
9442
+ /** Custom title (overrides i18n) */
9443
+ title?: string;
9444
+ /** Custom message (overrides i18n) */
9445
+ message?: string;
9446
+ /** Custom subtitle (overrides i18n) */
9447
+ subtitle?: string;
9448
+ /** Icon type: 'lock' for payments, 'shield' for auth (default: inferred) */
9449
+ icon?: 'lock' | 'shield' | 'none';
9450
+ /** Timeout in ms before showing cancel button (default: 10000) */
9451
+ cancelTimeout?: number;
9452
+ }
9453
+ /**
9454
+ * Redirect overlay state
9455
+ *
9456
+ * @version 0.0.1
9457
+ * @since 0.0.1
9458
+ * @author AMBROISE PARK Consulting
9459
+ */
9460
+ interface RedirectOverlayState {
9461
+ /** Whether the redirect overlay is visible */
9462
+ isRedirectOverlayOpen: boolean;
9463
+ /** Current operation being performed */
9464
+ redirectOperation: RedirectOperation | null;
9465
+ /** Current phase of the redirect */
9466
+ redirectPhase: RedirectOverlayPhase;
9467
+ /** Whether cancel button should be shown */
9468
+ showCancelButton: boolean;
9469
+ /** Configuration overrides */
9470
+ redirectConfig: RedirectOverlayConfig | null;
9471
+ /** Timestamp when overlay was shown (for phase progression) */
9472
+ redirectStartTime: number | null;
9473
+ }
9474
+ /**
9475
+ * Redirect overlay actions
9476
+ *
9477
+ * @version 0.0.1
9478
+ * @since 0.0.1
9479
+ * @author AMBROISE PARK Consulting
9480
+ */
9481
+ interface RedirectOverlayActions {
9482
+ /** Show the redirect overlay */
9483
+ showRedirectOverlay: (operation: RedirectOperation, config?: RedirectOverlayConfig) => void;
9484
+ /** Hide the redirect overlay */
9485
+ hideRedirectOverlay: () => void;
9486
+ /** Update the current phase (internal use) */
9487
+ setRedirectPhase: (phase: RedirectOverlayPhase) => void;
9488
+ /** Show/hide cancel button (internal use) */
9489
+ setShowCancelButton: (show: boolean) => void;
9490
+ }
9051
9491
  /**
9052
9492
  * Loading state
9053
9493
  *
@@ -11646,141 +12086,301 @@ declare function parseDateToNoonUTC(dateString: string): string | undefined;
11646
12086
  */
11647
12087
  declare function toDateOnly(date: DateValue | number | string | null | undefined): string;
11648
12088
 
12089
+ interface HandleErrorOptions {
12090
+ userMessage?: string;
12091
+ context?: Record<string, any>;
12092
+ log?: boolean;
12093
+ reportToSentry?: boolean;
12094
+ showNotification?: boolean;
12095
+ severity?: 'error' | 'warning' | 'info' | 'success';
12096
+ notificationTimeout?: number;
12097
+ }
11649
12098
  /**
11650
- * Check if email verification should be shown to users
12099
+ * Universal error handler for DoNotDev applications
12100
+ *
12101
+ * Handles errors from any source, converting them to standardized DoNotDevError
12102
+ * objects, logging appropriately, and optionally adding to UI notification system.
11651
12103
  *
11652
- * Email verification is only relevant when:
11653
- * 1. Email authentication is enabled (user can sign up with email/password)
11654
- * 2. Firebase email verification is enabled in the project settings
12104
+ * @param error - The original error from any source
12105
+ * @param optionsOrMessage - Optional configuration or user-friendly message
12106
+ * @returns Standardized DoNotDevError
11655
12107
  *
11656
- * @returns boolean - true if email verification should be shown
12108
+ * @example
12109
+ * try {
12110
+ * await fetchData();
12111
+ * } catch (error) {
12112
+ * throw handleError(error, 'Failed to fetch data');
12113
+ * }
11657
12114
  *
11658
12115
  * @version 0.0.1
11659
12116
  * @since 0.0.1
11660
12117
  * @author AMBROISE PARK Consulting
11661
12118
  */
11662
- declare function shouldShowEmailVerification(): boolean;
12119
+ declare function handleError(error: unknown, optionsOrMessage?: HandleErrorOptions | string): DoNotDevError;
11663
12120
  /**
11664
- * Check if email verification is required for the current user
12121
+ * Creates a wrapped function that handles errors automatically
12122
+ *
12123
+ * @param fn - Function to wrap with error handling
12124
+ * @param options - Error handling options or user message
12125
+ * @returns Wrapped function with error handling
11665
12126
  *
11666
- * @param user - The current user object
11667
- * @returns boolean - true if email verification is required
12127
+ * @example
12128
+ * const safeFetchData = withErrorHandling(fetchData, 'Failed to fetch data');
12129
+ * await safeFetchData();
11668
12130
  *
11669
12131
  * @version 0.0.1
11670
12132
  * @since 0.0.1
11671
12133
  * @author AMBROISE PARK Consulting
11672
12134
  */
11673
- declare function isEmailVerificationRequired(user: any): boolean;
11674
-
12135
+ declare function withErrorHandling<T extends (...args: any[]) => any>(fn: T, options?: HandleErrorOptions | string): (...args: Parameters<T>) => Promise<ReturnType<T>>;
11675
12136
  /**
11676
- * @fileoverview Smart translation helper
11677
- * @description Auto-detects translation keys vs raw strings
12137
+ * Display a notification message (client-only)
12138
+ * This is a stub - actual implementation should be in client-side code
12139
+ * that imports toast directly from @donotdev/components
12140
+ *
12141
+ * @param message Message to display
12142
+ * @param severity Severity level
12143
+ * @param timeout Optional timeout in milliseconds
12144
+ * @returns ID of the notification
11678
12145
  *
11679
12146
  * @version 0.0.1
11680
12147
  * @since 0.0.1
11681
12148
  * @author AMBROISE PARK Consulting
11682
12149
  */
12150
+ declare function showNotification(message: string, severity?: 'error' | 'warning' | 'info' | 'success', timeout?: number): string;
12151
+
11683
12152
  /**
11684
- * Smart translation helper - auto-detects translation keys vs raw strings
11685
- *
11686
- * **How it works:**
11687
- * - If string has no dots/colons → return as-is (plain string)
11688
- * - If string has namespace prefix (e.g. "purchase:products.x") → try to translate
11689
- * - If string has dots but no namespace → try to translate (i18next fallback returns original if missing)
11690
- *
11691
- * **Namespace handling:**
11692
- * - "purchase:products.earlyBird.name" → translates from purchase namespace
11693
- * - "products.earlyBird.name" → translates from current namespace
11694
- * - "Early Bird Lifetime" → returns as-is
11695
- *
11696
- * **Use cases:**
11697
- * 1. Simple apps: Pass plain strings, they render as-is
11698
- * 2. i18n apps: Pass translation keys with namespace prefix
11699
- * 3. Edge cases: "Dr. Smith" with dot → tries t(), fallback returns original ✅
12153
+ * @fileoverview Error source detection module
12154
+ * @description Automatically detects the source of errors to apply appropriate handling
11700
12155
  *
11701
12156
  * @version 0.0.1
11702
12157
  * @since 0.0.1
11703
12158
  * @author AMBROISE PARK Consulting
11704
- *
11705
- * @example
11706
- * ```tsx
11707
- * // Simple app
11708
- * maybeTranslate(t, "Early Bird Lifetime") // → "Early Bird Lifetime"
11709
- *
11710
- * // i18n app with namespace
11711
- * maybeTranslate(t, "purchase:products.earlyBird.name") // → "Accès Anticipé à Vie" (if FR)
11712
- *
11713
- * // i18n app without namespace
11714
- * maybeTranslate(t, "products.earlyBird.name") // → "Accès Anticipé à Vie" (if FR)
11715
- *
11716
- * // Missing translation
11717
- * maybeTranslate(t, "products.missing.key") // → "products.missing.key" (debug!)
11718
- * ```
11719
12159
  */
11720
- declare function maybeTranslate(t: any, value?: string): string;
11721
12160
 
11722
12161
  /**
11723
- * @fileoverview PKCE (Proof Key for Code Exchange) utilities
11724
- * @description Implements PKCE for OAuth 2.0 flows to enhance security
12162
+ * Detects the source of an error based on its properties and structure
11725
12163
  *
11726
12164
  * @version 0.0.1
11727
12165
  * @since 0.0.1
11728
12166
  * @author AMBROISE PARK Consulting
12167
+ * @param error - The error to analyze
12168
+ * @returns The detected error source
11729
12169
  */
12170
+ declare function detectErrorSource(error: unknown): ErrorSource;
12171
+
11730
12172
  /**
11731
- * Generate a cryptographically random code verifier
12173
+ * Default error messages for standard error codes
12174
+ * These provide a fallback when no specific message is available
11732
12175
  *
11733
12176
  * @version 0.0.1
11734
12177
  * @since 0.0.1
11735
12178
  * @author AMBROISE PARK Consulting
11736
- * @returns Base64URL-encoded code verifier
11737
12179
  */
11738
- declare function generateCodeVerifier(): string;
12180
+ declare const DEFAULT_ERROR_MESSAGES: Record<ErrorCode, string>;
11739
12181
  /**
11740
- * Generate a code challenge from a code verifier
12182
+ * Maps an error from any source to a standardized DoNotDevError
12183
+ *
12184
+ * This is the central error mapping function that routes errors to the appropriate
12185
+ * handler based on the detected source.
12186
+ *
12187
+ * @param error - The original error
12188
+ * @param source - The detected error source
12189
+ * @param userMessage - Optional user-friendly message
12190
+ * @returns A standardized DoNotDevError
11741
12191
  *
11742
12192
  * @version 0.0.1
11743
12193
  * @since 0.0.1
11744
12194
  * @author AMBROISE PARK Consulting
11745
- * @param verifier The code verifier
11746
- * @returns Promise resolving to Base64URL-encoded code challenge
11747
12195
  */
11748
- declare function generateCodeChallenge(verifier: string): Promise<string>;
12196
+ declare function mapToDoNotDevError(error: unknown, source: ErrorSource, userMessage?: string): DoNotDevError;
12197
+
11749
12198
  /**
11750
- * Generate a PKCE pair (code verifier and challenge)
12199
+ * @fileoverview Sentry integration module
12200
+ * @description Handles capturing errors to Sentry with appropriate context.
12201
+ * Works universally on both client and server - uses globalThis.Sentry which
12202
+ * is set by both @sentry/react and @sentry/node when initialized.
11751
12203
  *
11752
12204
  * @version 0.0.1
11753
12205
  * @since 0.0.1
11754
12206
  * @author AMBROISE PARK Consulting
11755
- * @returns Promise resolving to PKCE pair
11756
12207
  */
11757
- declare function generatePKCEPair(): Promise<{
11758
- codeVerifier: string;
11759
- codeChallenge: string;
11760
- }>;
12208
+
11761
12209
  /**
11762
- * Check if PKCE is supported by the current environment
11763
- * @returns True if PKCE is supported
12210
+ * Captures an error to Sentry with additional context
12211
+ * Works on both client (@sentry/react) and server (@sentry/node)
11764
12212
  *
11765
12213
  * @version 0.0.1
11766
12214
  * @since 0.0.1
11767
12215
  * @author AMBROISE PARK Consulting
12216
+ * @param error - The error to capture
12217
+ * @param source - The detected error source
12218
+ * @param context - Additional context to include
11768
12219
  */
11769
- declare function isPKCESupported(): boolean;
12220
+ declare function captureErrorToSentry(error: DoNotDevError, source: ErrorSource, context?: Record<string, any>): void;
12221
+
11770
12222
  /**
11771
- * Validate a code verifier format
11772
- * @param verifier The code verifier to validate
11773
- * @returns True if the verifier is valid
12223
+ * @fileoverview Standard error handling factory
12224
+ * @description Creates error handlers that map any source error to DoNotDevError format
11774
12225
  *
11775
12226
  * @version 0.0.1
11776
12227
  * @since 0.0.1
11777
12228
  * @author AMBROISE PARK Consulting
11778
12229
  */
11779
- declare function validateCodeVerifier(verifier: string): boolean;
12230
+
11780
12231
  /**
11781
- * Validate a code challenge format
11782
- * @param challenge The code challenge to validate
11783
- * @returns True if the challenge is valid
12232
+ * Type for error handler functions
12233
+ *
12234
+ * @version 0.0.1
12235
+ * @since 0.0.1
12236
+ * @author AMBROISE PARK Consulting
12237
+ */
12238
+ type ErrorHandlerFunction = (error: unknown, userMessage?: string) => DoNotDevError;
12239
+ /**
12240
+ * Core configuration for error handlers
12241
+ *
12242
+ * @version 0.0.1
12243
+ * @since 0.0.1
12244
+ * @author AMBROISE PARK Consulting
12245
+ */
12246
+ interface ErrorHandlerConfig {
12247
+ errorSource: ErrorSource;
12248
+ defaultErrorCode: ErrorCode;
12249
+ defaultErrorMessage: string;
12250
+ errorCodeMapping?: Record<string, ErrorCode>;
12251
+ friendlyMessageMapping?: Record<string, string>;
12252
+ extractErrorCode?: (error: unknown) => string | undefined;
12253
+ extractErrorMessage?: (error: unknown) => string | undefined;
12254
+ processMetadata?: (error: unknown) => Record<string, any>;
12255
+ }
12256
+ /**
12257
+ * Creates an error handler that converts any type of error to DoNotDevError format
12258
+ *
12259
+ * @version 0.0.1
12260
+ * @since 0.0.1
12261
+ * @author AMBROISE PARK Consulting
12262
+ * @param config Configuration for the error handler
12263
+ * @returns A function that converts errors to DoNotDevErrors
12264
+ */
12265
+ declare function createErrorHandler(config: ErrorHandlerConfig): ErrorHandlerFunction;
12266
+ /**
12267
+ * Common error code mappings for most services
12268
+ *
12269
+ * @version 0.0.1
12270
+ * @since 0.0.1
12271
+ * @author AMBROISE PARK Consulting
12272
+ */
12273
+ declare const commonErrorCodeMappings: Record<string, ErrorCode>;
12274
+
12275
+ /**
12276
+ * @fileoverview Smart translation helper
12277
+ * @description Auto-detects translation keys vs raw strings
12278
+ *
12279
+ * @version 0.0.1
12280
+ * @since 0.0.1
12281
+ * @author AMBROISE PARK Consulting
12282
+ */
12283
+ /**
12284
+ * Smart translation helper - auto-detects translation keys vs raw strings
12285
+ *
12286
+ * **How it works:**
12287
+ * - If string has no dots/colons → return as-is (plain string)
12288
+ * - If string has namespace prefix (e.g. "purchase:products.x") → try to translate
12289
+ * - If string has dots but no namespace → try to translate (i18next fallback returns original if missing)
12290
+ *
12291
+ * **Namespace handling:**
12292
+ * - "purchase:products.earlyBird.name" → translates from purchase namespace
12293
+ * - "products.earlyBird.name" → translates from current namespace
12294
+ * - "Early Bird Lifetime" → returns as-is
12295
+ *
12296
+ * **Use cases:**
12297
+ * 1. Simple apps: Pass plain strings, they render as-is
12298
+ * 2. i18n apps: Pass translation keys with namespace prefix
12299
+ * 3. Edge cases: "Dr. Smith" with dot → tries t(), fallback returns original ✅
12300
+ *
12301
+ * @version 0.0.1
12302
+ * @since 0.0.1
12303
+ * @author AMBROISE PARK Consulting
12304
+ *
12305
+ * @example
12306
+ * ```tsx
12307
+ * // Simple app
12308
+ * maybeTranslate(t, "Early Bird Lifetime") // → "Early Bird Lifetime"
12309
+ *
12310
+ * // i18n app with namespace
12311
+ * maybeTranslate(t, "purchase:products.earlyBird.name") // → "Accès Anticipé à Vie" (if FR)
12312
+ *
12313
+ * // i18n app without namespace
12314
+ * maybeTranslate(t, "products.earlyBird.name") // → "Accès Anticipé à Vie" (if FR)
12315
+ *
12316
+ * // Missing translation
12317
+ * maybeTranslate(t, "products.missing.key") // → "products.missing.key" (debug!)
12318
+ * ```
12319
+ */
12320
+ declare function maybeTranslate(t: any, value?: string): string;
12321
+
12322
+ /**
12323
+ * @fileoverview PKCE (Proof Key for Code Exchange) utilities
12324
+ * @description Implements PKCE for OAuth 2.0 flows to enhance security
12325
+ *
12326
+ * @version 0.0.1
12327
+ * @since 0.0.1
12328
+ * @author AMBROISE PARK Consulting
12329
+ */
12330
+ /**
12331
+ * Generate a cryptographically random code verifier
12332
+ *
12333
+ * @version 0.0.1
12334
+ * @since 0.0.1
12335
+ * @author AMBROISE PARK Consulting
12336
+ * @returns Base64URL-encoded code verifier
12337
+ */
12338
+ declare function generateCodeVerifier(): string;
12339
+ /**
12340
+ * Generate a code challenge from a code verifier
12341
+ *
12342
+ * @version 0.0.1
12343
+ * @since 0.0.1
12344
+ * @author AMBROISE PARK Consulting
12345
+ * @param verifier The code verifier
12346
+ * @returns Promise resolving to Base64URL-encoded code challenge
12347
+ */
12348
+ declare function generateCodeChallenge(verifier: string): Promise<string>;
12349
+ /**
12350
+ * Generate a PKCE pair (code verifier and challenge)
12351
+ *
12352
+ * @version 0.0.1
12353
+ * @since 0.0.1
12354
+ * @author AMBROISE PARK Consulting
12355
+ * @returns Promise resolving to PKCE pair
12356
+ */
12357
+ declare function generatePKCEPair(): Promise<{
12358
+ codeVerifier: string;
12359
+ codeChallenge: string;
12360
+ }>;
12361
+ /**
12362
+ * Check if PKCE is supported by the current environment
12363
+ * @returns True if PKCE is supported
12364
+ *
12365
+ * @version 0.0.1
12366
+ * @since 0.0.1
12367
+ * @author AMBROISE PARK Consulting
12368
+ */
12369
+ declare function isPKCESupported(): boolean;
12370
+ /**
12371
+ * Validate a code verifier format
12372
+ * @param verifier The code verifier to validate
12373
+ * @returns True if the verifier is valid
12374
+ *
12375
+ * @version 0.0.1
12376
+ * @since 0.0.1
12377
+ * @author AMBROISE PARK Consulting
12378
+ */
12379
+ declare function validateCodeVerifier(verifier: string): boolean;
12380
+ /**
12381
+ * Validate a code challenge format
12382
+ * @param challenge The code challenge to validate
12383
+ * @returns True if the challenge is valid
11784
12384
  *
11785
12385
  * @version 0.0.1
11786
12386
  * @since 0.0.1
@@ -11809,17 +12409,222 @@ declare function validateCodeChallenge(challenge: string): boolean;
11809
12409
  */
11810
12410
  declare function withGracefulDegradation<T>(init: () => Promise<T>, fallback: () => void, featureName: string): Promise<T | false>;
11811
12411
 
11812
- /**
11813
- * Lazy import with caching
12412
+ /**
12413
+ * Lazy import with caching
12414
+ *
12415
+ * @version 0.0.1
12416
+ * @since 0.0.1
12417
+ * @author AMBROISE PARK Consulting
12418
+ * @param importFn - Dynamic import function
12419
+ * @param cacheKey - Cache key for this import
12420
+ * @returns Cached or fresh import result
12421
+ */
12422
+ declare function lazyImport<T>(importFn: () => Promise<T>, cacheKey: string): Promise<T>;
12423
+
12424
+ /**
12425
+
12426
+ * @fileoverview Role Hierarchy Utilities
12427
+
12428
+ * @description Provides role-based access control with hierarchical permissions.
12429
+
12430
+ * Implements a 4-level hierarchy: guest (0) < user (1) < admin (2) < super (3).
12431
+
12432
+ *
12433
+
12434
+ * **Hierarchy Rules:**
12435
+
12436
+ * - Super can access: super, admin, user, and guest routes
12437
+
12438
+ * - Admin can access: admin, user, and guest routes
12439
+
12440
+ * - User can access: user and guest routes
12441
+
12442
+ * - Guest can access: guest routes only
12443
+
12444
+ *
12445
+
12446
+ * **CSR/SSR/Server Safe:**
12447
+
12448
+ * Pure function with no browser APIs or React dependencies.
12449
+
12450
+ * Safe for use in Firebase Functions, API routes, and server-side rendering.
12451
+
12452
+ *
12453
+
12454
+ * @version 0.0.1
12455
+
12456
+ * @since 0.0.1
12457
+
12458
+ * @author AMBROISE PARK Consulting
12459
+
12460
+ */
12461
+ /**
12462
+
12463
+ * Check if a user role has access to a required role based on hierarchy.
12464
+
12465
+ *
12466
+
12467
+ * Uses a 4-level hierarchy where higher roles inherit access to lower roles:
12468
+
12469
+ * - Super (level 3) can access super, admin, user, and guest routes
12470
+
12471
+ * - Admin (level 2) can access admin, user, and guest routes
12472
+
12473
+ * - User (level 1) can access user and guest routes
12474
+
12475
+ * - Guest (level 0) can access guest routes only
12476
+
12477
+ *
12478
+
12479
+ * Unknown roles default to level -1 (denied) for security.
12480
+
12481
+ * Unknown required roles default to Infinity (always denied).
12482
+
12483
+ *
12484
+
12485
+ * @param userRole - The user's current role (e.g., 'super', 'admin', 'user', 'guest')
12486
+
12487
+ * @param requiredRole - The role required to access the resource
12488
+
12489
+ * @returns True if user has sufficient role level, false otherwise
12490
+
12491
+ *
12492
+
12493
+ * @example
12494
+
12495
+ * ```typescript
12496
+
12497
+ * // Admin accessing user route
12498
+
12499
+ * hasRoleAccess('admin', 'user') // true
12500
+
12501
+ *
12502
+
12503
+ * // User accessing admin route
12504
+
12505
+ * hasRoleAccess('user', 'admin') // false
12506
+
12507
+ *
12508
+
12509
+ * // Super accessing admin route
12510
+
12511
+ * hasRoleAccess('super', 'admin') // true
12512
+
12513
+ * ```
12514
+
12515
+ *
12516
+
12517
+ * @version 0.0.1
12518
+
12519
+ * @since 0.0.1
12520
+
12521
+ */
12522
+ declare function hasRoleAccess(userRole: string | undefined, requiredRole: string): boolean;
12523
+
12524
+ /**
12525
+
12526
+ * @fileoverview Tier Hierarchy Utilities
12527
+
12528
+ * @description Provides subscription tier-based access control with hierarchical permissions.
12529
+
12530
+ * Uses tier levels from SubscriptionConfig (apps define their own) with COMMON_TIER_CONFIGS as fallback.
12531
+
12532
+ *
12533
+
12534
+ * **Hierarchy Rules:**
12535
+
12536
+ * Higher tier levels inherit access to lower tier levels:
12537
+
12538
+ * - Tier with level 2 can access tiers with level 2, 1, and 0
12539
+
12540
+ * - Tier with level 1 can access tiers with level 1 and 0
12541
+
12542
+ * - Tier with level 0 can access tier with level 0 only
12543
+
12544
+ *
12545
+
12546
+ * **CSR/SSR/Server Safe:**
12547
+
12548
+ * Pure function with no browser APIs or React dependencies.
12549
+
12550
+ * Safe for use in Firebase Functions, API routes, and server-side rendering.
12551
+
12552
+ *
12553
+
12554
+ * @version 0.0.1
12555
+
12556
+ * @since 0.0.1
12557
+
12558
+ * @author AMBROISE PARK Consulting
12559
+
12560
+ */
12561
+
12562
+ /**
12563
+
12564
+ * Check if a user tier has access to a required tier based on hierarchy.
12565
+
12566
+ *
12567
+
12568
+ * Uses tier levels from the provided config (or COMMON_TIER_CONFIGS as fallback).
12569
+
12570
+ * Higher tier levels inherit access to lower tier levels.
12571
+
12572
+ *
12573
+
12574
+ * Unknown tiers default to level -1 (denied) for security.
12575
+
12576
+ * Unknown required tiers default to Infinity (always denied).
12577
+
12578
+ *
12579
+
12580
+ * @param userTier - The user's current tier (e.g., 'pro', 'free', 'ai')
12581
+
12582
+ * @param requiredTier - The tier required to access the resource
12583
+
12584
+ * @param tierConfig - Optional custom tier configuration. If not provided, uses COMMON_TIER_CONFIGS
12585
+
12586
+ * @returns True if user has sufficient tier level, false otherwise
12587
+
12588
+ *
12589
+
12590
+ * @example
12591
+
12592
+ * ```typescript
12593
+
12594
+ * // Pro accessing free route
12595
+
12596
+ * hasTierAccess('pro', 'free') // true
12597
+
12598
+ *
12599
+
12600
+ * // Free accessing pro route
12601
+
12602
+ * hasTierAccess('free', 'pro') // false
12603
+
12604
+ *
12605
+
12606
+ * // With custom config
12607
+
12608
+ * const customConfig = {
12609
+
12610
+ * basic: { features: [], level: 0 },
12611
+
12612
+ * premium: { features: [], level: 1 }
12613
+
12614
+ * };
12615
+
12616
+ * hasTierAccess('premium', 'basic', customConfig) // true
12617
+
12618
+ * ```
12619
+
11814
12620
  *
12621
+
11815
12622
  * @version 0.0.1
12623
+
11816
12624
  * @since 0.0.1
11817
- * @author AMBROISE PARK Consulting
11818
- * @param importFn - Dynamic import function
11819
- * @param cacheKey - Cache key for this import
11820
- * @returns Cached or fresh import result
12625
+
11821
12626
  */
11822
- declare function lazyImport<T>(importFn: () => Promise<T>, cacheKey: string): Promise<T>;
12627
+ declare function hasTierAccess(userTier: string | undefined, requiredTier: string, tierConfig?: SubscriptionConfig['tiers']): boolean;
11823
12628
 
11824
12629
  /**
11825
12630
  * @fileoverview Singleton utility functions
@@ -11981,125 +12786,6 @@ declare function updateMetadata(userId: string): {
11981
12786
  _updatedBy: string;
11982
12787
  };
11983
12788
 
11984
- /**
11985
- * @fileoverview Server-side error handler for DoNotDev applications
11986
- * @description Centralized error handling for server environments with logging and reporting
11987
- *
11988
- * This module provides comprehensive error handling specifically designed for server
11989
- * environments. It handles error detection, mapping, logging, and reporting without
11990
- * any client-side dependencies like UI notifications.
11991
- *
11992
- * **Key Features:**
11993
- * - Universal error handling for any error type
11994
- * - Automatic error source detection and mapping
11995
- * - Centralized logging with structured context
11996
- * - Server-safe error reporting (no UI dependencies)
11997
- * - Context preservation and debugging information
11998
- * - Configurable error handling behavior
11999
- *
12000
- * **Error Flow:**
12001
- * 1. Detect error source and type
12002
- * 2. Map to standardized DoNotDevError
12003
- * 3. Log error with structured context information
12004
- * 4. Report to external services (server-safe)
12005
- * 5. Return standardized error object
12006
- *
12007
- * **Usage Pattern:**
12008
- * ```typescript
12009
- * try {
12010
- * await riskyOperation();
12011
- * } catch (error) {
12012
- * throw handleServerError(error, {
12013
- * userMessage: 'Operation failed',
12014
- * context: { operation: 'riskyOperation' },
12015
- * severity: 'error'
12016
- * });
12017
- * }
12018
- * ```
12019
- *
12020
- * @version 0.0.1
12021
- * @since 0.0.1
12022
- * @author AMBROISE PARK Consulting
12023
- */
12024
-
12025
- /**
12026
- * Error handling options for server environments
12027
- *
12028
- * @version 0.0.1
12029
- * @since 0.0.1
12030
- * @author AMBROISE PARK Consulting
12031
- */
12032
- interface HandleServerErrorOptions {
12033
- /** User-friendly error message */
12034
- userMessage?: string;
12035
- /** Additional context information */
12036
- context?: Record<string, any>;
12037
- /** Error severity level for logging */
12038
- severity?: 'error' | 'warning' | 'info' | 'success';
12039
- /** Whether to report to external services */
12040
- reportToExternal?: boolean;
12041
- /** Custom error code */
12042
- code?: ErrorCode;
12043
- /** Error source */
12044
- source?: ErrorSource;
12045
- /** Whether to include stack trace in logs */
12046
- includeStackTrace?: boolean;
12047
- /** Whether this error should be displayed to the user */
12048
- displayable?: boolean;
12049
- }
12050
- /**
12051
- * Universal error handler for server environments
12052
- *
12053
- * @param error - The error to handle
12054
- * @param optionsOrMessage - Error handling options or simple message string
12055
- * @returns Standardized DoNotDevError
12056
- *
12057
- * @example
12058
- * ```typescript
12059
- * // Simple usage
12060
- * try {
12061
- * await riskyOperation();
12062
- * } catch (error) {
12063
- * throw handleServerError(error, 'Operation failed');
12064
- * }
12065
- *
12066
- * // Advanced usage
12067
- * try {
12068
- * await riskyOperation();
12069
- * } catch (error) {
12070
- * throw handleServerError(error, {
12071
- * userMessage: 'Failed to process user data',
12072
- * context: { userId: '123', operation: 'processUser' },
12073
- * severity: 'error',
12074
- * code: 'USER_PROCESSING_FAILED'
12075
- * });
12076
- * }
12077
- * ```
12078
- *
12079
- * @version 0.0.1
12080
- * @since 0.0.1
12081
- * @author AMBROISE PARK Consulting
12082
- */
12083
- declare function handleServerError(error: unknown, optionsOrMessage?: HandleServerErrorOptions | string): DoNotDevError;
12084
- /**
12085
- * Convenience function for logging errors without throwing
12086
- * Useful for non-critical errors that should be logged but not propagated
12087
- *
12088
- * @version 0.0.1
12089
- * @since 0.0.1
12090
- * @author AMBROISE PARK Consulting
12091
- */
12092
- declare function logServerErrorOnly(error: unknown, optionsOrMessage?: HandleServerErrorOptions | string): void;
12093
- /**
12094
- * Convenience function for creating server-safe error messages
12095
- * Returns a user-friendly message without throwing
12096
- *
12097
- * @version 0.0.1
12098
- * @since 0.0.1
12099
- * @author AMBROISE PARK Consulting
12100
- */
12101
- declare function createServerErrorMessage(error: unknown, fallbackMessage?: string): string;
12102
-
12103
12789
  /**
12104
12790
  * @fileoverview Server-side date utilities
12105
12791
  * @description Robust date calculation utilities for server environments
@@ -12185,134 +12871,6 @@ declare function validateMetadata(metadata: Record<string, any>): Record<string,
12185
12871
  */
12186
12872
  declare function validateEnvVar(name: string, required?: boolean): string;
12187
12873
 
12188
- /**
12189
- * Log levels for structured logging
12190
- *
12191
- * @version 0.0.1
12192
- * @since 0.0.1
12193
- * @author AMBROISE PARK Consulting
12194
- */
12195
- declare enum LogLevel {
12196
- DEBUG = 0,
12197
- INFO = 1,
12198
- WARN = 2,
12199
- ERROR = 3,
12200
- FATAL = 4
12201
- }
12202
- /**
12203
- * Log entry interface for structured logging
12204
- *
12205
- * @version 0.0.1
12206
- * @since 0.0.1
12207
- * @author AMBROISE PARK Consulting
12208
- */
12209
- interface LogEntry {
12210
- level: LogLevel;
12211
- message: string;
12212
- timestamp: string;
12213
- context?: Record<string, any>;
12214
- error?: Error;
12215
- metadata?: Record<string, any>;
12216
- }
12217
- /**
12218
- * Server-side logger (client-safe, no Sentry)
12219
- *
12220
- * Features:
12221
- * - Structured logging with context
12222
- * - Basic console output
12223
- * - Performance monitoring
12224
- * - Request correlation
12225
- *
12226
- * Note: For Sentry integration, use the logger from functions/shared/logger.ts
12227
- *
12228
- * @example
12229
- * ```typescript
12230
- * import { logger } from '@donotdev/utils/server';
12231
- *
12232
- * // Basic logging
12233
- * logger.info('Server started', { port: 3000 });
12234
- *
12235
- * // Error logging
12236
- * logger.error('Database error', { error: err, query: 'SELECT * FROM users' });
12237
- *
12238
- * // Performance logging
12239
- * logger.info('Request completed', {
12240
- * duration: 150,
12241
- * status: 200,
12242
- * path: '/api/users'
12243
- * });
12244
- * ```
12245
- *
12246
- * @version 0.0.1
12247
- * @since 0.0.1
12248
- * @author AMBROISE PARK Consulting
12249
- */
12250
- declare const logger: {
12251
- /**
12252
- * Log debug information
12253
- * @param message - Log message
12254
- * @param context - Additional context data
12255
- */
12256
- debug(message: string, context?: Record<string, any>): void;
12257
- /**
12258
- * Log informational messages
12259
- * @param message - Log message
12260
- * @param context - Additional context data
12261
- */
12262
- info(message: string, context?: Record<string, any>): void;
12263
- /**
12264
- * Log warning messages
12265
- * @param message - Log message
12266
- * @param context - Additional context data
12267
- */
12268
- warn(message: string, context?: Record<string, any>): void;
12269
- /**
12270
- * Log error messages
12271
- * @param message - Log message
12272
- * @param context - Additional context data
12273
- */
12274
- error(message: string, context?: Record<string, any>): void;
12275
- /**
12276
- * Log fatal errors
12277
- * @param message - Log message
12278
- * @param context - Additional context data
12279
- */
12280
- fatal(message: string, context?: Record<string, any>): void;
12281
- /**
12282
- * Core logging method
12283
- * @param level - Log level
12284
- * @param message - Log message
12285
- * @param context - Additional context data
12286
- */
12287
- log(level: LogLevel, message: string, context?: Record<string, any>): void;
12288
- /**
12289
- * Check if Sentry is enabled (always false for client-safe version)
12290
- * @returns False - this version doesn't support Sentry
12291
- */
12292
- isSentryEnabled(): boolean;
12293
- /**
12294
- * Get current log level (always DEBUG for server)
12295
- * @returns Current log level
12296
- */
12297
- getLevel(): LogLevel;
12298
- };
12299
- /**
12300
- * Create a child logger with additional context
12301
- * @param context - Additional context to include in all logs
12302
- * @returns Child logger instance
12303
- *
12304
- * @version 0.0.1
12305
- * @since 0.0.1
12306
- * @author AMBROISE PARK Consulting
12307
- */
12308
- declare function createChildLogger(context: Record<string, any>): {
12309
- debug: (message: string, additionalContext?: Record<string, any>) => void;
12310
- info: (message: string, additionalContext?: Record<string, any>) => void;
12311
- warn: (message: string, additionalContext?: Record<string, any>) => void;
12312
- error: (message: string, additionalContext?: Record<string, any>) => void;
12313
- fatal: (message: string, additionalContext?: Record<string, any>) => void;
12314
- };
12315
-
12316
12874
  /**
12317
12875
  * @fileoverview Server-side cookie utilities
12318
12876
  * @description Cookie parsing for SSR environments (Next.js, etc.)
@@ -12355,25 +12913,29 @@ declare function parseServerCookie(cookieHeader: string | undefined, name: strin
12355
12913
  */
12356
12914
  //# sourceMappingURL=index.d.ts.map
12357
12915
 
12916
+ declare const index_d_DEFAULT_ERROR_MESSAGES: typeof DEFAULT_ERROR_MESSAGES;
12358
12917
  type index_d_DateFormatOptions = DateFormatOptions;
12359
12918
  type index_d_DateFormatPreset = DateFormatPreset;
12360
- type index_d_HandleServerErrorOptions = HandleServerErrorOptions;
12361
- type index_d_LogEntry = LogEntry;
12362
- type index_d_LogLevel = LogLevel;
12363
- declare const index_d_LogLevel: typeof LogLevel;
12919
+ type index_d_DoNotDevError = DoNotDevError;
12920
+ declare const index_d_DoNotDevError: typeof DoNotDevError;
12921
+ type index_d_ErrorHandlerConfig = ErrorHandlerConfig;
12922
+ type index_d_ErrorHandlerFunction = ErrorHandlerFunction;
12923
+ type index_d_HandleErrorOptions = HandleErrorOptions;
12364
12924
  type index_d_SingletonManager = SingletonManager;
12365
12925
  declare const index_d_SingletonManager: typeof SingletonManager;
12366
12926
  declare const index_d_addMonths: typeof addMonths;
12367
12927
  declare const index_d_addYears: typeof addYears;
12368
12928
  declare const index_d_calculateSubscriptionEndDate: typeof calculateSubscriptionEndDate;
12929
+ declare const index_d_captureErrorToSentry: typeof captureErrorToSentry;
12930
+ declare const index_d_commonErrorCodeMappings: typeof commonErrorCodeMappings;
12369
12931
  declare const index_d_compactToISOString: typeof compactToISOString;
12370
12932
  declare const index_d_createAsyncSingleton: typeof createAsyncSingleton;
12371
- declare const index_d_createChildLogger: typeof createChildLogger;
12933
+ declare const index_d_createErrorHandler: typeof createErrorHandler;
12372
12934
  declare const index_d_createMetadata: typeof createMetadata;
12373
12935
  declare const index_d_createMethodProxy: typeof createMethodProxy;
12374
- declare const index_d_createServerErrorMessage: typeof createServerErrorMessage;
12375
12936
  declare const index_d_createSingleton: typeof createSingleton;
12376
12937
  declare const index_d_createSingletonWithParams: typeof createSingletonWithParams;
12938
+ declare const index_d_detectErrorSource: typeof detectErrorSource;
12377
12939
  declare const index_d_formatDate: typeof formatDate;
12378
12940
  declare const index_d_formatRelativeTime: typeof formatRelativeTime;
12379
12941
  declare const index_d_generateCodeChallenge: typeof generateCodeChallenge;
@@ -12381,21 +12943,21 @@ declare const index_d_generateCodeVerifier: typeof generateCodeVerifier;
12381
12943
  declare const index_d_generatePKCEPair: typeof generatePKCEPair;
12382
12944
  declare const index_d_getCurrentTimestamp: typeof getCurrentTimestamp;
12383
12945
  declare const index_d_getWeekFromISOString: typeof getWeekFromISOString;
12384
- declare const index_d_handleServerError: typeof handleServerError;
12946
+ declare const index_d_handleError: typeof handleError;
12947
+ declare const index_d_hasRoleAccess: typeof hasRoleAccess;
12948
+ declare const index_d_hasTierAccess: typeof hasTierAccess;
12385
12949
  declare const index_d_isCompactDateString: typeof isCompactDateString;
12386
- declare const index_d_isEmailVerificationRequired: typeof isEmailVerificationRequired;
12387
12950
  declare const index_d_isPKCESupported: typeof isPKCESupported;
12388
12951
  declare const index_d_isoToCompactString: typeof isoToCompactString;
12389
12952
  declare const index_d_lazyImport: typeof lazyImport;
12390
- declare const index_d_logServerErrorOnly: typeof logServerErrorOnly;
12391
- declare const index_d_logger: typeof logger;
12953
+ declare const index_d_mapToDoNotDevError: typeof mapToDoNotDevError;
12392
12954
  declare const index_d_maybeTranslate: typeof maybeTranslate;
12393
12955
  declare const index_d_normalizeToISOString: typeof normalizeToISOString;
12394
12956
  declare const index_d_parseDate: typeof parseDate;
12395
12957
  declare const index_d_parseDateToNoonUTC: typeof parseDateToNoonUTC;
12396
12958
  declare const index_d_parseISODate: typeof parseISODate;
12397
12959
  declare const index_d_parseServerCookie: typeof parseServerCookie;
12398
- declare const index_d_shouldShowEmailVerification: typeof shouldShowEmailVerification;
12960
+ declare const index_d_showNotification: typeof showNotification;
12399
12961
  declare const index_d_timestampToISOString: typeof timestampToISOString;
12400
12962
  declare const index_d_toDateOnly: typeof toDateOnly;
12401
12963
  declare const index_d_toISOString: typeof toISOString;
@@ -12409,210 +12971,12 @@ declare const index_d_validateCodeVerifier: typeof validateCodeVerifier;
12409
12971
  declare const index_d_validateEnvVar: typeof validateEnvVar;
12410
12972
  declare const index_d_validateMetadata: typeof validateMetadata;
12411
12973
  declare const index_d_validateUrl: typeof validateUrl;
12974
+ declare const index_d_withErrorHandling: typeof withErrorHandling;
12412
12975
  declare const index_d_withGracefulDegradation: typeof withGracefulDegradation;
12413
12976
  declare namespace index_d {
12414
- export { index_d_LogLevel as LogLevel, index_d_SingletonManager as SingletonManager, index_d_addMonths as addMonths, index_d_addYears as addYears, index_d_calculateSubscriptionEndDate as calculateSubscriptionEndDate, index_d_compactToISOString as compactToISOString, index_d_createAsyncSingleton as createAsyncSingleton, index_d_createChildLogger as createChildLogger, index_d_createMetadata as createMetadata, index_d_createMethodProxy as createMethodProxy, index_d_createServerErrorMessage as createServerErrorMessage, index_d_createSingleton as createSingleton, index_d_createSingletonWithParams as createSingletonWithParams, index_d_formatDate as formatDate, index_d_formatRelativeTime as formatRelativeTime, index_d_generateCodeChallenge as generateCodeChallenge, index_d_generateCodeVerifier as generateCodeVerifier, index_d_generatePKCEPair as generatePKCEPair, index_d_getCurrentTimestamp as getCurrentTimestamp, index_d_getWeekFromISOString as getWeekFromISOString, index_d_handleServerError as handleServerError, index_d_isCompactDateString as isCompactDateString, index_d_isEmailVerificationRequired as isEmailVerificationRequired, index_d_isPKCESupported as isPKCESupported, index_d_isoToCompactString as isoToCompactString, index_d_lazyImport as lazyImport, index_d_logServerErrorOnly as logServerErrorOnly, index_d_logger as logger, index_d_maybeTranslate as maybeTranslate, index_d_normalizeToISOString as normalizeToISOString, index_d_parseDate as parseDate, index_d_parseDateToNoonUTC as parseDateToNoonUTC, index_d_parseISODate as parseISODate, index_d_parseServerCookie as parseServerCookie, index_d_shouldShowEmailVerification as shouldShowEmailVerification, index_d_timestampToISOString as timestampToISOString, index_d_toDateOnly as toDateOnly, index_d_toISOString as toISOString, index_d_translateArray as translateArray, index_d_translateArrayRange as translateArrayRange, index_d_translateArrayWithIndices as translateArrayWithIndices, index_d_translateObjectArray as translateObjectArray, index_d_updateMetadata as updateMetadata, index_d_validateCodeChallenge as validateCodeChallenge, index_d_validateCodeVerifier as validateCodeVerifier, index_d_validateEnvVar as validateEnvVar, index_d_validateMetadata as validateMetadata, index_d_validateUrl as validateUrl, index_d_withGracefulDegradation as withGracefulDegradation };
12415
- export type { index_d_DateFormatOptions as DateFormatOptions, index_d_DateFormatPreset as DateFormatPreset, index_d_HandleServerErrorOptions as HandleServerErrorOptions, index_d_LogEntry as LogEntry };
12416
- }
12417
-
12418
- /**
12419
- * The standard schema types that are generated for each entity
12420
- */
12421
- interface EntitySchemas {
12422
- [key: string]: dndevSchema<unknown>;
12977
+ export { index_d_DEFAULT_ERROR_MESSAGES as DEFAULT_ERROR_MESSAGES, index_d_DoNotDevError as DoNotDevError, index_d_SingletonManager as SingletonManager, index_d_addMonths as addMonths, index_d_addYears as addYears, index_d_calculateSubscriptionEndDate as calculateSubscriptionEndDate, index_d_captureErrorToSentry as captureErrorToSentry, index_d_commonErrorCodeMappings as commonErrorCodeMappings, index_d_compactToISOString as compactToISOString, index_d_createAsyncSingleton as createAsyncSingleton, index_d_createErrorHandler as createErrorHandler, index_d_createMetadata as createMetadata, index_d_createMethodProxy as createMethodProxy, index_d_createSingleton as createSingleton, index_d_createSingletonWithParams as createSingletonWithParams, index_d_detectErrorSource as detectErrorSource, index_d_formatDate as formatDate, index_d_formatRelativeTime as formatRelativeTime, index_d_generateCodeChallenge as generateCodeChallenge, index_d_generateCodeVerifier as generateCodeVerifier, index_d_generatePKCEPair as generatePKCEPair, index_d_getCurrentTimestamp as getCurrentTimestamp, index_d_getWeekFromISOString as getWeekFromISOString, index_d_handleError as handleError, index_d_hasRoleAccess as hasRoleAccess, index_d_hasTierAccess as hasTierAccess, index_d_isCompactDateString as isCompactDateString, index_d_isPKCESupported as isPKCESupported, index_d_isoToCompactString as isoToCompactString, index_d_lazyImport as lazyImport, index_d_mapToDoNotDevError as mapToDoNotDevError, index_d_maybeTranslate as maybeTranslate, index_d_normalizeToISOString as normalizeToISOString, index_d_parseDate as parseDate, index_d_parseDateToNoonUTC as parseDateToNoonUTC, index_d_parseISODate as parseISODate, index_d_parseServerCookie as parseServerCookie, index_d_showNotification as showNotification, index_d_timestampToISOString as timestampToISOString, index_d_toDateOnly as toDateOnly, index_d_toISOString as toISOString, index_d_translateArray as translateArray, index_d_translateArrayRange as translateArrayRange, index_d_translateArrayWithIndices as translateArrayWithIndices, index_d_translateObjectArray as translateObjectArray, index_d_updateMetadata as updateMetadata, index_d_validateCodeChallenge as validateCodeChallenge, index_d_validateCodeVerifier as validateCodeVerifier, index_d_validateEnvVar as validateEnvVar, index_d_validateMetadata as validateMetadata, index_d_validateUrl as validateUrl, index_d_withErrorHandling as withErrorHandling, index_d_withGracefulDegradation as withGracefulDegradation };
12978
+ export type { index_d_DateFormatOptions as DateFormatOptions, index_d_DateFormatPreset as DateFormatPreset, index_d_ErrorHandlerConfig as ErrorHandlerConfig, index_d_ErrorHandlerFunction as ErrorHandlerFunction, index_d_HandleErrorOptions as HandleErrorOptions };
12423
12979
  }
12424
- /**
12425
- * Creates all necessary schemas for an entity
12426
- *
12427
- * @param entity The entity to create schemas for
12428
- * @returns An object containing all generated schemas with proper typing
12429
- * @version 0.0.1
12430
- * @since 0.0.1
12431
- * @author AMBROISE PARK Consulting
12432
- */
12433
- declare function createSchemas(entity: Entity): EntitySchemas;
12434
-
12435
- /**
12436
- * @fileoverview Schema enhancement utility
12437
- * @description Enhances a Valibot schema with additional metadata
12438
- *
12439
- * @version 0.0.1
12440
- * @since 0.0.1
12441
- * @author AMBROISE PARK Consulting
12442
- */
12443
-
12444
- /**
12445
- * Enhances a Valibot schema with additional metadata.
12446
- *
12447
- * @param schema - The base Valibot schema
12448
- * @param metadata - The metadata to attach
12449
- * @returns The enhanced schema
12450
- * @version 0.0.1
12451
- * @since 0.0.1
12452
- * @author AMBROISE PARK Consulting
12453
- */
12454
- declare function enhanceSchema<T>(schema: v.BaseSchema<unknown, T, v.BaseIssue<unknown>>, metadata: SchemaMetadata): dndevSchema<T>;
12455
-
12456
- /**
12457
- * @fileoverview Schema type generation utility
12458
- * @description Creates Valibot schemas for entity fields
12459
- *
12460
- * @version 0.0.1
12461
- * @since 0.0.1
12462
- * @author AMBROISE PARK Consulting
12463
- */
12464
-
12465
- /**
12466
- * Extracts a Valibot schema type for a given entity field with validation rules.
12467
- *
12468
- * @param field - The entity field definition
12469
- * @returns A Valibot schema corresponding to the field definition
12470
- * @version 0.0.1
12471
- * @since 0.0.1
12472
- * @author AMBROISE PARK Consulting
12473
- */
12474
- declare function getSchemaType(field: EntityField): v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>;
12475
-
12476
- /**
12477
- * Recursively validates that all string values that look like potential dates
12478
- * within an object adhere to the ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ).
12479
- *
12480
- * @param data - The object or data structure to validate
12481
- * @param {string} [currentPath=''] - Internal tracking of the object path for error messages
12482
- * @throws Error if any string resembling a date is not in the correct ISO format
12483
- * @version 0.0.1
12484
- * @since 0.0.1
12485
- * @author AMBROISE PARK Consulting
12486
- */
12487
- declare function validateDates(data: Record<string, any> | any[], currentPath?: string): void;
12488
-
12489
- /**
12490
- * Validates a document against the schema, including uniqueness and custom validations.
12491
- * @param schema - The enhanced schema.
12492
- * @param data - The document data.
12493
- * @param operation - 'create' or 'update'.
12494
- * @param currentDocId - Optional current document ID for update operations.
12495
- * @throws DoNotDevError if validation fails.
12496
- *
12497
- * @version 0.0.1
12498
- * @since 0.0.1
12499
- * @author AMBROISE PARK Consulting
12500
- */
12501
- declare function validateDocument<T>(schema: dndevSchema<T>, data: Record<string, any>, operation: 'create' | 'update', currentDocId?: string): Promise<void>;
12502
-
12503
- /**
12504
- * @fileoverview Unique field validation utility
12505
- * @description Validates uniqueness constraints for schema fields
12506
- *
12507
- * @version 0.0.1
12508
- * @since 0.0.1
12509
- * @author AMBROISE PARK Consulting
12510
- */
12511
-
12512
- /**
12513
- * Registers a validator for uniqueness constraints
12514
- *
12515
- * @param validator - The validator implementation
12516
- * @version 0.0.1
12517
- * @since 0.0.1
12518
- * @author AMBROISE PARK Consulting
12519
- */
12520
- declare function registerUniqueConstraintValidator(validator: UniqueConstraintValidator): void;
12521
- /**
12522
- * Validates unique fields for a document across environments.
12523
- *
12524
- * @param schema - The Valibot schema with metadata.
12525
- * @param data - The document data.
12526
- * @param currentDocId - Optional ID of the current document (for updates).
12527
- * @throws Error if a unique constraint is violated.
12528
- * @version 0.0.1
12529
- * @since 0.0.1
12530
- * @author AMBROISE PARK Consulting
12531
- */
12532
- declare function validateUniqueFields<T>(schema: dndevSchema<T>, data: Record<string, any>, currentDocId?: string): Promise<void>;
12533
-
12534
- /**
12535
- * @fileoverview Schema Utilities
12536
- * @description Common utility functions for working with schemas. Provides helper functions for schema metadata checking and manipulation.
12537
- *
12538
- * @version 0.0.1
12539
- * @since 0.0.1
12540
- * @author AMBROISE PARK Consulting
12541
- */
12542
-
12543
- /**
12544
- * Checks if an object has schema metadata (works with Valibot schemas)
12545
- *
12546
- * @param obj - The object to check
12547
- * @returns Whether the object has schema metadata
12548
- * @version 0.0.1
12549
- * @since 0.0.1
12550
- * @author AMBROISE PARK Consulting
12551
- */
12552
- declare function hasMetadata(obj: unknown): obj is dndevSchema<unknown>;
12553
- /**
12554
- * Gets the collection name from a schema
12555
- *
12556
- * @param schema - The schema to get the collection name from
12557
- * @returns The collection name
12558
- * @version 0.0.1
12559
- * @since 0.0.1
12560
- * @author AMBROISE PARK Consulting
12561
- */
12562
- declare function getCollectionName(schema: dndevSchema<unknown>): string;
12563
-
12564
- /**
12565
- * @fileoverview Field Visibility Utilities
12566
- * @description Core visibility logic used by both frontend and backend for field access control
12567
- *
12568
- * @version 0.0.1
12569
- * @since 0.0.1
12570
- * @author AMBROISE PARK Consulting
12571
- */
12572
-
12573
- /**
12574
- * Core visibility logic used by both frontend and backend
12575
- *
12576
- * @param visibility - The visibility level
12577
- * @param isAdmin - Whether the user is an admin
12578
- * @returns Whether the field should be visible
12579
- * @version 0.0.1
12580
- * @since 0.0.1
12581
- * @author AMBROISE PARK Consulting
12582
- */
12583
- declare function isFieldVisible(visibility: Visibility, isAdmin: boolean): boolean;
12584
- /**
12585
- * Gets visible fields from an entity definition
12586
- *
12587
- * @param fields - The entity fields
12588
- * @param isAdmin - Whether the user is an admin
12589
- * @returns Array of visible field names
12590
- * @version 0.0.1
12591
- * @since 0.0.1
12592
- * @author AMBROISE PARK Consulting
12593
- */
12594
- declare function getVisibleFieldsFromEntity(fields: Record<string, EntityField>, isAdmin: boolean): string[];
12595
- declare const baseFields: Record<string, EntityField>;
12596
-
12597
- /**
12598
- * @fileoverview Entity Definition Utilities
12599
- * @description Utilities for defining and validating entities. Provides functions to define business entities with form configuration, field definitions, and validation rules.
12600
- *
12601
- * @version 0.0.1
12602
- * @since 0.0.1
12603
- * @author AMBROISE PARK Consulting
12604
- */
12605
-
12606
- /**
12607
- * Defines an entity with validation and default configuration
12608
- *
12609
- * @param entity - The business entity definition
12610
- * @returns The validated and configured entity
12611
- * @version 0.0.1
12612
- * @since 0.0.1
12613
- * @author AMBROISE PARK Consulting
12614
- */
12615
- declare function defineEntity(entity: BusinessEntity): Entity;
12616
12980
 
12617
- export { AUTH_EVENTS, AUTH_PARTNERS, AUTH_PARTNER_STATE, AuthUserSchema, BILLING_EVENTS, BREAKPOINT_RANGES, BREAKPOINT_THRESHOLDS, COMMON_TIER_CONFIGS, CONFIDENCE_LEVELS, CONSENT_CATEGORY, CONTEXTS, CheckoutSessionMetadataSchema, CreateCheckoutSessionRequestSchema, CreateCheckoutSessionResponseSchema, CustomClaimsSchema, DEFAULT_LAYOUT_PRESET, DEFAULT_SUBSCRIPTION, DENSITY, DoNotDevError, ENVIRONMENTS, EntityHookError, FEATURES, FEATURE_CONSENT_MATRIX, FEATURE_STATUS, FIREBASE_ERROR_MAP, FIRESTORE_ID_PATTERN, GITHUB_PERMISSION_LEVELS, LAYOUT_PRESET, LogLevel, OAUTH_EVENTS, OAUTH_PARTNERS, PARTNER_ICONS, PAYLOAD_EVENTS, PERMISSIONS, PLATFORMS, PWA_ASSET_TYPES, PWA_DISPLAY_MODES, ProductDeclarationSchema, ProductDeclarationsSchema, ROUTE_SOURCES, STORAGE_SCOPES, STORAGE_TYPES, STRIPE_EVENTS, STRIPE_MODES, SUBSCRIPTION_DURATIONS, SUBSCRIPTION_STATUS, SUBSCRIPTION_TIERS, index_d as ServerUtils, SingletonManager, StripeBackConfigSchema, StripeFrontConfigSchema, StripePaymentSchema, StripeSubscriptionSchema, SubscriptionClaimsSchema, SubscriptionDataSchema, USER_ROLES, UserSubscriptionSchema, WebhookEventSchema, addMonths, addYears, baseFields, calculateSubscriptionEndDate, checkGitHubAccessSchema, compactToISOString, createAsyncSingleton, createChildLogger, createDefaultSubscriptionClaims, createDefaultUserProfile, createEntitySchema, createMetadata, createMethodProxy, createSchemas, createServerErrorMessage, createSingleton, createSingletonWithParams, defineEntity, deleteEntitySchema, disconnectOAuthSchema, enhanceSchema, exchangeTokenSchema, formatDate, formatRelativeTime, generateCodeChallenge, generateCodeVerifier, generatePKCEPair, getBreakpointFromWidth, getBreakpointUtils, getCollectionName, getConnectionsSchema, getCurrentTimestamp, getEntitySchema, getSchemaType, getVisibleFieldsFromEntity, getWeekFromISOString, githubPermissionSchema, githubRepoConfigSchema, grantGitHubAccessSchema, handleServerError, hasMetadata, isAuthPartnerId, isBreakpoint, isCompactDateString, isEmailVerificationRequired, isFieldVisible, isOAuthPartnerId, isPKCESupported, isoToCompactString, lazyImport, listEntitiesSchema, logServerErrorOnly, logger, maybeTranslate, normalizeToISOString, overrideFeatures, overridePaymentModes, overridePermissions, overrideSubscriptionStatus, overrideSubscriptionTiers, overrideUserRoles, parseDate, parseDateToNoonUTC, parseISODate, parseServerCookie, refreshTokenSchema, registerUniqueConstraintValidator, revokeGitHubAccessSchema, shouldShowEmailVerification, timestampToISOString, toDateOnly, toISOString, translateArray, translateArrayRange, translateArrayWithIndices, translateObjectArray, updateEntitySchema, updateMetadata, validateAuthPartners, validateAuthSchemas, validateAuthUser, validateBillingSchemas, validateCheckoutSessionMetadata, validateCodeChallenge, validateCodeVerifier, validateCreateCheckoutSessionRequest, validateCreateCheckoutSessionResponse, validateCustomClaims, validateDates, validateDocument, validateEnvVar, validateMetadata, validateOAuthPartners, validateStripeBackConfig, validateStripeFrontConfig, validateSubscriptionClaims, validateSubscriptionData, validateUniqueFields, validateUrl, validateUserSubscription, validateWebhookEvent, withGracefulDegradation };
12618
- export type { AccountLinkResult, AccountLinkingInfo, AdminCheckHookResult, AdminClaims, ApiResponse, AppConfig, AppCookieCategories, AppMetadata, AppProvidersProps, AssetsPluginConfig, AttemptRecord, AuthAPI, AuthActions, AuthConfig, AuthContextValue, AuthCoreHookResult, AuthError, AuthEventData, AuthEventKey, AuthEventName, AuthMethod, AuthPartner, AuthPartnerButton, AuthPartnerHookResult, AuthPartnerId, AuthPartnerResult, AuthPartnerState, AuthProvider, AuthProviderProps, AuthRedirectHookResult, AuthRedirectOptions, AuthResult, AuthState, AuthStateStore, AuthStatus, AuthTokenHookResult, AuthUser, BaseActions, BaseCredentials, BaseDocument, BaseEntityFields, BasePartnerState, BaseState, BaseStoreActions, BaseStoreState, BaseUserProfile, BasicUserInfo, BillingAPI, BillingAdapter, BillingErrorCode, BillingEvent, BillingEventData, BillingEventKey, BillingEventName, BillingProvider, BillingProviderConfig, Breakpoint, BreakpointUtils, BusinessEntity, CachedError, CanAPI, CheckGitHubAccessRequest, CheckoutMode, CheckoutOptions, CheckoutSessionMetadata, ColumnDef, CommonSubscriptionFeatures, CommonTranslations, ConfidenceLevel, ConsentAPI, ConsentActions, ConsentCategory, ConsentState, Context, CookieOptions, CreateCheckoutSessionRequest, CreateCheckoutSessionResponse, CreateEntityData, CreateEntityRequest, CreateEntityResponse, CrudAPI, CustomClaims, CustomStoreConfig, DateFormatOptions, DateFormatPreset, DateValue, DeleteEntityRequest, DeleteEntityResponse, Density, DnDevLayoutProps, DnDevOverride, DndevFrameworkConfig, DoNotDevCookieCategories, DynamicFormRule, EffectiveConnectionType, EmailVerificationHookResult, EmailVerificationStatus, Entity, EntityField, EntityHookErrors, EntityMetadata, EntitySchemas, EntityTemplateProps, EntityTranslations, EnvironmentMode, ErrorCode, ErrorSeverity, ErrorSource, ExchangeTokenParams, ExchangeTokenRequest, FaviconConfig, Feature, FeatureAccessHookResult, FeatureConsentRequirement, FeatureHookResult, FeatureId, FeatureName, FeatureStatus, FeaturesConfig, FeaturesPluginConfig, FeaturesRequiringAnyConsent, FeaturesRequiringConsent, FeaturesWithoutConsent, FieldCondition, FieldConfig, FieldType, FieldTypeToValue, FirebaseCallOptions, FirebaseConfig, FirestoreTimestamp, FirestoreUniqueConstraintValidator, FooterConfig, FooterZoneConfig, FormConfig, FormStep, FunctionCallConfig, FunctionCallContext, FunctionCallOptions, FunctionCallResult, FunctionClient, FunctionClientFactoryOptions, FunctionError, FunctionLoader, FunctionPlatform, FunctionResponse, FunctionSchema, FunctionSchemas, FunctionSystem, GetCustomClaimsResponse, GetEntityData, GetEntityRequest, GetEntityResponse, GetUserAuthStatusResponse, GitHubPermission, GitHubRepoConfig, GrantGitHubAccessRequest, HandleServerErrorOptions, HeaderZoneConfig, I18nConfig, I18nPluginConfig, I18nProviderProps, ID, INetworkManager, IStorageManager, IStorageStrategy, Invoice, InvoiceItem, LanguageInfo, LayoutConfig, LayoutInput, LayoutPreset, LegalCompanyInfo, LegalConfig, LegalContactInfo, LegalDirectorInfo, LegalHostingInfo, LegalJurisdictionInfo, LegalSectionsConfig, LegalWebsiteInfo, ListEntitiesRequest, ListEntitiesResponse, ListEntityData, ListOptions, ListResponse, LoadingActions, LoadingState, LogEntry, MergedBarConfig, MobileBehaviorConfig, ModalActions, ModalState, MutationResponse, NavigationRoute, NetworkCheckConfig, NetworkConnectionType, NetworkReconnectCallback, NetworkState, NetworkStatus, NetworkStatusHookResult, OAuthAPI, OAuthApiRequestOptions, OAuthCallbackHookResult, OAuthConnection, OAuthConnectionInfo, OAuthConnectionRequest, OAuthConnectionStatus, OAuthCredentials, OAuthEventData, OAuthEventKey, OAuthEventName, OAuthPartner, OAuthPartnerButton, OAuthPartnerHookResult, OAuthPartnerId, OAuthPartnerResult, OAuthPartnerState, OAuthPurpose, OAuthRefreshRequest, OAuthRefreshResponse, OAuthResult, OAuthStoreActions, OAuthStoreState, Observable, OrderByClause, PWAAssetType, PWADisplayMode, PWAPluginConfig, PageAuth, PageMeta, PaginationOptions, PartnerButton, PartnerConnectionState, PartnerIconId, PartnerId, PartnerResult, PartnerType, PayloadCacheEventData, PayloadDocument, PayloadDocumentEventData, PayloadEventKey, PayloadEventName, PayloadGlobalEventData, PayloadMediaEventData, PayloadPageRegenerationEventData, PayloadRequest, PayloadUserEventData, PaymentEventData, PaymentMethod, PaymentMethodType, PaymentMode, Permission, Platform, PresetConfig, PresetRegistry, ProcessPaymentSuccessRequest, ProcessPaymentSuccessResponse, ProductDeclaration, ProviderInstances, RateLimitConfig, RateLimitManager, RateLimitResult, RateLimitState, RateLimiter, ReadCallback, Reference, RefreshSubscriptionRequest, RefreshSubscriptionResponse, RemoveCustomClaimsResponse, ResolvedLayoutConfig, RevokeGitHubAccessRequest, RouteMeta, RouteSource, RoutesPluginConfig, SEOConfig, SchemaMetadata, SetCustomClaimsResponse, SidebarZoneConfig, SlotContent, StorageOptions, StorageScope, StorageType, Store, StoreApi, StripeBackConfig, StripeCheckoutRequest, StripeCheckoutResponse, StripeCheckoutSessionEventData, StripeConfig, StripeCustomer, StripeCustomerEventData, StripeEventData, StripeEventKey, StripeEventName, StripeFrontConfig, StripeInvoice, StripeInvoiceEventData, StripePayment, StripePaymentIntentEventData, StripePaymentMethod, StripePrice, StripeProduct, StripeProvider, StripeSubscription, StripeSubscriptionData, StripeWebhookEvent, StripeWebhookEventData, Subscription, SubscriptionClaims, SubscriptionConfig, SubscriptionData, SubscriptionDuration, SubscriptionEventData, SubscriptionHookResult, SubscriptionInfo, SubscriptionStatus, SubscriptionTier, SupportedLanguage, ThemeActions, ThemeInfo, ThemeMode, ThemeState, ThemesPluginConfig, TierAccessHookResult, Timestamp, TokenInfo, TokenResponse, TokenState, TokenStatus, TranslationOptions, TranslationResource, UIFieldOptions, UniqueConstraintValidator, UnsubscribeFn, UpdateEntityData, UpdateEntityRequest, UpdateEntityResponse, UseFunctionsMutationOptions, UseFunctionsQueryOptions, UseTranslationOptionsEnhanced, UserContext, UserProfile, UserProviderData, UserRole, UserSubscription, ValidationRules, ValueTypeForField, Visibility, WebhookEvent, WebhookEventData, WhereClause, WhereOperator, WithMetadata, dndevSchema };
12981
+ export { AUTH_EVENTS, AUTH_PARTNERS, AUTH_PARTNER_STATE, AuthUserSchema, BILLING_EVENTS, BREAKPOINT_RANGES, BREAKPOINT_THRESHOLDS, COMMON_TIER_CONFIGS, CONFIDENCE_LEVELS, CONSENT_CATEGORY, CONTEXTS, CheckoutSessionMetadataSchema, CreateCheckoutSessionRequestSchema, CreateCheckoutSessionResponseSchema, CustomClaimsSchema, DEFAULT_ERROR_MESSAGES, DEFAULT_LAYOUT_PRESET, DEFAULT_SUBSCRIPTION, DENSITY, DoNotDevError, ENVIRONMENTS, EntityHookError, FEATURES, FEATURE_CONSENT_MATRIX, FEATURE_STATUS, FIREBASE_ERROR_MAP, FIRESTORE_ID_PATTERN, GITHUB_PERMISSION_LEVELS, LAYOUT_PRESET, OAUTH_EVENTS, OAUTH_PARTNERS, PARTNER_ICONS, PAYLOAD_EVENTS, PERMISSIONS, PLATFORMS, PWA_ASSET_TYPES, PWA_DISPLAY_MODES, ProductDeclarationSchema, ProductDeclarationsSchema, ROUTE_SOURCES, STORAGE_SCOPES, STORAGE_TYPES, STRIPE_EVENTS, STRIPE_MODES, SUBSCRIPTION_DURATIONS, SUBSCRIPTION_STATUS, SUBSCRIPTION_TIERS, index_d as ServerUtils, SingletonManager, StripeBackConfigSchema, StripeFrontConfigSchema, StripePaymentSchema, StripeSubscriptionSchema, SubscriptionClaimsSchema, SubscriptionDataSchema, USER_ROLES, UserSubscriptionSchema, WebhookEventSchema, addMonths, addYears, calculateSubscriptionEndDate, captureErrorToSentry, checkGitHubAccessSchema, commonErrorCodeMappings, compactToISOString, createAsyncSingleton, createDefaultSubscriptionClaims, createDefaultUserProfile, createEntitySchema, createErrorHandler, createMetadata, createMethodProxy, createSingleton, createSingletonWithParams, deleteEntitySchema, detectErrorSource, disconnectOAuthSchema, exchangeTokenSchema, formatDate, formatRelativeTime, generateCodeChallenge, generateCodeVerifier, generatePKCEPair, getBreakpointFromWidth, getBreakpointUtils, getConnectionsSchema, getCurrentTimestamp, getEntitySchema, getWeekFromISOString, githubPermissionSchema, githubRepoConfigSchema, grantGitHubAccessSchema, handleError, hasRoleAccess, hasTierAccess, isAuthPartnerId, isBreakpoint, isCompactDateString, isOAuthPartnerId, isPKCESupported, isoToCompactString, lazyImport, listEntitiesSchema, mapToDoNotDevError, maybeTranslate, normalizeToISOString, overrideFeatures, overridePaymentModes, overridePermissions, overrideSubscriptionStatus, overrideSubscriptionTiers, overrideUserRoles, parseDate, parseDateToNoonUTC, parseISODate, parseServerCookie, refreshTokenSchema, revokeGitHubAccessSchema, showNotification, timestampToISOString, toDateOnly, toISOString, translateArray, translateArrayRange, translateArrayWithIndices, translateObjectArray, updateEntitySchema, updateMetadata, validateAuthPartners, validateAuthSchemas, validateAuthUser, validateBillingSchemas, validateCheckoutSessionMetadata, validateCodeChallenge, validateCodeVerifier, validateCreateCheckoutSessionRequest, validateCreateCheckoutSessionResponse, validateCustomClaims, validateEnvVar, validateMetadata, validateOAuthPartners, validateStripeBackConfig, validateStripeFrontConfig, validateSubscriptionClaims, validateSubscriptionData, validateUrl, validateUserSubscription, validateWebhookEvent, withErrorHandling, withGracefulDegradation };
12982
+ export type { AccountLinkResult, AccountLinkingInfo, AdminCheckHookResult, AdminClaims, AggregateConfig, AggregateFilterOperator, AggregateOperation, AggregateRequest, AggregateResponse, ApiResponse, AppConfig, AppCookieCategories, AppMetadata, AppProvidersProps, AssetsPluginConfig, AttemptRecord, AuthAPI, AuthActions, AuthConfig, AuthContextValue, AuthCoreHookResult, AuthError, AuthEventData, AuthEventKey, AuthEventName, AuthMethod, AuthPartner, AuthPartnerButton, AuthPartnerHookResult, AuthPartnerId, AuthPartnerResult, AuthPartnerState, AuthProvider, AuthProviderProps, AuthRedirectHookResult, AuthRedirectOperation, AuthRedirectOptions, AuthResult, AuthState, AuthStateStore, AuthStatus, AuthTokenHookResult, AuthUser, BaseActions, BaseCredentials, BaseDocument, BaseEntityFields, BasePartnerState, BaseState, BaseStoreActions, BaseStoreState, BaseUserProfile, BasicUserInfo, BillingAPI, BillingAdapter, BillingErrorCode, BillingEvent, BillingEventData, BillingEventKey, BillingEventName, BillingProvider, BillingProviderConfig, BillingRedirectOperation, Breakpoint, BreakpointUtils, BusinessEntity, CachedError, CanAPI, CheckGitHubAccessRequest, CheckoutMode, CheckoutOptions, CheckoutSessionMetadata, ColumnDef, CommonSubscriptionFeatures, CommonTranslations, ConfidenceLevel, ConsentAPI, ConsentActions, ConsentCategory, ConsentState, Context, CookieOptions, CreateCheckoutSessionRequest, CreateCheckoutSessionResponse, CreateEntityData, CreateEntityRequest, CreateEntityResponse, CrudAPI, CustomClaims, CustomStoreConfig, DateFormatOptions, DateFormatPreset, DateValue, DeleteEntityRequest, DeleteEntityResponse, Density, DnDevLayoutProps, DnDevOverride, DndevFrameworkConfig, DoNotDevCookieCategories, DynamicFormRule, Editable, EffectiveConnectionType, EmailVerificationHookResult, EmailVerificationStatus, Entity, EntityField, EntityHookErrors, EntityMetadata, EntityTemplateProps, EntityTranslations, EnvironmentMode, ErrorCode, ErrorHandlerConfig, ErrorHandlerFunction, ErrorSeverity, ErrorSource, ExchangeTokenParams, ExchangeTokenRequest, FaviconConfig, Feature, FeatureAccessHookResult, FeatureConsentRequirement, FeatureHookResult, FeatureId, FeatureName, FeatureStatus, FeaturesConfig, FeaturesPluginConfig, FeaturesRequiringAnyConsent, FeaturesRequiringConsent, FeaturesWithoutConsent, FieldCondition, FieldConfig, FieldType, FieldTypeToValue, FirebaseCallOptions, FirebaseConfig, FirestoreTimestamp, FirestoreUniqueConstraintValidator, FooterConfig, FooterZoneConfig, FormConfig, FormStep, FunctionCallConfig, FunctionCallContext, FunctionCallOptions, FunctionCallResult, FunctionClient, FunctionClientFactoryOptions, FunctionError, FunctionLoader, FunctionPlatform, FunctionResponse, FunctionSchema, FunctionSchemas, FunctionSystem, GetCustomClaimsResponse, GetEntityData, GetEntityRequest, GetEntityResponse, GetUserAuthStatusResponse, GitHubPermission, GitHubRepoConfig, GrantGitHubAccessRequest, GroupByDefinition, HandleErrorOptions, HeaderZoneConfig, I18nConfig, I18nPluginConfig, I18nProviderProps, ID, INetworkManager, IStorageManager, IStorageStrategy, Invoice, InvoiceItem, LanguageInfo, LayoutConfig, LayoutInput, LayoutPreset, LegalCompanyInfo, LegalConfig, LegalContactInfo, LegalDirectorInfo, LegalHostingInfo, LegalJurisdictionInfo, LegalSectionsConfig, LegalWebsiteInfo, ListEntitiesRequest, ListEntitiesResponse, ListEntityData, ListOptions, ListResponse, LoadingActions, LoadingState, MergedBarConfig, MetricDefinition, MobileBehaviorConfig, ModalActions, ModalState, MutationResponse, NavigationRoute, NetworkCheckConfig, NetworkConnectionType, NetworkReconnectCallback, NetworkState, NetworkStatus, NetworkStatusHookResult, OAuthAPI, OAuthApiRequestOptions, OAuthCallbackHookResult, OAuthConnection, OAuthConnectionInfo, OAuthConnectionRequest, OAuthConnectionStatus, OAuthCredentials, OAuthEventData, OAuthEventKey, OAuthEventName, OAuthPartner, OAuthPartnerButton, OAuthPartnerHookResult, OAuthPartnerId, OAuthPartnerResult, OAuthPartnerState, OAuthPurpose, OAuthRedirectOperation, OAuthRefreshRequest, OAuthRefreshResponse, OAuthResult, OAuthStoreActions, OAuthStoreState, Observable, OrderByClause, PWAAssetType, PWADisplayMode, PWAPluginConfig, PageAuth, PageMeta, PaginationOptions, PartnerButton, PartnerConnectionState, PartnerIconId, PartnerId, PartnerResult, PartnerType, PayloadCacheEventData, PayloadDocument, PayloadDocumentEventData, PayloadEventKey, PayloadEventName, PayloadGlobalEventData, PayloadMediaEventData, PayloadPageRegenerationEventData, PayloadRequest, PayloadUserEventData, PaymentEventData, PaymentMethod, PaymentMethodType, PaymentMode, Permission, Picture, Platform, PresetConfig, PresetRegistry, ProcessPaymentSuccessRequest, ProcessPaymentSuccessResponse, ProductDeclaration, ProviderInstances, RateLimitConfig, RateLimitManager, RateLimitResult, RateLimitState, RateLimiter, ReadCallback, RedirectOperation, RedirectOverlayActions, RedirectOverlayConfig, RedirectOverlayPhase, RedirectOverlayState, Reference, RefreshSubscriptionRequest, RefreshSubscriptionResponse, RemoveCustomClaimsResponse, ResolvedLayoutConfig, RevokeGitHubAccessRequest, RouteMeta, RouteSource, RoutesPluginConfig, SEOConfig, SchemaMetadata, SetCustomClaimsResponse, SidebarZoneConfig, SlotContent, StorageOptions, StorageScope, StorageType, Store, StoreApi, StripeBackConfig, StripeCheckoutRequest, StripeCheckoutResponse, StripeCheckoutSessionEventData, StripeConfig, StripeCustomer, StripeCustomerEventData, StripeEventData, StripeEventKey, StripeEventName, StripeFrontConfig, StripeInvoice, StripeInvoiceEventData, StripePayment, StripePaymentIntentEventData, StripePaymentMethod, StripePrice, StripeProduct, StripeProvider, StripeSubscription, StripeSubscriptionData, StripeWebhookEvent, StripeWebhookEventData, Subscription, SubscriptionClaims, SubscriptionConfig, SubscriptionData, SubscriptionDuration, SubscriptionEventData, SubscriptionHookResult, SubscriptionInfo, SubscriptionStatus, SubscriptionTier, SupportedLanguage, ThemeActions, ThemeInfo, ThemeMode, ThemeState, ThemesPluginConfig, TierAccessHookResult, Timestamp, TokenInfo, TokenResponse, TokenState, TokenStatus, TranslationOptions, TranslationResource, UIFieldOptions, UniqueConstraintValidator, UnsubscribeFn, UpdateEntityData, UpdateEntityRequest, UpdateEntityResponse, UseFunctionsMutationOptions, UseFunctionsQueryOptions, UseTranslationOptionsEnhanced, UserContext, UserProfile, UserProviderData, UserRole, UserSubscription, ValidationRules, ValueTypeForField, Visibility, WebhookEvent, WebhookEventData, WhereClause, WhereOperator, WithMetadata, dndevSchema };