feathers-utils 2.1.0 → 2.1.2
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/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +17 -17
- package/src/utils/mergeQuery/mergeArrays.ts +3 -3
- package/src/utils/shouldSkip.ts +2 -5
package/dist/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@ const _debounce = require('lodash/debounce.js');
|
|
|
16
16
|
const _isObject = require('lodash/isObject.js');
|
|
17
17
|
|
|
18
18
|
function mergeArrays(targetArr, sourceArr, handle, prependKey, actionOnEmptyIntersect) {
|
|
19
|
-
if (!sourceArr
|
|
19
|
+
if (!sourceArr || !targetArr) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
if (handle === "target") {
|
package/dist/index.d.ts
CHANGED
|
@@ -143,7 +143,7 @@ interface MergeQueryOptions<T> extends FilterQueryOptions<T> {
|
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
declare function mergeArrays<T>(targetArr: T[], sourceArr: T[], handle: Handle, prependKey?: Path, actionOnEmptyIntersect?: ActionOnEmptyIntersect): T[] | undefined;
|
|
146
|
+
declare function mergeArrays<T>(targetArr: T[] | undefined, sourceArr: T[] | undefined, handle: Handle, prependKey?: Path, actionOnEmptyIntersect?: ActionOnEmptyIntersect): T[] | undefined;
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
149
|
* Merges two queries into one.
|
|
@@ -202,7 +202,7 @@ type ShouldSkipOptions = {
|
|
|
202
202
|
/**
|
|
203
203
|
* util to detect if a hook should be skipped
|
|
204
204
|
*/
|
|
205
|
-
declare const shouldSkip: <H extends HookContext<_feathersjs_feathers.Application<any, any>, any> = HookContext<_feathersjs_feathers.Application<any, any>, any
|
|
205
|
+
declare const shouldSkip: <H extends HookContext<_feathersjs_feathers.Application<any, any>, any> = HookContext<_feathersjs_feathers.Application<any, any>, any>>(hookName: string, context: H, options?: ShouldSkipOptions) => boolean;
|
|
206
206
|
|
|
207
207
|
/**
|
|
208
208
|
* util to validate a query for operators
|
package/dist/index.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import _debounce from 'lodash/debounce.js';
|
|
|
14
14
|
import _isObject from 'lodash/isObject.js';
|
|
15
15
|
|
|
16
16
|
function mergeArrays(targetArr, sourceArr, handle, prependKey, actionOnEmptyIntersect) {
|
|
17
|
-
if (!sourceArr
|
|
17
|
+
if (!sourceArr || !targetArr) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
if (handle === "target") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "feathers-utils",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Some utils for projects using '@feathersjs/feathers'",
|
|
5
5
|
"author": "fratzinger",
|
|
6
6
|
"repository": {
|
|
@@ -39,36 +39,36 @@
|
|
|
39
39
|
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@feathersjs/adapter-commons": "5.0.
|
|
43
|
-
"@feathersjs/commons": "^5.0.
|
|
44
|
-
"@feathersjs/errors": "5.0.
|
|
45
|
-
"@feathersjs/feathers": "5.0.
|
|
42
|
+
"@feathersjs/adapter-commons": "5.0.1",
|
|
43
|
+
"@feathersjs/commons": "^5.0.1",
|
|
44
|
+
"@feathersjs/errors": "5.0.1",
|
|
45
|
+
"@feathersjs/feathers": "5.0.1",
|
|
46
46
|
"fast-equals": "^5.0.1",
|
|
47
|
-
"feathers-hooks-common": "^7.0.
|
|
47
|
+
"feathers-hooks-common": "^7.0.1",
|
|
48
48
|
"lodash": "^4.17.21"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@feathersjs/memory": "^5.0.
|
|
51
|
+
"@feathersjs/memory": "^5.0.1",
|
|
52
52
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
53
53
|
"@types/lodash": "^4.14.191",
|
|
54
54
|
"@types/mocha": "^10.0.1",
|
|
55
|
-
"@types/node": "^18.
|
|
56
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
57
|
-
"@typescript-eslint/parser": "^5.
|
|
58
|
-
"@vitest/coverage-c8": "^0.29.
|
|
55
|
+
"@types/node": "^18.15.9",
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^5.56.0",
|
|
57
|
+
"@typescript-eslint/parser": "^5.56.0",
|
|
58
|
+
"@vitest/coverage-c8": "^0.29.7",
|
|
59
59
|
"cross-env": "^7.0.3",
|
|
60
|
-
"eslint": "^8.
|
|
61
|
-
"eslint-config-prettier": "^8.
|
|
60
|
+
"eslint": "^8.36.0",
|
|
61
|
+
"eslint-config-prettier": "^8.8.0",
|
|
62
62
|
"eslint-import-resolver-typescript": "^3.5.3",
|
|
63
63
|
"eslint-plugin-import": "^2.27.5",
|
|
64
64
|
"eslint-plugin-prettier": "^4.2.1",
|
|
65
65
|
"eslint-plugin-security": "^1.7.1",
|
|
66
|
-
"np": "^7.6.
|
|
66
|
+
"np": "^7.6.4",
|
|
67
67
|
"nyc": "^15.1.0",
|
|
68
|
-
"prettier": "^2.8.
|
|
68
|
+
"prettier": "^2.8.7",
|
|
69
69
|
"shx": "^0.3.4",
|
|
70
|
-
"typescript": "^
|
|
70
|
+
"typescript": "^5.0.2",
|
|
71
71
|
"unbuild": "^1.1.2",
|
|
72
|
-
"vitest": "^0.29.
|
|
72
|
+
"vitest": "^0.29.7"
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -2,13 +2,13 @@ import type { Path } from "../../typesInternal";
|
|
|
2
2
|
import type { Handle, ActionOnEmptyIntersect } from "./types";
|
|
3
3
|
|
|
4
4
|
export function mergeArrays<T>(
|
|
5
|
-
targetArr: T[],
|
|
6
|
-
sourceArr: T[],
|
|
5
|
+
targetArr: T[] | undefined,
|
|
6
|
+
sourceArr: T[] | undefined,
|
|
7
7
|
handle: Handle,
|
|
8
8
|
prependKey?: Path,
|
|
9
9
|
actionOnEmptyIntersect?: ActionOnEmptyIntersect
|
|
10
10
|
): T[] | undefined {
|
|
11
|
-
if (!sourceArr
|
|
11
|
+
if (!sourceArr || !targetArr) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
if (handle === "target") {
|
package/src/utils/shouldSkip.ts
CHANGED
|
@@ -12,13 +12,10 @@ export type ShouldSkipOptions = {
|
|
|
12
12
|
/**
|
|
13
13
|
* util to detect if a hook should be skipped
|
|
14
14
|
*/
|
|
15
|
-
export const shouldSkip = <
|
|
16
|
-
H extends HookContext = HookContext,
|
|
17
|
-
O extends ShouldSkipOptions = ShouldSkipOptions
|
|
18
|
-
>(
|
|
15
|
+
export const shouldSkip = <H extends HookContext = HookContext>(
|
|
19
16
|
hookName: string,
|
|
20
17
|
context: H,
|
|
21
|
-
options?:
|
|
18
|
+
options?: ShouldSkipOptions
|
|
22
19
|
): boolean => {
|
|
23
20
|
if (!context.params || !context.params.skipHooks || options?.notSkippable) {
|
|
24
21
|
return false;
|