@plyaz/api 1.0.2 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +632 -542
- package/dist/api/cache/index.d.ts +183 -0
- package/dist/api/cache/index.d.ts.map +1 -0
- package/dist/api/cache/patterns.d.ts +174 -0
- package/dist/api/cache/patterns.d.ts.map +1 -0
- package/dist/api/cache/strategies.d.ts +47 -0
- package/dist/api/cache/strategies.d.ts.map +1 -0
- package/dist/api/client/clientEventManager.d.ts +238 -0
- package/dist/api/client/clientEventManager.d.ts.map +1 -0
- package/dist/api/client/createApiClient.d.ts +5 -0
- package/dist/api/client/createApiClient.d.ts.map +1 -0
- package/dist/api/client/helpers/headers.d.ts +11 -0
- package/dist/api/client/helpers/headers.d.ts.map +1 -0
- package/dist/api/client/helpers/index.d.ts +9 -0
- package/dist/api/client/helpers/index.d.ts.map +1 -0
- package/dist/api/client/helpers/interceptors.d.ts +29 -0
- package/dist/api/client/helpers/interceptors.d.ts.map +1 -0
- package/dist/api/client/helpers/network.d.ts +21 -0
- package/dist/api/client/helpers/network.d.ts.map +1 -0
- package/dist/api/client/helpers/strategies.d.ts +30 -0
- package/dist/api/client/helpers/strategies.d.ts.map +1 -0
- package/dist/api/client/helpers/tracking.d.ts +15 -0
- package/dist/api/client/helpers/tracking.d.ts.map +1 -0
- package/dist/api/client/index.d.ts +7 -0
- package/dist/api/client/index.d.ts.map +1 -0
- package/dist/api/config/adapter.d.ts +25 -0
- package/dist/api/config/adapter.d.ts.map +1 -0
- package/dist/api/config/configBuilder.d.ts +62 -0
- package/dist/api/config/configBuilder.d.ts.map +1 -0
- package/dist/api/config/configManager.d.ts +67 -0
- package/dist/api/config/configManager.d.ts.map +1 -0
- package/dist/api/config/global.d.ts +106 -0
- package/dist/api/config/global.d.ts.map +1 -0
- package/dist/api/config/index.d.ts +11 -0
- package/dist/api/config/index.d.ts.map +1 -0
- package/dist/api/debugger/DebugReport.d.ts +71 -0
- package/dist/api/debugger/DebugReport.d.ts.map +1 -0
- package/dist/api/debugger/UnifiedDebugger.d.ts +444 -0
- package/dist/api/debugger/UnifiedDebugger.d.ts.map +1 -0
- package/dist/api/debugger/factories/conflict.d.ts +58 -0
- package/dist/api/debugger/factories/conflict.d.ts.map +1 -0
- package/dist/api/debugger/factories/eventTracking.d.ts +126 -0
- package/dist/api/debugger/factories/eventTracking.d.ts.map +1 -0
- package/dist/api/debugger/factories/history.d.ts +97 -0
- package/dist/api/debugger/factories/history.d.ts.map +1 -0
- package/dist/api/debugger/factories/index.d.ts +15 -0
- package/dist/api/debugger/factories/index.d.ts.map +1 -0
- package/dist/api/debugger/factories/issueAnalysis.d.ts +52 -0
- package/dist/api/debugger/factories/issueAnalysis.d.ts.map +1 -0
- package/dist/api/debugger/factories/performance.d.ts +53 -0
- package/dist/api/debugger/factories/performance.d.ts.map +1 -0
- package/dist/api/debugger/factories/report.d.ts +43 -0
- package/dist/api/debugger/factories/report.d.ts.map +1 -0
- package/dist/api/debugger/index.d.ts +99 -0
- package/dist/api/debugger/index.d.ts.map +1 -0
- package/dist/api/debugger/queue/DebuggerQueueManager.d.ts +61 -0
- package/dist/api/debugger/queue/DebuggerQueueManager.d.ts.map +1 -0
- package/dist/api/debugger/queue/OperationTracker.d.ts +86 -0
- package/dist/api/debugger/queue/OperationTracker.d.ts.map +1 -0
- package/dist/api/debugger/queue/index.d.ts +9 -0
- package/dist/api/debugger/queue/index.d.ts.map +1 -0
- package/dist/api/endpoints/builders.d.ts +109 -0
- package/dist/api/endpoints/builders.d.ts.map +1 -0
- package/dist/api/endpoints/campaigns.d.ts +43 -0
- package/dist/api/endpoints/campaigns.d.ts.map +1 -0
- package/dist/api/endpoints/index.d.ts +100 -0
- package/dist/api/endpoints/index.d.ts.map +1 -0
- package/dist/api/endpoints/polling.d.ts +83 -0
- package/dist/api/endpoints/polling.d.ts.map +1 -0
- package/dist/api/endpoints/utils.d.ts +128 -0
- package/dist/api/endpoints/utils.d.ts.map +1 -0
- package/dist/api/errors/ApiPackageError.d.ts +101 -0
- package/dist/api/errors/ApiPackageError.d.ts.map +1 -0
- package/dist/api/errors/definitions.d.ts +24 -0
- package/dist/api/errors/definitions.d.ts.map +1 -0
- package/dist/api/errors/error-codes.d.ts +116 -0
- package/dist/api/errors/error-codes.d.ts.map +1 -0
- package/dist/api/errors/error-events.d.ts +63 -0
- package/dist/api/errors/error-events.d.ts.map +1 -0
- package/dist/api/errors/index.d.ts +18 -0
- package/dist/api/errors/index.d.ts.map +1 -0
- package/dist/api/errors/types-constants.d.ts +64 -0
- package/dist/api/errors/types-constants.d.ts.map +1 -0
- package/dist/api/events/EventManager.d.ts +230 -0
- package/dist/api/events/EventManager.d.ts.map +1 -0
- package/dist/api/events/factories/base.d.ts +269 -0
- package/dist/api/events/factories/base.d.ts.map +1 -0
- package/dist/api/events/factories/cache.d.ts +31 -0
- package/dist/api/events/factories/cache.d.ts.map +1 -0
- package/dist/api/events/factories/client.d.ts +43 -0
- package/dist/api/events/factories/client.d.ts.map +1 -0
- package/dist/api/events/factories/config.d.ts +34 -0
- package/dist/api/events/factories/config.d.ts.map +1 -0
- package/dist/api/events/factories/debug.d.ts +74 -0
- package/dist/api/events/factories/debug.d.ts.map +1 -0
- package/dist/api/events/factories/errors.d.ts +91 -0
- package/dist/api/events/factories/errors.d.ts.map +1 -0
- package/dist/api/events/factories/headers.d.ts +54 -0
- package/dist/api/events/factories/headers.d.ts.map +1 -0
- package/dist/api/events/factories/index.d.ts +46 -0
- package/dist/api/events/factories/index.d.ts.map +1 -0
- package/dist/api/events/factories/network.d.ts +54 -0
- package/dist/api/events/factories/network.d.ts.map +1 -0
- package/dist/api/events/factories/performance.d.ts +43 -0
- package/dist/api/events/factories/performance.d.ts.map +1 -0
- package/dist/api/events/index.d.ts +34 -0
- package/dist/api/events/index.d.ts.map +1 -0
- package/dist/api/events/namespaces.d.ts +464 -0
- package/dist/api/events/namespaces.d.ts.map +1 -0
- package/dist/api/events/queue/ConfigUpdateQueueManager.d.ts +53 -0
- package/dist/api/events/queue/ConfigUpdateQueueManager.d.ts.map +1 -0
- package/dist/api/events/queue/EventQueueManager.d.ts +69 -0
- package/dist/api/events/queue/EventQueueManager.d.ts.map +1 -0
- package/dist/api/events/queue/index.d.ts +12 -0
- package/dist/api/events/queue/index.d.ts.map +1 -0
- package/dist/api/events/shared-emitter.d.ts +14 -0
- package/dist/api/events/shared-emitter.d.ts.map +1 -0
- package/dist/api/headers/cache.d.ts +17 -0
- package/dist/api/headers/cache.d.ts.map +1 -0
- package/dist/api/headers/enriched.d.ts +18 -0
- package/dist/api/headers/enriched.d.ts.map +1 -0
- package/dist/api/headers/events.d.ts +17 -0
- package/dist/api/headers/events.d.ts.map +1 -0
- package/dist/api/headers/extract.d.ts +73 -0
- package/dist/api/headers/extract.d.ts.map +1 -0
- package/dist/api/headers/headerBuilder.d.ts +308 -0
- package/dist/api/headers/headerBuilder.d.ts.map +1 -0
- package/dist/api/headers/index.d.ts +37 -0
- package/dist/api/headers/index.d.ts.map +1 -0
- package/dist/api/headers/merge.d.ts +32 -0
- package/dist/api/headers/merge.d.ts.map +1 -0
- package/dist/api/headers/presets.d.ts +24 -0
- package/dist/api/headers/presets.d.ts.map +1 -0
- package/dist/api/headers/utils.d.ts +38 -0
- package/dist/api/headers/utils.d.ts.map +1 -0
- package/dist/api/hooks/factories/createApiMutation.d.ts +57 -0
- package/dist/api/hooks/factories/createApiMutation.d.ts.map +1 -0
- package/dist/api/hooks/factories/createApiQuery.d.ts +55 -0
- package/dist/api/hooks/factories/createApiQuery.d.ts.map +1 -0
- package/dist/api/hooks/factories/defaults.d.ts +15 -0
- package/dist/api/hooks/factories/defaults.d.ts.map +1 -0
- package/dist/api/hooks/factories/index.d.ts +8 -0
- package/dist/api/hooks/factories/index.d.ts.map +1 -0
- package/dist/api/hooks/index.d.ts +11 -0
- package/dist/api/hooks/index.d.ts.map +1 -0
- package/dist/api/hooks/types.d.ts +82 -0
- package/dist/api/hooks/types.d.ts.map +1 -0
- package/dist/api/hooks/useApiConfigConflicts.d.ts +24 -0
- package/dist/api/hooks/useApiConfigConflicts.d.ts.map +1 -0
- package/dist/api/hooks/useApiDebugInfo.d.ts +24 -0
- package/dist/api/hooks/useApiDebugInfo.d.ts.map +1 -0
- package/dist/api/hooks/useApiMonitor.d.ts +25 -0
- package/dist/api/hooks/useApiMonitor.d.ts.map +1 -0
- package/dist/api/hooks/useApiNetworkQuality.d.ts +21 -0
- package/dist/api/hooks/useApiNetworkQuality.d.ts.map +1 -0
- package/dist/api/index.d.ts +26 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/network/adaptive.d.ts +56 -0
- package/dist/api/network/adaptive.d.ts.map +1 -0
- package/dist/api/network/client-hints.d.ts +25 -0
- package/dist/api/network/client-hints.d.ts.map +1 -0
- package/dist/api/network/connection.d.ts +60 -0
- package/dist/api/network/connection.d.ts.map +1 -0
- package/dist/api/network/core.d.ts +26 -0
- package/dist/api/network/core.d.ts.map +1 -0
- package/dist/api/network/events.d.ts +18 -0
- package/dist/api/network/events.d.ts.map +1 -0
- package/dist/api/network/frameworks/express.d.ts +110 -0
- package/dist/api/network/frameworks/express.d.ts.map +1 -0
- package/dist/api/network/frameworks/index.d.ts +13 -0
- package/dist/api/network/frameworks/index.d.ts.map +1 -0
- package/dist/api/network/frameworks/nestjs/clientHintsInterceptor.d.ts +29 -0
- package/dist/api/network/frameworks/nestjs/clientHintsInterceptor.d.ts.map +1 -0
- package/dist/api/network/frameworks/nestjs/decorators.d.ts +48 -0
- package/dist/api/network/frameworks/nestjs/decorators.d.ts.map +1 -0
- package/dist/api/network/frameworks/nestjs/enrichedHeadersGuard.d.ts +80 -0
- package/dist/api/network/frameworks/nestjs/enrichedHeadersGuard.d.ts.map +1 -0
- package/dist/api/network/frameworks/nestjs/enrichedHeadersInterceptor.d.ts +83 -0
- package/dist/api/network/frameworks/nestjs/enrichedHeadersInterceptor.d.ts.map +1 -0
- package/dist/api/network/frameworks/nestjs/index.d.ts +13 -0
- package/dist/api/network/frameworks/nestjs/index.d.ts.map +1 -0
- package/dist/api/network/frameworks/nestjs/minimumConnectionGuard.d.ts +27 -0
- package/dist/api/network/frameworks/nestjs/minimumConnectionGuard.d.ts.map +1 -0
- package/dist/api/network/frameworks/nestjs/networkDetectionMiddleware.d.ts +31 -0
- package/dist/api/network/frameworks/nestjs/networkDetectionMiddleware.d.ts.map +1 -0
- package/dist/api/network/frameworks/nestjs/networkGuard.d.ts +33 -0
- package/dist/api/network/frameworks/nestjs/networkGuard.d.ts.map +1 -0
- package/dist/api/network/frameworks/nestjs/noDataSaverGuard.d.ts +25 -0
- package/dist/api/network/frameworks/nestjs/noDataSaverGuard.d.ts.map +1 -0
- package/dist/api/network/frameworks/nextjs.d.ts +86 -0
- package/dist/api/network/frameworks/nextjs.d.ts.map +1 -0
- package/dist/api/network/frameworks/shared.d.ts +45 -0
- package/dist/api/network/frameworks/shared.d.ts.map +1 -0
- package/dist/api/network/headers.d.ts +112 -0
- package/dist/api/network/headers.d.ts.map +1 -0
- package/dist/api/network/index.d.ts +17 -0
- package/dist/api/network/index.d.ts.map +1 -0
- package/dist/api/network/networkConfigurationManager.d.ts +225 -0
- package/dist/api/network/networkConfigurationManager.d.ts.map +1 -0
- package/dist/api/network/platform.d.ts +171 -0
- package/dist/api/network/platform.d.ts.map +1 -0
- package/dist/api/network/presets.d.ts +55 -0
- package/dist/api/network/presets.d.ts.map +1 -0
- package/dist/api/network/quality.d.ts +28 -0
- package/dist/api/network/quality.d.ts.map +1 -0
- package/dist/api/network/status.d.ts +74 -0
- package/dist/api/network/status.d.ts.map +1 -0
- package/dist/api/performance/adaptive.d.ts +35 -0
- package/dist/api/performance/adaptive.d.ts.map +1 -0
- package/dist/api/performance/index.d.ts +133 -0
- package/dist/api/performance/index.d.ts.map +1 -0
- package/dist/api/performance/patterns.d.ts +20 -0
- package/dist/api/performance/patterns.d.ts.map +1 -0
- package/dist/api/performance/performanceMonitor.d.ts +85 -0
- package/dist/api/performance/performanceMonitor.d.ts.map +1 -0
- package/dist/api/performance/presets.d.ts +18 -0
- package/dist/api/performance/presets.d.ts.map +1 -0
- package/dist/api/performance/utils.d.ts +98 -0
- package/dist/api/performance/utils.d.ts.map +1 -0
- package/dist/api/polling/index.d.ts +10 -0
- package/dist/api/polling/index.d.ts.map +1 -0
- package/dist/api/polling/strategies.d.ts +128 -0
- package/dist/api/polling/strategies.d.ts.map +1 -0
- package/dist/api/polling/utils.d.ts +133 -0
- package/dist/api/polling/utils.d.ts.map +1 -0
- package/dist/api/pubsub/index.d.ts +147 -0
- package/dist/api/pubsub/index.d.ts.map +1 -0
- package/dist/api/pubsub/react.d.ts +214 -0
- package/dist/api/pubsub/react.d.ts.map +1 -0
- package/dist/api/queue/BaseOperationTracker.d.ts +86 -0
- package/dist/api/queue/BaseOperationTracker.d.ts.map +1 -0
- package/dist/api/queue/BaseQueueManager.d.ts +54 -0
- package/dist/api/queue/BaseQueueManager.d.ts.map +1 -0
- package/dist/api/queue/BatchProcessor.d.ts +42 -0
- package/dist/api/queue/BatchProcessor.d.ts.map +1 -0
- package/dist/api/queue/EventQueueManager.d.ts +128 -0
- package/dist/api/queue/EventQueueManager.d.ts.map +1 -0
- package/dist/api/queue/PriorityQueue.d.ts +58 -0
- package/dist/api/queue/PriorityQueue.d.ts.map +1 -0
- package/dist/api/queue/QueueFactory.d.ts +57 -0
- package/dist/api/queue/QueueFactory.d.ts.map +1 -0
- package/dist/api/queue/QueueOrchestrator.d.ts +90 -0
- package/dist/api/queue/QueueOrchestrator.d.ts.map +1 -0
- package/dist/api/queue/QueueSystem.d.ts +102 -0
- package/dist/api/queue/QueueSystem.d.ts.map +1 -0
- package/dist/api/queue/index.d.ts +22 -0
- package/dist/api/queue/index.d.ts.map +1 -0
- package/dist/api/regional/constants.d.ts +76 -0
- package/dist/api/regional/constants.d.ts.map +1 -0
- package/dist/api/regional/core.d.ts +56 -0
- package/dist/api/regional/core.d.ts.map +1 -0
- package/dist/api/regional/helpers.d.ts +49 -0
- package/dist/api/regional/helpers.d.ts.map +1 -0
- package/dist/api/regional/index.d.ts +10 -0
- package/dist/api/regional/index.d.ts.map +1 -0
- package/dist/api/regional/presets.d.ts +16 -0
- package/dist/api/regional/presets.d.ts.map +1 -0
- package/dist/api/request/index.d.ts +18 -0
- package/dist/api/request/index.d.ts.map +1 -0
- package/dist/api/request/management.d.ts +46 -0
- package/dist/api/request/management.d.ts.map +1 -0
- package/dist/api/request/prepare.d.ts +34 -0
- package/dist/api/request/prepare.d.ts.map +1 -0
- package/dist/api/request/react.d.ts +98 -0
- package/dist/api/request/react.d.ts.map +1 -0
- package/dist/api/request/routing.d.ts +74 -0
- package/dist/api/request/routing.d.ts.map +1 -0
- package/dist/api/request/tracker.d.ts +76 -0
- package/dist/api/request/tracker.d.ts.map +1 -0
- package/dist/api/request/utils.d.ts +129 -0
- package/dist/api/request/utils.d.ts.map +1 -0
- package/dist/api/retry/conditions.d.ts +140 -0
- package/dist/api/retry/conditions.d.ts.map +1 -0
- package/dist/api/retry/index.d.ts +10 -0
- package/dist/api/retry/index.d.ts.map +1 -0
- package/dist/api/retry/strategies.d.ts +56 -0
- package/dist/api/retry/strategies.d.ts.map +1 -0
- package/dist/api/revalidation/index.d.ts +29 -0
- package/dist/api/revalidation/index.d.ts.map +1 -0
- package/dist/api/revalidation/presets.d.ts +71 -0
- package/dist/api/revalidation/presets.d.ts.map +1 -0
- package/dist/api/revalidation/strategies.d.ts +116 -0
- package/dist/api/revalidation/strategies.d.ts.map +1 -0
- package/dist/api/revalidation/utils.d.ts +78 -0
- package/dist/api/revalidation/utils.d.ts.map +1 -0
- package/dist/api/services/campaigns/DELETE/deleteCampaign.d.ts +30 -0
- package/dist/api/services/campaigns/DELETE/deleteCampaign.d.ts.map +1 -0
- package/dist/api/services/campaigns/DELETE/index.d.ts +7 -0
- package/dist/api/services/campaigns/DELETE/index.d.ts.map +1 -0
- package/dist/api/services/campaigns/DELETE/useDeleteCampaign.d.ts +24 -0
- package/dist/api/services/campaigns/DELETE/useDeleteCampaign.d.ts.map +1 -0
- package/dist/api/services/campaigns/GET/fetchCampaign.d.ts +36 -0
- package/dist/api/services/campaigns/GET/fetchCampaign.d.ts.map +1 -0
- package/dist/api/services/campaigns/GET/fetchCampaignParticipants.d.ts +40 -0
- package/dist/api/services/campaigns/GET/fetchCampaignParticipants.d.ts.map +1 -0
- package/dist/api/services/campaigns/GET/fetchCampaignStats.d.ts +31 -0
- package/dist/api/services/campaigns/GET/fetchCampaignStats.d.ts.map +1 -0
- package/dist/api/services/campaigns/GET/fetchCampaigns.d.ts +39 -0
- package/dist/api/services/campaigns/GET/fetchCampaigns.d.ts.map +1 -0
- package/dist/api/services/campaigns/GET/index.d.ts +13 -0
- package/dist/api/services/campaigns/GET/index.d.ts.map +1 -0
- package/dist/api/services/campaigns/GET/useCampaign.d.ts +47 -0
- package/dist/api/services/campaigns/GET/useCampaign.d.ts.map +1 -0
- package/dist/api/services/campaigns/GET/useCampaignParticipants.d.ts +43 -0
- package/dist/api/services/campaigns/GET/useCampaignParticipants.d.ts.map +1 -0
- package/dist/api/services/campaigns/GET/useCampaignStats.d.ts +33 -0
- package/dist/api/services/campaigns/GET/useCampaignStats.d.ts.map +1 -0
- package/dist/api/services/campaigns/GET/useCampaigns.d.ts +43 -0
- package/dist/api/services/campaigns/GET/useCampaigns.d.ts.map +1 -0
- package/dist/api/services/campaigns/POST/createCampaign.d.ts +37 -0
- package/dist/api/services/campaigns/POST/createCampaign.d.ts.map +1 -0
- package/dist/api/services/campaigns/POST/index.d.ts +11 -0
- package/dist/api/services/campaigns/POST/index.d.ts.map +1 -0
- package/dist/api/services/campaigns/POST/joinCampaign.d.ts +31 -0
- package/dist/api/services/campaigns/POST/joinCampaign.d.ts.map +1 -0
- package/dist/api/services/campaigns/POST/leaveCampaign.d.ts +31 -0
- package/dist/api/services/campaigns/POST/leaveCampaign.d.ts.map +1 -0
- package/dist/api/services/campaigns/POST/useCreateCampaign.d.ts +36 -0
- package/dist/api/services/campaigns/POST/useCreateCampaign.d.ts.map +1 -0
- package/dist/api/services/campaigns/POST/useJoinCampaign.d.ts +23 -0
- package/dist/api/services/campaigns/POST/useJoinCampaign.d.ts.map +1 -0
- package/dist/api/services/campaigns/POST/useLeaveCampaign.d.ts +23 -0
- package/dist/api/services/campaigns/POST/useLeaveCampaign.d.ts.map +1 -0
- package/dist/api/services/campaigns/PUT/index.d.ts +7 -0
- package/dist/api/services/campaigns/PUT/index.d.ts.map +1 -0
- package/dist/api/services/campaigns/PUT/updateCampaign.d.ts +37 -0
- package/dist/api/services/campaigns/PUT/updateCampaign.d.ts.map +1 -0
- package/dist/api/services/campaigns/PUT/useUpdateCampaign.d.ts +38 -0
- package/dist/api/services/campaigns/PUT/useUpdateCampaign.d.ts.map +1 -0
- package/dist/api/services/campaigns/index.d.ts +9 -0
- package/dist/api/services/campaigns/index.d.ts.map +1 -0
- package/dist/api/services/clients.d.ts +58 -0
- package/dist/api/services/clients.d.ts.map +1 -0
- package/dist/api/services/index.d.ts +7 -0
- package/dist/api/services/index.d.ts.map +1 -0
- package/dist/api/strategies/index.d.ts +8 -0
- package/dist/api/strategies/index.d.ts.map +1 -0
- package/dist/api/strategies/tracked.d.ts +15 -0
- package/dist/api/strategies/tracked.d.ts.map +1 -0
- package/dist/api/strategies/unified.d.ts +87 -0
- package/dist/api/strategies/unified.d.ts.map +1 -0
- package/dist/api/utils/async-control.d.ts +96 -0
- package/dist/api/utils/async-control.d.ts.map +1 -0
- package/dist/api/utils/colors.d.ts +88 -0
- package/dist/api/utils/colors.d.ts.map +1 -0
- package/dist/api/utils/environment.d.ts +595 -0
- package/dist/api/utils/environment.d.ts.map +1 -0
- package/dist/api/utils/generation/correlation-id.d.ts +206 -0
- package/dist/api/utils/generation/correlation-id.d.ts.map +1 -0
- package/dist/api/utils/generation/id-generator.d.ts +133 -0
- package/dist/api/utils/generation/id-generator.d.ts.map +1 -0
- package/dist/api/utils/generation/request-id.d.ts +106 -0
- package/dist/api/utils/generation/request-id.d.ts.map +1 -0
- package/dist/api/utils/index.d.ts +19 -0
- package/dist/api/utils/index.d.ts.map +1 -0
- package/dist/api/utils/interval-manager.d.ts +94 -0
- package/dist/api/utils/interval-manager.d.ts.map +1 -0
- package/dist/api/utils/json.d.ts +98 -0
- package/dist/api/utils/json.d.ts.map +1 -0
- package/dist/api/utils/math.d.ts +168 -0
- package/dist/api/utils/math.d.ts.map +1 -0
- package/dist/api/utils/object-merge.d.ts +34 -0
- package/dist/api/utils/object-merge.d.ts.map +1 -0
- package/dist/api/utils/object.d.ts +101 -0
- package/dist/api/utils/object.d.ts.map +1 -0
- package/dist/api/utils/string.d.ts +41 -0
- package/dist/api/utils/string.d.ts.map +1 -0
- package/dist/api/utils/time.d.ts +233 -0
- package/dist/api/utils/time.d.ts.map +1 -0
- package/dist/api/utils/type-guards.d.ts +59 -0
- package/dist/api/utils/type-guards.d.ts.map +1 -0
- package/dist/api/utils/validation.d.ts +21 -0
- package/dist/api/utils/validation.d.ts.map +1 -0
- package/dist/index.cjs +25594 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +25068 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -6
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Endpoint URL Builders
|
|
3
|
+
* Advanced utilities for building URLs and cache keys from endpoints
|
|
4
|
+
*/
|
|
5
|
+
import { endpoints } from './index';
|
|
6
|
+
export type EndpointName = keyof typeof endpoints;
|
|
7
|
+
/**
|
|
8
|
+
* Query parameters type - matches fetchff's flexible param handling
|
|
9
|
+
* Supports objects, URLSearchParams, and arrays of name-value pairs
|
|
10
|
+
*/
|
|
11
|
+
export type QueryParams = Record<string, string | number | boolean | string[] | number[]> | URLSearchParams | Array<[string, string]>;
|
|
12
|
+
/**
|
|
13
|
+
* Generate cache key from endpoint name
|
|
14
|
+
*
|
|
15
|
+
* @param endpoint - The endpoint name
|
|
16
|
+
* @param params - Optional path and query parameters
|
|
17
|
+
* @returns Cache key string
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* endpointCacheKey('getCampaign', { pathParams: { id: '123' } }) // '/campaigns/123'
|
|
21
|
+
* endpointCacheKey('listCampaigns', { queryParams: { status: 'active' } }) // '/campaigns:{"status":"active"}'
|
|
22
|
+
*/
|
|
23
|
+
export declare function endpointCacheKey(endpoint: EndpointName, params?: {
|
|
24
|
+
pathParams?: Record<string, string | number>;
|
|
25
|
+
queryParams?: QueryParams;
|
|
26
|
+
}): string;
|
|
27
|
+
/**
|
|
28
|
+
* Generate pattern for cache invalidation
|
|
29
|
+
*
|
|
30
|
+
* @param endpoint - The endpoint name
|
|
31
|
+
* @param wildcardParam - Optional specific parameter to wildcard
|
|
32
|
+
* @returns Pattern string with wildcards
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* endpointCachePattern('getCampaign') // '/campaigns/*'
|
|
36
|
+
* endpointCachePattern('getCampaignStats', 'id') // '/campaigns/*\/stats'
|
|
37
|
+
*/
|
|
38
|
+
export declare function endpointCachePattern(endpoint: EndpointName, wildcardParam?: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Find endpoints by URL pattern
|
|
41
|
+
*
|
|
42
|
+
* @param pattern - RegExp pattern to match against URLs
|
|
43
|
+
* @returns Array of matching endpoints with their configs
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* findEndpointsByPattern(/^\/campaigns/) // All campaign endpoints
|
|
47
|
+
*/
|
|
48
|
+
export declare function findEndpointsByPattern(pattern: RegExp): Array<{
|
|
49
|
+
name: EndpointName;
|
|
50
|
+
url: string;
|
|
51
|
+
method?: string;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Get all endpoints by HTTP method
|
|
55
|
+
*
|
|
56
|
+
* @param method - HTTP method (GET, POST, etc.)
|
|
57
|
+
* @returns Array of endpoints using that method
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* getEndpointsByMethod('GET') // All GET endpoints
|
|
61
|
+
* getEndpointsByMethod('POST') // All POST endpoints
|
|
62
|
+
*/
|
|
63
|
+
export declare function getEndpointsByMethod(method: string): Array<{
|
|
64
|
+
name: EndpointName;
|
|
65
|
+
url: string;
|
|
66
|
+
method?: string;
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* Endpoint-based cache key patterns
|
|
70
|
+
* Predefined patterns for common cache invalidation scenarios
|
|
71
|
+
*/
|
|
72
|
+
export declare const endpointCachePatterns: {
|
|
73
|
+
allCampaigns: () => string;
|
|
74
|
+
campaignById: (id: string) => string;
|
|
75
|
+
campaignsByPattern: () => string;
|
|
76
|
+
campaignStats: (id: string) => string;
|
|
77
|
+
all: () => string;
|
|
78
|
+
byEndpoint: (endpoint: EndpointName) => string;
|
|
79
|
+
custom: (pattern: string) => string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Build full request URL including base URL and query parameters
|
|
83
|
+
*
|
|
84
|
+
* @param endpoint - The endpoint name
|
|
85
|
+
* @param baseURL - Base URL of the API
|
|
86
|
+
* @param params - Path and query parameters
|
|
87
|
+
* @returns Full URL string
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* buildFullUrl('getCampaign', 'https://api.example.com', { pathParams: { id: '123' } })
|
|
91
|
+
* // 'https://api.example.com/campaigns/123'
|
|
92
|
+
*/
|
|
93
|
+
export declare function buildFullUrl(endpoint: EndpointName, baseURL: string, params?: {
|
|
94
|
+
pathParams?: Record<string, string | number>;
|
|
95
|
+
queryParams?: QueryParams;
|
|
96
|
+
}): string;
|
|
97
|
+
/**
|
|
98
|
+
* Validate that all required path parameters are provided
|
|
99
|
+
*
|
|
100
|
+
* @param endpoint - The endpoint name
|
|
101
|
+
* @param pathParams - Provided path parameters
|
|
102
|
+
* @returns True if all required params are provided
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* validatePathParams('getCampaign', { id: '123' }) // true
|
|
106
|
+
* validatePathParams('getCampaign', {}) // false
|
|
107
|
+
*/
|
|
108
|
+
export declare function validatePathParams(endpoint: EndpointName, pathParams?: Record<string, string | number | undefined>): boolean;
|
|
109
|
+
//# sourceMappingURL=builders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../../src/api/endpoints/builders.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGpC,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,SAAS,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,WAAW,GACnB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,GAC/D,eAAe,GACf,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE5B;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,YAAY,EACtB,MAAM,CAAC,EAAE;IACP,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7C,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,GACA,MAAM,CAqBR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,YAAY,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAU3F;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC;IAC7D,IAAI,EAAE,YAAY,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC,CAOD;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;IAC1D,IAAI,EAAE,YAAY,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC,CAQD;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB;wBAEd,MAAM;uBACL,MAAM,KAAG,MAAM;8BAIV,MAAM;wBACV,MAAM,KAAG,MAAM;eAM1B,MAAM;2BACQ,YAAY,KAAG,MAAM;sBAG1B,MAAM,KAAG,MAAM;CAClC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE;IACP,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7C,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,GACA,MAAM,CAqCR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,YAAY,EACtB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,GACvD,OAAO,CAiBT"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Campaign endpoints configuration
|
|
3
|
+
* Each endpoint can override ALL global settings
|
|
4
|
+
*/
|
|
5
|
+
export declare const campaignEndpoints: {
|
|
6
|
+
readonly getCampaign: {
|
|
7
|
+
readonly url: "/campaigns/:id";
|
|
8
|
+
readonly method: "GET";
|
|
9
|
+
};
|
|
10
|
+
readonly listCampaigns: {
|
|
11
|
+
readonly url: "/campaigns";
|
|
12
|
+
readonly method: "GET";
|
|
13
|
+
};
|
|
14
|
+
readonly createCampaign: {
|
|
15
|
+
readonly url: "/campaigns";
|
|
16
|
+
readonly method: "POST";
|
|
17
|
+
};
|
|
18
|
+
readonly updateCampaign: {
|
|
19
|
+
readonly url: "/campaigns/:id";
|
|
20
|
+
readonly method: "PUT";
|
|
21
|
+
};
|
|
22
|
+
readonly deleteCampaign: {
|
|
23
|
+
readonly url: "/campaigns/:id";
|
|
24
|
+
readonly method: "DELETE";
|
|
25
|
+
};
|
|
26
|
+
readonly getCampaignStats: {
|
|
27
|
+
readonly url: "/campaigns/:id/stats";
|
|
28
|
+
readonly method: "GET";
|
|
29
|
+
};
|
|
30
|
+
readonly getCampaignParticipants: {
|
|
31
|
+
readonly url: "/campaigns/:id/participants";
|
|
32
|
+
readonly method: "GET";
|
|
33
|
+
};
|
|
34
|
+
readonly joinCampaign: {
|
|
35
|
+
readonly url: "/campaigns/:id/join";
|
|
36
|
+
readonly method: "POST";
|
|
37
|
+
};
|
|
38
|
+
readonly leaveCampaign: {
|
|
39
|
+
readonly url: "/campaigns/:id/leave";
|
|
40
|
+
readonly method: "POST";
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=campaigns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaigns.d.ts","sourceRoot":"","sources":["../../../src/api/endpoints/campaigns.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CpB,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Combined Endpoints Configuration
|
|
3
|
+
* Aggregates all endpoint configurations with their types
|
|
4
|
+
*/
|
|
5
|
+
import { campaignEndpoints } from './campaigns';
|
|
6
|
+
import { pollingEndpoints } from './polling';
|
|
7
|
+
/**
|
|
8
|
+
* All API endpoints combined
|
|
9
|
+
* This is passed to createApiClient to generate endpoint methods
|
|
10
|
+
*/
|
|
11
|
+
export declare const endpoints: {
|
|
12
|
+
readonly getJobStatus: {
|
|
13
|
+
readonly url: "/jobs/:jobId";
|
|
14
|
+
readonly method: "GET";
|
|
15
|
+
};
|
|
16
|
+
readonly startJob: {
|
|
17
|
+
readonly url: "/jobs";
|
|
18
|
+
readonly method: "POST";
|
|
19
|
+
};
|
|
20
|
+
readonly cancelJob: {
|
|
21
|
+
readonly url: "/jobs/:jobId/cancel";
|
|
22
|
+
readonly method: "POST";
|
|
23
|
+
};
|
|
24
|
+
readonly healthCheck: {
|
|
25
|
+
readonly url: "/health";
|
|
26
|
+
readonly method: "GET";
|
|
27
|
+
};
|
|
28
|
+
readonly getLiveData: {
|
|
29
|
+
readonly url: "/live-data";
|
|
30
|
+
readonly method: "GET";
|
|
31
|
+
};
|
|
32
|
+
readonly getDashboardMetrics: {
|
|
33
|
+
readonly url: "/dashboard/metrics";
|
|
34
|
+
readonly method: "GET";
|
|
35
|
+
};
|
|
36
|
+
readonly startSync: {
|
|
37
|
+
readonly url: "/sync";
|
|
38
|
+
readonly method: "POST";
|
|
39
|
+
};
|
|
40
|
+
readonly getSyncStatus: {
|
|
41
|
+
readonly url: "/sync/:syncId";
|
|
42
|
+
readonly method: "GET";
|
|
43
|
+
};
|
|
44
|
+
readonly getResourceStatus: {
|
|
45
|
+
readonly url: "/resources/:resourceId";
|
|
46
|
+
readonly method: "GET";
|
|
47
|
+
};
|
|
48
|
+
readonly reserveResource: {
|
|
49
|
+
readonly url: "/resources/:resourceId/reserve";
|
|
50
|
+
readonly method: "POST";
|
|
51
|
+
};
|
|
52
|
+
readonly getCampaign: {
|
|
53
|
+
readonly url: "/campaigns/:id";
|
|
54
|
+
readonly method: "GET";
|
|
55
|
+
};
|
|
56
|
+
readonly listCampaigns: {
|
|
57
|
+
readonly url: "/campaigns";
|
|
58
|
+
readonly method: "GET";
|
|
59
|
+
};
|
|
60
|
+
readonly createCampaign: {
|
|
61
|
+
readonly url: "/campaigns";
|
|
62
|
+
readonly method: "POST";
|
|
63
|
+
};
|
|
64
|
+
readonly updateCampaign: {
|
|
65
|
+
readonly url: "/campaigns/:id";
|
|
66
|
+
readonly method: "PUT";
|
|
67
|
+
};
|
|
68
|
+
readonly deleteCampaign: {
|
|
69
|
+
readonly url: "/campaigns/:id";
|
|
70
|
+
readonly method: "DELETE";
|
|
71
|
+
};
|
|
72
|
+
readonly getCampaignStats: {
|
|
73
|
+
readonly url: "/campaigns/:id/stats";
|
|
74
|
+
readonly method: "GET";
|
|
75
|
+
};
|
|
76
|
+
readonly getCampaignParticipants: {
|
|
77
|
+
readonly url: "/campaigns/:id/participants";
|
|
78
|
+
readonly method: "GET";
|
|
79
|
+
};
|
|
80
|
+
readonly joinCampaign: {
|
|
81
|
+
readonly url: "/campaigns/:id/join";
|
|
82
|
+
readonly method: "POST";
|
|
83
|
+
};
|
|
84
|
+
readonly leaveCampaign: {
|
|
85
|
+
readonly url: "/campaigns/:id/leave";
|
|
86
|
+
readonly method: "POST";
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
export type EndpointsList = typeof endpoints;
|
|
90
|
+
/**
|
|
91
|
+
* Export individual endpoint groups for selective imports
|
|
92
|
+
*/
|
|
93
|
+
export { campaignEndpoints };
|
|
94
|
+
export { pollingEndpoints };
|
|
95
|
+
/**
|
|
96
|
+
* Export endpoint utilities
|
|
97
|
+
*/
|
|
98
|
+
export { getEndpointUrl, getAllEndpointUrls, hasEndpoint, getEndpointConfig, buildEndpointUrl, getEndpointParams, hasPathParams, getEndpointMetadata, buildUrl, extractUrlParams, } from './utils';
|
|
99
|
+
export { endpointCacheKey, endpointCachePattern, findEndpointsByPattern, getEndpointsByMethod, endpointCachePatterns, buildFullUrl, validatePathParams, } from './builders';
|
|
100
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/endpoints/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIZ,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,OAAO,SAAS,CAAC;AAE7C;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B;;GAEG;AACH,OAAO,EAEL,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,QAAQ,EACR,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAEL,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,YAAY,EACZ,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example endpoint configurations that work with polling strategies
|
|
3
|
+
* These show how to properly configure endpoints for different polling scenarios
|
|
4
|
+
*/
|
|
5
|
+
export declare const pollingEndpoints: {
|
|
6
|
+
readonly getJobStatus: {
|
|
7
|
+
readonly url: "/jobs/:jobId";
|
|
8
|
+
readonly method: "GET";
|
|
9
|
+
};
|
|
10
|
+
readonly startJob: {
|
|
11
|
+
readonly url: "/jobs";
|
|
12
|
+
readonly method: "POST";
|
|
13
|
+
};
|
|
14
|
+
readonly cancelJob: {
|
|
15
|
+
readonly url: "/jobs/:jobId/cancel";
|
|
16
|
+
readonly method: "POST";
|
|
17
|
+
};
|
|
18
|
+
readonly healthCheck: {
|
|
19
|
+
readonly url: "/health";
|
|
20
|
+
readonly method: "GET";
|
|
21
|
+
};
|
|
22
|
+
readonly getLiveData: {
|
|
23
|
+
readonly url: "/live-data";
|
|
24
|
+
readonly method: "GET";
|
|
25
|
+
};
|
|
26
|
+
readonly getDashboardMetrics: {
|
|
27
|
+
readonly url: "/dashboard/metrics";
|
|
28
|
+
readonly method: "GET";
|
|
29
|
+
};
|
|
30
|
+
readonly startSync: {
|
|
31
|
+
readonly url: "/sync";
|
|
32
|
+
readonly method: "POST";
|
|
33
|
+
};
|
|
34
|
+
readonly getSyncStatus: {
|
|
35
|
+
readonly url: "/sync/:syncId";
|
|
36
|
+
readonly method: "GET";
|
|
37
|
+
};
|
|
38
|
+
readonly getResourceStatus: {
|
|
39
|
+
readonly url: "/resources/:resourceId";
|
|
40
|
+
readonly method: "GET";
|
|
41
|
+
};
|
|
42
|
+
readonly reserveResource: {
|
|
43
|
+
readonly url: "/resources/:resourceId/reserve";
|
|
44
|
+
readonly method: "POST";
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Example usage with fetchff and polling:
|
|
49
|
+
*
|
|
50
|
+
* ```typescript
|
|
51
|
+
* import { createApiFetcher } from 'fetchff';
|
|
52
|
+
* import type { PollingEndpointTypes } from './polling';
|
|
53
|
+
*
|
|
54
|
+
* const api = createApiFetcher<PollingEndpointTypes>({
|
|
55
|
+
* baseURL: 'https://api.example.com',
|
|
56
|
+
* endpoints: pollingEndpoints,
|
|
57
|
+
* });
|
|
58
|
+
*
|
|
59
|
+
* // Start a job and poll for completion
|
|
60
|
+
* const { data: job } = await api.startJob({
|
|
61
|
+
* body: { type: 'export', parameters: { format: 'csv' } }
|
|
62
|
+
* });
|
|
63
|
+
*
|
|
64
|
+
* // Poll job status using the jobStatus strategy
|
|
65
|
+
* const { data: result } = await api.getJobStatus({
|
|
66
|
+
* urlPathParams: { jobId: job.jobId },
|
|
67
|
+
* polling: 'jobStatus', // Uses our preset strategy
|
|
68
|
+
* });
|
|
69
|
+
*
|
|
70
|
+
* // Or with custom polling
|
|
71
|
+
* const { data: result } = await api.getJobStatus({
|
|
72
|
+
* urlPathParams: { jobId: job.jobId },
|
|
73
|
+
* polling: {
|
|
74
|
+
* interval: 3000,
|
|
75
|
+
* shouldStop: (response) => {
|
|
76
|
+
* const status = response.data?.status;
|
|
77
|
+
* return status === 'completed' || status === 'failed';
|
|
78
|
+
* }
|
|
79
|
+
* }
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
//# sourceMappingURL=polling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polling.d.ts","sourceRoot":"","sources":["../../../src/api/endpoints/polling.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoEnB,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Endpoint URL Utilities
|
|
3
|
+
* Lightweight helpers for working with endpoint definitions
|
|
4
|
+
*/
|
|
5
|
+
import { endpoints } from './index';
|
|
6
|
+
export type EndpointName = keyof typeof endpoints;
|
|
7
|
+
/**
|
|
8
|
+
* Get endpoint URL by name
|
|
9
|
+
*
|
|
10
|
+
* @param name - The endpoint name
|
|
11
|
+
* @returns The endpoint URL template
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* getEndpointUrl('getCampaign') // '/campaigns/:id'
|
|
15
|
+
*/
|
|
16
|
+
export declare function getEndpointUrl(name: EndpointName): string;
|
|
17
|
+
/**
|
|
18
|
+
* Get all endpoint URLs as a record
|
|
19
|
+
*
|
|
20
|
+
* @returns Record of endpoint names to URLs
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* getAllEndpointUrls() // { getCampaign: '/campaigns/:id', ... }
|
|
24
|
+
*/
|
|
25
|
+
export declare function getAllEndpointUrls(): Record<EndpointName, string>;
|
|
26
|
+
/**
|
|
27
|
+
* Check if endpoint exists
|
|
28
|
+
*
|
|
29
|
+
* @param name - The endpoint name to check
|
|
30
|
+
* @returns True if endpoint exists
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* hasEndpoint('getCampaign') // true
|
|
34
|
+
* hasEndpoint('invalid') // false
|
|
35
|
+
*/
|
|
36
|
+
export declare function hasEndpoint(name: string): name is EndpointName;
|
|
37
|
+
/**
|
|
38
|
+
* Get endpoint config (url, method, etc.)
|
|
39
|
+
*
|
|
40
|
+
* @param name - The endpoint name
|
|
41
|
+
* @returns The full endpoint configuration
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* getEndpointConfig('getCampaign') // { url: '/campaigns/:id', method: 'GET' }
|
|
45
|
+
*/
|
|
46
|
+
export declare function getEndpointConfig(name: EndpointName): {
|
|
47
|
+
url: string;
|
|
48
|
+
method?: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Build a URL with path parameters replaced
|
|
52
|
+
*
|
|
53
|
+
* @param endpoint - The endpoint name
|
|
54
|
+
* @param pathParams - Path parameters to replace
|
|
55
|
+
* @returns URL with parameters replaced
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* buildEndpointUrl('getCampaign', { id: '123' }) // '/campaigns/123'
|
|
59
|
+
*/
|
|
60
|
+
export declare function buildEndpointUrl(endpoint: EndpointName, pathParams?: Record<string, string | number>): string;
|
|
61
|
+
/**
|
|
62
|
+
* Extract path parameters from an endpoint
|
|
63
|
+
*
|
|
64
|
+
* @param endpoint - The endpoint name
|
|
65
|
+
* @returns Array of parameter names
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* getEndpointParams('getCampaign') // ['id']
|
|
69
|
+
* getEndpointParams('getCampaignStats') // ['id']
|
|
70
|
+
*/
|
|
71
|
+
export declare function getEndpointParams(endpoint: EndpointName): string[];
|
|
72
|
+
/**
|
|
73
|
+
* Check if endpoint requires path parameters
|
|
74
|
+
*
|
|
75
|
+
* @param endpoint - The endpoint name
|
|
76
|
+
* @returns True if endpoint has path parameters
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* hasPathParams('getCampaign') // true
|
|
80
|
+
* hasPathParams('listCampaigns') // false
|
|
81
|
+
*/
|
|
82
|
+
export declare function hasPathParams(endpoint: EndpointName): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Get endpoint metadata
|
|
85
|
+
*
|
|
86
|
+
* @param endpoint - The endpoint name
|
|
87
|
+
* @returns Metadata about the endpoint
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* getEndpointMetadata('getCampaign')
|
|
91
|
+
* // { name: 'getCampaign', url: '/campaigns/:id', method: 'GET', hasParams: true, params: ['id'], config: {...} }
|
|
92
|
+
*/
|
|
93
|
+
export declare function getEndpointMetadata(endpoint: EndpointName): {
|
|
94
|
+
name: EndpointName;
|
|
95
|
+
url: string;
|
|
96
|
+
method: string;
|
|
97
|
+
hasParams: boolean;
|
|
98
|
+
params: string[];
|
|
99
|
+
config: {
|
|
100
|
+
url: string;
|
|
101
|
+
method?: string;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Build URL from a URL template with parameters
|
|
106
|
+
* Generic helper for any URL template
|
|
107
|
+
*
|
|
108
|
+
* @param url - URL template with :param placeholders
|
|
109
|
+
* @param params - Parameters to replace
|
|
110
|
+
* @returns URL with parameters replaced
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* buildUrl('/users/:id', { id: '123' }) // '/users/123'
|
|
114
|
+
* buildUrl('/posts/:postId/comments/:commentId', { postId: '1', commentId: '2' }) // '/posts/1/comments/2'
|
|
115
|
+
*/
|
|
116
|
+
export declare function buildUrl(url: string, params?: Record<string, string | number>): string;
|
|
117
|
+
/**
|
|
118
|
+
* Extract parameter names from a URL template
|
|
119
|
+
*
|
|
120
|
+
* @param url - URL template with :param placeholders
|
|
121
|
+
* @returns Array of parameter names
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* extractUrlParams('/users/:id') // ['id']
|
|
125
|
+
* extractUrlParams('/posts/:postId/comments/:commentId') // ['postId', 'commentId']
|
|
126
|
+
*/
|
|
127
|
+
export declare function extractUrlParams(url: string): string[];
|
|
128
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/api/endpoints/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,SAAS,CAAC;AAElD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAEzD;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAQjE;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,YAAY,CAE9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,GAAG;IACrD,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAEA;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,YAAY,EACtB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAC3C,MAAM,CAUR;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,EAAE,CAIlE;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAE7D;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG;IAC3D,IAAI,EAAE,YAAY,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAUA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAStF;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAGtD"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main error class for @plyaz/api package
|
|
3
|
+
*/
|
|
4
|
+
import type { ResponseError, RequestConfig } from 'fetchff';
|
|
5
|
+
import type { ApiPackageErrorOptions, ErrorContext, ApiClientInstance, ApiPackageErrorLike, ErrorCategoryValue, ApiErrorCodeValue, StatusCodeValue } from '@plyaz/types/api';
|
|
6
|
+
import type { ErrorResponse, ErrorDetail } from '@plyaz/types';
|
|
7
|
+
import type { EndpointsList } from '../endpoints';
|
|
8
|
+
/**
|
|
9
|
+
* Enhanced error class that implements ErrorResponse interface
|
|
10
|
+
* Wraps fetchff's ResponseError for compatibility
|
|
11
|
+
*/
|
|
12
|
+
export declare class ApiPackageError extends Error implements ApiPackageErrorLike {
|
|
13
|
+
readonly statusCode: StatusCodeValue;
|
|
14
|
+
readonly errorCode: ApiErrorCodeValue;
|
|
15
|
+
readonly message: string;
|
|
16
|
+
readonly errors?: ErrorDetail<unknown, unknown, unknown>[];
|
|
17
|
+
readonly correlationId?: string;
|
|
18
|
+
readonly timestamp: string;
|
|
19
|
+
readonly responseError?: ResponseError;
|
|
20
|
+
readonly category: ErrorCategoryValue;
|
|
21
|
+
readonly cause?: Error;
|
|
22
|
+
readonly context?: ErrorContext;
|
|
23
|
+
readonly requestConfig?: RequestConfig;
|
|
24
|
+
readonly responseData?: ResponseError['response'];
|
|
25
|
+
readonly details?: ErrorDetail<unknown, unknown, unknown>[];
|
|
26
|
+
readonly originalError?: Error;
|
|
27
|
+
readonly metadata?: Record<string, string | number | boolean | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Getter for code property (alias for errorCode)
|
|
30
|
+
* Provides compatibility with standard error patterns
|
|
31
|
+
*/
|
|
32
|
+
get code(): string;
|
|
33
|
+
constructor(message: string, statusCode?: StatusCodeValue | 0, errorCode?: ApiErrorCodeValue, options?: ApiPackageErrorOptions<EndpointsList>);
|
|
34
|
+
/**
|
|
35
|
+
* Resolves the status code from the provided value or error definitions
|
|
36
|
+
*/
|
|
37
|
+
private resolveStatusCode;
|
|
38
|
+
/**
|
|
39
|
+
* Emit error event for this error
|
|
40
|
+
* Can be called with a specific client context or uses global handlers
|
|
41
|
+
*/
|
|
42
|
+
private emitEvent;
|
|
43
|
+
/**
|
|
44
|
+
* Creates an ApiPackageError from a fetchff ResponseError
|
|
45
|
+
*/
|
|
46
|
+
static fromResponseError(responseError: ResponseError, config?: RequestConfig, clientContext?: ApiClientInstance<EndpointsList>): ApiPackageError;
|
|
47
|
+
/**
|
|
48
|
+
* Creates an ApiPackageError from a standard Error
|
|
49
|
+
*/
|
|
50
|
+
static fromError(error: Error, statusCode?: StatusCodeValue | 0, errorCode?: ApiErrorCodeValue, context?: ApiClientInstance<EndpointsList>): ApiPackageError;
|
|
51
|
+
/**
|
|
52
|
+
* Classifies an error and returns appropriate code and status
|
|
53
|
+
*/
|
|
54
|
+
private static classifyError;
|
|
55
|
+
/**
|
|
56
|
+
* Determines appropriate error code from ResponseError by looking up status in ERROR_DEFINITIONS
|
|
57
|
+
*/
|
|
58
|
+
private static determineErrorCode;
|
|
59
|
+
/**
|
|
60
|
+
* Gets a generic error code based on HTTP status range
|
|
61
|
+
*/
|
|
62
|
+
private static getGenericErrorCode;
|
|
63
|
+
/**
|
|
64
|
+
* Gets the error category from ERROR_DEFINITIONS
|
|
65
|
+
*/
|
|
66
|
+
private categorizeError;
|
|
67
|
+
/**
|
|
68
|
+
* Checks if this is a specific category of error
|
|
69
|
+
*/
|
|
70
|
+
isAuthError(): boolean;
|
|
71
|
+
isValidationError(): boolean;
|
|
72
|
+
isNetworkError(): boolean;
|
|
73
|
+
isServerError(): boolean;
|
|
74
|
+
isClientError(): boolean;
|
|
75
|
+
isRetryable(): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Converts to ErrorResponse format (as per task-020)
|
|
78
|
+
*/
|
|
79
|
+
toJSON(): ErrorResponse;
|
|
80
|
+
/**
|
|
81
|
+
* Creates a string representation
|
|
82
|
+
*/
|
|
83
|
+
toString(): string;
|
|
84
|
+
/**
|
|
85
|
+
* Check if error is an ApiPackageError
|
|
86
|
+
*/
|
|
87
|
+
static isApiPackageError(error: Error | ApiPackageError): error is ApiPackageError;
|
|
88
|
+
/**
|
|
89
|
+
* Get user-friendly message for display
|
|
90
|
+
*/
|
|
91
|
+
getUserMessage(): string;
|
|
92
|
+
/**
|
|
93
|
+
* Gets custom user message from error details if available
|
|
94
|
+
*/
|
|
95
|
+
private getCustomUserMessage;
|
|
96
|
+
/**
|
|
97
|
+
* Gets default user message based on error category
|
|
98
|
+
*/
|
|
99
|
+
private getDefaultUserMessage;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=ApiPackageError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiPackageError.d.ts","sourceRoot":"","sources":["../../../src/api/errors/ApiPackageError.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized error definitions mapping for @plyaz/api package
|
|
3
|
+
* Maps error codes to their HTTP status and metadata
|
|
4
|
+
*/
|
|
5
|
+
import type { ErrorDefinitions, ErrorDefinition } from '@plyaz/types/api';
|
|
6
|
+
import { ERROR_CATEGORY } from '@plyaz/types';
|
|
7
|
+
/**
|
|
8
|
+
* Centralized error definitions mapping
|
|
9
|
+
* Maps error codes to their HTTP status and metadata
|
|
10
|
+
*/
|
|
11
|
+
export declare const ERROR_DEFINITIONS: ErrorDefinitions;
|
|
12
|
+
/**
|
|
13
|
+
* Helper function to get error definition by code
|
|
14
|
+
*/
|
|
15
|
+
export declare function getErrorDefinition(errorCode: string): ErrorDefinition | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Helper function to get error code by status
|
|
18
|
+
*/
|
|
19
|
+
export declare function getErrorCodeByStatus(status: number): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Helper function to get category for error code
|
|
22
|
+
*/
|
|
23
|
+
export declare function getErrorCategory(errorCode: string): (typeof ERROR_CATEGORY)[keyof typeof ERROR_CATEGORY];
|
|
24
|
+
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../src/api/errors/definitions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI9C;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,gBA0RtB,CAAC;AAEX;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAEjF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKvE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,GAChB,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAEtD"}
|