@moneypot/hub 1.4.0 → 1.4.1
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/README.md
CHANGED
|
@@ -28,7 +28,7 @@ export const HubPutAlertPlugin = makeExtendSchemaPlugin(() => {
|
|
|
28
28
|
return "";
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
return listenWithFilter($pgSubscriber, $channelKey, jsonParse, $identity, (
|
|
31
|
+
return listenWithFilter($pgSubscriber, $channelKey, jsonParse, $identity, (item, identity) => {
|
|
32
32
|
if (identity?.kind !== "user") {
|
|
33
33
|
return false;
|
|
34
34
|
}
|
|
@@ -5,7 +5,7 @@ export declare class ListenWithFilterStep<TTopics extends {
|
|
|
5
5
|
[topic: string]: any;
|
|
6
6
|
}, TTopic extends keyof TTopics, TPayloadStep extends Step, TFilterInput> extends Step<TTopics[TTopic][]> {
|
|
7
7
|
itemPlan: (itemPlan: __ItemStep<TTopics[TTopic]>) => TPayloadStep;
|
|
8
|
-
filterFn: (
|
|
8
|
+
filterFn: (item: any, filterInput: TFilterInput) => boolean;
|
|
9
9
|
static $$export: {
|
|
10
10
|
moduleName: string;
|
|
11
11
|
exportName: string;
|
|
@@ -14,9 +14,9 @@ export declare class ListenWithFilterStep<TTopics extends {
|
|
|
14
14
|
private pubsubDep;
|
|
15
15
|
private topicDep;
|
|
16
16
|
private filterInputDep;
|
|
17
|
-
constructor(pubsubOrPlan: Step<GrafastSubscriber<TTopics> | null> | GrafastSubscriber<TTopics> | null, topicOrPlan: Step<TTopic> | string, itemPlan: ((itemPlan: __ItemStep<TTopics[TTopic]>) => TPayloadStep) | undefined, filterInputPlan: Step<TFilterInput>, filterFn: (
|
|
17
|
+
constructor(pubsubOrPlan: Step<GrafastSubscriber<TTopics> | null> | GrafastSubscriber<TTopics> | null, topicOrPlan: Step<TTopic> | string, itemPlan: ((itemPlan: __ItemStep<TTopics[TTopic]>) => TPayloadStep) | undefined, filterInputPlan: Step<TFilterInput>, filterFn: (item: any, filterInput: TFilterInput) => boolean);
|
|
18
18
|
execute({ indexMap, values, stream, }: ExecutionDetails<readonly [GrafastSubscriber<TTopics>, TTopic]>): GrafastResultStreamList<TTopics[TTopic]>;
|
|
19
19
|
}
|
|
20
20
|
export declare function listenWithFilter<TTopics extends {
|
|
21
21
|
[topic: string]: any;
|
|
22
|
-
}, TTopic extends keyof TTopics, TPayloadStep extends Step, TFilterInput>(pubsubOrPlan: Step<GrafastSubscriber<TTopics> | null> | GrafastSubscriber<TTopics> | null, topicOrPlan: Step<TTopic> | string, itemPlan: ((itemPlan: __ItemStep<TTopics[TTopic]>) => TPayloadStep) | undefined, filterInputPlan: Step<TFilterInput>, filterFn: (
|
|
22
|
+
}, TTopic extends keyof TTopics, TPayloadStep extends Step, TFilterInput>(pubsubOrPlan: Step<GrafastSubscriber<TTopics> | null> | GrafastSubscriber<TTopics> | null, topicOrPlan: Step<TTopic> | string, itemPlan: ((itemPlan: __ItemStep<TTopics[TTopic]>) => TPayloadStep) | undefined, filterInputPlan: Step<TFilterInput>, filterFn: (item: any, filterInput: TFilterInput) => boolean): ListenWithFilterStep<TTopics, TTopic, TPayloadStep, TFilterInput>;
|
|
@@ -47,7 +47,7 @@ export class ListenWithFilterStep extends Step {
|
|
|
47
47
|
[Symbol.asyncIterator]: async function* () {
|
|
48
48
|
const iterator = await origStream;
|
|
49
49
|
for await (const item of iterator) {
|
|
50
|
-
if (filterFn(
|
|
50
|
+
if (filterFn(item, filterInput)) {
|
|
51
51
|
yield item;
|
|
52
52
|
}
|
|
53
53
|
}
|