117 lines
3.5 KiB
TypeScript

export type UserId = string & {
readonly __brand: "UserId";
};
export type OrderId = string & {
readonly __brand: "OrderId";
};
export type InvoiceId = string & {
readonly __brand: "InvoiceId";
};
export type SubscriptionId = string & {
readonly __brand: "SubscriptionId";
};
export type PaymentId = string & {
readonly __brand: "PaymentId";
};
export type CaseId = string & {
readonly __brand: "CaseId";
};
export type SessionId = string & {
readonly __brand: "SessionId";
};
export type WhmcsClientId = number & {
readonly __brand: "WhmcsClientId";
};
export type WhmcsInvoiceId = number & {
readonly __brand: "WhmcsInvoiceId";
};
export type WhmcsProductId = number & {
readonly __brand: "WhmcsProductId";
};
export type SalesforceContactId = string & {
readonly __brand: "SalesforceContactId";
};
export type SalesforceAccountId = string & {
readonly __brand: "SalesforceAccountId";
};
export type SalesforceCaseId = string & {
readonly __brand: "SalesforceCaseId";
};
export declare const createUserId: (id: string) => UserId;
export declare const createOrderId: (id: string) => OrderId;
export declare const createInvoiceId: (id: string) => InvoiceId;
export declare const createSubscriptionId: (id: string) => SubscriptionId;
export declare const createPaymentId: (id: string) => PaymentId;
export declare const createCaseId: (id: string) => CaseId;
export declare const createSessionId: (id: string) => SessionId;
export declare const createWhmcsClientId: (id: number) => WhmcsClientId;
export declare const createWhmcsInvoiceId: (id: number) => WhmcsInvoiceId;
export declare const createWhmcsProductId: (id: number) => WhmcsProductId;
export declare const createSalesforceContactId: (id: string) => SalesforceContactId;
export declare const createSalesforceAccountId: (id: string) => SalesforceAccountId;
export declare const createSalesforceCaseId: (id: string) => SalesforceCaseId;
export declare const isUserId: (id: string) => id is UserId;
export declare const isOrderId: (id: string) => id is OrderId;
export declare const isInvoiceId: (id: string) => id is InvoiceId;
export declare const isWhmcsClientId: (id: number) => id is WhmcsClientId;
export type IsoDateTimeString = string;
export interface BaseEntity {
id: string;
createdAt: string;
updatedAt: string;
}
export interface WhmcsEntity {
id: number;
}
export interface SalesforceEntity {
id: string;
createdDate: string;
lastModifiedDate: string;
}
export interface Paginated<T> {
items: T[];
nextCursor: string | null;
totalCount?: number;
}
export interface IdempotencyKey {
key: string;
userId: string;
createdAt: string;
}
export interface UserMapping {
userId: string;
whmcsClientId: number;
sfContactId?: string;
sfAccountId?: string;
createdAt?: Date;
updatedAt?: Date;
}
export interface UserIdMapping extends UserMapping {
createdAt?: Date;
updatedAt?: Date;
}
export interface CreateMappingRequest {
userId: string;
whmcsClientId: number;
sfAccountId?: string;
}
export interface UpdateMappingRequest {
whmcsClientId?: number;
sfAccountId?: string;
}
export interface MappingStats {
totalMappings: number;
whmcsMappings: number;
salesforceMappings: number;
completeMappings: number;
orphanedMappings: number;
}
export interface Address {
street: string | null;
streetLine2: string | null;
city: string | null;
state: string | null;
postalCode: string | null;
country: string | null;
}