@reventlessdev/rescript-node 2.0.0-alpha.0 → 2.0.0-alpha.2
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/package.json +1 -1
- package/src/NodeBuffer.res +21 -0
- package/src/NodeBuffer.res.mjs +2 -0
- package/src/NodeCrypto.res +6 -0
- package/src/NodeCrypto.res.mjs +11 -1
- package/src/NodeFs.res +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 2.0.0-alpha.2 (2026-08-05)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **local:** persist the object store beside the SQLite database ([f37e4a1](https://github.com/ReventlessDev/reventless-core/commit/f37e4a1ad3191a97f14f3db7e2ead0e2b27b46c2))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# 2.0.0-alpha.1 (2026-08-02)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **rescript-node:** add NodeCrypto.sha256Hex convenience ([047d2a2](https://github.com/ReventlessDev/reventless-core/commit/047d2a297cee4738b9daf50b1c988532db8e13df))
|
|
18
|
+
|
|
19
|
+
|
|
6
20
|
# 2.0.0-alpha.0 (2026-07-31)
|
|
7
21
|
|
|
8
22
|
* feat(rescript)!: one Node bindings package, not two ([1258d8c](https://github.com/ReventlessDev/reventless-core/commit/1258d8c2b2ff2636b36a849fc5bdf9005c6fb0eb))
|
package/package.json
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Bindings for Node's global [`Buffer`](https://nodejs.org/api/buffer.html).
|
|
2
|
+
|
|
3
|
+
`t` aliases `Uint8Array.t` rather than being abstract: a Node `Buffer` *is* a
|
|
4
|
+
`Uint8Array` subclass, so the bytes a stream hands over, the bytes
|
|
5
|
+
{!NodeFs.readFileSyncBuffer} returns, and the bytes {!NodeFs.writeFileSyncBuffer}
|
|
6
|
+
takes are all the same values. Aliasing lets them flow between those calls
|
|
7
|
+
without a cast that would exist only to satisfy the type checker. */
|
|
8
|
+
type t = Uint8Array.t
|
|
9
|
+
|
|
10
|
+
/** Joins byte chunks into one buffer — how a request body is assembled from the
|
|
11
|
+
chunks its `data` events deliver. */
|
|
12
|
+
@val @scope("Buffer")
|
|
13
|
+
external concat: array<t> => t = "concat"
|
|
14
|
+
|
|
15
|
+
/** Bakes the encoding in for the same reason {!NodeFs.readFileSync} does: the
|
|
16
|
+
`(string, string)` form permits a different, silently wrong, encoding name. */
|
|
17
|
+
@val @scope("Buffer")
|
|
18
|
+
external fromStringUtf8: (string, @as("utf8") _) => t = "from"
|
|
19
|
+
|
|
20
|
+
@send
|
|
21
|
+
external toStringUtf8: (t, @as("utf8") _) => string = "toString"
|
package/src/NodeCrypto.res
CHANGED
|
@@ -17,6 +17,12 @@ external createHash: string => hash = "createHash"
|
|
|
17
17
|
@send external hashUpdateBuffer: (hash, Uint8Array.t) => hash = "update"
|
|
18
18
|
@send external hashDigest: (hash, string) => string = "digest"
|
|
19
19
|
|
|
20
|
+
/** SHA-256 of a UTF-8 string, hex-encoded. The content hash content-addressed
|
|
21
|
+
stores key their objects on (`sha256/<hash>`): the same bytes always yield the
|
|
22
|
+
same digest, so an upload is idempotent and deduplicating. */
|
|
23
|
+
let sha256Hex = (input: string): string =>
|
|
24
|
+
createHash("sha256")->hashUpdate(input)->hashDigest("hex")
|
|
25
|
+
|
|
20
26
|
// ── HMAC ─────────────────────────────────────────────────────────────────────
|
|
21
27
|
|
|
22
28
|
type hmac
|
package/src/NodeCrypto.res.mjs
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import * as Nodecrypto from "node:crypto";
|
|
4
|
+
|
|
5
|
+
function sha256Hex(input) {
|
|
6
|
+
return Nodecrypto.createHash("sha256").update(input).digest("hex");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
sha256Hex,
|
|
11
|
+
}
|
|
12
|
+
/* node:crypto Not a pure module */
|
package/src/NodeFs.res
CHANGED
|
@@ -32,6 +32,12 @@ external readFileSyncBuffer: string => Uint8Array.t = "readFileSync"
|
|
|
32
32
|
@module("node:fs")
|
|
33
33
|
external writeFileSync: (string, string, @as("utf8") _) => unit = "writeFileSync"
|
|
34
34
|
|
|
35
|
+
/** The byte-oriented companion to {!writeFileSync}, mirroring
|
|
36
|
+
{!readFileSyncBuffer}: no encoding to bake in, because the payload is
|
|
37
|
+
already bytes. */
|
|
38
|
+
@module("node:fs")
|
|
39
|
+
external writeFileSyncBuffer: (string, Uint8Array.t) => unit = "writeFileSync"
|
|
40
|
+
|
|
35
41
|
// ── Directories ──────────────────────────────────────────────────────────────
|
|
36
42
|
|
|
37
43
|
type dirent
|