The Great Renaming: Pointer -> Embedded
This commit is contained in:
parent
191946d9c3
commit
5cd3198739
|
@ -6,8 +6,8 @@
|
||||||
"typescript": "^4.2.3"
|
"typescript": "^4.2.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@preserves/core": "^0.14.0",
|
"@preserves/core": "^0.15.0",
|
||||||
"@preserves/schema": "^0.7.0"
|
"@preserves/schema": "^0.8.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"regenerate": "rm -rf ./src/gen && preserves-schema-ts --module Actor=./src/runtime/actor.ts --output ./src/gen './schemas/**/*.prs'",
|
"regenerate": "rm -rf ./src/gen && preserves-schema-ts --module Actor=./src/runtime/actor.ts --output ./src/gen './schemas/**/*.prs'",
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
version 1 .
|
version 1 .
|
||||||
pointer Actor.Ref .
|
embeddedType Actor.Ref .
|
||||||
|
|
||||||
BoxState = <BoxState @value int>.
|
BoxState = <BoxState @value int>.
|
||||||
SetBox = <SetBox @value int>.
|
SetBox = <SetBox @value int>.
|
||||||
|
|
||||||
; BoxCap = BoxState / <Observe =SetBox @observer ref>.
|
; BoxCap = BoxState / <Observe =SetBox @observer embedded>.
|
||||||
; ClientCap = SetBox / <Observe =BoxState @observer ref>.
|
; ClientCap = SetBox / <Observe =BoxState @observer embedded>.
|
||||||
.
|
.
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
version 1 .
|
version 1 .
|
||||||
pointer Actor.Ref .
|
embeddedType Actor.Ref .
|
||||||
|
|
||||||
;As implemented
|
;As implemented
|
||||||
Observe = <Observe @label symbol @observer ref>.
|
Observe = <Observe @label symbol @observer embedded>.
|
||||||
|
|
||||||
; ;As will be implemented soon
|
; ;As will be implemented soon
|
||||||
; Observe = <Observe @pattern Pattern @observer ref>.
|
; Observe = <Observe @pattern Pattern @observer embedded>.
|
||||||
.
|
.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
version 1 .
|
version 1 .
|
||||||
pointer Actor.Ref .
|
embeddedType Actor.Ref .
|
||||||
|
|
||||||
Resolve = <resolve @sturdyref sturdy.SturdyRef @observer ref>.
|
Resolve = <resolve @sturdyref sturdy.SturdyRef @observer embedded>.
|
||||||
Bind = <bind @oid any @key bytes @target ref>.
|
Bind = <bind @oid any @key bytes @target embedded>.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
version 1 .
|
version 1 .
|
||||||
pointer sturdy.WireRef .
|
embeddedType sturdy.WireRef .
|
||||||
|
|
||||||
Assertion = any .
|
Assertion = any .
|
||||||
Handle = int .
|
Handle = int .
|
||||||
|
@ -11,4 +11,4 @@ TurnEvent = [@oid Oid @event Event].
|
||||||
Assert = <assert @assertion Assertion @handle Handle>.
|
Assert = <assert @assertion Assertion @handle Handle>.
|
||||||
Retract = <retract @handle Handle>.
|
Retract = <retract @handle Handle>.
|
||||||
Message = <message @body Assertion>.
|
Message = <message @body Assertion>.
|
||||||
Sync = <sync @peer ref>.
|
Sync = <sync @peer embedded>.
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
version 1 .
|
version 1 .
|
||||||
pointer Actor.Ref .
|
embeddedType Actor.Ref .
|
||||||
|
|
||||||
UserId = int .
|
UserId = int .
|
||||||
|
|
||||||
Join = <joinedUser @uid UserId @handle ref>.
|
Join = <joinedUser @uid UserId @handle embedded>.
|
||||||
|
|
||||||
NickClaim = <claimNick @uid UserId @name string @k ref>.
|
NickClaim = <claimNick @uid UserId @name string @k embedded>.
|
||||||
|
|
||||||
UserInfo = <user @uid UserId @name string>.
|
UserInfo = <user @uid UserId @name string>.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
version 1 .
|
version 1 .
|
||||||
pointer Actor.Ref .
|
embeddedType Actor.Ref .
|
||||||
|
|
||||||
Present = <Present @username string>.
|
Present = <Present @username string>.
|
||||||
Says = <Says @who string @what string>.
|
Says = <Says @who string @what string>.
|
||||||
|
|
|
@ -26,10 +26,10 @@ CDict = <dict>.
|
||||||
|
|
||||||
Lit = <lit @value any>.
|
Lit = <lit @value any>.
|
||||||
|
|
||||||
Pattern = PDiscard / PAtom / PPointer / PBind / PAnd / PNot / Lit / PCompound .
|
Pattern = PDiscard / PAtom / PEmbedded / PBind / PAnd / PNot / Lit / PCompound .
|
||||||
PDiscard = <_>.
|
PDiscard = <_>.
|
||||||
PAtom = =Boolean / =Float / =Double / =SignedInteger / =String / =ByteString / =Symbol .
|
PAtom = =Boolean / =Float / =Double / =SignedInteger / =String / =ByteString / =Symbol .
|
||||||
PPointer = =Pointer .
|
PEmbedded = =Embedded .
|
||||||
PBind = <bind @name symbol @pattern Pattern>.
|
PBind = <bind @name symbol @pattern Pattern>.
|
||||||
PAnd = <and [@patterns Pattern ...]>.
|
PAnd = <and [@patterns Pattern ...]>.
|
||||||
PNot = <not @pattern Pattern>.
|
PNot = <not @pattern Pattern>.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
version 1 .
|
version 1 .
|
||||||
pointer Actor.Ref .
|
embeddedType Actor.Ref .
|
||||||
|
|
||||||
Instance = <Instance @name string @argument any>.
|
Instance = <Instance @name string @argument any>.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Pointer } from "@preserves/core";
|
import { Embedded } from "@preserves/core";
|
||||||
import { BoxState, $SetBox, fromBoxState } from "../gen/box-protocol.js";
|
import { BoxState, $SetBox, fromBoxState } from "../gen/box-protocol.js";
|
||||||
import { fromObserve, Observe } from "../gen/dataspace.js";
|
import { fromObserve, Observe } from "../gen/dataspace.js";
|
||||||
import { Assertion, Handle, Ref, Turn } from "../runtime/actor.js";
|
import { Assertion, Handle, Ref, Turn } from "../runtime/actor.js";
|
||||||
|
@ -7,7 +7,7 @@ let startTime = Date.now();
|
||||||
let prevValue = 0;
|
let prevValue = 0;
|
||||||
|
|
||||||
export default function (t: Turn, arg: Assertion) {
|
export default function (t: Turn, arg: Assertion) {
|
||||||
const [ds_p, LIMIT, REPORT_EVERY]: [Pointer<Ref>, number, number] = Array.isArray(arg) && arg.length === 3
|
const [ds_p, LIMIT, REPORT_EVERY]: [Embedded<Ref>, number, number] = Array.isArray(arg) && arg.length === 3
|
||||||
? arg as any
|
? arg as any
|
||||||
: [arg, 50000, 2500];
|
: [arg, 50000, 2500];
|
||||||
const ds = ds_p.embeddedValue;
|
const ds = ds_p.embeddedValue;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { Pointer } from "@preserves/core";
|
import { Embedded } from "@preserves/core";
|
||||||
import { $BoxState, fromSetBox, SetBox } from "../gen/box-protocol.js";
|
import { $BoxState, fromSetBox, SetBox } from "../gen/box-protocol.js";
|
||||||
import { fromObserve, Observe } from "../gen/dataspace.js";
|
import { fromObserve, Observe } from "../gen/dataspace.js";
|
||||||
import { Assertion, Ref, Turn } from "../runtime/actor.js";
|
import { Assertion, Ref, Turn } from "../runtime/actor.js";
|
||||||
|
|
||||||
export default function (t: Turn, ds_p: Pointer<Ref>) {
|
export default function (t: Turn, ds_p: Embedded<Ref>) {
|
||||||
const ds = ds_p.embeddedValue;
|
const ds = ds_p.embeddedValue;
|
||||||
console.log('Spawning Client');
|
console.log('Spawning Client');
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Actor, Assertion, Turn } from '../runtime/actor.js';
|
import { Actor, Assertion, Turn } from '../runtime/actor.js';
|
||||||
import { Dictionary, embed } from '@preserves/core';
|
import { Dictionary, embed } from '@preserves/core';
|
||||||
import { Dataspace } from '../runtime/dataspace.js';
|
import { Dataspace } from '../runtime/dataspace.js';
|
||||||
import { _ptr, attenuate, CRec, Lit, Pattern, PCompound, rfilter, ConstructorSpec } from '../runtime/rewrite.js';
|
import { _embedded, attenuate, CRec, Lit, Pattern, PCompound, rfilter, ConstructorSpec } from '../runtime/rewrite.js';
|
||||||
import { $BoxState, $SetBox } from '../gen/box-protocol.js';
|
import { $BoxState, $SetBox } from '../gen/box-protocol.js';
|
||||||
import { $Observe } from '../gen/dataspace.js';
|
import { $Observe } from '../gen/dataspace.js';
|
||||||
import { spawnWorker } from '../worker/index.js';
|
import { spawnWorker } from '../worker/index.js';
|
||||||
|
@ -38,7 +38,7 @@ new Actor(async (t: Turn) => {
|
||||||
})),
|
})),
|
||||||
Pattern.PCompound(PCompound({
|
Pattern.PCompound(PCompound({
|
||||||
ctor: ConstructorSpec.CRec(CRec({ label: $Observe, arity: 2 })),
|
ctor: ConstructorSpec.CRec(CRec({ label: $Observe, arity: 2 })),
|
||||||
members: new Dictionary<_ptr, Pattern>([
|
members: new Dictionary<_embedded, Pattern>([
|
||||||
[0, Pattern.Lit(Lit($SetBox))]])
|
[0, Pattern.Lit(Lit($SetBox))]])
|
||||||
}))));
|
}))));
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ new Actor(async (t: Turn) => {
|
||||||
})),
|
})),
|
||||||
Pattern.PCompound(PCompound({
|
Pattern.PCompound(PCompound({
|
||||||
ctor: ConstructorSpec.CRec(CRec({ label: $Observe, arity: 2 })),
|
ctor: ConstructorSpec.CRec(CRec({ label: $Observe, arity: 2 })),
|
||||||
members: new Dictionary<_ptr, Pattern>([
|
members: new Dictionary<_embedded, Pattern>([
|
||||||
[0, Pattern.Lit(Lit($BoxState))]])
|
[0, Pattern.Lit(Lit($BoxState))]])
|
||||||
}))));
|
}))));
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@ import { $joinedUser, $says, $user, asJoin, asSays, asUserInfo, fromNickClaim, f
|
||||||
import { during, observe } from "../runtime/dataspace.js";
|
import { during, observe } from "../runtime/dataspace.js";
|
||||||
import { Assertion, Ref, Turn } from "../runtime/actor.js";
|
import { Assertion, Ref, Turn } from "../runtime/actor.js";
|
||||||
import { attachReadline } from './readline.js';
|
import { attachReadline } from './readline.js';
|
||||||
import { Pointer } from "@preserves/core";
|
import { Embedded } from "@preserves/core";
|
||||||
|
|
||||||
export default function (t: Turn, ds_ptr: Pointer<Ref>) {
|
export default function (t: Turn, ds_ptr: Embedded<Ref>) {
|
||||||
const ds = ds_ptr.embeddedValue;
|
const ds = ds_ptr.embeddedValue;
|
||||||
observe(t, ds, $joinedUser, during(async (t, j0) => {
|
observe(t, ds, $joinedUser, during(async (t, j0) => {
|
||||||
const j = asJoin(j0);
|
const j = asJoin(j0);
|
||||||
|
|
|
@ -14,12 +14,12 @@ import {
|
||||||
} from "../gen/secure-chat-protocol.js";
|
} from "../gen/secure-chat-protocol.js";
|
||||||
import { Assertion, Handle, Ref, Turn } from "../runtime/actor.js";
|
import { Assertion, Handle, Ref, Turn } from "../runtime/actor.js";
|
||||||
import { observe, during, $Observe, asObserve, Dataspace } from "../runtime/dataspace.js";
|
import { observe, during, $Observe, asObserve, Dataspace } from "../runtime/dataspace.js";
|
||||||
import { attenuate, rfilter, pRec, pPointer, pString, pLit } from "../runtime/rewrite.js";
|
import { attenuate, rfilter, pRec, pEmbedded, pString, pLit } from "../runtime/rewrite.js";
|
||||||
import { attenuate as sturdyAttenuate, KEY_LENGTH, sturdyEncode, fromSturdyRef, mint } from "../transport/sturdy.js";
|
import { attenuate as sturdyAttenuate, KEY_LENGTH, sturdyEncode, fromSturdyRef, mint } from "../transport/sturdy.js";
|
||||||
import { Bind, fromBind } from "../gen/gatekeeper.js";
|
import { Bind, fromBind } from "../gen/gatekeeper.js";
|
||||||
import { Bytes, Pointer } from "@preserves/core";
|
import { Bytes, Embedded } from "@preserves/core";
|
||||||
|
|
||||||
export default function (t: Turn, gatekeeperDs_ptr: Pointer<Ref>) {
|
export default function (t: Turn, gatekeeperDs_ptr: Embedded<Ref>) {
|
||||||
const gatekeeperDs = gatekeeperDs_ptr.embeddedValue;
|
const gatekeeperDs = gatekeeperDs_ptr.embeddedValue;
|
||||||
|
|
||||||
const ds = t.ref(new Dataspace());
|
const ds = t.ref(new Dataspace());
|
||||||
|
@ -28,7 +28,7 @@ export default function (t: Turn, gatekeeperDs_ptr: Pointer<Ref>) {
|
||||||
const chatKey = new Bytes(KEY_LENGTH);
|
const chatKey = new Bytes(KEY_LENGTH);
|
||||||
t.assert(gatekeeperDs, fromBind(Bind({ oid: chatOid, key: chatKey, target: ds })));
|
t.assert(gatekeeperDs, fromBind(Bind({ oid: chatOid, key: chatKey, target: ds })));
|
||||||
mint(chatOid, chatKey).then(async r => {
|
mint(chatOid, chatKey).then(async r => {
|
||||||
r = await sturdyAttenuate(r, rfilter(pRec($Observe, pLit($joinedUser), pPointer())));
|
r = await sturdyAttenuate(r, rfilter(pRec($Observe, pLit($joinedUser), pEmbedded())));
|
||||||
console.log(fromSturdyRef(r).asPreservesText());
|
console.log(fromSturdyRef(r).asPreservesText());
|
||||||
console.log(sturdyEncode(fromSturdyRef(r)).toHex());
|
console.log(sturdyEncode(fromSturdyRef(r)).toHex());
|
||||||
});
|
});
|
||||||
|
@ -45,9 +45,9 @@ export default function (t: Turn, gatekeeperDs_ptr: Pointer<Ref>) {
|
||||||
t.assert(o.observer, fromJoin(Join({
|
t.assert(o.observer, fromJoin(Join({
|
||||||
uid,
|
uid,
|
||||||
handle: attenuate(ds, rfilter(
|
handle: attenuate(ds, rfilter(
|
||||||
pRec($Observe, pLit($user), pPointer()),
|
pRec($Observe, pLit($user), pEmbedded()),
|
||||||
pRec($Observe, pLit($says), pPointer()),
|
pRec($Observe, pLit($says), pEmbedded()),
|
||||||
pRec($claimNick, pLit(uid), pString(), pPointer()),
|
pRec($claimNick, pLit(uid), pString(), pEmbedded()),
|
||||||
pRec($says, pLit(uid), pString()))),
|
pRec($says, pLit(uid), pString()))),
|
||||||
})));
|
})));
|
||||||
let infoHandle: Handle | undefined;
|
let infoHandle: Handle | undefined;
|
||||||
|
|
|
@ -2,9 +2,9 @@ import { $Present, $Says, asPresent, asSays, fromPresent, fromSays, Present, Say
|
||||||
import { during, observe } from "../runtime/dataspace.js";
|
import { during, observe } from "../runtime/dataspace.js";
|
||||||
import { Assertion, Handle, Ref, Turn } from "../runtime/actor.js";
|
import { Assertion, Handle, Ref, Turn } from "../runtime/actor.js";
|
||||||
import { attachReadline } from './readline.js';
|
import { attachReadline } from './readline.js';
|
||||||
import { Pointer } from "@preserves/core";
|
import { Embedded } from "@preserves/core";
|
||||||
|
|
||||||
export default function (t: Turn, ds_ptr: Pointer<Ref>) {
|
export default function (t: Turn, ds_ptr: Embedded<Ref>) {
|
||||||
const ds = ds_ptr.embeddedValue;
|
const ds = ds_ptr.embeddedValue;
|
||||||
|
|
||||||
let username = '';
|
let username = '';
|
||||||
|
|
|
@ -14,7 +14,7 @@ async function main() {
|
||||||
label: Symbol.for('says'),
|
label: Symbol.for('says'),
|
||||||
arity: 2
|
arity: 2
|
||||||
})),
|
})),
|
||||||
members: new Dictionary<RW._ptr, RW.Pattern>([
|
members: new Dictionary<RW._embedded, RW.Pattern>([
|
||||||
[0, RW.Pattern.Lit(RW.Lit('Tony'))]])
|
[0, RW.Pattern.Lit(RW.Lit('Tony'))]])
|
||||||
}))
|
}))
|
||||||
})),
|
})),
|
||||||
|
|
|
@ -4,9 +4,9 @@ import * as _i_Actor from "../runtime/actor";
|
||||||
export const $BoxState = Symbol.for("BoxState");
|
export const $BoxState = Symbol.for("BoxState");
|
||||||
export const $SetBox = Symbol.for("SetBox");
|
export const $SetBox = Symbol.for("SetBox");
|
||||||
|
|
||||||
export type _ptr = _i_Actor.Ref;
|
export type _embedded = _i_Actor.Ref;
|
||||||
|
|
||||||
export type _val = _.Value<_ptr>;
|
export type _val = _.Value<_embedded>;
|
||||||
|
|
||||||
export type BoxState = {"value": number};
|
export type BoxState = {"value": number};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ export function asBoxState(v: _val): BoxState {
|
||||||
|
|
||||||
export function toBoxState(v: _val): undefined | BoxState {
|
export function toBoxState(v: _val): undefined | BoxState {
|
||||||
let result: undefined | BoxState;
|
let result: undefined | BoxState;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $BoxState) ? null : void 0;
|
_tmp0 = _.is(v.label, $BoxState) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -47,7 +47,7 @@ export function asSetBox(v: _val): SetBox {
|
||||||
|
|
||||||
export function toSetBox(v: _val): undefined | SetBox {
|
export function toSetBox(v: _val): undefined | SetBox {
|
||||||
let result: undefined | SetBox;
|
let result: undefined | SetBox;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $SetBox) ? null : void 0;
|
_tmp0 = _.is(v.label, $SetBox) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
|
|
@ -3,14 +3,14 @@ import * as _i_Actor from "../runtime/actor";
|
||||||
|
|
||||||
export const $Observe = Symbol.for("Observe");
|
export const $Observe = Symbol.for("Observe");
|
||||||
|
|
||||||
export type _ptr = _i_Actor.Ref;
|
export type _embedded = _i_Actor.Ref;
|
||||||
|
|
||||||
export type _val = _.Value<_ptr>;
|
export type _val = _.Value<_embedded>;
|
||||||
|
|
||||||
export type Observe = {"label": symbol, "observer": _ptr};
|
export type Observe = {"label": symbol, "observer": _embedded};
|
||||||
|
|
||||||
|
|
||||||
export function Observe({label, observer}: {label: symbol, observer: _ptr}): Observe {return {"label": label, "observer": observer};}
|
export function Observe({label, observer}: {label: symbol, observer: _embedded}): Observe {return {"label": label, "observer": observer};}
|
||||||
|
|
||||||
export function asObserve(v: _val): Observe {
|
export function asObserve(v: _val): Observe {
|
||||||
let result = toObserve(v);
|
let result = toObserve(v);
|
||||||
|
@ -20,15 +20,15 @@ export function asObserve(v: _val): Observe {
|
||||||
|
|
||||||
export function toObserve(v: _val): undefined | Observe {
|
export function toObserve(v: _val): undefined | Observe {
|
||||||
let result: undefined | Observe;
|
let result: undefined | Observe;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $Observe) ? null : void 0;
|
_tmp0 = _.is(v.label, $Observe) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
let _tmp1: (symbol) | undefined;
|
let _tmp1: (symbol) | undefined;
|
||||||
_tmp1 = typeof v[0] === 'symbol' ? v[0] : void 0;
|
_tmp1 = typeof v[0] === 'symbol' ? v[0] : void 0;
|
||||||
if (_tmp1 !== void 0) {
|
if (_tmp1 !== void 0) {
|
||||||
let _tmp2: (_ptr) | undefined;
|
let _tmp2: (_embedded) | undefined;
|
||||||
_tmp2 = _.isPointer<_ptr>(v[1]) ? v[1].embeddedValue : void 0;
|
_tmp2 = _.isEmbedded<_embedded>(v[1]) ? v[1].embeddedValue : void 0;
|
||||||
if (_tmp2 !== void 0) {result = {"label": _tmp1, "observer": _tmp2};};
|
if (_tmp2 !== void 0) {result = {"label": _tmp1, "observer": _tmp2};};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,18 +5,18 @@ import * as _i_sturdy from "./sturdy";
|
||||||
export const $bind = Symbol.for("bind");
|
export const $bind = Symbol.for("bind");
|
||||||
export const $resolve = Symbol.for("resolve");
|
export const $resolve = Symbol.for("resolve");
|
||||||
|
|
||||||
export type _ptr = _i_Actor.Ref;
|
export type _embedded = _i_Actor.Ref;
|
||||||
|
|
||||||
export type _val = _.Value<_ptr>;
|
export type _val = _.Value<_embedded>;
|
||||||
|
|
||||||
export type Resolve = {"sturdyref": _i_sturdy.SturdyRef, "observer": _ptr};
|
export type Resolve = {"sturdyref": _i_sturdy.SturdyRef, "observer": _embedded};
|
||||||
|
|
||||||
export type Bind = {"oid": _val, "key": _.Bytes, "target": _ptr};
|
export type Bind = {"oid": _val, "key": _.Bytes, "target": _embedded};
|
||||||
|
|
||||||
|
|
||||||
export function Resolve({sturdyref, observer}: {sturdyref: _i_sturdy.SturdyRef, observer: _ptr}): Resolve {return {"sturdyref": sturdyref, "observer": observer};}
|
export function Resolve({sturdyref, observer}: {sturdyref: _i_sturdy.SturdyRef, observer: _embedded}): Resolve {return {"sturdyref": sturdyref, "observer": observer};}
|
||||||
|
|
||||||
export function Bind({oid, key, target}: {oid: _val, key: _.Bytes, target: _ptr}): Bind {return {"oid": oid, "key": key, "target": target};}
|
export function Bind({oid, key, target}: {oid: _val, key: _.Bytes, target: _embedded}): Bind {return {"oid": oid, "key": key, "target": target};}
|
||||||
|
|
||||||
export function asResolve(v: _val): Resolve {
|
export function asResolve(v: _val): Resolve {
|
||||||
let result = toResolve(v);
|
let result = toResolve(v);
|
||||||
|
@ -26,15 +26,15 @@ export function asResolve(v: _val): Resolve {
|
||||||
|
|
||||||
export function toResolve(v: _val): undefined | Resolve {
|
export function toResolve(v: _val): undefined | Resolve {
|
||||||
let result: undefined | Resolve;
|
let result: undefined | Resolve;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $resolve) ? null : void 0;
|
_tmp0 = _.is(v.label, $resolve) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
let _tmp1: (_i_sturdy.SturdyRef) | undefined;
|
let _tmp1: (_i_sturdy.SturdyRef) | undefined;
|
||||||
_tmp1 = _i_sturdy.toSturdyRef(v[0]);
|
_tmp1 = _i_sturdy.toSturdyRef(v[0]);
|
||||||
if (_tmp1 !== void 0) {
|
if (_tmp1 !== void 0) {
|
||||||
let _tmp2: (_ptr) | undefined;
|
let _tmp2: (_embedded) | undefined;
|
||||||
_tmp2 = _.isPointer<_ptr>(v[1]) ? v[1].embeddedValue : void 0;
|
_tmp2 = _.isEmbedded<_embedded>(v[1]) ? v[1].embeddedValue : void 0;
|
||||||
if (_tmp2 !== void 0) {result = {"sturdyref": _tmp1, "observer": _tmp2};};
|
if (_tmp2 !== void 0) {result = {"sturdyref": _tmp1, "observer": _tmp2};};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -54,7 +54,7 @@ export function asBind(v: _val): Bind {
|
||||||
|
|
||||||
export function toBind(v: _val): undefined | Bind {
|
export function toBind(v: _val): undefined | Bind {
|
||||||
let result: undefined | Bind;
|
let result: undefined | Bind;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $bind) ? null : void 0;
|
_tmp0 = _.is(v.label, $bind) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -64,8 +64,8 @@ export function toBind(v: _val): undefined | Bind {
|
||||||
let _tmp2: (_.Bytes) | undefined;
|
let _tmp2: (_.Bytes) | undefined;
|
||||||
_tmp2 = _.Bytes.isBytes(v[1]) ? v[1] : void 0;
|
_tmp2 = _.Bytes.isBytes(v[1]) ? v[1] : void 0;
|
||||||
if (_tmp2 !== void 0) {
|
if (_tmp2 !== void 0) {
|
||||||
let _tmp3: (_ptr) | undefined;
|
let _tmp3: (_embedded) | undefined;
|
||||||
_tmp3 = _.isPointer<_ptr>(v[2]) ? v[2].embeddedValue : void 0;
|
_tmp3 = _.isEmbedded<_embedded>(v[2]) ? v[2].embeddedValue : void 0;
|
||||||
if (_tmp3 !== void 0) {result = {"oid": _tmp1, "key": _tmp2, "target": _tmp3};};
|
if (_tmp3 !== void 0) {result = {"oid": _tmp1, "key": _tmp2, "target": _tmp3};};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,9 +6,9 @@ export const $message = Symbol.for("message");
|
||||||
export const $retract = Symbol.for("retract");
|
export const $retract = Symbol.for("retract");
|
||||||
export const $sync = Symbol.for("sync");
|
export const $sync = Symbol.for("sync");
|
||||||
|
|
||||||
export type _ptr = _i_sturdy.WireRef;
|
export type _embedded = _i_sturdy.WireRef;
|
||||||
|
|
||||||
export type _val = _.Value<_ptr>;
|
export type _val = _.Value<_embedded>;
|
||||||
|
|
||||||
export type Assertion = _val;
|
export type Assertion = _val;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ export type Retract = {"handle": Handle};
|
||||||
|
|
||||||
export type Message = {"body": Assertion};
|
export type Message = {"body": Assertion};
|
||||||
|
|
||||||
export type Sync = {"peer": _ptr};
|
export type Sync = {"peer": _embedded};
|
||||||
|
|
||||||
|
|
||||||
export function Assertion(value: _val): Assertion {return value;}
|
export function Assertion(value: _val): Assertion {return value;}
|
||||||
|
@ -59,7 +59,7 @@ export function Retract(handle: Handle): Retract {return {"handle": handle};}
|
||||||
|
|
||||||
export function Message(body: Assertion): Message {return {"body": body};}
|
export function Message(body: Assertion): Message {return {"body": body};}
|
||||||
|
|
||||||
export function Sync(peer: _ptr): Sync {return {"peer": peer};}
|
export function Sync(peer: _embedded): Sync {return {"peer": peer};}
|
||||||
|
|
||||||
export function asAssertion(v: _val): Assertion {
|
export function asAssertion(v: _val): Assertion {
|
||||||
let result = toAssertion(v);
|
let result = toAssertion(v);
|
||||||
|
@ -202,7 +202,7 @@ export function asAssert(v: _val): Assert {
|
||||||
|
|
||||||
export function toAssert(v: _val): undefined | Assert {
|
export function toAssert(v: _val): undefined | Assert {
|
||||||
let result: undefined | Assert;
|
let result: undefined | Assert;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $assert) ? null : void 0;
|
_tmp0 = _.is(v.label, $assert) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -230,7 +230,7 @@ export function asRetract(v: _val): Retract {
|
||||||
|
|
||||||
export function toRetract(v: _val): undefined | Retract {
|
export function toRetract(v: _val): undefined | Retract {
|
||||||
let result: undefined | Retract;
|
let result: undefined | Retract;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $retract) ? null : void 0;
|
_tmp0 = _.is(v.label, $retract) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -252,7 +252,7 @@ export function asMessage(v: _val): Message {
|
||||||
|
|
||||||
export function toMessage(v: _val): undefined | Message {
|
export function toMessage(v: _val): undefined | Message {
|
||||||
let result: undefined | Message;
|
let result: undefined | Message;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $message) ? null : void 0;
|
_tmp0 = _.is(v.label, $message) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -274,12 +274,12 @@ export function asSync(v: _val): Sync {
|
||||||
|
|
||||||
export function toSync(v: _val): undefined | Sync {
|
export function toSync(v: _val): undefined | Sync {
|
||||||
let result: undefined | Sync;
|
let result: undefined | Sync;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $sync) ? null : void 0;
|
_tmp0 = _.is(v.label, $sync) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
let _tmp1: (_ptr) | undefined;
|
let _tmp1: (_embedded) | undefined;
|
||||||
_tmp1 = _.isPointer<_ptr>(v[0]) ? v[0].embeddedValue : void 0;
|
_tmp1 = _.isEmbedded<_embedded>(v[0]) ? v[0].embeddedValue : void 0;
|
||||||
if (_tmp1 !== void 0) {result = {"peer": _tmp1};};
|
if (_tmp1 !== void 0) {result = {"peer": _tmp1};};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,15 +7,15 @@ export const $nickConflict = Symbol.for("nickConflict");
|
||||||
export const $says = Symbol.for("says");
|
export const $says = Symbol.for("says");
|
||||||
export const $user = Symbol.for("user");
|
export const $user = Symbol.for("user");
|
||||||
|
|
||||||
export type _ptr = _i_Actor.Ref;
|
export type _embedded = _i_Actor.Ref;
|
||||||
|
|
||||||
export type _val = _.Value<_ptr>;
|
export type _val = _.Value<_embedded>;
|
||||||
|
|
||||||
export type UserId = number;
|
export type UserId = number;
|
||||||
|
|
||||||
export type Join = {"uid": UserId, "handle": _ptr};
|
export type Join = {"uid": UserId, "handle": _embedded};
|
||||||
|
|
||||||
export type NickClaim = {"uid": UserId, "name": string, "k": _ptr};
|
export type NickClaim = {"uid": UserId, "name": string, "k": _embedded};
|
||||||
|
|
||||||
export type UserInfo = {"uid": UserId, "name": string};
|
export type UserInfo = {"uid": UserId, "name": string};
|
||||||
|
|
||||||
|
@ -26,9 +26,9 @@ export type NickConflict = null;
|
||||||
|
|
||||||
export function UserId(value: number): UserId {return value;}
|
export function UserId(value: number): UserId {return value;}
|
||||||
|
|
||||||
export function Join({uid, handle}: {uid: UserId, handle: _ptr}): Join {return {"uid": uid, "handle": handle};}
|
export function Join({uid, handle}: {uid: UserId, handle: _embedded}): Join {return {"uid": uid, "handle": handle};}
|
||||||
|
|
||||||
export function NickClaim({uid, name, k}: {uid: UserId, name: string, k: _ptr}): NickClaim {return {"uid": uid, "name": name, "k": k};}
|
export function NickClaim({uid, name, k}: {uid: UserId, name: string, k: _embedded}): NickClaim {return {"uid": uid, "name": name, "k": k};}
|
||||||
|
|
||||||
export function UserInfo({uid, name}: {uid: UserId, name: string}): UserInfo {return {"uid": uid, "name": name};}
|
export function UserInfo({uid, name}: {uid: UserId, name: string}): UserInfo {return {"uid": uid, "name": name};}
|
||||||
|
|
||||||
|
@ -60,15 +60,15 @@ export function asJoin(v: _val): Join {
|
||||||
|
|
||||||
export function toJoin(v: _val): undefined | Join {
|
export function toJoin(v: _val): undefined | Join {
|
||||||
let result: undefined | Join;
|
let result: undefined | Join;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $joinedUser) ? null : void 0;
|
_tmp0 = _.is(v.label, $joinedUser) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
let _tmp1: (UserId) | undefined;
|
let _tmp1: (UserId) | undefined;
|
||||||
_tmp1 = toUserId(v[0]);
|
_tmp1 = toUserId(v[0]);
|
||||||
if (_tmp1 !== void 0) {
|
if (_tmp1 !== void 0) {
|
||||||
let _tmp2: (_ptr) | undefined;
|
let _tmp2: (_embedded) | undefined;
|
||||||
_tmp2 = _.isPointer<_ptr>(v[1]) ? v[1].embeddedValue : void 0;
|
_tmp2 = _.isEmbedded<_embedded>(v[1]) ? v[1].embeddedValue : void 0;
|
||||||
if (_tmp2 !== void 0) {result = {"uid": _tmp1, "handle": _tmp2};};
|
if (_tmp2 !== void 0) {result = {"uid": _tmp1, "handle": _tmp2};};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -86,7 +86,7 @@ export function asNickClaim(v: _val): NickClaim {
|
||||||
|
|
||||||
export function toNickClaim(v: _val): undefined | NickClaim {
|
export function toNickClaim(v: _val): undefined | NickClaim {
|
||||||
let result: undefined | NickClaim;
|
let result: undefined | NickClaim;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $claimNick) ? null : void 0;
|
_tmp0 = _.is(v.label, $claimNick) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -96,8 +96,8 @@ export function toNickClaim(v: _val): undefined | NickClaim {
|
||||||
let _tmp2: (string) | undefined;
|
let _tmp2: (string) | undefined;
|
||||||
_tmp2 = typeof v[1] === 'string' ? v[1] : void 0;
|
_tmp2 = typeof v[1] === 'string' ? v[1] : void 0;
|
||||||
if (_tmp2 !== void 0) {
|
if (_tmp2 !== void 0) {
|
||||||
let _tmp3: (_ptr) | undefined;
|
let _tmp3: (_embedded) | undefined;
|
||||||
_tmp3 = _.isPointer<_ptr>(v[2]) ? v[2].embeddedValue : void 0;
|
_tmp3 = _.isEmbedded<_embedded>(v[2]) ? v[2].embeddedValue : void 0;
|
||||||
if (_tmp3 !== void 0) {result = {"uid": _tmp1, "name": _tmp2, "k": _tmp3};};
|
if (_tmp3 !== void 0) {result = {"uid": _tmp1, "name": _tmp2, "k": _tmp3};};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -118,7 +118,7 @@ export function asUserInfo(v: _val): UserInfo {
|
||||||
|
|
||||||
export function toUserInfo(v: _val): undefined | UserInfo {
|
export function toUserInfo(v: _val): undefined | UserInfo {
|
||||||
let result: undefined | UserInfo;
|
let result: undefined | UserInfo;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $user) ? null : void 0;
|
_tmp0 = _.is(v.label, $user) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -144,7 +144,7 @@ export function asSays(v: _val): Says {
|
||||||
|
|
||||||
export function toSays(v: _val): undefined | Says {
|
export function toSays(v: _val): undefined | Says {
|
||||||
let result: undefined | Says;
|
let result: undefined | Says;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $says) ? null : void 0;
|
_tmp0 = _.is(v.label, $says) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -170,7 +170,7 @@ export function asNickConflict(v: _val): NickConflict {
|
||||||
|
|
||||||
export function toNickConflict(v: _val): undefined | NickConflict {
|
export function toNickConflict(v: _val): undefined | NickConflict {
|
||||||
let result: undefined | NickConflict;
|
let result: undefined | NickConflict;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $nickConflict) ? null : void 0;
|
_tmp0 = _.is(v.label, $nickConflict) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {result = null;};
|
if (_tmp0 !== void 0) {result = null;};
|
||||||
|
|
|
@ -4,9 +4,9 @@ import * as _i_Actor from "../runtime/actor";
|
||||||
export const $Present = Symbol.for("Present");
|
export const $Present = Symbol.for("Present");
|
||||||
export const $Says = Symbol.for("Says");
|
export const $Says = Symbol.for("Says");
|
||||||
|
|
||||||
export type _ptr = _i_Actor.Ref;
|
export type _embedded = _i_Actor.Ref;
|
||||||
|
|
||||||
export type _val = _.Value<_ptr>;
|
export type _val = _.Value<_embedded>;
|
||||||
|
|
||||||
export type Present = {"username": string};
|
export type Present = {"username": string};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ export function asPresent(v: _val): Present {
|
||||||
|
|
||||||
export function toPresent(v: _val): undefined | Present {
|
export function toPresent(v: _val): undefined | Present {
|
||||||
let result: undefined | Present;
|
let result: undefined | Present;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $Present) ? null : void 0;
|
_tmp0 = _.is(v.label, $Present) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -47,7 +47,7 @@ export function asSays(v: _val): Says {
|
||||||
|
|
||||||
export function toSays(v: _val): undefined | Says {
|
export function toSays(v: _val): undefined | Says {
|
||||||
let result: undefined | Says;
|
let result: undefined | Says;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $Says) ? null : void 0;
|
_tmp0 = _.is(v.label, $Says) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
|
|
@ -5,8 +5,8 @@ export const $1 = 1;
|
||||||
export const $Boolean = Symbol.for("Boolean");
|
export const $Boolean = Symbol.for("Boolean");
|
||||||
export const $ByteString = Symbol.for("ByteString");
|
export const $ByteString = Symbol.for("ByteString");
|
||||||
export const $Double = Symbol.for("Double");
|
export const $Double = Symbol.for("Double");
|
||||||
|
export const $Embedded = Symbol.for("Embedded");
|
||||||
export const $Float = Symbol.for("Float");
|
export const $Float = Symbol.for("Float");
|
||||||
export const $Pointer = Symbol.for("Pointer");
|
|
||||||
export const $SignedInteger = Symbol.for("SignedInteger");
|
export const $SignedInteger = Symbol.for("SignedInteger");
|
||||||
export const $String = Symbol.for("String");
|
export const $String = Symbol.for("String");
|
||||||
export const $Symbol = Symbol.for("Symbol");
|
export const $Symbol = Symbol.for("Symbol");
|
||||||
|
@ -23,9 +23,9 @@ export const $rec = Symbol.for("rec");
|
||||||
export const $ref = Symbol.for("ref");
|
export const $ref = Symbol.for("ref");
|
||||||
export const $rewrite = Symbol.for("rewrite");
|
export const $rewrite = Symbol.for("rewrite");
|
||||||
|
|
||||||
export type _ptr = any;
|
export type _embedded = any;
|
||||||
|
|
||||||
export type _val = _.Value<_ptr>;
|
export type _val = _.Value<_embedded>;
|
||||||
|
|
||||||
export type SturdyRef = {"oid": _val, "caveatChain": Array<Attenuation>, "sig": _.Bytes};
|
export type SturdyRef = {"oid": _val, "caveatChain": Array<Attenuation>, "sig": _.Bytes};
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ export type Lit = {"value": _val};
|
||||||
export type Pattern = (
|
export type Pattern = (
|
||||||
{"_variant": "PDiscard", "value": PDiscard} |
|
{"_variant": "PDiscard", "value": PDiscard} |
|
||||||
{"_variant": "PAtom", "value": PAtom} |
|
{"_variant": "PAtom", "value": PAtom} |
|
||||||
{"_variant": "PPointer", "value": PPointer} |
|
{"_variant": "PEmbedded", "value": PEmbedded} |
|
||||||
{"_variant": "PBind", "value": PBind} |
|
{"_variant": "PBind", "value": PBind} |
|
||||||
{"_variant": "PAnd", "value": PAnd} |
|
{"_variant": "PAnd", "value": PAnd} |
|
||||||
{"_variant": "PNot", "value": PNot} |
|
{"_variant": "PNot", "value": PNot} |
|
||||||
|
@ -84,7 +84,7 @@ export type PAtom = (
|
||||||
{"_variant": "Symbol"}
|
{"_variant": "Symbol"}
|
||||||
);
|
);
|
||||||
|
|
||||||
export type PPointer = null;
|
export type PEmbedded = null;
|
||||||
|
|
||||||
export type PBind = {"name": symbol, "pattern": Pattern};
|
export type PBind = {"name": symbol, "pattern": Pattern};
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ export type PNot = {"pattern": Pattern};
|
||||||
|
|
||||||
export type PCompound = {"ctor": ConstructorSpec, "members": PCompoundMembers};
|
export type PCompound = {"ctor": ConstructorSpec, "members": PCompoundMembers};
|
||||||
|
|
||||||
export type PCompoundMembers = _.KeyedDictionary<_val, Pattern, _ptr>;
|
export type PCompoundMembers = _.KeyedDictionary<_val, Pattern, _embedded>;
|
||||||
|
|
||||||
export type Template = (
|
export type Template = (
|
||||||
{"_variant": "TRef", "value": TRef} |
|
{"_variant": "TRef", "value": TRef} |
|
||||||
|
@ -106,7 +106,7 @@ export type TRef = {"name": symbol};
|
||||||
|
|
||||||
export type TCompound = {"ctor": ConstructorSpec, "members": TCompoundMembers};
|
export type TCompound = {"ctor": ConstructorSpec, "members": TCompoundMembers};
|
||||||
|
|
||||||
export type TCompoundMembers = _.KeyedDictionary<_val, Template, _ptr>;
|
export type TCompoundMembers = _.KeyedDictionary<_val, Template, _embedded>;
|
||||||
|
|
||||||
|
|
||||||
export function SturdyRef(
|
export function SturdyRef(
|
||||||
|
@ -148,7 +148,7 @@ export function Lit(value: _val): Lit {return {"value": value};}
|
||||||
export namespace Pattern {
|
export namespace Pattern {
|
||||||
export function PDiscard(value: PDiscard): Pattern {return {"_variant": "PDiscard", "value": value};};
|
export function PDiscard(value: PDiscard): Pattern {return {"_variant": "PDiscard", "value": value};};
|
||||||
export function PAtom(value: PAtom): Pattern {return {"_variant": "PAtom", "value": value};};
|
export function PAtom(value: PAtom): Pattern {return {"_variant": "PAtom", "value": value};};
|
||||||
export function PPointer(value: PPointer): Pattern {return {"_variant": "PPointer", "value": value};};
|
export function PEmbedded(value: PEmbedded): Pattern {return {"_variant": "PEmbedded", "value": value};};
|
||||||
export function PBind(value: PBind): Pattern {return {"_variant": "PBind", "value": value};};
|
export function PBind(value: PBind): Pattern {return {"_variant": "PBind", "value": value};};
|
||||||
export function PAnd(value: PAnd): Pattern {return {"_variant": "PAnd", "value": value};};
|
export function PAnd(value: PAnd): Pattern {return {"_variant": "PAnd", "value": value};};
|
||||||
export function PNot(value: PNot): Pattern {return {"_variant": "PNot", "value": value};};
|
export function PNot(value: PNot): Pattern {return {"_variant": "PNot", "value": value};};
|
||||||
|
@ -168,7 +168,7 @@ export namespace PAtom {
|
||||||
export function Symbol(): PAtom {return {"_variant": "Symbol"};};
|
export function Symbol(): PAtom {return {"_variant": "Symbol"};};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function PPointer(): PPointer {return null;}
|
export function PEmbedded(): PEmbedded {return null;}
|
||||||
|
|
||||||
export function PBind({name, pattern}: {name: symbol, pattern: Pattern}): PBind {return {"name": name, "pattern": pattern};}
|
export function PBind({name, pattern}: {name: symbol, pattern: Pattern}): PBind {return {"name": name, "pattern": pattern};}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ export function PNot(pattern: Pattern): PNot {return {"pattern": pattern};}
|
||||||
|
|
||||||
export function PCompound({ctor, members}: {ctor: ConstructorSpec, members: PCompoundMembers}): PCompound {return {"ctor": ctor, "members": members};}
|
export function PCompound({ctor, members}: {ctor: ConstructorSpec, members: PCompoundMembers}): PCompound {return {"ctor": ctor, "members": members};}
|
||||||
|
|
||||||
export function PCompoundMembers(value: _.KeyedDictionary<_val, Pattern, _ptr>): PCompoundMembers {return value;}
|
export function PCompoundMembers(value: _.KeyedDictionary<_val, Pattern, _embedded>): PCompoundMembers {return value;}
|
||||||
|
|
||||||
export namespace Template {
|
export namespace Template {
|
||||||
export function TRef(value: TRef): Template {return {"_variant": "TRef", "value": value};};
|
export function TRef(value: TRef): Template {return {"_variant": "TRef", "value": value};};
|
||||||
|
@ -190,7 +190,7 @@ export function TRef(name: symbol): TRef {return {"name": name};}
|
||||||
|
|
||||||
export function TCompound({ctor, members}: {ctor: ConstructorSpec, members: TCompoundMembers}): TCompound {return {"ctor": ctor, "members": members};}
|
export function TCompound({ctor, members}: {ctor: ConstructorSpec, members: TCompoundMembers}): TCompound {return {"ctor": ctor, "members": members};}
|
||||||
|
|
||||||
export function TCompoundMembers(value: _.KeyedDictionary<_val, Template, _ptr>): TCompoundMembers {return value;}
|
export function TCompoundMembers(value: _.KeyedDictionary<_val, Template, _embedded>): TCompoundMembers {return value;}
|
||||||
|
|
||||||
export function asSturdyRef(v: _val): SturdyRef {
|
export function asSturdyRef(v: _val): SturdyRef {
|
||||||
let result = toSturdyRef(v);
|
let result = toSturdyRef(v);
|
||||||
|
@ -200,7 +200,7 @@ export function asSturdyRef(v: _val): SturdyRef {
|
||||||
|
|
||||||
export function toSturdyRef(v: _val): undefined | SturdyRef {
|
export function toSturdyRef(v: _val): undefined | SturdyRef {
|
||||||
let result: undefined | SturdyRef;
|
let result: undefined | SturdyRef;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $ref) ? null : void 0;
|
_tmp0 = _.is(v.label, $ref) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -296,7 +296,7 @@ export function asRewrite(v: _val): Rewrite {
|
||||||
|
|
||||||
export function toRewrite(v: _val): undefined | Rewrite {
|
export function toRewrite(v: _val): undefined | Rewrite {
|
||||||
let result: undefined | Rewrite;
|
let result: undefined | Rewrite;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $rewrite) ? null : void 0;
|
_tmp0 = _.is(v.label, $rewrite) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -324,7 +324,7 @@ export function asAlts(v: _val): Alts {
|
||||||
|
|
||||||
export function toAlts(v: _val): undefined | Alts {
|
export function toAlts(v: _val): undefined | Alts {
|
||||||
let result: undefined | Alts;
|
let result: undefined | Alts;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $or) ? null : void 0;
|
_tmp0 = _.is(v.label, $or) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -462,7 +462,7 @@ export function asCRec(v: _val): CRec {
|
||||||
|
|
||||||
export function toCRec(v: _val): undefined | CRec {
|
export function toCRec(v: _val): undefined | CRec {
|
||||||
let result: undefined | CRec;
|
let result: undefined | CRec;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $rec) ? null : void 0;
|
_tmp0 = _.is(v.label, $rec) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -488,7 +488,7 @@ export function asCArr(v: _val): CArr {
|
||||||
|
|
||||||
export function toCArr(v: _val): undefined | CArr {
|
export function toCArr(v: _val): undefined | CArr {
|
||||||
let result: undefined | CArr;
|
let result: undefined | CArr;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $arr) ? null : void 0;
|
_tmp0 = _.is(v.label, $arr) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -510,7 +510,7 @@ export function asCDict(v: _val): CDict {
|
||||||
|
|
||||||
export function toCDict(v: _val): undefined | CDict {
|
export function toCDict(v: _val): undefined | CDict {
|
||||||
let result: undefined | CDict;
|
let result: undefined | CDict;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $dict) ? null : void 0;
|
_tmp0 = _.is(v.label, $dict) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {result = null;};
|
if (_tmp0 !== void 0) {result = null;};
|
||||||
|
@ -528,7 +528,7 @@ export function asLit(v: _val): Lit {
|
||||||
|
|
||||||
export function toLit(v: _val): undefined | Lit {
|
export function toLit(v: _val): undefined | Lit {
|
||||||
let result: undefined | Lit;
|
let result: undefined | Lit;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $lit) ? null : void 0;
|
_tmp0 = _.is(v.label, $lit) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -558,9 +558,9 @@ export function toPattern(v: _val): undefined | Pattern {
|
||||||
_tmp1 = toPAtom(v);
|
_tmp1 = toPAtom(v);
|
||||||
if (_tmp1 !== void 0) {result = {"_variant": "PAtom", "value": _tmp1};};
|
if (_tmp1 !== void 0) {result = {"_variant": "PAtom", "value": _tmp1};};
|
||||||
if (result === void 0) {
|
if (result === void 0) {
|
||||||
let _tmp2: (PPointer) | undefined;
|
let _tmp2: (PEmbedded) | undefined;
|
||||||
_tmp2 = toPPointer(v);
|
_tmp2 = toPEmbedded(v);
|
||||||
if (_tmp2 !== void 0) {result = {"_variant": "PPointer", "value": _tmp2};};
|
if (_tmp2 !== void 0) {result = {"_variant": "PEmbedded", "value": _tmp2};};
|
||||||
if (result === void 0) {
|
if (result === void 0) {
|
||||||
let _tmp3: (PBind) | undefined;
|
let _tmp3: (PBind) | undefined;
|
||||||
_tmp3 = toPBind(v);
|
_tmp3 = toPBind(v);
|
||||||
|
@ -595,7 +595,7 @@ export function fromPattern(_v: Pattern): _val {
|
||||||
switch (_v._variant) {
|
switch (_v._variant) {
|
||||||
case "PDiscard": {return fromPDiscard(_v.value);};
|
case "PDiscard": {return fromPDiscard(_v.value);};
|
||||||
case "PAtom": {return fromPAtom(_v.value);};
|
case "PAtom": {return fromPAtom(_v.value);};
|
||||||
case "PPointer": {return fromPPointer(_v.value);};
|
case "PEmbedded": {return fromPEmbedded(_v.value);};
|
||||||
case "PBind": {return fromPBind(_v.value);};
|
case "PBind": {return fromPBind(_v.value);};
|
||||||
case "PAnd": {return fromPAnd(_v.value);};
|
case "PAnd": {return fromPAnd(_v.value);};
|
||||||
case "PNot": {return fromPNot(_v.value);};
|
case "PNot": {return fromPNot(_v.value);};
|
||||||
|
@ -612,7 +612,7 @@ export function asPDiscard(v: _val): PDiscard {
|
||||||
|
|
||||||
export function toPDiscard(v: _val): undefined | PDiscard {
|
export function toPDiscard(v: _val): undefined | PDiscard {
|
||||||
let result: undefined | PDiscard;
|
let result: undefined | PDiscard;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $_) ? null : void 0;
|
_tmp0 = _.is(v.label, $_) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {result = null;};
|
if (_tmp0 !== void 0) {result = null;};
|
||||||
|
@ -678,21 +678,21 @@ export function fromPAtom(_v: PAtom): _val {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function asPPointer(v: _val): PPointer {
|
export function asPEmbedded(v: _val): PEmbedded {
|
||||||
let result = toPPointer(v);
|
let result = toPEmbedded(v);
|
||||||
if (result === void 0) throw new TypeError(`Invalid PPointer: ${_.stringify(v)}`);
|
if (result === void 0) throw new TypeError(`Invalid PEmbedded: ${_.stringify(v)}`);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toPPointer(v: _val): undefined | PPointer {
|
export function toPEmbedded(v: _val): undefined | PEmbedded {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
let result: undefined | PPointer;
|
let result: undefined | PEmbedded;
|
||||||
_tmp0 = _.is(v, $Pointer) ? null : void 0;
|
_tmp0 = _.is(v, $Embedded) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {result = _tmp0;};
|
if (_tmp0 !== void 0) {result = _tmp0;};
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fromPPointer(_v: PPointer): _val {return $Pointer;}
|
export function fromPEmbedded(_v: PEmbedded): _val {return $Embedded;}
|
||||||
|
|
||||||
export function asPBind(v: _val): PBind {
|
export function asPBind(v: _val): PBind {
|
||||||
let result = toPBind(v);
|
let result = toPBind(v);
|
||||||
|
@ -702,7 +702,7 @@ export function asPBind(v: _val): PBind {
|
||||||
|
|
||||||
export function toPBind(v: _val): undefined | PBind {
|
export function toPBind(v: _val): undefined | PBind {
|
||||||
let result: undefined | PBind;
|
let result: undefined | PBind;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $bind) ? null : void 0;
|
_tmp0 = _.is(v.label, $bind) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -728,7 +728,7 @@ export function asPAnd(v: _val): PAnd {
|
||||||
|
|
||||||
export function toPAnd(v: _val): undefined | PAnd {
|
export function toPAnd(v: _val): undefined | PAnd {
|
||||||
let result: undefined | PAnd;
|
let result: undefined | PAnd;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $and) ? null : void 0;
|
_tmp0 = _.is(v.label, $and) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -763,7 +763,7 @@ export function asPNot(v: _val): PNot {
|
||||||
|
|
||||||
export function toPNot(v: _val): undefined | PNot {
|
export function toPNot(v: _val): undefined | PNot {
|
||||||
let result: undefined | PNot;
|
let result: undefined | PNot;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $not) ? null : void 0;
|
_tmp0 = _.is(v.label, $not) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -785,7 +785,7 @@ export function asPCompound(v: _val): PCompound {
|
||||||
|
|
||||||
export function toPCompound(v: _val): undefined | PCompound {
|
export function toPCompound(v: _val): undefined | PCompound {
|
||||||
let result: undefined | PCompound;
|
let result: undefined | PCompound;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $compound) ? null : void 0;
|
_tmp0 = _.is(v.label, $compound) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -815,9 +815,9 @@ export function asPCompoundMembers(v: _val): PCompoundMembers {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toPCompoundMembers(v: _val): undefined | PCompoundMembers {
|
export function toPCompoundMembers(v: _val): undefined | PCompoundMembers {
|
||||||
let _tmp0: (_.KeyedDictionary<_val, Pattern, _ptr>) | undefined;
|
let _tmp0: (_.KeyedDictionary<_val, Pattern, _embedded>) | undefined;
|
||||||
let result: undefined | PCompoundMembers;
|
let result: undefined | PCompoundMembers;
|
||||||
if (_.Dictionary.isDictionary<_ptr>(v)) {
|
if (_.Dictionary.isDictionary<_embedded>(v)) {
|
||||||
_tmp0 = new _.KeyedDictionary();
|
_tmp0 = new _.KeyedDictionary();
|
||||||
for (const [_tmp2, _tmp1] of v) {
|
for (const [_tmp2, _tmp1] of v) {
|
||||||
let _tmp3: (_val) | undefined;
|
let _tmp3: (_val) | undefined;
|
||||||
|
@ -836,7 +836,7 @@ export function toPCompoundMembers(v: _val): undefined | PCompoundMembers {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fromPCompoundMembers(_v: PCompoundMembers): _val {
|
export function fromPCompoundMembers(_v: PCompoundMembers): _val {
|
||||||
return new _.Dictionary<_ptr>(_.Array.from(_v.entries()).map(([k, v]) => [k, fromPattern(v)]));
|
return new _.Dictionary<_embedded>(_.Array.from(_v.entries()).map(([k, v]) => [k, fromPattern(v)]));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function asTemplate(v: _val): Template {
|
export function asTemplate(v: _val): Template {
|
||||||
|
@ -879,7 +879,7 @@ export function asTRef(v: _val): TRef {
|
||||||
|
|
||||||
export function toTRef(v: _val): undefined | TRef {
|
export function toTRef(v: _val): undefined | TRef {
|
||||||
let result: undefined | TRef;
|
let result: undefined | TRef;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $ref) ? null : void 0;
|
_tmp0 = _.is(v.label, $ref) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -901,7 +901,7 @@ export function asTCompound(v: _val): TCompound {
|
||||||
|
|
||||||
export function toTCompound(v: _val): undefined | TCompound {
|
export function toTCompound(v: _val): undefined | TCompound {
|
||||||
let result: undefined | TCompound;
|
let result: undefined | TCompound;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $compound) ? null : void 0;
|
_tmp0 = _.is(v.label, $compound) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
@ -931,9 +931,9 @@ export function asTCompoundMembers(v: _val): TCompoundMembers {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toTCompoundMembers(v: _val): undefined | TCompoundMembers {
|
export function toTCompoundMembers(v: _val): undefined | TCompoundMembers {
|
||||||
let _tmp0: (_.KeyedDictionary<_val, Template, _ptr>) | undefined;
|
let _tmp0: (_.KeyedDictionary<_val, Template, _embedded>) | undefined;
|
||||||
let result: undefined | TCompoundMembers;
|
let result: undefined | TCompoundMembers;
|
||||||
if (_.Dictionary.isDictionary<_ptr>(v)) {
|
if (_.Dictionary.isDictionary<_embedded>(v)) {
|
||||||
_tmp0 = new _.KeyedDictionary();
|
_tmp0 = new _.KeyedDictionary();
|
||||||
for (const [_tmp2, _tmp1] of v) {
|
for (const [_tmp2, _tmp1] of v) {
|
||||||
let _tmp3: (_val) | undefined;
|
let _tmp3: (_val) | undefined;
|
||||||
|
@ -952,6 +952,6 @@ export function toTCompoundMembers(v: _val): undefined | TCompoundMembers {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fromTCompoundMembers(_v: TCompoundMembers): _val {
|
export function fromTCompoundMembers(_v: TCompoundMembers): _val {
|
||||||
return new _.Dictionary<_ptr>(_.Array.from(_v.entries()).map(([k, v]) => [k, fromTemplate(v)]));
|
return new _.Dictionary<_embedded>(_.Array.from(_v.entries()).map(([k, v]) => [k, fromTemplate(v)]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ import * as _i_Actor from "../runtime/actor";
|
||||||
|
|
||||||
export const $Instance = Symbol.for("Instance");
|
export const $Instance = Symbol.for("Instance");
|
||||||
|
|
||||||
export type _ptr = _i_Actor.Ref;
|
export type _embedded = _i_Actor.Ref;
|
||||||
|
|
||||||
export type _val = _.Value<_ptr>;
|
export type _val = _.Value<_embedded>;
|
||||||
|
|
||||||
export type Instance = {"name": string, "argument": _val};
|
export type Instance = {"name": string, "argument": _val};
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ export function asInstance(v: _val): Instance {
|
||||||
|
|
||||||
export function toInstance(v: _val): undefined | Instance {
|
export function toInstance(v: _val): undefined | Instance {
|
||||||
let result: undefined | Instance;
|
let result: undefined | Instance;
|
||||||
if (_.Record.isRecord<_val, _.Tuple<_val>, _ptr>(v)) {
|
if (_.Record.isRecord<_val, _.Tuple<_val>, _embedded>(v)) {
|
||||||
let _tmp0: (null) | undefined;
|
let _tmp0: (null) | undefined;
|
||||||
_tmp0 = _.is(v.label, $Instance) ? null : void 0;
|
_tmp0 = _.is(v.label, $Instance) ? null : void 0;
|
||||||
if (_tmp0 !== void 0) {
|
if (_tmp0 !== void 0) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Bags and Deltas (which are Bags where item-counts can be negative).
|
// Bags and Deltas (which are Bags where item-counts can be negative).
|
||||||
|
|
||||||
import { Value, Set, Dictionary, GenericPointer } from '@preserves/core';
|
import { Value, Set, Dictionary, GenericEmbedded } from '@preserves/core';
|
||||||
|
|
||||||
export enum ChangeDescription {
|
export enum ChangeDescription {
|
||||||
PRESENT_TO_ABSENT = -1,
|
PRESENT_TO_ABSENT = -1,
|
||||||
|
@ -9,7 +9,7 @@ export enum ChangeDescription {
|
||||||
PRESENT_TO_PRESENT = 2,
|
PRESENT_TO_PRESENT = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Bag<T extends object = GenericPointer> {
|
export class Bag<T extends object = GenericEmbedded> {
|
||||||
_items: Dictionary<T, number>;
|
_items: Dictionary<T, number>;
|
||||||
|
|
||||||
constructor(s?: Set<T>) {
|
constructor(s?: Set<T>) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Assertion, Handle, Ref, Turn } from "./actor.js";
|
import type { Assertion, Handle, Ref, Turn } from "./actor.js";
|
||||||
import { Bytes, Dictionary, DoubleFloat, IdentityMap, is, isPointer, Record, SingleFloat, Tuple } from "@preserves/core";
|
import { Bytes, Dictionary, DoubleFloat, IdentityMap, is, isEmbedded, Record, SingleFloat, Tuple } from "@preserves/core";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Alts,
|
Alts,
|
||||||
|
@ -17,13 +17,13 @@ import {
|
||||||
PCompoundMembers,
|
PCompoundMembers,
|
||||||
PDiscard,
|
PDiscard,
|
||||||
PNot,
|
PNot,
|
||||||
PPointer,
|
PEmbedded,
|
||||||
Pattern,
|
Pattern,
|
||||||
Rewrite,
|
Rewrite,
|
||||||
TRef,
|
TRef,
|
||||||
Template,
|
Template,
|
||||||
_val,
|
_val,
|
||||||
_ptr,
|
_embedded,
|
||||||
} from '../gen/sturdy.js';
|
} from '../gen/sturdy.js';
|
||||||
export * from '../gen/sturdy.js';
|
export * from '../gen/sturdy.js';
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ export function match(p: Pattern, v: Assertion): Bindings | null {
|
||||||
case 'String': return typeof v === 'string';
|
case 'String': return typeof v === 'string';
|
||||||
case 'Symbol': return typeof v === 'symbol';
|
case 'Symbol': return typeof v === 'symbol';
|
||||||
}
|
}
|
||||||
case 'PPointer':
|
case 'PEmbedded':
|
||||||
return isPointer(v);
|
return isEmbedded(v);
|
||||||
case 'PBind':
|
case 'PBind':
|
||||||
if (walk(p.value.pattern, v)) {
|
if (walk(p.value.pattern, v)) {
|
||||||
bindings[p.value.name.asPreservesText()] = v;
|
bindings[p.value.name.asPreservesText()] = v;
|
||||||
|
@ -234,21 +234,21 @@ export function forwarder(t: Turn, ref: Ref): { proxy: Ref, revoker: Ref } {
|
||||||
export function pRec(label: _val, ... members: Array<Pattern>): Pattern {
|
export function pRec(label: _val, ... members: Array<Pattern>): Pattern {
|
||||||
return Pattern.PCompound(PCompound({
|
return Pattern.PCompound(PCompound({
|
||||||
ctor: ConstructorSpec.CRec(CRec({ label: label, arity: members.length })),
|
ctor: ConstructorSpec.CRec(CRec({ label: label, arity: members.length })),
|
||||||
members: PCompoundMembers(new Dictionary<_ptr, Pattern>(
|
members: PCompoundMembers(new Dictionary<_embedded, Pattern>(
|
||||||
members.map((p, i) => [i, p] as const).filter(e => e[1]._variant !== 'PDiscard')))}));
|
members.map((p, i) => [i, p] as const).filter(e => e[1]._variant !== 'PDiscard')))}));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pArr(... members: Array<Pattern>): Pattern {
|
export function pArr(... members: Array<Pattern>): Pattern {
|
||||||
return Pattern.PCompound(PCompound({
|
return Pattern.PCompound(PCompound({
|
||||||
ctor: ConstructorSpec.CArr(CArr(members.length)),
|
ctor: ConstructorSpec.CArr(CArr(members.length)),
|
||||||
members: PCompoundMembers(new Dictionary<_ptr, Pattern>(
|
members: PCompoundMembers(new Dictionary<_embedded, Pattern>(
|
||||||
members.map((p, i) => [i, p] as const).filter(e => e[1]._variant !== 'PDiscard')))}));
|
members.map((p, i) => [i, p] as const).filter(e => e[1]._variant !== 'PDiscard')))}));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pDict(... entries: [_val, Pattern][]): Pattern {
|
export function pDict(... entries: [_val, Pattern][]): Pattern {
|
||||||
return Pattern.PCompound(PCompound({
|
return Pattern.PCompound(PCompound({
|
||||||
ctor: ConstructorSpec.CDict(CDict()),
|
ctor: ConstructorSpec.CDict(CDict()),
|
||||||
members: PCompoundMembers(new Dictionary<_ptr, Pattern>(entries))}));
|
members: PCompoundMembers(new Dictionary<_embedded, Pattern>(entries))}));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pLit(value: _val): Pattern {
|
export function pLit(value: _val): Pattern {
|
||||||
|
@ -267,8 +267,8 @@ export function pBind(name: symbol, pattern: Pattern): Pattern {
|
||||||
return Pattern.PBind(PBind({ name, pattern }));
|
return Pattern.PBind(PBind({ name, pattern }));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pPointer(): Pattern {
|
export function pEmbedded(): Pattern {
|
||||||
return Pattern.PPointer(PPointer());
|
return Pattern.PEmbedded(PEmbedded());
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pSymbol(): Pattern {
|
export function pSymbol(): Pattern {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { Bytes, Reader } from '@preserves/core';
|
import { Bytes, Reader } from '@preserves/core';
|
||||||
import { fromSturdyRef, toSturdyRef, toCaveat, attenuate, sturdyDecode, sturdyEncode, _ptr } from '../transport/sturdy.js';
|
import { fromSturdyRef, toSturdyRef, toCaveat, attenuate, sturdyDecode, sturdyEncode, _embedded } from '../transport/sturdy.js';
|
||||||
|
|
||||||
const [ base, pat ] = process.argv.slice(2);
|
const [ base, pat ] = process.argv.slice(2);
|
||||||
const baseCap = toSturdyRef(sturdyDecode(Bytes.fromHex(base ?? '')));
|
const baseCap = toSturdyRef(sturdyDecode(Bytes.fromHex(base ?? '')));
|
||||||
if (baseCap === void 0) throw new Error("Cannot decode sturdyref");
|
if (baseCap === void 0) throw new Error("Cannot decode sturdyref");
|
||||||
const cs0 = new Reader<_ptr>(pat).next();
|
const cs0 = new Reader<_embedded>(pat).next();
|
||||||
if (!Array.isArray(cs0)) throw new Error("Expected array of caveats");
|
if (!Array.isArray(cs0)) throw new Error("Expected array of caveats");
|
||||||
const cs = cs0.map(c => toCaveat(c) ?? (()=>{ throw new Error("Cannot decode caveat"); })());
|
const cs = cs0.map(c => toCaveat(c) ?? (()=>{ throw new Error("Cannot decode caveat"); })());
|
||||||
attenuate(baseCap, ... cs).then(derived => {
|
attenuate(baseCap, ... cs).then(derived => {
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
import * as S from '../gen/sturdy.js';
|
import * as S from '../gen/sturdy.js';
|
||||||
import * as IO from '../gen/protocol.js';
|
import * as IO from '../gen/protocol.js';
|
||||||
import { Ref } from '../runtime/actor.js';
|
import { Ref } from '../runtime/actor.js';
|
||||||
import { Decoder, DecoderState, Encoder, EncoderState, GenericPointer, neverPointerType, PointerType, Value } from '@preserves/core';
|
import { Decoder, DecoderState, Encoder, EncoderState, GenericEmbedded, neverEmbeddedType, EmbeddedType, Value } from '@preserves/core';
|
||||||
|
|
||||||
export type WireSymbol = { oid: IO.Oid, ref: Ref, count: number };
|
export type WireSymbol = { oid: IO.Oid, ref: Ref, count: number };
|
||||||
|
|
||||||
export const wireRefPointerType: PointerType<S.WireRef> = {
|
export const wireRefEmbeddedType: EmbeddedType<S.WireRef> = {
|
||||||
decode(s: DecoderState): S.WireRef {
|
decode(s: DecoderState): S.WireRef {
|
||||||
return S.asWireRef(new Decoder<any>(s).next());
|
return S.asWireRef(new Decoder<any>(s).next());
|
||||||
},
|
},
|
||||||
|
|
||||||
encode(s: EncoderState, v: S.WireRef): void {
|
encode(s: EncoderState, v: S.WireRef): void {
|
||||||
new Encoder<any>(s, neverPointerType).push(S.fromWireRef(v));
|
new Encoder<any>(s, neverEmbeddedType).push(S.fromWireRef(v));
|
||||||
},
|
},
|
||||||
|
|
||||||
fromValue(v: Value<GenericPointer>): S.WireRef {
|
fromValue(v: Value<GenericEmbedded>): S.WireRef {
|
||||||
return S.asWireRef(v as S._val);
|
return S.asWireRef(v as S._val);
|
||||||
},
|
},
|
||||||
|
|
||||||
toValue(v: S.WireRef): Value<GenericPointer> {
|
toValue(v: S.WireRef): Value<GenericEmbedded> {
|
||||||
return S.fromWireRef(v) as Value<GenericPointer>;
|
return S.fromWireRef(v) as Value<GenericEmbedded>;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Actor, Assertion, Entity, Facet, Handle, Ref, Turn } from '../runtime/actor.js';
|
import { Actor, Assertion, Entity, Facet, Handle, Ref, Turn } from '../runtime/actor.js';
|
||||||
import { BytesLike, Decoder, Dictionary, embed, encode, IdentityMap, mapPointers, underlying, Value } from '@preserves/core';
|
import { BytesLike, Decoder, Dictionary, embed, encode, IdentityMap, mapEmbeddeds, underlying, Value } from '@preserves/core';
|
||||||
import * as IO from '../gen/protocol.js';
|
import * as IO from '../gen/protocol.js';
|
||||||
import { wireRefPointerType, WireSymbol } from './protocol.js';
|
import { wireRefEmbeddedType, WireSymbol } from './protocol.js';
|
||||||
import { queueTask } from '../runtime/task.js';
|
import { queueTask } from '../runtime/task.js';
|
||||||
import { attenuate } from '../runtime/rewrite.js';
|
import { attenuate } from '../runtime/rewrite.js';
|
||||||
import { fromAttenuation, WireRef } from '../gen/sturdy.js';
|
import { fromAttenuation, WireRef } from '../gen/sturdy.js';
|
||||||
|
@ -137,7 +137,7 @@ export class Relay {
|
||||||
|
|
||||||
readonly decoder = new Decoder(void 0, {
|
readonly decoder = new Decoder(void 0, {
|
||||||
includeAnnotations: false,
|
includeAnnotations: false,
|
||||||
pointerDecode: wireRefPointerType,
|
embeddedDecode: wireRefEmbeddedType,
|
||||||
});
|
});
|
||||||
|
|
||||||
constructor(t: Turn, options: RelayOptions) {
|
constructor(t: Turn, options: RelayOptions) {
|
||||||
|
@ -153,14 +153,14 @@ export class Relay {
|
||||||
rewriteOut(assertion: Assertion, transient: boolean): [Value<WireRef>, Array<WireSymbol>]
|
rewriteOut(assertion: Assertion, transient: boolean): [Value<WireRef>, Array<WireSymbol>]
|
||||||
{
|
{
|
||||||
const exported: Array<WireSymbol> = [];
|
const exported: Array<WireSymbol> = [];
|
||||||
const rewritten = mapPointers(assertion, r => embed(this.rewriteRefOut(r, transient, exported)));
|
const rewritten = mapEmbeddeds(assertion, r => embed(this.rewriteRefOut(r, transient, exported)));
|
||||||
return [rewritten, exported];
|
return [rewritten, exported];
|
||||||
}
|
}
|
||||||
|
|
||||||
rewriteIn(t: Turn, a: Value<WireRef>): [Assertion, Array<WireSymbol>]
|
rewriteIn(t: Turn, a: Value<WireRef>): [Assertion, Array<WireSymbol>]
|
||||||
{
|
{
|
||||||
const imported: Array<WireSymbol> = [];
|
const imported: Array<WireSymbol> = [];
|
||||||
const rewritten = mapPointers(a, r => embed(this.rewriteRefIn(t, r, imported)));
|
const rewritten = mapEmbeddeds(a, r => embed(this.rewriteRefIn(t, r, imported)));
|
||||||
return [rewritten, imported];
|
return [rewritten, imported];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ export class Relay {
|
||||||
if (this.debug) console.log('OUT', IO.fromTurn(this.pendingTurn).asPreservesText());
|
if (this.debug) console.log('OUT', IO.fromTurn(this.pendingTurn).asPreservesText());
|
||||||
this.w(underlying(encode(IO.fromTurn(this.pendingTurn), {
|
this.w(underlying(encode(IO.fromTurn(this.pendingTurn), {
|
||||||
canonical: true,
|
canonical: true,
|
||||||
pointerEncode: wireRefPointerType,
|
embeddedEncode: wireRefEmbeddedType,
|
||||||
})));
|
})));
|
||||||
this.pendingTurn = [];
|
this.pendingTurn = [];
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
// California: Internet Society, 2014.
|
// California: Internet Society, 2014.
|
||||||
|
|
||||||
import { mac } from './cryptography.js';
|
import { mac } from './cryptography.js';
|
||||||
import { Bytes, decode, encode, is, neverPointerType } from '@preserves/core';
|
import { Bytes, decode, encode, is, neverEmbeddedType } from '@preserves/core';
|
||||||
import * as S from '../gen/sturdy.js';
|
import * as S from '../gen/sturdy.js';
|
||||||
export * from '../gen/sturdy.js';
|
export * from '../gen/sturdy.js';
|
||||||
|
|
||||||
|
@ -15,22 +15,22 @@ export type SturdyValue = S._val;
|
||||||
|
|
||||||
export const KEY_LENGTH = 16; // 128 bits
|
export const KEY_LENGTH = 16; // 128 bits
|
||||||
|
|
||||||
export function pointerNotAllowed(): never {
|
export function embeddedNotAllowed(): never {
|
||||||
throw new Error("Embedded Ref not permitted in SturdyRef");
|
throw new Error("Embedded Ref not permitted in SturdyRef");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sturdyEncode(v: SturdyValue): Bytes {
|
export function sturdyEncode(v: SturdyValue): Bytes {
|
||||||
return encode<S._ptr>(v, {
|
return encode<S._embedded>(v, {
|
||||||
canonical: true,
|
canonical: true,
|
||||||
includeAnnotations: false,
|
includeAnnotations: false,
|
||||||
pointerEncode: neverPointerType,
|
embeddedEncode: neverEmbeddedType,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sturdyDecode(bs: Bytes): SturdyValue {
|
export function sturdyDecode(bs: Bytes): SturdyValue {
|
||||||
return decode<S._ptr>(bs, {
|
return decode<S._embedded>(bs, {
|
||||||
includeAnnotations: false,
|
includeAnnotations: false,
|
||||||
pointerDecode: neverPointerType,
|
embeddedDecode: neverEmbeddedType,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
18
yarn.lock
18
yarn.lock
|
@ -2,17 +2,17 @@
|
||||||
# yarn lockfile v1
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
"@preserves/core@^0.14.0":
|
"@preserves/core@^0.15.0":
|
||||||
version "0.14.0"
|
version "0.15.0"
|
||||||
resolved "https://registry.yarnpkg.com/@preserves/core/-/core-0.14.0.tgz#a7b8fda8b408415e0dbc0682218d6f63f3ec19e5"
|
resolved "https://registry.yarnpkg.com/@preserves/core/-/core-0.15.0.tgz#55a14288442d404d20a2906b92b7a7cc9e522a18"
|
||||||
integrity sha512-iTwhoW/dVZIXIfU6p98ZL9dZS5vNH12CDBL+OMJP5cF6fon/CXEVvGEjx/cNJ1+Xg0KSz+CLNXNAdZhwPoph1Q==
|
integrity sha512-PoEvwlqNNXpYykwkiD7KyjT6kfo78XXEMwJ5yOhOiEF6nVD167NVv801/DR7xIINtPDaDjdqBtqY/tamyzi7vA==
|
||||||
|
|
||||||
"@preserves/schema@^0.7.0":
|
"@preserves/schema@^0.8.1":
|
||||||
version "0.7.0"
|
version "0.8.1"
|
||||||
resolved "https://registry.yarnpkg.com/@preserves/schema/-/schema-0.7.0.tgz#4e835353a597b5e37284d1a6f9ee3a49b91abe41"
|
resolved "https://registry.yarnpkg.com/@preserves/schema/-/schema-0.8.1.tgz#5cd213e9d1c6c8bcb70944a59d8f3146a609b773"
|
||||||
integrity sha512-9XO0Wpi4udUxatlKT3cLpt+u4bQCmLrRidCEM91tcCOOD7i+h6ltohKfWbXrn94St0uZTBkLU+jRBHb8i75PsQ==
|
integrity sha512-j4uNW7WYs+x3MCWq6m8u/umVtgqJ2UoN5xN1HK4v8cFN8ww291lnVlyI4sK5L3VqXVF9aJZL5NZWN8N3lQ5K+A==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@preserves/core" "^0.14.0"
|
"@preserves/core" "^0.15.0"
|
||||||
"@types/glob" "^7.1.3"
|
"@types/glob" "^7.1.3"
|
||||||
"@types/minimatch" "^3.0.3"
|
"@types/minimatch" "^3.0.3"
|
||||||
chalk "^4.1.0"
|
chalk "^4.1.0"
|
||||||
|
|
Loading…
Reference in New Issue