akeyless-server-commons 1.0.203 → 1.0.204
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/cjs/helpers/index.d.ts +0 -1
- package/dist/cjs/helpers/index.js +0 -1
- package/dist/cjs/helpers/index.js.map +1 -1
- package/dist/cjs/helpers/start.js +16 -18
- package/dist/cjs/helpers/start.js.map +1 -1
- package/dist/cjs/managers/index.d.ts +1 -0
- package/dist/cjs/managers/index.js +1 -0
- package/dist/cjs/managers/index.js.map +1 -1
- package/dist/cjs/managers/rabbitmq_manager.d.ts +60 -0
- package/dist/cjs/managers/rabbitmq_manager.js +190 -0
- package/dist/cjs/managers/rabbitmq_manager.js.map +1 -0
- package/dist/esm/helpers/index.d.ts +0 -1
- package/dist/esm/helpers/index.js +0 -1
- package/dist/esm/helpers/index.js.map +1 -1
- package/dist/esm/helpers/start.js +16 -18
- package/dist/esm/helpers/start.js.map +1 -1
- package/dist/esm/managers/index.d.ts +1 -0
- package/dist/esm/managers/index.js +1 -0
- package/dist/esm/managers/index.js.map +1 -1
- package/dist/esm/managers/rabbitmq_manager.d.ts +60 -0
- package/dist/esm/managers/rabbitmq_manager.js +183 -0
- package/dist/esm/managers/rabbitmq_manager.js.map +1 -0
- package/dist/helpers/boards_helpers.js +62 -0
- package/dist/helpers/email_helpers.js +153 -0
- package/dist/helpers/firebase_helpers.js +601 -0
- package/dist/helpers/global_helpers.js +147 -0
- package/dist/helpers/index.js +12 -0
- package/dist/helpers/location_helpers.js +15 -0
- package/dist/helpers/login_helpers.js +18 -0
- package/dist/helpers/notification_helpers.js +248 -0
- package/dist/helpers/phone_number_helpers.js +96 -0
- package/dist/helpers/redis/helpers.js +215 -0
- package/dist/helpers/redis/index.js +4 -0
- package/dist/helpers/redis/initialize.js +139 -0
- package/dist/helpers/redis/keys.js +23 -0
- package/dist/helpers/redis/snapshot.js +166 -0
- package/dist/helpers/start.js +83 -0
- package/dist/helpers/tasks_helpers.js +139 -0
- package/dist/helpers/time_helpers.js +167 -0
- package/dist/index.js +5 -0
- package/dist/managers/cache_manager.js +37 -0
- package/dist/managers/index.js +4 -0
- package/dist/managers/logger_manager.js +68 -0
- package/dist/managers/rabbitmq_manager.js +179 -0
- package/dist/managers/translation_manager.js +38 -0
- package/dist/middlewares/auth_mw.js +50 -0
- package/dist/middlewares/error_handling.js +20 -0
- package/dist/middlewares/global_mw.js +119 -0
- package/dist/middlewares/index.js +4 -0
- package/dist/middlewares/trim_mw.js +7 -0
- package/dist/test.js +1 -0
- package/dist/types/enums/global.js +8 -0
- package/dist/types/enums/index.js +1 -0
- package/dist/types/helpers/boards_helpers.d.ts +10 -0
- package/dist/types/helpers/email_helpers.d.ts +12 -0
- package/dist/types/helpers/firebase_helpers.d.ts +56 -0
- package/dist/types/helpers/global_helpers.d.ts +16 -0
- package/dist/types/helpers/index.d.ts +12 -0
- package/dist/types/helpers/location_helpers.d.ts +3 -0
- package/dist/types/helpers/login_helpers.d.ts +4 -0
- package/dist/types/helpers/notification_helpers.d.ts +11 -0
- package/dist/types/helpers/phone_number_helpers.d.ts +19 -0
- package/dist/types/helpers/redis/helpers.d.ts +11 -0
- package/dist/types/helpers/redis/index.d.ts +4 -0
- package/dist/types/helpers/redis/initialize.d.ts +6 -0
- package/dist/types/helpers/redis/keys.d.ts +5 -0
- package/dist/types/helpers/redis/snapshot.d.ts +2 -0
- package/dist/types/helpers/start.d.ts +4 -0
- package/dist/types/helpers/tasks_helpers.d.ts +25 -0
- package/dist/types/helpers/time_helpers.d.ts +40 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +3 -0
- package/dist/types/interfaces/email.js +1 -0
- package/dist/types/interfaces/global.js +1 -0
- package/dist/types/interfaces/index.js +2 -0
- package/dist/types/managers/cache_manager.d.ts +12 -0
- package/dist/types/managers/index.d.ts +4 -0
- package/dist/types/managers/logger_manager.d.ts +14 -0
- package/dist/types/managers/rabbitmq_manager.d.ts +60 -0
- package/dist/types/managers/translation_manager.d.ts +14 -0
- package/dist/types/middlewares/auth_mw.d.ts +4 -0
- package/dist/types/middlewares/error_handling.d.ts +11 -0
- package/dist/types/middlewares/global_mw.d.ts +5 -0
- package/dist/types/middlewares/index.d.ts +4 -0
- package/dist/types/middlewares/trim_mw.d.ts +2 -0
- package/dist/types/test.d.ts +0 -0
- package/dist/types/types/enums/global.d.ts +9 -0
- package/dist/types/types/enums/index.d.ts +1 -0
- package/dist/types/types/firebase_types.js +1 -0
- package/dist/types/types/global.js +1 -0
- package/dist/types/types/index.d.ts +3 -0
- package/dist/types/types/index.js +2 -0
- package/dist/types/types/interfaces/email.d.ts +33 -0
- package/dist/types/types/interfaces/global.d.ts +27 -0
- package/dist/types/types/interfaces/index.d.ts +2 -0
- package/dist/types/types/types/firebase_types.d.ts +50 -0
- package/dist/types/types/types/global.d.ts +17 -0
- package/dist/types/types/types/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Request, Response, NextFunction } from "express";
|
|
2
|
+
import { Service } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Utility to handle async errors
|
|
5
|
+
*/
|
|
6
|
+
declare const async_error_handler: (service: Service) => (req: Request, res: Response, next: NextFunction) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Global error-handling middleware.
|
|
9
|
+
*/
|
|
10
|
+
declare const error_handler: (err: Error, req: Request, res: Response, next: NextFunction) => void;
|
|
11
|
+
export { error_handler, async_error_handler };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RequestHandler } from "express";
|
|
2
|
+
import { LogRequests, MandatoryParams, MW } from "../types";
|
|
3
|
+
export declare const mandatory: ({ body, headers }: MandatoryParams) => MW;
|
|
4
|
+
export declare const optional: ({ body, headers }: MandatoryParams) => MW;
|
|
5
|
+
export declare const request_logger: (log_requests: LogRequests) => RequestHandler;
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare enum SimProvider {
|
|
2
|
+
partner = "partner",
|
|
3
|
+
pelephone = "pelephone",
|
|
4
|
+
celcom = "celcom",
|
|
5
|
+
monogoto = "monogoto",
|
|
6
|
+
unknown = "unknown"
|
|
7
|
+
}
|
|
8
|
+
export type NxServiceName = "bi" | "call_center" | "dashboard" | "devices" | "installer" | "ox_server" | "toolbox" | "end_users" | "notifications";
|
|
9
|
+
export type NxServiceNameMap = Record<NxServiceName, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./global";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface EmailData {
|
|
2
|
+
subject: string;
|
|
3
|
+
entity_for_audit: string;
|
|
4
|
+
to?: string | string[];
|
|
5
|
+
from?: string | {
|
|
6
|
+
email: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
};
|
|
9
|
+
group_name?: string;
|
|
10
|
+
cc?: string | string[];
|
|
11
|
+
body_plain_text?: string;
|
|
12
|
+
body_html?: string;
|
|
13
|
+
attachments?: EmailAttachment[];
|
|
14
|
+
}
|
|
15
|
+
export interface EmailAttachment {
|
|
16
|
+
content: string;
|
|
17
|
+
filename: string;
|
|
18
|
+
type?: string;
|
|
19
|
+
disposition?: "attachment" | "inline";
|
|
20
|
+
content_id?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface EmailSettings {
|
|
23
|
+
default_from: {
|
|
24
|
+
email: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
};
|
|
27
|
+
default_cc: string[];
|
|
28
|
+
groups: Record<string, {
|
|
29
|
+
cc?: string[];
|
|
30
|
+
to: string[];
|
|
31
|
+
}>;
|
|
32
|
+
sendgrid_api_key: string;
|
|
33
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { InitSnapshotsOptions } from "../types";
|
|
2
|
+
export interface MandatoryObject {
|
|
3
|
+
key: string;
|
|
4
|
+
type: "string" | "number" | "boolean" | "object" | "array";
|
|
5
|
+
length?: number;
|
|
6
|
+
required_keys?: string[];
|
|
7
|
+
array_types?: ("string" | "number" | "boolean" | "object")[];
|
|
8
|
+
}
|
|
9
|
+
export interface MandatoryParams {
|
|
10
|
+
body?: MandatoryObject[];
|
|
11
|
+
headers?: MandatoryObject[];
|
|
12
|
+
}
|
|
13
|
+
export interface LogRequests {
|
|
14
|
+
url?: boolean;
|
|
15
|
+
headers?: boolean;
|
|
16
|
+
query?: boolean;
|
|
17
|
+
body?: boolean;
|
|
18
|
+
gcp?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface AppOptions {
|
|
21
|
+
port?: number;
|
|
22
|
+
log_requests?: LogRequests;
|
|
23
|
+
init_snapshot_options?: InitSnapshotsOptions;
|
|
24
|
+
initialize_redis?: boolean;
|
|
25
|
+
enable_axios_keep_alive?: boolean;
|
|
26
|
+
on_shutdown?: () => void | Promise<void> | undefined;
|
|
27
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { TObject } from "akeyless-types-commons";
|
|
2
|
+
export type QueryDocuments = (collection_path: string, field_name: string, operator: FirebaseFirestore.WhereFilterOp, value: any) => Promise<TObject<any>[]>;
|
|
3
|
+
export type WhereCondition = {
|
|
4
|
+
field_name: string;
|
|
5
|
+
operator: FirebaseFirestore.WhereFilterOp;
|
|
6
|
+
value: any;
|
|
7
|
+
};
|
|
8
|
+
export type QueryDocumentsByConditions = (collection_path: string, where_conditions: WhereCondition[]) => Promise<TObject<any>[]>;
|
|
9
|
+
export type QueryDocumentByConditions = (collection_path: string, where_conditions: WhereCondition[], log?: boolean) => Promise<TObject<any>>;
|
|
10
|
+
export type QueryDocument = (collection_path: string, field_name: string, operator: FirebaseFirestore.WhereFilterOp, value: any, ignore_log?: boolean) => Promise<TObject<any>>;
|
|
11
|
+
export type QueryDocumentOptional = (collection_path: string, field_name: string, operator: FirebaseFirestore.WhereFilterOp, value: any, ignore_log?: boolean) => Promise<TObject<any> | null>;
|
|
12
|
+
export type OnSnapshotCallback = (documents: any[], config: OnSnapshotConfig) => void;
|
|
13
|
+
export interface OnSnapshotParsers {
|
|
14
|
+
on_first_time?: OnSnapshotCallback;
|
|
15
|
+
on_add?: OnSnapshotCallback;
|
|
16
|
+
on_modify?: OnSnapshotCallback;
|
|
17
|
+
on_remove?: OnSnapshotCallback;
|
|
18
|
+
}
|
|
19
|
+
export interface ExtraSnapshotConfig {
|
|
20
|
+
collection_name: string;
|
|
21
|
+
extra_parsers?: OnSnapshotParsers[];
|
|
22
|
+
conditions?: WhereCondition[];
|
|
23
|
+
cache_name?: string;
|
|
24
|
+
parse_as?: "object" | "array";
|
|
25
|
+
doc_key_property?: string;
|
|
26
|
+
subscription_type?: "redis" | "firebase";
|
|
27
|
+
debug?: Debug & {
|
|
28
|
+
extra_parsers?: Debug;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
interface Debug {
|
|
32
|
+
on_first_time?: "documents" | "length";
|
|
33
|
+
on_add?: boolean;
|
|
34
|
+
on_modify?: boolean;
|
|
35
|
+
on_remove?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export type OnSnapshotConfig = OnSnapshotParsers & ExtraSnapshotConfig;
|
|
38
|
+
export type Snapshot = (config: OnSnapshotConfig) => Promise<void>;
|
|
39
|
+
export type SnapshotBulk = (snapshots: ReturnType<Snapshot>[], label?: string) => Promise<void>;
|
|
40
|
+
export type SnapshotBulkByNamesParamObject = Omit<ExtraSnapshotConfig, "extra_parsers"> & {
|
|
41
|
+
extra_parsers: OnSnapshotParsers[];
|
|
42
|
+
};
|
|
43
|
+
export type SnapshotBulkByNamesParam = string | SnapshotBulkByNamesParamObject;
|
|
44
|
+
export type SnapshotBulkByNamesOptions = Pick<ExtraSnapshotConfig, "debug" | "subscription_type" | "parse_as" | "doc_key_property"> & {
|
|
45
|
+
label?: string;
|
|
46
|
+
};
|
|
47
|
+
export type SnapshotBulkByNames = (params: SnapshotBulkByNamesParam[], options?: SnapshotBulkByNamesOptions) => Promise<void>;
|
|
48
|
+
export interface InitSnapshotsOptions extends Pick<ExtraSnapshotConfig, "subscription_type" | "debug"> {
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Request, Response, Express, NextFunction } from "express";
|
|
2
|
+
import { NxUser, TObject } from "akeyless-types-commons";
|
|
3
|
+
export type JsonOK<T> = (data?: T) => {
|
|
4
|
+
success: true;
|
|
5
|
+
data: T | undefined;
|
|
6
|
+
};
|
|
7
|
+
export type JsonFailed = (error?: any, msg?: string) => {
|
|
8
|
+
success: false;
|
|
9
|
+
error: any;
|
|
10
|
+
};
|
|
11
|
+
export type MainRouter = (app: Express) => void;
|
|
12
|
+
export type MW = (req: Request, res: Response, next: NextFunction) => void;
|
|
13
|
+
export type Service = (req: Request, res: Response) => void;
|
|
14
|
+
export type Route = (req: Request, res: Response, next?: NextFunction) => Response;
|
|
15
|
+
export type AddAuditRecord = (action: string, entity: string, details: TObject<any>, user?: NxUser) => Promise<void>;
|
|
16
|
+
export type LangOptions = "he" | "en" | "ru" | (string & {});
|
|
17
|
+
export type EntityOptions = "nx_devices" | (string & {});
|