@payfit/audit-log 2.0.1 → 2.1.1
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/es/index.js +411 -0
- package/dist/es/index.js.map +1 -0
- package/dist/index.d.ts +11 -10
- package/dist/node/index.js +419 -0
- package/dist/node/index.js.map +1 -0
- package/package.json +38 -19
- package/.prettierrc +0 -5
- package/CHANGELOG.md +0 -13
- package/dist/index.js +0 -44
- package/dist/index.js.map +0 -1
- package/dist/transport/generated/api/default-api.d.ts +0 -74
- package/dist/transport/generated/api/default-api.js +0 -156
- package/dist/transport/generated/api/default-api.js.map +0 -1
- package/dist/transport/generated/api.d.ts +0 -12
- package/dist/transport/generated/api.js +0 -26
- package/dist/transport/generated/api.js.map +0 -1
- package/dist/transport/generated/base.d.ts +0 -55
- package/dist/transport/generated/base.js +0 -64
- package/dist/transport/generated/base.js.map +0 -1
- package/dist/transport/generated/configuration.d.ts +0 -63
- package/dist/transport/generated/configuration.js +0 -27
- package/dist/transport/generated/configuration.js.map +0 -1
- package/dist/transport/generated/index.d.ts +0 -13
- package/dist/transport/generated/index.js +0 -27
- package/dist/transport/generated/index.js.map +0 -1
- package/dist/transport/generated/model/index.d.ts +0 -1
- package/dist/transport/generated/model/index.js +0 -14
- package/dist/transport/generated/model/index.js.map +0 -1
- package/dist/transport/generated/model/inline-object.d.ts +0 -138
- package/dist/transport/generated/model/inline-object.js +0 -15
- package/dist/transport/generated/model/inline-object.js.map +0 -1
- package/dist/transport/implementation.d.ts +0 -9
- package/dist/transport/implementation.js +0 -38
- package/dist/transport/implementation.js.map +0 -1
- package/dist/transport/interface.d.ts +0 -25
- package/dist/transport/interface.js +0 -3
- package/dist/transport/interface.js.map +0 -1
- package/openapi-codegen-config.yml +0 -6
- package/openapitools.json +0 -6
- package/playground/index.ts +0 -37
- package/src/index.ts +0 -199
- package/src/transport/generated/.openapi-generator/VERSION +0 -1
- package/src/transport/generated/.openapi-generator-ignore +0 -23
- package/src/transport/generated/api/default-api.ts +0 -132
- package/src/transport/generated/api.ts +0 -17
- package/src/transport/generated/base.ts +0 -70
- package/src/transport/generated/configuration.ts +0 -75
- package/src/transport/generated/git_push.sh +0 -58
- package/src/transport/generated/index.ts +0 -16
- package/src/transport/generated/model/index.ts +0 -1
- package/src/transport/generated/model/inline-object.ts +0 -144
- package/src/transport/implementation.ts +0 -27
- package/src/transport/interface.ts +0 -28
- package/tsconfig.json +0 -25
- package/tslint.json +0 -12
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Audit Logs
|
|
3
|
-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
-
*
|
|
5
|
-
* The version of the OpenAPI document: 1.0.0
|
|
6
|
-
* Contact: damian.bursztyn@payfit.com
|
|
7
|
-
*
|
|
8
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
-
* https://openapi-generator.tech
|
|
10
|
-
* Do not edit the class manually.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @export
|
|
15
|
-
* @interface InlineObject
|
|
16
|
-
*/
|
|
17
|
-
export interface InlineObject {
|
|
18
|
-
/**
|
|
19
|
-
* Audit log event unique identifier
|
|
20
|
-
* @type {string}
|
|
21
|
-
* @memberof InlineObject
|
|
22
|
-
*/
|
|
23
|
-
id: string;
|
|
24
|
-
/**
|
|
25
|
-
* Audit log event country code
|
|
26
|
-
* @type {string}
|
|
27
|
-
* @memberof InlineObject
|
|
28
|
-
*/
|
|
29
|
-
countryCode?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Audit log event payload
|
|
32
|
-
* @type {object}
|
|
33
|
-
* @memberof InlineObject
|
|
34
|
-
*/
|
|
35
|
-
payload?: object;
|
|
36
|
-
/**
|
|
37
|
-
* id of the payfiter who performed the audit log action, if signed as.
|
|
38
|
-
* @type {string}
|
|
39
|
-
* @memberof InlineObject
|
|
40
|
-
*/
|
|
41
|
-
internalId?: string;
|
|
42
|
-
/**
|
|
43
|
-
* Tells whether the logged action has been made by the system
|
|
44
|
-
* @type {boolean}
|
|
45
|
-
* @memberof InlineObject
|
|
46
|
-
*/
|
|
47
|
-
isSystem?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Audit log event namespace (business related)
|
|
50
|
-
* @type {string}
|
|
51
|
-
* @memberof InlineObject
|
|
52
|
-
*/
|
|
53
|
-
namespace: string;
|
|
54
|
-
/**
|
|
55
|
-
* Audit log event namespace (technical related)
|
|
56
|
-
* @type {string}
|
|
57
|
-
* @memberof InlineObject
|
|
58
|
-
*/
|
|
59
|
-
service: string;
|
|
60
|
-
/**
|
|
61
|
-
* Audit log event type
|
|
62
|
-
* @type {string}
|
|
63
|
-
* @memberof InlineObject
|
|
64
|
-
*/
|
|
65
|
-
event: string;
|
|
66
|
-
/**
|
|
67
|
-
* Audit log target
|
|
68
|
-
* @type {string}
|
|
69
|
-
* @memberof InlineObject
|
|
70
|
-
*/
|
|
71
|
-
target: string;
|
|
72
|
-
/**
|
|
73
|
-
* Audit log event environment, only required when in todd context
|
|
74
|
-
* @type {string}
|
|
75
|
-
* @memberof InlineObject
|
|
76
|
-
*/
|
|
77
|
-
environment?: string;
|
|
78
|
-
/**
|
|
79
|
-
* holdingId of the account performing the event
|
|
80
|
-
* @type {string}
|
|
81
|
-
* @memberof InlineObject
|
|
82
|
-
*/
|
|
83
|
-
holdingId?: string;
|
|
84
|
-
/**
|
|
85
|
-
* companyId of the account performing the event
|
|
86
|
-
* @type {string}
|
|
87
|
-
* @memberof InlineObject
|
|
88
|
-
*/
|
|
89
|
-
companyId?: string;
|
|
90
|
-
/**
|
|
91
|
-
* employeeId of the account performing the event
|
|
92
|
-
* @type {string}
|
|
93
|
-
* @memberof InlineObject
|
|
94
|
-
*/
|
|
95
|
-
employeeId?: string;
|
|
96
|
-
/**
|
|
97
|
-
* individualId of the account performing the event
|
|
98
|
-
* @type {string}
|
|
99
|
-
* @memberof InlineObject
|
|
100
|
-
*/
|
|
101
|
-
individualId?: string;
|
|
102
|
-
/**
|
|
103
|
-
* roleId of the account performing the event
|
|
104
|
-
* @type {string}
|
|
105
|
-
* @memberof InlineObject
|
|
106
|
-
*/
|
|
107
|
-
roleId?: string;
|
|
108
|
-
/**
|
|
109
|
-
* userIp of the account performing the event
|
|
110
|
-
* @type {string}
|
|
111
|
-
* @memberof InlineObject
|
|
112
|
-
*/
|
|
113
|
-
userIp?: string;
|
|
114
|
-
/**
|
|
115
|
-
* specialRole of the account performing the event
|
|
116
|
-
* @type {string}
|
|
117
|
-
* @memberof InlineObject
|
|
118
|
-
*/
|
|
119
|
-
specialRole?: string;
|
|
120
|
-
/**
|
|
121
|
-
* email of the account performing the event
|
|
122
|
-
* @type {string}
|
|
123
|
-
* @memberof InlineObject
|
|
124
|
-
*/
|
|
125
|
-
email?: string;
|
|
126
|
-
/**
|
|
127
|
-
* Audit log event scope
|
|
128
|
-
* @type {object}
|
|
129
|
-
* @memberof InlineObject
|
|
130
|
-
*/
|
|
131
|
-
scope?: object;
|
|
132
|
-
/**
|
|
133
|
-
* Audit log event timestamp unix format
|
|
134
|
-
* @type {number}
|
|
135
|
-
* @memberof InlineObject
|
|
136
|
-
*/
|
|
137
|
-
timestamp: number;
|
|
138
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// tslint:disable
|
|
3
|
-
/**
|
|
4
|
-
* Audit Logs
|
|
5
|
-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
-
*
|
|
7
|
-
* The version of the OpenAPI document: 1.0.0
|
|
8
|
-
* Contact: damian.bursztyn@payfit.com
|
|
9
|
-
*
|
|
10
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
-
* https://openapi-generator.tech
|
|
12
|
-
* Do not edit the class manually.
|
|
13
|
-
*/
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
//# sourceMappingURL=inline-object.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inline-object.js","sourceRoot":"","sources":["../../../../src/transport/generated/model/inline-object.ts"],"names":[],"mappings":";AAAA,iBAAiB;AACjB;;;;;;;;;;GAUG"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { DefaultApi } from './generated';
|
|
2
|
-
import { InlineObject } from './generated/model';
|
|
3
|
-
import { IAuditLogTransport } from './interface';
|
|
4
|
-
export declare class Transport implements IAuditLogTransport {
|
|
5
|
-
protected apiUrl: string;
|
|
6
|
-
api: DefaultApi;
|
|
7
|
-
constructor(apiUrl: string);
|
|
8
|
-
create(auditLogData: InlineObject): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Transport = void 0;
|
|
13
|
-
const generated_1 = require("./generated");
|
|
14
|
-
class Transport {
|
|
15
|
-
constructor(apiUrl) {
|
|
16
|
-
this.apiUrl = apiUrl;
|
|
17
|
-
this.api = new generated_1.DefaultApi({
|
|
18
|
-
basePath: this.apiUrl,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
create(auditLogData) {
|
|
22
|
-
var _a;
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
try {
|
|
25
|
-
yield this.api.v1LogPost(auditLogData);
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
if (!err.isAxiosError) {
|
|
29
|
-
throw err;
|
|
30
|
-
}
|
|
31
|
-
const message = ((_a = err.response) === null || _a === void 0 ? void 0 : _a.data) || err.message;
|
|
32
|
-
throw new Error(message);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.Transport = Transport;
|
|
38
|
-
//# sourceMappingURL=implementation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../src/transport/implementation.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwC;AAKxC,MAAa,SAAS;IAGpB,YAAsB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAClC,IAAI,CAAC,GAAG,GAAG,IAAI,sBAAU,CAAC;YACxB,QAAQ,EAAE,IAAI,CAAC,MAAM;SACtB,CAAC,CAAA;IACJ,CAAC;IAEK,MAAM,CAAC,YAA0B;;;YACrC,IAAI;gBACF,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,YAAY,CAAC,CAAA;aACvC;YAAC,OAAO,GAAG,EAAE;gBACZ,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE;oBACrB,MAAM,GAAG,CAAA;iBACV;gBAED,MAAM,OAAO,GAAG,OAAA,GAAG,CAAC,QAAQ,0CAAE,IAAI,KAAI,GAAG,CAAC,OAAO,CAAA;gBACjD,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;aACzB;;KACF;CACF;AArBD,8BAqBC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export declare type IAuditLogCreationData = {
|
|
2
|
-
id: string;
|
|
3
|
-
timestamp: number;
|
|
4
|
-
environment: string;
|
|
5
|
-
service: string;
|
|
6
|
-
scope?: object;
|
|
7
|
-
countryCode?: string;
|
|
8
|
-
payload?: object;
|
|
9
|
-
internalId?: string;
|
|
10
|
-
isSystem?: boolean;
|
|
11
|
-
namespace: string;
|
|
12
|
-
event: string;
|
|
13
|
-
target: string;
|
|
14
|
-
holdingId?: string;
|
|
15
|
-
companyId?: string;
|
|
16
|
-
employeeId?: string;
|
|
17
|
-
individualId?: string;
|
|
18
|
-
roleId?: string;
|
|
19
|
-
userIp?: string;
|
|
20
|
-
specialRole?: string;
|
|
21
|
-
email?: string;
|
|
22
|
-
};
|
|
23
|
-
export interface IAuditLogTransport {
|
|
24
|
-
create: (data: IAuditLogCreationData) => Promise<void>;
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/transport/interface.ts"],"names":[],"mappings":""}
|
package/openapitools.json
DELETED
package/playground/index.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { AuditLogger } from '../src'
|
|
2
|
-
|
|
3
|
-
const logger = new AuditLogger({
|
|
4
|
-
apiUrl: 'http://localhost:8090',
|
|
5
|
-
environment: 't-hello-audit',
|
|
6
|
-
service: 'auth',
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
await logger.log({
|
|
11
|
-
event: 'update',
|
|
12
|
-
target: 'user_settings',
|
|
13
|
-
namespace: 'auth',
|
|
14
|
-
payload: {
|
|
15
|
-
isTest: true,
|
|
16
|
-
},
|
|
17
|
-
account: {
|
|
18
|
-
internalId: 'an internal id',
|
|
19
|
-
individualId: 'an individual id',
|
|
20
|
-
employeeId: 'an employee id',
|
|
21
|
-
holdingId: 'a holding id',
|
|
22
|
-
companyId: 'a company id',
|
|
23
|
-
roleId: 'a role id',
|
|
24
|
-
userIp: '127.0.0.1',
|
|
25
|
-
countryCode: 'FR',
|
|
26
|
-
email: 'truc@ok.fr',
|
|
27
|
-
},
|
|
28
|
-
scope: {
|
|
29
|
-
employeeId: 'an employee id',
|
|
30
|
-
companyId: 'a company id',
|
|
31
|
-
},
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
main().catch((err) => {
|
|
36
|
-
console.log('Error:', err)
|
|
37
|
-
})
|
package/src/index.ts
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { v4 as uuidV4 } from 'uuid'
|
|
2
|
-
import { IAuditLogTransport } from './transport/interface'
|
|
3
|
-
import { Transport } from './transport/implementation'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The allowed Namespaces for the AuditLog
|
|
7
|
-
*/
|
|
8
|
-
export type AuditNamespaces =
|
|
9
|
-
| 'employee'
|
|
10
|
-
| 'company'
|
|
11
|
-
| 'permissions'
|
|
12
|
-
| 'absence'
|
|
13
|
-
| 'expense'
|
|
14
|
-
| 'advancePayment'
|
|
15
|
-
| 'auth'
|
|
16
|
-
| 'billing'
|
|
17
|
-
| 'modules'
|
|
18
|
-
| 'integrations'
|
|
19
|
-
| 'partnerApi'
|
|
20
|
-
| 'donation'
|
|
21
|
-
| 'notificationSettings'
|
|
22
|
-
| 'people'
|
|
23
|
-
| 'subscriptions'
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The allowed targets for the AuditLog
|
|
27
|
-
*/
|
|
28
|
-
export type AuditTargets =
|
|
29
|
-
| 'reporting'
|
|
30
|
-
| 'employee'
|
|
31
|
-
| 'employee.settings'
|
|
32
|
-
| 'employee-request'
|
|
33
|
-
| 'company.billings'
|
|
34
|
-
| 'company.variables'
|
|
35
|
-
| 'company.settings'
|
|
36
|
-
| 'company.emails'
|
|
37
|
-
| 'company.addons'
|
|
38
|
-
| 'company.plans'
|
|
39
|
-
| 'user.role'
|
|
40
|
-
| 'user.account'
|
|
41
|
-
| 'user.primaryEmail'
|
|
42
|
-
| 'user.secondaryEmail'
|
|
43
|
-
| 'user.locale'
|
|
44
|
-
| 'user.notificationSettings'
|
|
45
|
-
| 'role'
|
|
46
|
-
| 'team'
|
|
47
|
-
| 'department'
|
|
48
|
-
| 'workflow'
|
|
49
|
-
| 'integration'
|
|
50
|
-
| 'apiAccess'
|
|
51
|
-
| 'individual'
|
|
52
|
-
| 'association'
|
|
53
|
-
| 'association.archived'
|
|
54
|
-
| 'donation'
|
|
55
|
-
| 'donation.amount'
|
|
56
|
-
| 'donation.auth.partner.portal'
|
|
57
|
-
| 'donation.company.onboarding'
|
|
58
|
-
| 'donation.taxReceipt'
|
|
59
|
-
| 'donationPayment.status'
|
|
60
|
-
| 'people.document.comments'
|
|
61
|
-
| 'people.document.notifications'
|
|
62
|
-
| 'people.document.reactions'
|
|
63
|
-
| 'people.document.status'
|
|
64
|
-
| 'people.document.answers'
|
|
65
|
-
| 'people.settings'
|
|
66
|
-
| 'people.relation'
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* The allowed Events for the AuditLog
|
|
70
|
-
*/
|
|
71
|
-
export type AuditEvents = 'create' | 'update' | 'delete' | 'view' | 'merge'
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Data to audit log.
|
|
75
|
-
*/
|
|
76
|
-
export interface IAuditLogData {
|
|
77
|
-
/**
|
|
78
|
-
* The data specific to the audit log.
|
|
79
|
-
* For example, if we add a bonus to an employee, it could contain the amount, the impacted employeeId, etc...
|
|
80
|
-
*/
|
|
81
|
-
payload?: object
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* The buisness domain impacted.
|
|
85
|
-
* e.g documents, authentication, ...
|
|
86
|
-
*/
|
|
87
|
-
namespace: AuditNamespaces
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* The name of the event.
|
|
91
|
-
* e.g. signIn, passwordUpdated, ...
|
|
92
|
-
*/
|
|
93
|
-
event: AuditEvents
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* The target of event.
|
|
97
|
-
* e.g. user.settings, employee.bonuses, ...
|
|
98
|
-
*/
|
|
99
|
-
target: AuditTargets
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* The data that describes who did perform the logged action.
|
|
103
|
-
*/
|
|
104
|
-
account: IAuditLogAuthData
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* The scope of the audit log
|
|
108
|
-
*/
|
|
109
|
-
scope: IAuditLogScope
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Data used to indentify who performed an action
|
|
114
|
-
*/
|
|
115
|
-
export type IAuditLogAuthData =
|
|
116
|
-
| {
|
|
117
|
-
/**
|
|
118
|
-
* The id of the payfiter that did the action if it has been made during a siginAs
|
|
119
|
-
*/
|
|
120
|
-
internalId?: string
|
|
121
|
-
|
|
122
|
-
// the "account" infos
|
|
123
|
-
holdingId?: string
|
|
124
|
-
companyId?: string
|
|
125
|
-
employeeId?: string
|
|
126
|
-
individualId?: string
|
|
127
|
-
roleId?: string
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
*
|
|
131
|
-
*/
|
|
132
|
-
countryCode?: string
|
|
133
|
-
/**
|
|
134
|
-
* The IP address of the user
|
|
135
|
-
*/
|
|
136
|
-
userIp?: string
|
|
137
|
-
/**
|
|
138
|
-
* The email address of the user
|
|
139
|
-
*/
|
|
140
|
-
email?: string
|
|
141
|
-
}
|
|
142
|
-
| {
|
|
143
|
-
/* Indicates that the action has been performed by the system */
|
|
144
|
-
isSystem: true
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Data used to "scope" the audit log.
|
|
149
|
-
* Might be useful to retrieve all actions performed in a holding, a company, or on an employee.
|
|
150
|
-
*/
|
|
151
|
-
export type IAuditLogScope =
|
|
152
|
-
| {
|
|
153
|
-
holdingId: string
|
|
154
|
-
}
|
|
155
|
-
| {
|
|
156
|
-
companyId: string
|
|
157
|
-
employeeId?: string
|
|
158
|
-
}
|
|
159
|
-
| {
|
|
160
|
-
individualId: string
|
|
161
|
-
}
|
|
162
|
-
| null
|
|
163
|
-
|
|
164
|
-
// warning: modifying this interface means probably make a breaking change to the SDK
|
|
165
|
-
export interface IAuditLogger {
|
|
166
|
-
log: (data: IAuditLogData) => Promise<void>
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export interface IAuditLoggerInitialization {
|
|
170
|
-
apiUrl: string
|
|
171
|
-
environment: string
|
|
172
|
-
service: string
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export class AuditLogger implements IAuditLogger {
|
|
176
|
-
private transport: IAuditLogTransport
|
|
177
|
-
|
|
178
|
-
constructor(protected params: IAuditLoggerInitialization) {
|
|
179
|
-
this.transport = new Transport(params.apiUrl)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
async log({ scope, account, ...data }: IAuditLogData) {
|
|
183
|
-
const uuid = uuidV4()
|
|
184
|
-
const { environment, service } = this.params
|
|
185
|
-
const timestamp = Math.floor(Date.now() / 1000)
|
|
186
|
-
|
|
187
|
-
const log = {
|
|
188
|
-
...data,
|
|
189
|
-
...account,
|
|
190
|
-
service,
|
|
191
|
-
id: uuid,
|
|
192
|
-
environment,
|
|
193
|
-
timestamp,
|
|
194
|
-
...(scope && { scope }),
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
await this.transport.create(log)
|
|
198
|
-
}
|
|
199
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
4.3.1
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# OpenAPI Generator Ignore
|
|
2
|
-
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
|
3
|
-
|
|
4
|
-
# Use this file to prevent files from being overwritten by the generator.
|
|
5
|
-
# The patterns follow closely to .gitignore or .dockerignore.
|
|
6
|
-
|
|
7
|
-
# As an example, the C# client generator defines ApiClient.cs.
|
|
8
|
-
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
|
9
|
-
#ApiClient.cs
|
|
10
|
-
|
|
11
|
-
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
12
|
-
#foo/*/qux
|
|
13
|
-
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
14
|
-
|
|
15
|
-
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
16
|
-
#foo/**/qux
|
|
17
|
-
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
18
|
-
|
|
19
|
-
# You can also negate patterns with an exclamation (!).
|
|
20
|
-
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
21
|
-
#docs/*.md
|
|
22
|
-
# Then explicitly reverse the ignore rule for a single file:
|
|
23
|
-
#!docs/README.md
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// tslint:disable
|
|
2
|
-
/**
|
|
3
|
-
* Audit Logs
|
|
4
|
-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
-
*
|
|
6
|
-
* The version of the OpenAPI document: 1.0.0
|
|
7
|
-
* Contact: damian.bursztyn@payfit.com
|
|
8
|
-
*
|
|
9
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
10
|
-
* https://openapi-generator.tech
|
|
11
|
-
* Do not edit the class manually.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import * as globalImportUrl from 'url';
|
|
16
|
-
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
|
|
17
|
-
import { Configuration } from '../configuration';
|
|
18
|
-
// Some imports not used depending on template conditions
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
|
|
21
|
-
// @ts-ignore
|
|
22
|
-
import { InlineObject } from '../model';
|
|
23
|
-
/**
|
|
24
|
-
* DefaultApi - axios parameter creator
|
|
25
|
-
* @export
|
|
26
|
-
*/
|
|
27
|
-
export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) {
|
|
28
|
-
return {
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
* @summary Creates Audit Log event
|
|
32
|
-
* @param {InlineObject} inlineObject
|
|
33
|
-
* @param {*} [options] Override http request option.
|
|
34
|
-
* @throws {RequiredError}
|
|
35
|
-
*/
|
|
36
|
-
v1LogPost: async (inlineObject: InlineObject, options: any = {}): Promise<RequestArgs> => {
|
|
37
|
-
// verify required parameter 'inlineObject' is not null or undefined
|
|
38
|
-
if (inlineObject === null || inlineObject === undefined) {
|
|
39
|
-
throw new RequiredError('inlineObject','Required parameter inlineObject was null or undefined when calling v1LogPost.');
|
|
40
|
-
}
|
|
41
|
-
const localVarPath = `/v1/log`;
|
|
42
|
-
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
|
|
43
|
-
let baseOptions;
|
|
44
|
-
if (configuration) {
|
|
45
|
-
baseOptions = configuration.baseOptions;
|
|
46
|
-
}
|
|
47
|
-
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
|
|
48
|
-
const localVarHeaderParameter = {} as any;
|
|
49
|
-
const localVarQueryParameter = {} as any;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
54
|
-
|
|
55
|
-
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
|
|
56
|
-
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
|
|
57
|
-
delete localVarUrlObj.search;
|
|
58
|
-
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
59
|
-
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
|
60
|
-
const needsSerialization = (typeof inlineObject !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
|
|
61
|
-
localVarRequestOptions.data = needsSerialization ? JSON.stringify(inlineObject !== undefined ? inlineObject : {}) : (inlineObject || "");
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
url: globalImportUrl.format(localVarUrlObj),
|
|
65
|
-
options: localVarRequestOptions,
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* DefaultApi - functional programming interface
|
|
73
|
-
* @export
|
|
74
|
-
*/
|
|
75
|
-
export const DefaultApiFp = function(configuration?: Configuration) {
|
|
76
|
-
return {
|
|
77
|
-
/**
|
|
78
|
-
*
|
|
79
|
-
* @summary Creates Audit Log event
|
|
80
|
-
* @param {InlineObject} inlineObject
|
|
81
|
-
* @param {*} [options] Override http request option.
|
|
82
|
-
* @throws {RequiredError}
|
|
83
|
-
*/
|
|
84
|
-
async v1LogPost(inlineObject: InlineObject, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
|
85
|
-
const localVarAxiosArgs = await DefaultApiAxiosParamCreator(configuration).v1LogPost(inlineObject, options);
|
|
86
|
-
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
|
87
|
-
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
|
88
|
-
return axios.request(axiosRequestArgs);
|
|
89
|
-
};
|
|
90
|
-
},
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* DefaultApi - factory interface
|
|
96
|
-
* @export
|
|
97
|
-
*/
|
|
98
|
-
export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
|
99
|
-
return {
|
|
100
|
-
/**
|
|
101
|
-
*
|
|
102
|
-
* @summary Creates Audit Log event
|
|
103
|
-
* @param {InlineObject} inlineObject
|
|
104
|
-
* @param {*} [options] Override http request option.
|
|
105
|
-
* @throws {RequiredError}
|
|
106
|
-
*/
|
|
107
|
-
v1LogPost(inlineObject: InlineObject, options?: any): AxiosPromise<void> {
|
|
108
|
-
return DefaultApiFp(configuration).v1LogPost(inlineObject, options).then((request) => request(axios, basePath));
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* DefaultApi - object-oriented interface
|
|
115
|
-
* @export
|
|
116
|
-
* @class DefaultApi
|
|
117
|
-
* @extends {BaseAPI}
|
|
118
|
-
*/
|
|
119
|
-
export class DefaultApi extends BaseAPI {
|
|
120
|
-
/**
|
|
121
|
-
*
|
|
122
|
-
* @summary Creates Audit Log event
|
|
123
|
-
* @param {InlineObject} inlineObject
|
|
124
|
-
* @param {*} [options] Override http request option.
|
|
125
|
-
* @throws {RequiredError}
|
|
126
|
-
* @memberof DefaultApi
|
|
127
|
-
*/
|
|
128
|
-
public v1LogPost(inlineObject: InlineObject, options?: any) {
|
|
129
|
-
return DefaultApiFp(this.configuration).v1LogPost(inlineObject, options).then((request) => request(this.axios, this.basePath));
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// tslint:disable
|
|
2
|
-
/**
|
|
3
|
-
* Audit Logs
|
|
4
|
-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
-
*
|
|
6
|
-
* The version of the OpenAPI document: 1.0.0
|
|
7
|
-
* Contact: damian.bursztyn@payfit.com
|
|
8
|
-
*
|
|
9
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
10
|
-
* https://openapi-generator.tech
|
|
11
|
-
* Do not edit the class manually.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export * from './api/default-api';
|
|
17
|
-
|