init
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
import { MoneroConfirmationTier } from './MoneroConfirmationTier';
|
||||
import { MoneroWalletConfig } from './MoneroWalletConfig';
|
||||
import { NodeEnv } from './NodeEnv';
|
||||
import { PaymentMethod } from '../modules/payment/types/PaymentMethod';
|
||||
import { ShopFiatCurrency } from './ShopFiatCurrency';
|
||||
import { SimplexConfig } from './SimplexConfig';
|
||||
|
||||
export interface SignedCookieProfileConfig {
|
||||
cookieName: string;
|
||||
expiresInMs: number;
|
||||
}
|
||||
|
||||
export interface SignedCookieConfig {
|
||||
jwtSecret: string;
|
||||
feedback: SignedCookieProfileConfig;
|
||||
cart: SignedCookieProfileConfig;
|
||||
captcha: SignedCookieProfileConfig;
|
||||
discount: SignedCookieProfileConfig;
|
||||
error: SignedCookieProfileConfig;
|
||||
checkoutSession: SignedCookieProfileConfig;
|
||||
orderAuth: SignedCookieProfileConfig;
|
||||
theme: SignedCookieProfileConfig;
|
||||
}
|
||||
|
||||
export interface CaptchaConfig {
|
||||
length: number;
|
||||
}
|
||||
|
||||
export interface ThrottleConfig {
|
||||
ttlMs: number;
|
||||
limit: number;
|
||||
}
|
||||
|
||||
export interface AppConfig {
|
||||
port: number;
|
||||
nodeEnv: NodeEnv;
|
||||
corsOrigins: string[];
|
||||
cmsPassword: string;
|
||||
captcha: CaptchaConfig;
|
||||
throttle: ThrottleConfig;
|
||||
signedCookie: SignedCookieConfig;
|
||||
validation: {
|
||||
productTitleMaxLength: number;
|
||||
categoryNameMaxLength: number;
|
||||
discountCodeMaxLength: number;
|
||||
variantImagesMax: number;
|
||||
digitalStockAttachmentsMax: number;
|
||||
shippingNoteMinLength: number;
|
||||
shippingNoteMaxLength: number;
|
||||
orderMessageMaxLength: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ShopSettingsConfig {
|
||||
shopName: string;
|
||||
shopFiatCurrency: ShopFiatCurrency;
|
||||
monero: {
|
||||
confirmationTiers: MoneroConfirmationTier[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface JwtConfig {
|
||||
secret: string;
|
||||
expiresInMs: number;
|
||||
}
|
||||
|
||||
export interface PostgresConfig {
|
||||
type: 'postgres';
|
||||
url: string;
|
||||
host: string;
|
||||
username: string;
|
||||
password: string;
|
||||
port: number;
|
||||
database: string;
|
||||
entities: string[];
|
||||
migrations: string[];
|
||||
migrationsRun: boolean;
|
||||
}
|
||||
|
||||
export interface MulterConfig {
|
||||
allowedMimes: readonly string[];
|
||||
maxFileBytes: number;
|
||||
}
|
||||
|
||||
export interface CoingeckoConfig {
|
||||
apiBaseUrl: string;
|
||||
xmrRateFetchTimeoutMs: number;
|
||||
}
|
||||
|
||||
export interface KrakenConfig {
|
||||
apiBaseUrl: string;
|
||||
xmrRateFetchTimeoutMs: number;
|
||||
}
|
||||
|
||||
export interface EncryptionConfig {
|
||||
keyBase64: string;
|
||||
}
|
||||
|
||||
export interface OrderConfig {
|
||||
checkoutValidityMs: number;
|
||||
shippingPaymentValidityMs: number;
|
||||
checkoutStatusRefreshSec: number;
|
||||
dataRetentionDays: number;
|
||||
}
|
||||
|
||||
export interface InvoiceConfig {
|
||||
minByMethod: Record<PaymentMethod, string>;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
app: AppConfig;
|
||||
postgres: PostgresConfig;
|
||||
jwt: JwtConfig;
|
||||
coingecko: CoingeckoConfig;
|
||||
kraken: KrakenConfig;
|
||||
encryption: EncryptionConfig;
|
||||
shopSettings: ShopSettingsConfig;
|
||||
order: OrderConfig;
|
||||
invoice: InvoiceConfig;
|
||||
moneroWallet: MoneroWalletConfig;
|
||||
simplex: SimplexConfig;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export type DiskFileTypeValidatorOptions = {
|
||||
fileType: RegExp;
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface MoneroConfirmationTier {
|
||||
upToTotalFiat?: string;
|
||||
minConfirmations: number;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export enum MoneroNetwork {
|
||||
Mainnet = 'mainnet',
|
||||
Stagenet = 'stagenet'
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { MoneroNetwork } from './MoneroNetwork';
|
||||
|
||||
export interface MoneroWalletConfig {
|
||||
network: MoneroNetwork;
|
||||
rpcUrl: string;
|
||||
daemonRpcUrl: string;
|
||||
username: string;
|
||||
password: string;
|
||||
rpcTimeoutMs: number;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export enum NodeEnv {
|
||||
Development = 'development',
|
||||
Production = 'production'
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export type PaginatedResponse<T> = {
|
||||
items: T[];
|
||||
total: number;
|
||||
page: number;
|
||||
limit: number;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
export enum ShopFiatCurrency {
|
||||
Usd = 'USD',
|
||||
Eur = 'EUR',
|
||||
Gbp = 'GBP',
|
||||
Cad = 'CAD',
|
||||
Aud = 'AUD',
|
||||
Chf = 'CHF'
|
||||
}
|
||||
|
||||
export const SHOP_FIAT_CURRENCY_VALUES = Object.values(ShopFiatCurrency);
|
||||
@@ -0,0 +1,4 @@
|
||||
export enum ShopSurface {
|
||||
Clearnet = 'clearnet',
|
||||
Onion = 'onion'
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface SimplexConfig {
|
||||
wsUrl: string;
|
||||
botDisplayName: string;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export type UploadFileSource = 'disk' | 'buffer';
|
||||
@@ -0,0 +1,3 @@
|
||||
export type ValidatedUploadFile = Express.Multer.File & {
|
||||
detectedMimeType: string;
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
export type InformationSchemaTableRow = {
|
||||
table_name: string;
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
export type PgEnumTypeRow = {
|
||||
typname: string;
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
import { StorefrontOrderRefreshSection } from '../../consts/storefrontOrderRefreshSection';
|
||||
|
||||
export type StorefrontOrderRefreshSection =
|
||||
(typeof StorefrontOrderRefreshSection)[keyof typeof StorefrontOrderRefreshSection];
|
||||
@@ -0,0 +1,3 @@
|
||||
export interface IsBase64Options {
|
||||
byteLength?: number;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export type NullOrIntOptions = {
|
||||
min?: number;
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
export type NullOrNumberOptions = {
|
||||
min?: number;
|
||||
};
|
||||
Reference in New Issue
Block a user