@atproto/lex-json 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/blob.d.ts +2 -4
- package/dist/blob.d.ts.map +1 -1
- package/dist/blob.js.map +1 -1
- package/package.json +6 -6
- package/src/blob.ts +7 -2
- package/src/lex-json.test.ts +1 -0
- package/tsconfig.tests.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atproto/lex-json
|
|
2
2
|
|
|
3
|
+
## 0.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`2f78893`](https://github.com/bluesky-social/atproto/commit/2f78893ace3bbf14d4bac36837820ddb46658c98), [`2f78893`](https://github.com/bluesky-social/atproto/commit/2f78893ace3bbf14d4bac36837820ddb46658c98), [`2f78893`](https://github.com/bluesky-social/atproto/commit/2f78893ace3bbf14d4bac36837820ddb46658c98)]:
|
|
8
|
+
- @atproto/lex-data@0.0.6
|
|
9
|
+
|
|
10
|
+
## 0.0.5
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`9af7a2d`](https://github.com/bluesky-social/atproto/commit/9af7a2d12240e91248610ce4fe7d93387733c59c), [`9af7a2d`](https://github.com/bluesky-social/atproto/commit/9af7a2d12240e91248610ce4fe7d93387733c59c)]:
|
|
15
|
+
- @atproto/lex-data@0.0.5
|
|
16
|
+
|
|
3
17
|
## 0.0.4
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/blob.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { BlobRef, LexMap } from '@atproto/lex-data';
|
|
2
|
-
export declare function parseBlobRef(input: LexMap, options?:
|
|
3
|
-
strict?: boolean;
|
|
4
|
-
}): BlobRef | undefined;
|
|
1
|
+
import { BlobRef, BlobRefValidationOptions, LexMap } from '@atproto/lex-data';
|
|
2
|
+
export declare function parseBlobRef(input: LexMap, options?: BlobRefValidationOptions): BlobRef | undefined;
|
|
5
3
|
//# sourceMappingURL=blob.d.ts.map
|
package/dist/blob.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob.d.ts","sourceRoot":"","sources":["../src/blob.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"blob.d.ts","sourceRoot":"","sources":["../src/blob.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,wBAAwB,EACxB,MAAM,EAEP,MAAM,mBAAmB,CAAA;AAG1B,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,GAAG,SAAS,CAwBrB"}
|
package/dist/blob.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob.js","sourceRoot":"","sources":["../src/blob.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"blob.js","sourceRoot":"","sources":["../src/blob.ts"],"names":[],"mappings":";;AAQA,oCA2BC;AAnCD,gDAK0B;AAC1B,uCAAwC;AAExC,SAAgB,YAAY,CAC1B,KAAa,EACb,OAAkC;IAElC,IAAI,KAAK,CAAC,KAAK,KAAK,MAAM;QAAE,OAAO,SAAS,CAAA;IAE5C,MAAM,GAAG,GAAG,KAAK,EAAE,GAAG,CAAA;IACtB,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAA;IAErD,8EAA8E;IAC9E,oEAAoE;IACpE,qEAAqE;IACrE,iDAAiD;IAEjD,IAAI,OAAO,IAAI,GAAG,EAAE,CAAC;QACnB,MAAM,GAAG,GAAG,IAAA,sBAAY,EAAC,GAAG,CAAC,CAAA;QAC7B,IAAI,CAAC,GAAG;YAAE,OAAO,SAAS,CAAA;QAE1B,MAAM,IAAI,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA;QACnC,IAAI,IAAA,oBAAS,EAAC,IAAI,EAAE,OAAO,CAAC;YAAE,OAAO,IAAI,CAAA;IAC3C,CAAC;IAED,IAAI,IAAA,oBAAS,EAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO,SAAS,CAAA;AAClB,CAAC","sourcesContent":["import {\n BlobRef,\n BlobRefValidationOptions,\n LexMap,\n isBlobRef,\n} from '@atproto/lex-data'\nimport { parseLexLink } from './link.js'\n\nexport function parseBlobRef(\n input: LexMap,\n options?: BlobRefValidationOptions,\n): BlobRef | undefined {\n if (input.$type !== 'blob') return undefined\n\n const ref = input?.ref\n if (!ref || typeof ref !== 'object') return undefined\n\n // @NOTE Because json to lex conversion can be performed both in a depth-first\n // manner (e.g. via lexParse) or in a breadth-first manner (e.g. via\n // jsonToLex), the `ref` property may either be a LexMap with a $link\n // property, or it may already be a CID instance.\n\n if ('$link' in ref) {\n const cid = parseLexLink(ref)\n if (!cid) return undefined\n\n const blob = { ...input, ref: cid }\n if (isBlobRef(blob, options)) return blob\n }\n\n if (isBlobRef(input)) {\n return input\n }\n\n return undefined\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/lex-json",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Lexicon encoding utilities for AT Lexicon data in JSON format",
|
|
6
6
|
"keywords": [
|
|
@@ -31,21 +31,21 @@
|
|
|
31
31
|
"types": "./dist/index.d.ts",
|
|
32
32
|
"exports": {
|
|
33
33
|
".": {
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
34
35
|
"browser": "./dist/index.js",
|
|
35
36
|
"import": "./dist/index.js",
|
|
36
|
-
"require": "./dist/index.js"
|
|
37
|
-
"types": "./dist/index.d.ts"
|
|
37
|
+
"require": "./dist/index.js"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"tslib": "^2.8.1",
|
|
42
|
-
"@atproto/lex-data": "0.0.
|
|
42
|
+
"@atproto/lex-data": "0.0.6"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"
|
|
45
|
+
"vitest": "^4.0.16"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "tsc --build tsconfig.build.json",
|
|
49
|
-
"test": "
|
|
49
|
+
"test": "vitest run"
|
|
50
50
|
}
|
|
51
51
|
}
|
package/src/blob.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BlobRef,
|
|
3
|
+
BlobRefValidationOptions,
|
|
4
|
+
LexMap,
|
|
5
|
+
isBlobRef,
|
|
6
|
+
} from '@atproto/lex-data'
|
|
2
7
|
import { parseLexLink } from './link.js'
|
|
3
8
|
|
|
4
9
|
export function parseBlobRef(
|
|
5
10
|
input: LexMap,
|
|
6
|
-
options?:
|
|
11
|
+
options?: BlobRefValidationOptions,
|
|
7
12
|
): BlobRef | undefined {
|
|
8
13
|
if (input.$type !== 'blob') return undefined
|
|
9
14
|
|
package/src/lex-json.test.ts
CHANGED
package/tsconfig.tests.json
CHANGED