@kitschpatrol/aphex 0.1.6 → 0.3.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/dist/aphex-swift +0 -0
- package/dist/assets/applescript-gui.applescript +293 -179
- package/dist/index.d.ts +336 -23
- package/dist/index.js +428 -161
- package/package.json +17 -15
- package/readme.md +101 -29
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { ExifTool } from "exiftool-vendored";
|
|
2
|
-
import { ILogBasic, ILogLayer } from "lognow";
|
|
3
1
|
import { OmitDeep, PartialDeep, Simplify } from "type-fest";
|
|
2
|
+
import "exiftool-vendored";
|
|
3
|
+
import { ILogBasic, ILogLayer } from "lognow";
|
|
4
4
|
/**
|
|
5
5
|
* Start an interactive session with aphex-swift. Commands will be sent to this
|
|
6
6
|
* persistent process instead of spawning new ones.
|
|
7
7
|
*
|
|
8
|
+
* If the process ends on its own after it has answered a command, or to get rid
|
|
9
|
+
* of a render that timed out, another one takes its place and carries on with
|
|
10
|
+
* the commands that were waiting.
|
|
11
|
+
*
|
|
8
12
|
* @throws {Error} If the session is already active or fails to start
|
|
9
13
|
*/
|
|
10
14
|
export declare function interactiveSessionStart(): Promise<void>;
|
|
@@ -13,58 +17,182 @@ export declare function interactiveSessionStart(): Promise<void>;
|
|
|
13
17
|
*/
|
|
14
18
|
export declare function interactiveSessionStop(): Promise<void>;
|
|
15
19
|
/**
|
|
16
|
-
*
|
|
20
|
+
* One of the image files Photos.app keeps for a photo, as reported by
|
|
21
|
+
* aphex-swift.
|
|
17
22
|
*/
|
|
18
23
|
type ResourceInfo = {
|
|
24
|
+
/**
|
|
25
|
+
* Uniform type identifier, like `public.jpeg`.
|
|
26
|
+
*/
|
|
19
27
|
contentType: string;
|
|
28
|
+
/**
|
|
29
|
+
* The name the file had when it was imported. Edited files are always called
|
|
30
|
+
* something like `FullSizeRender.jpg`.
|
|
31
|
+
*/
|
|
20
32
|
fileName: string;
|
|
33
|
+
/**
|
|
34
|
+
* Absolute path of the file inside the Photos.app library.
|
|
35
|
+
*/
|
|
21
36
|
filePath: string;
|
|
37
|
+
/**
|
|
38
|
+
* In bytes.
|
|
39
|
+
*/
|
|
22
40
|
fileSize: number;
|
|
41
|
+
/**
|
|
42
|
+
* In pixels.
|
|
43
|
+
*/
|
|
23
44
|
height: number;
|
|
45
|
+
/**
|
|
46
|
+
* In pixels.
|
|
47
|
+
*/
|
|
24
48
|
width: number;
|
|
25
49
|
};
|
|
26
50
|
/**
|
|
27
|
-
*
|
|
28
|
-
* iOS Photos framework (CodablePHAsset)
|
|
51
|
+
* A photo in the Photos.app library, as reported by aphex-swift.
|
|
29
52
|
*/
|
|
30
53
|
type PhotoInfo = {
|
|
54
|
+
/**
|
|
55
|
+
* When the photo was taken.
|
|
56
|
+
*/
|
|
31
57
|
dateCreated: Date;
|
|
58
|
+
/**
|
|
59
|
+
* The most recent modification time of the photo's files in the library, not
|
|
60
|
+
* the modification date Photos.app shows.
|
|
61
|
+
*/
|
|
32
62
|
dateModified: Date;
|
|
63
|
+
/**
|
|
64
|
+
* The edited image Photos.app stored when the photo was last edited, a
|
|
65
|
+
* compressed JPEG or HEIC. Only present if the photo has edits.
|
|
66
|
+
*/
|
|
33
67
|
edited?: ResourceInfo;
|
|
34
68
|
favorite: boolean;
|
|
35
69
|
hidden: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* The image as it was imported.
|
|
72
|
+
*/
|
|
36
73
|
original: ResourceInfo;
|
|
74
|
+
/**
|
|
75
|
+
* Only present if a title has been set in Photos.app.
|
|
76
|
+
*/
|
|
37
77
|
title?: string;
|
|
78
|
+
/**
|
|
79
|
+
* The photo's local identifier. It is unique to this copy of the library, so
|
|
80
|
+
* the same photo has a different one on another Mac.
|
|
81
|
+
*/
|
|
38
82
|
uuid: string;
|
|
39
83
|
};
|
|
84
|
+
/**
|
|
85
|
+
* An album in the Photos.app library, as reported by aphex-swift.
|
|
86
|
+
*/
|
|
40
87
|
type AlbumInfo = {
|
|
88
|
+
/**
|
|
89
|
+
* When the newest photo in the album was taken, if Photos.app knows.
|
|
90
|
+
*/
|
|
41
91
|
dateEnd?: Date;
|
|
92
|
+
/**
|
|
93
|
+
* When the oldest photo in the album was taken, if Photos.app knows.
|
|
94
|
+
*/
|
|
42
95
|
dateStart?: Date;
|
|
96
|
+
/**
|
|
97
|
+
* PhotoKit's estimate, which is not guaranteed to be exact.
|
|
98
|
+
*/
|
|
43
99
|
estimatedAssetCount: number;
|
|
100
|
+
/**
|
|
101
|
+
* The album's place in the folder hierarchy, like `/Folder/Album`.
|
|
102
|
+
*/
|
|
44
103
|
path: string;
|
|
104
|
+
/**
|
|
105
|
+
* Raw value of PhotoKit's `PHAssetCollectionSubtype`.
|
|
106
|
+
*/
|
|
45
107
|
subtype: number;
|
|
46
108
|
title: string;
|
|
109
|
+
/**
|
|
110
|
+
* Raw value of PhotoKit's `PHAssetCollectionType`.
|
|
111
|
+
*/
|
|
47
112
|
type: number;
|
|
113
|
+
/**
|
|
114
|
+
* The album's local identifier, unique to this copy of the library.
|
|
115
|
+
*/
|
|
48
116
|
uuid: string;
|
|
49
117
|
};
|
|
50
118
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
119
|
+
* Look up photos in the Photos.app library.
|
|
120
|
+
*
|
|
121
|
+
* @param identifiers Photo UUIDs, paths like `Album/Title` or
|
|
122
|
+
* `Album/IMG_1234.jpeg`, or album UUIDs and paths, which stand for every
|
|
123
|
+
* photo in the album.
|
|
124
|
+
* @param caseSensitive Whether titles, file names, and album paths have to
|
|
125
|
+
* match exactly.
|
|
53
126
|
*
|
|
54
|
-
* @
|
|
127
|
+
* @returns One entry per photo found. Empty if no identifiers are passed.
|
|
128
|
+
* @throws {Error} If nothing matches, or the command fails.
|
|
55
129
|
*/
|
|
56
130
|
declare function aphexPhotoInfo(identifiers: string | string[], caseSensitive?: boolean): Promise<PhotoInfo[]>;
|
|
57
131
|
/**
|
|
58
|
-
*
|
|
132
|
+
* Look up albums in the Photos.app library.
|
|
133
|
+
*
|
|
134
|
+
* @param identifiers Album UUIDs, or paths like `Album` or `Folder/Album`.
|
|
135
|
+
* @param caseSensitive Whether album paths have to match exactly.
|
|
59
136
|
*
|
|
60
|
-
* @
|
|
137
|
+
* @returns One entry per album found. Empty if no identifiers are passed.
|
|
138
|
+
* @throws {Error} If nothing matches, or the command fails.
|
|
61
139
|
*/
|
|
62
140
|
declare function aphexAlbumInfo(identifiers: string | string[], caseSensitive?: boolean): Promise<AlbumInfo[]>;
|
|
141
|
+
/**
|
|
142
|
+
* Options for re-rendering a photo with its edits at full quality, the way File
|
|
143
|
+
* → Export does in Photos.app. Mirrors the `aphex export --format` flags.
|
|
144
|
+
*/
|
|
145
|
+
type AphexRenderOptions = {
|
|
146
|
+
/**
|
|
147
|
+
* Flatten the transparency of photos that have any onto this sRGB color
|
|
148
|
+
* instead of white, as six hexadecimal digits like `ff8800`. Can't be
|
|
149
|
+
* combined with `preserveAlpha`.
|
|
150
|
+
*/
|
|
151
|
+
background?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Bits per channel. Only applies to `tiff`.
|
|
154
|
+
*/
|
|
155
|
+
bitDepth?: 8 | 16;
|
|
156
|
+
/**
|
|
157
|
+
* `original` keeps the color space the edit renders in. `most-compatible` is
|
|
158
|
+
* Display P3 tagged with Apple's backwards compatible sharing profile.
|
|
159
|
+
*/
|
|
160
|
+
colorProfile?: 'adobe-rgb' | 'display-p3' | 'most-compatible' | 'original' | 'srgb';
|
|
161
|
+
/**
|
|
162
|
+
* File format to render to. PNG and TIFF are lossless.
|
|
163
|
+
*/
|
|
164
|
+
format: 'heic' | 'jpeg' | 'png' | 'tiff';
|
|
165
|
+
/**
|
|
166
|
+
* Keep location metadata in the file.
|
|
167
|
+
*/
|
|
168
|
+
includeLocation?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Write the title, caption, and keywords from the library into the file.
|
|
171
|
+
*/
|
|
172
|
+
includeMetadata?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Scale down to fit this height in pixels. Never scales up.
|
|
175
|
+
*/
|
|
176
|
+
maxHeight?: number;
|
|
177
|
+
/**
|
|
178
|
+
* Scale down to fit this width in pixels. Never scales up.
|
|
179
|
+
*/
|
|
180
|
+
maxWidth?: number;
|
|
181
|
+
/**
|
|
182
|
+
* Keep the transparency of photos that have any, where Photos.app flattens it
|
|
183
|
+
* onto white. Only applies to `png` and `tiff`.
|
|
184
|
+
*/
|
|
185
|
+
preserveAlpha?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* JPEG quality from 0 to 1. Only applies to `jpeg`.
|
|
188
|
+
*/
|
|
189
|
+
quality?: number;
|
|
190
|
+
};
|
|
63
191
|
export declare const IMAGE_MIME_TYPES: readonly ["arw", "avif", "bmp", "cr2", "cr3", "crw", "tga", "dng", "gif", "heic", "heif", "jpeg", "nef", "pef", "png", "psd", "svg+xml", "tiff", "webp"];
|
|
64
192
|
type ImageMimeType = (typeof IMAGE_MIME_TYPES)[number];
|
|
65
193
|
/**
|
|
66
|
-
* Mirrors the export
|
|
67
|
-
* others.
|
|
194
|
+
* Mirrors the export sheet in Photos.app. Note that some options are contingent
|
|
195
|
+
* on others.
|
|
68
196
|
*
|
|
69
197
|
* The AppleScript implementation is smart about only "clicking" the necessary
|
|
70
198
|
* options in the GUI.
|
|
@@ -115,26 +243,103 @@ type ExportViaAppleScriptGuiOptions = {
|
|
|
115
243
|
*/
|
|
116
244
|
tiffBitDepth: 8 | 16;
|
|
117
245
|
};
|
|
118
|
-
|
|
246
|
+
/**
|
|
247
|
+
* Options for the `swift-render` engine. These cover the same ground as the
|
|
248
|
+
* Photos.app export sheet, see `ExportViaAppleScriptGuiOptions`.
|
|
249
|
+
*/
|
|
250
|
+
type ExportViaSwiftRenderOptions = Required<Omit<AphexRenderOptions, 'background' | 'maxHeight' | 'maxWidth'>> & {
|
|
251
|
+
/**
|
|
252
|
+
* Flatten the transparency of photos that have any onto this sRGB color, as
|
|
253
|
+
* six hexadecimal digits like `ff8800`. `undefined` flattens onto white, like
|
|
254
|
+
* Photos.app, unless `preserveAlpha` is set.
|
|
255
|
+
*/
|
|
256
|
+
background: string | undefined;
|
|
257
|
+
/**
|
|
258
|
+
* Scale down to fit this height in pixels. `undefined` leaves the height
|
|
259
|
+
* unconstrained.
|
|
260
|
+
*/
|
|
261
|
+
maxHeight: number | undefined;
|
|
262
|
+
/**
|
|
263
|
+
* Scale down to fit this width in pixels. `undefined` leaves the width
|
|
264
|
+
* unconstrained.
|
|
265
|
+
*/
|
|
266
|
+
maxWidth: number | undefined;
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* A way of getting an image file out of the Photos.app library.
|
|
270
|
+
*
|
|
271
|
+
* - `swift-render` renders the original image and its edits again, with the
|
|
272
|
+
* private frameworks Photos.app uses. Same result as File → Export.
|
|
273
|
+
* - `photos-gui` drives the Photos.app export sheet through AppleScript GUI
|
|
274
|
+
* automation. Same result, but slow, and it takes over the screen.
|
|
275
|
+
* - `swift-photokit` asks PhotoKit for the image stored in the library: the
|
|
276
|
+
* untouched original, or for an edited photo, a compressed JPEG or HEIC.
|
|
277
|
+
* - `file-system` copies that same stored image straight out of the library
|
|
278
|
+
* folder.
|
|
279
|
+
* - `applescript` uses the `export` command of the Photos.app AppleScript
|
|
280
|
+
* dictionary, which gives a JPEG.
|
|
281
|
+
*/
|
|
282
|
+
type ExportEngine = 'applescript' | 'file-system' | 'photos-gui' | 'swift-photokit' | 'swift-render';
|
|
283
|
+
/**
|
|
284
|
+
* Either one engine for every photo, or a map from image format to engine. With
|
|
285
|
+
* a map, a photo in a format that has no entry fails to export.
|
|
286
|
+
*/
|
|
119
287
|
type ExportEngineOptions = ExportEngine | Partial<Record<ImageMimeType, ExportEngine>>;
|
|
120
288
|
type ExportApplePhotoOptions = {
|
|
289
|
+
/**
|
|
290
|
+
* Options for the `photos-gui` engine, named after the controls of the
|
|
291
|
+
* Photos.app export sheet.
|
|
292
|
+
*/
|
|
121
293
|
appleScriptGuiOptions: ExportViaAppleScriptGuiOptions;
|
|
294
|
+
/**
|
|
295
|
+
* Engine for photos that have been edited in Photos.app. A map is keyed by
|
|
296
|
+
* the format of the edited image stored in the library.
|
|
297
|
+
*/
|
|
122
298
|
engineEdited: ExportEngineOptions;
|
|
299
|
+
/**
|
|
300
|
+
* Engine for edited photos whose original has transparency.
|
|
301
|
+
*/
|
|
123
302
|
engineEditedAlpha: ExportEngineOptions;
|
|
303
|
+
/**
|
|
304
|
+
* Engine for photos without edits. A map is keyed by the format of the
|
|
305
|
+
* original.
|
|
306
|
+
*/
|
|
124
307
|
engineOriginal: ExportEngineOptions;
|
|
308
|
+
/**
|
|
309
|
+
* Engine for photos without edits that have transparency.
|
|
310
|
+
*/
|
|
125
311
|
engineOriginalAlpha: ExportEngineOptions;
|
|
126
312
|
/**
|
|
127
|
-
* Append
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* content hash.
|
|
313
|
+
* Append the last eight characters of the photo's UUID to file names taken
|
|
314
|
+
* from its title or original file name, to keep photos that share a name
|
|
315
|
+
* apart. Turned on automatically when two photos in one export would collide.
|
|
316
|
+
* This is NOT the same as a content hash.
|
|
131
317
|
*/
|
|
132
318
|
fileNameAppendUuidFragment: boolean;
|
|
319
|
+
/**
|
|
320
|
+
* Lowercase file extensions, and spell them `.jpeg` and `.tiff`.
|
|
321
|
+
*/
|
|
133
322
|
fileNameNormalizeExtensions: boolean;
|
|
323
|
+
/**
|
|
324
|
+
* What to name exported files after, in order of preference: the photo's
|
|
325
|
+
* `title`, the original `fileName` without its extension, or the `uuid`. The
|
|
326
|
+
* first one the photo has is used.
|
|
327
|
+
*/
|
|
134
328
|
fileNamePrecedence: FileNameOptions[];
|
|
329
|
+
/**
|
|
330
|
+
* Turn file names into lowercase, URL-friendly slugs.
|
|
331
|
+
*/
|
|
135
332
|
fileNameSluggify: boolean;
|
|
333
|
+
/**
|
|
334
|
+
* Options for the `swift-render` engine, which re-renders photos and their
|
|
335
|
+
* edits at full quality without automating the Photos.app GUI.
|
|
336
|
+
*/
|
|
337
|
+
swiftRenderOptions: ExportViaSwiftRenderOptions;
|
|
136
338
|
};
|
|
137
339
|
type ExportApplePhotoResult = {
|
|
340
|
+
/**
|
|
341
|
+
* The engine the options picked for the photo, which produced the file.
|
|
342
|
+
*/
|
|
138
343
|
exportEngine: ExportEngine;
|
|
139
344
|
exportOptions: ExportApplePhotoOptions;
|
|
140
345
|
path: string;
|
|
@@ -147,7 +352,16 @@ type ValidateTagsResult = {
|
|
|
147
352
|
issues: string[];
|
|
148
353
|
valid: boolean;
|
|
149
354
|
};
|
|
355
|
+
/**
|
|
356
|
+
* What Aphex records in an exported file, so that a later sync can tell whether
|
|
357
|
+
* the file is still up to date
|
|
358
|
+
*/
|
|
150
359
|
type AphexMetadata = {
|
|
360
|
+
/**
|
|
361
|
+
* The engine that produced the file. Absent in files from older versions of
|
|
362
|
+
* Aphex.
|
|
363
|
+
*/
|
|
364
|
+
exportEngine?: ExportEngine;
|
|
151
365
|
exportOptions: ExportOptions;
|
|
152
366
|
photoInfo: PhotoInfo;
|
|
153
367
|
};
|
|
@@ -167,10 +381,29 @@ type ImageTags = {
|
|
|
167
381
|
preservedFileName?: string | undefined;
|
|
168
382
|
};
|
|
169
383
|
type ManageMetadataOptions = {
|
|
384
|
+
/**
|
|
385
|
+
* Copy `tagsToSync` from a photo's original file onto the edited image
|
|
386
|
+
* Photos.app stores for it. Note that this writes to a file inside the
|
|
387
|
+
* Photos.app library.
|
|
388
|
+
*/
|
|
170
389
|
syncToEdited: boolean;
|
|
390
|
+
/**
|
|
391
|
+
* Copy `tagsToSync` from a photo's original file to the exported file.
|
|
392
|
+
*/
|
|
171
393
|
syncToTarget: boolean;
|
|
394
|
+
/**
|
|
395
|
+
* The XMP tags to copy.
|
|
396
|
+
*/
|
|
172
397
|
tagsToSync: Array<keyof ImageTags>;
|
|
398
|
+
/**
|
|
399
|
+
* Check that the exported file has the expected tags, and log a warning for
|
|
400
|
+
* any that are missing.
|
|
401
|
+
*/
|
|
173
402
|
validate: boolean;
|
|
403
|
+
/**
|
|
404
|
+
* Record the photo's library information and the export options in the
|
|
405
|
+
* exported file. Sync relies on this to recognize files that are up to date.
|
|
406
|
+
*/
|
|
174
407
|
writeAphexMetadata: boolean;
|
|
175
408
|
};
|
|
176
409
|
type ManageMetadataResult = {
|
|
@@ -311,9 +544,31 @@ type ProcessImageResult = {
|
|
|
311
544
|
export declare function processImage(sourceImagePath: string, destinationDirectory: string, options: ProcessImageOptions): Promise<ProcessImageResult>;
|
|
312
545
|
type DiffStrategy = 'exif-tags' | 'export-options' | 'file-name' | 'force-update' | 'metadata-options' | 'photo-info' | 'process-options';
|
|
313
546
|
type SyncOptions = {
|
|
547
|
+
/**
|
|
548
|
+
* Delete every file in the destination directory that isn't the export of one
|
|
549
|
+
* of the photos being exported.
|
|
550
|
+
*/
|
|
314
551
|
deleteOthers: boolean;
|
|
552
|
+
/**
|
|
553
|
+
* Delete a photo's existing export when it is out of date, once it has been
|
|
554
|
+
* exported again. A new export of the same name replaces the old one either
|
|
555
|
+
* way.
|
|
556
|
+
*/
|
|
315
557
|
deleteTarget: boolean;
|
|
558
|
+
/**
|
|
559
|
+
* The checks that decide whether a photo's existing export is out of date,
|
|
560
|
+
* tried in order until one finds a difference:
|
|
561
|
+
*
|
|
562
|
+
* - `file-name`: the name the export would get has changed
|
|
563
|
+
* - `photo-info`: the photo changed in the library, for example by an edit
|
|
564
|
+
* - `export-options`, `process-options`, `metadata-options`: that group of
|
|
565
|
+
* options differs from the ones the export was made with
|
|
566
|
+
* - `exif-tags`: the synced tags differ between the original and the export
|
|
567
|
+
*/
|
|
316
568
|
diffStrategies: DiffStrategy[];
|
|
569
|
+
/**
|
|
570
|
+
* Treat every existing export as out of date.
|
|
571
|
+
*/
|
|
317
572
|
forceUpdate: boolean;
|
|
318
573
|
};
|
|
319
574
|
type SyncResult = {
|
|
@@ -329,7 +584,8 @@ type SyncResult = {
|
|
|
329
584
|
* End the exiftool process gracefully
|
|
330
585
|
*
|
|
331
586
|
* This should be called when you're done using exiftool to prevent hanging
|
|
332
|
-
* processes. It's safe to call multiple times
|
|
587
|
+
* processes. It's safe to call multiple times, and exiftool starts again the
|
|
588
|
+
* next time it's needed.
|
|
333
589
|
*/
|
|
334
590
|
export declare function endExiftool(): Promise<void>;
|
|
335
591
|
/**
|
|
@@ -341,37 +597,94 @@ export declare function endExiftool(): Promise<void>;
|
|
|
341
597
|
*/
|
|
342
598
|
export declare function setLogger(logger?: ILogBasic | ILogLayer<unknown>): void;
|
|
343
599
|
/**
|
|
344
|
-
*
|
|
345
|
-
* Exported for unplugin-aphex.
|
|
600
|
+
* Fill in everything a partial `ExportOptions` object leaves out with the
|
|
601
|
+
* library defaults. Exported for unplugin-aphex.
|
|
346
602
|
*/
|
|
347
603
|
export declare function mergeDefaultExportOptions(options: PartialDeep<ExportOptions> | undefined): ExportOptions;
|
|
604
|
+
/**
|
|
605
|
+
* Everything that controls an export, one group of options per stage. Every
|
|
606
|
+
* stage but the export itself can be skipped by passing `'disabled'`.
|
|
607
|
+
*/
|
|
348
608
|
export type ExportOptions = {
|
|
609
|
+
/**
|
|
610
|
+
* How photos are read out of the Photos.app library, and how the exported
|
|
611
|
+
* files are named.
|
|
612
|
+
*/
|
|
349
613
|
exportOptions: ExportApplePhotoOptions;
|
|
614
|
+
/**
|
|
615
|
+
* Which metadata is carried over to the exported files, and whether it is
|
|
616
|
+
* validated.
|
|
617
|
+
*/
|
|
350
618
|
metadataOptions: 'disabled' | ManageMetadataOptions;
|
|
619
|
+
/**
|
|
620
|
+
* Resizing, compression, and color profile normalization of the exported
|
|
621
|
+
* files.
|
|
622
|
+
*/
|
|
351
623
|
processOptions: 'disabled' | ProcessImageOptions;
|
|
624
|
+
/**
|
|
625
|
+
* Skipping photos whose exported file is already up to date, and deleting
|
|
626
|
+
* files that are out of date.
|
|
627
|
+
*/
|
|
352
628
|
syncOptions: 'disabled' | SyncOptions;
|
|
353
629
|
};
|
|
354
630
|
export declare const defaultSyncOptions: SyncOptions;
|
|
355
631
|
export declare const defaultExportOptions: ExportOptions;
|
|
356
|
-
/**
|
|
632
|
+
/**
|
|
633
|
+
* What each stage did for one photo. A stage that was disabled, or skipped
|
|
634
|
+
* because the photo was already up to date, is `undefined`. Fields that
|
|
635
|
+
* `ExportResult` already carries are left out.
|
|
636
|
+
*/
|
|
357
637
|
type ExportResults = {
|
|
358
638
|
exportResult: Simplify<Omit<ExportApplePhotoResult, 'exportOptions' | 'path' | 'photoInfo'>> | undefined;
|
|
359
639
|
metadataResult: Simplify<Omit<ManageMetadataResult, 'photoInfo'>> | undefined;
|
|
360
640
|
processResult: Simplify<OmitDeep<ProcessImageResult, 'input.path' | 'output.path' | 'path'>> | undefined;
|
|
361
641
|
syncResult: Simplify<Omit<SyncResult['plan'][number], 'photoInfo'>> | undefined;
|
|
362
642
|
};
|
|
643
|
+
/**
|
|
644
|
+
* The outcome of exporting one photo.
|
|
645
|
+
*/
|
|
363
646
|
export type ExportResult = {
|
|
647
|
+
/**
|
|
648
|
+
* The options the export ran with, defaults included.
|
|
649
|
+
*/
|
|
364
650
|
options: ExportOptions;
|
|
651
|
+
/**
|
|
652
|
+
* Where the exported file is. For a photo that was already up to date, this
|
|
653
|
+
* is the existing file.
|
|
654
|
+
*/
|
|
365
655
|
path: string;
|
|
366
656
|
photoInfo: PhotoInfo;
|
|
367
657
|
results: ExportResults;
|
|
368
658
|
};
|
|
369
659
|
/**
|
|
370
|
-
* Export a single photo
|
|
660
|
+
* Export a single photo from the Photos.app library to a directory.
|
|
661
|
+
*
|
|
662
|
+
* @param identifier A photo's UUID, a path like `Album/Title` or
|
|
663
|
+
* `Folder/Album/IMG_1234.jpeg`, or a `PhotoInfo` from `getPhotoInfo`.
|
|
664
|
+
* @param destinationDirectory Created if it doesn't exist. A leading `~` is
|
|
665
|
+
* expanded.
|
|
666
|
+
* @param options Anything left out falls back to the library defaults.
|
|
667
|
+
* @throws {Error} If the identifier matches no photo, or more than one.
|
|
371
668
|
*/
|
|
372
669
|
export declare function exportPhoto(identifier: PhotoInfo | string, destinationDirectory: string, options?: PartialDeep<ExportOptions>): Promise<ExportResult>;
|
|
373
670
|
/**
|
|
374
|
-
* Export photos
|
|
671
|
+
* Export any number of photos and albums from the Photos.app library to a
|
|
672
|
+
* directory.
|
|
673
|
+
*
|
|
674
|
+
* Each photo goes through the stages that are enabled in `options`: checking
|
|
675
|
+
* whether an up-to-date export already exists, exporting from Photos.app,
|
|
676
|
+
* processing, and writing metadata.
|
|
677
|
+
*
|
|
678
|
+
* @param identifiers Any mix of photo and album identifiers: UUIDs, paths like
|
|
679
|
+
* `Album/Title` or `Folder/Album`, and `PhotoInfo` or `AlbumInfo` objects. An
|
|
680
|
+
* album stands for every photo in it.
|
|
681
|
+
* @param destinationDirectory Created if it doesn't exist. A leading `~` is
|
|
682
|
+
* expanded.
|
|
683
|
+
* @param options Anything left out falls back to the library defaults.
|
|
684
|
+
*
|
|
685
|
+
* @returns One result per photo, in a flat list. A photo that is identified
|
|
686
|
+
* more than once is exported once.
|
|
687
|
+
* @throws {Error} If the identifiers match no photos.
|
|
375
688
|
*/
|
|
376
689
|
export declare function exportPhotos(identifiers: Array<AlbumInfo | PhotoInfo | string>, destinationDirectory: string, options?: PartialDeep<ExportOptions>): Promise<ExportResult[]>;
|
|
377
690
|
export { type ImageMimeType, aphexAlbumInfo as getAlbumInfo, aphexPhotoInfo as getPhotoInfo };
|