Commit 0385e3d7 authored by Panagiotis Skarvelis's avatar Panagiotis Skarvelis
Browse files

use newest auditrecorddb module

parent b1ccab09
# Client for getNncIdentity service of KED
Client to connect EMEP service, useful for use with nextjs/nodejs projects.
Client to connect EMEP service, useful for nextjs/nodejs projects.
#### Example:
```
......@@ -26,8 +26,32 @@ const test = async () => {
test().then((identity) => { console.log('getNncIdentityOutputRecord',identity); });
```
* you can use `overides` to override the default values
* for test you dont need to use the `overides`, in that case default storage path will be used `/tmp`
* look at [KED](https://www.gsis.gr/dimosia-dioikisi/ked/) common guides for records you can use on auditInit"
* for your tests, you don't need to use the `overides` mecahnism,in that case, the default storage path will be used ie `/tmp`
* look at [KED](https://www.gsis.gr/dimosia-dioikisi/ked/) standard guides for records you can use on auditInit"
Also, you can use `overides` to override the default storage Engine.
```
import getIdentity from '@digigov-oss/get-nnc-identity-client';
import {PostgreSqlEngine} from '@digigov-oss/gsis-audit-record-db';
const test = async () => {
try {
const overides = {
auditEngine: new PostgreSqlEngine('postgres://postgres:postgres@localhost:5432/postgres'),
auditInit: {
auditUnit: 'grnet.gr',
},
}
const Identity = await getIdentity("052704062", config.user, config.pass, overides);
return Identity;
} catch (error) {
console.log(error);
}
}
test().then((identity) => { console.log('getNncIdentityOutputRecord',identity); });
```
Look at module [AuditRecordDB](https://gitlab.grnet.gr/digigov-oss/auditRecordDB/-/blob/main/README.md) for more details on how to use the AuditEngine.
#### Returns
......
import { AuditRecord } from '@digigov-oss/gsis-audit-record-db';
import { AuditRecord, AuditEngine } from '@digigov-oss/gsis-audit-record-db';
export declare type AuditInit = AuditRecord;
export declare type getNncIdentityOutputRecord = {
countryCode?: string;
......@@ -36,6 +36,7 @@ export declare type Overides = {
prod?: boolean;
auditInit?: AuditRecord;
auditStoragePath?: string;
auditEngine?: AuditEngine;
};
/**
*
......
......@@ -25,12 +25,13 @@ const config_json_1 = __importDefault(require("./config.json"));
* @returns AuditRecord | errorRecord
*/
const getIdentity = (afm, user, pass, overides) => __awaiter(void 0, void 0, void 0, function* () {
var _a, _b, _c;
var _a, _b, _c, _d;
const prod = (_a = overides === null || overides === void 0 ? void 0 : overides.prod) !== null && _a !== void 0 ? _a : false;
const auditInit = (_b = overides === null || overides === void 0 ? void 0 : overides.auditInit) !== null && _b !== void 0 ? _b : {};
const auditStoragePath = (_c = overides === null || overides === void 0 ? void 0 : overides.auditStoragePath) !== null && _c !== void 0 ? _c : "/tmp";
const auditEngine = (_d = overides === null || overides === void 0 ? void 0 : overides.auditEngine) !== null && _d !== void 0 ? _d : new gsis_audit_record_db_1.FileEngine(auditStoragePath);
const wsdl = prod == true ? config_json_1.default.prod.wsdl : config_json_1.default.test.wsdl;
const auditRecord = (0, gsis_audit_record_db_1.generateAuditRecord)(auditInit, auditStoragePath);
const auditRecord = (0, gsis_audit_record_db_1.generateAuditRecord)(auditInit, auditEngine);
if (!auditRecord)
throw new Error('Audit record is not initialized');
try {
......
import { AuditRecord } from '@digigov-oss/gsis-audit-record-db';
import { AuditRecord, AuditEngine } from '@digigov-oss/gsis-audit-record-db';
export declare type AuditInit = AuditRecord;
export declare type getNncIdentityOutputRecord = {
countryCode?: string;
......@@ -36,6 +36,7 @@ export declare type Overides = {
prod?: boolean;
auditInit?: AuditRecord;
auditStoragePath?: string;
auditEngine?: AuditEngine;
};
/**
*
......
import soapClient from './soapClient.js';
import { generateAuditRecord } from '@digigov-oss/gsis-audit-record-db';
import { generateAuditRecord, FileEngine } from '@digigov-oss/gsis-audit-record-db';
import config from './config.json';
/**
*
......@@ -13,8 +13,9 @@ export const getIdentity = async (afm, user, pass, overides) => {
const prod = overides?.prod ?? false;
const auditInit = overides?.auditInit ?? {};
const auditStoragePath = overides?.auditStoragePath ?? "/tmp";
const auditEngine = overides?.auditEngine ?? new FileEngine(auditStoragePath);
const wsdl = prod == true ? config.prod.wsdl : config.test.wsdl;
const auditRecord = generateAuditRecord(auditInit, auditStoragePath);
const auditRecord = generateAuditRecord(auditInit, auditEngine);
if (!auditRecord)
throw new Error('Audit record is not initialized');
try {
......
......@@ -8,7 +8,7 @@
},
"author": "Panagiotis Skarvelis <pskarvelis@admin.grnet.gr>",
"dependencies": {
"@digigov-oss/gsis-audit-record-db": "^1.0.2",
"@digigov-oss/gsis-audit-record-db": "^1.0.8",
"soap": "^0.43.0"
},
"repository": {
......@@ -31,6 +31,7 @@
"test": "node --experimental-specifier-resolution=node --experimental-modules --no-warnings --loader ts-node/esm ./test/test.ts",
"testesm": "node --experimental-json-modules --no-warnings ./test/test.mjs",
"testcjs": "node ./test/test.cjs",
"testPostgreSql": "node --experimental-specifier-resolution=node --experimental-modules --no-warnings --loader ts-node/esm ./test/testPostgreSql.ts",
"build": "rm -fr dist/* && tsc -p tsconfig.json && tsc -p tsconfig.commonjs.json && ./setType.sh"
},
"eslintConfig": {
......
import soapClient from './soapClient.js';
import {generateAuditRecord,AuditRecord} from '@digigov-oss/gsis-audit-record-db';
import {generateAuditRecord, AuditRecord, FileEngine, AuditEngine } from '@digigov-oss/gsis-audit-record-db';
import config from './config.json';
......@@ -42,6 +42,7 @@ export type Overides = {
prod?:boolean;
auditInit?: AuditRecord;
auditStoragePath?: string;
auditEngine?: AuditEngine;
}
......@@ -58,8 +59,9 @@ export const getIdentity = async (afm:string, user:string, pass:string, overides
const prod = overides?.prod ?? false;
const auditInit = overides?.auditInit ?? {} as AuditRecord;
const auditStoragePath = overides?.auditStoragePath ?? "/tmp"
const auditEngine = overides?.auditEngine ?? new FileEngine(auditStoragePath);
const wsdl = prod==true? config.prod.wsdl : config.test.wsdl;
const auditRecord = generateAuditRecord(auditInit, auditStoragePath);
const auditRecord = generateAuditRecord(auditInit, auditEngine);
if (!auditRecord) throw new Error('Audit record is not initialized');
try {
......
import getIdentity from '../src/index';
import config from './config.json';
import { PostgreSqlEngine } from '@digigov-oss/gsis-audit-record-db';
const test = async () => {
try {
const overides = {
auditEngine: new PostgreSqlEngine('postgres://postgres:postgres@localhost:5432/postgres'),
auditInit: {
auditUnit: 'grnet.gr',
},
}
const Identity = await getIdentity("052704062", config.user, config.pass, overides);
return Identity;
} catch (error) {
console.log(error);
}
}
test().then((identity) => { console.log('getNncIdentityOutputRecord',identity); });
\ No newline at end of file
......@@ -14,10 +14,12 @@
dependencies:
"@cspotcode/source-map-consumer" "0.8.0"
"@digigov-oss/gsis-audit-record-db@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@digigov-oss/gsis-audit-record-db/-/gsis-audit-record-db-1.0.2.tgz#6cf3ce301554c9d88c2fcc00ef9f7bbb7138794e"
integrity sha512-cqKMO2eugcoL237R2xn9fg4H/z1SrwgLn+O7++Tu1Gomd0fEeXgUfuKC/c7hfe7fWC38EUqMmfCt2gx0miC/Zw==
"@digigov-oss/gsis-audit-record-db@^1.0.8":
version "1.0.8"
resolved "https://registry.yarnpkg.com/@digigov-oss/gsis-audit-record-db/-/gsis-audit-record-db-1.0.8.tgz#10695d2fccc51232ff0d6399a05ea934415e4c29"
integrity sha512-UEKVeJ6n7TuDbzmIcul/wkSmTGKRpz9BSQvRPFWVFBk/Fm1kZ4ptQ+AexzQ19qBaxJUlWbK2na8+LSCa8nXYyg==
dependencies:
pg-native "^3.0.0"
"@tsconfig/node10@^1.0.7":
version "1.0.8"
......@@ -83,11 +85,23 @@ axios@^0.21.1, axios@^0.21.3:
dependencies:
follow-redirects "^1.14.0"
bindings@1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df"
integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==
dependencies:
file-uri-to-path "1.0.0"
content-type-parser@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/content-type-parser/-/content-type-parser-1.0.2.tgz#caabe80623e63638b2502fd4c7f12ff4ce2352e7"
integrity sha512-lM4l4CnMEwOLHAHr/P6MEZwZFPJFtAAKgL6pogbXmVZggIqXhdB6RbBtPOTsw2FcXwYhehRGERJmRrjOiIB8pQ==
core-util-is@~1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85"
integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==
create-require@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
......@@ -105,6 +119,11 @@ diff@^4.0.1:
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==
file-uri-to-path@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"
integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==
follow-redirects@^1.14.0:
version "1.14.6"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.6.tgz#8cfb281bbc035b3c067d6cd975b0f6ade6e855cd"
......@@ -120,6 +139,16 @@ get-stream@^6.0.1:
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7"
integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==
inherits@~2.0.1:
version "2.0.4"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
isarray@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=
json5@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe"
......@@ -127,6 +156,14 @@ json5@^1.0.1:
dependencies:
minimist "^1.2.0"
libpq@^1.7.0:
version "1.8.9"
resolved "https://registry.yarnpkg.com/libpq/-/libpq-1.8.9.tgz#6e0c6eecb176f6656ad092d67cc0131980cba897"
integrity sha512-herU0STiW3+/XBoYRycKKf49O9hBKK0JbdC2QmvdC5pyCSu8prb9idpn5bUSbxj8XwcEsWPWWWwTDZE9ZTwJ7g==
dependencies:
bindings "1.5.0"
nan "^2.14.0"
lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
......@@ -147,6 +184,68 @@ ms@2.1.2:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
nan@^2.14.0:
version "2.15.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.15.0.tgz#3f34a473ff18e15c1b5626b62903b5ad6e665fee"
integrity sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==
pg-int8@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/pg-int8/-/pg-int8-1.0.1.tgz#943bd463bf5b71b4170115f80f8efc9a0c0eb78c"
integrity sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==
pg-native@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/pg-native/-/pg-native-3.0.0.tgz#20c64e651e20b28f5c060b3823522d1c8c4429c3"
integrity sha512-qZZyywXJ8O4lbiIN7mn6vXIow1fd3QZFqzRe+uET/SZIXvCa3HBooXQA4ZU8EQX8Ae6SmaYtDGLp5DwU+8vrfg==
dependencies:
libpq "^1.7.0"
pg-types "^1.12.1"
readable-stream "1.0.31"
pg-types@^1.12.1:
version "1.13.0"
resolved "https://registry.yarnpkg.com/pg-types/-/pg-types-1.13.0.tgz#75f490b8a8abf75f1386ef5ec4455ecf6b345c63"
integrity sha512-lfKli0Gkl/+za/+b6lzENajczwZHc7D5kiUCZfgm914jipD2kIOIvEkAhZ8GrW3/TUoP9w8FHjwpPObBye5KQQ==
dependencies:
pg-int8 "1.0.1"
postgres-array "~1.0.0"
postgres-bytea "~1.0.0"
postgres-date "~1.0.0"
postgres-interval "^1.1.0"
postgres-array@~1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/postgres-array/-/postgres-array-1.0.3.tgz#c561fc3b266b21451fc6555384f4986d78ec80f5"
integrity sha512-5wClXrAP0+78mcsNX3/ithQ5exKvCyK5lr5NEEEeGwwM6NJdQgzIJBVxLvRW+huFpX92F2QnZ5CcokH0VhK2qQ==
postgres-bytea@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/postgres-bytea/-/postgres-bytea-1.0.0.tgz#027b533c0aa890e26d172d47cf9ccecc521acd35"
integrity sha1-AntTPAqokOJtFy1Hz5zOzFIazTU=
postgres-date@~1.0.0:
version "1.0.7"
resolved "https://registry.yarnpkg.com/postgres-date/-/postgres-date-1.0.7.tgz#51bc086006005e5061c591cee727f2531bf641a8"
integrity sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==
postgres-interval@^1.1.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/postgres-interval/-/postgres-interval-1.2.0.tgz#b460c82cb1587507788819a06aa0fffdb3544695"
integrity sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==
dependencies:
xtend "^4.0.0"
readable-stream@1.0.31:
version "1.0.31"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.31.tgz#8f2502e0bc9e3b0da1b94520aabb4e2603ecafae"
integrity sha1-jyUC4LyeOw2huUUgqrtOJgPsr64=
dependencies:
core-util-is "~1.0.0"
inherits "~2.0.1"
isarray "0.0.1"
string_decoder "~0.10.x"
sax@>=0.6:
version "1.2.4"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
......@@ -169,6 +268,11 @@ soap@^0.43.0:
uuid "^8.3.2"
xml-crypto "^2.1.3"
string_decoder@~0.10.x:
version "0.10.31"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"
integrity sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=
strip-bom@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"
......@@ -225,6 +329,11 @@ xpath@0.0.32:
resolved "https://registry.yarnpkg.com/xpath/-/xpath-0.0.32.tgz#1b73d3351af736e17ec078d6da4b8175405c48af"
integrity sha512-rxMJhSIoiO8vXcWvSifKqhvV96GjiD5wYb8/QHdoRyQvraTpp4IEv944nhGausZZ3u7dhQXteZuZbaqfpB7uYw==
xtend@^4.0.0:
version "4.0.2"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==
yn@3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
......
Markdown is supported
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