From 07f9f09553725da7a193bce3b6f69270871c7064 Mon Sep 17 00:00:00 2001 From: Mark Krasner Date: Thu, 19 Dec 2024 12:59:41 -0500 Subject: [PATCH 1/8] Improving method comments across client packages --- packages/model-client/src/index.ts | 4 +-- packages/model-instance-client/src/client.ts | 35 ++++++++++++++++++-- packages/stream-client/src/index.ts | 2 +- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/packages/model-client/src/index.ts b/packages/model-client/src/index.ts index d5d8adf..325d8ee 100644 --- a/packages/model-client/src/index.ts +++ b/packages/model-client/src/index.ts @@ -70,7 +70,7 @@ export class ModelClient extends StreamClient { return getModelStreamID(cid) } - /** Retrieve the stringified model stream ID from a stream */ + /** Retrieve the stringified model stream ID from a model instance document stream ID */ async getDocumentModel(streamID: StreamID | string): Promise { const id = typeof streamID === 'string' ? StreamID.fromString(streamID) : streamID @@ -79,7 +79,7 @@ export class ModelClient extends StreamClient { return stream.toString() } - /** Retrieve a model's JSON definition */ + /** Retrieve a model's JSON definition based on the model's stream ID*/ async getModelDefinition( streamID: StreamID | string, ): Promise { diff --git a/packages/model-instance-client/src/client.ts b/packages/model-instance-client/src/client.ts index 6238c6a..b27e4a4 100644 --- a/packages/model-instance-client/src/client.ts +++ b/packages/model-instance-client/src/client.ts @@ -58,7 +58,17 @@ export class ModelInstanceClient extends StreamClient { )) as DocumentEvent } - /** Post a deterministic init event and return its commit ID */ + /** + * Post a deterministic init event and return its commit ID + * + * @remarks This method is used to post an init event that is deterministic, meaning that the + * resulting stream ID is derived from the uniqueValue parameter. This is used when creating + * model instance documents of type `set` and `single`. + * + * @param params - Parameters for posting a deterministic init event + * @returns Commit ID of the posted event + * + */ async postDeterministicInit( params: PostDeterministicInitParams, ): Promise { @@ -71,7 +81,16 @@ export class ModelInstanceClient extends StreamClient { return CommitID.fromStream(getStreamID(cid)) } - /** Post a signed (non-deterministic) init event and return its commit ID */ + /** + * Post a signed init event and return its commit ID + * + * @remarks This method is used to post an init event that is non-deterministic, meaning that the + * resulting stream ID is not derived from the uniqueValue parameter. This is used when creating + * model instance documents of type `list`. + * + * @param params - Parameters for posting a signed init event + * @returns Commit ID of the posted event + */ async postSignedInit( params: PostSignedInitParams, ): Promise { @@ -127,7 +146,17 @@ export class ModelInstanceClient extends StreamClient { return this.streamStateToDocumentState(streamState) } - /** Post an update to a document that optionally obtains docstate first */ + /** + * Update a document with new content and return the updated document state + * + * @remarks This method is used to update the content of a document. The new content is + * posted as a data event and the document state is returned with the updated content. The + * document's current state can be provided as a parameter to avoid fetching it from the + * Ceramic node. + * + * @param params - Parameters for updating a document + * @returns Updated document state + */ async updateDocument( params: UpdateDataParams, ): Promise { diff --git a/packages/stream-client/src/index.ts b/packages/stream-client/src/index.ts index e148b7e..4ec9c22 100644 --- a/packages/stream-client/src/index.ts +++ b/packages/stream-client/src/index.ts @@ -39,7 +39,7 @@ export class StreamClient { /** * Get the state of a stream by its ID * @param streamId - Multibase encoded stream ID - * @returns The state of the stream + * @returns The StreamState object of the stream */ async getStreamState(streamId: StreamID | string): Promise { const { data, error } = await this.#ceramic.api.GET( From d65d97148c98bfcfdc46648460c53bfea26bfead Mon Sep 17 00:00:00 2001 From: Mark Krasner Date: Thu, 19 Dec 2024 13:21:40 -0500 Subject: [PATCH 2/8] More thorough commenting for stream-client class --- packages/stream-client/src/index.ts | 101 +++++++++++++++++++++++----- 1 file changed, 84 insertions(+), 17 deletions(-) diff --git a/packages/stream-client/src/index.ts b/packages/stream-client/src/index.ts index 4ec9c22..a5f541c 100644 --- a/packages/stream-client/src/index.ts +++ b/packages/stream-client/src/index.ts @@ -22,26 +22,74 @@ export type StreamClientParams = { did?: DID } +/** + * Represents a Stream Client. + * + * This class provides basic utility methods to interact with streams, including + * accessing the Ceramic client and obtaining stream states. It also manages a + * Decentralized Identifier (DID) that can be used for authentication or signing. + * + * This class is intended to be extended by other classes for more specific functionalities. + */ export class StreamClient { - #ceramic: CeramicClient - #did?: DID + /** + * Instance of the Ceramic HTTP client, used to communicate with the Ceramic node. + * It facilitates API interactions such as fetching stream states or publishing updates. + */ + #ceramic: CeramicClient; + + /** + * Optional Decentralized Identifier (DID) attached to the instance. + * The DID is typically used for authentication or signing event payloads. + */ + #did?: DID; + /** + * Creates a new instance of `StreamClient`. + * + * @param params - Configuration object containing parameters for initializing the StreamClient. + * @param params.ceramic - URL or instance of the Ceramic client to be used. + * @param params.did - Optional DID to be attached to the client for authentication purposes. + */ constructor(params: StreamClientParams) { - this.#ceramic = getCeramicClient(params.ceramic) - this.#did = params.did + // Initialize the Ceramic client from the provided parameters + this.#ceramic = getCeramicClient(params.ceramic); + + // Attach the provided DID to the instance (if any) + this.#did = params.did; } - /** Ceramic HTTP client instance used to interact with Ceramic One server */ + /** + * Retrieves the Ceramic HTTP client instance used to interact with the Ceramic server. + * + * This client is essential for executing API requests to fetch stream data. + * + * @returns The `CeramicClient` instance associated with this StreamClient. + */ get ceramic(): CeramicClient { - return this.#ceramic + return this.#ceramic; } /** - * Get the state of a stream by its ID - * @param streamId - Multibase encoded stream ID - * @returns The StreamState object of the stream + * Fetches the current stream state of a specific stream by its ID. + * + * This method interacts with the Ceramic HTTP API to retrieve the state of a stream. + * The stream ID can either be a multibase-encoded string or a `StreamID` object. + * + * @param streamId - The unique identifier of the stream to fetch. + * - Can be a multibase-encoded string or a `StreamID` object. + * @returns A Promise that resolves to the `StreamState` object, representing the current state of the stream. + * + * @throws Will throw an error if the API request fails or returns an error response (if stream is not found). + * + * @example + * ```typescript + * const streamState = await client.getStreamState('kjzl6cwe1...'); + * console.log(streamState); + * ``` */ async getStreamState(streamId: StreamID | string): Promise { + // Prepare the API request to fetch the stream state const { data, error } = await this.#ceramic.api.GET( '/streams/{stream_id}', { @@ -51,24 +99,43 @@ export class StreamClient { typeof streamId === 'string' ? streamId : streamId.toString(), }, }, - }, - ) + } + ); + // Handle errors returned from the API if (error != null) { - throw new Error(error.message) + throw new Error(`Failed to fetch stream state: ${error.message}`); } - return data + // Return the retrieved stream state + return data; } - /** Utility method used to access the provided DID or the one attached to the instance, throws if neither is provided */ + /** + * Retrieves a Decentralized Identifier (DID). + * + * This method provides access to a DID, which is required for authentication or event signing operations. + * The caller can optionally provide a DID; if none is provided, the instance's DID is used instead. + * + * @param provided - An optional DID object to use. If not supplied, the instance's DID is returned. + * @returns The DID object, either provided or attached to the instance. + * + * @throws Will throw an error if neither a provided DID nor an instance DID is available. + * + * @example + * ```typescript + * const did = client.getDID(); + * console.log(did.id); // Outputs the DID identifier + * ``` + */ getDID(provided?: DID): DID { if (provided != null) { - return provided + return provided; } if (this.#did != null) { - return this.#did + return this.#did; } - throw new Error('Missing DID') + throw new Error('Missing DID: Neither a provided DID nor an instance DID is available.'); } } + From 152cec78c955be0375752924022110b3452ed96c Mon Sep 17 00:00:00 2001 From: Mark Krasner Date: Thu, 19 Dec 2024 13:26:55 -0500 Subject: [PATCH 3/8] Improved commenting for base http-client --- packages/http-client/src/index.ts | 126 +++++++++++++++++++++++----- packages/stream-client/src/index.ts | 39 ++++----- 2 files changed, 127 insertions(+), 38 deletions(-) diff --git a/packages/http-client/src/index.ts b/packages/http-client/src/index.ts index 62a9867..d041d09 100644 --- a/packages/http-client/src/index.ts +++ b/packages/http-client/src/index.ts @@ -13,11 +13,12 @@ import type { SimplifyDeep } from 'type-fest' import type { components, paths } from './__generated__/api' +// Type definitions for Ceramic API and schemas export type CeramicAPI = ReturnType> - export type Schemas = SimplifyDeep export type Schema = SimplifyDeep +// Parameters for initializing the Ceramic client export type ClientParams = { /** Ceramic One server URL */ url: string @@ -27,16 +28,35 @@ export type ClientParams = { headers?: HeadersOptions } +// Parameters for fetching the events feed export type EventsFeedParams = { - /** Resume token */ + /** Resume token for paginated feeds */ resumeAt?: string /** Maximum number of events to return in response */ limit?: number } +/** + * Represents an HTTP client for interacting with the Ceramic One server. + * + * This class provides methods for working with Ceramic events, including fetching, decoding, and posting events. + * It also supports retrieving server metadata and managing stream interests. + */ export class CeramicClient { + /** + * Internal OpenAPI client used for all HTTP requests to the Ceramic server. + * This client provides a low-level interface for interacting with the server APIs. + */ #api: CeramicAPI + /** + * Creates a new instance of `CeramicClient`. + * + * @param params - Configuration options for initializing the client. + * @param params.url - Base URL of the Ceramic One server. + * @param params.fetch - (Optional) Custom fetch function to override default behavior. + * @param params.headers - (Optional) Additional headers to include in HTTP requests. + */ constructor(params: ClientParams) { const { url, ...options } = params this.#api = createAPIClient({ @@ -45,23 +65,41 @@ export class CeramicClient { }) } - /** OpenAPI client used internally, provides low-level access to the HTTP APIs exposed by the Ceramic One server */ + /** + * Retrieves the OpenAPI client instance. + * + * @returns The internal OpenAPI client used for making HTTP requests. + */ get api(): CeramicAPI { return this.#api } - /** Get the raw event response for the given event CID */ + /** + * Fetches a raw event response by its unique event CID. + * + * @param id - The unique identifier (CID) of the event to fetch. + * @returns A Promise that resolves to the event schema. + * + * @throws Will throw an error if the request fails or the server returns an error. + */ async getEvent(id: string): Promise> { const { data, error } = await this.#api.GET('/events/{event_id}', { params: { path: { event_id: id } }, }) if (error != null) { - throw new Error(error.message) + throw new Error(`Failed to fetch event: ${error.message}`) } return data } - /** Get the string-encoded event for the given event CID */ + /** + * Fetches the string-encoded event data for a given event CID. + * + * @param id - The unique identifier (CID) of the event to fetch. + * @returns A Promise that resolves to the event's string data. + * + * @throws Will throw an error if the event data is missing. + */ async getEventData(id: string): Promise { const event = await this.getEvent(id) if (event.data == null) { @@ -70,13 +108,24 @@ export class CeramicClient { return event.data } - /** Get the CAR-encoded event for the given event CID */ + /** + * Fetches the CAR-encoded event for a given event CID. + * + * @param id - The unique identifier (CID) of the event. + * @returns A Promise that resolves to a CAR object representing the event. + */ async getEventCAR(id: string): Promise { const data = await this.getEventData(id) return carFromString(data) } - /** Get the decoded event for the given decoder and event CID */ + /** + * Decodes and retrieves a specific event type using the provided decoder. + * + * @param decoder - The decoder used to interpret the event data. + * @param id - The unique identifier (CID) of the event. + * @returns A Promise that resolves to the decoded event payload or a signed event. + */ async getEventType( decoder: Decoder, id: string, @@ -85,7 +134,12 @@ export class CeramicClient { return eventFromString(decoder, data) } - /** Get the events feed based on the given parameters */ + /** + * Retrieves the events feed based on provided parameters. + * + * @param params - Options for paginated feeds, including resume tokens and limits. + * @returns A Promise that resolves to the events feed schema. + */ async getEventsFeed( params: EventsFeedParams = {}, ): Promise> { @@ -93,52 +147,86 @@ export class CeramicClient { query: params, }) if (error != null) { - throw new Error(error.message) + throw new Error(`Failed to fetch events feed: ${error.message}`) } return data } - /** Get information about the Ceramic One server version */ + /** + * Retrieves the version information of the Ceramic One server. + * + * @returns A Promise that resolves to the server version schema. + */ async getVersion(): Promise> { const { data, error } = await this.#api.GET('/version') if (error != null) { - throw new Error(error.message) + throw new Error(`Failed to fetch server version: ${error.message}`) } return data } - /** Post a string-encoded event to the server */ + /** + * Posts a string-encoded event to the server. + * + * @param data - The string-encoded event data to post. + * @returns A Promise that resolves when the request completes. + * + * @throws Will throw an error if the request fails. + */ async postEvent(data: string): Promise { const { error } = await this.#api.POST('/events', { body: { data } }) if (error != null) { - throw new Error(error.message) + throw new Error(`Failed to post event: ${error.message}`) } } - /** Post a CAR-encoded event to the server */ + /** + * Posts a CAR-encoded event to the server. + * + * @param car - The CAR object representing the event. + * @returns A Promise that resolves to the CID of the posted event. + */ async postEventCAR(car: CAR): Promise { await this.postEvent(carToString(car)) return car.roots[0] } - /** Encode and post an event to the server */ + /** + * Encodes and posts an event using a specified codec. + * + * @param codec - The codec used to encode the event. + * @param event - The event data to encode and post (must be compatible with the codec). + * @returns A Promise that resolves to the CID of the posted event. + */ async postEventType(codec: Codec, event: unknown): Promise { const car = eventToCAR(codec, event) return await this.postEventCAR(car) } - /** Register interest in streams using the given model stream ID */ + /** + * Registers interest in a model stream using its model stream ID. + * + * @param model - The stream ID of the model to register interest in. + * @returns A Promise that resolves when the request completes. + * + * @throws Will throw an error if the request fails. + */ async registerInterestModel(model: string): Promise { const { error } = await this.#api.POST('/interests', { body: { sep: 'model', sepValue: model }, }) if (error != null) { - throw new Error(error.message) + throw new Error(`Failed to register interest in model: ${error.message}`) } } } -/** @internal */ +/** + * Internal utility function to retrieve or initialize a Ceramic client. + * + * @param ceramic - Either a Ceramic client instance or a Ceramic server URL. + * @returns A Ceramic client instance. + */ export function getCeramicClient( ceramic: CeramicClient | string, ): CeramicClient { diff --git a/packages/stream-client/src/index.ts b/packages/stream-client/src/index.ts index a5f541c..77445fb 100644 --- a/packages/stream-client/src/index.ts +++ b/packages/stream-client/src/index.ts @@ -32,17 +32,17 @@ export type StreamClientParams = { * This class is intended to be extended by other classes for more specific functionalities. */ export class StreamClient { - /** - * Instance of the Ceramic HTTP client, used to communicate with the Ceramic node. + /** + * Instance of the Ceramic HTTP client, used to communicate with the Ceramic node. * It facilitates API interactions such as fetching stream states or publishing updates. */ - #ceramic: CeramicClient; + #ceramic: CeramicClient /** * Optional Decentralized Identifier (DID) attached to the instance. * The DID is typically used for authentication or signing event payloads. */ - #did?: DID; + #did?: DID /** * Creates a new instance of `StreamClient`. @@ -53,21 +53,21 @@ export class StreamClient { */ constructor(params: StreamClientParams) { // Initialize the Ceramic client from the provided parameters - this.#ceramic = getCeramicClient(params.ceramic); + this.#ceramic = getCeramicClient(params.ceramic) // Attach the provided DID to the instance (if any) - this.#did = params.did; + this.#did = params.did } /** * Retrieves the Ceramic HTTP client instance used to interact with the Ceramic server. * * This client is essential for executing API requests to fetch stream data. - * + * * @returns The `CeramicClient` instance associated with this StreamClient. */ get ceramic(): CeramicClient { - return this.#ceramic; + return this.#ceramic } /** @@ -79,12 +79,12 @@ export class StreamClient { * @param streamId - The unique identifier of the stream to fetch. * - Can be a multibase-encoded string or a `StreamID` object. * @returns A Promise that resolves to the `StreamState` object, representing the current state of the stream. - * + * * @throws Will throw an error if the API request fails or returns an error response (if stream is not found). * * @example * ```typescript - * const streamState = await client.getStreamState('kjzl6cwe1...'); + * const streamState = await client.getStreamState('kjzl6cwe1...'); * console.log(streamState); * ``` */ @@ -99,16 +99,16 @@ export class StreamClient { typeof streamId === 'string' ? streamId : streamId.toString(), }, }, - } - ); + }, + ) // Handle errors returned from the API if (error != null) { - throw new Error(`Failed to fetch stream state: ${error.message}`); + throw new Error(`Failed to fetch stream state: ${error.message}`) } // Return the retrieved stream state - return data; + return data } /** @@ -119,7 +119,7 @@ export class StreamClient { * * @param provided - An optional DID object to use. If not supplied, the instance's DID is returned. * @returns The DID object, either provided or attached to the instance. - * + * * @throws Will throw an error if neither a provided DID nor an instance DID is available. * * @example @@ -130,12 +130,13 @@ export class StreamClient { */ getDID(provided?: DID): DID { if (provided != null) { - return provided; + return provided } if (this.#did != null) { - return this.#did; + return this.#did } - throw new Error('Missing DID: Neither a provided DID nor an instance DID is available.'); + throw new Error( + 'Missing DID: Neither a provided DID nor an instance DID is available.', + ) } } - From d4d1b0dba80722a7b6ddf7ec4ae7439486a4d619 Mon Sep 17 00:00:00 2001 From: Mark Krasner Date: Thu, 19 Dec 2024 13:30:52 -0500 Subject: [PATCH 4/8] Improved commenting for model client --- packages/model-client/src/index.ts | 62 +++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 6 deletions(-) diff --git a/packages/model-client/src/index.ts b/packages/model-client/src/index.ts index 325d8ee..f50e8e3 100644 --- a/packages/model-client/src/index.ts +++ b/packages/model-client/src/index.ts @@ -21,7 +21,13 @@ import type { DID } from 'dids' const header: PartialInitEventHeader = { model: MODEL, sep: 'model' } /** - * Create a signed init event for a model using the provided DID and model definition + * Creates a signed initialization event for a model using the provided DID and model definition. + * + * @param did - The Decentralized Identifier (DID) to sign the initialization event. + * @param data - The model definition to be signed. + * @returns A promise that resolves to a `SignedEvent` representing the initialization event. + * + * @throws Will throw an error if the model content is invalid or the DID is not authenticated. */ export async function createInitEvent( did: DID, @@ -37,15 +43,37 @@ export async function createInitEvent( return event } +/** + * Represents a client for interacting with Ceramic models. + * + * The `ModelClient` class extends the `StreamClient` class to provide additional + * methods specific to working with Ceramic models, including fetching and posting + * model definitions, retrieving initialization events, and decoding stream data. + */ export class ModelClient extends StreamClient { - /** Get the signed init event of a Model based on its stream ID */ + /** + * Retrieves the signed initialization event of a model based on its stream ID. + * + * @param streamID - The stream ID of the model, either as a `StreamID` object or string. + * @returns A promise that resolves to the `SignedEvent` for the model. + * + * @throws Will throw an error if the stream ID is invalid or the request fails. + */ async getInitEvent(streamID: StreamID | string): Promise { const id = typeof streamID === 'string' ? StreamID.fromString(streamID) : streamID return await this.ceramic.getEventType(SignedEvent, id.cid.toString()) } - /** Get the init event payload of a Model based on its stream ID */ + /** + * Retrieves the payload of the initialization event for a model based on its stream ID. + * + * @param streamID - The stream ID of the model, either as a `StreamID` object or string. + * @param verifier - (Optional) A `DID` instance for verifying the event payload. + * @returns A promise that resolves to the `ModelInitEventPayload`. + * + * @throws Will throw an error if the event or payload is invalid or verification fails. + */ async getPayload( streamID: StreamID | string, verifier?: DID, @@ -59,7 +87,15 @@ export class ModelClient extends StreamClient { return container.payload } - /** Post a Model definition and return its stream ID */ + /** + * Posts a model definition and returns the resulting stream ID. + * + * @param definition - The model JSON definition to post. + * @param signer - (Optional) A `DID` instance for signing the model definition. + * @returns A promise that resolves to the `StreamID` of the posted model. + * + * @throws Will throw an error if the definition is invalid or the signing process fails. + */ async postDefinition( definition: ModelDefinition, signer?: DID, @@ -70,7 +106,14 @@ export class ModelClient extends StreamClient { return getModelStreamID(cid) } - /** Retrieve the stringified model stream ID from a model instance document stream ID */ + /** + * Retrieves the stringified model stream ID from a model instance document stream ID. + * + * @param streamID - The document stream ID, either as a `StreamID` object or string. + * @returns A promise that resolves to the stringified model stream ID. + * + * @throws Will throw an error if the stream ID or its state is invalid. + */ async getDocumentModel(streamID: StreamID | string): Promise { const id = typeof streamID === 'string' ? StreamID.fromString(streamID) : streamID @@ -79,7 +122,14 @@ export class ModelClient extends StreamClient { return stream.toString() } - /** Retrieve a model's JSON definition based on the model's stream ID*/ + /** + * Retrieves a model's JSON definition based on the model's stream ID. + * + * @param streamID - The stream ID of the model, either as a `StreamID` object or string. + * @returns A promise that resolves to the `ModelDefinition` for the specified model. + * + * @throws Will throw an error if the stream ID is invalid or the data cannot be decoded. + */ async getModelDefinition( streamID: StreamID | string, ): Promise { From d4c7bad45fd94cec9fd3b81ec270c1fc42df9f9f Mon Sep 17 00:00:00 2001 From: Mark Krasner Date: Thu, 19 Dec 2024 13:40:18 -0500 Subject: [PATCH 5/8] Improving commenting throughout model-instance-client --- packages/model-instance-client/src/client.ts | 119 ++++++++++++++----- packages/model-instance-client/src/events.ts | 70 +++++++++-- packages/model-instance-client/src/utils.ts | 71 +++++++++-- 3 files changed, 210 insertions(+), 50 deletions(-) diff --git a/packages/model-instance-client/src/client.ts b/packages/model-instance-client/src/client.ts index b27e4a4..00ea0a1 100644 --- a/packages/model-instance-client/src/client.ts +++ b/packages/model-instance-client/src/client.ts @@ -22,17 +22,29 @@ import { } from './events.js' import type { DocumentState, UnknownContent } from './types.js' +/** + * Parameters for posting a deterministic initialization event. + */ export type PostDeterministicInitParams = { + /** The model's stream ID */ model: StreamID + /** The controller of the stream (DID string or literal string) */ controller: DIDString | string + /** A unique value to ensure determinism of the event */ uniqueValue?: Uint8Array } +/** + * Parameters for posting a signed initialization event. + */ export type PostSignedInitParams = Omit, 'controller'> & { controller?: DID } +/** + * Parameters for posting a data event. + */ export type PostDataParams = Omit< CreateDataEventParams, 'controller' @@ -40,6 +52,9 @@ export type PostDataParams = Omit< controller?: DID } +/** + * Parameters for updating a document with new content. + */ export type UpdateDataParams = Omit< PostDataEventParams, 'controller' @@ -47,8 +62,23 @@ export type UpdateDataParams = Omit< controller?: DID } +/** + * Extends the StreamClient to add functionality for interacting with Ceramic model instance documents. + * + * The `ModelInstanceClient` class provides methods to: + * - Retrieve events and document states + * - Post deterministic and signed initialization events + * - Update existing documents with new content + */ export class ModelInstanceClient extends StreamClient { - /** Get a DocumentEvent based on its commit ID */ + /** + * Retrieves a `DocumentEvent` based on its commit ID. + * + * @param commitID - The commit ID of the event, either as a `CommitID` object or string. + * @returns A promise that resolves to the `DocumentEvent` for the specified commit ID. + * + * @throws Will throw an error if the commit ID is invalid or the request fails. + */ async getEvent(commitID: CommitID | string): Promise { const id = typeof commitID === 'string' ? CommitID.fromString(commitID) : commitID @@ -59,15 +89,15 @@ export class ModelInstanceClient extends StreamClient { } /** - * Post a deterministic init event and return its commit ID + * Posts a deterministic initialization event and returns its commit ID. * - * @remarks This method is used to post an init event that is deterministic, meaning that the - * resulting stream ID is derived from the uniqueValue parameter. This is used when creating - * model instance documents of type `set` and `single`. - * - * @param params - Parameters for posting a deterministic init event - * @returns Commit ID of the posted event + * @param params - Parameters for posting the deterministic init event. + * @returns A promise that resolves to the `CommitID` of the posted event. * + * @remarks + * This method ensures that the resulting stream ID is deterministic, derived + * from the `uniqueValue` parameter. Commonly used for model instance documents + * of type `set` and `single`. */ async postDeterministicInit( params: PostDeterministicInitParams, @@ -82,14 +112,14 @@ export class ModelInstanceClient extends StreamClient { } /** - * Post a signed init event and return its commit ID + * Posts a signed initialization event and returns its commit ID. * - * @remarks This method is used to post an init event that is non-deterministic, meaning that the - * resulting stream ID is not derived from the uniqueValue parameter. This is used when creating - * model instance documents of type `list`. + * @param params - Parameters for posting the signed init event. + * @returns A promise that resolves to the `CommitID` of the posted event. * - * @param params - Parameters for posting a signed init event - * @returns Commit ID of the posted event + * @remarks + * This method results in a non-deterministic stream ID, typically used for + * model instance documents of type `list`. */ async postSignedInit( params: PostSignedInitParams, @@ -103,7 +133,16 @@ export class ModelInstanceClient extends StreamClient { return CommitID.fromStream(getStreamID(cid)) } - /** Post a data event and return its commit ID */ + /** + * Posts a data event and returns its commit ID. + * + * @param params - Parameters for posting the data event. + * @returns A promise that resolves to the `CommitID` of the posted event. + * + * @remarks + * The data event updates the content of a stream and is associated with the + * current state of the stream. + */ async postData( params: PostDataParams, ): Promise { @@ -116,12 +155,22 @@ export class ModelInstanceClient extends StreamClient { return CommitID.fromStream(params.currentID.baseID, cid) } - /** Gets currentID */ + /** + * Retrieves the `CommitID` for the provided stream ID. + * + * @param streamID - The stream ID string. + * @returns The `CommitID` for the stream. + */ getCurrentID(streamID: string): CommitID { return new CommitID(3, streamID) } - /** Transform StreamState into DocumentState */ + /** + * Transforms a `StreamState` into a `DocumentState`. + * + * @param streamState - The stream state to transform. + * @returns The `DocumentState` derived from the stream state. + */ streamStateToDocumentState(streamState: StreamState): DocumentState { const decodedData = decodeMultibaseToJSON(streamState.data) const controller = streamState.controller @@ -138,7 +187,16 @@ export class ModelInstanceClient extends StreamClient { } } - /** Retrieve and return document state */ + /** + * Retrieves the document state for a given stream ID. + * + * @param streamID - The stream ID, either as a `StreamID` object or string. + * @returns A promise that resolves to the `DocumentState`. + * + * @throws Will throw an error if the stream ID is invalid or the request fails. + * + * @remarks This method fetches the stream state using the extended StreamClient's `getStreamState` method. + */ async getDocumentState(streamID: StreamID | string): Promise { const id = typeof streamID === 'string' ? StreamID.fromString(streamID) : streamID @@ -147,22 +205,21 @@ export class ModelInstanceClient extends StreamClient { } /** - * Update a document with new content and return the updated document state + * Updates a document with new content and returns the updated document state. * - * @remarks This method is used to update the content of a document. The new content is - * posted as a data event and the document state is returned with the updated content. The - * document's current state can be provided as a parameter to avoid fetching it from the - * Ceramic node. + * @param params - Parameters for updating the document. + * @returns A promise that resolves to the updated `DocumentState`. * - * @param params - Parameters for updating a document - * @returns Updated document state + * @remarks + * This method posts the new content as a data event, updating the document. + * It can optionally take the current document state to avoid re-fetching it. */ async updateDocument( params: UpdateDataParams, ): Promise { let currentState: DocumentState let currentId: CommitID - // If currentState is not provided, fetch the current state + if (!params.currentState) { const streamState = await this.getStreamState( StreamID.fromString(params.streamID), @@ -173,18 +230,20 @@ export class ModelInstanceClient extends StreamClient { currentState = this.streamStateToDocumentState(params.currentState) currentId = this.getCurrentID(params.currentState.event_cid) } + const { content } = currentState const { controller, newContent, shouldIndex } = params - // Use existing postData utility to access the ceramic api + await this.postData({ controller: this.getDID(controller), currentContent: content ?? undefined, - newContent: newContent, + newContent, currentID: currentId, - shouldIndex: shouldIndex, + shouldIndex, }) + return { - content: params.newContent, + content: newContent, metadata: { model: currentState.metadata.model, controller: currentState.metadata.controller, diff --git a/packages/model-instance-client/src/events.ts b/packages/model-instance-client/src/events.ts index e9b6b2b..44c5fa7 100644 --- a/packages/model-instance-client/src/events.ts +++ b/packages/model-instance-client/src/events.ts @@ -21,6 +21,9 @@ import type { StreamState } from '@ceramic-sdk/stream-client' import type { UnknownContent } from './types.js' import { createInitHeader, getPatchOperations } from './utils.js' +/** + * Parameters required to create a non-deterministic initialization event for a ModelInstanceDocument stream. + */ export type CreateInitEventParams = { /** Initial JSON object content for the ModelInstanceDocument stream */ content: T @@ -30,13 +33,21 @@ export type CreateInitEventParams = { model: StreamID /** Optional context */ context?: StreamID - /** Flag notifying indexers if they should index the ModelInstanceDocument stream or not, defaults to `true` */ + /** Flag indicating if indexers should index the ModelInstanceDocument stream (defaults to `true`) */ shouldIndex?: boolean } /** - * Create a non-deterministic init event for a ModelInstanceDocument stream. - * @see {@link getDeterministicInitEventPayload} for deterministic events. + * Creates a non-deterministic initialization event for a ModelInstanceDocument stream. + * + * @param params - The parameters required to create the initialization event. + * @returns A promise that resolves to a signed initialization event. + * + * @remarks + * This method creates a non-deterministic initialization event for use with streams where + * the stream ID is not derived from a unique value. + * + * @see {@link getDeterministicInitEventPayload} for deterministic initialization events. */ export async function createInitEvent< T extends UnknownContent = UnknownContent, @@ -52,8 +63,16 @@ export async function createInitEvent< } /** - * Get a deterministic init event payload for a ModelInstanceDocument stream. - * @see {@link createInitEvent} for creating non-deterministic events. + * Retrieves the payload for a deterministic initialization event for a ModelInstanceDocument stream. + * + * @param model - The stream ID of the model associated with the stream. + * @param controller - The DID string or literal string for the stream's controller. + * @param uniqueValue - Optional unique value to ensure determinism. + * @returns The deterministic initialization event payload. + * + * @remarks + * Deterministic initialization events ensure the resulting stream ID is derived + * from the provided unique value. */ export function getDeterministicInitEventPayload( model: StreamID, @@ -71,7 +90,12 @@ export function getDeterministicInitEventPayload( } /** - * Get an encoded deterministic init event for a ModelInstanceDocument stream + * Encodes a deterministic initialization event for a ModelInstanceDocument stream. + * + * @param model - The stream ID of the model associated with the stream. + * @param controller - The DID string or literal string for the stream's controller. + * @param uniqueValue - Optional unique value to ensure determinism. + * @returns The encoded deterministic initialization event payload. */ export function getDeterministicInitEvent( model: StreamID, @@ -88,7 +112,14 @@ export function getDeterministicInitEvent( } /** - * Create a data event payload for a ModelInstanceDocument stream + * Creates a data event payload for a ModelInstanceDocument stream. + * + * @param current - The current commit ID of the stream. + * @param data - The JSON patch operations to apply to the stream content. + * @param header - Optional header information for the data event. + * @returns A valid data event payload. + * + * @throws Will throw an error if the JSON patch operations are invalid. */ export function createDataEventPayload( current: CommitID, @@ -110,32 +141,45 @@ export function createDataEventPayload( return payload } +/** + * Parameters required to create a signed data event for a ModelInstanceDocument stream. + */ export type CreateDataEventParams = { /** DID controlling the ModelInstanceDocument stream */ controller: DID /** Commit ID of the current tip of the ModelInstanceDocument stream */ currentID: CommitID - /** Current JSON object content for the ModelInstanceDocument stream, used with `newContent` to create the JSON patch */ + /** Current JSON object content for the stream, used with `newContent` to create a JSON patch */ currentContent?: T - /** New JSON object content for the ModelInstanceDocument stream, used with `currentContent` to create the JSON patch */ + /** New JSON object content for the stream, used with `currentContent` to create a JSON patch */ newContent?: T - /** Flag notifying indexers if they should index the ModelInstanceDocument stream or not */ + /** Flag indicating if indexers should index the stream */ shouldIndex?: boolean } +/** + * Parameters required to post a data event for a ModelInstanceDocument stream. + */ export type PostDataEventParams = { /** String representation of the StreamID to update */ streamID: string - /** New JSON object content for the ModelInstanceDocument stream, used with `currentContent` to create the JSON patch */ + /** New JSON object content for the stream, used with `currentContent` to create a JSON patch */ newContent: T /** Current JSON object containing the stream's current state */ currentState?: StreamState - /** Flag notifying indexers if they should index the ModelInstanceDocument stream or not */ + /** Flag indicating if indexers should index the stream */ shouldIndex?: boolean } /** - * Create a signed data event for a ModelInstanceDocument stream + * Creates a signed data event for a ModelInstanceDocument stream. + * + * @param params - Parameters required to create the data event. + * @returns A promise that resolves to the signed data event. + * + * @remarks + * The data event updates the content of the stream by applying JSON patch operations + * to the existing content. The resulting event is signed by the controlling DID. */ export async function createDataEvent< T extends UnknownContent = UnknownContent, diff --git a/packages/model-instance-client/src/utils.ts b/packages/model-instance-client/src/utils.ts index 972f60e..41100a3 100644 --- a/packages/model-instance-client/src/utils.ts +++ b/packages/model-instance-client/src/utils.ts @@ -8,23 +8,59 @@ import jsonpatch from 'fast-json-patch' import type { UnknownContent } from './types.js' -/** @internal */ +/** + * Generates a random byte array of a given length. + * + * @param length - The length of the byte array to generate. + * @returns A `Uint8Array` containing random bytes. + * + * @remarks + * This utility is typically used for generating unique identifiers + * or values where randomness is required. + * + * @internal + */ export function randomBytes(length: number): Uint8Array { const bytes = new Uint8Array(length) globalThis.crypto.getRandomValues(bytes) return bytes } -/** @internal */ +/** + * Parameters for creating a `DocumentInitEventHeader`. + * + * @internal + */ export type CreateInitHeaderParams = { + /** The stream ID of the model associated with the document. */ model: StreamID + /** The DID string or literal string representing the controller of the document. */ controller: DIDString | string + /** A unique value to ensure determinism, or a boolean to indicate uniqueness type. */ unique?: Uint8Array | boolean + /** Optional context for the document. */ context?: StreamID + /** Flag indicating if indexers should index the document. */ shouldIndex?: boolean } -/** @internal */ +/** + * Creates a `DocumentInitEventHeader` for a ModelInstanceDocument stream. + * + * @param params - The parameters required to create the initialization header. + * @returns A valid `DocumentInitEventHeader` object. + * + * @throws Will throw an error if the resulting header is invalid. + * + * @remarks + * - The `unique` parameter determines the uniqueness type: + * - If `false`, a random unique value is generated. + * - If an `Uint8Array`, the provided value is used. + * - If `true` or undefined, no unique value is added. + * - Additional optional fields like `context` and `shouldIndex` can be included. + * + * @internal + */ export function createInitHeader( params: CreateInitHeaderParams, ): DocumentInitEventHeader { @@ -36,12 +72,13 @@ export function createInitHeader( // Handle unique field if (params.unique == null || params.unique === false) { - // Generate a random unique value (account relation of type "list") + // Generate a random unique value (e.g., for account relation of type "list"). header.unique = randomBytes(12) } else if (params.unique instanceof Uint8Array) { - // Use the provided unique value (account relation of type "set") + // Use the provided unique value (e.g., for account relation of type "set"). header.unique = params.unique - } // Otherwise don't set any unique value (account relation of type "single") + } + // Otherwise, do not set any unique value (e.g., for account relation of type "single"). // Add optional fields if (params.context != null) { @@ -58,7 +95,27 @@ export function createInitHeader( return header } -/** @internal */ +/** + * Computes JSON patch operations to transform one content object into another. + * + * @param fromContent - The current content of the document. + * @param toContent - The new content of the document. + * @returns An array of JSON patch operations required to transform `fromContent` into `toContent`. + * + * @remarks + * - If either `fromContent` or `toContent` is undefined, an empty object `{}` is used as the default. + * - JSON patch operations are generated using the `fast-json-patch` library. + * + * @example + * ```typescript + * const currentContent = { name: 'Alice' }; + * const newContent = { name: 'Bob' }; + * const operations = getPatchOperations(currentContent, newContent); + * console.log(operations); // [{ op: 'replace', path: '/name', value: 'Bob' }] + * ``` + * + * @internal + */ export function getPatchOperations( fromContent?: T, toContent?: T, From 0a00f051c681f7d3cdf0e96987e7ceccd6ddc1cc Mon Sep 17 00:00:00 2001 From: Mark Krasner Date: Thu, 19 Dec 2024 13:59:17 -0500 Subject: [PATCH 6/8] Improving commenting for events package --- packages/events/src/container.ts | 72 +++++++++++++++++++++++--- packages/events/src/encoding.ts | 85 ++++++++++++++++++++++++++---- packages/events/src/signing.ts | 55 ++++++++++++++++++-- packages/events/src/utils.ts | 89 +++++++++++++++++++++++++++++--- 4 files changed, 274 insertions(+), 27 deletions(-) diff --git a/packages/events/src/container.ts b/packages/events/src/container.ts index 4bc27ec..d921a00 100644 --- a/packages/events/src/container.ts +++ b/packages/events/src/container.ts @@ -5,7 +5,17 @@ import type { CID } from 'multiformats/cid' import { SignedEvent } from './codecs.js' import { getSignedEventPayload } from './signing.js' -/** Container for a signed Ceramic event */ +/** + * A container for a signed Ceramic event. + * + * @typeParam Payload - The type of the event's payload. + * + * @property signed - Indicates that the event is signed (`true`). + * @property cid - The CID of the linked block for the event. + * @property payload - The decoded payload of the event. + * @property verified - The result of verifying the event's JWS. + * @property cacaoBlock - (Optional) A block containing a Cacao (Capability Object). + */ export type SignedEventContainer = { signed: true cid: CID @@ -14,18 +24,39 @@ export type SignedEventContainer = { cacaoBlock?: Uint8Array } -/** Container for an unsigned Ceramic event */ +/** + * A container for an unsigned Ceramic event. + * + * @typeParam Payload - The type of the event's payload. + * + * @property signed - Indicates that the event is unsigned (`false`). + * @property payload - The decoded payload of the event. + */ export type UnsignedEventContainer = { signed: false payload: Payload } -/** Container for a Ceramic event, providing additional metadata about the event */ +/** + * A container for a Ceramic event, which can be either signed or unsigned. + * + * @typeParam Payload - The type of the event's payload. + */ export type EventContainer = | SignedEventContainer | UnsignedEventContainer -/** Decode an unsigned Ceramic event into a container using the provided payload decoder */ +/** + * Decodes an unsigned Ceramic event into a container. + * + * @param codec - The codec used to decode the event's payload. + * @param event - The unsigned Ceramic event to decode. + * @returns An `UnsignedEventContainer` containing the decoded payload. + * + * @remarks + * - This function assumes that the event is unsigned and decodes it accordingly. + * - Use `eventToContainer` if the event type (signed or unsigned) is unknown. + */ export function unsignedEventToContainer( codec: Decoder, event: unknown, @@ -33,7 +64,20 @@ export function unsignedEventToContainer( return { signed: false, payload: decode(codec, event) } } -/** Decode a signed Ceramic event into a container using the provided verifier DID and payload decoder */ +/** + * Decodes a signed Ceramic event into a container. + * + * @param did - The DID used to verify the event's JWS. + * @param codec - The codec used to decode the event's payload. + * @param event - The signed Ceramic event to decode. + * @returns A promise that resolves to a `SignedEventContainer` containing the decoded payload and metadata. + * + * @throws Will throw an error if the linked block CID is missing or if verification fails. + * + * @remarks + * - This function verifies the event's JWS and decodes its payload simultaneously. + * - It also includes additional metadata such as the verification result and `cacaoBlock` if present. + */ export async function signedEventToContainer( did: DID, codec: Decoder, @@ -44,13 +88,25 @@ export async function signedEventToContainer( throw new Error('Missing linked block CID') } const [verified, payload] = await Promise.all([ - did.verifyJWS(event.jws), - getSignedEventPayload(codec, event), + did.verifyJWS(event.jws), // Verify the JWS signature. + getSignedEventPayload(codec, event), // Decode the payload. ]) return { signed: true, cid, verified, payload, cacaoBlock: event.cacaoBlock } } -/** Decode a Ceramic event into a container using the provided verifier DID and payload decoder */ +/** + * Decodes a Ceramic event (signed or unsigned) into a container. + * + * @param did - The DID used to verify the event's JWS if it is signed. + * @param codec - The codec used to decode the event's payload. + * @param event - The Ceramic event to decode (can be signed or unsigned). + * @returns A promise that resolves to an `EventContainer` containing the decoded payload and metadata. + * + * @remarks + * - This function determines the type of the event (signed or unsigned) and processes it accordingly. + * - For signed events, it verifies the JWS and decodes the payload. + * - For unsigned events, it simply decodes the payload. + */ export async function eventToContainer( did: DID, codec: Decoder, diff --git a/packages/events/src/encoding.ts b/packages/events/src/encoding.ts index de66446..d77f2ee 100644 --- a/packages/events/src/encoding.ts +++ b/packages/events/src/encoding.ts @@ -10,6 +10,7 @@ import { sha256 } from 'multihashes-sync/sha2' import { SignedEvent } from './codecs.js' import { base64urlToJSON, restrictBlockSize } from './utils.js' +// Initialize a CAR factory with support for DAG-JOSE and DAG-JSON codecs. const carFactory = new CARFactory() carFactory.codecs.add(dagJose) carFactory.codecs.add(dagJson) @@ -18,15 +19,31 @@ carFactory.hashers.add(sha256) /** @internal */ export type Base = keyof typeof bases -/** @internal */ +/** Default base encoding for CAR files (Base64) */ export const DEFAULT_BASE: Base = 'base64' -/** Encode a CAR into a string, using the given base (defaults to base64) */ +/** + * Encodes a CAR into a string using the specified base encoding. + * + * @param car - The CAR to encode. + * @param base - The base encoding to use (defaults to Base64). + * @returns The string-encoded CAR. + * + * @throws Will throw an error if the base encoding is not supported. + */ export function carToString(car: CAR, base: Base = DEFAULT_BASE): string { return car.toString(base) } -/** Decode a CAR from a string, using the given base (defaults to base64) */ +/** + * Decodes a CAR from a string using the specified base encoding. + * + * @param value - The string-encoded CAR. + * @param base - The base encoding used to decode the CAR (defaults to Base64). + * @returns The decoded CAR object. + * + * @throws Will throw an error if the base encoding is not supported. + */ export function carFromString(value: string, base: Base = DEFAULT_BASE): CAR { const codec = bases[base] if (codec == null) { @@ -35,7 +52,16 @@ export function carFromString(value: string, base: Base = DEFAULT_BASE): CAR { return carFactory.fromBytes(codec.decode(value)) } -/** Encode a signed event into a CAR */ +/** + * Encodes a signed event into a CAR format. + * + * @param event - The signed event to encode. + * @returns A CAR object representing the signed event. + * + * @remarks + * - Encodes the JWS, linked block, and optional `cacaoBlock` into the CAR. + * - Validates block sizes using `restrictBlockSize` to ensure consistency. + */ export function signedEventToCAR(event: SignedEvent): CAR { const { jws, linkedBlock, cacaoBlock } = event const car = carFactory.build() @@ -68,7 +94,16 @@ export function signedEventToCAR(event: SignedEvent): CAR { return car } -/** Encode an unsigned event into a CAR using the provided codec */ +/** + * Encodes an unsigned event into a CAR using the provided codec. + * + * @param codec - The codec used to encode the event. + * @param event - The unsigned event to encode. + * @returns A CAR object representing the unsigned event. + * + * @remarks + * Encodes the event as the root of the CAR file using the specified codec. + */ export function encodeEventToCAR(codec: Codec, event: unknown): CAR { const car = carFactory.build() const cid = car.put(codec.encode(event), { isRoot: true }) @@ -78,14 +113,30 @@ export function encodeEventToCAR(codec: Codec, event: unknown): CAR { return car } -/** Encode an event into a CAR using the provided codec for unsigned events */ +/** + * Encodes an event into a CAR. Supports both signed and unsigned events. + * + * @param codec - The codec used for unsigned events. + * @param event - The event to encode (signed or unsigned). + * @returns A CAR object representing the event. + * + * @remarks + * Uses `signedEventToCAR` for signed events and `encodeEventToCAR` for unsigned events. + */ export function eventToCAR(codec: Codec, event: unknown): CAR { return SignedEvent.is(event) ? signedEventToCAR(event) : encodeEventToCAR(codec, event) } -/** Encode an event into a string using the provided codec for unsigned events and the given base (defaults to base64) */ +/** + * Encodes an event into a string using the specified codec and base encoding. + * + * @param codec - The codec used for unsigned events. + * @param event - The event to encode (signed or unsigned). + * @param base - The base encoding to use (defaults to Base64). + * @returns The string-encoded CAR representing the event. + */ export function eventToString( codec: Codec, event: unknown, @@ -94,7 +145,16 @@ export function eventToString( return carToString(eventToCAR(codec, event), base) } -/** Decode an event from a string using the provided codec for unsigned events */ +/** + * Decodes an event from a CAR object using the specified decoder. + * + * @param decoder - The decoder to use for unsigned events. + * @param car - The CAR object containing the event. + * @param eventCID - (Optional) The CID of the event to decode. + * @returns The decoded event, either a `SignedEvent` or a custom payload. + * + * @throws Will throw an error if the linked block is missing or decoding fails. + */ export function eventFromCAR( decoder: Decoder, car: CAR, @@ -124,7 +184,14 @@ export function eventFromCAR( return decode(decoder, root) } -/** Decode an event from a string using the provided codec for unsigned events and the given base (defaults to base64) */ +/** + * Decodes an event from a string using the specified decoder and base encoding. + * + * @param decoder - The decoder to use for unsigned events. + * @param value - The string-encoded CAR containing the event. + * @param base - The base encoding used (defaults to Base64). + * @returns The decoded event, either a `SignedEvent` or a custom payload. + */ export function eventFromString( decoder: Decoder, value: string, diff --git a/packages/events/src/signing.ts b/packages/events/src/signing.ts index 5c1cc0c..e146531 100644 --- a/packages/events/src/signing.ts +++ b/packages/events/src/signing.ts @@ -11,7 +11,20 @@ import { type SignedEvent, } from './codecs.js' -/** Sign an event payload using the provided DID */ +/** + * Signs an event payload using the provided DID. + * + * @param did - The DID instance used to sign the payload. + * @param payload - The data to be signed, provided as a key-value map. + * @param options - (Optional) Additional options for creating the JWS. + * @returns A promise that resolves to a `SignedEvent` containing the JWS and linked block. + * + * @throws Will throw an error if the DID is not authenticated. + * + * @remarks + * This function uses the DID's `createDagJWS` method to sign the payload and + * returns the signed event, including the linked block as a `Uint8Array`. + */ export async function signEvent( did: DID, payload: Record, @@ -24,12 +37,33 @@ export async function signEvent( return { ...rest, linkedBlock: new Uint8Array(linkedBlock) } } -// Make controllers optional in the event header as createSignedEvent() will inject it as needed +/** + * A partial version of the initialization event header, with optional controllers. + * + * @remarks + * This type is used to allow the creation of initialization events without requiring + * the `controllers` field, as it will be injected automatically during the signing process. + */ export type PartialInitEventHeader = Omit & { controllers?: [DIDString] } -/** Create a signed init event using the provided DID, data and header */ +/** + * Creates a signed initialization event using the provided DID, data, and header. + * + * @param did - The DID instance used to sign the initialization event. + * @param data - The initialization data to be included in the event. + * @param header - The header for the initialization event, with optional controllers. + * @param options - (Optional) Additional options for creating the JWS. + * @returns A promise that resolves to a `SignedEvent` representing the initialization event. + * + * @throws Will throw an error if the DID is not authenticated. + * + * @remarks + * - If `controllers` are not provided in the header, they will be automatically set + * based on the DID's parent (if available) or the DID itself. + * - The payload is encoded as an `InitEventPayload` before signing. + */ export async function createSignedInitEvent( did: DID, data: T, @@ -49,7 +83,20 @@ export async function createSignedInitEvent( return await signEvent(did, payload, options) } -/** Decode the payload of a signed event using the provided decoder */ +/** + * Decodes the payload of a signed event using the provided decoder. + * + * @param decoder - The decoder used to interpret the event's payload. + * @param event - The signed event containing the payload to decode. + * @returns A promise that resolves to the decoded payload. + * + * @throws Will throw an error if the linked block CID is missing or if decoding fails. + * + * @remarks + * - The function reconstructs the block from the event's linked block and CID, + * using the DAG-CBOR codec and SHA-256 hasher. + * - The payload is decoded using the provided decoder to ensure its validity and type safety. + */ export async function getSignedEventPayload>( decoder: Decoder, event: SignedEvent, diff --git a/packages/events/src/utils.ts b/packages/events/src/utils.ts index 8dbd38b..3a21e57 100644 --- a/packages/events/src/utils.ts +++ b/packages/events/src/utils.ts @@ -3,14 +3,49 @@ import { bases } from 'multiformats/basics' import type { CID } from 'multiformats/cid' import { toString as bytesToString, fromString } from 'uint8arrays' -/** @internal */ +/** + * Maximum allowed size for IPLD blocks. + * + * @remarks + * This constant is used to enforce size restrictions on blocks, + * ensuring they do not exceed the maximum of 256 KB. + * + * @internal + */ export const MAX_BLOCK_SIZE = 256000 // 256 KB -/** @internal */ +/** + * Decodes a Base64URL-encoded string into a JSON object. + * + * @param value - The Base64URL-encoded string to decode. + * @returns The decoded JSON object. + * + * @typeParam T - The expected shape of the returned JSON object (defaults to `Record`). + * + * @example + * ```typescript + * const json = base64urlToJSON<{ foo: string }>('eyJmb28iOiAiYmFyIn0'); + * console.log(json.foo); // Output: "bar" + * ``` + */ export function base64urlToJSON>(value: string): T { return JSON.parse(bytesToString(fromString(value, 'base64url'))) } +/** + * Decodes a multibase-encoded string into a `Uint8Array`. + * + * @param multibaseString - The multibase-encoded string to decode. + * @returns A `Uint8Array` containing the decoded data. + * + * @throws Will throw an error if the string's prefix does not match a supported multibase encoding. + * + * @example + * ```typescript + * const bytes = decodeMultibase('z1a2b3c...'); + * console.log(bytes); // Output: Uint8Array([...]) + * ``` + */ export function decodeMultibase(multibaseString: string): Uint8Array { const prefix = multibaseString[0] const baseEntry = Object.values(bases).find((base) => base.prefix === prefix) @@ -18,9 +53,23 @@ export function decodeMultibase(multibaseString: string): Uint8Array { throw new Error(`Unsupported multibase prefix: ${prefix}`) } - return baseEntry.decode(multibaseString) // Remove prefix and decode + return baseEntry.decode(multibaseString) // Decode without the prefix. } +/** + * Decodes a multibase-encoded string into a JSON object. + * + * @param value - The multibase-encoded string to decode. + * @returns The decoded JSON object. + * + * @typeParam T - The expected shape of the returned JSON object (defaults to `Record`). + * + * @example + * ```typescript + * const json = decodeMultibaseToJSON<{ key: string }>('z1a2b3c...'); + * console.log(json.key); // Output: "value" + * ``` + */ export function decodeMultibaseToJSON>( value: string, ): T { @@ -28,15 +77,43 @@ export function decodeMultibaseToJSON>( return JSON.parse(new TextDecoder().decode(data)) } +/** + * Decodes a multibase-encoded string into a `StreamID`. + * + * @param value - The multibase-encoded string to decode. + * @returns A `StreamID` object representing the decoded value. + * + * @example + * ```typescript + * const streamID = decodeMultibaseToStreamID('z1a2b3c...'); + * console.log(streamID.toString()); // Output: StreamID + * ``` + */ export function decodeMultibaseToStreamID(value: string): StreamID { return StreamID.fromBytes(decodeMultibase(value)) } /** - * Restricts block size to MAX_BLOCK_SIZE. + * Enforces a size restriction on an IPLD block. + * + * @param block - The IPLD block as a `Uint8Array`. + * @param cid - The CID associated with the block. + * + * @throws Will throw an error if the block size exceeds the `MAX_BLOCK_SIZE`. + * + * @remarks + * This function is used to ensure that blocks do not exceed the maximum allowed size. + * + * @example + * ```typescript + * const block = new Uint8Array(256001); // Larger than MAX_BLOCK_SIZE + * try { + * restrictBlockSize(block, cid); + * } catch (error) { + * console.error(error.message); // "Commit size exceeds the maximum block size" + * } + * ``` * - * @param block - Uint8Array of IPLD block - * @param cid - Commit CID * @internal */ export function restrictBlockSize(block: Uint8Array, cid: CID): void { From 1705e453c23b203b11af62411653536229a0d107 Mon Sep 17 00:00:00 2001 From: Mark Krasner Date: Thu, 19 Dec 2024 15:13:09 -0500 Subject: [PATCH 7/8] Reformatting openapi generated api comments for typedoc --- packages/http-client/src/__generated__/api.ts | 484 +++++++++++++----- 1 file changed, 363 insertions(+), 121 deletions(-) diff --git a/packages/http-client/src/__generated__/api.ts b/packages/http-client/src/__generated__/api.ts index 032ad9a..868aa65 100644 --- a/packages/http-client/src/__generated__/api.ts +++ b/packages/http-client/src/__generated__/api.ts @@ -1,9 +1,16 @@ /** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. + * + * @remarks + * Contains TypeScript types representing the API paths, components, schemas, and operations + * defined in the OpenAPI specification for the Ceramic node. */ export interface paths { + /** + * Endpoints for testing the liveness of the Ceramic node. + */ '/liveness': { parameters: { query?: never @@ -11,7 +18,12 @@ export interface paths { path?: never cookie?: never } - /** Test the liveness of the Ceramic node */ + /** + * Test the liveness of the Ceramic node. + * + * @remarks + * Sends a GET request to verify that the Ceramic node is operational. + */ get: { parameters: { query?: never @@ -21,14 +33,18 @@ export interface paths { } requestBody?: never responses: { - /** @description success */ + /** + * Successful response. + */ 200: { headers: { [name: string]: unknown } content?: never } - /** @description Internal server error */ + /** + * Internal server error. + */ 500: { headers: { [name: string]: unknown @@ -52,7 +68,9 @@ export interface paths { } requestBody?: never responses: { - /** @description cors */ + /** + * Cross-Origin Resource Sharing (CORS) preflight response. + */ 200: { headers: { [name: string]: unknown @@ -65,6 +83,9 @@ export interface paths { patch?: never trace?: never } + /** + * Endpoints for retrieving heap statistics. + */ '/debug/heap': { parameters: { query?: never @@ -72,7 +93,12 @@ export interface paths { path?: never cookie?: never } - /** Get the heap statistics of the Ceramic node */ + /** + * Get the heap statistics of the Ceramic node. + * + * @remarks + * Provides details about the heap memory usage for debugging purposes. + */ get: { parameters: { query?: never @@ -82,7 +108,9 @@ export interface paths { } requestBody?: never responses: { - /** @description success */ + /** + * Successful response with heap statistics. + */ 200: { headers: { [name: string]: unknown @@ -91,7 +119,9 @@ export interface paths { 'application/octet-stream': string } } - /** @description bad request */ + /** + * Bad request error. + */ 400: { headers: { [name: string]: unknown @@ -100,7 +130,9 @@ export interface paths { 'application/json': components['schemas']['BadRequestResponse'] } } - /** @description Internal server error */ + /** + * Internal server error. + */ 500: { headers: { [name: string]: unknown @@ -124,7 +156,9 @@ export interface paths { } requestBody?: never responses: { - /** @description cors */ + /** + * Cross-Origin Resource Sharing (CORS) preflight response. + */ 200: { headers: { [name: string]: unknown @@ -137,6 +171,9 @@ export interface paths { patch?: never trace?: never } + /** + * Endpoints for retrieving the version of the Ceramic node. + */ '/version': { parameters: { query?: never @@ -144,7 +181,12 @@ export interface paths { path?: never cookie?: never } - /** Get the version of the Ceramic node */ + /** + * Get the version of the Ceramic node. + * + * @remarks + * Provides the version number of the Ceramic node in semver format. + */ get: { parameters: { query?: never @@ -154,7 +196,9 @@ export interface paths { } requestBody?: never responses: { - /** @description success */ + /** + * Successful response with the version information. + */ 200: { headers: { [name: string]: unknown @@ -163,7 +207,9 @@ export interface paths { 'application/json': components['schemas']['Version'] } } - /** @description Internal server error */ + /** + * Internal server error. + */ 500: { headers: { [name: string]: unknown @@ -185,7 +231,9 @@ export interface paths { } requestBody?: never responses: { - /** @description success */ + /** + * Successful response with the version information. + */ 200: { headers: { [name: string]: unknown @@ -194,7 +242,9 @@ export interface paths { 'application/json': components['schemas']['Version'] } } - /** @description Internal server error */ + /** + * Internal server error. + */ 500: { headers: { [name: string]: unknown @@ -216,7 +266,9 @@ export interface paths { } requestBody?: never responses: { - /** @description cors */ + /** + * Cross-Origin Resource Sharing (CORS) preflight response. + */ 200: { headers: { [name: string]: unknown @@ -229,6 +281,9 @@ export interface paths { patch?: never trace?: never } + /** + * Endpoints for managing Ceramic events. + */ '/events': { parameters: { query?: never @@ -238,7 +293,12 @@ export interface paths { } get?: never put?: never - /** Creates a new event */ + /** + * Creates a new Ceramic event. + * + * @remarks + * Posts a new event to the Ceramic node. + */ post: { parameters: { query?: never @@ -248,14 +308,18 @@ export interface paths { } requestBody: components['requestBodies']['EventData'] responses: { - /** @description success */ + /** + * Successful creation of the event. + */ 204: { headers: { [name: string]: unknown } content?: never } - /** @description bad request */ + /** + * Bad request error. + */ 400: { headers: { [name: string]: unknown @@ -264,7 +328,9 @@ export interface paths { 'application/json': components['schemas']['BadRequestResponse'] } } - /** @description Internal server error */ + /** + * Internal server error. + */ 500: { headers: { [name: string]: unknown @@ -286,7 +352,9 @@ export interface paths { } requestBody?: never responses: { - /** @description cors */ + /** + * Cross-Origin Resource Sharing (CORS) preflight response. + */ 200: { headers: { [name: string]: unknown @@ -299,6 +367,9 @@ export interface paths { patch?: never trace?: never } + /** + * Retrieves the details of a specific event. + */ '/events/{event_id}': { parameters: { query?: never @@ -312,14 +383,21 @@ export interface paths { query?: never header?: never path: { - /** @description CID of the root block of the event, used to identify of the event */ + /** + * CID string of the root block of the event. + * + * @remarks + * Used to uniquely identify the event. + */ event_id: string } cookie?: never } requestBody?: never responses: { - /** @description success */ + /** + * Successful retrieval of event details. + */ 200: { headers: { [name: string]: unknown @@ -328,7 +406,9 @@ export interface paths { 'application/json': components['schemas']['Event'] } } - /** @description bad request */ + /** + * Bad request error. + */ 400: { headers: { [name: string]: unknown @@ -337,7 +417,9 @@ export interface paths { 'application/json': components['schemas']['BadRequestResponse'] } } - /** @description Event not found */ + /** + * Event not found. + */ 404: { headers: { [name: string]: unknown @@ -346,7 +428,9 @@ export interface paths { 'text/plain': string } } - /** @description Internal server error */ + /** + * Internal server error. + */ 500: { headers: { [name: string]: unknown @@ -366,14 +450,18 @@ export interface paths { query?: never header?: never path: { - /** @description Name of the field in the Events header that holds the separator value e.g. 'model' */ + /** + * Name of the field in the Events header that holds the separator value. + */ event_id: string } cookie?: never } requestBody?: never responses: { - /** @description cors */ + /** + * Cross-Origin Resource Sharing (CORS) preflight response. + */ 200: { headers: { [name: string]: unknown @@ -399,14 +487,18 @@ export interface paths { query?: never header?: never path: { - /** @description Multibase encoded stream ID */ + /** + * Multibase encoded stream ID + */ stream_id: string } cookie?: never } requestBody?: never responses: { - /** @description success */ + /** + * Successful response. + */ 200: { headers: { [name: string]: unknown @@ -415,7 +507,9 @@ export interface paths { 'application/json': components['schemas']['StreamState'] } } - /** @description bad request */ + /** + * Bad request error. + */ 400: { headers: { [name: string]: unknown @@ -424,7 +518,9 @@ export interface paths { 'application/json': components['schemas']['BadRequestResponse'] } } - /** @description Stream not found */ + /** + * Stream not found + */ 404: { headers: { [name: string]: unknown @@ -433,7 +529,9 @@ export interface paths { 'text/plain': string } } - /** @description Internal server error */ + /** + * Internal server error. + */ 500: { headers: { [name: string]: unknown @@ -453,14 +551,18 @@ export interface paths { query?: never header?: never path: { - /** @description Multibase encoded stream ID */ + /** + * Multibase encoded stream ID + */ stream_id: string } cookie?: never } requestBody?: never responses: { - /** @description cors */ + /** + * Cross-Origin Resource Sharing (CORS) preflight response. + */ 200: { headers: { [name: string]: unknown @@ -486,30 +588,42 @@ export interface paths { post: { parameters: { query?: { - /** @description the controller to register interest for */ + /** + * the controller to register interest for + */ controller?: string - /** @description the stream to register interest for */ + /** + * the stream to register interest for + */ streamId?: string } header?: never path: { - /** @description name of the sort_key */ + /** + * name of the sort_key + */ sort_key: string - /** @description value associated with the sort key */ + /** + * value associated with the sort key + */ sort_value: string } cookie?: never } requestBody?: never responses: { - /** @description success */ + /** + * Successful response. + */ 204: { headers: { [name: string]: unknown } content?: never } - /** @description bad request */ + /** + * Bad request error. + */ 400: { headers: { [name: string]: unknown @@ -518,7 +632,9 @@ export interface paths { 'application/json': components['schemas']['BadRequestResponse'] } } - /** @description Internal server error */ + /** + * Internal server error. + */ 500: { headers: { [name: string]: unknown @@ -536,16 +652,22 @@ export interface paths { query?: never header?: never path: { - /** @description Name of the field in the Events header that holds the separator value e.g. 'model' */ + /** + * Name of the field in the Events header that holds the separator value e.g. 'model' + */ sort_key: string - /** @description The value of the field in the Events header indicated by the separator key e.g. multibase encoded model ID */ + /** + * The value of the field in the Events header indicated by the separator key e.g. multibase encoded model ID + */ sort_value: string } cookie?: never } requestBody?: never responses: { - /** @description cors */ + /** + * Cross-Origin Resource Sharing (CORS) preflight response. + */ 200: { headers: { [name: string]: unknown @@ -577,14 +699,18 @@ export interface paths { } requestBody: components['requestBodies']['Interest'] responses: { - /** @description success */ + /** + * Successful response. + */ 204: { headers: { [name: string]: unknown } content?: never } - /** @description bad request */ + /** + * Bad request error. + */ 400: { headers: { [name: string]: unknown @@ -593,7 +719,9 @@ export interface paths { 'application/json': components['schemas']['BadRequestResponse'] } } - /** @description Internal server error */ + /** + * Internal server error. + */ 500: { headers: { [name: string]: unknown @@ -615,7 +743,9 @@ export interface paths { } requestBody?: never responses: { - /** @description cors */ + /** + * Cross-Origin Resource Sharing (CORS) preflight response. + */ 200: { headers: { [name: string]: unknown @@ -645,7 +775,9 @@ export interface paths { } requestBody?: never responses: { - /** @description success */ + /** + * Successful response. + */ 200: { headers: { [name: string]: unknown @@ -669,7 +801,9 @@ export interface paths { } requestBody?: never responses: { - /** @description cors */ + /** + * Cross-Origin Resource Sharing (CORS) preflight response. + */ 200: { headers: { [name: string]: unknown @@ -693,7 +827,9 @@ export interface paths { get: { parameters: { query?: { - /** @description Only return interests from the specified peer ID. */ + /** + * Only return interests from the specified peer ID. + */ peerId?: string } header?: never @@ -702,7 +838,9 @@ export interface paths { } requestBody?: never responses: { - /** @description success */ + /** + * Successful response. + */ 200: { headers: { [name: string]: unknown @@ -711,7 +849,9 @@ export interface paths { 'application/json': components['schemas']['InterestsGet'] } } - /** @description bad request */ + /** + * Bad request error. + */ 400: { headers: { [name: string]: unknown @@ -720,7 +860,9 @@ export interface paths { 'application/json': components['schemas']['BadRequestResponse'] } } - /** @description Internal server error */ + /** + * Internal server error. + */ 500: { headers: { [name: string]: unknown @@ -738,7 +880,9 @@ export interface paths { options: { parameters: { query?: { - /** @description Only return interests from the specified peer ID. */ + /** + * Only return interests from the specified peer ID. + */ peerId?: string } header?: never @@ -747,7 +891,9 @@ export interface paths { } requestBody?: never responses: { - /** @description cors */ + /** + * Cross-Origin Resource Sharing (CORS) preflight response. + */ 200: { headers: { [name: string]: unknown @@ -771,27 +917,41 @@ export interface paths { get: { parameters: { query?: { - /** @description the controller to filter (DID string) */ + /** + * the controller to filter (DID string) + */ controller?: string - /** @description the stream to filter (multibase encoded stream ID) */ + /** + * the stream to filter (multibase encoded stream ID) + */ streamId?: string - /** @description token that designates the point to resume from, that is find keys added after this point */ + /** + * token that designates the point to resume from, that is find keys added after this point + */ offset?: number - /** @description the maximum number of events to return, default is 10000. */ + /** + * the maximum number of events to return, default is 10000. + */ limit?: number } header?: never path: { - /** @description Name of the field in the Events header that holds the separator value e.g. 'model' */ + /** + * Name of the field in the Events header that holds the separator value e.g. 'model' + */ sep: string - /** @description The value of the field in the Events header indicated by the separator key e.g. multibase encoded model ID */ + /** + * The value of the field in the Events header indicated by the separator key e.g. multibase encoded model ID + */ sepValue: string } cookie?: never } requestBody?: never responses: { - /** @description success */ + /** + * Successful response. + */ 200: { headers: { [name: string]: unknown @@ -800,7 +960,9 @@ export interface paths { 'application/json': components['schemas']['EventsGet'] } } - /** @description bad request */ + /** + * Bad request error. + */ 400: { headers: { [name: string]: unknown @@ -809,7 +971,9 @@ export interface paths { 'application/json': components['schemas']['BadRequestResponse'] } } - /** @description Internal server error */ + /** + * Internal server error. + */ 500: { headers: { [name: string]: unknown @@ -829,16 +993,22 @@ export interface paths { query?: never header?: never path: { - /** @description Name of the field in the Events header that holds the separator value e.g. 'model' */ + /** + * Name of the field in the Events header that holds the separator value e.g. 'model' + */ sep: string - /** @description The value of the field in the Events header indicated by the separator key e.g. multibase encoded model ID */ + /** + * The value of the field in the Events header indicated by the separator key e.g. multibase encoded model ID + */ sepValue: string } cookie?: never } requestBody?: never responses: { - /** @description cors */ + /** + * Cross-Origin Resource Sharing (CORS) preflight response. + */ 200: { headers: { [name: string]: unknown @@ -862,14 +1032,18 @@ export interface paths { get: { parameters: { query?: { - /** @description token that designates the point to resume from, that is find keys added after this point */ + /** + * token that designates the point to resume from, that is find keys added after this point + */ resumeAt?: string - /** @description The maximum number of events to return, default is 100. The max with data is 10000. */ + /** + * The maximum number of events to return, default is 100. The max with data is 10000. + */ limit?: number - /** @description Whether to include the event data (carfile) in the response. In the future, only the payload or other options may be supported: - * * `none` - Empty, only the event ID is returned - * * `full` - The entire event carfile (including the envelope and payload) - * */ + /** Whether to include the event data (carfile) in the response. In the future, only the payload or other options may be supported: + ** `none` - Empty, only the event ID is returned + ** `full` - The entire event carfile (including the envelope and payload) + */ includeData?: 'none' | 'full' } header?: never @@ -878,7 +1052,9 @@ export interface paths { } requestBody?: never responses: { - /** @description success */ + /** + * Successful response. + */ 200: { headers: { [name: string]: unknown @@ -887,7 +1063,9 @@ export interface paths { 'application/json': components['schemas']['EventFeed'] } } - /** @description bad request */ + /** + * Bad request error. + */ 400: { headers: { [name: string]: unknown @@ -896,7 +1074,9 @@ export interface paths { 'application/json': components['schemas']['BadRequestResponse'] } } - /** @description Internal server error */ + /** + * Internal server error. + */ 500: { headers: { [name: string]: unknown @@ -920,7 +1100,9 @@ export interface paths { } requestBody?: never responses: { - /** @description cors */ + /** + * Cross-Origin Resource Sharing (CORS) preflight response. + */ 200: { headers: { [name: string]: unknown @@ -950,7 +1132,9 @@ export interface paths { } requestBody?: never responses: { - /** @description success */ + /** + * Successful response. + */ 200: { headers: { [name: string]: unknown @@ -959,7 +1143,9 @@ export interface paths { 'application/json': components['schemas']['_feed_resumeToken_get_200_response'] } } - /** @description bad request */ + /** + * Bad request error. + */ 400: { headers: { [name: string]: unknown @@ -968,7 +1154,9 @@ export interface paths { 'application/json': components['schemas']['BadRequestResponse'] } } - /** @description Internal server error */ + /** + * Internal server error. + */ 500: { headers: { [name: string]: unknown @@ -992,7 +1180,9 @@ export interface paths { } requestBody?: never responses: { - /** @description cors */ + /** + * Cross-Origin Resource Sharing (CORS) preflight response. + */ 200: { headers: { [name: string]: unknown @@ -1010,51 +1200,60 @@ export type webhooks = Record export interface components { schemas: { /** - * @description Version of the Ceramic node in semver format, e.g. 2.1.0 + * Version of the Ceramic node in semver format, e.g. 2.1.0 * @example { * "version": "version" * } */ Version: { - /** @description Version of the Ceramic node */ + /** + * Version of the Ceramic node + */ version?: string } /** - * Response to a bad request (400) - * @description Bad request (input error) + * Response to a bad request (400) error. */ BadRequestResponse: { - /** @description Message describing the error */ + /** + * Message describing the error + */ message: string } /** * A Ceramic Event - * @description A Ceramic event as part of a Ceramic Stream. Contains both the root CID used to identify the Event as well as the Event payload data. + * A Ceramic event as part of a Ceramic Stream. Contains both the root CID used to identify the Event as well as the Event payload data. * @example { * "data": "data", * "id": "id" * } */ Event: { - /** @description Multibase encoding of event root CID bytes. */ + /** + * Multibase encoding of event root CID bytes. + */ id: string - /** @description Multibase encoding of event data. */ + /** + * Multibase encoding of event data. + */ data?: string } /** * A Ceramic Event Data Payload - * @description The data for a Ceramic event that is part of a Ceramic Stream + * The data for a Ceramic event that is part of a Ceramic Stream * @example { * "data": "data" * } */ EventData: { - /** @description Multibase encoding of event data. */ + /** + * Multibase encoding of event data. + */ data: string } /** * Ceramic Event feed data - * @description Ceramic event keys as part of a Ceramic Stream + * Ceramic event keys as part of a Ceramic Stream * @example { * "resumeToken": "resumeToken", * "events": [ @@ -1070,14 +1269,18 @@ export interface components { * } */ EventFeed: { - /** @description An array of events. For now, the event data payload is empty. */ + /** + * An array of events. For now, the event data payload is empty. + */ events: components['schemas']['Event'][] - /** @description The token/highwater mark to used as resumeAt on a future request */ + /** + * The token/highwater mark to used as resumeAt on a future request + */ resumeToken: string } /** * Information about multiple events. - * @description Ceramic event keys as part of a Ceramic Stream + * Ceramic event keys as part of a Ceramic Stream * @example { * "resumeOffset": 0, * "events": [ @@ -1094,16 +1297,22 @@ export interface components { * } */ EventsGet: { - /** @description An array of events */ + /** + * An array of events + */ events: components['schemas']['Event'][] - /** @description An integer specifying where to resume the request. Only works correctly for the same input parameters. */ + /** + * An integer specifying where to resume the request. Only works correctly for the same input parameters. + */ resumeOffset: number - /** @description A boolean specifying if there are more events to be fetched. Repeat with the resumeOffset to get next set. */ + /** + * A boolean specifying if there are more events to be fetched. Repeat with the resumeOffset to get next set. + */ isComplete: boolean } /** * Information about multiple interests. - * @description Ceramic interest keys + * Ceramic interest keys * @example { * "interests": [ * { @@ -1116,20 +1325,23 @@ export interface components { * } */ InterestsGet: { - /** @description An array of interests */ + /** + * An array of interests + */ interests: components['schemas']['InterestsGet_interests_inner'][] } /** * Error response - * @description Error response */ ErrorResponse: { - /** @description Error message */ + /** + * Error message + */ message: string } /** * A recon interest - * @description Describes a recon interest range to store and synchronize + * Describes a recon interest range to store and synchronize * @example { * "controller": "controller", * "streamId": "streamId", @@ -1138,29 +1350,39 @@ export interface components { * } */ Interest: { - /** @description Separator key, typically 'model' (sometimes called sort_key) */ + /** + * Separator key, typically 'model' (sometimes called sort_key) + */ sep: string - /** @description Multibase encoded separator value (sometimes called sort_value, typically a stream ID) */ + /** + * Multibase encoded separator value (sometimes called sort_value, typically a stream ID) + */ sepValue: string - /** @description Decentralized identifier (DID) string */ + /** + * Decentralized identifier (DID) string + */ controller?: string - /** @description Multibase encoded stream ID. */ + /** + * Multibase encoded stream ID. + */ streamId?: string } /** * Information about the Ceramic network - * @description Ceramic network information + * Ceramic network information * @example { * "name": "name" * } */ NetworkInfo: { - /** @description Name of the Ceramic network */ + /** + * Name of the Ceramic network + */ name: string } /** * State of a Ceramic stream - * @description The state of a Ceramic stream as defined by the stream type aggregation and conflict resolution rules. + * The state of a Ceramic stream as defined by the stream type aggregation and conflict resolution rules. * @example { * "controller": "controller", * "data": "data", @@ -1170,48 +1392,68 @@ export interface components { * } */ StreamState: { - /** @description Multibase encoding of the stream id */ + /** + * Multibase encoding of the stream id + */ id: string - /** @description CID of the event that produced this state */ + /** + * CID of the event that produced this state + */ event_cid: string - /** @description Controller of the stream */ + /** + * Controller of the stream + */ controller: string - /** @description Dimensions of the stream, each value is multibase encoded. */ + /** + * Dimensions of the stream, each value is multibase encoded. + */ dimensions: Record - /** @description Multibase encoding of the data of the stream. Content is stream type specific. */ + /** + * Multibase encoding of the data of the stream. Content is stream type specific. + */ data: string } /** @example { * "resumeToken": "resumeToken" * } */ _feed_resumeToken_get_200_response: { - /** @description The highwater mark/resume token to use with the event/feed endpoint. */ + /** + * The highwater mark/resume token to use with the event/feed endpoint. + */ resumeToken: string } /** @example { * "data": "data" * } */ InterestsGet_interests_inner: { - /** @description The multbase encoded bytes of the interest. */ + /** + * The multbase encoded bytes of the interest. + */ data: string } } responses: never parameters: never requestBodies: { - /** @description Event to add to the node */ + /** + * Event to add to the node + */ EventData: { content: { 'application/json': components['schemas']['EventData'] } } - /** @description Recon message to send */ + /** + * Recon message to send. + */ Message: { content: { 'application/cbor-seq': string } } - /** @description Interest to register on the node */ + /** + * Interest to register on the node + */ Interest: { content: { 'application/json': components['schemas']['Interest'] From f0c51e6e533ebe38c8e07689f07f7053002e5597 Mon Sep 17 00:00:00 2001 From: Mark Krasner Date: Thu, 19 Dec 2024 15:14:41 -0500 Subject: [PATCH 8/8] Typedoc re-generation of package documentation --- docs/@ceramic-sdk/events/README.md | 4 +- .../events/functions/assertSignedEvent.md | 2 +- .../events/functions/assertTimeEvent.md | 2 +- .../events/functions/carFromString.md | 14 +- .../events/functions/carToString.md | 14 +- .../events/functions/createSignedInitEvent.md | 24 +- .../events/functions/decodeMultibaseToJSON.md | 36 +++ .../functions/decodeMultibaseToStreamID.md | 30 +++ .../events/functions/decodeSignedEvent.md | 2 +- .../events/functions/decodeTimeEvent.md | 2 +- .../events/functions/encodeEventToCAR.md | 14 +- .../events/functions/eventFromCAR.md | 16 +- .../events/functions/eventFromString.md | 12 +- .../events/functions/eventToCAR.md | 14 +- .../events/functions/eventToContainer.md | 18 +- .../events/functions/eventToString.md | 12 +- .../events/functions/getSignedEventPayload.md | 20 +- .../events/functions/signEvent.md | 21 +- .../events/functions/signedEventToCAR.md | 13 +- .../functions/signedEventToContainer.md | 21 +- .../functions/unsignedEventToContainer.md | 15 +- .../events/type-aliases/EventContainer.md | 6 +- .../events/type-aliases/InitEventHeader.md | 2 +- .../events/type-aliases/InitEventPayload.md | 2 +- .../type-aliases/PartialInitEventHeader.md | 9 +- .../events/type-aliases/SignedEvent.md | 2 +- .../type-aliases/SignedEventContainer.md | 6 +- .../events/type-aliases/TimeEvent.md | 2 +- .../type-aliases/UnsignedEventContainer.md | 6 +- .../events/variables/InitEventHeader.md | 2 +- .../events/variables/InitEventPayload.md | 2 +- .../events/variables/SignedEvent.md | 2 +- .../events/variables/TimeEvent.md | 2 +- docs/@ceramic-sdk/http-client/README.md | 6 +- .../http-client/classes/CeramicClient.md | 103 ++++++-- .../http-client/functions/getCeramicClient.md | 23 ++ .../http-client/type-aliases/CeramicAPI.md | 2 +- .../http-client/type-aliases/ClientParams.md | 2 +- .../type-aliases/EventsFeedParams.md | 4 +- .../http-client/type-aliases/Schema.md | 2 +- .../http-client/type-aliases/Schemas.md | 2 +- docs/@ceramic-sdk/identifiers/README.md | 2 +- .../identifiers/classes/CommitID.md | 2 +- .../identifiers/classes/StreamID.md | 2 +- .../identifiers/type-aliases/StreamType.md | 2 +- .../type-aliases/StreamTypeCode.md | 2 +- .../type-aliases/StreamTypeName.md | 2 +- .../identifiers/variables/streamIDAsBytes.md | 2 +- .../identifiers/variables/streamIDAsString.md | 2 +- .../identifiers/variables/streamIDString.md | 2 +- docs/@ceramic-sdk/model-client/README.md | 2 +- .../model-client/classes/ModelClient.md | 159 ++++++++++++- .../model-client/functions/createInitEvent.md | 14 +- .../model-instance-client/README.md | 2 +- .../classes/ModelInstanceClient.md | 219 +++++++++++++++++- .../functions/createDataEvent.md | 13 +- .../functions/createDataEventPayload.md | 16 +- .../functions/createInitEvent.md | 15 +- .../functions/getDeterministicInitEvent.md | 12 +- .../getDeterministicInitEventPayload.md | 17 +- .../type-aliases/CreateDataEventParams.md | 10 +- .../type-aliases/CreateInitEventParams.md | 6 +- .../type-aliases/PostDataParams.md | 4 +- .../PostDeterministicInitParams.md | 10 +- .../type-aliases/PostSignedInitParams.md | 4 +- .../type-aliases/UnknownContent.md | 2 +- .../model-instance-handler/README.md | 34 +++ .../functions/assertNoImmutableFieldChange.md | 21 ++ .../functions/assertValidContent.md | 25 ++ .../functions/assertValidInitHeader.md | 25 ++ .../functions/assertValidUniqueValue.md | 21 ++ .../functions/handleDataPayload.md | 19 ++ .../handleDeterministicInitPayload.md | 19 ++ .../functions/handleEvent.md | 19 ++ .../functions/handleInitPayload.md | 19 ++ .../functions/handleTimeEvent.md | 19 ++ .../functions/validateRelation.md | 23 ++ .../functions/validateRelationsContent.md | 21 ++ .../type-aliases/Context.md | 51 ++++ .../type-aliases/DocumentEvent.md | 9 + .../type-aliases/DocumentEventPayload.md | 9 + .../type-aliases/DocumentState.md | 19 ++ .../type-aliases/UnknownContent.md | 9 + .../variables/DocumentEvent.md | 9 + .../variables/DocumentEventPayload.md | 9 + .../model-instance-protocol/README.md | 2 +- .../functions/getDeterministicStreamID.md | 2 +- .../functions/getStreamID.md | 2 +- .../type-aliases/DataInitEventPayload.md | 2 +- .../DeterministicInitEventPayload.md | 2 +- .../type-aliases/DocumentDataEventHeader.md | 2 +- .../type-aliases/DocumentDataEventPayload.md | 2 +- .../type-aliases/DocumentEvent.md | 2 +- .../type-aliases/DocumentInitEventHeader.md | 2 +- .../type-aliases/DocumentInitEventPayload.md | 2 +- .../type-aliases/DocumentMetadata.md | 2 +- .../EncodedDeterministicInitEventPayload.md | 2 +- .../type-aliases/EncodedDocumentMetadata.md | 2 +- .../type-aliases/JSONPatchOperation.md | 2 +- .../variables/DataInitEventPayload.md | 2 +- .../DeterministicInitEventPayload.md | 2 +- .../variables/DocumentDataEventHeader.md | 2 +- .../variables/DocumentDataEventPayload.md | 2 +- .../variables/DocumentEvent.md | 2 +- .../variables/DocumentInitEventHeader.md | 2 +- .../variables/DocumentInitEventPayload.md | 2 +- .../variables/DocumentMetadata.md | 2 +- .../variables/JSONPatchAddOperation.md | 2 +- .../variables/JSONPatchCopyOperation.md | 2 +- .../variables/JSONPatchMoveOperation.md | 2 +- .../variables/JSONPatchOperation.md | 2 +- .../variables/JSONPatchRemoveOperation.md | 2 +- .../variables/JSONPatchReplaceOperation.md | 2 +- .../variables/JSONPatchTestOperation.md | 2 +- .../variables/MAX_DOCUMENT_SIZE.md | 2 +- docs/@ceramic-sdk/model-protocol/README.md | 2 +- .../functions/assertValidModelContent.md | 2 +- .../functions/getModelStreamID.md | 2 +- .../type-aliases/ModelAccountRelation.md | 2 +- .../type-aliases/ModelAccountRelationV2.md | 2 +- .../type-aliases/ModelDefinition.md | 2 +- .../type-aliases/ModelDefinitionV1.md | 2 +- .../type-aliases/ModelDefinitionV2.md | 2 +- .../ModelDocumentMetadataViewDefinition.md | 2 +- .../model-protocol/type-aliases/ModelEvent.md | 2 +- .../type-aliases/ModelEventHeader.md | 2 +- .../type-aliases/ModelInitEventPayload.md | 2 +- .../type-aliases/ModelMetadata.md | 2 +- .../type-aliases/ModelRelationDefinition.md | 2 +- .../type-aliases/ModelRelationDefinitionV2.md | 2 +- .../ModelRelationViewDefinition.md | 2 +- .../ModelRelationViewDefinitionV2.md | 2 +- .../type-aliases/ModelRelationsDefinition.md | 2 +- .../ModelRelationsDefinitionV2.md | 2 +- .../type-aliases/ModelViewDefinition.md | 2 +- .../type-aliases/ModelViewDefinitionV2.md | 2 +- .../type-aliases/ModelViewsDefinition.md | 2 +- .../type-aliases/ModelViewsDefinitionV2.md | 2 +- .../type-aliases/ObjectSchema.md | 2 +- .../model-protocol/type-aliases/SchemaType.md | 2 +- .../type-aliases/ValidVersionSatisfies.md | 2 +- .../model-protocol/variables/MODEL.md | 2 +- .../variables/MODEL_STREAM_ID.md | 2 +- .../variables/ModelAccountRelation.md | 2 +- .../variables/ModelAccountRelationV2.md | 2 +- .../variables/ModelDefinition.md | 2 +- .../variables/ModelDefinitionV1.md | 2 +- .../variables/ModelDefinitionV2.md | 2 +- .../ModelDocumentMetadataViewDefinition.md | 2 +- .../model-protocol/variables/ModelEvent.md | 2 +- .../variables/ModelEventHeader.md | 2 +- .../variables/ModelInitEventPayload.md | 2 +- .../model-protocol/variables/ModelMetadata.md | 2 +- .../variables/ModelRelationDefinition.md | 2 +- .../variables/ModelRelationDefinitionV2.md | 2 +- .../variables/ModelRelationViewDefinition.md | 2 +- .../ModelRelationViewDefinitionV2.md | 2 +- .../variables/ModelRelationsDefinition.md | 2 +- .../variables/ModelRelationsDefinitionV2.md | 2 +- .../variables/ModelViewDefinition.md | 2 +- .../variables/ModelViewDefinitionV2.md | 2 +- .../variables/ModelViewsDefinition.md | 2 +- .../variables/ModelViewsDefinitionV2.md | 2 +- .../model-protocol/variables/ObjectSchema.md | 2 +- .../variables/optionalModelString.md | 2 +- docs/@ceramic-sdk/stream-client/README.md | 3 +- .../stream-client/classes/StreamClient.md | 75 +++++- .../type-aliases/StreamClientParams.md | 2 +- .../stream-client/type-aliases/StreamState.md | 41 ++++ docs/README.md | 17 +- 170 files changed, 1475 insertions(+), 219 deletions(-) create mode 100644 docs/@ceramic-sdk/events/functions/decodeMultibaseToJSON.md create mode 100644 docs/@ceramic-sdk/events/functions/decodeMultibaseToStreamID.md create mode 100644 docs/@ceramic-sdk/http-client/functions/getCeramicClient.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/README.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/functions/assertNoImmutableFieldChange.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/functions/assertValidContent.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/functions/assertValidInitHeader.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/functions/assertValidUniqueValue.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/functions/handleDataPayload.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/functions/handleDeterministicInitPayload.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/functions/handleEvent.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/functions/handleInitPayload.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/functions/handleTimeEvent.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/functions/validateRelation.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/functions/validateRelationsContent.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/type-aliases/Context.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/type-aliases/DocumentEvent.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/type-aliases/DocumentEventPayload.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/type-aliases/DocumentState.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/type-aliases/UnknownContent.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/variables/DocumentEvent.md create mode 100644 docs/@ceramic-sdk/model-instance-handler/variables/DocumentEventPayload.md create mode 100644 docs/@ceramic-sdk/stream-client/type-aliases/StreamState.md diff --git a/docs/@ceramic-sdk/events/README.md b/docs/@ceramic-sdk/events/README.md index d387724..e18f22b 100644 --- a/docs/@ceramic-sdk/events/README.md +++ b/docs/@ceramic-sdk/events/README.md @@ -1,4 +1,4 @@ -**@ceramic-sdk/events v0.1.0** • **Docs** +**@ceramic-sdk/events v0.2.1** • **Docs** *** @@ -31,6 +31,8 @@ - [carFromString](functions/carFromString.md) - [carToString](functions/carToString.md) - [createSignedInitEvent](functions/createSignedInitEvent.md) +- [decodeMultibaseToJSON](functions/decodeMultibaseToJSON.md) +- [decodeMultibaseToStreamID](functions/decodeMultibaseToStreamID.md) - [decodeSignedEvent](functions/decodeSignedEvent.md) - [decodeTimeEvent](functions/decodeTimeEvent.md) - [encodeEventToCAR](functions/encodeEventToCAR.md) diff --git a/docs/@ceramic-sdk/events/functions/assertSignedEvent.md b/docs/@ceramic-sdk/events/functions/assertSignedEvent.md index 3e74028..3a76950 100644 --- a/docs/@ceramic-sdk/events/functions/assertSignedEvent.md +++ b/docs/@ceramic-sdk/events/functions/assertSignedEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/events/functions/assertTimeEvent.md b/docs/@ceramic-sdk/events/functions/assertTimeEvent.md index 57053b7..a6cd99f 100644 --- a/docs/@ceramic-sdk/events/functions/assertTimeEvent.md +++ b/docs/@ceramic-sdk/events/functions/assertTimeEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/events/functions/carFromString.md b/docs/@ceramic-sdk/events/functions/carFromString.md index 548c213..2f52987 100644 --- a/docs/@ceramic-sdk/events/functions/carFromString.md +++ b/docs/@ceramic-sdk/events/functions/carFromString.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,14 +8,24 @@ > **carFromString**(`value`, `base`): `CAR` -Decode a CAR from a string, using the given base (defaults to base64) +Decodes a CAR from a string using the specified base encoding. ## Parameters • **value**: `string` +The string-encoded CAR. + • **base**: `"base64url"` \| `"base256emoji"` \| `"base64"` \| `"base64pad"` \| `"base64urlpad"` \| `"base58btc"` \| `"base58flickr"` \| `"base36"` \| `"base36upper"` \| `"base32"` \| `"base32upper"` \| `"base32pad"` \| `"base32padupper"` \| `"base32hex"` \| `"base32hexupper"` \| `"base32hexpad"` \| `"base32hexpadupper"` \| `"base32z"` \| `"base16"` \| `"base16upper"` \| `"base10"` \| `"base8"` \| `"base2"` \| `"identity"` = `DEFAULT_BASE` +The base encoding used to decode the CAR (defaults to Base64). + ## Returns `CAR` + +The decoded CAR object. + +## Throws + +Will throw an error if the base encoding is not supported. diff --git a/docs/@ceramic-sdk/events/functions/carToString.md b/docs/@ceramic-sdk/events/functions/carToString.md index 1fb000e..d6f4705 100644 --- a/docs/@ceramic-sdk/events/functions/carToString.md +++ b/docs/@ceramic-sdk/events/functions/carToString.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,14 +8,24 @@ > **carToString**(`car`, `base`): `string` -Encode a CAR into a string, using the given base (defaults to base64) +Encodes a CAR into a string using the specified base encoding. ## Parameters • **car**: `CAR` +The CAR to encode. + • **base**: `"base64url"` \| `"base256emoji"` \| `"base64"` \| `"base64pad"` \| `"base64urlpad"` \| `"base58btc"` \| `"base58flickr"` \| `"base36"` \| `"base36upper"` \| `"base32"` \| `"base32upper"` \| `"base32pad"` \| `"base32padupper"` \| `"base32hex"` \| `"base32hexupper"` \| `"base32hexpad"` \| `"base32hexpadupper"` \| `"base32z"` \| `"base16"` \| `"base16upper"` \| `"base10"` \| `"base8"` \| `"base2"` \| `"identity"` = `DEFAULT_BASE` +The base encoding to use (defaults to Base64). + ## Returns `string` + +The string-encoded CAR. + +## Throws + +Will throw an error if the base encoding is not supported. diff --git a/docs/@ceramic-sdk/events/functions/createSignedInitEvent.md b/docs/@ceramic-sdk/events/functions/createSignedInitEvent.md index b4a9a05..eaf49c5 100644 --- a/docs/@ceramic-sdk/events/functions/createSignedInitEvent.md +++ b/docs/@ceramic-sdk/events/functions/createSignedInitEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,7 +8,7 @@ > **createSignedInitEvent**\<`T`\>(`did`, `data`, `header`, `options`?): `Promise`\<[`SignedEvent`](../type-aliases/SignedEvent.md)\> -Create a signed init event using the provided DID, data and header +Creates a signed initialization event using the provided DID, data, and header. ## Type Parameters @@ -18,12 +18,32 @@ Create a signed init event using the provided DID, data and header • **did**: `DID` +The DID instance used to sign the initialization event. + • **data**: `T` +The initialization data to be included in the event. + • **header**: [`PartialInitEventHeader`](../type-aliases/PartialInitEventHeader.md) +The header for the initialization event, with optional controllers. + • **options?**: `CreateJWSOptions` +(Optional) Additional options for creating the JWS. + ## Returns `Promise`\<[`SignedEvent`](../type-aliases/SignedEvent.md)\> + +A promise that resolves to a `SignedEvent` representing the initialization event. + +## Throws + +Will throw an error if the DID is not authenticated. + +## Remarks + +- If `controllers` are not provided in the header, they will be automatically set + based on the DID's parent (if available) or the DID itself. +- The payload is encoded as an `InitEventPayload` before signing. diff --git a/docs/@ceramic-sdk/events/functions/decodeMultibaseToJSON.md b/docs/@ceramic-sdk/events/functions/decodeMultibaseToJSON.md new file mode 100644 index 0000000..f9dd6ba --- /dev/null +++ b/docs/@ceramic-sdk/events/functions/decodeMultibaseToJSON.md @@ -0,0 +1,36 @@ +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/events](../README.md) / decodeMultibaseToJSON + +# Function: decodeMultibaseToJSON() + +> **decodeMultibaseToJSON**\<`T`\>(`value`): `T` + +Decodes a multibase-encoded string into a JSON object. + +## Type Parameters + +• **T** = `Record`\<`string`, `unknown`\> + +The expected shape of the returned JSON object (defaults to `Record`). + +## Parameters + +• **value**: `string` + +The multibase-encoded string to decode. + +## Returns + +`T` + +The decoded JSON object. + +## Example + +```typescript +const json = decodeMultibaseToJSON<{ key: string }>('z1a2b3c...'); +console.log(json.key); // Output: "value" +``` diff --git a/docs/@ceramic-sdk/events/functions/decodeMultibaseToStreamID.md b/docs/@ceramic-sdk/events/functions/decodeMultibaseToStreamID.md new file mode 100644 index 0000000..0828212 --- /dev/null +++ b/docs/@ceramic-sdk/events/functions/decodeMultibaseToStreamID.md @@ -0,0 +1,30 @@ +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/events](../README.md) / decodeMultibaseToStreamID + +# Function: decodeMultibaseToStreamID() + +> **decodeMultibaseToStreamID**(`value`): [`StreamID`](../../identifiers/classes/StreamID.md) + +Decodes a multibase-encoded string into a `StreamID`. + +## Parameters + +• **value**: `string` + +The multibase-encoded string to decode. + +## Returns + +[`StreamID`](../../identifiers/classes/StreamID.md) + +A `StreamID` object representing the decoded value. + +## Example + +```typescript +const streamID = decodeMultibaseToStreamID('z1a2b3c...'); +console.log(streamID.toString()); // Output: StreamID +``` diff --git a/docs/@ceramic-sdk/events/functions/decodeSignedEvent.md b/docs/@ceramic-sdk/events/functions/decodeSignedEvent.md index 9dfbe97..8862a96 100644 --- a/docs/@ceramic-sdk/events/functions/decodeSignedEvent.md +++ b/docs/@ceramic-sdk/events/functions/decodeSignedEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/events/functions/decodeTimeEvent.md b/docs/@ceramic-sdk/events/functions/decodeTimeEvent.md index ded886e..c62bed5 100644 --- a/docs/@ceramic-sdk/events/functions/decodeTimeEvent.md +++ b/docs/@ceramic-sdk/events/functions/decodeTimeEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/events/functions/encodeEventToCAR.md b/docs/@ceramic-sdk/events/functions/encodeEventToCAR.md index 1da15ea..97488ce 100644 --- a/docs/@ceramic-sdk/events/functions/encodeEventToCAR.md +++ b/docs/@ceramic-sdk/events/functions/encodeEventToCAR.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,14 +8,24 @@ > **encodeEventToCAR**(`codec`, `event`): `CAR` -Encode an unsigned event into a CAR using the provided codec +Encodes an unsigned event into a CAR using the provided codec. ## Parameters • **codec**: `Codec`\<`unknown`, `unknown`, `unknown`\> +The codec used to encode the event. + • **event**: `unknown` +The unsigned event to encode. + ## Returns `CAR` + +A CAR object representing the unsigned event. + +## Remarks + +Encodes the event as the root of the CAR file using the specified codec. diff --git a/docs/@ceramic-sdk/events/functions/eventFromCAR.md b/docs/@ceramic-sdk/events/functions/eventFromCAR.md index ffd3728..57869f6 100644 --- a/docs/@ceramic-sdk/events/functions/eventFromCAR.md +++ b/docs/@ceramic-sdk/events/functions/eventFromCAR.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,7 +8,7 @@ > **eventFromCAR**\<`Payload`\>(`decoder`, `car`, `eventCID`?): [`SignedEvent`](../type-aliases/SignedEvent.md) \| `Payload` -Decode an event from a string using the provided codec for unsigned events +Decodes an event from a CAR object using the specified decoder. ## Type Parameters @@ -18,10 +18,22 @@ Decode an event from a string using the provided codec for unsigned events • **decoder**: `Decoder`\<`unknown`, `Payload`\> +The decoder to use for unsigned events. + • **car**: `CAR` +The CAR object containing the event. + • **eventCID?**: `CID`\<`unknown`, `number`, `number`, `Version`\> +(Optional) The CID of the event to decode. + ## Returns [`SignedEvent`](../type-aliases/SignedEvent.md) \| `Payload` + +The decoded event, either a `SignedEvent` or a custom payload. + +## Throws + +Will throw an error if the linked block is missing or decoding fails. diff --git a/docs/@ceramic-sdk/events/functions/eventFromString.md b/docs/@ceramic-sdk/events/functions/eventFromString.md index 41225e4..b6388fc 100644 --- a/docs/@ceramic-sdk/events/functions/eventFromString.md +++ b/docs/@ceramic-sdk/events/functions/eventFromString.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,7 +8,7 @@ > **eventFromString**\<`Payload`\>(`decoder`, `value`, `base`?): [`SignedEvent`](../type-aliases/SignedEvent.md) \| `Payload` -Decode an event from a string using the provided codec for unsigned events and the given base (defaults to base64) +Decodes an event from a string using the specified decoder and base encoding. ## Type Parameters @@ -18,10 +18,18 @@ Decode an event from a string using the provided codec for unsigned events and t • **decoder**: `Decoder`\<`unknown`, `Payload`\> +The decoder to use for unsigned events. + • **value**: `string` +The string-encoded CAR containing the event. + • **base?**: `"base64url"` \| `"base256emoji"` \| `"base64"` \| `"base64pad"` \| `"base64urlpad"` \| `"base58btc"` \| `"base58flickr"` \| `"base36"` \| `"base36upper"` \| `"base32"` \| `"base32upper"` \| `"base32pad"` \| `"base32padupper"` \| `"base32hex"` \| `"base32hexupper"` \| `"base32hexpad"` \| `"base32hexpadupper"` \| `"base32z"` \| `"base16"` \| `"base16upper"` \| `"base10"` \| `"base8"` \| `"base2"` \| `"identity"` +The base encoding used (defaults to Base64). + ## Returns [`SignedEvent`](../type-aliases/SignedEvent.md) \| `Payload` + +The decoded event, either a `SignedEvent` or a custom payload. diff --git a/docs/@ceramic-sdk/events/functions/eventToCAR.md b/docs/@ceramic-sdk/events/functions/eventToCAR.md index 4633702..687ce6c 100644 --- a/docs/@ceramic-sdk/events/functions/eventToCAR.md +++ b/docs/@ceramic-sdk/events/functions/eventToCAR.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,14 +8,24 @@ > **eventToCAR**(`codec`, `event`): `CAR` -Encode an event into a CAR using the provided codec for unsigned events +Encodes an event into a CAR. Supports both signed and unsigned events. ## Parameters • **codec**: `Codec`\<`unknown`, `unknown`, `unknown`\> +The codec used for unsigned events. + • **event**: `unknown` +The event to encode (signed or unsigned). + ## Returns `CAR` + +A CAR object representing the event. + +## Remarks + +Uses `signedEventToCAR` for signed events and `encodeEventToCAR` for unsigned events. diff --git a/docs/@ceramic-sdk/events/functions/eventToContainer.md b/docs/@ceramic-sdk/events/functions/eventToContainer.md index 571fece..07aebdf 100644 --- a/docs/@ceramic-sdk/events/functions/eventToContainer.md +++ b/docs/@ceramic-sdk/events/functions/eventToContainer.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,7 +8,7 @@ > **eventToContainer**\<`Payload`\>(`did`, `codec`, `event`): `Promise`\<[`EventContainer`](../type-aliases/EventContainer.md)\<`Payload`\>\> -Decode a Ceramic event into a container using the provided verifier DID and payload decoder +Decodes a Ceramic event (signed or unsigned) into a container. ## Type Parameters @@ -18,10 +18,24 @@ Decode a Ceramic event into a container using the provided verifier DID and payl • **did**: `DID` +The DID used to verify the event's JWS if it is signed. + • **codec**: `Decoder`\<`unknown`, `Payload`\> +The codec used to decode the event's payload. + • **event**: `unknown` +The Ceramic event to decode (can be signed or unsigned). + ## Returns `Promise`\<[`EventContainer`](../type-aliases/EventContainer.md)\<`Payload`\>\> + +A promise that resolves to an `EventContainer` containing the decoded payload and metadata. + +## Remarks + +- This function determines the type of the event (signed or unsigned) and processes it accordingly. +- For signed events, it verifies the JWS and decodes the payload. +- For unsigned events, it simply decodes the payload. diff --git a/docs/@ceramic-sdk/events/functions/eventToString.md b/docs/@ceramic-sdk/events/functions/eventToString.md index 469f335..a2fd863 100644 --- a/docs/@ceramic-sdk/events/functions/eventToString.md +++ b/docs/@ceramic-sdk/events/functions/eventToString.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,16 +8,24 @@ > **eventToString**(`codec`, `event`, `base`?): `string` -Encode an event into a string using the provided codec for unsigned events and the given base (defaults to base64) +Encodes an event into a string using the specified codec and base encoding. ## Parameters • **codec**: `Codec`\<`unknown`, `unknown`, `unknown`\> +The codec used for unsigned events. + • **event**: `unknown` +The event to encode (signed or unsigned). + • **base?**: `"base64url"` \| `"base256emoji"` \| `"base64"` \| `"base64pad"` \| `"base64urlpad"` \| `"base58btc"` \| `"base58flickr"` \| `"base36"` \| `"base36upper"` \| `"base32"` \| `"base32upper"` \| `"base32pad"` \| `"base32padupper"` \| `"base32hex"` \| `"base32hexupper"` \| `"base32hexpad"` \| `"base32hexpadupper"` \| `"base32z"` \| `"base16"` \| `"base16upper"` \| `"base10"` \| `"base8"` \| `"base2"` \| `"identity"` +The base encoding to use (defaults to Base64). + ## Returns `string` + +The string-encoded CAR representing the event. diff --git a/docs/@ceramic-sdk/events/functions/getSignedEventPayload.md b/docs/@ceramic-sdk/events/functions/getSignedEventPayload.md index 43c7e95..276ce61 100644 --- a/docs/@ceramic-sdk/events/functions/getSignedEventPayload.md +++ b/docs/@ceramic-sdk/events/functions/getSignedEventPayload.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,7 +8,7 @@ > **getSignedEventPayload**\<`Payload`\>(`decoder`, `event`): `Promise`\<`Payload`\> -Decode the payload of a signed event using the provided decoder +Decodes the payload of a signed event using the provided decoder. ## Type Parameters @@ -18,8 +18,24 @@ Decode the payload of a signed event using the provided decoder • **decoder**: `Decoder`\<`unknown`, `Payload`\> +The decoder used to interpret the event's payload. + • **event**: `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> +The signed event containing the payload to decode. + ## Returns `Promise`\<`Payload`\> + +A promise that resolves to the decoded payload. + +## Throws + +Will throw an error if the linked block CID is missing or if decoding fails. + +## Remarks + +- The function reconstructs the block from the event's linked block and CID, + using the DAG-CBOR codec and SHA-256 hasher. +- The payload is decoded using the provided decoder to ensure its validity and type safety. diff --git a/docs/@ceramic-sdk/events/functions/signEvent.md b/docs/@ceramic-sdk/events/functions/signEvent.md index 3c3c3b3..30af01c 100644 --- a/docs/@ceramic-sdk/events/functions/signEvent.md +++ b/docs/@ceramic-sdk/events/functions/signEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,16 +8,33 @@ > **signEvent**(`did`, `payload`, `options`?): `Promise`\<[`SignedEvent`](../type-aliases/SignedEvent.md)\> -Sign an event payload using the provided DID +Signs an event payload using the provided DID. ## Parameters • **did**: `DID` +The DID instance used to sign the payload. + • **payload**: `Record`\<`string`, `unknown`\> +The data to be signed, provided as a key-value map. + • **options?**: `CreateJWSOptions` +(Optional) Additional options for creating the JWS. + ## Returns `Promise`\<[`SignedEvent`](../type-aliases/SignedEvent.md)\> + +A promise that resolves to a `SignedEvent` containing the JWS and linked block. + +## Throws + +Will throw an error if the DID is not authenticated. + +## Remarks + +This function uses the DID's `createDagJWS` method to sign the payload and +returns the signed event, including the linked block as a `Uint8Array`. diff --git a/docs/@ceramic-sdk/events/functions/signedEventToCAR.md b/docs/@ceramic-sdk/events/functions/signedEventToCAR.md index b0c69d3..9c789d8 100644 --- a/docs/@ceramic-sdk/events/functions/signedEventToCAR.md +++ b/docs/@ceramic-sdk/events/functions/signedEventToCAR.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,12 +8,21 @@ > **signedEventToCAR**(`event`): `CAR` -Encode a signed event into a CAR +Encodes a signed event into a CAR format. ## Parameters • **event**: `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> +The signed event to encode. + ## Returns `CAR` + +A CAR object representing the signed event. + +## Remarks + +- Encodes the JWS, linked block, and optional `cacaoBlock` into the CAR. +- Validates block sizes using `restrictBlockSize` to ensure consistency. diff --git a/docs/@ceramic-sdk/events/functions/signedEventToContainer.md b/docs/@ceramic-sdk/events/functions/signedEventToContainer.md index 803763c..8a8c46f 100644 --- a/docs/@ceramic-sdk/events/functions/signedEventToContainer.md +++ b/docs/@ceramic-sdk/events/functions/signedEventToContainer.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,7 +8,7 @@ > **signedEventToContainer**\<`Payload`\>(`did`, `codec`, `event`): `Promise`\<[`SignedEventContainer`](../type-aliases/SignedEventContainer.md)\<`Payload`\>\> -Decode a signed Ceramic event into a container using the provided verifier DID and payload decoder +Decodes a signed Ceramic event into a container. ## Type Parameters @@ -18,10 +18,27 @@ Decode a signed Ceramic event into a container using the provided verifier DID a • **did**: `DID` +The DID used to verify the event's JWS. + • **codec**: `Decoder`\<`unknown`, `Payload`\> +The codec used to decode the event's payload. + • **event**: `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> +The signed Ceramic event to decode. + ## Returns `Promise`\<[`SignedEventContainer`](../type-aliases/SignedEventContainer.md)\<`Payload`\>\> + +A promise that resolves to a `SignedEventContainer` containing the decoded payload and metadata. + +## Throws + +Will throw an error if the linked block CID is missing or if verification fails. + +## Remarks + +- This function verifies the event's JWS and decodes its payload simultaneously. +- It also includes additional metadata such as the verification result and `cacaoBlock` if present. diff --git a/docs/@ceramic-sdk/events/functions/unsignedEventToContainer.md b/docs/@ceramic-sdk/events/functions/unsignedEventToContainer.md index e2f6b87..4691a6f 100644 --- a/docs/@ceramic-sdk/events/functions/unsignedEventToContainer.md +++ b/docs/@ceramic-sdk/events/functions/unsignedEventToContainer.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,7 +8,7 @@ > **unsignedEventToContainer**\<`Payload`\>(`codec`, `event`): [`UnsignedEventContainer`](../type-aliases/UnsignedEventContainer.md)\<`Payload`\> -Decode an unsigned Ceramic event into a container using the provided payload decoder +Decodes an unsigned Ceramic event into a container. ## Type Parameters @@ -18,8 +18,19 @@ Decode an unsigned Ceramic event into a container using the provided payload dec • **codec**: `Decoder`\<`unknown`, `Payload`\> +The codec used to decode the event's payload. + • **event**: `unknown` +The unsigned Ceramic event to decode. + ## Returns [`UnsignedEventContainer`](../type-aliases/UnsignedEventContainer.md)\<`Payload`\> + +An `UnsignedEventContainer` containing the decoded payload. + +## Remarks + +- This function assumes that the event is unsigned and decodes it accordingly. +- Use `eventToContainer` if the event type (signed or unsigned) is unknown. diff --git a/docs/@ceramic-sdk/events/type-aliases/EventContainer.md b/docs/@ceramic-sdk/events/type-aliases/EventContainer.md index 92e0c94..179f683 100644 --- a/docs/@ceramic-sdk/events/type-aliases/EventContainer.md +++ b/docs/@ceramic-sdk/events/type-aliases/EventContainer.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,8 +8,10 @@ > **EventContainer**\<`Payload`\>: [`SignedEventContainer`](SignedEventContainer.md)\<`Payload`\> \| [`UnsignedEventContainer`](UnsignedEventContainer.md)\<`Payload`\> -Container for a Ceramic event, providing additional metadata about the event +A container for a Ceramic event, which can be either signed or unsigned. ## Type Parameters • **Payload** + +The type of the event's payload. diff --git a/docs/@ceramic-sdk/events/type-aliases/InitEventHeader.md b/docs/@ceramic-sdk/events/type-aliases/InitEventHeader.md index ade1e32..276ede9 100644 --- a/docs/@ceramic-sdk/events/type-aliases/InitEventHeader.md +++ b/docs/@ceramic-sdk/events/type-aliases/InitEventHeader.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/events/type-aliases/InitEventPayload.md b/docs/@ceramic-sdk/events/type-aliases/InitEventPayload.md index 2e06894..454a041 100644 --- a/docs/@ceramic-sdk/events/type-aliases/InitEventPayload.md +++ b/docs/@ceramic-sdk/events/type-aliases/InitEventPayload.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/events/type-aliases/PartialInitEventHeader.md b/docs/@ceramic-sdk/events/type-aliases/PartialInitEventHeader.md index 778823e..4a1fced 100644 --- a/docs/@ceramic-sdk/events/type-aliases/PartialInitEventHeader.md +++ b/docs/@ceramic-sdk/events/type-aliases/PartialInitEventHeader.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,8 +8,15 @@ > **PartialInitEventHeader**: `Omit`\<[`InitEventHeader`](InitEventHeader.md), `"controllers"`\> & `object` +A partial version of the initialization event header, with optional controllers. + ## Type declaration ### controllers? > `optional` **controllers**: [`DIDString`] + +## Remarks + +This type is used to allow the creation of initialization events without requiring +the `controllers` field, as it will be injected automatically during the signing process. diff --git a/docs/@ceramic-sdk/events/type-aliases/SignedEvent.md b/docs/@ceramic-sdk/events/type-aliases/SignedEvent.md index 5ae7fc7..bbb1c3d 100644 --- a/docs/@ceramic-sdk/events/type-aliases/SignedEvent.md +++ b/docs/@ceramic-sdk/events/type-aliases/SignedEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/events/type-aliases/SignedEventContainer.md b/docs/@ceramic-sdk/events/type-aliases/SignedEventContainer.md index c9700e3..5717e99 100644 --- a/docs/@ceramic-sdk/events/type-aliases/SignedEventContainer.md +++ b/docs/@ceramic-sdk/events/type-aliases/SignedEventContainer.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,12 +8,14 @@ > **SignedEventContainer**\<`Payload`\>: `object` -Container for a signed Ceramic event +A container for a signed Ceramic event. ## Type Parameters • **Payload** +The type of the event's payload. + ## Type declaration ### cacaoBlock? diff --git a/docs/@ceramic-sdk/events/type-aliases/TimeEvent.md b/docs/@ceramic-sdk/events/type-aliases/TimeEvent.md index d6b9124..bf27711 100644 --- a/docs/@ceramic-sdk/events/type-aliases/TimeEvent.md +++ b/docs/@ceramic-sdk/events/type-aliases/TimeEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/events/type-aliases/UnsignedEventContainer.md b/docs/@ceramic-sdk/events/type-aliases/UnsignedEventContainer.md index 55d0ca5..11a1b38 100644 --- a/docs/@ceramic-sdk/events/type-aliases/UnsignedEventContainer.md +++ b/docs/@ceramic-sdk/events/type-aliases/UnsignedEventContainer.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** @@ -8,12 +8,14 @@ > **UnsignedEventContainer**\<`Payload`\>: `object` -Container for an unsigned Ceramic event +A container for an unsigned Ceramic event. ## Type Parameters • **Payload** +The type of the event's payload. + ## Type declaration ### payload diff --git a/docs/@ceramic-sdk/events/variables/InitEventHeader.md b/docs/@ceramic-sdk/events/variables/InitEventHeader.md index 4f9e752..5f1c938 100644 --- a/docs/@ceramic-sdk/events/variables/InitEventHeader.md +++ b/docs/@ceramic-sdk/events/variables/InitEventHeader.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/events/variables/InitEventPayload.md b/docs/@ceramic-sdk/events/variables/InitEventPayload.md index 1014d6a..5dd4ea8 100644 --- a/docs/@ceramic-sdk/events/variables/InitEventPayload.md +++ b/docs/@ceramic-sdk/events/variables/InitEventPayload.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/events/variables/SignedEvent.md b/docs/@ceramic-sdk/events/variables/SignedEvent.md index 2e65a57..3760168 100644 --- a/docs/@ceramic-sdk/events/variables/SignedEvent.md +++ b/docs/@ceramic-sdk/events/variables/SignedEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/events/variables/TimeEvent.md b/docs/@ceramic-sdk/events/variables/TimeEvent.md index 49adecb..23b7564 100644 --- a/docs/@ceramic-sdk/events/variables/TimeEvent.md +++ b/docs/@ceramic-sdk/events/variables/TimeEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/events v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/events v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/http-client/README.md b/docs/@ceramic-sdk/http-client/README.md index 3993fec..5b80e09 100644 --- a/docs/@ceramic-sdk/http-client/README.md +++ b/docs/@ceramic-sdk/http-client/README.md @@ -1,4 +1,4 @@ -**@ceramic-sdk/http-client v0.1.0** • **Docs** +**@ceramic-sdk/http-client v0.2.1** • **Docs** *** @@ -17,3 +17,7 @@ - [EventsFeedParams](type-aliases/EventsFeedParams.md) - [Schema](type-aliases/Schema.md) - [Schemas](type-aliases/Schemas.md) + +## Functions + +- [getCeramicClient](functions/getCeramicClient.md) diff --git a/docs/@ceramic-sdk/http-client/classes/CeramicClient.md b/docs/@ceramic-sdk/http-client/classes/CeramicClient.md index 686014b..ff64143 100644 --- a/docs/@ceramic-sdk/http-client/classes/CeramicClient.md +++ b/docs/@ceramic-sdk/http-client/classes/CeramicClient.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/http-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/http-client v0.2.1**](../README.md) • **Docs** *** @@ -6,16 +6,25 @@ # Class: CeramicClient +Represents an HTTP client for interacting with the Ceramic One server. + +This class provides methods for working with Ceramic events, including fetching, decoding, and posting events. +It also supports retrieving server metadata and managing stream interests. + ## Constructors ### new CeramicClient() > **new CeramicClient**(`params`): [`CeramicClient`](CeramicClient.md) +Creates a new instance of `CeramicClient`. + #### Parameters • **params**: [`ClientParams`](../type-aliases/ClientParams.md) +Configuration options for initializing the client. + #### Returns [`CeramicClient`](CeramicClient.md) @@ -26,12 +35,14 @@ > `get` **api**(): `Client`\<`paths`, \`$\{string\}/$\{string\}\`\> -OpenAPI client used internally, provides low-level access to the HTTP APIs exposed by the Ceramic One server +Retrieves the OpenAPI client instance. #### Returns `Client`\<`paths`, \`$\{string\}/$\{string\}\`\> +The internal OpenAPI client used for making HTTP requests. + #### Defined in ## Methods @@ -40,94 +51,110 @@ OpenAPI client used internally, provides low-level access to the HTTP APIs expos > **getEvent**(`id`): `Promise`\<`object`\> -Get the raw event response for the given event CID +Fetches a raw event response by its unique event CID. #### Parameters • **id**: `string` +The unique identifier (CID) of the event to fetch. + #### Returns `Promise`\<`object`\> +A Promise that resolves to the event schema. + ##### data? > `optional` **data**: `string` -###### Description - Multibase encoding of event data. ##### id > **id**: `string` -###### Description - Multibase encoding of event root CID bytes. +#### Throws + +Will throw an error if the request fails or the server returns an error. + *** ### getEventCAR() > **getEventCAR**(`id`): `Promise`\<`CAR`\> -Get the CAR-encoded event for the given event CID +Fetches the CAR-encoded event for a given event CID. #### Parameters • **id**: `string` +The unique identifier (CID) of the event. + #### Returns `Promise`\<`CAR`\> +A Promise that resolves to a CAR object representing the event. + *** ### getEventData() > **getEventData**(`id`): `Promise`\<`string`\> -Get the string-encoded event for the given event CID +Fetches the string-encoded event data for a given event CID. #### Parameters • **id**: `string` +The unique identifier (CID) of the event to fetch. + #### Returns `Promise`\<`string`\> +A Promise that resolves to the event's string data. + +#### Throws + +Will throw an error if the event data is missing. + *** ### getEventsFeed() > **getEventsFeed**(`params`): `Promise`\<`object`\> -Get the events feed based on the given parameters +Retrieves the events feed based on provided parameters. #### Parameters • **params**: [`EventsFeedParams`](../type-aliases/EventsFeedParams.md) = `{}` +Options for paginated feeds, including resume tokens and limits. + #### Returns `Promise`\<`object`\> +A Promise that resolves to the events feed schema. + ##### events > **events**: `object`[] -###### Description - An array of events. For now, the event data payload is empty. ##### resumeToken > **resumeToken**: `string` -###### Description - The token/highwater mark to used as resumeAt on a future request *** @@ -136,7 +163,7 @@ The token/highwater mark to used as resumeAt on a future request > **getEventType**\<`Payload`\>(`decoder`, `id`): `Promise`\<`Payload` \| `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\>\> -Get the decoded event for the given decoder and event CID +Decodes and retrieves a specific event type using the provided decoder. #### Type Parameters @@ -146,30 +173,36 @@ Get the decoded event for the given decoder and event CID • **decoder**: `Decoder`\<`unknown`, `Payload`\> +The decoder used to interpret the event data. + • **id**: `string` +The unique identifier (CID) of the event. + #### Returns `Promise`\<`Payload` \| `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\>\> +A Promise that resolves to the decoded event payload or a signed event. + *** ### getVersion() > **getVersion**(): `Promise`\<`object`\> -Get information about the Ceramic One server version +Retrieves the version information of the Ceramic One server. #### Returns `Promise`\<`object`\> +A Promise that resolves to the server version schema. + ##### version? > `optional` **version**: `string` -###### Description - Version of the Ceramic node *** @@ -178,62 +211,88 @@ Version of the Ceramic node > **postEvent**(`data`): `Promise`\<`void`\> -Post a string-encoded event to the server +Posts a string-encoded event to the server. #### Parameters • **data**: `string` +The string-encoded event data to post. + #### Returns `Promise`\<`void`\> +A Promise that resolves when the request completes. + +#### Throws + +Will throw an error if the request fails. + *** ### postEventCAR() > **postEventCAR**(`car`): `Promise`\<`CID`\<`unknown`, `number`, `number`, `Version`\>\> -Post a CAR-encoded event to the server +Posts a CAR-encoded event to the server. #### Parameters • **car**: `CAR` +The CAR object representing the event. + #### Returns `Promise`\<`CID`\<`unknown`, `number`, `number`, `Version`\>\> +A Promise that resolves to the CID of the posted event. + *** ### postEventType() > **postEventType**(`codec`, `event`): `Promise`\<`CID`\<`unknown`, `number`, `number`, `Version`\>\> -Encode and post an event to the server +Encodes and posts an event using a specified codec. #### Parameters • **codec**: `Codec`\<`unknown`, `unknown`, `unknown`\> +The codec used to encode the event. + • **event**: `unknown` +The event data to encode and post (must be compatible with the codec). + #### Returns `Promise`\<`CID`\<`unknown`, `number`, `number`, `Version`\>\> +A Promise that resolves to the CID of the posted event. + *** ### registerInterestModel() > **registerInterestModel**(`model`): `Promise`\<`void`\> -Register interest in streams using the given model stream ID +Registers interest in a model stream using its model stream ID. #### Parameters • **model**: `string` +The stream ID of the model to register interest in. + #### Returns `Promise`\<`void`\> + +A Promise that resolves when the request completes. + +#### Throws + +Will throw an error if the request fails. diff --git a/docs/@ceramic-sdk/http-client/functions/getCeramicClient.md b/docs/@ceramic-sdk/http-client/functions/getCeramicClient.md new file mode 100644 index 0000000..12cdc65 --- /dev/null +++ b/docs/@ceramic-sdk/http-client/functions/getCeramicClient.md @@ -0,0 +1,23 @@ +[**@ceramic-sdk/http-client v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/http-client](../README.md) / getCeramicClient + +# Function: getCeramicClient() + +> **getCeramicClient**(`ceramic`): [`CeramicClient`](../classes/CeramicClient.md) + +Internal utility function to retrieve or initialize a Ceramic client. + +## Parameters + +• **ceramic**: `string` \| [`CeramicClient`](../classes/CeramicClient.md) + +Either a Ceramic client instance or a Ceramic server URL. + +## Returns + +[`CeramicClient`](../classes/CeramicClient.md) + +A Ceramic client instance. diff --git a/docs/@ceramic-sdk/http-client/type-aliases/CeramicAPI.md b/docs/@ceramic-sdk/http-client/type-aliases/CeramicAPI.md index c79aa18..d401dcd 100644 --- a/docs/@ceramic-sdk/http-client/type-aliases/CeramicAPI.md +++ b/docs/@ceramic-sdk/http-client/type-aliases/CeramicAPI.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/http-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/http-client v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/http-client/type-aliases/ClientParams.md b/docs/@ceramic-sdk/http-client/type-aliases/ClientParams.md index e7744dc..fae4bf3 100644 --- a/docs/@ceramic-sdk/http-client/type-aliases/ClientParams.md +++ b/docs/@ceramic-sdk/http-client/type-aliases/ClientParams.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/http-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/http-client v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/http-client/type-aliases/EventsFeedParams.md b/docs/@ceramic-sdk/http-client/type-aliases/EventsFeedParams.md index a47d959..b4baeea 100644 --- a/docs/@ceramic-sdk/http-client/type-aliases/EventsFeedParams.md +++ b/docs/@ceramic-sdk/http-client/type-aliases/EventsFeedParams.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/http-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/http-client v0.2.1**](../README.md) • **Docs** *** @@ -20,4 +20,4 @@ Maximum number of events to return in response > `optional` **resumeAt**: `string` -Resume token +Resume token for paginated feeds diff --git a/docs/@ceramic-sdk/http-client/type-aliases/Schema.md b/docs/@ceramic-sdk/http-client/type-aliases/Schema.md index 0714ad8..43e60f4 100644 --- a/docs/@ceramic-sdk/http-client/type-aliases/Schema.md +++ b/docs/@ceramic-sdk/http-client/type-aliases/Schema.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/http-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/http-client v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/http-client/type-aliases/Schemas.md b/docs/@ceramic-sdk/http-client/type-aliases/Schemas.md index 446b462..3e15965 100644 --- a/docs/@ceramic-sdk/http-client/type-aliases/Schemas.md +++ b/docs/@ceramic-sdk/http-client/type-aliases/Schemas.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/http-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/http-client v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/identifiers/README.md b/docs/@ceramic-sdk/identifiers/README.md index 128a66e..2340c6b 100644 --- a/docs/@ceramic-sdk/identifiers/README.md +++ b/docs/@ceramic-sdk/identifiers/README.md @@ -1,4 +1,4 @@ -**@ceramic-sdk/identifiers v0.1.0** • **Docs** +**@ceramic-sdk/identifiers v0.2.0** • **Docs** *** diff --git a/docs/@ceramic-sdk/identifiers/classes/CommitID.md b/docs/@ceramic-sdk/identifiers/classes/CommitID.md index 6a02ee9..1a51d53 100644 --- a/docs/@ceramic-sdk/identifiers/classes/CommitID.md +++ b/docs/@ceramic-sdk/identifiers/classes/CommitID.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/identifiers v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/identifiers v0.2.0**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/identifiers/classes/StreamID.md b/docs/@ceramic-sdk/identifiers/classes/StreamID.md index 8ac9c40..b3a3318 100644 --- a/docs/@ceramic-sdk/identifiers/classes/StreamID.md +++ b/docs/@ceramic-sdk/identifiers/classes/StreamID.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/identifiers v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/identifiers v0.2.0**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/identifiers/type-aliases/StreamType.md b/docs/@ceramic-sdk/identifiers/type-aliases/StreamType.md index acaecfa..9b505e1 100644 --- a/docs/@ceramic-sdk/identifiers/type-aliases/StreamType.md +++ b/docs/@ceramic-sdk/identifiers/type-aliases/StreamType.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/identifiers v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/identifiers v0.2.0**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/identifiers/type-aliases/StreamTypeCode.md b/docs/@ceramic-sdk/identifiers/type-aliases/StreamTypeCode.md index fd03306..c5f4f99 100644 --- a/docs/@ceramic-sdk/identifiers/type-aliases/StreamTypeCode.md +++ b/docs/@ceramic-sdk/identifiers/type-aliases/StreamTypeCode.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/identifiers v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/identifiers v0.2.0**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/identifiers/type-aliases/StreamTypeName.md b/docs/@ceramic-sdk/identifiers/type-aliases/StreamTypeName.md index 6b66988..d8445df 100644 --- a/docs/@ceramic-sdk/identifiers/type-aliases/StreamTypeName.md +++ b/docs/@ceramic-sdk/identifiers/type-aliases/StreamTypeName.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/identifiers v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/identifiers v0.2.0**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/identifiers/variables/streamIDAsBytes.md b/docs/@ceramic-sdk/identifiers/variables/streamIDAsBytes.md index 2635326..5cd1786 100644 --- a/docs/@ceramic-sdk/identifiers/variables/streamIDAsBytes.md +++ b/docs/@ceramic-sdk/identifiers/variables/streamIDAsBytes.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/identifiers v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/identifiers v0.2.0**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/identifiers/variables/streamIDAsString.md b/docs/@ceramic-sdk/identifiers/variables/streamIDAsString.md index 4470f2b..7d91098 100644 --- a/docs/@ceramic-sdk/identifiers/variables/streamIDAsString.md +++ b/docs/@ceramic-sdk/identifiers/variables/streamIDAsString.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/identifiers v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/identifiers v0.2.0**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/identifiers/variables/streamIDString.md b/docs/@ceramic-sdk/identifiers/variables/streamIDString.md index 2b12bd6..8924f60 100644 --- a/docs/@ceramic-sdk/identifiers/variables/streamIDString.md +++ b/docs/@ceramic-sdk/identifiers/variables/streamIDString.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/identifiers v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/identifiers v0.2.0**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-client/README.md b/docs/@ceramic-sdk/model-client/README.md index f48a621..a38319f 100644 --- a/docs/@ceramic-sdk/model-client/README.md +++ b/docs/@ceramic-sdk/model-client/README.md @@ -1,4 +1,4 @@ -**@ceramic-sdk/model-client v0.1.0** • **Docs** +**@ceramic-sdk/model-client v0.2.1** • **Docs** *** diff --git a/docs/@ceramic-sdk/model-client/classes/ModelClient.md b/docs/@ceramic-sdk/model-client/classes/ModelClient.md index 97e303a..bfa4fdb 100644 --- a/docs/@ceramic-sdk/model-client/classes/ModelClient.md +++ b/docs/@ceramic-sdk/model-client/classes/ModelClient.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-client v0.2.1**](../README.md) • **Docs** *** @@ -6,6 +6,12 @@ # Class: ModelClient +Represents a client for interacting with Ceramic models. + +The `ModelClient` class extends the `StreamClient` class to provide additional +methods specific to working with Ceramic models, including fetching and posting +model definitions, retrieving initialization events, and decoding stream data. + ## Extends - [`StreamClient`](../../stream-client/classes/StreamClient.md) @@ -16,10 +22,14 @@ > **new ModelClient**(`params`): [`ModelClient`](ModelClient.md) +Creates a new instance of `StreamClient`. + #### Parameters • **params**: [`StreamClientParams`](../../stream-client/type-aliases/StreamClientParams.md) +Configuration object containing parameters for initializing the StreamClient. + #### Returns [`ModelClient`](ModelClient.md) @@ -34,12 +44,16 @@ > `get` **ceramic**(): [`CeramicClient`](../../http-client/classes/CeramicClient.md) -Ceramic HTTP client instance used to interact with Ceramic One server +Retrieves the Ceramic HTTP client instance used to interact with the Ceramic server. + +This client is essential for executing API requests to fetch stream data. #### Returns [`CeramicClient`](../../http-client/classes/CeramicClient.md) +The `CeramicClient` instance associated with this StreamClient. + #### Inherited from [`StreamClient`](../../stream-client/classes/StreamClient.md).[`ceramic`](../../stream-client/classes/StreamClient.md#ceramic) @@ -52,68 +66,201 @@ Ceramic HTTP client instance used to interact with Ceramic One server > **getDID**(`provided`?): `DID` -Utility method used to access the provided DID or the one attached to the instance, throws if neither is provided +Retrieves a Decentralized Identifier (DID). + +This method provides access to a DID, which is required for authentication or event signing operations. +The caller can optionally provide a DID; if none is provided, the instance's DID is used instead. #### Parameters • **provided?**: `DID` +An optional DID object to use. If not supplied, the instance's DID is returned. + #### Returns `DID` +The DID object, either provided or attached to the instance. + +#### Throws + +Will throw an error if neither a provided DID nor an instance DID is available. + +#### Example + +```typescript +const did = client.getDID(); +console.log(did.id); // Outputs the DID identifier +``` + #### Inherited from [`StreamClient`](../../stream-client/classes/StreamClient.md).[`getDID`](../../stream-client/classes/StreamClient.md#getdid) *** +### getDocumentModel() + +> **getDocumentModel**(`streamID`): `Promise`\<`string`\> + +Retrieves the stringified model stream ID from a model instance document stream ID. + +#### Parameters + +• **streamID**: `string` \| [`StreamID`](../../identifiers/classes/StreamID.md) + +The document stream ID, either as a `StreamID` object or string. + +#### Returns + +`Promise`\<`string`\> + +A promise that resolves to the stringified model stream ID. + +#### Throws + +Will throw an error if the stream ID or its state is invalid. + +*** + ### getInitEvent() > **getInitEvent**(`streamID`): `Promise`\<`MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\>\> -Get the signed init event of a Model based on its stream ID +Retrieves the signed initialization event of a model based on its stream ID. #### Parameters • **streamID**: `string` \| [`StreamID`](../../identifiers/classes/StreamID.md) +The stream ID of the model, either as a `StreamID` object or string. + #### Returns `Promise`\<`MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\>\> +A promise that resolves to the `SignedEvent` for the model. + +#### Throws + +Will throw an error if the stream ID is invalid or the request fails. + +*** + +### getModelDefinition() + +> **getModelDefinition**(`streamID`): `Promise`\<`MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> \| `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\>\> + +Retrieves a model's JSON definition based on the model's stream ID. + +#### Parameters + +• **streamID**: `string` \| [`StreamID`](../../identifiers/classes/StreamID.md) + +The stream ID of the model, either as a `StreamID` object or string. + +#### Returns + +`Promise`\<`MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> \| `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\>\> + +A promise that resolves to the `ModelDefinition` for the specified model. + +#### Throws + +Will throw an error if the stream ID is invalid or the data cannot be decoded. + *** ### getPayload() > **getPayload**(`streamID`, `verifier`?): `Promise`\<`MapIn`\<`object`, `$TypeOf`\>\> -Get the init event payload of a Model based on its stream ID +Retrieves the payload of the initialization event for a model based on its stream ID. #### Parameters • **streamID**: `string` \| [`StreamID`](../../identifiers/classes/StreamID.md) +The stream ID of the model, either as a `StreamID` object or string. + • **verifier?**: `DID` +(Optional) A `DID` instance for verifying the event payload. + #### Returns `Promise`\<`MapIn`\<`object`, `$TypeOf`\>\> +A promise that resolves to the `ModelInitEventPayload`. + +#### Throws + +Will throw an error if the event or payload is invalid or verification fails. + +*** + +### getStreamState() + +> **getStreamState**(`streamId`): `Promise`\<[`StreamState`](../../stream-client/type-aliases/StreamState.md)\> + +Fetches the current stream state of a specific stream by its ID. + +This method interacts with the Ceramic HTTP API to retrieve the state of a stream. +The stream ID can either be a multibase-encoded string or a `StreamID` object. + +#### Parameters + +• **streamId**: `string` \| [`StreamID`](../../identifiers/classes/StreamID.md) + +The unique identifier of the stream to fetch. + - Can be a multibase-encoded string or a `StreamID` object. + +#### Returns + +`Promise`\<[`StreamState`](../../stream-client/type-aliases/StreamState.md)\> + +A Promise that resolves to the `StreamState` object, representing the current state of the stream. + +#### Throws + +Will throw an error if the API request fails or returns an error response (if stream is not found). + +#### Example + +```typescript +const streamState = await client.getStreamState('kjzl6cwe1...'); +console.log(streamState); +``` + +#### Inherited from + +[`StreamClient`](../../stream-client/classes/StreamClient.md).[`getStreamState`](../../stream-client/classes/StreamClient.md#getstreamstate) + *** ### postDefinition() > **postDefinition**(`definition`, `signer`?): `Promise`\<[`StreamID`](../../identifiers/classes/StreamID.md)\> -Post a Model definition and return its stream ID +Posts a model definition and returns the resulting stream ID. #### Parameters • **definition**: `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> \| `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> +The model JSON definition to post. + • **signer?**: `DID` +(Optional) A `DID` instance for signing the model definition. + #### Returns `Promise`\<[`StreamID`](../../identifiers/classes/StreamID.md)\> + +A promise that resolves to the `StreamID` of the posted model. + +#### Throws + +Will throw an error if the definition is invalid or the signing process fails. diff --git a/docs/@ceramic-sdk/model-client/functions/createInitEvent.md b/docs/@ceramic-sdk/model-client/functions/createInitEvent.md index b53cb5f..d2ceb7a 100644 --- a/docs/@ceramic-sdk/model-client/functions/createInitEvent.md +++ b/docs/@ceramic-sdk/model-client/functions/createInitEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-client v0.2.1**](../README.md) • **Docs** *** @@ -8,14 +8,24 @@ > **createInitEvent**(`did`, `data`): `Promise`\<[`SignedEvent`](../../events/type-aliases/SignedEvent.md)\> -Create a signed init event for a model using the provided DID and model definition +Creates a signed initialization event for a model using the provided DID and model definition. ## Parameters • **did**: `DID` +The Decentralized Identifier (DID) to sign the initialization event. + • **data**: `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> \| `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> +The model definition to be signed. + ## Returns `Promise`\<[`SignedEvent`](../../events/type-aliases/SignedEvent.md)\> + +A promise that resolves to a `SignedEvent` representing the initialization event. + +## Throws + +Will throw an error if the model content is invalid or the DID is not authenticated. diff --git a/docs/@ceramic-sdk/model-instance-client/README.md b/docs/@ceramic-sdk/model-instance-client/README.md index c89c725..776feee 100644 --- a/docs/@ceramic-sdk/model-instance-client/README.md +++ b/docs/@ceramic-sdk/model-instance-client/README.md @@ -1,4 +1,4 @@ -**@ceramic-sdk/model-instance-client v0.1.0** • **Docs** +**@ceramic-sdk/model-instance-client v0.2.1** • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-client/classes/ModelInstanceClient.md b/docs/@ceramic-sdk/model-instance-client/classes/ModelInstanceClient.md index fd2faaa..8d04282 100644 --- a/docs/@ceramic-sdk/model-instance-client/classes/ModelInstanceClient.md +++ b/docs/@ceramic-sdk/model-instance-client/classes/ModelInstanceClient.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-client v0.2.1**](../README.md) • **Docs** *** @@ -6,6 +6,13 @@ # Class: ModelInstanceClient +Extends the StreamClient to add functionality for interacting with Ceramic model instance documents. + +The `ModelInstanceClient` class provides methods to: +- Retrieve events and document states +- Post deterministic and signed initialization events +- Update existing documents with new content + ## Extends - [`StreamClient`](../../stream-client/classes/StreamClient.md) @@ -16,10 +23,14 @@ > **new ModelInstanceClient**(`params`): [`ModelInstanceClient`](ModelInstanceClient.md) +Creates a new instance of `StreamClient`. + #### Parameters • **params**: [`StreamClientParams`](../../stream-client/type-aliases/StreamClientParams.md) +Configuration object containing parameters for initializing the StreamClient. + #### Returns [`ModelInstanceClient`](ModelInstanceClient.md) @@ -34,12 +45,16 @@ > `get` **ceramic**(): [`CeramicClient`](../../http-client/classes/CeramicClient.md) -Ceramic HTTP client instance used to interact with Ceramic One server +Retrieves the Ceramic HTTP client instance used to interact with the Ceramic server. + +This client is essential for executing API requests to fetch stream data. #### Returns [`CeramicClient`](../../http-client/classes/CeramicClient.md) +The `CeramicClient` instance associated with this StreamClient. + #### Inherited from [`StreamClient`](../../stream-client/classes/StreamClient.md).[`ceramic`](../../stream-client/classes/StreamClient.md#ceramic) @@ -48,47 +63,160 @@ Ceramic HTTP client instance used to interact with Ceramic One server ## Methods +### getCurrentID() + +> **getCurrentID**(`streamID`): [`CommitID`](../../identifiers/classes/CommitID.md) + +Retrieves the `CommitID` for the provided stream ID. + +#### Parameters + +• **streamID**: `string` + +The stream ID string. + +#### Returns + +[`CommitID`](../../identifiers/classes/CommitID.md) + +The `CommitID` for the stream. + +*** + ### getDID() > **getDID**(`provided`?): `DID` -Utility method used to access the provided DID or the one attached to the instance, throws if neither is provided +Retrieves a Decentralized Identifier (DID). + +This method provides access to a DID, which is required for authentication or event signing operations. +The caller can optionally provide a DID; if none is provided, the instance's DID is used instead. #### Parameters • **provided?**: `DID` +An optional DID object to use. If not supplied, the instance's DID is returned. + #### Returns `DID` +The DID object, either provided or attached to the instance. + +#### Throws + +Will throw an error if neither a provided DID nor an instance DID is available. + +#### Example + +```typescript +const did = client.getDID(); +console.log(did.id); // Outputs the DID identifier +``` + #### Inherited from [`StreamClient`](../../stream-client/classes/StreamClient.md).[`getDID`](../../stream-client/classes/StreamClient.md#getdid) *** +### getDocumentState() + +> **getDocumentState**(`streamID`): `Promise`\<`DocumentState`\> + +Retrieves the document state for a given stream ID. + +#### Parameters + +• **streamID**: `string` \| [`StreamID`](../../identifiers/classes/StreamID.md) + +The stream ID, either as a `StreamID` object or string. + +#### Returns + +`Promise`\<`DocumentState`\> + +A promise that resolves to the `DocumentState`. + +#### Throws + +Will throw an error if the stream ID is invalid or the request fails. + +#### Remarks + +This method fetches the stream state using the extended StreamClient's `getStreamState` method. + +*** + ### getEvent() > **getEvent**(`commitID`): `Promise`\<`MapIn`\<`RequiredProps`\<`object`\>, `$OutputOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$OutputOf`\> \| `MapIn`\<`RequiredProps`\<`object`\>, `$OutputOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$OutputOf`\> \| `MapIn`\<`object`, `$OutputOf`\>\> -Get a DocumentEvent based on its commit ID +Retrieves a `DocumentEvent` based on its commit ID. #### Parameters • **commitID**: `string` \| [`CommitID`](../../identifiers/classes/CommitID.md) +The commit ID of the event, either as a `CommitID` object or string. + #### Returns `Promise`\<`MapIn`\<`RequiredProps`\<`object`\>, `$OutputOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$OutputOf`\> \| `MapIn`\<`RequiredProps`\<`object`\>, `$OutputOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$OutputOf`\> \| `MapIn`\<`object`, `$OutputOf`\>\> +A promise that resolves to the `DocumentEvent` for the specified commit ID. + +#### Throws + +Will throw an error if the commit ID is invalid or the request fails. + +*** + +### getStreamState() + +> **getStreamState**(`streamId`): `Promise`\<[`StreamState`](../../stream-client/type-aliases/StreamState.md)\> + +Fetches the current stream state of a specific stream by its ID. + +This method interacts with the Ceramic HTTP API to retrieve the state of a stream. +The stream ID can either be a multibase-encoded string or a `StreamID` object. + +#### Parameters + +• **streamId**: `string` \| [`StreamID`](../../identifiers/classes/StreamID.md) + +The unique identifier of the stream to fetch. + - Can be a multibase-encoded string or a `StreamID` object. + +#### Returns + +`Promise`\<[`StreamState`](../../stream-client/type-aliases/StreamState.md)\> + +A Promise that resolves to the `StreamState` object, representing the current state of the stream. + +#### Throws + +Will throw an error if the API request fails or returns an error response (if stream is not found). + +#### Example + +```typescript +const streamState = await client.getStreamState('kjzl6cwe1...'); +console.log(streamState); +``` + +#### Inherited from + +[`StreamClient`](../../stream-client/classes/StreamClient.md).[`getStreamState`](../../stream-client/classes/StreamClient.md#getstreamstate) + *** ### postData() > **postData**\<`T`\>(`params`): `Promise`\<[`CommitID`](../../identifiers/classes/CommitID.md)\> -Post a data event and return its commit ID +Posts a data event and returns its commit ID. #### Type Parameters @@ -98,33 +226,52 @@ Post a data event and return its commit ID • **params**: [`PostDataParams`](../type-aliases/PostDataParams.md)\<`T`\> +Parameters for posting the data event. + #### Returns `Promise`\<[`CommitID`](../../identifiers/classes/CommitID.md)\> +A promise that resolves to the `CommitID` of the posted event. + +#### Remarks + +The data event updates the content of a stream and is associated with the +current state of the stream. + *** ### postDeterministicInit() > **postDeterministicInit**(`params`): `Promise`\<[`CommitID`](../../identifiers/classes/CommitID.md)\> -Post a deterministic init event and return its commit ID +Posts a deterministic initialization event and returns its commit ID. #### Parameters • **params**: [`PostDeterministicInitParams`](../type-aliases/PostDeterministicInitParams.md) +Parameters for posting the deterministic init event. + #### Returns `Promise`\<[`CommitID`](../../identifiers/classes/CommitID.md)\> +A promise that resolves to the `CommitID` of the posted event. + +#### Remarks + +This method ensures that the resulting stream ID is deterministic, derived +from the `uniqueValue` parameter. Commonly used for model instance documents +of type `set` and `single`. + *** ### postSignedInit() > **postSignedInit**\<`T`\>(`params`): `Promise`\<[`CommitID`](../../identifiers/classes/CommitID.md)\> -Post a signed (non-deterministic) init event and return its commit ID +Posts a signed initialization event and returns its commit ID. #### Type Parameters @@ -134,6 +281,64 @@ Post a signed (non-deterministic) init event and return its commit ID • **params**: [`PostSignedInitParams`](../type-aliases/PostSignedInitParams.md)\<`T`\> +Parameters for posting the signed init event. + #### Returns `Promise`\<[`CommitID`](../../identifiers/classes/CommitID.md)\> + +A promise that resolves to the `CommitID` of the posted event. + +#### Remarks + +This method results in a non-deterministic stream ID, typically used for +model instance documents of type `list`. + +*** + +### streamStateToDocumentState() + +> **streamStateToDocumentState**(`streamState`): `DocumentState` + +Transforms a `StreamState` into a `DocumentState`. + +#### Parameters + +• **streamState**: [`StreamState`](../../stream-client/type-aliases/StreamState.md) + +The stream state to transform. + +#### Returns + +`DocumentState` + +The `DocumentState` derived from the stream state. + +*** + +### updateDocument() + +> **updateDocument**\<`T`\>(`params`): `Promise`\<`DocumentState`\> + +Updates a document with new content and returns the updated document state. + +#### Type Parameters + +• **T** *extends* [`UnknownContent`](../type-aliases/UnknownContent.md) = [`UnknownContent`](../type-aliases/UnknownContent.md) + +#### Parameters + +• **params**: `UpdateDataParams`\<`T`\> + +Parameters for updating the document. + +#### Returns + +`Promise`\<`DocumentState`\> + +A promise that resolves to the updated `DocumentState`. + +#### Remarks + +This method posts the new content as a data event, updating the document. +It can optionally take the current document state to avoid re-fetching it. diff --git a/docs/@ceramic-sdk/model-instance-client/functions/createDataEvent.md b/docs/@ceramic-sdk/model-instance-client/functions/createDataEvent.md index e0bbbb7..09c9c0c 100644 --- a/docs/@ceramic-sdk/model-instance-client/functions/createDataEvent.md +++ b/docs/@ceramic-sdk/model-instance-client/functions/createDataEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-client v0.2.1**](../README.md) • **Docs** *** @@ -8,7 +8,7 @@ > **createDataEvent**\<`T`\>(`params`): `Promise`\<[`SignedEvent`](../../events/type-aliases/SignedEvent.md)\> -Create a signed data event for a ModelInstanceDocument stream +Creates a signed data event for a ModelInstanceDocument stream. ## Type Parameters @@ -18,6 +18,15 @@ Create a signed data event for a ModelInstanceDocument stream • **params**: [`CreateDataEventParams`](../type-aliases/CreateDataEventParams.md)\<`T`\> +Parameters required to create the data event. + ## Returns `Promise`\<[`SignedEvent`](../../events/type-aliases/SignedEvent.md)\> + +A promise that resolves to the signed data event. + +## Remarks + +The data event updates the content of the stream by applying JSON patch operations +to the existing content. The resulting event is signed by the controlling DID. diff --git a/docs/@ceramic-sdk/model-instance-client/functions/createDataEventPayload.md b/docs/@ceramic-sdk/model-instance-client/functions/createDataEventPayload.md index dce3409..4a5af12 100644 --- a/docs/@ceramic-sdk/model-instance-client/functions/createDataEventPayload.md +++ b/docs/@ceramic-sdk/model-instance-client/functions/createDataEventPayload.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-client v0.2.1**](../README.md) • **Docs** *** @@ -8,16 +8,28 @@ > **createDataEventPayload**(`current`, `data`, `header`?): [`DocumentDataEventPayload`](../../model-instance-protocol/type-aliases/DocumentDataEventPayload.md) -Create a data event payload for a ModelInstanceDocument stream +Creates a data event payload for a ModelInstanceDocument stream. ## Parameters • **current**: [`CommitID`](../../identifiers/classes/CommitID.md) +The current commit ID of the stream. + • **data**: (`MapIn`\<`object`, `$TypeOf`\> \| `MapIn`\<`object`, `$TypeOf`\> \| `MapIn`\<`object`, `$TypeOf`\> \| `MapIn`\<`object`, `$TypeOf`\> \| `MapIn`\<`object`, `$TypeOf`\> \| `MapIn`\<`object`, `$TypeOf`\>)[] +The JSON patch operations to apply to the stream content. + • **header?**: `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> +Optional header information for the data event. + ## Returns [`DocumentDataEventPayload`](../../model-instance-protocol/type-aliases/DocumentDataEventPayload.md) + +A valid data event payload. + +## Throws + +Will throw an error if the JSON patch operations are invalid. diff --git a/docs/@ceramic-sdk/model-instance-client/functions/createInitEvent.md b/docs/@ceramic-sdk/model-instance-client/functions/createInitEvent.md index 8ad0bdf..fc31316 100644 --- a/docs/@ceramic-sdk/model-instance-client/functions/createInitEvent.md +++ b/docs/@ceramic-sdk/model-instance-client/functions/createInitEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-client v0.2.1**](../README.md) • **Docs** *** @@ -8,7 +8,7 @@ > **createInitEvent**\<`T`\>(`params`): `Promise`\<[`SignedEvent`](../../events/type-aliases/SignedEvent.md)\> -Create a non-deterministic init event for a ModelInstanceDocument stream. +Creates a non-deterministic initialization event for a ModelInstanceDocument stream. ## Type Parameters @@ -18,10 +18,19 @@ Create a non-deterministic init event for a ModelInstanceDocument stream. • **params**: [`CreateInitEventParams`](../type-aliases/CreateInitEventParams.md)\<`T`\> +The parameters required to create the initialization event. + ## Returns `Promise`\<[`SignedEvent`](../../events/type-aliases/SignedEvent.md)\> +A promise that resolves to a signed initialization event. + +## Remarks + +This method creates a non-deterministic initialization event for use with streams where +the stream ID is not derived from a unique value. + ## See -[getDeterministicInitEventPayload](getDeterministicInitEventPayload.md) for deterministic events. +[getDeterministicInitEventPayload](getDeterministicInitEventPayload.md) for deterministic initialization events. diff --git a/docs/@ceramic-sdk/model-instance-client/functions/getDeterministicInitEvent.md b/docs/@ceramic-sdk/model-instance-client/functions/getDeterministicInitEvent.md index bc5715a..40c557c 100644 --- a/docs/@ceramic-sdk/model-instance-client/functions/getDeterministicInitEvent.md +++ b/docs/@ceramic-sdk/model-instance-client/functions/getDeterministicInitEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-client v0.2.1**](../README.md) • **Docs** *** @@ -8,16 +8,24 @@ > **getDeterministicInitEvent**(`model`, `controller`, `uniqueValue`?): [`EncodedDeterministicInitEventPayload`](../../model-instance-protocol/type-aliases/EncodedDeterministicInitEventPayload.md) -Get an encoded deterministic init event for a ModelInstanceDocument stream +Encodes a deterministic initialization event for a ModelInstanceDocument stream. ## Parameters • **model**: [`StreamID`](../../identifiers/classes/StreamID.md) +The stream ID of the model associated with the stream. + • **controller**: `string` \| `string` & `WithOpaque`\<`"DIDString"`\> +The DID string or literal string for the stream's controller. + • **uniqueValue?**: `Uint8Array` +Optional unique value to ensure determinism. + ## Returns [`EncodedDeterministicInitEventPayload`](../../model-instance-protocol/type-aliases/EncodedDeterministicInitEventPayload.md) + +The encoded deterministic initialization event payload. diff --git a/docs/@ceramic-sdk/model-instance-client/functions/getDeterministicInitEventPayload.md b/docs/@ceramic-sdk/model-instance-client/functions/getDeterministicInitEventPayload.md index 6388a5e..3984716 100644 --- a/docs/@ceramic-sdk/model-instance-client/functions/getDeterministicInitEventPayload.md +++ b/docs/@ceramic-sdk/model-instance-client/functions/getDeterministicInitEventPayload.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-client v0.2.1**](../README.md) • **Docs** *** @@ -8,20 +8,29 @@ > **getDeterministicInitEventPayload**(`model`, `controller`, `uniqueValue`?): [`DeterministicInitEventPayload`](../../model-instance-protocol/type-aliases/DeterministicInitEventPayload.md) -Get a deterministic init event payload for a ModelInstanceDocument stream. +Retrieves the payload for a deterministic initialization event for a ModelInstanceDocument stream. ## Parameters • **model**: [`StreamID`](../../identifiers/classes/StreamID.md) +The stream ID of the model associated with the stream. + • **controller**: `string` \| `string` & `WithOpaque`\<`"DIDString"`\> +The DID string or literal string for the stream's controller. + • **uniqueValue?**: `Uint8Array` +Optional unique value to ensure determinism. + ## Returns [`DeterministicInitEventPayload`](../../model-instance-protocol/type-aliases/DeterministicInitEventPayload.md) -## See +The deterministic initialization event payload. + +## Remarks -[createInitEvent](createInitEvent.md) for creating non-deterministic events. +Deterministic initialization events ensure the resulting stream ID is derived +from the provided unique value. diff --git a/docs/@ceramic-sdk/model-instance-client/type-aliases/CreateDataEventParams.md b/docs/@ceramic-sdk/model-instance-client/type-aliases/CreateDataEventParams.md index dc5889b..e8a3aac 100644 --- a/docs/@ceramic-sdk/model-instance-client/type-aliases/CreateDataEventParams.md +++ b/docs/@ceramic-sdk/model-instance-client/type-aliases/CreateDataEventParams.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-client v0.2.1**](../README.md) • **Docs** *** @@ -8,6 +8,8 @@ > **CreateDataEventParams**\<`T`\>: `object` +Parameters required to create a signed data event for a ModelInstanceDocument stream. + ## Type Parameters • **T** *extends* [`UnknownContent`](UnknownContent.md) = [`UnknownContent`](UnknownContent.md) @@ -24,7 +26,7 @@ DID controlling the ModelInstanceDocument stream > `optional` **currentContent**: `T` -Current JSON object content for the ModelInstanceDocument stream, used with `newContent` to create the JSON patch +Current JSON object content for the stream, used with `newContent` to create a JSON patch ### currentID @@ -36,10 +38,10 @@ Commit ID of the current tip of the ModelInstanceDocument stream > `optional` **newContent**: `T` -New JSON object content for the ModelInstanceDocument stream, used with `currentContent` to create the JSON patch +New JSON object content for the stream, used with `currentContent` to create a JSON patch ### shouldIndex? > `optional` **shouldIndex**: `boolean` -Flag notifying indexers if they should index the ModelInstanceDocument stream or not +Flag indicating if indexers should index the stream diff --git a/docs/@ceramic-sdk/model-instance-client/type-aliases/CreateInitEventParams.md b/docs/@ceramic-sdk/model-instance-client/type-aliases/CreateInitEventParams.md index 449a329..6c78838 100644 --- a/docs/@ceramic-sdk/model-instance-client/type-aliases/CreateInitEventParams.md +++ b/docs/@ceramic-sdk/model-instance-client/type-aliases/CreateInitEventParams.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-client v0.2.1**](../README.md) • **Docs** *** @@ -8,6 +8,8 @@ > **CreateInitEventParams**\<`T`\>: `object` +Parameters required to create a non-deterministic initialization event for a ModelInstanceDocument stream. + ## Type Parameters • **T** *extends* [`UnknownContent`](UnknownContent.md) = [`UnknownContent`](UnknownContent.md) @@ -42,4 +44,4 @@ Stream ID of the Model used by the ModelInstanceDocument stream > `optional` **shouldIndex**: `boolean` -Flag notifying indexers if they should index the ModelInstanceDocument stream or not, defaults to `true` +Flag indicating if indexers should index the ModelInstanceDocument stream (defaults to `true`) diff --git a/docs/@ceramic-sdk/model-instance-client/type-aliases/PostDataParams.md b/docs/@ceramic-sdk/model-instance-client/type-aliases/PostDataParams.md index ad1f70f..bfe8b4b 100644 --- a/docs/@ceramic-sdk/model-instance-client/type-aliases/PostDataParams.md +++ b/docs/@ceramic-sdk/model-instance-client/type-aliases/PostDataParams.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-client v0.2.1**](../README.md) • **Docs** *** @@ -8,6 +8,8 @@ > **PostDataParams**\<`T`\>: `Omit`\<[`CreateDataEventParams`](CreateDataEventParams.md)\<`T`\>, `"controller"`\> & `object` +Parameters for posting a data event. + ## Type declaration ### controller? diff --git a/docs/@ceramic-sdk/model-instance-client/type-aliases/PostDeterministicInitParams.md b/docs/@ceramic-sdk/model-instance-client/type-aliases/PostDeterministicInitParams.md index 9c6e261..cfe1d72 100644 --- a/docs/@ceramic-sdk/model-instance-client/type-aliases/PostDeterministicInitParams.md +++ b/docs/@ceramic-sdk/model-instance-client/type-aliases/PostDeterministicInitParams.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-client v0.2.1**](../README.md) • **Docs** *** @@ -8,16 +8,24 @@ > **PostDeterministicInitParams**: `object` +Parameters for posting a deterministic initialization event. + ## Type declaration ### controller > **controller**: `DIDString` \| `string` +The controller of the stream (DID string or literal string) + ### model > **model**: [`StreamID`](../../identifiers/classes/StreamID.md) +The model's stream ID + ### uniqueValue? > `optional` **uniqueValue**: `Uint8Array` + +A unique value to ensure determinism of the event diff --git a/docs/@ceramic-sdk/model-instance-client/type-aliases/PostSignedInitParams.md b/docs/@ceramic-sdk/model-instance-client/type-aliases/PostSignedInitParams.md index 0556c14..6ace0bd 100644 --- a/docs/@ceramic-sdk/model-instance-client/type-aliases/PostSignedInitParams.md +++ b/docs/@ceramic-sdk/model-instance-client/type-aliases/PostSignedInitParams.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-client v0.2.1**](../README.md) • **Docs** *** @@ -8,6 +8,8 @@ > **PostSignedInitParams**\<`T`\>: `Omit`\<[`CreateInitEventParams`](CreateInitEventParams.md)\<`T`\>, `"controller"`\> & `object` +Parameters for posting a signed initialization event. + ## Type declaration ### controller? diff --git a/docs/@ceramic-sdk/model-instance-client/type-aliases/UnknownContent.md b/docs/@ceramic-sdk/model-instance-client/type-aliases/UnknownContent.md index 23ca902..e4ab977 100644 --- a/docs/@ceramic-sdk/model-instance-client/type-aliases/UnknownContent.md +++ b/docs/@ceramic-sdk/model-instance-client/type-aliases/UnknownContent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-client v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-handler/README.md b/docs/@ceramic-sdk/model-instance-handler/README.md new file mode 100644 index 0000000..8547119 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/README.md @@ -0,0 +1,34 @@ +**@ceramic-sdk/model-instance-handler v0.2.1** • **Docs** + +*** + +[Ceramic SDK](../../README.md) / @ceramic-sdk/model-instance-handler + +# @ceramic-sdk/model-instance-handler + +## Type Aliases + +- [Context](type-aliases/Context.md) +- [DocumentEvent](type-aliases/DocumentEvent.md) +- [DocumentEventPayload](type-aliases/DocumentEventPayload.md) +- [DocumentState](type-aliases/DocumentState.md) +- [UnknownContent](type-aliases/UnknownContent.md) + +## Variables + +- [DocumentEvent](variables/DocumentEvent.md) +- [DocumentEventPayload](variables/DocumentEventPayload.md) + +## Functions + +- [assertNoImmutableFieldChange](functions/assertNoImmutableFieldChange.md) +- [assertValidContent](functions/assertValidContent.md) +- [assertValidInitHeader](functions/assertValidInitHeader.md) +- [assertValidUniqueValue](functions/assertValidUniqueValue.md) +- [handleDataPayload](functions/handleDataPayload.md) +- [handleDeterministicInitPayload](functions/handleDeterministicInitPayload.md) +- [handleEvent](functions/handleEvent.md) +- [handleInitPayload](functions/handleInitPayload.md) +- [handleTimeEvent](functions/handleTimeEvent.md) +- [validateRelation](functions/validateRelation.md) +- [validateRelationsContent](functions/validateRelationsContent.md) diff --git a/docs/@ceramic-sdk/model-instance-handler/functions/assertNoImmutableFieldChange.md b/docs/@ceramic-sdk/model-instance-handler/functions/assertNoImmutableFieldChange.md new file mode 100644 index 0000000..0abb076 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/functions/assertNoImmutableFieldChange.md @@ -0,0 +1,21 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / assertNoImmutableFieldChange + +# Function: assertNoImmutableFieldChange() + +> **assertNoImmutableFieldChange**(`operations`, `immutableFields`): `void` + +Helper function to validate if immutable fields are being mutated + +## Parameters + +• **operations**: (`MapIn`\<`object`, `$TypeOf`\> \| `MapIn`\<`object`, `$TypeOf`\> \| `MapIn`\<`object`, `$TypeOf`\> \| `MapIn`\<`object`, `$TypeOf`\> \| `MapIn`\<`object`, `$TypeOf`\> \| `MapIn`\<`object`, `$TypeOf`\>)[] + +• **immutableFields**: `string`[] = `[]` + +## Returns + +`void` diff --git a/docs/@ceramic-sdk/model-instance-handler/functions/assertValidContent.md b/docs/@ceramic-sdk/model-instance-handler/functions/assertValidContent.md new file mode 100644 index 0000000..29722c5 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/functions/assertValidContent.md @@ -0,0 +1,25 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / assertValidContent + +# Function: assertValidContent() + +> **assertValidContent**\<`T`\>(`modelID`, `modelSchema`, `content`): `asserts content is T` + +## Type Parameters + +• **T** *extends* [`UnknownContent`](../type-aliases/UnknownContent.md) + +## Parameters + +• **modelID**: `string` + +• **modelSchema**: `Object`\<`any`\> + +• **content**: `unknown` + +## Returns + +`asserts content is T` diff --git a/docs/@ceramic-sdk/model-instance-handler/functions/assertValidInitHeader.md b/docs/@ceramic-sdk/model-instance-handler/functions/assertValidInitHeader.md new file mode 100644 index 0000000..82293f0 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/functions/assertValidInitHeader.md @@ -0,0 +1,25 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / assertValidInitHeader + +# Function: assertValidInitHeader() + +> **assertValidInitHeader**(`definition`, `header`): `void` + +Validates the ModelInstanceDocument header against the Model definition. + +## Parameters + +• **definition**: `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> \| `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> + +definition of the Model that this ModelInstanceDocument belongs to + +• **header**: `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> + +the header to validate + +## Returns + +`void` diff --git a/docs/@ceramic-sdk/model-instance-handler/functions/assertValidUniqueValue.md b/docs/@ceramic-sdk/model-instance-handler/functions/assertValidUniqueValue.md new file mode 100644 index 0000000..934a522 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/functions/assertValidUniqueValue.md @@ -0,0 +1,21 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / assertValidUniqueValue + +# Function: assertValidUniqueValue() + +> **assertValidUniqueValue**(`definition`, `metadata`, `content`): `void` + +## Parameters + +• **definition**: `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> \| `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> + +• **metadata**: `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> + +• **content**: `null` \| [`UnknownContent`](../type-aliases/UnknownContent.md) + +## Returns + +`void` diff --git a/docs/@ceramic-sdk/model-instance-handler/functions/handleDataPayload.md b/docs/@ceramic-sdk/model-instance-handler/functions/handleDataPayload.md new file mode 100644 index 0000000..9578813 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/functions/handleDataPayload.md @@ -0,0 +1,19 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / handleDataPayload + +# Function: handleDataPayload() + +> **handleDataPayload**(`payload`, `context`): `Promise`\<[`DocumentState`](../type-aliases/DocumentState.md)\> + +## Parameters + +• **payload**: `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> + +• **context**: [`Context`](../type-aliases/Context.md) + +## Returns + +`Promise`\<[`DocumentState`](../type-aliases/DocumentState.md)\> diff --git a/docs/@ceramic-sdk/model-instance-handler/functions/handleDeterministicInitPayload.md b/docs/@ceramic-sdk/model-instance-handler/functions/handleDeterministicInitPayload.md new file mode 100644 index 0000000..488608f --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/functions/handleDeterministicInitPayload.md @@ -0,0 +1,19 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / handleDeterministicInitPayload + +# Function: handleDeterministicInitPayload() + +> **handleDeterministicInitPayload**(`payload`, `context`): `Promise`\<[`DocumentState`](../type-aliases/DocumentState.md)\> + +## Parameters + +• **payload**: `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> + +• **context**: [`Context`](../type-aliases/Context.md) + +## Returns + +`Promise`\<[`DocumentState`](../type-aliases/DocumentState.md)\> diff --git a/docs/@ceramic-sdk/model-instance-handler/functions/handleEvent.md b/docs/@ceramic-sdk/model-instance-handler/functions/handleEvent.md new file mode 100644 index 0000000..5f34448 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/functions/handleEvent.md @@ -0,0 +1,19 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / handleEvent + +# Function: handleEvent() + +> **handleEvent**(`event`, `context`): `Promise`\<[`DocumentState`](../type-aliases/DocumentState.md)\> + +## Parameters + +• **event**: `MapIn`\<`RequiredProps`\<`object`\>, `$OutputOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$OutputOf`\> \| `MapIn`\<`RequiredProps`\<`object`\>, `$OutputOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$OutputOf`\> \| `MapIn`\<`object`, `$OutputOf`\> + +• **context**: [`Context`](../type-aliases/Context.md) + +## Returns + +`Promise`\<[`DocumentState`](../type-aliases/DocumentState.md)\> diff --git a/docs/@ceramic-sdk/model-instance-handler/functions/handleInitPayload.md b/docs/@ceramic-sdk/model-instance-handler/functions/handleInitPayload.md new file mode 100644 index 0000000..f858612 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/functions/handleInitPayload.md @@ -0,0 +1,19 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / handleInitPayload + +# Function: handleInitPayload() + +> **handleInitPayload**(`payload`, `context`): `Promise`\<[`DocumentState`](../type-aliases/DocumentState.md)\> + +## Parameters + +• **payload**: `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> \| `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> + +• **context**: [`Context`](../type-aliases/Context.md) + +## Returns + +`Promise`\<[`DocumentState`](../type-aliases/DocumentState.md)\> diff --git a/docs/@ceramic-sdk/model-instance-handler/functions/handleTimeEvent.md b/docs/@ceramic-sdk/model-instance-handler/functions/handleTimeEvent.md new file mode 100644 index 0000000..983dcf0 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/functions/handleTimeEvent.md @@ -0,0 +1,19 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / handleTimeEvent + +# Function: handleTimeEvent() + +> **handleTimeEvent**(`event`, `context`): `Promise`\<[`DocumentState`](../type-aliases/DocumentState.md)\> + +## Parameters + +• **event**: `MapIn`\<`object`, `$TypeOf`\> + +• **context**: [`Context`](../type-aliases/Context.md) + +## Returns + +`Promise`\<[`DocumentState`](../type-aliases/DocumentState.md)\> diff --git a/docs/@ceramic-sdk/model-instance-handler/functions/validateRelation.md b/docs/@ceramic-sdk/model-instance-handler/functions/validateRelation.md new file mode 100644 index 0000000..6c0fa6f --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/functions/validateRelation.md @@ -0,0 +1,23 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / validateRelation + +# Function: validateRelation() + +> **validateRelation**(`context`, `docID`, `expectedModelID`, `fieldName`): `Promise`\<`void`\> + +## Parameters + +• **context**: [`Context`](../type-aliases/Context.md) + +• **docID**: `string` + +• **expectedModelID**: `string` + +• **fieldName**: `string` + +## Returns + +`Promise`\<`void`\> diff --git a/docs/@ceramic-sdk/model-instance-handler/functions/validateRelationsContent.md b/docs/@ceramic-sdk/model-instance-handler/functions/validateRelationsContent.md new file mode 100644 index 0000000..7208841 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/functions/validateRelationsContent.md @@ -0,0 +1,21 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / validateRelationsContent + +# Function: validateRelationsContent() + +> **validateRelationsContent**(`context`, `definition`, `content`): `Promise`\<`void`\> + +## Parameters + +• **context**: [`Context`](../type-aliases/Context.md) + +• **definition**: `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> \| `MapIn`\<`RequiredProps`\<`object`\>, `$TypeOf`\> & `MapIn`\<`OptionalProps`\<`object`\>, `$TypeOf`\> + +• **content**: [`UnknownContent`](../type-aliases/UnknownContent.md) + +## Returns + +`Promise`\<`void`\> diff --git a/docs/@ceramic-sdk/model-instance-handler/type-aliases/Context.md b/docs/@ceramic-sdk/model-instance-handler/type-aliases/Context.md new file mode 100644 index 0000000..cb46bf3 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/type-aliases/Context.md @@ -0,0 +1,51 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / Context + +# Type Alias: Context + +> **Context**: `object` + +## Type declaration + +### getDocumentModel() + +> **getDocumentModel**: (`streamID`) => `Promise`\<`string`\> + +#### Parameters + +• **streamID**: `string` + +#### Returns + +`Promise`\<`string`\> + +### getDocumentState() + +> **getDocumentState**: (`streamID`) => `Promise`\<[`DocumentState`](DocumentState.md)\> + +#### Parameters + +• **streamID**: `string` + +#### Returns + +`Promise`\<[`DocumentState`](DocumentState.md)\> + +### getModelDefinition() + +> **getModelDefinition**: (`streamID`) => `Promise`\<[`ModelDefinition`](../../model-protocol/type-aliases/ModelDefinition.md)\> + +#### Parameters + +• **streamID**: `string` + +#### Returns + +`Promise`\<[`ModelDefinition`](../../model-protocol/type-aliases/ModelDefinition.md)\> + +### verifier + +> **verifier**: `DID` diff --git a/docs/@ceramic-sdk/model-instance-handler/type-aliases/DocumentEvent.md b/docs/@ceramic-sdk/model-instance-handler/type-aliases/DocumentEvent.md new file mode 100644 index 0000000..d126f92 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/type-aliases/DocumentEvent.md @@ -0,0 +1,9 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / DocumentEvent + +# Type Alias: DocumentEvent + +> **DocumentEvent**: `OutputOf`\<*typeof* [`DocumentEvent`](../variables/DocumentEvent.md)\> diff --git a/docs/@ceramic-sdk/model-instance-handler/type-aliases/DocumentEventPayload.md b/docs/@ceramic-sdk/model-instance-handler/type-aliases/DocumentEventPayload.md new file mode 100644 index 0000000..2cbcc36 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/type-aliases/DocumentEventPayload.md @@ -0,0 +1,9 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / DocumentEventPayload + +# Type Alias: DocumentEventPayload + +> **DocumentEventPayload**: `TypeOf`\<*typeof* [`DocumentEventPayload`](../variables/DocumentEventPayload.md)\> diff --git a/docs/@ceramic-sdk/model-instance-handler/type-aliases/DocumentState.md b/docs/@ceramic-sdk/model-instance-handler/type-aliases/DocumentState.md new file mode 100644 index 0000000..b727c69 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/type-aliases/DocumentState.md @@ -0,0 +1,19 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / DocumentState + +# Type Alias: DocumentState + +> **DocumentState**: `object` + +## Type declaration + +### content + +> **content**: [`UnknownContent`](UnknownContent.md) \| `null` + +### metadata + +> **metadata**: [`DocumentMetadata`](../../model-instance-protocol/type-aliases/DocumentMetadata.md) diff --git a/docs/@ceramic-sdk/model-instance-handler/type-aliases/UnknownContent.md b/docs/@ceramic-sdk/model-instance-handler/type-aliases/UnknownContent.md new file mode 100644 index 0000000..66cec95 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/type-aliases/UnknownContent.md @@ -0,0 +1,9 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / UnknownContent + +# Type Alias: UnknownContent + +> **UnknownContent**: `Record`\<`string`, `unknown`\> diff --git a/docs/@ceramic-sdk/model-instance-handler/variables/DocumentEvent.md b/docs/@ceramic-sdk/model-instance-handler/variables/DocumentEvent.md new file mode 100644 index 0000000..8446e63 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/variables/DocumentEvent.md @@ -0,0 +1,9 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / DocumentEvent + +# Variable: DocumentEvent + +> `const` **DocumentEvent**: `UnionCodec`\<[`SparseCodec`\<`object`\>, `SparseCodec`\<`object`\>, `ExactCodec`\<`TypeCodec`\<`object`\>\>]\> diff --git a/docs/@ceramic-sdk/model-instance-handler/variables/DocumentEventPayload.md b/docs/@ceramic-sdk/model-instance-handler/variables/DocumentEventPayload.md new file mode 100644 index 0000000..4767d31 --- /dev/null +++ b/docs/@ceramic-sdk/model-instance-handler/variables/DocumentEventPayload.md @@ -0,0 +1,9 @@ +[**@ceramic-sdk/model-instance-handler v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-handler](../README.md) / DocumentEventPayload + +# Variable: DocumentEventPayload + +> `const` **DocumentEventPayload**: `UnionCodec`\<[`SparseCodec`\<`object`\>, `UnionCodec`\<[`SparseCodec`\<`object`\>, `SparseCodec`\<`object`\>]\>, `SparseCodec`\<`object`\>, `ExactCodec`\<`TypeCodec`\<`object`\>\>]\> diff --git a/docs/@ceramic-sdk/model-instance-protocol/README.md b/docs/@ceramic-sdk/model-instance-protocol/README.md index ddaadff..d1366d7 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/README.md +++ b/docs/@ceramic-sdk/model-instance-protocol/README.md @@ -1,4 +1,4 @@ -**@ceramic-sdk/model-instance-protocol v0.1.0** • **Docs** +**@ceramic-sdk/model-instance-protocol v0.2.1** • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/functions/getDeterministicStreamID.md b/docs/@ceramic-sdk/model-instance-protocol/functions/getDeterministicStreamID.md index c9db38d..fe34d1f 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/functions/getDeterministicStreamID.md +++ b/docs/@ceramic-sdk/model-instance-protocol/functions/getDeterministicStreamID.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/functions/getStreamID.md b/docs/@ceramic-sdk/model-instance-protocol/functions/getStreamID.md index 2b23e41..937f835 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/functions/getStreamID.md +++ b/docs/@ceramic-sdk/model-instance-protocol/functions/getStreamID.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DataInitEventPayload.md b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DataInitEventPayload.md index e1ec152..be7182e 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DataInitEventPayload.md +++ b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DataInitEventPayload.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DeterministicInitEventPayload.md b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DeterministicInitEventPayload.md index 5b2f57e..3cf1698 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DeterministicInitEventPayload.md +++ b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DeterministicInitEventPayload.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentDataEventHeader.md b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentDataEventHeader.md index ca7c147..49f5140 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentDataEventHeader.md +++ b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentDataEventHeader.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentDataEventPayload.md b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentDataEventPayload.md index c237179..1bd2f4d 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentDataEventPayload.md +++ b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentDataEventPayload.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentEvent.md b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentEvent.md index dd8b36f..c07a63a 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentEvent.md +++ b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentInitEventHeader.md b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentInitEventHeader.md index 89717d1..c6b994f 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentInitEventHeader.md +++ b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentInitEventHeader.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentInitEventPayload.md b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentInitEventPayload.md index 6926c6d..b886b88 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentInitEventPayload.md +++ b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentInitEventPayload.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentMetadata.md b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentMetadata.md index bdc3082..13e39e8 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentMetadata.md +++ b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/DocumentMetadata.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/EncodedDeterministicInitEventPayload.md b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/EncodedDeterministicInitEventPayload.md index 9dd0451..c18a354 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/EncodedDeterministicInitEventPayload.md +++ b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/EncodedDeterministicInitEventPayload.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/EncodedDocumentMetadata.md b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/EncodedDocumentMetadata.md index ea1f131..c97cf58 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/EncodedDocumentMetadata.md +++ b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/EncodedDocumentMetadata.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/JSONPatchOperation.md b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/JSONPatchOperation.md index 877bc80..1db5775 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/type-aliases/JSONPatchOperation.md +++ b/docs/@ceramic-sdk/model-instance-protocol/type-aliases/JSONPatchOperation.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/variables/DataInitEventPayload.md b/docs/@ceramic-sdk/model-instance-protocol/variables/DataInitEventPayload.md index 0264312..d1d544c 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/variables/DataInitEventPayload.md +++ b/docs/@ceramic-sdk/model-instance-protocol/variables/DataInitEventPayload.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/variables/DeterministicInitEventPayload.md b/docs/@ceramic-sdk/model-instance-protocol/variables/DeterministicInitEventPayload.md index 938d294..1be5092 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/variables/DeterministicInitEventPayload.md +++ b/docs/@ceramic-sdk/model-instance-protocol/variables/DeterministicInitEventPayload.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentDataEventHeader.md b/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentDataEventHeader.md index 09a84cd..b7ea462 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentDataEventHeader.md +++ b/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentDataEventHeader.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentDataEventPayload.md b/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentDataEventPayload.md index 274ce91..df1ebc4 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentDataEventPayload.md +++ b/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentDataEventPayload.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentEvent.md b/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentEvent.md index 57912d8..829683f 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentEvent.md +++ b/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentInitEventHeader.md b/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentInitEventHeader.md index da20767..4aeddcd 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentInitEventHeader.md +++ b/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentInitEventHeader.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentInitEventPayload.md b/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentInitEventPayload.md index ae9c435..7092789 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentInitEventPayload.md +++ b/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentInitEventPayload.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentMetadata.md b/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentMetadata.md index b089245..1a57a73 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentMetadata.md +++ b/docs/@ceramic-sdk/model-instance-protocol/variables/DocumentMetadata.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchAddOperation.md b/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchAddOperation.md index 40bb2e7..721e20b 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchAddOperation.md +++ b/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchAddOperation.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchCopyOperation.md b/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchCopyOperation.md index fa5484f..86409d9 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchCopyOperation.md +++ b/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchCopyOperation.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchMoveOperation.md b/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchMoveOperation.md index 7100e38..04b92b0 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchMoveOperation.md +++ b/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchMoveOperation.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchOperation.md b/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchOperation.md index a0fbf91..807ec9d 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchOperation.md +++ b/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchOperation.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchRemoveOperation.md b/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchRemoveOperation.md index dff98b9..0819b8f 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchRemoveOperation.md +++ b/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchRemoveOperation.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchReplaceOperation.md b/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchReplaceOperation.md index 33593d3..3b2a58e 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchReplaceOperation.md +++ b/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchReplaceOperation.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchTestOperation.md b/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchTestOperation.md index 2706c1a..fcad209 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchTestOperation.md +++ b/docs/@ceramic-sdk/model-instance-protocol/variables/JSONPatchTestOperation.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-instance-protocol/variables/MAX_DOCUMENT_SIZE.md b/docs/@ceramic-sdk/model-instance-protocol/variables/MAX_DOCUMENT_SIZE.md index eedf472..95ad3a9 100644 --- a/docs/@ceramic-sdk/model-instance-protocol/variables/MAX_DOCUMENT_SIZE.md +++ b/docs/@ceramic-sdk/model-instance-protocol/variables/MAX_DOCUMENT_SIZE.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-instance-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-instance-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/README.md b/docs/@ceramic-sdk/model-protocol/README.md index d88cc33..2bcfab8 100644 --- a/docs/@ceramic-sdk/model-protocol/README.md +++ b/docs/@ceramic-sdk/model-protocol/README.md @@ -1,4 +1,4 @@ -**@ceramic-sdk/model-protocol v0.1.0** • **Docs** +**@ceramic-sdk/model-protocol v0.2.1** • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/functions/assertValidModelContent.md b/docs/@ceramic-sdk/model-protocol/functions/assertValidModelContent.md index 28bd320..2ca1033 100644 --- a/docs/@ceramic-sdk/model-protocol/functions/assertValidModelContent.md +++ b/docs/@ceramic-sdk/model-protocol/functions/assertValidModelContent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/functions/getModelStreamID.md b/docs/@ceramic-sdk/model-protocol/functions/getModelStreamID.md index 64619e8..910237d 100644 --- a/docs/@ceramic-sdk/model-protocol/functions/getModelStreamID.md +++ b/docs/@ceramic-sdk/model-protocol/functions/getModelStreamID.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelAccountRelation.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelAccountRelation.md index a70954f..1232b66 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelAccountRelation.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelAccountRelation.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelAccountRelationV2.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelAccountRelationV2.md index a5ceee8..7d67413 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelAccountRelationV2.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelAccountRelationV2.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelDefinition.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelDefinition.md index 381b001..a67511b 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelDefinition.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelDefinition.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelDefinitionV1.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelDefinitionV1.md index 118bef2..82e18cf 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelDefinitionV1.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelDefinitionV1.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelDefinitionV2.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelDefinitionV2.md index 1cb619a..73c86a8 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelDefinitionV2.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelDefinitionV2.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelDocumentMetadataViewDefinition.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelDocumentMetadataViewDefinition.md index 5a1037a..c7086fc 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelDocumentMetadataViewDefinition.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelDocumentMetadataViewDefinition.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelEvent.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelEvent.md index f61b76e..4f79120 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelEvent.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelEventHeader.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelEventHeader.md index 7afdea1..573fb93 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelEventHeader.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelEventHeader.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelInitEventPayload.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelInitEventPayload.md index 7fb0d7f..ccee375 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelInitEventPayload.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelInitEventPayload.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelMetadata.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelMetadata.md index 20ecef3..1c9dd58 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelMetadata.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelMetadata.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationDefinition.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationDefinition.md index 69ca062..8aca08c 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationDefinition.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationDefinition.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationDefinitionV2.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationDefinitionV2.md index 9a6bcf9..cd6b6e2 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationDefinitionV2.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationDefinitionV2.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationViewDefinition.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationViewDefinition.md index c5601d5..9e7289c 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationViewDefinition.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationViewDefinition.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationViewDefinitionV2.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationViewDefinitionV2.md index 3b21eb4..eeb4744 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationViewDefinitionV2.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationViewDefinitionV2.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationsDefinition.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationsDefinition.md index 1ab938d..02fb4ca 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationsDefinition.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationsDefinition.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationsDefinitionV2.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationsDefinitionV2.md index 3ad838d..ecf62fc 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationsDefinitionV2.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelRelationsDefinitionV2.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelViewDefinition.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelViewDefinition.md index a065c68..c3e96ee 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelViewDefinition.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelViewDefinition.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelViewDefinitionV2.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelViewDefinitionV2.md index c08eac6..60532c7 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelViewDefinitionV2.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelViewDefinitionV2.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelViewsDefinition.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelViewsDefinition.md index 6c69e9c..a98e2db 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelViewsDefinition.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelViewsDefinition.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelViewsDefinitionV2.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelViewsDefinitionV2.md index 8e72aaf..0dde1aa 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ModelViewsDefinitionV2.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ModelViewsDefinitionV2.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ObjectSchema.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ObjectSchema.md index 1914d84..4c1216d 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ObjectSchema.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ObjectSchema.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/SchemaType.md b/docs/@ceramic-sdk/model-protocol/type-aliases/SchemaType.md index d61afae..4924ffd 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/SchemaType.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/SchemaType.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/type-aliases/ValidVersionSatisfies.md b/docs/@ceramic-sdk/model-protocol/type-aliases/ValidVersionSatisfies.md index 733d9c4..147a891 100644 --- a/docs/@ceramic-sdk/model-protocol/type-aliases/ValidVersionSatisfies.md +++ b/docs/@ceramic-sdk/model-protocol/type-aliases/ValidVersionSatisfies.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/MODEL.md b/docs/@ceramic-sdk/model-protocol/variables/MODEL.md index 46e4635..da7e0ee 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/MODEL.md +++ b/docs/@ceramic-sdk/model-protocol/variables/MODEL.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/MODEL_STREAM_ID.md b/docs/@ceramic-sdk/model-protocol/variables/MODEL_STREAM_ID.md index 5d77a5e..475df4e 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/MODEL_STREAM_ID.md +++ b/docs/@ceramic-sdk/model-protocol/variables/MODEL_STREAM_ID.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelAccountRelation.md b/docs/@ceramic-sdk/model-protocol/variables/ModelAccountRelation.md index 34d4c7a..39c40f2 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelAccountRelation.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelAccountRelation.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelAccountRelationV2.md b/docs/@ceramic-sdk/model-protocol/variables/ModelAccountRelationV2.md index 049eb41..994f939 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelAccountRelationV2.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelAccountRelationV2.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelDefinition.md b/docs/@ceramic-sdk/model-protocol/variables/ModelDefinition.md index 841bd59..fa9722d 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelDefinition.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelDefinition.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelDefinitionV1.md b/docs/@ceramic-sdk/model-protocol/variables/ModelDefinitionV1.md index 09e89e5..505d1cd 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelDefinitionV1.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelDefinitionV1.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelDefinitionV2.md b/docs/@ceramic-sdk/model-protocol/variables/ModelDefinitionV2.md index 4d346f7..e5d70d0 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelDefinitionV2.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelDefinitionV2.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelDocumentMetadataViewDefinition.md b/docs/@ceramic-sdk/model-protocol/variables/ModelDocumentMetadataViewDefinition.md index 045245d..5531852 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelDocumentMetadataViewDefinition.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelDocumentMetadataViewDefinition.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelEvent.md b/docs/@ceramic-sdk/model-protocol/variables/ModelEvent.md index 3e127cd..788a756 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelEvent.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelEvent.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelEventHeader.md b/docs/@ceramic-sdk/model-protocol/variables/ModelEventHeader.md index 734fd86..0b66e6e 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelEventHeader.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelEventHeader.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelInitEventPayload.md b/docs/@ceramic-sdk/model-protocol/variables/ModelInitEventPayload.md index a0a16ca..d0c9937 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelInitEventPayload.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelInitEventPayload.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelMetadata.md b/docs/@ceramic-sdk/model-protocol/variables/ModelMetadata.md index 5690e85..af034ab 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelMetadata.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelMetadata.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelRelationDefinition.md b/docs/@ceramic-sdk/model-protocol/variables/ModelRelationDefinition.md index f24796d..3e0db76 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelRelationDefinition.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelRelationDefinition.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelRelationDefinitionV2.md b/docs/@ceramic-sdk/model-protocol/variables/ModelRelationDefinitionV2.md index 68b8dbe..e63c578 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelRelationDefinitionV2.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelRelationDefinitionV2.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelRelationViewDefinition.md b/docs/@ceramic-sdk/model-protocol/variables/ModelRelationViewDefinition.md index 4b74c97..5d9333d 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelRelationViewDefinition.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelRelationViewDefinition.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelRelationViewDefinitionV2.md b/docs/@ceramic-sdk/model-protocol/variables/ModelRelationViewDefinitionV2.md index dfc1eaf..a4419ff 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelRelationViewDefinitionV2.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelRelationViewDefinitionV2.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelRelationsDefinition.md b/docs/@ceramic-sdk/model-protocol/variables/ModelRelationsDefinition.md index 354f5ea..fe845eb 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelRelationsDefinition.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelRelationsDefinition.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelRelationsDefinitionV2.md b/docs/@ceramic-sdk/model-protocol/variables/ModelRelationsDefinitionV2.md index f09b5db..ecd49cd 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelRelationsDefinitionV2.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelRelationsDefinitionV2.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelViewDefinition.md b/docs/@ceramic-sdk/model-protocol/variables/ModelViewDefinition.md index d43a11a..48f49c8 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelViewDefinition.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelViewDefinition.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelViewDefinitionV2.md b/docs/@ceramic-sdk/model-protocol/variables/ModelViewDefinitionV2.md index b40d93a..9b53c4f 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelViewDefinitionV2.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelViewDefinitionV2.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelViewsDefinition.md b/docs/@ceramic-sdk/model-protocol/variables/ModelViewsDefinition.md index 845c0a6..ba2b0f9 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelViewsDefinition.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelViewsDefinition.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ModelViewsDefinitionV2.md b/docs/@ceramic-sdk/model-protocol/variables/ModelViewsDefinitionV2.md index f16cd19..6a42414 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ModelViewsDefinitionV2.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ModelViewsDefinitionV2.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/ObjectSchema.md b/docs/@ceramic-sdk/model-protocol/variables/ObjectSchema.md index f637609..479a96b 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/ObjectSchema.md +++ b/docs/@ceramic-sdk/model-protocol/variables/ObjectSchema.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/model-protocol/variables/optionalModelString.md b/docs/@ceramic-sdk/model-protocol/variables/optionalModelString.md index f3c6a82..620949f 100644 --- a/docs/@ceramic-sdk/model-protocol/variables/optionalModelString.md +++ b/docs/@ceramic-sdk/model-protocol/variables/optionalModelString.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/model-protocol v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/model-protocol v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/stream-client/README.md b/docs/@ceramic-sdk/stream-client/README.md index ae5999b..9e12332 100644 --- a/docs/@ceramic-sdk/stream-client/README.md +++ b/docs/@ceramic-sdk/stream-client/README.md @@ -1,4 +1,4 @@ -**@ceramic-sdk/stream-client v0.1.0** • **Docs** +**@ceramic-sdk/stream-client v0.2.1** • **Docs** *** @@ -13,3 +13,4 @@ ## Type Aliases - [StreamClientParams](type-aliases/StreamClientParams.md) +- [StreamState](type-aliases/StreamState.md) diff --git a/docs/@ceramic-sdk/stream-client/classes/StreamClient.md b/docs/@ceramic-sdk/stream-client/classes/StreamClient.md index abc8d66..f2870ae 100644 --- a/docs/@ceramic-sdk/stream-client/classes/StreamClient.md +++ b/docs/@ceramic-sdk/stream-client/classes/StreamClient.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/stream-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/stream-client v0.2.1**](../README.md) • **Docs** *** @@ -6,6 +6,14 @@ # Class: StreamClient +Represents a Stream Client. + +This class provides basic utility methods to interact with streams, including +accessing the Ceramic client and obtaining stream states. It also manages a +Decentralized Identifier (DID) that can be used for authentication or signing. + +This class is intended to be extended by other classes for more specific functionalities. + ## Extended by ## Constructors @@ -14,10 +22,14 @@ > **new StreamClient**(`params`): [`StreamClient`](StreamClient.md) +Creates a new instance of `StreamClient`. + #### Parameters • **params**: [`StreamClientParams`](../type-aliases/StreamClientParams.md) +Configuration object containing parameters for initializing the StreamClient. + #### Returns [`StreamClient`](StreamClient.md) @@ -28,12 +40,16 @@ > `get` **ceramic**(): [`CeramicClient`](../../http-client/classes/CeramicClient.md) -Ceramic HTTP client instance used to interact with Ceramic One server +Retrieves the Ceramic HTTP client instance used to interact with the Ceramic server. + +This client is essential for executing API requests to fetch stream data. #### Returns [`CeramicClient`](../../http-client/classes/CeramicClient.md) +The `CeramicClient` instance associated with this StreamClient. + #### Defined in ## Methods @@ -42,12 +58,65 @@ Ceramic HTTP client instance used to interact with Ceramic One server > **getDID**(`provided`?): `DID` -Utility method used to access the provided DID or the one attached to the instance, throws if neither is provided +Retrieves a Decentralized Identifier (DID). + +This method provides access to a DID, which is required for authentication or event signing operations. +The caller can optionally provide a DID; if none is provided, the instance's DID is used instead. #### Parameters • **provided?**: `DID` +An optional DID object to use. If not supplied, the instance's DID is returned. + #### Returns `DID` + +The DID object, either provided or attached to the instance. + +#### Throws + +Will throw an error if neither a provided DID nor an instance DID is available. + +#### Example + +```typescript +const did = client.getDID(); +console.log(did.id); // Outputs the DID identifier +``` + +*** + +### getStreamState() + +> **getStreamState**(`streamId`): `Promise`\<[`StreamState`](../type-aliases/StreamState.md)\> + +Fetches the current stream state of a specific stream by its ID. + +This method interacts with the Ceramic HTTP API to retrieve the state of a stream. +The stream ID can either be a multibase-encoded string or a `StreamID` object. + +#### Parameters + +• **streamId**: `string` \| [`StreamID`](../../identifiers/classes/StreamID.md) + +The unique identifier of the stream to fetch. + - Can be a multibase-encoded string or a `StreamID` object. + +#### Returns + +`Promise`\<[`StreamState`](../type-aliases/StreamState.md)\> + +A Promise that resolves to the `StreamState` object, representing the current state of the stream. + +#### Throws + +Will throw an error if the API request fails or returns an error response (if stream is not found). + +#### Example + +```typescript +const streamState = await client.getStreamState('kjzl6cwe1...'); +console.log(streamState); +``` diff --git a/docs/@ceramic-sdk/stream-client/type-aliases/StreamClientParams.md b/docs/@ceramic-sdk/stream-client/type-aliases/StreamClientParams.md index 6532192..50908f5 100644 --- a/docs/@ceramic-sdk/stream-client/type-aliases/StreamClientParams.md +++ b/docs/@ceramic-sdk/stream-client/type-aliases/StreamClientParams.md @@ -1,4 +1,4 @@ -[**@ceramic-sdk/stream-client v0.1.0**](../README.md) • **Docs** +[**@ceramic-sdk/stream-client v0.2.1**](../README.md) • **Docs** *** diff --git a/docs/@ceramic-sdk/stream-client/type-aliases/StreamState.md b/docs/@ceramic-sdk/stream-client/type-aliases/StreamState.md new file mode 100644 index 0000000..075e5c3 --- /dev/null +++ b/docs/@ceramic-sdk/stream-client/type-aliases/StreamState.md @@ -0,0 +1,41 @@ +[**@ceramic-sdk/stream-client v0.2.1**](../README.md) • **Docs** + +*** + +[Ceramic SDK](../../../README.md) / [@ceramic-sdk/stream-client](../README.md) / StreamState + +# Type Alias: StreamState + +> **StreamState**: `object` + +## Type declaration + +### controller + +> **controller**: `string` + +Controller of the stream + +### data + +> **data**: `string` + +Multibase encoding of the data of the stream. Content is stream type specific + +### dimensions + +> **dimensions**: `Record`\<`string`, `string`\> + +Dimensions of the stream, each value is multibase encoded + +### event\_cid + +> **event\_cid**: `string` + +CID of the event that produced this state + +### id + +> **id**: `string` + +Multibase encoding of the stream id diff --git a/docs/README.md b/docs/README.md index 34aca53..59fc4bd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -6,11 +6,12 @@ ## Packages -- [@ceramic-sdk/events - v0.1.0](@ceramic-sdk/events/README.md) -- [@ceramic-sdk/http-client - v0.1.0](@ceramic-sdk/http-client/README.md) -- [@ceramic-sdk/identifiers - v0.1.0](@ceramic-sdk/identifiers/README.md) -- [@ceramic-sdk/model-client - v0.1.0](@ceramic-sdk/model-client/README.md) -- [@ceramic-sdk/model-instance-client - v0.1.0](@ceramic-sdk/model-instance-client/README.md) -- [@ceramic-sdk/model-instance-protocol - v0.1.0](@ceramic-sdk/model-instance-protocol/README.md) -- [@ceramic-sdk/model-protocol - v0.1.0](@ceramic-sdk/model-protocol/README.md) -- [@ceramic-sdk/stream-client - v0.1.0](@ceramic-sdk/stream-client/README.md) +- [@ceramic-sdk/events - v0.2.1](@ceramic-sdk/events/README.md) +- [@ceramic-sdk/http-client - v0.2.1](@ceramic-sdk/http-client/README.md) +- [@ceramic-sdk/identifiers - v0.2.0](@ceramic-sdk/identifiers/README.md) +- [@ceramic-sdk/model-client - v0.2.1](@ceramic-sdk/model-client/README.md) +- [@ceramic-sdk/model-instance-client - v0.2.1](@ceramic-sdk/model-instance-client/README.md) +- [@ceramic-sdk/model-instance-protocol - v0.2.1](@ceramic-sdk/model-instance-protocol/README.md) +- [@ceramic-sdk/model-instance-handler - v0.2.1](@ceramic-sdk/model-instance-handler/README.md) +- [@ceramic-sdk/model-protocol - v0.2.1](@ceramic-sdk/model-protocol/README.md) +- [@ceramic-sdk/stream-client - v0.2.1](@ceramic-sdk/stream-client/README.md)