-
Notifications
You must be signed in to change notification settings - Fork 0
/
mdquery.js
34 lines (30 loc) · 837 Bytes
/
mdquery.js
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
33
34
const {
MDQuery,
} = require('node-gyp-build')(__dirname);
const mdQueryImpl = (option) => {
const { query, scopes, maxResultCount } = option;
const mdQuery = new MDQuery(query, scopes ?? [MDQueryScope.Home], maxResultCount ?? 0);
return new Promise((resolve) => {
mdQuery.start((result) => resolve(result));
});
};
const MDQueryScope = {
Home: 'kMDQueryScopeHome',
Computer: 'kMDQueryScopeComputer',
Network: 'kMDQueryScopeNetwork',
AllIndexed: 'kMDQueryScopeAllIndexed',
ComputerIndexed: 'kMDQueryScopeComputerIndexed',
NetworkIndexed: 'kMDQueryScopeNetworkIndexed',
};
const MDQueryUpdateType = {
Add: 0,
Change: 1,
Remove: 2,
};
module.exports = {
mdQuery: mdQueryImpl,
MDQuery,
MDQueryScope,
MDQueryResultCountNoLimit: 0,
MDQueryUpdateType,
};