@zapier/zapier-sdk 0.15.8 → 0.15.10
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 +12 -0
- package/dist/index.cjs +2 -4
- package/dist/index.mjs +2 -4
- package/dist/plugins/eventEmission/builders.d.ts.map +1 -1
- package/dist/plugins/eventEmission/builders.js +0 -1
- package/dist/plugins/getAction/index.d.ts.map +1 -1
- package/dist/plugins/getAction/index.js +2 -4
- package/dist/plugins/getAction/index.test.js +26 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @zapier/zapier-sdk
|
|
2
2
|
|
|
3
|
+
## 0.15.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2f1fc5c: Remove inaccurate `peak_memory_usage_bytes` values from telemetry events
|
|
8
|
+
|
|
9
|
+
## 0.15.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 450b009: Fix getAction to search across all paginated results
|
|
14
|
+
|
|
3
15
|
## 0.15.8
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
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.10"};
|
|
4795
4794
|
|
|
4796
4795
|
// src/plugins/eventEmission/builders.ts
|
|
4797
4796
|
function createBaseEvent(context = {}) {
|
|
@@ -4830,7 +4829,6 @@ function buildApplicationLifecycleEvent(data, context = {}) {
|
|
|
4830
4829
|
sdk_version: package_default.version,
|
|
4831
4830
|
cli_version: null,
|
|
4832
4831
|
memory_usage_bytes: data.memory_usage_bytes ?? getMemoryUsage(),
|
|
4833
|
-
peak_memory_usage_bytes: data.peak_memory_usage_bytes ?? getMemoryUsage(),
|
|
4834
4832
|
cpu_time_ms: data.cpu_time_ms ?? getCpuTime(),
|
|
4835
4833
|
os_platform: osInfo.platform,
|
|
4836
4834
|
os_release: osInfo.release,
|
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.10"};
|
|
4773
4772
|
|
|
4774
4773
|
// src/plugins/eventEmission/builders.ts
|
|
4775
4774
|
function createBaseEvent(context = {}) {
|
|
@@ -4808,7 +4807,6 @@ function buildApplicationLifecycleEvent(data, context = {}) {
|
|
|
4808
4807
|
sdk_version: package_default.version,
|
|
4809
4808
|
cli_version: null,
|
|
4810
4809
|
memory_usage_bytes: data.memory_usage_bytes ?? getMemoryUsage(),
|
|
4811
|
-
peak_memory_usage_bytes: data.peak_memory_usage_bytes ?? getMemoryUsage(),
|
|
4812
4810
|
cpu_time_ms: data.cpu_time_ms ?? getCpuTime(),
|
|
4813
4811
|
os_platform: osInfo.platform,
|
|
4814
4812
|
os_release: osInfo.release,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../../src/plugins/eventEmission/builders.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,SAAS,EACV,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,6BAA6B,EAC7B,sBAAsB,EACtB,cAAc,EACd,YAAY,EACb,MAAM,SAAS,CAAC;AAgBjB,wBAAgB,eAAe,CAAC,OAAO,GAAE,YAAiB,GAAG,SAAS,CAWrE;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE,YAAiB,GACzB,kBAAkB,CAYpB;AAED,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,6BAA6B,EACnC,OAAO,GAAE,YAAiB,GACzB,yBAAyB,
|
|
1
|
+
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../../src/plugins/eventEmission/builders.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,SAAS,EACV,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,6BAA6B,EAC7B,sBAAsB,EACtB,cAAc,EACd,YAAY,EACb,MAAM,SAAS,CAAC;AAgBjB,wBAAgB,eAAe,CAAC,OAAO,GAAE,YAAiB,GAAG,SAAS,CAWrE;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE,YAAiB,GACzB,kBAAkB,CAYpB;AAED,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,6BAA6B,EACnC,OAAO,GAAE,YAAiB,GACzB,yBAAyB,CAyB3B;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,sBAAsB,EAC5B,OAAO,GAAE,YAAiB,GACzB,kBAAkB,CAiBpB"}
|
|
@@ -44,7 +44,6 @@ export function buildApplicationLifecycleEvent(data, context = {}) {
|
|
|
44
44
|
sdk_version: sdkPackageJson.version,
|
|
45
45
|
cli_version: null,
|
|
46
46
|
memory_usage_bytes: data.memory_usage_bytes ?? getMemoryUsage(),
|
|
47
|
-
peak_memory_usage_bytes: data.peak_memory_usage_bytes ?? getMemoryUsage(),
|
|
48
47
|
cpu_time_ms: data.cpu_time_ms ?? getCpuTime(),
|
|
49
48
|
os_platform: osInfo.platform,
|
|
50
49
|
os_release: osInfo.release,
|
|
@@ -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",
|