diff --git a/packages/client/src/httpClient.ts b/packages/client/src/httpClient.ts index 2fb0463a..c9e1b0af 100644 --- a/packages/client/src/httpClient.ts +++ b/packages/client/src/httpClient.ts @@ -120,7 +120,7 @@ export class AlephHttpClient { * Watches for new messages on the Aleph network. This method returns a socket that can be used to listen for new messages. * @param config The filters used to watch for new messages, similar to getMessages. */ - async watchMessages(config: Omit): Promise { + async watchMessages(config: Omit): Promise { return this.messageClient.getMessagesSocket(config) } } diff --git a/packages/message/__tests__/base/get.test.ts b/packages/message/__tests__/base/get.test.ts index e5a8f9fd..1f10e99c 100644 --- a/packages/message/__tests__/base/get.test.ts +++ b/packages/message/__tests__/base/get.test.ts @@ -41,9 +41,9 @@ describe('Test features from GetMessage', () => { describe('Test features from GetMessage', () => { const client = new BaseMessageClient() - it('Try by pageSize and page', async () => { + it('Try by pagination and page', async () => { const res = await client.getAll({ - pageSize: 5, + pagination: 5, page: 2, }) expect(res.messages.length).toStrictEqual(5) @@ -112,7 +112,7 @@ describe('Test features from GetMessage', () => { const aimedType = 'testing_oversize' const res = await client.getAll({ contentTypes: [aimedType], - pageSize: 10, + pagination: 10, }) expect(res.messages.length).toBeGreaterThan(0) @@ -126,7 +126,7 @@ describe('Test features from GetMessage', () => { const aimedTag = ['Test'] const res = await client.getAll({ tags: aimedTag, - pageSize: 10, + pagination: 10, }) expect(res.messages.length).toBeGreaterThan(0) @@ -141,7 +141,7 @@ describe('Test features from GetMessage', () => { const aimedKey = 'InterPlanetaryCloud' const res = await client.getAll({ contentKeys: [aimedKey], - pageSize: 10, + pagination: 10, }) expect(res.messages.length).toBeGreaterThan(0) @@ -157,7 +157,7 @@ describe('Test features from GetMessage', () => { const res = await client.getAll({ startDate: aimedStartTime, endDate: aimedEndTime, - pageSize: 5, + pagination: 5, }) res.messages.map((item) => { @@ -191,7 +191,7 @@ describe('Test features from GetMessage', () => { typeArray.map(async (type) => { const res = await client.getAll({ messageTypes: [type], - pageSize: 3, + pagination: 3, }) expect(checkTypeList(res.messages, type)).toStrictEqual(true) }), diff --git a/packages/message/__tests__/post/get.test.ts b/packages/message/__tests__/post/get.test.ts index 91bd8ea5..072ce0d1 100644 --- a/packages/message/__tests__/post/get.test.ts +++ b/packages/message/__tests__/post/get.test.ts @@ -8,7 +8,7 @@ describe('Post get tests', () => { const amends = await post.getAll({ types: [], - pageSize: 5, + pagination: 5, channels: [channel], }) diff --git a/packages/message/src/base/impl.ts b/packages/message/src/base/impl.ts index 05ea4840..c73d6bd9 100644 --- a/packages/message/src/base/impl.ts +++ b/packages/message/src/base/impl.ts @@ -99,7 +99,7 @@ export class BaseMessageClient { * @param configuration The message params to make the query. */ async getAll({ - pageSize = 20, + pagination = 20, page = 1, addresses = [], channels = [], @@ -115,7 +115,7 @@ export class BaseMessageClient { }: GetMessagesConfiguration): Promise { const any = (value: any) => value && value.length > 0 const params: GetMessagesParams = { - pageSize, + pagination, page, addresses: any(addresses) ? addresses.join(',') : undefined, channels: any(channels) ? channels.join(',') : undefined, diff --git a/packages/message/src/base/types.ts b/packages/message/src/base/types.ts index 273ea305..76602612 100644 --- a/packages/message/src/base/types.ts +++ b/packages/message/src/base/types.ts @@ -31,7 +31,7 @@ export type MessagesQueryResponse = { } export type GetMessagesConfiguration = { - pageSize?: number + pagination?: number page?: number addresses?: string[] channels?: string[] @@ -47,7 +47,7 @@ export type GetMessagesConfiguration = { } export type GetMessagesParams = { - pageSize?: number + pagination?: number page?: number addresses?: string channels?: string diff --git a/packages/message/src/post/impl.ts b/packages/message/src/post/impl.ts index acbce13e..e9013ed1 100644 --- a/packages/message/src/post/impl.ts +++ b/packages/message/src/post/impl.ts @@ -37,7 +37,7 @@ export class PostMessageClient { /** * Queries the Aleph network for post messages. * @param types The types of messages to retrieve. - * @param pageSize The number of messages to retrieve. + * @param pagination The number of messages to retrieve. * @param page The page number to retrieve. * @param channels The channels to retrieve the messages from. * @param refs The references to retrieve the messages from. @@ -47,7 +47,7 @@ export class PostMessageClient { */ async getAll({ types = [], - pageSize = 50, + pagination = 50, page = 1, channels = [], refs = [], @@ -58,7 +58,7 @@ export class PostMessageClient { const any = (value: any) => value && value.length > 0 const params: PostQueryParams = { types, - pageSize, + pagination, page, refs: any(refs) ? refs?.join(',') : undefined, addresses: any(addresses) ? addresses?.join(',') : undefined, diff --git a/packages/message/src/post/types.ts b/packages/message/src/post/types.ts index 3eea5968..5a57d5f0 100644 --- a/packages/message/src/post/types.ts +++ b/packages/message/src/post/types.ts @@ -12,7 +12,7 @@ export type PostContent = BaseContent & { export type PostGetConfiguration = { types?: string | string[] - pageSize?: number + pagination?: number page?: number refs?: string[] addresses?: string[] @@ -23,7 +23,7 @@ export type PostGetConfiguration = { export type PostQueryParams = { types?: string | string[] - pageSize: number + pagination: number page: number refs?: string | undefined addresses?: string | undefined