Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: inline json-joy dependency #999

Merged
merged 4 commits into from Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .prettierignore
@@ -0,0 +1 @@
src/json-joy
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -121,7 +121,7 @@
}
},
"dependencies": {
"json-joy": "^11.0.0",
"hyperdyperid": "^1.2.0",
"thingies": "^1.11.1",
"tslib": "^2.0.0"
},
Expand Down
4 changes: 2 additions & 2 deletions src/fsa-to-node/json.ts
@@ -1,5 +1,5 @@
import { CborEncoder } from 'json-joy/es6/json-pack/cbor/CborEncoder';
import { CborDecoder } from 'json-joy/es6/json-pack/cbor/CborDecoder';
import { CborEncoder } from '../json-joy/json-pack/cbor/CborEncoder';
import { CborDecoder } from '../json-joy/json-pack/cbor/CborDecoder';

export const encoder = new CborEncoder();
export const decoder = new CborDecoder();
11 changes: 11 additions & 0 deletions src/json-joy/json-pack/JsonPackExtension.ts
@@ -0,0 +1,11 @@
/**
* A wrapping for MessagePack extension or CBOR tag value. When encoder
* encounters {@link JsonPackExtension} it will encode it as a MessagePack
* extension or CBOR tag. Likewise, the decoder will
* decode extensions into {@link JsonPackExtension}.
*
* @category Value
*/
export class JsonPackExtension<T = Uint8Array> {
constructor(public readonly tag: number, public readonly val: T) {}
}
13 changes: 13 additions & 0 deletions src/json-joy/json-pack/JsonPackValue.ts
@@ -0,0 +1,13 @@
/**
* Use this wrapper is you have a pre-encoded MessagePack or CBOR value and you would
* like to dump it into a the document as-is. The contents of `buf` will
* be written as is to the document.
*
* It also serves as CBOR simple value container. In which case the type of value
* `val` field is "number".
*
* @category Value
*/
export class JsonPackValue<T = Uint8Array> {
constructor(public readonly val: T) {}
}