akeyless-server-commons 1.0.76 → 1.0.77
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/global_helpers.d.ts +0 -1
- package/dist/cjs/helpers/global_helpers.js +1 -5
- package/dist/cjs/helpers/global_helpers.js.map +1 -1
- package/dist/cjs/helpers/tasks.d.ts +12 -0
- package/dist/cjs/helpers/tasks.js +62 -0
- package/dist/cjs/helpers/tasks.js.map +1 -0
- package/dist/cjs/managers/cacche_manager2.d.ts +18 -0
- package/dist/cjs/managers/cacche_manager2.js +41 -0
- package/dist/cjs/managers/cacche_manager2.js.map +1 -0
- package/dist/cjs/managers/socket_manager.d.ts +34 -0
- package/dist/cjs/managers/socket_manager.js +222 -0
- package/dist/cjs/managers/socket_manager.js.map +1 -0
- package/dist/esm/helpers/global_helpers.d.ts +0 -1
- package/dist/esm/helpers/global_helpers.js +0 -3
- package/dist/esm/helpers/global_helpers.js.map +1 -1
- package/dist/esm/helpers/tasks.d.ts +12 -0
- package/dist/esm/helpers/tasks.js +58 -0
- package/dist/esm/helpers/tasks.js.map +1 -0
- package/dist/esm/managers/cacche_manager2.d.ts +18 -0
- package/dist/esm/managers/cacche_manager2.js +37 -0
- package/dist/esm/managers/cacche_manager2.js.map +1 -0
- package/dist/esm/managers/socket_manager.d.ts +34 -0
- package/dist/esm/managers/socket_manager.js +219 -0
- package/dist/esm/managers/socket_manager.js.map +1 -0
- package/package.json +1 -1
- package/dist/helpers/boards_helpers.js +0 -11
- package/dist/helpers/email_helpers.js +0 -69
- package/dist/helpers/firebase_helpers.js +0 -379
- package/dist/helpers/global_helpers.js +0 -123
- package/dist/helpers/index.js +0 -10
- package/dist/helpers/login_helpers.js +0 -18
- package/dist/helpers/notification_helpers.js +0 -230
- package/dist/helpers/phone_number_helpers.js +0 -88
- package/dist/helpers/start.js +0 -43
- package/dist/helpers/tasks_helpers.js +0 -125
- package/dist/helpers/time_helpers.js +0 -63
- package/dist/index.js +0 -5
- package/dist/managers/cache_manager.js +0 -27
- package/dist/managers/index.js +0 -3
- package/dist/managers/logger_manager.js +0 -51
- package/dist/managers/translation_manager.js +0 -38
- package/dist/middlewares/auth_mw.js +0 -49
- package/dist/middlewares/error_handling.js +0 -19
- package/dist/middlewares/global_mw.js +0 -50
- package/dist/middlewares/index.js +0 -3
- package/dist/test.js +0 -1
- package/dist/types/enums/global.js +0 -18
- package/dist/types/enums/index.js +0 -1
- package/dist/types/helpers/boards_helpers.d.ts +0 -7
- package/dist/types/helpers/email_helpers.d.ts +0 -2
- package/dist/types/helpers/firebase_helpers.d.ts +0 -37
- package/dist/types/helpers/global_helpers.d.ts +0 -14
- package/dist/types/helpers/index.d.ts +0 -10
- package/dist/types/helpers/login_helpers.d.ts +0 -4
- package/dist/types/helpers/notification_helpers.d.ts +0 -11
- package/dist/types/helpers/phone_number_helpers.d.ts +0 -13
- package/dist/types/helpers/start.d.ts +0 -5
- package/dist/types/helpers/tasks_helpers.d.ts +0 -20
- package/dist/types/helpers/time_helpers.d.ts +0 -26
- package/dist/types/index.d.ts +0 -5
- package/dist/types/index.js +0 -3
- package/dist/types/interfaces/email.js +0 -1
- package/dist/types/interfaces/global.js +0 -1
- package/dist/types/interfaces/index.js +0 -2
- package/dist/types/managers/cache_manager.d.ts +0 -11
- package/dist/types/managers/index.d.ts +0 -3
- package/dist/types/managers/logger_manager.d.ts +0 -12
- package/dist/types/managers/translation_manager.d.ts +0 -14
- package/dist/types/middlewares/auth_mw.d.ts +0 -4
- package/dist/types/middlewares/error_handling.d.ts +0 -11
- package/dist/types/middlewares/global_mw.d.ts +0 -2
- package/dist/types/middlewares/index.d.ts +0 -3
- package/dist/types/test.d.ts +0 -0
- package/dist/types/types/enums/global.d.ts +0 -16
- package/dist/types/types/enums/index.d.ts +0 -1
- package/dist/types/types/firebase_types.js +0 -1
- package/dist/types/types/global.js +0 -1
- package/dist/types/types/index.d.ts +0 -3
- package/dist/types/types/index.js +0 -2
- package/dist/types/types/interfaces/email.d.ts +0 -24
- package/dist/types/types/interfaces/global.d.ts +0 -12
- package/dist/types/types/interfaces/index.d.ts +0 -2
- package/dist/types/types/types/firebase_types.d.ts +0 -30
- package/dist/types/types/types/global.d.ts +0 -15
- package/dist/types/types/types/index.d.ts +0 -2
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { verify_token, json_failed, query_document_optional, get_user_by_identifier } from "../helpers";
|
|
2
|
-
import { logger } from "../managers";
|
|
3
|
-
export const verify_user_auth = async (req, res, next) => {
|
|
4
|
-
try {
|
|
5
|
-
const user = await verify_token(req.headers.authorization);
|
|
6
|
-
req.body.firebase_user = user;
|
|
7
|
-
next();
|
|
8
|
-
}
|
|
9
|
-
catch (error) {
|
|
10
|
-
logger.error("error from verify user auth", error);
|
|
11
|
-
res.status(403).send(json_failed(error));
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
export const nx_user_login = async (req, res, next) => {
|
|
15
|
-
try {
|
|
16
|
-
const authorization = req.headers.authorization;
|
|
17
|
-
const user_data = await verify_token(authorization);
|
|
18
|
-
const { phone_number, email } = user_data;
|
|
19
|
-
if (!phone_number && !email) {
|
|
20
|
-
throw "Invalid authorization token";
|
|
21
|
-
}
|
|
22
|
-
const nx_user = await get_user_by_identifier(phone_number || email);
|
|
23
|
-
if (!nx_user) {
|
|
24
|
-
throw `No user found with phone number: ${phone_number} or email: ${email}.`;
|
|
25
|
-
}
|
|
26
|
-
req.body.user = nx_user;
|
|
27
|
-
next();
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
res.status(403).send(json_failed(error));
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
export const client_login = async (req, res, next) => {
|
|
34
|
-
try {
|
|
35
|
-
const token = req.headers.authorization;
|
|
36
|
-
if (!token) {
|
|
37
|
-
throw new Error("Authorization token not found.");
|
|
38
|
-
}
|
|
39
|
-
const client_data = (await query_document_optional("nx-clients", "api_token", "==", token));
|
|
40
|
-
if (!client_data) {
|
|
41
|
-
throw new Error(`No client found with token: ${token} .`);
|
|
42
|
-
}
|
|
43
|
-
req.body.client = client_data;
|
|
44
|
-
next();
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
res.status(403).send(json_failed(error.message || error));
|
|
48
|
-
}
|
|
49
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility to handle async errors
|
|
3
|
-
*/
|
|
4
|
-
const async_error_handler = (service) => {
|
|
5
|
-
return (req, res, next) => {
|
|
6
|
-
Promise.resolve(service(req, res)).catch(next);
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Global error-handling middleware.
|
|
11
|
-
*/
|
|
12
|
-
const error_handler = (err, req, res, next) => {
|
|
13
|
-
console.error("Global Error Handler:", err.stack);
|
|
14
|
-
res.status(500).json({
|
|
15
|
-
status: "error",
|
|
16
|
-
message: err.message || "Internal Server Error",
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
export { error_handler, async_error_handler };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { json_failed } from "../helpers";
|
|
2
|
-
const validateParameter = (data, parameter) => {
|
|
3
|
-
if (data[parameter.key] === undefined) {
|
|
4
|
-
throw `missing mandatory parameter: ${parameter.key}`;
|
|
5
|
-
}
|
|
6
|
-
if (parameter.type === "array" && !Array.isArray(data[parameter.key])) {
|
|
7
|
-
throw `parameter ${parameter.key} must be of type: Array`;
|
|
8
|
-
}
|
|
9
|
-
if (typeof data[parameter.key] !== parameter.type && parameter.type !== "array") {
|
|
10
|
-
throw `parameter ${parameter.key} must be of type: ${parameter.type}`;
|
|
11
|
-
}
|
|
12
|
-
if ((Array.isArray(data[parameter.key]) && parameter.length && data[parameter.key].length < parameter.length) ||
|
|
13
|
-
(parameter.type === "string" && parameter.length && data[parameter.key].length < parameter.length)) {
|
|
14
|
-
throw `parameter ${parameter.key} must have minimum length: ${parameter.length}`;
|
|
15
|
-
}
|
|
16
|
-
if (parameter.type === "object" && parameter.required_keys) {
|
|
17
|
-
const missingKeys = parameter.required_keys.filter((key) => data[parameter.key][key] === undefined);
|
|
18
|
-
if (missingKeys.length > 0) {
|
|
19
|
-
throw `parameter ${parameter.key} is missing required keys: ${missingKeys.join(", ")}`;
|
|
20
|
-
}
|
|
21
|
-
parameter.required_keys.forEach((key) => {
|
|
22
|
-
const value = data[parameter.key][key];
|
|
23
|
-
if ((typeof value === "string" || Array.isArray(value)) && value.length === 0) {
|
|
24
|
-
throw `parameter ${key} in ${parameter.key} must have some length `;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
export const mandatory = ({ body, headers }) => {
|
|
30
|
-
return (req, res, next) => {
|
|
31
|
-
try {
|
|
32
|
-
const body_data = req.body;
|
|
33
|
-
const headers_data = req.headers;
|
|
34
|
-
if (body) {
|
|
35
|
-
body.forEach((parameter) => {
|
|
36
|
-
validateParameter(body_data, parameter);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
if (headers) {
|
|
40
|
-
headers.forEach((parameter) => {
|
|
41
|
-
validateParameter(headers_data, parameter);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
next();
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
return res.status(500).send(json_failed(error));
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
};
|
package/dist/test.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export var SimProvider;
|
|
2
|
-
(function (SimProvider) {
|
|
3
|
-
SimProvider["partner"] = "partner";
|
|
4
|
-
SimProvider["pelephone"] = "pelephone";
|
|
5
|
-
SimProvider["celcom"] = "celcom";
|
|
6
|
-
SimProvider["monogoto"] = "monogoto";
|
|
7
|
-
SimProvider["unknown"] = "unknown";
|
|
8
|
-
})(SimProvider || (SimProvider = {}));
|
|
9
|
-
export var NxServiceName;
|
|
10
|
-
(function (NxServiceName) {
|
|
11
|
-
NxServiceName["bi"] = "bi";
|
|
12
|
-
NxServiceName["call_center"] = "call_center";
|
|
13
|
-
NxServiceName["dashboard"] = "dashboard";
|
|
14
|
-
NxServiceName["devices"] = "devices";
|
|
15
|
-
NxServiceName["installer"] = "installer";
|
|
16
|
-
NxServiceName["ox_server"] = "ox_server";
|
|
17
|
-
NxServiceName["toolbox"] = "toolbox";
|
|
18
|
-
})(NxServiceName || (NxServiceName = {}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./global";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { TObject } from "akeyless-types-commons";
|
|
2
|
-
interface BoardProviderWithBoardTypes {
|
|
3
|
-
board_provider: "erm" | "jimi" | "ruptela" | "servision" | "jimi_iothub";
|
|
4
|
-
board_types: string[];
|
|
5
|
-
}
|
|
6
|
-
export declare const extract_board_types_from_settings: (settings: TObject<any>) => BoardProviderWithBoardTypes[];
|
|
7
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import firebase_admin from "firebase-admin";
|
|
2
|
-
import { QueryDocument, QueryDocumentByConditions, QueryDocumentOptional, QueryDocuments, QueryDocumentsByConditions, Snapshot, SnapshotBulk, SnapshotBulkByNames } from "../types";
|
|
3
|
-
import { DecodedIdToken } from "firebase-admin/auth";
|
|
4
|
-
import { TObject } from "akeyless-types-commons";
|
|
5
|
-
export declare const service_account_firebase: {
|
|
6
|
-
type: string;
|
|
7
|
-
project_id: string;
|
|
8
|
-
private_key_id: string;
|
|
9
|
-
private_key: string;
|
|
10
|
-
client_email: string;
|
|
11
|
-
client_id: string;
|
|
12
|
-
auth_uri: string;
|
|
13
|
-
token_uri: string;
|
|
14
|
-
auth_provider_x509_cert_url: string;
|
|
15
|
-
client_x509_cert_url: string;
|
|
16
|
-
universe_domain: string;
|
|
17
|
-
};
|
|
18
|
-
export declare const db: firebase_admin.firestore.Firestore;
|
|
19
|
-
export declare const messaging: import("firebase-admin/messaging").Messaging;
|
|
20
|
-
export declare const auth: import("firebase-admin/auth").Auth;
|
|
21
|
-
export declare const simple_extract_data: (doc: FirebaseFirestore.DocumentSnapshot) => TObject<any>;
|
|
22
|
-
export declare const get_all_documents: (collection_path: string) => Promise<any[]>;
|
|
23
|
-
export declare const query_documents: QueryDocuments;
|
|
24
|
-
export declare const query_documents_by_conditions: QueryDocumentsByConditions;
|
|
25
|
-
export declare const query_document_by_conditions: QueryDocumentByConditions;
|
|
26
|
-
export declare const query_document: QueryDocument;
|
|
27
|
-
export declare const query_document_optional: QueryDocumentOptional;
|
|
28
|
-
export declare const get_document_by_id: (collection_path: string, doc_id: string) => Promise<TObject<any>>;
|
|
29
|
-
export declare const get_document_by_id_optional: (collection_path: string, doc_id: string) => Promise<TObject<any> | null>;
|
|
30
|
-
export declare const set_document: (collection_path: string, doc_id: string, data: {}, merge?: boolean) => Promise<void>;
|
|
31
|
-
export declare const add_document: (collection_path: string, data: {}, include_id?: boolean, custom_id?: string) => Promise<void>;
|
|
32
|
-
export declare const delete_document: (collection_path: string, doc_id: string) => Promise<void>;
|
|
33
|
-
export declare const verify_token: (authorization: string | undefined) => Promise<DecodedIdToken>;
|
|
34
|
-
export declare const snapshot: Snapshot;
|
|
35
|
-
export declare const init_snapshots: () => Promise<void>;
|
|
36
|
-
export declare const snapshot_bulk: SnapshotBulk;
|
|
37
|
-
export declare const snapshot_bulk_by_names: SnapshotBulkByNames;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { AddAuditRecord, JsonFailed, JsonOK } from "../types";
|
|
2
|
-
import { Geo, LanguageOptions, TObject } from "akeyless-types-commons";
|
|
3
|
-
export declare const init_env_variables: (required_vars?: string[]) => TObject<string>;
|
|
4
|
-
export declare const json_ok: JsonOK<TObject<any> | TObject<any>[]>;
|
|
5
|
-
export declare const json_failed: JsonFailed;
|
|
6
|
-
export declare const parse_error: (error: any) => any;
|
|
7
|
-
export declare const get_version: (packageJsonPath: string) => string;
|
|
8
|
-
export declare const sleep: (ms?: number) => Promise<unknown>;
|
|
9
|
-
export declare const add_audit_record: AddAuditRecord;
|
|
10
|
-
export declare const get_nx_service_urls: (env_name?: string) => TObject<string>;
|
|
11
|
-
export declare const get_address_by_geo: ({ lat, lng }: Geo, currentLanguage: LanguageOptions) => Promise<string>;
|
|
12
|
-
export declare const validate_and_cast: <T extends unknown>(variable: any, condition: Boolean) => variable is T;
|
|
13
|
-
export declare const get_or_default: <T>(value: T | undefined, default_value: T | (() => T)) => T;
|
|
14
|
-
export declare const remove_nulls_and_undefined: (obj: Record<string, any>) => Record<string, any>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./global_helpers";
|
|
2
|
-
export * from "./firebase_helpers";
|
|
3
|
-
export * from "./start";
|
|
4
|
-
export * from "./time_helpers";
|
|
5
|
-
export * from "./login_helpers";
|
|
6
|
-
export * from "./notification_helpers";
|
|
7
|
-
export * from "./email_helpers";
|
|
8
|
-
export * from "./phone_number_helpers";
|
|
9
|
-
export * from "./tasks_helpers";
|
|
10
|
-
export * from "./boards_helpers";
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { NxUser, MobileAppUser } from "akeyless-types-commons";
|
|
2
|
-
export declare const convert_to_short_phone_number: (phone_number: string) => string;
|
|
3
|
-
export declare const get_user_by_identifier: (identifier: string, ignore_log?: boolean) => Promise<NxUser | null>;
|
|
4
|
-
export declare const get_mobile_app_user_by_uid: (uid: string, ignore_log?: boolean) => Promise<MobileAppUser | null>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { EventFromDevice, TObject } from "akeyless-types-commons";
|
|
2
|
-
export declare const send_sms: (recepient: string, text: string, entity_for_audit: string, details?: TObject<any>) => Promise<void>;
|
|
3
|
-
export declare const push_event_to_mobile_users: (event: EventFromDevice) => Promise<void>;
|
|
4
|
-
type FuncSendFcmMessage = (title: string, body: string, fcm_tokens: string[], custom_sound?: string) => Promise<{
|
|
5
|
-
success: boolean;
|
|
6
|
-
response: string;
|
|
7
|
-
success_count?: number;
|
|
8
|
-
failure_count?: number;
|
|
9
|
-
}>;
|
|
10
|
-
export declare const send_fcm_message: FuncSendFcmMessage;
|
|
11
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { TObject } from "akeyless-types-commons";
|
|
2
|
-
import { SimProvider } from "../types/enums";
|
|
3
|
-
export declare const is_long_phone_number: (phone_number: string) => boolean;
|
|
4
|
-
export declare const is_israel_long_phone_number: (phone_number: string) => boolean;
|
|
5
|
-
export declare const is_international_phone_number: (phone_number: string) => boolean;
|
|
6
|
-
export declare const is_iccid: (number: string) => boolean;
|
|
7
|
-
export declare const convert_to_short_israel_phone: (international_number: string) => string;
|
|
8
|
-
export declare const is_sim_provider_partner: (phone_number: string) => any;
|
|
9
|
-
export declare const is_sim_provider_pelephone: (phone_number: string) => any;
|
|
10
|
-
export declare const is_sim_provider_celcom: (phone_number: string) => any;
|
|
11
|
-
export declare const is_sim_provider_monogoto: (phone_number: string) => boolean;
|
|
12
|
-
export declare const get_sim_provider: (phone_number: string) => SimProvider;
|
|
13
|
-
export declare const long_short_phone_numbers: (phone_number: string) => TObject<any>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Express } from "express";
|
|
2
|
-
import { MainRouter } from "../types";
|
|
3
|
-
export declare const start_server: (main_router: MainRouter, project_name: string, version: string, port?: number) => Promise<Express>;
|
|
4
|
-
export declare const basic_init: (main_router: MainRouter, project_name: string, version: string, port?: number) => Promise<Express>;
|
|
5
|
-
export declare const nextjs_init: (project_name: string, version: string) => Promise<void>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { TObject } from "akeyless-types-commons";
|
|
2
|
-
export declare enum TaskName {
|
|
3
|
-
collect_gprs_balances = "collect_gprs_balances",
|
|
4
|
-
send_reset_sms = "send_reset_sms",
|
|
5
|
-
collect_devices_health = "collect_devices_health",
|
|
6
|
-
collect_billing_balance = "collect_billing_balance"
|
|
7
|
-
}
|
|
8
|
-
export declare enum TaskStatus {
|
|
9
|
-
running = "running",
|
|
10
|
-
completed = "completed",
|
|
11
|
-
failed = "failed",
|
|
12
|
-
suspeneded = "suspeneded"
|
|
13
|
-
}
|
|
14
|
-
export type TaskSaveOptions = "storage" | "db";
|
|
15
|
-
export declare const execute_task: <T = any>(source: string, task_name: TaskName, task: () => Promise<T>, options?: {
|
|
16
|
-
save_in?: TaskSaveOptions;
|
|
17
|
-
}) => Promise<void>;
|
|
18
|
-
export declare const get_task_data: <T = any>(task_name: TaskName) => Promise<T>;
|
|
19
|
-
export declare const get_task_data_from_storage: <T = any>(task_name: TaskName) => Promise<T | null>;
|
|
20
|
-
export declare const keep_task_data_in_storage: (task_name: TaskName, data: any[] | TObject<any>) => Promise<string>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { firebase_timestamp } from "akeyless-types-commons";
|
|
2
|
-
/**
|
|
3
|
-
* Converts a Firebase Timestamp object into a formatted string.
|
|
4
|
-
*
|
|
5
|
-
* @param {firebase_timestamp} firebaseTimestamp - The Firebase timestamp object containing _seconds and _nanoseconds.
|
|
6
|
-
* @param {string} [format="DD-MM-YYYY HH:mm:ss"] - Optional the format string used to format the date. Default is "DD-MM-YYYY HH:mm:ss".
|
|
7
|
-
* @returns {string} - A formatted date string according to the specified format or the default format.
|
|
8
|
-
*/
|
|
9
|
-
export declare function timestamp_to_string(firebaseTimestamp: firebase_timestamp, format?: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Converts a Firebase Timestamp object into milliseconds since the Unix epoch.
|
|
12
|
-
*
|
|
13
|
-
* @param {firebase_timestamp} firebaseTimestamp - The Firebase timestamp object containing _seconds and _nanoseconds.
|
|
14
|
-
* @returns {number} - Time in milliseconds
|
|
15
|
-
*/
|
|
16
|
-
export declare function timestamp_to_millis(firebaseTimestamp: firebase_timestamp): number;
|
|
17
|
-
export declare function sort_by_timestamp(a: firebase_timestamp, b: firebase_timestamp, reverse?: boolean): number;
|
|
18
|
-
export interface TimePassedByDate {
|
|
19
|
-
seconds_passed: number;
|
|
20
|
-
minutes_passed: number;
|
|
21
|
-
hours_passed: number;
|
|
22
|
-
days_passed: number;
|
|
23
|
-
time_passed_formatted_short: string;
|
|
24
|
-
time_passed_formatted_long: string;
|
|
25
|
-
}
|
|
26
|
-
export declare const calculate_time_passed: (datetime: Date) => TimePassedByDate;
|
package/dist/types/index.d.ts
DELETED
package/dist/types/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare class CacheManager {
|
|
2
|
-
private static instance;
|
|
3
|
-
private data;
|
|
4
|
-
private constructor();
|
|
5
|
-
static getInstance(): CacheManager;
|
|
6
|
-
setArrayData(key: string, data: any[]): void;
|
|
7
|
-
getArrayData(key: string): any[];
|
|
8
|
-
setObjectData(key: string, data: any): void;
|
|
9
|
-
getObjectData(key: string, default_value?: any): any;
|
|
10
|
-
}
|
|
11
|
-
export declare const cache_manager: CacheManager;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { TObject } from "akeyless-types-commons";
|
|
2
|
-
declare class LoggerManager {
|
|
3
|
-
private static instance;
|
|
4
|
-
private constructor();
|
|
5
|
-
static getInstance(): LoggerManager;
|
|
6
|
-
private get_date;
|
|
7
|
-
log(msg: string, data?: TObject<any> | any[]): void;
|
|
8
|
-
error(msg: string, data?: any): void;
|
|
9
|
-
warn(msg: string, data?: any): void;
|
|
10
|
-
}
|
|
11
|
-
export declare const logger: LoggerManager;
|
|
12
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TObject } from "akeyless-types-commons";
|
|
2
|
-
import { EntityOptions, LangOptions } from "../types";
|
|
3
|
-
export declare class TranslationManager {
|
|
4
|
-
private static instance;
|
|
5
|
-
private data;
|
|
6
|
-
private constructor();
|
|
7
|
-
static getInstance(): TranslationManager;
|
|
8
|
-
setTranslationData(data: TObject<any>): void;
|
|
9
|
-
getTranslationData(): TObject<any>;
|
|
10
|
-
get_translation(scope: string, lang: string, entity: string, key: string): string;
|
|
11
|
-
get_sms(lang: LangOptions, entity: EntityOptions, key: string): string;
|
|
12
|
-
get_email(lang: LangOptions, entity: EntityOptions, key: string): string;
|
|
13
|
-
}
|
|
14
|
-
export declare const translation_manager: TranslationManager;
|
|
@@ -1,11 +0,0 @@
|
|
|
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 };
|
package/dist/types/test.d.ts
DELETED
|
File without changes
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare enum SimProvider {
|
|
2
|
-
partner = "partner",
|
|
3
|
-
pelephone = "pelephone",
|
|
4
|
-
celcom = "celcom",
|
|
5
|
-
monogoto = "monogoto",
|
|
6
|
-
unknown = "unknown"
|
|
7
|
-
}
|
|
8
|
-
export declare enum NxServiceName {
|
|
9
|
-
bi = "bi",
|
|
10
|
-
call_center = "call_center",
|
|
11
|
-
dashboard = "dashboard",
|
|
12
|
-
devices = "devices",
|
|
13
|
-
installer = "installer",
|
|
14
|
-
ox_server = "ox_server",
|
|
15
|
-
toolbox = "toolbox"
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./global";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
}
|
|
14
|
-
export interface EmailSettings {
|
|
15
|
-
default_from: {
|
|
16
|
-
email: string;
|
|
17
|
-
name?: string;
|
|
18
|
-
};
|
|
19
|
-
groups: Record<string, {
|
|
20
|
-
cc?: string[];
|
|
21
|
-
to: string[];
|
|
22
|
-
}>;
|
|
23
|
-
sendgrid_api_key: string;
|
|
24
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface MandatoryObject {
|
|
2
|
-
key: string;
|
|
3
|
-
type: "string" | "number" | "boolean" | "object" | "array";
|
|
4
|
-
length?: number;
|
|
5
|
-
required_keys?: string[];
|
|
6
|
-
}
|
|
7
|
-
export interface MandatoryParams {
|
|
8
|
-
body?: MandatoryObject[];
|
|
9
|
-
headers?: MandatoryObject[];
|
|
10
|
-
}
|
|
11
|
-
export type LangOptions = "he" | "en" | "ru" | (string & {});
|
|
12
|
-
export type EntityOptions = "nx_devices" | (string & {});
|
|
@@ -1,30 +0,0 @@
|
|
|
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 OnSnapshotConfig extends OnSnapshotParsers {
|
|
20
|
-
collection_name: string;
|
|
21
|
-
extra_parsers?: OnSnapshotParsers[];
|
|
22
|
-
}
|
|
23
|
-
export type Snapshot = (config: OnSnapshotConfig) => Promise<void>;
|
|
24
|
-
export type SnapshotBulk = (snapshots: ReturnType<Snapshot>[], label?: string) => Promise<void>;
|
|
25
|
-
export type SnapshotBulkByNamesParamObject = {
|
|
26
|
-
collection_name: string;
|
|
27
|
-
extra_parsers: OnSnapshotParsers[];
|
|
28
|
-
};
|
|
29
|
-
export type SnapshotBulkByNamesParam = string | SnapshotBulkByNamesParamObject;
|
|
30
|
-
export type SnapshotBulkByNames = (params: SnapshotBulkByNamesParam[]) => Promise<void>;
|
|
@@ -1,15 +0,0 @@
|
|
|
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>;
|