@sambath999/localize-token 12.0.3
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/README.md +57 -0
- package/bundles/sambath999-localize-token.umd.js +1112 -0
- package/bundles/sambath999-localize-token.umd.js.map +1 -0
- package/esm2015/lib/index.js +6 -0
- package/esm2015/lib/localize.api.service.js +152 -0
- package/esm2015/lib/localize.token.js +59 -0
- package/esm2015/lib/localize.token.module.js +10 -0
- package/esm2015/lib/localize.token.service.js +62 -0
- package/esm2015/lib/localize.token.storage.js +101 -0
- package/esm2015/public-api.js +2 -0
- package/esm2015/sambath999-localize-token.js +5 -0
- package/fesm2015/sambath999-localize-token.js +379 -0
- package/fesm2015/sambath999-localize-token.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/localize.api.service.d.ts +59 -0
- package/lib/localize.token.d.ts +35 -0
- package/lib/localize.token.module.d.ts +2 -0
- package/lib/localize.token.service.d.ts +26 -0
- package/lib/localize.token.storage.d.ts +61 -0
- package/package.json +36 -0
- package/public-api.d.ts +1 -0
- package/sambath999-localize-token.d.ts +4 -0
- package/sambath999-localize-token.metadata.json +1 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ICookieOptions, LocalizeTokenStorageHelper } from "./localize.token.storage";
|
|
2
|
+
interface ILocalizeTokenConfig {
|
|
3
|
+
mainDomain: string;
|
|
4
|
+
authTokenName: string;
|
|
5
|
+
tenantTokenName: string;
|
|
6
|
+
refreshTokenName: string;
|
|
7
|
+
needTenant: boolean;
|
|
8
|
+
isProduction: boolean;
|
|
9
|
+
revokeTokenUrl?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class LocalizeToken {
|
|
12
|
+
static config: ILocalizeTokenConfig;
|
|
13
|
+
static cookieOptions: ICookieOptions;
|
|
14
|
+
static readonly storage: LocalizeTokenStorageHelper;
|
|
15
|
+
static readonly httpHeaders: {
|
|
16
|
+
AUTHORIZATION: string;
|
|
17
|
+
X_TENANT: string;
|
|
18
|
+
X_REFRESH_TOKEN: string;
|
|
19
|
+
CONTENT_TYPE: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Waits for a specified amount of time.
|
|
24
|
+
* @param milliseconds - The milliseconds to wait.
|
|
25
|
+
* @param when - The condition to wait for. Default is true.
|
|
26
|
+
* @returns - Promise<void>
|
|
27
|
+
*/
|
|
28
|
+
export declare function waitFor(milliseconds: number, when?: boolean): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Waits until the condition is met.
|
|
31
|
+
* @param when - The condition to wait for.
|
|
32
|
+
* @param intervalNumber - The interval number in milliseconds to check the condition. Default is 50.
|
|
33
|
+
*/
|
|
34
|
+
export declare function waitUntil(when: () => any, intervalNumber?: number): Promise<void>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BehaviorSubject } from 'rxjs';
|
|
2
|
+
import * as jwt_decode from 'jwt-decode';
|
|
3
|
+
export interface JwtPayload extends jwt_decode.JwtPayload {
|
|
4
|
+
email: string;
|
|
5
|
+
sub: string;
|
|
6
|
+
name: string;
|
|
7
|
+
iat: number;
|
|
8
|
+
exp: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class LocalizeTokenService {
|
|
11
|
+
readonly isRevokingTokenSubject: BehaviorSubject<boolean>;
|
|
12
|
+
private get authToken();
|
|
13
|
+
private set authToken(value);
|
|
14
|
+
get refreshToken(): string;
|
|
15
|
+
get accessToken(): string | undefined;
|
|
16
|
+
set accessToken(value: string | undefined);
|
|
17
|
+
get isRevokingToken(): boolean;
|
|
18
|
+
set isRevokingToken(value: boolean);
|
|
19
|
+
get tenantToken(): string;
|
|
20
|
+
constructor();
|
|
21
|
+
private storageGet;
|
|
22
|
+
private storageSet;
|
|
23
|
+
tokensValid(): number | boolean;
|
|
24
|
+
decodeToken: (token: string) => JwtPayload;
|
|
25
|
+
get decodeRefreshToken(): JwtPayload;
|
|
26
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assembly of @package ng2-cookies @see https://www.npmjs.com/package/ng2-cookies
|
|
3
|
+
*
|
|
4
|
+
* Reassembled by
|
|
5
|
+
* @author sambath999
|
|
6
|
+
* @date_29_09_2021
|
|
7
|
+
* Updated from raw parameters to
|
|
8
|
+
* @param {ICookieOptions} options and added another newer cookie flag
|
|
9
|
+
* @param {string} samesite
|
|
10
|
+
* @param {constant} SameSiteTypes, @param {string} strict "strict", @param {string} lax "lax", @param {string} none "none"
|
|
11
|
+
*
|
|
12
|
+
* @enum
|
|
13
|
+
*/
|
|
14
|
+
export declare class LocalizeTokenStorageHelper {
|
|
15
|
+
/**
|
|
16
|
+
* Checks the existence of a single cookie by it's name
|
|
17
|
+
*
|
|
18
|
+
* @param {string} name Identification of the cookie
|
|
19
|
+
* @returns existence of the cookie
|
|
20
|
+
*/
|
|
21
|
+
check(name: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves a single cookie by it's name
|
|
24
|
+
*
|
|
25
|
+
* @param {string} name Identification of the Cookie
|
|
26
|
+
* @returns The Cookie's value
|
|
27
|
+
*/
|
|
28
|
+
get(name: string): string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves a a list of all cookie avaiable
|
|
31
|
+
*
|
|
32
|
+
* @returns Object with all Cookies
|
|
33
|
+
*/
|
|
34
|
+
getAll(): any;
|
|
35
|
+
get defaultOptions(): ICookieOptions;
|
|
36
|
+
set(name: string, value: string, options?: ICookieOptions): void;
|
|
37
|
+
/**
|
|
38
|
+
* Removes specified Cookie
|
|
39
|
+
*
|
|
40
|
+
* @param {string} name Cookie's identification
|
|
41
|
+
* @param {string} path Path relative to the domain where the cookie should be avaiable. Default /
|
|
42
|
+
* @param {string} domain Domain where the cookie should be avaiable. Default current domain
|
|
43
|
+
*/
|
|
44
|
+
delete(name: string, path?: string, domain?: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Delete all cookie avaiable
|
|
47
|
+
*/
|
|
48
|
+
deleteAll(path?: string, domain?: string): void;
|
|
49
|
+
}
|
|
50
|
+
export declare enum ISameSiteType {
|
|
51
|
+
strict = "strict",
|
|
52
|
+
lax = "lax",
|
|
53
|
+
none = "none"
|
|
54
|
+
}
|
|
55
|
+
export interface ICookieOptions {
|
|
56
|
+
expires?: number | Date;
|
|
57
|
+
path?: string;
|
|
58
|
+
domain?: string;
|
|
59
|
+
secure?: boolean;
|
|
60
|
+
samesite?: string;
|
|
61
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sambath999/localize-token",
|
|
3
|
+
"version": "12.0.3",
|
|
4
|
+
"description": "localize token client app",
|
|
5
|
+
"esm2020": "lib/esm2020/sambath999-localize-token.js",
|
|
6
|
+
"fesm2020": "lib/fesm2020/sambath999-localize-token.js",
|
|
7
|
+
"esm2015": "esm2015/sambath999-localize-token.js",
|
|
8
|
+
"fesm2015": "fesm2015/sambath999-localize-token.js",
|
|
9
|
+
"typings": "sambath999-localize-token.d.ts",
|
|
10
|
+
"main": "bundles/sambath999-localize-token.umd.js",
|
|
11
|
+
"types": "lib/index.d.ts",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/sambathM/localize-token.git"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"localize-token"
|
|
18
|
+
],
|
|
19
|
+
"author": "sambathM",
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/sambathM/localize-token/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/sambathM/localize-token#readme",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@angular/common": "^19.0.0",
|
|
27
|
+
"@angular/compiler": "^12.2.17",
|
|
28
|
+
"jwt-decode": "^4.0.0",
|
|
29
|
+
"rxjs": "^7.8.1",
|
|
30
|
+
"tslib": "^2.2.0"
|
|
31
|
+
},
|
|
32
|
+
"module": "fesm2015/sambath999-localize-token.js",
|
|
33
|
+
"es2015": "fesm2015/sambath999-localize-token.js",
|
|
34
|
+
"metadata": "sambath999-localize-token.metadata.json",
|
|
35
|
+
"sideEffects": false
|
|
36
|
+
}
|
package/public-api.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"__symbolic":"module","version":4,"exports":[{"from":"./localize.token.service"},{"from":"./localize.token"},{"from":"./localize.token.storage"},{"from":"./localize.token.module"},{"from":"./localize.api.service"}],"metadata":{},"origins":{},"importAs":"@sambath999/localize-token"}
|