import { type Database, type FileSystem, type Record, type Factory, type Transform, type Logger } from '@servicenow/sdk-build-core'; /** * Relationship configuration for source artifact tables. * * Defines the hierarchy: M2M → Artifact → Attachment → Attachment Docs */ export declare const SOURCE_ARTIFACT_RELATIONSHIPS: { sn_glider_source_artifact_m2m: { via: string; descendant: boolean; relationships: { sn_glider_source_artifact: { via: string; inverse: boolean; descendant: boolean; relationships: { sys_attachment: { via: string; descendant: boolean; relationships: { sys_attachment_doc: { via: string; descendant: boolean; }; }; }; }; }; }; }; }; export declare function createArtifactRecord(artifactName: string, parentRecord: Record, factory: Factory): Promise; export declare function createArtifactM2mRecord(artifactRecord: Record, parentRecord: Record, factory: Factory): Promise; /** * Serializes a metadata record along with its embedded source artifacts to XML. * * Creates a custom XML format where source artifacts, attachments, M2M records, * and the parent metadata record are all embedded within a single XML file. * * The generated XML contains (in order): * 1. The metadata record fields (sys_id, sys_scope, sys_update_name, then metadataProps) * 2. M2M records (sn_glider_source_artifact_m2m) * 3. Artifact records (sn_glider_source_artifact) * 4. Attachment records (sys_attachment) * 5. Attachment doc records (sys_attachment_doc) * 6. delete_multiple cleanup elements * * @param metadataRecord - The main metadata record (e.g., sys_ui_page, sys_aix_experience) * @param metadataProps - List of property names to serialize from the metadata record * @param context - Serialization context (descendants, database, config, transform) */ export declare function serializeWithArtifact(metadataRecord: Record, metadataProps: string[], context: { database: Database; descendants: { query: (table: string) => Record[]; }; config: { scope: string; scopeId: string; }; transform: Transform; }): Promise<{ source: Record; name: string; category: import("@servicenow/sdk-build-core").InstallCategory; content: string; }>; export declare const MAX_FILE_SIZE: number; export declare const MAX_TOTAL_SIZE: number; /** * Reads files from disk and collects them for attachment storage. * * Error handling uses two distinct strategies: * - **Recoverable** (per-file): files that cannot be read or exceed the per-file size limit are * skipped and their paths are collected in the returned `skippedFiles` array. * - **Fatal** (aggregate): if adding a file would push the total over `MAX_TOTAL_SIZE`, an error * is thrown immediately. Since the file that triggers this is just whatever was read last (not * necessarily large itself), the error instead lists the largest files seen so far so users know * what to exclude via `.nowpackignore`. * * If the final total is at or above `TOTAL_SIZE_WARNING_RATIO` of `MAX_TOTAL_SIZE` (but did not * exceed it), a warning is logged once after all files are processed — naming the largest files * across the whole artifact — so users have advance notice before a future addition hits the hard * limit. * * When `useNowPackIgnore` is `true`, a `.nowpackignore` file in `rootDir` is honored like a * `.gitignore` to further filter out files before they are read. Files dropped by the filter are * logged at debug level (an expected, benign exclusion), whereas an entry the filter cannot even * evaluate is recorded in `skippedFiles` like any other recoverable failure. * * @returns Map of file paths to raw buffers, total size in bytes, and array of warning messages for skipped files * @throws {Error} if the cumulative size of valid files would exceed `MAX_TOTAL_SIZE` */ export declare function getAttachmentContent(fs: FileSystem, rootDir: string, files: string[], useNowPackIgnore?: boolean, logger?: Logger): Promise<{ files: Map; totalSize: number; skippedFiles: string[]; }>; /** * Creates attachment and attachment_doc records for the artifact. * * Attachments are compressed using zip and chunked for storage. The attachment ID includes * a hash prefix to ensure immutability (each content version gets a unique ID). */ export declare function createAttachmentRecords(factory: Factory, artifactRecord: Record, files: Map, totalSize: number): Promise;