Update to latest preserves

This commit is contained in:
Tony Garnock-Jones 2021-05-25 10:54:17 +02:00
parent 83335287f5
commit 5085abfcbf
5 changed files with 66 additions and 73 deletions

View File

@ -6,8 +6,8 @@
"typescript": "^4.2.3" "typescript": "^4.2.3"
}, },
"dependencies": { "dependencies": {
"@preserves/core": "^0.15.0", "@preserves/core": "^0.16.0",
"@preserves/schema": "^0.9.0" "@preserves/schema": "^0.13.0"
}, },
"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'",

View File

@ -2,7 +2,7 @@ version 1 .
; Each Attenuation is a stage. The sequence of Attenuations is run RIGHT-TO-LEFT. ; Each Attenuation is a stage. The sequence of Attenuations is run RIGHT-TO-LEFT.
; That is, the newest Attenuations are at the right. ; That is, the newest Attenuations are at the right.
SturdyRef = <ref @oid any [@caveatChain Attenuation ...] @sig bytes>. SturdyRef = <ref @oid any @caveatChain [Attenuation ...] @sig bytes>.
; An individual Attenuation is run RIGHT-TO-LEFT. ; An individual Attenuation is run RIGHT-TO-LEFT.
; That is, the newest Caveats are at the right. ; That is, the newest Caveats are at the right.
@ -12,7 +12,7 @@ Attenuation = [Caveat ...].
; can add 3rd-party caveats and richer predicates later ; can add 3rd-party caveats and richer predicates later
Caveat = Rewrite / Alts . Caveat = Rewrite / Alts .
Rewrite = <rewrite @pattern Pattern @template Template>. Rewrite = <rewrite @pattern Pattern @template Template>.
Alts = <or [@alternatives Rewrite ...]>. Alts = <or @alternatives [Rewrite ...]>.
Oid = int . Oid = int .
WireRef = @mine [0 @oid Oid] / @yours [1 @oid Oid @attenuation Caveat ...]. WireRef = @mine [0 @oid Oid] / @yours [1 @oid Oid @attenuation Caveat ...].
@ -31,7 +31,7 @@ PDiscard = <_>.
PAtom = =Boolean / =Float / =Double / =SignedInteger / =String / =ByteString / =Symbol . PAtom = =Boolean / =Float / =Double / =SignedInteger / =String / =ByteString / =Symbol .
PEmbedded = =Embedded . 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>.
PCompound = <compound @ctor ConstructorSpec @members PCompoundMembers>. PCompound = <compound @ctor ConstructorSpec @members PCompoundMembers>.
PCompoundMembers = { any: Pattern ...:... }. PCompoundMembers = { any: Pattern ...:... }.

View File

@ -154,9 +154,10 @@ export function asTurn(v: _val): Turn {
} }
export function toTurn(v: _val): undefined | Turn { export function toTurn(v: _val): undefined | Turn {
let _tmp0: (Array<TurnEvent>) | undefined;
let result: undefined | Turn; let result: undefined | Turn;
_tmp0 = void 0;
if (_.Array.isArray(v)) { if (_.Array.isArray(v)) {
let _tmp0: (Array<TurnEvent>) | undefined;
_tmp0 = []; _tmp0 = [];
for (const _tmp1 of v) { for (const _tmp1 of v) {
let _tmp2: (TurnEvent) | undefined; let _tmp2: (TurnEvent) | undefined;
@ -165,8 +166,8 @@ export function toTurn(v: _val): undefined | Turn {
_tmp0 = void 0; _tmp0 = void 0;
break; break;
}; };
if (_tmp0 !== void 0) {result = _tmp0;};
}; };
if (_tmp0 !== void 0) {result = _tmp0;};
return result; return result;
} }

View File

@ -207,26 +207,23 @@ export function toSturdyRef(v: _val): undefined | SturdyRef {
let _tmp1: (_val) | undefined; let _tmp1: (_val) | undefined;
_tmp1 = v[0]; _tmp1 = v[0];
if (_tmp1 !== void 0) { if (_tmp1 !== void 0) {
let _tmp2: (Array<Attenuation>) | undefined;
_tmp2 = void 0;
if (_.Array.isArray(v[1])) { if (_.Array.isArray(v[1])) {
let _tmp2: (Array<_val>) | undefined; _tmp2 = [];
let _tmp3: (Array<Attenuation>) | undefined; for (const _tmp3 of v[1]) {
_tmp2 = v[1]; let _tmp4: (Attenuation) | undefined;
{ _tmp4 = toAttenuation(_tmp3);
_tmp3 = []; if (_tmp4 !== void 0) {_tmp2.push(_tmp4); continue;};
for (const _tmp4 of _tmp2) { _tmp2 = void 0;
let _tmp5: (Attenuation) | undefined; break;
_tmp5 = toAttenuation(_tmp4);
if (_tmp5 !== void 0) {_tmp3.push(_tmp5); continue;};
_tmp3 = void 0;
break;
};
if (_tmp3 !== void 0) {
let _tmp6: (_.Bytes) | undefined;
_tmp6 = _.Bytes.isBytes(v[2]) ? v[2] : void 0;
if (_tmp6 !== void 0) {result = {"oid": _tmp1, "caveatChain": _tmp3, "sig": _tmp6};};
};
}; };
}; };
if (_tmp2 !== void 0) {
let _tmp5: (_.Bytes) | undefined;
_tmp5 = _.Bytes.isBytes(v[2]) ? v[2] : void 0;
if (_tmp5 !== void 0) {result = {"oid": _tmp1, "caveatChain": _tmp2, "sig": _tmp5};};
};
}; };
}; };
}; };
@ -244,9 +241,10 @@ export function asAttenuation(v: _val): Attenuation {
} }
export function toAttenuation(v: _val): undefined | Attenuation { export function toAttenuation(v: _val): undefined | Attenuation {
let _tmp0: (Array<Caveat>) | undefined;
let result: undefined | Attenuation; let result: undefined | Attenuation;
_tmp0 = void 0;
if (_.Array.isArray(v)) { if (_.Array.isArray(v)) {
let _tmp0: (Array<Caveat>) | undefined;
_tmp0 = []; _tmp0 = [];
for (const _tmp1 of v) { for (const _tmp1 of v) {
let _tmp2: (Caveat) | undefined; let _tmp2: (Caveat) | undefined;
@ -255,8 +253,8 @@ export function toAttenuation(v: _val): undefined | Attenuation {
_tmp0 = void 0; _tmp0 = void 0;
break; break;
}; };
if (_tmp0 !== void 0) {result = _tmp0;};
}; };
if (_tmp0 !== void 0) {result = _tmp0;};
return result; return result;
} }
@ -328,22 +326,19 @@ export function toAlts(v: _val): undefined | Alts {
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) {
let _tmp1: (Array<Rewrite>) | undefined;
_tmp1 = void 0;
if (_.Array.isArray(v[0])) { if (_.Array.isArray(v[0])) {
let _tmp1: (Array<_val>) | undefined; _tmp1 = [];
let _tmp2: (Array<Rewrite>) | undefined; for (const _tmp2 of v[0]) {
_tmp1 = v[0]; let _tmp3: (Rewrite) | undefined;
{ _tmp3 = toRewrite(_tmp2);
_tmp2 = []; if (_tmp3 !== void 0) {_tmp1.push(_tmp3); continue;};
for (const _tmp3 of _tmp1) { _tmp1 = void 0;
let _tmp4: (Rewrite) | undefined; break;
_tmp4 = toRewrite(_tmp3);
if (_tmp4 !== void 0) {_tmp2.push(_tmp4); continue;};
_tmp2 = void 0;
break;
};
if (_tmp2 !== void 0) {result = {"alternatives": _tmp2};};
}; };
}; };
if (_tmp1 !== void 0) {result = {"alternatives": _tmp1};};
}; };
}; };
return result; return result;
@ -395,17 +390,15 @@ export function toWireRef(v: _val): undefined | WireRef {
let _tmp4: (Array<_val>) | undefined; let _tmp4: (Array<_val>) | undefined;
let _tmp5: (Array<Caveat>) | undefined; let _tmp5: (Array<Caveat>) | undefined;
_tmp4 = v.slice(2); _tmp4 = v.slice(2);
{ _tmp5 = [];
_tmp5 = []; for (const _tmp6 of _tmp4) {
for (const _tmp6 of _tmp4) { let _tmp7: (Caveat) | undefined;
let _tmp7: (Caveat) | undefined; _tmp7 = toCaveat(_tmp6);
_tmp7 = toCaveat(_tmp6); if (_tmp7 !== void 0) {_tmp5.push(_tmp7); continue;};
if (_tmp7 !== void 0) {_tmp5.push(_tmp7); continue;}; _tmp5 = void 0;
_tmp5 = void 0; break;
break;
};
if (_tmp5 !== void 0) {result = {"_variant": "yours", "oid": _tmp3, "attenuation": _tmp5};};
}; };
if (_tmp5 !== void 0) {result = {"_variant": "yours", "oid": _tmp3, "attenuation": _tmp5};};
}; };
}; };
}; };
@ -732,22 +725,19 @@ export function toPAnd(v: _val): undefined | PAnd {
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) {
let _tmp1: (Array<Pattern>) | undefined;
_tmp1 = void 0;
if (_.Array.isArray(v[0])) { if (_.Array.isArray(v[0])) {
let _tmp1: (Array<_val>) | undefined; _tmp1 = [];
let _tmp2: (Array<Pattern>) | undefined; for (const _tmp2 of v[0]) {
_tmp1 = v[0]; let _tmp3: (Pattern) | undefined;
{ _tmp3 = toPattern(_tmp2);
_tmp2 = []; if (_tmp3 !== void 0) {_tmp1.push(_tmp3); continue;};
for (const _tmp3 of _tmp1) { _tmp1 = void 0;
let _tmp4: (Pattern) | undefined; break;
_tmp4 = toPattern(_tmp3);
if (_tmp4 !== void 0) {_tmp2.push(_tmp4); continue;};
_tmp2 = void 0;
break;
};
if (_tmp2 !== void 0) {result = {"patterns": _tmp2};};
}; };
}; };
if (_tmp1 !== void 0) {result = {"patterns": _tmp1};};
}; };
}; };
return result; return result;
@ -817,6 +807,7 @@ 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, _embedded>) | undefined; let _tmp0: (_.KeyedDictionary<_val, Pattern, _embedded>) | undefined;
let result: undefined | PCompoundMembers; let result: undefined | PCompoundMembers;
_tmp0 = void 0;
if (_.Dictionary.isDictionary<_embedded>(v)) { if (_.Dictionary.isDictionary<_embedded>(v)) {
_tmp0 = new _.KeyedDictionary(); _tmp0 = new _.KeyedDictionary();
for (const [_tmp2, _tmp1] of v) { for (const [_tmp2, _tmp1] of v) {
@ -830,8 +821,8 @@ export function toPCompoundMembers(v: _val): undefined | PCompoundMembers {
_tmp0 = void 0; _tmp0 = void 0;
break; break;
}; };
if (_tmp0 !== void 0) {result = _tmp0;};
}; };
if (_tmp0 !== void 0) {result = _tmp0;};
return result; return result;
} }
@ -933,6 +924,7 @@ 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, _embedded>) | undefined; let _tmp0: (_.KeyedDictionary<_val, Template, _embedded>) | undefined;
let result: undefined | TCompoundMembers; let result: undefined | TCompoundMembers;
_tmp0 = void 0;
if (_.Dictionary.isDictionary<_embedded>(v)) { if (_.Dictionary.isDictionary<_embedded>(v)) {
_tmp0 = new _.KeyedDictionary(); _tmp0 = new _.KeyedDictionary();
for (const [_tmp2, _tmp1] of v) { for (const [_tmp2, _tmp1] of v) {
@ -946,8 +938,8 @@ export function toTCompoundMembers(v: _val): undefined | TCompoundMembers {
_tmp0 = void 0; _tmp0 = void 0;
break; break;
}; };
if (_tmp0 !== void 0) {result = _tmp0;};
}; };
if (_tmp0 !== void 0) {result = _tmp0;};
return result; return result;
} }

View File

@ -2,17 +2,17 @@
# yarn lockfile v1 # yarn lockfile v1
"@preserves/core@^0.15.0": "@preserves/core@^0.16.0":
version "0.15.0" version "0.16.0"
resolved "https://registry.yarnpkg.com/@preserves/core/-/core-0.15.0.tgz#55a14288442d404d20a2906b92b7a7cc9e522a18" resolved "https://registry.yarnpkg.com/@preserves/core/-/core-0.16.0.tgz#4828ecd2445bb7ba6e6d80333653d3e8e7005fe9"
integrity sha512-PoEvwlqNNXpYykwkiD7KyjT6kfo78XXEMwJ5yOhOiEF6nVD167NVv801/DR7xIINtPDaDjdqBtqY/tamyzi7vA== integrity sha512-tW5JKvv/CmC23q/NtDv7viPutKEPZqWuDoVOndqBQK4k3E3UfgTlVpbnM3wOG9OP3icl38aY8nMtvTlJ3IWaoA==
"@preserves/schema@^0.9.0": "@preserves/schema@^0.13.0":
version "0.9.0" version "0.13.0"
resolved "https://registry.yarnpkg.com/@preserves/schema/-/schema-0.9.0.tgz#61e468a5c1f051c8b792358303d3c85526717541" resolved "https://registry.yarnpkg.com/@preserves/schema/-/schema-0.13.0.tgz#6d054a6a70a4b3133ca0a20ca0cc71fe2f23a54f"
integrity sha512-J9ZI6GPQDGyWDMxNCckSexgKRW+QDxPZs8CmZ5mkPUkpiYzBHYFpdJgdmDsh15CMWYZaqYnwRWvtTPWvxljwuQ== integrity sha512-EvHiGT40fx4mvX4salwKd5gmx3znUJKxJFY1hbFdoAxXOi13Zd2B71qBMsoMJNIHARcp978G8ZJKdWJNjHkzcA==
dependencies: dependencies:
"@preserves/core" "^0.15.0" "@preserves/core" "^0.16.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"