UNPKG

@accounter/server

Version:
66 lines (65 loc) • 9.54 kB
import DataLoader from 'dataloader'; import { _DOLLAR_defs_addClientRequest_Input, _DOLLAR_defs_getClientResponse, updateClient_mutationMutationVariables, type Sdk } from '../../../../green-invoice-graphql/src/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("../../../../green-invoice-graphql/src/index.js")._DOLLAR_defs_searchDocumentsResponse, "total" | "from" | "to" | "page" | "pageSize" | "pages"> & { items: Array<import("../../../../green-invoice-graphql/src/index.js").Maybe<(Pick<import("../../../../green-invoice-graphql/src/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("../../../../green-invoice-graphql/src/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("../../../../green-invoice-graphql/src/index.js").query_getDocument_client, "country" | "emails" | "id" | "name" | "phone" | "taxId" | "self" | "address" | "city" | "zip" | "fax" | "mobile" | "add" | "JSON">; data: Pick<import("../../../../green-invoice-graphql/src/index.js")._DOLLAR_defs_DocumentData, "tags">; income: Array<import("../../../../green-invoice-graphql/src/index.js").Maybe<Pick<import("../../../../green-invoice-graphql/src/index.js")._DOLLAR_defs_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")._DOLLAR_defs_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")._DOLLAR_defs_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")._DOLLAR_defs_Url, "he" | "en" | "origin">; })>>; }) | null | undefined>; addDocuments(...params: Parameters<Sdk['addDocument_mutation']>): Promise<(Pick<import("../../../../green-invoice-graphql/src/index.js")._DOLLAR_defs_AddedDocument, "number" | "id" | "signed" | "lang"> & { url: Pick<import("../../../../green-invoice-graphql/src/index.js")._DOLLAR_defs_Url, "he" | "en" | "origin">; }) | Pick<import("../../../../green-invoice-graphql/src/index.js")._DOLLAR_defs_ErrorResponse, "errorMessage" | "errorCode"> | null | undefined>; previewDocuments(...params: Parameters<Sdk['previewDocument_query']>): Promise<Pick<import("../../../../green-invoice-graphql/src/index.js")._DOLLAR_defs_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")._DOLLAR_defs_GetLinkedDocuments, "number" | "type" | "id" | "currency" | "amount" | "documentDate" | "currencyRate" | "status"> | null | undefined>; getDocumentLinks(documentId: string): Promise<Pick<import("../../../../green-invoice-graphql/src/index.js")._DOLLAR_defs_Url, "origin" | "he" | "en"> | null | undefined>; private _batchLoadByIds; private batchDocumentsByIds; documentLoader: DataLoader<string, (Pick<import("../../../../green-invoice-graphql/src/index.js")._DOLLAR_defs_Document, "number" | "type" | "id" | "currency" | "amount" | "description" | "vat" | "remarks" | "documentDate" | "footer" | "vatType" | "rounding" | "signed" | "currencyRate" | "vatRate" | "status" | "creationDate" | "lang" | "amountDueVat" | "amountDueVatLocal" | "amountExcludeVat" | "amountExemptVat" | "amountLocal" | "amountOpened" | "calculatedAmountLocal" | "calculatedAmountOpenedLocal" | "calculatedIncomeAmountExcludeLocal" | "calculatedIncomeAmountLocal" | "calculatedPaymentAmountLocal" | "cancellable" | "cancelType" | "downloaded" | "ref" | "reverseCharge" | "skinId" | "taxConfirmationEligible" | "templateId" | "userName" | "vatLocal"> & { business: Pick<import("../../../../green-invoice-graphql/src/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("../../../../green-invoice-graphql/src/index.js").query_getDocument_client, "country" | "emails" | "id" | "name" | "phone" | "taxId" | "self" | "address" | "city" | "zip" | "fax" | "mobile" | "add" | "JSON">; data: Pick<import("../../../../green-invoice-graphql/src/index.js")._DOLLAR_defs_DocumentData, "tags">; income: Array<import("../../../../green-invoice-graphql/src/index.js").Maybe<Pick<import("../../../../green-invoice-graphql/src/index.js")._DOLLAR_defs_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")._DOLLAR_defs_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")._DOLLAR_defs_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")._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, "id" | "name" | "country" | "address" | "city" | "emails" | "remarks" | "category" | "bankName" | "bankBranch" | "bankAccount" | "phone" | "taxId" | "fax" | "mobile" | "creationDate" | "lastUpdateDate" | "active" | "labels" | "contactPerson" | "zip" | "paymentTerms" | "department" | "accountingKey" | "incomeAmount" | "paymentAmount" | "balanceAmount" | "send" | "subCategory"> | 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; }