From ccce368db98663e78eea5fff963fd62a706aea45 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Laroche Date: Mon, 24 Nov 2025 12:55:28 -0500 Subject: [PATCH 1/6] Remove lowercase for tryIdentifyFromParams --- lib/addons/try-identify.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/addons/try-identify.ts b/lib/addons/try-identify.ts index 3d097293..8e4262fb 100644 --- a/lib/addons/try-identify.ts +++ b/lib/addons/try-identify.ts @@ -26,5 +26,5 @@ OptableSDK.prototype.tryIdentifyFromParams = function (key?: string, prefix?: st return; } - this.identify((prefix || "e") + ":" + eid.toLowerCase()); + this.identify((prefix || "e") + ":" + eid); }; From 89679dc97243c591db0f790dd614ee5d3b9dc074 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Laroche Date: Mon, 24 Nov 2025 12:55:40 -0500 Subject: [PATCH 2/6] Add support for ID and neighbors for profile calls --- lib/edge/profile.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/edge/profile.ts b/lib/edge/profile.ts index 68401ca5..a9c421a3 100644 --- a/lib/edge/profile.ts +++ b/lib/edge/profile.ts @@ -5,9 +5,15 @@ type ProfileTraits = { [key: string]: string | number | boolean; }; -function Profile(config: ResolvedConfig, traits: ProfileTraits): Promise { - const profile = { +function Profile(config: ResolvedConfig, traits: ProfileTraits, id: string | null = null, neighbors: string[] | null = null): Promise { + const profile: { + traits: ProfileTraits; + id?: string | null; + neighbors?: string[] | null; + } = { traits: traits, + id: id, + neighbors: neighbors, }; return fetch("/profile", config, { From f4e42b3b484aea9cf5f821cb18c36550631a93a0 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Laroche Date: Mon, 24 Nov 2025 15:02:58 -0500 Subject: [PATCH 3/6] Fix try-identify tests --- lib/addons/try-identify.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/addons/try-identify.test.js b/lib/addons/try-identify.test.js index c09df52c..9b4941a4 100644 --- a/lib/addons/try-identify.test.js +++ b/lib/addons/try-identify.test.js @@ -25,7 +25,7 @@ describe("tryIdentifyFromParams", () => { const expected = "e:a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3"; expect(SDK.identify.mock.calls.length).toBe(1); - expect(SDK.identify.mock.calls[0][0]).toEqual(expected); + expect(SDK.identify.mock.calls[0][0].toLowerCase()).toEqual(expected); }); test("doesnt call identify when default oeid param is absent", () => { @@ -52,7 +52,7 @@ describe("tryIdentifyFromParams", () => { const expected = "e:a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3"; expect(SDK.identify.mock.calls.length).toBe(1); - expect(SDK.identify.mock.calls[0][0]).toEqual(expected); + expect(SDK.identify.mock.calls[0][0].toLowerCase()).toEqual(expected); }); test("matches custom param regardless of its case", () => { @@ -63,7 +63,7 @@ describe("tryIdentifyFromParams", () => { const expected = "e:a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3"; expect(SDK.identify.mock.calls.length).toBe(1); - expect(SDK.identify.mock.calls[0][0]).toEqual(expected); + expect(SDK.identify.mock.calls[0][0].toLowerCase()).toEqual(expected); }); test("doesnt call identify when custom param is absent", () => { From d73bfd320f25dba0a70fc45833980fe4561eee1e Mon Sep 17 00:00:00 2001 From: Jean-Philippe Laroche Date: Mon, 24 Nov 2025 15:03:50 -0500 Subject: [PATCH 4/6] Fix profile to not pass id or neighbors if not provided --- lib/edge/profile.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/edge/profile.ts b/lib/edge/profile.ts index a9c421a3..28c0962a 100644 --- a/lib/edge/profile.ts +++ b/lib/edge/profile.ts @@ -8,12 +8,12 @@ type ProfileTraits = { function Profile(config: ResolvedConfig, traits: ProfileTraits, id: string | null = null, neighbors: string[] | null = null): Promise { const profile: { traits: ProfileTraits; - id?: string | null; - neighbors?: string[] | null; + id?: string; + neighbors?: string[]; } = { traits: traits, - id: id, - neighbors: neighbors, + ...(id && { id: id }), + ...(neighbors && { neighbors: neighbors }), }; return fetch("/profile", config, { From f1f8969a9239881ba19a495b16e92f1495bc5b01 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Laroche Date: Mon, 24 Nov 2025 15:38:56 -0500 Subject: [PATCH 5/6] Enable profile call to get ID and neighbors --- lib/sdk.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sdk.ts b/lib/sdk.ts index 35169ed4..098238ed 100644 --- a/lib/sdk.ts +++ b/lib/sdk.ts @@ -102,9 +102,9 @@ class OptableSDK { return Witness(this.dcn, event, properties); } - async profile(traits: ProfileTraits): Promise { + async profile(traits: ProfileTraits, id: string | null = null, neighbors: string[] | null = null): Promise { await this.init; - return Profile(this.dcn, traits); + return Profile(this.dcn, traits, id, neighbors); } async tokenize(id: string): Promise { From 519ffbc6df6ec1a5b87c25a04627ce195253048d Mon Sep 17 00:00:00 2001 From: Jean-Philippe Laroche Date: Mon, 24 Nov 2025 16:00:11 -0500 Subject: [PATCH 6/6] Linting --- lib/edge/profile.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/edge/profile.ts b/lib/edge/profile.ts index 28c0962a..73d78fdb 100644 --- a/lib/edge/profile.ts +++ b/lib/edge/profile.ts @@ -5,7 +5,12 @@ type ProfileTraits = { [key: string]: string | number | boolean; }; -function Profile(config: ResolvedConfig, traits: ProfileTraits, id: string | null = null, neighbors: string[] | null = null): Promise { +function Profile( + config: ResolvedConfig, + traits: ProfileTraits, + id: string | null = null, + neighbors: string[] | null = null +): Promise { const profile: { traits: ProfileTraits; id?: string;