windmill-components 1.103.2 → 1.109.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/package/components/AppConnect.svelte +4 -1
- package/package/components/ArgInput.svelte +81 -68
- package/package/components/ArgInput.svelte.d.ts +0 -2
- package/package/components/Awareness.svelte +17 -0
- package/package/components/Awareness.svelte.d.ts +14 -0
- package/package/components/CliHelpBox.svelte +2 -5
- package/package/components/Editor.svelte +81 -30
- package/package/components/Editor.svelte.d.ts +4 -0
- package/package/components/EditorBar.svelte +127 -131
- package/package/components/EditorBar.svelte.d.ts +8 -0
- package/package/components/FlowBuilder.svelte +6 -1
- package/package/components/FlowStatusViewer.svelte +157 -144
- package/package/components/FlowStatusViewer.svelte.d.ts +1 -0
- package/package/components/HighlightCode.svelte +9 -2
- package/package/components/HighlightCode.svelte.d.ts +1 -0
- package/package/components/InputTransformForm.svelte +1 -1
- package/package/components/InputTransformSchemaForm.svelte +4 -1
- package/package/components/InputTransformSchemaForm.svelte.d.ts +3 -0
- package/package/components/ObjectTypeNarrowing.svelte +8 -2
- package/package/components/ResourcePicker.svelte +0 -1
- package/package/components/ResourceTypePicker.svelte +1 -1
- package/package/components/RunForm.svelte.d.ts +1 -1
- package/package/components/ScheduleEditor.svelte +35 -3
- package/package/components/SchemaEditor.svelte +7 -8
- package/package/components/SchemaEditor.svelte.d.ts +1 -1
- package/package/components/SchemaForm.svelte.d.ts +1 -1
- package/package/components/SchemaModal.svelte +7 -12
- package/package/components/SchemaModal.svelte.d.ts +2 -3
- package/package/components/SchemaViewer.svelte +7 -1
- package/package/components/SchemaViewer.svelte.d.ts +1 -1
- package/package/components/ScriptBuilder.svelte +95 -21
- package/package/components/ScriptEditor.svelte +114 -6
- package/package/components/ScriptEditor.svelte.d.ts +7 -1
- package/package/components/ScriptSchema.svelte.d.ts +1 -1
- package/package/components/TemplateEditor.svelte +1 -0
- package/package/components/Toggle.svelte +1 -1
- package/package/components/Urlize.svelte +19 -0
- package/package/components/Urlize.svelte.d.ts +16 -0
- package/package/components/UserSettings.svelte +57 -36
- package/package/components/UserSettings.svelte.d.ts +1 -0
- package/package/components/VariableEditor.svelte +1 -1
- package/package/components/apps/components/buttons/AppSchemaForm.svelte +6 -1
- package/package/components/apps/components/display/AppDisplayComponent.svelte +6 -1
- package/package/components/apps/components/display/AppDownload.svelte +33 -25
- package/package/components/apps/components/display/AppFlowStatusComponent.svelte +2 -2
- package/package/components/apps/components/display/AppLogsComponent.svelte +2 -2
- package/package/components/apps/components/display/AppText.svelte +9 -14
- package/package/components/apps/components/display/table/AppAggridTable.svelte +45 -36
- package/package/components/apps/components/display/table/AppTable.svelte +5 -2
- package/package/components/apps/components/helpers/ComponentErrorHandler.svelte +26 -0
- package/package/components/apps/components/helpers/ComponentErrorHandler.svelte.d.ts +18 -0
- package/package/components/apps/components/helpers/InputValue.svelte +15 -17
- package/package/components/apps/components/helpers/NonRunnableComponent.svelte +1 -1
- package/package/components/apps/components/helpers/eval.d.ts +1 -0
- package/package/components/apps/components/helpers/eval.js +3 -1
- package/package/components/apps/components/inputs/AppCheckbox.svelte +21 -8
- package/package/components/apps/components/inputs/AppDateInput.svelte +6 -1
- package/package/components/apps/components/inputs/AppMultiSelect.svelte +18 -7
- package/package/components/apps/components/inputs/AppNumberInput.svelte +6 -1
- package/package/components/apps/components/inputs/AppRangeInput.svelte +6 -2
- package/package/components/apps/components/inputs/AppSelect.svelte +11 -3
- package/package/components/apps/components/inputs/AppSelectStep.svelte +19 -6
- package/package/components/apps/components/inputs/AppSelectTab.svelte +9 -1
- package/package/components/apps/components/inputs/AppSliderInputs.svelte +6 -1
- package/package/components/apps/components/inputs/AppTextInput.svelte +6 -1
- package/package/components/apps/components/inputs/currency/AppCurrencyInput.svelte +6 -1
- package/package/components/apps/components/inputs/currency/CurrencyInput.svelte +0 -1
- package/package/components/apps/editor/AppEditor.svelte +4 -7
- package/package/components/apps/editor/AppEditor.svelte.d.ts +3 -2
- package/package/components/apps/editor/AppEditorHeader.svelte +38 -11
- package/package/components/apps/editor/AppEditorHeader.svelte.d.ts +3 -0
- package/package/components/apps/editor/AppPreview.svelte +9 -7
- package/package/components/apps/editor/AppPreview.svelte.d.ts +6 -6
- package/package/components/apps/editor/ConnectionInstructions.svelte +1 -0
- package/package/components/apps/editor/DeploymentHistory.svelte +70 -0
- package/package/components/apps/editor/DeploymentHistory.svelte.d.ts +18 -0
- package/package/components/apps/editor/RecomputeAllComponents.svelte +49 -20
- package/package/components/apps/editor/component/ComponentNavigation.svelte +51 -20
- package/package/components/apps/editor/component/ComponentNavigation.svelte.d.ts +4 -1
- package/package/components/apps/editor/component/components.d.ts +50 -49
- package/package/components/apps/editor/component/components.js +6 -0
- package/package/components/apps/editor/inlineScriptsPanel/EmptyInlineScript.svelte +1 -0
- package/package/components/apps/editor/inlineScriptsPanel/InlineScriptsPanelList.svelte +2 -2
- package/package/components/apps/editor/settingsPanel/ComponentPanel.svelte +1 -4
- package/package/components/apps/editor/settingsPanel/inputEditor/StaticInputEditor.svelte +4 -7
- package/package/components/apps/rx.js +6 -1
- package/package/components/apps/types.d.ts +1 -1
- package/package/components/apps/utils.js +1 -0
- package/package/components/common/button/ButtonDropdown.svelte +45 -19
- package/package/components/common/button/ButtonDropdown.svelte.d.ts +1 -0
- package/package/components/common/modal/Modal.svelte +13 -2
- package/package/components/common/modal/Modal.svelte.d.ts +1 -0
- package/package/components/common/table/AppRow.svelte +33 -3
- package/package/components/flows/content/FlowModuleCache.svelte +37 -0
- package/package/components/flows/content/FlowModuleCache.svelte.d.ts +17 -0
- package/package/components/flows/content/FlowModuleComponent.svelte +57 -54
- package/package/components/flows/content/FlowModuleEarlyStop.svelte +1 -1
- package/package/components/flows/content/FlowModuleHeader.svelte +12 -1
- package/package/components/flows/content/FlowModuleHeader.svelte.d.ts +1 -0
- package/package/components/flows/content/FlowModuleSleep.svelte +1 -1
- package/package/components/flows/content/FlowModuleSuspend.svelte +1 -7
- package/package/components/flows/content/ScriptEditorDrawer.svelte +2 -1
- package/package/components/flows/map/FlowModuleSchemaItem.svelte +13 -1
- package/package/components/flows/map/FlowModuleSchemaItem.svelte.d.ts +1 -0
- package/package/components/flows/map/FlowModuleSchemaMap.svelte +49 -5
- package/package/components/flows/map/MapItem.svelte +9 -2
- package/package/components/flows/map/MapItem.svelte.d.ts +1 -0
- package/package/components/flows/pickers/PickHubApp.svelte +2 -1
- package/package/components/flows/pickers/PickHubApp.svelte.d.ts +1 -0
- package/package/components/flows/pickers/PickHubFlow.svelte +2 -1
- package/package/components/flows/pickers/PickHubFlow.svelte.d.ts +1 -0
- package/package/components/flows/pickers/PickHubScript.svelte +2 -1
- package/package/components/flows/pickers/PickHubScript.svelte.d.ts +1 -0
- package/package/components/flows/previousResults.d.ts +2 -0
- package/package/components/flows/previousResults.js +46 -0
- package/package/components/graph/FlowGraph.svelte +1 -1
- package/package/components/home/ItemsList.svelte +11 -3
- package/package/components/home/ListFilters.svelte +39 -0
- package/package/components/home/ListFilters.svelte.d.ts +4 -0
- package/package/components/propertyPicker/ObjectViewer.svelte +77 -79
- package/package/components/propertyPicker/ObjectViewer.svelte.d.ts +1 -1
- package/package/components/propertyPicker/PropPicker.svelte +18 -0
- package/package/components/sidebar/MultiplayerMenu.svelte +123 -0
- package/package/components/sidebar/MultiplayerMenu.svelte.d.ts +16 -0
- package/package/components/sidebar/WorkspaceMenu.svelte +1 -1
- package/package/gen/core/CancelablePromise.d.ts +2 -8
- package/package/gen/core/CancelablePromise.js +38 -36
- package/package/gen/core/OpenAPI.js +1 -1
- package/package/gen/core/request.js +3 -2
- package/package/gen/models/AuditLog.d.ts +1 -1
- package/package/gen/models/CreateInput.d.ts +1 -1
- package/package/gen/models/FlowMetadata.d.ts +1 -1
- package/package/gen/models/FlowModule.d.ts +1 -0
- package/package/gen/models/Input.d.ts +1 -1
- package/package/gen/models/NewScript.d.ts +2 -1
- package/package/gen/models/NewToken.d.ts +1 -0
- package/package/gen/models/OpenFlow.d.ts +1 -1
- package/package/gen/models/Policy.d.ts +1 -1
- package/package/gen/models/Script.d.ts +2 -1
- package/package/gen/models/TruncatedToken.d.ts +1 -0
- package/package/gen/services/AppService.d.ts +1 -1
- package/package/gen/services/JobService.d.ts +64 -4
- package/package/gen/services/JobService.js +45 -0
- package/package/gen/services/ResourceService.d.ts +2 -1
- package/package/gen/services/ResourceService.js +4 -1
- package/package/gen/services/ScriptService.d.ts +0 -45
- package/package/gen/services/ScriptService.js +0 -52
- package/package/gen/services/SettingsService.d.ts +6 -0
- package/package/gen/services/SettingsService.js +11 -0
- package/package/gen/services/UserService.d.ts +14 -0
- package/package/gen/services/UserService.js +11 -0
- package/package/gen/services/VariableService.d.ts +12 -0
- package/package/gen/services/VariableService.js +16 -0
- package/package/hub.d.ts +1 -1
- package/package/infer.js +8 -13
- package/package/navigation.d.ts +1 -1
- package/package/navigation.js +6 -1
- package/package/script_helpers.d.ts +1 -1
- package/package/script_helpers.js +6 -1
- package/package/stores.d.ts +2 -0
- package/package/stores.js +4 -2
- package/package/utils.d.ts +1 -0
- package/package/utils.js +14 -0
- package/package.json +23 -19
|
@@ -26,6 +26,9 @@ $: resultByIdFiltered =
|
|
|
26
26
|
search === EMPTY_STRING
|
|
27
27
|
? pickableProperties.priorIds
|
|
28
28
|
: keepByKey(pickableProperties.priorIds, search);
|
|
29
|
+
$: suggestedPropsFiltered = $propPickerConfig
|
|
30
|
+
? keepByKey(pickableProperties.priorIds, $propPickerConfig.propName)
|
|
31
|
+
: undefined;
|
|
29
32
|
async function loadVariables() {
|
|
30
33
|
variables = Object.fromEntries((await VariableService.listVariable({
|
|
31
34
|
workspace: $workspaceStore ?? ''
|
|
@@ -131,6 +134,21 @@ async function loadResources() {
|
|
|
131
134
|
</div>
|
|
132
135
|
{/if}
|
|
133
136
|
{#if Object.keys(pickableProperties.priorIds).length > 0}
|
|
137
|
+
{#if suggestedPropsFiltered && Object.keys(suggestedPropsFiltered).length > 0}
|
|
138
|
+
<span class="font-bold text-sm">Suggested Results</span>
|
|
139
|
+
<div class="overflow-y-auto mb-2">
|
|
140
|
+
<ObjectViewer
|
|
141
|
+
allowCopy={false}
|
|
142
|
+
topLevelNode
|
|
143
|
+
pureViewer={!$propPickerConfig}
|
|
144
|
+
collapsed={false}
|
|
145
|
+
json={suggestedPropsFiltered}
|
|
146
|
+
on:select={(e) => {
|
|
147
|
+
dispatch('select', `results.${e.detail}`)
|
|
148
|
+
}}
|
|
149
|
+
/>
|
|
150
|
+
</div>
|
|
151
|
+
{/if}
|
|
134
152
|
<span class="font-bold text-sm">All Results</span>
|
|
135
153
|
<div class="overflow-y-auto mb-2">
|
|
136
154
|
<ObjectViewer
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<script>import { enterpriseLicense, userStore, workspaceStore, awarenessStore } from '../../stores';
|
|
2
|
+
import { classNames } from '../../utils';
|
|
3
|
+
import { Users } from 'lucide-svelte';
|
|
4
|
+
import { BROWSER } from 'esm-env';
|
|
5
|
+
import Menu from '../common/menu/Menu.svelte';
|
|
6
|
+
import { WebsocketProvider } from 'y-websocket';
|
|
7
|
+
import * as Y from 'yjs';
|
|
8
|
+
import { page } from '$app/stores';
|
|
9
|
+
export let isCollapsed = false;
|
|
10
|
+
const wsProtocol = BROWSER && window.location.protocol == 'https:' ? 'wss' : 'ws';
|
|
11
|
+
let awareness = undefined;
|
|
12
|
+
let wsProvider = undefined;
|
|
13
|
+
let connected = false;
|
|
14
|
+
function connectWorkspace(workspace) {
|
|
15
|
+
const ydoc = new Y.Doc();
|
|
16
|
+
wsProvider = new WebsocketProvider(`${wsProtocol}://${window.location.host}/ws_mp/`, workspace, ydoc);
|
|
17
|
+
wsProvider.on('sync', (isSynced) => {
|
|
18
|
+
connected = true;
|
|
19
|
+
});
|
|
20
|
+
awareness = wsProvider.awareness;
|
|
21
|
+
awareness?.setLocalState({
|
|
22
|
+
name: $userStore?.username,
|
|
23
|
+
url: $page.url.pathname
|
|
24
|
+
});
|
|
25
|
+
function setPeers() {
|
|
26
|
+
if (!awareness)
|
|
27
|
+
return;
|
|
28
|
+
$awarenessStore = Object.fromEntries(Array.from(awareness.getStates().values()).map((x) => [x.name, x.url]));
|
|
29
|
+
}
|
|
30
|
+
setPeers();
|
|
31
|
+
// You can observe when a user updates their awareness information
|
|
32
|
+
awareness.on('change', (changes) => {
|
|
33
|
+
setPeers();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
$: awareness?.setLocalState({
|
|
37
|
+
name: $userStore?.username,
|
|
38
|
+
url: $page.url.pathname
|
|
39
|
+
});
|
|
40
|
+
$: $enterpriseLicense && $workspaceStore && connectWorkspace($workspaceStore);
|
|
41
|
+
function showActivity(url) {
|
|
42
|
+
if (url.startsWith('/scripts/add')) {
|
|
43
|
+
return 'Creating a script';
|
|
44
|
+
}
|
|
45
|
+
else if (url.startsWith('/scripts/edit')) {
|
|
46
|
+
return 'Editing a script';
|
|
47
|
+
}
|
|
48
|
+
else if (url.startsWith('/scripts/get')) {
|
|
49
|
+
return 'Viewing a script';
|
|
50
|
+
}
|
|
51
|
+
else if (url.startsWith('/flows/add')) {
|
|
52
|
+
return 'Creating a flow';
|
|
53
|
+
}
|
|
54
|
+
else if (url.startsWith('/flows/edit')) {
|
|
55
|
+
return 'Editing a flow';
|
|
56
|
+
}
|
|
57
|
+
else if (url.startsWith('/flows/get')) {
|
|
58
|
+
return 'Viewing a flow';
|
|
59
|
+
}
|
|
60
|
+
else if (url.startsWith('/apps/add')) {
|
|
61
|
+
return 'Creating an app';
|
|
62
|
+
}
|
|
63
|
+
else if (url.startsWith('/apps/edit')) {
|
|
64
|
+
return 'Editing an app';
|
|
65
|
+
}
|
|
66
|
+
else if (url.startsWith('/runs')) {
|
|
67
|
+
return 'Exploring runs';
|
|
68
|
+
}
|
|
69
|
+
else if (url.startsWith('/variables')) {
|
|
70
|
+
return 'Exploring variables';
|
|
71
|
+
}
|
|
72
|
+
else if (url.startsWith('/resources')) {
|
|
73
|
+
return 'Exploring runs';
|
|
74
|
+
}
|
|
75
|
+
else if (url == '/') {
|
|
76
|
+
return 'On the home page';
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return '';
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
{#if connected}
|
|
85
|
+
<Menu placement="bottom-start">
|
|
86
|
+
<button
|
|
87
|
+
slot="trigger"
|
|
88
|
+
type="button"
|
|
89
|
+
class={classNames(
|
|
90
|
+
'group w-full flex items-center text-white hover:bg-gray-50 hover:text-gray-900 focus:ring-4 focus:outline-none focus:ring-gray-300 px-2 py-2 text-sm font-medium rounded-md h-8 '
|
|
91
|
+
)}
|
|
92
|
+
>
|
|
93
|
+
<div class="center-center mr-2">
|
|
94
|
+
<Users size={16} />
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
{#if !isCollapsed}
|
|
98
|
+
<span class={classNames('whitespace-pre truncate')}>Live</span>
|
|
99
|
+
{/if}
|
|
100
|
+
</button>
|
|
101
|
+
|
|
102
|
+
<div class="divide-y divide-gray-100" role="none">
|
|
103
|
+
<div class="py-1 flex flex-col gap-y-1">
|
|
104
|
+
{#each Object.entries($awarenessStore ?? {}) as [user, url]}
|
|
105
|
+
<div class="inline-flex gap-2 px-2 items-center">
|
|
106
|
+
<span
|
|
107
|
+
class="inline-flex h-6 w-6 px-1 items-center justify-center rounded-full ring-2 ring-white bg-gray-600"
|
|
108
|
+
title={user}
|
|
109
|
+
>
|
|
110
|
+
<span class="text-sm font-medium leading-none text-white"
|
|
111
|
+
>{user.substring(0, 2).toLocaleUpperCase()}</span
|
|
112
|
+
>
|
|
113
|
+
</span>
|
|
114
|
+
<div class="flex flex-col">
|
|
115
|
+
<span class="text-sm text-gray-900 truncate">{user}</span>
|
|
116
|
+
<span class="text-xs text-gray-500 truncate">{showActivity(url)}</span>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
{/each}
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</Menu>
|
|
123
|
+
{/if}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
isCollapsed?: boolean | undefined;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type MultiplayerMenuProps = typeof __propDef.props;
|
|
12
|
+
export type MultiplayerMenuEvents = typeof __propDef.events;
|
|
13
|
+
export type MultiplayerMenuSlots = typeof __propDef.slots;
|
|
14
|
+
export default class MultiplayerMenu extends SvelteComponentTyped<MultiplayerMenuProps, MultiplayerMenuEvents, MultiplayerMenuSlots> {
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -28,7 +28,7 @@ export let isCollapsed = false;
|
|
|
28
28
|
<div class="py-1">
|
|
29
29
|
{#each $userWorkspaces as workspace}
|
|
30
30
|
<button
|
|
31
|
-
class="text-xs min-w-0 w-full flex flex-col py-1.5
|
|
31
|
+
class="text-xs min-w-0 w-full overflow-hidden flex flex-col py-1.5
|
|
32
32
|
{$workspaceStore === workspace.id
|
|
33
33
|
? 'cursor-default bg-blue-50'
|
|
34
34
|
: 'cursor-pointer hover:bg-gray-100'}"
|
|
@@ -9,15 +9,9 @@ export interface OnCancel {
|
|
|
9
9
|
(cancelHandler: () => void): void;
|
|
10
10
|
}
|
|
11
11
|
export declare class CancelablePromise<T> implements Promise<T> {
|
|
12
|
-
|
|
13
|
-
private _isResolved;
|
|
14
|
-
private _isRejected;
|
|
15
|
-
private _isCancelled;
|
|
16
|
-
private readonly _cancelHandlers;
|
|
17
|
-
private readonly _promise;
|
|
18
|
-
private _resolve?;
|
|
19
|
-
private _reject?;
|
|
12
|
+
#private;
|
|
20
13
|
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
|
|
14
|
+
get [Symbol.toStringTag](): string;
|
|
21
15
|
then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
22
16
|
catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
23
17
|
finally(onFinally?: (() => void) | null): Promise<T>;
|
|
@@ -11,71 +11,73 @@ export class CancelError extends Error {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
export class CancelablePromise {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
_reject;
|
|
14
|
+
#isResolved;
|
|
15
|
+
#isRejected;
|
|
16
|
+
#isCancelled;
|
|
17
|
+
#cancelHandlers;
|
|
18
|
+
#promise;
|
|
19
|
+
#resolve;
|
|
20
|
+
#reject;
|
|
22
21
|
constructor(executor) {
|
|
23
|
-
this
|
|
24
|
-
this
|
|
25
|
-
this
|
|
26
|
-
this
|
|
27
|
-
this
|
|
28
|
-
this
|
|
29
|
-
this
|
|
22
|
+
this.#isResolved = false;
|
|
23
|
+
this.#isRejected = false;
|
|
24
|
+
this.#isCancelled = false;
|
|
25
|
+
this.#cancelHandlers = [];
|
|
26
|
+
this.#promise = new Promise((resolve, reject) => {
|
|
27
|
+
this.#resolve = resolve;
|
|
28
|
+
this.#reject = reject;
|
|
30
29
|
const onResolve = (value) => {
|
|
31
|
-
if (this
|
|
30
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
32
31
|
return;
|
|
33
32
|
}
|
|
34
|
-
this
|
|
35
|
-
this
|
|
33
|
+
this.#isResolved = true;
|
|
34
|
+
this.#resolve?.(value);
|
|
36
35
|
};
|
|
37
36
|
const onReject = (reason) => {
|
|
38
|
-
if (this
|
|
37
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
39
38
|
return;
|
|
40
39
|
}
|
|
41
|
-
this
|
|
42
|
-
this
|
|
40
|
+
this.#isRejected = true;
|
|
41
|
+
this.#reject?.(reason);
|
|
43
42
|
};
|
|
44
43
|
const onCancel = (cancelHandler) => {
|
|
45
|
-
if (this
|
|
44
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
46
45
|
return;
|
|
47
46
|
}
|
|
48
|
-
this.
|
|
47
|
+
this.#cancelHandlers.push(cancelHandler);
|
|
49
48
|
};
|
|
50
49
|
Object.defineProperty(onCancel, 'isResolved', {
|
|
51
|
-
get: () => this
|
|
50
|
+
get: () => this.#isResolved,
|
|
52
51
|
});
|
|
53
52
|
Object.defineProperty(onCancel, 'isRejected', {
|
|
54
|
-
get: () => this
|
|
53
|
+
get: () => this.#isRejected,
|
|
55
54
|
});
|
|
56
55
|
Object.defineProperty(onCancel, 'isCancelled', {
|
|
57
|
-
get: () => this
|
|
56
|
+
get: () => this.#isCancelled,
|
|
58
57
|
});
|
|
59
58
|
return executor(onResolve, onReject, onCancel);
|
|
60
59
|
});
|
|
61
60
|
}
|
|
61
|
+
get [Symbol.toStringTag]() {
|
|
62
|
+
return "Cancellable Promise";
|
|
63
|
+
}
|
|
62
64
|
then(onFulfilled, onRejected) {
|
|
63
|
-
return this.
|
|
65
|
+
return this.#promise.then(onFulfilled, onRejected);
|
|
64
66
|
}
|
|
65
67
|
catch(onRejected) {
|
|
66
|
-
return this.
|
|
68
|
+
return this.#promise.catch(onRejected);
|
|
67
69
|
}
|
|
68
70
|
finally(onFinally) {
|
|
69
|
-
return this.
|
|
71
|
+
return this.#promise.finally(onFinally);
|
|
70
72
|
}
|
|
71
73
|
cancel() {
|
|
72
|
-
if (this
|
|
74
|
+
if (this.#isResolved || this.#isRejected || this.#isCancelled) {
|
|
73
75
|
return;
|
|
74
76
|
}
|
|
75
|
-
this
|
|
76
|
-
if (this.
|
|
77
|
+
this.#isCancelled = true;
|
|
78
|
+
if (this.#cancelHandlers.length) {
|
|
77
79
|
try {
|
|
78
|
-
for (const cancelHandler of this
|
|
80
|
+
for (const cancelHandler of this.#cancelHandlers) {
|
|
79
81
|
cancelHandler();
|
|
80
82
|
}
|
|
81
83
|
}
|
|
@@ -84,10 +86,10 @@ export class CancelablePromise {
|
|
|
84
86
|
return;
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
|
-
this.
|
|
88
|
-
this
|
|
89
|
+
this.#cancelHandlers.length = 0;
|
|
90
|
+
this.#reject?.(new CancelError('Request aborted'));
|
|
89
91
|
}
|
|
90
92
|
get isCancelled() {
|
|
91
|
-
return this
|
|
93
|
+
return this.#isCancelled;
|
|
92
94
|
}
|
|
93
95
|
}
|
|
@@ -150,7 +150,7 @@ const getHeaders = async (config, options) => {
|
|
|
150
150
|
return new Headers(headers);
|
|
151
151
|
};
|
|
152
152
|
const getRequestBody = (options) => {
|
|
153
|
-
if (options.body) {
|
|
153
|
+
if (options.body !== undefined) {
|
|
154
154
|
if (options.mediaType?.includes('/json')) {
|
|
155
155
|
return JSON.stringify(options.body);
|
|
156
156
|
}
|
|
@@ -192,7 +192,8 @@ const getResponseBody = async (response) => {
|
|
|
192
192
|
try {
|
|
193
193
|
const contentType = response.headers.get('Content-Type');
|
|
194
194
|
if (contentType) {
|
|
195
|
-
const
|
|
195
|
+
const jsonTypes = ['application/json', 'application/problem+json'];
|
|
196
|
+
const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type));
|
|
196
197
|
if (isJSON) {
|
|
197
198
|
return await response.json();
|
|
198
199
|
}
|
|
@@ -4,13 +4,14 @@ export type NewScript = {
|
|
|
4
4
|
summary: string;
|
|
5
5
|
description: string;
|
|
6
6
|
content: string;
|
|
7
|
-
schema?: any
|
|
7
|
+
schema?: Record<string, any>;
|
|
8
8
|
is_template?: boolean;
|
|
9
9
|
lock?: Array<string>;
|
|
10
10
|
language: NewScript.language;
|
|
11
11
|
kind?: NewScript.kind;
|
|
12
12
|
tag?: string;
|
|
13
13
|
draft_only?: boolean;
|
|
14
|
+
envs?: Array<string>;
|
|
14
15
|
};
|
|
15
16
|
export declare namespace NewScript {
|
|
16
17
|
enum language {
|
|
@@ -13,7 +13,7 @@ export type Script = {
|
|
|
13
13
|
created_by: string;
|
|
14
14
|
created_at: string;
|
|
15
15
|
archived: boolean;
|
|
16
|
-
schema?: any
|
|
16
|
+
schema?: Record<string, any>;
|
|
17
17
|
deleted: boolean;
|
|
18
18
|
is_template: boolean;
|
|
19
19
|
extra_perms: Record<string, boolean>;
|
|
@@ -25,6 +25,7 @@ export type Script = {
|
|
|
25
25
|
tag?: string;
|
|
26
26
|
has_draft?: boolean;
|
|
27
27
|
draft_only?: boolean;
|
|
28
|
+
envs?: Array<string>;
|
|
28
29
|
};
|
|
29
30
|
export declare namespace Script {
|
|
30
31
|
enum language {
|
|
@@ -39,6 +39,38 @@ export declare class JobService {
|
|
|
39
39
|
*/
|
|
40
40
|
invisibleToOwner?: boolean;
|
|
41
41
|
}): CancelablePromise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* run script by path in openai format
|
|
44
|
+
* @returns any job result
|
|
45
|
+
* @throws ApiError
|
|
46
|
+
*/
|
|
47
|
+
static openaiSyncScriptByPath({ workspace, path, requestBody, parentJob, jobId, includeHeader, queueLimit, }: {
|
|
48
|
+
workspace: string;
|
|
49
|
+
path: string;
|
|
50
|
+
/**
|
|
51
|
+
* script args
|
|
52
|
+
*/
|
|
53
|
+
requestBody: ScriptArgs;
|
|
54
|
+
/**
|
|
55
|
+
* The parent job that is at the origin and responsible for the execution of this script if any
|
|
56
|
+
*/
|
|
57
|
+
parentJob?: string;
|
|
58
|
+
/**
|
|
59
|
+
* The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request)
|
|
60
|
+
*/
|
|
61
|
+
jobId?: string;
|
|
62
|
+
/**
|
|
63
|
+
* List of headers's keys (separated with ',') whove value are added to the args
|
|
64
|
+
* Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
67
|
+
includeHeader?: string;
|
|
68
|
+
/**
|
|
69
|
+
* The maximum size of the queue for which the request would get rejected if that job would push it above that limit
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
queueLimit?: string;
|
|
73
|
+
}): CancelablePromise<any>;
|
|
42
74
|
/**
|
|
43
75
|
* run script by path
|
|
44
76
|
* @returns any job result
|
|
@@ -105,6 +137,34 @@ export declare class JobService {
|
|
|
105
137
|
*/
|
|
106
138
|
payload?: string;
|
|
107
139
|
}): CancelablePromise<any>;
|
|
140
|
+
/**
|
|
141
|
+
* run flow by path and wait until completion in openai format
|
|
142
|
+
* @returns any job result
|
|
143
|
+
* @throws ApiError
|
|
144
|
+
*/
|
|
145
|
+
static openaiSyncFlowByPath({ workspace, path, requestBody, includeHeader, queueLimit, jobId, }: {
|
|
146
|
+
workspace: string;
|
|
147
|
+
path: string;
|
|
148
|
+
/**
|
|
149
|
+
* script args
|
|
150
|
+
*/
|
|
151
|
+
requestBody: ScriptArgs;
|
|
152
|
+
/**
|
|
153
|
+
* List of headers's keys (separated with ',') whove value are added to the args
|
|
154
|
+
* Header's key lowercased and '-'' replaced to '_' such that 'Content-Type' becomes the 'content_type' arg key
|
|
155
|
+
*
|
|
156
|
+
*/
|
|
157
|
+
includeHeader?: string;
|
|
158
|
+
/**
|
|
159
|
+
* The maximum size of the queue for which the request would get rejected if that job would push it above that limit
|
|
160
|
+
*
|
|
161
|
+
*/
|
|
162
|
+
queueLimit?: string;
|
|
163
|
+
/**
|
|
164
|
+
* The job id to assign to the created job. if missing, job is chosen randomly using the ULID scheme. If a job id already exists in the queue or as a completed job, the request to create one will fail (Bad Request)
|
|
165
|
+
*/
|
|
166
|
+
jobId?: string;
|
|
167
|
+
}): CancelablePromise<any>;
|
|
108
168
|
/**
|
|
109
169
|
* run flow by path and wait until completion
|
|
110
170
|
* @returns any job result
|
|
@@ -193,7 +253,7 @@ export declare class JobService {
|
|
|
193
253
|
/**
|
|
194
254
|
* Partially filled args
|
|
195
255
|
*/
|
|
196
|
-
requestBody: any
|
|
256
|
+
requestBody: Record<string, any>;
|
|
197
257
|
/**
|
|
198
258
|
* when to schedule this job (leave empty for immediate run)
|
|
199
259
|
*/
|
|
@@ -621,7 +681,7 @@ export declare class JobService {
|
|
|
621
681
|
id: string;
|
|
622
682
|
resumeId: number;
|
|
623
683
|
signature: string;
|
|
624
|
-
requestBody: any
|
|
684
|
+
requestBody: Record<string, any>;
|
|
625
685
|
approver?: string;
|
|
626
686
|
}): CancelablePromise<string>;
|
|
627
687
|
/**
|
|
@@ -632,7 +692,7 @@ export declare class JobService {
|
|
|
632
692
|
static resumeSuspendedFlowAsOwner({ workspace, id, requestBody, }: {
|
|
633
693
|
workspace: string;
|
|
634
694
|
id: string;
|
|
635
|
-
requestBody: any
|
|
695
|
+
requestBody: Record<string, any>;
|
|
636
696
|
}): CancelablePromise<string>;
|
|
637
697
|
/**
|
|
638
698
|
* cancel a job for a suspended flow
|
|
@@ -656,7 +716,7 @@ export declare class JobService {
|
|
|
656
716
|
id: string;
|
|
657
717
|
resumeId: number;
|
|
658
718
|
signature: string;
|
|
659
|
-
requestBody: any
|
|
719
|
+
requestBody: Record<string, any>;
|
|
660
720
|
approver?: string;
|
|
661
721
|
}): CancelablePromise<string>;
|
|
662
722
|
/**
|
|
@@ -25,6 +25,29 @@ export class JobService {
|
|
|
25
25
|
mediaType: 'application/json',
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* run script by path in openai format
|
|
30
|
+
* @returns any job result
|
|
31
|
+
* @throws ApiError
|
|
32
|
+
*/
|
|
33
|
+
static openaiSyncScriptByPath({ workspace, path, requestBody, parentJob, jobId, includeHeader, queueLimit, }) {
|
|
34
|
+
return __request(OpenAPI, {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
url: '/w/{workspace}/jobs/openai_sync/p/{path}',
|
|
37
|
+
path: {
|
|
38
|
+
'workspace': workspace,
|
|
39
|
+
'path': path,
|
|
40
|
+
},
|
|
41
|
+
query: {
|
|
42
|
+
'parent_job': parentJob,
|
|
43
|
+
'job_id': jobId,
|
|
44
|
+
'include_header': includeHeader,
|
|
45
|
+
'queue_limit': queueLimit,
|
|
46
|
+
},
|
|
47
|
+
body: requestBody,
|
|
48
|
+
mediaType: 'application/json',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
28
51
|
/**
|
|
29
52
|
* run script by path
|
|
30
53
|
* @returns any job result
|
|
@@ -70,6 +93,28 @@ export class JobService {
|
|
|
70
93
|
},
|
|
71
94
|
});
|
|
72
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* run flow by path and wait until completion in openai format
|
|
98
|
+
* @returns any job result
|
|
99
|
+
* @throws ApiError
|
|
100
|
+
*/
|
|
101
|
+
static openaiSyncFlowByPath({ workspace, path, requestBody, includeHeader, queueLimit, jobId, }) {
|
|
102
|
+
return __request(OpenAPI, {
|
|
103
|
+
method: 'POST',
|
|
104
|
+
url: '/w/{workspace}/jobs/openai_sync/f/{path}',
|
|
105
|
+
path: {
|
|
106
|
+
'workspace': workspace,
|
|
107
|
+
'path': path,
|
|
108
|
+
},
|
|
109
|
+
query: {
|
|
110
|
+
'include_header': includeHeader,
|
|
111
|
+
'queue_limit': queueLimit,
|
|
112
|
+
'job_id': jobId,
|
|
113
|
+
},
|
|
114
|
+
body: requestBody,
|
|
115
|
+
mediaType: 'application/json',
|
|
116
|
+
});
|
|
117
|
+
}
|
|
73
118
|
/**
|
|
74
119
|
* run flow by path and wait until completion
|
|
75
120
|
* @returns any job result
|
|
@@ -11,12 +11,13 @@ export declare class ResourceService {
|
|
|
11
11
|
* @returns string resource created
|
|
12
12
|
* @throws ApiError
|
|
13
13
|
*/
|
|
14
|
-
static createResource({ workspace, requestBody, }: {
|
|
14
|
+
static createResource({ workspace, requestBody, updateIfExists, }: {
|
|
15
15
|
workspace: string;
|
|
16
16
|
/**
|
|
17
17
|
* new resource
|
|
18
18
|
*/
|
|
19
19
|
requestBody: CreateResource;
|
|
20
|
+
updateIfExists?: boolean;
|
|
20
21
|
}): CancelablePromise<string>;
|
|
21
22
|
/**
|
|
22
23
|
* delete resource
|