import { AnnotationModel, AnnotationsTypesImagesAssetLink, AnnotationsTypesImagesInstanceLink, IdEither } from '@cognite/sdk'; import { Matrix4, Texture } from 'three'; import { ClassicDataSourceType, DataSourceType, DMDataSourceType } from './DataSourceType'; import { DMInstanceRef } from '../../utilities'; import { ModelIdentifier } from './ModelIdentifier'; export interface JsonFileProvider { /** * Download and parse a JSON file and return the resulting struct. * @param baseUrl Base URL of the model. Pass empty string to treat fileName as a full signed URL. * @param fileName Filename of JSON file, or a full signed URL when baseUrl is empty. */ getJsonFile(baseUrl: string, fileName: string): Promise; } export interface BinaryFileProvider { /** * Downloads a binary blob. * @param baseUrl Base URL of the model. Pass empty string to treat fileName as a full signed URL. * @param fileName Filename of binary file, or a full signed URL when baseUrl is empty. * @param abortSignal Optional abort signal that can be used to cancel an in progress fetch. */ getBinaryFile(baseUrl: string, fileName: string, abortSignal?: AbortSignal): Promise; } export interface SignedFileProvider { /** * Retrieves signed URLs for files belonging to a model revision. * @param baseUrl Base URL of the signed files endpoint. * @param modelIdentifier Identifier of the model revision to fetch URLs for. * @param fileNameFilter Optional filename to filter results to a single file. */ getFileUrlsForModel?(baseUrl: string, modelIdentifier: ModelIdentifier, fileNameFilter?: string): Promise; } export type SignedFileItem = { signedUrl: string; fileName: string; subPath: string; }; export type SignedFilesResponseWithCursor = { items: SignedFileItem[]; nextCursor?: string; }; /** * An ID identifiying a single Image360 entity within a collection */ export type Image360Id = Image360RevisionId; /** * An ID identifiying a single Image360 revision within a collection */ export type Image360RevisionId = T extends DMDataSourceType ? DMInstanceRef : string; /** * Filter for finding linked annotations in either a classic 360 collection or a new one */ export type InstanceReference = T extends ClassicDataSourceType ? IdEither : DMInstanceRef; export interface Image360DescriptorProvider { get360ImageDescriptors(metadataFilter: T['image360Identifier'], preMultipliedRotation: boolean): Promise[]>; } export interface Image360FileProvider { get360ImageFiles(image360FaceDescriptors: Image360FileDescriptor[], abortSignal?: AbortSignal): Promise; getLowResolution360ImageFiles(image360FaceDescriptors: Image360FileDescriptor[], abortSignal?: AbortSignal): Promise; } /** * A CDF AnnotationModel with a narrower type representing an image asset link */ export type ImageAssetLinkAnnotationInfo = Omit & { /** * The data associated with the image asset link */ data: AnnotationsTypesImagesAssetLink; }; /** * A CDF AnnotationModel with a narrower type representing an image instance link */ export type ImageInstanceLinkAnnotationInfo = Omit & { /** * The data associated with the image instance link */ data: AnnotationsTypesImagesInstanceLink; }; export type Historical360ImageSet = Image360RevisionDescriptor & { imageRevisions: Image360Descriptor[]; }; export type Image360Descriptor = { id: Image360RevisionId; timestamp?: number | string; faceDescriptors: Image360FileDescriptor[]; }; export type Image360RevisionDescriptor = { id: Image360RevisionId; label: string | undefined; collectionId: string; collectionLabel: string | undefined; transform: Matrix4; }; export type FaceName = 'front' | 'back' | 'left' | 'right' | 'top' | 'bottom'; export type Image360Face = { face: FaceName; mimeType: 'image/jpeg' | 'image/png'; data: ArrayBuffer; /** Signed download URL for streaming. When present, data is empty. */ downloadUrl?: string; }; export type Image360Texture = { face: FaceName; texture: Texture; }; export type Image360FileDescriptor = { face: FaceName; mimeType: 'image/jpeg' | 'image/png'; /** Internal CDF file ID (numeric) */ fileId?: number; /** External file ID (string) - for system-space/FDM collections */ externalId?: string; /** DM instance reference - for CDM collections */ instanceId?: DMInstanceRef; }; export declare enum File3dFormat { EptPointCloud = "ept-pointcloud", /** * Reveal v9 and above (GLTF based output) */ GltfCadModel = "gltf-directory", /** * High-detail geometry for a prioritized subset of nodes. * Same GLTF structure as GltfCadModel but only contains * geometry for nodes specified in a PrioritizedNodes job. */ GltfPrioritizedNodes = "gltf-prioritized-nodes-directory", AnyFormat = "all-outputs" } export interface BlobOutputMetadata { blobId: number; format: File3dFormat | string; version: number; } type InstanceType = 'node' | 'edge'; export type Item = { instanceType: InstanceType; } & DMInstanceRef; export type Source = { type: 'view'; version: string; } & DMInstanceRef; export type EdgeItem = { startNode: DMInstanceRef; endNode: DMInstanceRef; }; export type Query = { with: Record; select: Record; parameters?: Record; cursors?: Record; }; type QuerySelect = { sources: readonly SourceProperties[]; }; type SourceProperties = { source: TestSource; properties: readonly string[]; }; type TestSource = { type: 'view'; space: string; externalId: string; version: string; }; export type ResultSetExpression = (NodeResultSetExpression | EdgeResultSetExpression) & { limit?: number; sort?: any[]; }; export type NodeResultSetExpression = { nodes: { filter?: any; from?: any; through?: any; chainTo?: any; direction?: 'outwards' | 'inwards'; }; }; export type EdgeResultSetExpression = { edges: { filter?: any; from?: any; nodeFilter?: any; maxDistance?: number; direction?: 'outwards' | 'inwards'; limitEach?: number; }; }; type SelectKey = keyof T['select']; type Sources> = T['select'][K]['sources'][0]; type MainSource> = Sources['source']; type MainSourceProperties> = Sources['properties']; type ResultExpressionProperties> = { [V in MainSource['space']]: { [Q in `${MainSource['externalId']}/${MainSource['version']}`]: { [B in MainSourceProperties[number]]: string | number | DMInstanceRef; }; }; }; type ResultExpression> = { instanceType: 'node'; version: number; space: string; externalId: string; createdTime: number; lastUpdatedTime: number; properties: ResultExpressionProperties; }; export type QueryNextCursors = { [K in SelectKey]?: string | undefined; }; export type QueryResult = { [K in SelectKey]: ResultExpression[]; } & { nextCursor?: QueryNextCursors; }; export {};