diff --git a/TODO.md b/TODO.md index 70155a9..abe74bf 100644 --- a/TODO.md +++ b/TODO.md @@ -12,3 +12,5 @@ ``` - [ ] Нужен еще один слой Create как и для Patch? + +- [ ] Нужно ли типизировать template литералами href в meta? diff --git a/package.json b/package.json index d22f42b..a879c7e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moysklad-api-model", - "version": "0.2.0", + "version": "0.2.1", "description": "Объектная модель API МойСклад для TypeScript проектов", "main": "build/src/index.js", "types": "build/src/index.d.ts", diff --git a/src/model/Counterparty.ts b/src/model/Counterparty.ts index 958f23c..b1f6621 100644 --- a/src/model/Counterparty.ts +++ b/src/model/Counterparty.ts @@ -2,7 +2,6 @@ import type { CollectionRef } from './CollectionRef' import type { Company, CompanyType } from './Company' import type { EntityRef } from './EntityRef' import type { Legal } from './Legal' -import type { MetaType } from './MetaType' import type { Person } from './Person' import type { PriceType } from './PriceType' diff --git a/src/model/HasVat.ts b/src/model/HasVat.ts index a32a475..76af012 100644 --- a/src/model/HasVat.ts +++ b/src/model/HasVat.ts @@ -7,3 +7,13 @@ export type HasVat = vatIncluded: boolean vatSum: number } + +export type HasVatPatch = + | { + vatEnabled?: false + } + | { + vatEnabled: true + vatIncluded?: boolean + vatSum?: number + } diff --git a/src/model/InvoiceIn.ts b/src/model/InvoiceIn.ts index d114274..0d8deb1 100644 --- a/src/model/InvoiceIn.ts +++ b/src/model/InvoiceIn.ts @@ -1,3 +1,11 @@ -import type { DocumentWithPositions, HasVat, MetaType } from '.' +import type { + DocumentWithPositions, + DocumentWithPositionsPatch, + HasVat, + HasVatPatch +} from '.' export type InvoiceIn = DocumentWithPositions<'invoicein'> & HasVat + +export type InvoiceInPatch = DocumentWithPositionsPatch<'invoicein'> & + HasVatPatch diff --git a/src/model/InvoiceOut.ts b/src/model/InvoiceOut.ts index a07477d..ae6f261 100644 --- a/src/model/InvoiceOut.ts +++ b/src/model/InvoiceOut.ts @@ -1,3 +1,11 @@ -import type { DocumentWithPositions, HasVat, MetaType } from '.' +import type { + DocumentWithPositions, + DocumentWithPositionsPatch, + HasVat, + HasVatPatch +} from '.' export type InvoiceOut = DocumentWithPositions<'invoiceout'> & HasVat + +export type InvoiceOutPatch = DocumentWithPositionsPatch<'invoiceout'> & + HasVatPatch diff --git a/src/model/utils/Patch.ts b/src/model/utils/Patch.ts index 5def4f9..83059b4 100644 --- a/src/model/utils/Patch.ts +++ b/src/model/utils/Patch.ts @@ -3,13 +3,21 @@ import type { CustomerOrderPatch, EntityPatchRef, MetaType, - CustomerOrderPositionPatch + CustomerOrderPositionPatch, + InvoiceInPatch, + InvoiceOutPatch } from '..' +import type { CashInPatch } from '../CashIn' +import type { CashOutPatch } from '../CashOut' export type PatchByMetaType = { customerorder: CustomerOrderPatch customerorderposition: CustomerOrderPositionPatch attributemetadata: AttributePatch + invoicein: InvoiceInPatch + invoiceout: InvoiceOutPatch + cashin: CashInPatch + cashout: CashOutPatch } export type Patch = T extends keyof PatchByMetaType