From 3ed47bed8b47dc82518726f3354ddfcf140112c8 Mon Sep 17 00:00:00 2001 From: samuel Date: Tue, 27 Feb 2024 16:38:23 +0100 Subject: [PATCH] fix --- .../src/opa/script/evaluate-legacy-policy.script.ts | 8 ++++---- .../src/opa/script/translate-legacy-policy.script.ts | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/policy-engine/src/opa/script/evaluate-legacy-policy.script.ts b/apps/policy-engine/src/opa/script/evaluate-legacy-policy.script.ts index a4a5eafa6..b10b5c022 100644 --- a/apps/policy-engine/src/opa/script/evaluate-legacy-policy.script.ts +++ b/apps/policy-engine/src/opa/script/evaluate-legacy-policy.script.ts @@ -1,3 +1,4 @@ +// eslint-disable @typescript-eslint/no-explicit-any import { Action, Request, UserRole } from '@narval/policy-engine-shared' import { InputType, safeDecode } from '@narval/transaction-request-intent' import { loadPolicy } from '@open-policy-agent/opa-wasm' @@ -9,10 +10,9 @@ import wallets from './data/wallets.json' import legacyRequests from './requests/legacy-requests.json' export const run = async () => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any const entities: { [key: string]: any } = { users: {}, wallets: {} } - for (const user of users) { + for (const user of users as any[]) { let role = user.guildUserRole if (['SCHOLAR'].includes(role)) { role = UserRole.MEMBER @@ -22,13 +22,13 @@ export const run = async () => { entities.users[user.id] = { uid: user.id, role } } - for (const wallet of wallets) { + for (const wallet of wallets as any[]) { const uid = `eip155:${wallet.accountType}:${wallet.address}` entities.wallets[uid] = { uid, address: wallet.address, accountType: wallet.accountType, - assignees: wallet.assignees?.map((assignee) => assignee.userId) || [] + assignees: wallet.assignees?.map((assignee: any) => assignee.userId) || [] } } diff --git a/apps/policy-engine/src/opa/script/translate-legacy-policy.script.ts b/apps/policy-engine/src/opa/script/translate-legacy-policy.script.ts index 9194737d0..0d5f4afd6 100644 --- a/apps/policy-engine/src/opa/script/translate-legacy-policy.script.ts +++ b/apps/policy-engine/src/opa/script/translate-legacy-policy.script.ts @@ -1,3 +1,4 @@ +// eslint-disable @typescript-eslint/no-explicit-any import { EntityType, FiatCurrency, UserRole, ValueOperators } from '@narval/policy-engine-shared' import axios from 'axios' import { omit } from 'lodash' @@ -322,7 +323,7 @@ export const translateLegacyPolicy = (oldPolicy: OldPolicy): NewPolicy | null => } export const run = () => { - const data = policies + const data = (policies as any[]) .map((policy) => { const copy = omit(policy, ['guild_id', 'sequence', 'version', 'amount']) as OldPolicy copy.amount = policy.amount ? `${policy.amount}` : null