@vue-skuilder/db 0.1.13-8 → 0.1.13

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/index.mjs CHANGED
@@ -2464,18 +2464,37 @@ function accomodateGuest() {
2464
2464
  };
2465
2465
  function generateUUID() {
2466
2466
  logger.log("[funnel] Inside generateUUID()");
2467
+ if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
2468
+ const uuid2 = crypto.randomUUID();
2469
+ logger.log("[funnel] Generated UUID using crypto.randomUUID():", uuid2);
2470
+ return uuid2;
2471
+ }
2472
+ if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
2473
+ const bytes = new Uint8Array(16);
2474
+ crypto.getRandomValues(bytes);
2475
+ bytes[6] = bytes[6] & 15 | 64;
2476
+ bytes[8] = bytes[8] & 63 | 128;
2477
+ const uuid2 = [
2478
+ Array.from(bytes.slice(0, 4)).map((b) => b.toString(16).padStart(2, "0")).join(""),
2479
+ Array.from(bytes.slice(4, 6)).map((b) => b.toString(16).padStart(2, "0")).join(""),
2480
+ Array.from(bytes.slice(6, 8)).map((b) => b.toString(16).padStart(2, "0")).join(""),
2481
+ Array.from(bytes.slice(8, 10)).map((b) => b.toString(16).padStart(2, "0")).join(""),
2482
+ Array.from(bytes.slice(10, 16)).map((b) => b.toString(16).padStart(2, "0")).join("")
2483
+ ].join("-");
2484
+ logger.log("[funnel] Generated UUID using crypto.getRandomValues():", uuid2);
2485
+ return uuid2;
2486
+ }
2487
+ logger.warn("[funnel] crypto API not available, using timestamp-based UUID (NOT SECURE)");
2467
2488
  let d = (/* @__PURE__ */ new Date()).getTime();
2468
- logger.log("[funnel] Date timestamp:", d);
2469
2489
  if (typeof performance !== "undefined" && typeof performance.now === "function") {
2470
2490
  d += performance.now();
2471
- logger.log("[funnel] After adding performance.now():", d);
2472
2491
  }
2473
2492
  const uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
2474
2493
  const r = (d + Math.random() * 16) % 16 | 0;
2475
2494
  d = Math.floor(d / 16);
2476
2495
  return (c === "x" ? r : r & 3 | 8).toString(16);
2477
2496
  });
2478
- logger.log("[funnel] Generated UUID inside function:", uuid);
2497
+ logger.log("[funnel] Generated UUID (fallback):", uuid);
2479
2498
  return uuid;
2480
2499
  }
2481
2500
  }