@forklaunch/implementation-billing-base 0.6.3 → 0.6.5
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/domain/schemas/index.d.mts +1196 -342
- package/lib/domain/schemas/index.d.ts +1196 -342
- package/lib/domain/schemas/index.js +389 -250
- package/lib/domain/schemas/index.mjs +281 -225
- package/lib/domain/types/index.d.mts +282 -84
- package/lib/domain/types/index.d.ts +282 -84
- package/lib/domain/types/index.js +8 -4
- package/lib/eject/domain/schemas/billingPortal.schema.ts +1 -7
- package/lib/services/index.d.mts +361 -105
- package/lib/services/index.d.ts +361 -105
- package/lib/services/index.js +198 -161
- package/lib/services/index.mjs +182 -160
- package/package.json +10 -10
|
@@ -1,116 +1,314 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BillingPortalDto,
|
|
3
|
+
CreateBillingPortalDto,
|
|
4
|
+
UpdateBillingPortalDto,
|
|
5
|
+
CheckoutSessionDto,
|
|
6
|
+
CreateCheckoutSessionDto,
|
|
7
|
+
UpdateCheckoutSessionDto,
|
|
8
|
+
PaymentLinkDto,
|
|
9
|
+
CreatePaymentLinkDto,
|
|
10
|
+
UpdatePaymentLinkDto,
|
|
11
|
+
PlanDto,
|
|
12
|
+
CreatePlanDto,
|
|
13
|
+
UpdatePlanDto,
|
|
14
|
+
SubscriptionDto,
|
|
15
|
+
CreateSubscriptionDto,
|
|
16
|
+
UpdateSubscriptionDto
|
|
17
|
+
} from '@forklaunch/interfaces-billing/types';
|
|
2
18
|
import { EntityManager } from '@mikro-orm/core';
|
|
3
19
|
|
|
4
20
|
type BaseBillingDtos = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
21
|
+
BillingPortalMapper: BillingPortalDto;
|
|
22
|
+
CreateBillingPortalMapper: CreateBillingPortalDto;
|
|
23
|
+
UpdateBillingPortalMapper: UpdateBillingPortalDto;
|
|
8
24
|
};
|
|
9
25
|
type BaseCheckoutSessionDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
26
|
+
CheckoutSessionMapper: CheckoutSessionDto<
|
|
27
|
+
PaymentMethodEnum,
|
|
28
|
+
CurrencyEnum,
|
|
29
|
+
StatusEnum
|
|
30
|
+
>;
|
|
31
|
+
CreateCheckoutSessionMapper: CreateCheckoutSessionDto<
|
|
32
|
+
PaymentMethodEnum,
|
|
33
|
+
CurrencyEnum,
|
|
34
|
+
StatusEnum
|
|
35
|
+
>;
|
|
36
|
+
UpdateCheckoutSessionMapper: UpdateCheckoutSessionDto<
|
|
37
|
+
PaymentMethodEnum,
|
|
38
|
+
CurrencyEnum,
|
|
39
|
+
StatusEnum
|
|
40
|
+
>;
|
|
13
41
|
};
|
|
14
42
|
type BasePaymentLinkDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
43
|
+
PaymentLinkMapper: PaymentLinkDto<
|
|
44
|
+
PaymentMethodEnum,
|
|
45
|
+
CurrencyEnum,
|
|
46
|
+
StatusEnum
|
|
47
|
+
>;
|
|
48
|
+
CreatePaymentLinkMapper: CreatePaymentLinkDto<
|
|
49
|
+
PaymentMethodEnum,
|
|
50
|
+
CurrencyEnum,
|
|
51
|
+
StatusEnum
|
|
52
|
+
>;
|
|
53
|
+
UpdatePaymentLinkMapper: UpdatePaymentLinkDto<
|
|
54
|
+
PaymentMethodEnum,
|
|
55
|
+
CurrencyEnum,
|
|
56
|
+
StatusEnum
|
|
57
|
+
>;
|
|
18
58
|
};
|
|
19
59
|
type BasePlanDtos<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
60
|
+
PlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
|
|
61
|
+
CreatePlanMapper: CreatePlanDto<
|
|
62
|
+
PlanCadenceEnum,
|
|
63
|
+
CurrencyEnum,
|
|
64
|
+
BillingProviderEnum
|
|
65
|
+
>;
|
|
66
|
+
UpdatePlanMapper: UpdatePlanDto<
|
|
67
|
+
PlanCadenceEnum,
|
|
68
|
+
CurrencyEnum,
|
|
69
|
+
BillingProviderEnum
|
|
70
|
+
>;
|
|
23
71
|
};
|
|
24
72
|
type BaseSubscriptionDtos<PartyType, BillingProviderType> = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
73
|
+
SubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
|
|
74
|
+
CreateSubscriptionMapper: CreateSubscriptionDto<
|
|
75
|
+
PartyType,
|
|
76
|
+
BillingProviderType
|
|
77
|
+
>;
|
|
78
|
+
UpdateSubscriptionMapper: UpdateSubscriptionDto<
|
|
79
|
+
PartyType,
|
|
80
|
+
BillingProviderType
|
|
81
|
+
>;
|
|
28
82
|
};
|
|
29
83
|
|
|
30
84
|
type BaseBillingEntities = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
type BaseCheckoutSessionEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
|
|
36
|
-
CheckoutSessionMapper: CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
|
|
37
|
-
CreateCheckoutSessionMapper: CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
|
|
38
|
-
UpdateCheckoutSessionMapper: CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
|
|
85
|
+
BillingPortalMapper: BillingPortalDto;
|
|
86
|
+
CreateBillingPortalMapper: BillingPortalDto;
|
|
87
|
+
UpdateBillingPortalMapper: BillingPortalDto;
|
|
39
88
|
};
|
|
89
|
+
type BaseCheckoutSessionEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum> =
|
|
90
|
+
{
|
|
91
|
+
CheckoutSessionMapper: CheckoutSessionDto<
|
|
92
|
+
PaymentMethodEnum,
|
|
93
|
+
CurrencyEnum,
|
|
94
|
+
StatusEnum
|
|
95
|
+
>;
|
|
96
|
+
CreateCheckoutSessionMapper: CheckoutSessionDto<
|
|
97
|
+
PaymentMethodEnum,
|
|
98
|
+
CurrencyEnum,
|
|
99
|
+
StatusEnum
|
|
100
|
+
>;
|
|
101
|
+
UpdateCheckoutSessionMapper: CheckoutSessionDto<
|
|
102
|
+
PaymentMethodEnum,
|
|
103
|
+
CurrencyEnum,
|
|
104
|
+
StatusEnum
|
|
105
|
+
>;
|
|
106
|
+
};
|
|
40
107
|
type BasePaymentLinkEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
108
|
+
PaymentLinkMapper: PaymentLinkDto<
|
|
109
|
+
PaymentMethodEnum,
|
|
110
|
+
CurrencyEnum,
|
|
111
|
+
StatusEnum
|
|
112
|
+
>;
|
|
113
|
+
CreatePaymentLinkMapper: PaymentLinkDto<
|
|
114
|
+
PaymentMethodEnum,
|
|
115
|
+
CurrencyEnum,
|
|
116
|
+
StatusEnum
|
|
117
|
+
>;
|
|
118
|
+
UpdatePaymentLinkMapper: PaymentLinkDto<
|
|
119
|
+
PaymentMethodEnum,
|
|
120
|
+
CurrencyEnum,
|
|
121
|
+
StatusEnum
|
|
122
|
+
>;
|
|
44
123
|
};
|
|
45
124
|
type BasePlanEntities<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum> = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
125
|
+
PlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
|
|
126
|
+
CreatePlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
|
|
127
|
+
UpdatePlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
|
|
49
128
|
};
|
|
50
129
|
type BaseSubscriptionEntities<PartyType, BillingProviderType> = {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
130
|
+
SubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
|
|
131
|
+
CreateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
|
|
132
|
+
UpdateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
|
|
54
133
|
};
|
|
55
134
|
|
|
56
|
-
type BillingPortalMappers<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
135
|
+
type BillingPortalMappers<
|
|
136
|
+
MapperEntities extends BaseBillingEntities,
|
|
137
|
+
MapperDomains extends BaseBillingDtos
|
|
138
|
+
> = {
|
|
139
|
+
BillingPortalMapper: {
|
|
140
|
+
toDto: (
|
|
141
|
+
entity: MapperEntities['BillingPortalMapper']
|
|
142
|
+
) => Promise<MapperDomains['BillingPortalMapper']>;
|
|
143
|
+
};
|
|
144
|
+
CreateBillingPortalMapper: {
|
|
145
|
+
toEntity: (
|
|
146
|
+
dto: MapperDomains['CreateBillingPortalMapper'],
|
|
147
|
+
em: EntityManager,
|
|
148
|
+
...args: unknown[]
|
|
149
|
+
) => Promise<MapperEntities['CreateBillingPortalMapper']>;
|
|
150
|
+
};
|
|
151
|
+
UpdateBillingPortalMapper: {
|
|
152
|
+
toEntity: (
|
|
153
|
+
dto: MapperDomains['UpdateBillingPortalMapper'],
|
|
154
|
+
em: EntityManager,
|
|
155
|
+
...args: unknown[]
|
|
156
|
+
) => Promise<MapperEntities['UpdateBillingPortalMapper']>;
|
|
157
|
+
};
|
|
66
158
|
};
|
|
67
159
|
|
|
68
|
-
type CheckoutSessionMappers<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
160
|
+
type CheckoutSessionMappers<
|
|
161
|
+
PaymentMethodEnum,
|
|
162
|
+
CurrencyEnum,
|
|
163
|
+
StatusEnum,
|
|
164
|
+
MapperEntities extends BaseCheckoutSessionEntities<
|
|
165
|
+
PaymentMethodEnum,
|
|
166
|
+
CurrencyEnum,
|
|
167
|
+
StatusEnum
|
|
168
|
+
>,
|
|
169
|
+
MapperDomains extends BaseCheckoutSessionDtos<
|
|
170
|
+
PaymentMethodEnum,
|
|
171
|
+
CurrencyEnum,
|
|
172
|
+
StatusEnum
|
|
173
|
+
>
|
|
174
|
+
> = {
|
|
175
|
+
CheckoutSessionMapper: {
|
|
176
|
+
toDto: (
|
|
177
|
+
entity: MapperEntities['CheckoutSessionMapper']
|
|
178
|
+
) => Promise<MapperDomains['CheckoutSessionMapper']>;
|
|
179
|
+
};
|
|
180
|
+
CreateCheckoutSessionMapper: {
|
|
181
|
+
toEntity: (
|
|
182
|
+
dto: MapperDomains['CreateCheckoutSessionMapper'],
|
|
183
|
+
em: EntityManager,
|
|
184
|
+
...args: unknown[]
|
|
185
|
+
) => Promise<MapperEntities['CreateCheckoutSessionMapper']>;
|
|
186
|
+
};
|
|
187
|
+
UpdateCheckoutSessionMapper: {
|
|
188
|
+
toEntity: (
|
|
189
|
+
dto: MapperDomains['UpdateCheckoutSessionMapper'],
|
|
190
|
+
em: EntityManager,
|
|
191
|
+
...args: unknown[]
|
|
192
|
+
) => Promise<MapperEntities['UpdateCheckoutSessionMapper']>;
|
|
193
|
+
};
|
|
78
194
|
};
|
|
79
195
|
|
|
80
|
-
type PaymentLinkMappers<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
196
|
+
type PaymentLinkMappers<
|
|
197
|
+
PaymentMethodEnum,
|
|
198
|
+
CurrencyEnum,
|
|
199
|
+
StatusEnum,
|
|
200
|
+
MapperEntities extends BasePaymentLinkEntities<
|
|
201
|
+
PaymentMethodEnum,
|
|
202
|
+
CurrencyEnum,
|
|
203
|
+
StatusEnum
|
|
204
|
+
>,
|
|
205
|
+
MapperDomains extends BasePaymentLinkDtos<
|
|
206
|
+
PaymentMethodEnum,
|
|
207
|
+
CurrencyEnum,
|
|
208
|
+
StatusEnum
|
|
209
|
+
>
|
|
210
|
+
> = {
|
|
211
|
+
PaymentLinkMapper: {
|
|
212
|
+
toDto: (
|
|
213
|
+
entity: MapperEntities['PaymentLinkMapper']
|
|
214
|
+
) => Promise<MapperDomains['PaymentLinkMapper']>;
|
|
215
|
+
};
|
|
216
|
+
CreatePaymentLinkMapper: {
|
|
217
|
+
toEntity: (
|
|
218
|
+
dto: MapperDomains['CreatePaymentLinkMapper'],
|
|
219
|
+
em: EntityManager,
|
|
220
|
+
...args: unknown[]
|
|
221
|
+
) => Promise<MapperEntities['CreatePaymentLinkMapper']>;
|
|
222
|
+
};
|
|
223
|
+
UpdatePaymentLinkMapper: {
|
|
224
|
+
toEntity: (
|
|
225
|
+
dto: MapperDomains['UpdatePaymentLinkMapper'],
|
|
226
|
+
em: EntityManager,
|
|
227
|
+
...args: unknown[]
|
|
228
|
+
) => Promise<MapperEntities['UpdatePaymentLinkMapper']>;
|
|
229
|
+
};
|
|
90
230
|
};
|
|
91
231
|
|
|
92
|
-
type PlanMappers<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
232
|
+
type PlanMappers<
|
|
233
|
+
PlanCadenceEnum,
|
|
234
|
+
CurrencyEnum,
|
|
235
|
+
BillingProviderEnum,
|
|
236
|
+
MapperEntities extends BasePlanEntities<
|
|
237
|
+
PlanCadenceEnum,
|
|
238
|
+
CurrencyEnum,
|
|
239
|
+
BillingProviderEnum
|
|
240
|
+
>,
|
|
241
|
+
MapperDomains extends BasePlanDtos<
|
|
242
|
+
PlanCadenceEnum,
|
|
243
|
+
CurrencyEnum,
|
|
244
|
+
BillingProviderEnum
|
|
245
|
+
>
|
|
246
|
+
> = {
|
|
247
|
+
PlanMapper: {
|
|
248
|
+
toDto: (
|
|
249
|
+
entity: MapperEntities['PlanMapper']
|
|
250
|
+
) => Promise<MapperDomains['PlanMapper']>;
|
|
251
|
+
};
|
|
252
|
+
CreatePlanMapper: {
|
|
253
|
+
toEntity: (
|
|
254
|
+
dto: MapperDomains['CreatePlanMapper'],
|
|
255
|
+
em: EntityManager,
|
|
256
|
+
...args: unknown[]
|
|
257
|
+
) => Promise<MapperEntities['CreatePlanMapper']>;
|
|
258
|
+
};
|
|
259
|
+
UpdatePlanMapper: {
|
|
260
|
+
toEntity: (
|
|
261
|
+
dto: MapperDomains['UpdatePlanMapper'],
|
|
262
|
+
em: EntityManager,
|
|
263
|
+
...args: unknown[]
|
|
264
|
+
) => Promise<MapperEntities['UpdatePlanMapper']>;
|
|
265
|
+
};
|
|
102
266
|
};
|
|
103
267
|
|
|
104
|
-
type SubscriptionMappers<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
268
|
+
type SubscriptionMappers<
|
|
269
|
+
PartyType,
|
|
270
|
+
BillingProviderType,
|
|
271
|
+
MapperEntities extends BaseSubscriptionEntities<
|
|
272
|
+
PartyType,
|
|
273
|
+
BillingProviderType
|
|
274
|
+
>,
|
|
275
|
+
MapperDomains extends BaseSubscriptionDtos<PartyType, BillingProviderType>
|
|
276
|
+
> = {
|
|
277
|
+
SubscriptionMapper: {
|
|
278
|
+
toDto: (
|
|
279
|
+
entity: MapperEntities['SubscriptionMapper']
|
|
280
|
+
) => Promise<MapperDomains['SubscriptionMapper']>;
|
|
281
|
+
};
|
|
282
|
+
CreateSubscriptionMapper: {
|
|
283
|
+
toEntity: (
|
|
284
|
+
dto: MapperDomains['CreateSubscriptionMapper'],
|
|
285
|
+
em: EntityManager,
|
|
286
|
+
...args: unknown[]
|
|
287
|
+
) => Promise<MapperEntities['CreateSubscriptionMapper']>;
|
|
288
|
+
};
|
|
289
|
+
UpdateSubscriptionMapper: {
|
|
290
|
+
toEntity: (
|
|
291
|
+
dto: MapperDomains['UpdateSubscriptionMapper'],
|
|
292
|
+
em: EntityManager,
|
|
293
|
+
...args: unknown[]
|
|
294
|
+
) => Promise<MapperEntities['UpdateSubscriptionMapper']>;
|
|
295
|
+
};
|
|
114
296
|
};
|
|
115
297
|
|
|
116
|
-
export type {
|
|
298
|
+
export type {
|
|
299
|
+
BaseBillingDtos,
|
|
300
|
+
BaseBillingEntities,
|
|
301
|
+
BaseCheckoutSessionDtos,
|
|
302
|
+
BaseCheckoutSessionEntities,
|
|
303
|
+
BasePaymentLinkDtos,
|
|
304
|
+
BasePaymentLinkEntities,
|
|
305
|
+
BasePlanDtos,
|
|
306
|
+
BasePlanEntities,
|
|
307
|
+
BaseSubscriptionDtos,
|
|
308
|
+
BaseSubscriptionEntities,
|
|
309
|
+
BillingPortalMappers,
|
|
310
|
+
CheckoutSessionMappers,
|
|
311
|
+
PaymentLinkMappers,
|
|
312
|
+
PlanMappers,
|
|
313
|
+
SubscriptionMappers
|
|
314
|
+
};
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from ===
|
|
7
|
+
if ((from && typeof from === 'object') || typeof from === 'function') {
|
|
8
8
|
for (let key of __getOwnPropNames(from))
|
|
9
9
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, {
|
|
10
|
+
__defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
11
14
|
}
|
|
12
15
|
return to;
|
|
13
16
|
};
|
|
14
|
-
var __toCommonJS = (mod) =>
|
|
17
|
+
var __toCommonJS = (mod) =>
|
|
18
|
+
__copyProps(__defProp({}, '__esModule', { value: true }), mod);
|
|
15
19
|
|
|
16
20
|
// domain/types/index.ts
|
|
17
21
|
var types_exports = {};
|