@composio/core 0.16.0 → 0.18.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.
- package/dist/{CustomTool-Bk38kFp0.d.mts → CustomTool-BKhHv2hJ.d.mts} +1 -1
- package/dist/{CustomTool-l-j5HtEf.mjs → CustomTool-C4tv-GL1.mjs} +1 -1
- package/dist/FileToolModifier.utils.neutral-D_YkHwZP.mjs +188 -0
- package/dist/{Telemetry-DuGJSwUt.mjs → Telemetry-CBtSnWrm.mjs} +27 -11
- package/dist/cancellation-jUVItfHw.mjs +704 -0
- package/dist/{composio-DSs-1AhC.d.mts → composio-CldtZUyC.d.mts} +254 -247
- package/dist/{BaseProvider-D7p2OPEx.d.mts → customTool.types-DC5fPOOi.d.mts} +2954 -82
- package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +1 -1
- package/dist/{errors-BcEUHZbq.mjs → errors-DyZt79fi.mjs} +3 -0
- package/dist/experimental/index.d.mts +2 -2
- package/dist/experimental/index.mjs +1 -1
- package/dist/{fileUtils.node-BQ0fWge3.mjs → fileUtils.node-BwpUOF0s.mjs} +4 -4
- package/dist/index.d.mts +105 -7
- package/dist/index.mjs +94 -116
- package/dist/models/Files.node.mjs +2 -2
- package/dist/{sensitiveFileUploadPaths-BVEt0peg.mjs → sensitiveFileUploadPaths-B0w8dqpv.mjs} +23 -6
- package/dist/ssrfGuard.node-DlxO8uzr.mjs +307 -0
- package/dist/{types-B4k-qoOf.d.mts → types-BgsRW-XH.d.mts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +57 -101
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.workerd.mjs +1 -1
- package/dist/utils/ssrfGuard.node.d.mts +25 -6
- package/dist/utils/ssrfGuard.node.mjs +2 -152
- package/dist/utils/ssrfGuard.workerd.d.mts +13 -1
- package/dist/utils/ssrfGuard.workerd.mjs +13 -1
- package/package.json +8 -4
- package/src/errors/ToolErrors.ts +1 -0
- package/src/errors/ValidationErrors.ts +2 -0
- package/src/index.ts +6 -0
- package/src/models/RemoteFile.ts +7 -2
- package/src/models/ToolRouterSession.ts +36 -8
- package/src/models/ToolRouterSessionFileMount.ts +14 -8
- package/src/models/Tools.ts +102 -39
- package/src/provider/BaseProvider.ts +53 -1
- package/src/provider/OpenAIProvider.ts +43 -15
- package/src/services/telemetry/TelemetryService.ts +27 -12
- package/src/types/provider.types.ts +15 -0
- package/src/utils/fileUtils.node.ts +8 -2
- package/src/utils/jsonSchema.ts +505 -27
- package/src/utils/modifiers/FileToolModifier.node.ts +85 -181
- package/src/utils/modifiers/FileToolModifier.utils.neutral.ts +199 -0
- package/src/utils/pinnedDispatcher.node.ts +118 -0
- package/src/utils/sensitiveFileUploadPaths.ts +36 -9
- package/src/utils/ssrfGuard.node.ts +100 -11
- package/src/utils/ssrfGuard.workerd.ts +16 -0
- package/dist/FileToolModifier.utils.neutral-B5rT711M.mjs +0 -72
- package/dist/cancellation-NVtGf3St.mjs +0 -364
- package/dist/customTool.types-cGHcIBX-.d.mts +0 -2859
|
@@ -31,10 +31,29 @@ const SECRET_LIKE_BASENAME = /^(\.env(\.|$)|\.netrc$|\.pgpass$)/i;
|
|
|
31
31
|
/** Default SSH private key basenames (public keys like id_rsa.pub are allowed). */
|
|
32
32
|
const DEFAULT_PRIVATE_KEY_BASENAME = /^id_(rsa|ed25519|ecdsa|dsa|ecdsa_sk)(\.old)?$/i;
|
|
33
33
|
|
|
34
|
+
const splitSegments = (aPath: string): string[] => aPath.split(/[/\\]+/).filter(Boolean);
|
|
35
|
+
|
|
34
36
|
/**
|
|
35
37
|
* Returns normalized path segments, resolving symlinks when the path exists.
|
|
38
|
+
*
|
|
39
|
+
* Both the written path and the symlink-resolved one are returned, because a
|
|
40
|
+
* denied segment can be hidden by a symlink in either direction:
|
|
41
|
+
*
|
|
42
|
+
* - `~/innocent-name` -> `~/nested/.aws/creds` hides `.aws` from the written
|
|
43
|
+
* path, so the denylist has to see the resolved one.
|
|
44
|
+
* - `~/.claude` -> `/state/claude` hides `.claude` from the *resolved* path,
|
|
45
|
+
* so the denylist also has to see the written one. Dotfile managers
|
|
46
|
+
* (chezmoi, stow, yadm) and containerised home directories produce exactly
|
|
47
|
+
* this layout.
|
|
48
|
+
*
|
|
49
|
+
* Matching only the resolved path silently turns the denylist off for the
|
|
50
|
+
* second case.
|
|
36
51
|
*/
|
|
37
|
-
function normalizePath(filePath: string): {
|
|
52
|
+
function normalizePath(filePath: string): {
|
|
53
|
+
resolvedPath: string;
|
|
54
|
+
segments: string[];
|
|
55
|
+
writtenSegments: string[];
|
|
56
|
+
} {
|
|
38
57
|
const absolute = platform.resolvePath(filePath);
|
|
39
58
|
let resolved = absolute;
|
|
40
59
|
try {
|
|
@@ -46,7 +65,8 @@ function normalizePath(filePath: string): { resolvedPath: string; segments: stri
|
|
|
46
65
|
}
|
|
47
66
|
return {
|
|
48
67
|
resolvedPath: resolved,
|
|
49
|
-
segments: resolved
|
|
68
|
+
segments: splitSegments(resolved),
|
|
69
|
+
writtenSegments: splitSegments(absolute),
|
|
50
70
|
};
|
|
51
71
|
}
|
|
52
72
|
|
|
@@ -65,7 +85,7 @@ function getSensitiveFileUploadPathBlockReason(
|
|
|
65
85
|
filePath: string,
|
|
66
86
|
additionalDenySegments?: string[]
|
|
67
87
|
): string | null {
|
|
68
|
-
const { resolvedPath, segments } = normalizePath(filePath);
|
|
88
|
+
const { resolvedPath, segments, writtenSegments } = normalizePath(filePath);
|
|
69
89
|
const isCaseSensitive = platform.isFileSystemCaseSensitive?.(resolvedPath) ?? true;
|
|
70
90
|
const normalizeSegment = (segment: string) => (isCaseSensitive ? segment : segment.toLowerCase());
|
|
71
91
|
const deny = new Set(
|
|
@@ -75,15 +95,22 @@ function getSensitiveFileUploadPathBlockReason(
|
|
|
75
95
|
].map(normalizeSegment)
|
|
76
96
|
);
|
|
77
97
|
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
98
|
+
for (const candidate of [segments, writtenSegments]) {
|
|
99
|
+
const segmentsForMatch = isCaseSensitive ? candidate : candidate.map(normalizeSegment);
|
|
100
|
+
for (let i = 0; i < candidate.length; i++) {
|
|
101
|
+
if (deny.has(segmentsForMatch[i]!)) {
|
|
102
|
+
return `path segment "${candidate[i]}" is in the sensitive file upload denylist`;
|
|
103
|
+
}
|
|
82
104
|
}
|
|
83
105
|
}
|
|
84
106
|
|
|
85
|
-
|
|
86
|
-
|
|
107
|
+
// Same two directions as the segment scan: `~/.env -> /state/config` hides a
|
|
108
|
+
// denied basename from the resolved path, and a symlink pointing *at* a
|
|
109
|
+
// credential file hides it from the written one.
|
|
110
|
+
const basenames = [segments.at(-1), writtenSegments.at(-1)].filter(
|
|
111
|
+
(name): name is string => !!name
|
|
112
|
+
);
|
|
113
|
+
for (const basename of basenames) {
|
|
87
114
|
if (SECRET_LIKE_BASENAME.test(basename) || DEFAULT_PRIVATE_KEY_BASENAME.test(basename)) {
|
|
88
115
|
return `file name "${basename}" looks like a credential, env, or private key file`;
|
|
89
116
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { lookup } from 'node:dns/promises'; // we're in a Node.js-specific module
|
|
2
2
|
import { isIP } from 'node:net';
|
|
3
3
|
import { ComposioBlockedInternalUrlError } from '../errors/SsrfErrors';
|
|
4
|
+
import { createPinnedDispatcher, hasCustomGlobalDispatcher } from './pinnedDispatcher.node';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* SSRF guard for user-supplied URL file inputs.
|
|
@@ -16,14 +17,43 @@ import { ComposioBlockedInternalUrlError } from '../errors/SsrfErrors';
|
|
|
16
17
|
* which defeats decimal/octal/hex IP obfuscation) before every fetch, and
|
|
17
18
|
* follows redirects manually so each hop is re-validated.
|
|
18
19
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* The address that was validated is also the address connected to: `fetch` gets
|
|
21
|
+
* a dispatcher pinned to it (see {@link createPinnedDispatcher}), so the
|
|
22
|
+
* hostname is never resolved a second time. Without that, a name could resolve
|
|
23
|
+
* to a public address during validation and rebind to an internal one before
|
|
24
|
+
* the connect — a TOCTOU window the Python guard closes the same way.
|
|
25
|
+
*
|
|
26
|
+
* Residual: a hop whose effective dispatcher is a configured route — a
|
|
27
|
+
* caller-supplied `init.dispatcher`, a non-stock global dispatcher (a
|
|
28
|
+
* `ProxyAgent` or `EnvHttpProxyAgent` installed via `setGlobalDispatcher`), or
|
|
29
|
+
* the runtime's env-proxy mode (`NODE_USE_ENV_PROXY`) — keeps only the
|
|
30
|
+
* pre-flight validation. Pinning would dial the validated address instead of
|
|
31
|
+
* the proxy, and the proxy resolves the hostname itself where the SDK cannot
|
|
32
|
+
* see or pin that resolution. The Python guard carries the same residual for
|
|
33
|
+
* the same reason (`_proxy_applies`).
|
|
23
34
|
*/
|
|
24
35
|
|
|
25
36
|
const MAX_REDIRECTS = 5;
|
|
26
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Whether the runtime would route `url` through an env proxy the SDK cannot
|
|
40
|
+
* see into. Only meaningful when `NODE_USE_ENV_PROXY` opts the built-in
|
|
41
|
+
* `fetch` into env proxies (Node >= 24); without that flag the runtime's
|
|
42
|
+
* `fetch` ignores `HTTP_PROXY`/`HTTPS_PROXY` entirely, so mirroring Python's
|
|
43
|
+
* bare env-var check would drop pinning for users whose fetch never proxied.
|
|
44
|
+
*
|
|
45
|
+
* `NO_PROXY=*` is the one bypass honored precisely (nothing is proxied, so
|
|
46
|
+
* pinning is safe again); per-host `NO_PROXY` entries are treated
|
|
47
|
+
* conservatively as proxied rather than parsed.
|
|
48
|
+
*/
|
|
49
|
+
const envProxyApplies = (url: URL): boolean => {
|
|
50
|
+
const useEnvProxy = ['1', 'true'].includes((process.env.NODE_USE_ENV_PROXY ?? '').toLowerCase());
|
|
51
|
+
if (!useEnvProxy) return false;
|
|
52
|
+
if ((process.env.NO_PROXY ?? process.env.no_proxy ?? '') === '*') return false;
|
|
53
|
+
const schemeVar = url.protocol === 'https:' ? 'HTTPS_PROXY' : 'HTTP_PROXY';
|
|
54
|
+
return Boolean(process.env[schemeVar] ?? process.env[schemeVar.toLowerCase()]);
|
|
55
|
+
};
|
|
56
|
+
|
|
27
57
|
const ipv4ToLong = (ip: string): number => {
|
|
28
58
|
const [a, b, c, d] = ip.split('.').map(Number);
|
|
29
59
|
return (((a << 24) >>> 0) | (b << 16) | (c << 8) | d) >>> 0;
|
|
@@ -133,8 +163,12 @@ export const isBlockedIp = (ip: string): boolean => {
|
|
|
133
163
|
* Validate a single URL: it must be http(s), its host must resolve, and every
|
|
134
164
|
* resolved address must be publicly routable. Throws
|
|
135
165
|
* {@link ComposioBlockedInternalUrlError} otherwise.
|
|
166
|
+
*
|
|
167
|
+
* @returns the validated addresses to connect to, in resolver order. Callers
|
|
168
|
+
* must connect to *those* rather than let the client resolve the hostname
|
|
169
|
+
* again; see {@link ssrfSafeFetch}.
|
|
136
170
|
*/
|
|
137
|
-
export const assertSafeFetchTarget = async (rawUrl: string): Promise<
|
|
171
|
+
export const assertSafeFetchTarget = async (rawUrl: string): Promise<string[]> => {
|
|
138
172
|
let url: URL;
|
|
139
173
|
try {
|
|
140
174
|
url = new URL(rawUrl);
|
|
@@ -158,6 +192,10 @@ export const assertSafeFetchTarget = async (rawUrl: string): Promise<void> => {
|
|
|
158
192
|
throw new ComposioBlockedInternalUrlError(`Could not resolve host "${host}"`, { url: rawUrl });
|
|
159
193
|
}
|
|
160
194
|
|
|
195
|
+
if (resolved.length === 0) {
|
|
196
|
+
throw new ComposioBlockedInternalUrlError(`Could not resolve host "${host}"`, { url: rawUrl });
|
|
197
|
+
}
|
|
198
|
+
|
|
161
199
|
for (const { address } of resolved) {
|
|
162
200
|
if (isBlockedIp(address)) {
|
|
163
201
|
throw new ComposioBlockedInternalUrlError(
|
|
@@ -166,13 +204,22 @@ export const assertSafeFetchTarget = async (rawUrl: string): Promise<void> => {
|
|
|
166
204
|
);
|
|
167
205
|
}
|
|
168
206
|
}
|
|
207
|
+
|
|
208
|
+
// Every answer was validated, so all of them are safe to connect to, and
|
|
209
|
+
// resolver order is the system's own address preference.
|
|
210
|
+
return resolved.map(({ address }) => address);
|
|
169
211
|
};
|
|
170
212
|
|
|
171
213
|
/**
|
|
172
|
-
* Drop-in replacement for `fetch` that blocks SSRF. Validates the target
|
|
173
|
-
*
|
|
174
|
-
* manually up to {@link MAX_REDIRECTS}).
|
|
175
|
-
* cancelled; non-redirect responses are
|
|
214
|
+
* Drop-in replacement for `fetch` that blocks SSRF. Validates the target, then
|
|
215
|
+
* connects to the address it validated, and re-validates and re-pins every
|
|
216
|
+
* redirect hop (redirects are followed manually up to {@link MAX_REDIRECTS}).
|
|
217
|
+
* Intermediate redirect bodies are cancelled; non-redirect responses are
|
|
218
|
+
* returned unchanged.
|
|
219
|
+
*
|
|
220
|
+
* A hop whose effective dispatcher is a configured route (caller-supplied
|
|
221
|
+
* `init.dispatcher`, non-stock global dispatcher, env-proxy mode) is *not*
|
|
222
|
+
* pinned — see the module residual above.
|
|
176
223
|
*/
|
|
177
224
|
export const ssrfSafeFetch = async (
|
|
178
225
|
rawUrl: string,
|
|
@@ -182,9 +229,40 @@ export const ssrfSafeFetch = async (
|
|
|
182
229
|
let currentUrl = rawUrl;
|
|
183
230
|
|
|
184
231
|
for (let hop = 0; hop <= maxRedirects; hop++) {
|
|
185
|
-
await assertSafeFetchTarget(currentUrl);
|
|
232
|
+
const addresses = await assertSafeFetchTarget(currentUrl);
|
|
233
|
+
|
|
234
|
+
// Pinning replaces the connect target; through a configured route that
|
|
235
|
+
// would dial the validated origin instead of the route's next hop (the
|
|
236
|
+
// proxy), so those hops keep the pre-flight check only.
|
|
237
|
+
const callerDispatcher = (init as RequestInit & { dispatcher?: unknown }).dispatcher;
|
|
238
|
+
const respectConfiguredRoute =
|
|
239
|
+
callerDispatcher !== undefined ||
|
|
240
|
+
envProxyApplies(new URL(currentUrl)) ||
|
|
241
|
+
hasCustomGlobalDispatcher();
|
|
242
|
+
|
|
243
|
+
const dispatcher = respectConfiguredRoute ? undefined : await createPinnedDispatcher(addresses);
|
|
186
244
|
|
|
187
|
-
|
|
245
|
+
let response: Response;
|
|
246
|
+
try {
|
|
247
|
+
// `dispatcher` is a Node-only extension to `RequestInit`.
|
|
248
|
+
response = await fetch(
|
|
249
|
+
currentUrl,
|
|
250
|
+
(dispatcher === undefined
|
|
251
|
+
? { ...init, redirect: 'manual' }
|
|
252
|
+
: { ...init, redirect: 'manual', dispatcher }) as RequestInit
|
|
253
|
+
);
|
|
254
|
+
} catch (error) {
|
|
255
|
+
if (dispatcher !== undefined) {
|
|
256
|
+
await dispatcher.close().catch(() => undefined);
|
|
257
|
+
}
|
|
258
|
+
throw error;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// `close()` is graceful: it waits for the in-flight request — including a
|
|
262
|
+
// body still being streamed to the caller — before releasing the socket.
|
|
263
|
+
if (dispatcher !== undefined) {
|
|
264
|
+
void dispatcher.close().catch(() => undefined);
|
|
265
|
+
}
|
|
188
266
|
|
|
189
267
|
const isRedirect =
|
|
190
268
|
response.status >= 300 && response.status < 400 && response.headers.has('location');
|
|
@@ -204,3 +282,14 @@ export const ssrfSafeFetch = async (
|
|
|
204
282
|
{ url: rawUrl }
|
|
205
283
|
);
|
|
206
284
|
};
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* {@link ssrfSafeFetch} for call sites that must keep working on every runtime.
|
|
288
|
+
*
|
|
289
|
+
* `ssrfSafeFetch` fails closed in edge runtimes, which is right for a URL the
|
|
290
|
+
* caller chose to upload — the alternative is fetching it unvalidated — but not
|
|
291
|
+
* for Tool Router session file transfers, where refusing would remove a working
|
|
292
|
+
* feature from Workers rather than close a hole reachable there. On Node this
|
|
293
|
+
* is the full guard; only the edge build differs.
|
|
294
|
+
*/
|
|
295
|
+
export const ssrfSafeFetchWhereSupported = ssrfSafeFetch;
|
|
@@ -17,3 +17,19 @@ export const ssrfSafeFetch = async (rawUrl: string): Promise<Response> => {
|
|
|
17
17
|
}
|
|
18
18
|
);
|
|
19
19
|
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Unguarded `fetch`, for the call sites that must keep working here.
|
|
23
|
+
*
|
|
24
|
+
* Failing closed is the right default for a URL the caller chose to upload, but
|
|
25
|
+
* applying it to Tool Router session file transfers would take a working
|
|
26
|
+
* feature away from Workers instead of closing a hole reachable there. The
|
|
27
|
+
* guard exists to stop a URL from reaching private address space the SDK's host
|
|
28
|
+
* can see; an edge worker has no such vantage point — it cannot resolve DNS to
|
|
29
|
+
* check, and its `fetch` does not originate inside the caller's network. The
|
|
30
|
+
* Node build applies the full guard.
|
|
31
|
+
*/
|
|
32
|
+
export const ssrfSafeFetchWhereSupported = async (
|
|
33
|
+
rawUrl: string,
|
|
34
|
+
init: RequestInit = {}
|
|
35
|
+
): Promise<Response> => fetch(rawUrl, init);
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
//#region src/utils/modifiers/FileToolModifier.utils.neutral.ts
|
|
2
|
-
function isPlainObject(val) {
|
|
3
|
-
return typeof val === "object" && val !== null && !Array.isArray(val);
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Transforms a single JSON schema property, recursively handling nested properties,
|
|
7
|
-
* anyOf, oneOf, and allOf.
|
|
8
|
-
*/
|
|
9
|
-
const transformSchema = (property) => {
|
|
10
|
-
if (property.file_uploadable) return {
|
|
11
|
-
title: property.title,
|
|
12
|
-
description: property.description,
|
|
13
|
-
format: "path",
|
|
14
|
-
type: "string",
|
|
15
|
-
file_uploadable: true
|
|
16
|
-
};
|
|
17
|
-
const newProperty = { ...property };
|
|
18
|
-
if (property.type === "object" && property.properties) newProperty.properties = transformProperties(property.properties);
|
|
19
|
-
if (property.anyOf) newProperty.anyOf = property.anyOf.map(transformSchema);
|
|
20
|
-
if (property.oneOf) newProperty.oneOf = property.oneOf.map(transformSchema);
|
|
21
|
-
if (property.allOf) newProperty.allOf = property.allOf.map(transformSchema);
|
|
22
|
-
if (property.items) if (Array.isArray(property.items)) newProperty.items = property.items.map(transformSchema);
|
|
23
|
-
else newProperty.items = transformSchema(property.items);
|
|
24
|
-
return newProperty;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Transforms the properties of the tool schema to include the file upload URL.
|
|
28
|
-
*
|
|
29
|
-
* Attaches the format: 'path' to the properties that are file uploadable for agents.
|
|
30
|
-
*
|
|
31
|
-
* @param properties - The properties of the tool schema.
|
|
32
|
-
* @returns The transformed properties.
|
|
33
|
-
*/
|
|
34
|
-
const transformProperties = (properties) => {
|
|
35
|
-
const newProperties = {};
|
|
36
|
-
for (const [key, property] of Object.entries(properties)) newProperties[key] = transformSchema(property);
|
|
37
|
-
return newProperties;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Recursively checks if a schema (or any of its variants) contains a specific file property.
|
|
41
|
-
*/
|
|
42
|
-
const schemaHasFileProperty = (schema, property) => {
|
|
43
|
-
if (!schema) return false;
|
|
44
|
-
if (schema[property]) return true;
|
|
45
|
-
if (schema.properties) {
|
|
46
|
-
for (const prop of Object.values(schema.properties)) if (schemaHasFileProperty(prop, property)) return true;
|
|
47
|
-
}
|
|
48
|
-
if (schema.anyOf) {
|
|
49
|
-
for (const variant of schema.anyOf) if (schemaHasFileProperty(variant, property)) return true;
|
|
50
|
-
}
|
|
51
|
-
if (schema.oneOf) {
|
|
52
|
-
for (const variant of schema.oneOf) if (schemaHasFileProperty(variant, property)) return true;
|
|
53
|
-
}
|
|
54
|
-
if (schema.allOf) {
|
|
55
|
-
for (const variant of schema.allOf) if (schemaHasFileProperty(variant, property)) return true;
|
|
56
|
-
}
|
|
57
|
-
if (schema.items) {
|
|
58
|
-
if (Array.isArray(schema.items)) {
|
|
59
|
-
for (const item of schema.items) if (schemaHasFileProperty(item, property)) return true;
|
|
60
|
-
} else if (schemaHasFileProperty(schema.items, property)) return true;
|
|
61
|
-
}
|
|
62
|
-
return false;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Recursively checks if a schema (or any of its variants) contains file_uploadable properties.
|
|
66
|
-
*/
|
|
67
|
-
const schemaHasFileUploadable = (schema) => {
|
|
68
|
-
return schemaHasFileProperty(schema, "file_uploadable");
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
//#endregion
|
|
72
|
-
export { transformProperties as i, schemaHasFileProperty as n, schemaHasFileUploadable as r, isPlainObject as t };
|