digitaltwin-core 0.13.1 → 0.13.2

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.
Files changed (36) hide show
  1. package/dist/components/tileset_manager.d.ts +45 -56
  2. package/dist/components/tileset_manager.d.ts.map +1 -1
  3. package/dist/components/tileset_manager.js +370 -497
  4. package/dist/components/tileset_manager.js.map +1 -1
  5. package/dist/database/adapters/knex_database_adapter.d.ts.map +1 -1
  6. package/dist/database/adapters/knex_database_adapter.js +9 -12
  7. package/dist/database/adapters/knex_database_adapter.js.map +1 -1
  8. package/dist/engine/upload_processor.d.ts +6 -0
  9. package/dist/engine/upload_processor.d.ts.map +1 -1
  10. package/dist/engine/upload_processor.js +35 -10
  11. package/dist/engine/upload_processor.js.map +1 -1
  12. package/dist/storage/adapters/local_storage_service.d.ts +14 -0
  13. package/dist/storage/adapters/local_storage_service.d.ts.map +1 -1
  14. package/dist/storage/adapters/local_storage_service.js +46 -0
  15. package/dist/storage/adapters/local_storage_service.js.map +1 -1
  16. package/dist/storage/adapters/ovh_storage_service.d.ts +15 -0
  17. package/dist/storage/adapters/ovh_storage_service.d.ts.map +1 -1
  18. package/dist/storage/adapters/ovh_storage_service.js +54 -2
  19. package/dist/storage/adapters/ovh_storage_service.js.map +1 -1
  20. package/dist/storage/storage_service.d.ts +36 -0
  21. package/dist/storage/storage_service.d.ts.map +1 -1
  22. package/dist/storage/storage_service.js.map +1 -1
  23. package/dist/types/data_record.d.ts +6 -15
  24. package/dist/types/data_record.d.ts.map +1 -1
  25. package/dist/utils/index.d.ts +1 -1
  26. package/dist/utils/index.d.ts.map +1 -1
  27. package/dist/utils/index.js +1 -1
  28. package/dist/utils/index.js.map +1 -1
  29. package/dist/utils/map_to_data_record.d.ts.map +1 -1
  30. package/dist/utils/map_to_data_record.js +3 -1
  31. package/dist/utils/map_to_data_record.js.map +1 -1
  32. package/dist/utils/zip_utils.d.ts +14 -30
  33. package/dist/utils/zip_utils.d.ts.map +1 -1
  34. package/dist/utils/zip_utils.js +25 -63
  35. package/dist/utils/zip_utils.js.map +1 -1
  36. package/package.json +1 -1
@@ -5,64 +5,67 @@ import type { HttpMethod } from '../engine/endpoints.js';
5
5
  import type { AsyncUploadable } from './async_upload.js';
6
6
  import type { Queue } from 'bullmq';
7
7
  /**
8
- * Extended metadata for tileset assets with file index support
8
+ * Metadata stored in database for a tileset.
9
+ * Simplified: Cesium accesses files directly from OVH.
9
10
  */
10
11
  export interface TilesetMetadataRow {
11
12
  id?: number;
12
13
  name: string;
13
14
  type: string;
15
+ /** Base path in storage for deletion (e.g., tilesets/123) */
14
16
  url: string;
17
+ /** Public URL to tileset.json */
18
+ tileset_url: string;
15
19
  date: Date;
16
20
  description: string;
17
- source: string;
18
- owner_id: number | null;
19
21
  filename: string;
22
+ owner_id: number | null;
20
23
  is_public?: boolean;
21
- file_index?: {
22
- files: Array<{
23
- path: string;
24
- name: string;
25
- size: number;
26
- }>;
27
- root_file?: string;
28
- };
24
+ upload_status?: 'pending' | 'processing' | 'completed' | 'failed';
25
+ upload_job_id?: string;
26
+ upload_error?: string;
29
27
  }
30
28
  /**
31
29
  * Specialized Assets Manager for handling 3D Tiles tilesets.
32
30
  *
33
- * This manager extracts uploaded ZIP files and stores each file individually,
34
- * allowing Cesium and other 3D viewers to load tilesets directly via URL.
31
+ * This manager extracts uploaded ZIP files and stores each file in cloud storage (OVH S3),
32
+ * allowing Cesium and other 3D viewers to load tilesets directly via public URLs.
33
+ *
34
+ * ## How it works
35
35
  *
36
- * Key features:
37
- * - Extracts ZIP archives on upload (no ZIP stored, only extracted files)
38
- * - Detects and tracks the root tileset.json file
39
- * - Serves individual files via dedicated endpoint
40
- * - Returns tileset.json URL for direct Cesium loading
36
+ * 1. User uploads a ZIP containing a 3D Tiles tileset
37
+ * 2. ZIP is extracted and all files are stored in OVH with public-read ACL
38
+ * 3. Database stores only the tileset.json URL and base path
39
+ * 4. Cesium loads tileset.json directly from OVH
40
+ * 5. Cesium fetches tiles using relative paths in tileset.json (directly from OVH)
41
41
  *
42
- * Endpoints:
43
- * - GET /{endpoint} - List all tilesets with tileset.json URLs
44
- * - POST /{endpoint} - Upload tileset ZIP (extracts and stores files)
45
- * - GET /{endpoint}/:id - Get tileset metadata
46
- * - GET /{endpoint}/:id/files/* - Serve extracted files (tileset.json, .b3dm, etc.)
42
+ * ## Endpoints
43
+ *
44
+ * - GET /{endpoint} - List all tilesets with their public URLs
45
+ * - POST /{endpoint} - Upload tileset ZIP (sync < 50MB, async >= 50MB)
46
+ * - GET /{endpoint}/:id/status - Poll async upload status
47
47
  * - PUT /{endpoint}/:id - Update tileset metadata
48
- * - DELETE /{endpoint}/:id - Delete tileset and all extracted files
48
+ * - DELETE /{endpoint}/:id - Delete tileset and all files from storage
49
49
  *
50
50
  * @example
51
51
  * ```typescript
52
52
  * class MyTilesetManager extends TilesetManager {
53
53
  * getConfiguration() {
54
54
  * return {
55
- * name: 'tilesets_manager',
55
+ * name: 'tilesets',
56
56
  * description: 'Manage 3D Tiles tilesets',
57
57
  * contentType: 'application/json',
58
58
  * endpoint: 'api/tilesets',
59
- * tags: ['Tileset']
59
+ * extension: '.zip'
60
60
  * }
61
61
  * }
62
62
  * }
63
63
  *
64
- * // After upload, Cesium can load:
65
- * // Cesium3DTileset.fromUrl('/api/tilesets/123/files/tileset.json')
64
+ * // After upload, response contains:
65
+ * // { tileset_url: 'https://bucket.s3.../tilesets/123/tileset.json' }
66
+ * //
67
+ * // Cesium loads directly:
68
+ * // Cesium.Cesium3DTileset.fromUrl(tileset_url)
66
69
  * ```
67
70
  */
68
71
  export declare abstract class TilesetManager extends AssetsManager implements AsyncUploadable {
@@ -74,53 +77,39 @@ export declare abstract class TilesetManager extends AssetsManager implements As
74
77
  */
75
78
  setUploadQueue(queue: Queue): void;
76
79
  /**
77
- * Override the upload handler to support async processing for large files.
78
- *
79
- * When uploadQueue is available (async mode):
80
- * 1. Validates request and authentication
81
- * 2. Creates a database record with status 'pending'
82
- * 3. Queues a job for background processing
83
- * 4. Returns immediately with job ID
84
- *
85
- * When uploadQueue is not available (sync mode - fallback):
86
- * 1. Validates request and authentication
87
- * 2. Extracts ZIP and stores files synchronously
88
- * 3. Returns with completed tileset info
80
+ * Handle tileset upload.
89
81
  *
90
- * @param req - HTTP request with ZIP file upload
91
- * @returns DataResponse with upload result (async: job info, sync: tileset info)
82
+ * - Files < 50MB: Synchronous extraction and upload
83
+ * - Files >= 50MB: Queued for async processing (returns 202)
92
84
  */
93
85
  handleUpload(req: any): Promise<DataResponse>;
86
+ /**
87
+ * Authenticate user from request headers.
88
+ * Returns user ID on success, or error response on failure.
89
+ */
90
+ private authenticateUser;
94
91
  /**
95
92
  * Queue upload for background processing. Returns HTTP 202 immediately.
96
93
  */
97
94
  private handleAsyncUpload;
98
95
  /**
99
- * Process upload synchronously (fallback when queue unavailable).
96
+ * Process upload synchronously.
100
97
  */
101
98
  private handleSyncUpload;
102
99
  /**
103
- * Get upload status for polling. Returns: pending | processing | completed | failed
100
+ * Get upload status for async uploads.
104
101
  */
105
102
  handleGetStatus(req: any): Promise<DataResponse>;
106
103
  /**
107
- * Serve extracted tileset file (tileset.json, .b3dm, textures, etc.)
108
- */
109
- handleGetFile(req: any): Promise<DataResponse>;
110
- /**
111
- * Determines the MIME content type based on file extension.
112
- */
113
- private getContentTypeForFile;
114
- /**
115
- * Override retrieve to include tileset.json URL in the response.
104
+ * List all tilesets with their public URLs.
116
105
  */
117
106
  retrieve(req?: any): Promise<DataResponse>;
118
107
  /**
119
- * Delete tileset and all extracted files from storage.
108
+ * Delete tileset and all files from storage.
120
109
  */
121
110
  handleDelete(req: any): Promise<DataResponse>;
122
111
  /**
123
- * Override getEndpoints to add the file serving endpoint.
112
+ * Get HTTP endpoints for this manager.
124
113
  */
125
114
  getEndpoints(): Array<{
126
115
  method: HttpMethod;
@@ -129,7 +118,7 @@ export declare abstract class TilesetManager extends AssetsManager implements As
129
118
  responseType?: string;
130
119
  }>;
131
120
  /**
132
- * Override OpenAPI specification to include tileset-specific endpoints.
121
+ * Generate OpenAPI specification.
133
122
  */
134
123
  getOpenAPISpec(): OpenAPIComponentSpec;
135
124
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tileset_manager.d.ts","sourceRoot":"","sources":["../../src/components/tileset_manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAIxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAGnC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,IAAI,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB,UAAU,CAAC,EAAE;QACT,KAAK,EAAE,KAAK,CAAC;YACT,IAAI,EAAE,MAAM,CAAA;YACZ,IAAI,EAAE,MAAM,CAAA;YACZ,IAAI,EAAE,MAAM,CAAA;SACf,CAAC,CAAA;QACF,SAAS,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;CACJ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,8BAAsB,cAAe,SAAQ,aAAc,YAAW,eAAe;IACjF,6DAA6D;IAC7D,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