@payfit/audit-log 1.0.0-alpha1 → 1.0.0-alpha3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js.map +1 -1
- package/dist/transport/implementation.js +2 -22
- package/dist/transport/implementation.js.map +1 -1
- package/package.json +2 -1
- package/src/index.ts +3 -4
- package/src/transport/implementation.ts +5 -34
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
- package/src/types.ts +0 -11
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+BAAmC;AACnC,sEAAuD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+BAAmC;AACnC,sEAAuD;AAoBvD,SAAsB,QAAQ,CAAC,MAAoB;;QACjD,MAAM,IAAI,GAAG,SAAM,EAAE,CAAA;QACrB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAA;QAC3C,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;QAEtC,MAAM,GAAG,qBACJ,MAAM,IACT,EAAE,EAAE,IAAI,EACR,WAAW;YACX,SAAS,GACV,CAAA;QAED,MAAM,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IAC/B,CAAC;CAAA;AAbD,4BAaC"}
|
|
@@ -20,33 +20,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
const generated_1 = require("./generated");
|
|
23
|
-
const model_1 = require("./generated/model");
|
|
24
23
|
const api = new generated_1.DefaultApi({
|
|
25
|
-
basePath:
|
|
24
|
+
basePath: process.env.AUDIT_LOG_API_URL,
|
|
26
25
|
});
|
|
27
|
-
const stringToCountry = {
|
|
28
|
-
FR: model_1.CountryCodeEnum.FR,
|
|
29
|
-
DE: model_1.CountryCodeEnum.DE,
|
|
30
|
-
GB: model_1.CountryCodeEnum.GB,
|
|
31
|
-
ES: model_1.CountryCodeEnum.ES,
|
|
32
|
-
IT: model_1.CountryCodeEnum.IT,
|
|
33
|
-
};
|
|
34
|
-
function serializeCountry(country) {
|
|
35
|
-
return stringToCountry[country];
|
|
36
|
-
}
|
|
37
|
-
function serializeNamespace(namespace) {
|
|
38
|
-
return namespace;
|
|
39
|
-
}
|
|
40
|
-
function serializeService(service) {
|
|
41
|
-
return service;
|
|
42
|
-
}
|
|
43
|
-
function serializeEvent(event) {
|
|
44
|
-
return event;
|
|
45
|
-
}
|
|
46
26
|
function auditLog(auditLogData) {
|
|
47
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
28
|
const { countryCode, namespace, service, event, payload } = auditLogData, data = __rest(auditLogData, ["countryCode", "namespace", "service", "event", "payload"]);
|
|
49
|
-
const dataToSend = Object.assign({}, data, { countryCode:
|
|
29
|
+
const dataToSend = Object.assign({}, data, { countryCode: countryCode, namespace: namespace, service: service, event: event, payload });
|
|
50
30
|
return api.v1LogPost(dataToSend);
|
|
51
31
|
});
|
|
52
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../src/transport/implementation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../src/transport/implementation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAAwC;AASxC,MAAM,GAAG,GAAG,IAAI,sBAAU,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;CACxC,CAAC,CAAA;AAEF,SAAsB,QAAQ,CAAC,YAAkC;;QAC/D,MAAM,EACJ,WAAW,EACX,SAAS,EACT,OAAO,EACP,KAAK,EACL,OAAO,KAEL,YAAY,EADd,wFACc,CAAA;QAEhB,MAAM,UAAU,qBACX,IAAI,IACP,WAAW,EAAE,WAA8B,EAC3C,SAAS,EAAE,SAA0B,EACrC,OAAO,EAAE,OAAsB,EAC/B,KAAK,EAAE,KAAkB,EACzB,OAAO,GACR,CAAA;QAED,OAAO,GAAG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;IAClC,CAAC;CAAA;AApBD,4BAoBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payfit/audit-log",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-alpha3",
|
|
4
4
|
"description": "Library to handle audit logs at Payfit",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"build": "rimraf dist && tsc",
|
|
9
9
|
"prepublish": "npm run build"
|
|
10
10
|
},
|
|
11
|
+
"types": "./src/index.ts",
|
|
11
12
|
"author": "",
|
|
12
13
|
"license": "ISC",
|
|
13
14
|
"dependencies": {
|
package/src/index.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { v4 as uuidV4 } from 'uuid'
|
|
2
2
|
import * as transport from './transport/implementation'
|
|
3
|
-
import { Country, Event, ServiceName } from './types'
|
|
4
3
|
|
|
5
4
|
export interface AuditLogData {
|
|
6
|
-
countryCode:
|
|
5
|
+
countryCode: string
|
|
7
6
|
payload?: object
|
|
8
7
|
isImpersonated?: boolean
|
|
9
8
|
isSystem?: boolean
|
|
10
9
|
namespace: string
|
|
11
|
-
service:
|
|
12
|
-
event:
|
|
10
|
+
service: string
|
|
11
|
+
event: string
|
|
13
12
|
holdingId?: string
|
|
14
13
|
companyId?: string
|
|
15
14
|
employeeId?: string
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { v4 as uuidV4 } from 'uuid'
|
|
2
|
-
import { invert } from 'lodash'
|
|
3
|
-
|
|
4
1
|
import { DefaultApi } from './generated'
|
|
5
2
|
import {
|
|
6
3
|
CountryCodeEnum,
|
|
@@ -9,37 +6,11 @@ import {
|
|
|
9
6
|
ServiceEnum,
|
|
10
7
|
} from './generated/model'
|
|
11
8
|
import { AuditLogCreationData } from './interface'
|
|
12
|
-
import { ServiceName, Event } from '../types'
|
|
13
9
|
|
|
14
10
|
const api = new DefaultApi({
|
|
15
|
-
basePath:
|
|
11
|
+
basePath: process.env.AUDIT_LOG_API_URL,
|
|
16
12
|
})
|
|
17
13
|
|
|
18
|
-
const stringToCountry = {
|
|
19
|
-
FR: CountryCodeEnum.FR,
|
|
20
|
-
DE: CountryCodeEnum.DE,
|
|
21
|
-
GB: CountryCodeEnum.GB,
|
|
22
|
-
ES: CountryCodeEnum.ES,
|
|
23
|
-
IT: CountryCodeEnum.IT,
|
|
24
|
-
}
|
|
25
|
-
function serializeCountry(
|
|
26
|
-
country: keyof typeof stringToCountry
|
|
27
|
-
): CountryCodeEnum {
|
|
28
|
-
return stringToCountry[country]
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function serializeNamespace(namespace: string): NamespaceEnum {
|
|
32
|
-
return namespace as any
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function serializeService(service: ServiceName): ServiceEnum {
|
|
36
|
-
return service as any
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function serializeEvent(event: Event): EventEnum {
|
|
40
|
-
return event as any
|
|
41
|
-
}
|
|
42
|
-
|
|
43
14
|
export async function auditLog(auditLogData: AuditLogCreationData) {
|
|
44
15
|
const {
|
|
45
16
|
countryCode,
|
|
@@ -52,10 +23,10 @@ export async function auditLog(auditLogData: AuditLogCreationData) {
|
|
|
52
23
|
|
|
53
24
|
const dataToSend = {
|
|
54
25
|
...data,
|
|
55
|
-
countryCode:
|
|
56
|
-
namespace:
|
|
57
|
-
service:
|
|
58
|
-
event:
|
|
26
|
+
countryCode: countryCode as CountryCodeEnum,
|
|
27
|
+
namespace: namespace as NamespaceEnum,
|
|
28
|
+
service: service as ServiceEnum,
|
|
29
|
+
event: event as EventEnum,
|
|
59
30
|
payload,
|
|
60
31
|
}
|
|
61
32
|
|
package/dist/types.js
DELETED
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/src/types.ts
DELETED