@pc-nexus/storage 0.5.0-next.17 → 0.5.0-next.18
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/kvs/index.d.ts +2 -4
- package/lib/kvs/index.d.ts.map +1 -1
- package/lib/kvs/index.js +2 -4
- package/lib/kvs/kvs.d.ts +9 -0
- package/lib/kvs/kvs.d.ts.map +1 -0
- package/lib/kvs/kvs.js +26 -0
- package/lib/kvs/type.d.ts +13 -0
- package/lib/kvs/type.d.ts.map +1 -0
- package/lib/kvs/type.js +1 -0
- package/package.json +2 -2
package/lib/kvs/index.d.ts
CHANGED
package/lib/kvs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/kvs/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/kvs/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
|
package/lib/kvs/index.js
CHANGED
package/lib/kvs/kvs.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GetOptions, KvsSetResult, KvsValueType, SetOptions } from "./type.js";
|
|
2
|
+
declare class Kvs {
|
|
3
|
+
set(key: string, value: KvsValueType, options?: SetOptions): Promise<KvsSetResult>;
|
|
4
|
+
get(key: string, options?: GetOptions): Promise<KvsSetResult>;
|
|
5
|
+
delete(key: string): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare const kvs: Kvs;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=kvs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kvs.d.ts","sourceRoot":"","sources":["../../../src/lib/kvs/kvs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/E,cAAM,GAAG;IACQ,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;IAUlF,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;IAS7D,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAKlD;AACD,eAAO,MAAM,GAAG,KAAY,CAAC"}
|
package/lib/kvs/kvs.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { invoke } from "@pc-nexus/internal";
|
|
2
|
+
class Kvs {
|
|
3
|
+
async set(key, value, options) {
|
|
4
|
+
const response = await invoke("storage/kvs", "set", {
|
|
5
|
+
key,
|
|
6
|
+
value,
|
|
7
|
+
options,
|
|
8
|
+
});
|
|
9
|
+
const result = (await response.json());
|
|
10
|
+
return result.value;
|
|
11
|
+
}
|
|
12
|
+
async get(key, options) {
|
|
13
|
+
const response = await invoke("storage/kvs", "get", {
|
|
14
|
+
key,
|
|
15
|
+
options,
|
|
16
|
+
});
|
|
17
|
+
const result = (await response.json());
|
|
18
|
+
return result.value;
|
|
19
|
+
}
|
|
20
|
+
async delete(key) {
|
|
21
|
+
await invoke("storage/kvs", "delete", {
|
|
22
|
+
key,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export const kvs = new Kvs();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type KvsValueType = number | string | boolean | object | unknown[];
|
|
2
|
+
export interface SetOptions {
|
|
3
|
+
policy?: "OVERRIDE" | "FAIL_IF_EXISTS";
|
|
4
|
+
secret?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface KvsSetResult {
|
|
7
|
+
key: string;
|
|
8
|
+
value: KvsValueType;
|
|
9
|
+
}
|
|
10
|
+
export interface GetOptions {
|
|
11
|
+
secret?: boolean;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/lib/kvs/type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,EAAE,CAAC;AAE1E,MAAM,WAAW,UAAU;IACvB,MAAM,CAAC,EAAE,UAAU,GAAG,gBAAgB,CAAC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,YAAY,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
package/lib/kvs/type.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pc-nexus/storage",
|
|
3
|
-
"version": "0.5.0-next.
|
|
3
|
+
"version": "0.5.0-next.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"type": "module",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@pc-nexus/internal": "0.5.0-next.
|
|
33
|
+
"@pc-nexus/internal": "0.5.0-next.18",
|
|
34
34
|
"lodash": "^4.17.21"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {},
|