@zapier/zapier-sdk 0.41.2 → 0.42.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.
Files changed (139) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -0
  3. package/dist/index.cjs +376 -219
  4. package/dist/index.d.mts +174 -424
  5. package/dist/index.d.ts +3 -3
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1 -1
  8. package/dist/index.mjs +376 -220
  9. package/dist/plugins/api/index.d.ts +5 -1
  10. package/dist/plugins/api/index.d.ts.map +1 -1
  11. package/dist/plugins/api/index.js +2 -3
  12. package/dist/plugins/apps/index.d.ts +2 -3
  13. package/dist/plugins/apps/index.d.ts.map +1 -1
  14. package/dist/plugins/apps/index.js +1 -1
  15. package/dist/plugins/capabilities/index.d.ts +8 -6
  16. package/dist/plugins/capabilities/index.d.ts.map +1 -1
  17. package/dist/plugins/capabilities/index.js +3 -3
  18. package/dist/plugins/connections/index.d.ts +3 -1
  19. package/dist/plugins/connections/index.d.ts.map +1 -1
  20. package/dist/plugins/connections/index.js +2 -3
  21. package/dist/plugins/createClientCredentials/index.d.ts +6 -4
  22. package/dist/plugins/createClientCredentials/index.d.ts.map +1 -1
  23. package/dist/plugins/createClientCredentials/index.js +3 -3
  24. package/dist/plugins/deleteClientCredentials/index.d.ts +6 -4
  25. package/dist/plugins/deleteClientCredentials/index.d.ts.map +1 -1
  26. package/dist/plugins/deleteClientCredentials/index.js +3 -3
  27. package/dist/plugins/deprecated/authentications.d.ts +9 -9
  28. package/dist/plugins/deprecated/authentications.d.ts.map +1 -1
  29. package/dist/plugins/deprecated/authentications.js +4 -4
  30. package/dist/plugins/eventEmission/index.d.ts +4 -5
  31. package/dist/plugins/eventEmission/index.d.ts.map +1 -1
  32. package/dist/plugins/eventEmission/index.js +8 -7
  33. package/dist/plugins/fetch/index.d.ts +18 -23
  34. package/dist/plugins/fetch/index.d.ts.map +1 -1
  35. package/dist/plugins/fetch/index.js +88 -28
  36. package/dist/plugins/fetch/schemas.d.ts +8 -0
  37. package/dist/plugins/fetch/schemas.d.ts.map +1 -1
  38. package/dist/plugins/fetch/schemas.js +21 -12
  39. package/dist/plugins/findFirstConnection/index.d.ts +3 -4
  40. package/dist/plugins/findFirstConnection/index.d.ts.map +1 -1
  41. package/dist/plugins/findFirstConnection/index.js +2 -2
  42. package/dist/plugins/findUniqueConnection/index.d.ts +3 -4
  43. package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -1
  44. package/dist/plugins/findUniqueConnection/index.js +2 -2
  45. package/dist/plugins/getAction/index.d.ts +7 -7
  46. package/dist/plugins/getAction/index.d.ts.map +1 -1
  47. package/dist/plugins/getAction/index.js +2 -2
  48. package/dist/plugins/getApp/index.d.ts +2 -3
  49. package/dist/plugins/getApp/index.d.ts.map +1 -1
  50. package/dist/plugins/getApp/index.js +2 -2
  51. package/dist/plugins/getConnection/index.d.ts +6 -6
  52. package/dist/plugins/getConnection/index.d.ts.map +1 -1
  53. package/dist/plugins/getConnection/index.js +3 -3
  54. package/dist/plugins/getInputFieldsSchema/index.d.ts +8 -6
  55. package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -1
  56. package/dist/plugins/getInputFieldsSchema/index.js +4 -4
  57. package/dist/plugins/getProfile/index.d.ts +6 -6
  58. package/dist/plugins/getProfile/index.d.ts.map +1 -1
  59. package/dist/plugins/getProfile/index.js +3 -3
  60. package/dist/plugins/listActions/index.d.ts +8 -6
  61. package/dist/plugins/listActions/index.d.ts.map +1 -1
  62. package/dist/plugins/listActions/index.js +3 -3
  63. package/dist/plugins/listApps/index.d.ts +3 -3
  64. package/dist/plugins/listApps/index.d.ts.map +1 -1
  65. package/dist/plugins/listApps/index.js +3 -3
  66. package/dist/plugins/listClientCredentials/index.d.ts +6 -4
  67. package/dist/plugins/listClientCredentials/index.d.ts.map +1 -1
  68. package/dist/plugins/listClientCredentials/index.js +3 -3
  69. package/dist/plugins/listConnections/index.d.ts +8 -6
  70. package/dist/plugins/listConnections/index.d.ts.map +1 -1
  71. package/dist/plugins/listConnections/index.js +5 -5
  72. package/dist/plugins/listInputFieldChoices/index.d.ts +9 -8
  73. package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
  74. package/dist/plugins/listInputFieldChoices/index.js +4 -4
  75. package/dist/plugins/listInputFields/index.d.ts +8 -8
  76. package/dist/plugins/listInputFields/index.d.ts.map +1 -1
  77. package/dist/plugins/listInputFields/index.js +4 -4
  78. package/dist/plugins/manifest/index.d.ts +8 -3
  79. package/dist/plugins/manifest/index.d.ts.map +1 -1
  80. package/dist/plugins/manifest/index.js +2 -3
  81. package/dist/plugins/registry/index.d.ts +1 -2
  82. package/dist/plugins/registry/index.d.ts.map +1 -1
  83. package/dist/plugins/registry/index.js +3 -3
  84. package/dist/plugins/request/index.d.ts +3 -4
  85. package/dist/plugins/request/index.d.ts.map +1 -1
  86. package/dist/plugins/request/index.js +2 -2
  87. package/dist/plugins/runAction/index.d.ts +8 -8
  88. package/dist/plugins/runAction/index.d.ts.map +1 -1
  89. package/dist/plugins/runAction/index.js +5 -5
  90. package/dist/plugins/tables/createTable/index.d.ts +3 -5
  91. package/dist/plugins/tables/createTable/index.d.ts.map +1 -1
  92. package/dist/plugins/tables/createTable/index.js +3 -3
  93. package/dist/plugins/tables/createTableFields/index.d.ts +3 -5
  94. package/dist/plugins/tables/createTableFields/index.d.ts.map +1 -1
  95. package/dist/plugins/tables/createTableFields/index.js +3 -3
  96. package/dist/plugins/tables/createTableRecords/index.d.ts +3 -5
  97. package/dist/plugins/tables/createTableRecords/index.d.ts.map +1 -1
  98. package/dist/plugins/tables/createTableRecords/index.js +3 -3
  99. package/dist/plugins/tables/deleteTable/index.d.ts +5 -5
  100. package/dist/plugins/tables/deleteTable/index.d.ts.map +1 -1
  101. package/dist/plugins/tables/deleteTable/index.js +4 -4
  102. package/dist/plugins/tables/deleteTableFields/index.d.ts +3 -5
  103. package/dist/plugins/tables/deleteTableFields/index.d.ts.map +1 -1
  104. package/dist/plugins/tables/deleteTableFields/index.js +3 -3
  105. package/dist/plugins/tables/deleteTableRecords/index.d.ts +3 -5
  106. package/dist/plugins/tables/deleteTableRecords/index.d.ts.map +1 -1
  107. package/dist/plugins/tables/deleteTableRecords/index.js +3 -3
  108. package/dist/plugins/tables/getTable/index.d.ts +3 -5
  109. package/dist/plugins/tables/getTable/index.d.ts.map +1 -1
  110. package/dist/plugins/tables/getTable/index.js +3 -3
  111. package/dist/plugins/tables/getTableRecord/index.d.ts +3 -5
  112. package/dist/plugins/tables/getTableRecord/index.d.ts.map +1 -1
  113. package/dist/plugins/tables/getTableRecord/index.js +3 -3
  114. package/dist/plugins/tables/listTableFields/index.d.ts +3 -5
  115. package/dist/plugins/tables/listTableFields/index.d.ts.map +1 -1
  116. package/dist/plugins/tables/listTableFields/index.js +3 -3
  117. package/dist/plugins/tables/listTableRecords/index.d.ts +3 -3
  118. package/dist/plugins/tables/listTableRecords/index.d.ts.map +1 -1
  119. package/dist/plugins/tables/listTableRecords/index.js +3 -3
  120. package/dist/plugins/tables/listTables/index.d.ts +5 -3
  121. package/dist/plugins/tables/listTables/index.d.ts.map +1 -1
  122. package/dist/plugins/tables/listTables/index.js +4 -4
  123. package/dist/plugins/tables/updateTableRecords/index.d.ts +3 -5
  124. package/dist/plugins/tables/updateTableRecords/index.d.ts.map +1 -1
  125. package/dist/plugins/tables/updateTableRecords/index.js +3 -3
  126. package/dist/resolvers/connectionId.js +1 -1
  127. package/dist/resolvers/tableId.js +1 -1
  128. package/dist/sdk.d.ts +29 -257
  129. package/dist/sdk.d.ts.map +1 -1
  130. package/dist/sdk.js +33 -43
  131. package/dist/types/plugin.d.ts +29 -48
  132. package/dist/types/plugin.d.ts.map +1 -1
  133. package/dist/types/plugin.js +7 -3
  134. package/dist/types/sdk.d.ts +2 -3
  135. package/dist/types/sdk.d.ts.map +1 -1
  136. package/dist/utils/abort-utils.d.ts +64 -0
  137. package/dist/utils/abort-utils.d.ts.map +1 -0
  138. package/dist/utils/abort-utils.js +107 -0
  139. package/package.json +1 -1
@@ -1,11 +1,14 @@
1
- import { ZapierRelayError } from "../../types/errors";
2
- import { FetchUrlSchema, FetchInitSchema } from "./schemas";
1
+ import { ZapierRelayError, ZapierTimeoutError } from "../../types/errors";
2
+ import { FetchUrlSchema, FetchInitSchema, FetchInitZapierFieldsSchema, } from "./schemas";
3
+ import { z } from "zod";
3
4
  import { resolveConnectionId } from "../../utils/domain-utils";
5
+ import { combineAbortSignals, createTimeoutAbortSignal, } from "../../utils/abort-utils";
4
6
  import { isPlainObject } from "../../utils/type-guard-utils";
5
7
  // fetch() doesn't use createFunction/createPaginatedFunction (its signature
6
8
  // doesn't fit the single-options-object pattern), so we wire up telemetry
7
9
  // context tracking manually.
8
10
  import { isTelemetryNested, runWithTelemetryContext, } from "../../utils/telemetry-context";
11
+ import { createValidator } from "../../utils/validation";
9
12
  /**
10
13
  * Transforms full URLs into Relay format: /relay/{domain}/{path}
11
14
  */
@@ -53,24 +56,62 @@ function inferContentType(body) {
53
56
  }
54
57
  return undefined;
55
58
  }
59
+ /**
60
+ * If the request aborted because the client-side `maxTime` timer fired, rewrap the
61
+ * underlying error as a `ZapierTimeoutError` so callers (and telemetry) can
62
+ * distinguish it from a caller-triggered abort or an unrelated network
63
+ * cancellation. The original error is preserved as `cause`.
64
+ *
65
+ * Caller-triggered aborts are left unwrapped so the caller's own abort
66
+ * semantics (reason, name) propagate.
67
+ */
68
+ function rewrapIfMaxTimeTimeout({ error, abortSignal, maxTimeSeconds, }) {
69
+ if (maxTimeSeconds === undefined || !abortSignal?.aborted)
70
+ return error;
71
+ const reason = abortSignal.reason;
72
+ if (!reason || reason.name !== "TimeoutError")
73
+ return error;
74
+ return new ZapierTimeoutError(`fetch timed out after ${maxTimeSeconds}s (maxTime)`, { cause: error });
75
+ }
76
+ /**
77
+ * Builds an AbortSignal (and a dispose callback) from the optional maxTime
78
+ * timeout and an optional caller-provided signal. Callers must invoke
79
+ * `dispose()` when the request completes to release timers and listeners.
80
+ */
81
+ function buildAbortHandle({ maxTimeSeconds, callerSignal, }) {
82
+ const handles = [];
83
+ if (callerSignal)
84
+ handles.push({ signal: callerSignal, dispose: () => { } });
85
+ if (maxTimeSeconds !== undefined) {
86
+ handles.push(createTimeoutAbortSignal({ timeoutMs: maxTimeSeconds * 1000 }));
87
+ }
88
+ return combineAbortSignals({ handles });
89
+ }
90
+ const FetchInitSdkValidationSchema = z
91
+ .looseObject(FetchInitZapierFieldsSchema.shape)
92
+ .optional();
93
+ const validateFetchInit = createValidator(FetchInitSdkValidationSchema);
56
94
  /**
57
95
  * Fetch plugin — the primary way to make authenticated HTTP requests through Zapier's Relay service.
58
96
  * Mirrors the native fetch(url, init?) signature with additional Zapier-specific options.
59
97
  */
60
- export const fetchPlugin = ({ context }) => {
98
+ export const fetchPlugin = (sdk) => {
61
99
  return {
62
100
  fetch: async function fetch(url, init) {
63
101
  return runWithTelemetryContext(async () => {
64
- const { api } = context;
102
+ const { api } = sdk.context;
65
103
  const startTime = Date.now();
66
104
  const isNested = isTelemetryNested();
67
105
  try {
68
- const { connectionId, connection, authenticationId, callbackUrl, ...fetchInit } = init || {};
106
+ if (init) {
107
+ validateFetchInit(init);
108
+ }
109
+ const { connectionId, connection, authenticationId, callbackUrl, maxTime, ...fetchInit } = init || {};
69
110
  const resolvedConnectionId = await resolveConnectionId({
70
111
  connectionId,
71
112
  connection,
72
113
  authenticationId,
73
- resolveConnection: context.resolveConnection,
114
+ resolveConnection: sdk.context.resolveConnection,
74
115
  label: "fetch",
75
116
  });
76
117
  const relayPath = transformUrlToRelayPath(url);
@@ -88,36 +129,55 @@ export const fetchPlugin = ({ context }) => {
88
129
  if (callbackUrl) {
89
130
  headers["X-Relay-Callback-Url"] = callbackUrl;
90
131
  }
91
- const result = await api.fetch(relayPath, {
92
- method: fetchInit.method ?? "GET",
93
- body: fetchInit.body,
94
- headers,
95
- redirect: fetchInit.redirect,
96
- signal: fetchInit.signal,
97
- authRequired: true,
132
+ if (maxTime !== undefined) {
133
+ headers["X-Zapier-Sdk-Max-Time"] = String(maxTime);
134
+ }
135
+ const abortHandle = buildAbortHandle({
136
+ maxTimeSeconds: maxTime,
137
+ callerSignal: fetchInit.signal,
98
138
  });
99
- const relayError = result.headers.get("x-relay-error");
100
- if (relayError) {
101
- throw new ZapierRelayError(relayError, {
102
- statusCode: result.status,
139
+ try {
140
+ const result = await api.fetch(relayPath, {
141
+ method: fetchInit.method ?? "GET",
142
+ body: fetchInit.body,
143
+ headers,
144
+ redirect: fetchInit.redirect,
145
+ signal: abortHandle?.signal,
146
+ authRequired: true,
103
147
  });
148
+ const relayError = result.headers.get("x-relay-error");
149
+ if (relayError) {
150
+ throw new ZapierRelayError(relayError, {
151
+ statusCode: result.status,
152
+ });
153
+ }
154
+ if (!isNested) {
155
+ sdk.context.eventEmission.emitMethodCalled({
156
+ method_name: "fetch",
157
+ execution_duration_ms: Date.now() - startTime,
158
+ success_flag: true,
159
+ error_message: null,
160
+ error_type: null,
161
+ argument_count: init ? 2 : 1,
162
+ is_paginated: false,
163
+ });
164
+ }
165
+ return result;
104
166
  }
105
- if (!isNested) {
106
- context.eventEmission.emitMethodCalled({
107
- method_name: "fetch",
108
- execution_duration_ms: Date.now() - startTime,
109
- success_flag: true,
110
- error_message: null,
111
- error_type: null,
112
- argument_count: init ? 2 : 1,
113
- is_paginated: false,
167
+ catch (error) {
168
+ throw rewrapIfMaxTimeTimeout({
169
+ error,
170
+ abortSignal: abortHandle?.signal,
171
+ maxTimeSeconds: maxTime,
114
172
  });
115
173
  }
116
- return result;
174
+ finally {
175
+ abortHandle?.dispose();
176
+ }
117
177
  }
118
178
  catch (error) {
119
179
  if (!isNested) {
120
- context.eventEmission.emitMethodCalled({
180
+ sdk.context.eventEmission.emitMethodCalled({
121
181
  method_name: "fetch",
122
182
  execution_duration_ms: Date.now() - startTime,
123
183
  success_flag: false,
@@ -1,5 +1,12 @@
1
1
  import { z } from "zod";
2
2
  export declare const FetchUrlSchema: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<URL, URL>]>;
3
+ export declare const FetchInitZapierFieldsSchema: z.ZodObject<{
4
+ connectionId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
5
+ connection: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
6
+ authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
7
+ callbackUrl: z.ZodOptional<z.ZodString>;
8
+ maxTime: z.ZodOptional<z.ZodNumber>;
9
+ }, z.core.$strip>;
3
10
  export declare const FetchInitSchema: z.ZodOptional<z.ZodObject<{
4
11
  method: z.ZodOptional<z.ZodEnum<{
5
12
  POST: "POST";
@@ -16,5 +23,6 @@ export declare const FetchInitSchema: z.ZodOptional<z.ZodObject<{
16
23
  connection: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
17
24
  authenticationId: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
18
25
  callbackUrl: z.ZodOptional<z.ZodString>;
26
+ maxTime: z.ZodOptional<z.ZodNumber>;
19
27
  }, z.core.$strip>>;
20
28
  //# sourceMappingURL=schemas.d.ts.map
@@ -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;AAQxB,eAAO,MAAM,cAAc,2DAIxB,CAAC;AAEJ,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;kBAwCxB,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,2BAA2B;;;;;;iBAqBtC,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;kBA6BxB,CAAC"}
@@ -4,6 +4,26 @@ import { ConnectionIdPropertySchema, ConnectionPropertySchema, AuthenticationIdP
4
4
  export const FetchUrlSchema = z
5
5
  .union([z.string(), z.instanceof(URL)])
6
6
  .describe("The full URL of the API endpoint to call (proxied through Zapier's Relay service)");
7
+ export const FetchInitZapierFieldsSchema = z.object({
8
+ connectionId: ConnectionIdPropertySchema.optional().meta({
9
+ deprecated: true,
10
+ }),
11
+ connection: ConnectionPropertySchema.optional(),
12
+ /** @deprecated Use connection instead */
13
+ authenticationId: AuthenticationIdPropertySchema.optional().meta({
14
+ deprecated: true,
15
+ }),
16
+ callbackUrl: z
17
+ .string()
18
+ .optional()
19
+ .describe("URL to send async response to (makes request async)"),
20
+ maxTime: z
21
+ .number()
22
+ .int()
23
+ .positive()
24
+ .optional()
25
+ .describe("Maximum seconds to wait for a response. Honored on a best-effort basis; the server may silently enforce a lower ceiling."),
26
+ });
7
27
  export const FetchInitSchema = z
8
28
  .object({
9
29
  method: z
@@ -23,19 +43,8 @@ export const FetchInitSchema = z
23
43
  ])
24
44
  .optional()
25
45
  .describe("Request body — plain objects and JSON strings are auto-detected and Content-Type is set accordingly"),
26
- connectionId: ConnectionIdPropertySchema.optional().meta({
27
- deprecated: true,
28
- }),
29
- connection: ConnectionPropertySchema.optional(),
30
- /** @deprecated Use connection instead */
31
- authenticationId: AuthenticationIdPropertySchema.optional().meta({
32
- deprecated: true,
33
- }),
34
- callbackUrl: z
35
- .string()
36
- .optional()
37
- .describe("URL to send async response to (makes request async)"),
38
46
  })
47
+ .extend(FetchInitZapierFieldsSchema.shape)
39
48
  .optional()
40
49
  .describe("Request options including method, headers, body, and authentication")
41
50
  .meta({
@@ -1,8 +1,8 @@
1
- import type { Plugin, GetSdkType } from "../../types/plugin";
1
+ import type { Plugin } from "../../types/plugin";
2
2
  import type { ConnectionItem } from "../../types/domain";
3
3
  import { FindFirstConnectionSchema, type FindFirstConnectionOptions } from "./schemas";
4
4
  import type { ListConnectionsPluginProvides } from "../listConnections";
5
- import type { EventEmissionContext } from "../eventEmission";
5
+ import type { EventEmissionProvides } from "../eventEmission";
6
6
  export interface FindFirstConnectionPluginProvides {
7
7
  findFirstConnection: (options?: FindFirstConnectionOptions) => Promise<{
8
8
  data: ConnectionItem;
@@ -15,7 +15,6 @@ export interface FindFirstConnectionPluginProvides {
15
15
  };
16
16
  };
17
17
  }
18
- export declare const findFirstConnectionPlugin: Plugin<GetSdkType<ListConnectionsPluginProvides>, // requires listConnections in SDK
19
- EventEmissionContext, // requires eventEmission in context
18
+ export declare const findFirstConnectionPlugin: Plugin<ListConnectionsPluginProvides & EventEmissionProvides, // requires listConnections in SDK, eventEmission in context
20
19
  FindFirstConnectionPluginProvides>;
21
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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,CA4ClC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/findFirstConnection/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,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,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAG9D,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,6BAA6B,GAAG,qBAAqB,EAAE,4DAA4D;AACnH,iCAAiC,CA4ClC,CAAC"}
@@ -3,7 +3,7 @@ import { createFunction } from "../../utils/function-utils";
3
3
  import { ConnectionItemSchema } from "../../schemas/Connection";
4
4
  import { ZapierResourceNotFoundError } from "../../types/errors";
5
5
  import { createTelemetryCallback } from "../../utils/telemetry-utils";
6
- export const findFirstConnectionPlugin = ({ sdk, context }) => {
6
+ export const findFirstConnectionPlugin = (sdk) => {
7
7
  async function findFirstConnection(options = {}) {
8
8
  // Use listConnections with maxItems 1 to get the first result
9
9
  const connectionsResponse = await sdk.listConnections({
@@ -17,7 +17,7 @@ export const findFirstConnectionPlugin = ({ sdk, context }) => {
17
17
  data: connectionsResponse.data[0],
18
18
  };
19
19
  }
20
- const findFirstConnectionDefinition = createFunction(findFirstConnection, FindFirstConnectionSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, findFirstConnection.name));
20
+ const findFirstConnectionDefinition = createFunction(findFirstConnection, FindFirstConnectionSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, findFirstConnection.name));
21
21
  return {
22
22
  findFirstConnection: findFirstConnectionDefinition,
23
23
  context: {
@@ -1,8 +1,8 @@
1
- import type { Plugin, GetSdkType } from "../../types/plugin";
1
+ import type { Plugin } from "../../types/plugin";
2
2
  import type { ConnectionItem } from "../../types/domain";
3
3
  import { FindUniqueConnectionSchema, type FindUniqueConnectionOptions } from "./schemas";
4
4
  import type { ListConnectionsPluginProvides } from "../listConnections";
5
- import type { EventEmissionContext } from "../eventEmission";
5
+ import type { EventEmissionProvides } from "../eventEmission";
6
6
  export interface FindUniqueConnectionPluginProvides {
7
7
  findUniqueConnection: (options?: FindUniqueConnectionOptions) => Promise<{
8
8
  data: ConnectionItem;
@@ -15,7 +15,6 @@ export interface FindUniqueConnectionPluginProvides {
15
15
  };
16
16
  };
17
17
  }
18
- export declare const findUniqueConnectionPlugin: Plugin<GetSdkType<ListConnectionsPluginProvides>, // requires listConnections in SDK
19
- EventEmissionContext, // requires eventEmission in context
18
+ export declare const findUniqueConnectionPlugin: Plugin<ListConnectionsPluginProvides & EventEmissionProvides, // requires listConnections in SDK, eventEmission in context
20
19
  FindUniqueConnectionPluginProvides>;
21
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/findUniqueConnection/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MA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WAAW,EAAE,OAAO,0BAA0B,CAAC;aAChD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAC7C,6BAA6B,GAAG,qBAAqB,EAAE,4DAA4D;AACnH,kCAAkC,CAoDnC,CAAC"}
@@ -3,7 +3,7 @@ import { ZapierResourceNotFoundError, ZapierValidationError, } from "../../types
3
3
  import { createFunction } from "../../utils/function-utils";
4
4
  import { ConnectionItemSchema } from "../../schemas/Connection";
5
5
  import { createTelemetryCallback } from "../../utils/telemetry-utils";
6
- export const findUniqueConnectionPlugin = ({ sdk, context }) => {
6
+ export const findUniqueConnectionPlugin = (sdk) => {
7
7
  async function findUniqueConnection(options = {}) {
8
8
  // Use listConnections with maxItems 2 to check for uniqueness
9
9
  const connectionsResponse = await sdk.listConnections({
@@ -20,7 +20,7 @@ export const findUniqueConnectionPlugin = ({ sdk, context }) => {
20
20
  data: connectionsResponse.data[0],
21
21
  };
22
22
  }
23
- const findUniqueConnectionDefinition = createFunction(findUniqueConnection, FindUniqueConnectionSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, findUniqueConnection.name));
23
+ const findUniqueConnectionDefinition = createFunction(findUniqueConnection, FindUniqueConnectionSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, findUniqueConnection.name));
24
24
  return {
25
25
  findUniqueConnection: findUniqueConnectionDefinition,
26
26
  context: {
@@ -1,9 +1,9 @@
1
- import type { Plugin, GetSdkType } from "../../types/plugin";
1
+ import type { Plugin } from "../../types/plugin";
2
2
  import type { ApiClient } from "../../api";
3
3
  import type { ActionItem } from "../../types/domain";
4
4
  import { GetActionSchema, type GetActionOptions } from "./schemas";
5
5
  import type { ListActionsPluginProvides } from "../listActions";
6
- import type { EventEmissionContext } from "../eventEmission";
6
+ import type { EventEmissionProvides } from "../eventEmission";
7
7
  export interface GetActionPluginProvides {
8
8
  getAction: (options: GetActionOptions) => Promise<{
9
9
  data: ActionItem;
@@ -16,10 +16,10 @@ export interface GetActionPluginProvides {
16
16
  };
17
17
  };
18
18
  }
19
- export declare const getActionPlugin: Plugin<GetSdkType<ListActionsPluginProvides>, // requires listActions in SDK
20
- // requires listActions in SDK
21
- {
22
- api: ApiClient;
23
- } & EventEmissionContext, // requires api in context
19
+ export declare const getActionPlugin: Plugin<ListActionsPluginProvides & {
20
+ context: {
21
+ api: ApiClient;
22
+ };
23
+ } & EventEmissionProvides, // requires listActions in SDK, api and eventEmission in context
24
24
  GetActionPluginProvides>;
25
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,eAAe,EAEf,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAOhE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAI7D,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;IACxE,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,WAAW,EAAE,OAAO,eAAe,CAAC;aACrC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,UAAU,CAAC,yBAAyB,CAAC,EAAE,8BAA8B;AACrE,AADuC,8BAA8B;AACrE;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,EAAE,0BAA0B;AACrE,uBAAuB,CA2DxB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,eAAe,EAEf,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAOhE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAI9D,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;IACxE,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,WAAW,EAAE,OAAO,eAAe,CAAC;aACrC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,yBAAyB,GAAG;IAC1B,OAAO,EAAE;QAAE,GAAG,EAAE,SAAS,CAAA;KAAE,CAAC;CAC7B,GAAG,qBAAqB,EAAE,gEAAgE;AAC3F,uBAAuB,CA2DxB,CAAC"}
@@ -5,7 +5,7 @@ import { appKeyResolver, actionTypeResolver, actionKeyResolver, } from "../../re
5
5
  import { ActionItemSchema } from "../../schemas/Action";
6
6
  import { createTelemetryCallback } from "../../utils/telemetry-utils";
7
7
  import { setMethodMetadata } from "../../utils/telemetry-context";
8
- export const getActionPlugin = ({ sdk, context }) => {
8
+ export const getActionPlugin = (sdk) => {
9
9
  async function getAction(options) {
10
10
  const appKey = "app" in options ? options.app : options.appKey;
11
11
  const actionKey = "action" in options ? options.action : options.actionKey;
@@ -26,7 +26,7 @@ export const getActionPlugin = ({ sdk, context }) => {
26
26
  // If we get here, action was not found
27
27
  throw new ZapierResourceNotFoundError(`Action not found: ${actionKey} with type ${actionType}`, { resourceType: "Action", resourceId: `${actionKey} (${actionType})` });
28
28
  }
29
- const getActionDefinition = createFunction(getAction, GetActionInputSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, getAction.name));
29
+ const getActionDefinition = createFunction(getAction, GetActionInputSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, getAction.name));
30
30
  return {
31
31
  getAction: getActionDefinition,
32
32
  context: {
@@ -2,9 +2,8 @@ import type { Plugin } from "../../types/plugin";
2
2
  import { GetAppSchema } from "./schemas";
3
3
  import type { GetAppOptions } from "./schemas";
4
4
  import type { AppItem } from "../../types/domain";
5
- import type { GetSdkType } from "../../types/plugin";
6
5
  import type { ListAppsPluginProvides } from "../listApps";
7
- import type { EventEmissionContext } from "../eventEmission";
6
+ import type { EventEmissionProvides } from "../eventEmission";
8
7
  export interface GetAppPluginProvides {
9
8
  getApp: (options: GetAppOptions) => Promise<{
10
9
  data: AppItem;
@@ -17,5 +16,5 @@ export interface GetAppPluginProvides {
17
16
  };
18
17
  };
19
18
  }
20
- export declare const getAppPlugin: Plugin<GetSdkType<ListAppsPluginProvides>, EventEmissionContext, GetAppPluginProvides>;
19
+ export declare const getAppPlugin: Plugin<ListAppsPluginProvides & EventEmissionProvides, GetAppPluginProvides>;
21
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getApp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAqB,MAAM,WAAW,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,M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CAAC;KACH,CAAC;CACH;AAGD,eAAO,MAAM,YAAY,EAAE,MAAM,CAC/B,sBAAsB,GAAG,qBAAqB,EAC9C,oBAAoB,CA+CrB,CAAC"}
@@ -5,7 +5,7 @@ import { ZapierAppNotFoundError } from "../../types/errors";
5
5
  import { appKeyResolver } from "../../resolvers";
6
6
  import { createTelemetryCallback } from "../../utils/telemetry-utils";
7
7
  // GetApp plugin depends on listApps SDK function
8
- export const getAppPlugin = ({ sdk, context }) => {
8
+ export const getAppPlugin = (sdk) => {
9
9
  async function getApp(options) {
10
10
  const appKey = "app" in options ? options.app : options.appKey;
11
11
  const appsIterable = sdk
@@ -22,7 +22,7 @@ export const getAppPlugin = ({ sdk, context }) => {
22
22
  appKey,
23
23
  });
24
24
  }
25
- const getAppDefinition = createFunction(getApp, GetAppInputSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, getApp.name));
25
+ const getAppDefinition = createFunction(getApp, GetAppInputSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, getApp.name));
26
26
  // Return flat structure - getApp goes directly to SDK
27
27
  return {
28
28
  getApp: getAppDefinition,
@@ -1,6 +1,6 @@
1
1
  import type { Plugin } from "../../types/plugin";
2
2
  import type { ApiClient } from "../../api";
3
- import type { EventEmissionContext } from "../eventEmission";
3
+ import type { EventEmissionProvides } from "../eventEmission";
4
4
  import type { GetConnectionResponse } from "@zapier/zapier-sdk-core/v0/schemas/connections";
5
5
  import { GetConnectionParamSchema, type GetConnectionParam } from "./schemas";
6
6
  export interface GetConnectionPluginProvides {
@@ -13,10 +13,10 @@ export interface GetConnectionPluginProvides {
13
13
  };
14
14
  };
15
15
  }
16
- export declare const getConnectionPlugin: Plugin<{}, // no SDK dependencies
17
- // no SDK dependencies
18
- {
19
- api: ApiClient;
20
- } & EventEmissionContext, // requires api in context
16
+ export declare const getConnectionPlugin: Plugin<{
17
+ context: {
18
+ api: ApiClient;
19
+ };
20
+ } & EventEmissionProvides, // no SDK dependencies, requires api and eventEmission in context
21
21
  GetConnectionPluginProvides>;
22
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getConnection/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAK3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAC5F,OAAO,EAAE,wBAAwB,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE9E,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,CACb,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACpC,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,aAAa,EAAE;gBACb,WAAW,EAAE,OAAO,wBAAwB,CAAC;aAC9C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,mBAAmB,EAAE,MAAM,CACtC,EAAE,EAAE,sBAAsB;AAC1B,AADI,sBAAsB;AAC1B;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,EAAE,0BAA0B;AACrE,2BAA2B,CAgD5B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getConnection/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAK3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AAC5F,OAAO,EAAE,wBAAwB,EAAE,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE9E,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,CACb,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACpC,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,aAAa,EAAE;gBACb,WAAW,EAAE,OAAO,wBAAwB,CAAC;aAC9C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,mBAAmB,EAAE,MAAM,CACtC;IAAE,OAAO,EAAE;QAAE,GAAG,EAAE,SAAS,CAAA;KAAE,CAAA;CAAE,GAAG,qBAAqB,EAAE,iEAAiE;AAC1H,2BAA2B,CAgD5B,CAAC"}
@@ -4,9 +4,9 @@ import { transformConnectionItem } from "../../utils/domain-utils";
4
4
  import { ConnectionItemSchema } from "../../schemas/Connection";
5
5
  import { createTelemetryCallback } from "../../utils/telemetry-utils";
6
6
  import { GetConnectionParamSchema } from "./schemas";
7
- export const getConnectionPlugin = ({ context }) => {
7
+ export const getConnectionPlugin = (sdk) => {
8
8
  async function getConnection(options) {
9
- const { api } = context;
9
+ const { api } = sdk.context;
10
10
  const resolvedConnectionId = options.connection ?? options.connectionId ?? options.authenticationId;
11
11
  if (!resolvedConnectionId) {
12
12
  throw new Error("connection is required");
@@ -17,7 +17,7 @@ export const getConnectionPlugin = ({ context }) => {
17
17
  data: transformConnectionItem(response.data),
18
18
  };
19
19
  }
20
- const getConnectionDefinition = createFunction(getConnection, GetConnectionParamSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, getConnection.name));
20
+ const getConnectionDefinition = createFunction(getConnection, GetConnectionParamSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, getConnection.name));
21
21
  return {
22
22
  getConnection: getConnectionDefinition,
23
23
  context: {
@@ -1,9 +1,9 @@
1
- import type { Plugin, GetSdkType } from "../../types/plugin";
1
+ import type { Plugin } from "../../types/plugin";
2
2
  import type { ApiClient } from "../../api";
3
3
  import { GetInputFieldsSchemaSchema, type GetInputFieldsSchemaOptions as GetInputFieldsSchemaOptions } from "./schemas";
4
4
  import type { GetActionPluginProvides } from "../getAction";
5
5
  import type { GetVersionedImplementationId } from "../manifest/schemas";
6
- import type { EventEmissionContext } from "../eventEmission";
6
+ import type { EventEmissionProvides } from "../eventEmission";
7
7
  import type { ConnectionsPluginProvides } from "../connections";
8
8
  export interface GetInputFieldsSchemaPluginProvides {
9
9
  getInputFieldsSchema: (options: GetInputFieldsSchemaOptions) => Promise<{
@@ -17,8 +17,10 @@ export interface GetInputFieldsSchemaPluginProvides {
17
17
  };
18
18
  };
19
19
  }
20
- export declare const getInputFieldsSchemaPlugin: Plugin<GetSdkType<GetActionPluginProvides>, {
21
- api: ApiClient;
22
- getVersionedImplementationId: GetVersionedImplementationId;
23
- } & EventEmissionContext & ConnectionsPluginProvides["context"], GetInputFieldsSchemaPluginProvides>;
20
+ export declare const getInputFieldsSchemaPlugin: Plugin<GetActionPluginProvides & {
21
+ context: {
22
+ api: ApiClient;
23
+ getVersionedImplementationId: GetVersionedImplementationId;
24
+ } & ConnectionsPluginProvides["context"];
25
+ } & EventEmissionProvides, GetInputFieldsSchemaPluginProvides>;
24
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getInputFieldsSchema/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,0BAA0B,EAE1B,KAAK,2BAA2B,IAAI,2BAA2B,EAChE,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAUxE,OAAO,KAAK,EAAE,oBAAoB,E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E,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;IAChD,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,oBAAoB,EAAE;gBACpB,WAAW,EAAE,OAAO,0BAA0B,CAAC;aAChD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAC7C,uBAAuB,GAAG;IACxB,OAAO,EAAE;QACP,GAAG,EAAE,SAAS,CAAC;QACf,4BAA4B,EAAE,4BAA4B,CAAC;KAC5D,GAAG,yBAAyB,CAAC,SAAS,CAAC,CAAC;CAC1C,GAAG,qBAAqB,EACzB,kCAAkC,CAmFnC,CAAC"}
@@ -6,9 +6,9 @@ import { fetchImplementationNeeds } from "../../services/implementations";
6
6
  import { createTelemetryCallback } from "../../utils/telemetry-utils";
7
7
  import { resolveConnectionId } from "../../utils/domain-utils";
8
8
  import { setMethodMetadata } from "../../utils/telemetry-context";
9
- export const getInputFieldsSchemaPlugin = ({ sdk, context }) => {
9
+ export const getInputFieldsSchemaPlugin = (sdk) => {
10
10
  async function getInputFieldsSchema(options) {
11
- const { api, getVersionedImplementationId } = context;
11
+ const { api, getVersionedImplementationId } = sdk.context;
12
12
  const appKey = "app" in options ? options.app : options.appKey;
13
13
  const actionKey = "action" in options ? options.action : options.actionKey;
14
14
  const { actionType, connection, connectionId, authenticationId, inputs } = options;
@@ -16,7 +16,7 @@ export const getInputFieldsSchemaPlugin = ({ sdk, context }) => {
16
16
  connection,
17
17
  connectionId,
18
18
  authenticationId,
19
- resolveConnection: context.resolveConnection,
19
+ resolveConnection: sdk.context.resolveConnection,
20
20
  });
21
21
  const selectedApi = await getVersionedImplementationId(appKey);
22
22
  if (!selectedApi) {
@@ -44,7 +44,7 @@ export const getInputFieldsSchemaPlugin = ({ sdk, context }) => {
44
44
  data: needsData.schema || {},
45
45
  };
46
46
  }
47
- const getInputFieldsSchemaDefinition = createFunction(getInputFieldsSchema, GetInputFieldsSchemaInputSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, getInputFieldsSchema.name));
47
+ const getInputFieldsSchemaDefinition = createFunction(getInputFieldsSchema, GetInputFieldsSchemaInputSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, getInputFieldsSchema.name));
48
48
  return {
49
49
  getInputFieldsSchema: getInputFieldsSchemaDefinition,
50
50
  context: {
@@ -3,7 +3,7 @@ import type { ApiClient } from "../../api/types";
3
3
  import type { Plugin } from "../../types/plugin";
4
4
  import type { UserProfileItem } from "../../types/domain";
5
5
  import { GetProfileSchema } from "./schemas";
6
- import type { EventEmissionContext } from "../eventEmission";
6
+ import type { EventEmissionProvides } from "../eventEmission";
7
7
  export interface GetProfilePluginProvides {
8
8
  getProfile: (options?: GetProfileOptions) => Promise<{
9
9
  data: UserProfileItem;
@@ -16,10 +16,10 @@ export interface GetProfilePluginProvides {
16
16
  };
17
17
  };
18
18
  }
19
- export declare const getProfilePlugin: Plugin<{}, // no SDK dependencies
20
- // no SDK dependencies
21
- {
22
- api: ApiClient;
23
- } & EventEmissionContext, // requires api and eventEmission in context
19
+ export declare const getProfilePlugin: Plugin<{
20
+ context: {
21
+ api: ApiClient;
22
+ };
23
+ } & EventEmissionProvides, // no SDK dependencies, requires api and eventEmission in context
24
24
  GetProfilePluginProvides>;
25
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getProfile/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG7C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,EAAE,MAAM,CACnC;IAAE,OAAO,EAAE;QAAE,GAAG,EAAE,SAAS,CAAA;KAAE,CAAA;CAAE,GAAG,qBAAqB,EAAE,iEAAiE;AAC1H,wBAAwB,CA+CzB,CAAC"}
@@ -3,9 +3,9 @@ import { GetProfileSchema } from "./schemas";
3
3
  import { UserProfileItemSchema } from "../../schemas/UserProfile";
4
4
  import { createTelemetryCallback } from "../../utils/telemetry-utils";
5
5
  // Direct plugin function - takes options + sdk + context in one object
6
- export const getProfilePlugin = ({ context }) => {
6
+ export const getProfilePlugin = (sdk) => {
7
7
  async function getProfile() {
8
- const profile = await context.api.get("/zapier/api/v4/profile/", {
8
+ const profile = await sdk.context.api.get("/zapier/api/v4/profile/", {
9
9
  authRequired: true,
10
10
  });
11
11
  return {
@@ -20,7 +20,7 @@ export const getProfilePlugin = ({ context }) => {
20
20
  },
21
21
  };
22
22
  }
23
- const getProfileDefinition = createFunction(getProfile, GetProfileSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, getProfile.name));
23
+ const getProfileDefinition = createFunction(getProfile, GetProfileSchema, createTelemetryCallback(sdk.context.eventEmission.emitMethodCalled, getProfile.name));
24
24
  // Return flat structure - getProfile goes directly to SDK
25
25
  return {
26
26
  getProfile: getProfileDefinition,