@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.15.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 6657f05: Defined shape and support for configured actions in the .zapierrc manifest file
8
+
3
9
  ## 0.15.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -2721,6 +2721,17 @@ async function readFile(filePath) {
2721
2721
  throw new Error(`File not found: ${filePath}`);
2722
2722
  }
2723
2723
  var DEFAULT_CONFIG_PATH = ".zapierrc";
2724
+ var ActionEntrySchema = zod.z.object({
2725
+ appKey: zod.z.string().describe("App key (slug or implementation name)"),
2726
+ actionKey: zod.z.string().describe("Action key identifier"),
2727
+ actionType: zod.z.string().describe("Action type (e.g., 'read', 'write', 'search')"),
2728
+ authenticationId: zod.z.number().nullable().optional().describe("Authentication ID used"),
2729
+ inputs: zod.z.record(zod.z.unknown()).optional().describe("Resolved input values"),
2730
+ schema: zod.z.record(zod.z.unknown()).describe(
2731
+ "Complete JSON Schema from getInputFieldsSchema (includes $schema, type, properties, required, etc.)"
2732
+ ),
2733
+ createdAt: zod.z.string().describe("ISO 8601 timestamp when created")
2734
+ });
2724
2735
  var ManifestSchema = zod.z.object({
2725
2736
  apps: zod.z.record(
2726
2737
  zod.z.string(),
@@ -2730,8 +2741,9 @@ var ManifestSchema = zod.z.object({
2730
2741
  ),
2731
2742
  version: zod.z.string().describe("Version string (e.g., '1.21.1')")
2732
2743
  })
2733
- )
2734
- }).describe("Manifest mapping app keys to version information");
2744
+ ),
2745
+ actions: zod.z.record(zod.z.string(), ActionEntrySchema).optional().describe("Saved action configurations with their schemas")
2746
+ }).describe("Manifest for app version locking and action configurations");
2735
2747
  zod.z.object({
2736
2748
  manifestPath: zod.z.string().optional().describe("Path to manifest file"),
2737
2749
  manifest: zod.z.record(
@@ -3002,7 +3014,81 @@ var manifestPlugin = (params) => {
3002
3014
  await writeManifestToFile(updatedManifest, configPath);
3003
3015
  resolvedManifest = void 0;
3004
3016
  }
3005
- return [manifestKey, entry, updatedManifest];
3017
+ return {
3018
+ key: manifestKey,
3019
+ entry,
3020
+ manifest: updatedManifest
3021
+ };
3022
+ };
3023
+ const addActionEntry = async (options2) => {
3024
+ const {
3025
+ name,
3026
+ entry,
3027
+ configPath = DEFAULT_CONFIG_PATH,
3028
+ skipWrite = false,
3029
+ manifest: inputManifest
3030
+ } = options2;
3031
+ const manifest2 = inputManifest || await readManifestFromFile(configPath) || { apps: {} };
3032
+ const actions = manifest2.actions || {};
3033
+ if (actions[name] && !skipWrite) {
3034
+ throw new Error(
3035
+ `Action "${name}" already exists. Please choose a different name or remove the existing action first.`
3036
+ );
3037
+ }
3038
+ const updatedManifest = {
3039
+ ...manifest2,
3040
+ actions: {
3041
+ ...actions,
3042
+ [name]: entry
3043
+ }
3044
+ };
3045
+ if (!skipWrite) {
3046
+ await writeManifestToFile(updatedManifest, configPath);
3047
+ resolvedManifest = void 0;
3048
+ }
3049
+ return {
3050
+ name,
3051
+ entry,
3052
+ manifest: updatedManifest
3053
+ };
3054
+ };
3055
+ const findActionEntry = ({
3056
+ name,
3057
+ manifest: manifest2
3058
+ }) => {
3059
+ return manifest2.actions?.[name] || null;
3060
+ };
3061
+ const listActionEntries = async ({
3062
+ configPath = DEFAULT_CONFIG_PATH
3063
+ } = {}) => {
3064
+ const manifest2 = await readManifestFromFile(configPath) || { };
3065
+ return Object.entries(manifest2.actions || {});
3066
+ };
3067
+ const deleteActionEntry = async ({
3068
+ name,
3069
+ configPath = DEFAULT_CONFIG_PATH,
3070
+ skipWrite = false
3071
+ }) => {
3072
+ const manifest2 = await readManifestFromFile(configPath) || { apps: {} };
3073
+ if (!manifest2.actions?.[name]) {
3074
+ throw new Error(`Action "${name}" does not exist.`);
3075
+ }
3076
+ const { [name]: removed, ...remainingActions } = manifest2.actions;
3077
+ const updatedManifest = {
3078
+ ...manifest2,
3079
+ actions: remainingActions
3080
+ };
3081
+ if (!skipWrite) {
3082
+ await writeManifestToFile(updatedManifest, configPath);
3083
+ resolvedManifest = void 0;
3084
+ }
3085
+ return updatedManifest;
3086
+ };
3087
+ const hasActionEntry = ({
3088
+ name,
3089
+ manifest: manifest2
3090
+ }) => {
3091
+ return !!manifest2.actions?.[name];
3006
3092
  };
3007
3093
  return {
3008
3094
  context: {
@@ -3012,7 +3098,14 @@ var manifestPlugin = (params) => {
3012
3098
  api,
3013
3099
  manifest: await getResolvedManifest() ?? { apps: {} }
3014
3100
  }),
3015
- updateManifestEntry
3101
+ updateManifestEntry,
3102
+ addActionEntry,
3103
+ findActionEntry,
3104
+ listActionEntries,
3105
+ deleteActionEntry,
3106
+ hasActionEntry,
3107
+ findManifestEntry,
3108
+ readManifestFromFile
3016
3109
  }
3017
3110
  };
3018
3111
  };
@@ -4502,7 +4595,7 @@ function getCpuTime() {
4502
4595
 
4503
4596
  // package.json
4504
4597
  var package_default = {
4505
- version: "0.15.2"};
4598
+ version: "0.15.3"};
4506
4599
 
4507
4600
  // src/plugins/eventEmission/builders.ts
4508
4601
  function createBaseEvent(context = {}) {
package/dist/index.d.mts CHANGED
@@ -1307,8 +1307,39 @@ type ManifestEntry = {
1307
1307
  version?: string;
1308
1308
  };
1309
1309
  type GetVersionedImplementationId = (appKey: string) => Promise<string | null>;
1310
+ /**
1311
+ * Action entry for storing saved action configurations
1312
+ * The key in the actions record IS the user-provided name
1313
+ */
1314
+ declare const ActionEntrySchema: z.ZodObject<{
1315
+ appKey: z.ZodString;
1316
+ actionKey: z.ZodString;
1317
+ actionType: z.ZodString;
1318
+ authenticationId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1319
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1320
+ schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1321
+ createdAt: z.ZodString;
1322
+ }, "strip", z.ZodTypeAny, {
1323
+ schema: Record<string, unknown>;
1324
+ appKey: string;
1325
+ actionKey: string;
1326
+ actionType: string;
1327
+ createdAt: string;
1328
+ authenticationId?: number | null | undefined;
1329
+ inputs?: Record<string, unknown> | undefined;
1330
+ }, {
1331
+ schema: Record<string, unknown>;
1332
+ appKey: string;
1333
+ actionKey: string;
1334
+ actionType: string;
1335
+ createdAt: string;
1336
+ authenticationId?: number | null | undefined;
1337
+ inputs?: Record<string, unknown> | undefined;
1338
+ }>;
1339
+ type ActionEntry = z.infer<typeof ActionEntrySchema>;
1310
1340
  type Manifest = {
1311
1341
  apps: Record<string, ManifestEntry>;
1342
+ actions?: Record<string, ActionEntry>;
1312
1343
  };
1313
1344
  type ResolveAppKeys = ({ appKeys, }: {
1314
1345
  appKeys: string[];
@@ -1347,11 +1378,50 @@ interface UpdateManifestEntryOptions {
1347
1378
  skipWrite?: boolean;
1348
1379
  manifest?: Manifest;
1349
1380
  }
1381
+ interface UpdateManifestEntryResult {
1382
+ key: string;
1383
+ entry: ManifestEntry;
1384
+ manifest: Manifest;
1385
+ }
1386
+ interface AddActionEntryOptions {
1387
+ name: string;
1388
+ entry: ActionEntry;
1389
+ configPath?: string;
1390
+ skipWrite?: boolean;
1391
+ manifest?: Manifest;
1392
+ }
1393
+ interface AddActionEntryResult {
1394
+ name: string;
1395
+ entry: ActionEntry;
1396
+ manifest: Manifest;
1397
+ }
1350
1398
  interface ManifestPluginProvides {
1351
1399
  context: {
1352
1400
  getVersionedImplementationId: GetVersionedImplementationId;
1353
1401
  resolveAppKeys: ResolveAppKeys;
1354
- updateManifestEntry: (options: UpdateManifestEntryOptions) => Promise<[string, ManifestEntry, Manifest]>;
1402
+ updateManifestEntry: (options: UpdateManifestEntryOptions) => Promise<UpdateManifestEntryResult>;
1403
+ addActionEntry: (options: AddActionEntryOptions) => Promise<AddActionEntryResult>;
1404
+ findActionEntry: (options: {
1405
+ name: string;
1406
+ manifest: Manifest;
1407
+ }) => ActionEntry | null;
1408
+ listActionEntries: (options?: {
1409
+ configPath?: string;
1410
+ }) => Promise<Array<[string, ActionEntry]>>;
1411
+ deleteActionEntry: (options: {
1412
+ name: string;
1413
+ configPath?: string;
1414
+ skipWrite?: boolean;
1415
+ }) => Promise<Manifest>;
1416
+ hasActionEntry: (options: {
1417
+ name: string;
1418
+ manifest: Manifest;
1419
+ }) => boolean;
1420
+ findManifestEntry: (options: {
1421
+ appKey: string;
1422
+ manifest: Manifest;
1423
+ }) => [string, ManifestEntry] | null;
1424
+ readManifestFromFile: (filePath: string) => Promise<Manifest | null>;
1355
1425
  };
1356
1426
  }
1357
1427
  /**
@@ -1562,22 +1632,22 @@ declare const ListInputFieldsSchema: z.ZodObject<{
1562
1632
  cursor: z.ZodOptional<z.ZodString>;
1563
1633
  }, "strip", z.ZodTypeAny, {
1564
1634
  appKey: string;
1565
- actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
1566
1635
  actionKey: string;
1636
+ actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
1637
+ authenticationId?: number | null | undefined;
1638
+ inputs?: Record<string, unknown> | undefined;
1567
1639
  pageSize?: number | undefined;
1568
1640
  maxItems?: number | undefined;
1569
1641
  cursor?: string | undefined;
1570
- authenticationId?: number | null | undefined;
1571
- inputs?: Record<string, unknown> | undefined;
1572
1642
  }, {
1573
1643
  appKey: string;
1574
- actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
1575
1644
  actionKey: string;
1645
+ actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
1646
+ authenticationId?: number | null | undefined;
1647
+ inputs?: Record<string, unknown> | undefined;
1576
1648
  pageSize?: number | undefined;
1577
1649
  maxItems?: number | undefined;
1578
1650
  cursor?: string | undefined;
1579
- authenticationId?: number | null | undefined;
1580
- inputs?: Record<string, unknown> | undefined;
1581
1651
  }>;
1582
1652
  type ListInputFieldsOptions = z.infer<typeof ListInputFieldsSchema>;
1583
1653
 
@@ -1649,18 +1719,18 @@ declare const RelayRequestSchema: z.ZodObject<{
1649
1719
  }, "strip", z.ZodTypeAny, {
1650
1720
  url: string;
1651
1721
  method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
1722
+ authenticationId?: number | undefined;
1652
1723
  headers?: Record<string, string> | [string, string][] | Headers | undefined;
1653
1724
  body?: any;
1654
- authenticationId?: number | undefined;
1655
1725
  callbackUrl?: string | undefined;
1656
1726
  authenticationTemplate?: string | undefined;
1657
1727
  relayBaseUrl?: string | undefined;
1658
1728
  }, {
1659
1729
  url: string;
1660
1730
  method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
1731
+ authenticationId?: number | undefined;
1661
1732
  headers?: Record<string, string> | [string, string][] | Headers | undefined;
1662
1733
  body?: any;
1663
- authenticationId?: number | undefined;
1664
1734
  callbackUrl?: string | undefined;
1665
1735
  authenticationTemplate?: string | undefined;
1666
1736
  relayBaseUrl?: string | undefined;
@@ -1679,18 +1749,18 @@ declare const RelayFetchSchema: z.ZodObject<{
1679
1749
  }, "strip", z.ZodTypeAny, {
1680
1750
  url: string;
1681
1751
  method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
1752
+ authenticationId?: number | undefined;
1682
1753
  headers?: Record<string, string> | [string, string][] | Headers | undefined;
1683
1754
  body?: any;
1684
- authenticationId?: number | undefined;
1685
1755
  callbackUrl?: string | undefined;
1686
1756
  authenticationTemplate?: string | undefined;
1687
1757
  relayBaseUrl?: string | undefined;
1688
1758
  }, {
1689
1759
  url: string;
1690
1760
  method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
1761
+ authenticationId?: number | undefined;
1691
1762
  headers?: Record<string, string> | [string, string][] | Headers | undefined;
1692
1763
  body?: any;
1693
- authenticationId?: number | undefined;
1694
1764
  callbackUrl?: string | undefined;
1695
1765
  authenticationTemplate?: string | undefined;
1696
1766
  relayBaseUrl?: string | undefined;
@@ -1853,22 +1923,22 @@ declare const RunActionSchema: z.ZodObject<{
1853
1923
  cursor: z.ZodOptional<z.ZodString>;
1854
1924
  }, "strip", z.ZodTypeAny, {
1855
1925
  appKey: string;
1856
- actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
1857
1926
  actionKey: string;
1927
+ actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
1928
+ authenticationId?: number | null | undefined;
1929
+ inputs?: Record<string, unknown> | undefined;
1858
1930
  pageSize?: number | undefined;
1859
1931
  maxItems?: number | undefined;
1860
1932
  cursor?: string | undefined;
1861
- authenticationId?: number | null | undefined;
1862
- inputs?: Record<string, unknown> | undefined;
1863
1933
  }, {
1864
1934
  appKey: string;
1865
- actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
1866
1935
  actionKey: string;
1936
+ actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
1937
+ authenticationId?: number | null | undefined;
1938
+ inputs?: Record<string, unknown> | undefined;
1867
1939
  pageSize?: number | undefined;
1868
1940
  maxItems?: number | undefined;
1869
1941
  cursor?: string | undefined;
1870
- authenticationId?: number | null | undefined;
1871
- inputs?: Record<string, unknown> | undefined;
1872
1942
  }>;
1873
1943
  type RunActionOptions = z.infer<typeof RunActionSchema>;
1874
1944
 
@@ -1880,12 +1950,12 @@ declare const GetActionSchema: z.ZodObject<{
1880
1950
  actionKey: z.ZodString;
1881
1951
  }, "strip", z.ZodTypeAny, {
1882
1952
  appKey: string;
1883
- actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
1884
1953
  actionKey: string;
1954
+ actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
1885
1955
  }, {
1886
1956
  appKey: string;
1887
- actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
1888
1957
  actionKey: string;
1958
+ actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
1889
1959
  }>;
1890
1960
  type GetActionOptions = z.infer<typeof GetActionSchema>;
1891
1961
 
@@ -1899,16 +1969,16 @@ declare const ListActionsSchema: z.ZodObject<{
1899
1969
  cursor: z.ZodOptional<z.ZodString>;
1900
1970
  }, "strip", z.ZodTypeAny, {
1901
1971
  appKey: string;
1972
+ actionType?: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write" | undefined;
1902
1973
  pageSize?: number | undefined;
1903
1974
  maxItems?: number | undefined;
1904
1975
  cursor?: string | undefined;
1905
- actionType?: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write" | undefined;
1906
1976
  }, {
1907
1977
  appKey: string;
1978
+ actionType?: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write" | undefined;
1908
1979
  pageSize?: number | undefined;
1909
1980
  maxItems?: number | undefined;
1910
1981
  cursor?: string | undefined;
1911
- actionType?: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write" | undefined;
1912
1982
  }>;
1913
1983
  type ListActionsOptions = z.infer<typeof ListActionsSchema>;
1914
1984
 
@@ -2409,14 +2479,14 @@ declare const GetInputFieldsSchemaSchema: z.ZodObject<{
2409
2479
  inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2410
2480
  }, "strip", z.ZodTypeAny, {
2411
2481
  appKey: string;
2412
- actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
2413
2482
  actionKey: string;
2483
+ actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
2414
2484
  authenticationId?: number | null | undefined;
2415
2485
  inputs?: Record<string, unknown> | undefined;
2416
2486
  }, {
2417
2487
  appKey: string;
2418
- actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
2419
2488
  actionKey: string;
2489
+ actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
2420
2490
  authenticationId?: number | null | undefined;
2421
2491
  inputs?: Record<string, unknown> | undefined;
2422
2492
  }>;
@@ -2467,26 +2537,26 @@ declare const ListInputFieldChoicesSchema: z.ZodObject<{
2467
2537
  cursor: z.ZodOptional<z.ZodString>;
2468
2538
  }, "strip", z.ZodTypeAny, {
2469
2539
  appKey: string;
2470
- actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
2471
2540
  actionKey: string;
2541
+ actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
2472
2542
  inputFieldKey: string;
2473
2543
  page?: number | undefined;
2544
+ authenticationId?: number | null | undefined;
2545
+ inputs?: Record<string, unknown> | undefined;
2474
2546
  pageSize?: number | undefined;
2475
2547
  maxItems?: number | undefined;
2476
2548
  cursor?: string | undefined;
2477
- authenticationId?: number | null | undefined;
2478
- inputs?: Record<string, unknown> | undefined;
2479
2549
  }, {
2480
2550
  appKey: string;
2481
- actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
2482
2551
  actionKey: string;
2552
+ actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
2483
2553
  inputFieldKey: string;
2484
2554
  page?: number | undefined;
2555
+ authenticationId?: number | null | undefined;
2556
+ inputs?: Record<string, unknown> | undefined;
2485
2557
  pageSize?: number | undefined;
2486
2558
  maxItems?: number | undefined;
2487
2559
  cursor?: string | undefined;
2488
- authenticationId?: number | null | undefined;
2489
- inputs?: Record<string, unknown> | undefined;
2490
2560
  }>;
2491
2561
  type ListInputFieldChoicesOptions = z.infer<typeof ListInputFieldChoicesSchema>;
2492
2562
 
@@ -3575,7 +3645,29 @@ declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk
3575
3645
  } & {
3576
3646
  getVersionedImplementationId: GetVersionedImplementationId;
3577
3647
  resolveAppKeys: ResolveAppKeys;
3578
- updateManifestEntry: (options: UpdateManifestEntryOptions) => Promise<[string, ManifestEntry, Manifest]>;
3648
+ updateManifestEntry: (options: UpdateManifestEntryOptions) => Promise<UpdateManifestEntryResult>;
3649
+ addActionEntry: (options: AddActionEntryOptions) => Promise<AddActionEntryResult>;
3650
+ findActionEntry: (options: {
3651
+ name: string;
3652
+ manifest: Manifest;
3653
+ }) => ActionEntry | null;
3654
+ listActionEntries: (options?: {
3655
+ configPath?: string;
3656
+ }) => Promise<Array<[string, ActionEntry]>>;
3657
+ deleteActionEntry: (options: {
3658
+ name: string;
3659
+ configPath?: string;
3660
+ skipWrite?: boolean;
3661
+ }) => Promise<Manifest>;
3662
+ hasActionEntry: (options: {
3663
+ name: string;
3664
+ manifest: Manifest;
3665
+ }) => boolean;
3666
+ findManifestEntry: (options: {
3667
+ appKey: string;
3668
+ manifest: Manifest;
3669
+ }) => [string, ManifestEntry] | null;
3670
+ readManifestFromFile: (filePath: string) => Promise<Manifest | null>;
3579
3671
  } & {
3580
3672
  meta: {
3581
3673
  listApps: {
@@ -3675,4 +3767,4 @@ declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk
3675
3767
  }>;
3676
3768
  declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
3677
3769
 
3678
- export { type Action, type ActionExecutionOptions, type ActionExecutionResult, type ActionField, type ActionFieldChoice, type ActionItem$1 as ActionItem, type ActionKeyProperty, ActionKeyPropertySchema, type ActionTypeProperty, ActionTypePropertySchema, type ApiError, type ApiEvent, type ApiPluginOptions, type ApiPluginProvides, type App, type AppItem, type AppKeyProperty, AppKeyPropertySchema, type ApplicationLifecycleEventData, type AppsPluginProvides, type AuthEvent, type AuthOptions, type Authentication, type AuthenticationIdProperty, AuthenticationIdPropertySchema, type AuthenticationItem, type AuthenticationsResponse, type BaseEvent, type BatchOptions, type Choice, DEFAULT_CONFIG_PATH, type DebugProperty, DebugPropertySchema, type EnhancedErrorEventData, type ErrorOptions, type EventCallback, type EventContext, type EventEmissionContext, type FetchPluginProvides, type Field, type FieldsetItem, type FindFirstAuthenticationPluginProvides, type FindUniqueAuthenticationPluginProvides, type FormatMetadata, type FormattedItem, type FunctionOptions, type FunctionRegistryEntry, type GetActionPluginProvides, type GetAppPluginProvides, type GetAuthenticationPluginProvides, type GetContextType, type GetProfilePluginProvides, type GetSdkType, type InfoFieldItem, type InputFieldItem, type InputsProperty, InputsPropertySchema, type LimitProperty, LimitPropertySchema, type ListActionsPluginProvides, type ListAppsPluginProvides, type ListAuthenticationsPluginProvides, type ListInputFieldsPluginProvides, type LoadingEvent, MAX_PAGE_LIMIT, type Manifest, type ManifestEntry, type ManifestPluginOptions, type ManifestPluginProvides, type Need, type NeedsRequest, type NeedsResponse, type OffsetProperty, OffsetPropertySchema, type OutputProperty, OutputPropertySchema, type PaginatedSdkFunction, type ParamsProperty, ParamsPropertySchema, type Plugin, type PluginDependencies, type PluginOptions, type PluginProvides, type PositionalMetadata, RelayFetchSchema, RelayRequestSchema, type RequestPluginProvides, type RootFieldItem, type RunActionPluginProvides, type Sdk, type SdkEvent, type UpdateManifestEntryOptions, type UserProfile, type UserProfileItem, ZAPIER_BASE_URL, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, type ZapierFetchInitOptions, ZapierNotFoundError, ZapierResourceNotFoundError, type ZapierSdk, type ZapierSdkApps, type ZapierSdkOptions, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, authenticationIdGenericResolver, authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildErrorEvent, buildErrorEventWithContext, createBaseEvent, createFunction, createSdk, createZapierSdk, createZapierSdkWithoutRegistry, fetchPlugin, findFirstAuthenticationPlugin, findManifestEntry, findUniqueAuthenticationPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getAuthenticationPlugin, getCiPlatform, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTokenFromCliLogin, getTokenFromEnv, getTokenFromEnvOrConfig, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, isCi, isPositional, listActionsPlugin, listAppsPlugin, listAuthenticationsPlugin, listInputFieldsPlugin, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, runActionPlugin, toSnakeCase, toTitleCase };
3770
+ export { type Action, type ActionEntry, type ActionExecutionOptions, type ActionExecutionResult, type ActionField, type ActionFieldChoice, type ActionItem$1 as ActionItem, type ActionKeyProperty, ActionKeyPropertySchema, type ActionTypeProperty, ActionTypePropertySchema, type AddActionEntryOptions, type AddActionEntryResult, type ApiError, type ApiEvent, type ApiPluginOptions, type ApiPluginProvides, type App, type AppItem, type AppKeyProperty, AppKeyPropertySchema, type ApplicationLifecycleEventData, type AppsPluginProvides, type AuthEvent, type AuthOptions, type Authentication, type AuthenticationIdProperty, AuthenticationIdPropertySchema, type AuthenticationItem, type AuthenticationsResponse, type BaseEvent, type BatchOptions, type Choice, DEFAULT_CONFIG_PATH, type DebugProperty, DebugPropertySchema, type EnhancedErrorEventData, type ErrorOptions, type EventCallback, type EventContext, type EventEmissionContext, type FetchPluginProvides, type Field, type FieldsetItem, type FindFirstAuthenticationPluginProvides, type FindUniqueAuthenticationPluginProvides, type FormatMetadata, type FormattedItem, type FunctionOptions, type FunctionRegistryEntry, type GetActionPluginProvides, type GetAppPluginProvides, type GetAuthenticationPluginProvides, type GetContextType, type GetProfilePluginProvides, type GetSdkType, type InfoFieldItem, type InputFieldItem, type InputsProperty, InputsPropertySchema, type LimitProperty, LimitPropertySchema, type ListActionsPluginProvides, type ListAppsPluginProvides, type ListAuthenticationsPluginProvides, type ListInputFieldsPluginProvides, type LoadingEvent, MAX_PAGE_LIMIT, type Manifest, type ManifestEntry, type ManifestPluginOptions, type ManifestPluginProvides, type Need, type NeedsRequest, type NeedsResponse, type OffsetProperty, OffsetPropertySchema, type OutputProperty, OutputPropertySchema, type PaginatedSdkFunction, type ParamsProperty, ParamsPropertySchema, type Plugin, type PluginDependencies, type PluginOptions, type PluginProvides, type PositionalMetadata, RelayFetchSchema, RelayRequestSchema, type RequestPluginProvides, type RootFieldItem, type RunActionPluginProvides, type Sdk, type SdkEvent, type UpdateManifestEntryOptions, type UpdateManifestEntryResult, type UserProfile, type UserProfileItem, ZAPIER_BASE_URL, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, type ZapierFetchInitOptions, ZapierNotFoundError, ZapierResourceNotFoundError, type ZapierSdk, type ZapierSdkApps, type ZapierSdkOptions, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, authenticationIdGenericResolver, authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildErrorEvent, buildErrorEventWithContext, createBaseEvent, createFunction, createSdk, createZapierSdk, createZapierSdkWithoutRegistry, fetchPlugin, findFirstAuthenticationPlugin, findManifestEntry, findUniqueAuthenticationPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getAuthenticationPlugin, getCiPlatform, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTokenFromCliLogin, getTokenFromEnv, getTokenFromEnvOrConfig, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, isCi, isPositional, listActionsPlugin, listAppsPlugin, listAuthenticationsPlugin, listInputFieldsPlugin, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, runActionPlugin, toSnakeCase, toTitleCase };
package/dist/index.mjs CHANGED
@@ -2699,6 +2699,17 @@ async function readFile(filePath) {
2699
2699
  throw new Error(`File not found: ${filePath}`);
2700
2700
  }
2701
2701
  var DEFAULT_CONFIG_PATH = ".zapierrc";
2702
+ var ActionEntrySchema = z.object({
2703
+ appKey: z.string().describe("App key (slug or implementation name)"),
2704
+ actionKey: z.string().describe("Action key identifier"),
2705
+ actionType: z.string().describe("Action type (e.g., 'read', 'write', 'search')"),
2706
+ authenticationId: z.number().nullable().optional().describe("Authentication ID used"),
2707
+ inputs: z.record(z.unknown()).optional().describe("Resolved input values"),
2708
+ schema: z.record(z.unknown()).describe(
2709
+ "Complete JSON Schema from getInputFieldsSchema (includes $schema, type, properties, required, etc.)"
2710
+ ),
2711
+ createdAt: z.string().describe("ISO 8601 timestamp when created")
2712
+ });
2702
2713
  var ManifestSchema = z.object({
2703
2714
  apps: z.record(
2704
2715
  z.string(),
@@ -2708,8 +2719,9 @@ var ManifestSchema = z.object({
2708
2719
  ),
2709
2720
  version: z.string().describe("Version string (e.g., '1.21.1')")
2710
2721
  })
2711
- )
2712
- }).describe("Manifest mapping app keys to version information");
2722
+ ),
2723
+ actions: z.record(z.string(), ActionEntrySchema).optional().describe("Saved action configurations with their schemas")
2724
+ }).describe("Manifest for app version locking and action configurations");
2713
2725
  z.object({
2714
2726
  manifestPath: z.string().optional().describe("Path to manifest file"),
2715
2727
  manifest: z.record(
@@ -2980,7 +2992,81 @@ var manifestPlugin = (params) => {
2980
2992
  await writeManifestToFile(updatedManifest, configPath);
2981
2993
  resolvedManifest = void 0;
2982
2994
  }
2983
- return [manifestKey, entry, updatedManifest];
2995
+ return {
2996
+ key: manifestKey,
2997
+ entry,
2998
+ manifest: updatedManifest
2999
+ };
3000
+ };
3001
+ const addActionEntry = async (options2) => {
3002
+ const {
3003
+ name,
3004
+ entry,
3005
+ configPath = DEFAULT_CONFIG_PATH,
3006
+ skipWrite = false,
3007
+ manifest: inputManifest
3008
+ } = options2;
3009
+ const manifest2 = inputManifest || await readManifestFromFile(configPath) || { apps: {} };
3010
+ const actions = manifest2.actions || {};
3011
+ if (actions[name] && !skipWrite) {
3012
+ throw new Error(
3013
+ `Action "${name}" already exists. Please choose a different name or remove the existing action first.`
3014
+ );
3015
+ }
3016
+ const updatedManifest = {
3017
+ ...manifest2,
3018
+ actions: {
3019
+ ...actions,
3020
+ [name]: entry
3021
+ }
3022
+ };
3023
+ if (!skipWrite) {
3024
+ await writeManifestToFile(updatedManifest, configPath);
3025
+ resolvedManifest = void 0;
3026
+ }
3027
+ return {
3028
+ name,
3029
+ entry,
3030
+ manifest: updatedManifest
3031
+ };
3032
+ };
3033
+ const findActionEntry = ({
3034
+ name,
3035
+ manifest: manifest2
3036
+ }) => {
3037
+ return manifest2.actions?.[name] || null;
3038
+ };
3039
+ const listActionEntries = async ({
3040
+ configPath = DEFAULT_CONFIG_PATH
3041
+ } = {}) => {
3042
+ const manifest2 = await readManifestFromFile(configPath) || { };
3043
+ return Object.entries(manifest2.actions || {});
3044
+ };
3045
+ const deleteActionEntry = async ({
3046
+ name,
3047
+ configPath = DEFAULT_CONFIG_PATH,
3048
+ skipWrite = false
3049
+ }) => {
3050
+ const manifest2 = await readManifestFromFile(configPath) || { apps: {} };
3051
+ if (!manifest2.actions?.[name]) {
3052
+ throw new Error(`Action "${name}" does not exist.`);
3053
+ }
3054
+ const { [name]: removed, ...remainingActions } = manifest2.actions;
3055
+ const updatedManifest = {
3056
+ ...manifest2,
3057
+ actions: remainingActions
3058
+ };
3059
+ if (!skipWrite) {
3060
+ await writeManifestToFile(updatedManifest, configPath);
3061
+ resolvedManifest = void 0;
3062
+ }
3063
+ return updatedManifest;
3064
+ };
3065
+ const hasActionEntry = ({
3066
+ name,
3067
+ manifest: manifest2
3068
+ }) => {
3069
+ return !!manifest2.actions?.[name];
2984
3070
  };
2985
3071
  return {
2986
3072
  context: {
@@ -2990,7 +3076,14 @@ var manifestPlugin = (params) => {
2990
3076
  api,
2991
3077
  manifest: await getResolvedManifest() ?? { apps: {} }
2992
3078
  }),
2993
- updateManifestEntry
3079
+ updateManifestEntry,
3080
+ addActionEntry,
3081
+ findActionEntry,
3082
+ listActionEntries,
3083
+ deleteActionEntry,
3084
+ hasActionEntry,
3085
+ findManifestEntry,
3086
+ readManifestFromFile
2994
3087
  }
2995
3088
  };
2996
3089
  };
@@ -4480,7 +4573,7 @@ function getCpuTime() {
4480
4573
 
4481
4574
  // package.json
4482
4575
  var package_default = {
4483
- version: "0.15.2"};
4576
+ version: "0.15.3"};
4484
4577
 
4485
4578
  // src/plugins/eventEmission/builders.ts
4486
4579
  function createBaseEvent(context = {}) {
@@ -9,16 +9,16 @@ export declare const FetchInitSchema: z.ZodOptional<z.ZodObject<{
9
9
  authenticationTemplate: z.ZodOptional<z.ZodString>;
10
10
  }, "strip", z.ZodTypeAny, {
11
11
  method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
12
+ authenticationId?: number | undefined;
12
13
  headers?: Record<string, string> | undefined;
13
14
  body?: string | FormData | URLSearchParams | undefined;
14
- authenticationId?: number | undefined;
15
15
  callbackUrl?: string | undefined;
16
16
  authenticationTemplate?: string | undefined;
17
17
  }, {
18
18
  method?: "POST" | "GET" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
19
+ authenticationId?: number | undefined;
19
20
  headers?: Record<string, string> | undefined;
20
21
  body?: string | FormData | URLSearchParams | undefined;
21
- authenticationId?: number | undefined;
22
22
  callbackUrl?: string | undefined;
23
23
  authenticationTemplate?: string | undefined;
24
24
  }>>;
@@ -9,12 +9,12 @@ export declare const GetActionSchema: z.ZodObject<{
9
9
  actionKey: z.ZodString;
10
10
  }, "strip", z.ZodTypeAny, {
11
11
  appKey: string;
12
- actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
13
12
  actionKey: string;
13
+ actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
14
14
  }, {
15
15
  appKey: string;
16
- actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
17
16
  actionKey: string;
17
+ actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
18
18
  }>;
19
19
  export type GetActionOptions = z.infer<typeof GetActionSchema>;
20
20
  export type GetActionError = ZapierAuthenticationError | ZapierApiError | ZapierAppNotFoundError | ZapierValidationError | ZapierResourceNotFoundError | ZapierUnknownError;
@@ -10,14 +10,14 @@ export declare const GetInputFieldsSchemaSchema: z.ZodObject<{
10
10
  inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
11
11
  }, "strip", z.ZodTypeAny, {
12
12
  appKey: string;
13
- actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
14
13
  actionKey: string;
14
+ actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
15
15
  authenticationId?: number | null | undefined;
16
16
  inputs?: Record<string, unknown> | undefined;
17
17
  }, {
18
18
  appKey: string;
19
- actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
20
19
  actionKey: string;
20
+ actionType: "search" | "filter" | "read" | "read_bulk" | "run" | "search_and_write" | "search_or_write" | "write";
21
21
  authenticationId?: number | null | undefined;
22
22
  inputs?: Record<string, unknown> | undefined;
23
23
  }>;