@zapier/zapier-sdk 0.26.0 → 0.27.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.
Files changed (157) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/CLAUDE.md +6 -6
  3. package/README.md +217 -222
  4. package/dist/api/index.d.ts +1 -1
  5. package/dist/api/index.d.ts.map +1 -1
  6. package/dist/api/types.d.ts +3 -3
  7. package/dist/api/types.d.ts.map +1 -1
  8. package/dist/index.cjs +367 -216
  9. package/dist/index.d.mts +171 -91
  10. package/dist/index.d.ts +6 -5
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +4 -4
  13. package/dist/index.mjs +359 -211
  14. package/dist/plugins/apps/index.d.ts.map +1 -1
  15. package/dist/plugins/apps/index.js +20 -13
  16. package/dist/plugins/apps/schemas.d.ts +6 -2
  17. package/dist/plugins/apps/schemas.d.ts.map +1 -1
  18. package/dist/plugins/apps/schemas.js +7 -3
  19. package/dist/plugins/deprecated/authentications.d.ts +79 -0
  20. package/dist/plugins/deprecated/authentications.d.ts.map +1 -0
  21. package/dist/plugins/deprecated/authentications.js +90 -0
  22. package/dist/plugins/fetch/index.d.ts +4 -0
  23. package/dist/plugins/fetch/index.d.ts.map +1 -1
  24. package/dist/plugins/fetch/index.js +7 -4
  25. package/dist/plugins/fetch/schemas.d.ts +1 -0
  26. package/dist/plugins/fetch/schemas.d.ts.map +1 -1
  27. package/dist/plugins/fetch/schemas.js +3 -1
  28. package/dist/plugins/findFirstConnection/index.d.ts +21 -0
  29. package/dist/plugins/findFirstConnection/index.d.ts.map +1 -0
  30. package/dist/plugins/findFirstConnection/index.js +37 -0
  31. package/dist/plugins/findFirstConnection/index.test.d.ts.map +1 -0
  32. package/dist/plugins/{findFirstAuthentication → findFirstConnection}/index.test.js +43 -43
  33. package/dist/plugins/findFirstConnection/schemas.d.ts +22 -0
  34. package/dist/plugins/findFirstConnection/schemas.d.ts.map +1 -0
  35. package/dist/plugins/findFirstConnection/schemas.js +8 -0
  36. package/dist/plugins/findUniqueConnection/index.d.ts +21 -0
  37. package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -0
  38. package/dist/plugins/findUniqueConnection/index.js +40 -0
  39. package/dist/plugins/findUniqueConnection/index.test.d.ts.map +1 -0
  40. package/dist/plugins/{findUniqueAuthentication → findUniqueConnection}/index.test.js +41 -41
  41. package/dist/plugins/findUniqueConnection/schemas.d.ts +22 -0
  42. package/dist/plugins/findUniqueConnection/schemas.d.ts.map +1 -0
  43. package/dist/plugins/findUniqueConnection/schemas.js +8 -0
  44. package/dist/plugins/getApp/index.js +2 -2
  45. package/dist/plugins/getConnection/index.d.ts +22 -0
  46. package/dist/plugins/getConnection/index.d.ts.map +1 -0
  47. package/dist/plugins/getConnection/index.js +35 -0
  48. package/dist/plugins/getConnection/index.test.d.ts.map +1 -0
  49. package/dist/plugins/{getAuthentication → getConnection}/index.test.js +46 -28
  50. package/dist/plugins/getConnection/schemas.d.ts +13 -0
  51. package/dist/plugins/getConnection/schemas.d.ts.map +1 -0
  52. package/dist/plugins/getConnection/schemas.js +8 -0
  53. package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -1
  54. package/dist/plugins/getInputFieldsSchema/index.js +7 -4
  55. package/dist/plugins/getInputFieldsSchema/schemas.d.ts +1 -0
  56. package/dist/plugins/getInputFieldsSchema/schemas.d.ts.map +1 -1
  57. package/dist/plugins/getInputFieldsSchema/schemas.js +6 -2
  58. package/dist/plugins/listApps/schemas.js +2 -2
  59. package/dist/plugins/listClientCredentials/schemas.js +2 -2
  60. package/dist/plugins/listConnections/index.d.ts +24 -0
  61. package/dist/plugins/listConnections/index.d.ts.map +1 -0
  62. package/dist/plugins/{listAuthentications → listConnections}/index.js +28 -21
  63. package/dist/plugins/listConnections/index.test.d.ts.map +1 -0
  64. package/dist/plugins/{listAuthentications → listConnections}/index.test.js +219 -198
  65. package/dist/plugins/{listAuthentications → listConnections}/schemas.d.ts +11 -10
  66. package/dist/plugins/listConnections/schemas.d.ts.map +1 -0
  67. package/dist/plugins/listConnections/schemas.js +47 -0
  68. package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
  69. package/dist/plugins/listInputFieldChoices/index.js +8 -5
  70. package/dist/plugins/listInputFieldChoices/schemas.d.ts +1 -0
  71. package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +1 -1
  72. package/dist/plugins/listInputFieldChoices/schemas.js +3 -1
  73. package/dist/plugins/listInputFields/index.d.ts.map +1 -1
  74. package/dist/plugins/listInputFields/index.js +7 -4
  75. package/dist/plugins/listInputFields/schemas.d.ts +1 -0
  76. package/dist/plugins/listInputFields/schemas.d.ts.map +1 -1
  77. package/dist/plugins/listInputFields/schemas.js +3 -1
  78. package/dist/plugins/manifest/schemas.d.ts +2 -0
  79. package/dist/plugins/manifest/schemas.d.ts.map +1 -1
  80. package/dist/plugins/manifest/schemas.js +3 -1
  81. package/dist/plugins/registry/index.d.ts.map +1 -1
  82. package/dist/plugins/registry/index.js +3 -2
  83. package/dist/plugins/request/index.d.ts.map +1 -1
  84. package/dist/plugins/request/index.js +5 -2
  85. package/dist/plugins/request/schemas.d.ts +2 -0
  86. package/dist/plugins/request/schemas.d.ts.map +1 -1
  87. package/dist/plugins/request/schemas.js +3 -1
  88. package/dist/plugins/runAction/index.d.ts.map +1 -1
  89. package/dist/plugins/runAction/index.js +12 -8
  90. package/dist/plugins/runAction/schemas.d.ts +1 -0
  91. package/dist/plugins/runAction/schemas.d.ts.map +1 -1
  92. package/dist/plugins/runAction/schemas.js +4 -2
  93. package/dist/resolvers/connectionId.d.ts +9 -0
  94. package/dist/resolvers/connectionId.d.ts.map +1 -0
  95. package/dist/resolvers/connectionId.js +42 -0
  96. package/dist/resolvers/index.d.ts +5 -1
  97. package/dist/resolvers/index.d.ts.map +1 -1
  98. package/dist/resolvers/index.js +6 -1
  99. package/dist/resolvers/inputFieldKey.d.ts +1 -1
  100. package/dist/resolvers/inputFieldKey.d.ts.map +1 -1
  101. package/dist/resolvers/inputFieldKey.js +2 -2
  102. package/dist/resolvers/inputs.d.ts +1 -1
  103. package/dist/resolvers/inputs.d.ts.map +1 -1
  104. package/dist/resolvers/inputs.js +4 -4
  105. package/dist/schemas/Connection.d.ts +29 -0
  106. package/dist/schemas/Connection.d.ts.map +1 -0
  107. package/dist/schemas/{Auth.js → Connection.js} +5 -7
  108. package/dist/sdk.d.ts +29 -7
  109. package/dist/sdk.d.ts.map +1 -1
  110. package/dist/sdk.js +12 -5
  111. package/dist/sdk.test.js +9 -8
  112. package/dist/services/implementations.d.ts +6 -6
  113. package/dist/services/implementations.d.ts.map +1 -1
  114. package/dist/services/implementations.js +10 -10
  115. package/dist/types/domain.d.ts +4 -4
  116. package/dist/types/domain.d.ts.map +1 -1
  117. package/dist/types/properties.d.ts +5 -1
  118. package/dist/types/properties.d.ts.map +1 -1
  119. package/dist/types/properties.js +4 -2
  120. package/dist/types/sdk.d.ts +12 -9
  121. package/dist/types/sdk.d.ts.map +1 -1
  122. package/package.json +2 -2
  123. package/dist/plugins/findFirstAuthentication/index.d.ts +0 -21
  124. package/dist/plugins/findFirstAuthentication/index.d.ts.map +0 -1
  125. package/dist/plugins/findFirstAuthentication/index.js +0 -36
  126. package/dist/plugins/findFirstAuthentication/index.test.d.ts.map +0 -1
  127. package/dist/plugins/findFirstAuthentication/schemas.d.ts +0 -21
  128. package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +0 -1
  129. package/dist/plugins/findFirstAuthentication/schemas.js +0 -8
  130. package/dist/plugins/findUniqueAuthentication/index.d.ts +0 -21
  131. package/dist/plugins/findUniqueAuthentication/index.d.ts.map +0 -1
  132. package/dist/plugins/findUniqueAuthentication/index.js +0 -39
  133. package/dist/plugins/findUniqueAuthentication/index.test.d.ts.map +0 -1
  134. package/dist/plugins/findUniqueAuthentication/schemas.d.ts +0 -21
  135. package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +0 -1
  136. package/dist/plugins/findUniqueAuthentication/schemas.js +0 -8
  137. package/dist/plugins/getAuthentication/index.d.ts +0 -21
  138. package/dist/plugins/getAuthentication/index.d.ts.map +0 -1
  139. package/dist/plugins/getAuthentication/index.js +0 -29
  140. package/dist/plugins/getAuthentication/index.test.d.ts.map +0 -1
  141. package/dist/plugins/getAuthentication/schemas.d.ts +0 -7
  142. package/dist/plugins/getAuthentication/schemas.d.ts.map +0 -1
  143. package/dist/plugins/getAuthentication/schemas.js +0 -1
  144. package/dist/plugins/listAuthentications/index.d.ts +0 -24
  145. package/dist/plugins/listAuthentications/index.d.ts.map +0 -1
  146. package/dist/plugins/listAuthentications/index.test.d.ts.map +0 -1
  147. package/dist/plugins/listAuthentications/schemas.d.ts.map +0 -1
  148. package/dist/plugins/listAuthentications/schemas.js +0 -32
  149. package/dist/resolvers/authenticationId.d.ts +0 -9
  150. package/dist/resolvers/authenticationId.d.ts.map +0 -1
  151. package/dist/resolvers/authenticationId.js +0 -42
  152. package/dist/schemas/Auth.d.ts +0 -55
  153. package/dist/schemas/Auth.d.ts.map +0 -1
  154. /package/dist/plugins/{findFirstAuthentication → findFirstConnection}/index.test.d.ts +0 -0
  155. /package/dist/plugins/{findUniqueAuthentication → findUniqueConnection}/index.test.d.ts +0 -0
  156. /package/dist/plugins/{getAuthentication → getConnection}/index.test.d.ts +0 -0
  157. /package/dist/plugins/{listAuthentications → listConnections}/index.test.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EAEZ,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGlE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,CAAC;CACnB;AA2JD,eAAO,MAAM,UAAU,EAAE,MAAM,CAC7B,UAAU,CAAC,mBAAmB,GAAG,uBAAuB,CAAC,EAAE,oCAAoC;AAC/F,EAAE,EAAE,0BAA0B;AAC9B,kBAAkB,CAyBnB,CAAC;AAGF,YAAY,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACxD,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAI7D,MAAM,WAAW,aAAa;CAAG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EAEZ,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGlE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,CAAC;CACnB;AAsKD,eAAO,MAAM,UAAU,EAAE,MAAM,CAC7B,UAAU,CAAC,mBAAmB,GAAG,uBAAuB,CAAC,EAAE,oCAAoC;AAC/F,EAAE,EAAE,0BAA0B;AAC9B,kBAAkB,CA2BnB,CAAC;AAGF,YAAY,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACxD,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAI7D,MAAM,WAAW,aAAa;CAAG"}
@@ -4,11 +4,11 @@ import { ActionResultItemSchema } from "../../schemas/Run";
4
4
  function createActionFunction(appKey, actionType, actionKey, options, pinnedAuthId) {
5
5
  return (actionOptions = {}) => {
6
6
  const { sdk } = options;
7
- const { inputs, authenticationId: providedAuthenticationId, timeoutMs, } = actionOptions;
8
- // Use pinned auth ID first, then provided auth ID
9
- const authenticationId = pinnedAuthId ?? providedAuthenticationId;
10
- if (!authenticationId) {
11
- throw new ZapierValidationError(`Authentication ID is required. Either use the factory pattern: sdk.apps.${appKey}({ authenticationId }) or provide authenticationId in the action call.`);
7
+ const { inputs, connectionId: providedConnectionId, authenticationId: providedAuthenticationId, timeoutMs, } = actionOptions;
8
+ // Use pinned auth ID first, then provided connectionId, then deprecated authenticationId
9
+ const resolvedConnectionId = pinnedAuthId ?? providedConnectionId ?? providedAuthenticationId;
10
+ if (!resolvedConnectionId) {
11
+ throw new ZapierValidationError(`Connection ID is required. Either use the factory pattern: sdk.apps.${appKey}({ connectionId }) or provide connectionId in the action call.`);
12
12
  }
13
13
  // Call sdk.runAction with the resolved parameters
14
14
  return sdk.runAction({
@@ -16,7 +16,7 @@ function createActionFunction(appKey, actionType, actionKey, options, pinnedAuth
16
16
  actionType: actionType,
17
17
  actionKey,
18
18
  inputs,
19
- authenticationId,
19
+ connectionId: resolvedConnectionId,
20
20
  timeoutMs,
21
21
  });
22
22
  };
@@ -26,15 +26,15 @@ function createActionTypeProxy(appKey, actionType, options, pinnedAuthId) {
26
26
  if (actionType === "fetch") {
27
27
  return async (url, init) => {
28
28
  const { sdk } = options;
29
- // Use pinned auth ID first, then provided auth ID
30
- const authenticationId = pinnedAuthId ?? init?.authenticationId;
31
- if (!authenticationId) {
32
- throw new ZapierValidationError(`Authentication ID is required for fetch. Either use the factory pattern: sdk.apps.${appKey}({ authenticationId }).fetch(...) or provide authenticationId in the fetch call.`);
29
+ // Use pinned auth ID first, then provided connectionId, then deprecated authenticationId
30
+ const resolvedConnectionId = pinnedAuthId ?? init?.connectionId ?? init?.authenticationId;
31
+ if (!resolvedConnectionId) {
32
+ throw new ZapierValidationError(`Connection ID is required for fetch. Either use the factory pattern: sdk.apps.${appKey}({ connectionId }).fetch(...) or provide connectionId in the fetch call.`);
33
33
  }
34
- // Call sdk.fetch with the resolved authenticationId
34
+ // Call sdk.fetch with the resolved connectionId
35
35
  return sdk.fetch(url, {
36
36
  ...init,
37
- authenticationId,
37
+ connectionId: resolvedConnectionId,
38
38
  });
39
39
  };
40
40
  }
@@ -60,7 +60,12 @@ function createPinnedAppProxy(appKey, options, pinnedAuthId) {
60
60
  function createAppProxy(appKey, options) {
61
61
  // Create the factory function that returns a pinned version
62
62
  const appFactory = (factoryOptions) => {
63
- return createPinnedAppProxy(appKey, options, factoryOptions.authenticationId);
63
+ // Support both connectionId (new) and authenticationId (deprecated)
64
+ const resolvedConnectionId = factoryOptions.connectionId ?? factoryOptions.authenticationId;
65
+ if (!resolvedConnectionId) {
66
+ throw new ZapierValidationError(`Connection ID is required. Use sdk.apps.${appKey}({ connectionId: "..." })`);
67
+ }
68
+ return createPinnedAppProxy(appKey, options, resolvedConnectionId);
64
69
  };
65
70
  // Add properties for direct usage (backward compatibility)
66
71
  return new Proxy(appFactory, {
@@ -98,6 +103,7 @@ export const appsPlugin = ({ sdk }) => {
98
103
  type: "function",
99
104
  inputSchema: AppFactoryInputSchema,
100
105
  returnType: "AppProxy",
106
+ deprecatedParameters: ["authenticationId"],
101
107
  },
102
108
  "apps.{appKey}.{actionType}.{actionKey}": {
103
109
  categories: ["app"],
@@ -106,6 +112,7 @@ export const appsPlugin = ({ sdk }) => {
106
112
  inputSchema: ActionExecutionInputSchema,
107
113
  itemType: "ActionResult",
108
114
  outputSchema: ActionResultItemSchema,
115
+ deprecatedParameters: ["authenticationId"],
109
116
  },
110
117
  },
111
118
  },
@@ -1,13 +1,15 @@
1
1
  import { z } from "zod";
2
- import { type AuthenticationIdProperty } from "../../types/properties";
2
+ import { type ConnectionIdProperty, type AuthenticationIdProperty } from "../../types/properties";
3
3
  export declare const ActionExecutionInputSchema: z.ZodObject<{
4
4
  inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5
+ connectionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
5
6
  authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
6
7
  timeoutMs: z.ZodOptional<z.ZodNumber>;
7
8
  }, z.core.$strip>;
8
9
  export type ActionExecutionOptions = z.infer<typeof ActionExecutionInputSchema>;
9
10
  export declare const AppFactoryInputSchema: z.ZodObject<{
10
- authenticationId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
11
+ connectionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
12
+ authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
11
13
  }, z.core.$strip>;
12
14
  export type AppFactoryInput = z.infer<typeof AppFactoryInputSchema>;
13
15
  interface BaseActionTypeProxy {
@@ -23,6 +25,8 @@ interface BaseActionTypeProxy {
23
25
  }
24
26
  interface FetchActionType {
25
27
  fetch: (url: string | URL, init?: RequestInit & {
28
+ connectionId?: ConnectionIdProperty;
29
+ /** @deprecated Use connectionId instead */
26
30
  authenticationId?: AuthenticationIdProperty;
27
31
  callbackUrl?: string;
28
32
  }) => Promise<Response>;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,0BAA0B;;;;iBAQpC,CAAC;AAGJ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEhF,eAAO,MAAM,qBAAqB;;iBAIgB,CAAC;AAEnD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,UAAU,mBAAmB;IAC3B,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC;QAC9D,IAAI,EAAE,GAAG,EAAE,CAAC;QACZ,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACpD,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC;KAC7B,CAAC;CACL;AAGD,UAAU,eAAe;IACvB,KAAK,EAAE,CACL,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,CAAC,EAAE,WAAW,GAAG;QACnB,gBAAgB,CAAC,EAAE,wBAAwB,CAAC;QAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,KACE,OAAO,CAAC,QAAQ,CAAC,CAAC;CACxB;AAGD,KAAK,eAAe,GAAG,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAEtE,UAAU,QAAQ;IAChB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC;CACjC;AAED,UAAU,UAAU;IAClB,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAAC;CACtC;AAGD,KAAK,mBAAmB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEjD,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAAC;CACpC"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC9B,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,0BAA0B;;;;;iBAUpC,CAAC;AAGJ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEhF,eAAO,MAAM,qBAAqB;;;iBAMW,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAGpE,UAAU,mBAAmB;IAC3B,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC;QAC9D,IAAI,EAAE,GAAG,EAAE,CAAC;QACZ,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACpD,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC;KAC7B,CAAC;CACL;AAGD,UAAU,eAAe;IACvB,KAAK,EAAE,CACL,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,CAAC,EAAE,WAAW,GAAG;QACnB,YAAY,CAAC,EAAE,oBAAoB,CAAC;QACpC,2CAA2C;QAC3C,gBAAgB,CAAC,EAAE,wBAAwB,CAAC;QAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,KACE,OAAO,CAAC,QAAQ,CAAC,CAAC;CACxB;AAGD,KAAK,eAAe,GAAG,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAEtE,UAAU,QAAQ;IAChB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC;CACjC;AAED,UAAU,UAAU;IAClB,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAAC;CACtC;AAGD,KAAK,mBAAmB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEjD,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAAC;CACpC"}
@@ -1,15 +1,19 @@
1
1
  import { z } from "zod";
2
- import { AuthenticationIdPropertySchema, ActionTimeoutMsPropertySchema, } from "../../types/properties";
2
+ import { ConnectionIdPropertySchema, AuthenticationIdPropertySchema, ActionTimeoutMsPropertySchema, } from "../../types/properties";
3
3
  export const ActionExecutionInputSchema = z
4
4
  .object({
5
5
  inputs: z.record(z.string(), z.unknown()).optional(),
6
+ connectionId: ConnectionIdPropertySchema.optional(),
7
+ /** @deprecated Use connectionId instead */
6
8
  authenticationId: AuthenticationIdPropertySchema.optional(),
7
9
  timeoutMs: ActionTimeoutMsPropertySchema,
8
10
  })
9
11
  .describe("Execute an action with the given inputs for the bound app, as an alternative to runAction");
10
12
  export const AppFactoryInputSchema = z
11
13
  .object({
12
- authenticationId: AuthenticationIdPropertySchema,
14
+ connectionId: ConnectionIdPropertySchema.optional(),
15
+ /** @deprecated Use connectionId instead */
16
+ authenticationId: AuthenticationIdPropertySchema.optional(),
13
17
  })
14
- .describe("Bind an authentication ID to an app");
18
+ .describe("Bind a connection ID to an app");
15
19
  // Note: AppsPluginSdkExtension removed - now using AppsPluginProvides in index.ts
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Deprecated Authentication Plugins
3
+ *
4
+ * These plugins provide backward compatibility for the old authentication naming.
5
+ * They are simple aliases that delegate to the connection plugins.
6
+ * The connection plugins already accept both connectionId and authenticationId parameters.
7
+ *
8
+ * @deprecated Use the connection equivalents instead:
9
+ * - listAuthentications -> listConnections
10
+ * - getAuthentication -> getConnection
11
+ * - findFirstAuthentication -> findFirstConnection
12
+ * - findUniqueAuthentication -> findUniqueConnection
13
+ */
14
+ import type { Plugin, GetSdkType } from "../../types/plugin";
15
+ import type { ListConnectionsPluginProvides } from "../listConnections";
16
+ import type { GetConnectionPluginProvides } from "../getConnection";
17
+ import type { FindFirstConnectionPluginProvides } from "../findFirstConnection";
18
+ import type { FindUniqueConnectionPluginProvides } from "../findUniqueConnection";
19
+ import { ListConnectionsQuerySchema } from "../listConnections/schemas";
20
+ import { GetConnectionParamSchema } from "../getConnection/schemas";
21
+ import { FindFirstConnectionSchema } from "../findFirstConnection/schemas";
22
+ import { FindUniqueConnectionSchema } from "../findUniqueConnection/schemas";
23
+ export interface ListAuthenticationsPluginProvides {
24
+ listAuthentications: GetSdkType<ListConnectionsPluginProvides>["listConnections"];
25
+ context: {
26
+ meta: {
27
+ listAuthentications: {
28
+ inputSchema: typeof ListConnectionsQuerySchema;
29
+ };
30
+ };
31
+ };
32
+ }
33
+ export interface GetAuthenticationPluginProvides {
34
+ getAuthentication: GetSdkType<GetConnectionPluginProvides>["getConnection"];
35
+ context: {
36
+ meta: {
37
+ getAuthentication: {
38
+ inputSchema: typeof GetConnectionParamSchema;
39
+ };
40
+ };
41
+ };
42
+ }
43
+ export interface FindFirstAuthenticationPluginProvides {
44
+ findFirstAuthentication: GetSdkType<FindFirstConnectionPluginProvides>["findFirstConnection"];
45
+ context: {
46
+ meta: {
47
+ findFirstAuthentication: {
48
+ inputSchema: typeof FindFirstConnectionSchema;
49
+ };
50
+ };
51
+ };
52
+ }
53
+ export interface FindUniqueAuthenticationPluginProvides {
54
+ findUniqueAuthentication: GetSdkType<FindUniqueConnectionPluginProvides>["findUniqueConnection"];
55
+ context: {
56
+ meta: {
57
+ findUniqueAuthentication: {
58
+ inputSchema: typeof FindUniqueConnectionSchema;
59
+ };
60
+ };
61
+ };
62
+ }
63
+ /**
64
+ * @deprecated Use listConnections instead
65
+ */
66
+ export declare const listAuthenticationsPlugin: Plugin<GetSdkType<ListConnectionsPluginProvides>, {}, ListAuthenticationsPluginProvides>;
67
+ /**
68
+ * @deprecated Use getConnection instead
69
+ */
70
+ export declare const getAuthenticationPlugin: Plugin<GetSdkType<GetConnectionPluginProvides>, {}, GetAuthenticationPluginProvides>;
71
+ /**
72
+ * @deprecated Use findFirstConnection instead
73
+ */
74
+ export declare const findFirstAuthenticationPlugin: Plugin<GetSdkType<FindFirstConnectionPluginProvides>, {}, FindFirstAuthenticationPluginProvides>;
75
+ /**
76
+ * @deprecated Use findUniqueConnection instead
77
+ */
78
+ export declare const findUniqueAuthenticationPlugin: Plugin<GetSdkType<FindUniqueConnectionPluginProvides>, {}, FindUniqueAuthenticationPluginProvides>;
79
+ //# sourceMappingURL=authentications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentications.d.ts","sourceRoot":"","sources":["../../../src/plugins/deprecated/authentications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAI7E,MAAM,WAAW,iCAAiC;IAChD,mBAAmB,EAAE,UAAU,CAAC,6BAA6B,CAAC,CAAC,iBAAiB,CAAC,CAAC;IAClF,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,mBAAmB,EAAE;gBACnB,WAAW,EAAE,OAAO,0BAA0B,CAAC;aAChD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,+BAA+B;IAC9C,iBAAiB,EAAE,UAAU,CAAC,2BAA2B,CAAC,CAAC,eAAe,CAAC,CAAC;IAC5E,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,iBAAiB,EAAE;gBACjB,WAAW,EAAE,OAAO,wBAAwB,CAAC;aAC9C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,qCAAqC;IACpD,uBAAuB,EAAE,UAAU,CAAC,iCAAiC,CAAC,CAAC,qBAAqB,CAAC,CAAC;IAC9F,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,uBAAuB,EAAE;gBACvB,WAAW,EAAE,OAAO,yBAAyB,CAAC;aAC/C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,MAAM,WAAW,sCAAsC;IACrD,wBAAwB,EAAE,UAAU,CAAC,kCAAkC,CAAC,CAAC,sBAAsB,CAAC,CAAC;IACjG,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,wBAAwB,EAAE;gBACxB,WAAW,EAAE,OAAO,0BAA0B,CAAC;aAChD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAC5C,UAAU,CAAC,6BAA6B,CAAC,EACzC,EAAE,EACF,iCAAiC,CAejC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAC1C,UAAU,CAAC,2BAA2B,CAAC,EACvC,EAAE,EACF,+BAA+B,CAe/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,MAAM,CAChD,UAAU,CAAC,iCAAiC,CAAC,EAC7C,EAAE,EACF,qCAAqC,CAerC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,8BAA8B,EAAE,MAAM,CACjD,UAAU,CAAC,kCAAkC,CAAC,EAC9C,EAAE,EACF,sCAAsC,CAetC,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Deprecated Authentication Plugins
3
+ *
4
+ * These plugins provide backward compatibility for the old authentication naming.
5
+ * They are simple aliases that delegate to the connection plugins.
6
+ * The connection plugins already accept both connectionId and authenticationId parameters.
7
+ *
8
+ * @deprecated Use the connection equivalents instead:
9
+ * - listAuthentications -> listConnections
10
+ * - getAuthentication -> getConnection
11
+ * - findFirstAuthentication -> findFirstConnection
12
+ * - findUniqueAuthentication -> findUniqueConnection
13
+ */
14
+ import { ListConnectionsQuerySchema } from "../listConnections/schemas";
15
+ import { GetConnectionParamSchema } from "../getConnection/schemas";
16
+ import { FindFirstConnectionSchema } from "../findFirstConnection/schemas";
17
+ import { FindUniqueConnectionSchema } from "../findUniqueConnection/schemas";
18
+ import { ConnectionItemSchema } from "../../schemas/Connection";
19
+ /**
20
+ * @deprecated Use listConnections instead
21
+ */
22
+ export const listAuthenticationsPlugin = ({ sdk }) => ({
23
+ listAuthentications: sdk.listConnections,
24
+ context: {
25
+ meta: {
26
+ listAuthentications: {
27
+ packages: ["cli", "mcp"],
28
+ categories: ["connection", "deprecated"],
29
+ type: "list",
30
+ itemType: "Connection",
31
+ inputSchema: ListConnectionsQuerySchema,
32
+ outputSchema: ConnectionItemSchema,
33
+ },
34
+ },
35
+ },
36
+ });
37
+ /**
38
+ * @deprecated Use getConnection instead
39
+ */
40
+ export const getAuthenticationPlugin = ({ sdk }) => ({
41
+ getAuthentication: sdk.getConnection,
42
+ context: {
43
+ meta: {
44
+ getAuthentication: {
45
+ packages: ["cli", "mcp"],
46
+ categories: ["connection", "deprecated"],
47
+ type: "item",
48
+ itemType: "Connection",
49
+ inputSchema: GetConnectionParamSchema,
50
+ outputSchema: ConnectionItemSchema,
51
+ },
52
+ },
53
+ },
54
+ });
55
+ /**
56
+ * @deprecated Use findFirstConnection instead
57
+ */
58
+ export const findFirstAuthenticationPlugin = ({ sdk }) => ({
59
+ findFirstAuthentication: sdk.findFirstConnection,
60
+ context: {
61
+ meta: {
62
+ findFirstAuthentication: {
63
+ packages: ["cli", "mcp"],
64
+ categories: ["connection", "deprecated"],
65
+ type: "item",
66
+ itemType: "Connection",
67
+ inputSchema: FindFirstConnectionSchema,
68
+ outputSchema: ConnectionItemSchema,
69
+ },
70
+ },
71
+ },
72
+ });
73
+ /**
74
+ * @deprecated Use findUniqueConnection instead
75
+ */
76
+ export const findUniqueAuthenticationPlugin = ({ sdk }) => ({
77
+ findUniqueAuthentication: sdk.findUniqueConnection,
78
+ context: {
79
+ meta: {
80
+ findUniqueAuthentication: {
81
+ packages: ["cli", "mcp"],
82
+ categories: ["connection", "deprecated"],
83
+ type: "item",
84
+ itemType: "Connection",
85
+ inputSchema: FindUniqueConnectionSchema,
86
+ outputSchema: ConnectionItemSchema,
87
+ },
88
+ },
89
+ },
90
+ });
@@ -4,6 +4,8 @@ import type { z } from "zod";
4
4
  import type { EventEmissionContext } from "../eventEmission";
5
5
  export interface FetchPluginProvides {
6
6
  fetch: (url: string | URL, init?: RequestInit & {
7
+ connectionId?: string | number;
8
+ /** @deprecated Use connectionId instead */
7
9
  authenticationId?: string | number;
8
10
  callbackUrl?: string;
9
11
  _telemetry?: {
@@ -36,6 +38,8 @@ export declare const fetchPlugin: Plugin<{}, // no SDK dependencies
36
38
  } & EventEmissionContext, // requires api + eventEmission in context
37
39
  FetchPluginProvides>;
38
40
  export type ZapierFetchInitOptions = RequestInit & {
41
+ connectionId?: string | number;
42
+ /** @deprecated Use connectionId instead */
39
43
  authenticationId?: string | number;
40
44
  callbackUrl?: string;
41
45
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AA6D7D,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,CACL,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,CAAC,EAAE,WAAW,GAAG;QACnB,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACnC,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC;KACrC,KACE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvB,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,KAAK,EAAE;gBACL,WAAW,EAAE,MAAM,CAAC;gBACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;gBACnB,UAAU,EAAE,MAAM,EAAE,CAAC;gBACrB,UAAU,EAAE,MAAM,CAAC;gBACnB,eAAe,EAAE,KAAK,CAAC;oBAAE,IAAI,EAAE,MAAM,CAAC;oBAAC,MAAM,EAAE,CAAC,CAAC,SAAS,CAAA;iBAAE,CAAC,CAAC;aAC/D,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAC9B,EAAE,EAAE,sBAAsB;AAC1B,AADI,sBAAsB;AAC1B;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,EAAE,0CAA0C;AACrF,mBAAmB,CAyGpB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,WAAW,GAAG;IACjD,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AA6D7D,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,CACL,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,CAAC,EAAE,WAAW,GAAG;QACnB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAC/B,2CAA2C;QAC3C,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACnC,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC;KACrC,KACE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvB,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,KAAK,EAAE;gBACL,WAAW,EAAE,MAAM,CAAC;gBACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;gBACnB,UAAU,EAAE,MAAM,EAAE,CAAC;gBACrB,UAAU,EAAE,MAAM,CAAC;gBACnB,eAAe,EAAE,KAAK,CAAC;oBAAE,IAAI,EAAE,MAAM,CAAC;oBAAC,MAAM,EAAE,CAAC,CAAC,SAAS,CAAA;iBAAE,CAAC,CAAC;aAC/D,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAC9B,EAAE,EAAE,sBAAsB;AAC1B,AADI,sBAAsB;AAC1B;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,EAAE,0CAA0C;AACrF,mBAAmB,CAoHpB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,WAAW,GAAG;IACjD,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,2CAA2C;IAC3C,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
@@ -59,7 +59,9 @@ export const fetchPlugin = ({ context }) => {
59
59
  const startTime = Date.now();
60
60
  const isNested = init?._telemetry?.isNested === true;
61
61
  try {
62
- const { authenticationId, callbackUrl, _telemetry, ...fetchInit } = init || {};
62
+ const { connectionId, authenticationId, callbackUrl, _telemetry, ...fetchInit } = init || {};
63
+ // Support both connectionId (new) and authenticationId (deprecated)
64
+ const resolvedConnectionId = connectionId ?? authenticationId;
63
65
  const relayPath = transformUrlToRelayPath(url);
64
66
  const headers = normalizeHeaders(fetchInit.headers);
65
67
  const hasContentType = Object.keys(headers).some((k) => k.toLowerCase() === "content-type");
@@ -69,8 +71,8 @@ export const fetchPlugin = ({ context }) => {
69
71
  headers["Content-Type"] = inferred;
70
72
  }
71
73
  }
72
- if (authenticationId) {
73
- headers["X-Relay-Authentication-Id"] = coerceToNumericId("authenticationId", authenticationId).toString();
74
+ if (resolvedConnectionId) {
75
+ headers["X-Relay-Authentication-Id"] = coerceToNumericId("connectionId", resolvedConnectionId).toString();
74
76
  }
75
77
  if (callbackUrl) {
76
78
  headers["X-Relay-Callback-Url"] = callbackUrl;
@@ -113,7 +115,7 @@ export const fetchPlugin = ({ context }) => {
113
115
  meta: {
114
116
  fetch: {
115
117
  description: "Make authenticated HTTP requests to any API through Zapier's Relay service. " +
116
- "Pass an authenticationId to automatically inject the user's stored credentials " +
118
+ "Pass a connectionId to automatically inject the user's stored credentials " +
117
119
  "(OAuth tokens, API keys, etc.) into the outgoing request. " +
118
120
  "Mirrors the native fetch(url, init?) signature with additional Zapier-specific options.",
119
121
  packages: ["sdk", "cli", "mcp"],
@@ -123,6 +125,7 @@ export const fetchPlugin = ({ context }) => {
123
125
  { name: "url", schema: FetchUrlSchema },
124
126
  { name: "init", schema: FetchInitSchema },
125
127
  ],
128
+ deprecatedParameters: ["authenticationId"],
126
129
  },
127
130
  },
128
131
  },
@@ -12,6 +12,7 @@ export declare const FetchInitSchema: z.ZodOptional<z.ZodObject<{
12
12
  }>>;
13
13
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
14
14
  body: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<FormData, FormData>, z.ZodCustom<URLSearchParams, URLSearchParams>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
15
+ connectionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
15
16
  authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
16
17
  callbackUrl: z.ZodOptional<z.ZodString>;
17
18
  }, z.core.$strip>>;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,cAAc,2DAIxB,CAAC;AAEJ,eAAO,MAAM,eAAe;;;;;;;;;;;;;;kBA8BzB,CAAC"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/fetch/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,cAAc,2DAIxB,CAAC;AAEJ,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;kBAgCzB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { AuthenticationIdPropertySchema } from "../../types/properties";
2
+ import { ConnectionIdPropertySchema, AuthenticationIdPropertySchema, } from "../../types/properties";
3
3
  // Schemas for fetch function parameters
4
4
  export const FetchUrlSchema = z
5
5
  .union([z.string(), z.instanceof(URL)])
@@ -23,6 +23,8 @@ export const FetchInitSchema = z
23
23
  ])
24
24
  .optional()
25
25
  .describe("Request body — plain objects and JSON strings are auto-detected and Content-Type is set accordingly"),
26
+ connectionId: ConnectionIdPropertySchema.optional(),
27
+ /** @deprecated Use connectionId instead */
26
28
  authenticationId: AuthenticationIdPropertySchema.optional(),
27
29
  callbackUrl: z
28
30
  .string()
@@ -0,0 +1,21 @@
1
+ import type { Plugin, GetSdkType } from "../../types/plugin";
2
+ import type { ConnectionItem } from "../../types/domain";
3
+ import { FindFirstConnectionSchema, type FindFirstConnectionOptions } from "./schemas";
4
+ import type { ListConnectionsPluginProvides } from "../listConnections";
5
+ import type { EventEmissionContext } from "../eventEmission";
6
+ export interface FindFirstConnectionPluginProvides {
7
+ findFirstConnection: (options?: FindFirstConnectionOptions) => Promise<{
8
+ data: ConnectionItem;
9
+ }>;
10
+ context: {
11
+ meta: {
12
+ findFirstConnection: {
13
+ inputSchema: typeof FindFirstConnectionSchema;
14
+ };
15
+ };
16
+ };
17
+ }
18
+ export declare const findFirstConnectionPlugin: Plugin<GetSdkType<ListConnectionsPluginProvides>, // requires listConnections in SDK
19
+ EventEmissionContext, // requires eventEmission in context
20
+ FindFirstConnectionPluginProvides>;
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/findFirstConnection/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACL,yBAAyB,EACzB,KAAK,0BAA0B,EAChC,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAGxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,MAAM,WAAW,iCAAiC;IAChD,mBAAmB,EAAE,CACnB,OAAO,CAAC,EAAE,0BAA0B,KACjC,OAAO,CAAC;QAAE,IAAI,EAAE,cAAc,CAAA;KAAE,CAAC,CAAC;IACvC,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,mBAAmB,EAAE;gBACnB,WAAW,EAAE,OAAO,yBAAyB,CAAC;aAC/C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAC5C,UAAU,CAAC,6BAA6B,CAAC,EAAE,kCAAkC;AAC7E,oBAAoB,EAAE,oCAAoC;AAC1D,iCAAiC,CA8ClC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { FindFirstConnectionSchema, } from "./schemas";
2
+ import { createFunction } from "../../utils/function-utils";
3
+ import { ConnectionItemSchema } from "../../schemas/Connection";
4
+ import { ZapierResourceNotFoundError } from "../../types/errors";
5
+ import { createTelemetryCallback } from "../../utils/telemetry-utils";
6
+ export const findFirstConnectionPlugin = ({ sdk, context }) => {
7
+ async function findFirstConnection(options = {}) {
8
+ // Use listConnections with maxItems 1 to get the first result
9
+ const connectionsResponse = await sdk.listConnections({
10
+ ...options,
11
+ maxItems: 1,
12
+ _telemetry: { isNested: true },
13
+ });
14
+ if (connectionsResponse.data.length === 0) {
15
+ throw new ZapierResourceNotFoundError("No connection found matching the specified criteria", { resourceType: "Connection" });
16
+ }
17
+ return {
18
+ data: connectionsResponse.data[0],
19
+ };
20
+ }
21
+ const findFirstConnectionDefinition = createFunction(findFirstConnection, FindFirstConnectionSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, findFirstConnection.name));
22
+ return {
23
+ findFirstConnection: findFirstConnectionDefinition,
24
+ context: {
25
+ meta: {
26
+ findFirstConnection: {
27
+ categories: ["connection"],
28
+ type: "item",
29
+ itemType: "Connection",
30
+ inputSchema: FindFirstConnectionSchema,
31
+ outputSchema: ConnectionItemSchema,
32
+ deprecatedParameters: ["authenticationIds"],
33
+ },
34
+ },
35
+ },
36
+ };
37
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/findFirstConnection/index.test.ts"],"names":[],"mappings":""}