@plyaz/types 1.13.16 → 1.14.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 (45) hide show
  1. package/dist/api/endpoints/infobip/types.d.ts +6 -1
  2. package/dist/api/errors/types.d.ts +1 -1
  3. package/dist/api/index.cjs +158 -100
  4. package/dist/api/index.cjs.map +1 -1
  5. package/dist/api/index.js +60 -2
  6. package/dist/api/index.js.map +1 -1
  7. package/dist/auth/index.cjs +12 -4196
  8. package/dist/auth/index.cjs.map +1 -1
  9. package/dist/auth/index.js +10 -6
  10. package/dist/auth/index.js.map +1 -1
  11. package/dist/auth/schemas.d.ts +20 -21
  12. package/dist/db/database.types.d.ts +1 -1
  13. package/dist/db/features-config.types.d.ts +2 -2
  14. package/dist/db/index.cjs.map +1 -1
  15. package/dist/db/index.js.map +1 -1
  16. package/dist/db/replica.types.d.ts +2 -2
  17. package/dist/errors/index.cjs +158 -100
  18. package/dist/errors/index.cjs.map +1 -1
  19. package/dist/errors/index.js +60 -2
  20. package/dist/errors/index.js.map +1 -1
  21. package/dist/errors/types.d.ts +47 -6
  22. package/dist/http/constants.d.ts +265 -0
  23. package/dist/index.cjs +761 -4344
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.ts +4 -0
  26. package/dist/index.js +600 -7
  27. package/dist/index.js.map +1 -1
  28. package/dist/locale/types.d.ts +109 -0
  29. package/dist/notifications/enums.d.ts +0 -1
  30. package/dist/notifications/index.cjs +155 -4201
  31. package/dist/notifications/index.cjs.map +1 -1
  32. package/dist/notifications/index.d.ts +11 -0
  33. package/dist/notifications/index.js +133 -1
  34. package/dist/notifications/index.js.map +1 -1
  35. package/dist/notifications/schemas.d.ts +13 -3
  36. package/dist/notifications/types.d.ts +66 -24
  37. package/dist/notifications/webhooks.schemas.d.ts +278 -0
  38. package/dist/payments/base-error/types.d.ts +1 -1
  39. package/dist/payments/gateways/provider/types.d.ts +1 -1
  40. package/dist/payments/gateways/routings/types.d.ts +1 -1
  41. package/dist/payments/provider/adapter/types.d.ts +1 -1
  42. package/dist/payments/provider/core/types.d.ts +1 -1
  43. package/dist/payments/provider/payment-provider/types.d.ts +1 -1
  44. package/dist/payments/transaction/types.d.ts +1 -1
  45. package/package.json +4 -5
@@ -0,0 +1,278 @@
1
+ /**
2
+ * Webhook Validation Schemas
3
+ *
4
+ * Zod schemas for validating webhook payloads from notification providers
5
+ * Provider-specific webhook event structures
6
+ *
7
+ * @module notifications/webhooks.schemas
8
+ */
9
+ import { z } from 'zod';
10
+ /**
11
+ * Infobip Email Status schema
12
+ */
13
+ export declare const InfobipEmailStatusSchema: z.ZodObject<{
14
+ groupId: z.ZodOptional<z.ZodNumber>;
15
+ groupName: z.ZodOptional<z.ZodString>;
16
+ id: z.ZodOptional<z.ZodNumber>;
17
+ name: z.ZodOptional<z.ZodString>;
18
+ description: z.ZodOptional<z.ZodString>;
19
+ action: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>;
21
+ /**
22
+ * Infobip Error Info schema
23
+ */
24
+ export declare const InfobipErrorInfoSchema: z.ZodObject<{
25
+ groupId: z.ZodOptional<z.ZodNumber>;
26
+ groupName: z.ZodOptional<z.ZodString>;
27
+ id: z.ZodOptional<z.ZodNumber>;
28
+ name: z.ZodOptional<z.ZodString>;
29
+ description: z.ZodOptional<z.ZodString>;
30
+ permanent: z.ZodOptional<z.ZodBoolean>;
31
+ }, z.core.$strip>;
32
+ /**
33
+ * Infobip Price Info schema
34
+ */
35
+ export declare const InfobipPriceInfoSchema: z.ZodObject<{
36
+ pricePerMessage: z.ZodOptional<z.ZodNumber>;
37
+ currency: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$strip>;
39
+ /**
40
+ * Infobip Delivery Result schema
41
+ */
42
+ export declare const InfobipDeliveryResultSchema: z.ZodObject<{
43
+ messageId: z.ZodOptional<z.ZodString>;
44
+ to: z.ZodOptional<z.ZodString>;
45
+ bulkId: z.ZodOptional<z.ZodString>;
46
+ sentAt: z.ZodOptional<z.ZodString>;
47
+ doneAt: z.ZodOptional<z.ZodString>;
48
+ status: z.ZodOptional<z.ZodObject<{
49
+ groupId: z.ZodOptional<z.ZodNumber>;
50
+ groupName: z.ZodOptional<z.ZodString>;
51
+ id: z.ZodOptional<z.ZodNumber>;
52
+ name: z.ZodOptional<z.ZodString>;
53
+ description: z.ZodOptional<z.ZodString>;
54
+ action: z.ZodOptional<z.ZodString>;
55
+ }, z.core.$strip>>;
56
+ error: z.ZodOptional<z.ZodObject<{
57
+ groupId: z.ZodOptional<z.ZodNumber>;
58
+ groupName: z.ZodOptional<z.ZodString>;
59
+ id: z.ZodOptional<z.ZodNumber>;
60
+ name: z.ZodOptional<z.ZodString>;
61
+ description: z.ZodOptional<z.ZodString>;
62
+ permanent: z.ZodOptional<z.ZodBoolean>;
63
+ }, z.core.$strip>>;
64
+ attemptCount: z.ZodOptional<z.ZodNumber>;
65
+ timeToFirstAttempt: z.ZodOptional<z.ZodNumber>;
66
+ sendingIp: z.ZodOptional<z.ZodString>;
67
+ price: z.ZodOptional<z.ZodObject<{
68
+ pricePerMessage: z.ZodOptional<z.ZodNumber>;
69
+ currency: z.ZodOptional<z.ZodString>;
70
+ }, z.core.$strip>>;
71
+ smsCount: z.ZodOptional<z.ZodNumber>;
72
+ browserLink: z.ZodOptional<z.ZodString>;
73
+ applicationId: z.ZodOptional<z.ZodString>;
74
+ entityId: z.ZodOptional<z.ZodString>;
75
+ campaignReferenceId: z.ZodOptional<z.ZodString>;
76
+ callbackData: z.ZodOptional<z.ZodString>;
77
+ }, z.core.$loose>;
78
+ /**
79
+ * Infobip Delivery Webhook Payload schema
80
+ */
81
+ export declare const InfobipDeliveryWebhookSchema: z.ZodObject<{
82
+ results: z.ZodArray<z.ZodObject<{
83
+ messageId: z.ZodOptional<z.ZodString>;
84
+ to: z.ZodOptional<z.ZodString>;
85
+ bulkId: z.ZodOptional<z.ZodString>;
86
+ sentAt: z.ZodOptional<z.ZodString>;
87
+ doneAt: z.ZodOptional<z.ZodString>;
88
+ status: z.ZodOptional<z.ZodObject<{
89
+ groupId: z.ZodOptional<z.ZodNumber>;
90
+ groupName: z.ZodOptional<z.ZodString>;
91
+ id: z.ZodOptional<z.ZodNumber>;
92
+ name: z.ZodOptional<z.ZodString>;
93
+ description: z.ZodOptional<z.ZodString>;
94
+ action: z.ZodOptional<z.ZodString>;
95
+ }, z.core.$strip>>;
96
+ error: z.ZodOptional<z.ZodObject<{
97
+ groupId: z.ZodOptional<z.ZodNumber>;
98
+ groupName: z.ZodOptional<z.ZodString>;
99
+ id: z.ZodOptional<z.ZodNumber>;
100
+ name: z.ZodOptional<z.ZodString>;
101
+ description: z.ZodOptional<z.ZodString>;
102
+ permanent: z.ZodOptional<z.ZodBoolean>;
103
+ }, z.core.$strip>>;
104
+ attemptCount: z.ZodOptional<z.ZodNumber>;
105
+ timeToFirstAttempt: z.ZodOptional<z.ZodNumber>;
106
+ sendingIp: z.ZodOptional<z.ZodString>;
107
+ price: z.ZodOptional<z.ZodObject<{
108
+ pricePerMessage: z.ZodOptional<z.ZodNumber>;
109
+ currency: z.ZodOptional<z.ZodString>;
110
+ }, z.core.$strip>>;
111
+ smsCount: z.ZodOptional<z.ZodNumber>;
112
+ browserLink: z.ZodOptional<z.ZodString>;
113
+ applicationId: z.ZodOptional<z.ZodString>;
114
+ entityId: z.ZodOptional<z.ZodString>;
115
+ campaignReferenceId: z.ZodOptional<z.ZodString>;
116
+ callbackData: z.ZodOptional<z.ZodString>;
117
+ }, z.core.$loose>>;
118
+ }, z.core.$strip>;
119
+ /**
120
+ * Infobip Geo Location schema
121
+ */
122
+ export declare const InfobipGeoLocationSchema: z.ZodObject<{
123
+ countryName: z.ZodOptional<z.ZodString>;
124
+ countryCode: z.ZodOptional<z.ZodString>;
125
+ regionName: z.ZodOptional<z.ZodString>;
126
+ city: z.ZodOptional<z.ZodString>;
127
+ latitude: z.ZodOptional<z.ZodNumber>;
128
+ longitude: z.ZodOptional<z.ZodNumber>;
129
+ }, z.core.$loose>;
130
+ /**
131
+ * Infobip Recipient Info schema
132
+ */
133
+ export declare const InfobipRecipientInfoSchema: z.ZodObject<{
134
+ messageId: z.ZodOptional<z.ZodNumber>;
135
+ to: z.ZodOptional<z.ZodString>;
136
+ requestId: z.ZodOptional<z.ZodString>;
137
+ sentDateTime: z.ZodOptional<z.ZodNumber>;
138
+ }, z.core.$loose>;
139
+ /**
140
+ * Infobip Tracking Event schema
141
+ */
142
+ export declare const InfobipTrackingEventSchema: z.ZodObject<{
143
+ messageId: z.ZodOptional<z.ZodNumber>;
144
+ bulkId: z.ZodOptional<z.ZodString>;
145
+ recipient: z.ZodOptional<z.ZodString>;
146
+ sender: z.ZodOptional<z.ZodString>;
147
+ domain: z.ZodOptional<z.ZodString>;
148
+ notificationType: z.ZodOptional<z.ZodString>;
149
+ eventId: z.ZodOptional<z.ZodString>;
150
+ sendDateTime: z.ZodOptional<z.ZodNumber>;
151
+ url: z.ZodOptional<z.ZodString>;
152
+ applicationId: z.ZodOptional<z.ZodString>;
153
+ entityId: z.ZodOptional<z.ZodString>;
154
+ campaignReferenceId: z.ZodOptional<z.ZodString>;
155
+ callbackData: z.ZodOptional<z.ZodString>;
156
+ geoLocation: z.ZodOptional<z.ZodObject<{
157
+ countryName: z.ZodOptional<z.ZodString>;
158
+ countryCode: z.ZodOptional<z.ZodString>;
159
+ regionName: z.ZodOptional<z.ZodString>;
160
+ city: z.ZodOptional<z.ZodString>;
161
+ latitude: z.ZodOptional<z.ZodNumber>;
162
+ longitude: z.ZodOptional<z.ZodNumber>;
163
+ }, z.core.$loose>>;
164
+ recipientInfo: z.ZodOptional<z.ZodObject<{
165
+ messageId: z.ZodOptional<z.ZodNumber>;
166
+ to: z.ZodOptional<z.ZodString>;
167
+ requestId: z.ZodOptional<z.ZodString>;
168
+ sentDateTime: z.ZodOptional<z.ZodNumber>;
169
+ }, z.core.$loose>>;
170
+ }, z.core.$loose>;
171
+ /**
172
+ * Infobip Tracking Webhook Payload schema
173
+ * Note: Tracking webhooks send a single event object, not an array
174
+ */
175
+ export declare const InfobipTrackingWebhookSchema: z.ZodObject<{
176
+ messageId: z.ZodOptional<z.ZodNumber>;
177
+ bulkId: z.ZodOptional<z.ZodString>;
178
+ recipient: z.ZodOptional<z.ZodString>;
179
+ sender: z.ZodOptional<z.ZodString>;
180
+ domain: z.ZodOptional<z.ZodString>;
181
+ notificationType: z.ZodOptional<z.ZodString>;
182
+ eventId: z.ZodOptional<z.ZodString>;
183
+ sendDateTime: z.ZodOptional<z.ZodNumber>;
184
+ url: z.ZodOptional<z.ZodString>;
185
+ applicationId: z.ZodOptional<z.ZodString>;
186
+ entityId: z.ZodOptional<z.ZodString>;
187
+ campaignReferenceId: z.ZodOptional<z.ZodString>;
188
+ callbackData: z.ZodOptional<z.ZodString>;
189
+ geoLocation: z.ZodOptional<z.ZodObject<{
190
+ countryName: z.ZodOptional<z.ZodString>;
191
+ countryCode: z.ZodOptional<z.ZodString>;
192
+ regionName: z.ZodOptional<z.ZodString>;
193
+ city: z.ZodOptional<z.ZodString>;
194
+ latitude: z.ZodOptional<z.ZodNumber>;
195
+ longitude: z.ZodOptional<z.ZodNumber>;
196
+ }, z.core.$loose>>;
197
+ recipientInfo: z.ZodOptional<z.ZodObject<{
198
+ messageId: z.ZodOptional<z.ZodNumber>;
199
+ to: z.ZodOptional<z.ZodString>;
200
+ requestId: z.ZodOptional<z.ZodString>;
201
+ sentDateTime: z.ZodOptional<z.ZodNumber>;
202
+ }, z.core.$loose>>;
203
+ }, z.core.$loose>;
204
+ /**
205
+ * SendGrid Event schema
206
+ */
207
+ export declare const SendGridEventSchema: z.ZodObject<{
208
+ email: z.ZodString;
209
+ timestamp: z.ZodNumber;
210
+ event: z.ZodEnum<{
211
+ open: "open";
212
+ click: "click";
213
+ delivered: "delivered";
214
+ deferred: "deferred";
215
+ dropped: "dropped";
216
+ spam_report: "spam_report";
217
+ processed: "processed";
218
+ bounce: "bounce";
219
+ unsubscribe: "unsubscribe";
220
+ group_unsubscribe: "group_unsubscribe";
221
+ group_resubscribe: "group_resubscribe";
222
+ }>;
223
+ sg_event_id: z.ZodString;
224
+ sg_message_id: z.ZodString;
225
+ notification_id: z.ZodOptional<z.ZodString>;
226
+ recipient_id: z.ZodOptional<z.ZodString>;
227
+ category: z.ZodOptional<z.ZodString>;
228
+ url: z.ZodOptional<z.ZodString>;
229
+ reason: z.ZodOptional<z.ZodString>;
230
+ status: z.ZodOptional<z.ZodString>;
231
+ response: z.ZodOptional<z.ZodString>;
232
+ useragent: z.ZodOptional<z.ZodString>;
233
+ ip: z.ZodOptional<z.ZodString>;
234
+ asm_group_id: z.ZodOptional<z.ZodNumber>;
235
+ }, z.core.$loose>;
236
+ /**
237
+ * SendGrid Webhook Payload schema (array of events)
238
+ */
239
+ export declare const SendGridWebhookSchema: z.ZodArray<z.ZodObject<{
240
+ email: z.ZodString;
241
+ timestamp: z.ZodNumber;
242
+ event: z.ZodEnum<{
243
+ open: "open";
244
+ click: "click";
245
+ delivered: "delivered";
246
+ deferred: "deferred";
247
+ dropped: "dropped";
248
+ spam_report: "spam_report";
249
+ processed: "processed";
250
+ bounce: "bounce";
251
+ unsubscribe: "unsubscribe";
252
+ group_unsubscribe: "group_unsubscribe";
253
+ group_resubscribe: "group_resubscribe";
254
+ }>;
255
+ sg_event_id: z.ZodString;
256
+ sg_message_id: z.ZodString;
257
+ notification_id: z.ZodOptional<z.ZodString>;
258
+ recipient_id: z.ZodOptional<z.ZodString>;
259
+ category: z.ZodOptional<z.ZodString>;
260
+ url: z.ZodOptional<z.ZodString>;
261
+ reason: z.ZodOptional<z.ZodString>;
262
+ status: z.ZodOptional<z.ZodString>;
263
+ response: z.ZodOptional<z.ZodString>;
264
+ useragent: z.ZodOptional<z.ZodString>;
265
+ ip: z.ZodOptional<z.ZodString>;
266
+ asm_group_id: z.ZodOptional<z.ZodNumber>;
267
+ }, z.core.$loose>>;
268
+ export type InfobipWebhookEmailStatus = z.infer<typeof InfobipEmailStatusSchema>;
269
+ export type InfobipWebhookErrorInfo = z.infer<typeof InfobipErrorInfoSchema>;
270
+ export type InfobipWebhookPriceInfo = z.infer<typeof InfobipPriceInfoSchema>;
271
+ export type InfobipWebhookDeliveryResult = z.infer<typeof InfobipDeliveryResultSchema>;
272
+ export type InfobipWebhookDeliveryPayload = z.infer<typeof InfobipDeliveryWebhookSchema>;
273
+ export type InfobipWebhookGeoLocation = z.infer<typeof InfobipGeoLocationSchema>;
274
+ export type InfobipWebhookRecipientInfo = z.infer<typeof InfobipRecipientInfoSchema>;
275
+ export type InfobipWebhookTrackingEvent = z.infer<typeof InfobipTrackingEventSchema>;
276
+ export type InfobipWebhookTrackingPayload = z.infer<typeof InfobipTrackingWebhookSchema>;
277
+ export type SendGridWebhookEvent = z.infer<typeof SendGridEventSchema>;
278
+ export type SendGridWebhookPayload = z.infer<typeof SendGridWebhookSchema>;
@@ -4,7 +4,7 @@ import type { BaseErrorContext } from '../../api';
4
4
  import type { EventProcessingMetadata, PaymentEventPayload, PAYMENTEVENTTYPE } from '../events';
5
5
  import type { PAYMENT_ERROR_CATEGORY } from './enum';
6
6
  import type { ERROR_SEVERITY } from '../../errors';
7
- import type { CurrencyCode } from '@plyaz/config';
7
+ import type { CurrencyCode } from '../../locale/types';
8
8
  /**
9
9
  * Base adapter options used for constructing provider adapters.
10
10
  */
@@ -1,4 +1,4 @@
1
- import type { CurrencyCode } from '@plyaz/config';
1
+ import type { CurrencyCode } from '../../../locale/types';
2
2
  import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE } from '../../provider';
3
3
  /**
4
4
  * Base configuration interface that all payment providers must implement.
@@ -1,4 +1,4 @@
1
- import type { CurrencyCode } from '@plyaz/config';
1
+ import type { CurrencyCode } from '../../../locale/types';
2
2
  import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE, TRANSACTIONTYPE, USERTYPE } from '../../provider';
3
3
  import type { VolumeTier } from '../provider/types';
4
4
  import type { COSTOPTIMIZATIONSTRATEGY, FAILOVERSTRATEGY, LOADBALANCINGSTRATEGY, PERFORMANCEMETRICTYPE, REGULATORYFRAMEWORK, ROUTINGSTRATEGY } from './enums';
@@ -1,4 +1,4 @@
1
- import type { CurrencyCode } from '@plyaz/config';
1
+ import type { CurrencyCode } from '../../../locale/types';
2
2
  import type { ProviderHealthStatus } from '../../../features';
3
3
  import type { BaseProviderConfig } from '../../gateways';
4
4
  import type { PaymentResult, ProcessPaymentRequest } from '../../request';
@@ -1,4 +1,4 @@
1
- import type { CurrencyCode } from '@plyaz/config';
1
+ import type { CurrencyCode } from '../../../locale/types';
2
2
  import type { FeeBreakdown, Money } from '../../transaction';
3
3
  import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE, PAYMENTSTATUS } from '../provider-capability';
4
4
  /**
@@ -4,7 +4,7 @@ import type { PaymentResult, ProcessPaymentRequest } from '../../request';
4
4
  import type { FeeBreakdown, Money } from '../../transaction';
5
5
  import type { CreateCustomerParams, CustomerResult, FeeCalculationOptions, PaymentStatusResult, RefundParams, RefundResult, SavedPaymentMethodResult, SavePaymentMethodParams, TransactionHistory, TransactionHistoryParams, WebhookPayload, WebhookResult } from '../core';
6
6
  import type { PAYMENTMETHOD, PAYMENTPROVIDERTYPE } from '../provider-capability';
7
- import type { CurrencyCode } from '@plyaz/config';
7
+ import type { CurrencyCode } from '../../../locale/types';
8
8
  /**
9
9
  * Core interface that all payment providers must implement.
10
10
  * This interface ensures consistent behavior across all providers
@@ -1,4 +1,4 @@
1
- import type { CurrencyCode } from '@plyaz/config';
1
+ import type { CurrencyCode } from '../../locale/types';
2
2
  /**
3
3
  * Core money interface for handling monetary values throughout the system.
4
4
  * All monetary amounts are stored in the smallest currency unit to avoid
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plyaz/types",
3
- "version": "1.13.16",
3
+ "version": "1.14.0",
4
4
  "author": "Redeemer Pace",
5
5
  "license": "ISC",
6
6
  "description": "Provides shared TypeScript types and schema utilities for validation and parsing in the @playz ecosystem.",
@@ -192,10 +192,10 @@
192
192
  "keywords": [],
193
193
  "packageManager": "pnpm@10.11.0",
194
194
  "dependencies": {
195
- "@plyaz/config": "^1.7.3",
196
195
  "pino": "^10.0.0",
197
196
  "type-fest": "^4.41.0",
198
- "zustand": "^5.0.0"
197
+ "zustand": "^5.0.0",
198
+ "zod": "^4.1.5"
199
199
  },
200
200
  "devDependencies": {
201
201
  "@changesets/cli": "^2.29.5",
@@ -256,8 +256,7 @@
256
256
  "tsup": "8.5.0",
257
257
  "typescript": "^5",
258
258
  "typescript-eslint": "^8.34.0",
259
- "vitest": "3.2.4",
260
- "zod": "^3.25.64"
259
+ "vitest": "3.2.4"
261
260
  },
262
261
  "peerDependenciesMeta": {
263
262
  "react": {