@payfit/audit-log 1.0.0-alpha6 → 1.0.0-alpha7

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.
@@ -29,8 +29,9 @@ class Transport {
29
29
  }
30
30
  create(auditLogData) {
31
31
  return __awaiter(this, void 0, void 0, function* () {
32
- const { payload } = auditLogData, data = __rest(auditLogData, ["payload"]);
33
- const dataToSend = Object.assign({}, data, { payload });
32
+ const { account } = auditLogData, logDataWithoutAccount = __rest(auditLogData, ["account"]);
33
+ const dataToSend = Object.assign({}, logDataWithoutAccount, account);
34
+ console.log(dataToSend);
34
35
  yield this.api.v1LogPost(dataToSend);
35
36
  });
36
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../src/transport/implementation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAAwC;AAGxC,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,YAAmC;;YAC9C,MAAM,EAAE,OAAO,KAAc,YAAY,EAAxB,wCAAwB,CAAA;YAEzC,MAAM,UAAU,qBACX,IAAI,IACP,OAAO,GACR,CAAA;YAED,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;QACtC,CAAC;KAAA;CACF;AAnBD,8BAmBC"}
1
+ {"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../src/transport/implementation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,2CAAwC;AAGxC,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,YAAmC;;YAC9C,MAAM,EAAE,OAAO,KAA+B,YAAY,EAAzC,yDAAyC,CAAA;YAE1D,MAAM,UAAU,qBACX,qBAAqB,EACrB,OAAO,CACX,CAAA;YAED,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;YAEvB,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;QACtC,CAAC;KAAA;CACF;AArBD,8BAqBC"}
@@ -2,6 +2,7 @@ import { IAuditLogData } from '..';
2
2
  export declare type IAuditLogCreationData = IAuditLogData & {
3
3
  id: string;
4
4
  timestamp: number;
5
+ environment: string;
5
6
  };
6
7
  export interface IAuditLogTransport {
7
8
  create: (data: IAuditLogCreationData) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payfit/audit-log",
3
- "version": "1.0.0-alpha6",
3
+ "version": "1.0.0-alpha7",
4
4
  "description": "Library to handle audit logs at Payfit",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -7,13 +7,16 @@ const logger = new AuditLogger({
7
7
 
8
8
  async function main() {
9
9
  await logger.log({
10
- countryCode: 'fr',
11
10
  event: 'signin',
12
11
  namespace: 'auth',
13
12
  service: 'auth',
14
13
  payload: {
15
14
  isTest: true,
16
15
  },
16
+ account: {
17
+ isSystem: true,
18
+ },
19
+ scope: null,
17
20
  })
18
21
  }
19
22
 
package/src/index.ts CHANGED
@@ -77,7 +77,7 @@ export type IAuditLogAuthData =
77
77
  }
78
78
 
79
79
  /**
80
- * Data used to "scope" the audit log.
80
+ * Data used to "scope" the audit log.
81
81
  * Might be useful to retrieve all actions performed in a holding, a company, or on an employee.
82
82
  */
83
83
  export type IAuditLogScope =
@@ -11,13 +11,15 @@ export class Transport implements IAuditLogTransport {
11
11
  }
12
12
 
13
13
  async create(auditLogData: IAuditLogCreationData) {
14
- const { payload, ...data } = auditLogData
14
+ const { account, ...logDataWithoutAccount } = auditLogData
15
15
 
16
16
  const dataToSend = {
17
- ...data,
18
- payload,
17
+ ...logDataWithoutAccount,
18
+ ...account,
19
19
  }
20
20
 
21
+ console.log(dataToSend)
22
+
21
23
  await this.api.v1LogPost(dataToSend)
22
24
  }
23
25
  }
@@ -3,6 +3,7 @@ import { IAuditLogData } from '..'
3
3
  export type IAuditLogCreationData = IAuditLogData & {
4
4
  id: string
5
5
  timestamp: number
6
+ environment: string
6
7
  }
7
8
 
8
9
  export interface IAuditLogTransport {