@coast/core-types 0.0.15 → 0.0.16
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/common/EntityType.d.ts +13 -0
- package/dist/common/EntityType.js +18 -0
- package/dist/common/EntityType.js.map +1 -0
- package/dist/common/EntityTypeLabels.d.ts +2 -0
- package/dist/common/EntityTypeLabels.js +18 -0
- package/dist/common/EntityTypeLabels.js.map +1 -0
- package/dist/error/GeneralErrorCode.d.ts +1 -0
- package/dist/error/GeneralErrorCode.js +1 -0
- package/dist/error/GeneralErrorCode.js.map +1 -1
- package/dist/exception/AssertionFailedException.d.ts +4 -0
- package/dist/exception/AssertionFailedException.js +17 -0
- package/dist/exception/AssertionFailedException.js.map +1 -0
- package/dist/exception/CoastException.d.ts +20 -0
- package/dist/exception/CoastException.js +37 -0
- package/dist/exception/CoastException.js.map +1 -0
- package/dist/exception/ForbiddenException.d.ts +4 -0
- package/dist/exception/ForbiddenException.js +17 -0
- package/dist/exception/ForbiddenException.js.map +1 -0
- package/dist/exception/InvalidComponentTypeException.d.ts +13 -0
- package/dist/exception/InvalidComponentTypeException.js +23 -0
- package/dist/exception/InvalidComponentTypeException.js.map +1 -0
- package/dist/exception/InvalidEntityReferenceException.d.ts +15 -0
- package/dist/exception/InvalidEntityReferenceException.js +23 -0
- package/dist/exception/InvalidEntityReferenceException.js.map +1 -0
- package/dist/exception/MultiException.d.ts +21 -0
- package/dist/exception/MultiException.js +34 -0
- package/dist/exception/MultiException.js.map +1 -0
- package/dist/exception/NotDefinedException.d.ts +4 -0
- package/dist/exception/NotDefinedException.js +17 -0
- package/dist/exception/NotDefinedException.js.map +1 -0
- package/dist/exception/NotFoundException.d.ts +11 -0
- package/dist/exception/NotFoundException.js +22 -0
- package/dist/exception/NotFoundException.js.map +1 -0
- package/dist/exception/UnauthorizedException.d.ts +4 -0
- package/dist/exception/UnauthorizedException.js +17 -0
- package/dist/exception/UnauthorizedException.js.map +1 -0
- package/dist/exception/test/CoastExceptionTest.d.ts +1 -0
- package/dist/exception/test/CoastExceptionTest.js +32 -0
- package/dist/exception/test/CoastExceptionTest.js.map +1 -0
- package/package.json +5 -1
- package/src/common/EntityType.ts +13 -0
- package/src/common/EntityTypeLabels.ts +15 -0
- package/src/error/GeneralErrorCode.ts +1 -0
- package/src/exception/AssertionFailedException.ts +13 -0
- package/src/exception/CoastException.ts +72 -0
- package/src/exception/ForbiddenException.ts +13 -0
- package/src/exception/InvalidComponentTypeException.ts +35 -0
- package/src/exception/InvalidEntityReferenceException.ts +31 -0
- package/src/exception/MultiException.ts +50 -0
- package/src/exception/NotDefinedException.ts +13 -0
- package/src/exception/NotFoundException.ts +26 -0
- package/src/exception/UnauthorizedException.ts +13 -0
- package/src/exception/test/CoastExceptionTest.ts +33 -0
- package/tsconfig.json +2 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum EntityType {
|
|
2
|
+
AUTOMATION = "AUTOMATION",
|
|
3
|
+
AUTOMATION_ACTION = "AUTOMATION_ACTION",
|
|
4
|
+
CARD = "CARD",
|
|
5
|
+
CARD_DEFINITION = "CARD_DEFINITION",
|
|
6
|
+
CHANNEL = "CHANNEL",
|
|
7
|
+
COMPONENT = "COMPONENT",
|
|
8
|
+
USER = "USER",
|
|
9
|
+
VIEW_TEMPLATE = "VIEW_TEMPLATE",
|
|
10
|
+
WORKFLOW_ENTITY = "WORKFLOW_ENTITY",
|
|
11
|
+
WORKFLOW_TEMPLATE = "WORKFLOW_TEMPLATE",
|
|
12
|
+
WORKFLOW_TEMPLATE_AUTOMATION_ASSOCIATION = "WORKFLOW_TEMPLATE_AUTOMATION_ASSOCIATION"
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntityType = void 0;
|
|
4
|
+
var EntityType;
|
|
5
|
+
(function (EntityType) {
|
|
6
|
+
EntityType["AUTOMATION"] = "AUTOMATION";
|
|
7
|
+
EntityType["AUTOMATION_ACTION"] = "AUTOMATION_ACTION";
|
|
8
|
+
EntityType["CARD"] = "CARD";
|
|
9
|
+
EntityType["CARD_DEFINITION"] = "CARD_DEFINITION";
|
|
10
|
+
EntityType["CHANNEL"] = "CHANNEL";
|
|
11
|
+
EntityType["COMPONENT"] = "COMPONENT";
|
|
12
|
+
EntityType["USER"] = "USER";
|
|
13
|
+
EntityType["VIEW_TEMPLATE"] = "VIEW_TEMPLATE";
|
|
14
|
+
EntityType["WORKFLOW_ENTITY"] = "WORKFLOW_ENTITY";
|
|
15
|
+
EntityType["WORKFLOW_TEMPLATE"] = "WORKFLOW_TEMPLATE";
|
|
16
|
+
EntityType["WORKFLOW_TEMPLATE_AUTOMATION_ASSOCIATION"] = "WORKFLOW_TEMPLATE_AUTOMATION_ASSOCIATION";
|
|
17
|
+
})(EntityType || (exports.EntityType = EntityType = {}));
|
|
18
|
+
//# sourceMappingURL=EntityType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityType.js","sourceRoot":"","sources":["../../src/common/EntityType.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAYX;AAZD,WAAY,UAAU;IAClB,uCAAyB,CAAA;IACzB,qDAAuC,CAAA;IACvC,2BAAa,CAAA;IACb,iDAAmC,CAAA;IACnC,iCAAmB,CAAA;IACnB,qCAAuB,CAAA;IACvB,2BAAa,CAAA;IACb,6CAA+B,CAAA;IAC/B,iDAAmC,CAAA;IACnC,qDAAuC,CAAA;IACvC,mGAAqF,CAAA;AACzF,CAAC,EAZW,UAAU,0BAAV,UAAU,QAYrB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntityTypeLabels = void 0;
|
|
4
|
+
const EntityType_1 = require("./EntityType");
|
|
5
|
+
exports.EntityTypeLabels = {
|
|
6
|
+
[EntityType_1.EntityType.AUTOMATION]: 'Automation',
|
|
7
|
+
[EntityType_1.EntityType.AUTOMATION_ACTION]: 'Automation Action',
|
|
8
|
+
[EntityType_1.EntityType.CARD]: 'Card',
|
|
9
|
+
[EntityType_1.EntityType.CARD_DEFINITION]: 'Card Definition',
|
|
10
|
+
[EntityType_1.EntityType.COMPONENT]: 'Component',
|
|
11
|
+
[EntityType_1.EntityType.CHANNEL]: 'Channel',
|
|
12
|
+
[EntityType_1.EntityType.VIEW_TEMPLATE]: 'View Template',
|
|
13
|
+
[EntityType_1.EntityType.WORKFLOW_ENTITY]: 'Workflow Entity',
|
|
14
|
+
[EntityType_1.EntityType.WORKFLOW_TEMPLATE]: 'Workflow Template',
|
|
15
|
+
[EntityType_1.EntityType.WORKFLOW_TEMPLATE_AUTOMATION_ASSOCIATION]: 'Workflow Template Automation Association',
|
|
16
|
+
[EntityType_1.EntityType.USER]: 'User',
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=EntityTypeLabels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityTypeLabels.js","sourceRoot":"","sources":["../../src/common/EntityTypeLabels.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAE7B,QAAA,gBAAgB,GAA+B;IACxD,CAAC,uBAAU,CAAC,UAAU,CAAC,EAAE,YAAY;IACrC,CAAC,uBAAU,CAAC,iBAAiB,CAAC,EAAE,mBAAmB;IACnD,CAAC,uBAAU,CAAC,IAAI,CAAC,EAAE,MAAM;IACzB,CAAC,uBAAU,CAAC,eAAe,CAAC,EAAE,iBAAiB;IAC/C,CAAC,uBAAU,CAAC,SAAS,CAAC,EAAE,WAAW;IACnC,CAAC,uBAAU,CAAC,OAAO,CAAC,EAAE,SAAS;IAC/B,CAAC,uBAAU,CAAC,aAAa,CAAC,EAAE,eAAe;IAC3C,CAAC,uBAAU,CAAC,eAAe,CAAC,EAAE,iBAAiB;IAC/C,CAAC,uBAAU,CAAC,iBAAiB,CAAC,EAAE,mBAAmB;IACnD,CAAC,uBAAU,CAAC,wCAAwC,CAAC,EAAE,0CAA0C;IACjG,CAAC,uBAAU,CAAC,IAAI,CAAC,EAAE,MAAM;CACnB,CAAC"}
|
|
@@ -4,6 +4,7 @@ exports.GeneralErrorCode = void 0;
|
|
|
4
4
|
var GeneralErrorCode;
|
|
5
5
|
(function (GeneralErrorCode) {
|
|
6
6
|
GeneralErrorCode["ARRAY_MAX_SIZE_EXCEEDED"] = "ARRAY_MAX_SIZE_EXCEEDED";
|
|
7
|
+
GeneralErrorCode["ASSERTION_FAILED"] = "ASSERTION_FAILED";
|
|
7
8
|
GeneralErrorCode["BATCH_LIMIT_EXCEEDED"] = "BATCH_LIMIT_EXCEEDED";
|
|
8
9
|
GeneralErrorCode["FORBIDDEN"] = "FORBIDDEN";
|
|
9
10
|
GeneralErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeneralErrorCode.js","sourceRoot":"","sources":["../../src/error/GeneralErrorCode.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"GeneralErrorCode.js","sourceRoot":"","sources":["../../src/error/GeneralErrorCode.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAcX;AAdD,WAAY,gBAAgB;IACxB,uEAAmD,CAAA;IACnD,yDAAqC,CAAA;IACrC,iEAA6C,CAAA;IAC7C,2CAAuB,CAAA;IACvB,qDAAiC,CAAA;IACjC,yEAAqD,CAAA;IACrD,6CAAyB,CAAA;IACzB,+CAA2B,CAAA;IAC3B,+CAA2B,CAAA;IAC3B,2CAAuB,CAAA;IACvB,2DAAuC,CAAA;IACvC,iDAA6B,CAAA;IAC7B,6CAAyB,CAAA;AAC7B,CAAC,EAdW,gBAAgB,gCAAhB,gBAAgB,QAc3B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AssertionFailedException = void 0;
|
|
4
|
+
const GeneralErrorCode_1 = require("../error/GeneralErrorCode");
|
|
5
|
+
const HttpStatus_1 = require("../utils/HttpStatus");
|
|
6
|
+
const CoastException_1 = require("./CoastException");
|
|
7
|
+
class AssertionFailedException extends CoastException_1.CoastException {
|
|
8
|
+
constructor(message = 'Assertion failed') {
|
|
9
|
+
super({
|
|
10
|
+
message,
|
|
11
|
+
code: GeneralErrorCode_1.GeneralErrorCode.ASSERTION_FAILED,
|
|
12
|
+
status: HttpStatus_1.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.AssertionFailedException = AssertionFailedException;
|
|
17
|
+
//# sourceMappingURL=AssertionFailedException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssertionFailedException.js","sourceRoot":"","sources":["../../src/exception/AssertionFailedException.ts"],"names":[],"mappings":";;;AAAA,gEAA6D;AAC7D,oDAAiD;AACjD,qDAAkD;AAElD,MAAa,wBAAyB,SAAQ,+BAAc;IACxD,YAAY,OAAO,GAAG,kBAAkB;QACpC,KAAK,CAAC;YACF,OAAO;YACP,IAAI,EAAE,mCAAgB,CAAC,gBAAgB;YACvC,MAAM,EAAE,uBAAU,CAAC,qBAAqB;SAC3C,CAAC,CAAC;IACP,CAAC;CACJ;AARD,4DAQC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LogLevel } from '@coast/service-common/logger/LogLevel';
|
|
2
|
+
import { LogMessage } from '@coast/service-common/logger/LogMessage';
|
|
3
|
+
import { Trace } from '@coast/service-common/trace/Trace';
|
|
4
|
+
import { MakeRequired } from '@coast/service-common/types/MakeRequired';
|
|
5
|
+
import { JsonObject } from '@paradoxical-io/types';
|
|
6
|
+
import { ApiError } from '../error/ApiError';
|
|
7
|
+
import { ErrorCode } from '../error/ErrorCode';
|
|
8
|
+
import { HttpStatus } from '../utils/HttpStatus';
|
|
9
|
+
export type CoastExceptionOptions = MakeRequired<Partial<ApiError>, 'code' | 'message'> & {
|
|
10
|
+
logLevel?: LogLevel;
|
|
11
|
+
};
|
|
12
|
+
export declare class CoastException extends Error implements ApiError {
|
|
13
|
+
readonly code: ErrorCode;
|
|
14
|
+
readonly status: HttpStatus;
|
|
15
|
+
readonly logLevel: LogLevel;
|
|
16
|
+
additionalData?: JsonObject;
|
|
17
|
+
constructor(input: CoastExceptionOptions | string);
|
|
18
|
+
toLogMessage(): Exclude<LogMessage, string>;
|
|
19
|
+
toApiError(trace?: Trace): ApiError;
|
|
20
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoastException = void 0;
|
|
4
|
+
const LogLevel_1 = require("@coast/service-common/logger/LogLevel");
|
|
5
|
+
const GeneralErrorCode_1 = require("../error/GeneralErrorCode");
|
|
6
|
+
const HttpStatus_1 = require("../utils/HttpStatus");
|
|
7
|
+
class CoastException extends Error {
|
|
8
|
+
constructor(input) {
|
|
9
|
+
const options = typeof input === 'string' ? { message: input, code: GeneralErrorCode_1.GeneralErrorCode.INTERNAL_ERROR } : input;
|
|
10
|
+
const { message, code = GeneralErrorCode_1.GeneralErrorCode.INTERNAL_ERROR, status = HttpStatus_1.HttpStatus.INTERNAL_SERVER_ERROR, logLevel = LogLevel_1.LogLevel.ERROR, additionalData, } = options;
|
|
11
|
+
super(message);
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.status = status;
|
|
14
|
+
this.logLevel = logLevel;
|
|
15
|
+
this.additionalData = additionalData;
|
|
16
|
+
}
|
|
17
|
+
toLogMessage() {
|
|
18
|
+
return {
|
|
19
|
+
code: this.code,
|
|
20
|
+
status: this.status,
|
|
21
|
+
msg: this.message,
|
|
22
|
+
name: this.name,
|
|
23
|
+
stack: this.stack,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
toApiError(trace) {
|
|
27
|
+
return {
|
|
28
|
+
code: this.code,
|
|
29
|
+
status: this.status,
|
|
30
|
+
message: this.message,
|
|
31
|
+
additionalData: this.additionalData,
|
|
32
|
+
trace,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.CoastException = CoastException;
|
|
37
|
+
//# sourceMappingURL=CoastException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoastException.js","sourceRoot":"","sources":["../../src/exception/CoastException.ts"],"names":[],"mappings":";;;AACA,oEAAiE;AAQjE,gEAA6D;AAC7D,oDAAiD;AAUjD,MAAa,cAAe,SAAQ,KAAK;IAMrC,YAAY,KAAqC;QAC7C,MAAM,OAAO,GACT,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,mCAAgB,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAElG,MAAM,EACF,OAAO,EACP,IAAI,GAAG,mCAAgB,CAAC,cAAc,EACtC,MAAM,GAAG,uBAAU,CAAC,qBAAqB,EACzC,QAAQ,GAAG,mBAAQ,CAAC,KAAK,EACzB,cAAc,GACjB,GAAG,OAAO,CAAC;QAEZ,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACzC,CAAC;IAKD,YAAY;QACR,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,GAAG,EAAE,IAAI,CAAC,OAAO;YACjB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;SACpB,CAAC;IACN,CAAC;IAMD,UAAU,CAAC,KAAa;QACpB,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,KAAK;SACR,CAAC;IACN,CAAC;CACJ;AAnDD,wCAmDC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ForbiddenException = void 0;
|
|
4
|
+
const GeneralErrorCode_1 = require("../error/GeneralErrorCode");
|
|
5
|
+
const HttpStatus_1 = require("../utils/HttpStatus");
|
|
6
|
+
const CoastException_1 = require("./CoastException");
|
|
7
|
+
class ForbiddenException extends CoastException_1.CoastException {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super({
|
|
10
|
+
message,
|
|
11
|
+
code: GeneralErrorCode_1.GeneralErrorCode.FORBIDDEN,
|
|
12
|
+
status: HttpStatus_1.HttpStatus.FORBIDDEN,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ForbiddenException = ForbiddenException;
|
|
17
|
+
//# sourceMappingURL=ForbiddenException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ForbiddenException.js","sourceRoot":"","sources":["../../src/exception/ForbiddenException.ts"],"names":[],"mappings":";;;AAAA,gEAA6D;AAC7D,oDAAiD;AACjD,qDAAkD;AAElD,MAAa,kBAAmB,SAAQ,+BAAc;IAClD,YAAY,OAAe;QACvB,KAAK,CAAC;YACF,OAAO;YACP,IAAI,EAAE,mCAAgB,CAAC,SAAS;YAChC,MAAM,EAAE,uBAAU,CAAC,SAAS;SAC/B,CAAC,CAAC;IACP,CAAC;CACJ;AARD,gDAQC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { JsonObject } from '@paradoxical-io/types';
|
|
2
|
+
import { ComponentType } from '../workflow-template/components/ComponentType';
|
|
3
|
+
import { CoastException } from './CoastException';
|
|
4
|
+
type Options = {
|
|
5
|
+
message?: string;
|
|
6
|
+
expectedType: ComponentType;
|
|
7
|
+
actualType: ComponentType;
|
|
8
|
+
additionalData?: JsonObject;
|
|
9
|
+
};
|
|
10
|
+
export declare class InvalidComponentTypeException extends CoastException {
|
|
11
|
+
constructor(options: Options);
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidComponentTypeException = void 0;
|
|
4
|
+
const HttpStatus_1 = require("../utils/HttpStatus");
|
|
5
|
+
const ComponentErrorCode_1 = require("../workflow-template/components/error/ComponentErrorCode");
|
|
6
|
+
const CoastException_1 = require("./CoastException");
|
|
7
|
+
class InvalidComponentTypeException extends CoastException_1.CoastException {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
const { message = `Invalid component type: expected ${options.expectedType} but received ${options.actualType}.`, expectedType, actualType, additionalData, } = options;
|
|
10
|
+
super({
|
|
11
|
+
code: ComponentErrorCode_1.ComponentErrorCode.INVALID_COMPONENT_TYPE,
|
|
12
|
+
status: HttpStatus_1.HttpStatus.BAD_REQUEST,
|
|
13
|
+
message,
|
|
14
|
+
additionalData: {
|
|
15
|
+
expectedType,
|
|
16
|
+
actualType,
|
|
17
|
+
...additionalData,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.InvalidComponentTypeException = InvalidComponentTypeException;
|
|
23
|
+
//# sourceMappingURL=InvalidComponentTypeException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidComponentTypeException.js","sourceRoot":"","sources":["../../src/exception/InvalidComponentTypeException.ts"],"names":[],"mappings":";;;AAEA,oDAAiD;AAEjD,iGAA8F;AAC9F,qDAAkD;AASlD,MAAa,6BAA8B,SAAQ,+BAAc;IAC7D,YAAY,OAAgB;QACxB,MAAM,EACF,OAAO,GAAG,oCAAoC,OAAO,CAAC,YAAY,iBAAiB,OAAO,CAAC,UAAU,GAAG,EACxG,YAAY,EACZ,UAAU,EACV,cAAc,GACjB,GAAG,OAAO,CAAC;QAEZ,KAAK,CAAC;YACF,IAAI,EAAE,uCAAkB,CAAC,sBAAsB;YAC/C,MAAM,EAAE,uBAAU,CAAC,WAAW;YAC9B,OAAO;YACP,cAAc,EAAE;gBACZ,YAAY;gBACZ,UAAU;gBACV,GAAG,cAAc;aACpB;SACJ,CAAC,CAAC;IACP,CAAC;CACJ;AApBD,sEAoBC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { JsonObject } from '@paradoxical-io/types';
|
|
2
|
+
import { EntityType } from '../common/EntityType';
|
|
3
|
+
import { HttpStatus } from '../utils/HttpStatus';
|
|
4
|
+
import { CoastException } from './CoastException';
|
|
5
|
+
type Options = {
|
|
6
|
+
message?: string;
|
|
7
|
+
entityType: EntityType;
|
|
8
|
+
id?: string;
|
|
9
|
+
additionalData?: JsonObject;
|
|
10
|
+
status?: HttpStatus;
|
|
11
|
+
};
|
|
12
|
+
export declare class InvalidEntityReferenceException extends CoastException {
|
|
13
|
+
constructor({ entityType, id, message, additionalData, status }: Options);
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidEntityReferenceException = void 0;
|
|
4
|
+
const LogLevel_1 = require("@coast/service-common/logger/LogLevel");
|
|
5
|
+
const EntityTypeLabels_1 = require("../common/EntityTypeLabels");
|
|
6
|
+
const GeneralErrorCode_1 = require("../error/GeneralErrorCode");
|
|
7
|
+
const HttpStatus_1 = require("../utils/HttpStatus");
|
|
8
|
+
const CoastException_1 = require("./CoastException");
|
|
9
|
+
class InvalidEntityReferenceException extends CoastException_1.CoastException {
|
|
10
|
+
constructor({ entityType, id, message, additionalData, status = HttpStatus_1.HttpStatus.BAD_REQUEST }) {
|
|
11
|
+
const label = EntityTypeLabels_1.EntityTypeLabels[entityType];
|
|
12
|
+
const errorMessage = message ?? `Invalid entity reference: ${label} not found`;
|
|
13
|
+
super({
|
|
14
|
+
code: GeneralErrorCode_1.GeneralErrorCode.INVALID_ENTITY_REFERENCE,
|
|
15
|
+
status,
|
|
16
|
+
logLevel: LogLevel_1.LogLevel.WARN,
|
|
17
|
+
message: errorMessage,
|
|
18
|
+
additionalData: { ...additionalData, entityType, id },
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.InvalidEntityReferenceException = InvalidEntityReferenceException;
|
|
23
|
+
//# sourceMappingURL=InvalidEntityReferenceException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidEntityReferenceException.js","sourceRoot":"","sources":["../../src/exception/InvalidEntityReferenceException.ts"],"names":[],"mappings":";;;AAAA,oEAAiE;AAIjE,iEAA8D;AAC9D,gEAA6D;AAC7D,oDAAiD;AACjD,qDAAkD;AAUlD,MAAa,+BAAgC,SAAQ,+BAAc;IAC/D,YAAY,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,uBAAU,CAAC,WAAW,EAAW;QAC7F,MAAM,KAAK,GAAG,mCAAgB,CAAC,UAAU,CAAC,CAAC;QAC3C,MAAM,YAAY,GAAG,OAAO,IAAI,6BAA6B,KAAK,YAAY,CAAC;QAE/E,KAAK,CAAC;YACF,IAAI,EAAE,mCAAgB,CAAC,wBAAwB;YAC/C,MAAM;YACN,QAAQ,EAAE,mBAAQ,CAAC,IAAI;YACvB,OAAO,EAAE,YAAY;YACrB,cAAc,EAAE,EAAE,GAAG,cAAc,EAAE,UAAU,EAAE,EAAE,EAAE;SACxD,CAAC,CAAC;IACP,CAAC;CACJ;AAbD,0EAaC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LogLevel } from '@coast/service-common/logger/LogLevel';
|
|
2
|
+
import { LogMessage } from '@coast/service-common/logger/LogMessage';
|
|
3
|
+
import { JsonObject } from '@paradoxical-io/types';
|
|
4
|
+
import { ApiError } from '../error/ApiError';
|
|
5
|
+
import { ErrorCode } from '../error/ErrorCode';
|
|
6
|
+
import { HttpStatus } from '../utils/HttpStatus';
|
|
7
|
+
import { CoastException } from './CoastException';
|
|
8
|
+
export type MultiExceptionOptions<T extends CoastException = CoastException> = {
|
|
9
|
+
status?: HttpStatus;
|
|
10
|
+
exceptions: T[];
|
|
11
|
+
code?: ErrorCode;
|
|
12
|
+
message?: string;
|
|
13
|
+
additionalData?: JsonObject;
|
|
14
|
+
logLevel?: LogLevel;
|
|
15
|
+
};
|
|
16
|
+
export declare class MultiException<T extends CoastException = CoastException> extends CoastException {
|
|
17
|
+
readonly exceptions: T[];
|
|
18
|
+
constructor(options: MultiExceptionOptions<T>);
|
|
19
|
+
toApiError(): ApiError;
|
|
20
|
+
toLogMessage(): Exclude<LogMessage, string>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MultiException = void 0;
|
|
4
|
+
const DeepLogObject_1 = require("@coast/service-common/logger/DeepLogObject");
|
|
5
|
+
const LogLevel_1 = require("@coast/service-common/logger/LogLevel");
|
|
6
|
+
const GeneralErrorCode_1 = require("../error/GeneralErrorCode");
|
|
7
|
+
const HttpStatus_1 = require("../utils/HttpStatus");
|
|
8
|
+
const CoastException_1 = require("./CoastException");
|
|
9
|
+
class MultiException extends CoastException_1.CoastException {
|
|
10
|
+
constructor(options) {
|
|
11
|
+
super({
|
|
12
|
+
code: GeneralErrorCode_1.GeneralErrorCode.MULTI_ERROR,
|
|
13
|
+
message: 'MultiException',
|
|
14
|
+
status: HttpStatus_1.HttpStatus.BAD_REQUEST,
|
|
15
|
+
logLevel: LogLevel_1.LogLevel.INFO,
|
|
16
|
+
...options,
|
|
17
|
+
});
|
|
18
|
+
this.exceptions = options.exceptions;
|
|
19
|
+
}
|
|
20
|
+
toApiError() {
|
|
21
|
+
return {
|
|
22
|
+
...super.toApiError(),
|
|
23
|
+
errors: this.exceptions.map((e) => e.toApiError()),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
toLogMessage() {
|
|
27
|
+
return {
|
|
28
|
+
...super.toLogMessage(),
|
|
29
|
+
exceptions: (0, DeepLogObject_1.DeepLogObject)(this.exceptions.map((e) => e.toLogMessage())),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.MultiException = MultiException;
|
|
34
|
+
//# sourceMappingURL=MultiException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultiException.js","sourceRoot":"","sources":["../../src/exception/MultiException.ts"],"names":[],"mappings":";;;AACA,8EAA2E;AAC3E,oEAAiE;AAMjE,gEAA6D;AAC7D,oDAAiD;AACjD,qDAAkD;AAWlD,MAAa,cAA0D,SAAQ,+BAAc;IAGzF,YAAY,OAAiC;QACzC,KAAK,CAAC;YACF,IAAI,EAAE,mCAAgB,CAAC,WAAW;YAClC,OAAO,EAAE,gBAAgB;YACzB,MAAM,EAAE,uBAAU,CAAC,WAAW;YAC9B,QAAQ,EAAE,mBAAQ,CAAC,IAAI;YACvB,GAAG,OAAO;SACb,CAAC,CAAC;QAEH,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACzC,CAAC;IAED,UAAU;QACN,OAAO;YACH,GAAG,KAAK,CAAC,UAAU,EAAE;YACrB,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;SACrD,CAAC;IACN,CAAC;IAED,YAAY;QACR,OAAO;YACH,GAAG,KAAK,CAAC,YAAY,EAAE;YACvB,UAAU,EAAE,IAAA,6BAAa,EAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC;SAC1E,CAAC;IACN,CAAC;CACJ;AA5BD,wCA4BC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotDefinedException = void 0;
|
|
4
|
+
const GeneralErrorCode_1 = require("../error/GeneralErrorCode");
|
|
5
|
+
const HttpStatus_1 = require("../utils/HttpStatus");
|
|
6
|
+
const CoastException_1 = require("./CoastException");
|
|
7
|
+
class NotDefinedException extends CoastException_1.CoastException {
|
|
8
|
+
constructor(message = 'Value is not defined') {
|
|
9
|
+
super({
|
|
10
|
+
message,
|
|
11
|
+
code: GeneralErrorCode_1.GeneralErrorCode.NOT_DEFINED,
|
|
12
|
+
status: HttpStatus_1.HttpStatus.BAD_REQUEST,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.NotDefinedException = NotDefinedException;
|
|
17
|
+
//# sourceMappingURL=NotDefinedException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotDefinedException.js","sourceRoot":"","sources":["../../src/exception/NotDefinedException.ts"],"names":[],"mappings":";;;AAAA,gEAA6D;AAC7D,oDAAiD;AACjD,qDAAkD;AAElD,MAAa,mBAAoB,SAAQ,+BAAc;IACnD,YAAY,OAAO,GAAG,sBAAsB;QACxC,KAAK,CAAC;YACF,OAAO;YACP,IAAI,EAAE,mCAAgB,CAAC,WAAW;YAClC,MAAM,EAAE,uBAAU,CAAC,WAAW;SACjC,CAAC,CAAC;IACP,CAAC;CACJ;AARD,kDAQC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LogLevel } from '@coast/service-common/logger/LogLevel';
|
|
2
|
+
import { CoastException, CoastExceptionOptions } from '../exception/CoastException';
|
|
3
|
+
type EntityNotFoundExceptionOptions = {
|
|
4
|
+
message?: string;
|
|
5
|
+
additionalData?: CoastExceptionOptions['additionalData'];
|
|
6
|
+
logLevel?: LogLevel;
|
|
7
|
+
};
|
|
8
|
+
export declare class NotFoundException extends CoastException {
|
|
9
|
+
constructor(input: EntityNotFoundExceptionOptions | string);
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotFoundException = void 0;
|
|
4
|
+
const LogLevel_1 = require("@coast/service-common/logger/LogLevel");
|
|
5
|
+
const GeneralErrorCode_1 = require("../error/GeneralErrorCode");
|
|
6
|
+
const CoastException_1 = require("../exception/CoastException");
|
|
7
|
+
const HttpStatus_1 = require("../utils/HttpStatus");
|
|
8
|
+
class NotFoundException extends CoastException_1.CoastException {
|
|
9
|
+
constructor(input) {
|
|
10
|
+
const options = typeof input === 'string' ? { message: input } : input;
|
|
11
|
+
const { message = 'Entity not found.', additionalData, logLevel = LogLevel_1.LogLevel.INFO } = options;
|
|
12
|
+
super({
|
|
13
|
+
message,
|
|
14
|
+
code: GeneralErrorCode_1.GeneralErrorCode.NOT_FOUND,
|
|
15
|
+
status: HttpStatus_1.HttpStatus.NOT_FOUND,
|
|
16
|
+
logLevel,
|
|
17
|
+
additionalData,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.NotFoundException = NotFoundException;
|
|
22
|
+
//# sourceMappingURL=NotFoundException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotFoundException.js","sourceRoot":"","sources":["../../src/exception/NotFoundException.ts"],"names":[],"mappings":";;;AAAA,oEAAiE;AAEjE,gEAA6D;AAC7D,gEAAoF;AACpF,oDAAiD;AAQjD,MAAa,iBAAkB,SAAQ,+BAAc;IACjD,YAAY,KAA8C;QACtD,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QACvE,MAAM,EAAE,OAAO,GAAG,mBAAmB,EAAE,cAAc,EAAE,QAAQ,GAAG,mBAAQ,CAAC,IAAI,EAAE,GAAG,OAAO,CAAC;QAE5F,KAAK,CAAC;YACF,OAAO;YACP,IAAI,EAAE,mCAAgB,CAAC,SAAS;YAChC,MAAM,EAAE,uBAAU,CAAC,SAAS;YAC5B,QAAQ;YACR,cAAc;SACjB,CAAC,CAAC;IACP,CAAC;CACJ;AAbD,8CAaC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnauthorizedException = void 0;
|
|
4
|
+
const GeneralErrorCode_1 = require("../error/GeneralErrorCode");
|
|
5
|
+
const HttpStatus_1 = require("../utils/HttpStatus");
|
|
6
|
+
const CoastException_1 = require("./CoastException");
|
|
7
|
+
class UnauthorizedException extends CoastException_1.CoastException {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super({
|
|
10
|
+
message,
|
|
11
|
+
code: GeneralErrorCode_1.GeneralErrorCode.UNAUTHORIZED,
|
|
12
|
+
status: HttpStatus_1.HttpStatus.UNAUTHORIZED,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.UnauthorizedException = UnauthorizedException;
|
|
17
|
+
//# sourceMappingURL=UnauthorizedException.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnauthorizedException.js","sourceRoot":"","sources":["../../src/exception/UnauthorizedException.ts"],"names":[],"mappings":";;;AAAA,gEAA6D;AAC7D,oDAAiD;AACjD,qDAAkD;AAElD,MAAa,qBAAsB,SAAQ,+BAAc;IACrD,YAAY,OAAe;QACvB,KAAK,CAAC;YACF,OAAO;YACP,IAAI,EAAE,mCAAgB,CAAC,YAAY;YACnC,MAAM,EAAE,uBAAU,CAAC,YAAY;SAClC,CAAC,CAAC;IACP,CAAC;CACJ;AARD,sDAQC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const LogLevel_1 = require("@coast/service-common/logger/LogLevel");
|
|
4
|
+
const GeneralErrorCode_1 = require("../../error/GeneralErrorCode");
|
|
5
|
+
const HttpStatus_1 = require("../../utils/HttpStatus");
|
|
6
|
+
const ComponentDataErrorCode_1 = require("../../workflow-entity/error/ComponentDataErrorCode");
|
|
7
|
+
const CoastException_1 = require("../CoastException");
|
|
8
|
+
describe('CoastException', () => {
|
|
9
|
+
it('should produce CoastException when passed a string', () => {
|
|
10
|
+
const exception = new CoastException_1.CoastException('test');
|
|
11
|
+
expect(exception.message).toEqual('test');
|
|
12
|
+
expect(exception.code).toEqual(GeneralErrorCode_1.GeneralErrorCode.INTERNAL_ERROR);
|
|
13
|
+
expect(exception.status).toEqual(HttpStatus_1.HttpStatus.INTERNAL_SERVER_ERROR);
|
|
14
|
+
expect(exception.additionalData).toEqual(undefined);
|
|
15
|
+
expect(exception.logLevel).toEqual(LogLevel_1.LogLevel.ERROR);
|
|
16
|
+
});
|
|
17
|
+
it('should set options when passed an object', () => {
|
|
18
|
+
const exception = new CoastException_1.CoastException({
|
|
19
|
+
message: 'custom message',
|
|
20
|
+
code: ComponentDataErrorCode_1.ComponentDataErrorCode.COMPONENT_DATA_INVALID_PERSON_USER_ID,
|
|
21
|
+
status: HttpStatus_1.HttpStatus.BAD_REQUEST,
|
|
22
|
+
additionalData: { test: 'test' },
|
|
23
|
+
logLevel: LogLevel_1.LogLevel.INFO,
|
|
24
|
+
});
|
|
25
|
+
expect(exception.message).toEqual('custom message');
|
|
26
|
+
expect(exception.code).toEqual(ComponentDataErrorCode_1.ComponentDataErrorCode.COMPONENT_DATA_INVALID_PERSON_USER_ID);
|
|
27
|
+
expect(exception.status).toEqual(HttpStatus_1.HttpStatus.BAD_REQUEST);
|
|
28
|
+
expect(exception.additionalData).toEqual({ test: 'test' });
|
|
29
|
+
expect(exception.logLevel).toEqual(LogLevel_1.LogLevel.INFO);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=CoastExceptionTest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoastExceptionTest.js","sourceRoot":"","sources":["../../../src/exception/test/CoastExceptionTest.ts"],"names":[],"mappings":";;AAAA,oEAAiE;AAEjE,mEAAgE;AAChE,uDAAoD;AACpD,+FAA4F;AAC5F,sDAAmD;AAEnD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC1D,MAAM,SAAS,GAAG,IAAI,+BAAc,CAAC,MAAM,CAAC,CAAC;QAC7C,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC1C,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,mCAAgB,CAAC,cAAc,CAAC,CAAC;QAChE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,uBAAU,CAAC,qBAAqB,CAAC,CAAC;QACnE,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACpD,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,mBAAQ,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAChD,MAAM,SAAS,GAAG,IAAI,+BAAc,CAAC;YACjC,OAAO,EAAE,gBAAgB;YACzB,IAAI,EAAE,+CAAsB,CAAC,qCAAqC;YAClE,MAAM,EAAE,uBAAU,CAAC,WAAW;YAC9B,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YAChC,QAAQ,EAAE,mBAAQ,CAAC,IAAI;SAC1B,CAAC,CAAC;QAEH,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QACpD,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,+CAAsB,CAAC,qCAAqC,CAAC,CAAC;QAC7F,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,uBAAU,CAAC,WAAW,CAAC,CAAC;QACzD,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QAC3D,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,mBAAQ,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coast/core-types",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"author": "Coast Engineering",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
"strict:compile": "yarn run -T tsc-strict",
|
|
16
16
|
"strict:update": "yarn run -T update-strict-comments"
|
|
17
17
|
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@coast/service-common": "^2.0.65",
|
|
20
|
+
"@paradoxical-io/types": "^2.1.0"
|
|
21
|
+
},
|
|
18
22
|
"devDependencies": {
|
|
19
23
|
"cross-env": "^7.0.3",
|
|
20
24
|
"jest": "^29.7.0",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export enum EntityType {
|
|
2
|
+
AUTOMATION = 'AUTOMATION',
|
|
3
|
+
AUTOMATION_ACTION = 'AUTOMATION_ACTION',
|
|
4
|
+
CARD = 'CARD',
|
|
5
|
+
CARD_DEFINITION = 'CARD_DEFINITION',
|
|
6
|
+
CHANNEL = 'CHANNEL',
|
|
7
|
+
COMPONENT = 'COMPONENT',
|
|
8
|
+
USER = 'USER',
|
|
9
|
+
VIEW_TEMPLATE = 'VIEW_TEMPLATE',
|
|
10
|
+
WORKFLOW_ENTITY = 'WORKFLOW_ENTITY',
|
|
11
|
+
WORKFLOW_TEMPLATE = 'WORKFLOW_TEMPLATE',
|
|
12
|
+
WORKFLOW_TEMPLATE_AUTOMATION_ASSOCIATION = 'WORKFLOW_TEMPLATE_AUTOMATION_ASSOCIATION',
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EntityType } from './EntityType';
|
|
2
|
+
|
|
3
|
+
export const EntityTypeLabels: Record<EntityType, string> = {
|
|
4
|
+
[EntityType.AUTOMATION]: 'Automation',
|
|
5
|
+
[EntityType.AUTOMATION_ACTION]: 'Automation Action',
|
|
6
|
+
[EntityType.CARD]: 'Card',
|
|
7
|
+
[EntityType.CARD_DEFINITION]: 'Card Definition',
|
|
8
|
+
[EntityType.COMPONENT]: 'Component',
|
|
9
|
+
[EntityType.CHANNEL]: 'Channel',
|
|
10
|
+
[EntityType.VIEW_TEMPLATE]: 'View Template',
|
|
11
|
+
[EntityType.WORKFLOW_ENTITY]: 'Workflow Entity',
|
|
12
|
+
[EntityType.WORKFLOW_TEMPLATE]: 'Workflow Template',
|
|
13
|
+
[EntityType.WORKFLOW_TEMPLATE_AUTOMATION_ASSOCIATION]: 'Workflow Template Automation Association',
|
|
14
|
+
[EntityType.USER]: 'User',
|
|
15
|
+
} as const;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GeneralErrorCode } from '../error/GeneralErrorCode';
|
|
2
|
+
import { HttpStatus } from '../utils/HttpStatus';
|
|
3
|
+
import { CoastException } from './CoastException';
|
|
4
|
+
|
|
5
|
+
export class AssertionFailedException extends CoastException {
|
|
6
|
+
constructor(message = 'Assertion failed') {
|
|
7
|
+
super({
|
|
8
|
+
message,
|
|
9
|
+
code: GeneralErrorCode.ASSERTION_FAILED,
|
|
10
|
+
status: HttpStatus.INTERNAL_SERVER_ERROR,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|