diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f2f22c80..35e6d119f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,10 +66,22 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - feat: subscription by credits api [`f97aa61`](https://github.com/nevermined-io/sdk-js/commit/f97aa61c4328a7bc8ea1f14f584b3664876970db) - chore: adapting nft 1155 to duration and transfer params [`a133315`](https://github.com/nevermined-io/sdk-js/commit/a133315c8b217cec7d41e6f863277dfe94fce98a) -#### [v2.0.0-rc2](https://github.com/nevermined-io/sdk-js/compare/v2.0.0-rc18...v2.0.0-rc2) +#### [v2.0.0-rc2](https://github.com/nevermined-io/sdk-js/compare/v2.0.0-rc19...v2.0.0-rc2) > 26 July 2023 +#### [v2.0.0-rc19](https://github.com/nevermined-io/sdk-js/compare/v2.0.0-rc18...v2.0.0-rc19) + +> 19 October 2023 + +- fix: search by subscription needs to filter by tokenId [`#598`](https://github.com/nevermined-io/sdk-js/pull/598) +- Feat/nvm tools actions v0.15.0 [`#596`](https://github.com/nevermined-io/sdk-js/pull/596) +- Adding optional resource type attributes [`#597`](https://github.com/nevermined-io/sdk-js/pull/597) +- Cleaning tokenId prefix on DDO attribute [`#595`](https://github.com/nevermined-io/sdk-js/pull/595) +- fix: add filter by nft type [`418877e`](https://github.com/nevermined-io/sdk-js/commit/418877ed6097e73d0119e533c66e616ea729f012) +- fix: add type2 [`538cb14`](https://github.com/nevermined-io/sdk-js/commit/538cb1421c053bae32548eb67ed564769c4d58d7) +- ci: nvm tools v0.15.0 [`c2a7007`](https://github.com/nevermined-io/sdk-js/commit/c2a70078805da0ec46bead9fc2b56d452a5c3817) + #### [v2.0.0-rc18](https://github.com/nevermined-io/sdk-js/compare/v2.0.0-rc17...v2.0.0-rc18) > 16 October 2023 @@ -529,7 +541,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - ci: testing with https services [`bb96077`](https://github.com/nevermined-io/sdk-js/commit/bb96077c9403ea7ae26195a51d8a92e144cea384) - linting [`d2547ed`](https://github.com/nevermined-io/sdk-js/commit/d2547edfbfebb49b488c97c4ce9e6d6f2ee849e4) -#### [v1.0.0](https://github.com/nevermined-io/sdk-js/compare/v1.0.0-rc9...v1.0.0) +### [v1.0.0](https://github.com/nevermined-io/sdk-js/compare/v1.0.0-rc9...v1.0.0) > 14 February 2023 @@ -1268,7 +1280,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). > 2 May 2022 -- add aave service agreement to ddo when creating nft721 asset [`#248`](https://github.com/nevermined-io/sdk-js/pull/248) +- add aave service agreement to ddo when creating nft721 asset [`#248`](https://github.com/nevermined-io/sdk-js/pull/248) - Adding v0.19.21 Changelog updates [`c93cdc5`](https://github.com/nevermined-io/sdk-js/commit/c93cdc55f139a43db4130ccb0f80924d2645a931) #### [v0.19.21](https://github.com/nevermined-io/sdk-js/compare/v0.19.20...v0.19.21) @@ -1531,7 +1543,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). > 18 January 2022 -- Removing not used parameter [`#186`](https://github.com/nevermined-io/sdk-js/pull/186) +- Removing not used parameter [`#186`](https://github.com/nevermined-io/sdk-js/pull/186) - [wip] Create agreement+pay in one transaction [`#183`](https://github.com/nevermined-io/sdk-js/pull/183) - Adapting to contracts `v1.3.3` [`#177`](https://github.com/nevermined-io/sdk-js/pull/177) - Adding v0.17.2 Changelog updates [`5eddda4`](https://github.com/nevermined-io/sdk-js/commit/5eddda43954e013e6e6f7344c9a877d801aacb5c) @@ -2037,7 +2049,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - Feature/sync develop [`#268`](https://github.com/nevermined-io/sdk-js/pull/268) - Quick fix for non-eip1559 networks [`#266`](https://github.com/nevermined-io/sdk-js/pull/266) - integrate Permissions and refactor search query [`#264`](https://github.com/nevermined-io/sdk-js/pull/264) -- add aave service agreement to ddo when creating nft721 asset [`#248`](https://github.com/nevermined-io/sdk-js/pull/248) +- add aave service agreement to ddo when creating nft721 asset [`#248`](https://github.com/nevermined-io/sdk-js/pull/248) - Get the keeper version from the artifacts instead of package version [`#244`](https://github.com/nevermined-io/sdk-js/pull/244) - replace `metadata-api` url by `marketplace-api` and sort type [`#243`](https://github.com/nevermined-io/sdk-js/pull/243) - fixing issues with BigNumbers [`#246`](https://github.com/nevermined-io/sdk-js/pull/246) @@ -2076,7 +2088,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - Feature/190 add did to sec markets [`#191`](https://github.com/nevermined-io/sdk-js/pull/191) - Adding utility methods for getting nft token uri [`#189`](https://github.com/nevermined-io/sdk-js/pull/189) - Lint ... [`#187`](https://github.com/nevermined-io/sdk-js/pull/187) -- Removing not used parameter [`#186`](https://github.com/nevermined-io/sdk-js/pull/186) +- Removing not used parameter [`#186`](https://github.com/nevermined-io/sdk-js/pull/186) - [wip] Create agreement+pay in one transaction [`#183`](https://github.com/nevermined-io/sdk-js/pull/183) - Adapting to contracts `v1.3.3` [`#177`](https://github.com/nevermined-io/sdk-js/pull/177) - Correct typo in route [`#184`](https://github.com/nevermined-io/sdk-js/pull/184) diff --git a/package.json b/package.json index 1e3a6ed0e..ea655ee48 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nevermined-io/sdk", - "version": "2.0.0-rc18", + "version": "2.0.0-rc19", "description": "Javascript SDK for connecting with Nevermined Data Platform ", "main": "./dist/node/sdk.js", "typings": "./dist/node/sdk.d.ts", diff --git a/src/nevermined/api/SearchApi.ts b/src/nevermined/api/SearchApi.ts index 80a7496ea..62075d7e2 100644 --- a/src/nevermined/api/SearchApi.ts +++ b/src/nevermined/api/SearchApi.ts @@ -263,7 +263,7 @@ export class SearchApi extends Instantiable { */ public async subscriptionsCreated( account: Account, - nftType?: string, + nftType?: NeverminedNFT721Type | NeverminedNFT1155Type, customNestedQueries?: SearchQuery['query'][], offset = 100, page = 1, @@ -355,8 +355,8 @@ export class SearchApi extends Instantiable { */ public async subscriptionsPurchased( account: Account, - nftType: string, - ercType: 721 | 1155, + nftType?: NeverminedNFT721Type | NeverminedNFT1155Type, + ercType?: 721 | 1155, customNestedQueries?: SearchQuery['query'][], offset = 100, page = 1, @@ -473,6 +473,8 @@ export class SearchApi extends Instantiable { */ public async servicesByNftContract( nftContractAddress: string, + nftType?: NeverminedNFT721Type | NeverminedNFT1155Type, + tokenId?: string, customNestedQueries?: SearchQuery['query'][], offset = 100, page = 1, @@ -487,18 +489,30 @@ export class SearchApi extends Instantiable { bool: { filter: [ { match: { 'service.type': 'metadata' } }, - { - bool: { - should: [ - { match: { 'service.attributes.main.nftType': NeverminedNFT721Type.nft721 } }, - { - match: { - 'service.attributes.main.nftType': NeverminedNFT1155Type.nft1155Credit, - }, + nftType + ? { + match: { + 'service.attributes.main.nftType': nftType, }, - ], - }, - }, + } + : { + bool: { + should: [ + { + match: { + 'service.attributes.main.nftType': + NeverminedNFT721Type.nft721Subscription, + }, + }, + { + match: { + 'service.attributes.main.nftType': + NeverminedNFT1155Type.nft1155Credit, + }, + }, + ], + }, + }, { exists: { field: 'service.attributes.main.webService', @@ -522,6 +536,12 @@ export class SearchApi extends Instantiable { nftContractAddress, }, }, + tokenId && { + match: { + 'service.attributes.serviceAgreementTemplate.conditions.parameters.value': + tokenId, + }, + }, ], }, }, @@ -563,6 +583,7 @@ export class SearchApi extends Instantiable { */ public async servicesBySubscription( subscriptionDid: string, + nftType?: NeverminedNFT721Type | NeverminedNFT1155Type, customNestedQueries?: SearchQuery['query'][], offset = 100, page = 1, @@ -588,6 +609,8 @@ export class SearchApi extends Instantiable { return this.servicesByNftContract( nftContractAddress, + nftType, + subscriptionDid, customNestedQueries, offset, page, @@ -610,6 +633,8 @@ export class SearchApi extends Instantiable { */ public async datasetsByNftContract( nftContractAddress: string, + nftType?: NeverminedNFT721Type | NeverminedNFT1155Type, + tokenId?: string, customNestedQueries?: SearchQuery['query'][], offset = 100, page = 1, @@ -624,18 +649,30 @@ export class SearchApi extends Instantiable { bool: { filter: [ { match: { 'service.type': 'metadata' } }, - { - bool: { - should: [ - { match: { 'service.attributes.main.nftType': NeverminedNFT721Type.nft721 } }, - { - match: { - 'service.attributes.main.nftType': NeverminedNFT1155Type.nft1155Credit, - }, + nftType + ? { + match: { + 'service.attributes.main.nftType': nftType, }, - ], - }, - }, + } + : { + bool: { + should: [ + { + match: { + 'service.attributes.main.nftType': + NeverminedNFT721Type.nft721Subscription, + }, + }, + { + match: { + 'service.attributes.main.nftType': + NeverminedNFT1155Type.nft1155Credit, + }, + }, + ], + }, + }, { match: { 'service.attributes.main.type': 'dataset', @@ -659,6 +696,12 @@ export class SearchApi extends Instantiable { nftContractAddress, }, }, + tokenId && { + match: { + 'service.attributes.serviceAgreementTemplate.conditions.parameters.value': + tokenId, + }, + }, ], }, }, @@ -700,6 +743,7 @@ export class SearchApi extends Instantiable { */ public async datasetsBySubscription( subscriptionDid: string, + nftType?: NeverminedNFT721Type | NeverminedNFT1155Type, customNestedQueries?: SearchQuery['query'][], offset = 100, page = 1, @@ -725,6 +769,8 @@ export class SearchApi extends Instantiable { return this.datasetsByNftContract( nftContractAddress, + nftType, + subscriptionDid, customNestedQueries, offset, page,