Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4ce46f3
chore(typescript): change moduleResolution
alexandre-abrioux Apr 14, 2025
1cc4d4d
remove corepack field
alexandre-abrioux Apr 14, 2025
08c1467
use nodenext
alexandre-abrioux Apr 14, 2025
13fcb50
change module too
alexandre-abrioux Apr 14, 2025
ec996e5
fix ajv
alexandre-abrioux Apr 14, 2025
c210da6
remove corepack field
alexandre-abrioux Apr 14, 2025
1aa1232
update hinkal
alexandre-abrioux Apr 15, 2025
bf4b00f
bump hinkal
alexandre-abrioux Apr 15, 2025
0882d51
Merge branch 'master' into moduleresolution
alexandre-abrioux Apr 17, 2025
ddd2837
fix ci
alexandre-abrioux Apr 17, 2025
4a7e963
fix ajv
alexandre-abrioux Apr 17, 2025
ca74d7c
fix jest
alexandre-abrioux Apr 17, 2025
2b9a2e9
remove corepack field
alexandre-abrioux Apr 17, 2025
9086e84
dedupe package
alexandre-abrioux Apr 17, 2025
5e58c52
esModuleInterop
alexandre-abrioux Apr 17, 2025
5511457
fix ci
alexandre-abrioux Apr 17, 2025
ec033a9
remove ci change
alexandre-abrioux Apr 17, 2025
944fd75
fix ci
alexandre-abrioux Apr 17, 2025
3dc97e4
fix ci
alexandre-abrioux Apr 17, 2025
2957d4d
update ts-jest
alexandre-abrioux Apr 17, 2025
2f55bf1
add isolatedmodules
alexandre-abrioux Apr 17, 2025
db0eb65
fix isolatedmodule errors
alexandre-abrioux Apr 17, 2025
17f77bd
fix isolatedmodule errors
alexandre-abrioux Apr 17, 2025
008fefe
fix isolatedmodule errors
alexandre-abrioux Apr 17, 2025
6e97cbb
fix isolatedmodule errors
alexandre-abrioux Apr 17, 2025
b43d2ca
fix isolatedmodule errors
alexandre-abrioux Apr 17, 2025
e491985
fix isolatedmodule errors
alexandre-abrioux Apr 17, 2025
7960f48
fix isolatedmodule errors
alexandre-abrioux Apr 17, 2025
cd24ea8
Merge branch 'master' into moduleresolution
alexandre-abrioux May 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"npm-package-json-lint": "5.1.0",
"prettier": "2.8.8",
"prettier-plugin-solidity": "1.0.0-beta.19",
"typescript": "5.1.3"
"typescript": "5.8.3"
Copy link
Member Author

@alexandre-abrioux alexandre-abrioux Apr 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated Typescript to support loading ES modules in CommonJS synchronously (without await import()):
https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require

This is needed to support the latest version of graphql-request used in the payment-detection package.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing we satisfy the final bullet point because we use .js extension and not "type": "commonjs"

Per the link:

require() only supports loading ECMAScript modules that meet the following requirements:

  • The module is fully synchronous (contains no top-level await); and
  • One of these conditions are met:
    • The file has a .mjs extension.
    • The file has a .js extension, and the closest package.json contains "type": "module"
    • The file has a .js extension, the closest package.json does not contain "type": "commonjs", and the module contains ES module syntax.

If the ES Module being loaded meets the requirements, require() can load it and return the module namespace object. In this case it is similar to dynamic import() but is run synchronously and returns the name space object directly.

},
"resolutions": {
"underscore": "^1.12.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/advanced-logic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"jest-junit": "16.0.0",
"ts-jest": "29.1.0",
"ts-node": "10.9.1",
"typescript": "5.1.3"
"typescript": "5.8.3"
},
"gitHead": "6155223cfce769e48ccae480c510b35b4f54b4d0"
}
2 changes: 1 addition & 1 deletion packages/currency/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@
"source-map-support": "0.5.19",
"ts-jest": "29.1.0",
"ts-node": "10.9.1",
"typescript": "5.1.3"
"typescript": "5.8.3"
}
}
2 changes: 1 addition & 1 deletion packages/data-access/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"source-map-support": "0.5.19",
"ts-jest": "29.1.0",
"ts-node": "10.9.1",
"typescript": "5.1.3"
"typescript": "5.8.3"
},
"gitHead": "6155223cfce769e48ccae480c510b35b4f54b4d0"
}
2 changes: 1 addition & 1 deletion packages/data-format/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@types/node": "18.11.9",
"jest-junit": "16.0.0",
"ts-node": "10.9.1",
"typescript": "5.1.3"
"typescript": "5.8.3"
},
"gitHead": "6155223cfce769e48ccae480c510b35b4f54b4d0"
}
2 changes: 1 addition & 1 deletion packages/epk-cipher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"ts-jest": "29.1.0",
"ts-loader": "8.4.0",
"ts-node": "10.9.1",
"typescript": "5.1.3",
"typescript": "5.8.3",
"webpack": "5.94.0",
"webpack-bundle-analyzer": "4.2.0",
"webpack-cli": "3.3.12"
Expand Down
2 changes: 1 addition & 1 deletion packages/epk-decryption/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"ts-jest": "29.1.0",
"ts-loader": "8.4.0",
"ts-node": "10.9.1",
"typescript": "5.1.3",
"typescript": "5.8.3",
"webpack": "5.94.0",
"webpack-bundle-analyzer": "4.2.0",
"webpack-cli": "3.3.12"
Expand Down
2 changes: 1 addition & 1 deletion packages/epk-signature/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"ts-jest": "29.1.0",
"ts-loader": "8.4.0",
"ts-node": "10.9.1",
"typescript": "5.1.3",
"typescript": "5.8.3",
"webpack": "5.94.0",
"webpack-bundle-analyzer": "4.2.0",
"webpack-cli": "3.3.12"
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"source-map-support": "0.5.19",
"ts-jest": "29.1.0",
"ts-node": "10.9.1",
"typescript": "5.1.3",
"typescript": "5.8.3",
"web3-providers-http": "1.3.6"
},
"gitHead": "6155223cfce769e48ccae480c510b35b4f54b4d0"
Expand Down
2 changes: 1 addition & 1 deletion packages/integration-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@
"ts-jest": "29.1.0",
"ts-node": "10.9.1",
"tslib": "2.5.0",
"typescript": "5.1.3"
"typescript": "5.8.3"
}
}
2 changes: 1 addition & 1 deletion packages/lit-protocol-cipher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@
"jest-junit": "16.0.0",
"ts-jest": "29.1.0",
"ts-node": "10.9.1",
"typescript": "5.1.3"
"typescript": "5.8.3"
}
}
2 changes: 1 addition & 1 deletion packages/multi-format/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
"source-map-support": "0.5.19",
"ts-jest": "29.1.0",
"ts-node": "10.9.1",
"typescript": "5.1.3"
"typescript": "5.8.3"
}
}
4 changes: 2 additions & 2 deletions packages/payment-detection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@graphql-codegen/cli": "4.0.1",
"@graphql-codegen/typescript": "4.0.1",
"@graphql-codegen/typescript-document-nodes": "4.0.1",
"@graphql-codegen/typescript-graphql-request": "6.0.1",
"@graphql-codegen/typescript-graphql-request": "6.2.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the generated GraphQL code that previously contained imports not compatible with latest module resolution.

"@graphql-codegen/typescript-operations": "4.0.1",
"@graphql-codegen/typescript-resolvers": "4.0.1",
"@jridgewell/gen-mapping": "0.3.2",
Expand All @@ -68,6 +68,6 @@
"source-map-support": "0.5.19",
"ts-jest": "29.1.0",
"ts-node": "10.9.1",
"typescript": "5.1.3"
"typescript": "5.8.3"
}
}
5 changes: 3 additions & 2 deletions packages/payment-detection/src/thegraph/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
import { CurrencyTypes } from '@requestnetwork/types';
import { NearChains } from '@requestnetwork/currency';
import { GraphQLClient } from 'graphql-request';
import { Block_Height, Maybe, getSdk } from './generated/graphql';
import { Block_Height, getSdk, Maybe } from './generated/graphql';
import { getSdk as getNearSdk } from './generated/graphql-near';
import { RequestConfig } from 'graphql-request/src/types';
Copy link
Member Author

@alexandre-abrioux alexandre-abrioux Apr 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import is not compatible with ESM. We can't do such type of imports anymore, as graphql-request/src/types is not an exported module.


const THE_GRAPH_STUDIO_URL =
'https://api.studio.thegraph.com/query/67444/request-payments-$NETWORK/version/latest';
Expand Down Expand Up @@ -41,6 +40,8 @@ export type TheGraphQueryOptions = {
blockFilter?: Maybe<Block_Height>;
};

type RequestConfig = (typeof GraphQLClient.prototype)['requestConfig'];

export type TheGraphClientOptions = RequestConfig & {
/** constraint to select indexers that have at least parsed this block */
minIndexedBlock?: number | undefined;
Expand Down
3 changes: 2 additions & 1 deletion packages/payment-detection/src/thegraph/superfluid.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { GraphQLClient } from 'graphql-request';
import { getSdk } from './generated/graphql-superfluid';
import { RequestConfig } from 'graphql-request/src/types';

const BASE_URL = `https://subgraph-endpoints.superfluid.dev`;
const NETWORK_TO_URL: Record<string, string> = {
Expand All @@ -16,6 +15,8 @@ const NETWORK_TO_URL: Record<string, string> = {
xdai: 'xdai-mainnet',
};

type RequestConfig = (typeof GraphQLClient.prototype)['requestConfig'];

// NB: the GraphQL client is automatically generated based on files present in ./queries,
// using graphql-codegen.
// To generate types, run `yarn codegen`, then open the generated files so that the code editor picks up the changes.
Expand Down
2 changes: 1 addition & 1 deletion packages/payment-processor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@
"jest-junit": "16.0.0",
"source-map-support": "0.5.19",
"ts-jest": "29.1.0",
"typescript": "5.1.3"
"typescript": "5.8.3"
}
}
2 changes: 1 addition & 1 deletion packages/request-client.js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"ts-jest": "29.1.0",
"ts-loader": "8.4.0",
"ts-node": "10.9.1",
"typescript": "5.1.3",
"typescript": "5.8.3",
"webpack": "5.94.0",
"webpack-bundle-analyzer": "4.2.0",
"webpack-cli": "3.3.12"
Expand Down
2 changes: 1 addition & 1 deletion packages/request-logic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"source-map-support": "0.5.19",
"ts-jest": "29.1.0",
"ts-node": "10.9.1",
"typescript": "5.1.3"
"typescript": "5.8.3"
},
"gitHead": "6155223cfce769e48ccae480c510b35b4f54b4d0"
}
4 changes: 2 additions & 2 deletions packages/request-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@requestnetwork/utils": "0.54.0",
"chalk": "4.1.0",
"cors": "2.8.5",
"dotenv": "8.2.0",
"dotenv": "16.5.0",
Copy link
Member Author

@alexandre-abrioux alexandre-abrioux Apr 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was an issue with how dotenv exported their types in older versions, resulting in error

TS7016: Could not find a declaration file for module dotenv.

"ethers": "5.7.2",
"express": "4.21.0",
"graphql": "16.8.1",
Expand Down Expand Up @@ -90,7 +90,7 @@
"ts-jest": "29.1.0",
"ts-node": "10.9.1",
"ts-node-dev": "1.0.0-pre.62",
"typescript": "5.1.3"
"typescript": "5.8.3"
},
"gitHead": "6155223cfce769e48ccae480c510b35b4f54b4d0"
}
2 changes: 1 addition & 1 deletion packages/smart-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@types/mocha": "8.2.3",
"@types/node": "18.11.9",
"chai": "4.3.4",
"dotenv": "10.0.0",
"dotenv": "16.5.0",
"ethereum-waffle": "3.4.4",
"ethers": "5.7.2",
"ganache-cli": "6.12.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/thegraph-data-access/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"source-map-support": "0.5.19",
"ts-jest": "29.1.0",
"ts-node": "10.9.1",
"typescript": "5.1.3"
"typescript": "5.8.3"
},
"gitHead": "6155223cfce769e48ccae480c510b35b4f54b4d0"
}
5 changes: 2 additions & 3 deletions packages/thegraph-data-access/src/subgraph-client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DataAccessTypes, StorageTypes } from '@requestnetwork/types';
import { GraphQLClient } from 'graphql-request';
import { GraphQLClient, Variables } from 'graphql-request';
import {
GetBlockQuery,
GetTransactionByDataHashQuery,
Expand All @@ -10,12 +10,11 @@ import {
Transaction,
TransactionsBody,
} from './queries';
import { Variables } from 'graphql-request/build/cjs/types';
import { RequestConfig } from 'graphql-request/build/legacy/helpers/types';

// Max Int value (as supported by grapqhl types)
const MAX_INT_VALUE = 0x7fffffff;

type RequestConfig = (typeof GraphQLClient.prototype)['requestConfig'];
type ClientConfig = Omit<RequestConfig, 'headers'> & { headers?: Record<string, string> };

export class SubgraphClient implements StorageTypes.IIndexer {
Expand Down
7 changes: 4 additions & 3 deletions packages/thegraph-data-access/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { StorageTypes } from '@requestnetwork/types';
import { DataAccessBaseOptions } from '@requestnetwork/data-access';
import { RequestConfig } from 'graphql-request/build/legacy/helpers/types';
import type { StorageTypes } from '@requestnetwork/types';
import type { DataAccessBaseOptions } from '@requestnetwork/data-access';
import type { GraphQLClient } from 'graphql-request';

type RequestConfig = (typeof GraphQLClient.prototype)['requestConfig'];
export type TheGraphDataAccessOptions = DataAccessBaseOptions & {
graphql: { url: string } & Omit<RequestConfig, 'headers'> & { headers?: Record<string, string> };
storage?: StorageTypes.IStorageWrite;
Expand Down
2 changes: 1 addition & 1 deletion packages/toolbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@
"@types/yargs": "17.0.14",
"cross-env": "7.0.2",
"ts-node": "10.9.1",
"typescript": "5.1.3"
"typescript": "5.8.3"
}
}
2 changes: 1 addition & 1 deletion packages/transaction-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"source-map-support": "0.5.19",
"ts-jest": "29.1.0",
"ts-node": "10.9.1",
"typescript": "5.1.3"
"typescript": "5.8.3"
},
"gitHead": "6155223cfce769e48ccae480c510b35b4f54b4d0"
}
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"devDependencies": {
"ts-node": "10.9.1",
"typed-emitter": "2.1.0",
"typescript": "5.1.3"
"typescript": "5.8.3"
},
"gitHead": "6155223cfce769e48ccae480c510b35b4f54b4d0"
}
2 changes: 1 addition & 1 deletion packages/usage-examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
},
"devDependencies": {
"ts-node": "10.9.1",
"typescript": "5.1.3"
"typescript": "5.8.3"
}
}
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"source-map-support": "0.5.19",
"ts-jest": "29.1.0",
"ts-node": "10.9.1",
"typescript": "5.1.3"
"typescript": "5.8.3"
},
"gitHead": "6155223cfce769e48ccae480c510b35b4f54b4d0"
}
2 changes: 1 addition & 1 deletion packages/web3-signature/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"ts-jest": "29.1.0",
"ts-loader": "8.4.0",
"ts-node": "10.9.1",
"typescript": "5.1.3",
"typescript": "5.8.3",
"webpack": "5.94.0",
"webpack-bundle-analyzer": "4.2.0",
"webpack-cli": "3.3.12"
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"moduleResolution": "node16",
"importHelpers": true,
"composite": true,
"declaration": true,
Expand All @@ -10,7 +11,6 @@
"strict": true,
"baseUrl": "./packages",
"skipLibCheck": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"useUnknownInCatchVariables": false,
"lib": ["es2019"]
Expand Down
Loading