@payfit/audit-log 1.0.0-rc.98 → 1.0.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/.prettierrc +5 -0
- package/README.md +8 -10
- package/dist/index.d.ts +8 -27
- package/dist/index.js +30 -1
- package/dist/index.js.map +1 -0
- package/dist/transport/generated/api/default-api.d.ts +7 -7
- package/dist/transport/generated/api/default-api.js +131 -0
- package/dist/transport/generated/api/default-api.js.map +1 -0
- package/dist/transport/generated/api.js +19 -0
- package/dist/transport/generated/api.js.map +1 -0
- package/dist/transport/generated/base.d.ts +2 -2
- package/dist/transport/generated/base.js +63 -0
- package/dist/transport/generated/base.js.map +1 -0
- package/dist/transport/generated/configuration.d.ts +4 -24
- package/dist/transport/generated/configuration.js +26 -0
- package/dist/transport/generated/configuration.js.map +1 -0
- package/dist/transport/generated/index.d.ts +0 -1
- package/dist/transport/generated/index.js +20 -0
- package/dist/transport/generated/index.js.map +1 -0
- package/dist/transport/generated/model/index.js +3 -0
- package/dist/transport/generated/model/index.js.map +1 -0
- package/dist/transport/generated/model/inline-object.d.ts +18 -36
- package/dist/transport/generated/model/inline-object.js +15 -0
- package/dist/transport/generated/model/inline-object.js.map +1 -0
- package/dist/transport/implementation.d.ts +4 -4
- package/dist/transport/implementation.js +39 -0
- package/dist/transport/implementation.js.map +1 -0
- package/dist/transport/interface.d.ts +3 -18
- package/dist/transport/interface.js +3 -0
- package/dist/transport/interface.js.map +1 -0
- package/openapi-codegen-config.yml +6 -0
- package/package.json +19 -46
- package/playground/index.ts +29 -0
- package/src/index.ts +120 -0
- package/src/transport/generated/.openapi-generator/VERSION +1 -0
- package/src/transport/generated/.openapi-generator-ignore +23 -0
- package/src/transport/generated/api/default-api.ts +131 -0
- package/src/transport/generated/api.ts +17 -0
- package/src/transport/generated/base.ts +70 -0
- package/src/transport/generated/configuration.ts +75 -0
- package/src/transport/generated/git_push.sh +58 -0
- package/src/transport/generated/index.ts +16 -0
- package/src/transport/generated/model/index.ts +1 -0
- package/src/transport/generated/model/inline-object.ts +126 -0
- package/src/transport/implementation.ts +23 -0
- package/src/transport/interface.ts +12 -0
- package/tsconfig.json +25 -0
- package/tslint.json +12 -0
- package/dist/index.mjs +0 -149
- package/dist/playground.d.ts +0 -1
- package/dist/transport/generated/common.d.ts +0 -65
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// tslint:disable
|
|
2
|
+
/**
|
|
3
|
+
* Audit Logs
|
|
4
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
+
*
|
|
6
|
+
* The version of the OpenAPI document: 1.0.0
|
|
7
|
+
* Contact: damian.bursztyn@payfit.com
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
10
|
+
* https://openapi-generator.tech
|
|
11
|
+
* Do not edit the class manually.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
import { Configuration } from "./configuration";
|
|
16
|
+
// Some imports not used depending on template conditions
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
|
|
19
|
+
|
|
20
|
+
export const BASE_PATH = "http://localhost:8081/v1".replace(/\/+$/, "");
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @export
|
|
25
|
+
*/
|
|
26
|
+
export const COLLECTION_FORMATS = {
|
|
27
|
+
csv: ",",
|
|
28
|
+
ssv: " ",
|
|
29
|
+
tsv: "\t",
|
|
30
|
+
pipes: "|",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @export
|
|
36
|
+
* @interface RequestArgs
|
|
37
|
+
*/
|
|
38
|
+
export interface RequestArgs {
|
|
39
|
+
url: string;
|
|
40
|
+
options: any;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @export
|
|
46
|
+
* @class BaseAPI
|
|
47
|
+
*/
|
|
48
|
+
export class BaseAPI {
|
|
49
|
+
protected configuration: Configuration | undefined;
|
|
50
|
+
|
|
51
|
+
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
|
|
52
|
+
if (configuration) {
|
|
53
|
+
this.configuration = configuration;
|
|
54
|
+
this.basePath = configuration.basePath || this.basePath;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @export
|
|
62
|
+
* @class RequiredError
|
|
63
|
+
* @extends {Error}
|
|
64
|
+
*/
|
|
65
|
+
export class RequiredError extends Error {
|
|
66
|
+
name: "RequiredError" = "RequiredError";
|
|
67
|
+
constructor(public field: string, msg?: string) {
|
|
68
|
+
super(msg);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// tslint:disable
|
|
2
|
+
/**
|
|
3
|
+
* Audit Logs
|
|
4
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
+
*
|
|
6
|
+
* The version of the OpenAPI document: 1.0.0
|
|
7
|
+
* Contact: damian.bursztyn@payfit.com
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
10
|
+
* https://openapi-generator.tech
|
|
11
|
+
* Do not edit the class manually.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export interface ConfigurationParameters {
|
|
16
|
+
apiKey?: string | ((name: string) => string);
|
|
17
|
+
username?: string;
|
|
18
|
+
password?: string;
|
|
19
|
+
accessToken?: string | ((name?: string, scopes?: string[]) => string);
|
|
20
|
+
basePath?: string;
|
|
21
|
+
baseOptions?: any;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class Configuration {
|
|
25
|
+
/**
|
|
26
|
+
* parameter for apiKey security
|
|
27
|
+
* @param name security name
|
|
28
|
+
* @memberof Configuration
|
|
29
|
+
*/
|
|
30
|
+
apiKey?: string | ((name: string) => string);
|
|
31
|
+
/**
|
|
32
|
+
* parameter for basic security
|
|
33
|
+
*
|
|
34
|
+
* @type {string}
|
|
35
|
+
* @memberof Configuration
|
|
36
|
+
*/
|
|
37
|
+
username?: string;
|
|
38
|
+
/**
|
|
39
|
+
* parameter for basic security
|
|
40
|
+
*
|
|
41
|
+
* @type {string}
|
|
42
|
+
* @memberof Configuration
|
|
43
|
+
*/
|
|
44
|
+
password?: string;
|
|
45
|
+
/**
|
|
46
|
+
* parameter for oauth2 security
|
|
47
|
+
* @param name security name
|
|
48
|
+
* @param scopes oauth2 scope
|
|
49
|
+
* @memberof Configuration
|
|
50
|
+
*/
|
|
51
|
+
accessToken?: string | ((name?: string, scopes?: string[]) => string);
|
|
52
|
+
/**
|
|
53
|
+
* override base path
|
|
54
|
+
*
|
|
55
|
+
* @type {string}
|
|
56
|
+
* @memberof Configuration
|
|
57
|
+
*/
|
|
58
|
+
basePath?: string;
|
|
59
|
+
/**
|
|
60
|
+
* base options for axios calls
|
|
61
|
+
*
|
|
62
|
+
* @type {any}
|
|
63
|
+
* @memberof Configuration
|
|
64
|
+
*/
|
|
65
|
+
baseOptions?: any;
|
|
66
|
+
|
|
67
|
+
constructor(param: ConfigurationParameters = {}) {
|
|
68
|
+
this.apiKey = param.apiKey;
|
|
69
|
+
this.username = param.username;
|
|
70
|
+
this.password = param.password;
|
|
71
|
+
this.accessToken = param.accessToken;
|
|
72
|
+
this.basePath = param.basePath;
|
|
73
|
+
this.baseOptions = param.baseOptions;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
|
3
|
+
#
|
|
4
|
+
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
|
|
5
|
+
|
|
6
|
+
git_user_id=$1
|
|
7
|
+
git_repo_id=$2
|
|
8
|
+
release_note=$3
|
|
9
|
+
git_host=$4
|
|
10
|
+
|
|
11
|
+
if [ "$git_host" = "" ]; then
|
|
12
|
+
git_host="github.com"
|
|
13
|
+
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
if [ "$git_user_id" = "" ]; then
|
|
17
|
+
git_user_id="GIT_USER_ID"
|
|
18
|
+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
if [ "$git_repo_id" = "" ]; then
|
|
22
|
+
git_repo_id="GIT_REPO_ID"
|
|
23
|
+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
if [ "$release_note" = "" ]; then
|
|
27
|
+
release_note="Minor update"
|
|
28
|
+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# Initialize the local directory as a Git repository
|
|
32
|
+
git init
|
|
33
|
+
|
|
34
|
+
# Adds the files in the local repository and stages them for commit.
|
|
35
|
+
git add .
|
|
36
|
+
|
|
37
|
+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
|
38
|
+
git commit -m "$release_note"
|
|
39
|
+
|
|
40
|
+
# Sets the new remote
|
|
41
|
+
git_remote=`git remote`
|
|
42
|
+
if [ "$git_remote" = "" ]; then # git remote not defined
|
|
43
|
+
|
|
44
|
+
if [ "$GIT_TOKEN" = "" ]; then
|
|
45
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
|
46
|
+
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
|
47
|
+
else
|
|
48
|
+
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
git pull origin master
|
|
54
|
+
|
|
55
|
+
# Pushes (Forces) the changes in the local repository up to the remote repository
|
|
56
|
+
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
|
57
|
+
git push origin master 2>&1 | grep -v 'To https'
|
|
58
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// tslint:disable
|
|
2
|
+
/**
|
|
3
|
+
* Audit Logs
|
|
4
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
+
*
|
|
6
|
+
* The version of the OpenAPI document: 1.0.0
|
|
7
|
+
* Contact: damian.bursztyn@payfit.com
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
10
|
+
* https://openapi-generator.tech
|
|
11
|
+
* Do not edit the class manually.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export * from "./api";
|
|
16
|
+
export * from "./configuration";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './inline-object';
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// tslint:disable
|
|
2
|
+
/**
|
|
3
|
+
* Audit Logs
|
|
4
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
5
|
+
*
|
|
6
|
+
* The version of the OpenAPI document: 1.0.0
|
|
7
|
+
* Contact: damian.bursztyn@payfit.com
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
10
|
+
* https://openapi-generator.tech
|
|
11
|
+
* Do not edit the class manually.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @export
|
|
19
|
+
* @interface InlineObject
|
|
20
|
+
*/
|
|
21
|
+
export interface InlineObject {
|
|
22
|
+
/**
|
|
23
|
+
* Audit log event unique identifier
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @memberof InlineObject
|
|
26
|
+
*/
|
|
27
|
+
id: string;
|
|
28
|
+
/**
|
|
29
|
+
* Audit log event country code
|
|
30
|
+
* @type {string}
|
|
31
|
+
* @memberof InlineObject
|
|
32
|
+
*/
|
|
33
|
+
countryCode?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Audit log event payload
|
|
36
|
+
* @type {object}
|
|
37
|
+
* @memberof InlineObject
|
|
38
|
+
*/
|
|
39
|
+
payload?: object;
|
|
40
|
+
/**
|
|
41
|
+
* id of the payfiter who performed the audit log action, if signed as.
|
|
42
|
+
* @type {string}
|
|
43
|
+
* @memberof InlineObject
|
|
44
|
+
*/
|
|
45
|
+
internalId?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Tells whether the logged action has been made by the system
|
|
48
|
+
* @type {boolean}
|
|
49
|
+
* @memberof InlineObject
|
|
50
|
+
*/
|
|
51
|
+
isSystem?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Audit log event namespace (business related)
|
|
54
|
+
* @type {string}
|
|
55
|
+
* @memberof InlineObject
|
|
56
|
+
*/
|
|
57
|
+
namespace: string;
|
|
58
|
+
/**
|
|
59
|
+
* Audit log event namespace (technical related)
|
|
60
|
+
* @type {string}
|
|
61
|
+
* @memberof InlineObject
|
|
62
|
+
*/
|
|
63
|
+
service: string;
|
|
64
|
+
/**
|
|
65
|
+
* Audit log event type
|
|
66
|
+
* @type {string}
|
|
67
|
+
* @memberof InlineObject
|
|
68
|
+
*/
|
|
69
|
+
event?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Audit log event environment
|
|
72
|
+
* @type {string}
|
|
73
|
+
* @memberof InlineObject
|
|
74
|
+
*/
|
|
75
|
+
environment?: string;
|
|
76
|
+
/**
|
|
77
|
+
* holdingId of the account performing the event
|
|
78
|
+
* @type {string}
|
|
79
|
+
* @memberof InlineObject
|
|
80
|
+
*/
|
|
81
|
+
holdingId?: string;
|
|
82
|
+
/**
|
|
83
|
+
* companyId of the account performing the event
|
|
84
|
+
* @type {string}
|
|
85
|
+
* @memberof InlineObject
|
|
86
|
+
*/
|
|
87
|
+
companyId?: string;
|
|
88
|
+
/**
|
|
89
|
+
* employeeId of the account performing the event
|
|
90
|
+
* @type {string}
|
|
91
|
+
* @memberof InlineObject
|
|
92
|
+
*/
|
|
93
|
+
employeeId?: string;
|
|
94
|
+
/**
|
|
95
|
+
* individualId of the account performing the event
|
|
96
|
+
* @type {string}
|
|
97
|
+
* @memberof InlineObject
|
|
98
|
+
*/
|
|
99
|
+
individualId?: string;
|
|
100
|
+
/**
|
|
101
|
+
* roleId of the account performing the event
|
|
102
|
+
* @type {string}
|
|
103
|
+
* @memberof InlineObject
|
|
104
|
+
*/
|
|
105
|
+
roleId?: string;
|
|
106
|
+
/**
|
|
107
|
+
* userIp of the account performing the event
|
|
108
|
+
* @type {string}
|
|
109
|
+
* @memberof InlineObject
|
|
110
|
+
*/
|
|
111
|
+
userIp?: string;
|
|
112
|
+
/**
|
|
113
|
+
* specialRole of the account performing the event
|
|
114
|
+
* @type {string}
|
|
115
|
+
* @memberof InlineObject
|
|
116
|
+
*/
|
|
117
|
+
specialRole?: string;
|
|
118
|
+
/**
|
|
119
|
+
* email of the account performing the event
|
|
120
|
+
* @type {string}
|
|
121
|
+
* @memberof InlineObject
|
|
122
|
+
*/
|
|
123
|
+
email?: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DefaultApi } from './generated'
|
|
2
|
+
import { IAuditLogTransport, IAuditLogCreationData } from './interface'
|
|
3
|
+
|
|
4
|
+
export class Transport implements IAuditLogTransport {
|
|
5
|
+
api: DefaultApi
|
|
6
|
+
|
|
7
|
+
constructor(protected apiUrl: string) {
|
|
8
|
+
this.api = new DefaultApi({
|
|
9
|
+
basePath: this.apiUrl,
|
|
10
|
+
})
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async create(auditLogData: IAuditLogCreationData) {
|
|
14
|
+
const { account, ...logDataWithoutAccount } = auditLogData
|
|
15
|
+
|
|
16
|
+
const dataToSend = {
|
|
17
|
+
...logDataWithoutAccount,
|
|
18
|
+
...account,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
await this.api.v1LogPost(dataToSend)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IAuditLogData } from '..'
|
|
2
|
+
|
|
3
|
+
export type IAuditLogCreationData = IAuditLogData & {
|
|
4
|
+
id: string
|
|
5
|
+
timestamp: number
|
|
6
|
+
environment: string
|
|
7
|
+
service: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IAuditLogTransport {
|
|
11
|
+
create: (data: IAuditLogCreationData) => Promise<void>
|
|
12
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"declaration": true,
|
|
4
|
+
"target": "es6",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"lib": ["es7", "esnext.asynciterable", "es2017"],
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"outDir": "./dist",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"noImplicitAny": true,
|
|
11
|
+
"strictNullChecks": true,
|
|
12
|
+
"noImplicitThis": true,
|
|
13
|
+
"alwaysStrict": true,
|
|
14
|
+
"noImplicitReturns": true,
|
|
15
|
+
"noFallthroughCasesInSwitch": true,
|
|
16
|
+
"moduleResolution": "node",
|
|
17
|
+
"baseUrl": "src",
|
|
18
|
+
"paths": {
|
|
19
|
+
"*": ["*"]
|
|
20
|
+
},
|
|
21
|
+
"esModuleInterop": true
|
|
22
|
+
},
|
|
23
|
+
"include": ["./src/**/*"],
|
|
24
|
+
"exclude": ["node_modules", "./src/__tests__/**/*"]
|
|
25
|
+
}
|
package/tslint.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"defaultSeverity": "error",
|
|
3
|
+
"extends": ["tslint:recommended", "tslint-config-prettier"],
|
|
4
|
+
"jsRules": {
|
|
5
|
+
"object-literal-sort-keys": false
|
|
6
|
+
},
|
|
7
|
+
"rules": {
|
|
8
|
+
"one-variable-per-declaration": false,
|
|
9
|
+
"interface-name": false
|
|
10
|
+
},
|
|
11
|
+
"rulesDirectory": []
|
|
12
|
+
}
|
package/dist/index.mjs
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
var u = Object.defineProperty;
|
|
2
|
-
var P = (s, e, t) => e in s ? u(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
-
var n = (s, e, t) => (P(s, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
import { v4 as m } from "uuid";
|
|
5
|
-
import l from "axios";
|
|
6
|
-
const p = "http://localhost:8090".replace(/\/+$/, "");
|
|
7
|
-
class f {
|
|
8
|
-
constructor(e, t = p, o = l) {
|
|
9
|
-
n(this, "basePath");
|
|
10
|
-
n(this, "axios");
|
|
11
|
-
n(this, "configuration");
|
|
12
|
-
this.basePath = t, this.axios = o, e && (this.configuration = e, this.basePath = e.basePath || this.basePath);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
class A extends Error {
|
|
16
|
-
constructor(t, o) {
|
|
17
|
-
super(o);
|
|
18
|
-
n(this, "field");
|
|
19
|
-
n(this, "name", "RequiredError");
|
|
20
|
-
this.field = t;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
const w = "https://example.com", x = function(s, e, t) {
|
|
24
|
-
if (t == null)
|
|
25
|
-
throw new A(e, `Required parameter ${e} was null or undefined when calling ${s}.`);
|
|
26
|
-
}, g = function(s, ...e) {
|
|
27
|
-
const t = new URLSearchParams(s.search);
|
|
28
|
-
for (const o of e)
|
|
29
|
-
for (const r in o)
|
|
30
|
-
if (Array.isArray(o[r])) {
|
|
31
|
-
t.delete(r);
|
|
32
|
-
for (const a of o[r])
|
|
33
|
-
t.append(r, a);
|
|
34
|
-
} else
|
|
35
|
-
t.set(r, o[r]);
|
|
36
|
-
s.search = t.toString();
|
|
37
|
-
}, b = function(s, e, t) {
|
|
38
|
-
const o = typeof s != "string";
|
|
39
|
-
return (o && t && t.isJsonMime ? t.isJsonMime(e.headers["Content-Type"]) : o) ? JSON.stringify(s !== void 0 ? s : {}) : s || "";
|
|
40
|
-
}, y = function(s) {
|
|
41
|
-
return s.pathname + s.search + s.hash;
|
|
42
|
-
}, E = function(s, e, t, o) {
|
|
43
|
-
return (r = e, a = t) => {
|
|
44
|
-
const i = { ...s.options, url: ((o == null ? void 0 : o.basePath) || a) + s.url };
|
|
45
|
-
return r.request(i);
|
|
46
|
-
};
|
|
47
|
-
}, L = function(s) {
|
|
48
|
-
return {
|
|
49
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
* @summary Creates Audit Log event
|
|
52
|
-
* @param {InlineObject} inlineObject
|
|
53
|
-
* @param {*} [options] Override http request option.
|
|
54
|
-
* @throws {RequiredError}
|
|
55
|
-
*/
|
|
56
|
-
v1LogPost: async (e, t = {}) => {
|
|
57
|
-
x("v1LogPost", "inlineObject", e);
|
|
58
|
-
const o = "/v1/log", r = new URL(o, w);
|
|
59
|
-
let a;
|
|
60
|
-
s && (a = s.baseOptions);
|
|
61
|
-
const i = { method: "POST", ...a, ...t }, c = {}, h = {};
|
|
62
|
-
c["Content-Type"] = "application/json", g(r, h);
|
|
63
|
-
let d = a && a.headers ? a.headers : {};
|
|
64
|
-
return i.headers = { ...c, ...d, ...t.headers }, i.data = b(e, i, s), {
|
|
65
|
-
url: y(r),
|
|
66
|
-
options: i
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
}, S = function(s) {
|
|
71
|
-
const e = L(s);
|
|
72
|
-
return {
|
|
73
|
-
/**
|
|
74
|
-
*
|
|
75
|
-
* @summary Creates Audit Log event
|
|
76
|
-
* @param {InlineObject} inlineObject
|
|
77
|
-
* @param {*} [options] Override http request option.
|
|
78
|
-
* @throws {RequiredError}
|
|
79
|
-
*/
|
|
80
|
-
async v1LogPost(t, o) {
|
|
81
|
-
const r = await e.v1LogPost(t, o);
|
|
82
|
-
return E(r, l, p, s);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
class v extends f {
|
|
87
|
-
/**
|
|
88
|
-
*
|
|
89
|
-
* @summary Creates Audit Log event
|
|
90
|
-
* @param {InlineObject} inlineObject
|
|
91
|
-
* @param {*} [options] Override http request option.
|
|
92
|
-
* @throws {RequiredError}
|
|
93
|
-
* @memberof DefaultApi
|
|
94
|
-
*/
|
|
95
|
-
v1LogPost(e, t) {
|
|
96
|
-
return S(this.configuration).v1LogPost(e, t).then((o) => o(this.axios, this.basePath));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
const R = (s) => "isAxiosError" in s && s.isAxiosError && s instanceof Error;
|
|
100
|
-
class U {
|
|
101
|
-
constructor(e) {
|
|
102
|
-
n(this, "apiUrl");
|
|
103
|
-
n(this, "api");
|
|
104
|
-
this.apiUrl = e, this.api = new v({
|
|
105
|
-
basePath: this.apiUrl,
|
|
106
|
-
isJsonMime(t) {
|
|
107
|
-
const o = new RegExp(
|
|
108
|
-
// eslint-disable-next-line no-control-regex
|
|
109
|
-
"^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$",
|
|
110
|
-
"i"
|
|
111
|
-
);
|
|
112
|
-
return t !== null && (o.test(t) || t.toLowerCase() === "application/json-patch+json");
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
async create(e) {
|
|
117
|
-
var t;
|
|
118
|
-
try {
|
|
119
|
-
await this.api.v1LogPost(e, { timeout: 5e3 });
|
|
120
|
-
} catch (o) {
|
|
121
|
-
if (!R(o))
|
|
122
|
-
throw o;
|
|
123
|
-
const r = ((t = o.response) == null ? void 0 : t.data) || o.message;
|
|
124
|
-
throw new Error(r);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
class O {
|
|
129
|
-
constructor(e) {
|
|
130
|
-
n(this, "params");
|
|
131
|
-
n(this, "transport");
|
|
132
|
-
this.params = e, this.transport = new U(e.apiUrl);
|
|
133
|
-
}
|
|
134
|
-
async log({ scope: e, account: t, ...o }) {
|
|
135
|
-
const r = m(), { environment: a, service: i } = this.params, c = Math.floor(Date.now() / 1e3), h = {
|
|
136
|
-
...o,
|
|
137
|
-
...t,
|
|
138
|
-
service: i,
|
|
139
|
-
id: r,
|
|
140
|
-
environment: a,
|
|
141
|
-
timestamp: c,
|
|
142
|
-
...e && { scope: e }
|
|
143
|
-
};
|
|
144
|
-
await this.transport.create(h);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
export {
|
|
148
|
-
O as AuditLogger
|
|
149
|
-
};
|
package/dist/playground.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Audit Logs
|
|
3
|
-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
-
*
|
|
5
|
-
* The version of the OpenAPI document: 1.0.0
|
|
6
|
-
* Contact: damian.bursztyn@payfit.com
|
|
7
|
-
*
|
|
8
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
-
* https://openapi-generator.tech
|
|
10
|
-
* Do not edit the class manually.
|
|
11
|
-
*/
|
|
12
|
-
import { Configuration } from "./configuration";
|
|
13
|
-
import { RequestArgs } from "./base";
|
|
14
|
-
import { AxiosInstance, AxiosResponse } from 'axios';
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* @export
|
|
18
|
-
*/
|
|
19
|
-
export declare const DUMMY_BASE_URL = "https://example.com";
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
* @throws {RequiredError}
|
|
23
|
-
* @export
|
|
24
|
-
*/
|
|
25
|
-
export declare const assertParamExists: (functionName: string, paramName: string, paramValue: unknown) => void;
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @export
|
|
29
|
-
*/
|
|
30
|
-
export declare const setApiKeyToObject: (object: any, keyParamName: string, configuration?: Configuration) => Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
*
|
|
33
|
-
* @export
|
|
34
|
-
*/
|
|
35
|
-
export declare const setBasicAuthToObject: (object: any, configuration?: Configuration) => void;
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
* @export
|
|
39
|
-
*/
|
|
40
|
-
export declare const setBearerAuthToObject: (object: any, configuration?: Configuration) => Promise<void>;
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* @export
|
|
44
|
-
*/
|
|
45
|
-
export declare const setOAuthToObject: (object: any, name: string, scopes: string[], configuration?: Configuration) => Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
48
|
-
* @export
|
|
49
|
-
*/
|
|
50
|
-
export declare const setSearchParams: (url: URL, ...objects: any[]) => void;
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
* @export
|
|
54
|
-
*/
|
|
55
|
-
export declare const serializeDataIfNeeded: (value: any, requestOptions: any, configuration?: Configuration) => any;
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
* @export
|
|
59
|
-
*/
|
|
60
|
-
export declare const toPathString: (url: URL) => string;
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
* @export
|
|
64
|
-
*/
|
|
65
|
-
export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
|