@northtalk/ts 0.7.0 → 0.9.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/{binary-value-M8v567iA.d.ts → binary-value-B93hEK7l.d.ts} +1 -1
  2. package/{checker-Coml0Tf9.js → checker-D74oYIhs.js} +21 -16
  3. package/{core-D4qYURer.d.ts → core-BBPI6EhG.d.ts} +1 -1
  4. package/{debug-C_Ob5rkl.d.ts → debug-s6QIovKS.d.ts} +18 -3
  5. package/debug.d.ts +1 -1
  6. package/debug.js +1 -1
  7. package/{driver-CLi_OmyQ.d.ts → driver-D5yrK3Nu.d.ts} +1 -1
  8. package/driver.d.ts +1 -1
  9. package/driver.js +1 -1
  10. package/{encoding-BL2ECJmg.js → encoding-DzVFpg7k.js} +2 -2
  11. package/{engine-DhBk0lTt.js → engine-Bx8B63iQ.js} +6 -6
  12. package/{engine-BBNHy4-F.d.ts → engine-Dy-BCoiw.d.ts} +2 -2
  13. package/{errors-P3ga1I-9.js → errors-CNc-xY_9.js} +35 -4
  14. package/{group-BqccKTWz.js → group-CY4FKhzT.js} +122 -54
  15. package/{http-fetch-DA-NbFIM.js → http-fetch-DnpfiOWK.js} +2 -2
  16. package/http.d.ts +1 -1
  17. package/http.js +4 -4
  18. package/index.d.ts +5 -5
  19. package/index.js +15 -15
  20. package/{lean-CFLJ9VrX.d.ts → lean-Bg_UTRj0.d.ts} +20 -5
  21. package/{lean-BJmLobmd.js → lean-DTCTJUmR.js} +10 -10
  22. package/lean.d.ts +5 -5
  23. package/lean.js +15 -15
  24. package/{manifest-37x-HSxH.js → manifest-DVS1SEmN.js} +3 -3
  25. package/message-layer.d.ts +2 -2
  26. package/message-layer.js +2 -2
  27. package/notify.d.ts +1 -1
  28. package/notify.js +1 -1
  29. package/{objects-DE6kRk0r.js → objects-OKVLH190.js} +1 -1
  30. package/{objects-DVlpWsi0.d.ts → objects-q0lnCK-4.d.ts} +2 -1
  31. package/{operations-CGjDlkGU.js → operations-B3XaG7Ve.js} +174 -54
  32. package/package.json +1 -1
  33. package/{peer-capability-elnbQy-J.js → peer-capability-3etyPHs3.js} +7 -5
  34. package/peer.d.ts +8 -1
  35. package/peer.js +29 -12
  36. package/{readers-ChQ0e92c.d.ts → readers-AeB1bJ--.d.ts} +1 -1
  37. package/{readers-yMS1eAOp.js → readers-G1lHqrPl.js} +1 -1
  38. package/{request-pump-binary-BS1J8DF2.js → request-pump-binary-VOPVqRZD.js} +9 -4
  39. package/{router-Bm7A2kjt.js → router-Bdm4KiMG.js} +4 -4
  40. package/{router-D0rf5SkW.d.ts → router-DXoJ_2Z4.d.ts} +2 -2
  41. package/session.d.ts +2 -2
  42. package/session.js +15 -15
  43. package/setup.d.ts +2 -2
  44. package/setup.js +6 -5
  45. package/sqlite.d.ts +2 -2
  46. package/sqlite.js +5 -5
  47. package/{store-D80OlpyG.js → store-BTcyKBLg.js} +2 -2
  48. package/{store-capability-DBLlWaNO.js → store-capability-CBJ6mUoH.js} +3 -3
  49. package/store.d.ts +2 -2
  50. package/store.js +2 -2
  51. package/{user-capability-D6hGa3eF.js → user-capability-DNY2dyjq.js} +3 -3
  52. package/wasm.d.ts +5 -5
  53. package/wasm.js +15 -13
  54. package/{inline-grants-BT2nnfLA.js → zone-rules-DsCJtmlC.js} +88 -5
@@ -1,19 +1,19 @@
1
1
 
2
- import { sn as unicodeVersion } from "./errors-P3ga1I-9.js";
3
- import { i as restore, l as compileLibrary, r as newGroup, s as stateFingerprint } from "./group-BqccKTWz.js";
4
- import { t as defineObjectKind } from "./objects-DE6kRk0r.js";
5
- import { dt as costModel, pt as languageVersion, yt as defineCapability } from "./operations-CGjDlkGU.js";
6
- import { a as clockCapability, d as timerCapability, i as calendarCapability, o as consoleCapability, u as musicalClockCapability } from "./encoding-BL2ECJmg.js";
7
- import { a as peerKind, i as peerCapability } from "./peer-capability-elnbQy-J.js";
8
- import { a as sqliteCapability, i as httpCapability, n as createGroup$1 } from "./inline-grants-BT2nnfLA.js";
9
- import { n as localeCapability, t as userCapability } from "./user-capability-D6hGa3eF.js";
10
- import { r as storeCapability } from "./store-capability-DBLlWaNO.js";
2
+ import { fn as unicodeVersion } from "./errors-CNc-xY_9.js";
3
+ import { i as restore, l as compileLibrary, r as newGroup, s as stateFingerprint } from "./group-CY4FKhzT.js";
4
+ import { t as defineObjectKind } from "./objects-OKVLH190.js";
5
+ import { bt as defineCapability, dt as costModel, pt as languageVersion } from "./operations-B3XaG7Ve.js";
6
+ import { a as clockCapability, d as timerCapability, i as calendarCapability, o as consoleCapability, u as musicalClockCapability } from "./encoding-DzVFpg7k.js";
7
+ import { a as peerKind, i as peerCapability } from "./peer-capability-3etyPHs3.js";
8
+ import { a as httpCapability, o as sqliteCapability, r as createGroup$1 } from "./zone-rules-DsCJtmlC.js";
9
+ import { n as localeCapability, t as userCapability } from "./user-capability-DNY2dyjq.js";
10
+ import { r as storeCapability } from "./store-capability-CBJ6mUoH.js";
11
11
  //#region src/versions.ts
12
12
  const coreVersions = Object.freeze({
13
13
  language: languageVersion,
14
14
  costModel: String(costModel.version),
15
15
  unicode: unicodeVersion,
16
- core: "ts/0.7.0",
16
+ core: "ts/0.9.0",
17
17
  saveFormat: String(1)
18
18
  });
19
19
  //#endregion
package/lean.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /// <reference lib="esnext.disposable" />
2
- import { $ as instant, $n as waitUs, $t as Group, A as ScriptSources, An as consoleCapability, Ar as Mode, At as FireOp, B as restore, Bn as LimitName, Bt as ReleaseHook, C as Report, Cn as CalendarImpl, Cr as SemanticName, Ct as ChargeRequest, Dn as TimerImpl, Dr as SemanticTree, Dt as EffectResult, E as RestoreResult, En as MusicalClockImpl, Er as SemanticToken, Et as Cost, Fn as LibrarySource, Fr as SyntaxNode, Ft as Metering, G as RunStarted, Gn as Script, Gt as SegmentGrant, H as RunAccounting, Hn as Outcome, Ht as ScopeDecl, In as OperationRef, Ir as SyntaxRule, It as Operation, J as Value, Jn as defaultLimits, Jt as SuspendingOp, K as Decimal, Kn as UnitLoadError, Kt as SegmentLifecycle, L as TsScript, Ln as codeIdentity, Lr as Trivia, Lt as Operations, Mn as timerCapability, Mr as Token, Mt as GrantContext, N as Settlement, Nn as Library, Nr as SyntaxElement, Nt as ImmediateOp, O as SaveOptions, On as calendarCapability, Or as SourceSpan, Ot as ErrorDecl, P as TsGroup, Pn as LibraryOptions, Pr as SyntaxErrorCode, Pt as LimitReached, Q as dec, Qn as canConvert, Qt as Core, R as Verdict, Rn as compileLibrary, Rr as syntaxSelector, Rt as PlainArg, S as PumpedRequest, Sn as localeCapability, Sr as SemanticElement, St as CapabilityDefiner, T as RestoreOptions, Tn as Costs, Tr as SemanticScope, Tt as CoordinatedLifecycle, U as RunAncestry, Un as Run, Ut as SegmentContext, V as CausalWork, Vn as Limits, Vt as ReleaseReason, W as RunDiscarded, Wn as RunRecord, Wt as SegmentCoordinator, X as bytes, Xn as loadScript, Xt as operationDeclarations, Y as bool, Yn as deliver, Yt as defineCapability, Z as civilDate, Zn as NotImplementedError, Zt as shape, _ as LoadOptions, _n as SqlValue, _r as BindingKind, _t as PropDef, an as peerKind, ar as ScriptError, at as quantity, b as PumpOptions, bn as sqliteCapability, br as LibraryExport, bt as Call, cn as HttpServerImpl, cr as BodyKind, d as Counters, dn as userCapability, dr as EventEntry, dt as nowMicros, en as Script$1, er as HostError, f as Decided, fn as StoreImpl, fr as Instruction, ft as parseInstant, g as Inspection, gn as SqlRows, gr as Binding, gt as ObjectKindDef, h as GroupOptions, hn as SqlParams, hr as disassemble, ht as ObjectKind, in as peerCapability, ir as MailboxFull, it as num, jn as musicalClockCapability, jr as TokType, jt as Grant, k as ScriptCodeRequest, kn as clockCapability, kr as Lexer, kt as FieldShape, l as CancellationOptions, ln as httpCapability, lr as CodeUnit, lt as text, m as EffectFailure, mn as storeCapability, mr as UnwindEntry, mt as ObjectElements, nn as coreVersions, nr as LoadDiagnostic, nt as map, on as HttpClientImpl, or as SendFailedReason, ot as range, p as Deciding, pn as add, pr as Operand, pt as HostObject, q as Kind, qn as callFunction, qt as Shape, rn as PeerImpl, rr as LoadError, rt as nothing, sn as HttpImpl, sr as Body, st as record, tn as Versions, tr as HostErrorCode, tt as list, u as CarryOver, un as UserImpl, ur as EventBranch, ut as formatInstant, v as Message, vn as SqliteBinding, vr as ExportKind, vt as defineObjectKind, w as Requested, wn as ConsoleImpl, wr as SemanticNode, wt as ChargeResult, x as PumpResult, xn as LocaleImpl, xr as NameRole, xt as CapabilityDef, y as PendingCall, yn as SqliteImpl, yr as FunctionContract, yt as GrantDecls, z as newGroup, zr as syntaxText, zt as PlainResult } from "./debug-C_Ob5rkl.js";
2
+ import { $ as instant, $n as NotImplementedError, $t as shape, A as ScriptSources, An as calendarCapability, Ar as SourceSpan, At as FireOp, B as restore, Bn as compileLibrary, Br as syntaxSelector, Bt as ReleaseHook, C as Report, Cn as LocaleImpl, Cr as NameRole, Ct as ChargeRequest, Dn as Costs, Dr as SemanticScope, Dt as EffectResult, E as RestoreResult, En as ConsoleImpl, Er as SemanticNode, Et as Cost, Fn as Library, Fr as SyntaxElement, Ft as Metering, G as RunStarted, Gn as Run, Gt as SegmentGrant, H as RunAccounting, Hn as LimitName, Ht as ScopeDecl, In as LibraryOptions, Ir as SyntaxErrorCode, It as Operation, J as Value, Jn as UnitLoadError, Jt as SuspendingOp, K as Decimal, Kn as RunRecord, Kt as SegmentLifecycle, L as TsScript, Ln as LibrarySource, Lr as SyntaxNode, Lt as Operations, Mn as consoleCapability, Mr as Mode, Mt as GrantContext, N as Settlement, Nn as musicalClockCapability, Nr as TokType, Nt as ImmediateOp, O as SaveOptions, On as MusicalClockImpl, Or as SemanticToken, Ot as ErrorDecl, P as TsGroup, Pn as timerCapability, Pr as Token, Pt as LimitReached, Q as dec, Qn as loadScript, Qt as operationDeclarations, R as Verdict, Rn as OperationRef, Rr as SyntaxRule, Rt as PlainArg, S as PumpedRequest, Sn as sqliteCapability, Sr as LibraryExport, St as CapabilityDefiner, T as RestoreOptions, Tn as CalendarImpl, Tr as SemanticName, Tt as CoordinatedLifecycle, U as RunAncestry, Un as Limits, Ut as SegmentContext, V as CausalWork, Vr as syntaxText, Vt as ReleaseReason, W as RunDiscarded, Wn as Outcome, Wt as SegmentCoordinator, X as bytes, Xn as defaultLimits, Xt as defineCapability, Y as bool, Yn as callFunction, Yt as conforms, Z as civilDate, Zn as deliver, Zt as explain, _ as LoadOptions, _n as SqlParams, _r as disassemble, _t as PropDef, an as PeerImpl, ar as LoadError, at as quantity, b as PumpOptions, bn as SqliteBinding, br as ExportKind, bt as Call, cn as HttpClientImpl, cr as SendFailedReason, d as Counters, dn as httpCapability, dr as CodeUnit, dt as nowMicros, en as Core, er as canConvert, f as Decided, fn as UserImpl, fr as EventBranch, ft as parseInstant, g as Inspection, gn as storeCapability, gr as UnwindEntry, gt as ObjectKindDef, h as GroupOptions, hn as add, hr as Operand, ht as ObjectKind, in as coreVersions, ir as LoadDiagnostic, it as num, jn as clockCapability, jr as Lexer, jt as Grant, k as ScriptCodeRequest, kn as TimerImpl, kr as SemanticTree, kt as FieldShape, l as CancellationOptions, ln as HttpImpl, lr as Body, lt as text, m as EffectFailure, mn as StoreImpl, mr as Instruction, mt as ObjectElements, nn as Script$1, nr as HostError, nt as map, on as peerCapability, or as MailboxFull, ot as range, p as Deciding, pn as userCapability, pr as EventEntry, pt as HostObject, q as Kind, qn as Script, qt as Shape, rn as Versions, rr as HostErrorCode, rt as nothing, sn as peerKind, sr as ScriptError, st as record, tn as Group, tr as waitUs, tt as list, u as CarryOver, un as HttpServerImpl, ur as BodyKind, ut as formatInstant, v as Message, vn as SqlRows, vr as Binding, vt as defineObjectKind, w as Requested, wn as localeCapability, wr as SemanticElement, wt as ChargeResult, x as PumpResult, xn as SqliteImpl, xr as FunctionContract, xt as CapabilityDef, y as PendingCall, yn as SqlValue, yr as BindingKind, yt as GrantDecls, z as newGroup, zn as codeIdentity, zr as Trivia, zt as PlainResult } from "./debug-s6QIovKS.js";
3
3
  import { n as registerStdlib, r as stdlibNames, t as StdlibLibrary } from "./stdlib-registry-BwitI3Ox.js";
4
- import { $ as units, A as PlainValue, B as checkSource, C as decodeJson, D as kindNames, E as shapeData, F as CheckOptions, G as ParseResult, H as EntryKind, I as CheckResult, J as parseEntry, K as RecoveringParseResult, L as Diagnostic, M as fromValue, N as toValue, O as encodeValue, P as talk, Q as grammar, R as DiagnosticCode, S as handlersOf, T as ShapeData, U as EntryResult, V as checkSyntax, W as ParseError, X as parseSourceRecovering, Y as parseSource, Z as builtins, a as LoweringError, b as Handlers, c as lowerTree, d as exportManifest, f as InlineFunction, g as createGroup, h as CreateGroupOptions, i as CompileResult, j as ToValueOptions, k as FromValueOptions, l as ManifestSpec, m as inlineGrants, n as declarationStart, o as compileSource, p as InlineOperation, q as RecoveryDiagnostic, r as CompileOptions, s as exportsOf, t as validMessageSelector, u as MessageDecl, v as DrivenGroup, w as encodeJson, x as ScriptWithHandlers, z as SemanticResult } from "./lean-CFLJ9VrX.js";
5
- import { n as createCore, t as TsCore } from "./core-D4qYURer.js";
6
- import { a as decodeValue, o as readDisplay, t as FunctionResolver } from "./readers-ChQ0e92c.js";
7
- export { type Binding, type BindingKind, type Body, type BodyKind, type CalendarImpl, type Call, type CancellationOptions, type CapabilityDef, type CapabilityDefiner, type CarryOver, type CausalWork, type ChargeRequest, type ChargeResult, type CheckOptions, type CheckResult, type CodeUnit, type CompileOptions, type CompileResult, Script as CompiledScript, type ConsoleImpl, type CoordinatedLifecycle, type Core, type Cost, type Costs, type Counters, type CreateGroupOptions, type Decided, type Deciding, Decimal, type Diagnostic, type DiagnosticCode, type DrivenGroup, type EffectFailure, type EffectResult, type EntryKind, type EntryResult, type ErrorDecl, type EventBranch, type EventEntry, type ExportKind, type FieldShape, type FireOp, type FromValueOptions, type FunctionContract, type FunctionResolver, type Grant, type GrantContext, type GrantDecls, type Group, type GroupOptions, type Handlers, HostError, type HostErrorCode, type HostObject, type HttpClientImpl, type HttpImpl, type HttpServerImpl, type ImmediateOp, type InlineFunction, type InlineOperation, type Inspection, type Instruction, type Kind, Lexer, type Library, type LibraryExport, type LibraryOptions, type LibrarySource, type LimitName, LimitReached, type Limits, type LoadDiagnostic, LoadError, type LoadOptions, type LocaleImpl, LoweringError, MailboxFull, type ManifestSpec, type Message, type MessageDecl, type Metering, type Mode, type MusicalClockImpl, type NameRole, NotImplementedError, type ObjectElements, type ObjectKind, type ObjectKindDef, type Operand, type Operation, type OperationRef, type Operations, type Outcome, ParseError, type ParseResult, type PeerImpl, type PendingCall, type PlainArg, type PlainResult, type PlainValue, type PropDef, type PumpOptions, type PumpResult, type PumpedRequest, type RecoveringParseResult, type RecoveryDiagnostic, type ReleaseHook, type ReleaseReason, type Report, type Requested, type RestoreOptions, type RestoreResult, Run, type RunAccounting, type RunAncestry, type RunDiscarded, type RunRecord, type RunStarted, type SaveOptions, type ScopeDecl, type Script$1 as Script, type ScriptCodeRequest, ScriptError, type ScriptSources, type ScriptWithHandlers, type SegmentContext, type SegmentCoordinator, type SegmentGrant, type SegmentLifecycle, type SemanticElement, type SemanticName, type SemanticNode, type SemanticResult, type SemanticScope, type SemanticToken, type SemanticTree, type SendFailedReason, type Settlement, type Shape, type ShapeData, type SourceSpan, type SqlParams, type SqlRows, type SqlValue, type SqliteBinding, type SqliteImpl, type StdlibLibrary, type StoreImpl, type SuspendingOp, type SyntaxElement, type SyntaxErrorCode, type SyntaxNode, type SyntaxRule, type TimerImpl, type ToValueOptions, type TokType, type Token, type Trivia, type TsCore, TsGroup, TsScript, UnitLoadError, type UnwindEntry, type UserImpl, Value, type Verdict, type Versions, add, bool, builtins, bytes, calendarCapability, callFunction, canConvert, checkSource, checkSyntax, civilDate, clockCapability, codeIdentity, compileLibrary, compileSource, consoleCapability, coreVersions, createCore, createGroup, dec, declarationStart, decodeJson, decodeValue, defaultLimits, defineCapability, defineObjectKind, deliver, disassemble, encodeJson, encodeValue, exportManifest, exportsOf, formatInstant, fromValue, grammar, handlersOf, httpCapability, inlineGrants, instant, kindNames, list, loadScript, localeCapability, lowerTree, map, musicalClockCapability, newGroup, nothing, nowMicros, num, operationDeclarations, parseEntry, parseInstant, parseSource, parseSourceRecovering, peerCapability, peerKind, quantity, range, readDisplay, record, registerStdlib, restore, shape, shapeData, sqliteCapability, stdlibNames, storeCapability, syntaxSelector, syntaxText, talk, text, timerCapability, toValue, units, userCapability, validMessageSelector, waitUs };
4
+ import { $ as grammar, A as FromValueOptions, B as SemanticResult, C as handlersOf, D as shapeData, E as ShapeData, F as talk, G as ParseError, H as checkSyntax, I as CheckOptions, J as RecoveryDiagnostic, K as ParseResult, L as CheckResult, M as ToValueOptions, N as fromValue, O as kindNames, P as toValue, Q as builtins, R as Diagnostic, S as ScriptWithHandlers, T as encodeJson, U as EntryKind, V as checkSource, W as EntryResult, X as parseSource, Y as parseEntry, Z as parseSourceRecovering, _ as createGroup, a as LoweringError, c as lowerTree, d as exportManifest, et as units, f as zoneRules, g as CreateGroupOptions, h as inlineGrants, i as CompileResult, j as PlainValue, k as encodeValue, l as ManifestSpec, m as InlineOperation, n as declarationStart, o as compileSource, p as InlineFunction, q as RecoveringParseResult, r as CompileOptions, s as exportsOf, t as validMessageSelector, u as MessageDecl, w as decodeJson, x as Handlers, y as DrivenGroup, z as DiagnosticCode } from "./lean-Bg_UTRj0.js";
5
+ import { n as createCore, t as TsCore } from "./core-BBPI6EhG.js";
6
+ import { a as decodeValue, o as readDisplay, t as FunctionResolver } from "./readers-AeB1bJ--.js";
7
+ export { type Binding, type BindingKind, type Body, type BodyKind, type CalendarImpl, type Call, type CancellationOptions, type CapabilityDef, type CapabilityDefiner, type CarryOver, type CausalWork, type ChargeRequest, type ChargeResult, type CheckOptions, type CheckResult, type CodeUnit, type CompileOptions, type CompileResult, Script as CompiledScript, type ConsoleImpl, type CoordinatedLifecycle, type Core, type Cost, type Costs, type Counters, type CreateGroupOptions, type Decided, type Deciding, Decimal, type Diagnostic, type DiagnosticCode, type DrivenGroup, type EffectFailure, type EffectResult, type EntryKind, type EntryResult, type ErrorDecl, type EventBranch, type EventEntry, type ExportKind, type FieldShape, type FireOp, type FromValueOptions, type FunctionContract, type FunctionResolver, type Grant, type GrantContext, type GrantDecls, type Group, type GroupOptions, type Handlers, HostError, type HostErrorCode, type HostObject, type HttpClientImpl, type HttpImpl, type HttpServerImpl, type ImmediateOp, type InlineFunction, type InlineOperation, type Inspection, type Instruction, type Kind, Lexer, type Library, type LibraryExport, type LibraryOptions, type LibrarySource, type LimitName, LimitReached, type Limits, type LoadDiagnostic, LoadError, type LoadOptions, type LocaleImpl, LoweringError, MailboxFull, type ManifestSpec, type Message, type MessageDecl, type Metering, type Mode, type MusicalClockImpl, type NameRole, NotImplementedError, type ObjectElements, type ObjectKind, type ObjectKindDef, type Operand, type Operation, type OperationRef, type Operations, type Outcome, ParseError, type ParseResult, type PeerImpl, type PendingCall, type PlainArg, type PlainResult, type PlainValue, type PropDef, type PumpOptions, type PumpResult, type PumpedRequest, type RecoveringParseResult, type RecoveryDiagnostic, type ReleaseHook, type ReleaseReason, type Report, type Requested, type RestoreOptions, type RestoreResult, Run, type RunAccounting, type RunAncestry, type RunDiscarded, type RunRecord, type RunStarted, type SaveOptions, type ScopeDecl, type Script$1 as Script, type ScriptCodeRequest, ScriptError, type ScriptSources, type ScriptWithHandlers, type SegmentContext, type SegmentCoordinator, type SegmentGrant, type SegmentLifecycle, type SemanticElement, type SemanticName, type SemanticNode, type SemanticResult, type SemanticScope, type SemanticToken, type SemanticTree, type SendFailedReason, type Settlement, type Shape, type ShapeData, type SourceSpan, type SqlParams, type SqlRows, type SqlValue, type SqliteBinding, type SqliteImpl, type StdlibLibrary, type StoreImpl, type SuspendingOp, type SyntaxElement, type SyntaxErrorCode, type SyntaxNode, type SyntaxRule, type TimerImpl, type ToValueOptions, type TokType, type Token, type Trivia, type TsCore, TsGroup, TsScript, UnitLoadError, type UnwindEntry, type UserImpl, Value, type Verdict, type Versions, add, bool, builtins, bytes, calendarCapability, callFunction, canConvert, checkSource, checkSyntax, civilDate, clockCapability, codeIdentity, compileLibrary, compileSource, conforms, consoleCapability, coreVersions, createCore, createGroup, dec, declarationStart, decodeJson, decodeValue, defaultLimits, defineCapability, defineObjectKind, deliver, disassemble, encodeJson, encodeValue, explain, exportManifest, exportsOf, formatInstant, fromValue, grammar, handlersOf, httpCapability, inlineGrants, instant, kindNames, list, loadScript, localeCapability, lowerTree, map, musicalClockCapability, newGroup, nothing, nowMicros, num, operationDeclarations, parseEntry, parseInstant, parseSource, parseSourceRecovering, peerCapability, peerKind, quantity, range, readDisplay, record, registerStdlib, restore, shape, shapeData, sqliteCapability, stdlibNames, storeCapability, syntaxSelector, syntaxText, talk, text, timerCapability, toValue, units, userCapability, validMessageSelector, waitUs, zoneRules };
package/lean.js CHANGED
@@ -1,16 +1,16 @@
1
1
 
2
- import { G as record, H as quantity, Jt as parseInstant, Kt as nowMicros, L as nothing, N as map, R as num, T as instant, Ut as formatInstant, W as range, c as Decimal, cn as builtins, d as bytes, et as text, i as ScriptError, k as list, l as Value, m as civilDate, n as LoadError, pn as units, r as MailboxFull, t as HostError, u as bool, un as grammar, v as dec } from "./errors-P3ga1I-9.js";
3
- import { S as registerStdlib, _ as loadScript, b as exportsOf, c as codeIdentity, d as Run, f as Script, g as deliver, h as defaultLimits, i as restore, l as compileLibrary, m as callFunction, n as TsScript, p as UnitLoadError, r as newGroup, t as TsGroup, v as LoweringError, w as stdlibNames, x as lowerTree, y as compileSource } from "./group-BqccKTWz.js";
4
- import { t as defineObjectKind } from "./objects-DE6kRk0r.js";
5
- import { At as Lexer, Ot as validMessageSelector, Tt as shape, U as waitUs, c as canConvert, et as disassemble, gt as LimitReached, t as NotImplementedError, wt as operationDeclarations, yt as defineCapability } from "./operations-CGjDlkGU.js";
6
- import { a as syntaxText, c as parseSource, i as syntaxSelector, l as parseSourceRecovering, o as ParseError, p as declarationStart, r as checkSyntax, s as parseEntry, t as checkSource, v as shapeData, y as kindNames } from "./checker-Coml0Tf9.js";
7
- import { n as exportManifest } from "./manifest-37x-HSxH.js";
8
- import { c as readDisplay, r as decodeValue } from "./readers-yMS1eAOp.js";
9
- import { a as clockCapability, d as timerCapability, i as calendarCapability, o as consoleCapability, t as encodeValue, u as musicalClockCapability } from "./encoding-BL2ECJmg.js";
10
- import { a as peerKind, i as peerCapability } from "./peer-capability-elnbQy-J.js";
11
- import { a as sqliteCapability, c as talk, i as httpCapability, o as fromValue, r as handlersOf, s as toValue, t as inlineGrants } from "./inline-grants-BT2nnfLA.js";
12
- import { o as decodeJson, s as encodeJson } from "./http-fetch-DA-NbFIM.js";
13
- import { n as createCore, r as coreVersions, t as createGroup } from "./lean-BJmLobmd.js";
14
- import { n as localeCapability, t as userCapability } from "./user-capability-D6hGa3eF.js";
15
- import { r as storeCapability, t as add } from "./store-capability-DBLlWaNO.js";
16
- export { Script as CompiledScript, Decimal, HostError, Lexer, LimitReached, LoadError, LoweringError, MailboxFull, NotImplementedError, ParseError, Run, ScriptError, TsGroup, TsScript, UnitLoadError, Value, add, bool, builtins, bytes, calendarCapability, callFunction, canConvert, checkSource, checkSyntax, civilDate, clockCapability, codeIdentity, compileLibrary, compileSource, consoleCapability, coreVersions, createCore, createGroup, dec, declarationStart, decodeJson, decodeValue, defaultLimits, defineCapability, defineObjectKind, deliver, disassemble, encodeJson, encodeValue, exportManifest, exportsOf, formatInstant, fromValue, grammar, handlersOf, httpCapability, inlineGrants, instant, kindNames, list, loadScript, localeCapability, lowerTree, map, musicalClockCapability, newGroup, nothing, nowMicros, num, operationDeclarations, parseEntry, parseInstant, parseSource, parseSourceRecovering, peerCapability, peerKind, quantity, range, readDisplay, record, registerStdlib, restore, shape, shapeData, sqliteCapability, stdlibNames, storeCapability, syntaxSelector, syntaxText, talk, text, timerCapability, toValue, units, userCapability, validMessageSelector, waitUs };
2
+ import { D as instant, H as num, J as range, K as quantity, L as map, N as list, Qt as parseInstant, V as nothing, Xt as nowMicros, Y as record, b as dec, c as Decimal, d as bytes, g as civilDate, hn as grammar, i as ScriptError, it as text, l as Value, n as LoadError, pn as builtins, qt as formatInstant, r as MailboxFull, t as HostError, u as bool, vn as units } from "./errors-CNc-xY_9.js";
3
+ import { S as registerStdlib, _ as loadScript, b as exportsOf, c as codeIdentity, d as Run, f as Script, g as deliver, h as defaultLimits, i as restore, l as compileLibrary, m as callFunction, n as TsScript, p as UnitLoadError, r as newGroup, t as TsGroup, v as LoweringError, w as stdlibNames, x as lowerTree, y as compileSource } from "./group-CY4FKhzT.js";
4
+ import { t as defineObjectKind } from "./objects-OKVLH190.js";
5
+ import { At as validMessageSelector, Dt as shape, Et as operationDeclarations, Mt as Lexer, U as waitUs, bt as defineCapability, c as canConvert, et as disassemble, gt as LimitReached, t as NotImplementedError, vt as conforms, wt as explain } from "./operations-B3XaG7Ve.js";
6
+ import { a as syntaxText, c as parseSource, i as syntaxSelector, l as parseSourceRecovering, o as ParseError, p as declarationStart, r as checkSyntax, s as parseEntry, t as checkSource, v as shapeData, y as kindNames } from "./checker-D74oYIhs.js";
7
+ import { n as exportManifest } from "./manifest-DVS1SEmN.js";
8
+ import { c as readDisplay, r as decodeValue } from "./readers-G1lHqrPl.js";
9
+ import { a as clockCapability, d as timerCapability, i as calendarCapability, o as consoleCapability, t as encodeValue, u as musicalClockCapability } from "./encoding-DzVFpg7k.js";
10
+ import { a as peerKind, i as peerCapability } from "./peer-capability-3etyPHs3.js";
11
+ import { a as httpCapability, c as toValue, i as handlersOf, l as talk, n as inlineGrants, o as sqliteCapability, s as fromValue, t as zoneRules } from "./zone-rules-DsCJtmlC.js";
12
+ import { o as decodeJson, s as encodeJson } from "./http-fetch-DnpfiOWK.js";
13
+ import { n as createCore, r as coreVersions, t as createGroup } from "./lean-DTCTJUmR.js";
14
+ import { n as localeCapability, t as userCapability } from "./user-capability-DNY2dyjq.js";
15
+ import { r as storeCapability, t as add } from "./store-capability-CBJ6mUoH.js";
16
+ export { Script as CompiledScript, Decimal, HostError, Lexer, LimitReached, LoadError, LoweringError, MailboxFull, NotImplementedError, ParseError, Run, ScriptError, TsGroup, TsScript, UnitLoadError, Value, add, bool, builtins, bytes, calendarCapability, callFunction, canConvert, checkSource, checkSyntax, civilDate, clockCapability, codeIdentity, compileLibrary, compileSource, conforms, consoleCapability, coreVersions, createCore, createGroup, dec, declarationStart, decodeJson, decodeValue, defaultLimits, defineCapability, defineObjectKind, deliver, disassemble, encodeJson, encodeValue, explain, exportManifest, exportsOf, formatInstant, fromValue, grammar, handlersOf, httpCapability, inlineGrants, instant, kindNames, list, loadScript, localeCapability, lowerTree, map, musicalClockCapability, newGroup, nothing, nowMicros, num, operationDeclarations, parseEntry, parseInstant, parseSource, parseSourceRecovering, peerCapability, peerKind, quantity, range, readDisplay, record, registerStdlib, restore, shape, shapeData, sqliteCapability, stdlibNames, storeCapability, syntaxSelector, syntaxText, talk, text, timerCapability, toValue, units, userCapability, validMessageSelector, waitUs, zoneRules };
@@ -1,7 +1,7 @@
1
1
 
2
- import { K as requireArgs, t as HostError } from "./errors-P3ga1I-9.js";
3
- import { gt as LimitReached, pt as languageVersion, ut as compareText } from "./operations-CGjDlkGU.js";
4
- import { n as quoteJSON } from "./encoding-BL2ECJmg.js";
2
+ import { X as requireArgs, t as HostError } from "./errors-CNc-xY_9.js";
3
+ import { gt as LimitReached, pt as languageVersion, ut as compareText } from "./operations-B3XaG7Ve.js";
4
+ import { n as quoteJSON } from "./encoding-DzVFpg7k.js";
5
5
  //#region src/call-meter.ts
6
6
  var CallMeter = class {
7
7
  take;
@@ -1,6 +1,6 @@
1
1
  /// <reference lib="esnext.disposable" />
2
- import { i as JsonObject, n as Json, r as JsonNumber, s as readOrderedJSON } from "./readers-ChQ0e92c.js";
3
- import { n as decodeBinaryValue, r as encodeBinaryValue, t as BinaryValueOptions } from "./binary-value-M8v567iA.js";
2
+ import { i as JsonObject, n as Json, r as JsonNumber, s as readOrderedJSON } from "./readers-AeB1bJ--.js";
3
+ import { n as decodeBinaryValue, r as encodeBinaryValue, t as BinaryValueOptions } from "./binary-value-B93hEK7l.js";
4
4
  //#region src/request-pump-binary.d.ts
5
5
  export declare const requestPumpFeature: "request-pump-fields-v1";
6
6
  export declare const callbacksFeature: "callbacks-fields-v1";
package/message-layer.js CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
- import { l as readOrderedJSON, n as JsonObject, t as JsonNumber } from "./readers-yMS1eAOp.js";
3
- import { c as isRequestPumpBinary, f as decodeBinaryValue, i as encodeBinaryFrame, n as decodeBinaryFrame, p as encodeBinaryValue, t as callbacksFeature, u as requestPumpFeature } from "./request-pump-binary-BS1J8DF2.js";
2
+ import { l as readOrderedJSON, n as JsonObject, t as JsonNumber } from "./readers-G1lHqrPl.js";
3
+ import { c as isRequestPumpBinary, f as decodeBinaryValue, i as encodeBinaryFrame, n as decodeBinaryFrame, p as encodeBinaryValue, t as callbacksFeature, u as requestPumpFeature } from "./request-pump-binary-VOPVqRZD.js";
4
4
  export { JsonNumber, JsonObject, callbacksFeature, decodeBinaryFrame, decodeBinaryValue, encodeBinaryFrame, encodeBinaryValue, isRequestPumpBinary, readOrderedJSON, requestPumpFeature };
package/notify.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /// <reference lib="esnext.disposable" />
2
- import { a as changed, i as WatchLimits, n as RouterOptions, o as createRouter, r as RoutingResult, t as NotificationRouter } from "./router-D0rf5SkW.js";
2
+ import { a as changed, i as WatchLimits, n as RouterOptions, o as createRouter, r as RoutingResult, t as NotificationRouter } from "./router-DXoJ_2Z4.js";
3
3
  export { type NotificationRouter, type RouterOptions, type RoutingResult, type WatchLimits, changed, createRouter };
package/notify.js CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- export { t as changed, n as createRouter } from "./router-Bm7A2kjt.js";
2
+ export { t as changed, n as createRouter } from "./router-Bdm4KiMG.js";
@@ -1,5 +1,5 @@
1
1
 
2
- import { t as HostError, z as objectValue } from "./errors-P3ga1I-9.js";
2
+ import { U as objectValue, t as HostError } from "./errors-CNc-xY_9.js";
3
3
  //#region src/objects.ts
4
4
  const elementCost = (cost, name) => {
5
5
  const c = cost;
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.disposable" />
2
- import { C as Report, Cn as CalendarImpl, D as RunEvent, E as RestoreResult, F as TsGroupOptions, Ht as ScopeDecl, I as TsRestoreOptions, J as Value, L as TsScript, M as SessionPort, Nn as Library, P as TsGroup, Rn as compileLibrary, Vn as Limits, g as Inspection, gt as ObjectKindDef, ht as ObjectKind, j as SessionControls, jt as Grant, pt as HostObject, qt as Shape, rr as LoadError, t as DebugController, vn as SqliteBinding, xn as LocaleImpl, xt as CapabilityDef, yt as GrantDecls, zn as replacementLibraries } from "./debug-C_Ob5rkl.js";
2
+ import { Bn as compileLibrary, C as Report, Cn as LocaleImpl, D as RunEvent, E as RestoreResult, F as TsGroupOptions, Fn as Library, Ht as ScopeDecl, I as TsRestoreOptions, J as Value, L as TsScript, M as SessionPort, P as TsGroup, Tn as CalendarImpl, Un as Limits, Vn as replacementLibraries, ar as LoadError, bn as SqliteBinding, g as Inspection, gt as ObjectKindDef, ht as ObjectKind, j as SessionControls, jt as Grant, pt as HostObject, qt as Shape, t as DebugController, xt as CapabilityDef, yt as GrantDecls } from "./debug-s6QIovKS.js";
3
3
  //#region src/setup.d.ts
4
4
  type ShapeSpec = string | {
5
5
  quantity: string;
@@ -109,6 +109,7 @@ type Setup = {
109
109
  }[];
110
110
  operations?: OperationSpec[];
111
111
  scripts?: {
112
+ forbidSuspension?: boolean;
112
113
  grants?: Record<string, {
113
114
  binding?: string | SqliteBinding;
114
115
  capability?: string;
@@ -1,5 +1,5 @@
1
1
 
2
- import { $t as charactersAt, A as listValues, At as subtract, B as ownedMapPairs, Bt as civilOfUs, Ct as integerOf, D as isDecimal, Dt as negate, E as instantOf, Et as multiply, Ft as addMonths, Gt as isoWeek, H as quantity, Ht as dayOfYear, I as mapWithEntry, It as checkInstant, J as sliceText, L as nothing, Lt as civilDays, M as literalDigits, Mt as DateRangeError, N as map, Nt as US_PER_DAY, Ot as powerInteger, Pt as US_PER_SECOND, Q as smallInteger, Qt as characterBoundaries, R as num, St as formatDec, T as instant, Tt as mod, U as quantityOf, V as patternValue, Vt as civilUs, W as range, X as smallDecimalNumber, Xt as weekday, Y as smallCoefficient, Yt as parseInstantText, Z as smallExponent, Zt as assertScalarText, _ as concatText, _t as decOf, an as simpleFold, at as fromBase, b as displayText, bt as div, ct as parseUnit, d as bytes, dt as toBase, en as generalCategory, et as text, f as bytesOf, fn as unitKinds, ft as unitEntry, g as compareBytes, gt as compareDec, h as civilOf, ht as add, in as scalarCount, it as combine, j as listWithItem, jt as withinLimits, k as list, kt as roundRatio, l as Value, lt as powerOf, mt as ArithmeticError, nn as lower, nt as trimWhiteSpace, o as invalidValue, on as upper, ot as musicalKind, p as canonicalNumber, pt as unitText, qt as parseCivil, rn as normalizeNFC, rt as UnitError, st as ownUnit, t as HostError, tn as isWhiteSpace, tt as textStorage, u as bool, un as grammar, ut as sameDimension, v as dec, vt as digitCount$1, wt as isInteger, x as extendList, xt as divide, y as decimalParts, yt as digitsOf, zt as civilOfDays } from "./errors-P3ga1I-9.js";
2
+ import { $ as smallCoefficient, $t as parseInstantText, At as multiply, B as mapWithEntry, Bt as checkInstant, C as extendList, Ct as digitsOf, D as instant, Dt as integerOf, Et as formatDec, F as listWithItem, Ft as withinLimits, G as patternValue, Gt as civilUs, H as num, I as literalDigits, It as DateRangeError, J as range, K as quantity, Kt as dayOfYear, L as map, Lt as US_PER_DAY, M as knownSize, Mt as powerInteger, N as list, Nt as roundRatio, O as instantOf, Ot as isInteger, P as listValues, Pt as subtract, Q as sliceText, Rt as US_PER_SECOND, S as displayText, St as digitCount$1, Tt as divide, Ut as civilOfDays, V as nothing, Vt as civilDays, W as ownedMapPairs, Wt as civilOfUs, Yt as isoWeek, Zt as parseCivil, _ as civilOf, _n as unitKinds, _t as unitText, an as isWhiteSpace, at as textStorage, b as dec, bt as compareDec, cn as scalarCount, ct as combine, d as bytes, dn as utf8Length, dt as ownUnit, en as weekday, et as smallDecimalNumber, f as bytesOf, ft as parseUnit, gt as unitEntry, h as canonicalNumber, hn as grammar, ht as toBase, in as generalCategory, it as text, j as knownContents, jt as negate, k as isDecimal, kt as mod, l as Value, ln as simpleFold, lt as fromBase, m as cacheSize, mt as sameDimension, nn as characterBoundaries, nt as smallInteger, o as invalidValue, on as lower, ot as trimWhiteSpace, p as cacheContents, pt as powerOf, q as quantityOf, rn as charactersAt, sn as normalizeNFC, st as UnitError, t as HostError, tn as assertScalarText, tt as smallExponent, u as bool, un as upper, ut as musicalKind, v as compareBytes, vt as ArithmeticError, wt as div, x as decimalParts, xt as decOf, y as concatText, yt as add, zt as addMonths } from "./errors-CNc-xY_9.js";
3
3
  //#region src/tasks.ts
4
4
  const runTask = (root) => {
5
5
  const stack = [root];
@@ -625,6 +625,20 @@ const wrapperKeys = [
625
625
  "map"
626
626
  ];
627
627
  const scalarsOf = (s) => [...s].length;
628
+ const decodedShapes = /* @__PURE__ */ new WeakMap();
629
+ /**
630
+ * `decodeShape`, kept per Shape data value: values are immutable, and a
631
+ * Constant's Shape data is decoded once per load rather than per test.
632
+ * The scanned count is kept too, so the Fuel charged is unchanged.
633
+ */
634
+ const decodeShapeCached = (data) => {
635
+ let decoded = decodedShapes.get(data);
636
+ if (!decoded) {
637
+ decoded = decodeShape(data);
638
+ decodedShapes.set(data, decoded);
639
+ }
640
+ return decoded;
641
+ };
628
642
  /** Reads Shape data into a Shape, or gives the first definition error. */
629
643
  const decodeShape = (data) => {
630
644
  let scanned = 0;
@@ -821,22 +835,21 @@ const shapeDiagnostics = (v, s, first, scanned) => {
821
835
  let halted = false;
822
836
  const deepInfo = /* @__PURE__ */ new Map();
823
837
  const infoOf = (rootValue) => {
824
- const pending = [rootValue];
825
- const order = [];
826
- const seen = /* @__PURE__ */ new Set();
838
+ const pending = [{ v: rootValue }];
827
839
  while (pending.length) {
828
- const next = pending.pop();
829
- if (deepInfo.has(next) || seen.has(next)) continue;
830
- seen.add(next);
831
- order.push(next);
832
- if (next.kind === "list") for (let i = 1; i <= next.length; i++) pending.push(next.index(i));
833
- else if (next.kind === "map") for (const [, value] of next.entries()) pending.push(value);
834
- }
835
- for (let i = order.length - 1; i >= 0; i--) {
836
- const value = order[i];
840
+ const { children, v: value } = pending.pop();
841
+ if (deepInfo.has(value)) continue;
842
+ if (!children) {
843
+ const parts = value.kind === "list" ? Array.from({ length: value.length }, (_, j) => value.index(j + 1)) : value.kind === "map" ? value.entries().map(([, item]) => item) : [];
844
+ pending.push({
845
+ children: parts,
846
+ v: value
847
+ });
848
+ for (let i = parts.length - 1; i >= 0; i--) pending.push({ v: parts[i] });
849
+ continue;
850
+ }
837
851
  let clean = value.kind !== "function";
838
852
  let nodes = 1;
839
- const children = value.kind === "list" ? Array.from({ length: value.length }, (_, j) => value.index(j + 1)) : value.kind === "map" ? value.entries().map(([, item]) => item) : [];
840
853
  for (const child of children) {
841
854
  const info = deepInfo.get(child);
842
855
  clean = clean && info.clean;
@@ -1332,6 +1345,10 @@ const operationDeclarations = (capabilities) => {
1332
1345
  }]));
1333
1346
  return declarations;
1334
1347
  };
1348
+ /** True exactly when `v` fits `s`, with a Capability argument's acceptance (ADR 0176). */
1349
+ const conforms = (v, s) => shapeDiagnostics(v, s, true, 0).diags.length === 0;
1350
+ /** The `explain` Built-in's report for `v` against `s` (ADR 0176). */
1351
+ const explain = (v, s) => listValues(shapeDiagnostics(v, s, false, 0).diags.map(diagnosticRecord));
1335
1352
  //#endregion
1336
1353
  //#region src/generated/machine.ts
1337
1354
  const instructions = [
@@ -4608,6 +4625,11 @@ const costModel = {
4608
4625
  0,
4609
4626
  10,
4610
4627
  1
4628
+ ], [
4629
+ 10,
4630
+ 0,
4631
+ 2,
4632
+ 1
4611
4633
  ]],
4612
4634
  "alloc": [[
4613
4635
  1,
@@ -4623,6 +4645,11 @@ const costModel = {
4623
4645
  0,
4624
4646
  10,
4625
4647
  1
4648
+ ], [
4649
+ 10,
4650
+ 0,
4651
+ 2,
4652
+ 1
4626
4653
  ]],
4627
4654
  "alloc": [[
4628
4655
  1,
@@ -5811,7 +5838,7 @@ const makeCostRates = (measure) => [
5811
5838
  fuel: 0,
5812
5839
  alloc: 0
5813
5840
  }) => {
5814
- into.fuel = 10;
5841
+ into.fuel = 10 + Math.ceil(2 * (m.scanned ?? 0) / 1);
5815
5842
  into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
5816
5843
  return into;
5817
5844
  },
@@ -5819,7 +5846,7 @@ const makeCostRates = (measure) => [
5819
5846
  fuel: 0,
5820
5847
  alloc: 0
5821
5848
  }) => {
5822
- into.fuel = 10;
5849
+ into.fuel = 10 + Math.ceil(2 * (m.scanned ?? 0) / 1);
5823
5850
  into.alloc = Math.ceil(1 * (m.resultSize ?? measure(1, m.result)) / 1);
5824
5851
  return into;
5825
5852
  },
@@ -5895,9 +5922,8 @@ const sizes = new Map(Object.entries(costModel.sizes));
5895
5922
  const { constant: CONSTANT, size: SIZE, contents: CONTENTS, characters: CHARACTERS, scalars: SCALARS, utf8: UTF8, bytes: BYTES, items: ITEMS, entries: ENTRIES, digits: DIGITS, scanned: SCANNED, steps: STEPS, program: PROGRAM, frames: FRAMES, count: COUNT, declared: DECLARED } = costMeasure;
5896
5923
  const { none: NONE, input: INPUT, result: RESULT, v: V, x1: X1 } = costSubject;
5897
5924
  const noCounts = {};
5898
- const encoder = new TextEncoder();
5899
- const known = /* @__PURE__ */ new WeakMap();
5900
- const knownContents = /* @__PURE__ */ new WeakMap();
5925
+ /** A map entry's contents besides its value: 16 plus its key's UTF-8 bytes. */
5926
+ const keySize = (key) => 16 + utf8Length(key);
5901
5927
  /** The measures of one value that aren't sizes. */
5902
5928
  const measureOf = (measure, v) => {
5903
5929
  if (!v) return 0;
@@ -5961,18 +5987,19 @@ const countOf = (measure, counts) => {
5961
5987
  const contentsOf = (v) => {
5962
5988
  switch (v.kind) {
5963
5989
  case "list": {
5964
- const cached = knownContents.get(v);
5965
- if (cached !== void 0) return cached;
5990
+ const cached = knownContents(v);
5991
+ if (cached >= 0) return cached;
5966
5992
  let total = 0;
5967
5993
  for (let i = 1; i <= v.length; i++) total += sizeOf(v.index(i));
5968
- knownContents.set(v, total);
5994
+ cacheContents(v, total);
5969
5995
  return total;
5970
5996
  }
5971
5997
  case "map": {
5972
- const cached = knownContents.get(v);
5973
- if (cached !== void 0) return cached;
5974
- const total = ownedMapPairs(v).reduce((sum, [key, value]) => sum + 16 + encoder.encode(key).length + sizeOf(value), 0);
5975
- knownContents.set(v, total);
5998
+ const cached = knownContents(v);
5999
+ if (cached >= 0) return cached;
6000
+ let total = 0;
6001
+ for (const [key, value] of ownedMapPairs(v)) total += keySize(key) + sizeOf(value);
6002
+ cacheContents(v, total);
5976
6003
  return total;
5977
6004
  }
5978
6005
  case "range": {
@@ -5986,39 +6013,39 @@ const contentsOf = (v) => {
5986
6013
  /** Seed a List's contents after growth, without walking its retained items. */
5987
6014
  const cacheListExtension = (result, current, part, all) => {
5988
6015
  const contents = contentsOf(current) + (all ? contentsOf(part) : sizeOf(part));
5989
- knownContents.set(result, contents);
5990
- known.set(result, partSize("list", result.length, contents));
6016
+ cacheContents(result, contents);
6017
+ cacheSize(result, partSize("list", result.length, contents));
5991
6018
  };
5992
6019
  /** The part of a map's contents its keys add, one term per key. */
5993
- const keysContents = (keys) => keys.reduce((sum, key) => sum + 16 + encoder.encode(key).length, 0);
6020
+ const keysContents = (keys) => keys.reduce((sum, key) => sum + keySize(key), 0);
5994
6021
  /** Seed a newly built List's or map's size from the values it was built of. */
5995
6022
  const cacheBuild = (result, items, keys) => {
5996
6023
  let contents = keys;
5997
6024
  for (const item of items) contents += sizeOf(item);
5998
- knownContents.set(result, contents);
5999
- known.set(result, partSize(result.kind, result.kind === "map" ? result.mapSize : result.length, contents));
6025
+ cacheContents(result, contents);
6026
+ cacheSize(result, partSize(result.kind, result.kind === "map" ? result.mapSize : result.length, contents));
6000
6027
  };
6001
6028
  /** Seed the logical sizes of point edits from their retained collection. */
6002
6029
  const cacheMapWrite = (result, current, key, part) => {
6003
6030
  if (result === current) return;
6004
- const previous = current.hasKey(key) ? 16 + encoder.encode(key).length + sizeOf(current.get(key)) : 0;
6005
- const added = part === void 0 ? 0 : 16 + encoder.encode(key).length + sizeOf(part);
6031
+ const previous = current.hasKey(key) ? keySize(key) + sizeOf(current.get(key)) : 0;
6032
+ const added = part === void 0 ? 0 : keySize(key) + sizeOf(part);
6006
6033
  const contents = contentsOf(current) - previous + added;
6007
- knownContents.set(result, contents);
6008
- known.set(result, partSize("map", result.mapSize, contents));
6034
+ cacheContents(result, contents);
6035
+ cacheSize(result, partSize("map", result.mapSize, contents));
6009
6036
  };
6010
6037
  const cacheListEdit = (result, current, i, part) => {
6011
6038
  const contents = contentsOf(current) - sizeOf(current.index(i + 1)) + (part === void 0 ? 0 : sizeOf(part));
6012
- knownContents.set(result, contents);
6013
- known.set(result, partSize("list", result.length, contents));
6039
+ cacheContents(result, contents);
6040
+ cacheSize(result, partSize("list", result.length, contents));
6014
6041
  };
6015
6042
  /** A value's logical size (chapter 8, Logical sizes), as if nothing were shared. */
6016
6043
  const sizeOf = (v) => {
6017
- const cached = known.get(v);
6018
- if (cached !== void 0) return cached;
6044
+ const cached = knownSize(v);
6045
+ if (cached >= 0) return cached;
6019
6046
  const leaf = leafSize(v, measureOf);
6020
6047
  if (leaf !== void 0) {
6021
- known.set(v, leaf);
6048
+ cacheSize(v, leaf);
6022
6049
  return leaf;
6023
6050
  }
6024
6051
  const pending = [v];
@@ -6026,22 +6053,22 @@ const sizeOf = (v) => {
6026
6053
  const seen = /* @__PURE__ */ new Set();
6027
6054
  while (pending.length) {
6028
6055
  const next = pending.pop();
6029
- if (known.has(next) || seen.has(next)) continue;
6056
+ if (knownSize(next) >= 0 || seen.has(next)) continue;
6030
6057
  const leaf = leafSize(next, measureOf);
6031
6058
  if (leaf !== void 0) {
6032
- known.set(next, leaf);
6059
+ cacheSize(next, leaf);
6033
6060
  continue;
6034
6061
  }
6035
6062
  seen.add(next);
6036
6063
  order.push(next);
6037
- for (const child of childrenOf(next)) if (!known.has(child) && !seen.has(child)) pending.push(child);
6064
+ for (const child of childrenOf(next)) if (knownSize(child) < 0 && !seen.has(child)) pending.push(child);
6038
6065
  }
6039
6066
  for (let i = order.length - 1; i >= 0; i--) {
6040
6067
  const value = order[i];
6041
6068
  const formula = sizes.get(value.kind);
6042
- known.set(value, evaluate(formula, noCounts, value));
6069
+ cacheSize(value, evaluate(formula, noCounts, value));
6043
6070
  }
6044
- return known.get(v);
6071
+ return knownSize(v);
6045
6072
  };
6046
6073
  const childrenOf = (v) => {
6047
6074
  switch (v.kind) {
@@ -8418,12 +8445,83 @@ const dateField = (name, d) => {
8418
8445
  };
8419
8446
  return integerValue(field[name]);
8420
8447
  };
8421
- const offsetOf = (name, v) => {
8448
+ const fixedOffsetUs = (v) => {
8422
8449
  const q = v.asQuantityRef();
8423
8450
  const seconds = q && sameDimension(q.unit, SECONDS) ? inBase(q) : void 0;
8424
8451
  const whole = seconds && isInteger(seconds) ? integerOf(seconds) : void 0;
8425
- if (whole === void 0 || whole % 60n !== 0n || whole >= 86400n || whole <= -86400n) throw outOfDomain(name, v);
8426
- return whole * US_PER_SECOND;
8452
+ return whole === void 0 || whole % 60n !== 0n || whole >= 86400n || whole <= -86400n ? void 0 : whole * US_PER_SECOND;
8453
+ };
8454
+ const offsetOf = (name, v) => {
8455
+ const us = fixedOffsetUs(v);
8456
+ if (us === void 0) throw outOfDomain(name, v);
8457
+ return us;
8458
+ };
8459
+ const exactKeys = (v, keys) => v.kind === "map" && v.mapSize === keys.length && keys.every((k) => v.hasKey(k));
8460
+ /** `scanned` is the number of changes, whenever `changes` is a list, so a
8461
+ * malformed map is charged as a well-formed one of its length would be. */
8462
+ const zoneRulesOf = (name, v, measure) => {
8463
+ const bad = () => outOfDomain(name, v);
8464
+ if (!exactKeys(v, [
8465
+ "zone",
8466
+ "until",
8467
+ "changes"
8468
+ ])) throw bad();
8469
+ const zone = v.get("zone").asText();
8470
+ const until = v.get("until").asInstant();
8471
+ const changes = v.get("changes");
8472
+ if (changes.kind === "list") measure.scanned = changes.length;
8473
+ if (zone === void 0 || until === void 0 || changes.kind !== "list" || changes.length === 0) throw bad();
8474
+ const starts = [];
8475
+ const offsets = [];
8476
+ for (let i = 1; i <= changes.length; i++) {
8477
+ const change = changes.index(i);
8478
+ if (!exactKeys(change, ["at", "offset"])) throw bad();
8479
+ const at = change.get("at").asInstant();
8480
+ const offset = fixedOffsetUs(change.get("offset"));
8481
+ if (at === void 0 || offset === void 0 || starts.length > 0 && at <= starts.at(-1)) throw bad();
8482
+ starts.push(at);
8483
+ offsets.push(offset);
8484
+ }
8485
+ if (starts.at(-1) >= until) throw bad();
8486
+ return {
8487
+ zone,
8488
+ starts,
8489
+ offsets,
8490
+ until
8491
+ };
8492
+ };
8493
+ const outsideWindow = (rules, us) => us < rules.starts[0] || us >= rules.until;
8494
+ /** The offset in effect at the Instant `us`, inside the window. */
8495
+ const zoneOffsetAt = (rules, us) => {
8496
+ let k = 0;
8497
+ while (k + 1 < rules.starts.length && rules.starts[k + 1] <= us) k++;
8498
+ return rules.offsets[k];
8499
+ };
8500
+ const DISAMBIGUATIONS = [
8501
+ "compatible",
8502
+ "earlier",
8503
+ "later",
8504
+ "reject"
8505
+ ];
8506
+ /** The Instant at which the zone's wall clock reads `local`, a Civil Date's
8507
+ * microseconds read as if at UTC, resolving a gap or overlap. */
8508
+ const zoneInstant = (rules, civil, local, disambiguation) => {
8509
+ for (const o of rules.offsets) if (outsideWindow(rules, local - o)) throw outOfRange("zone", civil);
8510
+ const { starts, offsets, until } = rules;
8511
+ const candidates = [];
8512
+ for (let k = 0; k < starts.length; k++) {
8513
+ const t = local - offsets[k];
8514
+ if (starts[k] <= t && t < (starts[k + 1] ?? until)) candidates.push(t);
8515
+ }
8516
+ if (candidates.length === 1) return candidates[0];
8517
+ if (disambiguation === "reject") throw new ScriptError("ambiguous time", [["civil", civil], ["zone", text(rules.zone)]]);
8518
+ if (candidates.length > 1) return disambiguation === "later" ? candidates.reduce((a, b) => a > b ? a : b) : candidates.reduce((a, b) => a < b ? a : b);
8519
+ for (let j = 1; j < starts.length; j++) {
8520
+ const o1 = offsets[j - 1];
8521
+ const o2 = offsets[j];
8522
+ if (local - o2 < starts[j] && starts[j] <= local - o1) return disambiguation === "earlier" ? local - o2 : local - o1;
8523
+ }
8524
+ throw new Error("a Civil Date with no candidate lies in no gap");
8427
8525
  };
8428
8526
  const unary = {
8429
8527
  sqrt,
@@ -8628,7 +8726,7 @@ const builtin = (name, args, measure = {}) => {
8628
8726
  case "conforms":
8629
8727
  case "check":
8630
8728
  case "explain": {
8631
- const decoded = decodeShape(y);
8729
+ const decoded = decodeShapeCached(y);
8632
8730
  measure.scanned = decoded.scanned;
8633
8731
  if (decoded.error) throw new ScriptError("invalid shape", [
8634
8732
  ["reason", text(decoded.error.reason)],
@@ -8685,15 +8783,36 @@ const builtin = (name, args, measure = {}) => {
8685
8783
  case "hasTime": return { result: dateField(name, x) };
8686
8784
  case "toCivil": {
8687
8785
  if (x.kind !== "instant") throw wrongKind("instant", x);
8688
- const offset = offsetOf(name, y);
8689
- return { result: inRangeDate(() => civilOf(civilOfUs(x.asInstant() + offset))) };
8786
+ const i = x.asInstant();
8787
+ let offset;
8788
+ if (y.kind === "map") {
8789
+ const rules = zoneRulesOf(name, y, measure);
8790
+ if (outsideWindow(rules, i)) throw outOfRange("zone", x);
8791
+ offset = zoneOffsetAt(rules, i);
8792
+ } else offset = offsetOf(name, y);
8793
+ return {
8794
+ result: inRangeDate(() => civilOf(civilOfUs(i + offset))),
8795
+ scanned: measure.scanned
8796
+ };
8690
8797
  }
8691
8798
  case "toInstant": {
8692
8799
  const c = x.civilRef();
8693
8800
  if (!c) throw wrongKind("civil date", x);
8694
8801
  if (c.us === null) throw outOfDomain(name, x);
8695
- const offset = offsetOf(name, y);
8696
- return { result: inRangeDate(() => instantOf(checkInstant(civilUs(c) - offset))) };
8802
+ const how = z ?? nothing;
8803
+ if (y.kind !== "map") {
8804
+ const offset = offsetOf(name, y);
8805
+ if (how.kind !== "nothing") throw outOfDomain(name, how);
8806
+ return { result: inRangeDate(() => instantOf(checkInstant(civilUs(c) - offset))) };
8807
+ }
8808
+ const rules = zoneRulesOf(name, y, measure);
8809
+ const word = how.kind === "nothing" ? "compatible" : how.asText();
8810
+ if (word === void 0 || !DISAMBIGUATIONS.includes(word)) throw outOfDomain(name, how);
8811
+ const local = civilUs(c);
8812
+ return {
8813
+ result: inRangeDate(() => instantOf(checkInstant(zoneInstant(rules, x, local, word)))),
8814
+ scanned: measure.scanned
8815
+ };
8697
8816
  }
8698
8817
  case "abs":
8699
8818
  case "floor":
@@ -8741,10 +8860,11 @@ const builtin = (name, args, measure = {}) => {
8741
8860
  const builtinDefaults = {
8742
8861
  round: [num(0), text("half up")],
8743
8862
  bitShiftLeft: [nothing],
8863
+ toInstant: [nothing],
8744
8864
  fromFloat64: [text("big")],
8745
8865
  fromFloat32: [text("big")],
8746
8866
  toFloat64: [text("big")],
8747
8867
  toFloat32: [text("big")]
8748
8868
  };
8749
8869
  //#endregion
8750
- export { arityOf as $, musicalCount as A, Lexer as At, splice as B, isKind as C, mismatch as Ct, matchCaptures as D, validComputedMessageName as Dt, makeRange as E, shapeDiagnostics as Et, randomBound as F, cacheBuild as G, textForm as H, search as I, keysContents as J, charge as K, setKey as L, outOfRange as M, runTask as Mt, prepareConversion as N, matchesOf as O, validMessageSelector as Ot, property as P, sizeOf as Q, smallArithmetic as R, isEmpty as S, expectedOf as St, makePatternValue as T, shape as Tt, waitUs as U, subjectText as V, wrongKind as W, rateOf as X, partSize as Y, resetMeasured as Z, deleteKey as _, acceptsArgumentCount as _t, builtin as a, numberText as at, hasKey as b, defineValueCapability as bt, canConvert as c, splicesOf as ct, chunkSet as d, costModel as dt, disassemble as et, chunkThere as f, errorMessages as ft, decodeUtf8 as g, LimitReached as gt, convert as h, reservedErrorKeys as ht, arithmetic as i, capturesOf$1 as it, negated as j, RESERVED as jt, member as k, validStaticMessageName as kt, chunkDelete as l, textDisplay as lt, concat as m, limitDefaults as mt, ScriptError as n, instructionSpec as nt, builtinDefaults as o, patternSource as ot, comparison as p, languageVersion as pt, fixedRates as q, appendTo as r, opcodes as rt, byteOf as s, quantityText as st, NotImplementedError as t, functionHead as tt, chunkGet as u, compareText as ut, equals as v, decodeShape as vt, keyText as w, operationDeclarations as wt, integerValue as x, diagnosticRecord as xt, getKey as y, defineCapability as yt, smallCoefficientOf as z };
8870
+ export { arityOf as $, musicalCount as A, validMessageSelector as At, splice as B, isKind as C, expectedOf as Ct, matchCaptures as D, shape as Dt, makeRange as E, operationDeclarations as Et, randomBound as F, cacheBuild as G, textForm as H, search as I, keysContents as J, charge as K, setKey as L, outOfRange as M, Lexer as Mt, prepareConversion as N, RESERVED as Nt, matchesOf as O, shapeDiagnostics as Ot, property as P, runTask as Pt, sizeOf as Q, smallArithmetic as R, isEmpty as S, diagnosticRecord as St, makePatternValue as T, mismatch as Tt, waitUs as U, subjectText as V, wrongKind as W, rateOf as X, partSize as Y, resetMeasured as Z, deleteKey as _, acceptsArgumentCount as _t, builtin as a, numberText as at, hasKey as b, defineCapability as bt, canConvert as c, splicesOf as ct, chunkSet as d, costModel as dt, disassemble as et, chunkThere as f, errorMessages as ft, decodeUtf8 as g, LimitReached as gt, convert as h, reservedErrorKeys as ht, arithmetic as i, capturesOf$1 as it, negated as j, validStaticMessageName as jt, member as k, validComputedMessageName as kt, chunkDelete as l, textDisplay as lt, concat as m, limitDefaults as mt, ScriptError as n, instructionSpec as nt, builtinDefaults as o, patternSource as ot, comparison as p, languageVersion as pt, fixedRates as q, appendTo as r, opcodes as rt, byteOf as s, quantityText as st, NotImplementedError as t, functionHead as tt, chunkGet as u, compareText as ut, equals as v, conforms as vt, keyText as w, explain as wt, integerValue as x, defineValueCapability as xt, getKey as y, decodeShape as yt, smallCoefficientOf as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@northtalk/ts",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "NorthTalk, a readable scripting language for embedding: the TS Core, its Session Host and Standard Capabilities.",
5
5
  "license": "MIT",
6
6
  "type": "module",