Skip to content

Commit

Permalink
Updated dwn-sdk-js and dwn-sql-store dependencies + v0.1.8 (#95)
Browse files Browse the repository at this point in the history
Updated dependencies + v0.1.8
  • Loading branch information
thehenrytsai authored Dec 13, 2023
1 parent 7a178b5 commit a55711f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 36 deletions.
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@web5/dwn-server",
"type": "module",
"version": "0.1.7",
"version": "0.1.8",
"files": [
"dist",
"src"
Expand All @@ -26,8 +26,8 @@
"url": "https://github.com/TBD54566975/dwn-server/issues"
},
"dependencies": {
"@tbd54566975/dwn-sdk-js": "0.2.8",
"@tbd54566975/dwn-sql-store": "0.2.4",
"@tbd54566975/dwn-sdk-js": "0.2.9",
"@tbd54566975/dwn-sql-store": "0.2.5",
"better-sqlite3": "^8.5.0",
"bytes": "3.1.2",
"cors": "2.8.5",
Expand Down
26 changes: 5 additions & 21 deletions src/json-rpc-handlers/dwn/process-message.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { RecordsReadReply } from '@tbd54566975/dwn-sdk-js';
import { DwnInterfaceName, DwnMethodName } from '@tbd54566975/dwn-sdk-js';

import type { Readable as IsomorphicReadable } from 'readable-stream';
import { v4 as uuidv4 } from 'uuid';
Expand All @@ -23,26 +22,11 @@ export const handleDwnProcessMessage: JsonRpcHandler = async (
const requestId = dwnRequest.id ?? uuidv4();

try {
let reply;
const messageType =
message?.descriptor?.interface + message?.descriptor?.method;

// When a record is deleted via `RecordsDelete`, the initial RecordsWrite is kept as a tombstone _in addition_
// to the RecordsDelete message. the data associated to that initial RecordsWrite is deleted. If a record was written
// _and_ deleted before it ever got to dwn-server, we end up in a situation where we still need to process the tombstone
// so that we can process the RecordsDelete.
if (
messageType === DwnInterfaceName.Records + DwnMethodName.Write &&
!dataStream
) {
reply = await dwn.synchronizePrunedInitialRecordsWrite(target, message);
} else {
reply = (await dwn.processMessage(
target,
message,
dataStream as IsomorphicReadable,
)) as RecordsReadReply;
}
const reply = (await dwn.processMessage(
target,
message,
dataStream as IsomorphicReadable,
)) as RecordsReadReply;

// RecordsRead messages return record data as a stream to for accommodate large amounts of data
let recordDataStream;
Expand Down

0 comments on commit a55711f

Please sign in to comment.