Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/contextLookup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
5 changes: 1 addition & 4 deletions src/evaluate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down