0.5.0 • Published 7 months ago
@stash-it/core v0.5.0
@stash-it/core
Set of interfaces and types for @stash-it
, for main class, adapters and plugins (and some other things).
The main ones you'll be interested in are:
StashItAdapter
- base class used to create your own adaptersStashItPlugin
type to create your own plugins
See usage for examples.
Installation
npm
npx jsr add @stash-it/core
deno
deno add @stash-it/core
yarn
yarn dlx jsr add @stash-it/core
pnpm
pnpm dlx jsr add @stash-it/core
bun
bunx jsr add @stash-it/core
Usage
StashItAdapter
import { StashItAdapter } from "@stash-it/core";
// Your adapter class should extend from the base abstract class.
class MyAdapter extends StashItAdapter {
// Your implementation here.
}
The base class contains two methods, that you should implement if your adapter requires establishing a connection and/or disconnecting from a storage.
For instance:
import { StashItAdapter } from "@stash-it/core";
// Your adapter class should extend from the base abstract class.
class MyAdapter extends StashItAdapter {
override async connect(): Promise<void> {
// Depending on the storage, it can look different.
// For example:
this.#database.connect();
}
override async disconnect(): Promise<void> {
this.#database.connect();
}
}
StashItPlugin
import { type StashItPlugin } from "@stash-it/core";
// Your plugin can be a function that returns StashItPlugin:
const myPlugin = (someArgsIfNeedBe): StashItPlugin => {
// Your implementation here.
};
// It can also be an object, depends on what your plugin needs:
const myPlugin2: StashItPlugin = {
// Your implementation here.
};
License
MIT
Contribution
Feel free to open an issue or a pull request.
0.3.0
8 months ago
0.5.0
7 months ago
0.4.0
8 months ago
0.2.0
10 months ago
0.1.2
11 months ago
0.1.1
11 months ago
0.1.0
11 months ago
0.0.3
11 months ago
0.0.2
11 months ago
0.0.1
11 months ago
0.0.0-beta.13
11 months ago
0.0.0-beta.12
11 months ago
0.0.0-beta.11
11 months ago
0.0.0-beta.10
11 months ago
0.0.0-beta.9
11 months ago
0.0.0-beta.8
11 months ago
0.0.0-beta.7
12 months ago
0.0.0-beta.6
12 months ago
0.0.0-beta.5
12 months ago
0.0.0-beta.4
12 months ago
0.0.0-beta.1
1 year ago