digitaltwin-core 0.13.3 → 0.14.1
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.
- package/package.json +101 -106
- package/dist/auth/apisix_parser.d.ts +0 -146
- package/dist/auth/apisix_parser.d.ts.map +0 -1
- package/dist/auth/apisix_parser.js +0 -185
- package/dist/auth/apisix_parser.js.map +0 -1
- package/dist/auth/auth_config.d.ts +0 -126
- package/dist/auth/auth_config.d.ts.map +0 -1
- package/dist/auth/auth_config.js +0 -169
- package/dist/auth/auth_config.js.map +0 -1
- package/dist/auth/index.d.ts +0 -5
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js +0 -4
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/types.d.ts +0 -100
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/types.js +0 -2
- package/dist/auth/types.js.map +0 -1
- package/dist/auth/user_service.d.ts +0 -86
- package/dist/auth/user_service.d.ts.map +0 -1
- package/dist/auth/user_service.js +0 -237
- package/dist/auth/user_service.js.map +0 -1
- package/dist/components/assets_manager.d.ts +0 -662
- package/dist/components/assets_manager.d.ts.map +0 -1
- package/dist/components/assets_manager.js +0 -1529
- package/dist/components/assets_manager.js.map +0 -1
- package/dist/components/async_upload.d.ts +0 -20
- package/dist/components/async_upload.d.ts.map +0 -1
- package/dist/components/async_upload.js +0 -10
- package/dist/components/async_upload.js.map +0 -1
- package/dist/components/collector.d.ts +0 -203
- package/dist/components/collector.d.ts.map +0 -1
- package/dist/components/collector.js +0 -202
- package/dist/components/collector.js.map +0 -1
- package/dist/components/custom_table_manager.d.ts +0 -503
- package/dist/components/custom_table_manager.d.ts.map +0 -1
- package/dist/components/custom_table_manager.js +0 -1052
- package/dist/components/custom_table_manager.js.map +0 -1
- package/dist/components/global_assets_handler.d.ts +0 -63
- package/dist/components/global_assets_handler.d.ts.map +0 -1
- package/dist/components/global_assets_handler.js +0 -127
- package/dist/components/global_assets_handler.js.map +0 -1
- package/dist/components/handler.d.ts +0 -104
- package/dist/components/handler.d.ts.map +0 -1
- package/dist/components/handler.js +0 -110
- package/dist/components/handler.js.map +0 -1
- package/dist/components/harvester.d.ts +0 -182
- package/dist/components/harvester.d.ts.map +0 -1
- package/dist/components/harvester.js +0 -393
- package/dist/components/harvester.js.map +0 -1
- package/dist/components/index.d.ts +0 -11
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js +0 -9
- package/dist/components/index.js.map +0 -1
- package/dist/components/interfaces.d.ts +0 -126
- package/dist/components/interfaces.d.ts.map +0 -1
- package/dist/components/interfaces.js +0 -8
- package/dist/components/interfaces.js.map +0 -1
- package/dist/components/map_manager.d.ts +0 -61
- package/dist/components/map_manager.d.ts.map +0 -1
- package/dist/components/map_manager.js +0 -242
- package/dist/components/map_manager.js.map +0 -1
- package/dist/components/tileset_manager.d.ts +0 -125
- package/dist/components/tileset_manager.d.ts.map +0 -1
- package/dist/components/tileset_manager.js +0 -618
- package/dist/components/tileset_manager.js.map +0 -1
- package/dist/components/types.d.ts +0 -226
- package/dist/components/types.d.ts.map +0 -1
- package/dist/components/types.js +0 -8
- package/dist/components/types.js.map +0 -1
- package/dist/database/adapters/knex_database_adapter.d.ts +0 -92
- package/dist/database/adapters/knex_database_adapter.d.ts.map +0 -1
- package/dist/database/adapters/knex_database_adapter.js +0 -647
- package/dist/database/adapters/knex_database_adapter.js.map +0 -1
- package/dist/database/database_adapter.d.ts +0 -251
- package/dist/database/database_adapter.d.ts.map +0 -1
- package/dist/database/database_adapter.js +0 -46
- package/dist/database/database_adapter.js.map +0 -1
- package/dist/engine/digital_twin_engine.d.ts +0 -253
- package/dist/engine/digital_twin_engine.d.ts.map +0 -1
- package/dist/engine/digital_twin_engine.js +0 -790
- package/dist/engine/digital_twin_engine.js.map +0 -1
- package/dist/engine/endpoints.d.ts +0 -47
- package/dist/engine/endpoints.d.ts.map +0 -1
- package/dist/engine/endpoints.js +0 -56
- package/dist/engine/endpoints.js.map +0 -1
- package/dist/engine/events.d.ts +0 -93
- package/dist/engine/events.d.ts.map +0 -1
- package/dist/engine/events.js +0 -71
- package/dist/engine/events.js.map +0 -1
- package/dist/engine/initializer.d.ts +0 -62
- package/dist/engine/initializer.d.ts.map +0 -1
- package/dist/engine/initializer.js +0 -108
- package/dist/engine/initializer.js.map +0 -1
- package/dist/engine/queue_manager.d.ts +0 -87
- package/dist/engine/queue_manager.d.ts.map +0 -1
- package/dist/engine/queue_manager.js +0 -196
- package/dist/engine/queue_manager.js.map +0 -1
- package/dist/engine/scheduler.d.ts +0 -30
- package/dist/engine/scheduler.d.ts.map +0 -1
- package/dist/engine/scheduler.js +0 -370
- package/dist/engine/scheduler.js.map +0 -1
- package/dist/engine/upload_processor.d.ts +0 -36
- package/dist/engine/upload_processor.d.ts.map +0 -1
- package/dist/engine/upload_processor.js +0 -101
- package/dist/engine/upload_processor.js.map +0 -1
- package/dist/env/env.d.ts +0 -134
- package/dist/env/env.d.ts.map +0 -1
- package/dist/env/env.js +0 -177
- package/dist/env/env.js.map +0 -1
- package/dist/index.d.ts +0 -49
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -57
- package/dist/index.js.map +0 -1
- package/dist/openapi/generator.d.ts +0 -93
- package/dist/openapi/generator.d.ts.map +0 -1
- package/dist/openapi/generator.js +0 -293
- package/dist/openapi/generator.js.map +0 -1
- package/dist/openapi/index.d.ts +0 -9
- package/dist/openapi/index.d.ts.map +0 -1
- package/dist/openapi/index.js +0 -9
- package/dist/openapi/index.js.map +0 -1
- package/dist/openapi/types.d.ts +0 -182
- package/dist/openapi/types.d.ts.map +0 -1
- package/dist/openapi/types.js +0 -16
- package/dist/openapi/types.js.map +0 -1
- package/dist/storage/adapters/local_storage_service.d.ts +0 -51
- package/dist/storage/adapters/local_storage_service.d.ts.map +0 -1
- package/dist/storage/adapters/local_storage_service.js +0 -110
- package/dist/storage/adapters/local_storage_service.js.map +0 -1
- package/dist/storage/adapters/ovh_storage_service.d.ts +0 -61
- package/dist/storage/adapters/ovh_storage_service.d.ts.map +0 -1
- package/dist/storage/adapters/ovh_storage_service.js +0 -172
- package/dist/storage/adapters/ovh_storage_service.js.map +0 -1
- package/dist/storage/storage_factory.d.ts +0 -14
- package/dist/storage/storage_factory.d.ts.map +0 -1
- package/dist/storage/storage_factory.js +0 -36
- package/dist/storage/storage_factory.js.map +0 -1
- package/dist/storage/storage_service.d.ts +0 -163
- package/dist/storage/storage_service.d.ts.map +0 -1
- package/dist/storage/storage_service.js +0 -54
- package/dist/storage/storage_service.js.map +0 -1
- package/dist/types/data_record.d.ts +0 -123
- package/dist/types/data_record.d.ts.map +0 -1
- package/dist/types/data_record.js +0 -8
- package/dist/types/data_record.js.map +0 -1
- package/dist/utils/http_responses.d.ts +0 -155
- package/dist/utils/http_responses.d.ts.map +0 -1
- package/dist/utils/http_responses.js +0 -190
- package/dist/utils/http_responses.js.map +0 -1
- package/dist/utils/index.d.ts +0 -8
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -6
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -74
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -92
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/map_to_data_record.d.ts +0 -10
- package/dist/utils/map_to_data_record.d.ts.map +0 -1
- package/dist/utils/map_to_data_record.js +0 -36
- package/dist/utils/map_to_data_record.js.map +0 -1
- package/dist/utils/servable_endpoint.d.ts +0 -63
- package/dist/utils/servable_endpoint.d.ts.map +0 -1
- package/dist/utils/servable_endpoint.js +0 -67
- package/dist/utils/servable_endpoint.js.map +0 -1
- package/dist/utils/zip_utils.d.ts +0 -66
- package/dist/utils/zip_utils.d.ts.map +0 -1
- package/dist/utils/zip_utils.js +0 -169
- package/dist/utils/zip_utils.js.map +0 -1
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Data record type definition for digital twin data storage
|
|
3
|
-
*
|
|
4
|
-
* This module defines the standardized interface for data records used
|
|
5
|
-
* throughout the digital twin system for both streaming data and asset storage.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Standard data record interface for digital twin data storage.
|
|
9
|
-
*
|
|
10
|
-
* DataRecord provides a unified interface for all data stored in the digital twin system,
|
|
11
|
-
* from streaming sensor data to asset files. It supports both database metadata
|
|
12
|
-
* and file storage through a consistent API.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* const record: DataRecord = {
|
|
17
|
-
* id: 12345,
|
|
18
|
-
* name: 'weather-station-001',
|
|
19
|
-
* date: new Date(),
|
|
20
|
-
* contentType: 'application/json',
|
|
21
|
-
* url: '/api/data/weather/12345',
|
|
22
|
-
* data: async () => Buffer.from(JSON.stringify(weatherData)),
|
|
23
|
-
* description: 'Weather data from station 001',
|
|
24
|
-
* source: 'https://api.weather.com/v1/current',
|
|
25
|
-
* owner_id: 123
|
|
26
|
-
* };
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export interface DataRecord {
|
|
30
|
-
/** Unique identifier for this data record */
|
|
31
|
-
id: number;
|
|
32
|
-
/** Human-readable name or identifier for this record */
|
|
33
|
-
name: string;
|
|
34
|
-
/** Timestamp when this record was created or last updated */
|
|
35
|
-
date: Date;
|
|
36
|
-
/** MIME type of the data content (e.g., 'application/json', 'image/png') */
|
|
37
|
-
contentType: string;
|
|
38
|
-
/** URL or path where this record can be accessed */
|
|
39
|
-
url: string;
|
|
40
|
-
/**
|
|
41
|
-
* Function that returns the actual data content as a Buffer.
|
|
42
|
-
*
|
|
43
|
-
* This lazy-loading approach allows for efficient memory usage
|
|
44
|
-
* when working with large datasets or files.
|
|
45
|
-
*
|
|
46
|
-
* @returns Promise resolving to the data content as a Buffer
|
|
47
|
-
*/
|
|
48
|
-
data: () => Promise<Buffer>;
|
|
49
|
-
/**
|
|
50
|
-
* Human-readable description of the asset.
|
|
51
|
-
*
|
|
52
|
-
* Used primarily by AssetsManager components to provide
|
|
53
|
-
* additional context about stored files and resources.
|
|
54
|
-
*/
|
|
55
|
-
description?: string;
|
|
56
|
-
/**
|
|
57
|
-
* Source URL for data provenance.
|
|
58
|
-
*
|
|
59
|
-
* Records the original source of this data for traceability
|
|
60
|
-
* and debugging purposes. Used by AssetsManager components.
|
|
61
|
-
*/
|
|
62
|
-
source?: string;
|
|
63
|
-
/**
|
|
64
|
-
* ID of the user who owns this asset.
|
|
65
|
-
*
|
|
66
|
-
* Enables access control and ownership tracking for
|
|
67
|
-
* asset management. Used by AssetsManager components.
|
|
68
|
-
*/
|
|
69
|
-
owner_id?: number | null;
|
|
70
|
-
/**
|
|
71
|
-
* Original filename provided by the user.
|
|
72
|
-
*
|
|
73
|
-
* Preserves the original filename when assets are uploaded
|
|
74
|
-
* or imported. Used by AssetsManager components.
|
|
75
|
-
*/
|
|
76
|
-
filename?: string;
|
|
77
|
-
/**
|
|
78
|
-
* Whether the asset is publicly accessible.
|
|
79
|
-
*
|
|
80
|
-
* Controls visibility of assets. If true, asset can be accessed
|
|
81
|
-
* by anyone. If false, only the owner can access it.
|
|
82
|
-
* Used by AssetsManager components for access control.
|
|
83
|
-
*/
|
|
84
|
-
is_public?: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Public URL to tileset.json for Cesium loading.
|
|
87
|
-
* Cesium accesses files directly via this URL.
|
|
88
|
-
*/
|
|
89
|
-
tileset_url?: string;
|
|
90
|
-
/**
|
|
91
|
-
* @deprecated No longer used. Kept for backward compatibility.
|
|
92
|
-
*/
|
|
93
|
-
file_index?: {
|
|
94
|
-
/** List of files with their storage paths */
|
|
95
|
-
files: Array<{
|
|
96
|
-
/** Storage path for this file */
|
|
97
|
-
path: string;
|
|
98
|
-
/** Original filename */
|
|
99
|
-
name: string;
|
|
100
|
-
/** File size in bytes */
|
|
101
|
-
size?: number;
|
|
102
|
-
}>;
|
|
103
|
-
/** Main entry point file (e.g., 'tileset.json') */
|
|
104
|
-
root_file?: string;
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Status of async upload processing.
|
|
108
|
-
* - 'pending': Job queued, waiting to start
|
|
109
|
-
* - 'processing': Job is running
|
|
110
|
-
* - 'completed': Job finished successfully
|
|
111
|
-
* - 'failed': Job failed with error
|
|
112
|
-
*/
|
|
113
|
-
upload_status?: 'pending' | 'processing' | 'completed' | 'failed' | null;
|
|
114
|
-
/**
|
|
115
|
-
* Error message if upload failed.
|
|
116
|
-
*/
|
|
117
|
-
upload_error?: string | null;
|
|
118
|
-
/**
|
|
119
|
-
* BullMQ job ID for tracking.
|
|
120
|
-
*/
|
|
121
|
-
upload_job_id?: string | null;
|
|
122
|
-
}
|
|
123
|
-
//# sourceMappingURL=data_record.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data_record.d.ts","sourceRoot":"","sources":["../../src/types/data_record.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,UAAU;IACvB,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAA;IAEV,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAA;IAEZ,6DAA6D;IAC7D,IAAI,EAAE,IAAI,CAAA;IAEV,4EAA4E;IAC5E,WAAW,EAAE,MAAM,CAAA;IAEnB,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAA;IAEX;;;;;;;OAOG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;IAI3B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAExB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IAInB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAIpB;;OAEG;IACH,UAAU,CAAC,EAAE;QACT,6CAA6C;QAC7C,KAAK,EAAE,KAAK,CAAC;YACT,iCAAiC;YACjC,IAAI,EAAE,MAAM,CAAA;YACZ,wBAAwB;YACxB,IAAI,EAAE,MAAM,CAAA;YACZ,yBAAyB;YACzB,IAAI,CAAC,EAAE,MAAM,CAAA;SAChB,CAAC,CAAA;QACF,mDAAmD;QACnD,SAAS,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;IAID;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,QAAQ,GAAG,IAAI,CAAA;IAExE;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAE5B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Data record type definition for digital twin data storage
|
|
3
|
-
*
|
|
4
|
-
* This module defines the standardized interface for data records used
|
|
5
|
-
* throughout the digital twin system for both streaming data and asset storage.
|
|
6
|
-
*/
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=data_record.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data_record.js","sourceRoot":"","sources":["../../src/types/data_record.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview HTTP response utilities for consistent API responses
|
|
3
|
-
*
|
|
4
|
-
* This module provides helper functions to create standardized DataResponse objects,
|
|
5
|
-
* reducing boilerplate code in component handlers and ensuring consistent API responses.
|
|
6
|
-
*/
|
|
7
|
-
import type { DataResponse } from '../components/types.js';
|
|
8
|
-
/**
|
|
9
|
-
* HTTP status codes commonly used in the Digital Twin framework.
|
|
10
|
-
*/
|
|
11
|
-
export declare const HttpStatus: {
|
|
12
|
-
readonly OK: 200;
|
|
13
|
-
readonly CREATED: 201;
|
|
14
|
-
readonly MULTI_STATUS: 207;
|
|
15
|
-
readonly BAD_REQUEST: 400;
|
|
16
|
-
readonly UNAUTHORIZED: 401;
|
|
17
|
-
readonly FORBIDDEN: 403;
|
|
18
|
-
readonly NOT_FOUND: 404;
|
|
19
|
-
readonly INTERNAL_SERVER_ERROR: 500;
|
|
20
|
-
};
|
|
21
|
-
export type HttpStatusCode = (typeof HttpStatus)[keyof typeof HttpStatus];
|
|
22
|
-
/**
|
|
23
|
-
* Creates a JSON response with the specified status and data.
|
|
24
|
-
*
|
|
25
|
-
* @param status - HTTP status code
|
|
26
|
-
* @param data - Data to serialize as JSON
|
|
27
|
-
* @returns DataResponse with JSON content type
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* return jsonResponse(200, { message: 'Success' })
|
|
32
|
-
* return jsonResponse(400, { error: 'Invalid input' })
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare function jsonResponse(status: number, data: object): DataResponse;
|
|
36
|
-
/**
|
|
37
|
-
* Creates a successful JSON response (HTTP 200).
|
|
38
|
-
*
|
|
39
|
-
* @param data - Data to serialize as JSON
|
|
40
|
-
* @returns DataResponse with status 200
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```typescript
|
|
44
|
-
* return successResponse({ message: 'Asset uploaded successfully' })
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export declare function successResponse(data: object): DataResponse;
|
|
48
|
-
/**
|
|
49
|
-
* Creates an error response from an Error object or string.
|
|
50
|
-
*
|
|
51
|
-
* @param error - Error object or error message string
|
|
52
|
-
* @param status - HTTP status code (default: 500)
|
|
53
|
-
* @returns DataResponse with error message
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```typescript
|
|
57
|
-
* return errorResponse(new Error('Something went wrong'))
|
|
58
|
-
* return errorResponse('Invalid input', 400)
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
export declare function errorResponse(error: unknown, status?: number): DataResponse;
|
|
62
|
-
/**
|
|
63
|
-
* Creates a 400 Bad Request response.
|
|
64
|
-
*
|
|
65
|
-
* @param message - Error message describing what's wrong with the request
|
|
66
|
-
* @returns DataResponse with status 400
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```typescript
|
|
70
|
-
* return badRequestResponse('Missing required fields: description, source')
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
73
|
-
export declare function badRequestResponse(message: string): DataResponse;
|
|
74
|
-
/**
|
|
75
|
-
* Creates a 401 Unauthorized response.
|
|
76
|
-
*
|
|
77
|
-
* @param message - Error message (default: 'Authentication required')
|
|
78
|
-
* @returns DataResponse with status 401
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```typescript
|
|
82
|
-
* return unauthorizedResponse()
|
|
83
|
-
* return unauthorizedResponse('Invalid authentication headers')
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
export declare function unauthorizedResponse(message?: string): DataResponse;
|
|
87
|
-
/**
|
|
88
|
-
* Creates a 403 Forbidden response.
|
|
89
|
-
*
|
|
90
|
-
* @param message - Error message describing why access is denied
|
|
91
|
-
* @returns DataResponse with status 403
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* ```typescript
|
|
95
|
-
* return forbiddenResponse('You can only modify your own assets')
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
export declare function forbiddenResponse(message: string): DataResponse;
|
|
99
|
-
/**
|
|
100
|
-
* Creates a 404 Not Found response.
|
|
101
|
-
*
|
|
102
|
-
* @param message - Error message (default: 'Resource not found')
|
|
103
|
-
* @returns DataResponse with status 404
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```typescript
|
|
107
|
-
* return notFoundResponse('Asset not found')
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
export declare function notFoundResponse(message?: string): DataResponse;
|
|
111
|
-
/**
|
|
112
|
-
* Creates a plain text response.
|
|
113
|
-
*
|
|
114
|
-
* @param status - HTTP status code
|
|
115
|
-
* @param content - Text content
|
|
116
|
-
* @returns DataResponse with text/plain content type
|
|
117
|
-
*
|
|
118
|
-
* @example
|
|
119
|
-
* ```typescript
|
|
120
|
-
* return textResponse(404, 'Asset not found')
|
|
121
|
-
* ```
|
|
122
|
-
*/
|
|
123
|
-
export declare function textResponse(status: number, content: string): DataResponse;
|
|
124
|
-
/**
|
|
125
|
-
* Creates a binary/file response.
|
|
126
|
-
*
|
|
127
|
-
* @param content - File content as Buffer
|
|
128
|
-
* @param contentType - MIME type of the file
|
|
129
|
-
* @param filename - Optional filename for Content-Disposition header (triggers download)
|
|
130
|
-
* @returns DataResponse with appropriate content type
|
|
131
|
-
*
|
|
132
|
-
* @example
|
|
133
|
-
* ```typescript
|
|
134
|
-
* // For display/use in browser
|
|
135
|
-
* return fileResponse(buffer, 'model/gltf-binary')
|
|
136
|
-
*
|
|
137
|
-
* // For download
|
|
138
|
-
* return fileResponse(buffer, 'model/gltf-binary', 'model.glb')
|
|
139
|
-
* ```
|
|
140
|
-
*/
|
|
141
|
-
export declare function fileResponse(content: Buffer, contentType: string, filename?: string): DataResponse;
|
|
142
|
-
/**
|
|
143
|
-
* Creates a 207 Multi-Status response for batch operations.
|
|
144
|
-
*
|
|
145
|
-
* @param message - Summary message
|
|
146
|
-
* @param results - Array of individual operation results
|
|
147
|
-
* @returns DataResponse with status 207
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* ```typescript
|
|
151
|
-
* return multiStatusResponse('3/5 assets uploaded successfully', results)
|
|
152
|
-
* ```
|
|
153
|
-
*/
|
|
154
|
-
export declare function multiStatusResponse(message: string, results: unknown[]): DataResponse;
|
|
155
|
-
//# sourceMappingURL=http_responses.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http_responses.d.ts","sourceRoot":"","sources":["../../src/utils/http_responses.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAE1D;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;CASb,CAAA;AAEV,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAA;AAEzE;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAMvE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAE1D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,GAAE,MAAyC,GAAG,YAAY,CAG7G;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAEhE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,MAAkC,GAAG,YAAY,CAE9F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAE/D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,MAA6B,GAAG,YAAY,CAErF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,CAM1E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,YAAY,CAYlG;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,YAAY,CAErF"}
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview HTTP response utilities for consistent API responses
|
|
3
|
-
*
|
|
4
|
-
* This module provides helper functions to create standardized DataResponse objects,
|
|
5
|
-
* reducing boilerplate code in component handlers and ensuring consistent API responses.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* HTTP status codes commonly used in the Digital Twin framework.
|
|
9
|
-
*/
|
|
10
|
-
export const HttpStatus = {
|
|
11
|
-
OK: 200,
|
|
12
|
-
CREATED: 201,
|
|
13
|
-
MULTI_STATUS: 207,
|
|
14
|
-
BAD_REQUEST: 400,
|
|
15
|
-
UNAUTHORIZED: 401,
|
|
16
|
-
FORBIDDEN: 403,
|
|
17
|
-
NOT_FOUND: 404,
|
|
18
|
-
INTERNAL_SERVER_ERROR: 500
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Creates a JSON response with the specified status and data.
|
|
22
|
-
*
|
|
23
|
-
* @param status - HTTP status code
|
|
24
|
-
* @param data - Data to serialize as JSON
|
|
25
|
-
* @returns DataResponse with JSON content type
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* return jsonResponse(200, { message: 'Success' })
|
|
30
|
-
* return jsonResponse(400, { error: 'Invalid input' })
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export function jsonResponse(status, data) {
|
|
34
|
-
return {
|
|
35
|
-
status,
|
|
36
|
-
content: JSON.stringify(data),
|
|
37
|
-
headers: { 'Content-Type': 'application/json' }
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Creates a successful JSON response (HTTP 200).
|
|
42
|
-
*
|
|
43
|
-
* @param data - Data to serialize as JSON
|
|
44
|
-
* @returns DataResponse with status 200
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```typescript
|
|
48
|
-
* return successResponse({ message: 'Asset uploaded successfully' })
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
export function successResponse(data) {
|
|
52
|
-
return jsonResponse(HttpStatus.OK, data);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Creates an error response from an Error object or string.
|
|
56
|
-
*
|
|
57
|
-
* @param error - Error object or error message string
|
|
58
|
-
* @param status - HTTP status code (default: 500)
|
|
59
|
-
* @returns DataResponse with error message
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```typescript
|
|
63
|
-
* return errorResponse(new Error('Something went wrong'))
|
|
64
|
-
* return errorResponse('Invalid input', 400)
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
export function errorResponse(error, status = HttpStatus.INTERNAL_SERVER_ERROR) {
|
|
68
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
69
|
-
return jsonResponse(status, { error: message });
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Creates a 400 Bad Request response.
|
|
73
|
-
*
|
|
74
|
-
* @param message - Error message describing what's wrong with the request
|
|
75
|
-
* @returns DataResponse with status 400
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```typescript
|
|
79
|
-
* return badRequestResponse('Missing required fields: description, source')
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
export function badRequestResponse(message) {
|
|
83
|
-
return jsonResponse(HttpStatus.BAD_REQUEST, { error: message });
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Creates a 401 Unauthorized response.
|
|
87
|
-
*
|
|
88
|
-
* @param message - Error message (default: 'Authentication required')
|
|
89
|
-
* @returns DataResponse with status 401
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* ```typescript
|
|
93
|
-
* return unauthorizedResponse()
|
|
94
|
-
* return unauthorizedResponse('Invalid authentication headers')
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
export function unauthorizedResponse(message = 'Authentication required') {
|
|
98
|
-
return jsonResponse(HttpStatus.UNAUTHORIZED, { error: message });
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Creates a 403 Forbidden response.
|
|
102
|
-
*
|
|
103
|
-
* @param message - Error message describing why access is denied
|
|
104
|
-
* @returns DataResponse with status 403
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* ```typescript
|
|
108
|
-
* return forbiddenResponse('You can only modify your own assets')
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
export function forbiddenResponse(message) {
|
|
112
|
-
return jsonResponse(HttpStatus.FORBIDDEN, { error: message });
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Creates a 404 Not Found response.
|
|
116
|
-
*
|
|
117
|
-
* @param message - Error message (default: 'Resource not found')
|
|
118
|
-
* @returns DataResponse with status 404
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
* ```typescript
|
|
122
|
-
* return notFoundResponse('Asset not found')
|
|
123
|
-
* ```
|
|
124
|
-
*/
|
|
125
|
-
export function notFoundResponse(message = 'Resource not found') {
|
|
126
|
-
return jsonResponse(HttpStatus.NOT_FOUND, { error: message });
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Creates a plain text response.
|
|
130
|
-
*
|
|
131
|
-
* @param status - HTTP status code
|
|
132
|
-
* @param content - Text content
|
|
133
|
-
* @returns DataResponse with text/plain content type
|
|
134
|
-
*
|
|
135
|
-
* @example
|
|
136
|
-
* ```typescript
|
|
137
|
-
* return textResponse(404, 'Asset not found')
|
|
138
|
-
* ```
|
|
139
|
-
*/
|
|
140
|
-
export function textResponse(status, content) {
|
|
141
|
-
return {
|
|
142
|
-
status,
|
|
143
|
-
content,
|
|
144
|
-
headers: { 'Content-Type': 'text/plain' }
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Creates a binary/file response.
|
|
149
|
-
*
|
|
150
|
-
* @param content - File content as Buffer
|
|
151
|
-
* @param contentType - MIME type of the file
|
|
152
|
-
* @param filename - Optional filename for Content-Disposition header (triggers download)
|
|
153
|
-
* @returns DataResponse with appropriate content type
|
|
154
|
-
*
|
|
155
|
-
* @example
|
|
156
|
-
* ```typescript
|
|
157
|
-
* // For display/use in browser
|
|
158
|
-
* return fileResponse(buffer, 'model/gltf-binary')
|
|
159
|
-
*
|
|
160
|
-
* // For download
|
|
161
|
-
* return fileResponse(buffer, 'model/gltf-binary', 'model.glb')
|
|
162
|
-
* ```
|
|
163
|
-
*/
|
|
164
|
-
export function fileResponse(content, contentType, filename) {
|
|
165
|
-
const headers = { 'Content-Type': contentType };
|
|
166
|
-
if (filename) {
|
|
167
|
-
headers['Content-Disposition'] = `attachment; filename="${filename}"`;
|
|
168
|
-
}
|
|
169
|
-
return {
|
|
170
|
-
status: HttpStatus.OK,
|
|
171
|
-
content,
|
|
172
|
-
headers
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Creates a 207 Multi-Status response for batch operations.
|
|
177
|
-
*
|
|
178
|
-
* @param message - Summary message
|
|
179
|
-
* @param results - Array of individual operation results
|
|
180
|
-
* @returns DataResponse with status 207
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* ```typescript
|
|
184
|
-
* return multiStatusResponse('3/5 assets uploaded successfully', results)
|
|
185
|
-
* ```
|
|
186
|
-
*/
|
|
187
|
-
export function multiStatusResponse(message, results) {
|
|
188
|
-
return jsonResponse(HttpStatus.MULTI_STATUS, { message, results });
|
|
189
|
-
}
|
|
190
|
-
//# sourceMappingURL=http_responses.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http_responses.js","sourceRoot":"","sources":["../../src/utils/http_responses.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB,EAAE,EAAE,GAAG;IACP,OAAO,EAAE,GAAG;IACZ,YAAY,EAAE,GAAG;IACjB,WAAW,EAAE,GAAG;IAChB,YAAY,EAAE,GAAG;IACjB,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,qBAAqB,EAAE,GAAG;CACpB,CAAA;AAIV;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,IAAY;IACrD,OAAO;QACH,MAAM;QACN,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QAC7B,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;KAClD,CAAA;AACL,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IACxC,OAAO,YAAY,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;AAC5C,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc,EAAE,SAAiB,UAAU,CAAC,qBAAqB;IAC3F,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACtE,OAAO,YAAY,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;AACnD,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAC9C,OAAO,YAAY,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;AACnE,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAkB,yBAAyB;IAC5E,OAAO,YAAY,CAAC,UAAU,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;AACpE,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC7C,OAAO,YAAY,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;AACjE,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAkB,oBAAoB;IACnE,OAAO,YAAY,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;AACjE,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,OAAe;IACxD,OAAO;QACH,MAAM;QACN,OAAO;QACP,OAAO,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE;KAC5C,CAAA;AACL,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,WAAmB,EAAE,QAAiB;IAChF,MAAM,OAAO,GAA2B,EAAE,cAAc,EAAE,WAAW,EAAE,CAAA;IAEvE,IAAI,QAAQ,EAAE,CAAC;QACX,OAAO,CAAC,qBAAqB,CAAC,GAAG,yBAAyB,QAAQ,GAAG,CAAA;IACzE,CAAC;IAED,OAAO;QACH,MAAM,EAAE,UAAU,CAAC,EAAE;QACrB,OAAO;QACP,OAAO;KACV,CAAA;AACL,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,OAAkB;IACnE,OAAO,YAAY,CAAC,UAAU,CAAC,YAAY,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAA;AACtE,CAAC"}
|
package/dist/utils/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { Logger, LogLevel } from './logger.js';
|
|
2
|
-
export { mapToDataRecord } from './map_to_data_record.js';
|
|
3
|
-
export { servableEndpoint } from './servable_endpoint.js';
|
|
4
|
-
export { extractZipContentStream, zipToDict, detectTilesetRootFile, normalizeArchivePaths, extractAndStoreArchive } from './zip_utils.js';
|
|
5
|
-
export type { ExtractedArchiveResult } from './zip_utils.js';
|
|
6
|
-
export { HttpStatus, jsonResponse, successResponse, errorResponse, badRequestResponse, unauthorizedResponse, forbiddenResponse, notFoundResponse, textResponse, fileResponse, multiStatusResponse } from './http_responses.js';
|
|
7
|
-
export type { HttpStatusCode } from './http_responses.js';
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EACH,uBAAuB,EACvB,SAAS,EACT,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACzB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAC5D,OAAO,EACH,UAAU,EACV,YAAY,EACZ,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACtB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA"}
|
package/dist/utils/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { Logger, LogLevel } from './logger.js';
|
|
2
|
-
export { mapToDataRecord } from './map_to_data_record.js';
|
|
3
|
-
export { servableEndpoint } from './servable_endpoint.js';
|
|
4
|
-
export { extractZipContentStream, zipToDict, detectTilesetRootFile, normalizeArchivePaths, extractAndStoreArchive } from './zip_utils.js';
|
|
5
|
-
export { HttpStatus, jsonResponse, successResponse, errorResponse, badRequestResponse, unauthorizedResponse, forbiddenResponse, notFoundResponse, textResponse, fileResponse, multiStatusResponse } from './http_responses.js';
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EACH,uBAAuB,EACvB,SAAS,EACT,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACzB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EACH,UAAU,EACV,YAAY,EACZ,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACtB,MAAM,qBAAqB,CAAA"}
|
package/dist/utils/logger.d.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enumeration of available logging levels.
|
|
3
|
-
*
|
|
4
|
-
* Levels are ordered by severity, with lower numbers being more verbose.
|
|
5
|
-
*
|
|
6
|
-
* @enum {number}
|
|
7
|
-
*/
|
|
8
|
-
export declare enum LogLevel {
|
|
9
|
-
/** Debug messages - most verbose, includes internal state information */
|
|
10
|
-
DEBUG = 0,
|
|
11
|
-
/** Informational messages - general application flow */
|
|
12
|
-
INFO = 1,
|
|
13
|
-
/** Warning messages - potential issues that don't prevent operation */
|
|
14
|
-
WARN = 2,
|
|
15
|
-
/** Error messages - failures that affect functionality */
|
|
16
|
-
ERROR = 3,
|
|
17
|
-
/** Silent mode - no logging output */
|
|
18
|
-
SILENT = 4
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Simple logger class for Digital Twin framework components.
|
|
22
|
-
*
|
|
23
|
-
* Provides structured logging with component identification and configurable levels.
|
|
24
|
-
* Automatically adjusts log level based on environment (silent in tests).
|
|
25
|
-
*
|
|
26
|
-
* @class Logger
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```typescript
|
|
30
|
-
* const logger = new Logger('MyCollector', LogLevel.DEBUG)
|
|
31
|
-
* logger.info('Starting data collection')
|
|
32
|
-
* logger.error('Failed to connect', error)
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare class Logger {
|
|
36
|
-
private readonly componentName;
|
|
37
|
-
private readonly level;
|
|
38
|
-
/**
|
|
39
|
-
* Creates a new logger instance for a component.
|
|
40
|
-
*
|
|
41
|
-
* @param {string} componentName - Name of the component for log prefixing
|
|
42
|
-
* @param {LogLevel} level - Minimum log level to output (defaults based on NODE_ENV)
|
|
43
|
-
*/
|
|
44
|
-
constructor(componentName: string, level?: LogLevel);
|
|
45
|
-
/**
|
|
46
|
-
* Logs debug information for development and troubleshooting.
|
|
47
|
-
*
|
|
48
|
-
* @param {string} message - Debug message
|
|
49
|
-
* @param {any} data - Optional additional data to log
|
|
50
|
-
*/
|
|
51
|
-
debug(message: string, data?: any): void;
|
|
52
|
-
/**
|
|
53
|
-
* Logs informational messages about normal operation.
|
|
54
|
-
*
|
|
55
|
-
* @param {string} message - Information message
|
|
56
|
-
* @param {any} data - Optional additional data to log
|
|
57
|
-
*/
|
|
58
|
-
info(message: string, data?: any): void;
|
|
59
|
-
/**
|
|
60
|
-
* Logs warning messages about potential issues.
|
|
61
|
-
*
|
|
62
|
-
* @param {string} message - Warning message
|
|
63
|
-
* @param {any} data - Optional additional data to log
|
|
64
|
-
*/
|
|
65
|
-
warn(message: string, data?: any): void;
|
|
66
|
-
/**
|
|
67
|
-
* Logs error messages about failures and exceptions.
|
|
68
|
-
*
|
|
69
|
-
* @param {string} message - Error message
|
|
70
|
-
* @param {any} error - Optional error object or additional data
|
|
71
|
-
*/
|
|
72
|
-
error(message: string, error?: any): void;
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,oBAAY,QAAQ;IAChB,yEAAyE;IACzE,KAAK,IAAI;IACT,wDAAwD;IACxD,IAAI,IAAI;IACR,uEAAuE;IACvE,IAAI,IAAI;IACR,0DAA0D;IAC1D,KAAK,IAAI;IACT,sCAAsC;IACtC,MAAM,IAAI;CACb;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,MAAM;IAQX,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,KAAK;IAR1B;;;;;OAKG;gBAEkB,aAAa,EAAE,MAAM,EACrB,KAAK,GAAE,QAA2E;IAGvG;;;;;OAKG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAMjC;;;;;OAKG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAMhC;;;;;OAKG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAMhC;;;;;OAKG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;CAKrC"}
|