@adaas/a-utils 0.0.2
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/.nvmrc +1 -0
- package/LICENSE +22 -0
- package/README.md +49 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/src/constants/errors.constants.d.ts +65 -0
- package/dist/src/constants/errors.constants.js +74 -0
- package/dist/src/constants/errors.constants.js.map +1 -0
- package/dist/src/global/ASEID.class.d.ts +77 -0
- package/dist/src/global/ASEID.class.js +129 -0
- package/dist/src/global/ASEID.class.js.map +1 -0
- package/dist/src/global/A_Deferred.class.d.ts +8 -0
- package/dist/src/global/A_Deferred.class.js +19 -0
- package/dist/src/global/A_Deferred.class.js.map +1 -0
- package/dist/src/global/A_Entity.class.d.ts +49 -0
- package/dist/src/global/A_Entity.class.js +94 -0
- package/dist/src/global/A_Entity.class.js.map +1 -0
- package/dist/src/global/A_Error.class.d.ts +13 -0
- package/dist/src/global/A_Error.class.js +54 -0
- package/dist/src/global/A_Error.class.js.map +1 -0
- package/dist/src/global/A_Polyfills.d.ts +21 -0
- package/dist/src/global/A_Polyfills.js +123 -0
- package/dist/src/global/A_Polyfills.js.map +1 -0
- package/dist/src/global/A_ScheduleObject.class.d.ts +9 -0
- package/dist/src/global/A_ScheduleObject.class.js +38 -0
- package/dist/src/global/A_ScheduleObject.class.js.map +1 -0
- package/dist/src/global/A_ServerError.class.d.ts +13 -0
- package/dist/src/global/A_ServerError.class.js +57 -0
- package/dist/src/global/A_ServerError.class.js.map +1 -0
- package/dist/src/helpers/A_Common.helper.d.ts +32 -0
- package/dist/src/helpers/A_Common.helper.js +184 -0
- package/dist/src/helpers/A_Common.helper.js.map +1 -0
- package/dist/src/helpers/A_Schedule.helper.d.ts +6 -0
- package/dist/src/helpers/A_Schedule.helper.js +21 -0
- package/dist/src/helpers/A_Schedule.helper.js.map +1 -0
- package/dist/src/types/ASEID.types.d.ts +65 -0
- package/dist/src/types/ASEID.types.js +5 -0
- package/dist/src/types/ASEID.types.js.map +1 -0
- package/dist/src/types/A_Common.types.d.ts +59 -0
- package/dist/src/types/A_Common.types.js +3 -0
- package/dist/src/types/A_Common.types.js.map +1 -0
- package/dist/src/types/A_Entity.types.d.ts +13 -0
- package/dist/src/types/A_Entity.types.js +4 -0
- package/dist/src/types/A_Entity.types.js.map +1 -0
- package/dist/src/types/A_Error.type.d.ts +7 -0
- package/dist/src/types/A_Error.type.js +3 -0
- package/dist/src/types/A_Error.type.js.map +1 -0
- package/dist/src/types/A_Error.types.d.ts +7 -0
- package/dist/src/types/A_Error.types.js +3 -0
- package/dist/src/types/A_Error.types.js.map +1 -0
- package/dist/src/types/A_ScheduleObject.types.d.ts +9 -0
- package/dist/src/types/A_ScheduleObject.types.js +3 -0
- package/dist/src/types/A_ScheduleObject.types.js.map +1 -0
- package/dist/src/types/A_ServerError.types.d.ts +4 -0
- package/dist/src/types/A_ServerError.types.js +3 -0
- package/dist/src/types/A_ServerError.types.js.map +1 -0
- package/docs/a-logo-docs.png +0 -0
- package/index.ts +64 -0
- package/jest.config.ts +19 -0
- package/package.json +73 -0
- package/src/constants/errors.constants.ts +78 -0
- package/src/global/ASEID.class.ts +208 -0
- package/src/global/A_Deferred.class.ts +20 -0
- package/src/global/A_Entity.class.ts +134 -0
- package/src/global/A_Error.class.ts +75 -0
- package/src/global/A_Polyfills.ts +112 -0
- package/src/global/A_ScheduleObject.class.ts +53 -0
- package/src/global/A_ServerError.class.ts +70 -0
- package/src/helpers/A_Common.helper.ts +229 -0
- package/src/helpers/A_Schedule.helper.ts +25 -0
- package/src/types/ASEID.types.ts +86 -0
- package/src/types/A_Common.types.ts +111 -0
- package/src/types/A_Entity.types.ts +17 -0
- package/src/types/A_Error.types.ts +10 -0
- package/src/types/A_ScheduleObject.types.ts +9 -0
- package/src/types/A_ServerError.types.ts +7 -0
- package/tests/default.test.ts +160 -0
- package/tests/polyfill.test.ts +37 -0
- package/tsconfig.json +58 -0
- package/tslint.json +98 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface A_TYPES__ASEID_Constructor {
|
|
2
|
+
/**
|
|
3
|
+
* Namespace for the ASEID
|
|
4
|
+
* Generally it is the application name or code, should correspond to the namespace of the application
|
|
5
|
+
* Could be ID or ASEID
|
|
6
|
+
*/
|
|
7
|
+
namespace?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Entity Scope the primary location of the resource
|
|
10
|
+
* Organization, or organization Unit
|
|
11
|
+
* Could be ID or ASEID
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
scope: number | string;
|
|
15
|
+
/**
|
|
16
|
+
* Entity Type the type of the resource
|
|
17
|
+
*/
|
|
18
|
+
entity: string;
|
|
19
|
+
/**
|
|
20
|
+
* Entity ID the unique identifier of the resource
|
|
21
|
+
*/
|
|
22
|
+
id: number | string;
|
|
23
|
+
/**
|
|
24
|
+
* Version of the entity (optional)
|
|
25
|
+
*/
|
|
26
|
+
version?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Shard of the entity (optional)
|
|
29
|
+
*/
|
|
30
|
+
shard?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface A_TYPES__ASEID_ConstructorConfig {
|
|
33
|
+
/**
|
|
34
|
+
* If true, the entity ASEID will be distributed across multiple shards.
|
|
35
|
+
* In this case SHARD should be provided via Environment Variables (A_SHARD) or Configurations
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
sharding?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export type A_TYPES__ASEID_JSON = {
|
|
41
|
+
/**
|
|
42
|
+
* Namespace for the ASEID
|
|
43
|
+
*/
|
|
44
|
+
namespace: string;
|
|
45
|
+
/**
|
|
46
|
+
* Entity Scope the primary location of the resource
|
|
47
|
+
*/
|
|
48
|
+
scope: string;
|
|
49
|
+
/**
|
|
50
|
+
* Entity Type the type of the resource
|
|
51
|
+
*/
|
|
52
|
+
entity: string;
|
|
53
|
+
/**
|
|
54
|
+
* Entity ID the unique identifier of the resource
|
|
55
|
+
*/
|
|
56
|
+
id: string;
|
|
57
|
+
/**
|
|
58
|
+
* Version of the entity (optional)
|
|
59
|
+
*/
|
|
60
|
+
version?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Shard of the entity (optional)
|
|
63
|
+
*/
|
|
64
|
+
shard?: string;
|
|
65
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ASEID.types.js","sourceRoot":"","sources":["../../../src/types/ASEID.types.ts"],"names":[],"mappings":";;AAqCC,CAAC;AAYD,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export type A_AUTH_RequestParam = {
|
|
2
|
+
id?: string;
|
|
3
|
+
/**
|
|
4
|
+
* The issuer of the parameter. Could be system, custom, proxy, credentials or SIC to data provider service(e.g. CSS)
|
|
5
|
+
*/
|
|
6
|
+
issuer?: 'system' | 'custom' | 'proxy' | 'credentials' | string;
|
|
7
|
+
/**
|
|
8
|
+
* Common internal value, uses for proper mapping
|
|
9
|
+
*/
|
|
10
|
+
key?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Allows to define the type of the parameter to convert input during the execution
|
|
13
|
+
*/
|
|
14
|
+
type: 'json' | 'array' | 'number' | 'string' | 'boolean' | 'base_64' | 'file' | 'file_url';
|
|
15
|
+
/**
|
|
16
|
+
* The name of the parameter
|
|
17
|
+
*/
|
|
18
|
+
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* The value of the parameter
|
|
21
|
+
*/
|
|
22
|
+
value: string;
|
|
23
|
+
};
|
|
24
|
+
type Decrement = [never, 0, 1, 2, 3, 4, 5];
|
|
25
|
+
export type A_TYPES__DeepPartial<T, D extends number = 5> = {
|
|
26
|
+
[P in keyof Required<T>]?: [
|
|
27
|
+
D
|
|
28
|
+
] extends [never] ? any : Required<T>[P] extends Array<infer U> ? Array<A_TYPES__DeepPartial<U, Decrement[D]>> : Required<T>[P] extends Function ? Required<T>[P] : Required<T>[P] extends object ? A_TYPES__DeepPartial<T[P], Decrement[D]> : T[P];
|
|
29
|
+
};
|
|
30
|
+
export type A_TYPES__ObjectKeyEnum<T, E> = {
|
|
31
|
+
[P in keyof Required<T>]?: T[P] extends object ? A_TYPES__ObjectKeyEnum<T[P], E> : E;
|
|
32
|
+
};
|
|
33
|
+
export type A_TYPES__Dictionary<T> = {
|
|
34
|
+
[Key: string]: T;
|
|
35
|
+
};
|
|
36
|
+
export type A_TYPES__NonObjectPaths<T> = T extends object ? {
|
|
37
|
+
[K in keyof T]: `${Exclude<K, symbol>}${""}`;
|
|
38
|
+
}[keyof T] : never;
|
|
39
|
+
export type A_TYPES__Paths<T, D extends number = 5> = [D] extends [never] ? never : (T extends object ? {
|
|
40
|
+
[K in keyof T]: `${Exclude<K, symbol>}${"" | `.${A_TYPES__Paths<T[K], Decrement[D]>}`}`;
|
|
41
|
+
}[keyof T] : never);
|
|
42
|
+
export type A_TYPES__UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
43
|
+
export type A_TYPES__PathsToObject<_Obj, T extends readonly string[]> = A_TYPES__UnionToIntersection<{
|
|
44
|
+
[K in keyof T]: T[K] extends `${infer Key}.${infer Rest}` ? {
|
|
45
|
+
[P in Key]: P extends keyof _Obj ? A_TYPES__PathsToObject<Required<_Obj>[P], [Rest]> : any;
|
|
46
|
+
} : {
|
|
47
|
+
[P in T[K]]: `${T[K]}` extends keyof Required<_Obj> ? Required<_Obj>[`${T[K]}`] : never;
|
|
48
|
+
};
|
|
49
|
+
}[number]>;
|
|
50
|
+
export type A_TYPES__Required<T, arr extends (A_TYPES__Paths<T>)[] = (A_TYPES__Paths<T>)[]> = A_TYPES__PathsToObject<T, arr> & T;
|
|
51
|
+
export type A_TYPES__ExtractNested<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? {
|
|
52
|
+
[Key in K]: A_TYPES__ExtractNested<T[K], Rest>;
|
|
53
|
+
} : never : P extends keyof T ? {
|
|
54
|
+
[Key in P]: T[P];
|
|
55
|
+
} : never;
|
|
56
|
+
export type A_TYPES__ExtractProperties<T, P extends A_TYPES__Paths<T>[]> = A_TYPES__UnionToIntersection<{
|
|
57
|
+
[K in keyof P]: P[K] extends string ? A_TYPES__ExtractNested<T, P[K]> : never;
|
|
58
|
+
}[number]>;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A_Common.types.js","sourceRoot":"","sources":["../../../src/types/A_Common.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A_Entity.types.js","sourceRoot":"","sources":["../../../src/types/A_Entity.types.ts"],"names":[],"mappings":";;AAOC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A_Error.type.js","sourceRoot":"","sources":["../../../src/types/A_Error.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A_Error.types.js","sourceRoot":"","sources":["../../../src/types/A_Error.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type A_TYPES__ScheduleObjectConfig = {
|
|
2
|
+
/**
|
|
3
|
+
* If the timeout is cleared, should the promise resolve or reject?
|
|
4
|
+
* BY Default it rejects
|
|
5
|
+
*
|
|
6
|
+
* !!!NOTE: If the property is set to true, the promise will resolve with undefined
|
|
7
|
+
*/
|
|
8
|
+
resolveOnClear: boolean;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A_ScheduleObject.types.js","sourceRoot":"","sources":["../../../src/types/A_ScheduleObject.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A_ServerError.types.js","sourceRoot":"","sources":["../../../src/types/A_ServerError.types.ts"],"names":[],"mappings":""}
|
|
Binary file
|
package/index.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
// ====================== EXPORTS ======================
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// --- Helpers ---
|
|
7
|
+
export { A_CommonHelper } from './src/helpers/A_Common.helper';
|
|
8
|
+
export { A_ScheduleHelper } from './src/helpers/A_Schedule.helper';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// --- Global ---
|
|
12
|
+
export { A_Error } from './src/global/A_Error.class';
|
|
13
|
+
export { A_ServerError } from './src/global/A_ServerError.class';
|
|
14
|
+
|
|
15
|
+
export { ASEID } from './src/global/ASEID.class';
|
|
16
|
+
export { A_Entity } from './src/global/A_Entity.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
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Config } from '@jest/types';
|
|
2
|
+
|
|
3
|
+
// Sync object
|
|
4
|
+
const config: Config.InitialOptions = {
|
|
5
|
+
verbose: true,
|
|
6
|
+
|
|
7
|
+
transform: {
|
|
8
|
+
'^.+\\.tsx?$': 'ts-jest'
|
|
9
|
+
},
|
|
10
|
+
moduleNameMapper: {
|
|
11
|
+
"@adaas/a-utils/constants/(.*)": ["<rootDir>/src/constants/$1"],
|
|
12
|
+
"@adaas/a-utils/global/(.*)": ["<rootDir>/src/global/$1"],
|
|
13
|
+
"@adaas/a-utils/types/(.*)": ["<rootDir>/src/types/$1"],
|
|
14
|
+
"@adaas/a-utils/helpers/(.*)": ["<rootDir>/src/helpers/$1"],
|
|
15
|
+
"@adaas/a-utils/decorators/(.*)": ["<rootDir>/src/decorators/$1"],
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
};
|
|
19
|
+
export default config;
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@adaas/a-utils",
|
|
3
|
+
"version": "0.0.2",
|
|
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
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"nodemonConfig": {
|
|
9
|
+
"ignore": [
|
|
10
|
+
"**/*.test.ts",
|
|
11
|
+
"**/*.spec.ts",
|
|
12
|
+
".git",
|
|
13
|
+
"node_modules"
|
|
14
|
+
],
|
|
15
|
+
"watch": [
|
|
16
|
+
"config",
|
|
17
|
+
"constants",
|
|
18
|
+
"src",
|
|
19
|
+
"lib",
|
|
20
|
+
"db",
|
|
21
|
+
"shared"
|
|
22
|
+
],
|
|
23
|
+
"exec": "node -r tsconfig-paths/register -r ts-node/register ",
|
|
24
|
+
"ext": "ts, js"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"test": "jest",
|
|
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",
|
|
30
|
+
"preversion": "echo test",
|
|
31
|
+
"version": "echo git add .",
|
|
32
|
+
"postversion": "git push --no-verify && git push --tags --no-verify && echo \"\n======Version Pushed Successfully=====\n\" ",
|
|
33
|
+
"echo-version": "echo $npm_package_version",
|
|
34
|
+
"build": "tsc --declaration --project tsconfig.json && tscpaths -p tsconfig.json -s ./ -o ./dist && rm -r ./dist/tests"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/ADAAS-org/adaas-adf-auth.git"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"sdk",
|
|
42
|
+
"ai",
|
|
43
|
+
"rag"
|
|
44
|
+
],
|
|
45
|
+
"author": "adaas.org",
|
|
46
|
+
"license": "ISC",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/ADAAS-org/adaas-adf-auth/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/ADAAS-org/adaas-adf-auth#readme",
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@types/node": "^20.10.0",
|
|
53
|
+
"axios": "^1.6.2"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/chai": "^4.3.14",
|
|
57
|
+
"@types/jest": "^29.5.12",
|
|
58
|
+
"@types/mocha": "^10.0.6",
|
|
59
|
+
"chai": "^5.1.0",
|
|
60
|
+
"dotenv": "^16.4.5",
|
|
61
|
+
"jest": "^29.7.0",
|
|
62
|
+
"mocha": "^10.4.0",
|
|
63
|
+
"nodemon": "^3.1.4",
|
|
64
|
+
"ts-jest": "^29.1.2",
|
|
65
|
+
"ts-node": "^10.9.2",
|
|
66
|
+
"tsconfig-paths": "^4.2.0",
|
|
67
|
+
"tscpaths": "^0.0.9"
|
|
68
|
+
},
|
|
69
|
+
"directories": {
|
|
70
|
+
"doc": "docs",
|
|
71
|
+
"test": "tests"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
}
|