@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.
Files changed (74) hide show
  1. package/dist/aws-sigv4.d.ts +42 -0
  2. package/dist/aws-sigv4.js +166 -0
  3. package/dist/browser.d.ts +314 -0
  4. package/dist/browser.js +1320 -0
  5. package/dist/components/email.d.ts +135 -0
  6. package/dist/components/email.js +271 -0
  7. package/dist/components/expo.d.ts +69 -0
  8. package/dist/components/expo.js +125 -0
  9. package/dist/components/index.d.ts +8 -0
  10. package/dist/components/index.js +18 -0
  11. package/dist/components/k3s.d.ts +172 -0
  12. package/dist/components/k3s.js +1124 -0
  13. package/dist/components/postgres.d.ts +93 -0
  14. package/dist/components/postgres.js +58 -0
  15. package/dist/components/replayFake.d.ts +169 -0
  16. package/dist/components/replayFake.js +738 -0
  17. package/dist/components/s3.d.ts +99 -0
  18. package/dist/components/s3.js +81 -0
  19. package/dist/components/supabase.d.ts +197 -0
  20. package/dist/components/supabase.js +1003 -0
  21. package/dist/daemon.d.ts +1 -0
  22. package/dist/daemon.js +4611 -0
  23. package/dist/ids.d.ts +2 -0
  24. package/{src/ids.ts → dist/ids.js} +46 -50
  25. package/dist/index.d.ts +1328 -0
  26. package/dist/index.js +769 -0
  27. package/dist/ingress.d.ts +114 -0
  28. package/dist/ingress.js +210 -0
  29. package/dist/inspect.d.ts +228 -0
  30. package/dist/inspect.js +429 -0
  31. package/dist/locator.d.ts +260 -0
  32. package/dist/locator.js +293 -0
  33. package/dist/mobile.d.ts +71 -0
  34. package/dist/mobile.js +65 -0
  35. package/dist/record-secrets.d.ts +9 -0
  36. package/{src/record-secrets.ts → dist/record-secrets.js} +13 -15
  37. package/dist/recorder.d.ts +527 -0
  38. package/dist/recorder.js +219 -0
  39. package/dist/redis.d.ts +54 -0
  40. package/dist/redis.js +126 -0
  41. package/dist/replay-bundle.d.ts +38 -0
  42. package/{src/replay-bundle.ts → dist/replay-bundle.js} +29 -47
  43. package/dist/resolver.d.ts +1 -0
  44. package/dist/resolver.js +309 -0
  45. package/dist/s3.d.ts +89 -0
  46. package/dist/s3.js +198 -0
  47. package/dist/sql.d.ts +74 -0
  48. package/dist/sql.js +151 -0
  49. package/dist/terminal.d.ts +161 -0
  50. package/dist/terminal.js +538 -0
  51. package/package.json +24 -9
  52. package/src/browser.ts +0 -1819
  53. package/src/components/email.ts +0 -398
  54. package/src/components/expo.ts +0 -167
  55. package/src/components/index.ts +0 -63
  56. package/src/components/k3s.ts +0 -1312
  57. package/src/components/postgres.ts +0 -105
  58. package/src/components/replayFake.ts +0 -848
  59. package/src/components/s3.ts +0 -132
  60. package/src/components/supabase.ts +0 -1299
  61. package/src/daemon.ts +0 -4969
  62. package/src/index.ts +0 -2350
  63. package/src/ingress.ts +0 -288
  64. package/src/inspect.ts +0 -673
  65. package/src/locator.ts +0 -594
  66. package/src/mobile.ts +0 -133
  67. package/src/recorder.ts +0 -817
  68. package/src/redis.ts +0 -202
  69. package/src/resolver.ts +0 -351
  70. package/src/s3.ts +0 -333
  71. package/src/sql.ts +0 -243
  72. package/src/terminal.ts +0 -740
  73. package/src/vendor/rrweb-plugin-console-record.umd.js +0 -521
  74. package/src/vendor/rrweb-record.min.js +0 -5061
package/dist/ids.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ /** Mint a fresh id, e.g. `generateId("art")` → `art_0c3k9mpq…`. */
2
+ export declare function generateId(prefix: string): string;
@@ -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: string): string {
38
- const digest = createHash("sha256")
39
- .update(urandom(16))
40
- .update(String(Date.now()))
41
- .update(String(performance.now()))
42
- .update(String(mintCounter++))
43
- .digest();
44
- return `${prefix}_0${base32Crockford(digest.subarray(0, 16)).slice(0, RANDOM_LEN)}`;
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: number): Uint8Array {
49
- const buf = new Uint8Array(n);
50
- try {
51
- const fd = openSync("/dev/urandom", "r");
42
+ function urandom(n) {
43
+ const buf = new Uint8Array(n);
52
44
  try {
53
- let off = 0;
54
- while (off < n) {
55
- const read = readSync(fd, buf, off, n - off, null);
56
- if (read <= 0) break;
57
- off += read;
58
- }
59
- } finally {
60
- closeSync(fd);
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
- } catch {
63
- // Non-Linux host (SDK types compiled locally) or exotic failure — the
64
- // clock + counter inputs still make the hash unique in practice.
65
- crypto.getRandomValues(buf);
66
- }
67
- return buf;
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: Uint8Array): string {
72
- let out = "";
73
- let acc = 0;
74
- let bits = 0;
75
- for (const b of bytes) {
76
- acc = (acc << 8) | b;
77
- bits += 8;
78
- while (bits >= 5) {
79
- bits -= 5;
80
- out += ALPHABET[(acc >> bits) & 0x1f];
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
- // Keep the accumulator within 32-bit safe range for the `<<` operator.
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
  }