@forklaunch/implementation-billing-base 0.1.12 → 0.1.14
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/lib/__test__/schemaEquality.test.d.ts +2 -0
- package/lib/__test__/schemaEquality.test.d.ts.map +1 -0
- package/lib/__test__/schemaEquality.test.js +409 -0
- package/lib/eject/domain/schemas/billingPortal.schema.ts +31 -0
- package/lib/eject/domain/schemas/checkoutSession.schema.ts +55 -0
- package/lib/eject/domain/schemas/index.ts +5 -0
- package/lib/eject/domain/schemas/paymentLink.schema.ts +60 -0
- package/lib/eject/domain/schemas/plan.schema.ts +80 -0
- package/lib/eject/domain/schemas/subscription.schema.ts +86 -0
- package/lib/eject/services/billingPortal.service.ts +145 -0
- package/lib/eject/services/checkoutSession.service.ts +132 -0
- package/lib/eject/services/index.ts +5 -0
- package/lib/eject/services/paymentLink.service.ts +170 -0
- package/lib/eject/services/plan.service.ts +132 -0
- package/lib/eject/services/subscription.service.ts +239 -0
- package/lib/jest.config.d.ts +4 -0
- package/lib/jest.config.d.ts.map +1 -0
- package/lib/jest.config.js +19 -0
- package/lib/schemas/billingPortal.schema.d.ts +123 -0
- package/lib/schemas/billingPortal.schema.d.ts.map +1 -0
- package/lib/schemas/billingPortal.schema.js +7 -0
- package/lib/schemas/checkoutSession.schema.d.ts +179 -0
- package/lib/schemas/checkoutSession.schema.d.ts.map +1 -0
- package/lib/schemas/checkoutSession.schema.js +7 -0
- package/lib/schemas/index.d.ts +6 -0
- package/lib/schemas/index.d.ts.map +1 -0
- package/lib/schemas/index.js +5 -0
- package/lib/schemas/paymentLink.schema.d.ts +220 -0
- package/lib/schemas/paymentLink.schema.d.ts.map +1 -0
- package/lib/schemas/paymentLink.schema.js +7 -0
- package/lib/schemas/plan.schema.d.ts +336 -0
- package/lib/schemas/plan.schema.d.ts.map +1 -0
- package/lib/schemas/plan.schema.js +7 -0
- package/lib/schemas/subscription.schema.d.ts +374 -0
- package/lib/schemas/subscription.schema.d.ts.map +1 -0
- package/lib/schemas/subscription.schema.js +7 -0
- package/lib/schemas/typebox/billingPortal.schema.d.ts +181 -0
- package/lib/schemas/typebox/billingPortal.schema.d.ts.map +1 -0
- package/lib/schemas/typebox/billingPortal.schema.js +31 -0
- package/lib/schemas/typebox/checkoutSession.schema.d.ts +204 -0
- package/lib/schemas/typebox/checkoutSession.schema.d.ts.map +1 -0
- package/lib/schemas/typebox/checkoutSession.schema.js +44 -0
- package/lib/schemas/typebox/paymentLink.schema.d.ts +282 -0
- package/lib/schemas/typebox/paymentLink.schema.d.ts.map +1 -0
- package/lib/schemas/typebox/paymentLink.schema.js +49 -0
- package/lib/schemas/typebox/plan.schema.d.ts +416 -0
- package/lib/schemas/typebox/plan.schema.d.ts.map +1 -0
- package/lib/schemas/typebox/plan.schema.js +57 -0
- package/lib/schemas/typebox/subscription.schema.d.ts +488 -0
- package/lib/schemas/typebox/subscription.schema.d.ts.map +1 -0
- package/lib/schemas/typebox/subscription.schema.js +61 -0
- package/lib/schemas/zod/billingPortal.schema.d.ts +51 -0
- package/lib/schemas/zod/billingPortal.schema.d.ts.map +1 -0
- package/lib/schemas/zod/billingPortal.schema.js +31 -0
- package/lib/schemas/zod/checkoutSession.schema.d.ts +114 -0
- package/lib/schemas/zod/checkoutSession.schema.d.ts.map +1 -0
- package/lib/schemas/zod/checkoutSession.schema.js +44 -0
- package/lib/schemas/zod/paymentLink.schema.d.ts +106 -0
- package/lib/schemas/zod/paymentLink.schema.d.ts.map +1 -0
- package/lib/schemas/zod/paymentLink.schema.js +49 -0
- package/lib/schemas/zod/plan.schema.d.ts +184 -0
- package/lib/schemas/zod/plan.schema.d.ts.map +1 -0
- package/lib/schemas/zod/plan.schema.js +57 -0
- package/lib/schemas/zod/subscription.schema.d.ts +188 -0
- package/lib/schemas/zod/subscription.schema.d.ts.map +1 -0
- package/lib/schemas/zod/subscription.schema.js +61 -0
- package/lib/services/billingPortal.service.d.ts +94 -0
- package/lib/services/billingPortal.service.d.ts.map +1 -0
- package/lib/services/billingPortal.service.js +70 -0
- package/lib/services/checkoutSession.service.d.ts +94 -0
- package/lib/services/checkoutSession.service.d.ts.map +1 -0
- package/lib/services/checkoutSession.service.js +60 -0
- package/lib/services/index.d.ts +6 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +5 -0
- package/lib/services/paymentLink.service.d.ts +99 -0
- package/lib/services/paymentLink.service.d.ts.map +1 -0
- package/lib/services/paymentLink.service.js +90 -0
- package/lib/services/plan.service.d.ts +90 -0
- package/lib/services/plan.service.d.ts.map +1 -0
- package/lib/services/plan.service.js +48 -0
- package/lib/services/subscription.service.d.ts +145 -0
- package/lib/services/subscription.service.d.ts.map +1 -0
- package/lib/services/subscription.service.js +117 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/vitest.config.d.ts +3 -0
- package/lib/vitest.config.d.ts.map +1 -0
- package/lib/vitest.config.js +7 -0
- package/package.json +8 -8
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { IdDto, InstanceTypeRecord } from '@forklaunch/common';
|
|
2
|
+
import {
|
|
3
|
+
InternalDtoMapper,
|
|
4
|
+
RequestDtoMapperConstructor,
|
|
5
|
+
ResponseDtoMapperConstructor,
|
|
6
|
+
transformIntoInternalDtoMapper
|
|
7
|
+
} from '@forklaunch/core/mappers';
|
|
8
|
+
import {
|
|
9
|
+
MetricsDefinition,
|
|
10
|
+
OpenTelemetryCollector
|
|
11
|
+
} from '@forklaunch/core/http';
|
|
12
|
+
import { SubscriptionService } from '@forklaunch/interfaces-billing/interfaces';
|
|
13
|
+
import {
|
|
14
|
+
CreateSubscriptionDto,
|
|
15
|
+
SubscriptionDto,
|
|
16
|
+
UpdateSubscriptionDto
|
|
17
|
+
} from '@forklaunch/interfaces-billing/types';
|
|
18
|
+
import { AnySchemaValidator } from '@forklaunch/validator';
|
|
19
|
+
import { EntityManager } from '@mikro-orm/core';
|
|
20
|
+
|
|
21
|
+
export class BaseSubscriptionService<
|
|
22
|
+
SchemaValidator extends AnySchemaValidator,
|
|
23
|
+
PartyType,
|
|
24
|
+
BillingProviderType,
|
|
25
|
+
Metrics extends MetricsDefinition = MetricsDefinition,
|
|
26
|
+
Dto extends {
|
|
27
|
+
SubscriptionDtoMapper: SubscriptionDto<PartyType, BillingProviderType>;
|
|
28
|
+
CreateSubscriptionDtoMapper: CreateSubscriptionDto<
|
|
29
|
+
PartyType,
|
|
30
|
+
BillingProviderType
|
|
31
|
+
>;
|
|
32
|
+
UpdateSubscriptionDtoMapper: UpdateSubscriptionDto<
|
|
33
|
+
PartyType,
|
|
34
|
+
BillingProviderType
|
|
35
|
+
>;
|
|
36
|
+
} = {
|
|
37
|
+
SubscriptionDtoMapper: SubscriptionDto<PartyType, BillingProviderType>;
|
|
38
|
+
CreateSubscriptionDtoMapper: CreateSubscriptionDto<
|
|
39
|
+
PartyType,
|
|
40
|
+
BillingProviderType
|
|
41
|
+
>;
|
|
42
|
+
UpdateSubscriptionDtoMapper: UpdateSubscriptionDto<
|
|
43
|
+
PartyType,
|
|
44
|
+
BillingProviderType
|
|
45
|
+
>;
|
|
46
|
+
},
|
|
47
|
+
Entities extends {
|
|
48
|
+
SubscriptionDtoMapper: SubscriptionDto<PartyType, BillingProviderType>;
|
|
49
|
+
CreateSubscriptionDtoMapper: SubscriptionDto<
|
|
50
|
+
PartyType,
|
|
51
|
+
BillingProviderType
|
|
52
|
+
>;
|
|
53
|
+
UpdateSubscriptionDtoMapper: SubscriptionDto<
|
|
54
|
+
PartyType,
|
|
55
|
+
BillingProviderType
|
|
56
|
+
>;
|
|
57
|
+
} = {
|
|
58
|
+
SubscriptionDtoMapper: SubscriptionDto<PartyType, BillingProviderType>;
|
|
59
|
+
CreateSubscriptionDtoMapper: SubscriptionDto<
|
|
60
|
+
PartyType,
|
|
61
|
+
BillingProviderType
|
|
62
|
+
>;
|
|
63
|
+
UpdateSubscriptionDtoMapper: SubscriptionDto<
|
|
64
|
+
PartyType,
|
|
65
|
+
BillingProviderType
|
|
66
|
+
>;
|
|
67
|
+
}
|
|
68
|
+
> implements SubscriptionService<PartyType, BillingProviderType>
|
|
69
|
+
{
|
|
70
|
+
#mapperss: InternalDtoMapper<
|
|
71
|
+
InstanceTypeRecord<typeof this.mapperss>,
|
|
72
|
+
Entities,
|
|
73
|
+
Dto
|
|
74
|
+
>;
|
|
75
|
+
|
|
76
|
+
constructor(
|
|
77
|
+
protected em: EntityManager,
|
|
78
|
+
protected readonly openTelemetryCollector: OpenTelemetryCollector<Metrics>,
|
|
79
|
+
protected readonly schemaValidator: SchemaValidator,
|
|
80
|
+
protected readonly mapperss: {
|
|
81
|
+
SubscriptionDtoMapper: ResponseDtoMapperConstructor<
|
|
82
|
+
SchemaValidator,
|
|
83
|
+
Dto['SubscriptionDtoMapper'],
|
|
84
|
+
Entities['SubscriptionDtoMapper']
|
|
85
|
+
>;
|
|
86
|
+
CreateSubscriptionDtoMapper: RequestDtoMapperConstructor<
|
|
87
|
+
SchemaValidator,
|
|
88
|
+
Dto['CreateSubscriptionDtoMapper'],
|
|
89
|
+
Entities['CreateSubscriptionDtoMapper']
|
|
90
|
+
>;
|
|
91
|
+
UpdateSubscriptionDtoMapper: RequestDtoMapperConstructor<
|
|
92
|
+
SchemaValidator,
|
|
93
|
+
Dto['UpdateSubscriptionDtoMapper'],
|
|
94
|
+
Entities['UpdateSubscriptionDtoMapper']
|
|
95
|
+
>;
|
|
96
|
+
}
|
|
97
|
+
) {
|
|
98
|
+
this.#mapperss = transformIntoInternalDtoMapper<
|
|
99
|
+
SchemaValidator,
|
|
100
|
+
typeof this.mapperss,
|
|
101
|
+
Entities,
|
|
102
|
+
Dto
|
|
103
|
+
>(mapperss, this.schemaValidator);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async createSubscription(
|
|
107
|
+
subscriptionDto: Dto['CreateSubscriptionDtoMapper'],
|
|
108
|
+
em?: EntityManager
|
|
109
|
+
): Promise<Dto['SubscriptionDtoMapper']> {
|
|
110
|
+
const subscription =
|
|
111
|
+
this.#mapperss.CreateSubscriptionDtoMapper.deserializeDtoToEntity(
|
|
112
|
+
subscriptionDto
|
|
113
|
+
);
|
|
114
|
+
await (em ?? this.em).transactional(async (innerEm) => {
|
|
115
|
+
await innerEm.persist(subscription);
|
|
116
|
+
});
|
|
117
|
+
const createdSubscriptionDto =
|
|
118
|
+
this.#mapperss.SubscriptionDtoMapper.serializeEntityToDto(subscription);
|
|
119
|
+
return createdSubscriptionDto;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async getSubscription(
|
|
123
|
+
idDto: IdDto,
|
|
124
|
+
em?: EntityManager
|
|
125
|
+
): Promise<Dto['SubscriptionDtoMapper']> {
|
|
126
|
+
const subscription = await (em ?? this.em).findOneOrFail(
|
|
127
|
+
'Subscription',
|
|
128
|
+
idDto
|
|
129
|
+
);
|
|
130
|
+
return this.#mapperss.SubscriptionDtoMapper.serializeEntityToDto(
|
|
131
|
+
subscription as Entities['SubscriptionDtoMapper']
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async getUserSubscription(
|
|
136
|
+
{ id }: IdDto,
|
|
137
|
+
em?: EntityManager
|
|
138
|
+
): Promise<Dto['SubscriptionDtoMapper']> {
|
|
139
|
+
const subscription = await (em ?? this.em).findOneOrFail('Subscription', {
|
|
140
|
+
partyId: id,
|
|
141
|
+
partyType: 'USER',
|
|
142
|
+
active: true
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
return this.#mapperss.SubscriptionDtoMapper.serializeEntityToDto(
|
|
146
|
+
subscription as Entities['SubscriptionDtoMapper']
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async getOrganizationSubscription(
|
|
151
|
+
{ id }: IdDto,
|
|
152
|
+
em?: EntityManager
|
|
153
|
+
): Promise<Dto['SubscriptionDtoMapper']> {
|
|
154
|
+
const subscription = await (em ?? this.em).findOneOrFail('Subscription', {
|
|
155
|
+
partyId: id,
|
|
156
|
+
partyType: 'ORGANIZATION',
|
|
157
|
+
active: true
|
|
158
|
+
});
|
|
159
|
+
return this.#mapperss.SubscriptionDtoMapper.serializeEntityToDto(
|
|
160
|
+
subscription as Entities['SubscriptionDtoMapper']
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async updateSubscription(
|
|
165
|
+
subscriptionDto: Dto['UpdateSubscriptionDtoMapper'],
|
|
166
|
+
em?: EntityManager
|
|
167
|
+
): Promise<Dto['SubscriptionDtoMapper']> {
|
|
168
|
+
const subscription =
|
|
169
|
+
this.#mapperss.UpdateSubscriptionDtoMapper.deserializeDtoToEntity(
|
|
170
|
+
subscriptionDto
|
|
171
|
+
);
|
|
172
|
+
const updatedSubscription = await (em ?? this.em).upsert(subscription);
|
|
173
|
+
await (em ?? this.em).transactional(async (innerEm) => {
|
|
174
|
+
await innerEm.persist(updatedSubscription);
|
|
175
|
+
});
|
|
176
|
+
const updatedSubscriptionDto =
|
|
177
|
+
this.#mapperss.SubscriptionDtoMapper.serializeEntityToDto(
|
|
178
|
+
updatedSubscription
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
return updatedSubscriptionDto;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
async deleteSubscription(
|
|
185
|
+
idDto: { id: string },
|
|
186
|
+
em?: EntityManager
|
|
187
|
+
): Promise<void> {
|
|
188
|
+
const subscription = await (em ?? this.em).findOne('Subscription', idDto);
|
|
189
|
+
if (!subscription) {
|
|
190
|
+
throw new Error('Subscription not found');
|
|
191
|
+
}
|
|
192
|
+
await (em ?? this.em).removeAndFlush(subscription);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
async listSubscriptions(
|
|
196
|
+
idsDto: { ids?: string[] },
|
|
197
|
+
em?: EntityManager
|
|
198
|
+
): Promise<Dto['SubscriptionDtoMapper'][]> {
|
|
199
|
+
const subscriptions = await (em ?? this.em).findAll('Subscription', {
|
|
200
|
+
where: idsDto.ids
|
|
201
|
+
? {
|
|
202
|
+
id: {
|
|
203
|
+
$in: idsDto.ids
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
: undefined
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
return subscriptions.map((subscription) => {
|
|
210
|
+
const subscriptionDto =
|
|
211
|
+
this.#mapperss.SubscriptionDtoMapper.serializeEntityToDto(
|
|
212
|
+
subscription as Entities['SubscriptionDtoMapper']
|
|
213
|
+
);
|
|
214
|
+
return subscriptionDto;
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
async cancelSubscription(idDto: IdDto, em?: EntityManager): Promise<void> {
|
|
219
|
+
const subscription = await (em ?? this.em).findOne('Subscription', idDto);
|
|
220
|
+
if (!subscription) {
|
|
221
|
+
throw new Error('Subscription not found');
|
|
222
|
+
}
|
|
223
|
+
(subscription as Entities['SubscriptionDtoMapper']).active = false;
|
|
224
|
+
await (em ?? this.em).transactional(async (innerEm) => {
|
|
225
|
+
await innerEm.persist(subscription);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
async resumeSubscription(idDto: IdDto, em?: EntityManager): Promise<void> {
|
|
230
|
+
const subscription = await (em ?? this.em).findOne('Subscription', idDto);
|
|
231
|
+
if (!subscription) {
|
|
232
|
+
throw new Error('Subscription not found');
|
|
233
|
+
}
|
|
234
|
+
(subscription as Entities['SubscriptionDtoMapper']).active = true;
|
|
235
|
+
await (em ?? this.em).transactional(async (innerEm) => {
|
|
236
|
+
await innerEm.persist(subscription);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest.config.d.ts","sourceRoot":"","sources":["../jest.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,QAAA,MAAM,UAAU,EAAE,oBAiBjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const jestConfig = {
|
|
2
|
+
preset: 'ts-jest/presets/default-esm', // or other ESM presets
|
|
3
|
+
moduleNameMapper: {
|
|
4
|
+
'^(\\.{1,2}/.*)\\.js$': '$1'
|
|
5
|
+
},
|
|
6
|
+
transform: {
|
|
7
|
+
// '^.+\\.[tj]sx?$' to process ts,js,tsx,jsx with `ts-jest`
|
|
8
|
+
// '^.+\\.m?[tj]sx?$' to process ts,js,tsx,jsx,mts,mjs,mtsx,mjsx with `ts-jest`
|
|
9
|
+
'^.+\\.[tj]sx?$': [
|
|
10
|
+
'ts-jest',
|
|
11
|
+
{
|
|
12
|
+
useESM: true
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
'^.+\\.js$': 'babel-jest'
|
|
16
|
+
},
|
|
17
|
+
testPathIgnorePatterns: ['.*dist/', '.*node_modules/']
|
|
18
|
+
};
|
|
19
|
+
export default jestConfig;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
export declare const BaseBillingPortalServiceSchemas: <
|
|
2
|
+
SchemaValidator extends import('@forklaunch/validator').AnySchemaValidator
|
|
3
|
+
>(
|
|
4
|
+
options: {
|
|
5
|
+
uuidId: boolean;
|
|
6
|
+
} & {
|
|
7
|
+
validator: SchemaValidator;
|
|
8
|
+
}
|
|
9
|
+
) => import('@forklaunch/core/mappers').SchemasByValidator<
|
|
10
|
+
SchemaValidator,
|
|
11
|
+
(options: {
|
|
12
|
+
uuidId: boolean;
|
|
13
|
+
}) => {
|
|
14
|
+
CreateBillingPortalSchema: {
|
|
15
|
+
customerId: import('@sinclair/typebox').TString;
|
|
16
|
+
uri: import('@sinclair/typebox').TString;
|
|
17
|
+
expiresAt: import('@sinclair/typebox').TTransform<
|
|
18
|
+
import('@sinclair/typebox').TUnion<
|
|
19
|
+
[
|
|
20
|
+
import('@sinclair/typebox').TDate,
|
|
21
|
+
import('@sinclair/typebox').TNumber,
|
|
22
|
+
import('@sinclair/typebox').TString,
|
|
23
|
+
import('@sinclair/typebox').TBoolean,
|
|
24
|
+
import('@sinclair/typebox').TNull
|
|
25
|
+
]
|
|
26
|
+
>,
|
|
27
|
+
Date
|
|
28
|
+
>;
|
|
29
|
+
};
|
|
30
|
+
UpdateBillingPortalSchema: {
|
|
31
|
+
id: import('@sinclair/typebox').TString;
|
|
32
|
+
uri: import('@sinclair/typebox').TOptional<
|
|
33
|
+
import('@sinclair/typebox').TString
|
|
34
|
+
>;
|
|
35
|
+
expiresAt: import('@sinclair/typebox').TOptional<
|
|
36
|
+
import('@sinclair/typebox').TTransform<
|
|
37
|
+
import('@sinclair/typebox').TUnion<
|
|
38
|
+
[
|
|
39
|
+
import('@sinclair/typebox').TDate,
|
|
40
|
+
import('@sinclair/typebox').TNumber,
|
|
41
|
+
import('@sinclair/typebox').TString,
|
|
42
|
+
import('@sinclair/typebox').TBoolean,
|
|
43
|
+
import('@sinclair/typebox').TNull
|
|
44
|
+
]
|
|
45
|
+
>,
|
|
46
|
+
Date
|
|
47
|
+
>
|
|
48
|
+
>;
|
|
49
|
+
};
|
|
50
|
+
BillingPortalSchema: {
|
|
51
|
+
id: import('@sinclair/typebox').TString;
|
|
52
|
+
customerId: import('@sinclair/typebox').TString;
|
|
53
|
+
uri: import('@sinclair/typebox').TString;
|
|
54
|
+
expiresAt: import('@sinclair/typebox').TTransform<
|
|
55
|
+
import('@sinclair/typebox').TUnion<
|
|
56
|
+
[
|
|
57
|
+
import('@sinclair/typebox').TDate,
|
|
58
|
+
import('@sinclair/typebox').TNumber,
|
|
59
|
+
import('@sinclair/typebox').TString,
|
|
60
|
+
import('@sinclair/typebox').TBoolean,
|
|
61
|
+
import('@sinclair/typebox').TNull
|
|
62
|
+
]
|
|
63
|
+
>,
|
|
64
|
+
Date
|
|
65
|
+
>;
|
|
66
|
+
extraFields: import('@sinclair/typebox').TOptional<
|
|
67
|
+
import('@sinclair/typebox').TUnknown
|
|
68
|
+
>;
|
|
69
|
+
createdAt: import('@sinclair/typebox').TOptional<
|
|
70
|
+
import('@sinclair/typebox').TTransform<
|
|
71
|
+
import('@sinclair/typebox').TUnion<
|
|
72
|
+
[
|
|
73
|
+
import('@sinclair/typebox').TDate,
|
|
74
|
+
import('@sinclair/typebox').TNumber,
|
|
75
|
+
import('@sinclair/typebox').TString,
|
|
76
|
+
import('@sinclair/typebox').TBoolean,
|
|
77
|
+
import('@sinclair/typebox').TNull
|
|
78
|
+
]
|
|
79
|
+
>,
|
|
80
|
+
Date
|
|
81
|
+
>
|
|
82
|
+
>;
|
|
83
|
+
updatedAt: import('@sinclair/typebox').TOptional<
|
|
84
|
+
import('@sinclair/typebox').TTransform<
|
|
85
|
+
import('@sinclair/typebox').TUnion<
|
|
86
|
+
[
|
|
87
|
+
import('@sinclair/typebox').TDate,
|
|
88
|
+
import('@sinclair/typebox').TNumber,
|
|
89
|
+
import('@sinclair/typebox').TString,
|
|
90
|
+
import('@sinclair/typebox').TBoolean,
|
|
91
|
+
import('@sinclair/typebox').TNull
|
|
92
|
+
]
|
|
93
|
+
>,
|
|
94
|
+
Date
|
|
95
|
+
>
|
|
96
|
+
>;
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
(options: {
|
|
100
|
+
uuidId: boolean;
|
|
101
|
+
}) => {
|
|
102
|
+
CreateBillingPortalSchema: {
|
|
103
|
+
customerId: import('zod').ZodString;
|
|
104
|
+
uri: import('zod').ZodString;
|
|
105
|
+
expiresAt: import('zod').ZodDate;
|
|
106
|
+
};
|
|
107
|
+
UpdateBillingPortalSchema: {
|
|
108
|
+
id: import('zod').ZodString;
|
|
109
|
+
uri: import('zod').ZodOptional<import('zod').ZodString>;
|
|
110
|
+
expiresAt: import('zod').ZodOptional<import('zod').ZodDate>;
|
|
111
|
+
};
|
|
112
|
+
BillingPortalSchema: {
|
|
113
|
+
id: import('zod').ZodString;
|
|
114
|
+
customerId: import('zod').ZodString;
|
|
115
|
+
uri: import('zod').ZodString;
|
|
116
|
+
expiresAt: import('zod').ZodDate;
|
|
117
|
+
extraFields: import('zod').ZodOptional<import('zod').ZodUnknown>;
|
|
118
|
+
createdAt: import('zod').ZodOptional<import('zod').ZodDate>;
|
|
119
|
+
updatedAt: import('zod').ZodOptional<import('zod').ZodDate>;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
>;
|
|
123
|
+
//# sourceMappingURL=billingPortal.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billingPortal.schema.d.ts","sourceRoot":"","sources":["../../schemas/billingPortal.schema.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG3C,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { serviceSchemaResolver } from '@forklaunch/core/mappers';
|
|
2
|
+
import { BaseBillingPortalServiceSchemas as TypeBoxSchemas } from './typebox/billingPortal.schema';
|
|
3
|
+
import { BaseBillingPortalServiceSchemas as ZodSchemas } from './zod/billingPortal.schema';
|
|
4
|
+
export const BaseBillingPortalServiceSchemas = serviceSchemaResolver(
|
|
5
|
+
TypeBoxSchemas,
|
|
6
|
+
ZodSchemas
|
|
7
|
+
);
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
export declare const BaseCheckoutSessionServiceSchemas: <
|
|
2
|
+
SchemaValidator extends import('@forklaunch/validator').AnySchemaValidator
|
|
3
|
+
>(
|
|
4
|
+
options: {
|
|
5
|
+
uuidId: boolean;
|
|
6
|
+
} & {
|
|
7
|
+
validator: SchemaValidator;
|
|
8
|
+
}
|
|
9
|
+
) => import('@forklaunch/core/mappers').SchemasByValidator<
|
|
10
|
+
SchemaValidator,
|
|
11
|
+
(options: {
|
|
12
|
+
uuidId: boolean;
|
|
13
|
+
}) => {
|
|
14
|
+
CreateCheckoutSessionSchema: <
|
|
15
|
+
T extends Record<string, import('@forklaunch/validator').LiteralSchema>
|
|
16
|
+
>(
|
|
17
|
+
PaymentMethodEnum: T
|
|
18
|
+
) => {
|
|
19
|
+
customerId: import('@sinclair/typebox').TString;
|
|
20
|
+
paymentMethods: import('@sinclair/typebox').TArray<
|
|
21
|
+
import('@sinclair/typebox').TUnion<
|
|
22
|
+
[
|
|
23
|
+
{
|
|
24
|
+
[K in keyof T]: import('@sinclair/typebox').TLiteral<T[K]>;
|
|
25
|
+
}[keyof T]
|
|
26
|
+
]
|
|
27
|
+
>
|
|
28
|
+
>;
|
|
29
|
+
successRedirectUri: import('@sinclair/typebox').TString;
|
|
30
|
+
cancelRedirectUri: import('@sinclair/typebox').TString;
|
|
31
|
+
extraFields: import('@sinclair/typebox').TOptional<
|
|
32
|
+
import('@sinclair/typebox').TUnknown
|
|
33
|
+
>;
|
|
34
|
+
};
|
|
35
|
+
UpdateCheckoutSessionSchema: <
|
|
36
|
+
T extends Record<string, import('@forklaunch/validator').LiteralSchema>
|
|
37
|
+
>(
|
|
38
|
+
PaymentMethodEnum: T
|
|
39
|
+
) => {
|
|
40
|
+
id: import('@sinclair/typebox').TString;
|
|
41
|
+
customerId: import('@sinclair/typebox').TOptional<
|
|
42
|
+
import('@sinclair/typebox').TString
|
|
43
|
+
>;
|
|
44
|
+
paymentMethods: import('@sinclair/typebox').TOptional<
|
|
45
|
+
import('@sinclair/typebox').TArray<
|
|
46
|
+
import('@sinclair/typebox').TUnion<
|
|
47
|
+
[
|
|
48
|
+
{
|
|
49
|
+
[K in keyof T]: import('@sinclair/typebox').TLiteral<T[K]>;
|
|
50
|
+
}[keyof T]
|
|
51
|
+
]
|
|
52
|
+
>
|
|
53
|
+
>
|
|
54
|
+
>;
|
|
55
|
+
successRedirectUri: import('@sinclair/typebox').TOptional<
|
|
56
|
+
import('@sinclair/typebox').TString
|
|
57
|
+
>;
|
|
58
|
+
cancelRedirectUri: import('@sinclair/typebox').TOptional<
|
|
59
|
+
import('@sinclair/typebox').TString
|
|
60
|
+
>;
|
|
61
|
+
extraFields: import('@sinclair/typebox').TOptional<
|
|
62
|
+
import('@sinclair/typebox').TUnknown
|
|
63
|
+
>;
|
|
64
|
+
};
|
|
65
|
+
CheckoutSessionSchema: <
|
|
66
|
+
T extends Record<string, import('@forklaunch/validator').LiteralSchema>
|
|
67
|
+
>(
|
|
68
|
+
PaymentMethodEnum: T
|
|
69
|
+
) => {
|
|
70
|
+
id: import('@sinclair/typebox').TString;
|
|
71
|
+
customerId: import('@sinclair/typebox').TString;
|
|
72
|
+
metadata: import('@sinclair/typebox').TOptional<
|
|
73
|
+
import('@sinclair/typebox').TUnknown
|
|
74
|
+
>;
|
|
75
|
+
paymentMethods: import('@sinclair/typebox').TArray<
|
|
76
|
+
import('@sinclair/typebox').TUnion<
|
|
77
|
+
[
|
|
78
|
+
{
|
|
79
|
+
[K in keyof T]: import('@sinclair/typebox').TLiteral<T[K]>;
|
|
80
|
+
}[keyof T]
|
|
81
|
+
]
|
|
82
|
+
>
|
|
83
|
+
>;
|
|
84
|
+
successRedirectUri: import('@sinclair/typebox').TString;
|
|
85
|
+
cancelRedirectUri: import('@sinclair/typebox').TString;
|
|
86
|
+
extraFields: import('@sinclair/typebox').TOptional<
|
|
87
|
+
import('@sinclair/typebox').TUnknown
|
|
88
|
+
>;
|
|
89
|
+
createdAt: import('@sinclair/typebox').TOptional<
|
|
90
|
+
import('@sinclair/typebox').TTransform<
|
|
91
|
+
import('@sinclair/typebox').TUnion<
|
|
92
|
+
[
|
|
93
|
+
import('@sinclair/typebox').TDate,
|
|
94
|
+
import('@sinclair/typebox').TNumber,
|
|
95
|
+
import('@sinclair/typebox').TString,
|
|
96
|
+
import('@sinclair/typebox').TBoolean,
|
|
97
|
+
import('@sinclair/typebox').TNull
|
|
98
|
+
]
|
|
99
|
+
>,
|
|
100
|
+
Date
|
|
101
|
+
>
|
|
102
|
+
>;
|
|
103
|
+
updatedAt: import('@sinclair/typebox').TOptional<
|
|
104
|
+
import('@sinclair/typebox').TTransform<
|
|
105
|
+
import('@sinclair/typebox').TUnion<
|
|
106
|
+
[
|
|
107
|
+
import('@sinclair/typebox').TDate,
|
|
108
|
+
import('@sinclair/typebox').TNumber,
|
|
109
|
+
import('@sinclair/typebox').TString,
|
|
110
|
+
import('@sinclair/typebox').TBoolean,
|
|
111
|
+
import('@sinclair/typebox').TNull
|
|
112
|
+
]
|
|
113
|
+
>,
|
|
114
|
+
Date
|
|
115
|
+
>
|
|
116
|
+
>;
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
(options: {
|
|
120
|
+
uuidId: boolean;
|
|
121
|
+
}) => {
|
|
122
|
+
CreateCheckoutSessionSchema: <
|
|
123
|
+
T extends Record<string, import('@forklaunch/validator').LiteralSchema>
|
|
124
|
+
>(
|
|
125
|
+
PaymentMethodEnum: T
|
|
126
|
+
) => {
|
|
127
|
+
customerId: import('zod').ZodString;
|
|
128
|
+
paymentMethods: import('zod').ZodArray<
|
|
129
|
+
import('zod').ZodUnion<
|
|
130
|
+
[{ [K in keyof T]: import('zod').ZodLiteral<T[K]> }[keyof T]]
|
|
131
|
+
>,
|
|
132
|
+
'many'
|
|
133
|
+
>;
|
|
134
|
+
successRedirectUri: import('zod').ZodString;
|
|
135
|
+
cancelRedirectUri: import('zod').ZodString;
|
|
136
|
+
extraFields: import('zod').ZodOptional<import('zod').ZodUnknown>;
|
|
137
|
+
};
|
|
138
|
+
UpdateCheckoutSessionSchema: <
|
|
139
|
+
T extends Record<string, import('@forklaunch/validator').LiteralSchema>
|
|
140
|
+
>(
|
|
141
|
+
PaymentMethodEnum: T
|
|
142
|
+
) => {
|
|
143
|
+
id: import('zod').ZodString;
|
|
144
|
+
customerId: import('zod').ZodOptional<import('zod').ZodString>;
|
|
145
|
+
paymentMethods: import('zod').ZodOptional<
|
|
146
|
+
import('zod').ZodArray<
|
|
147
|
+
import('zod').ZodUnion<
|
|
148
|
+
[{ [K in keyof T]: import('zod').ZodLiteral<T[K]> }[keyof T]]
|
|
149
|
+
>,
|
|
150
|
+
'many'
|
|
151
|
+
>
|
|
152
|
+
>;
|
|
153
|
+
successRedirectUri: import('zod').ZodOptional<import('zod').ZodString>;
|
|
154
|
+
cancelRedirectUri: import('zod').ZodOptional<import('zod').ZodString>;
|
|
155
|
+
extraFields: import('zod').ZodOptional<import('zod').ZodUnknown>;
|
|
156
|
+
};
|
|
157
|
+
CheckoutSessionSchema: <
|
|
158
|
+
T extends Record<string, import('@forklaunch/validator').LiteralSchema>
|
|
159
|
+
>(
|
|
160
|
+
PaymentMethodEnum: T
|
|
161
|
+
) => {
|
|
162
|
+
id: import('zod').ZodString;
|
|
163
|
+
customerId: import('zod').ZodString;
|
|
164
|
+
metadata: import('zod').ZodOptional<import('zod').ZodUnknown>;
|
|
165
|
+
paymentMethods: import('zod').ZodArray<
|
|
166
|
+
import('zod').ZodUnion<
|
|
167
|
+
[{ [K in keyof T]: import('zod').ZodLiteral<T[K]> }[keyof T]]
|
|
168
|
+
>,
|
|
169
|
+
'many'
|
|
170
|
+
>;
|
|
171
|
+
successRedirectUri: import('zod').ZodString;
|
|
172
|
+
cancelRedirectUri: import('zod').ZodString;
|
|
173
|
+
extraFields: import('zod').ZodOptional<import('zod').ZodUnknown>;
|
|
174
|
+
createdAt: import('zod').ZodOptional<import('zod').ZodDate>;
|
|
175
|
+
updatedAt: import('zod').ZodOptional<import('zod').ZodDate>;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
>;
|
|
179
|
+
//# sourceMappingURL=checkoutSession.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkoutSession.schema.d.ts","sourceRoot":"","sources":["../../schemas/checkoutSession.schema.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG7C,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { serviceSchemaResolver } from '@forklaunch/core/mappers';
|
|
2
|
+
import { BaseCheckoutSessionServiceSchemas as TypeBoxSchemas } from './typebox/checkoutSession.schema';
|
|
3
|
+
import { BaseCheckoutSessionServiceSchemas as ZodSchemas } from './zod/checkoutSession.schema';
|
|
4
|
+
export const BaseCheckoutSessionServiceSchemas = serviceSchemaResolver(
|
|
5
|
+
TypeBoxSchemas,
|
|
6
|
+
ZodSchemas
|
|
7
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC"}
|