@gatekeeper_technology/report-utils
Version:
Gatekeeper's pdf/email Utils - shared in NPM
35 lines • 2.24 kB
TypeScript
import { Attachment } from "@journeyapps/db";
export { getImageContentForPDF, loadImageBase64, loadAttachments, loadPhotoOrSignature, isAttachmentsUploaded, isAttachmentUploaded, };
/**
* This function serves as the central utility in photo_attachment_utils.
* It takes a Journey Attachment (or an image path) as input and provides either the base64 data (if in-app or the path is given),
* or the URL (if the function is called from Cloud code and a JA Attachment is provided).
* If the attachment is still being uploaded, the Cloud code task is rescheduled.
*/
declare function getImageContentForPDF(image: string | Attachment, type?: "base64" | "url"): Promise<string | null>;
/**
* This function is used to read an images from a local directory (not a journeyapps)
*/
declare function loadImageBase64(path: string): string | null;
/**
* This function takes all the signatures and photos of an object and checks if they are uploaded. If uploaded, then it modifies the target object
* If a attachment is not done uploading, the calling task is rescheduled
* NOTE: Use the ID of the object received in the params to refresh the object.
* Otherwise an object is returned containing all the signatures and photos from the original object
* @param {Record<string, any>} target The target hash where image data will be stored
* @param {Record<string, any>} object_to_check The object to check whether attachments are uploaded
*/
declare function loadAttachments(target: Record<string, any>, object_to_check: Record<string, any>): Promise<Record<string, any>>;
/**
* This function checks if the signature or photo was indeed taken
* and then assigns the boolean to a value. And then assigns the actual image to
* different variable
* @param {Object} object The object containing the current image.
* @param {String} field_name The field that is being checked.
*/
declare function loadPhotoOrSignature(object: Record<string, any>, field_name: string): Promise<{
[x: string]: string | boolean | null;
}>;
declare function isAttachmentsUploaded(object_to_check: Record<string, any>): boolean;
declare function isAttachmentUploaded(object: any, field_name: string): boolean;
//# sourceMappingURL=photo_attachment_utils.d.ts.map