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

Function assertValidResponse

packages/electron-db-sqlite-persistence/src/renderer.ts:68–89  ·  view source on GitHub ↗
(
  response: ElectronPersistenceResponseEnvelope,
  request: ElectronPersistenceRequestEnvelope,
)

Source from the content-addressed store, hash-verified

66}
67
68function assertValidResponse(
69 response: ElectronPersistenceResponseEnvelope,
70 request: ElectronPersistenceRequestEnvelope,
71): void {
72 if (response.v !== ELECTRON_PERSISTENCE_PROTOCOL_VERSION) {
73 throw new InvalidPersistedCollectionConfigError(
74 `Unexpected electron persistence protocol version "${response.v}" in response`,
75 )
76 }
77
78 if (response.requestId !== request.requestId) {
79 throw new InvalidPersistedCollectionConfigError(
80 `Mismatched electron persistence response request id. Expected "${request.requestId}", received "${response.requestId}"`,
81 )
82 }
83
84 if (response.method !== request.method) {
85 throw new InvalidPersistedCollectionConfigError(
86 `Mismatched electron persistence response method. Expected "${request.method}", received "${response.method}"`,
87 )
88 }
89}
90
91function createSerializableLoadSubsetOptions(
92 subsetOptions: LoadSubsetOptions,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected