digitaltwin-core 0.1.0

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 (107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +125 -0
  3. package/dist/components/assets_manager.d.ts +384 -0
  4. package/dist/components/assets_manager.d.ts.map +1 -0
  5. package/dist/components/assets_manager.js +637 -0
  6. package/dist/components/assets_manager.js.map +1 -0
  7. package/dist/components/collector.d.ts +62 -0
  8. package/dist/components/collector.d.ts.map +1 -0
  9. package/dist/components/collector.js +80 -0
  10. package/dist/components/collector.js.map +1 -0
  11. package/dist/components/global_assets_handler.d.ts +63 -0
  12. package/dist/components/global_assets_handler.d.ts.map +1 -0
  13. package/dist/components/global_assets_handler.js +127 -0
  14. package/dist/components/global_assets_handler.js.map +1 -0
  15. package/dist/components/handler.d.ts +33 -0
  16. package/dist/components/handler.d.ts.map +1 -0
  17. package/dist/components/handler.js +27 -0
  18. package/dist/components/handler.js.map +1 -0
  19. package/dist/components/harvester.d.ts +54 -0
  20. package/dist/components/harvester.d.ts.map +1 -0
  21. package/dist/components/harvester.js +253 -0
  22. package/dist/components/harvester.js.map +1 -0
  23. package/dist/components/index.d.ts +8 -0
  24. package/dist/components/index.d.ts.map +1 -0
  25. package/dist/components/index.js +6 -0
  26. package/dist/components/index.js.map +1 -0
  27. package/dist/components/interfaces.d.ts +18 -0
  28. package/dist/components/interfaces.d.ts.map +1 -0
  29. package/dist/components/interfaces.js +2 -0
  30. package/dist/components/interfaces.js.map +1 -0
  31. package/dist/components/types.d.ts +47 -0
  32. package/dist/components/types.d.ts.map +1 -0
  33. package/dist/components/types.js +2 -0
  34. package/dist/components/types.js.map +1 -0
  35. package/dist/database/adapters/knex_database_adapter.d.ts +47 -0
  36. package/dist/database/adapters/knex_database_adapter.d.ts.map +1 -0
  37. package/dist/database/adapters/knex_database_adapter.js +180 -0
  38. package/dist/database/adapters/knex_database_adapter.js.map +1 -0
  39. package/dist/database/database_adapter.d.ts +92 -0
  40. package/dist/database/database_adapter.d.ts.map +1 -0
  41. package/dist/database/database_adapter.js +6 -0
  42. package/dist/database/database_adapter.js.map +1 -0
  43. package/dist/engine/digital_twin_engine.d.ts +237 -0
  44. package/dist/engine/digital_twin_engine.d.ts.map +1 -0
  45. package/dist/engine/digital_twin_engine.js +574 -0
  46. package/dist/engine/digital_twin_engine.js.map +1 -0
  47. package/dist/engine/endpoints.d.ts +7 -0
  48. package/dist/engine/endpoints.d.ts.map +1 -0
  49. package/dist/engine/endpoints.js +18 -0
  50. package/dist/engine/endpoints.js.map +1 -0
  51. package/dist/engine/events.d.ts +13 -0
  52. package/dist/engine/events.d.ts.map +1 -0
  53. package/dist/engine/events.js +11 -0
  54. package/dist/engine/events.js.map +1 -0
  55. package/dist/engine/initializer.d.ts +8 -0
  56. package/dist/engine/initializer.d.ts.map +1 -0
  57. package/dist/engine/initializer.js +23 -0
  58. package/dist/engine/initializer.js.map +1 -0
  59. package/dist/engine/queue_manager.d.ts +78 -0
  60. package/dist/engine/queue_manager.d.ts.map +1 -0
  61. package/dist/engine/queue_manager.js +167 -0
  62. package/dist/engine/queue_manager.js.map +1 -0
  63. package/dist/engine/scheduler.d.ts +30 -0
  64. package/dist/engine/scheduler.d.ts.map +1 -0
  65. package/dist/engine/scheduler.js +378 -0
  66. package/dist/engine/scheduler.js.map +1 -0
  67. package/dist/env/env.d.ts +25 -0
  68. package/dist/env/env.d.ts.map +1 -0
  69. package/dist/env/env.js +55 -0
  70. package/dist/env/env.js.map +1 -0
  71. package/dist/index.d.ts +23 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +31 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/storage/adapters/local_storage_service.d.ts +29 -0
  76. package/dist/storage/adapters/local_storage_service.d.ts.map +1 -0
  77. package/dist/storage/adapters/local_storage_service.js +50 -0
  78. package/dist/storage/adapters/local_storage_service.js.map +1 -0
  79. package/dist/storage/adapters/ovh_storage_service.d.ts +32 -0
  80. package/dist/storage/adapters/ovh_storage_service.d.ts.map +1 -0
  81. package/dist/storage/adapters/ovh_storage_service.js +70 -0
  82. package/dist/storage/adapters/ovh_storage_service.js.map +1 -0
  83. package/dist/storage/storage_factory.d.ts +14 -0
  84. package/dist/storage/storage_factory.d.ts.map +1 -0
  85. package/dist/storage/storage_factory.js +36 -0
  86. package/dist/storage/storage_factory.js.map +1 -0
  87. package/dist/storage/storage_service.d.ts +26 -0
  88. package/dist/storage/storage_service.d.ts.map +1 -0
  89. package/dist/storage/storage_service.js +7 -0
  90. package/dist/storage/storage_service.js.map +1 -0
  91. package/dist/types/data_record.d.ts +17 -0
  92. package/dist/types/data_record.d.ts.map +1 -0
  93. package/dist/types/data_record.js +2 -0
  94. package/dist/types/data_record.js.map +1 -0
  95. package/dist/utils/logger.d.ts +17 -0
  96. package/dist/utils/logger.d.ts.map +1 -0
  97. package/dist/utils/logger.js +35 -0
  98. package/dist/utils/logger.js.map +1 -0
  99. package/dist/utils/map_to_data_record.d.ts +10 -0
  100. package/dist/utils/map_to_data_record.d.ts.map +1 -0
  101. package/dist/utils/map_to_data_record.js +21 -0
  102. package/dist/utils/map_to_data_record.js.map +1 -0
  103. package/dist/utils/servable_endpoint.d.ts +6 -0
  104. package/dist/utils/servable_endpoint.d.ts.map +1 -0
  105. package/dist/utils/servable_endpoint.js +15 -0
  106. package/dist/utils/servable_endpoint.js.map +1 -0
  107. package/package.json +95 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Axel Hoffmann
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,125 @@
1
+ # Digital Twin Core
2
+
3
+ Digital Twin Core is a minimalist TypeScript framework used to collect and process data for Digital Twin projects. It provides building blocks to create scheduled collectors, harvesters and HTTP handlers while abstracting storage and database access.
4
+
5
+ ## Features
6
+
7
+ - **Collectors** – fetch regular data from APIs (typically JSON) based on a Buffer schedule, store it and expose it via GET endpoints.
8
+ - **Harvesters** – transform data collected by collectors, store the results and expose them via GET endpoints.
9
+ - **Handlers** – expose GET endpoints that directly return the result of the method defined in the decorator.
10
+ - **Assets Manager** – upload, store and manage file assets with metadata, providing RESTful endpoints for CRUD operations.
11
+ - **Storage adapters** – currently local filesystem and OVH Object Storage via S3 API.
12
+ - **Database adapter** – implemented with [Knex](https://knexjs.org/) to index metadata.
13
+ - **Engine** – orchestrates components, schedules jobs with BullMQ and exposes endpoints via Express.
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install
19
+ ```
20
+
21
+ The project requires Node.js 18 or later.
22
+
23
+ ## Building
24
+
25
+ Compile the TypeScript sources to `dist/`:
26
+
27
+ ```bash
28
+ npm run build
29
+ ```
30
+
31
+ During development you can use the watcher:
32
+
33
+ ```bash
34
+ npm run dev
35
+ ```
36
+
37
+ ## Running tests
38
+
39
+ The test suite uses [Japa](https://github.com/japa/runner). Run all tests with:
40
+
41
+ ```bash
42
+ npm test
43
+ ```
44
+
45
+ ## Example usage
46
+
47
+ Below is a very small example showing how the engine may be instantiated. Storage and database implementations are selected through the provided factories.
48
+
49
+ ```ts
50
+ import { DigitalTwinEngine } from './src/engine/digital_twin_engine.js';
51
+ import { StorageServiceFactory } from './src/storage/storage_factory.js';
52
+ import { KnexDatabaseAdapter } from './src/database/adapters/knex_database_adapter.js';
53
+ import { Env } from './src/env/env.js';
54
+
55
+ // Validate environment variables and bootstrap services
56
+ const env = Env.validate({
57
+ STORAGE_CONFIG: Env.schema.enum(['local', 'ovh'])
58
+ });
59
+
60
+ const storage = StorageServiceFactory.create();
61
+ const database = new KnexDatabaseAdapter({ client: 'sqlite3', connection: ':memory:' }, storage);
62
+
63
+ const engine = new DigitalTwinEngine({ storage, database });
64
+ engine.start();
65
+ ```
66
+
67
+ ## Components
68
+
69
+ ### Collectors
70
+
71
+ Collectors are scheduled components that fetch data from external sources at regular intervals. They implement a `collect()` method that returns a Buffer, which is then stored and exposed via HTTP endpoints.
72
+
73
+ **Key features:**
74
+ - Cron-based scheduling
75
+ - Automatic storage and metadata indexing
76
+ - HTTP GET endpoint for retrieving latest data
77
+ - Event emission on successful collection
78
+
79
+ ### Assets Manager
80
+
81
+ The Assets Manager provides a complete solution for file asset management with metadata support. It's an abstract base class that can be extended for specific asset types.
82
+
83
+ **Key features:**
84
+ - File upload with metadata (description, source URL, owner, filename)
85
+ - RESTful CRUD operations via HTTP endpoints
86
+ - Content-type aware storage and retrieval
87
+ - Separate display and download endpoints
88
+ - Source URL validation for data provenance
89
+ - Component isolation (each manager handles its own asset type)
90
+
91
+ **Available endpoints:**
92
+ - `GET /{assetType}` - List all assets with metadata
93
+ - `POST /{assetType}/upload` - Upload new asset with metadata
94
+ - `GET /{assetType}/{id}` - Retrieve asset content for display
95
+ - `GET /{assetType}/{id}/download` - Download asset with attachment headers
96
+ - `PUT /{assetType}/{id}` - Update asset metadata
97
+ - `DELETE /{assetType}/{id}` - Delete asset
98
+
99
+ **Example usage:**
100
+ ```typescript
101
+ class GLTFAssetsManager extends AssetsManager {
102
+ getConfiguration() {
103
+ return {
104
+ name: 'gltf',
105
+ description: 'GLTF 3D models manager',
106
+ contentType: 'model/gltf-binary',
107
+ tags: ['assets', '3d', 'gltf']
108
+ }
109
+ }
110
+ }
111
+ ```
112
+
113
+ ## Folder structure
114
+
115
+ - `src/` – framework sources
116
+ - `components/` – base classes for collectors, harvesters, handlers and assets manager
117
+ - `engine/` – orchestration logic
118
+ - `storage/` – storage service abstractions and adapters
119
+ - `database/` – metadata database adapter
120
+ - `env/` – environment configuration helper
121
+ - `tests/` – unit tests
122
+
123
+ ---
124
+
125
+ This project is licensed under the MIT License.
@@ -0,0 +1,384 @@
1
+ import { Component, Servable } from './interfaces.js';
2
+ import { ComponentConfiguration, DataResponse } from './types.js';
3
+ import { HttpMethod } from '../engine/endpoints.js';
4
+ import { StorageService } from '../storage/storage_service.js';
5
+ import { DatabaseAdapter, MetadataRow } from '../database/database_adapter.js';
6
+ import { DataRecord } from "../types/data_record.js";
7
+ /**
8
+ * Extended metadata row for assets with additional fields.
9
+ * This will be stored as separate columns in the database table.
10
+ *
11
+ * @interface AssetMetadataRow
12
+ * @extends {MetadataRow}
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const assetMeta: AssetMetadataRow = {
17
+ * name: 'gltf',
18
+ * type: 'model/gltf-binary',
19
+ * url: '/storage/gltf/model.glb',
20
+ * date: new Date(),
21
+ * description: '3D building model',
22
+ * source: 'https://example.com/data-source',
23
+ * owner_id: 'user123',
24
+ * filename: 'building.glb'
25
+ * }
26
+ * ```
27
+ */
28
+ export interface AssetMetadataRow extends MetadataRow {
29
+ /** Human-readable description of the asset */
30
+ description: string;
31
+ /** Source URL for data provenance and licensing compliance (must be valid URL) */
32
+ source: string;
33
+ /** ID of the user who owns this asset (for access control) */
34
+ owner_id: string | null;
35
+ /** Original filename provided by the user */
36
+ filename: string;
37
+ }
38
+ /**
39
+ * Request payload for creating a new asset.
40
+ *
41
+ * @interface CreateAssetRequest
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const request: CreateAssetRequest = {
46
+ * description: '3D model of building',
47
+ * source: 'https://city-data.example.com/buildings',
48
+ * owner_id: 'user123',
49
+ * filename: 'building.glb',
50
+ * file: fileBuffer
51
+ * }
52
+ * ```
53
+ */
54
+ export interface CreateAssetRequest {
55
+ /** Human-readable description of the asset */
56
+ description: string;
57
+ /** Source URL for data provenance (validated as proper URL) */
58
+ source: string;
59
+ /** Owner user ID for access control (can be null) */
60
+ owner_id: string | null;
61
+ /** Original filename */
62
+ filename: string;
63
+ /** File content as Buffer */
64
+ file: Buffer;
65
+ }
66
+ /**
67
+ * Request payload for updating asset metadata.
68
+ *
69
+ * @interface UpdateAssetRequest
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * const updates: UpdateAssetRequest = {
74
+ * description: 'Updated building model with new textures',
75
+ * source: 'https://updated-source.example.com'
76
+ * }
77
+ * ```
78
+ */
79
+ export interface UpdateAssetRequest {
80
+ /** Updated description (optional) */
81
+ description?: string;
82
+ /** Updated source URL (optional, validated if provided) */
83
+ source?: string;
84
+ }
85
+ /**
86
+ * Abstract base class for Assets Manager components.
87
+ *
88
+ * Provides file upload, storage, and retrieval capabilities following the Digital Twin framework patterns.
89
+ * Each concrete implementation manages a specific type of asset and creates its own database table.
90
+ *
91
+ * @abstract
92
+ * @class AssetsManager
93
+ * @implements {Component}
94
+ * @implements {Servable}
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * // Create concrete implementations for different asset types
99
+ * class GLTFAssetsManager extends AssetsManager {
100
+ * getConfiguration() {
101
+ * return { name: 'gltf', description: 'GLTF 3D models manager', ... }
102
+ * }
103
+ * }
104
+ *
105
+ * class PointCloudAssetsManager extends AssetsManager {
106
+ * getConfiguration() {
107
+ * return { name: 'pointcloud', description: 'Point cloud data manager', ... }
108
+ * }
109
+ * }
110
+ *
111
+ * // Usage in engine
112
+ * const gltfManager = new GLTFAssetsManager()
113
+ * gltfManager.setDependencies(database, storage)
114
+ *
115
+ * // Each creates its own table and endpoints:
116
+ * // - GLTFAssetsManager → table 'gltf', endpoints /gltf/*
117
+ * // - PointCloudAssetsManager → table 'pointcloud', endpoints /pointcloud/*
118
+ * ```
119
+ *
120
+ * @remarks
121
+ * Asset metadata is stored as dedicated columns in the database table:
122
+ * - id, name, url, date (standard columns)
123
+ * - description, source, owner_id, filename (asset-specific columns)
124
+ *
125
+ * Each concrete AssetsManager creates its own table based on the configuration name.
126
+ */
127
+ export declare abstract class AssetsManager implements Component, Servable {
128
+ protected db: DatabaseAdapter;
129
+ protected storage: StorageService;
130
+ /**
131
+ * Injects dependencies into the assets manager.
132
+ *
133
+ * Called by the framework during component initialization.
134
+ *
135
+ * @param {DatabaseAdapter} db - The database adapter for metadata storage
136
+ * @param {StorageService} storage - The storage service for file persistence
137
+ *
138
+ * @example
139
+ * ```typescript
140
+ * const assetsManager = new MyAssetsManager()
141
+ * assetsManager.setDependencies(databaseAdapter, storageService)
142
+ * ```
143
+ */
144
+ setDependencies(db: DatabaseAdapter, storage: StorageService): void;
145
+ /**
146
+ * Returns the configuration of the assets manager.
147
+ *
148
+ * Must be implemented by subclasses to define the asset type,
149
+ * table name, and content types.
150
+ *
151
+ * @abstract
152
+ * @returns {ComponentConfiguration} The component configuration
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * class GLTFAssetsManager extends AssetsManager {
157
+ * getConfiguration(): ComponentConfiguration {
158
+ * return {
159
+ * name: 'gltf',
160
+ * description: 'GLTF 3D models manager',
161
+ * contentType: 'model/gltf-binary',
162
+ * tags: ['assets', '3d', 'gltf']
163
+ * }
164
+ * }
165
+ * }
166
+ * ```
167
+ */
168
+ abstract getConfiguration(): ComponentConfiguration;
169
+ /**
170
+ * Validates that a source string is a valid URL.
171
+ *
172
+ * Used internally to ensure data provenance URLs are properly formatted.
173
+ *
174
+ * @private
175
+ * @param {string} source - The source URL to validate
176
+ * @returns {boolean} True if the source is a valid URL, false otherwise
177
+ *
178
+ * @example
179
+ * ```typescript
180
+ * this.validateSourceURL('https://example.com/data') // returns true
181
+ * this.validateSourceURL('not-a-url') // returns false
182
+ * ```
183
+ */
184
+ private validateSourceURL;
185
+ /**
186
+ * Upload a new asset file with metadata.
187
+ *
188
+ * Stores the file using the storage service and saves metadata to the database.
189
+ * Asset metadata is stored as dedicated columns in the database table.
190
+ *
191
+ * @param {CreateAssetRequest} request - The asset upload request
192
+ * @throws {Error} If source URL is invalid
193
+ *
194
+ * @example
195
+ * ```typescript
196
+ * await assetsManager.uploadAsset({
197
+ * description: '3D building model',
198
+ * source: 'https://city-data.example.com/buildings',
199
+ * owner_id: 'user123',
200
+ * filename: 'building.glb',
201
+ * file: fileBuffer
202
+ * })
203
+ * ```
204
+ */
205
+ uploadAsset(request: CreateAssetRequest): Promise<void>;
206
+ /**
207
+ * Retrieve all assets for this component (like other components).
208
+ *
209
+ * Returns a JSON list of all assets with their metadata, following the
210
+ * framework pattern but adapted for assets management.
211
+ *
212
+ * @returns {Promise<DataResponse>} JSON response with all assets
213
+ */
214
+ retrieve(): Promise<DataResponse>;
215
+ /**
216
+ * Get all assets for this component type.
217
+ *
218
+ * Retrieves all assets managed by this component, with their metadata.
219
+ * Uses a very old start date to get all records.
220
+ *
221
+ * @returns {Promise<DataRecord[]>} Array of all asset records
222
+ *
223
+ * @example
224
+ * ```typescript
225
+ * const allAssets = await assetsManager.getAllAssets()
226
+ * // Returns: [{ id, name, type, url, date, contentType }, ...]
227
+ * ```
228
+ */
229
+ getAllAssets(): Promise<DataRecord[]>;
230
+ /**
231
+ * Get asset by specific ID.
232
+ *
233
+ * @param {string} id - The asset ID to retrieve
234
+ * @returns {Promise<DataRecord | undefined>} The asset record or undefined if not found
235
+ *
236
+ * @example
237
+ * ```typescript
238
+ * const asset = await assetsManager.getAssetById('123')
239
+ * if (asset) {
240
+ * const fileData = await asset.data()
241
+ * }
242
+ * ```
243
+ */
244
+ getAssetById(id: string): Promise<DataRecord | undefined>;
245
+ /**
246
+ * Update asset metadata by ID.
247
+ *
248
+ * Updates the metadata (description and/or source) of a specific asset.
249
+ * Asset metadata is stored as dedicated columns in the database.
250
+ *
251
+ * @param {string} id - The ID of the asset to update
252
+ * @param {UpdateAssetRequest} updates - The metadata updates to apply
253
+ * @throws {Error} If source URL is invalid or asset not found
254
+ *
255
+ * @example
256
+ * ```typescript
257
+ * await assetsManager.updateAssetMetadata('123', {
258
+ * description: 'Updated building model with new textures',
259
+ * source: 'https://updated-source.example.com'
260
+ * })
261
+ * ```
262
+ */
263
+ updateAssetMetadata(id: string, updates: UpdateAssetRequest): Promise<void>;
264
+ /**
265
+ * Delete asset by ID.
266
+ *
267
+ * Removes a specific asset.
268
+ *
269
+ * @param {string} id - The ID of the asset to delete
270
+ * @throws {Error} If asset not found or doesn't belong to this component
271
+ *
272
+ * @example
273
+ * ```typescript
274
+ * await assetsManager.deleteAssetById('123')
275
+ * ```
276
+ */
277
+ deleteAssetById(id: string): Promise<void>;
278
+ /**
279
+ * Delete latest asset (simplified)
280
+ *
281
+ * Removes the most recently uploaded asset for this component type.
282
+ *
283
+ * @throws {Error} If no assets exist to delete
284
+ *
285
+ * @example
286
+ * ```typescript
287
+ * await assetsManager.deleteLatestAsset()
288
+ * ```
289
+ */
290
+ deleteLatestAsset(): Promise<void>;
291
+ /**
292
+ * Get endpoints following the framework pattern
293
+ */
294
+ /**
295
+ * Get HTTP endpoints exposed by this assets manager.
296
+ *
297
+ * Returns the standard CRUD endpoints following the framework pattern.
298
+ *
299
+ * @returns {Array} Array of endpoint descriptors with methods, paths, and handlers
300
+ *
301
+ * @example
302
+ * ```typescript
303
+ * // For a manager with assetType: 'gltf', provides:
304
+ * GET /gltf - Get all assets
305
+ * POST /gltf/upload - Upload new asset
306
+ * GET /gltf/123 - Get specific asset
307
+ * PUT /gltf/123 - Update asset metadata
308
+ * GET /gltf/123/download - Download asset
309
+ * DELETE /gltf/123 - Delete asset
310
+ * ```
311
+ */
312
+ getEndpoints(): Array<{
313
+ method: HttpMethod;
314
+ path: string;
315
+ handler: (...args: any[]) => any;
316
+ responseType?: string;
317
+ }>;
318
+ /**
319
+ * Handle upload endpoint
320
+ */
321
+ handleUpload(req: any): Promise<DataResponse>;
322
+ /**
323
+ * Handle update endpoint (PUT).
324
+ *
325
+ * Updates metadata for a specific asset by ID.
326
+ *
327
+ * @param {any} req - HTTP request object with params.id and body containing updates
328
+ * @returns {Promise<DataResponse>} HTTP response
329
+ *
330
+ * @example
331
+ * ```typescript
332
+ * // PUT /gltf/123
333
+ * // Body: { "description": "Updated model", "source": "https://new-source.com" }
334
+ * ```
335
+ */
336
+ handleUpdate(req: any): Promise<DataResponse>;
337
+ /**
338
+ * Handle get asset endpoint (GET).
339
+ *
340
+ * Returns the file content of a specific asset by ID for display/use in front-end.
341
+ * No download headers - just the raw file content.
342
+ *
343
+ * @param {any} req - HTTP request object with params.id
344
+ * @returns {Promise<DataResponse>} HTTP response with file content
345
+ *
346
+ * @example
347
+ * ```typescript
348
+ * // GET /gltf/123
349
+ * // Returns the .glb file content for display in 3D viewer
350
+ * ```
351
+ */
352
+ handleGetAsset(req: any): Promise<DataResponse>;
353
+ /**
354
+ * Handle download endpoint (GET).
355
+ *
356
+ * Downloads the file content of a specific asset by ID with download headers.
357
+ * Forces browser to download the file rather than display it.
358
+ *
359
+ * @param {any} req - HTTP request object with params.id
360
+ * @returns {Promise<DataResponse>} HTTP response with file content and download headers
361
+ *
362
+ * @example
363
+ * ```typescript
364
+ * // GET /gltf/123/download
365
+ * // Returns the .glb file with download headers - browser will save it
366
+ * ```
367
+ */
368
+ handleDownload(req: any): Promise<DataResponse>;
369
+ /**
370
+ * Handle delete endpoint (DELETE).
371
+ *
372
+ * Deletes a specific asset by ID.
373
+ *
374
+ * @param {any} req - HTTP request object with params.id
375
+ * @returns {Promise<DataResponse>} HTTP response
376
+ *
377
+ * @example
378
+ * ```typescript
379
+ * // DELETE /gltf/123
380
+ * ```
381
+ */
382
+ handleDelete(req: any): Promise<DataResponse>;
383
+ }
384
+ //# sourceMappingURL=assets_manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets_manager.d.ts","sourceRoot":"","sources":["../../src/components/assets_manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAC;AAsBnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACjD,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAA;IACnB,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAA;IACd,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,kBAAkB;IAC/B,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAA;IACnB,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAA;IACd,qDAAqD;IACrD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,wBAAwB;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,kBAAkB;IAC/B,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAA;CACl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