@n8n/rest-api-client 2.0.1 → 2.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.
@@ -0,0 +1,9 @@
1
+ require('../utils2.cjs');
2
+ const require_credentialResolvers = require('../credentialResolvers.cjs');
3
+
4
+ exports.createCredentialResolver = require_credentialResolvers.createCredentialResolver;
5
+ exports.deleteCredentialResolver = require_credentialResolvers.deleteCredentialResolver;
6
+ exports.getCredentialResolver = require_credentialResolvers.getCredentialResolver;
7
+ exports.getCredentialResolverTypes = require_credentialResolvers.getCredentialResolverTypes;
8
+ exports.getCredentialResolvers = require_credentialResolvers.getCredentialResolvers;
9
+ exports.updateCredentialResolver = require_credentialResolvers.updateCredentialResolver;
@@ -0,0 +1,3 @@
1
+ import "../types2.cjs";
2
+ import { a as getCredentialResolvers, i as getCredentialResolverTypes, n as deleteCredentialResolver, o as updateCredentialResolver, r as getCredentialResolver, t as createCredentialResolver } from "../credentialResolvers.cjs";
3
+ export { createCredentialResolver, deleteCredentialResolver, getCredentialResolver, getCredentialResolverTypes, getCredentialResolvers, updateCredentialResolver };
@@ -0,0 +1,3 @@
1
+ import "../types2.mjs";
2
+ import { a as getCredentialResolvers, i as getCredentialResolverTypes, n as deleteCredentialResolver, o as updateCredentialResolver, r as getCredentialResolver, t as createCredentialResolver } from "../credentialResolvers.mjs";
3
+ export { createCredentialResolver, deleteCredentialResolver, getCredentialResolver, getCredentialResolverTypes, getCredentialResolvers, updateCredentialResolver };
@@ -0,0 +1,4 @@
1
+ import "../utils2.mjs";
2
+ import { a as getCredentialResolvers, i as getCredentialResolverTypes, n as deleteCredentialResolver, o as updateCredentialResolver, r as getCredentialResolver, t as createCredentialResolver } from "../credentialResolvers.mjs";
3
+
4
+ export { createCredentialResolver, deleteCredentialResolver, getCredentialResolver, getCredentialResolverTypes, getCredentialResolvers, updateCredentialResolver };
@@ -2,6 +2,7 @@ require('../utils2.cjs');
2
2
  const require_api_keys = require('../api-keys.cjs');
3
3
  const require_cloudPlans = require('../cloudPlans.cjs');
4
4
  const require_communityNodes = require('../communityNodes.cjs');
5
+ const require_credentialResolvers = require('../credentialResolvers.cjs');
5
6
  const require_ctas = require('../ctas.cjs');
6
7
  const require_eventbus_ee = require('../eventbus.ee.cjs');
7
8
  const require_events = require('../events.cjs');
@@ -32,8 +33,10 @@ exports.canEnableMFA = require_mfa.canEnableMFA;
32
33
  exports.changePassword = require_users.changePassword;
33
34
  exports.connectProvider = require_externalSecrets_ee.connectProvider;
34
35
  exports.createApiKey = require_api_keys.createApiKey;
36
+ exports.createCredentialResolver = require_credentialResolvers.createCredentialResolver;
35
37
  exports.createProjectRole = require_roles.createProjectRole;
36
38
  exports.deleteApiKey = require_api_keys.deleteApiKey;
39
+ exports.deleteCredentialResolver = require_credentialResolvers.deleteCredentialResolver;
37
40
  exports.deleteDestinationFromDb = require_eventbus_ee.deleteDestinationFromDb;
38
41
  exports.deleteProjectRole = require_roles.deleteProjectRole;
39
42
  exports.deleteUser = require_users.deleteUser;
@@ -52,6 +55,9 @@ exports.getCategories = require_templates.getCategories;
52
55
  exports.getCloudUserInfo = require_cloudPlans.getCloudUserInfo;
53
56
  exports.getCollectionById = require_templates.getCollectionById;
54
57
  exports.getCollections = require_templates.getCollections;
58
+ exports.getCredentialResolver = require_credentialResolvers.getCredentialResolver;
59
+ exports.getCredentialResolverTypes = require_credentialResolvers.getCredentialResolverTypes;
60
+ exports.getCredentialResolvers = require_credentialResolvers.getCredentialResolvers;
55
61
  exports.getCurrentPlan = require_cloudPlans.getCurrentPlan;
56
62
  exports.getCurrentUsage = require_cloudPlans.getCurrentUsage;
57
63
  exports.getDestinationsFromBackend = require_eventbus_ee.getDestinationsFromBackend;
@@ -125,6 +131,7 @@ exports.testSamlConfig = require_sso.testSamlConfig;
125
131
  exports.toggleSamlConfig = require_sso.toggleSamlConfig;
126
132
  exports.uninstallPackage = require_communityNodes.uninstallPackage;
127
133
  exports.updateApiKey = require_api_keys.updateApiKey;
134
+ exports.updateCredentialResolver = require_credentialResolvers.updateCredentialResolver;
128
135
  exports.updateCurrentUser = require_users.updateCurrentUser;
129
136
  exports.updateCurrentUserPassword = require_users.updateCurrentUserPassword;
130
137
  exports.updateCurrentUserSettings = require_users.updateCurrentUserSettings;
@@ -2,6 +2,7 @@ import "../types2.cjs";
2
2
  import { a as updateApiKey, i as getApiKeys, n as deleteApiKey, r as getApiKeyScopes, t as createApiKey } from "../api-keys.cjs";
3
3
  import { a as getCloudUserInfo, c as sendConfirmationEmail, i as getAdminPanelLoginCode, l as sendUserEvent, n as DynamicNotification, o as getCurrentPlan, r as InstanceUsage, s as getCurrentUsage, t as Cloud } from "../cloudPlans.cjs";
4
4
  import { a as updatePackage, i as uninstallPackage, n as getInstalledCommunityNodes, r as installNewPackage, t as getAvailableCommunityPackageCount } from "../communityNodes.cjs";
5
+ import { a as getCredentialResolvers, i as getCredentialResolverTypes, n as deleteCredentialResolver, o as updateCredentialResolver, r as getCredentialResolver, t as createCredentialResolver } from "../credentialResolvers.cjs";
5
6
  import { t as getBecomeCreatorCta } from "../ctas.cjs";
6
7
  import { a as hasDestinationId, i as getEventNamesFromBackend, n as deleteDestinationFromDb, o as saveDestinationToDb, r as getDestinationsFromBackend, s as sendTestMessageToDestination, t as ApiMessageEventBusDestinationOptions } from "../eventbus.ee.cjs";
7
8
  import { t as sessionStarted } from "../events.cjs";
@@ -28,4 +29,4 @@ import { C as updateCurrentUserPassword, D as validatePasswordToken, E as update
28
29
  import { t as findWebhook } from "../webhooks.cjs";
29
30
  import { a as WorkflowVersion, c as getWorkflowVersion, i as WorkflowPublishHistory, n as WorkflowHistoryActionTypes, o as WorkflowVersionId, r as WorkflowHistoryRequestParams, s as getWorkflowHistory, t as WorkflowHistory } from "../workflowHistory.cjs";
30
31
  import "../index2.cjs";
31
- export { ApiMessageEventBusDestinationOptions, Cloud, CurrentUserResponse, DisableMfaParams, DynamicNotification, IPersonalizationLatestVersion, IPersonalizationSurveyAnswersV1, IPersonalizationSurveyAnswersV2, IPersonalizationSurveyAnswersV3, IPersonalizationSurveyVersions, ITag, ITemplatesCategory, ITemplatesCollection, ITemplatesCollectionFull, ITemplatesCollectionResponse, ITemplatesNode, ITemplatesQuery, ITemplatesWorkflow, ITemplatesWorkflowFull, ITemplatesWorkflowInfo, ITemplatesWorkflowResponse, IUser, IUserResponse, IWorkflowTemplate, IWorkflowTemplateNode, IWorkflowTemplateNodeCredentials, InstanceUsage, LdapConfig, LdapSyncData, LdapSyncTable, N8nPromptResponse, N8nPrompts, ProvisioningConfig, SamlPreferencesExtractedData, TemplateSearchFacet, UpdateGlobalRolePayload, Version, VersionNode, WhatsNewArticle, WhatsNewSection, WorkflowData, WorkflowDataCreate, WorkflowDataUpdate, WorkflowHistory, WorkflowHistoryActionTypes, WorkflowHistoryRequestParams, WorkflowMetadata, WorkflowPublishHistory, WorkflowVersion, WorkflowVersionId, activateLicenseKey, canEnableMFA, changePassword, connectProvider, createApiKey, createProjectRole, deleteApiKey, deleteDestinationFromDb, deleteProjectRole, deleteUser, disableMfa, dismissBannerPermanently, enableMfa, fetchCommunityNodeAttributes, fetchCommunityNodeTypes, findWebhook, getAdminPanelLoginCode, getApiKeyScopes, getApiKeys, getAvailableCommunityPackageCount, getBecomeCreatorCta, getCategories, getCloudUserInfo, getCollectionById, getCollections, getCurrentPlan, getCurrentUsage, getDestinationsFromBackend, getEventNamesFromBackend, getExternalSecrets, getExternalSecretsProvider, getExternalSecretsProviders, getInstalledCommunityNodes, getInviteLink, getLdapConfig, getLdapSynchronizations, getLicense, getLocalResourceMapperFields, getMfaQR, getModuleSettings, getNextVersions, getNodeParameterActionResult, getNodeParameterOptions, getNodeTranslationHeaders, getNodeTypes, getNodesInformation, getOidcConfig, getPasswordResetLink, getPromptsData, getProvisioningConfig, getResourceLocatorResults, getResourceMapperFields, getRoleBySlug, getRoles, getSamlConfig, getSamlMetadata, getSettings, getTemplateById, getThirdPartyLicenses, getUsers, getWhatsNewSection, getWorkflowHistory, getWorkflowTemplate, getWorkflowVersion, getWorkflows, hasDestinationId, initOidcLogin, initSSO, installNewPackage, login, loginCurrentUser, logout, registerCommunityEdition, reloadProvider, renewLicense, requestLicenseTrial, runLdapSync, saveDestinationToDb, saveOidcConfig, saveProvisioningConfig, saveSamlConfig, sendConfirmationEmail, sendForgotPasswordEmail, sendGetWorkerStatus, sendTestMessageToDestination, sendUserEvent, sessionStarted, setupOwner, signup, submitContactInfo, submitPersonalizationSurvey, testExternalSecretsProviderConnection, testHealthEndpoint, testLdapConnection, testSamlConfig, toggleSamlConfig, uninstallPackage, updateApiKey, updateCurrentUser, updateCurrentUserPassword, updateCurrentUserSettings, updateEnforceMfa, updateGlobalRole, updateLdapConfig, updateNpsSurveyState, updateOtherUserSettings, updatePackage, updateProjectRole, updateProvider, validatePasswordToken, validateSignupToken, verifyMfaCode };
32
+ export { ApiMessageEventBusDestinationOptions, Cloud, CurrentUserResponse, DisableMfaParams, DynamicNotification, IPersonalizationLatestVersion, IPersonalizationSurveyAnswersV1, IPersonalizationSurveyAnswersV2, IPersonalizationSurveyAnswersV3, IPersonalizationSurveyVersions, ITag, ITemplatesCategory, ITemplatesCollection, ITemplatesCollectionFull, ITemplatesCollectionResponse, ITemplatesNode, ITemplatesQuery, ITemplatesWorkflow, ITemplatesWorkflowFull, ITemplatesWorkflowInfo, ITemplatesWorkflowResponse, IUser, IUserResponse, IWorkflowTemplate, IWorkflowTemplateNode, IWorkflowTemplateNodeCredentials, InstanceUsage, LdapConfig, LdapSyncData, LdapSyncTable, N8nPromptResponse, N8nPrompts, ProvisioningConfig, SamlPreferencesExtractedData, TemplateSearchFacet, UpdateGlobalRolePayload, Version, VersionNode, WhatsNewArticle, WhatsNewSection, WorkflowData, WorkflowDataCreate, WorkflowDataUpdate, WorkflowHistory, WorkflowHistoryActionTypes, WorkflowHistoryRequestParams, WorkflowMetadata, WorkflowPublishHistory, WorkflowVersion, WorkflowVersionId, activateLicenseKey, canEnableMFA, changePassword, connectProvider, createApiKey, createCredentialResolver, createProjectRole, deleteApiKey, deleteCredentialResolver, deleteDestinationFromDb, deleteProjectRole, deleteUser, disableMfa, dismissBannerPermanently, enableMfa, fetchCommunityNodeAttributes, fetchCommunityNodeTypes, findWebhook, getAdminPanelLoginCode, getApiKeyScopes, getApiKeys, getAvailableCommunityPackageCount, getBecomeCreatorCta, getCategories, getCloudUserInfo, getCollectionById, getCollections, getCredentialResolver, getCredentialResolverTypes, getCredentialResolvers, getCurrentPlan, getCurrentUsage, getDestinationsFromBackend, getEventNamesFromBackend, getExternalSecrets, getExternalSecretsProvider, getExternalSecretsProviders, getInstalledCommunityNodes, getInviteLink, getLdapConfig, getLdapSynchronizations, getLicense, getLocalResourceMapperFields, getMfaQR, getModuleSettings, getNextVersions, getNodeParameterActionResult, getNodeParameterOptions, getNodeTranslationHeaders, getNodeTypes, getNodesInformation, getOidcConfig, getPasswordResetLink, getPromptsData, getProvisioningConfig, getResourceLocatorResults, getResourceMapperFields, getRoleBySlug, getRoles, getSamlConfig, getSamlMetadata, getSettings, getTemplateById, getThirdPartyLicenses, getUsers, getWhatsNewSection, getWorkflowHistory, getWorkflowTemplate, getWorkflowVersion, getWorkflows, hasDestinationId, initOidcLogin, initSSO, installNewPackage, login, loginCurrentUser, logout, registerCommunityEdition, reloadProvider, renewLicense, requestLicenseTrial, runLdapSync, saveDestinationToDb, saveOidcConfig, saveProvisioningConfig, saveSamlConfig, sendConfirmationEmail, sendForgotPasswordEmail, sendGetWorkerStatus, sendTestMessageToDestination, sendUserEvent, sessionStarted, setupOwner, signup, submitContactInfo, submitPersonalizationSurvey, testExternalSecretsProviderConnection, testHealthEndpoint, testLdapConnection, testSamlConfig, toggleSamlConfig, uninstallPackage, updateApiKey, updateCredentialResolver, updateCurrentUser, updateCurrentUserPassword, updateCurrentUserSettings, updateEnforceMfa, updateGlobalRole, updateLdapConfig, updateNpsSurveyState, updateOtherUserSettings, updatePackage, updateProjectRole, updateProvider, validatePasswordToken, validateSignupToken, verifyMfaCode };
@@ -2,6 +2,7 @@ import "../types2.mjs";
2
2
  import { a as updateApiKey, i as getApiKeys, n as deleteApiKey, r as getApiKeyScopes, t as createApiKey } from "../api-keys.mjs";
3
3
  import { a as getCloudUserInfo, c as sendConfirmationEmail, i as getAdminPanelLoginCode, l as sendUserEvent, n as DynamicNotification, o as getCurrentPlan, r as InstanceUsage, s as getCurrentUsage, t as Cloud } from "../cloudPlans.mjs";
4
4
  import { a as updatePackage, i as uninstallPackage, n as getInstalledCommunityNodes, r as installNewPackage, t as getAvailableCommunityPackageCount } from "../communityNodes.mjs";
5
+ import { a as getCredentialResolvers, i as getCredentialResolverTypes, n as deleteCredentialResolver, o as updateCredentialResolver, r as getCredentialResolver, t as createCredentialResolver } from "../credentialResolvers.mjs";
5
6
  import { t as getBecomeCreatorCta } from "../ctas.mjs";
6
7
  import { a as hasDestinationId, i as getEventNamesFromBackend, n as deleteDestinationFromDb, o as saveDestinationToDb, r as getDestinationsFromBackend, s as sendTestMessageToDestination, t as ApiMessageEventBusDestinationOptions } from "../eventbus.ee.mjs";
7
8
  import { t as sessionStarted } from "../events.mjs";
@@ -28,4 +29,4 @@ import { C as updateCurrentUserPassword, D as validatePasswordToken, E as update
28
29
  import { t as findWebhook } from "../webhooks.mjs";
29
30
  import { a as WorkflowVersion, c as getWorkflowVersion, i as WorkflowPublishHistory, n as WorkflowHistoryActionTypes, o as WorkflowVersionId, r as WorkflowHistoryRequestParams, s as getWorkflowHistory, t as WorkflowHistory } from "../workflowHistory.mjs";
30
31
  import "../index2.mjs";
31
- export { ApiMessageEventBusDestinationOptions, Cloud, CurrentUserResponse, DisableMfaParams, DynamicNotification, IPersonalizationLatestVersion, IPersonalizationSurveyAnswersV1, IPersonalizationSurveyAnswersV2, IPersonalizationSurveyAnswersV3, IPersonalizationSurveyVersions, ITag, ITemplatesCategory, ITemplatesCollection, ITemplatesCollectionFull, ITemplatesCollectionResponse, ITemplatesNode, ITemplatesQuery, ITemplatesWorkflow, ITemplatesWorkflowFull, ITemplatesWorkflowInfo, ITemplatesWorkflowResponse, IUser, IUserResponse, IWorkflowTemplate, IWorkflowTemplateNode, IWorkflowTemplateNodeCredentials, InstanceUsage, LdapConfig, LdapSyncData, LdapSyncTable, N8nPromptResponse, N8nPrompts, ProvisioningConfig, SamlPreferencesExtractedData, TemplateSearchFacet, UpdateGlobalRolePayload, Version, VersionNode, WhatsNewArticle, WhatsNewSection, WorkflowData, WorkflowDataCreate, WorkflowDataUpdate, WorkflowHistory, WorkflowHistoryActionTypes, WorkflowHistoryRequestParams, WorkflowMetadata, WorkflowPublishHistory, WorkflowVersion, WorkflowVersionId, activateLicenseKey, canEnableMFA, changePassword, connectProvider, createApiKey, createProjectRole, deleteApiKey, deleteDestinationFromDb, deleteProjectRole, deleteUser, disableMfa, dismissBannerPermanently, enableMfa, fetchCommunityNodeAttributes, fetchCommunityNodeTypes, findWebhook, getAdminPanelLoginCode, getApiKeyScopes, getApiKeys, getAvailableCommunityPackageCount, getBecomeCreatorCta, getCategories, getCloudUserInfo, getCollectionById, getCollections, getCurrentPlan, getCurrentUsage, getDestinationsFromBackend, getEventNamesFromBackend, getExternalSecrets, getExternalSecretsProvider, getExternalSecretsProviders, getInstalledCommunityNodes, getInviteLink, getLdapConfig, getLdapSynchronizations, getLicense, getLocalResourceMapperFields, getMfaQR, getModuleSettings, getNextVersions, getNodeParameterActionResult, getNodeParameterOptions, getNodeTranslationHeaders, getNodeTypes, getNodesInformation, getOidcConfig, getPasswordResetLink, getPromptsData, getProvisioningConfig, getResourceLocatorResults, getResourceMapperFields, getRoleBySlug, getRoles, getSamlConfig, getSamlMetadata, getSettings, getTemplateById, getThirdPartyLicenses, getUsers, getWhatsNewSection, getWorkflowHistory, getWorkflowTemplate, getWorkflowVersion, getWorkflows, hasDestinationId, initOidcLogin, initSSO, installNewPackage, login, loginCurrentUser, logout, registerCommunityEdition, reloadProvider, renewLicense, requestLicenseTrial, runLdapSync, saveDestinationToDb, saveOidcConfig, saveProvisioningConfig, saveSamlConfig, sendConfirmationEmail, sendForgotPasswordEmail, sendGetWorkerStatus, sendTestMessageToDestination, sendUserEvent, sessionStarted, setupOwner, signup, submitContactInfo, submitPersonalizationSurvey, testExternalSecretsProviderConnection, testHealthEndpoint, testLdapConnection, testSamlConfig, toggleSamlConfig, uninstallPackage, updateApiKey, updateCurrentUser, updateCurrentUserPassword, updateCurrentUserSettings, updateEnforceMfa, updateGlobalRole, updateLdapConfig, updateNpsSurveyState, updateOtherUserSettings, updatePackage, updateProjectRole, updateProvider, validatePasswordToken, validateSignupToken, verifyMfaCode };
32
+ export { ApiMessageEventBusDestinationOptions, Cloud, CurrentUserResponse, DisableMfaParams, DynamicNotification, IPersonalizationLatestVersion, IPersonalizationSurveyAnswersV1, IPersonalizationSurveyAnswersV2, IPersonalizationSurveyAnswersV3, IPersonalizationSurveyVersions, ITag, ITemplatesCategory, ITemplatesCollection, ITemplatesCollectionFull, ITemplatesCollectionResponse, ITemplatesNode, ITemplatesQuery, ITemplatesWorkflow, ITemplatesWorkflowFull, ITemplatesWorkflowInfo, ITemplatesWorkflowResponse, IUser, IUserResponse, IWorkflowTemplate, IWorkflowTemplateNode, IWorkflowTemplateNodeCredentials, InstanceUsage, LdapConfig, LdapSyncData, LdapSyncTable, N8nPromptResponse, N8nPrompts, ProvisioningConfig, SamlPreferencesExtractedData, TemplateSearchFacet, UpdateGlobalRolePayload, Version, VersionNode, WhatsNewArticle, WhatsNewSection, WorkflowData, WorkflowDataCreate, WorkflowDataUpdate, WorkflowHistory, WorkflowHistoryActionTypes, WorkflowHistoryRequestParams, WorkflowMetadata, WorkflowPublishHistory, WorkflowVersion, WorkflowVersionId, activateLicenseKey, canEnableMFA, changePassword, connectProvider, createApiKey, createCredentialResolver, createProjectRole, deleteApiKey, deleteCredentialResolver, deleteDestinationFromDb, deleteProjectRole, deleteUser, disableMfa, dismissBannerPermanently, enableMfa, fetchCommunityNodeAttributes, fetchCommunityNodeTypes, findWebhook, getAdminPanelLoginCode, getApiKeyScopes, getApiKeys, getAvailableCommunityPackageCount, getBecomeCreatorCta, getCategories, getCloudUserInfo, getCollectionById, getCollections, getCredentialResolver, getCredentialResolverTypes, getCredentialResolvers, getCurrentPlan, getCurrentUsage, getDestinationsFromBackend, getEventNamesFromBackend, getExternalSecrets, getExternalSecretsProvider, getExternalSecretsProviders, getInstalledCommunityNodes, getInviteLink, getLdapConfig, getLdapSynchronizations, getLicense, getLocalResourceMapperFields, getMfaQR, getModuleSettings, getNextVersions, getNodeParameterActionResult, getNodeParameterOptions, getNodeTranslationHeaders, getNodeTypes, getNodesInformation, getOidcConfig, getPasswordResetLink, getPromptsData, getProvisioningConfig, getResourceLocatorResults, getResourceMapperFields, getRoleBySlug, getRoles, getSamlConfig, getSamlMetadata, getSettings, getTemplateById, getThirdPartyLicenses, getUsers, getWhatsNewSection, getWorkflowHistory, getWorkflowTemplate, getWorkflowVersion, getWorkflows, hasDestinationId, initOidcLogin, initSSO, installNewPackage, login, loginCurrentUser, logout, registerCommunityEdition, reloadProvider, renewLicense, requestLicenseTrial, runLdapSync, saveDestinationToDb, saveOidcConfig, saveProvisioningConfig, saveSamlConfig, sendConfirmationEmail, sendForgotPasswordEmail, sendGetWorkerStatus, sendTestMessageToDestination, sendUserEvent, sessionStarted, setupOwner, signup, submitContactInfo, submitPersonalizationSurvey, testExternalSecretsProviderConnection, testHealthEndpoint, testLdapConnection, testSamlConfig, toggleSamlConfig, uninstallPackage, updateApiKey, updateCredentialResolver, updateCurrentUser, updateCurrentUserPassword, updateCurrentUserSettings, updateEnforceMfa, updateGlobalRole, updateLdapConfig, updateNpsSurveyState, updateOtherUserSettings, updatePackage, updateProjectRole, updateProvider, validatePasswordToken, validateSignupToken, verifyMfaCode };
@@ -2,6 +2,7 @@ import "../utils2.mjs";
2
2
  import { a as updateApiKey, i as getApiKeys, n as deleteApiKey, r as getApiKeyScopes, t as createApiKey } from "../api-keys.mjs";
3
3
  import { a as sendConfirmationEmail, i as getCurrentUsage, n as getCloudUserInfo, o as sendUserEvent, r as getCurrentPlan, t as getAdminPanelLoginCode } from "../cloudPlans.mjs";
4
4
  import { a as updatePackage, i as uninstallPackage, n as getInstalledCommunityNodes, r as installNewPackage, t as getAvailableCommunityPackageCount } from "../communityNodes.mjs";
5
+ import { a as getCredentialResolvers, i as getCredentialResolverTypes, n as deleteCredentialResolver, o as updateCredentialResolver, r as getCredentialResolver, t as createCredentialResolver } from "../credentialResolvers.mjs";
5
6
  import { t as getBecomeCreatorCta } from "../ctas.mjs";
6
7
  import { a as saveDestinationToDb, i as hasDestinationId, n as getDestinationsFromBackend, o as sendTestMessageToDestination, r as getEventNamesFromBackend, t as deleteDestinationFromDb } from "../eventbus.ee.mjs";
7
8
  import { t as sessionStarted } from "../events.mjs";
@@ -27,4 +28,4 @@ import { t as findWebhook } from "../webhooks.mjs";
27
28
  import { n as getWorkflowVersion, t as getWorkflowHistory } from "../workflowHistory.mjs";
28
29
  import "../api.mjs";
29
30
 
30
- export { activateLicenseKey, canEnableMFA, changePassword, connectProvider, createApiKey, createProjectRole, deleteApiKey, deleteDestinationFromDb, deleteProjectRole, deleteUser, disableMfa, dismissBannerPermanently, enableMfa, fetchCommunityNodeAttributes, fetchCommunityNodeTypes, findWebhook, getAdminPanelLoginCode, getApiKeyScopes, getApiKeys, getAvailableCommunityPackageCount, getBecomeCreatorCta, getCategories, getCloudUserInfo, getCollectionById, getCollections, getCurrentPlan, getCurrentUsage, getDestinationsFromBackend, getEventNamesFromBackend, getExternalSecrets, getExternalSecretsProvider, getExternalSecretsProviders, getInstalledCommunityNodes, getInviteLink, getLdapConfig, getLdapSynchronizations, getLicense, getLocalResourceMapperFields, getMfaQR, getModuleSettings, getNextVersions, getNodeParameterActionResult, getNodeParameterOptions, getNodeTranslationHeaders, getNodeTypes, getNodesInformation, getOidcConfig, getPasswordResetLink, getPromptsData, getProvisioningConfig, getResourceLocatorResults, getResourceMapperFields, getRoleBySlug, getRoles, getSamlConfig, getSamlMetadata, getSettings, getTemplateById, getThirdPartyLicenses, getUsers, getWhatsNewSection, getWorkflowHistory, getWorkflowTemplate, getWorkflowVersion, getWorkflows, hasDestinationId, initOidcLogin, initSSO, installNewPackage, login, loginCurrentUser, logout, registerCommunityEdition, reloadProvider, renewLicense, requestLicenseTrial, runLdapSync, saveDestinationToDb, saveOidcConfig, saveProvisioningConfig, saveSamlConfig, sendConfirmationEmail, sendForgotPasswordEmail, sendGetWorkerStatus, sendTestMessageToDestination, sendUserEvent, sessionStarted, setupOwner, signup, submitContactInfo, submitPersonalizationSurvey, testExternalSecretsProviderConnection, testHealthEndpoint, testLdapConnection, testSamlConfig, toggleSamlConfig, uninstallPackage, updateApiKey, updateCurrentUser, updateCurrentUserPassword, updateCurrentUserSettings, updateEnforceMfa, updateGlobalRole, updateLdapConfig, updateNpsSurveyState, updateOtherUserSettings, updatePackage, updateProjectRole, updateProvider, validatePasswordToken, validateSignupToken, verifyMfaCode };
31
+ export { activateLicenseKey, canEnableMFA, changePassword, connectProvider, createApiKey, createCredentialResolver, createProjectRole, deleteApiKey, deleteCredentialResolver, deleteDestinationFromDb, deleteProjectRole, deleteUser, disableMfa, dismissBannerPermanently, enableMfa, fetchCommunityNodeAttributes, fetchCommunityNodeTypes, findWebhook, getAdminPanelLoginCode, getApiKeyScopes, getApiKeys, getAvailableCommunityPackageCount, getBecomeCreatorCta, getCategories, getCloudUserInfo, getCollectionById, getCollections, getCredentialResolver, getCredentialResolverTypes, getCredentialResolvers, getCurrentPlan, getCurrentUsage, getDestinationsFromBackend, getEventNamesFromBackend, getExternalSecrets, getExternalSecretsProvider, getExternalSecretsProviders, getInstalledCommunityNodes, getInviteLink, getLdapConfig, getLdapSynchronizations, getLicense, getLocalResourceMapperFields, getMfaQR, getModuleSettings, getNextVersions, getNodeParameterActionResult, getNodeParameterOptions, getNodeTranslationHeaders, getNodeTypes, getNodesInformation, getOidcConfig, getPasswordResetLink, getPromptsData, getProvisioningConfig, getResourceLocatorResults, getResourceMapperFields, getRoleBySlug, getRoles, getSamlConfig, getSamlMetadata, getSettings, getTemplateById, getThirdPartyLicenses, getUsers, getWhatsNewSection, getWorkflowHistory, getWorkflowTemplate, getWorkflowVersion, getWorkflows, hasDestinationId, initOidcLogin, initSSO, installNewPackage, login, loginCurrentUser, logout, registerCommunityEdition, reloadProvider, renewLicense, requestLicenseTrial, runLdapSync, saveDestinationToDb, saveOidcConfig, saveProvisioningConfig, saveSamlConfig, sendConfirmationEmail, sendForgotPasswordEmail, sendGetWorkerStatus, sendTestMessageToDestination, sendUserEvent, sessionStarted, setupOwner, signup, submitContactInfo, submitPersonalizationSurvey, testExternalSecretsProviderConnection, testHealthEndpoint, testLdapConnection, testSamlConfig, toggleSamlConfig, uninstallPackage, updateApiKey, updateCredentialResolver, updateCurrentUser, updateCurrentUserPassword, updateCurrentUserSettings, updateEnforceMfa, updateGlobalRole, updateLdapConfig, updateNpsSurveyState, updateOtherUserSettings, updatePackage, updateProjectRole, updateProvider, validatePasswordToken, validateSignupToken, verifyMfaCode };
@@ -0,0 +1,60 @@
1
+ const require_utils = require('./utils2.cjs');
2
+
3
+ //#region src/api/credentialResolvers.ts
4
+ async function getCredentialResolvers(context) {
5
+ return await require_utils.makeRestApiRequest(context, "GET", "/credential-resolvers");
6
+ }
7
+ async function getCredentialResolverTypes(context) {
8
+ return await require_utils.makeRestApiRequest(context, "GET", "/credential-resolvers/types");
9
+ }
10
+ async function getCredentialResolver(context, resolverId) {
11
+ return await require_utils.makeRestApiRequest(context, "GET", `/credential-resolvers/${resolverId}`);
12
+ }
13
+ async function createCredentialResolver(context, payload) {
14
+ return await require_utils.makeRestApiRequest(context, "POST", "/credential-resolvers", payload);
15
+ }
16
+ async function updateCredentialResolver(context, resolverId, payload) {
17
+ return await require_utils.makeRestApiRequest(context, "PATCH", `/credential-resolvers/${resolverId}`, payload);
18
+ }
19
+ async function deleteCredentialResolver(context, resolverId) {
20
+ return await require_utils.makeRestApiRequest(context, "DELETE", `/credential-resolvers/${resolverId}`);
21
+ }
22
+
23
+ //#endregion
24
+ Object.defineProperty(exports, 'createCredentialResolver', {
25
+ enumerable: true,
26
+ get: function () {
27
+ return createCredentialResolver;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, 'deleteCredentialResolver', {
31
+ enumerable: true,
32
+ get: function () {
33
+ return deleteCredentialResolver;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, 'getCredentialResolver', {
37
+ enumerable: true,
38
+ get: function () {
39
+ return getCredentialResolver;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, 'getCredentialResolverTypes', {
43
+ enumerable: true,
44
+ get: function () {
45
+ return getCredentialResolverTypes;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, 'getCredentialResolvers', {
49
+ enumerable: true,
50
+ get: function () {
51
+ return getCredentialResolvers;
52
+ }
53
+ });
54
+ Object.defineProperty(exports, 'updateCredentialResolver', {
55
+ enumerable: true,
56
+ get: function () {
57
+ return updateCredentialResolver;
58
+ }
59
+ });
60
+ //# sourceMappingURL=credentialResolvers.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentialResolvers.cjs","names":["makeRestApiRequest"],"sources":["../src/api/credentialResolvers.ts"],"sourcesContent":["import type { CredentialResolver, CredentialResolverType } from '@n8n/api-types';\n\nimport type { IRestApiContext } from '../types';\nimport { makeRestApiRequest } from '../utils';\n\nexport async function getCredentialResolvers(\n\tcontext: IRestApiContext,\n): Promise<CredentialResolver[]> {\n\treturn await makeRestApiRequest(context, 'GET', '/credential-resolvers');\n}\n\nexport async function getCredentialResolverTypes(\n\tcontext: IRestApiContext,\n): Promise<CredentialResolverType[]> {\n\treturn await makeRestApiRequest(context, 'GET', '/credential-resolvers/types');\n}\n\nexport async function getCredentialResolver(\n\tcontext: IRestApiContext,\n\tresolverId: string,\n): Promise<CredentialResolver> {\n\treturn await makeRestApiRequest(context, 'GET', `/credential-resolvers/${resolverId}`);\n}\n\nexport async function createCredentialResolver(\n\tcontext: IRestApiContext,\n\tpayload: { name: string; type: string; config: Record<string, unknown> },\n): Promise<CredentialResolver> {\n\treturn await makeRestApiRequest(context, 'POST', '/credential-resolvers', payload);\n}\n\nexport async function updateCredentialResolver(\n\tcontext: IRestApiContext,\n\tresolverId: string,\n\tpayload: { name: string; type: string; config: Record<string, unknown> },\n): Promise<CredentialResolver> {\n\treturn await makeRestApiRequest(context, 'PATCH', `/credential-resolvers/${resolverId}`, payload);\n}\n\nexport async function deleteCredentialResolver(\n\tcontext: IRestApiContext,\n\tresolverId: string,\n): Promise<void> {\n\treturn await makeRestApiRequest(context, 'DELETE', `/credential-resolvers/${resolverId}`);\n}\n"],"mappings":";;;AAKA,eAAsB,uBACrB,SACgC;AAChC,QAAO,MAAMA,iCAAmB,SAAS,OAAO,wBAAwB;;AAGzE,eAAsB,2BACrB,SACoC;AACpC,QAAO,MAAMA,iCAAmB,SAAS,OAAO,8BAA8B;;AAG/E,eAAsB,sBACrB,SACA,YAC8B;AAC9B,QAAO,MAAMA,iCAAmB,SAAS,OAAO,yBAAyB,aAAa;;AAGvF,eAAsB,yBACrB,SACA,SAC8B;AAC9B,QAAO,MAAMA,iCAAmB,SAAS,QAAQ,yBAAyB,QAAQ;;AAGnF,eAAsB,yBACrB,SACA,YACA,SAC8B;AAC9B,QAAO,MAAMA,iCAAmB,SAAS,SAAS,yBAAyB,cAAc,QAAQ;;AAGlG,eAAsB,yBACrB,SACA,YACgB;AAChB,QAAO,MAAMA,iCAAmB,SAAS,UAAU,yBAAyB,aAAa"}
@@ -0,0 +1,21 @@
1
+ import { t as IRestApiContext } from "./types2.cjs";
2
+ import { CredentialResolver, CredentialResolverType } from "@n8n/api-types";
3
+
4
+ //#region src/api/credentialResolvers.d.ts
5
+ declare function getCredentialResolvers(context: IRestApiContext): Promise<CredentialResolver[]>;
6
+ declare function getCredentialResolverTypes(context: IRestApiContext): Promise<CredentialResolverType[]>;
7
+ declare function getCredentialResolver(context: IRestApiContext, resolverId: string): Promise<CredentialResolver>;
8
+ declare function createCredentialResolver(context: IRestApiContext, payload: {
9
+ name: string;
10
+ type: string;
11
+ config: Record<string, unknown>;
12
+ }): Promise<CredentialResolver>;
13
+ declare function updateCredentialResolver(context: IRestApiContext, resolverId: string, payload: {
14
+ name: string;
15
+ type: string;
16
+ config: Record<string, unknown>;
17
+ }): Promise<CredentialResolver>;
18
+ declare function deleteCredentialResolver(context: IRestApiContext, resolverId: string): Promise<void>;
19
+ //#endregion
20
+ export { getCredentialResolvers as a, getCredentialResolverTypes as i, deleteCredentialResolver as n, updateCredentialResolver as o, getCredentialResolver as r, createCredentialResolver as t };
21
+ //# sourceMappingURL=credentialResolvers.d.cts.map
@@ -0,0 +1,21 @@
1
+ import { t as IRestApiContext } from "./types2.mjs";
2
+ import { CredentialResolver, CredentialResolverType } from "@n8n/api-types";
3
+
4
+ //#region src/api/credentialResolvers.d.ts
5
+ declare function getCredentialResolvers(context: IRestApiContext): Promise<CredentialResolver[]>;
6
+ declare function getCredentialResolverTypes(context: IRestApiContext): Promise<CredentialResolverType[]>;
7
+ declare function getCredentialResolver(context: IRestApiContext, resolverId: string): Promise<CredentialResolver>;
8
+ declare function createCredentialResolver(context: IRestApiContext, payload: {
9
+ name: string;
10
+ type: string;
11
+ config: Record<string, unknown>;
12
+ }): Promise<CredentialResolver>;
13
+ declare function updateCredentialResolver(context: IRestApiContext, resolverId: string, payload: {
14
+ name: string;
15
+ type: string;
16
+ config: Record<string, unknown>;
17
+ }): Promise<CredentialResolver>;
18
+ declare function deleteCredentialResolver(context: IRestApiContext, resolverId: string): Promise<void>;
19
+ //#endregion
20
+ export { getCredentialResolvers as a, getCredentialResolverTypes as i, deleteCredentialResolver as n, updateCredentialResolver as o, getCredentialResolver as r, createCredentialResolver as t };
21
+ //# sourceMappingURL=credentialResolvers.d.mts.map
@@ -0,0 +1,25 @@
1
+ import { s as makeRestApiRequest } from "./utils2.mjs";
2
+
3
+ //#region src/api/credentialResolvers.ts
4
+ async function getCredentialResolvers(context) {
5
+ return await makeRestApiRequest(context, "GET", "/credential-resolvers");
6
+ }
7
+ async function getCredentialResolverTypes(context) {
8
+ return await makeRestApiRequest(context, "GET", "/credential-resolvers/types");
9
+ }
10
+ async function getCredentialResolver(context, resolverId) {
11
+ return await makeRestApiRequest(context, "GET", `/credential-resolvers/${resolverId}`);
12
+ }
13
+ async function createCredentialResolver(context, payload) {
14
+ return await makeRestApiRequest(context, "POST", "/credential-resolvers", payload);
15
+ }
16
+ async function updateCredentialResolver(context, resolverId, payload) {
17
+ return await makeRestApiRequest(context, "PATCH", `/credential-resolvers/${resolverId}`, payload);
18
+ }
19
+ async function deleteCredentialResolver(context, resolverId) {
20
+ return await makeRestApiRequest(context, "DELETE", `/credential-resolvers/${resolverId}`);
21
+ }
22
+
23
+ //#endregion
24
+ export { getCredentialResolvers as a, getCredentialResolverTypes as i, deleteCredentialResolver as n, updateCredentialResolver as o, getCredentialResolver as r, createCredentialResolver as t };
25
+ //# sourceMappingURL=credentialResolvers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentialResolvers.mjs","names":[],"sources":["../src/api/credentialResolvers.ts"],"sourcesContent":["import type { CredentialResolver, CredentialResolverType } from '@n8n/api-types';\n\nimport type { IRestApiContext } from '../types';\nimport { makeRestApiRequest } from '../utils';\n\nexport async function getCredentialResolvers(\n\tcontext: IRestApiContext,\n): Promise<CredentialResolver[]> {\n\treturn await makeRestApiRequest(context, 'GET', '/credential-resolvers');\n}\n\nexport async function getCredentialResolverTypes(\n\tcontext: IRestApiContext,\n): Promise<CredentialResolverType[]> {\n\treturn await makeRestApiRequest(context, 'GET', '/credential-resolvers/types');\n}\n\nexport async function getCredentialResolver(\n\tcontext: IRestApiContext,\n\tresolverId: string,\n): Promise<CredentialResolver> {\n\treturn await makeRestApiRequest(context, 'GET', `/credential-resolvers/${resolverId}`);\n}\n\nexport async function createCredentialResolver(\n\tcontext: IRestApiContext,\n\tpayload: { name: string; type: string; config: Record<string, unknown> },\n): Promise<CredentialResolver> {\n\treturn await makeRestApiRequest(context, 'POST', '/credential-resolvers', payload);\n}\n\nexport async function updateCredentialResolver(\n\tcontext: IRestApiContext,\n\tresolverId: string,\n\tpayload: { name: string; type: string; config: Record<string, unknown> },\n): Promise<CredentialResolver> {\n\treturn await makeRestApiRequest(context, 'PATCH', `/credential-resolvers/${resolverId}`, payload);\n}\n\nexport async function deleteCredentialResolver(\n\tcontext: IRestApiContext,\n\tresolverId: string,\n): Promise<void> {\n\treturn await makeRestApiRequest(context, 'DELETE', `/credential-resolvers/${resolverId}`);\n}\n"],"mappings":";;;AAKA,eAAsB,uBACrB,SACgC;AAChC,QAAO,MAAM,mBAAmB,SAAS,OAAO,wBAAwB;;AAGzE,eAAsB,2BACrB,SACoC;AACpC,QAAO,MAAM,mBAAmB,SAAS,OAAO,8BAA8B;;AAG/E,eAAsB,sBACrB,SACA,YAC8B;AAC9B,QAAO,MAAM,mBAAmB,SAAS,OAAO,yBAAyB,aAAa;;AAGvF,eAAsB,yBACrB,SACA,SAC8B;AAC9B,QAAO,MAAM,mBAAmB,SAAS,QAAQ,yBAAyB,QAAQ;;AAGnF,eAAsB,yBACrB,SACA,YACA,SAC8B;AAC9B,QAAO,MAAM,mBAAmB,SAAS,SAAS,yBAAyB,cAAc,QAAQ;;AAGlG,eAAsB,yBACrB,SACA,YACgB;AAChB,QAAO,MAAM,mBAAmB,SAAS,UAAU,yBAAyB,aAAa"}
package/dist/index.cjs CHANGED
@@ -2,6 +2,7 @@ const require_utils = require('./utils2.cjs');
2
2
  const require_api_keys = require('./api-keys.cjs');
3
3
  const require_cloudPlans = require('./cloudPlans.cjs');
4
4
  const require_communityNodes = require('./communityNodes.cjs');
5
+ const require_credentialResolvers = require('./credentialResolvers.cjs');
5
6
  const require_ctas = require('./ctas.cjs');
6
7
  const require_eventbus_ee = require('./eventbus.ee.cjs');
7
8
  const require_events = require('./events.cjs');
@@ -36,8 +37,10 @@ exports.canEnableMFA = require_mfa.canEnableMFA;
36
37
  exports.changePassword = require_users.changePassword;
37
38
  exports.connectProvider = require_externalSecrets_ee.connectProvider;
38
39
  exports.createApiKey = require_api_keys.createApiKey;
40
+ exports.createCredentialResolver = require_credentialResolvers.createCredentialResolver;
39
41
  exports.createProjectRole = require_roles.createProjectRole;
40
42
  exports.deleteApiKey = require_api_keys.deleteApiKey;
43
+ exports.deleteCredentialResolver = require_credentialResolvers.deleteCredentialResolver;
41
44
  exports.deleteDestinationFromDb = require_eventbus_ee.deleteDestinationFromDb;
42
45
  exports.deleteProjectRole = require_roles.deleteProjectRole;
43
46
  exports.deleteUser = require_users.deleteUser;
@@ -57,6 +60,9 @@ exports.getCategories = require_templates.getCategories;
57
60
  exports.getCloudUserInfo = require_cloudPlans.getCloudUserInfo;
58
61
  exports.getCollectionById = require_templates.getCollectionById;
59
62
  exports.getCollections = require_templates.getCollections;
63
+ exports.getCredentialResolver = require_credentialResolvers.getCredentialResolver;
64
+ exports.getCredentialResolverTypes = require_credentialResolvers.getCredentialResolverTypes;
65
+ exports.getCredentialResolvers = require_credentialResolvers.getCredentialResolvers;
60
66
  exports.getCurrentPlan = require_cloudPlans.getCurrentPlan;
61
67
  exports.getCurrentUsage = require_cloudPlans.getCurrentUsage;
62
68
  exports.getDestinationsFromBackend = require_eventbus_ee.getDestinationsFromBackend;
@@ -136,6 +142,7 @@ exports.testSamlConfig = require_sso.testSamlConfig;
136
142
  exports.toggleSamlConfig = require_sso.toggleSamlConfig;
137
143
  exports.uninstallPackage = require_communityNodes.uninstallPackage;
138
144
  exports.updateApiKey = require_api_keys.updateApiKey;
145
+ exports.updateCredentialResolver = require_credentialResolvers.updateCredentialResolver;
139
146
  exports.updateCurrentUser = require_users.updateCurrentUser;
140
147
  exports.updateCurrentUserPassword = require_users.updateCurrentUserPassword;
141
148
  exports.updateCurrentUserSettings = require_users.updateCurrentUserSettings;
package/dist/index.d.cts CHANGED
@@ -2,6 +2,7 @@ import { t as IRestApiContext } from "./types2.cjs";
2
2
  import { a as updateApiKey, i as getApiKeys, n as deleteApiKey, r as getApiKeyScopes, t as createApiKey } from "./api-keys.cjs";
3
3
  import { a as getCloudUserInfo, c as sendConfirmationEmail, i as getAdminPanelLoginCode, l as sendUserEvent, n as DynamicNotification, o as getCurrentPlan, r as InstanceUsage, s as getCurrentUsage, t as Cloud } from "./cloudPlans.cjs";
4
4
  import { a as updatePackage, i as uninstallPackage, n as getInstalledCommunityNodes, r as installNewPackage, t as getAvailableCommunityPackageCount } from "./communityNodes.cjs";
5
+ import { a as getCredentialResolvers, i as getCredentialResolverTypes, n as deleteCredentialResolver, o as updateCredentialResolver, r as getCredentialResolver, t as createCredentialResolver } from "./credentialResolvers.cjs";
5
6
  import { t as getBecomeCreatorCta } from "./ctas.cjs";
6
7
  import { a as hasDestinationId, i as getEventNamesFromBackend, n as deleteDestinationFromDb, o as saveDestinationToDb, r as getDestinationsFromBackend, s as sendTestMessageToDestination, t as ApiMessageEventBusDestinationOptions } from "./eventbus.ee.cjs";
7
8
  import { t as sessionStarted } from "./events.cjs";
@@ -29,4 +30,4 @@ import { t as findWebhook } from "./webhooks.cjs";
29
30
  import { a as WorkflowVersion, c as getWorkflowVersion, i as WorkflowPublishHistory, n as WorkflowHistoryActionTypes, o as WorkflowVersionId, r as WorkflowHistoryRequestParams, s as getWorkflowHistory, t as WorkflowHistory } from "./workflowHistory.cjs";
30
31
  import "./index2.cjs";
31
32
  import { a as get, c as patch, d as streamRequest, i as STREAM_SEPARATOR, l as post, n as NO_NETWORK_ERROR_CODE, o as getFullApiResponse, r as ResponseError, s as makeRestApiRequest, t as MfaRequiredError, u as request } from "./utils2.cjs";
32
- export { ApiMessageEventBusDestinationOptions, Cloud, CurrentUserResponse, DisableMfaParams, DynamicNotification, IPersonalizationLatestVersion, IPersonalizationSurveyAnswersV1, IPersonalizationSurveyAnswersV2, IPersonalizationSurveyAnswersV3, IPersonalizationSurveyVersions, IRestApiContext, ITag, ITemplatesCategory, ITemplatesCollection, ITemplatesCollectionFull, ITemplatesCollectionResponse, ITemplatesNode, ITemplatesQuery, ITemplatesWorkflow, ITemplatesWorkflowFull, ITemplatesWorkflowInfo, ITemplatesWorkflowResponse, IUser, IUserResponse, IWorkflowTemplate, IWorkflowTemplateNode, IWorkflowTemplateNodeCredentials, InstanceUsage, LdapConfig, LdapSyncData, LdapSyncTable, MfaRequiredError, N8nPromptResponse, N8nPrompts, NO_NETWORK_ERROR_CODE, ProvisioningConfig, ResponseError, STREAM_SEPARATOR, SamlPreferencesExtractedData, TemplateSearchFacet, UpdateGlobalRolePayload, Version, VersionNode, WhatsNewArticle, WhatsNewSection, WorkflowData, WorkflowDataCreate, WorkflowDataUpdate, WorkflowHistory, WorkflowHistoryActionTypes, WorkflowHistoryRequestParams, WorkflowMetadata, WorkflowPublishHistory, WorkflowVersion, WorkflowVersionId, activateLicenseKey, canEnableMFA, changePassword, connectProvider, createApiKey, createProjectRole, deleteApiKey, deleteDestinationFromDb, deleteProjectRole, deleteUser, disableMfa, dismissBannerPermanently, enableMfa, fetchCommunityNodeAttributes, fetchCommunityNodeTypes, findWebhook, get, getAdminPanelLoginCode, getApiKeyScopes, getApiKeys, getAvailableCommunityPackageCount, getBecomeCreatorCta, getCategories, getCloudUserInfo, getCollectionById, getCollections, getCurrentPlan, getCurrentUsage, getDestinationsFromBackend, getEventNamesFromBackend, getExternalSecrets, getExternalSecretsProvider, getExternalSecretsProviders, getFullApiResponse, getInstalledCommunityNodes, getInviteLink, getLdapConfig, getLdapSynchronizations, getLicense, getLocalResourceMapperFields, getMfaQR, getModuleSettings, getNextVersions, getNodeParameterActionResult, getNodeParameterOptions, getNodeTranslationHeaders, getNodeTypes, getNodesInformation, getOidcConfig, getPasswordResetLink, getPromptsData, getProvisioningConfig, getResourceLocatorResults, getResourceMapperFields, getRoleBySlug, getRoles, getSamlConfig, getSamlMetadata, getSettings, getTemplateById, getThirdPartyLicenses, getUsers, getWhatsNewSection, getWorkflowHistory, getWorkflowTemplate, getWorkflowVersion, getWorkflows, hasDestinationId, initOidcLogin, initSSO, installNewPackage, login, loginCurrentUser, logout, makeRestApiRequest, patch, post, registerCommunityEdition, reloadProvider, renewLicense, request, requestLicenseTrial, runLdapSync, saveDestinationToDb, saveOidcConfig, saveProvisioningConfig, saveSamlConfig, sendConfirmationEmail, sendForgotPasswordEmail, sendGetWorkerStatus, sendTestMessageToDestination, sendUserEvent, sessionStarted, setupOwner, signup, streamRequest, submitContactInfo, submitPersonalizationSurvey, testExternalSecretsProviderConnection, testHealthEndpoint, testLdapConnection, testSamlConfig, toggleSamlConfig, uninstallPackage, updateApiKey, updateCurrentUser, updateCurrentUserPassword, updateCurrentUserSettings, updateEnforceMfa, updateGlobalRole, updateLdapConfig, updateNpsSurveyState, updateOtherUserSettings, updatePackage, updateProjectRole, updateProvider, validatePasswordToken, validateSignupToken, verifyMfaCode };
33
+ export { ApiMessageEventBusDestinationOptions, Cloud, CurrentUserResponse, DisableMfaParams, DynamicNotification, IPersonalizationLatestVersion, IPersonalizationSurveyAnswersV1, IPersonalizationSurveyAnswersV2, IPersonalizationSurveyAnswersV3, IPersonalizationSurveyVersions, IRestApiContext, ITag, ITemplatesCategory, ITemplatesCollection, ITemplatesCollectionFull, ITemplatesCollectionResponse, ITemplatesNode, ITemplatesQuery, ITemplatesWorkflow, ITemplatesWorkflowFull, ITemplatesWorkflowInfo, ITemplatesWorkflowResponse, IUser, IUserResponse, IWorkflowTemplate, IWorkflowTemplateNode, IWorkflowTemplateNodeCredentials, InstanceUsage, LdapConfig, LdapSyncData, LdapSyncTable, MfaRequiredError, N8nPromptResponse, N8nPrompts, NO_NETWORK_ERROR_CODE, ProvisioningConfig, ResponseError, STREAM_SEPARATOR, SamlPreferencesExtractedData, TemplateSearchFacet, UpdateGlobalRolePayload, Version, VersionNode, WhatsNewArticle, WhatsNewSection, WorkflowData, WorkflowDataCreate, WorkflowDataUpdate, WorkflowHistory, WorkflowHistoryActionTypes, WorkflowHistoryRequestParams, WorkflowMetadata, WorkflowPublishHistory, WorkflowVersion, WorkflowVersionId, activateLicenseKey, canEnableMFA, changePassword, connectProvider, createApiKey, createCredentialResolver, createProjectRole, deleteApiKey, deleteCredentialResolver, deleteDestinationFromDb, deleteProjectRole, deleteUser, disableMfa, dismissBannerPermanently, enableMfa, fetchCommunityNodeAttributes, fetchCommunityNodeTypes, findWebhook, get, getAdminPanelLoginCode, getApiKeyScopes, getApiKeys, getAvailableCommunityPackageCount, getBecomeCreatorCta, getCategories, getCloudUserInfo, getCollectionById, getCollections, getCredentialResolver, getCredentialResolverTypes, getCredentialResolvers, getCurrentPlan, getCurrentUsage, getDestinationsFromBackend, getEventNamesFromBackend, getExternalSecrets, getExternalSecretsProvider, getExternalSecretsProviders, getFullApiResponse, getInstalledCommunityNodes, getInviteLink, getLdapConfig, getLdapSynchronizations, getLicense, getLocalResourceMapperFields, getMfaQR, getModuleSettings, getNextVersions, getNodeParameterActionResult, getNodeParameterOptions, getNodeTranslationHeaders, getNodeTypes, getNodesInformation, getOidcConfig, getPasswordResetLink, getPromptsData, getProvisioningConfig, getResourceLocatorResults, getResourceMapperFields, getRoleBySlug, getRoles, getSamlConfig, getSamlMetadata, getSettings, getTemplateById, getThirdPartyLicenses, getUsers, getWhatsNewSection, getWorkflowHistory, getWorkflowTemplate, getWorkflowVersion, getWorkflows, hasDestinationId, initOidcLogin, initSSO, installNewPackage, login, loginCurrentUser, logout, makeRestApiRequest, patch, post, registerCommunityEdition, reloadProvider, renewLicense, request, requestLicenseTrial, runLdapSync, saveDestinationToDb, saveOidcConfig, saveProvisioningConfig, saveSamlConfig, sendConfirmationEmail, sendForgotPasswordEmail, sendGetWorkerStatus, sendTestMessageToDestination, sendUserEvent, sessionStarted, setupOwner, signup, streamRequest, submitContactInfo, submitPersonalizationSurvey, testExternalSecretsProviderConnection, testHealthEndpoint, testLdapConnection, testSamlConfig, toggleSamlConfig, uninstallPackage, updateApiKey, updateCredentialResolver, updateCurrentUser, updateCurrentUserPassword, updateCurrentUserSettings, updateEnforceMfa, updateGlobalRole, updateLdapConfig, updateNpsSurveyState, updateOtherUserSettings, updatePackage, updateProjectRole, updateProvider, validatePasswordToken, validateSignupToken, verifyMfaCode };
package/dist/index.d.mts CHANGED
@@ -2,6 +2,7 @@ import { t as IRestApiContext } from "./types2.mjs";
2
2
  import { a as updateApiKey, i as getApiKeys, n as deleteApiKey, r as getApiKeyScopes, t as createApiKey } from "./api-keys.mjs";
3
3
  import { a as getCloudUserInfo, c as sendConfirmationEmail, i as getAdminPanelLoginCode, l as sendUserEvent, n as DynamicNotification, o as getCurrentPlan, r as InstanceUsage, s as getCurrentUsage, t as Cloud } from "./cloudPlans.mjs";
4
4
  import { a as updatePackage, i as uninstallPackage, n as getInstalledCommunityNodes, r as installNewPackage, t as getAvailableCommunityPackageCount } from "./communityNodes.mjs";
5
+ import { a as getCredentialResolvers, i as getCredentialResolverTypes, n as deleteCredentialResolver, o as updateCredentialResolver, r as getCredentialResolver, t as createCredentialResolver } from "./credentialResolvers.mjs";
5
6
  import { t as getBecomeCreatorCta } from "./ctas.mjs";
6
7
  import { a as hasDestinationId, i as getEventNamesFromBackend, n as deleteDestinationFromDb, o as saveDestinationToDb, r as getDestinationsFromBackend, s as sendTestMessageToDestination, t as ApiMessageEventBusDestinationOptions } from "./eventbus.ee.mjs";
7
8
  import { t as sessionStarted } from "./events.mjs";
@@ -29,4 +30,4 @@ import { t as findWebhook } from "./webhooks.mjs";
29
30
  import { a as WorkflowVersion, c as getWorkflowVersion, i as WorkflowPublishHistory, n as WorkflowHistoryActionTypes, o as WorkflowVersionId, r as WorkflowHistoryRequestParams, s as getWorkflowHistory, t as WorkflowHistory } from "./workflowHistory.mjs";
30
31
  import "./index2.mjs";
31
32
  import { a as get, c as patch, d as streamRequest, i as STREAM_SEPARATOR, l as post, n as NO_NETWORK_ERROR_CODE, o as getFullApiResponse, r as ResponseError, s as makeRestApiRequest, t as MfaRequiredError, u as request } from "./utils2.mjs";
32
- export { ApiMessageEventBusDestinationOptions, Cloud, CurrentUserResponse, DisableMfaParams, DynamicNotification, IPersonalizationLatestVersion, IPersonalizationSurveyAnswersV1, IPersonalizationSurveyAnswersV2, IPersonalizationSurveyAnswersV3, IPersonalizationSurveyVersions, IRestApiContext, ITag, ITemplatesCategory, ITemplatesCollection, ITemplatesCollectionFull, ITemplatesCollectionResponse, ITemplatesNode, ITemplatesQuery, ITemplatesWorkflow, ITemplatesWorkflowFull, ITemplatesWorkflowInfo, ITemplatesWorkflowResponse, IUser, IUserResponse, IWorkflowTemplate, IWorkflowTemplateNode, IWorkflowTemplateNodeCredentials, InstanceUsage, LdapConfig, LdapSyncData, LdapSyncTable, MfaRequiredError, N8nPromptResponse, N8nPrompts, NO_NETWORK_ERROR_CODE, ProvisioningConfig, ResponseError, STREAM_SEPARATOR, SamlPreferencesExtractedData, TemplateSearchFacet, UpdateGlobalRolePayload, Version, VersionNode, WhatsNewArticle, WhatsNewSection, WorkflowData, WorkflowDataCreate, WorkflowDataUpdate, WorkflowHistory, WorkflowHistoryActionTypes, WorkflowHistoryRequestParams, WorkflowMetadata, WorkflowPublishHistory, WorkflowVersion, WorkflowVersionId, activateLicenseKey, canEnableMFA, changePassword, connectProvider, createApiKey, createProjectRole, deleteApiKey, deleteDestinationFromDb, deleteProjectRole, deleteUser, disableMfa, dismissBannerPermanently, enableMfa, fetchCommunityNodeAttributes, fetchCommunityNodeTypes, findWebhook, get, getAdminPanelLoginCode, getApiKeyScopes, getApiKeys, getAvailableCommunityPackageCount, getBecomeCreatorCta, getCategories, getCloudUserInfo, getCollectionById, getCollections, getCurrentPlan, getCurrentUsage, getDestinationsFromBackend, getEventNamesFromBackend, getExternalSecrets, getExternalSecretsProvider, getExternalSecretsProviders, getFullApiResponse, getInstalledCommunityNodes, getInviteLink, getLdapConfig, getLdapSynchronizations, getLicense, getLocalResourceMapperFields, getMfaQR, getModuleSettings, getNextVersions, getNodeParameterActionResult, getNodeParameterOptions, getNodeTranslationHeaders, getNodeTypes, getNodesInformation, getOidcConfig, getPasswordResetLink, getPromptsData, getProvisioningConfig, getResourceLocatorResults, getResourceMapperFields, getRoleBySlug, getRoles, getSamlConfig, getSamlMetadata, getSettings, getTemplateById, getThirdPartyLicenses, getUsers, getWhatsNewSection, getWorkflowHistory, getWorkflowTemplate, getWorkflowVersion, getWorkflows, hasDestinationId, initOidcLogin, initSSO, installNewPackage, login, loginCurrentUser, logout, makeRestApiRequest, patch, post, registerCommunityEdition, reloadProvider, renewLicense, request, requestLicenseTrial, runLdapSync, saveDestinationToDb, saveOidcConfig, saveProvisioningConfig, saveSamlConfig, sendConfirmationEmail, sendForgotPasswordEmail, sendGetWorkerStatus, sendTestMessageToDestination, sendUserEvent, sessionStarted, setupOwner, signup, streamRequest, submitContactInfo, submitPersonalizationSurvey, testExternalSecretsProviderConnection, testHealthEndpoint, testLdapConnection, testSamlConfig, toggleSamlConfig, uninstallPackage, updateApiKey, updateCurrentUser, updateCurrentUserPassword, updateCurrentUserSettings, updateEnforceMfa, updateGlobalRole, updateLdapConfig, updateNpsSurveyState, updateOtherUserSettings, updatePackage, updateProjectRole, updateProvider, validatePasswordToken, validateSignupToken, verifyMfaCode };
33
+ export { ApiMessageEventBusDestinationOptions, Cloud, CurrentUserResponse, DisableMfaParams, DynamicNotification, IPersonalizationLatestVersion, IPersonalizationSurveyAnswersV1, IPersonalizationSurveyAnswersV2, IPersonalizationSurveyAnswersV3, IPersonalizationSurveyVersions, IRestApiContext, ITag, ITemplatesCategory, ITemplatesCollection, ITemplatesCollectionFull, ITemplatesCollectionResponse, ITemplatesNode, ITemplatesQuery, ITemplatesWorkflow, ITemplatesWorkflowFull, ITemplatesWorkflowInfo, ITemplatesWorkflowResponse, IUser, IUserResponse, IWorkflowTemplate, IWorkflowTemplateNode, IWorkflowTemplateNodeCredentials, InstanceUsage, LdapConfig, LdapSyncData, LdapSyncTable, MfaRequiredError, N8nPromptResponse, N8nPrompts, NO_NETWORK_ERROR_CODE, ProvisioningConfig, ResponseError, STREAM_SEPARATOR, SamlPreferencesExtractedData, TemplateSearchFacet, UpdateGlobalRolePayload, Version, VersionNode, WhatsNewArticle, WhatsNewSection, WorkflowData, WorkflowDataCreate, WorkflowDataUpdate, WorkflowHistory, WorkflowHistoryActionTypes, WorkflowHistoryRequestParams, WorkflowMetadata, WorkflowPublishHistory, WorkflowVersion, WorkflowVersionId, activateLicenseKey, canEnableMFA, changePassword, connectProvider, createApiKey, createCredentialResolver, createProjectRole, deleteApiKey, deleteCredentialResolver, deleteDestinationFromDb, deleteProjectRole, deleteUser, disableMfa, dismissBannerPermanently, enableMfa, fetchCommunityNodeAttributes, fetchCommunityNodeTypes, findWebhook, get, getAdminPanelLoginCode, getApiKeyScopes, getApiKeys, getAvailableCommunityPackageCount, getBecomeCreatorCta, getCategories, getCloudUserInfo, getCollectionById, getCollections, getCredentialResolver, getCredentialResolverTypes, getCredentialResolvers, getCurrentPlan, getCurrentUsage, getDestinationsFromBackend, getEventNamesFromBackend, getExternalSecrets, getExternalSecretsProvider, getExternalSecretsProviders, getFullApiResponse, getInstalledCommunityNodes, getInviteLink, getLdapConfig, getLdapSynchronizations, getLicense, getLocalResourceMapperFields, getMfaQR, getModuleSettings, getNextVersions, getNodeParameterActionResult, getNodeParameterOptions, getNodeTranslationHeaders, getNodeTypes, getNodesInformation, getOidcConfig, getPasswordResetLink, getPromptsData, getProvisioningConfig, getResourceLocatorResults, getResourceMapperFields, getRoleBySlug, getRoles, getSamlConfig, getSamlMetadata, getSettings, getTemplateById, getThirdPartyLicenses, getUsers, getWhatsNewSection, getWorkflowHistory, getWorkflowTemplate, getWorkflowVersion, getWorkflows, hasDestinationId, initOidcLogin, initSSO, installNewPackage, login, loginCurrentUser, logout, makeRestApiRequest, patch, post, registerCommunityEdition, reloadProvider, renewLicense, request, requestLicenseTrial, runLdapSync, saveDestinationToDb, saveOidcConfig, saveProvisioningConfig, saveSamlConfig, sendConfirmationEmail, sendForgotPasswordEmail, sendGetWorkerStatus, sendTestMessageToDestination, sendUserEvent, sessionStarted, setupOwner, signup, streamRequest, submitContactInfo, submitPersonalizationSurvey, testExternalSecretsProviderConnection, testHealthEndpoint, testLdapConnection, testSamlConfig, toggleSamlConfig, uninstallPackage, updateApiKey, updateCredentialResolver, updateCurrentUser, updateCurrentUserPassword, updateCurrentUserSettings, updateEnforceMfa, updateGlobalRole, updateLdapConfig, updateNpsSurveyState, updateOtherUserSettings, updatePackage, updateProjectRole, updateProvider, validatePasswordToken, validateSignupToken, verifyMfaCode };
package/dist/index.mjs CHANGED
@@ -2,6 +2,7 @@ import { a as get, c as patch, d as streamRequest, i as STREAM_SEPARATOR, l as p
2
2
  import { a as updateApiKey, i as getApiKeys, n as deleteApiKey, r as getApiKeyScopes, t as createApiKey } from "./api-keys.mjs";
3
3
  import { a as sendConfirmationEmail, i as getCurrentUsage, n as getCloudUserInfo, o as sendUserEvent, r as getCurrentPlan, t as getAdminPanelLoginCode } from "./cloudPlans.mjs";
4
4
  import { a as updatePackage, i as uninstallPackage, n as getInstalledCommunityNodes, r as installNewPackage, t as getAvailableCommunityPackageCount } from "./communityNodes.mjs";
5
+ import { a as getCredentialResolvers, i as getCredentialResolverTypes, n as deleteCredentialResolver, o as updateCredentialResolver, r as getCredentialResolver, t as createCredentialResolver } from "./credentialResolvers.mjs";
5
6
  import { t as getBecomeCreatorCta } from "./ctas.mjs";
6
7
  import { a as saveDestinationToDb, i as hasDestinationId, n as getDestinationsFromBackend, o as sendTestMessageToDestination, r as getEventNamesFromBackend, t as deleteDestinationFromDb } from "./eventbus.ee.mjs";
7
8
  import { t as sessionStarted } from "./events.mjs";
@@ -27,4 +28,4 @@ import { t as findWebhook } from "./webhooks.mjs";
27
28
  import { n as getWorkflowVersion, t as getWorkflowHistory } from "./workflowHistory.mjs";
28
29
  import "./api.mjs";
29
30
 
30
- export { MfaRequiredError, NO_NETWORK_ERROR_CODE, ResponseError, STREAM_SEPARATOR, activateLicenseKey, canEnableMFA, changePassword, connectProvider, createApiKey, createProjectRole, deleteApiKey, deleteDestinationFromDb, deleteProjectRole, deleteUser, disableMfa, dismissBannerPermanently, enableMfa, fetchCommunityNodeAttributes, fetchCommunityNodeTypes, findWebhook, get, getAdminPanelLoginCode, getApiKeyScopes, getApiKeys, getAvailableCommunityPackageCount, getBecomeCreatorCta, getCategories, getCloudUserInfo, getCollectionById, getCollections, getCurrentPlan, getCurrentUsage, getDestinationsFromBackend, getEventNamesFromBackend, getExternalSecrets, getExternalSecretsProvider, getExternalSecretsProviders, getFullApiResponse, getInstalledCommunityNodes, getInviteLink, getLdapConfig, getLdapSynchronizations, getLicense, getLocalResourceMapperFields, getMfaQR, getModuleSettings, getNextVersions, getNodeParameterActionResult, getNodeParameterOptions, getNodeTranslationHeaders, getNodeTypes, getNodesInformation, getOidcConfig, getPasswordResetLink, getPromptsData, getProvisioningConfig, getResourceLocatorResults, getResourceMapperFields, getRoleBySlug, getRoles, getSamlConfig, getSamlMetadata, getSettings, getTemplateById, getThirdPartyLicenses, getUsers, getWhatsNewSection, getWorkflowHistory, getWorkflowTemplate, getWorkflowVersion, getWorkflows, hasDestinationId, initOidcLogin, initSSO, installNewPackage, login, loginCurrentUser, logout, makeRestApiRequest, patch, post, registerCommunityEdition, reloadProvider, renewLicense, request, requestLicenseTrial, runLdapSync, saveDestinationToDb, saveOidcConfig, saveProvisioningConfig, saveSamlConfig, sendConfirmationEmail, sendForgotPasswordEmail, sendGetWorkerStatus, sendTestMessageToDestination, sendUserEvent, sessionStarted, setupOwner, signup, streamRequest, submitContactInfo, submitPersonalizationSurvey, testExternalSecretsProviderConnection, testHealthEndpoint, testLdapConnection, testSamlConfig, toggleSamlConfig, uninstallPackage, updateApiKey, updateCurrentUser, updateCurrentUserPassword, updateCurrentUserSettings, updateEnforceMfa, updateGlobalRole, updateLdapConfig, updateNpsSurveyState, updateOtherUserSettings, updatePackage, updateProjectRole, updateProvider, validatePasswordToken, validateSignupToken, verifyMfaCode };
31
+ export { MfaRequiredError, NO_NETWORK_ERROR_CODE, ResponseError, STREAM_SEPARATOR, activateLicenseKey, canEnableMFA, changePassword, connectProvider, createApiKey, createCredentialResolver, createProjectRole, deleteApiKey, deleteCredentialResolver, deleteDestinationFromDb, deleteProjectRole, deleteUser, disableMfa, dismissBannerPermanently, enableMfa, fetchCommunityNodeAttributes, fetchCommunityNodeTypes, findWebhook, get, getAdminPanelLoginCode, getApiKeyScopes, getApiKeys, getAvailableCommunityPackageCount, getBecomeCreatorCta, getCategories, getCloudUserInfo, getCollectionById, getCollections, getCredentialResolver, getCredentialResolverTypes, getCredentialResolvers, getCurrentPlan, getCurrentUsage, getDestinationsFromBackend, getEventNamesFromBackend, getExternalSecrets, getExternalSecretsProvider, getExternalSecretsProviders, getFullApiResponse, getInstalledCommunityNodes, getInviteLink, getLdapConfig, getLdapSynchronizations, getLicense, getLocalResourceMapperFields, getMfaQR, getModuleSettings, getNextVersions, getNodeParameterActionResult, getNodeParameterOptions, getNodeTranslationHeaders, getNodeTypes, getNodesInformation, getOidcConfig, getPasswordResetLink, getPromptsData, getProvisioningConfig, getResourceLocatorResults, getResourceMapperFields, getRoleBySlug, getRoles, getSamlConfig, getSamlMetadata, getSettings, getTemplateById, getThirdPartyLicenses, getUsers, getWhatsNewSection, getWorkflowHistory, getWorkflowTemplate, getWorkflowVersion, getWorkflows, hasDestinationId, initOidcLogin, initSSO, installNewPackage, login, loginCurrentUser, logout, makeRestApiRequest, patch, post, registerCommunityEdition, reloadProvider, renewLicense, request, requestLicenseTrial, runLdapSync, saveDestinationToDb, saveOidcConfig, saveProvisioningConfig, saveSamlConfig, sendConfirmationEmail, sendForgotPasswordEmail, sendGetWorkerStatus, sendTestMessageToDestination, sendUserEvent, sessionStarted, setupOwner, signup, streamRequest, submitContactInfo, submitPersonalizationSurvey, testExternalSecretsProviderConnection, testHealthEndpoint, testLdapConnection, testSamlConfig, toggleSamlConfig, uninstallPackage, updateApiKey, updateCredentialResolver, updateCurrentUser, updateCurrentUserPassword, updateCurrentUserSettings, updateEnforceMfa, updateGlobalRole, updateLdapConfig, updateNpsSurveyState, updateOtherUserSettings, updatePackage, updateProjectRole, updateProvider, validatePasswordToken, validateSignupToken, verifyMfaCode };
package/dist/utils2.cjs CHANGED
@@ -166,6 +166,10 @@ async function patch(baseURL, endpoint, params, headers) {
166
166
  });
167
167
  }
168
168
  async function streamRequest(context, apiEndpoint, payload, onChunk, onDone, onError, separator = STREAM_SEPARATOR, abortSignal) {
169
+ let onErrorOnce = (e) => {
170
+ onErrorOnce = void 0;
171
+ onError?.(e);
172
+ };
169
173
  const assistantRequest = {
170
174
  headers: {
171
175
  "browser-id": getBrowserId(),
@@ -185,7 +189,8 @@ async function streamRequest(context, apiEndpoint, payload, onChunk, onDone, onE
185
189
  async function readStream() {
186
190
  const { done, value } = await reader.read();
187
191
  if (done) {
188
- onDone?.();
192
+ if (response.ok) onDone?.();
193
+ else onErrorOnce?.(new ResponseError(response.statusText, { httpStatusCode: response.status }));
189
194
  return;
190
195
  }
191
196
  const chunk = decoder.decode(value);
@@ -204,19 +209,19 @@ async function streamRequest(context, apiEndpoint, payload, onChunk, onDone, onE
204
209
  if (response.ok) onChunk?.(data);
205
210
  else {
206
211
  const message = "message" in data ? data.message : response.statusText;
207
- onError?.(new ResponseError(String(message), { httpStatusCode: response.status }));
212
+ onErrorOnce?.(new ResponseError(String(message), { httpStatusCode: response.status }));
208
213
  }
209
214
  } catch (e) {
210
- if (e instanceof Error) onError?.(e);
215
+ if (e instanceof Error) onErrorOnce?.(e);
211
216
  }
212
217
  }
213
218
  await readStream();
214
219
  }
215
220
  await readStream();
216
- } else if (onError) onError(new Error(response.statusText));
221
+ } else if (onErrorOnce) onErrorOnce(new Error(response.statusText));
217
222
  } catch (e) {
218
223
  (0, __n8n_utils_assert.assert)(e instanceof Error);
219
- onError?.(e);
224
+ onErrorOnce?.(e);
220
225
  }
221
226
  }
222
227
 
@@ -1 +1 @@
1
- {"version":3,"file":"utils2.cjs","names":["BROWSER_ID_STORAGE_KEY","ApplicationError","options: AxiosRequestConfig","assistantRequest: RequestInit","data: T","e: unknown"],"sources":["../src/utils.ts"],"sourcesContent":["import { BROWSER_ID_STORAGE_KEY } from '@n8n/constants';\nimport { assert } from '@n8n/utils/assert';\nimport type { AxiosRequestConfig, Method, RawAxiosRequestHeaders } from 'axios';\nimport axios from 'axios';\nimport { ApplicationError, jsonParse } from 'n8n-workflow';\nimport type { GenericValue, IDataObject } from 'n8n-workflow';\n\nimport type { IRestApiContext } from './types';\n\nconst getBrowserId = () => {\n\tlet browserId = localStorage.getItem(BROWSER_ID_STORAGE_KEY);\n\tif (!browserId) {\n\t\tbrowserId = crypto.randomUUID();\n\t\tlocalStorage.setItem(BROWSER_ID_STORAGE_KEY, browserId);\n\t}\n\treturn browserId;\n};\n\nexport const NO_NETWORK_ERROR_CODE = 999;\nexport const STREAM_SEPARATOR = '⧉⇋⇋➽⌑⧉§§\\n';\n\nexport class MfaRequiredError extends ApplicationError {\n\tconstructor() {\n\t\tsuper('MFA is required to access this resource. Please set up MFA in your user settings.');\n\t\tthis.name = 'MfaRequiredError';\n\t}\n}\n\nexport class ResponseError extends ApplicationError {\n\t// The HTTP status code of response\n\thttpStatusCode?: number;\n\n\t// The error code in the response\n\terrorCode?: number;\n\n\t// The stack trace of the server\n\tserverStackTrace?: string;\n\n\t// Additional metadata from the server (e.g., EULA URL)\n\tmeta?: Record<string, unknown>;\n\n\t/**\n\t * Creates an instance of ResponseError.\n\t * @param {string} message The error message\n\t * @param {number} [errorCode] The error code which can be used by frontend to identify the actual error\n\t * @param {number} [httpStatusCode] The HTTP status code the response should have\n\t * @param {string} [stack] The stack trace\n\t * @param {Record<string, unknown>} [meta] Additional metadata from the server\n\t */\n\tconstructor(\n\t\tmessage: string,\n\t\toptions: {\n\t\t\terrorCode?: number;\n\t\t\thttpStatusCode?: number;\n\t\t\tstack?: string;\n\t\t\tmeta?: Record<string, unknown>;\n\t\t} = {},\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'ResponseError';\n\n\t\tconst { errorCode, httpStatusCode, stack, meta } = options;\n\t\tif (errorCode) {\n\t\t\tthis.errorCode = errorCode;\n\t\t}\n\t\tif (httpStatusCode) {\n\t\t\tthis.httpStatusCode = httpStatusCode;\n\t\t}\n\t\tif (stack) {\n\t\t\tthis.serverStackTrace = stack;\n\t\t}\n\t\tif (meta) {\n\t\t\tthis.meta = meta;\n\t\t}\n\t}\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst legacyParamSerializer = (params: Record<string, any>) =>\n\tObject.keys(params)\n\t\t.filter((key) => params[key] !== undefined)\n\t\t.map((key) => {\n\t\t\tif (Array.isArray(params[key])) {\n\t\t\t\treturn params[key].map((v: string) => `${key}[]=${encodeURIComponent(v)}`).join('&');\n\t\t\t}\n\t\t\tif (typeof params[key] === 'object') {\n\t\t\t\tparams[key] = JSON.stringify(params[key]);\n\t\t\t}\n\t\t\treturn `${key}=${encodeURIComponent(params[key])}`;\n\t\t})\n\t\t.join('&');\n\nexport async function request(config: {\n\tmethod: Method;\n\tbaseURL: string;\n\tendpoint: string;\n\theaders?: RawAxiosRequestHeaders;\n\tdata?: GenericValue | GenericValue[];\n\twithCredentials?: boolean;\n}) {\n\tconst { method, baseURL, endpoint, headers, data } = config;\n\tconst options: AxiosRequestConfig = {\n\t\tmethod,\n\t\turl: endpoint,\n\t\tbaseURL,\n\t\theaders: headers ?? {},\n\t};\n\tif (baseURL.startsWith('/')) {\n\t\toptions.headers!['browser-id'] = getBrowserId();\n\t}\n\tif (\n\t\timport.meta.env.NODE_ENV !== 'production' &&\n\t\t!baseURL.includes('api.n8n.io') &&\n\t\t!baseURL.includes('n8n.cloud')\n\t) {\n\t\toptions.withCredentials = options.withCredentials ?? true;\n\t}\n\tif (['POST', 'PATCH', 'PUT'].includes(method)) {\n\t\toptions.data = data;\n\t} else if (data) {\n\t\toptions.params = data;\n\t\toptions.paramsSerializer = legacyParamSerializer;\n\t}\n\n\ttry {\n\t\tconst response = await axios.request(options);\n\t\treturn response.data;\n\t} catch (error) {\n\t\tif (error.message === 'Network Error') {\n\t\t\tthrow new ResponseError(\"Can't connect to n8n.\", {\n\t\t\t\terrorCode: NO_NETWORK_ERROR_CODE,\n\t\t\t});\n\t\t}\n\n\t\tconst errorResponseData = error.response?.data;\n\t\tif (errorResponseData?.mfaRequired === true) {\n\t\t\tthrow new MfaRequiredError();\n\t\t}\n\t\tif (errorResponseData?.message !== undefined) {\n\t\t\tif (errorResponseData.name === 'NodeApiError') {\n\t\t\t\terrorResponseData.httpStatusCode = error.response.status;\n\t\t\t\tthrow errorResponseData;\n\t\t\t}\n\n\t\t\tthrow new ResponseError(errorResponseData.message, {\n\t\t\t\terrorCode: errorResponseData.code,\n\t\t\t\thttpStatusCode: error.response.status,\n\t\t\t\tstack: errorResponseData.stack,\n\t\t\t\tmeta: errorResponseData.meta,\n\t\t\t});\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n\n/**\n * Sends a request to the API and returns the response without extracting the data key.\n * @param context Rest API context\n * @param method HTTP method\n * @param endpoint relative path to the API endpoint\n * @param data request data\n * @returns data and total count\n */\nexport async function getFullApiResponse<T>(\n\tcontext: IRestApiContext,\n\tmethod: Method,\n\tendpoint: string,\n\tdata?: GenericValue | GenericValue[],\n) {\n\tconst response = await request({\n\t\tmethod,\n\t\tbaseURL: context.baseUrl,\n\t\tendpoint,\n\t\theaders: { 'push-ref': context.pushRef },\n\t\tdata,\n\t});\n\n\treturn response as { count: number; data: T };\n}\n\nexport async function makeRestApiRequest<T>(\n\tcontext: IRestApiContext,\n\tmethod: Method,\n\tendpoint: string,\n\tdata?: GenericValue | GenericValue[],\n) {\n\tconst response = await request({\n\t\tmethod,\n\t\tbaseURL: context.baseUrl,\n\t\tendpoint,\n\t\theaders: { 'push-ref': context.pushRef },\n\t\tdata,\n\t});\n\n\t// All cli rest api endpoints return data wrapped in `data` key\n\treturn response.data as T;\n}\n\nexport async function get(\n\tbaseURL: string,\n\tendpoint: string,\n\tparams?: IDataObject,\n\theaders?: RawAxiosRequestHeaders,\n) {\n\treturn await request({ method: 'GET', baseURL, endpoint, headers, data: params });\n}\n\nexport async function post(\n\tbaseURL: string,\n\tendpoint: string,\n\tparams?: IDataObject,\n\theaders?: RawAxiosRequestHeaders,\n) {\n\treturn await request({ method: 'POST', baseURL, endpoint, headers, data: params });\n}\n\nexport async function patch(\n\tbaseURL: string,\n\tendpoint: string,\n\tparams?: IDataObject,\n\theaders?: RawAxiosRequestHeaders,\n) {\n\treturn await request({ method: 'PATCH', baseURL, endpoint, headers, data: params });\n}\n\nexport async function streamRequest<T extends object>(\n\tcontext: IRestApiContext,\n\tapiEndpoint: string,\n\tpayload: object,\n\tonChunk?: (chunk: T) => void,\n\tonDone?: () => void,\n\tonError?: (e: Error) => void,\n\tseparator = STREAM_SEPARATOR,\n\tabortSignal?: AbortSignal,\n): Promise<void> {\n\tconst headers: Record<string, string> = {\n\t\t'browser-id': getBrowserId(),\n\t\t'Content-Type': 'application/json',\n\t};\n\tconst assistantRequest: RequestInit = {\n\t\theaders,\n\t\tmethod: 'POST',\n\t\tcredentials: 'include',\n\t\tbody: JSON.stringify(payload),\n\t\tsignal: abortSignal,\n\t};\n\ttry {\n\t\tconst response = await fetch(`${context.baseUrl}${apiEndpoint}`, assistantRequest);\n\n\t\tif (response.body) {\n\t\t\t// Handle the streaming response\n\t\t\tconst reader = response.body.getReader();\n\t\t\tconst decoder = new TextDecoder('utf-8');\n\n\t\t\tlet buffer = '';\n\n\t\t\tasync function readStream() {\n\t\t\t\tconst { done, value } = await reader.read();\n\t\t\t\tif (done) {\n\t\t\t\t\tonDone?.();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst chunk = decoder.decode(value);\n\t\t\t\tbuffer += chunk;\n\n\t\t\t\tconst splitChunks = buffer.split(separator);\n\n\t\t\t\tbuffer = '';\n\t\t\t\tfor (const splitChunk of splitChunks) {\n\t\t\t\t\tif (splitChunk) {\n\t\t\t\t\t\tlet data: T;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tdata = jsonParse<T>(splitChunk, { errorMessage: 'Invalid json' });\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\t// incomplete json. append to buffer to complete\n\t\t\t\t\t\t\tbuffer += splitChunk;\n\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tif (response.ok) {\n\t\t\t\t\t\t\t\t// Call chunk callback if request was successful\n\t\t\t\t\t\t\t\tonChunk?.(data);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Otherwise, call error callback\n\t\t\t\t\t\t\t\tconst message = 'message' in data ? data.message : response.statusText;\n\t\t\t\t\t\t\t\tonError?.(\n\t\t\t\t\t\t\t\t\tnew ResponseError(String(message), {\n\t\t\t\t\t\t\t\t\t\thttpStatusCode: response.status,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (e: unknown) {\n\t\t\t\t\t\t\tif (e instanceof Error) {\n\t\t\t\t\t\t\t\tonError?.(e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tawait readStream();\n\t\t\t}\n\n\t\t\t// Start reading the stream\n\t\t\tawait readStream();\n\t\t} else if (onError) {\n\t\t\tonError(new Error(response.statusText));\n\t\t}\n\t} catch (e: unknown) {\n\t\tassert(e instanceof Error);\n\t\tonError?.(e);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,qBAAqB;CAC1B,IAAI,YAAY,aAAa,QAAQA,uCAAuB;AAC5D,KAAI,CAAC,WAAW;AACf,cAAY,OAAO,YAAY;AAC/B,eAAa,QAAQA,wCAAwB,UAAU;;AAExD,QAAO;;AAGR,MAAa,wBAAwB;AACrC,MAAa,mBAAmB;AAEhC,IAAa,mBAAb,cAAsCC,8BAAiB;CACtD,cAAc;AACb,QAAM,oFAAoF;AAC1F,OAAK,OAAO;;;AAId,IAAa,gBAAb,cA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5B,gBAAgB;GAChB;EAGA,QAAQ;EACR,aAAa;EACb,MAAM,KAAK,UAAU,QAAQ;EAC7B,QAAQ;EACR;AACD,KAAI;EACH,MAAM,WAAW,MAAM,MAAM,GAAG,QAAQ,UAAU,eAAe,iBAAiB;AAElF,MAAI,SAAS,MAAM;GAElB,MAAM,SAAS,SAAS,KAAK,WAAW;GACxC,MAAM,UAAU,IAAI,YAAY,QAAQ;GAExC,IAAI,SAAS;GAEb,eAAe,aAAa;IAC3B,MAAM,EAAE,MAAM,UAAU,MAAM,OAAO,MAAM;AAC3C,QAAI,MAAM;AACT,eAAU;AACV;;IAED,MAAM,QAAQ,QAAQ,OAAO,MAAM;AACnC,cAAU;IAEV,MAAM,cAAc,OAAO,MAAM,UAAU;AAE3C,aAAS;AACT,SAAK,MAAM,cAAc,YACxB,KAAI,YAAY;KACf,IAAIC;AACJ,SAAI;AACH,yCAAoB,YAAY,EAAE,cAAc,gBAAgB,CAAC;cACzD,GAAG;AAEX,gBAAU;AAEV;;AAGD,SAAI;AACH,UAAI,SAAS,GAEZ,WAAU,KAAK;WACT;OAEN,MAAM,UAAU,aAAa,OAAO,KAAK,UAAU,SAAS;AAC5D,iBACC,IAAI,cAAc,OAAO,QAAQ,EAAE,EAClC,gBAAgB,SAAS,QACzB,CAAC,CACF;;cAEMC,GAAY;AACpB,UAAI,aAAa,MAChB,WAAU,EAAE;;;AAKhB,UAAM,YAAY;;AAInB,SAAM,YAAY;aACR,QACV,SAAQ,IAAI,MAAM,SAAS,WAAW,CAAC;UAEhCA,GAAY;AACpB,iCAAO,aAAa,MAAM;AAC1B,YAAU,EAAE"}
1
+ {"version":3,"file":"utils2.cjs","names":["BROWSER_ID_STORAGE_KEY","ApplicationError","options: AxiosRequestConfig","onErrorOnce: ((e: Error) => void) | undefined","assistantRequest: RequestInit","data: T","e: unknown"],"sources":["../src/utils.ts"],"sourcesContent":["import { BROWSER_ID_STORAGE_KEY } from '@n8n/constants';\nimport { assert } from '@n8n/utils/assert';\nimport type { AxiosRequestConfig, Method, RawAxiosRequestHeaders } from 'axios';\nimport axios from 'axios';\nimport { ApplicationError, jsonParse } from 'n8n-workflow';\nimport type { GenericValue, IDataObject } from 'n8n-workflow';\n\nimport type { IRestApiContext } from './types';\n\nconst getBrowserId = () => {\n\tlet browserId = localStorage.getItem(BROWSER_ID_STORAGE_KEY);\n\tif (!browserId) {\n\t\tbrowserId = crypto.randomUUID();\n\t\tlocalStorage.setItem(BROWSER_ID_STORAGE_KEY, browserId);\n\t}\n\treturn browserId;\n};\n\nexport const NO_NETWORK_ERROR_CODE = 999;\nexport const STREAM_SEPARATOR = '⧉⇋⇋➽⌑⧉§§\\n';\n\nexport class MfaRequiredError extends ApplicationError {\n\tconstructor() {\n\t\tsuper('MFA is required to access this resource. Please set up MFA in your user settings.');\n\t\tthis.name = 'MfaRequiredError';\n\t}\n}\n\nexport class ResponseError extends ApplicationError {\n\t// The HTTP status code of response\n\thttpStatusCode?: number;\n\n\t// The error code in the response\n\terrorCode?: number;\n\n\t// The stack trace of the server\n\tserverStackTrace?: string;\n\n\t// Additional metadata from the server (e.g., EULA URL)\n\tmeta?: Record<string, unknown>;\n\n\t/**\n\t * Creates an instance of ResponseError.\n\t * @param {string} message The error message\n\t * @param {number} [errorCode] The error code which can be used by frontend to identify the actual error\n\t * @param {number} [httpStatusCode] The HTTP status code the response should have\n\t * @param {string} [stack] The stack trace\n\t * @param {Record<string, unknown>} [meta] Additional metadata from the server\n\t */\n\tconstructor(\n\t\tmessage: string,\n\t\toptions: {\n\t\t\terrorCode?: number;\n\t\t\thttpStatusCode?: number;\n\t\t\tstack?: string;\n\t\t\tmeta?: Record<string, unknown>;\n\t\t} = {},\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'ResponseError';\n\n\t\tconst { errorCode, httpStatusCode, stack, meta } = options;\n\t\tif (errorCode) {\n\t\t\tthis.errorCode = errorCode;\n\t\t}\n\t\tif (httpStatusCode) {\n\t\t\tthis.httpStatusCode = httpStatusCode;\n\t\t}\n\t\tif (stack) {\n\t\t\tthis.serverStackTrace = stack;\n\t\t}\n\t\tif (meta) {\n\t\t\tthis.meta = meta;\n\t\t}\n\t}\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst legacyParamSerializer = (params: Record<string, any>) =>\n\tObject.keys(params)\n\t\t.filter((key) => params[key] !== undefined)\n\t\t.map((key) => {\n\t\t\tif (Array.isArray(params[key])) {\n\t\t\t\treturn params[key].map((v: string) => `${key}[]=${encodeURIComponent(v)}`).join('&');\n\t\t\t}\n\t\t\tif (typeof params[key] === 'object') {\n\t\t\t\tparams[key] = JSON.stringify(params[key]);\n\t\t\t}\n\t\t\treturn `${key}=${encodeURIComponent(params[key])}`;\n\t\t})\n\t\t.join('&');\n\nexport async function request(config: {\n\tmethod: Method;\n\tbaseURL: string;\n\tendpoint: string;\n\theaders?: RawAxiosRequestHeaders;\n\tdata?: GenericValue | GenericValue[];\n\twithCredentials?: boolean;\n}) {\n\tconst { method, baseURL, endpoint, headers, data } = config;\n\tconst options: AxiosRequestConfig = {\n\t\tmethod,\n\t\turl: endpoint,\n\t\tbaseURL,\n\t\theaders: headers ?? {},\n\t};\n\tif (baseURL.startsWith('/')) {\n\t\toptions.headers!['browser-id'] = getBrowserId();\n\t}\n\tif (\n\t\timport.meta.env.NODE_ENV !== 'production' &&\n\t\t!baseURL.includes('api.n8n.io') &&\n\t\t!baseURL.includes('n8n.cloud')\n\t) {\n\t\toptions.withCredentials = options.withCredentials ?? true;\n\t}\n\tif (['POST', 'PATCH', 'PUT'].includes(method)) {\n\t\toptions.data = data;\n\t} else if (data) {\n\t\toptions.params = data;\n\t\toptions.paramsSerializer = legacyParamSerializer;\n\t}\n\n\ttry {\n\t\tconst response = await axios.request(options);\n\t\treturn response.data;\n\t} catch (error) {\n\t\tif (error.message === 'Network Error') {\n\t\t\tthrow new ResponseError(\"Can't connect to n8n.\", {\n\t\t\t\terrorCode: NO_NETWORK_ERROR_CODE,\n\t\t\t});\n\t\t}\n\n\t\tconst errorResponseData = error.response?.data;\n\t\tif (errorResponseData?.mfaRequired === true) {\n\t\t\tthrow new MfaRequiredError();\n\t\t}\n\t\tif (errorResponseData?.message !== undefined) {\n\t\t\tif (errorResponseData.name === 'NodeApiError') {\n\t\t\t\terrorResponseData.httpStatusCode = error.response.status;\n\t\t\t\tthrow errorResponseData;\n\t\t\t}\n\n\t\t\tthrow new ResponseError(errorResponseData.message, {\n\t\t\t\terrorCode: errorResponseData.code,\n\t\t\t\thttpStatusCode: error.response.status,\n\t\t\t\tstack: errorResponseData.stack,\n\t\t\t\tmeta: errorResponseData.meta,\n\t\t\t});\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n\n/**\n * Sends a request to the API and returns the response without extracting the data key.\n * @param context Rest API context\n * @param method HTTP method\n * @param endpoint relative path to the API endpoint\n * @param data request data\n * @returns data and total count\n */\nexport async function getFullApiResponse<T>(\n\tcontext: IRestApiContext,\n\tmethod: Method,\n\tendpoint: string,\n\tdata?: GenericValue | GenericValue[],\n) {\n\tconst response = await request({\n\t\tmethod,\n\t\tbaseURL: context.baseUrl,\n\t\tendpoint,\n\t\theaders: { 'push-ref': context.pushRef },\n\t\tdata,\n\t});\n\n\treturn response as { count: number; data: T };\n}\n\nexport async function makeRestApiRequest<T>(\n\tcontext: IRestApiContext,\n\tmethod: Method,\n\tendpoint: string,\n\tdata?: GenericValue | GenericValue[],\n) {\n\tconst response = await request({\n\t\tmethod,\n\t\tbaseURL: context.baseUrl,\n\t\tendpoint,\n\t\theaders: { 'push-ref': context.pushRef },\n\t\tdata,\n\t});\n\n\t// All cli rest api endpoints return data wrapped in `data` key\n\treturn response.data as T;\n}\n\nexport async function get(\n\tbaseURL: string,\n\tendpoint: string,\n\tparams?: IDataObject,\n\theaders?: RawAxiosRequestHeaders,\n) {\n\treturn await request({ method: 'GET', baseURL, endpoint, headers, data: params });\n}\n\nexport async function post(\n\tbaseURL: string,\n\tendpoint: string,\n\tparams?: IDataObject,\n\theaders?: RawAxiosRequestHeaders,\n) {\n\treturn await request({ method: 'POST', baseURL, endpoint, headers, data: params });\n}\n\nexport async function patch(\n\tbaseURL: string,\n\tendpoint: string,\n\tparams?: IDataObject,\n\theaders?: RawAxiosRequestHeaders,\n) {\n\treturn await request({ method: 'PATCH', baseURL, endpoint, headers, data: params });\n}\n\nexport async function streamRequest<T extends object>(\n\tcontext: IRestApiContext,\n\tapiEndpoint: string,\n\tpayload: object,\n\tonChunk?: (chunk: T) => void,\n\tonDone?: () => void,\n\tonError?: (e: Error) => void,\n\tseparator = STREAM_SEPARATOR,\n\tabortSignal?: AbortSignal,\n): Promise<void> {\n\tlet onErrorOnce: ((e: Error) => void) | undefined = (e: Error) => {\n\t\tonErrorOnce = undefined;\n\t\tonError?.(e);\n\t};\n\tconst headers: Record<string, string> = {\n\t\t'browser-id': getBrowserId(),\n\t\t'Content-Type': 'application/json',\n\t};\n\tconst assistantRequest: RequestInit = {\n\t\theaders,\n\t\tmethod: 'POST',\n\t\tcredentials: 'include',\n\t\tbody: JSON.stringify(payload),\n\t\tsignal: abortSignal,\n\t};\n\ttry {\n\t\tconst response = await fetch(`${context.baseUrl}${apiEndpoint}`, assistantRequest);\n\n\t\tif (response.body) {\n\t\t\t// Handle the streaming response\n\t\t\tconst reader = response.body.getReader();\n\t\t\tconst decoder = new TextDecoder('utf-8');\n\n\t\t\tlet buffer = '';\n\n\t\t\tasync function readStream() {\n\t\t\t\tconst { done, value } = await reader.read();\n\t\t\t\tif (done) {\n\t\t\t\t\tif (response.ok) {\n\t\t\t\t\t\tonDone?.();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tonErrorOnce?.(\n\t\t\t\t\t\t\tnew ResponseError(response.statusText, {\n\t\t\t\t\t\t\t\thttpStatusCode: response.status,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst chunk = decoder.decode(value);\n\t\t\t\tbuffer += chunk;\n\n\t\t\t\tconst splitChunks = buffer.split(separator);\n\n\t\t\t\tbuffer = '';\n\t\t\t\tfor (const splitChunk of splitChunks) {\n\t\t\t\t\tif (splitChunk) {\n\t\t\t\t\t\tlet data: T;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tdata = jsonParse<T>(splitChunk, { errorMessage: 'Invalid json' });\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\t// incomplete json. append to buffer to complete\n\t\t\t\t\t\t\tbuffer += splitChunk;\n\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tif (response.ok) {\n\t\t\t\t\t\t\t\t// Call chunk callback if request was successful\n\t\t\t\t\t\t\t\tonChunk?.(data);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Otherwise, call error callback\n\t\t\t\t\t\t\t\tconst message = 'message' in data ? data.message : response.statusText;\n\t\t\t\t\t\t\t\tonErrorOnce?.(\n\t\t\t\t\t\t\t\t\tnew ResponseError(String(message), {\n\t\t\t\t\t\t\t\t\t\thttpStatusCode: response.status,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (e: unknown) {\n\t\t\t\t\t\t\tif (e instanceof Error) {\n\t\t\t\t\t\t\t\tonErrorOnce?.(e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tawait readStream();\n\t\t\t}\n\n\t\t\t// Start reading the stream\n\t\t\tawait readStream();\n\t\t} else if (onErrorOnce) {\n\t\t\tonErrorOnce(new Error(response.statusText));\n\t\t}\n\t} catch (e: unknown) {\n\t\tassert(e instanceof Error);\n\t\tonErrorOnce?.(e);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,qBAAqB;CAC1B,IAAI,YAAY,aAAa,QA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;AACpB,UAAI,aAAa,MAChB,eAAc,EAAE;;;AAKpB,UAAM,YAAY;;AAInB,SAAM,YAAY;aACR,YACV,aAAY,IAAI,MAAM,SAAS,WAAW,CAAC;UAEpCA,GAAY;AACpB,iCAAO,aAAa,MAAM;AAC1B,gBAAc,EAAE"}
package/dist/utils2.mjs CHANGED
@@ -142,6 +142,10 @@ async function patch(baseURL, endpoint, params, headers) {
142
142
  });
143
143
  }
144
144
  async function streamRequest(context, apiEndpoint, payload, onChunk, onDone, onError, separator = STREAM_SEPARATOR, abortSignal) {
145
+ let onErrorOnce = (e) => {
146
+ onErrorOnce = void 0;
147
+ onError?.(e);
148
+ };
145
149
  const assistantRequest = {
146
150
  headers: {
147
151
  "browser-id": getBrowserId(),
@@ -161,7 +165,8 @@ async function streamRequest(context, apiEndpoint, payload, onChunk, onDone, onE
161
165
  async function readStream() {
162
166
  const { done, value } = await reader.read();
163
167
  if (done) {
164
- onDone?.();
168
+ if (response.ok) onDone?.();
169
+ else onErrorOnce?.(new ResponseError(response.statusText, { httpStatusCode: response.status }));
165
170
  return;
166
171
  }
167
172
  const chunk = decoder.decode(value);
@@ -180,19 +185,19 @@ async function streamRequest(context, apiEndpoint, payload, onChunk, onDone, onE
180
185
  if (response.ok) onChunk?.(data);
181
186
  else {
182
187
  const message = "message" in data ? data.message : response.statusText;
183
- onError?.(new ResponseError(String(message), { httpStatusCode: response.status }));
188
+ onErrorOnce?.(new ResponseError(String(message), { httpStatusCode: response.status }));
184
189
  }
185
190
  } catch (e) {
186
- if (e instanceof Error) onError?.(e);
191
+ if (e instanceof Error) onErrorOnce?.(e);
187
192
  }
188
193
  }
189
194
  await readStream();
190
195
  }
191
196
  await readStream();
192
- } else if (onError) onError(new Error(response.statusText));
197
+ } else if (onErrorOnce) onErrorOnce(new Error(response.statusText));
193
198
  } catch (e) {
194
199
  assert(e instanceof Error);
195
- onError?.(e);
200
+ onErrorOnce?.(e);
196
201
  }
197
202
  }
198
203
 
@@ -1 +1 @@
1
- {"version":3,"file":"utils2.mjs","names":["options: AxiosRequestConfig","assistantRequest: RequestInit","data: T","e: unknown"],"sources":["../src/utils.ts"],"sourcesContent":["import { BROWSER_ID_STORAGE_KEY } from '@n8n/constants';\nimport { assert } from '@n8n/utils/assert';\nimport type { AxiosRequestConfig, Method, RawAxiosRequestHeaders } from 'axios';\nimport axios from 'axios';\nimport { ApplicationError, jsonParse } from 'n8n-workflow';\nimport type { GenericValue, IDataObject } from 'n8n-workflow';\n\nimport type { IRestApiContext } from './types';\n\nconst getBrowserId = () => {\n\tlet browserId = localStorage.getItem(BROWSER_ID_STORAGE_KEY);\n\tif (!browserId) {\n\t\tbrowserId = crypto.randomUUID();\n\t\tlocalStorage.setItem(BROWSER_ID_STORAGE_KEY, browserId);\n\t}\n\treturn browserId;\n};\n\nexport const NO_NETWORK_ERROR_CODE = 999;\nexport const STREAM_SEPARATOR = '⧉⇋⇋➽⌑⧉§§\\n';\n\nexport class MfaRequiredError extends ApplicationError {\n\tconstructor() {\n\t\tsuper('MFA is required to access this resource. Please set up MFA in your user settings.');\n\t\tthis.name = 'MfaRequiredError';\n\t}\n}\n\nexport class ResponseError extends ApplicationError {\n\t// The HTTP status code of response\n\thttpStatusCode?: number;\n\n\t// The error code in the response\n\terrorCode?: number;\n\n\t// The stack trace of the server\n\tserverStackTrace?: string;\n\n\t// Additional metadata from the server (e.g., EULA URL)\n\tmeta?: Record<string, unknown>;\n\n\t/**\n\t * Creates an instance of ResponseError.\n\t * @param {string} message The error message\n\t * @param {number} [errorCode] The error code which can be used by frontend to identify the actual error\n\t * @param {number} [httpStatusCode] The HTTP status code the response should have\n\t * @param {string} [stack] The stack trace\n\t * @param {Record<string, unknown>} [meta] Additional metadata from the server\n\t */\n\tconstructor(\n\t\tmessage: string,\n\t\toptions: {\n\t\t\terrorCode?: number;\n\t\t\thttpStatusCode?: number;\n\t\t\tstack?: string;\n\t\t\tmeta?: Record<string, unknown>;\n\t\t} = {},\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'ResponseError';\n\n\t\tconst { errorCode, httpStatusCode, stack, meta } = options;\n\t\tif (errorCode) {\n\t\t\tthis.errorCode = errorCode;\n\t\t}\n\t\tif (httpStatusCode) {\n\t\t\tthis.httpStatusCode = httpStatusCode;\n\t\t}\n\t\tif (stack) {\n\t\t\tthis.serverStackTrace = stack;\n\t\t}\n\t\tif (meta) {\n\t\t\tthis.meta = meta;\n\t\t}\n\t}\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst legacyParamSerializer = (params: Record<string, any>) =>\n\tObject.keys(params)\n\t\t.filter((key) => params[key] !== undefined)\n\t\t.map((key) => {\n\t\t\tif (Array.isArray(params[key])) {\n\t\t\t\treturn params[key].map((v: string) => `${key}[]=${encodeURIComponent(v)}`).join('&');\n\t\t\t}\n\t\t\tif (typeof params[key] === 'object') {\n\t\t\t\tparams[key] = JSON.stringify(params[key]);\n\t\t\t}\n\t\t\treturn `${key}=${encodeURIComponent(params[key])}`;\n\t\t})\n\t\t.join('&');\n\nexport async function request(config: {\n\tmethod: Method;\n\tbaseURL: string;\n\tendpoint: string;\n\theaders?: RawAxiosRequestHeaders;\n\tdata?: GenericValue | GenericValue[];\n\twithCredentials?: boolean;\n}) {\n\tconst { method, baseURL, endpoint, headers, data } = config;\n\tconst options: AxiosRequestConfig = {\n\t\tmethod,\n\t\turl: endpoint,\n\t\tbaseURL,\n\t\theaders: headers ?? {},\n\t};\n\tif (baseURL.startsWith('/')) {\n\t\toptions.headers!['browser-id'] = getBrowserId();\n\t}\n\tif (\n\t\timport.meta.env.NODE_ENV !== 'production' &&\n\t\t!baseURL.includes('api.n8n.io') &&\n\t\t!baseURL.includes('n8n.cloud')\n\t) {\n\t\toptions.withCredentials = options.withCredentials ?? true;\n\t}\n\tif (['POST', 'PATCH', 'PUT'].includes(method)) {\n\t\toptions.data = data;\n\t} else if (data) {\n\t\toptions.params = data;\n\t\toptions.paramsSerializer = legacyParamSerializer;\n\t}\n\n\ttry {\n\t\tconst response = await axios.request(options);\n\t\treturn response.data;\n\t} catch (error) {\n\t\tif (error.message === 'Network Error') {\n\t\t\tthrow new ResponseError(\"Can't connect to n8n.\", {\n\t\t\t\terrorCode: NO_NETWORK_ERROR_CODE,\n\t\t\t});\n\t\t}\n\n\t\tconst errorResponseData = error.response?.data;\n\t\tif (errorResponseData?.mfaRequired === true) {\n\t\t\tthrow new MfaRequiredError();\n\t\t}\n\t\tif (errorResponseData?.message !== undefined) {\n\t\t\tif (errorResponseData.name === 'NodeApiError') {\n\t\t\t\terrorResponseData.httpStatusCode = error.response.status;\n\t\t\t\tthrow errorResponseData;\n\t\t\t}\n\n\t\t\tthrow new ResponseError(errorResponseData.message, {\n\t\t\t\terrorCode: errorResponseData.code,\n\t\t\t\thttpStatusCode: error.response.status,\n\t\t\t\tstack: errorResponseData.stack,\n\t\t\t\tmeta: errorResponseData.meta,\n\t\t\t});\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n\n/**\n * Sends a request to the API and returns the response without extracting the data key.\n * @param context Rest API context\n * @param method HTTP method\n * @param endpoint relative path to the API endpoint\n * @param data request data\n * @returns data and total count\n */\nexport async function getFullApiResponse<T>(\n\tcontext: IRestApiContext,\n\tmethod: Method,\n\tendpoint: string,\n\tdata?: GenericValue | GenericValue[],\n) {\n\tconst response = await request({\n\t\tmethod,\n\t\tbaseURL: context.baseUrl,\n\t\tendpoint,\n\t\theaders: { 'push-ref': context.pushRef },\n\t\tdata,\n\t});\n\n\treturn response as { count: number; data: T };\n}\n\nexport async function makeRestApiRequest<T>(\n\tcontext: IRestApiContext,\n\tmethod: Method,\n\tendpoint: string,\n\tdata?: GenericValue | GenericValue[],\n) {\n\tconst response = await request({\n\t\tmethod,\n\t\tbaseURL: context.baseUrl,\n\t\tendpoint,\n\t\theaders: { 'push-ref': context.pushRef },\n\t\tdata,\n\t});\n\n\t// All cli rest api endpoints return data wrapped in `data` key\n\treturn response.data as T;\n}\n\nexport async function get(\n\tbaseURL: string,\n\tendpoint: string,\n\tparams?: IDataObject,\n\theaders?: RawAxiosRequestHeaders,\n) {\n\treturn await request({ method: 'GET', baseURL, endpoint, headers, data: params });\n}\n\nexport async function post(\n\tbaseURL: string,\n\tendpoint: string,\n\tparams?: IDataObject,\n\theaders?: RawAxiosRequestHeaders,\n) {\n\treturn await request({ method: 'POST', baseURL, endpoint, headers, data: params });\n}\n\nexport async function patch(\n\tbaseURL: string,\n\tendpoint: string,\n\tparams?: IDataObject,\n\theaders?: RawAxiosRequestHeaders,\n) {\n\treturn await request({ method: 'PATCH', baseURL, endpoint, headers, data: params });\n}\n\nexport async function streamRequest<T extends object>(\n\tcontext: IRestApiContext,\n\tapiEndpoint: string,\n\tpayload: object,\n\tonChunk?: (chunk: T) => void,\n\tonDone?: () => void,\n\tonError?: (e: Error) => void,\n\tseparator = STREAM_SEPARATOR,\n\tabortSignal?: AbortSignal,\n): Promise<void> {\n\tconst headers: Record<string, string> = {\n\t\t'browser-id': getBrowserId(),\n\t\t'Content-Type': 'application/json',\n\t};\n\tconst assistantRequest: RequestInit = {\n\t\theaders,\n\t\tmethod: 'POST',\n\t\tcredentials: 'include',\n\t\tbody: JSON.stringify(payload),\n\t\tsignal: abortSignal,\n\t};\n\ttry {\n\t\tconst response = await fetch(`${context.baseUrl}${apiEndpoint}`, assistantRequest);\n\n\t\tif (response.body) {\n\t\t\t// Handle the streaming response\n\t\t\tconst reader = response.body.getReader();\n\t\t\tconst decoder = new TextDecoder('utf-8');\n\n\t\t\tlet buffer = '';\n\n\t\t\tasync function readStream() {\n\t\t\t\tconst { done, value } = await reader.read();\n\t\t\t\tif (done) {\n\t\t\t\t\tonDone?.();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst chunk = decoder.decode(value);\n\t\t\t\tbuffer += chunk;\n\n\t\t\t\tconst splitChunks = buffer.split(separator);\n\n\t\t\t\tbuffer = '';\n\t\t\t\tfor (const splitChunk of splitChunks) {\n\t\t\t\t\tif (splitChunk) {\n\t\t\t\t\t\tlet data: T;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tdata = jsonParse<T>(splitChunk, { errorMessage: 'Invalid json' });\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\t// incomplete json. append to buffer to complete\n\t\t\t\t\t\t\tbuffer += splitChunk;\n\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tif (response.ok) {\n\t\t\t\t\t\t\t\t// Call chunk callback if request was successful\n\t\t\t\t\t\t\t\tonChunk?.(data);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Otherwise, call error callback\n\t\t\t\t\t\t\t\tconst message = 'message' in data ? data.message : response.statusText;\n\t\t\t\t\t\t\t\tonError?.(\n\t\t\t\t\t\t\t\t\tnew ResponseError(String(message), {\n\t\t\t\t\t\t\t\t\t\thttpStatusCode: response.status,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (e: unknown) {\n\t\t\t\t\t\t\tif (e instanceof Error) {\n\t\t\t\t\t\t\t\tonError?.(e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tawait readStream();\n\t\t\t}\n\n\t\t\t// Start reading the stream\n\t\t\tawait readStream();\n\t\t} else if (onError) {\n\t\t\tonError(new Error(response.statusText));\n\t\t}\n\t} catch (e: unknown) {\n\t\tassert(e instanceof Error);\n\t\tonError?.(e);\n\t}\n}\n"],"mappings":";;;;;;AASA,MAAM,qBAAqB;CAC1B,IAAI,YAAY,aAAa,QAAQ,uBAAuB;AAC5D,KAAI,CAAC,WAAW;AACf,cAAY,OAAO,YAAY;AAC/B,eAAa,QAAQ,wBAAwB,UAAU;;AAExD,QAAO;;AAGR,MAAa,wBAAwB;AACrC,MAAa,mBAAmB;AAEhC,IAAa,mBAAb,cAAsC,iBAAiB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QACA,SACA,YAAY,kBACZ,aACgB;CAKhB,MAAMC,mBAAgC;EACrC,SALuC;GACvC,cAAc,cAAc;GAC5B,gBAAgB;GAChB;EAGA,QAAQ;EACR,aAAa;EACb,MAAM,KAAK,UAAU,QAAQ;EAC7B,QAAQ;EACR;AACD,KAAI;EACH,MAAM,WAAW,MAAM,MAAM,GAAG,QAAQ,UAAU,eAAe,iBAAiB;AAElF,MAAI,SAAS,MAAM;GAElB,MAAM,SAAS,SAAS,KAAK,WAAW;GACxC,MAAM,UAAU,IAAI,YAAY,QAAQ;GAExC,IAAI,SAAS;GAEb,eAAe,aAAa;IAC3B,MAAM,EAAE,MAAM,UAAU,MAAM,OAAO,MAAM;AAC3C,QAAI,MAAM;AACT,eAAU;AACV;;IAED,MAAM,QAAQ,QAAQ,OAAO,MAAM;AACnC,cAAU;IAEV,MAAM,cAAc,OAAO,MAAM,UAAU;AAE3C,aAAS;AACT,SAAK,MAAM,cAAc,YACxB,KAAI,YAAY;KACf,IAAIC;AACJ,SAAI;AACH,aAAO,UAAa,YAAY,EAAE,cAAc,gBAAgB,CAAC;cACzD,GAAG;AAEX,gBAAU;AAEV;;AAGD,SAAI;AACH,UAAI,SAAS,GAEZ,WAAU,KAAK;WACT;OAEN,MAAM,UAAU,aAAa,OAAO,KAAK,UAAU,SAAS;AAC5D,iBACC,IAAI,cAAc,OAAO,QAAQ,EAAE,EAClC,gBAAgB,SAAS,QACzB,CAAC,CACF;;cAEMC,GAAY;AACpB,UAAI,aAAa,MAChB,WAAU,EAAE;;;AAKhB,UAAM,YAAY;;AAInB,SAAM,YAAY;aACR,QACV,SAAQ,IAAI,MAAM,SAAS,WAAW,CAAC;UAEhCA,GAAY;AACpB,SAAO,aAAa,MAAM;AAC1B,YAAU,EAAE"}
1
+ {"version":3,"file":"utils2.mjs","names":["options: AxiosRequestConfig","onErrorOnce: ((e: Error) => void) | undefined","assistantRequest: RequestInit","data: T","e: unknown"],"sources":["../src/utils.ts"],"sourcesContent":["import { BROWSER_ID_STORAGE_KEY } from '@n8n/constants';\nimport { assert } from '@n8n/utils/assert';\nimport type { AxiosRequestConfig, Method, RawAxiosRequestHeaders } from 'axios';\nimport axios from 'axios';\nimport { ApplicationError, jsonParse } from 'n8n-workflow';\nimport type { GenericValue, IDataObject } from 'n8n-workflow';\n\nimport type { IRestApiContext } from './types';\n\nconst getBrowserId = () => {\n\tlet browserId = localStorage.getItem(BROWSER_ID_STORAGE_KEY);\n\tif (!browserId) {\n\t\tbrowserId = crypto.randomUUID();\n\t\tlocalStorage.setItem(BROWSER_ID_STORAGE_KEY, browserId);\n\t}\n\treturn browserId;\n};\n\nexport const NO_NETWORK_ERROR_CODE = 999;\nexport const STREAM_SEPARATOR = '⧉⇋⇋➽⌑⧉§§\\n';\n\nexport class MfaRequiredError extends ApplicationError {\n\tconstructor() {\n\t\tsuper('MFA is required to access this resource. Please set up MFA in your user settings.');\n\t\tthis.name = 'MfaRequiredError';\n\t}\n}\n\nexport class ResponseError extends ApplicationError {\n\t// The HTTP status code of response\n\thttpStatusCode?: number;\n\n\t// The error code in the response\n\terrorCode?: number;\n\n\t// The stack trace of the server\n\tserverStackTrace?: string;\n\n\t// Additional metadata from the server (e.g., EULA URL)\n\tmeta?: Record<string, unknown>;\n\n\t/**\n\t * Creates an instance of ResponseError.\n\t * @param {string} message The error message\n\t * @param {number} [errorCode] The error code which can be used by frontend to identify the actual error\n\t * @param {number} [httpStatusCode] The HTTP status code the response should have\n\t * @param {string} [stack] The stack trace\n\t * @param {Record<string, unknown>} [meta] Additional metadata from the server\n\t */\n\tconstructor(\n\t\tmessage: string,\n\t\toptions: {\n\t\t\terrorCode?: number;\n\t\t\thttpStatusCode?: number;\n\t\t\tstack?: string;\n\t\t\tmeta?: Record<string, unknown>;\n\t\t} = {},\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'ResponseError';\n\n\t\tconst { errorCode, httpStatusCode, stack, meta } = options;\n\t\tif (errorCode) {\n\t\t\tthis.errorCode = errorCode;\n\t\t}\n\t\tif (httpStatusCode) {\n\t\t\tthis.httpStatusCode = httpStatusCode;\n\t\t}\n\t\tif (stack) {\n\t\t\tthis.serverStackTrace = stack;\n\t\t}\n\t\tif (meta) {\n\t\t\tthis.meta = meta;\n\t\t}\n\t}\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst legacyParamSerializer = (params: Record<string, any>) =>\n\tObject.keys(params)\n\t\t.filter((key) => params[key] !== undefined)\n\t\t.map((key) => {\n\t\t\tif (Array.isArray(params[key])) {\n\t\t\t\treturn params[key].map((v: string) => `${key}[]=${encodeURIComponent(v)}`).join('&');\n\t\t\t}\n\t\t\tif (typeof params[key] === 'object') {\n\t\t\t\tparams[key] = JSON.stringify(params[key]);\n\t\t\t}\n\t\t\treturn `${key}=${encodeURIComponent(params[key])}`;\n\t\t})\n\t\t.join('&');\n\nexport async function request(config: {\n\tmethod: Method;\n\tbaseURL: string;\n\tendpoint: string;\n\theaders?: RawAxiosRequestHeaders;\n\tdata?: GenericValue | GenericValue[];\n\twithCredentials?: boolean;\n}) {\n\tconst { method, baseURL, endpoint, headers, data } = config;\n\tconst options: AxiosRequestConfig = {\n\t\tmethod,\n\t\turl: endpoint,\n\t\tbaseURL,\n\t\theaders: headers ?? {},\n\t};\n\tif (baseURL.startsWith('/')) {\n\t\toptions.headers!['browser-id'] = getBrowserId();\n\t}\n\tif (\n\t\timport.meta.env.NODE_ENV !== 'production' &&\n\t\t!baseURL.includes('api.n8n.io') &&\n\t\t!baseURL.includes('n8n.cloud')\n\t) {\n\t\toptions.withCredentials = options.withCredentials ?? true;\n\t}\n\tif (['POST', 'PATCH', 'PUT'].includes(method)) {\n\t\toptions.data = data;\n\t} else if (data) {\n\t\toptions.params = data;\n\t\toptions.paramsSerializer = legacyParamSerializer;\n\t}\n\n\ttry {\n\t\tconst response = await axios.request(options);\n\t\treturn response.data;\n\t} catch (error) {\n\t\tif (error.message === 'Network Error') {\n\t\t\tthrow new ResponseError(\"Can't connect to n8n.\", {\n\t\t\t\terrorCode: NO_NETWORK_ERROR_CODE,\n\t\t\t});\n\t\t}\n\n\t\tconst errorResponseData = error.response?.data;\n\t\tif (errorResponseData?.mfaRequired === true) {\n\t\t\tthrow new MfaRequiredError();\n\t\t}\n\t\tif (errorResponseData?.message !== undefined) {\n\t\t\tif (errorResponseData.name === 'NodeApiError') {\n\t\t\t\terrorResponseData.httpStatusCode = error.response.status;\n\t\t\t\tthrow errorResponseData;\n\t\t\t}\n\n\t\t\tthrow new ResponseError(errorResponseData.message, {\n\t\t\t\terrorCode: errorResponseData.code,\n\t\t\t\thttpStatusCode: error.response.status,\n\t\t\t\tstack: errorResponseData.stack,\n\t\t\t\tmeta: errorResponseData.meta,\n\t\t\t});\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n\n/**\n * Sends a request to the API and returns the response without extracting the data key.\n * @param context Rest API context\n * @param method HTTP method\n * @param endpoint relative path to the API endpoint\n * @param data request data\n * @returns data and total count\n */\nexport async function getFullApiResponse<T>(\n\tcontext: IRestApiContext,\n\tmethod: Method,\n\tendpoint: string,\n\tdata?: GenericValue | GenericValue[],\n) {\n\tconst response = await request({\n\t\tmethod,\n\t\tbaseURL: context.baseUrl,\n\t\tendpoint,\n\t\theaders: { 'push-ref': context.pushRef },\n\t\tdata,\n\t});\n\n\treturn response as { count: number; data: T };\n}\n\nexport async function makeRestApiRequest<T>(\n\tcontext: IRestApiContext,\n\tmethod: Method,\n\tendpoint: string,\n\tdata?: GenericValue | GenericValue[],\n) {\n\tconst response = await request({\n\t\tmethod,\n\t\tbaseURL: context.baseUrl,\n\t\tendpoint,\n\t\theaders: { 'push-ref': context.pushRef },\n\t\tdata,\n\t});\n\n\t// All cli rest api endpoints return data wrapped in `data` key\n\treturn response.data as T;\n}\n\nexport async function get(\n\tbaseURL: string,\n\tendpoint: string,\n\tparams?: IDataObject,\n\theaders?: RawAxiosRequestHeaders,\n) {\n\treturn await request({ method: 'GET', baseURL, endpoint, headers, data: params });\n}\n\nexport async function post(\n\tbaseURL: string,\n\tendpoint: string,\n\tparams?: IDataObject,\n\theaders?: RawAxiosRequestHeaders,\n) {\n\treturn await request({ method: 'POST', baseURL, endpoint, headers, data: params });\n}\n\nexport async function patch(\n\tbaseURL: string,\n\tendpoint: string,\n\tparams?: IDataObject,\n\theaders?: RawAxiosRequestHeaders,\n) {\n\treturn await request({ method: 'PATCH', baseURL, endpoint, headers, data: params });\n}\n\nexport async function streamRequest<T extends object>(\n\tcontext: IRestApiContext,\n\tapiEndpoint: string,\n\tpayload: object,\n\tonChunk?: (chunk: T) => void,\n\tonDone?: () => void,\n\tonError?: (e: Error) => void,\n\tseparator = STREAM_SEPARATOR,\n\tabortSignal?: AbortSignal,\n): Promise<void> {\n\tlet onErrorOnce: ((e: Error) => void) | undefined = (e: Error) => {\n\t\tonErrorOnce = undefined;\n\t\tonError?.(e);\n\t};\n\tconst headers: Record<string, string> = {\n\t\t'browser-id': getBrowserId(),\n\t\t'Content-Type': 'application/json',\n\t};\n\tconst assistantRequest: RequestInit = {\n\t\theaders,\n\t\tmethod: 'POST',\n\t\tcredentials: 'include',\n\t\tbody: JSON.stringify(payload),\n\t\tsignal: abortSignal,\n\t};\n\ttry {\n\t\tconst response = await fetch(`${context.baseUrl}${apiEndpoint}`, assistantRequest);\n\n\t\tif (response.body) {\n\t\t\t// Handle the streaming response\n\t\t\tconst reader = response.body.getReader();\n\t\t\tconst decoder = new TextDecoder('utf-8');\n\n\t\t\tlet buffer = '';\n\n\t\t\tasync function readStream() {\n\t\t\t\tconst { done, value } = await reader.read();\n\t\t\t\tif (done) {\n\t\t\t\t\tif (response.ok) {\n\t\t\t\t\t\tonDone?.();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tonErrorOnce?.(\n\t\t\t\t\t\t\tnew ResponseError(response.statusText, {\n\t\t\t\t\t\t\t\thttpStatusCode: response.status,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst chunk = decoder.decode(value);\n\t\t\t\tbuffer += chunk;\n\n\t\t\t\tconst splitChunks = buffer.split(separator);\n\n\t\t\t\tbuffer = '';\n\t\t\t\tfor (const splitChunk of splitChunks) {\n\t\t\t\t\tif (splitChunk) {\n\t\t\t\t\t\tlet data: T;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tdata = jsonParse<T>(splitChunk, { errorMessage: 'Invalid json' });\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\t// incomplete json. append to buffer to complete\n\t\t\t\t\t\t\tbuffer += splitChunk;\n\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tif (response.ok) {\n\t\t\t\t\t\t\t\t// Call chunk callback if request was successful\n\t\t\t\t\t\t\t\tonChunk?.(data);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Otherwise, call error callback\n\t\t\t\t\t\t\t\tconst message = 'message' in data ? data.message : response.statusText;\n\t\t\t\t\t\t\t\tonErrorOnce?.(\n\t\t\t\t\t\t\t\t\tnew ResponseError(String(message), {\n\t\t\t\t\t\t\t\t\t\thttpStatusCode: response.status,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (e: unknown) {\n\t\t\t\t\t\t\tif (e instanceof Error) {\n\t\t\t\t\t\t\t\tonErrorOnce?.(e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tawait readStream();\n\t\t\t}\n\n\t\t\t// Start reading the stream\n\t\t\tawait readStream();\n\t\t} else if (onErrorOnce) {\n\t\t\tonErrorOnce(new Error(response.statusText));\n\t\t}\n\t} catch (e: unknown) {\n\t\tassert(e instanceof Error);\n\t\tonErrorOnce?.(e);\n\t}\n}\n"],"mappings":";;;;;;AASA,MAAM,qBAAqB;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AgB,SAAS,QACzB,CAAC,CACF;;cAEMC,GAAY;AACpB,UAAI,aAAa,MAChB,eAAc,EAAE;;;AAKpB,UAAM,YAAY;;AAInB,SAAM,YAAY;aACR,YACV,aAAY,IAAI,MAAM,SAAS,WAAW,CAAC;UAEpCA,GAAY;AACpB,SAAO,aAAa,MAAM;AAC1B,gBAAc,EAAE"}
@@ -36,6 +36,8 @@ interface WorkflowDataUpdate {
36
36
  parentFolderId?: string;
37
37
  uiContext?: string;
38
38
  expectedChecksum?: string;
39
+ aiBuilderAssisted?: boolean;
40
+ autosaved?: boolean;
39
41
  }
40
42
  interface WorkflowDataCreate extends WorkflowDataUpdate {
41
43
  projectId?: string;
@@ -36,6 +36,8 @@ interface WorkflowDataUpdate {
36
36
  parentFolderId?: string;
37
37
  uiContext?: string;
38
38
  expectedChecksum?: string;
39
+ aiBuilderAssisted?: boolean;
40
+ autosaved?: boolean;
39
41
  }
40
42
  interface WorkflowDataCreate extends WorkflowDataUpdate {
41
43
  projectId?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@n8n/rest-api-client",
3
3
  "type": "module",
4
- "version": "2.0.1",
4
+ "version": "2.1.0",
5
5
  "files": [
6
6
  "dist",
7
7
  "LICENSE_EE.md",
@@ -26,11 +26,11 @@
26
26
  "js-base64": "3.7.2",
27
27
  "axios": "1.12.0",
28
28
  "flatted": "3.2.7",
29
- "@n8n/api-types": "1.0.1",
30
- "@n8n/constants": "0.14.0",
31
- "@n8n/permissions": "0.43.0",
32
- "@n8n/utils": "1.20.0",
33
- "n8n-workflow": "2.0.1"
29
+ "@n8n/api-types": "1.1.0",
30
+ "@n8n/constants": "0.15.0",
31
+ "@n8n/permissions": "0.44.0",
32
+ "n8n-workflow": "2.1.0",
33
+ "@n8n/utils": "1.21.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@testing-library/jest-dom": "^6.6.3",
@@ -39,10 +39,10 @@
39
39
  "typescript": "5.9.2",
40
40
  "vite": "npm:rolldown-vite@latest",
41
41
  "vitest": "^3.1.3",
42
- "@n8n/i18n": "2.0.1",
42
+ "@n8n/eslint-config": "0.0.1",
43
+ "@n8n/i18n": "2.1.0",
43
44
  "@n8n/typescript-config": "1.3.0",
44
- "@n8n/vitest-config": "1.5.0",
45
- "@n8n/eslint-config": "0.0.1"
45
+ "@n8n/vitest-config": "1.5.0"
46
46
  },
47
47
  "license": "SEE LICENSE IN LICENSE.md",
48
48
  "homepage": "https://n8n.io",