@zapier/zapier-sdk 0.8.3 → 0.9.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 (90) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +10 -33
  3. package/dist/index.cjs +346 -219
  4. package/dist/index.d.mts +181 -185
  5. package/dist/index.d.ts +1 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +0 -1
  8. package/dist/index.mjs +343 -218
  9. package/dist/plugins/apps/index.d.ts +4 -0
  10. package/dist/plugins/apps/index.d.ts.map +1 -1
  11. package/dist/plugins/getApp/index.d.ts +2 -7
  12. package/dist/plugins/getApp/index.d.ts.map +1 -1
  13. package/dist/plugins/getApp/index.js +9 -9
  14. package/dist/plugins/getApp/index.test.js +1 -1
  15. package/dist/plugins/getAuthentication/index.test.js +1 -1
  16. package/dist/plugins/listActions/index.d.ts +2 -4
  17. package/dist/plugins/listActions/index.d.ts.map +1 -1
  18. package/dist/plugins/listActions/index.js +1 -1
  19. package/dist/plugins/listActions/index.test.js +4 -4
  20. package/dist/plugins/listApps/index.d.ts +4 -7
  21. package/dist/plugins/listApps/index.d.ts.map +1 -1
  22. package/dist/plugins/listApps/index.js +33 -17
  23. package/dist/plugins/listApps/index.test.js +22 -2
  24. package/dist/plugins/listAuthentications/index.d.ts +2 -4
  25. package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
  26. package/dist/plugins/listAuthentications/index.js +4 -0
  27. package/dist/plugins/listAuthentications/index.test.js +39 -13
  28. package/dist/plugins/listAuthentications/schemas.d.ts +3 -0
  29. package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
  30. package/dist/plugins/listAuthentications/schemas.js +4 -0
  31. package/dist/plugins/manifest/index.d.ts +25 -9
  32. package/dist/plugins/manifest/index.d.ts.map +1 -1
  33. package/dist/plugins/manifest/index.js +239 -67
  34. package/dist/plugins/manifest/index.test.js +426 -171
  35. package/dist/plugins/manifest/schemas.d.ts +5 -1
  36. package/dist/plugins/manifest/schemas.d.ts.map +1 -1
  37. package/dist/plugins/manifest/schemas.js +1 -0
  38. package/dist/sdk.d.ts +5 -11
  39. package/dist/sdk.d.ts.map +1 -1
  40. package/dist/sdk.js +1 -4
  41. package/dist/types/plugin.d.ts +1 -0
  42. package/dist/types/plugin.d.ts.map +1 -1
  43. package/dist/types/sdk.d.ts +6 -3
  44. package/dist/types/sdk.d.ts.map +1 -1
  45. package/dist/utils/domain-utils.d.ts +16 -0
  46. package/dist/utils/domain-utils.d.ts.map +1 -1
  47. package/dist/utils/domain-utils.js +46 -27
  48. package/dist/utils/domain-utils.test.js +157 -3
  49. package/dist/utils/file-utils.d.ts +4 -0
  50. package/dist/utils/file-utils.d.ts.map +1 -0
  51. package/dist/utils/file-utils.js +74 -0
  52. package/dist/utils/file-utils.test.d.ts +2 -0
  53. package/dist/utils/file-utils.test.d.ts.map +1 -0
  54. package/dist/utils/file-utils.test.js +51 -0
  55. package/package.json +1 -1
  56. package/src/index.ts +1 -1
  57. package/src/plugins/apps/index.ts +9 -2
  58. package/src/plugins/getApp/index.test.ts +1 -1
  59. package/src/plugins/getApp/index.ts +12 -14
  60. package/src/plugins/getAuthentication/index.test.ts +1 -1
  61. package/src/plugins/listActions/index.test.ts +8 -7
  62. package/src/plugins/listActions/index.ts +3 -3
  63. package/src/plugins/listApps/index.test.ts +23 -2
  64. package/src/plugins/listApps/index.ts +46 -25
  65. package/src/plugins/listAuthentications/index.test.ts +52 -15
  66. package/src/plugins/listAuthentications/index.ts +7 -2
  67. package/src/plugins/listAuthentications/schemas.ts +4 -0
  68. package/src/plugins/manifest/index.test.ts +503 -197
  69. package/src/plugins/manifest/index.ts +338 -82
  70. package/src/plugins/manifest/schemas.ts +9 -2
  71. package/src/sdk.ts +1 -5
  72. package/src/types/plugin.ts +3 -0
  73. package/src/types/sdk.ts +26 -21
  74. package/src/utils/domain-utils.test.ts +196 -2
  75. package/src/utils/domain-utils.ts +68 -35
  76. package/src/utils/file-utils.test.ts +73 -0
  77. package/src/utils/file-utils.ts +94 -0
  78. package/tsconfig.tsbuildinfo +1 -1
  79. package/dist/plugins/lockVersion/index.d.ts +0 -24
  80. package/dist/plugins/lockVersion/index.d.ts.map +0 -1
  81. package/dist/plugins/lockVersion/index.js +0 -72
  82. package/dist/plugins/lockVersion/index.test.d.ts +0 -2
  83. package/dist/plugins/lockVersion/index.test.d.ts.map +0 -1
  84. package/dist/plugins/lockVersion/index.test.js +0 -129
  85. package/dist/plugins/lockVersion/schemas.d.ts +0 -10
  86. package/dist/plugins/lockVersion/schemas.d.ts.map +0 -1
  87. package/dist/plugins/lockVersion/schemas.js +0 -6
  88. package/src/plugins/lockVersion/index.test.ts +0 -176
  89. package/src/plugins/lockVersion/index.ts +0 -112
  90. package/src/plugins/lockVersion/schemas.ts +0 -9
package/dist/index.d.mts CHANGED
@@ -2218,75 +2218,6 @@ declare const RelayFetchSchema: z.ZodObject<{
2218
2218
  relayBaseUrl?: string | undefined;
2219
2219
  }>;
2220
2220
 
2221
- declare const LockVersionSchema: z.ZodObject<{
2222
- appKey: z.ZodString;
2223
- }, "strip", z.ZodTypeAny, {
2224
- appKey: string;
2225
- }, {
2226
- appKey: string;
2227
- }>;
2228
- type LockVersionOptions = z.infer<typeof LockVersionSchema>;
2229
-
2230
- declare const ListAppsSchema: z.ZodObject<{
2231
- appKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2232
- search: z.ZodOptional<z.ZodString>;
2233
- pageSize: z.ZodOptional<z.ZodNumber>;
2234
- maxItems: z.ZodOptional<z.ZodNumber>;
2235
- }, "strip", z.ZodTypeAny, {
2236
- search?: string | undefined;
2237
- pageSize?: number | undefined;
2238
- maxItems?: number | undefined;
2239
- appKeys?: string[] | undefined;
2240
- }, {
2241
- search?: string | undefined;
2242
- pageSize?: number | undefined;
2243
- maxItems?: number | undefined;
2244
- appKeys?: string[] | undefined;
2245
- }>;
2246
- type ListAppsOptions = z.infer<typeof ListAppsSchema>;
2247
-
2248
- interface ListAppsPluginProvides {
2249
- listApps: (options?: ListAppsOptions) => Promise<{
2250
- data: AppItem[];
2251
- }> & AsyncIterable<{
2252
- data: AppItem[];
2253
- nextCursor?: string;
2254
- }> & {
2255
- items(): AsyncIterable<AppItem>;
2256
- };
2257
- context: {
2258
- meta: {
2259
- listApps: {
2260
- inputSchema: typeof ListAppsSchema;
2261
- };
2262
- };
2263
- };
2264
- }
2265
- declare const listAppsPlugin: Plugin<{}, // no SDK dependencies
2266
- {
2267
- api: ApiClient;
2268
- }, // requires api in context
2269
- ListAppsPluginProvides>;
2270
-
2271
- interface LockVersionPluginProvides {
2272
- lockVersion: (options: LockVersionOptions & {
2273
- configPath?: string;
2274
- }) => Promise<{
2275
- data: AppItem;
2276
- configPath: string;
2277
- }>;
2278
- context: {
2279
- meta: {
2280
- lockVersion: {
2281
- inputSchema: typeof LockVersionSchema;
2282
- };
2283
- };
2284
- };
2285
- }
2286
- declare const lockVersionPlugin: Plugin<GetSdkType<ListAppsPluginProvides>, // requires getApp in SDK
2287
- {}, // requires manifest context
2288
- LockVersionPluginProvides>;
2289
-
2290
2221
  interface RegistryPluginProvides {
2291
2222
  getRegistry: () => {
2292
2223
  functions: FunctionRegistryEntry[];
@@ -2358,25 +2289,50 @@ type ZapierFetchInitOptions = RequestInit & {
2358
2289
  authenticationTemplate?: string;
2359
2290
  };
2360
2291
 
2361
- declare const GetAppSchema: z.ZodObject<{
2362
- appKey: z.ZodString;
2292
+ declare const ListAppsSchema: z.ZodObject<{
2293
+ appKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2294
+ search: z.ZodOptional<z.ZodString>;
2295
+ pageSize: z.ZodOptional<z.ZodNumber>;
2296
+ maxItems: z.ZodOptional<z.ZodNumber>;
2363
2297
  }, "strip", z.ZodTypeAny, {
2364
- appKey: string;
2298
+ search?: string | undefined;
2299
+ pageSize?: number | undefined;
2300
+ maxItems?: number | undefined;
2301
+ appKeys?: string[] | undefined;
2365
2302
  }, {
2366
- appKey: string;
2303
+ search?: string | undefined;
2304
+ pageSize?: number | undefined;
2305
+ maxItems?: number | undefined;
2306
+ appKeys?: string[] | undefined;
2367
2307
  }>;
2368
- type GetAppOptions = z.infer<typeof GetAppSchema>;
2308
+ type ListAppsOptions = z.infer<typeof ListAppsSchema>;
2309
+
2310
+ /**
2311
+ * Domain utility functions for working with app identifiers and data normalization
2312
+ */
2313
+
2314
+ interface AppLocator {
2315
+ lookupAppKey: string;
2316
+ slug?: string;
2317
+ implementationName?: string;
2318
+ version?: string;
2319
+ }
2320
+ interface ResolvedAppLocator extends AppLocator {
2321
+ implementationName: string;
2322
+ }
2369
2323
 
2324
+ declare const DEFAULT_CONFIG_PATH: ".zapierrc";
2370
2325
  type ManifestEntry = {
2371
2326
  implementationName: string;
2372
2327
  version?: string;
2373
2328
  };
2374
- type GetManifestEntry = (appKey: string) => ManifestEntry | null;
2375
2329
  type GetVersionedImplementationId = (appKey: string) => Promise<string | null>;
2376
- type GetImplementation = (appKey: string) => Promise<AppItem | null>;
2377
2330
  type Manifest = {
2378
2331
  apps: Record<string, ManifestEntry>;
2379
2332
  };
2333
+ type ResolveAppKeys = ({ appKeys, }: {
2334
+ appKeys: string[];
2335
+ }) => Promise<ResolvedAppLocator[]>;
2380
2336
  declare const ManifestPluginOptionsSchema: z.ZodObject<{
2381
2337
  manifestPath: z.ZodOptional<z.ZodString>;
2382
2338
  manifest: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -2407,19 +2363,75 @@ type ManifestPluginOptions = z.infer<typeof ManifestPluginOptionsSchema>;
2407
2363
  interface ManifestPluginProvides {
2408
2364
  context: {
2409
2365
  getVersionedImplementationId: GetVersionedImplementationId;
2410
- getManifestEntry: GetManifestEntry;
2411
- getImplementation: GetImplementation;
2366
+ resolveAppKeys: ResolveAppKeys;
2367
+ updateManifestEntry: (appKey: string, entry: ManifestEntry, configPath?: string) => Promise<[string, ManifestEntry]>;
2412
2368
  };
2413
2369
  }
2414
2370
  /**
2415
- * Load manifest from a file path synchronously
2416
- * Supports local files (Node.js only)
2371
+ * Read manifest from a file path asynchronously
2372
+ * Supports local files (Node.js) and browser environments (fallback to global filesystem)
2373
+ */
2374
+ declare function readManifestFromFile(filePath: string): Promise<Manifest | null>;
2375
+ /**
2376
+ * Get the preferred key for storing an app in the manifest
2377
+ * Extracted from plugin to make it easier to test
2417
2378
  */
2418
- declare function loadManifestFromFile(filePath: string): Manifest | null;
2419
- declare const manifestPlugin: Plugin<GetSdkType<ListAppsPluginProvides>, {
2379
+ declare function getPreferredManifestEntryKey({ appKey, api, }: {
2380
+ appKey: string;
2381
+ api: ApiClient;
2382
+ }): Promise<string>;
2383
+ /**
2384
+ * Find a manifest entry by any app key (implementation name, slug, etc.).
2385
+ */
2386
+ declare function findManifestEntry({ appKey, manifest, }: {
2387
+ appKey: string;
2388
+ manifest: Manifest;
2389
+ }): [string, ManifestEntry] | null;
2390
+
2391
+ declare const manifestPlugin: Plugin<{}, // no SDK dependencies
2392
+ {
2420
2393
  api: ApiClient;
2421
2394
  }, ManifestPluginProvides>;
2422
2395
 
2396
+ interface ApiPluginOptions extends BaseSdkOptions {
2397
+ }
2398
+ interface ApiPluginProvides {
2399
+ context: {
2400
+ api: ApiClient;
2401
+ };
2402
+ }
2403
+ declare const apiPlugin: Plugin<{}, // no SDK dependencies
2404
+ {}, // requires no context
2405
+ ApiPluginProvides>;
2406
+
2407
+ interface ListAppsPluginProvides {
2408
+ listApps: (options?: ListAppsOptions) => Promise<{
2409
+ data: AppItem[];
2410
+ }> & AsyncIterable<{
2411
+ data: AppItem[];
2412
+ nextCursor?: string;
2413
+ }> & {
2414
+ items(): AsyncIterable<AppItem>;
2415
+ };
2416
+ context: {
2417
+ meta: {
2418
+ listApps: {
2419
+ inputSchema: typeof ListAppsSchema;
2420
+ };
2421
+ };
2422
+ };
2423
+ }
2424
+ declare const listAppsPlugin: Plugin<{}, GetContextType<ApiPluginProvides & ManifestPluginProvides>, ListAppsPluginProvides>;
2425
+
2426
+ declare const GetAppSchema: z.ZodObject<{
2427
+ appKey: z.ZodString;
2428
+ }, "strip", z.ZodTypeAny, {
2429
+ appKey: string;
2430
+ }, {
2431
+ appKey: string;
2432
+ }>;
2433
+ type GetAppOptions = z.infer<typeof GetAppSchema>;
2434
+
2423
2435
  interface GetAppPluginProvides {
2424
2436
  getApp: (options: GetAppOptions) => Promise<{
2425
2437
  data: AppItem;
@@ -2432,11 +2444,7 @@ interface GetAppPluginProvides {
2432
2444
  };
2433
2445
  };
2434
2446
  }
2435
- declare const getAppPlugin: Plugin<GetSdkType<ManifestPluginProvides>, // depends on manifest plugin with getImplementation in context
2436
- {
2437
- getImplementation: GetImplementation;
2438
- }, //
2439
- GetAppPluginProvides>;
2447
+ declare const getAppPlugin: Plugin<GetSdkType<ListAppsPluginProvides>, {}, GetAppPluginProvides>;
2440
2448
 
2441
2449
  declare const ListActionsSchema: z.ZodObject<{
2442
2450
  appKey: z.ZodString;
@@ -2473,12 +2481,10 @@ interface ListActionsPluginProvides {
2473
2481
  };
2474
2482
  };
2475
2483
  }
2476
- declare const listActionsPlugin: Plugin<GetSdkType<ManifestPluginProvides>, // requires getApp in SDK
2477
- {
2484
+ declare const listActionsPlugin: Plugin<GetSdkType<ManifestPluginProvides>, {
2478
2485
  api: ApiClient;
2479
2486
  getVersionedImplementationId: GetVersionedImplementationId;
2480
- }, // requires api and getVersionedImplementationId in context
2481
- ListActionsPluginProvides>;
2487
+ }, ListActionsPluginProvides>;
2482
2488
 
2483
2489
  declare const GetActionSchema: z.ZodObject<{
2484
2490
  appKey: z.ZodString;
@@ -2566,6 +2572,7 @@ RunActionPluginProvides>;
2566
2572
 
2567
2573
  declare const ListAuthenticationsSchema: z.ZodObject<{
2568
2574
  appKey: z.ZodOptional<z.ZodString>;
2575
+ authenticationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2569
2576
  search: z.ZodOptional<z.ZodString>;
2570
2577
  title: z.ZodOptional<z.ZodString>;
2571
2578
  accountId: z.ZodOptional<z.ZodString>;
@@ -2580,6 +2587,7 @@ declare const ListAuthenticationsSchema: z.ZodObject<{
2580
2587
  maxItems?: number | undefined;
2581
2588
  accountId?: string | undefined;
2582
2589
  owner?: string | undefined;
2590
+ authenticationIds?: string[] | undefined;
2583
2591
  }, {
2584
2592
  title?: string | undefined;
2585
2593
  search?: string | undefined;
@@ -2588,6 +2596,7 @@ declare const ListAuthenticationsSchema: z.ZodObject<{
2588
2596
  maxItems?: number | undefined;
2589
2597
  accountId?: string | undefined;
2590
2598
  owner?: string | undefined;
2599
+ authenticationIds?: string[] | undefined;
2591
2600
  }>;
2592
2601
  type ListAuthenticationsOptions = z.infer<typeof ListAuthenticationsSchema>;
2593
2602
 
@@ -2608,12 +2617,10 @@ interface ListAuthenticationsPluginProvides {
2608
2617
  };
2609
2618
  };
2610
2619
  }
2611
- declare const listAuthenticationsPlugin: Plugin<GetSdkType<ManifestPluginProvides>, // requires getApp in SDK
2612
- {
2620
+ declare const listAuthenticationsPlugin: Plugin<GetSdkType<ManifestPluginProvides>, {
2613
2621
  api: ApiClient;
2614
2622
  getVersionedImplementationId: GetVersionedImplementationId;
2615
- }, // requires api in context
2616
- ListAuthenticationsPluginProvides>;
2623
+ }, ListAuthenticationsPluginProvides>;
2617
2624
 
2618
2625
  interface GetAuthenticationPluginProvides {
2619
2626
  getAuthentication: (options: GetAuthenticationOptions) => Promise<{
@@ -2689,6 +2696,74 @@ declare const listInputFieldsPlugin: Plugin<GetSdkType<GetAppPluginProvides>, //
2689
2696
  }, // requires api and getVersionedImplementationId in context
2690
2697
  ListInputFieldsPluginProvides>;
2691
2698
 
2699
+ declare const InputFieldChoiceItemSchema: z.ZodObject<{
2700
+ key: z.ZodOptional<z.ZodString>;
2701
+ label: z.ZodOptional<z.ZodString>;
2702
+ sample: z.ZodOptional<z.ZodString>;
2703
+ value: z.ZodOptional<z.ZodString>;
2704
+ }, "strip", z.ZodTypeAny, {
2705
+ value?: string | undefined;
2706
+ key?: string | undefined;
2707
+ label?: string | undefined;
2708
+ sample?: string | undefined;
2709
+ }, {
2710
+ value?: string | undefined;
2711
+ key?: string | undefined;
2712
+ label?: string | undefined;
2713
+ sample?: string | undefined;
2714
+ }>;
2715
+ type InputFieldChoiceItem = z.infer<typeof InputFieldChoiceItemSchema>;
2716
+ declare const ListInputFieldChoicesSchema: z.ZodObject<{
2717
+ appKey: z.ZodString;
2718
+ actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
2719
+ actionKey: z.ZodString;
2720
+ inputFieldKey: z.ZodString;
2721
+ authenticationId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2722
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2723
+ page: z.ZodOptional<z.ZodNumber>;
2724
+ pageSize: z.ZodOptional<z.ZodNumber>;
2725
+ maxItems: z.ZodOptional<z.ZodNumber>;
2726
+ }, "strip", z.ZodTypeAny, {
2727
+ appKey: string;
2728
+ actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
2729
+ actionKey: string;
2730
+ inputFieldKey: string;
2731
+ page?: number | undefined;
2732
+ authenticationId?: number | null | undefined;
2733
+ inputs?: Record<string, unknown> | undefined;
2734
+ pageSize?: number | undefined;
2735
+ maxItems?: number | undefined;
2736
+ }, {
2737
+ appKey: string;
2738
+ actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
2739
+ actionKey: string;
2740
+ inputFieldKey: string;
2741
+ page?: number | undefined;
2742
+ authenticationId?: number | null | undefined;
2743
+ inputs?: Record<string, unknown> | undefined;
2744
+ pageSize?: number | undefined;
2745
+ maxItems?: number | undefined;
2746
+ }>;
2747
+ type ListInputFieldChoicesOptions = z.infer<typeof ListInputFieldChoicesSchema>;
2748
+
2749
+ interface ListInputFieldChoicesPluginProvides {
2750
+ listInputFieldChoices: (options: ListInputFieldChoicesOptions) => Promise<{
2751
+ data: InputFieldChoiceItem[];
2752
+ }> & AsyncIterable<{
2753
+ data: InputFieldChoiceItem[];
2754
+ nextCursor?: string;
2755
+ }> & {
2756
+ items(): AsyncIterable<InputFieldChoiceItem>;
2757
+ };
2758
+ context: {
2759
+ meta: {
2760
+ listInputFieldChoices: {
2761
+ inputSchema: typeof ListInputFieldChoicesSchema;
2762
+ };
2763
+ };
2764
+ };
2765
+ }
2766
+
2692
2767
  /**
2693
2768
  * SDK-related types and interfaces
2694
2769
  */
@@ -2716,7 +2791,9 @@ interface FunctionRegistryEntry {
2716
2791
  inputSchema: z.ZodSchema;
2717
2792
  categories: string[];
2718
2793
  }
2719
- type ZapierSdk = GetSdkType<RegistryPluginProvides & FetchPluginProvides & AppsPluginProvides & ListAppsPluginProvides & ManifestPluginProvides & GetAppPluginProvides & ListActionsPluginProvides & GetActionPluginProvides & RunActionPluginProvides & LockVersionPluginProvides & ListAuthenticationsPluginProvides & GetAuthenticationPluginProvides & FindFirstAuthenticationPluginProvides & FindUniqueAuthenticationPluginProvides & ListInputFieldsPluginProvides & RequestPluginProvides & GetProfilePluginProvides>;
2794
+ interface ZapierSdk extends GetSdkType<RegistryPluginProvides & FetchPluginProvides & AppsPluginProvides & ListAppsPluginProvides & ManifestPluginProvides & GetAppPluginProvides & ListActionsPluginProvides & GetActionPluginProvides & RunActionPluginProvides & ListAuthenticationsPluginProvides & GetAuthenticationPluginProvides & FindFirstAuthenticationPluginProvides & FindUniqueAuthenticationPluginProvides & ListInputFieldsPluginProvides & ListInputFieldChoicesPluginProvides & RequestPluginProvides & GetProfilePluginProvides> {
2795
+ apps: ActionProxy & ZapierSdkApps;
2796
+ }
2720
2797
 
2721
2798
  /**
2722
2799
  * ------------------------------
@@ -2744,6 +2821,7 @@ type ExtractContextProperties<T extends PluginProvides> = T["context"];
2744
2821
  type GetSdkType<TPluginProvides extends PluginProvides> = ExtractSdkProperties<TPluginProvides> & {
2745
2822
  getContext(): NonNullable<ExtractContextProperties<TPluginProvides>>;
2746
2823
  };
2824
+ type GetContextType<TPluginProvides extends PluginProvides> = NonNullable<ExtractContextProperties<TPluginProvides>>;
2747
2825
  type PluginOptions<TSdk = {}, TContext = {}> = {
2748
2826
  sdk: TSdk;
2749
2827
  context: TContext & {
@@ -2792,16 +2870,8 @@ declare const appsPlugin: Plugin<GetSdkType<FetchPluginProvides & RunActionPlugi
2792
2870
  {}, // no context requirements
2793
2871
  AppsPluginProvides>;
2794
2872
 
2795
- interface ApiPluginOptions extends BaseSdkOptions {
2796
- }
2797
- interface ApiPluginProvides {
2798
- context: {
2799
- api: ApiClient;
2800
- };
2873
+ interface ZapierSdkApps {
2801
2874
  }
2802
- declare const apiPlugin: Plugin<{}, // no SDK dependencies
2803
- {}, // requires no context
2804
- ApiPluginProvides>;
2805
2875
 
2806
2876
  interface InputsResolver {
2807
2877
  type: "fields";
@@ -2922,93 +2992,25 @@ declare function getTokenFromCliLogin(options?: AuthOptions): Promise<string | u
2922
2992
  */
2923
2993
  declare function getTokenFromEnvOrConfig(options?: AuthOptions): Promise<string | undefined>;
2924
2994
 
2925
- declare const InputFieldChoiceItemSchema: z.ZodObject<{
2926
- key: z.ZodOptional<z.ZodString>;
2927
- label: z.ZodOptional<z.ZodString>;
2928
- sample: z.ZodOptional<z.ZodString>;
2929
- value: z.ZodOptional<z.ZodString>;
2930
- }, "strip", z.ZodTypeAny, {
2931
- value?: string | undefined;
2932
- key?: string | undefined;
2933
- label?: string | undefined;
2934
- sample?: string | undefined;
2935
- }, {
2936
- value?: string | undefined;
2937
- key?: string | undefined;
2938
- label?: string | undefined;
2939
- sample?: string | undefined;
2940
- }>;
2941
- type InputFieldChoiceItem = z.infer<typeof InputFieldChoiceItemSchema>;
2942
- declare const ListInputFieldChoicesSchema: z.ZodObject<{
2943
- appKey: z.ZodString;
2944
- actionType: z.ZodEnum<["read", "read_bulk", "write", "run", "search", "search_or_write", "search_and_write", "filter"]>;
2945
- actionKey: z.ZodString;
2946
- inputFieldKey: z.ZodString;
2947
- authenticationId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2948
- inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2949
- page: z.ZodOptional<z.ZodNumber>;
2950
- pageSize: z.ZodOptional<z.ZodNumber>;
2951
- maxItems: z.ZodOptional<z.ZodNumber>;
2952
- }, "strip", z.ZodTypeAny, {
2953
- appKey: string;
2954
- actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
2955
- actionKey: string;
2956
- inputFieldKey: string;
2957
- page?: number | undefined;
2958
- authenticationId?: number | null | undefined;
2959
- inputs?: Record<string, unknown> | undefined;
2960
- pageSize?: number | undefined;
2961
- maxItems?: number | undefined;
2962
- }, {
2963
- appKey: string;
2964
- actionType: "filter" | "read" | "read_bulk" | "run" | "search" | "search_and_write" | "search_or_write" | "write";
2965
- actionKey: string;
2966
- inputFieldKey: string;
2967
- page?: number | undefined;
2968
- authenticationId?: number | null | undefined;
2969
- inputs?: Record<string, unknown> | undefined;
2970
- pageSize?: number | undefined;
2971
- maxItems?: number | undefined;
2972
- }>;
2973
- type ListInputFieldChoicesOptions = z.infer<typeof ListInputFieldChoicesSchema>;
2974
-
2975
- interface ListInputFieldChoicesPluginProvides {
2976
- listInputFieldChoices: (options: ListInputFieldChoicesOptions) => Promise<{
2977
- data: InputFieldChoiceItem[];
2978
- }> & AsyncIterable<{
2979
- data: InputFieldChoiceItem[];
2980
- nextCursor?: string;
2981
- }> & {
2982
- items(): AsyncIterable<InputFieldChoiceItem>;
2983
- };
2984
- context: {
2985
- meta: {
2986
- listInputFieldChoices: {
2987
- inputSchema: typeof ListInputFieldChoicesSchema;
2988
- };
2989
- };
2990
- };
2991
- }
2992
-
2993
2995
  interface ZapierSdkOptions extends BaseSdkOptions {
2994
2996
  }
2995
2997
  declare function createSdk<TCurrentSdk = {}, TCurrentContext = {
2996
2998
  meta: Record<string, PluginMeta>;
2997
2999
  }>(options?: ZapierSdkOptions, initialSdk?: TCurrentSdk, initialContext?: TCurrentContext): Sdk<TCurrentSdk, TCurrentContext>;
2998
- declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk<ExtractSdkProperties<ApiPluginProvides> & ExtractSdkProperties<ListAppsPluginProvides> & ExtractSdkProperties<ManifestPluginProvides> & ExtractSdkProperties<GetAppPluginProvides> & ExtractSdkProperties<ListActionsPluginProvides> & ExtractSdkProperties<GetActionPluginProvides> & ExtractSdkProperties<ListInputFieldsPluginProvides> & ExtractSdkProperties<ListInputFieldChoicesPluginProvides> & ExtractSdkProperties<RunActionPluginProvides> & ExtractSdkProperties<LockVersionPluginProvides> & ExtractSdkProperties<ListAuthenticationsPluginProvides> & ExtractSdkProperties<GetAuthenticationPluginProvides> & ExtractSdkProperties<FindFirstAuthenticationPluginProvides> & ExtractSdkProperties<FindUniqueAuthenticationPluginProvides> & ExtractSdkProperties<RequestPluginProvides> & ExtractSdkProperties<FetchPluginProvides> & ExtractSdkProperties<AppsPluginProvides> & ExtractSdkProperties<GetProfilePluginProvides>, {
3000
+ declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk<ExtractSdkProperties<ApiPluginProvides> & ExtractSdkProperties<ManifestPluginProvides> & ExtractSdkProperties<ListAppsPluginProvides> & ExtractSdkProperties<GetAppPluginProvides> & ExtractSdkProperties<ListActionsPluginProvides> & ExtractSdkProperties<GetActionPluginProvides> & ExtractSdkProperties<ListInputFieldsPluginProvides> & ExtractSdkProperties<ListInputFieldChoicesPluginProvides> & ExtractSdkProperties<RunActionPluginProvides> & ExtractSdkProperties<ListAuthenticationsPluginProvides> & ExtractSdkProperties<GetAuthenticationPluginProvides> & ExtractSdkProperties<FindFirstAuthenticationPluginProvides> & ExtractSdkProperties<FindUniqueAuthenticationPluginProvides> & ExtractSdkProperties<RequestPluginProvides> & ExtractSdkProperties<FetchPluginProvides> & ExtractSdkProperties<AppsPluginProvides> & ExtractSdkProperties<GetProfilePluginProvides>, {
2999
3001
  meta: Record<string, PluginMeta>;
3000
3002
  } & {
3001
3003
  api: ApiClient;
3004
+ } & {
3005
+ getVersionedImplementationId: GetVersionedImplementationId;
3006
+ resolveAppKeys: ResolveAppKeys;
3007
+ updateManifestEntry: (appKey: string, entry: ManifestEntry, configPath?: string) => Promise<[string, ManifestEntry]>;
3002
3008
  } & {
3003
3009
  meta: {
3004
3010
  listApps: {
3005
3011
  inputSchema: typeof ListAppsSchema;
3006
3012
  };
3007
3013
  };
3008
- } & {
3009
- getVersionedImplementationId: GetVersionedImplementationId;
3010
- getManifestEntry: GetManifestEntry;
3011
- getImplementation: GetImplementation;
3012
3014
  } & {
3013
3015
  meta: {
3014
3016
  getApp: {
@@ -3045,12 +3047,6 @@ declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk
3045
3047
  inputSchema: typeof RunActionSchema;
3046
3048
  };
3047
3049
  };
3048
- } & {
3049
- meta: {
3050
- lockVersion: {
3051
- inputSchema: typeof LockVersionSchema;
3052
- };
3053
- };
3054
3050
  } & {
3055
3051
  meta: {
3056
3052
  listAuthentications: {
@@ -3090,4 +3086,4 @@ declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk
3090
3086
  }>;
3091
3087
  declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
3092
3088
 
3093
- export { type Action, type ActionExecutionResult, type ActionField, type ActionFieldChoice, type ActionItem, type ActionKeyProperty, ActionKeyPropertySchema, type ActionTypeProperty, ActionTypePropertySchema, type ApiError, type ApiEvent, type ApiPluginOptions, type ApiPluginProvides, type App, type AppItem, type AppKeyProperty, AppKeyPropertySchema, type AppsPluginProvides, type AuthEvent, type AuthOptions, type Authentication, type AuthenticationIdProperty, AuthenticationIdPropertySchema, type AuthenticationItem, type AuthenticationsResponse, type Choice, type DebugProperty, DebugPropertySchema, type ErrorOptions, type EventCallback, type FetchPluginProvides, type Field, type FindFirstAuthenticationPluginProvides, type FindUniqueAuthenticationPluginProvides, type FunctionOptions, type FunctionRegistryEntry, type GetActionPluginProvides, type GetAppPluginProvides, type GetAuthenticationPluginProvides, type GetProfilePluginProvides, type GetSdkType, type InputFieldItem, type InputsProperty, InputsPropertySchema, type LimitProperty, LimitPropertySchema, type ListActionsPluginProvides, type ListAppsPluginProvides, type ListAuthenticationsPluginProvides, type ListInputFieldsPluginProvides, type LoadingEvent, type LockVersionPluginProvides, 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, RelayFetchSchema, RelayRequestSchema, type RequestPluginProvides, type ResolverName, type ResolverType, type RunActionPluginProvides, type Sdk, type SdkEvent, type UserProfile, type UserProfileItem, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, type ZapierFetchInitOptions, ZapierNotFoundError, ZapierResourceNotFoundError, type ZapierSdk, type ZapierSdkOptions, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, authenticationIdResolver, createFunction, createSdk, createZapierSdk, createZapierSdkWithoutRegistry, fetchPlugin, findFirstAuthenticationPlugin, findUniqueAuthenticationPlugin, formatErrorMessage, getActionPlugin, getAppPlugin, getAuthenticationPlugin, getProfilePlugin, getResolutionOrder, getResolutionOrderForParams, getResolvableParams, getResolver, getResolversForMissingParams, getTokenFromCliLogin, getTokenFromEnv, getTokenFromEnvOrConfig, hasResolver, inputsResolver, isPositional, listActionsPlugin, listAppsPlugin, listAuthenticationsPlugin, listInputFieldsPlugin, loadManifestFromFile, lockVersionPlugin, manifestPlugin, registryPlugin, requestPlugin, resolverRegistry, runActionPlugin };
3089
+ export { type Action, type ActionExecutionOptions, type ActionExecutionResult, type ActionField, type ActionFieldChoice, type ActionItem, type ActionKeyProperty, ActionKeyPropertySchema, type ActionTypeProperty, ActionTypePropertySchema, type ApiError, type ApiEvent, type ApiPluginOptions, type ApiPluginProvides, type App, type AppItem, type AppKeyProperty, AppKeyPropertySchema, type AppsPluginProvides, type AuthEvent, type AuthOptions, type Authentication, type AuthenticationIdProperty, AuthenticationIdPropertySchema, type AuthenticationItem, type AuthenticationsResponse, type Choice, DEFAULT_CONFIG_PATH, type DebugProperty, DebugPropertySchema, type ErrorOptions, type EventCallback, type FetchPluginProvides, type Field, type FindFirstAuthenticationPluginProvides, type FindUniqueAuthenticationPluginProvides, type FunctionOptions, type FunctionRegistryEntry, type GetActionPluginProvides, type GetAppPluginProvides, type GetAuthenticationPluginProvides, type GetContextType, type GetProfilePluginProvides, type GetSdkType, type InputFieldItem, type InputsProperty, InputsPropertySchema, type LimitProperty, LimitPropertySchema, type ListActionsPluginProvides, type ListAppsPluginProvides, type ListAuthenticationsPluginProvides, type ListInputFieldsPluginProvides, type LoadingEvent, 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, RelayFetchSchema, RelayRequestSchema, type RequestPluginProvides, type ResolverName, type ResolverType, type RunActionPluginProvides, type Sdk, type SdkEvent, type UserProfile, type UserProfileItem, 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, authenticationIdResolver, createFunction, createSdk, createZapierSdk, createZapierSdkWithoutRegistry, fetchPlugin, findFirstAuthenticationPlugin, findManifestEntry, findUniqueAuthenticationPlugin, formatErrorMessage, getActionPlugin, getAppPlugin, getAuthenticationPlugin, getPreferredManifestEntryKey, getProfilePlugin, getResolutionOrder, getResolutionOrderForParams, getResolvableParams, getResolver, getResolversForMissingParams, getTokenFromCliLogin, getTokenFromEnv, getTokenFromEnvOrConfig, hasResolver, inputsResolver, isPositional, listActionsPlugin, listAppsPlugin, listAuthenticationsPlugin, listInputFieldsPlugin, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resolverRegistry, runActionPlugin };
package/dist/index.d.ts CHANGED
@@ -16,7 +16,6 @@ export * from "./plugins/findUniqueAuthentication";
16
16
  export * from "./plugins/runAction";
17
17
  export * from "./plugins/request";
18
18
  export * from "./plugins/manifest";
19
- export * from "./plugins/lockVersion";
20
19
  export * from "./plugins/getProfile";
21
20
  export * from "./plugins/api";
22
21
  export type { Action, App, Need, Field, Choice, ActionExecutionResult, ActionField, ActionFieldChoice, NeedsRequest, NeedsResponse, Authentication, AuthenticationsResponse, UserProfile, } from "./api/types";
@@ -28,7 +27,7 @@ export * from "./resolvers";
28
27
  export { RelayRequestSchema, RelayFetchSchema, } from "./plugins/request/schemas";
29
28
  export { createZapierSdk, createZapierSdkWithoutRegistry, createSdk, ZapierSdkOptions, } from "./sdk";
30
29
  export type { FunctionRegistryEntry } from "./types/sdk";
31
- export type { Plugin, PluginProvides, PluginDependencies, PluginOptions, GetSdkType, Sdk, } from "./types/plugin";
30
+ export type { Plugin, PluginProvides, PluginDependencies, PluginOptions, GetSdkType, GetContextType, Sdk, } from "./types/plugin";
32
31
  export { registryPlugin } from "./plugins/registry";
33
32
  export type { ZapierSdk } from "./types/sdk";
34
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBA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AAa,CAAC;AAGzD,YAAY,EACV,MAAM,EACN,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,cAAc,EACd,GAAG,GACJ,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -17,7 +17,6 @@ export * from "./plugins/findUniqueAuthentication";
17
17
  export * from "./plugins/runAction";
18
18
  export * from "./plugins/request";
19
19
  export * from "./plugins/manifest";
20
- export * from "./plugins/lockVersion";
21
20
  export * from "./plugins/getProfile";
22
21
  export * from "./plugins/api";
23
22
  // Export schema utilities for CLI