From f7fd336caa74dde378d0f70692b040d8eb193868 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Fri, 3 May 2024 17:29:12 +0900 Subject: [PATCH 1/6] fix!: removed ajv usage and replaced with typebox-validators --- .github/.ubiquibot-config.yml | 21 ++---- package.json | 11 ++- src/types/configuration-types.ts | 8 +-- .../configuration/plugin-configuration.ts | 2 +- src/utils/ajv.ts | 38 ---------- src/utils/generate-configuration.ts | 40 +++++++---- src/utils/index.ts | 1 - tests/__mocks__/test-default-conf-obj.ts | 8 +-- tests/__mocks__/test-valid-conf-obj.ts | 7 -- tests/__mocks__/test-valid-config.yml | 70 +++++++++++++++++-- yarn.lock | 30 ++++---- 11 files changed, 125 insertions(+), 111 deletions(-) delete mode 100644 src/utils/ajv.ts diff --git a/.github/.ubiquibot-config.yml b/.github/.ubiquibot-config.yml index a03c877..1655776 100644 --- a/.github/.ubiquibot-config.yml +++ b/.github/.ubiquibot-config.yml @@ -1,13 +1,3 @@ -price-multiplier: 1.5 -command-settings: - - name: start - enabled: false -# newContributorGreeting: -# enabled: true -# header: "Thank you for contributing to UbiquiBot! Please be sure to set your wallet address before completing your first bounty so that the automatic payout upon task completion will work for you." -# helpMenu: true -# footer: "###### Also please star this repository and [@ubiquity/devpool-directory](https://github.com/ubiquity/devpool-directory/) to show your support. It helps a lot!" - incentives: enabled: true contentEvaluator: @@ -77,8 +67,9 @@ incentives: plugins: 'issues.closed': - - uses: - - plugin: ubiquity/conversation-rewards@testing/ubiquibot-v2-testing - type: github - with: - evmNetworkId: 100 + - skipBotEvents: true + uses: + - plugin: ubiquibot/conversation-rewards@testing/ubiquibot-v2-testing + type: github + with: + evmNetworkId: 100 diff --git a/package.json b/package.json index 3406666..e692d39 100644 --- a/package.json +++ b/package.json @@ -25,15 +25,15 @@ "ubiquibot", "open-source" ], - "dependencies": {}, + "dependencies": { + }, "peerDependencies": { "@octokit/webhooks": "12.2.0", "@sinclair/typebox": "0.32.23", - "ajv": "8.13.0", - "ajv-formats": "3.0.1", "dotenv": "16.4.5", "lodash": "4.17.21", - "ms": "2.1.3" + "ms": "2.1.3", + "typebox-validators": "0.3.5" }, "devDependencies": { "@commitlint/cli": "18.6.1", @@ -55,8 +55,6 @@ "@types/node": "20.11.19", "@typescript-eslint/eslint-plugin": "7.0.1", "@typescript-eslint/parser": "7.0.1", - "ajv": "8.12.0", - "ajv-formats": "3.0.1", "cspell": "8.3.2", "dotenv": "16.4.5", "esbuild": "0.20.0", @@ -82,6 +80,7 @@ "ts-jest": "29.1.2", "tslib": "2.6.2", "tsx": "4.7.1", + "typebox-validators": "0.3.5", "typescript": "5.3.3" }, "lint-staged": { diff --git a/src/types/configuration-types.ts b/src/types/configuration-types.ts index a8a6378..9c80fb3 100644 --- a/src/types/configuration-types.ts +++ b/src/types/configuration-types.ts @@ -1,6 +1,6 @@ import { ObjectOptions, Static, StaticDecode, StringOptions, TProperties, Type as T } from "@sinclair/typebox"; import ms from "ms"; -import { ajv } from "../utils"; +import { StandardValidator } from "typebox-validators"; import { contentEvaluatorConfigurationType } from "./configuration/content-evaluator-config"; import { dataPurgeConfigurationType } from "./configuration/data-purge-config"; import { formattingEvaluatorConfigurationType } from "./configuration/formatting-evaluator-config"; @@ -59,10 +59,10 @@ export const envConfigSchema = T.Object({ APP_ID: T.Number(), }); -export const validateEnvConfig = ajv.compile(envConfigSchema); +export const validateEnvConfig = new StandardValidator(envConfigSchema); export type EnvConfigType = Static; -const botConfigSchema = strictObject( +export const botConfigSchema = strictObject( { keys: strictObject({ evmPrivateEncrypted: T.Optional(T.String()), @@ -119,6 +119,6 @@ const botConfigSchema = strictObject( }, { default: undefined } // top level object can't have default! ); -export const validateBotConfig = ajv.compile(botConfigSchema); +export const validateBotConfig = new StandardValidator(botConfigSchema); export type BotConfig = StaticDecode; diff --git a/src/types/configuration/plugin-configuration.ts b/src/types/configuration/plugin-configuration.ts index 1591f49..28ea17b 100644 --- a/src/types/configuration/plugin-configuration.ts +++ b/src/types/configuration/plugin-configuration.ts @@ -11,7 +11,7 @@ type GithubPlugin = { ref?: string; }; -function githubPluginType() { +export function githubPluginType() { return T.Transform(T.String()) .Decode((value) => { const matches = value.match(pluginNameRegex); diff --git a/src/utils/ajv.ts b/src/utils/ajv.ts deleted file mode 100644 index 861c923..0000000 --- a/src/utils/ajv.ts +++ /dev/null @@ -1,38 +0,0 @@ -import Ajv from "ajv"; -import addFormats from "ajv-formats"; - -export const ajv = addFormats( - new Ajv({ - strict: true, - removeAdditional: false, - useDefaults: true, - allErrors: true, - coerceTypes: true, - }), - { - formats: [ - "date", - "time", - "date-time", - "duration", - "uri", - "uri-reference", - "uri-template", - "email", - "hostname", - "ipv4", - "ipv6", - "regex", - "uuid", - "json-pointer", - "relative-json-pointer", - "byte", - "int32", - "int64", - "float", - "double", - "password", - "binary", - ], - } -); diff --git a/src/utils/generate-configuration.ts b/src/utils/generate-configuration.ts index 60e72f3..1868979 100644 --- a/src/utils/generate-configuration.ts +++ b/src/utils/generate-configuration.ts @@ -1,13 +1,15 @@ import { Value } from "@sinclair/typebox/value"; -import { DefinedError } from "ajv"; import mergeWith from "lodash/merge"; import YAML from "yaml"; -import { BotConfig, stringDuration, validateBotConfig } from "../types"; +import { BotConfig, botConfigSchema, stringDuration, validateBotConfig } from "../types"; // @ts-expect-error gets transformed by rollup import orgConfig from "../../.github/.ubiquibot-config.yml"; +import { githubPluginType } from "../types/configuration/plugin-configuration"; export function generateConfiguration(repoConfig?: BotConfig): BotConfig { - const merged = mergeWith({}, orgConfig, repoConfig, (objValue: unknown, srcValue: unknown) => { + const defaultConfig = Value.Default(botConfigSchema, {}) as BotConfig; + + const merged = mergeWith(defaultConfig, orgConfig, repoConfig, (objValue: unknown, srcValue: unknown) => { if (Array.isArray(objValue) && Array.isArray(srcValue)) { // if it's string array, concat and remove duplicates if (objValue.every((value) => typeof value === "string")) { @@ -18,12 +20,12 @@ export function generateConfiguration(repoConfig?: BotConfig): BotConfig { } }); - const isValid = validateBotConfig(merged); - if (!isValid) { - const errorMessage = getErrorMsg(validateBotConfig.errors as DefinedError[]); - if (errorMessage) { - throw new Error(`Invalid merged configuration: ${errorMessage}`); + if (!validateBotConfig.test(merged)) { + const errors = validateBotConfig.errors(merged); + for (const error of errors) { + console.error(error); } + throw new Error("Invalid configuration."); } // this will run transform functions @@ -33,7 +35,6 @@ export function generateConfiguration(repoConfig?: BotConfig): BotConfig { console.error(`Could not transform the configuration: ${err}`); throw err; } - return merged as BotConfig; } @@ -74,12 +75,27 @@ export function transformConfig(config: BotConfig) { errorMsg += `Invalid taskDisqualifyDuration value: ${decodeError.value}\n`; } } + errorMsg += transformUseReferences(config); if (errorMsg) throw new Error(errorMsg); } -function getErrorMsg(errors: DefinedError[]) { - const errorsWithoutStrict = errors.filter((error) => error.keyword !== "additionalProperties"); - return errorsWithoutStrict.length === 0 ? null : errorsWithoutStrict.map((error) => error.instancePath.replaceAll("/", ".") + " " + error.message).join("\n"); +function transformUseReferences(config: BotConfig) { + let errorMsg = ""; + try { + for (const plugins of Object.values(config.plugins)) { + for (const plugin of plugins) { + for (const use of plugin.uses) { + use.plugin = Value.Decode(githubPluginType(), use.plugin); + } + } + } + } catch (err: unknown) { + const decodeError = err as DecodeError; + if (decodeError.value) { + errorMsg += `Invalid plugin use value: ${decodeError.value}\n`; + } + } + return errorMsg; } /** diff --git a/src/utils/index.ts b/src/utils/index.ts index 16e4c81..debd3d5 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,2 +1 @@ -export * from "./ajv"; export * from "./generate-configuration"; diff --git a/tests/__mocks__/test-default-conf-obj.ts b/tests/__mocks__/test-default-conf-obj.ts index 0c0dd33..2f948db 100644 --- a/tests/__mocks__/test-default-conf-obj.ts +++ b/tests/__mocks__/test-default-conf-obj.ts @@ -1,11 +1,4 @@ const defaultConfig = { - "price-multiplier": 1.5, - "command-settings": [ - { - name: "start", - enabled: false, - }, - ], incentives: { enabled: true, contentEvaluator: { @@ -104,6 +97,7 @@ const defaultConfig = { plugins: { "issues.closed": [ { + skipBotEvents: true, uses: [ { plugin: "ubiquity/conversation-rewards@testing/ubiquibot-v2-testing", diff --git a/tests/__mocks__/test-valid-conf-obj.ts b/tests/__mocks__/test-valid-conf-obj.ts index 245c289..23cef27 100644 --- a/tests/__mocks__/test-valid-conf-obj.ts +++ b/tests/__mocks__/test-valid-conf-obj.ts @@ -1,11 +1,4 @@ const validConfig = { - "price-multiplier": 1.5, - "command-settings": [ - { - name: "start", - enabled: false, - }, - ], keys: {}, features: { assistivePricing: false, diff --git a/tests/__mocks__/test-valid-config.yml b/tests/__mocks__/test-valid-config.yml index 80c24e8..ecd467d 100644 --- a/tests/__mocks__/test-valid-config.yml +++ b/tests/__mocks__/test-valid-config.yml @@ -1,4 +1,66 @@ -price-multiplier: 1.5 -command-settings: - - name: start - enabled: false +incentives: + enabled: true + contentEvaluator: + enabled: true + userExtractor: + enabled: true + redeemTask: true + dataPurge: + enabled: true + formattingEvaluator: + enabled: true + scores: + br: 0 + code: 1 + p: 1 + em: 0 + img: 0 + strong: 0 + blockquote: 0 + h1: 1 + h2: 1 + h3: 1 + h4: 1 + h5: 1 + h6: 1 + a: 1 + li: 1 + td: 1 + hr: 0 + multipliers: + - type: [ ISSUE, ISSUER, SPECIFICATION ] + formattingMultiplier: 1 + wordValue: 0.1 + - type: [ ISSUE, ISSUER, COMMENTED ] + formattingMultiplier: 1 + wordValue: 0.2 + - type: [ ISSUE, ASSIGNEE, COMMENTED ] + formattingMultiplier: 0 + wordValue: 0 + - type: [ ISSUE, COLLABORATOR, COMMENTED ] + formattingMultiplier: 1 + wordValue: 0.1 + - type: [ ISSUE, CONTRIBUTOR, COMMENTED ] + formattingMultiplier: 0.25 + wordValue: 0.1 + - type: [ REVIEW, ISSUER, TASK ] + formattingMultiplier: 0 + wordValue: 0 + - type: [ REVIEW, ISSUER, COMMENTED ] + formattingMultiplier: 2 + wordValue: 0.2 + - type: [ REVIEW, ASSIGNEE, COMMENTED ] + formattingMultiplier: 1 + wordValue: 0.1 + - type: [ REVIEW, COLLABORATOR, COMMENTED ] + formattingMultiplier: 1 + wordValue: 0.1 + - type: [ REVIEW, CONTRIBUTOR, COMMENTED ] + formattingMultiplier: 0.25 + wordValue: 0.1 + permitGeneration: + enabled: true + githubComment: + enabled: true + post: true + debug: false diff --git a/yarn.lock b/yarn.lock index 76aa50b..48d076e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2073,14 +2073,17 @@ aggregate-error@^3.0.0, aggregate-error@^3.1.0: clean-stack "^2.0.0" indent-string "^4.0.0" -ajv-formats@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/ajv-formats/-/ajv-formats-3.0.1.tgz#3d5dc762bca17679c3c2ea7e90ad6b7532309578" - integrity sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ== +ajv@^6.12.4: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== dependencies: - ajv "^8.0.0" + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" -ajv@8.12.0, ajv@^8.0.0, ajv@^8.11.0: +ajv@^8.11.0: version "8.12.0" resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1" integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA== @@ -2090,16 +2093,6 @@ ajv@8.12.0, ajv@^8.0.0, ajv@^8.11.0: require-from-string "^2.0.2" uri-js "^4.2.2" -ajv@^6.12.4: - version "6.12.6" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" - integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== - dependencies: - fast-deep-equal "^3.1.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - ansi-escapes@^4.2.1: version "4.3.2" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" @@ -6451,6 +6444,11 @@ type-fest@^1.0.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1" integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA== +typebox-validators@0.3.5: + version "0.3.5" + resolved "https://registry.yarnpkg.com/typebox-validators/-/typebox-validators-0.3.5.tgz#b913bad0a87571ffe0edd01d2b6090a268e1ecc9" + integrity sha512-FXrmSUAN6bSGxDANResNCZQ8VRRLr5bSyy73/HyqSXGdiVuogppGAoRocy7NTVZY4Wc2sWUofmWwwIXE6OxS6Q== + typed-array-buffer@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz#1867c5d83b20fcb5ccf32649e5e2fc7424474ff3" From fd9407032df4819d2dc895a80fc859160a7c5b24 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Fri, 3 May 2024 17:39:07 +0900 Subject: [PATCH 2/6] chore: updated yarn.lock --- yarn.lock | 259 +++++++++++++++++++++++++++--------------------------- 1 file changed, 130 insertions(+), 129 deletions(-) diff --git a/yarn.lock b/yarn.lock index 48d076e..93db8d7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,11 +2,6 @@ # yarn lockfile v1 -"@aashutoshrathi/word-wrap@^1.2.3": - version "1.2.6" - resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" - integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== - "@ampproject/remapping@^2.2.0": version "2.3.0" resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" @@ -15,7 +10,7 @@ "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.24" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.23.5", "@babel/code-frame@^7.24.1", "@babel/code-frame@^7.24.2": +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.23.5", "@babel/code-frame@^7.24.2": version "7.24.2" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.2.tgz#718b4b19841809a58b29b68cde80bc5e1aa6d9ae" integrity sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ== @@ -29,32 +24,32 @@ integrity sha512-vg8Gih2MLK+kOkHJp4gBEIkyaIi00jgWot2D9QOmmfLC8jINSOzmCLta6Bvz/JSBCqnegV0L80jhxkol5GWNfQ== "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": - version "7.24.4" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.24.4.tgz#1f758428e88e0d8c563874741bc4ffc4f71a4717" - integrity sha512-MBVlMXP+kkl5394RBLSxxk/iLTeVGuXTV3cIDXavPpMMqnSnt6apKgan/U8O3USWZCWZT/TbgfEpKa4uMgN4Dg== + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.24.5.tgz#15ab5b98e101972d171aeef92ac70d8d6718f06a" + integrity sha512-tVQRucExLQ02Boi4vdPp49svNGcfL2GhdTCT9aldhXgCJVAI21EtRfBettiuLUwce/7r6bFdgs6JFkcdTiFttA== dependencies: "@ampproject/remapping" "^2.2.0" "@babel/code-frame" "^7.24.2" - "@babel/generator" "^7.24.4" + "@babel/generator" "^7.24.5" "@babel/helper-compilation-targets" "^7.23.6" - "@babel/helper-module-transforms" "^7.23.3" - "@babel/helpers" "^7.24.4" - "@babel/parser" "^7.24.4" + "@babel/helper-module-transforms" "^7.24.5" + "@babel/helpers" "^7.24.5" + "@babel/parser" "^7.24.5" "@babel/template" "^7.24.0" - "@babel/traverse" "^7.24.1" - "@babel/types" "^7.24.0" + "@babel/traverse" "^7.24.5" + "@babel/types" "^7.24.5" convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.24.1", "@babel/generator@^7.24.4", "@babel/generator@^7.7.2": - version "7.24.4" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.4.tgz#1fc55532b88adf952025d5d2d1e71f946cb1c498" - integrity sha512-Xd6+v6SnjWVx/nus+y0l1sxMOTOMBkyL4+BIdbALyatQnAe/SRVjANeDPSCYaX+i1iJmuGSKf3Z+E+V/va1Hvw== +"@babel/generator@^7.24.5", "@babel/generator@^7.7.2": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.5.tgz#e5afc068f932f05616b66713e28d0f04e99daeb3" + integrity sha512-x32i4hEXvr+iI0NEoEfDKzlemF8AmtOP8CcrRaEcpzysWuoEb1KknpcvMsHKPONoKZiDuItklgWhB18xEhr9PA== dependencies: - "@babel/types" "^7.24.0" + "@babel/types" "^7.24.5" "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" jsesc "^2.5.1" @@ -90,81 +85,81 @@ dependencies: "@babel/types" "^7.22.5" -"@babel/helper-module-imports@^7.22.15": +"@babel/helper-module-imports@^7.24.3": version "7.24.3" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.24.3.tgz#6ac476e6d168c7c23ff3ba3cf4f7841d46ac8128" integrity sha512-viKb0F9f2s0BCS22QSF308z/+1YWKV/76mwt61NBzS5izMzDPwdq1pTrzf+Li3npBWX9KdQbkeCt1jSAM7lZqg== dependencies: "@babel/types" "^7.24.0" -"@babel/helper-module-transforms@^7.23.3": - version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz#d7d12c3c5d30af5b3c0fcab2a6d5217773e2d0f1" - integrity sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ== +"@babel/helper-module-transforms@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.24.5.tgz#ea6c5e33f7b262a0ae762fd5986355c45f54a545" + integrity sha512-9GxeY8c2d2mdQUP1Dye0ks3VDyIMS98kt/llQ2nUId8IsWqTF0l1LkSX0/uP7l7MCDrzXS009Hyhe2gzTiGW8A== dependencies: "@babel/helper-environment-visitor" "^7.22.20" - "@babel/helper-module-imports" "^7.22.15" - "@babel/helper-simple-access" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/helper-validator-identifier" "^7.22.20" + "@babel/helper-module-imports" "^7.24.3" + "@babel/helper-simple-access" "^7.24.5" + "@babel/helper-split-export-declaration" "^7.24.5" + "@babel/helper-validator-identifier" "^7.24.5" "@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.24.0", "@babel/helper-plugin-utils@^7.8.0": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.0.tgz#945681931a52f15ce879fd5b86ce2dae6d3d7f2a" - integrity sha512-9cUznXMG0+FxRuJfvL82QlTqIzhVW9sL0KjMPHhAOOvpQGL8QtdxnBKILjBqxlHyliz0yCa1G903ZXI/FuHy2w== + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.5.tgz#a924607dd254a65695e5bd209b98b902b3b2f11a" + integrity sha512-xjNLDopRzW2o6ba0gKbkZq5YWEBaK3PCyTOY1K2P/O07LGMhMqlMXPxwN4S5/RhWuCobT8z0jrlKGlYmeR1OhQ== -"@babel/helper-simple-access@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz#4938357dc7d782b80ed6dbb03a0fba3d22b1d5de" - integrity sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w== +"@babel/helper-simple-access@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.24.5.tgz#50da5b72f58c16b07fbd992810be6049478e85ba" + integrity sha512-uH3Hmf5q5n7n8mz7arjUlDOCbttY/DW4DYhE6FUsjKJ/oYC1kQQUvwEQWxRwUpX9qQKRXeqLwWxrqilMrf32sQ== dependencies: - "@babel/types" "^7.22.5" + "@babel/types" "^7.24.5" -"@babel/helper-split-export-declaration@^7.22.6": - version "7.22.6" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" - integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== +"@babel/helper-split-export-declaration@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.5.tgz#b9a67f06a46b0b339323617c8c6213b9055a78b6" + integrity sha512-5CHncttXohrHk8GWOFCcCl4oRD9fKosWlIRgWm4ql9VYioKm52Mk2xsmoohvm7f3JoiLSM5ZgJuRaf5QZZYd3Q== dependencies: - "@babel/types" "^7.22.5" + "@babel/types" "^7.24.5" -"@babel/helper-string-parser@^7.23.4": +"@babel/helper-string-parser@^7.24.1": version "7.24.1" resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.1.tgz#f99c36d3593db9540705d0739a1f10b5e20c696e" integrity sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ== -"@babel/helper-validator-identifier@^7.22.20": - version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" - integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== +"@babel/helper-validator-identifier@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.5.tgz#918b1a7fa23056603506370089bd990d8720db62" + integrity sha512-3q93SSKX2TWCG30M2G2kwaKeTYgEUp5Snjuj8qm729SObL6nbtUldAi37qbxkD5gg3xnBio+f9nqpSepGZMvxA== "@babel/helper-validator-option@^7.23.5": version "7.23.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz#907a3fbd4523426285365d1206c423c4c5520307" integrity sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw== -"@babel/helpers@^7.24.4": - version "7.24.4" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.24.4.tgz#dc00907fd0d95da74563c142ef4cd21f2cb856b6" - integrity sha512-FewdlZbSiwaVGlgT1DPANDuCHaDMiOo+D/IDYRFYjHOuv66xMSJ7fQwwODwRNAPkADIO/z1EoF/l2BCWlWABDw== +"@babel/helpers@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.24.5.tgz#fedeb87eeafa62b621160402181ad8585a22a40a" + integrity sha512-CiQmBMMpMQHwM5m01YnrM6imUG1ebgYJ+fAIW4FZe6m4qHTPaRHti+R8cggAwkdz4oXhtO4/K9JWlh+8hIfR2Q== dependencies: "@babel/template" "^7.24.0" - "@babel/traverse" "^7.24.1" - "@babel/types" "^7.24.0" + "@babel/traverse" "^7.24.5" + "@babel/types" "^7.24.5" "@babel/highlight@^7.24.2": - version "7.24.2" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.2.tgz#3f539503efc83d3c59080a10e6634306e0370d26" - integrity sha512-Yac1ao4flkTxTteCDZLEvdxg2fZfz1v8M4QpaGypq/WPDqg3ijHYbDfs+LG5hvzSoqaSZ9/Z9lKSP3CjZjv+pA== + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.5.tgz#bc0613f98e1dd0720e99b2a9ee3760194a704b6e" + integrity sha512-8lLmua6AVh/8SLJRRVD6V8p73Hir9w5mJrhE+IPpILG31KKlI9iz5zmBYKcWPS59qSfgP9RaSBQSHHE81WKuEw== dependencies: - "@babel/helper-validator-identifier" "^7.22.20" + "@babel/helper-validator-identifier" "^7.24.5" chalk "^2.4.2" js-tokens "^4.0.0" picocolors "^1.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.24.0", "@babel/parser@^7.24.1", "@babel/parser@^7.24.4": - version "7.24.4" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.4.tgz#234487a110d89ad5a3ed4a8a566c36b9453e8c88" - integrity sha512-zTvEBcghmeBma9QIGunWevvBAp4/Qu9Bdq+2k0Ot4fVMD6v3dsC9WOcRSKk7tRRyBM/53yKMJko9xOatGQAwSg== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.24.0", "@babel/parser@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.5.tgz#4a4d5ab4315579e5398a82dcf636ca80c3392790" + integrity sha512-EOv5IK8arwh3LI47dz1b0tKUb/1uhHAnHJOrjgtQMIpu1uXd9mlFrJg9IUgGUgZ41Ch0K8REPTYpO7B76b4vJg== "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -273,29 +268,29 @@ "@babel/parser" "^7.24.0" "@babel/types" "^7.24.0" -"@babel/traverse@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.1.tgz#d65c36ac9dd17282175d1e4a3c49d5b7988f530c" - integrity sha512-xuU6o9m68KeqZbQuDt2TcKSxUw/mrsvavlEqQ1leZ/B+C9tk6E4sRWy97WaXgvq5E+nU3cXMxv3WKOCanVMCmQ== +"@babel/traverse@^7.24.5": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.5.tgz#972aa0bc45f16983bf64aa1f877b2dd0eea7e6f8" + integrity sha512-7aaBLeDQ4zYcUFDUD41lJc1fG8+5IU9DaNSJAgal866FGvmD5EbWQgnEC6kO1gGLsX0esNkfnJSndbTXA3r7UA== dependencies: - "@babel/code-frame" "^7.24.1" - "@babel/generator" "^7.24.1" + "@babel/code-frame" "^7.24.2" + "@babel/generator" "^7.24.5" "@babel/helper-environment-visitor" "^7.22.20" "@babel/helper-function-name" "^7.23.0" "@babel/helper-hoist-variables" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/parser" "^7.24.1" - "@babel/types" "^7.24.0" + "@babel/helper-split-export-declaration" "^7.24.5" + "@babel/parser" "^7.24.5" + "@babel/types" "^7.24.5" debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.24.0", "@babel/types@^7.3.3": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.0.tgz#3b951f435a92e7333eba05b7566fd297960ea1bf" - integrity sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w== +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.24.0", "@babel/types@^7.24.5", "@babel/types@^7.3.3": + version "7.24.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.5.tgz#7661930afc638a5383eb0c4aee59b74f38db84d7" + integrity sha512-6mQNsaLeXTw0nxYUYu+NSa4Hx4BlF1x1x8/PMFbiR+GBSr+2DkECc69b8hgy2frEodNcvPffeH8YfWd3LI6jhQ== dependencies: - "@babel/helper-string-parser" "^7.23.4" - "@babel/helper-validator-identifier" "^7.22.20" + "@babel/helper-string-parser" "^7.24.1" + "@babel/helper-validator-identifier" "^7.24.5" to-fast-properties "^2.0.0" "@bcoe/v8-coverage@^0.2.3": @@ -752,9 +747,9 @@ integrity sha512-cIh8KTjpldzFzKGgrqUX4bFyav5lC52hXDKo4LbRuMVncs3zg4hcSf4HtURY+f2AfEZzN6ZKzXafQpThq3dl2g== "@cspell/dict-rust@^4.0.1": - version "4.0.2" - resolved "https://registry.yarnpkg.com/@cspell/dict-rust/-/dict-rust-4.0.2.tgz#e9111f0105ee6d836a1be8314f47347fd9f8fc3a" - integrity sha512-RhziKDrklzOntxAbY3AvNR58wnFGIo3YS8+dNeLY36GFuWOvXDHFStYw5Pod4f/VXbO/+1tXtywCC4zWfB2p1w== + version "4.0.3" + resolved "https://registry.yarnpkg.com/@cspell/dict-rust/-/dict-rust-4.0.3.tgz#ad61939f78bd63a07ae885f429eab24a74ad7f5e" + integrity sha512-8DFCzkFQ+2k3fDaezWc/D+0AyiBBiOGYfSDUfrTNU7wpvUvJ6cRcAUshMI/cn2QW/mmxTspRgVlXsE6GUMz00Q== "@cspell/dict-scala@^5.0.0": version "5.0.0" @@ -1894,9 +1889,9 @@ integrity sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g== "@types/node@*": - version "20.12.7" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.7.tgz#04080362fa3dd6c5822061aa3124f5c152cff384" - integrity sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg== + version "20.12.8" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.8.tgz#35897bf2bfe3469847ab04634636de09552e8256" + integrity sha512-NU0rJLJnshZWdE/097cdCBbyW1h4hEg0xpovcoAQYHl8dnEyp/NAOiE45pvc+Bd1Dt+2r94v2eGFpQJ4R7g+2w== dependencies: undici-types "~5.26.4" @@ -2084,14 +2079,14 @@ ajv@^6.12.4: uri-js "^4.2.2" ajv@^8.11.0: - version "8.12.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1" - integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA== + version "8.13.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.13.0.tgz#a3939eaec9fb80d217ddf0c3376948c023f28c91" + integrity sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA== dependencies: - fast-deep-equal "^3.1.1" + fast-deep-equal "^3.1.3" json-schema-traverse "^1.0.0" require-from-string "^2.0.2" - uri-js "^4.2.2" + uri-js "^4.4.1" ansi-escapes@^4.2.1: version "4.3.2" @@ -2296,9 +2291,9 @@ balanced-match@^1.0.0: integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== bole@^5.0.0: - version "5.0.11" - resolved "https://registry.yarnpkg.com/bole/-/bole-5.0.11.tgz#c4a165975422daee6f576360e882a425c8e40617" - integrity sha512-KB0Ye0iMAW5BnNbnLfMSQcnI186hKUzE2fpkZWqcxsoTR7eqzlTidSOMYPHJOn/yR7VGH7uSZp37qH9q2Et0zQ== + version "5.0.12" + resolved "https://registry.yarnpkg.com/bole/-/bole-5.0.12.tgz#434d44bb831e019fafdd2ecd1f2b71c8b64aa4a4" + integrity sha512-G5H5siOlUrcyvYr7kVlQyYMWip0dZ8qa+Uiy+d9QxOvBY2eaP/g8YsJVwvf3VIMbXmYxZIAOmmsuN3rL5r6gwQ== dependencies: fast-safe-stringify "^2.0.7" individual "^3.0.0" @@ -2402,9 +2397,9 @@ camelcase@^6.2.0: integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001587: - version "1.0.30001612" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001612.tgz#d34248b4ec1f117b70b24ad9ee04c90e0b8a14ae" - integrity sha512-lFgnZ07UhaCcsSZgWW0K5j4e69dK1u/ltrL9lTUiFOwNHs12S3UMIEYgBV0Z6C6hRDev7iRnMzzYmKabYdXF9g== + version "1.0.30001615" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001615.tgz#7c2c8772db681b6dee74d81d6550db68f2d28842" + integrity sha512-1IpazM5G3r38meiae0bHRnPhz+CBQ3ZLqbQMtrg+AsTPKAXgW38JNsXkyZ+v8waCsDmPq87lmfun5Q2AGysNEQ== chalk-template@^1.1.0: version "1.1.0" @@ -2446,9 +2441,9 @@ ci-info@^3.2.0: integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== cjs-module-lexer@^1.0.0: - version "1.2.3" - resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz#6c370ab19f8a3394e318fe682686ec0ac684d107" - integrity sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ== + version "1.3.1" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.3.1.tgz#c485341ae8fd999ca4ee5af2d7a1c9ae01e0099c" + integrity sha512-a3KdPAANPbNE4ZUv9h6LckSl9zLsYOP4MBmhIPkRaeyybt+r4UghLvq+xw/YwUcC1gqylCkL4rdVs3Lwupjm4Q== clean-stack@^2.0.0: version "2.2.0" @@ -2892,7 +2887,7 @@ define-data-property@^1.0.1, define-data-property@^1.1.4: es-errors "^1.3.0" gopd "^1.0.1" -define-properties@^1.1.3, define-properties@^1.2.0, define-properties@^1.2.1: +define-properties@^1.2.0, define-properties@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c" integrity sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg== @@ -2972,9 +2967,9 @@ easy-table@1.2.0: wcwidth "^1.0.1" electron-to-chromium@^1.4.668: - version "1.4.747" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.747.tgz#e37fa5b7b7e4c22607c5f59b5cf78f947266e77d" - integrity sha512-+FnSWZIAvFHbsNVmUxhEqWiaOiPMcfum1GQzlWCg/wLigVtshOsjXHyEFfmt6cFK6+HkS3QOJBv6/3OPumbBfw== + version "1.4.754" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.754.tgz#20a9f3cc80e0fb6a804b86605e55da16918a58b0" + integrity sha512-7Kr5jUdns5rL/M9wFFmMZAgFDuL2YOnanFH4OI4iFzUqyh3XOL7nAGbSlSMZdzKMIyyTpNSbqZsWG9odwLeKvA== emittery@^0.13.1: version "0.13.1" @@ -3170,7 +3165,7 @@ esbuild@~0.19.10: "@esbuild/win32-ia32" "0.19.12" "@esbuild/win32-x64" "0.19.12" -escalade@^3.1.1: +escalade@^3.1.1, escalade@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA== @@ -3719,11 +3714,12 @@ globals@^13.19.0: type-fest "^0.20.2" globalthis@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf" - integrity sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA== + version "1.0.4" + resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.4.tgz#7430ed3a975d97bfb59bcce41f5cabbafa651236" + integrity sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ== dependencies: - define-properties "^1.1.3" + define-properties "^1.2.1" + gopd "^1.0.1" globby@^11.1.0: version "11.1.0" @@ -3881,9 +3877,9 @@ import-local@^3.0.2: resolve-cwd "^3.0.0" import-meta-resolve@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/import-meta-resolve/-/import-meta-resolve-4.0.0.tgz#0b1195915689f60ab00f830af0f15cc841e8919e" - integrity sha512-okYUR7ZQPH+efeuMJGlq4f8ubUgO50kByRPyt/Cy1Io4PSRsPjxME+YlVaCOx+NIToW7hCsZNFJyTPFFKepRSA== + version "4.1.0" + resolved "https://registry.yarnpkg.com/import-meta-resolve/-/import-meta-resolve-4.1.0.tgz#f9db8bead9fafa61adb811db77a2bf22c5399706" + integrity sha512-I6fiaX09Xivtk+THaMfAwnA3MVA5Big1WHF1Dfx9hFuvNIWpXnorlkzhcQf6ehrqQiiZECRt1poOAkPmer3ruw== imurmurhash@^0.1.4: version "0.1.4" @@ -4900,9 +4896,9 @@ log-update@^6.0.0: wrap-ansi "^9.0.0" lru-cache@^10.0.1, lru-cache@^10.0.2, lru-cache@^10.2.0: - version "10.2.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.0.tgz#0bd445ca57363465900f4d1f9bd8db343a4d95c3" - integrity sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q== + version "10.2.2" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.2.tgz#48206bc114c1252940c41b25b41af5b545aca878" + integrity sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ== lru-cache@^5.1.1: version "5.1.1" @@ -5310,16 +5306,16 @@ onetime@^6.0.0: mimic-fn "^4.0.0" optionator@^0.9.3: - version "0.9.3" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" - integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== + version "0.9.4" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.4.tgz#7ea1c1a5d91d764fb282139c88fe11e182a3a734" + integrity sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g== dependencies: - "@aashutoshrathi/word-wrap" "^1.2.3" deep-is "^0.1.3" fast-levenshtein "^2.0.6" levn "^0.4.1" prelude-ls "^1.2.1" type-check "^0.4.0" + word-wrap "^1.2.5" p-defer@^1.0.0: version "1.0.0" @@ -5619,9 +5615,9 @@ randombytes@^2.1.0: safe-buffer "^5.1.0" react-is@^18.0.0: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" - integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== + version "18.3.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" + integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== read-package-json-fast@^3.0.0: version "3.0.2" @@ -6282,9 +6278,9 @@ synckit@^0.8.6: tslib "^2.6.2" terser@^5.17.4: - version "5.30.4" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.30.4.tgz#62b4d16a819424e6317fd5ceffb4ee8dc769803a" - integrity sha512-xRdd0v64a8mFK9bnsKVdoNP9GQIKUAaJPTaqEQDL4w/J8WaW4sWXXoMZ+6SimPkfT5bElreXf8m9HnmPc3E1BQ== + version "5.31.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.31.0.tgz#06eef86f17007dbad4593f11a574c7f5eb02c6a1" + integrity sha512-Q1JFAoUKE5IMfI4Z/lkE/E6+SwgzO+x4tq4v1AyBLRj8VSYvRO6A/rQrPg1yud4g0En9EKI1TvFRF2tQFcoUkg== dependencies: "@jridgewell/source-map" "^0.3.3" acorn "^8.8.2" @@ -6552,14 +6548,14 @@ universalify@^2.0.0: integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== update-browserslist-db@^1.0.13: - version "1.0.13" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" - integrity sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg== + version "1.0.14" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.14.tgz#46a9367c323f8ade9a9dddb7f3ae7814b3a0b31c" + integrity sha512-JixKH8GR2pWYshIPUg/NujK3JO7JiqEEUiNArE86NQyrgUuZeTlZQN3xuS/yiV5Kb48ev9K6RqNkaJjXsdg7Jw== dependencies: - escalade "^3.1.1" + escalade "^3.1.2" picocolors "^1.0.0" -uri-js@^4.2.2: +uri-js@^4.2.2, uri-js@^4.4.1: version "4.4.1" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== @@ -6686,6 +6682,11 @@ which@^4.0.0: dependencies: isexe "^3.1.1" +word-wrap@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" + integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== + "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" @@ -6776,9 +6777,9 @@ yaml@2.3.4: integrity sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA== yaml@^2.3.4: - version "2.4.1" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.4.1.tgz#2e57e0b5e995292c25c75d2658f0664765210eed" - integrity sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg== + version "2.4.2" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.4.2.tgz#7a2b30f2243a5fc299e1f14ca58d475ed4bc5362" + integrity sha512-B3VqDZ+JAg1nZpaEmWtTXUlBneoGx6CPM9b0TENK6aoSu5t73dItudwdgmi6tHlIZZId4dZ9skcAQ2UbcyAeVA== yargs-parser@^20.2.3: version "20.2.9" From 7b46a77ebe9b14858a278cf0ae0b866bd7ed1c91 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Fri, 3 May 2024 17:42:12 +0900 Subject: [PATCH 3/6] v2.1.0 --- package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e692d39..a4f4660 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ubiquibot/configuration", - "version": "1.0.0", + "version": "2.1.0", "private": false, "description": "Configuration helpers for Ubiquibot.", "author": "Ubiquity DAO", @@ -25,8 +25,7 @@ "ubiquibot", "open-source" ], - "dependencies": { - }, + "dependencies": {}, "peerDependencies": { "@octokit/webhooks": "12.2.0", "@sinclair/typebox": "0.32.23", From 59799e7025df77fa91a8441259deb7a865c9ec7c Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Fri, 3 May 2024 17:43:08 +0900 Subject: [PATCH 4/6] chore: bumped typebox version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a4f4660..9ac58e6 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "dependencies": {}, "peerDependencies": { "@octokit/webhooks": "12.2.0", - "@sinclair/typebox": "0.32.23", + "@sinclair/typebox": "0.32.27", "dotenv": "16.4.5", "lodash": "4.17.21", "ms": "2.1.3", From 1fdb75800050516fa3bb186276e4d22a309540b1 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Fri, 3 May 2024 18:05:54 +0900 Subject: [PATCH 5/6] chore: fixed tests --- src/utils/generate-configuration.ts | 5 ++++- tests/__mocks__/test-default-conf-obj.ts | 2 +- tests/__mocks__/test-valid-conf-obj.ts | 7 ++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/utils/generate-configuration.ts b/src/utils/generate-configuration.ts index 1868979..1ed2e0e 100644 --- a/src/utils/generate-configuration.ts +++ b/src/utils/generate-configuration.ts @@ -85,7 +85,10 @@ function transformUseReferences(config: BotConfig) { for (const plugins of Object.values(config.plugins)) { for (const plugin of plugins) { for (const use of plugin.uses) { - use.plugin = Value.Decode(githubPluginType(), use.plugin); + // This case happens if the object was not transformed before, otherwise the value can be safely be ignored + if (typeof use.plugin === "string") { + use.plugin = Value.Decode(githubPluginType(), use.plugin); + } } } } diff --git a/tests/__mocks__/test-default-conf-obj.ts b/tests/__mocks__/test-default-conf-obj.ts index 2f948db..424c04d 100644 --- a/tests/__mocks__/test-default-conf-obj.ts +++ b/tests/__mocks__/test-default-conf-obj.ts @@ -100,7 +100,7 @@ const defaultConfig = { skipBotEvents: true, uses: [ { - plugin: "ubiquity/conversation-rewards@testing/ubiquibot-v2-testing", + plugin: "ubiquibot/conversation-rewards@testing/ubiquibot-v2-testing", type: "github", with: { evmNetworkId: 100, diff --git a/tests/__mocks__/test-valid-conf-obj.ts b/tests/__mocks__/test-valid-conf-obj.ts index 23cef27..2180057 100644 --- a/tests/__mocks__/test-valid-conf-obj.ts +++ b/tests/__mocks__/test-valid-conf-obj.ts @@ -142,7 +142,12 @@ const validConfig = { skipBotEvents: true, uses: [ { - plugin: "ubiquity/conversation-rewards@testing/ubiquibot-v2-testing", + plugin: { + owner: "ubiquibot", + ref: "testing/ubiquibot-v2-testing", + repo: "conversation-rewards", + workflowId: "compute.yml", + }, type: "github", with: { evmNetworkId: 100, From 77c2fbded4b8358406e83cf55a424199a2382819 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Mon, 6 May 2024 16:01:01 +0900 Subject: [PATCH 6/6] feat!: removed unused parts of the old configuration --- .github/.ubiquibot-config.yml | 67 --------- src/types/configuration-types.ts | 68 --------- src/types/configuration/comment-types.ts | 38 ----- .../common-incentive-config-type.ts | 10 -- .../configuration/content-evaluator-config.ts | 10 -- src/types/configuration/data-purge-config.ts | 10 -- .../formatting-evaluator-config.ts | 27 ---- .../configuration/github-comment-config.ts | 18 --- src/types/configuration/index.ts | 8 -- .../permit-generation-configuration.ts | 10 -- .../configuration/user-extractor-config.ts | 14 -- src/types/index.ts | 1 - src/utils/generate-configuration.ts | 34 +---- tests/__mocks__/test-default-conf-obj.ts | 95 ------------ tests/__mocks__/test-valid-conf-obj.ts | 136 ------------------ tests/configuration.test.ts | 24 ++-- 16 files changed, 17 insertions(+), 553 deletions(-) delete mode 100644 src/types/configuration/comment-types.ts delete mode 100644 src/types/configuration/common-incentive-config-type.ts delete mode 100644 src/types/configuration/content-evaluator-config.ts delete mode 100644 src/types/configuration/data-purge-config.ts delete mode 100644 src/types/configuration/formatting-evaluator-config.ts delete mode 100644 src/types/configuration/github-comment-config.ts delete mode 100644 src/types/configuration/index.ts delete mode 100644 src/types/configuration/permit-generation-configuration.ts delete mode 100644 src/types/configuration/user-extractor-config.ts diff --git a/.github/.ubiquibot-config.yml b/.github/.ubiquibot-config.yml index 1655776..d009955 100644 --- a/.github/.ubiquibot-config.yml +++ b/.github/.ubiquibot-config.yml @@ -1,70 +1,3 @@ -incentives: - enabled: true - contentEvaluator: - enabled: true - userExtractor: - enabled: true - redeemTask: true - dataPurge: - enabled: true - formattingEvaluator: - enabled: true - scores: - br: 0 - code: 1 - p: 1 - em: 0 - img: 0 - strong: 0 - blockquote: 0 - h1: 1 - h2: 1 - h3: 1 - h4: 1 - h5: 1 - h6: 1 - a: 1 - li: 1 - td: 1 - hr: 0 - multipliers: - - type: [ ISSUE, ISSUER, SPECIFICATION ] - formattingMultiplier: 1 - wordValue: 0.1 - - type: [ ISSUE, ISSUER, COMMENTED ] - formattingMultiplier: 1 - wordValue: 0.2 - - type: [ ISSUE, ASSIGNEE, COMMENTED ] - formattingMultiplier: 0 - wordValue: 0 - - type: [ ISSUE, COLLABORATOR, COMMENTED ] - formattingMultiplier: 1 - wordValue: 0.1 - - type: [ ISSUE, CONTRIBUTOR, COMMENTED ] - formattingMultiplier: 0.25 - wordValue: 0.1 - - type: [ REVIEW, ISSUER, TASK ] - formattingMultiplier: 0 - wordValue: 0 - - type: [ REVIEW, ISSUER, COMMENTED ] - formattingMultiplier: 2 - wordValue: 0.2 - - type: [ REVIEW, ASSIGNEE, COMMENTED ] - formattingMultiplier: 1 - wordValue: 0.1 - - type: [ REVIEW, COLLABORATOR, COMMENTED ] - formattingMultiplier: 1 - wordValue: 0.1 - - type: [ REVIEW, CONTRIBUTOR, COMMENTED ] - formattingMultiplier: 0.25 - wordValue: 0.1 - permitGeneration: - enabled: true - githubComment: - enabled: true - post: true - debug: false - plugins: 'issues.closed': - skipBotEvents: true diff --git a/src/types/configuration-types.ts b/src/types/configuration-types.ts index 9c80fb3..47881f3 100644 --- a/src/types/configuration-types.ts +++ b/src/types/configuration-types.ts @@ -1,18 +1,7 @@ import { ObjectOptions, Static, StaticDecode, StringOptions, TProperties, Type as T } from "@sinclair/typebox"; import ms from "ms"; import { StandardValidator } from "typebox-validators"; -import { contentEvaluatorConfigurationType } from "./configuration/content-evaluator-config"; -import { dataPurgeConfigurationType } from "./configuration/data-purge-config"; -import { formattingEvaluatorConfigurationType } from "./configuration/formatting-evaluator-config"; -import { githubCommentConfigurationType } from "./configuration/github-comment-config"; -import { permitGenerationConfigurationType } from "./configuration/permit-generation-configuration"; import { pluginConfigurationSchema } from "./configuration/plugin-configuration"; -import { userExtractorConfigurationType } from "./configuration/user-extractor-config"; - -const promotionComment = - "###### If you enjoy the DevPool experience, please follow [Ubiquity on GitHub](https://github.com/ubiquity) and star [this repo](https://github.com/ubiquity/devpool-directory) to show your support. It helps a lot!"; -const defaultGreetingHeader = - "Thank you for contributing! Please be sure to set your wallet address before completing your first task so that you can collect your reward."; export enum LogLevel { FATAL = "fatal", @@ -22,12 +11,6 @@ export enum LogLevel { DEBUG = "debug", } -const allCommands = ["start", "stop", "help", "query", "ask", "multiplier", "labels", "authorize", "wallet"] as const; - -const defaultTimeLabels = ["Time: <1 Hour", "Time: <2 Hours", "Time: <4 Hours", "Time: <1 Day", "Time: <1 Week"]; - -const defaultPriorityLabels = ["Priority: 1 (Normal)", "Priority: 2 (Medium)", "Priority: 3 (High)", "Priority: 4 (Urgent)", "Priority: 5 (Emergency)"]; - function strictObject(obj: T, options?: ObjectOptions) { return T.Object(obj, { additionalProperties: false, default: {}, ...options }); } @@ -64,57 +47,6 @@ export type EnvConfigType = Static; export const botConfigSchema = strictObject( { - keys: strictObject({ - evmPrivateEncrypted: T.Optional(T.String()), - openAi: T.Optional(T.String()), - }), - features: strictObject({ - assistivePricing: T.Boolean({ default: false }), - defaultLabels: T.Array(T.String(), { default: [] }), - newContributorGreeting: strictObject({ - enabled: T.Boolean({ default: false }), - header: T.String({ default: defaultGreetingHeader }), - displayHelpMenu: T.Boolean({ default: true }), - footer: T.String({ default: promotionComment }), - }), - publicAccessControl: strictObject({ - setLabel: T.Boolean({ default: true }), - fundExternalClosedIssue: T.Boolean({ default: true }), - }), - isNftRewardEnabled: T.Boolean({ default: false }), - }), - timers: strictObject({ - reviewDelayTolerance: stringDuration({ default: "1 day" }), - taskStaleTimeoutDuration: stringDuration({ default: "4 weeks" }), - taskFollowUpDuration: stringDuration({ default: "0.5 weeks" }), - taskDisqualifyDuration: stringDuration({ default: "1 week" }), - }), - payments: strictObject({ - maxPermitPrice: T.Number({ default: Number.MAX_SAFE_INTEGER }), - evmNetworkId: T.Number({ default: 1 }), - basePriceMultiplier: T.Number({ default: 1 }), - issueCreatorMultiplier: T.Number({ default: 1 }), - }), - disabledCommands: T.Array(T.String(), { default: allCommands }), - incentives: strictObject({ - enabled: T.Boolean({ default: true }), - contentEvaluator: contentEvaluatorConfigurationType, - userExtractor: userExtractorConfigurationType, - dataPurge: dataPurgeConfigurationType, - formattingEvaluator: formattingEvaluatorConfigurationType, - permitGeneration: permitGenerationConfigurationType, - githubComment: githubCommentConfigurationType, - }), - labels: strictObject({ - time: T.Array(T.String(), { default: defaultTimeLabels }), - priority: T.Array(T.String(), { default: defaultPriorityLabels }), - }), - miscellaneous: strictObject({ - maxConcurrentTasks: T.Number({ default: Number.MAX_SAFE_INTEGER }), - promotionComment: T.String({ default: promotionComment }), - registerWalletWithVerification: T.Boolean({ default: false }), - openAiTokenLimit: T.Number({ default: 100000 }), - }), plugins: pluginConfigurationSchema, }, { default: undefined } // top level object can't have default! diff --git a/src/types/configuration/comment-types.ts b/src/types/configuration/comment-types.ts deleted file mode 100644 index 912575f..0000000 --- a/src/types/configuration/comment-types.ts +++ /dev/null @@ -1,38 +0,0 @@ -export enum CommentType { - /** - * Review related item - */ - REVIEW = 0b1, - /** - * Issue related item - */ - ISSUE = 0b10, - /** - * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW} - */ - ASSIGNEE = 0b100, - /** - * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW} - */ - ISSUER = 0b1000, - /** - * A user that is part of the organization or owner of the repo - */ - COLLABORATOR = 0b10000, - /** - * A user that is NOT part of the organization nor owner of the repo - */ - CONTRIBUTOR = 0b100000, - /** - * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW} - */ - COMMENTED = 0b1000000, - /** - * Pull request opening item - */ - TASK = 0b10000000, - /** - * Issue opening item - */ - SPECIFICATION = 0b100000000, -} diff --git a/src/types/configuration/common-incentive-config-type.ts b/src/types/configuration/common-incentive-config-type.ts deleted file mode 100644 index eed1eb8..0000000 --- a/src/types/configuration/common-incentive-config-type.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Type, Static } from "@sinclair/typebox"; - -export const baseIncentiveConfiguration = Type.Object({ - /** - * Enables or disabled this module - */ - enabled: Type.Boolean({ default: true }), -}); - -export type BaseConfiguration = Static; diff --git a/src/types/configuration/content-evaluator-config.ts b/src/types/configuration/content-evaluator-config.ts deleted file mode 100644 index 4b5c41d..0000000 --- a/src/types/configuration/content-evaluator-config.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Static, Type } from "@sinclair/typebox"; - -export const contentEvaluatorConfigurationType = Type.Object({ - /** - * Enables or disabled this module - */ - enabled: Type.Boolean(), -}); - -export type ContentEvaluatorConfiguration = Static; diff --git a/src/types/configuration/data-purge-config.ts b/src/types/configuration/data-purge-config.ts deleted file mode 100644 index 5fafca9..0000000 --- a/src/types/configuration/data-purge-config.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Type, Static } from "@sinclair/typebox"; - -export const dataPurgeConfigurationType = Type.Object({ - /** - * Enables or disabled this module - */ - enabled: Type.Boolean({ default: true }), -}); - -export type DataPurgeConfiguration = Static; diff --git a/src/types/configuration/formatting-evaluator-config.ts b/src/types/configuration/formatting-evaluator-config.ts deleted file mode 100644 index 4c5f44f..0000000 --- a/src/types/configuration/formatting-evaluator-config.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Static, Type } from "@sinclair/typebox"; -import { CommentType } from "./comment-types"; - -const type = Type.Union([...Object.keys(CommentType).map((key) => Type.Literal(key as keyof typeof CommentType))]); - -export const formattingEvaluatorConfigurationType = Type.Object({ - /** - * Enables or disabled this module - */ - enabled: Type.Boolean({ default: true }), - /** - * Multipliers applied to different parts of the comment body content - */ - multipliers: Type.Array( - Type.Object({ - type: Type.Array(type), - formattingMultiplier: Type.Number(), - wordValue: Type.Number(), - }) - ), - /** - * Attributed score per HTML entity - */ - scores: Type.Record(Type.String(), Type.Number()), -}); - -export type FormattingEvaluatorConfiguration = Static; diff --git a/src/types/configuration/github-comment-config.ts b/src/types/configuration/github-comment-config.ts deleted file mode 100644 index 30c1622..0000000 --- a/src/types/configuration/github-comment-config.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Static, Type } from "@sinclair/typebox"; - -export const githubCommentConfigurationType = Type.Object({ - /** - * Enables or disabled this module - */ - enabled: Type.Boolean({ default: true }), - /** - * Enables posting to the related GitHub Issue - */ - post: Type.Boolean({ default: true }), - /** - * Enables debug by creating a local html file of the rendered comment - */ - debug: Type.Boolean({ default: false }), -}); - -export type GithubCommentConfiguration = Static; diff --git a/src/types/configuration/index.ts b/src/types/configuration/index.ts deleted file mode 100644 index 37707e9..0000000 --- a/src/types/configuration/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export * from "./comment-types"; -export * from "./content-evaluator-config"; -export * from "./data-purge-config"; -export * from "./common-incentive-config-type"; -export * from "./github-comment-config"; -export * from "./formatting-evaluator-config"; -export * from "./permit-generation-configuration"; -export * from "./user-extractor-config"; diff --git a/src/types/configuration/permit-generation-configuration.ts b/src/types/configuration/permit-generation-configuration.ts deleted file mode 100644 index e755f2f..0000000 --- a/src/types/configuration/permit-generation-configuration.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Static, Type } from "@sinclair/typebox"; - -export const permitGenerationConfigurationType = Type.Object({ - /** - * Enables or disabled this module - */ - enabled: Type.Boolean(), -}); - -export type PermitGenerationConfiguration = Static; diff --git a/src/types/configuration/user-extractor-config.ts b/src/types/configuration/user-extractor-config.ts deleted file mode 100644 index 4cb2bf7..0000000 --- a/src/types/configuration/user-extractor-config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Static, Type } from "@sinclair/typebox"; - -export const userExtractorConfigurationType = Type.Object({ - /** - * Enables or disabled this module - */ - enabled: Type.Boolean({ default: true }), - /** - * Is the task redeemable, e.g. can the user collect the bounty? - */ - redeemTask: Type.Boolean({ default: true }), -}); - -export type UserExtractorConfiguration = Static; diff --git a/src/types/index.ts b/src/types/index.ts index d310596..e65c959 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,3 +1,2 @@ export * from "./configuration-types"; export * from "./valid-html-elements"; -export * from "./configuration"; diff --git a/src/utils/generate-configuration.ts b/src/utils/generate-configuration.ts index 1ed2e0e..d502be6 100644 --- a/src/utils/generate-configuration.ts +++ b/src/utils/generate-configuration.ts @@ -1,9 +1,9 @@ import { Value } from "@sinclair/typebox/value"; import mergeWith from "lodash/merge"; import YAML from "yaml"; -import { BotConfig, botConfigSchema, stringDuration, validateBotConfig } from "../types"; // @ts-expect-error gets transformed by rollup import orgConfig from "../../.github/.ubiquibot-config.yml"; +import { BotConfig, botConfigSchema, validateBotConfig } from "../types"; import { githubPluginType } from "../types/configuration/plugin-configuration"; export function generateConfiguration(repoConfig?: BotConfig): BotConfig { @@ -43,38 +43,6 @@ export function generateConfiguration(repoConfig?: BotConfig): BotConfig { // That's why we have transform every field manually and catch errors export function transformConfig(config: BotConfig) { let errorMsg = ""; - try { - config.timers.reviewDelayTolerance = Value.Decode(stringDuration(), config.timers.reviewDelayTolerance); - } catch (err: unknown) { - const decodeError = err as DecodeError; - if (decodeError.value) { - errorMsg += `Invalid reviewDelayTolerance value: ${decodeError.value}\n`; - } - } - try { - config.timers.taskStaleTimeoutDuration = Value.Decode(stringDuration(), config.timers.taskStaleTimeoutDuration); - } catch (err: unknown) { - const decodeError = err as DecodeError; - if (decodeError.value) { - errorMsg += `Invalid taskStaleTimeoutDuration value: ${decodeError.value}\n`; - } - } - try { - config.timers.taskFollowUpDuration = Value.Decode(stringDuration(), config.timers.taskFollowUpDuration); - } catch (err: unknown) { - const decodeError = err as DecodeError; - if (decodeError.value) { - errorMsg += `Invalid taskFollowUpDuration value: ${decodeError.value}\n`; - } - } - try { - config.timers.taskDisqualifyDuration = Value.Decode(stringDuration(), config.timers.taskDisqualifyDuration); - } catch (err: unknown) { - const decodeError = err as DecodeError; - if (decodeError.value) { - errorMsg += `Invalid taskDisqualifyDuration value: ${decodeError.value}\n`; - } - } errorMsg += transformUseReferences(config); if (errorMsg) throw new Error(errorMsg); } diff --git a/tests/__mocks__/test-default-conf-obj.ts b/tests/__mocks__/test-default-conf-obj.ts index 424c04d..ad83ad8 100644 --- a/tests/__mocks__/test-default-conf-obj.ts +++ b/tests/__mocks__/test-default-conf-obj.ts @@ -1,99 +1,4 @@ const defaultConfig = { - incentives: { - enabled: true, - contentEvaluator: { - enabled: true, - }, - userExtractor: { - enabled: true, - redeemTask: true, - }, - dataPurge: { - enabled: true, - }, - formattingEvaluator: { - enabled: true, - scores: { - br: 0, - code: 1, - p: 1, - em: 0, - img: 0, - strong: 0, - blockquote: 0, - h1: 1, - h2: 1, - h3: 1, - h4: 1, - h5: 1, - h6: 1, - a: 1, - li: 1, - td: 1, - hr: 0, - }, - multipliers: [ - { - type: ["ISSUE", "ISSUER", "SPECIFICATION"], - formattingMultiplier: 1, - wordValue: 0.1, - }, - { - type: ["ISSUE", "ISSUER", "COMMENTED"], - formattingMultiplier: 1, - wordValue: 0.2, - }, - { - type: ["ISSUE", "ASSIGNEE", "COMMENTED"], - formattingMultiplier: 0, - wordValue: 0, - }, - { - type: ["ISSUE", "COLLABORATOR", "COMMENTED"], - formattingMultiplier: 1, - wordValue: 0.1, - }, - { - type: ["ISSUE", "CONTRIBUTOR", "COMMENTED"], - formattingMultiplier: 0.25, - wordValue: 0.1, - }, - { - type: ["REVIEW", "ISSUER", "TASK"], - formattingMultiplier: 0, - wordValue: 0, - }, - { - type: ["REVIEW", "ISSUER", "COMMENTED"], - formattingMultiplier: 2, - wordValue: 0.2, - }, - { - type: ["REVIEW", "ASSIGNEE", "COMMENTED"], - formattingMultiplier: 1, - wordValue: 0.1, - }, - { - type: ["REVIEW", "COLLABORATOR", "COMMENTED"], - formattingMultiplier: 1, - wordValue: 0.1, - }, - { - type: ["REVIEW", "CONTRIBUTOR", "COMMENTED"], - formattingMultiplier: 0.25, - wordValue: 0.1, - }, - ], - }, - permitGeneration: { - enabled: true, - }, - githubComment: { - enabled: true, - post: true, - debug: false, - }, - }, plugins: { "issues.closed": [ { diff --git a/tests/__mocks__/test-valid-conf-obj.ts b/tests/__mocks__/test-valid-conf-obj.ts index 2180057..2ebcf98 100644 --- a/tests/__mocks__/test-valid-conf-obj.ts +++ b/tests/__mocks__/test-valid-conf-obj.ts @@ -1,140 +1,4 @@ const validConfig = { - keys: {}, - features: { - assistivePricing: false, - defaultLabels: [], - newContributorGreeting: { - enabled: false, - header: "Thank you for contributing! Please be sure to set your wallet address before completing your first task so that you can collect your reward.", - displayHelpMenu: true, - footer: - "###### If you enjoy the DevPool experience, please follow [Ubiquity on GitHub](https://github.com/ubiquity) and star [this repo](https://github.com/ubiquity/devpool-directory) to show your support. It helps a lot!", - }, - publicAccessControl: { - setLabel: true, - fundExternalClosedIssue: true, - }, - isNftRewardEnabled: false, - }, - timers: { - reviewDelayTolerance: 86400000, - taskStaleTimeoutDuration: 2419200000, - taskFollowUpDuration: 302400000, - taskDisqualifyDuration: 604800000, - }, - payments: { - maxPermitPrice: 9007199254740991, - evmNetworkId: 1, - basePriceMultiplier: 1, - issueCreatorMultiplier: 1, - }, - disabledCommands: ["start", "stop", "help", "query", "ask", "multiplier", "labels", "authorize", "wallet"], - incentives: { - enabled: true, - contentEvaluator: { - enabled: true, - }, - userExtractor: { - enabled: true, - redeemTask: true, - }, - dataPurge: { - enabled: true, - }, - formattingEvaluator: { - enabled: true, - scores: { - br: 0, - code: 1, - p: 1, - em: 0, - img: 0, - strong: 0, - blockquote: 0, - h1: 1, - h2: 1, - h3: 1, - h4: 1, - h5: 1, - h6: 1, - a: 1, - li: 1, - td: 1, - hr: 0, - }, - multipliers: [ - { - type: ["ISSUE", "ISSUER", "SPECIFICATION"], - formattingMultiplier: 1, - wordValue: 0.1, - }, - { - type: ["ISSUE", "ISSUER", "COMMENTED"], - formattingMultiplier: 1, - wordValue: 0.2, - }, - { - type: ["ISSUE", "ASSIGNEE", "COMMENTED"], - formattingMultiplier: 0, - wordValue: 0, - }, - { - type: ["ISSUE", "COLLABORATOR", "COMMENTED"], - formattingMultiplier: 1, - wordValue: 0.1, - }, - { - type: ["ISSUE", "CONTRIBUTOR", "COMMENTED"], - formattingMultiplier: 0.25, - wordValue: 0.1, - }, - { - type: ["REVIEW", "ISSUER", "TASK"], - formattingMultiplier: 0, - wordValue: 0, - }, - { - type: ["REVIEW", "ISSUER", "COMMENTED"], - formattingMultiplier: 2, - wordValue: 0.2, - }, - { - type: ["REVIEW", "ASSIGNEE", "COMMENTED"], - formattingMultiplier: 1, - wordValue: 0.1, - }, - { - type: ["REVIEW", "COLLABORATOR", "COMMENTED"], - formattingMultiplier: 1, - wordValue: 0.1, - }, - { - type: ["REVIEW", "CONTRIBUTOR", "COMMENTED"], - formattingMultiplier: 0.25, - wordValue: 0.1, - }, - ], - }, - permitGeneration: { - enabled: true, - }, - githubComment: { - enabled: true, - post: true, - debug: false, - }, - }, - labels: { - time: ["Time: <1 Hour", "Time: <2 Hours", "Time: <4 Hours", "Time: <1 Day", "Time: <1 Week"], - priority: ["Priority: 1 (Normal)", "Priority: 2 (Medium)", "Priority: 3 (High)", "Priority: 4 (Urgent)", "Priority: 5 (Emergency)"], - }, - miscellaneous: { - maxConcurrentTasks: 9007199254740991, - promotionComment: - "###### If you enjoy the DevPool experience, please follow [Ubiquity on GitHub](https://github.com/ubiquity) and star [this repo](https://github.com/ubiquity/devpool-directory) to show your support. It helps a lot!", - registerWalletWithVerification: false, - openAiTokenLimit: 100000, - }, plugins: { "*": [], "issues.closed": [ diff --git a/tests/configuration.test.ts b/tests/configuration.test.ts index db11342..21d427b 100644 --- a/tests/configuration.test.ts +++ b/tests/configuration.test.ts @@ -29,16 +29,24 @@ describe("Configuration generation", () => { test("Transform configuration", async () => { const cfg = generateConfiguration(); - expect(() => { - transformConfig(cfg); - }).toThrow(); const stringCfg = { ...cfg, - timers: { - reviewDelayTolerance: "86400000", - taskStaleTimeoutDuration: "2419200000", - taskFollowUpDuration: "302400000", - taskDisqualifyDuration: "604800000", + plugins: { + ...cfg.plugins, + "issues.closed": [ + { + skipBotEvents: true, + uses: [ + { + plugin: "ubiquibot/conversation-rewards@testing/ubiquibot-v2-testing", + type: "github", + with: { + evmNetworkId: 100, + }, + }, + ], + }, + ], }, } as unknown as BotConfig; transformConfig(stringCfg);