@mcma/core 0.13.24 → 0.13.29
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 +2 -2
- package/dist/lib/model/job-assignment.d.ts +4 -4
- 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 +7 -7
- package/dist/lib/model/jobs/job.js +2 -2
- package/dist/lib/model/service.d.ts +2 -2
- package/dist/lib/model/service.js +1 -1
- package/dist/lib/utils.js +7 -8
- package/package.json +3 -3
|
@@ -46,11 +46,11 @@ class LogEvent {
|
|
|
46
46
|
try {
|
|
47
47
|
return JSON.stringify(logEventEntry, null, 2);
|
|
48
48
|
}
|
|
49
|
-
catch
|
|
49
|
+
catch {
|
|
50
50
|
try {
|
|
51
51
|
logEventEntry.message = util.inspect(logEventEntry.message);
|
|
52
52
|
}
|
|
53
|
-
catch
|
|
53
|
+
catch {
|
|
54
54
|
logEventEntry.message = logEventEntry.message + "";
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JobBase, JobBaseProperties } from "./job-base";
|
|
2
|
-
import { McmaTrackerProperties } from "./mcma-tracker";
|
|
3
|
-
import { NotificationEndpointProperties } from "./notification-endpoint";
|
|
2
|
+
import { McmaTracker, McmaTrackerProperties } from "./mcma-tracker";
|
|
3
|
+
import { NotificationEndpoint, NotificationEndpointProperties } from "./notification-endpoint";
|
|
4
4
|
export interface JobAssignmentProperties extends JobBaseProperties {
|
|
5
5
|
jobId: string;
|
|
6
6
|
tracker?: McmaTrackerProperties;
|
|
@@ -8,7 +8,7 @@ export interface JobAssignmentProperties extends JobBaseProperties {
|
|
|
8
8
|
}
|
|
9
9
|
export declare class JobAssignment extends JobBase<JobAssignmentProperties> implements JobAssignmentProperties {
|
|
10
10
|
jobId: string;
|
|
11
|
-
tracker?:
|
|
12
|
-
notificationEndpoint?:
|
|
11
|
+
tracker?: McmaTracker;
|
|
12
|
+
notificationEndpoint?: NotificationEndpoint;
|
|
13
13
|
constructor(properties: JobAssignmentProperties);
|
|
14
14
|
}
|
|
@@ -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,13 +1,13 @@
|
|
|
1
1
|
import { JobBase, JobBaseProperties } from "../job-base";
|
|
2
|
-
import { JobParameterBag } from "../job-parameter-bag";
|
|
3
|
-
import { McmaTrackerProperties } from "../mcma-tracker";
|
|
4
|
-
import { NotificationEndpointProperties } from "../notification-endpoint";
|
|
2
|
+
import { JobParameterBag, JobParameterBagProperties } from "../job-parameter-bag";
|
|
3
|
+
import { McmaTracker, McmaTrackerProperties } from "../mcma-tracker";
|
|
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
|
-
deadline?: Date;
|
|
10
|
+
deadline?: Date | string;
|
|
11
11
|
tracker?: McmaTrackerProperties;
|
|
12
12
|
notificationEndpoint?: NotificationEndpointProperties;
|
|
13
13
|
}
|
|
@@ -17,7 +17,7 @@ export declare class Job extends JobBase<JobProperties> implements JobProperties
|
|
|
17
17
|
jobInput?: JobParameterBag;
|
|
18
18
|
timeout?: number;
|
|
19
19
|
deadline?: Date;
|
|
20
|
-
tracker?:
|
|
21
|
-
notificationEndpoint?:
|
|
20
|
+
tracker?: McmaTracker;
|
|
21
|
+
notificationEndpoint?: NotificationEndpoint;
|
|
22
22
|
constructor(type: string, properties: JobProperties);
|
|
23
23
|
}
|
|
@@ -8,14 +8,14 @@ const notification_endpoint_1 = require("../notification-endpoint");
|
|
|
8
8
|
class Job extends job_base_1.JobBase {
|
|
9
9
|
constructor(type, properties) {
|
|
10
10
|
super(type, properties);
|
|
11
|
-
this.checkProperty("parentId", "
|
|
11
|
+
this.checkProperty("parentId", "string", false);
|
|
12
12
|
this.checkProperty("jobProfileId", "url", true);
|
|
13
13
|
this.checkProperty("jobInput", "object", false);
|
|
14
14
|
this.checkProperty("timeout", "number", false);
|
|
15
|
-
this.checkProperty("deadline", "object", false);
|
|
16
15
|
this.checkProperty("tracker", "object", false);
|
|
17
16
|
this.checkProperty("notificationEndpoint", "object", false);
|
|
18
17
|
this.jobInput = new job_parameter_bag_1.JobParameterBag(properties.jobInput);
|
|
18
|
+
this.deadline = this.ensureValidDateOrUndefined(this.deadline);
|
|
19
19
|
if (typeof this.notificationEndpoint === "object") {
|
|
20
20
|
this.notificationEndpoint = new notification_endpoint_1.NotificationEndpoint(this.notificationEndpoint);
|
|
21
21
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { McmaResource, McmaResourceProperties } from "./mcma-resource";
|
|
2
|
-
import { ResourceEndpointProperties } from "./resource-endpoint";
|
|
2
|
+
import { ResourceEndpoint, ResourceEndpointProperties } from "./resource-endpoint";
|
|
3
3
|
export interface ServiceProperties extends McmaResourceProperties {
|
|
4
4
|
name: string;
|
|
5
5
|
resources: ResourceEndpointProperties[];
|
|
@@ -10,7 +10,7 @@ export interface ServiceProperties extends McmaResourceProperties {
|
|
|
10
10
|
}
|
|
11
11
|
export declare class Service extends McmaResource implements ServiceProperties {
|
|
12
12
|
name: string;
|
|
13
|
-
resources:
|
|
13
|
+
resources: ResourceEndpoint[];
|
|
14
14
|
authType?: string;
|
|
15
15
|
authContext?: any;
|
|
16
16
|
jobType?: string;
|
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") {
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcma/core",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.29",
|
|
4
4
|
"description": "Node module with type definitions and helper utils for the EBU MCMA framework",
|
|
5
5
|
"engines": {
|
|
6
|
-
"node": "^
|
|
6
|
+
"node": "^14.17.0"
|
|
7
7
|
},
|
|
8
8
|
"type": "commonjs",
|
|
9
9
|
"main": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"uuid": "^7.0.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@types/node": "^
|
|
35
|
+
"@types/node": "^14.17.22",
|
|
36
36
|
"@types/uuid": "^7.0.4",
|
|
37
37
|
"jasmine": "^3.4.0"
|
|
38
38
|
}
|