Skip to content

Commit

Permalink
feat: add metadata to store messages
Browse files Browse the repository at this point in the history
  • Loading branch information
gmolki committed Dec 10, 2024
1 parent 4449b06 commit 39d0368
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/message/src/store/impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class StoreMessageClient {
fileHash,
fileObject,
extraFields,
metadata,
sync = false,
}: RequireOnlyOne<StorePublishConfiguration, 'fileObject' | 'fileHash'>): Promise<StoreMessage> {
if (!fileObject && !fileHash) throw new Error('You need to specify a File to upload or a Hash to pin.')
Expand All @@ -67,6 +68,7 @@ export class StoreMessageClient {
item_hash: hash,
time: timestamp,
extra_fields: extraFields,
metadata,
}

const builtMessage = buildStoreMessage({
Expand Down
4 changes: 4 additions & 0 deletions packages/message/src/store/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type StoreContent = BaseContent & {
content_type?: string
ref?: string
extra_fields?: Record<string, unknown>
metadata?: Record<string, unknown>
}

// -------- PIN ----------
Expand Down Expand Up @@ -48,6 +49,8 @@ export type StorePinConfiguration = {
*
* extraFields: Extra fields to add to the Store message.
*
* metadata: Metadata about the stored content.
*
* sync: If true, the function will wait for the message to be confirmed by the API server.
*/
export type StorePublishConfiguration = {
Expand All @@ -57,5 +60,6 @@ export type StorePublishConfiguration = {
fileHash?: string
storageEngine?: ItemType.ipfs | ItemType.storage
extraFields?: Record<string, unknown>
metadata?: Record<string, unknown>
sync?: boolean
}

0 comments on commit 39d0368

Please sign in to comment.