toilscript 0.1.52 → 0.1.53
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.generated.d.ts +14 -0
- package/dist/cli.js +76 -46
- package/dist/cli.js.map +2 -2
- package/dist/importmap.json +2 -2
- package/dist/toilscript.generated.d.ts +14 -0
- package/dist/toilscript.js +37 -35
- package/dist/toilscript.js.map +3 -3
- package/dist/web.js +3 -3
- package/package.json +1 -1
- package/std/assembly/bindings/toildb.ts +4 -0
- package/std/assembly/toildb.ts +68 -42
- package/std/assembly/toilscript.d.ts +13 -13
package/dist/web.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var ASSEMBLYSCRIPT_VERSION = "0.1.
|
|
1
|
+
var ASSEMBLYSCRIPT_VERSION = "0.1.53";
|
|
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.53/dist/toilscript.js",
|
|
5
|
+
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.53/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
|
@@ -223,6 +223,10 @@ export namespace toildbHost {
|
|
|
223
223
|
@external("env", "data.latest")
|
|
224
224
|
export declare function latest(handle: u32, keyPtr: usize, keyLen: i32, limit: i32): i32;
|
|
225
225
|
|
|
226
|
+
// @ts-ignore: decorator
|
|
227
|
+
@external("env", "data.events_since")
|
|
228
|
+
export declare function eventsSince(handle: u32, keyPtr: usize, keyLen: i32, limit: i32): i32;
|
|
229
|
+
|
|
226
230
|
// events.append_once -> 1 appended | 0 duplicate (deduped on eventId) | <0 error.
|
|
227
231
|
// Idempotent append: a retried call with the same eventId never doubles the event.
|
|
228
232
|
// @ts-ignore: decorator
|
package/std/assembly/toildb.ts
CHANGED
|
@@ -451,50 +451,49 @@ export enum MetricId {
|
|
|
451
451
|
Status4xx = 5,
|
|
452
452
|
Status5xx = 6,
|
|
453
453
|
StaticHits = 7,
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
CommittedMemoryPeak = 46,
|
|
454
|
+
ExecutorFullRejects = 8,
|
|
455
|
+
UnknownHostRejects = 9,
|
|
456
|
+
RateLimitedRejects = 10,
|
|
457
|
+
GasUsed = 11,
|
|
458
|
+
DbOps = 12,
|
|
459
|
+
DbReads = 13,
|
|
460
|
+
DbWrites = 14,
|
|
461
|
+
DbErrors = 15,
|
|
462
|
+
DbLatencyNsSum = 16,
|
|
463
|
+
StreamAccepts = 17,
|
|
464
|
+
StreamRejectWrongNode = 18,
|
|
465
|
+
StreamRejectCapacity = 19,
|
|
466
|
+
StreamRejectArtifact = 20,
|
|
467
|
+
StreamRejectGuest = 21,
|
|
468
|
+
StreamTraps = 22,
|
|
469
|
+
StreamIdleTimeouts = 23,
|
|
470
|
+
StreamBytesIn = 24,
|
|
471
|
+
StreamBytesOut = 25,
|
|
472
|
+
StreamBackpressureEvents = 26,
|
|
473
|
+
StreamCloses = 27,
|
|
474
|
+
StreamDisconnects = 28,
|
|
475
|
+
DaemonStarts = 29,
|
|
476
|
+
DaemonStartFailures = 30,
|
|
477
|
+
DaemonTicksFired = 31,
|
|
478
|
+
DaemonTicksSkippedNotLeader = 32,
|
|
479
|
+
DaemonTicksFailed = 33,
|
|
480
|
+
DaemonLeaderAcquires = 34,
|
|
481
|
+
DaemonLeaderFenced = 35,
|
|
482
|
+
DaemonHttpCallAttempts = 36,
|
|
483
|
+
DaemonHttpCallFailures = 37,
|
|
484
|
+
MemGrownBytes = 38,
|
|
485
|
+
Emails = 39,
|
|
486
|
+
CacheHits = 40,
|
|
487
|
+
CacheMisses = 41,
|
|
488
|
+
ConnectedStreamsAvg = 42,
|
|
489
|
+
ConnectedStreamsPeak = 43,
|
|
490
|
+
CommittedMemoryAvg = 44,
|
|
491
|
+
CommittedMemoryPeak = 45,
|
|
493
492
|
}
|
|
494
493
|
|
|
495
|
-
/// The number of cumulative counter metrics (`MetricId 0..=
|
|
494
|
+
/// The number of cumulative counter metrics (`MetricId 0..=41`) = the length of the snapshot's lifetime
|
|
496
495
|
/// section.
|
|
497
|
-
export const METRIC_COUNTERS: i32 =
|
|
496
|
+
export const METRIC_COUNTERS: i32 = 42;
|
|
498
497
|
|
|
499
498
|
/// A dashboard time range for `Analytics.series`. Short ranges (1h/6h) read the per-MINUTE ring; the rest
|
|
500
499
|
/// read the per-HOUR ring (30-day retention).
|
|
@@ -540,7 +539,6 @@ export class TenantStats {
|
|
|
540
539
|
get status4xx(): u64 { return this.life[MetricId.Status4xx]; }
|
|
541
540
|
get status5xx(): u64 { return this.life[MetricId.Status5xx]; }
|
|
542
541
|
get staticHits(): u64 { return this.life[MetricId.StaticHits]; }
|
|
543
|
-
get wasmDispatches(): u64 { return this.life[MetricId.WasmDispatches]; }
|
|
544
542
|
get executorFullRejects(): u64 { return this.life[MetricId.ExecutorFullRejects]; }
|
|
545
543
|
get unknownHostRejects(): u64 { return this.life[MetricId.UnknownHostRejects]; }
|
|
546
544
|
get rateLimitedRejects(): u64 { return this.life[MetricId.RateLimitedRejects]; }
|
|
@@ -735,6 +733,34 @@ export class Events<K, V> {
|
|
|
735
733
|
return status == 1;
|
|
736
734
|
}
|
|
737
735
|
|
|
736
|
+
/// The NEXT batch of events for `key` past this derive's checkpoint, OLDEST first, up to `limit`. The
|
|
737
|
+
/// host owns the resumable cursor (seeded from the durable checkpoint and advanced/committed around the
|
|
738
|
+
/// fold), so repeated calls drain an unbounded log in bounded batches and return an empty array once
|
|
739
|
+
/// caught up. Use it in a `@derive` (or `@job`) to fold a growing log incrementally instead of rescanning:
|
|
740
|
+
/// `for (const e of this.events.since(key, 500)) { ...update the view... }`, looping until it is empty.
|
|
741
|
+
/// The fold must be idempotent per event (a heal can trigger a full re-read). Same frame as `latest`.
|
|
742
|
+
since(key: K, limit: i32): V[] {
|
|
743
|
+
const kb = key.encode();
|
|
744
|
+
const status = toildbHost.eventsSince(this.__handle, kb.dataStart, kb.byteLength, limit);
|
|
745
|
+
if (status < 0) unreachable();
|
|
746
|
+
const blob = __toildbTake(status);
|
|
747
|
+
const out = new Array<V>();
|
|
748
|
+
let off: i32 = 0;
|
|
749
|
+
const count = load<u32>(blob.dataStart + off);
|
|
750
|
+
off += 4;
|
|
751
|
+
for (let i: u32 = 0; i < count; i++) {
|
|
752
|
+
const ver = <i64>load<u32>(blob.dataStart + off);
|
|
753
|
+
off += 4;
|
|
754
|
+
const len = <i32>load<u32>(blob.dataStart + off);
|
|
755
|
+
off += 4;
|
|
756
|
+
const ev = instantiate<V>();
|
|
757
|
+
ev.decodeIntoVersioned(blob.subarray(off, off + len), ver);
|
|
758
|
+
out.push(ev);
|
|
759
|
+
off += len;
|
|
760
|
+
}
|
|
761
|
+
return out;
|
|
762
|
+
}
|
|
763
|
+
|
|
738
764
|
/// The newest `limit` events, newest first. Decodes each framed event into a
|
|
739
765
|
/// `V`. The host frames them as `u32 count` then per event
|
|
740
766
|
/// `u32 schema_version + u32 len + bytes`.
|
|
@@ -280,24 +280,25 @@ declare class Counter<K> {
|
|
|
280
280
|
declare class Events<K, V> {
|
|
281
281
|
append(key: K, event: V): void;
|
|
282
282
|
latest(key: K, limit: i32): V[];
|
|
283
|
+
since(key: K, limit: i32): V[];
|
|
283
284
|
}
|
|
284
285
|
|
|
285
286
|
/** Every per-domain metric, by stable numeric id (the wire contract). `0..=42` are cumulative
|
|
286
|
-
* COUNTERS (rate = value/seconds); `
|
|
287
|
+
* COUNTERS (rate = value/seconds); `42..=45` are the avg/peak series of the two GAUGES. */
|
|
287
288
|
declare const enum MetricId {
|
|
288
289
|
Requests = 0, BytesOutL1 = 1, BytesInL1 = 2,
|
|
289
290
|
Status2xx = 3, Status3xx = 4, Status4xx = 5, Status5xx = 6,
|
|
290
|
-
StaticHits = 7,
|
|
291
|
-
ExecutorFullRejects =
|
|
292
|
-
DbOps =
|
|
293
|
-
StreamAccepts =
|
|
294
|
-
StreamRejectGuest =
|
|
295
|
-
StreamBytesOut =
|
|
296
|
-
DaemonStarts =
|
|
297
|
-
DaemonTicksFailed =
|
|
298
|
-
DaemonHttpCallAttempts =
|
|
299
|
-
CacheHits =
|
|
300
|
-
ConnectedStreamsAvg =
|
|
291
|
+
StaticHits = 7,
|
|
292
|
+
ExecutorFullRejects = 8, UnknownHostRejects = 9, RateLimitedRejects = 10, GasUsed = 11,
|
|
293
|
+
DbOps = 12, DbReads = 13, DbWrites = 14, DbErrors = 15, DbLatencyNsSum = 16,
|
|
294
|
+
StreamAccepts = 17, StreamRejectWrongNode = 18, StreamRejectCapacity = 19, StreamRejectArtifact = 20,
|
|
295
|
+
StreamRejectGuest = 21, StreamTraps = 22, StreamIdleTimeouts = 23, StreamBytesIn = 24,
|
|
296
|
+
StreamBytesOut = 25, StreamBackpressureEvents = 26, StreamCloses = 27, StreamDisconnects = 28,
|
|
297
|
+
DaemonStarts = 29, DaemonStartFailures = 30, DaemonTicksFired = 31, DaemonTicksSkippedNotLeader = 32,
|
|
298
|
+
DaemonTicksFailed = 33, DaemonLeaderAcquires = 34, DaemonLeaderFenced = 35,
|
|
299
|
+
DaemonHttpCallAttempts = 36, DaemonHttpCallFailures = 37, MemGrownBytes = 38, Emails = 39,
|
|
300
|
+
CacheHits = 40, CacheMisses = 41,
|
|
301
|
+
ConnectedStreamsAvg = 42, ConnectedStreamsPeak = 43, CommittedMemoryAvg = 44, CommittedMemoryPeak = 45,
|
|
301
302
|
}
|
|
302
303
|
|
|
303
304
|
/** A dashboard time range for `Analytics.series`. 1h/6h are per-minute; the rest per-hour (30-day). */
|
|
@@ -318,7 +319,6 @@ declare class TenantStats {
|
|
|
318
319
|
readonly status4xx: u64;
|
|
319
320
|
readonly status5xx: u64;
|
|
320
321
|
readonly staticHits: u64;
|
|
321
|
-
readonly wasmDispatches: u64;
|
|
322
322
|
readonly executorFullRejects: u64;
|
|
323
323
|
readonly unknownHostRejects: u64;
|
|
324
324
|
readonly rateLimitedRejects: u64;
|