@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.
Files changed (55) hide show
  1. package/dist/es/index.js +411 -0
  2. package/dist/es/index.js.map +1 -0
  3. package/dist/index.d.ts +11 -10
  4. package/dist/node/index.js +419 -0
  5. package/dist/node/index.js.map +1 -0
  6. package/package.json +38 -19
  7. package/.prettierrc +0 -5
  8. package/CHANGELOG.md +0 -13
  9. package/dist/index.js +0 -44
  10. package/dist/index.js.map +0 -1
  11. package/dist/transport/generated/api/default-api.d.ts +0 -74
  12. package/dist/transport/generated/api/default-api.js +0 -156
  13. package/dist/transport/generated/api/default-api.js.map +0 -1
  14. package/dist/transport/generated/api.d.ts +0 -12
  15. package/dist/transport/generated/api.js +0 -26
  16. package/dist/transport/generated/api.js.map +0 -1
  17. package/dist/transport/generated/base.d.ts +0 -55
  18. package/dist/transport/generated/base.js +0 -64
  19. package/dist/transport/generated/base.js.map +0 -1
  20. package/dist/transport/generated/configuration.d.ts +0 -63
  21. package/dist/transport/generated/configuration.js +0 -27
  22. package/dist/transport/generated/configuration.js.map +0 -1
  23. package/dist/transport/generated/index.d.ts +0 -13
  24. package/dist/transport/generated/index.js +0 -27
  25. package/dist/transport/generated/index.js.map +0 -1
  26. package/dist/transport/generated/model/index.d.ts +0 -1
  27. package/dist/transport/generated/model/index.js +0 -14
  28. package/dist/transport/generated/model/index.js.map +0 -1
  29. package/dist/transport/generated/model/inline-object.d.ts +0 -138
  30. package/dist/transport/generated/model/inline-object.js +0 -15
  31. package/dist/transport/generated/model/inline-object.js.map +0 -1
  32. package/dist/transport/implementation.d.ts +0 -9
  33. package/dist/transport/implementation.js +0 -38
  34. package/dist/transport/implementation.js.map +0 -1
  35. package/dist/transport/interface.d.ts +0 -25
  36. package/dist/transport/interface.js +0 -3
  37. package/dist/transport/interface.js.map +0 -1
  38. package/openapi-codegen-config.yml +0 -6
  39. package/openapitools.json +0 -6
  40. package/playground/index.ts +0 -37
  41. package/src/index.ts +0 -199
  42. package/src/transport/generated/.openapi-generator/VERSION +0 -1
  43. package/src/transport/generated/.openapi-generator-ignore +0 -23
  44. package/src/transport/generated/api/default-api.ts +0 -132
  45. package/src/transport/generated/api.ts +0 -17
  46. package/src/transport/generated/base.ts +0 -70
  47. package/src/transport/generated/configuration.ts +0 -75
  48. package/src/transport/generated/git_push.sh +0 -58
  49. package/src/transport/generated/index.ts +0 -16
  50. package/src/transport/generated/model/index.ts +0 -1
  51. package/src/transport/generated/model/inline-object.ts +0 -144
  52. package/src/transport/implementation.ts +0 -27
  53. package/src/transport/interface.ts +0 -28
  54. package/tsconfig.json +0 -25
  55. package/tslint.json +0 -12
@@ -0,0 +1,411 @@
1
+ import { v4 } from 'uuid';
2
+ import globalAxios from 'axios';
3
+
4
+ /*! *****************************************************************************
5
+ Copyright (c) Microsoft Corporation.
6
+
7
+ Permission to use, copy, modify, and/or distribute this software for any
8
+ purpose with or without fee is hereby granted.
9
+
10
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
11
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
13
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16
+ PERFORMANCE OF THIS SOFTWARE.
17
+ ***************************************************************************** */
18
+ /* global Reflect, Promise */
19
+
20
+ var extendStatics = function(d, b) {
21
+ extendStatics = Object.setPrototypeOf ||
22
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
23
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
24
+ return extendStatics(d, b);
25
+ };
26
+
27
+ function __extends(d, b) {
28
+ extendStatics(d, b);
29
+ function __() { this.constructor = d; }
30
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
31
+ }
32
+
33
+ var __assign = function() {
34
+ __assign = Object.assign || function __assign(t) {
35
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
36
+ s = arguments[i];
37
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
38
+ }
39
+ return t;
40
+ };
41
+ return __assign.apply(this, arguments);
42
+ };
43
+
44
+ function __rest(s, e) {
45
+ var t = {};
46
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
47
+ t[p] = s[p];
48
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
49
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
50
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
51
+ t[p[i]] = s[p[i]];
52
+ }
53
+ return t;
54
+ }
55
+
56
+ function __awaiter(thisArg, _arguments, P, generator) {
57
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
58
+ return new (P || (P = Promise))(function (resolve, reject) {
59
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
60
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
61
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
62
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
63
+ });
64
+ }
65
+
66
+ function __generator(thisArg, body) {
67
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
68
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
69
+ function verb(n) { return function (v) { return step([n, v]); }; }
70
+ function step(op) {
71
+ if (f) throw new TypeError("Generator is already executing.");
72
+ while (_) try {
73
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
74
+ if (y = 0, t) op = [op[0] & 2, t.value];
75
+ switch (op[0]) {
76
+ case 0: case 1: t = op; break;
77
+ case 4: _.label++; return { value: op[1], done: false };
78
+ case 5: _.label++; y = op[1]; op = [0]; continue;
79
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
80
+ default:
81
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
82
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
83
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
84
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
85
+ if (t[2]) _.ops.pop();
86
+ _.trys.pop(); continue;
87
+ }
88
+ op = body.call(thisArg, _);
89
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
90
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
91
+ }
92
+ }
93
+
94
+ function __values(o) {
95
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
96
+ if (m) return m.call(o);
97
+ if (o && typeof o.length === "number") return {
98
+ next: function () {
99
+ if (o && i >= o.length) o = void 0;
100
+ return { value: o && o[i++], done: !o };
101
+ }
102
+ };
103
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
104
+ }
105
+
106
+ /* tslint:disable */
107
+ var BASE_PATH = "http://localhost:8090".replace(/\/+$/, "");
108
+ /**
109
+ *
110
+ * @export
111
+ * @class BaseAPI
112
+ */
113
+ var BaseAPI = /** @class */ (function () {
114
+ function BaseAPI(configuration, basePath, axios) {
115
+ if (basePath === void 0) { basePath = BASE_PATH; }
116
+ if (axios === void 0) { axios = globalAxios; }
117
+ this.basePath = basePath;
118
+ this.axios = axios;
119
+ if (configuration) {
120
+ this.configuration = configuration;
121
+ this.basePath = configuration.basePath || this.basePath;
122
+ }
123
+ }
124
+ return BaseAPI;
125
+ }());
126
+ /**
127
+ *
128
+ * @export
129
+ * @class RequiredError
130
+ * @extends {Error}
131
+ */
132
+ var RequiredError = /** @class */ (function (_super) {
133
+ __extends(RequiredError, _super);
134
+ function RequiredError(field, msg) {
135
+ var _this = _super.call(this, msg) || this;
136
+ _this.field = field;
137
+ _this.name = "RequiredError";
138
+ return _this;
139
+ }
140
+ return RequiredError;
141
+ }(Error));
142
+
143
+ /* tslint:disable */
144
+ /**
145
+ *
146
+ * @export
147
+ */
148
+ var DUMMY_BASE_URL = 'https://example.com';
149
+ /**
150
+ *
151
+ * @throws {RequiredError}
152
+ * @export
153
+ */
154
+ var assertParamExists = function (functionName, paramName, paramValue) {
155
+ if (paramValue === null || paramValue === undefined) {
156
+ throw new RequiredError(paramName, "Required parameter ".concat(paramName, " was null or undefined when calling ").concat(functionName, "."));
157
+ }
158
+ };
159
+ /**
160
+ *
161
+ * @export
162
+ */
163
+ var setSearchParams = function (url) {
164
+ var e_1, _a, e_2, _b;
165
+ var objects = [];
166
+ for (var _i = 1; _i < arguments.length; _i++) {
167
+ objects[_i - 1] = arguments[_i];
168
+ }
169
+ var searchParams = new URLSearchParams(url.search);
170
+ try {
171
+ for (var objects_1 = __values(objects), objects_1_1 = objects_1.next(); !objects_1_1.done; objects_1_1 = objects_1.next()) {
172
+ var object = objects_1_1.value;
173
+ for (var key in object) {
174
+ if (Array.isArray(object[key])) {
175
+ searchParams["delete"](key);
176
+ try {
177
+ for (var _c = (e_2 = void 0, __values(object[key])), _d = _c.next(); !_d.done; _d = _c.next()) {
178
+ var item = _d.value;
179
+ searchParams.append(key, item);
180
+ }
181
+ }
182
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
183
+ finally {
184
+ try {
185
+ if (_d && !_d.done && (_b = _c["return"])) _b.call(_c);
186
+ }
187
+ finally { if (e_2) throw e_2.error; }
188
+ }
189
+ }
190
+ else {
191
+ searchParams.set(key, object[key]);
192
+ }
193
+ }
194
+ }
195
+ }
196
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
197
+ finally {
198
+ try {
199
+ if (objects_1_1 && !objects_1_1.done && (_a = objects_1["return"])) _a.call(objects_1);
200
+ }
201
+ finally { if (e_1) throw e_1.error; }
202
+ }
203
+ url.search = searchParams.toString();
204
+ };
205
+ /**
206
+ *
207
+ * @export
208
+ */
209
+ var serializeDataIfNeeded = function (value, requestOptions, configuration) {
210
+ var nonString = typeof value !== 'string';
211
+ var needsSerialization = nonString && configuration && configuration.isJsonMime
212
+ ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
213
+ : nonString;
214
+ return needsSerialization
215
+ ? JSON.stringify(value !== undefined ? value : {})
216
+ : (value || "");
217
+ };
218
+ /**
219
+ *
220
+ * @export
221
+ */
222
+ var toPathString = function (url) {
223
+ return url.pathname + url.search + url.hash;
224
+ };
225
+ /**
226
+ *
227
+ * @export
228
+ */
229
+ var createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
230
+ return function (axios, basePath) {
231
+ if (axios === void 0) { axios = globalAxios; }
232
+ if (basePath === void 0) { basePath = BASE_PATH; }
233
+ var axiosRequestArgs = __assign(__assign({}, axiosArgs.options), { url: ((configuration === null || configuration === void 0 ? void 0 : configuration.basePath) || basePath) + axiosArgs.url });
234
+ return axios.request(axiosRequestArgs);
235
+ };
236
+ };
237
+
238
+ /* tslint:disable */
239
+ /**
240
+ * DefaultApi - axios parameter creator
241
+ * @export
242
+ */
243
+ var DefaultApiAxiosParamCreator = function (configuration) {
244
+ var _this = this;
245
+ return {
246
+ /**
247
+ *
248
+ * @summary Creates Audit Log event
249
+ * @param {InlineObject} inlineObject
250
+ * @param {*} [options] Override http request option.
251
+ * @throws {RequiredError}
252
+ */
253
+ v1LogPost: function (inlineObject, options) {
254
+ if (options === void 0) { options = {}; }
255
+ return __awaiter(_this, void 0, void 0, function () {
256
+ var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
257
+ return __generator(this, function (_a) {
258
+ // verify required parameter 'inlineObject' is not null or undefined
259
+ assertParamExists('v1LogPost', 'inlineObject', inlineObject);
260
+ localVarPath = "/v1/log";
261
+ localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
262
+ if (configuration) {
263
+ baseOptions = configuration.baseOptions;
264
+ }
265
+ localVarRequestOptions = __assign(__assign({ method: 'POST' }, baseOptions), options);
266
+ localVarHeaderParameter = {};
267
+ localVarQueryParameter = {};
268
+ localVarHeaderParameter['Content-Type'] = 'application/json';
269
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
270
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
271
+ localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
272
+ localVarRequestOptions.data = serializeDataIfNeeded(inlineObject, localVarRequestOptions, configuration);
273
+ return [2 /*return*/, {
274
+ url: toPathString(localVarUrlObj),
275
+ options: localVarRequestOptions
276
+ }];
277
+ });
278
+ });
279
+ }
280
+ };
281
+ };
282
+ /**
283
+ * DefaultApi - functional programming interface
284
+ * @export
285
+ */
286
+ var DefaultApiFp = function (configuration) {
287
+ var localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration);
288
+ return {
289
+ /**
290
+ *
291
+ * @summary Creates Audit Log event
292
+ * @param {InlineObject} inlineObject
293
+ * @param {*} [options] Override http request option.
294
+ * @throws {RequiredError}
295
+ */
296
+ v1LogPost: function (inlineObject, options) {
297
+ return __awaiter(this, void 0, void 0, function () {
298
+ var localVarAxiosArgs;
299
+ return __generator(this, function (_a) {
300
+ switch (_a.label) {
301
+ case 0: return [4 /*yield*/, localVarAxiosParamCreator.v1LogPost(inlineObject, options)];
302
+ case 1:
303
+ localVarAxiosArgs = _a.sent();
304
+ return [2 /*return*/, createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)];
305
+ }
306
+ });
307
+ });
308
+ }
309
+ };
310
+ };
311
+ /**
312
+ * DefaultApi - object-oriented interface
313
+ * @export
314
+ * @class DefaultApi
315
+ * @extends {BaseAPI}
316
+ */
317
+ var DefaultApi = /** @class */ (function (_super) {
318
+ __extends(DefaultApi, _super);
319
+ function DefaultApi() {
320
+ return _super !== null && _super.apply(this, arguments) || this;
321
+ }
322
+ /**
323
+ *
324
+ * @summary Creates Audit Log event
325
+ * @param {InlineObject} inlineObject
326
+ * @param {*} [options] Override http request option.
327
+ * @throws {RequiredError}
328
+ * @memberof DefaultApi
329
+ */
330
+ DefaultApi.prototype.v1LogPost = function (inlineObject, options) {
331
+ var _this = this;
332
+ return DefaultApiFp(this.configuration).v1LogPost(inlineObject, options).then(function (request) { return request(_this.axios, _this.basePath); });
333
+ };
334
+ return DefaultApi;
335
+ }(BaseAPI));
336
+
337
+ var isAxiosError = function (err) {
338
+ return 'isAxiosError' in err && err.isAxiosError && err instanceof Error;
339
+ };
340
+ var Transport = /** @class */ (function () {
341
+ function Transport(apiUrl) {
342
+ this.apiUrl = apiUrl;
343
+ this.api = new DefaultApi({
344
+ basePath: this.apiUrl,
345
+ isJsonMime: function (mime) {
346
+ // eslint-disable-next-line security/detect-unsafe-regex
347
+ var jsonMime = new RegExp(
348
+ // eslint-disable-next-line no-control-regex
349
+ '^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
350
+ return (mime !== null &&
351
+ (jsonMime.test(mime) ||
352
+ mime.toLowerCase() === 'application/json-patch+json'));
353
+ }
354
+ });
355
+ }
356
+ Transport.prototype.create = function (auditLogData) {
357
+ var _a;
358
+ return __awaiter(this, void 0, void 0, function () {
359
+ var err_1, message;
360
+ return __generator(this, function (_b) {
361
+ switch (_b.label) {
362
+ case 0:
363
+ _b.trys.push([0, 2, , 3]);
364
+ return [4 /*yield*/, this.api.v1LogPost(auditLogData)];
365
+ case 1:
366
+ _b.sent();
367
+ return [3 /*break*/, 3];
368
+ case 2:
369
+ err_1 = _b.sent();
370
+ if (!isAxiosError(err_1)) {
371
+ throw err_1;
372
+ }
373
+ message = ((_a = err_1.response) === null || _a === void 0 ? void 0 : _a.data) || err_1.message;
374
+ throw new Error(message);
375
+ case 3: return [2 /*return*/];
376
+ }
377
+ });
378
+ });
379
+ };
380
+ return Transport;
381
+ }());
382
+
383
+ var AuditLogger = /** @class */ (function () {
384
+ function AuditLogger(params) {
385
+ this.params = params;
386
+ this.transport = new Transport(params.apiUrl);
387
+ }
388
+ AuditLogger.prototype.log = function (_a) {
389
+ var scope = _a.scope, account = _a.account, data = __rest(_a, ["scope", "account"]);
390
+ return __awaiter(this, void 0, void 0, function () {
391
+ var uuid, _b, environment, service, timestamp, log;
392
+ return __generator(this, function (_c) {
393
+ switch (_c.label) {
394
+ case 0:
395
+ uuid = v4();
396
+ _b = this.params, environment = _b.environment, service = _b.service;
397
+ timestamp = Math.floor(Date.now() / 1000);
398
+ log = __assign(__assign(__assign(__assign({}, data), account), { service: service, id: uuid, environment: environment, timestamp: timestamp }), (scope && { scope: scope }));
399
+ return [4 /*yield*/, this.transport.create(log)];
400
+ case 1:
401
+ _c.sent();
402
+ return [2 /*return*/];
403
+ }
404
+ });
405
+ });
406
+ };
407
+ return AuditLogger;
408
+ }());
409
+
410
+ export { AuditLogger };
411
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../node_modules/tslib/tslib.es6.js","../../src/transport/generated/base.ts","../../src/transport/generated/common.ts","../../src/transport/generated/api/default-api.ts","../../src/transport/implementation.ts","../../src/index.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/* tslint:disable */\n/* eslint-disable */\n/**\n * Audit Logs\n * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)\n *\n * The version of the OpenAPI document: 1.0.0\n * Contact: damian.bursztyn@payfit.com\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\n\nimport { Configuration } from \"./configuration\";\n// Some imports not used depending on template conditions\n// @ts-ignore\nimport globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';\n\nexport const BASE_PATH = \"http://localhost:8090\".replace(/\\/+$/, \"\");\n\n/**\n *\n * @export\n */\nexport const COLLECTION_FORMATS = {\n csv: \",\",\n ssv: \" \",\n tsv: \"\\t\",\n pipes: \"|\",\n};\n\n/**\n *\n * @export\n * @interface RequestArgs\n */\nexport interface RequestArgs {\n url: string;\n options: AxiosRequestConfig;\n}\n\n/**\n *\n * @export\n * @class BaseAPI\n */\nexport class BaseAPI {\n protected configuration: Configuration | undefined;\n\n constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {\n if (configuration) {\n this.configuration = configuration;\n this.basePath = configuration.basePath || this.basePath;\n }\n }\n};\n\n/**\n *\n * @export\n * @class RequiredError\n * @extends {Error}\n */\nexport class RequiredError extends Error {\n name: \"RequiredError\" = \"RequiredError\";\n constructor(public field: string, msg?: string) {\n super(msg);\n }\n}\n","/* tslint:disable */\n/* eslint-disable */\n/**\n * Audit Logs\n * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)\n *\n * The version of the OpenAPI document: 1.0.0\n * Contact: damian.bursztyn@payfit.com\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\n\nimport { Configuration } from \"./configuration\";\nimport { RequiredError, RequestArgs } from \"./base\";\nimport { AxiosInstance, AxiosResponse } from 'axios';\n\n/**\n *\n * @export\n */\nexport const DUMMY_BASE_URL = 'https://example.com'\n\n/**\n *\n * @throws {RequiredError}\n * @export\n */\nexport const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {\n if (paramValue === null || paramValue === undefined) {\n throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);\n }\n}\n\n/**\n *\n * @export\n */\nexport const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {\n if (configuration && configuration.apiKey) {\n const localVarApiKeyValue = typeof configuration.apiKey === 'function'\n ? await configuration.apiKey(keyParamName)\n : await configuration.apiKey;\n object[keyParamName] = localVarApiKeyValue;\n }\n}\n\n/**\n *\n * @export\n */\nexport const setBasicAuthToObject = function (object: any, configuration?: Configuration) {\n if (configuration && (configuration.username || configuration.password)) {\n object[\"auth\"] = { username: configuration.username, password: configuration.password };\n }\n}\n\n/**\n *\n * @export\n */\nexport const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {\n if (configuration && configuration.accessToken) {\n const accessToken = typeof configuration.accessToken === 'function'\n ? await configuration.accessToken()\n : await configuration.accessToken;\n object[\"Authorization\"] = \"Bearer \" + accessToken;\n }\n}\n\n/**\n *\n * @export\n */\nexport const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {\n if (configuration && configuration.accessToken) {\n const localVarAccessTokenValue = typeof configuration.accessToken === 'function'\n ? await configuration.accessToken(name, scopes)\n : await configuration.accessToken;\n object[\"Authorization\"] = \"Bearer \" + localVarAccessTokenValue;\n }\n}\n\n/**\n *\n * @export\n */\nexport const setSearchParams = function (url: URL, ...objects: any[]) {\n const searchParams = new URLSearchParams(url.search);\n for (const object of objects) {\n for (const key in object) {\n if (Array.isArray(object[key])) {\n searchParams.delete(key);\n for (const item of object[key]) {\n searchParams.append(key, item);\n }\n } else {\n searchParams.set(key, object[key]);\n }\n }\n }\n url.search = searchParams.toString();\n}\n\n/**\n *\n * @export\n */\nexport const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {\n const nonString = typeof value !== 'string';\n const needsSerialization = nonString && configuration && configuration.isJsonMime\n ? configuration.isJsonMime(requestOptions.headers['Content-Type'])\n : nonString;\n return needsSerialization\n ? JSON.stringify(value !== undefined ? value : {})\n : (value || \"\");\n}\n\n/**\n *\n * @export\n */\nexport const toPathString = function (url: URL) {\n return url.pathname + url.search + url.hash\n}\n\n/**\n *\n * @export\n */\nexport const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {\n return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {\n const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};\n return axios.request<T, R>(axiosRequestArgs);\n };\n}\n","/* tslint:disable */\n/* eslint-disable */\n/**\n * Audit Logs\n * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)\n *\n * The version of the OpenAPI document: 1.0.0\n * Contact: damian.bursztyn@payfit.com\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\n\nimport globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';\nimport { Configuration } from '../configuration';\n// Some imports not used depending on template conditions\n// @ts-ignore\nimport { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';\n// @ts-ignore\nimport { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';\n// @ts-ignore\nimport { InlineObject } from '../model';\n/**\n * DefaultApi - axios parameter creator\n * @export\n */\nexport const DefaultApiAxiosParamCreator = function (configuration?: Configuration) {\n return {\n /**\n * \n * @summary Creates Audit Log event\n * @param {InlineObject} inlineObject \n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n v1LogPost: async (inlineObject: InlineObject, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {\n // verify required parameter 'inlineObject' is not null or undefined\n assertParamExists('v1LogPost', 'inlineObject', inlineObject)\n const localVarPath = `/v1/log`;\n // use dummy base URL string because the URL constructor only accepts absolute URLs.\n const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);\n let baseOptions;\n if (configuration) {\n baseOptions = configuration.baseOptions;\n }\n\n const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};\n const localVarHeaderParameter = {} as any;\n const localVarQueryParameter = {} as any;\n\n\n \n localVarHeaderParameter['Content-Type'] = 'application/json';\n\n setSearchParams(localVarUrlObj, localVarQueryParameter);\n let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};\n localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};\n localVarRequestOptions.data = serializeDataIfNeeded(inlineObject, localVarRequestOptions, configuration)\n\n return {\n url: toPathString(localVarUrlObj),\n options: localVarRequestOptions,\n };\n },\n }\n};\n\n/**\n * DefaultApi - functional programming interface\n * @export\n */\nexport const DefaultApiFp = function(configuration?: Configuration) {\n const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration)\n return {\n /**\n * \n * @summary Creates Audit Log event\n * @param {InlineObject} inlineObject \n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n async v1LogPost(inlineObject: InlineObject, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {\n const localVarAxiosArgs = await localVarAxiosParamCreator.v1LogPost(inlineObject, options);\n return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);\n },\n }\n};\n\n/**\n * DefaultApi - factory interface\n * @export\n */\nexport const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {\n const localVarFp = DefaultApiFp(configuration)\n return {\n /**\n * \n * @summary Creates Audit Log event\n * @param {InlineObject} inlineObject \n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n */\n v1LogPost(inlineObject: InlineObject, options?: any): AxiosPromise<void> {\n return localVarFp.v1LogPost(inlineObject, options).then((request) => request(axios, basePath));\n },\n };\n};\n\n/**\n * DefaultApi - object-oriented interface\n * @export\n * @class DefaultApi\n * @extends {BaseAPI}\n */\nexport class DefaultApi extends BaseAPI {\n /**\n * \n * @summary Creates Audit Log event\n * @param {InlineObject} inlineObject \n * @param {*} [options] Override http request option.\n * @throws {RequiredError}\n * @memberof DefaultApi\n */\n public v1LogPost(inlineObject: InlineObject, options?: AxiosRequestConfig) {\n return DefaultApiFp(this.configuration).v1LogPost(inlineObject, options).then((request) => request(this.axios, this.basePath));\n }\n}\n","import { AxiosError } from 'axios'\n\nimport { DefaultApi } from './generated'\nimport { InlineObject } from './generated/model'\nimport { IAuditLogTransport } from './interface'\n\nconst isAxiosError = (err: any): err is AxiosError =>\n 'isAxiosError' in err && err.isAxiosError && err instanceof Error\n\nexport class Transport implements IAuditLogTransport {\n private api: DefaultApi\n\n constructor(protected apiUrl: string) {\n this.api = new DefaultApi({\n basePath: this.apiUrl,\n isJsonMime(mime: string): boolean {\n // eslint-disable-next-line security/detect-unsafe-regex\n const jsonMime = new RegExp(\n // eslint-disable-next-line no-control-regex\n '^(application/json|[^;/ \\t]+/[^;/ \\t]+[+]json)[ \\t]*(;.*)?$',\n 'i'\n )\n return (\n mime !== null &&\n (jsonMime.test(mime) ||\n mime.toLowerCase() === 'application/json-patch+json')\n )\n },\n })\n }\n\n public async create(auditLogData: InlineObject) {\n try {\n await this.api.v1LogPost(auditLogData)\n } catch (err) {\n if (!isAxiosError(err)) {\n throw err\n }\n\n const message = err.response?.data || err.message\n throw new Error(message)\n }\n }\n}\n","import { v4 as uuidV4 } from 'uuid'\n\nimport { IAuditLogTransport } from './transport/interface'\nimport { Transport } from './transport/implementation'\n\n/**\n * The allowed Namespaces for the AuditLog\n */\nexport type AuditNamespaces =\n | 'employee'\n | 'company'\n | 'permissions'\n | 'absence'\n | 'expense'\n | 'advancePayment'\n | 'auth'\n | 'billing'\n | 'modules'\n | 'integrations'\n | 'partnerApi'\n | 'donation'\n | 'notificationSettings'\n | 'people'\n | 'subscriptions'\n | 'organization'\n | 'declarations'\n | 'pricing'\n\n/**\n * The allowed targets for the AuditLog\n */\nexport type AuditTargets =\n | 'reporting'\n | 'employee'\n | 'employee.settings'\n | 'employee-request'\n | 'company'\n | 'company.billings'\n | 'company.billing'\n | 'company.variables'\n | 'company.settings'\n | 'company.emails'\n | 'company.addons'\n | 'company.plans'\n | 'company.modules'\n | 'declaration.metadata'\n | 'user.role'\n | 'user.account'\n | 'user.primaryEmail'\n | 'user.secondaryEmail'\n | 'user.locale'\n | 'user.notificationSettings'\n | 'user.mfa'\n | 'role'\n | 'team'\n | 'department'\n | 'workflow'\n | 'integration'\n | 'apiAccess'\n | 'individual'\n | 'association'\n | 'association.archived'\n | 'donation'\n | 'donation.amount'\n | 'donation.auth.partner.portal'\n | 'donation.company.onboarding'\n | 'donation.taxReceipt'\n | 'donationPayment.status'\n | 'people.document.comments'\n | 'people.document.notifications'\n | 'people.document.reactions'\n | 'people.document.status'\n | 'people.document.answers'\n | 'people.settings'\n | 'people.relation'\n\n/**\n * The allowed Events for the AuditLog\n */\nexport type AuditEvents =\n | 'create'\n | 'update'\n | 'delete'\n | 'view'\n | 'merge'\n | 'disable'\n\n/**\n * Data to audit log.\n */\nexport interface IAuditLogData {\n /**\n * The data specific to the audit log.\n * For example, if we add a bonus to an employee, it could contain the amount, the impacted employeeId, etc...\n */\n payload?: Record<string, unknown>\n\n /**\n * The buisness domain impacted.\n * e.g documents, authentication, ...\n */\n namespace: AuditNamespaces\n\n /**\n * The name of the event.\n * e.g. signIn, passwordUpdated, ...\n */\n event: AuditEvents\n\n /**\n * The target of event.\n * e.g. user.settings, employee.bonuses, ...\n */\n target: AuditTargets\n\n /**\n * The data that describes who did perform the logged action.\n */\n account: IAuditLogAuthData\n\n /**\n * The scope of the audit log\n */\n scope: IAuditLogScope\n}\n\n/**\n * Data used to indentify who performed an action\n */\nexport type IAuditLogAuthData =\n | {\n /**\n * The id of the payfiter that did the action if it has been made during a siginAs\n */\n internalId?: string\n\n // the \"account\" infos\n holdingId?: string\n companyId?: string\n employeeId?: string\n individualId?: string\n roleId?: string\n\n /**\n *\n */\n countryCode?: string\n /**\n * The IP address of the user\n */\n userIp?: string\n /**\n * The email address of the user\n */\n email?: string\n }\n | {\n /* Indicates that the action has been performed by the system */\n isSystem: true\n }\n\n/**\n * Data used to \"scope\" the audit log.\n * Might be useful to retrieve all actions performed in a holding, a company, or on an employee.\n */\nexport type IAuditLogScope =\n | {\n holdingId: string\n }\n | {\n companyId: string\n employeeId?: string\n }\n | {\n individualId: string\n }\n | null\n\n// warning: modifying this interface means probably make a breaking change to the SDK\nexport interface IAuditLogger {\n log: (data: IAuditLogData) => Promise<void>\n}\n\nexport interface IAuditLoggerInitialization {\n apiUrl: string\n environment: string\n service: string\n}\n\nexport class AuditLogger implements IAuditLogger {\n private transport: IAuditLogTransport\n\n constructor(protected params: IAuditLoggerInitialization) {\n this.transport = new Transport(params.apiUrl)\n }\n\n public async log({ scope, account, ...data }: IAuditLogData) {\n const uuid = uuidV4()\n const { environment, service } = this.params\n const timestamp = Math.floor(Date.now() / 1000)\n\n const log = {\n ...data,\n ...account,\n service,\n id: uuid,\n environment,\n timestamp,\n ...(scope && { scope }),\n }\n\n await this.transport.create(log)\n }\n}\n"],"names":["uuidV4"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;AACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;AACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;AACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnF,IAAI,OAAO,aAAa,CAAC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MAAkC;QAAlC,WAAM,GAAN,MAAM,CAA4B;QACtD,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;KAC9C;IAEY,yBAAG,GAAhB,UAAiB,EAA0C;QAAxC,IAAA,KAAK,WAAA,EAAE,OAAO,aAAA,EAAK,IAAI,cAAzB,oBAA2B,CAAF;;;;;;wBAClC,IAAI,GAAGA,EAAM,EAAE,CAAA;wBACf,KAA2B,IAAI,CAAC,MAAM,EAApC,WAAW,iBAAA,EAAE,OAAO,aAAA,CAAgB;wBACtC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;wBAEzC,GAAG,2CACJ,IAAI,GACJ,OAAO,KACV,OAAO,SAAA,EACP,EAAE,EAAE,IAAI,EACR,WAAW,aAAA,EACX,SAAS,WAAA,MACL,KAAK,IAAI,EAAE,KAAK,OAAA,EAAE,EACvB,CAAA;wBAED,qBAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,EAAA;;wBAAhC,SAAgC,CAAA;;;;;KACjC;IACH,kBAAC;AAAD,CAAC;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,24 +1,24 @@
1
1
  /**
2
2
  * The allowed Namespaces for the AuditLog
3
3
  */
4
- export declare type AuditNamespaces = 'employee' | 'company' | 'permissions' | 'absence' | 'expense' | 'advancePayment' | 'auth' | 'billing' | 'modules' | 'integrations' | 'partnerApi' | 'donation' | 'notificationSettings' | 'people' | 'subscriptions';
4
+ type AuditNamespaces = 'employee' | 'company' | 'permissions' | 'absence' | 'expense' | 'advancePayment' | 'auth' | 'billing' | 'modules' | 'integrations' | 'partnerApi' | 'donation' | 'notificationSettings' | 'people' | 'subscriptions' | 'organization' | 'declarations' | 'pricing';
5
5
  /**
6
6
  * The allowed targets for the AuditLog
7
7
  */
8
- export declare type AuditTargets = 'reporting' | 'employee' | 'employee.settings' | 'employee-request' | 'company.billings' | 'company.variables' | 'company.settings' | 'company.emails' | 'company.addons' | 'company.plans' | 'user.role' | 'user.account' | 'user.primaryEmail' | 'user.secondaryEmail' | 'user.locale' | 'user.notificationSettings' | 'role' | 'team' | 'department' | 'workflow' | 'integration' | 'apiAccess' | 'individual' | 'association' | 'association.archived' | 'donation' | 'donation.amount' | 'donation.auth.partner.portal' | 'donation.company.onboarding' | 'donation.taxReceipt' | 'donationPayment.status' | 'people.document.comments' | 'people.document.notifications' | 'people.document.reactions' | 'people.document.status' | 'people.document.answers' | 'people.settings' | 'people.relation';
8
+ type AuditTargets = 'reporting' | 'employee' | 'employee.settings' | 'employee-request' | 'company' | 'company.billings' | 'company.billing' | 'company.variables' | 'company.settings' | 'company.emails' | 'company.addons' | 'company.plans' | 'company.modules' | 'declaration.metadata' | 'user.role' | 'user.account' | 'user.primaryEmail' | 'user.secondaryEmail' | 'user.locale' | 'user.notificationSettings' | 'user.mfa' | 'role' | 'team' | 'department' | 'workflow' | 'integration' | 'apiAccess' | 'individual' | 'association' | 'association.archived' | 'donation' | 'donation.amount' | 'donation.auth.partner.portal' | 'donation.company.onboarding' | 'donation.taxReceipt' | 'donationPayment.status' | 'people.document.comments' | 'people.document.notifications' | 'people.document.reactions' | 'people.document.status' | 'people.document.answers' | 'people.settings' | 'people.relation';
9
9
  /**
10
10
  * The allowed Events for the AuditLog
11
11
  */
12
- export declare type AuditEvents = 'create' | 'update' | 'delete' | 'view' | 'merge';
12
+ type AuditEvents = 'create' | 'update' | 'delete' | 'view' | 'merge' | 'disable';
13
13
  /**
14
14
  * Data to audit log.
15
15
  */
16
- export interface IAuditLogData {
16
+ interface IAuditLogData {
17
17
  /**
18
18
  * The data specific to the audit log.
19
19
  * For example, if we add a bonus to an employee, it could contain the amount, the impacted employeeId, etc...
20
20
  */
21
- payload?: object;
21
+ payload?: Record<string, unknown>;
22
22
  /**
23
23
  * The buisness domain impacted.
24
24
  * e.g documents, authentication, ...
@@ -46,7 +46,7 @@ export interface IAuditLogData {
46
46
  /**
47
47
  * Data used to indentify who performed an action
48
48
  */
49
- export declare type IAuditLogAuthData = {
49
+ type IAuditLogAuthData = {
50
50
  /**
51
51
  * The id of the payfiter that did the action if it has been made during a siginAs
52
52
  */
@@ -75,7 +75,7 @@ export declare type IAuditLogAuthData = {
75
75
  * Data used to "scope" the audit log.
76
76
  * Might be useful to retrieve all actions performed in a holding, a company, or on an employee.
77
77
  */
78
- export declare type IAuditLogScope = {
78
+ type IAuditLogScope = {
79
79
  holdingId: string;
80
80
  } | {
81
81
  companyId: string;
@@ -83,17 +83,18 @@ export declare type IAuditLogScope = {
83
83
  } | {
84
84
  individualId: string;
85
85
  } | null;
86
- export interface IAuditLogger {
86
+ interface IAuditLogger {
87
87
  log: (data: IAuditLogData) => Promise<void>;
88
88
  }
89
- export interface IAuditLoggerInitialization {
89
+ interface IAuditLoggerInitialization {
90
90
  apiUrl: string;
91
91
  environment: string;
92
92
  service: string;
93
93
  }
94
- export declare class AuditLogger implements IAuditLogger {
94
+ declare class AuditLogger implements IAuditLogger {
95
95
  protected params: IAuditLoggerInitialization;
96
96
  private transport;
97
97
  constructor(params: IAuditLoggerInitialization);
98
98
  log({ scope, account, ...data }: IAuditLogData): Promise<void>;
99
99
  }
100
+ export { AuditNamespaces, AuditTargets, AuditEvents, IAuditLogData, IAuditLogAuthData, IAuditLogScope, IAuditLogger, IAuditLoggerInitialization, AuditLogger };