@livechat/developer-studio-api 3.1.8 → 3.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -526,7 +526,6 @@ interface WorkflowExecutionDetails {
526
526
  type Credential = {
527
527
  name: string;
528
528
  description: string;
529
- product?: string;
530
529
  } & ({
531
530
  type: "header_auth";
532
531
  data: {
@@ -547,10 +546,40 @@ type Credential = {
547
546
  access_token_url: string;
548
547
  client_id: string;
549
548
  client_secret: string;
550
- product_fields?: Record<string, string>;
549
+ provider_name: string;
550
+ provider_fields?: Record<string, string>;
551
+ connected?: boolean;
551
552
  };
552
553
  });
553
- type CredentialDto = Credential & {
554
+ type CredentialGet = {
555
+ name: string;
556
+ description: string;
557
+ } & ({
558
+ credential_type: "header_auth";
559
+ data: {
560
+ name: string;
561
+ value: string;
562
+ };
563
+ } | {
564
+ credential_type: "basic_auth";
565
+ data: {
566
+ username: string;
567
+ password: string;
568
+ };
569
+ } | {
570
+ credential_type: "oauth2";
571
+ data: {
572
+ redirect_url: string;
573
+ authorization_url: string;
574
+ access_token_url: string;
575
+ client_id: string;
576
+ client_secret: string;
577
+ provider_name: string;
578
+ provider_fields?: Record<string, string>;
579
+ connected?: boolean;
580
+ };
581
+ });
582
+ type CredentialDto = CredentialGet & {
554
583
  created_at: string;
555
584
  updated_at: string;
556
585
  };
@@ -561,10 +590,153 @@ type DeepPartial<T> = T extends object ? {
561
590
  type CreateCredentialPayload = Credential;
562
591
  type UpdateCredentialPayload = DeepPartial<Credential>;
563
592
 
593
+ type ApiErrorName = "adapter" | "accounts" | "livechat" | "dps" | "github" | "vercel" | "netlify" | "planetscale" | "neon" | "mailchimp" | "shopify" | "text";
594
+ type ApiErrorSource = "accounts" | "github" | "vercel" | "netlify" | "planetscale" | "neon" | "mailchimp" | "shopify" | "text";
595
+ type ApiErrorKind = "unauthorized" | "error";
596
+ type ApiError<TData = unknown> = {
597
+ code: number;
598
+ message: string;
599
+ } & ({
600
+ kind: "error";
601
+ data?: TData;
602
+ } | {
603
+ kind: "unauthorized";
604
+ source: ApiErrorSource;
605
+ });
606
+ declare abstract class ApiErrorBase<TErrorData> extends Error {
607
+ message: string;
608
+ data: TErrorData;
609
+ code: number;
610
+ readonly kind: ApiErrorKind;
611
+ abstract name: ApiErrorName;
612
+ ["constructor"]: new (...args: ConstructorParameters<typeof ApiErrorBase>) => this;
613
+ constructor(message: string, data: TErrorData, code: number);
614
+ withCustomMessage(message: string): this;
615
+ }
616
+ declare class UnauthorizeApiError extends Error {
617
+ source: ApiErrorSource;
618
+ message: string;
619
+ readonly kind: ApiErrorKind;
620
+ readonly code = 401;
621
+ constructor(source: ApiErrorSource, message?: string);
622
+ withCustomMessage(_message: string): this;
623
+ }
624
+
625
+ interface ApiClientConfig {
626
+ baseURL: string;
627
+ }
628
+ interface ApiClientAuthorization {
629
+ token?: string;
630
+ tokenType?: string;
631
+ }
632
+ declare abstract class ApiClient<TError extends ApiErrorBase<TErrorData>, TErrorData = TError["data"]> {
633
+ private config;
634
+ private authorization?;
635
+ protected options?: RequestInit;
636
+ protected abstract Error: new (message: string, data: TErrorData, status: number) => TError;
637
+ protected abstract UnauthorizedError: new () => UnauthorizeApiError;
638
+ constructor(config: ApiClientConfig, authorization?: ApiClientAuthorization | undefined);
639
+ updateConfig(config: Partial<ApiClientConfig>): void;
640
+ updateAuthorization(authorization: Partial<ApiClientAuthorization>): void;
641
+ fetch<TResponseData>(url: string, customConfig?: {
642
+ authorization?: ApiClientAuthorization;
643
+ customErrorMessage?: string;
644
+ ensureAuthorization?: boolean;
645
+ }, customOptions?: RequestInit): Promise<Response & {
646
+ data: TResponseData;
647
+ }>;
648
+ get<TResponseData>(url: string, config?: {
649
+ authorization?: ApiClientAuthorization;
650
+ customErrorMessage?: string;
651
+ }, options?: Omit<RequestInit, "method" | "body">): Promise<Response & {
652
+ data: TResponseData;
653
+ }>;
654
+ post<TResponseData, TBody = unknown>(url: string, body: TBody, customConfig?: {
655
+ authorization?: ApiClientAuthorization;
656
+ customErrorMessage?: string;
657
+ }, customOptions?: Omit<RequestInit, "method" | "body">): Promise<Response & {
658
+ data: TResponseData;
659
+ }>;
660
+ patch<TResponseData, TBody = unknown>(url: string, body: TBody, customConfig?: {
661
+ authorization?: ApiClientAuthorization;
662
+ customErrorMessage?: string;
663
+ }, customOptions?: Omit<RequestInit, "method" | "body">): Promise<Response & {
664
+ data: TResponseData;
665
+ }>;
666
+ put<TResponseData, TBody = unknown>(url: string, body: TBody, customConfig?: {
667
+ authorization?: ApiClientAuthorization;
668
+ customErrorMessage?: string;
669
+ }, customOptions?: Omit<RequestInit, "method" | "body">): Promise<Response & {
670
+ data: TResponseData;
671
+ }>;
672
+ delete<TResponseData, TBody = unknown>(url: string, body: TBody, config?: {
673
+ authorization?: ApiClientAuthorization;
674
+ customErrorMessage?: string;
675
+ }, options?: Omit<RequestInit, "method" | "body">): Promise<Response & {
676
+ data: TResponseData;
677
+ }>;
678
+ }
679
+
680
+ interface SagaStep<TData = unknown, TOutput = unknown, TStatus = unknown> {
681
+ data: TData;
682
+ output: TOutput;
683
+ status: TStatus;
684
+ }
685
+ type SagaStepsSchema = Record<string, SagaStep | undefined>;
686
+ type SagaStepStatus<TData = NonNullable<unknown>> = {
687
+ isDone: boolean;
688
+ isLoading: boolean;
689
+ error?: {
690
+ message: string;
691
+ source?: ApiErrorSource;
692
+ data?: unknown;
693
+ statusCode?: number;
694
+ statusText?: string;
695
+ };
696
+ } & TData;
697
+ interface Saga<TStepSchema extends SagaStepsSchema> {
698
+ data: {
699
+ [name in keyof TStepSchema]: TStepSchema[name] extends undefined ? undefined : NonNullable<TStepSchema[name]>["data"];
700
+ };
701
+ output: {
702
+ sagaId: string;
703
+ steps: {
704
+ [name in keyof TStepSchema]: TStepSchema[name] extends undefined ? undefined : NonNullable<TStepSchema[name]>["output"];
705
+ };
706
+ isDone?: boolean;
707
+ };
708
+ status: {
709
+ [name in keyof TStepSchema]: TStepSchema[name] extends undefined ? undefined : SagaStepStatus & NonNullable<TStepSchema[name]>["status"];
710
+ };
711
+ }
712
+ type SagaInput<TSaga> = Omit<TSaga, "status">;
713
+ type SagaOutput<TSaga> = Omit<TSaga, "data">;
714
+
715
+ type SagaStepPropertyCompareResult<T> = {
716
+ isChanged: false;
717
+ } | {
718
+ isChanged: true;
719
+ value: T;
720
+ };
721
+ type SagaStepChanges<T> = {
722
+ [Key in keyof T]: SagaStepPropertyCompareResult<T[Key]>;
723
+ };
724
+ type SagaStepComparer<T> = {
725
+ [Key in keyof T]: (current: T[Key] | undefined, pending: T[Key] | undefined) => SagaStepPropertyCompareResult<T[Key]>;
726
+ };
727
+
564
728
  type TextClientAuthorization = PlatformClientAuthorization;
565
729
  interface TextClientOptions extends TextClientAuthorization {
566
730
  ensureAuthorizationToken?: boolean;
567
731
  }
732
+ declare class TextApiError extends ApiErrorBase<{
733
+ error: {
734
+ type: string;
735
+ message: string;
736
+ };
737
+ }> {
738
+ name: "text";
739
+ }
568
740
  declare const textClientInstance: axios.AxiosInstance;
569
741
  declare function getTextClientAuthorization(req: {
570
742
  headers: Record<string, string | string[] | undefined> | Headers;
@@ -789,141 +961,6 @@ type MailchimpUnsubscribeWebhookData = MailchimpWebhookConcreteData<"unsubscribe
789
961
  }>;
790
962
  type MailchimpWebhookData = MailchimpSubscribeWebhookData | MailchimpUnsubscribeWebhookData;
791
963
 
792
- type ApiErrorName = "adapter" | "accounts" | "livechat" | "dps" | "github" | "vercel" | "netlify" | "planetscale" | "neon" | "mailchimp" | "shopify";
793
- type ApiErrorSource = "accounts" | "github" | "vercel" | "netlify" | "planetscale" | "neon" | "mailchimp" | "shopify" | "text";
794
- type ApiErrorKind = "unauthorized" | "error";
795
- type ApiError<TData = unknown> = {
796
- code: number;
797
- message: string;
798
- } & ({
799
- kind: "error";
800
- data?: TData;
801
- } | {
802
- kind: "unauthorized";
803
- source: ApiErrorSource;
804
- });
805
- declare abstract class ApiErrorBase<TErrorData> extends Error {
806
- message: string;
807
- data: TErrorData;
808
- code: number;
809
- readonly kind: ApiErrorKind;
810
- abstract name: ApiErrorName;
811
- ["constructor"]: new (...args: ConstructorParameters<typeof ApiErrorBase>) => this;
812
- constructor(message: string, data: TErrorData, code: number);
813
- withCustomMessage(message: string): this;
814
- }
815
- declare class UnauthorizeApiError extends Error {
816
- source: ApiErrorSource;
817
- message: string;
818
- readonly kind: ApiErrorKind;
819
- readonly code = 401;
820
- constructor(source: ApiErrorSource, message?: string);
821
- withCustomMessage(_message: string): this;
822
- }
823
-
824
- interface ApiClientConfig {
825
- baseURL: string;
826
- }
827
- interface ApiClientAuthorization {
828
- token?: string;
829
- tokenType?: string;
830
- }
831
- declare abstract class ApiClient<TError extends ApiErrorBase<TErrorData>, TErrorData = TError["data"]> {
832
- private config;
833
- private authorization?;
834
- protected options?: RequestInit;
835
- protected abstract Error: new (message: string, data: TErrorData, status: number) => TError;
836
- protected abstract UnauthorizedError: new () => UnauthorizeApiError;
837
- constructor(config: ApiClientConfig, authorization?: ApiClientAuthorization | undefined);
838
- updateConfig(config: Partial<ApiClientConfig>): void;
839
- updateAuthorization(authorization: Partial<ApiClientAuthorization>): void;
840
- fetch<TResponseData>(url: string, customConfig?: {
841
- authorization?: ApiClientAuthorization;
842
- customErrorMessage?: string;
843
- ensureAuthorization?: boolean;
844
- }, customOptions?: RequestInit): Promise<Response & {
845
- data: TResponseData;
846
- }>;
847
- get<TResponseData>(url: string, config?: {
848
- authorization?: ApiClientAuthorization;
849
- customErrorMessage?: string;
850
- }, options?: Omit<RequestInit, "method" | "body">): Promise<Response & {
851
- data: TResponseData;
852
- }>;
853
- post<TResponseData, TBody = unknown>(url: string, body: TBody, customConfig?: {
854
- authorization?: ApiClientAuthorization;
855
- customErrorMessage?: string;
856
- }, customOptions?: Omit<RequestInit, "method" | "body">): Promise<Response & {
857
- data: TResponseData;
858
- }>;
859
- patch<TResponseData, TBody = unknown>(url: string, body: TBody, customConfig?: {
860
- authorization?: ApiClientAuthorization;
861
- customErrorMessage?: string;
862
- }, customOptions?: Omit<RequestInit, "method" | "body">): Promise<Response & {
863
- data: TResponseData;
864
- }>;
865
- put<TResponseData, TBody = unknown>(url: string, body: TBody, customConfig?: {
866
- authorization?: ApiClientAuthorization;
867
- customErrorMessage?: string;
868
- }, customOptions?: Omit<RequestInit, "method" | "body">): Promise<Response & {
869
- data: TResponseData;
870
- }>;
871
- delete<TResponseData, TBody = unknown>(url: string, body: TBody, config?: {
872
- authorization?: ApiClientAuthorization;
873
- customErrorMessage?: string;
874
- }, options?: Omit<RequestInit, "method" | "body">): Promise<Response & {
875
- data: TResponseData;
876
- }>;
877
- }
878
-
879
- interface SagaStep<TData = unknown, TOutput = unknown, TStatus = unknown> {
880
- data: TData;
881
- output: TOutput;
882
- status: TStatus;
883
- }
884
- type SagaStepsSchema = Record<string, SagaStep | undefined>;
885
- type SagaStepStatus<TData = NonNullable<unknown>> = {
886
- isDone: boolean;
887
- isLoading: boolean;
888
- error?: {
889
- message: string;
890
- source?: ApiErrorSource;
891
- data?: unknown;
892
- statusCode?: number;
893
- statusText?: string;
894
- };
895
- } & TData;
896
- interface Saga<TStepSchema extends SagaStepsSchema> {
897
- data: {
898
- [name in keyof TStepSchema]: TStepSchema[name] extends undefined ? undefined : NonNullable<TStepSchema[name]>["data"];
899
- };
900
- output: {
901
- sagaId: string;
902
- steps: {
903
- [name in keyof TStepSchema]: TStepSchema[name] extends undefined ? undefined : NonNullable<TStepSchema[name]>["output"];
904
- };
905
- isDone?: boolean;
906
- };
907
- status: {
908
- [name in keyof TStepSchema]: TStepSchema[name] extends undefined ? undefined : SagaStepStatus & NonNullable<TStepSchema[name]>["status"];
909
- };
910
- }
911
- type SagaInput<TSaga> = Omit<TSaga, "status">;
912
- type SagaOutput<TSaga> = Omit<TSaga, "data">;
913
-
914
- type SagaStepPropertyCompareResult<T> = {
915
- isChanged: false;
916
- } | {
917
- isChanged: true;
918
- value: T;
919
- };
920
- type SagaStepChanges<T> = {
921
- [Key in keyof T]: SagaStepPropertyCompareResult<T[Key]>;
922
- };
923
- type SagaStepComparer<T> = {
924
- [Key in keyof T]: (current: T[Key] | undefined, pending: T[Key] | undefined) => SagaStepPropertyCompareResult<T[Key]>;
925
- };
926
-
927
964
  interface MailchimpClientAuthorization {
928
965
  server?: string;
929
966
  token?: string;
@@ -1968,14 +2005,14 @@ declare enum ShopifyEventNames {
1968
2005
  }
1969
2006
 
1970
2007
  interface ShopifyAuthorizeActionContext {
1971
- shop?: string;
2008
+ shop: string;
1972
2009
  }
1973
- interface ShopifyAuthorizeActionResult {
2010
+ type ShopifyAuthorizeActionResult = IntegrationAuthorizeFlowResult & {
1974
2011
  shop: string;
1975
2012
  token: string;
1976
- }
1977
- type ShopifyAuthorizeFlowContext = IntegrationFlowContext & {
1978
- authorize?: ShopifyAuthorizeActionContext;
2013
+ };
2014
+ type ShopifyAuthorizeFlowContext<TCredential extends string | undefined = string> = IntegrationAuthorizeFlowContext<TCredential> & {
2015
+ authorize: ShopifyAuthorizeActionContext;
1979
2016
  };
1980
2017
  type ShopifyAuthorizeFlowResult = ShopifyAuthorizeActionResult;
1981
2018
 
@@ -4820,4 +4857,4 @@ declare function getIntegrationFlowUrl<TContext extends IntegrationFlowContext,
4820
4857
  adapterUrl: string;
4821
4858
  }): string;
4822
4859
 
4823
- export { API_NOTIFICATIONS, AccountDto, AccountsApiError, AdapterApiError, AddAppAuthorizationPayload, AddAppAuthorizationResult, AgentConfigurationDto, AgentDto, ApiClient, ApiClientAuthorization, ApiClientConfig, ApiError, ApiErrorBase, ApiErrorKind, ApiErrorName, ApiErrorSource, AppAuthorizationData, AppBaseData, AppBaseTemplate, AppDeployment, AppDeploymentBlock, AppDeploymentBlockConfig, AppDeploymentData, AppDeploymentProvider, AppDisplayData, AppEventDto, AppGitHubRepository, AppGitHubRepositoryConfig, AppInfrastructureBlocks, AppManifest, AppMonetizationData, AppMonitoringCustomReport, AppMonitoringCustomReportDataDto, AppMonitoringEvent, AppMonitoringEventData, AppMonitoringEventsLog, AppMonitoringEventsLogItem, AppMonitoringEventsReportDto, AppMonitoringReportParams, AppMonitoringUptimeReportDto, AppNeonStorage, AppNeonStorageConfig, AppNetlifyDeployment, AppNetlifyDeploymentConfig, AppPlanetScaleStorage, AppPlanetScaleStorageConfig, AppPropertiesData, AppPropertyData, AppRepository, AppRepositoryBlock, AppRepositoryBlockConfig, AppRepositoryData, AppRepositoryProvider, AppRepositoryTarget, AppRepositoryTemplate, AppRepositoryTemplates, AppResourceDto, AppStatsDto, AppStorage, AppStorageBlock, AppStorageBlockConfig, AppStorageData, AppStorageProvider, AppTemplate, AppTemplates, AppVariable, AppVariableExternalProvider, AppVariableLocalProvider, AppVariableProvider, AppVariableStatus, AppVariableType, AppVercelDeployment, AppVercelDeploymentConfig, AppWidgetData, AppWidgetsData, ApplicationAutoReviewDto, ApplicationAutoReviewPayload, ApplicationBasicDetailsDto, ApplicationBenefitDto, ApplicationChatBooster, ApplicationDto, ApplicationFeatureDto, ApplicationIconDto, ApplicationOverviewDto, ApplicationPaymentDto, ApplicationPropertyDto, ApplicationScreenshotDto, ApplicationTutorialAndSupportDto, ApplicationUsageOptionsDto, ApplicationWidget, AuthorizeData, BillingAccountDto, BillingAccountInfoDto, BillingInvoiceDto, Category, ChatDeactivatedWebhookData, ChatTransferredWebhookData, ClientDto, ClientInfoDto, ClientScopeDto, ClientWithSecretDto, CreateAppVariablePayload, CreateApplicationAuthorizationPayload, CreateApplicationChatActionPayload, CreateApplicationPayload, CreateApplicationResponse, CreateApplicationSubmissionPayload, CreateClientPayload, CreateCredentialPayload, CreateWorkflowPayload, Credential, CredentialDto, DeveloperLedgerParams, DpsApiError, EditAppVariablePayload, GetAppMonitoringCustomReportDataPayload, GetAppMonitoringEventsLogPayload, GetAppMonitoringEventsLogResponse, GetAppMonitoringEventsReportPayload, GetAppMonitoringUptimeReportPayload, GetPlanetScaleDatabasePasswordsResult, GetPlanetScaleDatabasesResult, GetPlanetScaleOrganizationsResult, GetTextPlatformDashboardReportParams, GetVercelProjectsResult, GetWorkflowPayload, GitHubAuthorizeAppActionResult, GitHubAuthorizeFlowContext, GitHubAuthorizeFlowResult, GitHubAuthorizeOauthActionResult, GitHubInstallActionContext, GitHubInstallActionResult, GitHubInstallFlowContext, GitHubInstallFlowResult, GitHubInstallation, GitHubRepository, GitHubRepositoryBranch, GitHubRepositoryHook, GitHubRepositoryIssue, GitHubRepositoryKey, GitHubRepositorySeed, GithubClientAuthorization, GithubClientOptions, IncomingChatWebhookData, IncomingEventWebhookData, IntegrationAuthorizeFlowContext, IntegrationAuthorizeFlowResult, IntegrationEvent, IntegrationEventProviderName, IntegrationEventSource, IntegrationEventSourceName, IntegrationFlowContext, IntegrationFlowOutput, IssueLabel, LinkAppDeploymentData, LinkAppDeploymentNetlifyData, LinkAppDeploymentNetlifySiteData, LinkAppDeploymentPayload, LinkAppDeploymentResult, LinkAppDeploymentVercelData, LinkAppDeploymentVercelProjectData, LinkAppRepositoryData, LinkAppRepositoryGitHubData, LinkAppRepositoryPayload, LinkAppRepositoryResult, LinkAppStorageData, LinkAppStorageNeonData, LinkAppStoragePayload, LinkAppStoragePlanetScaleData, LinkAppStoragePlanetScaleDatabaseData, LiveChatClientAuthorization, LiveChatClientOptions, LiveChatConfigurationApiError, LivechatApiError, MailchimpApiError, MailchimpAuthorizeActionResult, MailchimpAuthorizeFlowContext, MailchimpAuthorizeFlowResult, MailchimpClientAuthorization, MailchimpClientInstanceOptions, MailchimpEvent, MailchimpEventNames, MailchimpListWebhook, MailchimpSubscribeWebhookData, MailchimpUnsubscribeWebhookData, MailchimpWebhookConcreteData, MailchimpWebhookData, MailchimpWebhookDataBase, MailchimpWebhookEvents, MyAccountDto, NeonAuthorizeActionResult, NeonAuthorizeFlowContext, NeonAuthorizeFlowResult, NeonClientAuthorization, NeonClientOptions, NeonProjectBranchDto, NeonProjectBranchesDto, NeonProjectDatabaseDto, NeonProjectDatabasesDto, NeonProjectDto, NeonProjectRoleDto, NeonProjectRolesDto, NeonProjectWithConnectionUriDto, NeonProjectsDto, NeonUser, NetlifyAccount, NetlifyAuthorizeActionResult, NetlifyAuthorizeFlowContext, NetlifyAuthorizeFlowResult, NetlifyClientAuthorization, NetlifyClientOptions, NetlifyDeploy, NetlifyDeployKey, NetlifyEnv, NetlifyInstallActionContext, NetlifyInstallActionResult, NetlifyInstallFlowContext, NetlifyInstallFlowResult, NetlifySite, OrganizationDto, PatDto, PatScopeDto, PatWithSecretDto, PlanetScaleAuthorizeActionResult, PlanetScaleAuthorizeFlowContext, PlanetScaleAuthorizeFlowResult, PlanetScaleClientAuthorization, PlanetScaleClientOptions, PlanetScaleDatabase, PlanetScaleDatabasePassword, PlanetScaleOrganization, PlanetScalePaginatedResult, PlanetScalePagination, PlanetScaleUser, PlatformAccountsClientAuthorization, PlatformAccountsClientInstanceOptions, PlatformAdapterClientAuthorization, PlatformAdapterClientOptions, PlatformBillingClientAuthorization, PlatformBillingClientOptions, PlatformClientAuthorization, PlatformDpsClientAuthorization, PlatformDpsClientOptions, ProductDto, PropertiesDto, Property, PropertyAccessDto, PropertyAccessItemDto, PropertyDto, PushAppPayload, PushAppResult, PushAppSaga, PushAppSagaAuthorizationStep, PushAppSagaBaseStep, PushAppSagaDeploymentStep, PushAppSagaDisplayStep, PushAppSagaMonetizationStep, PushAppSagaPropertiesStep, PushAppSagaRepositoryStep, PushAppSagaStorageStep, PushAppSagaWidgetsStep, RemoveAppAuthorizationPayload, RemoveAppMonetizationPayload, RemoveAppPropertiesPayload, RemoveAppPropertyPayload, RemoveAppWidgetPayload, RemoveAppWidgetsPayload, ResearchCustomerItemDto, ResearchCustomerLocationItemDto, ResearchDictionaryParams, ResearchMarketplaceItemDto, ResearchMarketplaceParams, ResearchTrafficItemDto, ResearchTrafficParams, Saga, SagaInput, SagaOutput, SagaStep, SagaStepChanges, SagaStepComparer, SagaStepPropertyCompareResult, SagaStepStatus, SagaStepsSchema, ScopeDto, SeedAppRepositoryPayload, SeedAppRepositoryResult, ShopifyApiError, ShopifyAuthorizeActionContext, ShopifyAuthorizeActionResult, ShopifyAuthorizeFlowContext, ShopifyAuthorizeFlowResult, ShopifyClientAuthorization, ShopifyClientOptions, ShopifyEvent, ShopifyEventNames, ShopifyOrderCreatedWebhookData, ShopifyWebhookConcreteData, ShopifyWebhookData, ShopifyWebhookDataBase, ShopifyWebhookTopics, ShortcutDto, SubscribeToIntegrationEventPayload, SubscribeToMailchimpEventPayload, SubscribeToShopifyEventPayload, SubscribeToTextLivechatEventPayload, SyncAppVariablePayload, TextAuthorizeActionContext, TextAuthorizeActionResult, TextAuthorizeFlowContext, TextAuthorizeFlowResult, TextClientAuthorization, TextClientOptions, TextLiveChatEvent, TextLivechatEventNames, TextPlatformDashboardCreditsDto, TextPlatformDashboardPaymentDto, TextPlatformDashboardReportDto, TextPlatformDashboardReportItemDto, TriggerPayload, TriggerType, UnauthorizeAccountsApiError, UnauthorizeApiError, UnlinkAppDeploymentData, UnlinkAppDeploymentPayload, UnlinkAppRepositoryData, UnlinkAppRepositoryPayload, UnlinkAppStorageData, UnlinkAppStoragePayload, UnsubscribeFromIntegrationEventPayload, UnsubscribeFromMailchimpEventPayload, UnsubscribeFromShopifyEventPayload, UnsubscribeFromTextLivechatEventPayload, UpdateAppAuthorizationPayload, UpdateAppInfrastructureBlocksPayload, UpdateApplicationChangelogPayload, UpdateApplicationChatActionPayload, UpdateApplicationDirectInstallUrlPayload, UpdateApplicationIconPayload, UpdateApplicationOnboardingPayload, UpdateApplicationProductPayload, UpdateApplicationWebhookPayload, UpdateApplicationWidgetDto, UpdateChatWebhookPayload, UpdateClientPayload, UpdateCredentialPayload, UpdateUserFeatures, UpdateUserIntegrations, UpsertAppDeploymentPayload, UpsertAppMonetizationPayload, UpsertAppPropertiesPayload, UpsertAppPropertyPayload, UpsertAppRepositoryPayload, UpsertAppResourcePayload, UpsertAppStoragePayload, UpsertAppWidgetPayload, UpsertAppWidgetsPayload, UpsertApplicationChatBoosterPayload, UserAddedToChatWebhookData, UserDto, UserGitHubIntegrationDto, UserIntegrationsDto, UserNeonIntegrationDto, UserNetlifyIntegrationDto, UserPlanetScaleIntegrationDto, UserRemovedFromChatWebhookData, UserVercelIntegrationDto, VercelAuthorizeFlowContext, VercelAuthorizeFlowResult, VercelClientAuthorization, VercelClientOptions, VercelConnectActionContext, VercelConnectActionResult, VercelDeploy, VercelInstallActionContext, VercelInstallActionResult, VercelInstallFlowContext, VercelInstallFlowResult, VercelIntegrateActionResult, VercelNamespace, VercelPaginatedResult, VercelPagination, VercelProject, VercelProjectEnv, VercelRepository, VercelSearchRepositoryResponse, VerifyAppPayload, VerifyAppResult, Webhook, WebhookActions, WebhookChat, WebhookConcreteData, WebhookData, WebhookDataBase, WebhookDto, WebhookEvent, WebhookEvents, WebhookMessageEvent, WebhookSystemMessageEvent, WebhookSystemMessages, WebhookUser, WorkflowDefinitionAddNodeTask, WorkflowDefinitionAddTriggerTask, WorkflowDefinitionDto, WorkflowDefinitionForkJoinTask, WorkflowDefinitionHttpTask, WorkflowDefinitionJoinTask, WorkflowDefinitionSwitchTask, WorkflowDefinitionTask, WorkflowDefinitionTaskBase, WorkflowDefinitionTaskCore, WorkflowDefinitionTaskType, WorkflowDefinitionTerminateTask, WorkflowDefinitionsQueryParams, WorkflowDto, WorkflowExecution, WorkflowExecutionDetails, WorkflowExecutionPayload, WorkflowsDto, allAppTemplates, api, appBaseTemplates, appRepositoryTemplates, appRepositoryTemplatesMap, appTemplates, appTemplatesMap, getAppAutoReviewPayload, getEmptyAppAutoReview, getGitHubClientAuthorization, getGithubClientConfig, getIntegrationFlowUrl, getLiveChatClientAuthorization, getLiveChatClientConfig, getMailchimpClientAuthorization, getMailchimpClientConfig, getMailchimpClientUrl, getNeonClientAuthorization, getNeonClientConfig, getNetlifyClientAuthorization, getNetlifyClientConfig, getPlanetScaleClientAuthorization, getPlanetScaleClientConfig, getPlatformAccountsClientAuthorization, getPlatformAdapterClientAuthorization, getPlatformAdapterClientConfig, getPlatformAdapterClientDefaultConfig, getPlatformBillingClientAuthorization, getPlatformBillingClientConfig, getPlatformDpsAdminClientAuthorization, getPlatformDpsClientAuthorization, getPlatformDpsClientConfig, getRegion, getShopifyClientAuthorization, getShopifyClientConfig, getShopifyClientUrl, getTextClientAuthorization, getTextClientConfig, getVercelClientAuthorization, getVercelClientConfig, githubClientInstance, initApi, initGithubClient, initLiveChatClient, initMailchimpClient, initNeonClient, initNetlifyClient, initPlanetScaleClient, initPlatformAccountsClient, initPlatformAdapterClient, initPlatformBillingClient, initPlatformDpsClient, initShopifyClient, initTextClient, initVercelClient, integrationEventsZods, livechatClientInstance, mailchimpClientInstance, mailchimpEventsZods, neonClientInstance, netlifyClientInstance, planetScaleClientInstance, platformAccountsClientInstance, platformAdapterClientInstance, platformBillingClientInstance, platformDpsClientInstance, shopifyClientInstance, shopifyEventsZods, textClientInstance, textLivechatEventsZods, updateGithubClient, updateMailchimpClient, updateNeonClient, updateNetlifyClient, updatePlanetScaleClient, updatePlatformAdapterClient, updateShopifyClient, updateTextClient, updateVercelClient, vercelClientInstance };
4860
+ export { API_NOTIFICATIONS, AccountDto, AccountsApiError, AdapterApiError, AddAppAuthorizationPayload, AddAppAuthorizationResult, AgentConfigurationDto, AgentDto, ApiClient, ApiClientAuthorization, ApiClientConfig, ApiError, ApiErrorBase, ApiErrorKind, ApiErrorName, ApiErrorSource, AppAuthorizationData, AppBaseData, AppBaseTemplate, AppDeployment, AppDeploymentBlock, AppDeploymentBlockConfig, AppDeploymentData, AppDeploymentProvider, AppDisplayData, AppEventDto, AppGitHubRepository, AppGitHubRepositoryConfig, AppInfrastructureBlocks, AppManifest, AppMonetizationData, AppMonitoringCustomReport, AppMonitoringCustomReportDataDto, AppMonitoringEvent, AppMonitoringEventData, AppMonitoringEventsLog, AppMonitoringEventsLogItem, AppMonitoringEventsReportDto, AppMonitoringReportParams, AppMonitoringUptimeReportDto, AppNeonStorage, AppNeonStorageConfig, AppNetlifyDeployment, AppNetlifyDeploymentConfig, AppPlanetScaleStorage, AppPlanetScaleStorageConfig, AppPropertiesData, AppPropertyData, AppRepository, AppRepositoryBlock, AppRepositoryBlockConfig, AppRepositoryData, AppRepositoryProvider, AppRepositoryTarget, AppRepositoryTemplate, AppRepositoryTemplates, AppResourceDto, AppStatsDto, AppStorage, AppStorageBlock, AppStorageBlockConfig, AppStorageData, AppStorageProvider, AppTemplate, AppTemplates, AppVariable, AppVariableExternalProvider, AppVariableLocalProvider, AppVariableProvider, AppVariableStatus, AppVariableType, AppVercelDeployment, AppVercelDeploymentConfig, AppWidgetData, AppWidgetsData, ApplicationAutoReviewDto, ApplicationAutoReviewPayload, ApplicationBasicDetailsDto, ApplicationBenefitDto, ApplicationChatBooster, ApplicationDto, ApplicationFeatureDto, ApplicationIconDto, ApplicationOverviewDto, ApplicationPaymentDto, ApplicationPropertyDto, ApplicationScreenshotDto, ApplicationTutorialAndSupportDto, ApplicationUsageOptionsDto, ApplicationWidget, AuthorizeData, BillingAccountDto, BillingAccountInfoDto, BillingInvoiceDto, Category, ChatDeactivatedWebhookData, ChatTransferredWebhookData, ClientDto, ClientInfoDto, ClientScopeDto, ClientWithSecretDto, CreateAppVariablePayload, CreateApplicationAuthorizationPayload, CreateApplicationChatActionPayload, CreateApplicationPayload, CreateApplicationResponse, CreateApplicationSubmissionPayload, CreateClientPayload, CreateCredentialPayload, CreateWorkflowPayload, Credential, CredentialDto, CredentialGet, DeveloperLedgerParams, DpsApiError, EditAppVariablePayload, GetAppMonitoringCustomReportDataPayload, GetAppMonitoringEventsLogPayload, GetAppMonitoringEventsLogResponse, GetAppMonitoringEventsReportPayload, GetAppMonitoringUptimeReportPayload, GetPlanetScaleDatabasePasswordsResult, GetPlanetScaleDatabasesResult, GetPlanetScaleOrganizationsResult, GetTextPlatformDashboardReportParams, GetVercelProjectsResult, GetWorkflowPayload, GitHubAuthorizeAppActionResult, GitHubAuthorizeFlowContext, GitHubAuthorizeFlowResult, GitHubAuthorizeOauthActionResult, GitHubInstallActionContext, GitHubInstallActionResult, GitHubInstallFlowContext, GitHubInstallFlowResult, GitHubInstallation, GitHubRepository, GitHubRepositoryBranch, GitHubRepositoryHook, GitHubRepositoryIssue, GitHubRepositoryKey, GitHubRepositorySeed, GithubClientAuthorization, GithubClientOptions, IncomingChatWebhookData, IncomingEventWebhookData, IntegrationAuthorizeFlowContext, IntegrationAuthorizeFlowResult, IntegrationEvent, IntegrationEventProviderName, IntegrationEventSource, IntegrationEventSourceName, IntegrationFlowContext, IntegrationFlowOutput, IssueLabel, LinkAppDeploymentData, LinkAppDeploymentNetlifyData, LinkAppDeploymentNetlifySiteData, LinkAppDeploymentPayload, LinkAppDeploymentResult, LinkAppDeploymentVercelData, LinkAppDeploymentVercelProjectData, LinkAppRepositoryData, LinkAppRepositoryGitHubData, LinkAppRepositoryPayload, LinkAppRepositoryResult, LinkAppStorageData, LinkAppStorageNeonData, LinkAppStoragePayload, LinkAppStoragePlanetScaleData, LinkAppStoragePlanetScaleDatabaseData, LiveChatClientAuthorization, LiveChatClientOptions, LiveChatConfigurationApiError, LivechatApiError, MailchimpApiError, MailchimpAuthorizeActionResult, MailchimpAuthorizeFlowContext, MailchimpAuthorizeFlowResult, MailchimpClientAuthorization, MailchimpClientInstanceOptions, MailchimpEvent, MailchimpEventNames, MailchimpListWebhook, MailchimpSubscribeWebhookData, MailchimpUnsubscribeWebhookData, MailchimpWebhookConcreteData, MailchimpWebhookData, MailchimpWebhookDataBase, MailchimpWebhookEvents, MyAccountDto, NeonAuthorizeActionResult, NeonAuthorizeFlowContext, NeonAuthorizeFlowResult, NeonClientAuthorization, NeonClientOptions, NeonProjectBranchDto, NeonProjectBranchesDto, NeonProjectDatabaseDto, NeonProjectDatabasesDto, NeonProjectDto, NeonProjectRoleDto, NeonProjectRolesDto, NeonProjectWithConnectionUriDto, NeonProjectsDto, NeonUser, NetlifyAccount, NetlifyAuthorizeActionResult, NetlifyAuthorizeFlowContext, NetlifyAuthorizeFlowResult, NetlifyClientAuthorization, NetlifyClientOptions, NetlifyDeploy, NetlifyDeployKey, NetlifyEnv, NetlifyInstallActionContext, NetlifyInstallActionResult, NetlifyInstallFlowContext, NetlifyInstallFlowResult, NetlifySite, OrganizationDto, PatDto, PatScopeDto, PatWithSecretDto, PlanetScaleAuthorizeActionResult, PlanetScaleAuthorizeFlowContext, PlanetScaleAuthorizeFlowResult, PlanetScaleClientAuthorization, PlanetScaleClientOptions, PlanetScaleDatabase, PlanetScaleDatabasePassword, PlanetScaleOrganization, PlanetScalePaginatedResult, PlanetScalePagination, PlanetScaleUser, PlatformAccountsClientAuthorization, PlatformAccountsClientInstanceOptions, PlatformAdapterClientAuthorization, PlatformAdapterClientOptions, PlatformBillingClientAuthorization, PlatformBillingClientOptions, PlatformClientAuthorization, PlatformDpsClientAuthorization, PlatformDpsClientOptions, ProductDto, PropertiesDto, Property, PropertyAccessDto, PropertyAccessItemDto, PropertyDto, PushAppPayload, PushAppResult, PushAppSaga, PushAppSagaAuthorizationStep, PushAppSagaBaseStep, PushAppSagaDeploymentStep, PushAppSagaDisplayStep, PushAppSagaMonetizationStep, PushAppSagaPropertiesStep, PushAppSagaRepositoryStep, PushAppSagaStorageStep, PushAppSagaWidgetsStep, RemoveAppAuthorizationPayload, RemoveAppMonetizationPayload, RemoveAppPropertiesPayload, RemoveAppPropertyPayload, RemoveAppWidgetPayload, RemoveAppWidgetsPayload, ResearchCustomerItemDto, ResearchCustomerLocationItemDto, ResearchDictionaryParams, ResearchMarketplaceItemDto, ResearchMarketplaceParams, ResearchTrafficItemDto, ResearchTrafficParams, Saga, SagaInput, SagaOutput, SagaStep, SagaStepChanges, SagaStepComparer, SagaStepPropertyCompareResult, SagaStepStatus, SagaStepsSchema, ScopeDto, SeedAppRepositoryPayload, SeedAppRepositoryResult, ShopifyApiError, ShopifyAuthorizeActionContext, ShopifyAuthorizeActionResult, ShopifyAuthorizeFlowContext, ShopifyAuthorizeFlowResult, ShopifyClientAuthorization, ShopifyClientOptions, ShopifyEvent, ShopifyEventNames, ShopifyOrderCreatedWebhookData, ShopifyWebhookConcreteData, ShopifyWebhookData, ShopifyWebhookDataBase, ShopifyWebhookTopics, ShortcutDto, SubscribeToIntegrationEventPayload, SubscribeToMailchimpEventPayload, SubscribeToShopifyEventPayload, SubscribeToTextLivechatEventPayload, SyncAppVariablePayload, TextApiError, TextAuthorizeActionContext, TextAuthorizeActionResult, TextAuthorizeFlowContext, TextAuthorizeFlowResult, TextClientAuthorization, TextClientOptions, TextLiveChatEvent, TextLivechatEventNames, TextPlatformDashboardCreditsDto, TextPlatformDashboardPaymentDto, TextPlatformDashboardReportDto, TextPlatformDashboardReportItemDto, TriggerPayload, TriggerType, UnauthorizeAccountsApiError, UnauthorizeApiError, UnlinkAppDeploymentData, UnlinkAppDeploymentPayload, UnlinkAppRepositoryData, UnlinkAppRepositoryPayload, UnlinkAppStorageData, UnlinkAppStoragePayload, UnsubscribeFromIntegrationEventPayload, UnsubscribeFromMailchimpEventPayload, UnsubscribeFromShopifyEventPayload, UnsubscribeFromTextLivechatEventPayload, UpdateAppAuthorizationPayload, UpdateAppInfrastructureBlocksPayload, UpdateApplicationChangelogPayload, UpdateApplicationChatActionPayload, UpdateApplicationDirectInstallUrlPayload, UpdateApplicationIconPayload, UpdateApplicationOnboardingPayload, UpdateApplicationProductPayload, UpdateApplicationWebhookPayload, UpdateApplicationWidgetDto, UpdateChatWebhookPayload, UpdateClientPayload, UpdateCredentialPayload, UpdateUserFeatures, UpdateUserIntegrations, UpsertAppDeploymentPayload, UpsertAppMonetizationPayload, UpsertAppPropertiesPayload, UpsertAppPropertyPayload, UpsertAppRepositoryPayload, UpsertAppResourcePayload, UpsertAppStoragePayload, UpsertAppWidgetPayload, UpsertAppWidgetsPayload, UpsertApplicationChatBoosterPayload, UserAddedToChatWebhookData, UserDto, UserGitHubIntegrationDto, UserIntegrationsDto, UserNeonIntegrationDto, UserNetlifyIntegrationDto, UserPlanetScaleIntegrationDto, UserRemovedFromChatWebhookData, UserVercelIntegrationDto, VercelAuthorizeFlowContext, VercelAuthorizeFlowResult, VercelClientAuthorization, VercelClientOptions, VercelConnectActionContext, VercelConnectActionResult, VercelDeploy, VercelInstallActionContext, VercelInstallActionResult, VercelInstallFlowContext, VercelInstallFlowResult, VercelIntegrateActionResult, VercelNamespace, VercelPaginatedResult, VercelPagination, VercelProject, VercelProjectEnv, VercelRepository, VercelSearchRepositoryResponse, VerifyAppPayload, VerifyAppResult, Webhook, WebhookActions, WebhookChat, WebhookConcreteData, WebhookData, WebhookDataBase, WebhookDto, WebhookEvent, WebhookEvents, WebhookMessageEvent, WebhookSystemMessageEvent, WebhookSystemMessages, WebhookUser, WorkflowDefinitionAddNodeTask, WorkflowDefinitionAddTriggerTask, WorkflowDefinitionDto, WorkflowDefinitionForkJoinTask, WorkflowDefinitionHttpTask, WorkflowDefinitionJoinTask, WorkflowDefinitionSwitchTask, WorkflowDefinitionTask, WorkflowDefinitionTaskBase, WorkflowDefinitionTaskCore, WorkflowDefinitionTaskType, WorkflowDefinitionTerminateTask, WorkflowDefinitionsQueryParams, WorkflowDto, WorkflowExecution, WorkflowExecutionDetails, WorkflowExecutionPayload, WorkflowsDto, allAppTemplates, api, appBaseTemplates, appRepositoryTemplates, appRepositoryTemplatesMap, appTemplates, appTemplatesMap, getAppAutoReviewPayload, getEmptyAppAutoReview, getGitHubClientAuthorization, getGithubClientConfig, getIntegrationFlowUrl, getLiveChatClientAuthorization, getLiveChatClientConfig, getMailchimpClientAuthorization, getMailchimpClientConfig, getMailchimpClientUrl, getNeonClientAuthorization, getNeonClientConfig, getNetlifyClientAuthorization, getNetlifyClientConfig, getPlanetScaleClientAuthorization, getPlanetScaleClientConfig, getPlatformAccountsClientAuthorization, getPlatformAdapterClientAuthorization, getPlatformAdapterClientConfig, getPlatformAdapterClientDefaultConfig, getPlatformBillingClientAuthorization, getPlatformBillingClientConfig, getPlatformDpsAdminClientAuthorization, getPlatformDpsClientAuthorization, getPlatformDpsClientConfig, getRegion, getShopifyClientAuthorization, getShopifyClientConfig, getShopifyClientUrl, getTextClientAuthorization, getTextClientConfig, getVercelClientAuthorization, getVercelClientConfig, githubClientInstance, initApi, initGithubClient, initLiveChatClient, initMailchimpClient, initNeonClient, initNetlifyClient, initPlanetScaleClient, initPlatformAccountsClient, initPlatformAdapterClient, initPlatformBillingClient, initPlatformDpsClient, initShopifyClient, initTextClient, initVercelClient, integrationEventsZods, livechatClientInstance, mailchimpClientInstance, mailchimpEventsZods, neonClientInstance, netlifyClientInstance, planetScaleClientInstance, platformAccountsClientInstance, platformAdapterClientInstance, platformBillingClientInstance, platformDpsClientInstance, shopifyClientInstance, shopifyEventsZods, textClientInstance, textLivechatEventsZods, updateGithubClient, updateMailchimpClient, updateNeonClient, updateNetlifyClient, updatePlanetScaleClient, updatePlatformAdapterClient, updateShopifyClient, updateTextClient, updateVercelClient, vercelClientInstance };
package/dist/index.d.ts CHANGED
@@ -526,7 +526,6 @@ interface WorkflowExecutionDetails {
526
526
  type Credential = {
527
527
  name: string;
528
528
  description: string;
529
- product?: string;
530
529
  } & ({
531
530
  type: "header_auth";
532
531
  data: {
@@ -547,10 +546,40 @@ type Credential = {
547
546
  access_token_url: string;
548
547
  client_id: string;
549
548
  client_secret: string;
550
- product_fields?: Record<string, string>;
549
+ provider_name: string;
550
+ provider_fields?: Record<string, string>;
551
+ connected?: boolean;
551
552
  };
552
553
  });
553
- type CredentialDto = Credential & {
554
+ type CredentialGet = {
555
+ name: string;
556
+ description: string;
557
+ } & ({
558
+ credential_type: "header_auth";
559
+ data: {
560
+ name: string;
561
+ value: string;
562
+ };
563
+ } | {
564
+ credential_type: "basic_auth";
565
+ data: {
566
+ username: string;
567
+ password: string;
568
+ };
569
+ } | {
570
+ credential_type: "oauth2";
571
+ data: {
572
+ redirect_url: string;
573
+ authorization_url: string;
574
+ access_token_url: string;
575
+ client_id: string;
576
+ client_secret: string;
577
+ provider_name: string;
578
+ provider_fields?: Record<string, string>;
579
+ connected?: boolean;
580
+ };
581
+ });
582
+ type CredentialDto = CredentialGet & {
554
583
  created_at: string;
555
584
  updated_at: string;
556
585
  };
@@ -561,10 +590,153 @@ type DeepPartial<T> = T extends object ? {
561
590
  type CreateCredentialPayload = Credential;
562
591
  type UpdateCredentialPayload = DeepPartial<Credential>;
563
592
 
593
+ type ApiErrorName = "adapter" | "accounts" | "livechat" | "dps" | "github" | "vercel" | "netlify" | "planetscale" | "neon" | "mailchimp" | "shopify" | "text";
594
+ type ApiErrorSource = "accounts" | "github" | "vercel" | "netlify" | "planetscale" | "neon" | "mailchimp" | "shopify" | "text";
595
+ type ApiErrorKind = "unauthorized" | "error";
596
+ type ApiError<TData = unknown> = {
597
+ code: number;
598
+ message: string;
599
+ } & ({
600
+ kind: "error";
601
+ data?: TData;
602
+ } | {
603
+ kind: "unauthorized";
604
+ source: ApiErrorSource;
605
+ });
606
+ declare abstract class ApiErrorBase<TErrorData> extends Error {
607
+ message: string;
608
+ data: TErrorData;
609
+ code: number;
610
+ readonly kind: ApiErrorKind;
611
+ abstract name: ApiErrorName;
612
+ ["constructor"]: new (...args: ConstructorParameters<typeof ApiErrorBase>) => this;
613
+ constructor(message: string, data: TErrorData, code: number);
614
+ withCustomMessage(message: string): this;
615
+ }
616
+ declare class UnauthorizeApiError extends Error {
617
+ source: ApiErrorSource;
618
+ message: string;
619
+ readonly kind: ApiErrorKind;
620
+ readonly code = 401;
621
+ constructor(source: ApiErrorSource, message?: string);
622
+ withCustomMessage(_message: string): this;
623
+ }
624
+
625
+ interface ApiClientConfig {
626
+ baseURL: string;
627
+ }
628
+ interface ApiClientAuthorization {
629
+ token?: string;
630
+ tokenType?: string;
631
+ }
632
+ declare abstract class ApiClient<TError extends ApiErrorBase<TErrorData>, TErrorData = TError["data"]> {
633
+ private config;
634
+ private authorization?;
635
+ protected options?: RequestInit;
636
+ protected abstract Error: new (message: string, data: TErrorData, status: number) => TError;
637
+ protected abstract UnauthorizedError: new () => UnauthorizeApiError;
638
+ constructor(config: ApiClientConfig, authorization?: ApiClientAuthorization | undefined);
639
+ updateConfig(config: Partial<ApiClientConfig>): void;
640
+ updateAuthorization(authorization: Partial<ApiClientAuthorization>): void;
641
+ fetch<TResponseData>(url: string, customConfig?: {
642
+ authorization?: ApiClientAuthorization;
643
+ customErrorMessage?: string;
644
+ ensureAuthorization?: boolean;
645
+ }, customOptions?: RequestInit): Promise<Response & {
646
+ data: TResponseData;
647
+ }>;
648
+ get<TResponseData>(url: string, config?: {
649
+ authorization?: ApiClientAuthorization;
650
+ customErrorMessage?: string;
651
+ }, options?: Omit<RequestInit, "method" | "body">): Promise<Response & {
652
+ data: TResponseData;
653
+ }>;
654
+ post<TResponseData, TBody = unknown>(url: string, body: TBody, customConfig?: {
655
+ authorization?: ApiClientAuthorization;
656
+ customErrorMessage?: string;
657
+ }, customOptions?: Omit<RequestInit, "method" | "body">): Promise<Response & {
658
+ data: TResponseData;
659
+ }>;
660
+ patch<TResponseData, TBody = unknown>(url: string, body: TBody, customConfig?: {
661
+ authorization?: ApiClientAuthorization;
662
+ customErrorMessage?: string;
663
+ }, customOptions?: Omit<RequestInit, "method" | "body">): Promise<Response & {
664
+ data: TResponseData;
665
+ }>;
666
+ put<TResponseData, TBody = unknown>(url: string, body: TBody, customConfig?: {
667
+ authorization?: ApiClientAuthorization;
668
+ customErrorMessage?: string;
669
+ }, customOptions?: Omit<RequestInit, "method" | "body">): Promise<Response & {
670
+ data: TResponseData;
671
+ }>;
672
+ delete<TResponseData, TBody = unknown>(url: string, body: TBody, config?: {
673
+ authorization?: ApiClientAuthorization;
674
+ customErrorMessage?: string;
675
+ }, options?: Omit<RequestInit, "method" | "body">): Promise<Response & {
676
+ data: TResponseData;
677
+ }>;
678
+ }
679
+
680
+ interface SagaStep<TData = unknown, TOutput = unknown, TStatus = unknown> {
681
+ data: TData;
682
+ output: TOutput;
683
+ status: TStatus;
684
+ }
685
+ type SagaStepsSchema = Record<string, SagaStep | undefined>;
686
+ type SagaStepStatus<TData = NonNullable<unknown>> = {
687
+ isDone: boolean;
688
+ isLoading: boolean;
689
+ error?: {
690
+ message: string;
691
+ source?: ApiErrorSource;
692
+ data?: unknown;
693
+ statusCode?: number;
694
+ statusText?: string;
695
+ };
696
+ } & TData;
697
+ interface Saga<TStepSchema extends SagaStepsSchema> {
698
+ data: {
699
+ [name in keyof TStepSchema]: TStepSchema[name] extends undefined ? undefined : NonNullable<TStepSchema[name]>["data"];
700
+ };
701
+ output: {
702
+ sagaId: string;
703
+ steps: {
704
+ [name in keyof TStepSchema]: TStepSchema[name] extends undefined ? undefined : NonNullable<TStepSchema[name]>["output"];
705
+ };
706
+ isDone?: boolean;
707
+ };
708
+ status: {
709
+ [name in keyof TStepSchema]: TStepSchema[name] extends undefined ? undefined : SagaStepStatus & NonNullable<TStepSchema[name]>["status"];
710
+ };
711
+ }
712
+ type SagaInput<TSaga> = Omit<TSaga, "status">;
713
+ type SagaOutput<TSaga> = Omit<TSaga, "data">;
714
+
715
+ type SagaStepPropertyCompareResult<T> = {
716
+ isChanged: false;
717
+ } | {
718
+ isChanged: true;
719
+ value: T;
720
+ };
721
+ type SagaStepChanges<T> = {
722
+ [Key in keyof T]: SagaStepPropertyCompareResult<T[Key]>;
723
+ };
724
+ type SagaStepComparer<T> = {
725
+ [Key in keyof T]: (current: T[Key] | undefined, pending: T[Key] | undefined) => SagaStepPropertyCompareResult<T[Key]>;
726
+ };
727
+
564
728
  type TextClientAuthorization = PlatformClientAuthorization;
565
729
  interface TextClientOptions extends TextClientAuthorization {
566
730
  ensureAuthorizationToken?: boolean;
567
731
  }
732
+ declare class TextApiError extends ApiErrorBase<{
733
+ error: {
734
+ type: string;
735
+ message: string;
736
+ };
737
+ }> {
738
+ name: "text";
739
+ }
568
740
  declare const textClientInstance: axios.AxiosInstance;
569
741
  declare function getTextClientAuthorization(req: {
570
742
  headers: Record<string, string | string[] | undefined> | Headers;
@@ -789,141 +961,6 @@ type MailchimpUnsubscribeWebhookData = MailchimpWebhookConcreteData<"unsubscribe
789
961
  }>;
790
962
  type MailchimpWebhookData = MailchimpSubscribeWebhookData | MailchimpUnsubscribeWebhookData;
791
963
 
792
- type ApiErrorName = "adapter" | "accounts" | "livechat" | "dps" | "github" | "vercel" | "netlify" | "planetscale" | "neon" | "mailchimp" | "shopify";
793
- type ApiErrorSource = "accounts" | "github" | "vercel" | "netlify" | "planetscale" | "neon" | "mailchimp" | "shopify" | "text";
794
- type ApiErrorKind = "unauthorized" | "error";
795
- type ApiError<TData = unknown> = {
796
- code: number;
797
- message: string;
798
- } & ({
799
- kind: "error";
800
- data?: TData;
801
- } | {
802
- kind: "unauthorized";
803
- source: ApiErrorSource;
804
- });
805
- declare abstract class ApiErrorBase<TErrorData> extends Error {
806
- message: string;
807
- data: TErrorData;
808
- code: number;
809
- readonly kind: ApiErrorKind;
810
- abstract name: ApiErrorName;
811
- ["constructor"]: new (...args: ConstructorParameters<typeof ApiErrorBase>) => this;
812
- constructor(message: string, data: TErrorData, code: number);
813
- withCustomMessage(message: string): this;
814
- }
815
- declare class UnauthorizeApiError extends Error {
816
- source: ApiErrorSource;
817
- message: string;
818
- readonly kind: ApiErrorKind;
819
- readonly code = 401;
820
- constructor(source: ApiErrorSource, message?: string);
821
- withCustomMessage(_message: string): this;
822
- }
823
-
824
- interface ApiClientConfig {
825
- baseURL: string;
826
- }
827
- interface ApiClientAuthorization {
828
- token?: string;
829
- tokenType?: string;
830
- }
831
- declare abstract class ApiClient<TError extends ApiErrorBase<TErrorData>, TErrorData = TError["data"]> {
832
- private config;
833
- private authorization?;
834
- protected options?: RequestInit;
835
- protected abstract Error: new (message: string, data: TErrorData, status: number) => TError;
836
- protected abstract UnauthorizedError: new () => UnauthorizeApiError;
837
- constructor(config: ApiClientConfig, authorization?: ApiClientAuthorization | undefined);
838
- updateConfig(config: Partial<ApiClientConfig>): void;
839
- updateAuthorization(authorization: Partial<ApiClientAuthorization>): void;
840
- fetch<TResponseData>(url: string, customConfig?: {
841
- authorization?: ApiClientAuthorization;
842
- customErrorMessage?: string;
843
- ensureAuthorization?: boolean;
844
- }, customOptions?: RequestInit): Promise<Response & {
845
- data: TResponseData;
846
- }>;
847
- get<TResponseData>(url: string, config?: {
848
- authorization?: ApiClientAuthorization;
849
- customErrorMessage?: string;
850
- }, options?: Omit<RequestInit, "method" | "body">): Promise<Response & {
851
- data: TResponseData;
852
- }>;
853
- post<TResponseData, TBody = unknown>(url: string, body: TBody, customConfig?: {
854
- authorization?: ApiClientAuthorization;
855
- customErrorMessage?: string;
856
- }, customOptions?: Omit<RequestInit, "method" | "body">): Promise<Response & {
857
- data: TResponseData;
858
- }>;
859
- patch<TResponseData, TBody = unknown>(url: string, body: TBody, customConfig?: {
860
- authorization?: ApiClientAuthorization;
861
- customErrorMessage?: string;
862
- }, customOptions?: Omit<RequestInit, "method" | "body">): Promise<Response & {
863
- data: TResponseData;
864
- }>;
865
- put<TResponseData, TBody = unknown>(url: string, body: TBody, customConfig?: {
866
- authorization?: ApiClientAuthorization;
867
- customErrorMessage?: string;
868
- }, customOptions?: Omit<RequestInit, "method" | "body">): Promise<Response & {
869
- data: TResponseData;
870
- }>;
871
- delete<TResponseData, TBody = unknown>(url: string, body: TBody, config?: {
872
- authorization?: ApiClientAuthorization;
873
- customErrorMessage?: string;
874
- }, options?: Omit<RequestInit, "method" | "body">): Promise<Response & {
875
- data: TResponseData;
876
- }>;
877
- }
878
-
879
- interface SagaStep<TData = unknown, TOutput = unknown, TStatus = unknown> {
880
- data: TData;
881
- output: TOutput;
882
- status: TStatus;
883
- }
884
- type SagaStepsSchema = Record<string, SagaStep | undefined>;
885
- type SagaStepStatus<TData = NonNullable<unknown>> = {
886
- isDone: boolean;
887
- isLoading: boolean;
888
- error?: {
889
- message: string;
890
- source?: ApiErrorSource;
891
- data?: unknown;
892
- statusCode?: number;
893
- statusText?: string;
894
- };
895
- } & TData;
896
- interface Saga<TStepSchema extends SagaStepsSchema> {
897
- data: {
898
- [name in keyof TStepSchema]: TStepSchema[name] extends undefined ? undefined : NonNullable<TStepSchema[name]>["data"];
899
- };
900
- output: {
901
- sagaId: string;
902
- steps: {
903
- [name in keyof TStepSchema]: TStepSchema[name] extends undefined ? undefined : NonNullable<TStepSchema[name]>["output"];
904
- };
905
- isDone?: boolean;
906
- };
907
- status: {
908
- [name in keyof TStepSchema]: TStepSchema[name] extends undefined ? undefined : SagaStepStatus & NonNullable<TStepSchema[name]>["status"];
909
- };
910
- }
911
- type SagaInput<TSaga> = Omit<TSaga, "status">;
912
- type SagaOutput<TSaga> = Omit<TSaga, "data">;
913
-
914
- type SagaStepPropertyCompareResult<T> = {
915
- isChanged: false;
916
- } | {
917
- isChanged: true;
918
- value: T;
919
- };
920
- type SagaStepChanges<T> = {
921
- [Key in keyof T]: SagaStepPropertyCompareResult<T[Key]>;
922
- };
923
- type SagaStepComparer<T> = {
924
- [Key in keyof T]: (current: T[Key] | undefined, pending: T[Key] | undefined) => SagaStepPropertyCompareResult<T[Key]>;
925
- };
926
-
927
964
  interface MailchimpClientAuthorization {
928
965
  server?: string;
929
966
  token?: string;
@@ -1968,14 +2005,14 @@ declare enum ShopifyEventNames {
1968
2005
  }
1969
2006
 
1970
2007
  interface ShopifyAuthorizeActionContext {
1971
- shop?: string;
2008
+ shop: string;
1972
2009
  }
1973
- interface ShopifyAuthorizeActionResult {
2010
+ type ShopifyAuthorizeActionResult = IntegrationAuthorizeFlowResult & {
1974
2011
  shop: string;
1975
2012
  token: string;
1976
- }
1977
- type ShopifyAuthorizeFlowContext = IntegrationFlowContext & {
1978
- authorize?: ShopifyAuthorizeActionContext;
2013
+ };
2014
+ type ShopifyAuthorizeFlowContext<TCredential extends string | undefined = string> = IntegrationAuthorizeFlowContext<TCredential> & {
2015
+ authorize: ShopifyAuthorizeActionContext;
1979
2016
  };
1980
2017
  type ShopifyAuthorizeFlowResult = ShopifyAuthorizeActionResult;
1981
2018
 
@@ -4820,4 +4857,4 @@ declare function getIntegrationFlowUrl<TContext extends IntegrationFlowContext,
4820
4857
  adapterUrl: string;
4821
4858
  }): string;
4822
4859
 
4823
- export { API_NOTIFICATIONS, AccountDto, AccountsApiError, AdapterApiError, AddAppAuthorizationPayload, AddAppAuthorizationResult, AgentConfigurationDto, AgentDto, ApiClient, ApiClientAuthorization, ApiClientConfig, ApiError, ApiErrorBase, ApiErrorKind, ApiErrorName, ApiErrorSource, AppAuthorizationData, AppBaseData, AppBaseTemplate, AppDeployment, AppDeploymentBlock, AppDeploymentBlockConfig, AppDeploymentData, AppDeploymentProvider, AppDisplayData, AppEventDto, AppGitHubRepository, AppGitHubRepositoryConfig, AppInfrastructureBlocks, AppManifest, AppMonetizationData, AppMonitoringCustomReport, AppMonitoringCustomReportDataDto, AppMonitoringEvent, AppMonitoringEventData, AppMonitoringEventsLog, AppMonitoringEventsLogItem, AppMonitoringEventsReportDto, AppMonitoringReportParams, AppMonitoringUptimeReportDto, AppNeonStorage, AppNeonStorageConfig, AppNetlifyDeployment, AppNetlifyDeploymentConfig, AppPlanetScaleStorage, AppPlanetScaleStorageConfig, AppPropertiesData, AppPropertyData, AppRepository, AppRepositoryBlock, AppRepositoryBlockConfig, AppRepositoryData, AppRepositoryProvider, AppRepositoryTarget, AppRepositoryTemplate, AppRepositoryTemplates, AppResourceDto, AppStatsDto, AppStorage, AppStorageBlock, AppStorageBlockConfig, AppStorageData, AppStorageProvider, AppTemplate, AppTemplates, AppVariable, AppVariableExternalProvider, AppVariableLocalProvider, AppVariableProvider, AppVariableStatus, AppVariableType, AppVercelDeployment, AppVercelDeploymentConfig, AppWidgetData, AppWidgetsData, ApplicationAutoReviewDto, ApplicationAutoReviewPayload, ApplicationBasicDetailsDto, ApplicationBenefitDto, ApplicationChatBooster, ApplicationDto, ApplicationFeatureDto, ApplicationIconDto, ApplicationOverviewDto, ApplicationPaymentDto, ApplicationPropertyDto, ApplicationScreenshotDto, ApplicationTutorialAndSupportDto, ApplicationUsageOptionsDto, ApplicationWidget, AuthorizeData, BillingAccountDto, BillingAccountInfoDto, BillingInvoiceDto, Category, ChatDeactivatedWebhookData, ChatTransferredWebhookData, ClientDto, ClientInfoDto, ClientScopeDto, ClientWithSecretDto, CreateAppVariablePayload, CreateApplicationAuthorizationPayload, CreateApplicationChatActionPayload, CreateApplicationPayload, CreateApplicationResponse, CreateApplicationSubmissionPayload, CreateClientPayload, CreateCredentialPayload, CreateWorkflowPayload, Credential, CredentialDto, DeveloperLedgerParams, DpsApiError, EditAppVariablePayload, GetAppMonitoringCustomReportDataPayload, GetAppMonitoringEventsLogPayload, GetAppMonitoringEventsLogResponse, GetAppMonitoringEventsReportPayload, GetAppMonitoringUptimeReportPayload, GetPlanetScaleDatabasePasswordsResult, GetPlanetScaleDatabasesResult, GetPlanetScaleOrganizationsResult, GetTextPlatformDashboardReportParams, GetVercelProjectsResult, GetWorkflowPayload, GitHubAuthorizeAppActionResult, GitHubAuthorizeFlowContext, GitHubAuthorizeFlowResult, GitHubAuthorizeOauthActionResult, GitHubInstallActionContext, GitHubInstallActionResult, GitHubInstallFlowContext, GitHubInstallFlowResult, GitHubInstallation, GitHubRepository, GitHubRepositoryBranch, GitHubRepositoryHook, GitHubRepositoryIssue, GitHubRepositoryKey, GitHubRepositorySeed, GithubClientAuthorization, GithubClientOptions, IncomingChatWebhookData, IncomingEventWebhookData, IntegrationAuthorizeFlowContext, IntegrationAuthorizeFlowResult, IntegrationEvent, IntegrationEventProviderName, IntegrationEventSource, IntegrationEventSourceName, IntegrationFlowContext, IntegrationFlowOutput, IssueLabel, LinkAppDeploymentData, LinkAppDeploymentNetlifyData, LinkAppDeploymentNetlifySiteData, LinkAppDeploymentPayload, LinkAppDeploymentResult, LinkAppDeploymentVercelData, LinkAppDeploymentVercelProjectData, LinkAppRepositoryData, LinkAppRepositoryGitHubData, LinkAppRepositoryPayload, LinkAppRepositoryResult, LinkAppStorageData, LinkAppStorageNeonData, LinkAppStoragePayload, LinkAppStoragePlanetScaleData, LinkAppStoragePlanetScaleDatabaseData, LiveChatClientAuthorization, LiveChatClientOptions, LiveChatConfigurationApiError, LivechatApiError, MailchimpApiError, MailchimpAuthorizeActionResult, MailchimpAuthorizeFlowContext, MailchimpAuthorizeFlowResult, MailchimpClientAuthorization, MailchimpClientInstanceOptions, MailchimpEvent, MailchimpEventNames, MailchimpListWebhook, MailchimpSubscribeWebhookData, MailchimpUnsubscribeWebhookData, MailchimpWebhookConcreteData, MailchimpWebhookData, MailchimpWebhookDataBase, MailchimpWebhookEvents, MyAccountDto, NeonAuthorizeActionResult, NeonAuthorizeFlowContext, NeonAuthorizeFlowResult, NeonClientAuthorization, NeonClientOptions, NeonProjectBranchDto, NeonProjectBranchesDto, NeonProjectDatabaseDto, NeonProjectDatabasesDto, NeonProjectDto, NeonProjectRoleDto, NeonProjectRolesDto, NeonProjectWithConnectionUriDto, NeonProjectsDto, NeonUser, NetlifyAccount, NetlifyAuthorizeActionResult, NetlifyAuthorizeFlowContext, NetlifyAuthorizeFlowResult, NetlifyClientAuthorization, NetlifyClientOptions, NetlifyDeploy, NetlifyDeployKey, NetlifyEnv, NetlifyInstallActionContext, NetlifyInstallActionResult, NetlifyInstallFlowContext, NetlifyInstallFlowResult, NetlifySite, OrganizationDto, PatDto, PatScopeDto, PatWithSecretDto, PlanetScaleAuthorizeActionResult, PlanetScaleAuthorizeFlowContext, PlanetScaleAuthorizeFlowResult, PlanetScaleClientAuthorization, PlanetScaleClientOptions, PlanetScaleDatabase, PlanetScaleDatabasePassword, PlanetScaleOrganization, PlanetScalePaginatedResult, PlanetScalePagination, PlanetScaleUser, PlatformAccountsClientAuthorization, PlatformAccountsClientInstanceOptions, PlatformAdapterClientAuthorization, PlatformAdapterClientOptions, PlatformBillingClientAuthorization, PlatformBillingClientOptions, PlatformClientAuthorization, PlatformDpsClientAuthorization, PlatformDpsClientOptions, ProductDto, PropertiesDto, Property, PropertyAccessDto, PropertyAccessItemDto, PropertyDto, PushAppPayload, PushAppResult, PushAppSaga, PushAppSagaAuthorizationStep, PushAppSagaBaseStep, PushAppSagaDeploymentStep, PushAppSagaDisplayStep, PushAppSagaMonetizationStep, PushAppSagaPropertiesStep, PushAppSagaRepositoryStep, PushAppSagaStorageStep, PushAppSagaWidgetsStep, RemoveAppAuthorizationPayload, RemoveAppMonetizationPayload, RemoveAppPropertiesPayload, RemoveAppPropertyPayload, RemoveAppWidgetPayload, RemoveAppWidgetsPayload, ResearchCustomerItemDto, ResearchCustomerLocationItemDto, ResearchDictionaryParams, ResearchMarketplaceItemDto, ResearchMarketplaceParams, ResearchTrafficItemDto, ResearchTrafficParams, Saga, SagaInput, SagaOutput, SagaStep, SagaStepChanges, SagaStepComparer, SagaStepPropertyCompareResult, SagaStepStatus, SagaStepsSchema, ScopeDto, SeedAppRepositoryPayload, SeedAppRepositoryResult, ShopifyApiError, ShopifyAuthorizeActionContext, ShopifyAuthorizeActionResult, ShopifyAuthorizeFlowContext, ShopifyAuthorizeFlowResult, ShopifyClientAuthorization, ShopifyClientOptions, ShopifyEvent, ShopifyEventNames, ShopifyOrderCreatedWebhookData, ShopifyWebhookConcreteData, ShopifyWebhookData, ShopifyWebhookDataBase, ShopifyWebhookTopics, ShortcutDto, SubscribeToIntegrationEventPayload, SubscribeToMailchimpEventPayload, SubscribeToShopifyEventPayload, SubscribeToTextLivechatEventPayload, SyncAppVariablePayload, TextAuthorizeActionContext, TextAuthorizeActionResult, TextAuthorizeFlowContext, TextAuthorizeFlowResult, TextClientAuthorization, TextClientOptions, TextLiveChatEvent, TextLivechatEventNames, TextPlatformDashboardCreditsDto, TextPlatformDashboardPaymentDto, TextPlatformDashboardReportDto, TextPlatformDashboardReportItemDto, TriggerPayload, TriggerType, UnauthorizeAccountsApiError, UnauthorizeApiError, UnlinkAppDeploymentData, UnlinkAppDeploymentPayload, UnlinkAppRepositoryData, UnlinkAppRepositoryPayload, UnlinkAppStorageData, UnlinkAppStoragePayload, UnsubscribeFromIntegrationEventPayload, UnsubscribeFromMailchimpEventPayload, UnsubscribeFromShopifyEventPayload, UnsubscribeFromTextLivechatEventPayload, UpdateAppAuthorizationPayload, UpdateAppInfrastructureBlocksPayload, UpdateApplicationChangelogPayload, UpdateApplicationChatActionPayload, UpdateApplicationDirectInstallUrlPayload, UpdateApplicationIconPayload, UpdateApplicationOnboardingPayload, UpdateApplicationProductPayload, UpdateApplicationWebhookPayload, UpdateApplicationWidgetDto, UpdateChatWebhookPayload, UpdateClientPayload, UpdateCredentialPayload, UpdateUserFeatures, UpdateUserIntegrations, UpsertAppDeploymentPayload, UpsertAppMonetizationPayload, UpsertAppPropertiesPayload, UpsertAppPropertyPayload, UpsertAppRepositoryPayload, UpsertAppResourcePayload, UpsertAppStoragePayload, UpsertAppWidgetPayload, UpsertAppWidgetsPayload, UpsertApplicationChatBoosterPayload, UserAddedToChatWebhookData, UserDto, UserGitHubIntegrationDto, UserIntegrationsDto, UserNeonIntegrationDto, UserNetlifyIntegrationDto, UserPlanetScaleIntegrationDto, UserRemovedFromChatWebhookData, UserVercelIntegrationDto, VercelAuthorizeFlowContext, VercelAuthorizeFlowResult, VercelClientAuthorization, VercelClientOptions, VercelConnectActionContext, VercelConnectActionResult, VercelDeploy, VercelInstallActionContext, VercelInstallActionResult, VercelInstallFlowContext, VercelInstallFlowResult, VercelIntegrateActionResult, VercelNamespace, VercelPaginatedResult, VercelPagination, VercelProject, VercelProjectEnv, VercelRepository, VercelSearchRepositoryResponse, VerifyAppPayload, VerifyAppResult, Webhook, WebhookActions, WebhookChat, WebhookConcreteData, WebhookData, WebhookDataBase, WebhookDto, WebhookEvent, WebhookEvents, WebhookMessageEvent, WebhookSystemMessageEvent, WebhookSystemMessages, WebhookUser, WorkflowDefinitionAddNodeTask, WorkflowDefinitionAddTriggerTask, WorkflowDefinitionDto, WorkflowDefinitionForkJoinTask, WorkflowDefinitionHttpTask, WorkflowDefinitionJoinTask, WorkflowDefinitionSwitchTask, WorkflowDefinitionTask, WorkflowDefinitionTaskBase, WorkflowDefinitionTaskCore, WorkflowDefinitionTaskType, WorkflowDefinitionTerminateTask, WorkflowDefinitionsQueryParams, WorkflowDto, WorkflowExecution, WorkflowExecutionDetails, WorkflowExecutionPayload, WorkflowsDto, allAppTemplates, api, appBaseTemplates, appRepositoryTemplates, appRepositoryTemplatesMap, appTemplates, appTemplatesMap, getAppAutoReviewPayload, getEmptyAppAutoReview, getGitHubClientAuthorization, getGithubClientConfig, getIntegrationFlowUrl, getLiveChatClientAuthorization, getLiveChatClientConfig, getMailchimpClientAuthorization, getMailchimpClientConfig, getMailchimpClientUrl, getNeonClientAuthorization, getNeonClientConfig, getNetlifyClientAuthorization, getNetlifyClientConfig, getPlanetScaleClientAuthorization, getPlanetScaleClientConfig, getPlatformAccountsClientAuthorization, getPlatformAdapterClientAuthorization, getPlatformAdapterClientConfig, getPlatformAdapterClientDefaultConfig, getPlatformBillingClientAuthorization, getPlatformBillingClientConfig, getPlatformDpsAdminClientAuthorization, getPlatformDpsClientAuthorization, getPlatformDpsClientConfig, getRegion, getShopifyClientAuthorization, getShopifyClientConfig, getShopifyClientUrl, getTextClientAuthorization, getTextClientConfig, getVercelClientAuthorization, getVercelClientConfig, githubClientInstance, initApi, initGithubClient, initLiveChatClient, initMailchimpClient, initNeonClient, initNetlifyClient, initPlanetScaleClient, initPlatformAccountsClient, initPlatformAdapterClient, initPlatformBillingClient, initPlatformDpsClient, initShopifyClient, initTextClient, initVercelClient, integrationEventsZods, livechatClientInstance, mailchimpClientInstance, mailchimpEventsZods, neonClientInstance, netlifyClientInstance, planetScaleClientInstance, platformAccountsClientInstance, platformAdapterClientInstance, platformBillingClientInstance, platformDpsClientInstance, shopifyClientInstance, shopifyEventsZods, textClientInstance, textLivechatEventsZods, updateGithubClient, updateMailchimpClient, updateNeonClient, updateNetlifyClient, updatePlanetScaleClient, updatePlatformAdapterClient, updateShopifyClient, updateTextClient, updateVercelClient, vercelClientInstance };
4860
+ export { API_NOTIFICATIONS, AccountDto, AccountsApiError, AdapterApiError, AddAppAuthorizationPayload, AddAppAuthorizationResult, AgentConfigurationDto, AgentDto, ApiClient, ApiClientAuthorization, ApiClientConfig, ApiError, ApiErrorBase, ApiErrorKind, ApiErrorName, ApiErrorSource, AppAuthorizationData, AppBaseData, AppBaseTemplate, AppDeployment, AppDeploymentBlock, AppDeploymentBlockConfig, AppDeploymentData, AppDeploymentProvider, AppDisplayData, AppEventDto, AppGitHubRepository, AppGitHubRepositoryConfig, AppInfrastructureBlocks, AppManifest, AppMonetizationData, AppMonitoringCustomReport, AppMonitoringCustomReportDataDto, AppMonitoringEvent, AppMonitoringEventData, AppMonitoringEventsLog, AppMonitoringEventsLogItem, AppMonitoringEventsReportDto, AppMonitoringReportParams, AppMonitoringUptimeReportDto, AppNeonStorage, AppNeonStorageConfig, AppNetlifyDeployment, AppNetlifyDeploymentConfig, AppPlanetScaleStorage, AppPlanetScaleStorageConfig, AppPropertiesData, AppPropertyData, AppRepository, AppRepositoryBlock, AppRepositoryBlockConfig, AppRepositoryData, AppRepositoryProvider, AppRepositoryTarget, AppRepositoryTemplate, AppRepositoryTemplates, AppResourceDto, AppStatsDto, AppStorage, AppStorageBlock, AppStorageBlockConfig, AppStorageData, AppStorageProvider, AppTemplate, AppTemplates, AppVariable, AppVariableExternalProvider, AppVariableLocalProvider, AppVariableProvider, AppVariableStatus, AppVariableType, AppVercelDeployment, AppVercelDeploymentConfig, AppWidgetData, AppWidgetsData, ApplicationAutoReviewDto, ApplicationAutoReviewPayload, ApplicationBasicDetailsDto, ApplicationBenefitDto, ApplicationChatBooster, ApplicationDto, ApplicationFeatureDto, ApplicationIconDto, ApplicationOverviewDto, ApplicationPaymentDto, ApplicationPropertyDto, ApplicationScreenshotDto, ApplicationTutorialAndSupportDto, ApplicationUsageOptionsDto, ApplicationWidget, AuthorizeData, BillingAccountDto, BillingAccountInfoDto, BillingInvoiceDto, Category, ChatDeactivatedWebhookData, ChatTransferredWebhookData, ClientDto, ClientInfoDto, ClientScopeDto, ClientWithSecretDto, CreateAppVariablePayload, CreateApplicationAuthorizationPayload, CreateApplicationChatActionPayload, CreateApplicationPayload, CreateApplicationResponse, CreateApplicationSubmissionPayload, CreateClientPayload, CreateCredentialPayload, CreateWorkflowPayload, Credential, CredentialDto, CredentialGet, DeveloperLedgerParams, DpsApiError, EditAppVariablePayload, GetAppMonitoringCustomReportDataPayload, GetAppMonitoringEventsLogPayload, GetAppMonitoringEventsLogResponse, GetAppMonitoringEventsReportPayload, GetAppMonitoringUptimeReportPayload, GetPlanetScaleDatabasePasswordsResult, GetPlanetScaleDatabasesResult, GetPlanetScaleOrganizationsResult, GetTextPlatformDashboardReportParams, GetVercelProjectsResult, GetWorkflowPayload, GitHubAuthorizeAppActionResult, GitHubAuthorizeFlowContext, GitHubAuthorizeFlowResult, GitHubAuthorizeOauthActionResult, GitHubInstallActionContext, GitHubInstallActionResult, GitHubInstallFlowContext, GitHubInstallFlowResult, GitHubInstallation, GitHubRepository, GitHubRepositoryBranch, GitHubRepositoryHook, GitHubRepositoryIssue, GitHubRepositoryKey, GitHubRepositorySeed, GithubClientAuthorization, GithubClientOptions, IncomingChatWebhookData, IncomingEventWebhookData, IntegrationAuthorizeFlowContext, IntegrationAuthorizeFlowResult, IntegrationEvent, IntegrationEventProviderName, IntegrationEventSource, IntegrationEventSourceName, IntegrationFlowContext, IntegrationFlowOutput, IssueLabel, LinkAppDeploymentData, LinkAppDeploymentNetlifyData, LinkAppDeploymentNetlifySiteData, LinkAppDeploymentPayload, LinkAppDeploymentResult, LinkAppDeploymentVercelData, LinkAppDeploymentVercelProjectData, LinkAppRepositoryData, LinkAppRepositoryGitHubData, LinkAppRepositoryPayload, LinkAppRepositoryResult, LinkAppStorageData, LinkAppStorageNeonData, LinkAppStoragePayload, LinkAppStoragePlanetScaleData, LinkAppStoragePlanetScaleDatabaseData, LiveChatClientAuthorization, LiveChatClientOptions, LiveChatConfigurationApiError, LivechatApiError, MailchimpApiError, MailchimpAuthorizeActionResult, MailchimpAuthorizeFlowContext, MailchimpAuthorizeFlowResult, MailchimpClientAuthorization, MailchimpClientInstanceOptions, MailchimpEvent, MailchimpEventNames, MailchimpListWebhook, MailchimpSubscribeWebhookData, MailchimpUnsubscribeWebhookData, MailchimpWebhookConcreteData, MailchimpWebhookData, MailchimpWebhookDataBase, MailchimpWebhookEvents, MyAccountDto, NeonAuthorizeActionResult, NeonAuthorizeFlowContext, NeonAuthorizeFlowResult, NeonClientAuthorization, NeonClientOptions, NeonProjectBranchDto, NeonProjectBranchesDto, NeonProjectDatabaseDto, NeonProjectDatabasesDto, NeonProjectDto, NeonProjectRoleDto, NeonProjectRolesDto, NeonProjectWithConnectionUriDto, NeonProjectsDto, NeonUser, NetlifyAccount, NetlifyAuthorizeActionResult, NetlifyAuthorizeFlowContext, NetlifyAuthorizeFlowResult, NetlifyClientAuthorization, NetlifyClientOptions, NetlifyDeploy, NetlifyDeployKey, NetlifyEnv, NetlifyInstallActionContext, NetlifyInstallActionResult, NetlifyInstallFlowContext, NetlifyInstallFlowResult, NetlifySite, OrganizationDto, PatDto, PatScopeDto, PatWithSecretDto, PlanetScaleAuthorizeActionResult, PlanetScaleAuthorizeFlowContext, PlanetScaleAuthorizeFlowResult, PlanetScaleClientAuthorization, PlanetScaleClientOptions, PlanetScaleDatabase, PlanetScaleDatabasePassword, PlanetScaleOrganization, PlanetScalePaginatedResult, PlanetScalePagination, PlanetScaleUser, PlatformAccountsClientAuthorization, PlatformAccountsClientInstanceOptions, PlatformAdapterClientAuthorization, PlatformAdapterClientOptions, PlatformBillingClientAuthorization, PlatformBillingClientOptions, PlatformClientAuthorization, PlatformDpsClientAuthorization, PlatformDpsClientOptions, ProductDto, PropertiesDto, Property, PropertyAccessDto, PropertyAccessItemDto, PropertyDto, PushAppPayload, PushAppResult, PushAppSaga, PushAppSagaAuthorizationStep, PushAppSagaBaseStep, PushAppSagaDeploymentStep, PushAppSagaDisplayStep, PushAppSagaMonetizationStep, PushAppSagaPropertiesStep, PushAppSagaRepositoryStep, PushAppSagaStorageStep, PushAppSagaWidgetsStep, RemoveAppAuthorizationPayload, RemoveAppMonetizationPayload, RemoveAppPropertiesPayload, RemoveAppPropertyPayload, RemoveAppWidgetPayload, RemoveAppWidgetsPayload, ResearchCustomerItemDto, ResearchCustomerLocationItemDto, ResearchDictionaryParams, ResearchMarketplaceItemDto, ResearchMarketplaceParams, ResearchTrafficItemDto, ResearchTrafficParams, Saga, SagaInput, SagaOutput, SagaStep, SagaStepChanges, SagaStepComparer, SagaStepPropertyCompareResult, SagaStepStatus, SagaStepsSchema, ScopeDto, SeedAppRepositoryPayload, SeedAppRepositoryResult, ShopifyApiError, ShopifyAuthorizeActionContext, ShopifyAuthorizeActionResult, ShopifyAuthorizeFlowContext, ShopifyAuthorizeFlowResult, ShopifyClientAuthorization, ShopifyClientOptions, ShopifyEvent, ShopifyEventNames, ShopifyOrderCreatedWebhookData, ShopifyWebhookConcreteData, ShopifyWebhookData, ShopifyWebhookDataBase, ShopifyWebhookTopics, ShortcutDto, SubscribeToIntegrationEventPayload, SubscribeToMailchimpEventPayload, SubscribeToShopifyEventPayload, SubscribeToTextLivechatEventPayload, SyncAppVariablePayload, TextApiError, TextAuthorizeActionContext, TextAuthorizeActionResult, TextAuthorizeFlowContext, TextAuthorizeFlowResult, TextClientAuthorization, TextClientOptions, TextLiveChatEvent, TextLivechatEventNames, TextPlatformDashboardCreditsDto, TextPlatformDashboardPaymentDto, TextPlatformDashboardReportDto, TextPlatformDashboardReportItemDto, TriggerPayload, TriggerType, UnauthorizeAccountsApiError, UnauthorizeApiError, UnlinkAppDeploymentData, UnlinkAppDeploymentPayload, UnlinkAppRepositoryData, UnlinkAppRepositoryPayload, UnlinkAppStorageData, UnlinkAppStoragePayload, UnsubscribeFromIntegrationEventPayload, UnsubscribeFromMailchimpEventPayload, UnsubscribeFromShopifyEventPayload, UnsubscribeFromTextLivechatEventPayload, UpdateAppAuthorizationPayload, UpdateAppInfrastructureBlocksPayload, UpdateApplicationChangelogPayload, UpdateApplicationChatActionPayload, UpdateApplicationDirectInstallUrlPayload, UpdateApplicationIconPayload, UpdateApplicationOnboardingPayload, UpdateApplicationProductPayload, UpdateApplicationWebhookPayload, UpdateApplicationWidgetDto, UpdateChatWebhookPayload, UpdateClientPayload, UpdateCredentialPayload, UpdateUserFeatures, UpdateUserIntegrations, UpsertAppDeploymentPayload, UpsertAppMonetizationPayload, UpsertAppPropertiesPayload, UpsertAppPropertyPayload, UpsertAppRepositoryPayload, UpsertAppResourcePayload, UpsertAppStoragePayload, UpsertAppWidgetPayload, UpsertAppWidgetsPayload, UpsertApplicationChatBoosterPayload, UserAddedToChatWebhookData, UserDto, UserGitHubIntegrationDto, UserIntegrationsDto, UserNeonIntegrationDto, UserNetlifyIntegrationDto, UserPlanetScaleIntegrationDto, UserRemovedFromChatWebhookData, UserVercelIntegrationDto, VercelAuthorizeFlowContext, VercelAuthorizeFlowResult, VercelClientAuthorization, VercelClientOptions, VercelConnectActionContext, VercelConnectActionResult, VercelDeploy, VercelInstallActionContext, VercelInstallActionResult, VercelInstallFlowContext, VercelInstallFlowResult, VercelIntegrateActionResult, VercelNamespace, VercelPaginatedResult, VercelPagination, VercelProject, VercelProjectEnv, VercelRepository, VercelSearchRepositoryResponse, VerifyAppPayload, VerifyAppResult, Webhook, WebhookActions, WebhookChat, WebhookConcreteData, WebhookData, WebhookDataBase, WebhookDto, WebhookEvent, WebhookEvents, WebhookMessageEvent, WebhookSystemMessageEvent, WebhookSystemMessages, WebhookUser, WorkflowDefinitionAddNodeTask, WorkflowDefinitionAddTriggerTask, WorkflowDefinitionDto, WorkflowDefinitionForkJoinTask, WorkflowDefinitionHttpTask, WorkflowDefinitionJoinTask, WorkflowDefinitionSwitchTask, WorkflowDefinitionTask, WorkflowDefinitionTaskBase, WorkflowDefinitionTaskCore, WorkflowDefinitionTaskType, WorkflowDefinitionTerminateTask, WorkflowDefinitionsQueryParams, WorkflowDto, WorkflowExecution, WorkflowExecutionDetails, WorkflowExecutionPayload, WorkflowsDto, allAppTemplates, api, appBaseTemplates, appRepositoryTemplates, appRepositoryTemplatesMap, appTemplates, appTemplatesMap, getAppAutoReviewPayload, getEmptyAppAutoReview, getGitHubClientAuthorization, getGithubClientConfig, getIntegrationFlowUrl, getLiveChatClientAuthorization, getLiveChatClientConfig, getMailchimpClientAuthorization, getMailchimpClientConfig, getMailchimpClientUrl, getNeonClientAuthorization, getNeonClientConfig, getNetlifyClientAuthorization, getNetlifyClientConfig, getPlanetScaleClientAuthorization, getPlanetScaleClientConfig, getPlatformAccountsClientAuthorization, getPlatformAdapterClientAuthorization, getPlatformAdapterClientConfig, getPlatformAdapterClientDefaultConfig, getPlatformBillingClientAuthorization, getPlatformBillingClientConfig, getPlatformDpsAdminClientAuthorization, getPlatformDpsClientAuthorization, getPlatformDpsClientConfig, getRegion, getShopifyClientAuthorization, getShopifyClientConfig, getShopifyClientUrl, getTextClientAuthorization, getTextClientConfig, getVercelClientAuthorization, getVercelClientConfig, githubClientInstance, initApi, initGithubClient, initLiveChatClient, initMailchimpClient, initNeonClient, initNetlifyClient, initPlanetScaleClient, initPlatformAccountsClient, initPlatformAdapterClient, initPlatformBillingClient, initPlatformDpsClient, initShopifyClient, initTextClient, initVercelClient, integrationEventsZods, livechatClientInstance, mailchimpClientInstance, mailchimpEventsZods, neonClientInstance, netlifyClientInstance, planetScaleClientInstance, platformAccountsClientInstance, platformAdapterClientInstance, platformBillingClientInstance, platformDpsClientInstance, shopifyClientInstance, shopifyEventsZods, textClientInstance, textLivechatEventsZods, updateGithubClient, updateMailchimpClient, updateNeonClient, updateNetlifyClient, updatePlanetScaleClient, updatePlatformAdapterClient, updateShopifyClient, updateTextClient, updateVercelClient, vercelClientInstance };
package/dist/index.js CHANGED
@@ -78,6 +78,7 @@ __export(src_exports, {
78
78
  MailchimpEventNames: () => MailchimpEventNames,
79
79
  ShopifyApiError: () => ShopifyApiError,
80
80
  ShopifyEventNames: () => ShopifyEventNames,
81
+ TextApiError: () => TextApiError,
81
82
  TextLivechatEventNames: () => TextLivechatEventNames,
82
83
  UnauthorizeAccountsApiError: () => UnauthorizeAccountsApiError,
83
84
  UnauthorizeApiError: () => UnauthorizeApiError,
@@ -225,8 +226,9 @@ var ApiClient = class {
225
226
  Authorization: `${(_b = authorization.tokenType) != null ? _b : "Bearer"} ${authorization.token}`
226
227
  } : void 0)
227
228
  }));
229
+ const responseText = yield response.text();
228
230
  if (!response.ok) {
229
- const errorData = yield response.json();
231
+ const errorData = responseText ? JSON.parse(responseText) : {};
230
232
  const error = new this.Error(
231
233
  (_c = customConfig == null ? void 0 : customConfig.customErrorMessage) != null ? _c : response.statusText,
232
234
  errorData,
@@ -237,7 +239,7 @@ var ApiClient = class {
237
239
  }
238
240
  throw error;
239
241
  }
240
- const data = yield response.json();
242
+ const data = responseText ? JSON.parse(responseText) : {};
241
243
  return __spreadProps(__spreadValues({}, response), {
242
244
  data
243
245
  });
@@ -1445,9 +1447,33 @@ var planetscaleApi = {
1445
1447
 
1446
1448
  // src/apis/integrations/text/instance.ts
1447
1449
  var import_axios8 = __toESM(require("axios"));
1450
+ var TextApiError = class extends ApiErrorBase {
1451
+ constructor() {
1452
+ super(...arguments);
1453
+ this.name = "text";
1454
+ }
1455
+ };
1448
1456
  var textClientInstance = import_axios8.default.create({
1449
1457
  baseURL: "https://api.labs.text.com"
1450
1458
  });
1459
+ textClientInstance.interceptors.response.use(
1460
+ (r) => r,
1461
+ (error) => {
1462
+ var _a, _b, _c, _d;
1463
+ if (import_axios8.default.isAxiosError(error)) {
1464
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
1465
+ throw new UnauthorizeApiError("text");
1466
+ }
1467
+ }
1468
+ return Promise.reject(
1469
+ new TextApiError(
1470
+ error.message,
1471
+ (_b = error.response) == null ? void 0 : _b.data,
1472
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
1473
+ )
1474
+ );
1475
+ }
1476
+ );
1451
1477
  function getTextClientAuthorization(req, usePlatformToken = true) {
1452
1478
  if (req.headers instanceof Headers) {
1453
1479
  return {
@@ -1858,7 +1884,14 @@ var textPlatformWorkflowsCredentialsApi = {
1858
1884
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1859
1885
  ensureAuthorizationToken: true
1860
1886
  }))
1861
- );
1887
+ ).catch((error) => {
1888
+ if (error instanceof TextApiError) {
1889
+ throw error.withCustomMessage(
1890
+ `Couldn't get credential. [${error.message}]`
1891
+ );
1892
+ }
1893
+ throw error;
1894
+ });
1862
1895
  });
1863
1896
  },
1864
1897
  getList(authorization) {
@@ -1868,7 +1901,14 @@ var textPlatformWorkflowsCredentialsApi = {
1868
1901
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1869
1902
  ensureAuthorizationToken: true
1870
1903
  }))
1871
- );
1904
+ ).catch((error) => {
1905
+ if (error instanceof TextApiError) {
1906
+ throw error.withCustomMessage(
1907
+ `Couldn't get credentials. [${error.message}]`
1908
+ );
1909
+ }
1910
+ throw error;
1911
+ });
1872
1912
  });
1873
1913
  },
1874
1914
  create(payload, authorization) {
@@ -1879,7 +1919,14 @@ var textPlatformWorkflowsCredentialsApi = {
1879
1919
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1880
1920
  ensureAuthorizationToken: true
1881
1921
  }))
1882
- );
1922
+ ).catch((error) => {
1923
+ if (error instanceof TextApiError) {
1924
+ throw error.withCustomMessage(
1925
+ `Couldn't create credential. [${error.message}]`
1926
+ );
1927
+ }
1928
+ throw error;
1929
+ });
1883
1930
  });
1884
1931
  },
1885
1932
  update(id, payload, authorization) {
@@ -1890,7 +1937,14 @@ var textPlatformWorkflowsCredentialsApi = {
1890
1937
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1891
1938
  ensureAuthorizationToken: true
1892
1939
  }))
1893
- );
1940
+ ).catch((error) => {
1941
+ if (error instanceof TextApiError) {
1942
+ throw error.withCustomMessage(
1943
+ `Couldn't update credentials. [${error.message}]`
1944
+ );
1945
+ }
1946
+ throw error;
1947
+ });
1894
1948
  });
1895
1949
  },
1896
1950
  delete(id, authorization) {
@@ -1900,20 +1954,34 @@ var textPlatformWorkflowsCredentialsApi = {
1900
1954
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1901
1955
  ensureAuthorizationToken: true
1902
1956
  }))
1903
- );
1957
+ ).catch((error) => {
1958
+ if (error instanceof TextApiError) {
1959
+ throw error.withCustomMessage(
1960
+ `Couldn't delete credentials. [${error.message}]`
1961
+ );
1962
+ }
1963
+ throw error;
1964
+ });
1904
1965
  });
1905
1966
  },
1906
1967
  connect(id, code, authorization) {
1907
1968
  return __async(this, null, function* () {
1908
1969
  return textClientInstance.put(
1909
- `/workflow_platform/credentials/${id}/connect`,
1970
+ `/workflow_platform/credentials/${id}/connection`,
1910
1971
  {
1911
1972
  code
1912
1973
  },
1913
1974
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1914
1975
  ensureAuthorizationToken: true
1915
1976
  }))
1916
- );
1977
+ ).catch((error) => {
1978
+ if (error instanceof TextApiError) {
1979
+ throw error.withCustomMessage(
1980
+ `Couldn't connect to credentials. [${error.message}]`
1981
+ );
1982
+ }
1983
+ throw error;
1984
+ });
1917
1985
  });
1918
1986
  }
1919
1987
  };
@@ -6835,6 +6903,7 @@ function getIntegrationFlowUrl(provider, flow, data, context, config) {
6835
6903
  MailchimpEventNames,
6836
6904
  ShopifyApiError,
6837
6905
  ShopifyEventNames,
6906
+ TextApiError,
6838
6907
  TextLivechatEventNames,
6839
6908
  UnauthorizeAccountsApiError,
6840
6909
  UnauthorizeApiError,
package/dist/index.mjs CHANGED
@@ -95,8 +95,9 @@ var ApiClient = class {
95
95
  Authorization: `${(_b = authorization.tokenType) != null ? _b : "Bearer"} ${authorization.token}`
96
96
  } : void 0)
97
97
  }));
98
+ const responseText = yield response.text();
98
99
  if (!response.ok) {
99
- const errorData = yield response.json();
100
+ const errorData = responseText ? JSON.parse(responseText) : {};
100
101
  const error = new this.Error(
101
102
  (_c = customConfig == null ? void 0 : customConfig.customErrorMessage) != null ? _c : response.statusText,
102
103
  errorData,
@@ -107,7 +108,7 @@ var ApiClient = class {
107
108
  }
108
109
  throw error;
109
110
  }
110
- const data = yield response.json();
111
+ const data = responseText ? JSON.parse(responseText) : {};
111
112
  return __spreadProps(__spreadValues({}, response), {
112
113
  data
113
114
  });
@@ -1315,9 +1316,33 @@ var planetscaleApi = {
1315
1316
 
1316
1317
  // src/apis/integrations/text/instance.ts
1317
1318
  import axios6 from "axios";
1319
+ var TextApiError = class extends ApiErrorBase {
1320
+ constructor() {
1321
+ super(...arguments);
1322
+ this.name = "text";
1323
+ }
1324
+ };
1318
1325
  var textClientInstance = axios6.create({
1319
1326
  baseURL: "https://api.labs.text.com"
1320
1327
  });
1328
+ textClientInstance.interceptors.response.use(
1329
+ (r) => r,
1330
+ (error) => {
1331
+ var _a, _b, _c, _d;
1332
+ if (axios6.isAxiosError(error)) {
1333
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
1334
+ throw new UnauthorizeApiError("text");
1335
+ }
1336
+ }
1337
+ return Promise.reject(
1338
+ new TextApiError(
1339
+ error.message,
1340
+ (_b = error.response) == null ? void 0 : _b.data,
1341
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
1342
+ )
1343
+ );
1344
+ }
1345
+ );
1321
1346
  function getTextClientAuthorization(req, usePlatformToken = true) {
1322
1347
  if (req.headers instanceof Headers) {
1323
1348
  return {
@@ -1728,7 +1753,14 @@ var textPlatformWorkflowsCredentialsApi = {
1728
1753
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1729
1754
  ensureAuthorizationToken: true
1730
1755
  }))
1731
- );
1756
+ ).catch((error) => {
1757
+ if (error instanceof TextApiError) {
1758
+ throw error.withCustomMessage(
1759
+ `Couldn't get credential. [${error.message}]`
1760
+ );
1761
+ }
1762
+ throw error;
1763
+ });
1732
1764
  });
1733
1765
  },
1734
1766
  getList(authorization) {
@@ -1738,7 +1770,14 @@ var textPlatformWorkflowsCredentialsApi = {
1738
1770
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1739
1771
  ensureAuthorizationToken: true
1740
1772
  }))
1741
- );
1773
+ ).catch((error) => {
1774
+ if (error instanceof TextApiError) {
1775
+ throw error.withCustomMessage(
1776
+ `Couldn't get credentials. [${error.message}]`
1777
+ );
1778
+ }
1779
+ throw error;
1780
+ });
1742
1781
  });
1743
1782
  },
1744
1783
  create(payload, authorization) {
@@ -1749,7 +1788,14 @@ var textPlatformWorkflowsCredentialsApi = {
1749
1788
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1750
1789
  ensureAuthorizationToken: true
1751
1790
  }))
1752
- );
1791
+ ).catch((error) => {
1792
+ if (error instanceof TextApiError) {
1793
+ throw error.withCustomMessage(
1794
+ `Couldn't create credential. [${error.message}]`
1795
+ );
1796
+ }
1797
+ throw error;
1798
+ });
1753
1799
  });
1754
1800
  },
1755
1801
  update(id, payload, authorization) {
@@ -1760,7 +1806,14 @@ var textPlatformWorkflowsCredentialsApi = {
1760
1806
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1761
1807
  ensureAuthorizationToken: true
1762
1808
  }))
1763
- );
1809
+ ).catch((error) => {
1810
+ if (error instanceof TextApiError) {
1811
+ throw error.withCustomMessage(
1812
+ `Couldn't update credentials. [${error.message}]`
1813
+ );
1814
+ }
1815
+ throw error;
1816
+ });
1764
1817
  });
1765
1818
  },
1766
1819
  delete(id, authorization) {
@@ -1770,20 +1823,34 @@ var textPlatformWorkflowsCredentialsApi = {
1770
1823
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1771
1824
  ensureAuthorizationToken: true
1772
1825
  }))
1773
- );
1826
+ ).catch((error) => {
1827
+ if (error instanceof TextApiError) {
1828
+ throw error.withCustomMessage(
1829
+ `Couldn't delete credentials. [${error.message}]`
1830
+ );
1831
+ }
1832
+ throw error;
1833
+ });
1774
1834
  });
1775
1835
  },
1776
1836
  connect(id, code, authorization) {
1777
1837
  return __async(this, null, function* () {
1778
1838
  return textClientInstance.put(
1779
- `/workflow_platform/credentials/${id}/connect`,
1839
+ `/workflow_platform/credentials/${id}/connection`,
1780
1840
  {
1781
1841
  code
1782
1842
  },
1783
1843
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
1784
1844
  ensureAuthorizationToken: true
1785
1845
  }))
1786
- );
1846
+ ).catch((error) => {
1847
+ if (error instanceof TextApiError) {
1848
+ throw error.withCustomMessage(
1849
+ `Couldn't connect to credentials. [${error.message}]`
1850
+ );
1851
+ }
1852
+ throw error;
1853
+ });
1787
1854
  });
1788
1855
  }
1789
1856
  };
@@ -6704,6 +6771,7 @@ export {
6704
6771
  MailchimpEventNames,
6705
6772
  ShopifyApiError,
6706
6773
  ShopifyEventNames,
6774
+ TextApiError,
6707
6775
  TextLivechatEventNames,
6708
6776
  UnauthorizeAccountsApiError,
6709
6777
  UnauthorizeApiError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livechat/developer-studio-api",
3
- "version": "3.1.8",
3
+ "version": "3.1.10",
4
4
  "description": "This project is API for LiveChat Developer Studio.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",