diff --git a/CHANGELOG.md b/CHANGELOG.md index b3508ce..9f302d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,17 @@ # Changelog +## 0.4.8 - 2025-04-15 + +- Implement virtual context `prefab.current-time` for all operators [#102] +- fix: Declare Long as a peer dependency [#97] + ## 0.4.7 - 2025-04-08 -- fix: Telemetry hanging after prefab.close() (#100) +- fix: Telemetry hanging after prefab.close() [#100] ## 0.4.6 - 2025-04-08 -- Add withContext to get a context-bound resolver (#98) +- Add withContext to get a context-bound resolver [#98] ## 0.4.5 - 2025-02-24 - Updated protos with schema types [#95] diff --git a/package-lock.json b/package-lock.json index 9d6ba7a..16fd7db 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@prefab-cloud/prefab-cloud-node", - "version": "0.4.7", + "version": "0.4.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@prefab-cloud/prefab-cloud-node", - "version": "0.4.7", + "version": "0.4.8", "license": "ISC", "dependencies": { "@types/eventsource": "^1.1.11", diff --git a/package.json b/package.json index b9f4a2a..4fe9f99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@prefab-cloud/prefab-cloud-node", - "version": "0.4.7", + "version": "0.4.8", "description": "Feature Flags, Live Config, and Dynamic Log Levels", "main": "dist/prefab.cjs", "types": "dist/prefab.d.ts", diff --git a/src/__tests__/contextLookup.test.ts b/src/__tests__/contextLookup.test.ts index 3c44515..2dd1a8b 100644 --- a/src/__tests__/contextLookup.test.ts +++ b/src/__tests__/contextLookup.test.ts @@ -83,9 +83,9 @@ describe("contextLookup", () => { it("should return current timestamp for prefab.current-time", () => { const result = contextLookup(contexts, "prefab.current-time"); const now = +new Date(); - + // Allow for a small time difference (within 100ms) since the test and the function call // might not execute at exactly the same millisecond - expect(Math.abs(result as number - now)).toBeLessThan(100); + expect(Math.abs((result as number) - now)).toBeLessThan(100); }); }); diff --git a/src/evaluate.ts b/src/evaluate.ts index 5c50665..7e1188e 100644 --- a/src/evaluate.ts +++ b/src/evaluate.ts @@ -126,10 +126,7 @@ const inIntRange = (criterion: Criterion, contexts: Contexts): boolean => { const start = criterion.valueToMatch?.intRange?.start; const end = criterion.valueToMatch?.intRange?.end; - const comparable = contextLookup( - contexts, - criterion.propertyName - ); + const comparable = contextLookup(contexts, criterion.propertyName); if (start === undefined || end === undefined || comparable === undefined) { return false;