import { AxiosRequestConfig } from 'axios'; export { BuildOptions, DeployOptions, appBuild, appDeploy } from './cli.cjs'; type NomiClientConfig = { authStrategy: 'in-app'; token?: string; baseUrl?: string; defaultLimit?: number; } | { authStrategy: 'ppt'; email: string; pptToken: string; baseUrl?: string; defaultLimit?: number; }; declare class BaseClient { private config; private client; constructor(config: NomiClientConfig); private getAuthHeaders; request(config: AxiosRequestConfig): Promise; get(endpoint: string, params?: Record): Promise; post(endpoint: string, data?: any): Promise; put(endpoint: string, data?: any): Promise; patch(endpoint: string, data?: any): Promise; delete(endpoint: string, params?: Record): Promise; getDefaultLimit(): number; paginate(endpoint: string, itemsKey: string, params?: Record): AsyncGenerator; /** * Automatically splits large payloads into subsets corresponding to defaultLimit (or specified limit) * and aggregates the returned IDs from all chunk requests. * * @param endpoint The bulk API endpoint URL * @param items Array of payload items to save * @param limit Optional custom chunk size (defaults to defaultLimit or 100) */ bulkSaveChunks(endpoint: string, items: T[], limit?: number): Promise<{ ids: string[]; }>; } /** * Types for Nomi Application Runner (`application-runner`) */ interface RunnerProgressData { percent: number; label?: string; current?: number; total?: number; unit?: string; id?: string; [key: string]: any; } interface RunnerLogger { info(message: string, meta?: any): void; warn(message: string, meta?: any): void; error(message: string, meta?: any): void; debug(message: string, meta?: any): void; progress?(percentOrData: number | RunnerProgressData, label?: string): void; } interface RunnerPropertyBag { get(name: string): Promise; set(name: string, value: T): Promise; delete(name: string): Promise; remove?(name: string): Promise; } interface RunnerTenant { id: string; companyName: string | null; accessToken: string | null; refreshToken: string | null; securityKey?: string | null; clientId?: string | null; clientSecret?: string | null; [key: string]: any; } interface RunnerUser { id: string | null; email?: string | null; permissions?: string[]; [key: string]: any; } interface RunnerApp { id: string; version: string; versionId?: string; channel?: 'dev' | 'release' | string; routeBaseUrl?: string | null; sentry?: any; [key: string]: any; } interface RunnerFunctionInfo { id: string; name?: string; title?: string; file?: string; [key: string]: any; } interface RunnerExecution { id: string; [key: string]: any; } interface RunnerSecretItem { secretId?: string; type?: string; value?: string; hasValue?: boolean; refreshToken?: string; hasRefreshToken?: boolean; [key: string]: any; } interface RunnerSecrets { get(name: string): Promise; set?(name: string, value: string, options?: { type?: string; }): Promise; delete?(name: string): Promise; exists?(name: string): Promise; [key: string]: any; } type RunnerSyncStatus = 'new' | 'in_progress' | 'success' | 'error' | 'cancelled'; interface RunnerSyncUpdateParams { status?: RunnerSyncStatus; progress?: number; message?: string; result?: any; error?: any; } interface RunnerCreateSyncParams { functionId: string; name?: string; payload?: any; } interface RunnerSync { currentSyncId: string | null; create(params: RunnerCreateSyncParams): Promise; get(targetSyncId?: string): Promise; update(params: RunnerSyncUpdateParams, targetSyncId?: string): Promise; setProgress(percent: number, message?: string, targetSyncId?: string): Promise; setStatus(status: RunnerSyncStatus, message?: string, targetSyncId?: string): Promise; complete(message?: string, result?: any, targetSyncId?: string): Promise; fail(message: string, error?: any, targetSyncId?: string): Promise; uploadReport(content: Buffer | string | any, filename?: string, mimeType?: string, targetSyncId?: string): Promise; } interface RunnerContext { app: RunnerApp; routeUrl?: (routePath?: string) => string; function: RunnerFunctionInfo; tenant: RunnerTenant | null; tenantContext?: RunnerTenant | null; user?: RunnerUser | null; execution: RunnerExecution; logger: RunnerLogger; propertyBag: RunnerPropertyBag; sync?: RunnerSync; secrets?: RunnerSecrets | Record; featureFlags?: Record; sentry?: any; [key: string]: any; } type RunnerHandler = (payload: TPayload, context: RunnerContext) => Promise | TResult; /** * Convenient context wrapper supporting both standard RunnerContext * and traditional helper methods (json, error, body). */ type Context = RunnerContext & { body?: TPayload; payload?: TPayload; json?: (data: any) => any; error?: (err: any) => any; }; interface AppRunnerExecutionResult { result?: T; error?: any; stdout?: string; stderr?: string; } type RunnerTriggerType = 'route' | 'cron' | 'event' | string; interface RunnerManifestTrigger { type: RunnerTriggerType; path?: string; method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | string; event?: string; schedule?: string; timezone?: string; id?: string; name?: string | Record; permissions?: string[]; [key: string]: any; } interface RunnerManifestFunction { id: string; name?: string | Record; file: string; triggers?: RunnerManifestTrigger[]; permissions?: string[]; [key: string]: any; } type RunnerSecretType = 'token' | 'oauth2' | 'apiKey' | 'api_key' | string; interface RunnerManifestSecret { id: string; name?: string | Record; description?: string | Record; type?: RunnerSecretType; required?: boolean; refresh_callback?: string; refresh_lifetime?: string | number; [key: string]: any; } interface RunnerManifestPanel { id: string; name: string | Record; url: string; icon?: string | null; permissions?: string[]; [key: string]: any; } interface RunnerManifestMenuItem { id: string; panel?: string | null; url?: string | null; target?: string | null; name?: string | Record | null; title?: string | Record | null; icon?: string | null; permissions?: string[]; [key: string]: any; } interface RunnerManifestFeatureFlagOption { label?: string | Record; value: string; } interface RunnerManifestFeatureFlag { id: string; name?: string | Record; description?: string | Record; type: 'boolean' | 'string' | 'select' | string; options?: Array; default?: boolean | string; [key: string]: any; } interface RunnerManifestApp { id: string; version: string; name?: string | Record | null; description?: string | Record | null; icon?: string | null; main?: string | null; locale?: { fallback?: string; supports?: string[]; [key: string]: any; }; marketplace?: Record; permissions?: string[]; scopes?: string[]; [key: string]: any; } interface RunnerManifest { app: RunnerManifestApp; functions?: RunnerManifestFunction[]; panels?: RunnerManifestPanel[]; menu?: RunnerManifestMenuItem[]; secrets?: RunnerManifestSecret[]; featureFlags?: RunnerManifestFeatureFlag[]; files?: string[]; public?: { path?: string; [key: string]: any; }; [key: string]: any; } type EntityId = string; interface PaginationParams { page?: number; query?: string | null; limit?: number | null; offset?: number | null; sorting?: string[][] | null; filter?: Record | null; } interface Metadata { total?: number; size?: number; pages?: number; page?: number; } interface NomiApiError { code: string; message: string; } declare class NomiError extends Error { code: string; constructor(error: NomiApiError); } interface Account { id: EntityId; name: string; balance: number; currency: string; legalEntityId?: EntityId | null; externalId?: string | null; accountNumber?: string | null; } interface AccountPayload { id?: EntityId | null; name: string; balance?: number; initialBalance?: number; initialBalanceDate?: string | null; currency?: string; currencyId?: EntityId | null; legalEntityId?: EntityId | null; externalId?: string | null; accountNumber?: string | null; type?: string | null; comment?: string | null; notes?: string | null; } interface GetAccountsResponse { accounts: Account[]; meta: Metadata; } interface AccountsTotalsResponse { totals: Record; } interface AccountImportsResponse { imports: any[]; currency: string; meta: any; } declare class AccountsApi { private client; constructor(client: BaseClient); getAll(params?: { with?: 'totals'; } & PaginationParams): AsyncGenerator; getTotals(): Promise; getById(id: EntityId): Promise; update(id: EntityId, payload: AccountPayload): Promise<{ id: EntityId; }>; delete(id: EntityId): Promise; bulkSave(accounts: AccountPayload[]): Promise<{ ids: EntityId[]; }>; getImports(accountId: EntityId): Promise; sync(accountId: EntityId, period: string[]): Promise; uploadStatement(accountId: EntityId, file: File | Blob): Promise<{ statement: any; }>; saveStatement(accountId: EntityId, id: EntityId): Promise; } interface ProjectCategory { id: EntityId; name: string; parentId?: EntityId | null; } interface ProjectCategoryPayload { id?: EntityId | null; name: string; parentId?: EntityId | null; } interface Project { id: EntityId; projectCategoryId?: EntityId | null; name: string; notes?: string | null; hasPlan: boolean; planIncome?: number | null; planOutcome?: number | null; income: number; outcome: number; grossProfit: number; profitability: number; isArchived: boolean; planGrossProfit?: number | null; planProfitability?: number | null; } interface ProjectPayload { id?: EntityId | null; projectCategoryId?: EntityId | null; name: string; notes?: string | null; hasPlan: boolean; planIncome?: number | null; planOutcome?: number | null; } declare class ProjectsApi { private client; constructor(client: BaseClient); getAll(params?: PaginationParams): AsyncGenerator; getById(id: EntityId): Promise; create(payload: ProjectPayload): Promise<{ id: EntityId; }>; update(id: EntityId, payload: ProjectPayload): Promise<{ id: EntityId; }>; delete(id: EntityId): Promise; deleteMultiple(ids: EntityId[]): Promise; bulkSave(projects: ProjectPayload[]): Promise<{ ids: EntityId[]; }>; restore(ids: EntityId[]): Promise; getCategories(params?: PaginationParams): AsyncGenerator; getCategoryById(id: EntityId): Promise; createCategory(payload: ProjectCategoryPayload): Promise<{ id: EntityId; }>; updateCategory(id: EntityId, payload: ProjectCategoryPayload): Promise<{ id: EntityId; }>; deleteCategory(id: EntityId): Promise; deleteMultipleCategories(ids: EntityId[]): Promise; bulkSaveCategories(categories: ProjectCategoryPayload[]): Promise<{ ids: EntityId[]; }>; restoreCategory(ids: EntityId[]): Promise; } interface CounterpartyType { id: EntityId; name: string; } interface CounterpartyTypePayload { id?: EntityId | null; name: string; } interface CounterpartyTypeRef { id: EntityId; name?: string; } interface Counterparty { id: EntityId; name: string; externalId: string | null; balance: number; notes: string | null; isArchived: boolean; types: ('client' | 'supplier' | 'partner' | 'contractor' | 'other')[]; } interface CounterpartyPayload { id?: EntityId | null; name: string; externalId?: string | null; notes?: string | null; phone?: string | null; email?: string | null; types?: Array; } declare class CounterpartiesApi { private client; private defaultTypeId?; constructor(client: BaseClient); getOrCreateDefaultType(name?: string): Promise; getAll(params?: PaginationParams): AsyncGenerator; getById(id: EntityId): Promise; create(payload: CounterpartyPayload): Promise<{ id: EntityId; }>; update(id: EntityId, payload: CounterpartyPayload): Promise<{ id: EntityId; }>; delete(id: EntityId): Promise; deleteMultiple(ids: EntityId[]): Promise; bulkSave(counterparties: CounterpartyPayload[]): Promise<{ ids: EntityId[]; }>; restore(ids: EntityId[]): Promise; getTypes(params?: PaginationParams): AsyncGenerator; bulkSaveTypes(types: CounterpartyTypePayload[]): Promise<{ ids: EntityId[]; }>; createTypes(types: CounterpartyTypePayload[]): Promise<{ ids: EntityId[]; }>; } type TransactionType = 'income' | 'outcome' | 'transfer'; interface TransactionPartPayload { id?: EntityId | null; amount: number; date: string; categoryId?: EntityId | null; legalEntityId?: EntityId | null; exchangeSourceId?: EntityId | null; counterpartyId?: EntityId | null; commitmentPartId?: EntityId | null; projectId?: EntityId | null; isCommitment?: boolean | null; } interface Transaction { id: EntityId; amount: number; date: string; incomeDate?: string | null; externalId?: string | null; description: string; type: TransactionType; isRecurring?: boolean; isPlanned?: boolean | null; isCoveredByClient?: boolean | null; isCompleted?: boolean | null; isDifferentIncomeDate?: boolean | null; recurrencePeriod?: string | null; recurrenceEndDate?: string | null; accountId?: EntityId | null; categoryId?: EntityId | null; counterpartyId?: EntityId | null; commitmentPartId?: EntityId | null; projectId?: EntityId | null; projectCategoryId?: EntityId | null; isCommitment?: boolean | null; fileId?: EntityId | null; file2Id?: EntityId | null; file3Id?: EntityId | null; tags?: { id?: EntityId | null; name?: string | null; }[]; parts?: TransactionPartPayload[]; destTransactionId?: EntityId | null; destAccountId?: EntityId | null; destAmount?: number | null; } interface TransactionPayload { id?: EntityId | null; amount: number; date: string; incomeDate?: string | null; externalId?: string | null; description: string; type: TransactionType; isRecurring?: boolean; isPlanned?: boolean | null; isCoveredByClient?: boolean | null; isCompleted?: boolean | null; isDifferentIncomeDate?: boolean | null; recurrencePeriod?: string | null; recurrenceEndDate?: string | null; accountId: EntityId; categoryId?: EntityId | null; counterpartyId?: EntityId | null; commitmentPartId?: EntityId | null; projectId?: EntityId | null; projectCategoryId?: EntityId | null; isCommitment?: boolean | null; fileId?: EntityId | null; file2Id?: EntityId | null; file3Id?: EntityId | null; tags?: { id?: EntityId | null; name?: string | null; }[]; parts?: TransactionPartPayload[]; destTransactionId?: EntityId | null; destAccountId?: EntityId | null; destAmount?: number | null; } declare class TransactionsApi { private client; constructor(client: BaseClient); getAll(params?: PaginationParams): AsyncGenerator; getById(id: EntityId): Promise; bulkSave(transactions: TransactionPayload[]): Promise<{ ids: EntityId[]; }>; bulkDelete(ids: EntityId[]): Promise; applyChanges(payload: any): Promise; complete(id: EntityId): Promise; link(sourceId: EntityId, targetId: EntityId): Promise; unlink(id: EntityId): Promise; searchPlanned(params?: Record): Promise; suggestGroupOperation(params?: Record): Promise; getCategories(params?: PaginationParams): AsyncGenerator; getCategoryById(id: EntityId): Promise; } interface TransactionCategory { id: EntityId; name: string; type?: 'income' | 'expense' | 'transfer' | string; parentId?: EntityId | null; [key: string]: any; } interface NomenclatureCategory { id: EntityId; name: string; parentId?: EntityId | null; } interface NomenclatureItem { id: EntityId; name: string; type: 'product' | 'service'; serviceType?: 'in' | 'out' | null; categoryId?: EntityId | null; externalId?: string | null; notes?: string | null; sku?: string | null; barcode?: string | null; imageFileId?: EntityId | null; imageFileUrl?: string | null; unitId: EntityId; defaultSellingPrice?: number | null; defaultSellingCurrencyId?: EntityId | null; averagePriceCurrencyId?: EntityId | null; legalEntityId?: EntityId | null; dateOfReceipt?: string | null; initialStockQuantity?: number | null; averagePrice?: number | null; hasInitialBalanceOnStock?: boolean | null; isArchived?: boolean; isIgnoreCostRecalc?: boolean | null; } interface NomenclatureCategoryPayload { id?: EntityId | null; name: string; parentId?: EntityId | null; } interface NomenclaturePayload { id?: EntityId | null; name: string; type: 'product' | 'service'; serviceType?: 'in' | 'out' | null; categoryId?: EntityId | null; externalId?: string | null; notes?: string | null; sku?: string | null; barcode?: string | null; imageFileId?: EntityId | null; unitId?: EntityId | null; defaultSellingPrice?: number | null; defaultSellingCurrencyId?: EntityId | null; averagePriceCurrencyId?: EntityId | null; legalEntityId?: EntityId | null; dateOfReceipt?: string | null; initialStockQuantity?: number | null; averagePrice?: number | null; hasInitialBalanceOnStock?: boolean | null; isArchived?: boolean; isIgnoreCostRecalc?: boolean | null; } declare enum NomenclatureUnitId { Piece = "piece", HundredPieces = "hundred_pieces", Gram = "gram", Hectare = "hectare", Year = "year", Decimeter = "decimeter", SquareDecimeter = "square_decimeter", Quarter = "quarter", Kilogram = "kilogram", Kilometer = "kilometer", SquareKilometer = "square_kilometer", Liter = "liter", Meter = "meter", SquareMeter = "square_meter", CubicMeter = "cubic_meter", Milligram = "milligram", Month = "month", Minute = "minute", Millimeter = "millimeter", SquareMillimeter = "square_millimeter", Week = "week", LinearMeter = "linear_meter", Centimeter = "centimeter", SquareCentimeter = "square_centimeter", Day = "day", Ton = "ton", ThousandPieces = "thousand_pieces", Quintal = "quintal", Hour = "hour", PIECE = "piece", HUNDRED_PIECES = "hundred_pieces", GRAM = "gram", HECTARE = "hectare", YEAR = "year", DECIMETER = "decimeter", SQUARE_DECIMETER = "square_decimeter", QUARTER = "quarter", KILOGRAM = "kilogram", KILOMETER = "kilometer", SQUARE_KILOMETER = "square_kilometer", LITER = "liter", METER = "meter", SQUARE_METER = "square_meter", CUBIC_METER = "cubic_meter", MILLIGRAM = "milligram", MONTH = "month", MINUTE = "minute", MILLIMETER = "millimeter", SQUARE_MILLIMETER = "square_millimeter", WEEK = "week", LINEAR_METER = "linear_meter", CENTIMETER = "centimeter", SQUARE_CENTIMETER = "square_centimeter", DAY = "day", TON = "ton", THOUSAND_PIECES = "thousand_pieces", QUINTAL = "quintal", HOUR = "hour" } declare const NomenclatureUnits: typeof NomenclatureUnitId; type NomenclatureUnits = NomenclatureUnitId; declare const UnitId: typeof NomenclatureUnitId; type UnitId = NomenclatureUnitId; declare const DEFAULT_PRODUCT_UNIT_ID = NomenclatureUnitId.Piece; declare const DEFAULT_SERVICE_UNIT_ID = NomenclatureUnitId.Hour; interface NomenclatureUnit { id: EntityId; name: string; symbol?: string; type?: 'product' | 'service'; code?: string; } declare class NomenclatureApi { private client; constructor(client: BaseClient); getDefaultUnit(type?: 'product' | 'service'): NomenclatureUnitId; getAll(params?: PaginationParams): AsyncGenerator; getById(id: EntityId): Promise; create(payload: NomenclaturePayload): Promise<{ id: EntityId; }>; update(id: EntityId, payload: NomenclaturePayload): Promise<{ id: EntityId; }>; delete(id: EntityId): Promise; deleteMultiple(ids: EntityId[]): Promise; bulkSave(items: NomenclaturePayload[]): Promise<{ ids: EntityId[]; }>; bulkEdit(ids: EntityId[], changes: { categoryId?: EntityId | null; serviceCategoryId?: EntityId | null; }): Promise; restore(ids: EntityId[]): Promise; getCategories(params?: PaginationParams): AsyncGenerator; getCategoryById(id: EntityId): Promise; createCategory(payload: NomenclatureCategoryPayload): Promise<{ id: EntityId; }>; updateCategory(id: EntityId, payload: NomenclatureCategoryPayload): Promise<{ id: EntityId; }>; deleteCategory(id: EntityId): Promise; deleteMultipleCategories(ids: EntityId[]): Promise; bulkSaveCategories(categories: NomenclatureCategoryPayload[]): Promise<{ ids: EntityId[]; }>; restoreCategory(ids: EntityId[]): Promise; getUnits(type?: 'service' | 'product'): Promise; } interface NomenclatureMovementPartPayload { id?: EntityId | null; externalId?: string | null; nomenclatureId: EntityId; quantity: number; unitPrice: number; vatPercent?: number | null; vatAmount?: number | null; } interface NomenclatureMovement { id: EntityId; externalId?: string | null; date: string; type: 'buy' | 'sell' | 'adjustment' | 'write-off'; legalEntityId: EntityId; currencyId: EntityId; counterpartyId?: EntityId | null; projectId?: EntityId | null; notes?: string | null; parts: NomenclatureMovementPartPayload[]; tags?: { id?: EntityId | null; name?: string; }[]; fileId?: EntityId | null; file2Id?: EntityId | null; file3Id?: EntityId | null; } interface NomenclatureMovementPayload { id?: EntityId | null; externalId?: string | null; date: string; type: 'buy' | 'sell' | 'adjustment' | 'write-off'; legalEntityId: EntityId; currencyId: EntityId; counterpartyId?: EntityId | null; projectId?: EntityId | null; notes?: string | null; parts: NomenclatureMovementPartPayload[]; tags?: { id?: EntityId | null; name?: string; }[]; fileId?: EntityId | null; file2Id?: EntityId | null; file3Id?: EntityId | null; } declare class NomenclatureMovementsApi { private client; constructor(client: BaseClient); getAll(params?: PaginationParams): AsyncGenerator; getById(id: EntityId): Promise; create(payload: NomenclatureMovementPayload): Promise<{ id: EntityId; }>; update(id: EntityId, payload: NomenclatureMovementPayload): Promise<{ id: EntityId; }>; delete(id: EntityId): Promise; deleteMultiple(ids: EntityId[]): Promise; bulkSave(movements: NomenclatureMovementPayload[]): Promise<{ ids: EntityId[]; }>; restore(ids: EntityId[]): Promise; } /** * Document types in Nomi: * - `sale` — Combined sale document (invoice + warehouse stock deduction) * - `saleReturn` — Customer return of goods * - `purchase` — Combined purchase document (vendor invoice + stock receipt) * - `purchaseReturn` — Return of goods to vendor * - `posting` — Initial stock entry or inventory surplus receipt * - `writeOff` — Stock write-off (damaged, expired, or lost goods) * - `inventory` — Inventory audit / stocktaking act * - `transfer` — Stock transfer between warehouses * - `adjustment` — Price/quantity adjustment for previously posted documents * - `customerOrder` — Customer order with stock reservation and deadline * - `saleInvoice` — Sales invoice (financial billing document) * - `saleShipment` — Delivery note / shipment act * - `creditNote` — Credit note (debt adjustment for customer) * - `purchaseOrder` — Purchase order to vendor * - `purchaseInvoice` — Incoming vendor bill * - `goodsReceipt` — Warehouse goods receipt note from vendor * - `assembly` — Product assembly/manufacturing from component items * - `disassembly` — Product disassembly into component items * - `supply` — Supplier stock delivery */ type DocumentType = 'sale' | 'saleReturn' | 'purchase' | 'purchaseReturn' | 'posting' | 'writeOff' | 'inventory' | 'transfer' | 'adjustment' | 'customerOrder' | 'saleInvoice' | 'saleShipment' | 'creditNote' | 'purchaseOrder' | 'purchaseInvoice' | 'goodsReceipt' | 'assembly' | 'disassembly' | 'supply'; /** * Document posting status: * - `draft` — Draft document (does not affect stock balances or financial ledgers) * - `posted` — Posted document (executes warehouse stock movements and financial postings) */ type DocumentStatus = 'draft' | 'posted'; /** * Document payment status: * - `unpaid` — Unpaid document * - `partiallyPaid` — Partially paid document * - `paid` — Fully paid document */ type DocumentPaymentStatus = 'unpaid' | 'partiallyPaid' | 'paid'; /** * Document tag / label representation (`Label` entity in Nomi backend): * Contains tag text (`text`), hex color (`color` without `#`), color name, and sort index. */ interface DocumentTag { /** Tag identifier in Nomi (if referencing an existing tag) */ id?: EntityId | null; /** Tag text label (required) */ text: string; /** Hex color code without '#' (e.g. 'F2F3F5', 'EF4444') */ color?: string | null; /** Semantic color name ('gray', 'red', 'blue', etc.) */ colorName?: string | null; /** Sorting / display order index */ sortIndex?: number | null; } /** * Document item line payload (product or service line) */ interface DocumentPartPayload { /** Line identifier (when updating existing document lines) */ id?: EntityId | null; /** External line identifier from the external system */ externalId?: string | null; /** Nomenclature item ID in Nomi */ nomenclatureId: EntityId | null; /** Nomenclature item name (used for display and printed forms) */ nomenclatureName?: string | null; /** Nomenclature SKU / barcode */ nomenclatureSku?: string | null; /** Measurement unit symbol (e.g. 'pcs', 'kg', 'm') */ nomenclatureUnit?: string | null; /** Warehouse ID for this line (defaults to document header warehouse if omitted) */ warehouseId?: EntityId | null; /** Warehouse name */ warehouseName?: string | null; /** Quantity of items/services */ quantity: number; /** Unit price (before discounts) */ unitPrice: number; /** Final line amount after discount: (unitPrice * quantity) - discountAmount */ amount: number; /** Line amount in company base accounting currency */ amountCurrency?: number | null; /** Unit price in company base accounting currency */ unitAmountCurrency?: number | null; /** Line cost amount */ costAmount?: number | null; /** Line cost amount in company base accounting currency */ costAmountCurrency?: number | null; /** Unit cost amount in company base accounting currency */ unitCostAmountCurrency?: number | null; /** VAT rate percentage (e.g. 20 for 20% VAT) */ vatPercent?: number | null; /** VAT amount for this line: amount * vatPercent / 100 */ vatAmount?: number | null; /** Line discount amount */ discountAmount?: number | null; /** Line currency ID */ currencyId?: EntityId | null; } interface DocumentPart extends DocumentPartPayload { } /** * Nomi Document object returned from the API */ interface Document { /** Unique document identifier in Nomi */ id: EntityId; /** External identifier for 1-to-1 synchronization (e.g. CRM order ID) */ externalId?: string | null; /** Human-readable document number */ documentNumber?: string | null; /** Operation date (YYYY-MM-DD) */ date: string; /** Payment due date or expected delivery date (YYYY-MM-DD) */ dueDate?: string | null; /** Document type */ type: DocumentType; /** Document posting status ('draft' or 'posted') */ status: DocumentStatus; /** Document payment status ('unpaid', 'partiallyPaid', 'paid') */ paymentStatus?: DocumentPaymentStatus; /** Organization / Legal entity ID in Nomi */ legalEntityId: EntityId; /** Document currency ID */ currencyId: EntityId; /** Counterparty ID (customer, supplier) */ counterpartyId?: EntityId | null; /** Associated Project ID */ projectId?: EntityId | null; /** Associated Project category / business direction ID */ projectCategoryId?: EntityId | null; /** Primary warehouse ID for stock movements */ warehouseId?: EntityId | null; /** Total document amount (sum of line amounts before VAT) */ amount?: number; /** Total document amount in company base accounting currency */ amountCurrency?: number; /** Unit amount in accounting currency */ unitAmountCurrency?: number; /** Total amount paid towards this document */ paidAmount?: number; /** Total VAT amount across all document lines */ vatAmount?: number | null; /** Text notes and manager comments */ notes?: string | null; /** Tags / labels assigned to the document (strings or tag objects) */ tags?: (DocumentTag | string)[] | null; /** Reference document ID (e.g. parent invoice, order, or receipt) */ refDocumentId?: EntityId | null; /** Reference document number */ refDocumentNumber?: string | null; /** Reference document type */ refDocumentType?: DocumentType | null; /** Print template ID for generating invoices / packing slips */ printTemplateId?: EntityId | null; /** Organization company requisites snapshot ID */ organizationRequisiteId?: EntityId | null; /** Counterparty requisites snapshot ID */ counterpartyRequisiteId?: EntityId | null; /** Primary attached file ID */ fileId?: EntityId | null; /** Secondary attached file ID */ file2Id?: EntityId | null; /** Tertiary attached file ID */ file3Id?: EntityId | null; /** Document line items */ parts: DocumentPart[]; } /** * Payload for creating or updating a document */ interface DocumentPayload { /** Document ID (required when updating an existing document) */ id?: EntityId | null; /** External identifier for deduplication and sync tracking */ externalId?: string | null; /** Human-readable document number */ documentNumber?: string | null; /** Operation date (YYYY-MM-DD) */ date: string; /** Payment due date or expected delivery date (YYYY-MM-DD) */ dueDate?: string | null; /** Document type (defaults to 'sale') */ type: DocumentType; /** Posting status ('draft' or 'posted', defaults to 'posted') */ status?: DocumentStatus; /** Payment status ('unpaid', 'partiallyPaid', 'paid') */ paymentStatus?: DocumentPaymentStatus; /** Organization / Legal entity ID (required) */ legalEntityId: EntityId; /** Document currency ID (required) */ currencyId: EntityId; /** Counterparty ID (customer or supplier) */ counterpartyId?: EntityId | null; /** Project ID */ projectId?: EntityId | null; /** Project category / direction ID */ projectCategoryId?: EntityId | null; /** Warehouse ID */ warehouseId?: EntityId | null; /** Total document amount (calculated automatically from parts if omitted) */ amount?: number; /** Total document amount in accounting currency */ amountCurrency?: number; /** Unit amount in accounting currency */ unitAmountCurrency?: number; /** Paid amount */ paidAmount?: number; /** Total VAT amount */ vatAmount?: number | null; /** Text notes */ notes?: string | null; /** Tags / labels assigned to the document */ tags?: (DocumentTag | string)[] | null; /** Reference document ID */ refDocumentId?: EntityId | null; /** Reference document number */ refDocumentNumber?: string | null; /** Reference document type */ refDocumentType?: DocumentType | null; /** Print template ID */ printTemplateId?: EntityId | null; /** Organization requisites ID */ organizationRequisiteId?: EntityId | null; /** Counterparty requisites ID */ counterpartyRequisiteId?: EntityId | null; /** Attached file ID 1 */ fileId?: EntityId | null; /** Attached file ID 2 */ file2Id?: EntityId | null; /** Attached file ID 3 */ file3Id?: EntityId | null; /** Document line items */ parts: DocumentPartPayload[]; } /** * Client API for managing Nomi documents (/v1/documents) */ declare class DocumentsApi { private client; constructor(client: BaseClient); /** * Retrieves documents using asynchronous pagination generator * @param params Pagination, sorting, and filter parameters * @example * for await (const doc of client.documents.getAll({ limit: 50 })) { * console.log(doc.documentNumber, doc.amount); * } */ getAll(params?: PaginationParams): AsyncGenerator; /** * Retrieves a document by its ID * GET /v1/documents/:id * @param id Document ID */ getById(id: EntityId): Promise; /** * Creates a new document in Nomi * POST /v1/documents * @param payload Document payload data */ create(payload: DocumentPayload): Promise<{ id: EntityId; }>; /** * Updates an existing document in Nomi * PUT /v1/documents/:id * @param id Document ID * @param payload Updated document payload data */ update(id: EntityId, payload: DocumentPayload): Promise<{ id: EntityId; }>; /** * Deletes a document by ID * DELETE /v1/documents/:id * @param id Document ID */ delete(id: EntityId): Promise; /** * Bulk deletes multiple documents by IDs * DELETE /v1/documents/bulk * @param ids Array of document IDs to delete */ deleteMultiple(ids: EntityId[]): Promise; /** * Bulk creates/saves multiple documents with automatic chunking * POST /v1/documents/bulk * @param documents Array of documents to save */ bulkSave(documents: DocumentPayload[]): Promise<{ ids: EntityId[]; }>; /** * Restores soft-deleted documents from trash * POST /v1/documents/restore * @param ids Array of document IDs to restore */ restore(ids: EntityId[]): Promise; /** * Links payments (transaction parts) to a document in Nomi * POST /v1/documents/:id/link-payments * @param id Document ID * @param transactionPartIds Array of transaction part IDs to link */ linkPayments(id: EntityId, transactionPartIds: EntityId[]): Promise; /** * Unlinks payments (transaction parts) from a document in Nomi * POST /v1/documents/:id/unlink-payment * @param id Document ID * @param transactionPartIds Array of transaction part IDs to unlink */ unlinkPayment(id: EntityId, transactionPartIds: EntityId[]): Promise; } /** * Currency entity in Nomi (/v1/finance/currencies) */ interface Currency { /** Unique currency identifier in Nomi */ id: EntityId; /** Currency name (e.g. 'US Dollar', 'Euro', 'Hryvnia') */ name: string; /** ISO currency code (e.g. 'USD', 'EUR', 'UAH') */ code: string; /** Currency symbol (e.g. '$', '€', '₴') */ symbol?: string; /** Exchange rate relative to base accounting currency */ rate?: number; /** Whether the currency is a cryptocurrency */ isCryptoCurrency?: boolean; } /** * Payload for creating or updating a currency */ interface CurrencyPayload { /** Currency ID (when updating) */ id?: EntityId | null; /** Currency name */ name?: string; /** ISO currency code (required) */ code: string; /** Currency symbol */ symbol?: string; /** Exchange rate */ rate?: number; /** Cryptocurrency flag */ isCryptoCurrency?: boolean; } interface GetCurrenciesResponse { defaultCurrency?: Currency; currencies: Currency[]; allowToChangeCurrency?: boolean; allowToDeleteCurrencies?: string[]; } /** * Client API for managing currencies (/v1/finance/currencies) */ declare class CurrenciesApi { private client; constructor(client: BaseClient); /** * Retrieves all company currencies * GET /v1/finance/currencies */ getAll(): Promise; /** * Retrieves currencies settings including default currency * GET /v1/finance/currencies */ getSettings(): Promise; /** * Creates or saves a currency * POST /v1/finance/currencies * @param payload Currency payload data */ save(payload: CurrencyPayload): Promise; /** * Deletes a currency * DELETE /v1/finance/currencies/:id */ delete(id: EntityId): Promise; /** * Changes default currency * PUT /v1/finance/currencies/default */ changeDefault(payload: { currencyId?: string; currencyCode?: string; }): Promise; } /** * Legal entity / internal organization in Nomi (/v1/legal-entities) */ interface LegalEntity { /** Legal entity identifier */ id: EntityId; /** Legal entity / company name */ name: string; /** Registration code / company number */ code?: string | null; /** Tax ID number */ taxNumber?: string | null; /** Notes */ notes?: string | null; /** Whether the legal entity is archived */ isArchived?: boolean; } /** * Payload for legal entity data */ interface LegalEntityPayload { /** Legal entity ID */ id?: EntityId | null; /** Legal entity name */ name: string; /** Registration code */ code?: string | null; /** Tax ID number */ taxNumber?: string | null; /** Notes */ notes?: string | null; } /** * Client API for retrieving legal entities in Nomi (/v1/legal-entities) */ declare class LegalEntitiesApi { private client; constructor(client: BaseClient); /** * Retrieves legal entities using pagination generator * GET /v1/legal-entities */ getAll(params?: PaginationParams): AsyncGenerator; /** * Retrieves a legal entity by ID * GET /v1/legal-entities/:id */ getById(id: EntityId): Promise; /** * Creates or saves a legal entity * POST /v1/legal-entities */ save(payload: LegalEntityPayload): Promise<{ id: EntityId; }>; /** * Bulk creates/saves legal entities with automatic chunking * POST /v1/legal-entities/bulk */ bulkSave(legalEntities: LegalEntityPayload[]): Promise<{ ids: EntityId[]; }>; /** * Updates a legal entity * PUT /v1/legal-entities/:id */ update(id: EntityId, payload: LegalEntityPayload): Promise<{ id: EntityId; }>; /** * Deletes a legal entity * DELETE /v1/legal-entities/:id */ delete(id: EntityId): Promise; } declare class PropertyBagsApi { private client; constructor(client: BaseClient); get(appName: string, name: string): Promise; set(appName: string, name: string, value: T): Promise; remove(appName: string, name: string): Promise; } interface Warehouse { id: EntityId; name: string; externalId?: string | null; address?: string | null; isArchived?: boolean; } interface WarehousePayload { id?: EntityId | null; name: string; externalId?: string | null; address?: string | null; } declare class WarehousesApi { private client; constructor(client: BaseClient); getAll(): Promise; getById(id: EntityId): Promise; create(payload: WarehousePayload): Promise<{ id: EntityId; }>; bulkSave(warehouses: WarehousePayload[]): Promise<{ ids: EntityId[]; }>; update(id: EntityId, payload: WarehousePayload): Promise<{ id: EntityId; }>; delete(id: EntityId): Promise; } interface SynchronizationDto { id: string; appId: string; tenantId?: string | null; functionId: string; name?: string | null; status: 'new' | 'in_progress' | 'success' | 'error' | 'cancelled'; progress: number; message?: string | null; executionId?: string | null; payload?: any; result?: any; error?: any; hasReport?: boolean; report?: { fileName: string; mimeType?: string | null; sizeBytes?: number | null; } | null; startedAt?: string | null; finishedAt?: string | null; createdAt?: string | null; updatedAt?: string | null; } interface CreateSynchronizationPayload { functionId: string; name?: string; payload?: any; tenantId?: string; } interface UpdateSynchronizationPayload { status?: 'new' | 'in_progress' | 'success' | 'error' | 'cancelled'; progress?: number; message?: string; result?: any; error?: any; } declare class SynchronizationsApi { private client; constructor(client: BaseClient); create(appId: string, payload: CreateSynchronizationPayload): Promise; get(appId: string, syncId: string): Promise; list(appId: string, params?: { status?: string; tenantId?: string; limit?: number; offset?: number; }): Promise; update(appId: string, syncId: string, payload: UpdateSynchronizationPayload): Promise; } declare function isLocalhost(url?: string, baseUrl?: string): boolean; declare function getLocalhostHttpsAgent(): any; declare class NomiClient { accounts: AccountsApi; projects: ProjectsApi; counterparties: CounterpartiesApi; transactions: TransactionsApi; nomenclature: NomenclatureApi; nomenclatureMovements: NomenclatureMovementsApi; documents: DocumentsApi; currencies: CurrenciesApi; legalEntities: LegalEntitiesApi; propertyBags: PropertyBagsApi; warehouses: WarehousesApi; synchronizations: SynchronizationsApi; constructor(config: NomiClientConfig); } declare const propertyBag: any; declare const secrets: any; export { type Account, type AccountImportsResponse, type AccountPayload, AccountsApi, type AccountsTotalsResponse, type AppRunnerExecutionResult, BaseClient, type Context, CounterpartiesApi, type Counterparty, type CounterpartyPayload, type CounterpartyType, type CounterpartyTypePayload, type CounterpartyTypeRef, type CreateSynchronizationPayload, CurrenciesApi, type Currency, type CurrencyPayload, DEFAULT_PRODUCT_UNIT_ID, DEFAULT_SERVICE_UNIT_ID, type Document, type DocumentPart, type DocumentPartPayload, type DocumentPayload, type DocumentPaymentStatus, type DocumentStatus, type DocumentTag, type DocumentType, DocumentsApi, type EntityId, type GetAccountsResponse, type GetCurrenciesResponse, LegalEntitiesApi, type LegalEntity, type LegalEntityPayload, type Metadata, NomenclatureApi, type NomenclatureCategory, type NomenclatureCategoryPayload, type NomenclatureItem, type NomenclatureMovement, type NomenclatureMovementPartPayload, type NomenclatureMovementPayload, NomenclatureMovementsApi, type NomenclaturePayload, type NomenclatureUnit, NomenclatureUnitId, NomenclatureUnits, type NomiApiError, NomiClient, type NomiClientConfig, NomiError, type PaginationParams, type Project, type ProjectCategory, type ProjectCategoryPayload, type ProjectPayload, ProjectsApi, PropertyBagsApi, type RunnerApp, type RunnerContext, type RunnerCreateSyncParams, type RunnerExecution, type RunnerFunctionInfo, type RunnerHandler, type RunnerLogger, type RunnerManifest, type RunnerManifestApp, type RunnerManifestFeatureFlag, type RunnerManifestFeatureFlagOption, type RunnerManifestFunction, type RunnerManifestMenuItem, type RunnerManifestPanel, type RunnerManifestSecret, type RunnerManifestTrigger, type RunnerProgressData, type RunnerPropertyBag, type RunnerSecretItem, type RunnerSecretType, type RunnerSecrets, type RunnerSync, type RunnerSyncStatus, type RunnerSyncUpdateParams, type RunnerTenant, type RunnerTriggerType, type RunnerUser, type SynchronizationDto, SynchronizationsApi, type Transaction, type TransactionCategory, type TransactionPartPayload, type TransactionPayload, type TransactionType, TransactionsApi, UnitId, type UpdateSynchronizationPayload, type Warehouse, type WarehousePayload, WarehousesApi, getLocalhostHttpsAgent, isLocalhost, propertyBag, secrets };