windmill-components 1.138.1 → 1.138.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/package/components/apps/editor/inlineScriptsPanel/InlineScriptRunnableByPath.svelte +1 -2
- package/package/components/apps/editor/settingsPanel/mainInput/RunnableSelector.svelte +2 -1
- package/package/components/apps/utils.d.ts +0 -4
- package/package/components/apps/utils.js +0 -31
- package/package/infer.d.ts +4 -0
- package/package/infer.js +30 -1
- package/package.json +1 -1
|
@@ -8,8 +8,7 @@ import { workspaceStore } from '../../../../stores';
|
|
|
8
8
|
import { createEventDispatcher } from 'svelte';
|
|
9
9
|
import { deepEqual } from 'fast-equals';
|
|
10
10
|
import { computeFields } from './utils';
|
|
11
|
-
import { loadSchema } from '
|
|
12
|
-
import { inferArgs } from '../../../../infer';
|
|
11
|
+
import { inferArgs, loadSchema } from '../../../../infer';
|
|
13
12
|
import RunButton from './RunButton.svelte';
|
|
14
13
|
import { getScriptByPath } from '../../../../scripts';
|
|
15
14
|
import { sendUserToast } from '../../../../toast';
|
|
@@ -6,8 +6,9 @@ import InlineScriptList from './InlineScriptList.svelte';
|
|
|
6
6
|
import WorkspaceScriptList from './WorkspaceScriptList.svelte';
|
|
7
7
|
import WorkspaceFlowList from './WorkspaceFlowList.svelte';
|
|
8
8
|
import { createEventDispatcher, getContext } from 'svelte';
|
|
9
|
-
import { getAllScriptNames,
|
|
9
|
+
import { getAllScriptNames, schemaToInputsSpec } from '../../../utils';
|
|
10
10
|
import { defaultIfEmptyString, emptySchema } from '../../../../../utils';
|
|
11
|
+
import { loadSchema } from '../../../../../infer';
|
|
11
12
|
export let defaultUserInput = false;
|
|
12
13
|
export let hideCreateScript = false;
|
|
13
14
|
export let onlyFlow = false;
|
|
@@ -5,10 +5,6 @@ import type { App, ComponentCssProperty, GridItem, HorizontalAlignment, Vertical
|
|
|
5
5
|
export declare const BG_PREFIX = "bg_";
|
|
6
6
|
export declare function migrateApp(app: App): void;
|
|
7
7
|
export declare function allItems(grid: GridItem[], subgrids: Record<string, GridItem[]> | undefined): GridItem[];
|
|
8
|
-
export declare function loadSchema(workspace: string, path: string, runType: 'script' | 'flow' | 'hubscript'): Promise<{
|
|
9
|
-
schema: Schema;
|
|
10
|
-
summary: string | undefined;
|
|
11
|
-
}>;
|
|
12
8
|
export declare function schemaToInputsSpec(schema: Schema, defaultUserInput: boolean): Record<string, StaticAppInput>;
|
|
13
9
|
export declare function accessPropertyByPath<T>(object: T, path: string): any;
|
|
14
10
|
export declare function fieldTypeToTsType(inputType: InputType): string;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { FlowService, ScriptService } from '../../gen';
|
|
2
|
-
import { inferArgs } from '../../infer';
|
|
3
|
-
import { emptySchema } from '../../utils';
|
|
4
1
|
import { twMerge } from 'tailwind-merge';
|
|
5
2
|
export const BG_PREFIX = 'bg_';
|
|
6
3
|
export function migrateApp(app) {
|
|
@@ -22,34 +19,6 @@ export function allItems(grid, subgrids) {
|
|
|
22
19
|
}
|
|
23
20
|
return [...grid, ...Object.values(subgrids).flat()];
|
|
24
21
|
}
|
|
25
|
-
export async function loadSchema(workspace, path, runType) {
|
|
26
|
-
if (runType === 'script') {
|
|
27
|
-
const script = await ScriptService.getScriptByPath({
|
|
28
|
-
workspace,
|
|
29
|
-
path
|
|
30
|
-
});
|
|
31
|
-
return { schema: script.schema, summary: script.summary };
|
|
32
|
-
}
|
|
33
|
-
else if (runType === 'flow') {
|
|
34
|
-
const flow = await FlowService.getFlowByPath({
|
|
35
|
-
workspace,
|
|
36
|
-
path
|
|
37
|
-
});
|
|
38
|
-
return { schema: flow.schema, summary: flow.summary };
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
const script = await ScriptService.getHubScriptByPath({
|
|
42
|
-
path
|
|
43
|
-
});
|
|
44
|
-
if (script.schema == undefined ||
|
|
45
|
-
Object.keys(script.schema).length == 0 ||
|
|
46
|
-
typeof script.schema != 'object') {
|
|
47
|
-
script.schema = emptySchema();
|
|
48
|
-
}
|
|
49
|
-
await inferArgs(script.language, script.content, script.schema);
|
|
50
|
-
return { schema: script.schema, summary: script.summary };
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
22
|
export function schemaToInputsSpec(schema, defaultUserInput) {
|
|
54
23
|
if (schema?.properties == undefined) {
|
|
55
24
|
return {};
|
package/package/infer.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import type { Schema, SupportedLanguage } from './common.js';
|
|
2
2
|
export declare function inferArgs(language: SupportedLanguage, code: string, schema: Schema): Promise<void>;
|
|
3
|
+
export declare function loadSchema(workspace: string, path: string, runType: 'script' | 'flow' | 'hubscript'): Promise<{
|
|
4
|
+
schema: Schema;
|
|
5
|
+
summary: string | undefined;
|
|
6
|
+
}>;
|
package/package/infer.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ScriptService, FlowService } from './gen';
|
|
1
2
|
import { get, writable } from 'svelte/store';
|
|
2
|
-
import { sortObject } from './utils.js';
|
|
3
|
+
import { emptySchema, sortObject } from './utils.js';
|
|
3
4
|
import { tick } from 'svelte';
|
|
4
5
|
import init, { parse_deno, parse_bash, parse_go, parse_python, parse_sql, parse_mysql, parse_bigquery } from 'windmill-parser-wasm';
|
|
5
6
|
import wasmUrl from 'windmill-parser-wasm/windmill_parser_wasm_bg.wasm?url';
|
|
@@ -178,3 +179,31 @@ function argSigToJsonSchemaType(t, oldS) {
|
|
|
178
179
|
oldS.format = undefined;
|
|
179
180
|
}
|
|
180
181
|
}
|
|
182
|
+
export async function loadSchema(workspace, path, runType) {
|
|
183
|
+
if (runType === 'script') {
|
|
184
|
+
const script = await ScriptService.getScriptByPath({
|
|
185
|
+
workspace,
|
|
186
|
+
path
|
|
187
|
+
});
|
|
188
|
+
return { schema: script.schema, summary: script.summary };
|
|
189
|
+
}
|
|
190
|
+
else if (runType === 'flow') {
|
|
191
|
+
const flow = await FlowService.getFlowByPath({
|
|
192
|
+
workspace,
|
|
193
|
+
path
|
|
194
|
+
});
|
|
195
|
+
return { schema: flow.schema, summary: flow.summary };
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
const script = await ScriptService.getHubScriptByPath({
|
|
199
|
+
path
|
|
200
|
+
});
|
|
201
|
+
if (script.schema == undefined ||
|
|
202
|
+
Object.keys(script.schema).length == 0 ||
|
|
203
|
+
typeof script.schema != 'object') {
|
|
204
|
+
script.schema = emptySchema();
|
|
205
|
+
}
|
|
206
|
+
await inferArgs(script.language, script.content, script.schema);
|
|
207
|
+
return { schema: script.schema, summary: script.summary };
|
|
208
|
+
}
|
|
209
|
+
}
|