@plyaz/types 1.12.4 → 1.13.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.
@@ -3,7 +3,7 @@
3
3
  * Defines the client interface and options
4
4
  */
5
5
  import type { ApiHandlerMethods, FetchResponse, RequestConfig, ResponseError } from 'fetchff';
6
- import type { ApiConfig } from '../config';
6
+ import type { ApiConfig, ConfigState } from '../config';
7
7
  import type { ConfigUpdateStrategy, EventScopeWithTemporary, HandlerStrategy } from '../events';
8
8
  import type { EndpointTypes } from '../endpoints';
9
9
  import type { UnknownRecord } from 'type-fest';
@@ -37,6 +37,65 @@ export type ApiClientOptions = ApiConfig;
37
37
  * Note: Full type definition requires EndpointTypes and endpoints from api package
38
38
  */
39
39
  export type ApiClientInstance<EndpointsList = UnknownRecord> = ApiHandlerMethods<EndpointTypes, EndpointsList>;
40
+ /**
41
+ * Minimal event manager interface for EnhanceClientParams
42
+ * This avoids circular dependency while maintaining type safety
43
+ */
44
+ export interface EventManagerLike<TEventManager = unknown> {
45
+ readonly emitter: TEventManager extends {
46
+ getEmitter(): infer E;
47
+ } ? E : unknown;
48
+ addHandler(event: string, handler: Function | Function[], options?: unknown): () => void;
49
+ updateConfig(updates: Partial<ApiConfig>, options?: unknown): void;
50
+ clearTemporaryOverrides(): void;
51
+ checkConflicts(): ConfigConflict[];
52
+ getDebugInfo(): DebugInfo;
53
+ startMonitoring(): void;
54
+ stopMonitoring(): void;
55
+ isMonitoring(): boolean;
56
+ getEventStats(): {
57
+ totalEvents: number;
58
+ totalListeners: number;
59
+ listenerCount: number;
60
+ recentEvents: Array<{
61
+ type: string;
62
+ timestamp: number;
63
+ data?: unknown;
64
+ }>;
65
+ overrideCount: number;
66
+ eventCountsByType: Record<string, number>;
67
+ };
68
+ getActiveScopes(): EventScopeWithTemporary[];
69
+ emitError(error: ApiPackageErrorLike): void;
70
+ emitRequestStart(config: RequestConfig): void;
71
+ emitResponseReceived<TData = unknown>(response: FetchResponse<TData>): void;
72
+ emitRetryAttempt<TResponse = unknown>(error: ResponseError<TResponse>, attemptNumber: number, config?: RequestConfig): void;
73
+ dispose(): void;
74
+ }
75
+ /**
76
+ * Parameters for enhancing client with runtime configuration methods
77
+ * Used internally by createApiClient to add config management methods
78
+ *
79
+ * @internal
80
+ */
81
+ export interface EnhanceClientParams<TEventManager = unknown, TEndpointsList = UnknownRecord, TClient = ApiHandlerMethods<EndpointTypes, TEndpointsList>> {
82
+ /** Client instance with events already attached */
83
+ clientWithEvents: ApiClientWithEvents<TEventManager, TEndpointsList>;
84
+ /** Mutable container holding current config state */
85
+ stateContainer: {
86
+ current: ConfigState;
87
+ };
88
+ /** Event manager instance for lifecycle events */
89
+ eventManager: EventManagerLike<TEventManager>;
90
+ /** Base fetchff client instance */
91
+ client: TClient;
92
+ /** Unique client identifier */
93
+ clientId: string;
94
+ /** Global configuration */
95
+ globalConfig: ApiConfig;
96
+ /** Client creation options */
97
+ options: ApiClientOptions;
98
+ }
40
99
  /**
41
100
  * Event handler registration options
42
101
  */
@@ -62,6 +62,20 @@ export interface ParticipantFilters {
62
62
  limit?: number;
63
63
  offset?: number;
64
64
  }
65
+ /**
66
+ * Parameters for useCampaignParticipants hook
67
+ */
68
+ export interface UseCampaignParticipantsParams {
69
+ campaignId: string;
70
+ filters?: ParticipantFilters;
71
+ }
72
+ /**
73
+ * Parameters for useUpdateCampaign hook
74
+ */
75
+ export interface UpdateCampaignParams {
76
+ campaignId: string;
77
+ data: UpdateCampaignDto;
78
+ }
65
79
  /**
66
80
  * Campaign endpoint types for TypeScript
67
81
  * Using fetchff's Req type to properly define endpoints
@@ -1,3 +1,4 @@
1
1
  export type * from './campaigns';
2
2
  export type * from './health';
3
+ export type * from './infobip';
3
4
  export type * from './types';
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Infobip Email Endpoint Type Definitions
3
+ *
4
+ * This file contains endpoint type definitions for essential email operations:
5
+ * - Send email (with attachment support)
6
+ * - Email validation
7
+ * - Email bulk operations
8
+ * - Email webhooks
9
+ *
10
+ * All types are derived from generated OpenAPI specifications.
11
+ *
12
+ * @see ./types.ts
13
+ */
14
+ import type { Endpoint, Req } from 'fetchff';
15
+ import type { InfobipSendEmailRequest, InfobipSendEmailResponse, InfobipSendAdvancedEmailRequest, InfobipSendAdvancedEmailResponse, InfobipSendEmailMimeRequest, InfobipSendEmailMimeResponse, InfobipValidateEmailRequest, InfobipValidateEmailResponse, InfobipBulkValidateEmailsRequest, InfobipBulkValidateEmailsResponse, InfobipGetValidationsParams, InfobipGetValidationsResponse, InfobipGetEmailReportsParams, InfobipGetEmailReportsResponse, InfobipGetEmailLogsParams, InfobipGetEmailLogsResponse, InfobipGetScheduledEmailsParams, InfobipGetScheduledEmailsResponse, InfobipGetScheduledEmailStatusesParams, InfobipGetScheduledEmailStatusesResponse, InfobipRescheduleEmailsParams, InfobipRescheduleEmailsRequest, InfobipRescheduleEmailsResponse, InfobipUpdateScheduledEmailStatusesParams, InfobipUpdateScheduledEmailStatusesRequest, InfobipUpdateScheduledEmailStatusesResponse, InfobipEmailDeliveryReportWebhook, InfobipEmailTrackingReportWebhook, InfobipInboundEmailWebhook } from './types';
16
+ /**
17
+ * Infobip Email API endpoint types
18
+ * Complete type definitions for essential email endpoints
19
+ */
20
+ export interface InfobipEmailEndpointTypes {
21
+ /**
22
+ * POST /email/3/send - Send email message
23
+ * Supports both simple text and HTML emails with attachments
24
+ */
25
+ sendEmail: Endpoint<Req<InfobipSendEmailResponse, InfobipSendEmailRequest>>;
26
+ /**
27
+ * POST /email/4/send - Send advanced email message
28
+ * Full email customization with advanced features
29
+ */
30
+ sendAdvancedEmail: Endpoint<Req<InfobipSendAdvancedEmailResponse, InfobipSendAdvancedEmailRequest>>;
31
+ /**
32
+ * POST /email/3/mime - Send email via MIME format
33
+ * Send pre-formatted MIME messages
34
+ */
35
+ sendEmailMime: Endpoint<Req<InfobipSendEmailMimeResponse, InfobipSendEmailMimeRequest>>;
36
+ /**
37
+ * POST /email/2/validation - Validate single email address
38
+ * Check if an email address is valid and deliverable
39
+ */
40
+ validateEmail: Endpoint<Req<InfobipValidateEmailResponse, InfobipValidateEmailRequest>>;
41
+ /**
42
+ * POST /email/2/validations - Bulk validate email addresses
43
+ * Submit multiple email addresses for validation (async operation)
44
+ * Returns 202 with validation request ID
45
+ */
46
+ bulkValidateEmails: Endpoint<Req<InfobipBulkValidateEmailsResponse, InfobipBulkValidateEmailsRequest>>;
47
+ /**
48
+ * GET /email/2/validations - Get validation results
49
+ * Retrieve results of bulk email validation requests
50
+ */
51
+ getValidations: Endpoint<Req<InfobipGetValidationsResponse, never, InfobipGetValidationsParams>>;
52
+ /**
53
+ * GET /email/1/reports - Get email delivery reports
54
+ * Retrieve delivery status for sent emails
55
+ */
56
+ getEmailReports: Endpoint<Req<InfobipGetEmailReportsResponse, never, InfobipGetEmailReportsParams>>;
57
+ /**
58
+ * GET /email/1/logs - Get email logs
59
+ * Retrieve detailed logs for email messages
60
+ */
61
+ getEmailLogs: Endpoint<Req<InfobipGetEmailLogsResponse, never, InfobipGetEmailLogsParams>>;
62
+ /**
63
+ * GET /email/1/bulks - Get scheduled email bulks
64
+ * Retrieve information about scheduled email batches
65
+ */
66
+ getScheduledEmails: Endpoint<Req<InfobipGetScheduledEmailsResponse, never, InfobipGetScheduledEmailsParams>>;
67
+ /**
68
+ * GET /email/1/bulks/status - Get scheduled email statuses
69
+ * Get status of scheduled email batches
70
+ */
71
+ getScheduledEmailStatuses: Endpoint<Req<InfobipGetScheduledEmailStatusesResponse, never, InfobipGetScheduledEmailStatusesParams>>;
72
+ /**
73
+ * PUT /email/1/bulks - Reschedule email messages
74
+ * Change the send time for scheduled emails
75
+ */
76
+ rescheduleEmails: Endpoint<Req<InfobipRescheduleEmailsResponse, InfobipRescheduleEmailsRequest, InfobipRescheduleEmailsParams>>;
77
+ /**
78
+ * PUT /email/1/bulks/status - Update scheduled email statuses
79
+ * Pause, resume, or cancel scheduled emails
80
+ */
81
+ updateScheduledEmailStatuses: Endpoint<Req<InfobipUpdateScheduledEmailStatusesResponse, InfobipUpdateScheduledEmailStatusesRequest, InfobipUpdateScheduledEmailStatusesParams>>;
82
+ }
83
+ /**
84
+ * Infobip Email Webhook payload types
85
+ * Types for incoming webhook payloads from Infobip
86
+ */
87
+ export interface InfobipEmailWebhookTypes {
88
+ /**
89
+ * Webhook: POST receive-email-delivery-reports
90
+ * Delivery status update webhook payload
91
+ */
92
+ deliveryReport: InfobipEmailDeliveryReportWebhook;
93
+ /**
94
+ * Webhook: POST receive-email-tracking-reports
95
+ * Tracking events webhook payload (opens, clicks, bounces, etc.)
96
+ */
97
+ trackingReport: InfobipEmailTrackingReportWebhook;
98
+ /**
99
+ * Webhook: POST receive-inbound-email
100
+ * Inbound email received webhook payload
101
+ */
102
+ inboundEmail: InfobipInboundEmailWebhook;
103
+ }
104
+ /**
105
+ * All Infobip endpoint types
106
+ * Email operations and webhooks
107
+ */
108
+ export interface InfobipEndpointTypes extends InfobipEmailEndpointTypes {
109
+ }
110
+ /**
111
+ * All Infobip webhook types
112
+ * Email webhooks
113
+ */
114
+ export interface InfobipWebhookTypes extends InfobipEmailWebhookTypes {
115
+ }