@c-rex/core 0.0.1
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/index.d.mts +70 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +3022 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3014 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +37 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Method } from 'axios';
|
|
2
|
+
import winston from 'winston';
|
|
3
|
+
|
|
4
|
+
declare const ALL = "*";
|
|
5
|
+
declare const LOG_CATEGORIES: readonly ["NoLicense", "Scenario", "Favorites", "Subscription", "Share", "Document", "Search", "History", "Notification", "UserProfile"];
|
|
6
|
+
declare const LOG_LEVELS: {
|
|
7
|
+
readonly critical: 2;
|
|
8
|
+
readonly error: 3;
|
|
9
|
+
readonly warning: 4;
|
|
10
|
+
readonly info: 6;
|
|
11
|
+
readonly debug: 7;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type LogLevelType = keyof typeof LOG_LEVELS | typeof ALL;
|
|
15
|
+
type LogCategoriesType = typeof LOG_CATEGORIES[number] | typeof ALL;
|
|
16
|
+
|
|
17
|
+
interface logInfo {
|
|
18
|
+
silent: boolean;
|
|
19
|
+
minimumLevel: LogLevelType;
|
|
20
|
+
categoriesLevel: LogCategoriesType[];
|
|
21
|
+
url: string;
|
|
22
|
+
app: string;
|
|
23
|
+
}
|
|
24
|
+
interface ConfigInterface {
|
|
25
|
+
projectName: string;
|
|
26
|
+
baseUrl: string;
|
|
27
|
+
search: {
|
|
28
|
+
fields: string[];
|
|
29
|
+
tags: string[];
|
|
30
|
+
sparqlWhere?: string;
|
|
31
|
+
};
|
|
32
|
+
logs: {
|
|
33
|
+
console: logInfo;
|
|
34
|
+
graylog: logInfo;
|
|
35
|
+
matomo: logInfo;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare class CrexLogger {
|
|
40
|
+
private customerConfig;
|
|
41
|
+
logger: winston.Logger;
|
|
42
|
+
constructor(config: ConfigInterface);
|
|
43
|
+
log(level: LogLevelType, message: string, category?: LogCategoriesType): void;
|
|
44
|
+
private createLogger;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface CallParams {
|
|
48
|
+
url: string;
|
|
49
|
+
method: Method;
|
|
50
|
+
body?: any;
|
|
51
|
+
headers?: any;
|
|
52
|
+
params?: any;
|
|
53
|
+
}
|
|
54
|
+
declare class CrexApi {
|
|
55
|
+
private apiClient;
|
|
56
|
+
private logger;
|
|
57
|
+
constructor(baseUrl: string, logger: CrexLogger);
|
|
58
|
+
execute<T>({ url, method, params, body, headers, }: CallParams): Promise<any>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare class CrexSDK {
|
|
62
|
+
private static instance;
|
|
63
|
+
customerConfig: ConfigInterface;
|
|
64
|
+
logger: CrexLogger;
|
|
65
|
+
api: CrexApi;
|
|
66
|
+
constructor(config: ConfigInterface);
|
|
67
|
+
static getInstance(): CrexSDK;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { CrexSDK };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Method } from 'axios';
|
|
2
|
+
import winston from 'winston';
|
|
3
|
+
|
|
4
|
+
declare const ALL = "*";
|
|
5
|
+
declare const LOG_CATEGORIES: readonly ["NoLicense", "Scenario", "Favorites", "Subscription", "Share", "Document", "Search", "History", "Notification", "UserProfile"];
|
|
6
|
+
declare const LOG_LEVELS: {
|
|
7
|
+
readonly critical: 2;
|
|
8
|
+
readonly error: 3;
|
|
9
|
+
readonly warning: 4;
|
|
10
|
+
readonly info: 6;
|
|
11
|
+
readonly debug: 7;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type LogLevelType = keyof typeof LOG_LEVELS | typeof ALL;
|
|
15
|
+
type LogCategoriesType = typeof LOG_CATEGORIES[number] | typeof ALL;
|
|
16
|
+
|
|
17
|
+
interface logInfo {
|
|
18
|
+
silent: boolean;
|
|
19
|
+
minimumLevel: LogLevelType;
|
|
20
|
+
categoriesLevel: LogCategoriesType[];
|
|
21
|
+
url: string;
|
|
22
|
+
app: string;
|
|
23
|
+
}
|
|
24
|
+
interface ConfigInterface {
|
|
25
|
+
projectName: string;
|
|
26
|
+
baseUrl: string;
|
|
27
|
+
search: {
|
|
28
|
+
fields: string[];
|
|
29
|
+
tags: string[];
|
|
30
|
+
sparqlWhere?: string;
|
|
31
|
+
};
|
|
32
|
+
logs: {
|
|
33
|
+
console: logInfo;
|
|
34
|
+
graylog: logInfo;
|
|
35
|
+
matomo: logInfo;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare class CrexLogger {
|
|
40
|
+
private customerConfig;
|
|
41
|
+
logger: winston.Logger;
|
|
42
|
+
constructor(config: ConfigInterface);
|
|
43
|
+
log(level: LogLevelType, message: string, category?: LogCategoriesType): void;
|
|
44
|
+
private createLogger;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface CallParams {
|
|
48
|
+
url: string;
|
|
49
|
+
method: Method;
|
|
50
|
+
body?: any;
|
|
51
|
+
headers?: any;
|
|
52
|
+
params?: any;
|
|
53
|
+
}
|
|
54
|
+
declare class CrexApi {
|
|
55
|
+
private apiClient;
|
|
56
|
+
private logger;
|
|
57
|
+
constructor(baseUrl: string, logger: CrexLogger);
|
|
58
|
+
execute<T>({ url, method, params, body, headers, }: CallParams): Promise<any>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare class CrexSDK {
|
|
62
|
+
private static instance;
|
|
63
|
+
customerConfig: ConfigInterface;
|
|
64
|
+
logger: CrexLogger;
|
|
65
|
+
api: CrexApi;
|
|
66
|
+
constructor(config: ConfigInterface);
|
|
67
|
+
static getInstance(): CrexSDK;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { CrexSDK };
|