@drawbridge/drawbridge-utils 0.0.83 → 0.0.85
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/billing.cjs +3 -0
- package/dist/billing.d.cts +11 -0
- package/dist/billing.d.ts +11 -0
- package/dist/billing.js +3 -0
- package/package.json +4 -4
package/dist/billing.cjs
CHANGED
|
@@ -435,6 +435,7 @@ var action = {
|
|
|
435
435
|
valid.push({ type, amount: amount2, key, meta, traceId });
|
|
436
436
|
}
|
|
437
437
|
if (valid.length === 0) return;
|
|
438
|
+
const date = /* @__PURE__ */ new Date();
|
|
438
439
|
const result = await controller.bulk({
|
|
439
440
|
collection: "action",
|
|
440
441
|
pipeline: valid.map(({ type, amount: amount2, key, meta, traceId }) => ({
|
|
@@ -448,6 +449,8 @@ var action = {
|
|
|
448
449
|
units: amount2,
|
|
449
450
|
key,
|
|
450
451
|
meta,
|
|
452
|
+
createdAt: date,
|
|
453
|
+
updatedAt: date,
|
|
451
454
|
...traceId && { traceId }
|
|
452
455
|
}
|
|
453
456
|
},
|
package/dist/billing.d.cts
CHANGED
|
@@ -485,6 +485,15 @@ const action = {
|
|
|
485
485
|
|
|
486
486
|
if( valid.length === 0 ) return;
|
|
487
487
|
|
|
488
|
+
// controller.bulk is a RAW bulkWrite — unlike record()'s controller.update,
|
|
489
|
+
// nothing injects insert timestamps. createdAt is what the per-period billing
|
|
490
|
+
// aggregation (and the ledger's TTL index) key on, so a row inserted without
|
|
491
|
+
// it is invisible to every invoice window forever: sweep-billed segment
|
|
492
|
+
// joins were counted on the usage display but never billed (2026-07-21,
|
|
493
|
+
// usage 12 vs invoice qty 3). No `id` is minted here (no ObjectId dep);
|
|
494
|
+
// ledger rows are only ever queried by key/usage/organization/createdAt.
|
|
495
|
+
const date = new Date();
|
|
496
|
+
|
|
488
497
|
const result = await controller.bulk({
|
|
489
498
|
collection : 'action',
|
|
490
499
|
pipeline : valid.map( ({ type, amount, key, meta, traceId }) => ({
|
|
@@ -498,6 +507,8 @@ const action = {
|
|
|
498
507
|
units : amount,
|
|
499
508
|
key,
|
|
500
509
|
meta,
|
|
510
|
+
createdAt : date,
|
|
511
|
+
updatedAt : date,
|
|
501
512
|
...( traceId && { traceId })
|
|
502
513
|
}
|
|
503
514
|
},
|
package/dist/billing.d.ts
CHANGED
|
@@ -485,6 +485,15 @@ const action = {
|
|
|
485
485
|
|
|
486
486
|
if( valid.length === 0 ) return;
|
|
487
487
|
|
|
488
|
+
// controller.bulk is a RAW bulkWrite — unlike record()'s controller.update,
|
|
489
|
+
// nothing injects insert timestamps. createdAt is what the per-period billing
|
|
490
|
+
// aggregation (and the ledger's TTL index) key on, so a row inserted without
|
|
491
|
+
// it is invisible to every invoice window forever: sweep-billed segment
|
|
492
|
+
// joins were counted on the usage display but never billed (2026-07-21,
|
|
493
|
+
// usage 12 vs invoice qty 3). No `id` is minted here (no ObjectId dep);
|
|
494
|
+
// ledger rows are only ever queried by key/usage/organization/createdAt.
|
|
495
|
+
const date = new Date();
|
|
496
|
+
|
|
488
497
|
const result = await controller.bulk({
|
|
489
498
|
collection : 'action',
|
|
490
499
|
pipeline : valid.map( ({ type, amount, key, meta, traceId }) => ({
|
|
@@ -498,6 +507,8 @@ const action = {
|
|
|
498
507
|
units : amount,
|
|
499
508
|
key,
|
|
500
509
|
meta,
|
|
510
|
+
createdAt : date,
|
|
511
|
+
updatedAt : date,
|
|
501
512
|
...( traceId && { traceId })
|
|
502
513
|
}
|
|
503
514
|
},
|
package/dist/billing.js
CHANGED
|
@@ -405,6 +405,7 @@ var action = {
|
|
|
405
405
|
valid.push({ type, amount: amount2, key, meta, traceId });
|
|
406
406
|
}
|
|
407
407
|
if (valid.length === 0) return;
|
|
408
|
+
const date = /* @__PURE__ */ new Date();
|
|
408
409
|
const result = await controller.bulk({
|
|
409
410
|
collection: "action",
|
|
410
411
|
pipeline: valid.map(({ type, amount: amount2, key, meta, traceId }) => ({
|
|
@@ -418,6 +419,8 @@ var action = {
|
|
|
418
419
|
units: amount2,
|
|
419
420
|
key,
|
|
420
421
|
meta,
|
|
422
|
+
createdAt: date,
|
|
423
|
+
updatedAt: date,
|
|
421
424
|
...traceId && { traceId }
|
|
422
425
|
}
|
|
423
426
|
},
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@drawbridge/drawbridge-agents": "0.0.10",
|
|
5
4
|
"@drawbridge/drawbridge-telemetry": "0.0.15",
|
|
6
5
|
"@google/genai": "1.30.0",
|
|
7
|
-
"axios": "1.
|
|
6
|
+
"axios": "1.18.1",
|
|
8
7
|
"currency-codes": "2.2.0",
|
|
9
8
|
"disposable-email-domains": "1.0.62",
|
|
10
9
|
"libphonenumber-js": "1.13.4",
|
|
@@ -16,7 +15,8 @@
|
|
|
16
15
|
"devDependencies": {
|
|
17
16
|
"@node-oauth/oauth2-server": "5.3.0",
|
|
18
17
|
"tsup": "8.5.1",
|
|
19
|
-
"typescript": "5.9.3"
|
|
18
|
+
"typescript": "5.9.3",
|
|
19
|
+
"@drawbridge/drawbridge-agents": "0.1.7"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@node-oauth/oauth2-server": "^5.3.0"
|
|
@@ -164,5 +164,5 @@
|
|
|
164
164
|
"test": "node --test test/"
|
|
165
165
|
},
|
|
166
166
|
"types": "dist/index.d.ts",
|
|
167
|
-
"version": "0.0.
|
|
167
|
+
"version": "0.0.85"
|
|
168
168
|
}
|