toilscript 0.1.53 → 0.1.54
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/cli.js +41 -8
- package/dist/cli.js.map +2 -2
- package/dist/importmap.json +2 -2
- package/dist/web.js +3 -3
- package/package.json +1 -1
- package/std/assembly/toildb.ts +40 -7
- package/std/assembly/toilscript.d.ts +17 -5
package/dist/importmap.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"imports": {
|
|
3
|
-
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
4
|
-
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
3
|
+
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.54/dist/toilscript.js",
|
|
4
|
+
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.54/dist/cli.js",
|
|
5
5
|
"binaryen": "https://cdn.jsdelivr.net/npm/binaryen@130.0.0-nightly.20260609/index.js",
|
|
6
6
|
"long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
|
|
7
7
|
}
|
package/dist/web.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var ASSEMBLYSCRIPT_VERSION = "0.1.
|
|
1
|
+
var ASSEMBLYSCRIPT_VERSION = "0.1.54";
|
|
2
2
|
var ASSEMBLYSCRIPT_IMPORTMAP = {
|
|
3
3
|
"imports": {
|
|
4
|
-
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
5
|
-
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
4
|
+
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.54/dist/toilscript.js",
|
|
5
|
+
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.54/dist/cli.js",
|
|
6
6
|
"binaryen": "https://cdn.jsdelivr.net/npm/binaryen@130.0.0-nightly.20260609/index.js",
|
|
7
7
|
"long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
|
|
8
8
|
}
|
package/package.json
CHANGED
package/std/assembly/toildb.ts
CHANGED
|
@@ -495,8 +495,9 @@ export enum MetricId {
|
|
|
495
495
|
/// section.
|
|
496
496
|
export const METRIC_COUNTERS: i32 = 42;
|
|
497
497
|
|
|
498
|
-
/// A dashboard time range for `Analytics.series`. Short ranges (1h/6h) read the per-MINUTE ring; the
|
|
499
|
-
/// read the per-
|
|
498
|
+
/// A dashboard time range for `Analytics.series`. Short ranges (1h/6h) read the per-MINUTE ring; the long
|
|
499
|
+
/// ranges (60d/90d) read the per-DAY ring (90-day retention); the rest read the per-HOUR ring (30-day).
|
|
500
|
+
/// Append-only: never renumber (D60/D90 were added after D30, keeping the wire ids stable).
|
|
500
501
|
export enum AnalyticsRange {
|
|
501
502
|
H1 = 0,
|
|
502
503
|
H6 = 1,
|
|
@@ -506,6 +507,8 @@ export enum AnalyticsRange {
|
|
|
506
507
|
D7 = 5,
|
|
507
508
|
D14 = 6,
|
|
508
509
|
D30 = 7,
|
|
510
|
+
D60 = 8,
|
|
511
|
+
D90 = 9,
|
|
509
512
|
}
|
|
510
513
|
|
|
511
514
|
/// One tenant's analytics snapshot: the lifetime totals (indexed by `MetricId`, NO string keys), the two
|
|
@@ -522,6 +525,16 @@ export class TenantStats {
|
|
|
522
525
|
reqMinuteCap: u64 = 0;
|
|
523
526
|
reqDayUsed: u64 = 0;
|
|
524
527
|
reqDayCap: u64 = 0;
|
|
528
|
+
/// LIVE per-second gauges (rates), computed edge-side from the last completed minute bucket so the
|
|
529
|
+
/// guest is STATELESS (no client diffing of two snapshots). Idle -> 0.0. `f64` (a rate is fractional
|
|
530
|
+
/// and bounded; f64 cannot overflow for any real value).
|
|
531
|
+
rps: f64 = 0;
|
|
532
|
+
bytesInPerSec: f64 = 0;
|
|
533
|
+
bytesOutPerSec: f64 = 0;
|
|
534
|
+
streamBytesInPerSec: f64 = 0;
|
|
535
|
+
streamBytesOutPerSec: f64 = 0;
|
|
536
|
+
dbOpsPerSec: f64 = 0;
|
|
537
|
+
gasPerSec: f64 = 0;
|
|
525
538
|
/// Edge wall-clock (ms) when the snapshot was read.
|
|
526
539
|
nowMs: u64 = 0;
|
|
527
540
|
|
|
@@ -589,19 +602,28 @@ export class TenantStats {
|
|
|
589
602
|
}
|
|
590
603
|
}
|
|
591
604
|
|
|
592
|
-
/// One metric's time series for a range: `points` oldest→newest, `
|
|
593
|
-
/// `headMs` the newest bucket's end. Rates are derived, never stored.
|
|
605
|
+
/// One metric's time series for a range: `points` oldest→newest (per-bucket totals, `u64` — non-negative),
|
|
606
|
+
/// `bucketSecs` the per-bucket width, and `headMs` the newest bucket's end. Rates are derived, never stored.
|
|
594
607
|
export class Series {
|
|
595
608
|
metric: MetricId = MetricId.Requests;
|
|
596
609
|
bucketSecs: u32 = 0;
|
|
597
610
|
headMs: u64 = 0;
|
|
598
|
-
points:
|
|
611
|
+
points: u64[] = [];
|
|
599
612
|
|
|
600
613
|
/// Per-second rate of bucket `i` (its total divided by the bucket width). 0 for an out-of-range index.
|
|
601
614
|
ratePerSec(i: i32): f64 {
|
|
602
615
|
if (i < 0 || i >= this.points.length || this.bucketSecs == 0) return 0;
|
|
603
616
|
return <f64>this.points[i] / <f64>this.bucketSecs;
|
|
604
617
|
}
|
|
618
|
+
|
|
619
|
+
/// The CUMULATIVE total over the whole window (e.g. total bytes across a 30d/90d range). Folded into an
|
|
620
|
+
/// `f64` accumulator — NEVER a `u64`/`i64` sum, which could overflow a long byte-count window (AS has no
|
|
621
|
+
/// u128; `f64` max is 1.8e308, so it cannot overflow for any real value).
|
|
622
|
+
sum(): f64 {
|
|
623
|
+
let acc: f64 = 0;
|
|
624
|
+
for (let i = 0; i < this.points.length; i++) acc += <f64>this.points[i];
|
|
625
|
+
return acc;
|
|
626
|
+
}
|
|
605
627
|
}
|
|
606
628
|
|
|
607
629
|
/// A page of site names from `Analytics.listSites` (dacely.com only). When `hasMore` is
|
|
@@ -634,6 +656,16 @@ export class Analytics {
|
|
|
634
656
|
stats.reqMinuteCap = r.readU64();
|
|
635
657
|
stats.reqDayUsed = r.readU64();
|
|
636
658
|
stats.reqDayCap = r.readU64();
|
|
659
|
+
// LIVE per-second rates (f64), appended after the windows. VERSION-GATE by LENGTH: a pre-rates
|
|
660
|
+
// (shorter) frame from an older edge exhausts the buffer here, so `readF64` returns 0.0 for each
|
|
661
|
+
// missing rate (DataReader is bounds-checked). No frame-version bump needed.
|
|
662
|
+
stats.rps = r.readF64();
|
|
663
|
+
stats.bytesInPerSec = r.readF64();
|
|
664
|
+
stats.bytesOutPerSec = r.readF64();
|
|
665
|
+
stats.streamBytesInPerSec = r.readF64();
|
|
666
|
+
stats.streamBytesOutPerSec = r.readF64();
|
|
667
|
+
stats.dbOpsPerSec = r.readF64();
|
|
668
|
+
stats.gasPerSec = r.readF64();
|
|
637
669
|
return stats;
|
|
638
670
|
}
|
|
639
671
|
|
|
@@ -646,8 +678,9 @@ export class Analytics {
|
|
|
646
678
|
out.bucketSecs = r.readU32();
|
|
647
679
|
out.headMs = r.readU64();
|
|
648
680
|
const count = <i32>r.readU32();
|
|
649
|
-
|
|
650
|
-
|
|
681
|
+
// Points are non-negative per-bucket totals: read as u64 (matches the edge `u64 LE` series frame).
|
|
682
|
+
const pts = new Array<u64>(count);
|
|
683
|
+
for (let i: i32 = 0; i < count && r.ok; i++) pts[i] = r.readU64();
|
|
651
684
|
out.points = pts;
|
|
652
685
|
return out;
|
|
653
686
|
}
|
|
@@ -301,9 +301,10 @@ declare const enum MetricId {
|
|
|
301
301
|
ConnectedStreamsAvg = 42, ConnectedStreamsPeak = 43, CommittedMemoryAvg = 44, CommittedMemoryPeak = 45,
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
-
/** A dashboard time range for `Analytics.series`. 1h/6h are per-minute;
|
|
304
|
+
/** A dashboard time range for `Analytics.series`. 1h/6h are per-minute; 60d/90d are per-day (90-day
|
|
305
|
+
* retention); the rest are per-hour (30-day). Append-only ids. */
|
|
305
306
|
declare const enum AnalyticsRange {
|
|
306
|
-
H1 = 0, H6 = 1, H12 = 2, H24 = 3, D3 = 4, D7 = 5, D14 = 6, D30 = 7,
|
|
307
|
+
H1 = 0, H6 = 1, H12 = 2, H24 = 3, D3 = 4, D7 = 5, D14 = 6, D30 = 7, D60 = 8, D90 = 9,
|
|
307
308
|
}
|
|
308
309
|
|
|
309
310
|
/** One tenant's analytics snapshot: lifetime totals (indexed by `MetricId`, no string keys), the two
|
|
@@ -362,17 +363,28 @@ declare class TenantStats {
|
|
|
362
363
|
reqMinuteCap: u64;
|
|
363
364
|
reqDayUsed: u64;
|
|
364
365
|
reqDayCap: u64;
|
|
366
|
+
/** LIVE per-second gauges (rates), computed edge-side from the last completed minute bucket (idle 0.0),
|
|
367
|
+
* so no client diffing is needed. `f64` cannot overflow for any real value. */
|
|
368
|
+
readonly rps: f64;
|
|
369
|
+
readonly bytesInPerSec: f64;
|
|
370
|
+
readonly bytesOutPerSec: f64;
|
|
371
|
+
readonly streamBytesInPerSec: f64;
|
|
372
|
+
readonly streamBytesOutPerSec: f64;
|
|
373
|
+
readonly dbOpsPerSec: f64;
|
|
374
|
+
readonly gasPerSec: f64;
|
|
365
375
|
nowMs: u64;
|
|
366
376
|
}
|
|
367
377
|
|
|
368
|
-
/** One metric's time series for a range: `points` oldest→newest, `bucketSecs`
|
|
369
|
-
* `headMs` newest bucket end. `ratePerSec(i)` derives the per-second rate of point `i
|
|
378
|
+
/** One metric's time series for a range: `points` oldest→newest (per-bucket totals, `u64`), `bucketSecs`
|
|
379
|
+
* bucket width, `headMs` newest bucket end. `ratePerSec(i)` derives the per-second rate of point `i`;
|
|
380
|
+
* `sum()` folds the window into an `f64` cumulative (never a `u64` sum -> overflow-safe). */
|
|
370
381
|
declare class Series {
|
|
371
382
|
metric: MetricId;
|
|
372
383
|
bucketSecs: u32;
|
|
373
384
|
headMs: u64;
|
|
374
|
-
points:
|
|
385
|
+
points: u64[];
|
|
375
386
|
ratePerSec(i: i32): f64;
|
|
387
|
+
sum(): f64;
|
|
376
388
|
}
|
|
377
389
|
|
|
378
390
|
/** A page of site names from `Analytics.listSites` (dacely.com only). When `hasMore` is
|