@northtalk/ts 0.2.0 → 0.4.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 +16 -14
- package/{base64-DORMd3Hv.js → base64-Dtqaz_0A.js} +880 -409
- package/{binary-value-CEmh60GC.d.ts → binary-value-Bb6HPDtM.d.ts} +2 -2
- package/{capabilities-CH0FkRMq.js → capabilities-Bi5Qm6Fr.js} +39 -20
- package/{checker-Dc1jl2WH.js → checker-DMI4LiRm.js} +321 -112
- package/core-BzGUgjL6.d.ts +22 -0
- package/{debug-CQBxKnJB.d.ts → debug-C72o2pZy.d.ts} +506 -50
- package/debug.d.ts +3 -3
- package/debug.js +1 -1
- package/driver-ClV_UDEK.d.ts +63 -0
- package/driver.d.ts +2 -40
- package/driver.js +24 -4
- package/{encoding-nlrpj-Pb.js → encoding-C3Q7pIC9.js} +2 -2
- package/{engine-BGaJ9dAk.js → engine-BpdGfAND.js} +6 -6
- package/{engine-vbYInVYF.d.ts → engine-Dtby_FkE.d.ts} +3 -3
- package/{errors-LYJZ_c8h.js → errors-BKJES3Zu.js} +1060 -751
- package/{group-B742gg4T.js → group-vuUL2tq-.js} +6526 -1725
- package/http.d.ts +2 -2
- package/http.js +3 -3
- package/index-ByF5j53i.d.ts +779 -0
- package/index.d.ts +6 -651
- package/index.js +23 -15
- package/{http-capability-CSTkw1Yt.js → inline-grants-Cx0Z9XAt.js} +109 -24
- package/manifest-Dw-8Unmf.js +256 -0
- package/message-layer.d.ts +3 -3
- package/message-layer.js +2 -2
- package/notify.d.ts +2 -2
- package/notify.js +1 -1
- package/{objects-Db7IB5vQ.js → objects-BC4fS0vq.js} +1 -1
- package/{objects-DJ3QtCCs.d.ts → objects-Dnqor7Gn.d.ts} +12 -4
- package/{operation-promises-EgZXG5N_.js → operation-promises-ClA1BTaS.js} +10 -5
- package/package.json +2 -2
- package/{readers-CjJHKHvH.js → readers-B5e5bBrY.js} +2 -2
- package/{readers-BFPuosPk.d.ts → readers-DAFVvvq4.d.ts} +2 -2
- package/{request-pump-binary-DdY3X-yl.js → request-pump-binary-BjnyqXV5.js} +4 -4
- package/{router--71qvxtY.js → router-BCHEfs4x.js} +5 -5
- package/{router-Zhrw5l__.d.ts → router-BspOCPA0.d.ts} +3 -3
- package/session.d.ts +41 -3
- package/session.js +260 -179
- package/setup.d.ts +2 -2
- package/setup.js +4 -4
- package/sha256-9CGf5BS_.js +168 -0
- package/sqlite.d.ts +5 -5
- package/sqlite.js +27 -21
- package/{store-hJrRULMx.js → store-DTQa0lyE.js} +2 -2
- package/{store-capability-OZp4hXmj.js → store-capability-BxXgiRM7.js} +4 -4
- package/store.d.ts +3 -3
- package/store.js +2 -2
- package/{user-capability-BK4Asg7D.js → user-capability-5-IvCeZI.js} +5 -5
- package/wasm.d.ts +12 -8
- package/wasm.js +67 -39
- package/core-DptnvQT9.d.ts +0 -14
- package/manifest-BscyH_rW.d.ts +0 -70
- package/manifest-DjsxDSuB.js +0 -129
- package/sha256-B_kyYw3Z.js +0 -124
package/debug.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
export { type DebugController, type DebugFrame, type DebugInstruction, type DebugPause, type DebugSnapshot, type DebugSource, type RepeatedEffect, isReadable, sourceForm };
|
|
1
|
+
/// <reference lib="esnext.disposable" />
|
|
2
|
+
import { a as DebugPause, c as RepeatedEffect, ct as sourceForm, et as isReadable, i as DebugInstruction, n as DebugEvaluation, o as DebugSnapshot, r as DebugFrame, s as DebugSource, t as DebugController } from "./debug-C72o2pZy.js";
|
|
3
|
+
export { type DebugController, type DebugEvaluation, type DebugFrame, type DebugInstruction, type DebugPause, type DebugSnapshot, type DebugSource, type RepeatedEffect, isReadable, sourceForm };
|
package/debug.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export {
|
|
2
|
+
export { O as isReadable, Z as sourceForm } from "./errors-BKJES3Zu.js";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/// <reference lib="esnext.disposable" />
|
|
2
|
+
import { Qt as Group, b as PumpOptions, h as GroupOptions, x as PumpResult } from "./debug-C72o2pZy.js";
|
|
3
|
+
//#region src/operation-promises.d.ts
|
|
4
|
+
/** A suspending call whose Host `run` Promise has not settled. */
|
|
5
|
+
type PendingOperation = {
|
|
6
|
+
readonly callId: string;
|
|
7
|
+
readonly grantName: string;
|
|
8
|
+
readonly scriptName: string;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/driver.d.ts
|
|
12
|
+
type AutoDriveOptions = {
|
|
13
|
+
/** Epoch microseconds. The default reads `Date.now()`; readings never go backwards. */
|
|
14
|
+
clock?: () => bigint;
|
|
15
|
+
/**
|
|
16
|
+
* Bounds how long close waits for Host `run` Promises, in milliseconds.
|
|
17
|
+
* Close then stops waiting, reports the calls still pending to
|
|
18
|
+
* `onCloseTimeout` and resolves. The default waits indefinitely.
|
|
19
|
+
*/
|
|
20
|
+
closeTimeoutMs?: number;
|
|
21
|
+
/** The calls still pending when `closeTimeoutMs` expired. Their late results are ignored. */
|
|
22
|
+
onCloseTimeout?: (pending: PendingOperation[]) => void;
|
|
23
|
+
/** A Pump that threw, such as a `clock backwards` HostError. The driver keeps going. */
|
|
24
|
+
onError?: (error: unknown) => void;
|
|
25
|
+
/** Each Pump's result, as soon as it returns. It may make worker calls, such as Reload after a `rewound` Pump. */
|
|
26
|
+
onPump?: (result: PumpResult) => void;
|
|
27
|
+
/** Passed to every Pump. A Fuel Slice yields the event loop between Pumps. */
|
|
28
|
+
pump?: PumpOptions;
|
|
29
|
+
/**
|
|
30
|
+
* Calls `fire` once the clock reaches `at`, and returns a cancel function.
|
|
31
|
+
* The default uses `setTimeout`; a Host with its own clock supplies its own.
|
|
32
|
+
*/
|
|
33
|
+
setDeadline?: (at: bigint, fire: () => void) => () => void;
|
|
34
|
+
};
|
|
35
|
+
type Drive = {
|
|
36
|
+
/** Closes with the default reason, "Host shutdown". */
|
|
37
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Stops all Scripts, drains, awaits Host run Promises, then cancels scheduling.
|
|
40
|
+
* Without `closeTimeoutMs`, a `run` Promise that ignores its aborted
|
|
41
|
+
* `call.signal` and never settles keeps close pending.
|
|
42
|
+
*/
|
|
43
|
+
close(reason?: string): Promise<void>;
|
|
44
|
+
/** Resolves once no Pump is scheduled or running. A Group waiting only on a deadline counts as settled. */
|
|
45
|
+
idle(): Promise<void>;
|
|
46
|
+
/** The Group's onReady: schedules a Pump, once, on a later macrotask. */
|
|
47
|
+
ready(): void;
|
|
48
|
+
/** Cancels scheduling without stopping Scripts. Does not interrupt an active close. */
|
|
49
|
+
stop(): void;
|
|
50
|
+
};
|
|
51
|
+
/** Group and driver options. The factory owns the Group's readiness callback. */
|
|
52
|
+
type DrivenGroupOptions = Omit<GroupOptions, 'onReady'> & AutoDriveOptions;
|
|
53
|
+
/** Creates a Group on `core` ready to drive queued Inputs from the Host's event loop. */
|
|
54
|
+
declare const newDrivenGroup: <G extends Group>(core: {
|
|
55
|
+
newGroup(o: GroupOptions): G;
|
|
56
|
+
}, o: DrivenGroupOptions) => {
|
|
57
|
+
drive: Drive;
|
|
58
|
+
group: G;
|
|
59
|
+
};
|
|
60
|
+
declare const asyncDispose: typeof Symbol.asyncDispose;
|
|
61
|
+
declare const autoDrive: (group: Group, o?: AutoDriveOptions) => Drive;
|
|
62
|
+
//#endregion
|
|
63
|
+
export { autoDrive as a, asyncDispose as i, Drive as n, newDrivenGroup as o, DrivenGroupOptions as r, PendingOperation as s, AutoDriveOptions as t };
|
package/driver.d.ts
CHANGED
|
@@ -1,41 +1,3 @@
|
|
|
1
1
|
/// <reference lib="esnext.disposable" />
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export type AutoDriveOptions = {
|
|
5
|
-
/** Epoch microseconds. The default reads `Date.now()`; readings never go backwards. */
|
|
6
|
-
clock?: () => bigint;
|
|
7
|
-
/** A Pump that threw, such as a `clock backwards` HostError. The driver keeps going. */
|
|
8
|
-
onError?: (error: unknown) => void;
|
|
9
|
-
/** Each Pump's result, as soon as it returns. It may make worker calls, such as Reload after a `rewound` Pump. */
|
|
10
|
-
onPump?: (result: PumpResult) => void;
|
|
11
|
-
/** Passed to every Pump. A Fuel Slice yields the event loop between Pumps. */
|
|
12
|
-
pump?: PumpOptions;
|
|
13
|
-
/**
|
|
14
|
-
* Calls `fire` once the clock reaches `at`, and returns a cancel function.
|
|
15
|
-
* The default uses `setTimeout`; a Host with its own clock supplies its own.
|
|
16
|
-
*/
|
|
17
|
-
setDeadline?: (at: bigint, fire: () => void) => () => void;
|
|
18
|
-
};
|
|
19
|
-
export type Drive = {
|
|
20
|
-
/** Closes with the default reason, "Host shutdown". */
|
|
21
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
22
|
-
/** Stops all Scripts, drains, awaits Host run Promises, then cancels scheduling. */
|
|
23
|
-
close(reason?: string): Promise<void>;
|
|
24
|
-
/** Resolves once no Pump is scheduled or running. A Group waiting only on a deadline counts as settled. */
|
|
25
|
-
idle(): Promise<void>;
|
|
26
|
-
/** The Group's onReady: schedules a Pump, once, on a later macrotask. */
|
|
27
|
-
ready(): void;
|
|
28
|
-
/** Cancels scheduling without stopping Scripts. Does not interrupt an active close. */
|
|
29
|
-
stop(): void;
|
|
30
|
-
};
|
|
31
|
-
/** Group and driver options. The factory owns the Group's readiness callback. */
|
|
32
|
-
export type DrivenGroupOptions = Omit<GroupOptions, 'onReady'> & AutoDriveOptions;
|
|
33
|
-
/** Creates a Group on `core` ready to drive queued Inputs from the Host's event loop. */
|
|
34
|
-
export declare const newDrivenGroup: <G extends Group>(core: {
|
|
35
|
-
newGroup(o: GroupOptions): G;
|
|
36
|
-
}, o: DrivenGroupOptions) => {
|
|
37
|
-
drive: Drive;
|
|
38
|
-
group: G;
|
|
39
|
-
};
|
|
40
|
-
export declare const autoDrive: (group: Group, o?: AutoDriveOptions) => Drive;
|
|
41
|
-
//#endregion
|
|
2
|
+
import { a as autoDrive, i as asyncDispose, n as Drive, o as newDrivenGroup, r as DrivenGroupOptions, s as PendingOperation, t as AutoDriveOptions } from "./driver-ClV_UDEK.js";
|
|
3
|
+
export { AutoDriveOptions, Drive, DrivenGroupOptions, type PendingOperation, asyncDispose, autoDrive, newDrivenGroup };
|
package/driver.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Yt as nowMicros } from "./errors-BKJES3Zu.js";
|
|
3
|
+
import { r as waitForOperations, t as pendingOperations } from "./operation-promises-ClA1BTaS.js";
|
|
4
4
|
//#region src/driver.ts
|
|
5
5
|
/** Creates a Group on `core` ready to drive queued Inputs from the Host's event loop. */
|
|
6
6
|
const newDrivenGroup = (core, o) => {
|
|
@@ -121,13 +121,33 @@ const autoDrive = (group, o = {}) => {
|
|
|
121
121
|
else resolve();
|
|
122
122
|
};
|
|
123
123
|
});
|
|
124
|
+
const operationsSettled = async () => {
|
|
125
|
+
const ms = o.closeTimeoutMs;
|
|
126
|
+
if (ms === void 0) {
|
|
127
|
+
await waitForOperations(group);
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
let timer;
|
|
131
|
+
const expired = new Promise((resolve) => {
|
|
132
|
+
timer = setTimeout(() => resolve(false), Math.min(Math.max(ms, 0), MAX_DELAY_MS));
|
|
133
|
+
});
|
|
134
|
+
try {
|
|
135
|
+
return await Promise.race([waitForOperations(group).then(() => true), expired]);
|
|
136
|
+
} finally {
|
|
137
|
+
clearTimeout(timer);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
124
140
|
const drain = async () => {
|
|
125
141
|
try {
|
|
126
142
|
for (const name of group.scriptNames()) group.script(name).stop(reason);
|
|
127
143
|
ready();
|
|
128
144
|
await idle();
|
|
129
145
|
if (!closing) return;
|
|
130
|
-
await
|
|
146
|
+
if (!await operationsSettled()) {
|
|
147
|
+
o.onCloseTimeout?.(pendingOperations(group));
|
|
148
|
+
finishClose?.();
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
131
151
|
if (!closing) return;
|
|
132
152
|
await idle();
|
|
133
153
|
finishClose?.();
|
|
@@ -149,4 +169,4 @@ const autoDrive = (group, o = {}) => {
|
|
|
149
169
|
};
|
|
150
170
|
};
|
|
151
171
|
//#endregion
|
|
152
|
-
export { autoDrive, newDrivenGroup };
|
|
172
|
+
export { asyncDispose, autoDrive, newDrivenGroup };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import { n as toBase64 } from "./base64-
|
|
2
|
+
import { o as invalidValue, q as requireValue } from "./errors-BKJES3Zu.js";
|
|
3
|
+
import { n as toBase64 } from "./base64-Dtqaz_0A.js";
|
|
4
4
|
//#region src/standard-capability-checks.ts
|
|
5
5
|
const checks = /* @__PURE__ */ new WeakMap();
|
|
6
6
|
const registerStandardChecks = (op, rules) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { i as decodeValueMembers } from "./readers-
|
|
5
|
-
import { n as quoteJSON, t as encodeValue } from "./encoding-
|
|
6
|
-
import { n as hostScriptError, t as add } from "./store-capability-
|
|
7
|
-
import { n as createRouter, t as changed } from "./router
|
|
2
|
+
import { A as listValues, L as nothing, Q as text, o as invalidValue, v as dec } from "./errors-BKJES3Zu.js";
|
|
3
|
+
import { $ as sizeOf, dt as compareText } from "./base64-Dtqaz_0A.js";
|
|
4
|
+
import { i as decodeValueMembers } from "./readers-B5e5bBrY.js";
|
|
5
|
+
import { n as quoteJSON, t as encodeValue } from "./encoding-C3Q7pIC9.js";
|
|
6
|
+
import { n as hostScriptError, t as add } from "./store-capability-BxXgiRM7.js";
|
|
7
|
+
import { n as createRouter, t as changed } from "./router-BCHEfs4x.js";
|
|
8
8
|
//#region src/store/engine.ts
|
|
9
9
|
/** The Session Store's quotas (chapter 12, The Session Store). */
|
|
10
10
|
const sessionQuotas = Object.freeze({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { i as WatchLimits, n as RouterOptions, t as NotificationRouter } from "./router-
|
|
1
|
+
/// <reference lib="esnext.disposable" />
|
|
2
|
+
import { Dt as EffectResult, J as Value, Mt as GrantContext, Ut as SegmentContext, bt as Call, on as StoreImpl } from "./debug-C72o2pZy.js";
|
|
3
|
+
import { i as WatchLimits, n as RouterOptions, t as NotificationRouter } from "./router-BspOCPA0.js";
|
|
4
4
|
//#region src/store/engine.d.ts
|
|
5
5
|
/** A Store's limits, each counted by logical size (chapter 8). */
|
|
6
6
|
type StoreQuotas = {
|