@chainlink/external-adapter-framework 0.16.0 → 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/transports/websocket.d.ts +1 -3
- package/transports/websocket.js +3 -7
- package/transports/websocket.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":[],"mapp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,GAAG,CAAC,CAAA;IACrC,IAAI,QAAQ,EAAE;QACZ,MAAM,CAAC,KAAK,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,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,CAAC,cAAc,CAAC,IAAI,EAAE,CAChI,CAAA;QAED,+DAA+D;QAC/D,MAAM,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"}
|
|
@@ -34,10 +34,9 @@ export interface WebSocketTransportConfig<T extends WebsocketTransportGenerics>
|
|
|
34
34
|
*
|
|
35
35
|
* @param message - the message received by the WS
|
|
36
36
|
* @param context - the background context for the Adapter
|
|
37
|
-
* @param params - current params in the subscription set
|
|
38
37
|
* @returns a list of cache entries of adapter responses to set in the cache
|
|
39
38
|
*/
|
|
40
|
-
message: (message: T['Provider']['WsMessage'], context: EndpointContext<T
|
|
39
|
+
message: (message: T['Provider']['WsMessage'], context: EndpointContext<T>) => ProviderResult<T>[] | undefined;
|
|
41
40
|
};
|
|
42
41
|
/** Map of "builders", functions that will be used to prepare specific WS messages */
|
|
43
42
|
builders?: {
|
|
@@ -84,7 +83,6 @@ export declare class WebSocketTransport<T extends WebsocketTransportGenerics> ex
|
|
|
84
83
|
currentUrl: string;
|
|
85
84
|
lastMessageReceivedAt: number;
|
|
86
85
|
connectionOpenedAt: number;
|
|
87
|
-
desiredSubscriptions: T['Request']['Params'][];
|
|
88
86
|
constructor(config: WebSocketTransportConfig<T>);
|
|
89
87
|
getSubscriptionTtlFromConfig(config: AdapterConfig<T['CustomSettings']>): number;
|
|
90
88
|
connectionClosed(): boolean;
|
package/transports/websocket.js
CHANGED
|
@@ -56,7 +56,6 @@ class WebSocketTransport extends streaming_1.StreamingTransport {
|
|
|
56
56
|
this.currentUrl = '';
|
|
57
57
|
this.lastMessageReceivedAt = 0;
|
|
58
58
|
this.connectionOpenedAt = 0;
|
|
59
|
-
this.desiredSubscriptions = [];
|
|
60
59
|
}
|
|
61
60
|
getSubscriptionTtlFromConfig(config) {
|
|
62
61
|
return config.WS_SUBSCRIPTION_TTL;
|
|
@@ -88,9 +87,7 @@ class WebSocketTransport extends streaming_1.StreamingTransport {
|
|
|
88
87
|
const parsed = this.deserializeMessage(event.data);
|
|
89
88
|
logger.trace(`Got ws message: ${event.data}`);
|
|
90
89
|
const providerDataReceived = Date.now();
|
|
91
|
-
const results = this.config.handlers
|
|
92
|
-
.message(parsed, context, this.desiredSubscriptions)
|
|
93
|
-
?.map((r) => {
|
|
90
|
+
const results = this.config.handlers.message(parsed, context)?.map((r) => {
|
|
94
91
|
const result = r;
|
|
95
92
|
const partialResponse = r.response;
|
|
96
93
|
result.response.timestamps = {
|
|
@@ -152,7 +149,6 @@ class WebSocketTransport extends streaming_1.StreamingTransport {
|
|
|
152
149
|
}
|
|
153
150
|
}
|
|
154
151
|
async streamHandler(context, subscriptions) {
|
|
155
|
-
this.desiredSubscriptions = subscriptions.desired;
|
|
156
152
|
// New subs && no connection -> connect -> add subs
|
|
157
153
|
// No new subs && no connection -> skip
|
|
158
154
|
// New subs && connection -> add subs
|
|
@@ -163,7 +159,7 @@ class WebSocketTransport extends streaming_1.StreamingTransport {
|
|
|
163
159
|
}
|
|
164
160
|
// We want to check if the URL we calculate is different from the one currently connected.
|
|
165
161
|
// This is because some providers handle subscriptions on the URLs and not through messages.
|
|
166
|
-
const urlFromConfig = await this.config.url(context,
|
|
162
|
+
const urlFromConfig = await this.config.url(context, subscriptions.desired);
|
|
167
163
|
const urlChanged = this.currentUrl !== urlFromConfig;
|
|
168
164
|
// We want to check that if we have a connection, it hasn't gone stale. That is,
|
|
169
165
|
// since opening it, have we had any activity from the provider.
|
|
@@ -189,7 +185,7 @@ class WebSocketTransport extends streaming_1.StreamingTransport {
|
|
|
189
185
|
}
|
|
190
186
|
}
|
|
191
187
|
// Check if we need to open a new connection
|
|
192
|
-
if (connectionClosed &&
|
|
188
|
+
if (connectionClosed && subscriptions.desired.length) {
|
|
193
189
|
logger.debug('No established connection and new subscriptions available, connecting to WS');
|
|
194
190
|
const options = this.config.options && (await this.config.options(context));
|
|
195
191
|
this.currentUrl = urlFromConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket.js","sourceRoot":"","sources":["../../../src/transports/websocket.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAsD;AAU7C,oBAVF,YAAS,CAUE;AAPlB,kCAA2C;AAG3C,4DAA6C;AAC7C,oDAA6E;AAK7E,MAAM,MAAM,GAAG,IAAA,iBAAU,EAAC,oBAAoB,CAAC,CAAA;AAQ/C,MAAa,sBAAsB;IAGjC,MAAM,CAAC,GAAG,CAAC,IAAoB;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,MAAM,CAAC,GAAG;QACR,OAAO,IAAI,CAAC,IAAI,CAAA;IAClB,CAAC;;AATH,wDAUC;AATQ,2BAAI,GAAmB,YAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"websocket.js","sourceRoot":"","sources":["../../../src/transports/websocket.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAsD;AAU7C,oBAVF,YAAS,CAUE;AAPlB,kCAA2C;AAG3C,4DAA6C;AAC7C,oDAA6E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CAAC,CAAA;QAExF,4FAA4F;QAC5F,MAAM,CAAC,KAAK,CACV,4CAA4C,OAAO,CAAC,aAAa,CAAC,wBAAwB,OAAO,CAClG,CAAA;QACD,MAAM,IAAA,YAAK,EAAC,OAAO,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAA;QAE3D,OAAM;IACR,CAAC;IAEO,gBAAgB,CACtB,WAAuC,EACvC,OAAoC;QAEpC,OAAO,KAAK,EAAE,KAAQ,EAAE,EAAE;YACxB,IAAI;gBACF,MAAM,OAAO,CAAC,KAAK,CAAC,CAAA;aACrB;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,WAAW,CAAC,CAAC,CAAC,CAAA;aACtB;QACH,CAAC,CAAA;IACH,CAAC;CACF;AAnOD,gDAmOC"}
|
|
@@ -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
|
}
|