Socket
Socket
Sign inDemoInstall

mbs-importer-jps

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mbs-importer-jps - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

9

dist/XMLImporter.d.ts
import { AbstractJob, JobConfig } from "server-socket-framework-jps";
import { Db } from 'mongodb';
import { DatabaseAvailableListener } from "mongo-access-jps";
export declare class XMLImporter extends AbstractJob implements DatabaseAvailableListener {
export declare class XMLImporter extends AbstractJob {
private static _instance;

@@ -11,3 +9,2 @@ private readonly importPath;

private fileName;
private db;
constructor();

@@ -17,7 +14,5 @@ static getInstance(): XMLImporter;

private handleCompleted;
importWithConnection(fileName: string, db: Db): Promise<number>;
import(fileName: string): void;
databaseConnected(db: Db): void;
import(fileName: string): Promise<number>;
executeJob(runId: string): void;
getConfig(): JobConfig;
}

@@ -25,2 +25,3 @@ "use strict";

const moment_1 = __importDefault(require("moment"));
const data_source_controller_1 = require("data-source-controller");
require('dotenv').config();

@@ -64,3 +65,3 @@ const converters = require('./util/fieldConverters');

}
importWithConnection(fileName, db) {
import(fileName) {
return __awaiter(this, void 0, void 0, function* () {

@@ -126,6 +127,6 @@ return new Promise((resolve, reject) => {

});
db.collection(this.collection).deleteMany({}).then((result) => {
db.collection(this.collection).insertMany(processedItems).then((result) => {
// now we need to calculated the derived values
db.collection(this.collection).find({ isDerived: true }).toArray().then((derivedItems) => {
data_source_controller_1.DataSourceController.getInstance().deleteAll(this.collection).then((result) => {
data_source_controller_1.DataSourceController.getInstance().insertMany(this.collection, processedItems).then((result) => {
// now we need to calculate the derived values
data_source_controller_1.DataSourceController.getInstance().find(this.collection, { isDerived: true }).then((derivedItems) => {
/*

@@ -196,3 +197,3 @@ compute the derived fee

}
db.collection(this.collection).replaceOne({ _id: item._id }, item);
data_source_controller_1.DataSourceController.getInstance().replaceOne(this.collection, item);
});

@@ -219,37 +220,19 @@ resolve(processedItems.length);

}
import(fileName) {
this.fileName = fileName;
}
databaseConnected(db) {
this.db = db;
}
executeJob(runId) {
if (this.db) {
this.importWithConnection(this.fileName, this.db).then((result) => {
this.handleCompleted(this.fileName);
if (this.cb)
this.cb(runId, this.getConfig(), server_socket_framework_jps_1.JobStatus.completed, null);
})
.catch((err) => {
const error = {
errorPriority: server_socket_framework_jps_1.JobErrorPriority.severe,
jobName: "MBS XML Importer",
message: err.message,
runId: runId
};
this.handleError(this.fileName);
if (this.cb)
this.cb(runId, this.getConfig(), server_socket_framework_jps_1.JobStatus.failed, [error]);
});
}
else {
this.import(this.fileName).then((result) => {
this.handleCompleted(this.fileName);
if (this.cb)
this.cb(runId, this.getConfig(), server_socket_framework_jps_1.JobStatus.completed, null);
})
.catch((err) => {
const error = {
errorPriority: server_socket_framework_jps_1.JobErrorPriority.severe,
jobName: "MBS XML Importer",
message: "database not available",
message: err.message,
runId: runId
};
this.handleError(this.fileName);
if (this.cb)
this.cb(runId, this.getConfig(), server_socket_framework_jps_1.JobStatus.failed, [error]);
}
});
}

@@ -256,0 +239,0 @@ getConfig() {

{
"name": "mbs-importer-jps",
"version": "1.0.3",
"version": "1.0.4",
"description": "A patient management web application",

@@ -18,7 +18,6 @@ "main": "dist/XMLImporter.js",

"buffer": "^5.7.1",
"data-source-controller": "^0.0.4",
"debug": "^2.6.9",
"dotenv": "^10.0.0",
"moment": "^2.29.1",
"mongo-access-jps": "^1.0.0-2",
"mongodb": "^4.1.1",
"path": "^0.12.7",

@@ -25,0 +24,0 @@ "server-socket-framework-jps": "^1.1.1-1",

Sorry, the diff of this file is not supported yet

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