@cognite/reveal 4.29.1 → 4.29.2-dev.20260211

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,10 +32,13 @@ export declare class DefaultImage360Collection<T extends DataSourceType> impleme
32
32
  private readonly _events;
33
33
  private readonly _icons;
34
34
  private _isCollectionVisible;
35
- private readonly _collectionId;
35
+ private readonly _sourceId;
36
36
  private readonly _collectionLabel;
37
37
  private readonly _setNeedsRedraw;
38
- get collectionId(): T['image360Identifier'];
38
+ /**
39
+ * returns the source ID of the collection
40
+ */
41
+ get sourceId(): T['image360Identifier'];
39
42
  /**
40
43
  * @deprecated
41
44
  */
@@ -81,7 +81,8 @@ export type Image360AnnotationAssetQueryResult<T extends DataSourceType = Classi
81
81
  export interface Image360Collection<T extends DataSourceType = ClassicDataSourceType> {
82
82
  /**
83
83
  * The id of the collection.
84
- * @returns The id of the collection.
84
+ * @returns The id of the collection
85
+ * @deprecated Use `sourceId` instead
85
86
  */
86
87
  readonly id: string;
87
88
  /**
@@ -89,6 +90,10 @@ export interface Image360Collection<T extends DataSourceType = ClassicDataSource
89
90
  * @returns The label of the collection.
90
91
  */
91
92
  readonly label: string | undefined;
93
+ /**
94
+ * The source identifier of the collection.
95
+ */
96
+ readonly sourceId: T['image360Identifier'];
92
97
  /**
93
98
  * A list containing all the 360 images in this set.
94
99
  */
@@ -1,10 +1,14 @@
1
1
  import { Image360Face, Image360FileDescriptor, Image360FileProvider } from '../types';
2
- import { CogniteClient, InternalId } from '@cognite/sdk';
2
+ import { FileIdentifier, FileDownloadResult } from './CdfImageFileProvider';
3
+ import { CogniteClient } from '@cognite/sdk';
3
4
  export declare class Cdf360ImageFileProvider implements Image360FileProvider {
4
5
  private readonly _imageFileProvider;
5
6
  constructor(client: CogniteClient);
6
7
  get360ImageFiles(image360FaceDescriptors: Image360FileDescriptor[], abortSignal?: AbortSignal): Promise<Image360Face[]>;
7
8
  getLowResolution360ImageFiles(image360FaceDescriptors: Image360FileDescriptor[], abortSignal?: AbortSignal): Promise<Image360Face[]>;
8
9
  }
9
- export declare function getFileIds(image360FaceDescriptors: Image360FileDescriptor[]): InternalId[];
10
- export declare function createFacesFromDescriptorsAndBuffers(image360FaceDescriptors: Image360FileDescriptor[], fileBuffer: ArrayBuffer[]): Image360Face[];
10
+ /**
11
+ * Extracts file identifiers from face descriptors.
12
+ */
13
+ export declare function getFileIdentifiers(image360FaceDescriptors: Image360FileDescriptor[]): FileIdentifier[];
14
+ export declare function createFacesFromDescriptorsAndDownloads(image360FaceDescriptors: Image360FileDescriptor[], downloadResults: FileDownloadResult[]): Image360Face[];
@@ -2,14 +2,42 @@
2
2
  * Copyright 2025 Cognite AS
3
3
  */
4
4
  import { CogniteClient } from '@cognite/sdk';
5
+ import { DMInstanceRef } from '../../../utilities';
6
+ /**
7
+ * File identifier types supported by CDF's /files/downloadlink endpoint.
8
+ */
9
+ export type FileIdentifier = {
10
+ id: number;
11
+ } | {
12
+ externalId: string;
13
+ } | {
14
+ instanceId: DMInstanceRef;
15
+ };
16
+ /**
17
+ * Result of downloading a file, including both the data and the mimeType
18
+ * extracted from the Content-Type response header.
19
+ */
20
+ export type FileDownloadResult = {
21
+ data: ArrayBuffer;
22
+ mimeType: 'image/jpeg' | 'image/png';
23
+ };
5
24
  export declare class CdfImageFileProvider {
6
25
  private readonly _client;
7
26
  constructor(sdk: CogniteClient);
8
- getFileBuffers(fileIds: {
9
- id: number;
10
- }[], abortSignal?: AbortSignal): Promise<ArrayBuffer[]>;
11
- getIconBuffers(fileIds: {
12
- id: number;
13
- }[], abortSignal?: AbortSignal): Promise<ArrayBuffer[]>;
27
+ /**
28
+ * Downloads files and returns both the data and mimeType (from Content-Type header).
29
+ */
30
+ getFileBuffersWithMimeType(fileIdentifiers: FileIdentifier[], abortSignal?: AbortSignal): Promise<FileDownloadResult[]>;
31
+ getFileBuffers(fileIdentifiers: FileIdentifier[], abortSignal?: AbortSignal): Promise<ArrayBuffer[]>;
32
+ /**
33
+ * Downloads low-resolution icon versions of files.
34
+ * The /files/icon endpoint only supports internal numeric IDs.
35
+ */
36
+ getIconBuffersWithMimeType(fileIdentifiers: FileIdentifier[], abortSignal?: AbortSignal): Promise<FileDownloadResult[]>;
37
+ private partitionIdentifiersByInternalId;
38
+ private resolveInternalIdsFromDownloadUrls;
39
+ private mergeResultsInOriginalOrder;
40
+ private fetchIconsById;
41
+ getIconBuffers(fileIdentifiers: FileIdentifier[], abortSignal?: AbortSignal): Promise<ArrayBuffer[]>;
14
42
  private getDownloadUrls;
15
43
  }
@@ -12,25 +12,30 @@ import { BatchLoader } from '../../../../utilities/BatchLoader';
12
12
  * Instead of loading each collection individually (1000 queries for 1000 collections),
13
13
  * it batches them into groups and makes far fewer queries (e.g., 20 queries for 1000 collections).
14
14
  * This allows collections with any number of images, not just ~200 per collection (10,000 / 50 batch size).
15
+ *
16
+ * This loader uses instance IDs directly from DMS queries to identify files,
17
+ * eliminating the need for /files/byids API calls to resolve file metadata.
18
+ * This significantly improves loading performance for large collections (e.g., 16k+ images).
15
19
  */
16
20
  export declare class Cdf360CdmBatchCollectionLoader extends BatchLoader<DMInstanceRef, Historical360ImageSet<DMDataSourceType>[]> {
17
21
  private readonly _dmsSdk;
18
- private readonly _cogniteSdk;
19
- constructor(dmsSdk: DataModelsSdk, cogniteSdk: CogniteClient);
22
+ constructor(dmsSdk: DataModelsSdk, _cogniteSdk: CogniteClient);
20
23
  getCollectionDescriptors(identifier: DMInstanceRef): Promise<Historical360ImageSet<DMDataSourceType>[]>;
21
24
  protected fetchBatch(identifiers: DMInstanceRef[]): Promise<Map<DMInstanceKey, Historical360ImageSet<DMDataSourceType>[]>>;
22
25
  protected getKeyForIdentifier(identifier: DMInstanceRef): DMInstanceKey;
23
26
  protected getDefaultResult(_identifier: DMInstanceRef): Historical360ImageSet<DMDataSourceType>[];
24
27
  private fetchAllPages;
25
28
  private groupResultsByCollection;
26
- private getFileDescriptorsForBatch;
27
- private getFileDescriptorsForImages;
29
+ /**
30
+ * Creates file descriptors directly from the DMS image data using instance IDs.
31
+ * This avoids the need to call /files/byids to resolve file metadata.
32
+ * The instance IDs are used directly with the /files/downloadlink endpoint.
33
+ */
34
+ private createFileDescriptorsFromImage;
28
35
  private createHistoricalImageSets;
29
36
  private getHistorical360ImageSet;
30
37
  private getImageRevision;
31
- private getFaceDescriptors;
32
38
  private getRevisionTransform;
33
- private getCdmFiles;
34
39
  private stringifyValue;
35
40
  private toNumber;
36
41
  }
@@ -35,11 +35,13 @@ export type Image360BaseIdentifier = {
35
35
  };
36
36
  export declare class Cdf360DataModelsDescriptorProvider implements Image360DescriptorProvider<ClassicDataSourceType> {
37
37
  readonly _dmsSdk: DataModelsSdk;
38
- private readonly _cogniteSdk;
39
38
  constructor(sdk: CogniteClient);
40
39
  get360ImageDescriptors(collectionIdentifier: Image360DataModelIdentifier, _: boolean): Promise<Historical360ImageSet<ClassicDataSourceType>[]>;
40
+ /**
41
+ * Creates file descriptors directly from the DMS image data using external IDs.
42
+ */
43
+ private createFileDescriptorsFromImage;
41
44
  private queryCollection;
42
- private getFileDescriptors;
43
45
  private getHistorical360ImageSet;
44
46
  private getImageRevision;
45
47
  private getRevisionTransform;
@@ -1,4 +1,11 @@
1
1
  import { DataModelsSdk } from '../../DataModelsSdk';
2
+ import { CdfDMPointCloudVolumeQuery } from './getDMPointCloudVolumeCollectionQuery';
2
3
  import { CdfPointCloudObjectAnnotation } from '../types';
3
4
  import { DMModelIdentifierType } from '../../DataSourceType';
5
+ type QueryResult = Awaited<ReturnType<typeof DataModelsSdk.prototype.queryNodesAndEdges<CdfDMPointCloudVolumeQuery>>>;
6
+ export type ExhaustedQueryResult = {
7
+ pointCloudVolumes: QueryResult['pointCloudVolumes'];
8
+ assets: QueryResult['assets'];
9
+ };
4
10
  export declare function getDMPointCloudObjects(dmsSdk: DataModelsSdk, modelIdentifier: DMModelIdentifierType): Promise<CdfPointCloudObjectAnnotation[]>;
11
+ export {};
@@ -63,6 +63,9 @@ declare const getDMPointCloudVolumeQuery: (revisionRef: DMInstanceRef) => {
63
63
  readonly properties: ["revisions", "volumeReferences", "volumeType", "volume", "object3D"];
64
64
  }];
65
65
  };
66
+ readonly object3D: {
67
+ readonly sources: [];
68
+ };
66
69
  readonly assets: {
67
70
  readonly sources: [{
68
71
  readonly source: {
@@ -89,9 +89,14 @@ export type Image360Texture = {
89
89
  texture: THREE.Texture;
90
90
  };
91
91
  export type Image360FileDescriptor = {
92
- fileId: number;
93
92
  face: 'front' | 'back' | 'left' | 'right' | 'top' | 'bottom';
94
93
  mimeType: 'image/jpeg' | 'image/png';
94
+ /** Internal CDF file ID (numeric) */
95
+ fileId?: number;
96
+ /** External file ID (string) - for system-space/FDM collections */
97
+ externalId?: string;
98
+ /** DM instance reference - for CDM collections */
99
+ instanceId?: DMInstanceRef;
95
100
  };
96
101
  export declare enum File3dFormat {
97
102
  EptPointCloud = "ept-pointcloud",
@@ -46,3 +46,4 @@ export declare const COGNITE_360_IMAGE_STATION_SOURCE: {
46
46
  readonly type: "view";
47
47
  };
48
48
  export declare const MAX_DMS_QUERY_LIMIT = 10000;
49
+ export declare const DEFAULT_360_IMAGE_MIME_TYPE: "image/jpeg";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognite/reveal",
3
- "version": "4.29.1",
3
+ "version": "4.29.2-dev.20260211",
4
4
  "description": "WebGL based 3D viewer for CAD and point clouds processed in Cognite Data Fusion.",
5
5
  "homepage": "https://github.com/cognitedata/reveal/tree/master/viewer",
6
6
  "repository": {
@@ -134,7 +134,7 @@
134
134
  "ts-loader": "^9.5.1",
135
135
  "tsc-alias": "^1.8.8",
136
136
  "typescript": "^5.4.5",
137
- "wasm-pack": "^0.13.0",
137
+ "wasm-pack": "^0.14.0",
138
138
  "webpack": "^5.91.0",
139
139
  "webpack-cli": "^5.1.4",
140
140
  "webpack-dev-server": "^5.0.4",