@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,6 +1,6 @@
1
1
  import { describe, it, expect, vi, beforeEach } from "vitest";
2
2
  import { ZapierValidationError, ZapierAuthenticationError, } from "../../types/errors";
3
- import { listAuthenticationsPlugin } from "./index";
3
+ import { listConnectionsPlugin } from "./index";
4
4
  import { createSdk } from "../../sdk";
5
5
  import { eventEmissionPlugin } from "../eventEmission";
6
6
  // Mock transport for testing - prevents real HTTP telemetry requests
@@ -16,7 +16,7 @@ vi.mock("@zapier/zapier-sdk-cli-login", () => ({
16
16
  getToken: vi.fn().mockResolvedValue(undefined),
17
17
  }));
18
18
  // Mock response in the new API format (data array, not results)
19
- const mockAuthenticationsResponse = {
19
+ const mockConnectionsResponse = {
20
20
  data: [
21
21
  {
22
22
  id: "123",
@@ -47,13 +47,13 @@ const mockAuthenticationsResponse = {
47
47
  ],
48
48
  nextCursor: undefined,
49
49
  };
50
- describe("listAuthentications plugin", () => {
50
+ describe("listConnections plugin", () => {
51
51
  let mockApiClient;
52
52
  let mockGetVersionedImplementationId;
53
53
  beforeEach(() => {
54
54
  vi.clearAllMocks();
55
55
  mockApiClient = {
56
- get: vi.fn().mockResolvedValue(mockAuthenticationsResponse),
56
+ get: vi.fn().mockResolvedValue(mockConnectionsResponse),
57
57
  };
58
58
  mockGetVersionedImplementationId = vi
59
59
  .fn()
@@ -105,17 +105,17 @@ describe("listAuthentications plugin", () => {
105
105
  .addPlugin(apiPlugin)
106
106
  .addPlugin(eventEmissionPlugin)
107
107
  .addPlugin(manifestPlugin)
108
- .addPlugin(listAuthenticationsPlugin);
108
+ .addPlugin(listConnectionsPlugin);
109
109
  }
110
110
  describe("schema validation", () => {
111
111
  it("should pass validation with empty options", async () => {
112
112
  const sdk = createTestSdk();
113
- const result = await sdk.listAuthentications({});
113
+ const result = await sdk.listConnections({});
114
114
  expect(result.data).toHaveLength(2);
115
115
  });
116
116
  it("should handle undefined options", async () => {
117
117
  const sdk = createTestSdk();
118
- const result = await sdk.listAuthentications();
118
+ const result = await sdk.listConnections();
119
119
  expect(result.data).toHaveLength(2);
120
120
  expect(result.data[0]).toMatchObject({
121
121
  id: "123",
@@ -124,7 +124,7 @@ describe("listAuthentications plugin", () => {
124
124
  it("should throw validation error for invalid appKey type", () => {
125
125
  const sdk = createTestSdk();
126
126
  expect(() => {
127
- sdk.listAuthentications({
127
+ sdk.listConnections({
128
128
  appKey: 123,
129
129
  });
130
130
  }).toThrow(ZapierValidationError);
@@ -132,7 +132,7 @@ describe("listAuthentications plugin", () => {
132
132
  it("should throw validation error for invalid search type", () => {
133
133
  const sdk = createTestSdk();
134
134
  expect(() => {
135
- sdk.listAuthentications({
135
+ sdk.listConnections({
136
136
  search: 123,
137
137
  });
138
138
  }).toThrow(ZapierValidationError);
@@ -140,7 +140,7 @@ describe("listAuthentications plugin", () => {
140
140
  it("should throw validation error for invalid title type", () => {
141
141
  const sdk = createTestSdk();
142
142
  expect(() => {
143
- sdk.listAuthentications({
143
+ sdk.listConnections({
144
144
  title: 123,
145
145
  });
146
146
  }).toThrow(ZapierValidationError);
@@ -148,7 +148,7 @@ describe("listAuthentications plugin", () => {
148
148
  it("should throw validation error for invalid accountId type", () => {
149
149
  const sdk = createTestSdk();
150
150
  expect(() => {
151
- sdk.listAuthentications({
151
+ sdk.listConnections({
152
152
  accountId: 123,
153
153
  });
154
154
  }).toThrow(ZapierValidationError);
@@ -156,7 +156,7 @@ describe("listAuthentications plugin", () => {
156
156
  it("should throw validation error for invalid owner type", () => {
157
157
  const sdk = createTestSdk();
158
158
  expect(() => {
159
- sdk.listAuthentications({
159
+ sdk.listConnections({
160
160
  owner: 123,
161
161
  });
162
162
  }).toThrow(ZapierValidationError);
@@ -164,12 +164,12 @@ describe("listAuthentications plugin", () => {
164
164
  it("should throw validation error for invalid isExpired type", () => {
165
165
  const sdk = createTestSdk();
166
166
  expect(() => {
167
- sdk.listAuthentications({
167
+ sdk.listConnections({
168
168
  isExpired: "true", // Should be boolean, not string
169
169
  });
170
170
  }).toThrow(ZapierValidationError);
171
171
  expect(() => {
172
- sdk.listAuthentications({
172
+ sdk.listConnections({
173
173
  isExpired: 1, // Should be boolean, not number
174
174
  });
175
175
  }).toThrow(ZapierValidationError);
@@ -177,34 +177,34 @@ describe("listAuthentications plugin", () => {
177
177
  it("should pass validation with isExpired boolean values", async () => {
178
178
  const sdk = createTestSdk();
179
179
  // Test with true
180
- const resultTrue = await sdk.listAuthentications({ isExpired: true });
180
+ const resultTrue = await sdk.listConnections({ isExpired: true });
181
181
  expect(resultTrue.data).toBeDefined();
182
182
  // Test with false
183
- const resultFalse = await sdk.listAuthentications({ isExpired: false });
183
+ const resultFalse = await sdk.listConnections({ isExpired: false });
184
184
  expect(resultFalse.data).toBeDefined();
185
185
  });
186
- it("should throw validation error for invalid authenticationIds type", () => {
186
+ it("should throw validation error for invalid connectionIds type", () => {
187
187
  const sdk = createTestSdk();
188
188
  expect(() => {
189
- sdk.listAuthentications({
190
- authenticationIds: "123", // Should be array of strings
189
+ sdk.listConnections({
190
+ connectionIds: "123", // Should be array of strings
191
191
  });
192
192
  }).toThrow(ZapierValidationError);
193
193
  expect(() => {
194
- sdk.listAuthentications({
195
- authenticationIds: [123], // Should be array of strings, not numbers
194
+ sdk.listConnections({
195
+ connectionIds: [123], // Should be array of strings, not numbers
196
196
  });
197
197
  }).toThrow(ZapierValidationError);
198
198
  });
199
199
  it("should throw validation error for invalid pageSize", () => {
200
200
  const sdk = createTestSdk();
201
201
  expect(() => {
202
- sdk.listAuthentications({
202
+ sdk.listConnections({
203
203
  pageSize: 0, // Should be >= 1
204
204
  });
205
205
  }).toThrow(ZapierValidationError);
206
206
  expect(() => {
207
- sdk.listAuthentications({
207
+ sdk.listConnections({
208
208
  pageSize: -5, // Should be >= 1
209
209
  });
210
210
  }).toThrow(ZapierValidationError);
@@ -212,21 +212,21 @@ describe("listAuthentications plugin", () => {
212
212
  it("should throw validation error for invalid maxItems", () => {
213
213
  const sdk = createTestSdk();
214
214
  expect(() => {
215
- sdk.listAuthentications({
215
+ sdk.listConnections({
216
216
  maxItems: 0, // Should be >= 1
217
217
  });
218
218
  }).toThrow(ZapierValidationError);
219
219
  expect(() => {
220
- sdk.listAuthentications({
220
+ sdk.listConnections({
221
221
  maxItems: -10, // Should be >= 1
222
222
  });
223
223
  }).toThrow(ZapierValidationError);
224
224
  });
225
225
  it("should pass validation with all valid fields", async () => {
226
226
  const sdk = createTestSdk();
227
- const result = await sdk.listAuthentications({
227
+ const result = await sdk.listConnections({
228
228
  appKey: "slack",
229
- authenticationIds: ["123", "456"],
229
+ connectionIds: ["123", "456"],
230
230
  search: "workspace",
231
231
  title: "My Slack Workspace",
232
232
  accountId: "acc_123",
@@ -238,10 +238,35 @@ describe("listAuthentications plugin", () => {
238
238
  expect(result.data).toBeDefined();
239
239
  });
240
240
  });
241
+ describe("deprecated authenticationIds support", () => {
242
+ it("should accept deprecated authenticationIds parameter", async () => {
243
+ const sdk = createTestSdk();
244
+ await sdk.listConnections({
245
+ authenticationIds: ["123", "456"],
246
+ });
247
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
248
+ searchParams: expect.objectContaining({
249
+ connection_ids: "123,456",
250
+ }),
251
+ }));
252
+ });
253
+ it("should prefer connectionIds over authenticationIds when both provided", async () => {
254
+ const sdk = createTestSdk();
255
+ await sdk.listConnections({
256
+ connectionIds: ["new-1", "new-2"],
257
+ authenticationIds: ["old-1", "old-2"],
258
+ });
259
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
260
+ searchParams: expect.objectContaining({
261
+ connection_ids: "new-1,new-2",
262
+ }),
263
+ }));
264
+ });
265
+ });
241
266
  describe("data mapping", () => {
242
267
  it("should pass through is_expired and expired_at fields", async () => {
243
268
  const sdk = createTestSdk();
244
- const result = await sdk.listAuthentications();
269
+ const result = await sdk.listConnections();
245
270
  // API returns these fields directly (no client-side transformation)
246
271
  expect(result.data[0].is_expired).toBe("false");
247
272
  expect(result.data[0].expired_at).toBe(null);
@@ -250,29 +275,29 @@ describe("listAuthentications plugin", () => {
250
275
  });
251
276
  it("should pass through label field when title is missing", async () => {
252
277
  const responseWithoutTitle = {
253
- ...mockAuthenticationsResponse,
278
+ ...mockConnectionsResponse,
254
279
  data: [
255
280
  {
256
- ...mockAuthenticationsResponse.data[0],
281
+ ...mockConnectionsResponse.data[0],
257
282
  title: undefined,
258
- label: "Label Only Auth",
283
+ label: "Label Only Connection",
259
284
  },
260
285
  ],
261
286
  nextCursor: undefined,
262
287
  };
263
288
  mockApiClient.get = vi.fn().mockResolvedValue(responseWithoutTitle);
264
289
  const sdk = createTestSdk();
265
- const result = await sdk.listAuthentications({});
290
+ const result = await sdk.listConnections({});
266
291
  // New API passes through fields directly - title coercion happens server-side
267
292
  expect(result.data[0].title).toBeUndefined();
268
- expect(result.data[0].label).toBe("Label Only Auth");
293
+ expect(result.data[0].label).toBe("Label Only Connection");
269
294
  });
270
- it("should handle authentications with neither title nor label", async () => {
295
+ it("should handle connections with neither title nor label", async () => {
271
296
  const responseWithoutTitleOrLabel = {
272
- ...mockAuthenticationsResponse,
297
+ ...mockConnectionsResponse,
273
298
  data: [
274
299
  {
275
- ...mockAuthenticationsResponse.data[0],
300
+ ...mockConnectionsResponse.data[0],
276
301
  title: undefined,
277
302
  label: undefined,
278
303
  },
@@ -283,15 +308,15 @@ describe("listAuthentications plugin", () => {
283
308
  .fn()
284
309
  .mockResolvedValue(responseWithoutTitleOrLabel);
285
310
  const sdk = createTestSdk();
286
- const result = await sdk.listAuthentications({});
311
+ const result = await sdk.listConnections({});
287
312
  expect(result.data[0].title).toBeUndefined();
288
313
  });
289
314
  });
290
315
  describe("filtering", () => {
291
316
  it("should pass search parameter to API when provided", async () => {
292
317
  const sdk = createTestSdk();
293
- await sdk.listAuthentications({ search: "workspace" });
294
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
318
+ await sdk.listConnections({ search: "workspace" });
319
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
295
320
  searchParams: expect.objectContaining({
296
321
  search: "workspace",
297
322
  }),
@@ -299,8 +324,8 @@ describe("listAuthentications plugin", () => {
299
324
  });
300
325
  it("should pass title parameter separately to API", async () => {
301
326
  const sdk = createTestSdk();
302
- await sdk.listAuthentications({ title: "My Slack Workspace" });
303
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
327
+ await sdk.listConnections({ title: "My Slack Workspace" });
328
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
304
329
  searchParams: expect.objectContaining({
305
330
  title: "My Slack Workspace",
306
331
  }),
@@ -308,11 +333,11 @@ describe("listAuthentications plugin", () => {
308
333
  });
309
334
  it("should pass both search and title when both provided", async () => {
310
335
  const sdk = createTestSdk();
311
- await sdk.listAuthentications({
336
+ await sdk.listConnections({
312
337
  search: "explicit search",
313
338
  title: "My Title",
314
339
  });
315
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
340
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
316
341
  searchParams: expect.objectContaining({
317
342
  search: "explicit search",
318
343
  title: "My Title",
@@ -321,17 +346,17 @@ describe("listAuthentications plugin", () => {
321
346
  });
322
347
  it("should pass accountId filter to API", async () => {
323
348
  const sdk = createTestSdk();
324
- await sdk.listAuthentications({ accountId: "acc_123" });
325
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
349
+ await sdk.listConnections({ accountId: "acc_123" });
350
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
326
351
  searchParams: expect.objectContaining({
327
- accountId: "acc_123",
352
+ account_id: "acc_123",
328
353
  }),
329
354
  }));
330
355
  });
331
356
  it("should pass owner filter to API", async () => {
332
357
  const sdk = createTestSdk();
333
- await sdk.listAuthentications({ owner: "me" });
334
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
358
+ await sdk.listConnections({ owner: "me" });
359
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
335
360
  searchParams: expect.objectContaining({
336
361
  owner: "me",
337
362
  }),
@@ -339,63 +364,63 @@ describe("listAuthentications plugin", () => {
339
364
  });
340
365
  it("should pass isExpired=true filter to API", async () => {
341
366
  const sdk = createTestSdk();
342
- await sdk.listAuthentications({ isExpired: true });
343
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
367
+ await sdk.listConnections({ isExpired: true });
368
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
344
369
  searchParams: expect.objectContaining({
345
- isExpired: "true",
370
+ is_expired: "true",
346
371
  }),
347
372
  }));
348
373
  });
349
374
  it("should pass isExpired=false filter to API", async () => {
350
375
  const sdk = createTestSdk();
351
- await sdk.listAuthentications({ isExpired: false });
352
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
376
+ await sdk.listConnections({ isExpired: false });
377
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
353
378
  searchParams: expect.objectContaining({
354
- isExpired: "false",
379
+ is_expired: "false",
355
380
  }),
356
381
  }));
357
382
  });
358
383
  it("should not include isExpired parameter when not provided", async () => {
359
384
  const sdk = createTestSdk();
360
- await sdk.listAuthentications({});
385
+ await sdk.listConnections({});
361
386
  const callArgs = mockApiClient.get.mock.calls[0];
362
387
  const searchParams = callArgs[1].searchParams;
363
- expect(searchParams).not.toHaveProperty("isExpired");
388
+ expect(searchParams).not.toHaveProperty("is_expired");
364
389
  });
365
- it("should pass authenticationIds as comma-separated string to API", async () => {
390
+ it("should pass connectionIds as comma-separated string to API", async () => {
366
391
  const sdk = createTestSdk();
367
- await sdk.listAuthentications({
368
- authenticationIds: ["123", "456", "789"],
392
+ await sdk.listConnections({
393
+ connectionIds: ["123", "456", "789"],
369
394
  });
370
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
395
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
371
396
  searchParams: expect.objectContaining({
372
- authenticationIds: "123,456,789",
397
+ connection_ids: "123,456,789",
373
398
  }),
374
399
  }));
375
400
  });
376
- it("should not include authenticationIds parameter when array is empty", async () => {
401
+ it("should not include connectionIds parameter when array is empty", async () => {
377
402
  const sdk = createTestSdk();
378
- await sdk.listAuthentications({
379
- authenticationIds: [],
403
+ await sdk.listConnections({
404
+ connectionIds: [],
380
405
  });
381
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
406
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
382
407
  searchParams: expect.not.objectContaining({
383
- authenticationIds: expect.anything(),
408
+ connection_ids: expect.anything(),
384
409
  }),
385
410
  }));
386
411
  });
387
412
  it("should not include undefined optional parameters in searchParams", async () => {
388
413
  const sdk = createTestSdk();
389
- await sdk.listAuthentications({});
414
+ await sdk.listConnections({});
390
415
  const callArgs = mockApiClient.get.mock.calls[0];
391
416
  const searchParams = callArgs[1].searchParams;
392
- // Should only have pageSize (default), not undefined params
417
+ // Should only have page_size (default), not undefined params
393
418
  expect(searchParams).not.toHaveProperty("search");
394
419
  expect(searchParams).not.toHaveProperty("title");
395
- expect(searchParams).not.toHaveProperty("accountId");
420
+ expect(searchParams).not.toHaveProperty("account_id");
396
421
  expect(searchParams).not.toHaveProperty("owner");
397
- expect(searchParams).not.toHaveProperty("authenticationIds");
398
- expect(searchParams).not.toHaveProperty("appKey");
422
+ expect(searchParams).not.toHaveProperty("connection_ids");
423
+ expect(searchParams).not.toHaveProperty("app_key");
399
424
  });
400
425
  });
401
426
  describe("pagination", () => {
@@ -404,7 +429,7 @@ describe("listAuthentications plugin", () => {
404
429
  mockApiClient.get = vi
405
430
  .fn()
406
431
  .mockResolvedValueOnce({
407
- data: mockAuthenticationsResponse.data,
432
+ data: mockConnectionsResponse.data,
408
433
  nextCursor: "2",
409
434
  })
410
435
  .mockResolvedValueOnce({
@@ -427,9 +452,7 @@ describe("listAuthentications plugin", () => {
427
452
  const sdk = createTestSdk();
428
453
  // Collect all items using the items() iterator
429
454
  const items = [];
430
- for await (const item of sdk
431
- .listAuthentications({ maxItems: 3 })
432
- .items()) {
455
+ for await (const item of sdk.listConnections({ maxItems: 3 }).items()) {
433
456
  items.push(item);
434
457
  }
435
458
  expect(items).toHaveLength(3); // Should stop at maxItems
@@ -437,11 +460,11 @@ describe("listAuthentications plugin", () => {
437
460
  });
438
461
  it("should return first page when awaited", async () => {
439
462
  mockApiClient.get = vi.fn().mockResolvedValue({
440
- data: mockAuthenticationsResponse.data,
463
+ data: mockConnectionsResponse.data,
441
464
  nextCursor: undefined,
442
465
  });
443
466
  const sdk = createTestSdk();
444
- const result = await sdk.listAuthentications({});
467
+ const result = await sdk.listConnections({});
445
468
  // Await returns first page only
446
469
  expect(result.data).toHaveLength(2);
447
470
  expect(mockApiClient.get).toHaveBeenCalledTimes(1);
@@ -450,16 +473,16 @@ describe("listAuthentications plugin", () => {
450
473
  mockApiClient.get = vi
451
474
  .fn()
452
475
  .mockResolvedValueOnce({
453
- data: mockAuthenticationsResponse.data.slice(0, 1),
476
+ data: mockConnectionsResponse.data.slice(0, 1),
454
477
  nextCursor: "1",
455
478
  })
456
479
  .mockResolvedValueOnce({
457
- data: mockAuthenticationsResponse.data.slice(1, 2),
480
+ data: mockConnectionsResponse.data.slice(1, 2),
458
481
  nextCursor: undefined,
459
482
  });
460
483
  const sdk = createTestSdk();
461
484
  const pages = [];
462
- for await (const page of sdk.listAuthentications({ pageSize: 1 })) {
485
+ for await (const page of sdk.listConnections({ pageSize: 1 })) {
463
486
  pages.push(page);
464
487
  if (pages.length >= 2)
465
488
  break;
@@ -473,9 +496,7 @@ describe("listAuthentications plugin", () => {
473
496
  it("should support async iteration over individual items", async () => {
474
497
  const sdk = createTestSdk();
475
498
  const items = [];
476
- for await (const item of sdk
477
- .listAuthentications({ maxItems: 2 })
478
- .items()) {
499
+ for await (const item of sdk.listConnections({ maxItems: 2 }).items()) {
479
500
  items.push(item);
480
501
  }
481
502
  expect(items).toHaveLength(2);
@@ -484,10 +505,10 @@ describe("listAuthentications plugin", () => {
484
505
  });
485
506
  it("should set pageSize in searchParams for API calls", async () => {
486
507
  const sdk = createTestSdk();
487
- await sdk.listAuthentications({ pageSize: 15 });
488
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
508
+ await sdk.listConnections({ pageSize: 15 });
509
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
489
510
  searchParams: expect.objectContaining({
490
- pageSize: "15",
511
+ page_size: "15",
491
512
  }),
492
513
  }));
493
514
  });
@@ -495,22 +516,22 @@ describe("listAuthentications plugin", () => {
495
516
  mockApiClient.get = vi
496
517
  .fn()
497
518
  .mockResolvedValueOnce({
498
- data: mockAuthenticationsResponse.data.slice(0, 1),
519
+ data: mockConnectionsResponse.data.slice(0, 1),
499
520
  nextCursor: "cursor-abc-123",
500
521
  })
501
522
  .mockResolvedValueOnce({
502
- data: mockAuthenticationsResponse.data.slice(1, 2),
523
+ data: mockConnectionsResponse.data.slice(1, 2),
503
524
  nextCursor: undefined,
504
525
  });
505
526
  const sdk = createTestSdk();
506
527
  const pages = [];
507
- for await (const page of sdk.listAuthentications({ pageSize: 1 })) {
528
+ for await (const page of sdk.listConnections({ pageSize: 1 })) {
508
529
  pages.push(page);
509
530
  if (pages.length >= 2)
510
531
  break;
511
532
  }
512
533
  // Second call should include the cursor as offset
513
- expect(mockApiClient.get).toHaveBeenNthCalledWith(2, "/api/v0/authentications", expect.objectContaining({
534
+ expect(mockApiClient.get).toHaveBeenNthCalledWith(2, "/api/v0/connections", expect.objectContaining({
514
535
  searchParams: expect.objectContaining({
515
536
  offset: "cursor-abc-123",
516
537
  }),
@@ -518,12 +539,12 @@ describe("listAuthentications plugin", () => {
518
539
  });
519
540
  it("should stop pagination when nextCursor is undefined", async () => {
520
541
  mockApiClient.get = vi.fn().mockResolvedValue({
521
- data: mockAuthenticationsResponse.data,
542
+ data: mockConnectionsResponse.data,
522
543
  nextCursor: undefined,
523
544
  });
524
545
  const sdk = createTestSdk();
525
546
  const pages = [];
526
- for await (const page of sdk.listAuthentications({})) {
547
+ for await (const page of sdk.listConnections({})) {
527
548
  pages.push(page);
528
549
  }
529
550
  expect(pages).toHaveLength(1);
@@ -533,15 +554,15 @@ describe("listAuthentications plugin", () => {
533
554
  describe("API integration", () => {
534
555
  it("should call the correct API endpoint", async () => {
535
556
  const sdk = createTestSdk();
536
- await sdk.listAuthentications({});
537
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.any(Object));
557
+ await sdk.listConnections({});
558
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.any(Object));
538
559
  });
539
560
  it("should pass pageSize as string in searchParams", async () => {
540
561
  const sdk = createTestSdk();
541
- await sdk.listAuthentications({ pageSize: 25 });
542
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
562
+ await sdk.listConnections({ pageSize: 25 });
563
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
543
564
  searchParams: expect.objectContaining({
544
- pageSize: "25",
565
+ page_size: "25",
545
566
  }),
546
567
  }));
547
568
  });
@@ -549,17 +570,17 @@ describe("listAuthentications plugin", () => {
549
570
  mockApiClient.get = vi
550
571
  .fn()
551
572
  .mockResolvedValueOnce({
552
- data: mockAuthenticationsResponse.data.slice(0, 1),
573
+ data: mockConnectionsResponse.data.slice(0, 1),
553
574
  nextCursor: "offset-1",
554
575
  })
555
576
  .mockResolvedValueOnce({
556
- data: mockAuthenticationsResponse.data.slice(1, 2),
577
+ data: mockConnectionsResponse.data.slice(1, 2),
557
578
  nextCursor: undefined,
558
579
  });
559
580
  const sdk = createTestSdk();
560
581
  // Test that the function can handle multiple pages
561
582
  let pageCount = 0;
562
- for await (const _page of sdk.listAuthentications({ pageSize: 1 })) {
583
+ for await (const _page of sdk.listConnections({ pageSize: 1 })) {
563
584
  pageCount++;
564
585
  if (pageCount >= 2)
565
586
  break;
@@ -567,7 +588,7 @@ describe("listAuthentications plugin", () => {
567
588
  expect(pageCount).toBe(2);
568
589
  expect(mockApiClient.get).toHaveBeenCalledTimes(2);
569
590
  // The second call should include the offset from the nextCursor
570
- expect(mockApiClient.get).toHaveBeenNthCalledWith(2, "/api/v0/authentications", expect.objectContaining({
591
+ expect(mockApiClient.get).toHaveBeenNthCalledWith(2, "/api/v0/connections", expect.objectContaining({
571
592
  searchParams: expect.objectContaining({
572
593
  offset: "offset-1",
573
594
  }),
@@ -575,15 +596,15 @@ describe("listAuthentications plugin", () => {
575
596
  });
576
597
  it("should set authRequired to true in API call options", async () => {
577
598
  const sdk = createTestSdk();
578
- await sdk.listAuthentications({});
579
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
599
+ await sdk.listConnections({});
600
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
580
601
  authRequired: true,
581
602
  }));
582
603
  });
583
604
  it("should include customErrorHandler in API call options", async () => {
584
605
  const sdk = createTestSdk();
585
- await sdk.listAuthentications({});
586
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
606
+ await sdk.listConnections({});
607
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
587
608
  customErrorHandler: expect.any(Function),
588
609
  }));
589
610
  });
@@ -597,8 +618,8 @@ describe("listAuthentications plugin", () => {
597
618
  throw error;
598
619
  });
599
620
  const sdk = createTestSdk();
600
- await expect(sdk.listAuthentications({})).rejects.toThrow(ZapierAuthenticationError);
601
- await expect(sdk.listAuthentications({})).rejects.toThrow(/Authentication failed.*HTTP 401/);
621
+ await expect(sdk.listConnections({})).rejects.toThrow(ZapierAuthenticationError);
622
+ await expect(sdk.listConnections({})).rejects.toThrow(/Authentication failed.*HTTP 401/);
602
623
  });
603
624
  it("should throw ZapierAuthenticationError for 403 responses", async () => {
604
625
  mockApiClient.get = vi.fn().mockImplementation((_url, options) => {
@@ -608,8 +629,8 @@ describe("listAuthentications plugin", () => {
608
629
  throw error;
609
630
  });
610
631
  const sdk = createTestSdk();
611
- await expect(sdk.listAuthentications({})).rejects.toThrow(ZapierAuthenticationError);
612
- await expect(sdk.listAuthentications({})).rejects.toThrow(/Access forbidden.*HTTP 403/);
632
+ await expect(sdk.listConnections({})).rejects.toThrow(ZapierAuthenticationError);
633
+ await expect(sdk.listConnections({})).rejects.toThrow(/Access forbidden.*HTTP 403/);
613
634
  });
614
635
  it("should return undefined from customErrorHandler for non-401/403 errors", async () => {
615
636
  let customErrorHandlerResult;
@@ -617,10 +638,10 @@ describe("listAuthentications plugin", () => {
617
638
  // Capture the customErrorHandler result for 500
618
639
  customErrorHandlerResult = options.customErrorHandler({ status: 500 });
619
640
  // Return valid data since we're just testing the handler
620
- return mockAuthenticationsResponse;
641
+ return mockConnectionsResponse;
621
642
  });
622
643
  const sdk = createTestSdk();
623
- await sdk.listAuthentications({});
644
+ await sdk.listConnections({});
624
645
  // The customErrorHandler should return undefined for other status codes
625
646
  expect(customErrorHandlerResult).toBeUndefined();
626
647
  });
@@ -631,7 +652,7 @@ describe("listAuthentications plugin", () => {
631
652
  };
632
653
  mockApiClient.get = vi.fn().mockResolvedValue(emptyResponse);
633
654
  const sdk = createTestSdk();
634
- const result = await sdk.listAuthentications({});
655
+ const result = await sdk.listConnections({});
635
656
  expect(result.data).toHaveLength(0);
636
657
  expect(Array.isArray(result.data)).toBe(true);
637
658
  });
@@ -639,55 +660,55 @@ describe("listAuthentications plugin", () => {
639
660
  const networkError = new Error("Network error");
640
661
  mockApiClient.get = vi.fn().mockRejectedValue(networkError);
641
662
  const sdk = createTestSdk();
642
- await expect(sdk.listAuthentications({})).rejects.toThrow("Network error");
663
+ await expect(sdk.listConnections({})).rejects.toThrow("Network error");
643
664
  });
644
665
  });
645
666
  describe("app key integration", () => {
646
667
  it("should not add appKey parameter when getVersionedImplementationId returns null", async () => {
647
668
  mockGetVersionedImplementationId.mockResolvedValue(null);
648
669
  const sdk = createTestSdk();
649
- await sdk.listAuthentications({ appKey: "slack" });
650
- // Should not add appKey parameter when implementation can't be resolved
651
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
652
- searchParams: expect.not.objectContaining({
653
- appKey: expect.any(String),
670
+ await sdk.listConnections({ appKey: "slack" });
671
+ // Should pass raw appKey when implementation can't be resolved via manifest
672
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
673
+ searchParams: expect.objectContaining({
674
+ app_key: "slack",
654
675
  }),
655
676
  }));
656
677
  });
657
678
  it("should extract versionless app key from versioned implementation ID", async () => {
658
679
  mockGetVersionedImplementationId.mockResolvedValue("SlackCLIAPI@2.1.3");
659
680
  const sdk = createTestSdk();
660
- await sdk.listAuthentications({ appKey: "slack" });
661
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
681
+ await sdk.listConnections({ appKey: "slack" });
682
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
662
683
  searchParams: expect.objectContaining({
663
- appKey: "SlackCLIAPI",
684
+ app_key: "SlackCLIAPI",
664
685
  }),
665
686
  }));
666
687
  });
667
688
  it("should handle implementation ID without version", async () => {
668
689
  mockGetVersionedImplementationId.mockResolvedValue("SlackCLIAPI");
669
690
  const sdk = createTestSdk();
670
- await sdk.listAuthentications({ appKey: "slack" });
671
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
691
+ await sdk.listConnections({ appKey: "slack" });
692
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
672
693
  searchParams: expect.objectContaining({
673
- appKey: "SlackCLIAPI",
694
+ app_key: "SlackCLIAPI",
674
695
  }),
675
696
  }));
676
697
  });
677
698
  it("should call getVersionedImplementationId with the provided appKey", async () => {
678
699
  const sdk = createTestSdk();
679
- await sdk.listAuthentications({ appKey: "my-custom-app" });
700
+ await sdk.listConnections({ appKey: "my-custom-app" });
680
701
  expect(mockGetVersionedImplementationId).toHaveBeenCalledWith("my-custom-app");
681
702
  });
682
703
  it("should not call getVersionedImplementationId when appKey is not provided", async () => {
683
704
  const sdk = createTestSdk();
684
- await sdk.listAuthentications({});
705
+ await sdk.listConnections({});
685
706
  expect(mockGetVersionedImplementationId).not.toHaveBeenCalled();
686
707
  });
687
708
  });
688
709
  describe("response transformation", () => {
689
- it("should preserve all authentication fields from new API response", async () => {
690
- const authWithAllFields = {
710
+ it("should preserve all connection fields from new API response", async () => {
711
+ const connectionWithAllFields = {
691
712
  data: [
692
713
  {
693
714
  id: "123",
@@ -703,9 +724,9 @@ describe("listAuthentications plugin", () => {
703
724
  is_expired: "true",
704
725
  is_shared: "false",
705
726
  expired_at: "2021-06-01",
706
- label: "Auth Label",
707
- title: "Auth Title",
708
- identifier: "auth-identifier",
727
+ label: "Connection Label",
728
+ title: "Connection Title",
729
+ identifier: "test-identifier",
709
730
  url: "https://example.com",
710
731
  groups: "group1,group2",
711
732
  members: "user1,user2",
@@ -716,36 +737,36 @@ describe("listAuthentications plugin", () => {
716
737
  ],
717
738
  nextCursor: undefined,
718
739
  };
719
- mockApiClient.get = vi.fn().mockResolvedValue(authWithAllFields);
740
+ mockApiClient.get = vi.fn().mockResolvedValue(connectionWithAllFields);
720
741
  const sdk = createTestSdk();
721
- const result = await sdk.listAuthentications({});
722
- const auth = result.data[0];
742
+ const result = await sdk.listConnections({});
743
+ const connection = result.data[0];
723
744
  // Verify all fields are passed through from the new API
724
- expect(auth.id).toBe("123");
725
- expect(auth.date).toBe("2021-01-01");
726
- expect(auth.lastchanged).toBe("2021-01-02");
727
- expect(auth.account_id).toBe("456");
728
- expect(auth.profile_id).toBe("789");
729
- expect(auth.implementation_id).toBe("SlackCLIAPI@1.21.1");
730
- expect(auth.destination_selected_api).toBe("SlackDestAPI@1.0.0");
731
- expect(auth.is_invite_only).toBe(true);
732
- expect(auth.is_private).toBe(true);
733
- expect(auth.shared_with_all).toBe(false);
734
- expect(auth.is_shared).toBe("false");
735
- expect(auth.label).toBe("Auth Label");
736
- expect(auth.title).toBe("Auth Title");
737
- expect(auth.identifier).toBe("auth-identifier");
738
- expect(auth.url).toBe("https://example.com");
739
- expect(auth.groups).toBe("group1,group2");
740
- expect(auth.members).toBe("user1,user2");
741
- expect(auth.permissions).toEqual({ read: true, write: false });
742
- expect(auth.is_expired).toBe("true");
743
- expect(auth.expired_at).toBe("2021-06-01");
744
- expect(auth.app_key).toBe("SlackCLIAPI");
745
- expect(auth.app_version).toBe("1.21.1");
746
- });
747
- it("should handle authentications with minimal fields", async () => {
748
- const minimalAuth = {
745
+ expect(connection.id).toBe("123");
746
+ expect(connection.date).toBe("2021-01-01");
747
+ expect(connection.lastchanged).toBe("2021-01-02");
748
+ expect(connection.account_id).toBe("456");
749
+ expect(connection.profile_id).toBe("789");
750
+ expect(connection.implementation_id).toBe("SlackCLIAPI@1.21.1");
751
+ expect(connection.destination_selected_api).toBe("SlackDestAPI@1.0.0");
752
+ expect(connection.is_invite_only).toBe(true);
753
+ expect(connection.is_private).toBe(true);
754
+ expect(connection.shared_with_all).toBe(false);
755
+ expect(connection.is_shared).toBe("false");
756
+ expect(connection.label).toBe("Connection Label");
757
+ expect(connection.title).toBe("Connection Title");
758
+ expect(connection.identifier).toBe("test-identifier");
759
+ expect(connection.url).toBe("https://example.com");
760
+ expect(connection.groups).toBe("group1,group2");
761
+ expect(connection.members).toBe("user1,user2");
762
+ expect(connection.permissions).toEqual({ read: true, write: false });
763
+ expect(connection.is_expired).toBe("true");
764
+ expect(connection.expired_at).toBe("2021-06-01");
765
+ expect(connection.app_key).toBe("SlackCLIAPI");
766
+ expect(connection.app_version).toBe("1.21.1");
767
+ });
768
+ it("should handle connections with minimal fields", async () => {
769
+ const minimalConnection = {
749
770
  data: [
750
771
  {
751
772
  id: "100",
@@ -755,29 +776,29 @@ describe("listAuthentications plugin", () => {
755
776
  ],
756
777
  nextCursor: undefined,
757
778
  };
758
- mockApiClient.get = vi.fn().mockResolvedValue(minimalAuth);
779
+ mockApiClient.get = vi.fn().mockResolvedValue(minimalConnection);
759
780
  const sdk = createTestSdk();
760
- const result = await sdk.listAuthentications({});
761
- const auth = result.data[0];
762
- expect(auth.id).toBe("100");
763
- expect(auth.account_id).toBe("200");
764
- expect(auth.implementation_id).toBe("TestAPI@1.0.0");
781
+ const result = await sdk.listConnections({});
782
+ const connection = result.data[0];
783
+ expect(connection.id).toBe("100");
784
+ expect(connection.account_id).toBe("200");
785
+ expect(connection.implementation_id).toBe("TestAPI@1.0.0");
765
786
  });
766
787
  });
767
788
  describe("context and metadata", () => {
768
789
  it("should provide context with meta information", () => {
769
790
  const sdk = createTestSdk();
770
791
  const context = sdk.getContext();
771
- expect(context.meta.listAuthentications).toBeDefined();
772
- expect(context.meta.listAuthentications.inputSchema).toBeDefined();
792
+ expect(context.meta.listConnections).toBeDefined();
793
+ expect(context.meta.listConnections.inputSchema).toBeDefined();
773
794
  });
774
795
  it("should include all required metadata properties", () => {
775
796
  const sdk = createTestSdk();
776
797
  const context = sdk.getContext();
777
- const meta = context.meta.listAuthentications;
778
- expect(meta.categories).toContain("authentication");
798
+ const meta = context.meta.listConnections;
799
+ expect(meta.categories).toContain("connection");
779
800
  expect(meta.type).toBe("list");
780
- expect(meta.itemType).toBe("Authentication");
801
+ expect(meta.itemType).toBe("Connection");
781
802
  expect(meta.inputSchema).toBeDefined();
782
803
  expect(meta.outputSchema).toBeDefined();
783
804
  expect(meta.resolvers).toBeDefined();
@@ -787,8 +808,8 @@ describe("listAuthentications plugin", () => {
787
808
  describe("edge cases", () => {
788
809
  it("should handle special characters in search parameter", async () => {
789
810
  const sdk = createTestSdk();
790
- await sdk.listAuthentications({ search: "test@email.com" });
791
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
811
+ await sdk.listConnections({ search: "test@email.com" });
812
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
792
813
  searchParams: expect.objectContaining({
793
814
  search: "test@email.com",
794
815
  }),
@@ -796,54 +817,54 @@ describe("listAuthentications plugin", () => {
796
817
  });
797
818
  it("should handle special characters in title parameter", async () => {
798
819
  const sdk = createTestSdk();
799
- await sdk.listAuthentications({ title: "My Auth (Test) #1" });
800
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
820
+ await sdk.listConnections({ title: "My Connection (Test) #1" });
821
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
801
822
  searchParams: expect.objectContaining({
802
- title: "My Auth (Test) #1",
823
+ title: "My Connection (Test) #1",
803
824
  }),
804
825
  }));
805
826
  });
806
- it("should handle single authenticationId in array", async () => {
827
+ it("should handle single connectionId in array", async () => {
807
828
  const sdk = createTestSdk();
808
- await sdk.listAuthentications({ authenticationIds: ["single-id"] });
809
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
829
+ await sdk.listConnections({ connectionIds: ["single-id"] });
830
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
810
831
  searchParams: expect.objectContaining({
811
- authenticationIds: "single-id",
832
+ connection_ids: "single-id",
812
833
  }),
813
834
  }));
814
835
  });
815
836
  it("should handle multiple filters combined", async () => {
816
837
  const sdk = createTestSdk();
817
- await sdk.listAuthentications({
838
+ await sdk.listConnections({
818
839
  appKey: "slack",
819
840
  search: "workspace",
820
841
  title: "My Workspace",
821
842
  accountId: "acc_123",
822
843
  owner: "me",
823
- authenticationIds: ["id1", "id2"],
844
+ connectionIds: ["id1", "id2"],
824
845
  pageSize: 10,
825
846
  });
826
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
847
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
827
848
  searchParams: expect.objectContaining({
828
- appKey: "SlackCLIAPI",
849
+ app_key: "SlackCLIAPI",
829
850
  search: "workspace",
830
851
  title: "My Workspace",
831
- accountId: "acc_123",
852
+ account_id: "acc_123",
832
853
  owner: "me",
833
- authenticationIds: "id1,id2",
834
- pageSize: "10",
854
+ connection_ids: "id1,id2",
855
+ page_size: "10",
835
856
  }),
836
857
  }));
837
858
  });
838
859
  it("should handle maxItems less than pageSize", async () => {
839
860
  mockApiClient.get = vi.fn().mockResolvedValue({
840
- data: mockAuthenticationsResponse.data,
861
+ data: mockConnectionsResponse.data,
841
862
  nextCursor: "next-page",
842
863
  });
843
864
  const sdk = createTestSdk();
844
865
  const items = [];
845
866
  for await (const item of sdk
846
- .listAuthentications({ pageSize: 10, maxItems: 1 })
867
+ .listConnections({ pageSize: 10, maxItems: 1 })
847
868
  .items()) {
848
869
  items.push(item);
849
870
  }
@@ -853,8 +874,8 @@ describe("listAuthentications plugin", () => {
853
874
  });
854
875
  it("should handle owner filter with user ID instead of 'me'", async () => {
855
876
  const sdk = createTestSdk();
856
- await sdk.listAuthentications({ owner: "user_12345" });
857
- expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/authentications", expect.objectContaining({
877
+ await sdk.listConnections({ owner: "user_12345" });
878
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v0/connections", expect.objectContaining({
858
879
  searchParams: expect.objectContaining({
859
880
  owner: "user_12345",
860
881
  }),
@@ -862,30 +883,30 @@ describe("listAuthentications plugin", () => {
862
883
  });
863
884
  it("should pass through nextCursor in response", async () => {
864
885
  mockApiClient.get = vi.fn().mockResolvedValue({
865
- data: mockAuthenticationsResponse.data,
886
+ data: mockConnectionsResponse.data,
866
887
  nextCursor: "cursor-for-next-page",
867
888
  });
868
889
  const sdk = createTestSdk();
869
- const result = await sdk.listAuthentications({});
890
+ const result = await sdk.listConnections({});
870
891
  expect(result.nextCursor).toBe("cursor-for-next-page");
871
892
  });
872
893
  it("should handle undefined nextCursor in response", async () => {
873
894
  mockApiClient.get = vi.fn().mockResolvedValue({
874
- data: mockAuthenticationsResponse.data,
895
+ data: mockConnectionsResponse.data,
875
896
  nextCursor: undefined,
876
897
  });
877
898
  const sdk = createTestSdk();
878
- const result = await sdk.listAuthentications({});
899
+ const result = await sdk.listConnections({});
879
900
  expect(result.nextCursor).toBeUndefined();
880
901
  });
881
902
  });
882
903
  describe("concurrent requests", () => {
883
- it("should handle multiple concurrent listAuthentications calls", async () => {
904
+ it("should handle multiple concurrent listConnections calls", async () => {
884
905
  const sdk = createTestSdk();
885
906
  const [result1, result2, result3] = await Promise.all([
886
- sdk.listAuthentications({ search: "first" }),
887
- sdk.listAuthentications({ search: "second" }),
888
- sdk.listAuthentications({ search: "third" }),
907
+ sdk.listConnections({ search: "first" }),
908
+ sdk.listConnections({ search: "second" }),
909
+ sdk.listConnections({ search: "third" }),
889
910
  ]);
890
911
  expect(result1.data).toHaveLength(2);
891
912
  expect(result2.data).toHaveLength(2);