@zapier/zapier-sdk 0.107.2 → 0.108.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.
@@ -1,7 +1,7 @@
1
- import { DEFAULT_PAGE_SIZE, apiPluginRef, workflowIdResolver, extractErrorDetail, ZapierApiError, durableRunIdResolver, ZapierConflictError, workflowVersionIdResolver, workflowDraftIdResolver, workflowRunIdResolver, zapierSdkPlugin, ZapierValidationError, ZapierConfigurationError, zapierCoreOptions, SDK_OPTIONS_ID } from './chunk-HYFM3H36.mjs';
2
- export { ACTION_RUNS_PATH, API_ID, ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMillisecondsPropertySchema, ActionTimeoutSecondsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthMechanism, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONNECTIONS_ID, CONTEXT, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MILLISECONDS, CORE_ERROR_SYMBOL, CORE_OPTIONS_ID, CORE_SIGNAL_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreCancelledSignal, CoreDisposeError, CoreErrorCode, CoreSignal, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MILLISECONDS, DEFAULT_APPROVAL_TIMEOUT_MILLISECONDS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DEPRECATION_NOTICE_EVENT, DebugPropertySchema, DrainTriggerInboxSchema, EVENT_EMISSION_ID, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MANIFEST_ID, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RESOLVE_CREDENTIALS_ID, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, SDK_OPTIONS_ID, TablePropertySchema, TablesPropertySchema, TriggerInboxKeyPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, WatchTriggerInboxSchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MILLISECONDS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, addPlugin, apiPlugin, apiPluginRef, appKeyResolver, appsPlugin, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, connectionsPluginRef, createActionRunPlugin, createBaseEvent, createClientCredentialsPlugin, createController, createCorePlugin, createFunction, createMemoryCache, createPaginatedFunction, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierSdkWithoutRegistry, declareMethod, declareOptionalProperty, declarePlugin, declareProperty, defineFormatter, defineLegacyMerge, defineMethod, defineMethodOverride, defineOverride, definePlugin, defineProperty, defineResolver, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, disposeSdk, durableRunIdResolver, eventEmissionHookPlugin, eventEmissionPlugin, eventEmissionPluginRef, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, fromFunctionPlugin, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getActionRunPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCallerContext, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getNegatable, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getRegistryPlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierCausationId, getZapierCorrelationId, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreCancelledSignal, isCoreError, isCoreSignal, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, isZapierAbortDrainSignal, isZapierActionError, isZapierAppNotFoundError, isZapierApprovalError, isZapierAuthenticationError, isZapierBundleError, isZapierConflictError, isZapierError, isZapierNotFoundError, isZapierRateLimitError, isZapierReleaseTriggerMessageSignal, isZapierResourceNotFoundError, isZapierSignal, isZapierTimeoutError, isZapierValidationError, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, manifestPluginRef, omitExports, operationAnnotatorPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuth, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, resolveCredentialsPlugin, resolveCredentialsPluginRef, resolvePlugin, runActionPlugin, runInMethodScope, runWithCallerContext, runWithTelemetryContext, sdkOptionsPluginRef, selectExports, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowDraftIdResolver, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError, zapierCoreOptions, zapierSdkPlugin } from './chunk-HYFM3H36.mjs';
1
+ import { DEFAULT_PAGE_SIZE, apiPluginRef, workflowIdResolver, extractErrorDetail, ZapierApiError, durableRunIdResolver, ZapierConflictError, workflowVersionIdResolver, workflowDraftIdResolver, workflowRunIdResolver, zapierSdkPlugin, ZapierValidationError, ZapierConfigurationError, zapierCoreOptions, SDK_OPTIONS_ID } from './chunk-ULZVDPAK.mjs';
2
+ export { ACTION_RUNS_PATH, API_ID, ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMillisecondsPropertySchema, ActionTimeoutSecondsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthMechanism, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONNECTIONS_ID, CONTEXT, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MILLISECONDS, CORE_ERROR_SYMBOL, CORE_OPTIONS_ID, CORE_SIGNAL_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreCancelledSignal, CoreDisposeError, CoreErrorCode, CoreSignal, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MILLISECONDS, DEFAULT_APPROVAL_TIMEOUT_MILLISECONDS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DEPRECATION_NOTICE_EVENT, DebugPropertySchema, DrainTriggerInboxSchema, EVENT_EMISSION_ID, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MANIFEST_ID, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RESOLVE_CREDENTIALS_ID, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, SDK_OPTIONS_ID, TablePropertySchema, TablesPropertySchema, TriggerInboxKeyPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, WatchTriggerInboxSchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MILLISECONDS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, addPlugin, apiPlugin, apiPluginRef, appKeyResolver, appsPlugin, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, connectionsPluginRef, createActionRunPlugin, createBaseEvent, createClientCredentialsPlugin, createController, createCorePlugin, createFunction, createMemoryCache, createPaginatedFunction, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierSdkWithoutRegistry, declareMethod, declareOptionalProperty, declarePlugin, declareProperty, defineFormatter, defineLegacyMerge, defineMethod, defineMethodOverride, defineOverride, definePlugin, defineProperty, defineResolver, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, disposeSdk, durableRunIdResolver, eventEmissionHookPlugin, eventEmissionPlugin, eventEmissionPluginRef, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, fromFunctionPlugin, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getActionRunPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCallerContext, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getNegatable, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getRegistryPlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierCausationId, getZapierCorrelationId, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreCancelledSignal, isCoreError, isCoreSignal, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, isZapierAbortDrainSignal, isZapierActionError, isZapierAppNotFoundError, isZapierApprovalError, isZapierAuthenticationError, isZapierBundleError, isZapierConflictError, isZapierError, isZapierNotFoundError, isZapierRateLimitError, isZapierReleaseTriggerMessageSignal, isZapierResourceNotFoundError, isZapierSignal, isZapierTimeoutError, isZapierValidationError, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, manifestPluginRef, omitExports, operationAnnotatorPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuth, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, resolveCredentialsPlugin, resolveCredentialsPluginRef, resolvePlugin, runActionPlugin, runInMethodScope, runWithCallerContext, runWithTelemetryContext, sdkOptionsPluginRef, selectExports, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowDraftIdResolver, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError, zapierCoreOptions, zapierSdkPlugin } from './chunk-ULZVDPAK.mjs';
3
3
  import './chunk-Y6FXYEAI.mjs';
4
- import { defineMethod, openEnum, defineResolver, definePlugin, createSdk, CORE_OPTIONS_ID } from '@zapier/kitcore';
4
+ import { defineMethod, openEnum, defineResolver, defineFormatter, definePlugin, createSdk, CORE_OPTIONS_ID } from '@zapier/kitcore';
5
5
  import { z } from 'zod';
6
6
 
7
7
  var codeSubstrateDefaults = {
@@ -2690,6 +2690,473 @@ var updateAgenticManagementIntentPlugin = defineMethod({
2690
2690
  return { data };
2691
2691
  }
2692
2692
  });
2693
+ var fsDirectoryEntryFormatter = defineFormatter({
2694
+ format: ({ item }) => ({
2695
+ title: item.path,
2696
+ details: [
2697
+ { label: "type", text: item.type, style: "normal" },
2698
+ ...item.size !== void 0 ? [
2699
+ {
2700
+ label: "size",
2701
+ text: `${item.size} bytes`,
2702
+ style: "normal"
2703
+ }
2704
+ ] : [],
2705
+ ...item.version !== void 0 ? [
2706
+ {
2707
+ label: "version",
2708
+ text: String(item.version),
2709
+ style: "normal"
2710
+ }
2711
+ ] : [],
2712
+ ...item.updated_at ? [{ label: "updated", text: item.updated_at, style: "dim" }] : []
2713
+ ]
2714
+ })
2715
+ });
2716
+
2717
+ // src/plugins/vfs/shared.ts
2718
+ var vfsDefaults = {
2719
+ // `titlePlural` is set explicitly so the generated docs heading reads
2720
+ // "Virtual File System", not the auto-pluralized "Virtual File Systems".
2721
+ categories: [
2722
+ {
2723
+ key: "vfs",
2724
+ title: "Virtual File System",
2725
+ titlePlural: "Virtual File System"
2726
+ }
2727
+ ],
2728
+ stability: "experimental"
2729
+ };
2730
+ var VFS_PATH_PREFIX = "/vfs/v1";
2731
+ var VFS_NAME = "Zapier Virtual File System (VFS)";
2732
+ var VFS_MAX_CONTENT_BYTES = 10485760;
2733
+ function absolutePathSchema({
2734
+ label,
2735
+ example = "/Mine/notes.md"
2736
+ }) {
2737
+ return z.string().startsWith("/", {
2738
+ message: `${label} must start with '/' \u2014 paths are absolute.`
2739
+ }).meta({ example });
2740
+ }
2741
+ var FsWriteResultSchema = z.object({
2742
+ path: z.string().describe("Absolute path of the written file."),
2743
+ version: z.number().int().min(1).describe("Monotonic version stamped by the server on this write."),
2744
+ action: z.enum(["created", "updated"]).describe(
2745
+ "Whether the write created a new file or updated an existing one."
2746
+ ),
2747
+ warnings: z.array(z.string()).optional().describe(
2748
+ "Non-fatal issues the server surfaced alongside the successful write."
2749
+ )
2750
+ });
2751
+ var FsMkdirResultSchema = z.object({
2752
+ path: z.string().describe("Absolute path of the created directory."),
2753
+ action: z.enum(["created", "updated"]).describe(
2754
+ "Whether the directory was newly created or already existed (idempotent)."
2755
+ )
2756
+ });
2757
+ var FsDeleteResultSchema = z.object({
2758
+ path: z.string().describe("Absolute path that was removed from the live tree.")
2759
+ });
2760
+ var FsMoveResultSchema = z.object({
2761
+ from: z.string().describe("Absolute source path (before the move)."),
2762
+ to: z.string().describe("Absolute destination path (after the move).")
2763
+ });
2764
+ var FsDirectoryEntrySchema = z.object({
2765
+ type: z.enum(["file", "directory", "shortcut", "stream"]).describe("Kind of entry. `shortcut` points at a `target_*` sibling."),
2766
+ name: z.string().describe("Basename of the entry (the segment after the last `/`)."),
2767
+ path: z.string().describe("Absolute path of the entry."),
2768
+ size: z.number().int().min(0).optional().describe(
2769
+ "Content size in bytes. Present for files; absent for directories."
2770
+ ),
2771
+ version: z.number().int().min(1).optional().describe("Monotonic version for the underlying file, when applicable."),
2772
+ updated_at: z.string().optional().describe("ISO-8601 timestamp of the last modification."),
2773
+ target_type: z.enum(["file", "directory", "stream"]).nullable().optional().describe(
2774
+ "For `shortcut` entries: the kind of resource the shortcut points at."
2775
+ ),
2776
+ target_path: z.string().nullable().optional().describe(
2777
+ "For `shortcut` entries: the absolute path the shortcut points at."
2778
+ ),
2779
+ accessible: z.boolean().optional().describe(
2780
+ "Whether the caller can read the target. Only meaningful for shortcuts."
2781
+ ),
2782
+ content_type: z.string().optional().describe(
2783
+ "MIME type of a file's content, when the server can determine one."
2784
+ )
2785
+ });
2786
+
2787
+ // src/plugins/vfs/readVfsFile/schemas.ts
2788
+ var ReadVfsFileSchema = z.object({
2789
+ path: absolutePathSchema({ label: "Path" }).describe(
2790
+ "Absolute path of the file to read (must start with `/`)."
2791
+ ),
2792
+ maxBytes: z.number().int().min(1).max(VFS_MAX_CONTENT_BYTES).optional().describe(
2793
+ "Optional cap on returned content length, in bytes. Files are capped at 10 MB, so values above that have no effect."
2794
+ )
2795
+ }).describe(
2796
+ "Read a file from the " + VFS_NAME + ", the file store behind your context repository. Paths are absolute, e.g. `/Mine/notes.md`. Returns the content as a UTF-8 string with its size, version, and last-modified time."
2797
+ );
2798
+ var ReadVfsFileItemSchema = z.object({
2799
+ type: z.literal("file").describe("Discriminator \u2014 always `file` for a file read."),
2800
+ path: z.string().describe("Absolute path of the file that was read."),
2801
+ name: z.string().describe("Basename of the file (the segment after the last `/`)."),
2802
+ content: z.string().describe(
2803
+ "File content as a UTF-8 string, truncated to `maxBytes` when requested."
2804
+ ),
2805
+ size: z.number().int().min(0).describe(
2806
+ "Total content size in bytes (independent of any `maxBytes` truncation)."
2807
+ ),
2808
+ version: z.number().int().min(1).describe("Monotonic version for the file at read time."),
2809
+ updated_at: z.string().describe("ISO-8601 timestamp of the last modification."),
2810
+ canonical_path: z.string().optional().describe(
2811
+ "Absolute path the server resolved after following any shortcut."
2812
+ )
2813
+ });
2814
+
2815
+ // src/plugins/vfs/readVfsFile/index.ts
2816
+ var readVfsFilePlugin = defineMethod({
2817
+ ...vfsDefaults,
2818
+ name: "readVfsFile",
2819
+ imports: [apiPluginRef],
2820
+ itemType: "VfsFile",
2821
+ inputSchema: ReadVfsFileSchema,
2822
+ outputSchema: ReadVfsFileItemSchema,
2823
+ output: "item",
2824
+ formatter: fsDirectoryEntryFormatter,
2825
+ run: async ({ imports, input }) => {
2826
+ const searchParams = { path: input.path };
2827
+ if (input.maxBytes !== void 0) {
2828
+ searchParams.max_bytes = String(input.maxBytes);
2829
+ }
2830
+ const data = await imports.api.get(
2831
+ `${VFS_PATH_PREFIX}/files`,
2832
+ {
2833
+ authRequired: true,
2834
+ searchParams,
2835
+ resource: { type: "vfs_path", id: input.path }
2836
+ }
2837
+ );
2838
+ return { data };
2839
+ }
2840
+ });
2841
+ var fsWriteResultFormatter = defineFormatter({
2842
+ format: ({ item }) => ({
2843
+ title: item.path,
2844
+ details: [
2845
+ { label: "action", text: item.action, style: "normal" },
2846
+ {
2847
+ label: "version",
2848
+ text: String(item.version),
2849
+ style: "normal"
2850
+ },
2851
+ ...item.warnings?.length ? [
2852
+ {
2853
+ label: "warnings",
2854
+ text: item.warnings.join("; "),
2855
+ style: "dim"
2856
+ }
2857
+ ] : []
2858
+ ]
2859
+ })
2860
+ });
2861
+ var WriteVfsFileSchema = z.object({
2862
+ path: absolutePathSchema({ label: "Path" }).describe(
2863
+ "Absolute path of the file (must start with `/`)."
2864
+ ),
2865
+ content: z.string().max(VFS_MAX_CONTENT_BYTES).describe("New file contents. Capped at 10 MB per call."),
2866
+ expectedVersion: z.number().int().min(0).optional().describe(
2867
+ "Optional expected current version for optimistic concurrency. The write fails if the file's actual version differs. Pass `0` to assert the file does not exist yet (versions start at 1)."
2868
+ )
2869
+ }).describe(
2870
+ "Write (create or overwrite) a file in the " + VFS_NAME + ". Paths are absolute (e.g. `/Mine/notes.md`); missing parent directories are created automatically."
2871
+ );
2872
+ var WriteVfsFileItemSchema = FsWriteResultSchema;
2873
+
2874
+ // src/plugins/vfs/writeVfsFile/index.ts
2875
+ var writeVfsFilePlugin = defineMethod({
2876
+ ...vfsDefaults,
2877
+ name: "writeVfsFile",
2878
+ imports: [apiPluginRef],
2879
+ itemType: "VfsWriteResult",
2880
+ inputSchema: WriteVfsFileSchema,
2881
+ outputSchema: WriteVfsFileItemSchema,
2882
+ output: "item",
2883
+ formatter: fsWriteResultFormatter,
2884
+ run: async ({ imports, input }) => {
2885
+ const body = {
2886
+ path: input.path,
2887
+ content: input.content
2888
+ };
2889
+ if (input.expectedVersion !== void 0) {
2890
+ body.expected_version = input.expectedVersion;
2891
+ }
2892
+ const data = await imports.api.put(
2893
+ `${VFS_PATH_PREFIX}/files`,
2894
+ body,
2895
+ {
2896
+ authRequired: true,
2897
+ resource: { type: "vfs_path", id: input.path }
2898
+ }
2899
+ );
2900
+ return { data };
2901
+ }
2902
+ });
2903
+ var AppendVfsFileSchema = z.object({
2904
+ path: absolutePathSchema({ label: "Path" }).describe(
2905
+ "Absolute path of the file (must start with `/`)."
2906
+ ),
2907
+ content: z.string().max(VFS_MAX_CONTENT_BYTES).describe(
2908
+ "Content to append. Capped at 10 MB per call, and the resulting file must also fit under 10 MB."
2909
+ )
2910
+ }).describe(
2911
+ "Append content to a file in the " + VFS_NAME + ". Creates the file if it doesn't exist; missing parent directories are created automatically. Safer than reading the file and rewriting it \u2014 appends server-side without a read/write round-trip. Paths are absolute (e.g. `/Mine/log.md`)."
2912
+ );
2913
+ var AppendVfsFileItemSchema = FsWriteResultSchema;
2914
+
2915
+ // src/plugins/vfs/appendVfsFile/index.ts
2916
+ var appendVfsFilePlugin = defineMethod({
2917
+ ...vfsDefaults,
2918
+ name: "appendVfsFile",
2919
+ imports: [apiPluginRef],
2920
+ itemType: "VfsWriteResult",
2921
+ inputSchema: AppendVfsFileSchema,
2922
+ outputSchema: AppendVfsFileItemSchema,
2923
+ output: "item",
2924
+ formatter: fsWriteResultFormatter,
2925
+ run: async ({ imports, input }) => {
2926
+ const data = await imports.api.post(
2927
+ `${VFS_PATH_PREFIX}/files/append`,
2928
+ { path: input.path, content: input.content },
2929
+ {
2930
+ authRequired: true,
2931
+ resource: { type: "vfs_path", id: input.path }
2932
+ }
2933
+ );
2934
+ return { data };
2935
+ }
2936
+ });
2937
+ var CopyVfsFileSchema = z.object({
2938
+ from: absolutePathSchema({ label: "from" }).describe(
2939
+ "Absolute path of the source file."
2940
+ ),
2941
+ to: absolutePathSchema({
2942
+ label: "to",
2943
+ example: "/Mine/notes-copy.md"
2944
+ }).describe("Absolute path of the destination file."),
2945
+ overwrite: z.boolean().optional().describe(
2946
+ "When `true`, replace any existing file at `to`. Default `false` fails if `to` already exists."
2947
+ ),
2948
+ expectedVersion: z.number().int().min(1).optional().describe(
2949
+ "Optional version pin for the destination. Requires `overwrite: true` and an existing file at `to`; the replace only succeeds if the destination's current version matches, otherwise the call fails."
2950
+ )
2951
+ }).describe(
2952
+ "Copy a file to a new path in the " + VFS_NAME + ". Both `from` and `to` are absolute file paths (e.g. `/Mine/notes.md`), not directories."
2953
+ );
2954
+ var CopyVfsFileItemSchema = FsWriteResultSchema;
2955
+
2956
+ // src/plugins/vfs/copyVfsFile/index.ts
2957
+ var copyVfsFilePlugin = defineMethod({
2958
+ ...vfsDefaults,
2959
+ name: "copyVfsFile",
2960
+ imports: [apiPluginRef],
2961
+ itemType: "VfsWriteResult",
2962
+ inputSchema: CopyVfsFileSchema,
2963
+ outputSchema: CopyVfsFileItemSchema,
2964
+ output: "item",
2965
+ formatter: fsWriteResultFormatter,
2966
+ run: async ({ imports, input }) => {
2967
+ const body = { from: input.from, to: input.to };
2968
+ if (input.overwrite !== void 0) body.overwrite = input.overwrite;
2969
+ if (input.expectedVersion !== void 0) {
2970
+ body.expected_version = input.expectedVersion;
2971
+ }
2972
+ const data = await imports.api.post(
2973
+ `${VFS_PATH_PREFIX}/files/copy`,
2974
+ body,
2975
+ {
2976
+ authRequired: true,
2977
+ resource: { type: "vfs_path", id: input.from }
2978
+ }
2979
+ );
2980
+ return { data };
2981
+ }
2982
+ });
2983
+ var ListVfsDirectorySchema = z.object({
2984
+ path: absolutePathSchema({ label: "Path", example: "/Mine" }).describe(
2985
+ "Absolute path of the directory (must start with `/`)."
2986
+ ),
2987
+ pageSize: z.number().int().min(1).max(500).optional().describe("Entries per page (default 50, max 500)."),
2988
+ maxItems: z.number().int().min(1).optional().describe("Maximum total entries to return across all pages."),
2989
+ cursor: z.string().optional().describe("Cursor to resume from, as returned in `nextCursor`.")
2990
+ }).describe(
2991
+ "List one page of a directory's contents in the " + VFS_NAME + ". Paths are absolute (e.g. `/Mine`). Pass the previous page's `nextCursor` back in `cursor` to fetch the next page."
2992
+ );
2993
+
2994
+ // src/plugins/vfs/listVfsDirectory/index.ts
2995
+ var listVfsDirectoryPlugin = defineMethod({
2996
+ ...vfsDefaults,
2997
+ name: "listVfsDirectory",
2998
+ imports: [apiPluginRef],
2999
+ type: "list",
3000
+ itemType: "VfsDirectoryEntry",
3001
+ inputSchema: ListVfsDirectorySchema,
3002
+ outputSchema: FsDirectoryEntrySchema,
3003
+ output: "list",
3004
+ formatter: fsDirectoryEntryFormatter,
3005
+ run: async ({ imports, input }) => {
3006
+ const searchParams = { path: input.path };
3007
+ if (input.pageSize !== void 0) {
3008
+ searchParams.limit = String(input.pageSize);
3009
+ }
3010
+ if (input.cursor !== void 0) {
3011
+ searchParams.cursor = input.cursor;
3012
+ }
3013
+ const page = await imports.api.get(
3014
+ `${VFS_PATH_PREFIX}/directories`,
3015
+ {
3016
+ authRequired: true,
3017
+ searchParams,
3018
+ resource: { type: "vfs_path", id: input.path }
3019
+ }
3020
+ );
3021
+ return {
3022
+ data: page.results,
3023
+ nextCursor: page.meta.next_cursor ?? void 0
3024
+ };
3025
+ }
3026
+ });
3027
+ var CreateVfsDirectorySchema = z.object({
3028
+ path: absolutePathSchema({
3029
+ label: "Path",
3030
+ example: "/Mine/notes"
3031
+ }).describe("Absolute path of the directory (must start with `/`).")
3032
+ }).describe(
3033
+ "Create a directory in the " + VFS_NAME + ". Paths are absolute (e.g. `/Mine/notes`). Idempotent \u2014 safe to call on an existing directory."
3034
+ );
3035
+ var CreateVfsDirectoryItemSchema = FsMkdirResultSchema;
3036
+
3037
+ // src/plugins/vfs/createVfsDirectory/index.ts
3038
+ var createVfsDirectoryPlugin = defineMethod({
3039
+ ...vfsDefaults,
3040
+ name: "createVfsDirectory",
3041
+ imports: [apiPluginRef],
3042
+ itemType: "VfsMkdirResult",
3043
+ inputSchema: CreateVfsDirectorySchema,
3044
+ outputSchema: CreateVfsDirectoryItemSchema,
3045
+ output: "item",
3046
+ run: async ({ imports, input }) => {
3047
+ const data = await imports.api.put(
3048
+ `${VFS_PATH_PREFIX}/directories`,
3049
+ { path: input.path },
3050
+ {
3051
+ authRequired: true,
3052
+ resource: { type: "vfs_path", id: input.path }
3053
+ }
3054
+ );
3055
+ return { data };
3056
+ }
3057
+ });
3058
+ var StatVfsPathSchema = z.object({
3059
+ path: absolutePathSchema({ label: "Path" }).describe(
3060
+ "Absolute path to stat (must start with `/`)."
3061
+ )
3062
+ }).describe(
3063
+ "Inspect metadata for any path (file, directory, shortcut, or stream) in the " + VFS_NAME + ". Paths are absolute (e.g. `/Mine/notes.md`). Check the `type` field before reading fields that only exist for certain types."
3064
+ );
3065
+ var StatVfsPathItemSchema = FsDirectoryEntrySchema;
3066
+
3067
+ // src/plugins/vfs/statVfsPath/index.ts
3068
+ var statVfsPathPlugin = defineMethod({
3069
+ ...vfsDefaults,
3070
+ name: "statVfsPath",
3071
+ imports: [apiPluginRef],
3072
+ itemType: "VfsStat",
3073
+ inputSchema: StatVfsPathSchema,
3074
+ outputSchema: StatVfsPathItemSchema,
3075
+ output: "item",
3076
+ formatter: fsDirectoryEntryFormatter,
3077
+ run: async ({ imports, input }) => {
3078
+ const data = await imports.api.get(
3079
+ `${VFS_PATH_PREFIX}/paths`,
3080
+ {
3081
+ authRequired: true,
3082
+ searchParams: { path: input.path },
3083
+ resource: { type: "vfs_path", id: input.path }
3084
+ }
3085
+ );
3086
+ return { data };
3087
+ }
3088
+ });
3089
+ var DeleteVfsPathSchema = z.object({
3090
+ path: absolutePathSchema({ label: "Path" }).describe(
3091
+ "Absolute path to delete (must start with `/`)."
3092
+ )
3093
+ }).describe(
3094
+ "Delete a file or directory in the " + VFS_NAME + ". Works on either; paths are absolute (e.g. `/Mine/notes.md`). Deletes are recoverable \u2014 contact Zapier support to restore an entry."
3095
+ );
3096
+ var DeleteVfsPathItemSchema = FsDeleteResultSchema;
3097
+
3098
+ // src/plugins/vfs/deleteVfsPath/index.ts
3099
+ var deleteVfsPathPlugin = defineMethod({
3100
+ ...vfsDefaults,
3101
+ name: "deleteVfsPath",
3102
+ imports: [apiPluginRef],
3103
+ type: "delete",
3104
+ itemType: "VfsDeleteResult",
3105
+ // `type: "delete"` defaults the documented return to `{ success: boolean }`,
3106
+ // but this method returns `{ data: { path } }`; name the real item type.
3107
+ returnType: "VfsDeleteResultItem",
3108
+ // Match the other delete methods: prompt in the CLI before removing a path.
3109
+ confirm: "delete",
3110
+ inputSchema: DeleteVfsPathSchema,
3111
+ outputSchema: DeleteVfsPathItemSchema,
3112
+ output: "item",
3113
+ run: async ({ imports, input }) => {
3114
+ const data = await imports.api.delete(
3115
+ `${VFS_PATH_PREFIX}/paths`,
3116
+ void 0,
3117
+ {
3118
+ authRequired: true,
3119
+ searchParams: { path: input.path },
3120
+ resource: { type: "vfs_path", id: input.path }
3121
+ }
3122
+ );
3123
+ return { data };
3124
+ }
3125
+ });
3126
+ var MoveVfsPathSchema = z.object({
3127
+ from: absolutePathSchema({ label: "from" }).describe(
3128
+ "Absolute path of the source entry."
3129
+ ),
3130
+ to: absolutePathSchema({
3131
+ label: "to",
3132
+ example: "/Mine/archive/notes.md"
3133
+ }).describe("New absolute path for the entry.")
3134
+ }).describe(
3135
+ "Move (rename) a file or directory in the " + VFS_NAME + ". Both `from` and `to` are absolute paths (e.g. `/Mine/notes.md`). Fails if an entry already exists at `to` \u2014 delete or rename it first."
3136
+ );
3137
+ var MoveVfsPathItemSchema = FsMoveResultSchema;
3138
+
3139
+ // src/plugins/vfs/moveVfsPath/index.ts
3140
+ var moveVfsPathPlugin = defineMethod({
3141
+ ...vfsDefaults,
3142
+ name: "moveVfsPath",
3143
+ imports: [apiPluginRef],
3144
+ itemType: "VfsMoveResult",
3145
+ inputSchema: MoveVfsPathSchema,
3146
+ outputSchema: MoveVfsPathItemSchema,
3147
+ output: "item",
3148
+ run: async ({ imports, input }) => {
3149
+ const data = await imports.api.post(
3150
+ `${VFS_PATH_PREFIX}/paths/move`,
3151
+ { from: input.from, to: input.to },
3152
+ {
3153
+ authRequired: true,
3154
+ resource: { type: "vfs_path", id: input.from }
3155
+ }
3156
+ );
3157
+ return { data };
3158
+ }
3159
+ });
2693
3160
 
2694
3161
  // src/experimental.ts
2695
3162
  var zapierExperimentalSdkPlugin = definePlugin({
@@ -2738,7 +3205,19 @@ var zapierExperimentalSdkPlugin = definePlugin({
2738
3205
  getAgenticManagementConfigPlugin,
2739
3206
  updateAgenticManagementConfigPlugin,
2740
3207
  getAgenticManagementIntentPlugin,
2741
- updateAgenticManagementIntentPlugin
3208
+ updateAgenticManagementIntentPlugin,
3209
+ // VFS (experimental). Also routed through the Public API Gateway — see the
3210
+ // `/vfs` entry in api/routing/config.ts. `list*` is exported before the
3211
+ // other methods per the same listing-first convention as code substrate.
3212
+ listVfsDirectoryPlugin,
3213
+ readVfsFilePlugin,
3214
+ writeVfsFilePlugin,
3215
+ appendVfsFilePlugin,
3216
+ copyVfsFilePlugin,
3217
+ createVfsDirectoryPlugin,
3218
+ statVfsPathPlugin,
3219
+ deleteVfsPathPlugin,
3220
+ moveVfsPathPlugin
2742
3221
  ]
2743
3222
  });
2744
3223
  function createZapierSdk(options = {}) {