digitaltwin-core 0.14.0 → 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 -72
- package/dist/storage/adapters/ovh_storage_service.d.ts.map +0 -1
- package/dist/storage/adapters/ovh_storage_service.js +0 -206
- 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 -40
- 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
package/dist/utils/logger.js
DELETED
|
@@ -1,92 +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 var LogLevel;
|
|
9
|
-
(function (LogLevel) {
|
|
10
|
-
/** Debug messages - most verbose, includes internal state information */
|
|
11
|
-
LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
|
|
12
|
-
/** Informational messages - general application flow */
|
|
13
|
-
LogLevel[LogLevel["INFO"] = 1] = "INFO";
|
|
14
|
-
/** Warning messages - potential issues that don't prevent operation */
|
|
15
|
-
LogLevel[LogLevel["WARN"] = 2] = "WARN";
|
|
16
|
-
/** Error messages - failures that affect functionality */
|
|
17
|
-
LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
|
|
18
|
-
/** Silent mode - no logging output */
|
|
19
|
-
LogLevel[LogLevel["SILENT"] = 4] = "SILENT";
|
|
20
|
-
})(LogLevel || (LogLevel = {}));
|
|
21
|
-
/**
|
|
22
|
-
* Simple logger class for Digital Twin framework components.
|
|
23
|
-
*
|
|
24
|
-
* Provides structured logging with component identification and configurable levels.
|
|
25
|
-
* Automatically adjusts log level based on environment (silent in tests).
|
|
26
|
-
*
|
|
27
|
-
* @class Logger
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* const logger = new Logger('MyCollector', LogLevel.DEBUG)
|
|
32
|
-
* logger.info('Starting data collection')
|
|
33
|
-
* logger.error('Failed to connect', error)
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export class Logger {
|
|
37
|
-
/**
|
|
38
|
-
* Creates a new logger instance for a component.
|
|
39
|
-
*
|
|
40
|
-
* @param {string} componentName - Name of the component for log prefixing
|
|
41
|
-
* @param {LogLevel} level - Minimum log level to output (defaults based on NODE_ENV)
|
|
42
|
-
*/
|
|
43
|
-
constructor(componentName, level = process.env.NODE_ENV === 'test' ? LogLevel.ERROR : LogLevel.INFO) {
|
|
44
|
-
this.componentName = componentName;
|
|
45
|
-
this.level = level;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Logs debug information for development and troubleshooting.
|
|
49
|
-
*
|
|
50
|
-
* @param {string} message - Debug message
|
|
51
|
-
* @param {any} data - Optional additional data to log
|
|
52
|
-
*/
|
|
53
|
-
debug(message, data) {
|
|
54
|
-
if (this.level <= LogLevel.DEBUG) {
|
|
55
|
-
console.log(`[${this.componentName}] DEBUG: ${message}`, data || '');
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Logs informational messages about normal operation.
|
|
60
|
-
*
|
|
61
|
-
* @param {string} message - Information message
|
|
62
|
-
* @param {any} data - Optional additional data to log
|
|
63
|
-
*/
|
|
64
|
-
info(message, data) {
|
|
65
|
-
if (this.level <= LogLevel.INFO) {
|
|
66
|
-
console.log(`[${this.componentName}] ${message}`, data || '');
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Logs warning messages about potential issues.
|
|
71
|
-
*
|
|
72
|
-
* @param {string} message - Warning message
|
|
73
|
-
* @param {any} data - Optional additional data to log
|
|
74
|
-
*/
|
|
75
|
-
warn(message, data) {
|
|
76
|
-
if (this.level <= LogLevel.WARN) {
|
|
77
|
-
console.warn(`[${this.componentName}] WARN: ${message}`, data || '');
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Logs error messages about failures and exceptions.
|
|
82
|
-
*
|
|
83
|
-
* @param {string} message - Error message
|
|
84
|
-
* @param {any} error - Optional error object or additional data
|
|
85
|
-
*/
|
|
86
|
-
error(message, error) {
|
|
87
|
-
if (this.level <= LogLevel.ERROR) {
|
|
88
|
-
console.error(`[${this.componentName}] ERROR: ${message}`, error || '');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=logger.js.map
|
package/dist/utils/logger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
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AQ,CAAC,IAAI,EAAE,CAAC;YAC9B,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,aAAa,WAAW,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,CAAA;QACxE,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAe,EAAE,KAAW;QAC9B,IAAI,IAAI,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;YAC/B,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,aAAa,YAAY,OAAO,EAAE,EAAE,KAAK,IAAI,EAAE,CAAC,CAAA;QAC3E,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { StorageService } from '../storage/storage_service.js';
|
|
2
|
-
import type { DataRecord } from '../types/data_record.js';
|
|
3
|
-
import type { MetadataRow } from '../database/database_adapter.js';
|
|
4
|
-
/**
|
|
5
|
-
* Convert a DB metadata row to a full DataRecord with lazy-loaded blob.
|
|
6
|
-
*
|
|
7
|
-
* Also maps asset-specific fields if present (for AssetsManager components).
|
|
8
|
-
*/
|
|
9
|
-
export declare function mapToDataRecord(row: MetadataRow | any, storage: StorageService): DataRecord;
|
|
10
|
-
//# sourceMappingURL=map_to_data_record.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"map_to_data_record.d.ts","sourceRoot":"","sources":["../../src/utils/map_to_data_record.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAElE;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,GAAG,GAAG,EAAE,OAAO,EAAE,cAAc,GAAG,UAAU,CAiC3F"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert a DB metadata row to a full DataRecord with lazy-loaded blob.
|
|
3
|
-
*
|
|
4
|
-
* Also maps asset-specific fields if present (for AssetsManager components).
|
|
5
|
-
*/
|
|
6
|
-
export function mapToDataRecord(row, storage) {
|
|
7
|
-
return {
|
|
8
|
-
id: row.id,
|
|
9
|
-
name: row.name,
|
|
10
|
-
date: new Date(row.date),
|
|
11
|
-
contentType: row.type,
|
|
12
|
-
url: row.url,
|
|
13
|
-
data: () => storage.retrieve(row.url),
|
|
14
|
-
// Asset-specific fields (optional, only for AssetsManager)
|
|
15
|
-
description: row.description,
|
|
16
|
-
source: row.source,
|
|
17
|
-
owner_id: row.owner_id,
|
|
18
|
-
filename: row.filename,
|
|
19
|
-
// Default to true for backward compatibility with records created before is_public column
|
|
20
|
-
// SQLite stores booleans as 0/1, so we normalize to proper boolean
|
|
21
|
-
is_public: row.is_public === undefined || row.is_public === null ? true : Boolean(row.is_public),
|
|
22
|
-
// TilesetManager support
|
|
23
|
-
tileset_url: row.tileset_url || undefined,
|
|
24
|
-
// Legacy (deprecated)
|
|
25
|
-
file_index: row.file_index
|
|
26
|
-
? typeof row.file_index === 'string'
|
|
27
|
-
? JSON.parse(row.file_index)
|
|
28
|
-
: row.file_index
|
|
29
|
-
: undefined,
|
|
30
|
-
// Async upload support
|
|
31
|
-
upload_status: row.upload_status || null,
|
|
32
|
-
upload_error: row.upload_error || null,
|
|
33
|
-
upload_job_id: row.upload_job_id || null
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=map_to_data_record.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"map_to_data_record.js","sourceRoot":"","sources":["../../src/utils/map_to_data_record.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,GAAsB,EAAE,OAAuB;IAC3E,OAAO;QACH,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,IAAI,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;QACxB,WAAW,EAAE,GAAG,CAAC,IAAI;QACrB,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;QAErC,2DAA2D;QAC3D,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,0FAA0F;QAC1F,mEAAmE;QACnE,SAAS,EAAE,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,GAAG,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;QAEhG,yBAAyB;QACzB,WAAW,EAAE,GAAG,CAAC,WAAW,IAAI,SAAS;QAEzC,sBAAsB;QACtB,UAAU,EAAE,GAAG,CAAC,UAAU;YACtB,CAAC,CAAC,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ;gBAChC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC;gBAC5B,CAAC,CAAC,GAAG,CAAC,UAAU;YACpB,CAAC,CAAC,SAAS;QAEf,uBAAuB;QACvB,aAAa,EAAE,GAAG,CAAC,aAAa,IAAI,IAAI;QACxC,YAAY,EAAE,GAAG,CAAC,YAAY,IAAI,IAAI;QACtC,aAAa,EAAE,GAAG,CAAC,aAAa,IAAI,IAAI;KAC3C,CAAA;AACL,CAAC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Decorator for marking methods as HTTP endpoint handlers
|
|
3
|
-
*
|
|
4
|
-
* This utility provides a decorator to annotate component methods as HTTP endpoints
|
|
5
|
-
* that should be automatically registered with the digital twin engine's router.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Configuration interface for the servable endpoint decorator.
|
|
9
|
-
*/
|
|
10
|
-
interface ServableEndpointConfig {
|
|
11
|
-
/** URL path for this endpoint (e.g., '/api/data/:id') */
|
|
12
|
-
path: string;
|
|
13
|
-
/** HTTP method (defaults to 'get') */
|
|
14
|
-
method?: string;
|
|
15
|
-
/** Response content type (defaults to 'application/json') */
|
|
16
|
-
responseType?: string;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Decorator that marks a method as an HTTP endpoint handler.
|
|
20
|
-
*
|
|
21
|
-
* This decorator allows component methods to be automatically discovered
|
|
22
|
-
* and registered as HTTP endpoints by the digital twin engine. The decorated
|
|
23
|
-
* method will be called when HTTP requests are made to the specified path.
|
|
24
|
-
*
|
|
25
|
-
* @param config - Configuration object specifying the endpoint details
|
|
26
|
-
* @param config.path - URL path pattern for this endpoint
|
|
27
|
-
* @param config.method - HTTP method (defaults to 'GET')
|
|
28
|
-
* @param config.responseType - Response content type (defaults to 'application/json')
|
|
29
|
-
*
|
|
30
|
-
* @returns Method decorator function
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```typescript
|
|
34
|
-
* class WeatherCollector extends Collector {
|
|
35
|
-
* @servableEndpoint({
|
|
36
|
-
* path: '/api/weather/current',
|
|
37
|
-
* method: 'get',
|
|
38
|
-
* responseType: 'application/json'
|
|
39
|
-
* })
|
|
40
|
-
* getCurrentWeather(req: Request) {
|
|
41
|
-
* return {
|
|
42
|
-
* status: 200,
|
|
43
|
-
* content: { temperature: 22, humidity: 65 }
|
|
44
|
-
* };
|
|
45
|
-
* }
|
|
46
|
-
*
|
|
47
|
-
* @servableEndpoint({
|
|
48
|
-
* path: '/api/weather/history/:date',
|
|
49
|
-
* method: 'get'
|
|
50
|
-
* })
|
|
51
|
-
* getWeatherHistory(req: Request) {
|
|
52
|
-
* const date = req.params.date;
|
|
53
|
-
* return {
|
|
54
|
-
* status: 200,
|
|
55
|
-
* content: this.getHistoricalData(date)
|
|
56
|
-
* };
|
|
57
|
-
* }
|
|
58
|
-
* }
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
export declare function servableEndpoint(config: ServableEndpointConfig): (target: any, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => any;
|
|
62
|
-
export {};
|
|
63
|
-
//# sourceMappingURL=servable_endpoint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"servable_endpoint.d.ts","sourceRoot":"","sources":["../../src/utils/servable_endpoint.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,UAAU,sBAAsB;IAC5B,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAA;IAEZ,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,IAC1C,QAAQ,GAAG,EAAE,aAAa,MAAM,GAAG,MAAM,EAAE,aAAa,kBAAkB,KAAG,GAAG,CAkBpG"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Decorator for marking methods as HTTP endpoint handlers
|
|
3
|
-
*
|
|
4
|
-
* This utility provides a decorator to annotate component methods as HTTP endpoints
|
|
5
|
-
* that should be automatically registered with the digital twin engine's router.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Decorator that marks a method as an HTTP endpoint handler.
|
|
9
|
-
*
|
|
10
|
-
* This decorator allows component methods to be automatically discovered
|
|
11
|
-
* and registered as HTTP endpoints by the digital twin engine. The decorated
|
|
12
|
-
* method will be called when HTTP requests are made to the specified path.
|
|
13
|
-
*
|
|
14
|
-
* @param config - Configuration object specifying the endpoint details
|
|
15
|
-
* @param config.path - URL path pattern for this endpoint
|
|
16
|
-
* @param config.method - HTTP method (defaults to 'GET')
|
|
17
|
-
* @param config.responseType - Response content type (defaults to 'application/json')
|
|
18
|
-
*
|
|
19
|
-
* @returns Method decorator function
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* class WeatherCollector extends Collector {
|
|
24
|
-
* @servableEndpoint({
|
|
25
|
-
* path: '/api/weather/current',
|
|
26
|
-
* method: 'get',
|
|
27
|
-
* responseType: 'application/json'
|
|
28
|
-
* })
|
|
29
|
-
* getCurrentWeather(req: Request) {
|
|
30
|
-
* return {
|
|
31
|
-
* status: 200,
|
|
32
|
-
* content: { temperature: 22, humidity: 65 }
|
|
33
|
-
* };
|
|
34
|
-
* }
|
|
35
|
-
*
|
|
36
|
-
* @servableEndpoint({
|
|
37
|
-
* path: '/api/weather/history/:date',
|
|
38
|
-
* method: 'get'
|
|
39
|
-
* })
|
|
40
|
-
* getWeatherHistory(req: Request) {
|
|
41
|
-
* const date = req.params.date;
|
|
42
|
-
* return {
|
|
43
|
-
* status: 200,
|
|
44
|
-
* content: this.getHistoricalData(date)
|
|
45
|
-
* };
|
|
46
|
-
* }
|
|
47
|
-
* }
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
export function servableEndpoint(config) {
|
|
51
|
-
return function (target, propertyKey, descriptor) {
|
|
52
|
-
const ctor = target.constructor;
|
|
53
|
-
// Initialize endpoints array if it doesn't exist
|
|
54
|
-
if (!ctor.__endpoints) {
|
|
55
|
-
ctor.__endpoints = [];
|
|
56
|
-
}
|
|
57
|
-
// Add endpoint configuration to the constructor metadata
|
|
58
|
-
ctor.__endpoints.push({
|
|
59
|
-
method: (config.method || 'get').toUpperCase(),
|
|
60
|
-
path: config.path,
|
|
61
|
-
responseType: config.responseType,
|
|
62
|
-
handlerName: propertyKey.toString()
|
|
63
|
-
});
|
|
64
|
-
return descriptor;
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=servable_endpoint.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"servable_endpoint.js","sourceRoot":"","sources":["../../src/utils/servable_endpoint.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgBH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAA8B;IAC3D,OAAO,UAAU,MAAW,EAAE,WAA4B,EAAE,UAA+B;QACvF,MAAM,IAAI,GAAG,MAAM,CAAC,WAAkB,CAAA;QAEtC,iDAAiD;QACjD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACpB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAA;QACzB,CAAC;QAED,yDAAyD;QACzD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;YAClB,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,WAAW,EAAE;YAC9C,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,WAAW,EAAE,WAAW,CAAC,QAAQ,EAAE;SACtC,CAAC,CAAA;QAEF,OAAO,UAAU,CAAA;IACrB,CAAC,CAAA;AACL,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { StorageService } from '../storage/storage_service.js';
|
|
2
|
-
/**
|
|
3
|
-
* Result of extracting and storing a ZIP archive
|
|
4
|
-
*/
|
|
5
|
-
export interface ExtractedArchiveResult {
|
|
6
|
-
/** The root/main file path (e.g., 'tileset.json') */
|
|
7
|
-
root_file?: string;
|
|
8
|
-
/** Total number of files extracted */
|
|
9
|
-
file_count: number;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Extracts the content of a zip file as a stream (for large files)
|
|
13
|
-
* @param zipBuffer - The content of the zip file as Buffer
|
|
14
|
-
* @returns A generator yielding tuples containing the name and content of each file in the zip file
|
|
15
|
-
*/
|
|
16
|
-
export declare function extractZipContentStream(zipBuffer: Buffer): AsyncGenerator<[string, string | Buffer]>;
|
|
17
|
-
/**
|
|
18
|
-
* Converts a zip file to a dictionary containing all files and their contents
|
|
19
|
-
* @param zipBuffer - The content of the zip file as Buffer
|
|
20
|
-
* @returns A dictionary containing the content of the zip file
|
|
21
|
-
*/
|
|
22
|
-
export declare function zipToDict(zipBuffer: Buffer): Promise<Record<string, string | Buffer>>;
|
|
23
|
-
/**
|
|
24
|
-
* Detects the root file for 3D Tiles tilesets
|
|
25
|
-
* Looks for tileset.json or similar entry point files
|
|
26
|
-
* @param files - List of file paths in the archive
|
|
27
|
-
* @returns The path to the root file, or undefined if not found
|
|
28
|
-
*/
|
|
29
|
-
export declare function detectTilesetRootFile(files: string[]): string | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* Normalizes file paths from ZIP archives
|
|
32
|
-
* Removes leading directory if all files share the same root folder
|
|
33
|
-
* @param files - Original file paths from the archive
|
|
34
|
-
* @returns Normalized file paths (original -> normalized)
|
|
35
|
-
*/
|
|
36
|
-
export declare function normalizeArchivePaths(files: string[]): Map<string, string>;
|
|
37
|
-
/**
|
|
38
|
-
* Extracts a ZIP archive and stores each file individually using the storage service.
|
|
39
|
-
*
|
|
40
|
-
* This function:
|
|
41
|
-
* 1. Extracts all files from the ZIP
|
|
42
|
-
* 2. Normalizes paths (removes common root directory if present)
|
|
43
|
-
* 3. Stores each file using the storage service with a unique base path
|
|
44
|
-
* 4. Returns the root file path and file count
|
|
45
|
-
*
|
|
46
|
-
* Files are uploaded in parallel batches for performance.
|
|
47
|
-
*
|
|
48
|
-
* @param zipBuffer - The ZIP file content as a Buffer
|
|
49
|
-
* @param storage - The storage service to use for saving files
|
|
50
|
-
* @param basePath - Base path/folder for storing extracted files (e.g., 'tilesets/1234567890')
|
|
51
|
-
* @returns ExtractedArchiveResult with root file and file count
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* const result = await extractAndStoreArchive(zipBuffer, storage, 'tilesets/1234567890')
|
|
56
|
-
* // result.root_file = 'tileset.json'
|
|
57
|
-
* // result.file_count = 42
|
|
58
|
-
*
|
|
59
|
-
* // Files are stored at:
|
|
60
|
-
* // tilesets/1234567890/tileset.json
|
|
61
|
-
* // tilesets/1234567890/tiles/tile_0.b3dm
|
|
62
|
-
* // etc.
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
export declare function extractAndStoreArchive(zipBuffer: Buffer, storage: StorageService, basePath: string): Promise<ExtractedArchiveResult>;
|
|
66
|
-
//# sourceMappingURL=zip_utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zip_utils.d.ts","sourceRoot":"","sources":["../../src/utils/zip_utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAEnE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAA;CACrB;AAED;;;;GAIG;AACH,wBAAuB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAqB3G;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAQ3F;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAezE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAiB1E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,sBAAsB,CACxC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,sBAAsB,CAAC,CAuEjC"}
|
package/dist/utils/zip_utils.js
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import JSZip from 'jszip';
|
|
2
|
-
/**
|
|
3
|
-
* Extracts the content of a zip file as a stream (for large files)
|
|
4
|
-
* @param zipBuffer - The content of the zip file as Buffer
|
|
5
|
-
* @returns A generator yielding tuples containing the name and content of each file in the zip file
|
|
6
|
-
*/
|
|
7
|
-
export async function* extractZipContentStream(zipBuffer) {
|
|
8
|
-
const zip = new JSZip();
|
|
9
|
-
const zipContent = await zip.loadAsync(zipBuffer);
|
|
10
|
-
for (const [name, zipObject] of Object.entries(zipContent.files)) {
|
|
11
|
-
if (!zipObject.dir) {
|
|
12
|
-
// Skip directories
|
|
13
|
-
const content = await zipObject.async('nodebuffer');
|
|
14
|
-
// Try to decode as UTF-8, fallback to Buffer for binary files
|
|
15
|
-
try {
|
|
16
|
-
const textContent = content.toString('utf-8');
|
|
17
|
-
// Check if it's valid UTF-8 by trying to encode it back
|
|
18
|
-
Buffer.from(textContent, 'utf-8');
|
|
19
|
-
yield [name, textContent];
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
// If UTF-8 decoding fails, return as Buffer
|
|
23
|
-
yield [name, content];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Converts a zip file to a dictionary containing all files and their contents
|
|
30
|
-
* @param zipBuffer - The content of the zip file as Buffer
|
|
31
|
-
* @returns A dictionary containing the content of the zip file
|
|
32
|
-
*/
|
|
33
|
-
export async function zipToDict(zipBuffer) {
|
|
34
|
-
const output = {};
|
|
35
|
-
for await (const [name, content] of extractZipContentStream(zipBuffer)) {
|
|
36
|
-
output[name] = content;
|
|
37
|
-
}
|
|
38
|
-
return output;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Detects the root file for 3D Tiles tilesets
|
|
42
|
-
* Looks for tileset.json or similar entry point files
|
|
43
|
-
* @param files - List of file paths in the archive
|
|
44
|
-
* @returns The path to the root file, or undefined if not found
|
|
45
|
-
*/
|
|
46
|
-
export function detectTilesetRootFile(files) {
|
|
47
|
-
// Priority order for 3D Tiles root files
|
|
48
|
-
const rootFilePatterns = [
|
|
49
|
-
/^tileset\.json$/i,
|
|
50
|
-
/\/tileset\.json$/i,
|
|
51
|
-
/^[^/]+\/tileset\.json$/i, // One level deep
|
|
52
|
-
/tileset\.json$/i // Any tileset.json as fallback
|
|
53
|
-
];
|
|
54
|
-
for (const pattern of rootFilePatterns) {
|
|
55
|
-
const match = files.find(f => pattern.test(f));
|
|
56
|
-
if (match)
|
|
57
|
-
return match;
|
|
58
|
-
}
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Normalizes file paths from ZIP archives
|
|
63
|
-
* Removes leading directory if all files share the same root folder
|
|
64
|
-
* @param files - Original file paths from the archive
|
|
65
|
-
* @returns Normalized file paths (original -> normalized)
|
|
66
|
-
*/
|
|
67
|
-
export function normalizeArchivePaths(files) {
|
|
68
|
-
const pathMap = new Map();
|
|
69
|
-
// Check if all files share a common root directory
|
|
70
|
-
const firstParts = files.map(f => f.split('/')[0]);
|
|
71
|
-
const commonRoot = firstParts.every(p => p === firstParts[0]) && firstParts[0] !== '' ? firstParts[0] : null;
|
|
72
|
-
for (const file of files) {
|
|
73
|
-
if (commonRoot && file.startsWith(commonRoot + '/')) {
|
|
74
|
-
// Remove the common root prefix
|
|
75
|
-
pathMap.set(file, file.substring(commonRoot.length + 1));
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
pathMap.set(file, file);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return pathMap;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Extracts a ZIP archive and stores each file individually using the storage service.
|
|
85
|
-
*
|
|
86
|
-
* This function:
|
|
87
|
-
* 1. Extracts all files from the ZIP
|
|
88
|
-
* 2. Normalizes paths (removes common root directory if present)
|
|
89
|
-
* 3. Stores each file using the storage service with a unique base path
|
|
90
|
-
* 4. Returns the root file path and file count
|
|
91
|
-
*
|
|
92
|
-
* Files are uploaded in parallel batches for performance.
|
|
93
|
-
*
|
|
94
|
-
* @param zipBuffer - The ZIP file content as a Buffer
|
|
95
|
-
* @param storage - The storage service to use for saving files
|
|
96
|
-
* @param basePath - Base path/folder for storing extracted files (e.g., 'tilesets/1234567890')
|
|
97
|
-
* @returns ExtractedArchiveResult with root file and file count
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* ```typescript
|
|
101
|
-
* const result = await extractAndStoreArchive(zipBuffer, storage, 'tilesets/1234567890')
|
|
102
|
-
* // result.root_file = 'tileset.json'
|
|
103
|
-
* // result.file_count = 42
|
|
104
|
-
*
|
|
105
|
-
* // Files are stored at:
|
|
106
|
-
* // tilesets/1234567890/tileset.json
|
|
107
|
-
* // tilesets/1234567890/tiles/tile_0.b3dm
|
|
108
|
-
* // etc.
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
export async function extractAndStoreArchive(zipBuffer, storage, basePath) {
|
|
112
|
-
const zip = new JSZip();
|
|
113
|
-
const zipContent = await zip.loadAsync(zipBuffer);
|
|
114
|
-
// Get all file paths (excluding directories)
|
|
115
|
-
const filePaths = Object.entries(zipContent.files)
|
|
116
|
-
.filter(([_, zipObject]) => !zipObject.dir)
|
|
117
|
-
.map(([name]) => name);
|
|
118
|
-
// Normalize paths (remove common root if present)
|
|
119
|
-
const normalizedPaths = normalizeArchivePaths(filePaths);
|
|
120
|
-
// Detect root file before normalization, then get normalized path
|
|
121
|
-
const rootFileOriginal = detectTilesetRootFile(filePaths);
|
|
122
|
-
const rootFileNormalized = rootFileOriginal ? normalizedPaths.get(rootFileOriginal) : undefined;
|
|
123
|
-
// Extract and store files in parallel (batched to avoid overwhelming storage)
|
|
124
|
-
const PARALLEL_UPLOADS = 10;
|
|
125
|
-
const entries = Array.from(normalizedPaths.entries());
|
|
126
|
-
const totalFiles = entries.length;
|
|
127
|
-
let uploadedCount = 0;
|
|
128
|
-
const uploadedPaths = [];
|
|
129
|
-
console.log(`[ZipUtils] Extracting ${totalFiles} files to ${basePath}`);
|
|
130
|
-
try {
|
|
131
|
-
const totalBatches = Math.ceil(totalFiles / PARALLEL_UPLOADS);
|
|
132
|
-
// Log progress every 10% or at least every 10 batches
|
|
133
|
-
const logInterval = Math.max(1, Math.floor(totalBatches / 10));
|
|
134
|
-
for (let i = 0; i < entries.length; i += PARALLEL_UPLOADS) {
|
|
135
|
-
const batch = entries.slice(i, i + PARALLEL_UPLOADS);
|
|
136
|
-
const batchNum = Math.floor(i / PARALLEL_UPLOADS) + 1;
|
|
137
|
-
await Promise.all(batch.map(async ([originalPath, normalizedPath]) => {
|
|
138
|
-
const zipObject = zipContent.files[originalPath];
|
|
139
|
-
const content = await zipObject.async('nodebuffer');
|
|
140
|
-
// Build storage path: basePath/normalizedPath
|
|
141
|
-
const storagePath = `${basePath}/${normalizedPath}`;
|
|
142
|
-
// Save the file using saveWithPath which preserves the exact path
|
|
143
|
-
await storage.saveWithPath(content, storagePath);
|
|
144
|
-
uploadedPaths.push(storagePath);
|
|
145
|
-
}));
|
|
146
|
-
uploadedCount += batch.length;
|
|
147
|
-
// Log progress periodically (every ~10%) or on last batch
|
|
148
|
-
if (batchNum % logInterval === 0 || batchNum === totalBatches) {
|
|
149
|
-
const percent = Math.round((uploadedCount / totalFiles) * 100);
|
|
150
|
-
console.log(`[ZipUtils] Progress: ${percent}% (${uploadedCount}/${totalFiles} files)`);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
catch (error) {
|
|
155
|
-
// Clean up any files that were already uploaded before the error
|
|
156
|
-
if (uploadedPaths.length > 0) {
|
|
157
|
-
console.log(`[ZipUtils] Error during extraction, cleaning up ${uploadedPaths.length} uploaded files...`);
|
|
158
|
-
await storage.deleteBatch(uploadedPaths).catch(cleanupErr => {
|
|
159
|
-
console.error(`[ZipUtils] Failed to clean up files after error:`, cleanupErr);
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
throw error;
|
|
163
|
-
}
|
|
164
|
-
return {
|
|
165
|
-
root_file: rootFileNormalized,
|
|
166
|
-
file_count: uploadedCount
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
//# sourceMappingURL=zip_utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zip_utils.js","sourceRoot":"","sources":["../../src/utils/zip_utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAazB;;;;GAIG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,uBAAuB,CAAC,SAAiB;IAC5D,MAAM,GAAG,GAAG,IAAI,KAAK,EAAE,CAAA;IACvB,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;IAEjD,KAAK,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/D,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;YACjB,mBAAmB;YACnB,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;YAEnD,8DAA8D;YAC9D,IAAI,CAAC;gBACD,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;gBAC7C,wDAAwD;gBACxD,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;gBACjC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,CAA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