{"id":22356328,"url":"https://github.com/do-/node-doix-w2ui","last_synced_at":"2026-01-04T20:02:36.488Z","repository":{"id":65813245,"uuid":"598705055","full_name":"do-/node-doix-w2ui","owner":"do-","description":"doix w2ui adapter","archived":false,"fork":false,"pushed_at":"2024-09-07T17:25:35.000Z","size":165,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-09T12:08:26.581Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/do-.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":"2023-02-07T16:43:08.000Z","updated_at":"2024-09-07T17:25:39.000Z","dependencies_parsed_at":"2024-06-29T06:50:59.479Z","dependency_job_id":null,"html_url":"https://github.com/do-/node-doix-w2ui","commit_stats":{"total_commits":7,"total_committers":2,"mean_commits":3.5,"dds":0.4285714285714286,"last_synced_commit":"ce0ef6acf7c1778542e054aef077cad73a7606ea"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-%2Fnode-doix-w2ui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-%2Fnode-doix-w2ui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-%2Fnode-doix-w2ui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/do-%2Fnode-doix-w2ui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/do-","download_url":"https://codeload.github.com/do-/node-doix-w2ui/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228124653,"owners_count":17873170,"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":[],"created_at":"2024-12-04T14:09:55.143Z","updated_at":"2026-01-04T20:02:36.431Z","avatar_url":"https://github.com/do-.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![workflow](https://github.com/do-/node-doix-w2ui/actions/workflows/main.yml/badge.svg)\n![Jest coverage](./badges/coverage-jest%20coverage.svg)\n\n`doix-w2ui` is a [w2ui](https://w2ui.com/) adapter for the [doix](https://github.com/do-/node-doix) server platform.\n\nMore specifically, this is a translator of [AJAX requests](https://w2ui.com/web/docs/2.0/grid#struct-request) coming from w2grid into [DbQuery](https://github.com/do-/node-doix-db/wiki/DbQuery) instances.\n\n# Installation\n```\nnpm install doix-w2ui\n```\n\n# Initialization\n`doix-w2ui` is a plug in for database clients, such as [DbClientPg](https://github.com/do-/node-doix-db-postgresql/wiki/DbClientPg). It can be attached to any database connection pool by calling the `plugInto` method:\n\n```js\nconst {DbPoolPg}   = require ('doix-db-postgresql')\nconst w2ui = require ('doix-w2ui')\n\nconst db = new DbPoolPg ({\n  db: conf.db,\n  logger: createLogger (conf, 'db'),\n})\n\nw2ui.plugInto (db)\n```\n\nAfter that, each `db` instance injected into a [Job](https://github.com/do-/node-doix/wiki/Job) will have the `w2uiQuery` method described in the next section.\n\n# Using in application code\nWith `doix-w2ui` plugged in, the `db` resource provides the `w2uiQuery` method having the same parameters as [DbModel.createQuery](https://github.com/do-/node-doix-db/wiki/DbModel#createquery):\n\n```js\nselect_users:    \n  async function () {\n    const {db} = this\n    const query = db.w2uiQuery ([['users']], {order: ['label']})\n    const list = await db.getArray (query)\n    return {\n      all: list, \n      cnt: list [Symbol.for ('count')], \n      portion: query.options.limit\n    }\n  }\n```\n\nIn fact, this is the `db.model.createQuery` call, but with some additions:\n* the `limit` and `offset` options are overridden with `this.request.limit` and `this.request.offset` respectively;\n* the `order` list is replaced with the translated `this.request.sort`, if any (so the `order` passed in argument acts as a default value);\n* the 1st query table `filter` option is appended with the translated `this.request.search`.\n\n## More about search filters.\n\nThe base documentation on w2ui [types](https://w2ui.com/web/docs/2.0/w2grid.searches) and [operators](https://w2ui.com/web/docs/2.0/w2grid.operators) can be found at the developers' web site. In this section, only special `doix-w2ui` features are described.\n\n### Operators\n`doix-w2ui` supports three extra operators: \n\n|name|SQL operator|\n|-|-|\n|is not|\u003c\u003e|\n|less!|\u003c|\n|more!|\u003e|\n\nBoth standard `is` and local `is not` can be used with `value: null`, in which case they a mapped to `IS NULL` and `IS NOT NULL` respectively.\n\nSearch terms with `operator: 'between'` are replaced with 'more', 'less' or both, depending on values provided.\n\n### `date` type\nFor `type: 'date'`, string values are accepted in any numeric `DD ? MM ? YYYY` or `YYYY ? MM ? DD` format. They are all translated into ISO `YYYY-MM-DD` format.\n\nAny `\u003c=` comparison with a date (original `operator: 'less'`; right part of `'between'`) is replaced with the strict `\u003c` comparison with the next date. This makes sense for datetime values.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdo-%2Fnode-doix-w2ui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdo-%2Fnode-doix-w2ui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdo-%2Fnode-doix-w2ui/lists"}