pico-framework
Advanced tools
Comparing version 0.0.0 to 0.0.1
@@ -0,2 +1,6 @@ | ||
import { ChannelConfig, ChannelReadOnly, EventPolicy, EventPolicyRule, QueryPolicy, QueryPolicyRule } from "./Channel"; | ||
import { PicoEvent } from "./PicoEvent"; | ||
import { PicoFramework, PicoFrameworkConf } from "./PicoFramework"; | ||
export { PicoFramework, PicoFrameworkConf }; | ||
import { PicoQuery } from "./PicoQuery"; | ||
import { Ruleset, RulesetConfig, RulesetInstance } from "./Ruleset"; | ||
export { PicoEvent, PicoQuery, PicoFramework, PicoFrameworkConf, ChannelConfig, RulesetInstance, Ruleset, RulesetConfig, ChannelReadOnly, EventPolicy, EventPolicyRule, QueryPolicy, QueryPolicyRule }; |
@@ -102,3 +102,3 @@ "use strict"; | ||
for (const rs of conf.rulesets) { | ||
const { instance, dbPut } = child.installBase(rs.rid, rs.version, rs.config); | ||
const { instance, dbPut } = yield child.installBase(rs.rid, rs.version, rs.config); | ||
dbOps.push(dbPut); | ||
@@ -249,3 +249,3 @@ child.rulesets[rs.rid] = { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { instance, dbPut } = this.installBase(rid, version, config); | ||
const { instance, dbPut } = yield this.installBase(rid, version, config); | ||
yield this.pf.db.batch([dbPut]); | ||
@@ -256,19 +256,21 @@ this.rulesets[rid] = { version, config, instance }; | ||
installBase(rid, version, config = {}) { | ||
const rs = this.pf.getRuleset(rid, version); | ||
// even if we already have that rid installed, we need to init again | ||
// b/c the version or configuration may have changed | ||
const ctx = RulesetContext_1.createRulesetContext(this.pf, this, { rid, version, config }); | ||
const instance = rs.init(ctx); | ||
return { | ||
instance, | ||
dbPut: { | ||
type: "put", | ||
key: ["pico-ruleset", this.id, rid], | ||
value: { | ||
rid, | ||
version, | ||
config | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const rs = this.pf.getRuleset(rid, version); | ||
// even if we already have that rid installed, we need to init again | ||
// b/c the version or configuration may have changed | ||
const ctx = RulesetContext_1.createRulesetContext(this.pf, this, { rid, version, config }); | ||
const instance = yield rs.init(ctx); | ||
return { | ||
instance, | ||
dbPut: { | ||
type: "put", | ||
key: ["pico-ruleset", this.id, rid], | ||
value: { | ||
rid, | ||
version, | ||
config | ||
} | ||
} | ||
} | ||
}; | ||
}; | ||
}); | ||
} | ||
@@ -275,0 +277,0 @@ uninstall(rid) { |
@@ -6,3 +6,3 @@ import { PicoEvent } from "./PicoEvent"; | ||
version: string; | ||
init(conf: RulesetContext): RulesetInstance; | ||
init(ctx: RulesetContext): Promise<RulesetInstance> | RulesetInstance; | ||
} | ||
@@ -9,0 +9,0 @@ export interface RulesetConfig { |
{ | ||
"name": "pico-framework", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "A framework for building actor-based, people-centric systems. (pico = PersIstent Compute Objects)", | ||
@@ -52,3 +52,3 @@ "repository": { | ||
"@types/levelup": "^3.1.0", | ||
"@types/lodash": "^4.14.122", | ||
"@types/lodash": "^4.14.123", | ||
"ava": "^1.3.1", | ||
@@ -58,3 +58,3 @@ "codecov": "^3.2.0", | ||
"ts-node": "^8.0.3", | ||
"typescript": "^3.3.3333" | ||
"typescript": "^3.3.4000" | ||
}, | ||
@@ -61,0 +61,0 @@ "ava": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
79129
1306