Skip to content

Commit

Permalink
Consistent naming of ModelInstanceClient class (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
mzkrasner authored Dec 6, 2024
1 parent 93856f1 commit 614ef71
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/@ceramic-sdk/model-instance-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

## Classes

- [DocumentClient](classes/DocumentClient.md)
- [ModelInstanceClient](classes/ModelInstanceClient.md)

## Type Aliases

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@

***

[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-client](../README.md) / DocumentClient
[Ceramic SDK](../../../README.md) / [@ceramic-sdk/model-instance-client](../README.md) / ModelInstanceClient

# Class: DocumentClient
# Class: ModelInstanceClient

## Extends

- [`StreamClient`](../../stream-client/classes/StreamClient.md)

## Constructors

### new DocumentClient()
### new ModelInstanceClient()

> **new DocumentClient**(`params`): [`DocumentClient`](DocumentClient.md)
> **new ModelInstanceClient**(`params`): [`ModelInstanceClient`](ModelInstanceClient.md)
#### Parameters

**params**: [`StreamClientParams`](../../stream-client/type-aliases/StreamClientParams.md)

#### Returns

[`DocumentClient`](DocumentClient.md)
[`ModelInstanceClient`](ModelInstanceClient.md)

#### Inherited from

Expand Down
2 changes: 1 addition & 1 deletion packages/model-instance-client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export type PostDataParams<T extends UnknownContent = UnknownContent> = Omit<
controller?: DID
}

export class DocumentClient extends StreamClient {
export class ModelInstanceClient extends StreamClient {
/** Get a DocumentEvent based on its commit ID */
async getEvent(commitID: CommitID | string): Promise<DocumentEvent> {
const id =
Expand Down
2 changes: 1 addition & 1 deletion packages/model-instance-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export {
DocumentClient,
ModelInstanceClient,
type PostDataParams,
type PostDeterministicInitParams,
type PostSignedInitParams,
Expand Down
12 changes: 6 additions & 6 deletions packages/model-instance-client/test/lib.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { jest } from '@jest/globals'
import { equals } from 'uint8arrays'

import {
DocumentClient,
ModelInstanceClient,
createDataEvent,
createInitEvent,
getDeterministicInitEvent,
Expand Down Expand Up @@ -136,14 +136,14 @@ describe('createDataEvent()', () => {
})
})

describe('DocumentClient', () => {
describe('ModelInstanceClient', () => {
describe('getEvent() method', () => {
test('gets a MID event by commit ID', async () => {
const streamID = randomStreamID()
const docEvent = getDeterministicInitEvent(streamID, 'did:key:123')
const getEventType = jest.fn(() => docEvent)
const ceramic = { getEventType } as unknown as CeramicClient
const client = new DocumentClient({ ceramic, did: authenticatedDID })
const client = new ModelInstanceClient({ ceramic, did: authenticatedDID })

const commitID = CommitID.fromStream(streamID)
const event = await client.getEvent(CommitID.fromStream(streamID))
Expand All @@ -159,7 +159,7 @@ describe('DocumentClient', () => {
test('posts the deterministic init event and returns the MID init CommitID', async () => {
const postEventType = jest.fn(() => randomCID())
const ceramic = { postEventType } as unknown as CeramicClient
const client = new DocumentClient({ ceramic, did: authenticatedDID })
const client = new ModelInstanceClient({ ceramic, did: authenticatedDID })

const id = await client.postDeterministicInit({
controller: 'did:key:123',
Expand All @@ -175,7 +175,7 @@ describe('DocumentClient', () => {
test('posts the signed init event and returns the MID init CommitID', async () => {
const postEventType = jest.fn(() => randomCID())
const ceramic = { postEventType } as unknown as CeramicClient
const client = new DocumentClient({ ceramic, did: authenticatedDID })
const client = new ModelInstanceClient({ ceramic, did: authenticatedDID })

const id = await client.postSignedInit({
content: { test: true },
Expand All @@ -192,7 +192,7 @@ describe('DocumentClient', () => {
test('posts the signed data event and returns the CommitID', async () => {
const postEventType = jest.fn(() => randomCID())
const ceramic = { postEventType } as unknown as CeramicClient
const client = new DocumentClient({ ceramic, did: authenticatedDID })
const client = new ModelInstanceClient({ ceramic, did: authenticatedDID })

const initCommitID = await client.postSignedInit({
content: { test: 0 },
Expand Down
6 changes: 3 additions & 3 deletions tests/c1-integration/test/classes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
type ModelState,
handleInitEvent as handleModel,
} from '@ceramic-sdk/model-handler'
import { DocumentClient } from '@ceramic-sdk/model-instance-client'
import { ModelInstanceClient } from '@ceramic-sdk/model-instance-client'
import {
type DocumentState,
handleEvent as handleDocument,
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('stream classes', () => {
context,
)

const docClient = new DocumentClient({
const docClient = new ModelInstanceClient({
ceramic: client,
did: authenticatedDID,
})
Expand Down Expand Up @@ -169,7 +169,7 @@ describe('stream classes', () => {
context,
)

const docClient = new DocumentClient({
const docClient = new ModelInstanceClient({
ceramic: client,
did: authenticatedDID,
})
Expand Down

0 comments on commit 614ef71

Please sign in to comment.