@windmill-labs/shared-utils 1.0.5 → 1.0.12
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/common.d.ts +5 -2
- package/components/apps/components/display/dbtable/queries/select.d.ts +2 -0
- package/components/apps/components/display/dbtable/utils.d.ts +14 -3
- package/components/apps/editor/appPolicy.d.ts +1 -1
- package/components/apps/editor/appUtilsS3.d.ts +12 -1
- package/components/apps/editor/component/components.d.ts +68 -2
- package/components/apps/inputType.d.ts +4 -2
- package/components/apps/sharedTypes.d.ts +2 -0
- package/components/assets/lib.d.ts +25 -0
- package/components/dbTypes.d.ts +3 -0
- package/components/icons/index.d.ts +101 -0
- package/components/raw_apps/rawAppPolicy.d.ts +1 -1
- package/components/raw_apps/utils.d.ts +1 -1
- package/components/triggers/utils.d.ts +2 -3
- package/gen/schemas.gen.d.ts +915 -71
- package/gen/services.gen.d.ts +329 -23
- package/gen/types.gen.d.ts +1869 -140
- package/hub.d.ts +1 -0
- package/jsr.json +2 -2
- package/lib.d.ts +1 -0
- package/lib.es.js +262 -108
- package/package.json +11 -11
- package/stores.d.ts +1 -0
- package/svelte5Utils.svelte.d.ts +32 -1
- package/utils.d.ts +19 -4
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
2
|
+
"name": "@windmill-labs/shared-utils",
|
|
3
|
+
"version": "1.0.12",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": false,
|
|
6
|
+
"main": "./lib.es.js",
|
|
7
|
+
"module": "./lib.es.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./lib.es.js"
|
|
10
|
+
},
|
|
11
|
+
"types": "./lib.d.ts"
|
|
12
|
+
}
|
package/stores.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface UserWorkspace {
|
|
|
27
27
|
export declare function getWorkspaceFromStorage(): string | undefined;
|
|
28
28
|
export declare function clearWorkspaceFromStorage(): void;
|
|
29
29
|
export declare const tutorialsToDo: import("svelte/store").Writable<number[]>;
|
|
30
|
+
export declare const skippedAll: import("svelte/store").Writable<boolean>;
|
|
30
31
|
export declare const globalEmailInvite: import("svelte/store").Writable<string>;
|
|
31
32
|
export declare const awarenessStore: import("svelte/store").Writable<Record<string, string>>;
|
|
32
33
|
export declare const enterpriseLicense: import("svelte/store").Writable<string | undefined>;
|
package/svelte5Utils.svelte.d.ts
CHANGED
|
@@ -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
|
+
}
|
package/utils.d.ts
CHANGED
|
@@ -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>;
|