Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

improve(buffer): stringify all properties since they can be different types (unsure why now)

Carl-Gerhard Lindesvärdb0a41f7911b5
diff --git a/packages/db/src/buffers/profile-buffer-psql.ts b/packages/db/src/buffers/profile-buffer-psql.ts
index 6129d1354..32fe4c432 100644
--- a/packages/db/src/buffers/profile-buffer-psql.ts
+++ b/packages/db/src/buffers/profile-buffer-psql.ts
@@ -34,7 +34,7 @@ export class ProfileBuffer extends BaseBuffer {
// Fast-path for primitives
if (obj === null || type !== 'object') {
- return obj;
+ return String(obj);
}
// Fast-path for arrays - process values only
@@ -57,7 +57,9 @@ export class ProfileBuffer extends BaseBuffer {
const key = sortedKeys[i]!;
const value = obj[key];
result[key] =
- value && typeof value === 'object' ? this.sortObjectKeys(value) : value;
+ value && typeof value === 'object'
+ ? this.sortObjectKeys(value)
+ : String(value);
}
return result;