Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: api3dao/signed-api
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.2.0
Choose a base ref
...
head repository: api3dao/signed-api
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Dec 31, 2023

  1. Update dependency is-wsl to v3 (#181)

    * Update dependency is-wsl to v3
    
    * Ignore is-wsl dependency, increase renovate PR frequency
    
    ---------
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    Co-authored-by: Emanuel Tesař <e.tesarr@gmail.com>
    renovate[bot] and Siegrift authored Dec 31, 2023
    Copy the full SHA
    cd8c9c3 View commit details

Commits on Jan 1, 2024

  1. Update non-major-devDependencies (#184)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 1, 2024
    Copy the full SHA
    e5e29dc View commit details

Commits on Jan 8, 2024

  1. Update non-major-devDependencies (#192)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 8, 2024
    Copy the full SHA
    0587de5 View commit details
  2. Update pnpm to ^8.13.1 (#187)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 8, 2024
    Copy the full SHA
    a61f815 View commit details
  3. Update non-major-dependencies (#183)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 8, 2024
    Copy the full SHA
    16169a4 View commit details
  4. Copy the full SHA
    b644303 View commit details
  5. Copy the full SHA
    61ea35d View commit details
  6. Add airnode address to POST endpoint as a path parameter (#189)

    * Add airnode address to POST endpoint as a path parameter
    
    * Check authentication first
    
    * Update package name in READMEs
    
    * Fix typo
    bdrhn9 authored Jan 8, 2024
    Copy the full SHA
    d3aa269 View commit details
  7. Copy the full SHA
    d6c6d03 View commit details
  8. v0.3.0

    Siegrift committed Jan 8, 2024
    Copy the full SHA
    0ce9357 View commit details

Commits on Jan 10, 2024

  1. Update pnpm to ^8.14.0 (#194)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 10, 2024
    Copy the full SHA
    7cf36f2 View commit details

Commits on Jan 17, 2024

  1. Update non-major-dependencies (#196)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 17, 2024
    Copy the full SHA
    752b2d4 View commit details

Commits on Jan 18, 2024

  1. Update pnpm to ^8.14.1 (#198)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 18, 2024
    Copy the full SHA
    1210485 View commit details
  2. Update non-major-devDependencies (#197)

    * Update non-major-devDependencies
    
    * Disable broken ESLint rule, fix lint
    
    ---------
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    Co-authored-by: Emanuel Tesař <e.tesarr@gmail.com>
    renovate[bot] and Siegrift authored Jan 18, 2024
    Copy the full SHA
    7cb4f29 View commit details
  3. Implement secrets interpolation, update CF template (#199)

    * Allow Signed API to interpolate secrets
    
    * Update docs regarding secrets interpolation
    
    * Update CloudFormation file
    
    * Fix e2e test
    Siegrift authored Jan 18, 2024
    Copy the full SHA
    19e0482 View commit details
  4. Support caching on AWS CloudFront (#200)

    * Update cache
    
    * Update docs regarding cache
    
    * Fix test
    Siegrift authored Jan 18, 2024
    Copy the full SHA
    0e93ebf View commit details
  5. Fix README (#201)

    Siegrift authored Jan 18, 2024
    Copy the full SHA
    dcfa993 View commit details
  6. v0.4.0

    Siegrift committed Jan 18, 2024
    Copy the full SHA
    c1fa053 View commit details

Commits on Jan 19, 2024

  1. Forward logs to Loki (#129)

    * Update CloudFormation template
    
    * Use airnode label instead of airnodeAddress
    Siegrift authored Jan 19, 2024
    Copy the full SHA
    6b2cf90 View commit details

Commits on Jan 23, 2024

  1. Update dependency @aws-sdk/client-s3 to ^3.490.0 (#202)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 23, 2024
    Copy the full SHA
    92936e8 View commit details

Commits on Jan 29, 2024

  1. Update non-major-devDependencies (#203)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Jan 29, 2024
    Copy the full SHA
    d8e3ba4 View commit details

Commits on Jan 31, 2024

  1. Copy the full SHA
    9aa11fa View commit details

Commits on Feb 2, 2024

  1. Update dependency husky to v9 (#210)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 2, 2024
    Copy the full SHA
    66084c6 View commit details
  2. Update non-major-dependencies (#204)

    * Update non-major-dependencies
    
    * Fix lint
    
    ---------
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    Co-authored-by: Emanuel Tesař <e.tesarr@gmail.com>
    renovate[bot] and Siegrift authored Feb 2, 2024
    Copy the full SHA
    f6e03d4 View commit details

Commits on Feb 7, 2024

  1. Implement async signed data validation (#215)

    * Implement signature verification in a Worker
    
    * Move worker pool to separate module
    
    * Fix is batch unique check
    
    * Resolve remaining TODOs
    
    * Fix loading service worker
    
    * Specify min workers
    
    * Move ts-node to dev-deps
    
    * Fix tests, initialize pool just once
    
    * Increase test timeout
    Siegrift authored Feb 7, 2024
    Copy the full SHA
    905ec21 View commit details
  2. Handle configuration errors, minor code cleanup (#217)

    * Set LOG_LEVEL to INFO
    
    * Lint also performance test workspace
    
    * Rename DEV_SERVER_PORT to SERVER_PORT
    
    * Using single entrypoint for dev-server and prod
    
    * Handle configuration errors in Signed API
    
    * Handle configuration error in Airnode feed
    
    * Self review, fix tests
    Siegrift authored Feb 7, 2024
    Copy the full SHA
    b29a56a View commit details
  3. Copy the full SHA
    81e8124 View commit details

Commits on Feb 8, 2024

  1. Update non-major-devDependencies (#221)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 8, 2024
    Copy the full SHA
    89f83af View commit details
  2. Update dependency @aws-sdk/client-s3 to ^3.504.0 (#220)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 8, 2024
    Copy the full SHA
    0299186 View commit details
  3. Copy the full SHA
    4245010 View commit details
  4. Improve uncaught error handling, include configuration errors in logs (

    …#227)
    
    * Improve uncaught error handling
    
    * Exit on uncaught error to avoid logging to stderr
    
    * Make sure the configuration issues are logged
    Siegrift authored Feb 8, 2024
    Copy the full SHA
    b1991e0 View commit details
  5. v0.5.0

    Siegrift committed Feb 8, 2024
    Copy the full SHA
    5590378 View commit details

Commits on Feb 15, 2024

  1. Copy the full SHA
    4376116 View commit details

Commits on Feb 19, 2024

  1. Fix timestamps not used when signing payload (#229)

    * Use timestamps from post-processing
    
    * Lint README
    
    * PR comments
    
    * Minor fix to e2e README
    aquarat authored Feb 19, 2024
    Copy the full SHA
    2eed67e View commit details

Commits on Feb 22, 2024

  1. Copy the full SHA
    01eb235 View commit details

Commits on Feb 23, 2024

  1. v0.5.1

    Siegrift committed Feb 23, 2024
    Copy the full SHA
    44232f8 View commit details

Commits on Feb 26, 2024

  1. Update non-major-dependencies (#230)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 26, 2024
    Copy the full SHA
    fab51f8 View commit details
  2. Update Node.js to >=18.19.1 (#236)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 26, 2024
    Copy the full SHA
    4073b22 View commit details
  3. Update typescript-eslint monorepo to v7 (#235)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Feb 26, 2024
    Copy the full SHA
    b499557 View commit details
  4. Update non-major-devDependencies (#231)

    * Update non-major-devDependencies
    
    * Fix lint
    
    ---------
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    Co-authored-by: Emanuel Tesař <e.tesarr@gmail.com>
    renovate[bot] and Siegrift authored Feb 26, 2024
    Copy the full SHA
    e03d017 View commit details
  5. Log received signed data (#241)

    * Log received signed data
    
    * Update spelling to be `LOG_API_DATA`
    
    * Add option to enable/disable heartbeat log
    bdrhn9 authored Feb 26, 2024
    Copy the full SHA
    2129d8f View commit details

Commits on Feb 29, 2024

  1. Update commons library (#244)

    * Update commons
    
    * Use the released commons version
    Siegrift authored Feb 29, 2024
    Copy the full SHA
    7cda2c4 View commit details
  2. Node 20 Bump (#246)

    * Initial Node 20 bump
    
    * Extra references
    
    * Revert Node bump in package.json
    aquarat authored Feb 29, 2024
    1
    Copy the full SHA
    6cc350b View commit details
  3. v0.6.0

    Siegrift committed Feb 29, 2024
    Copy the full SHA
    01a8438 View commit details
  4. Support skipping API calls (#245)

    * Allow skipping API calls
    
    * Fix leaky test
    
    * Simplify test
    
    * Update packages/airnode-feed/src/api-requests/data-provider.ts
    
    Co-authored-by: Bedirhan <bedirhan@api3.org>
    
    * Add debug output and pass through endpoint parameters
    
    * PR Comment
    
    * Add resetMocks to jest config file
    
    ---------
    
    Co-authored-by: Bedirhan <bedirhan@api3.org>
    aquarat and bdrhn9 authored Feb 29, 2024
    Copy the full SHA
    4b7e752 View commit details

Commits on Mar 3, 2024

  1. 1
    Copy the full SHA
    7f4c62a View commit details

Commits on Mar 6, 2024

  1. Update non-major-dependencies (#251)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Mar 6, 2024
    Copy the full SHA
    d5bc055 View commit details

Commits on Mar 7, 2024

  1. Update non-major-devDependencies (#250)

    * Update non-major-devDependencies
    
    * Disable @typescript-eslint/consistent-return rule, handle preProcessing validation error
    
    ---------
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    Co-authored-by: Emanuel Tesař <e.tesarr@gmail.com>
    renovate[bot] and Siegrift authored Mar 7, 2024
    Copy the full SHA
    d2af1a3 View commit details
  2. Ignore casing when comparing address (#253)

    * Support lower/mixed case addresses
    
    * Make e2e test be .feature.ts instead of .test.ts
    
    * Fix test
    Siegrift authored Mar 7, 2024
    Copy the full SHA
    a70162b View commit details

Commits on Mar 9, 2024

  1. v0.7.0

    Siegrift committed Mar 9, 2024
    Copy the full SHA
    74340ef View commit details
Showing with 12,375 additions and 6,992 deletions.
  1. +1 −0 .eslintignore
  2. +2 −5 .eslintrc.js
  3. +109 −10 .github/workflows/main.yml
  4. +0 −2 .husky/pre-push
  5. +1 −0 .prettierignore
  6. +36 −22 Dockerfile
  7. +8 −11 README.md
  8. +5 −0 funding.json
  9. +4 −2 jest.config.js
  10. +1 −1 jest.setup.js
  11. +24 −26 package.json
  12. +1 −0 packages/airnode-feed/.env.example
  13. +0 −1 packages/airnode-feed/.eslintignore
  14. +0 −1 packages/airnode-feed/.prettierignore
  15. +4 −295 packages/airnode-feed/README.md
  16. +3 −5 packages/airnode-feed/config/airnode-feed.example.json
  17. +295 −0 packages/airnode-feed/config/configuration.md
  18. +2 −0 packages/airnode-feed/config/secrets.example.env
  19. +23 −22 packages/airnode-feed/package.json
  20. +91 −5 packages/airnode-feed/src/api-requests/data-provider.test.ts
  21. +23 −14 packages/airnode-feed/src/api-requests/data-provider.ts
  22. +41 −39 packages/airnode-feed/src/api-requests/signed-api.test.ts
  23. +41 −65 packages/airnode-feed/src/api-requests/signed-api.ts
  24. +0 −3 packages/airnode-feed/src/constants.ts
  25. +3 −24 packages/airnode-feed/src/fetch-beacon-data.ts
  26. +0 −18 packages/airnode-feed/src/heartbeat/heartbeat-utils.test.ts
  27. +2 −9 packages/airnode-feed/src/heartbeat/heartbeat-utils.ts
  28. +42 −27 packages/airnode-feed/src/heartbeat/heartbeat.test.ts
  29. +3 −2 packages/airnode-feed/src/heartbeat/heartbeat.ts
  30. +1 −2 packages/airnode-feed/src/heartbeat/logger.ts
  31. +29 −3 packages/airnode-feed/src/index.ts
  32. +1 −1 packages/airnode-feed/src/sign-template-data.test.ts
  33. +40 −21 packages/airnode-feed/src/sign-template-data.ts
  34. +0 −82 packages/airnode-feed/src/state.test.ts
  35. +5 −86 packages/airnode-feed/src/state.ts
  36. +3 −3 packages/airnode-feed/src/update-signed-api.ts
  37. +2 −0 packages/airnode-feed/src/utils.ts
  38. +14 −8 packages/airnode-feed/src/validation/config.ts
  39. +128 −36 packages/airnode-feed/src/validation/schema.test.ts
  40. +80 −58 packages/airnode-feed/src/validation/schema.ts
  41. +0 −41 packages/airnode-feed/src/validation/utils.ts
  42. +49 −59 packages/airnode-feed/test/fixtures.ts
  43. +0 −15 packages/e2e/.eslintignore
  44. +0 −15 packages/e2e/.prettierignore
  45. +8 −6 packages/e2e/README.md
  46. +17 −2 packages/e2e/jest.config.js
  47. +10 −13 packages/e2e/package.json
  48. +2 −22 packages/e2e/src/airnode-feed/airnode-feed.json
  49. +1 −1 packages/e2e/src/airnode-feed/secrets.example.env
  50. +1 −1 packages/e2e/src/data-provider-api.ts
  51. +3 −0 packages/e2e/src/signed-api/secrets.example.env
  52. +18 −5 packages/e2e/src/signed-api/signed-api.json
  53. +0 −55 packages/e2e/src/user.test.ts
  54. +5 −3 packages/e2e/src/user.ts
  55. +44 −0 packages/e2e/src/utils.ts
  56. +102 −0 packages/e2e/test/signed-api.feature.ts
  57. +2 −2 packages/performance-test/airnode-feed/cloudformation.json
  58. +6 −8 packages/performance-test/airnode-feed/create-config.ts
  59. +4 −5 packages/performance-test/airnode-feed/initialize-source-api/start-airnode-feeds.ts
  60. +5 −6 packages/performance-test/package.json
  61. +1 −1 packages/performance-test/signed-api/benchmark-signed-api.ts
  62. +2 −2 packages/performance-test/signed-api/cloudformation.json
  63. +1 −1 packages/performance-test/signed-api/signed-api.json
  64. +1 −0 packages/signed-api/.env.example
  65. +0 −1 packages/signed-api/.eslintignore
  66. +0 −1 packages/signed-api/.prettierignore
  67. +18 −223 packages/signed-api/README.md
  68. +263 −0 packages/signed-api/config/configuration.md
  69. +3 −0 packages/signed-api/config/secrets.example.env
  70. +24 −5 packages/signed-api/config/signed-api.example.json
  71. +107 −12 packages/signed-api/deployment/cloudformation-template.json
  72. +23 −19 packages/signed-api/package.json
  73. +0 −18 packages/signed-api/src/cache.ts
  74. +0 −67 packages/signed-api/src/config.ts
  75. +25 −0 packages/signed-api/src/config/config.test.ts
  76. +99 −0 packages/signed-api/src/config/config.ts
  77. +0 −30 packages/signed-api/src/dev-server.ts
  78. +477 −157 packages/signed-api/src/handlers.test.ts
  79. +149 −98 packages/signed-api/src/handlers.ts
  80. +1 −1 packages/signed-api/src/headers.test.ts
  81. +1 −1 packages/signed-api/src/headers.ts
  82. +109 −78 packages/signed-api/src/in-memory-cache.test.ts
  83. +69 −37 packages/signed-api/src/in-memory-cache.ts
  84. +56 −4 packages/signed-api/src/index.ts
  85. +1 −1 packages/signed-api/src/npm-exports.ts
  86. +15 −9 packages/signed-api/src/schema.test.ts
  87. +18 −16 packages/signed-api/src/schema.ts
  88. +27 −11 packages/signed-api/src/server.ts
  89. +43 −0 packages/signed-api/src/signed-data-verifier-pool.ts
  90. +54 −0 packages/signed-api/src/signed-data-verifier.ts
  91. +74 −0 packages/signed-api/src/transform-payload.ts
  92. +36 −0 packages/signed-api/src/types.ts
  93. +3 −5 packages/signed-api/src/utils.ts
  94. +28 −3 packages/signed-api/test/utils.ts
  95. +9,266 −4,964 pnpm-lock.yaml
  96. +17 −5 renovate.json
  97. +0 −48 scripts/create-docker-release.ts
  98. +3 −6 scripts/create-npm-release.ts
  99. +15 −0 scripts/tag-and-release.ts
  100. +1 −0 tsconfig.json
1 change: 1 addition & 0 deletions .eslintignore
7 changes: 2 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
module.exports = {
extends: ['./node_modules/@api3/commons/dist/eslint/universal', './node_modules/@api3/commons/dist/eslint/jest'],
extends: ['plugin:@api3/eslint-plugin-commons/universal', 'plugin:@api3/eslint-plugin-commons/jest'],
parserOptions: {
project: ['./tsconfig.json', './packages/*/tsconfig.json'],
},
rules: {
'@typescript-eslint/prefer-destructuring': 'off', // The commons universal ESLint configuration already uses "prefer-destructuring" and this extended version is not needed.
'@typescript-eslint/max-params': 'off', // It is sometimes necessary to have enough arguments. This rule is too strict.
},
rules: {},
};
119 changes: 109 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
########################################################################################
# The following secrets are required:
#
# 1. GH_ACCESS_TOKEN - A "fine-grained personal access token" generated through the
# Github UI. It seems like these tokens are scoped to a user, rather than an
# organisation.
#
# The following minimum permissions are required:
# Read - access to metadata
# Read & write - access to actions and code
# 2. GH_USER_NAME - The name (not username) associated with the Git user. e.g. John Smith
# 3. GH_USER_EMAIL - The email associated with the Git user
# 4. NPM_TOKEN - A token for publishing to npm
# 5. DOCKERHUB_USERNAME - Username for publishing to Docker Hub
# 6. DOCKERHUB_TOKEN - Docker Hub publishing token
########################################################################################
name: Continuous Build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
documentation:
@@ -24,13 +38,11 @@ jobs:
- name: Clone repo
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8.x
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '22.16.0'
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install --frozen-lockfile
@@ -49,13 +61,11 @@ jobs:
- name: Clone repo
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8.x
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '22.16.0'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
@@ -65,6 +75,8 @@ jobs:
run: pnpm run docker:build
- name: Copy Airnode feed secrets
run: cd packages/e2e/src && cp airnode-feed/secrets.example.env airnode-feed/secrets.env
- name: Copy Signed API secrets
run: cd packages/e2e/src && cp signed-api/secrets.example.env signed-api/secrets.env
- name: Start services
# Start the e2e services in the background and wait a small amount of time for them to start.
run: |
@@ -81,3 +93,90 @@ jobs:
needs: [documentation, lint-build-test, e2e]
steps:
- run: exit 0

tag-and-release:
name: Tag and release
runs-on: ubuntu-latest
needs: required-checks-passed
# Only tag and release on pushes to main
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
strategy:
matrix:
node-version: [20]
permissions:
id-token: write
steps:
- name: Clone repo
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Configure Git credentials
run: |
git config --global user.name '${{ secrets.GH_USER_NAME }}'
git config --global user.email '${{ secrets.GH_USER_EMAIL }}'
- name: Install Dependencies
run: pnpm install
- name: Build
run: pnpm run build
- name: Get package.json version
id: get-version
run: echo "version=$(cat package.json | jq -r '.version' | sed 's/^/v/')" >> $GITHUB_OUTPUT
- name: Validate tag
id: validate-tag
run: test "$(git tag -l '${{ steps.get-version.outputs.version }}' | awk '{print $NF}')" = "${{ steps.get-version.outputs.version }}" || echo "new-tag=true" >> $GITHUB_OUTPUT
- name: Tag and release on Github
if: ${{ steps.validate-tag.outputs.new-tag }}
run: pnpm run release:tag
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
- name: Publish airnode-feed to npm
if: ${{ steps.validate-tag.outputs.new-tag }}
run: |
npm config set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
cd packages/airnode-feed && pnpm publish --access public
env:
NPM_CONFIG_PROVENANCE: true
- name: Publish signed-api to npm
if: ${{ steps.validate-tag.outputs.new-tag }}
run: |
npm config set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
cd packages/signed-api && pnpm publish --access public
env:
NPM_CONFIG_PROVENANCE: true
- name: Set up Docker Buildx
if: ${{ steps.validate-tag.outputs.new-tag }}
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: ${{ steps.validate-tag.outputs.new-tag }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push airnode-feed Docker image
if: ${{ steps.validate-tag.outputs.new-tag }}
uses: docker/build-push-action@v6
with:
context: .
push: true
target: airnode-feed
tags: |
api3/airnode-feed:latest
api3/airnode-feed:${{ steps.get-version.outputs.version }}
- name: Build and push signed-api Docker image
if: ${{ steps.validate-tag.outputs.new-tag }}
uses: docker/build-push-action@v6
with:
context: .
push: true
target: signed-api
tags: |
api3/signed-api:latest
api3/signed-api:${{ steps.get-version.outputs.version }}
2 changes: 0 additions & 2 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm run prettier:check && pnpm run eslint:check
1 change: 1 addition & 0 deletions .prettierignore
58 changes: 36 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -14,19 +14,26 @@
# The above commands will allow you to inspect the output of the build stage. You can change the target to debug other
# stages and verify that the image is correct.

# We use the alpine image because of its small size. The alternative considered was the "slim" image, but it is larger
# and we already use alpine (without issues) in other projects, so the size reduction seems worth it.
FROM node:18-alpine AS build
# Extract the pnpm version from the package.json file and store it in an environment variable.
FROM node:20-slim AS version-extract
WORKDIR /app
RUN npm install -g pnpm
COPY package.json .
RUN apt-get update && \
apt-get install -y jq && \
echo "PNPM_VERSION=$(jq -r .packageManager package.json | sed 's/pnpm@//')" >> /tmp/env-vars

FROM node:20-slim AS build
WORKDIR /app
COPY --from=version-extract /tmp/env-vars /tmp/env-vars
RUN . /tmp/env-vars && npm install -g pnpm@${PNPM_VERSION}
# Copy just the "pnpm-lock.yaml" file and use "pnpm fetch" to download all dependencies just from the lockfile. This
# command is specifically designed to improve building a docker image because it only installs the dependencies if the
# lockfile has changed (otherwise uses the cached value).
COPY pnpm-lock.yaml /app
RUN pnpm fetch
# Copies all of the contents (without files listed in .dockerignore) of the monorepo into the image.
COPY . /app
# Ideally, we would use "--offline" option, but it seems pnpm has a bug. Fortunately, the instalation times are similar.
# Ideally, we would use "--offline" option, but it seems pnpm has a bug. Fortunately, the installation times are similar.
# See: https://github.com/pnpm/pnpm/issues/6058 for details.
RUN pnpm install --recursive --prefer-offline
# Build all packages in the monorepo.
@@ -39,16 +46,18 @@ LABEL application="airnode-feed" description="Airnode feed container"
FROM build AS deployed-airnode-feed

RUN pnpm --filter=@api3/airnode-feed --prod deploy deployed-airnode-feed
FROM node:18-alpine as airnode-feed
FROM node:20-slim as airnode-feed
WORKDIR /app
ENV NODE_ENV=production

RUN addgroup -S deployed-airnode-feed && \
adduser -h /app -s /bin/false -S -D -H -G deployed-airnode-feed deployed-airnode-feed && \
chown -R deployed-airnode-feed /app
USER deployed-airnode-feed
# Update package lists and install wget
RUN apt-get update && \
apt-get install --no-install-recommends -y wget ca-certificates && \
rm -rf /var/lib/apt/lists/*

COPY --chown=deployed-airnode-feed:deployed-airnode-feed --from=deployed-airnode-feed /app/deployed-airnode-feed .
RUN chown --recursive node:node /app
COPY --chown=node:node --from=deployed-airnode-feed /app/deployed-airnode-feed .
USER node
ENV NODE_ENV=production
ENTRYPOINT ["node", "dist/src/index.js"]

# Create a separate stage for signed-api package. We create a temporary stage for deployment and then copy the result
@@ -58,18 +67,23 @@ LABEL application="signed-api" description="Signed API container"
FROM build AS deployed-signed-api

RUN pnpm --filter=@api3/signed-api --prod deploy deployed-signed-api
FROM node:18-alpine as signed-api
FROM node:20-slim as signed-api
WORKDIR /app
ENV NODE_ENV=production

# Make sure the non-root user can bind to port 80.
RUN apk add --no-cache libcap
RUN setcap 'cap_net_bind_service=+ep' /usr/local/bin/node
# Update package lists and install wget
RUN apt-get update && \
apt-get install --no-install-recommends -y wget ca-certificates && \
rm -rf /var/lib/apt/lists/*

RUN addgroup -S deployed-signed-api && \
adduser -h /app -s /bin/false -S -D -H -G deployed-signed-api deployed-signed-api && \
chown -R deployed-signed-api /app
USER deployed-signed-api
# Update package lists and install libcap
RUN apt-get update && \
apt-get install --no-install-recommends -y libcap2-bin && \
rm -rf /var/lib/apt/lists/*
# Set capabilities to allow Node.js to bind to well-known ports (<1024) as a non-root user
RUN setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

COPY --chown=deployed-signed-api:deployed-signed-api --from=deployed-signed-api /app/deployed-signed-api .
RUN chown --recursive node:node /app
COPY --chown=node:node --from=deployed-signed-api /app/deployed-signed-api .
USER node
ENV NODE_ENV=production
ENTRYPOINT ["node", "dist/src/index.js"]
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@

A monorepo for managing signed data. Consists of:

- [api](./packages/signed-api/README.md) - A service for storing and accessing signed data. It provides endpoints to
handle signed data for a specific airnode.
- [signed-api](./packages/signed-api/README.md) - A service for storing and accessing signed data. It provides endpoints
to handle signed data for a specific airnode.
- [airnode-feed](./packages/airnode-feed/README.md) - A service for pushing data provider signed data.
- [e2e](./packages/e2e/README.md) - End to end test utilizing Mock API, Airnode feed and signed API.
- [performance-test](./packages/performance-test/README.md) - Configurations and scripts to allow running performance
@@ -27,7 +27,7 @@ and to build the packages:
pnpm run build
```

Note, that everytime you make a change to a workspace that is used as a dependency of another, you need to rebuild the
Note, that every time you make a change to a workspace that is used as a dependency of another, you need to rebuild the
changed package (otherwise you might get weird JS/TS errors).

## Versioning and release
@@ -39,13 +39,10 @@ There is a script that automates the process of creating new NPM packages and Do

1. `pnpm run create-release:npm [major|minor|patch]` - The script ensures publishing happens from up-to-date `main`
branch. It updates the package versions for `airnode-feed` and `signed-api`, updates fixtures and example files, does
basic checks to ensure the changes are valid and creates a version commit with a git tag. The command intentionally
does not do the publishing so that the changes can be reviewed before publishing.
basic checks to ensure the changes are valid and creates a version commit. The command intentionally does not do the
publishing so that the changes can be reviewed before pushing.
2. `git show` - To inspect the changes of the version commit.
3. Run the e2e tests locally. This is not automated due to implementation complexity.
4. `pnpm run publish:airnode-feed && pnpm run publish:signed-api` - To publish Airnode feed and Signed API package to
NPM.
5. `git push --follow-tags` - Push the tagged version commit upstream.
6. `pnpm run create-release:docker` - To build the Docker images and tag them correctly. The script uses the current
package.json version so it expects the NPM release is done first.
7. The command outputs the publish instructions to push the images.
4. `git push` - Push the version commit upstream. This will trigger the `tag-and-release` GitHub Actions job and result
in 1) the commit being tagged with the new version, 2) the release being created on GitHub, 3) both packages being
released on npm, and 4) both Docker images being built and pushed to Docker Hub.
5 changes: 5 additions & 0 deletions funding.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"opRetro": {
"projectId": "0x2725d5ff44dd7e375ac3a54baa024ec90eafe91185cdc6d1b3c84256c14ff92a"
}
}
6 changes: 4 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { join } = require('path');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { join } = require('node:path');

/*
/**
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/configuration
*/
@@ -11,6 +12,7 @@ module.exports = {
modulePathIgnorePatterns: ['<rootDir>/.build', '<rootDir>/dist/', '<rootDir>/build/'],
preset: 'ts-jest',
restoreMocks: true,
resetMocks: true,
setupFiles: [join(__dirname, './jest.setup.js')],
testEnvironment: 'jest-environment-node',
};
2 changes: 1 addition & 1 deletion jest.setup.js
Original file line number Diff line number Diff line change
@@ -17,4 +17,4 @@ Object.defineProperty = function (object, name, meta) {
};

// Disable logger if it is not explicitly set to true.
process.env.LOGGER_ENABLED = process.env.LOGGER_ENABLED || 'false';
process.env.LOGGER_ENABLED = process.env.LOGGER_ENABLED ?? 'false';
Loading