@payfit/audit-log 1.0.0 → 1.0.2

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.d.ts CHANGED
@@ -14,9 +14,14 @@ export interface IAuditLogData {
14
14
  namespace: string;
15
15
  /**
16
16
  * The name of the event.
17
- * e.g. signIn, passwordUpdated, bonusAdded, ...
17
+ * e.g. signIn, passwordUpdated, ...
18
18
  */
19
19
  event: string;
20
+ /**
21
+ * The target of event.
22
+ * e.g. user.settings, employee.bonuses, ...
23
+ */
24
+ target: string;
20
25
  /**
21
26
  * The data that describes who did perform the logged action.
22
27
  */
@@ -37,7 +42,7 @@ export declare type IAuditLogAuthData = {
37
42
  holdingId?: string;
38
43
  companyId?: string;
39
44
  employeeId?: string;
40
- individualId: string;
45
+ individualId?: string;
41
46
  roleId?: string;
42
47
  /**
43
48
  *
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,+BAAmC;AAEnC,+DAAsD;AA+FtD,MAAa,WAAW;IAGtB,YAAsB,MAAkC;QAAlC,WAAM,GAAN,MAAM,CAA4B;QACtD,IAAI,CAAC,SAAS,GAAG,IAAI,0BAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC/C,CAAC;IAEK,GAAG,CAAC,IAAmB;;YAC3B,MAAM,IAAI,GAAG,SAAM,EAAE,CAAA;YACrB,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;YAC5C,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;YAEtC,MAAM,GAAG,qBACJ,IAAI,IACP,OAAO,EACP,EAAE,EAAE,IAAI,EACR,WAAW;gBACX,SAAS,GACV,CAAA;YAED,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAClC,CAAC;KAAA;CACF;AAtBD,kCAsBC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,+BAAmC;AAEnC,+DAAsD;AAqGtD,MAAa,WAAW;IAGtB,YAAsB,MAAkC;QAAlC,WAAM,GAAN,MAAM,CAA4B;QACtD,IAAI,CAAC,SAAS,GAAG,IAAI,0BAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC/C,CAAC;IAEK,GAAG,CAAC,IAAmB;;YAC3B,MAAM,IAAI,GAAG,SAAM,EAAE,CAAA;YACrB,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;YAC5C,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;YAEtC,MAAM,GAAG,qBACJ,IAAI,IACP,OAAO,EACP,EAAE,EAAE,IAAI,EACR,WAAW;gBACX,SAAS,GACV,CAAA;YAED,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAClC,CAAC;KAAA;CACF;AAtBD,kCAsBC"}
@@ -62,7 +62,13 @@ export interface InlineObject {
62
62
  * @type {string}
63
63
  * @memberof InlineObject
64
64
  */
65
- event?: string;
65
+ event: string;
66
+ /**
67
+ * Audit log target
68
+ * @type {string}
69
+ * @memberof InlineObject
70
+ */
71
+ target: string;
66
72
  /**
67
73
  * Audit log event environment
68
74
  * @type {string}
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.2",
4
4
  "description": "Library to handle audit logs at Payfit",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -8,14 +8,22 @@ const logger = new AuditLogger({
8
8
 
9
9
  async function main() {
10
10
  await logger.log({
11
- event: 'signin',
11
+ event: 'update',
12
+ target: 'user_settings',
12
13
  namespace: 'auth',
13
14
  payload: {
14
15
  isTest: true,
15
16
  },
16
17
  account: {
17
18
  internalId: 'an internal id',
18
- individualId: 'an invidiaul 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'
19
27
  },
20
28
  scope: {
21
29
  employeeId: 'an employee id',
package/src/index.ts CHANGED
@@ -20,10 +20,16 @@ export interface IAuditLogData {
20
20
 
21
21
  /**
22
22
  * The name of the event.
23
- * e.g. signIn, passwordUpdated, bonusAdded, ...
23
+ * e.g. signIn, passwordUpdated, ...
24
24
  */
25
25
  event: string
26
26
 
27
+ /**
28
+ * The target of event.
29
+ * e.g. user.settings, employee.bonuses, ...
30
+ */
31
+ target: string
32
+
27
33
  /**
28
34
  * The data that describes who did perform the logged action.
29
35
  */
@@ -49,7 +55,7 @@ export type IAuditLogAuthData =
49
55
  holdingId?: string
50
56
  companyId?: string
51
57
  employeeId?: string
52
- individualId: string
58
+ individualId?: string
53
59
  roleId?: string
54
60
 
55
61
  /**
@@ -66,7 +66,13 @@ export interface InlineObject {
66
66
  * @type {string}
67
67
  * @memberof InlineObject
68
68
  */
69
- event?: string;
69
+ event: string;
70
+ /**
71
+ * Audit log target
72
+ * @type {string}
73
+ * @memberof InlineObject
74
+ */
75
+ target: string;
70
76
  /**
71
77
  * Audit log event environment
72
78
  * @type {string}