@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.
Files changed (54) hide show
  1. package/README.md +9 -5
  2. package/{encoding-DWlbPq-e.js → base64-DORMd3Hv.js} +197 -1368
  3. package/binary-value-CEmh60GC.d.ts +15 -0
  4. package/capabilities-CH0FkRMq.js +1301 -0
  5. package/checker-Dc1jl2WH.js +6657 -0
  6. package/core-DptnvQT9.d.ts +14 -0
  7. package/{debug-D8Z_u244.d.ts → debug-CQBxKnJB.d.ts} +1147 -780
  8. package/debug.d.ts +2 -1
  9. package/debug.js +2 -1
  10. package/driver.d.ts +16 -2
  11. package/driver.js +98 -20
  12. package/encoding-nlrpj-Pb.js +99 -0
  13. package/{engine-CgCMdGGd.js → engine-BGaJ9dAk.js} +7 -5
  14. package/{engine-BPFnHT9N.d.ts → engine-vbYInVYF.d.ts} +3 -3
  15. package/{errors-DHwz1Vho.js → errors-LYJZ_c8h.js} +91 -17
  16. package/{group-B4eyJKTA.js → group-B742gg4T.js} +1490 -7278
  17. package/{sqlite-capability-CrCej3Po.js → http-capability-CSTkw1Yt.js} +255 -5
  18. package/http.d.ts +59 -0
  19. package/http.js +465 -0
  20. package/index.d.ts +23 -17
  21. package/index.js +19 -12
  22. package/manifest-BscyH_rW.d.ts +70 -0
  23. package/{manifest-DKe2Je6Z.js → manifest-DjsxDSuB.js} +11 -90
  24. package/message-layer.d.ts +12 -0
  25. package/message-layer.js +4 -0
  26. package/notify.d.ts +2 -1
  27. package/notify.js +2 -1
  28. package/{objects-MeXIDDFo.d.ts → objects-DJ3QtCCs.d.ts} +23 -8
  29. package/objects-Db7IB5vQ.js +91 -0
  30. package/operation-promises-EgZXG5N_.js +23 -0
  31. package/package.json +9 -1
  32. package/readers-BFPuosPk.d.ts +25 -0
  33. package/{readers-DyjxJEkL.js → readers-CjJHKHvH.js} +6 -3
  34. package/request-pump-binary-DdY3X-yl.js +2246 -0
  35. package/{router-DHPJNvbt.js → router--71qvxtY.js} +8 -6
  36. package/{router-DpDpAJjz.d.ts → router-Zhrw5l__.d.ts} +6 -5
  37. package/session.d.ts +2 -1
  38. package/session.js +58 -24
  39. package/setup.d.ts +2 -1
  40. package/setup.js +8 -4
  41. package/{sha256-0jiTgVJu.js → sha256-B_kyYw3Z.js} +1 -0
  42. package/sqlite.d.ts +3 -4
  43. package/sqlite.js +6 -5
  44. package/{store-capability-CDoVafZL.js → store-capability-OZp4hXmj.js} +10 -7
  45. package/{store-DrYjcoru.js → store-hJrRULMx.js} +3 -2
  46. package/store.d.ts +3 -2
  47. package/store.js +3 -2
  48. package/{user-capability-Cv0oJhhv.js → user-capability-BK4Asg7D.js} +8 -5
  49. package/wasm.d.ts +42 -22
  50. package/wasm.js +330 -46
  51. package/core-eU5KaYkz.d.ts +0 -23
  52. package/readers-Oh4tO2dK.d.ts +0 -57
  53. package/sqlite-capability-C7-SYdD7.d.ts +0 -87
  54. 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 { newGroup, num, parseInstant } from '@northtalk/ts';
15
+ import { createCore, num } from '@northtalk/ts';
16
+ import { newDrivenGroup } from '@northtalk/ts/driver';
13
17
 
14
- const group = newGroup({ name: 'example' });
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 drives each Group with `pump`. `@northtalk/ts/driver` pumps one from the event loop.
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 pumps a Group from the event loop |
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 |