MCPcopy Create free account
hub / github.com/TanStack/db / validateJsonSerializable

Function validateJsonSerializable

packages/db/src/local-storage.ts:133–146  ·  view source on GitHub ↗

* Validates that a value can be JSON serialized * @param parser - The parser to use for serialization * @param value - The value to validate for JSON serialization * @param operation - The operation type being performed (for error messages) * @throws Error if the value cannot be JSON serialized

(
  parser: Parser,
  value: any,
  operation: string,
)

Source from the content-addressed store, hash-verified

131 * @throws Error if the value cannot be JSON serialized
132 */
133function validateJsonSerializable(
134 parser: Parser,
135 value: any,
136 operation: string,
137): void {
138 try {
139 parser.stringify(value)
140 } catch (error) {
141 throw new SerializationError(
142 operation,
143 error instanceof Error ? error.message : String(error),
144 )
145 }
146}
147
148/**
149 * Generate a UUID for version tracking

Callers 5

wrappedOnInsertFunction · 0.85
wrappedOnUpdateFunction · 0.85
acceptMutationsFunction · 0.85
processStorageChangesFunction · 0.85
createLocalStorageSyncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected