@neko-makura/railid 4.3.3 → 5.0.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/README.md +39 -9
- package/index.d.ts +67 -0
- package/index.js +40 -2
- package/no-tpm.d.ts +39 -0
- package/no-tpm.js +11 -0
- package/package.json +14 -2
- package/v2.js +23 -0
- package/railid-tpm.linux-x64-gnu.node +0 -0
- package/railid.darwin-arm64.node +0 -0
- package/railid.darwin-x64.node +0 -0
- package/railid.linux-arm-gnu.node +0 -0
- package/railid.linux-arm64-gnu.node +0 -0
- package/railid.linux-arm64-musl.node +0 -0
- package/railid.linux-riscv64-gnu.node +0 -0
- package/railid.linux-x64-gnu.node +0 -0
- package/railid.linux-x64-musl.node +0 -0
- package/railid.win32-arm64-msvc.node +0 -0
- package/railid.win32-x64-msvc.node +0 -0
package/README.md
CHANGED
|
@@ -9,7 +9,9 @@ Native N-API bindings for [RailID](https://crates.io/crates/railid).
|
|
|
9
9
|
npm install @neko-makura/railid
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
The
|
|
12
|
+
The npm install pulls in one of the ten optional `@neko-makura/railid-<target>`
|
|
13
|
+
packages, each containing that platform's prebuilt N-API addon. The main
|
|
14
|
+
package itself is JavaScript only. Node.js 18 or newer is required.
|
|
13
15
|
|
|
14
16
|
## Platforms
|
|
15
17
|
|
|
@@ -26,14 +28,31 @@ The package includes prebuilt N-API binaries. Node.js 18 or newer is required.
|
|
|
26
28
|
| macOS | x64 | — | OS-only |
|
|
27
29
|
| macOS | arm64 | — | OS-only |
|
|
28
30
|
|
|
29
|
-
`index.js` selects the
|
|
30
|
-
Linux, whether the Node process runs on glibc or musl.
|
|
31
|
+
`index.js` selects the platform package from `process.platform`, `process.arch`
|
|
32
|
+
and, on Linux, whether the Node process runs on glibc or musl. A local `.node`
|
|
33
|
+
file in the checkout takes precedence, so `npm run build` still works. When the
|
|
34
|
+
addon's version differs from the JavaScript package, loading warns (minor)
|
|
35
|
+
or fails (major). The darwin packages may lag a release while a macOS runner
|
|
36
|
+
is unavailable; check `railid.version()` before relying on new APIs.
|
|
31
37
|
|
|
32
38
|
The riscv64 addon targets the `riscv64gc` glibc ABI used by distribution Node
|
|
33
39
|
builds (for example Ubuntu 24.04). Node.js does not publish official riscv64
|
|
34
40
|
binaries; use a distribution package.
|
|
35
41
|
|
|
36
42
|
|
|
43
|
+
|
|
44
|
+
## v5 timestamp-less formats
|
|
45
|
+
|
|
46
|
+
`generateV5192()` / `generateV5126()` produce 32- / 21-character identifiers
|
|
47
|
+
with no timestamp and no time ordering. Their values are identical to the
|
|
48
|
+
equivalent v2 formats (custom 192-bit without a timestamp and the `B126`
|
|
49
|
+
preset). Buffer variants (`generateV5192Buffer`, `generateV5126Buffer`) and
|
|
50
|
+
contiguous batch variants (`generateV5192ManyEncoded`, `generateV5126ManyEncoded`)
|
|
51
|
+
avoid JavaScript string allocations. `decodeV5192()` / `decodeV5126()` validate
|
|
52
|
+
and return the canonical spelling. The strings are not self-describing: decode
|
|
53
|
+
with the intended function and store an external format tag when formats are
|
|
54
|
+
mixed. The `no-tpm` entry point maps each v5 generator to its OS-only variant.
|
|
55
|
+
|
|
37
56
|
## Usage
|
|
38
57
|
|
|
39
58
|
```js
|
|
@@ -110,8 +129,8 @@ still never falls back implicitly.
|
|
|
110
129
|
| `backend()` | `"tpm" \| "os-only"` | Backend compiled into the loaded binary |
|
|
111
130
|
|
|
112
131
|
v2 adds `generateV2`, `generateV2Buffer`, `generateV2Many`,
|
|
113
|
-
`generateV2ManyEncoded`, `
|
|
114
|
-
[RailID v2](#railid-v2) below.
|
|
132
|
+
`generateV2ManyEncoded`, `generateV2ManyAsync`, `generateV2ManyEncodedAsync`,
|
|
133
|
+
`decodeV2`, and `formatV2`; see [RailID v2](#railid-v2) below.
|
|
115
134
|
|
|
116
135
|
Limits:
|
|
117
136
|
|
|
@@ -241,6 +260,10 @@ const custom = railid.formatV2({
|
|
|
241
260
|
// Batches use one format. The buffer has count * encodedLen bytes.
|
|
242
261
|
const ids = railid.generateV2Many({ bits: 192 }, 1000); // string[]
|
|
243
262
|
const buffer = railid.generateV2ManyEncoded({ bits: 192 }, 1000); // 32,000 bytes
|
|
263
|
+
|
|
264
|
+
// Async batches resolve with the same shapes after running off the JS thread.
|
|
265
|
+
const asyncIds = await railid.generateV2ManyAsync({ bits: 192 }, 1000);
|
|
266
|
+
const asyncBuffer = await railid.generateV2ManyEncodedAsync({ bits: 192 }, 1000);
|
|
244
267
|
```
|
|
245
268
|
|
|
246
269
|
| Preset | Bits | Timestamp | Random | Characters |
|
|
@@ -263,11 +286,17 @@ const buffer = railid.generateV2ManyEncoded({ bits: 192 }, 1000); // 32,000 byte
|
|
|
263
286
|
- The v2 epoch is `2020-01-01T00:00:00Z`. Timestamps are returned as decimal
|
|
264
287
|
strings to preserve 64-bit ticks and 128-bit microsecond values.
|
|
265
288
|
- `generateV2Many` and `generateV2ManyEncoded` reject counts above 1,024 (TPM)
|
|
266
|
-
or 1,000,000 (OS-only) before allocating.
|
|
289
|
+
or 1,000,000 (OS-only) before allocating. The async variants
|
|
290
|
+
(`generateV2ManyAsync`, `generateV2ManyEncodedAsync`) apply the same caps
|
|
291
|
+
synchronously, before scheduling work on the libuv thread pool; only the
|
|
292
|
+
generation itself is asynchronous. Errors use the stable codes in
|
|
267
293
|
[Errors](#errors); invalid formats and lengths report `InvalidInput`.
|
|
294
|
+
- The async v2 batches keep the TPM profile fail-closed: without a usable TPM
|
|
295
|
+
they reject with `TpmUnavailable` instead of falling back to OS randomness.
|
|
268
296
|
- v2 is not wire-compatible with v1. See `docs/SPEC-v2.md` in the repository.
|
|
269
297
|
- The `no-tpm` entry point exposes `generateV2`, `generateV2Buffer`,
|
|
270
|
-
`generateV2Many`,
|
|
298
|
+
`generateV2Many`, `generateV2ManyEncoded`, `generateV2ManyAsync`, and
|
|
299
|
+
`generateV2ManyEncodedAsync` with the OS-only profile.
|
|
271
300
|
Batch encoded buffers use `count * formatV2(format).encodedLen` bytes.
|
|
272
301
|
|
|
273
302
|
## Caller-provided buffer APIs
|
|
@@ -316,8 +345,9 @@ sudo apt install libtss2
|
|
|
316
345
|
```
|
|
317
346
|
|
|
318
347
|
Alpine, arm64, armv7 and riscv64 ship the OS-only backend only. Those
|
|
319
|
-
platforms
|
|
320
|
-
throws `TpmUnavailable` and `generateOsOnly()` is the supported
|
|
348
|
+
platforms resolve a per-platform `@neko-makura/railid-<target>` package, so
|
|
349
|
+
`generate()` throws `TpmUnavailable` and `generateOsOnly()` is the supported
|
|
350
|
+
profile.
|
|
321
351
|
|
|
322
352
|
Windows uses the system TBS service (`Tbs.dll`) and needs no extra DLL. macOS
|
|
323
353
|
ships the OS-only backend.
|
package/index.d.ts
CHANGED
|
@@ -43,6 +43,49 @@ export declare function generateBuffer(): Buffer;
|
|
|
43
43
|
/** Generate one OS-only RailID as 32 ASCII bytes, without a JS string. */
|
|
44
44
|
export declare function generateOsOnlyBuffer(): Buffer;
|
|
45
45
|
|
|
46
|
+
|
|
47
|
+
/** Generate one timestamp-less 192-bit v5 RailID (32 characters) with TPM hybrid. */
|
|
48
|
+
export declare function generateV5192(): string;
|
|
49
|
+
|
|
50
|
+
/** Generate one timestamp-less 192-bit v5 RailID with the OS-only profile. */
|
|
51
|
+
export declare function generateV5192OsOnly(): string;
|
|
52
|
+
|
|
53
|
+
/** Generate one timestamp-less 126-bit v5 RailID (21 characters) with TPM hybrid. */
|
|
54
|
+
export declare function generateV5126(): string;
|
|
55
|
+
|
|
56
|
+
/** Generate one timestamp-less 126-bit v5 RailID with the OS-only profile. */
|
|
57
|
+
export declare function generateV5126OsOnly(): string;
|
|
58
|
+
|
|
59
|
+
/** Generate one v5-192 value as 32 ASCII bytes with the TPM hybrid profile. */
|
|
60
|
+
export declare function generateV5192Buffer(): Buffer;
|
|
61
|
+
|
|
62
|
+
/** Generate one v5-192 value as 32 ASCII bytes with the OS-only profile. */
|
|
63
|
+
export declare function generateV5192BufferOsOnly(): Buffer;
|
|
64
|
+
|
|
65
|
+
/** Generate one v5-126 value as 21 ASCII bytes with the TPM hybrid profile. */
|
|
66
|
+
export declare function generateV5126Buffer(): Buffer;
|
|
67
|
+
|
|
68
|
+
/** Generate one v5-126 value as 21 ASCII bytes with the OS-only profile. */
|
|
69
|
+
export declare function generateV5126BufferOsOnly(): Buffer;
|
|
70
|
+
|
|
71
|
+
/** Generate `count` v5-192 IDs as one contiguous `count * 32` Buffer. */
|
|
72
|
+
export declare function generateV5192ManyEncoded(count: number): Buffer;
|
|
73
|
+
|
|
74
|
+
/** Generate `count` v5-192 IDs with the OS-only profile. */
|
|
75
|
+
export declare function generateV5192ManyEncodedOsOnly(count: number): Buffer;
|
|
76
|
+
|
|
77
|
+
/** Generate `count` v5-126 IDs as one contiguous `count * 21` Buffer. */
|
|
78
|
+
export declare function generateV5126ManyEncoded(count: number): Buffer;
|
|
79
|
+
|
|
80
|
+
/** Generate `count` v5-126 IDs with the OS-only profile. */
|
|
81
|
+
export declare function generateV5126ManyEncodedOsOnly(count: number): Buffer;
|
|
82
|
+
|
|
83
|
+
/** Validate a v5-192 string and return its canonical spelling. */
|
|
84
|
+
export declare function decodeV5192(input: string): string;
|
|
85
|
+
|
|
86
|
+
/** Validate a v5-126 string and return its canonical spelling. */
|
|
87
|
+
export declare function decodeV5126(input: string): string;
|
|
88
|
+
|
|
46
89
|
/**
|
|
47
90
|
* Generate one 126-bit v4 RailID as a 21-character string with the TPM hybrid
|
|
48
91
|
* profile. Throws `TpmUnavailable` rather than falling back to OS-only.
|
|
@@ -193,6 +236,30 @@ export declare function generateV2Many(format: V2Format, count: number): string[
|
|
|
193
236
|
/** Generate `count` v2 values as one contiguous `count * encodedLen` Buffer. */
|
|
194
237
|
export declare function generateV2ManyEncoded(format: V2Format, count: number): Buffer;
|
|
195
238
|
|
|
239
|
+
/**
|
|
240
|
+
* Generate `count` v2 values asynchronously as a string array with the TPM
|
|
241
|
+
* hybrid profile. The batch runs on a libuv worker thread. Capped at 1,024
|
|
242
|
+
* IDs; fails closed with `TpmUnavailable` when no TPM is usable. Invalid
|
|
243
|
+
* formats and counts throw `InvalidInput` synchronously, before any work is
|
|
244
|
+
* scheduled.
|
|
245
|
+
*/
|
|
246
|
+
export declare function generateV2ManyAsync(
|
|
247
|
+
format: V2Format,
|
|
248
|
+
count: number,
|
|
249
|
+
): Promise<string[]>;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Generate `count` v2 values asynchronously as one contiguous
|
|
253
|
+
* `count * encodedLen` Buffer with the TPM hybrid profile. The batch runs on a
|
|
254
|
+
* libuv worker thread. Capped at 1,024 IDs; fails closed with
|
|
255
|
+
* `TpmUnavailable` when no TPM is usable. Invalid formats and counts throw
|
|
256
|
+
* `InvalidInput` synchronously, before any work is scheduled.
|
|
257
|
+
*/
|
|
258
|
+
export declare function generateV2ManyEncodedAsync(
|
|
259
|
+
format: V2Format,
|
|
260
|
+
count: number,
|
|
261
|
+
): Promise<Buffer>;
|
|
262
|
+
|
|
196
263
|
/** Decode a v2 value with the expected format. */
|
|
197
264
|
export declare function decodeV2(input: string, format: V2Format): V2Decoded;
|
|
198
265
|
|
package/index.js
CHANGED
|
@@ -43,8 +43,12 @@ function candidates() {
|
|
|
43
43
|
|
|
44
44
|
let binding = null;
|
|
45
45
|
let backend = null;
|
|
46
|
+
let nativePackage = null;
|
|
46
47
|
const loadErrors = [];
|
|
47
48
|
|
|
49
|
+
// A local build wins so development and the CI test flows keep working without
|
|
50
|
+
// installing anything. Published installs resolve the addon through the
|
|
51
|
+
// per-platform package instead (ADR-014).
|
|
48
52
|
for (const file of candidates()) {
|
|
49
53
|
try {
|
|
50
54
|
binding = require(path.join(__dirname, file));
|
|
@@ -56,15 +60,47 @@ for (const file of candidates()) {
|
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
if (!binding) {
|
|
63
|
+
const tag = suffix();
|
|
64
|
+
nativePackage = `@neko-makura/railid-${tag}`;
|
|
65
|
+
try {
|
|
66
|
+
binding = require(nativePackage);
|
|
67
|
+
backend = typeof binding.backend === 'function' ? binding.backend() : 'unknown';
|
|
68
|
+
} catch (error) {
|
|
69
|
+
loadErrors.push(`${nativePackage}: ${error.message}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!binding) {
|
|
74
|
+
const tag = suffix();
|
|
59
75
|
const error = new Error(
|
|
60
76
|
`No usable RailID native addon for ${process.platform}/${process.arch}. ` +
|
|
61
|
-
`Tried: ${candidates().join(', ')}. ` +
|
|
62
|
-
'Install
|
|
77
|
+
`Tried: ${[...candidates(), `@neko-makura/railid-${tag}`].join(', ')}. ` +
|
|
78
|
+
'Install `@neko-makura/railid` again to refresh its optional platform ' +
|
|
79
|
+
'package, or run `npm run build` with Rust and the platform TPM libraries.'
|
|
63
80
|
);
|
|
64
81
|
error.cause = loadErrors.join('\n');
|
|
65
82
|
throw error;
|
|
66
83
|
}
|
|
67
84
|
|
|
85
|
+
// A platform package that lags behind the JavaScript package would silently
|
|
86
|
+
// miss entry points, so report the difference instead. Major differences are
|
|
87
|
+
// fatal; a patch or minor difference is a warning.
|
|
88
|
+
if (typeof binding.version === 'function') {
|
|
89
|
+
const expected = require('./package.json').version;
|
|
90
|
+
const actual = binding.version();
|
|
91
|
+
const differs = actual !== expected;
|
|
92
|
+
const majorDiffers = actual.split('.')[0] !== expected.split('.')[0];
|
|
93
|
+
if (differs) {
|
|
94
|
+
const message =
|
|
95
|
+
`RailID addon version ${actual} does not match @neko-makura/railid ${expected}` +
|
|
96
|
+
`${nativePackage ? ` (loaded from ${nativePackage})` : ' (loaded from a local build)'}.`;
|
|
97
|
+
if (majorDiffers) {
|
|
98
|
+
throw new Error(`${message} Reinstall the package to refresh its platform packages.`);
|
|
99
|
+
}
|
|
100
|
+
process.emitWarning(`${message} Some APIs may be unavailable.`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
68
104
|
const {
|
|
69
105
|
checkCount,
|
|
70
106
|
batchLimit,
|
|
@@ -89,6 +125,8 @@ for (const key of Object.keys(publicBinding)) {
|
|
|
89
125
|
key === 'v2GenerateMany' ||
|
|
90
126
|
key === 'v2GenerateManyEncoded' ||
|
|
91
127
|
key === 'v2GenerateManyEncodedInto' ||
|
|
128
|
+
key === 'v2GenerateManyAsync' ||
|
|
129
|
+
key === 'v2GenerateManyEncodedAsync' ||
|
|
92
130
|
key === 'generateManyEncodedInto' ||
|
|
93
131
|
key === 'generateV4ManyEncodedInto' ||
|
|
94
132
|
key === 'generateV4ManyEncodedOsOnlyInto'
|
package/no-tpm.d.ts
CHANGED
|
@@ -15,6 +15,24 @@ export declare function generateBuffer(): Buffer;
|
|
|
15
15
|
/** Same as `generateBuffer()`; kept for symmetry. */
|
|
16
16
|
export declare function generateOsOnlyBuffer(): Buffer;
|
|
17
17
|
|
|
18
|
+
|
|
19
|
+
/** Generate one timestamp-less 192-bit v5 value (32 characters). */
|
|
20
|
+
export declare function generateV5192(): string;
|
|
21
|
+
/** Generate one timestamp-less 192-bit v5 value as 32 ASCII bytes. */
|
|
22
|
+
export declare function generateV5192Buffer(): Buffer;
|
|
23
|
+
/** Generate `count` v5-192 IDs as one contiguous `count * 32` Buffer. */
|
|
24
|
+
export declare function generateV5192ManyEncoded(count: number): Buffer;
|
|
25
|
+
/** Generate one timestamp-less 126-bit v5 value (21 characters). */
|
|
26
|
+
export declare function generateV5126(): string;
|
|
27
|
+
/** Generate one timestamp-less 126-bit v5 value as 21 ASCII bytes. */
|
|
28
|
+
export declare function generateV5126Buffer(): Buffer;
|
|
29
|
+
/** Generate `count` v5-126 IDs as one contiguous `count * 21` Buffer. */
|
|
30
|
+
export declare function generateV5126ManyEncoded(count: number): Buffer;
|
|
31
|
+
/** Validate a v5-192 string and return its canonical spelling. */
|
|
32
|
+
export declare function decodeV5192(input: string): string;
|
|
33
|
+
/** Validate a v5-126 string and return its canonical spelling. */
|
|
34
|
+
export declare function decodeV5126(input: string): string;
|
|
35
|
+
|
|
18
36
|
/** Generate one 126-bit v4 RailID as a 21-character string with the OS-only profile. */
|
|
19
37
|
export declare function generateV4(): string;
|
|
20
38
|
|
|
@@ -97,6 +115,27 @@ export declare function generateV2Many(format: V2Format, count: number): string[
|
|
|
97
115
|
/** Generate `count` OS-only v2 values as one contiguous `count * encodedLen` Buffer. */
|
|
98
116
|
export declare function generateV2ManyEncoded(format: V2Format, count: number): Buffer;
|
|
99
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Generate `count` OS-only v2 values asynchronously as a string array. The
|
|
120
|
+
* batch runs on a libuv worker thread and is capped at 1,000,000 IDs. Invalid
|
|
121
|
+
* formats and counts throw `InvalidInput` synchronously.
|
|
122
|
+
*/
|
|
123
|
+
export declare function generateV2ManyAsync(
|
|
124
|
+
format: V2Format,
|
|
125
|
+
count: number,
|
|
126
|
+
): Promise<string[]>;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Generate `count` OS-only v2 values asynchronously as one contiguous
|
|
130
|
+
* `count * encodedLen` Buffer. The batch runs on a libuv worker thread and is
|
|
131
|
+
* capped at 1,000,000 IDs. Invalid formats and counts throw `InvalidInput`
|
|
132
|
+
* synchronously.
|
|
133
|
+
*/
|
|
134
|
+
export declare function generateV2ManyEncodedAsync(
|
|
135
|
+
format: V2Format,
|
|
136
|
+
count: number,
|
|
137
|
+
): Promise<Buffer>;
|
|
138
|
+
|
|
100
139
|
/** Decode a v2 value with the expected format. */
|
|
101
140
|
export declare function decodeV2(input: string, format: V2Format): V2Decoded;
|
|
102
141
|
|
package/no-tpm.js
CHANGED
|
@@ -19,6 +19,13 @@ module.exports = {
|
|
|
19
19
|
generateV4ManyEncoded: (count) => core.generateV4ManyEncodedOsOnly(count),
|
|
20
20
|
generateV4ManyEncodedAsync: (count) => core.generateV4ManyEncodedOsOnlyAsync(count),
|
|
21
21
|
generateV4ManyEncodedInto: (buffer) => core.generateV4ManyEncodedOsOnlyInto(buffer),
|
|
22
|
+
// v5 is timestamp-less; these entry points never touch the TPM.
|
|
23
|
+
generateV5192: () => core.generateV5192OsOnly(),
|
|
24
|
+
generateV5192Buffer: () => core.generateV5192BufferOsOnly(),
|
|
25
|
+
generateV5192ManyEncoded: (count) => core.generateV5192ManyEncodedOsOnly(count),
|
|
26
|
+
generateV5126: () => core.generateV5126OsOnly(),
|
|
27
|
+
generateV5126Buffer: () => core.generateV5126BufferOsOnly(),
|
|
28
|
+
generateV5126ManyEncoded: (count) => core.generateV5126ManyEncodedOsOnly(count),
|
|
22
29
|
// The `osOnly` argument is accepted for signature compatibility and always
|
|
23
30
|
// resolves to the OS-only profile.
|
|
24
31
|
generateMany: (count) => core.generateMany(count, true),
|
|
@@ -31,6 +38,10 @@ module.exports = {
|
|
|
31
38
|
generateV2Many: (format, count) => core.generateV2Many(format, count, 'os-only'),
|
|
32
39
|
generateV2ManyEncoded: (format, count) =>
|
|
33
40
|
core.generateV2ManyEncoded(format, count, 'os-only'),
|
|
41
|
+
generateV2ManyAsync: (format, count) =>
|
|
42
|
+
core.generateV2ManyAsync(format, count, 'os-only'),
|
|
43
|
+
generateV2ManyEncodedAsync: (format, count) =>
|
|
44
|
+
core.generateV2ManyEncodedAsync(format, count, 'os-only'),
|
|
34
45
|
// The loaded binary may still contain the TPM backend, but this module never
|
|
35
46
|
// calls it.
|
|
36
47
|
backend: () => 'os-only',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neko-makura/railid",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Native N-API bindings for RailID: 192-bit v1 and variable-length v2 timestamp-first identifiers with TPM 2.0 + OS CSPRNG randomness",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -32,14 +32,26 @@
|
|
|
32
32
|
"no-tpm.js",
|
|
33
33
|
"no-tpm.d.ts",
|
|
34
34
|
"v2.js",
|
|
35
|
-
"*.node",
|
|
36
35
|
"README.md",
|
|
37
36
|
"LICENSE"
|
|
38
37
|
],
|
|
39
38
|
"scripts": {
|
|
40
39
|
"build": "node scripts/build.js",
|
|
40
|
+
"npm-dirs": "node scripts/create-npm-dirs.js",
|
|
41
41
|
"verify": "node scripts/verify.js",
|
|
42
42
|
"test": "node test.js",
|
|
43
43
|
"pack:check": "npm pack --dry-run"
|
|
44
|
+
},
|
|
45
|
+
"optionalDependencies": {
|
|
46
|
+
"@neko-makura/railid-darwin-arm64": ">=5.0.0 <6",
|
|
47
|
+
"@neko-makura/railid-darwin-x64": ">=5.0.0 <6",
|
|
48
|
+
"@neko-makura/railid-linux-arm-gnu": ">=5.0.0 <6",
|
|
49
|
+
"@neko-makura/railid-linux-arm64-gnu": ">=5.0.0 <6",
|
|
50
|
+
"@neko-makura/railid-linux-arm64-musl": ">=5.0.0 <6",
|
|
51
|
+
"@neko-makura/railid-linux-riscv64-gnu": ">=5.0.0 <6",
|
|
52
|
+
"@neko-makura/railid-linux-x64-gnu": ">=5.0.0 <6",
|
|
53
|
+
"@neko-makura/railid-linux-x64-musl": ">=5.0.0 <6",
|
|
54
|
+
"@neko-makura/railid-win32-arm64-msvc": ">=5.0.0 <6",
|
|
55
|
+
"@neko-makura/railid-win32-x64-msvc": ">=5.0.0 <6"
|
|
44
56
|
}
|
|
45
57
|
}
|
package/v2.js
CHANGED
|
@@ -204,6 +204,27 @@ module.exports = function createV2(binding) {
|
|
|
204
204
|
return buffer;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
+
// Async batches validate the format and count on the JS thread; only the
|
|
208
|
+
// generation runs on a libuv worker. The resolved values have the same shape
|
|
209
|
+
// as the synchronous functions.
|
|
210
|
+
function generateV2ManyAsync(format, count, profile) {
|
|
211
|
+
const degraded = profile === 'os-only';
|
|
212
|
+
checkCount(count, batchLimit(degraded));
|
|
213
|
+
const args = toNativeArguments(format);
|
|
214
|
+
const entry = cachedInfo(args);
|
|
215
|
+
emitWarnings(entry.commands);
|
|
216
|
+
return binding.v2GenerateManyAsync(...args, count, degraded);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function generateV2ManyEncodedAsync(format, count, profile) {
|
|
220
|
+
const degraded = profile === 'os-only';
|
|
221
|
+
checkCount(count, batchLimit(degraded));
|
|
222
|
+
const args = toNativeArguments(format);
|
|
223
|
+
const entry = cachedInfo(args);
|
|
224
|
+
emitWarnings(entry.commands);
|
|
225
|
+
return binding.v2GenerateManyEncodedAsync(...args, count, degraded);
|
|
226
|
+
}
|
|
227
|
+
|
|
207
228
|
function decodeV2(input, format) {
|
|
208
229
|
if (typeof input !== 'string') {
|
|
209
230
|
throw new TypeError('input must be a string');
|
|
@@ -216,6 +237,8 @@ module.exports = function createV2(binding) {
|
|
|
216
237
|
generateV2Buffer,
|
|
217
238
|
generateV2Many,
|
|
218
239
|
generateV2ManyEncoded,
|
|
240
|
+
generateV2ManyAsync,
|
|
241
|
+
generateV2ManyEncodedAsync,
|
|
219
242
|
decodeV2,
|
|
220
243
|
formatV2,
|
|
221
244
|
};
|
|
Binary file
|
package/railid.darwin-arm64.node
DELETED
|
Binary file
|
package/railid.darwin-x64.node
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|