Add wave-mcp/src/types.ts
This commit is contained in:
parent
6ac85284c2
commit
bc56a8cda8
1 changed files with 161 additions and 0 deletions
161
wave-mcp/src/types.ts
Normal file
161
wave-mcp/src/types.ts
Normal file
|
|
@ -0,0 +1,161 @@
|
||||||
|
// ── Config ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export interface WaveConfig {
|
||||||
|
accessToken: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Pagination ────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export interface PageInfo {
|
||||||
|
currentPage: number;
|
||||||
|
totalPages: number;
|
||||||
|
totalCount: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PaginatedResult<T = unknown> {
|
||||||
|
total: number;
|
||||||
|
count: number;
|
||||||
|
page: number;
|
||||||
|
totalPages: number;
|
||||||
|
items: T[];
|
||||||
|
has_more: boolean;
|
||||||
|
next_page?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── GraphQL ───────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export interface GraphQLResponse<T = unknown> {
|
||||||
|
data?: T;
|
||||||
|
errors?: Array<{ message: string; locations?: unknown; path?: unknown }>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MutationResult {
|
||||||
|
didSucceed: boolean;
|
||||||
|
inputErrors: Array<{
|
||||||
|
code: string;
|
||||||
|
message: string;
|
||||||
|
path?: string[];
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Index-signature base (required for structuredContent) ────────────────────
|
||||||
|
|
||||||
|
export type JsonObject = { [key: string]: unknown };
|
||||||
|
|
||||||
|
// ── Wave Entities ─────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export interface WaveBusiness extends JsonObject {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
isPersonal: boolean;
|
||||||
|
organizationalType?: string;
|
||||||
|
isClassicAccounting: boolean;
|
||||||
|
isClassicInvoicing: boolean;
|
||||||
|
currency: { code: string; symbol: string; name: string };
|
||||||
|
address?: {
|
||||||
|
addressLine1?: string;
|
||||||
|
addressLine2?: string;
|
||||||
|
city?: string;
|
||||||
|
province?: { name: string; code: string };
|
||||||
|
country?: { name: string; code: string };
|
||||||
|
postalCode?: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WaveCustomer extends JsonObject {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
firstName?: string;
|
||||||
|
lastName?: string;
|
||||||
|
email?: string;
|
||||||
|
currency?: { code: string };
|
||||||
|
address?: {
|
||||||
|
addressLine1?: string;
|
||||||
|
city?: string;
|
||||||
|
country?: { name: string; code: string };
|
||||||
|
postalCode?: string;
|
||||||
|
};
|
||||||
|
createdAt: string;
|
||||||
|
modifiedAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WaveProduct extends JsonObject {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
description?: string;
|
||||||
|
unitPrice?: number;
|
||||||
|
isSold: boolean;
|
||||||
|
isBought: boolean;
|
||||||
|
isArchived: boolean;
|
||||||
|
incomeAccount?: { id: string; name: string };
|
||||||
|
expenseAccount?: { id: string; name: string };
|
||||||
|
currency?: { code: string };
|
||||||
|
createdAt: string;
|
||||||
|
modifiedAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WaveInvoiceItem extends JsonObject {
|
||||||
|
product?: { id: string; name: string };
|
||||||
|
description?: string;
|
||||||
|
quantity: number;
|
||||||
|
unitPrice: number;
|
||||||
|
subtotal: number;
|
||||||
|
total: number;
|
||||||
|
account?: { id: string; name: string };
|
||||||
|
taxes?: Array<{ amount: { value: number }; salesTaxRate?: { name: string } }>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WaveInvoice extends JsonObject {
|
||||||
|
id: string;
|
||||||
|
pdfUrl?: string;
|
||||||
|
viewUrl?: string;
|
||||||
|
status: string;
|
||||||
|
title?: string;
|
||||||
|
subhead?: string;
|
||||||
|
invoiceNumber: string;
|
||||||
|
invoiceDate?: string;
|
||||||
|
dueDate?: string;
|
||||||
|
memo?: string;
|
||||||
|
customer: WaveCustomer;
|
||||||
|
currency: { code: string };
|
||||||
|
amountDue: { value: number; currency: { code: string } };
|
||||||
|
amountPaid: { value: number; currency: { code: string } };
|
||||||
|
taxTotal: { value: number; currency: { code: string } };
|
||||||
|
subtotal: { value: number; currency: { code: string } };
|
||||||
|
total: { value: number; currency: { code: string } };
|
||||||
|
items: WaveInvoiceItem[];
|
||||||
|
createdAt: string;
|
||||||
|
modifiedAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WaveAccount extends JsonObject {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
description?: string;
|
||||||
|
displayId: string;
|
||||||
|
type: { name: string; value: string; normalBalanceType: string };
|
||||||
|
subtype: { name: string; value: string };
|
||||||
|
currency: { code: string };
|
||||||
|
isArchived: boolean;
|
||||||
|
sequence: number;
|
||||||
|
normalBalanceType: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WaveTransaction extends JsonObject {
|
||||||
|
id: string;
|
||||||
|
description?: string;
|
||||||
|
notes?: string;
|
||||||
|
anchor: {
|
||||||
|
account: { id: string; name: string };
|
||||||
|
amount: { value: number; currency: { code: string } };
|
||||||
|
direction: string;
|
||||||
|
};
|
||||||
|
lineItems: Array<{
|
||||||
|
account: { id: string; name: string };
|
||||||
|
amount: { value: number; currency: { code: string } };
|
||||||
|
description?: string;
|
||||||
|
balance?: string;
|
||||||
|
}>;
|
||||||
|
createdAt: string;
|
||||||
|
modifiedAt: string;
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue