Commit d27a1daf authored by Panagiotis Skarvelis's avatar Panagiotis Skarvelis
Browse files

remove experimental nececarity

parent ebcf2efe
import { AuditRecord } from './interfaces/index';
import { AuditRecord } from './interfaces/index.js';
/**
* @description Use this on your app to generate and log the audit record
* @coment This is the main function of the application
......
......@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateAuditRecord = void 0;
const protocol_1 = __importDefault(require("./lib/protocol"));
const sequence_1 = __importDefault(require("./lib/sequence"));
const db_1 = __importDefault(require("./lib/db"));
const FileEngine_1 = __importDefault(require("./lib/FileEngine"));
const protocol_js_1 = __importDefault(require("./lib/protocol.js"));
const sequence_js_1 = __importDefault(require("./lib/sequence.js"));
const db_js_1 = __importDefault(require("./lib/db.js"));
const FileEngine_js_1 = __importDefault(require("./lib/FileEngine.js"));
/**
* @description Use this on your app to generate and log the audit record
* @coment This is the main function of the application
......@@ -20,8 +20,8 @@ const FileEngine_1 = __importDefault(require("./lib/FileEngine"));
*/
const generateAuditRecord = (auditInit, storagePath = "/tmp") => {
const auditUnit = (auditInit === null || auditInit === void 0 ? void 0 : auditInit.auditUnit) || "gov.gr";
const auditTransactionId = (auditInit === null || auditInit === void 0 ? void 0 : auditInit.auditTransactionId) || "" + (0, sequence_1.default)(storagePath + "/sequence", storagePath + "/sequence");
const auditProtocol = (auditInit === null || auditInit === void 0 ? void 0 : auditInit.auditProtocol) || (0, protocol_1.default)(storagePath);
const auditTransactionId = (auditInit === null || auditInit === void 0 ? void 0 : auditInit.auditTransactionId) || "" + (0, sequence_js_1.default)(storagePath + "/sequence", storagePath + "/sequence");
const auditProtocol = (auditInit === null || auditInit === void 0 ? void 0 : auditInit.auditProtocol) || (0, protocol_js_1.default)(storagePath);
const auditTransactionDate = (auditInit === null || auditInit === void 0 ? void 0 : auditInit.auditTransactionDate) || new Date().toISOString().split('.')[0] + "Z";
const auditUserIp = (auditInit === null || auditInit === void 0 ? void 0 : auditInit.auditUserIp) || process.env.HOSTIP || "127.0.0.1";
const auditUserId = (auditInit === null || auditInit === void 0 ? void 0 : auditInit.auditUserId) || "system";
......@@ -33,7 +33,7 @@ const generateAuditRecord = (auditInit, storagePath = "/tmp") => {
auditUserIp,
auditUserId
};
const dbEngine = new db_1.default(new FileEngine_1.default(storagePath));
const dbEngine = new db_js_1.default(new FileEngine_js_1.default(storagePath));
try {
return dbEngine.put(auditRecord);
}
......
import { AuditRecord, AuditEngine } from '../interfaces/index';
import { AuditRecord, AuditEngine } from '../interfaces/index.js';
/**
* @description AuditEngine implementation
* @note This class is used to implement the methods that must be implemented by the AuditEngine
......
import { AuditRecord, AuditEngine } from '../interfaces/index';
import { AuditRecord, AuditEngine } from '../interfaces/index.js';
/**
* @description AuditEngine implementation
* @note This class uses AuditEngine implemetations, look at FileEngine.ts for an example
......
......@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const sequence_1 = __importDefault(require("./sequence"));
const sequence_js_1 = __importDefault(require("./sequence.js"));
/**
* Generate a new protocol number
* in the format sequence/date
......@@ -14,7 +14,7 @@ const sequence_1 = __importDefault(require("./sequence"));
const protocol = (protocol_path) => {
const protocol_date = new Date().toISOString().split('T')[0];
const path = `${protocol_path}/${protocol_date}.protocol.sequence`;
const protocol_sequence = (0, sequence_1.default)(path, path); //Protocol starts from 1 each day.
const protocol_sequence = (0, sequence_js_1.default)(path, path); //Protocol starts from 1 each day.
let pn = protocol_sequence + "/" + protocol_date;
return pn;
};
......
import { AuditRecord } from './interfaces/index';
import { AuditRecord } from './interfaces/index.js';
/**
* @description Use this on your app to generate and log the audit record
* @coment This is the main function of the application
......
import protocol from './lib/protocol';
import sequence from './lib/sequence';
import db from './lib/db';
import FileEngine from './lib/FileEngine';
import protocol from './lib/protocol.js';
import sequence from './lib/sequence.js';
import db from './lib/db.js';
import FileEngine from './lib/FileEngine.js';
/**
* @description Use this on your app to generate and log the audit record
* @coment This is the main function of the application
......
import { AuditRecord, AuditEngine } from '../interfaces/index';
import { AuditRecord, AuditEngine } from '../interfaces/index.js';
/**
* @description AuditEngine implementation
* @note This class is used to implement the methods that must be implemented by the AuditEngine
......
import { AuditRecord, AuditEngine } from '../interfaces/index';
import { AuditRecord, AuditEngine } from '../interfaces/index.js';
/**
* @description AuditEngine implementation
* @note This class uses AuditEngine implemetations, look at FileEngine.ts for an example
......
import sequence from './sequence';
import sequence from './sequence.js';
/**
* Generate a new protocol number
* in the format sequence/date
......
......@@ -26,7 +26,7 @@
},
"scripts": {
"test": "node --experimental-specifier-resolution=node --no-warnings --loader ts-node/esm ./test/test.ts",
"testesm": "node --experimental-specifier-resolution=node ./test/test.mjs",
"testesm": "node ./test/test.mjs",
"testcjs": "node ./test/test.cjs",
"build": "rm -fr dist/* && tsc -p tsconfig.json && tsc -p tsconfig.commonjs.json && ./setType.sh"
},
......
import protocol from './lib/protocol'
import sequence from './lib/sequence';
import db from './lib/db';
import { AuditRecord,FS_ERROR } from './interfaces/index';
import FileEngine from './lib/FileEngine';
import protocol from './lib/protocol.js'
import sequence from './lib/sequence.js';
import db from './lib/db.js';
import { AuditRecord,FS_ERROR } from './interfaces/index.js';
import FileEngine from './lib/FileEngine.js';
/**
* @description Use this on your app to generate and log the audit record
......
//Use File System as DB storage
import fs from 'fs';
import { AuditRecord, AuditEngine } from '../interfaces/index';
import { AuditRecord, AuditEngine } from '../interfaces/index.js';
/**
* @description AuditEngine implementation
......
import { AuditRecord, AuditEngine } from '../interfaces/index';
import { AuditRecord, AuditEngine } from '../interfaces/index.js';
/**
* @description AuditEngine implementation
......
import sequence from './sequence';
import sequence from './sequence.js';
/**
* Generate a new protocol number
......
import fs from 'fs';
import { FS_ERROR } from '../interfaces/index';
import { FS_ERROR } from '../interfaces/index.js';
const LOCK_FILE_PATH = "/tmp/sequence"
const SEQUENCE_FILE = "/tmp/sequence"
......
import {generateAuditRecord} from '../dist/esm/index'
import {generateAuditRecord} from '../dist/esm/index.js'
const test = () => {
const ar = generateAuditRecord(undefined, "/tmp");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment