-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunner.d.ts
98 lines (74 loc) · 2.71 KB
/
runner.d.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/* eslint-disable @typescript-eslint/naming-convention */
import {
MDQueryItem,
MDQueryUpdateType,
} from './mdquery';
/**
* Commonly used Spotlight Metadata attribute keys.
* You can find the complete list here.
* https://developer.apple.com/library/archive/documentation/CoreServices/Reference/MetadataAttributesRef/Reference/CommonAttrs.html#//apple_ref/doc/uid/TP40001694-SW1
*/
export enum MDItemKey {
DisplayName = 'kMDItemDisplayName',
FSName = 'kMDItemFSName',
ModificationDate = 'kMDItemContentModificationDate',
CreationDate = 'kMDItemContentCreationDate',
LastUsedDate = 'kMDItemLastUsedDate',
Size = 'kMDItemFSSize',
ContentType = 'kMDItemContentType',
}
/**
* Convert seconds timestamp to time that can be used directly in MDQuery expressions.
* @param timestamp
*/
export declare function timestampToMDDate(timestamp: number): string;
/**
* Describe a value in a range.
* @param key
* @param min
* @param max
*/
export declare function rangeMDQueryExpression(key: MDItemKey, min: number, max: number): string;
export type MDQCompareType = 'greaterThen' | 'lessThen' | 'equal' | 'greaterOrEqual' | 'lessOrEqual';
export type MDQueryUpdateListener = (type: MDQueryUpdateType, items: MDQueryItem[]) => void;
export declare class MDQueryRunner {
/**
* The actual executed MDQuery expression.
*/
public get expression(): string;
public run(options?: {
scopes: string[];
maxResultCount: number;
}): Promise<MDQueryItem[]>;
public stop(): void;
/**
* Listen for an MDQuery update event.
* @param listener
*/
public watch(listener: MDQueryUpdateListener): void;
public stopWatch(): void;
/**
* Add wildcards to the left and right of the query to match the file name. Not case sensitive.
* @param nameLike
*/
public nameLike(nameLike: string): MDQueryRunner;
/**
* Exactly match filename.
* @param name
*/
public nameIs(name: string): MDQueryRunner;
public time(timeKey: MDItemKey.CreationDate | MDItemKey.ModificationDate | MDItemKey.LastUsedDate, compareType: MDQCompareType, value: number): MDQueryRunner;
/**
* Limit file size in bytes.
* @param compareType
* @param value
*/
public size(compareType: MDQCompareType, value: number): MDQueryRunner;
public isDir(is: boolean): MDQueryRunner;
public isType(type: string): MDQueryRunner;
public inType(types: string[]): MDQueryRunner;
public contentTypeIs(type: string): MDQueryRunner;
public and(other: MDQueryRunner): MDQueryRunner;
public or(other: MDQueryRunner): MDQueryRunner;
public static merge(runners: MDQueryRunner[], isAnd: boolean): MDQueryRunner;
}