Skip to content
This repository was archived by the owner on Oct 19, 2023. It is now read-only.

Commit f4befd5

Browse files
authored
Merge pull request #304 from nevermined-io/split-search-options
set different search options
2 parents 25aa521 + d7e1262 commit f4befd5

File tree

5 files changed

+66
-27
lines changed

5 files changed

+66
-27
lines changed

CHANGELOG.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file. Dates are d
44

55
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

7+
#### [v1.6.4](https://github.com/nevermined-io/components-catalog/compare/v1.6.3...v1.6.4)
8+
9+
> 1 June 2023
10+
11+
- Update/sdk 1.4.1 [`#303`](https://github.com/nevermined-io/components-catalog/pull/303)
12+
- update sdk to the version 1.4.1 [`4511ce1`](https://github.com/nevermined-io/components-catalog/commit/4511ce1f495da6940cf0f145a3f735afc4a07c26)
13+
- update pachage version to 1.6.4 [`29fb045`](https://github.com/nevermined-io/components-catalog/commit/29fb04580dbce7285e79085854cf397af761617c)
14+
15+
#### [v1.6.3](https://github.com/nevermined-io/components-catalog/compare/v1.6.2...v1.6.3)
16+
17+
> 31 May 2023
18+
19+
- feat: update to sdk v1.4.0 [`#302`](https://github.com/nevermined-io/components-catalog/pull/302)
20+
- chore: adding v1.6.2 Changelog updates [`5437523`](https://github.com/nevermined-io/components-catalog/commit/5437523144d2fa5ca89ba58dd09613faf7135bf3)
21+
722
#### [v1.6.2](https://github.com/nevermined-io/components-catalog/compare/v1.6.1...v1.6.2)
823

924
> 29 May 2023
@@ -116,15 +131,21 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
116131
117132
- fix: update version in catalog and provider [`#287`](https://github.com/nevermined-io/components-catalog/pull/287)
118133

119-
#### [v1.3.6](https://github.com/nevermined-io/components-catalog/compare/v1.3.4...v1.3.6)
134+
#### [v1.3.6](https://github.com/nevermined-io/components-catalog/compare/v1.3.5...v1.3.6)
120135

121136
> 9 May 2023
122137
123138
- fix: update version in providers [`#286`](https://github.com/nevermined-io/components-catalog/pull/286)
124139
- fix: update version [`#285`](https://github.com/nevermined-io/components-catalog/pull/285)
125140
- feat: update sdk to 1.3.7 and dtp to 0.4.8 [`#284`](https://github.com/nevermined-io/components-catalog/pull/284)
126-
- Bump: sdk@1.3.6 [`#283`](https://github.com/nevermined-io/components-catalog/pull/283)
127141
- Update package.json [`a9efd07`](https://github.com/nevermined-io/components-catalog/commit/a9efd0786e860e025d482d84182bdbfb3a8c236d)
142+
143+
#### [v1.3.5](https://github.com/nevermined-io/components-catalog/compare/v1.3.4...v1.3.5)
144+
145+
> 26 April 2023
146+
147+
- Bump: sdk@1.3.6 [`#283`](https://github.com/nevermined-io/components-catalog/pull/283)
148+
- Adding v1.3.4 Changelog updates [`ae984b3`](https://github.com/nevermined-io/components-catalog/commit/ae984b34eb99a300a58046c35a2600c4a0c3d608)
128149
- bump: libs versions [`2396266`](https://github.com/nevermined-io/components-catalog/commit/2396266601cfc4d3a5496fc12c2c8fe8ae29d91b)
129150
- bump: sdk-dtp [`2434e49`](https://github.com/nevermined-io/components-catalog/commit/2434e496aff66519c74d09d620606d26ee82e377)
130151

@@ -763,7 +784,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
763784
- Release/0.0.74 [`#61`](https://github.com/nevermined-io/components-catalog/pull/61)
764785
- Update README.md [`0278775`](https://github.com/nevermined-io/components-catalog/commit/02787757cda723d418c34d29e8b20ada9974091d)
765786
- Update README.md [`c897ba3`](https://github.com/nevermined-io/components-catalog/commit/c897ba3103674e508931ffff3a3b322005f1d7eb)
766-
- add mint and safe gurading [`8068817`](https://github.com/nevermined-io/components-catalog/commit/80688178117c83391962b7196eecc662f25ef648)
787+
- add mint and safe gurading [`8068817`](https://github.com/nevermined-io/components-catalog/commit/80688178117c83391962b7196eecc662f25ef648)
767788

768789
#### [v0.0.73](https://github.com/nevermined-io/components-catalog/compare/v0.0.72...v0.0.73)
769790

catalog/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nevermined-io/catalog",
3-
"version": "1.6.4",
3+
"version": "1.6.5",
44
"main": "./dist/index.js",
55
"types": "./dist/index.d.ts",
66
"dependencies": {

catalog/src/catalog.tsx

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -228,23 +228,28 @@ export const NeverminedProvider = ({ children, config, verbose }: NeverminedProv
228228
}
229229
},
230230

231-
getPublishedSubscriptionsAndServices: async (searchOptions?: SearchOptions
231+
getPublishedSubscriptionsAndServices: async (
232+
searchOptionsSubscriptions?: SearchOptions,
233+
searchOptionsServices?: SearchOptions
232234
): Promise<SubscriptionsAndServicesDDOs[]> => {
233235
try {
234236
const account = await getCurrentAccount(sdk)
235-
const query = await sdk.search.subscriptionsCreated(account, searchOptions?.customNestedQueries, searchOptions?.offset, searchOptions?.page, searchOptions?.sort, searchOptions?.appId)
236-
return getSubscriptionsAndServices(query.results, sdk, searchOptions)
237+
const query = await sdk.search.subscriptionsCreated(account, searchOptionsSubscriptions?.customNestedQueries, searchOptionsSubscriptions?.offset, searchOptionsSubscriptions?.page, searchOptionsSubscriptions?.sort, searchOptionsSubscriptions?.appId)
238+
return getSubscriptionsAndServices(query.results, sdk, searchOptionsServices)
237239
} catch (error) {
238240
verbose && Logger.error(error)
239241
return []
240242
}
241243
},
242244

243-
getPublishedSubscriptionsAndDatasets: async (searchOptions?: SearchOptions): Promise<SubscriptionsAndDatasetsDDOs[]> => {
245+
getPublishedSubscriptionsAndDatasets: async (
246+
searchOptionsSubscriptions?: SearchOptions,
247+
searchOptionsDatasets?: SearchOptions
248+
): Promise<SubscriptionsAndDatasetsDDOs[]> => {
244249
try {
245250
const account = await getCurrentAccount(sdk)
246-
const query = await sdk.search.subscriptionsCreated(account, searchOptions?.customNestedQueries, searchOptions?.offset, searchOptions?.page, searchOptions?.sort, searchOptions?.appId)
247-
return getSubscriptionsAndDatasets(query.results, sdk, searchOptions)
251+
const query = await sdk.search.subscriptionsCreated(account, searchOptionsSubscriptions?.customNestedQueries, searchOptionsSubscriptions?.offset, searchOptionsSubscriptions?.page, searchOptionsSubscriptions?.sort, searchOptionsSubscriptions?.appId)
252+
return getSubscriptionsAndDatasets(query.results, sdk, searchOptionsDatasets)
248253
} catch (error) {
249254
verbose && Logger.error(error)
250255
return []
@@ -262,23 +267,28 @@ export const NeverminedProvider = ({ children, config, verbose }: NeverminedProv
262267
}
263268
},
264269

265-
getPurchasedSubscriptionsAndServices: async (searchOptions?: SearchOptions
266-
): Promise<SubscriptionsAndServicesDDOs[]> => {
270+
getPurchasedSubscriptionsAndServices: async (
271+
searchOptionsSubscriptions?: SearchOptions,
272+
searchOptionsServices?: SearchOptions
273+
): Promise<SubscriptionsAndServicesDDOs[]> => {
267274
try {
268275
const account = await getCurrentAccount(sdk)
269-
const query = await sdk.search.subscriptionsPurchased(account, searchOptions?.customNestedQueries, searchOptions?.offset, searchOptions?.page, searchOptions?.sort, searchOptions?.appId)
270-
return getSubscriptionsAndServices(query.results, sdk, searchOptions)
276+
const query = await sdk.search.subscriptionsPurchased(account, searchOptionsSubscriptions?.customNestedQueries, searchOptionsSubscriptions?.offset, searchOptionsSubscriptions?.page, searchOptionsSubscriptions?.sort, searchOptionsSubscriptions?.appId)
277+
return getSubscriptionsAndServices(query.results, sdk, searchOptionsServices)
271278
} catch (error) {
272279
verbose && Logger.error(error)
273280
return []
274281
}
275282
},
276283

277-
getPurchasedSubscriptionsAndDatasets: async (searchOptions?: SearchOptions): Promise<SubscriptionsAndDatasetsDDOs[]> => {
284+
getPurchasedSubscriptionsAndDatasets: async (
285+
searchOptionsSubscriptions?: SearchOptions,
286+
searchOptionsDatasets?: SearchOptions
287+
): Promise<SubscriptionsAndDatasetsDDOs[]> => {
278288
try {
279289
const account = await getCurrentAccount(sdk)
280-
const query = await sdk.search.subscriptionsPurchased(account, searchOptions?.customNestedQueries, searchOptions?.offset, searchOptions?.page, searchOptions?.sort, searchOptions?.appId)
281-
return getSubscriptionsAndDatasets(query.results, sdk, searchOptions)
290+
const query = await sdk.search.subscriptionsPurchased(account, searchOptionsSubscriptions?.customNestedQueries, searchOptionsSubscriptions?.offset, searchOptionsSubscriptions?.page, searchOptionsSubscriptions?.sort, searchOptionsSubscriptions?.appId)
291+
return getSubscriptionsAndDatasets(query.results, sdk, searchOptionsDatasets)
282292
} catch (error) {
283293
verbose && Logger.error(error)
284294
return []

catalog/src/types/index.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ export interface GenericOutput<T, E> {
305305
*/
306306
export interface SearchOptions {
307307
/** custom nested queries to add in the search */
308-
customNestedQueries: SearchQuery['query'][]
308+
customNestedQueries?: SearchQuery['query'][]
309309
/** Number of results per page */
310310
offset?: number
311311
/** Number of page */
@@ -442,19 +442,23 @@ export interface AccountModule {
442442
getAssociatedDatasets: (did: string, searchOptions?: SearchOptions) => Promise<QueryResult>
443443
/**
444444
* Get all the published subscriptions and services associated from the wallet address passed
445-
* @param searchOptions options for customize result
445+
* @param searchOptionsSubscriptions options for customize result of Subscriptions
446+
* @param searchOptionsServices options for customize result of Service
446447
* @returns published subscriptions and service
447448
*/
448449
getPublishedSubscriptionsAndServices: (
449-
searchOptions?: SearchOptions,
450+
searchOptionsSubscriptions?: SearchOptions,
451+
searchOptionsServices?: SearchOptions,
450452
) => Promise<SubscriptionsAndServicesDDOs[]>
451453
/**
452454
* Get all the published subscriptions and datasets associated from the wallet address passed
453-
* @param searchOptions options for customize result
455+
* @param searchOptionsSubscriptions options for customize result of Subscriptions
456+
* @param searchOptionsDatasets options for customize result of Datasets
454457
* @returns published subscriptions and its datasets
455458
*/
456459
getPublishedSubscriptionsAndDatasets: (
457-
searchOptions?: SearchOptions,
460+
searchOptionsSubscriptions?: SearchOptions,
461+
searchOptionsDatasets?: SearchOptions,
458462
) => Promise<SubscriptionsAndDatasetsDDOs[]>
459463
/**
460464
* Get only purchased Subscriptions
@@ -464,19 +468,23 @@ export interface AccountModule {
464468
getPurchasedSubscriptions: (searchOptions?: SearchOptions) => Promise<QueryResult>
465469
/**
466470
* Get all the purchased subscriptions and services associated from the wallet address passed
467-
* @param searchOptions options for customize result
471+
* @param searchOptionsSubscriptions options for customize result of Subscriptions
472+
* @param searchOptionsServices options for customize result of Service
468473
* @returns purchased subscriptions and services
469474
*/
470475
getPurchasedSubscriptionsAndServices: (
471-
searchOptions?: SearchOptions,
476+
searchOptionsSubscriptions?: SearchOptions,
477+
searchOptionsServices?: SearchOptions,
472478
) => Promise<SubscriptionsAndServicesDDOs[]>
473479
/**
474480
* Get all the purchased subscriptions and datasets associated from the wallet address passed
475-
* @param searchOptions options for customize result
481+
* @param searchOptionsSubscriptions options for customize result of Subscriptions
482+
* @param searchOptionsDatasets options for customize result of Datasets
476483
* @returns purchased subscriptions and its datasets
477484
*/
478485
getPurchasedSubscriptionsAndDatasets: (
479-
searchOptions?: SearchOptions,
486+
searchOptionsSubscriptions?: SearchOptions,
487+
searchOptionsDatasets?: SearchOptions,
480488
) => Promise<SubscriptionsAndDatasetsDDOs[]>
481489
/**
482490
* Generate a token for authentication in the Marketplace API

providers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@nevermined-io/providers",
33
"private": false,
4-
"version": "1.6.4",
4+
"version": "1.6.5",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",
77
"dependencies": {

0 commit comments

Comments
 (0)