All files / lib/resources resource-types.ts

100% Statements 101/101
100% Branches 0/0
100% Functions 0/0
100% Lines 101/101

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 99 100 1011x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x
/**
 * This file holds relevant information about the resources used by this application
 */
 
import {iCPSAppOptions} from "../../app/factory.js";
 
/**
 * File encoding for all text based files written by this application
 */
export const FILE_ENCODING = `utf8`;
 
/**
 * Filename for library lock file located in DATA_DIR
 */
export const LIBRARY_LOCK_FILE_NAME = `.library.lock`;
 
/**
 * Filename of the resource file
 */
export const RESOURCE_FILE_NAME = `.icloud-photos-sync`;
 
/**
 * The name of the log file
 */
export const LOG_FILE_NAME = `.icloud-photos-sync.log`;
 
/**
 * The name of the metrics file
 */
export const METRICS_FILE_NAME = `.icloud-photos-sync.metrics`;
 
/**
 * The name of the HAR file generated by the network capture
 */
export const HAR_FILE_NAME = `.icloud-photos-sync.har`;
 
/**
 * Resources held by the resource manager
 */
export type iCPSResources = ResourceFile
    & iCPSAppOptions
    & PhotosAccount
    & NetworkResources;
 
/**
 * Persistent information, stored in a resource file
 */
export type ResourceFile = {
    /**
     * The library version of the currently present library
     * @minimum 1
     * @default 1
     */
    libraryVersion: number,
    /**
     * The currently used trust token
     */
    trustToken?: string
}
 
/**
 * Non persistent network resources, required to access the iCloud API
 */
type NetworkResources = {
    /**
     * Session secret, either acquired on successful sign in, or after trusting the device
     */
    sessionSecret?: string,
}
 
/**
 * Information to interact with the iCloud Photos backend
 */
type PhotosAccount = {
    /**
     * The primary photos library zone
     */
    primaryZone?: PhotosAccountZone,
    /**
     * The shared photos library zone
     */
    sharedZone?: PhotosAccountZone
}
 
/**
 * Information about photos library zones
 */
export type PhotosAccountZone = {
    /**
     * The zone name, either PrimarySync or SharedSync-<UUID>
     */
    zoneName: string,
    /**
     * The zone type, usually REGULAR_CUSTOM_ZONE
     */
    zoneType: string,
    /**
     * The owner name, usually _<UUID>
     */
    ownerRecordName: string,
}