@mcma/core 0.13.27 → 0.14.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/lib/logging/log-event.js +10 -1
- package/dist/lib/mcma-exception.d.ts +4 -3
- package/dist/lib/mcma-exception.js +8 -3
- package/dist/lib/model/job-base.d.ts +2 -2
- package/dist/lib/model/job-parameter-bag.d.ts +5 -2
- package/dist/lib/model/job-profile.d.ts +4 -4
- package/dist/lib/model/job-profile.js +10 -1
- package/dist/lib/model/jobs/job.d.ts +2 -2
- package/dist/lib/model/locator.d.ts +2 -0
- package/dist/lib/model/locator.js +1 -0
- package/dist/lib/utils.js +7 -8
- package/package.json +1 -1
|
@@ -14,13 +14,22 @@ class LogEvent {
|
|
|
14
14
|
}
|
|
15
15
|
flatten() {
|
|
16
16
|
var _a, _b, _c, _d, _e;
|
|
17
|
+
let message = this.message;
|
|
18
|
+
if (message instanceof Error) {
|
|
19
|
+
if (this.message.stack) {
|
|
20
|
+
message = this.message.stack;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
message = this.message.toString();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
17
26
|
const logEventEntry = {
|
|
18
27
|
type: this.type,
|
|
19
28
|
level: this.level,
|
|
20
29
|
source: this.source,
|
|
21
30
|
requestId: this.requestId,
|
|
22
31
|
timestamp: this.timestamp,
|
|
23
|
-
message
|
|
32
|
+
message,
|
|
24
33
|
trackerId: (_a = this.tracker) === null || _a === void 0 ? void 0 : _a.id,
|
|
25
34
|
trackerLabel: (_b = this.tracker) === null || _b === void 0 ? void 0 : _b.label,
|
|
26
35
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare class McmaException extends Error {
|
|
2
2
|
message: string;
|
|
3
|
-
cause?:
|
|
3
|
+
cause?: Error;
|
|
4
4
|
context?: any;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
originalStack: string;
|
|
6
|
+
constructor(message: string, cause?: Error, context?: any);
|
|
7
|
+
toString(includeDetails?: boolean): string;
|
|
7
8
|
}
|
|
@@ -9,19 +9,24 @@ class McmaException extends Error {
|
|
|
9
9
|
this.context = context;
|
|
10
10
|
this.cause = cause;
|
|
11
11
|
this.context = context;
|
|
12
|
+
this.originalStack = this.stack;
|
|
13
|
+
this.stack = this.toString(true);
|
|
12
14
|
}
|
|
13
|
-
toString() {
|
|
15
|
+
toString(includeDetails = false) {
|
|
14
16
|
var _a;
|
|
15
17
|
let ret = "";
|
|
16
18
|
let c = this;
|
|
17
19
|
while (c) {
|
|
18
|
-
if (c.
|
|
20
|
+
if (includeDetails && c.originalStack) {
|
|
21
|
+
ret += c.originalStack;
|
|
22
|
+
}
|
|
23
|
+
else if (includeDetails && c.stack) {
|
|
19
24
|
ret += c.stack;
|
|
20
25
|
}
|
|
21
26
|
else {
|
|
22
27
|
ret += "Error: " + ((_a = c.message) !== null && _a !== void 0 ? _a : c);
|
|
23
28
|
}
|
|
24
|
-
if (c.context) {
|
|
29
|
+
if (includeDetails && c.context) {
|
|
25
30
|
ret += "\nContext:\n" + JSON.stringify(c.context, null, 2);
|
|
26
31
|
}
|
|
27
32
|
c = c.cause;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { JobParameterBag } from "./job-parameter-bag";
|
|
1
|
+
import { JobParameterBag, JobParameterBagProperties } from "./job-parameter-bag";
|
|
2
2
|
import { McmaResource, McmaResourceProperties } from "./mcma-resource";
|
|
3
3
|
import { ProblemDetail, ProblemDetailProperties } from "./problem-detail";
|
|
4
4
|
import { JobStatus } from "./job-status";
|
|
5
5
|
export interface JobBaseProperties extends McmaResourceProperties {
|
|
6
6
|
status?: JobStatus;
|
|
7
7
|
error?: ProblemDetailProperties;
|
|
8
|
-
jobOutput?:
|
|
8
|
+
jobOutput?: JobParameterBagProperties;
|
|
9
9
|
progress?: number;
|
|
10
10
|
}
|
|
11
11
|
export declare abstract class JobBase<T extends JobBaseProperties> extends McmaResource implements JobBaseProperties {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { McmaObject } from "./mcma-object";
|
|
2
|
-
export
|
|
1
|
+
import { McmaObject, McmaObjectProperties } from "./mcma-object";
|
|
2
|
+
export interface JobParameterBagProperties extends McmaObjectProperties {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
5
|
+
export declare class JobParameterBag extends McmaObject implements JobParameterBagProperties {
|
|
3
6
|
[key: string]: any;
|
|
4
7
|
constructor(properties?: {
|
|
5
8
|
[key: string]: any;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { McmaResource, McmaResourceProperties } from "./mcma-resource";
|
|
2
|
-
import { JobParameter } from "./job-parameter";
|
|
2
|
+
import { JobParameter, JobParameterProperties } from "./job-parameter";
|
|
3
3
|
export interface JobProfileProperties extends McmaResourceProperties {
|
|
4
4
|
name: string;
|
|
5
|
-
inputParameters?:
|
|
6
|
-
outputParameters?:
|
|
7
|
-
optionalInputParameters?:
|
|
5
|
+
inputParameters?: JobParameterProperties[];
|
|
6
|
+
outputParameters?: JobParameterProperties[];
|
|
7
|
+
optionalInputParameters?: JobParameterProperties[];
|
|
8
8
|
}
|
|
9
9
|
export declare class JobProfile extends McmaResource implements JobProfileProperties {
|
|
10
10
|
name: string;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.JobProfile = void 0;
|
|
4
4
|
const mcma_resource_1 = require("./mcma-resource");
|
|
5
|
+
const job_parameter_1 = require("./job-parameter");
|
|
5
6
|
class JobProfile extends mcma_resource_1.McmaResource {
|
|
6
7
|
constructor(properties) {
|
|
7
8
|
super("JobProfile", properties);
|
|
@@ -9,7 +10,15 @@ class JobProfile extends mcma_resource_1.McmaResource {
|
|
|
9
10
|
this.checkProperty("inputParameters", "Array", false);
|
|
10
11
|
this.checkProperty("outputParameters", "Array", false);
|
|
11
12
|
this.checkProperty("optionalInputParameters", "Array", false);
|
|
12
|
-
this.
|
|
13
|
+
if (Array.isArray(this.inputParameters)) {
|
|
14
|
+
this.inputParameters = this.inputParameters.map(ip => new job_parameter_1.JobParameter(ip));
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(this.optionalInputParameters)) {
|
|
17
|
+
this.optionalInputParameters = this.optionalInputParameters.map(ip => new job_parameter_1.JobParameter(ip));
|
|
18
|
+
}
|
|
19
|
+
if (Array.isArray(this.outputParameters)) {
|
|
20
|
+
this.outputParameters = this.outputParameters.map(ip => new job_parameter_1.JobParameter(ip));
|
|
21
|
+
}
|
|
13
22
|
}
|
|
14
23
|
}
|
|
15
24
|
exports.JobProfile = JobProfile;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { JobBase, JobBaseProperties } from "../job-base";
|
|
2
|
-
import { JobParameterBag } from "../job-parameter-bag";
|
|
2
|
+
import { JobParameterBag, JobParameterBagProperties } from "../job-parameter-bag";
|
|
3
3
|
import { McmaTracker, McmaTrackerProperties } from "../mcma-tracker";
|
|
4
4
|
import { NotificationEndpoint, NotificationEndpointProperties } from "../notification-endpoint";
|
|
5
5
|
export interface JobProperties extends JobBaseProperties {
|
|
6
6
|
parentId?: string;
|
|
7
7
|
jobProfileId: string;
|
|
8
|
-
jobInput?:
|
|
8
|
+
jobInput?: JobParameterBagProperties;
|
|
9
9
|
timeout?: number;
|
|
10
10
|
deadline?: Date | string;
|
|
11
11
|
tracker?: McmaTrackerProperties;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { McmaObject, McmaObjectProperties } from "./mcma-object";
|
|
2
2
|
export interface LocatorProperties extends McmaObjectProperties {
|
|
3
|
+
url: string;
|
|
3
4
|
}
|
|
4
5
|
export declare abstract class Locator extends McmaObject implements LocatorProperties {
|
|
6
|
+
url: string;
|
|
5
7
|
protected constructor(type: string, properties?: LocatorProperties);
|
|
6
8
|
}
|
package/dist/lib/utils.js
CHANGED
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Utils = void 0;
|
|
4
4
|
const mcma_exception_1 = require("./mcma-exception");
|
|
5
|
-
const validUrl = new RegExp("^(https?:\\/\\/)?" + // protocol
|
|
6
|
-
"((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|" + // domain name
|
|
7
|
-
"((\\d{1,3}\\.){3}\\d{1,3}))" + // OR ip (v4) address
|
|
8
|
-
"(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // port and path
|
|
9
|
-
"(\\?[;&a-z\\d%_.~+=-]*)?" + // query string
|
|
10
|
-
"(\\#[-a-z\\d_]*)?$", "i" // fragment locator
|
|
11
|
-
);
|
|
12
5
|
function isValidUrl(url) {
|
|
13
|
-
|
|
6
|
+
try {
|
|
7
|
+
new URL(url);
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
14
13
|
}
|
|
15
14
|
function getTypeName(type) {
|
|
16
15
|
if (typeof type === "function") {
|