js editor + fix js runner

This commit is contained in:
Sirttas
2026-06-08 08:27:42 +02:00
parent a201a95756
commit c444f51423
5 changed files with 79 additions and 8 deletions
+61
View File
@@ -1377,6 +1377,36 @@ export const RuleBookApiAxiosParamCreator = function (configuration?: Configurat
options: localVarRequestOptions,
};
},
/**
*
* @summary Download the TypeScript definitions for the rule script runtime
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getScriptDefinitions: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/rule-books/script-definitions`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarHeaderParameter['Accept'] = 'text/plain';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Update a rule book
@@ -1463,6 +1493,18 @@ export const RuleBookApiFp = function(configuration?: Configuration) {
const localVarOperationServerBasePath = operationServerMap['RuleBookApi.findRuleBookById']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @summary Download the TypeScript definitions for the rule script runtime
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getScriptDefinitions(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getScriptDefinitions(options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['RuleBookApi.getScriptDefinitions']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @summary Update a rule book
@@ -1515,6 +1557,15 @@ export const RuleBookApiFactory = function (configuration?: Configuration, baseP
findRuleBookById(ruleBookId: string, options?: RawAxiosRequestConfig): AxiosPromise<RuleBookResponse> {
return localVarFp.findRuleBookById(ruleBookId, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Download the TypeScript definitions for the rule script runtime
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getScriptDefinitions(options?: RawAxiosRequestConfig): AxiosPromise<string> {
return localVarFp.getScriptDefinitions(options).then((request) => request(axios, basePath));
},
/**
*
* @summary Update a rule book
@@ -1565,6 +1616,16 @@ export class RuleBookApi extends BaseAPI {
return RuleBookApiFp(this.configuration).findRuleBookById(ruleBookId, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Download the TypeScript definitions for the rule script runtime
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
public getScriptDefinitions(options?: RawAxiosRequestConfig) {
return RuleBookApiFp(this.configuration).getScriptDefinitions(options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Update a rule book
-6
View File
@@ -23,12 +23,6 @@ const mammonAxiosInstance = axios.create({
})
logResource(mammonAxiosInstance)
export const fetchScriptDefinitions = (): Promise<string> =>
mammonAxiosInstance.get<string>('rule-books/script-definitions', {
responseType: 'text',
headers: {Accept: 'text/plain'},
}).then(response => response.data);
export const ledgerApi = new LedgerApi(undefined, mammonUrl, mammonAxiosInstance);
export const transactionApi = new TransactionApi(undefined, mammonUrl, mammonAxiosInstance);
export const characterApi = new CharacterApi(undefined, mammonUrl, mammonAxiosInstance);
+1 -1
View File
@@ -3,7 +3,7 @@ import * as monaco from 'monaco-editor';
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
import {onBeforeUnmount, onMounted, ref, watch} from 'vue';
import {fetchScriptDefinitions} from '@/mammon';
import {fetchScriptDefinitions} from './rules';
(self as unknown as { MonacoEnvironment: { getWorker(workerId: string, label: string): Worker } }).MonacoEnvironment = {
getWorker(_workerId: string, label: string) {
+4 -1
View File
@@ -45,4 +45,7 @@ export const findCharacterRuleBookByCharacterId = (characterId: number): Promise
.catch(() => ({characterId, ruleBookId: '', bindings: {}}));
export const setCharacterRuleBookForCharacter = (characterId: number, ruleBook: SetCharacterRuleBookRequest): Promise<CharacterRuleBookResponse> => characterRuleBookApi.setCharacterRuleBookForCharacter(characterId, ruleBook)
.then(response => response.data);
.then(response => response.data);
export const fetchScriptDefinitions = (): Promise<string> =>
ruleBookApi.getScriptDefinitions({responseType: 'text'}).then(response => response.data);