@zapier/zapier-sdk 0.6.4 → 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/CHANGELOG.md +18 -0
- package/README.md +55 -23
- package/dist/api/schemas.d.ts +114 -0
- package/dist/api/schemas.d.ts.map +1 -1
- package/dist/api/schemas.js +45 -0
- package/dist/api/types.d.ts +8 -3
- package/dist/api/types.d.ts.map +1 -1
- package/dist/index.cjs +173 -9
- package/dist/index.d.mts +516 -442
- package/dist/index.mjs +173 -9
- package/dist/plugins/findFirstAuthentication/index.test.js +3 -3
- package/dist/plugins/findFirstAuthentication/schemas.d.ts +3 -3
- package/dist/plugins/findFirstAuthentication/schemas.js +1 -1
- package/dist/plugins/findUniqueAuthentication/index.test.js +3 -3
- package/dist/plugins/findUniqueAuthentication/schemas.d.ts +3 -3
- package/dist/plugins/findUniqueAuthentication/schemas.js +1 -1
- package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/index.js +2 -3
- package/dist/plugins/listAuthentications/index.test.js +5 -5
- package/dist/plugins/listAuthentications/schemas.d.ts +3 -3
- package/dist/plugins/listAuthentications/schemas.js +1 -1
- package/dist/plugins/listInputFieldChoices/index.d.ts +28 -0
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -0
- package/dist/plugins/listInputFieldChoices/index.js +78 -0
- package/dist/plugins/listInputFieldChoices/index.test.d.ts +2 -0
- package/dist/plugins/listInputFieldChoices/index.test.d.ts.map +1 -0
- package/dist/plugins/listInputFieldChoices/index.test.js +537 -0
- package/dist/plugins/listInputFieldChoices/schemas.d.ts +61 -0
- package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +1 -0
- package/dist/plugins/listInputFieldChoices/schemas.js +73 -0
- package/dist/plugins/listInputFields/schemas.d.ts +3 -3
- package/dist/plugins/runAction/schemas.d.ts +5 -5
- package/dist/plugins/runAction/schemas.d.ts.map +1 -1
- package/dist/sdk.d.ts +7 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +2 -0
- package/dist/types/functions.d.ts +1 -1
- package/dist/types/functions.d.ts.map +1 -1
- package/dist/types/properties.d.ts +2 -2
- package/dist/types/properties.d.ts.map +1 -1
- package/dist/types/properties.js +2 -2
- package/package.json +1 -1
- package/src/api/schemas.ts +62 -0
- package/src/api/types.ts +17 -2
- package/src/plugins/findFirstAuthentication/index.test.ts +3 -3
- package/src/plugins/findFirstAuthentication/schemas.ts +1 -1
- package/src/plugins/findUniqueAuthentication/index.test.ts +3 -3
- package/src/plugins/findUniqueAuthentication/schemas.ts +1 -1
- package/src/plugins/listAuthentications/index.test.ts +5 -5
- package/src/plugins/listAuthentications/index.ts +2 -3
- package/src/plugins/listAuthentications/schemas.ts +1 -1
- package/src/plugins/listInputFieldChoices/index.test.ts +653 -0
- package/src/plugins/listInputFieldChoices/index.ts +152 -0
- package/src/plugins/listInputFieldChoices/schemas.ts +139 -0
- package/src/plugins/runAction/schemas.ts +2 -2
- package/src/sdk.ts +2 -0
- package/src/types/functions.ts +1 -1
- package/src/types/properties.ts +2 -2
- package/tsconfig.tsbuildinfo +1 -1
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
|
*
|
|
@@ -906,176 +687,29 @@ interface SdkEvent {
|
|
|
906
687
|
interface AuthEvent extends SdkEvent {
|
|
907
688
|
type: "auth_refreshing" | "auth_success" | "auth_error" | "auth_logout";
|
|
908
689
|
payload?: {
|
|
909
|
-
message?: string;
|
|
910
|
-
error?: string;
|
|
911
|
-
operation?: string;
|
|
912
|
-
};
|
|
913
|
-
}
|
|
914
|
-
interface ApiEvent extends SdkEvent {
|
|
915
|
-
type: "api_request" | "api_response" | "api_error";
|
|
916
|
-
payload?: {
|
|
917
|
-
url?: string;
|
|
918
|
-
method?: string;
|
|
919
|
-
status?: number;
|
|
920
|
-
duration?: number;
|
|
921
|
-
error?: string;
|
|
922
|
-
};
|
|
923
|
-
}
|
|
924
|
-
interface LoadingEvent extends SdkEvent {
|
|
925
|
-
type: "loading_start" | "loading_end";
|
|
926
|
-
payload?: {
|
|
927
|
-
operation?: string;
|
|
928
|
-
resource?: string;
|
|
929
|
-
};
|
|
930
|
-
}
|
|
931
|
-
type EventCallback = (event: SdkEvent) => void;
|
|
932
|
-
|
|
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
|
-
account_id: z.ZodOptional<z.ZodString>;
|
|
974
|
-
owner: z.ZodOptional<z.ZodString>;
|
|
975
|
-
}, "strip", z.ZodTypeAny, {
|
|
976
|
-
title?: string | undefined;
|
|
977
|
-
search?: string | undefined;
|
|
978
|
-
account_id?: string | undefined;
|
|
979
|
-
appKey?: string | undefined;
|
|
980
|
-
owner?: string | undefined;
|
|
981
|
-
}, {
|
|
982
|
-
title?: string | undefined;
|
|
983
|
-
search?: string | undefined;
|
|
984
|
-
account_id?: string | undefined;
|
|
985
|
-
appKey?: 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
|
-
account_id: z.ZodOptional<z.ZodString>;
|
|
995
|
-
owner: z.ZodOptional<z.ZodString>;
|
|
996
|
-
}, "strip", z.ZodTypeAny, {
|
|
997
|
-
title?: string | undefined;
|
|
998
|
-
search?: string | undefined;
|
|
999
|
-
account_id?: string | undefined;
|
|
1000
|
-
appKey?: string | undefined;
|
|
1001
|
-
owner?: string | undefined;
|
|
1002
|
-
}, {
|
|
1003
|
-
title?: string | undefined;
|
|
1004
|
-
search?: string | undefined;
|
|
1005
|
-
account_id?: string | undefined;
|
|
1006
|
-
appKey?: 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>;
|
|
690
|
+
message?: string;
|
|
691
|
+
error?: string;
|
|
692
|
+
operation?: string;
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
interface ApiEvent extends SdkEvent {
|
|
696
|
+
type: "api_request" | "api_response" | "api_error";
|
|
697
|
+
payload?: {
|
|
698
|
+
url?: string;
|
|
699
|
+
method?: string;
|
|
700
|
+
status?: number;
|
|
701
|
+
duration?: number;
|
|
702
|
+
error?: string;
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
interface LoadingEvent extends SdkEvent {
|
|
706
|
+
type: "loading_start" | "loading_end";
|
|
707
|
+
payload?: {
|
|
708
|
+
operation?: string;
|
|
709
|
+
resource?: string;
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
type EventCallback = (event: SdkEvent) => void;
|
|
1079
713
|
|
|
1080
714
|
declare const NeedSchema: z.ZodObject<{
|
|
1081
715
|
key: z.ZodString;
|
|
@@ -2175,58 +1809,424 @@ declare const NeedsResponseSchema: z.ZodObject<{
|
|
|
2175
1809
|
}>;
|
|
2176
1810
|
|
|
2177
1811
|
/**
|
|
2178
|
-
* API Client Type Definitions
|
|
2179
|
-
*
|
|
2180
|
-
* This module contains all type definitions related to the Zapier API client,
|
|
2181
|
-
* including configuration options, client interfaces, request/response types,
|
|
2182
|
-
* and API response models.
|
|
2183
|
-
*
|
|
2184
|
-
* API response model types are inferred from Zod schemas defined in api/schemas.ts
|
|
2185
|
-
* to ensure a single source of truth and eliminate duplication.
|
|
1812
|
+
* API Client Type Definitions
|
|
1813
|
+
*
|
|
1814
|
+
* This module contains all type definitions related to the Zapier API client,
|
|
1815
|
+
* including configuration options, client interfaces, request/response types,
|
|
1816
|
+
* and API response models.
|
|
1817
|
+
*
|
|
1818
|
+
* API response model types are inferred from Zod schemas defined in api/schemas.ts
|
|
1819
|
+
* to ensure a single source of truth and eliminate duplication.
|
|
1820
|
+
*/
|
|
1821
|
+
|
|
1822
|
+
interface ApiClient {
|
|
1823
|
+
get: <T = unknown>(path: string, options?: RequestOptions) => Promise<T>;
|
|
1824
|
+
post: <T = unknown>(path: string, data?: unknown, options?: RequestOptions) => Promise<T>;
|
|
1825
|
+
put: <T = unknown>(path: string, data?: unknown, options?: RequestOptions) => Promise<T>;
|
|
1826
|
+
delete: <T = unknown>(path: string, options?: RequestOptions) => Promise<T>;
|
|
1827
|
+
poll: <T = unknown>(path: string, options?: PollOptions) => Promise<T>;
|
|
1828
|
+
fetch: (path: string, init?: RequestInit & {
|
|
1829
|
+
searchParams?: Record<string, string>;
|
|
1830
|
+
authRequired?: boolean;
|
|
1831
|
+
}) => Promise<Response>;
|
|
1832
|
+
}
|
|
1833
|
+
interface RequestOptions {
|
|
1834
|
+
headers?: Record<string, string>;
|
|
1835
|
+
searchParams?: Record<string, string>;
|
|
1836
|
+
authRequired?: boolean;
|
|
1837
|
+
customErrorHandler?: (errorInfo: {
|
|
1838
|
+
status: number;
|
|
1839
|
+
statusText: string;
|
|
1840
|
+
data: unknown;
|
|
1841
|
+
}) => Error | undefined;
|
|
1842
|
+
}
|
|
1843
|
+
interface PollOptions extends RequestOptions {
|
|
1844
|
+
maxAttempts?: number;
|
|
1845
|
+
initialDelay?: number;
|
|
1846
|
+
maxDelay?: number;
|
|
1847
|
+
successStatus?: number;
|
|
1848
|
+
pendingStatus?: number;
|
|
1849
|
+
resultExtractor?: (response: unknown) => unknown;
|
|
1850
|
+
}
|
|
1851
|
+
type Need = z.infer<typeof NeedSchema>;
|
|
1852
|
+
type Action = z.infer<typeof ActionSchema>;
|
|
1853
|
+
type Choice = z.infer<typeof ChoiceSchema>;
|
|
1854
|
+
type Field = z.infer<typeof FieldSchema>;
|
|
1855
|
+
type ActionExecutionResult = z.infer<typeof ActionExecutionResultSchema>;
|
|
1856
|
+
type ActionFieldChoice = z.infer<typeof ActionFieldChoiceSchema>;
|
|
1857
|
+
type ActionField = z.infer<typeof ActionFieldSchema>;
|
|
1858
|
+
type Authentication = z.infer<typeof AuthenticationSchema>;
|
|
1859
|
+
type AuthenticationsResponse = z.infer<typeof AuthenticationsResponseSchema>;
|
|
1860
|
+
type UserProfile = z.infer<typeof UserProfileSchema>;
|
|
1861
|
+
type App = z.infer<typeof AppSchema>;
|
|
1862
|
+
type NeedsRequest = z.infer<typeof NeedsRequestSchema>;
|
|
1863
|
+
type NeedsResponse = z.infer<typeof NeedsResponseSchema>;
|
|
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
|
|
2186
2052
|
*/
|
|
2053
|
+
declare function formatErrorMessage(error: ZapierError): string;
|
|
2187
2054
|
|
|
2188
|
-
interface
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
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;
|
|
2197
2070
|
}) => Promise<Response>;
|
|
2198
2071
|
}
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
authRequired?: boolean;
|
|
2203
|
-
customErrorHandler?: (errorInfo: {
|
|
2204
|
-
status: number;
|
|
2205
|
-
statusText: string;
|
|
2206
|
-
data: unknown;
|
|
2207
|
-
}) => Error | undefined;
|
|
2072
|
+
type ActionTypeProxy = BaseActionTypeProxy & Partial<FetchActionType>;
|
|
2073
|
+
interface AppProxy {
|
|
2074
|
+
[type: string]: ActionTypeProxy;
|
|
2208
2075
|
}
|
|
2209
|
-
interface
|
|
2210
|
-
|
|
2211
|
-
initialDelay?: number;
|
|
2212
|
-
maxDelay?: number;
|
|
2213
|
-
successStatus?: number;
|
|
2214
|
-
pendingStatus?: number;
|
|
2215
|
-
resultExtractor?: (response: unknown) => unknown;
|
|
2076
|
+
interface AppFactory {
|
|
2077
|
+
(options: AppFactoryOptions): AppProxy;
|
|
2216
2078
|
}
|
|
2217
|
-
type
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
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
2230
|
|
|
2231
2231
|
declare const ListAppsSchema: z.ZodObject<{
|
|
2232
2232
|
appKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -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.
|
|
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,
|
|
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,
|
|
2538
|
+
inputs?: Record<string, unknown> | undefined;
|
|
2539
2539
|
pageSize?: number | undefined;
|
|
2540
2540
|
maxItems?: number | undefined;
|
|
2541
2541
|
}>;
|
|
@@ -2569,25 +2569,25 @@ declare const ListAuthenticationsSchema: z.ZodObject<{
|
|
|
2569
2569
|
appKey: z.ZodOptional<z.ZodString>;
|
|
2570
2570
|
search: z.ZodOptional<z.ZodString>;
|
|
2571
2571
|
title: z.ZodOptional<z.ZodString>;
|
|
2572
|
-
|
|
2572
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
2573
2573
|
owner: z.ZodOptional<z.ZodString>;
|
|
2574
2574
|
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
2575
2575
|
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
2576
2576
|
}, "strip", z.ZodTypeAny, {
|
|
2577
2577
|
title?: string | undefined;
|
|
2578
2578
|
search?: string | undefined;
|
|
2579
|
-
account_id?: string | undefined;
|
|
2580
2579
|
appKey?: string | undefined;
|
|
2581
2580
|
pageSize?: number | undefined;
|
|
2582
2581
|
maxItems?: number | undefined;
|
|
2582
|
+
accountId?: string | undefined;
|
|
2583
2583
|
owner?: string | undefined;
|
|
2584
2584
|
}, {
|
|
2585
2585
|
title?: string | undefined;
|
|
2586
2586
|
search?: string | undefined;
|
|
2587
|
-
account_id?: string | undefined;
|
|
2588
2587
|
appKey?: string | undefined;
|
|
2589
2588
|
pageSize?: number | undefined;
|
|
2590
2589
|
maxItems?: number | undefined;
|
|
2590
|
+
accountId?: string | undefined;
|
|
2591
2591
|
owner?: string | undefined;
|
|
2592
2592
|
}>;
|
|
2593
2593
|
type ListAuthenticationsOptions = z.infer<typeof ListAuthenticationsSchema>;
|
|
@@ -2923,12 +2923,80 @@ declare function getTokenFromCliLogin(options?: AuthOptions): Promise<string | u
|
|
|
2923
2923
|
*/
|
|
2924
2924
|
declare function getTokenFromEnvOrConfig(options?: AuthOptions): Promise<string | undefined>;
|
|
2925
2925
|
|
|
2926
|
+
declare const InputFieldChoiceItemSchema: z.ZodObject<{
|
|
2927
|
+
key: z.ZodOptional<z.ZodString>;
|
|
2928
|
+
label: z.ZodOptional<z.ZodString>;
|
|
2929
|
+
sample: z.ZodOptional<z.ZodString>;
|
|
2930
|
+
value: z.ZodOptional<z.ZodString>;
|
|
2931
|
+
}, "strip", z.ZodTypeAny, {
|
|
2932
|
+
value?: string | undefined;
|
|
2933
|
+
key?: string | undefined;
|
|
2934
|
+
label?: string | undefined;
|
|
2935
|
+
sample?: string | undefined;
|
|
2936
|
+
}, {
|
|
2937
|
+
value?: string | undefined;
|
|
2938
|
+
key?: string | undefined;
|
|
2939
|
+
label?: string | undefined;
|
|
2940
|
+
sample?: string | undefined;
|
|
2941
|
+
}>;
|
|
2942
|
+
type InputFieldChoiceItem = z.infer<typeof InputFieldChoiceItemSchema>;
|
|
2943
|
+
declare const ListInputFieldChoicesSchema: z.ZodObject<{
|
|
2944
|
+
appKey: z.ZodString;
|
|
2945
|
+
actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
2946
|
+
actionKey: z.ZodString;
|
|
2947
|
+
inputFieldKey: z.ZodString;
|
|
2948
|
+
authenticationId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
2949
|
+
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2950
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
2951
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
2952
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
2953
|
+
}, "strip", z.ZodTypeAny, {
|
|
2954
|
+
appKey: string;
|
|
2955
|
+
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
2956
|
+
actionKey: string;
|
|
2957
|
+
inputFieldKey: string;
|
|
2958
|
+
page?: number | undefined;
|
|
2959
|
+
authenticationId?: number | null | undefined;
|
|
2960
|
+
inputs?: Record<string, unknown> | undefined;
|
|
2961
|
+
pageSize?: number | undefined;
|
|
2962
|
+
maxItems?: number | undefined;
|
|
2963
|
+
}, {
|
|
2964
|
+
appKey: string;
|
|
2965
|
+
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
2966
|
+
actionKey: string;
|
|
2967
|
+
inputFieldKey: string;
|
|
2968
|
+
page?: number | undefined;
|
|
2969
|
+
authenticationId?: number | null | undefined;
|
|
2970
|
+
inputs?: Record<string, unknown> | undefined;
|
|
2971
|
+
pageSize?: number | undefined;
|
|
2972
|
+
maxItems?: number | undefined;
|
|
2973
|
+
}>;
|
|
2974
|
+
type ListInputFieldChoicesOptions = z.infer<typeof ListInputFieldChoicesSchema>;
|
|
2975
|
+
|
|
2976
|
+
interface ListInputFieldChoicesPluginProvides {
|
|
2977
|
+
listInputFieldChoices: (options: ListInputFieldChoicesOptions) => Promise<{
|
|
2978
|
+
data: InputFieldChoiceItem[];
|
|
2979
|
+
}> & AsyncIterable<{
|
|
2980
|
+
data: InputFieldChoiceItem[];
|
|
2981
|
+
nextCursor?: string;
|
|
2982
|
+
}> & {
|
|
2983
|
+
items(): AsyncIterable<InputFieldChoiceItem>;
|
|
2984
|
+
};
|
|
2985
|
+
context: {
|
|
2986
|
+
meta: {
|
|
2987
|
+
listInputFieldChoices: {
|
|
2988
|
+
inputSchema: typeof ListInputFieldChoicesSchema;
|
|
2989
|
+
};
|
|
2990
|
+
};
|
|
2991
|
+
};
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2926
2994
|
interface ZapierSdkOptions extends BaseSdkOptions {
|
|
2927
2995
|
}
|
|
2928
2996
|
declare function createSdk<TCurrentSdk = {}, TCurrentContext = {
|
|
2929
2997
|
meta: Record<string, PluginMeta>;
|
|
2930
2998
|
}>(options?: ZapierSdkOptions, initialSdk?: TCurrentSdk, initialContext?: TCurrentContext): Sdk<TCurrentSdk, TCurrentContext>;
|
|
2931
|
-
declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk<ExtractSdkProperties<ApiPluginProvides> & ExtractSdkProperties<ListAppsPluginProvides> & ExtractSdkProperties<ManifestPluginProvides> & ExtractSdkProperties<GetAppPluginProvides> & ExtractSdkProperties<ListActionsPluginProvides> & ExtractSdkProperties<GetActionPluginProvides> & ExtractSdkProperties<ListInputFieldsPluginProvides> & ExtractSdkProperties<RunActionPluginProvides> & ExtractSdkProperties<LockVersionPluginProvides> & ExtractSdkProperties<ListAuthenticationsPluginProvides> & ExtractSdkProperties<GetAuthenticationPluginProvides> & ExtractSdkProperties<FindFirstAuthenticationPluginProvides> & ExtractSdkProperties<FindUniqueAuthenticationPluginProvides> & ExtractSdkProperties<RequestPluginProvides> & ExtractSdkProperties<FetchPluginProvides> & ExtractSdkProperties<AppsPluginProvides> & ExtractSdkProperties<GetProfilePluginProvides>, {
|
|
2999
|
+
declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk<ExtractSdkProperties<ApiPluginProvides> & ExtractSdkProperties<ListAppsPluginProvides> & ExtractSdkProperties<ManifestPluginProvides> & ExtractSdkProperties<GetAppPluginProvides> & ExtractSdkProperties<ListActionsPluginProvides> & ExtractSdkProperties<GetActionPluginProvides> & ExtractSdkProperties<ListInputFieldsPluginProvides> & ExtractSdkProperties<ListInputFieldChoicesPluginProvides> & ExtractSdkProperties<RunActionPluginProvides> & ExtractSdkProperties<LockVersionPluginProvides> & ExtractSdkProperties<ListAuthenticationsPluginProvides> & ExtractSdkProperties<GetAuthenticationPluginProvides> & ExtractSdkProperties<FindFirstAuthenticationPluginProvides> & ExtractSdkProperties<FindUniqueAuthenticationPluginProvides> & ExtractSdkProperties<RequestPluginProvides> & ExtractSdkProperties<FetchPluginProvides> & ExtractSdkProperties<AppsPluginProvides> & ExtractSdkProperties<GetProfilePluginProvides>, {
|
|
2932
3000
|
meta: Record<string, PluginMeta>;
|
|
2933
3001
|
} & {
|
|
2934
3002
|
api: ApiClient;
|
|
@@ -2966,6 +3034,12 @@ declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk
|
|
|
2966
3034
|
inputSchema: typeof ListInputFieldsSchema;
|
|
2967
3035
|
};
|
|
2968
3036
|
};
|
|
3037
|
+
} & {
|
|
3038
|
+
meta: {
|
|
3039
|
+
listInputFieldChoices: {
|
|
3040
|
+
inputSchema: typeof ListInputFieldChoicesSchema;
|
|
3041
|
+
};
|
|
3042
|
+
};
|
|
2969
3043
|
} & {
|
|
2970
3044
|
meta: {
|
|
2971
3045
|
runAction: {
|