@atproto/common 0.6.0 → 0.6.1

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atproto/common
2
2
 
3
+ ## 0.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4954](https://github.com/bluesky-social/atproto/pull/4954) [`e6c6343`](https://github.com/bluesky-social/atproto/commit/e6c6343bd3727455bd0da12300bb4929a944e4f1) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Add back support for any `Uint8Array` as input to the `ui8ToArrayBuffer` helper
8
+
9
+ - Updated dependencies [[`e6c6343`](https://github.com/bluesky-social/atproto/commit/e6c6343bd3727455bd0da12300bb4929a944e4f1)]:
10
+ - @atproto/lex-data@0.1.1
11
+
3
12
  ## 0.6.0
4
13
 
5
14
  ### Minor Changes
package/dist/buffers.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export declare function ui8ToBuffer(bytes: Uint8Array): Buffer;
2
- export declare function ui8ToArrayBuffer(bytes: Uint8Array<ArrayBuffer>): ArrayBuffer;
2
+ export declare function ui8ToArrayBuffer(bytes: Uint8Array): ArrayBuffer;
3
3
  //# sourceMappingURL=buffers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buffers.d.ts","sourceRoot":"","sources":["../src/buffers.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAErD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,WAAW,CAK5E"}
1
+ {"version":3,"file":"buffers.d.ts","sourceRoot":"","sources":["../src/buffers.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAErD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CAS/D"}
package/dist/buffers.js CHANGED
@@ -2,6 +2,9 @@ export function ui8ToBuffer(bytes) {
2
2
  return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
3
3
  }
4
4
  export function ui8ToArrayBuffer(bytes) {
5
- return bytes.buffer.slice(bytes.byteOffset, bytes.byteLength + bytes.byteOffset);
5
+ if (bytes.buffer instanceof ArrayBuffer) {
6
+ return bytes.buffer.slice(bytes.byteOffset, bytes.byteLength + bytes.byteOffset);
7
+ }
8
+ return new Uint8Array(bytes).buffer;
6
9
  }
7
10
  //# sourceMappingURL=buffers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"buffers.js","sourceRoot":"","sources":["../src/buffers.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAC,KAAiB;IAC3C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAA;AACtE,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAA8B;IAC7D,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CACvB,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CACpC,CAAA;AACH,CAAC","sourcesContent":["export function ui8ToBuffer(bytes: Uint8Array): Buffer {\n return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n}\n\nexport function ui8ToArrayBuffer(bytes: Uint8Array<ArrayBuffer>): ArrayBuffer {\n return bytes.buffer.slice(\n bytes.byteOffset,\n bytes.byteLength + bytes.byteOffset,\n )\n}\n"]}
1
+ {"version":3,"file":"buffers.js","sourceRoot":"","sources":["../src/buffers.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAC,KAAiB;IAC3C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAA;AACtE,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAiB;IAChD,IAAI,KAAK,CAAC,MAAM,YAAY,WAAW,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CACvB,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CACpC,CAAA;IACH,CAAC;IAED,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAA;AACrC,CAAC","sourcesContent":["export function ui8ToBuffer(bytes: Uint8Array): Buffer {\n return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n}\n\nexport function ui8ToArrayBuffer(bytes: Uint8Array): ArrayBuffer {\n if (bytes.buffer instanceof ArrayBuffer) {\n return bytes.buffer.slice(\n bytes.byteOffset,\n bytes.byteLength + bytes.byteOffset,\n )\n }\n\n return new Uint8Array(bytes).buffer\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/common",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "license": "MIT",
5
5
  "description": "Shared web-platform-friendly code for atproto libraries",
6
6
  "keywords": [
@@ -20,7 +20,7 @@
20
20
  "pino": "^8.21.0",
21
21
  "@atproto/common-web": "^0.5.0",
22
22
  "@atproto/lex-cbor": "^0.1.0",
23
- "@atproto/lex-data": "^0.1.0"
23
+ "@atproto/lex-data": "^0.1.1"
24
24
  },
25
25
  "devDependencies": {
26
26
  "jest": "^30.0.0",
package/src/buffers.ts CHANGED
@@ -2,9 +2,13 @@ export function ui8ToBuffer(bytes: Uint8Array): Buffer {
2
2
  return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength)
3
3
  }
4
4
 
5
- export function ui8ToArrayBuffer(bytes: Uint8Array<ArrayBuffer>): ArrayBuffer {
6
- return bytes.buffer.slice(
7
- bytes.byteOffset,
8
- bytes.byteLength + bytes.byteOffset,
9
- )
5
+ export function ui8ToArrayBuffer(bytes: Uint8Array): ArrayBuffer {
6
+ if (bytes.buffer instanceof ArrayBuffer) {
7
+ return bytes.buffer.slice(
8
+ bytes.byteOffset,
9
+ bytes.byteLength + bytes.byteOffset,
10
+ )
11
+ }
12
+
13
+ return new Uint8Array(bytes).buffer
10
14
  }