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
13 changes: 5 additions & 8 deletions packages/node-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@ Install using `yarn` or `npm` with:

> `yarn add -s @bucketco/node-sdk` or `npm install -s @bucketco/node-sdk`.

Other supported languages/frameworks are in the
[Supported languages](https://docs.bucket.co/quickstart/supported-languages)
documentation pages.
Other supported languages/frameworks are in the [Supported languages](https://docs.bucket.co/quickstart/supported-languages) documentation pages.

You can also [use the HTTP API directly](https://docs.bucket.co/reference/http-tracking-api)
You can also [use the HTTP API directly](https://docs.bucket.co/api/http-api)

## Basic usage

To get started you need to obtain your secret key from the
[environment settings](https://app.bucket.co/envs/current/settings/app-environments)
To get started you need to obtain your secret key from the [environment settings](https://app.bucket.co/envs/current/settings/app-environments)
in Bucket.

> [!CAUTION]
Expand Down Expand Up @@ -138,8 +135,8 @@ await client.flush();

### Rate Limiting

The SDK includes automatic rate limiting for feature events to prevent overwhelming the API. Rate limiting is applied per
unique combination of feature key and context. The rate limiter window size is configurable:
The SDK includes automatic rate limiting for feature events to prevent overwhelming the API.
Rate limiting is applied per unique combination of feature key and context. The rate limiter window size is configurable:

```typescript
const client = new BucketClient({
Expand Down
2 changes: 1 addition & 1 deletion packages/node-sdk/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export function hashObject(obj: Record<string, any>): string {
const hash = createHash("sha1");
updateSha1Hash(hash, obj);

return hash.digest("hex");
return hash.digest("base64");
}

export function once<T extends () => ReturnType<T>>(
Expand Down
4 changes: 1 addition & 3 deletions packages/node-sdk/test/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1596,9 +1596,7 @@ describe("BucketClient", () => {
await client.initialize();
client.getFeatures({ user, company, other: otherContext });

expect(isAllowedSpy).toHaveBeenCalledWith(
"d461e93fe41f6297ab43402d0fc6d63e2444e07d",
);
expect(isAllowedSpy).toHaveBeenCalledWith("1GHpP+QfYperQ0AtD8bWPiRE4H0=");
});

it("should return evaluated features when only user is defined", async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/node-sdk/test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ describe("hashObject", () => {
expectedHash.update("name");
expectedHash.update("Alice");

expect(hash).toBe(expectedHash.digest("hex"));
expect(hash).toBe(expectedHash.digest("base64"));
});

it("should hash arrays within objects", () => {
Expand All @@ -180,7 +180,7 @@ describe("hashObject", () => {
expectedHash.update("2");
expectedHash.update("3");

expect(hash).toBe(expectedHash.digest("hex"));
expect(hash).toBe(expectedHash.digest("base64"));
});
});

Expand Down