@opencxh/domain 1.301.0 → 1.303.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/entities/agreement/from-quote.d.ts +8 -8
  2. package/dist/entities/agreement/index.d.ts +2 -0
  3. package/dist/entities/agreement/invoice-head.d.ts +21 -0
  4. package/dist/entities/agreement/lifecycle.d.ts +10 -0
  5. package/dist/entities/agreement/period.d.ts +8 -0
  6. package/dist/entities/agreement/prices.d.ts +43 -0
  7. package/dist/entities/agreement/prices.test.d.ts +1 -0
  8. package/dist/entities/agreement/types.d.ts +54 -10
  9. package/dist/entities/bank/match.d.ts +16 -2
  10. package/dist/entities/bank/types.d.ts +12 -0
  11. package/dist/entities/bookkeeping/receipt.d.ts +45 -6
  12. package/dist/entities/bookkeeping/types.d.ts +1 -2
  13. package/dist/entities/business-entity/types.d.ts +11 -15
  14. package/dist/entities/catalog/pricing.d.ts +11 -11
  15. package/dist/entities/catalog/types.d.ts +15 -9
  16. package/dist/entities/company/role.d.ts +14 -0
  17. package/dist/entities/financing/schedule.d.ts +9 -3
  18. package/dist/entities/financing/types.d.ts +17 -6
  19. package/dist/entities/fulfilment/adopt.d.ts +149 -0
  20. package/dist/entities/fulfilment/customers.d.ts +63 -0
  21. package/dist/entities/fulfilment/execute.d.ts +67 -0
  22. package/dist/entities/fulfilment/fulfilment.test.d.ts +1 -0
  23. package/dist/entities/fulfilment/goods.d.ts +72 -0
  24. package/dist/entities/fulfilment/index.d.ts +8 -0
  25. package/dist/entities/fulfilment/path.d.ts +8 -0
  26. package/dist/entities/fulfilment/path.test.d.ts +1 -0
  27. package/dist/entities/fulfilment/rules.d.ts +124 -0
  28. package/dist/entities/fulfilment/target.d.ts +131 -0
  29. package/dist/entities/fulfilment/types.d.ts +321 -0
  30. package/dist/entities/ledger/entry.d.ts +47 -9
  31. package/dist/entities/ledger/types.d.ts +33 -35
  32. package/dist/entities/ledger/xaf.d.ts +3 -0
  33. package/dist/entities/money/tax.d.ts +6 -0
  34. package/dist/entities/money/totals.d.ts +5 -5
  35. package/dist/entities/purchase/choose.d.ts +57 -0
  36. package/dist/entities/purchase/choose.test.d.ts +1 -0
  37. package/dist/entities/purchase/contract.d.ts +44 -25
  38. package/dist/entities/purchase/demand.d.ts +22 -40
  39. package/dist/entities/purchase/feed.d.ts +92 -6
  40. package/dist/entities/purchase/index.d.ts +1 -0
  41. package/dist/entities/purchase/kinds.d.ts +2 -1
  42. package/dist/entities/purchase/logic.d.ts +32 -7
  43. package/dist/entities/purchase/match.d.ts +48 -6
  44. package/dist/entities/purchase/packing-slip.d.ts +23 -0
  45. package/dist/entities/purchase/types.d.ts +71 -38
  46. package/dist/entities/reports/vat.d.ts +20 -5
  47. package/dist/entities/transaction/booking.d.ts +4 -4
  48. package/dist/entities/transaction/convert.d.ts +10 -10
  49. package/dist/entities/transaction/document.d.ts +8 -3
  50. package/dist/entities/transaction/dunning.d.ts +12 -1
  51. package/dist/entities/transaction/facets.test.d.ts +1 -0
  52. package/dist/entities/transaction/keys.d.ts +3 -0
  53. package/dist/entities/transaction/kinds.d.ts +11 -10
  54. package/dist/entities/transaction/receivable.d.ts +5 -2
  55. package/dist/entities/transaction/settlement.d.ts +7 -7
  56. package/dist/entities/transaction/types.d.ts +123 -68
  57. package/dist/index.cjs +25 -25
  58. package/dist/index.d.ts +2 -1
  59. package/dist/index.js +5452 -4308
  60. package/dist/platform/bookkeeping.d.ts +8 -8
  61. package/dist/platform/provisioning.d.ts +210 -13
  62. package/package.json +1 -1
  63. /package/dist/entities/{purchase/demand.test.d.ts → agreement/invoice-head.test.d.ts} +0 -0
@@ -1,6 +1,7 @@
1
1
  import { LedgerMappingRule } from '../entities/bookkeeping/types';
2
2
  import { Cents } from '../entities/money/money';
3
3
  import { TaxRateKind } from '../entities/money/tax';
4
+ import { LineDimensions } from '../entities/transaction/types';
4
5
  export declare const BOOKABLE_SOURCE_PROVIDER_GROUP = "bookable-source";
5
6
  export declare const BOOKKEEPING_PROVIDER_GROUP = "bookkeeping";
6
7
  /** Routes under `/provider`. Constants, so caller and provider cannot drift apart. */
@@ -39,6 +40,8 @@ export interface BookingDocument {
39
40
  number?: string;
40
41
  counterparty: {
41
42
  companyId?: string;
43
+ /** Its role number at this administration (debtor or creditor number), as it went out. */
44
+ number?: string;
42
45
  name: string;
43
46
  vatNumber?: string;
44
47
  kvkNumber?: string;
@@ -53,7 +56,7 @@ export interface BookingDocument {
53
56
  };
54
57
  /** `"2026-09-24"`. Dates are days, not instants. */
55
58
  issueDate: string;
56
- /** Delivery date or end of the service period: decides the VAT period. */
59
+ /** When the VAT is due, if not on `issueDate`. A sales invoice leaves it out (D2). */
57
60
  taxPointDate?: string;
58
61
  dueDate?: string;
59
62
  currency: string;
@@ -95,11 +98,8 @@ export interface BookingLine {
95
98
  */
96
99
  accountKey?: string;
97
100
  productId?: string;
98
- /**
99
- * Open map: `projectId`, `costCenterId`, `customerCompanyId` (whose cost or revenue this is),
100
- * and whatever a later country needs. All of it reaches the journal line.
101
- */
102
- dimensions?: Record<string, string>;
101
+ /** KETEN-STAND B1: each reaches the journal line as its own column. */
102
+ dimensions?: LineDimensions;
103
103
  /** The cost of what this line sold (quantity × cost price): carried for margin, not booked yet. */
104
104
  costCents?: Cents;
105
105
  /**
@@ -126,8 +126,8 @@ export interface IssuedDocumentRef {
126
126
  export interface BookingAnnouncement {
127
127
  sourceApp: string;
128
128
  documentId: string;
129
- /** Empty = the default administration; finance resolves it, a row never carries "". */
130
- businessEntityId?: string;
129
+ /** Always the document's own administration (review 5a-4); `""` is refused, not "the default". */
130
+ businessEntityId: string;
131
131
  documentKind: BookingDocument["kind"];
132
132
  documentNumber?: string;
133
133
  issuedAt: number;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * `provisioning-source`: an app that can order at a supplier through its API (Eylo: a customer
3
- * account, numbers). Purchase submits a request per order line and follows it; the provider says
3
+ * account, numbers). Fulfilment submits a request per act and follows it; the provider says
4
4
  * what it needs and what it made.
5
5
  */
6
6
  export declare const PROVISIONING_SOURCE_GROUP = "provisioning-source";
@@ -8,17 +8,57 @@ export declare const PROVISIONING_ROUTES: {
8
8
  readonly describe: "/provisioning/describe";
9
9
  readonly submit: "/provisioning/submit";
10
10
  readonly status: "/provisioning/status";
11
+ readonly subscriptions: "/provisioning/subscriptions";
12
+ /** Optional, for offers that declare `qualify`: deliverable here, before the promise (047 step 8). */
13
+ readonly qualify: "/provisioning/qualify";
14
+ /** Optional, for account offers that declare `accounts`: every customer account it knows (047 step 9). */
15
+ readonly accounts: "/provisioning/accounts";
16
+ /** Optional, for providers that declare `catalog`: the assortment as price-list rows (045 D N-1). */
17
+ readonly catalog: "/provisioning/catalog";
18
+ /** Optional, for offers that declare `quote`: what one order costs, per part (045 D N-2). */
19
+ readonly quote: "/provisioning/quote";
11
20
  };
12
- export type ProvisioningAction = "purchase" | "change" | "suspend" | "resume" | "cancel";
13
21
  /**
14
- * A field the supplier needs. `ordering` is filled on the order line before it goes (the tenant's
15
- * domain, the number's region); `fulfillment` is what the supplier hands back (the account id).
22
+ * One vocabulary for the act, on the wire and on a `ProvisioningRequest` (plan 047 v2): `convert`
23
+ * swaps the product (Microsoft Transition, Pax8 ChangeProduct), `renew` starts a next term.
24
+ */
25
+ export type ProvisioningAction = "purchase" | "change" | "convert" | "suspend" | "resume" | "cancel" | "renew";
26
+ /** What one provider hands another, normalised (047 v2 §7): a few concrete kinds, no mapping language. */
27
+ export type ProvidedResource = {
28
+ kind: "phone_number";
29
+ value: string;
30
+ } | {
31
+ kind: "device";
32
+ value: string;
33
+ } | {
34
+ kind: "tenant";
35
+ value: string;
36
+ } | {
37
+ kind: "account";
38
+ value: string;
39
+ };
40
+ export type ResourceKind = ProvidedResource["kind"];
41
+ /** A role an offer needs another item in, and for which acts that item must be active. */
42
+ export interface RoleNeed {
43
+ role: string;
44
+ kind: ResourceKind;
45
+ min: number;
46
+ max: number;
47
+ for: ProvisioningAction[];
48
+ }
49
+ /** How an unknown outcome is recovered, per act (047 v2 §2.3). */
50
+ export type ProvisioningRecovery = "idempotent" | "lookup_by_ref" | "lookup_by_listing";
51
+ /**
52
+ * A field the supplier needs. `qualify` is asked on the quote line already (the site, for a
53
+ * delivery check); `ordering` is filled before it goes (the tenant's domain, the number's region);
54
+ * `fulfillment` is what the supplier hands back (the account id). An `address` is a crm
55
+ * `CompanyAddress.id`, never a copy: the provider reads the address itself.
16
56
  */
17
57
  export interface ProvisioningParam {
18
58
  key: string;
19
59
  label: string;
20
- phase: "ordering" | "fulfillment";
21
- type?: "text" | "email" | "select";
60
+ phase: "qualify" | "ordering" | "fulfillment";
61
+ type?: "text" | "email" | "select" | "address";
22
62
  required?: boolean;
23
63
  options?: {
24
64
  value: string;
@@ -39,17 +79,175 @@ export interface ProvisionableOffer {
39
79
  actions: ProvisioningAction[];
40
80
  /** The account it makes is a usage source: approved links it to the customer's agreement. */
41
81
  usageAccount?: boolean;
82
+ /** What a successful purchase hands back to others (047 v2 §7). */
83
+ provides?: {
84
+ kind: ResourceKind;
85
+ }[];
86
+ /** What it needs from other items, per role (047 v2 §10.1). */
87
+ needs?: RoleNeed[];
88
+ /** Per act, how an unknown outcome is recovered. Absent = ask a person. */
89
+ recovery?: Partial<Record<ProvisioningAction, ProvisioningRecovery>>;
90
+ /** The provider lists what runs under an account (`subscriptions`): polled into `reported`. */
91
+ listing?: boolean;
92
+ /** Answers `POST /provisioning/qualify` with its `qualify` params (047 step 8). */
93
+ qualify?: boolean;
94
+ /** Priced per order: answers `POST /provisioning/quote` (045 D N-2). */
95
+ quote?: boolean;
96
+ /**
97
+ * An account offer whose accounts the provider lists (`POST /provisioning/accounts`): where
98
+ * fulfilment looks for what already runs when an existing business moves over (047 step 9).
99
+ */
100
+ accounts?: boolean;
101
+ /**
102
+ * Internal only: a federated resource (`"nextpertise:SiteCheck"`) for a check a form cannot do.
103
+ * Runs with a colleague's rights, so an offer checkable only this way is never self-service.
104
+ */
105
+ resource?: string;
106
+ }
107
+ /**
108
+ * `qualify`: the offer, the supplier's product (`SupplierOffer.vendorSku`: one Nextpertise offer
109
+ * covers every carrier product) and its `qualify` answers (an address as a crm address id).
110
+ */
111
+ export interface QualifyCommand {
112
+ offer: string;
113
+ vendorSku?: string;
114
+ params: Record<string, string>;
115
+ }
116
+ /**
117
+ * A provider's answer, per supplier option, with its cost: internal, never shown to a customer.
118
+ * An option's `key` is one of the provider's own offer keys, so fulfilment can name it as ours.
119
+ */
120
+ export interface ProviderQualification {
121
+ available: boolean;
122
+ reason?: string;
123
+ options?: {
124
+ key: string;
125
+ label: string;
126
+ costCents?: number;
127
+ termMonths?: number;
128
+ }[];
129
+ expiresAt: number;
130
+ }
131
+ /**
132
+ * `quote`: what an act costs. A purchase (no `action`): the offer, the supplier's product
133
+ * (`SupplierOffer.vendorSku`), its commitment (`SupplierOffer.termMonths`) and the request's
134
+ * answers. A cancel: the running subscription, the account it runs under and the day it ends.
135
+ */
136
+ export interface QuoteCommand {
137
+ offer: string;
138
+ action?: ProvisioningAction;
139
+ vendorSku?: string;
140
+ termMonths?: number;
141
+ params: Record<string, string>;
142
+ externalRef?: string;
143
+ parent?: {
144
+ externalRef?: string;
145
+ fulfillment?: Record<string, string>;
146
+ };
147
+ effectiveAt?: number;
148
+ }
149
+ /**
150
+ * What one order costs at the supplier, per part: each part is a line on the purchase order, once
151
+ * or per month. Cost, internal — never shown to a customer.
152
+ */
153
+ export interface ProviderQuote {
154
+ parts: {
155
+ label: string;
156
+ cents: number;
157
+ recurring?: "month";
158
+ }[];
159
+ warnings?: string[];
160
+ }
161
+ /** One subscription as the supplier lists it under an account (Pax8, Microsoft, 047 v2 §2.1). */
162
+ export interface ReportedSubscription {
163
+ externalRef: string;
164
+ offer: string;
165
+ quantity: number;
166
+ status: "active" | "suspended" | "ended";
167
+ /** Our `requestId`, where the supplier keeps a reference (Ion `referenceId`). */
168
+ requestRef?: string;
169
+ termEndsAt?: number;
170
+ autoRenew?: boolean;
171
+ /** Microsoft NCE: every add-on has its own window; a decrease only within these. */
172
+ refundable?: {
173
+ quantity: number;
174
+ until: number;
175
+ }[];
176
+ scheduled?: {
177
+ quantity?: number;
178
+ productId?: string;
179
+ at: number;
180
+ };
181
+ /** The account it runs under at this provider (its `externalRef`), when listed flat. */
182
+ under?: string;
183
+ /** What it uses of other items (a number routed from elsewhere): bound to `requires` on adopt. */
184
+ uses?: ProvidedResource[];
185
+ }
186
+ /** One customer account a provider knows (`accounts`): matched to a crm company on adopt. */
187
+ export interface ProviderAccount {
188
+ externalRef: string;
189
+ /** The account offer it is an instance of. */
190
+ offer: string;
191
+ name: string;
192
+ kvkNumber?: string;
193
+ domain?: string;
194
+ fulfillment?: Record<string, string>;
195
+ since?: number;
196
+ }
197
+ /** `subscriptions`: what runs under one account, optionally of one offer. */
198
+ export interface SubscriptionsQuery {
199
+ account: {
200
+ externalRef?: string;
201
+ fulfillment?: Record<string, string>;
202
+ };
203
+ offer?: string;
42
204
  }
43
205
  export interface ProvisioningDescription {
44
206
  offers: ProvisionableOffer[];
207
+ /**
208
+ * The provider lists its assortment (`POST /provisioning/catalog { account }`), per connection:
209
+ * a price list with source `api` reads it instead of a file (045 D N-1).
210
+ */
211
+ catalog?: {
212
+ accounts: {
213
+ id: string;
214
+ name: string;
215
+ }[];
216
+ };
45
217
  }
46
- export interface ProvisioningRequest {
47
- /** `lineKey` of the order line: the provider's idempotency key — the same request twice is one. */
218
+ /** One product of a provider's assortment, as a price-list line reads it. */
219
+ export interface ProviderCatalogRow {
220
+ vendorSku: string;
221
+ description: string;
222
+ brand?: string;
223
+ group?: string;
224
+ /** The provider's offer it is ordered through (`ProvisionableOffer.key`). */
225
+ offer: string;
226
+ /** Absent: priced per order (`pricedBy: "quote"`). */
227
+ costCents?: number;
228
+ currency?: string;
229
+ }
230
+ export interface ProvisioningCommand {
231
+ /** The provider's idempotency key: the same request twice is one. */
48
232
  requestId: string;
49
233
  offer: string;
50
234
  action: ProvisioningAction;
51
235
  quantity: number;
236
+ /** `convert`: the product it becomes. */
237
+ toProductId?: string;
238
+ /**
239
+ * What it is bought as at the supplier, from the PO line's offer: their product
240
+ * (`SupplierOffer.vendorSku`, a Nextpertise carrier product) and its term in months.
241
+ */
242
+ vendorSku?: string;
243
+ termMonths?: number;
52
244
  params: Record<string, string>;
245
+ /** What it uses from other items, bound by role (047 v2 §10.1): the number it routes. */
246
+ inputs?: {
247
+ role: string;
248
+ itemId: string;
249
+ resource: ProvidedResource;
250
+ }[];
53
251
  /** The subscription this changes or ends. */
54
252
  externalRef?: string;
55
253
  /** What the account level handed back (its id), for an item inside it. */
@@ -57,11 +255,6 @@ export interface ProvisioningRequest {
57
255
  externalRef?: string;
58
256
  fulfillment?: Record<string, string>;
59
257
  };
60
- /** Bought elsewhere and landing here: what the purchase handed back (the numbers). */
61
- predecessor?: {
62
- externalRef?: string;
63
- fulfillment?: Record<string, string>;
64
- };
65
258
  customer?: {
66
259
  companyId: string;
67
260
  name?: string;
@@ -85,4 +278,8 @@ export interface ProvisioningResult {
85
278
  app: string;
86
279
  accountRef: string;
87
280
  };
281
+ /** Partly done: how many of the target succeeded (Microsoft reports per part). */
282
+ quantity?: number;
283
+ /** What it now provides to others, normalised (047 v2 §7). */
284
+ resources?: ProvidedResource[];
88
285
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/domain",
3
- "version": "1.301.0",
3
+ "version": "1.303.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",