@payfit/audit-log 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/index.js +411 -0
- package/dist/es/index.js.map +1 -0
- package/dist/index.d.ts +11 -10
- package/dist/node/index.js +419 -0
- package/dist/node/index.js.map +1 -0
- package/package.json +37 -18
- package/.prettierrc +0 -5
- package/CHANGELOG.md +0 -13
- package/dist/index.js +0 -44
- package/dist/index.js.map +0 -1
- package/dist/transport/generated/api/default-api.d.ts +0 -74
- package/dist/transport/generated/api/default-api.js +0 -156
- package/dist/transport/generated/api/default-api.js.map +0 -1
- package/dist/transport/generated/api.d.ts +0 -12
- package/dist/transport/generated/api.js +0 -26
- package/dist/transport/generated/api.js.map +0 -1
- package/dist/transport/generated/base.d.ts +0 -55
- package/dist/transport/generated/base.js +0 -64
- package/dist/transport/generated/base.js.map +0 -1
- package/dist/transport/generated/configuration.d.ts +0 -63
- package/dist/transport/generated/configuration.js +0 -27
- package/dist/transport/generated/configuration.js.map +0 -1
- package/dist/transport/generated/index.d.ts +0 -13
- package/dist/transport/generated/index.js +0 -27
- package/dist/transport/generated/index.js.map +0 -1
- package/dist/transport/generated/model/index.d.ts +0 -1
- package/dist/transport/generated/model/index.js +0 -14
- package/dist/transport/generated/model/index.js.map +0 -1
- package/dist/transport/generated/model/inline-object.d.ts +0 -138
- package/dist/transport/generated/model/inline-object.js +0 -15
- package/dist/transport/generated/model/inline-object.js.map +0 -1
- package/dist/transport/implementation.d.ts +0 -9
- package/dist/transport/implementation.js +0 -38
- package/dist/transport/implementation.js.map +0 -1
- package/dist/transport/interface.d.ts +0 -25
- package/dist/transport/interface.js +0 -3
- package/dist/transport/interface.js.map +0 -1
- package/openapi-codegen-config.yml +0 -6
- package/openapitools.json +0 -6
- package/playground/index.ts +0 -37
- package/src/index.ts +0 -199
- package/src/transport/generated/.openapi-generator/VERSION +0 -1
- package/src/transport/generated/.openapi-generator-ignore +0 -23
- package/src/transport/generated/api/default-api.ts +0 -132
- package/src/transport/generated/api.ts +0 -17
- package/src/transport/generated/base.ts +0 -70
- package/src/transport/generated/configuration.ts +0 -75
- package/src/transport/generated/git_push.sh +0 -58
- package/src/transport/generated/index.ts +0 -16
- package/src/transport/generated/model/index.ts +0 -1
- package/src/transport/generated/model/inline-object.ts +0 -144
- package/src/transport/implementation.ts +0 -27
- package/src/transport/interface.ts +0 -28
- package/tsconfig.json +0 -25
- package/tslint.json +0 -12
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var uuid = require('uuid');
|
|
6
|
+
var globalAxios = require('axios');
|
|
7
|
+
|
|
8
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
+
|
|
10
|
+
var globalAxios__default = /*#__PURE__*/_interopDefaultLegacy(globalAxios);
|
|
11
|
+
|
|
12
|
+
/*! *****************************************************************************
|
|
13
|
+
Copyright (c) Microsoft Corporation.
|
|
14
|
+
|
|
15
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
16
|
+
purpose with or without fee is hereby granted.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
19
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
21
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
22
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
23
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
24
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
25
|
+
***************************************************************************** */
|
|
26
|
+
/* global Reflect, Promise */
|
|
27
|
+
|
|
28
|
+
var extendStatics = function(d, b) {
|
|
29
|
+
extendStatics = Object.setPrototypeOf ||
|
|
30
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
31
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
32
|
+
return extendStatics(d, b);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
function __extends(d, b) {
|
|
36
|
+
extendStatics(d, b);
|
|
37
|
+
function __() { this.constructor = d; }
|
|
38
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var __assign = function() {
|
|
42
|
+
__assign = Object.assign || function __assign(t) {
|
|
43
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
44
|
+
s = arguments[i];
|
|
45
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
46
|
+
}
|
|
47
|
+
return t;
|
|
48
|
+
};
|
|
49
|
+
return __assign.apply(this, arguments);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
function __rest(s, e) {
|
|
53
|
+
var t = {};
|
|
54
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
55
|
+
t[p] = s[p];
|
|
56
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
57
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
58
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
59
|
+
t[p[i]] = s[p[i]];
|
|
60
|
+
}
|
|
61
|
+
return t;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
65
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
66
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
67
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
68
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
69
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
70
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function __generator(thisArg, body) {
|
|
75
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
76
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
77
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
78
|
+
function step(op) {
|
|
79
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
80
|
+
while (_) try {
|
|
81
|
+
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;
|
|
82
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
83
|
+
switch (op[0]) {
|
|
84
|
+
case 0: case 1: t = op; break;
|
|
85
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
86
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
87
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
88
|
+
default:
|
|
89
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
90
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
91
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
92
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
93
|
+
if (t[2]) _.ops.pop();
|
|
94
|
+
_.trys.pop(); continue;
|
|
95
|
+
}
|
|
96
|
+
op = body.call(thisArg, _);
|
|
97
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
98
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function __values(o) {
|
|
103
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
104
|
+
if (m) return m.call(o);
|
|
105
|
+
if (o && typeof o.length === "number") return {
|
|
106
|
+
next: function () {
|
|
107
|
+
if (o && i >= o.length) o = void 0;
|
|
108
|
+
return { value: o && o[i++], done: !o };
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* tslint:disable */
|
|
115
|
+
var BASE_PATH = "http://localhost:8090".replace(/\/+$/, "");
|
|
116
|
+
/**
|
|
117
|
+
*
|
|
118
|
+
* @export
|
|
119
|
+
* @class BaseAPI
|
|
120
|
+
*/
|
|
121
|
+
var BaseAPI = /** @class */ (function () {
|
|
122
|
+
function BaseAPI(configuration, basePath, axios) {
|
|
123
|
+
if (basePath === void 0) { basePath = BASE_PATH; }
|
|
124
|
+
if (axios === void 0) { axios = globalAxios__default["default"]; }
|
|
125
|
+
this.basePath = basePath;
|
|
126
|
+
this.axios = axios;
|
|
127
|
+
if (configuration) {
|
|
128
|
+
this.configuration = configuration;
|
|
129
|
+
this.basePath = configuration.basePath || this.basePath;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return BaseAPI;
|
|
133
|
+
}());
|
|
134
|
+
/**
|
|
135
|
+
*
|
|
136
|
+
* @export
|
|
137
|
+
* @class RequiredError
|
|
138
|
+
* @extends {Error}
|
|
139
|
+
*/
|
|
140
|
+
var RequiredError = /** @class */ (function (_super) {
|
|
141
|
+
__extends(RequiredError, _super);
|
|
142
|
+
function RequiredError(field, msg) {
|
|
143
|
+
var _this = _super.call(this, msg) || this;
|
|
144
|
+
_this.field = field;
|
|
145
|
+
_this.name = "RequiredError";
|
|
146
|
+
return _this;
|
|
147
|
+
}
|
|
148
|
+
return RequiredError;
|
|
149
|
+
}(Error));
|
|
150
|
+
|
|
151
|
+
/* tslint:disable */
|
|
152
|
+
/**
|
|
153
|
+
*
|
|
154
|
+
* @export
|
|
155
|
+
*/
|
|
156
|
+
var DUMMY_BASE_URL = 'https://example.com';
|
|
157
|
+
/**
|
|
158
|
+
*
|
|
159
|
+
* @throws {RequiredError}
|
|
160
|
+
* @export
|
|
161
|
+
*/
|
|
162
|
+
var assertParamExists = function (functionName, paramName, paramValue) {
|
|
163
|
+
if (paramValue === null || paramValue === undefined) {
|
|
164
|
+
throw new RequiredError(paramName, "Required parameter ".concat(paramName, " was null or undefined when calling ").concat(functionName, "."));
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
*
|
|
169
|
+
* @export
|
|
170
|
+
*/
|
|
171
|
+
var setSearchParams = function (url) {
|
|
172
|
+
var e_1, _a, e_2, _b;
|
|
173
|
+
var objects = [];
|
|
174
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
175
|
+
objects[_i - 1] = arguments[_i];
|
|
176
|
+
}
|
|
177
|
+
var searchParams = new URLSearchParams(url.search);
|
|
178
|
+
try {
|
|
179
|
+
for (var objects_1 = __values(objects), objects_1_1 = objects_1.next(); !objects_1_1.done; objects_1_1 = objects_1.next()) {
|
|
180
|
+
var object = objects_1_1.value;
|
|
181
|
+
for (var key in object) {
|
|
182
|
+
if (Array.isArray(object[key])) {
|
|
183
|
+
searchParams["delete"](key);
|
|
184
|
+
try {
|
|
185
|
+
for (var _c = (e_2 = void 0, __values(object[key])), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
186
|
+
var item = _d.value;
|
|
187
|
+
searchParams.append(key, item);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
191
|
+
finally {
|
|
192
|
+
try {
|
|
193
|
+
if (_d && !_d.done && (_b = _c["return"])) _b.call(_c);
|
|
194
|
+
}
|
|
195
|
+
finally { if (e_2) throw e_2.error; }
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
searchParams.set(key, object[key]);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
205
|
+
finally {
|
|
206
|
+
try {
|
|
207
|
+
if (objects_1_1 && !objects_1_1.done && (_a = objects_1["return"])) _a.call(objects_1);
|
|
208
|
+
}
|
|
209
|
+
finally { if (e_1) throw e_1.error; }
|
|
210
|
+
}
|
|
211
|
+
url.search = searchParams.toString();
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
*
|
|
215
|
+
* @export
|
|
216
|
+
*/
|
|
217
|
+
var serializeDataIfNeeded = function (value, requestOptions, configuration) {
|
|
218
|
+
var nonString = typeof value !== 'string';
|
|
219
|
+
var needsSerialization = nonString && configuration && configuration.isJsonMime
|
|
220
|
+
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
|
|
221
|
+
: nonString;
|
|
222
|
+
return needsSerialization
|
|
223
|
+
? JSON.stringify(value !== undefined ? value : {})
|
|
224
|
+
: (value || "");
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
*
|
|
228
|
+
* @export
|
|
229
|
+
*/
|
|
230
|
+
var toPathString = function (url) {
|
|
231
|
+
return url.pathname + url.search + url.hash;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
*
|
|
235
|
+
* @export
|
|
236
|
+
*/
|
|
237
|
+
var createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
|
|
238
|
+
return function (axios, basePath) {
|
|
239
|
+
if (axios === void 0) { axios = globalAxios; }
|
|
240
|
+
if (basePath === void 0) { basePath = BASE_PATH; }
|
|
241
|
+
var axiosRequestArgs = __assign(__assign({}, axiosArgs.options), { url: ((configuration === null || configuration === void 0 ? void 0 : configuration.basePath) || basePath) + axiosArgs.url });
|
|
242
|
+
return axios.request(axiosRequestArgs);
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
/* tslint:disable */
|
|
247
|
+
/**
|
|
248
|
+
* DefaultApi - axios parameter creator
|
|
249
|
+
* @export
|
|
250
|
+
*/
|
|
251
|
+
var DefaultApiAxiosParamCreator = function (configuration) {
|
|
252
|
+
var _this = this;
|
|
253
|
+
return {
|
|
254
|
+
/**
|
|
255
|
+
*
|
|
256
|
+
* @summary Creates Audit Log event
|
|
257
|
+
* @param {InlineObject} inlineObject
|
|
258
|
+
* @param {*} [options] Override http request option.
|
|
259
|
+
* @throws {RequiredError}
|
|
260
|
+
*/
|
|
261
|
+
v1LogPost: function (inlineObject, options) {
|
|
262
|
+
if (options === void 0) { options = {}; }
|
|
263
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
264
|
+
var localVarPath, localVarUrlObj, baseOptions, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
|
|
265
|
+
return __generator(this, function (_a) {
|
|
266
|
+
// verify required parameter 'inlineObject' is not null or undefined
|
|
267
|
+
assertParamExists('v1LogPost', 'inlineObject', inlineObject);
|
|
268
|
+
localVarPath = "/v1/log";
|
|
269
|
+
localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
270
|
+
if (configuration) {
|
|
271
|
+
baseOptions = configuration.baseOptions;
|
|
272
|
+
}
|
|
273
|
+
localVarRequestOptions = __assign(__assign({ method: 'POST' }, baseOptions), options);
|
|
274
|
+
localVarHeaderParameter = {};
|
|
275
|
+
localVarQueryParameter = {};
|
|
276
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
277
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
278
|
+
headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
279
|
+
localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
|
|
280
|
+
localVarRequestOptions.data = serializeDataIfNeeded(inlineObject, localVarRequestOptions, configuration);
|
|
281
|
+
return [2 /*return*/, {
|
|
282
|
+
url: toPathString(localVarUrlObj),
|
|
283
|
+
options: localVarRequestOptions
|
|
284
|
+
}];
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* DefaultApi - functional programming interface
|
|
292
|
+
* @export
|
|
293
|
+
*/
|
|
294
|
+
var DefaultApiFp = function (configuration) {
|
|
295
|
+
var localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration);
|
|
296
|
+
return {
|
|
297
|
+
/**
|
|
298
|
+
*
|
|
299
|
+
* @summary Creates Audit Log event
|
|
300
|
+
* @param {InlineObject} inlineObject
|
|
301
|
+
* @param {*} [options] Override http request option.
|
|
302
|
+
* @throws {RequiredError}
|
|
303
|
+
*/
|
|
304
|
+
v1LogPost: function (inlineObject, options) {
|
|
305
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
306
|
+
var localVarAxiosArgs;
|
|
307
|
+
return __generator(this, function (_a) {
|
|
308
|
+
switch (_a.label) {
|
|
309
|
+
case 0: return [4 /*yield*/, localVarAxiosParamCreator.v1LogPost(inlineObject, options)];
|
|
310
|
+
case 1:
|
|
311
|
+
localVarAxiosArgs = _a.sent();
|
|
312
|
+
return [2 /*return*/, createRequestFunction(localVarAxiosArgs, globalAxios__default["default"], BASE_PATH, configuration)];
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* DefaultApi - object-oriented interface
|
|
321
|
+
* @export
|
|
322
|
+
* @class DefaultApi
|
|
323
|
+
* @extends {BaseAPI}
|
|
324
|
+
*/
|
|
325
|
+
var DefaultApi = /** @class */ (function (_super) {
|
|
326
|
+
__extends(DefaultApi, _super);
|
|
327
|
+
function DefaultApi() {
|
|
328
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
*
|
|
332
|
+
* @summary Creates Audit Log event
|
|
333
|
+
* @param {InlineObject} inlineObject
|
|
334
|
+
* @param {*} [options] Override http request option.
|
|
335
|
+
* @throws {RequiredError}
|
|
336
|
+
* @memberof DefaultApi
|
|
337
|
+
*/
|
|
338
|
+
DefaultApi.prototype.v1LogPost = function (inlineObject, options) {
|
|
339
|
+
var _this = this;
|
|
340
|
+
return DefaultApiFp(this.configuration).v1LogPost(inlineObject, options).then(function (request) { return request(_this.axios, _this.basePath); });
|
|
341
|
+
};
|
|
342
|
+
return DefaultApi;
|
|
343
|
+
}(BaseAPI));
|
|
344
|
+
|
|
345
|
+
var isAxiosError = function (err) {
|
|
346
|
+
return 'isAxiosError' in err && err.isAxiosError && err instanceof Error;
|
|
347
|
+
};
|
|
348
|
+
var Transport = /** @class */ (function () {
|
|
349
|
+
function Transport(apiUrl) {
|
|
350
|
+
this.apiUrl = apiUrl;
|
|
351
|
+
this.api = new DefaultApi({
|
|
352
|
+
basePath: this.apiUrl,
|
|
353
|
+
isJsonMime: function (mime) {
|
|
354
|
+
// eslint-disable-next-line security/detect-unsafe-regex
|
|
355
|
+
var jsonMime = new RegExp(
|
|
356
|
+
// eslint-disable-next-line no-control-regex
|
|
357
|
+
'^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
|
358
|
+
return (mime !== null &&
|
|
359
|
+
(jsonMime.test(mime) ||
|
|
360
|
+
mime.toLowerCase() === 'application/json-patch+json'));
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
Transport.prototype.create = function (auditLogData) {
|
|
365
|
+
var _a;
|
|
366
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
367
|
+
var err_1, message;
|
|
368
|
+
return __generator(this, function (_b) {
|
|
369
|
+
switch (_b.label) {
|
|
370
|
+
case 0:
|
|
371
|
+
_b.trys.push([0, 2, , 3]);
|
|
372
|
+
return [4 /*yield*/, this.api.v1LogPost(auditLogData)];
|
|
373
|
+
case 1:
|
|
374
|
+
_b.sent();
|
|
375
|
+
return [3 /*break*/, 3];
|
|
376
|
+
case 2:
|
|
377
|
+
err_1 = _b.sent();
|
|
378
|
+
if (!isAxiosError(err_1)) {
|
|
379
|
+
throw err_1;
|
|
380
|
+
}
|
|
381
|
+
message = ((_a = err_1.response) === null || _a === void 0 ? void 0 : _a.data) || err_1.message;
|
|
382
|
+
throw new Error(message);
|
|
383
|
+
case 3: return [2 /*return*/];
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
};
|
|
388
|
+
return Transport;
|
|
389
|
+
}());
|
|
390
|
+
|
|
391
|
+
var AuditLogger = /** @class */ (function () {
|
|
392
|
+
function AuditLogger(params) {
|
|
393
|
+
this.params = params;
|
|
394
|
+
this.transport = new Transport(params.apiUrl);
|
|
395
|
+
}
|
|
396
|
+
AuditLogger.prototype.log = function (_a) {
|
|
397
|
+
var scope = _a.scope, account = _a.account, data = __rest(_a, ["scope", "account"]);
|
|
398
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
399
|
+
var uuid$1, _b, environment, service, timestamp, log;
|
|
400
|
+
return __generator(this, function (_c) {
|
|
401
|
+
switch (_c.label) {
|
|
402
|
+
case 0:
|
|
403
|
+
uuid$1 = uuid.v4();
|
|
404
|
+
_b = this.params, environment = _b.environment, service = _b.service;
|
|
405
|
+
timestamp = Math.floor(Date.now() / 1000);
|
|
406
|
+
log = __assign(__assign(__assign(__assign({}, data), account), { service: service, id: uuid$1, environment: environment, timestamp: timestamp }), (scope && { scope: scope }));
|
|
407
|
+
return [4 /*yield*/, this.transport.create(log)];
|
|
408
|
+
case 1:
|
|
409
|
+
_c.sent();
|
|
410
|
+
return [2 /*return*/];
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
});
|
|
414
|
+
};
|
|
415
|
+
return AuditLogger;
|
|
416
|
+
}());
|
|
417
|
+
|
|
418
|
+
exports.AuditLogger = AuditLogger;
|
|
419
|
+
//# 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\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.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":["globalAxios","uuid","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,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF;AACO,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE;AAChC,IAAI,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACxB,IAAI,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,EAAE;AAC3C,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;AACzF,CAAC;AACD;AACO,IAAI,QAAQ,GAAG,WAAW;AACjC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,QAAQ,CAAC,CAAC,EAAE;AACrD,QAAQ,KAAK,IAAI,CAAC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K,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/package.json
CHANGED
|
@@ -1,34 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payfit/audit-log",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/PayFit/audit-logs.git",
|
|
7
|
+
"directory": "sdk"
|
|
8
|
+
},
|
|
4
9
|
"description": "Library to handle audit logs at Payfit",
|
|
5
|
-
"main": "dist/index.js",
|
|
10
|
+
"main": "dist/node/index.js",
|
|
11
|
+
"module": "dist/es/index.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
6
13
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
14
|
+
"generate": "openapi-generator-cli generate -i ../pkg/broker/v1/swagger/openapi.json -g typescript-axios -o src/transport/generated -c openapi-codegen-config.yml",
|
|
15
|
+
"build": "rimraf dist && rollup --config node:@payfit/rollup-config",
|
|
16
|
+
"prepack": "npm run build",
|
|
17
|
+
"lint": "eslint .",
|
|
18
|
+
"start:playground": "ts-node src/playground.ts",
|
|
19
|
+
"format:check": "prettier --check .",
|
|
20
|
+
"format:fix": "prettier --write .",
|
|
21
|
+
"release": "semantic-release --noCi"
|
|
13
22
|
},
|
|
14
23
|
"author": "",
|
|
15
24
|
"license": "ISC",
|
|
16
25
|
"dependencies": {
|
|
17
|
-
"axios": "0.24.0",
|
|
26
|
+
"axios": "^0.24.0",
|
|
18
27
|
"lodash": "^4.17.20",
|
|
19
|
-
"uuid": "^
|
|
28
|
+
"uuid": "^8.3.2"
|
|
20
29
|
},
|
|
21
30
|
"devDependencies": {
|
|
22
31
|
"@openapitools/openapi-generator-cli": "2.4.18",
|
|
23
|
-
"@
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
32
|
+
"@payfit/browserslist-config": "1.1.1",
|
|
33
|
+
"@payfit/eslint-config": "0.11.0",
|
|
34
|
+
"@payfit/rollup-config": "1.4.0",
|
|
35
|
+
"@payfit/semantic-release-package-config": "6.6.0",
|
|
36
|
+
"@payfit/tsconfig": "0.4.0",
|
|
37
|
+
"@types/lodash": "4.14.178",
|
|
38
|
+
"@types/node": "17.0.0",
|
|
39
|
+
"@types/uuid": "8.3.3",
|
|
40
|
+
"eslint": "8.4.1",
|
|
26
41
|
"prettier": "2.5.1",
|
|
27
42
|
"rimraf": "3.0.2",
|
|
43
|
+
"semantic-release": "18.0.1",
|
|
28
44
|
"ts-node": "10.4.0",
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
}
|
|
45
|
+
"typescript": "4.5.4"
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"registry": "https://registry.npmjs.org/"
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"dist"
|
|
52
|
+
]
|
|
34
53
|
}
|
package/.prettierrc
DELETED
package/CHANGELOG.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
## 1.0.5 (2020/06/03)
|
|
2
|
-
|
|
3
|
-
- Fix an error with audit log timestamp format (#37)
|
|
4
|
-
|
|
5
|
-
## 1.0.4 (2020/04/02)
|
|
6
|
-
|
|
7
|
-
- Better error handling (#18)
|
|
8
|
-
- Use TS 3.7 (#18)
|
|
9
|
-
- Add individualId to scope (#18)
|
|
10
|
-
|
|
11
|
-
## 1.0.3 (2020/04/01)
|
|
12
|
-
|
|
13
|
-
First working version in prod
|
package/dist/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
-
var t = {};
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
-
t[p[i]] = s[p[i]];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.AuditLogger = void 0;
|
|
24
|
-
const uuid_1 = require("uuid");
|
|
25
|
-
const implementation_1 = require("./transport/implementation");
|
|
26
|
-
class AuditLogger {
|
|
27
|
-
constructor(params) {
|
|
28
|
-
this.params = params;
|
|
29
|
-
this.transport = new implementation_1.Transport(params.apiUrl);
|
|
30
|
-
}
|
|
31
|
-
log(_a) {
|
|
32
|
-
var { scope, account } = _a, data = __rest(_a, ["scope", "account"]);
|
|
33
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
const uuid = uuid_1.v4();
|
|
35
|
-
const { environment, service } = this.params;
|
|
36
|
-
const timestamp = Math.floor(Date.now() / 1000);
|
|
37
|
-
const log = Object.assign(Object.assign(Object.assign(Object.assign({}, data), account), { service, id: uuid, environment,
|
|
38
|
-
timestamp }), (scope && { scope }));
|
|
39
|
-
yield this.transport.create(log);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.AuditLogger = AuditLogger;
|
|
44
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAmC;AAEnC,+DAAsD;AA4KtD,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"}
|