@chainlink/external-adapter-framework 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapter.d.ts +107 -0
- package/adapter.js +115 -0
- package/{dist/src/package/background-executor.d.ts → background-executor.d.ts} +0 -0
- package/{dist/src/background-executor.js → background-executor.js} +0 -0
- package/{dist/src/cache → cache}/factory.d.ts +0 -0
- package/{dist/src/cache → cache}/factory.js +0 -0
- package/{dist/src/cache → cache}/index.d.ts +8 -8
- package/{dist/src/cache → cache}/index.js +0 -0
- package/{dist/src/cache → cache}/local.d.ts +0 -0
- package/{dist/src/cache → cache}/local.js +0 -0
- package/{dist/src/cache → cache}/metrics.d.ts +0 -0
- package/{dist/src/cache → cache}/metrics.js +0 -0
- package/{dist/src/cache → cache}/redis.d.ts +0 -0
- package/{dist/src/cache → cache}/redis.js +0 -0
- package/{dist/src/chainlink-external-adapter-framework-0.0.6.tgz → chainlink-external-adapter-framework-0.0.6.tgz} +0 -0
- package/{dist/src/config → config}/index.d.ts +0 -5
- package/{dist/src/config → config}/index.js +5 -5
- package/{dist/src/config → config}/provider-limits.d.ts +0 -0
- package/{dist/src/config → config}/provider-limits.js +5 -1
- package/{dist/src/examples → examples}/bank-frick/accounts.d.ts +1 -1
- package/{dist/src/examples → examples}/bank-frick/accounts.js +2 -3
- package/{dist/src/examples → examples}/bank-frick/config/index.d.ts +0 -0
- package/{dist/src/examples → examples}/bank-frick/config/index.js +0 -0
- package/{dist/src/package/examples/coingecko → examples/bank-frick}/index.d.ts +0 -0
- package/{dist/src/examples → examples}/bank-frick/index.js +2 -3
- package/{dist/src/examples → examples}/bank-frick/util.d.ts +0 -0
- package/{dist/src/examples → examples}/bank-frick/util.js +0 -0
- package/{dist/src/package/examples → examples}/coingecko/batch-warming.d.ts +0 -0
- package/{dist/src/package/examples → examples}/coingecko/batch-warming.js +0 -0
- package/{dist/src/package/examples/ncfx → examples/coingecko}/index.d.ts +0 -0
- package/{dist/src/package/examples → examples}/coingecko/index.js +0 -0
- package/{dist/src/package/examples → examples}/coingecko/rest.d.ts +0 -0
- package/{dist/src/package/examples → examples}/coingecko/rest.js +0 -0
- package/{dist/src/examples → examples}/ncfx/config/index.d.ts +0 -0
- package/{dist/src/examples → examples}/ncfx/config/index.js +0 -0
- package/examples/ncfx/index.d.ts +2 -0
- package/{dist/src/package/examples → examples}/ncfx/index.js +0 -0
- package/{dist/src/package/examples → examples}/ncfx/websocket.d.ts +0 -0
- package/{dist/src/package/examples → examples}/ncfx/websocket.js +0 -0
- package/{dist/src/index.d.ts → index.d.ts} +0 -0
- package/{dist/src/index.js → index.js} +18 -13
- package/{dist/src/metrics → metrics}/constants.d.ts +0 -0
- package/{dist/src/metrics → metrics}/constants.js +0 -0
- package/{dist/src/metrics → metrics}/index.d.ts +0 -0
- package/{dist/src/metrics → metrics}/index.js +0 -0
- package/metrics/util.d.ts +7 -0
- package/{dist/src/metrics → metrics}/util.js +0 -0
- package/{dist/src/package → package}/adapter.d.ts +0 -0
- package/{dist/src/package → package}/adapter.js +0 -0
- package/{dist/src → package}/background-executor.d.ts +2 -2
- package/{dist/src/package → package}/background-executor.js +0 -0
- package/{dist/src/package → package}/cache/factory.d.ts +0 -0
- package/{dist/src/package → package}/cache/factory.js +0 -0
- package/{dist/src/package → package}/cache/index.d.ts +0 -0
- package/{dist/src/package → package}/cache/index.js +0 -0
- package/{dist/src/package → package}/cache/local.d.ts +0 -0
- package/{dist/src/package → package}/cache/local.js +0 -0
- package/{dist/src/package → package}/cache/metrics.d.ts +0 -0
- package/{dist/src/package → package}/cache/metrics.js +0 -0
- package/{dist/src/package → package}/cache/redis.d.ts +0 -0
- package/{dist/src/package → package}/cache/redis.js +0 -0
- package/{dist/src/package → package}/config/index.d.ts +0 -0
- package/{dist/src/package → package}/config/index.js +0 -0
- package/{dist/src/package → package}/config/provider-limits.d.ts +0 -0
- package/{dist/src/package → package}/config/provider-limits.js +0 -0
- package/package/examples/coingecko/batch-warming.d.ts +2 -0
- package/{dist/src → package}/examples/coingecko/batch-warming.js +2 -3
- package/package/examples/coingecko/index.d.ts +2 -0
- package/{dist/src → package}/examples/coingecko/index.js +2 -3
- package/package/examples/coingecko/rest.d.ts +2 -0
- package/{dist/src → package}/examples/coingecko/rest.js +2 -3
- package/{dist/src/package → package}/examples/ncfx/config/index.d.ts +0 -0
- package/{dist/src/package → package}/examples/ncfx/config/index.js +0 -0
- package/package/examples/ncfx/index.d.ts +2 -0
- package/{dist/src → package}/examples/ncfx/index.js +2 -3
- package/{dist/src → package}/examples/ncfx/websocket.d.ts +1 -12
- package/{dist/src → package}/examples/ncfx/websocket.js +2 -3
- package/{dist/src/package → package}/index.d.ts +0 -0
- package/{dist/src/package → package}/index.js +0 -0
- package/{dist/src/package → package}/metrics/constants.d.ts +0 -0
- package/{dist/src/package → package}/metrics/constants.js +0 -0
- package/{dist/src/package → package}/metrics/index.d.ts +0 -0
- package/{dist/src/package → package}/metrics/index.js +0 -0
- package/{dist/src/package → package}/metrics/util.d.ts +0 -0
- package/{dist/src/package → package}/metrics/util.js +0 -0
- package/{dist/src → package}/package.json +0 -0
- package/{dist/src/package → package}/rate-limiting/background/fixed-frequency.d.ts +0 -0
- package/{dist/src/package → package}/rate-limiting/background/fixed-frequency.js +0 -0
- package/{dist/src/package → package}/rate-limiting/index.d.ts +0 -0
- package/{dist/src/package → package}/rate-limiting/index.js +0 -0
- package/{dist/src/package → package}/rate-limiting/metrics.d.ts +0 -0
- package/{dist/src/package → package}/rate-limiting/metrics.js +0 -0
- package/{dist/src/package → package}/rate-limiting/request/simple-counting.d.ts +0 -0
- package/{dist/src/package → package}/rate-limiting/request/simple-counting.js +0 -0
- package/{dist/src/package → package}/test.d.ts +0 -0
- package/{dist/src/package → package}/test.js +0 -0
- package/{dist/src/package → package}/transports/batch-warming.d.ts +0 -0
- package/{dist/src/package → package}/transports/batch-warming.js +0 -0
- package/{dist/src/package → package}/transports/index.d.ts +0 -0
- package/{dist/src/package → package}/transports/index.js +0 -0
- package/{dist/src/package → package}/transports/metrics.d.ts +0 -0
- package/{dist/src/package → package}/transports/metrics.js +0 -0
- package/{dist/src/package → package}/transports/rest.d.ts +0 -0
- package/{dist/src/package → package}/transports/rest.js +0 -0
- package/{dist/src/package → package}/transports/util.d.ts +0 -0
- package/{dist/src/package → package}/transports/util.js +0 -0
- package/{dist/src/package → package}/transports/websocket.d.ts +0 -0
- package/{dist/src/package → package}/transports/websocket.js +0 -0
- package/{dist/src/package → package}/util/expiring-sorted-set.d.ts +0 -0
- package/{dist/src/package → package}/util/expiring-sorted-set.js +0 -0
- package/{dist/src/package → package}/util/index.d.ts +0 -0
- package/{dist/src/package → package}/util/index.js +0 -0
- package/{dist/src/package → package}/util/logger.d.ts +0 -0
- package/{dist/src/package → package}/util/logger.js +0 -0
- package/{dist/src/package → package}/util/request.d.ts +0 -0
- package/{dist/src/package → package}/util/request.js +0 -0
- package/{dist/src/package → package}/validation/error.d.ts +0 -0
- package/{dist/src/package → package}/validation/error.js +0 -0
- package/{dist/src/package → package}/validation/index.d.ts +0 -0
- package/{dist/src/package → package}/validation/index.js +0 -0
- package/{dist/src/package → package}/validation/input-params.d.ts +0 -0
- package/{dist/src/package → package}/validation/input-params.js +0 -0
- package/{dist/src/package → package}/validation/override-functions.d.ts +0 -0
- package/{dist/src/package → package}/validation/override-functions.js +0 -0
- package/{dist/src/package → package}/validation/preset-tokens.json +0 -0
- package/{dist/src/package → package}/validation/validator.d.ts +0 -0
- package/{dist/src/package → package}/validation/validator.js +0 -0
- package/package.json +1 -1
- package/{dist/src/rate-limiting → rate-limiting}/background/fixed-frequency.d.ts +1 -2
- package/{dist/src/rate-limiting → rate-limiting}/background/fixed-frequency.js +0 -0
- package/{dist/src/rate-limiting → rate-limiting}/index.d.ts +1 -2
- package/{dist/src/rate-limiting → rate-limiting}/index.js +0 -0
- package/{dist/src/rate-limiting → rate-limiting}/metrics.d.ts +0 -0
- package/{dist/src/rate-limiting → rate-limiting}/metrics.js +0 -0
- package/{dist/src/rate-limiting → rate-limiting}/request/simple-counting.d.ts +1 -2
- package/{dist/src/rate-limiting → rate-limiting}/request/simple-counting.js +0 -0
- package/{dist/src/test.d.ts → test.d.ts} +0 -0
- package/{dist/src/test.js → test.js} +0 -0
- package/{dist/src/transports → transports}/batch-warming.d.ts +0 -0
- package/{dist/src/transports → transports}/batch-warming.js +0 -0
- package/{dist/src/transports → transports}/index.d.ts +2 -2
- package/{dist/src/transports → transports}/index.js +0 -0
- package/{dist/src/transports → transports}/metrics.d.ts +1 -2
- package/{dist/src/transports → transports}/metrics.js +0 -0
- package/{dist/src/transports → transports}/rest.d.ts +0 -0
- package/{dist/src/transports → transports}/rest.js +0 -0
- package/{dist/src/transports → transports}/util.d.ts +0 -0
- package/{dist/src/transports → transports}/util.js +0 -0
- package/{dist/src/transports → transports}/websocket.d.ts +3 -2
- package/{dist/src/transports → transports}/websocket.js +6 -4
- package/{dist/src/util → util}/expiring-sorted-set.d.ts +0 -0
- package/{dist/src/util → util}/expiring-sorted-set.js +0 -0
- package/{dist/src/util → util}/index.d.ts +0 -0
- package/{dist/src/util → util}/index.js +0 -0
- package/{dist/src/util → util}/logger.d.ts +0 -0
- package/{dist/src/util → util}/logger.js +0 -0
- package/{dist/src/util → util}/request.d.ts +2 -2
- package/{dist/src/util → util}/request.js +0 -0
- package/{dist/src/util → util}/subscription-set/expiring-sorted-set.d.ts +0 -0
- package/{dist/src/util → util}/subscription-set/expiring-sorted-set.js +0 -0
- package/{dist/src/util → util}/subscription-set/subscription-set.d.ts +0 -0
- package/{dist/src/util → util}/subscription-set/subscription-set.js +0 -0
- package/{dist/src/util → util}/test-payload-loader.d.ts +0 -0
- package/{dist/src/util → util}/test-payload-loader.js +0 -0
- package/{dist/src/validation → validation}/error.d.ts +2 -2
- package/{dist/src/validation → validation}/error.js +0 -0
- package/{dist/src/validation → validation}/index.d.ts +0 -0
- package/{dist/src/validation → validation}/index.js +0 -0
- package/{dist/src/validation → validation}/input-params.d.ts +0 -0
- package/{dist/src/validation → validation}/input-params.js +0 -0
- package/validation/override-functions.d.ts +3 -0
- package/{dist/src/validation → validation}/override-functions.js +0 -0
- package/{dist/src/validation → validation}/preset-tokens.json +0 -0
- package/{dist/src/validation → validation}/validator.d.ts +0 -0
- package/{dist/src/validation → validation}/validator.js +0 -0
- package/.c8rc.json +0 -3
- package/.eslintignore +0 -9
- package/.eslintrc.js +0 -96
- package/.github/README.MD +0 -17
- package/.github/actions/setup/action.yaml +0 -13
- package/.github/workflows/main.yaml +0 -39
- package/.github/workflows/publish.yaml +0 -20
- package/.prettierignore +0 -13
- package/.yarnrc +0 -0
- package/README.md +0 -103
- package/dist/src/adapter.d.ts +0 -135
- package/dist/src/adapter.js +0 -145
- package/dist/src/examples/bank-frick/index.d.ts +0 -2
- package/dist/src/examples/coingecko/batch-warming.d.ts +0 -7
- package/dist/src/examples/coingecko/index.d.ts +0 -2
- package/dist/src/examples/coingecko/rest.d.ts +0 -12
- package/dist/src/examples/ncfx/index.d.ts +0 -13
- package/dist/src/metrics/util.d.ts +0 -7
- package/dist/src/package/package.json +0 -72
- package/dist/src/validation/override-functions.d.ts +0 -3
- package/docker-compose.yaml +0 -35
- package/env.sh +0 -54
- package/env2.sh +0 -55
- package/publish.sh +0 -0
- package/src/adapter.ts +0 -263
- package/src/background-executor.ts +0 -52
- package/src/cache/factory.ts +0 -26
- package/src/cache/index.ts +0 -258
- package/src/cache/local.ts +0 -73
- package/src/cache/metrics.ts +0 -112
- package/src/cache/redis.ts +0 -93
- package/src/config/index.ts +0 -517
- package/src/config/provider-limits.ts +0 -130
- package/src/examples/bank-frick/README.MD +0 -10
- package/src/examples/bank-frick/accounts.ts +0 -246
- package/src/examples/bank-frick/config/index.ts +0 -53
- package/src/examples/bank-frick/index.ts +0 -13
- package/src/examples/bank-frick/types.d.ts +0 -38
- package/src/examples/bank-frick/util.ts +0 -55
- package/src/examples/coingecko/batch-warming.ts +0 -78
- package/src/examples/coingecko/index.ts +0 -9
- package/src/examples/coingecko/rest.ts +0 -77
- package/src/examples/ncfx/config/index.ts +0 -12
- package/src/examples/ncfx/index.ts +0 -9
- package/src/examples/ncfx/websocket.ts +0 -99
- package/src/index.ts +0 -149
- package/src/metrics/constants.ts +0 -23
- package/src/metrics/index.ts +0 -115
- package/src/metrics/util.ts +0 -18
- package/src/rate-limiting/background/fixed-frequency.ts +0 -45
- package/src/rate-limiting/index.ts +0 -100
- package/src/rate-limiting/metrics.ts +0 -18
- package/src/rate-limiting/request/simple-counting.ts +0 -76
- package/src/test.ts +0 -5
- package/src/transports/batch-warming.ts +0 -122
- package/src/transports/index.ts +0 -152
- package/src/transports/metrics.ts +0 -95
- package/src/transports/rest.ts +0 -164
- package/src/transports/util.ts +0 -63
- package/src/transports/websocket.ts +0 -245
- package/src/util/index.ts +0 -22
- package/src/util/logger.ts +0 -69
- package/src/util/request.ts +0 -117
- package/src/util/subscription-set/expiring-sorted-set.ts +0 -54
- package/src/util/subscription-set/subscription-set.ts +0 -35
- package/src/util/test-payload-loader.ts +0 -87
- package/src/validation/error.ts +0 -116
- package/src/validation/index.ts +0 -110
- package/src/validation/input-params.ts +0 -45
- package/src/validation/override-functions.ts +0 -44
- package/src/validation/preset-tokens.json +0 -23
- package/src/validation/validator.ts +0 -384
- package/test/adapter.test.ts +0 -27
- package/test/background-executor.test.ts +0 -108
- package/test/cache/cache-key.test.ts +0 -114
- package/test/cache/helper.ts +0 -100
- package/test/cache/local.test.ts +0 -54
- package/test/cache/redis.test.ts +0 -89
- package/test/correlation.test.ts +0 -114
- package/test/index.test.ts +0 -37
- package/test/metrics/feed-id.test.ts +0 -38
- package/test/metrics/helper.ts +0 -14
- package/test/metrics/labels.test.ts +0 -36
- package/test/metrics/metrics.test.ts +0 -267
- package/test/metrics/redis-metrics.test.ts +0 -113
- package/test/metrics/warmer-metrics.test.ts +0 -192
- package/test/metrics/ws-metrics.test.ts +0 -225
- package/test/rate-limit-config.test.ts +0 -242
- package/test/smoke.test.ts +0 -166
- package/test/transports/batch.test.ts +0 -465
- package/test/transports/rest.test.ts +0 -242
- package/test/transports/websocket.test.ts +0 -183
- package/test/tsconfig.json +0 -5
- package/test/util.ts +0 -77
- package/test/validation.test.ts +0 -178
- package/test-payload-fail.json +0 -3
- package/test-payload.js +0 -22
- package/test-payload.json +0 -7
- package/test.sh +0 -20
- package/test2.sh +0 -2
- package/tsconfig.json +0 -25
- package/typedoc.json +0 -6
- package/webpack.config.js +0 -23
package/src/config/index.ts
DELETED
|
@@ -1,517 +0,0 @@
|
|
|
1
|
-
// Import { getRandomRequiredEnv, getRandomEnv, getEnv } from '../util'
|
|
2
|
-
|
|
3
|
-
export const BaseSettings = {
|
|
4
|
-
// V2 compat
|
|
5
|
-
// TODO: Remove non used in v3 ones
|
|
6
|
-
API_ENDPOINT: {
|
|
7
|
-
description: 'The URL that the certain transports use to retrieve data',
|
|
8
|
-
type: 'string',
|
|
9
|
-
},
|
|
10
|
-
API_KEY: {
|
|
11
|
-
description: 'Default setting for an EA key',
|
|
12
|
-
type: 'string',
|
|
13
|
-
},
|
|
14
|
-
// API_TIMEOUT: {
|
|
15
|
-
// type: 'number',
|
|
16
|
-
// default: 30000,
|
|
17
|
-
// },
|
|
18
|
-
// API_VERBOSE: {
|
|
19
|
-
// type: 'boolean',
|
|
20
|
-
// },
|
|
21
|
-
BASE_URL: {
|
|
22
|
-
description: 'Starting path for the EA handler endpoint',
|
|
23
|
-
type: 'string',
|
|
24
|
-
default: '/',
|
|
25
|
-
},
|
|
26
|
-
// CACHE_ENABLED: {
|
|
27
|
-
// type: 'boolean',
|
|
28
|
-
// default: true,
|
|
29
|
-
// },
|
|
30
|
-
// CACHE_KEY_GROUP: {
|
|
31
|
-
// type: 'string',
|
|
32
|
-
// },
|
|
33
|
-
CACHE_MAX_AGE: {
|
|
34
|
-
description: 'Maximum amount of time (in ms) that a response will stay cached',
|
|
35
|
-
type: 'number',
|
|
36
|
-
default: 90000,
|
|
37
|
-
},
|
|
38
|
-
// CACHE_MAX_ITEMS: {
|
|
39
|
-
// type: 'number',
|
|
40
|
-
// default: 1000,
|
|
41
|
-
// },
|
|
42
|
-
// CACHE_MIN_AGE: {
|
|
43
|
-
// type: 'number',
|
|
44
|
-
// default: 30000,
|
|
45
|
-
// },
|
|
46
|
-
// CACHE_REDIS_CONNECTION_TIMEOUT: {
|
|
47
|
-
// type: 'number',
|
|
48
|
-
// default: 15000,
|
|
49
|
-
// },
|
|
50
|
-
CACHE_REDIS_HOST: {
|
|
51
|
-
description: 'Hostname for the Redis instance to be used',
|
|
52
|
-
type: 'string',
|
|
53
|
-
default: '127.0.0.1',
|
|
54
|
-
},
|
|
55
|
-
// CACHE_REDIS_MAX_QUEUED_ITEMS: {
|
|
56
|
-
// type: 'number',
|
|
57
|
-
// default: 100,
|
|
58
|
-
// },
|
|
59
|
-
// CACHE_REDIS_MAX_RECONNECT_COOLDOWN: {
|
|
60
|
-
// type: 'number',
|
|
61
|
-
// default: 3000,
|
|
62
|
-
// },
|
|
63
|
-
// CACHE_REDIS_PASSWORD: {
|
|
64
|
-
// type: 'string',
|
|
65
|
-
// },
|
|
66
|
-
// CACHE_REDIS_PATH: {
|
|
67
|
-
// type: 'string',
|
|
68
|
-
// },
|
|
69
|
-
CACHE_REDIS_PORT: {
|
|
70
|
-
description: 'Port for the Redis instance to be used',
|
|
71
|
-
type: 'number',
|
|
72
|
-
default: 6379,
|
|
73
|
-
},
|
|
74
|
-
// CACHE_REDIS_TIMEOUT: {
|
|
75
|
-
// type: 'number',
|
|
76
|
-
// default: 500,
|
|
77
|
-
// },
|
|
78
|
-
// CACHE_REDIS_URL: {
|
|
79
|
-
// type: 'string',
|
|
80
|
-
// },
|
|
81
|
-
CACHE_TYPE: {
|
|
82
|
-
description: 'The type of cache to use throughout the EA',
|
|
83
|
-
type: 'enum',
|
|
84
|
-
default: 'local',
|
|
85
|
-
options: ['local', 'redis'],
|
|
86
|
-
},
|
|
87
|
-
// CACHE_UPDATE_AGE_ON_GET: {
|
|
88
|
-
// type: 'boolean',
|
|
89
|
-
// default: false,
|
|
90
|
-
// },
|
|
91
|
-
CORRELATION_ID_ENABLED: {
|
|
92
|
-
description: 'Flag to enable correlation IDs for sent requests in logging',
|
|
93
|
-
type: 'boolean',
|
|
94
|
-
default: true,
|
|
95
|
-
},
|
|
96
|
-
// DEBUG: {
|
|
97
|
-
// type: 'boolean',
|
|
98
|
-
// },
|
|
99
|
-
// DEFAULT_WS_HEARTBEAT_INTERVAL: {
|
|
100
|
-
// type: 'number',
|
|
101
|
-
// default: 30000,
|
|
102
|
-
// },
|
|
103
|
-
EA_PORT: {
|
|
104
|
-
description:
|
|
105
|
-
'Port through which the EA will listen for REST requests (if mode is set to "reader" or "reader-writer")',
|
|
106
|
-
type: 'number',
|
|
107
|
-
default: 8080,
|
|
108
|
-
},
|
|
109
|
-
// ENV_ADAPTER_URL: {
|
|
110
|
-
// type: 'string',
|
|
111
|
-
// },
|
|
112
|
-
// ERROR_CAPACITY: {
|
|
113
|
-
// type: 'number',
|
|
114
|
-
// },
|
|
115
|
-
EXPERIMENTAL_METRICS_ENABLED: {
|
|
116
|
-
description:
|
|
117
|
-
'Flag to specify whether or not to collect metrics. Used as fallback for METRICS_ENABLED',
|
|
118
|
-
type: 'boolean',
|
|
119
|
-
default: true,
|
|
120
|
-
},
|
|
121
|
-
// LEGACY_ENV_ADAPTER_URL: {
|
|
122
|
-
// type: 'string',
|
|
123
|
-
// },
|
|
124
|
-
LOG_LEVEL: {
|
|
125
|
-
description: 'Minimum level required for logs to be output',
|
|
126
|
-
type: 'string',
|
|
127
|
-
default: 'info',
|
|
128
|
-
},
|
|
129
|
-
METRICS_ENABLED: {
|
|
130
|
-
description: 'Flag to specify whether or not to startup the metrics server',
|
|
131
|
-
type: 'boolean',
|
|
132
|
-
default: true,
|
|
133
|
-
},
|
|
134
|
-
METRICS_NAME: {
|
|
135
|
-
description: 'Metrics name',
|
|
136
|
-
type: 'string',
|
|
137
|
-
},
|
|
138
|
-
METRICS_PORT: {
|
|
139
|
-
description: 'Port metrics will be exposed to',
|
|
140
|
-
type: 'number',
|
|
141
|
-
default: 9080,
|
|
142
|
-
},
|
|
143
|
-
METRICS_USE_BASE_URL: {
|
|
144
|
-
description: 'Flag to specify whether or not to prepend the BASE_URL to the metrics endpoint',
|
|
145
|
-
type: 'boolean',
|
|
146
|
-
},
|
|
147
|
-
RATE_LIMIT_API_TIER: {
|
|
148
|
-
description:
|
|
149
|
-
'Rate limiting tier to use from the available options for the adapter. If not present, the adapter will run using the first tier on the list.',
|
|
150
|
-
type: 'string',
|
|
151
|
-
},
|
|
152
|
-
// RATE_LIMIT_CAPACITY_MINUTE: {
|
|
153
|
-
// type: 'number',
|
|
154
|
-
// },
|
|
155
|
-
// RATE_LIMIT_CAPACITY_SECOND: {
|
|
156
|
-
// type: 'number',
|
|
157
|
-
// },
|
|
158
|
-
// RATE_LIMIT_CAPACITY: {
|
|
159
|
-
// type: 'number',
|
|
160
|
-
// },
|
|
161
|
-
// RATE_LIMIT_ENABLED: {
|
|
162
|
-
// type: 'boolean',
|
|
163
|
-
// default: true,
|
|
164
|
-
// },
|
|
165
|
-
// RECORD: {
|
|
166
|
-
// type: 'boolean',
|
|
167
|
-
// },
|
|
168
|
-
// REQUEST_COALESCING_ENABLED: {
|
|
169
|
-
// type: 'boolean',
|
|
170
|
-
// },
|
|
171
|
-
// REQUEST_COALESCING_ENTROPY_MAX: {
|
|
172
|
-
// type: 'number',
|
|
173
|
-
// default: 0,
|
|
174
|
-
// },
|
|
175
|
-
// REQUEST_COALESCING_INTERVAL_COEFFICIENT: {
|
|
176
|
-
// type: 'number',
|
|
177
|
-
// default: 2,
|
|
178
|
-
// },
|
|
179
|
-
// REQUEST_COALESCING_INTERVAL_MAX: {
|
|
180
|
-
// type: 'number',
|
|
181
|
-
// default: 1000,
|
|
182
|
-
// },
|
|
183
|
-
// REQUEST_COALESCING_INTERVAL: {
|
|
184
|
-
// type: 'number',
|
|
185
|
-
// default: 100,
|
|
186
|
-
// },
|
|
187
|
-
// REQUEST_COALESCING_MAX_RETRIES: {
|
|
188
|
-
// type: 'number',
|
|
189
|
-
// default: 5,
|
|
190
|
-
// },
|
|
191
|
-
// RETRY: {
|
|
192
|
-
// type: 'boolean',
|
|
193
|
-
// default: 1,
|
|
194
|
-
// },
|
|
195
|
-
// SERVER_RATE_LIMIT_MAX: {
|
|
196
|
-
// type: 'number',
|
|
197
|
-
// default: 250,
|
|
198
|
-
// },
|
|
199
|
-
// SERVER_SLOW_DOWN_AFTER_FACTOR: {
|
|
200
|
-
// type: 'number',
|
|
201
|
-
// default: 0.8,
|
|
202
|
-
// },
|
|
203
|
-
// SERVER_SLOW_DOWN_DELAY_MS: {
|
|
204
|
-
// type: 'number',
|
|
205
|
-
// default: 500,
|
|
206
|
-
// },
|
|
207
|
-
// TIMEOUT: {
|
|
208
|
-
// type: 'number',
|
|
209
|
-
// },
|
|
210
|
-
// WARMUP_ENABLED: {
|
|
211
|
-
// type: 'boolean',
|
|
212
|
-
// default: true,
|
|
213
|
-
// },
|
|
214
|
-
// WARMUP_INTERVAL: {
|
|
215
|
-
// type: 'number',
|
|
216
|
-
// },
|
|
217
|
-
WARMUP_SUBSCRIPTION_TTL: {
|
|
218
|
-
type: 'number',
|
|
219
|
-
description: 'TTL for batch warmer subscriptions',
|
|
220
|
-
default: 10000,
|
|
221
|
-
},
|
|
222
|
-
// WARMUP_UNHEALTHY_THRESHOLD: {
|
|
223
|
-
// type: 'number',
|
|
224
|
-
// default: 3,
|
|
225
|
-
// },
|
|
226
|
-
// WS_API_ENDPOINT: {
|
|
227
|
-
// type: 'string',
|
|
228
|
-
// },
|
|
229
|
-
// WS_API_KEY: {
|
|
230
|
-
// type: 'string',
|
|
231
|
-
// },
|
|
232
|
-
// WS_CONNECTION_KEY: {
|
|
233
|
-
// type: 'string',
|
|
234
|
-
// default: 1,
|
|
235
|
-
// },
|
|
236
|
-
// WS_CONNECTION_LIMIT: {
|
|
237
|
-
// type: 'number',
|
|
238
|
-
// default: 1,
|
|
239
|
-
// },
|
|
240
|
-
// WS_CONNECTION_RETRY_DELAY: {
|
|
241
|
-
// type: 'number',
|
|
242
|
-
// default: 1000,
|
|
243
|
-
// },
|
|
244
|
-
// WS_CONNECTION_RETRY_LIMIT: {
|
|
245
|
-
// type: 'number',
|
|
246
|
-
// default: 3,
|
|
247
|
-
// },
|
|
248
|
-
// WS_CONNECTION_TTL: {
|
|
249
|
-
// type: 'number',
|
|
250
|
-
// default: 70000,
|
|
251
|
-
// },
|
|
252
|
-
// WS_ENABLED: {
|
|
253
|
-
// type: 'boolean',
|
|
254
|
-
// default: false,
|
|
255
|
-
// },
|
|
256
|
-
// WS_SUBSCRIPTION_LIMIT: {
|
|
257
|
-
// type: 'number',
|
|
258
|
-
// default: 10,
|
|
259
|
-
// },
|
|
260
|
-
// WS_SUBSCRIPTION_PRIORITY_LIST: {
|
|
261
|
-
// type: 'string',
|
|
262
|
-
// },
|
|
263
|
-
// WS_SUBSCRIPTION_TTL: {
|
|
264
|
-
// type: 'number',
|
|
265
|
-
// default: 120000,
|
|
266
|
-
// },
|
|
267
|
-
// WS_SUBSCRIPTION_UNRESPONSIVE_TTL: {
|
|
268
|
-
// type: 'number',
|
|
269
|
-
// default: false,
|
|
270
|
-
// },
|
|
271
|
-
// WS_TIME_UNTIL_HANDLE_NEXT_MESSAGE_OVERRIDE: {
|
|
272
|
-
// type: 'number',
|
|
273
|
-
// },
|
|
274
|
-
|
|
275
|
-
// V3
|
|
276
|
-
CACHE_POLLING_MAX_RETRIES: {
|
|
277
|
-
description:
|
|
278
|
-
'Max amount of times to attempt to find EA response in the cache after the Transport has been set up',
|
|
279
|
-
type: 'number',
|
|
280
|
-
default: 10,
|
|
281
|
-
},
|
|
282
|
-
CACHE_POLLING_SLEEP_MS: {
|
|
283
|
-
description:
|
|
284
|
-
'The number of ms to sleep between each retry to fetch the EA response in the cache',
|
|
285
|
-
type: 'number',
|
|
286
|
-
default: 200,
|
|
287
|
-
},
|
|
288
|
-
DEFAULT_CACHE_KEY: {
|
|
289
|
-
description: 'Default key to be used when one cannot be determined from request parameters',
|
|
290
|
-
type: 'string',
|
|
291
|
-
default: 'DEFAULT_CACHE_KEY',
|
|
292
|
-
},
|
|
293
|
-
EA_HOST: {
|
|
294
|
-
description:
|
|
295
|
-
'Host this EA will listen for REST requests on (if mode is set to "reader" or "reader-writer")',
|
|
296
|
-
type: 'string',
|
|
297
|
-
default: '::',
|
|
298
|
-
},
|
|
299
|
-
EA_MODE: {
|
|
300
|
-
description:
|
|
301
|
-
'Port this EA will listen for REST requests on (if mode is set to "reader" or "reader-writer")',
|
|
302
|
-
type: 'enum',
|
|
303
|
-
default: 'reader-writer',
|
|
304
|
-
options: ['reader', 'writer', 'reader-writer'],
|
|
305
|
-
},
|
|
306
|
-
REST_TRANSPORT_MAX_RATE_LIMIT_RETRIES: {
|
|
307
|
-
description:
|
|
308
|
-
'Maximum amount of times the Rest Transport will attempt to set up a request when blocked by the rate limiter',
|
|
309
|
-
type: 'number',
|
|
310
|
-
default: 3,
|
|
311
|
-
},
|
|
312
|
-
REST_TRANSPORT_MS_BETWEEN_RATE_LIMIT_RETRIES: {
|
|
313
|
-
description:
|
|
314
|
-
'Time that the Rest Transport will wait between retries when blocked by the rate limiter',
|
|
315
|
-
type: 'number',
|
|
316
|
-
default: 400,
|
|
317
|
-
},
|
|
318
|
-
MAX_COMMON_KEY_SIZE: {
|
|
319
|
-
description:
|
|
320
|
-
'Maximum amount of characters that the common part of the cache key or feed ID can have',
|
|
321
|
-
type: 'number',
|
|
322
|
-
default: 300,
|
|
323
|
-
validate: (value?: number) => {
|
|
324
|
-
if (!(value && value >= 150 && value <= 500)) {
|
|
325
|
-
return 'MAX_COMMON_KEY_SIZE must be a number between 150 and 500'
|
|
326
|
-
}
|
|
327
|
-
},
|
|
328
|
-
},
|
|
329
|
-
// CACHE_KEY_IGNORED_PROPS : {
|
|
330
|
-
// description: 'Properties to ignore when generating a feed ID for requests',
|
|
331
|
-
// type: 'string'
|
|
332
|
-
// }
|
|
333
|
-
SMOKE_TEST_PAYLOAD_FILE_NAME: {
|
|
334
|
-
description: 'Name of the test payload file used for the smoke endpoint',
|
|
335
|
-
type: 'string',
|
|
336
|
-
},
|
|
337
|
-
} as const
|
|
338
|
-
|
|
339
|
-
export const buildAdapterConfig = <
|
|
340
|
-
CustomSettings extends CustomSettingsType<CustomSettings> = EmptySettings,
|
|
341
|
-
>({
|
|
342
|
-
overrides = {} as Partial<BaseAdapterConfig>,
|
|
343
|
-
customSettings = {} as SettingsMap,
|
|
344
|
-
}): AdapterConfig<CustomSettings> => {
|
|
345
|
-
const validationErrors = [] as string[]
|
|
346
|
-
const vars = {} as Record<string, SettingValueType | undefined>
|
|
347
|
-
|
|
348
|
-
// Iterate base adapter env vars
|
|
349
|
-
for (const [key, config] of Object.entries(BaseSettings) as Array<
|
|
350
|
-
[keyof BaseAdapterConfig, Setting]
|
|
351
|
-
>) {
|
|
352
|
-
const value = getEnv(key as string, config) ?? overrides?.[key] ?? config.default
|
|
353
|
-
vars[key] = value
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
// Iterate custom vars
|
|
357
|
-
for (const [key, config] of Object.entries(customSettings) as Array<[string, Setting]>) {
|
|
358
|
-
if ((BaseSettings as Record<string, unknown>)[key as string]) {
|
|
359
|
-
throw new Error(
|
|
360
|
-
`Custom env var "${key}" declared, but a base framework env var with that name already exists.`,
|
|
361
|
-
)
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
const value = getEnv(key as string, config) ?? config.default
|
|
365
|
-
|
|
366
|
-
// Check if a required setting has been provided
|
|
367
|
-
if (config.required && value === null) {
|
|
368
|
-
validationErrors.push(`${key}: Value is required, but none was provided`)
|
|
369
|
-
} else if (config.validate) {
|
|
370
|
-
// Cast validate to unknown because TS can't select one of multiple variants of the validate function signature
|
|
371
|
-
const validationRes = (
|
|
372
|
-
config.validate as unknown as (value?: SettingValueType) => ValidationErrorMessage
|
|
373
|
-
)(value)
|
|
374
|
-
if (validationRes) {
|
|
375
|
-
validationErrors.push(`${key}: ${validationRes}`)
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
vars[key] = value
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
if (validationErrors.length > 0) {
|
|
382
|
-
throw new Error(
|
|
383
|
-
`Validation failed for the following variables:\n ${validationErrors.join('\n')}`,
|
|
384
|
-
)
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
return vars as AdapterConfig<CustomSettings>
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
const getEnv = (name: string, config: Setting): SettingValueType | null => {
|
|
391
|
-
const value = process.env[name]
|
|
392
|
-
if (!value) {
|
|
393
|
-
return null
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
switch (config.type) {
|
|
397
|
-
case 'string':
|
|
398
|
-
return value
|
|
399
|
-
case 'number':
|
|
400
|
-
return parseInt(value)
|
|
401
|
-
case 'boolean':
|
|
402
|
-
return value === 'true'
|
|
403
|
-
case 'enum':
|
|
404
|
-
if (!config.options?.includes(value)) {
|
|
405
|
-
throw new Error(
|
|
406
|
-
`Env var "${name}" has value "${value}" which is not included in the valid options (${config.options})`,
|
|
407
|
-
)
|
|
408
|
-
}
|
|
409
|
-
return value
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
type SettingValueType = string | number | boolean
|
|
414
|
-
type SettingType<C extends Setting> = C['type'] extends 'string'
|
|
415
|
-
? string
|
|
416
|
-
: C['type'] extends 'number'
|
|
417
|
-
? number
|
|
418
|
-
: C['type'] extends 'boolean'
|
|
419
|
-
? boolean
|
|
420
|
-
: C['type'] extends 'enum'
|
|
421
|
-
? C['options'] extends readonly string[]
|
|
422
|
-
? C['options'][number]
|
|
423
|
-
: never
|
|
424
|
-
: never
|
|
425
|
-
type BaseSettingsType = typeof BaseSettings
|
|
426
|
-
export type Setting =
|
|
427
|
-
| {
|
|
428
|
-
type: 'string'
|
|
429
|
-
description: string
|
|
430
|
-
options?: never
|
|
431
|
-
default?: string
|
|
432
|
-
validate?: (value?: string) => ValidationErrorMessage
|
|
433
|
-
required?: false
|
|
434
|
-
}
|
|
435
|
-
| {
|
|
436
|
-
type: 'string'
|
|
437
|
-
description: string
|
|
438
|
-
options?: never
|
|
439
|
-
default?: string
|
|
440
|
-
validate?: (value: string) => ValidationErrorMessage
|
|
441
|
-
required: true
|
|
442
|
-
}
|
|
443
|
-
| {
|
|
444
|
-
type: 'number'
|
|
445
|
-
description: string
|
|
446
|
-
options?: never
|
|
447
|
-
default?: number
|
|
448
|
-
validate?: (value?: number) => ValidationErrorMessage
|
|
449
|
-
required?: false
|
|
450
|
-
}
|
|
451
|
-
| {
|
|
452
|
-
type: 'number'
|
|
453
|
-
description: string
|
|
454
|
-
options?: never
|
|
455
|
-
default?: number
|
|
456
|
-
validate?: (value: number) => ValidationErrorMessage
|
|
457
|
-
required: true
|
|
458
|
-
}
|
|
459
|
-
| {
|
|
460
|
-
type: 'boolean'
|
|
461
|
-
description: string
|
|
462
|
-
options?: never
|
|
463
|
-
default?: boolean
|
|
464
|
-
validate?: (value?: boolean) => ValidationErrorMessage
|
|
465
|
-
required?: false
|
|
466
|
-
}
|
|
467
|
-
| {
|
|
468
|
-
type: 'boolean'
|
|
469
|
-
description: string
|
|
470
|
-
options?: never
|
|
471
|
-
default?: boolean
|
|
472
|
-
validate?: (value: boolean) => ValidationErrorMessage
|
|
473
|
-
required: true
|
|
474
|
-
}
|
|
475
|
-
| {
|
|
476
|
-
type: 'enum'
|
|
477
|
-
description: string
|
|
478
|
-
default?: string
|
|
479
|
-
options: readonly string[]
|
|
480
|
-
validate?: (value?: string) => ValidationErrorMessage
|
|
481
|
-
required?: false
|
|
482
|
-
}
|
|
483
|
-
| {
|
|
484
|
-
type: 'enum'
|
|
485
|
-
description: string
|
|
486
|
-
default?: string
|
|
487
|
-
options: readonly string[]
|
|
488
|
-
validate?: (value: string) => ValidationErrorMessage
|
|
489
|
-
required: true
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
export type AdapterConfigFromSettings<T extends SettingsMap> = {
|
|
493
|
-
-readonly [K in keyof T as T[K] extends {
|
|
494
|
-
default: SettingValueType
|
|
495
|
-
}
|
|
496
|
-
? K
|
|
497
|
-
: T[K]['required'] extends true
|
|
498
|
-
? K
|
|
499
|
-
: never]: SettingType<T[K]>
|
|
500
|
-
} & {
|
|
501
|
-
-readonly [K in keyof T as T[K] extends {
|
|
502
|
-
default: SettingValueType
|
|
503
|
-
}
|
|
504
|
-
? never
|
|
505
|
-
: T[K]['required'] extends true
|
|
506
|
-
? never
|
|
507
|
-
: K]?: SettingType<T[K]> | undefined
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
export type BaseAdapterConfig = AdapterConfigFromSettings<BaseSettingsType>
|
|
511
|
-
export type AdapterConfig<T extends CustomSettingsType<T> = SettingsMap> =
|
|
512
|
-
AdapterConfigFromSettings<T> & BaseAdapterConfig
|
|
513
|
-
|
|
514
|
-
export type CustomSettingsType<T = SettingsMap> = Record<keyof T, Setting>
|
|
515
|
-
export type EmptySettings = Record<string, never>
|
|
516
|
-
export type SettingsMap = Record<string, Setting>
|
|
517
|
-
export type ValidationErrorMessage = string | undefined
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { makeLogger } from '../util'
|
|
2
|
-
|
|
3
|
-
export const DEFAULT_MINUTE_RATE_LIMIT = 60
|
|
4
|
-
export const BURST_UNDEFINED_QUOTA_MULTIPLE = 2
|
|
5
|
-
|
|
6
|
-
export const DEFAULT_WS_CONNECTIONS = 2
|
|
7
|
-
export const DEFAULT_WS_SUBSCRIPTIONS = 10
|
|
8
|
-
|
|
9
|
-
type RateLimitTimeFrame = 'rateLimit1s' | 'rateLimit1m' | 'rateLimit1h'
|
|
10
|
-
|
|
11
|
-
type HTTPTier = {
|
|
12
|
-
rateLimit1s?: number
|
|
13
|
-
rateLimit1m?: number
|
|
14
|
-
rateLimit1h?: number
|
|
15
|
-
note?: string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
type WSTier = {
|
|
19
|
-
connections: number
|
|
20
|
-
subscriptions: number
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface Limits {
|
|
24
|
-
http: {
|
|
25
|
-
[tierName: string]: HTTPTier
|
|
26
|
-
}
|
|
27
|
-
ws: {
|
|
28
|
-
[tierName: string]: WSTier
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
interface ProviderRateLimit {
|
|
33
|
-
second: number
|
|
34
|
-
minute: number
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const logger = makeLogger('ProviderLimits')
|
|
38
|
-
|
|
39
|
-
export const getHTTPLimit = (
|
|
40
|
-
provider: string,
|
|
41
|
-
limits: Limits,
|
|
42
|
-
tier: string,
|
|
43
|
-
timeframe: RateLimitTimeFrame,
|
|
44
|
-
): number => {
|
|
45
|
-
const providerLimit = getProviderLimits(provider, limits, tier, 'http')
|
|
46
|
-
return (providerLimit as HTTPTier)?.[timeframe] || 0
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export const getRateLimit = (provider: string, limits: Limits, tier: string): ProviderRateLimit => {
|
|
50
|
-
const providerLimit = getProviderLimits(provider, limits, tier, 'http')
|
|
51
|
-
return calculateRateLimit(providerLimit as HTTPTier)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export const getWSLimits = (provider: string, limits: Limits, tier: string): WSTier => {
|
|
55
|
-
const providerLimit = getProviderLimits(provider, limits, tier, 'ws')
|
|
56
|
-
return calculateWSLimits(providerLimit as WSTier)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const getProviderLimits = (
|
|
60
|
-
provider: string,
|
|
61
|
-
limits: Limits,
|
|
62
|
-
tier: string,
|
|
63
|
-
protocol: 'ws' | 'http',
|
|
64
|
-
): HTTPTier | WSTier | undefined => {
|
|
65
|
-
const providerConfig = parseLimits(limits)
|
|
66
|
-
if (!providerConfig) {
|
|
67
|
-
throw new Error(
|
|
68
|
-
`Rate Limit: Provider: "${provider}" doesn't match any provider spec in limits.json`,
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const protocolConfig = providerConfig[protocol]
|
|
73
|
-
if (!protocolConfig) {
|
|
74
|
-
throw new Error(
|
|
75
|
-
`Rate Limit: "${provider}" doesn't have any configuration for ${protocol} in limits.json`,
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
let limitsConfig = protocolConfig[tier.toLowerCase()]
|
|
80
|
-
|
|
81
|
-
if (!limitsConfig) {
|
|
82
|
-
logger.debug(
|
|
83
|
-
`Rate Limit: "${provider} does not have tier ${tier} defined. Falling back to lowest tier"`,
|
|
84
|
-
)
|
|
85
|
-
limitsConfig = Object.values(protocolConfig)?.[0]
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (!limitsConfig) {
|
|
89
|
-
throw new Error(
|
|
90
|
-
`Rate Limit: Provider: "${provider}" has no tiers defined for ${protocol} in limits.json`,
|
|
91
|
-
)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return limitsConfig
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const parseLimits = (limits: Limits): Limits => {
|
|
98
|
-
const _mapObject = (fn: any) => (o: any) => Object.fromEntries(Object.entries(o).map(fn))
|
|
99
|
-
const _formatProtocol = _mapObject((entry: any[]) => {
|
|
100
|
-
const [tierName, rest] = entry
|
|
101
|
-
return [tierName.toLowerCase(), { ...(rest as any) }]
|
|
102
|
-
})
|
|
103
|
-
const _formatProvider = (ls: Limits) => {
|
|
104
|
-
const http = _formatProtocol(ls.http)
|
|
105
|
-
const ws = _formatProtocol(ls?.ws)
|
|
106
|
-
return { http, ws }
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return _formatProvider(limits)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const calculateWSLimits = (providerLimit: WSTier): WSTier => {
|
|
113
|
-
return {
|
|
114
|
-
connections: providerLimit.connections,
|
|
115
|
-
subscriptions: providerLimit.subscriptions,
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const calculateRateLimit = (providerLimit: HTTPTier): ProviderRateLimit => {
|
|
120
|
-
let quota = providerLimit.rateLimit1m
|
|
121
|
-
if (!quota && providerLimit?.rateLimit1h) {
|
|
122
|
-
quota = providerLimit?.rateLimit1h / 60
|
|
123
|
-
} else if (!quota && providerLimit?.rateLimit1s) {
|
|
124
|
-
quota = providerLimit?.rateLimit1s * 60
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
second: providerLimit?.rateLimit1s || ((quota as number) / 60) * BURST_UNDEFINED_QUOTA_MULTIPLE,
|
|
128
|
-
minute: quota as number,
|
|
129
|
-
}
|
|
130
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
See: https://github.com/smartcontractkit/external-adapters-js/tree/develop/packages/sources/bank-frick for the original V2 adapter
|
|
2
|
-
|
|
3
|
-
The Bank Frick adapter is a complex REST-based EA that consists of mostly non-transferrable code purpose build to run against Bank Frick. Due to limitations of the API, this adapter has to interact with the API multiple times to fetch pages of data. This behavior is unique to the Bank Frick EA specifically, so no transport has been created to accomodate this pattern (nor is there the need to create one currently since it's only the Bank Frick EA so far). Instead, this EA leverages the frameworks interfaces for its own, EA specific transport.
|
|
4
|
-
|
|
5
|
-
What this example demonstrates is the V3 framework's features can be leveraged by complex implementations, and that complex implementations plug into the framework seamlessly when implementing the framework's patterns and interfacts.
|
|
6
|
-
|
|
7
|
-
In this example, you will find:
|
|
8
|
-
* A custom Transport implementation
|
|
9
|
-
* Custom validation for configuration
|
|
10
|
-
* (Non-V3) JWT authentication workflow
|