@atproto/lex-data 0.0.14 → 0.1.0-next.0
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 +28 -0
- package/dist/blob.d.ts +118 -39
- package/dist/blob.d.ts.map +1 -1
- package/dist/blob.js +68 -22
- package/dist/blob.js.map +1 -1
- package/dist/cid.d.ts.map +1 -1
- package/dist/cid.js +75 -79
- package/dist/cid.js.map +1 -1
- package/dist/index.js +8 -11
- package/dist/index.js.map +1 -1
- package/dist/lex-equals.js +9 -12
- package/dist/lex-equals.js.map +1 -1
- package/dist/lex-error.js +2 -7
- package/dist/lex-error.js.map +1 -1
- package/dist/lex.js +10 -17
- package/dist/lex.js.map +1 -1
- package/dist/lib/nodejs-buffer.d.ts +4 -0
- package/dist/lib/nodejs-buffer.d.ts.map +1 -1
- package/dist/lib/nodejs-buffer.js +1 -4
- package/dist/lib/nodejs-buffer.js.map +1 -1
- package/dist/lib/util.js +2 -6
- package/dist/lib/util.js.map +1 -1
- package/dist/object.js +3 -8
- package/dist/object.js.map +1 -1
- package/dist/uint8array-base64.js +1 -2
- package/dist/uint8array-concat.d.ts +2 -2
- package/dist/uint8array-concat.d.ts.map +1 -1
- package/dist/uint8array-concat.js +4 -8
- package/dist/uint8array-concat.js.map +1 -1
- package/dist/uint8array-from-base64.js +7 -11
- package/dist/uint8array-from-base64.js.map +1 -1
- package/dist/uint8array-to-base64.js +7 -11
- package/dist/uint8array-to-base64.js.map +1 -1
- package/dist/uint8array.d.ts +1 -1
- package/dist/uint8array.d.ts.map +1 -1
- package/dist/uint8array.js +17 -23
- package/dist/uint8array.js.map +1 -1
- package/dist/utf8-from-base64.js +6 -10
- package/dist/utf8-from-base64.js.map +1 -1
- package/dist/utf8-from-bytes.d.ts +3 -0
- package/dist/utf8-from-bytes.d.ts.map +1 -0
- package/dist/utf8-from-bytes.js +15 -0
- package/dist/utf8-from-bytes.js.map +1 -0
- package/dist/utf8-grapheme-len.js +4 -8
- package/dist/utf8-grapheme-len.js.map +1 -1
- package/dist/utf8-len.js +4 -8
- package/dist/utf8-len.js.map +1 -1
- package/dist/utf8-to-base64.js +8 -12
- package/dist/utf8-to-base64.js.map +1 -1
- package/dist/utf8.d.ts +18 -0
- package/dist/utf8.d.ts.map +1 -1
- package/dist/utf8.js +32 -16
- package/dist/utf8.js.map +1 -1
- package/package.json +7 -8
- package/src/blob.test.ts +38 -25
- package/src/blob.ts +190 -52
- package/src/cid-implementation.test.ts +3 -3
- package/src/cid.ts +1 -0
- package/src/core-js.d.ts +2 -0
- package/src/lib/nodejs-buffer.ts +10 -0
- package/src/uint8array-concat.ts +7 -3
- package/src/uint8array-from-base64.test.ts +2 -2
- package/src/uint8array-to-base64.test.ts +2 -2
- package/src/uint8array.test.ts +2 -2
- package/src/utf8-from-bytes.test.ts +43 -0
- package/src/utf8-from-bytes.ts +21 -0
- package/src/utf8.ts +20 -0
- package/tsconfig.tests.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utf8-from-bytes.d.ts","sourceRoot":"","sources":["../src/utf8-from-bytes.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,WACQ,UAAU,KAAG,MAAM,QAWf,CAAA;AAE1C,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE7D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NodeJSBuffer } from './lib/nodejs-buffer.js';
|
|
2
|
+
const Buffer = NodeJSBuffer;
|
|
3
|
+
export const utf8FromBytesNode = Buffer
|
|
4
|
+
? function utf8FromBytesNode(bytes) {
|
|
5
|
+
// @NOTE Buffer.from(bytes) creates a copy of the ArrayBuffer. The following
|
|
6
|
+
// allows us to avoid the copy by creating a Buffer that shares the same
|
|
7
|
+
// memory as the input Uint8Array.
|
|
8
|
+
const buffer = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
9
|
+
return buffer.toString('utf8');
|
|
10
|
+
}
|
|
11
|
+
: /* v8 ignore next -- @preserve */ null;
|
|
12
|
+
export function utf8FromBytesNative(bytes) {
|
|
13
|
+
return new TextDecoder('utf-8').decode(bytes);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=utf8-from-bytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utf8-from-bytes.js","sourceRoot":"","sources":["../src/utf8-from-bytes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAErD,MAAM,MAAM,GAAG,YAAY,CAAA;AAE3B,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM;IACrC,CAAC,CAAC,SAAS,iBAAiB,CAAC,KAAiB;QAC1C,4EAA4E;QAC5E,wEAAwE;QACxE,kCAAkC;QAClC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CACxB,KAAK,CAAC,MAAM,EACZ,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,UAAU,CACjB,CAAA;QACD,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAChC,CAAC;IACH,CAAC,CAAC,iCAAiC,CAAC,IAAI,CAAA;AAE1C,MAAM,UAAU,mBAAmB,CAAC,KAAiB;IACnD,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC/C,CAAC","sourcesContent":["import { NodeJSBuffer } from './lib/nodejs-buffer.js'\n\nconst Buffer = NodeJSBuffer\n\nexport const utf8FromBytesNode = Buffer\n ? function utf8FromBytesNode(bytes: Uint8Array): string {\n // @NOTE Buffer.from(bytes) creates a copy of the ArrayBuffer. The following\n // allows us to avoid the copy by creating a Buffer that shares the same\n // memory as the input Uint8Array.\n const buffer = Buffer.from(\n bytes.buffer,\n bytes.byteOffset,\n bytes.byteLength,\n )\n return buffer.toString('utf8')\n }\n : /* v8 ignore next -- @preserve */ null\n\nexport function utf8FromBytesNative(bytes: Uint8Array): string {\n return new TextDecoder('utf-8').decode(bytes)\n}\n"]}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.graphemeLenNative = void 0;
|
|
4
|
-
exports.graphemeLenPonyfill = graphemeLenPonyfill;
|
|
5
|
-
const grapheme_1 = require("unicode-segmenter/grapheme");
|
|
1
|
+
import { countGraphemes } from 'unicode-segmenter/grapheme';
|
|
6
2
|
// @TODO: Drop usage of "unicode-segmenter" package when Intl.Segmenter is
|
|
7
3
|
// widely supported.
|
|
8
4
|
// https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter
|
|
9
5
|
const segmenter = 'Segmenter' in Intl && typeof Intl.Segmenter === 'function'
|
|
10
6
|
? /*#__PURE__*/ new Intl.Segmenter()
|
|
11
7
|
: /* v8 ignore next -- @preserve */ null;
|
|
12
|
-
|
|
8
|
+
export const graphemeLenNative = segmenter
|
|
13
9
|
? function graphemeLenNative(str) {
|
|
14
10
|
let length = 0;
|
|
15
11
|
for (const _ of segmenter.segment(str))
|
|
@@ -17,7 +13,7 @@ exports.graphemeLenNative = segmenter
|
|
|
17
13
|
return length;
|
|
18
14
|
}
|
|
19
15
|
: /* v8 ignore next -- @preserve */ null;
|
|
20
|
-
function graphemeLenPonyfill(str) {
|
|
21
|
-
return
|
|
16
|
+
export function graphemeLenPonyfill(str) {
|
|
17
|
+
return countGraphemes(str);
|
|
22
18
|
}
|
|
23
19
|
//# sourceMappingURL=utf8-grapheme-len.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utf8-grapheme-len.js","sourceRoot":"","sources":["../src/utf8-grapheme-len.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utf8-grapheme-len.js","sourceRoot":"","sources":["../src/utf8-grapheme-len.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAE3D,0EAA0E;AAC1E,oBAAoB;AACpB,+FAA+F;AAC/F,MAAM,SAAS,GACb,WAAW,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,UAAU;IACzD,CAAC,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,SAAS,EAAE;IACpC,CAAC,CAAC,iCAAiC,CAAC,IAAI,CAAA;AAE5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS;IACxC,CAAC,CAAC,SAAS,iBAAiB,CAAC,GAAW;QACpC,IAAI,MAAM,GAAG,CAAC,CAAA;QACd,KAAK,MAAM,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC;YAAE,MAAM,EAAE,CAAA;QAChD,OAAO,MAAM,CAAA;IACf,CAAC;IACH,CAAC,CAAC,iCAAiC,CAAC,IAAI,CAAA;AAE1C,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,OAAO,cAAc,CAAC,GAAG,CAAC,CAAA;AAC5B,CAAC","sourcesContent":["import { countGraphemes } from 'unicode-segmenter/grapheme'\n\n// @TODO: Drop usage of \"unicode-segmenter\" package when Intl.Segmenter is\n// widely supported.\n// https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter\nconst segmenter =\n 'Segmenter' in Intl && typeof Intl.Segmenter === 'function'\n ? /*#__PURE__*/ new Intl.Segmenter()\n : /* v8 ignore next -- @preserve */ null\n\nexport const graphemeLenNative = segmenter\n ? function graphemeLenNative(str: string): number {\n let length = 0\n for (const _ of segmenter.segment(str)) length++\n return length\n }\n : /* v8 ignore next -- @preserve */ null\n\nexport function graphemeLenPonyfill(str: string): number {\n return countGraphemes(str)\n}\n"]}
|
package/dist/utf8-len.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.utf8LenNode = void 0;
|
|
4
|
-
exports.utf8LenCompute = utf8LenCompute;
|
|
5
|
-
const nodejs_buffer_js_1 = require("./lib/nodejs-buffer.js");
|
|
1
|
+
import { NodeJSBuffer } from './lib/nodejs-buffer.js';
|
|
6
2
|
// @NOTE This file is not meant to be exported directly. Instead, we re-export
|
|
7
3
|
// public functions from ./utf8.ts. The reason for this separation is that this
|
|
8
4
|
// file allows to test both the NodeJS-optimized and ponyfill implementations.
|
|
9
|
-
|
|
5
|
+
export const utf8LenNode = NodeJSBuffer
|
|
10
6
|
? function utf8LenNode(string) {
|
|
11
|
-
return
|
|
7
|
+
return NodeJSBuffer.byteLength(string, 'utf8');
|
|
12
8
|
}
|
|
13
9
|
: /* v8 ignore next -- @preserve */ null;
|
|
14
|
-
function utf8LenCompute(string) {
|
|
10
|
+
export function utf8LenCompute(string) {
|
|
15
11
|
// The code below is similar to TextEncoder's implementation of UTF-8
|
|
16
12
|
// encoding. However, using TextEncoder to get the byte length is slower
|
|
17
13
|
// as it requires allocating a new Uint8Array and copying data:
|
package/dist/utf8-len.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utf8-len.js","sourceRoot":"","sources":["../src/utf8-len.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utf8-len.js","sourceRoot":"","sources":["../src/utf8-len.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAErD,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAE9E,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY;IACrC,CAAC,CAAC,SAAS,WAAW,CAAC,MAAc;QACjC,OAAO,YAAa,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjD,CAAC;IACH,CAAC,CAAC,iCAAiC,CAAC,IAAI,CAAA;AAE1C,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,qEAAqE;IACrE,wEAAwE;IACxE,+DAA+D;IAE/D,qDAAqD;IAErD,mDAAmD;IACnD,IAAI,GAAG,GAAG,MAAM,CAAC,MAAM,CAAA;IACvB,IAAI,IAAY,CAAA;IAEhB,gEAAgE;IAChE,uBAAuB;IACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;QAE3B,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;YACjB,gBAAgB;QAClB,CAAC;aAAM,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,eAAe;YACf,GAAG,IAAI,CAAC,CAAA;QACV,CAAC;aAAM,CAAC;YACN,eAAe;YACf,GAAG,IAAI,CAAC,CAAA;YACR,sEAAsE;YACtE,+DAA+D;YAC/D,wEAAwE;YACxE,OAAO;YACP,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;gBACrC,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;gBAC/B,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;oBACrC,CAAC,EAAE,CAAA;gBACL,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["import { NodeJSBuffer } from './lib/nodejs-buffer.js'\n\n// @NOTE This file is not meant to be exported directly. Instead, we re-export\n// public functions from ./utf8.ts. The reason for this separation is that this\n// file allows to test both the NodeJS-optimized and ponyfill implementations.\n\nexport const utf8LenNode = NodeJSBuffer\n ? function utf8LenNode(string: string): number {\n return NodeJSBuffer!.byteLength(string, 'utf8')\n }\n : /* v8 ignore next -- @preserve */ null\n\nexport function utf8LenCompute(string: string): number {\n // The code below is similar to TextEncoder's implementation of UTF-8\n // encoding. However, using TextEncoder to get the byte length is slower\n // as it requires allocating a new Uint8Array and copying data:\n\n // return new TextEncoder().encode(string).byteLength\n\n // The base length is the string length (all ASCII)\n let len = string.length\n let code: number\n\n // The loop calculates the number of additional bytes needed for\n // non-ASCII characters\n for (let i = 0; i < string.length; i += 1) {\n code = string.charCodeAt(i)\n\n if (code <= 0x7f) {\n // ASCII, 1 byte\n } else if (code <= 0x7ff) {\n // 2 bytes char\n len += 1\n } else {\n // 3 bytes char\n len += 2\n // If the current char is a high surrogate, and the next char is a low\n // surrogate, skip the next char as the total is a 4 bytes char\n // (represented as a surrogate pair in UTF-16) and was already accounted\n // for.\n if (code >= 0xd800 && code <= 0xdbff) {\n code = string.charCodeAt(i + 1)\n if (code >= 0xdc00 && code <= 0xdfff) {\n i++\n }\n }\n }\n }\n\n return len\n}\n"]}
|
package/dist/utf8-to-base64.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const nodejs_buffer_js_1 = require("./lib/nodejs-buffer.js");
|
|
7
|
-
const uint8array_to_base64_js_1 = require("./uint8array-to-base64.js");
|
|
8
|
-
const Buffer = nodejs_buffer_js_1.NodeJSBuffer;
|
|
9
|
-
exports.utf8ToBase64Node = Buffer
|
|
1
|
+
import { toString } from 'uint8arrays/to-string';
|
|
2
|
+
import { NodeJSBuffer } from './lib/nodejs-buffer.js';
|
|
3
|
+
import { toBase64Node } from './uint8array-to-base64.js';
|
|
4
|
+
const Buffer = NodeJSBuffer;
|
|
5
|
+
export const utf8ToBase64Node = Buffer
|
|
10
6
|
? function utf8ToBase64Node(text, alphabet) {
|
|
11
7
|
const buffer = Buffer.from(text, 'utf8');
|
|
12
|
-
return
|
|
8
|
+
return toBase64Node(buffer, alphabet);
|
|
13
9
|
}
|
|
14
10
|
: /* v8 ignore next -- @preserve */ null;
|
|
15
11
|
const textEncoder = /*#__PURE__*/ new TextEncoder();
|
|
16
|
-
function utf8ToBase64Ponyfill(text, alphabet) {
|
|
12
|
+
export function utf8ToBase64Ponyfill(text, alphabet) {
|
|
17
13
|
const bytes = textEncoder.encode(text);
|
|
18
|
-
return
|
|
14
|
+
return toString(bytes, alphabet);
|
|
19
15
|
}
|
|
20
16
|
//# sourceMappingURL=utf8-to-base64.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utf8-to-base64.js","sourceRoot":"","sources":["../src/utf8-to-base64.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utf8-to-base64.js","sourceRoot":"","sources":["../src/utf8-to-base64.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAExD,MAAM,MAAM,GAAG,YAAY,CAAA;AAE3B,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM;IACpC,CAAC,CAAC,SAAS,gBAAgB,CAAC,IAAY,EAAE,QAAyB;QAC/D,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QACxC,OAAO,YAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IACxC,CAAC;IACH,CAAC,CAAC,iCAAiC,CAAC,IAAI,CAAA;AAE1C,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,WAAW,EAAE,CAAA;AACnD,MAAM,UAAU,oBAAoB,CAClC,IAAY,EACZ,QAAyB;IAEzB,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACtC,OAAO,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AAClC,CAAC","sourcesContent":["import { toString } from 'uint8arrays/to-string'\nimport { NodeJSBuffer } from './lib/nodejs-buffer.js'\nimport { Base64Alphabet } from './uint8array-base64.js'\nimport { toBase64Node } from './uint8array-to-base64.js'\n\nconst Buffer = NodeJSBuffer\n\nexport const utf8ToBase64Node = Buffer\n ? function utf8ToBase64Node(text: string, alphabet?: Base64Alphabet): string {\n const buffer = Buffer.from(text, 'utf8')\n return toBase64Node!(buffer, alphabet)\n }\n : /* v8 ignore next -- @preserve */ null\n\nconst textEncoder = /*#__PURE__*/ new TextEncoder()\nexport function utf8ToBase64Ponyfill(\n text: string,\n alphabet?: Base64Alphabet,\n): string {\n const bytes = textEncoder.encode(text)\n return toString(bytes, alphabet)\n}\n"]}
|
package/dist/utf8.d.ts
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import { Base64Alphabet } from './uint8array.js';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a Uint8Array to a UTF-8 string.
|
|
4
|
+
*
|
|
5
|
+
* Uses Node.js Buffer when available for performance, falling back to
|
|
6
|
+
* TextDecoder in environments without Buffer support.
|
|
7
|
+
*
|
|
8
|
+
* @param bytes - The binary data to decode
|
|
9
|
+
* @returns The decoded string (as UTF-16 JavaScript string)
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { utf8FromBytes } from '@atproto/lex-data'
|
|
14
|
+
*
|
|
15
|
+
* const bytes = new Uint8Array([72, 101, 108, 108, 111])
|
|
16
|
+
* utf8FromBytes(bytes) // 'Hello'
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const utf8FromBytes: (bytes: Uint8Array) => string;
|
|
2
20
|
/**
|
|
3
21
|
* Counts the number of grapheme clusters (user-perceived characters) in a string.
|
|
4
22
|
*
|
package/dist/utf8.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utf8.d.ts","sourceRoot":"","sources":["../src/utf8.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"utf8.d.ts","sourceRoot":"","sources":["../src/utf8.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAUhD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,+BAA2C,CAAA;AAErE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MACiC,CAAA;AAU5E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MACuB,CAAA;AAEjE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,KAAK,MACK,CAAA;AAE5E;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,EAAE,CAC3B,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,cAAc,KACtB,MAC2E,CAAA"}
|
package/dist/utf8.js
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { utf8FromBase64Node, utf8FromBase64Ponyfill, } from './utf8-from-base64.js';
|
|
2
|
+
import { utf8FromBytesNative, utf8FromBytesNode } from './utf8-from-bytes.js';
|
|
3
|
+
import { graphemeLenNative, graphemeLenPonyfill } from './utf8-grapheme-len.js';
|
|
4
|
+
import { utf8LenCompute, utf8LenNode } from './utf8-len.js';
|
|
5
|
+
import { utf8ToBase64Node, utf8ToBase64Ponyfill } from './utf8-to-base64.js';
|
|
6
|
+
/**
|
|
7
|
+
* Converts a Uint8Array to a UTF-8 string.
|
|
8
|
+
*
|
|
9
|
+
* Uses Node.js Buffer when available for performance, falling back to
|
|
10
|
+
* TextDecoder in environments without Buffer support.
|
|
11
|
+
*
|
|
12
|
+
* @param bytes - The binary data to decode
|
|
13
|
+
* @returns The decoded string (as UTF-16 JavaScript string)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { utf8FromBytes } from '@atproto/lex-data'
|
|
18
|
+
*
|
|
19
|
+
* const bytes = new Uint8Array([72, 101, 108, 108, 111])
|
|
20
|
+
* utf8FromBytes(bytes) // 'Hello'
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export const utf8FromBytes = utf8FromBytesNode ?? utf8FromBytesNative;
|
|
8
24
|
/**
|
|
9
25
|
* Counts the number of grapheme clusters (user-perceived characters) in a string.
|
|
10
26
|
*
|
|
@@ -28,10 +44,10 @@ const utf8_to_base64_js_1 = require("./utf8-to-base64.js");
|
|
|
28
44
|
* graphemeLen('\u{1F468}\u{200D}\u{1F469}\u{200D}\u{1F467}\u{200D}\u{1F466}') // 1 (family emoji)
|
|
29
45
|
* ```
|
|
30
46
|
*/
|
|
31
|
-
|
|
32
|
-
/* v8 ignore next -- @preserve */
|
|
47
|
+
export const graphemeLen =
|
|
48
|
+
/* v8 ignore next -- @preserve */ graphemeLenNative ?? graphemeLenPonyfill;
|
|
33
49
|
/* v8 ignore next -- @preserve */
|
|
34
|
-
if (
|
|
50
|
+
if (graphemeLen === graphemeLenPonyfill) {
|
|
35
51
|
/*#__PURE__*/
|
|
36
52
|
console.warn('[@atproto/lex-data]: Intl.Segmenter is not available in this environment. Falling back to ponyfill implementation.');
|
|
37
53
|
}
|
|
@@ -57,8 +73,8 @@ if (exports.graphemeLen === utf8_grapheme_len_js_1.graphemeLenPonyfill) {
|
|
|
57
73
|
* utf8Len('\u{1F468}\u{200D}\u{1F469}\u{200D}\u{1F467}\u{200D}\u{1F466}') // 25 (family emoji)
|
|
58
74
|
* ```
|
|
59
75
|
*/
|
|
60
|
-
|
|
61
|
-
/* v8 ignore next -- @preserve */
|
|
76
|
+
export const utf8Len =
|
|
77
|
+
/* v8 ignore next -- @preserve */ utf8LenNode ?? utf8LenCompute;
|
|
62
78
|
/**
|
|
63
79
|
* Encodes a UTF-8 string to base64.
|
|
64
80
|
*
|
|
@@ -75,8 +91,8 @@ exports.utf8Len =
|
|
|
75
91
|
* utf8ToBase64('Hello') // 'SGVsbG8='
|
|
76
92
|
* ```
|
|
77
93
|
*/
|
|
78
|
-
|
|
79
|
-
/* v8 ignore next -- @preserve */
|
|
94
|
+
export const utf8ToBase64 =
|
|
95
|
+
/* v8 ignore next -- @preserve */ utf8ToBase64Node ?? utf8ToBase64Ponyfill;
|
|
80
96
|
/**
|
|
81
97
|
* Decodes a base64 string to UTF-8.
|
|
82
98
|
*
|
|
@@ -93,6 +109,6 @@ exports.utf8ToBase64 =
|
|
|
93
109
|
* utf8FromBase64('SGVsbG8=') // 'Hello'
|
|
94
110
|
* ```
|
|
95
111
|
*/
|
|
96
|
-
|
|
97
|
-
/* v8 ignore next -- @preserve */
|
|
112
|
+
export const utf8FromBase64 =
|
|
113
|
+
/* v8 ignore next -- @preserve */ utf8FromBase64Node ?? utf8FromBase64Ponyfill;
|
|
98
114
|
//# sourceMappingURL=utf8.js.map
|
package/dist/utf8.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utf8.js","sourceRoot":"","sources":["../src/utf8.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utf8.js","sourceRoot":"","sources":["../src/utf8.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7E,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAE5E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,IAAI,mBAAmB,CAAA;AAErE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,WAAW;AACtB,iCAAiC,CAAC,iBAAiB,IAAI,mBAAmB,CAAA;AAE5E,iCAAiC;AACjC,IAAI,WAAW,KAAK,mBAAmB,EAAE,CAAC;IACxC,aAAa;IACb,OAAO,CAAC,IAAI,CACV,oHAAoH,CACrH,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,OAAO;AAClB,iCAAiC,CAAC,WAAW,IAAI,cAAc,CAAA;AAEjE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,YAAY;AACvB,iCAAiC,CAAC,gBAAgB,IAAI,oBAAoB,CAAA;AAE5E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,cAAc;AAIzB,iCAAiC,CAAC,kBAAkB,IAAI,sBAAsB,CAAA","sourcesContent":["import { Base64Alphabet } from './uint8array.js'\nimport {\n utf8FromBase64Node,\n utf8FromBase64Ponyfill,\n} from './utf8-from-base64.js'\nimport { utf8FromBytesNative, utf8FromBytesNode } from './utf8-from-bytes.js'\nimport { graphemeLenNative, graphemeLenPonyfill } from './utf8-grapheme-len.js'\nimport { utf8LenCompute, utf8LenNode } from './utf8-len.js'\nimport { utf8ToBase64Node, utf8ToBase64Ponyfill } from './utf8-to-base64.js'\n\n/**\n * Converts a Uint8Array to a UTF-8 string.\n *\n * Uses Node.js Buffer when available for performance, falling back to\n * TextDecoder in environments without Buffer support.\n *\n * @param bytes - The binary data to decode\n * @returns The decoded string (as UTF-16 JavaScript string)\n *\n * @example\n * ```typescript\n * import { utf8FromBytes } from '@atproto/lex-data'\n *\n * const bytes = new Uint8Array([72, 101, 108, 108, 111])\n * utf8FromBytes(bytes) // 'Hello'\n * ```\n */\nexport const utf8FromBytes = utf8FromBytesNode ?? utf8FromBytesNative\n\n/**\n * Counts the number of grapheme clusters (user-perceived characters) in a string.\n *\n * Grapheme clusters represent what users typically think of as \"characters\",\n * handling complex cases like:\n * - Emoji with skin tones and ZWJ sequences (e.g., family emoji)\n * - Combined characters (e.g., 'e' + combining accent)\n * - Regional indicator pairs (flag emoji)\n *\n * Uses native {@link Intl.Segmenter} when available, falling back to a ponyfill.\n *\n * @param str - The string to measure\n * @returns The number of grapheme clusters\n *\n * @example\n * ```typescript\n * import { graphemeLen } from '@atproto/lex-data'\n *\n * graphemeLen('hello') // 5\n * graphemeLen('cafe\\u0301') // 4 (cafe with combining accent)\n * graphemeLen('\\u{1F468}\\u{200D}\\u{1F469}\\u{200D}\\u{1F467}\\u{200D}\\u{1F466}') // 1 (family emoji)\n * ```\n */\nexport const graphemeLen: (str: string) => number =\n /* v8 ignore next -- @preserve */ graphemeLenNative ?? graphemeLenPonyfill\n\n/* v8 ignore next -- @preserve */\nif (graphemeLen === graphemeLenPonyfill) {\n /*#__PURE__*/\n console.warn(\n '[@atproto/lex-data]: Intl.Segmenter is not available in this environment. Falling back to ponyfill implementation.',\n )\n}\n\n/**\n * Calculates the UTF-8 byte length of a string.\n *\n * Returns the number of bytes the string would occupy when encoded as UTF-8.\n * This is important for Lexicon validation where schemas specify byte limits.\n *\n * Uses Node.js Buffer.byteLength when available for performance,\n * falling back to a computed implementation.\n *\n * @param str - The string to measure\n * @returns The UTF-8 byte length\n *\n * @example\n * ```typescript\n * import { utf8Len } from '@atproto/lex-data'\n *\n * utf8Len('hello') // 5 (ASCII: 1 byte per char)\n * utf8Len('\\u00e9') // 2 (e with accent: 2 bytes)\n * utf8Len('\\u{1F600}') // 4 (emoji: 4 bytes)\n * utf8Len('\\u{1F468}\\u{200D}\\u{1F469}\\u{200D}\\u{1F467}\\u{200D}\\u{1F466}') // 25 (family emoji)\n * ```\n */\nexport const utf8Len: (string: string) => number =\n /* v8 ignore next -- @preserve */ utf8LenNode ?? utf8LenCompute\n\n/**\n * Encodes a UTF-8 string to base64.\n *\n * First encodes the string as UTF-8 bytes, then encodes those bytes as base64.\n *\n * @param str - The string to encode\n * @param alphabet - The base64 alphabet to use ('base64' or 'base64url')\n * @returns The base64-encoded string\n *\n * @example\n * ```typescript\n * import { utf8ToBase64 } from '@atproto/lex-data'\n *\n * utf8ToBase64('Hello') // 'SGVsbG8='\n * ```\n */\nexport const utf8ToBase64: (str: string, alphabet?: Base64Alphabet) => string =\n /* v8 ignore next -- @preserve */ utf8ToBase64Node ?? utf8ToBase64Ponyfill\n\n/**\n * Decodes a base64 string to UTF-8.\n *\n * Decodes the base64 to bytes, then interprets those bytes as UTF-8 text.\n *\n * @param b64 - The base64 string to decode\n * @param alphabet - The base64 alphabet to use ('base64' or 'base64url')\n * @returns The decoded UTF-8 string\n *\n * @example\n * ```typescript\n * import { utf8FromBase64 } from '@atproto/lex-data'\n *\n * utf8FromBase64('SGVsbG8=') // 'Hello'\n * ```\n */\nexport const utf8FromBase64: (\n b64: string,\n alphabet?: Base64Alphabet,\n) => string =\n /* v8 ignore next -- @preserve */ utf8FromBase64Node ?? utf8FromBase64Ponyfill\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/lex-data",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.1.0-next.0",
|
|
4
|
+
"engines": {
|
|
5
|
+
"node": ">=22"
|
|
6
|
+
},
|
|
4
7
|
"license": "MIT",
|
|
5
8
|
"description": "Core utilities for AT Lexicons",
|
|
6
9
|
"keywords": [
|
|
@@ -23,21 +26,17 @@
|
|
|
23
26
|
"./CHANGELOG.md"
|
|
24
27
|
],
|
|
25
28
|
"sideEffects": false,
|
|
26
|
-
"type": "
|
|
27
|
-
"main": "./dist/index.js",
|
|
28
|
-
"types": "./dist/index.d.ts",
|
|
29
|
+
"type": "module",
|
|
29
30
|
"exports": {
|
|
30
31
|
".": {
|
|
31
32
|
"types": "./dist/index.d.ts",
|
|
32
|
-
"browser": "./dist/index.js",
|
|
33
|
-
"import": "./dist/index.js",
|
|
34
33
|
"default": "./dist/index.js"
|
|
35
34
|
}
|
|
36
35
|
},
|
|
37
36
|
"dependencies": {
|
|
38
|
-
"multiformats": "^
|
|
37
|
+
"multiformats": "^13.0.0",
|
|
39
38
|
"tslib": "^2.8.1",
|
|
40
|
-
"uint8arrays": "
|
|
39
|
+
"uint8arrays": "^5.0.0",
|
|
41
40
|
"unicode-segmenter": "^0.14.0"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
package/src/blob.test.ts
CHANGED
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
BlobRef,
|
|
4
4
|
LegacyBlobRef,
|
|
5
5
|
enumBlobRefs,
|
|
6
|
-
isBlobRef,
|
|
7
6
|
isLegacyBlobRef,
|
|
7
|
+
isTypedBlobRef,
|
|
8
8
|
} from './blob.js'
|
|
9
9
|
import { RawCid, parseCid } from './cid.js'
|
|
10
10
|
import { LexArray, LexMap, LexValue } from './lex.js'
|
|
@@ -21,7 +21,7 @@ const invalidBlobCid = parseCid(
|
|
|
21
21
|
{ flavor: 'cbor' },
|
|
22
22
|
)
|
|
23
23
|
|
|
24
|
-
describe(
|
|
24
|
+
describe(isTypedBlobRef, () => {
|
|
25
25
|
it('tests valid blobCid and lexCid', () => {
|
|
26
26
|
expect(validBlobCid.code).toBe(0x55) // raw
|
|
27
27
|
expect(validBlobCid.multihash.code).toBe(0x12) // sha2-256
|
|
@@ -31,7 +31,7 @@ describe(isBlobRef, () => {
|
|
|
31
31
|
|
|
32
32
|
it('parses valid blob', () => {
|
|
33
33
|
expect(
|
|
34
|
-
|
|
34
|
+
isTypedBlobRef({
|
|
35
35
|
$type: 'blob',
|
|
36
36
|
ref: validBlobCid,
|
|
37
37
|
mimeType: 'image/jpeg',
|
|
@@ -40,7 +40,7 @@ describe(isBlobRef, () => {
|
|
|
40
40
|
).toBe(true)
|
|
41
41
|
|
|
42
42
|
expect(
|
|
43
|
-
|
|
43
|
+
isTypedBlobRef(
|
|
44
44
|
{
|
|
45
45
|
$type: 'blob',
|
|
46
46
|
ref: invalidBlobCid,
|
|
@@ -55,7 +55,7 @@ describe(isBlobRef, () => {
|
|
|
55
55
|
|
|
56
56
|
it('performs strict validation by default', () => {
|
|
57
57
|
expect(
|
|
58
|
-
|
|
58
|
+
isTypedBlobRef({
|
|
59
59
|
$type: 'blob',
|
|
60
60
|
ref: invalidBlobCid,
|
|
61
61
|
mimeType: 'image/jpeg',
|
|
@@ -66,7 +66,7 @@ describe(isBlobRef, () => {
|
|
|
66
66
|
|
|
67
67
|
it('rejects invalid inputs', () => {
|
|
68
68
|
expect(
|
|
69
|
-
|
|
69
|
+
isTypedBlobRef({
|
|
70
70
|
$type: 'blob',
|
|
71
71
|
ref: { $link: validBlobCid.toString() },
|
|
72
72
|
mimeType: 'image/jpeg',
|
|
@@ -75,7 +75,7 @@ describe(isBlobRef, () => {
|
|
|
75
75
|
).toBe(false)
|
|
76
76
|
|
|
77
77
|
expect(
|
|
78
|
-
|
|
78
|
+
isTypedBlobRef({
|
|
79
79
|
// $type: 'blob',
|
|
80
80
|
ref: validBlobCid,
|
|
81
81
|
mimeType: 'image/jpeg',
|
|
@@ -84,7 +84,7 @@ describe(isBlobRef, () => {
|
|
|
84
84
|
).toBe(false)
|
|
85
85
|
|
|
86
86
|
expect(
|
|
87
|
-
|
|
87
|
+
isTypedBlobRef({
|
|
88
88
|
$type: 'blob',
|
|
89
89
|
ref: validBlobCid,
|
|
90
90
|
mimeType: { toString: () => 'image/jpeg' },
|
|
@@ -93,7 +93,7 @@ describe(isBlobRef, () => {
|
|
|
93
93
|
).toBe(false)
|
|
94
94
|
|
|
95
95
|
expect(
|
|
96
|
-
|
|
96
|
+
isTypedBlobRef(
|
|
97
97
|
{
|
|
98
98
|
$type: 'blob',
|
|
99
99
|
ref: { $link: validBlobCid.toString() },
|
|
@@ -105,7 +105,7 @@ describe(isBlobRef, () => {
|
|
|
105
105
|
).toBe(false)
|
|
106
106
|
|
|
107
107
|
expect(
|
|
108
|
-
|
|
108
|
+
isTypedBlobRef({
|
|
109
109
|
$type: 'blob',
|
|
110
110
|
mimeType: 'image/jpeg',
|
|
111
111
|
size: 10000,
|
|
@@ -113,7 +113,7 @@ describe(isBlobRef, () => {
|
|
|
113
113
|
).toBe(false)
|
|
114
114
|
|
|
115
115
|
expect(
|
|
116
|
-
|
|
116
|
+
isTypedBlobRef(
|
|
117
117
|
{
|
|
118
118
|
$type: 'blob',
|
|
119
119
|
mimeType: 'image/jpeg',
|
|
@@ -123,15 +123,15 @@ describe(isBlobRef, () => {
|
|
|
123
123
|
),
|
|
124
124
|
).toBe(false)
|
|
125
125
|
|
|
126
|
-
expect(
|
|
127
|
-
expect(
|
|
128
|
-
expect(
|
|
129
|
-
expect(
|
|
126
|
+
expect(isTypedBlobRef('not an object')).toBe(false)
|
|
127
|
+
expect(isTypedBlobRef([])).toBe(false)
|
|
128
|
+
expect(isTypedBlobRef(new Date())).toBe(false)
|
|
129
|
+
expect(isTypedBlobRef(new Map())).toBe(false)
|
|
130
130
|
})
|
|
131
131
|
|
|
132
132
|
it('rejects non-integer size', () => {
|
|
133
133
|
expect(
|
|
134
|
-
|
|
134
|
+
isTypedBlobRef({
|
|
135
135
|
$type: 'blob',
|
|
136
136
|
ref: validBlobCid,
|
|
137
137
|
mimeType: 'image/jpeg',
|
|
@@ -142,7 +142,7 @@ describe(isBlobRef, () => {
|
|
|
142
142
|
|
|
143
143
|
it('rejects invalid CID/multihash code', () => {
|
|
144
144
|
expect(
|
|
145
|
-
|
|
145
|
+
isTypedBlobRef(
|
|
146
146
|
{
|
|
147
147
|
$type: 'blob',
|
|
148
148
|
ref: validBlobCid,
|
|
@@ -154,7 +154,7 @@ describe(isBlobRef, () => {
|
|
|
154
154
|
).toBe(true)
|
|
155
155
|
|
|
156
156
|
expect(
|
|
157
|
-
|
|
157
|
+
isTypedBlobRef(
|
|
158
158
|
{
|
|
159
159
|
$type: 'blob',
|
|
160
160
|
ref: invalidBlobCid,
|
|
@@ -168,7 +168,7 @@ describe(isBlobRef, () => {
|
|
|
168
168
|
|
|
169
169
|
it('rejects extra keys', () => {
|
|
170
170
|
expect(
|
|
171
|
-
|
|
171
|
+
isTypedBlobRef({
|
|
172
172
|
$type: 'blob',
|
|
173
173
|
ref: validBlobCid,
|
|
174
174
|
mimeType: 'image/jpeg',
|
|
@@ -178,7 +178,7 @@ describe(isBlobRef, () => {
|
|
|
178
178
|
).toBe(false)
|
|
179
179
|
|
|
180
180
|
expect(
|
|
181
|
-
|
|
181
|
+
isTypedBlobRef(
|
|
182
182
|
{
|
|
183
183
|
$type: 'blob',
|
|
184
184
|
ref: validBlobCid,
|
|
@@ -197,7 +197,7 @@ describe(isBlobRef, () => {
|
|
|
197
197
|
'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG', // CID v0
|
|
198
198
|
)
|
|
199
199
|
expect(
|
|
200
|
-
|
|
200
|
+
isTypedBlobRef(
|
|
201
201
|
{
|
|
202
202
|
$type: 'blob',
|
|
203
203
|
ref: cidV0,
|
|
@@ -221,14 +221,27 @@ describe(isLegacyBlobRef, () => {
|
|
|
221
221
|
).toBe(true)
|
|
222
222
|
|
|
223
223
|
expect(
|
|
224
|
-
isLegacyBlobRef(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
224
|
+
isLegacyBlobRef(
|
|
225
|
+
{
|
|
226
|
+
cid: invalidBlobCid.toString(),
|
|
227
|
+
mimeType: 'image/jpeg',
|
|
228
|
+
},
|
|
229
|
+
{ strict: false },
|
|
230
|
+
),
|
|
228
231
|
).toBe(true)
|
|
229
232
|
})
|
|
230
233
|
|
|
231
234
|
it('rejects invalid inputs', () => {
|
|
235
|
+
expect(
|
|
236
|
+
isLegacyBlobRef(
|
|
237
|
+
{
|
|
238
|
+
cid: invalidBlobCid.toString(),
|
|
239
|
+
mimeType: 'image/jpeg',
|
|
240
|
+
},
|
|
241
|
+
{ strict: true },
|
|
242
|
+
),
|
|
243
|
+
).toBe(false)
|
|
244
|
+
|
|
232
245
|
expect(
|
|
233
246
|
isLegacyBlobRef({
|
|
234
247
|
cid: 'babbaaa',
|