lml-main
Version:
This is now a mono repository published into many standalone packages.
134 lines • 4.24 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var redux_rx_http_1 = require("redux-rx-http");
exports.FETCH_JOB_BY_ID = redux_rx_http_1.createRxHttpActionTypes('FETCH_JOB_BY_ID');
exports.FETCH_JOBS_BY_ID_BATCH = redux_rx_http_1.createRxHttpActionTypes('FETCH_JOBS_BY_ID_BATCH');
exports.FETCH_JOB_BY_JOB_NUMBER = redux_rx_http_1.createRxHttpActionTypes('FETCH_JOB_BY_JOB_NUMBER');
exports.FETCH_JOBS_BY_JOB_NUMBER = redux_rx_http_1.createRxHttpActionTypes('FETCH_JOBS_BY_ORDER_NUMBER');
exports.POST_JOB = redux_rx_http_1.createRxHttpActionTypes('POST_JOB');
exports.PUT_JOB = redux_rx_http_1.createRxHttpActionTypes('PUT_JOB');
exports.DELETE_JOB = redux_rx_http_1.createRxHttpActionTypes('DELETE_JOB');
exports.SET_JOB_BY_ID = 'SET_JOB_BY_ID';
exports.SET_JOBS_BY_ID_BATCH = 'SET_JOBS_BY_ID_BATCH';
/**
* Fetch a single job by refId
*
* @param refId
* @param showData
* @param args
*/
exports.fetchJobById = function (refId, showData, args) {
if (showData === void 0) { showData = 'job'; }
if (args === void 0) { args = {}; }
return redux_rx_http_1.rxHttpGet("/v2/job-orchestration/by-id/" + refId, exports.FETCH_JOB_BY_ID, {
showData: showData,
versions: 'incident:2',
}, {
args: tslib_1.__assign({ refId: refId,
showData: showData }, args),
});
};
/**
* Fetch a batch of jobs by refId
*
* @param refIds
* @param showData
* @param args
*/
exports.fetchJobsByIdBatch = function (refIds, showData, args) {
if (showData === void 0) { showData = 'jobs'; }
if (args === void 0) { args = {}; }
return redux_rx_http_1.rxHttpPost("/v2/job-orchestration/by-id/batch", exports.FETCH_JOBS_BY_ID_BATCH, { refIds: refIds }, {
args: tslib_1.__assign({ refIds: refIds,
showData: showData }, args),
request: {
query: {
showData: showData,
},
},
});
};
/**
* Fetch a job by job number
*
* @param jobNumber
* @param showData
* @param args
*/
exports.fetchJobByJobNumber = function (jobNumber, showData, args) {
if (showData === void 0) { showData = 'job'; }
if (args === void 0) { args = {}; }
return redux_rx_http_1.rxHttpGet("/v2/job-orchestration/by-job-number/" + jobNumber, exports.FETCH_JOB_BY_JOB_NUMBER, { showData: showData }, {
args: tslib_1.__assign({ jobNumber: jobNumber,
showData: showData }, args),
});
};
/**
* Fetch a jobs by order number
*
* @param jobNumber
* @param showData
* @param args
*/
exports.fetchJobsByJobNumber = function (jobNumber, partner, showData, args) {
if (showData === void 0) { showData = 'jobs'; }
if (args === void 0) { args = {}; }
return redux_rx_http_1.rxHttpGet("/v2/job-orchestration/by-order-number/" + jobNumber, exports.FETCH_JOBS_BY_JOB_NUMBER, { partner: partner, showData: showData }, {
args: tslib_1.__assign({ jobNumber: jobNumber,
showData: showData }, args),
});
};
/**
* Create a new job
*
* @param job
* @param args
*/
exports.postJob = function (job, args) {
if (args === void 0) { args = {}; }
return redux_rx_http_1.rxHttpPost('/v1/jobs', exports.POST_JOB, job, {
args: tslib_1.__assign({ job: job }, args),
});
};
/**
* Update a job
*
* @param job
* @param args
*/
exports.putJob = function (job, args) {
if (args === void 0) { args = {}; }
return redux_rx_http_1.rxHttpPut("/v1/jobs/" + job.refId, exports.PUT_JOB, job, {
args: tslib_1.__assign({ job: job }, args),
});
};
/**
* Delete a job
*
* @param refId
* @param args
*/
exports.deleteJob = function (refId, args) {
if (args === void 0) { args = {}; }
return redux_rx_http_1.rxHttpDelete("/v1/jobs/" + refId, exports.DELETE_JOB, {
args: tslib_1.__assign({ refId: refId }, args),
});
};
/**
* Update the store with a single job by id
*
* @param job
*/
exports.setJobById = function (job) {
return ({ type: exports.SET_JOB_BY_ID, job: job });
};
/**
* Update a batch of jobs by id
*
* @param jobs
*/
exports.setJobsByIdBatch = function (jobs) {
return ({ type: exports.SET_JOBS_BY_ID_BATCH, jobs: jobs });
};
//# sourceMappingURL=job.js.map