@accounter/server
Version:
67 lines (66 loc) • 8.74 kB
TypeScript
import DataLoader from 'dataloader';
import { type Sdk } from '../../../../green-invoice-graphql/src/index.js';
import type { Currency } from '../../shared/enums.js';
import type { Environment } from '../../shared/types/index.js';
export type ExpenseDraft = NonNullable<Extract<Awaited<ReturnType<Sdk['searchExpenseDrafts_query']>>['searchExpenseDrafts'], {
items: Array<unknown>;
}>['items'][number]>;
export declare class GreenInvoiceClientProvider {
private context;
private env;
localCurrency: Currency;
cache: {
get: <T>(key: import("node-cache").Key) => T | undefined;
set: {
<T>(key: import("node-cache").Key, value: T, ttl: number | string): boolean;
<T>(key: import("node-cache").Key, value: T): boolean;
};
delete: (keys: import("node-cache").Key | import("node-cache").Key[]) => number;
clear: () => void;
};
constructor(context: GraphQLModules.Context, env: Environment);
authToken: string | null;
private init;
getSDK(): Promise<Sdk>;
/**
* Expenses
* */
addExpenseDraftByFile(file: File | Blob): Promise<ExpenseDraft>;
/**
* Documents
* */
searchDocuments(...params: Parameters<Sdk['searchDocuments_query']>): Promise<(Pick<import("../../../../green-invoice-graphql/src/index.js").searchDocumentsResponse, "total" | "page" | "pageSize" | "pages"> & {
items: Array<import("../../../../green-invoice-graphql/src/index.js").Maybe<(Pick<import("../../../../green-invoice-graphql/src/index.js").Document, "amount" | "amountDueVat" | "amountDueVatLocal" | "amountExcludeVat" | "amountExemptVat" | "amountLocal" | "amountOpened" | "calculatedAmountLocal" | "calculatedAmountOpenedLocal" | "calculatedIncomeAmountExcludeLocal" | "calculatedIncomeAmountLocal" | "calculatedPaymentAmountLocal" | "cancellable" | "cancelType" | "creationDate" | "currency" | "currencyRate" | "description" | "documentDate" | "downloaded" | "footer" | "id" | "lang" | "number" | "ref" | "remarks" | "reverseCharge" | "rounding" | "signed" | "skinId" | "status" | "taxConfirmationEligible" | "templateId" | "type" | "userName" | "vat" | "vatLocal" | "vatRate" | "vatType"> & {
business: Pick<import("../../../../green-invoice-graphql/src/index.js").Business, "accountantDocsEmailSettings" | "accountantEmails" | "accountantReportEmailSettings" | "accountingType" | "active" | "advanceNationalInsuranceRate" | "advanceTaxRate" | "bankDisplay" | "bankDisplayEn" | "deductionRate" | "documentsEmailSettings" | "emailSubjectType" | "exemption" | "incomeReportEmailSettings" | "incomeReportFormatType" | "reportSendingDay" | "senderEmailSettings" | "type">;
client: Pick<import("../../../../green-invoice-graphql/src/index.js").Client, "country" | "emails" | "id" | "name" | "phone" | "taxId" | "self">;
data: Pick<import("../../../../green-invoice-graphql/src/index.js").DocumentData, "tags">;
income: Array<import("../../../../green-invoice-graphql/src/index.js").Maybe<Pick<import("../../../../green-invoice-graphql/src/index.js").Income, "amount" | "amountTotal" | "catalogNum" | "currency" | "currencyRate" | "description" | "itemId" | "price" | "quantity" | "vat" | "vatRate" | "vatType">>>;
linkedDocuments?: import("../../../../green-invoice-graphql/src/index.js").Maybe<Array<import("../../../../green-invoice-graphql/src/index.js").Maybe<Pick<import("../../../../green-invoice-graphql/src/index.js").DocumentLinkedDocument, "amount" | "currency" | "currencyRate" | "documentDate" | "id" | "number" | "reverseCharge" | "type">>>>;
payment: Array<import("../../../../green-invoice-graphql/src/index.js").Maybe<Pick<import("../../../../green-invoice-graphql/src/index.js").PaymentDocument, "currency" | "currencyRate" | "date" | "price" | "type" | "subType" | "bankName" | "bankBranch" | "bankAccount" | "chequeNum" | "accountId" | "transactionId" | "appType" | "cardType" | "cardNum" | "dealType" | "numPayments" | "firstPayment">>>;
url: Pick<import("../../../../green-invoice-graphql/src/index.js").Url, "he" | "en" | "origin">;
})>>;
}) | null | undefined>;
addDocuments(...params: Parameters<Sdk['addDocument_mutation']>): Promise<(Pick<import("../../../../green-invoice-graphql/src/index.js").AddedDocument, "number" | "id" | "lang" | "signed"> & {
url: Pick<import("../../../../green-invoice-graphql/src/index.js").Url, "he" | "en" | "origin">;
}) | Pick<import("../../../../green-invoice-graphql/src/index.js").ErrorResponse, "errorMessage" | "errorCode"> | null | undefined>;
previewDocuments(...params: Parameters<Sdk['previewDocument_query']>): Promise<Pick<import("../../../../green-invoice-graphql/src/index.js").ErrorResponse, "errorMessage" | "errorCode"> | Pick<import("../../../../green-invoice-graphql/src/index.js").query_previewDocument_oneOf_0, "file"> | null | undefined>;
getLinkedDocuments(documentId: string): Promise<Pick<import("../../../../green-invoice-graphql/src/index.js").GetLinkedDocuments, "number" | "type" | "id" | "currency" | "amount" | "documentDate" | "status" | "currencyRate"> | null | undefined>;
private _batchLoadByIds;
private batchDocumentsByIds;
documentLoader: DataLoader<string, (Pick<import("../../../../green-invoice-graphql/src/index.js").Document, "number" | "type" | "id" | "currency" | "amount" | "description" | "vat" | "documentDate" | "remarks" | "status" | "currencyRate" | "creationDate" | "lang" | "signed" | "amountDueVat" | "amountDueVatLocal" | "amountExcludeVat" | "amountExemptVat" | "amountLocal" | "amountOpened" | "calculatedAmountLocal" | "calculatedAmountOpenedLocal" | "calculatedIncomeAmountExcludeLocal" | "calculatedIncomeAmountLocal" | "calculatedPaymentAmountLocal" | "cancellable" | "cancelType" | "downloaded" | "footer" | "ref" | "reverseCharge" | "rounding" | "skinId" | "taxConfirmationEligible" | "templateId" | "userName" | "vatLocal" | "vatRate" | "vatType"> & {
business: Pick<import("../../../../green-invoice-graphql/src/index.js").Business, "accountantDocsEmailSettings" | "accountantEmails" | "accountantReportEmailSettings" | "accountingType" | "active" | "advanceNationalInsuranceRate" | "advanceTaxRate" | "bankDisplay" | "bankDisplayEn" | "deductionRate" | "documentsEmailSettings" | "emailSubjectType" | "exemption" | "incomeReportEmailSettings" | "incomeReportFormatType" | "reportSendingDay" | "senderEmailSettings" | "type">;
client: Pick<import("../../../../green-invoice-graphql/src/index.js").Client, "country" | "emails" | "id" | "name" | "phone" | "taxId" | "self">;
data: Pick<import("../../../../green-invoice-graphql/src/index.js").DocumentData, "tags">;
income: Array<import("../../../../green-invoice-graphql/src/index.js").Maybe<Pick<import("../../../../green-invoice-graphql/src/index.js").Income, "amount" | "amountTotal" | "catalogNum" | "currency" | "currencyRate" | "description" | "itemId" | "price" | "quantity" | "vat" | "vatRate" | "vatType">>>;
linkedDocuments?: import("../../../../green-invoice-graphql/src/index.js").Maybe<Array<import("../../../../green-invoice-graphql/src/index.js").Maybe<Pick<import("../../../../green-invoice-graphql/src/index.js").DocumentLinkedDocument, "amount" | "currency" | "currencyRate" | "documentDate" | "id" | "number" | "reverseCharge" | "type">>>>;
payment: Array<import("../../../../green-invoice-graphql/src/index.js").Maybe<Pick<import("../../../../green-invoice-graphql/src/index.js").PaymentDocument, "currency" | "currencyRate" | "date" | "price" | "type" | "subType" | "bankName" | "bankBranch" | "bankAccount" | "chequeNum" | "accountId" | "transactionId" | "appType" | "cardType" | "cardNum" | "dealType" | "numPayments" | "firstPayment">>>;
url: Pick<import("../../../../green-invoice-graphql/src/index.js").Url, "he" | "en" | "origin">;
}) | null, import("node-cache").Key | import("node-cache").Key[]>;
closeDocument(documentId: string): Promise<any>;
invalidateDocument(documentId: string): Promise<void>;
/**
* Clients
* */
private batchClientsByIds;
clientLoader: DataLoader<string, Pick<import("../../../../green-invoice-graphql/src/index.js").getClientResponse, "id" | "name" | "country" | "address" | "emails" | "category" | "remarks" | "creationDate" | "lastUpdateDate" | "active" | "labels" | "taxId" | "paymentTerms" | "bankName" | "bankBranch" | "bankAccount" | "phone" | "mobile" | "contactPerson" | "department" | "accountingKey" | "city" | "zip" | "fax" | "incomeAmount" | "paymentAmount" | "balanceAmount" | "send" | "subCategory"> | null, import("node-cache").Key | import("node-cache").Key[]>;
}