{"id":20507265,"url":"https://github.com/jbmusso/zer","last_synced_at":"2025-04-13T21:52:37.730Z","repository":{"id":48000721,"uuid":"61579256","full_name":"jbmusso/zer","owner":"jbmusso","description":"Zer helps you create and serialize generic JavaScript chains to String representations of any languages by leveraging ES2015 Proxy objects.","archived":false,"fork":false,"pushed_at":"2022-12-06T20:28:41.000Z","size":229,"stargazers_count":9,"open_issues_count":5,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T07:04:48.972Z","etag":null,"topics":["chain","dsl","gremlin","javascript-chains","javascript-proxy","serialization","serializer","sql"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jbmusso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-20T20:48:20.000Z","updated_at":"2020-10-31T19:11:05.000Z","dependencies_parsed_at":"2023-01-23T19:45:22.959Z","dependency_job_id":null,"html_url":"https://github.com/jbmusso/zer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbmusso%2Fzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbmusso%2Fzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbmusso%2Fzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbmusso%2Fzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbmusso","download_url":"https://codeload.github.com/jbmusso/zer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788867,"owners_count":21161726,"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":["chain","dsl","gremlin","javascript-chains","javascript-proxy","serialization","serializer","sql"],"created_at":"2024-11-15T20:12:59.902Z","updated_at":"2025-04-13T21:52:37.709Z","avatar_url":"https://github.com/jbmusso.png","language":"JavaScript","readme":"# zer\n\nZer helps you serialize any JavaScript chains to String representations of any languages by leveraging ES2015 `Proxy` objects.\n\n## Installation\n\n```shell\nnpm install zer\n```\n\n## Usage\n\nZer is currently useful for generating Gremlin-Groovy graph database queries.\n\n```javascript\n\nimport { gremlin, renderChain } from 'zer';\n\nconst { g, out, has } = gremlin;\n\nconst chain = g.V().has('name', 'Alice').repeat(out('knows')).until(has('name', 'Bob'));\nconst rendered_chain = renderChain(chain);\n\nconsole.log(rendered_chain);\n/*\n {\n    query: 'g.V().has(p0, p1).repeat(out(p2)).until(has(p3, p4))',\n    params: {\n        p0: 'name',\n        p1: 'Alice',\n        p2: 'knows',\n        p3: 'name',\n        p4: 'Bob'\n    }\n }\n*/\n\nconsole.log(chain.__repr__());\n/*\n [\n     ChainStart { name: 'g', type: 'CHAIN_START' },\n     Step { name: 'V', type: 'STEP' },\n     Arguments { params: [], type: 'ARGUMENTS' },\n     Step { name: 'has', type: 'STEP' },\n     Arguments { params: [ 'name', 'Alice' ], type: 'ARGUMENTS' },\n     Step { name: 'repeat', type: 'STEP' },\n     Arguments {\n       params: [\n         {\n           query: 'out(p0)',\n           params: {\n             p0: 'knows'\n           }\n         }\n       ],\n       type: 'ARGUMENTS'\n     },\n     Step {\n       name: 'until',\n       type: 'STEP'\n     },\n     Arguments {\n       params: [\n         {\n           query: 'has(p0, p1)',\n           params: {\n             p0: 'name',\n             p1: 'Bob'\n           }\n         }\n       ],\n       type: 'ARGUMENTS'\n     }\n  ]\n*/\n\n```\n\n## Argument escaping\n\nZer allows you to output Objects, not just Strings. This is especially useful when you wish to escape some arguments from your chain, such as when creating a DSL for a database client (SQL, Gremlin...).\n\n```javascript\nconst chain = g.V().has('name', 'Alice').repeat(out('knows')).until(has('name', 'Bob'));\n\nconsole.log(chain.__repr__())\n\n/*\n { query: 'g.V().has(p0, p1).has(p2, p3).repeat(out(p4, p5))',\n  params:\n   {\n     p0: 'name',\n     p1: 'Alice',\n     p2: 'age',\n     p3: 30,\n     p4: 'firstname',\n     p5: 'Bob'\n   }\n*/\n```\n\n","funding_links":[],"categories":["Proxy Resources"],"sub_categories":["Modules"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbmusso%2Fzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbmusso%2Fzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbmusso%2Fzer/lists"}