asma-helpers 0.2.26 → 0.2.28
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/.prettierrc +15 -15
- package/.vscode/settings.json +39 -39
- package/README.md +0 -0
- package/lib/clients/srvAuth.d.ts +1 -1
- package/lib/clients/srvAuth.js +6 -6
- package/lib/global.d.ts +39 -39
- package/lib/global.js +4 -4
- package/lib/helpers/CapitalizeFistLetter.d.ts +2 -2
- package/lib/helpers/CapitalizeFistLetter.js +6 -6
- package/lib/helpers/Config.d.ts +5 -5
- package/lib/helpers/Config.js +44 -44
- package/lib/helpers/EnvironmentToOperateTypes.d.ts +7 -7
- package/lib/helpers/EnvironmentToOperateTypes.js +8 -8
- package/lib/helpers/EnvironmentsUrls.d.ts +93 -93
- package/lib/helpers/EnvironmentsUrls.js +89 -89
- package/lib/helpers/FormatNumberConstants.d.ts +24 -24
- package/lib/helpers/FormatNumberConstants.js +40 -40
- package/lib/helpers/InitializeIDBListenersOnMstSnapshots.d.ts +1 -1
- package/lib/helpers/InitializeIDBListenersOnMstSnapshots.js +49 -49
- package/lib/helpers/InitializeIDBListenersOnMstSnapshotsThenCatch.d.ts +8 -8
- package/lib/helpers/InitializeIDBListenersOnMstSnapshotsThenCatch.js +68 -68
- package/lib/helpers/IsAdcuris.d.ts +2 -2
- package/lib/helpers/IsAdcuris.js +4 -4
- package/lib/helpers/IsNotEmpty.d.ts +1 -1
- package/lib/helpers/IsNotEmpty.js +3 -3
- package/lib/helpers/NorwegianPostalCodes.d.ts +8 -8
- package/lib/helpers/NorwegianPostalCodes.js +3 -3
- package/lib/helpers/ProcessServerError.d.ts +2 -2
- package/lib/helpers/ProcessServerError.js +100 -100
- package/lib/helpers/attachUserJournalCredentials.d.ts +2 -0
- package/lib/helpers/attachUserJournalCredentials.d.ts.map +1 -0
- package/lib/helpers/attachUserJournalCredentials.js +17 -0
- package/lib/helpers/attachUserJournalCredentials.js.map +1 -0
- package/lib/helpers/base64ToFile.d.ts +1 -1
- package/lib/helpers/base64ToFile.js +8 -8
- package/lib/helpers/clearCacheData.d.ts +1 -1
- package/lib/helpers/clearCacheData.js +12 -12
- package/lib/helpers/generateEnvConfigsBindings.d.ts +30 -30
- package/lib/helpers/generateEnvConfigsBindings.js +48 -48
- package/lib/helpers/generateGenqlClient.d.ts +18 -18
- package/lib/helpers/generateGenqlClient.js +56 -56
- package/lib/helpers/generateSrvAuthBindings.d.ts +36 -37
- package/lib/helpers/generateSrvAuthBindings.d.ts.map +1 -1
- package/lib/helpers/generateSrvAuthBindings.js +153 -148
- package/lib/helpers/generateSrvAuthBindings.js.map +1 -1
- package/lib/helpers/getGqlOperationName.d.ts +1 -1
- package/lib/helpers/getGqlOperationName.js +15 -15
- package/lib/helpers/getSubdomain.d.ts +12 -12
- package/lib/helpers/getSubdomain.js +39 -39
- package/lib/helpers/isValidUrl.d.ts +1 -1
- package/lib/helpers/isValidUrl.js +9 -9
- package/lib/helpers/parseJwt.d.ts +1 -1
- package/lib/helpers/parseJwt.js +7 -7
- package/lib/helpers/userTypingSignal.d.ts +4 -4
- package/lib/helpers/userTypingSignal.js +32 -32
- package/lib/index.d.ts +27 -27
- package/lib/index.js +25 -25
- package/lib/interfaces/api/advoca/ISaveToDataBase.d.ts +16 -16
- package/lib/interfaces/api/advoca/ISaveToDataBase.js +1 -1
- package/lib/interfaces/api/advoca/IUploadedDocument.d.ts +26 -26
- package/lib/interfaces/api/advoca/IUploadedDocument.js +1 -1
- package/lib/interfaces/enums.d.ts +50 -50
- package/lib/interfaces/enums.js +59 -59
- package/lib/utility/fetch.d.ts +1 -1
- package/lib/utility/fetch.js +5 -5
- package/package.json +29 -29
- package/src/clients/srvAuth.ts +6 -6
- package/src/global.ts +45 -45
- package/src/helpers/CapitalizeFistLetter.ts +7 -7
- package/src/helpers/Config.ts +58 -58
- package/src/helpers/EnvironmentToOperateTypes.ts +6 -6
- package/src/helpers/EnvironmentsUrls.ts +102 -102
- package/src/helpers/FormatNumberConstants.ts +41 -41
- package/src/helpers/InitializeIDBListenersOnMstSnapshots.ts +62 -62
- package/src/helpers/InitializeIDBListenersOnMstSnapshotsThenCatch.ts +82 -82
- package/src/helpers/IsAdcuris.ts +4 -4
- package/src/helpers/IsNotEmpty.ts +2 -2
- package/src/helpers/NorwegianPostalCodes.ts +6 -6
- package/src/helpers/ProcessServerError.ts +92 -92
- package/src/helpers/attachUserJournalCredentials.ts +23 -0
- package/src/helpers/base64ToFile.ts +9 -9
- package/src/helpers/clearCacheData.ts +15 -15
- package/src/helpers/generateEnvConfigsBindings.ts +82 -82
- package/src/helpers/generateGenqlClient.ts +85 -85
- package/src/helpers/generateSrvAuthBindings.ts +204 -233
- package/src/helpers/getGqlOperationName.ts +20 -20
- package/src/helpers/getSubdomain.ts +50 -50
- package/src/helpers/isValidUrl.ts +12 -12
- package/src/helpers/parseJwt.ts +10 -10
- package/src/index.ts +33 -33
- package/src/interfaces/api/advoca/ISaveToDataBase.ts +17 -17
- package/src/interfaces/api/advoca/IUploadedDocument.ts +23 -23
- package/src/interfaces/enums.ts +56 -56
- package/src/utility/fetch.ts +9 -9
- package/tsconfig.json +84 -84
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
import { AxiosResponse, ResponseType } from 'axios';
|
|
2
|
-
import { EnvironmentEnums } from '..';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* @
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
34
|
-
* @
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export declare function generateSrvAuthBindingsMicroApp(SRV_AUTH: () => string, DEVELOPMENT: () => boolean, ENVIRONMENT_TO_OPERATE: () => EnvironmentEnums, logout?: () => void): {};
|
|
1
|
+
import { AxiosResponse, ResponseType } from 'axios';
|
|
2
|
+
import { EnvironmentEnums } from '..';
|
|
3
|
+
export declare function generateSrvAuthBindings<FeatureEnums = never>(SRV_AUTH: () => string, DEVELOPMENT: () => boolean, EnvironmentToOperateFn: () => string, logout?: () => void): {
|
|
4
|
+
hasFeature: (featureName: FeatureEnums) => boolean;
|
|
5
|
+
getFeatures: () => Set<FeatureEnums> | undefined;
|
|
6
|
+
isJwtValid: () => boolean;
|
|
7
|
+
signin: (url: string, headers?: Record<string, string>) => Promise<{
|
|
8
|
+
token: string;
|
|
9
|
+
features: FeatureEnums[];
|
|
10
|
+
}>;
|
|
11
|
+
srvAuthGet: <R>(url: string, headers?: Record<string, string>) => Promise<AxiosResponse<R, any>>;
|
|
12
|
+
signoutAuth: () => Promise<void>;
|
|
13
|
+
setReqConfig: <T = unknown>(data?: T | undefined, responseType?: ResponseType) => Promise<{
|
|
14
|
+
data: T | undefined;
|
|
15
|
+
responseType: ResponseType | undefined;
|
|
16
|
+
headers: Record<string, string>;
|
|
17
|
+
}>;
|
|
18
|
+
getJwtTokenAsync: () => Promise<string>;
|
|
19
|
+
getNewJwtToken: () => Promise<string>;
|
|
20
|
+
getUserId: () => string;
|
|
21
|
+
getParsedJwt: <R_1 = {
|
|
22
|
+
user_id: string;
|
|
23
|
+
exp: number;
|
|
24
|
+
}>() => R_1 | undefined;
|
|
25
|
+
getJwtToken: () => string;
|
|
26
|
+
accessTokenHasExpired: () => boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated use generateSrvAuthBindings
|
|
30
|
+
* @param SRV_AUTH
|
|
31
|
+
* @param DEVELOPMENT
|
|
32
|
+
* @param ENVIRONMENT_TO_OPERATE
|
|
33
|
+
* @param logout
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
export declare function generateSrvAuthBindingsMicroApp(SRV_AUTH: () => string, DEVELOPMENT: () => boolean, ENVIRONMENT_TO_OPERATE: () => EnvironmentEnums, logout?: () => void): {};
|
|
38
37
|
//# sourceMappingURL=generateSrvAuthBindings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateSrvAuthBindings.d.ts","sourceRoot":"","sources":["../../src/helpers/generateSrvAuthBindings.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAY,MAAM,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"generateSrvAuthBindings.d.ts","sourceRoot":"","sources":["../../src/helpers/generateSrvAuthBindings.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAY,MAAM,IAAI,CAAA;AAE/C,wBAAgB,uBAAuB,CAAC,YAAY,GAAG,KAAK,EACxD,QAAQ,EAAE,MAAM,MAAM,EACtB,WAAW,EAAE,MAAM,OAAO,EAC1B,sBAAsB,EAAE,MAAM,MAAM,EACpC,MAAM,CAAC,EAAE,MAAM,IAAI;8BAyJc,YAAY;;;kBAjGlB,MAAM,YAAY,OAAO,MAAM,EAAE,MAAM,CAAC;eACpB,MAAM;kBAAY,YAAY,EAAE;;yBAtC7C,MAAM,YAAY,OAAO,MAAM,EAAE,MAAM,CAAC;;qEAyER,YAAY;;;;;;;qBAxBxD,MAAM;;iBAuES,MAAM;aAAO,MAAM;;;iCA9FtB,OAAO;EAoI5C;AACD;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAC3C,QAAQ,EAAE,MAAM,MAAM,EACtB,WAAW,EAAE,MAAM,OAAO,EAC1B,sBAAsB,EAAE,MAAM,gBAAgB,EAC9C,MAAM,CAAC,EAAE,MAAM,IAAI,MAMtB"}
|
|
@@ -1,149 +1,154 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { EnvironmentEnums, parseJwt } from '..';
|
|
3
|
-
export function generateSrvAuthBindings(SRV_AUTH, DEVELOPMENT, EnvironmentToOperateFn, logout) {
|
|
4
|
-
var _a;
|
|
5
|
-
if ((_a = window.__ASMA__SHELL__) === null || _a === void 0 ? void 0 : _a.auth_bindings) {
|
|
6
|
-
return window.__ASMA__SHELL__.auth_bindings;
|
|
7
|
-
}
|
|
8
|
-
let jwtToken = '';
|
|
9
|
-
let features;
|
|
10
|
-
let parsed_jwt;
|
|
11
|
-
let fetchJwtPromise = null;
|
|
12
|
-
const isJwtInvalid = () => (jwtToken && accessTokenHasExpired()) || !jwtToken;
|
|
13
|
-
const isJwtValid = () => !isJwtInvalid();
|
|
14
|
-
async function srvAuthGet(url, headers) {
|
|
15
|
-
if (DEVELOPMENT() && EnvironmentToOperateFn()) {
|
|
16
|
-
if (EnvironmentToOperateFn() in EnvironmentEnums) {
|
|
17
|
-
url = `${url}&env=${EnvironmentToOperateFn()}`;
|
|
18
|
-
url = url.includes('&') && !url.includes('?') ? url.replace('&', '?') : url;
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
console.warn('EnvironmentToOperateFn() is not a valid EnvironmentEnums', 'shall be one of:', EnvironmentEnums, 'actual value:', EnvironmentToOperateFn());
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return axios.get(`${SRV_AUTH()}${url}`, {
|
|
25
|
-
headers: {
|
|
26
|
-
...headers,
|
|
27
|
-
'asma-origin': window.location.origin,
|
|
28
|
-
},
|
|
29
|
-
withCredentials: true,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
function accessTokenHasExpired() {
|
|
33
|
-
const tokenObj = getParsedJwt();
|
|
34
|
-
const accessTokenExpDate = (tokenObj === null || tokenObj === void 0 ? void 0 : tokenObj.exp) || 0;
|
|
35
|
-
const nowTime = Math.floor(new Date().getTime() / 1000);
|
|
36
|
-
//set exp time -20sec for token to be refreshed early
|
|
37
|
-
return accessTokenExpDate - 10 <= nowTime;
|
|
38
|
-
}
|
|
39
|
-
async function signin(url, headers) {
|
|
40
|
-
const { data } = await srvAuthGet(url, headers);
|
|
41
|
-
setAuthData(data);
|
|
42
|
-
return data;
|
|
43
|
-
}
|
|
44
|
-
async function signoutAuth() {
|
|
45
|
-
setAuthData({ token: '' });
|
|
46
|
-
await srvAuthGet('/signout');
|
|
47
|
-
}
|
|
48
|
-
function getUserId() {
|
|
49
|
-
var _a;
|
|
50
|
-
return ((_a = getParsedJwt()) === null || _a === void 0 ? void 0 : _a['user_id']) || '-1';
|
|
51
|
-
}
|
|
52
|
-
function setAuthData(data) {
|
|
53
|
-
jwtToken = data.token;
|
|
54
|
-
features = new Set(data.features);
|
|
55
|
-
parsed_jwt = undefined;
|
|
56
|
-
}
|
|
57
|
-
function getJwtToken() {
|
|
58
|
-
return jwtToken;
|
|
59
|
-
}
|
|
60
|
-
async function getJwtTokenAsync() {
|
|
61
|
-
if (isJwtInvalid()) {
|
|
62
|
-
const new_jwt = await getNewJwtToken();
|
|
63
|
-
return new_jwt;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
return jwtToken;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async function setReqConfig(data, responseType) {
|
|
70
|
-
const token = await getJwtTokenAsync();
|
|
71
|
-
const res = {
|
|
72
|
-
data: data,
|
|
73
|
-
responseType: responseType,
|
|
74
|
-
headers: {},
|
|
75
|
-
};
|
|
76
|
-
if (token) {
|
|
77
|
-
res.headers['Authorization'] = `Bearer ${token}`;
|
|
78
|
-
}
|
|
79
|
-
return res;
|
|
80
|
-
}
|
|
81
|
-
async function getNewJwtToken() {
|
|
82
|
-
try {
|
|
83
|
-
if (!fetchJwtPromise) {
|
|
84
|
-
fetchJwtPromise = srvAuthGet('/token');
|
|
85
|
-
}
|
|
86
|
-
const { data } = await fetchJwtPromise;
|
|
87
|
-
if (!data || data.errors || data.message != 'Success') {
|
|
88
|
-
(logout === null || logout === void 0 ? void 0 : logout()) || signoutAuth();
|
|
89
|
-
}
|
|
90
|
-
if (!data.token) {
|
|
91
|
-
throw new Error('Token is not present in the result');
|
|
92
|
-
}
|
|
93
|
-
setAuthData({ token: data.token || '', features: data.features || [] });
|
|
94
|
-
fetchJwtPromise = null;
|
|
95
|
-
return jwtToken;
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
(logout === null || logout === void 0 ? void 0 : logout()) || signoutAuth();
|
|
99
|
-
//signoutAuth()
|
|
100
|
-
fetchJwtPromise = null;
|
|
101
|
-
console.error(error);
|
|
102
|
-
return jwtToken;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
function getParsedJwt() {
|
|
106
|
-
if (!parsed_jwt) {
|
|
107
|
-
parsed_jwt = parseJwt(jwtToken);
|
|
108
|
-
}
|
|
109
|
-
return parsed_jwt;
|
|
110
|
-
}
|
|
111
|
-
function getFeatures() {
|
|
112
|
-
return features;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
* @
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { EnvironmentEnums, parseJwt } from '..';
|
|
3
|
+
export function generateSrvAuthBindings(SRV_AUTH, DEVELOPMENT, EnvironmentToOperateFn, logout) {
|
|
4
|
+
var _a;
|
|
5
|
+
if ((_a = window.__ASMA__SHELL__) === null || _a === void 0 ? void 0 : _a.auth_bindings) {
|
|
6
|
+
return window.__ASMA__SHELL__.auth_bindings;
|
|
7
|
+
}
|
|
8
|
+
let jwtToken = '';
|
|
9
|
+
let features;
|
|
10
|
+
let parsed_jwt;
|
|
11
|
+
let fetchJwtPromise = null;
|
|
12
|
+
const isJwtInvalid = () => (jwtToken && accessTokenHasExpired()) || !jwtToken;
|
|
13
|
+
const isJwtValid = () => !isJwtInvalid();
|
|
14
|
+
async function srvAuthGet(url, headers) {
|
|
15
|
+
if (DEVELOPMENT() && EnvironmentToOperateFn()) {
|
|
16
|
+
if (EnvironmentToOperateFn() in EnvironmentEnums) {
|
|
17
|
+
url = `${url}&env=${EnvironmentToOperateFn()}`;
|
|
18
|
+
url = url.includes('&') && !url.includes('?') ? url.replace('&', '?') : url;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
console.warn('EnvironmentToOperateFn() is not a valid EnvironmentEnums', 'shall be one of:', EnvironmentEnums, 'actual value:', EnvironmentToOperateFn());
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return axios.get(`${SRV_AUTH()}${url}`, {
|
|
25
|
+
headers: {
|
|
26
|
+
...headers,
|
|
27
|
+
'asma-origin': window.location.origin,
|
|
28
|
+
},
|
|
29
|
+
withCredentials: true,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function accessTokenHasExpired() {
|
|
33
|
+
const tokenObj = getParsedJwt();
|
|
34
|
+
const accessTokenExpDate = (tokenObj === null || tokenObj === void 0 ? void 0 : tokenObj.exp) || 0;
|
|
35
|
+
const nowTime = Math.floor(new Date().getTime() / 1000);
|
|
36
|
+
//set exp time -20sec for token to be refreshed early
|
|
37
|
+
return accessTokenExpDate - 10 <= nowTime;
|
|
38
|
+
}
|
|
39
|
+
async function signin(url, headers) {
|
|
40
|
+
const { data } = await srvAuthGet(url, headers);
|
|
41
|
+
setAuthData(data);
|
|
42
|
+
return data;
|
|
43
|
+
}
|
|
44
|
+
async function signoutAuth() {
|
|
45
|
+
setAuthData({ token: '' });
|
|
46
|
+
await srvAuthGet('/signout');
|
|
47
|
+
}
|
|
48
|
+
function getUserId() {
|
|
49
|
+
var _a;
|
|
50
|
+
return ((_a = getParsedJwt()) === null || _a === void 0 ? void 0 : _a['user_id']) || '-1';
|
|
51
|
+
}
|
|
52
|
+
function setAuthData(data) {
|
|
53
|
+
jwtToken = data.token;
|
|
54
|
+
features = new Set(data.features);
|
|
55
|
+
parsed_jwt = undefined;
|
|
56
|
+
}
|
|
57
|
+
function getJwtToken() {
|
|
58
|
+
return jwtToken;
|
|
59
|
+
}
|
|
60
|
+
async function getJwtTokenAsync() {
|
|
61
|
+
if (isJwtInvalid()) {
|
|
62
|
+
const new_jwt = await getNewJwtToken();
|
|
63
|
+
return new_jwt;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
return jwtToken;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function setReqConfig(data, responseType) {
|
|
70
|
+
const token = await getJwtTokenAsync();
|
|
71
|
+
const res = {
|
|
72
|
+
data: data,
|
|
73
|
+
responseType: responseType,
|
|
74
|
+
headers: {},
|
|
75
|
+
};
|
|
76
|
+
if (token) {
|
|
77
|
+
res.headers['Authorization'] = `Bearer ${token}`;
|
|
78
|
+
}
|
|
79
|
+
return res;
|
|
80
|
+
}
|
|
81
|
+
async function getNewJwtToken() {
|
|
82
|
+
try {
|
|
83
|
+
if (!fetchJwtPromise) {
|
|
84
|
+
fetchJwtPromise = srvAuthGet('/token');
|
|
85
|
+
}
|
|
86
|
+
const { data } = await fetchJwtPromise;
|
|
87
|
+
if (!data || data.errors || data.message != 'Success') {
|
|
88
|
+
(logout === null || logout === void 0 ? void 0 : logout()) || signoutAuth();
|
|
89
|
+
}
|
|
90
|
+
if (!data.token) {
|
|
91
|
+
throw new Error('Token is not present in the result');
|
|
92
|
+
}
|
|
93
|
+
setAuthData({ token: data.token || '', features: data.features || [] });
|
|
94
|
+
fetchJwtPromise = null;
|
|
95
|
+
return jwtToken;
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
(logout === null || logout === void 0 ? void 0 : logout()) || signoutAuth();
|
|
99
|
+
//signoutAuth()
|
|
100
|
+
fetchJwtPromise = null;
|
|
101
|
+
console.error(error);
|
|
102
|
+
return jwtToken;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function getParsedJwt() {
|
|
106
|
+
if (!parsed_jwt) {
|
|
107
|
+
parsed_jwt = parseJwt(jwtToken);
|
|
108
|
+
}
|
|
109
|
+
return parsed_jwt;
|
|
110
|
+
}
|
|
111
|
+
function getFeatures() {
|
|
112
|
+
return features;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
*
|
|
116
|
+
* @param featureName feature_name_enums add this: generateSrvAuthBindings<feature_name_enums.>(...)
|
|
117
|
+
* @returns boolean
|
|
118
|
+
*/
|
|
119
|
+
function hasFeature(featureName) {
|
|
120
|
+
return !!(features === null || features === void 0 ? void 0 : features.has(featureName));
|
|
121
|
+
}
|
|
122
|
+
const auth_bindings = {
|
|
123
|
+
hasFeature,
|
|
124
|
+
getFeatures,
|
|
125
|
+
isJwtValid,
|
|
126
|
+
signin,
|
|
127
|
+
srvAuthGet,
|
|
128
|
+
signoutAuth,
|
|
129
|
+
setReqConfig,
|
|
130
|
+
getJwtTokenAsync,
|
|
131
|
+
getNewJwtToken,
|
|
132
|
+
getUserId,
|
|
133
|
+
getParsedJwt,
|
|
134
|
+
getJwtToken,
|
|
135
|
+
accessTokenHasExpired,
|
|
136
|
+
};
|
|
137
|
+
window.__ASMA__SHELL__ = window.__ASMA__SHELL__ || {};
|
|
138
|
+
window.__ASMA__SHELL__.auth_bindings = auth_bindings;
|
|
139
|
+
return auth_bindings;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* @deprecated use generateSrvAuthBindings
|
|
143
|
+
* @param SRV_AUTH
|
|
144
|
+
* @param DEVELOPMENT
|
|
145
|
+
* @param ENVIRONMENT_TO_OPERATE
|
|
146
|
+
* @param logout
|
|
147
|
+
* @returns
|
|
148
|
+
*/
|
|
149
|
+
export function generateSrvAuthBindingsMicroApp(SRV_AUTH, DEVELOPMENT, ENVIRONMENT_TO_OPERATE, logout) {
|
|
150
|
+
var _a;
|
|
151
|
+
return (((_a = window.__ASMA__SHELL__) === null || _a === void 0 ? void 0 : _a.auth_bindings) ||
|
|
152
|
+
generateSrvAuthBindings(SRV_AUTH, DEVELOPMENT, ENVIRONMENT_TO_OPERATE, logout));
|
|
153
|
+
}
|
|
149
154
|
//# sourceMappingURL=generateSrvAuthBindings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateSrvAuthBindings.js","sourceRoot":"","sources":["../../src/helpers/generateSrvAuthBindings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"generateSrvAuthBindings.js","sourceRoot":"","sources":["../../src/helpers/generateSrvAuthBindings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAA;AAE/C,MAAM,UAAU,uBAAuB,CACnC,QAAsB,EACtB,WAA0B,EAC1B,sBAAoC,EACpC,MAAmB;;IAEnB,IAAI,MAAA,MAAM,CAAC,eAAe,0CAAE,aAAa,EAAE;QACvC,OAAO,MAAM,CAAC,eAAe,CAAC,aAAqC,CAAA;KACtE;IACD,IAAI,QAAQ,GAAG,EAAE,CAAA;IAEjB,IAAI,QAAuC,CAAA;IAE3C,IAAI,UAA2B,CAAA;IAE/B,IAAI,eAAe,GAEP,IAAI,CAAA;IAEhB,MAAM,YAA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AC,WAAW,CAAC,CAAA,CAAA;IACvC,CAAC;IAED,MAAM,aAAa,GAAG;QAClB,UAAU;QACV,WAAW;QACX,UAAU;QACV,MAAM;QACN,UAAU;QACV,WAAW;QACX,YAAY;QACZ,gBAAgB;QAChB,cAAc;QACd,SAAS;QACT,YAAY;QACZ,WAAW;QACX,qBAAqB;KACxB,CAAA;IACD,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,EAAE,CAAA;IAErD,MAAM,CAAC,eAAe,CAAC,aAAa,GAAG,aAAa,CAAA;IAEpD,OAAO,aAAa,CAAA;AACxB,CAAC;AACD;;;;;;;GAOG;AACH,MAAM,UAAU,+BAA+B,CAC3C,QAAsB,EACtB,WAA0B,EAC1B,sBAA8C,EAC9C,MAAmB;;IAEnB,OAAO,CACH,CAAA,MAAA,MAAM,CAAC,eAAe,0CAAE,aAAa;QACrC,uBAAuB,CAAC,QAAQ,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,CAAC,CACjF,CAAA;AACL,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function getGqlOperationName(query: string): string | undefined;
|
|
1
|
+
export declare function getGqlOperationName(query: string): string | undefined;
|
|
2
2
|
//# sourceMappingURL=getGqlOperationName.d.ts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export function getGqlOperationName(query) {
|
|
2
|
-
var _a, _b, _c, _d, _e;
|
|
3
|
-
const is_query = query.includes('query') ? 'query' : undefined;
|
|
4
|
-
const is_mutation = query.includes('mutation') ? 'mutation' : undefined;
|
|
5
|
-
const is_subscription = query.includes('subscription') ? 'subscription' : undefined;
|
|
6
|
-
const split_word = is_query || is_mutation || is_subscription;
|
|
7
|
-
if (!split_word) {
|
|
8
|
-
return undefined;
|
|
9
|
-
}
|
|
10
|
-
let operationName = (_e = (_d = (_c = (_b = (_a = query === null || query === void 0 ? void 0 : query.split(split_word, 2)) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b.split('{', 1)[0]) === null || _c === void 0 ? void 0 : _c.split(' ')) === null || _d === void 0 ? void 0 : _d[1]) === null || _e === void 0 ? void 0 : _e.trim();
|
|
11
|
-
if (operationName === null || operationName === void 0 ? void 0 : operationName.includes('(')) {
|
|
12
|
-
operationName = operationName.split('(', 1)[0];
|
|
13
|
-
}
|
|
14
|
-
return operationName;
|
|
15
|
-
}
|
|
1
|
+
export function getGqlOperationName(query) {
|
|
2
|
+
var _a, _b, _c, _d, _e;
|
|
3
|
+
const is_query = query.includes('query') ? 'query' : undefined;
|
|
4
|
+
const is_mutation = query.includes('mutation') ? 'mutation' : undefined;
|
|
5
|
+
const is_subscription = query.includes('subscription') ? 'subscription' : undefined;
|
|
6
|
+
const split_word = is_query || is_mutation || is_subscription;
|
|
7
|
+
if (!split_word) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
let operationName = (_e = (_d = (_c = (_b = (_a = query === null || query === void 0 ? void 0 : query.split(split_word, 2)) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b.split('{', 1)[0]) === null || _c === void 0 ? void 0 : _c.split(' ')) === null || _d === void 0 ? void 0 : _d[1]) === null || _e === void 0 ? void 0 : _e.trim();
|
|
11
|
+
if (operationName === null || operationName === void 0 ? void 0 : operationName.includes('(')) {
|
|
12
|
+
operationName = operationName.split('(', 1)[0];
|
|
13
|
+
}
|
|
14
|
+
return operationName;
|
|
15
|
+
}
|
|
16
16
|
//# sourceMappingURL=getGqlOperationName.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated moved to asma-genql-directory use from there
|
|
3
|
-
*/
|
|
4
|
-
export declare const subdomain: string;
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated moved to asma-genql-directory use from there
|
|
7
|
-
*/
|
|
8
|
-
export declare function redirectFromSubdomainToDomain(): null;
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated moved to asma-genql-directory use from there
|
|
11
|
-
*/
|
|
12
|
-
export declare function createDomainUrlFromSubdomain(): string;
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated moved to asma-genql-directory use from there
|
|
3
|
+
*/
|
|
4
|
+
export declare const subdomain: string;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated moved to asma-genql-directory use from there
|
|
7
|
+
*/
|
|
8
|
+
export declare function redirectFromSubdomainToDomain(): null;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated moved to asma-genql-directory use from there
|
|
11
|
+
*/
|
|
12
|
+
export declare function createDomainUrlFromSubdomain(): string;
|
|
13
13
|
//# sourceMappingURL=getSubdomain.d.ts.map
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated moved to asma-genql-directory use from there
|
|
3
|
-
*/
|
|
4
|
-
function getSubdomain() {
|
|
5
|
-
const hostname_arr = window.location.hostname.split('.'); // fretex-dfsf.advoca.no
|
|
6
|
-
let subdomain = '';
|
|
7
|
-
if (hostname_arr.length === 3 &&
|
|
8
|
-
hostname_arr[0] &&
|
|
9
|
-
!['dev', 'test', 'stage', 'intern', 'www'].find((sub) => sub === hostname_arr[0])) {
|
|
10
|
-
subdomain = hostname_arr[0];
|
|
11
|
-
const subdomain_arr = subdomain.split('-');
|
|
12
|
-
if (subdomain_arr.length === 2 && subdomain_arr[0]) {
|
|
13
|
-
subdomain = subdomain_arr[0];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return subdomain;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated moved to asma-genql-directory use from there
|
|
20
|
-
*/
|
|
21
|
-
export const subdomain = getSubdomain();
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated moved to asma-genql-directory use from there
|
|
24
|
-
*/
|
|
25
|
-
export function redirectFromSubdomainToDomain() {
|
|
26
|
-
const domain_hostname = `${createDomainUrlFromSubdomain()}${window.location.pathname}`;
|
|
27
|
-
window.location.href = domain_hostname;
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated moved to asma-genql-directory use from there
|
|
32
|
-
*/
|
|
33
|
-
export function createDomainUrlFromSubdomain() {
|
|
34
|
-
let hostname = window.location.hostname.replace(subdomain, '');
|
|
35
|
-
(hostname.startsWith('-') && (hostname = hostname.substring(1))) ||
|
|
36
|
-
(hostname.startsWith('.') && (hostname = 'www' + hostname));
|
|
37
|
-
const { port, protocol } = window.location;
|
|
38
|
-
return protocol + '//' + hostname + (port ? `:${port}` : '');
|
|
39
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated moved to asma-genql-directory use from there
|
|
3
|
+
*/
|
|
4
|
+
function getSubdomain() {
|
|
5
|
+
const hostname_arr = window.location.hostname.split('.'); // fretex-dfsf.advoca.no
|
|
6
|
+
let subdomain = '';
|
|
7
|
+
if (hostname_arr.length === 3 &&
|
|
8
|
+
hostname_arr[0] &&
|
|
9
|
+
!['dev', 'test', 'stage', 'intern', 'www'].find((sub) => sub === hostname_arr[0])) {
|
|
10
|
+
subdomain = hostname_arr[0];
|
|
11
|
+
const subdomain_arr = subdomain.split('-');
|
|
12
|
+
if (subdomain_arr.length === 2 && subdomain_arr[0]) {
|
|
13
|
+
subdomain = subdomain_arr[0];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return subdomain;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated moved to asma-genql-directory use from there
|
|
20
|
+
*/
|
|
21
|
+
export const subdomain = getSubdomain();
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated moved to asma-genql-directory use from there
|
|
24
|
+
*/
|
|
25
|
+
export function redirectFromSubdomainToDomain() {
|
|
26
|
+
const domain_hostname = `${createDomainUrlFromSubdomain()}${window.location.pathname}`;
|
|
27
|
+
window.location.href = domain_hostname;
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated moved to asma-genql-directory use from there
|
|
32
|
+
*/
|
|
33
|
+
export function createDomainUrlFromSubdomain() {
|
|
34
|
+
let hostname = window.location.hostname.replace(subdomain, '');
|
|
35
|
+
(hostname.startsWith('-') && (hostname = hostname.substring(1))) ||
|
|
36
|
+
(hostname.startsWith('.') && (hostname = 'www' + hostname));
|
|
37
|
+
const { port, protocol } = window.location;
|
|
38
|
+
return protocol + '//' + hostname + (port ? `:${port}` : '');
|
|
39
|
+
}
|
|
40
40
|
//# sourceMappingURL=getSubdomain.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function isValidUrl(urlString: string): boolean;
|
|
1
|
+
export declare function isValidUrl(urlString: string): boolean;
|
|
2
2
|
//# sourceMappingURL=isValidUrl.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export function isValidUrl(urlString) {
|
|
2
|
-
const urlPattern = new RegExp('^(https?:\\/\\/)?' + // validate protocol
|
|
3
|
-
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // validate domain name
|
|
4
|
-
'((\\d{1,3}\\.){3}\\d{1,3}))' + // validate OR ip (v4) address
|
|
5
|
-
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // validate port and path
|
|
6
|
-
'(\\?[;&a-z\\d%_.~+=-]*)?' + // validate query string
|
|
7
|
-
'(\\#[-a-z\\d_]*)?$', 'i');
|
|
8
|
-
return !!urlPattern.test(urlString);
|
|
9
|
-
}
|
|
1
|
+
export function isValidUrl(urlString) {
|
|
2
|
+
const urlPattern = new RegExp('^(https?:\\/\\/)?' + // validate protocol
|
|
3
|
+
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // validate domain name
|
|
4
|
+
'((\\d{1,3}\\.){3}\\d{1,3}))' + // validate OR ip (v4) address
|
|
5
|
+
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // validate port and path
|
|
6
|
+
'(\\?[;&a-z\\d%_.~+=-]*)?' + // validate query string
|
|
7
|
+
'(\\#[-a-z\\d_]*)?$', 'i');
|
|
8
|
+
return !!urlPattern.test(urlString);
|
|
9
|
+
}
|
|
10
10
|
//# sourceMappingURL=isValidUrl.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function parseJwt<R>(jwtToken: string): R | undefined;
|
|
1
|
+
export declare function parseJwt<R>(jwtToken: string): R | undefined;
|
|
2
2
|
//# sourceMappingURL=parseJwt.d.ts.map
|
package/lib/helpers/parseJwt.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export function parseJwt(jwtToken) {
|
|
2
|
-
const base64Url = jwtToken === null || jwtToken === void 0 ? void 0 : jwtToken.split('.')[1];
|
|
3
|
-
if (base64Url === undefined) {
|
|
4
|
-
return {};
|
|
5
|
-
}
|
|
6
|
-
return JSON.parse(decodeURIComponent(escape(window.atob(base64Url))));
|
|
7
|
-
}
|
|
1
|
+
export function parseJwt(jwtToken) {
|
|
2
|
+
const base64Url = jwtToken === null || jwtToken === void 0 ? void 0 : jwtToken.split('.')[1];
|
|
3
|
+
if (base64Url === undefined) {
|
|
4
|
+
return {};
|
|
5
|
+
}
|
|
6
|
+
return JSON.parse(decodeURIComponent(escape(window.atob(base64Url))));
|
|
7
|
+
}
|
|
8
8
|
//# sourceMappingURL=parseJwt.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare function userTypingSignal(insertUserLastTyped: () => Promise<unknown>): {
|
|
2
|
-
initiateUserTyping: () => void;
|
|
3
|
-
setLastTyped: () => void;
|
|
4
|
-
};
|
|
1
|
+
export declare function userTypingSignal(insertUserLastTyped: () => Promise<unknown>): {
|
|
2
|
+
initiateUserTyping: () => void;
|
|
3
|
+
setLastTyped: () => void;
|
|
4
|
+
};
|
|
5
5
|
//# sourceMappingURL=userTypingSignal.d.ts.map
|