@forklaunch/interfaces-billing 0.1.0 → 0.1.2

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/index.ts CHANGED
@@ -1,5 +1,2 @@
1
- export * from './interfaces/billingPortal.service.interface';
2
- export * from './interfaces/checkoutSession.service.interface';
3
- export * from './interfaces/paymentLink.service.interface';
4
- export * from './interfaces/plan.service.interface';
5
- export * from './interfaces/subscription.service.interface';
1
+ export * from './interfaces';
2
+ export * from './types';
@@ -1,22 +1,4 @@
1
- import { IdDto, RecordTimingDto } from '@forklaunch/common';
2
-
3
- export type CreateBillingPortalDto = {
4
- customerId: string;
5
- uri: string;
6
- expiresAt: Date;
7
- extraFields?: unknown;
8
- };
9
- export type UpdateBillingPortalDto = IdDto & Partial<CreateBillingPortalDto>;
10
- export type BillingPortalDto = IdDto &
11
- CreateBillingPortalDto &
12
- Partial<RecordTimingDto>;
13
-
14
- export type BillingPortalServiceParameters = {
15
- CreateBillingPortalDto: CreateBillingPortalDto;
16
- UpdateBillingPortalDto: UpdateBillingPortalDto;
17
- BillingPortalDto: BillingPortalDto;
18
- IdDto: IdDto;
19
- };
1
+ import { BillingPortalServiceParameters } from '../types/billingPortal.service.types';
20
2
 
21
3
  export interface BillingPortalService<
22
4
  Params extends BillingPortalServiceParameters = BillingPortalServiceParameters
@@ -1,25 +1,4 @@
1
- import { IdDto, RecordTimingDto } from '@forklaunch/common';
2
-
3
- export type CreateCheckoutSessionDto<PaymentMethodEnum> = {
4
- customerId: string;
5
- paymentMethods: PaymentMethodEnum[keyof PaymentMethodEnum][];
6
- metadata?: unknown;
7
- successRedirectUri: string;
8
- cancelRedirectUri: string;
9
- extraFields?: unknown;
10
- };
11
- export type UpdateCheckoutSessionDto<PaymentMethodEnum> = IdDto &
12
- Partial<CreateCheckoutSessionDto<PaymentMethodEnum>>;
13
- export type CheckoutSessionDto<PaymentMethodEnum> = IdDto &
14
- CreateCheckoutSessionDto<PaymentMethodEnum> &
15
- Partial<RecordTimingDto>;
16
-
17
- export type CheckoutSessionServiceParameters<PaymentMethodEnum> = {
18
- CreateCheckoutSessionDto: CreateCheckoutSessionDto<PaymentMethodEnum>;
19
- CheckoutSessionDto: CheckoutSessionDto<PaymentMethodEnum>;
20
- IdDto: IdDto;
21
- };
22
-
1
+ import { CheckoutSessionServiceParameters } from '../types/checkoutSession.service.types';
23
2
  export interface CheckoutSessionService<
24
3
  PaymentMethodEnum,
25
4
  Params extends
@@ -0,0 +1,5 @@
1
+ export * from './billingPortal.service.interface';
2
+ export * from './checkoutSession.service.interface';
3
+ export * from './paymentLink.service.interface';
4
+ export * from './plan.service.interface';
5
+ export * from './subscription.service.interface';
@@ -1,26 +1,4 @@
1
- import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
2
-
3
- export type CreatePaymentLinkDto<CurrencyEnum> = {
4
- amount: number;
5
- currency: CurrencyEnum[keyof CurrencyEnum];
6
- metadata?: unknown;
7
- successRedirectUri: string;
8
- cancelRedirectUri: string;
9
- extraFields?: unknown;
10
- };
11
- export type UpdatePaymentLinkDto<CurrencyEnum> = IdDto &
12
- Partial<CreatePaymentLinkDto<CurrencyEnum>>;
13
- export type PaymentLinkDto<CurrencyEnum> = IdDto &
14
- CreatePaymentLinkDto<CurrencyEnum> &
15
- Partial<RecordTimingDto>;
16
-
17
- export type PaymentLinkServiceParameters<CurrencyEnum> = {
18
- CreatePaymentLinkDto: CreatePaymentLinkDto<CurrencyEnum>;
19
- UpdatePaymentLinkDto: UpdatePaymentLinkDto<CurrencyEnum>;
20
- PaymentLinkDto: PaymentLinkDto<CurrencyEnum>;
21
- IdDto: IdDto;
22
- IdsDto: IdsDto;
23
- };
1
+ import { PaymentLinkServiceParameters } from '../types/paymentLink.service.types';
24
2
 
25
3
  export interface PaymentLinkService<
26
4
  CurrencyEnum,
@@ -1,30 +1,5 @@
1
- import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
2
1
  import { EntityManager } from '@mikro-orm/core';
3
-
4
- export type CreatePlanDto<PlanCadenceEnum, BillingProviderEnum> = {
5
- active: boolean;
6
- name: string;
7
- description?: string;
8
- price: number;
9
- cadence: PlanCadenceEnum[keyof PlanCadenceEnum];
10
- features?: string[];
11
- extraFields?: unknown;
12
- externalId: string;
13
- billingProvider?: BillingProviderEnum[keyof BillingProviderEnum];
14
- };
15
- export type UpdatePlanDto<PlanCadenceEnum, BillingProviderEnum> = IdDto &
16
- Partial<CreatePlanDto<PlanCadenceEnum, BillingProviderEnum>>;
17
- export type PlanDto<PlanCadenceEnum, BillingProviderEnum> = IdDto &
18
- CreatePlanDto<PlanCadenceEnum, BillingProviderEnum> &
19
- Partial<RecordTimingDto>;
20
-
21
- export type PlanServiceParameters<PlanCadenceEnum, BillingProviderEnum> = {
22
- CreatePlanDto: CreatePlanDto<PlanCadenceEnum, BillingProviderEnum>;
23
- UpdatePlanDto: UpdatePlanDto<PlanCadenceEnum, BillingProviderEnum>;
24
- PlanDto: PlanDto<PlanCadenceEnum, BillingProviderEnum>;
25
- IdDto: IdDto;
26
- IdsDto: IdsDto;
27
- };
2
+ import { PlanServiceParameters } from '../types/plan.service.types';
28
3
 
29
4
  export interface PlanService<
30
5
  PlanCadenceEnum,
@@ -1,32 +1,5 @@
1
- import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
2
1
  import { EntityManager } from '@mikro-orm/core';
3
-
4
- export type CreateSubscriptionDto<PartyType, BillingProviderType> = {
5
- partyId: string;
6
- partyType: PartyType[keyof PartyType];
7
- description?: string;
8
- active: boolean;
9
- productId: string;
10
- extraFields?: unknown;
11
- externalId: string;
12
- billingProvider?: BillingProviderType[keyof BillingProviderType];
13
- startDate: Date;
14
- endDate: Date;
15
- status: string;
16
- };
17
- export type UpdateSubscriptionDto<PartyType, BillingProviderType> = IdDto &
18
- Partial<CreateSubscriptionDto<PartyType, BillingProviderType>>;
19
- export type SubscriptionDto<PartyType, BillingProviderType> = IdDto &
20
- CreateSubscriptionDto<PartyType, BillingProviderType> &
21
- Partial<RecordTimingDto>;
22
-
23
- export type SubscriptionServiceParameters<PartyType, BillingProviderType> = {
24
- CreateSubscriptionDto: CreateSubscriptionDto<PartyType, BillingProviderType>;
25
- UpdateSubscriptionDto: UpdateSubscriptionDto<PartyType, BillingProviderType>;
26
- SubscriptionDto: SubscriptionDto<PartyType, BillingProviderType>;
27
- IdDto: IdDto;
28
- IdsDto: IdsDto;
29
- };
2
+ import { SubscriptionServiceParameters } from '../types/subscription.service.types';
30
3
 
31
4
  export interface SubscriptionService<
32
5
  PartyType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/interfaces-billing",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Billing interfaces for forklaunch",
5
5
  "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
6
  "bugs": {
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "author": "Forklift Technologies, Inc.",
15
- "main": "server.ts",
15
+ "types": "./lib/index.d.ts",
16
16
  "dependencies": {
17
17
  "@forklaunch/common": "^0.2.5",
18
18
  "@mikro-orm/core": "^6.4.11"
@@ -22,21 +22,14 @@
22
22
  "prettier": "^3.5.3",
23
23
  "typedoc": "^0.28.1"
24
24
  },
25
- "mikro-orm": {
26
- "configPaths": [
27
- "./mikro-orm.config.ts",
28
- "./dist/mikro-orm.config.js"
29
- ]
30
- },
31
25
  "scripts": {
32
- "build": "tsc",
33
- "clean": "rm -rf dist pnpm.lock.yaml node_modules",
26
+ "build": "tsc && pnpm package:eject",
27
+ "clean": "rm -rf lib pnpm.lock.yaml node_modules",
34
28
  "docs": "typedoc --out docs *",
35
29
  "format": "prettier --ignore-path=.prettierignore --config .prettierrc '**/*.{ts,tsx,json}' --write",
36
30
  "lint": "eslint . -c eslint.config.mjs",
37
31
  "lint:fix": "eslint . -c eslint.config.mjs --fix",
38
- "start": "ENV_FILE_PATH=.env.local NODE_OPTIONS='--import=tsx' node dist/server.js",
39
- "start:bun": "bun run migrate:up && bun dist/server.js",
32
+ "package:eject": "mkdir -p lib/eject && cp -r interfaces lib/eject/interfaces && cp -r types lib/eject/types",
40
33
  "test": "vitest --passWithNoTests"
41
34
  }
42
35
  }
package/tsconfig.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "extends": "../../tsconfig.base.json",
3
3
  "compilerOptions": {
4
- "outDir": "dist"
4
+ "outDir": "lib"
5
5
  },
6
- "exclude": ["node_modules", "dist", "eslint.config.mjs"]
6
+ "exclude": ["node_modules", "lib", "eslint.config.mjs"]
7
7
  }
@@ -0,0 +1,19 @@
1
+ import { IdDto, RecordTimingDto } from '@forklaunch/common';
2
+
3
+ export type CreateBillingPortalDto = {
4
+ customerId: string;
5
+ uri: string;
6
+ expiresAt: Date;
7
+ extraFields?: unknown;
8
+ };
9
+ export type UpdateBillingPortalDto = IdDto & Partial<CreateBillingPortalDto>;
10
+ export type BillingPortalDto = IdDto &
11
+ CreateBillingPortalDto &
12
+ Partial<RecordTimingDto>;
13
+
14
+ export type BillingPortalServiceParameters = {
15
+ CreateBillingPortalDto: CreateBillingPortalDto;
16
+ UpdateBillingPortalDto: UpdateBillingPortalDto;
17
+ BillingPortalDto: BillingPortalDto;
18
+ IdDto: IdDto;
19
+ };
@@ -0,0 +1,21 @@
1
+ import { IdDto, RecordTimingDto } from '@forklaunch/common';
2
+
3
+ export type CreateCheckoutSessionDto<PaymentMethodEnum> = {
4
+ customerId: string;
5
+ paymentMethods: PaymentMethodEnum[keyof PaymentMethodEnum][];
6
+ metadata?: unknown;
7
+ successRedirectUri: string;
8
+ cancelRedirectUri: string;
9
+ extraFields?: unknown;
10
+ };
11
+ export type UpdateCheckoutSessionDto<PaymentMethodEnum> = IdDto &
12
+ Partial<CreateCheckoutSessionDto<PaymentMethodEnum>>;
13
+ export type CheckoutSessionDto<PaymentMethodEnum> = IdDto &
14
+ CreateCheckoutSessionDto<PaymentMethodEnum> &
15
+ Partial<RecordTimingDto>;
16
+
17
+ export type CheckoutSessionServiceParameters<PaymentMethodEnum> = {
18
+ CreateCheckoutSessionDto: CreateCheckoutSessionDto<PaymentMethodEnum>;
19
+ CheckoutSessionDto: CheckoutSessionDto<PaymentMethodEnum>;
20
+ IdDto: IdDto;
21
+ };
package/types/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * from './billingPortal.service.types';
2
+ export * from './checkoutSession.service.types';
3
+ export * from './paymentLink.service.types';
4
+ export * from './plan.service.types';
5
+ export * from './subscription.service.types';
@@ -0,0 +1,23 @@
1
+ import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
2
+
3
+ export type CreatePaymentLinkDto<CurrencyEnum> = {
4
+ amount: number;
5
+ currency: CurrencyEnum[keyof CurrencyEnum];
6
+ metadata?: unknown;
7
+ successRedirectUri: string;
8
+ cancelRedirectUri: string;
9
+ extraFields?: unknown;
10
+ };
11
+ export type UpdatePaymentLinkDto<CurrencyEnum> = IdDto &
12
+ Partial<CreatePaymentLinkDto<CurrencyEnum>>;
13
+ export type PaymentLinkDto<CurrencyEnum> = IdDto &
14
+ CreatePaymentLinkDto<CurrencyEnum> &
15
+ Partial<RecordTimingDto>;
16
+
17
+ export type PaymentLinkServiceParameters<CurrencyEnum> = {
18
+ CreatePaymentLinkDto: CreatePaymentLinkDto<CurrencyEnum>;
19
+ UpdatePaymentLinkDto: UpdatePaymentLinkDto<CurrencyEnum>;
20
+ PaymentLinkDto: PaymentLinkDto<CurrencyEnum>;
21
+ IdDto: IdDto;
22
+ IdsDto: IdsDto;
23
+ };
@@ -0,0 +1,26 @@
1
+ import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
2
+
3
+ export type CreatePlanDto<PlanCadenceEnum, BillingProviderEnum> = {
4
+ active: boolean;
5
+ name: string;
6
+ description?: string;
7
+ price: number;
8
+ cadence: PlanCadenceEnum[keyof PlanCadenceEnum];
9
+ features?: string[];
10
+ extraFields?: unknown;
11
+ externalId: string;
12
+ billingProvider?: BillingProviderEnum[keyof BillingProviderEnum];
13
+ };
14
+ export type UpdatePlanDto<PlanCadenceEnum, BillingProviderEnum> = IdDto &
15
+ Partial<CreatePlanDto<PlanCadenceEnum, BillingProviderEnum>>;
16
+ export type PlanDto<PlanCadenceEnum, BillingProviderEnum> = IdDto &
17
+ CreatePlanDto<PlanCadenceEnum, BillingProviderEnum> &
18
+ Partial<RecordTimingDto>;
19
+
20
+ export type PlanServiceParameters<PlanCadenceEnum, BillingProviderEnum> = {
21
+ CreatePlanDto: CreatePlanDto<PlanCadenceEnum, BillingProviderEnum>;
22
+ UpdatePlanDto: UpdatePlanDto<PlanCadenceEnum, BillingProviderEnum>;
23
+ PlanDto: PlanDto<PlanCadenceEnum, BillingProviderEnum>;
24
+ IdDto: IdDto;
25
+ IdsDto: IdsDto;
26
+ };
@@ -0,0 +1,28 @@
1
+ import { IdDto, IdsDto, RecordTimingDto } from '@forklaunch/common';
2
+
3
+ export type CreateSubscriptionDto<PartyType, BillingProviderType> = {
4
+ partyId: string;
5
+ partyType: PartyType[keyof PartyType];
6
+ description?: string;
7
+ active: boolean;
8
+ productId: string;
9
+ extraFields?: unknown;
10
+ externalId: string;
11
+ billingProvider?: BillingProviderType[keyof BillingProviderType];
12
+ startDate: Date;
13
+ endDate: Date;
14
+ status: string;
15
+ };
16
+ export type UpdateSubscriptionDto<PartyType, BillingProviderType> = IdDto &
17
+ Partial<CreateSubscriptionDto<PartyType, BillingProviderType>>;
18
+ export type SubscriptionDto<PartyType, BillingProviderType> = IdDto &
19
+ CreateSubscriptionDto<PartyType, BillingProviderType> &
20
+ Partial<RecordTimingDto>;
21
+
22
+ export type SubscriptionServiceParameters<PartyType, BillingProviderType> = {
23
+ CreateSubscriptionDto: CreateSubscriptionDto<PartyType, BillingProviderType>;
24
+ UpdateSubscriptionDto: UpdateSubscriptionDto<PartyType, BillingProviderType>;
25
+ SubscriptionDto: SubscriptionDto<PartyType, BillingProviderType>;
26
+ IdDto: IdDto;
27
+ IdsDto: IdsDto;
28
+ };