@blaxel/core 0.2.54 → 0.2.55-preview.17

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.
@@ -2,6 +2,7 @@
2
2
  // Browser-compatible exports for Node.js modules
3
3
  // In browser environments, Node.js built-in modules are not available
4
4
  // All Node.js modules are null in browser
5
+ export const crypto = null;
5
6
  export const fs = null;
6
7
  export const os = null;
7
8
  export const path = null;
@@ -3,6 +3,7 @@
3
3
  import * as fsImport from "fs";
4
4
  import * as osImport from "os";
5
5
  import * as pathImport from "path";
6
+ import * as cryptoImport from "crypto";
6
7
  // Detect environments
7
8
  const isNode = typeof process !== "undefined" &&
8
9
  process.versions != null &&
@@ -12,6 +13,7 @@ const isBrowser = typeof globalThis !== "undefined" && globalThis?.window !== un
12
13
  let fs = null;
13
14
  let os = null;
14
15
  let path = null;
16
+ let crypto = null;
15
17
  let dotenv = null;
16
18
  let ws = null; // Used internally by getWebSocket() for caching
17
19
  if (isNode && !isBrowser) {
@@ -19,6 +21,7 @@ if (isNode && !isBrowser) {
19
21
  fs = fsImport;
20
22
  os = osImport;
21
23
  path = pathImport;
24
+ crypto = cryptoImport;
22
25
  // Try to load optional dependencies
23
26
  try {
24
27
  dotenv = eval("require")("dotenv");
@@ -64,4 +67,4 @@ export async function getWebSocket() {
64
67
  throw new Error(`WebSocket library 'ws' not available: ${error?.message || error}`);
65
68
  }
66
69
  }
67
- export { dotenv, fs, os, path };
70
+ export { crypto, dotenv, fs, os, path };
@@ -0,0 +1,22 @@
1
+ /* eslint-disable */
2
+ // Browser/Edge-compatible exports for Sentry
3
+ // In browser/edge environments, @sentry/node is not available
4
+ // All functions are no-ops
5
+ /**
6
+ * Initialize Sentry - no-op in browser/edge environments.
7
+ */
8
+ export function initSentry() {
9
+ // No-op in browser/edge environments
10
+ }
11
+ /**
12
+ * Flush pending Sentry events - no-op in browser/edge environments.
13
+ */
14
+ export async function flushSentry(_timeout = 2000) {
15
+ // No-op in browser/edge environments
16
+ }
17
+ /**
18
+ * Check if Sentry is initialized - always returns false in browser/edge environments.
19
+ */
20
+ export function isSentryInitialized() {
21
+ return false;
22
+ }
@@ -3,8 +3,8 @@ import { authentication } from "../authentication/index.js";
3
3
  import { env } from "../common/env.js";
4
4
  import { fs, os, path } from "../common/node.js";
5
5
  // Build info - these placeholders are replaced at build time by build:replace-imports
6
- const BUILD_VERSION = "0.2.54";
7
- const BUILD_COMMIT = "36d148e9b7f9dd2134c772d954c8297b3c958ec3";
6
+ const BUILD_VERSION = "0.2.55-preview.17";
7
+ const BUILD_COMMIT = "1efcf3565af2e54805e7526888bebaf2347c5886";
8
8
  const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
9
9
  // Cache for config.yaml tracking value
10
10
  let configTrackingValue = null;
@@ -163,8 +163,9 @@ class Settings {
163
163
  }
164
164
  get tracking() {
165
165
  // Environment variable has highest priority
166
- if (env.BL_TRACKING !== undefined) {
167
- return env.BL_TRACKING === "true";
166
+ if (env.DO_NOT_TRACK !== undefined) {
167
+ // DO_NOT_TRACK has inverted semantics: true means tracking disabled
168
+ return env.DO_NOT_TRACK !== "true" && env.DO_NOT_TRACK !== "1";
168
169
  }
169
170
  // Then check config.yaml
170
171
  const configValue = getConfigTracking();
@@ -1,4 +1,4 @@
1
- import { createHmac, timingSafeEqual } from 'crypto';
1
+ import { crypto } from './node.js';
2
2
  /**
3
3
  * Verify the HMAC-SHA256 signature of a webhook callback from async-sidecar
4
4
  *
@@ -31,6 +31,10 @@ export function verifyWebhookSignature(options) {
31
31
  if (!body || !signature || !secret) {
32
32
  return false;
33
33
  }
34
+ // crypto is only available in Node.js environments
35
+ if (!crypto) {
36
+ throw new Error('verifyWebhookSignature is only available in Node.js environments');
37
+ }
34
38
  try {
35
39
  // Verify timestamp if provided (prevents replay attacks)
36
40
  if (timestamp) {
@@ -44,11 +48,11 @@ export function verifyWebhookSignature(options) {
44
48
  // Extract hex signature from "sha256=<hex>" format
45
49
  const expectedSignature = signature.replace('sha256=', '');
46
50
  // Compute HMAC-SHA256 signature
47
- const hmac = createHmac('sha256', secret);
51
+ const hmac = crypto.createHmac('sha256', secret);
48
52
  hmac.update(body);
49
53
  const computedSignature = hmac.digest('hex');
50
54
  // Timing-safe comparison to prevent timing attacks
51
- return timingSafeEqual(Buffer.from(expectedSignature, 'hex'), Buffer.from(computedSignature, 'hex'));
55
+ return crypto.timingSafeEqual(Buffer.from(expectedSignature, 'hex'), Buffer.from(computedSignature, 'hex'));
52
56
  }
53
57
  catch {
54
58
  // Invalid signature format or other error