@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/base.ts ADDED
@@ -0,0 +1,86 @@
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
+
15
+
16
+ import type { Configuration } from './configuration';
17
+ // Some imports not used depending on template conditions
18
+ // @ts-ignore
19
+ import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
20
+ import globalAxios from 'axios';
21
+
22
+ export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
23
+
24
+ /**
25
+ *
26
+ * @export
27
+ */
28
+ export const COLLECTION_FORMATS = {
29
+ csv: ",",
30
+ ssv: " ",
31
+ tsv: "\t",
32
+ pipes: "|",
33
+ };
34
+
35
+ /**
36
+ *
37
+ * @export
38
+ * @interface RequestArgs
39
+ */
40
+ export interface RequestArgs {
41
+ url: string;
42
+ options: RawAxiosRequestConfig;
43
+ }
44
+
45
+ /**
46
+ *
47
+ * @export
48
+ * @class BaseAPI
49
+ */
50
+ export class BaseAPI {
51
+ protected configuration: Configuration | undefined;
52
+
53
+ constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
54
+ if (configuration) {
55
+ this.configuration = configuration;
56
+ this.basePath = configuration.basePath ?? basePath;
57
+ }
58
+ }
59
+ };
60
+
61
+ /**
62
+ *
63
+ * @export
64
+ * @class RequiredError
65
+ * @extends {Error}
66
+ */
67
+ export class RequiredError extends Error {
68
+ constructor(public field: string, msg?: string) {
69
+ super(msg);
70
+ this.name = "RequiredError"
71
+ }
72
+ }
73
+
74
+ interface ServerMap {
75
+ [key: string]: {
76
+ url: string,
77
+ description: string,
78
+ }[];
79
+ }
80
+
81
+ /**
82
+ *
83
+ * @export
84
+ */
85
+ export const operationServerMap: ServerMap = {
86
+ }
package/common.ts ADDED
@@ -0,0 +1,150 @@
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
+
15
+
16
+ import type { Configuration } from "./configuration";
17
+ import type { RequestArgs } from "./base";
18
+ import type { AxiosInstance, AxiosResponse } from 'axios';
19
+ import { RequiredError } from "./base";
20
+
21
+ /**
22
+ *
23
+ * @export
24
+ */
25
+ export const DUMMY_BASE_URL = 'https://example.com'
26
+
27
+ /**
28
+ *
29
+ * @throws {RequiredError}
30
+ * @export
31
+ */
32
+ export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
33
+ if (paramValue === null || paramValue === undefined) {
34
+ throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
35
+ }
36
+ }
37
+
38
+ /**
39
+ *
40
+ * @export
41
+ */
42
+ export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
43
+ if (configuration && configuration.apiKey) {
44
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
45
+ ? await configuration.apiKey(keyParamName)
46
+ : await configuration.apiKey;
47
+ object[keyParamName] = localVarApiKeyValue;
48
+ }
49
+ }
50
+
51
+ /**
52
+ *
53
+ * @export
54
+ */
55
+ export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
56
+ if (configuration && (configuration.username || configuration.password)) {
57
+ object["auth"] = { username: configuration.username, password: configuration.password };
58
+ }
59
+ }
60
+
61
+ /**
62
+ *
63
+ * @export
64
+ */
65
+ export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
66
+ if (configuration && configuration.accessToken) {
67
+ const accessToken = typeof configuration.accessToken === 'function'
68
+ ? await configuration.accessToken()
69
+ : await configuration.accessToken;
70
+ object["Authorization"] = "Bearer " + accessToken;
71
+ }
72
+ }
73
+
74
+ /**
75
+ *
76
+ * @export
77
+ */
78
+ export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
79
+ if (configuration && configuration.accessToken) {
80
+ const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
81
+ ? await configuration.accessToken(name, scopes)
82
+ : await configuration.accessToken;
83
+ object["Authorization"] = "Bearer " + localVarAccessTokenValue;
84
+ }
85
+ }
86
+
87
+ function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
88
+ if (parameter == null) return;
89
+ if (typeof parameter === "object") {
90
+ if (Array.isArray(parameter)) {
91
+ (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
92
+ }
93
+ else {
94
+ Object.keys(parameter).forEach(currentKey =>
95
+ setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
96
+ );
97
+ }
98
+ }
99
+ else {
100
+ if (urlSearchParams.has(key)) {
101
+ urlSearchParams.append(key, parameter);
102
+ }
103
+ else {
104
+ urlSearchParams.set(key, parameter);
105
+ }
106
+ }
107
+ }
108
+
109
+ /**
110
+ *
111
+ * @export
112
+ */
113
+ export const setSearchParams = function (url: URL, ...objects: any[]) {
114
+ const searchParams = new URLSearchParams(url.search);
115
+ setFlattenedQueryParams(searchParams, objects);
116
+ url.search = searchParams.toString();
117
+ }
118
+
119
+ /**
120
+ *
121
+ * @export
122
+ */
123
+ export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: 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
+ *
135
+ * @export
136
+ */
137
+ export const toPathString = function (url: URL) {
138
+ return url.pathname + url.search + url.hash
139
+ }
140
+
141
+ /**
142
+ *
143
+ * @export
144
+ */
145
+ export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
146
+ return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
147
+ const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url};
148
+ return axios.request<T, R>(axiosRequestArgs);
149
+ };
150
+ }
@@ -0,0 +1,228 @@
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
+
15
+ import axios, { AxiosInstance, AxiosResponse } from 'axios';
16
+ import {
17
+ DefaultApi,
18
+ AuthApi,
19
+ CompanyApi,
20
+ ControlsApi,
21
+ EvidenceApi,
22
+ PaymentsApi,
23
+ PoliciesApi,
24
+ RolesApi,
25
+ UserApi
26
+ } from './api';
27
+
28
+
29
+ export interface ConfigurationParameters {
30
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
31
+ username?: string;
32
+ password?: string;
33
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
34
+ basePath?: string;
35
+ serverIndex?: number;
36
+ baseOptions?: any;
37
+ formDataCtor?: new () => any;
38
+ }
39
+
40
+ export class Configuration {
41
+ /**
42
+ * parameter for apiKey security
43
+ * @param name security name
44
+ * @memberof Configuration
45
+ */
46
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
47
+ /**
48
+ * parameter for basic security
49
+ *
50
+ * @type {string}
51
+ * @memberof Configuration
52
+ */
53
+ username?: string;
54
+ /**
55
+ * parameter for basic security
56
+ *
57
+ * @type {string}
58
+ * @memberof Configuration
59
+ */
60
+ password?: string;
61
+ /**
62
+ * parameter for oauth2 security
63
+ * @param name security name
64
+ * @param scopes oauth2 scope
65
+ * @memberof Configuration
66
+ */
67
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
68
+ /**
69
+ * override base path
70
+ *
71
+ * @type {string}
72
+ * @memberof Configuration
73
+ */
74
+ basePath?: string;
75
+ /**
76
+ * override server index
77
+ *
78
+ * @type {number}
79
+ * @memberof Configuration
80
+ */
81
+ serverIndex?: number;
82
+ /**
83
+ * base options for axios calls
84
+ *
85
+ * @type {any}
86
+ * @memberof Configuration
87
+ */
88
+ baseOptions?: any;
89
+ /**
90
+ * The FormData constructor that will be used to create multipart form data
91
+ * requests. You can inject this here so that execution environments that
92
+ * do not support the FormData class can still run the generated client.
93
+ *
94
+ * @type {new () => FormData}
95
+ */
96
+ formDataCtor?: new () => any;
97
+
98
+ constructor(param: ConfigurationParameters = {}) {
99
+ this.apiKey = param.apiKey;
100
+ this.username = param.username;
101
+ this.password = param.password;
102
+ this.accessToken = param.accessToken;
103
+ this.basePath = param.basePath;
104
+ this.serverIndex = param.serverIndex;
105
+ this.baseOptions = {
106
+ ...param.baseOptions,
107
+ headers: {
108
+ ...param.baseOptions?.headers,
109
+ },
110
+ };
111
+ this.formDataCtor = param.formDataCtor;
112
+ }
113
+
114
+ /**
115
+ * Check if the given MIME is a JSON MIME.
116
+ * JSON MIME examples:
117
+ * application/json
118
+ * application/json; charset=UTF8
119
+ * APPLICATION/JSON
120
+ * application/vnd.company+json
121
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
122
+ * @return True if the given MIME is JSON, false otherwise.
123
+ */
124
+ public isJsonMime(mime: string): boolean {
125
+ const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
126
+ return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
127
+ }
128
+ }
129
+
130
+
131
+ export class ApiSDK {
132
+ private defaultApi: DefaultApi;
133
+ private authApi: AuthApi;
134
+ private companyApi: CompanyApi;
135
+ private controlsApi: ControlsApi;
136
+ private evidenceApi: EvidenceApi;
137
+ private paymentsApi: PaymentsApi;
138
+ private policiesApi: PoliciesApi;
139
+ private rolesApi: RolesApi;
140
+ private userApi: UserApi;
141
+ private token: string | null = null;
142
+ private axiosInstance: AxiosInstance;
143
+
144
+ constructor(basePath?: string) {
145
+ this.axiosInstance = axios.create({
146
+ baseURL: basePath,
147
+ withCredentials: true // Include cookies (e.g., session_id) in requests
148
+ });
149
+ this.setupInterceptors();
150
+ const config = new Configuration({
151
+ basePath,
152
+ apiKey: () => this.getAuthHeader(),
153
+ baseOptions: {
154
+ axios: this.axiosInstance // Ensure generated API uses this instance
155
+ },
156
+ });
157
+
158
+ // Create instances of all API classes
159
+ this.defaultApi = new DefaultApi(config, undefined, this.axiosInstance);
160
+ this.authApi = new AuthApi(config, undefined, this.axiosInstance);
161
+ this.companyApi = new CompanyApi(config, undefined, this.axiosInstance);
162
+ this.controlsApi = new ControlsApi(config, undefined, this.axiosInstance);
163
+ this.evidenceApi = new EvidenceApi(config, undefined, this.axiosInstance);
164
+ this.paymentsApi = new PaymentsApi(config, undefined, this.axiosInstance);
165
+ this.policiesApi = new PoliciesApi(config, undefined, this.axiosInstance);
166
+ this.rolesApi = new RolesApi(config, undefined, this.axiosInstance);
167
+ this.userApi = new UserApi(config, undefined, this.axiosInstance);
168
+ }
169
+
170
+ // Set or update token
171
+ public setToken(newToken: string) {
172
+ this.token = newToken;
173
+ }
174
+
175
+ // Get auth header
176
+ private getAuthHeader(): string {
177
+ if (!this.token) {
178
+ throw new Error('No token set. Call setToken() first.');
179
+ }
180
+ return `Bearer ${this.token}`;
181
+ }
182
+
183
+ // Setup interceptors for requests and responses
184
+ private setupInterceptors() {
185
+ // Request interceptor: Always set latest token
186
+ this.axiosInstance.interceptors.request.use((config) => {
187
+ if (this.token) {
188
+ config.headers['Authorization'] = this.getAuthHeader();
189
+ }
190
+ return config;
191
+ });
192
+
193
+ this.axiosInstance.interceptors.response.use((response: AxiosResponse) => {
194
+ const newToken = response.data.newToken || response.headers['Authorization'];
195
+ if (newToken) {
196
+ this.setToken(newToken.replace('Bearer ', ''));
197
+ console.log('Token automatically updated via backend refresh');
198
+ }
199
+ return response;
200
+ }, (error) => {
201
+ if (error.response?.status === 401) {
202
+ console.error('Authentication failed - session expired');
203
+ // TODO: emit event or callback to app for login redirect
204
+ }
205
+ return Promise.reject(error);
206
+ });
207
+ }
208
+
209
+ // Expose API methods (proxies the generated API)
210
+ public getApi() {
211
+ return {
212
+ defaultApi: this.defaultApi,
213
+ authApi: this.authApi,
214
+ companyApi: this.companyApi,
215
+ controlsApi: this.controlsApi,
216
+ evidenceApi: this.evidenceApi,
217
+ paymentsApi: this.paymentsApi,
218
+ policiesApi: this.policiesApi,
219
+ rolesApi: this.rolesApi,
220
+ userApi: this.userApi,
221
+ // Legacy support - keep the old health check methods accessible
222
+ getRedisHealthHealthRedisGet: () => this.defaultApi.getRedisHealthHealthRedisGet(),
223
+ getHealthHealthGet: () => this.defaultApi.getHealthHealthGet(),
224
+ getDbHealthHealthDbGet: () => this.defaultApi.getDbHealthHealthDbGet(),
225
+ getListmonkHealthHealthListmonkGet: () => this.defaultApi.getListmonkHealthHealthListmonkGet(),
226
+ };
227
+ }
228
+ }