@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.
@@ -1,116 +1,314 @@
1
- import { BillingPortalDto, CreateBillingPortalDto, UpdateBillingPortalDto, CheckoutSessionDto, CreateCheckoutSessionDto, UpdateCheckoutSessionDto, PaymentLinkDto, CreatePaymentLinkDto, UpdatePaymentLinkDto, PlanDto, CreatePlanDto, UpdatePlanDto, SubscriptionDto, CreateSubscriptionDto, UpdateSubscriptionDto } from '@forklaunch/interfaces-billing/types';
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
- BillingPortalMapper: BillingPortalDto;
6
- CreateBillingPortalMapper: CreateBillingPortalDto;
7
- UpdateBillingPortalMapper: UpdateBillingPortalDto;
21
+ BillingPortalMapper: BillingPortalDto;
22
+ CreateBillingPortalMapper: CreateBillingPortalDto;
23
+ UpdateBillingPortalMapper: UpdateBillingPortalDto;
8
24
  };
9
25
  type BaseCheckoutSessionDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum> = {
10
- CheckoutSessionMapper: CheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
11
- CreateCheckoutSessionMapper: CreateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
12
- UpdateCheckoutSessionMapper: UpdateCheckoutSessionDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
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
- PaymentLinkMapper: PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
16
- CreatePaymentLinkMapper: CreatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
17
- UpdatePaymentLinkMapper: UpdatePaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
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
- PlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
21
- CreatePlanMapper: CreatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
22
- UpdatePlanMapper: UpdatePlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
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
- SubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
26
- CreateSubscriptionMapper: CreateSubscriptionDto<PartyType, BillingProviderType>;
27
- UpdateSubscriptionMapper: UpdateSubscriptionDto<PartyType, BillingProviderType>;
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
- BillingPortalMapper: BillingPortalDto;
32
- CreateBillingPortalMapper: BillingPortalDto;
33
- UpdateBillingPortalMapper: BillingPortalDto;
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
- PaymentLinkMapper: PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
42
- CreatePaymentLinkMapper: PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
43
- UpdatePaymentLinkMapper: PaymentLinkDto<PaymentMethodEnum, CurrencyEnum, StatusEnum>;
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
- PlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
47
- CreatePlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
48
- UpdatePlanMapper: PlanDto<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>;
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
- SubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
52
- CreateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
53
- UpdateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
130
+ SubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
131
+ CreateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
132
+ UpdateSubscriptionMapper: SubscriptionDto<PartyType, BillingProviderType>;
54
133
  };
55
134
 
56
- type BillingPortalMappers<MapperEntities extends BaseBillingEntities, MapperDomains extends BaseBillingDtos> = {
57
- BillingPortalMapper: {
58
- toDto: (entity: MapperEntities['BillingPortalMapper']) => Promise<MapperDomains['BillingPortalMapper']>;
59
- };
60
- CreateBillingPortalMapper: {
61
- toEntity: (dto: MapperDomains['CreateBillingPortalMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['CreateBillingPortalMapper']>;
62
- };
63
- UpdateBillingPortalMapper: {
64
- toEntity: (dto: MapperDomains['UpdateBillingPortalMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['UpdateBillingPortalMapper']>;
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<PaymentMethodEnum, CurrencyEnum, StatusEnum, MapperEntities extends BaseCheckoutSessionEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum>, MapperDomains extends BaseCheckoutSessionDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum>> = {
69
- CheckoutSessionMapper: {
70
- toDto: (entity: MapperEntities['CheckoutSessionMapper']) => Promise<MapperDomains['CheckoutSessionMapper']>;
71
- };
72
- CreateCheckoutSessionMapper: {
73
- toEntity: (dto: MapperDomains['CreateCheckoutSessionMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['CreateCheckoutSessionMapper']>;
74
- };
75
- UpdateCheckoutSessionMapper: {
76
- toEntity: (dto: MapperDomains['UpdateCheckoutSessionMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['UpdateCheckoutSessionMapper']>;
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<PaymentMethodEnum, CurrencyEnum, StatusEnum, MapperEntities extends BasePaymentLinkEntities<PaymentMethodEnum, CurrencyEnum, StatusEnum>, MapperDomains extends BasePaymentLinkDtos<PaymentMethodEnum, CurrencyEnum, StatusEnum>> = {
81
- PaymentLinkMapper: {
82
- toDto: (entity: MapperEntities['PaymentLinkMapper']) => Promise<MapperDomains['PaymentLinkMapper']>;
83
- };
84
- CreatePaymentLinkMapper: {
85
- toEntity: (dto: MapperDomains['CreatePaymentLinkMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['CreatePaymentLinkMapper']>;
86
- };
87
- UpdatePaymentLinkMapper: {
88
- toEntity: (dto: MapperDomains['UpdatePaymentLinkMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['UpdatePaymentLinkMapper']>;
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<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum, MapperEntities extends BasePlanEntities<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>, MapperDomains extends BasePlanDtos<PlanCadenceEnum, CurrencyEnum, BillingProviderEnum>> = {
93
- PlanMapper: {
94
- toDto: (entity: MapperEntities['PlanMapper']) => Promise<MapperDomains['PlanMapper']>;
95
- };
96
- CreatePlanMapper: {
97
- toEntity: (dto: MapperDomains['CreatePlanMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['CreatePlanMapper']>;
98
- };
99
- UpdatePlanMapper: {
100
- toEntity: (dto: MapperDomains['UpdatePlanMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['UpdatePlanMapper']>;
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<PartyType, BillingProviderType, MapperEntities extends BaseSubscriptionEntities<PartyType, BillingProviderType>, MapperDomains extends BaseSubscriptionDtos<PartyType, BillingProviderType>> = {
105
- SubscriptionMapper: {
106
- toDto: (entity: MapperEntities['SubscriptionMapper']) => Promise<MapperDomains['SubscriptionMapper']>;
107
- };
108
- CreateSubscriptionMapper: {
109
- toEntity: (dto: MapperDomains['CreateSubscriptionMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['CreateSubscriptionMapper']>;
110
- };
111
- UpdateSubscriptionMapper: {
112
- toEntity: (dto: MapperDomains['UpdateSubscriptionMapper'], em: EntityManager, ...args: unknown[]) => Promise<MapperEntities['UpdateSubscriptionMapper']>;
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 { BaseBillingDtos, BaseBillingEntities, BaseCheckoutSessionDtos, BaseCheckoutSessionEntities, BasePaymentLinkDtos, BasePaymentLinkEntities, BasePlanDtos, BasePlanEntities, BaseSubscriptionDtos, BaseSubscriptionEntities, BillingPortalMappers, CheckoutSessionMappers, PaymentLinkMappers, PlanMappers, SubscriptionMappers };
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
- "use strict";
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 === "object" || typeof from === "function") {
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, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
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) => __copyProps(__defProp({}, "__esModule", { value: true }), 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 = {};
@@ -1,10 +1,4 @@
1
- import {
2
- date,
3
- optional,
4
- string,
5
- unknown,
6
- uuid
7
- } from '@{{app_name}}/core';
1
+ import { date, optional, string, unknown, uuid } from '@{{app_name}}/core';
8
2
 
9
3
  export const CreateBillingPortalSchema = {
10
4
  customerId: string,