diff --git a/.bsb.lock b/.bsb.lock deleted file mode 100644 index e6029ce..0000000 --- a/.bsb.lock +++ /dev/null @@ -1 +0,0 @@ -24629 \ No newline at end of file diff --git a/bsconfig.json b/bsconfig.json index d9cf7db..4086034 100644 --- a/bsconfig.json +++ b/bsconfig.json @@ -1,6 +1,5 @@ { "name": "reason-nact", - "version": "1.4.4", "sources": [ { "dir": "src" diff --git a/package.json b/package.json index fc2aa7d..4688122 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "reason-nact", - "version": "3.0.1", + "version": "3.1.0", "description": "let reason-nact = (node.js, reason, actors) ⇒ your µ services have never been so typed", "repository": "https://github.com/ncthbrt/reason-nact", "author": "Nick Cuthbert (https://github.com/ncthbrt)", @@ -46,4 +46,4 @@ "dependencies": { "nact": "^6.0.4" } -} +} \ No newline at end of file diff --git a/src/Nact.js b/src/Nact.js index 76a6d86..f4e5b71 100644 --- a/src/Nact.js +++ b/src/Nact.js @@ -23,6 +23,25 @@ function defaultTo($$default, opt) { } } +function fromUntypedRef(reference) { + return /* ActorRef */[reference]; +} + +function toUntypedRef(param) { + return param[0]; +} + +function dispatch(prim, prim$1) { + Nact.dispatch(prim, prim$1); + return /* () */0; +} + +var Interop = /* module */[ + /* fromUntypedRef */fromUntypedRef, + /* toUntypedRef */toUntypedRef, + /* dispatch */dispatch +]; + function fromReference(param) { return /* ActorPath */[param[0].path]; } @@ -366,7 +385,7 @@ function stop(param) { return /* () */0; } -function dispatch(param, msg) { +function dispatch$1(param, msg) { Nact.dispatch(param[0], msg); return /* () */0; } @@ -377,7 +396,7 @@ function nobody() { function spawnAdapter(parent, mapping) { return spawnStateless(/* None */0, /* None */0, /* None */0, parent, (function (msg, _) { - return Promise.resolve(dispatch(parent, Curry._1(mapping, msg))); + return Promise.resolve(dispatch$1(parent, Curry._1(mapping, msg))); })); } @@ -450,10 +469,10 @@ var minutes = Caml_int32.imul(60, seconds); var hours = Caml_int32.imul(60, minutes); -var $less$neg$less = dispatch; +var $less$neg$less = dispatch$1; function $great$neg$great(msg, actorRef) { - return dispatch(actorRef, msg); + return dispatch$1(actorRef, msg); } function $less$unknown(actor, param) { @@ -491,6 +510,7 @@ var messages = 1; var message = 1; +exports.Interop = Interop; exports.ActorPath = ActorPath; exports.Log = Log; exports.useStatefulSupervisionPolicy = useStatefulSupervisionPolicy; @@ -500,7 +520,7 @@ exports.spawnPersistent = spawnPersistent; exports.spawnAdapter = spawnAdapter; exports.start = start; exports.stop = stop; -exports.dispatch = dispatch; +exports.dispatch = dispatch$1; exports.nobody = nobody; exports.QueryTimeout = QueryTimeout; exports.query = query; diff --git a/src/Nact.re b/src/Nact.re index d8d1d37..8f724cd 100644 --- a/src/Nact.re +++ b/src/Nact.re @@ -10,9 +10,17 @@ let defaultTo = (default, opt) => type persistenceEngine = Nact_bindings.persistenceEngine; +type untypedRef = Nact_bindings.actorRef; + type actorRef('msg) = | ActorRef(Nact_bindings.actorRef); +module Interop = { + let fromUntypedRef = reference => ActorRef(reference); + let toUntypedRef = (ActorRef(reference)) => reference; + let dispatch = Nact_bindings.dispatch; +}; + type actorPath = | ActorPath(Nact_bindings.actorPath); diff --git a/src/Nact.rei b/src/Nact.rei index da8b83e..2700add 100644 --- a/src/Nact.rei +++ b/src/Nact.rei @@ -4,8 +4,16 @@ type systemMsg; type actorRef('msg); +type untypedRef; + type actorPath; +module Interop: { + let fromUntypedRef: untypedRef => actorRef('msg); + let toUntypedRef: actorRef('msg) => untypedRef; + let dispatch: (untypedRef, 'msg) => unit; +}; + module ActorPath: { let fromReference: actorRef(_) => actorPath; let systemName: actorPath => string;