@adonis-agora/filter 0.11.2 → 1.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @adonis-agora/filter
|
|
2
2
|
|
|
3
|
+
## 1.0.0-rc.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#139](https://github.com/DavideCarvalho/adonis-agora-filter/pull/139) [`0cdff5b`](https://github.com/DavideCarvalho/adonis-agora-filter/commit/0cdff5b7c587a729c9b64602ff20d19279673c28) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - First stable release.
|
|
8
|
+
|
|
9
|
+
**Breaking (`@adonis-agora/filter-client`): pages are 1-based.** `.page(n)` now numbers pages from `1`, the same as the server and Lucid's `paginate`. Before, `.page()` took a 0-based index, so `.page(0)` and `.page(1)` both returned the first page and every later page was off by one.
|
|
10
|
+
|
|
11
|
+
- Replace `.page(0, 25)` with `.page(1, 25)`, and `.page(i)` with `.page(i + 1)`.
|
|
12
|
+
- `.page()` throws a `RangeError` when `page` or `size` is below 1 or not an integer.
|
|
13
|
+
- `applyTanstackTableState` / `tanstackTableToFilterQuery` send TanStack's 0-based `pageIndex` as `pageIndex + 1`. If you added the `+ 1` yourself before calling them, remove it.
|
|
14
|
+
- New `tanstackPaginationFromMeta(meta)` (from `@adonis-agora/filter-client/tanstack`) maps a paginated response's `meta` back to TanStack state (`pageIndex = currentPage - 1`, plus `pageCount` and `rowCount`).
|
|
15
|
+
|
|
16
|
+
`@adonis-agora/filter` (the server) is unchanged: it was already 1-based.
|
|
17
|
+
|
|
18
|
+
- Supported runtime: Node.js 24 and later (`engines.node: ">=24"`), the same requirement 0.x declared.
|
|
19
|
+
- `node ace add @adonis-agora/filter` runs the configure hook from the package's main entry. The `@adonis-agora/filter/configure` subpath still works too.
|
|
20
|
+
|
|
21
|
+
## 0.11.3
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [#135](https://github.com/DavideCarvalho/adonis-agora-filter/pull/135) [`ed96cf0`](https://github.com/DavideCarvalho/adonis-agora-filter/commit/ed96cf067d8e4d0983cde35c1c59eab81f94bac8) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Fix `node ace add @adonis-agora/filter`: the package's main entry now exports the `configure` hook, so the provider and the commands barrel get registered in `adonisrc.ts`.
|
|
26
|
+
|
|
27
|
+
Fix `node ace make:filter`, which crashed with `SyntaxError: Unexpected identifier 'filterable'` while compiling its stub.
|
|
28
|
+
|
|
3
29
|
## 0.11.2
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export declare const VERSION = "0.
|
|
2
|
+
export declare const VERSION = "1.0.0-rc.0";
|
|
3
|
+
/**
|
|
4
|
+
* The hook `node ace add @adonis-agora/filter` runs: ace looks for `configure` on the package's
|
|
5
|
+
* main entry. It registers the provider and the commands barrel in `adonisrc.ts`.
|
|
6
|
+
*/
|
|
7
|
+
export { configure } from '../configure.js';
|
|
3
8
|
export type { LucidModelLike, LucidRelationLike } from './aggregate.js';
|
|
4
9
|
export { discoverAggregateSources } from './aggregate.js';
|
|
5
10
|
export type { AggregateFn, AggregatePath } from './aggregate_path.js';
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,eAAO,MAAM,OAAO,eAAe,CAAC;AAEpC;;;GAGG;AACH,OAAO,EAAE,SAAS,EAA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,cAAc,EACd,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,EACT,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACnG,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EACV,SAAS,EACT,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,QAAQ,EACR,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export const VERSION = '0.
|
|
2
|
+
export const VERSION = '1.0.0-rc.0';
|
|
3
|
+
/**
|
|
4
|
+
* The hook `node ace add @adonis-agora/filter` runs: ace looks for `configure` on the package's
|
|
5
|
+
* main entry. It registers the provider and the commands barrel in `adonisrc.ts`.
|
|
6
|
+
*/
|
|
7
|
+
export { configure } from '../configure.js';
|
|
3
8
|
export { discoverAggregateSources } from './aggregate.js';
|
|
4
9
|
export { parseAggregatePath } from './aggregate_path.js';
|
|
5
10
|
export { applyCursorFromRequest, applyFilterFromRequest } from './apply_from_request.js';
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC;AAEpC;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAMzD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EACL,eAAe,EACf,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAS3B,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AASnD,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,SAAS,EACT,qBAAqB,EAGrB,yBAAyB,GAG1B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAOjD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,EACT,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACnG,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAgBxD,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -18,9 +18,9 @@ export default class {{ filterName }} extends BaseModelFilter {
|
|
|
18
18
|
|
|
19
19
|
/** Columns clients may filter on with the standard operators — these need no method. */
|
|
20
20
|
static filterable = ['name']
|
|
21
|
-
/** Columns clients may sort on. Defaults to
|
|
21
|
+
/** Columns clients may sort on. Defaults to the filterable list. */
|
|
22
22
|
static sortable = ['createdAt']
|
|
23
|
-
/** Columns the free-text
|
|
23
|
+
/** Columns the free-text search term scans. */
|
|
24
24
|
static searchable = ['name']
|
|
25
25
|
|
|
26
26
|
static defaultSort = [{ field: 'createdAt', direction: 'desc' as const }]
|
|
@@ -36,10 +36,10 @@ export default class {{ filterName }} extends BaseModelFilter {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* One method per request key that needs SQL of its own.
|
|
39
|
+
* One method per request key that needs SQL of its own. ?filter[fullName]=silva lands here;
|
|
40
40
|
* writing the method IS what exposes the key, so it needs no allow-list entry.
|
|
41
41
|
*/
|
|
42
42
|
// fullName(value: string) {
|
|
43
|
-
// this.$query.whereILike('full_name',
|
|
43
|
+
// this.$query.whereILike('full_name', '%' + value + '%')
|
|
44
44
|
// }
|
|
45
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonis-agora/filter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-rc.0",
|
|
4
4
|
"description": "Server-side query filtering/sorting/pagination for AdonisJS — Spatie-style input, a Lucid adapter, and field allow-listing. Part of the Agora ecosystem.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
+
"@adonis-agora/filter-client": "1.0.0-rc.0",
|
|
80
81
|
"@adonisjs/assembler": "8.6.0",
|
|
81
82
|
"@adonisjs/core": "7.6.0",
|
|
82
83
|
"@adonisjs/lucid": "22.4.2",
|
|
@@ -87,7 +88,7 @@
|
|
|
87
88
|
"luxon": "3.7.2",
|
|
88
89
|
"pg": "8.23.1",
|
|
89
90
|
"typescript": "7.0.2",
|
|
90
|
-
"vitest": "5.0
|
|
91
|
+
"vitest": "5.1.0"
|
|
91
92
|
},
|
|
92
93
|
"engines": {
|
|
93
94
|
"node": ">=24"
|
|
@@ -18,9 +18,9 @@ export default class {{ filterName }} extends BaseModelFilter {
|
|
|
18
18
|
|
|
19
19
|
/** Columns clients may filter on with the standard operators — these need no method. */
|
|
20
20
|
static filterable = ['name']
|
|
21
|
-
/** Columns clients may sort on. Defaults to
|
|
21
|
+
/** Columns clients may sort on. Defaults to the filterable list. */
|
|
22
22
|
static sortable = ['createdAt']
|
|
23
|
-
/** Columns the free-text
|
|
23
|
+
/** Columns the free-text search term scans. */
|
|
24
24
|
static searchable = ['name']
|
|
25
25
|
|
|
26
26
|
static defaultSort = [{ field: 'createdAt', direction: 'desc' as const }]
|
|
@@ -36,10 +36,10 @@ export default class {{ filterName }} extends BaseModelFilter {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* One method per request key that needs SQL of its own.
|
|
39
|
+
* One method per request key that needs SQL of its own. ?filter[fullName]=silva lands here;
|
|
40
40
|
* writing the method IS what exposes the key, so it needs no allow-list entry.
|
|
41
41
|
*/
|
|
42
42
|
// fullName(value: string) {
|
|
43
|
-
// this.$query.whereILike('full_name',
|
|
43
|
+
// this.$query.whereILike('full_name', '%' + value + '%')
|
|
44
44
|
// }
|
|
45
45
|
}
|