Repository: Azure/azure-functions-durable-js
Pull request #533 (2023-07-25 18:56:07)

Move GuidManager to util directory
No functional changes, just moving code


Patch:
diff --git a/src/orchestrations/DurableOrchestrationContext.ts b/src/orchestrations/DurableOrchestrationContext.ts
index 71d28cc..3ff446b 100644
--- a/src/orchestrations/DurableOrchestrationContext.ts
+++ b/src/orchestrations/DurableOrchestrationContext.ts
@@ -26,7 +26,7 @@ import { ContinueAsNewAction } from "../actions/continueasnewaction";
 import { CreateTimerAction } from "../actions/createtimeraction";
 import { ExternalEventType } from "../actions/externaleventtype";
 import { WaitForExternalEventAction } from "../actions/waitforexternaleventaction";
-import { GuidManager } from "../guidmanager";
+import { GuidManager } from "../util/GuidManager";
 import { HistoryEvent } from "../history/historyevent";
 import { DurableHttpRequest } from "../http/DurableHttpRequest";
 
diff --git a/src/guidmanager.ts b/src/util/GuidManager.ts
similarity index 93%
rename from src/guidmanager.ts
rename to src/util/GuidManager.ts
index 0b5d5d6..483f59d 100644
--- a/src/guidmanager.ts
+++ b/src/util/GuidManager.ts
@@ -1,27 +1,27 @@
-import * as crypto from "crypto";
-/** @hidden */
-import uuidv5 = require("uuid/v5");
-import { Utils } from "./util/Utils";
-
-/** @hidden */
-export class GuidManager {
-    // I don't anticipate these changing often.
-    public static DnsNamespaceValue = "9e952958-5e33-4daf-827f-2fa12937b875";
-    public static UrlNamespaceValue = "9e952958-5e33-4daf-827f-2fa12937b875";
-    public static IsoOidNamespaceValue = "9e952958-5e33-4daf-827f-2fa12937b875";
-
-    public static createDeterministicGuid(namespaceValue: string, name: string): string {
-        return this.createDeterministicGuidCore(namespaceValue, name);
-    }
-
-    private static createDeterministicGuidCore(namespaceValue: string, name: string): string {
-        Utils.throwIfEmpty(namespaceValue, "namespaceValue");
-        Utils.throwIfEmpty(name, "name");
-
-        const hash = crypto.createHash("sha1");
-        hash.update(name);
-        const bytes: number[] = Array.prototype.slice.call(hash.digest(), 0, 16);
-
-        return uuidv5(namespaceValue, bytes);
-    }
-}
+import * as crypto from "crypto";
+/** @hidden */
+import uuidv5 = require("uuid/v5");
+import { Utils } from "./Utils";
+
+/** @hidden */
+export class GuidManager {
+    // I don't anticipate these changing often.
+    public static DnsNamespaceValue = "9e952958-5e33-4daf-827f-2fa12937b875";
+    public static UrlNamespaceValue = "9e952958-5e33-4daf-827f-2fa12937b875";
+    public static IsoOidNamespaceValue = "9e952958-5e33-4daf-827f-2fa12937b875";
+
+    public static createDeterministicGuid(namespaceValue: string, name: string): string {
+        return this.createDeterministicGuidCore(namespaceValue, name);
+    }
+
+    private static createDeterministicGuidCore(namespaceValue: string, name: string): string {
+        Utils.throwIfEmpty(namespaceValue, "namespaceValue");
+        Utils.throwIfEmpty(name, "name");
+
+        const hash = crypto.createHash("sha1");
+        hash.update(name);
+        const bytes: number[] = Array.prototype.slice.call(hash.digest(), 0, 16);
+
+        return uuidv5(namespaceValue, bytes);
+    }
+}


Test patch:
diff --git a/test/unit/guidmanager-spec.ts b/test/unit/guidmanager-spec.ts
index dc67c3d..b5cfd08 100644
--- a/test/unit/guidmanager-spec.ts
+++ b/test/unit/guidmanager-spec.ts
@@ -1,7 +1,7 @@
 import { expect } from "chai";
 import "mocha";
 import moment = require("moment");
-import { GuidManager } from "../../src/guidmanager";
+import { GuidManager } from "../../src/util/GuidManager";
 import uuidv1 = require("uuid/v1");
 import { isUUID } from "validator";