@feathersjs/adapter-commons 5.0.39 → 6.0.0-pre.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 +85 -0
- package/LICENSE +1 -2
- package/README.md +1 -1
- package/lib/declarations.d.ts +1 -1
- package/lib/declarations.js +1 -2
- package/lib/index.d.ts +5 -5
- package/lib/index.js +7 -24
- package/lib/index.js.map +1 -1
- package/lib/query.d.ts +2 -2
- package/lib/query.js +12 -17
- package/lib/query.js.map +1 -1
- package/lib/service.d.ts +2 -2
- package/lib/service.js +5 -9
- package/lib/service.js.map +1 -1
- package/lib/sort.js +4 -10
- package/lib/sort.js.map +1 -1
- package/package.json +9 -9
- package/src/declarations.ts +1 -2
- package/src/index.ts +5 -6
- package/src/query.ts +2 -3
- package/src/service.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,91 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 6.0.0-pre.0 (2026-01-31)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- @feathersjs/adapter-commons: `update` id is non-nullable ([#1468](https://github.com/feathersjs/feathers/issues/1468)) ([43ec802](https://github.com/feathersjs/feathers/commit/43ec802974e65c992a4c6f5dd4da2c1ac306fcc5))
|
|
11
|
+
- @feathersjs/adapter-commons: remove data from `remove` arguments ([#1426](https://github.com/feathersjs/feathers/issues/1426)) ([fd54ae9](https://github.com/feathersjs/feathers/commit/fd54ae923da865931a4497aabdab4708946d4609))
|
|
12
|
+
- **adapter-commons:** Always respect paginate.max ([#2267](https://github.com/feathersjs/feathers/issues/2267)) ([f588257](https://github.com/feathersjs/feathers/commit/f5882575536624ed3a32bb6e3ff1919fa17e366d))
|
|
13
|
+
- **adapter-commons:** Clarify adapter query filtering ([#2607](https://github.com/feathersjs/feathers/issues/2607)) ([2dac771](https://github.com/feathersjs/feathers/commit/2dac771b0a3298d6dd25994d05186701b0617718))
|
|
14
|
+
- **adapter-commons:** clean up in sort.ts and select function ([#2492](https://github.com/feathersjs/feathers/issues/2492)) ([c3ec8a4](https://github.com/feathersjs/feathers/commit/c3ec8a418bdc85506e3c5100015720a45454d8d3))
|
|
15
|
+
- **adapter-commons:** Faster sorter ([#3495](https://github.com/feathersjs/feathers/issues/3495)) ([22243e4](https://github.com/feathersjs/feathers/commit/22243e4d92edc1a7343b4cf42be6dfb22e8b86d5))
|
|
16
|
+
- **adapter-commons:** Filter arrays in queries ([#1724](https://github.com/feathersjs/feathers/issues/1724)) ([872b669](https://github.com/feathersjs/feathers/commit/872b66906a806ab92ca41b5f6f504ff0af1ce79e))
|
|
17
|
+
- **adapter-commons:** Fix sorting for embedded objects ([#2488](https://github.com/feathersjs/feathers/issues/2488)) ([9c22f70](https://github.com/feathersjs/feathers/commit/9c22f70a838cb6341775d91705a7527c8fc5590e))
|
|
18
|
+
- **adapter-commons:** Keep Symbols when filtering a query ([#1141](https://github.com/feathersjs/feathers/issues/1141)) ([c9f55d8](https://github.com/feathersjs/feathers/commit/c9f55d8043e4a1614e37d9d9e73b7ef0c44fc38e))
|
|
19
|
+
- **adapter-commons:** multiple type definition issues ([#2876](https://github.com/feathersjs/feathers/issues/2876)) ([4ff1ed0](https://github.com/feathersjs/feathers/commit/4ff1ed084eb2b2cb687de27a28c96a0dad4530b7))
|
|
20
|
+
- **adapter-commons:** Return missing overloads ([#2203](https://github.com/feathersjs/feathers/issues/2203)) ([bbe7e2a](https://github.com/feathersjs/feathers/commit/bbe7e2a131633e9a6e7aac7f7fa02a312bca63c7))
|
|
21
|
+
- Add whitelist and filter support to common adapter service ([#1132](https://github.com/feathersjs/feathers/issues/1132)) ([df1daaa](https://github.com/feathersjs/feathers/commit/df1daaadd682f14d968584bac32913ab452c3fae))
|
|
22
|
+
- Check query for NaN ([#1607](https://github.com/feathersjs/feathers/issues/1607)) ([f1a781f](https://github.com/feathersjs/feathers/commit/f1a781f82a920b26423e6a22ad820abda51212f7))
|
|
23
|
+
- **chore:** Add .npmignore to adapter-commons ([8e129d8](https://github.com/feathersjs/feathers/commit/8e129d8d9e7c3131c4c89ffff605eccbab2cc41e))
|
|
24
|
+
- **cli:** Improve generated application and client ([#2701](https://github.com/feathersjs/feathers/issues/2701)) ([bd55ffb](https://github.com/feathersjs/feathers/commit/bd55ffb812e89bf215f4515e7f137656ea888c3f))
|
|
25
|
+
- **core:** Add PaginationParams to general find method ([#3095](https://github.com/feathersjs/feathers/issues/3095)) ([8ebdcf5](https://github.com/feathersjs/feathers/commit/8ebdcf5107fae5fa23920390052b871033de3a0a))
|
|
26
|
+
- **core:** Update to latest feathersjs/hooks ([#3434](https://github.com/feathersjs/feathers/issues/3434)) ([1499ccc](https://github.com/feathersjs/feathers/commit/1499ccc41fb3ebba97b2c84e0cb19bc48ad3c651))
|
|
27
|
+
- **core:** Use Symbol.for to instantiate shared symbols ([#3087](https://github.com/feathersjs/feathers/issues/3087)) ([7f3fc21](https://github.com/feathersjs/feathers/commit/7f3fc2167576f228f8183568eb52b077160e8d65))
|
|
28
|
+
- **databases:** Ensure that query sanitization is not necessary when using query schemas ([#3022](https://github.com/feathersjs/feathers/issues/3022)) ([dbf514e](https://github.com/feathersjs/feathers/commit/dbf514e85d1508b95c007462a39b3cadd4ff391d))
|
|
29
|
+
- **dependencies:** Fix transport-commons dependency and update other dependencies ([#2284](https://github.com/feathersjs/feathers/issues/2284)) ([05b03b2](https://github.com/feathersjs/feathers/commit/05b03b27b40604d956047e3021d8053c3a137616))
|
|
30
|
+
- **dependencies:** Lock monorepo package version numbers ([#2623](https://github.com/feathersjs/feathers/issues/2623)) ([5640c10](https://github.com/feathersjs/feathers/commit/5640c1020cc139994e695d658c08bad3494db507))
|
|
31
|
+
- **dependencies:** Update all dependencies ([#3139](https://github.com/feathersjs/feathers/issues/3139)) ([f24276e](https://github.com/feathersjs/feathers/commit/f24276e9a909e2e58a0730c730258ce1f70f4028))
|
|
32
|
+
- **dependencies:** Update all dependencies ([#3545](https://github.com/feathersjs/feathers/issues/3545)) ([221b92b](https://github.com/feathersjs/feathers/commit/221b92bb0ee5d54fb1036742968797cb02e56da2))
|
|
33
|
+
- **dependencies:** Update all dependencies ([#3625](https://github.com/feathersjs/feathers/issues/3625)) ([2698e4e](https://github.com/feathersjs/feathers/commit/2698e4e2996fbf479d82435938d907bc3d5b583a))
|
|
34
|
+
- **dependencies:** Update dependencies ([#3571](https://github.com/feathersjs/feathers/issues/3571)) ([ad611cb](https://github.com/feathersjs/feathers/commit/ad611cb6ffb1dc31d603ba5817331318c5a23217))
|
|
35
|
+
- Fix AdapterService multi option when set to true ([#1134](https://github.com/feathersjs/feathers/issues/1134)) ([40402fc](https://github.com/feathersjs/feathers/commit/40402fc1bbda01f4209852eb6942515406a35d98))
|
|
36
|
+
- improve Service and AdapterService types ([#1567](https://github.com/feathersjs/feathers/issues/1567)) ([baad6a2](https://github.com/feathersjs/feathers/commit/baad6a26f0f543b712ccb40359b3933ad3a21392))
|
|
37
|
+
- **knex:** Update all dependencies and Knex peer ([#3308](https://github.com/feathersjs/feathers/issues/3308)) ([d2f9860](https://github.com/feathersjs/feathers/commit/d2f986036c4741cce2339d8abbcc6b2eb037a12a))
|
|
38
|
+
- Make sure all Readme files are up to date ([#3154](https://github.com/feathersjs/feathers/issues/3154)) ([a5f0b38](https://github.com/feathersjs/feathers/commit/a5f0b38bbf2a11486415a39533bcc6c67fb51e3e))
|
|
39
|
+
- Remove adapter commons type alternatives ([#1620](https://github.com/feathersjs/feathers/issues/1620)) ([c9f3086](https://github.com/feathersjs/feathers/commit/c9f3086344420b57dbce7c4169cf550c97509f0d))
|
|
40
|
+
- Throw error in `filterQuery` when query parameter is unknown ([#1131](https://github.com/feathersjs/feathers/issues/1131)) ([cd1a183](https://github.com/feathersjs/feathers/commit/cd1a183ca4c05d571b52a7b6c5ecac909d9e58b9))
|
|
41
|
+
- **typescript:** Add type keys to service pagination options. ([#1888](https://github.com/feathersjs/feathers/issues/1888)) ([859c601](https://github.com/feathersjs/feathers/commit/859c601519c7cb399e8b1667bb50073466812d5c))
|
|
42
|
+
- **typescript:** Improve TypeScript backwards compatibility ([#2310](https://github.com/feathersjs/feathers/issues/2310)) ([f33be73](https://github.com/feathersjs/feathers/commit/f33be73fc46a533efb15df9aab0658e3240d3897))
|
|
43
|
+
- **typescript:** Move Paginated type back for better compatibility ([#2350](https://github.com/feathersjs/feathers/issues/2350)) ([2917d05](https://github.com/feathersjs/feathers/commit/2917d05fffb4716d3c4cdaa5ac6a1aee0972e8a6))
|
|
44
|
+
- **typescript:** Overall typing improvements ([#2478](https://github.com/feathersjs/feathers/issues/2478)) ([b8eb804](https://github.com/feathersjs/feathers/commit/b8eb804158556d9651a8607e3c3fda15e0bfd110))
|
|
45
|
+
- Update adapter common tests ([#1135](https://github.com/feathersjs/feathers/issues/1135)) ([8166dda](https://github.com/feathersjs/feathers/commit/8166ddad144350f224d0fd9fc66084d28706326c))
|
|
46
|
+
- Update adapter common tests to check for falsy ([#1140](https://github.com/feathersjs/feathers/issues/1140)) ([2856722](https://github.com/feathersjs/feathers/commit/2856722dd338937c9a028c237084fbf1298f05b3))
|
|
47
|
+
- Update all dependencies ([7d53a00](https://github.com/feathersjs/feathers/commit/7d53a00776f7301d9349e6d652656ee80b1cb556))
|
|
48
|
+
- Update all dependencies ([#3613](https://github.com/feathersjs/feathers/issues/3613)) ([5136bbd](https://github.com/feathersjs/feathers/commit/5136bbd2e2eeb4e6579e07c9e914006629542363))
|
|
49
|
+
- Update all dependencies to latest ([#1206](https://github.com/feathersjs/feathers/issues/1206)) ([e51e0f6](https://github.com/feathersjs/feathers/commit/e51e0f62d0f338fb59bd0d39952d99c2904a0c3f))
|
|
50
|
+
- Update database adapter common repository urls ([#2380](https://github.com/feathersjs/feathers/issues/2380)) ([3f4db68](https://github.com/feathersjs/feathers/commit/3f4db68d6700c7d9023ecd17d0d39893f75a19fd))
|
|
51
|
+
- Update dependencies ([#3584](https://github.com/feathersjs/feathers/issues/3584)) ([119fa4e](https://github.com/feathersjs/feathers/commit/119fa4e1ade8b0078aa235083d566e2538b3a084))
|
|
52
|
+
- Update dependencies and fix tests ([#1373](https://github.com/feathersjs/feathers/issues/1373)) ([d743a7f](https://github.com/feathersjs/feathers/commit/d743a7ff7b0f9f94aa6fa8e29d0c816469c9b8ab))
|
|
53
|
+
- Update Grant usage and other dependencies ([#2264](https://github.com/feathersjs/feathers/issues/2264)) ([7b0f8fa](https://github.com/feathersjs/feathers/commit/7b0f8fad252419ed0ad0bf259cdf3104d322ab60))
|
|
54
|
+
|
|
55
|
+
### chore
|
|
56
|
+
|
|
57
|
+
- **package:** Move adapter tests into their own module ([#1164](https://github.com/feathersjs/feathers/issues/1164)) ([dcc1e6b](https://github.com/feathersjs/feathers/commit/dcc1e6b43d0cdc6d8843dc8242837a6c3e11948f))
|
|
58
|
+
|
|
59
|
+
### Features
|
|
60
|
+
|
|
61
|
+
- adapter-commons: add `allowsMulti(method)` to AdapterService ([#1431](https://github.com/feathersjs/feathers/issues/1431)) ([e688851](https://github.com/feathersjs/feathers/commit/e6888518687d36689cf3adca362c1fcdf49d2005))
|
|
62
|
+
- **adapter-commons:** Add support for params.adapter option and move memory adapter to @feathersjs/memory ([#2367](https://github.com/feathersjs/feathers/issues/2367)) ([a43e7da](https://github.com/feathersjs/feathers/commit/a43e7da22b6b981a96d1321736ea9a0cb924fb4f))
|
|
63
|
+
- **adapter-commons:** Added mongoDB like search in embedded objects ([687e3c7](https://github.com/feathersjs/feathers/commit/687e3c7c36904221b2707d0220c0893e3cb1faa9))
|
|
64
|
+
- **adapter:** Add patch data type to adapters and refactor AdapterBase usage ([#2906](https://github.com/feathersjs/feathers/issues/2906)) ([9ddc2e6](https://github.com/feathersjs/feathers/commit/9ddc2e6b028f026f939d6af68125847e5c6734b4))
|
|
65
|
+
- Add hook-less methods and service option types to adapter-commons ([#1433](https://github.com/feathersjs/feathers/issues/1433)) ([857f54a](https://github.com/feathersjs/feathers/commit/857f54a312406897651566ae41008c6b006042ae))
|
|
66
|
+
- Add TypeScript definitions ([#1275](https://github.com/feathersjs/feathers/issues/1275)) ([9dd6713](https://github.com/feathersjs/feathers/commit/9dd671301ae0463968ade0f6eb0c82356adcc89d))
|
|
67
|
+
- Authentication v3 core server implementation ([#1205](https://github.com/feathersjs/feathers/issues/1205)) ([1bd7591](https://github.com/feathersjs/feathers/commit/1bd7591548da58c1c0facb2a733ce32524743ff3))
|
|
68
|
+
- Common database adapter utilities and test suite ([#1130](https://github.com/feathersjs/feathers/issues/1130)) ([17b3dc8](https://github.com/feathersjs/feathers/commit/17b3dc826fe162a07c4378838f37bc91620ab3f9))
|
|
69
|
+
- **core:** Add app.teardown functionality ([#2570](https://github.com/feathersjs/feathers/issues/2570)) ([fcdf524](https://github.com/feathersjs/feathers/commit/fcdf524ae1995bb59265d39f12e98b7794bed023))
|
|
70
|
+
- **core:** Allow to unregister services at runtime ([#2756](https://github.com/feathersjs/feathers/issues/2756)) ([d16601f](https://github.com/feathersjs/feathers/commit/d16601f2277dca5357866ffdefba2a611f6dc7fa))
|
|
71
|
+
- **core:** Finalize app.teardown() functionality ([#2584](https://github.com/feathersjs/feathers/issues/2584)) ([1a166f3](https://github.com/feathersjs/feathers/commit/1a166f3ded811ecacf0ae8cb67880bc9fa2eeafa))
|
|
72
|
+
- **database:** Add and to the query syntax ([#3021](https://github.com/feathersjs/feathers/issues/3021)) ([00cb0d9](https://github.com/feathersjs/feathers/commit/00cb0d9c302ae951ae007d3d6ceba33e254edd9c))
|
|
73
|
+
- ES module v5 compatibility layer for v6 ([#3607](https://github.com/feathersjs/feathers/issues/3607)) ([1dfff88](https://github.com/feathersjs/feathers/commit/1dfff8832eedca895eeaafd7f3acf0f8a27be23c))
|
|
74
|
+
- Feathers v5 core refactoring and features ([#2255](https://github.com/feathersjs/feathers/issues/2255)) ([2dafb7c](https://github.com/feathersjs/feathers/commit/2dafb7ce14ba57406aeec13d10ca45b1e709bee9))
|
|
75
|
+
- **generators:** Move core code generators to shared generators package ([#2982](https://github.com/feathersjs/feathers/issues/2982)) ([0328d22](https://github.com/feathersjs/feathers/commit/0328d2292153870bc43958f73d2c6f288a8cec17))
|
|
76
|
+
- **knex:** Add KnexJS SQL database adapter to core ([#2671](https://github.com/feathersjs/feathers/issues/2671)) ([9380fff](https://github.com/feathersjs/feathers/commit/9380fff58596e8bb90b8bb098d2795b7eadfec20))
|
|
77
|
+
- **memory:** Move feathers-memory into @feathersjs/adapter-memory ([#2153](https://github.com/feathersjs/feathers/issues/2153)) ([dd61fe3](https://github.com/feathersjs/feathers/commit/dd61fe371fb0502f78b8ccbe1f45a030e31ecff6))
|
|
78
|
+
- **mongodb:** Add feathers-mongodb adapter as @feathersjs/mongodb ([#2610](https://github.com/feathersjs/feathers/issues/2610)) ([6d43734](https://github.com/feathersjs/feathers/commit/6d43734a53db02c435cafc52a22dca414e5d0940))
|
|
79
|
+
- **mongodb:** Add Object ID keyword converter and update MongoDB CLI & docs ([#3041](https://github.com/feathersjs/feathers/issues/3041)) ([ca0994e](https://github.com/feathersjs/feathers/commit/ca0994eaecb5a31f310bc980d106834e11f24f41))
|
|
80
|
+
- **typescript:** Allow to pass generic service options to adapter services ([#2392](https://github.com/feathersjs/feathers/issues/2392)) ([f9431f2](https://github.com/feathersjs/feathers/commit/f9431f242354f804cafb835519f98dd405ac4f0b))
|
|
81
|
+
- **typescript:** Improve adapter typings ([#2605](https://github.com/feathersjs/feathers/issues/2605)) ([3b2ca0a](https://github.com/feathersjs/feathers/commit/3b2ca0a6a8e03e8390272c4d7e930b4bffdaacf5))
|
|
82
|
+
- **typescript:** Improve params and query typeability ([#2600](https://github.com/feathersjs/feathers/issues/2600)) ([df28b76](https://github.com/feathersjs/feathers/commit/df28b7619161f1df5e700326f52cca1a92dc5d28))
|
|
83
|
+
|
|
84
|
+
### BREAKING CHANGES
|
|
85
|
+
|
|
86
|
+
- All packages are now ES modules only
|
|
87
|
+
- **adapter-commons:** Changes the common adapter base class to use `sanitizeQuery` and `sanitizeData`
|
|
88
|
+
- **package:** Removes adapter tests from @feathersjs/adapter-commons
|
|
89
|
+
- Move database adapter utilities from @feathersjs/commons into its own module
|
|
90
|
+
|
|
6
91
|
## [5.0.39](https://github.com/feathersjs/feathers/compare/v5.0.38...v5.0.39) (2026-01-31)
|
|
7
92
|
|
|
8
93
|
**Note:** Version bump only for package @feathersjs/adapter-commons
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 Feathers Contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
22
|
-
|
package/README.md
CHANGED
|
@@ -22,6 +22,6 @@ Refer to the [Feathers database adapter documentation](https://feathersjs.com/ap
|
|
|
22
22
|
|
|
23
23
|
## License
|
|
24
24
|
|
|
25
|
-
Copyright (c)
|
|
25
|
+
Copyright (c) 2025 [Feathers contributors](https://github.com/feathersjs/feathers/graphs/contributors)
|
|
26
26
|
|
|
27
27
|
Licensed under the [MIT license](LICENSE).
|
package/lib/declarations.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Query, Params, Paginated, Id, PaginationParams, PaginationOptions } from '@feathersjs/feathers';
|
|
1
|
+
import type { Query, Params, Paginated, Id, PaginationParams, PaginationOptions } from '@feathersjs/feathers';
|
|
2
2
|
export type FilterQueryOptions = {
|
|
3
3
|
filters?: FilterSettings;
|
|
4
4
|
operators?: string[];
|
package/lib/declarations.js
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Params } from '@feathersjs/feathers';
|
|
2
|
-
export * from './declarations';
|
|
3
|
-
export * from './service';
|
|
4
|
-
export * from './query';
|
|
5
|
-
export * from './sort';
|
|
1
|
+
import type { Params } from '@feathersjs/feathers';
|
|
2
|
+
export * from './declarations.js';
|
|
3
|
+
export * from './service.js';
|
|
4
|
+
export * from './query.js';
|
|
5
|
+
export * from './sort.js';
|
|
6
6
|
export declare function select(params: Params, ...otherFields: string[]): (result: any) => any;
|
package/lib/index.js
CHANGED
|
@@ -1,36 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.select = select;
|
|
18
|
-
const commons_1 = require("@feathersjs/commons");
|
|
19
|
-
__exportStar(require("./declarations"), exports);
|
|
20
|
-
__exportStar(require("./service"), exports);
|
|
21
|
-
__exportStar(require("./query"), exports);
|
|
22
|
-
__exportStar(require("./sort"), exports);
|
|
1
|
+
import { _ } from '@feathersjs/commons';
|
|
2
|
+
export * from './declarations.js';
|
|
3
|
+
export * from './service.js';
|
|
4
|
+
export * from './query.js';
|
|
5
|
+
export * from './sort.js';
|
|
23
6
|
// Return a function that filters a result object or array
|
|
24
7
|
// and picks only the fields passed as `params.query.$select`
|
|
25
8
|
// and additional `otherFields`
|
|
26
|
-
function select(params, ...otherFields) {
|
|
9
|
+
export function select(params, ...otherFields) {
|
|
27
10
|
var _a;
|
|
28
11
|
const queryFields = (_a = params === null || params === void 0 ? void 0 : params.query) === null || _a === void 0 ? void 0 : _a.$select;
|
|
29
12
|
if (!queryFields) {
|
|
30
13
|
return (result) => result;
|
|
31
14
|
}
|
|
32
15
|
const resultFields = queryFields.concat(otherFields);
|
|
33
|
-
const convert = (result) =>
|
|
16
|
+
const convert = (result) => _.pick(result, ...resultFields);
|
|
34
17
|
return (result) => {
|
|
35
18
|
if (Array.isArray(result)) {
|
|
36
19
|
return result.map(convert);
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AAEvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AAEzB,0DAA0D;AAC1D,6DAA6D;AAC7D,+BAA+B;AAC/B,MAAM,UAAU,MAAM,CAAC,MAAc,EAAE,GAAG,WAAqB;;IAC7D,MAAM,WAAW,GAAyB,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,0CAAE,OAAO,CAAA;IAEhE,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,CAAC,MAAW,EAAE,EAAE,CAAC,MAAM,CAAA;IAChC,CAAC;IAED,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;IACpD,MAAM,OAAO,GAAG,CAAC,MAAW,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,YAAY,CAAC,CAAA;IAEhE,OAAO,CAAC,MAAW,EAAE,EAAE;QACrB,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAC5B,CAAC;QAED,OAAO,OAAO,CAAC,MAAM,CAAC,CAAA;IACxB,CAAC,CAAA;AACH,CAAC"}
|
package/lib/query.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Query } from '@feathersjs/feathers';
|
|
2
|
-
import { FilterQueryOptions, FilterSettings, PaginationParams } from './declarations';
|
|
1
|
+
import type { Query } from '@feathersjs/feathers';
|
|
2
|
+
import type { FilterQueryOptions, FilterSettings, PaginationParams } from './declarations.js';
|
|
3
3
|
/**
|
|
4
4
|
* Returns the converted `$limit` value based on the `paginate` configuration.
|
|
5
5
|
* @param _limit The limit value
|
package/lib/query.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.FILTERS = exports.OPERATORS = exports.getLimit = void 0;
|
|
4
|
-
exports.filterQuery = filterQuery;
|
|
5
|
-
const commons_1 = require("@feathersjs/commons");
|
|
6
|
-
const errors_1 = require("@feathersjs/errors");
|
|
1
|
+
import { _ } from '@feathersjs/commons';
|
|
2
|
+
import { BadRequest } from '@feathersjs/errors';
|
|
7
3
|
const parse = (value) => (typeof value !== 'undefined' ? parseInt(value, 10) : value);
|
|
8
|
-
const isPlainObject = (value) =>
|
|
4
|
+
const isPlainObject = (value) => _.isObject(value) && value.constructor === {}.constructor;
|
|
9
5
|
const validateQueryProperty = (query, operators = []) => {
|
|
10
6
|
if (!isPlainObject(query)) {
|
|
11
7
|
return query;
|
|
12
8
|
}
|
|
13
9
|
for (const key of Object.keys(query)) {
|
|
14
10
|
if (key.startsWith('$') && !operators.includes(key)) {
|
|
15
|
-
throw new
|
|
11
|
+
throw new BadRequest(`Invalid query parameter ${key}`, query);
|
|
16
12
|
}
|
|
17
13
|
const value = query[key];
|
|
18
14
|
if (isPlainObject(value)) {
|
|
@@ -42,7 +38,7 @@ const getQuery = (query, settings) => {
|
|
|
42
38
|
return keys.reduce((result, key) => {
|
|
43
39
|
if (typeof key === 'string' && key.startsWith('$')) {
|
|
44
40
|
if (settings.filters[key] === undefined) {
|
|
45
|
-
throw new
|
|
41
|
+
throw new BadRequest(`Invalid filter value ${key}`);
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
44
|
else {
|
|
@@ -57,7 +53,7 @@ const getQuery = (query, settings) => {
|
|
|
57
53
|
* @param paginate The pagination options
|
|
58
54
|
* @returns The converted $limit value
|
|
59
55
|
*/
|
|
60
|
-
const getLimit = (_limit, paginate) => {
|
|
56
|
+
export const getLimit = (_limit, paginate) => {
|
|
61
57
|
const limit = parse(_limit);
|
|
62
58
|
if (paginate && (paginate.default || paginate.max)) {
|
|
63
59
|
const base = paginate.default || 0;
|
|
@@ -67,9 +63,8 @@ const getLimit = (_limit, paginate) => {
|
|
|
67
63
|
}
|
|
68
64
|
return limit;
|
|
69
65
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
exports.FILTERS = {
|
|
66
|
+
export const OPERATORS = ['$in', '$nin', '$lt', '$lte', '$gt', '$gte', '$ne', '$or'];
|
|
67
|
+
export const FILTERS = {
|
|
73
68
|
$skip: (value) => parse(value),
|
|
74
69
|
$sort: (sort) => {
|
|
75
70
|
if (typeof sort !== 'object' || Array.isArray(sort)) {
|
|
@@ -80,7 +75,7 @@ exports.FILTERS = {
|
|
|
80
75
|
return result;
|
|
81
76
|
}, {});
|
|
82
77
|
},
|
|
83
|
-
$limit: (_limit, { paginate }) =>
|
|
78
|
+
$limit: (_limit, { paginate }) => getLimit(_limit, paginate),
|
|
84
79
|
$select: (select) => {
|
|
85
80
|
if (Array.isArray(select)) {
|
|
86
81
|
return select.map((current) => `${current}`);
|
|
@@ -111,15 +106,15 @@ exports.FILTERS = {
|
|
|
111
106
|
* @returns An object with `query` which contains the query without `filters`
|
|
112
107
|
* and `filters` which contains the converted values for each filter.
|
|
113
108
|
*/
|
|
114
|
-
function filterQuery(_query, options = {}) {
|
|
109
|
+
export function filterQuery(_query, options = {}) {
|
|
115
110
|
const query = _query || {};
|
|
116
111
|
const settings = {
|
|
117
112
|
...options,
|
|
118
113
|
filters: {
|
|
119
|
-
...
|
|
114
|
+
...FILTERS,
|
|
120
115
|
...options.filters
|
|
121
116
|
},
|
|
122
|
-
operators:
|
|
117
|
+
operators: OPERATORS.concat(options.operators || [])
|
|
123
118
|
};
|
|
124
119
|
return {
|
|
125
120
|
filters: getFilters(query, settings),
|
package/lib/query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,qBAAqB,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAG/C,MAAM,KAAK,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AAE1F,MAAM,aAAa,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,WAAW,KAAK,EAAE,CAAC,WAAW,CAAA;AAE/F,MAAM,qBAAqB,GAAG,CAAC,KAAU,EAAE,YAAsB,EAAE,EAAS,EAAE;IAC5E,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAA;IACd,CAA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@@
|
|
|
1
|
-
import { Id, Paginated, Query } from '@feathersjs/feathers';
|
|
2
|
-
import { AdapterParams, AdapterServiceOptions, InternalServiceMethods, PaginationOptions } from './declarations';
|
|
1
|
+
import type { Id, Paginated, Query } from '@feathersjs/feathers';
|
|
2
|
+
import type { AdapterParams, AdapterServiceOptions, InternalServiceMethods, PaginationOptions } from './declarations.js';
|
|
3
3
|
export declare const VALIDATED: unique symbol;
|
|
4
4
|
/**
|
|
5
5
|
* An abstract base class that a database adapter can extend from to implement the
|
package/lib/service.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.AdapterBase = exports.VALIDATED = void 0;
|
|
4
|
-
const query_1 = require("./query");
|
|
5
|
-
exports.VALIDATED = Symbol.for('@feathersjs/adapter/sanitized');
|
|
1
|
+
import { filterQuery } from './query.js';
|
|
2
|
+
export const VALIDATED = Symbol.for('@feathersjs/adapter/sanitized');
|
|
6
3
|
const alwaysMulti = {
|
|
7
4
|
find: true,
|
|
8
5
|
get: false,
|
|
@@ -12,7 +9,7 @@ const alwaysMulti = {
|
|
|
12
9
|
* An abstract base class that a database adapter can extend from to implement the
|
|
13
10
|
* `__find`, `__get`, `__update`, `__patch` and `__remove` methods.
|
|
14
11
|
*/
|
|
15
|
-
class AdapterBase {
|
|
12
|
+
export class AdapterBase {
|
|
16
13
|
constructor(options) {
|
|
17
14
|
this.options = {
|
|
18
15
|
id: 'id',
|
|
@@ -73,16 +70,15 @@ class AdapterBase {
|
|
|
73
70
|
*/
|
|
74
71
|
async sanitizeQuery(params = {}) {
|
|
75
72
|
// We don't need legacy query sanitisation if the query has been validated by a schema already
|
|
76
|
-
if (params.query && params.query[
|
|
73
|
+
if (params.query && params.query[VALIDATED]) {
|
|
77
74
|
return params.query || {};
|
|
78
75
|
}
|
|
79
76
|
const options = this.getOptions(params);
|
|
80
|
-
const { query, filters } =
|
|
77
|
+
const { query, filters } = filterQuery(params.query, options);
|
|
81
78
|
return {
|
|
82
79
|
...filters,
|
|
83
80
|
...query
|
|
84
81
|
};
|
|
85
82
|
}
|
|
86
83
|
}
|
|
87
|
-
exports.AdapterBase = AdapterBase;
|
|
88
84
|
//# sourceMappingURL=service.js.map
|
package/lib/service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;AAEpE,MAAM,WAAW,GAA+B;IAC9C,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,KAAK;CACd,CAAA;AAED;;;GAGG;AACH,MAAM,OAAgB,WAAW;IAU/B,YAAY,OAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG;YACb,EAAE,EAAE,IAAI;YACR,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,KAAK;YACZ,OAAO,EAAE,EAAE;YACX,SAAS,EAAE,EAAE;YACb,GAAG,OAAO;SACX,CAAA;IACH,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;IACxB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAA;IAC5B,CAAC;IAED;;;;;OAKG;IACH,WAAW,CAAC,MAAc,EAAE,SAAwB,EAAmB;QACrE,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;QAElC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,OAAO,MAAM,CAAA;QACf,CAAC;QAED,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QAEzC,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC7B,OAAO,KAAK,CAAA;QACd,CAAC;QAED,OAAO,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC/B,CAAC;IAED;;;;;;OAMG;IACH,UAAU,CAAC,MAAqB;QAC9B,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAA;QAExF,OAAO;YACL,GAAG,IAAI,CAAC,OAAO;YACf,QAAQ;YACR,GAAG,MAAM,CAAC,OAAO;SAClB,CAAA;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,aAAa,CAAC,SAAwB,EAAmB;QAC7D,8FAA8F;QAC9F,IAAI,MAAM,CAAC,KAAK,IAAK,MAAM,CAAC,KAAa,CAAC,SAAS,CAAC,EAAE,CAAC;YACrD,OAAO,MAAM,CAAC,KAAK,IAAI,EAAE,CAAA;QAC3B,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QACvC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAE7D,OAAO;YACL,GAAG,OAAO;YACV,GAAG,KAAK;SACT,CAAA;IACH,CAAC;CA0EF"}
|
package/lib/sort.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Sorting algorithm taken from NeDB (https://github.com/louischatriot/nedb)
|
|
3
2
|
// See https://github.com/louischatriot/nedb/blob/e3f0078499aa1005a59d0c2372e425ab789145c1/lib/model.js#L189
|
|
4
|
-
|
|
5
|
-
exports.compareNSB = compareNSB;
|
|
6
|
-
exports.compareArrays = compareArrays;
|
|
7
|
-
exports.compare = compare;
|
|
8
|
-
exports.sorter = sorter;
|
|
9
|
-
function compareNSB(a, b) {
|
|
3
|
+
export function compareNSB(a, b) {
|
|
10
4
|
if (a === b) {
|
|
11
5
|
return 0;
|
|
12
6
|
}
|
|
13
7
|
return a < b ? -1 : 1;
|
|
14
8
|
}
|
|
15
|
-
function compareArrays(a, b) {
|
|
9
|
+
export function compareArrays(a, b) {
|
|
16
10
|
for (let i = 0, l = Math.min(a.length, b.length); i < l; i++) {
|
|
17
11
|
const comparison = compare(a[i], b[i]);
|
|
18
12
|
if (comparison !== 0) {
|
|
@@ -22,7 +16,7 @@ function compareArrays(a, b) {
|
|
|
22
16
|
// Common section was identical, longest one wins
|
|
23
17
|
return compareNSB(a.length, b.length);
|
|
24
18
|
}
|
|
25
|
-
function compare(a, b, compareStrings = compareNSB) {
|
|
19
|
+
export function compare(a, b, compareStrings = compareNSB) {
|
|
26
20
|
if (a === b) {
|
|
27
21
|
return 0;
|
|
28
22
|
}
|
|
@@ -86,7 +80,7 @@ function compare(a, b, compareStrings = compareNSB) {
|
|
|
86
80
|
const get = (value, path) => path.reduce((value, key) => value[key], value);
|
|
87
81
|
// An in-memory sorting function according to the
|
|
88
82
|
// $sort special query parameter
|
|
89
|
-
function sorter($sort) {
|
|
83
|
+
export function sorter($sort) {
|
|
90
84
|
const compares = Object.keys($sort).map((key) => {
|
|
91
85
|
const direction = $sort[key];
|
|
92
86
|
if (!key.includes('.')) {
|
package/lib/sort.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort.js","sourceRoot":"","sources":["../src/sort.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sort.js","sourceRoot":"","sources":["../src/sort.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,4GAA4G;AAE5G,MAAM,UAAU,UAAU,CAAC,CAA4B,EAAE,CAA4B;IACnF,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACZ,OAAO,C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AG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;QAChE,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC3B,OAAO,CAAC,CAAM,EAAE,CAAM,EAAE,EAAE,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;QAC5E,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAM,EAAE,CAAM;QAC7B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;YAEhC,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;gBACrB,OAAO,UAAU,CAAA;YACnB,CAAC;QACH,CAAC;QAED,OAAO,CAAC,CAAA;IACV,CAAC,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathersjs/adapter-commons",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-pre.0",
|
|
4
4
|
"description": "Shared database adapter utility functions",
|
|
5
5
|
"homepage": "https://feathersjs.com",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"feathers"
|
|
8
8
|
],
|
|
9
9
|
"license": "MIT",
|
|
10
|
+
"type": "module",
|
|
10
11
|
"funding": {
|
|
11
12
|
"type": "opencollective",
|
|
12
13
|
"url": "https://opencollective.com/feathers"
|
|
@@ -26,10 +27,9 @@
|
|
|
26
27
|
"url": "https://github.com/feathersjs/feathers/issues"
|
|
27
28
|
},
|
|
28
29
|
"engines": {
|
|
29
|
-
"node": ">=
|
|
30
|
+
"node": ">= 20"
|
|
30
31
|
},
|
|
31
|
-
"main": "lib/",
|
|
32
|
-
"types": "lib/",
|
|
32
|
+
"main": "lib/index.js",
|
|
33
33
|
"scripts": {
|
|
34
34
|
"prepublish": "npm run compile",
|
|
35
35
|
"pack": "npm pack --pack-destination ../generators/test/build",
|
|
@@ -50,19 +50,19 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@feathersjs/commons": "^
|
|
54
|
-
"@feathersjs/errors": "^
|
|
55
|
-
"@feathersjs/feathers": "^
|
|
53
|
+
"@feathersjs/commons": "^6.0.0-pre.0",
|
|
54
|
+
"@feathersjs/errors": "^6.0.0-pre.0",
|
|
55
|
+
"@feathersjs/feathers": "^6.0.0-pre.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/mocha": "^10.0.10",
|
|
59
59
|
"@types/mongodb": "^4.0.6",
|
|
60
60
|
"@types/node": "^25.1.0",
|
|
61
61
|
"mocha": "^11.7.5",
|
|
62
|
-
"mongodb": "^
|
|
62
|
+
"mongodb": "^7.0.0",
|
|
63
63
|
"shx": "^0.4.0",
|
|
64
64
|
"ts-node": "^10.9.2",
|
|
65
65
|
"typescript": "^5.9.3"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "8fad4bb3d393794fb98fa5fe7cfc327661fedbd2"
|
|
68
68
|
}
|
package/src/declarations.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Query, Params, Paginated, Id, PaginationParams, PaginationOptions } from '@feathersjs/feathers'
|
|
2
|
-
|
|
1
|
+
import type { Query, Params, Paginated, Id, PaginationParams, PaginationOptions } from '@feathersjs/feathers'
|
|
3
2
|
export type FilterQueryOptions = {
|
|
4
3
|
filters?: FilterSettings
|
|
5
4
|
operators?: string[]
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { _ } from '@feathersjs/commons'
|
|
2
|
-
import { Params } from '@feathersjs/feathers'
|
|
3
|
-
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './sort'
|
|
2
|
+
import type { Params } from '@feathersjs/feathers'
|
|
3
|
+
export * from './declarations.js'
|
|
4
|
+
export * from './service.js'
|
|
5
|
+
export * from './query.js'
|
|
6
|
+
export * from './sort.js'
|
|
8
7
|
|
|
9
8
|
// Return a function that filters a result object or array
|
|
10
9
|
// and picks only the fields passed as `params.query.$select`
|
package/src/query.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { _ } from '@feathersjs/commons'
|
|
2
2
|
import { BadRequest } from '@feathersjs/errors'
|
|
3
|
-
import { Query } from '@feathersjs/feathers'
|
|
4
|
-
import { FilterQueryOptions, FilterSettings, PaginationParams } from './declarations'
|
|
5
|
-
|
|
3
|
+
import type { Query } from '@feathersjs/feathers'
|
|
4
|
+
import type { FilterQueryOptions, FilterSettings, PaginationParams } from './declarations.js'
|
|
6
5
|
const parse = (value: any) => (typeof value !== 'undefined' ? parseInt(value, 10) : value)
|
|
7
6
|
|
|
8
7
|
const isPlainObject = (value: any) => _.isObject(value) && value.constructor === {}.constructor
|
package/src/service.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Id, Paginated, Query } from '@feathersjs/feathers'
|
|
2
|
-
import {
|
|
1
|
+
import type { Id, Paginated, Query } from '@feathersjs/feathers'
|
|
2
|
+
import type {
|
|
3
3
|
AdapterParams,
|
|
4
4
|
AdapterServiceOptions,
|
|
5
5
|
InternalServiceMethods,
|
|
6
6
|
PaginationOptions
|
|
7
|
-
} from './declarations'
|
|
8
|
-
import { filterQuery } from './query'
|
|
7
|
+
} from './declarations.js'
|
|
8
|
+
import { filterQuery } from './query.js'
|
|
9
9
|
|
|
10
10
|
export const VALIDATED = Symbol.for('@feathersjs/adapter/sanitized')
|
|
11
11
|
|