UNPKG

windmill-utils-internal

Version:

Internal utility functions for Windmill

40 lines (39 loc) 1.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OpenAPI = exports.Interceptors = void 0; const getEnv = (key) => { return process.env[key]; }; const baseUrl = getEnv("BASE_INTERNAL_URL") ?? getEnv("BASE_URL") ?? "http://localhost:8000"; const baseUrlApi = (baseUrl ?? '') + "/api"; class Interceptors { _fns; constructor() { this._fns = []; } eject(fn) { const index = this._fns.indexOf(fn); if (index !== -1) { this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; } } use(fn) { this._fns = [...this._fns, fn]; } } exports.Interceptors = Interceptors; exports.OpenAPI = { BASE: baseUrlApi, CREDENTIALS: 'include', ENCODE_PATH: undefined, HEADERS: undefined, PASSWORD: undefined, TOKEN: getEnv("WM_TOKEN"), USERNAME: undefined, VERSION: '1.518.2', WITH_CREDENTIALS: true, interceptors: { request: new Interceptors(), response: new Interceptors(), }, };