ag-common 0.0.283 → 0.0.286
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.
|
@@ -246,6 +246,12 @@ filterOperator = '=', }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
246
246
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
247
247
|
eav[`:${skName2}`] = sp1;
|
|
248
248
|
}
|
|
249
|
+
else if (skOperator === 'BEGINS_WITH') {
|
|
250
|
+
kce += ` and ${skOperator.toLowerCase()}(#${skName.toLowerCase()}, :${skName.toLowerCase()})`;
|
|
251
|
+
ean[`#${skName.toLowerCase()}`] = skName;
|
|
252
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
253
|
+
eav[`:${skName.toLowerCase()}`] = skValue;
|
|
254
|
+
}
|
|
249
255
|
else {
|
|
250
256
|
kce += ` and #${skName.toLowerCase()} ${skOperator} :${skName.toLowerCase()}`;
|
|
251
257
|
ean[`#${skName.toLowerCase()}`] = skName;
|
|
@@ -50,7 +50,7 @@ export interface ILambdaConfigs {
|
|
|
50
50
|
default?: ILambdaConfig;
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
export declare type TSkOperator = 'BETWEEN' | '<' | '<=' | '=' | '>=' | '>';
|
|
53
|
+
export declare type TSkOperator = 'BETWEEN' | '<' | '<=' | '=' | '>=' | '>' | 'BEGINS_WITH';
|
|
54
54
|
export interface IQueryDynamo {
|
|
55
55
|
pkName: string;
|
|
56
56
|
pkValue: string | number;
|
|
@@ -14,7 +14,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.callOpenApiCached = exports.callOpenApiCachedRaw = exports.setOpenApiCacheRaw = void 0;
|
|
16
16
|
const direct_1 = require("./direct");
|
|
17
|
-
const cookie_1 = require("../cookie");
|
|
18
17
|
const string_1 = require("../../../common/helpers/string");
|
|
19
18
|
const common_1 = require("../../../common");
|
|
20
19
|
const node_cache_1 = __importDefault(require("node-cache"));
|
|
@@ -25,11 +24,9 @@ let callOpenApiCache;
|
|
|
25
24
|
* @returns
|
|
26
25
|
*/
|
|
27
26
|
function getCacheKey({ cacheKey, overrideAuth, ssrCacheItems, }) {
|
|
28
|
-
const authkeyPrefix1 = (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
defaultValue: '',
|
|
32
|
-
});
|
|
27
|
+
const authkeyPrefix1 = (0, direct_1.getIdTokenAuthHeaderRaw)({
|
|
28
|
+
overrideAuth: overrideAuth,
|
|
29
|
+
});
|
|
33
30
|
const authPref = !authkeyPrefix1 ? '' : (0, common_1.hashCode)((0, string_1.toBase64)(authkeyPrefix1));
|
|
34
31
|
const ssrCachePref = !ssrCacheItems
|
|
35
32
|
? ''
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import { ICallOpenApi } from './types';
|
|
1
|
+
import { ICallOpenApi, OverrideAuth } from './types';
|
|
2
2
|
import { AxiosWrapperLite } from '../jwt';
|
|
3
|
+
/**
|
|
4
|
+
* get the id_token from provided value, or cookie, or LS
|
|
5
|
+
*/
|
|
6
|
+
export declare function getIdTokenAuthHeaderRaw({ overrideAuth, }: {
|
|
7
|
+
overrideAuth?: OverrideAuth;
|
|
8
|
+
}): string;
|
|
3
9
|
export declare const callOpenApi: <T, TDefaultApi>(p: ICallOpenApi<T, TDefaultApi>) => Promise<AxiosWrapperLite<T>>;
|
|
@@ -9,29 +9,48 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.callOpenApi = void 0;
|
|
12
|
+
exports.callOpenApi = exports.getIdTokenAuthHeaderRaw = void 0;
|
|
13
13
|
const cookie_1 = require("../cookie");
|
|
14
14
|
const sleep_1 = require("../../../common/helpers/sleep");
|
|
15
15
|
const array_1 = require("../../../common/helpers/array");
|
|
16
|
+
const useLocalStorage_1 = require("../useLocalStorage");
|
|
17
|
+
/**
|
|
18
|
+
* get the id_token from provided value, or cookie, or LS
|
|
19
|
+
*/
|
|
20
|
+
function getIdTokenAuthHeaderRaw({ overrideAuth, }) {
|
|
21
|
+
var _a;
|
|
22
|
+
let idToken;
|
|
23
|
+
//if override supplied will only use that and not refresh
|
|
24
|
+
if (overrideAuth === null || overrideAuth === void 0 ? void 0 : overrideAuth.id_token) {
|
|
25
|
+
idToken = overrideAuth === null || overrideAuth === void 0 ? void 0 : overrideAuth.id_token;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
idToken = (0, cookie_1.getCookieString)({
|
|
29
|
+
name: 'id_token',
|
|
30
|
+
defaultValue: '',
|
|
31
|
+
});
|
|
32
|
+
if (!idToken) {
|
|
33
|
+
const userLs = (0, useLocalStorage_1.getLocalStorageItem)('user', undefined);
|
|
34
|
+
if ((_a = userLs === null || userLs === void 0 ? void 0 : userLs.jwt) === null || _a === void 0 ? void 0 : _a.id_token) {
|
|
35
|
+
idToken = userLs.jwt.id_token;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return idToken;
|
|
40
|
+
}
|
|
41
|
+
exports.getIdTokenAuthHeaderRaw = getIdTokenAuthHeaderRaw;
|
|
42
|
+
/**
|
|
43
|
+
* get id_token, and then refresh
|
|
44
|
+
*/
|
|
16
45
|
function getIdTokenAuthHeader({ overrideAuth, refreshToken, }) {
|
|
17
46
|
var _a, _b;
|
|
18
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
let idToken;
|
|
20
|
-
//if
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
idToken = (0, cookie_1.getCookieString)({
|
|
26
|
-
name: 'id_token',
|
|
27
|
-
defaultValue: '',
|
|
28
|
-
});
|
|
29
|
-
//if we have a cookie token, can try to refresh
|
|
30
|
-
if (idToken) {
|
|
31
|
-
const updated = yield refreshToken();
|
|
32
|
-
if ((_a = updated === null || updated === void 0 ? void 0 : updated.jwt) === null || _a === void 0 ? void 0 : _a.id_token) {
|
|
33
|
-
idToken = (_b = updated === null || updated === void 0 ? void 0 : updated.jwt) === null || _b === void 0 ? void 0 : _b.id_token;
|
|
34
|
-
}
|
|
48
|
+
let idToken = getIdTokenAuthHeaderRaw({ overrideAuth });
|
|
49
|
+
//if we have a cookie token, can try to refresh
|
|
50
|
+
if (idToken) {
|
|
51
|
+
const updated = yield refreshToken();
|
|
52
|
+
if ((_a = updated === null || updated === void 0 ? void 0 : updated.jwt) === null || _a === void 0 ? void 0 : _a.id_token) {
|
|
53
|
+
idToken = (_b = updated === null || updated === void 0 ? void 0 : updated.jwt) === null || _b === void 0 ? void 0 : _b.id_token;
|
|
35
54
|
}
|
|
36
55
|
}
|
|
37
56
|
return idToken;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ag-common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.286",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"author": "Andrei Gec <@andreigec> (https://gec.dev/)",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"@types/react": "18.0.15",
|
|
47
47
|
"@types/react-dom": "18.0.6",
|
|
48
48
|
"@types/styled-components": "5.1.25",
|
|
49
|
-
"@typescript-eslint/eslint-plugin": "5.30.
|
|
50
|
-
"@typescript-eslint/parser": "5.30.
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "5.30.6",
|
|
50
|
+
"@typescript-eslint/parser": "5.30.6",
|
|
51
51
|
"cross-env": "7.0.3",
|
|
52
52
|
"eslint": "8.19.0",
|
|
53
53
|
"eslint-config-airbnb-typescript": "17.0.0",
|