Skip to content
Merged
19 changes: 19 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@
"rules": {
"lodash/import-scope": ["error", "method"]
},
"overrides": [
{
"files": ["**/*.test.ts"],
"rules": {
"jest/prefer-ending-with-an-expect": [
"error",
{
"assertFunctionNames": ["expect*", "assertGoSuccess", "assertGoError", "assertType"]
}
],
"jest/expect-expect": [
"warn",
{
"assertFunctionNames": ["expect*", "assertGoSuccess", "assertGoError", "assertType"]
}
]
}
}
],
"parserOptions": {
"project": ["./tsconfig.json"]
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Read the documentation and sources of each module how to use it in the project.
- [http](./src/http/README.md)
- [logger](./src/logger/README.md)
- [processing](./src/processing/README.md)
- [promises](./src/promises/README.md)
- [release-scripts](./src/release-scripts/README.md)
- [run-in-loop](./src/run-in-loop/README.md)
- [utils](./src/utils/README.md)
Expand Down Expand Up @@ -52,7 +53,6 @@ manually, by adding the following to your `tsconfig.json`:
- [contracts](https://github.com/api3dao/contracts)
- [eslint-plugin-commons](https://github.com/api3dao/eslint-plugin-commons)
- [ois](https://github.com/api3dao/ois)
- [promise-utils](https://github.com/api3dao/promise-utils)

## For developers

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
},
"dependencies": {
"@api3/ois": "^3.0.0",
"@api3/promise-utils": "^0.4.0",
"@octokit/rest": "^20.1.1",
"axios": "^1.18.1",
"dotenv": "^17.4.2",
Expand All @@ -60,6 +59,7 @@
"prettier": "^3.8.1",
"ts-jest": "^29.4.9",
"ts-node": "^10.9.2",
"type-plus": "^7.6.2",
"typescript": "^5.9.3"
}
}
46 changes: 35 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/blockchain-utilities/schema.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { goSync } from '@api3/promise-utils';
import { ethers } from 'ethers';
import { z } from 'zod';

import { goSync } from '../promises';

export const hexSchema = z
.string()
.regex(/^0x[\dA-Fa-f]+$/, 'Invalid hex string format')
Expand Down
3 changes: 2 additions & 1 deletion src/config-parsing/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { goSync } from '@api3/promise-utils';
import { ZodError } from 'zod';

import { goSync } from '../promises';

import { interpolateSecretsIntoConfig } from './index';

const rawConfig = {
Expand Down
3 changes: 2 additions & 1 deletion src/http/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { go, type GoAsyncOptions } from '@api3/promise-utils';
import axios, { type Method, type AxiosError, type AxiosResponse } from 'axios';

import { go, type GoAsyncOptions } from '../promises';

const DEFAULT_TIMEOUT_MS = 10_000;

export interface Request {
Expand Down
10 changes: 5 additions & 5 deletions src/processing/processing.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable jest/prefer-strict-equal */ // Because the errors are thrown from the "vm" module (different context), they are not strictly equal.
import { go } from '@api3/promise-utils';
import { ZodError } from 'zod';

import { createEndpoint } from '../../test/fixtures/processing';
import { go } from '../promises';

import {
addReservedParameters,
Expand Down Expand Up @@ -59,7 +59,7 @@ describe(preProcessEndpointParametersV1.name, () => {

const throwingFunc = async () => preProcessEndpointParametersV1(preProcessingSpecifications, parameters);

await expect(throwingFunc).rejects.toThrow('SyntaxError: Unexpected identifier');
await expect(throwingFunc).rejects.toThrow('Unexpected identifier');
});

it('demonstrates access to endpointParameters, but reserved parameters are inaccessible', async () => {
Expand Down Expand Up @@ -193,7 +193,7 @@ describe(postProcessResponseV1.name, () => {

const throwingFunc = async () => postProcessResponseV1({ price: 1000 }, postProcessingSpecifications, parameters);

await expect(throwingFunc).rejects.toThrow('SyntaxError: Unexpected identifier');
await expect(throwingFunc).rejects.toThrow('Unexpected identifier');
});
});

Expand Down Expand Up @@ -299,7 +299,7 @@ describe(preProcessEndpointParametersV2.name, () => {

const throwingFunc = async () => preProcessEndpointParametersV2(preProcessingSpecificationV2, parameters);

await expect(throwingFunc).rejects.toThrow('SyntaxError: Unexpected identifier');
await expect(throwingFunc).rejects.toThrow('Unexpected identifier');
});

it('reserved parameters are inaccessible', async () => {
Expand Down Expand Up @@ -452,7 +452,7 @@ describe(postProcessResponseV2.name, () => {
const throwingFunc = async () =>
postProcessResponseV2({ price: 1000 }, postProcessingSpecificationV2, parameters);

await expect(throwingFunc).rejects.toThrow('SyntaxError: Unexpected identifier');
await expect(throwingFunc).rejects.toThrow('Unexpected identifier');
});
});

Expand Down
3 changes: 2 additions & 1 deletion src/processing/processing.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { type Endpoint, RESERVED_PARAMETERS } from '@api3/ois';
import { type GoAsyncOptions, go } from '@api3/promise-utils';

import { type GoAsyncOptions, go } from '../promises';

import {
type EndpointParameters,
Expand Down
2 changes: 1 addition & 1 deletion src/processing/unsafe-evaluate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import vm from 'node:vm';
import worker_threads from 'node:worker_threads';
import zlib from 'node:zlib';

import { type GoWrappedError, go } from '@api3/promise-utils';
import { type GoWrappedError, go } from '../promises';

import { createTimers } from './vm-timers';

Expand Down
Loading