@northtalk/ts 0.1.0 → 0.2.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 +9 -5
- package/{encoding-DWlbPq-e.js → base64-DORMd3Hv.js} +197 -1368
- package/binary-value-CEmh60GC.d.ts +15 -0
- package/capabilities-CH0FkRMq.js +1301 -0
- package/checker-Dc1jl2WH.js +6657 -0
- package/core-DptnvQT9.d.ts +14 -0
- package/{debug-D8Z_u244.d.ts → debug-CQBxKnJB.d.ts} +1147 -780
- package/debug.d.ts +2 -1
- package/debug.js +2 -1
- package/driver.d.ts +16 -2
- package/driver.js +98 -20
- package/encoding-nlrpj-Pb.js +99 -0
- package/{engine-CgCMdGGd.js → engine-BGaJ9dAk.js} +7 -5
- package/{engine-BPFnHT9N.d.ts → engine-vbYInVYF.d.ts} +3 -3
- package/{errors-DHwz1Vho.js → errors-LYJZ_c8h.js} +91 -17
- package/{group-B4eyJKTA.js → group-B742gg4T.js} +1490 -7278
- package/{sqlite-capability-CrCej3Po.js → http-capability-CSTkw1Yt.js} +255 -5
- package/http.d.ts +59 -0
- package/http.js +465 -0
- package/index.d.ts +23 -17
- package/index.js +19 -12
- package/manifest-BscyH_rW.d.ts +70 -0
- package/{manifest-DKe2Je6Z.js → manifest-DjsxDSuB.js} +11 -90
- package/message-layer.d.ts +12 -0
- package/message-layer.js +4 -0
- package/notify.d.ts +2 -1
- package/notify.js +2 -1
- package/{objects-MeXIDDFo.d.ts → objects-DJ3QtCCs.d.ts} +23 -8
- package/objects-Db7IB5vQ.js +91 -0
- package/operation-promises-EgZXG5N_.js +23 -0
- package/package.json +9 -1
- package/readers-BFPuosPk.d.ts +25 -0
- package/{readers-DyjxJEkL.js → readers-CjJHKHvH.js} +6 -3
- package/request-pump-binary-DdY3X-yl.js +2246 -0
- package/{router-DHPJNvbt.js → router--71qvxtY.js} +8 -6
- package/{router-DpDpAJjz.d.ts → router-Zhrw5l__.d.ts} +6 -5
- package/session.d.ts +2 -1
- package/session.js +58 -24
- package/setup.d.ts +2 -1
- package/setup.js +8 -4
- package/{sha256-0jiTgVJu.js → sha256-B_kyYw3Z.js} +1 -0
- package/sqlite.d.ts +3 -4
- package/sqlite.js +6 -5
- package/{store-capability-CDoVafZL.js → store-capability-OZp4hXmj.js} +10 -7
- package/{store-DrYjcoru.js → store-hJrRULMx.js} +3 -2
- package/store.d.ts +3 -2
- package/store.js +3 -2
- package/{user-capability-Cv0oJhhv.js → user-capability-BK4Asg7D.js} +8 -5
- package/wasm.d.ts +42 -22
- package/wasm.js +330 -46
- package/core-eU5KaYkz.d.ts +0 -23
- package/readers-Oh4tO2dK.d.ts +0 -57
- package/sqlite-capability-C7-SYdD7.d.ts +0 -87
- package/user-capability-CLkDsrCX.d.ts +0 -40
package/readers-Oh4tO2dK.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Rt as Grant, Tt as ObjectKind, Xt as Shape, at as Value, j as Library } from "./debug-D8Z_u244.js";
|
|
2
|
-
//#region src/encoding.d.ts
|
|
3
|
-
/**
|
|
4
|
-
* A Message Layer adapter's own spelling of a Function Value or a Text
|
|
5
|
-
* Pattern, which the Value Encoding doesn't hold.
|
|
6
|
-
*/
|
|
7
|
-
type AdapterEncoder = (v: Value) => string;
|
|
8
|
-
declare const encodeValue: (value: Value, adapter?: AdapterEncoder) => string;
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/json.d.ts
|
|
11
|
-
/** Read exact decimal digits, NFC strings and insertion-ordered maps. */
|
|
12
|
-
declare const decodeJson: (source: string) => Value;
|
|
13
|
-
/** Compact JSON, with canonical numbers and chapter 7's string escapes. */
|
|
14
|
-
declare const encodeJson: (value: Value) => string;
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/manifest.d.ts
|
|
17
|
-
type MessageDecl = {
|
|
18
|
-
args?: readonly Shape[];
|
|
19
|
-
description?: string;
|
|
20
|
-
/** NorthTalk source, each sending this message. */
|
|
21
|
-
examples?: readonly string[];
|
|
22
|
-
name: string;
|
|
23
|
-
receivers?: readonly ObjectKind[];
|
|
24
|
-
};
|
|
25
|
-
type ManifestSpec = {
|
|
26
|
-
grants: Readonly<Record<string, Grant<any>>>;
|
|
27
|
-
kind: string;
|
|
28
|
-
libraries?: readonly Library[];
|
|
29
|
-
messages?: readonly MessageDecl[];
|
|
30
|
-
objectKinds?: readonly ObjectKind[];
|
|
31
|
-
objects?: Readonly<Record<string, ObjectKind>>;
|
|
32
|
-
version: string;
|
|
33
|
-
};
|
|
34
|
-
/** Chapter 9's deterministic JSON file, ending in LF; never calls the Host. */
|
|
35
|
-
declare const exportManifest: (m: ManifestSpec) => string;
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region src/readers.d.ts
|
|
38
|
-
/** Finds the Host Object a reader names by its kind and id, or none. */
|
|
39
|
-
type ObjectResolver = (kind: string, id: string) => {
|
|
40
|
-
readonly value: Value;
|
|
41
|
-
} | Value | null | undefined;
|
|
42
|
-
type FunctionResolver = (display: string) => Value | undefined;
|
|
43
|
-
declare const readDisplay: (source: string, resolve?: ObjectResolver, resolveFunction?: FunctionResolver) => Value;
|
|
44
|
-
type Json = null | boolean | string | JsonNumber | Json[] | JsonObject;
|
|
45
|
-
declare class JsonNumber {
|
|
46
|
-
readonly source: string;
|
|
47
|
-
readonly kind = "number";
|
|
48
|
-
constructor(source: string);
|
|
49
|
-
}
|
|
50
|
-
declare class JsonObject {
|
|
51
|
-
readonly pairs: [string, Json][];
|
|
52
|
-
readonly kind = "object";
|
|
53
|
-
constructor(pairs: [string, Json][]);
|
|
54
|
-
}
|
|
55
|
-
declare const decodeValue: (source: string, resolve?: ObjectResolver, functionResolve?: (handle: string) => Value) => Value;
|
|
56
|
-
//#endregion
|
|
57
|
-
export { ManifestSpec as a, decodeJson as c, readDisplay as i, encodeJson as l, Json as n, MessageDecl as o, decodeValue as r, exportManifest as s, FunctionResolver as t, encodeValue as u };
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { At as Call, Nt as Cost, at as Value, jt as CapabilityDef, qt as SegmentCoordinator } from "./debug-D8Z_u244.js";
|
|
2
|
-
//#region src/standard-capabilities.d.ts
|
|
3
|
-
type Costs = Readonly<Record<string, Cost>>;
|
|
4
|
-
type ConsoleImpl = {
|
|
5
|
-
read(call: Call<unknown>): void;
|
|
6
|
-
write(call: Call<unknown>, value: Value): void;
|
|
7
|
-
};
|
|
8
|
-
type TimerImpl = {
|
|
9
|
-
cancel(call: Call<unknown>, name: string): void;
|
|
10
|
-
schedule(call: Call<unknown>, name: string, at: Value, message: string, args: Value): void;
|
|
11
|
-
};
|
|
12
|
-
/** The Pump's Clock reading; there is no Host clock implementation. */
|
|
13
|
-
declare const clockCapability: (costs: Costs) => CapabilityDef<void>;
|
|
14
|
-
/** The Host owns durable timers, scoped by Script and name. */
|
|
15
|
-
declare const timerCapability: (impl: TimerImpl, costs: Costs) => CapabilityDef<unknown>;
|
|
16
|
-
/** The Host shows Values in text form and answers read with a line of text. */
|
|
17
|
-
declare const consoleCapability: (impl: ConsoleImpl, costs: Costs) => CapabilityDef<unknown>;
|
|
18
|
-
type CalendarImpl = {
|
|
19
|
-
now(call: Call<string>, zone?: string): Value;
|
|
20
|
-
offset(call: Call<string>, instant: Value, zone?: string): Value;
|
|
21
|
-
toCivil(call: Call<string>, instant: Value, zone?: string): Value;
|
|
22
|
-
today(call: Call<string>, zone?: string): Value;
|
|
23
|
-
toInstant(call: Call<string>, civil: Value, disambiguation: string, zone?: string): Value;
|
|
24
|
-
zone(call: Call<string>, zone?: string): Value;
|
|
25
|
-
};
|
|
26
|
-
/** The Host owns zone data; the Grant binding supplies its default zone. */
|
|
27
|
-
declare const calendarCapability: (impl: CalendarImpl, costs: Costs) => CapabilityDef<string>;
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/locale-capability.d.ts
|
|
30
|
-
type LocaleImpl = {
|
|
31
|
-
compare(call: Call<string>, a: Value, b: Value, opts: Value, tag?: string): Value;
|
|
32
|
-
dayNames(call: Call<string>, opts: Value, tag?: string): Value;
|
|
33
|
-
lower(call: Call<string>, s: Value, tag?: string): Value;
|
|
34
|
-
monthNames(call: Call<string>, opts: Value, tag?: string): Value;
|
|
35
|
-
numberSymbols(call: Call<string>, tag?: string): Value;
|
|
36
|
-
rank(call: Call<string>, texts: Value, opts: Value, tag?: string): Value;
|
|
37
|
-
tag(call: Call<string>, tag?: string): Value;
|
|
38
|
-
upper(call: Call<string>, s: Value, tag?: string): Value;
|
|
39
|
-
};
|
|
40
|
-
/** The Host resolves tags and provides every Operation for each Locale. */
|
|
41
|
-
declare const localeCapability: (impl: LocaleImpl, costs: Costs) => CapabilityDef<string>;
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/sqlite-capability.d.ts
|
|
44
|
-
/**
|
|
45
|
-
* sqlite is optional (chapter 7, ADR 0070). The binding names a database the
|
|
46
|
-
* Host keeps; tables, when present, limits the tables a Grant may use, and
|
|
47
|
-
* maxRows caps the rows a call may give.
|
|
48
|
-
*/
|
|
49
|
-
type SqliteBinding = {
|
|
50
|
-
readonly database: string;
|
|
51
|
-
readonly maxRows: number;
|
|
52
|
-
readonly tables?: readonly string[];
|
|
53
|
-
};
|
|
54
|
-
/** NULL, INTEGER, REAL, TEXT and BLOB. */
|
|
55
|
-
type SqlValue = null | bigint | number | string | Uint8Array;
|
|
56
|
-
/** A list binds `?` and `?NNN`; a Map binds `:name`, keyed without the colon. */
|
|
57
|
-
type SqlParams = readonly SqlValue[] | ReadonlyMap<string, SqlValue>;
|
|
58
|
-
type SqlRows = {
|
|
59
|
-
readonly columns: readonly string[];
|
|
60
|
-
readonly rows: readonly (readonly SqlValue[])[];
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* The Core has checked the Shapes and max, converted params by the chapter 7
|
|
64
|
-
* rules and charged max × perRow. It converts the result, raising `sql` for a
|
|
65
|
-
* column named twice and `unrepresentable` for a double it can't hold.
|
|
66
|
-
* change, begin, commit and rollback are Segment-bound: they act inside the
|
|
67
|
-
* calling Segment's transaction, which the coordinator publishes or discards.
|
|
68
|
-
* begin, commit and rollback open, release and roll back a savepoint. A failed
|
|
69
|
-
* call leaves the database as it was. Throw ScriptError `sql` {reason},
|
|
70
|
-
* `constraint` {kind}, `sqlite busy`, `not read-only`, `too many rows` {max},
|
|
71
|
-
* or `unrepresentable` {column} for TEXT that isn't valid UTF-8 (chapter 9).
|
|
72
|
-
*/
|
|
73
|
-
type SqliteImpl = {
|
|
74
|
-
begin(call: Call<SqliteBinding>): void;
|
|
75
|
-
change(call: Call<SqliteBinding>, sql: string, params: SqlParams, max: number): SqlRows & {
|
|
76
|
-
readonly changes: number;
|
|
77
|
-
};
|
|
78
|
-
commit(call: Call<SqliteBinding>): void;
|
|
79
|
-
/** Called once per Grant. The same database gives the same coordinator. */
|
|
80
|
-
coordinator(database: string): SegmentCoordinator;
|
|
81
|
-
query(call: Call<SqliteBinding>, sql: string, params: SqlParams, max: number): SqlRows;
|
|
82
|
-
rollback(call: Call<SqliteBinding>): void;
|
|
83
|
-
};
|
|
84
|
-
/** Optional for Hosts. perRow is whole Fuel charged per row of max. */
|
|
85
|
-
declare const sqliteCapability: (impl: SqliteImpl, costs: Costs, perRow: number) => CapabilityDef<SqliteBinding>;
|
|
86
|
-
//#endregion
|
|
87
|
-
export { SqliteImpl as a, localeCapability as c, Costs as d, TimerImpl as f, timerCapability as g, consoleCapability as h, SqliteBinding as i, CalendarImpl as l, clockCapability as m, SqlRows as n, sqliteCapability as o, calendarCapability as p, SqlValue as r, LocaleImpl as s, SqlParams as t, ConsoleImpl as u };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { At as Call, Yt as SegmentLifecycle, at as Value, jt as CapabilityDef, zt as GrantContext } from "./debug-D8Z_u244.js";
|
|
2
|
-
import { d as Costs } from "./sqlite-capability-C7-SYdD7.js";
|
|
3
|
-
//#region src/store-capability.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* The binding is the Store's name. `set`, `delete`, `increment` and `swap`
|
|
6
|
-
* act on the calling Segment's pending writes, to every Store it writes,
|
|
7
|
-
* which `commit` applies together and `rollback` discards (chapter 7,
|
|
8
|
-
* ADR 0062). The implementation is the Segment Coordinator of every binding,
|
|
9
|
-
* so its hooks see each enrolled Store's Grant (ADR 0069). Watch registrations
|
|
10
|
-
* are final at the call, independent of the participant, and release drops
|
|
11
|
-
* their owner when the named Grant stops being effective (ADR 0061).
|
|
12
|
-
*/
|
|
13
|
-
type StoreImpl = SegmentLifecycle<string> & {
|
|
14
|
-
delete(call: Call<string>, key: string): void;
|
|
15
|
-
get(call: Call<string>, key: string, fallback?: Value): Value;
|
|
16
|
-
increment(call: Call<string>, key: string, by?: Value): Value;
|
|
17
|
-
keys(call: Call<string>, prefix?: string): Value;
|
|
18
|
-
release(context: GrantContext<string>): void;
|
|
19
|
-
set(call: Call<string>, key: string, value: Value): void;
|
|
20
|
-
swap(call: Call<string>, key: string, expected: Value, replacement: Value): boolean;
|
|
21
|
-
unwatch(call: Call<string>, name: string): void;
|
|
22
|
-
watch(call: Call<string>, name: string, prefix: string, message: string): void;
|
|
23
|
-
};
|
|
24
|
-
/** The `+` rules outside any Run, uncharged (chapter 9, Adding). */
|
|
25
|
-
declare const add: (a: Value, b: Value) => Value;
|
|
26
|
-
/** The Store is the Host's; the Grant binding names it, and `impl` coordinates every binding. */
|
|
27
|
-
declare const storeCapability: (impl: StoreImpl, costs: Costs) => CapabilityDef<string>;
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/user-capability.d.ts
|
|
30
|
-
/** An omitted prompt, default or title is "". */
|
|
31
|
-
type UserImpl = {
|
|
32
|
-
choose(call: Call<unknown>, items: readonly string[], prompt: string, multiple: boolean): void;
|
|
33
|
-
confirm(call: Call<unknown>, message: string): void;
|
|
34
|
-
enter(call: Call<unknown>, message: string, fallback: string): void;
|
|
35
|
-
notify(call: Call<unknown>, message: string, title: string): void;
|
|
36
|
-
};
|
|
37
|
-
/** Optional for Hosts. The binding is ignored. */
|
|
38
|
-
declare const userCapability: (impl: UserImpl, costs: Costs) => CapabilityDef<unknown>;
|
|
39
|
-
//#endregion
|
|
40
|
-
export { storeCapability as a, add as i, userCapability as n, StoreImpl as r, UserImpl as t };
|