mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-19 00:02:03 +00:00
5c39037aea
* first commit * update migration mqtt * chore: update dependencies * add cli support and update schema for mqtt * update: casing style * update: rename get_resource function and moving to resource.rs * feat: * feat: refactored * feat: add ready endpoints for workers to enterprise * feat: handle connection to server * fix: main.rs * feat: added support v5 * feat: 🚧 updated .github, handle more case for v5 and handle v3 * feat: handled client, update script helper * update .sqlx * refactor: added generic implement and trait to remove redundant code, misses client impleme * feat: remove optinal property update test function * feat: done * handle client certificate * minor fix * fix: tls and mtls * fix: min topic len in frontend * Update frontend/src/lib/components/triggers/mqtt/MqttEditorConfigSection.svelte Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * Update backend/windmill-api/openapi.yaml Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * Update backend/windmill-api/src/mqtt_triggers.rs Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * update openapi, and script_helper.ts * fix: toggle button and update mqtt migration * nits: remove postgres type and only relies on serde * fix: timeout connection * fix typo and captures * fix: capture table reactivity * handle more mqtt v5 option * nits: remove clone method * update: better naming * nits: display tooltip qos * fix: hanle tls connection with natively * update: add documentation links for qos and topics * fix tooltip and add default value * update: shoz preprocessor only if selected in capture table * nits: show mqtt icon in resource related componenets * update hub link and repo ref * fix: unused var * update ee ref * fix: give good reference id for script hub --------- Co-authored-by: Ruben Fiszel <ruben@windmill.dev> Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> Co-authored-by: Clement Zhang <clement.zhang2@gmail.com>
63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
const getEnv = (key: string) => {
|
|
return Deno.env.get(key)
|
|
};
|
|
|
|
const baseUrl = getEnv("BASE_INTERNAL_URL") ?? getEnv("BASE_URL") ?? "http://localhost:8000";
|
|
const baseUrlApi = (baseUrl ?? '') + "/api";
|
|
|
|
import type { ApiRequestOptions } from './ApiRequestOptions.ts';
|
|
|
|
type Headers = Record<string, string>;
|
|
type Middleware<T> = (value: T) => T | Promise<T>;
|
|
type Resolver<T> = (options: ApiRequestOptions<T>) => Promise<T>;
|
|
|
|
export class Interceptors<T> {
|
|
_fns: Middleware<T>[];
|
|
|
|
constructor() {
|
|
this._fns = [];
|
|
}
|
|
|
|
eject(fn: Middleware<T>): void {
|
|
const index = this._fns.indexOf(fn);
|
|
if (index !== -1) {
|
|
this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)];
|
|
}
|
|
}
|
|
|
|
use(fn: Middleware<T>): void {
|
|
this._fns = [...this._fns, fn];
|
|
}
|
|
}
|
|
|
|
export type OpenAPIConfig = {
|
|
BASE: string;
|
|
CREDENTIALS: 'include' | 'omit' | 'same-origin';
|
|
ENCODE_PATH?: ((path: string) => string) | undefined;
|
|
HEADERS?: Headers | Resolver<Headers> | undefined;
|
|
PASSWORD?: string | Resolver<string> | undefined;
|
|
TOKEN?: string | Resolver<string> | undefined;
|
|
USERNAME?: string | Resolver<string> | undefined;
|
|
VERSION: string;
|
|
WITH_CREDENTIALS: boolean;
|
|
interceptors: {
|
|
request: Interceptors<RequestInit>;
|
|
response: Interceptors<Response>;
|
|
};
|
|
};
|
|
|
|
export const OpenAPI: OpenAPIConfig = {
|
|
BASE: baseUrlApi,
|
|
CREDENTIALS: 'include',
|
|
ENCODE_PATH: undefined,
|
|
HEADERS: undefined,
|
|
PASSWORD: undefined,
|
|
TOKEN: getEnv("WM_TOKEN"),
|
|
USERNAME: undefined,
|
|
VERSION: '1.465.0',
|
|
WITH_CREDENTIALS: true,
|
|
interceptors: {
|
|
request: new Interceptors(),
|
|
response: new Interceptors(),
|
|
},
|
|
}; |