Skip to content

Commit fdefb3f

Browse files
committed
fix: pagination field not pageSize
1 parent 2bf19cd commit fdefb3f

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

packages/client/src/httpClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class AlephHttpClient {
120120
* Watches for new messages on the Aleph network. This method returns a socket that can be used to listen for new messages.
121121
* @param config The filters used to watch for new messages, similar to getMessages.
122122
*/
123-
async watchMessages(config: Omit<GetMessagesConfiguration, 'page' | 'pageSize'>): Promise<AlephSocket> {
123+
async watchMessages(config: Omit<GetMessagesConfiguration, 'page' | 'pagination'>): Promise<AlephSocket> {
124124
return this.messageClient.getMessagesSocket(config)
125125
}
126126
}

packages/message/__tests__/base/get.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ describe('Test features from GetMessage', () => {
4141
4242
describe('Test features from GetMessage', () => {
4343
const client = new BaseMessageClient()
44-
it('Try by pageSize and page', async () => {
44+
it('Try by pagination and page', async () => {
4545
const res = await client.getAll({
46-
pageSize: 5,
46+
pagination: 5,
4747
page: 2,
4848
})
4949
expect(res.messages.length).toStrictEqual(5)
@@ -112,7 +112,7 @@ describe('Test features from GetMessage', () => {
112112
const aimedType = 'testing_oversize'
113113
const res = await client.getAll({
114114
contentTypes: [aimedType],
115-
pageSize: 10,
115+
pagination: 10,
116116
})
117117
118118
expect(res.messages.length).toBeGreaterThan(0)
@@ -126,7 +126,7 @@ describe('Test features from GetMessage', () => {
126126
const aimedTag = ['Test']
127127
const res = await client.getAll({
128128
tags: aimedTag,
129-
pageSize: 10,
129+
pagination: 10,
130130
})
131131
132132
expect(res.messages.length).toBeGreaterThan(0)
@@ -141,7 +141,7 @@ describe('Test features from GetMessage', () => {
141141
const aimedKey = 'InterPlanetaryCloud'
142142
const res = await client.getAll({
143143
contentKeys: [aimedKey],
144-
pageSize: 10,
144+
pagination: 10,
145145
})
146146
147147
expect(res.messages.length).toBeGreaterThan(0)
@@ -157,7 +157,7 @@ describe('Test features from GetMessage', () => {
157157
const res = await client.getAll({
158158
startDate: aimedStartTime,
159159
endDate: aimedEndTime,
160-
pageSize: 5,
160+
pagination: 5,
161161
})
162162
163163
res.messages.map((item) => {
@@ -191,7 +191,7 @@ describe('Test features from GetMessage', () => {
191191
typeArray.map(async (type) => {
192192
const res = await client.getAll({
193193
messageTypes: [type],
194-
pageSize: 3,
194+
pagination: 3,
195195
})
196196
expect(checkTypeList(res.messages, type)).toStrictEqual(true)
197197
}),

packages/message/__tests__/post/get.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('Post get tests', () => {
88

99
const amends = await post.getAll({
1010
types: [],
11-
pageSize: 5,
11+
pagination: 5,
1212
channels: [channel],
1313
})
1414

packages/message/src/base/impl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class BaseMessageClient {
9999
* @param configuration The message params to make the query.
100100
*/
101101
async getAll({
102-
pageSize = 20,
102+
pagination = 20,
103103
page = 1,
104104
addresses = [],
105105
channels = [],
@@ -115,7 +115,7 @@ export class BaseMessageClient {
115115
}: GetMessagesConfiguration): Promise<MessagesQueryResponse> {
116116
const any = (value: any) => value && value.length > 0
117117
const params: GetMessagesParams = {
118-
pageSize,
118+
pagination,
119119
page,
120120
addresses: any(addresses) ? addresses.join(',') : undefined,
121121
channels: any(channels) ? channels.join(',') : undefined,

packages/message/src/base/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export type MessagesQueryResponse = {
3131
}
3232

3333
export type GetMessagesConfiguration = {
34-
pageSize?: number
34+
pagination?: number
3535
page?: number
3636
addresses?: string[]
3737
channels?: string[]
@@ -47,7 +47,7 @@ export type GetMessagesConfiguration = {
4747
}
4848

4949
export type GetMessagesParams = {
50-
pageSize?: number
50+
pagination?: number
5151
page?: number
5252
addresses?: string
5353
channels?: string

packages/message/src/post/impl.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class PostMessageClient {
3737
/**
3838
* Queries the Aleph network for post messages.
3939
* @param types The types of messages to retrieve.
40-
* @param pageSize The number of messages to retrieve.
40+
* @param pagination The number of messages to retrieve.
4141
* @param page The page number to retrieve.
4242
* @param channels The channels to retrieve the messages from.
4343
* @param refs The references to retrieve the messages from.
@@ -47,7 +47,7 @@ export class PostMessageClient {
4747
*/
4848
async getAll<T = any>({
4949
types = [],
50-
pageSize = 50,
50+
pagination = 50,
5151
page = 1,
5252
channels = [],
5353
refs = [],
@@ -58,7 +58,7 @@ export class PostMessageClient {
5858
const any = (value: any) => value && value.length > 0
5959
const params: PostQueryParams = {
6060
types,
61-
pageSize,
61+
pagination,
6262
page,
6363
refs: any(refs) ? refs?.join(',') : undefined,
6464
addresses: any(addresses) ? addresses?.join(',') : undefined,

packages/message/src/post/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export type PostContent<T> = BaseContent & {
1212

1313
export type PostGetConfiguration = {
1414
types?: string | string[]
15-
pageSize?: number
15+
pagination?: number
1616
page?: number
1717
refs?: string[]
1818
addresses?: string[]
@@ -23,7 +23,7 @@ export type PostGetConfiguration = {
2323

2424
export type PostQueryParams = {
2525
types?: string | string[]
26-
pageSize: number
26+
pagination: number
2727
page: number
2828
refs?: string | undefined
2929
addresses?: string | undefined

0 commit comments

Comments
 (0)