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 101 102 103 104 105 106 107 108 109 | 1x 1x 1x 1x 1x 6x 18x 18x 4x 18x 1x 18x | /**
* BUILT WITH O2.SERVICES AI HIVE
*
* This file was created by AI Hive - a dynamic swarm of AI agents that
* transform customer requirements into shipped products, handling every
* phase of the software engineering lifecycle.
*
* IMPORTANT: Keep this file focused and under 200 lines to ensure
* AI agents can effectively work with it.
*
* Learn more: https://o2.services
*/
/**
* Metadata entry for establishing relationships between content items
*/
export interface MetadataContent {
// Temporal information
timestamp: number; // Unix timestamp of creation
// Content references
references: ContentReference[];
// Authorship
authors: AuthorReference[];
// Version control
version: VersionInfo;
}
/**
* Reference to content with MIME type information
*/
export interface ContentReference {
hash: string; // CAS hash of referenced content
mimeType: string; // MIME type (e.g., 'text/plain', 'image/jpeg')
mimeTypeSource: 'detected' | 'manual'; // How mime type was determined
relationship?: string; // Optional relationship type (e.g., 'attachment', 'citation')
}
/**
* Reference to an author with their role
*/
export interface AuthorReference {
authorHash: string; // Hash reference to author entry
role: AuthorRole; // Author's role in this content
}
/**
* Possible roles for authors
*/
export enum AuthorRole {
CREATOR = 'creator', // Original creator
EDITOR = 'editor', // Made modifications
CONTRIBUTOR = 'contributor', // Minor contributions
REVIEWER = 'reviewer' // Reviewed content
}
/**
* Version control information
*/
export interface VersionInfo {
version: string; // Semantic version (e.g., '1.0.0')
previousVersion?: string; // Hash of previous metadata record
changeDescription?: string; // What changed in this version
}
/**
* Type guard to check if content is metadata
*/
export function isMetadataContent(content: any): content is MetadataContent {
return content
&& typeof content.timestamp === 'number'
&& Array.isArray(content.references)
&& Array.isArray(content.authors)
&& content.version
&& typeof content.version.version === 'string';
}
/**
* Helper to create a metadata content object
*/
export function createMetadataContent(params: {
references: ContentReference[];
authors: AuthorReference[];
previousVersion?: string;
changeDescription?: string;
version?: string;
}): MetadataContent {
const versionInfo: VersionInfo = {
version: params.version || '1.0.0'
};
if (params.previousVersion !== undefined) {
versionInfo.previousVersion = params.previousVersion;
}
if (params.changeDescription !== undefined) {
versionInfo.changeDescription = params.changeDescription;
}
return {
timestamp: Date.now(),
references: params.references,
authors: params.authors,
version: versionInfo
};
} |