Skip to content
Closed
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
7 changes: 6 additions & 1 deletion rivetkit-typescript/packages/traces/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
],
"exports": {
".": {
"browser": {
"types": "./dist/tsup/index.browser.d.ts",
"import": "./dist/tsup/index.browser.js",
"require": "./dist/tsup/index.browser.cjs"
},
"import": {
"types": "./dist/tsup/index.d.ts",
"default": "./dist/tsup/index.js"
Expand Down Expand Up @@ -43,8 +48,8 @@
},
"dependencies": {
"@rivetkit/bare-ts": "^0.6.2",
"cbor-x": "^1.6.0",
"fdb-tuple": "^1.0.0",
"cbor-x": "^1.6.0",
Comment on lines 51 to +52
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dependency ordering issue. The 'cbor-x' dependency was moved after 'fdb-tuple' which might violate the project's dependency sorting rules. Dependencies should be alphabetically sorted.

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

"vbare": "^0.0.4"
},
"devDependencies": {
Expand Down
11 changes: 11 additions & 0 deletions rivetkit-typescript/packages/traces/src/index.browser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Browser stub: createTraces is server-only (uses node:async_hooks, node:crypto,
// fdb-tuple). This module is selected via the "browser" export condition so that
// bundlers like Vite never pull in the real implementation when resolving
// @rivetkit/traces in a browser context. The function is never actually called
// in the browser; it only exists because tsup chunk-splitting may place the
// import in a shared chunk also reached by client code.
export function createTraces(): never {
throw new Error(
"createTraces is not available in the browser. This is a server-only API.",
);
}
5 changes: 1 addition & 4 deletions rivetkit-typescript/packages/traces/src/traces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1058,10 +1058,7 @@ export function createTraces(
chunkId: number;
} {
const tuple = unpack(Buffer.from(key)) as [number, number, number];
return {
bucketStartSec: tuple[1],
chunkId: tuple[2],
};
return { bucketStartSec: tuple[1], chunkId: tuple[2] };
}

function buildChunkKey(bucketStartSec: number, chunkId: number): Uint8Array {
Expand Down
Loading