forked from storacha/w3up
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: add storefront filecoin api to upload api (storacha#1052)
Adds `filecoin/*` to the `upload-api`, so that web3.storage implements storefront capabilities This will enable us to integrate the new API with w3infra, so that clients can execute `filecoin/offer` to web3.storage.
- Loading branch information
1 parent
b232aa7
commit 39916c2
Showing
9 changed files
with
99 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
32 changes: 32 additions & 0 deletions
32
packages/filecoin-api/test/context/queue-implementations.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Queue } from './queue.js' | ||
|
||
/** | ||
* @param {Map<string, unknown[]>} queuedMessages | ||
*/ | ||
export const getQueueImplementations = ( | ||
queuedMessages, | ||
QueueImplementation = Queue | ||
) => { | ||
queuedMessages.set('filecoinSubmitQueue', []) | ||
queuedMessages.set('pieceOfferQueue', []) | ||
const filecoinSubmitQueue = new QueueImplementation({ | ||
onMessage: (message) => { | ||
const messages = queuedMessages.get('filecoinSubmitQueue') || [] | ||
messages.push(message) | ||
queuedMessages.set('filecoinSubmitQueue', messages) | ||
}, | ||
}) | ||
const pieceOfferQueue = new QueueImplementation({ | ||
onMessage: (message) => { | ||
const messages = queuedMessages.get('pieceOfferQueue') || [] | ||
messages.push(message) | ||
queuedMessages.set('pieceOfferQueue', messages) | ||
}, | ||
}) | ||
return { | ||
storefront: { | ||
filecoinSubmitQueue, | ||
pieceOfferQueue | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.