@rasadov/lumoar-sdk 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/.openapi-generator/FILES +60 -0
  2. package/.openapi-generator/VERSION +1 -0
  3. package/.openapi-generator-ignore +23 -0
  4. package/api.ts +5133 -0
  5. package/base.ts +86 -0
  6. package/common.ts +150 -0
  7. package/configuration.ts +228 -0
  8. package/dist/api.d.ts +3329 -0
  9. package/dist/api.js +3498 -0
  10. package/dist/base.d.ts +66 -0
  11. package/dist/base.js +60 -0
  12. package/dist/common.d.ts +65 -0
  13. package/dist/common.js +149 -0
  14. package/dist/configuration.d.ts +125 -0
  15. package/dist/configuration.js +124 -0
  16. package/dist/index.d.ts +13 -0
  17. package/dist/index.js +15 -0
  18. package/docs/AuthApi.md +560 -0
  19. package/docs/AuthenticationSuccess.md +25 -0
  20. package/docs/CheckoutSessionResponse.md +22 -0
  21. package/docs/CompanyApi.md +363 -0
  22. package/docs/CompanyCreate.md +44 -0
  23. package/docs/CompanyInDBBase.md +48 -0
  24. package/docs/CompanyUpdate.md +42 -0
  25. package/docs/CompanyWithControls.md +50 -0
  26. package/docs/CompanyWithRoles.md +50 -0
  27. package/docs/ComplianceGoal.md +8 -0
  28. package/docs/ControlStatus.md +18 -0
  29. package/docs/ControlWithEvidences.md +30 -0
  30. package/docs/ControlWithRelationships.md +32 -0
  31. package/docs/ControlsApi.md +124 -0
  32. package/docs/CustomerDoesNotExist.md +20 -0
  33. package/docs/CustomerPortalSession.md +20 -0
  34. package/docs/DefaultApi.md +183 -0
  35. package/docs/Details.md +20 -0
  36. package/docs/EvidenceApi.md +309 -0
  37. package/docs/EvidenceBase.md +40 -0
  38. package/docs/EvidenceFileSchema.md +32 -0
  39. package/docs/EvidenceTextSchema.md +24 -0
  40. package/docs/FileDownload.md +26 -0
  41. package/docs/FrameworkControlsBase.md +26 -0
  42. package/docs/GetControl.md +22 -0
  43. package/docs/HTTPValidationError.md +20 -0
  44. package/docs/InviteToCompany.md +24 -0
  45. package/docs/LoginSchema.md +25 -0
  46. package/docs/PaymentsApi.md +164 -0
  47. package/docs/PermissionType.md +14 -0
  48. package/docs/PoliciesApi.md +302 -0
  49. package/docs/PolicyCreate.md +26 -0
  50. package/docs/PolicyRead.md +32 -0
  51. package/docs/PolicyUpdate.md +24 -0
  52. package/docs/RegisterSchema.md +31 -0
  53. package/docs/RemoveFromCompany.md +22 -0
  54. package/docs/ResponseGetCheckoutSessionPaymentsCheckoutGet.md +24 -0
  55. package/docs/ResponseGetCustomerManagementSessionPaymentsCustomerManagementGet.md +22 -0
  56. package/docs/RolesApi.md +127 -0
  57. package/docs/RolesWithUser.md +22 -0
  58. package/docs/UpdateControlSchema.md +24 -0
  59. package/docs/UpdatePassword.md +22 -0
  60. package/docs/UserApi.md +280 -0
  61. package/docs/UserBase.md +24 -0
  62. package/docs/UserInDBBase.md +30 -0
  63. package/docs/UserPermissionsWithCompany.md +22 -0
  64. package/docs/UserRole.md +20 -0
  65. package/docs/UserUpdate.md +24 -0
  66. package/docs/UserWithRelations.md +28 -0
  67. package/docs/ValidationError.md +24 -0
  68. package/docs/ValidationErrorLocInner.md +18 -0
  69. package/git_push.sh +57 -0
  70. package/index.ts +18 -0
  71. package/openapitools.json +7 -0
  72. package/package.json +33 -0
  73. package/tsconfig.json +14 -0
package/dist/base.d.ts ADDED
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Lumoar API
3
+ * Compliance as a service
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
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 type { Configuration } from './configuration';
13
+ import type { AxiosInstance, RawAxiosRequestConfig } from 'axios';
14
+ export declare const BASE_PATH: string;
15
+ /**
16
+ *
17
+ * @export
18
+ */
19
+ export declare const COLLECTION_FORMATS: {
20
+ csv: string;
21
+ ssv: string;
22
+ tsv: string;
23
+ pipes: string;
24
+ };
25
+ /**
26
+ *
27
+ * @export
28
+ * @interface RequestArgs
29
+ */
30
+ export interface RequestArgs {
31
+ url: string;
32
+ options: RawAxiosRequestConfig;
33
+ }
34
+ /**
35
+ *
36
+ * @export
37
+ * @class BaseAPI
38
+ */
39
+ export declare class BaseAPI {
40
+ protected basePath: string;
41
+ protected axios: AxiosInstance;
42
+ protected configuration: Configuration | undefined;
43
+ constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
44
+ }
45
+ /**
46
+ *
47
+ * @export
48
+ * @class RequiredError
49
+ * @extends {Error}
50
+ */
51
+ export declare class RequiredError extends Error {
52
+ field: string;
53
+ constructor(field: string, msg?: string);
54
+ }
55
+ interface ServerMap {
56
+ [key: string]: {
57
+ url: string;
58
+ description: string;
59
+ }[];
60
+ }
61
+ /**
62
+ *
63
+ * @export
64
+ */
65
+ export declare const operationServerMap: ServerMap;
66
+ export {};
package/dist/base.js ADDED
@@ -0,0 +1,60 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Lumoar API
5
+ * Compliance as a service
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ import globalAxios from 'axios';
15
+ export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
16
+ /**
17
+ *
18
+ * @export
19
+ */
20
+ export const COLLECTION_FORMATS = {
21
+ csv: ",",
22
+ ssv: " ",
23
+ tsv: "\t",
24
+ pipes: "|",
25
+ };
26
+ /**
27
+ *
28
+ * @export
29
+ * @class BaseAPI
30
+ */
31
+ export class BaseAPI {
32
+ constructor(configuration, basePath = BASE_PATH, axios = globalAxios) {
33
+ var _a;
34
+ this.basePath = basePath;
35
+ this.axios = axios;
36
+ if (configuration) {
37
+ this.configuration = configuration;
38
+ this.basePath = (_a = configuration.basePath) !== null && _a !== void 0 ? _a : basePath;
39
+ }
40
+ }
41
+ }
42
+ ;
43
+ /**
44
+ *
45
+ * @export
46
+ * @class RequiredError
47
+ * @extends {Error}
48
+ */
49
+ export class RequiredError extends Error {
50
+ constructor(field, msg) {
51
+ super(msg);
52
+ this.field = field;
53
+ this.name = "RequiredError";
54
+ }
55
+ }
56
+ /**
57
+ *
58
+ * @export
59
+ */
60
+ export const operationServerMap = {};
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Lumoar API
3
+ * Compliance as a service
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
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 type { Configuration } from "./configuration";
13
+ import type { RequestArgs } from "./base";
14
+ import type { 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>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
package/dist/common.js ADDED
@@ -0,0 +1,149 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Lumoar API
5
+ * Compliance as a service
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ import { RequiredError } from "./base";
24
+ /**
25
+ *
26
+ * @export
27
+ */
28
+ export const DUMMY_BASE_URL = 'https://example.com';
29
+ /**
30
+ *
31
+ * @throws {RequiredError}
32
+ * @export
33
+ */
34
+ export const assertParamExists = function (functionName, paramName, paramValue) {
35
+ if (paramValue === null || paramValue === undefined) {
36
+ throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
37
+ }
38
+ };
39
+ /**
40
+ *
41
+ * @export
42
+ */
43
+ export const setApiKeyToObject = function (object, keyParamName, configuration) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ if (configuration && configuration.apiKey) {
46
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
47
+ ? yield configuration.apiKey(keyParamName)
48
+ : yield configuration.apiKey;
49
+ object[keyParamName] = localVarApiKeyValue;
50
+ }
51
+ });
52
+ };
53
+ /**
54
+ *
55
+ * @export
56
+ */
57
+ export const setBasicAuthToObject = function (object, configuration) {
58
+ if (configuration && (configuration.username || configuration.password)) {
59
+ object["auth"] = { username: configuration.username, password: configuration.password };
60
+ }
61
+ };
62
+ /**
63
+ *
64
+ * @export
65
+ */
66
+ export const setBearerAuthToObject = function (object, configuration) {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ if (configuration && configuration.accessToken) {
69
+ const accessToken = typeof configuration.accessToken === 'function'
70
+ ? yield configuration.accessToken()
71
+ : yield configuration.accessToken;
72
+ object["Authorization"] = "Bearer " + accessToken;
73
+ }
74
+ });
75
+ };
76
+ /**
77
+ *
78
+ * @export
79
+ */
80
+ export const setOAuthToObject = function (object, name, scopes, configuration) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ if (configuration && configuration.accessToken) {
83
+ const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
84
+ ? yield configuration.accessToken(name, scopes)
85
+ : yield configuration.accessToken;
86
+ object["Authorization"] = "Bearer " + localVarAccessTokenValue;
87
+ }
88
+ });
89
+ };
90
+ function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
91
+ if (parameter == null)
92
+ return;
93
+ if (typeof parameter === "object") {
94
+ if (Array.isArray(parameter)) {
95
+ parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
96
+ }
97
+ else {
98
+ Object.keys(parameter).forEach(currentKey => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`));
99
+ }
100
+ }
101
+ else {
102
+ if (urlSearchParams.has(key)) {
103
+ urlSearchParams.append(key, parameter);
104
+ }
105
+ else {
106
+ urlSearchParams.set(key, parameter);
107
+ }
108
+ }
109
+ }
110
+ /**
111
+ *
112
+ * @export
113
+ */
114
+ export const setSearchParams = function (url, ...objects) {
115
+ const searchParams = new URLSearchParams(url.search);
116
+ setFlattenedQueryParams(searchParams, objects);
117
+ url.search = searchParams.toString();
118
+ };
119
+ /**
120
+ *
121
+ * @export
122
+ */
123
+ export const serializeDataIfNeeded = function (value, requestOptions, configuration) {
124
+ const nonString = typeof value !== 'string';
125
+ const needsSerialization = nonString && configuration && configuration.isJsonMime
126
+ ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
127
+ : nonString;
128
+ return needsSerialization
129
+ ? JSON.stringify(value !== undefined ? value : {})
130
+ : (value || "");
131
+ };
132
+ /**
133
+ *
134
+ * @export
135
+ */
136
+ export const toPathString = function (url) {
137
+ return url.pathname + url.search + url.hash;
138
+ };
139
+ /**
140
+ *
141
+ * @export
142
+ */
143
+ export const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
144
+ return (axios = globalAxios, basePath = BASE_PATH) => {
145
+ var _a;
146
+ const axiosRequestArgs = Object.assign(Object.assign({}, axiosArgs.options), { url: (axios.defaults.baseURL ? '' : (_a = configuration === null || configuration === void 0 ? void 0 : configuration.basePath) !== null && _a !== void 0 ? _a : basePath) + axiosArgs.url });
147
+ return axios.request(axiosRequestArgs);
148
+ };
149
+ };
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Lumoar API
3
+ * Compliance as a service
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
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 { AxiosResponse } from 'axios';
13
+ import { DefaultApi, AuthApi, CompanyApi, ControlsApi, EvidenceApi, PaymentsApi, PoliciesApi, RolesApi, UserApi } from './api';
14
+ export interface ConfigurationParameters {
15
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
16
+ username?: string;
17
+ password?: string;
18
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
19
+ basePath?: string;
20
+ serverIndex?: number;
21
+ baseOptions?: any;
22
+ formDataCtor?: new () => any;
23
+ }
24
+ export declare 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 | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
52
+ /**
53
+ * override base path
54
+ *
55
+ * @type {string}
56
+ * @memberof Configuration
57
+ */
58
+ basePath?: string;
59
+ /**
60
+ * override server index
61
+ *
62
+ * @type {number}
63
+ * @memberof Configuration
64
+ */
65
+ serverIndex?: number;
66
+ /**
67
+ * base options for axios calls
68
+ *
69
+ * @type {any}
70
+ * @memberof Configuration
71
+ */
72
+ baseOptions?: any;
73
+ /**
74
+ * The FormData constructor that will be used to create multipart form data
75
+ * requests. You can inject this here so that execution environments that
76
+ * do not support the FormData class can still run the generated client.
77
+ *
78
+ * @type {new () => FormData}
79
+ */
80
+ formDataCtor?: new () => any;
81
+ constructor(param?: ConfigurationParameters);
82
+ /**
83
+ * Check if the given MIME is a JSON MIME.
84
+ * JSON MIME examples:
85
+ * application/json
86
+ * application/json; charset=UTF8
87
+ * APPLICATION/JSON
88
+ * application/vnd.company+json
89
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
90
+ * @return True if the given MIME is JSON, false otherwise.
91
+ */
92
+ isJsonMime(mime: string): boolean;
93
+ }
94
+ export declare class ApiSDK {
95
+ private defaultApi;
96
+ private authApi;
97
+ private companyApi;
98
+ private controlsApi;
99
+ private evidenceApi;
100
+ private paymentsApi;
101
+ private policiesApi;
102
+ private rolesApi;
103
+ private userApi;
104
+ private token;
105
+ private axiosInstance;
106
+ constructor(basePath?: string);
107
+ setToken(newToken: string): void;
108
+ private getAuthHeader;
109
+ private setupInterceptors;
110
+ getApi(): {
111
+ defaultApi: DefaultApi;
112
+ authApi: AuthApi;
113
+ companyApi: CompanyApi;
114
+ controlsApi: ControlsApi;
115
+ evidenceApi: EvidenceApi;
116
+ paymentsApi: PaymentsApi;
117
+ policiesApi: PoliciesApi;
118
+ rolesApi: RolesApi;
119
+ userApi: UserApi;
120
+ getRedisHealthHealthRedisGet: () => Promise<AxiosResponse<any, any, {}>>;
121
+ getHealthHealthGet: () => Promise<AxiosResponse<any, any, {}>>;
122
+ getDbHealthHealthDbGet: () => Promise<AxiosResponse<any, any, {}>>;
123
+ getListmonkHealthHealthListmonkGet: () => Promise<AxiosResponse<any, any, {}>>;
124
+ };
125
+ }
@@ -0,0 +1,124 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Lumoar API
5
+ * Compliance as a service
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ import axios from 'axios';
15
+ import { DefaultApi, AuthApi, CompanyApi, ControlsApi, EvidenceApi, PaymentsApi, PoliciesApi, RolesApi, UserApi } from './api';
16
+ export class Configuration {
17
+ constructor(param = {}) {
18
+ var _a;
19
+ this.apiKey = param.apiKey;
20
+ this.username = param.username;
21
+ this.password = param.password;
22
+ this.accessToken = param.accessToken;
23
+ this.basePath = param.basePath;
24
+ this.serverIndex = param.serverIndex;
25
+ this.baseOptions = Object.assign(Object.assign({}, param.baseOptions), { headers: Object.assign({}, (_a = param.baseOptions) === null || _a === void 0 ? void 0 : _a.headers) });
26
+ this.formDataCtor = param.formDataCtor;
27
+ }
28
+ /**
29
+ * Check if the given MIME is a JSON MIME.
30
+ * JSON MIME examples:
31
+ * application/json
32
+ * application/json; charset=UTF8
33
+ * APPLICATION/JSON
34
+ * application/vnd.company+json
35
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
36
+ * @return True if the given MIME is JSON, false otherwise.
37
+ */
38
+ isJsonMime(mime) {
39
+ const jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
40
+ return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
41
+ }
42
+ }
43
+ export class ApiSDK {
44
+ constructor(basePath) {
45
+ this.token = null;
46
+ this.axiosInstance = axios.create({
47
+ baseURL: basePath,
48
+ withCredentials: true // Include cookies (e.g., session_id) in requests
49
+ });
50
+ this.setupInterceptors();
51
+ const config = new Configuration({
52
+ basePath,
53
+ apiKey: () => this.getAuthHeader(),
54
+ baseOptions: {
55
+ axios: this.axiosInstance // Ensure generated API uses this instance
56
+ },
57
+ });
58
+ // Create instances of all API classes
59
+ this.defaultApi = new DefaultApi(config, undefined, this.axiosInstance);
60
+ this.authApi = new AuthApi(config, undefined, this.axiosInstance);
61
+ this.companyApi = new CompanyApi(config, undefined, this.axiosInstance);
62
+ this.controlsApi = new ControlsApi(config, undefined, this.axiosInstance);
63
+ this.evidenceApi = new EvidenceApi(config, undefined, this.axiosInstance);
64
+ this.paymentsApi = new PaymentsApi(config, undefined, this.axiosInstance);
65
+ this.policiesApi = new PoliciesApi(config, undefined, this.axiosInstance);
66
+ this.rolesApi = new RolesApi(config, undefined, this.axiosInstance);
67
+ this.userApi = new UserApi(config, undefined, this.axiosInstance);
68
+ }
69
+ // Set or update token
70
+ setToken(newToken) {
71
+ this.token = newToken;
72
+ }
73
+ // Get auth header
74
+ getAuthHeader() {
75
+ if (!this.token) {
76
+ throw new Error('No token set. Call setToken() first.');
77
+ }
78
+ return `Bearer ${this.token}`;
79
+ }
80
+ // Setup interceptors for requests and responses
81
+ setupInterceptors() {
82
+ // Request interceptor: Always set latest token
83
+ this.axiosInstance.interceptors.request.use((config) => {
84
+ if (this.token) {
85
+ config.headers['Authorization'] = this.getAuthHeader();
86
+ }
87
+ return config;
88
+ });
89
+ this.axiosInstance.interceptors.response.use((response) => {
90
+ const newToken = response.data.newToken || response.headers['Authorization'];
91
+ if (newToken) {
92
+ this.setToken(newToken.replace('Bearer ', ''));
93
+ console.log('Token automatically updated via backend refresh');
94
+ }
95
+ return response;
96
+ }, (error) => {
97
+ var _a;
98
+ if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
99
+ console.error('Authentication failed - session expired');
100
+ // TODO: emit event or callback to app for login redirect
101
+ }
102
+ return Promise.reject(error);
103
+ });
104
+ }
105
+ // Expose API methods (proxies the generated API)
106
+ getApi() {
107
+ return {
108
+ defaultApi: this.defaultApi,
109
+ authApi: this.authApi,
110
+ companyApi: this.companyApi,
111
+ controlsApi: this.controlsApi,
112
+ evidenceApi: this.evidenceApi,
113
+ paymentsApi: this.paymentsApi,
114
+ policiesApi: this.policiesApi,
115
+ rolesApi: this.rolesApi,
116
+ userApi: this.userApi,
117
+ // Legacy support - keep the old health check methods accessible
118
+ getRedisHealthHealthRedisGet: () => this.defaultApi.getRedisHealthHealthRedisGet(),
119
+ getHealthHealthGet: () => this.defaultApi.getHealthHealthGet(),
120
+ getDbHealthHealthDbGet: () => this.defaultApi.getDbHealthHealthDbGet(),
121
+ getListmonkHealthHealthListmonkGet: () => this.defaultApi.getListmonkHealthHealthListmonkGet(),
122
+ };
123
+ }
124
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Lumoar API
3
+ * Compliance as a service
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
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
+ export * from "./api";
13
+ export * from "./configuration";
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Lumoar API
5
+ * Compliance as a service
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ export * from "./api";
15
+ export * from "./configuration";