@zapier/zapier-sdk 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +107 -83
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/schemas.d.ts +6 -6
- package/dist/api/types.d.ts +7 -7
- package/dist/api/types.d.ts.map +1 -1
- package/dist/index.cjs +343 -67
- package/dist/index.d.mts +416 -347
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.mjs +343 -67
- package/dist/plugins/api/index.js +1 -1
- package/dist/plugins/apps/types.d.ts +1 -1
- package/dist/plugins/apps/types.d.ts.map +1 -1
- package/dist/plugins/findFirstAuthentication/index.d.ts.map +1 -1
- package/dist/plugins/findFirstAuthentication/index.js +1 -0
- package/dist/plugins/findUniqueAuthentication/index.d.ts.map +1 -1
- package/dist/plugins/findUniqueAuthentication/index.js +1 -0
- package/dist/plugins/getAction/index.d.ts.map +1 -1
- package/dist/plugins/getAction/index.js +1 -0
- package/dist/plugins/getAction/index.test.js +1 -1
- package/dist/plugins/getApp/index.d.ts +6 -3
- package/dist/plugins/getApp/index.d.ts.map +1 -1
- package/dist/plugins/getApp/index.js +8 -18
- package/dist/plugins/getApp/index.test.js +2 -0
- package/dist/plugins/getAuthentication/index.d.ts.map +1 -1
- package/dist/plugins/getAuthentication/index.js +1 -0
- package/dist/plugins/getAuthentication/index.test.js +12 -1
- package/dist/plugins/getProfile/index.d.ts.map +1 -1
- package/dist/plugins/getProfile/index.js +1 -0
- package/dist/plugins/listActions/index.d.ts +5 -3
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/index.js +6 -6
- package/dist/plugins/listActions/index.test.js +26 -74
- package/dist/plugins/listActions/schemas.d.ts +4 -4
- package/dist/plugins/listApps/index.d.ts.map +1 -1
- package/dist/plugins/listApps/index.js +1 -0
- package/dist/plugins/listApps/schemas.d.ts +2 -2
- package/dist/plugins/listAuthentications/index.d.ts +4 -2
- package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/index.js +9 -12
- package/dist/plugins/listAuthentications/index.test.js +33 -40
- package/dist/plugins/listAuthentications/schemas.d.ts +4 -4
- package/dist/plugins/listInputFields/index.d.ts +3 -1
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.js +5 -5
- package/dist/plugins/listInputFields/index.test.js +10 -8
- package/dist/plugins/listInputFields/schemas.d.ts +4 -4
- package/dist/plugins/lockVersion/index.d.ts +24 -0
- package/dist/plugins/lockVersion/index.d.ts.map +1 -0
- package/dist/plugins/lockVersion/index.js +72 -0
- package/dist/plugins/lockVersion/index.test.d.ts +2 -0
- package/dist/plugins/lockVersion/index.test.d.ts.map +1 -0
- package/dist/plugins/lockVersion/index.test.js +129 -0
- package/dist/plugins/lockVersion/schemas.d.ts +10 -0
- package/dist/plugins/lockVersion/schemas.d.ts.map +1 -0
- package/dist/plugins/lockVersion/schemas.js +6 -0
- package/dist/plugins/manifest/index.d.ts +24 -0
- package/dist/plugins/manifest/index.d.ts.map +1 -0
- package/dist/plugins/manifest/index.js +119 -0
- package/dist/plugins/manifest/index.test.d.ts +2 -0
- package/dist/plugins/manifest/index.test.d.ts.map +1 -0
- package/dist/plugins/manifest/index.test.js +331 -0
- package/dist/plugins/manifest/schemas.d.ts +64 -0
- package/dist/plugins/manifest/schemas.d.ts.map +1 -0
- package/dist/plugins/manifest/schemas.js +25 -0
- package/dist/plugins/registry/index.d.ts +9 -1
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +68 -3
- package/dist/plugins/request/index.d.ts.map +1 -1
- package/dist/plugins/request/index.js +1 -0
- package/dist/plugins/request/index.test.js +6 -1
- package/dist/plugins/request/schemas.d.ts +4 -4
- package/dist/plugins/runAction/index.d.ts +2 -0
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +5 -5
- package/dist/plugins/runAction/index.test.js +9 -8
- package/dist/plugins/runAction/schemas.d.ts +4 -4
- package/dist/schemas/Auth.d.ts +4 -4
- package/dist/schemas/Field.d.ts.map +1 -1
- package/dist/sdk.d.ts +3 -3
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +18 -7
- package/dist/sdk.test.js +1 -1
- package/dist/types/errors.d.ts +6 -6
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/events.d.ts +1 -1
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/plugin.d.ts +10 -2
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/sdk.d.ts +13 -2
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/utils/validation.test.js +2 -1
- package/package.json +2 -2
- package/src/api/client.ts +3 -3
- package/src/api/index.ts +2 -0
- package/src/api/types.ts +15 -7
- package/src/index.ts +0 -2
- package/src/plugins/api/index.ts +1 -1
- package/src/plugins/apps/types.ts +1 -1
- package/src/plugins/findFirstAuthentication/index.ts +1 -0
- package/src/plugins/findUniqueAuthentication/index.ts +1 -0
- package/src/plugins/getAction/index.test.ts +1 -1
- package/src/plugins/getAction/index.ts +1 -0
- package/src/plugins/getApp/index.test.ts +2 -0
- package/src/plugins/getApp/index.ts +12 -24
- package/src/plugins/getAuthentication/index.test.ts +13 -3
- package/src/plugins/getAuthentication/index.ts +1 -0
- package/src/plugins/getProfile/index.ts +1 -0
- package/src/plugins/listActions/index.test.ts +30 -89
- package/src/plugins/listActions/index.ts +34 -27
- package/src/plugins/listApps/index.ts +1 -0
- package/src/plugins/listAuthentications/index.test.ts +38 -47
- package/src/plugins/listAuthentications/index.ts +21 -18
- package/src/plugins/listInputFields/index.test.ts +12 -9
- package/src/plugins/listInputFields/index.ts +10 -6
- package/src/plugins/lockVersion/index.test.ts +176 -0
- package/src/plugins/lockVersion/index.ts +112 -0
- package/src/plugins/lockVersion/schemas.ts +9 -0
- package/src/plugins/manifest/index.test.ts +439 -0
- package/src/plugins/manifest/index.ts +171 -0
- package/src/plugins/manifest/schemas.ts +53 -0
- package/src/plugins/registry/index.ts +89 -8
- package/src/plugins/request/index.test.ts +8 -4
- package/src/plugins/request/index.ts +1 -0
- package/src/plugins/runAction/index.test.ts +9 -8
- package/src/plugins/runAction/index.ts +18 -9
- package/src/schemas/Field.ts +5 -2
- package/src/sdk.test.ts +1 -1
- package/src/sdk.ts +22 -7
- package/src/types/errors.ts +9 -6
- package/src/types/events.ts +1 -1
- package/src/types/plugin.ts +14 -2
- package/src/types/sdk.ts +15 -1
- package/src/utils/validation.test.ts +2 -1
- package/tsconfig.tsbuildinfo +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -728,8 +728,8 @@ interface ApiError {
|
|
|
728
728
|
code: string;
|
|
729
729
|
title: string;
|
|
730
730
|
detail: string;
|
|
731
|
-
source?:
|
|
732
|
-
meta?:
|
|
731
|
+
source?: unknown;
|
|
732
|
+
meta?: unknown;
|
|
733
733
|
}
|
|
734
734
|
/**
|
|
735
735
|
* Base options for all error constructors
|
|
@@ -738,7 +738,7 @@ interface ErrorOptions {
|
|
|
738
738
|
statusCode?: number;
|
|
739
739
|
errors?: ApiError[];
|
|
740
740
|
cause?: unknown;
|
|
741
|
-
response?:
|
|
741
|
+
response?: unknown;
|
|
742
742
|
}
|
|
743
743
|
/**
|
|
744
744
|
* Base class for all Zapier SDK errors
|
|
@@ -749,7 +749,7 @@ declare abstract class ZapierError extends Error {
|
|
|
749
749
|
statusCode?: number;
|
|
750
750
|
errors?: ApiError[];
|
|
751
751
|
cause?: unknown;
|
|
752
|
-
response?:
|
|
752
|
+
response?: unknown;
|
|
753
753
|
constructor(message: string, options?: ErrorOptions);
|
|
754
754
|
}
|
|
755
755
|
/**
|
|
@@ -774,9 +774,9 @@ declare class ZapierAppNotFoundError extends ZapierError {
|
|
|
774
774
|
*/
|
|
775
775
|
declare class ZapierValidationError extends ZapierError {
|
|
776
776
|
readonly name = "ZapierValidationError";
|
|
777
|
-
details?:
|
|
777
|
+
details?: unknown;
|
|
778
778
|
constructor(message: string, options?: ErrorOptions & {
|
|
779
|
-
details?:
|
|
779
|
+
details?: unknown;
|
|
780
780
|
});
|
|
781
781
|
}
|
|
782
782
|
/**
|
|
@@ -871,7 +871,7 @@ interface AppFactoryOptions {
|
|
|
871
871
|
authenticationId: number;
|
|
872
872
|
}
|
|
873
873
|
interface BaseActionTypeProxy {
|
|
874
|
-
[action: string]: (options?: ActionExecutionOptions) =>
|
|
874
|
+
[action: string]: (options?: ActionExecutionOptions) => unknown;
|
|
875
875
|
}
|
|
876
876
|
interface FetchActionType {
|
|
877
877
|
fetch: (url: string | URL, init?: RequestInit & {
|
|
@@ -893,64 +893,189 @@ interface ActionProxy {
|
|
|
893
893
|
}
|
|
894
894
|
|
|
895
895
|
/**
|
|
896
|
-
*
|
|
897
|
-
* Plugin Type System with Explicit Context Dependencies
|
|
898
|
-
* ------------------------------
|
|
896
|
+
* SDK Event System
|
|
899
897
|
*
|
|
900
|
-
* This
|
|
901
|
-
*
|
|
898
|
+
* This module provides common event type definitions for the SDK's
|
|
899
|
+
* event system, including authentication, API, and loading events.
|
|
902
900
|
*/
|
|
903
|
-
interface
|
|
904
|
-
|
|
905
|
-
|
|
901
|
+
interface SdkEvent {
|
|
902
|
+
type: string;
|
|
903
|
+
payload?: Record<string, unknown>;
|
|
904
|
+
timestamp?: number;
|
|
906
905
|
}
|
|
907
|
-
interface
|
|
908
|
-
|
|
906
|
+
interface AuthEvent extends SdkEvent {
|
|
907
|
+
type: "auth_refreshing" | "auth_success" | "auth_error" | "auth_logout";
|
|
908
|
+
payload?: {
|
|
909
|
+
message?: string;
|
|
910
|
+
error?: string;
|
|
911
|
+
operation?: string;
|
|
912
|
+
};
|
|
909
913
|
}
|
|
910
|
-
|
|
911
|
-
type
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
meta: Record<string, any>;
|
|
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;
|
|
919
922
|
};
|
|
920
|
-
};
|
|
921
|
-
/**
|
|
922
|
-
* Plugin interface — now has 3 type params:
|
|
923
|
-
*
|
|
924
|
-
* TRequiresContext = what this plugin *needs* in context
|
|
925
|
-
* TProvides = what this plugin *returns* (sdk + context)
|
|
926
|
-
* TSdk = current sdk shape when plugin runs
|
|
927
|
-
*/
|
|
928
|
-
interface Plugin<TSdk = {}, TRequiresContext = {}, TProvides extends PluginProvides = PluginProvides> {
|
|
929
|
-
(params: {
|
|
930
|
-
sdk: TSdk;
|
|
931
|
-
context: TRequiresContext & {
|
|
932
|
-
meta: Record<string, any>;
|
|
933
|
-
};
|
|
934
|
-
}): TProvides;
|
|
935
923
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
}
|
|
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>;
|
|
954
1079
|
|
|
955
1080
|
declare const NeedSchema: z.ZodObject<{
|
|
956
1081
|
key: z.ZodString;
|
|
@@ -2074,65 +2199,85 @@ type App = z.infer<typeof AppSchema>;
|
|
|
2074
2199
|
type NeedsRequest = z.infer<typeof NeedsRequestSchema>;
|
|
2075
2200
|
type NeedsResponse = z.infer<typeof NeedsResponseSchema>;
|
|
2076
2201
|
|
|
2077
|
-
declare const
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
2083
|
-
authenticationTemplate: z.ZodOptional<z.ZodString>;
|
|
2084
|
-
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">]>>;
|
|
2085
|
-
} & {
|
|
2086
|
-
relayBaseUrl: z.ZodOptional<z.ZodString>;
|
|
2202
|
+
declare const ListAppsSchema: z.ZodObject<{
|
|
2203
|
+
appKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
2204
|
+
search: z.ZodOptional<z.ZodString>;
|
|
2205
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
2206
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
2087
2207
|
}, "strip", z.ZodTypeAny, {
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
callbackUrl?: string | undefined;
|
|
2093
|
-
authenticationTemplate?: string | undefined;
|
|
2094
|
-
headers?: Record<string, string> | [string, string][] | Headers | undefined;
|
|
2095
|
-
relayBaseUrl?: string | undefined;
|
|
2208
|
+
search?: string | undefined;
|
|
2209
|
+
pageSize?: number | undefined;
|
|
2210
|
+
maxItems?: number | undefined;
|
|
2211
|
+
appKeys?: string[] | undefined;
|
|
2096
2212
|
}, {
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
callbackUrl?: string | undefined;
|
|
2102
|
-
authenticationTemplate?: string | undefined;
|
|
2103
|
-
headers?: Record<string, string> | [string, string][] | Headers | undefined;
|
|
2104
|
-
relayBaseUrl?: string | undefined;
|
|
2105
|
-
}>;
|
|
2106
|
-
type RelayRequestOptions = z.infer<typeof RelayRequestSchema>;
|
|
2107
|
-
declare const RelayFetchSchema: z.ZodObject<{
|
|
2108
|
-
url: z.ZodString;
|
|
2109
|
-
method: z.ZodOptional<z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]>>;
|
|
2110
|
-
body: z.ZodOptional<z.ZodAny>;
|
|
2111
|
-
authenticationId: z.ZodOptional<z.ZodNumber>;
|
|
2112
|
-
callbackUrl: z.ZodOptional<z.ZodString>;
|
|
2113
|
-
authenticationTemplate: z.ZodOptional<z.ZodString>;
|
|
2114
|
-
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">]>>;
|
|
2115
|
-
} & {
|
|
2116
|
-
relayBaseUrl: z.ZodOptional<z.ZodString>;
|
|
2117
|
-
}, "strip", z.ZodTypeAny, {
|
|
2118
|
-
url: string;
|
|
2119
|
-
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
|
|
2120
|
-
body?: any;
|
|
2121
|
-
authenticationId?: number | undefined;
|
|
2122
|
-
callbackUrl?: string | undefined;
|
|
2123
|
-
authenticationTemplate?: string | undefined;
|
|
2124
|
-
headers?: Record<string, string> | [string, string][] | Headers | undefined;
|
|
2125
|
-
relayBaseUrl?: string | undefined;
|
|
2126
|
-
}, {
|
|
2127
|
-
url: string;
|
|
2128
|
-
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
|
|
2129
|
-
body?: any;
|
|
2130
|
-
authenticationId?: number | undefined;
|
|
2131
|
-
callbackUrl?: string | undefined;
|
|
2132
|
-
authenticationTemplate?: string | undefined;
|
|
2133
|
-
headers?: Record<string, string> | [string, string][] | Headers | undefined;
|
|
2134
|
-
relayBaseUrl?: string | undefined;
|
|
2213
|
+
search?: string | undefined;
|
|
2214
|
+
pageSize?: number | undefined;
|
|
2215
|
+
maxItems?: number | undefined;
|
|
2216
|
+
appKeys?: string[] | undefined;
|
|
2135
2217
|
}>;
|
|
2218
|
+
type ListAppsOptions = z.infer<typeof ListAppsSchema>;
|
|
2219
|
+
|
|
2220
|
+
interface ListAppsPluginProvides {
|
|
2221
|
+
listApps: (options?: ListAppsOptions) => Promise<{
|
|
2222
|
+
data: AppItem[];
|
|
2223
|
+
}> & AsyncIterable<{
|
|
2224
|
+
data: AppItem[];
|
|
2225
|
+
nextCursor?: string;
|
|
2226
|
+
}> & {
|
|
2227
|
+
items(): AsyncIterable<AppItem>;
|
|
2228
|
+
};
|
|
2229
|
+
context: {
|
|
2230
|
+
meta: {
|
|
2231
|
+
listApps: {
|
|
2232
|
+
inputSchema: typeof ListAppsSchema;
|
|
2233
|
+
};
|
|
2234
|
+
};
|
|
2235
|
+
};
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
interface LockVersionPluginProvides {
|
|
2239
|
+
lockVersion: (options: LockVersionOptions & {
|
|
2240
|
+
configPath?: string;
|
|
2241
|
+
}) => Promise<{
|
|
2242
|
+
data: AppItem;
|
|
2243
|
+
configPath: string;
|
|
2244
|
+
}>;
|
|
2245
|
+
context: {
|
|
2246
|
+
meta: {
|
|
2247
|
+
lockVersion: {
|
|
2248
|
+
inputSchema: typeof LockVersionSchema;
|
|
2249
|
+
};
|
|
2250
|
+
};
|
|
2251
|
+
};
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
interface RegistryPluginProvides {
|
|
2255
|
+
getRegistry: () => {
|
|
2256
|
+
functions: FunctionRegistryEntry[];
|
|
2257
|
+
categories: {
|
|
2258
|
+
key: string;
|
|
2259
|
+
title: string;
|
|
2260
|
+
titlePlural: string;
|
|
2261
|
+
functions: string[];
|
|
2262
|
+
}[];
|
|
2263
|
+
};
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
declare const GetProfileSchema: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
2267
|
+
type GetProfileOptions = z.infer<typeof GetProfileSchema> & FunctionOptions;
|
|
2268
|
+
|
|
2269
|
+
interface GetProfilePluginProvides {
|
|
2270
|
+
getProfile: (options?: GetProfileOptions) => Promise<{
|
|
2271
|
+
data: UserProfileItem;
|
|
2272
|
+
}>;
|
|
2273
|
+
context: {
|
|
2274
|
+
meta: {
|
|
2275
|
+
getProfile: {
|
|
2276
|
+
inputSchema: typeof GetProfileSchema;
|
|
2277
|
+
};
|
|
2278
|
+
};
|
|
2279
|
+
};
|
|
2280
|
+
}
|
|
2136
2281
|
|
|
2137
2282
|
interface RequestPluginProvides {
|
|
2138
2283
|
request: (options: RelayRequestOptions) => Promise<Response>;
|
|
@@ -2164,66 +2309,6 @@ type ZapierFetchInitOptions = RequestInit & {
|
|
|
2164
2309
|
authenticationTemplate?: string;
|
|
2165
2310
|
};
|
|
2166
2311
|
|
|
2167
|
-
declare const RunActionSchema: z.ZodObject<{
|
|
2168
|
-
appKey: z.ZodString;
|
|
2169
|
-
actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
2170
|
-
actionKey: z.ZodString;
|
|
2171
|
-
authenticationId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
2172
|
-
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
2173
|
-
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
2174
|
-
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
2175
|
-
}, "strip", z.ZodTypeAny, {
|
|
2176
|
-
appKey: string;
|
|
2177
|
-
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
2178
|
-
actionKey: string;
|
|
2179
|
-
authenticationId?: number | null | undefined;
|
|
2180
|
-
maxItems?: number | undefined;
|
|
2181
|
-
pageSize?: number | undefined;
|
|
2182
|
-
inputs?: Record<string, any> | undefined;
|
|
2183
|
-
}, {
|
|
2184
|
-
appKey: string;
|
|
2185
|
-
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
2186
|
-
actionKey: string;
|
|
2187
|
-
authenticationId?: number | null | undefined;
|
|
2188
|
-
maxItems?: number | undefined;
|
|
2189
|
-
pageSize?: number | undefined;
|
|
2190
|
-
inputs?: Record<string, any> | undefined;
|
|
2191
|
-
}>;
|
|
2192
|
-
type RunActionOptions = z.infer<typeof RunActionSchema>;
|
|
2193
|
-
|
|
2194
|
-
declare const GetActionSchema: z.ZodObject<{
|
|
2195
|
-
appKey: z.ZodString;
|
|
2196
|
-
actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
2197
|
-
actionKey: z.ZodString;
|
|
2198
|
-
}, "strip", z.ZodTypeAny, {
|
|
2199
|
-
appKey: string;
|
|
2200
|
-
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
2201
|
-
actionKey: string;
|
|
2202
|
-
}, {
|
|
2203
|
-
appKey: string;
|
|
2204
|
-
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
2205
|
-
actionKey: string;
|
|
2206
|
-
}>;
|
|
2207
|
-
type GetActionOptions = z.infer<typeof GetActionSchema>;
|
|
2208
|
-
|
|
2209
|
-
declare const ListActionsSchema: z.ZodObject<{
|
|
2210
|
-
appKey: z.ZodString;
|
|
2211
|
-
actionType: z.ZodOptional<z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>>;
|
|
2212
|
-
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
2213
|
-
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
2214
|
-
}, "strip", z.ZodTypeAny, {
|
|
2215
|
-
appKey: string;
|
|
2216
|
-
maxItems?: number | undefined;
|
|
2217
|
-
pageSize?: number | undefined;
|
|
2218
|
-
actionType?: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write" | undefined;
|
|
2219
|
-
}, {
|
|
2220
|
-
appKey: string;
|
|
2221
|
-
maxItems?: number | undefined;
|
|
2222
|
-
pageSize?: number | undefined;
|
|
2223
|
-
actionType?: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write" | undefined;
|
|
2224
|
-
}>;
|
|
2225
|
-
type ListActionsOptions = z.infer<typeof ListActionsSchema>;
|
|
2226
|
-
|
|
2227
2312
|
declare const GetAppSchema: z.ZodObject<{
|
|
2228
2313
|
appKey: z.ZodString;
|
|
2229
2314
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -2233,39 +2318,23 @@ declare const GetAppSchema: z.ZodObject<{
|
|
|
2233
2318
|
}>;
|
|
2234
2319
|
type GetAppOptions = z.infer<typeof GetAppSchema>;
|
|
2235
2320
|
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
}, {
|
|
2247
|
-
search?: string | undefined;
|
|
2248
|
-
maxItems?: number | undefined;
|
|
2249
|
-
pageSize?: number | undefined;
|
|
2250
|
-
appKeys?: string[] | undefined;
|
|
2251
|
-
}>;
|
|
2252
|
-
type ListAppsOptions = z.infer<typeof ListAppsSchema>;
|
|
2321
|
+
type ManifestEntry = {
|
|
2322
|
+
implementationName: string;
|
|
2323
|
+
version?: string;
|
|
2324
|
+
};
|
|
2325
|
+
type GetManifestEntry = (appKey: string) => ManifestEntry | null;
|
|
2326
|
+
type GetVersionedImplementationId = (appKey: string) => Promise<string | null>;
|
|
2327
|
+
type GetImplementation = (appKey: string) => Promise<AppItem | null>;
|
|
2328
|
+
type Manifest = {
|
|
2329
|
+
apps: Record<string, ManifestEntry>;
|
|
2330
|
+
};
|
|
2253
2331
|
|
|
2254
|
-
interface
|
|
2255
|
-
listApps: (options?: ListAppsOptions) => Promise<{
|
|
2256
|
-
data: AppItem[];
|
|
2257
|
-
}> & AsyncIterable<{
|
|
2258
|
-
data: AppItem[];
|
|
2259
|
-
nextCursor?: string;
|
|
2260
|
-
}> & {
|
|
2261
|
-
items(): AsyncIterable<AppItem>;
|
|
2262
|
-
};
|
|
2332
|
+
interface ManifestPluginProvides {
|
|
2263
2333
|
context: {
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
};
|
|
2334
|
+
manifest: Manifest | null;
|
|
2335
|
+
getVersionedImplementationId: GetVersionedImplementationId;
|
|
2336
|
+
getManifestEntry: GetManifestEntry;
|
|
2337
|
+
getImplementation: GetImplementation;
|
|
2269
2338
|
};
|
|
2270
2339
|
}
|
|
2271
2340
|
|
|
@@ -2282,6 +2351,24 @@ interface GetAppPluginProvides {
|
|
|
2282
2351
|
};
|
|
2283
2352
|
}
|
|
2284
2353
|
|
|
2354
|
+
declare const ListActionsSchema: z.ZodObject<{
|
|
2355
|
+
appKey: z.ZodString;
|
|
2356
|
+
actionType: z.ZodOptional<z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>>;
|
|
2357
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
2358
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
2359
|
+
}, "strip", z.ZodTypeAny, {
|
|
2360
|
+
appKey: string;
|
|
2361
|
+
actionType?: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write" | undefined;
|
|
2362
|
+
pageSize?: number | undefined;
|
|
2363
|
+
maxItems?: number | undefined;
|
|
2364
|
+
}, {
|
|
2365
|
+
appKey: string;
|
|
2366
|
+
actionType?: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write" | undefined;
|
|
2367
|
+
pageSize?: number | undefined;
|
|
2368
|
+
maxItems?: number | undefined;
|
|
2369
|
+
}>;
|
|
2370
|
+
type ListActionsOptions = z.infer<typeof ListActionsSchema>;
|
|
2371
|
+
|
|
2285
2372
|
interface ListActionsPluginProvides {
|
|
2286
2373
|
listActions: (options?: ListActionsOptions) => Promise<{
|
|
2287
2374
|
data: ActionItem[];
|
|
@@ -2300,6 +2387,21 @@ interface ListActionsPluginProvides {
|
|
|
2300
2387
|
};
|
|
2301
2388
|
}
|
|
2302
2389
|
|
|
2390
|
+
declare const GetActionSchema: z.ZodObject<{
|
|
2391
|
+
appKey: z.ZodString;
|
|
2392
|
+
actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
2393
|
+
actionKey: z.ZodString;
|
|
2394
|
+
}, "strip", z.ZodTypeAny, {
|
|
2395
|
+
appKey: string;
|
|
2396
|
+
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
2397
|
+
actionKey: string;
|
|
2398
|
+
}, {
|
|
2399
|
+
appKey: string;
|
|
2400
|
+
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
2401
|
+
actionKey: string;
|
|
2402
|
+
}>;
|
|
2403
|
+
type GetActionOptions = z.infer<typeof GetActionSchema>;
|
|
2404
|
+
|
|
2303
2405
|
interface GetActionPluginProvides {
|
|
2304
2406
|
getAction: (options: GetActionOptions) => Promise<{
|
|
2305
2407
|
data: ActionItem;
|
|
@@ -2313,70 +2415,7 @@ interface GetActionPluginProvides {
|
|
|
2313
2415
|
};
|
|
2314
2416
|
}
|
|
2315
2417
|
|
|
2316
|
-
|
|
2317
|
-
runAction: (options?: RunActionOptions) => Promise<{
|
|
2318
|
-
data: any[];
|
|
2319
|
-
}> & AsyncIterable<{
|
|
2320
|
-
data: any[];
|
|
2321
|
-
nextCursor?: string;
|
|
2322
|
-
}> & {
|
|
2323
|
-
items(): AsyncIterable<any>;
|
|
2324
|
-
};
|
|
2325
|
-
context: {
|
|
2326
|
-
meta: {
|
|
2327
|
-
runAction: {
|
|
2328
|
-
inputSchema: typeof RunActionSchema;
|
|
2329
|
-
};
|
|
2330
|
-
};
|
|
2331
|
-
};
|
|
2332
|
-
}
|
|
2333
|
-
|
|
2334
|
-
interface AppsPluginProvides {
|
|
2335
|
-
apps: ActionProxy;
|
|
2336
|
-
}
|
|
2337
|
-
declare const appsPlugin: Plugin<GetSdkType<FetchPluginProvides & RunActionPluginProvides>, // requires fetch + runAction in SDK
|
|
2338
|
-
{}, // no context requirements
|
|
2339
|
-
AppsPluginProvides>;
|
|
2340
|
-
|
|
2341
|
-
/**
|
|
2342
|
-
* SDK Event System
|
|
2343
|
-
*
|
|
2344
|
-
* This module provides common event type definitions for the SDK's
|
|
2345
|
-
* event system, including authentication, API, and loading events.
|
|
2346
|
-
*/
|
|
2347
|
-
interface SdkEvent {
|
|
2348
|
-
type: string;
|
|
2349
|
-
payload?: Record<string, any>;
|
|
2350
|
-
timestamp?: number;
|
|
2351
|
-
}
|
|
2352
|
-
interface AuthEvent extends SdkEvent {
|
|
2353
|
-
type: "auth_refreshing" | "auth_success" | "auth_error" | "auth_logout";
|
|
2354
|
-
payload?: {
|
|
2355
|
-
message?: string;
|
|
2356
|
-
error?: string;
|
|
2357
|
-
operation?: string;
|
|
2358
|
-
};
|
|
2359
|
-
}
|
|
2360
|
-
interface ApiEvent extends SdkEvent {
|
|
2361
|
-
type: "api_request" | "api_response" | "api_error";
|
|
2362
|
-
payload?: {
|
|
2363
|
-
url?: string;
|
|
2364
|
-
method?: string;
|
|
2365
|
-
status?: number;
|
|
2366
|
-
duration?: number;
|
|
2367
|
-
error?: string;
|
|
2368
|
-
};
|
|
2369
|
-
}
|
|
2370
|
-
interface LoadingEvent extends SdkEvent {
|
|
2371
|
-
type: "loading_start" | "loading_end";
|
|
2372
|
-
payload?: {
|
|
2373
|
-
operation?: string;
|
|
2374
|
-
resource?: string;
|
|
2375
|
-
};
|
|
2376
|
-
}
|
|
2377
|
-
type EventCallback = (event: SdkEvent) => void;
|
|
2378
|
-
|
|
2379
|
-
declare const ListInputFieldsSchema: z.ZodObject<{
|
|
2418
|
+
declare const RunActionSchema: z.ZodObject<{
|
|
2380
2419
|
appKey: z.ZodString;
|
|
2381
2420
|
actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
|
|
2382
2421
|
actionKey: z.ZodString;
|
|
@@ -2389,86 +2428,33 @@ declare const ListInputFieldsSchema: z.ZodObject<{
|
|
|
2389
2428
|
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
2390
2429
|
actionKey: string;
|
|
2391
2430
|
authenticationId?: number | null | undefined;
|
|
2392
|
-
maxItems?: number | undefined;
|
|
2393
|
-
pageSize?: number | undefined;
|
|
2394
2431
|
inputs?: Record<string, any> | undefined;
|
|
2432
|
+
pageSize?: number | undefined;
|
|
2433
|
+
maxItems?: number | undefined;
|
|
2395
2434
|
}, {
|
|
2396
2435
|
appKey: string;
|
|
2397
2436
|
actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
|
|
2398
2437
|
actionKey: string;
|
|
2399
2438
|
authenticationId?: number | null | undefined;
|
|
2400
|
-
maxItems?: number | undefined;
|
|
2401
|
-
pageSize?: number | undefined;
|
|
2402
2439
|
inputs?: Record<string, any> | undefined;
|
|
2440
|
+
pageSize?: number | undefined;
|
|
2441
|
+
maxItems?: number | undefined;
|
|
2403
2442
|
}>;
|
|
2404
|
-
type
|
|
2405
|
-
|
|
2406
|
-
declare const GetAuthenticationSchema: z.ZodObject<{
|
|
2407
|
-
authenticationId: z.ZodNumber;
|
|
2408
|
-
}, "strip", z.ZodTypeAny, {
|
|
2409
|
-
authenticationId: number;
|
|
2410
|
-
}, {
|
|
2411
|
-
authenticationId: number;
|
|
2412
|
-
}>;
|
|
2413
|
-
type GetAuthenticationOptions = z.infer<typeof GetAuthenticationSchema>;
|
|
2414
|
-
|
|
2415
|
-
declare const FindFirstAuthenticationSchema: z.ZodObject<{
|
|
2416
|
-
appKey: z.ZodOptional<z.ZodString>;
|
|
2417
|
-
search: z.ZodOptional<z.ZodString>;
|
|
2418
|
-
title: z.ZodOptional<z.ZodString>;
|
|
2419
|
-
account_id: z.ZodOptional<z.ZodString>;
|
|
2420
|
-
owner: z.ZodOptional<z.ZodString>;
|
|
2421
|
-
}, "strip", z.ZodTypeAny, {
|
|
2422
|
-
title?: string | undefined;
|
|
2423
|
-
search?: string | undefined;
|
|
2424
|
-
account_id?: string | undefined;
|
|
2425
|
-
appKey?: string | undefined;
|
|
2426
|
-
owner?: string | undefined;
|
|
2427
|
-
}, {
|
|
2428
|
-
title?: string | undefined;
|
|
2429
|
-
search?: string | undefined;
|
|
2430
|
-
account_id?: string | undefined;
|
|
2431
|
-
appKey?: string | undefined;
|
|
2432
|
-
owner?: string | undefined;
|
|
2433
|
-
}>;
|
|
2434
|
-
type FindFirstAuthenticationOptions = z.infer<typeof FindFirstAuthenticationSchema>;
|
|
2435
|
-
|
|
2436
|
-
declare const FindUniqueAuthenticationSchema: z.ZodObject<{
|
|
2437
|
-
appKey: z.ZodOptional<z.ZodString>;
|
|
2438
|
-
search: z.ZodOptional<z.ZodString>;
|
|
2439
|
-
title: z.ZodOptional<z.ZodString>;
|
|
2440
|
-
account_id: z.ZodOptional<z.ZodString>;
|
|
2441
|
-
owner: z.ZodOptional<z.ZodString>;
|
|
2442
|
-
}, "strip", z.ZodTypeAny, {
|
|
2443
|
-
title?: string | undefined;
|
|
2444
|
-
search?: string | undefined;
|
|
2445
|
-
account_id?: string | undefined;
|
|
2446
|
-
appKey?: string | undefined;
|
|
2447
|
-
owner?: string | undefined;
|
|
2448
|
-
}, {
|
|
2449
|
-
title?: string | undefined;
|
|
2450
|
-
search?: string | undefined;
|
|
2451
|
-
account_id?: string | undefined;
|
|
2452
|
-
appKey?: string | undefined;
|
|
2453
|
-
owner?: string | undefined;
|
|
2454
|
-
}>;
|
|
2455
|
-
type FindUniqueAuthenticationOptions = z.infer<typeof FindUniqueAuthenticationSchema>;
|
|
2456
|
-
|
|
2457
|
-
interface RegistryPluginProvides {
|
|
2458
|
-
__registry: FunctionRegistryEntry[];
|
|
2459
|
-
}
|
|
2460
|
-
|
|
2461
|
-
declare const GetProfileSchema: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
2462
|
-
type GetProfileOptions = z.infer<typeof GetProfileSchema> & FunctionOptions;
|
|
2443
|
+
type RunActionOptions = z.infer<typeof RunActionSchema>;
|
|
2463
2444
|
|
|
2464
|
-
interface
|
|
2465
|
-
|
|
2466
|
-
data:
|
|
2467
|
-
}
|
|
2445
|
+
interface RunActionPluginProvides {
|
|
2446
|
+
runAction: (options?: RunActionOptions) => Promise<{
|
|
2447
|
+
data: any[];
|
|
2448
|
+
}> & AsyncIterable<{
|
|
2449
|
+
data: any[];
|
|
2450
|
+
nextCursor?: string;
|
|
2451
|
+
}> & {
|
|
2452
|
+
items(): AsyncIterable<any>;
|
|
2453
|
+
};
|
|
2468
2454
|
context: {
|
|
2469
2455
|
meta: {
|
|
2470
|
-
|
|
2471
|
-
inputSchema: typeof
|
|
2456
|
+
runAction: {
|
|
2457
|
+
inputSchema: typeof RunActionSchema;
|
|
2472
2458
|
};
|
|
2473
2459
|
};
|
|
2474
2460
|
};
|
|
@@ -2486,17 +2472,17 @@ declare const ListAuthenticationsSchema: z.ZodObject<{
|
|
|
2486
2472
|
title?: string | undefined;
|
|
2487
2473
|
search?: string | undefined;
|
|
2488
2474
|
account_id?: string | undefined;
|
|
2489
|
-
maxItems?: number | undefined;
|
|
2490
|
-
pageSize?: number | undefined;
|
|
2491
2475
|
appKey?: string | undefined;
|
|
2476
|
+
pageSize?: number | undefined;
|
|
2477
|
+
maxItems?: number | undefined;
|
|
2492
2478
|
owner?: string | undefined;
|
|
2493
2479
|
}, {
|
|
2494
2480
|
title?: string | undefined;
|
|
2495
2481
|
search?: string | undefined;
|
|
2496
2482
|
account_id?: string | undefined;
|
|
2497
|
-
maxItems?: number | undefined;
|
|
2498
|
-
pageSize?: number | undefined;
|
|
2499
2483
|
appKey?: string | undefined;
|
|
2484
|
+
pageSize?: number | undefined;
|
|
2485
|
+
maxItems?: number | undefined;
|
|
2500
2486
|
owner?: string | undefined;
|
|
2501
2487
|
}>;
|
|
2502
2488
|
type ListAuthenticationsOptions = z.infer<typeof ListAuthenticationsSchema>;
|
|
@@ -2587,14 +2573,97 @@ interface BaseSdkOptions {
|
|
|
2587
2573
|
fetch?: typeof fetch;
|
|
2588
2574
|
baseUrl?: string;
|
|
2589
2575
|
debug?: boolean;
|
|
2576
|
+
manifestPath?: string;
|
|
2577
|
+
manifest?: {
|
|
2578
|
+
apps: {
|
|
2579
|
+
[appKey: string]: {
|
|
2580
|
+
implementationName: string;
|
|
2581
|
+
version?: string;
|
|
2582
|
+
};
|
|
2583
|
+
};
|
|
2584
|
+
};
|
|
2590
2585
|
}
|
|
2591
2586
|
|
|
2592
2587
|
interface FunctionRegistryEntry {
|
|
2593
2588
|
name: string;
|
|
2594
2589
|
inputSchema: z.ZodSchema;
|
|
2595
|
-
|
|
2590
|
+
categories: string[];
|
|
2591
|
+
}
|
|
2592
|
+
type ZapierSdk = GetSdkType<RegistryPluginProvides & FetchPluginProvides & AppsPluginProvides & ListAppsPluginProvides & ManifestPluginProvides & GetAppPluginProvides & ListActionsPluginProvides & GetActionPluginProvides & RunActionPluginProvides & LockVersionPluginProvides & ListAuthenticationsPluginProvides & GetAuthenticationPluginProvides & FindFirstAuthenticationPluginProvides & FindUniqueAuthenticationPluginProvides & ListInputFieldsPluginProvides & RequestPluginProvides & GetProfilePluginProvides>;
|
|
2593
|
+
|
|
2594
|
+
/**
|
|
2595
|
+
* ------------------------------
|
|
2596
|
+
* Plugin Type System with Explicit Context Dependencies
|
|
2597
|
+
* ------------------------------
|
|
2598
|
+
*
|
|
2599
|
+
* This system makes context dependencies explicit to restore TypeScript's
|
|
2600
|
+
* ability to catch missing context at compile time.
|
|
2601
|
+
*/
|
|
2602
|
+
|
|
2603
|
+
interface PluginDependencies<TSdk = {}, TContext = {}> {
|
|
2604
|
+
sdk: TSdk;
|
|
2605
|
+
context: TContext;
|
|
2596
2606
|
}
|
|
2597
|
-
|
|
2607
|
+
interface PluginProvides extends Record<string, any> {
|
|
2608
|
+
context?: Record<string, any>;
|
|
2609
|
+
}
|
|
2610
|
+
interface PluginMeta {
|
|
2611
|
+
categories: string[];
|
|
2612
|
+
inputSchema: z.ZodSchema;
|
|
2613
|
+
[key: string]: any;
|
|
2614
|
+
}
|
|
2615
|
+
type ExtractSdkProperties<T extends Record<string, any>> = Omit<T, "context">;
|
|
2616
|
+
type ExtractContextProperties<T extends PluginProvides> = T["context"];
|
|
2617
|
+
type GetSdkType<TPluginProvides extends PluginProvides> = ExtractSdkProperties<TPluginProvides> & {
|
|
2618
|
+
getContext(): NonNullable<ExtractContextProperties<TPluginProvides>>;
|
|
2619
|
+
};
|
|
2620
|
+
type PluginOptions<TSdk = {}, TContext = {}> = {
|
|
2621
|
+
sdk: TSdk;
|
|
2622
|
+
context: TContext & {
|
|
2623
|
+
meta: Record<string, any>;
|
|
2624
|
+
};
|
|
2625
|
+
};
|
|
2626
|
+
/**
|
|
2627
|
+
* Plugin interface — now has 3 type params:
|
|
2628
|
+
*
|
|
2629
|
+
* TRequiresContext = what this plugin *needs* in context
|
|
2630
|
+
* TProvides = what this plugin *returns* (sdk + context)
|
|
2631
|
+
* TSdk = current sdk shape when plugin runs
|
|
2632
|
+
*/
|
|
2633
|
+
interface Plugin<TSdk = {}, TRequiresContext = {}, TProvides extends PluginProvides = PluginProvides> {
|
|
2634
|
+
(params: {
|
|
2635
|
+
sdk: TSdk;
|
|
2636
|
+
context: TRequiresContext & {
|
|
2637
|
+
meta: Record<string, PluginMeta>;
|
|
2638
|
+
options: BaseSdkOptions;
|
|
2639
|
+
};
|
|
2640
|
+
}): TProvides;
|
|
2641
|
+
}
|
|
2642
|
+
type MissingContextKeys<TRequired, TCurrent> = TRequired extends Record<string, any> ? TCurrent extends Record<string, any> ? {
|
|
2643
|
+
[K in keyof TRequired]: K extends keyof TCurrent ? never : K;
|
|
2644
|
+
}[keyof TRequired] : keyof TRequired : never;
|
|
2645
|
+
type ContextError<TRequired, TCurrent> = MissingContextKeys<TRequired, TCurrent> extends never ? never : MissingContextKeys<TRequired, TCurrent> extends infer Missing ? Missing extends string ? `❌ Missing required context: { ${Missing}: any }` : Missing extends number ? `❌ Missing required context: { ${Missing}: any }` : `❌ Missing required context properties. Required: ${keyof TRequired extends string ? keyof TRequired : "unknown"}, Available: ${keyof TCurrent extends string ? keyof TCurrent : "unknown"}` : "❌ Context requirement not satisfied";
|
|
2646
|
+
/**
|
|
2647
|
+
* SDK interface — result of createSdk()
|
|
2648
|
+
*
|
|
2649
|
+
* addPlugin now enforces that TRequiresContext is assignable to TCurrentContext.
|
|
2650
|
+
* If not, TypeScript will emit a detailed error showing missing properties.
|
|
2651
|
+
*/
|
|
2652
|
+
type Sdk<TCurrentSdk = {}, TCurrentContext = {
|
|
2653
|
+
meta: Record<string, PluginMeta>;
|
|
2654
|
+
}> = TCurrentSdk & {
|
|
2655
|
+
addPlugin<TRequiresContext, TProvides extends PluginProvides>(plugin: Plugin<TCurrentSdk & {
|
|
2656
|
+
getContext(): TCurrentContext;
|
|
2657
|
+
}, TRequiresContext, TProvides>, options?: any): TCurrentContext extends TRequiresContext ? Sdk<TCurrentSdk & ExtractSdkProperties<TProvides>, TCurrentContext & NonNullable<ExtractContextProperties<TProvides>>> : ContextError<TRequiresContext, TCurrentContext>;
|
|
2658
|
+
getContext(): TCurrentContext;
|
|
2659
|
+
};
|
|
2660
|
+
|
|
2661
|
+
interface AppsPluginProvides {
|
|
2662
|
+
apps: ActionProxy;
|
|
2663
|
+
}
|
|
2664
|
+
declare const appsPlugin: Plugin<GetSdkType<FetchPluginProvides & RunActionPluginProvides>, // requires fetch + runAction in SDK
|
|
2665
|
+
{}, // no context requirements
|
|
2666
|
+
AppsPluginProvides>;
|
|
2598
2667
|
|
|
2599
2668
|
interface InputsResolver {
|
|
2600
2669
|
type: "fields";
|
|
@@ -2705,8 +2774,8 @@ declare function getTokenFromEnvOrConfig(options?: AuthOptions): Promise<string
|
|
|
2705
2774
|
interface ZapierSdkOptions extends BaseSdkOptions {
|
|
2706
2775
|
}
|
|
2707
2776
|
declare function createSdk<TCurrentSdk = {}, TCurrentContext = {
|
|
2708
|
-
meta: Record<string,
|
|
2709
|
-
}>(initialSdk?: TCurrentSdk, initialContext?: TCurrentContext): Sdk<TCurrentSdk, TCurrentContext>;
|
|
2777
|
+
meta: Record<string, PluginMeta>;
|
|
2778
|
+
}>(options?: ZapierSdkOptions, initialSdk?: TCurrentSdk, initialContext?: TCurrentContext): Sdk<TCurrentSdk, TCurrentContext>;
|
|
2710
2779
|
declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
|
|
2711
2780
|
|
|
2712
2781
|
export { type Action, type ActionExecutionResult, type ActionField, type ActionFieldChoice, type ActionItem, type ActionKeyProperty, ActionKeyPropertySchema, type ActionTypeProperty, ActionTypePropertySchema, type ApiError, type ApiEvent, type App, type AppItem, type AppKeyProperty, AppKeyPropertySchema, type AppsPluginProvides, type AuthEvent, type AuthOptions, type Authentication, type AuthenticationIdProperty, AuthenticationIdPropertySchema, type AuthenticationItem, type AuthenticationsResponse, type Choice, type DebugProperty, DebugPropertySchema, type ErrorOptions, type EventCallback, type FetchPluginProvides, type Field, type FunctionOptions, type FunctionRegistryEntry, type GetSdkType, type InputFieldItem, type InputsProperty, InputsPropertySchema, type LimitProperty, LimitPropertySchema, type LoadingEvent, type Need, type NeedsRequest, type NeedsResponse, type OffsetProperty, OffsetPropertySchema, type OutputProperty, OutputPropertySchema, type PaginatedSdkFunction, type ParamsProperty, ParamsPropertySchema, type Plugin, type PluginDependencies, type PluginOptions, type PluginProvides, RelayFetchSchema, RelayRequestSchema, type ResolverName, type ResolverType, type Sdk, type SdkEvent, type UserProfile, type UserProfileItem, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, type ZapierFetchInitOptions, ZapierNotFoundError, ZapierResourceNotFoundError, type ZapierSdk, type ZapierSdkOptions, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, appKeyResolver, appsPlugin, authenticationIdResolver, createSdk, createZapierSdk, fetchPlugin, formatErrorMessage, getResolutionOrder, getResolutionOrderForParams, getResolvableParams, getResolver, getResolversForMissingParams, getTokenFromCliLogin, getTokenFromEnv, getTokenFromEnvOrConfig, hasResolver, inputsResolver, isPositional, resolverRegistry };
|