ag-common 0.0.358 → 0.0.360
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/helpers/dynamo.d.ts +2 -1
- package/dist/api/helpers/dynamo.js +5 -3
- package/dist/api/helpers/enforceDynamoProvisionCap.d.ts +2 -1
- package/dist/api/helpers/enforceDynamoProvisionCap.js +1 -0
- package/dist/api/helpers/s3.d.ts +12 -1
- package/dist/api/helpers/s3.js +26 -2
- package/dist/api/helpers/validateOpenApi.d.ts +1 -1
- package/dist/api/helpers/validations.d.ts +1 -1
- package/dist/api/openapi-postfix.js +22 -16
- package/dist/api/types/aws.d.ts +1 -1
- package/dist/api/types/index.d.ts +1 -1
- package/dist/common/helpers/i18n.d.ts +3 -3
- package/dist/common/helpers/log.d.ts +1 -1
- package/dist/ui/components/BorderGradient/index.d.ts +1 -1
- package/dist/ui/components/RowOrColumn/index.d.ts +2 -2
- package/dist/ui/components/Search/types.d.ts +3 -3
- package/dist/ui/components/SparkLine/index.d.ts +1 -1
- package/dist/ui/helpers/axiosHelper.js +7 -7
- package/dist/ui/helpers/callOpenApi/cached.d.ts +1 -1
- package/dist/ui/helpers/callOpenApi/helpers.d.ts +6 -0
- package/dist/ui/helpers/callOpenApi/helpers.js +6 -0
- package/dist/ui/helpers/callOpenApi/hook.d.ts +3 -3
- package/dist/ui/helpers/cognito.d.ts +1 -1
- package/dist/ui/helpers/cookie/const.d.ts +4 -4
- package/dist/ui/helpers/routes.d.ts +2 -2
- package/dist/ui/helpers/useGranularHook.d.ts +1 -1
- package/dist/ui/helpers/useOnClickOutside.d.ts +1 -1
- package/package.json +3 -3
|
@@ -46,7 +46,8 @@ export declare const queryDynamo: <T>({ tableName, pkName, pkValue, pkOperator,
|
|
|
46
46
|
Items: T[];
|
|
47
47
|
startKey?: Key | undefined;
|
|
48
48
|
}>;
|
|
49
|
-
export declare const
|
|
49
|
+
export declare const getDynamoTtlDays: (days: number) => number;
|
|
50
|
+
export declare const getDynamoTtlMinutes: (mins: number) => number;
|
|
50
51
|
export declare const wipeTable: (tableName: string) => Promise<{
|
|
51
52
|
errors?: string[] | undefined;
|
|
52
53
|
}>;
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.getDynamoUpdates = exports.wipeTable = exports.
|
|
15
|
+
exports.getDynamoUpdates = exports.wipeTable = exports.getDynamoTtlMinutes = exports.getDynamoTtlDays = exports.queryDynamo = exports.getItemsDynamo = exports.getItemDynamo = exports.scan = exports.batchDelete = exports.batchWrite = exports.putDynamo = exports.setDynamo = exports.dynamoDb = void 0;
|
|
16
16
|
const log_1 = require("../../common/helpers/log");
|
|
17
17
|
const array_1 = require("../../common/helpers/array");
|
|
18
18
|
const sleep_1 = require("../../common/helpers/sleep");
|
|
@@ -317,8 +317,10 @@ const queryDynamo = ({ tableName, pkName, pkValue, pkOperator = '=', skName, skV
|
|
|
317
317
|
return { Items, startKey: undefined };
|
|
318
318
|
});
|
|
319
319
|
exports.queryDynamo = queryDynamo;
|
|
320
|
-
const
|
|
321
|
-
exports.
|
|
320
|
+
const getDynamoTtlDays = (days) => Math.ceil(new Date().getTime() / 1000) + days * 86400;
|
|
321
|
+
exports.getDynamoTtlDays = getDynamoTtlDays;
|
|
322
|
+
const getDynamoTtlMinutes = (mins) => Math.ceil(new Date().getTime() / 1000) + mins * 60;
|
|
323
|
+
exports.getDynamoTtlMinutes = getDynamoTtlMinutes;
|
|
322
324
|
const wipeTable = (tableName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
323
325
|
var _h;
|
|
324
326
|
const dbRaw = new dynamodb_1.default({ apiVersion: '2012-10-08' });
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** ensure that dynamo tables in stack dont exceed passed in provisioned limits */
|
|
1
2
|
export declare const enforceDynamoProvisionCap: ({ tables, readsMax, writesMax, mustEqual, }: {
|
|
2
3
|
tables: any[];
|
|
3
4
|
/**
|
|
@@ -9,7 +10,7 @@ export declare const enforceDynamoProvisionCap: ({ tables, readsMax, writesMax,
|
|
|
9
10
|
*/
|
|
10
11
|
writesMax?: number | undefined;
|
|
11
12
|
/**
|
|
12
|
-
* default false. if true, will throw if cap isnt met
|
|
13
|
+
* default false. if true, will throw if cap isnt met. will still throw if exceeds.
|
|
13
14
|
*/
|
|
14
15
|
mustEqual?: boolean | undefined;
|
|
15
16
|
}) => void;
|
|
@@ -9,6 +9,7 @@ const extractSum = ({ str, regex }) => {
|
|
|
9
9
|
return (0, math_1.sumArray)(((_a = str
|
|
10
10
|
.match(regex)) === null || _a === void 0 ? void 0 : _a.map((s2) => (0, string_1.trim)(s2.substring(s2.indexOf(':') + 1), ':', ',', ' ')).filter((r) => r && Number(r)).map((r) => Number(r))) || []);
|
|
11
11
|
};
|
|
12
|
+
/** ensure that dynamo tables in stack dont exceed passed in provisioned limits */
|
|
12
13
|
const enforceDynamoProvisionCap = ({ tables, readsMax = 25, writesMax = 25, mustEqual = false, }) => {
|
|
13
14
|
if (!tables || tables.length === 0) {
|
|
14
15
|
(0, log_1.warn)('error in dynamo FT enforce');
|
package/dist/api/helpers/s3.d.ts
CHANGED
|
@@ -46,7 +46,18 @@ export declare const deleteFiles: ({ Bucket, Keys, }: {
|
|
|
46
46
|
}) => Promise<{
|
|
47
47
|
error?: string;
|
|
48
48
|
}>;
|
|
49
|
-
export declare
|
|
49
|
+
export declare const copyFile: ({ Bucket, fromKey, toKey, deleteSource, }: {
|
|
50
|
+
Bucket: string;
|
|
51
|
+
fromKey: string;
|
|
52
|
+
toKey: string;
|
|
53
|
+
/** if true, will delete original after copy. default false */
|
|
54
|
+
deleteSource?: boolean | undefined;
|
|
55
|
+
}) => Promise<{
|
|
56
|
+
error?: string;
|
|
57
|
+
}>;
|
|
58
|
+
export declare function listFiles(bucketName: string, opt?: {
|
|
59
|
+
prefix?: string;
|
|
60
|
+
}): Promise<string[]>;
|
|
50
61
|
/**
|
|
51
62
|
* allow uploading of file directly to s3
|
|
52
63
|
* @param param0
|
package/dist/api/helpers/s3.js
CHANGED
|
@@ -24,7 +24,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
25
25
|
};
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.getPresignedPostURL = exports.listFiles = exports.deleteFiles = exports.deleteFile = exports.uploadFile = exports.putS3Object = exports.getS3Objects = exports.getS3Object = exports.setS3 = void 0;
|
|
27
|
+
exports.getPresignedPostURL = exports.listFiles = exports.copyFile = exports.deleteFiles = exports.deleteFile = exports.uploadFile = exports.putS3Object = exports.getS3Objects = exports.getS3Object = exports.setS3 = void 0;
|
|
28
28
|
const s3_1 = __importDefault(require("aws-sdk/clients/s3"));
|
|
29
29
|
const log_1 = require("../../common/helpers/log");
|
|
30
30
|
const array_1 = require("../../common/helpers/array");
|
|
@@ -110,7 +110,30 @@ const deleteFiles = ({ Bucket, Keys, }) => __awaiter(void 0, void 0, void 0, fun
|
|
|
110
110
|
return {};
|
|
111
111
|
});
|
|
112
112
|
exports.deleteFiles = deleteFiles;
|
|
113
|
-
function
|
|
113
|
+
const copyFile = ({ Bucket, fromKey, toKey, deleteSource = false, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
114
|
+
(0, log_1.debug)(`copying s3 file from ${Bucket}- ${fromKey} to ${toKey}`);
|
|
115
|
+
const res = yield s3
|
|
116
|
+
.copyObject({
|
|
117
|
+
//incl bucket
|
|
118
|
+
CopySource: Bucket + '/' + fromKey,
|
|
119
|
+
//dest
|
|
120
|
+
Bucket,
|
|
121
|
+
Key: toKey,
|
|
122
|
+
})
|
|
123
|
+
.promise();
|
|
124
|
+
if (res.$response.error) {
|
|
125
|
+
return { error: res.$response.error.message };
|
|
126
|
+
}
|
|
127
|
+
if (deleteSource) {
|
|
128
|
+
const df = yield (0, exports.deleteFile)({ Bucket, Key: fromKey });
|
|
129
|
+
if (df.error) {
|
|
130
|
+
return { error: df.error };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return {};
|
|
134
|
+
});
|
|
135
|
+
exports.copyFile = copyFile;
|
|
136
|
+
function listFiles(bucketName, opt) {
|
|
114
137
|
var _a, _b;
|
|
115
138
|
return __awaiter(this, void 0, void 0, function* () {
|
|
116
139
|
try {
|
|
@@ -124,6 +147,7 @@ function listFiles(bucketName) {
|
|
|
124
147
|
.listObjectsV2({
|
|
125
148
|
Bucket: bucketName,
|
|
126
149
|
ContinuationToken: response.NextContinuationToken,
|
|
150
|
+
Prefix: opt === null || opt === void 0 ? void 0 : opt.prefix,
|
|
127
151
|
})
|
|
128
152
|
.promise();
|
|
129
153
|
(_b = (_a = response.Contents) === null || _a === void 0 ? void 0 : _a.filter((r) => r.Key)) === null || _b === void 0 ? void 0 : _b.map((c) => {
|
|
@@ -2,7 +2,7 @@ import { TGetAndValidateToken } from './validations';
|
|
|
2
2
|
import { User } from '../../ui/helpers/jwt';
|
|
3
3
|
import { TLang } from '../../common/helpers/i18n';
|
|
4
4
|
import { APIGatewayEvent, APIGatewayProxyResult } from '../types';
|
|
5
|
-
export
|
|
5
|
+
export type NextType<T> = ({ event, body, params, userProfile, lang, }: {
|
|
6
6
|
params: Record<string, string>;
|
|
7
7
|
event: APIGatewayEvent;
|
|
8
8
|
body: T;
|
|
@@ -8,7 +8,7 @@ export interface IGetAndValidateToken {
|
|
|
8
8
|
tokenRaw?: string;
|
|
9
9
|
COGNITO_USER_POOL_ID: string;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export type TGetAndValidateToken = (p: IGetAndValidateToken) => Promise<{
|
|
12
12
|
error?: APIGatewayProxyResult;
|
|
13
13
|
token?: string;
|
|
14
14
|
userProfile?: User;
|
|
@@ -4,28 +4,34 @@
|
|
|
4
4
|
/* eslint-disable no-console */
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const process = require('process');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const pathV = require('path');
|
|
8
|
+
const cwd = process.cwd();
|
|
9
|
+
const resolvePath = (p) => pathV.resolve(cwd, p);
|
|
10
10
|
function run() {
|
|
11
|
-
|
|
11
|
+
const files = fs
|
|
12
12
|
.readdirSync(resolvePath('./dist/api'))
|
|
13
|
-
.filter((r) => r.endsWith('.js'))
|
|
14
|
-
.map((s) => `./dist/api/${s}`)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
.filter((r) => r.endsWith('.js') || r.endsWith('.d.ts'))
|
|
14
|
+
.map((s) => `./dist/api/${s}`)
|
|
15
|
+
.filter(fs.existsSync)
|
|
16
|
+
.map((file) => ({ file, content: fs.readFileSync(file).toString() }));
|
|
17
|
+
let found = false;
|
|
18
|
+
files.forEach(({ file, content }) => {
|
|
19
|
+
if (content.includes('url_1')) {
|
|
20
|
+
console.log('removing url_1 from ' + file);
|
|
21
|
+
content = content.replace(/url_1\./gim, '');
|
|
21
22
|
found = true;
|
|
22
23
|
}
|
|
23
|
-
if (
|
|
24
|
-
console.log('fixing queryparams default from ' +
|
|
25
|
-
|
|
24
|
+
if (content.includes('this.configuration.queryParamsStringify(')) {
|
|
25
|
+
console.log('fixing queryparams default from ' + file);
|
|
26
|
+
content = content.replace(/this.configuration.queryParamsStringify\(/gim, '(this.configuration.queryParamsStringify||querystring)(');
|
|
26
27
|
found = true;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
if (content.includes(`import("axios").`)) {
|
|
30
|
+
console.log('fixing axios import from ' + file);
|
|
31
|
+
content = content.replace(/import\("axios"\)\./gim, '');
|
|
32
|
+
found = true;
|
|
33
|
+
}
|
|
34
|
+
fs.writeFileSync(file, content);
|
|
29
35
|
});
|
|
30
36
|
if (!found) {
|
|
31
37
|
console.log('error: no files were fixed');
|
package/dist/api/types/aws.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export interface ILambdaConfigs {
|
|
|
50
50
|
default?: ILambdaConfig;
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
export
|
|
53
|
+
export type TSkOperator = 'BETWEEN' | '<' | '<=' | '=' | '>=' | '>' | '<>' | 'BEGINS_WITH';
|
|
54
54
|
export interface IQueryDynamo {
|
|
55
55
|
pkName: string;
|
|
56
56
|
pkValue: string | number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
type TLangExceptEn = 'id' | 'vi' | 'pt';
|
|
2
|
+
export type TLang = TLangExceptEn | 'en';
|
|
3
3
|
export declare const AllLang: TLang[];
|
|
4
4
|
/**
|
|
5
5
|
* null = wont translate. undefined = fallback to eng
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type TResource = {
|
|
8
8
|
[k in TLangExceptEn]?: string | null;
|
|
9
9
|
} & {
|
|
10
10
|
en: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type TLogType = 'TRACE' | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'FATAL';
|
|
2
2
|
export declare const GetLogLevel: (l: TLogType) => number;
|
|
3
3
|
export declare const SetLogLevel: (l: TLogType) => void;
|
|
4
4
|
export declare const debug: (...args: unknown[]) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
type IOnClick = React.MouseEvent<HTMLDivElement, MouseEvent> | React.MouseEvent<HTMLAnchorElement, MouseEvent>;
|
|
3
3
|
export interface IBorderGradient {
|
|
4
4
|
canClick?: boolean;
|
|
5
5
|
noGrow?: boolean;
|
|
@@ -8,6 +8,6 @@ export interface IRowOrColumn {
|
|
|
8
8
|
title?: string;
|
|
9
9
|
enableOverflow?: boolean;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
12
|
-
export
|
|
11
|
+
export type IFlexColumn = IRowOrColumn;
|
|
12
|
+
export type IFlexRow = IRowOrColumn;
|
|
13
13
|
export declare const RowOrColumn: (props: IRowOrColumn) => JSX.Element;
|
|
@@ -29,9 +29,9 @@ export interface ISearchDialog<T> {
|
|
|
29
29
|
totalItems?: (showing: number, outof: number) => string;
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
export
|
|
32
|
+
export type TSearchModalRes<T> = undefined | {
|
|
33
33
|
foundItem: T;
|
|
34
34
|
searchText: string;
|
|
35
35
|
};
|
|
36
|
-
export
|
|
37
|
-
export
|
|
36
|
+
export type ISearchModal<T> = ISearchDialog<T>;
|
|
37
|
+
export type ISearchInline<T> = ISearchDialog<T>;
|
|
@@ -39,23 +39,23 @@ const axiosHelper = ({ verb, url, body, headers, timeout = 30000, retryMax = 0,
|
|
|
39
39
|
}
|
|
40
40
|
let noBody = false;
|
|
41
41
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
-
let
|
|
42
|
+
let axiosV = axios_1.default.post;
|
|
43
43
|
if (verb === 'put') {
|
|
44
|
-
|
|
44
|
+
axiosV = axios_1.default.put;
|
|
45
45
|
}
|
|
46
46
|
else if (verb === 'post') {
|
|
47
|
-
|
|
47
|
+
axiosV = axios_1.default.post;
|
|
48
48
|
}
|
|
49
49
|
else if (verb === 'patch') {
|
|
50
|
-
|
|
50
|
+
axiosV = axios_1.default.patch;
|
|
51
51
|
}
|
|
52
52
|
else if (verb === 'delete') {
|
|
53
53
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
|
-
|
|
54
|
+
axiosV = axios_1.default.delete;
|
|
55
55
|
noBody = true;
|
|
56
56
|
}
|
|
57
57
|
if (noBody) {
|
|
58
|
-
ret = yield
|
|
58
|
+
ret = yield axiosV(url, {
|
|
59
59
|
headers: setHeaders,
|
|
60
60
|
timeout,
|
|
61
61
|
timeoutErrorMessage: `${url} timeout`,
|
|
@@ -66,7 +66,7 @@ const axiosHelper = ({ verb, url, body, headers, timeout = 30000, retryMax = 0,
|
|
|
66
66
|
setHeaders['Content-Type'] =
|
|
67
67
|
setHeaders['Content-Type'] || 'application/json';
|
|
68
68
|
}
|
|
69
|
-
ret = yield
|
|
69
|
+
ret = yield axiosV(url, body, { headers: setHeaders });
|
|
70
70
|
}
|
|
71
71
|
return ret;
|
|
72
72
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ICallOpenApi, OverrideAuth } from './types';
|
|
2
2
|
import { CacheItems } from '../routes';
|
|
3
3
|
import { AxiosWrapperLite } from '../jwt';
|
|
4
|
-
export
|
|
4
|
+
export type TCallOpenApiCached<T, TDefaultApi> = ICallOpenApi<T, TDefaultApi> & {
|
|
5
5
|
/**
|
|
6
6
|
* if falsey, will run callOpenApi directly
|
|
7
7
|
*/
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
2
|
import { ApiResponse } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* shim to convert raw response to an axios style response.
|
|
5
|
+
* must convert all DefaultClass requests to the Raw equivalent
|
|
6
|
+
* @param p
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
3
9
|
export declare const apiResponseToAxiosResponse: <T>(p: () => Promise<ApiResponse<T>>) => Promise<AxiosResponse<T, any>>;
|
|
@@ -11,6 +11,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.apiResponseToAxiosResponse = void 0;
|
|
13
13
|
const array_1 = require("../../../common/helpers/array");
|
|
14
|
+
/**
|
|
15
|
+
* shim to convert raw response to an axios style response.
|
|
16
|
+
* must convert all DefaultClass requests to the Raw equivalent
|
|
17
|
+
* @param p
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
14
20
|
const apiResponseToAxiosResponse = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
21
|
return p()
|
|
16
22
|
.then((r) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ICallOpenApi } from './types';
|
|
2
2
|
import { CacheItems } from '../routes';
|
|
3
3
|
import { AxiosWrapper } from '../jwt';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type TUseCallOpenApiDispatch<A> = (value: A) => A;
|
|
5
|
+
export type TUseCallOpenApi<T> = AxiosWrapper<T> & {
|
|
6
6
|
loaded: boolean;
|
|
7
7
|
loadcount: number;
|
|
8
8
|
setData: (d: TUseCallOpenApiDispatch<T | undefined>) => void;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
type TUseCallOpenApiInt<T, TDefaultApi> = ICallOpenApi<T, TDefaultApi> & {
|
|
11
11
|
cacheKey: string;
|
|
12
12
|
/**
|
|
13
13
|
* will shortcut and return the appropriate axioswrapper data if cachekey is found
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const expireDate = "Thu, 01 Jan 1970 00:00:00 UTC";
|
|
2
2
|
export declare const maxCookieLen = 4000;
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
3
|
+
export type Dispatch<A> = (value: A) => void;
|
|
4
|
+
export type SetStateAction<S> = S | ((prevState: S) => S);
|
|
5
|
+
export type ReturnType<T> = [T, Dispatch<SetStateAction<T>>];
|
|
6
|
+
export type TParse<T> = (s: string | null | undefined) => T;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ICognitoAuth } from './cognito';
|
|
2
2
|
import { AxiosWrapperLite } from './jwt';
|
|
3
3
|
import { TLang } from '../../common/helpers/i18n';
|
|
4
|
-
export
|
|
4
|
+
export type TProtocol = 'http:' | 'https:';
|
|
5
5
|
export interface LocationSubset {
|
|
6
6
|
/**
|
|
7
7
|
* slash only path eg /aaa/bbb
|
|
@@ -33,7 +33,7 @@ export interface LocationSubset {
|
|
|
33
33
|
*/
|
|
34
34
|
path: string;
|
|
35
35
|
}
|
|
36
|
-
export
|
|
36
|
+
export type CacheItems = CacheItem<any>[];
|
|
37
37
|
export interface CacheItem<T> {
|
|
38
38
|
cacheKey: string;
|
|
39
39
|
prefillData: AxiosWrapperLite<T>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DependencyList, EffectCallback } from 'react';
|
|
2
|
-
|
|
2
|
+
type HookWithDependencies<C, R> = (callback: C, deps: DependencyList) => R;
|
|
3
3
|
export declare const useGranularHook: <T extends HookWithDependencies<C, ReturnType<T>>, C>(hook: T, callback: C, primaryDeps: DependencyList, secondaryDeps: DependencyList) => ReturnType<T>;
|
|
4
4
|
export declare const useGranularEffect: (effect: EffectCallback, primaryDeps: DependencyList, secondaryDeps: DependencyList) => void;
|
|
5
5
|
export {};
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ag-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.360",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "Andrei Gec <@andreigec> (https://gec.dev/)",
|
|
7
7
|
"repository": "github:andreigec/ag-common",
|
|
8
8
|
"license": "ISC",
|
|
9
|
-
"packageManager": "yarn@3.3.0",
|
|
10
9
|
"scripts": {
|
|
10
|
+
"preinstall": "npx only-allow pnpm",
|
|
11
11
|
"format": "npx eslint --ext .ts,.tsx ./src --fix",
|
|
12
|
-
"build": "rimraf dist &&
|
|
12
|
+
"build": "rimraf dist && npm run lint && tsc",
|
|
13
13
|
"lint": "npx eslint --ext .ts,.tsx ./src",
|
|
14
14
|
"start": "cross-env BROWSER=none start-storybook -p 6006",
|
|
15
15
|
"build-storybook": "build-storybook -o docs --quiet"
|