Skip to content

Commit

Permalink
fix: inline json-joy dependency (#999)
Browse files Browse the repository at this point in the history
* feat: inline `json-joy`

* feat: remove unneeded files

* feat: remove even more unneeded files

* chore: don't apply prettier to `json-joy` code
  • Loading branch information
G-Rath committed Feb 17, 2024
1 parent 5110a89 commit 45b7a90
Show file tree
Hide file tree
Showing 41 changed files with 3,193 additions and 25 deletions.
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) {}
}

0 comments on commit 45b7a90

Please sign in to comment.