{"id":34982995,"url":"https://github.com/tinydesk/relmapper","last_synced_at":"2026-05-24T07:34:32.782Z","repository":{"id":57352869,"uuid":"77302261","full_name":"tinydesk/relmapper","owner":"tinydesk","description":"Map a relational model to JSON","archived":false,"fork":false,"pushed_at":"2017-01-01T17:53:50.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-05-24T07:34:18.284Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/tinydesk.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-12-24T22:31:11.000Z","updated_at":"2016-12-24T23:06:59.000Z","dependencies_parsed_at":"2022-09-05T11:40:51.418Z","dependency_job_id":null,"html_url":"https://github.com/tinydesk/relmapper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tinydesk/relmapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinydesk%2Frelmapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinydesk%2Frelmapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinydesk%2Frelmapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinydesk%2Frelmapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinydesk","download_url":"https://codeload.github.com/tinydesk/relmapper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinydesk%2Frelmapper/sbom","scorecard":{"id":887500,"data":{"date":"2025-08-11","repo":{"name":"github.com/tinydesk/relmapper","commit":"bf7e5d66a50a42ed8afe84084df3df21d25cb198"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 0/21 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T10:32:43.175Z","repository_id":57352869,"created_at":"2025-08-24T10:32:43.175Z","updated_at":"2025-08-24T10:32:43.175Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33426013,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T22:14:44.296Z","status":"online","status_checked_at":"2026-05-24T02:00:06.296Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-12-27T01:07:57.345Z","updated_at":"2026-05-24T07:34:32.760Z","avatar_url":"https://github.com/tinydesk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# relmapper\n\nMap a relational model to JSON and back.\n\nThis library is a light-weight tool, that is only concerned with converting between a hierarchical representation and a flat column-like representation of the data. The idea behind this is, that a server is essentially an adapter transforming data from a database to a web based interface such as REST over HTTP and vice versa. relmapper facilitates this transformation while not interfering with your queries. This library is for all developers that have decided on a particular relational db technology and want to leverage its full potential without being limited by the abstraction of an ORM. \n\nSupport for transforming join results into arrays is planned but not yet implemented.\n\n## Getting started\n\n```bash\nnpm install relmapper --save\n```\n\nConvert json to a db record:\n```javascript\nvar mapper = require('relmapper').defaultMapper;\nvar json = {\n  myJsonProperty: 5,\n  myNested: {\n    jsonProperty: 'with text'\n  }\n};\nmapper.apply(json);\n/*\nreturns {\n  my_json_property: 5,\n  my_nested__json_property: 'with_text'\n}\n */\n```\n\nConvert the result from a db query to nested json from a table looking like this:\n```sql\nCREATE TABLE(\n  my_json_property: INTEGER,\n  my_nested__json_property: VARCHAR(512)\n);\n```\n\n```javascript\nvar queryResult = query('SELECT * FROM mytable');\nmapper.unapply(queryResult); \n/*\nreturns [{\n  myJsonProperty: 5,\n  myNested: {\n   jsonProperty: 'with text'\n  } \n},\n...]\n */\n```\n\n## API\n\nThe basic concept of this library is that of a *mapper*. A mapper is a plain javascript object with two methods: `apply` and `unapply`. The transformation between the hierarchical and the relation representation is performed by applying a pipeline of mappers:\n\n```\njson -\u003e mapper1.apply -\u003e mapper2.apply -\u003e mapper3.apply -\u003e db object\ndb object -\u003e mapper3.unapply -\u003e mapper2.unapply -\u003e mapper1.unapply -\u003e json\n```\n \n A mapper can either transform a single object or an array of objects. The module exposes the following mappers:\n\n### flatten(delimiter)\n\nTransforms a hierarchical structure to a flat property where the path is indicated by the given delimiter.\n\nExamples:\n```javascript\nvar relmapper = require('relmapper');\nvar json = { a: { b: { c: 1 } } };\nrelmapper.flatten('__').apply(json);\n/*\nreturns { a__b__c: 1 }\n */\n\nvar result = { a__b__c: 1 };\nrelmapper.flatten('__').unapply(result);\n/*\nreturns { a: { b: { c: 1 } } }\n */\n```\n\n### camelCase\n\nTransforms camel case to snake case and vice versa. This is needed since most relational database systems are case insensitive.\n\nExamples:\n```javascript\nvar relmapper = require('relmapper');\nvar json = { aCamelCaseProperty: 1 };\nrelmapper.camelCase.apply(json);\n/*\nreturns { a_camel_case_property: 1 }\n */\n\nvar result = { a_camel_case_property: 1 };\nrelmapper.camelCase.unapply(result);\n/*\nreturns { aCamelCaseProperty: 1 }\n */\n```\n\nMappers can be combined to form more complex mappers:\n\n### sequence(...mappers)\n\nCreates a pipeline of mappers that are applied in sequence. The order is reversed when unapplying.\n\nThe library also publishes a `defaultMapper` which is defined as a sequence of flatten and camelCase:\n\n```javascript\nvar defaultMapper = relmapper.sequence(relmapper.flatten('__'), relmapper.camelCase);\n```\n\nSee the getting started section for an example of this mapper.\n\n### fromObjectMapper(mapper)\n\nCreates a mapper that can handle both arrays and objects from a simpler mapper that only processes objects. \n\n## Changelog\n\n### 0.3.0\n\n- Reimplemented the existing functionality in typescript. \n- Changed the following names due to collisions with keywords:\n    - `default` becomes `defaultMapper`\n    - `case` becomes `camelCase`\n\n### 0.2.0\n\n- Changed the mapper interface to also support arrays as arguments to `apply` and `unapply`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinydesk%2Frelmapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinydesk%2Frelmapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinydesk%2Frelmapper/lists"}