Skip to content

Commit

Permalink
feat: add extension storage api
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyWie committed Oct 18, 2023
1 parent 0438240 commit eb6a13d
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"version": "1.0.9",
"version": "1.1.0",
"packageManager": "[email protected]",
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/create-gopeed-ext/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-gopeed-ext",
"version": "1.0.9",
"version": "1.1.0",
"keywords": [
"gopeed"
],
Expand Down
4 changes: 2 additions & 2 deletions packages/create-gopeed-ext/templates/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"gopeed": "^1.0.9",
"@gopeed/types": "^1.0.9",
"gopeed": "^1.1.0",
"@gopeed/types": "^1.1.0",
"prettier": "^3.0.3",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/gopeed-rest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gopeed/rest",
"version": "1.0.9",
"version": "1.1.0",
"description": "",
"main": "dist/index.js",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/gopeed-types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gopeed/types",
"version": "1.0.9",
"version": "1.1.0",
"description": "",
"main": "dist/index.js",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/gopeed/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gopeed",
"version": "1.0.9",
"version": "1.1.0",
"description": "",
"main": "dist/index.js",
"exports": {
Expand Down
30 changes: 28 additions & 2 deletions packages/gopeed/src/extension/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,44 @@ import { Request, Resource } from '@gopeed/types';

type Settings = { [key: string]: unknown };

interface Storage {
/**
* Returns the current value associated with the given key, or null if the given key does not exist.
* @param key
*/
get(key: string): string;
/**
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
* @param key
* @param value
*/
set(key: string, value: string): void;
/**
* Removes the key/value pair with the given key, if a key/value pair with the given key exists.
* @param key
*/
remove(key: string): void;
/**
* Removes all key/value pairs, if any, that match the given key.
*/
clear(): void;
/**
* Returns all keys currently stored in the storage.
*/
keys(): string[];
}

interface OnResovleContext {
req: Request;
res: Resource;
settings: Settings;
storage: Storage;
}

interface Events {
onResolve(handler: (ctx: OnResovleContext) => void): void;
}

console.log();

interface Logger {
debug(message?: any, ...optionalParams: any[]): void;
info(message?: any, ...optionalParams: any[]): void;
Expand Down

0 comments on commit eb6a13d

Please sign in to comment.