Skip to content

Commit

Permalink
feat(all): use singleton injection token factory for driver tokens (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
griest024 authored Oct 15, 2024
1 parent 46c8e96 commit 2b16c62
Show file tree
Hide file tree
Showing 32 changed files with 64 additions and 64 deletions.
4 changes: 2 additions & 2 deletions libs/auth/driver/src/interfaces/auth-service.interface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Observable } from 'rxjs';

import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

export interface DaffAuthServiceInterface {
/**
Expand All @@ -12,4 +12,4 @@ export interface DaffAuthServiceInterface {
export const {
token: DaffAuthDriver,
provider: daffProvideAuthDriver,
} = createSingleInjectionToken<DaffAuthServiceInterface>('DaffAuthDriver');
} = createSingletonInjectionToken<DaffAuthServiceInterface>('DaffAuthDriver');
4 changes: 2 additions & 2 deletions libs/auth/driver/src/interfaces/login-service.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
DaffLoginInfo,
DaffAuthToken,
} from '@daffodil/auth';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

export interface DaffLoginServiceInterface<
TRequest extends DaffLoginInfo = DaffLoginInfo,
Expand All @@ -26,4 +26,4 @@ export interface DaffLoginServiceInterface<
export const {
token: DaffLoginDriver,
provider: daffProvideLoginDriver,
} = createSingleInjectionToken<DaffLoginServiceInterface>('DaffLoginDriver');
} = createSingletonInjectionToken<DaffLoginServiceInterface>('DaffLoginDriver');
4 changes: 2 additions & 2 deletions libs/auth/driver/src/interfaces/register-service.interface.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Observable } from 'rxjs';

import { DaffAccountRegistration } from '@daffodil/auth';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

export interface DaffRegisterServiceInterface<
TRequest extends DaffAccountRegistration = DaffAccountRegistration,
Expand All @@ -26,4 +26,4 @@ export interface DaffRegisterServiceInterface<
export const {
token: DaffRegisterDriver,
provider: daffProvideRegisterDriver,
} = createSingleInjectionToken<DaffRegisterServiceInterface>('DaffRegisterDriver');
} = createSingletonInjectionToken<DaffRegisterServiceInterface>('DaffRegisterDriver');
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Observable } from 'rxjs';

import { DaffAuthResetPasswordInfo } from '@daffodil/auth';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

export interface DaffResetPasswordServiceInterface<
T extends DaffAuthResetPasswordInfo = DaffAuthResetPasswordInfo,
Expand All @@ -26,4 +26,4 @@ export interface DaffResetPasswordServiceInterface<
export const {
token: DaffResetPasswordDriver,
provider: daffProvideResetPasswordDriver,
} = createSingleInjectionToken<DaffResetPasswordServiceInterface>('DaffResetPasswordDriver');
} = createSingletonInjectionToken<DaffResetPasswordServiceInterface>('DaffResetPasswordDriver');
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Observable } from 'rxjs';

import { DaffAuthorizeNetTokenRequest } from '@daffodil/authorizenet';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

export const {
token: DaffAuthorizeNetDriver,
provider: daffProvideAuthorizeNetDriver,
} = createSingleInjectionToken<DaffAuthorizeNetService>('DaffAuthorizeNetDriver');
} = createSingletonInjectionToken<DaffAuthorizeNetService>('DaffAuthorizeNetDriver');

export interface DaffAuthorizeNetService<T extends DaffAuthorizeNetTokenRequest = DaffAuthorizeNetTokenRequest> {
generateToken(paymentTokenRequest: T): Observable<any>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
DaffAuthorizenetPaymentRequest,
DaffAuthorizenetPaymentResponse,
} from '@daffodil/authorizenet';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';
import { DaffPaymentDriverInterface } from '@daffodil/payment/driver';

export const {
Expand All @@ -13,7 +13,7 @@ export const {
*/
token: DaffAuthorizeNetPaymentDriver,
provider: daffProvideAuthorizeNetPaymentDriver,
} = createSingleInjectionToken<DaffAuthorizeNetPaymentDriverInterface>('DaffAuthorizeNetPaymentDriver');
} = createSingletonInjectionToken<DaffAuthorizeNetPaymentDriverInterface>('DaffAuthorizeNetPaymentDriver');

/**
* @inheritdoc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Observable } from 'rxjs';

import { DaffCartWithStoreCredit } from '@daffodil/cart-store-credit';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

/**
* An injection token for the cart store credit driver.
*/
export const {
token: DaffCartStoreCreditDriver,
provider: daffProvideCartStoreCreditDriver,
} = createSingleInjectionToken<DaffCartStoreCreditDriverInterface>('DaffCartStoreCreditDriver');
} = createSingletonInjectionToken<DaffCartStoreCreditDriverInterface>('DaffCartStoreCreditDriver');

/**
* The cart store credit driver is responsible for loading carts.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
DaffCartAddress,
DaffCart,
} from '@daffodil/cart';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

/**
* The interface responsible for managing the address of a cart.
Expand All @@ -19,4 +19,4 @@ export interface DaffCartAddressServiceInterface<T extends DaffCart = DaffCart>
export const {
token: DaffCartAddressDriver,
provider: daffProvideCartAddressDriver,
} = createSingleInjectionToken<DaffCartAddressServiceInterface>('DaffCartAddressDriver');
} = createSingletonInjectionToken<DaffCartAddressServiceInterface>('DaffCartAddressDriver');
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
DaffCartAddress,
DaffCart,
} from '@daffodil/cart';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

/**
* The interface responsible for managing the billing address of a cart.
Expand All @@ -24,4 +24,4 @@ export interface DaffCartBillingAddressServiceInterface<T extends DaffCart = Daf
export const {
token: DaffCartBillingAddressDriver,
provider: daffProvideCartBillingAddressDriver,
} = createSingleInjectionToken<DaffCartBillingAddressServiceInterface>('DaffCartBillingAddressDriver');
} = createSingletonInjectionToken<DaffCartBillingAddressServiceInterface>('DaffCartBillingAddressDriver');
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
DaffCart,
DaffCartCoupon,
} from '@daffodil/cart';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

/**
* The interface responsible for applying a coupon to a cart.
Expand Down Expand Up @@ -34,4 +34,4 @@ export interface DaffCartCouponServiceInterface<T extends DaffCart = DaffCart> {
export const {
token: DaffCartCouponDriver,
provider: daffProvideCartCouponDriver,
} = createSingleInjectionToken<DaffCartCouponServiceInterface>('DaffCartCouponDriver');
} = createSingletonInjectionToken<DaffCartCouponServiceInterface>('DaffCartCouponDriver');
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
DaffCartItemInput,
DaffCart,
} from '@daffodil/cart';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

/**
* The interface responsible for managing the items of a cart.
Expand Down Expand Up @@ -47,4 +47,4 @@ export interface DaffCartItemServiceInterface<
export const {
token: DaffCartItemDriver,
provider: daffProvideCartItemDriver,
} = createSingleInjectionToken<DaffCartItemServiceInterface>('DaffCartItemDriver');
} = createSingletonInjectionToken<DaffCartItemServiceInterface>('DaffCartItemDriver');
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
DaffCart,
DaffCartOrderResult,
} from '@daffodil/cart';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

/**
* The interface responsible for placing an order for the customer's cart.
Expand All @@ -22,4 +22,4 @@ export interface DaffCartOrderServiceInterface<
export const {
token: DaffCartOrderDriver,
provider: daffProvideCartOrderDriver,
} = createSingleInjectionToken<DaffCartOrderServiceInterface>('DaffCartOrderDriver');
} = createSingletonInjectionToken<DaffCartOrderServiceInterface>('DaffCartOrderDriver');
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
DaffCartPaymentMethod,
DaffCart,
} from '@daffodil/cart';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

/**
* The interface responsible for retrieving the available payment methods of a cart.
Expand All @@ -19,4 +19,4 @@ export interface DaffCartPaymentMethodsServiceInterface<T extends DaffCartPaymen
export const {
token: DaffCartPaymentMethodsDriver,
provider: daffProvideCartPaymentMethodsDriver,
} = createSingleInjectionToken<DaffCartPaymentMethodsServiceInterface>('DaffCartPaymentMethodsDriver');
} = createSingletonInjectionToken<DaffCartPaymentMethodsServiceInterface>('DaffCartPaymentMethodsDriver');
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
DaffCart,
DaffCartAddress,
} from '@daffodil/cart';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

/**
* The interface responsible for managing the selected payment method of a cart.
Expand Down Expand Up @@ -39,4 +39,4 @@ export interface DaffCartPaymentServiceInterface<T extends DaffCart = DaffCart>
export const {
token: DaffCartPaymentDriver,
provider: daffProvideCartPaymentDriver,
} = createSingleInjectionToken<DaffCartPaymentServiceInterface>('DaffCartPaymentDriver');
} = createSingletonInjectionToken<DaffCartPaymentServiceInterface>('DaffCartPaymentDriver');
4 changes: 2 additions & 2 deletions libs/cart/driver/src/interfaces/cart-service.interface.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Observable } from 'rxjs';

import { DaffCart } from '@daffodil/cart';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';
import { DaffDriverResponse } from '@daffodil/driver';

/**
Expand Down Expand Up @@ -40,4 +40,4 @@ export interface DaffCartServiceInterface<T extends DaffCart = DaffCart> {
export const {
token: DaffCartDriver,
provider: daffProvideCartDriver,
} = createSingleInjectionToken<DaffCartServiceInterface>('DaffCartDriver');
} = createSingletonInjectionToken<DaffCartServiceInterface>('DaffCartDriver');
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
DaffCartAddress,
DaffCart,
} from '@daffodil/cart';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

/**
* The interface responsible for managing the shipping address of a cart.
Expand All @@ -24,4 +24,4 @@ export interface DaffCartShippingAddressServiceInterface<T extends DaffCart = Da
export const {
token: DaffCartShippingAddressDriver,
provider: daffProvideCartShippingAddressDriver,
} = createSingleInjectionToken<DaffCartShippingAddressServiceInterface>('DaffCartShippingAddressDriver');
} = createSingletonInjectionToken<DaffCartShippingAddressServiceInterface>('DaffCartShippingAddressDriver');
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
DaffCartShippingRate,
DaffCart,
} from '@daffodil/cart';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

/**
* The interface responsible for mediating the interaction of the shipping
Expand All @@ -30,4 +30,4 @@ export interface DaffCartShippingInformationServiceInterface<T extends DaffCart
export const {
token: DaffCartShippingInformationDriver,
provider: daffProvideCartShippingInformationDriver,
} = createSingleInjectionToken<DaffCartShippingInformationServiceInterface>('DaffCartShippingInformationDriver');
} = createSingletonInjectionToken<DaffCartShippingInformationServiceInterface>('DaffCartShippingInformationDriver');
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
DaffCartShippingRate,
DaffCart,
} from '@daffodil/cart';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

/**
* The interface responsible for retrieving the available shipping methods of a cart.
Expand All @@ -21,4 +21,4 @@ export interface DaffCartShippingMethodsServiceInterface<
export const {
token: DaffCartShippingMethodsDriver,
provider: daffProvideCartShippingMethodsDriver,
} = createSingleInjectionToken<DaffCartShippingMethodsServiceInterface>('DaffCartShippingMethodsDriver');
} = createSingletonInjectionToken<DaffCartShippingMethodsServiceInterface>('DaffCartShippingMethodsDriver');
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
DaffCategoryIdRequest,
DaffCategoryUrlRequest,
} from '@daffodil/category';
import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';
import { DaffProduct } from '@daffodil/product';

/**
Expand All @@ -32,4 +32,4 @@ export interface DaffCategoryServiceInterface<
export const {
token: DaffCategoryDriver,
provider: daffProvideCategoryDriver,
} = createSingleInjectionToken<any>('DaffCategoryDriver');
} = createSingletonInjectionToken<any>('DaffCategoryDriver');
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Observable } from 'rxjs';

import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';

export const {
token: DaffContactDriver,
provider: daffProvideContactDriver,
} = createSingleInjectionToken<DaffContactServiceInterface<any, any>>('DaffContactDriver');
} = createSingletonInjectionToken<DaffContactServiceInterface<any, any>>('DaffContactDriver');
export interface DaffContactServiceInterface<T, V> {
send(payload: T): Observable<V>;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Observable } from 'rxjs';

import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';
import { DaffCustomerPaymentAuthorizeNetApplyRequest } from '@daffodil/customer-payment-authorizenet';
import { DaffPaymentResponse } from '@daffodil/payment';
import { DaffPaymentDriverInterface } from '@daffodil/payment/driver';
Expand All @@ -11,7 +11,7 @@ export const {
*/
token: DaffCustomerPaymentAuthorizeNetPaymentDriver,
provider: daffProvideCustomerPaymentAuthorizeNetPaymentDriver,
} = createSingleInjectionToken<DaffCustomerPaymentAuthorizeNetPaymentDriverInterface>('DaffCustomerPaymentAuthorizeNetPaymentDriver');
} = createSingletonInjectionToken<DaffCustomerPaymentAuthorizeNetPaymentDriverInterface>('DaffCustomerPaymentAuthorizeNetPaymentDriver');

/**
* @inheritdoc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Observable } from 'rxjs';

import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';
import { DaffCustomerStoreCredit } from '@daffodil/customer-store-credit';

export const {
Expand All @@ -9,7 +9,7 @@ export const {
*/
token: DaffCustomerStoreCreditDriver,
provider: daffProvideCustomerStoreCreditDriver,
} = createSingleInjectionToken<DaffCustomerStoreCreditDriverInterface>('DaffCustomerStoreCreditDriver');
} = createSingletonInjectionToken<DaffCustomerStoreCreditDriverInterface>('DaffCustomerStoreCreditDriver');

/**
* The customer store credit driver is responsible for loading customers.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Observable } from 'rxjs';

import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';
import { DaffCustomer } from '@daffodil/customer';

export const {
Expand All @@ -9,7 +9,7 @@ export const {
*/
token: DaffCustomerDriver,
provider: daffProvideCustomerDriver,
} = createSingleInjectionToken<DaffCustomerDriverInterface>('DaffCustomerDriver');
} = createSingletonInjectionToken<DaffCustomerDriverInterface>('DaffCustomerDriver');

/**
* The customer driver is responsible for loading customers.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Observable } from 'rxjs';

import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';
import { DaffExternallyResolvableUrl } from '@daffodil/external-router';

export const {
Expand All @@ -9,7 +9,7 @@ export const {
*/
token: DaffExternalRouterDriver,
provider: daffProvideExternalRouterDriver,
} = createSingleInjectionToken<DaffExternalRouterDriverInterface>('DaffExternalRouterDriver');
} = createSingletonInjectionToken<DaffExternalRouterDriverInterface>('DaffExternalRouterDriver');

/**
* The interface for a @daffodil/external-router driver.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Observable } from 'rxjs';

import { createSingleInjectionToken } from '@daffodil/core';
import { createSingletonInjectionToken } from '@daffodil/core';
import { DaffCountry } from '@daffodil/geography';

export const {
token: DaffGeographyDriver,
provider: daffProvideGeographyDriver,
} = createSingleInjectionToken<DaffGeographyServiceInterface>('DaffGeographyDriver');
} = createSingletonInjectionToken<DaffGeographyServiceInterface>('DaffGeographyDriver');

export interface DaffGeographyServiceInterface<T extends DaffCountry = DaffCountry> {
/**
Expand Down
Loading

0 comments on commit 2b16c62

Please sign in to comment.