@zapier/zapier-sdk 0.15.2 → 0.15.3
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 +6 -0
- package/dist/index.cjs +98 -5
- package/dist/index.d.mts +123 -31
- package/dist/index.mjs +98 -5
- package/dist/plugins/fetch/schemas.d.ts +2 -2
- package/dist/plugins/getAction/schemas.d.ts +2 -2
- package/dist/plugins/getInputFieldsSchema/schemas.d.ts +2 -2
- package/dist/plugins/listActions/index.test.js +25 -0
- package/dist/plugins/listActions/schemas.d.ts +2 -2
- package/dist/plugins/listAuthentications/index.test.js +20 -0
- package/dist/plugins/listInputFieldChoices/schemas.d.ts +6 -6
- package/dist/plugins/listInputFields/schemas.d.ts +6 -6
- package/dist/plugins/manifest/index.d.ts +42 -3
- package/dist/plugins/manifest/index.d.ts.map +1 -1
- package/dist/plugins/manifest/index.js +68 -1
- package/dist/plugins/manifest/index.test.js +513 -1
- package/dist/plugins/manifest/schemas.d.ts +75 -2
- package/dist/plugins/manifest/schemas.d.ts.map +1 -1
- package/dist/plugins/manifest/schemas.js +27 -3
- package/dist/plugins/request/schemas.d.ts +4 -4
- package/dist/plugins/runAction/schemas.d.ts +6 -6
- package/dist/sdk.d.ts +23 -1
- package/dist/sdk.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -73,6 +73,31 @@ describe("listActions plugin", () => {
|
|
|
73
73
|
updateManifestEntry: vi
|
|
74
74
|
.fn()
|
|
75
75
|
.mockResolvedValue(["test-key", {}, { apps: {} }]),
|
|
76
|
+
addActionEntry: vi
|
|
77
|
+
.fn()
|
|
78
|
+
.mockResolvedValue(["test-key", {}, { apps: {} }]),
|
|
79
|
+
findActionEntry: vi.fn().mockResolvedValue({
|
|
80
|
+
key: "test-key",
|
|
81
|
+
entry: {},
|
|
82
|
+
manifest: { apps: {} },
|
|
83
|
+
}),
|
|
84
|
+
hasActionEntry: vi.fn().mockResolvedValue(true),
|
|
85
|
+
listActionEntries: vi
|
|
86
|
+
.fn()
|
|
87
|
+
.mockResolvedValue([
|
|
88
|
+
[
|
|
89
|
+
"test-key",
|
|
90
|
+
{ key: "test-key", entry: {}, manifest: { apps: {} } },
|
|
91
|
+
],
|
|
92
|
+
]),
|
|
93
|
+
deleteActionEntry: vi.fn().mockResolvedValue({ apps: {} }),
|
|
94
|
+
findManifestEntry: vi
|
|
95
|
+
.fn()
|
|
96
|
+
.mockResolvedValue([
|
|
97
|
+
"test-key",
|
|
98
|
+
{ key: "test-key", entry: {}, manifest: { apps: {} } },
|
|
99
|
+
]),
|
|
100
|
+
readManifestFromFile: vi.fn().mockResolvedValue({ apps: {} }),
|
|
76
101
|
},
|
|
77
102
|
}))
|
|
78
103
|
.addPlugin(listAppsPlugin)
|
|
@@ -12,16 +12,16 @@ export declare const ListActionsSchema: z.ZodObject<{
|
|
|
12
12
|
cursor: z.ZodOptional<z.ZodString>;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
14
|
appKey: string;
|
|
15
|
+
actionType?: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write" | undefined;
|
|
15
16
|
pageSize?: number | undefined;
|
|
16
17
|
maxItems?: number | undefined;
|
|
17
18
|
cursor?: string | undefined;
|
|
18
|
-
actionType?: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write" | undefined;
|
|
19
19
|
}, {
|
|
20
20
|
appKey: string;
|
|
21
|
+
actionType?: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write" | undefined;
|
|
21
22
|
pageSize?: number | undefined;
|
|
22
23
|
maxItems?: number | undefined;
|
|
23
24
|
cursor?: string | undefined;
|
|
24
|
-
actionType?: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write" | undefined;
|
|
25
25
|
}>;
|
|
26
26
|
export type ListActionsOptions = z.infer<typeof ListActionsSchema>;
|
|
27
27
|
export interface ListActionsPage {
|
|
@@ -61,6 +61,26 @@ describe("listAuthentications plugin", () => {
|
|
|
61
61
|
updateManifestEntry: vi
|
|
62
62
|
.fn()
|
|
63
63
|
.mockResolvedValue(["test-key", {}, { apps: {} }]),
|
|
64
|
+
addActionEntry: vi.fn().mockResolvedValue(["test-key", {}, { apps: {} }]),
|
|
65
|
+
findActionEntry: vi.fn().mockResolvedValue({
|
|
66
|
+
key: "test-key",
|
|
67
|
+
entry: {},
|
|
68
|
+
manifest: { apps: {} },
|
|
69
|
+
}),
|
|
70
|
+
hasActionEntry: vi.fn().mockResolvedValue(true),
|
|
71
|
+
listActionEntries: vi
|
|
72
|
+
.fn()
|
|
73
|
+
.mockResolvedValue([
|
|
74
|
+
["test-key", { key: "test-key", entry: {}, manifest: { apps: {} } }],
|
|
75
|
+
]),
|
|
76
|
+
deleteActionEntry: vi.fn().mockResolvedValue({ apps: {} }),
|
|
77
|
+
findManifestEntry: vi
|
|
78
|
+
.fn()
|
|
79
|
+
.mockResolvedValue([
|
|
80
|
+
"test-key",
|
|
81
|
+
{ key: "test-key", entry: {}, manifest: { apps: {} } },
|
|
82
|
+
]),
|
|
83
|
+
readManifestFromFile: vi.fn().mockResolvedValue({ apps: {} }),
|
|
64
84
|
},
|
|
65
85
|
});
|
|
66
86
|
function createTestSdk() {
|
|
@@ -33,26 +33,26 @@ export declare const ListInputFieldChoicesSchema: z.ZodObject<{
|
|
|
33
33
|
cursor: z.ZodOptional<z.ZodString>;
|
|
34
34
|
}, "strip", z.ZodTypeAny, {
|
|
35
35
|
appKey: string;
|
|
36
|
-
actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
|
|
37
36
|
actionKey: string;
|
|
37
|
+
actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
|
|
38
38
|
inputFieldKey: string;
|
|
39
39
|
page?: number | undefined;
|
|
40
|
+
authenticationId?: number | null | undefined;
|
|
41
|
+
inputs?: Record<string, unknown> | undefined;
|
|
40
42
|
pageSize?: number | undefined;
|
|
41
43
|
maxItems?: number | undefined;
|
|
42
44
|
cursor?: string | undefined;
|
|
43
|
-
authenticationId?: number | null | undefined;
|
|
44
|
-
inputs?: Record<string, unknown> | undefined;
|
|
45
45
|
}, {
|
|
46
46
|
appKey: string;
|
|
47
|
-
actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
|
|
48
47
|
actionKey: string;
|
|
48
|
+
actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
|
|
49
49
|
inputFieldKey: string;
|
|
50
50
|
page?: number | undefined;
|
|
51
|
+
authenticationId?: number | null | undefined;
|
|
52
|
+
inputs?: Record<string, unknown> | undefined;
|
|
51
53
|
pageSize?: number | undefined;
|
|
52
54
|
maxItems?: number | undefined;
|
|
53
55
|
cursor?: string | undefined;
|
|
54
|
-
authenticationId?: number | null | undefined;
|
|
55
|
-
inputs?: Record<string, unknown> | undefined;
|
|
56
56
|
}>;
|
|
57
57
|
export type ListInputFieldChoicesOptions = z.infer<typeof ListInputFieldChoicesSchema>;
|
|
58
58
|
export type ListInputFieldChoicesError = ZapierConfigurationError | ZapierApiError | ZapierAuthenticationError | ZapierAppNotFoundError | ZapierValidationError | ZapierUnknownError;
|
|
@@ -15,22 +15,22 @@ export declare const ListInputFieldsSchema: z.ZodObject<{
|
|
|
15
15
|
cursor: z.ZodOptional<z.ZodString>;
|
|
16
16
|
}, "strip", z.ZodTypeAny, {
|
|
17
17
|
appKey: string;
|
|
18
|
-
actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
|
|
19
18
|
actionKey: string;
|
|
19
|
+
actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
|
|
20
|
+
authenticationId?: number | null | undefined;
|
|
21
|
+
inputs?: Record<string, unknown> | undefined;
|
|
20
22
|
pageSize?: number | undefined;
|
|
21
23
|
maxItems?: number | undefined;
|
|
22
24
|
cursor?: string | undefined;
|
|
23
|
-
authenticationId?: number | null | undefined;
|
|
24
|
-
inputs?: Record<string, unknown> | undefined;
|
|
25
25
|
}, {
|
|
26
26
|
appKey: string;
|
|
27
|
-
actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
|
|
28
27
|
actionKey: string;
|
|
28
|
+
actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
|
|
29
|
+
authenticationId?: number | null | undefined;
|
|
30
|
+
inputs?: Record<string, unknown> | undefined;
|
|
29
31
|
pageSize?: number | undefined;
|
|
30
32
|
maxItems?: number | undefined;
|
|
31
33
|
cursor?: string | undefined;
|
|
32
|
-
authenticationId?: number | null | undefined;
|
|
33
|
-
inputs?: Record<string, unknown> | undefined;
|
|
34
34
|
}>;
|
|
35
35
|
export type ListInputFieldsOptions = z.infer<typeof ListInputFieldsSchema>;
|
|
36
36
|
export type ListInputFieldsError = ZapierConfigurationError | ZapierApiError | ZapierAuthenticationError | ZapierAppNotFoundError | ZapierValidationError | ZapierUnknownError;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GetVersionedImplementationId, Manifest, ManifestEntry, ManifestPluginOptionsSchema, ResolveAppKeys } from "./schemas";
|
|
1
|
+
import type { GetVersionedImplementationId, Manifest, ManifestEntry, ManifestPluginOptionsSchema, ResolveAppKeys, ActionEntry } from "./schemas";
|
|
2
2
|
import type { Plugin } from "../../types/plugin";
|
|
3
3
|
import type { z } from "zod";
|
|
4
4
|
import type { ApiClient } from "../../api";
|
|
@@ -10,11 +10,50 @@ export interface UpdateManifestEntryOptions {
|
|
|
10
10
|
skipWrite?: boolean;
|
|
11
11
|
manifest?: Manifest;
|
|
12
12
|
}
|
|
13
|
+
export interface UpdateManifestEntryResult {
|
|
14
|
+
key: string;
|
|
15
|
+
entry: ManifestEntry;
|
|
16
|
+
manifest: Manifest;
|
|
17
|
+
}
|
|
18
|
+
export interface AddActionEntryOptions {
|
|
19
|
+
name: string;
|
|
20
|
+
entry: ActionEntry;
|
|
21
|
+
configPath?: string;
|
|
22
|
+
skipWrite?: boolean;
|
|
23
|
+
manifest?: Manifest;
|
|
24
|
+
}
|
|
25
|
+
export interface AddActionEntryResult {
|
|
26
|
+
name: string;
|
|
27
|
+
entry: ActionEntry;
|
|
28
|
+
manifest: Manifest;
|
|
29
|
+
}
|
|
13
30
|
export interface ManifestPluginProvides {
|
|
14
31
|
context: {
|
|
15
32
|
getVersionedImplementationId: GetVersionedImplementationId;
|
|
16
33
|
resolveAppKeys: ResolveAppKeys;
|
|
17
|
-
updateManifestEntry: (options: UpdateManifestEntryOptions) => Promise<
|
|
34
|
+
updateManifestEntry: (options: UpdateManifestEntryOptions) => Promise<UpdateManifestEntryResult>;
|
|
35
|
+
addActionEntry: (options: AddActionEntryOptions) => Promise<AddActionEntryResult>;
|
|
36
|
+
findActionEntry: (options: {
|
|
37
|
+
name: string;
|
|
38
|
+
manifest: Manifest;
|
|
39
|
+
}) => ActionEntry | null;
|
|
40
|
+
listActionEntries: (options?: {
|
|
41
|
+
configPath?: string;
|
|
42
|
+
}) => Promise<Array<[string, ActionEntry]>>;
|
|
43
|
+
deleteActionEntry: (options: {
|
|
44
|
+
name: string;
|
|
45
|
+
configPath?: string;
|
|
46
|
+
skipWrite?: boolean;
|
|
47
|
+
}) => Promise<Manifest>;
|
|
48
|
+
hasActionEntry: (options: {
|
|
49
|
+
name: string;
|
|
50
|
+
manifest: Manifest;
|
|
51
|
+
}) => boolean;
|
|
52
|
+
findManifestEntry: (options: {
|
|
53
|
+
appKey: string;
|
|
54
|
+
manifest: Manifest;
|
|
55
|
+
}) => [string, ManifestEntry] | null;
|
|
56
|
+
readManifestFromFile: (filePath: string) => Promise<Manifest | null>;
|
|
18
57
|
};
|
|
19
58
|
}
|
|
20
59
|
/**
|
|
@@ -38,7 +77,7 @@ export declare function findManifestEntry({ appKey, manifest, }: {
|
|
|
38
77
|
manifest: Manifest;
|
|
39
78
|
}): [string, ManifestEntry] | null;
|
|
40
79
|
export { DEFAULT_CONFIG_PATH } from "./schemas";
|
|
41
|
-
export type { ManifestEntry, Manifest } from "./schemas";
|
|
80
|
+
export type { ManifestEntry, Manifest, ActionEntry } from "./schemas";
|
|
42
81
|
export declare const manifestPlugin: Plugin<{}, // no SDK dependencies
|
|
43
82
|
{
|
|
44
83
|
api: ApiClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/manifest/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,4BAA4B,EAC5B,QAAQ,EACR,aAAa,EACb,2BAA2B,EAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/manifest/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -293,7 +293,67 @@ export const manifestPlugin = (params) => {
|
|
|
293
293
|
// Clear the cached manifest so it gets reloaded with the new data
|
|
294
294
|
resolvedManifest = undefined;
|
|
295
295
|
}
|
|
296
|
-
return
|
|
296
|
+
return {
|
|
297
|
+
key: manifestKey,
|
|
298
|
+
entry,
|
|
299
|
+
manifest: updatedManifest,
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
const addActionEntry = async (options) => {
|
|
303
|
+
const { name, entry, configPath = DEFAULT_CONFIG_PATH, skipWrite = false, manifest: inputManifest, } = options;
|
|
304
|
+
// Use provided manifest or read from file
|
|
305
|
+
const manifest = inputManifest ||
|
|
306
|
+
(await readManifestFromFile(configPath)) || { apps: {} };
|
|
307
|
+
// Ensure actions exists
|
|
308
|
+
const actions = manifest.actions || {};
|
|
309
|
+
// Validate uniqueness - if action with this name already exists, throw error
|
|
310
|
+
if (actions[name] && !skipWrite) {
|
|
311
|
+
throw new Error(`Action "${name}" already exists. Please choose a different name or remove the existing action first.`);
|
|
312
|
+
}
|
|
313
|
+
const updatedManifest = {
|
|
314
|
+
...manifest,
|
|
315
|
+
actions: {
|
|
316
|
+
...actions,
|
|
317
|
+
[name]: entry,
|
|
318
|
+
},
|
|
319
|
+
};
|
|
320
|
+
// Conditionally write to file
|
|
321
|
+
if (!skipWrite) {
|
|
322
|
+
await writeManifestToFile(updatedManifest, configPath);
|
|
323
|
+
// Clear the cached manifest so it gets reloaded with the new data
|
|
324
|
+
resolvedManifest = undefined;
|
|
325
|
+
}
|
|
326
|
+
return {
|
|
327
|
+
name,
|
|
328
|
+
entry,
|
|
329
|
+
manifest: updatedManifest,
|
|
330
|
+
};
|
|
331
|
+
};
|
|
332
|
+
const findActionEntry = ({ name, manifest, }) => {
|
|
333
|
+
return manifest.actions?.[name] || null;
|
|
334
|
+
};
|
|
335
|
+
const listActionEntries = async ({ configPath = DEFAULT_CONFIG_PATH, } = {}) => {
|
|
336
|
+
const manifest = (await readManifestFromFile(configPath)) || { apps: {} };
|
|
337
|
+
return Object.entries(manifest.actions || {});
|
|
338
|
+
};
|
|
339
|
+
const deleteActionEntry = async ({ name, configPath = DEFAULT_CONFIG_PATH, skipWrite = false, }) => {
|
|
340
|
+
const manifest = (await readManifestFromFile(configPath)) || { apps: {} };
|
|
341
|
+
if (!manifest.actions?.[name]) {
|
|
342
|
+
throw new Error(`Action "${name}" does not exist.`);
|
|
343
|
+
}
|
|
344
|
+
const { [name]: removed, ...remainingActions } = manifest.actions;
|
|
345
|
+
const updatedManifest = {
|
|
346
|
+
...manifest,
|
|
347
|
+
actions: remainingActions,
|
|
348
|
+
};
|
|
349
|
+
if (!skipWrite) {
|
|
350
|
+
await writeManifestToFile(updatedManifest, configPath);
|
|
351
|
+
resolvedManifest = undefined;
|
|
352
|
+
}
|
|
353
|
+
return updatedManifest;
|
|
354
|
+
};
|
|
355
|
+
const hasActionEntry = ({ name, manifest, }) => {
|
|
356
|
+
return !!manifest.actions?.[name];
|
|
297
357
|
};
|
|
298
358
|
return {
|
|
299
359
|
context: {
|
|
@@ -304,6 +364,13 @@ export const manifestPlugin = (params) => {
|
|
|
304
364
|
manifest: (await getResolvedManifest()) ?? { apps: {} },
|
|
305
365
|
}),
|
|
306
366
|
updateManifestEntry,
|
|
367
|
+
addActionEntry,
|
|
368
|
+
findActionEntry,
|
|
369
|
+
listActionEntries,
|
|
370
|
+
deleteActionEntry,
|
|
371
|
+
hasActionEntry,
|
|
372
|
+
findManifestEntry,
|
|
373
|
+
readManifestFromFile,
|
|
307
374
|
},
|
|
308
375
|
};
|
|
309
376
|
};
|