idb-bridge: use lodash cloneDeep

This commit is contained in:
Florian Dold 2021-12-09 18:19:48 +01:00
parent 423af144ee
commit 38d8239f93
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
6 changed files with 14 additions and 11 deletions

View File

@ -19,6 +19,7 @@
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^11.2.0",
"@types/lodash": "^4.14.178",
"@types/node": "^14.14.22",
"ava": "^3.15.0",
"esm": "^3.2.25",
@ -28,6 +29,7 @@
"typescript": "^4.1.3"
},
"dependencies": {
"lodash": "^4.17.21",
"tslib": "^2.1.0"
},
"ava": {

View File

@ -1070,6 +1070,7 @@ export class MemoryBackend implements Backend {
btx: DatabaseTransaction,
req: RecordGetRequest,
): Promise<RecordGetResponse> {
console.log(`getRecords ${req.objectStoreName}`);
if (this.enableTracing) {
console.log(`TRACING: getRecords`);
console.log("query", req);

View File

@ -14,6 +14,8 @@
permissions and limitations under the License.
*/
import cloneDeep from "lodash/cloneDeep";
const { toString: toStr } = {};
const hasOwn = {}.hasOwnProperty;
const getProto = Object.getPrototypeOf;
@ -260,5 +262,5 @@ export function structuredRevive(val: any): any {
* Structured clone for IndexedDB.
*/
export function structuredClone(val: any): any {
return structuredRevive(structuredEncapsulate(val));
return cloneDeep(val);
}

View File

@ -270,7 +270,6 @@ export class CryptoImplementation {
const coinPriv = decodeCrock(coin.coinPriv);
const coinSig = eddsaSign(p, coinPriv);
if (coin.denomPub.cipher === DenomKeyType.LegacyRsa) {
logger.info("creating legacy recoup request");
const paybackRequest: RecoupRequest = {
coin_blind_key_secret: coin.blindingKey,
coin_pub: coin.coinPub,
@ -281,7 +280,6 @@ export class CryptoImplementation {
};
return paybackRequest;
} else {
logger.info("creating v10 recoup request");
const paybackRequest: RecoupRequest = {
coin_blind_key_secret: coin.blindingKey,
coin_pub: coin.coinPub,
@ -453,7 +451,6 @@ export class CryptoImplementation {
const hExt = new Uint8Array(64);
let d: Uint8Array;
if (depositInfo.denomKeyType === DenomKeyType.Rsa) {
logger.warn("signing v10 deposit permission");
d = buildSigPS(TalerSignaturePurpose.WALLET_COIN_DEPOSIT)
.put(decodeCrock(depositInfo.contractTermsHash))
.put(hExt)
@ -466,7 +463,6 @@ export class CryptoImplementation {
.put(decodeCrock(depositInfo.merchantPub))
.build();
} else if (depositInfo.denomKeyType === DenomKeyType.LegacyRsa) {
logger.warn("signing legacy deposit permission");
d = buildSigPS(TalerSignaturePurpose.WALLET_COIN_DEPOSIT)
.put(decodeCrock(depositInfo.contractTermsHash))
.put(decodeCrock(depositInfo.wireInfoHash))

View File

@ -1658,11 +1658,6 @@ export async function confirmPay(
throw Error("proposal is in invalid state");
}
const merchantInfo = await ws.merchantOps.getMerchantInfo(
ws,
d.contractData.merchantBaseUrl,
);
const existingPurchase = await ws.db
.mktx((x) => ({ purchases: x.purchases }))
.runReadWrite(async (tx) => {

View File

@ -129,20 +129,24 @@ importers:
'@rollup/plugin-commonjs': ^17.1.0
'@rollup/plugin-json': ^4.1.0
'@rollup/plugin-node-resolve': ^11.2.0
'@types/lodash': ^4.14.178
'@types/node': ^14.14.22
ava: ^3.15.0
esm: ^3.2.25
lodash: ^4.17.21
prettier: ^2.2.1
rimraf: ^3.0.2
rollup: ^2.37.1
tslib: ^2.1.0
typescript: ^4.1.3
dependencies:
lodash: 4.17.21
tslib: 2.1.0
devDependencies:
'@rollup/plugin-commonjs': 17.1.0_rollup@2.37.1
'@rollup/plugin-json': 4.1.0_rollup@2.37.1
'@rollup/plugin-node-resolve': 11.2.0_rollup@2.37.1
'@types/lodash': 4.14.178
'@types/node': 14.14.22
ava: 3.15.0
esm: 3.2.25
@ -10165,6 +10169,10 @@ packages:
resolution: {integrity: sha1-7ihweulOEdK4J7y+UnC86n8+ce4=}
dev: true
/@types/lodash/4.14.178:
resolution: {integrity: sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==}
dev: true
/@types/markdown-to-jsx/6.11.3:
resolution: {integrity: sha512-30nFYpceM/ZEvhGiqWjm5quLUxNeld0HCzJEXMZZDpq53FPkS85mTwkWtCXzCqq8s5JYLgM5W392a02xn8Bdaw==}
dependencies:
@ -19327,7 +19335,6 @@ packages:
/lodash/4.17.21:
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
dev: true
/log-symbols/4.1.0:
resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==}