@accounter/server
Version:
Accounter GraphQL server
66 lines (65 loc) • 8.45 kB
TypeScript
import DataLoader from 'dataloader';
import { _DOLLAR_defs_addClientRequest_Input, _DOLLAR_defs_getClientResponse, updateClient_mutationMutationVariables, type Sdk } from '../../index.js';
import type { Environment } from '../../shared/types/index.js';
import { AdminContextProvider } from '../admin-context/providers/admin-context.provider.js';
import { ProviderCredentialsProvider } from '../provider-credentials/providers/provider-credentials.provider.js';
export type ExpenseDraft = NonNullable<Extract<Awaited<ReturnType<Sdk['searchExpenseDrafts_query']>>['searchExpenseDrafts'], {
items: Array<unknown>;
}>['items'][number]>;
export declare class GreenInvoiceClientProvider {
private adminContextProvider;
private env;
private credentialsProvider;
private initPromise;
constructor(adminContextProvider: AdminContextProvider, env: Environment, credentialsProvider: ProviderCredentialsProvider);
authToken: string | null;
private init;
private _doInit;
getSDK(): Promise<Sdk>;
/**
* Expenses
* */
addExpenseDraftByFile(file: File | Blob): Promise<ExpenseDraft>;
/**
* Documents
* */
searchDocuments(...params: Parameters<Sdk['searchDocuments_query']>): Promise<(Pick<import("../../index.js")._DOLLAR_defs_searchDocumentsResponse, "from" | "page" | "pageSize" | "pages" | "to" | "total"> & {
items: Array<import("../../index.js").Maybe<(Pick<import("../../index.js")._DOLLAR_defs_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("../../index.js")._DOLLAR_defs_Business, 'accountantDocsEmailSettings' | 'accountantEmails' | 'accountantReportEmailSettings' | 'accountingType' | 'active' | 'advanceNationalInsuranceRate' | 'advanceTaxRate' | 'bankDisplay' | 'bankDisplayEn' | 'deductionRate' | 'documentsEmailSettings' | 'emailSubjectType' | 'exemption' | 'incomeReportEmailSettings' | 'incomeReportFormatType' | 'reportSendingDay' | 'senderEmailSettings' | 'type'>;
client: Pick<import("../../index.js").query_getDocument_client, 'country' | 'emails' | 'id' | 'name' | 'phone' | 'taxId' | 'self' | 'address' | 'city' | 'zip' | 'fax' | 'mobile' | 'add' | 'JSON'>;
data: Pick<import("../../index.js")._DOLLAR_defs_DocumentData, 'tags'>;
income: Array<import("../../index.js").Maybe<Pick<import("../../index.js")._DOLLAR_defs_Income, 'amount' | 'amountTotal' | 'catalogNum' | 'currency' | 'currencyRate' | 'description' | 'itemId' | 'price' | 'quantity' | 'vat' | 'vatRate' | 'vatType'>>>;
linkedDocuments?: import("../../index.js").Maybe<Array<import("../../index.js").Maybe<Pick<import("../../index.js")._DOLLAR_defs_DocumentLinkedDocument, 'amount' | 'currency' | 'currencyRate' | 'documentDate' | 'id' | 'number' | 'reverseCharge' | 'type'>>>>;
payment: Array<import("../../index.js").Maybe<Pick<import("../../index.js")._DOLLAR_defs_PaymentDocument, 'currency' | 'currencyRate' | 'date' | 'price' | 'type' | 'subType' | 'bankName' | 'bankBranch' | 'bankAccount' | 'chequeNum' | 'accountId' | 'transactionId' | 'appType' | 'cardType' | 'cardNum' | 'dealType' | 'numPayments' | 'firstPayment'>>>;
url: Pick<import("../../index.js")._DOLLAR_defs_Url, 'he' | 'en' | 'origin'>;
})>>;
}) | null | undefined>;
addDocuments(...params: Parameters<Sdk['addDocument_mutation']>): Promise<Pick<import("../../index.js")._DOLLAR_defs_ErrorResponse, "errorCode" | "errorMessage"> | (Pick<import("../../index.js")._DOLLAR_defs_AddedDocument, "id" | "lang" | "number" | "signed"> & {
url: Pick<import("../../index.js")._DOLLAR_defs_Url, 'he' | 'en' | 'origin'>;
}) | null | undefined>;
previewDocuments(...params: Parameters<Sdk['previewDocument_query']>): Promise<Pick<import("../../index.js")._DOLLAR_defs_ErrorResponse, "errorCode" | "errorMessage"> | Pick<import("../../index.js").query_previewDocument_oneOf_0, "file"> | null | undefined>;
getLinkedDocuments(documentId: string): Promise<Pick<import("../../index.js")._DOLLAR_defs_GetLinkedDocuments, "amount" | "currency" | "currencyRate" | "documentDate" | "id" | "number" | "status" | "type"> | null | undefined>;
getDocumentLinks(documentId: string): Promise<Pick<import("../../index.js")._DOLLAR_defs_Url, "en" | "he" | "origin"> | null | undefined>;
private _batchLoadByIds;
private batchDocumentsByIds;
documentLoader: DataLoader<string, (Pick<import("../../index.js")._DOLLAR_defs_Document, "amount" | "amountDueVat" | "amountDueVatLocal" | "amountExcludeVat" | "amountExemptVat" | "amountLocal" | "amountOpened" | "calculatedAmountLocal" | "calculatedAmountOpenedLocal" | "calculatedIncomeAmountExcludeLocal" | "calculatedIncomeAmountLocal" | "calculatedPaymentAmountLocal" | "cancelType" | "cancellable" | "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("../../index.js")._DOLLAR_defs_Business, 'accountantDocsEmailSettings' | 'accountantEmails' | 'accountantReportEmailSettings' | 'accountingType' | 'active' | 'advanceNationalInsuranceRate' | 'advanceTaxRate' | 'bankDisplay' | 'bankDisplayEn' | 'deductionRate' | 'documentsEmailSettings' | 'emailSubjectType' | 'exemption' | 'incomeReportEmailSettings' | 'incomeReportFormatType' | 'reportSendingDay' | 'senderEmailSettings' | 'type'>;
client: Pick<import("../../index.js").query_getDocument_client, 'country' | 'emails' | 'id' | 'name' | 'phone' | 'taxId' | 'self' | 'address' | 'city' | 'zip' | 'fax' | 'mobile' | 'add' | 'JSON'>;
data: Pick<import("../../index.js")._DOLLAR_defs_DocumentData, 'tags'>;
income: Array<import("../../index.js").Maybe<Pick<import("../../index.js")._DOLLAR_defs_Income, 'amount' | 'amountTotal' | 'catalogNum' | 'currency' | 'currencyRate' | 'description' | 'itemId' | 'price' | 'quantity' | 'vat' | 'vatRate' | 'vatType'>>>;
linkedDocuments?: import("../../index.js").Maybe<Array<import("../../index.js").Maybe<Pick<import("../../index.js")._DOLLAR_defs_DocumentLinkedDocument, 'amount' | 'currency' | 'currencyRate' | 'documentDate' | 'id' | 'number' | 'reverseCharge' | 'type'>>>>;
payment: Array<import("../../index.js").Maybe<Pick<import("../../index.js")._DOLLAR_defs_PaymentDocument, 'currency' | 'currencyRate' | 'date' | 'price' | 'type' | 'subType' | 'bankName' | 'bankBranch' | 'bankAccount' | 'chequeNum' | 'accountId' | 'transactionId' | 'appType' | 'cardType' | 'cardNum' | 'dealType' | 'numPayments' | 'firstPayment'>>>;
url: Pick<import("../../index.js")._DOLLAR_defs_Url, 'he' | 'en' | 'origin'>;
}) | null, string>;
closeDocument(documentId: string): Promise<any>;
invalidateDocument(documentId: string): void;
/**
* Clients
* */
private batchClientsByIds;
clientLoader: DataLoader<string, Pick<_DOLLAR_defs_getClientResponse, "accountingKey" | "active" | "address" | "balanceAmount" | "bankAccount" | "bankBranch" | "bankName" | "category" | "city" | "contactPerson" | "country" | "creationDate" | "department" | "emails" | "fax" | "id" | "incomeAmount" | "labels" | "lastUpdateDate" | "mobile" | "name" | "paymentAmount" | "paymentTerms" | "phone" | "remarks" | "send" | "subCategory" | "taxId" | "zip"> | null, string>;
createClient(input: _DOLLAR_defs_addClientRequest_Input): Promise<_DOLLAR_defs_getClientResponse>;
updateClient(args: updateClient_mutationMutationVariables): Promise<_DOLLAR_defs_getClientResponse>;
deleteClient(clientId: string): Promise<_DOLLAR_defs_getClientResponse>;
invalidateClient(clientId: string): void;
}