@kvs/types 1.1.0 → 2.1.1

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/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": "1.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "A type definition for KVS.",
5
5
  "keywords": [
6
6
  "types",
@@ -32,9 +32,12 @@
32
32
  "clean": "rimraf lib/ module/",
33
33
  "prettier": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"",
34
34
  "prepublishOnly": "npm run clean && npm run build",
35
- "test": "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": "8059a1e365484eab697477640c0dc7257d899db5"
57
+ "gitHead": "d8ec6e0ba796bc2cab189a395bcda9754ffc4c9e"
58
58
  }
package/CHANGELOG.md DELETED
@@ -1,69 +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
- # [1.1.0](https://github.com/azu/kvs/compare/v1.0.0...v1.1.0) (2020-10-29)
7
-
8
-
9
- ### Features
10
-
11
- * **examples:** add basic example ([#14](https://github.com/azu/kvs/issues/14)) ([351215d](https://github.com/azu/kvs/commit/351215d6c04158201768036caaa6e792c72717ea))
12
-
13
-
14
-
15
-
16
-
17
- # [1.0.0](https://github.com/azu/kvs/compare/v0.3.1...v1.0.0) (2020-08-22)
18
-
19
- **Note:** Version bump only for package @kvs/types
20
-
21
-
22
-
23
-
24
-
25
- # [0.3.0](https://github.com/azu/kvs/compare/v0.2.1...v0.3.0) (2020-08-22)
26
-
27
-
28
- ### Features
29
-
30
- * **storage-sync:** add storage-sync package ([#11](https://github.com/azu/kvs/issues/11)) ([5748776](https://github.com/azu/kvs/commit/574877624202660c0427cd050d30e807d7bbbd26))
31
-
32
-
33
-
34
-
35
-
36
- ## [0.2.1](https://github.com/azu/kvs/compare/v0.2.0...v0.2.1) (2020-08-22)
37
-
38
- **Note:** Version bump only for package @kvs/types
39
-
40
-
41
-
42
-
43
-
44
- # [0.2.0](https://github.com/azu/kvs/compare/v0.1.0...v0.2.0) (2020-08-08)
45
-
46
-
47
- ### Features
48
-
49
- * **storage:** use Schema interface ([2560aae](https://github.com/azu/kvs/commit/2560aae28d642c8f2e8ee5920dc1cc15f7c8c3f6))
50
-
51
-
52
-
53
-
54
-
55
- # 0.1.0 (2020-08-08)
56
-
57
-
58
- ### Bug Fixes
59
-
60
- * add deps ([b72e91a](https://github.com/azu/kvs/commit/b72e91aaa2487d69d44200ef0a11cc0b5f8fb904))
61
-
62
-
63
- ### Features
64
-
65
- * add `close()` to interface ([a269d1d](https://github.com/azu/kvs/commit/a269d1dda6ce63388771e6fa4d897a26f284b72c))
66
- * **@kvs/localstorage:** add localstorage implementation ([54fc38b](https://github.com/azu/kvs/commit/54fc38b8a3a75923d8e8383af9c907979a2dba52))
67
- * **kvs/indexeddb:** add [Symbol.asyncIterator] ([68392d4](https://github.com/azu/kvs/commit/68392d4870b0679d53f0e778a73adbb175b02f06))
68
- * **kvs/indexeddb:** add dropInstance ([0a38a0c](https://github.com/azu/kvs/commit/0a38a0c9ca9f1f31b230c3acbde295099c30c428))
69
- * **kvs/indexeddb:** implement basic usage ([cc14444](https://github.com/azu/kvs/commit/cc144447ccca6795f7805c5e50a1754d6ce4f6a1))