Commit 6d99299d authored by Panagiotis Skarvelis's avatar Panagiotis Skarvelis
Browse files

fix typo

parent 3c65c060
......@@ -7,7 +7,7 @@ Client to connect EMEP service, useful for nextjs/nodejs projects.
import getIdentity from '@digigov-oss/get-nnc-identity-client';
const test = async () => {
const overides = {
const overrides = {
prod:false,
auditInit: {
auditUnit: 'grnet.gr',
......@@ -16,7 +16,7 @@ const test = async () => {
}
try {
const Identity = await getIdentity("052704062", "username", "password",overides);
const Identity = await getIdentity("052704062", "username", "password",overrides);
return Identity;
} catch (error) {
console.log(error);
......@@ -25,22 +25,22 @@ const test = async () => {
test().then((identity) => { console.log('getNncIdentityOutputRecord',identity); });
```
* you can use `overides` to override the default values
* for your tests, you don't need to use the `overides` mecahnism,in that case, the default storage path will be used ie `/tmp`
* you can use `overrides` to override the default values
* for your tests, you don't need to use the `overrides` 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.
Also, you can use `overrides` 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 = {
const overrides = {
auditEngine: new PostgreSqlEngine('postgres://postgres:postgres@localhost:5432/postgres'),
auditInit: {
auditUnit: 'grnet.gr',
},
}
const Identity = await getIdentity("052704062", config.user, config.pass, overides);
const Identity = await getIdentity("052704062", config.user, config.pass, overrides);
return Identity;
} catch (error) {
console.log(error);
......@@ -96,10 +96,10 @@ you have to ask KED for notificationCenter_v_0.95 documentation to get more info
#### * known issues
KED advertises a wrong endpoint(!) for the `getNncIdentity` service on production WSDL. So, you have to use (override) the endpoint: `https://ked.gsis.gr/esb/notificationCenterElementsService`
You can do that by setting the `endpoint` property on the `overides` object.
You can do that by setting the `endpoint` property on the `overrides` object.
```
const overides = {
const overrides = {
endpoint: 'https://ked.gsis.gr/esb/notificationCenterElementsService',
}
```
......@@ -32,7 +32,7 @@ export declare type errorRecord = {
* @param {string} auditInit - Audit record initializer to be used for the audit record produced
* @param {string} auditStoragePath - Path to the audit record storage
*/
export declare type Overides = {
export declare type overrides = {
endpoint?: string;
prod?: boolean;
auditInit?: AuditRecord;
......@@ -44,8 +44,8 @@ export declare type Overides = {
* @param afm string;
* @param user string;
* @param pass string;
* @param overides Overides;
* @param overrides overrides;
* @returns AuditRecord | errorRecord
*/
export declare const getIdentity: (afm: string, user: string, pass: string, overides?: Overides | undefined) => Promise<any>;
export declare const getIdentity: (afm: string, user: string, pass: string, overrides?: overrides | undefined) => Promise<any>;
export default getIdentity;
......@@ -21,16 +21,16 @@ const config_json_1 = __importDefault(require("./config.json"));
* @param afm string;
* @param user string;
* @param pass string;
* @param overides Overides;
* @param overrides overrides;
* @returns AuditRecord | errorRecord
*/
const getIdentity = (afm, user, pass, overides) => __awaiter(void 0, void 0, void 0, function* () {
const getIdentity = (afm, user, pass, overrides) => __awaiter(void 0, void 0, void 0, function* () {
var _a, _b, _c, _d, _e;
const endpoint = (_a = overides === null || overides === void 0 ? void 0 : overides.endpoint) !== null && _a !== void 0 ? _a : "";
const prod = (_b = overides === null || overides === void 0 ? void 0 : overides.prod) !== null && _b !== void 0 ? _b : false;
const auditInit = (_c = overides === null || overides === void 0 ? void 0 : overides.auditInit) !== null && _c !== void 0 ? _c : {};
const auditStoragePath = (_d = overides === null || overides === void 0 ? void 0 : overides.auditStoragePath) !== null && _d !== void 0 ? _d : "/tmp";
const auditEngine = (_e = overides === null || overides === void 0 ? void 0 : overides.auditEngine) !== null && _e !== void 0 ? _e : new gsis_audit_record_db_1.FileEngine(auditStoragePath);
const endpoint = (_a = overrides === null || overrides === void 0 ? void 0 : overrides.endpoint) !== null && _a !== void 0 ? _a : "";
const prod = (_b = overrides === null || overrides === void 0 ? void 0 : overrides.prod) !== null && _b !== void 0 ? _b : false;
const auditInit = (_c = overrides === null || overrides === void 0 ? void 0 : overrides.auditInit) !== null && _c !== void 0 ? _c : {};
const auditStoragePath = (_d = overrides === null || overrides === void 0 ? void 0 : overrides.auditStoragePath) !== null && _d !== void 0 ? _d : "/tmp";
const auditEngine = (_e = overrides === null || overrides === void 0 ? void 0 : overrides.auditEngine) !== null && _e !== void 0 ? _e : 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 = yield (0, gsis_audit_record_db_1.generateAuditRecord)(auditInit, auditEngine);
if (!auditRecord)
......
......@@ -32,7 +32,7 @@ export declare type errorRecord = {
* @param {string} auditInit - Audit record initializer to be used for the audit record produced
* @param {string} auditStoragePath - Path to the audit record storage
*/
export declare type Overides = {
export declare type overrides = {
endpoint?: string;
prod?: boolean;
auditInit?: AuditRecord;
......@@ -44,8 +44,8 @@ export declare type Overides = {
* @param afm string;
* @param user string;
* @param pass string;
* @param overides Overides;
* @param overrides overrides;
* @returns AuditRecord | errorRecord
*/
export declare const getIdentity: (afm: string, user: string, pass: string, overides?: Overides | undefined) => Promise<any>;
export declare const getIdentity: (afm: string, user: string, pass: string, overrides?: overrides | undefined) => Promise<any>;
export default getIdentity;
......@@ -6,15 +6,15 @@ import config from './config.json';
* @param afm string;
* @param user string;
* @param pass string;
* @param overides Overides;
* @param overrides overrides;
* @returns AuditRecord | errorRecord
*/
export const getIdentity = async (afm, user, pass, overides) => {
const endpoint = overides?.endpoint ?? "";
const prod = overides?.prod ?? false;
const auditInit = overides?.auditInit ?? {};
const auditStoragePath = overides?.auditStoragePath ?? "/tmp";
const auditEngine = overides?.auditEngine ?? new FileEngine(auditStoragePath);
export const getIdentity = async (afm, user, pass, overrides) => {
const endpoint = overrides?.endpoint ?? "";
const prod = overrides?.prod ?? false;
const auditInit = overrides?.auditInit ?? {};
const auditStoragePath = overrides?.auditStoragePath ?? "/tmp";
const auditEngine = overrides?.auditEngine ?? new FileEngine(auditStoragePath);
const wsdl = prod == true ? config.prod.wsdl : config.test.wsdl;
const auditRecord = await generateAuditRecord(auditInit, auditEngine);
if (!auditRecord)
......
......@@ -38,7 +38,7 @@ export type errorRecord = {
* @param {string} auditInit - Audit record initializer to be used for the audit record produced
* @param {string} auditStoragePath - Path to the audit record storage
*/
export type Overides = {
export type overrides = {
endpoint?:string;
prod?:boolean;
auditInit?: AuditRecord;
......@@ -53,15 +53,15 @@ export type Overides = {
* @param afm string;
* @param user string;
* @param pass string;
* @param overides Overides;
* @param overrides overrides;
* @returns AuditRecord | errorRecord
*/
export const getIdentity = async (afm:string, user:string, pass:string, overides?:Overides) => {
const endpoint = overides?.endpoint ?? "";
const prod = overides?.prod ?? false;
const auditInit = overides?.auditInit ?? {} as AuditRecord;
const auditStoragePath = overides?.auditStoragePath ?? "/tmp"
const auditEngine = overides?.auditEngine ?? new FileEngine(auditStoragePath);
export const getIdentity = async (afm:string, user:string, pass:string, overrides?:overrides) => {
const endpoint = overrides?.endpoint ?? "";
const prod = overrides?.prod ?? false;
const auditInit = overrides?.auditInit ?? {} as AuditRecord;
const auditStoragePath = overrides?.auditStoragePath ?? "/tmp"
const auditEngine = overrides?.auditEngine ?? new FileEngine(auditStoragePath);
const wsdl = prod==true? config.prod.wsdl : config.test.wsdl;
const auditRecord = await generateAuditRecord(auditInit, auditEngine);
if (!auditRecord) throw new Error('Audit record is not initialized');
......
......@@ -3,13 +3,13 @@ import config from './config.json';
import { PostgreSqlEngine } from '@digigov-oss/gsis-audit-record-db';
const test = async () => {
try {
const overides = {
const overrides = {
auditEngine: new PostgreSqlEngine('postgres://postgres:postgres@localhost:5432/postgres'),
auditInit: {
auditUnit: 'grnet.gr',
},
}
const Identity = await getIdentity("052704062", config.user, config.pass, overides);
const Identity = await getIdentity("052704062", config.user, config.pass, overrides);
return Identity;
} catch (error) {
console.log(error);
......
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