Skip to content

Commit

Permalink
fix: shim globals for content-claims client
Browse files Browse the repository at this point in the history
- CarReadableStream expects global `TransformStream`
- ucanto client expects global `fetch`

License: MIT
Signed-off-by: Oli Evans <[email protected]>
  • Loading branch information
olizilla committed Sep 20, 2023
1 parent eebf755 commit 4986c5c
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 3 deletions.
57 changes: 55 additions & 2 deletions package-lock.json

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

5 changes: 5 additions & 0 deletions roundabout/globals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// CARReaderStream used by content-claims client expects global TransformStream and fetch
import { TransformStream } from 'node:stream/web'
import { fetch } from 'undici'
globalThis.TransformStream = TransformStream
globalThis.fetch = fetch
3 changes: 2 additions & 1 deletion roundabout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"@aws-sdk/s3-request-presigner": "^3.226.0",
"@sentry/serverless": "^7.22.0",
"@web3-storage/content-claims": "^3.0.1",
"multiformats": "^11.0.2"
"multiformats": "^11.0.2",
"undici": "^5.24.0"
},
"devDependencies": {
"@ipld/car": "^5.1.1",
Expand Down
2 changes: 2 additions & 0 deletions roundabout/piece.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// CARReaderStream used by content-claims client expects global TransformStream and fetch
import './globals.js'
import { read } from '@web3-storage/content-claims/client'
import * as Raw from 'multiformats/codecs/raw'

Expand Down

0 comments on commit 4986c5c

Please sign in to comment.