@rolealpha/n8n-nodes-rolealpha 0.8.0 → 0.9.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 +97 -21
- package/dist/lib/changes.d.ts +8 -0
- package/dist/lib/changes.js +19 -1
- package/dist/lib/changes.js.map +1 -1
- package/dist/lib/codeCheck.d.ts +27 -0
- package/dist/lib/codeCheck.js +381 -0
- package/dist/lib/codeCheck.js.map +1 -0
- package/dist/lib/templates.d.ts +41 -0
- package/dist/lib/templates.js +96 -0
- package/dist/lib/templates.js.map +1 -0
- package/dist/lib/workflows.d.ts +73 -2
- package/dist/lib/workflows.js +357 -13
- package/dist/lib/workflows.js.map +1 -1
- package/dist/nodes/RoleAlphaWorkflowBuilder/RoleAlphaWorkflowBuilder.node.js +167 -45
- package/dist/nodes/RoleAlphaWorkflowBuilder/RoleAlphaWorkflowBuilder.node.js.map +1 -1
- package/package.json +4 -1
package/dist/lib/workflows.d.ts
CHANGED
|
@@ -11,11 +11,14 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { type EntityChange } from './changes';
|
|
13
13
|
import { type GraphSource } from './graph';
|
|
14
|
+
import { type RunnerInfo } from './templates';
|
|
14
15
|
export declare const MANAGED_TAG = "rolealpha-managed";
|
|
15
16
|
export declare const DRAFT_TAG = "rolealpha-draft";
|
|
16
17
|
export declare const MARKER_NAME = "roleALPHA binding";
|
|
17
18
|
export declare const DRAFT_PREFIX = "Draft: ";
|
|
18
19
|
export declare const DEFAULT_NODE_TYPES: string[];
|
|
20
|
+
/** Allowed only with Allow Code Nodes, and then only through the code check. */
|
|
21
|
+
export declare const CODE_NODE = "n8n-nodes-base.code";
|
|
19
22
|
export interface N8nNode {
|
|
20
23
|
id?: string;
|
|
21
24
|
name: string;
|
|
@@ -61,6 +64,8 @@ export interface DraftInfo {
|
|
|
61
64
|
reason: string;
|
|
62
65
|
/** false when the entity is only a neighbour of the target: Apply then leaves the binding as it is. */
|
|
63
66
|
bindEntity?: boolean;
|
|
67
|
+
/** When the draft was made; a later change of the entity replaces it. */
|
|
68
|
+
madeAt?: string;
|
|
64
69
|
}
|
|
65
70
|
export interface Binding {
|
|
66
71
|
managed: true;
|
|
@@ -78,7 +83,13 @@ export interface ManagedWorkflow {
|
|
|
78
83
|
active: boolean;
|
|
79
84
|
entities: string[];
|
|
80
85
|
isDraft: boolean;
|
|
86
|
+
/** For a draft: the entity it was made for, and when. */
|
|
87
|
+
draftFor?: {
|
|
88
|
+
entityUuid: string;
|
|
89
|
+
madeAt: string | null;
|
|
90
|
+
};
|
|
81
91
|
versionId: string | null;
|
|
92
|
+
webhookPaths: string[];
|
|
82
93
|
nodes: Array<{
|
|
83
94
|
name: string;
|
|
84
95
|
type: string;
|
|
@@ -87,6 +98,18 @@ export interface ManagedWorkflow {
|
|
|
87
98
|
}>;
|
|
88
99
|
connections: string[];
|
|
89
100
|
}
|
|
101
|
+
/** A workflow the builder must not touch, but must know about so it does not build it again. */
|
|
102
|
+
export interface OtherWorkflow {
|
|
103
|
+
id: string;
|
|
104
|
+
name: string;
|
|
105
|
+
active: boolean;
|
|
106
|
+
triggers: string[];
|
|
107
|
+
webhookPaths: string[];
|
|
108
|
+
/** Inputs it declares as a sub-workflow; null when there are none to go by. */
|
|
109
|
+
inputs: string[] | null;
|
|
110
|
+
/** Whether it names the custom ID of the step at hand. */
|
|
111
|
+
namesStep?: boolean;
|
|
112
|
+
}
|
|
90
113
|
export declare function readBinding(wf: Pick<N8nWorkflow, 'nodes'>): Binding | null;
|
|
91
114
|
export declare function markerNode(binding: Binding, position?: [number, number]): N8nNode;
|
|
92
115
|
/** Hash of exactly what runs: names, types, versions, parameters, credentials and connections. */
|
|
@@ -95,6 +118,10 @@ export declare function summarizeWorkflows(raw: unknown[]): {
|
|
|
95
118
|
workflows: ManagedWorkflow[];
|
|
96
119
|
credentials: KnownCredential[];
|
|
97
120
|
};
|
|
121
|
+
/** All workflows that are not managed: what they start on, and whether they name the step already. */
|
|
122
|
+
export declare function summarizeOthers(raw: unknown[], customId?: string | null): OtherWorkflow[];
|
|
123
|
+
/** Finds the runner by ID or exact name among all workflows. */
|
|
124
|
+
export declare function findRunner(raw: unknown[], nameOrId: string): RunnerInfo | null;
|
|
98
125
|
/** A managed workflow a change touches: bound to the entity, or to a neighbouring step. */
|
|
99
126
|
export interface AffectedWorkflow {
|
|
100
127
|
workflowId: string;
|
|
@@ -110,6 +137,15 @@ export interface PlanContext {
|
|
|
110
137
|
credentials: KnownCredential[];
|
|
111
138
|
nodeTypes: string[];
|
|
112
139
|
extraRules?: string[];
|
|
140
|
+
/** All workflows that are not managed; without them the checks against them are skipped. */
|
|
141
|
+
others?: OtherWorkflow[];
|
|
142
|
+
runner?: RunnerInfo | null;
|
|
143
|
+
endpointUrl?: string;
|
|
144
|
+
organisation?: string;
|
|
145
|
+
/** Whether Code nodes may be proposed at all. */
|
|
146
|
+
allowCode?: boolean;
|
|
147
|
+
/** Whether n8n blocks environment access; a Code node needs that. */
|
|
148
|
+
envBlocked?: boolean;
|
|
113
149
|
}
|
|
114
150
|
export interface PlanInput {
|
|
115
151
|
systemMessage: string;
|
|
@@ -135,9 +171,42 @@ export interface PlanCheck {
|
|
|
135
171
|
notes: string[];
|
|
136
172
|
workflow: N8nWorkflow | null;
|
|
137
173
|
contentHash: string | null;
|
|
174
|
+
/** The template the workflow comes from, if any. */
|
|
175
|
+
template?: string;
|
|
176
|
+
/** Code nodes that are new or changed, with the number of tests they passed. */
|
|
177
|
+
code?: Array<{
|
|
178
|
+
node: string;
|
|
179
|
+
tests: number;
|
|
180
|
+
}>;
|
|
138
181
|
}
|
|
139
182
|
export declare function checkPlan(ctx: PlanContext, answerRaw: unknown, existing?: N8nWorkflow | null): PlanCheck;
|
|
140
|
-
export
|
|
183
|
+
export interface TriageOptions {
|
|
184
|
+
/** Custom ID prefixes of the steps the builder runs itself. */
|
|
185
|
+
ownPrefixes?: string[];
|
|
186
|
+
/** Whether a generic scheduler starts every step with a frequency, so such a step needs no workflow. */
|
|
187
|
+
schedulerCoversFrequency?: boolean;
|
|
188
|
+
}
|
|
189
|
+
export interface TriageResult {
|
|
190
|
+
rule: 'own_step' | 'draft_waiting' | 'decision' | 'grouping' | 'scheduled' | 'retired';
|
|
191
|
+
reason: string;
|
|
192
|
+
}
|
|
193
|
+
/** Changes whose answer is known without asking: same result every time, and no model call. */
|
|
194
|
+
export declare function triage(ctx: PlanContext, opts?: TriageOptions): TriageResult | null;
|
|
195
|
+
/** The answer of a rule, in the shape of a checked proposal. */
|
|
196
|
+
export declare function decidedPlan(change: EntityChange, reason: string): PlanCheck;
|
|
197
|
+
/** What a draft changes, one line each: a new workflow as a list of its nodes. */
|
|
198
|
+
export declare function diffWorkflows(before: Pick<N8nWorkflow, 'nodes' | 'connections'> | null | undefined, after: Pick<N8nWorkflow, 'nodes' | 'connections'>): string[];
|
|
199
|
+
/** The Code nodes a draft adds or changes against its target. */
|
|
200
|
+
export declare function changedCode(after: Pick<N8nWorkflow, 'nodes'>, before?: Pick<N8nWorkflow, 'nodes'> | null): Array<{
|
|
201
|
+
node: string;
|
|
202
|
+
jsCode: string;
|
|
203
|
+
}>;
|
|
204
|
+
/** The change and any code, escaped for the approval e-mail: all of it comes from a model. */
|
|
205
|
+
export declare function reviewHtml(diff: string[], code: Array<{
|
|
206
|
+
node: string;
|
|
207
|
+
jsCode: string;
|
|
208
|
+
}>): string;
|
|
209
|
+
export declare function draftWorkflow(plan: PlanCheck, change: EntityChange, target?: N8nWorkflow | null, now?: Date): N8nWorkflow;
|
|
141
210
|
/** The hash a draft stands for: its content, or for a deactivation the target and its version. */
|
|
142
211
|
export declare function draftHash(draft: N8nWorkflow): {
|
|
143
212
|
info: DraftInfo;
|
|
@@ -147,7 +216,8 @@ export type N8nRequest = (method: 'GET' | 'POST' | 'PUT' | 'DELETE', path: strin
|
|
|
147
216
|
export declare class N8nApi {
|
|
148
217
|
private readonly request;
|
|
149
218
|
constructor(request: N8nRequest);
|
|
150
|
-
|
|
219
|
+
/** The workflows with a tag; without one, all of them. */
|
|
220
|
+
listWorkflows(tag?: string): Promise<N8nWorkflow[]>;
|
|
151
221
|
get(id: string): Promise<N8nWorkflow>;
|
|
152
222
|
create(wf: N8nWorkflow): Promise<N8nWorkflow>;
|
|
153
223
|
update(id: string, wf: N8nWorkflow): Promise<N8nWorkflow>;
|
|
@@ -171,6 +241,7 @@ export interface ApplyResult {
|
|
|
171
241
|
*/
|
|
172
242
|
export declare function applyDraft(api: N8nApi, draftId: string, approvedHash: string, opts?: {
|
|
173
243
|
activate?: boolean;
|
|
244
|
+
codeApproved?: boolean;
|
|
174
245
|
}): Promise<ApplyResult>;
|
|
175
246
|
/** Deletes a rejected draft. Refuses anything that is not a draft. */
|
|
176
247
|
export declare function discardDraft(api: N8nApi, draftId: string): Promise<{
|