@substrat-run/engine-metering 0.4.2 → 0.5.1
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/dist/entities.d.ts +2 -0
- package/dist/entities.d.ts.map +1 -1
- package/dist/entities.js +6 -0
- package/dist/entities.js.map +1 -1
- package/dist/index.d.ts +70 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +281 -65
- package/dist/index.js.map +1 -1
- package/dist/model.d.ts +12 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +14 -0
- package/dist/model.js.map +1 -0
- package/dist/operations.d.ts +12 -0
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +31 -0
- package/dist/operations.js.map +1 -1
- package/dist/seam.d.ts +5 -0
- package/dist/seam.d.ts.map +1 -0
- package/dist/seam.js +20 -0
- package/dist/seam.js.map +1 -0
- package/package.json +5 -5
package/dist/entities.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export declare const meteringEntities: {
|
|
|
38
38
|
active: z.ZodNumber;
|
|
39
39
|
created_at: z.ZodString;
|
|
40
40
|
}, z.core.$strip>;
|
|
41
|
+
readonly primaryKey: readonly ["key"];
|
|
41
42
|
};
|
|
42
43
|
readonly 'metering-entry': {
|
|
43
44
|
readonly table: "metering_entries";
|
|
@@ -53,6 +54,7 @@ export declare const meteringEntities: {
|
|
|
53
54
|
created_by: z.ZodString;
|
|
54
55
|
created_at: z.ZodString;
|
|
55
56
|
}, z.core.$strip>;
|
|
57
|
+
readonly key: readonly ["meter_key", "dedupe_key"];
|
|
56
58
|
};
|
|
57
59
|
readonly 'metering-period': {
|
|
58
60
|
readonly table: "metering_periods";
|
package/dist/entities.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2C3B,CAAC;AAEH,2EAA2E;AAC3E,eAAO,MAAM,QAAQ;;;;;;;;;;iBAA4C,CAAC;AAClE,gDAAgD;AAChD,eAAO,MAAM,QAAQ;;;;;;;;;;;iBAA4C,CAAC;AAClE,4BAA4B;AAC5B,eAAO,MAAM,SAAS;;;;;;iBAA6C,CAAC"}
|
package/dist/entities.js
CHANGED
|
@@ -36,6 +36,9 @@ export const meteringEntities = defineEntities({
|
|
|
36
36
|
active: z.number(),
|
|
37
37
|
created_at: z.string(),
|
|
38
38
|
}),
|
|
39
|
+
// The shipped DDL is `key TEXT PRIMARY KEY` — this row has no `id`, so the
|
|
40
|
+
// fact has to be declared or `emitModel` cannot state it (#976).
|
|
41
|
+
primaryKey: ['key'],
|
|
39
42
|
},
|
|
40
43
|
'metering-entry': {
|
|
41
44
|
table: 'metering_entries',
|
|
@@ -51,6 +54,9 @@ export const meteringEntities = defineEntities({
|
|
|
51
54
|
created_by: z.string(),
|
|
52
55
|
created_at: z.string(),
|
|
53
56
|
}),
|
|
57
|
+
// `UNIQUE (meter_key, dedupe_key)` in the shipped DDL — the constraint the
|
|
58
|
+
// dedupe replay relies on, and the artifact of record should carry it (#976).
|
|
59
|
+
key: ['meter_key', 'dedupe_key'],
|
|
54
60
|
},
|
|
55
61
|
'metering-period': {
|
|
56
62
|
table: 'metering_periods',
|
package/dist/entities.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":"AAA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AQ,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC;AAClE,4BAA4B;AAC5B,MAAM,CAAC,MAAM,SAAS,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* engine-metering — composed **by call**, not by event.
|
|
3
|
+
*
|
|
4
|
+
* The in-scope functions are the surface: `configureMeter`, `recordUsage`,
|
|
5
|
+
* `closePeriod`, `usageTotal`, `listMeters`, `listEntries`, `listPeriods`,
|
|
6
|
+
* `periodLines`. A vertical imports those into its own operations and runs them
|
|
7
|
+
* inside its own transaction — ticket0 calls `recordUsage` in the same transaction
|
|
8
|
+
* that produced the usage, so the ledger row and the work it bills for commit or
|
|
9
|
+
* roll back together. (The builder reaches the same ledger through the registered
|
|
10
|
+
* operations instead; both are callers, and neither composes by event.)
|
|
11
|
+
*
|
|
12
|
+
* By call rather than by event is deliberate. Usage arrives from the vertical's own
|
|
13
|
+
* work, and an event round-trip would put the ledger write outside the transaction
|
|
14
|
+
* that knows whether the work happened.
|
|
15
|
+
*
|
|
16
|
+
* There are no consumers here. Nothing composes this engine by emitting at it.
|
|
17
|
+
*/
|
|
1
18
|
import { z } from 'zod';
|
|
2
19
|
import { type EntityRef } from '@substrat-run/contracts';
|
|
3
20
|
/**
|
|
@@ -9,7 +26,7 @@ import { type EntityRef } from '@substrat-run/contracts';
|
|
|
9
26
|
* Additive only, like every other engine surface: new reasons may appear, existing ones
|
|
10
27
|
* do not change spelling.
|
|
11
28
|
*/
|
|
12
|
-
export declare const METERING_CONFLICT_REASONS: readonly ['dedupe_mismatch', 'definition_frozen', 'meter_inactive', 'period_closed', 'period_overlap'];
|
|
29
|
+
export declare const METERING_CONFLICT_REASONS: readonly ['dedupe_mismatch', 'definition_frozen', 'meter_inactive', 'occurred_at_ahead', 'period_closed', 'period_overlap'];
|
|
13
30
|
export type MeteringConflictReason = (typeof METERING_CONFLICT_REASONS)[number];
|
|
14
31
|
import { type ModuleRegistration, type OperationContext } from '@substrat-run/kernel';
|
|
15
32
|
export { meteringEntities, meterRow, entryRow, periodRow } from './entities.js';
|
|
@@ -127,41 +144,59 @@ export declare const meteringMigrations: {
|
|
|
127
144
|
version: string;
|
|
128
145
|
sql: string;
|
|
129
146
|
}[];
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
147
|
+
declare const meterKind: z.ZodEnum<{
|
|
148
|
+
counter: "counter";
|
|
149
|
+
gauge: "gauge";
|
|
150
|
+
}>;
|
|
151
|
+
export type MeterKind = z.infer<typeof meterKind>;
|
|
152
|
+
/** The PUBLISHED shapes — what a composing vertical declares its `output` with. */
|
|
153
|
+
declare const meterShape: z.ZodObject<{
|
|
154
|
+
key: z.ZodString;
|
|
155
|
+
kind: z.ZodEnum<{
|
|
156
|
+
counter: "counter";
|
|
157
|
+
gauge: "gauge";
|
|
158
|
+
}>;
|
|
159
|
+
unit: z.ZodString;
|
|
160
|
+
description: z.ZodNullable<z.ZodString>;
|
|
161
|
+
active: z.ZodBoolean;
|
|
162
|
+
createdAt: z.ZodString;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
export type Meter = z.infer<typeof meterShape>;
|
|
165
|
+
declare const usageEntryShape: z.ZodObject<{
|
|
166
|
+
id: z.ZodString;
|
|
167
|
+
meterKey: z.ZodString;
|
|
168
|
+
qty: z.ZodString;
|
|
169
|
+
subject: z.ZodNullable<z.ZodObject<{
|
|
170
|
+
entityType: z.ZodString;
|
|
171
|
+
entityId: z.ZodString;
|
|
172
|
+
}, z.core.$strip>>;
|
|
173
|
+
occurredAt: z.ZodString;
|
|
174
|
+
dedupeKey: z.ZodString;
|
|
175
|
+
note: z.ZodNullable<z.ZodString>;
|
|
176
|
+
createdBy: z.ZodString;
|
|
177
|
+
createdAt: z.ZodString;
|
|
178
|
+
}, z.core.$strip>;
|
|
179
|
+
export type UsageEntry = z.infer<typeof usageEntryShape>;
|
|
180
|
+
declare const meteringPeriodShape: z.ZodObject<{
|
|
181
|
+
id: z.ZodString;
|
|
182
|
+
from: z.ZodString;
|
|
183
|
+
to: z.ZodString;
|
|
184
|
+
closedBy: z.ZodString;
|
|
185
|
+
closedAt: z.ZodString;
|
|
186
|
+
}, z.core.$strip>;
|
|
187
|
+
export type MeteringPeriod = z.infer<typeof meteringPeriodShape>;
|
|
157
188
|
/** One meter's frozen aggregate for a closed period. Unpriced, by design (D-E). */
|
|
158
|
-
|
|
159
|
-
meterKey:
|
|
160
|
-
kind:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
189
|
+
declare const periodLineShape: z.ZodObject<{
|
|
190
|
+
meterKey: z.ZodString;
|
|
191
|
+
kind: z.ZodEnum<{
|
|
192
|
+
counter: "counter";
|
|
193
|
+
gauge: "gauge";
|
|
194
|
+
}>;
|
|
195
|
+
unit: z.ZodString;
|
|
196
|
+
qty: z.ZodString;
|
|
197
|
+
entryCount: z.ZodNumber;
|
|
198
|
+
}, z.core.$strip>;
|
|
199
|
+
export type PeriodLine = z.infer<typeof periodLineShape>;
|
|
165
200
|
export declare const configureMeterInput: z.ZodObject<{
|
|
166
201
|
key: z.ZodString;
|
|
167
202
|
kind: z.ZodEnum<{
|
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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EAAE,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAM5C;AAED,wBAAgB,WAAW,CACzB,GAAG,EAAE,gBAAgB,EACrB,KAAK,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1E,UAAU,EAAE,CAqBd;AAED,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,gBAAgB,EACrB,QAAQ,EAAE,gBAAgB,GACzB;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,UAAU,EAAE,CAAA;CAAE,CAyDjD;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,gBAAgB,GAAG,cAAc,EAAE,CAInE;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,EAAE,CAY5F;AAkFD,eAAO,MAAM,cAAc,EAAE,kBAe5B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* engine-metering — composed **by call**, not by event.
|
|
3
|
+
*
|
|
4
|
+
* The in-scope functions are the surface: `configureMeter`, `recordUsage`,
|
|
5
|
+
* `closePeriod`, `usageTotal`, `listMeters`, `listEntries`, `listPeriods`,
|
|
6
|
+
* `periodLines`. A vertical imports those into its own operations and runs them
|
|
7
|
+
* inside its own transaction — ticket0 calls `recordUsage` in the same transaction
|
|
8
|
+
* that produced the usage, so the ledger row and the work it bills for commit or
|
|
9
|
+
* roll back together. (The builder reaches the same ledger through the registered
|
|
10
|
+
* operations instead; both are callers, and neither composes by event.)
|
|
11
|
+
*
|
|
12
|
+
* By call rather than by event is deliberate. Usage arrives from the vertical's own
|
|
13
|
+
* work, and an event round-trip would put the ledger write outside the transaction
|
|
14
|
+
* that knows whether the work happened.
|
|
15
|
+
*
|
|
16
|
+
* There are no consumers here. Nothing composes this engine by emitting at it.
|
|
17
|
+
*/
|
|
1
18
|
import { z } from 'zod';
|
|
2
|
-
import { addDecimal, compareDecimal, entityRef, moduleManifest, operationInputsOf, permissionKey, substratError, } from '@substrat-run/contracts';
|
|
19
|
+
import { addDecimal, compareDecimal, CURSOR_FIELD_SEPARATOR, entityRef, moduleManifest, operationInputsOf, pageOverFold, permissionKey, substratError, } from '@substrat-run/contracts';
|
|
3
20
|
/**
|
|
4
21
|
* The conflict reasons this engine raises — its own vocabulary, narrowing the platform's
|
|
5
22
|
* `conflict` code (#113). Exported so a vertical can branch on WHY a refusal happened
|
|
@@ -13,6 +30,7 @@ export const METERING_CONFLICT_REASONS = [
|
|
|
13
30
|
'dedupe_mismatch',
|
|
14
31
|
'definition_frozen',
|
|
15
32
|
'meter_inactive',
|
|
33
|
+
'occurred_at_ahead',
|
|
16
34
|
'period_closed',
|
|
17
35
|
'period_overlap',
|
|
18
36
|
];
|
|
@@ -39,7 +57,9 @@ export { meteringOperations, METERING_PERMISSIONS, meter, usageEntry, meteringPe
|
|
|
39
57
|
import { meteringOperations } from './operations.js';
|
|
40
58
|
// The value formats, shared with the declared surface above so a caller cannot be
|
|
41
59
|
// told a value is acceptable and then have the handler refuse it.
|
|
42
|
-
import { isoInstant, nonNegDecimal, signedDecimal } from './formats.js';
|
|
60
|
+
import { isoInstant, isoInstantIn, nonNegDecimal, signedDecimal } from './formats.js';
|
|
61
|
+
import { entryRow, meterRow, periodRow } from './entities.js';
|
|
62
|
+
import { columnsOf, returns } from './seam.js';
|
|
43
63
|
export const PERM = {
|
|
44
64
|
read: permissionKey.parse('metering:read'),
|
|
45
65
|
record: permissionKey.parse('metering:record'),
|
|
@@ -118,46 +138,169 @@ export const meteringMigrations = [
|
|
|
118
138
|
`,
|
|
119
139
|
},
|
|
120
140
|
];
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
141
|
+
// ---------------------------------------------------------------------------
|
|
142
|
+
// Schemas & shapes
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
// `isoInstant`, `nonNegDecimal` and `signedDecimal` are imported from `formats.ts`
|
|
145
|
+
// above — the same rules the declared inputs enforce, so a value the operation
|
|
146
|
+
// contract accepts is one these handlers can also parse.
|
|
147
|
+
const meterKind = z.enum(['counter', 'gauge']);
|
|
148
|
+
/**
|
|
149
|
+
* The STORED rows (#771/#970).
|
|
150
|
+
*
|
|
151
|
+
* `entities.ts` describes what the journal comparison checks against, so its
|
|
152
|
+
* quantities and instants are bare strings. Here they are narrowed to the formats
|
|
153
|
+
* this engine actually depends on — `signedDecimal` because a `qty` is folded
|
|
154
|
+
* into a billed line, `isoInstantIn` because every window in this engine is a
|
|
155
|
+
* string comparison over instants at one precision. Validating rather than
|
|
156
|
+
* transforming: normalising is the WRITE's decision (`isoInstant`), and a read
|
|
157
|
+
* that quietly rewrote a stored value would hide the drift it is here to catch.
|
|
158
|
+
*/
|
|
159
|
+
const meterRowShape = meterRow;
|
|
160
|
+
const entryRowShape = entryRow.extend({ qty: signedDecimal, occurred_at: isoInstantIn });
|
|
161
|
+
const periodRowShape = periodRow.extend({ from_at: isoInstantIn, to_at: isoInstantIn });
|
|
162
|
+
/**
|
|
163
|
+
* A period's frozen line, as stored. NOT in the entity registry, deliberately —
|
|
164
|
+
* a line has no identity outside the close that made it (`entities.ts`) — so its
|
|
165
|
+
* row shape is declared here, where the reads of it are.
|
|
166
|
+
*/
|
|
167
|
+
const periodLineRow = z.object({
|
|
168
|
+
id: z.string(),
|
|
169
|
+
period_id: z.string(),
|
|
170
|
+
meter_key: z.string(),
|
|
171
|
+
kind: meterKind,
|
|
172
|
+
unit: z.string(),
|
|
173
|
+
qty: signedDecimal,
|
|
174
|
+
entry_count: z.number(),
|
|
175
|
+
});
|
|
176
|
+
/** The PUBLISHED shapes — what a composing vertical declares its `output` with. */
|
|
177
|
+
const meterShape = z.object({
|
|
178
|
+
key: z.string(),
|
|
179
|
+
kind: meterKind,
|
|
180
|
+
unit: z.string(),
|
|
181
|
+
description: z.string().nullable(),
|
|
182
|
+
active: z.boolean(),
|
|
183
|
+
createdAt: z.string(),
|
|
128
184
|
});
|
|
129
|
-
const
|
|
130
|
-
id:
|
|
131
|
-
meterKey:
|
|
132
|
-
qty:
|
|
133
|
-
subject:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
createdBy: r.created_by,
|
|
140
|
-
createdAt: r.created_at,
|
|
185
|
+
const usageEntryShape = z.object({
|
|
186
|
+
id: z.string(),
|
|
187
|
+
meterKey: z.string(),
|
|
188
|
+
qty: signedDecimal,
|
|
189
|
+
subject: entityRef.nullable(),
|
|
190
|
+
occurredAt: isoInstantIn,
|
|
191
|
+
dedupeKey: z.string(),
|
|
192
|
+
note: z.string().nullable(),
|
|
193
|
+
createdBy: z.string(),
|
|
194
|
+
createdAt: z.string(),
|
|
141
195
|
});
|
|
142
|
-
const
|
|
143
|
-
id:
|
|
144
|
-
from:
|
|
145
|
-
to:
|
|
146
|
-
closedBy:
|
|
147
|
-
closedAt:
|
|
196
|
+
const meteringPeriodShape = z.object({
|
|
197
|
+
id: z.string(),
|
|
198
|
+
from: isoInstantIn,
|
|
199
|
+
to: isoInstantIn,
|
|
200
|
+
closedBy: z.string(),
|
|
201
|
+
closedAt: z.string(),
|
|
148
202
|
});
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
203
|
+
/** One meter's frozen aggregate for a closed period. Unpriced, by design (D-E). */
|
|
204
|
+
const periodLineShape = z.object({
|
|
205
|
+
meterKey: z.string(),
|
|
206
|
+
kind: meterKind,
|
|
207
|
+
unit: z.string(),
|
|
208
|
+
qty: signedDecimal,
|
|
209
|
+
entryCount: z.number(),
|
|
155
210
|
});
|
|
211
|
+
/** A window aggregate — the shape `usageTotal` publishes and a close freezes. */
|
|
212
|
+
const usageAggregate = z.object({ qty: signedDecimal, entryCount: z.number() });
|
|
213
|
+
/**
|
|
214
|
+
* The SELECT lists, derived from the row schemas (#771).
|
|
215
|
+
*
|
|
216
|
+
* Never `SELECT *`: that pins the shape a read returns to whatever the physical
|
|
217
|
+
* table currently holds, which is the same trust-TypeScript hole `returns` closes
|
|
218
|
+
* from the other side. A column dropped from the table is then a SQL error naming
|
|
219
|
+
* it; a column added to the table is simply never read.
|
|
220
|
+
*/
|
|
221
|
+
const METER_COLUMNS = columnsOf(meterRowShape);
|
|
222
|
+
const ENTRY_COLUMNS = columnsOf(entryRowShape);
|
|
223
|
+
const PERIOD_COLUMNS = columnsOf(periodRowShape);
|
|
224
|
+
const PERIOD_LINE_COLUMNS = columnsOf(periodLineRow);
|
|
225
|
+
/**
|
|
226
|
+
* What both aggregates read — a projection of `entryRowShape`, not a table.
|
|
227
|
+
*
|
|
228
|
+
* `occurred_at` is in it even though the fold never sums it, because it is what
|
|
229
|
+
* DECIDES the fold: the window is a string comparison, and an instant in a shape
|
|
230
|
+
* this engine never promised sorts into or out of it silently. Leaving it out
|
|
231
|
+
* would have parsed the summand and trusted the thing that chose which summands
|
|
232
|
+
* there were — and a close freezes that choice into an immutable line.
|
|
233
|
+
*/
|
|
234
|
+
const entryFold = entryRowShape.pick({ qty: true, occurred_at: true });
|
|
235
|
+
/** A stored row, parsed BEFORE anything is made of it. */
|
|
236
|
+
const storedMeter = (r) => returns(meterRowShape, `meter row ${r.key}`, r);
|
|
237
|
+
const storedEntry = (r) => returns(entryRowShape, `usage entry row ${r.id}`, r);
|
|
238
|
+
const storedPeriod = (r) => returns(periodRowShape, `period row ${r.id}`, r);
|
|
239
|
+
const storedLine = (r) => returns(periodLineRow, `period line row ${r.id}`, r);
|
|
240
|
+
/**
|
|
241
|
+
* A stored row, published (#771) — the projection AND the parse in one place,
|
|
242
|
+
* because every path out of this engine goes through one of these four.
|
|
243
|
+
*/
|
|
244
|
+
const toMeter = (raw) => {
|
|
245
|
+
const r = storedMeter(raw);
|
|
246
|
+
return returns(meterShape, `meter ${r.key}`, {
|
|
247
|
+
key: r.key,
|
|
248
|
+
kind: r.kind,
|
|
249
|
+
unit: r.unit,
|
|
250
|
+
description: r.description,
|
|
251
|
+
// Parsed BEFORE this normalisation: `active` is 0/1 and read with `=== 1`,
|
|
252
|
+
// so a retyped one would not throw — it would publish every meter as
|
|
253
|
+
// inactive and refuse every `recordUsage` against it as `meter_inactive`.
|
|
254
|
+
active: r.active === 1,
|
|
255
|
+
createdAt: r.created_at,
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
const toEntry = (raw) => {
|
|
259
|
+
const r = storedEntry(raw);
|
|
260
|
+
return returns(usageEntryShape, `usage entry ${r.id}`, {
|
|
261
|
+
id: r.id,
|
|
262
|
+
meterKey: r.meter_key,
|
|
263
|
+
qty: r.qty,
|
|
264
|
+
subject: r.subject_type !== null && r.subject_id !== null
|
|
265
|
+
? { entityType: r.subject_type, entityId: r.subject_id }
|
|
266
|
+
: null,
|
|
267
|
+
occurredAt: r.occurred_at,
|
|
268
|
+
dedupeKey: r.dedupe_key,
|
|
269
|
+
note: r.note,
|
|
270
|
+
createdBy: r.created_by,
|
|
271
|
+
createdAt: r.created_at,
|
|
272
|
+
});
|
|
273
|
+
};
|
|
274
|
+
const toPeriod = (raw) => {
|
|
275
|
+
const r = storedPeriod(raw);
|
|
276
|
+
return returns(meteringPeriodShape, `metering period ${r.id}`, {
|
|
277
|
+
id: r.id,
|
|
278
|
+
from: r.from_at,
|
|
279
|
+
to: r.to_at,
|
|
280
|
+
closedBy: r.closed_by,
|
|
281
|
+
closedAt: r.closed_at,
|
|
282
|
+
});
|
|
283
|
+
};
|
|
284
|
+
const toLine = (raw) => {
|
|
285
|
+
const r = storedLine(raw);
|
|
286
|
+
return returns(periodLineShape, `period line ${r.id}`, {
|
|
287
|
+
meterKey: r.meter_key,
|
|
288
|
+
kind: r.kind,
|
|
289
|
+
unit: r.unit,
|
|
290
|
+
qty: r.qty,
|
|
291
|
+
entryCount: r.entry_count,
|
|
292
|
+
});
|
|
293
|
+
};
|
|
156
294
|
function getMeterRow(ctx, key) {
|
|
157
|
-
const row = ctx.sql.query(
|
|
295
|
+
const row = ctx.sql.query(`SELECT ${METER_COLUMNS} FROM metering_meters WHERE key = ?`, [
|
|
296
|
+
key,
|
|
297
|
+
])[0];
|
|
158
298
|
if (!row)
|
|
159
299
|
throw substratError('not_found', `meter not found: ${key}`);
|
|
160
|
-
|
|
300
|
+
// Parsed here rather than at each caller: `kind` decides counter-versus-gauge
|
|
301
|
+
// aggregation and `active` decides whether usage may be recorded at all, so
|
|
302
|
+
// every path through this engine reads a meter row it has already checked.
|
|
303
|
+
return storedMeter(row);
|
|
161
304
|
}
|
|
162
305
|
/** The latest closed `to` — nothing may be recorded behind it (D-D). */
|
|
163
306
|
function closeHorizon(ctx) {
|
|
@@ -172,9 +315,14 @@ function closeHorizon(ctx) {
|
|
|
172
315
|
* sample forward with entryCount 0 — a level persists between observations.
|
|
173
316
|
*/
|
|
174
317
|
function aggregateMeter(ctx, meter, from, to) {
|
|
175
|
-
|
|
318
|
+
// Parsed on the way into the fold, the way absence parses a ledger delta: a
|
|
319
|
+
// summand that drifted crosses as a NUMBER nobody questions, and this one is
|
|
320
|
+
// frozen into a period line and billed.
|
|
321
|
+
const rows = ctx.sql
|
|
322
|
+
.query(`SELECT ${columnsOf(entryFold)} FROM metering_entries
|
|
176
323
|
WHERE meter_key = ? AND occurred_at >= ? AND occurred_at < ?
|
|
177
|
-
ORDER BY occurred_at, id`, [meter.key, from, to])
|
|
324
|
+
ORDER BY occurred_at, id`, [meter.key, from, to])
|
|
325
|
+
.map((r) => returns(entryFold, `usage entry on meter '${meter.key}'`, r));
|
|
178
326
|
if (meter.kind === 'counter') {
|
|
179
327
|
if (rows.length === 0)
|
|
180
328
|
return null;
|
|
@@ -184,10 +332,17 @@ function aggregateMeter(ctx, meter, from, to) {
|
|
|
184
332
|
const max = rows.reduce((m, r) => (compareDecimal(r.qty, m) > 0 ? r.qty : m), rows[0].qty);
|
|
185
333
|
return { qty: max, entryCount: rows.length };
|
|
186
334
|
}
|
|
187
|
-
const carried = ctx.sql.query(`SELECT
|
|
335
|
+
const carried = ctx.sql.query(`SELECT ${columnsOf(entryFold)} FROM metering_entries
|
|
188
336
|
WHERE meter_key = ? AND occurred_at < ?
|
|
189
337
|
ORDER BY occurred_at DESC, id DESC LIMIT 1`, [meter.key, from])[0];
|
|
190
|
-
|
|
338
|
+
// The carry-forward is chosen by `occurred_at` too — it is the LATEST earlier
|
|
339
|
+
// sample — so the same parse decides it.
|
|
340
|
+
return carried
|
|
341
|
+
? {
|
|
342
|
+
qty: returns(entryFold, `carried entry on meter '${meter.key}'`, carried).qty,
|
|
343
|
+
entryCount: 0,
|
|
344
|
+
}
|
|
345
|
+
: null;
|
|
191
346
|
}
|
|
192
347
|
// ---------------------------------------------------------------------------
|
|
193
348
|
// In-scope functions (K-16) — composable from vertical operations, same
|
|
@@ -208,9 +363,11 @@ export const configureMeterInput = z.object({
|
|
|
208
363
|
*/
|
|
209
364
|
export function configureMeter(ctx, rawInput) {
|
|
210
365
|
const input = configureMeterInput.parse(rawInput);
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
366
|
+
const stored = ctx.sql.query(`SELECT ${METER_COLUMNS} FROM metering_meters WHERE key = ?`, [input.key])[0];
|
|
367
|
+
// `kind` and `unit` are FROZEN, and this is the read that judges them — a
|
|
368
|
+
// drifted one would either wave through a change the invariant forbids or
|
|
369
|
+
// refuse a legitimate one with a message naming a value nothing declared.
|
|
370
|
+
const existing = stored ? storedMeter(stored) : undefined;
|
|
214
371
|
if (existing) {
|
|
215
372
|
if (existing.kind !== input.kind || existing.unit !== input.unit) {
|
|
216
373
|
throw conflict('definition_frozen', `meter '${input.key}' is ${existing.kind}/${existing.unit} — kind and unit are frozen after creation; a new unit is a new meter key`);
|
|
@@ -243,15 +400,43 @@ export function configureMeter(ctx, rawInput) {
|
|
|
243
400
|
return toMeter(row);
|
|
244
401
|
}
|
|
245
402
|
export function listMeters(ctx) {
|
|
246
|
-
return ctx.sql
|
|
403
|
+
return ctx.sql
|
|
404
|
+
.query(`SELECT ${METER_COLUMNS} FROM metering_meters ORDER BY key`)
|
|
405
|
+
.map(toMeter);
|
|
247
406
|
}
|
|
407
|
+
/**
|
|
408
|
+
* How far AHEAD of the operation's own instant an `occurredAt` may sit (#1066).
|
|
409
|
+
*
|
|
410
|
+
* The window is bounded on BOTH sides, and the two bounds are not the same kind
|
|
411
|
+
* of thing. Behind, the bound is the close horizon: the period covering that
|
|
412
|
+
* instant is frozen, so an entry landing there would change a line already
|
|
413
|
+
* billed. Ahead, the bound is this one, and it exists because `closePeriod`
|
|
414
|
+
* advances the horizon monotonically forward — an entry post-dated past every
|
|
415
|
+
* period anyone will realistically close is aggregated into none of them, and the
|
|
416
|
+
* usage it represents leaves the billing stream with no error anywhere. Nothing
|
|
417
|
+
* ever raises it again: `dedupeKey` does not help (it is per-`(meter, key)`, and
|
|
418
|
+
* this is a first write), and the close journal has no "sweep the stragglers"
|
|
419
|
+
* pass by design, because a closed period must stay reproducible from its own
|
|
420
|
+
* entries forever.
|
|
421
|
+
*
|
|
422
|
+
* So it is a SKEW tolerance, not a feature: a producer whose clock runs a little
|
|
423
|
+
* fast still records, and one that would park a year of usage past the horizon
|
|
424
|
+
* does not. Deliberately small — a caller with a legitimately future observation
|
|
425
|
+
* does not have one, it has a plan.
|
|
426
|
+
*/
|
|
427
|
+
const MAX_FUTURE_SKEW_MS = 5 * 60_000;
|
|
248
428
|
export const recordUsageInput = z.object({
|
|
249
429
|
meter: z.string().min(1),
|
|
250
430
|
/** Counters take signed deltas (a correction is a compensating entry, never
|
|
251
431
|
* an edit); gauges take non-negative level samples — enforced per kind. */
|
|
252
432
|
qty: signedDecimal,
|
|
253
433
|
subject: entityRef.optional(),
|
|
254
|
-
/**
|
|
434
|
+
/**
|
|
435
|
+
* Defaults to now, and is bounded on both sides. Behind: never past the close
|
|
436
|
+
* horizon (D-D), whose period is frozen. Ahead: never more than
|
|
437
|
+
* `MAX_FUTURE_SKEW_MS` past the operation's own instant, since the horizon only
|
|
438
|
+
* ever moves forward and an entry beyond it is aggregated by no close (#1066).
|
|
439
|
+
*/
|
|
255
440
|
occurredAt: isoInstant.optional(),
|
|
256
441
|
/** Caller-supplied idempotency key, unique per meter (D-C) — e.g. a turn id. */
|
|
257
442
|
dedupeKey: z.string().min(1),
|
|
@@ -270,18 +455,31 @@ export function recordUsage(ctx, rawInput) {
|
|
|
270
455
|
throw conflict('meter_inactive', `meter '${meter.key}' is inactive`);
|
|
271
456
|
if (meter.kind === 'gauge')
|
|
272
457
|
nonNegDecimal.parse(input.qty);
|
|
273
|
-
const
|
|
458
|
+
const priorRow = ctx.sql.query(`SELECT ${ENTRY_COLUMNS} FROM metering_entries WHERE meter_key = ? AND dedupe_key = ?`, [meter.key, input.dedupeKey])[0];
|
|
459
|
+
// Parsed before the dedupe comparison: `existing.qty` is compared as a decimal
|
|
460
|
+
// to decide replay-versus-upstream-bug, so a drifted one would answer the
|
|
461
|
+
// wrong question — a silent second bill, or a `dedupe_mismatch` naming a
|
|
462
|
+
// quantity that is not one.
|
|
463
|
+
const existing = priorRow ? storedEntry(priorRow) : undefined;
|
|
274
464
|
if (existing) {
|
|
275
465
|
if (compareDecimal(existing.qty, input.qty) !== 0) {
|
|
276
466
|
throw conflict('dedupe_mismatch', `dedupe key '${input.dedupeKey}' on meter '${meter.key}' was recorded with qty ${existing.qty}, now ${input.qty} — a dedupe key must name one observation`);
|
|
277
467
|
}
|
|
278
468
|
return { entry: toEntry(existing), deduped: true };
|
|
279
469
|
}
|
|
280
|
-
const
|
|
470
|
+
const now = ctx.now();
|
|
471
|
+
const occurredAt = input.occurredAt ?? now;
|
|
281
472
|
const horizon = closeHorizon(ctx);
|
|
282
473
|
if (horizon !== null && occurredAt < horizon) {
|
|
283
474
|
throw conflict('period_closed', `occurred_at ${occurredAt} is behind the close horizon ${horizon} — the period covering it is closed; record late usage at observation time`);
|
|
284
475
|
}
|
|
476
|
+
// The forward half of the same window (#1066). `new Date(ms)` reads a value we
|
|
477
|
+
// just derived from `ctx.now()`, not the wall clock — R6 bans originating an
|
|
478
|
+
// instant, and this originates none.
|
|
479
|
+
const ceiling = new Date(Date.parse(now) + MAX_FUTURE_SKEW_MS).toISOString();
|
|
480
|
+
if (occurredAt > ceiling) {
|
|
481
|
+
throw conflict('occurred_at_ahead', `occurred_at ${occurredAt} is ahead of ${now} by more than the ${MAX_FUTURE_SKEW_MS / 60_000}-minute skew tolerance — the close horizon only moves forward, so an entry past it is aggregated by no period; record usage at observation time`);
|
|
482
|
+
}
|
|
285
483
|
const id = ulid();
|
|
286
484
|
ctx.sql.exec(`INSERT INTO metering_entries
|
|
287
485
|
(id, meter_key, qty, subject_type, subject_id, occurred_at, dedupe_key, note, created_by, created_at)
|
|
@@ -295,9 +493,9 @@ export function recordUsage(ctx, rawInput) {
|
|
|
295
493
|
input.dedupeKey,
|
|
296
494
|
input.note ?? null,
|
|
297
495
|
ctx.principal,
|
|
298
|
-
|
|
496
|
+
now,
|
|
299
497
|
]);
|
|
300
|
-
const entry = toEntry(ctx.sql.query(
|
|
498
|
+
const entry = toEntry(ctx.sql.query(`SELECT ${ENTRY_COLUMNS} FROM metering_entries WHERE id = ?`, [id])[0]);
|
|
301
499
|
ctx.emit({
|
|
302
500
|
type: 'metering.usage-recorded',
|
|
303
501
|
schemaVersion: 1,
|
|
@@ -326,7 +524,8 @@ export function usageTotal(ctx, input) {
|
|
|
326
524
|
const to = isoInstant.parse(input.to);
|
|
327
525
|
if (to <= from)
|
|
328
526
|
throw substratError('validation_failed', `to ${to} must be after from ${from}`);
|
|
329
|
-
|
|
527
|
+
const agg = aggregateMeter(ctx, getMeterRow(ctx, input.meter), from, to);
|
|
528
|
+
return agg && returns(usageAggregate, `usage total for '${input.meter}'`, agg);
|
|
330
529
|
}
|
|
331
530
|
export function listEntries(ctx, input) {
|
|
332
531
|
const where = [];
|
|
@@ -347,7 +546,7 @@ export function listEntries(ctx, input) {
|
|
|
347
546
|
where.push('occurred_at < ?');
|
|
348
547
|
params.push(isoInstant.parse(input.to));
|
|
349
548
|
}
|
|
350
|
-
const sql = `SELECT
|
|
549
|
+
const sql = `SELECT ${ENTRY_COLUMNS} FROM metering_entries${where.length ? ` WHERE ${where.join(' AND ')}` : ''} ORDER BY occurred_at, id`;
|
|
351
550
|
return ctx.sql.query(sql, params).map(toEntry);
|
|
352
551
|
}
|
|
353
552
|
export const closePeriodInput = z.object({
|
|
@@ -375,19 +574,20 @@ export function closePeriod(ctx, rawInput) {
|
|
|
375
574
|
const now = ctx.now();
|
|
376
575
|
ctx.sql.exec(`INSERT INTO metering_periods (id, from_at, to_at, closed_by, closed_at) VALUES (?, ?, ?, ?, ?)`, [id, input.from, input.to, ctx.principal, now]);
|
|
377
576
|
const lines = [];
|
|
378
|
-
for (const
|
|
577
|
+
for (const raw of ctx.sql.query(`SELECT ${METER_COLUMNS} FROM metering_meters ORDER BY key`)) {
|
|
578
|
+
const meter = storedMeter(raw);
|
|
379
579
|
const agg = aggregateMeter(ctx, meter, input.from, input.to);
|
|
380
580
|
if (!agg)
|
|
381
581
|
continue;
|
|
382
582
|
ctx.sql.exec(`INSERT INTO metering_period_lines (id, period_id, meter_key, kind, unit, qty, entry_count)
|
|
383
583
|
VALUES (?, ?, ?, ?, ?, ?, ?)`, [ulid(), id, meter.key, meter.kind, meter.unit, agg.qty, agg.entryCount]);
|
|
384
|
-
lines.push({
|
|
584
|
+
lines.push(returns(periodLineShape, `period line for '${meter.key}'`, {
|
|
385
585
|
meterKey: meter.key,
|
|
386
586
|
kind: meter.kind,
|
|
387
587
|
unit: meter.unit,
|
|
388
588
|
qty: agg.qty,
|
|
389
589
|
entryCount: agg.entryCount,
|
|
390
|
-
});
|
|
590
|
+
}));
|
|
391
591
|
}
|
|
392
592
|
ctx.emit({
|
|
393
593
|
type: 'metering.period-closed',
|
|
@@ -397,23 +597,27 @@ export function closePeriod(ctx, rawInput) {
|
|
|
397
597
|
payload: { periodId: id, from: input.from, to: input.to, lines },
|
|
398
598
|
});
|
|
399
599
|
return {
|
|
400
|
-
period:
|
|
600
|
+
period: returns(meteringPeriodShape, `metering period ${id}`, {
|
|
601
|
+
id,
|
|
602
|
+
from: input.from,
|
|
603
|
+
to: input.to,
|
|
604
|
+
closedBy: String(ctx.principal),
|
|
605
|
+
closedAt: now,
|
|
606
|
+
}),
|
|
401
607
|
lines,
|
|
402
608
|
};
|
|
403
609
|
}
|
|
404
610
|
export function listPeriods(ctx) {
|
|
405
611
|
return ctx.sql
|
|
406
|
-
.query(
|
|
612
|
+
.query(`SELECT ${PERIOD_COLUMNS} FROM metering_periods ORDER BY from_at, id`)
|
|
407
613
|
.map(toPeriod);
|
|
408
614
|
}
|
|
409
615
|
export function periodLines(ctx, input) {
|
|
410
|
-
const period = ctx.sql.query(
|
|
411
|
-
input.periodId,
|
|
412
|
-
])[0];
|
|
616
|
+
const period = ctx.sql.query(`SELECT ${PERIOD_COLUMNS} FROM metering_periods WHERE id = ?`, [input.periodId])[0];
|
|
413
617
|
if (!period)
|
|
414
618
|
throw substratError('not_found', `metering period not found: ${input.periodId}`);
|
|
415
619
|
return ctx.sql
|
|
416
|
-
.query(
|
|
620
|
+
.query(`SELECT ${PERIOD_LINE_COLUMNS} FROM metering_period_lines WHERE period_id = ? ORDER BY meter_key`, [input.periodId])
|
|
417
621
|
.map(toLine);
|
|
418
622
|
}
|
|
419
623
|
// ---------------------------------------------------------------------------
|
|
@@ -423,9 +627,14 @@ const configureMeterOp = async (ctx, input) => {
|
|
|
423
627
|
assertAllowed(await ctx.check(PERM.configure));
|
|
424
628
|
return configureMeter(ctx, input);
|
|
425
629
|
};
|
|
426
|
-
|
|
630
|
+
// Paged (#959). The in-scope `listMeters`/`listEntries`/`listPeriods`/`periodLines`
|
|
631
|
+
// above stay unpaged: a vertical composing one inside its own transaction is
|
|
632
|
+
// folding it — pricing a period's lines, summing a window — not rendering a table.
|
|
633
|
+
// The same split `listOrders` kept in #811.
|
|
634
|
+
const listMetersOp = async (ctx, page) => {
|
|
427
635
|
assertAllowed(await ctx.check(PERM.read));
|
|
428
|
-
|
|
636
|
+
// `key` is the primary key, so it is both the order and a unique cursor.
|
|
637
|
+
return pageOverFold(listMeters(ctx), page ?? {}, (m) => m.key);
|
|
429
638
|
};
|
|
430
639
|
const recordOp = async (ctx, input) => {
|
|
431
640
|
assertAllowed(await ctx.check(PERM.record));
|
|
@@ -437,19 +646,26 @@ const totalOp = async (ctx, input) => {
|
|
|
437
646
|
};
|
|
438
647
|
const listEntriesOp = async (ctx, input) => {
|
|
439
648
|
assertAllowed(await ctx.check(PERM.read));
|
|
440
|
-
|
|
649
|
+
// `occurredAt` is the order and is NOT unique — it is caller-supplied, so two
|
|
650
|
+
// observations can share an instant. The cursor is the (occurredAt, id) pair the
|
|
651
|
+
// SQL already orders by, joined by `CURSOR_FIELD_SEPARATOR`.
|
|
652
|
+
return pageOverFold(listEntries(ctx, input), input ?? {}, (e) => `${e.occurredAt}${CURSOR_FIELD_SEPARATOR}${e.id}`);
|
|
441
653
|
};
|
|
442
654
|
const closePeriodOp = async (ctx, input) => {
|
|
443
655
|
assertAllowed(await ctx.check(PERM.close));
|
|
444
656
|
return closePeriod(ctx, input);
|
|
445
657
|
};
|
|
446
|
-
const listPeriodsOp = async (ctx) => {
|
|
658
|
+
const listPeriodsOp = async (ctx, page) => {
|
|
447
659
|
assertAllowed(await ctx.check(PERM.read));
|
|
448
|
-
|
|
660
|
+
// Oldest first. The SQL orders by (from_at, id), so the cursor is that pair —
|
|
661
|
+
// closes do not overlap, but the cursor matches the ORDER BY rather than
|
|
662
|
+
// relying on that.
|
|
663
|
+
return pageOverFold(listPeriods(ctx), page ?? {}, (p) => `${p.from}${CURSOR_FIELD_SEPARATOR}${p.id}`);
|
|
449
664
|
};
|
|
450
665
|
const periodLinesOp = async (ctx, input) => {
|
|
451
666
|
assertAllowed(await ctx.check(PERM.read));
|
|
452
|
-
|
|
667
|
+
// One line per meter per period, so `meterKey` is unique within the period.
|
|
668
|
+
return pageOverFold(periodLines(ctx, input), input, (l) => l.meterKey);
|
|
453
669
|
};
|
|
454
670
|
export const meteringModule = {
|
|
455
671
|
manifest: meteringManifest,
|
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,cAAc,EACd,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,aAAa,EAEb,aAAa,GACd,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,iBAAiB;IACjB,mBAAmB;IACnB,gBAAgB;IAChB,eAAe;IACf,gBAAgB;CACR,CAAC;AAGX,gGAAgG;AAChG,MAAM,QAAQ,GAAG,CAAC,MAA8B,EAAE,OAAe,EAAE,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAErH,OAAO,EACL,aAAa,EACb,IAAI,GAIL,MAAM,sBAAsB,CAAC;AAE9B,+EAA+E;AAC/E,gEAAgE;AAChE,8EAA8E;AAC9E,2EAA2E;AAC3E,gFAAgF;AAChF,6EAA6E;AAC7E,yCAAyC;AACzC,EAAE;AACF,4EAA4E;AAC5E,gFAAgF;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
*
|
|
4
|
+
* `pnpm lint:model --check` re-emits this into `engines/metering/model.json`, so a
|
|
5
|
+
* changed table, a renamed field or a moved parent edge has to appear in a PR
|
|
6
|
+
* diff. No `lifecycles` option: this engine declares no state machine, and an
|
|
7
|
+
* empty one would claim otherwise.
|
|
8
|
+
*
|
|
9
|
+
* Imported by nothing, so the direction stays acyclic.
|
|
10
|
+
*/
|
|
11
|
+
export declare const meteringModel: import("@substrat-run/contracts").EmittedModel;
|
|
12
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,gDAA8B,CAAC"}
|
package/dist/model.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { emitModel } from '@substrat-run/contracts';
|
|
2
|
+
import { meteringEntities } from './entities.js';
|
|
3
|
+
/**
|
|
4
|
+
* The artifact of record for this engine (#697/#844, #976).
|
|
5
|
+
*
|
|
6
|
+
* `pnpm lint:model --check` re-emits this into `engines/metering/model.json`, so a
|
|
7
|
+
* changed table, a renamed field or a moved parent edge has to appear in a PR
|
|
8
|
+
* diff. No `lifecycles` option: this engine declares no state machine, and an
|
|
9
|
+
* empty one would claim otherwise.
|
|
10
|
+
*
|
|
11
|
+
* Imported by nothing, so the direction stays acyclic.
|
|
12
|
+
*/
|
|
13
|
+
export const meteringModel = emitModel(meteringEntities);
|
|
14
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAAC"}
|
package/dist/operations.d.ts
CHANGED
|
@@ -124,6 +124,9 @@ export declare const meteringOperations: {
|
|
|
124
124
|
active: z.ZodBoolean;
|
|
125
125
|
createdAt: z.ZodString;
|
|
126
126
|
}, z.core.$strip>;
|
|
127
|
+
readonly paged: {
|
|
128
|
+
readonly sortKey: "key";
|
|
129
|
+
};
|
|
127
130
|
};
|
|
128
131
|
readonly 'metering/record': {
|
|
129
132
|
readonly summary: "Record one usage observation — idempotent per (meter, dedupeKey)";
|
|
@@ -197,6 +200,9 @@ export declare const meteringOperations: {
|
|
|
197
200
|
createdBy: z.ZodString;
|
|
198
201
|
createdAt: z.ZodString;
|
|
199
202
|
}, z.core.$strip>;
|
|
203
|
+
readonly paged: {
|
|
204
|
+
readonly sortKey: "occurredAt";
|
|
205
|
+
};
|
|
200
206
|
};
|
|
201
207
|
readonly 'metering/close-period': {
|
|
202
208
|
readonly summary: "Freeze [from, to) — aggregate every meter and advance the horizon";
|
|
@@ -235,6 +241,9 @@ export declare const meteringOperations: {
|
|
|
235
241
|
closedBy: z.ZodString;
|
|
236
242
|
closedAt: z.ZodString;
|
|
237
243
|
}, z.core.$strip>;
|
|
244
|
+
readonly paged: {
|
|
245
|
+
readonly sortKey: "from";
|
|
246
|
+
};
|
|
238
247
|
};
|
|
239
248
|
readonly 'metering/period-lines': {
|
|
240
249
|
readonly summary: "One period's frozen lines";
|
|
@@ -252,6 +261,9 @@ export declare const meteringOperations: {
|
|
|
252
261
|
qty: z.ZodString;
|
|
253
262
|
entryCount: z.ZodNumber;
|
|
254
263
|
}, z.core.$strip>;
|
|
264
|
+
readonly paged: {
|
|
265
|
+
readonly sortKey: "meterKey";
|
|
266
|
+
};
|
|
255
267
|
};
|
|
256
268
|
};
|
|
257
269
|
//# sourceMappingURL=operations.d.ts.map
|
package/dist/operations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoH7B,CAAC"}
|
package/dist/operations.js
CHANGED
|
@@ -116,6 +116,11 @@ export const meteringOperations = defineOperations(meteringEntities, METERING_PE
|
|
|
116
116
|
summary: 'Every configured meter, by key',
|
|
117
117
|
permission: 'metering:read',
|
|
118
118
|
output: meter,
|
|
119
|
+
// Handler-composed (#959): what is answered is the PROJECTION of the row
|
|
120
|
+
// (`active` as a boolean, `createdAt` renamed), not the stored row, so
|
|
121
|
+
// `paged.over` has nothing to walk. `key` is the primary key — the order and
|
|
122
|
+
// a unique cursor at once.
|
|
123
|
+
paged: { sortKey: 'key' },
|
|
119
124
|
},
|
|
120
125
|
'metering/record': {
|
|
121
126
|
summary: 'Record one usage observation — idempotent per (meter, dedupeKey)',
|
|
@@ -132,6 +137,16 @@ export const meteringOperations = defineOperations(meteringEntities, METERING_PE
|
|
|
132
137
|
*/
|
|
133
138
|
qty: signedDecimal,
|
|
134
139
|
subject: entityRef.optional(),
|
|
140
|
+
/**
|
|
141
|
+
* Defaults to the operation's own instant, and the handler bounds it on
|
|
142
|
+
* BOTH sides (#1066): never behind the close horizon, whose period is
|
|
143
|
+
* frozen, and never more than a small skew tolerance ahead of `ctx.now()`,
|
|
144
|
+
* because the horizon only moves forward and an entry past it is
|
|
145
|
+
* aggregated by no close — usage that leaves the billing stream silently.
|
|
146
|
+
* Like the per-kind `qty` rule above, that is a fact about stored state
|
|
147
|
+
* rather than about the string, so it lives in the handler and is stated
|
|
148
|
+
* here rather than claimed by the schema.
|
|
149
|
+
*/
|
|
135
150
|
occurredAt: instantIn.optional(),
|
|
136
151
|
dedupeKey: z.string().min(1),
|
|
137
152
|
note: z.string().optional(),
|
|
@@ -159,6 +174,13 @@ export const meteringOperations = defineOperations(meteringEntities, METERING_PE
|
|
|
159
174
|
}),
|
|
160
175
|
inputOptional: true,
|
|
161
176
|
output: usageEntry,
|
|
177
|
+
// The ledger is the read most obviously unbounded — one row per observation,
|
|
178
|
+
// for as long as the meter has run. Handler-composed: the entry is a
|
|
179
|
+
// projection (two columns folded into one `subject` ref) and the `WHERE` is
|
|
180
|
+
// built from four optional filters. `occurredAt` is caller-supplied and NOT
|
|
181
|
+
// unique, so the cursor is the (occurredAt, id) pair the SQL already orders
|
|
182
|
+
// by — see the handler.
|
|
183
|
+
paged: { sortKey: 'occurredAt' },
|
|
162
184
|
},
|
|
163
185
|
'metering/close-period': {
|
|
164
186
|
summary: 'Freeze [from, to) — aggregate every meter and advance the horizon',
|
|
@@ -170,12 +192,21 @@ export const meteringOperations = defineOperations(meteringEntities, METERING_PE
|
|
|
170
192
|
summary: 'Closed periods, oldest first',
|
|
171
193
|
permission: 'metering:read',
|
|
172
194
|
output: meteringPeriod,
|
|
195
|
+
// Handler-composed: `from`/`to` are the projection of `from_at`/`to_at`.
|
|
196
|
+
// Closes are non-overlapping so `from` is in practice unique, but the SQL
|
|
197
|
+
// orders by (from_at, id) and the cursor matches it rather than relying on
|
|
198
|
+
// that.
|
|
199
|
+
paged: { sortKey: 'from' },
|
|
173
200
|
},
|
|
174
201
|
'metering/period-lines': {
|
|
175
202
|
summary: "One period's frozen lines",
|
|
176
203
|
permission: 'metering:read',
|
|
177
204
|
input: z.object({ periodId: z.string().min(1) }),
|
|
178
205
|
output: periodLine,
|
|
206
|
+
// Handler-composed: the line is a projection, and the read 404s on an unknown
|
|
207
|
+
// period before it lists anything. One line per meter per period, so
|
|
208
|
+
// `meterKey` is unique within the period and is the order.
|
|
209
|
+
paged: { sortKey: 'meterKey' },
|
|
179
210
|
},
|
|
180
211
|
});
|
|
181
212
|
//# sourceMappingURL=operations.js.map
|
package/dist/operations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAA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E,cAAc;QACtB,yEAAyE;QACzE,0EAA0E;QAC1E,2EAA2E;QAC3E,QAAQ;QACR,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;KAC3B;IAED,uBAAuB,EAAE;QACvB,OAAO,EAAE,2BAA2B;QACpC,UAAU,EAAE,eAAe;QAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAChD,MAAM,EAAE,UAAU;QAClB,8EAA8E;QAC9E,qEAAqE;QACrE,2DAA2D;QAC3D,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;KAC/B;CACF,CAAC,CAAC"}
|
package/dist/seam.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** How this engine names itself in a seam failure. */
|
|
2
|
+
export declare const columnsOf: (schema: {
|
|
3
|
+
readonly shape: Readonly<Record<string, unknown>>;
|
|
4
|
+
}) => string, returns: <T>(schema: import("zod").ZodType<T>, surface: string, value: unknown) => T;
|
|
5
|
+
//# sourceMappingURL=seam.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seam.d.ts","sourceRoot":"","sources":["../src/seam.ts"],"names":[],"mappings":"AAkBA,sDAAsD;AACtD,eAAO,MAAQ,SAAS;;cAAE,OAAO,6EAAkC,CAAC"}
|
package/dist/seam.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The engine seam (#771) for engine-metering — the NAME, and nothing else.
|
|
3
|
+
*
|
|
4
|
+
* `returns(schema, surface, value)` and `columnsOf(schema)` live in
|
|
5
|
+
* `@substrat-run/contracts` (#970), where the prose explaining what they are for
|
|
6
|
+
* lives with them; an engine supplies only the name it answers under.
|
|
7
|
+
*
|
|
8
|
+
* What is specific to this engine is that almost everything it publishes is a
|
|
9
|
+
* number a bill is computed from. `qty` is summed by `aggregateMeter` into a
|
|
10
|
+
* period line, and a line is what the vertical prices and hands to invoicing — so
|
|
11
|
+
* a drifted summand is not a rendering bug, it is a wrong invoice with no throw
|
|
12
|
+
* anywhere. `occurred_at` is the other one: every window here is a string
|
|
13
|
+
* comparison over ISO instants, so an instant in a shape the engine never
|
|
14
|
+
* promised sorts into or out of a window silently, and the close that freezes it
|
|
15
|
+
* is immutable afterwards.
|
|
16
|
+
*/
|
|
17
|
+
import { engineSeam } from '@substrat-run/contracts';
|
|
18
|
+
/** How this engine names itself in a seam failure. */
|
|
19
|
+
export const { columnsOf, returns } = engineSeam('engine-metering');
|
|
20
|
+
//# sourceMappingURL=seam.js.map
|
package/dist/seam.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seam.js","sourceRoot":"","sources":["../src/seam.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,sDAAsD;AACtD,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@substrat-run/engine-metering",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Substrat engine: billable usage — an append-only, idempotent meter ledger (counters and gauges) whose closed periods are frozen billing evidence",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@substrat-run/contracts": "^0.
|
|
29
|
-
"@substrat-run/kernel": "^0.
|
|
28
|
+
"@substrat-run/contracts": "^0.95.0",
|
|
29
|
+
"@substrat-run/kernel": "^0.95.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"typescript": "^7.0.0",
|
|
33
33
|
"vitest": "^3.2.7",
|
|
34
34
|
"zod": "^4.4.3",
|
|
35
|
-
"@substrat-run/
|
|
36
|
-
"@substrat-run/
|
|
35
|
+
"@substrat-run/contract-tests": "^0.95.0",
|
|
36
|
+
"@substrat-run/engine-test-kit": "^0.3.22"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"zod": "^4.4.0"
|