GithubHelp home page GithubHelp logo

encapsule / holistic Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 5.46 MB

Encapsule Project Holistic App Platform runtime libraries and appgen utility.

Home Page: https://github.com/Encapsule-Holistic

License: MIT License

JavaScript 98.73% CSS 0.75% Handlebars 0.52%
javascript-platform javascript-framework model-driven-engineering component-driven-engineering nodejs http-server http-services html5 reactjs finite-state-automata

holistic's People

Contributors

chrisrus avatar

Stargazers

 avatar  avatar

Watchers

 avatar

holistic's Issues

Include client.js from appGen script when creating a new derived repo.

Build info:

"appgen": "@encapsule/holistic v0.0.46 crossroads CfA9bf7rR6WKBhqnhjgKWw 99ccf316fd664cd9fd66c9c624a3524ae95158cd 2020-09-23T21:44:33.000Z",

To reproduce:

  1. Create a new git repo by running yarn init and git init.
  2. Run holistic appgen with appRepoDir set to the new local repo directory,
  3. Add and commit all files in the derived repo.
  4. Run yarn build on the derived repo.

The following error will result:

ERROR in Entry module not found: Error: Can't resolve '/Users/viewpathuser/workspace2/holistic-bugs/BUILD/transpile-phase1/CLIENT/client.js' in '/Users/viewpathuser/workspace2/holistic-bugs' resolve '/Users/viewpathuser/workspace2/holistic-bugs/BUILD/transpile-phase1/CLIENT/client.js' in '/Users/viewpathuser/workspace2/holistic-bugs'

An empty or skeleton "client.js" should be included from appgen so that the derived repo will build initially.

cellProcessQuery does not find singleton instance unless "singleton" is explicitly passed.

Build info:

"appgen": "@encapsule/holistic v0.0.46 crossroads KdclOLg3SyqYSF6u2YUbDg 8e52b7dc753f874256a631b2244721553e41a5dd 2020-09-29T18:58:04.000Z",

When starting a cell process using:

holarchy: { CellProcessor: { process: { create: { apmID: "12345 ..." } } } }

A "cellProcessUniqueName" is not required, the name is defaulted to "singleton" by the cpm.

When I go to query for the same process, I have to pass in "singleton" for "cellProcesssUniqueName" or the query will not find the process. In other words:

holarchy: { CellProcessor: { process: { query: { queryCellProcess: { cellProcessNamespace: { apmID, //TODO this shouldn't be required after upgrading to the latest version of holistic. cellProcessUniqueName: "singleton" } } } } } }

Works whereas:

holarchy: { CellProcessor: { process: { query: { queryCellProcess: { cellProcessNamespace: { apmID, } } } } } }

does not.

If I am not required to pass in a unique name to create the process, I should not be required to pass in the uniqueName to query it. Getting the query to work requires me to know the default name that is being used by the CPM.

AppClientDisplayAdapter should provide a ControllerAction which will allow changing the renderPath and renderContext used.

Build info:

"appgen": "@encapsule/holistic v0.0.46 crossroads 8Ei6heL7RE66YL0q5jkslw 450d4fe4c7db0085ce31b323b0d4eb70fff1eac6 2020-09-26T22:55:07.000Z",

Currently, the AppClientDisplayAdapter only exposes a single ControllerAction:

https://github.com/Encapsule/holistic/blob/v0.0.46-crossroads/PACKAGES/holistic-app-client-cm/AppClientDisplayAdapter/ControllerAction-react-render-client-view.js

The Controller action does not allow consumers to update the renderPath or renderContext used. The renderPath and renderContext can be updated by writing directly to the OCD for the AppClientDisplay adapter, but that pattern in less than ideal.

Add cardinality transition operator to holarchy core logic.

This is a feature request to add cardinality transition operator along with the other logical operators in Holarchy core logic.

The cardinality operator will return true/false based on the cardinality of a passed set of other transition operators being true or false. So the request signature might be something like:

cardinality: { ____types: "jsObject", isTrue: { ____types: "jsArray", operandOperatorVariant: { ____accept: "jsObject" } }, equalTo: { ____accept: "jsNumber" } }

cpm process query throws exception instead of returning error.

Build:

"appgen": "@encapsule/holistic v0.0.46 crossroads CfA9bf7rR6WKBhqnhjgKWw 99ccf316fd664cd9fd66c9c624a3524ae95158cd 2020-09-23T21:44:33.000Z",

An exception is thrown when using the cpm query controller action:

https://github.com/Encapsule/holistic/blob/v0.0.46-crossroads/PACKAGES/holarchy/lib/intrinsics/CellProcessManager/ControllerAction-cpm-process-query.js

If the query is unable to find the requested process, instead of returning an error an unhandled exception is encountered:

"ERROR in 4 ms: Handled exception during controller action dispatch: repsonse is not defined"

which is originating from here: https://github.com/Encapsule/holistic/blob/v0.0.46-crossroads/PACKAGES/holarchy/lib/intrinsics/CellProcessManager/lib/cpm-get-cell-process-descriptor.js#L64

Add TransitionOperator support for OCD arrays and dictionary namespaces

Follow the same general pattern used in OCD value comparison I think. i.e. provide a single TransitionOperator that provides logical operations over an array namespace. This can start out with a small set of operations and grow as there are quite a few variants that we might want to support inside of a single TransitionOperator vs forcing developers to chain together multiple discrete array operations (less efficient). But, we'll see. Baseline is pretty easy and we'll start there.

readNamespace - Need a better facility for reading from proxied namespaces.

Inside the bodyFunction of a controller action, one may want to read from a sub namespace that is connected by a proxy. Using context.ocdi.readNamespace in a proxied namespace will yield a result like:

{
    CPPU-UPgS8eWiMap3Ixovg_private: {

        lcpConnect: "~.gFUcyA0qSrq7Z4Vpn1oIZA_CellProcesses.cellProcessMap.4ODg4BoaGhqkpKSkX19fXw"

        lcpRequest: {

            apmID: "gFUcyA0qSrq7Z4Vpn1oIZA",

            instanceName: "singleton"
   }
}

If I want to read from the actual proxied apm ocd, I can do something like this, to the the lcpConnect string and then use that as a path value to read the actual value from the proxy:

const lcpConnect = readResponse.result[Object.keys(readResponse.result)[0]].lcpConnect;
readResponse = context.ocdi.readNamespace(lcpConnect);

This is a very clunky implementation, either readNamespace needs to be able to sort out a proxied namespace, or we need some sort of wrapper function to do the same.

ComponentRouter React Component should not require context theme specific to ComponentRouter.

Build:

"appgen": "@encapsule/holistic v0.0.46 crossroads CfA9bf7rR6WKBhqnhjgKWw 99ccf316fd664cd9fd66c9c624a3524ae95158cd 2020-09-23T21:44:33.000Z",

ComponentRouter:

https://github.com/Encapsule/holistic/blob/v0.0.46-crossroads/PACKAGES/d2r2/lib/ComponentRouter.jsx#L168

Currently requires specific themes e.g. metadata.site.theme.ComponentRouterError... to be present in the render context to correctly render if an error occurs such as not finding a registered r2d2 component for the render message. In the absence of the correct theme in the render context, the ComponentRouter React component throws and renders nothing.

It is not reasonable for consumers of ComponentRouter to be aware and provide themes specific to ComponentRouter in the renderContext in order for it to properly handle errors.

Holism RTL: "contentType" in binding for a service filter is required yet ignored.

Build info:

"appgen": "@encapsule/holistic v0.0.47 alexandrite Jvp9FcdjQNuiXkE2zcUjJA 4854c0117a5fa5e257006b334d52368e1997cfc0 2020-11-01T16:38:28.000Z",

Suppose I have a service filter that serves content of type "application/json" as shown below:

let factoryResponse = httpServiceFilterFactory.create({
    id: "TxTaBMnjRAGUkRuf7rwUlg",
    name: "Demo JSON service filter",
    description: "A sample of a service filter that returns JSON as content.",
    constraints: {
         request: {
            content: { encoding: "utf8", type: "text/plain" },
            query_spec: { ____opaque: true },
            request_spec: { ____opaque: true },
            options_spec: { ____opaque: true }
        },
        response: {
            content: { encoding: "utf8", type: "application/json" },
            error_context_spec: { ____opaque: true },
            result_spec: { ____opaque: true }
        }
    },
    handlers: {
        request_handler: (request_) => {
            request_.response_filters.result.request({
                streams: request_.streams,
                integrations: request_.integrations,
                request_descriptor: request_.request_descriptor,
                response_descriptor: {
                    http: { code: 200 },
                    content: { encoding: "utf8", type: "application/json" },
                    data: {foo: "bar"}
                }
            });
            return {result: undefined};
        }
    }
});

if (factoryResponse.error) throw new Error(factoryResponse.error);
const demoJSONServiceFilter = factoryResponse.result;

The value of what will be the "content-type" header in the response is clearly "application/json"

When binding that service filter to a route in the config.services object used when constructing the holism server, I am also required to specify the "contentType"

{
    authentication: { required: false },
    filter: demoAsyncServiceFilter,
    request_bindings: { method: "GET", uris: [ "/demoasync" ] },
    response_properties: { contentEncoding: "utf8", contentType: "application/json" },
}

So I have now specified the "content-type" in 2 places, so which value is actually used?

If I change the "contentType" in the binding to something else e.g. "text/html" then the value I actually see when making the request remains "application/json", so clearly the value in the binding is not being used. If I remove, the contentType from "response_properties" then an exception from a filter error for the missing contentType member is thrown and server start fails.

The conclusion is that the "contentType" in the binding is not actually used for the "content-type" header in the response, yet I am still required to provide it.

CellProcess Proxy Connect throws exception if appdsl apm is missing.

Build info:

"appgen": "@encapsule/holistic v0.0.46 crossroads KdclOLg3SyqYSF6u2YUbDg 8e52b7dc753f874256a631b2244721553e41a5dd 2020-09-29T18:58:04.000Z",

When using cell process process connect: e.g.

holarchy: { CellProcessProxy: { connect: { proxyPath: "#.something" localCellProcess: { apmID: "foobar", } } } }

If the namespace defined by "proxyPath" does not have "____appdsl: apm: " ....", an error should be returned.

However instead of an error being returned and uncaught exception is thrown: "Handled exception during controller action dispatch: Cannot read property 'apm' of undefined"

The root cause of the exception is here:

https://github.com/Encapsule/holistic/blob/v0.0.46-crossroads/PACKAGES/holarchy/lib/intrinsics/CellProcessProxy/lib/cpp-get-status-filter.js#L82

Because in the expression the second condition throws and error because proxyMemorySpec.____appdsl will be undefined.

Delegate not working for transition operators.

Build info: appgen": "@encapsule/holistic v0.0.47 alexandrite Jvp9FcdjQNuiXkE2zcUjJA 4854c0117a5fa5e257006b334d52368e1997cfc0 2020-11-01T16:38:28.000Z",

The delegate transition operator with signature:

CellProcessor: { cell: { cellCoordinates: "#.cell2Proxy", delegate: { ...

Does not work, the operator being dispatched does not get the correct apmBindingPath.

An example is in this branch: https://github.com/Viewpath/viewpath5/tree/delegate-bug

node
var cp = require("./SOURCES/CLIENT/delegate-test")

cp.toJSON().opc.toJSON().ocdi.toJSON().PKj0xsAzRkC9SR_TiS1ZrA_CellProcesses

{ cellProcessMap: { '4ODg4BoaGhqkpKSkX19fXw': { cell2Proxy: [Object], __apmiStep: 'waiting_for_cell_2' } }, revision: 1 }

The APM for cell1 " '4ODg4BoaGhqkpKSkX19fXw" should transition to ready state because cell2 " x7pM9bwcReupSRh0fcYTgw" is in ready state but no such transition occurs.

https://github.com/Viewpath/viewpath5/blob/delegate-bug/SOURCES/CLIENT/delegate-test/cellModel1/index.js#L54

Looking at the debugger it does not appear that the apmBindingPath is being resolved correctly in the proxy in the implementation for the delegate operator.

ocd writeNamespace filter throw on attempt to write to an empty map entry

Build info:

appgen": "@encapsule/holistic v0.0.46 crossroads KdclOLg3SyqYSF6u2YUbDg 8e52b7dc753f874256a631b2244721553e41a5dd 2020-09-29T18:58:04.000Z",

If in an ocd namespace you have a map declared:

myMap: { ____types: "jsObject", ____asMap: true, ____defaultValue: {} key: {____accept: "jsObject"} }

If you attempt to write to a key in the map that doesn't exist such as:
( "key1" is not in the map)

ocd.writeNamespace("~...myMap.key1", {foo: "bar"})

Then the writeNamespace filter will throw an exception instead of returning an error as it should.

holarchy array isEmpty Transition operator throws exception.

Build info: "appgen": "@encapsule/holistic v0.0.46 crossroads t10PUwZHS3e8dhu3oBpMRA 10e623d9d2dbfb86af25bf3795dc8ec73e9af666 2020-10-08T18:50:20.000Z",

When attempting to use the holarchy arrayIsEmpty operator in an apm, for example:

holarchy: { cm: { operators: { ocd: { arrayIsEmpty: { path: "#.foo.bar..."

An exception is thrown:

OPC::evaluate <XSwV...> [4:0] TransitionOperator threw an illegal exception that was handled by OPC: Cannot read property 'path' of undefined

Error is originating here:

https://github.com/Encapsule/holistic/blob/v0.0.46-crossroads/PACKAGES/holarchy/lib/intrinsics/HolarchyCore/HolarchyCoreMemory/TransitionOperator-ocd-array-is-empty.js#L45

because line 43 should have "arrayIsEmpty" instead of "isArrayEmpty"

AppClientDisplayAdapter failing to initialize with TransitionOperator returning error.

Build info:

"appgen": "@encapsule/holistic v0.0.46 crossroads 8Ei6heL7RE66YL0q5jkslw 450d4fe4c7db0085ce31b323b0d4eb70fff1eac6 2020-09-26T22:55:07.000Z",

OPC::evaluate <gRyJ...> [2:1] TransitionOperator request was successfully parsed and routed to plug-in filter delegate [9tNY7o5GTUGH_xda2GhP-w::Cell Process In Step Operator]. But, the plug-in rejected the request with error: Filter [9tNY7o5GTUGH_xda2GhP-w::Cell Process In Step Operator] failed while performing main operation. Filter [RNUkdw8VT8WLz5H_i-SwYg::Data Path Resolve Filter] failed while performing main operation. Invalid dataPath '#.//.//.//.//' references namespace at or above the anonymous '~' namespace.

Offending code:

https://github.com/Encapsule/holistic/blob/v0.0.46-crossroads/PACKAGES/holistic-app-client-cm/AppClientDisplayAdapter/AbstractProcessModel-app-client-display-adapter.js#L96

AppClientDisplayAdapter - Incorrect transition operator signature in apm.

Build info:

appgen": "@encapsule/holistic v0.0.46 crossroads 8Ei6heL7RE66YL0q5jkslw 450d4fe4c7db0085ce31b323b0d4eb70fff1eac6 2020-09-26T22:55:07.000Z",

Exception is being thrown on evaluation of transition operator in the apm declaration:

https://github.com/Encapsule/holistic/blob/v0.0.46-crossroads/PACKAGES/holistic-app-client-cm/AppClientDisplayAdapter/AbstractProcessModel-app-client-display-adapter.js#L297

The signature at the above line should be "cell" instead of "opmi"

Include context from transition when an action is dispatched from opc.evaluate.

When an action signature is in an APM as an "enter" or "exit" action, it would be great to have some context from the transition included when that action is dispatched from opc.evaluate(). Currently, inside an action bodyFunction there is no way to tell what the target state of the APM is for the invocation. Actions currently have access to the "__apmiStep" from the ocdi, but that will contain the step that was last written to the ocdi and not the step that the APM will be (potentially) transitioning to.

Similarly it would be nice to know within a bodyFunction of an action whether the action was invoked by an external actor as opposed to opc.evaluate(), because most actions will be intended for one manner of invocation or the other, but not both and there is currently no way to distinguish them at runtime.

Modify generate runtime build tag to work with AWS Codepipeline

While building a holism derived Node server via AWS code pipeline, I encountered the following issue.

https://forums.aws.amazon.com/thread.jspa?threadID=251732

The summary of the issue is that the .git directory and hence any git commands are not available on the build server, and this causes the derived generate script: "generate-runtime-build-tag.js" to fail which fails the build. There is an environment variable available that contains the git hash of the commit being built. Therefore, to build a holism derived server on AWS Code Pipeline requires a small modification to the below file:

https://github.com/Encapsule/holistic/blob/master/PROJECT/GENERATOR/TEMPLATES/generate-runtime-buildtag.js.hbs

Which could look like this:

let commitHash;

if (process.env.CODEBUILD_RESOLVED_SOURCE_VERSION) {
    commitHash = process.env.CODEBUILD_RESOLVED_SOURCE_VERSION
} else {
    commitHash = childProcess.execSync('git rev-parse HEAD').toString('utf8').trim();
}

Cell Process Proxy RTL: Cell Process Proxy Transition Operator throws Exception.

Build info:

"appgen": "@encapsule/holistic v0.0.47 alexandrite oew_jzCXQrS65IlpoGuTEw 209d536ee6c3d769de0f59d643dd4eb25da7624a 2020-11-14T17:19:56.000Z",

The cell process proxy transition operator throws a an exception instead of returning an error.

" .... repsonse is not defined"

From line:

https://github.com/Encapsule/holistic/blob/v0.0.47-alexandrite/PACKAGES/holarchy/lib/intrinsics/CellProcessProxy/TransitionOperator-cpp-proxy-operator.js#L55

CellProcessor process create action throws exception when it should be returning an error.

Build info:

"appgen": "@encapsule/holistic v0.0.46 crossroads mbeyCaeHSLyoGtX19yvb2g
a87610edbc4589e47c01266c401f8e2abe79a053 2020-10-02T04:29:48.000Z",

An unhandled exception is being throw when calling

actionRequest: { holarchy: { CellProcessor: { process: { create ....

Error thrown:

Filter [PgH0_QIhSs2c6nsw53uCjQ::OPC Act Filter] failed while performing main operation. Handled exception during controller action dispatch: apmBindiingPath is not defined

From:

https://github.com/Encapsule/holistic/blob/v0.0.46-crossroads/PACKAGES/holarchy/lib/intrinsics/CellProcessManager/ControllerAction-cpm-process-create.js#L152

queryCellProcess should not return an error if it can't find the process for the passed apmID

Build info: "appgen": "@encapsule/holistic v0.0.46 crossroads KdclOLg3SyqYSF6u2YUbDg 8e52b7dc753f874256a631b2244721553e41a5dd 2020-09-29T18:58:04.000Z",

Using cell processor query such as:

          `holarchy: {
                CellProcessor: {
                    process: {
                        query: {
                            queryCellProcess: {
                                cellProcessNamespace: {
                                    apmID: "foo"
                               }
                          }
                   }
             }
      }`

I want to find if a process is running (the process may or may not be running).

If the process is not running, then the query should return some sort of empty result. Instead I get an error and a big orange box logged to the console with text like:

"ControllerAction request was successfully parsed and routed to plug-in filter delegate [r-JgxABoS_a-mSE2c1nvKA::Cell Process Manager: Process Query]. But, the plug-in rejected the request with error: Filter [r-JgxABoS_a-mSE2c1nvKA::Cell Process Manager: Process Query] failed while performing main operation. Filter [CxS4tmxfRdSF6C7pljlm5Q::cpmLib: Get Cell Process Descriptor] failed while performing main operation. Invalid cellProcessID specified. No active cell process with ID 'zkhowzwqMaTMU8prQEM_yA'. From the perspective of this error handler it's difficult to say precisely what this error means given the broad semantics of ControllerAction plug-in filters. Here is a list of possible problems in decreasing order of liklihood: Your request format may be invalid above the point in the request data where the message router made its delegate selection and this error is the plug-in rejecting the request entirely. Or, the selected ControllerAction plug-in filter may implement some sort of additional input value validation that constrains the permissible input beyond what's examined by the message router and ControllerAction plug-in filters. And, you've violated API constraints. Or, you have made a valid request but applied the action to the wrong type of cell (i.e. you think you're acting on a cell bound to APM X but it's really bound to a Y). Or, the cell you're attempting to act upon is not in the correct process step or otherwise prepared to accept or take action on behalf of the caller. Or, there's a bug in the ControllerAction plug-in filter itself. If you track down the source of this error and it's not on this list please report it!" ....

I would normally expect the semantics of a query to be such that not finding the thing that I query would return an empty result not an error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.