@substrat-run/engine-invoicing 0.1.0 → 0.2.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.
- package/README.md +65 -0
- package/dist/index.d.ts +17 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +76 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# @substrat-run/engine-invoicing
|
|
2
|
+
|
|
3
|
+
Invoicing engine for [Substrat](https://github.com/substrat-run/substrat) —
|
|
4
|
+
accumulates **invoice bases** (Swedish: *fakturaunderlag*) from billable events and
|
|
5
|
+
makes them **immutable once exported**.
|
|
6
|
+
|
|
7
|
+
It produces the *basis* for an invoice: per-customer collections of billable lines
|
|
8
|
+
with frozen prices and provenance, ready to hand to whatever actually issues invoices
|
|
9
|
+
(typically an accounting connector). It is **not** a ledger, not accounts receivable,
|
|
10
|
+
not payment tracking.
|
|
11
|
+
|
|
12
|
+
**Full documentation: https://substrat.ahlstrand.es/engines/invoicing**
|
|
13
|
+
|
|
14
|
+
## Snapshot, not join
|
|
15
|
+
|
|
16
|
+
The engine consumes `workorder.completed` with **zero imports** from the work-order
|
|
17
|
+
engine — star topology. The consumer parses its own Zod view of the event payload,
|
|
18
|
+
finds or creates the open underlag for that customer, and copies the billable lines
|
|
19
|
+
with provenance (`source_type`, `source_id`):
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
events: {
|
|
23
|
+
consumes: [{ type: 'workorder.completed', schemaVersion: 1 }],
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Prices are frozen from the payload at the moment the work order completed. If the
|
|
28
|
+
vertical's price list changes tomorrow, yesterday's underlag doesn't. Consumers are
|
|
29
|
+
delivered at-least-once; find-or-create plus the kernel's delivery journal keep the
|
|
30
|
+
handler idempotent.
|
|
31
|
+
|
|
32
|
+
## The immutability invariant
|
|
33
|
+
|
|
34
|
+
An underlag is `open` or `exported`:
|
|
35
|
+
|
|
36
|
+
- While **open**, consumed events append lines.
|
|
37
|
+
- **`invoicing/export`** flips it to `exported` — from then on it is immutable.
|
|
38
|
+
Nothing appends, nothing edits, exporting again throws.
|
|
39
|
+
- Billable work arriving *after* export opens a **new** underlag. History is never
|
|
40
|
+
rewritten; late facts become new facts.
|
|
41
|
+
|
|
42
|
+
`invoicing.underlag-exported` is the natural hook for an accounting connector that
|
|
43
|
+
turns the frozen basis into a real invoice.
|
|
44
|
+
|
|
45
|
+
## Operations
|
|
46
|
+
|
|
47
|
+
| Operation | Permission | Does |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| `invoicing/list` | `invoicing:read` | list underlag, each with computed total |
|
|
50
|
+
| `invoicing/get` | `invoicing:read` | one underlag with all lines and total |
|
|
51
|
+
| `invoicing/export` | `invoicing:export` | flip to `exported` — the point of no return |
|
|
52
|
+
|
|
53
|
+
Totals use exact decimal arithmetic from
|
|
54
|
+
[`@substrat-run/contracts`](https://npmjs.com/package/@substrat-run/contracts), never floats.
|
|
55
|
+
|
|
56
|
+
## Related packages
|
|
57
|
+
|
|
58
|
+
- [`@substrat-run/kernel`](https://npmjs.com/package/@substrat-run/kernel) — the
|
|
59
|
+
scope-host contract these operations run on
|
|
60
|
+
- [`@substrat-run/engine-workorder`](https://npmjs.com/package/@substrat-run/engine-workorder) —
|
|
61
|
+
the producer of the billable events this engine consumes
|
|
62
|
+
|
|
63
|
+
## Status
|
|
64
|
+
|
|
65
|
+
Pre-release (0.x): surfaces change without notice until the first vertical ships.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { type ModuleRegistration } from '@substrat-run/kernel';
|
|
3
3
|
export declare const INVOICING_PERM: {
|
|
4
|
-
read: string & z.
|
|
5
|
-
export: string & z.
|
|
4
|
+
read: string & z.core.$brand<"PermissionKey">;
|
|
5
|
+
export: string & z.core.$brand<"PermissionKey">;
|
|
6
6
|
};
|
|
7
7
|
export declare const invoicingManifest: {
|
|
8
|
-
id: string & z.
|
|
8
|
+
id: string & z.core.$brand<"ModuleId">;
|
|
9
|
+
version: string;
|
|
10
|
+
kernelContract: string;
|
|
9
11
|
permissions: {
|
|
10
|
-
key: string & z.
|
|
12
|
+
key: string & z.core.$brand<"PermissionKey">;
|
|
11
13
|
description: string;
|
|
12
14
|
}[];
|
|
13
|
-
version: string;
|
|
14
|
-
kernelContract: string;
|
|
15
15
|
events: {
|
|
16
16
|
emits: {
|
|
17
17
|
type: string;
|
|
@@ -28,13 +28,19 @@ export declare const invoicingManifest: {
|
|
|
28
28
|
};
|
|
29
29
|
attachmentTargets: {
|
|
30
30
|
entityType: string;
|
|
31
|
-
readPermission: string & z.
|
|
31
|
+
readPermission: string & z.core.$brand<"PermissionKey">;
|
|
32
32
|
}[];
|
|
33
33
|
entitlementKey: string;
|
|
34
34
|
entityRelations?: {
|
|
35
35
|
entityType: string;
|
|
36
36
|
parentType: string;
|
|
37
37
|
}[] | undefined;
|
|
38
|
+
guards?: {
|
|
39
|
+
before: string;
|
|
40
|
+
predicate: string;
|
|
41
|
+
config: Record<string, unknown>;
|
|
42
|
+
}[] | undefined;
|
|
43
|
+
withdraws?: string[] | undefined;
|
|
38
44
|
api?: string | undefined;
|
|
39
45
|
searchables?: {
|
|
40
46
|
entityType: string;
|
|
@@ -43,13 +49,13 @@ export declare const invoicingManifest: {
|
|
|
43
49
|
ui?: {
|
|
44
50
|
routes?: {
|
|
45
51
|
path: string;
|
|
46
|
-
permission: string & z.BRAND<"PermissionKey">;
|
|
47
52
|
screen: string;
|
|
53
|
+
permission: string & z.core.$brand<"PermissionKey">;
|
|
48
54
|
}[] | undefined;
|
|
49
55
|
nav?: {
|
|
50
|
-
permission: string & z.BRAND<"PermissionKey">;
|
|
51
56
|
label: string;
|
|
52
57
|
to: string;
|
|
58
|
+
permission: string & z.core.$brand<"PermissionKey">;
|
|
53
59
|
icon?: string | undefined;
|
|
54
60
|
}[] | undefined;
|
|
55
61
|
entityViews?: {
|
|
@@ -57,14 +63,14 @@ export declare const invoicingManifest: {
|
|
|
57
63
|
view: string;
|
|
58
64
|
}[] | undefined;
|
|
59
65
|
widgets?: {
|
|
60
|
-
permission: string & z.BRAND<"PermissionKey">;
|
|
61
66
|
slot: string;
|
|
62
67
|
component: string;
|
|
68
|
+
permission: string & z.core.$brand<"PermissionKey">;
|
|
63
69
|
}[] | undefined;
|
|
64
70
|
settingsPanels?: {
|
|
65
|
-
permission: string & z.BRAND<"PermissionKey">;
|
|
66
71
|
label: string;
|
|
67
72
|
component: string;
|
|
73
|
+
permission: string & z.core.$brand<"PermissionKey">;
|
|
68
74
|
}[] | undefined;
|
|
69
75
|
} | undefined;
|
|
70
76
|
};
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,OAAO,EAIL,KAAK,kBAAkB,EAGxB,MAAM,sBAAsB,CAAC;AAS9B,eAAO,MAAM,cAAc;;;CAG1B,CAAC;AAEF,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,OAAO,EAIL,KAAK,kBAAkB,EAGxB,MAAM,sBAAsB,CAAC;AAS9B,eAAO,MAAM,cAAc;;;CAG1B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B5B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;GA6B/B,CAAC;AA6CF,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB;AAuMD,eAAO,MAAM,eAAe,EAAE,kBAY7B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,10 @@ export const invoicingManifest = moduleManifest.parse({
|
|
|
24
24
|
{ type: 'invoicing.underlag-updated', schemaVersion: 1 },
|
|
25
25
|
{ type: 'invoicing.underlag-exported', schemaVersion: 1 },
|
|
26
26
|
],
|
|
27
|
-
consumes: [
|
|
27
|
+
consumes: [
|
|
28
|
+
{ type: 'workorder.completed', schemaVersion: 1 },
|
|
29
|
+
{ type: 'commerce.order-placed', schemaVersion: 1 },
|
|
30
|
+
],
|
|
28
31
|
},
|
|
29
32
|
migrations: { journalDir: './migrations', compatibleFrom: '0.0.1' },
|
|
30
33
|
attachmentTargets: [{ entityType: 'underlag', readPermission: 'invoicing:read' }],
|
|
@@ -83,6 +86,25 @@ const completedPayload = z.object({
|
|
|
83
86
|
})),
|
|
84
87
|
total: money,
|
|
85
88
|
});
|
|
89
|
+
// ADDITIVE (D-28): a SECOND input event. The engine learns to build a
|
|
90
|
+
// fakturaunderlag from a retail order without touching the workorder path — new
|
|
91
|
+
// `consumes` entry + this parse + the consumer below, no migration, no
|
|
92
|
+
// permission. Its OWN Zod view of the contract; zero imports from the producer.
|
|
93
|
+
const commercePlacedPayload = z.object({
|
|
94
|
+
orderId: z.string().min(1),
|
|
95
|
+
number: z.number().int(),
|
|
96
|
+
customer: entityRef,
|
|
97
|
+
paymentMethod: z.string().min(1),
|
|
98
|
+
billable: z.array(z.object({
|
|
99
|
+
article: z.string().min(1),
|
|
100
|
+
description: z.string().min(1),
|
|
101
|
+
qty: z.string().min(1),
|
|
102
|
+
unit: z.string().min(1),
|
|
103
|
+
unitPrice: money,
|
|
104
|
+
lineTotal: money,
|
|
105
|
+
})),
|
|
106
|
+
total: money,
|
|
107
|
+
});
|
|
86
108
|
function underlagTotal(ctx, underlagId) {
|
|
87
109
|
return ctx.sql
|
|
88
110
|
.query('SELECT line_total_amount FROM invoicing_lines WHERE underlag_id = ?', [underlagId])
|
|
@@ -133,6 +155,58 @@ const onWorkOrderCompleted = (ctx, event) => {
|
|
|
133
155
|
},
|
|
134
156
|
});
|
|
135
157
|
};
|
|
158
|
+
// ADDITIVE consumer for the retail order event (concept §7). Same snapshot,
|
|
159
|
+
// -not-join discipline as `onWorkOrderCompleted`; source_type is 'order'. Only
|
|
160
|
+
// invoice-payment orders bill — card/Swish settle through a payment connector.
|
|
161
|
+
const onCommerceOrderPlaced = (ctx, event) => {
|
|
162
|
+
const p = commercePlacedPayload.parse(event.payload);
|
|
163
|
+
if (p.paymentMethod !== 'invoice')
|
|
164
|
+
return;
|
|
165
|
+
if (p.billable.length === 0)
|
|
166
|
+
return;
|
|
167
|
+
// Idempotent on at-least-once redelivery (K-11): the order is the dedup key.
|
|
168
|
+
// Its lines are already present → this delivery is a replay, do nothing.
|
|
169
|
+
const already = ctx.sql.query(`SELECT 1 AS found FROM invoicing_lines WHERE source_type = 'order' AND source_id = ? LIMIT 1`, [p.orderId])[0];
|
|
170
|
+
if (already)
|
|
171
|
+
return;
|
|
172
|
+
let underlag = ctx.sql.query(`SELECT * FROM invoicing_underlag WHERE customer_type = ? AND customer_id = ? AND status = 'open'`, [p.customer.entityType, p.customer.entityId])[0];
|
|
173
|
+
if (!underlag) {
|
|
174
|
+
const id = ulid();
|
|
175
|
+
const number = ctx.sql.query('SELECT COALESCE(MAX(number), 0) + 1 AS n FROM invoicing_underlag')[0]?.n ?? 1;
|
|
176
|
+
ctx.sql.exec(`INSERT INTO invoicing_underlag (id, number, customer_type, customer_id, status, created_at)
|
|
177
|
+
VALUES (?, ?, ?, ?, 'open', ?)`, [id, number, p.customer.entityType, p.customer.entityId, new Date().toISOString()]);
|
|
178
|
+
underlag = ctx.sql.query('SELECT * FROM invoicing_underlag WHERE id = ?', [id])[0];
|
|
179
|
+
}
|
|
180
|
+
for (const line of p.billable) {
|
|
181
|
+
ctx.sql.exec(`INSERT INTO invoicing_lines
|
|
182
|
+
(id, underlag_id, source_type, source_id, article, description, qty, unit,
|
|
183
|
+
unit_price_amount, currency, line_total_amount, created_at)
|
|
184
|
+
VALUES (?, ?, 'order', ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
185
|
+
ulid(),
|
|
186
|
+
underlag.id,
|
|
187
|
+
p.orderId,
|
|
188
|
+
line.article,
|
|
189
|
+
line.description,
|
|
190
|
+
line.qty,
|
|
191
|
+
line.unit,
|
|
192
|
+
line.unitPrice.amount,
|
|
193
|
+
line.unitPrice.currency,
|
|
194
|
+
line.lineTotal.amount,
|
|
195
|
+
new Date().toISOString(),
|
|
196
|
+
]);
|
|
197
|
+
}
|
|
198
|
+
ctx.emit({
|
|
199
|
+
type: 'invoicing.underlag-updated',
|
|
200
|
+
schemaVersion: 1,
|
|
201
|
+
entity: { entityType: 'underlag', entityId: underlag.id },
|
|
202
|
+
piiClass: 'none',
|
|
203
|
+
payload: {
|
|
204
|
+
underlagId: underlag.id,
|
|
205
|
+
addedLines: p.billable.length,
|
|
206
|
+
source: { entityType: 'order', entityId: p.orderId },
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
};
|
|
136
210
|
const listOp = async (ctx, input) => {
|
|
137
211
|
assertAllowed(await ctx.check(INVOICING_PERM.read));
|
|
138
212
|
const rows = input?.status
|
|
@@ -186,6 +260,7 @@ export const invoicingModule = {
|
|
|
186
260
|
},
|
|
187
261
|
consumers: {
|
|
188
262
|
'workorder.completed': onWorkOrderCompleted,
|
|
263
|
+
'commerce.order-placed': onCommerceOrderPlaced,
|
|
189
264
|
},
|
|
190
265
|
};
|
|
191
266
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,UAAU,EACV,SAAS,EACT,KAAK,EACL,cAAc,EACd,aAAa,GACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,IAAI,GAKL,MAAM,sBAAsB,CAAC;AAE9B,+EAA+E;AAC/E,uEAAuE;AACvE,+EAA+E;AAC/E,6EAA6E;AAC7E,mDAAmD;AACnD,+EAA+E;AAE/E,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,gBAAgB,CAAC;IAC3C,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,kBAAkB,CAAC;CAChD,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC;IACpD,EAAE,EAAE,gCAAgC;IACpC,OAAO,EAAE,OAAO;IAChB,cAAc,EAAE,QAAQ;IACxB,WAAW,EAAE;QACX,EAAE,GAAG,EAAE,gBAAgB,EAAE,WAAW,EAAE,sBAAsB,EAAE;QAC9D,EAAE,GAAG,EAAE,kBAAkB,EAAE,WAAW,EAAE,+CAA+C,EAAE;KAC1F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AAI,CAAC;QACP,IAAI,EAAE,6BAA6B;QACnC,aAAa,EAAE,CAAC;QAChB,MAAM,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE;QACzD,QAAQ,EAAE,MAAM;QAChB,OAAO,EAAE;YACP,UAAU,EAAE,QAAQ,CAAC,EAAE;YACvB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,KAAK,EAAE,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC;SACvC;KACF,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,CAAc,+CAA+C,EAAE;QACjF,QAAQ,CAAC,EAAE;KACZ,CAAC,CAAC,CAAC,CAAE,CAAC;AACT,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAuB;IACjD,QAAQ,EAAE,iBAAiB;IAC3B,UAAU,EAAE,mBAAmB;IAC/B,UAAU,EAAE;QACV,gBAAgB,EAAE,MAAe;QACjC,eAAe,EAAE,KAAc;QAC/B,kBAAkB,EAAE,QAAiB;KACtC;IACD,SAAS,EAAE;QACT,qBAAqB,EAAE,oBAAoB;QAC3C,uBAAuB,EAAE,qBAAqB;KAC/C;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@substrat-run/engine-invoicing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Substrat engine: fakturaunderlag — consumes billable events, snapshots lines with provenance, immutable once exported",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"zod": "^
|
|
29
|
-
"@substrat-run/
|
|
30
|
-
"@substrat-run/
|
|
28
|
+
"zod": "^4.4.3",
|
|
29
|
+
"@substrat-run/contracts": "^0.3.0",
|
|
30
|
+
"@substrat-run/kernel": "^0.3.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"typescript": "^5.6.0"
|