@flowdrop/flowdrop 2.0.0-beta.1 → 2.0.0-beta.3
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/CHANGELOG.md +67 -0
- package/MIGRATION-2.0.md +173 -3
- package/dist/api/enhanced-client.js +6 -11
- package/dist/components/App.svelte +22 -45
- package/dist/components/App.svelte.d.ts +2 -7
- package/dist/components/CanvasIconButton.svelte +76 -0
- package/dist/components/CanvasIconButton.svelte.d.ts +18 -0
- package/dist/components/ConfigForm.svelte +6 -21
- package/dist/components/ConfigPanel.svelte +4 -3
- package/dist/components/LogoWordmark.svelte +113 -0
- package/dist/components/LogoWordmark.svelte.d.ts +26 -0
- package/dist/components/Navbar.svelte +8 -59
- package/dist/components/NodeSidebar.svelte +4 -11
- package/dist/components/NodeSwapPicker.svelte +0 -2
- package/dist/components/PipelineStatus.svelte +6 -1
- package/dist/components/PipelineStatus.svelte.d.ts +3 -0
- package/dist/components/PortMappingRow.svelte +0 -2
- package/dist/components/SchemaForm.svelte +4 -14
- package/dist/components/SettingsModal.svelte +0 -5
- package/dist/components/SettingsPanel.svelte +2 -6
- package/dist/components/ThemeToggle.svelte +0 -5
- package/dist/components/UniversalNode.svelte +32 -1
- package/dist/components/WorkflowEditor.svelte +66 -52
- package/dist/components/WorkflowEditor.svelte.d.ts +21 -0
- package/dist/components/chat/AIChatPanel.svelte +7 -2
- package/dist/components/console/ConsoleAutocomplete.svelte +1 -1
- package/dist/components/console/ConsoleOutput.svelte +2 -2
- package/dist/components/form/FormArray.svelte +0 -16
- package/dist/components/form/FormAutocomplete.svelte +18 -15
- package/dist/components/form/FormCheckboxGroup.svelte +0 -4
- package/dist/components/form/FormCodeEditor.svelte +9 -7
- package/dist/components/form/FormFieldLight.svelte +33 -4
- package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
- package/dist/components/form/FormMarkdownEditor.svelte +8 -5
- package/dist/components/form/FormNumberField.svelte +0 -4
- package/dist/components/form/FormRangeField.svelte +1 -20
- package/dist/components/form/FormSelect.svelte +10 -6
- package/dist/components/form/FormTemplateEditor.svelte +6 -4
- package/dist/components/form/FormTextField.svelte +10 -6
- package/dist/components/form/FormTextarea.svelte +10 -6
- package/dist/components/form/FormToggle.svelte +0 -4
- package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
- package/dist/components/icons/CommandLineIcon.svelte +15 -0
- package/dist/components/icons/CommandLineIcon.svelte.d.ts +26 -0
- package/dist/components/icons/MenuIcon.svelte +4 -0
- package/dist/components/icons/MenuIcon.svelte.d.ts +26 -0
- package/dist/components/icons/MenuOpenIcon.svelte +6 -0
- package/dist/components/icons/MenuOpenIcon.svelte.d.ts +26 -0
- package/dist/components/interrupt/ChoicePrompt.svelte +0 -10
- package/dist/components/interrupt/ConfirmationPrompt.svelte +0 -5
- package/dist/components/interrupt/InterruptBubble.svelte +11 -12
- package/dist/components/interrupt/ReviewPrompt.svelte +0 -20
- package/dist/components/interrupt/TextInputPrompt.svelte +0 -6
- package/dist/components/layouts/MainLayout.svelte +4 -5
- package/dist/components/nodes/AtomNode.svelte +46 -34
- package/dist/components/nodes/GatewayNode.svelte +91 -99
- package/dist/components/nodes/IdeaNode.svelte +62 -90
- package/dist/components/nodes/NodeConfigButton.svelte +86 -0
- package/dist/components/nodes/NodeConfigButton.svelte.d.ts +15 -0
- package/dist/components/nodes/NotesNode.svelte +70 -81
- package/dist/components/nodes/SimpleNode.svelte +28 -78
- package/dist/components/nodes/SquareNode.svelte +79 -109
- package/dist/components/nodes/TerminalNode.svelte +28 -86
- package/dist/components/nodes/ToolNode.svelte +82 -95
- package/dist/components/nodes/WorkflowNode.svelte +91 -100
- package/dist/components/playground/ChatInput.svelte +0 -1
- package/dist/components/playground/InputCollector.svelte +0 -2
- package/dist/components/playground/PipelineKanbanView.svelte +4 -2
- package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
- package/dist/components/playground/PipelinePanel.svelte +20 -3
- package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
- package/dist/components/playground/PipelineTableView.svelte +4 -2
- package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
- package/dist/components/playground/Playground.svelte +76 -25
- package/dist/components/playground/Playground.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundApp.svelte +6 -1
- package/dist/components/playground/PlaygroundApp.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundModal.svelte +5 -0
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundStudio.svelte +7 -6
- package/dist/components/playground/PlaygroundStudio.svelte.d.ts +3 -0
- package/dist/components/playground/pipelineViewUtils.svelte.d.ts +2 -1
- package/dist/components/playground/pipelineViewUtils.svelte.js +2 -2
- package/dist/config/endpoints.d.ts +23 -0
- package/dist/config/endpoints.js +28 -0
- package/dist/core/index.d.ts +1 -2
- package/dist/core/index.js +2 -6
- package/dist/display/index.d.ts +6 -1
- package/dist/display/index.js +9 -1
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/index.js +1 -1
- package/dist/form/full.d.ts +2 -1
- package/dist/form/full.js +4 -1
- package/dist/form/index.d.ts +0 -1
- package/dist/form/index.js +3 -2
- package/dist/helpers/workflowEditorHelper.d.ts +4 -2
- package/dist/helpers/workflowEditorHelper.js +4 -3
- package/dist/playground/index.d.ts +2 -2
- package/dist/playground/index.js +2 -2
- package/dist/playground/mount.d.ts +19 -5
- package/dist/playground/mount.js +16 -8
- package/dist/registry/builtinNodeTypes.d.ts +53 -0
- package/dist/registry/builtinNodeTypes.js +67 -0
- package/dist/registry/builtinNodes.d.ts +2 -39
- package/dist/registry/builtinNodes.js +6 -53
- package/dist/services/agentSpecExecutionService.d.ts +0 -2
- package/dist/services/agentSpecExecutionService.js +0 -2
- package/dist/services/apiVariableService.js +12 -26
- package/dist/services/categoriesApi.js +3 -6
- package/dist/services/chatService.d.ts +4 -3
- package/dist/services/chatService.js +13 -18
- package/dist/services/interruptService.d.ts +7 -6
- package/dist/services/interruptService.js +19 -21
- package/dist/services/playgroundService.d.ts +9 -8
- package/dist/services/playgroundService.js +23 -25
- package/dist/services/portConfigApi.js +3 -6
- package/dist/services/settingsService.d.ts +9 -4
- package/dist/services/settingsService.js +23 -12
- package/dist/skins/drafter.d.ts +30 -0
- package/dist/skins/drafter.js +185 -0
- package/dist/skins/index.d.ts +2 -1
- package/dist/skins/index.js +4 -2
- package/dist/stores/apiContext.d.ts +11 -0
- package/dist/stores/apiContext.js +15 -0
- package/dist/stores/categoriesStore.svelte.js +0 -1
- package/dist/stores/playgroundStore.svelte.js +0 -2
- package/dist/styles/base.css +38 -9
- package/dist/styles/tokens.css +54 -2
- package/dist/svelte-app.d.ts +6 -0
- package/dist/svelte-app.js +4 -2
- package/dist/themes/drafter.d.ts +2 -0
- package/dist/themes/drafter.js +15 -0
- package/dist/themes/index.d.ts +2 -1
- package/dist/themes/index.js +8 -2
- package/dist/types/auth.d.ts +9 -51
- package/dist/types/auth.js +4 -54
- package/dist/types/events.d.ts +18 -0
- package/dist/types/events.js +2 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/index.js +0 -1
- package/dist/types/settings.d.ts +1 -1
- package/dist/types/settings.js +1 -1
- package/dist/types/skin.d.ts +1 -1
- package/dist/types/theme.d.ts +16 -2
- package/dist/utils/edgeStyling.js +9 -5
- package/dist/utils/fetchWithAuth.d.ts +36 -15
- package/dist/utils/fetchWithAuth.js +53 -23
- package/dist/utils/nodeTypes.js +1 -1
- package/package.json +2 -1
|
@@ -1,25 +1,46 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Authenticated fetch
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The single fetch path for FlowDrop's per-instance services. It builds request
|
|
5
|
+
* headers (static endpoint headers + the {@link AuthProvider}'s headers + any
|
|
6
|
+
* caller headers) and uniformly applies the auth lifecycle: on `401` it invokes
|
|
7
|
+
* `onUnauthorized()` and — if that reports a successful refresh — retries the
|
|
8
|
+
* request once with freshly fetched headers; on `403` it invokes
|
|
9
|
+
* `onForbidden()`. Callers receive the raw {@link Response} and keep their own
|
|
10
|
+
* status/parse handling.
|
|
11
|
+
*
|
|
12
|
+
* Routing every service through this helper means a configured `AuthProvider`
|
|
13
|
+
* authenticates *and* refreshes consistently — matching the behaviour the typed
|
|
14
|
+
* workflow/node API gets from {@link EnhancedFlowDropApiClient}.
|
|
6
15
|
*
|
|
7
16
|
* @module utils/fetchWithAuth
|
|
8
17
|
*/
|
|
18
|
+
import type { EndpointConfig } from '../config/endpoints.js';
|
|
9
19
|
import type { AuthProvider } from '../types/auth.js';
|
|
10
20
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* Constructs standard JSON request headers and merges in authentication
|
|
14
|
-
* headers from the provided AuthProvider, if available.
|
|
21
|
+
* Options describing how to authenticate and where the base headers come from.
|
|
15
22
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
23
|
+
* Provide `config` + `endpointKey` to source static endpoint headers (the usual
|
|
24
|
+
* case for endpoint-keyed services), or `baseHeaders` for ad-hoc requests that
|
|
25
|
+
* are not tied to a configured endpoint (e.g. a user-configured autocomplete
|
|
26
|
+
* URL). When neither is given the request carries only JSON defaults plus auth.
|
|
27
|
+
*/
|
|
28
|
+
export interface AuthenticatedFetchOptions {
|
|
29
|
+
/** Auth provider supplying `Authorization` etc. and 401/403 lifecycle hooks. */
|
|
30
|
+
authProvider?: AuthProvider;
|
|
31
|
+
/** Endpoint configuration, used with `endpointKey` to look up static headers. */
|
|
32
|
+
config?: EndpointConfig;
|
|
33
|
+
/** Endpoint key identifying which static headers to apply. */
|
|
34
|
+
endpointKey?: string;
|
|
35
|
+
/** Base headers for requests not tied to a configured endpoint. */
|
|
36
|
+
baseHeaders?: Record<string, string>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Perform an authenticated fetch with consistent 401/403 handling.
|
|
18
40
|
*
|
|
19
|
-
* @
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* ```
|
|
41
|
+
* @param url - The fully-resolved request URL
|
|
42
|
+
* @param init - Standard fetch options (method, body, signal, headers, …)
|
|
43
|
+
* @param opts - Auth provider and header source
|
|
44
|
+
* @returns The raw {@link Response}; callers handle `.ok`/parsing themselves
|
|
24
45
|
*/
|
|
25
|
-
export declare function
|
|
46
|
+
export declare function authenticatedFetch(url: string, init?: RequestInit, opts?: AuthenticatedFetchOptions): Promise<Response>;
|
|
@@ -1,34 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Authenticated fetch
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The single fetch path for FlowDrop's per-instance services. It builds request
|
|
5
|
+
* headers (static endpoint headers + the {@link AuthProvider}'s headers + any
|
|
6
|
+
* caller headers) and uniformly applies the auth lifecycle: on `401` it invokes
|
|
7
|
+
* `onUnauthorized()` and — if that reports a successful refresh — retries the
|
|
8
|
+
* request once with freshly fetched headers; on `403` it invokes
|
|
9
|
+
* `onForbidden()`. Callers receive the raw {@link Response} and keep their own
|
|
10
|
+
* status/parse handling.
|
|
11
|
+
*
|
|
12
|
+
* Routing every service through this helper means a configured `AuthProvider`
|
|
13
|
+
* authenticates *and* refreshes consistently — matching the behaviour the typed
|
|
14
|
+
* workflow/node API gets from {@link EnhancedFlowDropApiClient}.
|
|
6
15
|
*
|
|
7
16
|
* @module utils/fetchWithAuth
|
|
8
17
|
*/
|
|
18
|
+
import { getEndpointHeaders } from '../config/endpoints.js';
|
|
19
|
+
const DEFAULT_HEADERS = {
|
|
20
|
+
Accept: 'application/json',
|
|
21
|
+
'Content-Type': 'application/json'
|
|
22
|
+
};
|
|
9
23
|
/**
|
|
10
|
-
* Build
|
|
11
|
-
*
|
|
12
|
-
* Constructs standard JSON request headers and merges in authentication
|
|
13
|
-
* headers from the provided AuthProvider, if available.
|
|
14
|
-
*
|
|
15
|
-
* @param authProvider - Optional auth provider to get headers from
|
|
16
|
-
* @returns Promise resolving to a complete headers object
|
|
24
|
+
* Build the merged header set: base headers < auth headers < per-request headers.
|
|
17
25
|
*
|
|
18
|
-
*
|
|
19
|
-
* ```typescript
|
|
20
|
-
* const headers = await buildFetchHeaders(authProvider);
|
|
21
|
-
* const response = await fetch(url, { headers });
|
|
22
|
-
* ```
|
|
26
|
+
* Re-invoked for the retry so a refreshed token is picked up.
|
|
23
27
|
*/
|
|
24
|
-
|
|
25
|
-
const headers =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
async function buildHeaders(init, opts) {
|
|
29
|
+
const headers = opts.config && opts.endpointKey
|
|
30
|
+
? getEndpointHeaders(opts.config, opts.endpointKey)
|
|
31
|
+
: { ...DEFAULT_HEADERS, ...opts.baseHeaders };
|
|
32
|
+
if (opts.authProvider) {
|
|
33
|
+
Object.assign(headers, await opts.authProvider.getAuthHeaders());
|
|
34
|
+
}
|
|
35
|
+
if (init.headers) {
|
|
36
|
+
Object.assign(headers, init.headers);
|
|
32
37
|
}
|
|
33
38
|
return headers;
|
|
34
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Perform an authenticated fetch with consistent 401/403 handling.
|
|
42
|
+
*
|
|
43
|
+
* @param url - The fully-resolved request URL
|
|
44
|
+
* @param init - Standard fetch options (method, body, signal, headers, …)
|
|
45
|
+
* @param opts - Auth provider and header source
|
|
46
|
+
* @returns The raw {@link Response}; callers handle `.ok`/parsing themselves
|
|
47
|
+
*/
|
|
48
|
+
export async function authenticatedFetch(url, init = {}, opts = {}) {
|
|
49
|
+
const headers = await buildHeaders(init, opts);
|
|
50
|
+
let response = await fetch(url, { ...init, headers });
|
|
51
|
+
// 401 → let the provider refresh, then retry once with fresh headers.
|
|
52
|
+
if (response.status === 401 && opts.authProvider?.onUnauthorized) {
|
|
53
|
+
const refreshed = await opts.authProvider.onUnauthorized();
|
|
54
|
+
if (refreshed) {
|
|
55
|
+
const retryHeaders = await buildHeaders(init, opts);
|
|
56
|
+
response = await fetch(url, { ...init, headers: retryHeaders });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// 403 → notify the provider (e.g. surface a permission error).
|
|
60
|
+
if (response.status === 403 && opts.authProvider?.onForbidden) {
|
|
61
|
+
await opts.authProvider.onForbidden();
|
|
62
|
+
}
|
|
63
|
+
return response;
|
|
64
|
+
}
|
package/dist/utils/nodeTypes.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Works with both built-in types and custom registered types.
|
|
11
11
|
*/
|
|
12
|
-
import { resolveBuiltinAlias, isBuiltinType } from '../registry/
|
|
12
|
+
import { resolveBuiltinAlias, isBuiltinType } from '../registry/builtinNodeTypes.js';
|
|
13
13
|
/**
|
|
14
14
|
* Display names for built-in node types.
|
|
15
15
|
*/
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A drop-in visual workflow editor for any web application. You own the backend. You own the data. You own the orchestration.",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "2.0.0-beta.
|
|
6
|
+
"version": "2.0.0-beta.3",
|
|
7
7
|
"author": "Shibin Das (D34dMan)",
|
|
8
8
|
"bugs": {
|
|
9
9
|
"url": "https://github.com/flowdrop-io/flowdrop/issues"
|
|
@@ -289,6 +289,7 @@
|
|
|
289
289
|
"watch:build": "npm-watch build",
|
|
290
290
|
"preview": "vite preview",
|
|
291
291
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
292
|
+
"check:bundle": "node scripts/check-bundle.mjs",
|
|
292
293
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
293
294
|
"lint": "eslint . && prettier --check .",
|
|
294
295
|
"test": "vitest run",
|