@chainlink/external-adapter-framework 0.16.1 → 0.17.0
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/cache/index.d.ts +4 -4
- package/cache/index.js +13 -31
- package/cache/index.js.map +1 -1
- package/package.json +1 -1
- package/transports/abstract/subscription.js +1 -1
- package/transports/abstract/subscription.js.map +1 -1
- package/util/subscription-set/expiring-sorted-set.d.ts +2 -11
- package/util/subscription-set/expiring-sorted-set.js +6 -9
- package/util/subscription-set/expiring-sorted-set.js.map +1 -1
- package/util/subscription-set/redis-sorted-set.d.ts +1 -1
- package/util/subscription-set/redis-sorted-set.js +3 -5
- package/util/subscription-set/redis-sorted-set.js.map +1 -1
- package/util/subscription-set/subscription-set.d.ts +1 -1
package/cache/index.d.ts
CHANGED
|
@@ -64,16 +64,16 @@ export declare const calculateFeedId: <T extends import("../transports").Transpo
|
|
|
64
64
|
* Calculates a unique key from the provided data.
|
|
65
65
|
*
|
|
66
66
|
* @param data - the request data/body, i.e. the adapter input params
|
|
67
|
-
* @param
|
|
67
|
+
* @param adapterConfig - the config for this Adapter
|
|
68
68
|
* @returns the calculated unique key
|
|
69
69
|
*
|
|
70
70
|
* @example
|
|
71
71
|
* ```
|
|
72
|
-
* calculateKey({ base: 'ETH', quote: 'BTC' }
|
|
73
|
-
* // equals
|
|
72
|
+
* calculateKey({ base: 'ETH', quote: 'BTC' })
|
|
73
|
+
* // equals `{"base":"eth","quote":"btc"}`
|
|
74
74
|
* ```
|
|
75
75
|
*/
|
|
76
|
-
export declare const calculateKey: <CustomSettings extends SettingsMap>(data: unknown,
|
|
76
|
+
export declare const calculateKey: <CustomSettings extends SettingsMap>(data: unknown, adapterConfig: AdapterConfig<CustomSettings>) => string;
|
|
77
77
|
/**
|
|
78
78
|
* Polls the provided Cache for an AdapterResponse set in the provided key. If the maximum
|
|
79
79
|
* amount of retries is exceeded, it returns undefined instead.
|
package/cache/index.js
CHANGED
|
@@ -22,64 +22,46 @@ __exportStar(require("./redis"), exports);
|
|
|
22
22
|
const logger = (0, util_1.makeLogger)('Cache');
|
|
23
23
|
// Uses calculateKey to generate a unique key from the endpoint name, data, and input parameters
|
|
24
24
|
const calculateCacheKey = ({ inputParameters, endpointName, adapterConfig, }, data) => {
|
|
25
|
-
|
|
26
|
-
if (paramNames.length === 0) {
|
|
25
|
+
if (Object.keys(inputParameters).length === 0) {
|
|
27
26
|
logger.trace(`Using default cache key ${adapterConfig.DEFAULT_CACHE_KEY}`);
|
|
28
27
|
return adapterConfig.DEFAULT_CACHE_KEY;
|
|
29
28
|
}
|
|
30
|
-
const cacheKey = `${endpointName}-${(0, exports.calculateKey)(data,
|
|
29
|
+
const cacheKey = `${endpointName}-${(0, exports.calculateKey)(data, adapterConfig)}`;
|
|
31
30
|
logger.trace(`Generated cache key for request: "${cacheKey}"`);
|
|
32
31
|
return cacheKey;
|
|
33
32
|
};
|
|
34
33
|
exports.calculateCacheKey = calculateCacheKey;
|
|
35
34
|
const calculateFeedId = ({ inputParameters, adapterConfig, }, data) => {
|
|
36
|
-
|
|
37
|
-
if (paramNames.length === 0) {
|
|
35
|
+
if (Object.keys(inputParameters).length === 0) {
|
|
38
36
|
logger.trace(`Cannot generate Feed ID without input parameters`);
|
|
39
37
|
return 'N/A';
|
|
40
38
|
}
|
|
41
|
-
return (0, exports.calculateKey)(data,
|
|
39
|
+
return (0, exports.calculateKey)(data, adapterConfig);
|
|
42
40
|
};
|
|
43
41
|
exports.calculateFeedId = calculateFeedId;
|
|
44
42
|
/**
|
|
45
43
|
* Calculates a unique key from the provided data.
|
|
46
44
|
*
|
|
47
45
|
* @param data - the request data/body, i.e. the adapter input params
|
|
48
|
-
* @param
|
|
46
|
+
* @param adapterConfig - the config for this Adapter
|
|
49
47
|
* @returns the calculated unique key
|
|
50
48
|
*
|
|
51
49
|
* @example
|
|
52
50
|
* ```
|
|
53
|
-
* calculateKey({ base: 'ETH', quote: 'BTC' }
|
|
54
|
-
* // equals
|
|
51
|
+
* calculateKey({ base: 'ETH', quote: 'BTC' })
|
|
52
|
+
* // equals `{"base":"eth","quote":"btc"}`
|
|
55
53
|
* ```
|
|
56
54
|
*/
|
|
57
|
-
const calculateKey = (data,
|
|
55
|
+
const calculateKey = (data, adapterConfig) => {
|
|
58
56
|
if (data && typeof data !== 'object') {
|
|
59
57
|
throw new Error('Data to calculate cache key should be an object');
|
|
60
58
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const param = params[paramName];
|
|
65
|
-
if (param === undefined) {
|
|
66
|
-
continue;
|
|
59
|
+
let cacheKey = JSON.stringify(data, (_, value) => {
|
|
60
|
+
if (value && typeof value === 'string') {
|
|
61
|
+
return value.toLowerCase();
|
|
67
62
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
case 'string':
|
|
71
|
-
cacheKey += param.toLowerCase();
|
|
72
|
-
break;
|
|
73
|
-
case 'number':
|
|
74
|
-
case 'boolean':
|
|
75
|
-
cacheKey += param.toString();
|
|
76
|
-
break;
|
|
77
|
-
case 'object':
|
|
78
|
-
// Force cache keys to only use performant properties of the input params.
|
|
79
|
-
// If the object were to be used, we'd have to sort its properties.
|
|
80
|
-
logger.debug(`Property "${paramName}" in request parameters is of type object, and won't be used in the cacheKey`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
63
|
+
return value;
|
|
64
|
+
});
|
|
83
65
|
if (cacheKey.length > adapterConfig.MAX_COMMON_KEY_SIZE) {
|
|
84
66
|
logger.warn(`Generated cache key for adapter request is bigger than the MAX_COMMON_KEY_SIZE and will be truncated`);
|
|
85
67
|
cacheKey = cacheKey.slice(0, adapterConfig.MAX_COMMON_KEY_SIZE);
|
package/cache/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cache/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,kCAA4D;AAI5D,4CAAyB;AACzB,0CAAuB;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,CAAC,yBAAyB,CAAC,CAAA;QACvC,OAAO,QAAQ,CAAA;KAChB;IAED,IAAI,OAAO,CAAC,UAAU,KAAK,CAAC,EAAE;QAC5B,MAAM,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA;QACpD,OAAO,SAAS,CAAA;KACjB;IAED,MAAM,CAAC,KAAK,CAAC,gCAAgC,OAAO,CAAC,KAAK,kBAAkB,CAAC,CAAA;IAC7E,MAAM,IAAA,YAAK,EAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAE1B,OAAO,IAAA,6BAAqB,EAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;AAC9D,CAAC,CAAA;AA/BY,QAAA,qBAAqB,yBA+BjC"}
|
package/package.json
CHANGED
|
@@ -42,7 +42,7 @@ class SubscriptionTransport {
|
|
|
42
42
|
async registerRequest(req, _) {
|
|
43
43
|
logger.debug(`Adding entry to subscription set (ttl ${this.subscriptionTtl}): [${req.requestContext.cacheKey}] = ${req.requestContext.data}`);
|
|
44
44
|
// This might need coalescing to avoid too frequent ttl updates
|
|
45
|
-
await this.subscriptionSet.add(req.requestContext.
|
|
45
|
+
await this.subscriptionSet.add(req.requestContext.data, this.subscriptionTtl);
|
|
46
46
|
}
|
|
47
47
|
async backgroundExecute(context) {
|
|
48
48
|
logger.debug('Starting background execute');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../../../src/transports/abstract/subscription.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,qCAAwD;AAGxD,6DAA8C;AAE9C,MAAM,MAAM,GAAG,IAAA,iBAAU,EAAC,uBAAuB,CAAC,CAAA;AAElD;;;;;GAKG;AACH,MAAsB,qBAAqB;IAQzC,KAAK,CAAC,UAAU,CACd,YAAsC,EACtC,MAA0C,EAC1C,YAAoB;QAEpB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC,aA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M,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,eAAe,CAAC,CAAA;IAC/E,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAA2B;QACjD,MAAM,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAA;QAC3C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAA;QAEnD,4DAA4D;QAC5D,gFAAgF;QAChF,2HAA2H;QAC3H,gBAAgB,CAAC,6BAA6B;aAC3C,MAAM,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,YAAY,EAAE,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;aACjF,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAEtB,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAChD,CAAC;CAmBF;AA7DD,sDA6DC"}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import { SubscriptionSet } from './subscription-set';
|
|
2
|
-
/**
|
|
3
|
-
* An object describing an entry in the expiring sorted set.
|
|
4
|
-
* @typeParam T - the type of the entry's value
|
|
5
|
-
*/
|
|
6
|
-
interface ExpiringSortedSetEntry<T> {
|
|
7
|
-
value: T;
|
|
8
|
-
expirationTimestamp: number;
|
|
9
|
-
}
|
|
10
2
|
/**
|
|
11
3
|
* This class implements a set of unique items, each of which has an expiration timestamp.
|
|
12
4
|
* On reads, items that have expired will be deleted from the set and not returned.
|
|
@@ -14,8 +6,7 @@ interface ExpiringSortedSetEntry<T> {
|
|
|
14
6
|
* @typeParam T - the type of the set entries' values
|
|
15
7
|
*/
|
|
16
8
|
export declare class ExpiringSortedSet<T> implements SubscriptionSet<T> {
|
|
17
|
-
map: Map<string,
|
|
18
|
-
add(
|
|
9
|
+
map: Map<string, number>;
|
|
10
|
+
add(value: T, ttl: number): void;
|
|
19
11
|
getAll(): T[];
|
|
20
12
|
}
|
|
21
|
-
export {};
|
|
@@ -11,22 +11,19 @@ class ExpiringSortedSet {
|
|
|
11
11
|
constructor() {
|
|
12
12
|
this.map = new Map();
|
|
13
13
|
}
|
|
14
|
-
add(
|
|
15
|
-
this.map.set(
|
|
16
|
-
value,
|
|
17
|
-
expirationTimestamp: Date.now() + ttl,
|
|
18
|
-
});
|
|
14
|
+
add(value, ttl) {
|
|
15
|
+
this.map.set(JSON.stringify(value), Date.now() + ttl);
|
|
19
16
|
}
|
|
20
17
|
getAll() {
|
|
21
18
|
const results = [];
|
|
22
19
|
const now = Date.now();
|
|
23
20
|
// Since we're iterating, might as well prune here
|
|
24
|
-
for (const [
|
|
25
|
-
if (
|
|
26
|
-
this.map.delete(
|
|
21
|
+
for (const [value, ttl] of this.map.entries()) {
|
|
22
|
+
if (ttl < now) {
|
|
23
|
+
this.map.delete(value); // In theory, this shouldn't happen frequently for feeds
|
|
27
24
|
}
|
|
28
25
|
else {
|
|
29
|
-
results.push(
|
|
26
|
+
results.push(JSON.parse(value));
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
29
|
return results;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expiring-sorted-set.js","sourceRoot":"","sources":["../../../../src/util/subscription-set/expiring-sorted-set.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"expiring-sorted-set.js","sourceRoot":"","sources":["../../../../src/util/subscription-set/expiring-sorted-set.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACH,MAAa,iBAAiB;IAA9B;QACE,QAAG,GAAG,IAAI,GAAG,EAAkB,CAAA;IAqBjC,CAAC;IAnBC,GAAG,CAAC,KAAQ,EAAE,GAAW;QACvB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,CAAA;IACvD,CAAC;IAED,MAAM;QACJ,MAAM,OAAO,GAAQ,EAAE,CAAA;QACvB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAEtB,kDAAkD;QAClD,KAAK,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE;YAC7C,IAAI,GAAG,GAAG,GAAG,EAAE;gBACb,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA,CAAC,wDAAwD;aAChF;iBAAM;gBACL,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;aAChC;SACF;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AAtBD,8CAsBC"}
|
|
@@ -4,6 +4,6 @@ export declare class RedisSubscriptionSet<T> implements SubscriptionSet<T> {
|
|
|
4
4
|
private redisClient;
|
|
5
5
|
private subscriptionSetKey;
|
|
6
6
|
constructor(redisClient: Redis, subscriptionSetKey: string);
|
|
7
|
-
add(
|
|
7
|
+
add(value: T, ttl: number): Promise<undefined>;
|
|
8
8
|
getAll(): Promise<T[]>;
|
|
9
9
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RedisSubscriptionSet = void 0;
|
|
4
|
-
// Delimiter used to store both key and value in redis sorted set string field together
|
|
5
|
-
const DELIMITER = '>';
|
|
6
4
|
class RedisSubscriptionSet {
|
|
7
5
|
constructor(redisClient, subscriptionSetKey) {
|
|
8
6
|
this.redisClient = redisClient;
|
|
9
7
|
this.subscriptionSetKey = subscriptionSetKey;
|
|
10
8
|
}
|
|
11
|
-
async add(
|
|
12
|
-
const storedValue =
|
|
9
|
+
async add(value, ttl) {
|
|
10
|
+
const storedValue = JSON.stringify(value);
|
|
13
11
|
await this.redisClient.zadd(this.subscriptionSetKey, Date.now() + ttl, storedValue);
|
|
14
12
|
return;
|
|
15
13
|
}
|
|
@@ -20,7 +18,7 @@ class RedisSubscriptionSet {
|
|
|
20
18
|
const validEntries = await this.redisClient.zrange(this.subscriptionSetKey, 0, -1);
|
|
21
19
|
validEntries.forEach((entry) => {
|
|
22
20
|
// Separate request and cache key prior to populating results array
|
|
23
|
-
parsedRequests.push(JSON.parse(entry
|
|
21
|
+
parsedRequests.push(JSON.parse(entry));
|
|
24
22
|
});
|
|
25
23
|
return parsedRequests;
|
|
26
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redis-sorted-set.js","sourceRoot":"","sources":["../../../../src/util/subscription-set/redis-sorted-set.ts"],"names":[],"mappings":";;;AAGA,
|
|
1
|
+
{"version":3,"file":"redis-sorted-set.js","sourceRoot":"","sources":["../../../../src/util/subscription-set/redis-sorted-set.ts"],"names":[],"mappings":";;;AAGA,MAAa,oBAAoB;IAK/B,YAAY,WAAkB,EAAE,kBAA0B;QACxD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAA;IAC9C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,KAAQ,EAAE,GAAW;QAC7B,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;QACzC,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,EAAE,WAAW,CAAC,CAAA;QACnF,OAAM;IACR,CAAC;IAED,KAAK,CAAC,MAAM;QACV,sCAAsC;QACtC,MAAM,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,kBAAkB,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;QACpF,MAAM,cAAc,GAAQ,EAAE,CAAA;QAC9B,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAClF,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YAC7B,mEAAmE;YACnE,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;QACxC,CAAC,CAAC,CAAA;QACF,OAAO,cAAc,CAAA;IACvB,CAAC;CACF;AA3BD,oDA2BC"}
|
|
@@ -6,7 +6,7 @@ import { AdapterConfig } from '../../config';
|
|
|
6
6
|
*/
|
|
7
7
|
export interface SubscriptionSet<T> {
|
|
8
8
|
/** Add a new subscription to the set */
|
|
9
|
-
add(
|
|
9
|
+
add(value: T, ttl: number): PromiseOrValue<void>;
|
|
10
10
|
/** Get all subscriptions from the set as a list */
|
|
11
11
|
getAll(): PromiseOrValue<T[]>;
|
|
12
12
|
}
|