pico-engine-core
Advanced tools
Comparing version 1.0.0-beta to 1.0.1
@@ -17,2 +17,5 @@ "use strict"; | ||
const module = { | ||
picoId: krl_stdlib_1.krl.Property(function rid() { | ||
return this.rsCtx.pico().id; | ||
}), | ||
rid: krl_stdlib_1.krl.Property(function rid() { | ||
@@ -19,0 +22,0 @@ return this.rsCtx.ruleset.rid; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const cross_fetch_1 = require("cross-fetch"); | ||
const krl_stdlib_1 = require("krl-stdlib"); | ||
@@ -29,2 +30,7 @@ function eventProperty(fn) { | ||
let eci = options.eci; | ||
if (!krl_stdlib_1.krl.isString(eci)) { | ||
throw new TypeError("eci was " + | ||
krl_stdlib_1.krl.toString(eci) + | ||
" instead of a string"); | ||
} | ||
let domain = options.domain; | ||
@@ -35,3 +41,3 @@ let name = options.name || options.type; | ||
const url = `${host}/c/${eci}/event/${domain}/${name}`; | ||
fetch(url, { | ||
cross_fetch_1.default(url, { | ||
method: "POST", | ||
@@ -52,2 +58,4 @@ headers: { "content-type": "application/json" }, | ||
time: 0, | ||
}).catch((err) => { | ||
this.log.error(err + ""); // TODO better handling | ||
}); | ||
@@ -54,0 +62,0 @@ return eid; |
@@ -17,2 +17,3 @@ "use strict"; | ||
const ursa_1 = require("./modules/ursa"); | ||
const meta_1 = require("./modules/meta"); | ||
const RulesetRegistry_1 = require("./RulesetRegistry"); | ||
@@ -59,5 +60,11 @@ const version = require("../package.json").version; | ||
case "txnDone": | ||
case "txnError": | ||
log.debug(ev.type, { picoId: ev.picoId, txnId: ev.txn.id }); | ||
break; | ||
case "txnError": | ||
log.debug(ev.type, { | ||
picoId: ev.picoId, | ||
txnId: ev.txn.id, | ||
error: ev.error + "", | ||
}); | ||
break; | ||
case "eventScheduleAdded": | ||
@@ -91,2 +98,3 @@ log.debug("event added to schedule", { | ||
this.modules["ursa"] = ursa_1.default; | ||
this.modules["meta"] = meta_1.default; | ||
if (conf.modules) { | ||
@@ -93,0 +101,0 @@ for (const domain of Object.keys(conf.modules)) { |
{ | ||
"name": "pico-engine-core", | ||
"version": "1.0.0-beta", | ||
"version": "1.0.1", | ||
"description": "This provides the environment for KRL to run.", | ||
@@ -39,4 +39,4 @@ "repository": { | ||
"cuid": "^2.1.8", | ||
"krl-compiler": "^1.0.0-beta", | ||
"krl-stdlib": "^1.0.0-beta", | ||
"krl-compiler": "^1.0.1", | ||
"krl-stdlib": "^1.0.1", | ||
"libsodium-wrappers": "^0.7.8", | ||
@@ -72,3 +72,3 @@ "lodash": "^4.17.11", | ||
}, | ||
"gitHead": "64405d208dcc9ced54ae903945d36a045c56148e" | ||
"gitHead": "965062451851075159c0611aa345e9668ce950c0" | ||
} |
@@ -46,2 +46,6 @@ import fetch from "cross-fetch"; | ||
const module: krl.Module = { | ||
picoId: krl.Property(function rid(){ | ||
return this.rsCtx.pico().id; | ||
}), | ||
rid: krl.Property(function rid() { | ||
@@ -48,0 +52,0 @@ return this.rsCtx.ruleset.rid; |
@@ -0,1 +1,2 @@ | ||
import fetch from "cross-fetch"; | ||
import { CurrentPicoEvent, krl, KrlCtx } from "krl-stdlib"; | ||
@@ -36,2 +37,9 @@ | ||
let eci = options.eci; | ||
if (!krl.isString(eci)) { | ||
throw new TypeError( | ||
"eci was " + | ||
krl.toString(eci) + | ||
" instead of a string" | ||
); | ||
} | ||
let domain = options.domain; | ||
@@ -61,2 +69,4 @@ let name = options.name || options.type; | ||
time: 0, | ||
}).catch((err) => { | ||
this.log.error(err + ""); // TODO better handling | ||
}); | ||
@@ -63,0 +73,0 @@ |
@@ -20,2 +20,3 @@ import { krl, KrlLogger, PicoLogEntry } from "krl-stdlib"; | ||
import module_ursa from "./modules/ursa"; | ||
import module_meta from "./modules/meta"; | ||
import { PicoEngineCoreConfiguration } from "./PicoEngineCoreConfiguration"; | ||
@@ -78,5 +79,11 @@ import { CachedRuleset, RulesetRegistry } from "./RulesetRegistry"; | ||
case "txnDone": | ||
case "txnError": | ||
log.debug(ev.type, { picoId: ev.picoId, txnId: ev.txn.id }); | ||
break; | ||
case "txnError": | ||
log.debug(ev.type, { | ||
picoId: ev.picoId, | ||
txnId: ev.txn.id, | ||
error: ev.error + "", | ||
}); | ||
break; | ||
case "eventScheduleAdded": | ||
@@ -114,2 +121,3 @@ log.debug("event added to schedule", { | ||
this.modules["ursa"] = module_ursa; | ||
this.modules["meta"] = module_meta; | ||
@@ -116,0 +124,0 @@ if (conf.modules) { |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
182652
79
3715
0
1
Updatedkrl-compiler@^1.0.1
Updatedkrl-stdlib@^1.0.1