-
Notifications
You must be signed in to change notification settings - Fork 8
319 - Release dataverse-client-javascript version 2.0.0 #320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
g-saracca
wants to merge
3
commits into
develop
Choose a base branch
from
319-release-v2-npm
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+116
−139
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,49 @@ | ||
# js-dataverse | ||
## Dataverse JavaScript Client | ||
|
||
[](https://www.npmjs.com/package/js-dataverse) | ||
 | ||
|
||
A JavaScript/TypeScript API wrapper for [Dataverse](http://guides.dataverse.org/en/latest/api/). | ||
The Dataverse JavaScript Client is an open-source package that provides a set of use-case-driven functions to interact with the [Dataverse API](http://guides.dataverse.org/en/latest/api/). Designed around Domain-Driven Design (DDD) principles, this package offers a structured, high-level interface to perform actions like retrieving datasets, managing collections, uploading files, and more. | ||
|
||
- [Installation](./docs/installation.md) | ||
- [Use Cases](./docs/useCases.md) | ||
- [Local Development](./docs/localDevelopment.md) | ||
- [Contributing](./CONTRIBUTING.md) | ||
- [License](./LICENSE) | ||
This package is part of the Dataverse Frontend ecosystem and is intended to be used by applications or services that integrate with the Dataverse platform. | ||
|
||
## Features | ||
|
||
- **Use case-centric API functions** – Organized around domain-specific actions like `getDataset`, `createCollection`, or `restrictFile`. | ||
- **TypeScript-first** – All use cases include strong typings for inputs and outputs, improving developer experience. | ||
|
||
## Installation | ||
|
||
Install the package via npm: | ||
|
||
```bash | ||
npm install @iqss/dataverse-client-javascript | ||
``` | ||
|
||
## Usage | ||
|
||
```typescript | ||
import { getDataset } from '@iqss/dataverse-client-javascript' | ||
|
||
/* ... */ | ||
|
||
const datasetIdentifier = 'doi:10.77777/FK2/AAAAAA' | ||
const datasetVersion = '1.0' | ||
|
||
getDataset.execute(datasetIdentifier, datasetVersion).then((dataset: Dataset) => { | ||
/* ... */ | ||
}) | ||
|
||
/* ... */ | ||
``` | ||
|
||
For detailed information about available use cases see [Use Cases Docs](https://github.com/IQSS/dataverse-client-javascript/blob/main/docs/useCases.md). | ||
|
||
For detailed information about usage see [Usage Docs](https://github.com/IQSS/dataverse-client-javascript/blob/main/docs/usage.md). | ||
|
||
## Contributing | ||
|
||
Want to add a new use case or improve an existing one? Please check the [Contributing](https://github.com/IQSS/dataverse-client-javascript/blob/main/CONTRIBUTING.md) section. | ||
|
||
## License | ||
|
||
This project is open source and available under the [MIT License](https://github.com/IQSS/dataverse-client-javascript/blob/main/LICENSE). |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
## Initialization | ||
|
||
In order for the package to connect to the Dataverse API, there is an `APIConfig` object that should be initialized to set the preferred authentication mechanism with the associated credentials for connecting to the Dataverse API. | ||
|
||
Currently, the supported authentication mechanisms are: | ||
|
||
- **API Key**: The recommended authentication mechanism. The API Key should correspond to a particular Dataverse user account. | ||
|
||
- **Bearer Token**: This mechanism is currently under development and testing. We've selected it for the upcoming Dataverse SPA and will provide more information in a future release once it becomes a standard. | ||
|
||
- **Session Cookie**: This is an experimental feature primarily designed for Dataverse SPA development. To use this mechanism, you must enable the corresponding feature flag in the Dataverse installation (See https://guides.dataverse.org/en/latest/installation/config.html?#feature-flags). It is recommended not to use this mechanism and instead use API Key authentication. | ||
|
||
It is recommended to globally initialize the `ApiConfig` object from the consuming application, as the configuration will be read on every API call made by the package's use cases. | ||
|
||
For example, in a React application, we can globally initialize the `ApiConfig` object in the `App` file, like this: | ||
|
||
```typescript | ||
ApiConfig.init(<DATAVERSE_API_BASE_URL>, DataverseApiAuthMechanism.API_KEY, <DATAVERSE_API_KEY>) | ||
|
||
function App() { | ||
/* Yor App code */ | ||
} | ||
|
||
export default App | ||
``` | ||
|
||
The same example but with example values set: | ||
|
||
```typescript | ||
ApiConfig.init( | ||
'http://localhost:8000/api/v1', | ||
DataverseApiAuthMechanism.API_KEY, | ||
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' | ||
) | ||
|
||
function App() { | ||
/* Yor App code */ | ||
} | ||
|
||
export default App | ||
``` | ||
|
||
We can initialize the `ApiConfig` object as an unauthenticated user, by setting `undefined` as the API Key value. | ||
|
||
This will allow use cases that do not require authentication to be successfully executed, but those that do require authentication will fail. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Based on some conversations especially with @GPortas early on, captured in a couple docs and possibly elsewhere, I thought the plan was:
Now it's looking like the plan is:
Is that right?