online-compiler-widget 1.0.3 → 1.0.4
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/index.d.ts +412 -0
- package/package.json +2 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { AxiosResponse } from 'axios';
|
|
3
|
+
import { default as default_2 } from 'react';
|
|
4
|
+
import { Dispatch } from 'react';
|
|
5
|
+
import { JSX } from 'react/jsx-runtime';
|
|
6
|
+
import { RawAxiosRequestConfig } from 'axios';
|
|
7
|
+
import { SetStateAction } from 'react';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* CompilerWidgetApi
|
|
11
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
12
|
+
*
|
|
13
|
+
* The version of the OpenAPI document: 1.0
|
|
14
|
+
*
|
|
15
|
+
*
|
|
16
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
17
|
+
* https://openapi-generator.tech
|
|
18
|
+
* Do not edit the class manually.
|
|
19
|
+
*/
|
|
20
|
+
declare interface AWSv4Configuration {
|
|
21
|
+
options?: {
|
|
22
|
+
region?: string;
|
|
23
|
+
service?: string;
|
|
24
|
+
};
|
|
25
|
+
credentials?: {
|
|
26
|
+
accessKeyId?: string;
|
|
27
|
+
secretAccessKey?: string;
|
|
28
|
+
sessionToken?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
declare class BaseAPI {
|
|
33
|
+
protected basePath: string;
|
|
34
|
+
protected axios: AxiosInstance;
|
|
35
|
+
protected configuration: Configuration | undefined;
|
|
36
|
+
constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare interface CompilationError {
|
|
40
|
+
'errorCode'?: string | null;
|
|
41
|
+
'message'?: string | null;
|
|
42
|
+
'startLine'?: number;
|
|
43
|
+
'endLine'?: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* CompilerApi - object-oriented interface
|
|
48
|
+
*/
|
|
49
|
+
export declare class CompilerApi extends BaseAPI {
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* @param {string} projectId
|
|
53
|
+
* @param {CompileRequest} [compileRequest]
|
|
54
|
+
* @param {*} [options] Override http request option.
|
|
55
|
+
* @throws {RequiredError}
|
|
56
|
+
*/
|
|
57
|
+
apiCompileProjectProjectIdCompilePost(projectId: string, compileRequest?: CompileRequest, options?: RawAxiosRequestConfig): Promise<AxiosResponse<CompileResult, any, {}>>;
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* @param {string} projectId
|
|
61
|
+
* @param {RunRequest} [runRequest]
|
|
62
|
+
* @param {*} [options] Override http request option.
|
|
63
|
+
* @throws {RequiredError}
|
|
64
|
+
*/
|
|
65
|
+
apiCompileProjectProjectIdRunPost(projectId: string, runRequest?: RunRequest, options?: RawAxiosRequestConfig): Promise<AxiosResponse<RunResult, any, {}>>;
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @param {string} projectId
|
|
69
|
+
* @param {*} [options] Override http request option.
|
|
70
|
+
* @throws {RequiredError}
|
|
71
|
+
*/
|
|
72
|
+
apiCompileProjectProjectIdStatusGet(projectId: string, options?: RawAxiosRequestConfig): Promise<AxiosResponse<ProcessStatus, any, {}>>;
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* @param {string} projectId
|
|
76
|
+
* @param {*} [options] Override http request option.
|
|
77
|
+
* @throws {RequiredError}
|
|
78
|
+
*/
|
|
79
|
+
apiCompileProjectProjectIdStopPost(projectId: string, options?: RawAxiosRequestConfig): Promise<AxiosResponse<void, any, {}>>;
|
|
80
|
+
/**
|
|
81
|
+
*
|
|
82
|
+
* @param {*} [options] Override http request option.
|
|
83
|
+
* @throws {RequiredError}
|
|
84
|
+
*/
|
|
85
|
+
apiCompileRunningProjectsGet(options?: RawAxiosRequestConfig): Promise<AxiosResponse<RunningProjectInfo[], any, {}>>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
declare interface CompileRequest {
|
|
89
|
+
'mainFile'?: string | null;
|
|
90
|
+
'optimize'?: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare interface CompileResult {
|
|
94
|
+
'success'?: boolean;
|
|
95
|
+
'output'?: string | null;
|
|
96
|
+
'errors'?: Array<CompilationError> | null;
|
|
97
|
+
'projectId'?: string;
|
|
98
|
+
'compiledAt'?: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export declare const CompilerWidget: default_2.NamedExoticComponent<CompilerWidgetProps>;
|
|
102
|
+
|
|
103
|
+
export declare const CompilerWidgetNode: (props: any) => JSX.Element;
|
|
104
|
+
|
|
105
|
+
declare interface CompilerWidgetProps {
|
|
106
|
+
id: string;
|
|
107
|
+
isNew: boolean;
|
|
108
|
+
data?: {
|
|
109
|
+
initialFiles?: Record<string, string>;
|
|
110
|
+
language?: 'csharp' | 'js';
|
|
111
|
+
};
|
|
112
|
+
setNodeHeight?: (id: string, height: number) => void;
|
|
113
|
+
getInfo?: (info: GetInfoModel_2) => void;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export declare class Configuration {
|
|
117
|
+
/**
|
|
118
|
+
* parameter for apiKey security
|
|
119
|
+
* @param name security name
|
|
120
|
+
*/
|
|
121
|
+
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
122
|
+
/**
|
|
123
|
+
* parameter for basic security
|
|
124
|
+
*/
|
|
125
|
+
username?: string;
|
|
126
|
+
/**
|
|
127
|
+
* parameter for basic security
|
|
128
|
+
*/
|
|
129
|
+
password?: string;
|
|
130
|
+
/**
|
|
131
|
+
* parameter for oauth2 security
|
|
132
|
+
* @param name security name
|
|
133
|
+
* @param scopes oauth2 scope
|
|
134
|
+
*/
|
|
135
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
136
|
+
/**
|
|
137
|
+
* parameter for aws4 signature security
|
|
138
|
+
* @param {Object} AWS4Signature - AWS4 Signature security
|
|
139
|
+
* @param {string} options.region - aws region
|
|
140
|
+
* @param {string} options.service - name of the service.
|
|
141
|
+
* @param {string} credentials.accessKeyId - aws access key id
|
|
142
|
+
* @param {string} credentials.secretAccessKey - aws access key
|
|
143
|
+
* @param {string} credentials.sessionToken - aws session token
|
|
144
|
+
* @memberof Configuration
|
|
145
|
+
*/
|
|
146
|
+
awsv4?: AWSv4Configuration;
|
|
147
|
+
/**
|
|
148
|
+
* override base path
|
|
149
|
+
*/
|
|
150
|
+
basePath?: string;
|
|
151
|
+
/**
|
|
152
|
+
* override server index
|
|
153
|
+
*/
|
|
154
|
+
serverIndex?: number;
|
|
155
|
+
/**
|
|
156
|
+
* base options for axios calls
|
|
157
|
+
*/
|
|
158
|
+
baseOptions?: any;
|
|
159
|
+
/**
|
|
160
|
+
* The FormData constructor that will be used to create multipart form data
|
|
161
|
+
* requests. You can inject this here so that execution environments that
|
|
162
|
+
* do not support the FormData class can still run the generated client.
|
|
163
|
+
*
|
|
164
|
+
* @type {new () => FormData}
|
|
165
|
+
*/
|
|
166
|
+
formDataCtor?: new () => any;
|
|
167
|
+
constructor(param?: ConfigurationParameters);
|
|
168
|
+
/**
|
|
169
|
+
* Check if the given MIME is a JSON MIME.
|
|
170
|
+
* JSON MIME examples:
|
|
171
|
+
* application/json
|
|
172
|
+
* application/json; charset=UTF8
|
|
173
|
+
* APPLICATION/JSON
|
|
174
|
+
* application/vnd.company+json
|
|
175
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
176
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
177
|
+
*/
|
|
178
|
+
isJsonMime(mime: string): boolean;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare interface ConfigurationParameters {
|
|
182
|
+
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
183
|
+
username?: string;
|
|
184
|
+
password?: string;
|
|
185
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
186
|
+
awsv4?: AWSv4Configuration;
|
|
187
|
+
basePath?: string;
|
|
188
|
+
serverIndex?: number;
|
|
189
|
+
baseOptions?: any;
|
|
190
|
+
formDataCtor?: new () => any;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare interface CreateFileDto {
|
|
194
|
+
'name'?: string | null;
|
|
195
|
+
'path'?: string | null;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export declare interface EditorDocument {
|
|
199
|
+
id: string;
|
|
200
|
+
path: string;
|
|
201
|
+
name: string;
|
|
202
|
+
language: "javascript" | "csharp";
|
|
203
|
+
content: string;
|
|
204
|
+
modified: boolean;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* FileApi - object-oriented interface
|
|
209
|
+
*/
|
|
210
|
+
export declare class FileApi extends BaseAPI {
|
|
211
|
+
/**
|
|
212
|
+
*
|
|
213
|
+
* @param {string} fileId
|
|
214
|
+
* @param {*} [options] Override http request option.
|
|
215
|
+
* @throws {RequiredError}
|
|
216
|
+
*/
|
|
217
|
+
apiFilesFileIdDeletePost(fileId: string, options?: RawAxiosRequestConfig): Promise<AxiosResponse<void, any, {}>>;
|
|
218
|
+
/**
|
|
219
|
+
*
|
|
220
|
+
* @param {string} fileId
|
|
221
|
+
* @param {string} [file]
|
|
222
|
+
* @param {string} [body]
|
|
223
|
+
* @param {*} [options] Override http request option.
|
|
224
|
+
* @throws {RequiredError}
|
|
225
|
+
*/
|
|
226
|
+
apiFilesFileIdMovePost(fileId: string, file?: string, body?: string, options?: RawAxiosRequestConfig): Promise<AxiosResponse<void, any, {}>>;
|
|
227
|
+
/**
|
|
228
|
+
*
|
|
229
|
+
* @param {string} fileId
|
|
230
|
+
* @param {RenameFileDto} [renameFileDto]
|
|
231
|
+
* @param {*} [options] Override http request option.
|
|
232
|
+
* @throws {RequiredError}
|
|
233
|
+
*/
|
|
234
|
+
apiFilesFileIdRenamePost(fileId: string, renameFileDto?: RenameFileDto, options?: RawAxiosRequestConfig): Promise<AxiosResponse<string, any, {}>>;
|
|
235
|
+
/**
|
|
236
|
+
*
|
|
237
|
+
* @param {string} fileId
|
|
238
|
+
* @param {UpdateFileDto} [updateFileDto]
|
|
239
|
+
* @param {*} [options] Override http request option.
|
|
240
|
+
* @throws {RequiredError}
|
|
241
|
+
*/
|
|
242
|
+
apiFilesFileIdSavePost(fileId: string, updateFileDto?: UpdateFileDto, options?: RawAxiosRequestConfig): Promise<AxiosResponse<string, any, {}>>;
|
|
243
|
+
/**
|
|
244
|
+
*
|
|
245
|
+
* @param {string} projectId
|
|
246
|
+
* @param {*} [options] Override http request option.
|
|
247
|
+
* @throws {RequiredError}
|
|
248
|
+
*/
|
|
249
|
+
apiFilesProjectIdGet(projectId: string, options?: RawAxiosRequestConfig): Promise<AxiosResponse<FileMetadata[], any, {}>>;
|
|
250
|
+
/**
|
|
251
|
+
*
|
|
252
|
+
* @param {string} projectId
|
|
253
|
+
* @param {PathChangeRequest} [pathChangeRequest]
|
|
254
|
+
* @param {*} [options] Override http request option.
|
|
255
|
+
* @throws {RequiredError}
|
|
256
|
+
*/
|
|
257
|
+
apiFilesProjectProjectIdChangeAllPathsPost(projectId: string, pathChangeRequest?: PathChangeRequest, options?: RawAxiosRequestConfig): Promise<AxiosResponse<void, any, {}>>;
|
|
258
|
+
/**
|
|
259
|
+
*
|
|
260
|
+
* @param {string} projectId
|
|
261
|
+
* @param {CreateFileDto} [createFileDto]
|
|
262
|
+
* @param {*} [options] Override http request option.
|
|
263
|
+
* @throws {RequiredError}
|
|
264
|
+
*/
|
|
265
|
+
apiFilesProjectProjectIdPost(projectId: string, createFileDto?: CreateFileDto, options?: RawAxiosRequestConfig): Promise<AxiosResponse<string, any, {}>>;
|
|
266
|
+
/**
|
|
267
|
+
*
|
|
268
|
+
* @param {string} fileId
|
|
269
|
+
* @param {*} [options] Override http request option.
|
|
270
|
+
* @throws {RequiredError}
|
|
271
|
+
*/
|
|
272
|
+
apiFilesReadFileIdGet(fileId: string, options?: RawAxiosRequestConfig): Promise<AxiosResponse<string, any, {}>>;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export declare const FileExplorer: default_2.FC<FileExplorerProps>;
|
|
276
|
+
|
|
277
|
+
declare interface FileExplorerProps {
|
|
278
|
+
documents: EditorDocument[];
|
|
279
|
+
selectedId: string | null;
|
|
280
|
+
onSelect: (id: string) => void;
|
|
281
|
+
onAdd: (fileName: string, parentPath?: string) => void;
|
|
282
|
+
onRename: (id: string, newName: string) => void;
|
|
283
|
+
onDelete: (id: string) => void;
|
|
284
|
+
onMove: (fileId: string, newPath: string) => void;
|
|
285
|
+
onFolderRename: (id: string, oldPath: string, newPath: string) => void;
|
|
286
|
+
changeAllDocPath: (oldPath: string, newPath: string) => void;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
declare interface FileMetadata {
|
|
290
|
+
'fileId'?: string;
|
|
291
|
+
'fileName'?: string | null;
|
|
292
|
+
'projectId'?: string;
|
|
293
|
+
'path'?: string | null;
|
|
294
|
+
'physicalPath'?: string | null;
|
|
295
|
+
'existsOnDisk'?: boolean;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export declare function getInfo(model: GetInfoModel): Promise<boolean>;
|
|
299
|
+
|
|
300
|
+
export declare interface GetInfoModel {
|
|
301
|
+
widgetId: string;
|
|
302
|
+
userId: number;
|
|
303
|
+
role: string;
|
|
304
|
+
config: string;
|
|
305
|
+
board: {
|
|
306
|
+
id: number;
|
|
307
|
+
name: string;
|
|
308
|
+
parentId: number;
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
declare interface GetInfoModel_2 {
|
|
313
|
+
"widgetId": number;
|
|
314
|
+
"userId": number;
|
|
315
|
+
"role": string;
|
|
316
|
+
"config": string;
|
|
317
|
+
"board": {
|
|
318
|
+
"id": number;
|
|
319
|
+
"name": string;
|
|
320
|
+
"parentId": number;
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
export declare const MonacoEditorWrapper: default_2.FC<MonacoEditorWrapperProps>;
|
|
325
|
+
|
|
326
|
+
declare interface MonacoEditorWrapperProps {
|
|
327
|
+
code: string;
|
|
328
|
+
language: string;
|
|
329
|
+
onChange: (value: string) => void;
|
|
330
|
+
theme?: string;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export declare const OutputPanel: default_2.FC<OutputPanelProps>;
|
|
334
|
+
|
|
335
|
+
declare interface OutputPanelProps {
|
|
336
|
+
output: string;
|
|
337
|
+
history: string[];
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
declare interface PathChangeRequest {
|
|
341
|
+
'oldPath'?: string | null;
|
|
342
|
+
'newPath'?: string | null;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
declare interface ProcessStatus {
|
|
346
|
+
'projectId'?: string;
|
|
347
|
+
'isRunning'?: boolean;
|
|
348
|
+
'processId'?: string | null;
|
|
349
|
+
'startedAt'?: string | null;
|
|
350
|
+
'uptime'?: string;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
declare interface RenameFileDto {
|
|
354
|
+
'name'?: string | null;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export declare const RunContainer: default_2.FC<RunContainerProps>;
|
|
358
|
+
|
|
359
|
+
declare interface RunContainerProps {
|
|
360
|
+
run: () => void;
|
|
361
|
+
stop: () => void;
|
|
362
|
+
save: () => void;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
declare interface RunningProjectInfo {
|
|
366
|
+
'projectId'?: string;
|
|
367
|
+
'processId'?: string | null;
|
|
368
|
+
'startedAt'?: string;
|
|
369
|
+
'uptime'?: string;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
declare interface RunRequest {
|
|
373
|
+
'mainFile'?: string | null;
|
|
374
|
+
'environmentVariables'?: {
|
|
375
|
+
[key: string]: string;
|
|
376
|
+
} | null;
|
|
377
|
+
'timeoutSeconds'?: number | null;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
declare interface RunResult {
|
|
381
|
+
'success'?: boolean;
|
|
382
|
+
'output'?: string | null;
|
|
383
|
+
'errors'?: Array<CompilationError> | null;
|
|
384
|
+
'processId'?: string | null;
|
|
385
|
+
'projectId'?: string;
|
|
386
|
+
'startedAt'?: string;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
declare interface UpdateFileDto {
|
|
390
|
+
'content'?: string | null;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export declare function useCompiler(id: string, isNew: boolean, initialFiles?: Record<string, string>): {
|
|
394
|
+
documents: EditorDocument[];
|
|
395
|
+
selectedDocument: EditorDocument | null;
|
|
396
|
+
selectedId: string | null;
|
|
397
|
+
setSelectedId: Dispatch<SetStateAction<string | null>>;
|
|
398
|
+
setDocumentContent: (id: string, newContent: string) => void;
|
|
399
|
+
addDocument: (fileName?: string, path?: string) => void;
|
|
400
|
+
updatePath: (id: string, oldPath: string, newPath: string) => void;
|
|
401
|
+
updateDocPath: (fileId: string, newPath: string) => void;
|
|
402
|
+
updateDocument: (id: string, patch: Partial<EditorDocument>) => void;
|
|
403
|
+
deleteDocument: (id: string) => void;
|
|
404
|
+
updateOneDocPath: (id: string, newPath: string) => void;
|
|
405
|
+
run: () => Promise<void>;
|
|
406
|
+
stop: () => void;
|
|
407
|
+
output: string;
|
|
408
|
+
saveAll: () => void;
|
|
409
|
+
history: never[];
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "online-compiler-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"sass": "^1.97.2",
|
|
37
37
|
"typescript": "^5.0.0",
|
|
38
38
|
"vite": "^5.0.0",
|
|
39
|
+
"vite-plugin-dts": "^4.5.4",
|
|
39
40
|
"vite-plugin-svgr": "^4.0.0"
|
|
40
41
|
}
|
|
41
42
|
}
|