Closed
Conversation
Five runnable TypeScript examples covering the core relayfile SDK: - 01: read files (listTree, readFile, queryFiles) - 02: write files (writeFile, bulkWrite, optimistic locking) - 03: webhook ingestion (ingestWebhook, computeCanonicalPath) - 04: realtime events (getEvents polling with cursors) - 05: scoped agent permissions (path-restricted tokens, 403 handling) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| function printEvent(evt: FilesystemEvent) { | ||
| const ts = new Date(evt.timestamp).toLocaleTimeString(); | ||
| console.log( | ||
| ` ${ts} ${padRight(evt.type, 14)} ${evt.path} (${evt.origin})` |
Contributor
There was a problem hiding this comment.
🟡 evt.origin is optional and will display as (undefined) in event output
The printEvent helper interpolates evt.origin directly into the output string, but FilesystemEvent.origin is typed as origin?: EventOrigin (packages/sdk/typescript/src/types.ts:125). When the server omits the origin field, the output will render as e.g. 10:00:00 file.created /github/pulls/42.json (undefined) instead of showing a meaningful fallback.
Suggested change
| ` ${ts} ${padRight(evt.type, 14)} ${evt.path} (${evt.origin})` | |
| ` ${ts} ${padRight(evt.type, 14)} ${evt.path} (${evt.origin ?? "unknown"})` |
Was this helpful? React with 👍 or 👎 to provide feedback.
Member
Author
|
Superseded by #25 which includes all examples + docker quickstart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Examples
Each example is runnable with
npx tsxand has its own README.