fix(next): add missing deps to nestapp

Because:

* Payments Next errors on start up since NestApp had missing modules.

This commit:

* Adds missing modules and config to NestApp.

Closes #
This commit is contained in:
Reino Muhl 2024-04-24 14:58:09 -04:00
Родитель f40da97c81
Коммит cbd8ddd861
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: C86660FCF998897A
9 изменённых файлов: 154 добавлений и 61 удалений

Просмотреть файл

@ -28,3 +28,26 @@ GEODB_CONFIG__DB_PATH=../../../libs/shared/geodb/db/cities-db.mmdb
# GeoDBManagerConfig
GEODB_MANAGER_CONFIG__LOCATION_OVERRIDE__COUNTRY_CODE=
GEODB_MANAGER_CONFIG__LOCATION_OVERRIDE__POSTAL_CODE=
# StripeConfig
STRIPE_CONFIG__API_KEY=11233
STRIPE_CONFIG__TAX_IDS={}
# PayPal Config
PAYPAL_CLIENT_CONFIG__SANDBOX=false
PAYPAL_CLIENT_CONFIG__USER=ASDF
PAYPAL_CLIENT_CONFIG__PWD=ASDF
PAYPAL_CLIENT_CONFIG__SIGNATURE=ASDF
PAYPAL_CLIENT_CONFIG__RETRY_OPTIONS__RETRIES=1
PAYPAL_CLIENT_CONFIG__RETRY_OPTIONS__MIN_TIMEOUT=1
PAYPAL_CLIENT_CONFIG__RETRY_OPTIONS__FACTOR=1
# Contentful Config
CONTENTFUL_CLIENT_CONFIG__CDN_API_URI=https://cdn.contentful.com
CONTENTFUL_CLIENT_CONFIG__GRAPHQL_API_URI=https://graphql.contentful.com/content/v1
CONTENTFUL_CLIENT_CONFIG__GRAPHQL_API_KEY=
CONTENTFUL_CLIENT_CONFIG__GRAPHQL_SPACE_ID=l7gqxxg5i1gg
CONTENTFUL_CLIENT_CONFIG__GRAPHQL_ENVIRONMENT=dev
CONTENTFUL_CLIENT_CONFIG__FIRESTORE_CACHE_COLLECTION_NAME=contentfulQueryCacheCollection
CONTENTFUL_CLIENT_CONFIG__MEM_CACHE_T_T_L=
CONTENTFUL_CLIENT_CONFIG__FIRESTORE_CACHE_T_T_L=

Просмотреть файл

@ -10,7 +10,7 @@ AUTH__CLIENT_ID=
# NextAuth
NEXTAUTH_URL_INTERNAL=
AUTH_SECRET=
AUTH_SECRET=placeholder
# MySQLConfig
MYSQL_CONFIG__DATABASE=fxa
@ -24,3 +24,24 @@ MYSQL_CONFIG__ACQUIRE_TIMEOUT_MILLIS=
# GeoDBConfig
GEODB_CONFIG__DB_PATH=
STRIPE_CONFIG__API_KEY=11233
STRIPE_CONFIG__TAX_IDS={}
PAYPAL_CLIENT_CONFIG__SANDBOX=false
PAYPAL_CLIENT_CONFIG__USER=ASDF
PAYPAL_CLIENT_CONFIG__PWD=ASDF
PAYPAL_CLIENT_CONFIG__SIGNATURE=ASDF
PAYPAL_CLIENT_CONFIG__RETRY_OPTIONS__RETRIES=1
PAYPAL_CLIENT_CONFIG__RETRY_OPTIONS__MIN_TIMEOUT=1
PAYPAL_CLIENT_CONFIG__RETRY_OPTIONS__FACTOR=1
# Contentful Config
CONTENTFUL_CLIENT_CONFIG__CDN_API_URI=https://cdn.contentful.com
CONTENTFUL_CLIENT_CONFIG__GRAPHQL_API_URI=https://graphql.contentful.com/content/v1
CONTENTFUL_CLIENT_CONFIG__GRAPHQL_API_KEY=
CONTENTFUL_CLIENT_CONFIG__GRAPHQL_SPACE_ID=l7gqxxg5i1gg
CONTENTFUL_CLIENT_CONFIG__GRAPHQL_ENVIRONMENT=master
CONTENTFUL_CLIENT_CONFIG__FIRESTORE_CACHE_COLLECTION_NAME=contentfulQueryCacheCollection
CONTENTFUL_CLIENT_CONFIG__MEM_CACHE_T_T_L=
CONTENTFUL_CLIENT_CONFIG__FIRESTORE_CACHE_T_T_L=

Просмотреть файл

@ -1,15 +1,6 @@
{
"name": "payments-next",
"version": "0.0.1",
"dependencies": {
"@fluent/bundle": "0.18.0",
"next": "13.5.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"stripe": "11.14.0",
"tslib": "2.5.0",
"typescript": "^5.3.3"
},
"scripts": {
"start": "next start"
}

Просмотреть файл

@ -2,12 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { Transform } from 'class-transformer';
import { IsObject, IsString } from 'class-validator';
export class StripeConfig {
@IsString()
public readonly apiKey!: string;
@Transform(
({ value }) => (value instanceof Object ? value : JSON.parse(value)),
{ toClassOnly: true }
)
@IsObject()
public readonly taxIds!: { [key: string]: string };
}

Просмотреть файл

@ -10,10 +10,27 @@ import { Module } from '@nestjs/common';
import { RootConfig } from './config';
import { LocalizerRscFactoryProvider } from '@fxa/shared/l10n/server';
import { AccountCustomerManager } from '@fxa/payments/stripe';
import {
AccountCustomerManager,
StripeClient,
StripeManager,
} from '@fxa/payments/stripe';
import { NextJSActionsService } from './nextjs-actions.service';
import { GeoDBManager, GeoDBNestFactory } from '@fxa/shared/geodb';
import { validate } from '../config.utils';
import {
EligibilityManager,
EligibilityService,
} from '@fxa/payments/eligibility';
import { CheckoutService } from 'libs/payments/cart/src/lib/checkout.service';
import { ContentfulClient, ContentfulManager } from '@fxa/shared/contentful';
import {
PayPalClient,
PayPalManager,
PaypalCustomerManager,
} from '@fxa/payments/paypal';
import { FirestoreService } from '@fxa/shared/db/firestore';
import { StatsD } from 'hot-shots';
@Module({
imports: [
@ -27,14 +44,32 @@ import { validate } from '../config.utils';
],
controllers: [],
providers: [
AccountDatabaseNestFactory,
{
provide: FirestoreService,
useValue: {}, //Temporary value to resolve Payments Next startup issues
},
{
provide: StatsD,
useValue: {}, //Temporary value to resolve Payments Next startup issues
},
LocalizerRscFactoryProvider,
NextJSActionsService,
AccountDatabaseNestFactory,
AccountCustomerManager,
CartService,
CartManager,
LocalizerRscFactoryProvider,
GeoDBNestFactory,
GeoDBManager,
EligibilityService,
EligibilityManager,
CheckoutService,
ContentfulClient,
ContentfulManager,
StripeManager,
StripeClient,
PayPalClient,
PaypalCustomerManager,
PayPalManager,
],
})
export class AppModule {}

Просмотреть файл

@ -7,6 +7,9 @@ import { IsDefined, ValidateNested } from 'class-validator';
import { MySQLConfig } from '@fxa/shared/db/mysql/core';
import { GeoDBConfig, GeoDBManagerConfig } from '@fxa/shared/geodb';
import { PaypalClientConfig } from 'libs/payments/paypal/src/lib/paypal.client.config';
import { StripeConfig } from '@fxa/payments/stripe';
import { ContentfulClientConfig } from '@fxa/shared/contentful';
export class RootConfig {
@Type(() => MySQLConfig)
@ -22,4 +25,19 @@ export class RootConfig {
@Type(() => GeoDBManagerConfig)
@ValidateNested()
public readonly geodbManagerConfig!: Partial<GeoDBManagerConfig>;
@Type(() => StripeConfig)
@ValidateNested()
@IsDefined()
public readonly stripeConfig!: Partial<StripeConfig>;
@Type(() => PaypalClientConfig)
@ValidateNested()
@IsDefined()
public readonly paypalClientConfig!: Partial<PaypalClientConfig>;
@Type(() => ContentfulClientConfig)
@ValidateNested()
@IsDefined()
public readonly contentfulClientConfig!: Partial<ContentfulClientConfig>;
}

Просмотреть файл

@ -8,7 +8,7 @@ import { getLocationData } from './geodb.repository';
import { GeoDBManagerConfig } from './geodb.config';
import { TaxAddress } from './geodb.types';
Injectable();
@Injectable()
export class GeoDBManager {
constructor(
@Inject(GeoDBProvider) private reader: GeoDBCityReader,

Просмотреть файл

@ -93,7 +93,7 @@
"mysql2": "^3.9.4",
"nest-typed-config": "^2.9.2",
"nest-winston": "^1.9.4",
"next": "14.2.0",
"next": "^14.2.3",
"next-auth": "beta",
"node-fetch": "^2.6.7",
"nps": "^5.10.0",

Просмотреть файл

@ -12235,10 +12235,10 @@ __metadata:
languageName: node
linkType: hard
"@next/env@npm:14.2.0":
version: 14.2.0
resolution: "@next/env@npm:14.2.0"
checksum: c99722ed9cbd977aa714d767b928bb6bd84e97bdab09966c07b69dda8c87edbea69b8d2024d36285128ab46ea4b629fdba53f7928bf5043b47d2da85d1016ccc
"@next/env@npm:14.2.3":
version: 14.2.3
resolution: "@next/env@npm:14.2.3"
checksum: 47ddb64ec6cdc13dfcf560ba42cce71d7948174bf800162738e20ba0147cc46a5f6fdde1eb7957a3676a9eca6dccf6603836ed7c755eab238d9f5c73614d9880
languageName: node
linkType: hard
@ -12251,65 +12251,65 @@ __metadata:
languageName: node
linkType: hard
"@next/swc-darwin-arm64@npm:14.2.0":
version: 14.2.0
resolution: "@next/swc-darwin-arm64@npm:14.2.0"
"@next/swc-darwin-arm64@npm:14.2.3":
version: 14.2.3
resolution: "@next/swc-darwin-arm64@npm:14.2.3"
conditions: os=darwin & cpu=arm64
languageName: node
linkType: hard
"@next/swc-darwin-x64@npm:14.2.0":
version: 14.2.0
resolution: "@next/swc-darwin-x64@npm:14.2.0"
"@next/swc-darwin-x64@npm:14.2.3":
version: 14.2.3
resolution: "@next/swc-darwin-x64@npm:14.2.3"
conditions: os=darwin & cpu=x64
languageName: node
linkType: hard
"@next/swc-linux-arm64-gnu@npm:14.2.0":
version: 14.2.0
resolution: "@next/swc-linux-arm64-gnu@npm:14.2.0"
"@next/swc-linux-arm64-gnu@npm:14.2.3":
version: 14.2.3
resolution: "@next/swc-linux-arm64-gnu@npm:14.2.3"
conditions: os=linux & cpu=arm64 & libc=glibc
languageName: node
linkType: hard
"@next/swc-linux-arm64-musl@npm:14.2.0":
version: 14.2.0
resolution: "@next/swc-linux-arm64-musl@npm:14.2.0"
"@next/swc-linux-arm64-musl@npm:14.2.3":
version: 14.2.3
resolution: "@next/swc-linux-arm64-musl@npm:14.2.3"
conditions: os=linux & cpu=arm64 & libc=musl
languageName: node
linkType: hard
"@next/swc-linux-x64-gnu@npm:14.2.0":
version: 14.2.0
resolution: "@next/swc-linux-x64-gnu@npm:14.2.0"
"@next/swc-linux-x64-gnu@npm:14.2.3":
version: 14.2.3
resolution: "@next/swc-linux-x64-gnu@npm:14.2.3"
conditions: os=linux & cpu=x64 & libc=glibc
languageName: node
linkType: hard
"@next/swc-linux-x64-musl@npm:14.2.0":
version: 14.2.0
resolution: "@next/swc-linux-x64-musl@npm:14.2.0"
"@next/swc-linux-x64-musl@npm:14.2.3":
version: 14.2.3
resolution: "@next/swc-linux-x64-musl@npm:14.2.3"
conditions: os=linux & cpu=x64 & libc=musl
languageName: node
linkType: hard
"@next/swc-win32-arm64-msvc@npm:14.2.0":
version: 14.2.0
resolution: "@next/swc-win32-arm64-msvc@npm:14.2.0"
"@next/swc-win32-arm64-msvc@npm:14.2.3":
version: 14.2.3
resolution: "@next/swc-win32-arm64-msvc@npm:14.2.3"
conditions: os=win32 & cpu=arm64
languageName: node
linkType: hard
"@next/swc-win32-ia32-msvc@npm:14.2.0":
version: 14.2.0
resolution: "@next/swc-win32-ia32-msvc@npm:14.2.0"
"@next/swc-win32-ia32-msvc@npm:14.2.3":
version: 14.2.3
resolution: "@next/swc-win32-ia32-msvc@npm:14.2.3"
conditions: os=win32 & cpu=ia32
languageName: node
linkType: hard
"@next/swc-win32-x64-msvc@npm:14.2.0":
version: 14.2.0
resolution: "@next/swc-win32-x64-msvc@npm:14.2.0"
"@next/swc-win32-x64-msvc@npm:14.2.3":
version: 14.2.3
resolution: "@next/swc-win32-x64-msvc@npm:14.2.3"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard
@ -38575,7 +38575,7 @@ fsevents@~2.1.1:
mysql2: ^3.9.4
nest-typed-config: ^2.9.2
nest-winston: ^1.9.4
next: 14.2.0
next: ^14.2.3
next-auth: beta
node-fetch: ^2.6.7
nps: ^5.10.0
@ -50235,20 +50235,20 @@ fsevents@~2.1.1:
languageName: node
linkType: hard
"next@npm:14.2.0":
version: 14.2.0
resolution: "next@npm:14.2.0"
"next@npm:^14.2.3":
version: 14.2.3
resolution: "next@npm:14.2.3"
dependencies:
"@next/env": 14.2.0
"@next/swc-darwin-arm64": 14.2.0
"@next/swc-darwin-x64": 14.2.0
"@next/swc-linux-arm64-gnu": 14.2.0
"@next/swc-linux-arm64-musl": 14.2.0
"@next/swc-linux-x64-gnu": 14.2.0
"@next/swc-linux-x64-musl": 14.2.0
"@next/swc-win32-arm64-msvc": 14.2.0
"@next/swc-win32-ia32-msvc": 14.2.0
"@next/swc-win32-x64-msvc": 14.2.0
"@next/env": 14.2.3
"@next/swc-darwin-arm64": 14.2.3
"@next/swc-darwin-x64": 14.2.3
"@next/swc-linux-arm64-gnu": 14.2.3
"@next/swc-linux-arm64-musl": 14.2.3
"@next/swc-linux-x64-gnu": 14.2.3
"@next/swc-linux-x64-musl": 14.2.3
"@next/swc-win32-arm64-msvc": 14.2.3
"@next/swc-win32-ia32-msvc": 14.2.3
"@next/swc-win32-x64-msvc": 14.2.3
"@swc/helpers": 0.5.5
busboy: 1.6.0
caniuse-lite: ^1.0.30001579
@ -50289,7 +50289,7 @@ fsevents@~2.1.1:
optional: true
bin:
next: dist/bin/next
checksum: 390f72a3465030a75e03f45fc0779d19d5b755c12b57f0352606b576ee1c106c917036183ece0fbb8c424a7aefb6afc12614106da891016a9ced41f4feb7cfa2
checksum: d34ea63adf23fe46efebe2a9c536c9127c0ee006d74c60d6d23aecbef650798c976b27c17910ca585f3bb1223b10924cb429b9ce930f3074aee1170d1519dccc
languageName: node
linkType: hard