{"id":39027413,"url":"https://github.com/arnaud/hateoas-query","last_synced_at":"2026-01-17T17:33:59.978Z","repository":{"id":57261771,"uuid":"103827736","full_name":"arnaud/hateoas-query","owner":"arnaud","description":"HATEOAS query client","archived":false,"fork":false,"pushed_at":"2018-01-21T16:42:10.000Z","size":151,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-29T05:23:10.851Z","etag":null,"topics":["api-client","hateoas","javascript","query","query-dsl"],"latest_commit_sha":null,"homepage":null,"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/arnaud.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}},"created_at":"2017-09-17T12:40:37.000Z","updated_at":"2023-02-18T21:36:31.000Z","dependencies_parsed_at":"2022-08-25T06:10:59.106Z","dependency_job_id":null,"html_url":"https://github.com/arnaud/hateoas-query","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/arnaud/hateoas-query","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnaud%2Fhateoas-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnaud%2Fhateoas-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnaud%2Fhateoas-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnaud%2Fhateoas-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arnaud","download_url":"https://codeload.github.com/arnaud/hateoas-query/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnaud%2Fhateoas-query/sbom","scorecard":{"id":207759,"data":{"date":"2025-08-11","repo":{"name":"github.com/arnaud/hateoas-query","commit":"97ee2527c185ab89fb956e38c20ed1fb71f58f25"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"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":"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":"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":"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":"Code-Review","score":1,"reason":"Found 1/6 approved changesets -- score normalized to 1","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":"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":"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":"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":"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":"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":"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":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"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"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T00:08:32.213Z","repository_id":57261771,"created_at":"2025-08-17T00:08:32.213Z","updated_at":"2025-08-17T00:08:32.213Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28513248,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api-client","hateoas","javascript","query","query-dsl"],"created_at":"2026-01-17T17:33:59.893Z","updated_at":"2026-01-17T17:33:59.967Z","avatar_url":"https://github.com/arnaud.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HATEOAS query\n\n`HATEOAS-query` enables working with REST HATEOAS APIs while keeping a very concise and elegant code.\n\nIt encapsulates a DSL that helps write single-line selectors to query and fetch though the endpoints, where promises chaining would usually be the classic implementation.\n\nFor instance,\n\n```js\nconst httpClient = require('my/http/client');\nconst path = _.get(user, '_links.invoices.href');\nconst invoices = await httpClient({ path })\n_.get(invoices, 'items', []);\n```\n\nsuddendly becomes:\n\n```js\n// const request = ...;\nconst query = require('hateoas-query')({ request });\nconst invoices = await query(user, `invoices[]`); // \u003c==\n```\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Rules](#rules)\n- [API](#api)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\nThis project uses [node](http://nodejs.org) and [npm](https://npmjs.com).\nGo check them out if you don't have them locally installed.\n\n```sh\n$ npm i --save hateoas-query\n```\n\n## Usage\n\nAll you need is a starting node and a selector, then handle the response in an asynchronous way:\n\n```js\nconst invoiceIds = await bquery(user, 'accounts[].invoices[].invoiceId')\nconsole.log(invoiceIds);\n// =\u003e [1005, 1006, 1008, 1009]\n```\n\n## Rules\n\n`HATEOAS-query` relies on a specific set of selector rules:\n- Each dot `'.'` marks a breakpoint in the chain, that distinguishes every path used to follow the HATOAS links from an endpoint to another ;\n- When a path corresponds to a collection of `'.items[]'`, it must be marked with a trailing `'[]'` ; \n  \u003e Examples: `'invoices[]'`, `'accounts[].invoices[]'`\n- Each path element can either be a *link*, an *action* or an *attribute* ;\n- A path which pattern is `'that'` will be considered a *link* (if available) or an *attribute* (if available) ; if it matches a *link*, it will follow `'_links.that.href'` ;\n- A path which pattern is `'@that'` will be considered an *action* and will follow `'_actions.that'` ;\n- Results are concatenated and reduced (see [functions](Functions)) ;\n- Each result has a reference to its `'_origin'`, which keeps a cloned version of the previous node in the graph ;\n- That's it.\n\n## API\n\n### Global options\n\nOptions can be defined when instanciating the library. These options will affect each and every subsequently calls.\n\n```js\nconst query = hateoas({ request: customRequest }) // \u003c==\n```\n\n#### `strict`\n\nType: `boolean` (default: `false`)\n\nWhen enabled, strict mode ensures all goes well when traversing all the nodes and triggers errors that have to be catched by the callee.\nWhen disabled, no errors are triggered but a warning is logged.\n\n#### `request`\n\nType: `Promise` (default: `undefined`)\n\nThis option is **mandatory** ; it defines how to request a ressource. It should be a Promise-based API client such as `axios` for example.\n\n### Options\n\n#### `strict`\n\nType: `boolean` (default: `false`)\n\nWhen enabled, strict mode ensures all goes well when traversing all the nodes and triggers errors that have to be catched by the callee.\nWhen disabled, no errors are triggered but a warning is logged.\n\n#### `actionParams`\n\nType: `object` (default: `{}`)\n\nSet the action parameters that will be set when calling an actual action.\n\n#### `only`\n\nType: `array or function` (default: `undefined`)\n\nCreates an object composed of the picked properties.\n\n### Functions\n\n#### `query( node, selector [, options] [, results] )`\n\nTraverse a HATEOAS REST API through a selector that descends the corresponding links in a HATEOAS compliant way.\n\nArguments:\n- node: The root node from which the traversal begins with.\n- selector: The [selector](#rules) is the \"full path\" that will be used to traverse the tree.\n- options: [Options](#options).\n- results: This is a reduced Array of every results coming from every leading nodes whichever their origin (whichever which they descend from in terms of tree traversal). Its format is `[arr]` where `arr` is the concatenated reduction of every results.\n\n#### `query-isolated( node, selector [, options] [, results] )`\n\nThis function has all the same implementation as `query()` but its results are not reduced.\n- results: This is a non-reduced Array of every results coming from every leading nodes whichever their origin (whichever which they descend from in terms of tree traversal). Its format is `[[arr1], [arr2], [...]]` where `arrN` is the result of its N-origin.\n\n## Contribute\n\nFeel free to dive in! [Open an issue](https://github.com/arnaud/hateoas-query/issues/new) or submit PRs.\n\n## License\n\nMIT (c) Arnaud Leymet\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnaud%2Fhateoas-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farnaud%2Fhateoas-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnaud%2Fhateoas-query/lists"}