# @rezasoltani/solid-typeindex-support

> See [Docs](https://pondersource.github.io/solid-typeindex-support/)

Latest version **0.0.7** (published 2024-01-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rezasoltani/solid-typeindex-support
pnpm add @rezasoltani/solid-typeindex-support
yarn add @rezasoltani/solid-typeindex-support
bun add @rezasoltani/solid-typeindex-support
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2024-01-12 |
| First published | 2023-12-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 21.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Reza Soltani |
| Maintainers | soltanireza54 |
| Keywords | typescript, npm, template, ts |

## Links

- npm: https://www.npmjs.com/package/@rezasoltani/solid-typeindex-support
- Repository: https://github.com/pondersource/solid-typeindex-support
- Homepage: https://github.com/pondersource/solid-typeindex-support#readme
- Issues: https://github.com/pondersource/solid-typeindex-support/issues
- npm.io page: https://npm.io/package/@rezasoltani/solid-typeindex-support

## Dependencies (3)

- [@rdfjs/data-model](https://npm.io/package/@rdfjs/data-model.md) ^1.3.4
- [@inrupt/solid-client](https://npm.io/package/@inrupt/solid-client.md) ^1.30.2
- [@inrupt/vocab-common-rdf](https://npm.io/package/@inrupt/vocab-common-rdf.md) ^1.0.5

## Alternatives

- [csv-to-markdown-table](https://npm.io/package/csv-to-markdown-table.md) — 47.0K weekly downloads
- [@sapphire/ratelimits](https://npm.io/package/@sapphire/ratelimits.md) — 4.4K weekly downloads
- [js-csvparser](https://npm.io/package/js-csvparser.md) — 2.0K weekly downloads
- [@adadapted/js-sdk](https://npm.io/package/@adadapted/js-sdk.md) — 251 weekly downloads
- [@grapecity/spread-sheets-sparklines](https://npm.io/package/@grapecity/spread-sheets-sparklines.md) — 103 weekly downloads

## Recent versions

- 0.0.7 (latest) — 2024-01-12
- 0.0.6 — 2024-01-12
- 0.0.5 — 2024-01-09
- 0.0.4 — 2023-12-28
- 0.0.3 — 2023-12-28
- 0.0.2 — 2023-12-21
- 0.0.1 — 2023-12-13

## README

# solid-typeindex-support

See [Docs](https://pondersource.github.io/solid-typeindex-support/)

## Development

```bash
git clone https://github.com/pondersource/solid-typeindex-support
npm install
npm run test
```

## Dependencies:
- `@inrupt/solid-client`: This module provides methods for interacting with the Solid Pod.
- `@inrupt/vocab-common-rdf`: This module provides methods for working with RDF data.
- `@rdfjs/data-model`: This module provides methods for working with RDF data.


## Usage
```bash
mpm install @rezasoltani/solid-typeindex-support
```

```typescript
import { TypeIndexHelper } from '@rezasoltani/solid-typeindex-support';

const webId = 'https://example.com/profile#me';
const solidInstanceUrl = 'https://example.com/type-index.ttl';
const rdfClass = "http://schema.org/Book";

const instances = await TypeIndexHelper.getFromTypeIndex(webId, rdfClass, fetch, true);

const updatedIndex = await TypeIndexHelper.registerInTypeIndex(webId, 'My Book List', rdfClass, fetch, solidInstanceUrl, true);

```

## Classes

|  Class | Description |
|  --- | --- |
|  TypeIndexHelper | TypeIndexHelper provides helper methods for working with typeIndexes in Solid. This includes methods for getting and updating a user's public and private typeIndexes. |


## Methods

|  Method | Modifiers | Description |
|  --- | --- | --- |
|  getFromTypeIndex(webId, rdfClass, fetch, isPrivate) | <code>static</code> | Retrieves all instances of the given RDF class from the user's typeIndexe. |
|  registerInTypeIndex(webId, typeRegistrationTitle, rdfClass, fetch, solidInstanceUrl, isPrivate) | <code>static</code> | Registers a type registration in the user's typeIndexe. |




## TypeIndexHelper.getFromTypeIndex() method

Retrieves all instances of the given RDF class from the user's typeIndexe.

**Signature:**

```typescript
static getFromTypeIndex(webId: string, rdfClass: string, fetch: any, isPrivate: true): Promise<string[]>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  webId | string | The user's WebID |
|  rdfClass | string | The RDF class to retrieve instances for |
|  fetch | any | Authenticated fetch function |
|  isPrivate | true | Whether the typeIndexe is private or public |

**Returns:**

Promise&lt;string\[\]&gt;



## TypeIndexHelper.registerInTypeIndex() method

Registers a type registration in the user's typeIndexe.

**Signature:**

```typescript
static registerInTypeIndex(webId: string, typeRegistrationTitle: string, rdfClass: string, fetch: any, solidInstanceUrl: string, isPrivate: boolean): Promise<SolidDataset>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  webId | string | The WebID of the user |
|  typeRegistrationTitle | string | The title to use for the type registration |
|  rdfClass | string | The RDF class that this registration is for |
|  fetch | any | The authenticated fetch function |
|  solidInstanceUrl | string | The URL of the index being registered |
|  isPrivate | boolean | Whether to register in the private or public typeIndexe |

**Returns:**

Promise&lt;SolidDataset&gt;

A Promise resolving to the updated typeIndexe dataset

---
_Source: https://npm.io/package/@rezasoltani/solid-typeindex-support · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
