@fsai-flow/core 0.0.4 → 0.1.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.
Files changed (136) hide show
  1. package/dist/index.d.ts +17 -0
  2. package/dist/index.js +61 -0
  3. package/dist/{src/lib → lib}/ActiveWebhooks.d.ts +1 -1
  4. package/dist/lib/ActiveWebhooks.js +177 -0
  5. package/dist/{src/lib → lib}/ActiveWorkflows.d.ts +3 -3
  6. package/dist/lib/ActiveWorkflows.js +465 -0
  7. package/dist/{src/lib → lib}/BinaryDataManager/FileSystem.d.ts +1 -1
  8. package/dist/lib/BinaryDataManager/FileSystem.js +180 -0
  9. package/dist/{src/lib → lib}/BinaryDataManager/index.d.ts +2 -2
  10. package/dist/lib/BinaryDataManager/index.js +129 -0
  11. package/dist/{src/lib → lib}/ChangeCase.js +11 -11
  12. package/dist/lib/Constants.js +18 -0
  13. package/dist/{src/lib → lib}/Credentials.d.ts +1 -1
  14. package/dist/{src/lib → lib}/Credentials.js +7 -8
  15. package/dist/{src/lib → lib}/FileSystem.d.ts +1 -1
  16. package/dist/lib/FileSystem.js +180 -0
  17. package/dist/{src/lib → lib}/InputConnectionDataLegacy.d.ts +1 -1
  18. package/dist/lib/InputConnectionDataLegacy.js +72 -0
  19. package/dist/{src/lib → lib}/Interfaces.d.ts +47 -48
  20. package/dist/{src/lib → lib}/Interfaces.js +0 -1
  21. package/dist/{src/lib → lib}/LoadNodeParameterOptions.d.ts +1 -1
  22. package/dist/lib/LoadNodeParameterOptions.js +152 -0
  23. package/dist/{src/lib → lib}/NodeExecuteFunctions.d.ts +9 -10
  24. package/dist/lib/NodeExecuteFunctions.js +2467 -0
  25. package/dist/{src/lib → lib}/NodesLoader/constants.d.ts +1 -1
  26. package/dist/lib/NodesLoader/constants.js +105 -0
  27. package/dist/{src/lib → lib}/NodesLoader/custom-directory-loader.d.ts +1 -1
  28. package/dist/lib/NodesLoader/custom-directory-loader.js +35 -0
  29. package/dist/{src/lib → lib}/NodesLoader/directory-loader.d.ts +1 -1
  30. package/dist/{src/lib → lib}/NodesLoader/directory-loader.js +80 -38
  31. package/dist/lib/NodesLoader/index.d.ts +5 -0
  32. package/dist/{src/lib → lib}/NodesLoader/index.js +5 -6
  33. package/dist/{src/lib → lib}/NodesLoader/lazy-package-directory-loader.d.ts +1 -1
  34. package/dist/lib/NodesLoader/lazy-package-directory-loader.js +44 -0
  35. package/dist/{src/lib → lib}/NodesLoader/load-class-in-isolation.js +6 -11
  36. package/dist/{src/lib → lib}/NodesLoader/package-directory-loader.d.ts +2 -2
  37. package/dist/{src/lib → lib}/NodesLoader/package-directory-loader.js +28 -36
  38. package/dist/{src/lib → lib}/NodesLoader/types.js +0 -1
  39. package/dist/{src/lib → lib}/RedisLeaderElectionManager.d.ts +1 -1
  40. package/dist/lib/RedisLeaderElectionManager.js +279 -0
  41. package/dist/lib/RequestTypes.d.ts +58 -0
  42. package/dist/lib/RequestTypes.js +8 -0
  43. package/dist/{src/lib → lib}/UserSettings.d.ts +1 -1
  44. package/dist/lib/UserSettings.js +269 -0
  45. package/dist/{src/lib → lib}/WorkflowExecute.d.ts +4 -4
  46. package/dist/{src/lib → lib}/WorkflowExecute.js +230 -178
  47. package/dist/{src/lib → lib}/index.d.ts +2 -2
  48. package/dist/lib/index.js +129 -0
  49. package/dist/{src/utils → utils}/crypto.js +2 -3
  50. package/package.json +59 -52
  51. package/dist/README.md +0 -31
  52. package/dist/package.json +0 -54
  53. package/dist/src/index.d.ts +0 -16
  54. package/dist/src/index.js +0 -30
  55. package/dist/src/index.js.map +0 -1
  56. package/dist/src/lib/ActiveWebhooks.js +0 -184
  57. package/dist/src/lib/ActiveWebhooks.js.map +0 -1
  58. package/dist/src/lib/ActiveWorkflows.js +0 -456
  59. package/dist/src/lib/ActiveWorkflows.js.map +0 -1
  60. package/dist/src/lib/BinaryDataManager/FileSystem.js +0 -179
  61. package/dist/src/lib/BinaryDataManager/FileSystem.js.map +0 -1
  62. package/dist/src/lib/BinaryDataManager/index.js +0 -146
  63. package/dist/src/lib/BinaryDataManager/index.js.map +0 -1
  64. package/dist/src/lib/ChangeCase.js.map +0 -1
  65. package/dist/src/lib/Constants.js +0 -19
  66. package/dist/src/lib/Constants.js.map +0 -1
  67. package/dist/src/lib/Credentials.js.map +0 -1
  68. package/dist/src/lib/FileSystem.js +0 -179
  69. package/dist/src/lib/FileSystem.js.map +0 -1
  70. package/dist/src/lib/InputConnectionDataLegacy.js +0 -79
  71. package/dist/src/lib/InputConnectionDataLegacy.js.map +0 -1
  72. package/dist/src/lib/Interfaces.js.map +0 -1
  73. package/dist/src/lib/LoadNodeParameterOptions.js +0 -150
  74. package/dist/src/lib/LoadNodeParameterOptions.js.map +0 -1
  75. package/dist/src/lib/NodeExecuteFunctions.js +0 -2479
  76. package/dist/src/lib/NodeExecuteFunctions.js.map +0 -1
  77. package/dist/src/lib/NodesLoader/constants.js +0 -106
  78. package/dist/src/lib/NodesLoader/constants.js.map +0 -1
  79. package/dist/src/lib/NodesLoader/custom-directory-loader.js +0 -36
  80. package/dist/src/lib/NodesLoader/custom-directory-loader.js.map +0 -1
  81. package/dist/src/lib/NodesLoader/directory-loader.js.map +0 -1
  82. package/dist/src/lib/NodesLoader/index.d.ts +0 -5
  83. package/dist/src/lib/NodesLoader/index.js.map +0 -1
  84. package/dist/src/lib/NodesLoader/lazy-package-directory-loader.js +0 -52
  85. package/dist/src/lib/NodesLoader/lazy-package-directory-loader.js.map +0 -1
  86. package/dist/src/lib/NodesLoader/load-class-in-isolation.js.map +0 -1
  87. package/dist/src/lib/NodesLoader/package-directory-loader.js.map +0 -1
  88. package/dist/src/lib/NodesLoader/types.js.map +0 -1
  89. package/dist/src/lib/RedisLeaderElectionManager.js +0 -294
  90. package/dist/src/lib/RedisLeaderElectionManager.js.map +0 -1
  91. package/dist/src/lib/UserSettings.js +0 -261
  92. package/dist/src/lib/UserSettings.js.map +0 -1
  93. package/dist/src/lib/WorkflowExecute.js.map +0 -1
  94. package/dist/src/lib/index.js +0 -146
  95. package/dist/src/lib/index.js.map +0 -1
  96. package/dist/src/utils/crypto.js.map +0 -1
  97. package/eslint.config.js +0 -19
  98. package/jest.config.ts +0 -10
  99. package/project.json +0 -19
  100. package/src/index.ts +0 -28
  101. package/src/lib/ActiveWebhooks.ts +0 -245
  102. package/src/lib/ActiveWorkflows.ts +0 -575
  103. package/src/lib/BinaryDataManager/FileSystem.ts +0 -214
  104. package/src/lib/BinaryDataManager/index.ts +0 -187
  105. package/src/lib/ChangeCase.ts +0 -45
  106. package/src/lib/Constants.ts +0 -16
  107. package/src/lib/Credentials.ts +0 -108
  108. package/src/lib/FileSystem.ts +0 -214
  109. package/src/lib/InputConnectionDataLegacy.ts +0 -123
  110. package/src/lib/Interfaces.ts +0 -338
  111. package/src/lib/LoadNodeParameterOptions.ts +0 -235
  112. package/src/lib/NodeExecuteFunctions.ts +0 -3700
  113. package/src/lib/NodesLoader/constants.ts +0 -112
  114. package/src/lib/NodesLoader/custom-directory-loader.ts +0 -31
  115. package/src/lib/NodesLoader/directory-loader.ts +0 -458
  116. package/src/lib/NodesLoader/index.ts +0 -5
  117. package/src/lib/NodesLoader/lazy-package-directory-loader.ts +0 -55
  118. package/src/lib/NodesLoader/load-class-in-isolation.ts +0 -19
  119. package/src/lib/NodesLoader/package-directory-loader.ts +0 -107
  120. package/src/lib/NodesLoader/types.ts +0 -14
  121. package/src/lib/RedisLeaderElectionManager.ts +0 -334
  122. package/src/lib/UserSettings.ts +0 -292
  123. package/src/lib/WorkflowExecute.ts +0 -1128
  124. package/src/lib/index.ts +0 -187
  125. package/src/utils/crypto.ts +0 -5
  126. package/tests/Credentials.test.ts +0 -88
  127. package/tests/Helpers.ts +0 -808
  128. package/tests/WorkflowExecute.test.ts +0 -1242
  129. package/tsconfig.json +0 -41
  130. package/tsconfig.lib.json +0 -10
  131. package/tsconfig.spec.json +0 -14
  132. /package/dist/{src/lib → lib}/ChangeCase.d.ts +0 -0
  133. /package/dist/{src/lib → lib}/Constants.d.ts +0 -0
  134. /package/dist/{src/lib → lib}/NodesLoader/load-class-in-isolation.d.ts +0 -0
  135. /package/dist/{src/lib → lib}/NodesLoader/types.d.ts +0 -0
  136. /package/dist/{src/utils → utils}/crypto.d.ts +0 -0
@@ -1,50 +1,49 @@
1
- import { IAdditionalCredentialOptions, IAllExecuteFunctions, IBinaryData, ICredentialTestFunctions as ICredentialTestFunctionsBase, ICredentialType, IDataObject, IExecuteFunctions as IExecuteFunctionsBase, IExecuteSingleFunctions as IExecuteSingleFunctionsBase, IHookFunctions as IHookFunctionsBase, IHttpRequestOptions, ILoadOptionsFunctions as ILoadOptionsFunctionsBase, INodeExecutionData, INodeType, IOAuth2Options, IPollFunctions as IPollFunctionsBase, IPollResponse, ITriggerFunctions as ITriggerFunctionsBase, ITriggerResponse, IWebhookFunctions as IWebhookFunctionsBase, IWorkflowSettings as IWorkflowSettingsWorkflow } from '@fsai-flow/workflow';
2
- import { OptionsWithUri, OptionsWithUrl } from 'request';
3
- import * as requestPromise from 'request-promise-native';
1
+ import type { IAdditionalCredentialOptions, IAllExecuteFunctions, IBinaryData, ICredentialTestFunctions as ICredentialTestFunctionsBase, ICredentialType, IDataObject, IExecuteFunctions as IExecuteFunctionsBase, IExecuteSingleFunctions as IExecuteSingleFunctionsBase, IHookFunctions as IHookFunctionsBase, IHttpRequestOptions, ILoadOptionsFunctions as ILoadOptionsFunctionsBase, IN8nHttpFullResponse, IN8nHttpResponse, INodeExecutionData, INodeType, IOAuth2Options, IPollFunctions as IPollFunctionsBase, IPollResponse, ITriggerFunctions as ITriggerFunctionsBase, ITriggerResponse, IWebhookFunctions as IWebhookFunctionsBase, IWorkflowSettings as IWorkflowSettingsWorkflow } from "@fsai-flow/workflow";
2
+ import type { OptionsWithUri, OptionsWithUrl, RequestPromiseOptions } from "./RequestTypes";
4
3
  interface Constructable<T> {
5
4
  new (): T;
6
5
  }
7
6
  export interface IProcessMessage {
8
- data?: any;
7
+ data?: unknown;
9
8
  type: string;
10
9
  }
11
10
  export type Class<T = object, A extends unknown[] = unknown[]> = new (...args: A) => T;
12
11
  export interface IExecuteFunctions extends IExecuteFunctionsBase {
13
12
  helpers: {
14
- httpRequest(requestOptions: IHttpRequestOptions): Promise<any>;
13
+ httpRequest(requestOptions: IHttpRequestOptions): Promise<IN8nHttpFullResponse | IN8nHttpResponse>;
15
14
  prepareBinaryData(binaryData: Buffer, filePath?: string, mimeType?: string): Promise<IBinaryData>;
16
15
  assertBinaryData(itemIndex: number, propertyName: string, inputIndex?: number): IBinaryData;
17
16
  getBinaryDataBuffer(itemIndex: number, propertyName: string, inputIndex?: number): Promise<Buffer>;
18
- request: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>;
19
- requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<any>;
20
- requestOAuth2(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, oAuth2Options?: IOAuth2Options): Promise<any>;
21
- requestOAuth1(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | requestPromise.RequestPromiseOptions): Promise<any>;
17
+ request: (uriOrObject: string | IDataObject | unknown, options?: IDataObject) => Promise<unknown>;
18
+ requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<unknown>;
19
+ requestOAuth2(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, oAuth2Options?: IOAuth2Options): Promise<unknown>;
20
+ requestOAuth1(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | RequestPromiseOptions): Promise<unknown>;
22
21
  returnJsonArray(jsonData: IDataObject | IDataObject[]): INodeExecutionData[];
23
22
  normalizeItems(items: INodeExecutionData | INodeExecutionData[]): INodeExecutionData[];
24
- httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions): Promise<any>;
23
+ httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions): Promise<IN8nHttpFullResponse | IN8nHttpResponse>;
25
24
  };
26
25
  }
27
26
  export interface IExecuteSingleFunctions extends IExecuteSingleFunctionsBase {
28
27
  helpers: {
29
- httpRequest(requestOptions: IHttpRequestOptions): Promise<any>;
28
+ httpRequest(requestOptions: IHttpRequestOptions): Promise<IN8nHttpFullResponse | IN8nHttpResponse>;
30
29
  prepareBinaryData(binaryData: Buffer, filePath?: string, mimeType?: string): Promise<IBinaryData>;
31
- request: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>;
32
- requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<any>;
33
- requestOAuth2(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, oAuth2Options?: IOAuth2Options): Promise<any>;
34
- requestOAuth1(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | requestPromise.RequestPromiseOptions): Promise<any>;
35
- httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions): Promise<any>;
30
+ request: (uriOrObject: string | IDataObject | unknown, options?: IDataObject) => Promise<unknown>;
31
+ requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<unknown>;
32
+ requestOAuth2(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, oAuth2Options?: IOAuth2Options): Promise<unknown>;
33
+ requestOAuth1(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | RequestPromiseOptions): Promise<unknown>;
34
+ httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions): Promise<IN8nHttpFullResponse | IN8nHttpResponse>;
36
35
  };
37
36
  }
38
37
  export interface IPollFunctions extends IPollFunctionsBase {
39
38
  helpers: {
40
- httpRequest(requestOptions: IHttpRequestOptions): Promise<any>;
39
+ httpRequest(requestOptions: IHttpRequestOptions): Promise<IN8nHttpFullResponse | IN8nHttpResponse>;
41
40
  prepareBinaryData(binaryData: Buffer, filePath?: string, mimeType?: string): Promise<IBinaryData>;
42
- request: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>;
43
- requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<any>;
44
- requestOAuth2(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, oAuth2Options?: IOAuth2Options): Promise<any>;
45
- requestOAuth1(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | requestPromise.RequestPromiseOptions): Promise<any>;
41
+ request: (uriOrObject: string | IDataObject | unknown, options?: IDataObject) => Promise<unknown>;
42
+ requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<unknown>;
43
+ requestOAuth2(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, oAuth2Options?: IOAuth2Options): Promise<unknown>;
44
+ requestOAuth1(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | RequestPromiseOptions): Promise<unknown>;
46
45
  returnJsonArray(jsonData: IDataObject | IDataObject[]): INodeExecutionData[];
47
- httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions): Promise<any>;
46
+ httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions): Promise<IN8nHttpFullResponse | IN8nHttpResponse>;
48
47
  };
49
48
  }
50
49
  export interface IResponseError extends Error {
@@ -52,14 +51,14 @@ export interface IResponseError extends Error {
52
51
  }
53
52
  export interface ITriggerFunctions extends ITriggerFunctionsBase {
54
53
  helpers: {
55
- httpRequest(requestOptions: IHttpRequestOptions): Promise<any>;
54
+ httpRequest(requestOptions: IHttpRequestOptions): Promise<IN8nHttpFullResponse | IN8nHttpResponse>;
56
55
  prepareBinaryData(binaryData: Buffer, filePath?: string, mimeType?: string): Promise<IBinaryData>;
57
- request: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>;
58
- requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<any>;
59
- requestOAuth2(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, oAuth2Options?: IOAuth2Options): Promise<any>;
60
- requestOAuth1(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | requestPromise.RequestPromiseOptions): Promise<any>;
56
+ request: (uriOrObject: string | IDataObject | unknown, options?: IDataObject) => Promise<unknown>;
57
+ requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<unknown>;
58
+ requestOAuth2(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, oAuth2Options?: IOAuth2Options): Promise<unknown>;
59
+ requestOAuth1(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | RequestPromiseOptions): Promise<unknown>;
61
60
  returnJsonArray(jsonData: IDataObject | IDataObject[]): INodeExecutionData[];
62
- httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions): Promise<any>;
61
+ httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions): Promise<IN8nHttpFullResponse | IN8nHttpResponse>;
63
62
  };
64
63
  }
65
64
  export interface ITriggerTime {
@@ -77,39 +76,39 @@ export interface IUserSettings {
77
76
  }
78
77
  export interface ILoadOptionsFunctions extends ILoadOptionsFunctionsBase {
79
78
  helpers: {
80
- httpRequest(requestOptions: IHttpRequestOptions): Promise<any>;
81
- request?: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>;
82
- requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<any>;
83
- requestOAuth2?: (this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, oAuth2Options?: IOAuth2Options) => Promise<any>;
84
- requestOAuth1?(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | requestPromise.RequestPromiseOptions): Promise<any>;
85
- httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions): Promise<any>;
79
+ httpRequest(requestOptions: IHttpRequestOptions): Promise<IN8nHttpFullResponse | IN8nHttpResponse>;
80
+ request?: (uriOrObject: string | IDataObject | unknown, options?: IDataObject) => Promise<unknown>;
81
+ requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<unknown>;
82
+ requestOAuth2?: (this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, oAuth2Options?: IOAuth2Options) => Promise<unknown>;
83
+ requestOAuth1?(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | RequestPromiseOptions): Promise<unknown>;
84
+ httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions): Promise<IN8nHttpFullResponse | IN8nHttpResponse>;
86
85
  };
87
86
  }
88
87
  export interface ICredentialTestFunctions extends ICredentialTestFunctionsBase {
89
88
  helpers: {
90
- request?: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>;
89
+ request?: (uriOrObject: string | IDataObject | unknown, options?: IDataObject) => Promise<unknown>;
91
90
  };
92
91
  }
93
92
  export interface IHookFunctions extends IHookFunctionsBase {
94
93
  helpers: {
95
- httpRequest(requestOptions: IHttpRequestOptions): Promise<any>;
96
- request: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>;
97
- requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<any>;
98
- requestOAuth2(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, oAuth2Options?: IOAuth2Options): Promise<any>;
99
- requestOAuth1(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | requestPromise.RequestPromiseOptions): Promise<any>;
100
- httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions): Promise<any>;
94
+ httpRequest(requestOptions: IHttpRequestOptions): Promise<IN8nHttpFullResponse | IN8nHttpResponse>;
95
+ request: (uriOrObject: string | IDataObject | unknown, options?: IDataObject) => Promise<unknown>;
96
+ requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<unknown>;
97
+ requestOAuth2(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, oAuth2Options?: IOAuth2Options): Promise<unknown>;
98
+ requestOAuth1(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | RequestPromiseOptions): Promise<unknown>;
99
+ httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions): Promise<IN8nHttpFullResponse | IN8nHttpResponse>;
101
100
  };
102
101
  }
103
102
  export interface IWebhookFunctions extends IWebhookFunctionsBase {
104
103
  helpers: {
105
- httpRequest(requestOptions: IHttpRequestOptions): Promise<any>;
104
+ httpRequest(requestOptions: IHttpRequestOptions): Promise<IN8nHttpFullResponse | IN8nHttpResponse>;
106
105
  prepareBinaryData(binaryData: Buffer, filePath?: string, mimeType?: string): Promise<IBinaryData>;
107
- request: (uriOrObject: string | IDataObject | any, options?: IDataObject) => Promise<any>;
108
- requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<any>;
109
- requestOAuth2(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, oAuth2Options?: IOAuth2Options): Promise<any>;
110
- requestOAuth1(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | requestPromise.RequestPromiseOptions): Promise<any>;
106
+ request: (uriOrObject: string | IDataObject | unknown, options?: IDataObject) => Promise<unknown>;
107
+ requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<unknown>;
108
+ requestOAuth2(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, oAuth2Options?: IOAuth2Options): Promise<unknown>;
109
+ requestOAuth1(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | RequestPromiseOptions): Promise<unknown>;
111
110
  returnJsonArray(jsonData: IDataObject | IDataObject[]): INodeExecutionData[];
112
- httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions): Promise<any>;
111
+ httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions): Promise<IN8nHttpFullResponse | IN8nHttpResponse>;
113
112
  };
114
113
  }
115
114
  export interface IWorkflowSettings extends IWorkflowSettingsWorkflow {
@@ -128,7 +127,7 @@ export interface IWorkflowData {
128
127
  triggerResponses?: ITriggerResponse[];
129
128
  }
130
129
  export interface IBinaryDataConfig {
131
- mode: 'default' | 'filesystem';
130
+ mode: "default" | "filesystem";
132
131
  availableModes: string;
133
132
  localStoragePath: string;
134
133
  binaryDataTTL: number;
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=Interfaces.js.map
@@ -1,4 +1,4 @@
1
- import { ILoadOptions, INode, INodeCredentials, INodeParameters, INodePropertyOptions, INodeTypeNameVersion, INodeTypes, IWorkflowExecuteAdditionalData, Workflow } from '@fsai-flow/workflow';
1
+ import { type ILoadOptions, type INode, type INodeCredentials, type INodeParameters, type INodePropertyOptions, type INodeTypeNameVersion, type INodeTypes, type IWorkflowExecuteAdditionalData, Workflow } from "@fsai-flow/workflow";
2
2
  export declare class LoadNodeParameterOptions {
3
3
  currentNodeParameters: INodeParameters;
4
4
  path: string;
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ /* eslint-disable no-restricted-syntax */
3
+ /* eslint-disable @typescript-eslint/no-unsafe-return */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
5
+ /* eslint-disable @typescript-eslint/restrict-template-expressions */
6
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
7
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
8
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.LoadNodeParameterOptions = void 0;
11
+ const workflow_1 = require("@fsai-flow/workflow");
12
+ // eslint-disable-next-line import/no-cycle
13
+ const __1 = require("..");
14
+ const TEMP_NODE_NAME = "Temp-Node";
15
+ const TEMP_WORKFLOW_NAME = "Temp-Workflow";
16
+ class LoadNodeParameterOptions {
17
+ constructor(nodeTypeNameAndVersion, nodeTypes, path, currentNodeParameters, credentials) {
18
+ const nodeType = nodeTypes.getByNameAndVersion(nodeTypeNameAndVersion.name, nodeTypeNameAndVersion.version);
19
+ this.currentNodeParameters = currentNodeParameters;
20
+ this.path = path;
21
+ if (nodeType === undefined) {
22
+ throw new Error(`The node-type "${nodeTypeNameAndVersion.name} v${nodeTypeNameAndVersion.version}" is not known!`);
23
+ }
24
+ const nodeData = {
25
+ parameters: currentNodeParameters,
26
+ name: TEMP_NODE_NAME,
27
+ type: nodeTypeNameAndVersion.name,
28
+ typeVersion: nodeTypeNameAndVersion.version,
29
+ position: [0, 0],
30
+ id: "",
31
+ };
32
+ if (credentials) {
33
+ nodeData.credentials = credentials;
34
+ }
35
+ const workflowData = {
36
+ nodes: [nodeData],
37
+ connections: {},
38
+ };
39
+ this.workflow = new workflow_1.Workflow({
40
+ nodes: workflowData.nodes,
41
+ connections: workflowData.connections,
42
+ active: false,
43
+ nodeTypes,
44
+ });
45
+ }
46
+ /**
47
+ * Returns data of a fake workflow
48
+ *
49
+ * @returns
50
+ * @memberof LoadNodeParameterOptions
51
+ */
52
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
53
+ getWorkflowData() {
54
+ return {
55
+ name: TEMP_WORKFLOW_NAME,
56
+ active: false,
57
+ connections: {},
58
+ nodes: Object.values(this.workflow.nodes),
59
+ createdAt: new Date(),
60
+ updatedAt: new Date(),
61
+ };
62
+ }
63
+ /**
64
+ * Returns the available options via a predefined method
65
+ *
66
+ * @param {string} methodName The name of the method of which to get the data from
67
+ * @param {IWorkflowExecuteAdditionalData} additionalData
68
+ * @returns {Promise<INodePropertyOptions[]>}
69
+ * @memberof LoadNodeParameterOptions
70
+ */
71
+ async getOptionsViaMethodName(methodName, additionalData) {
72
+ const node = this.workflow.getNode(TEMP_NODE_NAME);
73
+ const nodeType = this.workflow.nodeTypes.getByNameAndVersion(node.type, node?.typeVersion);
74
+ if (!nodeType ||
75
+ nodeType.methods === undefined ||
76
+ nodeType.methods.loadOptions === undefined ||
77
+ nodeType.methods.loadOptions[methodName] === undefined) {
78
+ throw new Error(`The node-type "${node?.type}" does not have the method "${methodName}" defined!`);
79
+ }
80
+ const thisArgs = __1.NodeExecuteFunctions.getLoadOptionsFunctions(this.workflow, node, this.path, additionalData);
81
+ try {
82
+ return await nodeType.methods.loadOptions[methodName].call(thisArgs);
83
+ }
84
+ catch (error) {
85
+ return [
86
+ {
87
+ name: "Error trying to load options",
88
+ value: "",
89
+ description: error.message || "Error trying to load options.",
90
+ },
91
+ ];
92
+ }
93
+ }
94
+ /**
95
+ * Returns the available options via a load request informatoin
96
+ *
97
+ * @param {ILoadOptions} loadOptions The load options which also contain the request information
98
+ * @param {IWorkflowExecuteAdditionalData} additionalData
99
+ * @returns {Promise<INodePropertyOptions[]>}
100
+ * @memberof LoadNodeParameterOptions
101
+ */
102
+ async getOptionsViaRequestProperty(loadOptions, additionalData) {
103
+ const node = this.workflow.getNode(TEMP_NODE_NAME);
104
+ const nodeType = this.workflow.nodeTypes.getByNameAndVersion(node.type, node?.typeVersion);
105
+ if (nodeType === undefined ||
106
+ !nodeType.description.requestDefaults ||
107
+ !nodeType.description.requestDefaults.baseURL) {
108
+ // This in in here for now for security reasons.
109
+ // Background: As the full data for the request to make does get send, and the auth data
110
+ // will then be applied, would it be possible to retrieve that data like that. By at least
111
+ // requiring a baseURL to be defined can at least not a random server be called.
112
+ // In the future this code has to get improved that it does not use the request information from
113
+ // the request rather resolves it via the parameter-path and nodeType data.
114
+ throw new Error(`The node-type "${node?.type}" does not exist or does not have "requestDefaults.baseURL" defined!`);
115
+ }
116
+ const mode = "internal";
117
+ const runIndex = 0;
118
+ const connectionInputData = [];
119
+ const runExecutionData = { resultData: { runData: {} } };
120
+ const routingNode = new workflow_1.RoutingNode(this.workflow, node, connectionInputData, runExecutionData ?? null, additionalData, mode);
121
+ // Create copy of node-type with the single property we want to get the data off
122
+ const tempNode = {
123
+ ...nodeType,
124
+ ...{
125
+ description: {
126
+ ...nodeType.description,
127
+ properties: [
128
+ {
129
+ displayName: "",
130
+ type: "string",
131
+ name: "",
132
+ default: "",
133
+ routing: loadOptions.routing,
134
+ },
135
+ ],
136
+ },
137
+ },
138
+ };
139
+ const inputData = {
140
+ main: [[{ json: {} }]],
141
+ };
142
+ const optionsData = await routingNode.runNode(inputData, runIndex, tempNode, __1.NodeExecuteFunctions);
143
+ if (optionsData?.length === 0) {
144
+ return [];
145
+ }
146
+ if (!Array.isArray(optionsData)) {
147
+ throw new Error("The returned data is not an array!");
148
+ }
149
+ return optionsData[0].map((item) => item.json);
150
+ }
151
+ }
152
+ exports.LoadNodeParameterOptions = LoadNodeParameterOptions;
@@ -1,7 +1,6 @@
1
- import { IAdditionalCredentialOptions, IAllExecuteFunctions, IBinaryData, ICredentialDataDecryptedObject, IDataObject, IExecuteFunctions, IExecuteSingleFunctions, IHttpRequestOptions, INode, INodeExecutionData, INodeParameters, INodeType, IOAuth2Options, IPollFunctions, IRunExecutionData, ITaskDataConnections, ITriggerFunctions, IWebhookData, IWebhookDescription, IWebhookFunctions, IWorkflowDataProxyAdditionalKeys, IWorkflowExecuteAdditionalData, IWorkflowMetadata, NodeParameterValue, Workflow, WorkflowActivateMode, WorkflowExecuteMode, ISupplyDataFunctions, NodeConnectionType, CloseFunction } from '@fsai-flow/workflow';
2
- import { OptionsWithUri, OptionsWithUrl } from 'request';
3
- import * as requestPromise from 'request-promise-native';
4
- import { ICredentialTestFunctions, IHookFunctions, ILoadOptionsFunctions } from '..';
1
+ import { type CloseFunction, type IAdditionalCredentialOptions, type IAllExecuteFunctions, type IBinaryData, type ICredentialDataDecryptedObject, type IDataObject, type IExecuteFunctions, type IExecuteSingleFunctions, type IHttpRequestOptions, type INode, type INodeExecutionData, type INodeParameters, type INodeType, type IOAuth2Options, type IPollFunctions, type IRunExecutionData, type ISupplyDataFunctions, type ITaskDataConnections, type ITriggerFunctions, type IWebhookData, type IWebhookDescription, type IWebhookFunctions, type IWorkflowDataProxyAdditionalKeys, type IWorkflowExecuteAdditionalData, type IWorkflowMetadata, type NodeConnectionType, type NodeParameterValue, type Workflow, type WorkflowActivateMode, type WorkflowExecuteMode } from "@fsai-flow/workflow";
2
+ import { type ICredentialTestFunctions, type IHookFunctions, type ILoadOptionsFunctions } from "..";
3
+ import type { OptionsWithUri, OptionsWithUrl, RequestPromiseOptions } from "./RequestTypes";
5
4
  /**
6
5
  * Returns binary data buffer for given item index and property name.
7
6
  *
@@ -25,9 +24,9 @@ export declare function getBinaryDataBuffer(inputData: ITaskDataConnections, ite
25
24
  */
26
25
  export declare function prepareBinaryData(binaryData: Buffer, executionId: string, filePath?: string, mimeType?: string): Promise<IBinaryData>;
27
26
  export declare function getCurrentOAuth2AccessToken(this: IAllExecuteFunctions, credentialsType: string, node: INode, additionalData: IWorkflowExecuteAdditionalData, oAuth2Options?: IOAuth2Options): Promise<string>;
28
- export declare function requestOAuth2(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions | IHttpRequestOptions, node: INode, additionalData: IWorkflowExecuteAdditionalData, oAuth2Options?: IOAuth2Options, isN8nRequest?: boolean): Promise<any>;
29
- export declare function requestOAuth1(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | OptionsWithUri | requestPromise.RequestPromiseOptions | IHttpRequestOptions, isN8nRequest?: boolean): Promise<any>;
30
- export declare function httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions, workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<any>;
27
+ export declare function requestOAuth2(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions | IHttpRequestOptions, node: INode, additionalData: IWorkflowExecuteAdditionalData, oAuth2Options?: IOAuth2Options, isN8nRequest?: boolean): Promise<unknown>;
28
+ export declare function requestOAuth1(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUrl | OptionsWithUri | RequestPromiseOptions | IHttpRequestOptions, isN8nRequest?: boolean): Promise<unknown>;
29
+ export declare function httpRequestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: IHttpRequestOptions, workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<unknown>;
31
30
  /**
32
31
  * Takes generic input data and brings it into the json format n8n uses.
33
32
  *
@@ -45,7 +44,7 @@ export declare function returnJsonArray(jsonData: IDataObject | IDataObject[]):
45
44
  * @returns {INodeExecutionData[]}
46
45
  */
47
46
  export declare function normalizeItems(executionData: INodeExecutionData | INodeExecutionData[]): INodeExecutionData[];
48
- export declare function requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | requestPromise.RequestPromiseOptions, workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<any>;
47
+ export declare function requestWithAuthentication(this: IAllExecuteFunctions, credentialsType: string, requestOptions: OptionsWithUri | RequestPromiseOptions, workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, additionalCredentialOptions?: IAdditionalCredentialOptions): Promise<unknown>;
49
48
  /**
50
49
  * Returns the additional keys for Expressions and Function-Nodes
51
50
  *
@@ -87,7 +86,7 @@ export declare function getNode(node: INode): INode;
87
86
  * @param {*} [fallbackValue]
88
87
  * @returns {(NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object)}
89
88
  */
90
- export declare function getNodeParameter(workflow: Workflow, runExecutionData: IRunExecutionData | null, runIndex: number, connectionInputData: INodeExecutionData[], node: INode, parameterName: string, itemIndex: number, mode: WorkflowExecuteMode, additionalKeys: IWorkflowDataProxyAdditionalKeys, fallbackValue?: any): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
89
+ export declare function getNodeParameter(workflow: Workflow, runExecutionData: IRunExecutionData | null, runIndex: number, connectionInputData: INodeExecutionData[], node: INode, parameterName: string, itemIndex: number, mode: WorkflowExecuteMode, additionalKeys: IWorkflowDataProxyAdditionalKeys, fallbackValue?: unknown): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object;
91
90
  /**
92
91
  * Returns if execution should be continued even if there was an error.
93
92
  *
@@ -221,6 +220,6 @@ export declare function getExecuteHookFunctions(workflow: Workflow, node: INode,
221
220
  * @param {WorkflowExecuteMode} mode
222
221
  * @returns {IWebhookFunctions}
223
222
  */
224
- export declare function getExecuteWebhookFunctions(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, webhookData: IWebhookData, runExecutionData: IRunExecutionData | undefined): IWebhookFunctions;
223
+ export declare function getExecuteWebhookFunctions(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, webhookData: IWebhookData, initialRunExecutionData: IRunExecutionData | undefined): IWebhookFunctions;
225
224
  export declare function getSupplyDataFunctions(workflow: Workflow, runExecutionData: IRunExecutionData, runIndex: number, connectionInputData: INodeExecutionData[], inputData: ITaskDataConnections, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, nodeTypeData: INodeType, closeFunctions: CloseFunction[]): ISupplyDataFunctions;
226
225
  export declare function getInputConnectionData(this: IExecuteFunctions | ISupplyDataFunctions, workflow: Workflow, runExecutionData: IRunExecutionData, runIndex: number, connectionInputData: INodeExecutionData[], inputData: ITaskDataConnections, additionalData: IWorkflowExecuteAdditionalData, connectionType: NodeConnectionType, mode: WorkflowExecuteMode, itemIndex: number, nodeTypeData: INodeType, closeFunctions: CloseFunction[]): Promise<unknown>;