MCPcopy Index your code
hub / github.com/simstudioai/sim / collectUserFileKeysInto

Function collectUserFileKeysInto

apps/sim/lib/core/utils/user-file.ts:54–79  ·  view source on GitHub ↗
(value: unknown, keys: Set<string>, seen: WeakSet<object>)

Source from the content-addressed store, hash-verified

52}
53
54function collectUserFileKeysInto(value: unknown, keys: Set<string>, seen: WeakSet<object>): void {
55 if (!value || typeof value !== 'object') {
56 return
57 }
58
59 if (seen.has(value)) {
60 return
61 }
62 seen.add(value)
63
64 if (isUserFileWithMetadata(value)) {
65 keys.add(value.key)
66 return
67 }
68
69 if (Array.isArray(value)) {
70 for (const item of value) {
71 collectUserFileKeysInto(item, keys, seen)
72 }
73 return
74 }
75
76 for (const item of Object.values(value)) {
77 collectUserFileKeysInto(item, keys, seen)
78 }
79}
80
81/**
82 * Checks if a value matches the display-safe UserFile metadata shape after internal fields are stripped.

Callers 1

collectUserFileKeysFunction · 0.85

Calls 2

isUserFileWithMetadataFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected