@kvs/types 0.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,9 @@ Install with [npm](https://www.npmjs.com/):
10
10
 
11
11
  ## Usage
12
12
 
13
- - [ ] Write usage instructions
13
+ ```ts
14
+ import type { KVS } from "@kvs/types";
15
+ ```
14
16
 
15
17
  ## Changelog
16
18
 
package/lib/index.d.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  export declare type StorageSchema = {
2
2
  [index: string]: any;
3
3
  };
4
- export declare type KnownKeys<T> = {
5
- [K in keyof T]: string extends K ? never : number extends K ? never : K;
6
- } extends {
7
- [_ in keyof T]: infer U;
8
- } ? U : never;
4
+ declare type HasIndexSignature<T> = T extends Record<infer K, any> ? K : never;
5
+ export declare type RemoveIndex<T> = {
6
+ [K in keyof T as symbol extends K ? never : string extends K ? never : number extends K ? never : K]: T[K];
7
+ };
8
+ export declare type KnownKeys<T> = keyof RemoveIndex<T>;
9
9
  /**
10
10
  * Extract known object store names from the DB schema type.
11
11
  *
12
12
  * @template DBTypes DB schema type, or unknown if the DB isn't typed.
13
13
  */
14
- export declare type StoreNames<DBTypes extends StorageSchema | unknown> = DBTypes extends StorageSchema ? KnownKeys<DBTypes> : string;
14
+ export declare type StoreNames<DBTypes extends StorageSchema | unknown> = DBTypes extends StorageSchema ? string extends HasIndexSignature<DBTypes> ? string : KnownKeys<DBTypes> : string;
15
15
  /**
16
16
  * Extract database value types from the DB schema type.
17
17
  *
@@ -107,3 +107,4 @@ export declare type KVSSyncOptions<Schema extends StorageSchema> = {
107
107
  newVersion: number;
108
108
  }): any;
109
109
  };
110
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvs/types",
3
- "version": "0.3.0",
3
+ "version": "2.0.0",
4
4
  "description": "A type definition for KVS.",
5
5
  "keywords": [
6
6
  "types",
@@ -31,10 +31,13 @@
31
31
  "build": "tsc -p .",
32
32
  "clean": "rimraf lib/ module/",
33
33
  "prettier": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"",
34
- "prepublish": "npm run clean && npm run build",
35
- "test": "npm run build",
34
+ "prepublishOnly": "npm run clean && npm run build",
35
+ "test": "tsc -p test",
36
36
  "watch": "tsc -p . --watch"
37
37
  },
38
+ "tsd": {
39
+ "directory": "test"
40
+ },
38
41
  "prettier": {
39
42
  "printWidth": 120,
40
43
  "singleQuote": false,
@@ -42,17 +45,14 @@
42
45
  "trailingComma": "none"
43
46
  },
44
47
  "devDependencies": {
45
- "@types/mocha": "^8.0.1",
46
- "@types/node": "^14.0.27",
47
- "mocha": "^8.1.1",
48
+ "@types/node": "^16.9.1",
48
49
  "prettier": "^2.0.5",
49
50
  "rimraf": "^3.0.2",
50
- "ts-node": "^8.10.2",
51
- "ts-node-test-register": "^8.0.1",
52
- "typescript": "^3.9.7"
51
+ "tsd": "^0.19.1",
52
+ "typescript": "^4.5.5"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "gitHead": "29ecd5a079ce0698ae822cc87344cf33532bad1e"
57
+ "gitHead": "b43dd2fdbefe4ee5714d0690b2f8f576dc8c1417"
58
58
  }
package/CHANGELOG.md DELETED
@@ -1,50 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [0.3.0](https://github.com/azu/kvs/compare/v0.2.1...v0.3.0) (2020-08-22)
7
-
8
-
9
- ### Features
10
-
11
- * **storage-sync:** add storage-sync package ([#11](https://github.com/azu/kvs/issues/11)) ([5748776](https://github.com/azu/kvs/commit/574877624202660c0427cd050d30e807d7bbbd26))
12
-
13
-
14
-
15
-
16
-
17
- ## [0.2.1](https://github.com/azu/kvs/compare/v0.2.0...v0.2.1) (2020-08-22)
18
-
19
- **Note:** Version bump only for package @kvs/types
20
-
21
-
22
-
23
-
24
-
25
- # [0.2.0](https://github.com/azu/kvs/compare/v0.1.0...v0.2.0) (2020-08-08)
26
-
27
-
28
- ### Features
29
-
30
- * **storage:** use Schema interface ([2560aae](https://github.com/azu/kvs/commit/2560aae28d642c8f2e8ee5920dc1cc15f7c8c3f6))
31
-
32
-
33
-
34
-
35
-
36
- # 0.1.0 (2020-08-08)
37
-
38
-
39
- ### Bug Fixes
40
-
41
- * add deps ([b72e91a](https://github.com/azu/kvs/commit/b72e91aaa2487d69d44200ef0a11cc0b5f8fb904))
42
-
43
-
44
- ### Features
45
-
46
- * add `close()` to interface ([a269d1d](https://github.com/azu/kvs/commit/a269d1dda6ce63388771e6fa4d897a26f284b72c))
47
- * **@kvs/localstorage:** add localstorage implementation ([54fc38b](https://github.com/azu/kvs/commit/54fc38b8a3a75923d8e8383af9c907979a2dba52))
48
- * **kvs/indexeddb:** add [Symbol.asyncIterator] ([68392d4](https://github.com/azu/kvs/commit/68392d4870b0679d53f0e778a73adbb175b02f06))
49
- * **kvs/indexeddb:** add dropInstance ([0a38a0c](https://github.com/azu/kvs/commit/0a38a0c9ca9f1f31b230c3acbde295099c30c428))
50
- * **kvs/indexeddb:** implement basic usage ([cc14444](https://github.com/azu/kvs/commit/cc144447ccca6795f7805c5e50a1754d6ce4f6a1))