@bsv/sdk 1.4.15 → 1.4.17
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/dist/cjs/mod.js +1 -0
- package/dist/cjs/mod.js.map +1 -1
- package/dist/cjs/package.json +9 -9
- package/dist/cjs/src/kvstore/LocalKVStore.js +268 -0
- package/dist/cjs/src/kvstore/LocalKVStore.js.map +1 -0
- package/dist/cjs/src/kvstore/index.js +9 -0
- package/dist/cjs/src/kvstore/index.js.map +1 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/mod.js +1 -0
- package/dist/esm/mod.js.map +1 -1
- package/dist/esm/src/kvstore/LocalKVStore.js +263 -0
- package/dist/esm/src/kvstore/LocalKVStore.js.map +1 -0
- package/dist/esm/src/kvstore/index.js +2 -0
- package/dist/esm/src/kvstore/index.js.map +1 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/mod.d.ts +1 -0
- package/dist/types/mod.d.ts.map +1 -1
- package/dist/types/src/kvstore/LocalKVStore.d.ts +79 -0
- package/dist/types/src/kvstore/LocalKVStore.d.ts.map +1 -0
- package/dist/types/src/kvstore/index.d.ts +2 -0
- package/dist/types/src/kvstore/index.d.ts.map +1 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +1 -1
- package/docs/identity.md +225 -0
- package/docs/kvstore.md +132 -0
- package/docs/registry.md +383 -0
- package/docs/transaction.md +3 -3
- package/mod.ts +2 -1
- package/package.json +19 -9
- package/src/kvstore/LocalKVStore.ts +282 -0
- package/src/kvstore/__tests/LocalKVStore.test.ts +703 -0
- package/src/kvstore/index.ts +1 -0
- package/docs/wallet-substrates.md +0 -1194
package/dist/cjs/mod.js
CHANGED
|
@@ -32,4 +32,5 @@ __exportStar(require("./src/overlay-tools/index.js"), exports);
|
|
|
32
32
|
__exportStar(require("./src/storage/index.js"), exports);
|
|
33
33
|
__exportStar(require("./src/identity/index.js"), exports);
|
|
34
34
|
__exportStar(require("./src/registry/index.js"), exports);
|
|
35
|
+
__exportStar(require("./src/kvstore/index.js"), exports);
|
|
35
36
|
//# sourceMappingURL=mod.js.map
|
package/dist/cjs/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../mod.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAAyC;AACzC,wDAAqC;AACrC,kEAA+C;AAC/C,6DAA0C;AAC1C,wEAAqD;AACrD,0EAAuD;AACvD,2EAAwD;AACxD,kEAA+C;AAC/C,0DAAuC;AACvC,wDAAqC;AACrC,sDAAmC;AACnC,wDAAqC;AACrC,mEAAgD;AAChD,sDAAmC;AACnC,+DAA4C;AAC5C,yDAAsC;AACtC,0DAAuC;AACvC,0DAAuC"}
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../mod.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAAyC;AACzC,wDAAqC;AACrC,kEAA+C;AAC/C,6DAA0C;AAC1C,wEAAqD;AACrD,0EAAuD;AACvD,2EAAwD;AACxD,kEAA+C;AAC/C,0DAAuC;AACvC,wDAAqC;AACrC,sDAAmC;AACnC,wDAAqC;AACrC,mEAAgD;AAChD,sDAAmC;AACnC,+DAA4C;AAC5C,yDAAsC;AACtC,0DAAuC;AACvC,0DAAuC;AACvC,yDAAsC"}
|
package/dist/cjs/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bsv/sdk",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.17",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "BSV Blockchain Software Development Kit",
|
|
6
6
|
"files": [
|
|
@@ -41,23 +41,23 @@
|
|
|
41
41
|
},
|
|
42
42
|
"homepage": "https://github.com/bitcoin-sv/ts-sdk#readme",
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@eslint/js": "^9.
|
|
44
|
+
"@eslint/js": "^9.23.0",
|
|
45
45
|
"@jest/globals": "^29.7.0",
|
|
46
46
|
"@types/jest": "^29.5.14",
|
|
47
47
|
"@types/node": "^22.13.14",
|
|
48
|
-
"eslint": "^
|
|
49
|
-
"globals": "^
|
|
48
|
+
"eslint": "^9.23.0",
|
|
49
|
+
"globals": "^16.0.0",
|
|
50
50
|
"jest": "^29.7.0",
|
|
51
51
|
"jest-environment-jsdom": "^29.7.0",
|
|
52
|
-
"ts-jest": "^29.
|
|
53
|
-
"ts-loader": "^9.5.
|
|
52
|
+
"ts-jest": "^29.3.1",
|
|
53
|
+
"ts-loader": "^9.5.2",
|
|
54
54
|
"ts-standard": "^12.0.2",
|
|
55
55
|
"ts2md": "^0.2.8",
|
|
56
56
|
"tsconfig-to-dual-package": "^1.2.0",
|
|
57
57
|
"typescript": "5.1",
|
|
58
|
-
"typescript-eslint": "^8.
|
|
59
|
-
"webpack": "^5.
|
|
60
|
-
"webpack-cli": "^
|
|
58
|
+
"typescript-eslint": "^8.29.0",
|
|
59
|
+
"webpack": "^5.98.0",
|
|
60
|
+
"webpack-cli": "^6.0.1"
|
|
61
61
|
},
|
|
62
62
|
"ts-standard": {
|
|
63
63
|
"project": "tsconfig.eslint.json",
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const LockingScript_js_1 = __importDefault(require("../script/LockingScript.js"));
|
|
30
|
+
const PushDrop_js_1 = __importDefault(require("../script/templates/PushDrop.js"));
|
|
31
|
+
const Utils = __importStar(require("../primitives/utils.js"));
|
|
32
|
+
const WalletClient_js_1 = __importDefault(require("../wallet/WalletClient.js"));
|
|
33
|
+
const Transaction_js_1 = __importDefault(require("../transaction/Transaction.js"));
|
|
34
|
+
/**
|
|
35
|
+
* Implements a key-value storage system backed by transaction outputs managed by a wallet.
|
|
36
|
+
* Each key-value pair is represented by a PushDrop token output in a specific context (basket).
|
|
37
|
+
* Allows setting, getting, and removing key-value pairs, with optional encryption.
|
|
38
|
+
*/
|
|
39
|
+
class LocalKVStore {
|
|
40
|
+
/**
|
|
41
|
+
* Creates an instance of the localKVStore.
|
|
42
|
+
*
|
|
43
|
+
* @param {WalletInterface} [wallet=new WalletClient()] - The wallet interface to use. Defaults to a new WalletClient instance.
|
|
44
|
+
* @param {string} [context='kvstore-default'] - The context (basket) for namespacing keys. Defaults to 'kvstore-default'.
|
|
45
|
+
* @param {boolean} [encrypt=true] - Whether to encrypt values. Defaults to true.
|
|
46
|
+
* @param {string} [originator] — An originator to use with PushDrop and the wallet, if provided.
|
|
47
|
+
* @throws {Error} If the context is missing or empty.
|
|
48
|
+
*/
|
|
49
|
+
constructor(wallet = new WalletClient_js_1.default(), context = 'kvstore-default', encrypt = true, originator) {
|
|
50
|
+
if (typeof context !== 'string' || context.length < 1) {
|
|
51
|
+
throw new Error('A context in which to operate is required.');
|
|
52
|
+
}
|
|
53
|
+
this.wallet = wallet;
|
|
54
|
+
this.context = context;
|
|
55
|
+
this.encrypt = encrypt;
|
|
56
|
+
this.originator = originator;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Retrieves the value associated with a given key.
|
|
60
|
+
*
|
|
61
|
+
* @param {string} key - The key to retrieve the value for.
|
|
62
|
+
* @param {string | undefined} [defaultValue=undefined] - The value to return if the key is not found.
|
|
63
|
+
* @returns {Promise<string | undefined>} A promise that resolves to the value as a string,
|
|
64
|
+
* the defaultValue if the key is not found, or undefined if no defaultValue is provided.
|
|
65
|
+
* @throws {Error} If multiple outputs are found for the key (ambiguous state).
|
|
66
|
+
* @throws {Error} If the found output's locking script cannot be decoded or represents an invalid token format.
|
|
67
|
+
*/
|
|
68
|
+
async get(key, defaultValue = undefined) {
|
|
69
|
+
const results = await this.wallet.listOutputs({
|
|
70
|
+
basket: this.context,
|
|
71
|
+
tags: [key],
|
|
72
|
+
include: 'locking scripts'
|
|
73
|
+
});
|
|
74
|
+
if (results.outputs.length === 0) {
|
|
75
|
+
return defaultValue;
|
|
76
|
+
}
|
|
77
|
+
else if (results.outputs.length > 1) {
|
|
78
|
+
throw new Error('Multiple tokens found for this key. You need to call set to collapse this ambiguous state before you can get this value again.');
|
|
79
|
+
}
|
|
80
|
+
let fields;
|
|
81
|
+
try {
|
|
82
|
+
if (typeof results.outputs[0].lockingScript !== 'string') {
|
|
83
|
+
throw new Error('No locking script');
|
|
84
|
+
}
|
|
85
|
+
const decoded = PushDrop_js_1.default.decode(LockingScript_js_1.default.fromHex(results.outputs[0].lockingScript));
|
|
86
|
+
if (decoded.fields.length !== 1) {
|
|
87
|
+
throw new Error('Invalid token.');
|
|
88
|
+
}
|
|
89
|
+
fields = decoded.fields;
|
|
90
|
+
}
|
|
91
|
+
catch (_) {
|
|
92
|
+
throw new Error(`Invalid value found. You need to call set to collapse the corrupted state (or relinquish the corrupted ${results.outputs[0].outpoint} output from the ${this.context} basket) before you can get this value again.`);
|
|
93
|
+
}
|
|
94
|
+
if (!this.encrypt) {
|
|
95
|
+
return Utils.toUTF8(fields[0]);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
const { plaintext } = await this.wallet.decrypt({
|
|
99
|
+
protocolID: [2, this.context],
|
|
100
|
+
keyID: key,
|
|
101
|
+
ciphertext: fields[0]
|
|
102
|
+
});
|
|
103
|
+
return Utils.toUTF8(plaintext);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Sets or updates the value associated with a given key.
|
|
108
|
+
* If the key already exists (one or more outputs found), it spends the existing output(s)
|
|
109
|
+
* and creates a new one with the updated value. If multiple outputs exist for the key,
|
|
110
|
+
* they are collapsed into a single new output.
|
|
111
|
+
* If the key does not exist, it creates a new output.
|
|
112
|
+
* Handles encryption if enabled.
|
|
113
|
+
* If signing the update/collapse transaction fails, it relinquishes the original outputs and starts over with a new chain.
|
|
114
|
+
*
|
|
115
|
+
* @param {string} key - The key to set or update.
|
|
116
|
+
* @param {string} value - The value to associate with the key.
|
|
117
|
+
* @returns {Promise<OutpointString>} A promise that resolves to the outpoint string (txid.vout) of the new or updated token output.
|
|
118
|
+
*/
|
|
119
|
+
async set(key, value) {
|
|
120
|
+
let valueAsArray = Utils.toArray(value, 'utf8');
|
|
121
|
+
if (this.encrypt) {
|
|
122
|
+
const { ciphertext } = await this.wallet.encrypt({
|
|
123
|
+
plaintext: valueAsArray,
|
|
124
|
+
protocolID: [2, this.context],
|
|
125
|
+
keyID: key
|
|
126
|
+
});
|
|
127
|
+
valueAsArray = ciphertext;
|
|
128
|
+
}
|
|
129
|
+
const pushdrop = new PushDrop_js_1.default(this.wallet, this.originator);
|
|
130
|
+
const lockingScript = await pushdrop.lock([valueAsArray], [2, this.context], key, 'self');
|
|
131
|
+
const results = await this.wallet.listOutputs({
|
|
132
|
+
basket: this.context,
|
|
133
|
+
tags: [key],
|
|
134
|
+
include: 'entire transactions'
|
|
135
|
+
});
|
|
136
|
+
if (results.totalOutputs !== 0) {
|
|
137
|
+
try {
|
|
138
|
+
const inputs = [];
|
|
139
|
+
for (let i = 0; i < results.outputs.length; i++) {
|
|
140
|
+
inputs.push({
|
|
141
|
+
outpoint: results.outputs[i].outpoint,
|
|
142
|
+
unlockingScriptLength: 74,
|
|
143
|
+
inputDescription: 'Previous key-value token'
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
const { signableTransaction } = await this.wallet.createAction({
|
|
147
|
+
description: `Update ${key} in ${this.context}`,
|
|
148
|
+
inputBEEF: results.BEEF,
|
|
149
|
+
inputs,
|
|
150
|
+
outputs: [{
|
|
151
|
+
lockingScript: lockingScript.toHex(),
|
|
152
|
+
satoshis: 1,
|
|
153
|
+
outputDescription: 'Key-value token'
|
|
154
|
+
}],
|
|
155
|
+
options: {
|
|
156
|
+
acceptDelayedBroadcast: false,
|
|
157
|
+
randomizeOutputs: false
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
if (typeof signableTransaction !== 'object') {
|
|
161
|
+
throw new Error('Wallet did not return a signable transaction when expected.');
|
|
162
|
+
}
|
|
163
|
+
const tx = Transaction_js_1.default.fromAtomicBEEF(signableTransaction.tx);
|
|
164
|
+
const spends = {};
|
|
165
|
+
for (let i = 0; i < results.outputs.length; i++) {
|
|
166
|
+
const unlocker = pushdrop.unlock([2, this.context], key, 'self');
|
|
167
|
+
const unlockingScript = await unlocker.sign(tx, i);
|
|
168
|
+
spends[i] = {
|
|
169
|
+
unlockingScript: unlockingScript.toHex()
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
const { txid } = await this.wallet.signAction({
|
|
173
|
+
reference: signableTransaction.reference,
|
|
174
|
+
spends
|
|
175
|
+
});
|
|
176
|
+
return `${txid}.0`;
|
|
177
|
+
}
|
|
178
|
+
catch (_) {
|
|
179
|
+
// Signing failed, relinquish original outputs
|
|
180
|
+
for (let i = 0; i < results.outputs.length; i++) {
|
|
181
|
+
await this.wallet.relinquishOutput({
|
|
182
|
+
output: results.outputs[i].outpoint,
|
|
183
|
+
basket: this.context
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
const { txid } = await this.wallet.createAction({
|
|
189
|
+
description: `Set ${key} in ${this.context}`,
|
|
190
|
+
outputs: [{
|
|
191
|
+
lockingScript: lockingScript.toHex(),
|
|
192
|
+
satoshis: 1,
|
|
193
|
+
outputDescription: 'Key-value token'
|
|
194
|
+
}],
|
|
195
|
+
options: {
|
|
196
|
+
acceptDelayedBroadcast: false,
|
|
197
|
+
randomizeOutputs: false
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
return `${txid}.0`;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Removes the key-value pair associated with the given key.
|
|
204
|
+
* It finds the existing output(s) for the key and spends them without creating a new output.
|
|
205
|
+
* If multiple outputs exist, they are all spent in the same transaction.
|
|
206
|
+
* If the key does not exist, it does nothing.
|
|
207
|
+
* If signing the removal transaction fails, it relinquishes the original outputs instead of spending.
|
|
208
|
+
*
|
|
209
|
+
* @param {string} key - The key to remove.
|
|
210
|
+
* @returns {Promise<string | void>} A promise that resolves to the txid of the removal transaction if successful.
|
|
211
|
+
*/
|
|
212
|
+
async remove(key) {
|
|
213
|
+
const results = await this.wallet.listOutputs({
|
|
214
|
+
basket: this.context,
|
|
215
|
+
tags: [key],
|
|
216
|
+
include: 'entire transactions'
|
|
217
|
+
});
|
|
218
|
+
if (results.totalOutputs === 0) {
|
|
219
|
+
return; // Key not found, do nothing
|
|
220
|
+
}
|
|
221
|
+
const pushdrop = new PushDrop_js_1.default(this.wallet, this.originator);
|
|
222
|
+
try {
|
|
223
|
+
const inputs = [];
|
|
224
|
+
for (let i = 0; i < results.outputs.length; i++) {
|
|
225
|
+
inputs.push({
|
|
226
|
+
outpoint: results.outputs[i].outpoint,
|
|
227
|
+
unlockingScriptLength: 74,
|
|
228
|
+
inputDescription: 'Previous key-value token'
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
const { signableTransaction } = await this.wallet.createAction({
|
|
232
|
+
description: `Remove ${key} in ${this.context}`,
|
|
233
|
+
inputBEEF: results.BEEF,
|
|
234
|
+
inputs,
|
|
235
|
+
options: {
|
|
236
|
+
acceptDelayedBroadcast: false
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
if (typeof signableTransaction !== 'object') {
|
|
240
|
+
throw new Error('Wallet did not return a signable transaction when expected.');
|
|
241
|
+
}
|
|
242
|
+
const tx = Transaction_js_1.default.fromAtomicBEEF(signableTransaction.tx);
|
|
243
|
+
const spends = {};
|
|
244
|
+
for (let i = 0; i < results.outputs.length; i++) {
|
|
245
|
+
const unlocker = pushdrop.unlock([2, this.context], key, 'self');
|
|
246
|
+
const unlockingScript = await unlocker.sign(tx, i);
|
|
247
|
+
spends[i] = {
|
|
248
|
+
unlockingScript: unlockingScript.toHex()
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
const { txid } = await this.wallet.signAction({
|
|
252
|
+
reference: signableTransaction.reference,
|
|
253
|
+
spends
|
|
254
|
+
});
|
|
255
|
+
return txid;
|
|
256
|
+
}
|
|
257
|
+
catch (_) {
|
|
258
|
+
for (let i = 0; i < results.outputs.length; i++) {
|
|
259
|
+
await this.wallet.relinquishOutput({
|
|
260
|
+
output: results.outputs[i].outpoint,
|
|
261
|
+
basket: this.context
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
exports.default = LocalKVStore;
|
|
268
|
+
//# sourceMappingURL=LocalKVStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalKVStore.js","sourceRoot":"","sources":["../../../../src/kvstore/LocalKVStore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kFAAsD;AACtD,kFAAsD;AACtD,8DAA+C;AAE/C,gFAAoD;AACpD,mFAAuD;AAEvD;;;;GAIG;AACH,MAAqB,YAAY;IA2B/B;;;;;;;;OAQG;IACH,YACE,SAA0B,IAAI,yBAAY,EAAE,EAC5C,OAAO,GAAG,iBAAiB,EAC3B,OAAO,GAAG,IAAI,EACd,UAAmB;QAEnB,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;YACrD,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;SAC9D;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,GAAG,CAAE,GAAW,EAAE,eAAmC,SAAS;QAClE,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;YAC5C,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,IAAI,EAAE,CAAC,GAAG,CAAC;YACX,OAAO,EAAE,iBAAiB;SAC3B,CAAC,CAAA;QACF,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YAChC,OAAO,YAAY,CAAA;SACpB;aAAM,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;YACrC,MAAM,IAAI,KAAK,CAAC,gIAAgI,CAAC,CAA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S;gBACxC,MAAM;aACP,CAAC,CAAA;YACF,OAAO,IAAI,CAAA;SACZ;QAAC,OAAO,CAAC,EAAE;YACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC/C,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC;oBACjC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ;oBACnC,MAAM,EAAE,IAAI,CAAC,OAAO;iBACrB,CAAC,CAAA;aACH;SACF;IACH,CAAC;CACF;AA7QD,+BA6QC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LocalKVStore = void 0;
|
|
7
|
+
var LocalKVStore_js_1 = require("./LocalKVStore.js");
|
|
8
|
+
Object.defineProperty(exports, "LocalKVStore", { enumerable: true, get: function () { return __importDefault(LocalKVStore_js_1).default; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/kvstore/index.ts"],"names":[],"mappings":";;;;;;AAAA,qDAA2D;AAAlD,gIAAA,OAAO,OAAgB"}
|