@huanban/rulego-editor-core 1.4.2 → 2.0.0
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/README.md +20 -8
- package/dist/ai/ai-chat-options.d.ts +12 -0
- package/dist/api/AIAssistantAPI.d.ts +29 -0
- package/dist/api/AIManager.d.ts +7 -1
- package/dist/api/ApiProvider.d.ts +17 -4
- package/dist/api/DebugSocketClient.d.ts +2 -0
- package/dist/api/GlobalConfigAPI.d.ts +35 -0
- package/dist/api/IoTPointTemplateAPI.d.ts +32 -0
- package/dist/api/MarketplaceAPI.d.ts +39 -0
- package/dist/api/RuleChainAPI.d.ts +23 -4
- package/dist/api/RuleChainVersionsAPI.d.ts +28 -0
- package/dist/api/SkillsAPI.d.ts +31 -0
- package/dist/api/UserAPI.d.ts +39 -0
- package/dist/api/extended-api-shared.d.ts +25 -0
- package/dist/api/index.d.ts +19 -2
- package/dist/api/public-api.test-d.d.ts +87 -0
- package/dist/api/response-utils.d.ts +1 -0
- package/dist/api/types.d.ts +86 -14
- package/dist/chunks/editor-core-api-BQiYFuIO.js +1157 -0
- package/dist/chunks/editor-core-canvas-nodes-BE9eN51s.js +6921 -0
- package/dist/chunks/editor-core-code-editor-DFm5Owtv.js +660 -0
- package/dist/chunks/{editor-core-default-components-BjF65lar.js → editor-core-default-components-BsNP8ma1.js} +98 -98
- package/dist/chunks/editor-core-dialogs-D9YHvzys.js +12009 -0
- package/dist/chunks/{editor-core-locales-i6o28vm2.js → editor-core-locales-CsqTh7Wh.js} +1723 -11
- package/dist/chunks/{editor-core-node-patches-BJTT3TuX.js → editor-core-node-patches-Dbi8XYxu.js} +633 -184
- package/dist/chunks/{editor-core-node-views-BOaPVdmN.js → editor-core-node-views-C8FQYC3E.js} +39 -29
- package/dist/chunks/editor-core-property-drawers-Bqmp9B_J.js +9562 -0
- package/dist/chunks/editor-core-settings-DcGCJSc7.js +4161 -0
- package/dist/chunks/editor-core-standalone-C7pzm8ZB.js +10013 -0
- package/dist/chunks/{editor-core-styles-DFhXz0vB.js → editor-core-styles-CwjFPfAo.js} +967 -510
- package/dist/chunks/vendor-highlight-acC2fLd8.js +5868 -0
- package/dist/chunks/vendor-logicflow-core-runtime-DpsWXOGl.js +4 -0
- package/dist/chunks/vendor-logicflow-shared-C_kIdBKO.js +4 -0
- package/dist/core/ActionRegistry.d.ts +4 -2
- package/dist/core/DataAdapter.d.ts +17 -1
- package/dist/core/DialogProvider.d.ts +33 -0
- package/dist/core/EditorCore.d.ts +16 -3
- package/dist/core/FieldCapabilityRegistry.d.ts +4 -1
- package/dist/core/FieldChangeRegistry.d.ts +3 -1
- package/dist/core/I18nManager.d.ts +1 -1
- package/dist/core/IdentityProvider.d.ts +32 -0
- package/dist/core/OptionSourceRegistry.d.ts +4 -1
- package/dist/core/PropertyControlRegistry.d.ts +29 -0
- package/dist/core/ThemeManager.d.ts +7 -0
- package/dist/core/anchored-popover.d.ts +16 -0
- package/dist/core/assistant-dsl.d.ts +18 -0
- package/dist/core/business-log-config.d.ts +18 -0
- package/dist/core/clean-snapshot.d.ts +14 -0
- package/dist/core/component-localization.d.ts +17 -0
- package/dist/core/component-palette.d.ts +3 -0
- package/dist/core/connection-status.d.ts +11 -0
- package/dist/core/dialog-styles.d.ts +1 -0
- package/dist/core/editor-capabilities.d.ts +82 -1
- package/dist/core/editor-edge-anchors.d.ts +16 -0
- package/dist/core/endpoint-protocol.d.ts +15 -0
- package/dist/core/expression-preview.d.ts +6 -0
- package/dist/core/field-protocol.d.ts +19 -4
- package/dist/core/global-config.d.ts +47 -0
- package/dist/core/global-search.d.ts +31 -0
- package/dist/core/group-protocol.d.ts +56 -0
- package/dist/core/identity-provider-default.d.ts +32 -0
- package/dist/core/index.d.ts +31 -5
- package/dist/core/keymap.d.ts +10 -0
- package/dist/core/payload-kv.d.ts +7 -0
- package/dist/core/rule-chain-versions.d.ts +143 -0
- package/dist/core/run-analysis.d.ts +126 -0
- package/dist/core/runtime-field-dictionary.d.ts +3 -0
- package/dist/core/save-conflict.d.ts +1 -0
- package/dist/core/server-status.d.ts +1 -0
- package/dist/core/toolbar-icons.d.ts +1 -1
- package/dist/core/variable-completion.d.ts +13 -0
- package/dist/core/websocket-auth.d.ts +2 -0
- package/dist/defaults/analysis-locales.d.ts +241 -0
- package/dist/defaults/component-locale-categories.d.ts +14 -0
- package/dist/defaults/component-locale-data.d.ts +4 -0
- package/dist/defaults/component-locale-en-US.d.ts +10 -0
- package/dist/defaults/component-locale-summaries.d.ts +15 -0
- package/dist/defaults/component-locale-zh-CN.d.ts +10 -0
- package/dist/defaults/editor-shell-locales.d.ts +290 -0
- package/dist/defaults/example-chain.d.ts +2 -0
- package/dist/defaults/field-interaction-locales.d.ts +19 -0
- package/dist/defaults/global-config-locales.d.ts +166 -0
- package/dist/defaults/official-component-fallbacks.d.ts +2 -1
- package/dist/defaults/point-template-locales.d.ts +64 -0
- package/dist/index.cjs +2856 -2086
- package/dist/index.d.ts +33 -10
- package/dist/index.esm.js +1182 -810
- package/dist/index.umd.js +2850 -2080
- package/dist/nodes/UnknownNodeModel.d.ts +12 -1
- package/dist/standalone/HuanbanRulegoEditor.d.ts +145 -13
- package/dist/standalone/auth-fetch.d.ts +1 -0
- package/dist/standalone/auth-ui-defaults.d.ts +15 -0
- package/dist/standalone/code-editor.d.ts +7 -5
- package/dist/standalone/connection-status-binding.d.ts +3 -2
- package/dist/standalone/custom-nodes.d.ts +13 -0
- package/dist/standalone/drawer-locale.d.ts +12 -0
- package/dist/standalone/drawer-unsaved-guard.d.ts +6 -1
- package/dist/standalone/dynamic-field-browse.d.ts +25 -0
- package/dist/standalone/edge-label-quick-editor.d.ts +2 -1
- package/dist/standalone/editor-actions.d.ts +1 -0
- package/dist/standalone/editor-canvas-anchors.d.ts +19 -0
- package/dist/standalone/editor-canvas-shortcuts.d.ts +1 -0
- package/dist/standalone/editor-chain-info.d.ts +1 -0
- package/dist/standalone/editor-debug-data.d.ts +18 -0
- package/dist/standalone/editor-debug-ws.d.ts +2 -0
- package/dist/standalone/editor-delete.d.ts +5 -3
- package/dist/standalone/editor-dialog-provider.d.ts +3 -0
- package/dist/standalone/editor-dialogs.d.ts +25 -2
- package/dist/standalone/editor-global-config.d.ts +44 -0
- package/dist/standalone/editor-group-interactions.d.ts +1 -0
- package/dist/standalone/editor-host-region-styles.d.ts +1 -0
- package/dist/standalone/editor-host-regions.d.ts +53 -0
- package/dist/standalone/editor-login.d.ts +15 -0
- package/dist/standalone/editor-overlays.d.ts +5 -0
- package/dist/standalone/editor-property-drawers.d.ts +3 -1
- package/dist/standalone/editor-run-analysis.d.ts +81 -0
- package/dist/standalone/editor-run-compare.d.ts +20 -0
- package/dist/standalone/editor-run-waterfall.d.ts +11 -0
- package/dist/standalone/editor-toast.d.ts +1 -1
- package/dist/standalone/editor-toolbar-presentation.d.ts +12 -0
- package/dist/standalone/editor-toolbar.d.ts +5 -1
- package/dist/standalone/editor-ui-configuration.d.ts +55 -0
- package/dist/standalone/editor-ui-settings.d.ts +26 -0
- package/dist/standalone/editor-user-menu.d.ts +8 -0
- package/dist/standalone/editor-version-history.d.ts +82 -0
- package/dist/standalone/editor-workspace-shell.d.ts +47 -0
- package/dist/standalone/editor-workspace-styles.d.ts +1 -0
- package/dist/standalone/field-expression-preview.d.ts +12 -0
- package/dist/standalone/group-node.d.ts +19 -3
- package/dist/standalone/icon-utils.d.ts +7 -0
- package/dist/standalone/index.d.ts +17 -5
- package/dist/standalone/keyboard-events.d.ts +3 -0
- package/dist/standalone/multi-select-popover.d.ts +16 -0
- package/dist/standalone/node-copy.d.ts +1 -0
- package/dist/standalone/node-definitions.d.ts +4 -0
- package/dist/standalone/node-renderer-utils.d.ts +21 -0
- package/dist/standalone/node-theme.d.ts +1 -1
- package/dist/standalone/point-template-actions.d.ts +43 -0
- package/dist/standalone/property-field-draft.d.ts +5 -0
- package/dist/standalone/question-list-editor.d.ts +35 -0
- package/dist/standalone/shared-node-manager.d.ts +14 -0
- package/dist/standalone/single-select-popover.d.ts +6 -0
- package/dist/standalone/theme-scope.d.ts +15 -0
- package/dist/standalone/themes.d.ts +4 -0
- package/dist/standalone/variable-completion-dropdown.d.ts +18 -0
- package/dist/types/component.d.ts +22 -1
- package/dist/types/editor.d.ts +41 -0
- package/dist/utils/relation-utils.d.ts +19 -1
- package/dist/version.d.ts +2 -2
- package/package.json +3 -3
- package/vite-chunks.mjs +66 -0
- package/dist/chunks/editor-core-code-editor-CRki2wA_.js +0 -512
- package/dist/chunks/editor-core-dialogs-BMWb0WRN.js +0 -17228
- package/dist/chunks/editor-core-property-drawers-BPh-jj1b.js +0 -7998
- package/dist/chunks/editor-core-standalone-Cls7lcgT.js +0 -11302
- package/dist/chunks/vendor-logicflow-core-runtime-Cp6IBEjB.js +0 -217
- package/dist/chunks/vendor-logicflow-shared-C7YynLDn.js +0 -4
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
- **基于 LogicFlow** — 底层使用 LogicFlow 流程图引擎,提供强大的节点编排能力
|
|
16
16
|
- **完整事件系统** — EventBus 事件总线,支持节点/边/编辑器事件监听
|
|
17
17
|
- **状态管理** — 内置 StateStore 响应式状态管理
|
|
18
|
-
- **
|
|
18
|
+
- **12 套浅色与彩色主题** — 经典(Classic) / 自然(Nature) / 优雅(Elegant) / 科技(Tech) / 现代(Modern) / 彩色(Colorful) / 蚂蚁蓝(Ant Blue) / Material / Tailwind / GitHub / VS Code / Apple
|
|
19
19
|
- **国际化** — 中/英文双语支持,一键切换
|
|
20
20
|
- **撤销/重做** — 内置 undo/redo 操作历史
|
|
21
21
|
- **调试日志** — 内置调试开关,默认关闭,可按需开启
|
|
@@ -43,10 +43,11 @@ pnpm add @huanban/rulego-editor-core
|
|
|
43
43
|
<div id="editor" style="width: 100%; height: 100vh;"></div>
|
|
44
44
|
<script src="dist/index.umd.js"></script>
|
|
45
45
|
<script>
|
|
46
|
-
const editor = new RuleGoEditorCore.HuanbanRulegoEditor(
|
|
46
|
+
const editor = new RuleGoEditorCore.HuanbanRulegoEditor({
|
|
47
|
+
container: '#editor',
|
|
47
48
|
apiBase: 'http://127.0.0.1:9090/api/v1',
|
|
48
49
|
theme: 'modern',
|
|
49
|
-
|
|
50
|
+
locale: 'zh-CN',
|
|
50
51
|
onReady: ({ lf, core }) => console.log('编辑器就绪'),
|
|
51
52
|
onNodeClick: (node) => console.log('点击节点', node),
|
|
52
53
|
onSaveSuccess: (data) => console.log('保存成功', data),
|
|
@@ -59,9 +60,10 @@ pnpm add @huanban/rulego-editor-core
|
|
|
59
60
|
```typescript
|
|
60
61
|
import { HuanbanRulegoEditor } from '@huanban/rulego-editor-core'
|
|
61
62
|
|
|
62
|
-
const editor = new HuanbanRulegoEditor(
|
|
63
|
+
const editor = new HuanbanRulegoEditor({
|
|
64
|
+
container: '#editor',
|
|
63
65
|
apiBase: 'http://127.0.0.1:9090/api/v1',
|
|
64
|
-
|
|
66
|
+
locale: 'zh-CN',
|
|
65
67
|
theme: 'modern',
|
|
66
68
|
toolbarTitle: '我的工作流',
|
|
67
69
|
})
|
|
@@ -86,10 +88,20 @@ const allChains = await api.listAll(100, '', 100)
|
|
|
86
88
|
// 获取内容
|
|
87
89
|
const content = await api.getContent('chain-001')
|
|
88
90
|
|
|
89
|
-
//
|
|
90
|
-
await api.
|
|
91
|
+
// 正式保存,chainData.ruleChain.id 决定目标资源,默认带 versionMark=1。
|
|
92
|
+
const result = await api.create(chainData)
|
|
93
|
+
if (!result.success) throw new Error(result.msg || 'Save failed')
|
|
94
|
+
|
|
95
|
+
// 草稿仍然写入后端,但不标记正式版本。
|
|
96
|
+
await api.create(chainData, { draft: true })
|
|
91
97
|
```
|
|
92
98
|
|
|
99
|
+
默认编辑器已接入多规则链 Tab、草稿、版本历史、运行瀑布/对比、全局配置及共享节点入口。
|
|
100
|
+
API 默认遵守 RuleGo 协议,扩展接口只接受显式宿主配置;不自动探测模型服务,也不使用 Mock。
|
|
101
|
+
`apiPrefix` 默认 `/api/v1`,完整自定义 API base 可配合 `apiPrefix: ''` 使用。
|
|
102
|
+
宿主已有 Tab 时可设 `showWorkspaceTabs: false`,其他按钮通过 `toolbar` 或 `capabilities` 控制。
|
|
103
|
+
完整接入约定见 [接口与多框架接入合同](../../docs/plan/2026-10-19-upstream-editor-refresh/03-api-and-host-contract.md)。
|
|
104
|
+
|
|
93
105
|
## 🎨 内置 UI 组件(独立编辑器)
|
|
94
106
|
|
|
95
107
|
`HuanbanRulegoEditor` 内置完整的 UI,**无需额外安装任何框架组件**:
|
|
@@ -138,7 +150,7 @@ setDebug(true)
|
|
|
138
150
|
| `DEFAULT_ROUTES` | 默认 API 路径映射 (RuleGo 标准路径) |
|
|
139
151
|
| `EventBus` | 事件总线,支持 on / off / emit 模式 |
|
|
140
152
|
| `StateStore` | 响应式状态容器,支持 subscribe |
|
|
141
|
-
| `ThemeManager` | 主题管理器,
|
|
153
|
+
| `ThemeManager` | 主题管理器,12 套主题自由切换;standalone、React、Vue 和 DOM 组件共享运行时变量 |
|
|
142
154
|
| `I18nManager` | 国际化管理器,中英文切换 |
|
|
143
155
|
| `ValidationEngine` | 规则链验证引擎 |
|
|
144
156
|
| `EditorWorkspace` | 框架无关的多 Tab、草稿和保存冲突状态 |
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type AIChatUrlValue = string | (() => string);
|
|
2
|
+
export interface AIChatConnectionOptions {
|
|
3
|
+
chainId?: string;
|
|
4
|
+
baseUrl?: AIChatUrlValue;
|
|
5
|
+
apiPrefix?: AIChatUrlValue;
|
|
6
|
+
getToken?: (() => string | null | undefined) | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function resolveAIChatEndpoint(options: AIChatConnectionOptions): string;
|
|
9
|
+
export declare function resolveAIChatTransportOptions(options: AIChatConnectionOptions, init?: RequestInit): {
|
|
10
|
+
endpoint: string;
|
|
11
|
+
init: RequestInit;
|
|
12
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ExtendedApiOptions } from './extended-api-shared';
|
|
2
|
+
import { ExtendedApiBase } from './extended-api-shared';
|
|
3
|
+
export interface AIAssistantSettings {
|
|
4
|
+
prompt: string;
|
|
5
|
+
model: string;
|
|
6
|
+
provider?: string;
|
|
7
|
+
maxSteps?: number;
|
|
8
|
+
maxToolOutput?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface AIAssistantModelConfig {
|
|
11
|
+
model: string;
|
|
12
|
+
provider?: string;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export interface AIAssistantRoutes {
|
|
16
|
+
agentPrompt: (agentId: string) => string;
|
|
17
|
+
agentModel: (agentId: string) => string;
|
|
18
|
+
}
|
|
19
|
+
export declare const AI_ASSISTANT_DEFAULT_AGENT_ID = "_assistant";
|
|
20
|
+
export declare class AIAssistantAPI extends ExtendedApiBase {
|
|
21
|
+
private readonly routes;
|
|
22
|
+
constructor(options: ExtendedApiOptions & {
|
|
23
|
+
routes?: Partial<AIAssistantRoutes>;
|
|
24
|
+
});
|
|
25
|
+
getPrompt(agentId?: string): Promise<string>;
|
|
26
|
+
updatePrompt(agentId: string, content: string): Promise<void>;
|
|
27
|
+
getModel(agentId?: string): Promise<AIAssistantModelConfig>;
|
|
28
|
+
updateModel(agentId: string, model: string, provider?: string): Promise<void>;
|
|
29
|
+
}
|
package/dist/api/AIManager.d.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { ApiProvider } from './ApiProvider';
|
|
2
|
+
export interface AIManagerOptions {
|
|
3
|
+
modelsPath?: string;
|
|
4
|
+
loader?: (request: ApiProvider['request'], signal: AbortSignal) => Promise<Response>;
|
|
5
|
+
}
|
|
2
6
|
export declare class AIManager {
|
|
3
7
|
private readonly provider;
|
|
8
|
+
private readonly modelsPath;
|
|
9
|
+
private readonly loader?;
|
|
4
10
|
private modelsCache;
|
|
5
11
|
private fetchPromise;
|
|
6
12
|
private fetchPromiseKey;
|
|
7
13
|
private lastFetchTime;
|
|
8
14
|
private cacheKey;
|
|
9
|
-
constructor(provider?: ApiProvider);
|
|
15
|
+
constructor(provider?: ApiProvider, options?: AIManagerOptions);
|
|
10
16
|
getAvailableModels(): Promise<any>;
|
|
11
17
|
private fetchAvailableModels;
|
|
12
18
|
}
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
import { ServerStatusStore } from '../core/server-status';
|
|
2
|
+
import type { IdentityProvider } from '../core/IdentityProvider';
|
|
2
3
|
import type { ApiAuthRequiredHandler, ApiCacheKey, ApiCustomFetch, ApiRequestHeaders } from './types';
|
|
3
4
|
export interface EditorApiConfig {
|
|
4
5
|
baseUrl: string;
|
|
6
|
+
apiPrefix?: string;
|
|
5
7
|
fetchHeaders?: ApiRequestHeaders;
|
|
6
8
|
customFetch?: ApiCustomFetch;
|
|
7
9
|
cacheKey?: ApiCacheKey;
|
|
8
10
|
includeStoredToken?: boolean;
|
|
9
11
|
onAuthRequired?: ApiAuthRequiredHandler;
|
|
10
12
|
serverStatus?: ServerStatusStore;
|
|
13
|
+
identityProvider?: IdentityProvider;
|
|
11
14
|
}
|
|
12
|
-
export declare function
|
|
13
|
-
export declare function
|
|
15
|
+
export declare function normalizeApiPrefix(apiPrefix?: string): string;
|
|
16
|
+
export declare function normalizeApiProviderBaseUrl(baseUrl: string, apiPrefix?: string): string;
|
|
17
|
+
export declare function normalizeApiV1BaseUrl(baseUrl: string, apiPrefix?: string): string;
|
|
14
18
|
export declare class ApiProvider {
|
|
15
19
|
private config;
|
|
16
20
|
private configGeneration;
|
|
21
|
+
private readonly debugClientId;
|
|
17
22
|
private readonly lastAuthNotifyAt;
|
|
18
23
|
constructor(config?: Partial<EditorApiConfig>);
|
|
19
24
|
updateConfig(newConfig: Partial<EditorApiConfig>): void;
|
|
20
25
|
getBaseUrl(): string;
|
|
26
|
+
getApiPrefix(): string;
|
|
21
27
|
isSharedCacheEnabled(): boolean;
|
|
22
28
|
isModelCacheEnabled(): boolean;
|
|
23
29
|
getCacheKey(): string;
|
|
@@ -25,7 +31,14 @@ export declare class ApiProvider {
|
|
|
25
31
|
private isCurrentRequestGeneration;
|
|
26
32
|
private notifyAuthRequired;
|
|
27
33
|
fetchComponents(init?: RequestInit): Promise<unknown>;
|
|
28
|
-
runDebug(chainId: string, data:
|
|
29
|
-
|
|
34
|
+
runDebug(chainId: string, data: unknown, options?: {
|
|
35
|
+
msgType?: string;
|
|
36
|
+
msgId?: string;
|
|
37
|
+
metadata?: Record<string, string>;
|
|
38
|
+
signal?: AbortSignal;
|
|
39
|
+
}): Promise<unknown>;
|
|
40
|
+
getDebugWsUrl(chainId: string, clientId?: string): string;
|
|
30
41
|
}
|
|
31
42
|
export declare const apiProvider: ApiProvider;
|
|
43
|
+
export declare function getToken(): string | null;
|
|
44
|
+
export declare function clearToken(): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type GlobalConfigFetcher, type GlobalConfigPatch, type GlobalConfigReloadResult, type GlobalConfigValues } from '../core/global-config';
|
|
2
|
+
import type { ApiAuthRequiredHandler, ApiCustomFetch, ApiRequestHeaders } from './types';
|
|
3
|
+
export interface GlobalConfigTransportContext {
|
|
4
|
+
opts: {
|
|
5
|
+
apiBase?: string;
|
|
6
|
+
fetchTimeout?: number;
|
|
7
|
+
fetchHeaders?: ApiRequestHeaders;
|
|
8
|
+
customFetch?: ApiCustomFetch;
|
|
9
|
+
allowedApiOrigins?: string[];
|
|
10
|
+
apiCacheKey?: string;
|
|
11
|
+
onApiAuthRequired?: ApiAuthRequiredHandler;
|
|
12
|
+
onAuthExpired?: (response: Response) => void;
|
|
13
|
+
clearToken?: () => void;
|
|
14
|
+
};
|
|
15
|
+
serverStatus?: import('../core/server-status').ServerStatusStore;
|
|
16
|
+
_getTransportGeneration?(): number;
|
|
17
|
+
}
|
|
18
|
+
export declare class GlobalConfigApiError extends Error {
|
|
19
|
+
readonly status: number;
|
|
20
|
+
readonly url: string;
|
|
21
|
+
constructor(message: string, status: number, url: string);
|
|
22
|
+
}
|
|
23
|
+
export declare class GlobalConfigAPI implements GlobalConfigFetcher {
|
|
24
|
+
private readonly editor;
|
|
25
|
+
private readonly requests;
|
|
26
|
+
private destroyed;
|
|
27
|
+
constructor(editor: GlobalConfigTransportContext);
|
|
28
|
+
captureContext(): () => boolean;
|
|
29
|
+
private request;
|
|
30
|
+
getGlobalConfig(signal?: AbortSignal): Promise<GlobalConfigValues>;
|
|
31
|
+
getGlobalOverrides(signal?: AbortSignal): Promise<GlobalConfigValues>;
|
|
32
|
+
updateGlobalConfig(patch: GlobalConfigPatch, signal?: AbortSignal): Promise<GlobalConfigReloadResult>;
|
|
33
|
+
revertGlobalConfigKey(key: string, signal?: AbortSignal): Promise<GlobalConfigReloadResult>;
|
|
34
|
+
destroy(): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ExtendedApiOptions } from './extended-api-shared';
|
|
2
|
+
import { ExtendedApiBase } from './extended-api-shared';
|
|
3
|
+
export interface PointTemplate {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
points: unknown[];
|
|
7
|
+
category?: string;
|
|
8
|
+
protocol?: string;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
export interface PointTemplateListParams {
|
|
12
|
+
protocol?: string;
|
|
13
|
+
category?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface IoTPointTemplateRoutes {
|
|
16
|
+
list: string;
|
|
17
|
+
detail: (id: string) => string;
|
|
18
|
+
create: string;
|
|
19
|
+
update: (id: string) => string;
|
|
20
|
+
remove: (id: string) => string;
|
|
21
|
+
}
|
|
22
|
+
export declare class IoTPointTemplateAPI extends ExtendedApiBase {
|
|
23
|
+
private readonly routes;
|
|
24
|
+
constructor(options: ExtendedApiOptions & {
|
|
25
|
+
routes?: Partial<IoTPointTemplateRoutes>;
|
|
26
|
+
});
|
|
27
|
+
list(params?: PointTemplateListParams): Promise<PointTemplate[]>;
|
|
28
|
+
get(id: string): Promise<PointTemplate>;
|
|
29
|
+
create(template: Omit<PointTemplate, 'id'>): Promise<PointTemplate>;
|
|
30
|
+
update(id: string, template: Partial<PointTemplate>): Promise<void>;
|
|
31
|
+
delete(id: string): Promise<void>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ExtendedApiOptions } from './extended-api-shared';
|
|
2
|
+
import { ExtendedApiBase } from './extended-api-shared';
|
|
3
|
+
export interface MarketplaceComponent {
|
|
4
|
+
type: string;
|
|
5
|
+
label: string;
|
|
6
|
+
desc?: string;
|
|
7
|
+
category?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface MarketplaceChain {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
desc?: string;
|
|
14
|
+
category?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface MarketplaceSearchParams {
|
|
17
|
+
keywords?: string;
|
|
18
|
+
page?: number;
|
|
19
|
+
size?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface MarketplaceChainSearchParams extends MarketplaceSearchParams {
|
|
22
|
+
root?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface MarketplaceRoutes {
|
|
25
|
+
components: string;
|
|
26
|
+
chains: string;
|
|
27
|
+
dynamicComponents: string;
|
|
28
|
+
}
|
|
29
|
+
export declare class MarketplaceAPI extends ExtendedApiBase {
|
|
30
|
+
private readonly routes;
|
|
31
|
+
constructor(options: ExtendedApiOptions & {
|
|
32
|
+
routes?: Partial<MarketplaceRoutes>;
|
|
33
|
+
});
|
|
34
|
+
getComponents(params?: MarketplaceSearchParams): Promise<MarketplaceComponent[]>;
|
|
35
|
+
getChains(params?: MarketplaceChainSearchParams): Promise<MarketplaceChain[]>;
|
|
36
|
+
installComponent(nodeType: string, body: Record<string, unknown>): Promise<unknown>;
|
|
37
|
+
uninstallComponent(nodeType: string): Promise<unknown>;
|
|
38
|
+
getComponentDSL(nodeType: string): Promise<unknown>;
|
|
39
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WorkflowItem, PagedResponse, ApiResult, WorkflowFetcher, SharedNode, SharedNodeFetcher, RuleChainAPIOptions, ListAllResult, RulePatchPreviewResponse, RuleRepairPlanResponse, RuleSchemaDiffResponse, RuleValidateUpstreamResponse, JSONPatchOperation } from './types';
|
|
1
|
+
import type { WorkflowItem, PagedResponse, ApiResult, WorkflowFetcher, SharedNode, SharedNodeFetcher, RuleChainAPIOptions, ListAllResult, RulePatchPreviewResponse, RuleRepairPlanResponse, RuleSchemaDiffResponse, RuleValidateUpstreamResponse, JSONPatchOperation, RuleMessageBody, RunsListOptions, RunRecord, ComponentDSL, RuleListOptions } from './types';
|
|
2
2
|
export declare class RuleChainApiError extends Error {
|
|
3
3
|
readonly status: number;
|
|
4
4
|
readonly url: string;
|
|
@@ -8,6 +8,7 @@ export declare class RuleChainAPI implements WorkflowFetcher, SharedNodeFetcher
|
|
|
8
8
|
private apiBase;
|
|
9
9
|
private timeout;
|
|
10
10
|
private headers;
|
|
11
|
+
private authToken?;
|
|
11
12
|
private customFetch?;
|
|
12
13
|
private credentials?;
|
|
13
14
|
private onAuthRequired?;
|
|
@@ -24,19 +25,21 @@ export declare class RuleChainAPI implements WorkflowFetcher, SharedNodeFetcher
|
|
|
24
25
|
private resolveSharedNodePath;
|
|
25
26
|
static parseRuleChain(raw: unknown): WorkflowItem;
|
|
26
27
|
static generateChainId(): string;
|
|
27
|
-
list(page?: number, size?: number, keywords?: string): Promise<PagedResponse<WorkflowItem>>;
|
|
28
|
+
list(page?: number, size?: number, keywords?: string, signal?: AbortSignal): Promise<PagedResponse<WorkflowItem>>;
|
|
28
29
|
listAll(size?: number, keywords?: string, maxPages?: number): Promise<WorkflowItem[]>;
|
|
29
30
|
listAllDetailed(size?: number, keywords?: string, maxPages?: number): Promise<ListAllResult<WorkflowItem>>;
|
|
30
31
|
getSharedNodes(keywords?: string, page?: number, size?: number, type?: string, signal?: AbortSignal): Promise<PagedResponse<SharedNode>>;
|
|
31
32
|
getSharedNode(id: string, type: string, signal?: AbortSignal): Promise<SharedNode>;
|
|
32
33
|
saveSharedNode<TResponse = unknown>(id: string, type: string, body: SharedNode, signal?: AbortSignal): Promise<TResponse>;
|
|
33
34
|
deleteSharedNode<TResponse = unknown>(id: string, type: string, signal?: AbortSignal): Promise<TResponse>;
|
|
34
|
-
create(data: Record<string, unknown
|
|
35
|
+
create(data: Record<string, unknown>, options?: {
|
|
36
|
+
draft?: boolean;
|
|
37
|
+
}): Promise<ApiResult>;
|
|
35
38
|
remove(id: string): Promise<ApiResult>;
|
|
36
39
|
operate(id: string, type: 'start' | 'stop'): Promise<ApiResult>;
|
|
37
40
|
restart(id: string): Promise<ApiResult>;
|
|
38
41
|
copy(id: string, newName?: string): Promise<ApiResult>;
|
|
39
|
-
getContent(id: string): Promise<Record<string, unknown>>;
|
|
42
|
+
getContent(id: string, signal?: AbortSignal): Promise<Record<string, unknown>>;
|
|
40
43
|
getChainStatuses(id: string, signal?: AbortSignal): Promise<unknown>;
|
|
41
44
|
getSharedNodeStatuses(signal?: AbortSignal): Promise<unknown>;
|
|
42
45
|
saveBaseInfo(id: string, info: Record<string, unknown>): Promise<ApiResult>;
|
|
@@ -45,5 +48,21 @@ export declare class RuleChainAPI implements WorkflowFetcher, SharedNodeFetcher
|
|
|
45
48
|
getSchemaDiff(id: string): Promise<RuleSchemaDiffResponse>;
|
|
46
49
|
getRepairPlan(id: string, dsl: Record<string, unknown>, options?: Record<string, unknown>): Promise<RuleRepairPlanResponse>;
|
|
47
50
|
previewPatch(id: string, dsl: Record<string, unknown>, operations: JSONPatchOperation[]): Promise<RulePatchPreviewResponse>;
|
|
51
|
+
notifyRule(chainId: string, msgType: string, body?: RuleMessageBody): Promise<void>;
|
|
52
|
+
executeRule(chainId: string, msgType: string, body?: RuleMessageBody): Promise<unknown>;
|
|
53
|
+
listFiltered(options?: RuleListOptions, signal?: AbortSignal): Promise<PagedResponse<WorkflowItem>>;
|
|
54
|
+
getRuleCategories(signal?: AbortSignal): Promise<string[]>;
|
|
55
|
+
getDebugData(chainId: string, nodeId?: string, page?: number, size?: number, signal?: AbortSignal): Promise<unknown[]>;
|
|
56
|
+
getRunsList(chainId: string, options?: RunsListOptions, signal?: AbortSignal): Promise<PagedResponse<RunRecord>>;
|
|
57
|
+
getRuns(chainId: string, id: string, signal?: AbortSignal): Promise<RunRecord>;
|
|
58
|
+
deleteRuns(chainId: string, ids?: string | string[], signal?: AbortSignal): Promise<void>;
|
|
59
|
+
getComponentDSL(nodeType: string, signal?: AbortSignal): Promise<ComponentDSL>;
|
|
60
|
+
installComponent(nodeType: string, dsl: ComponentDSL, signal?: AbortSignal): Promise<void>;
|
|
61
|
+
uninstallComponent(nodeType: string, signal?: AbortSignal): Promise<void>;
|
|
62
|
+
queryDynamicBuiltin(name: string, params?: Record<string, unknown>, signal?: AbortSignal): Promise<unknown>;
|
|
48
63
|
getApiBase(): string;
|
|
64
|
+
getLocales(lang?: string): Promise<Record<string, string>>;
|
|
65
|
+
getLocalesCached(lang?: string): Promise<Record<string, string>>;
|
|
66
|
+
static readonly RULE_CHAIN_ASSISTANT_ID = "_assistant";
|
|
67
|
+
getChatCompletionsUrl(chainId?: string): string;
|
|
49
68
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { RuleChainAPIOptions } from './types';
|
|
2
|
+
import { type RuleChainVersionDetail, type RuleChainVersionPage, type RuleChainVersionsFetcher } from '../core/rule-chain-versions';
|
|
3
|
+
import type { RuleChainData } from '../types/rule-chain';
|
|
4
|
+
export interface RuleChainVersionRoutes {
|
|
5
|
+
list: (chainId: string) => string;
|
|
6
|
+
detail: (chainId: string, versionId: string) => string;
|
|
7
|
+
rollback: (chainId: string, versionId: string) => string;
|
|
8
|
+
}
|
|
9
|
+
export interface RuleChainVersionsAPIOptions extends RuleChainAPIOptions {
|
|
10
|
+
versionRoutes?: Partial<RuleChainVersionRoutes>;
|
|
11
|
+
}
|
|
12
|
+
export declare class RuleChainVersionsAPI implements RuleChainVersionsFetcher {
|
|
13
|
+
private readonly options;
|
|
14
|
+
private readonly requests;
|
|
15
|
+
private destroyed;
|
|
16
|
+
private lastAuthNotifyAt;
|
|
17
|
+
constructor(options: RuleChainVersionsAPIOptions | (() => RuleChainVersionsAPIOptions));
|
|
18
|
+
private config;
|
|
19
|
+
private getHeaders;
|
|
20
|
+
private contentPath;
|
|
21
|
+
private versionPath;
|
|
22
|
+
private request;
|
|
23
|
+
getRuleVersions(chainId: string, page?: number, size?: number, signal?: AbortSignal): Promise<RuleChainVersionPage>;
|
|
24
|
+
getRuleVersion(chainId: string, versionId: string, signal?: AbortSignal): Promise<RuleChainVersionDetail>;
|
|
25
|
+
rollbackRuleVersion(chainId: string, versionId: string, signal?: AbortSignal): Promise<unknown>;
|
|
26
|
+
getContent(chainId: string, signal?: AbortSignal): Promise<RuleChainData>;
|
|
27
|
+
destroy(): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ExtendedApiOptions } from './extended-api-shared';
|
|
2
|
+
import { ExtendedApiBase } from './extended-api-shared';
|
|
3
|
+
export interface SkillItem {
|
|
4
|
+
name: string;
|
|
5
|
+
desc?: string;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
version?: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface SkillsRoutes {
|
|
11
|
+
list: string;
|
|
12
|
+
detail: (name: string) => string;
|
|
13
|
+
create: string;
|
|
14
|
+
update: (name: string) => string;
|
|
15
|
+
remove: (name: string) => string;
|
|
16
|
+
upload: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class SkillsAPI extends ExtendedApiBase {
|
|
19
|
+
private readonly routes;
|
|
20
|
+
constructor(options: ExtendedApiOptions & {
|
|
21
|
+
routes?: Partial<SkillsRoutes>;
|
|
22
|
+
});
|
|
23
|
+
list(scope?: string): Promise<SkillItem[]>;
|
|
24
|
+
getDetail(name: string, scope?: string): Promise<unknown>;
|
|
25
|
+
create(payload: Record<string, unknown>): Promise<void>;
|
|
26
|
+
update(name: string, payload: Record<string, unknown>): Promise<void>;
|
|
27
|
+
delete(name: string, scope?: string): Promise<void>;
|
|
28
|
+
upload(file: Blob, scope?: string): Promise<{
|
|
29
|
+
name: string;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ExtendedApiOptions } from './extended-api-shared';
|
|
2
|
+
import { ExtendedApiBase } from './extended-api-shared';
|
|
3
|
+
export interface UserInfo {
|
|
4
|
+
username: string;
|
|
5
|
+
role?: string;
|
|
6
|
+
roles?: string[];
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface LoginResult {
|
|
11
|
+
token: string;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface RuleCategory {
|
|
15
|
+
id?: string;
|
|
16
|
+
name: string;
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}
|
|
19
|
+
export interface UserRoutes {
|
|
20
|
+
login: string;
|
|
21
|
+
currentUser: string;
|
|
22
|
+
users: string;
|
|
23
|
+
deleteUser: (username: string) => string;
|
|
24
|
+
ruleCategories: string;
|
|
25
|
+
}
|
|
26
|
+
export declare class UserAPI extends ExtendedApiBase {
|
|
27
|
+
private readonly routes;
|
|
28
|
+
constructor(options: ExtendedApiOptions & {
|
|
29
|
+
routes?: Partial<UserRoutes>;
|
|
30
|
+
});
|
|
31
|
+
login(username: string, password: string): Promise<LoginResult>;
|
|
32
|
+
getCurrentUser(): Promise<UserInfo>;
|
|
33
|
+
getUsers(): Promise<UserInfo[]>;
|
|
34
|
+
saveUser(user: UserInfo & {
|
|
35
|
+
password?: string;
|
|
36
|
+
}): Promise<void>;
|
|
37
|
+
deleteUser(username: string, purge?: boolean): Promise<void>;
|
|
38
|
+
getRuleCategories(): Promise<RuleCategory[]>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ExtendedApiOptions {
|
|
2
|
+
apiBase: string;
|
|
3
|
+
timeout?: number;
|
|
4
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
5
|
+
authToken?: string;
|
|
6
|
+
customFetch?: (url: string, init?: RequestInit) => Promise<Response>;
|
|
7
|
+
credentials?: RequestCredentials;
|
|
8
|
+
}
|
|
9
|
+
export declare class ExtendedApiError extends Error {
|
|
10
|
+
readonly status: number;
|
|
11
|
+
readonly url: string;
|
|
12
|
+
constructor(message: string, status: number, url: string);
|
|
13
|
+
}
|
|
14
|
+
export declare class ExtendedApiBase {
|
|
15
|
+
protected readonly apiBase: string;
|
|
16
|
+
private readonly timeout;
|
|
17
|
+
private readonly headerSource;
|
|
18
|
+
private readonly authToken?;
|
|
19
|
+
private readonly fetchImpl?;
|
|
20
|
+
private readonly credentials?;
|
|
21
|
+
constructor(options: ExtendedApiOptions);
|
|
22
|
+
private getHeaders;
|
|
23
|
+
protected request<T = unknown>(path: string, init?: RequestInit): Promise<T>;
|
|
24
|
+
getApiBase(): string;
|
|
25
|
+
}
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
export { RuleChainAPI, RuleChainApiError } from './RuleChainAPI';
|
|
2
|
+
export { RuleChainVersionsAPI } from './RuleChainVersionsAPI';
|
|
3
|
+
export type { RuleChainVersionsAPIOptions, RuleChainVersionRoutes } from './RuleChainVersionsAPI';
|
|
4
|
+
export { GlobalConfigAPI, GlobalConfigApiError } from './GlobalConfigAPI';
|
|
5
|
+
export type { GlobalConfigTransportContext } from './GlobalConfigAPI';
|
|
2
6
|
export { normalizePagedResponse, unwrapApiEnvelope } from './response-utils';
|
|
3
7
|
export { DEFAULT_ROUTES } from './types';
|
|
4
|
-
export type { WorkflowItem, PagedResponse, ListAllResult, ApiResult, SharedNode, SharedNodeFetcher, WorkflowFetcher, RuleChainAPIOptions, RuleChainRoutes, WorkflowListIcons, WorkflowInfoIcons, WorkflowTheme, RuleMaintenanceSeverity, RuleMaintenanceCategory, RuleMaintenanceIssue, RuleMaintenanceRuntimeInfo, RuleValidateUpstreamRequest, RuleValidateUpstreamResponse, RuleSchemaDiffResponse, RuleRepairPlanResponse, JSONPatchOperation, RulePatchPreviewResponse, ApiAuthRequiredDetails, ApiAuthRequiredHandler, ApiCacheKey, } from './types';
|
|
5
|
-
export { ApiProvider, apiProvider, normalizeApiProviderBaseUrl, normalizeApiV1BaseUrl, type EditorApiConfig } from './ApiProvider';
|
|
8
|
+
export type { WorkflowItem, PagedResponse, ListAllResult, ApiResult, SharedNode, SharedNodeFetcher, WorkflowFetcher, RuleChainAPIOptions, RuleChainRoutes, WorkflowListIcons, WorkflowInfoIcons, WorkflowTheme, RuleMaintenanceSeverity, RuleMaintenanceCategory, RuleMaintenanceIssue, RuleMaintenanceRuntimeInfo, RuleValidateUpstreamRequest, RuleValidateUpstreamResponse, RuleSchemaDiffResponse, RuleRepairPlanResponse, JSONPatchOperation, RulePatchPreviewResponse, ApiAuthRequiredDetails, ApiAuthRequiredHandler, ApiRequestHeaders, ApiCustomFetch, ApiCacheKey, RuleMessageBody, RuleMessageMetadata, RunsListOptions, RunRecord, ComponentDSL, RuleListOptions, } from './types';
|
|
9
|
+
export { ApiProvider, apiProvider, getToken, clearToken, normalizeApiPrefix, normalizeApiProviderBaseUrl, normalizeApiV1BaseUrl, type EditorApiConfig } from './ApiProvider';
|
|
6
10
|
export { ComponentCatalogCache, componentCatalogCache, type ComponentCatalogCacheOptions, type ComponentCatalogLoadOptions, } from './ComponentCatalogCache';
|
|
7
11
|
export { AIManager, aiManager } from './AIManager';
|
|
12
|
+
export type { AIManagerOptions } from './AIManager';
|
|
8
13
|
export { DebugSocketClient } from './DebugSocketClient';
|
|
9
14
|
export type { DebugSocketClientOptions } from './DebugSocketClient';
|
|
15
|
+
export { ExtendedApiBase, ExtendedApiError } from './extended-api-shared';
|
|
16
|
+
export type { ExtendedApiOptions } from './extended-api-shared';
|
|
17
|
+
export { MarketplaceAPI } from './MarketplaceAPI';
|
|
18
|
+
export type { MarketplaceComponent, MarketplaceChain, MarketplaceSearchParams, MarketplaceChainSearchParams, MarketplaceRoutes, } from './MarketplaceAPI';
|
|
19
|
+
export { AIAssistantAPI, AI_ASSISTANT_DEFAULT_AGENT_ID } from './AIAssistantAPI';
|
|
20
|
+
export type { AIAssistantSettings, AIAssistantModelConfig, AIAssistantRoutes, } from './AIAssistantAPI';
|
|
21
|
+
export { SkillsAPI } from './SkillsAPI';
|
|
22
|
+
export type { SkillItem, SkillsRoutes } from './SkillsAPI';
|
|
23
|
+
export { IoTPointTemplateAPI } from './IoTPointTemplateAPI';
|
|
24
|
+
export type { PointTemplate, PointTemplateListParams, IoTPointTemplateRoutes, } from './IoTPointTemplateAPI';
|
|
25
|
+
export { UserAPI } from './UserAPI';
|
|
26
|
+
export type { UserInfo, LoginResult, RuleCategory, UserRoutes } from './UserAPI';
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type * as Root from '../index';
|
|
2
|
+
import type * as Api from './index';
|
|
3
|
+
type Assert<T extends true> = T;
|
|
4
|
+
type Equal<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? true : false;
|
|
5
|
+
type RequiredKeys<T> = {
|
|
6
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? never : K;
|
|
7
|
+
}[keyof T];
|
|
8
|
+
type LegacyMethods = 'list' | 'create' | 'remove' | 'operate' | 'copy' | 'getContent' | 'saveBaseInfo' | 'saveConfig';
|
|
9
|
+
type LegacyHost = Omit<Pick<Root.WorkflowFetcher, LegacyMethods>, 'list' | 'getContent'> & {
|
|
10
|
+
list: (page: number, size: number, keywords: string) => Promise<Root.PagedResponse<Root.WorkflowItem>>;
|
|
11
|
+
getContent: (id: string) => Promise<Record<string, unknown>>;
|
|
12
|
+
};
|
|
13
|
+
type LegacySharedHost = {
|
|
14
|
+
getSharedNodes: (keywords: string, page: number, size: number, type?: string) => Promise<Root.PagedResponse<Root.SharedNode>>;
|
|
15
|
+
getSharedNode: (id: string, type: string) => Promise<Root.SharedNode>;
|
|
16
|
+
saveSharedNode: (id: string, type: string, body: Root.SharedNode) => Promise<unknown>;
|
|
17
|
+
deleteSharedNode: (id: string, type: string) => Promise<unknown>;
|
|
18
|
+
};
|
|
19
|
+
type OptionalMethods = 'notifyRule' | 'executeRule' | 'listFiltered' | 'getRuleCategories' | 'getDebugData' | 'getRunsList' | 'getRuns' | 'deleteRuns' | 'getComponentDSL' | 'installComponent' | 'uninstallComponent' | 'queryDynamicBuiltin';
|
|
20
|
+
type MethodMatches = {
|
|
21
|
+
[K in OptionalMethods]: Equal<NonNullable<Root.WorkflowFetcher[K]>, Root.RuleChainAPI[K]>;
|
|
22
|
+
};
|
|
23
|
+
export type BackwardCompatibleFetcher = Assert<Equal<RequiredKeys<Root.WorkflowFetcher>, LegacyMethods>>;
|
|
24
|
+
export type MinimalHostStillWorks = Assert<LegacyHost extends Root.WorkflowFetcher ? true : false>;
|
|
25
|
+
export type LegacySharedHostStillWorks = Assert<LegacySharedHost extends Root.SharedNodeFetcher ? true : false>;
|
|
26
|
+
export type ImplementationIsSharedFetcher = Assert<Root.RuleChainAPI extends Root.SharedNodeFetcher ? true : false>;
|
|
27
|
+
export type SharedListSignal = Assert<Equal<Parameters<Root.SharedNodeFetcher['getSharedNodes']>, [string, number, number, string?, AbortSignal?]>>;
|
|
28
|
+
export type SharedGetSignal = Assert<Equal<Parameters<Root.SharedNodeFetcher['getSharedNode']>, [string, string, AbortSignal?]>>;
|
|
29
|
+
export type SharedSaveSignal = Assert<Equal<Parameters<Root.SharedNodeFetcher['saveSharedNode']>, [string, string, Root.SharedNode, AbortSignal?]>>;
|
|
30
|
+
export type SharedDeleteSignal = Assert<Equal<Parameters<Root.SharedNodeFetcher['deleteSharedNode']>, [string, string, AbortSignal?]>>;
|
|
31
|
+
export type HostListSignal = Assert<Equal<Parameters<Root.WorkflowFetcher['list']>, [number, number, string, AbortSignal?]>>;
|
|
32
|
+
export type ApiListSignal = Assert<Equal<Parameters<Root.RuleChainAPI['list']>, [number?, number?, string?, AbortSignal?]>>;
|
|
33
|
+
export type HostContentSignal = Assert<Equal<Parameters<Root.WorkflowFetcher['getContent']>, [string, AbortSignal?]>>;
|
|
34
|
+
export type ContentMatchesImplementation = Assert<Equal<Root.WorkflowFetcher['getContent'], Root.RuleChainAPI['getContent']>>;
|
|
35
|
+
export type MethodsMatchImplementation = Assert<Equal<MethodMatches[OptionalMethods], true>>;
|
|
36
|
+
export type ImplementationIsFetcher = Assert<Root.RuleChainAPI extends Root.WorkflowFetcher ? true : false>;
|
|
37
|
+
export type DefaultRoutesAreCallable = Assert<Equal<Exclude<'notifyRule' | 'executeRule' | 'ruleCategories' | 'debugData' | 'runsList' | 'dynamicComponent' | 'queryDynamicBuiltin', RequiredKeys<typeof Root.DEFAULT_ROUTES>>, never>>;
|
|
38
|
+
export type RootAndApiTypesMatch = Assert<Equal<[
|
|
39
|
+
Root.WorkflowFetcher,
|
|
40
|
+
Root.RuleChainRoutes,
|
|
41
|
+
Root.RuleChainAPIOptions,
|
|
42
|
+
Root.RuleMessageBody,
|
|
43
|
+
Root.RuleMessageMetadata,
|
|
44
|
+
Root.RuleListOptions,
|
|
45
|
+
Root.RunsListOptions,
|
|
46
|
+
Root.RunRecord,
|
|
47
|
+
Root.ComponentDSL,
|
|
48
|
+
Root.ApiRequestHeaders,
|
|
49
|
+
Root.ApiCustomFetch,
|
|
50
|
+
Root.SharedNodeFetcher,
|
|
51
|
+
Root.GlobalConfigTransportContext,
|
|
52
|
+
Root.RuleChainVersionsAPIOptions,
|
|
53
|
+
Root.RuleChainVersionRoutes
|
|
54
|
+
], [
|
|
55
|
+
Api.WorkflowFetcher,
|
|
56
|
+
Api.RuleChainRoutes,
|
|
57
|
+
Api.RuleChainAPIOptions,
|
|
58
|
+
Api.RuleMessageBody,
|
|
59
|
+
Api.RuleMessageMetadata,
|
|
60
|
+
Api.RuleListOptions,
|
|
61
|
+
Api.RunsListOptions,
|
|
62
|
+
Api.RunRecord,
|
|
63
|
+
Api.ComponentDSL,
|
|
64
|
+
Api.ApiRequestHeaders,
|
|
65
|
+
Api.ApiCustomFetch,
|
|
66
|
+
Api.SharedNodeFetcher,
|
|
67
|
+
Api.GlobalConfigTransportContext,
|
|
68
|
+
Api.RuleChainVersionsAPIOptions,
|
|
69
|
+
Api.RuleChainVersionRoutes
|
|
70
|
+
]>>;
|
|
71
|
+
export type RootAndApiValuesMatch = Assert<Equal<[
|
|
72
|
+
typeof Root.RuleChainAPI,
|
|
73
|
+
typeof Root.RuleChainApiError,
|
|
74
|
+
typeof Root.DEFAULT_ROUTES,
|
|
75
|
+
typeof Root.GlobalConfigAPI,
|
|
76
|
+
typeof Root.GlobalConfigApiError,
|
|
77
|
+
typeof Root.RuleChainVersionsAPI
|
|
78
|
+
], [
|
|
79
|
+
typeof Api.RuleChainAPI,
|
|
80
|
+
typeof Api.RuleChainApiError,
|
|
81
|
+
typeof Api.DEFAULT_ROUTES,
|
|
82
|
+
typeof Api.GlobalConfigAPI,
|
|
83
|
+
typeof Api.GlobalConfigApiError,
|
|
84
|
+
typeof Api.RuleChainVersionsAPI
|
|
85
|
+
]>>;
|
|
86
|
+
export type ConfigIsTransport = Assert<Equal<NonNullable<Root.RuleMessageBody['config']>, Omit<RequestInit, 'method' | 'body'>>>;
|
|
87
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare function unwrapApiEnvelope<T = unknown>(raw: unknown): T;
|
|
2
2
|
export declare function normalizePagedResponse<T>(raw: unknown, mapItem: (item: unknown) => T, fallbackPage?: number, fallbackPageSize?: number, options?: {
|
|
3
3
|
includeMetadata?: boolean;
|
|
4
|
+
strict?: boolean;
|
|
4
5
|
}): {
|
|
5
6
|
items: T[];
|
|
6
7
|
total: number;
|