pico-framework
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -177,4 +177,4 @@ "use strict"; | ||
.join(",") !== "domain,name" || | ||
utils_1.isNotStringOrBlank(orig.domain) || | ||
utils_1.isNotStringOrBlank(orig.name)) { | ||
(0, utils_1.isNotStringOrBlank)(orig.domain) || | ||
(0, utils_1.isNotStringOrBlank)(orig.name)) { | ||
throw new TypeError(`EventPolicyRule expects {domain: string, name: string}`); | ||
@@ -207,4 +207,4 @@ } | ||
.join(",") !== "name,rid" || | ||
utils_1.isNotStringOrBlank(orig.name) || | ||
utils_1.isNotStringOrBlank(orig.rid)) { | ||
(0, utils_1.isNotStringOrBlank)(orig.name) || | ||
(0, utils_1.isNotStringOrBlank)(orig.rid)) { | ||
throw new TypeError(`QueryPolicyRule expects {rid: string, name: string}`); | ||
@@ -211,0 +211,0 @@ } |
@@ -246,3 +246,3 @@ "use strict"; | ||
const config = this.rulesets[rid].config; | ||
const ctx = RulesetContext_1.createRulesetContext(this.pf, this, { rid, config }); | ||
const ctx = (0, RulesetContext_1.createRulesetContext)(this.pf, this, { rid, config }); | ||
const instance = await rs.init(ctx, this.pf.environment); | ||
@@ -256,3 +256,3 @@ this.rulesets[rid].instance = instance; | ||
// b/c the configuration may have changed | ||
const ctx = RulesetContext_1.createRulesetContext(this.pf, this, { | ||
const ctx = (0, RulesetContext_1.createRulesetContext)(this.pf, this, { | ||
rid: rs.rid, | ||
@@ -280,3 +280,3 @@ config, | ||
async uninstallBase(rid) { | ||
const ops = await dbRange_1.dbRange(this.pf.db, { prefix: ["entvar", this.id, rid] }, (data) => { | ||
const ops = await (0, dbRange_1.dbRange)(this.pf.db, { prefix: ["entvar", this.id, rid] }, (data) => { | ||
const delEnt = { | ||
@@ -327,3 +327,3 @@ type: "del", | ||
raiseEvent(domain, name, attrs, forRid) { | ||
const event = PicoEvent_1.cleanEvent({ | ||
const event = (0, PicoEvent_1.cleanEvent)({ | ||
eci: (this.current && this.current.event.eci) || "[raise]", | ||
@@ -330,0 +330,0 @@ domain, |
@@ -12,9 +12,9 @@ "use strict"; | ||
function cleanEvent(eventOrig, time = Date.now()) { | ||
if (utils_1.isNotStringOrBlank(eventOrig && eventOrig.eci)) { | ||
if ((0, utils_1.isNotStringOrBlank)(eventOrig && eventOrig.eci)) { | ||
throw new Error("missing event.eci"); | ||
} | ||
if (utils_1.isNotStringOrBlank(eventOrig.domain)) { | ||
if ((0, utils_1.isNotStringOrBlank)(eventOrig.domain)) { | ||
throw new Error("missing event.domain"); | ||
} | ||
if (utils_1.isNotStringOrBlank(eventOrig.name)) { | ||
if ((0, utils_1.isNotStringOrBlank)(eventOrig.name)) { | ||
throw new Error("missing event.name"); | ||
@@ -21,0 +21,0 @@ } |
@@ -19,3 +19,3 @@ "use strict"; | ||
this.useEventInputTime = false; | ||
this.db = levelup_1.default(encode((conf && conf.leveldown) || memdown(), { | ||
this.db = (0, levelup_1.default)(encode((conf && conf.leveldown) || memdown(), { | ||
keyEncoding: charwise, | ||
@@ -39,7 +39,7 @@ valueEncoding: safeJsonCodec, | ||
this.emit({ type: "startup" }); | ||
await dbRange_1.dbRange(this.db, { prefix: ["pico"] }, (data) => { | ||
await (0, dbRange_1.dbRange)(this.db, { prefix: ["pico"] }, (data) => { | ||
const pico = Pico_1.Pico.fromDb(this, data.value); | ||
this.picos.push(pico); | ||
}); | ||
await dbRange_1.dbRange(this.db, { prefix: ["pico-channel"] }, (data) => { | ||
await (0, dbRange_1.dbRange)(this.db, { prefix: ["pico-channel"] }, (data) => { | ||
const { picoId } = data.value; | ||
@@ -56,3 +56,3 @@ const pico = this.picos.find((pico) => pico.id === picoId); | ||
const toInstall = []; | ||
await dbRange_1.dbRange(this.db, { prefix: ["pico-ruleset"] }, async (data) => { | ||
await (0, dbRange_1.dbRange)(this.db, { prefix: ["pico-ruleset"] }, async (data) => { | ||
const picoId = data.key[1]; | ||
@@ -130,5 +130,5 @@ const rid = data.key[2]; | ||
if (this.useEventInputTime) { | ||
return PicoEvent_1.cleanEvent(event, event.time); | ||
return (0, PicoEvent_1.cleanEvent)(event, event.time); | ||
} | ||
return PicoEvent_1.cleanEvent(event); | ||
return (0, PicoEvent_1.cleanEvent)(event); | ||
} | ||
@@ -168,3 +168,3 @@ /** | ||
event = this.cleanEvent(event); | ||
query = PicoQuery_1.cleanQuery(query); | ||
query = (0, PicoQuery_1.cleanQuery)(query); | ||
if (query.eci !== event.eci) { | ||
@@ -179,3 +179,3 @@ throw new Error("eventQuery must use the same channel"); | ||
async query(query, fromPicoId) { | ||
query = PicoQuery_1.cleanQuery(query); | ||
query = (0, PicoQuery_1.cleanQuery)(query); | ||
const channel = this.lookupChannel(query.eci); | ||
@@ -182,0 +182,0 @@ channel.assertQueryPolicy(query, fromPicoId); |
@@ -12,9 +12,9 @@ "use strict"; | ||
function cleanQuery(queryOrig) { | ||
if (utils_1.isNotStringOrBlank(queryOrig && queryOrig.eci)) { | ||
if ((0, utils_1.isNotStringOrBlank)(queryOrig && queryOrig.eci)) { | ||
throw new Error("missing query.eci"); | ||
} | ||
if (utils_1.isNotStringOrBlank(queryOrig.rid)) { | ||
if ((0, utils_1.isNotStringOrBlank)(queryOrig.rid)) { | ||
throw new Error("missing query.rid"); | ||
} | ||
if (utils_1.isNotStringOrBlank(queryOrig.name)) { | ||
if ((0, utils_1.isNotStringOrBlank)(queryOrig.name)) { | ||
throw new Error("missing query.name"); | ||
@@ -21,0 +21,0 @@ } |
{ | ||
"name": "pico-framework", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "A framework for building actor-based, people-centric systems. (pico = PersIstent Compute Objects)", | ||
@@ -37,4 +37,3 @@ "repository": { | ||
"build": "rm -rf dist && tsc", | ||
"test": "nyc ava", | ||
"report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov" | ||
"test": "nyc ava" | ||
}, | ||
@@ -55,7 +54,6 @@ "dependencies": { | ||
"@types/lodash": "^4.14.157", | ||
"ava": "^3.10.1", | ||
"codecov": "^3.7.1", | ||
"ava": "^4.0.0", | ||
"nyc": "^15.1.0", | ||
"ts-node": "^8.10.2", | ||
"typescript": "^3.9.7" | ||
"ts-node": "^10.4.0", | ||
"typescript": "^4.5.4" | ||
}, | ||
@@ -62,0 +60,0 @@ "ava": { |
# pico-framework | ||
[](https://travis-ci.org/Picolab/pico-framework) | ||
[](https://codecov.io/gh/Picolab/pico-framework) | ||
A framework for building actor-based, people-centric systems. (pico = PersIstent Compute Objects) | ||
@@ -7,0 +4,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7
96024
35