windmill-components 1.655.0 → 1.655.2
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/sharedUtils/common.d.ts +5 -2
- package/dist/sharedUtils/components/apps/components/display/dbtable/queries/select.d.ts +2 -0
- package/dist/sharedUtils/components/apps/components/display/dbtable/utils.d.ts +14 -3
- package/dist/sharedUtils/components/apps/editor/appPolicy.d.ts +1 -1
- package/dist/sharedUtils/components/apps/editor/appUtilsS3.d.ts +12 -1
- package/dist/sharedUtils/components/apps/editor/component/components.d.ts +68 -2
- package/dist/sharedUtils/components/apps/inputType.d.ts +4 -2
- package/dist/sharedUtils/components/apps/sharedTypes.d.ts +2 -0
- package/dist/sharedUtils/components/assets/lib.d.ts +25 -0
- package/dist/sharedUtils/components/dbTypes.d.ts +3 -0
- package/dist/sharedUtils/components/icons/index.d.ts +101 -0
- package/dist/sharedUtils/components/raw_apps/rawAppPolicy.d.ts +1 -1
- package/dist/sharedUtils/components/raw_apps/utils.d.ts +1 -1
- package/dist/sharedUtils/components/triggers/utils.d.ts +2 -3
- package/dist/sharedUtils/gen/schemas.gen.d.ts +915 -71
- package/dist/sharedUtils/gen/services.gen.d.ts +329 -23
- package/dist/sharedUtils/gen/types.gen.d.ts +1869 -140
- package/dist/sharedUtils/hub.d.ts +1 -0
- package/dist/sharedUtils/jsr.json +5 -5
- package/dist/sharedUtils/lib.d.ts +1 -1
- package/dist/sharedUtils/lib.es.js +241 -79
- package/dist/sharedUtils/package.json +11 -11
- package/dist/sharedUtils/stores.d.ts +1 -0
- package/dist/sharedUtils/svelte5Utils.svelte.d.ts +32 -1
- package/dist/sharedUtils/utils.d.ts +19 -4
- package/package/components/custom_ui.d.ts +1 -0
- package/package/components/flows/content/FlowInputs.svelte +1 -1
- package/package/components/flows/content/FlowInputsQuick.svelte +1 -1
- package/package/components/flows/map/InsertModuleInner.svelte +2 -0
- package/package/components/runs/RunBadges.svelte +1 -1
- package/package/components/runs/TimeframeSelect.svelte +2 -32
- package/package/components/runs/TimeframeSelect.svelte.d.ts +2 -20
- package/package/components/runs/runsFilter.js +1 -1
- package/package/components/runs/timeframes.d.ts +20 -0
- package/package/components/runs/timeframes.js +33 -0
- package/package/components/runs/useJobsLoader.svelte.d.ts +1 -1
- package/package/svelte5Utils.svelte.d.ts +184 -0
- package/package.json +1 -1
- package/dist/appPolicy/myFunction.es.js +0 -1337
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type StateStore } from './utils';
|
|
2
|
+
import * as runed from 'runed/kit';
|
|
3
|
+
import type z from 'zod';
|
|
2
4
|
export declare function withProps<Component, Props>(component: Component, props: Props): {
|
|
3
5
|
component: Component;
|
|
4
6
|
props: Props;
|
|
@@ -30,6 +32,9 @@ export type UsePromiseOptions = {
|
|
|
30
32
|
loadInit?: boolean;
|
|
31
33
|
clearValueOnRefresh?: boolean;
|
|
32
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Use `resource` from `runed` instead
|
|
37
|
+
*/
|
|
33
38
|
export declare function usePromise<T>(createPromise: () => Promise<T>, { loadInit, clearValueOnRefresh }?: UsePromiseOptions): UsePromiseResult<T>;
|
|
34
39
|
/**
|
|
35
40
|
* Generic change tracker class that monitors changes in state using deep equality comparison
|
|
@@ -47,3 +52,29 @@ export declare class ChangeTracker<T> {
|
|
|
47
52
|
*/
|
|
48
53
|
track(value: T): boolean;
|
|
49
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* This allows using async resources that only fetch missing data based on a set of keys.
|
|
57
|
+
* It maintains a Record of the fetched data and only calls the fetcher for keys that
|
|
58
|
+
* are not already present in the map.
|
|
59
|
+
* The fetcher takes a record of keys to allow fetching multiple items in a single call.
|
|
60
|
+
*/
|
|
61
|
+
export declare class MapResource<U, T> {
|
|
62
|
+
private _cached;
|
|
63
|
+
private _fetcherResource;
|
|
64
|
+
constructor(getValues: () => Record<string, U>, fetcher: (toFetch: Record<string, U>) => Promise<Record<string, T>>);
|
|
65
|
+
get current(): Record<string, T> | undefined;
|
|
66
|
+
get loading(): boolean;
|
|
67
|
+
get error(): Error | undefined;
|
|
68
|
+
}
|
|
69
|
+
export declare class ChangeOnDeepInequality<T> {
|
|
70
|
+
private _cached;
|
|
71
|
+
constructor(compute: () => T);
|
|
72
|
+
get value(): T;
|
|
73
|
+
}
|
|
74
|
+
export declare function useSearchParams<S extends z.ZodType>(schema: S, options?: runed.SearchParamsOptions): runed.ReturnUseSearchParams<S>;
|
|
75
|
+
export declare class StaleWhileLoading<T> {
|
|
76
|
+
private _current;
|
|
77
|
+
private _currentTimeout;
|
|
78
|
+
constructor(getter: () => T, timeout?: number);
|
|
79
|
+
get current(): T | undefined;
|
|
80
|
+
}
|
|
@@ -38,7 +38,7 @@ export declare function validateUsername(username: string): string;
|
|
|
38
38
|
export declare function parseQueryParams(url: string | undefined): Record<string, string>;
|
|
39
39
|
export declare function displayDateOnly(dateString: string | Date | undefined): string;
|
|
40
40
|
export declare function retrieveCommonWorkerPrefix(workerName: string): string;
|
|
41
|
-
export declare function subtractDaysFromDateString(dateString: string |
|
|
41
|
+
export declare function subtractDaysFromDateString(dateString: string | null, days: number): string | undefined;
|
|
42
42
|
export declare function displayDate(dateString: string | Date | undefined, displaySecond?: boolean, displayDate?: boolean): string;
|
|
43
43
|
export declare function displayTime(dateString: string | Date | undefined): string;
|
|
44
44
|
export declare function displaySize(sizeInBytes: number | undefined): string | undefined;
|
|
@@ -63,6 +63,7 @@ export declare function clickOutside(node: Node, options?: ClickOutsideOptions |
|
|
|
63
63
|
destroy(): void;
|
|
64
64
|
update(newOptions: ClickOutsideOptions | boolean): void;
|
|
65
65
|
};
|
|
66
|
+
export declare function undefinedIfEmpty(obj: any): any;
|
|
66
67
|
export declare function pointerDownOutside(node: Node, options?: ClickOutsideOptions): {
|
|
67
68
|
destroy(): void;
|
|
68
69
|
update(newOptions: ClickOutsideOptions): void;
|
|
@@ -136,6 +137,12 @@ export declare function throttle<T>(func: (...args: any[]) => T, wait: number):
|
|
|
136
137
|
export declare function isMac(): boolean;
|
|
137
138
|
export declare function getModifierKey(): string;
|
|
138
139
|
export declare function isValidHexColor(color: string): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Generates a text color with the same hue as the background but adjusted lightness for good contrast
|
|
142
|
+
* @param backgroundColor Hex color string (e.g., "#FF0000" or "#F00")
|
|
143
|
+
* @returns Hex color string with same hue but good contrast, or undefined if invalid
|
|
144
|
+
*/
|
|
145
|
+
export declare function getContrastTextColor(backgroundColor: string | null | undefined): string | undefined;
|
|
139
146
|
export declare function sortObject<T>(o: T & object): T;
|
|
140
147
|
export declare function sortArray<T>(array: T[], compareFn?: (a: T, b: T) => number): T[];
|
|
141
148
|
export declare function generateRandomString(len?: number): string;
|
|
@@ -180,7 +187,7 @@ export declare function getSchemaFromProperties(properties: {
|
|
|
180
187
|
}): Schema;
|
|
181
188
|
export declare function validateFileExtension(ext: string): boolean;
|
|
182
189
|
export declare function isFlowPreview(job_kind: Job['job_kind'] | undefined): job_kind is "flowpreview" | "flownode";
|
|
183
|
-
export declare function isNotFlow(job_kind: Job['job_kind'] | undefined): job_kind is "script" | "aiagent" | "identity" | "preview" | "dependencies" | "flowdependencies" | "appdependencies" | "script_hub" | "deploymentcallback" | "flowscript" | "appscript" | undefined;
|
|
190
|
+
export declare function isNotFlow(job_kind: Job['job_kind'] | undefined): job_kind is "script" | "aiagent" | "identity" | "preview" | "dependencies" | "flowdependencies" | "appdependencies" | "script_hub" | "deploymentcallback" | "flowscript" | "appscript" | "unassigned_script" | "unassigned_flow" | "unassigned_singlestepflow" | undefined;
|
|
184
191
|
export declare function isScriptPreview(job_kind: Job['job_kind'] | undefined): job_kind is "preview" | "flowscript" | "appscript";
|
|
185
192
|
export declare function conditionalMelt(node: HTMLElement, meltItem: AnyMeltElement | undefined): void | import("svelte/action").ActionReturn<undefined, Record<never, any>>;
|
|
186
193
|
export type Item = {
|
|
@@ -195,6 +202,7 @@ export type Item = {
|
|
|
195
202
|
hide?: boolean | undefined;
|
|
196
203
|
extra?: Snippet;
|
|
197
204
|
id?: string;
|
|
205
|
+
tooltip?: string;
|
|
198
206
|
};
|
|
199
207
|
export declare function isObjectTooBig(obj: any): boolean;
|
|
200
208
|
export declare function localeConcatAnd(items: string[]): string;
|
|
@@ -202,11 +210,9 @@ export declare function formatDate(dateString: string | undefined): string;
|
|
|
202
210
|
export declare function formatDateShort(dateString: string | undefined): string;
|
|
203
211
|
export declare function toJsonStr(result: any): string;
|
|
204
212
|
export declare function getOS(): "Windows" | "macOS" | "iOS" | "Android" | "Linux" | "Unknown OS";
|
|
205
|
-
import { type ClassValue } from 'clsx';
|
|
206
213
|
import type { Component, Snippet } from 'svelte';
|
|
207
214
|
import { OpenAPIV2, type OpenAPI, type OpenAPIV3, type OpenAPIV3_1 } from 'openapi-types';
|
|
208
215
|
import type { IPosition } from 'monaco-editor';
|
|
209
|
-
export declare function cn(...inputs: ClassValue[]): string;
|
|
210
216
|
export type StateStore<T> = {
|
|
211
217
|
val: T;
|
|
212
218
|
};
|
|
@@ -241,6 +247,7 @@ export declare function wait(ms: number): Promise<unknown>;
|
|
|
241
247
|
export declare function validateRetryConfig(retry: Retry | undefined): string | null;
|
|
242
248
|
export type CssColor = keyof (typeof tokensFile)['tokens']['light'];
|
|
243
249
|
import tokensFile from './assets/tokens/tokens.json';
|
|
250
|
+
import { Package } from 'lucide-svelte';
|
|
244
251
|
export declare function getCssColor(color: CssColor, { alpha, format }: {
|
|
245
252
|
alpha?: number;
|
|
246
253
|
format?: 'css-var' | 'hex-dark' | 'hex-light';
|
|
@@ -248,3 +255,11 @@ export declare function getCssColor(color: CssColor, { alpha, format }: {
|
|
|
248
255
|
export type IconType = Component<{
|
|
249
256
|
size?: number;
|
|
250
257
|
}> | typeof import('lucide-svelte').Dot;
|
|
258
|
+
export declare function getJobKindIcon(jobKind: Job['job_kind']): import("svelte/legacy").LegacyComponentType | typeof Package | undefined;
|
|
259
|
+
export declare function chunkBy<T>(array: T[], getKey: (key: T) => string): T[][];
|
|
260
|
+
export declare function getQueryStmtCountHeuristic(query: string): number;
|
|
261
|
+
export declare function countChars(str: string, char: string): number;
|
|
262
|
+
export declare function buildReactiveObj<T extends object>(fields: {
|
|
263
|
+
[name in keyof T]: [() => T[name], (v: T[name]) => void];
|
|
264
|
+
}): T;
|
|
265
|
+
export declare function pick<T extends object, K extends keyof T>(obj: T, keys: readonly K[]): Pick<T, K>;
|
|
@@ -251,7 +251,7 @@ let customUi = getContext('customUi');
|
|
|
251
251
|
{/each}
|
|
252
252
|
</div>
|
|
253
253
|
|
|
254
|
-
{#if !failureModule && !preprocessorModule}
|
|
254
|
+
{#if !failureModule && !preprocessorModule && customUi?.aiSandbox != false}
|
|
255
255
|
<h3 class="pb-2 pt-4">AI Sandbox</h3>
|
|
256
256
|
<div class="flex flex-row flex-wrap gap-2">
|
|
257
257
|
<FlowScriptPicker
|
|
@@ -402,7 +402,7 @@ let aiLength = $derived(funcDesc?.length > 0 && !disableAi && selectedKind != 'f
|
|
|
402
402
|
{/await}
|
|
403
403
|
<div class="pb-1"></div>
|
|
404
404
|
{/if}
|
|
405
|
-
{#if selectedKind === 'script' && preFilter === 'all' && !selected}
|
|
405
|
+
{#if selectedKind === 'script' && preFilter === 'all' && !selected && customUi?.aiSandbox != false}
|
|
406
406
|
<div class="pb-0 text-2xs font-normal text-secondary ml-2">AI Sandbox</div>
|
|
407
407
|
<FlowScriptPickerQuick
|
|
408
408
|
eeRestricted={false}
|
|
@@ -159,6 +159,7 @@ let displayPath = $derived(width > 650 || height > 400);
|
|
|
159
159
|
}}
|
|
160
160
|
/>
|
|
161
161
|
{/if}
|
|
162
|
+
{#if customUi?.aiSandbox != false}
|
|
162
163
|
<TopLevelNode
|
|
163
164
|
label="AI Sandbox"
|
|
164
165
|
selected={selectedKind === 'aisandbox'}
|
|
@@ -167,6 +168,7 @@ let displayPath = $derived(width > 650 || height > 400);
|
|
|
167
168
|
}}
|
|
168
169
|
/>
|
|
169
170
|
{/if}
|
|
171
|
+
{/if}
|
|
170
172
|
</div>
|
|
171
173
|
{/if}
|
|
172
174
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">import Tooltip from '../meltComponents/Tooltip.svelte';
|
|
2
2
|
import PreprocessedArgsDisplay from './PreprocessedArgsDisplay.svelte';
|
|
3
3
|
import { truncateHash } from '../../utils';
|
|
4
|
-
import { base } from '
|
|
4
|
+
import { base } from '../../base';
|
|
5
5
|
import { truncateRev } from '../../utils';
|
|
6
6
|
import { workspaceStore } from '../../stores';
|
|
7
7
|
import Badge from '../common/badge/Badge.svelte';
|
|
@@ -1,35 +1,5 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
|
|
3
|
-
let maxTs = new Date().toISOString();
|
|
4
|
-
return { minTs, maxTs };
|
|
5
|
-
}
|
|
6
|
-
export function buildManualTimeframe(minTs, maxTs) {
|
|
7
|
-
return {
|
|
8
|
-
label: formatDateRange(minTs ?? undefined, maxTs ?? undefined),
|
|
9
|
-
minTs,
|
|
10
|
-
maxTs,
|
|
11
|
-
type: 'manual',
|
|
12
|
-
computeMinMax: () => ({ minTs, maxTs })
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export const serviceLogsTimeframes = [
|
|
16
|
-
{ label: '1000 last service logs', computeMinMax: () => ({ minTs: null, maxTs: null }) },
|
|
17
|
-
{ label: 'Within last 5 minutes', computeMinMax: () => computeMinMaxInc(5 * 60 * 1000) },
|
|
18
|
-
{ label: 'Within last 30 minutes', computeMinMax: () => computeMinMaxInc(30 * 60 * 1000) },
|
|
19
|
-
{ label: 'Within last 24 hours', computeMinMax: () => computeMinMaxInc(24 * 60 * 60 * 1000) },
|
|
20
|
-
{ label: 'Within last 7 days', computeMinMax: () => computeMinMaxInc(7 * 24 * 60 * 60 * 1000) },
|
|
21
|
-
{ label: 'Within last month', computeMinMax: () => computeMinMaxInc(30 * 24 * 60 * 60 * 1000) }
|
|
22
|
-
].map((item) => ({ ...item, type: 'dynamic' }));
|
|
23
|
-
export const runsTimeframes = [
|
|
24
|
-
{ label: 'Latest runs', computeMinMax: () => ({ minTs: null, maxTs: null }) },
|
|
25
|
-
{ label: 'Within 30 seconds', computeMinMax: () => computeMinMaxInc(30 * 1000) },
|
|
26
|
-
{ label: 'Within last minute', computeMinMax: () => computeMinMaxInc(60 * 1000) },
|
|
27
|
-
{ label: 'Within last 5 minutes', computeMinMax: () => computeMinMaxInc(5 * 60 * 1000) },
|
|
28
|
-
{ label: 'Within last 30 minutes', computeMinMax: () => computeMinMaxInc(30 * 60 * 1000) },
|
|
29
|
-
{ label: 'Within last 24 hours', computeMinMax: () => computeMinMaxInc(24 * 60 * 60 * 1000) },
|
|
30
|
-
{ label: 'Within last 7 days', computeMinMax: () => computeMinMaxInc(7 * 24 * 60 * 60 * 1000) },
|
|
31
|
-
{ label: 'Within last month', computeMinMax: () => computeMinMaxInc(30 * 24 * 60 * 60 * 1000) }
|
|
32
|
-
].map((item) => ({ ...item, type: 'dynamic' }));
|
|
1
|
+
<script module lang="ts">export { buildManualTimeframe, serviceLogsTimeframes, runsTimeframes } from './timeframes';
|
|
2
|
+
import { buildManualTimeframe } from './timeframes';
|
|
33
3
|
export function useUrlSyncedTimeframe(timeframes) {
|
|
34
4
|
let obj = $state({ timeframe: timeframes[0] });
|
|
35
5
|
let timeframe = $derived(obj.timeframe);
|
|
@@ -1,23 +1,5 @@
|
|
|
1
|
-
export type Timeframe
|
|
2
|
-
|
|
3
|
-
computeMinMax: () => {
|
|
4
|
-
minTs: string | null;
|
|
5
|
-
maxTs: string | null;
|
|
6
|
-
};
|
|
7
|
-
type: 'dynamic';
|
|
8
|
-
} | {
|
|
9
|
-
label: string;
|
|
10
|
-
computeMinMax: () => {
|
|
11
|
-
minTs: string | null;
|
|
12
|
-
maxTs: string | null;
|
|
13
|
-
};
|
|
14
|
-
minTs: string | null;
|
|
15
|
-
maxTs: string | null;
|
|
16
|
-
type: 'manual';
|
|
17
|
-
};
|
|
18
|
-
export declare function buildManualTimeframe(minTs: string | null, maxTs: string | null): Timeframe;
|
|
19
|
-
export declare const serviceLogsTimeframes: Timeframe[];
|
|
20
|
-
export declare const runsTimeframes: Timeframe[];
|
|
1
|
+
export { type Timeframe, buildManualTimeframe, serviceLogsTimeframes, runsTimeframes } from './timeframes';
|
|
2
|
+
import { type Timeframe } from './timeframes';
|
|
21
3
|
export declare function useUrlSyncedTimeframe(timeframes: Timeframe[]): {
|
|
22
4
|
timeframe: Timeframe;
|
|
23
5
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Braces, Calendar, Clock, ServerCog, FileCode, FolderIcon, Hash, ListFilter, Lock, Tag, UserIcon, Zap, CirclePlayIcon } from 'lucide-svelte';
|
|
2
2
|
import { triggerDisplayNamesMap } from '../triggers/utils';
|
|
3
|
-
import { runsTimeframes } from './
|
|
3
|
+
import { runsTimeframes } from './timeframes';
|
|
4
4
|
export function buildRunsFilterSearchbarSchema({ paths, usernames, folders, jobTriggerKinds, isSuperAdmin, isAdminsWorkspace }) {
|
|
5
5
|
return {
|
|
6
6
|
_default_: {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type Timeframe = {
|
|
2
|
+
label: string;
|
|
3
|
+
computeMinMax: () => {
|
|
4
|
+
minTs: string | null;
|
|
5
|
+
maxTs: string | null;
|
|
6
|
+
};
|
|
7
|
+
type: 'dynamic';
|
|
8
|
+
} | {
|
|
9
|
+
label: string;
|
|
10
|
+
computeMinMax: () => {
|
|
11
|
+
minTs: string | null;
|
|
12
|
+
maxTs: string | null;
|
|
13
|
+
};
|
|
14
|
+
minTs: string | null;
|
|
15
|
+
maxTs: string | null;
|
|
16
|
+
type: 'manual';
|
|
17
|
+
};
|
|
18
|
+
export declare function buildManualTimeframe(minTs: string | null, maxTs: string | null): Timeframe;
|
|
19
|
+
export declare const serviceLogsTimeframes: Timeframe[];
|
|
20
|
+
export declare const runsTimeframes: Timeframe[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { formatDateRange } from '../../utils';
|
|
2
|
+
function computeMinMaxInc(inc) {
|
|
3
|
+
let minTs = new Date(new Date().getTime() - inc).toISOString();
|
|
4
|
+
let maxTs = new Date().toISOString();
|
|
5
|
+
return { minTs, maxTs };
|
|
6
|
+
}
|
|
7
|
+
export function buildManualTimeframe(minTs, maxTs) {
|
|
8
|
+
return {
|
|
9
|
+
label: formatDateRange(minTs ?? undefined, maxTs ?? undefined),
|
|
10
|
+
minTs,
|
|
11
|
+
maxTs,
|
|
12
|
+
type: 'manual',
|
|
13
|
+
computeMinMax: () => ({ minTs, maxTs })
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export const serviceLogsTimeframes = [
|
|
17
|
+
{ label: '1000 last service logs', computeMinMax: () => ({ minTs: null, maxTs: null }) },
|
|
18
|
+
{ label: 'Within last 5 minutes', computeMinMax: () => computeMinMaxInc(5 * 60 * 1000) },
|
|
19
|
+
{ label: 'Within last 30 minutes', computeMinMax: () => computeMinMaxInc(30 * 60 * 1000) },
|
|
20
|
+
{ label: 'Within last 24 hours', computeMinMax: () => computeMinMaxInc(24 * 60 * 60 * 1000) },
|
|
21
|
+
{ label: 'Within last 7 days', computeMinMax: () => computeMinMaxInc(7 * 24 * 60 * 60 * 1000) },
|
|
22
|
+
{ label: 'Within last month', computeMinMax: () => computeMinMaxInc(30 * 24 * 60 * 60 * 1000) }
|
|
23
|
+
].map((item) => ({ ...item, type: 'dynamic' }));
|
|
24
|
+
export const runsTimeframes = [
|
|
25
|
+
{ label: 'Latest runs', computeMinMax: () => ({ minTs: null, maxTs: null }) },
|
|
26
|
+
{ label: 'Within 30 seconds', computeMinMax: () => computeMinMaxInc(30 * 1000) },
|
|
27
|
+
{ label: 'Within last minute', computeMinMax: () => computeMinMaxInc(60 * 1000) },
|
|
28
|
+
{ label: 'Within last 5 minutes', computeMinMax: () => computeMinMaxInc(5 * 60 * 1000) },
|
|
29
|
+
{ label: 'Within last 30 minutes', computeMinMax: () => computeMinMaxInc(30 * 60 * 1000) },
|
|
30
|
+
{ label: 'Within last 24 hours', computeMinMax: () => computeMinMaxInc(24 * 60 * 60 * 1000) },
|
|
31
|
+
{ label: 'Within last 7 days', computeMinMax: () => computeMinMaxInc(7 * 24 * 60 * 60 * 1000) },
|
|
32
|
+
{ label: 'Within last month', computeMinMax: () => computeMinMaxInc(30 * 24 * 60 * 60 * 1000) }
|
|
33
|
+
].map((item) => ({ ...item, type: 'dynamic' }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Job, type CompletedJob, type ExtendedJobs } from '../../gen';
|
|
2
2
|
import { type Tweened } from 'svelte/motion';
|
|
3
|
-
import type { Timeframe } from './
|
|
3
|
+
import type { Timeframe } from './timeframes';
|
|
4
4
|
import { type RunsFilterInstance } from './runsFilter';
|
|
5
5
|
export declare function computeJobKinds(jobKindsCat: string | null): string;
|
|
6
6
|
export interface UseJobLoaderArgs {
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import type { StateStore } from './utils';
|
|
2
|
+
export declare function withProps<Component, Props>(component: Component, props: Props): {
|
|
3
|
+
component: Component;
|
|
4
|
+
props: Props;
|
|
5
|
+
};
|
|
6
|
+
export declare function createState<T>(initialValue: T): T;
|
|
7
|
+
export declare function stateSnapshot<T>(state: T): $state.Snapshot<T>;
|
|
8
|
+
export declare function refreshStateStore<T>(store: StateStore<T>): void;
|
|
9
|
+
export type UsePromiseResult<T> = ({
|
|
10
|
+
status: 'loading';
|
|
11
|
+
value?: undefined;
|
|
12
|
+
error?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
status: 'error';
|
|
15
|
+
error: any;
|
|
16
|
+
value?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
status: 'ok';
|
|
19
|
+
value: T;
|
|
20
|
+
error?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
status: 'idle';
|
|
23
|
+
value?: undefined;
|
|
24
|
+
error?: undefined;
|
|
25
|
+
}) & {
|
|
26
|
+
refresh: () => void;
|
|
27
|
+
clear: () => void;
|
|
28
|
+
};
|
|
29
|
+
export type UsePromiseOptions = {
|
|
30
|
+
loadInit?: boolean;
|
|
31
|
+
clearValueOnRefresh?: boolean;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Use `resource` from `runed` instead
|
|
35
|
+
*/
|
|
36
|
+
export declare function usePromise<T>(createPromise: () => Promise<T>, { loadInit, clearValueOnRefresh }?: UsePromiseOptions): UsePromiseResult<T>;
|
|
37
|
+
/**
|
|
38
|
+
* Generic change tracker class that monitors changes in state using deep equality comparison
|
|
39
|
+
* and provides a counter to trigger Svelte 5 reactivity. Similar to the pattern used in
|
|
40
|
+
* FlowGraphV2.svelte's onModulesChange2 function.
|
|
41
|
+
*/
|
|
42
|
+
export declare class ChangeTracker<T> {
|
|
43
|
+
#private;
|
|
44
|
+
counter: number;
|
|
45
|
+
constructor(initialValue?: T);
|
|
46
|
+
/**
|
|
47
|
+
* Check if the value has changed and update the counter to trigger reactivity
|
|
48
|
+
* @param value - The current value to check for changes
|
|
49
|
+
* @returns true if the value changed, false otherwise
|
|
50
|
+
*/
|
|
51
|
+
track(value: T): boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* This allows using async resources that only fetch missing data based on a set of keys.
|
|
55
|
+
* It maintains a Record of the fetched data and only calls the fetcher for keys that
|
|
56
|
+
* are not already present in the map.
|
|
57
|
+
* The fetcher takes a record of keys to allow fetching multiple items in a single call.
|
|
58
|
+
*/
|
|
59
|
+
export declare class MapResource<U, T> {
|
|
60
|
+
private _cached;
|
|
61
|
+
private _fetcherResource;
|
|
62
|
+
constructor(getValues: () => Record<string, U>, fetcher: (toFetch: Record<string, U>) => Promise<Record<string, T>>);
|
|
63
|
+
get current(): Record<string, T> | undefined;
|
|
64
|
+
get loading(): boolean;
|
|
65
|
+
get error(): Error | undefined;
|
|
66
|
+
}
|
|
67
|
+
export declare class ChangeOnDeepInequality<T> {
|
|
68
|
+
private _cached;
|
|
69
|
+
constructor(compute: () => T);
|
|
70
|
+
get value(): T;
|
|
71
|
+
}
|
|
72
|
+
export declare function useReducedMotion(): {
|
|
73
|
+
val: boolean;
|
|
74
|
+
};
|
|
75
|
+
export declare class StaleWhileLoading<T> {
|
|
76
|
+
private _current;
|
|
77
|
+
private _currentTimeout;
|
|
78
|
+
constructor(getter: () => T, timeout?: number);
|
|
79
|
+
get current(): T | undefined;
|
|
80
|
+
}
|
|
81
|
+
export interface UseInfiniteQueryOptions<TData, TPageParam> {
|
|
82
|
+
queryFn: (pageParam: TPageParam) => Promise<TData>;
|
|
83
|
+
initialPageParam: TPageParam;
|
|
84
|
+
getNextPageParam: (lastPage: TData, allPages: TData[]) => TPageParam | undefined;
|
|
85
|
+
}
|
|
86
|
+
export interface UseInfiniteQueryReturn<TData> {
|
|
87
|
+
current: TData[];
|
|
88
|
+
isLoading: boolean;
|
|
89
|
+
isFetchingNextPage: boolean;
|
|
90
|
+
hasNextPage: boolean;
|
|
91
|
+
error: Error | undefined;
|
|
92
|
+
fetchNextPage: () => Promise<void>;
|
|
93
|
+
reset: () => void;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* A Svelte 5 hook that detects when the user has scrolled to the bottom of an element
|
|
97
|
+
*
|
|
98
|
+
* @param selector - CSS selector for the element to monitor (if not provided, monitors window)
|
|
99
|
+
* @param threshold - Distance from bottom in pixels to trigger (default: 0)
|
|
100
|
+
* @returns Object with `current` getter that returns true when at bottom
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* // Monitor a specific element
|
|
104
|
+
* const bottomDetector = useScrollToBottom('.my-scrollable-div', 100)
|
|
105
|
+
*
|
|
106
|
+
* // Monitor the window
|
|
107
|
+
* const windowBottomDetector = useScrollToBottom()
|
|
108
|
+
*
|
|
109
|
+
* $effect(() => {
|
|
110
|
+
* if (bottomDetector.current) {
|
|
111
|
+
* console.log('User scrolled to bottom!')
|
|
112
|
+
* }
|
|
113
|
+
* })
|
|
114
|
+
*/
|
|
115
|
+
export declare function useScrollToBottom(selector: string, threshold?: number): {
|
|
116
|
+
current: boolean;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* A Svelte 5 hook for infinite query/pagination functionality
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* const query = useInfiniteQuery({
|
|
123
|
+
* queryFn: async (page) => fetchItems(page),
|
|
124
|
+
* initialPageParam: 0,
|
|
125
|
+
* getNextPageParam: (lastPage, allPages) =>
|
|
126
|
+
* lastPage.length > 0 ? allPages.length : undefined
|
|
127
|
+
* })
|
|
128
|
+
*
|
|
129
|
+
* // Access data
|
|
130
|
+
* query.current // All pages of data
|
|
131
|
+
* query.isLoading // Initial loading state
|
|
132
|
+
* query.isFetchingNextPage // Loading next page
|
|
133
|
+
* query.hasNextPage // Whether more pages exist
|
|
134
|
+
*
|
|
135
|
+
* // Fetch next page
|
|
136
|
+
* await query.fetchNextPage()
|
|
137
|
+
*/
|
|
138
|
+
export declare function useInfiniteQuery<TData, TPageParam = number>(options: UseInfiniteQueryOptions<TData, TPageParam>): UseInfiniteQueryReturn<TData>;
|
|
139
|
+
export declare function useKeyPressed<Key extends string>(keys: Key[], params?: {
|
|
140
|
+
onKeyUp?: (key: Key, e: KeyboardEvent) => void;
|
|
141
|
+
onKeyDown?: (key: Key, e: KeyboardEvent) => void;
|
|
142
|
+
}): Record<Key, boolean>;
|
|
143
|
+
export declare function useTransformedSyncedValue<T, U>(source: [() => T, (val: T) => void], transform: (val: T) => U, inverseTransform: (val: U) => T): {
|
|
144
|
+
val: U;
|
|
145
|
+
reparse(): void;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Maintains a local copy of a value that syncs back to the parent state in a debounced way.
|
|
149
|
+
*
|
|
150
|
+
* Useful for inputs where you want immediate local reactivity but don't want to
|
|
151
|
+
* flood the parent with updates (e.g. text fields, sliders).
|
|
152
|
+
*
|
|
153
|
+
* @param getter - Reads the canonical value from the parent
|
|
154
|
+
* @param setter - Writes a new canonical value to the parent (called debounced)
|
|
155
|
+
* @param react - A function that reads the fields to react to.
|
|
156
|
+
* @param delay - Debounce delay in ms (default: 300)
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* const debounced = new DebouncedTempValue(
|
|
160
|
+
* () => props.value,
|
|
161
|
+
* (v) => { props.value = v },
|
|
162
|
+
* (t) => t, // react to the value itself
|
|
163
|
+
* 300
|
|
164
|
+
* )
|
|
165
|
+
* // Use debounced.current in the template; writes are debounced to the parent.
|
|
166
|
+
*/
|
|
167
|
+
export declare class DebouncedTempValue<T> {
|
|
168
|
+
#private;
|
|
169
|
+
private setter;
|
|
170
|
+
private delay;
|
|
171
|
+
current: T;
|
|
172
|
+
constructor(getter: () => T, setter: (val: T) => void, react: (t: T) => void, delay?: number);
|
|
173
|
+
/** Flush any pending debounced write immediately. */
|
|
174
|
+
flush(): void;
|
|
175
|
+
}
|
|
176
|
+
export declare function useLocalStorageValue<T>(key: string, defaultValue: T, typ?: 'string' | 'number' | 'boolean'): {
|
|
177
|
+
val: T;
|
|
178
|
+
};
|
|
179
|
+
export declare function onCustomEvent(node: any, { event, handler }: {
|
|
180
|
+
event: any;
|
|
181
|
+
handler: any;
|
|
182
|
+
}): {
|
|
183
|
+
destroy: () => any;
|
|
184
|
+
};
|