{"id":19185939,"url":"https://github.com/beameryedge/querycraft-to-function","last_synced_at":"2025-10-28T07:03:03.076Z","repository":{"id":57157980,"uuid":"112618347","full_name":"BeameryEdge/queryCraft-to-function","owner":"BeameryEdge","description":"Converts a QueryCraft Filter Builder object into a functions to filter Arrays of objects","archived":false,"fork":false,"pushed_at":"2025-07-22T11:08:41.000Z","size":174,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-30T06:38:36.115Z","etag":null,"topics":["querycraft","querycraft-filter-builder"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/BeameryEdge.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-30T14:03:54.000Z","updated_at":"2021-11-10T20:15:14.000Z","dependencies_parsed_at":"2024-11-09T11:12:41.318Z","dependency_job_id":"8dfe9d89-6a92-4a21-ab77-f29acf96f737","html_url":"https://github.com/BeameryEdge/queryCraft-to-function","commit_stats":null,"previous_names":["beameryhq/querycraft-to-function"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/BeameryEdge/queryCraft-to-function","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeameryEdge%2FqueryCraft-to-function","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeameryEdge%2FqueryCraft-to-function/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeameryEdge%2FqueryCraft-to-function/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeameryEdge%2FqueryCraft-to-function/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BeameryEdge","download_url":"https://codeload.github.com/BeameryEdge/queryCraft-to-function/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeameryEdge%2FqueryCraft-to-function/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281397300,"owners_count":26493908,"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","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"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":["querycraft","querycraft-filter-builder"],"created_at":"2024-11-09T11:12:33.658Z","updated_at":"2025-10-28T07:03:03.060Z","avatar_url":"https://github.com/BeameryEdge.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QueryCraft-To-Function-To-Function\nConverts a [QueryCraft](https://github.com/BeameryHQ/QueryCraft) Filter Builder object into a function to filter arrays of objects.\n\n\n[![NPM](https://nodei.co/npm/querycraft-to-function.png)](https://npmjs.org/package/querycraft-to-function)\n\n[![npm version](https://badge.fury.io/js/querycraft-to-function.svg)](https://badge.fury.io/js/querycraft-to-function)\n[![CircleCI](https://circleci.com/gh/BeameryHQ/QueryCraft-To-Function.svg?style=shield)](https://circleci.com/gh/BeameryHQ/QueryCraft-To-Function)\n[![codecov](https://codecov.io/gh/BeameryHQ/QueryCraft-To-Function/branch/master/graph/badge.svg)](https://codecov.io/gh/BeameryHQ/QueryCraft-To-Function)\n[![David deps](https://david-dm.org/BeameryHQ/QueryCraft-To-Function.svg)](https://david-dm.org/BeameryHQ/QueryCraft-To-Function)\n[![Known Vulnerabilities](https://snyk.io/test/github/beameryhq/querycraft-to-function/badge.svg)](https://snyk.io/test/github/beameryhq/querycraft-to-function)\n\n## Installation\n\n```sh\nnpm install --save 'querycraft'\nnpm install --save 'querycraft-to-function'\n```\n\n## Examples\n\nSuppose we have a collection of data that satisfies the interface\n\n```ts\ninterface contact {\n    id: string\n    'list': { id: string }[]\n    firstName: string\n    lastName: string\n    email: string\n    createdAt: Date\n    customFields: { id: string, value: number }[]\n    assignedTo?: string\n}\n```\n\nIf we want a query the describes the logic:-\n```\n    first 50 items where\n        fistName is bob\n        lastName is doyle OR is not set\n        assignedTo is anything\n        list has an item where id is item1\n    sorted (in ascending order) by the value property of the customField where id is custom1\n    created less than 5 days ago\n```\n\nWe can build build it as easily as:-\n\n```ts\nimport { FilterBuilder, eq, lt, neq, any, find, where, BucketsAggregation,  } from 'querycraft'\nimport { apply, ArraySource } from 'querycraft-to-function'\n\nconst contacts: contact[] =  [ ... ]\n\nconst filter = new FilterBuilder()\n.where('firstName', eq('bob'))\n.where('list', find(where('id', eq('item1'))))\n.where('lastName', any([\n    eq('doyle'),\n    eq(null)\n]))\n.where('createdAt', lt({ daysAgo: 5 }))\n.where('assignedTo', neq(null))\n.setSortFieldId('customFields', 'custom1', 'value')\n.setSortDirection('ASC')\n.setLimit(50)\n\nconsole.log(apply(filter, contacts))\n// -\u003e filtered list of contacts\n\n```\n\nIf we would instead for example want to get contacts named bob\ngrouped by the day they were created :-\n\n```ts\nimport { FilterAggregation, eq, BucketsAggregation,  } from 'querycraft'\nimport { apply, ArraySource } from 'querycraft-to-function'\n\nconst buckets = new ArraySource(testObjects)\n    .pipe(new FilterAggregation())\n        .where('firstName', eq('bob'))\n    .pipe(new BucketsAggregation({\n        fieldId: 'createdAt',\n        dateInterval: 'day'\n    }))\n    .sink()\n// -\u003e grouped counts of contacts\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeameryedge%2Fquerycraft-to-function","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeameryedge%2Fquerycraft-to-function","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeameryedge%2Fquerycraft-to-function/lists"}