@flowdrop/flowdrop 2.0.0-beta.1 → 2.0.0-beta.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/CHANGELOG.md +33 -0
- package/MIGRATION-2.0.md +160 -3
- package/dist/api/enhanced-client.js +6 -11
- package/dist/components/App.svelte +1 -0
- package/dist/components/ConfigForm.svelte +6 -2
- package/dist/components/PipelineStatus.svelte +6 -1
- package/dist/components/PipelineStatus.svelte.d.ts +3 -0
- package/dist/components/SchemaForm.svelte +4 -2
- package/dist/components/WorkflowEditor.svelte +4 -1
- package/dist/components/WorkflowEditor.svelte.d.ts +3 -0
- package/dist/components/chat/AIChatPanel.svelte +6 -1
- package/dist/components/form/FormAutocomplete.svelte +8 -9
- package/dist/components/form/FormFieldLight.svelte +30 -1
- package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
- package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
- package/dist/components/interrupt/InterruptBubble.svelte +11 -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 +5 -0
- 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 -1
- 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 +10 -0
- package/dist/playground/mount.js +8 -4
- 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/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/svelte-app.js +2 -1
- package/dist/types/auth.d.ts +9 -51
- package/dist/types/auth.js +4 -54
- package/dist/types/index.d.ts +4 -2
- package/dist/types/index.js +0 -1
- 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
package/dist/display/index.d.ts
CHANGED
|
@@ -5,9 +5,13 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module display
|
|
7
7
|
*
|
|
8
|
+
* This entry renders user/API-provided HTML, so it pulls in the HTML sanitizer
|
|
9
|
+
* (DOMPurify). `sanitizeHtml` is exposed here — rather than from
|
|
10
|
+
* `@flowdrop/flowdrop/core` — to keep `core` free of that heavier dependency.
|
|
11
|
+
*
|
|
8
12
|
* @example
|
|
9
13
|
* ```typescript
|
|
10
|
-
* import { MarkdownDisplay } from "@flowdrop/flowdrop/display";
|
|
14
|
+
* import { MarkdownDisplay, sanitizeHtml } from "@flowdrop/flowdrop/display";
|
|
11
15
|
* ```
|
|
12
16
|
*
|
|
13
17
|
* @example In Svelte:
|
|
@@ -25,3 +29,4 @@
|
|
|
25
29
|
* ```
|
|
26
30
|
*/
|
|
27
31
|
export { default as MarkdownDisplay } from '../components/MarkdownDisplay.svelte';
|
|
32
|
+
export { sanitizeHtml } from '../utils/sanitize.js';
|
package/dist/display/index.js
CHANGED
|
@@ -5,9 +5,13 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module display
|
|
7
7
|
*
|
|
8
|
+
* This entry renders user/API-provided HTML, so it pulls in the HTML sanitizer
|
|
9
|
+
* (DOMPurify). `sanitizeHtml` is exposed here — rather than from
|
|
10
|
+
* `@flowdrop/flowdrop/core` — to keep `core` free of that heavier dependency.
|
|
11
|
+
*
|
|
8
12
|
* @example
|
|
9
13
|
* ```typescript
|
|
10
|
-
* import { MarkdownDisplay } from "@flowdrop/flowdrop/display";
|
|
14
|
+
* import { MarkdownDisplay, sanitizeHtml } from "@flowdrop/flowdrop/display";
|
|
11
15
|
* ```
|
|
12
16
|
*
|
|
13
17
|
* @example In Svelte:
|
|
@@ -28,3 +32,7 @@
|
|
|
28
32
|
// Display Components
|
|
29
33
|
// ============================================================================
|
|
30
34
|
export { default as MarkdownDisplay } from '../components/MarkdownDisplay.svelte';
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// HTML Sanitization (DOMPurify-backed — lives here, not in core)
|
|
37
|
+
// ============================================================================
|
|
38
|
+
export { sanitizeHtml } from '../utils/sanitize.js';
|
package/dist/editor/index.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ export { PortCoordinateStore } from '../stores/portCoordinateStore.svelte.js';
|
|
|
74
74
|
export { HistoryService } from '../services/historyService.js';
|
|
75
75
|
export type { HistoryEntry, HistoryState, PushOptions } from '../stores/historyStore.svelte.js';
|
|
76
76
|
export { showSuccess, showError, showWarning, showInfo, showLoading, dismissToast, dismissAllToasts, showPromise, showConfirmation, apiToasts, workflowToasts, pipelineToasts } from '../services/toastService.js';
|
|
77
|
-
export { NodeExecutionService
|
|
77
|
+
export { NodeExecutionService } from '../services/nodeExecutionService.js';
|
|
78
78
|
export { saveWorkflow, updateWorkflow, getWorkflow, getWorkflows, deleteWorkflow, getWorkflowCount, initializeSampleWorkflows } from '../services/workflowStorage.js';
|
|
79
79
|
export { globalSaveWorkflow, globalExportWorkflow } from '../services/globalSave.js';
|
|
80
80
|
export { fetchPortConfig, validatePortConfig } from '../services/portConfigApi.js';
|
package/dist/editor/index.js
CHANGED
|
@@ -109,7 +109,7 @@ export { HistoryService } from '../services/historyService.js';
|
|
|
109
109
|
// Services
|
|
110
110
|
// ============================================================================
|
|
111
111
|
export { showSuccess, showError, showWarning, showInfo, showLoading, dismissToast, dismissAllToasts, showPromise, showConfirmation, apiToasts, workflowToasts, pipelineToasts } from '../services/toastService.js';
|
|
112
|
-
export { NodeExecutionService
|
|
112
|
+
export { NodeExecutionService } from '../services/nodeExecutionService.js';
|
|
113
113
|
export { saveWorkflow, updateWorkflow, getWorkflow, getWorkflows, deleteWorkflow, getWorkflowCount, initializeSampleWorkflows } from '../services/workflowStorage.js';
|
|
114
114
|
export { globalSaveWorkflow, globalExportWorkflow } from '../services/globalSave.js';
|
|
115
115
|
export { fetchPortConfig, validatePortConfig } from '../services/portConfigApi.js';
|
package/dist/form/full.d.ts
CHANGED
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
* // Now all field types are available
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
export {
|
|
23
|
+
export { default as FormFieldFull } from '../components/form/FormField.svelte';
|
|
24
|
+
export { SchemaForm, FormField, FormFieldWrapper, FormTextField, FormTextarea, FormNumberField, FormRangeField, FormToggle, FormSelect, FormCheckboxGroup, FormArray, FormFieldset, FormUISchemaRenderer } from './index.js';
|
|
24
25
|
export type { FieldSchema, FieldType, FieldFormat, FieldOption, OneOfItem, SchemaFormProps, BaseFieldProps, TextFieldProps, TextareaFieldProps, NumberFieldProps, ToggleFieldProps, RangeFieldProps, SelectFieldProps, CheckboxGroupFieldProps, ArrayFieldProps, FormFieldFactoryProps, FormFieldWrapperProps, FieldComponentProps, FieldMatcher, FieldMatcherRegistration, FieldComponent, FieldComponentRegistration } from './index.js';
|
|
25
26
|
export { isFieldOptionArray, isOneOfArray, normalizeOptions, oneOfToOptions, getSchemaOptions } from './index.js';
|
|
26
27
|
export { FieldComponentRegistry, hiddenFieldMatcher, checkboxGroupMatcher, enumSelectMatcher, textareaMatcher, rangeMatcher, textFieldMatcher, numberFieldMatcher, toggleMatcher, selectOptionsMatcher, arrayMatcher } from './index.js';
|
package/dist/form/full.js
CHANGED
|
@@ -21,8 +21,11 @@
|
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
// Re-export everything from the light form module
|
|
24
|
+
// The "everything statically bundled" FormField variant lives here (this is the
|
|
25
|
+
// heavy entry), not in the light `@flowdrop/flowdrop/form`.
|
|
26
|
+
export { default as FormFieldFull } from '../components/form/FormField.svelte';
|
|
24
27
|
// Components
|
|
25
|
-
export { SchemaForm, FormField,
|
|
28
|
+
export { SchemaForm, FormField, FormFieldWrapper, FormTextField, FormTextarea, FormNumberField, FormRangeField, FormToggle, FormSelect, FormCheckboxGroup, FormArray, FormFieldset, FormUISchemaRenderer } from './index.js';
|
|
26
29
|
// Utility functions
|
|
27
30
|
export { isFieldOptionArray, isOneOfArray, normalizeOptions, oneOfToOptions, getSchemaOptions } from './index.js';
|
|
28
31
|
// Field Registry
|
package/dist/form/index.d.ts
CHANGED
|
@@ -59,7 +59,6 @@
|
|
|
59
59
|
*/
|
|
60
60
|
export { default as SchemaForm } from '../components/SchemaForm.svelte';
|
|
61
61
|
export { default as FormField } from '../components/form/FormFieldLight.svelte';
|
|
62
|
-
export { default as FormFieldFull } from '../components/form/FormField.svelte';
|
|
63
62
|
export { default as FormFieldWrapper } from '../components/form/FormFieldWrapper.svelte';
|
|
64
63
|
export { default as FormTextField } from '../components/form/FormTextField.svelte';
|
|
65
64
|
export { default as FormTextarea } from '../components/form/FormTextarea.svelte';
|
package/dist/form/index.js
CHANGED
|
@@ -66,8 +66,9 @@ export { default as SchemaForm } from '../components/SchemaForm.svelte';
|
|
|
66
66
|
// ============================================================================
|
|
67
67
|
// Use the light version of FormField that uses the registry for heavy editors
|
|
68
68
|
export { default as FormField } from '../components/form/FormFieldLight.svelte';
|
|
69
|
-
//
|
|
70
|
-
|
|
69
|
+
// NOTE: `FormFieldFull` — the variant that *statically* bundles every editor
|
|
70
|
+
// (including CodeMirror) — is intentionally NOT exported here; it would pull
|
|
71
|
+
// CodeMirror into this light entry. Import it from `@flowdrop/flowdrop/form/full`.
|
|
71
72
|
export { default as FormFieldWrapper } from '../components/form/FormFieldWrapper.svelte';
|
|
72
73
|
export { default as FormTextField } from '../components/form/FormTextField.svelte';
|
|
73
74
|
export { default as FormTextarea } from '../components/form/FormTextarea.svelte';
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import type { WorkflowNode as WorkflowNodeType, NodeMetadata, Workflow, WorkflowEdge, NodeExecutionInfo } from '../types/index.js';
|
|
6
6
|
import { type FlowDropInstance } from '../stores/instanceContainer.svelte.js';
|
|
7
7
|
import type { ApiContext } from '../stores/apiContext.js';
|
|
8
|
+
import type { AuthProvider } from '../types/auth.js';
|
|
8
9
|
import type { EndpointConfig } from '../config/endpoints.js';
|
|
9
10
|
export { generateNodeId, extractConfigDefaults } from '../utils/nodeIds.js';
|
|
10
11
|
/**
|
|
@@ -134,7 +135,8 @@ export declare class WorkflowOperationsHelper {
|
|
|
134
135
|
*/
|
|
135
136
|
export declare class ConfigurationHelper {
|
|
136
137
|
/**
|
|
137
|
-
* Configure API endpoints
|
|
138
|
+
* Configure API endpoints (and optionally the auth provider) on the given
|
|
139
|
+
* instance's API context.
|
|
138
140
|
*/
|
|
139
|
-
static configureEndpoints(api: ApiContext, config: EndpointConfig): void;
|
|
141
|
+
static configureEndpoints(api: ApiContext, config: EndpointConfig, authProvider?: AuthProvider): void;
|
|
140
142
|
}
|
|
@@ -382,9 +382,10 @@ export class WorkflowOperationsHelper {
|
|
|
382
382
|
*/
|
|
383
383
|
export class ConfigurationHelper {
|
|
384
384
|
/**
|
|
385
|
-
* Configure API endpoints
|
|
385
|
+
* Configure API endpoints (and optionally the auth provider) on the given
|
|
386
|
+
* instance's API context.
|
|
386
387
|
*/
|
|
387
|
-
static configureEndpoints(api, config) {
|
|
388
|
-
api.configure(config);
|
|
388
|
+
static configureEndpoints(api, config, authProvider) {
|
|
389
|
+
api.configure(config, authProvider);
|
|
389
390
|
}
|
|
390
391
|
}
|
|
@@ -126,8 +126,8 @@ export { default as InputCollector } from '../components/playground/InputCollect
|
|
|
126
126
|
export { default as ExecutionLogs } from '../components/playground/ExecutionLogs.svelte';
|
|
127
127
|
export { default as MessageBubble } from '../components/playground/MessageBubble.svelte';
|
|
128
128
|
export { InterruptBubble, ConfirmationPrompt, ChoicePrompt, TextInputPrompt, FormPrompt, ReviewPrompt } from '../components/interrupt/index.js';
|
|
129
|
-
export { PlaygroundService
|
|
130
|
-
export { InterruptService
|
|
129
|
+
export { PlaygroundService } from '../services/playgroundService.js';
|
|
130
|
+
export { InterruptService } from '../services/interruptService.js';
|
|
131
131
|
export { PlaygroundStore } from '../stores/playgroundStore.svelte.js';
|
|
132
132
|
export type { PlaygroundSession, PlaygroundMessage, PlaygroundInputField, PlaygroundMessageRequest, PlaygroundMessagesResult, PlaygroundConfig, PlaygroundMode, PlaygroundSessionStatus, PlaygroundMessageRole, PlaygroundMessageLevel, PlaygroundMessageMetadata, PlaygroundApiResponse, PlaygroundSessionsResponse, PlaygroundSessionResponse, PlaygroundMessageResponse, PlaygroundMessagesApiResponse, PlaygroundExecution } from '../types/playground.js';
|
|
133
133
|
export { isChatInputNode, CHAT_INPUT_PATTERNS, defaultShouldStopPolling, defaultIsTerminalStatus, DEFAULT_STOP_POLLING_STATUSES, DEFAULT_TERMINAL_STATUSES } from '../types/playground.js';
|
package/dist/playground/index.js
CHANGED
|
@@ -135,11 +135,11 @@ export { InterruptBubble, ConfirmationPrompt, ChoicePrompt, TextInputPrompt, For
|
|
|
135
135
|
// ============================================================================
|
|
136
136
|
// Playground Service
|
|
137
137
|
// ============================================================================
|
|
138
|
-
export { PlaygroundService
|
|
138
|
+
export { PlaygroundService } from '../services/playgroundService.js';
|
|
139
139
|
// ============================================================================
|
|
140
140
|
// Interrupt Service (Human-in-the-Loop)
|
|
141
141
|
// ============================================================================
|
|
142
|
-
export { InterruptService
|
|
142
|
+
export { InterruptService } from '../services/interruptService.js';
|
|
143
143
|
// ============================================================================
|
|
144
144
|
// Playground Store
|
|
145
145
|
// ============================================================================
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
*/
|
|
46
46
|
import type { Workflow } from '../types/index.js';
|
|
47
47
|
import type { EndpointConfig } from '../config/endpoints.js';
|
|
48
|
+
import type { AuthProvider } from '../types/auth.js';
|
|
48
49
|
import type { PlaygroundMode, PlaygroundConfig, PlaygroundSession, PlaygroundMessagesApiResponse, PlaygroundSessionStatus } from '../types/playground.js';
|
|
49
50
|
import type { PartialSettings, SettingsCategory } from '../types/settings.js';
|
|
50
51
|
import type { NavbarAction } from '../types/navbar.js';
|
|
@@ -81,6 +82,15 @@ export interface PlaygroundMountOptions {
|
|
|
81
82
|
* Use createEndpointConfig() to create this
|
|
82
83
|
*/
|
|
83
84
|
endpointConfig?: EndpointConfig;
|
|
85
|
+
/**
|
|
86
|
+
* Authentication provider for API requests.
|
|
87
|
+
*
|
|
88
|
+
* Applied to this instance via `fd.api.configure()` so every request the
|
|
89
|
+
* playground makes (sessions, messages, polling, interrupts) carries the
|
|
90
|
+
* provider's headers — e.g. an `Authorization` bearer token or an
|
|
91
|
+
* `X-CSRF-Token`. Omit for unauthenticated backends.
|
|
92
|
+
*/
|
|
93
|
+
authProvider?: AuthProvider;
|
|
84
94
|
/**
|
|
85
95
|
* Playground-specific configuration options
|
|
86
96
|
*/
|
package/dist/playground/mount.js
CHANGED
|
@@ -125,7 +125,7 @@ function buildMountedPlayground(svelteApp, workflowId, config, fd, ownsInstance,
|
|
|
125
125
|
startPolling: () => {
|
|
126
126
|
const session = fd.playground.currentSession;
|
|
127
127
|
if (session) {
|
|
128
|
-
playgroundService.startPolling(fd.api.config, session.id, (response) => fd.playground.applyServerResponse(response, session.id), pollingInterval, config.shouldStopPolling, playgroundService.getLastSequenceNumber());
|
|
128
|
+
playgroundService.startPolling(fd.api.config, session.id, (response) => fd.playground.applyServerResponse(response, session.id), pollingInterval, config.shouldStopPolling, playgroundService.getLastSequenceNumber(), fd.api.authProvider);
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
131
|
pushMessages: (response) => fd.playground.applyServerResponse(response, null),
|
|
@@ -165,7 +165,7 @@ function buildMountedPlayground(svelteApp, workflowId, config, fd, ownsInstance,
|
|
|
165
165
|
* ```
|
|
166
166
|
*/
|
|
167
167
|
export async function mountPlayground(container, options) {
|
|
168
|
-
const { workflowId, workflow, mode = 'standalone', initialSessionId, endpointConfig, config = {}, height, width, settings: initialSettings, onClose, onSessionStatusChange, instanceId } = options;
|
|
168
|
+
const { workflowId, workflow, mode = 'standalone', initialSessionId, endpointConfig, authProvider, config = {}, height, width, settings: initialSettings, onClose, onSessionStatusChange, instanceId } = options;
|
|
169
169
|
// Validate required parameters
|
|
170
170
|
if (!workflowId) {
|
|
171
171
|
throw new Error('workflowId is required for mountPlayground()');
|
|
@@ -200,6 +200,7 @@ export async function mountPlayground(container, options) {
|
|
|
200
200
|
workflow,
|
|
201
201
|
initialSessionId,
|
|
202
202
|
endpointConfig: finalEndpointConfig,
|
|
203
|
+
authProvider,
|
|
203
204
|
config,
|
|
204
205
|
onClose: () => {
|
|
205
206
|
if (onClose) {
|
|
@@ -219,6 +220,7 @@ export async function mountPlayground(container, options) {
|
|
|
219
220
|
mode,
|
|
220
221
|
initialSessionId,
|
|
221
222
|
endpointConfig: finalEndpointConfig,
|
|
223
|
+
authProvider,
|
|
222
224
|
config,
|
|
223
225
|
onClose
|
|
224
226
|
}
|
|
@@ -247,7 +249,7 @@ export function unmountPlayground(app) {
|
|
|
247
249
|
}
|
|
248
250
|
}
|
|
249
251
|
export async function mountPlaygroundStudio(container, options) {
|
|
250
|
-
const { workflowId, workflow, mode = 'standalone', initialSessionId, endpointConfig, config = {}, height, width, initialPipelineOpen, minChatWidth, initialPipelineWidth, settings: initialSettings, onClose, onSessionNavigate, onSessionStatusChange, pipelineViews, instanceId } = options;
|
|
252
|
+
const { workflowId, workflow, mode = 'standalone', initialSessionId, endpointConfig, authProvider, config = {}, height, width, initialPipelineOpen, minChatWidth, initialPipelineWidth, settings: initialSettings, onClose, onSessionNavigate, onSessionStatusChange, pipelineViews, instanceId } = options;
|
|
251
253
|
if (!workflowId) {
|
|
252
254
|
throw new Error('workflowId is required for mountPlaygroundStudio()');
|
|
253
255
|
}
|
|
@@ -272,6 +274,7 @@ export async function mountPlaygroundStudio(container, options) {
|
|
|
272
274
|
mode,
|
|
273
275
|
initialSessionId,
|
|
274
276
|
endpointConfig: finalEndpointConfig,
|
|
277
|
+
authProvider,
|
|
275
278
|
config,
|
|
276
279
|
onClose,
|
|
277
280
|
onSessionNavigate,
|
|
@@ -304,7 +307,7 @@ export async function mountPlaygroundStudio(container, options) {
|
|
|
304
307
|
* ```
|
|
305
308
|
*/
|
|
306
309
|
export async function mountPlaygroundApp(container, options) {
|
|
307
|
-
const { workflowId, workflow, mode = 'standalone', initialSessionId, endpointConfig, config = {}, height, width, showNavbar = true, navbarTitle, primaryActions, showSettings = true, settingsCategories, showSettingsSyncButton, showSettingsResetButton, initialPipelineOpen, minChatWidth, initialPipelineWidth, settings: initialSettings, onClose, onSessionNavigate, onSessionStatusChange, instanceId } = options;
|
|
310
|
+
const { workflowId, workflow, mode = 'standalone', initialSessionId, endpointConfig, authProvider, config = {}, height, width, showNavbar = true, navbarTitle, primaryActions, showSettings = true, settingsCategories, showSettingsSyncButton, showSettingsResetButton, initialPipelineOpen, minChatWidth, initialPipelineWidth, settings: initialSettings, onClose, onSessionNavigate, onSessionStatusChange, instanceId } = options;
|
|
308
311
|
if (!workflowId) {
|
|
309
312
|
throw new Error('workflowId is required for mountPlaygroundApp()');
|
|
310
313
|
}
|
|
@@ -332,6 +335,7 @@ export async function mountPlaygroundApp(container, options) {
|
|
|
332
335
|
mode,
|
|
333
336
|
initialSessionId,
|
|
334
337
|
endpointConfig: finalEndpointConfig,
|
|
338
|
+
authProvider,
|
|
335
339
|
config,
|
|
336
340
|
showNavbar,
|
|
337
341
|
navbarTitle,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Node Type Metadata (pure — no component imports)
|
|
3
|
+
*
|
|
4
|
+
* The type identifiers, aliases, and resolution helpers for FlowDrop's built-in
|
|
5
|
+
* node types, with ZERO dependency on the Svelte node components. Utilities that
|
|
6
|
+
* only need to reason about type strings (e.g. `utils/nodeTypes.ts`, reachable
|
|
7
|
+
* from `@flowdrop/flowdrop/core`) import from here, so the lightweight `core`
|
|
8
|
+
* entry never statically pulls in node components, marked, or DOMPurify.
|
|
9
|
+
*
|
|
10
|
+
* The component registrations themselves live in `./builtinNodes.ts`, which
|
|
11
|
+
* re-exports everything here for backward compatibility.
|
|
12
|
+
*
|
|
13
|
+
* @module registry/builtinNodeTypes
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Source identifier for built-in FlowDrop components.
|
|
17
|
+
*/
|
|
18
|
+
export declare const FLOWDROP_SOURCE = "flowdrop";
|
|
19
|
+
/**
|
|
20
|
+
* Type for built-in node types.
|
|
21
|
+
* Use this when you specifically need a built-in type.
|
|
22
|
+
*/
|
|
23
|
+
export type BuiltinNodeType = 'workflowNode' | 'simple' | 'square' | 'atom' | 'tool' | 'gateway' | 'note' | 'terminal' | 'idea';
|
|
24
|
+
/**
|
|
25
|
+
* Array of built-in type strings for runtime validation.
|
|
26
|
+
*/
|
|
27
|
+
export declare const BUILTIN_NODE_TYPES: BuiltinNodeType[];
|
|
28
|
+
/**
|
|
29
|
+
* Alias mapping for type resolution.
|
|
30
|
+
* Maps alternative type names to their canonical registration.
|
|
31
|
+
*/
|
|
32
|
+
export declare const BUILTIN_TYPE_ALIASES: Record<string, string>;
|
|
33
|
+
/**
|
|
34
|
+
* Get the canonical type for a given type string.
|
|
35
|
+
* Handles aliases like "default" -> "workflowNode".
|
|
36
|
+
*
|
|
37
|
+
* @param type - The type string to resolve
|
|
38
|
+
* @returns The canonical type string
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveBuiltinAlias(type: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Check if a type is a built-in FlowDrop type.
|
|
43
|
+
*
|
|
44
|
+
* @param type - The type to check
|
|
45
|
+
* @returns true if this is a built-in type
|
|
46
|
+
*/
|
|
47
|
+
export declare function isBuiltinType(type: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get all built-in type identifiers.
|
|
50
|
+
*
|
|
51
|
+
* @returns Array of built-in type strings
|
|
52
|
+
*/
|
|
53
|
+
export declare function getBuiltinTypes(): string[];
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in Node Type Metadata (pure — no component imports)
|
|
3
|
+
*
|
|
4
|
+
* The type identifiers, aliases, and resolution helpers for FlowDrop's built-in
|
|
5
|
+
* node types, with ZERO dependency on the Svelte node components. Utilities that
|
|
6
|
+
* only need to reason about type strings (e.g. `utils/nodeTypes.ts`, reachable
|
|
7
|
+
* from `@flowdrop/flowdrop/core`) import from here, so the lightweight `core`
|
|
8
|
+
* entry never statically pulls in node components, marked, or DOMPurify.
|
|
9
|
+
*
|
|
10
|
+
* The component registrations themselves live in `./builtinNodes.ts`, which
|
|
11
|
+
* re-exports everything here for backward compatibility.
|
|
12
|
+
*
|
|
13
|
+
* @module registry/builtinNodeTypes
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Source identifier for built-in FlowDrop components.
|
|
17
|
+
*/
|
|
18
|
+
export const FLOWDROP_SOURCE = 'flowdrop';
|
|
19
|
+
/**
|
|
20
|
+
* Array of built-in type strings for runtime validation.
|
|
21
|
+
*/
|
|
22
|
+
export const BUILTIN_NODE_TYPES = [
|
|
23
|
+
'workflowNode',
|
|
24
|
+
'simple',
|
|
25
|
+
'square',
|
|
26
|
+
'atom',
|
|
27
|
+
'tool',
|
|
28
|
+
'gateway',
|
|
29
|
+
'note',
|
|
30
|
+
'terminal',
|
|
31
|
+
'idea'
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* Alias mapping for type resolution.
|
|
35
|
+
* Maps alternative type names to their canonical registration.
|
|
36
|
+
*/
|
|
37
|
+
export const BUILTIN_TYPE_ALIASES = {
|
|
38
|
+
default: 'workflowNode'
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Get the canonical type for a given type string.
|
|
42
|
+
* Handles aliases like "default" -> "workflowNode".
|
|
43
|
+
*
|
|
44
|
+
* @param type - The type string to resolve
|
|
45
|
+
* @returns The canonical type string
|
|
46
|
+
*/
|
|
47
|
+
export function resolveBuiltinAlias(type) {
|
|
48
|
+
return BUILTIN_TYPE_ALIASES[type] ?? type;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Check if a type is a built-in FlowDrop type.
|
|
52
|
+
*
|
|
53
|
+
* @param type - The type to check
|
|
54
|
+
* @returns true if this is a built-in type
|
|
55
|
+
*/
|
|
56
|
+
export function isBuiltinType(type) {
|
|
57
|
+
const canonicalType = resolveBuiltinAlias(type);
|
|
58
|
+
return BUILTIN_NODE_TYPES.includes(canonicalType);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get all built-in type identifiers.
|
|
62
|
+
*
|
|
63
|
+
* @returns Array of built-in type strings
|
|
64
|
+
*/
|
|
65
|
+
export function getBuiltinTypes() {
|
|
66
|
+
return [...BUILTIN_NODE_TYPES];
|
|
67
|
+
}
|
|
@@ -6,47 +6,10 @@
|
|
|
6
6
|
* ensuring all built-in node types are available without user action.
|
|
7
7
|
*/
|
|
8
8
|
import { type NodeComponentRegistration } from './nodeComponentRegistry.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
export declare const FLOWDROP_SOURCE = "flowdrop";
|
|
9
|
+
export { FLOWDROP_SOURCE, BUILTIN_TYPE_ALIASES, BUILTIN_NODE_TYPES, resolveBuiltinAlias, isBuiltinType, getBuiltinTypes } from './builtinNodeTypes.js';
|
|
10
|
+
export type { BuiltinNodeType } from './builtinNodeTypes.js';
|
|
13
11
|
/**
|
|
14
12
|
* Built-in FlowDrop node component registrations.
|
|
15
13
|
* These are the default node types that ship with FlowDrop.
|
|
16
14
|
*/
|
|
17
15
|
export declare const BUILTIN_NODE_COMPONENTS: NodeComponentRegistration[];
|
|
18
|
-
/**
|
|
19
|
-
* Alias mapping for type resolution.
|
|
20
|
-
* Maps alternative type names to their canonical registration.
|
|
21
|
-
*/
|
|
22
|
-
export declare const BUILTIN_TYPE_ALIASES: Record<string, string>;
|
|
23
|
-
/**
|
|
24
|
-
* Get the canonical type for a given type string.
|
|
25
|
-
* Handles aliases like "default" -> "workflowNode".
|
|
26
|
-
*
|
|
27
|
-
* @param type - The type string to resolve
|
|
28
|
-
* @returns The canonical type string
|
|
29
|
-
*/
|
|
30
|
-
export declare function resolveBuiltinAlias(type: string): string;
|
|
31
|
-
/**
|
|
32
|
-
* Check if a type is a built-in FlowDrop type.
|
|
33
|
-
*
|
|
34
|
-
* @param type - The type to check
|
|
35
|
-
* @returns true if this is a built-in type
|
|
36
|
-
*/
|
|
37
|
-
export declare function isBuiltinType(type: string): boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Get all built-in type identifiers.
|
|
40
|
-
*
|
|
41
|
-
* @returns Array of built-in type strings
|
|
42
|
-
*/
|
|
43
|
-
export declare function getBuiltinTypes(): string[];
|
|
44
|
-
/**
|
|
45
|
-
* Type for built-in node types.
|
|
46
|
-
* Use this when you specifically need a built-in type.
|
|
47
|
-
*/
|
|
48
|
-
export type BuiltinNodeType = 'workflowNode' | 'simple' | 'square' | 'atom' | 'tool' | 'gateway' | 'note' | 'terminal' | 'idea';
|
|
49
|
-
/**
|
|
50
|
-
* Array of built-in type strings for runtime validation.
|
|
51
|
-
*/
|
|
52
|
-
export declare const BUILTIN_NODE_TYPES: BuiltinNodeType[];
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* ensuring all built-in node types are available without user action.
|
|
7
7
|
*/
|
|
8
8
|
import {} from './nodeComponentRegistry.js';
|
|
9
|
+
import { FLOWDROP_SOURCE } from './builtinNodeTypes.js';
|
|
9
10
|
import WorkflowNode from '../components/nodes/WorkflowNode.svelte';
|
|
10
11
|
import SimpleNode from '../components/nodes/SimpleNode.svelte';
|
|
11
12
|
import SquareNode from '../components/nodes/SquareNode.svelte';
|
|
@@ -15,10 +16,11 @@ import GatewayNode from '../components/nodes/GatewayNode.svelte';
|
|
|
15
16
|
import NotesNode from '../components/nodes/NotesNode.svelte';
|
|
16
17
|
import TerminalNode from '../components/nodes/TerminalNode.svelte';
|
|
17
18
|
import IdeaNode from '../components/nodes/IdeaNode.svelte';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
// Pure type metadata + resolution helpers are re-exported for backward
|
|
20
|
+
// compatibility — they now live in a component-free module so that
|
|
21
|
+
// type-only consumers (e.g. utils/nodeTypes.ts, reachable from `core`) do
|
|
22
|
+
// not statically pull in the node components below.
|
|
23
|
+
export { FLOWDROP_SOURCE, BUILTIN_TYPE_ALIASES, BUILTIN_NODE_TYPES, resolveBuiltinAlias, isBuiltinType, getBuiltinTypes } from './builtinNodeTypes.js';
|
|
22
24
|
/**
|
|
23
25
|
* Built-in FlowDrop node component registrations.
|
|
24
26
|
* These are the default node types that ship with FlowDrop.
|
|
@@ -124,52 +126,3 @@ export const BUILTIN_NODE_COMPONENTS = [
|
|
|
124
126
|
statusSize: 'sm'
|
|
125
127
|
}
|
|
126
128
|
];
|
|
127
|
-
/**
|
|
128
|
-
* Alias mapping for type resolution.
|
|
129
|
-
* Maps alternative type names to their canonical registration.
|
|
130
|
-
*/
|
|
131
|
-
export const BUILTIN_TYPE_ALIASES = {
|
|
132
|
-
default: 'workflowNode'
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* Get the canonical type for a given type string.
|
|
136
|
-
* Handles aliases like "default" -> "workflowNode".
|
|
137
|
-
*
|
|
138
|
-
* @param type - The type string to resolve
|
|
139
|
-
* @returns The canonical type string
|
|
140
|
-
*/
|
|
141
|
-
export function resolveBuiltinAlias(type) {
|
|
142
|
-
return BUILTIN_TYPE_ALIASES[type] ?? type;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Check if a type is a built-in FlowDrop type.
|
|
146
|
-
*
|
|
147
|
-
* @param type - The type to check
|
|
148
|
-
* @returns true if this is a built-in type
|
|
149
|
-
*/
|
|
150
|
-
export function isBuiltinType(type) {
|
|
151
|
-
const canonicalType = resolveBuiltinAlias(type);
|
|
152
|
-
return BUILTIN_NODE_COMPONENTS.some((reg) => reg.type === canonicalType);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Get all built-in type identifiers.
|
|
156
|
-
*
|
|
157
|
-
* @returns Array of built-in type strings
|
|
158
|
-
*/
|
|
159
|
-
export function getBuiltinTypes() {
|
|
160
|
-
return BUILTIN_NODE_COMPONENTS.map((reg) => reg.type);
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Array of built-in type strings for runtime validation.
|
|
164
|
-
*/
|
|
165
|
-
export const BUILTIN_NODE_TYPES = [
|
|
166
|
-
'workflowNode',
|
|
167
|
-
'simple',
|
|
168
|
-
'square',
|
|
169
|
-
'atom',
|
|
170
|
-
'tool',
|
|
171
|
-
'gateway',
|
|
172
|
-
'note',
|
|
173
|
-
'terminal',
|
|
174
|
-
'idea'
|
|
175
|
-
];
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module services/apiVariableService
|
|
7
7
|
*/
|
|
8
|
-
import { logger } from '../utils/logger.js';
|
|
9
8
|
import { DEFAULT_CACHE_TTL_MS } from '../config/constants.js';
|
|
9
|
+
import { authenticatedFetch } from '../utils/fetchWithAuth.js';
|
|
10
10
|
/**
|
|
11
11
|
* Variable schema cache with TTL support
|
|
12
12
|
* Key format: `variables:{workflowId}:{nodeId}`
|
|
@@ -142,25 +142,9 @@ export async function fetchVariableSchema(endpointConfig, workflowId, nodeId, co
|
|
|
142
142
|
// Prepare request options
|
|
143
143
|
const method = endpoint.method ?? 'GET';
|
|
144
144
|
const timeout = endpoint.timeout ?? 30000;
|
|
145
|
-
const headers = {
|
|
146
|
-
Accept: 'application/json',
|
|
147
|
-
'Content-Type': 'application/json',
|
|
148
|
-
...endpoint.headers
|
|
149
|
-
};
|
|
150
|
-
// Add auth headers from AuthProvider if available
|
|
151
|
-
if (authProvider) {
|
|
152
|
-
try {
|
|
153
|
-
const authHeaders = await authProvider.getAuthHeaders();
|
|
154
|
-
Object.assign(headers, authHeaders);
|
|
155
|
-
}
|
|
156
|
-
catch (error) {
|
|
157
|
-
logger.warn('Failed to get auth headers:', error);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
145
|
// Prepare fetch options
|
|
161
146
|
const fetchOptions = {
|
|
162
147
|
method,
|
|
163
|
-
headers,
|
|
164
148
|
signal: AbortSignal.timeout(timeout)
|
|
165
149
|
};
|
|
166
150
|
// Add body for non-GET requests
|
|
@@ -169,7 +153,16 @@ export async function fetchVariableSchema(endpointConfig, workflowId, nodeId, co
|
|
|
169
153
|
fetchOptions.body = JSON.stringify(resolvedBody);
|
|
170
154
|
}
|
|
171
155
|
try {
|
|
172
|
-
|
|
156
|
+
// authenticatedFetch merges auth headers and transparently refreshes +
|
|
157
|
+
// retries once on 401 via the provider's onUnauthorized hook.
|
|
158
|
+
const response = await authenticatedFetch(url, fetchOptions, {
|
|
159
|
+
authProvider,
|
|
160
|
+
baseHeaders: {
|
|
161
|
+
Accept: 'application/json',
|
|
162
|
+
'Content-Type': 'application/json',
|
|
163
|
+
...endpoint.headers
|
|
164
|
+
}
|
|
165
|
+
});
|
|
173
166
|
// Handle 404 as "no variables available"
|
|
174
167
|
if (response.status === 404) {
|
|
175
168
|
return {
|
|
@@ -179,15 +172,8 @@ export async function fetchVariableSchema(endpointConfig, workflowId, nodeId, co
|
|
|
179
172
|
};
|
|
180
173
|
}
|
|
181
174
|
if (!response.ok) {
|
|
182
|
-
//
|
|
175
|
+
// Auth errors remain after the provider's refresh attempt.
|
|
183
176
|
if (response.status === 401 || response.status === 403) {
|
|
184
|
-
if (authProvider?.onUnauthorized) {
|
|
185
|
-
const refreshed = await authProvider.onUnauthorized();
|
|
186
|
-
if (refreshed) {
|
|
187
|
-
// Retry with refreshed auth
|
|
188
|
-
return fetchVariableSchema(endpointConfig, workflowId, nodeId, config, authProvider);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
177
|
return {
|
|
192
178
|
success: false,
|
|
193
179
|
error: 'Authentication failed'
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Categories API Service
|
|
3
3
|
* Handles fetching category definitions from the backend
|
|
4
4
|
*/
|
|
5
|
-
import { buildEndpointUrl
|
|
5
|
+
import { buildEndpointUrl } from '../config/endpoints.js';
|
|
6
|
+
import { authenticatedFetch } from '../utils/fetchWithAuth.js';
|
|
6
7
|
import { DEFAULT_CATEGORIES } from '../config/defaultCategories.js';
|
|
7
8
|
import { logger } from '../utils/logger.js';
|
|
8
9
|
/**
|
|
@@ -11,11 +12,7 @@ import { logger } from '../utils/logger.js';
|
|
|
11
12
|
export async function fetchCategories(endpointConfig, authProvider) {
|
|
12
13
|
try {
|
|
13
14
|
const url = buildEndpointUrl(endpointConfig, endpointConfig.endpoints.categories);
|
|
14
|
-
const
|
|
15
|
-
const authHeaders = authProvider ? await authProvider.getAuthHeaders() : {};
|
|
16
|
-
const response = await fetch(url, {
|
|
17
|
-
headers: { ...configHeaders, ...authHeaders }
|
|
18
|
-
});
|
|
15
|
+
const response = await authenticatedFetch(url, {}, { config: endpointConfig, endpointKey: 'categories', authProvider });
|
|
19
16
|
if (!response.ok) {
|
|
20
17
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
21
18
|
}
|