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.
Files changed (169) hide show
  1. package/package.json +101 -106
  2. package/dist/auth/apisix_parser.d.ts +0 -146
  3. package/dist/auth/apisix_parser.d.ts.map +0 -1
  4. package/dist/auth/apisix_parser.js +0 -185
  5. package/dist/auth/apisix_parser.js.map +0 -1
  6. package/dist/auth/auth_config.d.ts +0 -126
  7. package/dist/auth/auth_config.d.ts.map +0 -1
  8. package/dist/auth/auth_config.js +0 -169
  9. package/dist/auth/auth_config.js.map +0 -1
  10. package/dist/auth/index.d.ts +0 -5
  11. package/dist/auth/index.d.ts.map +0 -1
  12. package/dist/auth/index.js +0 -4
  13. package/dist/auth/index.js.map +0 -1
  14. package/dist/auth/types.d.ts +0 -100
  15. package/dist/auth/types.d.ts.map +0 -1
  16. package/dist/auth/types.js +0 -2
  17. package/dist/auth/types.js.map +0 -1
  18. package/dist/auth/user_service.d.ts +0 -86
  19. package/dist/auth/user_service.d.ts.map +0 -1
  20. package/dist/auth/user_service.js +0 -237
  21. package/dist/auth/user_service.js.map +0 -1
  22. package/dist/components/assets_manager.d.ts +0 -662
  23. package/dist/components/assets_manager.d.ts.map +0 -1
  24. package/dist/components/assets_manager.js +0 -1529
  25. package/dist/components/assets_manager.js.map +0 -1
  26. package/dist/components/async_upload.d.ts +0 -20
  27. package/dist/components/async_upload.d.ts.map +0 -1
  28. package/dist/components/async_upload.js +0 -10
  29. package/dist/components/async_upload.js.map +0 -1
  30. package/dist/components/collector.d.ts +0 -203
  31. package/dist/components/collector.d.ts.map +0 -1
  32. package/dist/components/collector.js +0 -202
  33. package/dist/components/collector.js.map +0 -1
  34. package/dist/components/custom_table_manager.d.ts +0 -503
  35. package/dist/components/custom_table_manager.d.ts.map +0 -1
  36. package/dist/components/custom_table_manager.js +0 -1052
  37. package/dist/components/custom_table_manager.js.map +0 -1
  38. package/dist/components/global_assets_handler.d.ts +0 -63
  39. package/dist/components/global_assets_handler.d.ts.map +0 -1
  40. package/dist/components/global_assets_handler.js +0 -127
  41. package/dist/components/global_assets_handler.js.map +0 -1
  42. package/dist/components/handler.d.ts +0 -104
  43. package/dist/components/handler.d.ts.map +0 -1
  44. package/dist/components/handler.js +0 -110
  45. package/dist/components/handler.js.map +0 -1
  46. package/dist/components/harvester.d.ts +0 -182
  47. package/dist/components/harvester.d.ts.map +0 -1
  48. package/dist/components/harvester.js +0 -393
  49. package/dist/components/harvester.js.map +0 -1
  50. package/dist/components/index.d.ts +0 -11
  51. package/dist/components/index.d.ts.map +0 -1
  52. package/dist/components/index.js +0 -9
  53. package/dist/components/index.js.map +0 -1
  54. package/dist/components/interfaces.d.ts +0 -126
  55. package/dist/components/interfaces.d.ts.map +0 -1
  56. package/dist/components/interfaces.js +0 -8
  57. package/dist/components/interfaces.js.map +0 -1
  58. package/dist/components/map_manager.d.ts +0 -61
  59. package/dist/components/map_manager.d.ts.map +0 -1
  60. package/dist/components/map_manager.js +0 -242
  61. package/dist/components/map_manager.js.map +0 -1
  62. package/dist/components/tileset_manager.d.ts +0 -125
  63. package/dist/components/tileset_manager.d.ts.map +0 -1
  64. package/dist/components/tileset_manager.js +0 -618
  65. package/dist/components/tileset_manager.js.map +0 -1
  66. package/dist/components/types.d.ts +0 -226
  67. package/dist/components/types.d.ts.map +0 -1
  68. package/dist/components/types.js +0 -8
  69. package/dist/components/types.js.map +0 -1
  70. package/dist/database/adapters/knex_database_adapter.d.ts +0 -92
  71. package/dist/database/adapters/knex_database_adapter.d.ts.map +0 -1
  72. package/dist/database/adapters/knex_database_adapter.js +0 -647
  73. package/dist/database/adapters/knex_database_adapter.js.map +0 -1
  74. package/dist/database/database_adapter.d.ts +0 -251
  75. package/dist/database/database_adapter.d.ts.map +0 -1
  76. package/dist/database/database_adapter.js +0 -46
  77. package/dist/database/database_adapter.js.map +0 -1
  78. package/dist/engine/digital_twin_engine.d.ts +0 -253
  79. package/dist/engine/digital_twin_engine.d.ts.map +0 -1
  80. package/dist/engine/digital_twin_engine.js +0 -790
  81. package/dist/engine/digital_twin_engine.js.map +0 -1
  82. package/dist/engine/endpoints.d.ts +0 -47
  83. package/dist/engine/endpoints.d.ts.map +0 -1
  84. package/dist/engine/endpoints.js +0 -56
  85. package/dist/engine/endpoints.js.map +0 -1
  86. package/dist/engine/events.d.ts +0 -93
  87. package/dist/engine/events.d.ts.map +0 -1
  88. package/dist/engine/events.js +0 -71
  89. package/dist/engine/events.js.map +0 -1
  90. package/dist/engine/initializer.d.ts +0 -62
  91. package/dist/engine/initializer.d.ts.map +0 -1
  92. package/dist/engine/initializer.js +0 -108
  93. package/dist/engine/initializer.js.map +0 -1
  94. package/dist/engine/queue_manager.d.ts +0 -87
  95. package/dist/engine/queue_manager.d.ts.map +0 -1
  96. package/dist/engine/queue_manager.js +0 -196
  97. package/dist/engine/queue_manager.js.map +0 -1
  98. package/dist/engine/scheduler.d.ts +0 -30
  99. package/dist/engine/scheduler.d.ts.map +0 -1
  100. package/dist/engine/scheduler.js +0 -370
  101. package/dist/engine/scheduler.js.map +0 -1
  102. package/dist/engine/upload_processor.d.ts +0 -36
  103. package/dist/engine/upload_processor.d.ts.map +0 -1
  104. package/dist/engine/upload_processor.js +0 -101
  105. package/dist/engine/upload_processor.js.map +0 -1
  106. package/dist/env/env.d.ts +0 -134
  107. package/dist/env/env.d.ts.map +0 -1
  108. package/dist/env/env.js +0 -177
  109. package/dist/env/env.js.map +0 -1
  110. package/dist/index.d.ts +0 -49
  111. package/dist/index.d.ts.map +0 -1
  112. package/dist/index.js +0 -57
  113. package/dist/index.js.map +0 -1
  114. package/dist/openapi/generator.d.ts +0 -93
  115. package/dist/openapi/generator.d.ts.map +0 -1
  116. package/dist/openapi/generator.js +0 -293
  117. package/dist/openapi/generator.js.map +0 -1
  118. package/dist/openapi/index.d.ts +0 -9
  119. package/dist/openapi/index.d.ts.map +0 -1
  120. package/dist/openapi/index.js +0 -9
  121. package/dist/openapi/index.js.map +0 -1
  122. package/dist/openapi/types.d.ts +0 -182
  123. package/dist/openapi/types.d.ts.map +0 -1
  124. package/dist/openapi/types.js +0 -16
  125. package/dist/openapi/types.js.map +0 -1
  126. package/dist/storage/adapters/local_storage_service.d.ts +0 -51
  127. package/dist/storage/adapters/local_storage_service.d.ts.map +0 -1
  128. package/dist/storage/adapters/local_storage_service.js +0 -110
  129. package/dist/storage/adapters/local_storage_service.js.map +0 -1
  130. package/dist/storage/adapters/ovh_storage_service.d.ts +0 -61
  131. package/dist/storage/adapters/ovh_storage_service.d.ts.map +0 -1
  132. package/dist/storage/adapters/ovh_storage_service.js +0 -172
  133. package/dist/storage/adapters/ovh_storage_service.js.map +0 -1
  134. package/dist/storage/storage_factory.d.ts +0 -14
  135. package/dist/storage/storage_factory.d.ts.map +0 -1
  136. package/dist/storage/storage_factory.js +0 -36
  137. package/dist/storage/storage_factory.js.map +0 -1
  138. package/dist/storage/storage_service.d.ts +0 -163
  139. package/dist/storage/storage_service.d.ts.map +0 -1
  140. package/dist/storage/storage_service.js +0 -54
  141. package/dist/storage/storage_service.js.map +0 -1
  142. package/dist/types/data_record.d.ts +0 -123
  143. package/dist/types/data_record.d.ts.map +0 -1
  144. package/dist/types/data_record.js +0 -8
  145. package/dist/types/data_record.js.map +0 -1
  146. package/dist/utils/http_responses.d.ts +0 -155
  147. package/dist/utils/http_responses.d.ts.map +0 -1
  148. package/dist/utils/http_responses.js +0 -190
  149. package/dist/utils/http_responses.js.map +0 -1
  150. package/dist/utils/index.d.ts +0 -8
  151. package/dist/utils/index.d.ts.map +0 -1
  152. package/dist/utils/index.js +0 -6
  153. package/dist/utils/index.js.map +0 -1
  154. package/dist/utils/logger.d.ts +0 -74
  155. package/dist/utils/logger.d.ts.map +0 -1
  156. package/dist/utils/logger.js +0 -92
  157. package/dist/utils/logger.js.map +0 -1
  158. package/dist/utils/map_to_data_record.d.ts +0 -10
  159. package/dist/utils/map_to_data_record.d.ts.map +0 -1
  160. package/dist/utils/map_to_data_record.js +0 -36
  161. package/dist/utils/map_to_data_record.js.map +0 -1
  162. package/dist/utils/servable_endpoint.d.ts +0 -63
  163. package/dist/utils/servable_endpoint.d.ts.map +0 -1
  164. package/dist/utils/servable_endpoint.js +0 -67
  165. package/dist/utils/servable_endpoint.js.map +0 -1
  166. package/dist/utils/zip_utils.d.ts +0 -66
  167. package/dist/utils/zip_utils.d.ts.map +0 -1
  168. package/dist/utils/zip_utils.js +0 -169
  169. package/dist/utils/zip_utils.js.map +0 -1
@@ -1,101 +0,0 @@
1
- import { Worker } from 'bullmq';
2
- import { extractAndStoreArchive } from '../utils/zip_utils.js';
3
- import fs from 'fs/promises';
4
- /**
5
- * Background worker for processing large file uploads (tileset extraction).
6
- * Prevents HTTP timeout by queuing jobs and processing asynchronously.
7
- *
8
- * Flow:
9
- * 1. Read ZIP from temp file
10
- * 2. Extract and upload all files to storage (OVH S3)
11
- * 3. Update database with tileset_url and base_path
12
- * 4. Clean up temp file
13
- */
14
- export class UploadProcessor {
15
- constructor(storage, db) {
16
- this.worker = null;
17
- this.storage = storage;
18
- this.db = db;
19
- }
20
- start(connection) {
21
- this.worker = new Worker('dt-uploads', async (job) => this.processJob(job), {
22
- connection,
23
- concurrency: 2,
24
- limiter: { max: 5, duration: 60000 }
25
- });
26
- this.worker.on('completed', job => console.log(`[UploadProcessor] Job ${job.id} completed`));
27
- this.worker.on('failed', (job, err) => console.error(`[UploadProcessor] Job ${job?.id} failed:`, err.message));
28
- }
29
- async stop() {
30
- if (this.worker) {
31
- await this.worker.close();
32
- this.worker = null;
33
- }
34
- }
35
- async processJob(job) {
36
- if (job.data.type === 'tileset') {
37
- await this.processTilesetUpload(job);
38
- }
39
- else {
40
- throw new Error(`Unknown upload job type: ${job.data.type}`);
41
- }
42
- }
43
- async processTilesetUpload(job) {
44
- const { recordId, tempFilePath, componentName } = job.data;
45
- let basePath = null;
46
- try {
47
- await this.updateRecordStatus(recordId, componentName, 'processing');
48
- await job.updateProgress(10);
49
- // Read ZIP file
50
- const zipBuffer = await fs.readFile(tempFilePath).catch(err => {
51
- throw new Error(`Failed to read temp file: ${err.message}`);
52
- });
53
- await job.updateProgress(20);
54
- // Generate unique base path
55
- basePath = `${componentName}/${Date.now()}`;
56
- // Extract and upload all files to storage
57
- const extractResult = await extractAndStoreArchive(zipBuffer, this.storage, basePath);
58
- await job.updateProgress(80);
59
- // Validate tileset.json exists
60
- if (!extractResult.root_file) {
61
- // Clean up uploaded files
62
- await this.storage.deleteByPrefix(basePath).catch(() => { });
63
- throw new Error('Invalid tileset: no tileset.json found in the ZIP archive');
64
- }
65
- // Build the public URL for tileset.json
66
- const tilesetPath = `${basePath}/${extractResult.root_file}`;
67
- const tilesetUrl = this.storage.getPublicUrl(tilesetPath);
68
- // Update database record (url = basePath for deletion)
69
- await this.db.updateById(componentName, recordId, {
70
- url: basePath,
71
- tileset_url: tilesetUrl,
72
- upload_status: 'completed'
73
- });
74
- await job.updateProgress(90);
75
- // Clean up temp file
76
- await fs.unlink(tempFilePath).catch(() => { });
77
- await job.updateProgress(100);
78
- console.log(`[UploadProcessor] Tileset ${recordId} uploaded: ${extractResult.file_count} files`);
79
- }
80
- catch (error) {
81
- // Update record as failed (don't delete - keep for debugging)
82
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
83
- await this.db
84
- .updateById(componentName, recordId, {
85
- upload_status: 'failed',
86
- upload_error: errorMessage
87
- })
88
- .catch(() => { });
89
- // Clean up: uploaded files and temp file
90
- if (basePath) {
91
- await this.storage.deleteByPrefix(basePath).catch(() => { });
92
- }
93
- await fs.unlink(tempFilePath).catch(() => { });
94
- throw error;
95
- }
96
- }
97
- async updateRecordStatus(id, tableName, status) {
98
- await this.db.updateById(tableName, id, { upload_status: status });
99
- }
100
- }
101
- //# sourceMappingURL=upload_processor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upload_processor.js","sourceRoot":"","sources":["../../src/engine/upload_processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;YAC/D,CAAC;YACD,MAAM,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;YAE7C,MAAM,KAAK,CAAA;QACf,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAC,EAAU,EAAE,SAAiB,EAAE,MAAoB;QAChF,MAAM,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,CAAA;IACtE,CAAC;CACJ"}
package/dist/env/env.d.ts DELETED
@@ -1,134 +0,0 @@
1
- /**
2
- * @fileoverview Environment variable validation and configuration management
3
- *
4
- * This utility class provides type-safe environment variable parsing with
5
- * validation rules for string, number, boolean, and enum types.
6
- */
7
- /**
8
- * Environment variable validation and configuration utility.
9
- *
10
- * The Env class provides a schema-based approach to validating and parsing
11
- * environment variables with type safety and format validation.
12
- *
13
- * @example
14
- * ```typescript
15
- * const config = Env.validate({
16
- * PORT: Env.schema.number({ optional: true, default: 3000 }),
17
- * API_URL: Env.schema.string({ format: 'url' }),
18
- * DEBUG: Env.schema.boolean({ optional: true, default: false }),
19
- * NODE_ENV: Env.schema.enum(['development', 'production', 'test'])
20
- * });
21
- *
22
- * // config is now type-safe and validated
23
- * console.log(config.PORT); // number
24
- * console.log(config.API_URL); // validated URL string
25
- * ```
26
- */
27
- export declare class Env {
28
- /**
29
- * Schema builders for different environment variable types.
30
- *
31
- * Provides factory methods for creating validation rules for different
32
- * data types that can be parsed from environment variables.
33
- */
34
- static schema: {
35
- /**
36
- * Creates a string validation rule.
37
- *
38
- * @param opts - Optional configuration for string validation
39
- * @param opts.optional - Whether the environment variable is optional
40
- * @param opts.format - Format validation ('url' or 'email')
41
- * @returns String validation rule object
42
- */
43
- string: (opts?: {
44
- optional?: boolean;
45
- format?: "url" | "email";
46
- }) => {
47
- optional?: boolean;
48
- format?: "url" | "email";
49
- type: "string";
50
- };
51
- /**
52
- * Creates a number validation rule.
53
- *
54
- * @param opts - Optional configuration for number validation
55
- * @param opts.optional - Whether the environment variable is optional
56
- * @returns Number validation rule object
57
- */
58
- number: (opts?: {
59
- optional?: boolean;
60
- }) => {
61
- optional?: boolean;
62
- type: "number";
63
- };
64
- /**
65
- * Creates a boolean validation rule.
66
- *
67
- * Accepts 'true'/'false' or '1'/'0' as valid boolean values.
68
- *
69
- * @param opts - Optional configuration for boolean validation
70
- * @param opts.optional - Whether the environment variable is optional
71
- * @param opts.default - Default value if the variable is missing
72
- * @returns Boolean validation rule object
73
- */
74
- boolean: (opts?: {
75
- optional?: boolean;
76
- default?: boolean;
77
- }) => {
78
- optional?: boolean;
79
- default?: boolean;
80
- type: "boolean";
81
- };
82
- /**
83
- * Creates an enum validation rule.
84
- *
85
- * @template T - Array of allowed string values
86
- * @param values - Array of allowed values for this environment variable
87
- * @returns Enum validation rule object
88
- */
89
- enum: <T extends string[]>(values: T) => {
90
- type: "enum";
91
- values: T;
92
- };
93
- };
94
- /**
95
- * Stores the last validated configuration.
96
- *
97
- * This static property holds the most recently validated environment
98
- * configuration for reference by other parts of the application.
99
- */
100
- static config: Record<string, any>;
101
- /**
102
- * Validates environment variables against a schema definition.
103
- *
104
- * Parses and validates environment variables according to the provided
105
- * schema, returning a type-safe configuration object.
106
- *
107
- * @template T - The expected type of the returned configuration object
108
- * @param schema - Object mapping environment variable names to validation rules
109
- * @param rawEnv - Environment variables object (defaults to process.env)
110
- * @returns Validated and parsed configuration object
111
- *
112
- * @throws {Error} When required environment variables are missing
113
- * @throws {Error} When environment variables fail format validation
114
- *
115
- * @example
116
- * ```typescript
117
- * interface Config {
118
- * DATABASE_URL: string;
119
- * PORT: number;
120
- * DEBUG: boolean;
121
- * NODE_ENV: 'development' | 'production';
122
- * }
123
- *
124
- * const config: Config = Env.validate({
125
- * DATABASE_URL: Env.schema.string({ format: 'url' }),
126
- * PORT: Env.schema.number({ optional: true }),
127
- * DEBUG: Env.schema.boolean({ optional: true, default: false }),
128
- * NODE_ENV: Env.schema.enum(['development', 'production'])
129
- * });
130
- * ```
131
- */
132
- static validate<T extends Record<string, any>>(schema: Record<string, any>, rawEnv?: NodeJS.ProcessEnv): T;
133
- }
134
- //# sourceMappingURL=env.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/env/env.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,GAAG;IACZ;;;;;OAKG;IACH,MAAM,CAAC,MAAM;QACT;;;;;;;WAOG;wBACa;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;YAAC,MAAM,CAAC,EAAE,KAAK,GAAG,OAAO,CAAA;SAAE;uBAAnC,OAAO;qBAAW,KAAK,GAAG,OAAO;;;QAK9D;;;;;;WAMG;wBACa;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE;uBAAT,OAAO;;;QAKpC;;;;;;;;;WASG;yBACc;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;YAAC,OAAO,CAAC,EAAE,OAAO,CAAA;SAAE;uBAA5B,OAAO;sBAAY,OAAO;;;QAKxD;;;;;;WAMG;eACI,CAAC,SAAS,MAAM,EAAE,UAAU,CAAC;;;;MAIvC;IAED;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAK;IAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,oBAAc,GAAG,CAAC;CA2DvG"}
package/dist/env/env.js DELETED
@@ -1,177 +0,0 @@
1
- /**
2
- * @fileoverview Environment variable validation and configuration management
3
- *
4
- * This utility class provides type-safe environment variable parsing with
5
- * validation rules for string, number, boolean, and enum types.
6
- */
7
- /**
8
- * Environment variable validation and configuration utility.
9
- *
10
- * The Env class provides a schema-based approach to validating and parsing
11
- * environment variables with type safety and format validation.
12
- *
13
- * @example
14
- * ```typescript
15
- * const config = Env.validate({
16
- * PORT: Env.schema.number({ optional: true, default: 3000 }),
17
- * API_URL: Env.schema.string({ format: 'url' }),
18
- * DEBUG: Env.schema.boolean({ optional: true, default: false }),
19
- * NODE_ENV: Env.schema.enum(['development', 'production', 'test'])
20
- * });
21
- *
22
- * // config is now type-safe and validated
23
- * console.log(config.PORT); // number
24
- * console.log(config.API_URL); // validated URL string
25
- * ```
26
- */
27
- export class Env {
28
- /**
29
- * Schema builders for different environment variable types.
30
- *
31
- * Provides factory methods for creating validation rules for different
32
- * data types that can be parsed from environment variables.
33
- */
34
- static { this.schema = {
35
- /**
36
- * Creates a string validation rule.
37
- *
38
- * @param opts - Optional configuration for string validation
39
- * @param opts.optional - Whether the environment variable is optional
40
- * @param opts.format - Format validation ('url' or 'email')
41
- * @returns String validation rule object
42
- */
43
- string: (opts) => ({
44
- type: 'string',
45
- ...opts
46
- }),
47
- /**
48
- * Creates a number validation rule.
49
- *
50
- * @param opts - Optional configuration for number validation
51
- * @param opts.optional - Whether the environment variable is optional
52
- * @returns Number validation rule object
53
- */
54
- number: (opts) => ({
55
- type: 'number',
56
- ...opts
57
- }),
58
- /**
59
- * Creates a boolean validation rule.
60
- *
61
- * Accepts 'true'/'false' or '1'/'0' as valid boolean values.
62
- *
63
- * @param opts - Optional configuration for boolean validation
64
- * @param opts.optional - Whether the environment variable is optional
65
- * @param opts.default - Default value if the variable is missing
66
- * @returns Boolean validation rule object
67
- */
68
- boolean: (opts) => ({
69
- type: 'boolean',
70
- ...opts
71
- }),
72
- /**
73
- * Creates an enum validation rule.
74
- *
75
- * @template T - Array of allowed string values
76
- * @param values - Array of allowed values for this environment variable
77
- * @returns Enum validation rule object
78
- */
79
- enum: (values) => ({
80
- type: 'enum',
81
- values
82
- })
83
- }; }
84
- /**
85
- * Stores the last validated configuration.
86
- *
87
- * This static property holds the most recently validated environment
88
- * configuration for reference by other parts of the application.
89
- */
90
- static { this.config = {}; }
91
- /**
92
- * Validates environment variables against a schema definition.
93
- *
94
- * Parses and validates environment variables according to the provided
95
- * schema, returning a type-safe configuration object.
96
- *
97
- * @template T - The expected type of the returned configuration object
98
- * @param schema - Object mapping environment variable names to validation rules
99
- * @param rawEnv - Environment variables object (defaults to process.env)
100
- * @returns Validated and parsed configuration object
101
- *
102
- * @throws {Error} When required environment variables are missing
103
- * @throws {Error} When environment variables fail format validation
104
- *
105
- * @example
106
- * ```typescript
107
- * interface Config {
108
- * DATABASE_URL: string;
109
- * PORT: number;
110
- * DEBUG: boolean;
111
- * NODE_ENV: 'development' | 'production';
112
- * }
113
- *
114
- * const config: Config = Env.validate({
115
- * DATABASE_URL: Env.schema.string({ format: 'url' }),
116
- * PORT: Env.schema.number({ optional: true }),
117
- * DEBUG: Env.schema.boolean({ optional: true, default: false }),
118
- * NODE_ENV: Env.schema.enum(['development', 'production'])
119
- * });
120
- * ```
121
- */
122
- static validate(schema, rawEnv = process.env) {
123
- const config = {};
124
- for (const [key, rules] of Object.entries(schema)) {
125
- const value = rawEnv[key];
126
- if (value === undefined || value === '') {
127
- if (rules.optional) {
128
- // Use default value if provided
129
- if (rules.default !== undefined) {
130
- config[key] = rules.default;
131
- }
132
- continue;
133
- }
134
- throw new Error(`Missing environment variable: ${key}`);
135
- }
136
- switch (rules.type) {
137
- case 'string':
138
- if (rules.format === 'url' && !/^https?:\/\/.+$/.test(value)) {
139
- throw new Error(`Invalid URL format for ${key}`);
140
- }
141
- if (rules.format === 'email' && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
142
- throw new Error(`Invalid email format for ${key}`);
143
- }
144
- config[key] = value;
145
- break;
146
- case 'number':
147
- const parsed = Number(value);
148
- if (isNaN(parsed)) {
149
- throw new Error(`Invalid number format for ${key}`);
150
- }
151
- config[key] = parsed;
152
- break;
153
- case 'boolean':
154
- const lowerValue = value.toLowerCase();
155
- if (lowerValue === 'true' || lowerValue === '1') {
156
- config[key] = true;
157
- }
158
- else if (lowerValue === 'false' || lowerValue === '0') {
159
- config[key] = false;
160
- }
161
- else {
162
- throw new Error(`Invalid boolean format for ${key}, expected true/false or 1/0`);
163
- }
164
- break;
165
- case 'enum':
166
- if (!rules.values.includes(value)) {
167
- throw new Error(`Invalid value for ${key}, expected one of ${rules.values.join(', ')}`);
168
- }
169
- config[key] = value;
170
- break;
171
- }
172
- }
173
- this.config = config;
174
- return config;
175
- }
176
- }
177
- //# sourceMappingURL=env.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/env/env.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,GAAG;IACZ;;;;;OAKG;aACI,WAAM,GAAG;QACZ;;;;;;;WAOG;QACH,MAAM,EAAE,CAAC,IAAuD,EAAE,EAAE,CAAC,CAAC;YAClE,IAAI,EAAE,QAAiB;YACvB,GAAG,IAAI;SACV,CAAC;QAEF;;;;;;WAMG;QACH,MAAM,EAAE,CAAC,IAA6B,EAAE,EAAE,CAAC,CAAC;YACxC,IAAI,EAAE,QAAiB;YACvB,GAAG,IAAI;SACV,CAAC;QAEF;;;;;;;;;WASG;QACH,OAAO,EAAE,CAAC,IAAgD,EAAE,EAAE,CAAC,CAAC;YAC5D,IAAI,EAAE,SAAkB;YACxB,GAAG,IAAI;SACV,CAAC;QAEF;;;;;;WAMG;QACH,IAAI,EAAE,CAAqB,MAAS,EAAE,EAAE,CAAC,CAAC;YACtC,IAAI,EAAE,MAAe;YACrB,MAAM;SACT,CAAC;KACL,CAAA;IAED;;;;;OAKG;aACI,WAAM,GAAwB,EAAE,CAAA;IAEvC;;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AA;oBAC5B,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;wBAChB,MAAM,IAAI,KAAK,CAAC,6BAA6B,GAAG,EAAE,CAAC,CAAA;oBACvD,CAAC;oBACD,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAA;oBACpB,MAAK;gBAET,KAAK,SAAS;oBACV,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAA;oBACtC,IAAI,UAAU,KAAK,MAAM,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;wBAC9C,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;oBACtB,CAAC;yBAAM,IAAI,UAAU,KAAK,OAAO,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;wBACtD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;oBACvB,CAAC;yBAAM,CAAC;wBACJ,MAAM,IAAI,KAAK,CAAC,8BAA8B,GAAG,8BAA8B,CAAC,CAAA;oBACpF,CAAC;oBACD,MAAK;gBAET,KAAK,MAAM;oBACP,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;wBAChC,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,qBAAqB,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;oBAC3F,CAAC;oBACD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;oBACnB,MAAK;YACb,CAAC;QACL,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,OAAO,MAAM,CAAA;IACjB,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,49 +0,0 @@
1
- /**
2
- * @fileoverview Main entry point for the digitaltwin-core package
3
- *
4
- * This module provides the core functionality for building digital twin applications,
5
- * including data collection, processing, asset management, and real-time synchronization.
6
- *
7
- * @version 1.0.0
8
- * @author FARI Team
9
- *
10
- * @example
11
- * ```typescript
12
- * import { DigitalTwinEngine, Collector, AssetsManager } from 'digitaltwin-core';
13
- *
14
- * const engine = new DigitalTwinEngine({ ... });
15
- * await engine.start();
16
- * ```
17
- */
18
- export { DigitalTwinEngine } from './engine/digital_twin_engine.js';
19
- export { Collector } from './components/collector.js';
20
- export { Harvester } from './components/harvester.js';
21
- export { Handler } from './components/handler.js';
22
- export { AssetsManager } from './components/assets_manager.js';
23
- export { GlobalAssetsHandler } from './components/global_assets_handler.js';
24
- export { CustomTableManager, type CustomTableRecord, type QueryValidationOptions } from './components/custom_table_manager.js';
25
- export { TilesetManager } from './components/tileset_manager.js';
26
- export { type AsyncUploadable, isAsyncUploadable } from './components/async_upload.js';
27
- export { StorageService } from './storage/storage_service.js';
28
- export { LocalStorageService } from './storage/adapters/local_storage_service.js';
29
- export { OvhS3StorageService } from './storage/adapters/ovh_storage_service.js';
30
- export { StorageServiceFactory } from './storage/storage_factory.js';
31
- export { DatabaseAdapter } from './database/database_adapter.js';
32
- export { KnexDatabaseAdapter, PostgreSQLConfig, SQLiteConfig } from './database/adapters/knex_database_adapter.js';
33
- export * from './components/types.js';
34
- export * from './components/interfaces.js';
35
- export * from './types/data_record.js';
36
- export * from './auth/index.js';
37
- export { Logger, LogLevel } from './utils/logger.js';
38
- export { mapToDataRecord } from './utils/map_to_data_record.js';
39
- export { servableEndpoint } from './utils/servable_endpoint.js';
40
- export { HttpStatus, jsonResponse, successResponse, errorResponse, badRequestResponse, unauthorizedResponse, forbiddenResponse, notFoundResponse, textResponse, fileResponse, multiStatusResponse } from './utils/http_responses.js';
41
- export type { HttpStatusCode } from './utils/http_responses.js';
42
- export { QueueManager } from './engine/queue_manager.js';
43
- export { UploadProcessor, type TilesetUploadJobData, type UploadJobData, type UploadStatus } from './engine/upload_processor.js';
44
- export { initializeComponents } from './engine/initializer.js';
45
- export * from './engine/events.js';
46
- export * from './engine/endpoints.js';
47
- export * from './openapi/index.js';
48
- export { Env } from './env/env.js';
49
- //# sourceMappingURL=index.d.ts.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BAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,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,2BAA2B,CAAA;AAClC,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAG/D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EACH,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,YAAY,EACpB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC9D,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AAGrC,cAAc,oBAAoB,CAAA;AAElC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA"}
package/dist/index.js DELETED
@@ -1,57 +0,0 @@
1
- /**
2
- * @fileoverview Main entry point for the digitaltwin-core package
3
- *
4
- * This module provides the core functionality for building digital twin applications,
5
- * including data collection, processing, asset management, and real-time synchronization.
6
- *
7
- * @version 1.0.0
8
- * @author FARI Team
9
- *
10
- * @example
11
- * ```typescript
12
- * import { DigitalTwinEngine, Collector, AssetsManager } from 'digitaltwin-core';
13
- *
14
- * const engine = new DigitalTwinEngine({ ... });
15
- * await engine.start();
16
- * ```
17
- */
18
- // Core Engine
19
- export { DigitalTwinEngine } from './engine/digital_twin_engine.js';
20
- // Base Components
21
- export { Collector } from './components/collector.js';
22
- export { Harvester } from './components/harvester.js';
23
- export { Handler } from './components/handler.js';
24
- export { AssetsManager } from './components/assets_manager.js';
25
- export { GlobalAssetsHandler } from './components/global_assets_handler.js';
26
- export { CustomTableManager } from './components/custom_table_manager.js';
27
- export { TilesetManager } from './components/tileset_manager.js';
28
- export { isAsyncUploadable } from './components/async_upload.js';
29
- // Storage Services
30
- export { StorageService } from './storage/storage_service.js';
31
- export { LocalStorageService } from './storage/adapters/local_storage_service.js';
32
- export { OvhS3StorageService } from './storage/adapters/ovh_storage_service.js';
33
- export { StorageServiceFactory } from './storage/storage_factory.js';
34
- // Database Services
35
- export { DatabaseAdapter } from './database/database_adapter.js';
36
- export { KnexDatabaseAdapter } from './database/adapters/knex_database_adapter.js';
37
- // Types and Interfaces
38
- export * from './components/types.js';
39
- export * from './components/interfaces.js';
40
- export * from './types/data_record.js';
41
- // Authentication
42
- export * from './auth/index.js';
43
- // Utilities
44
- export { Logger, LogLevel } from './utils/logger.js';
45
- export { mapToDataRecord } from './utils/map_to_data_record.js';
46
- export { servableEndpoint } from './utils/servable_endpoint.js';
47
- export { HttpStatus, jsonResponse, successResponse, errorResponse, badRequestResponse, unauthorizedResponse, forbiddenResponse, notFoundResponse, textResponse, fileResponse, multiStatusResponse } from './utils/http_responses.js';
48
- // Engine Components
49
- export { QueueManager } from './engine/queue_manager.js';
50
- export { UploadProcessor } from './engine/upload_processor.js';
51
- export { initializeComponents } from './engine/initializer.js';
52
- export * from './engine/events.js';
53
- export * from './engine/endpoints.js';
54
- // OpenAPI Documentation Generation
55
- export * from './openapi/index.js';
56
- export { Env } from './env/env.js';
57
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc;AACd,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAEnE,kBAAkB;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,mBAAmB,E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C,cAAc,uBAAuB,CAAA;AAErC,mCAAmC;AACnC,cAAc,oBAAoB,CAAA;AAElC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA"}
@@ -1,93 +0,0 @@
1
- /**
2
- * @fileoverview OpenAPI specification generator for Digital Twin components
3
- *
4
- * This module provides utilities to automatically generate OpenAPI 3.0
5
- * documentation from Digital Twin components that implement OpenAPIDocumentable.
6
- */
7
- import type { OpenAPIDocument, OpenAPIGeneratorOptions, OpenAPISchema } from './types.js';
8
- /**
9
- * Generates OpenAPI 3.0 specifications from Digital Twin components.
10
- *
11
- * The generator aggregates OpenAPI specs from all components that implement
12
- * the OpenAPIDocumentable interface and produces a complete OpenAPI document.
13
- *
14
- * @example
15
- * ```typescript
16
- * import { OpenAPIGenerator } from 'digitaltwin-core'
17
- * import * as components from './src/components'
18
- *
19
- * const spec = OpenAPIGenerator.generate({
20
- * info: {
21
- * title: 'My Digital Twin API',
22
- * version: '1.0.0',
23
- * description: 'API documentation'
24
- * },
25
- * components: Object.values(components),
26
- * servers: [{ url: 'http://localhost:3000' }]
27
- * })
28
- *
29
- * // Write to file
30
- * OpenAPIGenerator.writeYAML(spec, './openapi.yaml')
31
- * ```
32
- */
33
- export declare class OpenAPIGenerator {
34
- /**
35
- * Generates an OpenAPI document from the provided components.
36
- *
37
- * @param options - Generation options including components and metadata
38
- * @returns Complete OpenAPI document
39
- */
40
- static generate(options: OpenAPIGeneratorOptions): OpenAPIDocument;
41
- /**
42
- * Returns default security schemes for APISIX/Keycloak authentication.
43
- */
44
- private static getDefaultSecuritySchemes;
45
- /**
46
- * Converts an OpenAPI document to YAML string.
47
- *
48
- * @param document - OpenAPI document to convert
49
- * @returns YAML string representation
50
- */
51
- static toYAML(document: OpenAPIDocument): string;
52
- /**
53
- * Converts an OpenAPI document to JSON string.
54
- *
55
- * @param document - OpenAPI document to convert
56
- * @param pretty - Whether to format with indentation (default: true)
57
- * @returns JSON string representation
58
- */
59
- static toJSON(document: OpenAPIDocument, pretty?: boolean): string;
60
- /**
61
- * Recursively converts an object to YAML format.
62
- * Simple implementation without external dependencies.
63
- */
64
- private static objectToYAML;
65
- /**
66
- * Helper to create a simple schema reference.
67
- */
68
- static schemaRef(name: string): OpenAPISchema;
69
- /**
70
- * Helper to create a common response for 200 OK with content.
71
- */
72
- static successResponse(contentType: string, schema: OpenAPISchema, description?: string): {
73
- '200': {
74
- description: string;
75
- content: {
76
- [contentType]: {
77
- schema: OpenAPISchema;
78
- };
79
- };
80
- };
81
- };
82
- /**
83
- * Helper to create common error responses.
84
- */
85
- static errorResponses(codes?: Array<400 | 401 | 403 | 404 | 500>): Record<string, {
86
- description: string;
87
- }>;
88
- /**
89
- * Common schemas used across components.
90
- */
91
- static commonSchemas: Record<string, OpenAPISchema>;
92
- }
93
- //# sourceMappingURL=generator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/openapi/generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACR,eAAe,EACf,uBAAuB,EAEvB,aAAa,EAGhB,MAAM,YAAY,CAAA;AAGnB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,gBAAgB;IACzB;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,uBAAuB,GAAG,eAAe;IAqFlE;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAWxC;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM;IAIhD;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,UAAO,GAAG,MAAM;IAI/D;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IAoF3B;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa;IAI7C;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,SAAwB;;;;gBAKtF,CAAC,WAAW,CAAC;;kBAAY;;;;IAMzC;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,GAAE,KAAK,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAwB;qBACnC,MAAM;;IAiBzD;;OAEG;IACH,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAuClD;CACJ"}