@proteos/sdk 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +40 -0
- package/dist/chunk-7RGN4E22.cjs +1185 -0
- package/dist/chunk-7RGN4E22.cjs.map +1 -0
- package/dist/chunk-XJP5WCRZ.js +1125 -0
- package/dist/chunk-XJP5WCRZ.js.map +1 -0
- package/dist/index.cjs +2384 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +5225 -0
- package/dist/index.d.ts +5225 -0
- package/dist/index.js +2146 -0
- package/dist/index.js.map +1 -0
- package/dist/meta/index.cjs +204 -0
- package/dist/meta/index.cjs.map +1 -0
- package/dist/meta/index.d.cts +2 -0
- package/dist/meta/index.d.ts +2 -0
- package/dist/meta/index.js +3 -0
- package/dist/meta/index.js.map +1 -0
- package/dist/types-BNsjfU8N.d.cts +3299 -0
- package/dist/types-BNsjfU8N.d.ts +3299 -0
- package/package.json +86 -0
- package/src/agent/agents.ts +53 -0
- package/src/agent/index.ts +134 -0
- package/src/agent/mcp-servers.ts +102 -0
- package/src/agent/prompts.ts +80 -0
- package/src/agent/session-types.ts +397 -0
- package/src/agent/sessions.ts +197 -0
- package/src/agent/skills.ts +89 -0
- package/src/agent/tools.ts +53 -0
- package/src/agent/types.ts +362 -0
- package/src/auth/index.ts +111 -0
- package/src/auth/me.ts +46 -0
- package/src/auth/organizations.ts +128 -0
- package/src/auth/platform-entities.ts +78 -0
- package/src/auth/roles.ts +213 -0
- package/src/auth/types.ts +294 -0
- package/src/auth/users.ts +226 -0
- package/src/client.ts +441 -0
- package/src/connector/index.ts +120 -0
- package/src/connector/types.ts +150 -0
- package/src/conversation/index.ts +297 -0
- package/src/conversation/types.ts +590 -0
- package/src/conversation/voice.ts +123 -0
- package/src/data/index.ts +53 -0
- package/src/data/queries.ts +66 -0
- package/src/data/records.ts +122 -0
- package/src/data/types.ts +89 -0
- package/src/errors.ts +148 -0
- package/src/events/index.ts +172 -0
- package/src/events/types.ts +77 -0
- package/src/functions/actions.ts +95 -0
- package/src/functions/index.ts +32 -0
- package/src/functions/types.ts +71 -0
- package/src/http/index.ts +2 -0
- package/src/http/query-params.ts +106 -0
- package/src/index.ts +598 -0
- package/src/iterator.ts +183 -0
- package/src/knowledge/graph.ts +35 -0
- package/src/knowledge/index.ts +104 -0
- package/src/knowledge/labels.ts +70 -0
- package/src/knowledge/links.ts +65 -0
- package/src/knowledge/nodes.ts +198 -0
- package/src/knowledge/record-links.ts +66 -0
- package/src/knowledge/types.ts +569 -0
- package/src/meta/apps.ts +107 -0
- package/src/meta/components.ts +124 -0
- package/src/meta/currency/index.ts +202 -0
- package/src/meta/entities.ts +193 -0
- package/src/meta/filters.ts +76 -0
- package/src/meta/index.ts +227 -0
- package/src/meta/layout/common-props.ts +93 -0
- package/src/meta/layout/control-registry.json +70 -0
- package/src/meta/layout/control-registry.ts +92 -0
- package/src/meta/layout/elements.ts +203 -0
- package/src/meta/layout/index.ts +41 -0
- package/src/meta/layout/page-layout.ts +35 -0
- package/src/meta/layout/size-value.ts +27 -0
- package/src/meta/list-views.ts +109 -0
- package/src/meta/lists.ts +104 -0
- package/src/meta/menu-configurations.ts +128 -0
- package/src/meta/modules.ts +159 -0
- package/src/meta/pages.ts +106 -0
- package/src/meta/types.ts +1115 -0
- package/src/meta/variables.ts +98 -0
- package/src/storage/files.ts +183 -0
- package/src/storage/index.ts +33 -0
- package/src/storage/types.ts +70 -0
- package/src/types/common.ts +143 -0
- package/src/types/index.ts +28 -0
- package/src/types/options.ts +95 -0
- package/src/workflow/executions.ts +99 -0
- package/src/workflow/index.ts +109 -0
- package/src/workflow/node-types.ts +50 -0
- package/src/workflow/types.ts +658 -0
- package/src/workflow/workflows.ts +152 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { ProteosClient } from '../client.js'
|
|
2
|
+
import { PageIterator } from '../iterator.js'
|
|
3
|
+
import type { ListOptions, ListResult } from '../types/common.js'
|
|
4
|
+
import type {
|
|
5
|
+
CreateWorkflowRequest,
|
|
6
|
+
ListWorkflowsOptions,
|
|
7
|
+
RunWorkflowRequest,
|
|
8
|
+
TestNodeRequest,
|
|
9
|
+
TestNodeResponse,
|
|
10
|
+
UpdateWorkflowRequest,
|
|
11
|
+
Workflow,
|
|
12
|
+
WorkflowExecution,
|
|
13
|
+
WorkflowVersion,
|
|
14
|
+
WorkflowVersionSummary,
|
|
15
|
+
} from './types.js'
|
|
16
|
+
|
|
17
|
+
const WORKFLOWS_BASE_PATH = '/workflows/v1/workflows'
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Service for managing Workflows — n8n-shaped automation definitions keyed by an
|
|
21
|
+
* immutable kebab-case `key`. Run/pause/unpause drive the Temporal-backed runtime.
|
|
22
|
+
*/
|
|
23
|
+
export interface WorkflowService {
|
|
24
|
+
/** Lists workflows, auto-paginating. */
|
|
25
|
+
list(options?: ListWorkflowsOptions): PageIterator<Workflow, ListWorkflowsOptions>
|
|
26
|
+
/** Fetches a single page of workflows with pagination metadata. */
|
|
27
|
+
listPage(options?: ListWorkflowsOptions): Promise<ListResult<Workflow>>
|
|
28
|
+
/** Gets a single workflow by key. @throws {ProteosError} 404 if not found. */
|
|
29
|
+
get(key: string): Promise<Workflow>
|
|
30
|
+
/** Creates a new workflow. @throws {ProteosError} 400/409. */
|
|
31
|
+
create(request: CreateWorkflowRequest): Promise<Workflow>
|
|
32
|
+
/** Fully replaces a workflow's metadata + graph (version bumped server-side). */
|
|
33
|
+
update(key: string, request: UpdateWorkflowRequest): Promise<Workflow>
|
|
34
|
+
/** Deletes a workflow. @throws {ProteosError} 404 if not found. */
|
|
35
|
+
delete(key: string): Promise<void>
|
|
36
|
+
/**
|
|
37
|
+
* Triggers one manual run; returns the pending execution. Pass
|
|
38
|
+
* `destination_node_id` for a partial "run until here" execution (only the
|
|
39
|
+
* destination's ancestors run).
|
|
40
|
+
*/
|
|
41
|
+
run(key: string, request?: RunWorkflowRequest): Promise<WorkflowExecution>
|
|
42
|
+
/**
|
|
43
|
+
* Runs ONE node ephemerally against its last-known (or pinned) input and
|
|
44
|
+
* blocks for the result — the editor's "Run this node". No execution rows
|
|
45
|
+
* are written; side effects are real.
|
|
46
|
+
*/
|
|
47
|
+
testNode(key: string, nodeId: string, request: TestNodeRequest): Promise<TestNodeResponse>
|
|
48
|
+
/** Pauses scheduled/triggered firings. */
|
|
49
|
+
pause(key: string): Promise<Workflow>
|
|
50
|
+
/** Resumes a paused workflow. */
|
|
51
|
+
unpause(key: string): Promise<Workflow>
|
|
52
|
+
/** Lists a workflow's version history (newest first), auto-paginating. */
|
|
53
|
+
listVersions(
|
|
54
|
+
key: string,
|
|
55
|
+
options?: ListOptions,
|
|
56
|
+
): PageIterator<WorkflowVersionSummary, ListOptions>
|
|
57
|
+
/** Fetches a single page of a workflow's version history (newest first). */
|
|
58
|
+
listVersionsPage(key: string, options?: ListOptions): Promise<ListResult<WorkflowVersionSummary>>
|
|
59
|
+
/** Gets one immutable version of a workflow, graph included. @throws {ProteosError} 404. */
|
|
60
|
+
getVersion(key: string, version: number): Promise<WorkflowVersion>
|
|
61
|
+
/**
|
|
62
|
+
* Restores an old version by saving its graph as a NEW bumped version;
|
|
63
|
+
* returns the updated workflow (its `.version` is the new current version).
|
|
64
|
+
* @throws {ProteosError} 400 when restoring the current version.
|
|
65
|
+
*/
|
|
66
|
+
restoreVersion(key: string, version: number): Promise<Workflow>
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export class WorkflowServiceImpl implements WorkflowService {
|
|
70
|
+
constructor(private readonly client: ProteosClient) {}
|
|
71
|
+
|
|
72
|
+
list(options: ListWorkflowsOptions = {}): PageIterator<Workflow, ListWorkflowsOptions> {
|
|
73
|
+
return new PageIterator((opts) => this.listPage(opts), options)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async listPage(options: ListWorkflowsOptions = {}): Promise<ListResult<Workflow>> {
|
|
77
|
+
return this.client.requestWithQuery<ListResult<Workflow>>('GET', WORKFLOWS_BASE_PATH, options)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async get(key: string): Promise<Workflow> {
|
|
81
|
+
return this.client.request<Workflow>('GET', `${WORKFLOWS_BASE_PATH}/${key}`)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async create(request: CreateWorkflowRequest): Promise<Workflow> {
|
|
85
|
+
return this.client.request<Workflow>('POST', WORKFLOWS_BASE_PATH, request)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async update(key: string, request: UpdateWorkflowRequest): Promise<Workflow> {
|
|
89
|
+
return this.client.request<Workflow>('PATCH', `${WORKFLOWS_BASE_PATH}/${key}`, request)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async delete(key: string): Promise<void> {
|
|
93
|
+
await this.client.request<void>('DELETE', `${WORKFLOWS_BASE_PATH}/${key}`)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async run(key: string, request: RunWorkflowRequest = {}): Promise<WorkflowExecution> {
|
|
97
|
+
return this.client.request<WorkflowExecution>(
|
|
98
|
+
'POST',
|
|
99
|
+
`${WORKFLOWS_BASE_PATH}/${key}/run`,
|
|
100
|
+
request,
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async testNode(key: string, nodeId: string, request: TestNodeRequest): Promise<TestNodeResponse> {
|
|
105
|
+
return this.client.request<TestNodeResponse>(
|
|
106
|
+
'POST',
|
|
107
|
+
`${WORKFLOWS_BASE_PATH}/${key}/nodes/${nodeId}/test`,
|
|
108
|
+
request,
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async pause(key: string): Promise<Workflow> {
|
|
113
|
+
return this.client.request<Workflow>('POST', `${WORKFLOWS_BASE_PATH}/${key}/pause`, {})
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async unpause(key: string): Promise<Workflow> {
|
|
117
|
+
return this.client.request<Workflow>('POST', `${WORKFLOWS_BASE_PATH}/${key}/unpause`, {})
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
listVersions(
|
|
121
|
+
key: string,
|
|
122
|
+
options: ListOptions = {},
|
|
123
|
+
): PageIterator<WorkflowVersionSummary, ListOptions> {
|
|
124
|
+
return new PageIterator((opts) => this.listVersionsPage(key, opts), options)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async listVersionsPage(
|
|
128
|
+
key: string,
|
|
129
|
+
options: ListOptions = {},
|
|
130
|
+
): Promise<ListResult<WorkflowVersionSummary>> {
|
|
131
|
+
return this.client.requestWithQuery<ListResult<WorkflowVersionSummary>>(
|
|
132
|
+
'GET',
|
|
133
|
+
`${WORKFLOWS_BASE_PATH}/${key}/versions`,
|
|
134
|
+
options,
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async getVersion(key: string, version: number): Promise<WorkflowVersion> {
|
|
139
|
+
return this.client.request<WorkflowVersion>(
|
|
140
|
+
'GET',
|
|
141
|
+
`${WORKFLOWS_BASE_PATH}/${key}/versions/${version}`,
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async restoreVersion(key: string, version: number): Promise<Workflow> {
|
|
146
|
+
return this.client.request<Workflow>(
|
|
147
|
+
'POST',
|
|
148
|
+
`${WORKFLOWS_BASE_PATH}/${key}/versions/${version}/restore`,
|
|
149
|
+
{},
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
}
|