0.1.0 • Published 5 years ago

runtime-reason v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago
  module Internal {
    /* Internal development kitchensink, should be encapsulated */
    class Logger;
    // ... etc.
  };
  module Util {
    /* Utilities available for the developer to take common actions etc. */
    func resetAccount() { } // ... etc.
  };
  module Transport {
    /* Classes for I/O data structures */
    class Request;
    class Response;
    class Net;
    class Client; // Wrapper around the apollo client
    class Socket;
    // ... etc.
  };
  module Errors { 
    /* These are the different classes of Errors that can be thrown by the Framework, useful for catching specific errors */
    class BaseError;
    // ... etc.
  };
  module Events {
    /* Classes for different Event types */
    class BaseEvent;
    class Machine;
    class AppInitialized extends BaseEvent;
    // ... etc.
  };
  module Components {
    /* Namespaces for different components */
    React.Component Application;
    module Control {
      <If /> // ... etc
    };
    module Async {
      <Await /> // ... etc
    };
    // ... etc
  };
  module Data {
    /* Important data structures and classes */
    class User;
    class Session; 
    // ... etc.
  };
  module Engine {
    /* Core runtime functionality */
    class Credentials, Options; // ...etc.
    class Client;
    class SessionManager;
    class StreamingAgent;
    class TrainingPipeline;
  };
  module Core {
    /* Primary sub-products (essentially stand for different individual API endpoints) */
    module AI, Lang, Dialog, Speech, Knowledge; // etc.
  };
}

USAGE

const { Engine, Core, Components, Data, Events } = require("@mauna/framework");
const { Credentials, Client } = Engine;
const { Authenticated } = Events;
const { Application, Dialog, Scenario } = Components;
const { Bot, User } = Data; 
const credentials = Credentials.fromCerts("/path/to/pem/file");
const client = new Client(credentials, { /* options */ });
await client.authenticate();
// or... client.on(Authenticated, () => {});
class MyBot extends Bot { static /* Settings */ };
const appReducer = (
<Application>
  <Scenario>
    <Dialog>
      <MyBot.says> Hello </MyBot.says>
    <Dialog>
  <Scenario>
<Application>
);
const application = await client.registerApp(name, appReducer);
const transformStream = await application.init();
const outStream = inStream.pipeThrough(transformStream);
await outStream.pipeTo(/* some io */);