n8n-workflow 2.33.2 → 2.34.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.
Files changed (103) hide show
  1. package/dist/cjs/build.tsbuildinfo +1 -1
  2. package/dist/cjs/errors/abstract/execution-base.error.d.ts +4 -1
  3. package/dist/cjs/errors/abstract/execution-base.error.d.ts.map +1 -1
  4. package/dist/cjs/errors/abstract/execution-base.error.js +7 -5
  5. package/dist/cjs/errors/abstract/execution-base.error.js.map +1 -1
  6. package/dist/cjs/errors/abstract/node.error.d.ts +1 -1
  7. package/dist/cjs/errors/abstract/node.error.d.ts.map +1 -1
  8. package/dist/cjs/errors/abstract/node.error.js +7 -4
  9. package/dist/cjs/errors/abstract/node.error.js.map +1 -1
  10. package/dist/cjs/expression.d.ts +1 -0
  11. package/dist/cjs/expression.d.ts.map +1 -1
  12. package/dist/cjs/expression.js +16 -0
  13. package/dist/cjs/expression.js.map +1 -1
  14. package/dist/cjs/index.d.ts +2 -1
  15. package/dist/cjs/index.d.ts.map +1 -1
  16. package/dist/cjs/index.js +2 -2
  17. package/dist/cjs/index.js.map +1 -1
  18. package/dist/cjs/interfaces.d.ts +95 -6
  19. package/dist/cjs/interfaces.d.ts.map +1 -1
  20. package/dist/cjs/interfaces.js.map +1 -1
  21. package/dist/cjs/message-event-bus.d.ts +2 -1
  22. package/dist/cjs/message-event-bus.d.ts.map +1 -1
  23. package/dist/cjs/message-event-bus.js +1 -0
  24. package/dist/cjs/message-event-bus.js.map +1 -1
  25. package/dist/cjs/n8n-oauth2-auth.d.ts +26 -0
  26. package/dist/cjs/n8n-oauth2-auth.d.ts.map +1 -0
  27. package/dist/cjs/n8n-oauth2-auth.js +81 -0
  28. package/dist/cjs/n8n-oauth2-auth.js.map +1 -0
  29. package/dist/cjs/node-grouping-validation.js +1 -1
  30. package/dist/cjs/node-grouping-validation.js.map +1 -1
  31. package/dist/cjs/node-helpers.d.ts +21 -1
  32. package/dist/cjs/node-helpers.d.ts.map +1 -1
  33. package/dist/cjs/node-helpers.js +56 -4
  34. package/dist/cjs/node-helpers.js.map +1 -1
  35. package/dist/cjs/run-execution-data/run-execution-data.v0.d.ts +1 -1
  36. package/dist/cjs/run-execution-data/run-execution-data.v0.d.ts.map +1 -1
  37. package/dist/cjs/run-execution-data/run-execution-data.v1.d.ts +1 -1
  38. package/dist/cjs/run-execution-data/run-execution-data.v1.d.ts.map +1 -1
  39. package/dist/cjs/run-execution-data/run-execution-data.v1.js.map +1 -1
  40. package/dist/cjs/trigger-identity.d.ts +19 -1
  41. package/dist/cjs/trigger-identity.d.ts.map +1 -1
  42. package/dist/cjs/trigger-identity.js +22 -2
  43. package/dist/cjs/trigger-identity.js.map +1 -1
  44. package/dist/cjs/utils.d.ts +1 -3
  45. package/dist/cjs/utils.d.ts.map +1 -1
  46. package/dist/cjs/utils.js +6 -19
  47. package/dist/cjs/utils.js.map +1 -1
  48. package/dist/cjs/workflow-expression.d.ts +1 -0
  49. package/dist/cjs/workflow-expression.d.ts.map +1 -1
  50. package/dist/cjs/workflow-expression.js +3 -0
  51. package/dist/cjs/workflow-expression.js.map +1 -1
  52. package/dist/esm/errors/abstract/execution-base.error.d.ts +4 -1
  53. package/dist/esm/errors/abstract/execution-base.error.d.ts.map +1 -1
  54. package/dist/esm/errors/abstract/execution-base.error.js +7 -5
  55. package/dist/esm/errors/abstract/execution-base.error.js.map +1 -1
  56. package/dist/esm/errors/abstract/node.error.d.ts +1 -1
  57. package/dist/esm/errors/abstract/node.error.d.ts.map +1 -1
  58. package/dist/esm/errors/abstract/node.error.js +7 -4
  59. package/dist/esm/errors/abstract/node.error.js.map +1 -1
  60. package/dist/esm/expression.d.ts +1 -0
  61. package/dist/esm/expression.d.ts.map +1 -1
  62. package/dist/esm/expression.js +16 -0
  63. package/dist/esm/expression.js.map +1 -1
  64. package/dist/esm/index.d.ts +2 -1
  65. package/dist/esm/index.d.ts.map +1 -1
  66. package/dist/esm/index.js +2 -1
  67. package/dist/esm/index.js.map +1 -1
  68. package/dist/esm/interfaces.d.ts +95 -6
  69. package/dist/esm/interfaces.d.ts.map +1 -1
  70. package/dist/esm/interfaces.js.map +1 -1
  71. package/dist/esm/message-event-bus.d.ts +2 -1
  72. package/dist/esm/message-event-bus.d.ts.map +1 -1
  73. package/dist/esm/message-event-bus.js +1 -0
  74. package/dist/esm/message-event-bus.js.map +1 -1
  75. package/dist/esm/n8n-oauth2-auth.d.ts +26 -0
  76. package/dist/esm/n8n-oauth2-auth.d.ts.map +1 -0
  77. package/dist/esm/n8n-oauth2-auth.js +77 -0
  78. package/dist/esm/n8n-oauth2-auth.js.map +1 -0
  79. package/dist/esm/node-grouping-validation.js +1 -1
  80. package/dist/esm/node-grouping-validation.js.map +1 -1
  81. package/dist/esm/node-helpers.d.ts +21 -1
  82. package/dist/esm/node-helpers.d.ts.map +1 -1
  83. package/dist/esm/node-helpers.js +54 -4
  84. package/dist/esm/node-helpers.js.map +1 -1
  85. package/dist/esm/run-execution-data/run-execution-data.v0.d.ts +1 -1
  86. package/dist/esm/run-execution-data/run-execution-data.v0.d.ts.map +1 -1
  87. package/dist/esm/run-execution-data/run-execution-data.v1.d.ts +1 -1
  88. package/dist/esm/run-execution-data/run-execution-data.v1.d.ts.map +1 -1
  89. package/dist/esm/run-execution-data/run-execution-data.v1.js.map +1 -1
  90. package/dist/esm/trigger-identity.d.ts +19 -1
  91. package/dist/esm/trigger-identity.d.ts.map +1 -1
  92. package/dist/esm/trigger-identity.js +23 -3
  93. package/dist/esm/trigger-identity.js.map +1 -1
  94. package/dist/esm/typecheck.tsbuildinfo +1 -1
  95. package/dist/esm/utils.d.ts +1 -3
  96. package/dist/esm/utils.d.ts.map +1 -1
  97. package/dist/esm/utils.js +4 -16
  98. package/dist/esm/utils.js.map +1 -1
  99. package/dist/esm/workflow-expression.d.ts +1 -0
  100. package/dist/esm/workflow-expression.d.ts.map +1 -1
  101. package/dist/esm/workflow-expression.js +3 -0
  102. package/dist/esm/workflow-expression.js.map +1 -1
  103. package/package.json +9 -9
@@ -91,6 +91,15 @@ export type N8nOAuth2ValidationResult = {
91
91
  valid: false;
92
92
  reason: OAuth2FailureReason;
93
93
  };
94
+ export type N8nOAuth2FlowResult = {
95
+ valid: true;
96
+ token: string;
97
+ user: IUser;
98
+ metadata?: Record<string, string>;
99
+ } | {
100
+ valid: false;
101
+ reason: string;
102
+ };
94
103
  export type ProjectSharingData = {
95
104
  id: string;
96
105
  name: string | null;
@@ -165,7 +174,7 @@ export declare abstract class ICredentialsHelper {
165
174
  * validator so the policy is defined in exactly one place.
166
175
  */
167
176
  abstract isCredentialUsableByNode(credentialType: string, nodeType: string): boolean;
168
- abstract authenticate(credentials: ICredentialDataDecryptedObject, typeName: string, requestOptions: IHttpRequestOptions | IRequestOptionsSimplified, workflow: Workflow, node: INode): Promise<IHttpRequestOptions>;
177
+ abstract authenticate(credentials: ICredentialDataDecryptedObject, typeName: string, requestOptions: IHttpRequestOptions | IRequestOptionsSimplified, workflow?: Workflow, node?: INode): Promise<IHttpRequestOptions>;
169
178
  abstract preAuthentication(helpers: IHttpRequestHelper, credentials: ICredentialDataDecryptedObject, typeName: string, node: INode, credentialsExpired: boolean): Promise<ICredentialDataDecryptedObject | undefined>;
170
179
  abstract runPreAuthentication(helpers: IHttpRequestHelper, credentials: ICredentialDataDecryptedObject, typeName: string): Promise<ICredentialDataDecryptedObject | undefined>;
171
180
  abstract getCredentials(nodeCredentials: INodeCredentialsDetails, type: string): Promise<ICredentials>;
@@ -699,7 +708,7 @@ type CronRecurrenceRule = {
699
708
  activated: true;
700
709
  index: number;
701
710
  intervalSize: number;
702
- typeInterval: 'hours' | 'days' | 'weeks' | 'months';
711
+ typeInterval: 'minutes' | 'hours' | 'days' | 'weeks' | 'months';
703
712
  };
704
713
  /**
705
714
  * @deprecated Remnant of the legacy in-memory scheduling path. `registerCron`
@@ -806,10 +815,14 @@ export type CredentialCheckResult = {
806
815
  credentials: CredentialCheckStatus[];
807
816
  };
808
817
  export type DynamicCredentialCheckProxyProvider = {
809
- checkCredentialStatus(workflowId: string, executionContext: IExecutionContext): Promise<CredentialCheckResult>;
818
+ checkCredentialStatus(workflowId: string, executionContext: {
819
+ credentials?: string;
820
+ }): Promise<CredentialCheckResult>;
810
821
  };
811
822
  export type CredentialCheckProxyFunctions = {
812
- checkCredentialStatus?(workflowId: string, executionContext: IExecutionContext): Promise<CredentialCheckResult>;
823
+ checkCredentialStatus?(workflowId: string, executionContext: {
824
+ credentials?: string;
825
+ }): Promise<CredentialCheckResult>;
813
826
  };
814
827
  export type OauthJweProxyProvider = {
815
828
  decryptOAuth2TokenData(tokenData: IDataObject): Promise<IDataObject>;
@@ -850,7 +863,7 @@ export type IExecuteFunctions = ExecuteFunctions.GetNodeParameterFn & BaseExecut
850
863
  getRuntimeCredential(alias: string): Promise<IDataObject[string] | undefined>;
851
864
  putExecutionToWait(waitTill: Date): Promise<void>;
852
865
  sendMessageToUI(message: any): void;
853
- sendResponse(response: IExecuteResponsePromiseData): void;
866
+ sendResponse(response: IExecuteResponsePromiseData): Promise<void>;
854
867
  sendChunk(type: ChunkType, itemIndex: number, content?: IDataObject | string): void;
855
868
  isStreaming(): boolean;
856
869
  /** Returns true if the node is being executed as an AI Agent tool */
@@ -966,7 +979,57 @@ export interface IHookFunctions extends FunctionsBaseWithRequiredKeys<'getMode'
966
979
  export interface IWebhookFunctions extends FunctionsBaseWithRequiredKeys<'getMode'> {
967
980
  getBodyData(): IDataObject;
968
981
  getHeaderData(): IncomingHttpHeaders;
982
+ /**
983
+ * Identity pipeline for identity-bearing triggers (Form, MCP).
984
+ *
985
+ * These let a trigger run a workflow as the *caller* — resolving that user's own
986
+ * private (per-user) credentials instead of a shared/static credential — by
987
+ * proving the caller's n8n identity against the internal Authorization Server (AS)
988
+ * and binding it to the execution. The shape is acquire → verify → bind:
989
+ *
990
+ * - Browser-facing triggers (Form) acquire a token interactively:
991
+ * `beginN8nOAuth2Flow` → (AS redirect) → `completeN8nOAuth2Flow`.
992
+ * - Resource-server triggers (MCP) receive a bearer token directly and only
993
+ * `validateN8nOAuth2Token` it.
994
+ * - Either way, `establishTriggerIdentity` binds the verified token to the run.
995
+ */
996
+ /**
997
+ * Starts the interactive authorization-code + PKCE flow against n8n's internal AS
998
+ * for `resourceUrl` (the trigger's own protected-resource URL). Returns the
999
+ * `/oauth/authorize` URL to redirect the browser to; the AS identifies the
1000
+ * already-logged-in user from their n8n session (no login prompt for the
1001
+ * first-party trigger client) and redirects back to the trigger URL with a code.
1002
+ * Used on the initial GET of a browser-facing trigger. Pair with
1003
+ * `completeN8nOAuth2Flow`.
1004
+ *
1005
+ * Optional `metadata` is stashed server-side against this flow's one-time `state`
1006
+ * (never sent to the browser) and returned by `completeN8nOAuth2Flow` on success —
1007
+ * a per-flow slot for carrying data (e.g. the original request query) across the bounce.
1008
+ */
1009
+ beginN8nOAuth2Flow(resourceUrl: string, metadata?: Record<string, string>): Promise<string>;
1010
+ /**
1011
+ * Completes the flow started by `beginN8nOAuth2Flow` once the AS redirects back to
1012
+ * the trigger URL with `?code&state`. Consumes the one-time `state`, verifies PKCE,
1013
+ * exchanges the code for an access token **server-side** (the code never reaches the
1014
+ * sandboxed form page), and validates it. Returns the token and resolved user on
1015
+ * success, or a failure reason.
1016
+ */
1017
+ completeN8nOAuth2Flow(code: string, state: string): Promise<N8nOAuth2FlowResult>;
1018
+ /**
1019
+ * Verifies an AS access token against `resourceUrl` (the expected audience) without
1020
+ * running a redirect flow. Used by resource-server triggers (MCP) that receive a
1021
+ * bearer token directly, and by browser triggers on the POST leg to re-check the
1022
+ * token the page presents. Returns validity + resolved user, or a failure reason
1023
+ * (`invalid_token`, `insufficient_scope`, …).
1024
+ */
969
1025
  validateN8nOAuth2Token(token: string, resourceUrl: string): Promise<N8nOAuth2ValidationResult>;
1026
+ /**
1027
+ * Binds the verified submitter to the current execution: builds an encrypted
1028
+ * credential context from `token`/`resource` and threads it into the execution's
1029
+ * runtime context, so downstream nodes resolve *that user's* per-user credentials.
1030
+ * Call only after the token is validated. The identity persists for the whole
1031
+ * execution (including across a Wait), within the token's validity window.
1032
+ */
970
1033
  establishTriggerIdentity(token: string, resource: string): Promise<void>;
971
1034
  /**
972
1035
  * Checks the status of the triggering identity's resolvable (private) credentials
@@ -978,7 +1041,14 @@ export interface IWebhookFunctions extends FunctionsBaseWithRequiredKeys<'getMod
978
1041
  checkTriggerCredentialStatus(): Promise<CredentialCheckResult | undefined>;
979
1042
  getInputConnectionData(connectionType: AINodeConnectionType, itemIndex: number, inputIndex?: number): Promise<unknown>;
980
1043
  getNodeParameter(parameterName: string, fallbackValue?: any, options?: IGetNodeParameterOptions): NodeParameterValueType | object;
1044
+ /** Always the production endpoint, whichever endpoint the request arrived on. */
981
1045
  getNodeWebhookUrl: (name: WebhookType) => string | undefined;
1046
+ /**
1047
+ * The endpoint actually being served (`/webhook-test/…` on a test run), which
1048
+ * identifies the webhook as an OAuth protected resource. Minting and verifying a
1049
+ * token both derive the resource from it, so it must track the endpoint served.
1050
+ */
1051
+ getWebhookResourceUrl: (name: WebhookType) => string | undefined;
982
1052
  evaluateExpression(expression: string, itemIndex?: number): NodeParameterValueType;
983
1053
  getParamsData(): object;
984
1054
  getQueryData(): object;
@@ -1223,6 +1293,7 @@ export interface INodePropertyTypeOptions {
1223
1293
  password?: boolean;
1224
1294
  copyButton?: boolean;
1225
1295
  redactJsonLeaves?: boolean;
1296
+ resolveCredentialJsonLeaves?: boolean;
1226
1297
  ignoreCredentialExpressionResolveError?: boolean;
1227
1298
  rows?: number;
1228
1299
  showAlpha?: boolean;
@@ -1488,6 +1559,7 @@ export interface INodePropertyOptions {
1488
1559
  inputSchema?: any;
1489
1560
  displayOptions?: IDisplayOptions;
1490
1561
  disabledOptions?: undefined;
1562
+ envFeatureFlag?: Uppercase<string>;
1491
1563
  }
1492
1564
  export interface INodeListSearchItems extends INodePropertyOptions {
1493
1565
  icon?: string;
@@ -2638,6 +2710,13 @@ export interface IWorkflowExecutionDataProcess {
2638
2710
  * apart) and by telemetry.
2639
2711
  */
2640
2712
  source?: WorkflowExecutionSource;
2713
+ /**
2714
+ * When true, a failure in this run must not dispatch the workflow's error
2715
+ * workflow (or its own Error Trigger). Set for runs that are a test of the
2716
+ * workflow rather than a real one, but that still need a production
2717
+ * execution mode for realistic trigger semantics
2718
+ */
2719
+ suppressErrorWorkflow?: boolean;
2641
2720
  telemetryMetadata?: IWorkflowExecutionTelemetryMetadata;
2642
2721
  dirtyNodeNames?: string[];
2643
2722
  triggerToStartFrom?: {
@@ -2669,7 +2748,7 @@ export interface IWorkflowExecutionDataProcess {
2669
2748
  traceparent: string;
2670
2749
  tracestate?: string;
2671
2750
  };
2672
- /** Encrypted credential context for a manual editor-triggered execution. */
2751
+ /** Encrypted credential context for a triggered execution. */
2673
2752
  encryptedRunnerIdentity?: string;
2674
2753
  /** Parent evaluation TestRun.id, exposed to expressions as `$evaluation.runId`. */
2675
2754
  evaluationRunId?: string;
@@ -2727,6 +2806,14 @@ export interface IWorkflowExecuteAdditionalData {
2727
2806
  executionId?: string;
2728
2807
  restartExecutionId?: string;
2729
2808
  getRuntimeCredential(runExecutionData: IRunExecutionData, alias: string): Promise<IDataObject[string] | undefined>;
2809
+ /**
2810
+ * Backing implementations for the trigger identity pipeline exposed to nodes on
2811
+ * `IWebhookFunctions` (see the docs there). Optional here because they are only
2812
+ * wired in by the CLI webhook layer when the OAuth server is available; the
2813
+ * context methods throw if a node reaches them while unset.
2814
+ */
2815
+ beginN8nOAuth2Flow?: (resourceUrl: string, metadata?: Record<string, string>) => Promise<string>;
2816
+ completeN8nOAuth2Flow?: (code: string, state: string) => Promise<N8nOAuth2FlowResult>;
2730
2817
  validateN8nOAuth2Token?: (token: string, resourceUrl: string) => Promise<N8nOAuth2ValidationResult>;
2731
2818
  establishTriggerIdentity?(token: string, resource: string): Promise<void>;
2732
2819
  checkTriggerCredentialStatus?(): Promise<CredentialCheckResult | undefined>;
@@ -2738,7 +2825,9 @@ export interface IWorkflowExecuteAdditionalData {
2738
2825
  instanceBaseUrl: string;
2739
2826
  setExecutionStatus?: (status: ExecutionStatus) => void;
2740
2827
  sendDataToUI?: (type: string, data: IDataObject | IDataObject[]) => void;
2828
+ formBaseUrl: string;
2741
2829
  formWaitingBaseUrl: string;
2830
+ formTestBaseUrl: string;
2742
2831
  webhookBaseUrl: string;
2743
2832
  webhookWaitingBaseUrl: string;
2744
2833
  webhookTestBaseUrl: string;