{"id":15013976,"url":"https://github.com/dalen/node-puppetdbquery","last_synced_at":"2025-10-08T14:02:10.953Z","repository":{"id":17125247,"uuid":"19891457","full_name":"dalen/node-puppetdbquery","owner":"dalen","description":"a simple query language parser for PuppetDB","archived":false,"fork":false,"pushed_at":"2022-12-06T20:13:55.000Z","size":453,"stargazers_count":8,"open_issues_count":17,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-16T17:52:42.098Z","etag":null,"topics":["javascript","puppetdb"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dalen.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":"2014-05-17T16:53:38.000Z","updated_at":"2021-05-06T16:48:02.000Z","dependencies_parsed_at":"2023-01-11T20:25:57.119Z","dependency_job_id":null,"html_url":"https://github.com/dalen/node-puppetdbquery","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/dalen/node-puppetdbquery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalen%2Fnode-puppetdbquery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalen%2Fnode-puppetdbquery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalen%2Fnode-puppetdbquery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalen%2Fnode-puppetdbquery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dalen","download_url":"https://codeload.github.com/dalen/node-puppetdbquery/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dalen%2Fnode-puppetdbquery/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265914486,"owners_count":23848428,"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":["javascript","puppetdb"],"created_at":"2024-09-24T19:45:01.322Z","updated_at":"2025-10-08T14:02:10.878Z","avatar_url":"https://github.com/dalen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Node PuppetDB query\n===================\n\nA JavaScript version of the [puppetdbquery module for puppet](https://github.com/dalen/puppet-puppetdbquery).\n\nIt is written using [JISON](http://zaach.github.io/jison/) and [ast-types](http://github.com/benjamn/ast-types).\n\n```js\nvar puppetdbquery = require('puppetdbquery');\npuppetdbquery.parse('(puppetversion=\"3.6.2\" or puppetversion=\"3.7.0\") and kernel=Linux');\n// [\"and\",\n//   [\"or\",\n//     [\"in\",\"certname\",\n//       [\"extract\",\"certname\",\n//         [\"select_fact_contents\",\n//           [\"and\", [\"=\",\"path\", [\"puppetversion\"]],[\"=\",\"value\",\"3.6.2\"]]]]],\n//     [\"in\",\"certname\",\n//       [\"extract\",\"certname\",\n//         [\"select_fact_contents\",\n//           [\"and\", [\"=\",\"path\",[\"puppetversion\"]],[\"=\",\"value\",\"3.7.0\"]]]]]],\n//   [\"in\",\"certname\",\n//     [\"extract\",\"certname\",\n//       [\"select_fact_contents\",\n//         [\"and\",[\"=\",\"path\",[\"kernel\"]],[\"=\",\"value\",\"Linux\"]]]]]]\n```\n\nThe find-nodes utility is included as an example on how to use it.\n\nSyntax\n------\n\nUse `fact=value` to search for nodes where `fact` equals `value`. To search for\nstructured facts use dots between each part of the fact path, for example\n`foo.bar=baz`.\n\nResources can be matched using the syntax `type[title]{param=value}`.\nThe part in brackets is optional. You can also specify `~` before the `title`\nto do a regexp match on the title. Type names and class names are case insensitive.\nA resource can be preceded by @@ to match exported resources, the default is to only\nmatch \"local\" resources.\n\nStrings can contain letters, numbers or the characters :-_ without needing to be quoted.\nIf they contain any other characters they need to be quoted with single or double quotes.\nUse backslash (\\) to escape quotes within a quoted string or double backslash for backslashes.\n\nAn unquoted number or the strings true/false will be interpreted as numbers and boolean\nvalues, use quotation marks around them to search for them as strings instead.\n\nA @ sign before a string causes it to be interpreted as a date parsed with\n[timespec](https://github.com/calebcase/timespec). For example `@\"now - 2 hours\"`.\n\nA # sign can be used to do a subquery, against the nodes endpoint for example to\nquery the `report_timestamp`, `catalog_timestamp` or `facts_timestamp` fields.\nFor example `#node.report_timestamp \u003c @\"now - 2 hours\"`.\n\nA subquery using the # sign can have a block of expressions instead of a single\nexpression. For example `#node { report_timestamp \u003e @\"now - 4 hours\" and\nreport_timestamp \u003c @\"now - 2 hours\" }`\n\nA bare string without comparison operator will be treated as a regexp match against the certname.\n\n#### Comparison operators\n\n| Op | Meaning                |\n|----|------------------------|\n| =  | Equality               |\n| != | Not equal              |\n| ~  | Regexp match           |\n| !~ | Not equal Regexp match |\n| \u003c  | Less than              |\n| =\u003c | Less than or equal     |\n| \u003e  | Greater than           |\n| =\u003e | Greater than or equal  |\n\n#### Logical operators\n\n| Op  |            |\n|-----|------------|\n| not | (unary op) |\n| and |            |\n| or  |            |\n\nShown in precedence order from highest to lowest. Use parenthesis to change order in an expression.\n\n### Query Examples\n\nNodes with package mysql-server and amd64 arcitecture\n\n    (package[\"mysql-server\"] and architecture=amd64)\n\nNodes with the class Postgresql::Server and a version set to 9.3\n\n    class[postgresql::server]{version=9.3}\n\nNodes with 4 or 8 processors running Linux\n\n    (processorcount=4 or processorcount=8) and kernel=Linux\n\nNodes that haven't reported in the last 2 hours\n\n    #node.report_timestamp\u003c@\"now - 2 hours\"\n\nRequired PuppetDB version\n-------------------------\n\nThis requires at least PuppetDB 3.0.0 to work as it uses the v4 API not included in previous versions.\n\nLicense\n-------\n\nThis is licensed under the Apache V2 license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalen%2Fnode-puppetdbquery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdalen%2Fnode-puppetdbquery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdalen%2Fnode-puppetdbquery/lists"}