@mcma/core
Advanced tools
Comparing version 0.9.7 to 0.10.0
@@ -1,1 +0,1 @@ | ||
export * from "./lib/index"; | ||
export * from "./lib"; |
@@ -6,2 +6,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./lib/index")); | ||
__export(require("./lib")); |
@@ -12,6 +12,6 @@ export declare class ContextVariableProvider { | ||
setContextVariable(key: string, value: any): void; | ||
merge(contextVariables: ContextVariableProvider): any; | ||
merge(contextVariables: ContextVariableProvider): ContextVariableProvider; | ||
merge(contextVariables: { | ||
[key: string]: any; | ||
}): any; | ||
}): ContextVariableProvider; | ||
} |
export * from "./utils"; | ||
export * from "./mcma-exception"; | ||
export * from "./model/index"; | ||
export * from "./context-variables/index"; | ||
export * from "./logging/index"; | ||
export * from "./model"; | ||
export * from "./context-variables"; | ||
export * from "./logging"; |
@@ -8,4 +8,4 @@ "use strict"; | ||
__export(require("./mcma-exception")); | ||
__export(require("./model/index")); | ||
__export(require("./context-variables/index")); | ||
__export(require("./logging/index")); | ||
__export(require("./model")); | ||
__export(require("./context-variables")); | ||
__export(require("./logging")); |
@@ -8,3 +8,3 @@ export * from "./mcma-object"; | ||
export * from "./job-parameter"; | ||
export * from "./job-process"; | ||
export * from "./job-execution"; | ||
export * from "./job-profile"; | ||
@@ -15,5 +15,6 @@ export * from "./locator"; | ||
export * from "./notification"; | ||
export * from "./problem-detail"; | ||
export * from "./resource-endpoint"; | ||
export * from "./service"; | ||
export * from "./job-status"; | ||
export * from "./jobs/index"; | ||
export * from "./jobs"; |
@@ -12,3 +12,3 @@ "use strict"; | ||
__export(require("./job-parameter")); | ||
__export(require("./job-process")); | ||
__export(require("./job-execution")); | ||
__export(require("./job-profile")); | ||
@@ -19,5 +19,6 @@ __export(require("./locator")); | ||
__export(require("./notification")); | ||
__export(require("./problem-detail")); | ||
__export(require("./resource-endpoint")); | ||
__export(require("./service")); | ||
__export(require("./job-status")); | ||
__export(require("./jobs/index")); | ||
__export(require("./jobs")); |
import { JobBase, JobBaseProperties } from "./job-base"; | ||
import { McmaTrackerProperties } from "./mcma-tracker"; | ||
import { NotificationEndpointProperties } from "./notification-endpoint"; | ||
export interface JobAssignmentProperties extends JobBaseProperties { | ||
job: string; | ||
tracker?: McmaTrackerProperties; | ||
notificationEndpoint?: NotificationEndpointProperties; | ||
} | ||
export declare class JobAssignment extends JobBase<JobAssignmentProperties> implements JobAssignmentProperties { | ||
job: string; | ||
tracker?: McmaTrackerProperties; | ||
notificationEndpoint?: NotificationEndpointProperties; | ||
constructor(properties: JobAssignmentProperties); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const job_base_1 = require("./job-base"); | ||
const mcma_tracker_1 = require("./mcma-tracker"); | ||
const notification_endpoint_1 = require("./notification-endpoint"); | ||
class JobAssignment extends job_base_1.JobBase { | ||
constructor(properties) { | ||
super("JobAssignment", properties); | ||
this.checkProperty("job", "resource"); | ||
this.checkProperty("job", "url"); | ||
this.checkProperty("tracker", "object", false); | ||
this.checkProperty("notificationEndpoint", "object", false); | ||
if (typeof this.notificationEndpoint === "object") { | ||
this.notificationEndpoint = new notification_endpoint_1.NotificationEndpoint(this.notificationEndpoint); | ||
} | ||
if (typeof this.tracker === "object") { | ||
this.tracker = new mcma_tracker_1.McmaTracker(this.tracker); | ||
} | ||
} | ||
} | ||
exports.JobAssignment = JobAssignment; |
import { JobParameterBag } from "./job-parameter-bag"; | ||
import { McmaResource, McmaResourceProperties } from "./mcma-resource"; | ||
import { McmaTrackerProperties } from "./mcma-tracker"; | ||
import { NotificationEndpointProperties } from "./notification-endpoint"; | ||
import { ProblemDetail, ProblemDetailProperties } from "./problem-detail"; | ||
export interface JobBaseProperties extends McmaResourceProperties { | ||
tracker?: McmaTrackerProperties; | ||
notificationEndpoint?: string | NotificationEndpointProperties; | ||
status?: string; | ||
statusMessage?: string; | ||
jobInput?: JobParameterBag; | ||
error?: ProblemDetailProperties; | ||
jobOutput?: JobParameterBag; | ||
@@ -15,7 +11,4 @@ progress?: number; | ||
export declare abstract class JobBase<T extends JobBaseProperties> extends McmaResource implements JobBaseProperties { | ||
tracker?: McmaTrackerProperties; | ||
notificationEndpoint?: string | NotificationEndpointProperties; | ||
status?: string; | ||
statusMessage?: string; | ||
jobInput?: JobParameterBag; | ||
error?: ProblemDetail; | ||
jobOutput?: JobParameterBag; | ||
@@ -22,0 +15,0 @@ progress?: number; |
@@ -5,24 +5,16 @@ "use strict"; | ||
const mcma_resource_1 = require("./mcma-resource"); | ||
const mcma_tracker_1 = require("./mcma-tracker"); | ||
const notification_endpoint_1 = require("./notification-endpoint"); | ||
const problem_detail_1 = require("./problem-detail"); | ||
class JobBase extends mcma_resource_1.McmaResource { | ||
constructor(type, properties) { | ||
super(type, properties); | ||
this.checkProperty("tracker", "object", false); | ||
this.checkProperty("notificationEndpoint", "resource", false); | ||
this.checkProperty("status", "string", false); | ||
this.checkProperty("statusMessage", "string", false); | ||
this.checkProperty("jobInput", "resource", false); | ||
this.checkProperty("jobOutput", "resource", false); | ||
this.checkProperty("error", "object", false); | ||
this.checkProperty("jobOutput", "object", false); | ||
this.checkProperty("progress", "number", false); | ||
this.jobInput = new job_parameter_bag_1.JobParameterBag(properties.jobInput); | ||
if (typeof this.error === "object") { | ||
this.error = new problem_detail_1.ProblemDetail(this.error); | ||
} | ||
this.jobOutput = new job_parameter_bag_1.JobParameterBag(properties.jobOutput); | ||
if (typeof this.tracker === "object") { | ||
this.tracker = new mcma_tracker_1.McmaTracker(this.tracker); | ||
} | ||
if (typeof this.notificationEndpoint === "object") { | ||
this.notificationEndpoint = new notification_endpoint_1.NotificationEndpoint(this.notificationEndpoint); | ||
} | ||
} | ||
} | ||
exports.JobBase = JobBase; |
import { JobBase, JobBaseProperties } from "../job-base"; | ||
import { JobParameterBag } from "../job-parameter-bag"; | ||
import { McmaTrackerProperties } from "../mcma-tracker"; | ||
import { NotificationEndpointProperties } from "../notification-endpoint"; | ||
export interface JobProperties extends JobBaseProperties { | ||
parentId?: string; | ||
jobProfile: string; | ||
jobProcess?: string; | ||
jobInput?: JobParameterBag; | ||
timeout?: number; | ||
deadline?: Date; | ||
tracker?: McmaTrackerProperties; | ||
notificationEndpoint?: NotificationEndpointProperties; | ||
} | ||
export declare class Job extends JobBase<JobProperties> implements JobProperties { | ||
parentId?: string; | ||
jobProfile: string; | ||
jobProcess?: string; | ||
jobInput?: JobParameterBag; | ||
timeout?: number; | ||
deadline?: Date; | ||
tracker?: McmaTrackerProperties; | ||
notificationEndpoint?: NotificationEndpointProperties; | ||
constructor(type: string, properties: JobProperties); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const job_base_1 = require("../job-base"); | ||
const job_parameter_bag_1 = require("../job-parameter-bag"); | ||
const mcma_tracker_1 = require("../mcma-tracker"); | ||
const notification_endpoint_1 = require("../notification-endpoint"); | ||
class Job extends job_base_1.JobBase { | ||
constructor(type, properties) { | ||
super(type, properties); | ||
this.checkProperty("jobProfile", "resource", true); | ||
this.checkProperty("jobProcess", "resource", false); | ||
this.checkProperty("parentId", "url", false); | ||
this.checkProperty("jobProfile", "url", true); | ||
this.checkProperty("jobInput", "object", false); | ||
this.checkProperty("timeout", "number", false); | ||
this.checkProperty("deadline", "object", false); | ||
this.checkProperty("tracker", "object", false); | ||
this.checkProperty("notificationEndpoint", "object", false); | ||
this.jobInput = new job_parameter_bag_1.JobParameterBag(properties.jobInput); | ||
if (typeof this.notificationEndpoint === "object") { | ||
this.notificationEndpoint = new notification_endpoint_1.NotificationEndpoint(this.notificationEndpoint); | ||
} | ||
if (typeof this.tracker === "object") { | ||
this.tracker = new mcma_tracker_1.McmaTracker(this.tracker); | ||
} | ||
} | ||
} | ||
exports.Job = Job; |
@@ -5,2 +5,4 @@ export interface McmaObjectProperties { | ||
export declare class McmaObject implements McmaObjectProperties { | ||
["@type"]: string; | ||
[key: string]: any; | ||
constructor(type: string, properties?: McmaObjectProperties); | ||
@@ -7,0 +9,0 @@ protected checkProperty(propertyName: string, expectedType: string, required?: boolean): void; |
@@ -9,7 +9,3 @@ "use strict"; | ||
if (properties) { | ||
for (const prop in properties) { | ||
if (properties.hasOwnProperty(prop) && prop !== "@type") { | ||
this[prop] = properties[prop]; | ||
} | ||
} | ||
Object.assign(this, properties); | ||
} | ||
@@ -26,10 +22,3 @@ } | ||
} | ||
if (expectedType === "resource") { // special MCMA type that can either be a URL referencing a resource or embedded object | ||
if ((propertyType !== "string" && propertyType !== "object") || | ||
(propertyType === "string" && !utils_1.Utils.isValidUrl(propertyValue)) || | ||
(propertyType === "object" && Array.isArray(propertyValue))) { | ||
throw new mcma_exception_1.McmaException("Resource of type '" + this["@type"] + "' requires property '" + propertyName + "' to have a valid URL or an object", null, this); | ||
} | ||
} | ||
else if (expectedType === "url") { | ||
if (expectedType === "url") { | ||
if (propertyType !== "string" || !utils_1.Utils.isValidUrl(propertyValue)) { | ||
@@ -36,0 +25,0 @@ throw new mcma_exception_1.McmaException("Resource of type '" + this["@type"] + "' requires property '" + propertyName + "' to have a valid URL", null, this); |
@@ -1,8 +0,8 @@ | ||
import { McmaResourceProperties, McmaResource } from "./mcma-resource"; | ||
export interface NotificationEndpointProperties extends McmaResourceProperties { | ||
import { McmaObject, McmaObjectProperties } from "./mcma-object"; | ||
export interface NotificationEndpointProperties extends McmaObjectProperties { | ||
httpEndpoint: string; | ||
} | ||
export declare class NotificationEndpoint extends McmaResource implements NotificationEndpointProperties { | ||
export declare class NotificationEndpoint extends McmaObject implements NotificationEndpointProperties { | ||
httpEndpoint: string; | ||
constructor(properties: NotificationEndpointProperties); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const mcma_resource_1 = require("./mcma-resource"); | ||
class NotificationEndpoint extends mcma_resource_1.McmaResource { | ||
const mcma_object_1 = require("./mcma-object"); | ||
class NotificationEndpoint extends mcma_object_1.McmaObject { | ||
constructor(properties) { | ||
@@ -6,0 +6,0 @@ super("NotificationEndpoint", properties); |
@@ -1,11 +0,10 @@ | ||
import { McmaResource, McmaResourceProperties } from "./mcma-resource"; | ||
import { McmaObject } from "./mcma-object"; | ||
export interface NotificationProperties extends McmaResourceProperties { | ||
content: McmaObject; | ||
import { McmaObject, McmaObjectProperties } from "./mcma-object"; | ||
export interface NotificationProperties extends McmaObjectProperties { | ||
source?: string; | ||
content: any; | ||
} | ||
export declare class Notification extends McmaResource implements NotificationProperties { | ||
content: McmaObject; | ||
export declare class Notification extends McmaObject implements NotificationProperties { | ||
source?: string; | ||
constructor(properties: any); | ||
content: any; | ||
constructor(properties: NotificationProperties); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const mcma_resource_1 = require("./mcma-resource"); | ||
class Notification extends mcma_resource_1.McmaResource { | ||
const mcma_object_1 = require("./mcma-object"); | ||
class Notification extends mcma_object_1.McmaObject { | ||
constructor(properties) { | ||
super("Notification", properties); | ||
this.checkProperty("source", "string", false); | ||
this.checkProperty("content", "resource", true); | ||
this.checkProperty("content", "object", true); | ||
} | ||
} | ||
exports.Notification = Notification; |
import { McmaResource, McmaResourceProperties } from "./mcma-resource"; | ||
import { ResourceEndpointProperties } from "./resource-endpoint"; | ||
import { JobProfileProperties } from "./job-profile"; | ||
export interface ServiceProperties extends McmaResourceProperties { | ||
@@ -10,3 +9,3 @@ name: string; | ||
jobType?: string; | ||
jobProfiles?: (string | JobProfileProperties)[]; | ||
jobProfiles?: string[]; | ||
} | ||
@@ -19,4 +18,4 @@ export declare class Service extends McmaResource implements ServiceProperties { | ||
jobType?: string; | ||
jobProfiles?: (string | JobProfileProperties)[]; | ||
constructor(properties: any); | ||
jobProfiles?: string[]; | ||
constructor(properties: ServiceProperties); | ||
} |
@@ -5,3 +5,2 @@ "use strict"; | ||
const resource_endpoint_1 = require("./resource-endpoint"); | ||
const job_profile_1 = require("./job-profile"); | ||
class Service extends mcma_resource_1.McmaResource { | ||
@@ -31,12 +30,4 @@ constructor(properties) { | ||
} | ||
if (this.jobProfiles !== undefined) { | ||
for (let i = 0; i < this.jobProfiles.length; i++) { | ||
const jobProfile = this.jobProfiles[i]; | ||
if (typeof jobProfile !== "string") { | ||
this.jobProfiles[i] = new job_profile_1.JobProfile(jobProfile); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
exports.Service = Service; |
{ | ||
"name": "@mcma/core", | ||
"version": "0.9.7", | ||
"version": "0.10.0", | ||
"description": "Node module with type definitions and helper utils for the EBU MCMA framework", | ||
@@ -5,0 +5,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46059
84
1162