windmill-components 1.21.0 → 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 -66
- 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 +144 -61
- package/components/Editor.svelte.d.ts +2 -0
- package/components/EditorBar.svelte +215 -0
- package/components/EditorBar.svelte.d.ts +23 -0
- package/components/FlowBuilder.svelte +151 -79
- package/components/FlowEditor.svelte +77 -130
- 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 +100 -26
- package/components/FlowViewer.svelte.d.ts +8 -3
- 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 +47 -43
- package/components/ModuleStep.svelte +100 -54
- package/components/ObjectResourceInput.svelte +58 -38
- package/components/ObjectTypeNarrowing.svelte +4 -19
- package/components/Path.svelte +3 -3
- 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 +5 -6
- 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 +5 -7
- package/components/ScriptBuilder.svelte +41 -44
- package/components/ScriptEditor.svelte +76 -248
- package/components/ScriptPicker.svelte +13 -26
- 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 +56 -82
- package/components/Tooltip.svelte.d.ts +1 -5
- 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 +44 -41
- 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 -11
- package/components/flows/utils.js +103 -63
- 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 +12 -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/OpenFlow.d.ts +7 -0
- package/gen/models/OpenFlow.js +4 -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 +30 -16
- package/gen/services/FlowService.js +25 -0
- package/gen/services/JobService.d.ts +1 -1
- package/gen/services/ScriptService.d.ts +13 -8
- package/gen/services/WorkspaceService.d.ts +1 -1
- package/gen/services/WorkspaceService.js +1 -1
- package/infer.js +8 -1
- package/package.json +87 -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 +1 -1
- package/stores.js +0 -6
- package/utils.d.ts +26 -6
- package/utils.js +94 -7
- package/components/RadioButtonV2.svelte +0 -38
- package/components/RadioButtonV2.svelte.d.ts +0 -20
package/stores.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ export declare const hubScripts: import("svelte/store").Writable<{
|
|
|
18
18
|
summary: string;
|
|
19
19
|
approved: boolean;
|
|
20
20
|
is_trigger: boolean;
|
|
21
|
+
app: string;
|
|
21
22
|
}[] | undefined>;
|
|
22
23
|
export declare function clearStores(): void;
|
|
23
24
|
export declare const previewResults: import("svelte/store").Writable<Record<number, Object>>;
|
|
24
25
|
export declare function clearPreviewResults(): void;
|
|
25
|
-
export declare function addPreviewResult(res: Object, index: number): void;
|
package/stores.js
CHANGED
package/utils.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Flow, type User } from './gen';
|
|
2
2
|
import type { Schema } from './common';
|
|
3
|
-
import type
|
|
3
|
+
import { type UserExt } from './stores';
|
|
4
4
|
export declare function isToday(someDate: Date): boolean;
|
|
5
5
|
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,18 +52,36 @@ 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;
|
|
72
|
+
export declare function getScriptByPath(path: string): Promise<{
|
|
73
|
+
content: string;
|
|
74
|
+
language: 'deno' | 'python3';
|
|
75
|
+
}>;
|
|
76
|
+
export declare function loadHubScripts(): Promise<void>;
|
|
77
|
+
export declare function loadHubFlows(): Promise<{
|
|
78
|
+
id: number;
|
|
79
|
+
flow_id: number;
|
|
80
|
+
summary: string;
|
|
81
|
+
apps: string[];
|
|
82
|
+
approved: boolean;
|
|
83
|
+
votes: number;
|
|
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,9 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
2
2
|
import { goto } from '$app/navigation';
|
|
3
|
+
import { FlowService, ScriptService } from './gen';
|
|
3
4
|
import { toast } from '@zerodevx/svelte-toast';
|
|
5
|
+
import { get } from 'svelte/store';
|
|
6
|
+
import { hubScripts, workspaceStore } from './stores';
|
|
4
7
|
export function isToday(someDate) {
|
|
5
8
|
const today = new Date();
|
|
6
9
|
return (someDate.getDate() == today.getDate() &&
|
|
@@ -36,6 +39,11 @@ export function displayDate(dateString) {
|
|
|
36
39
|
return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()} at ${date.toLocaleTimeString()}`;
|
|
37
40
|
}
|
|
38
41
|
}
|
|
42
|
+
export function msToSec(ms) {
|
|
43
|
+
if (ms === undefined)
|
|
44
|
+
return '?';
|
|
45
|
+
return (ms / 1000).toLocaleString(undefined, { maximumFractionDigits: 3 });
|
|
46
|
+
}
|
|
39
47
|
export function getToday() {
|
|
40
48
|
var today = new Date();
|
|
41
49
|
return today;
|
|
@@ -134,6 +142,9 @@ export function canWrite(path, extra_perms, user) {
|
|
|
134
142
|
}
|
|
135
143
|
return false;
|
|
136
144
|
}
|
|
145
|
+
export function defaultIfEmptyString(str, dflt) {
|
|
146
|
+
return str == undefined || str == '' ? dflt : str;
|
|
147
|
+
}
|
|
137
148
|
export function removeKeysWithEmptyValues(obj) {
|
|
138
149
|
Object.keys(obj).forEach((key) => (obj[key] === undefined ? delete obj[key] : {}));
|
|
139
150
|
}
|
|
@@ -149,11 +160,17 @@ export function elapsedSinceSecs(date) {
|
|
|
149
160
|
export function pathIsEmpty(path) {
|
|
150
161
|
return path == undefined || path.split('/')[2] == '';
|
|
151
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
|
+
}
|
|
152
169
|
export async function setQuery(url, key, value) {
|
|
153
170
|
url.searchParams.set(key, value);
|
|
154
171
|
await goto(`?${url.searchParams.toString()}`);
|
|
155
172
|
}
|
|
156
|
-
export
|
|
173
|
+
export function setQueryWithoutLoad(url, key, value) {
|
|
157
174
|
const nurl = new URL(url.toString());
|
|
158
175
|
nurl.searchParams.set(key, value);
|
|
159
176
|
history.replaceState(null, '', nurl.toString());
|
|
@@ -212,7 +229,7 @@ export function mapUserToUserExt(user) {
|
|
|
212
229
|
pgroups: user.groups.map((x) => `g/${x}`)
|
|
213
230
|
};
|
|
214
231
|
}
|
|
215
|
-
export function buildExtraLib(previousResultType) {
|
|
232
|
+
export function buildExtraLib(flowInput, previousResultType) {
|
|
216
233
|
return `
|
|
217
234
|
/**
|
|
218
235
|
* get variable (including secret) at path
|
|
@@ -237,7 +254,7 @@ export function step(n: number): any;
|
|
|
237
254
|
/**
|
|
238
255
|
* flow input as an object
|
|
239
256
|
*/
|
|
240
|
-
export const flow_input:
|
|
257
|
+
export const flow_input: ${flowInput};
|
|
241
258
|
|
|
242
259
|
/**
|
|
243
260
|
* previous result as an object
|
|
@@ -281,15 +298,14 @@ export function schemaToTsType(schema) {
|
|
|
281
298
|
.join(';');
|
|
282
299
|
return `{ ${types} }`;
|
|
283
300
|
}
|
|
284
|
-
export function schemaToObject(schema) {
|
|
301
|
+
export function schemaToObject(schema, args) {
|
|
285
302
|
const object = {};
|
|
286
303
|
if (!schema) {
|
|
287
304
|
return object;
|
|
288
305
|
}
|
|
289
306
|
const propKeys = Object.keys(schema.properties);
|
|
290
307
|
propKeys.forEach((key) => {
|
|
291
|
-
|
|
292
|
-
object[key] = prop.type;
|
|
308
|
+
object[key] = args[key] ?? null;
|
|
293
309
|
});
|
|
294
310
|
return object;
|
|
295
311
|
}
|
|
@@ -339,6 +355,9 @@ export function setInputCat(type, format, itemsType, enum_, contentEncoding) {
|
|
|
339
355
|
else if (type == 'string' && format == 'date-time') {
|
|
340
356
|
return 'date';
|
|
341
357
|
}
|
|
358
|
+
else if (type == 'string' && format == 'sql') {
|
|
359
|
+
return 'sql';
|
|
360
|
+
}
|
|
342
361
|
else if (type == 'string' && contentEncoding == 'base64') {
|
|
343
362
|
return 'base64';
|
|
344
363
|
}
|
|
@@ -351,9 +370,77 @@ export function setInputCat(type, format, itemsType, enum_, contentEncoding) {
|
|
|
351
370
|
}
|
|
352
371
|
export function scriptPathToHref(path) {
|
|
353
372
|
if (path.startsWith('hub/')) {
|
|
354
|
-
return 'https://hub.windmill.dev/
|
|
373
|
+
return 'https://hub.windmill.dev/from_version/' + path.substring(4);
|
|
355
374
|
}
|
|
356
375
|
else {
|
|
357
376
|
return `/scripts/get/${path}`;
|
|
358
377
|
}
|
|
359
378
|
}
|
|
379
|
+
export async function getScriptByPath(path) {
|
|
380
|
+
if (path.startsWith('hub/')) {
|
|
381
|
+
const content = await ScriptService.getHubScriptContentByPath({ path });
|
|
382
|
+
return {
|
|
383
|
+
content,
|
|
384
|
+
language: 'deno'
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
const script = await ScriptService.getScriptByPath({
|
|
389
|
+
workspace: get(workspaceStore),
|
|
390
|
+
path: path ?? ''
|
|
391
|
+
});
|
|
392
|
+
return {
|
|
393
|
+
content: script.content,
|
|
394
|
+
language: script.language
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
export async function loadHubScripts() {
|
|
399
|
+
const scripts = (await ScriptService.listHubScripts()).asks ?? [];
|
|
400
|
+
const processed = scripts.map((x) => ({
|
|
401
|
+
path: `hub/${x.id}/${x.summary.toLowerCase().replaceAll(/\s+/g, '_')}`,
|
|
402
|
+
summary: `${x.summary} (${x.app}) ${x.views} uses`,
|
|
403
|
+
approved: x.approved,
|
|
404
|
+
is_trigger: x.is_trigger,
|
|
405
|
+
app: x.app,
|
|
406
|
+
views: x.views,
|
|
407
|
+
votes: x.votes,
|
|
408
|
+
ask_id: x.ask_id,
|
|
409
|
+
})).sort((a, b) => b.views - a.views);
|
|
410
|
+
hubScripts.set(processed);
|
|
411
|
+
}
|
|
412
|
+
export async function loadHubFlows() {
|
|
413
|
+
const flows = (await FlowService.listHubFlows()).flows ?? [];
|
|
414
|
+
const processed = flows.sort((a, b) => b.votes - a.votes);
|
|
415
|
+
return processed;
|
|
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,38 +0,0 @@
|
|
|
1
|
-
<script>export let options;
|
|
2
|
-
export let value;
|
|
3
|
-
import { createEventDispatcher } from 'svelte';
|
|
4
|
-
$: dispatch('change', value);
|
|
5
|
-
const dispatch = createEventDispatcher();
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<div class="flex flex-row space-x-4 m-4 reveal">
|
|
9
|
-
{#each options as [label, val]}
|
|
10
|
-
<button
|
|
11
|
-
type="button"
|
|
12
|
-
on:click={() => {
|
|
13
|
-
value = val
|
|
14
|
-
}}
|
|
15
|
-
class="flex flex-col default-secondary-button-v2 mb-2 w-full"
|
|
16
|
-
class:selected={value == val}
|
|
17
|
-
>
|
|
18
|
-
<h2 class="mb-2">{label.title}</h2>
|
|
19
|
-
<p class="hidden">
|
|
20
|
-
{label.desc}
|
|
21
|
-
</p>
|
|
22
|
-
</button>
|
|
23
|
-
{/each}
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<style>
|
|
27
|
-
.reveal:hover > button > p {
|
|
28
|
-
display: block;
|
|
29
|
-
}
|
|
30
|
-
.selected {
|
|
31
|
-
background-color: rgb(59 130 246 / 0.7);
|
|
32
|
-
--tw-text-opacity: 1;
|
|
33
|
-
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
34
|
-
}
|
|
35
|
-
.selected > h2 {
|
|
36
|
-
--tw-text-opacity: 1;
|
|
37
|
-
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
38
|
-
}</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 {};
|