Skip to content

Commit 77f854a

Browse files
committed
Merge Conflicts
2 parents 0c54f47 + 3407247 commit 77f854a

File tree

53 files changed

+1843
-822
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1843
-822
lines changed

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
npm run format
2+
npm run typecheck
3+
npm run lint:fix
4+
git add .

CHANGELOG.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,61 @@ This changelog follows the principles of [Keep a Changelog](https://keepachangel
99
### Added
1010

1111
- Datasets: Added `updateDatasetLicense` use case and repository method to support Dataverse endpoint `PUT /datasets/{id}/license`, for updating dataset license or custom terms
12+
- New Use Case: [Get Collections For Linking Use Case](./docs/useCases.md#get-collections-for-linking).
13+
- New Use Case: [Create a Dataset Template](./docs/useCases.md#create-a-dataset-template) under Collections.
1214

1315
### Changed
1416

1517
### Fixed
1618

1719
### Removed
1820

21+
- Removed date fields validations in create and update dataset use cases, since validation is already handled in the backend and SPA frontend (other clients should perform client side validation also). This avoids duplicated logic and keeps the package focused on its core responsibility.
22+
23+
[Unreleased]: https://github.com/IQSS/dataverse-client-javascript/compare/v2.1.0...develop
24+
1925
---
2026

21-
## [v2.0.0] -- 2025-07-04
27+
## [v2.1.0] -- 2025-09-29
28+
29+
### Added
30+
31+
- CHANGELOG.md file to track changes in a standard way.
32+
33+
- New property isAdvancedSearchFieldType returned by API in GetCollectionMetadataBlocks and GetMetadataBlockByName use cases.
34+
35+
- Use cases for Notifications: GetAllNotifications, DeleteNotification.
36+
37+
- Use cases for Dataset Linking: LinkDataset, UnlinkDataset, GetDatasetLinkedCollections.
38+
39+
- Use case: GetCitationInOtherFormats.
40+
41+
- Use case: GetDatasetAvailableCategories.
42+
43+
- Use cases for Collections Linking: LinkCollection, UnlinkCollection, GetCollectionLinks.
44+
45+
- Use cases for External Tools: GetExternalTools, GetDatasetExternalToolResolved, GetFileExternalToolResolved.
46+
47+
- Use case: GetDatasetTemplates.
48+
49+
- Use case: GetAvailableStandardLicenses.
50+
51+
- Use case: GetAvailableDatasetMetadataExportFormats.
52+
53+
- Use cases for Dataset Types: GetDatasetAvailableDatasetTypes, GetDatasetAvailableDatasetType, AddDatasetType, LinkDatasetTypeWithMetadataBlocks, SetAvailableLicensesForDatasetType, DeleteDatasetType.
54+
55+
### Changed
56+
57+
- CreateDataset use case updated to allow non-default dataset types.
58+
59+
- GetCollectionMetadataBlocks use case updated to support passing a dataset type.
60+
61+
### Fixed
62+
63+
- Integration tests in Roles Repository.
64+
65+
- Incorrect Filter Queries split that caused value parts to be truncated.
66+
67+
### Security
2268

23-
[Unreleased]: https://github.com/IQSS/dataverse-frontend/compare/v2.0.0...develop
69+
- Dependencies updated to address vulnerabilities found by npm audit.

docs/making-releases.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ npm version 3.5.0 --no-git-tag-version
4141

4242
This command will update the version in the `package.json` and `package-lock.json`.
4343

44-
If everything looks good, you can push the changes to the repository.
45-
4644
## Update the changelog
4745

4846
**Note**: Contributors should have already added their changes to the `[Unreleased]` section as part of their pull requests (see [CONTRIBUTING.md](../.github/CONTRIBUTING.md#changelog-guidelines) for details).
@@ -86,8 +84,9 @@ Before releasing, ensure the changelog is properly prepared:
8684
### Removed
8785
```
8886

89-
4. **Update the version links** at the bottom of the changelog files
90-
5. **Commit the changelog updates** as part of the release preparation
87+
4. **Commit the changelog updates** as part of the release preparation
88+
89+
If everything looks good, you can push the changes to the repository.
9190

9291
## Merge "release branch" into "main"
9392

docs/useCases.md

Lines changed: 104 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The different use cases currently available in the package are classified below,
1616
- [List All Collection Items](#list-all-collection-items)
1717
- [List My Data Collection Items](#list-my-data-collection-items)
1818
- [Get Collection Featured Items](#get-collection-featured-items)
19+
- [Get Collections for Linking](#get-collections-for-linking)
1920
- [Collections write use cases](#collections-write-use-cases)
2021
- [Create a Collection](#create-a-collection)
2122
- [Update a Collection](#update-a-collection)
@@ -24,6 +25,7 @@ The different use cases currently available in the package are classified below,
2425
- [Update Collection Featured Items](#update-collection-featured-items)
2526
- [Delete Collection Featured Items](#delete-collection-featured-items)
2627
- [Delete a Collection Featured Item](#delete-a-collection-featured-item)
28+
- [Create a Dataset Template](#create-a-dataset-template)
2729
- [Datasets](#Datasets)
2830
- [Datasets read use cases](#datasets-read-use-cases)
2931
- [Get a Dataset](#get-a-dataset)
@@ -337,6 +339,69 @@ The `collectionIdOrAlias` is a generic collection identifier, which can be eithe
337339

338340
If no collection identifier is specified, the default collection identifier; `:root` will be used. If you want to search for a different collection, you must add the collection identifier as a parameter in the use case call.
339341

342+
#### Get Collections for Linking
343+
344+
Returns an array of [CollectionSummary](../src/collections/domain/models/CollectionSummary.ts) (id, alias, displayName) representing the Dataverse collections to which a given Dataverse collection or Dataset may be linked.
345+
346+
This use case supports an optional `searchTerm` to filter by collection name.
347+
348+
##### Example calls:
349+
350+
```typescript
351+
import { getCollectionsForLinking } from '@iqss/dataverse-client-javascript'
352+
353+
/* ... */
354+
355+
// Case 1: For a given Dataverse collection (by numeric id or alias)
356+
const collectionIdOrAlias: number | string = 'collectionAlias' // or 123
357+
const searchTerm = 'searchOn'
358+
359+
getCollectionsForLinking
360+
.execute('collection', collectionIdOrAlias, searchTerm)
361+
.then((collections) => {
362+
// collections: CollectionSummary[]
363+
/* ... */
364+
})
365+
.catch((error: Error) => {
366+
/* ... */
367+
})
368+
369+
/* ... */
370+
371+
// Case 2: For a given Dataset (by persistent identifier)
372+
const persistentId = 'doi:10.5072/FK2/J8SJZB'
373+
374+
getCollectionsForLinking
375+
.execute('dataset', persistentId, searchTerm)
376+
.then((collections) => {
377+
// collections: CollectionSummary[]
378+
/* ... */
379+
})
380+
.catch((error: Error) => {
381+
/* ... */
382+
})
383+
384+
// Case 3: [alreadyLinked] Optional flag. When true, returns collections currently linked (candidates to unlink). Defaults to false.
385+
const alreadyLinked = true
386+
387+
getCollectionsForLinking
388+
.execute('dataset', persistentId, searchTerm, alreadyLinked)
389+
.then((collections) => {
390+
// collections: CollectionSummary[]
391+
/* ... */
392+
})
393+
.catch((error: Error) => {
394+
/* ... */
395+
})
396+
```
397+
398+
_See [use case](../src/collections/domain/useCases/GetCollectionsForLinking.ts) implementation_.
399+
400+
Notes:
401+
402+
- When the first argument is `'collection'`, the second argument can be a numeric collection id or a collection alias.
403+
- When the first argument is `'dataset'`, the second argument must be the dataset persistent identifier string (e.g., `doi:...`).
404+
340405
### Collections Write Use Cases
341406

342407
#### Create a Collection
@@ -504,6 +569,41 @@ deleteCollectionFeaturedItem.execute(featuredItemId)
504569

505570
_See [use case](../src/collections/domain/useCases/DeleteCollectionFeaturedItem.ts)_ definition.
506571

572+
#### Create a Dataset Template
573+
574+
Creates a dataset template for a given Dataverse collection id or alias.
575+
576+
##### Example call:
577+
578+
```typescript
579+
import { createDatasetTemplate } from '@iqss/dataverse-client-javascript'
580+
import { TemplateCreateDTO } from '@iqss/dataverse-client-javascript'
581+
582+
const collectionAlias = ':root'
583+
const template: TemplateCreateDTO = {
584+
name: 'Dataverse template',
585+
isDefault: true,
586+
fields: [
587+
{
588+
typeName: 'author',
589+
typeClass: 'compound',
590+
multiple: true,
591+
value: [
592+
{
593+
authorName: { typeName: 'authorName', value: 'Belicheck, Bill' },
594+
authorAffiliation: { typeName: 'authorIdentifierScheme', value: 'ORCID' }
595+
}
596+
]
597+
}
598+
],
599+
instructions: [{ instructionField: 'author', instructionText: 'The author data' }]
600+
}
601+
602+
await createDatasetTemplate.execute(template, collectionAlias)
603+
```
604+
605+
_See [use case](../src/collections/domain/useCases/CreateDatasetTemplate.ts) implementation_.
606+
507607
## Datasets
508608

509609
### Datasets Read Use Cases
@@ -861,7 +961,7 @@ _See [use case](../src/datasets/domain/useCases/GetDatasetAvailableDatasetType.t
861961

862962
#### Create a Dataset
863963

864-
Creates a new Dataset in a collection, given a [DatasetDTO](../src/datasets/domain/dtos/DatasetDTO.ts) object and an optional collection identifier, which defaults to `:root`.
964+
Creates a new Dataset in a collection, given a [DatasetDTO](../src/datasets/domain/dtos/DatasetDTO.ts) object, an optional collection identifier, which defaults to `:root`, and an optional dataset type.
865965

866966
This use case validates the submitted fields of each metadata block and can return errors of type [ResourceValidationError](../src/core/domain/useCases/validators/errors/ResourceValidationError.ts), which include sufficient information to determine which field value is invalid and why.
867967

@@ -916,7 +1016,7 @@ createDataset.execute(datasetDTO).then((newDatasetIds: CreatedDatasetIdentifiers
9161016

9171017
_See [use case](../src/datasets/domain/useCases/CreateDataset.ts) implementation_.
9181018

919-
The above example creates the new dataset in the root collection since no collection identifier is specified. If you want to create the dataset in a different collection, you must add the collection identifier as a second parameter in the use case call.
1019+
The above example creates the new dataset in the root collection since no collection identifier is specified. If you want to create the dataset in a different collection, you must add the collection identifier as a second parameter in the use case call. If you want the dataset type to be anything other than dataset, first [check available dataset types](#get-dataset-available-dataset-types) and then add the name of the dataset type as the third parameter.
9201020

9211021
The use case returns a [CreatedDatasetIdentifiers](../src/datasets/domain/models/CreatedDatasetIdentifiers.ts) object, which includes the persistent and numeric identifiers of the created dataset.
9221022

@@ -2050,6 +2150,8 @@ The `collectionIdOrAlias` is a generic collection identifier, which can be eithe
20502150

20512151
There is a second optional parameter called `onlyDisplayedOnCreate` which indicates whether or not to return only the metadata blocks that are displayed on dataset creation. The default value is false.
20522152

2153+
There is a third optional parameter called `datasetType` which will include additional fields from metadata blocks linked to the provided type, if any. Before using this parameter, you will probably want to [list available dataset types](#get-dataset-available-dataset-types) for your installation.
2154+
20532155
## Users
20542156

20552157
### Users read use cases

0 commit comments

Comments
 (0)