@zapier/zapier-sdk 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -673,225 +673,6 @@ type InputFieldItem = z.infer<typeof InputFieldItemSchema>;
673
673
  */
674
674
  type UserProfileItem = z.infer<typeof UserProfileItemSchema>;
675
675
 
676
- /**
677
- * Function-related types and interfaces
678
- */
679
- interface FunctionOptions {
680
- /** Base URL for Zapier API */
681
- baseUrl?: string;
682
- /** Authentication token */
683
- token?: string;
684
- /** Function to dynamically resolve authentication token */
685
- getToken?: () => Promise<string | undefined>;
686
- /** Optional pre-instantiated API client */
687
- api?: any;
688
- /** Enable debug logging */
689
- debug?: boolean;
690
- /** Custom fetch implementation */
691
- fetch?: typeof globalThis.fetch;
692
- }
693
- type PaginatedSdkFunction<TOptions, TItem> = (options: TOptions) => Promise<{
694
- data: TItem[];
695
- }> & AsyncIterable<{
696
- data: TItem[];
697
- nextCursor?: string;
698
- }> & {
699
- items(): AsyncIterable<TItem>;
700
- };
701
-
702
- declare const AppKeyPropertySchema: z.ZodString;
703
- declare const ActionTypePropertySchema: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
704
- declare const ActionKeyPropertySchema: z.ZodString;
705
- declare const AuthenticationIdPropertySchema: z.ZodNumber;
706
- declare const InputsPropertySchema: z.ZodRecord<z.ZodString, z.ZodAny>;
707
- declare const LimitPropertySchema: z.ZodDefault<z.ZodNumber>;
708
- declare const OffsetPropertySchema: z.ZodDefault<z.ZodNumber>;
709
- declare const OutputPropertySchema: z.ZodString;
710
- declare const DebugPropertySchema: z.ZodDefault<z.ZodBoolean>;
711
- declare const ParamsPropertySchema: z.ZodRecord<z.ZodString, z.ZodAny>;
712
- type AppKeyProperty = z.infer<typeof AppKeyPropertySchema>;
713
- type ActionTypeProperty = z.infer<typeof ActionTypePropertySchema>;
714
- type ActionKeyProperty = z.infer<typeof ActionKeyPropertySchema>;
715
- type AuthenticationIdProperty = z.infer<typeof AuthenticationIdPropertySchema>;
716
- type InputsProperty = z.infer<typeof InputsPropertySchema>;
717
- type LimitProperty = z.infer<typeof LimitPropertySchema>;
718
- type OffsetProperty = z.infer<typeof OffsetPropertySchema>;
719
- type OutputProperty = z.infer<typeof OutputPropertySchema>;
720
- type DebugProperty = z.infer<typeof DebugPropertySchema>;
721
- type ParamsProperty = z.infer<typeof ParamsPropertySchema>;
722
-
723
- /**
724
- * Standard error format returned by the Zapier API
725
- */
726
- interface ApiError {
727
- status: number;
728
- code: string;
729
- title: string;
730
- detail: string;
731
- source?: unknown;
732
- meta?: unknown;
733
- }
734
- /**
735
- * Base options for all error constructors
736
- */
737
- interface ErrorOptions {
738
- statusCode?: number;
739
- errors?: ApiError[];
740
- cause?: unknown;
741
- response?: unknown;
742
- }
743
- /**
744
- * Base class for all Zapier SDK errors
745
- * Use instanceof ZapierError to check if an error is from the SDK
746
- */
747
- declare abstract class ZapierError extends Error {
748
- abstract readonly name: string;
749
- statusCode?: number;
750
- errors?: ApiError[];
751
- cause?: unknown;
752
- response?: unknown;
753
- constructor(message: string, options?: ErrorOptions);
754
- }
755
- /**
756
- * Error thrown when API requests fail
757
- */
758
- declare class ZapierApiError extends ZapierError {
759
- readonly name = "ZapierApiError";
760
- constructor(message: string, options?: ErrorOptions);
761
- }
762
- /**
763
- * Error thrown when an app is not found
764
- */
765
- declare class ZapierAppNotFoundError extends ZapierError {
766
- readonly name = "ZapierAppNotFoundError";
767
- appKey?: string;
768
- constructor(message: string, options?: ErrorOptions & {
769
- appKey?: string;
770
- });
771
- }
772
- /**
773
- * Error thrown when validation fails (e.g., invalid parameters)
774
- */
775
- declare class ZapierValidationError extends ZapierError {
776
- readonly name = "ZapierValidationError";
777
- details?: unknown;
778
- constructor(message: string, options?: ErrorOptions & {
779
- details?: unknown;
780
- });
781
- }
782
- /**
783
- * Error for unrecognized/unknown errors that get wrapped by safe functions
784
- */
785
- declare class ZapierUnknownError extends ZapierError {
786
- readonly name = "ZapierUnknownError";
787
- constructor(message: string, options?: ErrorOptions);
788
- }
789
- /**
790
- * Error thrown for authentication and authorization failures (401/403)
791
- */
792
- declare class ZapierAuthenticationError extends ZapierError {
793
- readonly name = "ZapierAuthenticationError";
794
- constructor(message: string, options?: ErrorOptions);
795
- }
796
- /**
797
- * Error thrown when a requested resource is not found
798
- */
799
- declare class ZapierResourceNotFoundError extends ZapierError {
800
- readonly name = "ZapierResourceNotFoundError";
801
- resourceType?: string;
802
- resourceId?: string;
803
- constructor(message: string, options?: ErrorOptions & {
804
- resourceType?: string;
805
- resourceId?: string;
806
- });
807
- }
808
- /**
809
- * Error thrown when required app or implementation configuration is missing
810
- */
811
- declare class ZapierConfigurationError extends ZapierError {
812
- readonly name = "ZapierConfigurationError";
813
- configType?: string;
814
- constructor(message: string, options?: ErrorOptions & {
815
- configType?: string;
816
- });
817
- }
818
- /**
819
- * Error thrown when code bundling or compilation fails
820
- */
821
- declare class ZapierBundleError extends ZapierError {
822
- readonly name = "ZapierBundleError";
823
- buildErrors?: string[];
824
- constructor(message: string, options?: ErrorOptions & {
825
- buildErrors?: string[];
826
- });
827
- }
828
- /**
829
- * Error thrown when operations timeout or exceed retry limits
830
- */
831
- declare class ZapierTimeoutError extends ZapierError {
832
- readonly name = "ZapierTimeoutError";
833
- attempts?: number;
834
- maxAttempts?: number;
835
- constructor(message: string, options?: ErrorOptions & {
836
- attempts?: number;
837
- maxAttempts?: number;
838
- });
839
- }
840
- /**
841
- * Error thrown when action execution fails due to errors returned from the third-party service
842
- * This happens when the Actions API returns a 200 status but includes errors in the response
843
- */
844
- declare class ZapierActionError extends ZapierError {
845
- readonly name = "ZapierActionError";
846
- appKey?: string;
847
- actionKey?: string;
848
- constructor(message: string, options?: ErrorOptions & {
849
- appKey?: string;
850
- actionKey?: string;
851
- });
852
- get actionErrors(): ApiError[] | undefined;
853
- }
854
- /**
855
- * Error thrown when a resource is not found (404)
856
- */
857
- declare class ZapierNotFoundError extends ZapierError {
858
- readonly name = "ZapierNotFoundError";
859
- constructor(message: string, options?: ErrorOptions);
860
- }
861
- /**
862
- * Utility function to format error messages for display
863
- */
864
- declare function formatErrorMessage(error: ZapierError): string;
865
-
866
- interface ActionExecutionOptions {
867
- inputs?: Record<string, any>;
868
- authenticationId?: number;
869
- }
870
- interface AppFactoryOptions {
871
- authenticationId: number;
872
- }
873
- interface BaseActionTypeProxy {
874
- [action: string]: (options?: ActionExecutionOptions) => unknown;
875
- }
876
- interface FetchActionType {
877
- fetch: (url: string | URL, init?: RequestInit & {
878
- authenticationId?: number;
879
- callbackUrl?: string;
880
- authenticationTemplate?: string;
881
- }) => Promise<Response>;
882
- }
883
- type ActionTypeProxy = BaseActionTypeProxy & Partial<FetchActionType>;
884
- interface AppProxy {
885
- [type: string]: ActionTypeProxy;
886
- }
887
- interface AppFactory {
888
- (options: AppFactoryOptions): AppProxy;
889
- }
890
- type AppProxyWithFactory = AppFactory & AppProxy;
891
- interface ActionProxy {
892
- [app: string]: AppProxyWithFactory;
893
- }
894
-
895
676
  /**
896
677
  * SDK Event System
897
678
  *
@@ -930,153 +711,6 @@ interface LoadingEvent extends SdkEvent {
930
711
  }
931
712
  type EventCallback = (event: SdkEvent) => void;
932
713
 
933
- declare const ListInputFieldsSchema: z.ZodObject<{
934
- appKey: z.ZodString;
935
- actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
936
- actionKey: z.ZodString;
937
- authenticationId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
938
- inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
939
- pageSize: z.ZodOptional<z.ZodNumber>;
940
- maxItems: z.ZodOptional<z.ZodNumber>;
941
- }, "strip", z.ZodTypeAny, {
942
- appKey: string;
943
- actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
944
- actionKey: string;
945
- authenticationId?: number | null | undefined;
946
- inputs?: Record<string, any> | undefined;
947
- pageSize?: number | undefined;
948
- maxItems?: number | undefined;
949
- }, {
950
- appKey: string;
951
- actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
952
- actionKey: string;
953
- authenticationId?: number | null | undefined;
954
- inputs?: Record<string, any> | undefined;
955
- pageSize?: number | undefined;
956
- maxItems?: number | undefined;
957
- }>;
958
- type ListInputFieldsOptions = z.infer<typeof ListInputFieldsSchema>;
959
-
960
- declare const GetAuthenticationSchema: z.ZodObject<{
961
- authenticationId: z.ZodNumber;
962
- }, "strip", z.ZodTypeAny, {
963
- authenticationId: number;
964
- }, {
965
- authenticationId: number;
966
- }>;
967
- type GetAuthenticationOptions = z.infer<typeof GetAuthenticationSchema>;
968
-
969
- declare const FindFirstAuthenticationSchema: z.ZodObject<{
970
- appKey: z.ZodOptional<z.ZodString>;
971
- search: z.ZodOptional<z.ZodString>;
972
- title: z.ZodOptional<z.ZodString>;
973
- accountId: z.ZodOptional<z.ZodString>;
974
- owner: z.ZodOptional<z.ZodString>;
975
- }, "strip", z.ZodTypeAny, {
976
- title?: string | undefined;
977
- search?: string | undefined;
978
- appKey?: string | undefined;
979
- accountId?: string | undefined;
980
- owner?: string | undefined;
981
- }, {
982
- title?: string | undefined;
983
- search?: string | undefined;
984
- appKey?: string | undefined;
985
- accountId?: string | undefined;
986
- owner?: string | undefined;
987
- }>;
988
- type FindFirstAuthenticationOptions = z.infer<typeof FindFirstAuthenticationSchema>;
989
-
990
- declare const FindUniqueAuthenticationSchema: z.ZodObject<{
991
- appKey: z.ZodOptional<z.ZodString>;
992
- search: z.ZodOptional<z.ZodString>;
993
- title: z.ZodOptional<z.ZodString>;
994
- accountId: z.ZodOptional<z.ZodString>;
995
- owner: z.ZodOptional<z.ZodString>;
996
- }, "strip", z.ZodTypeAny, {
997
- title?: string | undefined;
998
- search?: string | undefined;
999
- appKey?: string | undefined;
1000
- accountId?: string | undefined;
1001
- owner?: string | undefined;
1002
- }, {
1003
- title?: string | undefined;
1004
- search?: string | undefined;
1005
- appKey?: string | undefined;
1006
- accountId?: string | undefined;
1007
- owner?: string | undefined;
1008
- }>;
1009
- type FindUniqueAuthenticationOptions = z.infer<typeof FindUniqueAuthenticationSchema>;
1010
-
1011
- declare const RelayRequestSchema: z.ZodObject<{
1012
- url: z.ZodString;
1013
- method: z.ZodOptional<z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]>>;
1014
- body: z.ZodOptional<z.ZodAny>;
1015
- authenticationId: z.ZodOptional<z.ZodNumber>;
1016
- callbackUrl: z.ZodOptional<z.ZodString>;
1017
- authenticationTemplate: z.ZodOptional<z.ZodString>;
1018
- headers: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodString>, z.ZodType<Headers, z.ZodTypeDef, Headers>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">]>>;
1019
- } & {
1020
- relayBaseUrl: z.ZodOptional<z.ZodString>;
1021
- }, "strip", z.ZodTypeAny, {
1022
- url: string;
1023
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
1024
- authenticationId?: number | undefined;
1025
- body?: any;
1026
- callbackUrl?: string | undefined;
1027
- authenticationTemplate?: string | undefined;
1028
- headers?: Record<string, string> | [string, string][] | Headers | undefined;
1029
- relayBaseUrl?: string | undefined;
1030
- }, {
1031
- url: string;
1032
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
1033
- authenticationId?: number | undefined;
1034
- body?: any;
1035
- callbackUrl?: string | undefined;
1036
- authenticationTemplate?: string | undefined;
1037
- headers?: Record<string, string> | [string, string][] | Headers | undefined;
1038
- relayBaseUrl?: string | undefined;
1039
- }>;
1040
- type RelayRequestOptions = z.infer<typeof RelayRequestSchema>;
1041
- declare const RelayFetchSchema: z.ZodObject<{
1042
- url: z.ZodString;
1043
- method: z.ZodOptional<z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]>>;
1044
- body: z.ZodOptional<z.ZodAny>;
1045
- authenticationId: z.ZodOptional<z.ZodNumber>;
1046
- callbackUrl: z.ZodOptional<z.ZodString>;
1047
- authenticationTemplate: z.ZodOptional<z.ZodString>;
1048
- headers: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodString>, z.ZodType<Headers, z.ZodTypeDef, Headers>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">]>>;
1049
- } & {
1050
- relayBaseUrl: z.ZodOptional<z.ZodString>;
1051
- }, "strip", z.ZodTypeAny, {
1052
- url: string;
1053
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
1054
- authenticationId?: number | undefined;
1055
- body?: any;
1056
- callbackUrl?: string | undefined;
1057
- authenticationTemplate?: string | undefined;
1058
- headers?: Record<string, string> | [string, string][] | Headers | undefined;
1059
- relayBaseUrl?: string | undefined;
1060
- }, {
1061
- url: string;
1062
- method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
1063
- authenticationId?: number | undefined;
1064
- body?: any;
1065
- callbackUrl?: string | undefined;
1066
- authenticationTemplate?: string | undefined;
1067
- headers?: Record<string, string> | [string, string][] | Headers | undefined;
1068
- relayBaseUrl?: string | undefined;
1069
- }>;
1070
-
1071
- declare const LockVersionSchema: z.ZodObject<{
1072
- appKey: z.ZodString;
1073
- }, "strip", z.ZodTypeAny, {
1074
- appKey: string;
1075
- }, {
1076
- appKey: string;
1077
- }>;
1078
- type LockVersionOptions = z.infer<typeof LockVersionSchema>;
1079
-
1080
714
  declare const NeedSchema: z.ZodObject<{
1081
715
  key: z.ZodString;
1082
716
  alters_custom_fields: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
@@ -2228,6 +1862,372 @@ type App = z.infer<typeof AppSchema>;
2228
1862
  type NeedsRequest = z.infer<typeof NeedsRequestSchema>;
2229
1863
  type NeedsResponse = z.infer<typeof NeedsResponseSchema>;
2230
1864
 
1865
+ /**
1866
+ * Function-related types and interfaces
1867
+ */
1868
+ interface FunctionOptions {
1869
+ /** Base URL for Zapier API */
1870
+ baseUrl?: string;
1871
+ /** Authentication token */
1872
+ token?: string;
1873
+ /** Function to dynamically resolve authentication token */
1874
+ getToken?: () => Promise<string | undefined>;
1875
+ /** Optional pre-instantiated API client */
1876
+ api?: ApiClient;
1877
+ /** Enable debug logging */
1878
+ debug?: boolean;
1879
+ /** Custom fetch implementation */
1880
+ fetch?: typeof globalThis.fetch;
1881
+ }
1882
+ type PaginatedSdkFunction<TOptions, TItem> = (options: TOptions) => Promise<{
1883
+ data: TItem[];
1884
+ }> & AsyncIterable<{
1885
+ data: TItem[];
1886
+ nextCursor?: string;
1887
+ }> & {
1888
+ items(): AsyncIterable<TItem>;
1889
+ };
1890
+
1891
+ declare const AppKeyPropertySchema: z.ZodString;
1892
+ declare const ActionTypePropertySchema: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
1893
+ declare const ActionKeyPropertySchema: z.ZodString;
1894
+ declare const AuthenticationIdPropertySchema: z.ZodNumber;
1895
+ declare const InputsPropertySchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1896
+ declare const LimitPropertySchema: z.ZodDefault<z.ZodNumber>;
1897
+ declare const OffsetPropertySchema: z.ZodDefault<z.ZodNumber>;
1898
+ declare const OutputPropertySchema: z.ZodString;
1899
+ declare const DebugPropertySchema: z.ZodDefault<z.ZodBoolean>;
1900
+ declare const ParamsPropertySchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1901
+ type AppKeyProperty = z.infer<typeof AppKeyPropertySchema>;
1902
+ type ActionTypeProperty = z.infer<typeof ActionTypePropertySchema>;
1903
+ type ActionKeyProperty = z.infer<typeof ActionKeyPropertySchema>;
1904
+ type AuthenticationIdProperty = z.infer<typeof AuthenticationIdPropertySchema>;
1905
+ type InputsProperty = z.infer<typeof InputsPropertySchema>;
1906
+ type LimitProperty = z.infer<typeof LimitPropertySchema>;
1907
+ type OffsetProperty = z.infer<typeof OffsetPropertySchema>;
1908
+ type OutputProperty = z.infer<typeof OutputPropertySchema>;
1909
+ type DebugProperty = z.infer<typeof DebugPropertySchema>;
1910
+ type ParamsProperty = z.infer<typeof ParamsPropertySchema>;
1911
+
1912
+ /**
1913
+ * Standard error format returned by the Zapier API
1914
+ */
1915
+ interface ApiError {
1916
+ status: number;
1917
+ code: string;
1918
+ title: string;
1919
+ detail: string;
1920
+ source?: unknown;
1921
+ meta?: unknown;
1922
+ }
1923
+ /**
1924
+ * Base options for all error constructors
1925
+ */
1926
+ interface ErrorOptions {
1927
+ statusCode?: number;
1928
+ errors?: ApiError[];
1929
+ cause?: unknown;
1930
+ response?: unknown;
1931
+ }
1932
+ /**
1933
+ * Base class for all Zapier SDK errors
1934
+ * Use instanceof ZapierError to check if an error is from the SDK
1935
+ */
1936
+ declare abstract class ZapierError extends Error {
1937
+ abstract readonly name: string;
1938
+ statusCode?: number;
1939
+ errors?: ApiError[];
1940
+ cause?: unknown;
1941
+ response?: unknown;
1942
+ constructor(message: string, options?: ErrorOptions);
1943
+ }
1944
+ /**
1945
+ * Error thrown when API requests fail
1946
+ */
1947
+ declare class ZapierApiError extends ZapierError {
1948
+ readonly name = "ZapierApiError";
1949
+ constructor(message: string, options?: ErrorOptions);
1950
+ }
1951
+ /**
1952
+ * Error thrown when an app is not found
1953
+ */
1954
+ declare class ZapierAppNotFoundError extends ZapierError {
1955
+ readonly name = "ZapierAppNotFoundError";
1956
+ appKey?: string;
1957
+ constructor(message: string, options?: ErrorOptions & {
1958
+ appKey?: string;
1959
+ });
1960
+ }
1961
+ /**
1962
+ * Error thrown when validation fails (e.g., invalid parameters)
1963
+ */
1964
+ declare class ZapierValidationError extends ZapierError {
1965
+ readonly name = "ZapierValidationError";
1966
+ details?: unknown;
1967
+ constructor(message: string, options?: ErrorOptions & {
1968
+ details?: unknown;
1969
+ });
1970
+ }
1971
+ /**
1972
+ * Error for unrecognized/unknown errors that get wrapped by safe functions
1973
+ */
1974
+ declare class ZapierUnknownError extends ZapierError {
1975
+ readonly name = "ZapierUnknownError";
1976
+ constructor(message: string, options?: ErrorOptions);
1977
+ }
1978
+ /**
1979
+ * Error thrown for authentication and authorization failures (401/403)
1980
+ */
1981
+ declare class ZapierAuthenticationError extends ZapierError {
1982
+ readonly name = "ZapierAuthenticationError";
1983
+ constructor(message: string, options?: ErrorOptions);
1984
+ }
1985
+ /**
1986
+ * Error thrown when a requested resource is not found
1987
+ */
1988
+ declare class ZapierResourceNotFoundError extends ZapierError {
1989
+ readonly name = "ZapierResourceNotFoundError";
1990
+ resourceType?: string;
1991
+ resourceId?: string;
1992
+ constructor(message: string, options?: ErrorOptions & {
1993
+ resourceType?: string;
1994
+ resourceId?: string;
1995
+ });
1996
+ }
1997
+ /**
1998
+ * Error thrown when required app or implementation configuration is missing
1999
+ */
2000
+ declare class ZapierConfigurationError extends ZapierError {
2001
+ readonly name = "ZapierConfigurationError";
2002
+ configType?: string;
2003
+ constructor(message: string, options?: ErrorOptions & {
2004
+ configType?: string;
2005
+ });
2006
+ }
2007
+ /**
2008
+ * Error thrown when code bundling or compilation fails
2009
+ */
2010
+ declare class ZapierBundleError extends ZapierError {
2011
+ readonly name = "ZapierBundleError";
2012
+ buildErrors?: string[];
2013
+ constructor(message: string, options?: ErrorOptions & {
2014
+ buildErrors?: string[];
2015
+ });
2016
+ }
2017
+ /**
2018
+ * Error thrown when operations timeout or exceed retry limits
2019
+ */
2020
+ declare class ZapierTimeoutError extends ZapierError {
2021
+ readonly name = "ZapierTimeoutError";
2022
+ attempts?: number;
2023
+ maxAttempts?: number;
2024
+ constructor(message: string, options?: ErrorOptions & {
2025
+ attempts?: number;
2026
+ maxAttempts?: number;
2027
+ });
2028
+ }
2029
+ /**
2030
+ * Error thrown when action execution fails due to errors returned from the third-party service
2031
+ * This happens when the Actions API returns a 200 status but includes errors in the response
2032
+ */
2033
+ declare class ZapierActionError extends ZapierError {
2034
+ readonly name = "ZapierActionError";
2035
+ appKey?: string;
2036
+ actionKey?: string;
2037
+ constructor(message: string, options?: ErrorOptions & {
2038
+ appKey?: string;
2039
+ actionKey?: string;
2040
+ });
2041
+ get actionErrors(): ApiError[] | undefined;
2042
+ }
2043
+ /**
2044
+ * Error thrown when a resource is not found (404)
2045
+ */
2046
+ declare class ZapierNotFoundError extends ZapierError {
2047
+ readonly name = "ZapierNotFoundError";
2048
+ constructor(message: string, options?: ErrorOptions);
2049
+ }
2050
+ /**
2051
+ * Utility function to format error messages for display
2052
+ */
2053
+ declare function formatErrorMessage(error: ZapierError): string;
2054
+
2055
+ interface ActionExecutionOptions {
2056
+ inputs?: Record<string, any>;
2057
+ authenticationId?: number;
2058
+ }
2059
+ interface AppFactoryOptions {
2060
+ authenticationId: number;
2061
+ }
2062
+ interface BaseActionTypeProxy {
2063
+ [action: string]: (options?: ActionExecutionOptions) => unknown;
2064
+ }
2065
+ interface FetchActionType {
2066
+ fetch: (url: string | URL, init?: RequestInit & {
2067
+ authenticationId?: number;
2068
+ callbackUrl?: string;
2069
+ authenticationTemplate?: string;
2070
+ }) => Promise<Response>;
2071
+ }
2072
+ type ActionTypeProxy = BaseActionTypeProxy & Partial<FetchActionType>;
2073
+ interface AppProxy {
2074
+ [type: string]: ActionTypeProxy;
2075
+ }
2076
+ interface AppFactory {
2077
+ (options: AppFactoryOptions): AppProxy;
2078
+ }
2079
+ type AppProxyWithFactory = AppFactory & AppProxy;
2080
+ interface ActionProxy {
2081
+ [app: string]: AppProxyWithFactory;
2082
+ }
2083
+
2084
+ declare const ListInputFieldsSchema: z.ZodObject<{
2085
+ appKey: z.ZodString;
2086
+ actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
2087
+ actionKey: z.ZodString;
2088
+ authenticationId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2089
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2090
+ pageSize: z.ZodOptional<z.ZodNumber>;
2091
+ maxItems: z.ZodOptional<z.ZodNumber>;
2092
+ }, "strip", z.ZodTypeAny, {
2093
+ appKey: string;
2094
+ actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
2095
+ actionKey: string;
2096
+ authenticationId?: number | null | undefined;
2097
+ inputs?: Record<string, unknown> | undefined;
2098
+ pageSize?: number | undefined;
2099
+ maxItems?: number | undefined;
2100
+ }, {
2101
+ appKey: string;
2102
+ actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
2103
+ actionKey: string;
2104
+ authenticationId?: number | null | undefined;
2105
+ inputs?: Record<string, unknown> | undefined;
2106
+ pageSize?: number | undefined;
2107
+ maxItems?: number | undefined;
2108
+ }>;
2109
+ type ListInputFieldsOptions = z.infer<typeof ListInputFieldsSchema>;
2110
+
2111
+ declare const GetAuthenticationSchema: z.ZodObject<{
2112
+ authenticationId: z.ZodNumber;
2113
+ }, "strip", z.ZodTypeAny, {
2114
+ authenticationId: number;
2115
+ }, {
2116
+ authenticationId: number;
2117
+ }>;
2118
+ type GetAuthenticationOptions = z.infer<typeof GetAuthenticationSchema>;
2119
+
2120
+ declare const FindFirstAuthenticationSchema: z.ZodObject<{
2121
+ appKey: z.ZodOptional<z.ZodString>;
2122
+ search: z.ZodOptional<z.ZodString>;
2123
+ title: z.ZodOptional<z.ZodString>;
2124
+ accountId: z.ZodOptional<z.ZodString>;
2125
+ owner: z.ZodOptional<z.ZodString>;
2126
+ }, "strip", z.ZodTypeAny, {
2127
+ title?: string | undefined;
2128
+ search?: string | undefined;
2129
+ appKey?: string | undefined;
2130
+ accountId?: string | undefined;
2131
+ owner?: string | undefined;
2132
+ }, {
2133
+ title?: string | undefined;
2134
+ search?: string | undefined;
2135
+ appKey?: string | undefined;
2136
+ accountId?: string | undefined;
2137
+ owner?: string | undefined;
2138
+ }>;
2139
+ type FindFirstAuthenticationOptions = z.infer<typeof FindFirstAuthenticationSchema>;
2140
+
2141
+ declare const FindUniqueAuthenticationSchema: z.ZodObject<{
2142
+ appKey: z.ZodOptional<z.ZodString>;
2143
+ search: z.ZodOptional<z.ZodString>;
2144
+ title: z.ZodOptional<z.ZodString>;
2145
+ accountId: z.ZodOptional<z.ZodString>;
2146
+ owner: z.ZodOptional<z.ZodString>;
2147
+ }, "strip", z.ZodTypeAny, {
2148
+ title?: string | undefined;
2149
+ search?: string | undefined;
2150
+ appKey?: string | undefined;
2151
+ accountId?: string | undefined;
2152
+ owner?: string | undefined;
2153
+ }, {
2154
+ title?: string | undefined;
2155
+ search?: string | undefined;
2156
+ appKey?: string | undefined;
2157
+ accountId?: string | undefined;
2158
+ owner?: string | undefined;
2159
+ }>;
2160
+ type FindUniqueAuthenticationOptions = z.infer<typeof FindUniqueAuthenticationSchema>;
2161
+
2162
+ declare const RelayRequestSchema: z.ZodObject<{
2163
+ url: z.ZodString;
2164
+ method: z.ZodOptional<z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]>>;
2165
+ body: z.ZodOptional<z.ZodAny>;
2166
+ authenticationId: z.ZodOptional<z.ZodNumber>;
2167
+ callbackUrl: z.ZodOptional<z.ZodString>;
2168
+ authenticationTemplate: z.ZodOptional<z.ZodString>;
2169
+ headers: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodString>, z.ZodType<Headers, z.ZodTypeDef, Headers>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">]>>;
2170
+ } & {
2171
+ relayBaseUrl: z.ZodOptional<z.ZodString>;
2172
+ }, "strip", z.ZodTypeAny, {
2173
+ url: string;
2174
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
2175
+ authenticationId?: number | undefined;
2176
+ body?: any;
2177
+ callbackUrl?: string | undefined;
2178
+ authenticationTemplate?: string | undefined;
2179
+ headers?: Record<string, string> | [string, string][] | Headers | undefined;
2180
+ relayBaseUrl?: string | undefined;
2181
+ }, {
2182
+ url: string;
2183
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
2184
+ authenticationId?: number | undefined;
2185
+ body?: any;
2186
+ callbackUrl?: string | undefined;
2187
+ authenticationTemplate?: string | undefined;
2188
+ headers?: Record<string, string> | [string, string][] | Headers | undefined;
2189
+ relayBaseUrl?: string | undefined;
2190
+ }>;
2191
+ type RelayRequestOptions = z.infer<typeof RelayRequestSchema>;
2192
+ declare const RelayFetchSchema: z.ZodObject<{
2193
+ url: z.ZodString;
2194
+ method: z.ZodOptional<z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]>>;
2195
+ body: z.ZodOptional<z.ZodAny>;
2196
+ authenticationId: z.ZodOptional<z.ZodNumber>;
2197
+ callbackUrl: z.ZodOptional<z.ZodString>;
2198
+ authenticationTemplate: z.ZodOptional<z.ZodString>;
2199
+ headers: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodString>, z.ZodType<Headers, z.ZodTypeDef, Headers>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">]>>;
2200
+ } & {
2201
+ relayBaseUrl: z.ZodOptional<z.ZodString>;
2202
+ }, "strip", z.ZodTypeAny, {
2203
+ url: string;
2204
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
2205
+ authenticationId?: number | undefined;
2206
+ body?: any;
2207
+ callbackUrl?: string | undefined;
2208
+ authenticationTemplate?: string | undefined;
2209
+ headers?: Record<string, string> | [string, string][] | Headers | undefined;
2210
+ relayBaseUrl?: string | undefined;
2211
+ }, {
2212
+ url: string;
2213
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
2214
+ authenticationId?: number | undefined;
2215
+ body?: any;
2216
+ callbackUrl?: string | undefined;
2217
+ authenticationTemplate?: string | undefined;
2218
+ headers?: Record<string, string> | [string, string][] | Headers | undefined;
2219
+ relayBaseUrl?: string | undefined;
2220
+ }>;
2221
+
2222
+ declare const LockVersionSchema: z.ZodObject<{
2223
+ appKey: z.ZodString;
2224
+ }, "strip", z.ZodTypeAny, {
2225
+ appKey: string;
2226
+ }, {
2227
+ appKey: string;
2228
+ }>;
2229
+ type LockVersionOptions = z.infer<typeof LockVersionSchema>;
2230
+
2231
2231
  declare const ListAppsSchema: z.ZodObject<{
2232
2232
  appKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2233
2233
  search: z.ZodOptional<z.ZodString>;
@@ -2519,7 +2519,7 @@ declare const RunActionSchema: z.ZodObject<{
2519
2519
  actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
2520
2520
  actionKey: z.ZodString;
2521
2521
  authenticationId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2522
- inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2522
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2523
2523
  pageSize: z.ZodOptional<z.ZodNumber>;
2524
2524
  maxItems: z.ZodOptional<z.ZodNumber>;
2525
2525
  }, "strip", z.ZodTypeAny, {
@@ -2527,7 +2527,7 @@ declare const RunActionSchema: z.ZodObject<{
2527
2527
  actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
2528
2528
  actionKey: string;
2529
2529
  authenticationId?: number | null | undefined;
2530
- inputs?: Record<string, any> | undefined;
2530
+ inputs?: Record<string, unknown> | undefined;
2531
2531
  pageSize?: number | undefined;
2532
2532
  maxItems?: number | undefined;
2533
2533
  }, {
@@ -2535,7 +2535,7 @@ declare const RunActionSchema: z.ZodObject<{
2535
2535
  actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
2536
2536
  actionKey: string;
2537
2537
  authenticationId?: number | null | undefined;
2538
- inputs?: Record<string, any> | undefined;
2538
+ inputs?: Record<string, unknown> | undefined;
2539
2539
  pageSize?: number | undefined;
2540
2540
  maxItems?: number | undefined;
2541
2541
  }>;
@@ -2946,7 +2946,7 @@ declare const ListInputFieldChoicesSchema: z.ZodObject<{
2946
2946
  actionKey: z.ZodString;
2947
2947
  inputFieldKey: z.ZodString;
2948
2948
  authenticationId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2949
- inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2949
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2950
2950
  page: z.ZodOptional<z.ZodNumber>;
2951
2951
  pageSize: z.ZodOptional<z.ZodNumber>;
2952
2952
  maxItems: z.ZodOptional<z.ZodNumber>;
@@ -2957,7 +2957,7 @@ declare const ListInputFieldChoicesSchema: z.ZodObject<{
2957
2957
  inputFieldKey: string;
2958
2958
  page?: number | undefined;
2959
2959
  authenticationId?: number | null | undefined;
2960
- inputs?: Record<string, any> | undefined;
2960
+ inputs?: Record<string, unknown> | undefined;
2961
2961
  pageSize?: number | undefined;
2962
2962
  maxItems?: number | undefined;
2963
2963
  }, {
@@ -2967,7 +2967,7 @@ declare const ListInputFieldChoicesSchema: z.ZodObject<{
2967
2967
  inputFieldKey: string;
2968
2968
  page?: number | undefined;
2969
2969
  authenticationId?: number | null | undefined;
2970
- inputs?: Record<string, any> | undefined;
2970
+ inputs?: Record<string, unknown> | undefined;
2971
2971
  pageSize?: number | undefined;
2972
2972
  maxItems?: number | undefined;
2973
2973
  }>;