-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ts
32 lines (30 loc) · 1.07 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { Plugin, KeyedStoreTrigger, Step } from "@shanzhai/interfaces";
import { pugSourceStore } from "@shanzhai/pug-source-store";
import { parsedPugStore } from "@shanzhai/parsed-pug-store";
import { ParsePugStep } from "@shanzhai/parse-pug-step";
import { DeleteFromKeyedStoreStep } from "@shanzhai/delete-from-keyed-store-step";
import { KeyedStoreGetInput } from "@shanzhai/keyed-store-get-input";
import { KeyedStoreSetOutput } from "@shanzhai/keyed-store-set-output";
const parsePugPlugin: Plugin<{
readonly parsePug: KeyedStoreTrigger;
}> = {
triggers: {
parsePug: {
type: `keyedStore`,
keyedStore: pugSourceStore,
refreshAllWhenStoresChange: [],
down(key: string): Step {
return new DeleteFromKeyedStoreStep(parsedPugStore, key);
},
up(key: string): Step {
return new ParsePugStep(
`Parse Pug "Test Key"`,
new KeyedStoreGetInput(pugSourceStore, key),
new KeyedStoreSetOutput(parsedPugStore, key)
);
},
writesToStores: [parsedPugStore],
},
},
};
export = parsePugPlugin;