Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mcma/api

Package Overview
Dependencies
Maintainers
3
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mcma/api - npm Package Compare versions

Comparing version 0.13.18 to 0.13.19

2

dist/lib/routing/defaults/default-job-route-collection.d.ts

@@ -7,2 +7,3 @@ import { JobAssignment } from "@mcma/core";

export declare class DefaultJobRouteCollection extends DefaultRouteCollection<JobAssignment> {
private dbTableProvider;
private workerInvoker;

@@ -12,2 +13,3 @@ constructor(dbTableProvider: DocumentDatabaseTableProvider, workerInvoker: WorkerInvoker, root?: string);

onJobAssignmentCreationCompleted(requestContext: McmaApiRequestContext, jobAssignment: JobAssignment): Promise<void>;
processCancel(requestContext: McmaApiRequestContext): Promise<void>;
}

@@ -6,11 +6,16 @@ "use strict";

const core_1 = require("@mcma/core");
const data_1 = require("@mcma/data");
const worker_invoker_1 = require("@mcma/worker-invoker");
const default_route_collection_1 = require("./default-route-collection");
const config_variables_ext_1 = require("../../config-variables-ext");
const http_1 = require("../../http");
class DefaultJobRouteCollection extends default_route_collection_1.DefaultRouteCollection {
constructor(dbTableProvider, workerInvoker, root) {
super(dbTableProvider, core_1.JobAssignment, root);
this.dbTableProvider = dbTableProvider;
this.workerInvoker = workerInvoker;
this.create.onStarted = reqCtx => this.onJobAssignmentCreationStarted(reqCtx);
this.create.onCompleted = (reqCtx, jobAssignment) => this.onJobAssignmentCreationCompleted(reqCtx, jobAssignment);
this.remove("update");
this.addRoute("POST", "/job-assignments/{id}/cancel", this.processCancel.bind(this));
}

@@ -33,3 +38,26 @@ async onJobAssignmentCreationStarted(requestContext) {

}
async processCancel(requestContext) {
const request = requestContext.request;
const table = await this.dbTableProvider.get(data_1.getTableName());
const jobAssignmentDatabaseId = "/job-assignments/" + request.pathVariables.id;
const jobAssignment = await table.get(jobAssignmentDatabaseId);
if (!jobAssignment) {
requestContext.setResponseResourceNotFound();
return;
}
if (jobAssignment.status === core_1.JobStatus.Completed ||
jobAssignment.status === core_1.JobStatus.Failed ||
jobAssignment.status === core_1.JobStatus.Canceled) {
requestContext.setResponseStatusCode(http_1.HttpStatusCode.Conflict, "JobAssignment is already in a final state");
return;
}
await this.workerInvoker.invoke(worker_invoker_1.getWorkerFunctionId(), {
operationName: "ProcessCancel",
input: {
jobAssignmentDatabaseId
},
tracker: jobAssignment.tracker
});
}
}
exports.DefaultJobRouteCollection = DefaultJobRouteCollection;

18

package.json
{
"name": "@mcma/api",
"version": "0.13.18",
"version": "0.13.19",
"description": "Node module for building APIs based on the EBU MCMA framework",

@@ -40,12 +40,12 @@ "engines": {

"peerDependencies": {
"@mcma/client": "0.13.18",
"@mcma/core": "0.13.18",
"@mcma/data": "0.13.18",
"@mcma/worker-invoker": "0.13.18"
"@mcma/client": "0.13.19",
"@mcma/core": "0.13.19",
"@mcma/data": "0.13.19",
"@mcma/worker-invoker": "0.13.19"
},
"devDependencies": {
"@mcma/client": "0.13.18",
"@mcma/core": "0.13.18",
"@mcma/data": "0.13.18",
"@mcma/worker-invoker": "0.13.18",
"@mcma/client": "0.13.19",
"@mcma/core": "0.13.19",
"@mcma/data": "0.13.19",
"@mcma/worker-invoker": "0.13.19",
"@types/node": "^13.7.4",

@@ -52,0 +52,0 @@ "@types/pluralize": "0.0.29",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc