@plyaz/types 1.19.4 → 1.20.0

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 (50) hide show
  1. package/dist/api/client/types.d.ts +59 -0
  2. package/dist/api/index.cjs +29 -0
  3. package/dist/api/index.cjs.map +1 -1
  4. package/dist/api/index.js +29 -0
  5. package/dist/api/index.js.map +1 -1
  6. package/dist/core/auth/types.d.ts +1 -1
  7. package/dist/core/domain/index.d.ts +5 -0
  8. package/dist/core/domain/types.d.ts +123 -0
  9. package/dist/core/events/enums.d.ts +25 -1
  10. package/dist/core/events/index.d.ts +3 -3
  11. package/dist/core/events/payloads.d.ts +80 -1
  12. package/dist/core/featureFlag/types.d.ts +16 -16
  13. package/dist/core/frontend/featureFlags.d.ts +106 -0
  14. package/dist/core/frontend/index.d.ts +6 -0
  15. package/dist/core/frontend/types.d.ts +318 -0
  16. package/dist/core/index.d.ts +6 -2
  17. package/dist/core/init/index.d.ts +5 -0
  18. package/dist/core/init/types.d.ts +347 -0
  19. package/dist/core/modules.d.ts +19 -3
  20. package/dist/core/services/index.d.ts +5 -0
  21. package/dist/core/{services.d.ts → services/types.d.ts} +74 -6
  22. package/dist/errors/codes.d.ts +3 -0
  23. package/dist/errors/index.cjs +29 -0
  24. package/dist/errors/index.cjs.map +1 -1
  25. package/dist/errors/index.d.ts +2 -0
  26. package/dist/errors/index.js +29 -0
  27. package/dist/errors/index.js.map +1 -1
  28. package/dist/errors/middleware.d.ts +105 -0
  29. package/dist/errors/store.d.ts +140 -0
  30. package/dist/examples/index.d.ts +1 -1
  31. package/dist/examples/types.d.ts +64 -0
  32. package/dist/features/feature-flag/dto.types.d.ts +67 -0
  33. package/dist/features/feature-flag/index.d.ts +3 -0
  34. package/dist/features/feature-flag/service.types.d.ts +184 -0
  35. package/dist/features/feature-flag/store.types.d.ts +166 -0
  36. package/dist/features/feature-flag/types.d.ts +16 -4
  37. package/dist/globals.d.ts +23 -0
  38. package/dist/index.cjs +49 -0
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.js +49 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/store/index.cjs +13 -0
  43. package/dist/store/index.cjs.map +1 -1
  44. package/dist/store/index.d.ts +2 -0
  45. package/dist/store/index.js +11 -0
  46. package/dist/store/index.js.map +1 -1
  47. package/dist/store/keys.d.ts +23 -0
  48. package/dist/store/types.d.ts +62 -71
  49. package/dist/testing/features/feature-flags/types.d.ts +3 -3
  50. package/package.json +6 -2
@@ -10,6 +10,8 @@ import type { UnknownRecord } from 'type-fest';
10
10
  import type { NETWORK_QUALITY, NetworkInfo } from '../network';
11
11
  import type { ConfigConflict, DebugInfo } from '../debugger';
12
12
  import type { PackageErrorLike } from '../../errors';
13
+ import type { ReactNode } from 'react';
14
+ import type { QueryClient } from '@tanstack/react-query';
13
15
  /**
14
16
  * Options for creating an API client
15
17
  * Endpoints are automatically included from src/api/endpoints
@@ -406,3 +408,60 @@ export interface SetupUnifiedHandlersParams {
406
408
  clientOptions?: ApiClientOptions;
407
409
  clearTemporaryOverrides?: () => void;
408
410
  }
411
+ /**
412
+ * Props for API initialization loading component.
413
+ * Used by ApiProvider to display loading state during client initialization.
414
+ */
415
+ export interface ApiInitializationLoadingProps {
416
+ /** Custom loading component override */
417
+ loading?: ReactNode;
418
+ }
419
+ /**
420
+ * Props for API initialization error component.
421
+ * Used by ApiProvider to display error state when initialization fails.
422
+ */
423
+ export interface ApiInitializationErrorProps {
424
+ /** The error that occurred during initialization */
425
+ error: PackageErrorLike;
426
+ /** Custom error component override */
427
+ errorComponent?: (error: PackageErrorLike) => ReactNode;
428
+ }
429
+ /**
430
+ * Props for ApiProvider component.
431
+ * Provides React Query context and optionally initializes the default API client.
432
+ */
433
+ export interface ApiProviderProps {
434
+ /** Child components that will have access to React Query */
435
+ children: ReactNode;
436
+ /** Optional custom QueryClient instance (defaults to shared singleton) */
437
+ queryClient?: QueryClient;
438
+ /**
439
+ * Optional global API configuration.
440
+ * Applied via setGlobalConfig() before client initialization.
441
+ * These settings apply to ALL API clients as defaults.
442
+ */
443
+ globalConfig?: ApiConfig;
444
+ /**
445
+ * Optional API client configuration.
446
+ * If provided, creates and sets the default API client automatically.
447
+ */
448
+ apiConfig?: ApiClientOptions;
449
+ /**
450
+ * Custom loading component to show while API client is initializing.
451
+ * Overrides the default ApiInitializationLoading component.
452
+ */
453
+ loading?: ReactNode;
454
+ /**
455
+ * Custom error renderer function.
456
+ * Overrides the default ApiInitializationError component.
457
+ */
458
+ error?: (error: PackageErrorLike) => ReactNode;
459
+ /**
460
+ * Callback when API client is ready.
461
+ */
462
+ onReady?: () => void;
463
+ /**
464
+ * Callback when API client initialization fails.
465
+ */
466
+ onError?: (error: PackageErrorLike) => void;
467
+ }
@@ -1192,6 +1192,10 @@ var ERROR_CODES = {
1192
1192
  ERROR_SYSTEM_NOT_INITIALIZED: "error.system.not.initialized",
1193
1193
  EVENT_FACTORY_NOT_REGISTERED: "error.event.factory.not.registered",
1194
1194
  DATABASE_ERROR: "error.database",
1195
+ // Global Error Handler
1196
+ UNCAUGHT_EXCEPTION: "error.uncaught.exception",
1197
+ UNHANDLED_REJECTION: "error.unhandled.rejection",
1198
+ RUNTIME_ERROR: "error.runtime",
1195
1199
  // ===== Database Errors =====
1196
1200
  // Connection & Configuration
1197
1201
  DB_ACCESS_DENIED: "db.access_denied",
@@ -3872,6 +3876,31 @@ var ERROR_DEFINITIONS = {
3872
3876
  retryable: false,
3873
3877
  userMessage: "errors.database"
3874
3878
  },
3879
+ // Global Error Handler
3880
+ [ERROR_CODES.UNCAUGHT_EXCEPTION]: {
3881
+ code: ERROR_CODES.UNCAUGHT_EXCEPTION,
3882
+ status: HTTP_STATUS.INTERNAL_SERVER_ERROR,
3883
+ category: ERROR_CATEGORY.System,
3884
+ severity: ERROR_SEVERITY.Critical,
3885
+ retryable: false,
3886
+ userMessage: "errors.uncaught.exception"
3887
+ },
3888
+ [ERROR_CODES.UNHANDLED_REJECTION]: {
3889
+ code: ERROR_CODES.UNHANDLED_REJECTION,
3890
+ status: HTTP_STATUS.INTERNAL_SERVER_ERROR,
3891
+ category: ERROR_CATEGORY.System,
3892
+ severity: ERROR_SEVERITY.Critical,
3893
+ retryable: false,
3894
+ userMessage: "errors.unhandled.rejection"
3895
+ },
3896
+ [ERROR_CODES.RUNTIME_ERROR]: {
3897
+ code: ERROR_CODES.RUNTIME_ERROR,
3898
+ status: HTTP_STATUS.INTERNAL_SERVER_ERROR,
3899
+ category: ERROR_CATEGORY.System,
3900
+ severity: ERROR_SEVERITY.High,
3901
+ retryable: false,
3902
+ userMessage: "errors.runtime"
3903
+ },
3875
3904
  // ===== Database Error Definitions =====
3876
3905
  // Connection & Configuration
3877
3906
  [ERROR_CODES.DB_ACCESS_DENIED]: {