@mcma/core 0.13.23 → 0.13.28

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.
@@ -46,11 +46,11 @@ class LogEvent {
46
46
  try {
47
47
  return JSON.stringify(logEventEntry, null, 2);
48
48
  }
49
- catch (_a) {
49
+ catch {
50
50
  try {
51
51
  logEventEntry.message = util.inspect(logEventEntry.message);
52
52
  }
53
- catch (_b) {
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?: McmaTrackerProperties;
12
- notificationEndpoint?: NotificationEndpointProperties;
11
+ tracker?: McmaTracker;
12
+ notificationEndpoint?: NotificationEndpoint;
13
13
  constructor(properties: JobAssignmentProperties);
14
14
  }
@@ -1,13 +1,13 @@
1
1
  import { JobBase, JobBaseProperties } from "../job-base";
2
2
  import { JobParameterBag } from "../job-parameter-bag";
3
- import { McmaTrackerProperties } from "../mcma-tracker";
4
- import { NotificationEndpointProperties } from "../notification-endpoint";
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
8
  jobInput?: JobParameterBag;
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?: McmaTrackerProperties;
21
- notificationEndpoint?: NotificationEndpointProperties;
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", "url", false);
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: ResourceEndpointProperties[];
13
+ resources: ResourceEndpoint[];
14
14
  authType?: string;
15
15
  authContext?: any;
16
16
  jobType?: string;
@@ -16,7 +16,7 @@ class Service extends mcma_resource_1.McmaResource {
16
16
  try {
17
17
  this.authContext = JSON.parse(properties.authContext);
18
18
  }
19
- catch (_a) {
19
+ catch {
20
20
  this.authContext = properties.authContext;
21
21
  }
22
22
  }
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
- return validUrl.test(url);
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.23",
3
+ "version": "0.13.28",
4
4
  "description": "Node module with type definitions and helper utils for the EBU MCMA framework",
5
5
  "engines": {
6
- "node": "^12.19.0"
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": "^13.13.26",
35
+ "@types/node": "^14.17.22",
36
36
  "@types/uuid": "^7.0.4",
37
37
  "jasmine": "^3.4.0"
38
38
  }