windmill-components 1.22.42 → 1.28.1
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/components/AppConnect.svelte +93 -47
- package/components/AppConnect.svelte.d.ts +2 -2
- package/components/ArgInfo.svelte +0 -5
- package/components/ArgInput.svelte +91 -64
- package/components/ArgInput.svelte.d.ts +8 -3
- package/components/Button.svelte +4 -4
- package/components/CenteredPage.svelte +1 -1
- package/components/CollapseLink.svelte +12 -0
- package/components/CollapseLink.svelte.d.ts +19 -0
- package/components/CronInput.svelte +84 -0
- package/components/CronInput.svelte.d.ts +18 -0
- package/components/DisplayResult.svelte +23 -7
- package/components/Editor.svelte +136 -66
- package/components/Editor.svelte.d.ts +2 -0
- package/components/EditorBar.svelte +56 -45
- package/components/FlowBuilder.svelte +150 -71
- package/components/FlowEditor.svelte +75 -200
- package/components/FlowEditor.svelte.d.ts +3 -2
- package/components/FlowJobResult.svelte +1 -1
- package/components/FlowPreview.svelte +18 -24
- package/components/FlowPreviewContent.svelte +68 -0
- package/components/FlowPreviewContent.svelte.d.ts +21 -0
- package/components/FlowStatusViewer.svelte +85 -37
- package/components/FlowStatusViewer.svelte.d.ts +3 -2
- package/components/FlowViewer.svelte +77 -45
- package/components/FlowViewer.svelte.d.ts +1 -1
- package/components/IconedResourceType.svelte +30 -5
- package/components/InputTransformForm.svelte +209 -0
- package/components/InputTransformForm.svelte.d.ts +26 -0
- package/components/InviteGlobalUser.svelte +2 -2
- package/components/InviteUser.svelte +2 -2
- package/components/JobStatus.svelte +32 -25
- package/components/Modal.svelte +44 -42
- package/components/ModuleStep.svelte +94 -79
- package/components/ObjectResourceInput.svelte +58 -38
- package/components/ObjectTypeNarrowing.svelte +4 -19
- package/components/Path.svelte +1 -0
- package/components/Path.svelte.d.ts +1 -1
- package/components/RadioButton.svelte +11 -96
- package/components/RadioButton.svelte.d.ts +4 -2
- package/components/ResourceEditor.svelte +4 -5
- package/components/ResourceEditor.svelte.d.ts +2 -2
- package/components/ResourcePicker.svelte +25 -2
- package/components/ResourcePicker.svelte.d.ts +3 -0
- package/components/ResourceTypePicker.svelte +17 -29
- package/components/ResourceTypePicker.svelte.d.ts +1 -0
- package/components/RunForm.svelte +14 -15
- package/components/RunForm.svelte.d.ts +1 -1
- package/components/SchemaEditor.svelte +87 -71
- package/components/SchemaEditor.svelte.d.ts +2 -0
- package/components/SchemaEditorProperty.svelte +11 -0
- package/components/SchemaEditorProperty.svelte.d.ts +17 -0
- package/components/SchemaForm.svelte +21 -127
- package/components/SchemaForm.svelte.d.ts +3 -4
- package/components/SchemaModal.svelte +20 -33
- package/components/SchemaModal.svelte.d.ts +1 -1
- package/components/SchemaViewer.svelte +4 -6
- package/components/ScriptBuilder.svelte +40 -43
- package/components/ScriptEditor.svelte +71 -66
- package/components/ScriptPicker.svelte +10 -12
- package/components/ScriptPicker.svelte.d.ts +1 -1
- package/components/ScriptSchema.svelte +0 -5
- package/components/ShareModal.svelte +1 -1
- package/components/SharedBadge.svelte +12 -10
- package/components/StringTypeNarrowing.svelte +8 -4
- package/components/StringTypeNarrowing.svelte.d.ts +1 -0
- package/components/TableCustom.svelte +7 -9
- package/components/TableSimple.svelte +1 -1
- package/components/Toggle.svelte +8 -10
- package/components/Toggle.svelte.d.ts +5 -11
- package/components/Tooltip.svelte +3 -2
- package/components/VariableEditor.svelte +21 -6
- package/components/flows/CopyFirstStepSchema.svelte +7 -5
- package/components/flows/DynamicInputHelpBox.svelte +1 -1
- package/components/flows/FlowBox.svelte +3 -0
- package/components/flows/FlowBox.svelte.d.ts +23 -0
- package/components/flows/FlowBoxHeader.svelte +9 -0
- package/components/flows/FlowBoxHeader.svelte.d.ts +18 -0
- package/components/flows/FlowInput.svelte +20 -0
- package/components/flows/FlowInput.svelte.d.ts +14 -0
- package/components/flows/FlowInputs.svelte +7 -3
- package/components/flows/FlowModuleHeader.svelte +42 -40
- package/components/flows/FlowModuleHeader.svelte.d.ts +1 -1
- package/components/flows/FlowSettings.svelte +174 -0
- package/components/flows/FlowSettings.svelte.d.ts +21 -0
- package/components/flows/flowStore.d.ts +5 -2
- package/components/flows/flowStore.js +65 -9
- package/components/flows/pickers/FlowScriptPicker.svelte +6 -1
- package/components/flows/pickers/FlowScriptPicker.svelte.d.ts +1 -0
- package/components/flows/utils.d.ts +11 -7
- package/components/flows/utils.js +104 -43
- package/components/icons/AirtableIcon.svelte +17 -0
- package/components/icons/AirtableIcon.svelte.d.ts +17 -0
- package/components/icons/GCloudIcon.svelte +16 -0
- package/components/icons/GCloudIcon.svelte.d.ts +17 -0
- package/components/icons/GItlabIcon.svelte +16 -0
- package/components/icons/GItlabIcon.svelte.d.ts +17 -0
- package/components/icons/GSheetsIcon.svelte +16 -0
- package/components/icons/GSheetsIcon.svelte.d.ts +17 -0
- package/components/icons/GcalIcon.svelte +16 -0
- package/components/icons/GcalIcon.svelte.d.ts +17 -0
- package/components/icons/GdriveIcon.svelte +16 -0
- package/components/icons/GdriveIcon.svelte.d.ts +17 -0
- package/components/icons/GmailIcon.svelte +16 -0
- package/components/icons/GmailIcon.svelte.d.ts +17 -0
- package/components/icons/PostgresIcon.svelte +8 -49
- package/components/icons/Slack.svelte +9 -18
- package/components/icons/TogglIcon.svelte +59 -0
- package/components/icons/TogglIcon.svelte.d.ts +17 -0
- package/components/propertyPicker/ObjectViewer.svelte +35 -37
- package/components/propertyPicker/ObjectViewer.svelte.d.ts +1 -0
- package/components/propertyPicker/OverlayPropertyPicker.svelte +53 -53
- package/components/propertyPicker/OverlayPropertyPicker.svelte.d.ts +5 -2
- package/components/propertyPicker/PropPicker.svelte +13 -15
- package/components/propertyPicker/PropPicker.svelte.d.ts +1 -1
- package/components/propertyPicker/WarningMessage.svelte +14 -41
- package/components/propertyPicker/WarningMessage.svelte.d.ts +11 -8
- package/components/propertyPicker/utils.d.ts +1 -0
- package/components/propertyPicker/utils.js +25 -0
- package/gen/core/OpenAPI.js +1 -1
- package/gen/index.d.ts +11 -2
- package/gen/index.js +1 -2
- package/gen/models/CompletedJob.d.ts +1 -1
- package/gen/models/Flow.d.ts +3 -13
- package/gen/models/FlowMetadata.d.ts +9 -0
- package/gen/models/FlowMetadata.js +4 -0
- package/gen/models/FlowModuleValue.d.ts +5 -22
- package/gen/models/FlowModuleValue.js +1 -15
- package/gen/models/ForloopFlow.d.ts +8 -0
- package/gen/models/ForloopFlow.js +4 -0
- package/gen/models/InputTransform.d.ts +3 -12
- package/gen/models/InputTransform.js +1 -8
- package/gen/models/JavascriptTransform.d.ts +4 -0
- package/gen/models/JavascriptTransform.js +4 -0
- package/gen/models/MainArgSignature.d.ts +1 -1
- package/gen/models/NewSchedule.d.ts +1 -0
- package/gen/models/OpenFlowWPath.d.ts +4 -0
- package/gen/models/OpenFlowWPath.js +4 -0
- package/gen/models/PathFlow.d.ts +4 -0
- package/gen/models/PathFlow.js +4 -0
- package/gen/models/PathScript.d.ts +4 -0
- package/gen/models/PathScript.js +4 -0
- package/gen/models/RawScript.d.ts +12 -0
- package/gen/models/RawScript.js +11 -0
- package/gen/models/Schedule.d.ts +1 -1
- package/gen/models/StaticTransform.d.ts +4 -0
- package/gen/models/StaticTransform.js +4 -0
- package/gen/models/TokenResponse.d.ts +3 -3
- package/gen/models/Usage.d.ts +5 -0
- package/gen/models/Usage.js +4 -0
- package/gen/models/User.d.ts +2 -0
- package/gen/schemas/$AuditLog.d.ts +32 -0
- package/gen/schemas/$AuditLog.js +35 -0
- package/gen/schemas/$CompletedJob.d.ts +98 -0
- package/gen/schemas/$CompletedJob.js +103 -0
- package/gen/schemas/$ContextualVariable.d.ts +16 -0
- package/gen/schemas/$ContextualVariable.js +19 -0
- package/gen/schemas/$CreateResource.d.ts +22 -0
- package/gen/schemas/$CreateResource.js +25 -0
- package/gen/schemas/$CreateVariable.d.ts +26 -0
- package/gen/schemas/$CreateVariable.js +29 -0
- package/gen/schemas/$CreateWorkspace.d.ts +20 -0
- package/gen/schemas/$CreateWorkspace.js +23 -0
- package/gen/schemas/$EditResource.d.ts +13 -0
- package/gen/schemas/$EditResource.js +16 -0
- package/gen/schemas/$EditResourceType.d.ts +10 -0
- package/gen/schemas/$EditResourceType.js +13 -0
- package/gen/schemas/$EditSchedule.d.ts +20 -0
- package/gen/schemas/$EditSchedule.js +23 -0
- package/gen/schemas/$EditVariable.d.ts +16 -0
- package/gen/schemas/$EditVariable.js +19 -0
- package/gen/schemas/$EditWorkspaceUser.d.ts +7 -0
- package/gen/schemas/$EditWorkspaceUser.js +10 -0
- package/gen/schemas/$Flow.d.ts +23 -0
- package/gen/schemas/$Flow.js +26 -0
- package/gen/schemas/$FlowMetadata.d.ts +31 -0
- package/gen/schemas/$FlowMetadata.js +34 -0
- package/gen/schemas/$FlowPreview.d.ts +80 -0
- package/gen/schemas/$FlowPreview.js +83 -0
- package/gen/schemas/$GlobalUserInfo.d.ts +26 -0
- package/gen/schemas/$GlobalUserInfo.js +29 -0
- package/gen/schemas/$Group.d.ts +23 -0
- package/gen/schemas/$Group.js +26 -0
- package/gen/schemas/$Job.d.ts +17 -0
- package/gen/schemas/$Job.js +20 -0
- package/gen/schemas/$ListableVariable.d.ts +35 -0
- package/gen/schemas/$ListableVariable.js +38 -0
- package/gen/schemas/$Login.d.ts +12 -0
- package/gen/schemas/$Login.js +15 -0
- package/gen/schemas/$MainArgSignature.d.ts +50 -0
- package/gen/schemas/$MainArgSignature.js +53 -0
- package/gen/schemas/$NewSchedule.d.ts +30 -0
- package/gen/schemas/$NewSchedule.js +33 -0
- package/gen/schemas/$NewToken.d.ts +11 -0
- package/gen/schemas/$NewToken.js +14 -0
- package/gen/schemas/$NewUser.d.ts +16 -0
- package/gen/schemas/$NewUser.js +19 -0
- package/gen/schemas/$Preview.d.ts +19 -0
- package/gen/schemas/$Preview.js +22 -0
- package/gen/schemas/$QueuedJob.d.ts +139 -0
- package/gen/schemas/$QueuedJob.js +144 -0
- package/gen/schemas/$Resource.d.ts +31 -0
- package/gen/schemas/$Resource.js +34 -0
- package/gen/schemas/$ResourceType.d.ts +17 -0
- package/gen/schemas/$ResourceType.js +20 -0
- package/gen/schemas/$Schedule.d.ts +47 -0
- package/gen/schemas/$Schedule.js +50 -0
- package/gen/schemas/$Script.d.ts +77 -0
- package/gen/schemas/$Script.js +80 -0
- package/gen/schemas/$ScriptArgs.d.ts +6 -0
- package/gen/schemas/$ScriptArgs.js +9 -0
- package/gen/schemas/$SlackToken.d.ts +24 -0
- package/gen/schemas/$SlackToken.js +27 -0
- package/gen/schemas/$TokenResponse.d.ts +23 -0
- package/gen/schemas/$TokenResponse.js +26 -0
- package/gen/schemas/$TruncatedToken.d.ts +25 -0
- package/gen/schemas/$TruncatedToken.js +28 -0
- package/gen/schemas/$Usage.d.ts +13 -0
- package/gen/schemas/$Usage.js +16 -0
- package/gen/schemas/$User.d.ts +42 -0
- package/gen/schemas/$User.js +45 -0
- package/gen/schemas/$UserWorkspaceList.d.ts +28 -0
- package/gen/schemas/$UserWorkspaceList.js +31 -0
- package/gen/schemas/$WorkerPing.d.ts +31 -0
- package/gen/schemas/$WorkerPing.js +34 -0
- package/gen/schemas/$Workspace.d.ts +19 -0
- package/gen/schemas/$Workspace.js +22 -0
- package/gen/schemas/$WorkspaceInvite.d.ts +16 -0
- package/gen/schemas/$WorkspaceInvite.js +19 -0
- package/gen/services/FlowService.d.ts +24 -23
- package/gen/services/FlowService.js +14 -0
- package/gen/services/JobService.d.ts +1 -1
- package/gen/services/ScriptService.d.ts +13 -19
- package/gen/services/ScriptService.js +0 -14
- package/gen/services/WorkspaceService.d.ts +1 -1
- package/gen/services/WorkspaceService.js +1 -1
- package/infer.js +8 -1
- package/package.json +83 -15
- package/script_helpers.d.ts +1 -1
- package/script_helpers.js +7 -6
- package/sql.d.ts +89 -0
- package/sql.js +817 -0
- package/stores.d.ts +0 -1
- package/stores.js +0 -6
- package/utils.d.ts +12 -5
- package/utils.js +55 -9
- package/components/RadioButtonV2.svelte +0 -33
- package/components/RadioButtonV2.svelte.d.ts +0 -20
package/stores.d.ts
CHANGED
|
@@ -23,4 +23,3 @@ export declare const hubScripts: import("svelte/store").Writable<{
|
|
|
23
23
|
export declare function clearStores(): void;
|
|
24
24
|
export declare const previewResults: import("svelte/store").Writable<Record<number, Object>>;
|
|
25
25
|
export declare function clearPreviewResults(): void;
|
|
26
|
-
export declare function addPreviewResult(res: Object, index: number): void;
|
package/stores.js
CHANGED
package/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type User } from './gen';
|
|
1
|
+
import { type Flow, type User } from './gen';
|
|
2
2
|
import type { Schema } from './common';
|
|
3
3
|
import { type UserExt } from './stores';
|
|
4
4
|
export declare function isToday(someDate: Date): boolean;
|
|
@@ -6,6 +6,7 @@ export declare function daysAgo(someDate: Date): number;
|
|
|
6
6
|
export declare function secondsAgo(date: Date): number;
|
|
7
7
|
export declare function displayDaysAgo(dateString: string): string;
|
|
8
8
|
export declare function displayDate(dateString: string | undefined): string;
|
|
9
|
+
export declare function msToSec(ms: number | undefined): string;
|
|
9
10
|
export declare function getToday(): Date;
|
|
10
11
|
export declare function sendUserToast(message: string, error?: boolean): void;
|
|
11
12
|
export declare function truncateHash(hash: string): string;
|
|
@@ -43,6 +44,7 @@ export declare function simpleSchema(): {
|
|
|
43
44
|
};
|
|
44
45
|
export declare function removeItemAll<T>(arr: T[], value: T): T[];
|
|
45
46
|
export declare function canWrite(path: string, extra_perms: Record<string, boolean>, user?: UserExt): boolean;
|
|
47
|
+
export declare function defaultIfEmptyString(str: string | undefined, dflt: string): string;
|
|
46
48
|
export declare function removeKeysWithEmptyValues(obj: any): any;
|
|
47
49
|
export declare function allTrue(dict: {
|
|
48
50
|
[id: string]: boolean;
|
|
@@ -50,19 +52,21 @@ export declare function allTrue(dict: {
|
|
|
50
52
|
export declare function forLater(scheduledString: string): boolean;
|
|
51
53
|
export declare function elapsedSinceSecs(date: string): number;
|
|
52
54
|
export declare function pathIsEmpty(path: string): boolean;
|
|
55
|
+
export declare function encodeState(state: any): string;
|
|
56
|
+
export declare function decodeState(query: string): any;
|
|
53
57
|
export declare function setQuery(url: URL, key: string, value: string): Promise<void>;
|
|
54
|
-
export declare function setQueryWithoutLoad(url: URL, key: string, value: string):
|
|
58
|
+
export declare function setQueryWithoutLoad(url: URL, key: string, value: string): void;
|
|
55
59
|
export declare function groupBy<T>(scripts: T[], toGroup: (t: T) => string, dflts?: string[]): [string, T[]][];
|
|
56
60
|
export declare function truncate(s: string, n: number, suffix?: string): string;
|
|
57
61
|
export declare function truncateRev(s: string, n: number, prefix?: string): string;
|
|
58
62
|
export declare function isString(value: any): boolean;
|
|
59
63
|
export declare function mapUserToUserExt(user: User): UserExt;
|
|
60
|
-
export declare function buildExtraLib(previousResultType?: string): string;
|
|
64
|
+
export declare function buildExtraLib(flowInput: string, previousResultType?: string): string;
|
|
61
65
|
export declare function schemaToTsType(schema: Schema): string;
|
|
62
|
-
export declare function schemaToObject(schema: Schema): Object;
|
|
66
|
+
export declare function schemaToObject(schema: Schema, args: Record<string, any>): Object;
|
|
63
67
|
export declare function valueToTsType(value: any): string;
|
|
64
68
|
export declare function objectToTsType(object: Object): string;
|
|
65
|
-
export declare type InputCat = "string" | "number" | "boolean" | "list" | "resource-object" | "enum" | "date" | "base64" | "resource-string" | "object";
|
|
69
|
+
export declare type InputCat = "string" | "number" | "boolean" | "list" | "resource-object" | "enum" | "date" | "base64" | "resource-string" | "object" | "sql";
|
|
66
70
|
export declare function setInputCat(type: string | undefined, format: string | undefined, itemsType: string | undefined, enum_: any, contentEncoding: string | undefined): InputCat;
|
|
67
71
|
export declare function scriptPathToHref(path: string): string;
|
|
68
72
|
export declare function getScriptByPath(path: string): Promise<{
|
|
@@ -78,3 +82,6 @@ export declare function loadHubFlows(): Promise<{
|
|
|
78
82
|
approved: boolean;
|
|
79
83
|
votes: number;
|
|
80
84
|
}[]>;
|
|
85
|
+
export declare function formatCron(inp: string): string;
|
|
86
|
+
export declare function flowToHubUrl(flow: Flow): URL;
|
|
87
|
+
export declare function scriptToHubUrl(content: string, summary: string, description: string, trigger: boolean): URL;
|
package/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
2
2
|
import { goto } from '$app/navigation';
|
|
3
|
-
import { FlowService,
|
|
3
|
+
import { FlowService, ScriptService } from './gen';
|
|
4
4
|
import { toast } from '@zerodevx/svelte-toast';
|
|
5
5
|
import { get } from 'svelte/store';
|
|
6
6
|
import { hubScripts, workspaceStore } from './stores';
|
|
@@ -39,6 +39,11 @@ export function displayDate(dateString) {
|
|
|
39
39
|
return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()} at ${date.toLocaleTimeString()}`;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
export function msToSec(ms) {
|
|
43
|
+
if (ms === undefined)
|
|
44
|
+
return '?';
|
|
45
|
+
return (ms / 1000).toLocaleString(undefined, { maximumFractionDigits: 3 });
|
|
46
|
+
}
|
|
42
47
|
export function getToday() {
|
|
43
48
|
var today = new Date();
|
|
44
49
|
return today;
|
|
@@ -137,6 +142,9 @@ export function canWrite(path, extra_perms, user) {
|
|
|
137
142
|
}
|
|
138
143
|
return false;
|
|
139
144
|
}
|
|
145
|
+
export function defaultIfEmptyString(str, dflt) {
|
|
146
|
+
return str == undefined || str == '' ? dflt : str;
|
|
147
|
+
}
|
|
140
148
|
export function removeKeysWithEmptyValues(obj) {
|
|
141
149
|
Object.keys(obj).forEach((key) => (obj[key] === undefined ? delete obj[key] : {}));
|
|
142
150
|
}
|
|
@@ -152,11 +160,17 @@ export function elapsedSinceSecs(date) {
|
|
|
152
160
|
export function pathIsEmpty(path) {
|
|
153
161
|
return path == undefined || path.split('/')[2] == '';
|
|
154
162
|
}
|
|
163
|
+
export function encodeState(state) {
|
|
164
|
+
return btoa(encodeURIComponent(JSON.stringify(state)));
|
|
165
|
+
}
|
|
166
|
+
export function decodeState(query) {
|
|
167
|
+
return JSON.parse(decodeURIComponent(atob(query)));
|
|
168
|
+
}
|
|
155
169
|
export async function setQuery(url, key, value) {
|
|
156
170
|
url.searchParams.set(key, value);
|
|
157
171
|
await goto(`?${url.searchParams.toString()}`);
|
|
158
172
|
}
|
|
159
|
-
export
|
|
173
|
+
export function setQueryWithoutLoad(url, key, value) {
|
|
160
174
|
const nurl = new URL(url.toString());
|
|
161
175
|
nurl.searchParams.set(key, value);
|
|
162
176
|
history.replaceState(null, '', nurl.toString());
|
|
@@ -215,7 +229,7 @@ export function mapUserToUserExt(user) {
|
|
|
215
229
|
pgroups: user.groups.map((x) => `g/${x}`)
|
|
216
230
|
};
|
|
217
231
|
}
|
|
218
|
-
export function buildExtraLib(previousResultType) {
|
|
232
|
+
export function buildExtraLib(flowInput, previousResultType) {
|
|
219
233
|
return `
|
|
220
234
|
/**
|
|
221
235
|
* get variable (including secret) at path
|
|
@@ -240,7 +254,7 @@ export function step(n: number): any;
|
|
|
240
254
|
/**
|
|
241
255
|
* flow input as an object
|
|
242
256
|
*/
|
|
243
|
-
export const flow_input:
|
|
257
|
+
export const flow_input: ${flowInput};
|
|
244
258
|
|
|
245
259
|
/**
|
|
246
260
|
* previous result as an object
|
|
@@ -284,15 +298,14 @@ export function schemaToTsType(schema) {
|
|
|
284
298
|
.join(';');
|
|
285
299
|
return `{ ${types} }`;
|
|
286
300
|
}
|
|
287
|
-
export function schemaToObject(schema) {
|
|
301
|
+
export function schemaToObject(schema, args) {
|
|
288
302
|
const object = {};
|
|
289
303
|
if (!schema) {
|
|
290
304
|
return object;
|
|
291
305
|
}
|
|
292
306
|
const propKeys = Object.keys(schema.properties);
|
|
293
307
|
propKeys.forEach((key) => {
|
|
294
|
-
|
|
295
|
-
object[key] = prop.type;
|
|
308
|
+
object[key] = args[key] ?? null;
|
|
296
309
|
});
|
|
297
310
|
return object;
|
|
298
311
|
}
|
|
@@ -342,6 +355,9 @@ export function setInputCat(type, format, itemsType, enum_, contentEncoding) {
|
|
|
342
355
|
else if (type == 'string' && format == 'date-time') {
|
|
343
356
|
return 'date';
|
|
344
357
|
}
|
|
358
|
+
else if (type == 'string' && format == 'sql') {
|
|
359
|
+
return 'sql';
|
|
360
|
+
}
|
|
345
361
|
else if (type == 'string' && contentEncoding == 'base64') {
|
|
346
362
|
return 'base64';
|
|
347
363
|
}
|
|
@@ -380,7 +396,7 @@ export async function getScriptByPath(path) {
|
|
|
380
396
|
}
|
|
381
397
|
}
|
|
382
398
|
export async function loadHubScripts() {
|
|
383
|
-
const scripts = await ScriptService.listHubScripts();
|
|
399
|
+
const scripts = (await ScriptService.listHubScripts()).asks ?? [];
|
|
384
400
|
const processed = scripts.map((x) => ({
|
|
385
401
|
path: `hub/${x.id}/${x.summary.toLowerCase().replaceAll(/\s+/g, '_')}`,
|
|
386
402
|
summary: `${x.summary} (${x.app}) ${x.views} uses`,
|
|
@@ -394,7 +410,37 @@ export async function loadHubScripts() {
|
|
|
394
410
|
hubScripts.set(processed);
|
|
395
411
|
}
|
|
396
412
|
export async function loadHubFlows() {
|
|
397
|
-
const flows = await FlowService.listHubFlows();
|
|
413
|
+
const flows = (await FlowService.listHubFlows()).flows ?? [];
|
|
398
414
|
const processed = flows.sort((a, b) => b.votes - a.votes);
|
|
399
415
|
return processed;
|
|
400
416
|
}
|
|
417
|
+
export function formatCron(inp) {
|
|
418
|
+
// Allow for cron expressions inputted by the user to omit month and year
|
|
419
|
+
let splitted = inp.split(' ');
|
|
420
|
+
splitted = splitted.filter(String); //remove empty string elements
|
|
421
|
+
if (6 - splitted.length > 0) {
|
|
422
|
+
return splitted.concat(Array(6 - splitted.length).fill('*')).join(' ');
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
return inp;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
export function flowToHubUrl(flow) {
|
|
429
|
+
const url = new URL('https://hub.windmill.dev/flows/add');
|
|
430
|
+
const openFlow = {
|
|
431
|
+
value: flow.value,
|
|
432
|
+
summary: flow.summary,
|
|
433
|
+
description: flow.description,
|
|
434
|
+
schema: flow.schema
|
|
435
|
+
};
|
|
436
|
+
url.searchParams.append('flow', encodeState(openFlow));
|
|
437
|
+
return url;
|
|
438
|
+
}
|
|
439
|
+
export function scriptToHubUrl(content, summary, description, trigger) {
|
|
440
|
+
const url = new URL('https://hub.windmill.dev/scripts/add');
|
|
441
|
+
url.searchParams.append('content', content);
|
|
442
|
+
url.searchParams.append('summary', summary);
|
|
443
|
+
url.searchParams.append('description', description);
|
|
444
|
+
url.searchParams.append('trigger', trigger.toString());
|
|
445
|
+
return url;
|
|
446
|
+
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
<script>export let options;
|
|
2
|
-
export let value;
|
|
3
|
-
import { createEventDispatcher } from 'svelte';
|
|
4
|
-
import Tooltip from './Tooltip.svelte';
|
|
5
|
-
$: dispatch('change', value);
|
|
6
|
-
const dispatch = createEventDispatcher();
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<div class="flex flex-row gap-x-4 m-4 reveal flex-wrap ">
|
|
10
|
-
{#each options as [label, val]}
|
|
11
|
-
<button
|
|
12
|
-
type="button"
|
|
13
|
-
on:click={() => {
|
|
14
|
-
value = val
|
|
15
|
-
}}
|
|
16
|
-
class="flex flex-col default-secondary-button-v2 mb-2 grow"
|
|
17
|
-
class:selected={value == val}
|
|
18
|
-
>
|
|
19
|
-
<h2 class="mb-2 whitespace-nowrap">{label.title} <Tooltip>{label.desc}</Tooltip></h2>
|
|
20
|
-
</button>
|
|
21
|
-
{/each}
|
|
22
|
-
</div>
|
|
23
|
-
|
|
24
|
-
<style>
|
|
25
|
-
.selected {
|
|
26
|
-
background-color: rgb(59 130 246 / 0.7);
|
|
27
|
-
--tw-text-opacity: 1;
|
|
28
|
-
color: rgb(255 255 255 / var(--tw-text-opacity))
|
|
29
|
-
}
|
|
30
|
-
.selected > h2 {
|
|
31
|
-
--tw-text-opacity: 1;
|
|
32
|
-
color: rgb(255 255 255 / var(--tw-text-opacity))
|
|
33
|
-
}</style>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
options: [{
|
|
5
|
-
title: string;
|
|
6
|
-
desc?: string;
|
|
7
|
-
}, string][];
|
|
8
|
-
value: any;
|
|
9
|
-
};
|
|
10
|
-
events: {
|
|
11
|
-
[evt: string]: CustomEvent<any>;
|
|
12
|
-
};
|
|
13
|
-
slots: {};
|
|
14
|
-
};
|
|
15
|
-
export declare type RadioButtonV2Props = typeof __propDef.props;
|
|
16
|
-
export declare type RadioButtonV2Events = typeof __propDef.events;
|
|
17
|
-
export declare type RadioButtonV2Slots = typeof __propDef.slots;
|
|
18
|
-
export default class RadioButtonV2 extends SvelteComponentTyped<RadioButtonV2Props, RadioButtonV2Events, RadioButtonV2Slots> {
|
|
19
|
-
}
|
|
20
|
-
export {};
|