From 3dcc2cd3ce37727969feb46e5ef5f14a3a61da36 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 06:28:45 +0000 Subject: [PATCH 1/2] chore(deps): bump the npm_and_yarn group with 2 updates Bumps the npm_and_yarn group with 2 updates: [jsonpath-plus](https://github.com/s3u/JSONPath) and [redis-om](https://github.com/redis/redis-om-node). Updates `jsonpath-plus` from 7.2.0 to 10.1.0 - [Release notes](https://github.com/s3u/JSONPath/releases) - [Changelog](https://github.com/JSONPath-Plus/JSONPath/blob/main/CHANGES.md) - [Commits](https://github.com/s3u/JSONPath/compare/v7.2.0...v10.1.0) Updates `redis-om` from 0.4.3 to 0.4.7 - [Changelog](https://github.com/redis/redis-om-node/blob/main/CHANGELOG) - [Commits](https://github.com/redis/redis-om-node/commits) --- updated-dependencies: - dependency-name: jsonpath-plus dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: redis-om dependency-type: direct:production dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] --- package-lock.json | 93 +++++++++++++++++++++++++++++++++++++++-------- package.json | 2 +- 2 files changed, 78 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 33b64371..ec615c71 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,7 +42,7 @@ "react-i18next": "^12.3.1", "react-redux": "^9.1.2", "redis": "^4.7.0", - "redis-om": "^0.4.3" + "redis-om": "^0.4.7" }, "devDependencies": { "@etherisc/gif-interface": "2.0.0-rc.1-0", @@ -2575,6 +2575,28 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@jsep-plugin/assignment": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jsep-plugin/assignment/-/assignment-1.2.1.tgz", + "integrity": "sha512-gaHqbubTi29aZpVbBlECRpmdia+L5/lh2BwtIJTmtxdbecEyyX/ejAOg7eQDGNvGOUmPY7Z2Yxdy9ioyH/VJeA==", + "engines": { + "node": ">= 10.16.0" + }, + "peerDependencies": { + "jsep": "^0.4.0||^1.0.0" + } + }, + "node_modules/@jsep-plugin/regex": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@jsep-plugin/regex/-/regex-1.0.3.tgz", + "integrity": "sha512-XfZgry4DwEZvSFtS/6Y+R48D7qJYJK6R9/yJFyUFHCIUMEEHuJ4X95TDgJp5QkmzfLYvapMPzskV5HpIDrREug==", + "engines": { + "node": ">= 10.16.0" + }, + "peerDependencies": { + "jsep": "^0.4.0||^1.0.0" + } + }, "node_modules/@lit-labs/ssr-dom-shim": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.2.0.tgz", @@ -11577,6 +11599,14 @@ } } }, + "node_modules/jsep": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/jsep/-/jsep-1.3.9.tgz", + "integrity": "sha512-i1rBX5N7VPl0eYb6+mHNp52sEuaS2Wi8CDYx1X5sn9naevL78+265XJqy1qENEk7mRKwS06NHpUqiBwR7qeodw==", + "engines": { + "node": ">= 10.16.0" + } + }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -11628,11 +11658,20 @@ } }, "node_modules/jsonpath-plus": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-7.2.0.tgz", - "integrity": "sha512-zBfiUPM5nD0YZSBT/o/fbCUlCcepMIdP0CJZxM1+KgA4f2T206f6VAg9e7mX35+KlMaIc5qXW34f3BnwJ3w+RA==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-10.1.0.tgz", + "integrity": "sha512-gHfV1IYqH8uJHYVTs8BJX1XKy2/rR93+f8QQi0xhx95aCiXn1ettYAd5T+7FU6wfqyDoX/wy0pm/fL3jOKJ9Lg==", + "dependencies": { + "@jsep-plugin/assignment": "^1.2.1", + "@jsep-plugin/regex": "^1.0.3", + "jsep": "^1.3.9" + }, + "bin": { + "jsonpath": "bin/jsonpath-cli.js", + "jsonpath-plus": "bin/jsonpath-cli.js" + }, "engines": { - "node": ">=12.0.0" + "node": ">=18.0.0" } }, "node_modules/jsx-ast-utils": { @@ -13241,11 +13280,11 @@ } }, "node_modules/redis-om": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/redis-om/-/redis-om-0.4.3.tgz", - "integrity": "sha512-OQ2ydJYm8j5YMWj3K2ieQdUcfu2gP1nW2XsdaFLbHkaSlYqj1Kfu8X+T44vPuesY3cKdVj6tv9bHEmI9oqwHgA==", + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/redis-om/-/redis-om-0.4.7.tgz", + "integrity": "sha512-s0N+RNkW0qNeMhTbaxYZqhbBR8W/nOdMsGm25EOls0jxLHvMj9O7nD2mSgpwYycxc1/wUkePAMnp9y6u3VH9fw==", "dependencies": { - "jsonpath-plus": "^7.2.0", + "jsonpath-plus": "^10.1.0", "just-clone": "^6.1.1", "redis": "^4.6.4", "ulid": "^2.3.0" @@ -16979,6 +17018,18 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "@jsep-plugin/assignment": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jsep-plugin/assignment/-/assignment-1.2.1.tgz", + "integrity": "sha512-gaHqbubTi29aZpVbBlECRpmdia+L5/lh2BwtIJTmtxdbecEyyX/ejAOg7eQDGNvGOUmPY7Z2Yxdy9ioyH/VJeA==", + "requires": {} + }, + "@jsep-plugin/regex": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@jsep-plugin/regex/-/regex-1.0.3.tgz", + "integrity": "sha512-XfZgry4DwEZvSFtS/6Y+R48D7qJYJK6R9/yJFyUFHCIUMEEHuJ4X95TDgJp5QkmzfLYvapMPzskV5HpIDrREug==", + "requires": {} + }, "@lit-labs/ssr-dom-shim": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.2.0.tgz", @@ -23557,6 +23608,11 @@ } } }, + "jsep": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/jsep/-/jsep-1.3.9.tgz", + "integrity": "sha512-i1rBX5N7VPl0eYb6+mHNp52sEuaS2Wi8CDYx1X5sn9naevL78+265XJqy1qENEk7mRKwS06NHpUqiBwR7qeodw==" + }, "jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -23596,9 +23652,14 @@ } }, "jsonpath-plus": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-7.2.0.tgz", - "integrity": "sha512-zBfiUPM5nD0YZSBT/o/fbCUlCcepMIdP0CJZxM1+KgA4f2T206f6VAg9e7mX35+KlMaIc5qXW34f3BnwJ3w+RA==" + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/jsonpath-plus/-/jsonpath-plus-10.1.0.tgz", + "integrity": "sha512-gHfV1IYqH8uJHYVTs8BJX1XKy2/rR93+f8QQi0xhx95aCiXn1ettYAd5T+7FU6wfqyDoX/wy0pm/fL3jOKJ9Lg==", + "requires": { + "@jsep-plugin/assignment": "^1.2.1", + "@jsep-plugin/regex": "^1.0.3", + "jsep": "^1.3.9" + } }, "jsx-ast-utils": { "version": "3.3.5", @@ -24741,11 +24802,11 @@ } }, "redis-om": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/redis-om/-/redis-om-0.4.3.tgz", - "integrity": "sha512-OQ2ydJYm8j5YMWj3K2ieQdUcfu2gP1nW2XsdaFLbHkaSlYqj1Kfu8X+T44vPuesY3cKdVj6tv9bHEmI9oqwHgA==", + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/redis-om/-/redis-om-0.4.7.tgz", + "integrity": "sha512-s0N+RNkW0qNeMhTbaxYZqhbBR8W/nOdMsGm25EOls0jxLHvMj9O7nD2mSgpwYycxc1/wUkePAMnp9y6u3VH9fw==", "requires": { - "jsonpath-plus": "^7.2.0", + "jsonpath-plus": "^10.1.0", "just-clone": "^6.1.1", "redis": "^4.6.4", "ulid": "^2.3.0" diff --git a/package.json b/package.json index 19ddbe9c..a2bf3d4a 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "react-i18next": "^12.3.1", "react-redux": "^9.1.2", "redis": "^4.7.0", - "redis-om": "^0.4.3" + "redis-om": "^0.4.7" }, "devDependencies": { "@etherisc/gif-interface": "2.0.0-rc.1-0", From 759b486508df70b73d2e8d468065fb5d34025831 Mon Sep 17 00:00:00 2001 From: Marc Doerflinger Date: Thu, 31 Oct 2024 10:29:58 +0000 Subject: [PATCH 2/2] fix compile error --- package-lock.json | 4 +++- package.json | 3 ++- src/pages/api/feeless/restake.tsx | 9 +++------ src/pages/api/feeless/stake.tsx | 26 ++++++++++++++------------ 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index ec615c71..f3a08801 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,7 +42,8 @@ "react-i18next": "^12.3.1", "react-redux": "^9.1.2", "redis": "^4.7.0", - "redis-om": "^0.4.7" + "redis-om": "^0.4.7", + "ulid": "^2.3.0" }, "devDependencies": { "@etherisc/gif-interface": "2.0.0-rc.1-0", @@ -14484,6 +14485,7 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/ulid/-/ulid-2.3.0.tgz", "integrity": "sha512-keqHubrlpvT6G2wH0OEfSW4mquYRcbe/J8NMmveoQOjUqmo+hXtO+ORCpWhdbZ7k72UtY61BL7haGxW6enBnjw==", + "license": "MIT", "bin": { "ulid": "bin/cli.js" } diff --git a/package.json b/package.json index a2bf3d4a..eba5e6bb 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,8 @@ "react-i18next": "^12.3.1", "react-redux": "^9.1.2", "redis": "^4.7.0", - "redis-om": "^0.4.7" + "redis-om": "^0.4.7", + "ulid": "^2.3.0" }, "devDependencies": { "@etherisc/gif-interface": "2.0.0-rc.1-0", diff --git a/src/pages/api/feeless/restake.tsx b/src/pages/api/feeless/restake.tsx index b89daa5c..50f06507 100644 --- a/src/pages/api/feeless/restake.tsx +++ b/src/pages/api/feeless/restake.tsx @@ -2,6 +2,7 @@ import { NextApiRequest, NextApiResponse } from "next"; import { getPendingRestakeRepository } from "../../../utils/feeless/pending_restake"; import { redisClient } from "../../../utils/redis"; import { EntityId } from "redis-om"; +import { ulid } from "ulid"; export const STREAM_KEY = process.env.REDIS_QUEUE_STREAM_KEY ?? "feeless:signatures"; @@ -39,7 +40,8 @@ async function handlePost(req: NextApiRequest, res: NextApiResponse) { // store pending application in redis const repo = await getPendingRestakeRepository(); - const savedRestake = await repo.save({ + const entityId = ulid(); + await repo.save(entityId, { owner: owner, stakeNftId: stakeNftId, targetNftId: targetNftId, @@ -48,11 +50,6 @@ async function handlePost(req: NextApiRequest, res: NextApiResponse) { transactionHash: null, timestamp: new Date(), }); - const entityId = savedRestake[EntityId]; - if (! entityId) { - res.status(500).send("Failed to save pending restake"); - return; - } console.log("created pending restake", signatureId, entityId); // push message to stream (queue) diff --git a/src/pages/api/feeless/stake.tsx b/src/pages/api/feeless/stake.tsx index 95764d75..8cd4bd6b 100644 --- a/src/pages/api/feeless/stake.tsx +++ b/src/pages/api/feeless/stake.tsx @@ -2,6 +2,7 @@ import { NextApiRequest, NextApiResponse } from "next"; import { redisClient } from "../../../utils/redis"; import { getPendingStakeRepository } from "../../../utils/feeless/pending_stake"; import { EntityId } from "redis-om"; +import { ulid } from "ulid"; export const STREAM_KEY = process.env.REDIS_QUEUE_STREAM_KEY ?? "feeless:signatures"; @@ -13,12 +14,17 @@ export default async function handler( req: NextApiRequest, res: NextApiResponse ) { - if (process.env.NEXT_PUBLIC_FEATURE_GASLESS_TRANSACTION !== 'true') { - res.status(404).send('Unsupported feature'); - } else if (req.method === 'POST') { - await handlePost(req, res); - } else { - res.status(405).send('Only POST requests allowed'); + try { + if (process.env.NEXT_PUBLIC_FEATURE_GASLESS_TRANSACTION !== 'true') { + res.status(404).send('Unsupported feature'); + } else if (req.method === 'POST') { + await handlePost(req, res); + } else { + res.status(405).send('Only POST requests allowed'); + } + } catch (err) { + console.log(err); + throw err; } } @@ -39,7 +45,8 @@ async function handlePost(req: NextApiRequest, res: NextApiResponse) { // store pending application in redis const repo = await getPendingStakeRepository(); - const savedStake = await repo.save({ + const entityId = ulid(); + await repo.save(entityId, { owner: owner, targetNftId: targetNftId, dipAmount: dipAmount, @@ -48,11 +55,6 @@ async function handlePost(req: NextApiRequest, res: NextApiResponse) { transactionHash: null, timestamp: new Date(), }); - const entityId = savedStake[EntityId]; - if (! entityId) { - res.status(500).send("Failed to save pending stake"); - return; - } console.log("created pending stake", signatureId, entityId); // push message to stream (queue)