Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes Node version 14 from pre/post-processing specification. #1652

Merged
merged 2 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions .changeset/rare-weeks-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@api3/airnode-adapter': minor
'@api3/airnode-deployer': minor
'@api3/airnode-examples': minor
'@api3/airnode-node': minor
'@api3/airnode-validator': minor
---

Removes Node version 14 from pre/post-processing specification.
To do so, bumps @api3/ois to 2.0.0 and zod to 3.20.6.
2 changes: 1 addition & 1 deletion packages/airnode-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test:watch": "yarn test:ts --watch"
},
"dependencies": {
"@api3/ois": "1.4.0",
"@api3/ois": "2.0.0",
"@api3/promise-utils": "^0.3.0",
"axios": "^1.2.4",
"bignumber.js": "^9.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-adapter/test/fixtures/ois.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { OIS } from '@api3/ois';

export function buildOIS(overrides?: Partial<OIS>): OIS {
return {
oisFormat: '1.4.0',
oisFormat: '2.0.0',
version: '1.2.3',
title: 'Currency Converter API',
apiSpecifications: {
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-deployer/config/config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.4.0",
"oisFormat": "2.0.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-deployer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"lodash": "^4.17.21",
"ora": "^5.4.1",
"yargs": "^17.6.2",
"zod": "^3.20.0"
"zod": "^3.20.6"
},
"devDependencies": {
"@google-cloud/functions-framework": "^3.1.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.4.0",
"oisFormat": "2.0.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.4.0",
"oisFormat": "2.0.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.4.0",
"oisFormat": "2.0.0",
"title": "CoinMarketCap Basic Authenticated Request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.4.0',
oisFormat: '2.0.0',
title: 'CoinMarketCap Basic Authenticated Request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.4.0",
"oisFormat": "2.0.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.4.0',
oisFormat: '2.0.0',
title: 'CoinGecko basic request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.4.0",
"oisFormat": "2.0.0",
"title": "CoinGecko coins markets request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down Expand Up @@ -193,7 +193,7 @@
],
"postProcessingSpecifications": [
{
"environment": "Node 14",
"environment": "Node",
"timeoutMs": 5000,
"value": "\n // Log out every coin data\n input.forEach((coinData) => {\n console.log(`[Post-processing snippet]: Received the following coin data: \\${JSON.stringify(coinData, null, 2)}`)\n })\n\n const sum = (nums) => nums.reduce((acc, num) => acc + num, 0);\n const average = sum(input.map((coinData) => coinData.current_price)) / input.length;\n const percentageChange = sum(input.map((coinData) => coinData.price_change_percentage_30d_in_currency)) / input.length;\n\n // Create the data to be sent on chain and multiply it by 10^8 to preserve precision\n const output = [average, percentageChange].map((x) => x * 10 ** 8);\n "
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.4.0',
oisFormat: '2.0.0',
title: 'CoinGecko coins markets request',
version: '1.0.0',
apiSpecifications: {
Expand Down Expand Up @@ -200,7 +200,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
],
postProcessingSpecifications: [
{
environment: 'Node 14',
environment: 'Node',
timeoutMs: 5000,
value: `
// Log out every coin data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.4.0",
"oisFormat": "2.0.0",
"title": "CoinGecko history data request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down Expand Up @@ -160,7 +160,7 @@
],
"preProcessingSpecifications": [
{
"environment": "Node 14",
"environment": "Node",
"timeoutMs": 5000,
"value": "\n const rawDate = new Date(input.unixTimestamp * 1000);\n const day = rawDate.getDate().toString().padStart(2, '0');\n const month = (rawDate.getMonth() + 1).toString().padStart(2, '0'); // Months start at 0\n const year = rawDate.getFullYear();\n\n const formattedDate = day + '-' + month + '-' + year;\n const output = {...input, unixTimestamp: formattedDate};\n\n console.log(`[Pre-processing snippet]: Formatted \\${input.unixTimestamp} to \\${formattedDate}.`)\n "
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.4.0',
oisFormat: '2.0.0',
title: 'CoinGecko history data request',
version: '1.0.0',
apiSpecifications: {
Expand Down Expand Up @@ -167,7 +167,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
],
preProcessingSpecifications: [
{
environment: 'Node 14',
environment: 'Node',
timeoutMs: 5000,
value: `
const rawDate = new Date(input.unixTimestamp * 1000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.4.0",
"oisFormat": "2.0.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.4.0',
oisFormat: '2.0.0',
title: 'CoinGecko basic request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
],
"ois": [
{
"oisFormat": "1.4.0",
"oisFormat": "2.0.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
],
ois: [
{
oisFormat: '1.4.0',
oisFormat: '2.0.0',
title: 'CoinGecko basic request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.4.0",
"oisFormat": "2.0.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.4.0',
oisFormat: '2.0.0',
title: 'CoinGecko basic request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.4.0",
"oisFormat": "2.0.0",
"title": "CoinGecko basic request",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.4.0',
oisFormat: '2.0.0',
title: 'CoinGecko basic request',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.4.0",
"oisFormat": "2.0.0",
"title": "Failure Example",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.4.0',
oisFormat: '2.0.0',
title: 'Failure Example',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.4.0",
"oisFormat": "2.0.0",
"title": "Relay Security Schemes via httpbin",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.4.0',
oisFormat: '2.0.0',
title: 'Relay Security Schemes via httpbin',
version: '1.0.0',
apiSpecifications: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.4.0",
"oisFormat": "2.0.0",
"title": "OpenWeather Multiple Encoded Values",
"version": "1.0.0",
"apiSpecifications": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const createConfig = async (generateExampleFile: boolean): Promise<Config> => ({
templates: [],
ois: [
{
oisFormat: '1.4.0',
oisFormat: '2.0.0',
title: 'OpenWeather Multiple Encoded Values',
version: '1.0.0',
apiSpecifications: {
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-node/config/config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"templates": [],
"ois": [
{
"oisFormat": "1.4.0",
"oisFormat": "2.0.0",
"version": "1.2.3",
"title": "Currency Converter API",
"apiSpecifications": {
Expand Down
4 changes: 2 additions & 2 deletions packages/airnode-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@api3/airnode-protocol": "^0.10.0",
"@api3/airnode-utilities": "^0.10.0",
"@api3/airnode-validator": "^0.10.0",
"@api3/ois": "1.4.0",
"@api3/ois": "2.0.0",
"@api3/promise-utils": "^0.3.0",
"aws-sdk": "^2.1302.0",
"dotenv": "^16.0.3",
Expand All @@ -38,7 +38,7 @@
"google-auth-library": "^8.7.0",
"lodash": "^4.17.21",
"yargs": "^17.6.2",
"zod": "^3.20.0"
"zod": "^3.20.6"
},
"devDependencies": {
"@api3/airnode-operation": "^0.10.0",
Expand Down
16 changes: 8 additions & 8 deletions packages/airnode-node/src/api/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,12 @@ describe('callApi', () => {
const config = fixtures.buildConfig();
const preProcessingSpecifications = [
{
environment: 'Node 14' as const,
environment: 'Node' as const,
value: 'const output = {...input, from: "BTC"};',
timeoutMs: 5_000,
},
{
environment: 'Node 14' as const,
environment: 'Node' as const,
value: 'const output = {...input, source: "airnode"};',
timeoutMs: 5_000,
},
Expand Down Expand Up @@ -390,12 +390,12 @@ describe('callApi', () => {
const config = fixtures.buildConfig();
const postProcessingSpecifications = [
{
environment: 'Node 14' as const,
environment: 'Node' as const,
value: 'const output = parseInt(input.price)*1000;',
timeoutMs: 5_000,
},
{
environment: 'Node 14' as const,
environment: 'Node' as const,
value: 'const output = parseInt(input)*2;',
timeoutMs: 5_000,
},
Expand Down Expand Up @@ -436,7 +436,7 @@ describe('callApi', () => {
const aggregatedApiCall = fixtures.buildAggregatedRegularApiCall({ parameters });
const preProcessingSpecifications = [
{
environment: 'Node 14' as const,
environment: 'Node' as const,
value: 'const output = { result: (parseInt(input.parameter1) * 2).toString() }',
timeoutMs: 5000,
},
Expand Down Expand Up @@ -469,7 +469,7 @@ describe('callApi', () => {
const aggregatedApiCall = fixtures.buildAggregatedRegularApiCall({ parameters });
const postProcessingSpecifications = [
{
environment: 'Node 14' as const,
environment: 'Node' as const,
value: 'const output = { result: (parseInt(input.parameter1) * 2).toString() }',
timeoutMs: 5000,
},
Expand Down Expand Up @@ -502,14 +502,14 @@ describe('callApi', () => {
const aggregatedApiCall = fixtures.buildAggregatedRegularApiCall({ parameters });
const preProcessingSpecifications = [
{
environment: 'Node 14' as const,
environment: 'Node' as const,
value: 'const output = {...input, addThis: "5" }',
timeoutMs: 5000,
},
];
const postProcessingSpecifications = [
{
environment: 'Node 14' as const,
environment: 'Node' as const,
value: 'const output = { result: (parseInt(input.parameter1) * 2 + parseInt(input.addThis)).toString() }',
timeoutMs: 5000,
},
Expand Down
Loading