@payfit/audit-log 1.0.4 → 1.0.6

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.
Files changed (31) hide show
  1. package/CHANGELOG.md +7 -3
  2. package/README.md +8 -7
  3. package/dist/index.js +2 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/transport/generated/api/default-api.d.ts +4 -4
  6. package/dist/transport/generated/api/default-api.js +42 -17
  7. package/dist/transport/generated/api/default-api.js.map +1 -1
  8. package/dist/transport/generated/api.js +11 -4
  9. package/dist/transport/generated/api.js.map +1 -1
  10. package/dist/transport/generated/base.js +2 -1
  11. package/dist/transport/generated/base.js.map +1 -1
  12. package/dist/transport/generated/configuration.d.ts +2 -2
  13. package/dist/transport/generated/configuration.js +1 -0
  14. package/dist/transport/generated/configuration.js.map +1 -1
  15. package/dist/transport/generated/index.js +12 -5
  16. package/dist/transport/generated/index.js.map +1 -1
  17. package/dist/transport/generated/model/index.js +11 -0
  18. package/dist/transport/generated/model/index.js.map +1 -1
  19. package/dist/transport/generated/model/inline-object.d.ts +7 -1
  20. package/dist/transport/implementation.js +2 -1
  21. package/dist/transport/implementation.js.map +1 -1
  22. package/openapitools.json +6 -0
  23. package/package.json +17 -14
  24. package/playground/index.ts +1 -1
  25. package/src/index.ts +1 -1
  26. package/src/transport/generated/.openapi-generator/VERSION +1 -1
  27. package/src/transport/generated/api/default-api.ts +12 -11
  28. package/src/transport/generated/base.ts +1 -1
  29. package/src/transport/generated/configuration.ts +2 -2
  30. package/src/transport/generated/model/inline-object.ts +7 -1
  31. package/src/transport/implementation.ts +2 -2
package/CHANGELOG.md CHANGED
@@ -1,8 +1,12 @@
1
+ ## 1.0.5 (2020/06/03)
2
+
3
+ - Fix an error with audit log timestamp format (#37)
4
+
1
5
  ## 1.0.4 (2020/04/02)
2
6
 
3
- * Better error handling (#18)
4
- * Use TS 3.7 (#18)
5
- * Add individualId to scope (#18)
7
+ - Better error handling (#18)
8
+ - Use TS 3.7 (#18)
9
+ - Add individualId to scope (#18)
6
10
 
7
11
  ## 1.0.3 (2020/04/01)
8
12
 
package/README.md CHANGED
@@ -53,10 +53,10 @@ In order to keep synced with the actual API, the API calls from the SDK are auto
53
53
  To build it, simply run
54
54
 
55
55
  ```sh
56
- make build-sdk
56
+ npm run build
57
57
  ```
58
58
 
59
- from the root folder of this repository (where the `Makefile` is located).
59
+ from the sdk folder (where the `package.json` is located).
60
60
 
61
61
  ### Testing
62
62
 
@@ -64,28 +64,29 @@ For now, no unit tests have been written, but it should arrive soon !
64
64
 
65
65
  ### Playing around with he SDK
66
66
 
67
- Could it be for testing some changes you made, or just to discover how to use the SDK, there is a [playground](./playground) at your disposal.
67
+ Could it be for testing some changes you made, or just to discover how to use the SDK, there is a [playground](./playground) at your disposal.
68
68
 
69
69
  It uses the current code in the repository, not the published one, so you don't have to `npm publish` or `npm link` to make it work 🙂
70
70
 
71
71
  To run it, simply run from the `sdk` folder:
72
+
72
73
  ```sh
73
74
  npm run start:playground
74
75
  ```
75
76
 
76
77
  ### Publishing
77
78
 
78
- For now, there is no automated publishing from CI, so you have to publish it manually.
79
+ For now, there is no automated publishing from CI, so you have to publish it manually.
80
+
81
+ To do so, simply bump the `version` field in the `package.json` file, and run
79
82
 
80
- To do so, simply bump the `version` field in the `package.json` file, and run
81
83
  ```
82
84
  npm publish
83
85
  ```
84
86
 
85
-
86
87
  ## Code organisation
87
88
 
88
89
  The code is mainly split into 2 parts:
90
+
89
91
  - The transport part, whose only goal is to tell how to communicate with the API, i.e it abstracts the communication layer.
90
92
  - The logic part, which tells how to build an audit log.
91
-
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  return t;
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.AuditLogger = void 0;
23
24
  const uuid_1 = require("uuid");
24
25
  const implementation_1 = require("./transport/implementation");
25
26
  class AuditLogger {
@@ -32,7 +33,7 @@ class AuditLogger {
32
33
  return __awaiter(this, void 0, void 0, function* () {
33
34
  const uuid = uuid_1.v4();
34
35
  const { environment, service } = this.params;
35
- const timestamp = new Date().getTime();
36
+ const timestamp = Math.floor(Date.now() / 1000);
36
37
  const log = Object.assign(Object.assign(Object.assign(Object.assign({}, data), account), { service, id: uuid, environment,
37
38
  timestamp }), (scope && { scope }));
38
39
  yield this.transport.create(log);
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;AAwGtD,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,EAA0C;YAA1C,EAAE,KAAK,EAAE,OAAO,OAA0B,EAAxB,uCAAO;;YACjC,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,+DACJ,IAAI,GACJ,OAAO,KACV,OAAO,EACP,EAAE,EAAE,IAAI,EACR,WAAW;gBACX,SAAS,KACN,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC,CACxB,CAAA;YAED,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;;KACjC;CACF;AAxBD,kCAwBC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAmC;AAEnC,+DAAsD;AAwGtD,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,EAA0C;YAA1C,EAAE,KAAK,EAAE,OAAO,OAA0B,EAArB,IAAI,cAAzB,oBAA2B,CAAF;;YACjC,MAAM,IAAI,GAAG,SAAM,EAAE,CAAA;YACrB,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;YAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;YAE/C,MAAM,GAAG,+DACJ,IAAI,GACJ,OAAO,KACV,OAAO,EACP,EAAE,EAAE,IAAI,EACR,WAAW;gBACX,SAAS,KACN,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC,CACxB,CAAA;YAED,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;;KACjC;CACF;AAxBD,kCAwBC"}
@@ -25,7 +25,7 @@ export declare const DefaultApiAxiosParamCreator: (configuration?: Configuration
25
25
  * @param {*} [options] Override http request option.
26
26
  * @throws {RequiredError}
27
27
  */
28
- v1LogPost(inlineObject: InlineObject, options?: any): RequestArgs;
28
+ logPost: (inlineObject: InlineObject, options?: any) => Promise<RequestArgs>;
29
29
  };
30
30
  /**
31
31
  * DefaultApi - functional programming interface
@@ -39,7 +39,7 @@ export declare const DefaultApiFp: (configuration?: Configuration | undefined) =
39
39
  * @param {*} [options] Override http request option.
40
40
  * @throws {RequiredError}
41
41
  */
42
- v1LogPost(inlineObject: InlineObject, options?: any): (axios?: AxiosInstance | undefined, basePath?: string | undefined) => AxiosPromise<void>;
42
+ logPost(inlineObject: InlineObject, options?: any): Promise<(axios?: AxiosInstance | undefined, basePath?: string | undefined) => AxiosPromise<void>>;
43
43
  };
44
44
  /**
45
45
  * DefaultApi - factory interface
@@ -53,7 +53,7 @@ export declare const DefaultApiFactory: (configuration?: Configuration | undefin
53
53
  * @param {*} [options] Override http request option.
54
54
  * @throws {RequiredError}
55
55
  */
56
- v1LogPost(inlineObject: InlineObject, options?: any): AxiosPromise<void>;
56
+ logPost(inlineObject: InlineObject, options?: any): AxiosPromise<void>;
57
57
  };
58
58
  /**
59
59
  * DefaultApi - object-oriented interface
@@ -70,5 +70,5 @@ export declare class DefaultApi extends BaseAPI {
70
70
  * @throws {RequiredError}
71
71
  * @memberof DefaultApi
72
72
  */
73
- v1LogPost(inlineObject: InlineObject, options?: any): AxiosPromise<void>;
73
+ logPost(inlineObject: InlineObject, options?: any): Promise<import("axios").AxiosResponse<void>>;
74
74
  }
@@ -11,17 +11,39 @@
11
11
  * https://openapi-generator.tech
12
12
  * Do not edit the class manually.
13
13
  */
14
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
17
+ }) : (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ o[k2] = m[k];
20
+ }));
21
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
23
+ }) : function(o, v) {
24
+ o["default"] = v;
25
+ });
14
26
  var __importStar = (this && this.__importStar) || function (mod) {
15
27
  if (mod && mod.__esModule) return mod;
16
28
  var result = {};
17
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
18
- result["default"] = mod;
29
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
30
+ __setModuleDefault(result, mod);
19
31
  return result;
20
32
  };
33
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
34
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
35
+ return new (P || (P = Promise))(function (resolve, reject) {
36
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
37
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
38
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
39
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
40
+ });
41
+ };
21
42
  var __importDefault = (this && this.__importDefault) || function (mod) {
22
43
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
44
  };
24
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.DefaultApi = exports.DefaultApiFactory = exports.DefaultApiFp = exports.DefaultApiAxiosParamCreator = void 0;
25
47
  const globalImportUrl = __importStar(require("url"));
26
48
  const axios_1 = __importDefault(require("axios"));
27
49
  // Some imports not used depending on template conditions
@@ -40,12 +62,12 @@ exports.DefaultApiAxiosParamCreator = function (configuration) {
40
62
  * @param {*} [options] Override http request option.
41
63
  * @throws {RequiredError}
42
64
  */
43
- v1LogPost(inlineObject, options = {}) {
65
+ logPost: (inlineObject, options = {}) => __awaiter(this, void 0, void 0, function* () {
44
66
  // verify required parameter 'inlineObject' is not null or undefined
45
67
  if (inlineObject === null || inlineObject === undefined) {
46
- throw new base_1.RequiredError('inlineObject', 'Required parameter inlineObject was null or undefined when calling v1LogPost.');
68
+ throw new base_1.RequiredError('inlineObject', 'Required parameter inlineObject was null or undefined when calling logPost.');
47
69
  }
48
- const localVarPath = `/v1/log`;
70
+ const localVarPath = `/log`;
49
71
  const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
50
72
  let baseOptions;
51
73
  if (configuration) {
@@ -58,14 +80,15 @@ exports.DefaultApiAxiosParamCreator = function (configuration) {
58
80
  localVarUrlObj.query = Object.assign(Object.assign(Object.assign({}, localVarUrlObj.query), localVarQueryParameter), options.query);
59
81
  // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
60
82
  delete localVarUrlObj.search;
61
- localVarRequestOptions.headers = Object.assign(Object.assign({}, localVarHeaderParameter), options.headers);
83
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
84
+ localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
62
85
  const needsSerialization = (typeof inlineObject !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
63
86
  localVarRequestOptions.data = needsSerialization ? JSON.stringify(inlineObject !== undefined ? inlineObject : {}) : (inlineObject || "");
64
87
  return {
65
88
  url: globalImportUrl.format(localVarUrlObj),
66
89
  options: localVarRequestOptions,
67
90
  };
68
- },
91
+ }),
69
92
  };
70
93
  };
71
94
  /**
@@ -81,12 +104,14 @@ exports.DefaultApiFp = function (configuration) {
81
104
  * @param {*} [options] Override http request option.
82
105
  * @throws {RequiredError}
83
106
  */
84
- v1LogPost(inlineObject, options) {
85
- const localVarAxiosArgs = exports.DefaultApiAxiosParamCreator(configuration).v1LogPost(inlineObject, options);
86
- return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
87
- const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
88
- return axios.request(axiosRequestArgs);
89
- };
107
+ logPost(inlineObject, options) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ const localVarAxiosArgs = yield exports.DefaultApiAxiosParamCreator(configuration).logPost(inlineObject, options);
110
+ return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
111
+ const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
112
+ return axios.request(axiosRequestArgs);
113
+ };
114
+ });
90
115
  },
91
116
  };
92
117
  };
@@ -103,8 +128,8 @@ exports.DefaultApiFactory = function (configuration, basePath, axios) {
103
128
  * @param {*} [options] Override http request option.
104
129
  * @throws {RequiredError}
105
130
  */
106
- v1LogPost(inlineObject, options) {
107
- return exports.DefaultApiFp(configuration).v1LogPost(inlineObject, options)(axios, basePath);
131
+ logPost(inlineObject, options) {
132
+ return exports.DefaultApiFp(configuration).logPost(inlineObject, options).then((request) => request(axios, basePath));
108
133
  },
109
134
  };
110
135
  };
@@ -123,8 +148,8 @@ class DefaultApi extends base_1.BaseAPI {
123
148
  * @throws {RequiredError}
124
149
  * @memberof DefaultApi
125
150
  */
126
- v1LogPost(inlineObject, options) {
127
- return exports.DefaultApiFp(this.configuration).v1LogPost(inlineObject, options)(this.axios, this.basePath);
151
+ logPost(inlineObject, options) {
152
+ return exports.DefaultApiFp(this.configuration).logPost(inlineObject, options).then((request) => request(this.axios, this.basePath));
128
153
  }
129
154
  }
130
155
  exports.DefaultApi = DefaultApi;
@@ -1 +1 @@
1
- {"version":3,"file":"default-api.js","sourceRoot":"","sources":["../../../../src/transport/generated/api/default-api.ts"],"names":[],"mappings":";AAAA,iBAAiB;AACjB;;;;;;;;;;GAUG;;;;;;;;;;;;AAGH,qDAAuC;AACvC,kDAAiE;AAEjE,yDAAyD;AACzD,aAAa;AACb,kCAA6F;AAG7F;;;GAGG;AACU,QAAA,2BAA2B,GAAG,UAAU,aAA6B;IAC9E,OAAO;QACH;;;;;;WAMG;QACH,SAAS,CAAC,YAA0B,EAAE,UAAe,EAAE;YACnD,oEAAoE;YACpE,IAAI,YAAY,KAAK,IAAI,IAAI,YAAY,KAAK,SAAS,EAAE;gBACrD,MAAM,IAAI,oBAAa,CAAC,cAAc,EAAC,+EAA+E,CAAC,CAAC;aAC3H;YACD,MAAM,YAAY,GAAG,SAAS,CAAC;YAC/B,MAAM,cAAc,GAAG,eAAe,CAAC,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;YACjE,IAAI,WAAW,CAAC;YAChB,IAAI,aAAa,EAAE;gBACf,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC;aAC3C;YACD,MAAM,sBAAsB,iCAAK,MAAM,EAAE,MAAM,IAAK,WAAW,GAAK,OAAO,CAAC,CAAC;YAC7E,MAAM,uB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gBAC/F,OAAO,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;YAC3C,CAAC,CAAC;QACN,CAAC;KACJ,CAAA;AACL,CAAC,CAAC;AAEF;;;GAGG;AACU,QAAA,iBAAiB,GAAG,UAAU,aAA6B,EAAE,QAAiB,EAAE,KAAqB;IAC9G,OAAO;QACH;;;;;;WAMG;QACH,SAAS,CAAC,YAA0B,EAAE,OAAa;YAC/C,OAAO,oBAAY,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACzF,CAAC;KACJ,CAAC;AACN,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAa,UAAW,SAAQ,cAAO;IACnC;;;;;;;OAOG;IACI,SAAS,CAAC,YAA0B,EAAE,OAAa;QACtD,OAAO,oBAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxG,CAAC;CAEJ;AAbD,gCAaC"}
1
+ {"version":3,"file":"default-api.js","sourceRoot":"","sources":["../../../../src/transport/generated/api/default-api.ts"],"names":[],"mappings":";AAAA,iBAAiB;AACjB;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,qDAAuC;AACvC,kDAAiE;AAEjE,yDAAyD;AACzD,aAAa;AACb,kCAA6F;AAG7F;;;GAGG;AACU,QAAA,2BAA2B,GAAG,UAAU,aAA6B;IAC9E,OAAO;QACH;;;;;;WAMG;QACH,OAAO,EAAE,CAAO,YAA0B,EAAE,UAAe,EAAE,EAAwB,EAAE;YACnF,oEAAoE;YACpE,IAAI,YAAY,KAAK,IAAI,IAAI,YAAY,KAAK,SAAS,EAAE;gBACrD,MAAM,IAAI,oBAAa,CAAC,cAAc,EAAC,6EAA6E,CAAC,CAAC;aACzH;YAC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I,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjI,CAAC;CAEJ;AAbD,gCAaC"}
@@ -11,9 +11,16 @@
11
11
  * https://openapi-generator.tech
12
12
  * Do not edit the class manually.
13
13
  */
14
- function __export(m) {
15
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
16
- }
14
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
17
+ }) : (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ o[k2] = m[k];
20
+ }));
21
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
23
+ };
17
24
  Object.defineProperty(exports, "__esModule", { value: true });
18
- __export(require("./api/default-api"));
25
+ __exportStar(require("./api/default-api"), exports);
19
26
  //# sourceMappingURL=api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/transport/generated/api.ts"],"names":[],"mappings":";AAAA,iBAAiB;AACjB;;;;;;;;;;GAUG;;;;;AAIH,uCAAkC"}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/transport/generated/api.ts"],"names":[],"mappings":";AAAA,iBAAiB;AACjB;;;;;;;;;;GAUG;;;;;;;;;;;;AAIH,oDAAkC"}
@@ -15,10 +15,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  return (mod && mod.__esModule) ? mod : { "default": mod };
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
18
19
  // Some imports not used depending on template conditions
19
20
  // @ts-ignore
20
21
  const axios_1 = __importDefault(require("axios"));
21
- exports.BASE_PATH = "http://localhost:8081/v1".replace(/\/+$/, "");
22
+ exports.BASE_PATH = "http://localhost:8090/v1".replace(/\/+$/, "");
22
23
  /**
23
24
  *
24
25
  * @export
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/transport/generated/base.ts"],"names":[],"mappings":";AAAA,iBAAiB;AACjB;;;;;;;;;;GAUG;;;;;AAIH,yDAAyD;AACzD,aAAa;AACb,kDAAiE;AAEpD,QAAA,SAAS,GAAG,0BAA0B,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAExE;;;GAGG;AACU,QAAA,kBAAkB,GAAG;IAC9B,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,IAAI;IACT,KAAK,EAAE,GAAG;CACb,CAAC;AAYF;;;;GAIG;AACH,MAAa,OAAO;IAGhB,YAAY,aAA6B,EAAY,WAAmB,iBAAS,EAAY,QAAuB,eAAW;QAA1E,aAAQ,GAAR,QAAQ,CAAoB;QAAY,UAAK,GAAL,KAAK,CAA6B;QAC3H,IAAI,aAAa,EAAE;YACf,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;YACnC,IAAI,CAAC,QAAQ,GAAG,aAAa,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC;SAC3D;IACL,CAAC;CACJ;AATD,0BASC;AAAA,CAAC;AAEF;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,KAAK;IAEpC,YAAmB,KAAa,EAAE,GAAY;QAC1C,KAAK,CAAC,GAAG,CAAC,CAAC;QADI,UAAK,GAAL,KAAK,CAAQ;QADhC,SAAI,GAAoB,eAAe,CAAC;IAGxC,CAAC;CACJ;AALD,sCAKC"}
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/transport/generated/base.ts"],"names":[],"mappings":";AAAA,iBAAiB;AACjB;;;;;;;;;;GAUG;;;;;;AAIH,yDAAyD;AACzD,aAAa;AACb,kDAAiE;AAEpD,QAAA,SAAS,GAAG,0BAA0B,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAExE;;;GAGG;AACU,QAAA,kBAAkB,GAAG;IAC9B,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,IAAI;IACT,KAAK,EAAE,GAAG;CACb,CAAC;AAYF;;;;GAIG;AACH,MAAa,OAAO;IAGhB,YAAY,aAA6B,EAAY,WAAmB,iBAAS,EAAY,QAAuB,eAAW;QAA1E,aAAQ,GAAR,QAAQ,CAAoB;QAAY,UAAK,GAAL,KAAK,CAA6B;QAC3H,IAAI,aAAa,EAAE;YACf,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;YACnC,IAAI,CAAC,QAAQ,GAAG,aAAa,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC;SAC3D;IACL,CAAC;CACJ;AATD,0BASC;AAAA,CAAC;AAEF;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,KAAK;IAEpC,YAAmB,KAAa,EAAE,GAAY;QAC1C,KAAK,CAAC,GAAG,CAAC,CAAC;QADI,UAAK,GAAL,KAAK,CAAQ;QADhC,SAAI,GAAoB,eAAe,CAAC;IAGxC,CAAC;CACJ;AALD,sCAKC"}
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  export interface ConfigurationParameters {
13
- apiKey?: string | ((name: string) => string);
13
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
14
14
  username?: string;
15
15
  password?: string;
16
16
  accessToken?: string | ((name?: string, scopes?: string[]) => string);
@@ -23,7 +23,7 @@ export declare class Configuration {
23
23
  * @param name security name
24
24
  * @memberof Configuration
25
25
  */
26
- apiKey?: string | ((name: string) => string);
26
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
27
27
  /**
28
28
  * parameter for basic security
29
29
  *
@@ -12,6 +12,7 @@
12
12
  * Do not edit the class manually.
13
13
  */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.Configuration = void 0;
15
16
  class Configuration {
16
17
  constructor(param = {}) {
17
18
  this.apiKey = param.apiKey;
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../src/transport/generated/configuration.ts"],"names":[],"mappings":";AAAA,iBAAiB;AACjB;;;;;;;;;;GAUG;;AAYH,MAAa,aAAa;IA2CtB,YAAY,QAAiC,EAAE;QAC3C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;IACzC,CAAC;CACJ;AAnDD,sCAmDC"}
1
+ {"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../src/transport/generated/configuration.ts"],"names":[],"mappings":";AAAA,iBAAiB;AACjB;;;;;;;;;;GAUG;;;AAYH,MAAa,aAAa;IA2CtB,YAAY,QAAiC,EAAE;QAC3C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;IACzC,CAAC;CACJ;AAnDD,sCAmDC"}
@@ -11,10 +11,17 @@
11
11
  * https://openapi-generator.tech
12
12
  * Do not edit the class manually.
13
13
  */
14
- function __export(m) {
15
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
16
- }
14
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
17
+ }) : (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ o[k2] = m[k];
20
+ }));
21
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
23
+ };
17
24
  Object.defineProperty(exports, "__esModule", { value: true });
18
- __export(require("./api"));
19
- __export(require("./configuration"));
25
+ __exportStar(require("./api"), exports);
26
+ __exportStar(require("./configuration"), exports);
20
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transport/generated/index.ts"],"names":[],"mappings":";AAAA,iBAAiB;AACjB;;;;;;;;;;GAUG;;;;;AAGH,2BAAsB;AACtB,qCAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transport/generated/index.ts"],"names":[],"mappings":";AAAA,iBAAiB;AACjB;;;;;;;;;;GAUG;;;;;;;;;;;;AAGH,wCAAsB;AACtB,kDAAgC"}
@@ -1,3 +1,14 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
+ };
2
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./inline-object"), exports);
3
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/transport/generated/model/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/transport/generated/model/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAgC"}
@@ -70,7 +70,7 @@ export interface InlineObject {
70
70
  */
71
71
  target: string;
72
72
  /**
73
- * Audit log event environment
73
+ * Audit log event environment, only required when in todd context
74
74
  * @type {string}
75
75
  * @memberof InlineObject
76
76
  */
@@ -129,4 +129,10 @@ export interface InlineObject {
129
129
  * @memberof InlineObject
130
130
  */
131
131
  scope?: object;
132
+ /**
133
+ * Audit log event timestamp unix format
134
+ * @type {number}
135
+ * @memberof InlineObject
136
+ */
137
+ timestamp: number;
132
138
  }
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Transport = void 0;
12
13
  const generated_1 = require("./generated");
13
14
  class Transport {
14
15
  constructor(apiUrl) {
@@ -21,7 +22,7 @@ class Transport {
21
22
  var _a;
22
23
  return __awaiter(this, void 0, void 0, function* () {
23
24
  try {
24
- yield this.api.v1LogPost(auditLogData);
25
+ yield this.api.logPost(auditLogData);
25
26
  }
26
27
  catch (err) {
27
28
  if (!err.isAxiosError) {
@@ -1 +1 @@
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,OAAM,GAAG,EAAE;gBACX,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
+ {"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,OAAO,CAAC,YAAY,CAAC,CAAA;aACrC;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"}
@@ -0,0 +1,6 @@
1
+ {
2
+ "spaces": 2,
3
+ "generator-cli": {
4
+ "version": "4.3.1"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,31 +1,34 @@
1
1
  {
2
2
  "name": "@payfit/audit-log",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Library to handle audit logs at Payfit",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1",
8
8
  "type:check": "tsc --noEmit",
9
- "build": "rimraf dist && tsc",
10
- "prepublish": "npm run build",
9
+ "codegen:sdk": "openapi-generator-cli generate -i ../pkg/broker/v1/swagger/openapi.json -g typescript-axios -o src/transport/generated -c openapi-codegen-config.yml",
10
+ "build": "npm run codegen:sdk && rimraf dist && tsc",
11
+ "prepublishOnly": "npm run build",
11
12
  "start:playground": "ts-node playground/index.ts"
12
13
  },
13
14
  "author": "",
14
15
  "license": "ISC",
15
16
  "dependencies": {
16
- "axios": "0.19.2",
17
- "lodash": "4.17.15",
18
- "uuid": "7.0.0"
17
+ "axios": "^0.21.1",
18
+ "lodash": "^4.17.20",
19
+ "uuid": "^7.0.3"
19
20
  },
20
21
  "devDependencies": {
21
- "@types/lodash": "4.14.149",
22
- "@types/uuid": "3.4.7",
23
- "prettier": "1.18.2",
24
- "rimraf": "2.6.3",
25
- "ts-node": "8.3.0",
26
- "ts-node-dev": "1.0.0-pre.40",
27
- "tslint": "5.18.0",
22
+ "@openapitools/openapi-generator-cli": "2.1.19",
23
+ "@types/lodash": "4.14.168",
24
+ "@types/node": "14.14.22",
25
+ "@types/uuid": "3.4.9",
26
+ "prettier": "2.2.1",
27
+ "rimraf": "3.0.2",
28
+ "ts-node": "9.1.1",
29
+ "ts-node-dev": "1.1.1",
30
+ "tslint": "5.20.1",
28
31
  "tslint-config-prettier": "1.18.0",
29
- "typescript": "3.8.3"
32
+ "typescript": "3.9.7"
30
33
  }
31
34
  }
@@ -32,6 +32,6 @@ async function main() {
32
32
  })
33
33
  }
34
34
 
35
- main().catch(err => {
35
+ main().catch((err) => {
36
36
  console.log('Error:', err)
37
37
  })
package/src/index.ts CHANGED
@@ -114,7 +114,7 @@ export class AuditLogger implements IAuditLogger {
114
114
  async log({ scope, account, ...data }: IAuditLogData) {
115
115
  const uuid = uuidV4()
116
116
  const { environment, service } = this.params
117
- const timestamp = new Date().getTime()
117
+ const timestamp = Math.floor(Date.now() / 1000)
118
118
 
119
119
  const log = {
120
120
  ...data,
@@ -1 +1 @@
1
- 4.2.3
1
+ 4.3.1
@@ -18,7 +18,7 @@ import { Configuration } from '../configuration';
18
18
  // Some imports not used depending on template conditions
19
19
  // @ts-ignore
20
20
  import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
21
-
21
+ // @ts-ignore
22
22
  import { InlineObject } from '../model';
23
23
  /**
24
24
  * DefaultApi - axios parameter creator
@@ -33,12 +33,12 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
33
33
  * @param {*} [options] Override http request option.
34
34
  * @throws {RequiredError}
35
35
  */
36
- v1LogPost(inlineObject: InlineObject, options: any = {}): RequestArgs {
36
+ logPost: async (inlineObject: InlineObject, options: any = {}): Promise<RequestArgs> => {
37
37
  // verify required parameter 'inlineObject' is not null or undefined
38
38
  if (inlineObject === null || inlineObject === undefined) {
39
- throw new RequiredError('inlineObject','Required parameter inlineObject was null or undefined when calling v1LogPost.');
39
+ throw new RequiredError('inlineObject','Required parameter inlineObject was null or undefined when calling logPost.');
40
40
  }
41
- const localVarPath = `/v1/log`;
41
+ const localVarPath = `/log`;
42
42
  const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
43
43
  let baseOptions;
44
44
  if (configuration) {
@@ -55,7 +55,8 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
55
55
  localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
56
56
  // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
57
57
  delete localVarUrlObj.search;
58
- localVarRequestOptions.headers = {...localVarHeaderParameter, ...options.headers};
58
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
59
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
59
60
  const needsSerialization = (typeof inlineObject !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
60
61
  localVarRequestOptions.data = needsSerialization ? JSON.stringify(inlineObject !== undefined ? inlineObject : {}) : (inlineObject || "");
61
62
 
@@ -80,8 +81,8 @@ export const DefaultApiFp = function(configuration?: Configuration) {
80
81
  * @param {*} [options] Override http request option.
81
82
  * @throws {RequiredError}
82
83
  */
83
- v1LogPost(inlineObject: InlineObject, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<void> {
84
- const localVarAxiosArgs = DefaultApiAxiosParamCreator(configuration).v1LogPost(inlineObject, options);
84
+ async logPost(inlineObject: InlineObject, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
85
+ const localVarAxiosArgs = await DefaultApiAxiosParamCreator(configuration).logPost(inlineObject, options);
85
86
  return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
86
87
  const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
87
88
  return axios.request(axiosRequestArgs);
@@ -103,8 +104,8 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
103
104
  * @param {*} [options] Override http request option.
104
105
  * @throws {RequiredError}
105
106
  */
106
- v1LogPost(inlineObject: InlineObject, options?: any): AxiosPromise<void> {
107
- return DefaultApiFp(configuration).v1LogPost(inlineObject, options)(axios, basePath);
107
+ logPost(inlineObject: InlineObject, options?: any): AxiosPromise<void> {
108
+ return DefaultApiFp(configuration).logPost(inlineObject, options).then((request) => request(axios, basePath));
108
109
  },
109
110
  };
110
111
  };
@@ -124,8 +125,8 @@ export class DefaultApi extends BaseAPI {
124
125
  * @throws {RequiredError}
125
126
  * @memberof DefaultApi
126
127
  */
127
- public v1LogPost(inlineObject: InlineObject, options?: any) {
128
- return DefaultApiFp(this.configuration).v1LogPost(inlineObject, options)(this.axios, this.basePath);
128
+ public logPost(inlineObject: InlineObject, options?: any) {
129
+ return DefaultApiFp(this.configuration).logPost(inlineObject, options).then((request) => request(this.axios, this.basePath));
129
130
  }
130
131
 
131
132
  }
@@ -17,7 +17,7 @@ import { Configuration } from "./configuration";
17
17
  // @ts-ignore
18
18
  import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
19
19
 
20
- export const BASE_PATH = "http://localhost:8081/v1".replace(/\/+$/, "");
20
+ export const BASE_PATH = "http://localhost:8090/v1".replace(/\/+$/, "");
21
21
 
22
22
  /**
23
23
  *
@@ -13,7 +13,7 @@
13
13
 
14
14
 
15
15
  export interface ConfigurationParameters {
16
- apiKey?: string | ((name: string) => string);
16
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
17
17
  username?: string;
18
18
  password?: string;
19
19
  accessToken?: string | ((name?: string, scopes?: string[]) => string);
@@ -27,7 +27,7 @@ export class Configuration {
27
27
  * @param name security name
28
28
  * @memberof Configuration
29
29
  */
30
- apiKey?: string | ((name: string) => string);
30
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
31
31
  /**
32
32
  * parameter for basic security
33
33
  *
@@ -74,7 +74,7 @@ export interface InlineObject {
74
74
  */
75
75
  target: string;
76
76
  /**
77
- * Audit log event environment
77
+ * Audit log event environment, only required when in todd context
78
78
  * @type {string}
79
79
  * @memberof InlineObject
80
80
  */
@@ -133,6 +133,12 @@ export interface InlineObject {
133
133
  * @memberof InlineObject
134
134
  */
135
135
  scope?: object;
136
+ /**
137
+ * Audit log event timestamp unix format
138
+ * @type {number}
139
+ * @memberof InlineObject
140
+ */
141
+ timestamp: number;
136
142
  }
137
143
 
138
144
 
@@ -14,8 +14,8 @@ export class Transport implements IAuditLogTransport {
14
14
 
15
15
  async create(auditLogData: InlineObject) {
16
16
  try {
17
- await this.api.v1LogPost(auditLogData)
18
- } catch(err) {
17
+ await this.api.logPost(auditLogData)
18
+ } catch (err) {
19
19
  if (!err.isAxiosError) {
20
20
  throw err
21
21
  }