@payfit/audit-log 2.0.0 → 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.
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 -16
  4. package/dist/node/index.js +419 -0
  5. package/dist/node/index.js.map +1 -0
  6. package/package.json +37 -18
  7. package/.prettierrc +0 -5
  8. package/CHANGELOG.md +0 -13
  9. package/dist/index.js +0 -55
  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 -205
  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
@@ -1,70 +0,0 @@
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:8090".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
- }
@@ -1,75 +0,0 @@
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 | Promise<string> | ((name: string) => string) | ((name: string) => Promise<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 | Promise<string> | ((name: string) => string) | ((name: string) => Promise<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
- }
@@ -1,58 +0,0 @@
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
-
@@ -1,16 +0,0 @@
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";
@@ -1 +0,0 @@
1
- export * from './inline-object';
@@ -1,144 +0,0 @@
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 target
72
- * @type {string}
73
- * @memberof InlineObject
74
- */
75
- target: string;
76
- /**
77
- * Audit log event environment, only required when in todd context
78
- * @type {string}
79
- * @memberof InlineObject
80
- */
81
- environment?: string;
82
- /**
83
- * holdingId of the account performing the event
84
- * @type {string}
85
- * @memberof InlineObject
86
- */
87
- holdingId?: string;
88
- /**
89
- * companyId of the account performing the event
90
- * @type {string}
91
- * @memberof InlineObject
92
- */
93
- companyId?: string;
94
- /**
95
- * employeeId of the account performing the event
96
- * @type {string}
97
- * @memberof InlineObject
98
- */
99
- employeeId?: string;
100
- /**
101
- * individualId of the account performing the event
102
- * @type {string}
103
- * @memberof InlineObject
104
- */
105
- individualId?: string;
106
- /**
107
- * roleId of the account performing the event
108
- * @type {string}
109
- * @memberof InlineObject
110
- */
111
- roleId?: string;
112
- /**
113
- * userIp of the account performing the event
114
- * @type {string}
115
- * @memberof InlineObject
116
- */
117
- userIp?: string;
118
- /**
119
- * specialRole of the account performing the event
120
- * @type {string}
121
- * @memberof InlineObject
122
- */
123
- specialRole?: string;
124
- /**
125
- * email of the account performing the event
126
- * @type {string}
127
- * @memberof InlineObject
128
- */
129
- email?: string;
130
- /**
131
- * Audit log event scope
132
- * @type {object}
133
- * @memberof InlineObject
134
- */
135
- scope?: object;
136
- /**
137
- * Audit log event timestamp unix format
138
- * @type {number}
139
- * @memberof InlineObject
140
- */
141
- timestamp: number;
142
- }
143
-
144
-
@@ -1,27 +0,0 @@
1
- import { DefaultApi } from './generated'
2
- import { InlineObject } from './generated/model'
3
-
4
- import { IAuditLogTransport } from './interface'
5
-
6
- export class Transport implements IAuditLogTransport {
7
- api: DefaultApi
8
-
9
- constructor(protected apiUrl: string) {
10
- this.api = new DefaultApi({
11
- basePath: this.apiUrl,
12
- })
13
- }
14
-
15
- async create(auditLogData: InlineObject) {
16
- try {
17
- await this.api.v1LogPost(auditLogData)
18
- } catch (err) {
19
- if (!err.isAxiosError) {
20
- throw err
21
- }
22
-
23
- const message = err.response?.data || err.message
24
- throw new Error(message)
25
- }
26
- }
27
- }
@@ -1,28 +0,0 @@
1
- import { IAuditLogData } from '..'
2
-
3
- export type IAuditLogCreationData = {
4
- id: string
5
- timestamp: number
6
- environment: string
7
- service: string
8
- scope?: object
9
- countryCode?: string
10
- payload?: object
11
- internalId?: string
12
- isSystem?: boolean
13
- namespace: string
14
- event: string
15
- target: string
16
- holdingId?: string
17
- companyId?: string
18
- employeeId?: string
19
- individualId?: string
20
- roleId?: string
21
- userIp?: string
22
- specialRole?: string
23
- email?: string
24
- }
25
-
26
- export interface IAuditLogTransport {
27
- create: (data: IAuditLogCreationData) => Promise<void>
28
- }
package/tsconfig.json DELETED
@@ -1,25 +0,0 @@
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 DELETED
@@ -1,12 +0,0 @@
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
- }