@specific.dev/spectest 0.26.0 → 0.28.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/dist/aws-sigv4.d.ts +42 -0
- package/dist/aws-sigv4.js +166 -0
- package/dist/browser.d.ts +314 -0
- package/dist/browser.js +1320 -0
- package/dist/components/email.d.ts +135 -0
- package/dist/components/email.js +271 -0
- package/dist/components/expo.d.ts +69 -0
- package/dist/components/expo.js +125 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.js +18 -0
- package/dist/components/k3s.d.ts +172 -0
- package/dist/components/k3s.js +1124 -0
- package/dist/components/postgres.d.ts +93 -0
- package/dist/components/postgres.js +58 -0
- package/dist/components/replayFake.d.ts +169 -0
- package/dist/components/replayFake.js +738 -0
- package/dist/components/s3.d.ts +99 -0
- package/dist/components/s3.js +81 -0
- package/dist/components/supabase.d.ts +197 -0
- package/dist/components/supabase.js +1003 -0
- package/dist/daemon.d.ts +1 -0
- package/dist/daemon.js +4611 -0
- package/dist/ids.d.ts +2 -0
- package/{src/ids.ts → dist/ids.js} +46 -50
- package/dist/index.d.ts +1328 -0
- package/dist/index.js +769 -0
- package/dist/ingress.d.ts +114 -0
- package/dist/ingress.js +210 -0
- package/dist/inspect.d.ts +228 -0
- package/dist/inspect.js +429 -0
- package/dist/locator.d.ts +260 -0
- package/dist/locator.js +293 -0
- package/dist/mobile.d.ts +71 -0
- package/dist/mobile.js +65 -0
- package/dist/record-secrets.d.ts +9 -0
- package/{src/record-secrets.ts → dist/record-secrets.js} +13 -15
- package/dist/recorder.d.ts +527 -0
- package/dist/recorder.js +219 -0
- package/dist/redis.d.ts +54 -0
- package/dist/redis.js +126 -0
- package/dist/replay-bundle.d.ts +38 -0
- package/{src/replay-bundle.ts → dist/replay-bundle.js} +29 -47
- package/dist/resolver.d.ts +1 -0
- package/dist/resolver.js +309 -0
- package/dist/s3.d.ts +89 -0
- package/dist/s3.js +198 -0
- package/dist/sql.d.ts +74 -0
- package/dist/sql.js +151 -0
- package/dist/terminal.d.ts +161 -0
- package/dist/terminal.js +538 -0
- package/package.json +24 -9
- package/src/browser.ts +0 -1819
- package/src/components/email.ts +0 -398
- package/src/components/expo.ts +0 -167
- package/src/components/index.ts +0 -63
- package/src/components/k3s.ts +0 -1312
- package/src/components/postgres.ts +0 -105
- package/src/components/replayFake.ts +0 -848
- package/src/components/s3.ts +0 -132
- package/src/components/supabase.ts +0 -1299
- package/src/daemon.ts +0 -4969
- package/src/index.ts +0 -2350
- package/src/ingress.ts +0 -288
- package/src/inspect.ts +0 -673
- package/src/locator.ts +0 -594
- package/src/mobile.ts +0 -133
- package/src/recorder.ts +0 -817
- package/src/redis.ts +0 -202
- package/src/resolver.ts +0 -351
- package/src/s3.ts +0 -333
- package/src/sql.ts +0 -243
- package/src/terminal.ts +0 -740
- package/src/vendor/rrweb-plugin-console-record.umd.js +0 -521
- package/src/vendor/rrweb-record.min.js +0 -5061
package/dist/ids.d.ts
ADDED
|
@@ -21,69 +21,65 @@
|
|
|
21
21
|
// This makes duplicates practically impossible, but the control plane
|
|
22
22
|
// still treats an id here as untrusted: shape-validated, and a duplicate
|
|
23
23
|
// insert is flagged per-artifact rather than clobbering anything.
|
|
24
|
-
|
|
25
24
|
import { createHash } from "node:crypto";
|
|
26
25
|
import { closeSync, openSync, readSync } from "node:fs";
|
|
27
|
-
|
|
28
26
|
/** Crockford base32, lowercased, minus `i`/`l`/`o`/`u` — mirrors ids.rs. */
|
|
29
27
|
const ALPHABET = "0123456789abcdefghjkmnpqrstvwxyz";
|
|
30
|
-
|
|
31
28
|
/** Random base32 chars after the version digit (100 bits of entropy). */
|
|
32
29
|
const RANDOM_LEN = 20;
|
|
33
|
-
|
|
34
30
|
let mintCounter = 0;
|
|
35
|
-
|
|
36
31
|
/** Mint a fresh id, e.g. `generateId("art")` → `art_0c3k9mpq…`. */
|
|
37
|
-
export function generateId(prefix
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
32
|
+
export function generateId(prefix) {
|
|
33
|
+
const digest = createHash("sha256")
|
|
34
|
+
.update(urandom(16))
|
|
35
|
+
.update(String(Date.now()))
|
|
36
|
+
.update(String(performance.now()))
|
|
37
|
+
.update(String(mintCounter++))
|
|
38
|
+
.digest();
|
|
39
|
+
return `${prefix}_0${base32Crockford(digest.subarray(0, 16)).slice(0, RANDOM_LEN)}`;
|
|
45
40
|
}
|
|
46
|
-
|
|
47
41
|
/** Read `n` bytes directly from /dev/urandom (NOT Bun's cached pool). */
|
|
48
|
-
function urandom(n
|
|
49
|
-
|
|
50
|
-
try {
|
|
51
|
-
const fd = openSync("/dev/urandom", "r");
|
|
42
|
+
function urandom(n) {
|
|
43
|
+
const buf = new Uint8Array(n);
|
|
52
44
|
try {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
45
|
+
const fd = openSync("/dev/urandom", "r");
|
|
46
|
+
try {
|
|
47
|
+
let off = 0;
|
|
48
|
+
while (off < n) {
|
|
49
|
+
const read = readSync(fd, buf, off, n - off, null);
|
|
50
|
+
if (read <= 0)
|
|
51
|
+
break;
|
|
52
|
+
off += read;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
closeSync(fd);
|
|
57
|
+
}
|
|
61
58
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
catch {
|
|
60
|
+
// Non-Linux host (SDK types compiled locally) or exotic failure — the
|
|
61
|
+
// clock + counter inputs still make the hash unique in practice.
|
|
62
|
+
crypto.getRandomValues(buf);
|
|
63
|
+
}
|
|
64
|
+
return buf;
|
|
68
65
|
}
|
|
69
|
-
|
|
70
66
|
/** Encode bytes as Crockford base32 (no padding). 16 bytes → 26 chars. */
|
|
71
|
-
function base32Crockford(bytes
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
67
|
+
function base32Crockford(bytes) {
|
|
68
|
+
let out = "";
|
|
69
|
+
let acc = 0;
|
|
70
|
+
let bits = 0;
|
|
71
|
+
for (const b of bytes) {
|
|
72
|
+
acc = (acc << 8) | b;
|
|
73
|
+
bits += 8;
|
|
74
|
+
while (bits >= 5) {
|
|
75
|
+
bits -= 5;
|
|
76
|
+
out += ALPHABET[(acc >> bits) & 0x1f];
|
|
77
|
+
}
|
|
78
|
+
// Keep the accumulator within 32-bit safe range for the `<<` operator.
|
|
79
|
+
acc &= (1 << bits) - 1;
|
|
80
|
+
}
|
|
81
|
+
if (bits > 0) {
|
|
82
|
+
out += ALPHABET[(acc << (5 - bits)) & 0x1f];
|
|
81
83
|
}
|
|
82
|
-
|
|
83
|
-
acc &= (1 << bits) - 1;
|
|
84
|
-
}
|
|
85
|
-
if (bits > 0) {
|
|
86
|
-
out += ALPHABET[(acc << (5 - bits)) & 0x1f];
|
|
87
|
-
}
|
|
88
|
-
return out;
|
|
84
|
+
return out;
|
|
89
85
|
}
|