@utaba/deep-memory 0.9.2 → 0.9.3

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.d.cts CHANGED
@@ -338,7 +338,7 @@ declare class MemoryRepository {
338
338
  onHook<E extends Extract<DeepMemoryEventType, 'entity:creating' | 'entity:updating' | 'entity:deleting' | 'relationship:creating' | 'relationship:removing'>>(event: E, handler: HookHandler<E>): Unsubscribe;
339
339
  }
340
340
 
341
- /** Generate a v4 UUID without depending on node:crypto */
341
+ /** Generate a v4 UUID using Node's crypto.randomUUID (CSPRNG-backed). */
342
342
  declare function generateId(): string;
343
343
  /** Validate that a string is a valid UUID */
344
344
  declare function isValidUuid(value: string): boolean;
package/dist/index.d.ts CHANGED
@@ -338,7 +338,7 @@ declare class MemoryRepository {
338
338
  onHook<E extends Extract<DeepMemoryEventType, 'entity:creating' | 'entity:updating' | 'entity:deleting' | 'relationship:creating' | 'relationship:removing'>>(event: E, handler: HookHandler<E>): Unsubscribe;
339
339
  }
340
340
 
341
- /** Generate a v4 UUID without depending on node:crypto */
341
+ /** Generate a v4 UUID using Node's crypto.randomUUID (CSPRNG-backed). */
342
342
  declare function generateId(): string;
343
343
  /** Validate that a string is a valid UUID */
344
344
  declare function isValidUuid(value: string): boolean;
package/dist/index.js CHANGED
@@ -252,6 +252,9 @@ var TraversalTimeoutError = class extends DeepMemoryError {
252
252
  }
253
253
  };
254
254
 
255
+ // src/core/DeepMemory.ts
256
+ import { randomUUID } from "crypto";
257
+
255
258
  // src/entities/IdGenerator.ts
256
259
  function slugify(text) {
257
260
  return text.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
@@ -3431,7 +3434,7 @@ var EventBus = class {
3431
3434
  };
3432
3435
 
3433
3436
  // src/portability/RepositoryExporter.ts
3434
- var LIBRARY_VERSION = true ? "0.9.2" : "0.1.0";
3437
+ var LIBRARY_VERSION = true ? "0.9.3" : "0.1.0";
3435
3438
  var RepositoryExporter = class {
3436
3439
  storage;
3437
3440
  provenance;
@@ -4083,10 +4086,7 @@ var RepositoryImporter = class {
4083
4086
  // src/core/DeepMemory.ts
4084
4087
  var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
4085
4088
  function generateId() {
4086
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
4087
- const r = Math.random() * 16 | 0;
4088
- return (c === "x" ? r : r & 3 | 8).toString(16);
4089
- });
4089
+ return randomUUID();
4090
4090
  }
4091
4091
  function isValidUuid(value) {
4092
4092
  return UUID_RE.test(value);