@djangocfg/api 1.0.4 → 1.0.6
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/dist/index.cjs +15856 -34128
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15274 -34396
- package/dist/index.d.ts +15274 -34396
- package/dist/index.mjs +15853 -33956
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cfg/contexts/payments/ApiKeysContext.tsx +21 -58
- package/src/cfg/contexts/payments/BalancesContext.tsx +19 -72
- package/src/cfg/contexts/payments/CurrenciesContext.tsx +5 -18
- package/src/cfg/contexts/payments/OverviewContext.tsx +78 -124
- package/src/cfg/contexts/payments/PaymentsContext.tsx +37 -36
- package/src/cfg/contexts/payments/RootPaymentsContext.tsx +7 -76
- package/src/cfg/contexts/payments/index.ts +5 -24
- package/src/cfg/generated/_utils/fetchers/cfg__payments.ts +38 -2380
- package/src/cfg/generated/_utils/fetchers/index.ts +0 -1
- package/src/cfg/generated/_utils/hooks/cfg__payments.ts +41 -2615
- package/src/cfg/generated/_utils/hooks/index.ts +0 -1
- package/src/cfg/generated/_utils/schemas/ArchiveItem.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/ArchiveItemChunk.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/ArchiveItemChunkDetail.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/ArchiveItemChunkRequest.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/ArchiveItemDetail.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/ArchiveItemRequest.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/ChatMessage.schema.ts +2 -2
- package/src/cfg/generated/_utils/schemas/ChatSession.schema.ts +3 -3
- package/src/cfg/generated/_utils/schemas/ChatSessionRequest.schema.ts +3 -3
- package/src/cfg/generated/_utils/schemas/Document.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/DocumentRequest.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/PatchedArchiveItemChunkRequest.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/PatchedArchiveItemRequest.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/PatchedChatSessionRequest.schema.ts +3 -3
- package/src/cfg/generated/_utils/schemas/PatchedDocumentRequest.schema.ts +1 -1
- package/src/cfg/generated/_utils/schemas/PaymentDetail.schema.ts +44 -0
- package/src/cfg/generated/_utils/schemas/PaymentList.schema.ts +7 -11
- package/src/cfg/generated/_utils/schemas/index.ts +1 -81
- package/src/cfg/generated/cfg__payments/client.ts +40 -1732
- package/src/cfg/generated/cfg__payments/models.ts +50 -1795
- package/src/cfg/generated/client.ts +0 -3
- package/src/cfg/generated/enums.ts +5 -347
- package/src/cfg/generated/index.ts +0 -5
- package/src/cfg/generated/schema.ts +5918 -18352
- package/src/cfg/services/payments/ApiKeysService.ts +34 -116
- package/src/cfg/services/payments/DashboardService.ts +37 -122
- package/src/cfg/services/payments/PaymentsService.ts +36 -69
- package/src/cfg/services/payments/SubscriptionsService.ts +35 -136
- package/src/cfg/services/webhooks/WebhooksService.ts +24 -66
- package/src/index.ts +1 -6
- package/src/cfg/generated/_utils/fetchers/cfg__payments__webhooks.ts +0 -109
- package/src/cfg/generated/_utils/hooks/cfg__payments__webhooks.ts +0 -100
- package/src/cfg/generated/_utils/schemas/APIKeyCreate.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/APIKeyCreateRequest.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/APIKeyDetail.schema.ts +0 -35
- package/src/cfg/generated/_utils/schemas/APIKeyList.schema.ts +0 -32
- package/src/cfg/generated/_utils/schemas/APIKeyUpdate.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/APIKeyUpdateRequest.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/APIKeyValidationRequest.schema.ts +0 -23
- package/src/cfg/generated/_utils/schemas/APIKeyValidationResponse.schema.ts +0 -29
- package/src/cfg/generated/_utils/schemas/APIKeysOverview.schema.ts +0 -26
- package/src/cfg/generated/_utils/schemas/AdminPaymentCreate.schema.ts +0 -26
- package/src/cfg/generated/_utils/schemas/AdminPaymentCreateRequest.schema.ts +0 -27
- package/src/cfg/generated/_utils/schemas/AdminPaymentDetail.schema.ts +0 -50
- package/src/cfg/generated/_utils/schemas/AdminPaymentList.schema.ts +0 -38
- package/src/cfg/generated/_utils/schemas/AdminPaymentStats.schema.ts +0 -29
- package/src/cfg/generated/_utils/schemas/AdminPaymentUpdate.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/AdminPaymentUpdateRequest.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/AdminUser.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/BalanceOverview.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/ChartDataPoint.schema.ts +0 -20
- package/src/cfg/generated/_utils/schemas/ChartSeries.schema.ts +0 -22
- package/src/cfg/generated/_utils/schemas/Currency.schema.ts +0 -35
- package/src/cfg/generated/_utils/schemas/CurrencyAnalyticsItem.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/CurrencyList.schema.ts +0 -32
- package/src/cfg/generated/_utils/schemas/CurrencyRates.schema.ts +0 -26
- package/src/cfg/generated/_utils/schemas/EndpointGroup.schema.ts +0 -28
- package/src/cfg/generated/_utils/schemas/Network.schema.ts +0 -30
- package/src/cfg/generated/_utils/schemas/PaginatedAPIKeyListList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedAdminPaymentListList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedAdminPaymentStatsList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedAdminUserList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedCurrencyListList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedEndpointGroupList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedNetworkList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedProviderCurrencyList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedRecentPaymentList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedRecentTransactionList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedSubscriptionListList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedTariffList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedTransactionList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedUserBalanceList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedWebhookEventListList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaginatedWebhookStatsList.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PatchedAPIKeyUpdateRequest.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PatchedAdminPaymentUpdateRequest.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/PatchedPaymentRequest.schema.ts +0 -30
- package/src/cfg/generated/_utils/schemas/PatchedSubscriptionRequest.schema.ts +0 -26
- package/src/cfg/generated/_utils/schemas/Payment.schema.ts +0 -49
- package/src/cfg/generated/_utils/schemas/PaymentAnalyticsResponse.schema.ts +0 -22
- package/src/cfg/generated/_utils/schemas/PaymentCreate.schema.ts +0 -28
- package/src/cfg/generated/_utils/schemas/PaymentCreateRequest.schema.ts +0 -28
- package/src/cfg/generated/_utils/schemas/PaymentOverview.schema.ts +0 -31
- package/src/cfg/generated/_utils/schemas/PaymentRequest.schema.ts +0 -30
- package/src/cfg/generated/_utils/schemas/PaymentsChartResponse.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/PaymentsDashboardOverview.schema.ts +0 -26
- package/src/cfg/generated/_utils/schemas/PaymentsMetrics.schema.ts +0 -26
- package/src/cfg/generated/_utils/schemas/ProviderAnalyticsItem.schema.ts +0 -24
- package/src/cfg/generated/_utils/schemas/ProviderCurrency.schema.ts +0 -36
- package/src/cfg/generated/_utils/schemas/RecentPayment.schema.ts +0 -32
- package/src/cfg/generated/_utils/schemas/RecentTransaction.schema.ts +0 -29
- package/src/cfg/generated/_utils/schemas/Subscription.schema.ts +0 -41
- package/src/cfg/generated/_utils/schemas/SubscriptionCreate.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/SubscriptionCreateRequest.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/SubscriptionList.schema.ts +0 -32
- package/src/cfg/generated/_utils/schemas/SubscriptionOverview.schema.ts +0 -37
- package/src/cfg/generated/_utils/schemas/SubscriptionRequest.schema.ts +0 -26
- package/src/cfg/generated/_utils/schemas/SupportedCurrencies.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/SupportedProviders.schema.ts +0 -22
- package/src/cfg/generated/_utils/schemas/Tariff.schema.ts +0 -34
- package/src/cfg/generated/_utils/schemas/Transaction.schema.ts +0 -35
- package/src/cfg/generated/_utils/schemas/UserBalance.schema.ts +0 -29
- package/src/cfg/generated/_utils/schemas/WebhookEvent.schema.ts +0 -31
- package/src/cfg/generated/_utils/schemas/WebhookEventList.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/WebhookEventListRequest.schema.ts +0 -25
- package/src/cfg/generated/_utils/schemas/WebhookEventRequest.schema.ts +0 -30
- package/src/cfg/generated/_utils/schemas/WebhookHealth.schema.ts +0 -21
- package/src/cfg/generated/_utils/schemas/WebhookProviderStats.schema.ts +0 -23
- package/src/cfg/generated/_utils/schemas/WebhookProviderStatsRequest.schema.ts +0 -23
- package/src/cfg/generated/_utils/schemas/WebhookResponse.schema.ts +0 -27
- package/src/cfg/generated/_utils/schemas/WebhookResponseRequest.schema.ts +0 -27
- package/src/cfg/generated/_utils/schemas/WebhookStats.schema.ts +0 -27
- package/src/cfg/generated/_utils/schemas/WebhookStatsRequest.schema.ts +0 -27
- package/src/cfg/generated/cfg__payments__webhooks/client.ts +0 -75
- package/src/cfg/generated/cfg__payments__webhooks/index.ts +0 -2
- package/src/cfg/generated/cfg__payments__webhooks/models.ts +0 -87
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for PaymentRequest
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Complete payment serializer with full details.
|
|
6
|
-
|
|
7
|
-
Used for detail views and updates.
|
|
8
|
-
* */
|
|
9
|
-
import { z } from 'zod'
|
|
10
|
-
import * as Enums from '../../enums'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Complete payment serializer with full details.
|
|
14
|
-
|
|
15
|
-
Used for detail views and updates.
|
|
16
|
-
*/
|
|
17
|
-
export const PaymentRequestSchema = z.object({
|
|
18
|
-
amount_usd: z.number().min(1.0).max(50000.0),
|
|
19
|
-
provider: z.nativeEnum(Enums.PaymentRequestProvider).optional(),
|
|
20
|
-
status: z.nativeEnum(Enums.PaymentRequestStatus).optional(),
|
|
21
|
-
callback_url: z.url().nullable().optional(),
|
|
22
|
-
cancel_url: z.url().nullable().optional(),
|
|
23
|
-
description: z.string().optional(),
|
|
24
|
-
expires_at: z.iso.datetime().nullable().optional(),
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Infer TypeScript type from Zod schema
|
|
29
|
-
*/
|
|
30
|
-
export type PaymentRequest = z.infer<typeof PaymentRequestSchema>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for PaymentsChartResponse
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Complete chart response for payments analytics
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
import { ChartSeriesSchema } from './ChartSeries.schema'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Complete chart response for payments analytics
|
|
12
|
-
*/
|
|
13
|
-
export const PaymentsChartResponseSchema = z.object({
|
|
14
|
-
series: z.array(ChartSeriesSchema),
|
|
15
|
-
period: z.string(),
|
|
16
|
-
total_amount: z.number(),
|
|
17
|
-
total_payments: z.int(),
|
|
18
|
-
success_rate: z.number(),
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Infer TypeScript type from Zod schema
|
|
23
|
-
*/
|
|
24
|
-
export type PaymentsChartResponse = z.infer<typeof PaymentsChartResponseSchema>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for PaymentsDashboardOverview
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Complete payments dashboard overview response
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
import { PaymentsChartResponseSchema } from './PaymentsChartResponse.schema'
|
|
9
|
-
import { PaymentsMetricsSchema } from './PaymentsMetrics.schema'
|
|
10
|
-
import { RecentPaymentSchema } from './RecentPayment.schema'
|
|
11
|
-
import { RecentTransactionSchema } from './RecentTransaction.schema'
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Complete payments dashboard overview response
|
|
15
|
-
*/
|
|
16
|
-
export const PaymentsDashboardOverviewSchema = z.object({
|
|
17
|
-
metrics: PaymentsMetricsSchema,
|
|
18
|
-
recent_payments: z.array(RecentPaymentSchema),
|
|
19
|
-
recent_transactions: z.array(RecentTransactionSchema),
|
|
20
|
-
chart_data: PaymentsChartResponseSchema,
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Infer TypeScript type from Zod schema
|
|
25
|
-
*/
|
|
26
|
-
export type PaymentsDashboardOverview = z.infer<typeof PaymentsDashboardOverviewSchema>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for PaymentsMetrics
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Complete payments dashboard metrics
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
import { APIKeysOverviewSchema } from './APIKeysOverview.schema'
|
|
9
|
-
import { BalanceOverviewSchema } from './BalanceOverview.schema'
|
|
10
|
-
import { PaymentOverviewSchema } from './PaymentOverview.schema'
|
|
11
|
-
import { SubscriptionOverviewSchema } from './SubscriptionOverview.schema'
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Complete payments dashboard metrics
|
|
15
|
-
*/
|
|
16
|
-
export const PaymentsMetricsSchema = z.object({
|
|
17
|
-
balance: BalanceOverviewSchema,
|
|
18
|
-
subscription: SubscriptionOverviewSchema.nullable(),
|
|
19
|
-
api_keys: APIKeysOverviewSchema,
|
|
20
|
-
payments: PaymentOverviewSchema,
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Infer TypeScript type from Zod schema
|
|
25
|
-
*/
|
|
26
|
-
export type PaymentsMetrics = z.infer<typeof PaymentsMetricsSchema>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for ProviderAnalyticsItem
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Analytics data for a single payment provider
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Analytics data for a single payment provider
|
|
11
|
-
*/
|
|
12
|
-
export const ProviderAnalyticsItemSchema = z.object({
|
|
13
|
-
provider: z.string(),
|
|
14
|
-
provider_display: z.string(),
|
|
15
|
-
total_payments: z.int(),
|
|
16
|
-
total_amount: z.number(),
|
|
17
|
-
completed_payments: z.int(),
|
|
18
|
-
success_rate: z.number(),
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Infer TypeScript type from Zod schema
|
|
23
|
-
*/
|
|
24
|
-
export type ProviderAnalyticsItem = z.infer<typeof ProviderAnalyticsItemSchema>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for ProviderCurrency
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Provider currency serializer for provider-specific currency info.
|
|
6
|
-
|
|
7
|
-
Used for provider currency management and rates.
|
|
8
|
-
* */
|
|
9
|
-
import { z } from 'zod'
|
|
10
|
-
import { CurrencyListSchema } from './CurrencyList.schema'
|
|
11
|
-
import { NetworkSchema } from './Network.schema'
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Provider currency serializer for provider-specific currency info.
|
|
15
|
-
|
|
16
|
-
Used for provider currency management and rates.
|
|
17
|
-
*/
|
|
18
|
-
export const ProviderCurrencySchema = z.object({
|
|
19
|
-
id: z.int(),
|
|
20
|
-
currency: CurrencyListSchema,
|
|
21
|
-
network: NetworkSchema.nullable(),
|
|
22
|
-
provider: z.string(),
|
|
23
|
-
provider_currency_code: z.string(),
|
|
24
|
-
provider_min_amount_usd: z.number(),
|
|
25
|
-
provider_max_amount_usd: z.number(),
|
|
26
|
-
provider_fee_percentage: z.number(),
|
|
27
|
-
provider_fixed_fee_usd: z.number(),
|
|
28
|
-
is_enabled: z.boolean(),
|
|
29
|
-
created_at: z.iso.datetime(),
|
|
30
|
-
updated_at: z.iso.datetime(),
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Infer TypeScript type from Zod schema
|
|
35
|
-
*/
|
|
36
|
-
export type ProviderCurrency = z.infer<typeof ProviderCurrencySchema>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for RecentPayment
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Recent payment item
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Recent payment item
|
|
11
|
-
*/
|
|
12
|
-
export const RecentPaymentSchema = z.object({
|
|
13
|
-
id: z.uuid(),
|
|
14
|
-
internal_payment_id: z.string(),
|
|
15
|
-
amount_usd: z.number(),
|
|
16
|
-
amount_display: z.string(),
|
|
17
|
-
currency_code: z.string(),
|
|
18
|
-
status: z.string(),
|
|
19
|
-
status_display: z.string(),
|
|
20
|
-
status_color: z.string(),
|
|
21
|
-
provider: z.string(),
|
|
22
|
-
created_at: z.iso.datetime(),
|
|
23
|
-
completed_at: z.iso.datetime().nullable(),
|
|
24
|
-
is_pending: z.boolean(),
|
|
25
|
-
is_completed: z.boolean(),
|
|
26
|
-
is_failed: z.boolean(),
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Infer TypeScript type from Zod schema
|
|
31
|
-
*/
|
|
32
|
-
export type RecentPayment = z.infer<typeof RecentPaymentSchema>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for RecentTransaction
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Recent transaction item
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Recent transaction item
|
|
11
|
-
*/
|
|
12
|
-
export const RecentTransactionSchema = z.object({
|
|
13
|
-
id: z.uuid(),
|
|
14
|
-
transaction_type: z.string(),
|
|
15
|
-
amount_usd: z.number(),
|
|
16
|
-
amount_display: z.string(),
|
|
17
|
-
balance_after: z.number(),
|
|
18
|
-
description: z.string(),
|
|
19
|
-
created_at: z.iso.datetime(),
|
|
20
|
-
payment_id: z.string().nullable(),
|
|
21
|
-
is_credit: z.boolean(),
|
|
22
|
-
is_debit: z.boolean(),
|
|
23
|
-
type_color: z.string(),
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Infer TypeScript type from Zod schema
|
|
28
|
-
*/
|
|
29
|
-
export type RecentTransaction = z.infer<typeof RecentTransactionSchema>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for Subscription
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Complete subscription serializer with full details.
|
|
6
|
-
|
|
7
|
-
Used for subscription detail views and updates.
|
|
8
|
-
* */
|
|
9
|
-
import { z } from 'zod'
|
|
10
|
-
import * as Enums from '../../enums'
|
|
11
|
-
import { EndpointGroupSchema } from './EndpointGroup.schema'
|
|
12
|
-
import { TariffSchema } from './Tariff.schema'
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Complete subscription serializer with full details.
|
|
16
|
-
|
|
17
|
-
Used for subscription detail views and updates.
|
|
18
|
-
*/
|
|
19
|
-
export const SubscriptionSchema = z.object({
|
|
20
|
-
id: z.uuid(),
|
|
21
|
-
user: z.string(),
|
|
22
|
-
tariff: TariffSchema,
|
|
23
|
-
endpoint_group: EndpointGroupSchema,
|
|
24
|
-
status: z.nativeEnum(Enums.SubscriptionStatus).optional(),
|
|
25
|
-
status_display: z.string(),
|
|
26
|
-
status_color: z.string(),
|
|
27
|
-
tier: z.nativeEnum(Enums.SubscriptionTier).optional(),
|
|
28
|
-
total_requests: z.int(),
|
|
29
|
-
usage_percentage: z.number(),
|
|
30
|
-
last_request_at: z.iso.datetime().nullable(),
|
|
31
|
-
expires_at: z.iso.datetime(),
|
|
32
|
-
is_active: z.boolean(),
|
|
33
|
-
is_expired: z.boolean(),
|
|
34
|
-
created_at: z.iso.datetime(),
|
|
35
|
-
updated_at: z.iso.datetime(),
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Infer TypeScript type from Zod schema
|
|
40
|
-
*/
|
|
41
|
-
export type Subscription = z.infer<typeof SubscriptionSchema>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for SubscriptionCreate
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Subscription creation serializer with service integration.
|
|
6
|
-
|
|
7
|
-
Validates input and delegates to SubscriptionService.
|
|
8
|
-
* */
|
|
9
|
-
import { z } from 'zod'
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Subscription creation serializer with service integration.
|
|
13
|
-
|
|
14
|
-
Validates input and delegates to SubscriptionService.
|
|
15
|
-
*/
|
|
16
|
-
export const SubscriptionCreateSchema = z.object({
|
|
17
|
-
tariff_id: z.int().min(1.0),
|
|
18
|
-
endpoint_group_id: z.int().min(1.0).nullable().optional(),
|
|
19
|
-
duration_days: z.int().min(1.0).max(365.0).optional(),
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Infer TypeScript type from Zod schema
|
|
24
|
-
*/
|
|
25
|
-
export type SubscriptionCreate = z.infer<typeof SubscriptionCreateSchema>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for SubscriptionCreateRequest
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Subscription creation serializer with service integration.
|
|
6
|
-
|
|
7
|
-
Validates input and delegates to SubscriptionService.
|
|
8
|
-
* */
|
|
9
|
-
import { z } from 'zod'
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Subscription creation serializer with service integration.
|
|
13
|
-
|
|
14
|
-
Validates input and delegates to SubscriptionService.
|
|
15
|
-
*/
|
|
16
|
-
export const SubscriptionCreateRequestSchema = z.object({
|
|
17
|
-
tariff_id: z.int().min(1.0),
|
|
18
|
-
endpoint_group_id: z.int().min(1.0).nullable().optional(),
|
|
19
|
-
duration_days: z.int().min(1.0).max(365.0).optional(),
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Infer TypeScript type from Zod schema
|
|
24
|
-
*/
|
|
25
|
-
export type SubscriptionCreateRequest = z.infer<typeof SubscriptionCreateRequestSchema>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for SubscriptionList
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Lightweight subscription serializer for lists.
|
|
6
|
-
|
|
7
|
-
Optimized for subscription lists with minimal data.
|
|
8
|
-
* */
|
|
9
|
-
import { z } from 'zod'
|
|
10
|
-
import * as Enums from '../../enums'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Lightweight subscription serializer for lists.
|
|
14
|
-
|
|
15
|
-
Optimized for subscription lists with minimal data.
|
|
16
|
-
*/
|
|
17
|
-
export const SubscriptionListSchema = z.object({
|
|
18
|
-
id: z.uuid(),
|
|
19
|
-
user: z.string(),
|
|
20
|
-
tariff_name: z.string(),
|
|
21
|
-
status: z.nativeEnum(Enums.SubscriptionListStatus),
|
|
22
|
-
status_display: z.string(),
|
|
23
|
-
is_active: z.boolean(),
|
|
24
|
-
is_expired: z.boolean(),
|
|
25
|
-
expires_at: z.iso.datetime(),
|
|
26
|
-
created_at: z.iso.datetime(),
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Infer TypeScript type from Zod schema
|
|
31
|
-
*/
|
|
32
|
-
export type SubscriptionList = z.infer<typeof SubscriptionListSchema>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for SubscriptionOverview
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Current subscription overview
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Current subscription overview
|
|
11
|
-
*/
|
|
12
|
-
export const SubscriptionOverviewSchema = z.object({
|
|
13
|
-
tier: z.string(),
|
|
14
|
-
tier_display: z.string(),
|
|
15
|
-
status: z.string(),
|
|
16
|
-
status_display: z.string(),
|
|
17
|
-
status_color: z.string(),
|
|
18
|
-
is_active: z.boolean(),
|
|
19
|
-
is_expired: z.boolean(),
|
|
20
|
-
days_remaining: z.int(),
|
|
21
|
-
requests_per_hour: z.int(),
|
|
22
|
-
requests_per_day: z.int(),
|
|
23
|
-
total_requests: z.int(),
|
|
24
|
-
usage_percentage: z.number(),
|
|
25
|
-
monthly_cost_usd: z.number(),
|
|
26
|
-
cost_display: z.string(),
|
|
27
|
-
starts_at: z.iso.datetime(),
|
|
28
|
-
expires_at: z.iso.datetime(),
|
|
29
|
-
last_request_at: z.iso.datetime().nullable(),
|
|
30
|
-
endpoint_groups_count: z.int(),
|
|
31
|
-
endpoint_groups: z.array(z.string()),
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Infer TypeScript type from Zod schema
|
|
36
|
-
*/
|
|
37
|
-
export type SubscriptionOverview = z.infer<typeof SubscriptionOverviewSchema>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for SubscriptionRequest
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Complete subscription serializer with full details.
|
|
6
|
-
|
|
7
|
-
Used for subscription detail views and updates.
|
|
8
|
-
* */
|
|
9
|
-
import { z } from 'zod'
|
|
10
|
-
import * as Enums from '../../enums'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Complete subscription serializer with full details.
|
|
14
|
-
|
|
15
|
-
Used for subscription detail views and updates.
|
|
16
|
-
*/
|
|
17
|
-
export const SubscriptionRequestSchema = z.object({
|
|
18
|
-
status: z.nativeEnum(Enums.SubscriptionRequestStatus).optional(),
|
|
19
|
-
tier: z.nativeEnum(Enums.SubscriptionRequestTier).optional(),
|
|
20
|
-
expires_at: z.iso.datetime(),
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Infer TypeScript type from Zod schema
|
|
25
|
-
*/
|
|
26
|
-
export type SubscriptionRequest = z.infer<typeof SubscriptionRequestSchema>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for SupportedCurrencies
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Supported currencies serializer for provider capabilities.
|
|
6
|
-
|
|
7
|
-
Gets supported currencies from providers through CurrencyService.
|
|
8
|
-
* */
|
|
9
|
-
import { z } from 'zod'
|
|
10
|
-
import * as Enums from '../../enums'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Supported currencies serializer for provider capabilities.
|
|
14
|
-
|
|
15
|
-
Gets supported currencies from providers through CurrencyService.
|
|
16
|
-
*/
|
|
17
|
-
export const SupportedCurrenciesSchema = z.object({
|
|
18
|
-
provider: z.nativeEnum(Enums.SupportedCurrenciesProvider).optional(),
|
|
19
|
-
currency_type: z.nativeEnum(Enums.SupportedCurrenciesCurrencyType).optional(),
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Infer TypeScript type from Zod schema
|
|
24
|
-
*/
|
|
25
|
-
export type SupportedCurrencies = z.infer<typeof SupportedCurrenciesSchema>
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for SupportedProviders
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Serializer for supported providers response.
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Serializer for supported providers response.
|
|
11
|
-
*/
|
|
12
|
-
export const SupportedProvidersSchema = z.object({
|
|
13
|
-
success: z.boolean(),
|
|
14
|
-
providers: z.string(),
|
|
15
|
-
total_count: z.int(),
|
|
16
|
-
timestamp: z.iso.datetime(),
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Infer TypeScript type from Zod schema
|
|
21
|
-
*/
|
|
22
|
-
export type SupportedProviders = z.infer<typeof SupportedProvidersSchema>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for Tariff
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Tariff serializer for subscription pricing.
|
|
6
|
-
|
|
7
|
-
Used for tariff information and selection.
|
|
8
|
-
* */
|
|
9
|
-
import { z } from 'zod'
|
|
10
|
-
import { EndpointGroupSchema } from './EndpointGroup.schema'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Tariff serializer for subscription pricing.
|
|
14
|
-
|
|
15
|
-
Used for tariff information and selection.
|
|
16
|
-
*/
|
|
17
|
-
export const TariffSchema = z.object({
|
|
18
|
-
id: z.int(),
|
|
19
|
-
name: z.string(),
|
|
20
|
-
description: z.string(),
|
|
21
|
-
monthly_price_usd: z.number(),
|
|
22
|
-
requests_per_month: z.int(),
|
|
23
|
-
requests_per_hour: z.int(),
|
|
24
|
-
is_active: z.boolean(),
|
|
25
|
-
endpoint_groups: z.array(EndpointGroupSchema),
|
|
26
|
-
endpoint_groups_count: z.int(),
|
|
27
|
-
created_at: z.iso.datetime(),
|
|
28
|
-
updated_at: z.iso.datetime(),
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Infer TypeScript type from Zod schema
|
|
33
|
-
*/
|
|
34
|
-
export type Tariff = z.infer<typeof TariffSchema>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for Transaction
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Transaction serializer with full details.
|
|
6
|
-
|
|
7
|
-
Used for transaction history and details.
|
|
8
|
-
* */
|
|
9
|
-
import { z } from 'zod'
|
|
10
|
-
import * as Enums from '../../enums'
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Transaction serializer with full details.
|
|
14
|
-
|
|
15
|
-
Used for transaction history and details.
|
|
16
|
-
*/
|
|
17
|
-
export const TransactionSchema = z.object({
|
|
18
|
-
id: z.uuid(),
|
|
19
|
-
user: z.string(),
|
|
20
|
-
amount_usd: z.number(),
|
|
21
|
-
amount_display: z.string(),
|
|
22
|
-
transaction_type: z.nativeEnum(Enums.TransactionTransactionType),
|
|
23
|
-
type_color: z.string(),
|
|
24
|
-
description: z.string(),
|
|
25
|
-
payment_id: z.string().nullable(),
|
|
26
|
-
metadata: z.string(),
|
|
27
|
-
is_credit: z.boolean(),
|
|
28
|
-
is_debit: z.boolean(),
|
|
29
|
-
created_at: z.iso.datetime(),
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Infer TypeScript type from Zod schema
|
|
34
|
-
*/
|
|
35
|
-
export type Transaction = z.infer<typeof TransactionSchema>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for UserBalance
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * User balance serializer with computed fields.
|
|
6
|
-
|
|
7
|
-
Provides balance information with display helpers.
|
|
8
|
-
* */
|
|
9
|
-
import { z } from 'zod'
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* User balance serializer with computed fields.
|
|
13
|
-
|
|
14
|
-
Provides balance information with display helpers.
|
|
15
|
-
*/
|
|
16
|
-
export const UserBalanceSchema = z.object({
|
|
17
|
-
user: z.string(),
|
|
18
|
-
balance_usd: z.number(),
|
|
19
|
-
balance_display: z.string(),
|
|
20
|
-
is_empty: z.boolean(),
|
|
21
|
-
has_transactions: z.boolean(),
|
|
22
|
-
created_at: z.iso.datetime(),
|
|
23
|
-
updated_at: z.iso.datetime(),
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Infer TypeScript type from Zod schema
|
|
28
|
-
*/
|
|
29
|
-
export type UserBalance = z.infer<typeof UserBalanceSchema>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for WebhookEvent
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Serializer for individual webhook event.
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
import * as Enums from '../../enums'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Serializer for individual webhook event.
|
|
12
|
-
*/
|
|
13
|
-
export const WebhookEventSchema = z.object({
|
|
14
|
-
id: z.int(),
|
|
15
|
-
provider: z.string().max(50),
|
|
16
|
-
event_type: z.string().max(100),
|
|
17
|
-
status: z.nativeEnum(Enums.WebhookEventStatus),
|
|
18
|
-
timestamp: z.iso.datetime(),
|
|
19
|
-
payload_size: z.int(),
|
|
20
|
-
response_time: z.int(),
|
|
21
|
-
retry_count: z.int().optional(),
|
|
22
|
-
error_message: z.string().max(500).optional(),
|
|
23
|
-
payload_preview: z.string().max(200).optional(),
|
|
24
|
-
response_status_code: z.int().optional(),
|
|
25
|
-
webhook_url: z.url().optional(),
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Infer TypeScript type from Zod schema
|
|
30
|
-
*/
|
|
31
|
-
export type WebhookEvent = z.infer<typeof WebhookEventSchema>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for WebhookEventList
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Serializer for paginated webhook events list.
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
import { WebhookEventSchema } from './WebhookEvent.schema'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Serializer for paginated webhook events list.
|
|
12
|
-
*/
|
|
13
|
-
export const WebhookEventListSchema = z.object({
|
|
14
|
-
events: z.array(WebhookEventSchema),
|
|
15
|
-
total: z.int(),
|
|
16
|
-
page: z.int(),
|
|
17
|
-
per_page: z.int(),
|
|
18
|
-
has_next: z.boolean(),
|
|
19
|
-
has_previous: z.boolean(),
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Infer TypeScript type from Zod schema
|
|
24
|
-
*/
|
|
25
|
-
export type WebhookEventList = z.infer<typeof WebhookEventListSchema>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Zod schema for WebhookEventListRequest
|
|
3
|
-
*
|
|
4
|
-
* This schema provides runtime validation and type inference.
|
|
5
|
-
* * Serializer for paginated webhook events list.
|
|
6
|
-
* */
|
|
7
|
-
import { z } from 'zod'
|
|
8
|
-
import { WebhookEventRequestSchema } from './WebhookEventRequest.schema'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Serializer for paginated webhook events list.
|
|
12
|
-
*/
|
|
13
|
-
export const WebhookEventListRequestSchema = z.object({
|
|
14
|
-
events: z.array(WebhookEventRequestSchema),
|
|
15
|
-
total: z.int(),
|
|
16
|
-
page: z.int(),
|
|
17
|
-
per_page: z.int(),
|
|
18
|
-
has_next: z.boolean(),
|
|
19
|
-
has_previous: z.boolean(),
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Infer TypeScript type from Zod schema
|
|
24
|
-
*/
|
|
25
|
-
export type WebhookEventListRequest = z.infer<typeof WebhookEventListRequestSchema>
|