ag-common 0.0.296 → 0.0.299
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/api/types/index.d.ts +2 -2
- package/dist/common/helpers/object.d.ts +1 -0
- package/dist/common/helpers/object.js +4 -1
- package/dist/ui/helpers/index.d.ts +1 -0
- package/dist/ui/helpers/index.js +1 -0
- package/dist/ui/helpers/useGranularHook.d.ts +5 -0
- package/dist/ui/helpers/useGranularHook.js +14 -0
- package/package.json +2 -2
|
@@ -50,7 +50,7 @@ export interface ILambdaConfigs {
|
|
|
50
50
|
default?: ILambdaConfig;
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
export declare type TSkOperator = 'BETWEEN' | '<' | '<=' | '=' | '>=' | '>' | 'BEGINS_WITH';
|
|
53
|
+
export declare type TSkOperator = 'BETWEEN' | '<' | '<=' | '=' | '>=' | '>' | '<>' | 'BEGINS_WITH';
|
|
54
54
|
export interface IQueryDynamo {
|
|
55
55
|
pkName: string;
|
|
56
56
|
pkValue: string | number;
|
|
@@ -63,7 +63,7 @@ export interface IQueryDynamo {
|
|
|
63
63
|
count?: number;
|
|
64
64
|
startKey?: Key;
|
|
65
65
|
filterName?: string;
|
|
66
|
-
filterValue?: string | number;
|
|
66
|
+
filterValue?: string | number | boolean;
|
|
67
67
|
filterOperator?: string;
|
|
68
68
|
}
|
|
69
69
|
export * from './aws';
|
|
@@ -51,3 +51,4 @@ export declare const removeUndefValuesFromObject: <T>(orig: Record<string, T>, .
|
|
|
51
51
|
* @returns
|
|
52
52
|
*/
|
|
53
53
|
export declare const castStringlyObject: (orig: Record<string, string | string[] | undefined>) => Record<string, string>;
|
|
54
|
+
export declare const isObject: (o: any) => any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.castStringlyObject = exports.removeUndefValuesFromObject = exports.castObject = exports.objectToString = exports.paramsToObject = exports.objectAlphaSort = exports.objectToArray = exports.getObjectKeysAsNumber = exports.objectKeysToLowerCase = exports.isJson = exports.tryJsonParse = void 0;
|
|
3
|
+
exports.isObject = exports.castStringlyObject = exports.removeUndefValuesFromObject = exports.castObject = exports.objectToString = exports.paramsToObject = exports.objectAlphaSort = exports.objectToArray = exports.getObjectKeysAsNumber = exports.objectKeysToLowerCase = exports.isJson = exports.tryJsonParse = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
const tryJsonParse = (str, defaultValue) => {
|
|
6
6
|
if (!str) {
|
|
@@ -156,3 +156,6 @@ const castStringlyObject = (orig) => {
|
|
|
156
156
|
});
|
|
157
157
|
};
|
|
158
158
|
exports.castStringlyObject = castStringlyObject;
|
|
159
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
160
|
+
const isObject = (o) => o && typeof o === 'object' && !Array.isArray(o);
|
|
161
|
+
exports.isObject = isObject;
|
|
@@ -12,6 +12,7 @@ export * from './plural';
|
|
|
12
12
|
export * from './routes';
|
|
13
13
|
export * from './serviceWorker';
|
|
14
14
|
export * from './useContextMenu';
|
|
15
|
+
export * from './useGranularHook';
|
|
15
16
|
export * from './useLocalStorage';
|
|
16
17
|
export * from './useLockBodyScroll';
|
|
17
18
|
export * from './useOnClickOutside';
|
package/dist/ui/helpers/index.js
CHANGED
|
@@ -28,6 +28,7 @@ __exportStar(require("./plural"), exports);
|
|
|
28
28
|
__exportStar(require("./routes"), exports);
|
|
29
29
|
__exportStar(require("./serviceWorker"), exports);
|
|
30
30
|
__exportStar(require("./useContextMenu"), exports);
|
|
31
|
+
__exportStar(require("./useGranularHook"), exports);
|
|
31
32
|
__exportStar(require("./useLocalStorage"), exports);
|
|
32
33
|
__exportStar(require("./useLockBodyScroll"), exports);
|
|
33
34
|
__exportStar(require("./useOnClickOutside"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DependencyList, EffectCallback } from 'react';
|
|
2
|
+
declare type HookWithDependencies<C, R> = (callback: C, deps: DependencyList) => R;
|
|
3
|
+
export declare const useGranularHook: <T extends HookWithDependencies<C, ReturnType<T>>, C>(hook: T, callback: C, primaryDeps: DependencyList, secondaryDeps: DependencyList) => ReturnType<T>;
|
|
4
|
+
export declare const useGranularEffect: (effect: EffectCallback, primaryDeps: DependencyList, secondaryDeps: DependencyList) => void;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGranularEffect = exports.useGranularHook = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useGranularHook = (hook, callback, primaryDeps, secondaryDeps) => {
|
|
6
|
+
const ref = (0, react_1.useRef)();
|
|
7
|
+
if (!ref.current ||
|
|
8
|
+
!primaryDeps.every((w, i) => { var _a; return Object.is(w, (_a = ref.current) === null || _a === void 0 ? void 0 : _a[i]); }))
|
|
9
|
+
ref.current = [...primaryDeps, ...secondaryDeps];
|
|
10
|
+
return hook(callback, ref.current);
|
|
11
|
+
};
|
|
12
|
+
exports.useGranularHook = useGranularHook;
|
|
13
|
+
const useGranularEffect = (effect, primaryDeps, secondaryDeps) => (0, exports.useGranularHook)(react_1.useEffect, effect, primaryDeps, secondaryDeps);
|
|
14
|
+
exports.useGranularEffect = useGranularEffect;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ag-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.299",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "Andrei Gec <@andreigec> (https://gec.dev/)",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@storybook/react": "6.5.9",
|
|
43
43
|
"@storybook/theming": "6.5.9",
|
|
44
44
|
"@types/jsonwebtoken": "8.5.8",
|
|
45
|
-
"@types/node": "18.6.
|
|
45
|
+
"@types/node": "18.6.2",
|
|
46
46
|
"@types/react": "18.0.15",
|
|
47
47
|
"@types/react-dom": "18.0.6",
|
|
48
48
|
"@types/styled-components": "5.1.25",
|