@adaas/a-utils 0.0.9 → 0.1.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.ts +21 -15
- package/dist/index.js +53 -22
- package/dist/index.js.map +1 -1
- package/dist/src/constants/errors.constants.d.ts +0 -65
- package/dist/src/constants/errors.constants.js +0 -72
- package/dist/src/constants/errors.constants.js.map +1 -1
- package/dist/src/lib/A-Channel/A-Channel.component.d.ts +3 -0
- package/dist/src/lib/A-Channel/A-Channel.component.js +8 -0
- package/dist/src/lib/A-Channel/A-Channel.component.js.map +1 -0
- package/dist/src/lib/A-Channel/A-Channel.error.d.ts +3 -0
- package/dist/src/lib/A-Channel/A-Channel.error.js +8 -0
- package/dist/src/lib/A-Channel/A-Channel.error.js.map +1 -0
- package/dist/src/lib/A-Channel/A-Channel.types.d.ts +0 -0
- package/dist/src/lib/A-Channel/A-Channel.types.js +2 -0
- package/dist/src/lib/A-Channel/A-Channel.types.js.map +1 -0
- package/dist/src/lib/A-Command/A-Command.constants.d.ts +22 -0
- package/dist/src/lib/A-Command/A-Command.constants.js +28 -0
- package/dist/src/lib/A-Command/A-Command.constants.js.map +1 -0
- package/dist/src/lib/A-Command/A-Command.entity.d.ts +133 -0
- package/dist/src/lib/A-Command/A-Command.entity.js +273 -0
- package/dist/src/lib/A-Command/A-Command.entity.js.map +1 -0
- package/dist/src/lib/A-Command/A-Command.error.d.ts +3 -0
- package/dist/src/lib/A-Command/A-Command.error.js +8 -0
- package/dist/src/lib/A-Command/A-Command.error.js.map +1 -0
- package/dist/src/lib/A-Command/A-Command.types.d.ts +73 -0
- package/dist/src/lib/A-Command/A-Command.types.js +4 -0
- package/dist/src/lib/A-Command/A-Command.types.js.map +1 -0
- package/dist/src/lib/A-Config/A-Config.constants.d.ts +3 -0
- package/dist/src/lib/A-Config/A-Config.constants.js +6 -0
- package/dist/src/lib/A-Config/A-Config.constants.js.map +1 -0
- package/dist/src/lib/A-Config/A-Config.container.d.ts +8 -0
- package/dist/src/lib/A-Config/A-Config.container.js +75 -0
- package/dist/src/lib/A-Config/A-Config.container.js.map +1 -0
- package/dist/src/lib/A-Config/A-Config.context.d.ts +29 -0
- package/dist/src/lib/A-Config/A-Config.context.js +63 -0
- package/dist/src/lib/A-Config/A-Config.context.js.map +1 -0
- package/dist/src/lib/A-Config/A-Config.error.d.ts +4 -0
- package/dist/src/lib/A-Config/A-Config.error.js +9 -0
- package/dist/src/lib/A-Config/A-Config.error.js.map +1 -0
- package/dist/src/lib/A-Config/A-Config.types.d.ts +19 -0
- package/dist/src/lib/A-Config/A-Config.types.js +7 -0
- package/dist/src/lib/A-Config/A-Config.types.js.map +1 -0
- package/dist/src/lib/A-Config/components/ConfigReader.component.d.ts +30 -0
- package/dist/src/lib/A-Config/components/ConfigReader.component.js +85 -0
- package/dist/src/lib/A-Config/components/ConfigReader.component.js.map +1 -0
- package/dist/src/lib/A-Config/components/ENVConfigReader.component.d.ts +10 -0
- package/dist/src/lib/A-Config/components/ENVConfigReader.component.js +37 -0
- package/dist/src/lib/A-Config/components/ENVConfigReader.component.js.map +1 -0
- package/dist/src/lib/A-Config/components/FileConfigReader.component.d.ts +11 -0
- package/dist/src/lib/A-Config/components/FileConfigReader.component.js +47 -0
- package/dist/src/lib/A-Config/components/FileConfigReader.component.js.map +1 -0
- package/dist/src/lib/A-Logger/A-Logger.component.d.ts +29 -0
- package/dist/src/lib/A-Logger/A-Logger.component.js +152 -0
- package/dist/src/lib/A-Logger/A-Logger.component.js.map +1 -0
- package/dist/src/lib/A-Logger/A-Logger.types.d.ts +0 -0
- package/dist/src/lib/A-Logger/A-Logger.types.js +2 -0
- package/dist/src/lib/A-Logger/A-Logger.types.js.map +1 -0
- package/dist/src/lib/A-Memory/A-Memory.context.d.ts +64 -0
- package/dist/src/lib/A-Memory/A-Memory.context.js +105 -0
- package/dist/src/lib/A-Memory/A-Memory.context.js.map +1 -0
- package/dist/src/lib/A-Polyfill/A-Polyfill.component.d.ts +20 -0
- package/dist/src/lib/A-Polyfill/A-Polyfill.component.js +53 -0
- package/dist/src/lib/A-Polyfill/A-Polyfill.component.js.map +1 -0
- package/dist/src/{global/A_Polyfills.d.ts → lib/A-Polyfill/A-Polyfill.types.d.ts} +1 -13
- package/dist/src/lib/A-Polyfill/A-Polyfill.types.js +2 -0
- package/dist/src/lib/A-Polyfill/A-Polyfill.types.js.map +1 -0
- package/dist/src/lib/A-Polyfill/A-Polyfills.class.d.ts +10 -0
- package/dist/src/{global/A_Polyfills.js → lib/A-Polyfill/A-Polyfills.class.js} +4 -4
- package/dist/src/lib/A-Polyfill/A-Polyfills.class.js.map +1 -0
- package/dist/src/{global/A_Deferred.class.d.ts → lib/A-Schedule/A-Deferred.class.d.ts} +4 -0
- package/dist/src/{global/A_Deferred.class.js → lib/A-Schedule/A-Deferred.class.js} +5 -1
- package/dist/src/lib/A-Schedule/A-Deferred.class.js.map +1 -0
- package/dist/src/lib/A-Schedule/A-Schedule.component.d.ts +57 -0
- package/dist/src/lib/A-Schedule/A-Schedule.component.js +49 -0
- package/dist/src/lib/A-Schedule/A-Schedule.component.js.map +1 -0
- package/dist/src/{types/A_ScheduleObject.types.d.ts → lib/A-Schedule/A-Schedule.types.d.ts} +2 -1
- package/dist/src/{types/ASEID.types.js → lib/A-Schedule/A-Schedule.types.js} +1 -3
- package/dist/src/lib/A-Schedule/A-Schedule.types.js.map +1 -0
- package/dist/src/lib/A-Schedule/A-ScheduleObject.class.d.ts +29 -0
- package/dist/src/{global/A_ScheduleObject.class.js → lib/A-Schedule/A-ScheduleObject.class.js} +25 -5
- package/dist/src/lib/A-Schedule/A-ScheduleObject.class.js.map +1 -0
- package/index.ts +33 -58
- package/jest.config.ts +3 -3
- package/package.json +6 -6
- package/src/constants/errors.constants.ts +0 -78
- package/src/lib/A-Channel/A-Channel.component.ts +8 -0
- package/src/lib/A-Channel/A-Channel.error.ts +6 -0
- package/src/lib/A-Channel/A-Channel.types.ts +0 -0
- package/src/lib/A-Command/A-Command.constants.ts +31 -0
- package/src/lib/A-Command/A-Command.entity.ts +327 -0
- package/src/lib/A-Command/A-Command.error.ts +6 -0
- package/src/lib/A-Command/A-Command.types.ts +100 -0
- package/src/lib/A-Config/A-Config.constants.ts +13 -0
- package/src/lib/A-Config/A-Config.container.ts +63 -0
- package/src/lib/A-Config/A-Config.context.ts +117 -0
- package/src/lib/A-Config/A-Config.error.ts +7 -0
- package/src/lib/A-Config/A-Config.types.ts +26 -0
- package/src/lib/A-Config/components/ConfigReader.component.ts +67 -0
- package/src/lib/A-Config/components/ENVConfigReader.component.ts +31 -0
- package/src/lib/A-Config/components/FileConfigReader.component.ts +42 -0
- package/src/lib/A-Logger/A-Logger.component.ts +190 -0
- package/src/lib/A-Logger/A-Logger.types.ts +0 -0
- package/src/lib/A-Memory/A-Memory.context.ts +115 -0
- package/src/lib/A-Polyfill/A-Polyfill.component.ts +45 -0
- package/src/lib/A-Polyfill/A-Polyfill.types.ts +10 -0
- package/src/{global/A_Polyfills.ts → lib/A-Polyfill/A-Polyfills.class.ts} +2 -16
- package/src/{global/A_Deferred.class.ts → lib/A-Schedule/A-Deferred.class.ts} +4 -0
- package/src/lib/A-Schedule/A-Schedule.component.ts +89 -0
- package/src/{types/A_ScheduleObject.types.ts → lib/A-Schedule/A-Schedule.types.ts} +7 -2
- package/src/{global/A_ScheduleObject.class.ts → lib/A-Schedule/A-ScheduleObject.class.ts} +25 -7
- package/tests/A-Channel.test.ts +16 -0
- package/tests/A-Command.test.ts +133 -0
- package/tests/A-Config.test.ts +185 -0
- package/tests/A-Polyfill.test.ts +67 -0
- package/tests/A-Schedule.test.ts +84 -0
- package/tests/jest.setup.ts +35 -0
- package/tsconfig.build.json +56 -0
- package/tsconfig.json +2 -2
- package/dist/src/global/ASEID.class.d.ts +0 -77
- package/dist/src/global/ASEID.class.js +0 -129
- package/dist/src/global/ASEID.class.js.map +0 -1
- package/dist/src/global/A_Deferred.class.js.map +0 -1
- package/dist/src/global/A_Entity.class.d.ts +0 -49
- package/dist/src/global/A_Entity.class.js +0 -94
- package/dist/src/global/A_Entity.class.js.map +0 -1
- package/dist/src/global/A_Error.class.d.ts +0 -13
- package/dist/src/global/A_Error.class.js +0 -63
- package/dist/src/global/A_Error.class.js.map +0 -1
- package/dist/src/global/A_Polyfills.js.map +0 -1
- package/dist/src/global/A_ScheduleObject.class.d.ts +0 -9
- package/dist/src/global/A_ScheduleObject.class.js.map +0 -1
- package/dist/src/global/A_ServerError.class.d.ts +0 -13
- package/dist/src/global/A_ServerError.class.js +0 -57
- package/dist/src/global/A_ServerError.class.js.map +0 -1
- package/dist/src/helpers/A_Common.helper.d.ts +0 -42
- package/dist/src/helpers/A_Common.helper.js +0 -214
- package/dist/src/helpers/A_Common.helper.js.map +0 -1
- package/dist/src/helpers/A_ID.helper.d.ts +0 -17
- package/dist/src/helpers/A_ID.helper.js +0 -26
- package/dist/src/helpers/A_ID.helper.js.map +0 -1
- package/dist/src/helpers/A_Schedule.helper.d.ts +0 -6
- package/dist/src/helpers/A_Schedule.helper.js +0 -21
- package/dist/src/helpers/A_Schedule.helper.js.map +0 -1
- package/dist/src/types/ASEID.types.d.ts +0 -65
- package/dist/src/types/ASEID.types.js.map +0 -1
- package/dist/src/types/A_Common.types.d.ts +0 -59
- package/dist/src/types/A_Common.types.js +0 -3
- package/dist/src/types/A_Common.types.js.map +0 -1
- package/dist/src/types/A_Entity.types.d.ts +0 -13
- package/dist/src/types/A_Entity.types.js +0 -4
- package/dist/src/types/A_Entity.types.js.map +0 -1
- package/dist/src/types/A_Error.type.d.ts +0 -7
- package/dist/src/types/A_Error.type.js +0 -3
- package/dist/src/types/A_Error.type.js.map +0 -1
- package/dist/src/types/A_Error.types.d.ts +0 -7
- package/dist/src/types/A_Error.types.js +0 -3
- package/dist/src/types/A_Error.types.js.map +0 -1
- package/dist/src/types/A_ScheduleObject.types.js +0 -3
- package/dist/src/types/A_ScheduleObject.types.js.map +0 -1
- package/dist/src/types/A_ServerError.types.d.ts +0 -4
- package/dist/src/types/A_ServerError.types.js +0 -3
- package/dist/src/types/A_ServerError.types.js.map +0 -1
- package/src/global/ASEID.class.ts +0 -208
- package/src/global/A_Error.class.ts +0 -88
- package/src/global/A_ServerError.class.ts +0 -70
- package/src/helpers/A_Common.helper.ts +0 -265
- package/src/helpers/A_ID.helper.ts +0 -32
- package/src/helpers/A_Schedule.helper.ts +0 -25
- package/src/types/ASEID.types.ts +0 -86
- package/src/types/A_Common.types.ts +0 -111
- package/src/types/A_Entity.types.ts +0 -17
- package/src/types/A_Error.types.ts +0 -10
- package/src/types/A_ServerError.types.ts +0 -7
- package/tests/default.test.ts +0 -173
- package/tests/polyfill.test.ts +0 -37
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.A_Polyfill = void 0;
|
|
13
|
+
const a_concept_1 = require("@adaas/a-concept");
|
|
14
|
+
const A_Polyfills_class_1 = require("./A-Polyfills.class");
|
|
15
|
+
class A_Polyfill extends a_concept_1.A_Component {
|
|
16
|
+
load() {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
this._polyfill = new A_Polyfills_class_1.A_PolyfillClass();
|
|
19
|
+
yield this._polyfill.fs();
|
|
20
|
+
yield this._polyfill.crypto();
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Allows to use the 'fs' polyfill methods regardless of the environment
|
|
25
|
+
* This method loads the 'fs' polyfill and returns its instance
|
|
26
|
+
*
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
fs() {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
if (!this._polyfill) {
|
|
32
|
+
yield this.load();
|
|
33
|
+
}
|
|
34
|
+
return yield this._polyfill.fs();
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Allows to use the 'crypto' polyfill methods regardless of the environment
|
|
39
|
+
* This method loads the 'crypto' polyfill and returns its instance
|
|
40
|
+
*
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
crypto() {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
if (!this._polyfill) {
|
|
46
|
+
yield this.load();
|
|
47
|
+
}
|
|
48
|
+
return yield this._polyfill.crypto();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.A_Polyfill = A_Polyfill;
|
|
53
|
+
//# sourceMappingURL=A-Polyfill.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A-Polyfill.component.js","sourceRoot":"","sources":["../../../../src/lib/A-Polyfill/A-Polyfill.component.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA+C;AAC/C,2DAAsD;AAItD,MAAa,UAAW,SAAQ,uBAAW;IAIjC,IAAI;;YACN,IAAI,CAAC,SAAS,GAAG,IAAI,mCAAe,EAAE,CAAC;YAEvC,MAAM,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;YAC1B,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;QAClC,CAAC;KAAA;IAGD;;;;;OAKG;IACG,EAAE;;YACJ,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;gBAClB,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YACtB,CAAC;YAED,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;QACrC,CAAC;KAAA;IAED;;;;;OAKG;IACG,MAAM;;YACR,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;gBAClB,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YACtB,CAAC;YAED,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;QACzC,CAAC;KAAA;CACJ;AAvCD,gCAuCC"}
|
|
@@ -3,19 +3,7 @@ interface Ifspolyfill {
|
|
|
3
3
|
existsSync: (path: string) => boolean;
|
|
4
4
|
createReadStream: (path: string, options?: BufferEncoding) => any;
|
|
5
5
|
}
|
|
6
|
-
interface
|
|
6
|
+
interface IcryptoInterface {
|
|
7
7
|
createTextHash(text: string, algorithm: string): Promise<string>;
|
|
8
8
|
createFileHash(filePath: string, algorithm: string): Promise<string>;
|
|
9
9
|
}
|
|
10
|
-
declare class A_PolyfillsClass {
|
|
11
|
-
private _fs;
|
|
12
|
-
private _crypto;
|
|
13
|
-
private fsName;
|
|
14
|
-
private cryptoName;
|
|
15
|
-
fs(): Promise<Ifspolyfill>;
|
|
16
|
-
crypto(): Promise<ICryptoInterface>;
|
|
17
|
-
get env(): 'server' | 'browser';
|
|
18
|
-
private init;
|
|
19
|
-
}
|
|
20
|
-
export declare const A_Polyfills: A_PolyfillsClass;
|
|
21
|
-
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A-Polyfill.types.js","sourceRoot":"","sources":["../../../../src/lib/A-Polyfill/A-Polyfill.types.ts"],"names":[],"mappings":""}
|
|
@@ -32,8 +32,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.
|
|
36
|
-
class
|
|
35
|
+
exports.A_PolyfillClass = void 0;
|
|
36
|
+
class A_PolyfillClass {
|
|
37
37
|
constructor() {
|
|
38
38
|
// eslint-disable-next-line no-use-before-define
|
|
39
39
|
this.fsName = 'fs';
|
|
@@ -119,5 +119,5 @@ class A_PolyfillsClass {
|
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
exports.
|
|
123
|
-
//# sourceMappingURL=
|
|
122
|
+
exports.A_PolyfillClass = A_PolyfillClass;
|
|
123
|
+
//# sourceMappingURL=A-Polyfills.class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A-Polyfills.class.js","sourceRoot":"","sources":["../../../../src/lib/A-Polyfill/A-Polyfills.class.ts"],"names":[],"mappings":"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"}
|
|
@@ -2,6 +2,10 @@ export declare class A_Deferred<T> {
|
|
|
2
2
|
promise: Promise<T>;
|
|
3
3
|
private resolveFn;
|
|
4
4
|
private rejectFn;
|
|
5
|
+
/**
|
|
6
|
+
* Creates a deferred promise
|
|
7
|
+
* @returns A promise that can be resolved or rejected later
|
|
8
|
+
*/
|
|
5
9
|
constructor();
|
|
6
10
|
resolve(value: T | PromiseLike<T>): void;
|
|
7
11
|
reject(reason?: any): void;
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.A_Deferred = void 0;
|
|
4
4
|
class A_Deferred {
|
|
5
|
+
/**
|
|
6
|
+
* Creates a deferred promise
|
|
7
|
+
* @returns A promise that can be resolved or rejected later
|
|
8
|
+
*/
|
|
5
9
|
constructor() {
|
|
6
10
|
this.promise = new Promise((resolve, reject) => {
|
|
7
11
|
this.resolveFn = resolve;
|
|
@@ -16,4 +20,4 @@ class A_Deferred {
|
|
|
16
20
|
}
|
|
17
21
|
}
|
|
18
22
|
exports.A_Deferred = A_Deferred;
|
|
19
|
-
//# sourceMappingURL=
|
|
23
|
+
//# sourceMappingURL=A-Deferred.class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A-Deferred.class.js","sourceRoot":"","sources":["../../../../src/lib/A-Schedule/A-Deferred.class.ts"],"names":[],"mappings":";;;AAAA,MAAa,UAAU;IAKnB;;;OAGG;IACH;QACI,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC9C,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC;YACzB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC;QAC3B,CAAC,CAAC,CAAC;IACP,CAAC;IAED,OAAO,CAAC,KAAyB;QAC7B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,MAAY;QACf,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;CACJ;AAvBD,gCAuBC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { A_Component } from "@adaas/a-concept";
|
|
2
|
+
import { A_ScheduleObject } from "./A-ScheduleObject.class";
|
|
3
|
+
import { A_UTILS_TYPES__ScheduleObjectCallback, A_UTILS_TYPES__ScheduleObjectConfig } from "./A-Schedule.types";
|
|
4
|
+
export declare class A_Schedule extends A_Component {
|
|
5
|
+
/**
|
|
6
|
+
* Allows to schedule a callback for particular time in the future
|
|
7
|
+
*
|
|
8
|
+
* @param timestamp - Unix timestamp in milliseconds
|
|
9
|
+
* @param callback - The callback to execute
|
|
10
|
+
* @returns A promise that resolves to the schedule object
|
|
11
|
+
*/
|
|
12
|
+
schedule<T extends any = any>(
|
|
13
|
+
/**
|
|
14
|
+
* Unix timestamp in milliseconds
|
|
15
|
+
*/
|
|
16
|
+
timestamp: number,
|
|
17
|
+
/**
|
|
18
|
+
* The callback to execute
|
|
19
|
+
*/
|
|
20
|
+
callback: A_UTILS_TYPES__ScheduleObjectCallback<T>,
|
|
21
|
+
/**
|
|
22
|
+
* Configuration options for the schedule object
|
|
23
|
+
*/
|
|
24
|
+
config?: A_UTILS_TYPES__ScheduleObjectConfig): Promise<A_ScheduleObject<T>>;
|
|
25
|
+
schedule<T extends any = any>(
|
|
26
|
+
/**
|
|
27
|
+
* ISO date string representing the date and time to schedule the callback for
|
|
28
|
+
*/
|
|
29
|
+
date: string,
|
|
30
|
+
/**
|
|
31
|
+
* The callback to execute
|
|
32
|
+
*/
|
|
33
|
+
callback: A_UTILS_TYPES__ScheduleObjectCallback<T>,
|
|
34
|
+
/**
|
|
35
|
+
* Configuration options for the schedule object
|
|
36
|
+
*/
|
|
37
|
+
config?: A_UTILS_TYPES__ScheduleObjectConfig): Promise<A_ScheduleObject<T>>;
|
|
38
|
+
/**
|
|
39
|
+
* Allows to execute callback after particular delay in milliseconds
|
|
40
|
+
* So the callback will be executed after the specified delay
|
|
41
|
+
*
|
|
42
|
+
* @param ms
|
|
43
|
+
*/
|
|
44
|
+
delay<T extends any = any>(
|
|
45
|
+
/**
|
|
46
|
+
* Delay in milliseconds
|
|
47
|
+
*/
|
|
48
|
+
ms: number,
|
|
49
|
+
/**
|
|
50
|
+
* The callback to execute after the delay
|
|
51
|
+
*/
|
|
52
|
+
callback: A_UTILS_TYPES__ScheduleObjectCallback<T>,
|
|
53
|
+
/**
|
|
54
|
+
* Configuration options for the schedule object
|
|
55
|
+
*/
|
|
56
|
+
config?: A_UTILS_TYPES__ScheduleObjectConfig): Promise<A_ScheduleObject<T>>;
|
|
57
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.A_Schedule = void 0;
|
|
13
|
+
const a_concept_1 = require("@adaas/a-concept");
|
|
14
|
+
const A_ScheduleObject_class_1 = require("./A-ScheduleObject.class");
|
|
15
|
+
class A_Schedule extends a_concept_1.A_Component {
|
|
16
|
+
schedule(date, callback, config) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const timestamp = a_concept_1.A_TypeGuards.isString(date)
|
|
19
|
+
? (new Date(date)).getTime()
|
|
20
|
+
: date;
|
|
21
|
+
return new A_ScheduleObject_class_1.A_ScheduleObject(timestamp - Date.now(), callback, config);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Allows to execute callback after particular delay in milliseconds
|
|
26
|
+
* So the callback will be executed after the specified delay
|
|
27
|
+
*
|
|
28
|
+
* @param ms
|
|
29
|
+
*/
|
|
30
|
+
delay(
|
|
31
|
+
/**
|
|
32
|
+
* Delay in milliseconds
|
|
33
|
+
*/
|
|
34
|
+
ms,
|
|
35
|
+
/**
|
|
36
|
+
* The callback to execute after the delay
|
|
37
|
+
*/
|
|
38
|
+
callback,
|
|
39
|
+
/**
|
|
40
|
+
* Configuration options for the schedule object
|
|
41
|
+
*/
|
|
42
|
+
config) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
return new A_ScheduleObject_class_1.A_ScheduleObject(ms, callback, config);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.A_Schedule = A_Schedule;
|
|
49
|
+
//# sourceMappingURL=A-Schedule.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A-Schedule.component.js","sourceRoot":"","sources":["../../../../src/lib/A-Schedule/A-Schedule.component.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA6D;AAC7D,qEAA4D;AAK5D,MAAa,UAAW,SAAQ,uBAAW;IAqCjC,QAAQ,CACV,IAAqB,EACrB,QAAkD,EAClD,MAA4C;;YAG5C,MAAM,SAAS,GAAG,wBAAY,CAAC,QAAQ,CAAC,IAAI,CAAC;gBACzC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE;gBAC5B,CAAC,CAAC,IAAI,CAAC;YAEX,OAAO,IAAI,yCAAgB,CACvB,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,EACtB,QAAQ,EACR,MAAM,CACT,CAAC;QACN,CAAC;KAAA;IAID;;;;;OAKG;IACG,KAAK;IACP;;OAEG;IACH,EAAU;IACV;;OAEG;IACH,QAAkD;IAClD;;MAEE;IACF,MAA4C;;YAE5C,OAAO,IAAI,yCAAgB,CACvB,EAAE,EACF,QAAQ,EACR,MAAM,CACT,CAAC;QACN,CAAC;KAAA;CACJ;AAlFD,gCAkFC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type A_UTILS_TYPES__ScheduleObjectConfig = {
|
|
2
2
|
/**
|
|
3
3
|
* If the timeout is cleared, should the promise resolve or reject?
|
|
4
4
|
* BY Default it rejects
|
|
@@ -7,3 +7,4 @@ export type A_TYPES__ScheduleObjectConfig = {
|
|
|
7
7
|
*/
|
|
8
8
|
resolveOnClear: boolean;
|
|
9
9
|
};
|
|
10
|
+
export type A_UTILS_TYPES__ScheduleObjectCallback<T> = () => Promise<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A-Schedule.types.js","sourceRoot":"","sources":["../../../../src/lib/A-Schedule/A-Schedule.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { A_UTILS_TYPES__ScheduleObjectCallback, A_UTILS_TYPES__ScheduleObjectConfig } from "./A-Schedule.types";
|
|
2
|
+
export declare class A_ScheduleObject<T extends any = any> {
|
|
3
|
+
private timeout;
|
|
4
|
+
private deferred;
|
|
5
|
+
private config;
|
|
6
|
+
/**
|
|
7
|
+
* Creates a scheduled object that will execute the action after specified milliseconds
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* @param ms - milliseconds to wait before executing the action
|
|
11
|
+
* @param action - the action to execute
|
|
12
|
+
* @param config - configuration options for the schedule object
|
|
13
|
+
*/
|
|
14
|
+
constructor(
|
|
15
|
+
/**
|
|
16
|
+
* Milliseconds to wait before executing the action
|
|
17
|
+
*/
|
|
18
|
+
ms: number,
|
|
19
|
+
/**
|
|
20
|
+
* The action to execute after the specified milliseconds
|
|
21
|
+
*/
|
|
22
|
+
action: A_UTILS_TYPES__ScheduleObjectCallback<T>,
|
|
23
|
+
/**
|
|
24
|
+
* Configuration options for the schedule object
|
|
25
|
+
*/
|
|
26
|
+
config?: A_UTILS_TYPES__ScheduleObjectConfig);
|
|
27
|
+
get promise(): Promise<T>;
|
|
28
|
+
clear(): void;
|
|
29
|
+
}
|
package/dist/src/{global/A_ScheduleObject.class.js → lib/A-Schedule/A-ScheduleObject.class.js}
RENAMED
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.A_ScheduleObject = void 0;
|
|
4
|
-
const A_Deferred_class_1 = require("./
|
|
5
|
-
const
|
|
4
|
+
const A_Deferred_class_1 = require("./A-Deferred.class");
|
|
5
|
+
const a_concept_1 = require("@adaas/a-concept");
|
|
6
6
|
class A_ScheduleObject {
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Creates a scheduled object that will execute the action after specified milliseconds
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* @param ms - milliseconds to wait before executing the action
|
|
12
|
+
* @param action - the action to execute
|
|
13
|
+
* @param config - configuration options for the schedule object
|
|
14
|
+
*/
|
|
15
|
+
constructor(
|
|
16
|
+
/**
|
|
17
|
+
* Milliseconds to wait before executing the action
|
|
18
|
+
*/
|
|
19
|
+
ms,
|
|
20
|
+
/**
|
|
21
|
+
* The action to execute after the specified milliseconds
|
|
22
|
+
*/
|
|
23
|
+
action,
|
|
24
|
+
/**
|
|
25
|
+
* Configuration options for the schedule object
|
|
26
|
+
*/
|
|
27
|
+
config) {
|
|
8
28
|
this.config = {
|
|
9
29
|
/**
|
|
10
30
|
* If the timeout is cleared, should the promise resolve or reject?
|
|
@@ -30,9 +50,9 @@ class A_ScheduleObject {
|
|
|
30
50
|
if (this.config.resolveOnClear)
|
|
31
51
|
this.deferred.resolve(undefined);
|
|
32
52
|
else
|
|
33
|
-
this.deferred.reject(new
|
|
53
|
+
this.deferred.reject(new a_concept_1.A_Error("Timeout Cleared"));
|
|
34
54
|
}
|
|
35
55
|
}
|
|
36
56
|
}
|
|
37
57
|
exports.A_ScheduleObject = A_ScheduleObject;
|
|
38
|
-
//# sourceMappingURL=
|
|
58
|
+
//# sourceMappingURL=A-ScheduleObject.class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A-ScheduleObject.class.js","sourceRoot":"","sources":["../../../../src/lib/A-Schedule/A-ScheduleObject.class.ts"],"names":[],"mappings":";;;AAAA,yDAAgD;AAChD,gDAA2C;AAG3C,MAAa,gBAAgB;IAgBzB;;;;;;;OAOG;IACH;IACI;;OAEG;IACH,EAAU;IACV;;OAEG;IACH,MAAgD;IAChD;;OAEG;IACH,MAA4C;QA/BxC,WAAM,GAAwC;YAClD;;;;;eAKG;YACH,cAAc,EAAE,KAAK;SACxB,CAAC;QAyBE,IAAI,MAAM;YACN,IAAI,CAAC,MAAM,mCAAQ,IAAI,CAAC,MAAM,GAAK,MAAM,CAAE,CAAC;QAEhD,IAAI,CAAC,QAAQ,GAAG,IAAI,6BAAU,EAAK,CAAC;QAEpC,IAAI,CAAC,OAAO,GAAG,UAAU,CACrB,GAAG,EAAE,CAAC,MAAM,EAAE;aACT,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;aACjD,KAAK,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,EACtD,EAAE,CACL,CAAC;IACN,CAAC;IAED,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;IACjC,CAAC;IAED,KAAK;QACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAE3B,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc;gBAC1B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAc,CAAC,CAAC;;gBAEtC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,mBAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC;QAC7D,CAAC;IACL,CAAC;CACJ;AAjED,4CAiEC"}
|
package/index.ts
CHANGED
|
@@ -1,64 +1,39 @@
|
|
|
1
1
|
|
|
2
|
+
export { A_Channel } from './src/lib/A-Channel/A-Channel.component';
|
|
3
|
+
export { A_ChannelError } from './src/lib/A-Channel/A-Channel.error';
|
|
4
|
+
// export * from './src/lib/A-Channel/A-Channel.types';
|
|
2
5
|
|
|
3
|
-
// ====================== EXPORTS ======================
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// --- Helpers ---
|
|
7
|
-
export { A_CommonHelper } from './src/helpers/A_Common.helper';
|
|
8
|
-
export { A_IdentityHelper } from './src/helpers/A_ID.helper';
|
|
9
|
-
export { A_ScheduleHelper } from './src/helpers/A_Schedule.helper';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// --- Global ---
|
|
13
|
-
export { A_Error } from './src/global/A_Error.class';
|
|
14
|
-
export { A_ServerError } from './src/global/A_ServerError.class';
|
|
15
|
-
|
|
16
|
-
export { ASEID } from './src/global/ASEID.class';
|
|
17
|
-
|
|
18
|
-
export { A_ScheduleObject } from './src/global/A_ScheduleObject.class';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
A_Polyfills
|
|
24
|
-
} from './src/global/A_Polyfills'
|
|
25
|
-
|
|
26
|
-
// --- Constants ---
|
|
27
|
-
export { A_CONSTANTS__ERROR_CODES } from './src/constants/errors.constants';
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// --- Types ---
|
|
31
|
-
export {
|
|
32
|
-
A_TYPES__DeepPartial,
|
|
33
|
-
A_TYPES__Dictionary,
|
|
34
|
-
A_TYPES__ObjectKeyEnum,
|
|
35
|
-
A_TYPES__Required,
|
|
36
|
-
A_TYPES__Paths,
|
|
37
|
-
A_TYPES__PathsToObject,
|
|
38
|
-
A_TYPES__UnionToIntersection,
|
|
39
|
-
A_TYPES__ExtractProperties,
|
|
40
|
-
A_TYPES__ExtractNested,
|
|
41
|
-
A_TYPES__NonObjectPaths
|
|
42
|
-
} from './src/types/A_Common.types';
|
|
43
|
-
export {
|
|
44
|
-
A_TYPES__IAEntity,
|
|
45
|
-
A_TYPES__AEntity_JSON
|
|
46
|
-
} from './src/types/A_Entity.types';
|
|
47
|
-
export {
|
|
48
|
-
A_TYPES__ScheduleObjectConfig
|
|
49
|
-
} from './src/types/A_ScheduleObject.types';
|
|
50
|
-
export {
|
|
51
|
-
A_TYPES__Error
|
|
52
|
-
} from './src/types/A_Error.types';
|
|
53
|
-
export {
|
|
54
|
-
A_TYPES__ServerError
|
|
55
|
-
} from './src/types/A_ServerError.types';
|
|
56
|
-
export {
|
|
57
|
-
A_TYPES__ASEID_Constructor,
|
|
58
|
-
A_TYPES__ASEID_ConstructorConfig,
|
|
59
|
-
A_TYPES__ASEID_JSON
|
|
60
|
-
} from './src/types/ASEID.types';
|
|
61
6
|
|
|
7
|
+
export { A_Command } from './src/lib/A-Command/A-Command.entity';
|
|
8
|
+
export { A_CommandError } from './src/lib/A-Command/A-Command.error';
|
|
9
|
+
export * from './src/lib/A-Command/A-Command.types';
|
|
10
|
+
export * from './src/lib/A-Command/A-Command.constants';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export { A_ConfigLoader } from './src/lib/A-Config/A-Config.container';
|
|
14
|
+
export { A_Config } from './src/lib/A-Config/A-Config.context';
|
|
15
|
+
export { A_ConfigError } from './src/lib/A-Config/A-Config.error';
|
|
16
|
+
export { ConfigReader } from './src/lib/A-Config/components/ConfigReader.component';
|
|
17
|
+
export { ENVConfigReader } from './src/lib/A-Config/components/ENVConfigReader.component';
|
|
18
|
+
export { FileConfigReader } from './src/lib/A-Config/components/FileConfigReader.component';
|
|
19
|
+
export * from './src/lib/A-Config/A-Config.types';
|
|
20
|
+
export * from './src/lib/A-Config/A-Config.constants';
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export { A_Memory } from './src/lib/A-Memory/A-Memory.context'
|
|
24
|
+
|
|
25
|
+
export { A_Polyfill } from './src/lib/A-Polyfill/A-Polyfill.component';
|
|
26
|
+
export { A_PolyfillClass } from './src/lib/A-Polyfill/A-Polyfills.class';
|
|
27
|
+
// export * from './src/lib/A-Polyfill/A-Polyfill.types';
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
export { A_Schedule } from './src/lib/A-Schedule/A-Schedule.component'
|
|
34
|
+
export * from './src/lib/A-Schedule/A-Schedule.types'
|
|
35
|
+
export { A_ScheduleObject } from './src/lib/A-Schedule/A-ScheduleObject.class'
|
|
36
|
+
export { A_Deferred } from './src/lib/A-Schedule/A-Deferred.class'
|
|
62
37
|
|
|
63
38
|
|
|
64
39
|
|
package/jest.config.ts
CHANGED
|
@@ -3,16 +3,16 @@ import type { Config } from '@jest/types';
|
|
|
3
3
|
// Sync object
|
|
4
4
|
const config: Config.InitialOptions = {
|
|
5
5
|
verbose: true,
|
|
6
|
-
|
|
6
|
+
setupFilesAfterEnv: ['<rootDir>/tests/jest.setup.ts'],
|
|
7
7
|
transform: {
|
|
8
8
|
'^.+\\.tsx?$': 'ts-jest'
|
|
9
9
|
},
|
|
10
10
|
moduleNameMapper: {
|
|
11
11
|
"@adaas/a-utils/constants/(.*)": ["<rootDir>/src/constants/$1"],
|
|
12
|
-
"@adaas/a-utils/
|
|
12
|
+
"@adaas/a-utils/lib/(.*)": ["<rootDir>/src/lib/$1"],
|
|
13
13
|
"@adaas/a-utils/types/(.*)": ["<rootDir>/src/types/$1"],
|
|
14
14
|
"@adaas/a-utils/helpers/(.*)": ["<rootDir>/src/helpers/$1"],
|
|
15
|
-
"@adaas/a-utils/
|
|
15
|
+
"@adaas/a-utils/utils/(.*)": ["<rootDir>/src/utils/$1"],
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaas/a-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "A-Utils is a set of utilities that are used across the ADAAS ecosystem. This package is designed to be a collection of utilities that are used across the ADAAS ecosystem.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
"ext": "ts, js"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
|
-
"test": "jest",
|
|
27
|
+
"test": "jest ",
|
|
28
28
|
"start": "nodemon ./tests/log.ts",
|
|
29
|
-
"publish": "npm run build && git add . && git commit -m \"new version created :: $(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g')\" && npm version patch && npm publish --access public",
|
|
29
|
+
"publish": "npm run test && npm run build && git add . && git commit -m \"new version created :: $(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g')\" && npm version patch && npm publish --access public",
|
|
30
30
|
"preversion": "echo test",
|
|
31
31
|
"version": "echo git add .",
|
|
32
32
|
"postversion": "git push --no-verify && git push --tags --no-verify && echo \"\n======Version Pushed Successfully=====\n\" ",
|
|
33
33
|
"echo-version": "echo $npm_package_version",
|
|
34
|
-
"build": "tsc --declaration --project tsconfig.json && tscpaths -p tsconfig.json -s ./ -o ./dist
|
|
34
|
+
"build": "rm -rf ./dist && tsc --declaration --project tsconfig.build.json && tscpaths -p tsconfig.build.json -s ./ -o ./dist"
|
|
35
35
|
},
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
},
|
|
50
50
|
"homepage": "https://github.com/ADAAS-org/adaas-adf-auth#readme",
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"
|
|
52
|
+
"@adaas/a-concept": "^0.1.15",
|
|
53
|
+
"@types/node": "^20.10.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/chai": "^4.3.14",
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export enum A_CONSTANTS__ERROR_CODES {
|
|
3
|
-
// Default Utils Errors
|
|
4
|
-
INCORRECT_A_ENTITY_CONSTRUCTOR = 'ERR-A-Entity-0001',
|
|
5
|
-
INVALID_ASEID = 'ERR-ASEID-0001',
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
UNEXPECTED_ERROR = 'ERR-0001',
|
|
9
|
-
METHOD_NOT_IMPLEMENTED = 'ERR-0002',
|
|
10
|
-
ROUTE_NOT_FOUND = 'ERR-0003',
|
|
11
|
-
TOKEN_NOT_PROVIDED = 'ERR-0004',
|
|
12
|
-
NOT_ALL_PARAMS_WAS_PROVIDED = 'ERR-0005',
|
|
13
|
-
CREDENTIALS_NOT_PROVIDED = 'ERR-0006',
|
|
14
|
-
CONFIGURATION_PROPERTY_NOT_EXISTS_OR_NOT_ALLOWED_TO_READ = 'ERR-0007',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export const A_CONSTANTS__DEFAULT_ERRORS = {
|
|
19
|
-
// Default A-Utils Errors
|
|
20
|
-
INCORRECT_A_ENTITY_CONSTRUCTOR: {
|
|
21
|
-
code: A_CONSTANTS__ERROR_CODES.INCORRECT_A_ENTITY_CONSTRUCTOR,
|
|
22
|
-
description: 'The A_Entity constructor was called with incorrect parameters.',
|
|
23
|
-
message: 'Incorrect A_Entity constructor parameters.'
|
|
24
|
-
},
|
|
25
|
-
INVALID_ASEID: {
|
|
26
|
-
code: A_CONSTANTS__ERROR_CODES.INVALID_ASEID,
|
|
27
|
-
description: 'The provided ASEID is invalid.',
|
|
28
|
-
message: 'Invalid ASEID provided.'
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// Default Utils Server Errors
|
|
33
|
-
UNEXPECTED_ERROR: {
|
|
34
|
-
serverCode: 500,
|
|
35
|
-
code: A_CONSTANTS__ERROR_CODES.UNEXPECTED_ERROR,
|
|
36
|
-
description: 'If you see this error please let us know.',
|
|
37
|
-
message: 'Oops... Something went wrong',
|
|
38
|
-
},
|
|
39
|
-
METHOD_NOT_IMPLEMENTED: {
|
|
40
|
-
serverCode: 500,
|
|
41
|
-
code: A_CONSTANTS__ERROR_CODES.METHOD_NOT_IMPLEMENTED,
|
|
42
|
-
description: 'If you see this error please let us know.',
|
|
43
|
-
message: 'Oops... Something went wrong',
|
|
44
|
-
link: 'https://support.adaas.org/error/' + A_CONSTANTS__ERROR_CODES.UNEXPECTED_ERROR
|
|
45
|
-
},
|
|
46
|
-
ROUTE_NOT_FOUND: {
|
|
47
|
-
serverCode: 404,
|
|
48
|
-
code: A_CONSTANTS__ERROR_CODES.ROUTE_NOT_FOUND,
|
|
49
|
-
description: 'We can not find the route you\'re looking for. Please make sure that you\'re using the correct path.',
|
|
50
|
-
message: 'The target route is not found.'
|
|
51
|
-
},
|
|
52
|
-
TOKEN_NOT_PROVIDED: {
|
|
53
|
-
serverCode: 401,
|
|
54
|
-
code: A_CONSTANTS__ERROR_CODES.TOKEN_NOT_PROVIDED,
|
|
55
|
-
description: 'The token is missed in the Authorization header. Please make sure that it\'s presented.',
|
|
56
|
-
message: 'Token has not found in the authorization header.'
|
|
57
|
-
},
|
|
58
|
-
NOT_ALL_PARAMS_WAS_PROVIDED: {
|
|
59
|
-
serverCode: 409,
|
|
60
|
-
code: A_CONSTANTS__ERROR_CODES.NOT_ALL_PARAMS_WAS_PROVIDED,
|
|
61
|
-
description: 'Not all required params provided in the request',
|
|
62
|
-
message: 'Conflict in request'
|
|
63
|
-
},
|
|
64
|
-
CREDENTIALS_NOT_PROVIDED: {
|
|
65
|
-
code: A_CONSTANTS__ERROR_CODES.CREDENTIALS_NOT_PROVIDED,
|
|
66
|
-
description: 'The credentials are missed. Please make sure that they are presented.',
|
|
67
|
-
message: 'Credentials has not found in the request.'
|
|
68
|
-
},
|
|
69
|
-
CONFIGURATION_PROPERTY_NOT_EXISTS_OR_NOT_ALLOWED_TO_READ: {
|
|
70
|
-
serverCode: 403,
|
|
71
|
-
code: A_CONSTANTS__ERROR_CODES.CONFIGURATION_PROPERTY_NOT_EXISTS_OR_NOT_ALLOWED_TO_READ,
|
|
72
|
-
description: 'The configuration property is not exists or not allowed to read.',
|
|
73
|
-
message: 'Configuration property is not exists or not allowed to read.'
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
File without changes
|