{"id":24558162,"url":"https://github.com/rse/flowlink","last_synced_at":"2025-03-16T19:23:13.335Z","repository":{"id":226894284,"uuid":"769927883","full_name":"rse/flowlink","owner":"rse","description":"Flow Expression Language","archived":false,"fork":false,"pushed_at":"2024-03-27T22:18:41.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-10T10:46:44.326Z","etag":null,"topics":["evaluator","expression","flow","language","link","parser"],"latest_commit_sha":null,"homepage":"https://npmjs.com/flowlink","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-03-10T13:09:12.000Z","updated_at":"2024-03-10T13:11:42.000Z","dependencies_parsed_at":"2024-03-10T13:12:53.141Z","dependency_job_id":"9efe9d13-5f83-410a-8d93-0b37a89cabe3","html_url":"https://github.com/rse/flowlink","commit_stats":null,"previous_names":["rse/flowlink"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fflowlink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fflowlink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fflowlink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fflowlink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rse","download_url":"https://codeload.github.com/rse/flowlink/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243918641,"owners_count":20368745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["evaluator","expression","flow","language","link","parser"],"created_at":"2025-01-23T05:47:33.007Z","updated_at":"2025-03-16T19:23:13.314Z","avatar_url":"https://github.com/rse.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nFlowLink\n====\n\n**Flow Expression Language (FlowLink)**\n\n\u003cp/\u003e\n\u003cimg src=\"https://nodei.co/npm/flowlink.png?downloads=true\u0026stars=true\" alt=\"\"/\u003e\n\n\u003cp/\u003e\n\u003cimg src=\"https://david-dm.org/rse/flowlink.png\" alt=\"\"/\u003e\n\nAbout\n-----\n\nFlowLink is a JavaScript library for use in the Browser and Node.js to\nparse/compile expressions describing data flows. The expressions are\nbased on sequental flows, parallel flows and groups of nodes. FlowLink\nis primarily intended to be used for configuring a complex data flow.\nWhat the particular nodes represent is up to the caller.\n\nInstallation\n------------\n\n```shell\n$ npm install flowlink\n```\n\nUsage\n-----\n\n```\n$ cat sample.js\nconst FlowLink = require(\"..\")\n\nconst flowlink = new FlowLink({\n    trace: (msg) =\u003e console.log(msg)\n})\n\nclass Node {\n    constructor (id, opts, args) {\n        this.id    = id\n        this.opts  = opts\n        this.args  = args\n        this.piped = []\n    }\n    pipe (node) {\n        this.piped.push(node)\n    }\n}\n\nconst expr = `\n    begin(42, id: \\`foo\\${sample}bar\\`) |\n    { foo1(\"foo\"), foo2('bar') } |\n    { bar1, bar2 } |\n    end,\n    sidechain\n`\n\ntry {\n    const ast = flowlink.compile(expr)\n    const stream = flowlink.execute(ast, {\n        resolveVariable (id) {\n            if (id === \"sample\")\n                return \"SAMPLE\"\n            throw new Error(`failed to resolve variable \"${id}\"`)\n        },\n        createNode (id, opts, args) {\n            return new Node(id, opts, args)\n        },\n        connectNode (node1, node2) {\n            node1.pipe(node2)\n        }\n    })\n}\ncatch (ex) {\n    console.log(\"ERROR\", ex.toString())\n}\n```\n\nExpression Language\n-------------------\n\nThe following BNF-style grammar shows the supported expression language:\n\n```\nexpr             ::= parallel\n                   | sequential\n                   | node\n                   | group\nparallel         ::= sequential (\",\" sequential)+\nsequential       ::= node (\"|\" node)+\nnode             ::= id (\"(\" (param (\",\" param)*)? \")\")?\nparam            ::= array | object | variable | template | string | number | value\ngroup            ::= \"{\" expr \"}\"\nid               ::= /[a-zA-Z_][a-zA-Z0-9_-]*/\nvariable         ::= id\narray            ::= \"[\" (param (\",\" param)*)? \"]\"\nobject           ::= \"{\" (id \":\" param (\",\" id \":\" param)*)? \"}\"\ntemplate         ::= \"`\" (\"${\" variable \"}\" / (\"\\\\`\"|.))* \"`\"\nstring           ::= /\"(\\\\\"|.)*\"/\n                   | /'(\\\\'|.)*'/\nnumber           ::= /[+-]?/ number-value\nnumber-value     ::= \"0b\" /[01]+/\n                   | \"0o\" /[0-7]+/\n                   | \"0x\" /[0-9a-fA-F]+/\n                   | /[0-9]*\\.[0-9]+([eE][+-]?[0-9]+)?/\n                   | /[0-9]+/\nvalue            ::= \"true\" | \"false\" | \"null\" | \"NaN\" | \"undefined\"\n```\n\nApplication Programming Interface (API)\n---------------------------------------\n\nThe following TypeScript definition shows the supported Application Programming Interface (API):\n\n```ts\ndeclare module \"flowlink\" {\n    type FlowLinkCallbacks\u003cT\u003e = {\n        resolveVariable(id: string): string,\n        createNode\u003cT\u003e(id: string, opts: { [ id: string ]: any }, args: any[]): T,\n        connectNode(node1: T, node2: T): void\n    }\n    class FlowLink\u003cT\u003e {\n        constructor(\n            options?: {\n                cache?: number,\n                trace?: (msg: string) =\u003e void\n            }\n        )\n        compile(\n            expr: string\n        ): any\n        execute\u003cT\u003e(\n            ast: any,\n            callbacks: FlowLinkCallbacks\u003cT\u003e\n        ): any\n        evaluate\u003cT\u003e(\n            expr: string,\n            callbacks: FlowLinkCallbacks\u003cT\u003e\n        ): any\n    }\n    export = FlowLink\n}\n```\n\nImplementation Notice\n---------------------\n\nAlthough FlowLink is written in ECMAScript 2023, it is transpiled to older\nenvironments and this way runs in really all current (as of 2024)\nJavaScript environments, of course.\n\nAdditionally, there are two transpilation results: first, there is a\ncompressed `flowlink.browser.js` for Browser environments. Second, there is\nan uncompressed `flowlink.node.js` for Node.js environments.\n\nThe Browser variant `flowlink.browser.js` has all external dependencies\n`asty`, `pegjs-otf`, `pegjs-util`, and `cache-lru` directly embedded.\nThe Node.js variant `flowlink.node.js` still requires the external\ndependencies `asty`, `pegjs-otf`, `pegjs-util`, and `cache-lru`.\n\nLicense\n-------\n\nCopyright \u0026copy; 2024 Dr. Ralf S. Engelschall (http://engelschall.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Fflowlink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frse%2Fflowlink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Fflowlink/lists"}