@zapier/zapier-sdk 0.15.8 → 0.15.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2274,8 +2274,7 @@ var GetActionSchema = zod.z.object({
|
|
|
2274
2274
|
var getActionPlugin = ({ sdk }) => {
|
|
2275
2275
|
const getAction = createFunction(async function getAction2(options) {
|
|
2276
2276
|
const { actionKey, actionType, appKey } = options;
|
|
2277
|
-
const
|
|
2278
|
-
for (const action of actionsResult.data) {
|
|
2277
|
+
for await (const action of sdk.listActions({ appKey }).items()) {
|
|
2279
2278
|
if ((action.key === actionKey || action.id === actionKey) && action.action_type === actionType) {
|
|
2280
2279
|
return { data: action };
|
|
2281
2280
|
}
|
|
@@ -4791,7 +4790,7 @@ function getCpuTime() {
|
|
|
4791
4790
|
|
|
4792
4791
|
// package.json
|
|
4793
4792
|
var package_default = {
|
|
4794
|
-
version: "0.15.
|
|
4793
|
+
version: "0.15.9"};
|
|
4795
4794
|
|
|
4796
4795
|
// src/plugins/eventEmission/builders.ts
|
|
4797
4796
|
function createBaseEvent(context = {}) {
|
package/dist/index.mjs
CHANGED
|
@@ -2252,8 +2252,7 @@ var GetActionSchema = z.object({
|
|
|
2252
2252
|
var getActionPlugin = ({ sdk }) => {
|
|
2253
2253
|
const getAction = createFunction(async function getAction2(options) {
|
|
2254
2254
|
const { actionKey, actionType, appKey } = options;
|
|
2255
|
-
const
|
|
2256
|
-
for (const action of actionsResult.data) {
|
|
2255
|
+
for await (const action of sdk.listActions({ appKey }).items()) {
|
|
2257
2256
|
if ((action.key === actionKey || action.id === actionKey) && action.action_type === actionType) {
|
|
2258
2257
|
return { data: action };
|
|
2259
2258
|
}
|
|
@@ -4769,7 +4768,7 @@ function getCpuTime() {
|
|
|
4769
4768
|
|
|
4770
4769
|
// package.json
|
|
4771
4770
|
var package_default = {
|
|
4772
|
-
version: "0.15.
|
|
4771
|
+
version: "0.15.9"};
|
|
4773
4772
|
|
|
4774
4773
|
// src/plugins/eventEmission/builders.ts
|
|
4775
4774
|
function createBaseEvent(context = {}) {
|
|
@@ -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,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAQhE,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;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAAE,0BAA0B;AAC9C,uBAAuB,
|
|
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,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAQhE,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;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAAE,0BAA0B;AAC9C,uBAAuB,CA2CxB,CAAC"}
|
|
@@ -6,10 +6,8 @@ import { ActionItemSchema } from "../../schemas/Action";
|
|
|
6
6
|
export const getActionPlugin = ({ sdk }) => {
|
|
7
7
|
const getAction = createFunction(async function getAction(options) {
|
|
8
8
|
const { actionKey, actionType, appKey } = options;
|
|
9
|
-
// Use the listActions function from the SDK to search for the specific action
|
|
10
|
-
const
|
|
11
|
-
// Search through all actions to find the matching one (by key or ID)
|
|
12
|
-
for (const action of actionsResult.data) {
|
|
9
|
+
// Use the listActions function from the SDK to search for the specific action across all pages
|
|
10
|
+
for await (const action of sdk.listActions({ appKey }).items()) {
|
|
13
11
|
if ((action.key === actionKey || action.id === actionKey) &&
|
|
14
12
|
action.action_type === actionType) {
|
|
15
13
|
return { data: action };
|
|
@@ -34,8 +34,21 @@ describe("getAction plugin", () => {
|
|
|
34
34
|
let mockApiClient;
|
|
35
35
|
beforeEach(() => {
|
|
36
36
|
vi.clearAllMocks();
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
// Mock listActions to return a promise with .items() method
|
|
38
|
+
mockListActions = vi.fn().mockImplementation(() => {
|
|
39
|
+
const promise = Promise.resolve({
|
|
40
|
+
data: mockActions,
|
|
41
|
+
});
|
|
42
|
+
// Add .items() method that returns an async iterable
|
|
43
|
+
return Object.assign(promise, {
|
|
44
|
+
items: () => ({
|
|
45
|
+
async *[Symbol.asyncIterator]() {
|
|
46
|
+
for (const action of mockActions) {
|
|
47
|
+
yield action;
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
39
52
|
});
|
|
40
53
|
mockApiClient = {};
|
|
41
54
|
});
|
|
@@ -166,7 +179,17 @@ describe("getAction plugin", () => {
|
|
|
166
179
|
})).rejects.toThrow(ZapierResourceNotFoundError);
|
|
167
180
|
});
|
|
168
181
|
it("should handle listActions errors", async () => {
|
|
169
|
-
mockListActions.
|
|
182
|
+
mockListActions.mockImplementation(() => {
|
|
183
|
+
const promise = Promise.reject(new Error("API Error"));
|
|
184
|
+
// Add .items() method that also rejects
|
|
185
|
+
return Object.assign(promise, {
|
|
186
|
+
items: () => ({
|
|
187
|
+
async *[Symbol.asyncIterator]() {
|
|
188
|
+
throw new Error("API Error");
|
|
189
|
+
},
|
|
190
|
+
}),
|
|
191
|
+
});
|
|
192
|
+
});
|
|
170
193
|
const sdk = createTestSdk();
|
|
171
194
|
await expect(sdk.getAction({
|
|
172
195
|
appKey: "slack",
|