project map script | semantic parcer
This commit is contained in:
@@ -8,11 +8,10 @@ import { PUBLIC_WS_URL } from '$env/static/public';
|
||||
|
||||
const API_BASE_URL = '/api';
|
||||
|
||||
/**
|
||||
* Returns the WebSocket URL for a specific task, with fallback logic.
|
||||
* @param {string} taskId
|
||||
* @returns {string}
|
||||
*/
|
||||
// [DEF:getWsUrl:Function]
|
||||
// @PURPOSE: Returns the WebSocket URL for a specific task, with fallback logic.
|
||||
// @PARAM: taskId (string) - The ID of the task.
|
||||
// @RETURN: string - The WebSocket URL.
|
||||
export const getWsUrl = (taskId) => {
|
||||
let baseUrl = PUBLIC_WS_URL;
|
||||
if (!baseUrl) {
|
||||
@@ -22,6 +21,7 @@ export const getWsUrl = (taskId) => {
|
||||
}
|
||||
return `${baseUrl}/ws/logs/${taskId}`;
|
||||
};
|
||||
// [/DEF:getWsUrl:Function]
|
||||
|
||||
// [DEF:fetchApi:Function]
|
||||
// @PURPOSE: Generic GET request wrapper.
|
||||
@@ -41,7 +41,7 @@ async function fetchApi(endpoint) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
// [/DEF:fetchApi]
|
||||
// [/DEF:fetchApi:Function]
|
||||
|
||||
// [DEF:postApi:Function]
|
||||
// @PURPOSE: Generic POST request wrapper.
|
||||
@@ -68,7 +68,7 @@ async function postApi(endpoint, body) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
// [/DEF:postApi]
|
||||
// [/DEF:postApi:Function]
|
||||
|
||||
// [DEF:requestApi:Function]
|
||||
// @PURPOSE: Generic request wrapper.
|
||||
@@ -96,6 +96,7 @@ async function requestApi(endpoint, method = 'GET', body = null) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
// [/DEF:requestApi:Function]
|
||||
|
||||
// [DEF:api:Data]
|
||||
// @PURPOSE: API client object with specific methods.
|
||||
@@ -116,7 +117,9 @@ export const api = {
|
||||
updateEnvironmentSchedule: (id, schedule) => requestApi(`/environments/${id}/schedule`, 'PUT', schedule),
|
||||
getEnvironmentsList: () => fetchApi('/environments'),
|
||||
};
|
||||
// [/DEF:api_module]
|
||||
// [/DEF:api:Data]
|
||||
|
||||
// [/DEF:api_module:Module]
|
||||
|
||||
// Export individual functions for easier use in components
|
||||
export const getPlugins = api.getPlugins;
|
||||
|
||||
Reference in New Issue
Block a user