@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/README.md
CHANGED
|
@@ -4,24 +4,28 @@ NorthTalk is a readable, conversational scripting language for embedding in appl
|
|
|
4
4
|
|
|
5
5
|
The [Spec](https://github.com/odogono/odgn-talk/tree/main/spec) defines the language, and the [TS guide](https://github.com/odogono/odgn-talk/tree/main/impl/ts#readme) describes this implementation.
|
|
6
6
|
|
|
7
|
+
For a walkthrough from the first Handler to asynchronous application services,
|
|
8
|
+
see [Embed the TS Core in a TypeScript app](https://github.com/odogono/odgn-talk/blob/main/docs/embedding-typescript.md).
|
|
9
|
+
|
|
7
10
|
```sh
|
|
8
11
|
npm install @northtalk/ts
|
|
9
12
|
```
|
|
10
13
|
|
|
11
14
|
```ts
|
|
12
|
-
import {
|
|
15
|
+
import { createCore, num } from '@northtalk/ts';
|
|
16
|
+
import { newDrivenGroup } from '@northtalk/ts/driver';
|
|
13
17
|
|
|
14
|
-
const group =
|
|
18
|
+
const { group, drive } = newDrivenGroup(createCore(), { name: 'example' });
|
|
15
19
|
const script = group.load({
|
|
16
20
|
name: 'main',
|
|
17
21
|
source: 'on total a, b\n return a + b\nend total',
|
|
18
22
|
});
|
|
19
23
|
const reply = script.request({ name: 'total', args: [num(2), num(3)] });
|
|
20
|
-
group.pump(parseInstant('2026-10-17T09:00:00Z'));
|
|
21
24
|
console.log((await reply.result).toString()); // 5
|
|
25
|
+
await drive.close();
|
|
22
26
|
```
|
|
23
27
|
|
|
24
|
-
A Host
|
|
28
|
+
A Host can create a Group ready to pump from the event loop with `newDrivenGroup`, or use `newGroup` and drive it with its own `pump` loop. Before releasing application resources, `await drive.close()` stops Scripts and awaits Promise-backed Operation cleanup. The driver also supports async disposal with `await using`.
|
|
25
29
|
|
|
26
30
|
## Subpaths
|
|
27
31
|
|
|
@@ -29,7 +33,7 @@ A Host drives each Group with `pump`. `@northtalk/ts/driver` pumps one from the
|
|
|
29
33
|
| ----------------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
30
34
|
| `@northtalk/ts` | Values, Groups, Scripts, Libraries, Capabilities, Object Kinds, save and restore, and the parser and checker |
|
|
31
35
|
| `@northtalk/ts/session` | The Session Host, for a REPL or playground, and Session Transcripts |
|
|
32
|
-
| `@northtalk/ts/driver` | `autoDrive`, which
|
|
36
|
+
| `@northtalk/ts/driver` | `newDrivenGroup` and `autoDrive`, which pump a Group from the event loop |
|
|
33
37
|
| `@northtalk/ts/store` | The Store Standard Capability |
|
|
34
38
|
| `@northtalk/ts/notify` | The Store notification router |
|
|
35
39
|
| `@northtalk/ts/sqlite` | A `sqlite` implementation on `node:sqlite`, for server Hosts |
|