https://github.com/dasch-swiss/dsp-js-lib
JavaScript library that handles API requests to DSP / Knora API
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
4 of 17 committers (23.5%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.5%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
JavaScript library that handles API requests to DSP / Knora API
Basic Info
- Host: GitHub
- Owner: dasch-swiss
- License: agpl-3.0
- Language: TypeScript
- Default Branch: main
- Homepage: https://dasch-swiss.github.io/dsp-js-lib/
- Size: 22.2 MB
Statistics
- Stars: 6
- Watchers: 7
- Forks: 3
- Open Issues: 45
- Releases: 128
Topics
Metadata Files
README.md
DSP-JS-LIB — A library to easily connect to DSP-API (Knora)
Introduction
Purpose of DSP-JS-LIB
The purpose of DSP-JS-LIB is to facilitate the communication with DSP-API in web clients developed with TypeScript/JavaScript. DSP-JS-LIB depends on RxJS and is web framework agnostic (it can be used with Angular, React, Vue.js etc.).
DSP-JS-LIB offers the following features:
- handling of HTTP calls to connect to DSP-API
- (de)serialisation from and to JSON-LD so the web client can work with classes instead
- methods that combine different HTTP calls to DSP-API into one method call
- caching for different types of data so fewer HTTP calls to DSP-API have to be performed
Basic Structure of DSP-JS-LIB
DSP-JS-LIB's architecture is based on endpoints that correspond to DSP-API's endpoints.
The following main endpoints are available through DSP-JS-LIB:
- admin (
AdminEndpoint): getting and modifying users, projects, permissions etc. - v2 (
V2Endpoint): requesting and modifying resources and values using DSP-API version 2. - system (
SystemEndpoint): DSP-API's health status.
Each of these main endpoints offers endpoints for specific operations.
Admin
- admin.usersEndpoint (
UsersEndpointAdmin): offers methods to administer users. - admin.groupsEndpoint (
GroupsEndpointAdmin): offers methods to administer groups. - admin.projectsEndpoint (
ProjectsEndpointAdmin): offers methods to administer projects. - admin.permissionsEndpoint (
PermissionsEndpointAdmin): offers methods to administer permissions. - admin.listsEndpoint (
ListsEndpointAdmin): offers methods to administer lists.
V2
- v2.auth (
AuthenticationEndpointV2): offers methods to authenticate. - v2.onto (
OntologiesEndpointV2): offers methods to get ontology information. - v2.res (
ResourcesEndpointV2): offers methods to work with resources. - v2.values (
ValuesEndpointV2): offers methods to work with values. - v2.list (
ListsEndpointV2): offers methods to retrieve list nodes and lists. - v2.search (
SearchEndpointV2): offers methods to search. - v2.metadata (
ProjectMetadataEndpointV2): offers methods to work with project metadata.
System
- system.healthEndpoint (
HealthEndpointSystem): offers methods to get DSP-API's status.
Consult the API docs for more details about the available endpoints. For each main endpoint, you'll find a category in the API docs:
- admin:
Endpoint Admin Classes - v2:
Endpoint V2 Classes - system:
Endpoint System Classes
You can also use the full text search to search for an endpoint's class name within the API docs, e.g., ResourcesEndpointV2.
See section Getting started for more usage information.
See design documentation for a detailed description of DSP-JS-LIB's design and architecture.
RxJS Observables
DSP-JS-LIB's endpoints return observables to the client.
An Observable represents the result of an asynchronous request to DSP-API that will either succeed or fail.
An Observable is an RxJS construct that the client can subscribe to.
Getting started
Install DSP-JS-LIB
Run npm install @dasch-swiss/dsp-js --save to install DSP-JS-LIB in your npm project.
Dependencies and Peer Dependencies
DSP-JS-LIB depends on jsonld and json2typescript.
These dependencies will be installed when you run npm install in your project.
RxJS is a peer dependency of this library and is not installed when running npm install.
Note that DSP-JS-LIB requires major version 6 of rxjs.
Make sure that the framework you are using, e.g., Angular, requires major version 6 of RxJS to ensure the peer dependency will be met.
Otherwise, install it with npm install rxjs@6.x --save.
Start Using DSP-JS-LIB
In order to get started using DSP-JS-LIB, you have to create a KnoraApiConfig instance and pass it to KnoraApiConnection's constructor:
```typescript // import from DSP-JS-LIB import { KnoraApiConfig, KnoraApiConnection } from "@dasch-swiss/dsp-js";
// create the configuration const config: KnoraApiConfig = new KnoraApiConfig("https", "api.dasch.swiss");
// create a connection instance const knoraApiConnection: KnoraApiConnection = new KnoraApiConnection(config); ```
Once you have set up the connection instance, you can use any of DSP-JS-LIB's endpoints to perform requests to DSP-API:
```typescript // formal example knoraApiConnection.[mainEndpoint].[endpoint].[method(...)]
// admin users endpoint example, see UsersEndpointAdmin in API docs knoraApiConnection.admin.usersEndpoint.getUserByIri("userIri").subscribe(...);
// v2 search endpoint example, see SearchEndpointV2 in API docs knoraApiConnection.v2.search.doFulltextSearch("searchLabel").subscribe(...);
// system health endpoint example, see HealthEndpointSystem in API docs knoraApiConnection.system.getHealthStatus().subscribe(...); ```
In the following full example, we are requesting a resource from DSP-API:
typescript
// request a resource using the resources endpoint from v2
knoraApiConnection.v2.res.getResource(iri).subscribe(
(resource: ReadResource) => {
// "resource" represents a resource retrieved from DSP-API
console.log(res);
},
(error) => {
// if, for some reason, the request failed
console.error(error);
}
);
For more information about available endpoints and methods, consult the API docs.
Publish to NPM
The repo is set up to automatically publish a new version to NPM when a new tag release is created (see Github Actions)
Release Notes
For the release notes see GitHub releases.
Developing DSP-JS-LIB
Owner
- Name: DaSCH - Swiss National Data and Service Center for the Humanities
- Login: dasch-swiss
- Kind: organization
- Email: info@dasch.swiss
- Location: Switzerland
- Website: https://dasch.swiss
- Twitter: DaSCHSwiss
- Repositories: 35
- Profile: https://github.com/dasch-swiss
Development repositories of the DaSCH.
GitHub Events
Total
- Release event: 9
- Delete event: 35
- Issue comment event: 19
- Push event: 81
- Pull request review event: 21
- Pull request review comment event: 6
- Pull request event: 58
- Create event: 47
Last Year
- Release event: 9
- Delete event: 35
- Issue comment event: 19
- Push event: 81
- Pull request review event: 21
- Pull request review comment event: 6
- Pull request event: 58
- Create event: 47
Committers
Last synced: almost 3 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Tobias Schweizer | t****r@u****m | 100 |
| André Kilchenmann | g****b@m****h | 67 |
| Tobias Schweizer | t****r@u****h | 65 |
| DaSCH Bot | 5****t@u****m | 52 |
| mdelez | 6****z@u****m | 45 |
| dependabot[bot] | 4****]@u****m | 40 |
| Andreas Aeschlimann | a****n@a****h | 39 |
| Marcin Procyk | m****k@d****s | 23 |
| André Kilchenmann | a****n@d****s | 17 |
| Lukas Rosenthaler | l****r@u****h | 7 |
| Ivan Subotic | 4****c@u****m | 3 |
| Flavie L | f****s@d****s | 2 |
| Benjamin Geer | b****r@u****h | 2 |
| Loïc Jaouen | l****n@u****h | 1 |
| Sepideh Alassi | s****i@u****h | 1 |
| Balduin Landolt | 3****t@u****m | 1 |
| irinaschubert | i****t@d****s | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 0
- Total pull requests: 254
- Average time to close issues: N/A
- Average time to close pull requests: 29 days
- Total issue authors: 0
- Total pull request authors: 13
- Average comments per issue: 0
- Average comments per pull request: 0.49
- Merged pull requests: 202
- Bot issues: 0
- Bot pull requests: 61
Past Year
- Issues: 0
- Pull requests: 42
- Average time to close issues: N/A
- Average time to close pull requests: 6 days
- Issue authors: 0
- Pull request authors: 4
- Average comments per issue: 0
- Average comments per pull request: 0.45
- Merged pull requests: 37
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- daschbot (93)
- dependabot[bot] (72)
- mpro7 (47)
- derschnee68 (40)
- mdelez (32)
- domsteinbach (11)
- irmastnt (5)
- kilchenmann (3)
- BalduinLandolt (2)
- seakayone (2)
- subotic (2)
- Vijeinath (2)
- tobiasschweizer (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- 413 dependencies
- @babel/helper-hoist-variables ^7.16.7 development
- @types/jasmine ^3.6.0 development
- @types/jasmine-ajax ^3.3.3 development
- @types/node ^12.20.43 development
- jasmine ^3.99.0 development
- jasmine-ajax ^4.0.0 development
- karma ^6.3.13 development
- karma-chrome-launcher ^3.1.0 development
- karma-jasmine ^2.0.1 development
- karma-jasmine-ajax ^0.1.13 development
- karma-mocha-reporter ^2.2.5 development
- karma-typescript ^5.5.3 development
- phantomjs-prebuilt ^2.1.16 development
- tslint ^6.1.0 development
- typedoc ^0.22.11 development
- typescript 4.5.5 development
- @babel/helper-compilation-targets ^7.16.7
- @types/jsonld ^1.5.6
- json2typescript 1.4.1
- jsonld ^5.2.0
- 965 dependencies
- @angular-devkit/build-angular ^13.2.1 development
- @angular/cli ~13.2.1 development
- @angular/compiler-cli ~13.2.0 development
- @angular/language-service ~13.2.0 development
- @types/jasmine ~3.6.11 development
- @types/jasminewd2 ~2.0.3 development
- @types/node ^12.11.1 development
- codelyzer ^6.0.0 development
- jasmine-core ~3.6.0 development
- jasmine-spec-reporter ~5.0.2 development
- karma ~6.3.16 development
- karma-chrome-launcher ~3.1.0 development
- karma-coverage-istanbul-reporter ~3.0.2 development
- karma-jasmine ~4.0.0 development
- karma-jasmine-html-reporter ^1.5.0 development
- protractor ~7.0.0 development
- ts-node ~7.0.1 development
- tslint ~6.1.0 development
- typescript ~4.5.5 development
- @angular/animations ~13.2.0
- @angular/common ~13.2.0
- @angular/compiler ~13.2.0
- @angular/core ~13.2.0
- @angular/forms ~13.2.0
- @angular/platform-browser ~13.2.0
- @angular/platform-browser-dynamic ~13.2.0
- @angular/router ~13.2.0
- @dasch-swiss/dsp-js file:.yalc/@dasch-swiss/dsp-js
- core-js ^2.6.12
- rxjs ^6.6.7
- tslib ^2.0.0
- zone.js ~0.11.4