@tiangong-lca/tidas-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +0 -0
  3. package/dist/core/base/TidasEntity.d.ts +97 -0
  4. package/dist/core/base/TidasEntity.d.ts.map +1 -0
  5. package/dist/core/base/TidasEntity.js +241 -0
  6. package/dist/core/base/TidasEntity.js.map +1 -0
  7. package/dist/core/config/GlobalConfig.d.ts +60 -0
  8. package/dist/core/config/GlobalConfig.d.ts.map +1 -0
  9. package/dist/core/config/GlobalConfig.js +110 -0
  10. package/dist/core/config/GlobalConfig.js.map +1 -0
  11. package/dist/core/config/ValidationConfig.d.ts +70 -0
  12. package/dist/core/config/ValidationConfig.d.ts.map +1 -0
  13. package/dist/core/config/ValidationConfig.js +159 -0
  14. package/dist/core/config/ValidationConfig.js.map +1 -0
  15. package/dist/core/entities/TidasContact.d.ts +14 -0
  16. package/dist/core/entities/TidasContact.d.ts.map +1 -0
  17. package/dist/core/entities/TidasContact.js +87 -0
  18. package/dist/core/entities/TidasContact.js.map +1 -0
  19. package/dist/core/entities/TidasFlow.d.ts +14 -0
  20. package/dist/core/entities/TidasFlow.d.ts.map +1 -0
  21. package/dist/core/entities/TidasFlow.js +105 -0
  22. package/dist/core/entities/TidasFlow.js.map +1 -0
  23. package/dist/core/entities/TidasFlowProperty.d.ts +14 -0
  24. package/dist/core/entities/TidasFlowProperty.d.ts.map +1 -0
  25. package/dist/core/entities/TidasFlowProperty.js +111 -0
  26. package/dist/core/entities/TidasFlowProperty.js.map +1 -0
  27. package/dist/core/entities/TidasLCIAMethod.d.ts +14 -0
  28. package/dist/core/entities/TidasLCIAMethod.d.ts.map +1 -0
  29. package/dist/core/entities/TidasLCIAMethod.js +125 -0
  30. package/dist/core/entities/TidasLCIAMethod.js.map +1 -0
  31. package/dist/core/entities/TidasLifeCycleModel.d.ts +14 -0
  32. package/dist/core/entities/TidasLifeCycleModel.d.ts.map +1 -0
  33. package/dist/core/entities/TidasLifeCycleModel.js +117 -0
  34. package/dist/core/entities/TidasLifeCycleModel.js.map +1 -0
  35. package/dist/core/entities/TidasProcess.d.ts +14 -0
  36. package/dist/core/entities/TidasProcess.d.ts.map +1 -0
  37. package/dist/core/entities/TidasProcess.js +129 -0
  38. package/dist/core/entities/TidasProcess.js.map +1 -0
  39. package/dist/core/entities/TidasSource.d.ts +14 -0
  40. package/dist/core/entities/TidasSource.d.ts.map +1 -0
  41. package/dist/core/entities/TidasSource.js +101 -0
  42. package/dist/core/entities/TidasSource.js.map +1 -0
  43. package/dist/core/entities/TidasUnitGroup.d.ts +14 -0
  44. package/dist/core/entities/TidasUnitGroup.d.ts.map +1 -0
  45. package/dist/core/entities/TidasUnitGroup.js +121 -0
  46. package/dist/core/entities/TidasUnitGroup.js.map +1 -0
  47. package/dist/core/factories/index.d.ts +49 -0
  48. package/dist/core/factories/index.d.ts.map +1 -0
  49. package/dist/core/factories/index.js +171 -0
  50. package/dist/core/factories/index.js.map +1 -0
  51. package/dist/core/index.d.ts +11 -0
  52. package/dist/core/index.d.ts.map +1 -0
  53. package/dist/core/index.js +47 -0
  54. package/dist/core/index.js.map +1 -0
  55. package/dist/core/zod-factories.d.ts +71 -0
  56. package/dist/core/zod-factories.d.ts.map +1 -0
  57. package/dist/core/zod-factories.js +169 -0
  58. package/dist/core/zod-factories.js.map +1 -0
  59. package/dist/core/zod-proxy.d.ts +108 -0
  60. package/dist/core/zod-proxy.d.ts.map +1 -0
  61. package/dist/core/zod-proxy.js +382 -0
  62. package/dist/core/zod-proxy.js.map +1 -0
  63. package/dist/index.d.ts +32 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +64 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/schemas/index.d.ts +48 -0
  68. package/dist/schemas/index.d.ts.map +1 -0
  69. package/dist/schemas/index.js +111 -0
  70. package/dist/schemas/index.js.map +1 -0
  71. package/dist/schemas/tidas_contacts.schema.d.ts +2340 -0
  72. package/dist/schemas/tidas_contacts.schema.d.ts.map +1 -0
  73. package/dist/schemas/tidas_contacts.schema.js +75 -0
  74. package/dist/schemas/tidas_contacts.schema.js.map +1 -0
  75. package/dist/schemas/tidas_contacts_category.schema.d.ts +3 -0
  76. package/dist/schemas/tidas_contacts_category.schema.d.ts.map +1 -0
  77. package/dist/schemas/tidas_contacts_category.schema.js +53 -0
  78. package/dist/schemas/tidas_contacts_category.schema.js.map +1 -0
  79. package/dist/schemas/tidas_data_types.schema.d.ts +172 -0
  80. package/dist/schemas/tidas_data_types.schema.d.ts.map +1 -0
  81. package/dist/schemas/tidas_data_types.schema.js +74 -0
  82. package/dist/schemas/tidas_data_types.schema.js.map +1 -0
  83. package/dist/schemas/tidas_flowproperties.schema.d.ts +2505 -0
  84. package/dist/schemas/tidas_flowproperties.schema.d.ts.map +1 -0
  85. package/dist/schemas/tidas_flowproperties.schema.js +78 -0
  86. package/dist/schemas/tidas_flowproperties.schema.js.map +1 -0
  87. package/dist/schemas/tidas_flowproperties_category.schema.d.ts +3 -0
  88. package/dist/schemas/tidas_flowproperties_category.schema.d.ts.map +1 -0
  89. package/dist/schemas/tidas_flowproperties_category.schema.js +28 -0
  90. package/dist/schemas/tidas_flowproperties_category.schema.js.map +1 -0
  91. package/dist/schemas/tidas_flows.schema.d.ts +3366 -0
  92. package/dist/schemas/tidas_flows.schema.d.ts.map +1 -0
  93. package/dist/schemas/tidas_flows.schema.js +125 -0
  94. package/dist/schemas/tidas_flows.schema.js.map +1 -0
  95. package/dist/schemas/tidas_flows_elementary_category.schema.d.ts +3 -0
  96. package/dist/schemas/tidas_flows_elementary_category.schema.d.ts.map +1 -0
  97. package/dist/schemas/tidas_flows_elementary_category.schema.js +309 -0
  98. package/dist/schemas/tidas_flows_elementary_category.schema.js.map +1 -0
  99. package/dist/schemas/tidas_flows_product_category.schema.d.ts +3 -0
  100. package/dist/schemas/tidas_flows_product_category.schema.d.ts.map +1 -0
  101. package/dist/schemas/tidas_flows_product_category.schema.js +28508 -0
  102. package/dist/schemas/tidas_flows_product_category.schema.js.map +1 -0
  103. package/dist/schemas/tidas_lciamethods.schema.d.ts +11025 -0
  104. package/dist/schemas/tidas_lciamethods.schema.d.ts.map +1 -0
  105. package/dist/schemas/tidas_lciamethods.schema.js +439 -0
  106. package/dist/schemas/tidas_lciamethods.schema.js.map +1 -0
  107. package/dist/schemas/tidas_lciamethods_category.schema.d.ts +3 -0
  108. package/dist/schemas/tidas_lciamethods_category.schema.d.ts.map +1 -0
  109. package/dist/schemas/tidas_lciamethods_category.schema.js +278 -0
  110. package/dist/schemas/tidas_lciamethods_category.schema.js.map +1 -0
  111. package/dist/schemas/tidas_lifecyclemodels.schema.d.ts +9362 -0
  112. package/dist/schemas/tidas_lifecyclemodels.schema.d.ts.map +1 -0
  113. package/dist/schemas/tidas_lifecyclemodels.schema.js +384 -0
  114. package/dist/schemas/tidas_lifecyclemodels.schema.js.map +1 -0
  115. package/dist/schemas/tidas_locations_category.schema.d.ts +3 -0
  116. package/dist/schemas/tidas_locations_category.schema.d.ts.map +1 -0
  117. package/dist/schemas/tidas_locations_category.schema.js +655 -0
  118. package/dist/schemas/tidas_locations_category.schema.js.map +1 -0
  119. package/dist/schemas/tidas_processes.schema.d.ts +12861 -0
  120. package/dist/schemas/tidas_processes.schema.d.ts.map +1 -0
  121. package/dist/schemas/tidas_processes.schema.js +547 -0
  122. package/dist/schemas/tidas_processes.schema.js.map +1 -0
  123. package/dist/schemas/tidas_processes_category.schema.d.ts +3 -0
  124. package/dist/schemas/tidas_processes_category.schema.d.ts.map +1 -0
  125. package/dist/schemas/tidas_processes_category.schema.js +4480 -0
  126. package/dist/schemas/tidas_processes_category.schema.js.map +1 -0
  127. package/dist/schemas/tidas_sources.schema.d.ts +2007 -0
  128. package/dist/schemas/tidas_sources.schema.d.ts.map +1 -0
  129. package/dist/schemas/tidas_sources.schema.js +73 -0
  130. package/dist/schemas/tidas_sources.schema.js.map +1 -0
  131. package/dist/schemas/tidas_sources_category.schema.d.ts +3 -0
  132. package/dist/schemas/tidas_sources_category.schema.d.ts.map +1 -0
  133. package/dist/schemas/tidas_sources_category.schema.js +43 -0
  134. package/dist/schemas/tidas_sources_category.schema.js.map +1 -0
  135. package/dist/schemas/tidas_unitgroups.schema.d.ts +2088 -0
  136. package/dist/schemas/tidas_unitgroups.schema.d.ts.map +1 -0
  137. package/dist/schemas/tidas_unitgroups.schema.js +92 -0
  138. package/dist/schemas/tidas_unitgroups.schema.js.map +1 -0
  139. package/dist/schemas/tidas_unitgroups_category.schema.d.ts +3 -0
  140. package/dist/schemas/tidas_unitgroups_category.schema.d.ts.map +1 -0
  141. package/dist/schemas/tidas_unitgroups_category.schema.js +28 -0
  142. package/dist/schemas/tidas_unitgroups_category.schema.js.map +1 -0
  143. package/dist/types/index.d.ts +21 -0
  144. package/dist/types/index.d.ts.map +1 -0
  145. package/dist/types/index.js +6 -0
  146. package/dist/types/index.js.map +1 -0
  147. package/dist/types/tidas_contacts.d.ts +72 -0
  148. package/dist/types/tidas_contacts.d.ts.map +1 -0
  149. package/dist/types/tidas_contacts.js +8 -0
  150. package/dist/types/tidas_contacts.js.map +1 -0
  151. package/dist/types/tidas_contacts_category.d.ts +43 -0
  152. package/dist/types/tidas_contacts_category.d.ts.map +1 -0
  153. package/dist/types/tidas_contacts_category.js +8 -0
  154. package/dist/types/tidas_contacts_category.js.map +1 -0
  155. package/dist/types/tidas_data_types.d.ts +145 -0
  156. package/dist/types/tidas_data_types.d.ts.map +1 -0
  157. package/dist/types/tidas_data_types.js +8 -0
  158. package/dist/types/tidas_data_types.js.map +1 -0
  159. package/dist/types/tidas_flowproperties.d.ts +70 -0
  160. package/dist/types/tidas_flowproperties.d.ts.map +1 -0
  161. package/dist/types/tidas_flowproperties.js +8 -0
  162. package/dist/types/tidas_flowproperties.js.map +1 -0
  163. package/dist/types/tidas_flowproperties_category.d.ts +23 -0
  164. package/dist/types/tidas_flowproperties_category.d.ts.map +1 -0
  165. package/dist/types/tidas_flowproperties_category.js +8 -0
  166. package/dist/types/tidas_flowproperties_category.js.map +1 -0
  167. package/dist/types/tidas_flows.d.ts +98 -0
  168. package/dist/types/tidas_flows.d.ts.map +1 -0
  169. package/dist/types/tidas_flows.js +8 -0
  170. package/dist/types/tidas_flows.js.map +1 -0
  171. package/dist/types/tidas_flows_elementary_category.d.ts +227 -0
  172. package/dist/types/tidas_flows_elementary_category.d.ts.map +1 -0
  173. package/dist/types/tidas_flows_elementary_category.js +8 -0
  174. package/dist/types/tidas_flows_elementary_category.js.map +1 -0
  175. package/dist/types/tidas_flows_product_category.d.ts +18391 -0
  176. package/dist/types/tidas_flows_product_category.d.ts.map +1 -0
  177. package/dist/types/tidas_flows_product_category.js +8 -0
  178. package/dist/types/tidas_flows_product_category.js.map +1 -0
  179. package/dist/types/tidas_lciamethods.d.ts +218 -0
  180. package/dist/types/tidas_lciamethods.d.ts.map +1 -0
  181. package/dist/types/tidas_lciamethods.js +8 -0
  182. package/dist/types/tidas_lciamethods.js.map +1 -0
  183. package/dist/types/tidas_lciamethods_category.d.ts +215 -0
  184. package/dist/types/tidas_lciamethods_category.d.ts.map +1 -0
  185. package/dist/types/tidas_lciamethods_category.js +8 -0
  186. package/dist/types/tidas_lciamethods_category.js.map +1 -0
  187. package/dist/types/tidas_lifecyclemodels.d.ts +250 -0
  188. package/dist/types/tidas_lifecyclemodels.d.ts.map +1 -0
  189. package/dist/types/tidas_lifecyclemodels.js +8 -0
  190. package/dist/types/tidas_lifecyclemodels.js.map +1 -0
  191. package/dist/types/tidas_locations_category.d.ts +7 -0
  192. package/dist/types/tidas_locations_category.d.ts.map +1 -0
  193. package/dist/types/tidas_locations_category.js +8 -0
  194. package/dist/types/tidas_locations_category.js.map +1 -0
  195. package/dist/types/tidas_processes.d.ts +278 -0
  196. package/dist/types/tidas_processes.d.ts.map +1 -0
  197. package/dist/types/tidas_processes.js +8 -0
  198. package/dist/types/tidas_processes.js.map +1 -0
  199. package/dist/types/tidas_processes_category.d.ts +3071 -0
  200. package/dist/types/tidas_processes_category.d.ts.map +1 -0
  201. package/dist/types/tidas_processes_category.js +8 -0
  202. package/dist/types/tidas_processes_category.js.map +1 -0
  203. package/dist/types/tidas_sources.d.ts +58 -0
  204. package/dist/types/tidas_sources.d.ts.map +1 -0
  205. package/dist/types/tidas_sources.js +8 -0
  206. package/dist/types/tidas_sources.js.map +1 -0
  207. package/dist/types/tidas_sources_category.d.ts +35 -0
  208. package/dist/types/tidas_sources_category.d.ts.map +1 -0
  209. package/dist/types/tidas_sources_category.js +8 -0
  210. package/dist/types/tidas_sources_category.js.map +1 -0
  211. package/dist/types/tidas_unitgroups.d.ts +81 -0
  212. package/dist/types/tidas_unitgroups.d.ts.map +1 -0
  213. package/dist/types/tidas_unitgroups.js +8 -0
  214. package/dist/types/tidas_unitgroups.js.map +1 -0
  215. package/dist/types/tidas_unitgroups_category.d.ts +23 -0
  216. package/dist/types/tidas_unitgroups_category.d.ts.map +1 -0
  217. package/dist/types/tidas_unitgroups_category.js +8 -0
  218. package/dist/types/tidas_unitgroups_category.js.map +1 -0
  219. package/dist/utils/index.d.ts +7 -0
  220. package/dist/utils/index.d.ts.map +1 -0
  221. package/dist/utils/index.js +31 -0
  222. package/dist/utils/index.js.map +1 -0
  223. package/dist/utils/object-utils.d.ts +29 -0
  224. package/dist/utils/object-utils.d.ts.map +1 -0
  225. package/dist/utils/object-utils.js +156 -0
  226. package/dist/utils/object-utils.js.map +1 -0
  227. package/package.json +90 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 TIDAS TypeScript SDK
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
File without changes
@@ -0,0 +1,97 @@
1
+ import { z } from 'zod';
2
+ import { ValidationConfig, EnhancedValidationResult, ValidationMode } from '../config/ValidationConfig';
3
+ /**
4
+ * Legacy validation result type (maintained for backward compatibility)
5
+ */
6
+ export type ValidationResult<T> = {
7
+ success: true;
8
+ data: T;
9
+ } | {
10
+ success: false;
11
+ error: z.ZodError;
12
+ };
13
+ /**
14
+ * Abstract base class for all TIDAS entities
15
+ * Provides basic validation and data container functionality without property mapping
16
+ */
17
+ export declare abstract class TidasEntity<T = any> {
18
+ protected _schema: z.ZodSchema<T>;
19
+ protected _data: Partial<T>;
20
+ protected _proxy: any;
21
+ protected _validationConfig: ValidationConfig;
22
+ constructor(schema: z.ZodSchema<T>, initialData?: Partial<T>, validationConfig?: Partial<ValidationConfig>);
23
+ /**
24
+ * Abstract method to be implemented by subclasses
25
+ * Initializes default values and ensures required structure
26
+ */
27
+ protected abstract initializeDefaults(): void;
28
+ /**
29
+ * Creates a basic proxy that provides direct data access
30
+ */
31
+ private createBasicProxy;
32
+ /**
33
+ * Get nested value using dot notation path
34
+ */
35
+ protected getNestedValue(path: string): any;
36
+ /**
37
+ * Set nested value using dot notation path
38
+ */
39
+ protected setNestedValue(path: string, value: any): void;
40
+ /**
41
+ * Resolve a nested path in an object
42
+ */
43
+ private resolvePath;
44
+ /**
45
+ * Set a nested path in an object
46
+ */
47
+ private setPath;
48
+ /**
49
+ * Ensure nested structure exists
50
+ */
51
+ protected ensureNestedStructure(paths: string[]): void;
52
+ /**
53
+ * Get current validation configuration
54
+ */
55
+ getValidationConfig(): ValidationConfig;
56
+ /**
57
+ * Set validation mode
58
+ */
59
+ setValidationMode(mode: ValidationMode): void;
60
+ /**
61
+ * Set validation configuration
62
+ */
63
+ setValidationConfig(config: Partial<ValidationConfig>): void;
64
+ /**
65
+ * Enhanced validation with configurable modes
66
+ */
67
+ validateEnhanced(): EnhancedValidationResult<T>;
68
+ /**
69
+ * Legacy validation method (maintained for backward compatibility)
70
+ * Uses current validation configuration but returns legacy result format
71
+ */
72
+ validate(): ValidationResult<T>;
73
+ /**
74
+ * Convert to JSON (complete TIDAS structure)
75
+ * Ensures clean JSON output without non-serializable objects
76
+ */
77
+ toJSON(): T;
78
+ /**
79
+ * Convert to JSON string
80
+ * Returns a properly formatted JSON string
81
+ */
82
+ toJSONString(indent?: number): string;
83
+ /**
84
+ * Clean data for JSON serialization
85
+ * Removes undefined values, functions, and ensures proper structure
86
+ */
87
+ private cleanForJSON;
88
+ /**
89
+ * Get raw data access
90
+ */
91
+ get rawData(): Partial<T>;
92
+ /**
93
+ * Clone the entity
94
+ */
95
+ clone(): this;
96
+ }
97
+ //# sourceMappingURL=TidasEntity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TidasEntity.d.ts","sourceRoot":"","sources":["../../../src/core/base/TidasEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EAExB,cAAc,EACf,MAAM,4BAA4B,CAAC;AAGpC;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,OAAO,EAAE,IAAI,CAAC;IAC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AC,CAAC;IAQ/C;;;OAGG;IACH,QAAQ,IAAI,gBAAgB,CAAC,CAAC,CAAC;IAgB/B;;;OAGG;IACH,MAAM,IAAI,CAAC;IAIX;;;OAGG;IACH,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IAKrC;;;OAGG;IACH,OAAO,CAAC,YAAY;IA4BpB;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,CAExB;IAED;;OAEG;IACH,KAAK,IAAI,IAAI;CAId"}
@@ -0,0 +1,241 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TidasEntity = void 0;
4
+ const ValidationConfig_1 = require("../config/ValidationConfig");
5
+ const GlobalConfig_1 = require("../config/GlobalConfig");
6
+ /**
7
+ * Abstract base class for all TIDAS entities
8
+ * Provides basic validation and data container functionality without property mapping
9
+ */
10
+ class TidasEntity {
11
+ constructor(schema, initialData, validationConfig) {
12
+ this._data = {};
13
+ this._schema = schema;
14
+ this._data = initialData || {};
15
+ this._validationConfig = {
16
+ ...GlobalConfig_1.globalConfig.getDefaultValidationConfig(),
17
+ ...validationConfig
18
+ };
19
+ this._proxy = this.createBasicProxy();
20
+ this.initializeDefaults();
21
+ return this._proxy;
22
+ }
23
+ /**
24
+ * Creates a basic proxy that provides direct data access
25
+ */
26
+ createBasicProxy() {
27
+ return new Proxy(this, {
28
+ get(target, prop) {
29
+ if (typeof prop === 'symbol') {
30
+ return target[prop];
31
+ }
32
+ // 1. Method calls - return bound methods
33
+ if (typeof target[prop] === 'function') {
34
+ return target[prop].bind(target);
35
+ }
36
+ // 2. Direct data access
37
+ if (prop in target._data) {
38
+ return target._data[prop];
39
+ }
40
+ // 3. Dynamic path access (supports dot notation)
41
+ if (prop.includes('.') || prop.includes('[')) {
42
+ return target.getNestedValue(prop);
43
+ }
44
+ // 4. Other properties
45
+ return target[prop];
46
+ },
47
+ set(target, prop, value) {
48
+ if (typeof prop === 'symbol') {
49
+ target[prop] = value;
50
+ return true;
51
+ }
52
+ // 1. Dynamic path setting (supports dot notation)
53
+ if (prop.includes('.') || prop.includes('[')) {
54
+ target.setNestedValue(prop, value);
55
+ return true;
56
+ }
57
+ // 2. Top-level property setting
58
+ target._data[prop] = value;
59
+ return true;
60
+ },
61
+ has(target, prop) {
62
+ return prop in target._data || prop in target;
63
+ },
64
+ ownKeys(target) {
65
+ return [
66
+ ...Object.keys(target._data),
67
+ ...Object.getOwnPropertyNames(target)
68
+ ];
69
+ }
70
+ });
71
+ }
72
+ /**
73
+ * Get nested value using dot notation path
74
+ */
75
+ getNestedValue(path) {
76
+ return this.resolvePath(this._data, path);
77
+ }
78
+ /**
79
+ * Set nested value using dot notation path
80
+ */
81
+ setNestedValue(path, value) {
82
+ this.setPath(this._data, path, value);
83
+ }
84
+ /**
85
+ * Resolve a nested path in an object
86
+ */
87
+ resolvePath(obj, path) {
88
+ return path.split('.').reduce((current, key) => {
89
+ if (key.includes('[') && key.includes(']')) {
90
+ const [arrayKey, indexStr] = key.split('[');
91
+ const index = parseInt(indexStr.replace(']', ''));
92
+ return current?.[arrayKey]?.[index];
93
+ }
94
+ return current?.[key];
95
+ }, obj);
96
+ }
97
+ /**
98
+ * Set a nested path in an object
99
+ */
100
+ setPath(obj, path, value) {
101
+ const keys = path.split('.');
102
+ const lastKey = keys.pop();
103
+ const target = keys.reduce((current, key) => {
104
+ if (key.includes('[') && key.includes(']')) {
105
+ const [arrayKey, indexStr] = key.split('[');
106
+ const index = parseInt(indexStr.replace(']', ''));
107
+ if (!current[arrayKey])
108
+ current[arrayKey] = [];
109
+ if (!current[arrayKey][index])
110
+ current[arrayKey][index] = {};
111
+ return current[arrayKey][index];
112
+ }
113
+ if (!current[key])
114
+ current[key] = {};
115
+ return current[key];
116
+ }, obj);
117
+ if (lastKey.includes('[') && lastKey.includes(']')) {
118
+ const [arrayKey, indexStr] = lastKey.split('[');
119
+ const index = parseInt(indexStr.replace(']', ''));
120
+ if (!target[arrayKey])
121
+ target[arrayKey] = [];
122
+ target[arrayKey][index] = value;
123
+ }
124
+ else {
125
+ target[lastKey] = value;
126
+ }
127
+ }
128
+ /**
129
+ * Ensure nested structure exists
130
+ */
131
+ ensureNestedStructure(paths) {
132
+ paths.forEach(path => {
133
+ if (!this.getNestedValue(path)) {
134
+ this.setNestedValue(path, {});
135
+ }
136
+ });
137
+ }
138
+ /**
139
+ * Get current validation configuration
140
+ */
141
+ getValidationConfig() {
142
+ return { ...this._validationConfig };
143
+ }
144
+ /**
145
+ * Set validation mode
146
+ */
147
+ setValidationMode(mode) {
148
+ this._validationConfig.mode = mode;
149
+ }
150
+ /**
151
+ * Set validation configuration
152
+ */
153
+ setValidationConfig(config) {
154
+ this._validationConfig = {
155
+ ...this._validationConfig,
156
+ ...config
157
+ };
158
+ }
159
+ /**
160
+ * Enhanced validation with configurable modes
161
+ */
162
+ validateEnhanced() {
163
+ return ValidationConfig_1.ValidationUtils.performValidation(this._schema, this._data, this._validationConfig);
164
+ }
165
+ /**
166
+ * Legacy validation method (maintained for backward compatibility)
167
+ * Uses current validation configuration but returns legacy result format
168
+ */
169
+ validate() {
170
+ const enhancedResult = this.validateEnhanced();
171
+ if (enhancedResult.success) {
172
+ return {
173
+ success: true,
174
+ data: enhancedResult.data
175
+ };
176
+ }
177
+ else {
178
+ return {
179
+ success: false,
180
+ error: enhancedResult.error
181
+ };
182
+ }
183
+ }
184
+ /**
185
+ * Convert to JSON (complete TIDAS structure)
186
+ * Ensures clean JSON output without non-serializable objects
187
+ */
188
+ toJSON() {
189
+ return this.cleanForJSON(this._data);
190
+ }
191
+ /**
192
+ * Convert to JSON string
193
+ * Returns a properly formatted JSON string
194
+ */
195
+ toJSONString(indent) {
196
+ const cleanData = this.cleanForJSON(this._data);
197
+ return JSON.stringify(cleanData, null, indent);
198
+ }
199
+ /**
200
+ * Clean data for JSON serialization
201
+ * Removes undefined values, functions, and ensures proper structure
202
+ */
203
+ cleanForJSON(obj) {
204
+ if (obj === null || obj === undefined) {
205
+ return null;
206
+ }
207
+ if (typeof obj === 'function') {
208
+ return undefined;
209
+ }
210
+ if (Array.isArray(obj)) {
211
+ return obj.map(item => this.cleanForJSON(item)).filter(item => item !== undefined);
212
+ }
213
+ if (typeof obj === 'object') {
214
+ const cleaned = {};
215
+ for (const [key, value] of Object.entries(obj)) {
216
+ const cleanedValue = this.cleanForJSON(value);
217
+ if (cleanedValue !== undefined) {
218
+ cleaned[key] = cleanedValue;
219
+ }
220
+ }
221
+ return cleaned;
222
+ }
223
+ // Primitive values
224
+ return obj;
225
+ }
226
+ /**
227
+ * Get raw data access
228
+ */
229
+ get rawData() {
230
+ return this._data;
231
+ }
232
+ /**
233
+ * Clone the entity
234
+ */
235
+ clone() {
236
+ const Constructor = this.constructor;
237
+ return new Constructor(this._schema, structuredClone(this._data), this._validationConfig);
238
+ }
239
+ }
240
+ exports.TidasEntity = TidasEntity;
241
+ //# sourceMappingURL=TidasEntity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TidasEntity.js","sourceRoot":"","sources":["../../../src/core/base/TidasEntity.ts"],"names":[],"mappings":";;;AACA,iEAKoC;AACpC,yDAAsD;AAatD;;;GAGG;AACH,MAAsB,WAAW;IAM/B,YAAY,MAAsB,EAAE,WAAwB,EAAE,gBAA4C;QAJhG,UAAK,GAAe,EAAE,CAAC;QAK/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,WAAW,IAAI,EAAE,CAAC;QAC/B,IAAI,CAAC,iBAAiB,GAAG;YACvB,GAAG,2BAAY,CAAC,0BAA0B,EAAE;YAC5C,GAAG,gBAAgB;SACpB,CAAC;QACF,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAQD;;OAEG;IACK,gBAAgB;QACtB,OAAO,IAAI,KA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/C,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;gBAC9C,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;oBAC/B,OAAO,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC;gBAC9B,CAAC;YACH,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,mBAAmB;QACnB,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,KAAK;QACH,MAAM,WAAW,GAAG,IAAI,CAAC,WAA2C,CAAC;QACrE,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC5F,CAAC;CACF;AA7QD,kCA6QC"}
@@ -0,0 +1,60 @@
1
+ import { ValidationConfig, ValidationMode } from './ValidationConfig';
2
+ /**
3
+ * Global configuration for TIDAS SDK
4
+ */
5
+ declare class TidasGlobalConfig {
6
+ private _defaultValidationConfig;
7
+ /**
8
+ * Get the current default validation configuration
9
+ */
10
+ getDefaultValidationConfig(): ValidationConfig;
11
+ /**
12
+ * Set the default validation mode globally
13
+ */
14
+ setDefaultValidationMode(mode: ValidationMode): void;
15
+ /**
16
+ * Set the complete default validation configuration
17
+ */
18
+ setDefaultValidationConfig(config: Partial<ValidationConfig>): void;
19
+ /**
20
+ * Reset to default configuration
21
+ */
22
+ resetToDefaults(): void;
23
+ /**
24
+ * Load configuration from environment variables
25
+ */
26
+ loadFromEnvironment(): void;
27
+ }
28
+ /**
29
+ * Global configuration instance
30
+ */
31
+ export declare const globalConfig: TidasGlobalConfig;
32
+ /**
33
+ * Convenience functions for global configuration
34
+ */
35
+ /**
36
+ * Set global validation mode
37
+ */
38
+ export declare function setGlobalValidationMode(mode: ValidationMode): void;
39
+ /**
40
+ * Get current global validation mode
41
+ */
42
+ export declare function getGlobalValidationMode(): ValidationMode;
43
+ /**
44
+ * Set global validation configuration
45
+ */
46
+ export declare function setGlobalValidationConfig(config: Partial<ValidationConfig>): void;
47
+ /**
48
+ * Get current global validation configuration
49
+ */
50
+ export declare function getGlobalValidationConfig(): ValidationConfig;
51
+ /**
52
+ * Reset global configuration to defaults
53
+ */
54
+ export declare function resetGlobalConfig(): void;
55
+ /**
56
+ * Load configuration from environment variables
57
+ */
58
+ export declare function loadConfigFromEnvironment(): void;
59
+ export {};
60
+ //# sourceMappingURL=GlobalConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlobalConfig.d.ts","sourceRoot":"","sources":["../../../src/core/config/GlobalConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAA6B,MAAM,oBAAoB,CAAC;AAEjG;;GAEG;AACH,cAAM,iBAAiB;IACrB,OAAO,CAAC,wBAAwB,CAAsD;IAEtF;;OAEG;IACH,0BAA0B,IAAI,gBAAgB;IAI9C;;OAEG;IACH,wBAAwB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAIpD;;OAEG;IACH,0BAA0B,CAAC,MAAM,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI;IAOnE;;OAEG;IACH,eAAe,IAAI,IAAI;IAIvB;;OAEG;IACH,mBAAmB,IAAI,IAAI;CAgB5B;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,mBAA0B,CAAC;AAEpD;;GAEG;AAEH;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAElE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,cAAc,CAExD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAEjF;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,gBAAgB,CAE5D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD"}
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.globalConfig = void 0;
4
+ exports.setGlobalValidationMode = setGlobalValidationMode;
5
+ exports.getGlobalValidationMode = getGlobalValidationMode;
6
+ exports.setGlobalValidationConfig = setGlobalValidationConfig;
7
+ exports.getGlobalValidationConfig = getGlobalValidationConfig;
8
+ exports.resetGlobalConfig = resetGlobalConfig;
9
+ exports.loadConfigFromEnvironment = loadConfigFromEnvironment;
10
+ const ValidationConfig_1 = require("./ValidationConfig");
11
+ /**
12
+ * Global configuration for TIDAS SDK
13
+ */
14
+ class TidasGlobalConfig {
15
+ constructor() {
16
+ this._defaultValidationConfig = { ...ValidationConfig_1.DEFAULT_VALIDATION_CONFIG };
17
+ }
18
+ /**
19
+ * Get the current default validation configuration
20
+ */
21
+ getDefaultValidationConfig() {
22
+ return { ...this._defaultValidationConfig };
23
+ }
24
+ /**
25
+ * Set the default validation mode globally
26
+ */
27
+ setDefaultValidationMode(mode) {
28
+ this._defaultValidationConfig.mode = mode;
29
+ }
30
+ /**
31
+ * Set the complete default validation configuration
32
+ */
33
+ setDefaultValidationConfig(config) {
34
+ this._defaultValidationConfig = {
35
+ ...this._defaultValidationConfig,
36
+ ...config
37
+ };
38
+ }
39
+ /**
40
+ * Reset to default configuration
41
+ */
42
+ resetToDefaults() {
43
+ this._defaultValidationConfig = { ...ValidationConfig_1.DEFAULT_VALIDATION_CONFIG };
44
+ }
45
+ /**
46
+ * Load configuration from environment variables
47
+ */
48
+ loadFromEnvironment() {
49
+ const envMode = process.env.TIDAS_VALIDATION_MODE;
50
+ if (envMode && ['strict', 'weak', 'ignore'].includes(envMode)) {
51
+ this._defaultValidationConfig.mode = envMode;
52
+ }
53
+ const envThrowOnError = process.env.TIDAS_THROW_ON_ERROR;
54
+ if (envThrowOnError !== undefined) {
55
+ this._defaultValidationConfig.throwOnError = envThrowOnError === 'true';
56
+ }
57
+ const envIncludeWarnings = process.env.TIDAS_INCLUDE_WARNINGS;
58
+ if (envIncludeWarnings !== undefined) {
59
+ this._defaultValidationConfig.includeWarnings = envIncludeWarnings === 'true';
60
+ }
61
+ }
62
+ }
63
+ /**
64
+ * Global configuration instance
65
+ */
66
+ exports.globalConfig = new TidasGlobalConfig();
67
+ /**
68
+ * Convenience functions for global configuration
69
+ */
70
+ /**
71
+ * Set global validation mode
72
+ */
73
+ function setGlobalValidationMode(mode) {
74
+ exports.globalConfig.setDefaultValidationMode(mode);
75
+ }
76
+ /**
77
+ * Get current global validation mode
78
+ */
79
+ function getGlobalValidationMode() {
80
+ return exports.globalConfig.getDefaultValidationConfig().mode;
81
+ }
82
+ /**
83
+ * Set global validation configuration
84
+ */
85
+ function setGlobalValidationConfig(config) {
86
+ exports.globalConfig.setDefaultValidationConfig(config);
87
+ }
88
+ /**
89
+ * Get current global validation configuration
90
+ */
91
+ function getGlobalValidationConfig() {
92
+ return exports.globalConfig.getDefaultValidationConfig();
93
+ }
94
+ /**
95
+ * Reset global configuration to defaults
96
+ */
97
+ function resetGlobalConfig() {
98
+ exports.globalConfig.resetToDefaults();
99
+ }
100
+ /**
101
+ * Load configuration from environment variables
102
+ */
103
+ function loadConfigFromEnvironment() {
104
+ exports.globalConfig.loadFromEnvironment();
105
+ }
106
+ // Auto-load from environment on module initialization
107
+ if (typeof process !== 'undefined' && process.env) {
108
+ loadConfigFromEnvironment();
109
+ }
110
+ //# sourceMappingURL=GlobalConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlobalConfig.js","sourceRoot":"","sources":["../../../src/core/config/GlobalConfig.ts"],"names":[],"mappings":";;;AAwEA,0DAEC;AAKD,0DAEC;AAKD,8DAEC;AAKD,8DAEC;AAKD,8CAEC;AAKD,8DAEC;AA7GD,yDAAiG;AAEjG;;GAEG;AACH,MAAM,iBA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AAI,iBAAiB,EAAE,CAAC;AAEpD;;GAEG;AAEH;;GAEG;AACH,SAAgB,uBAAuB,CAAC,IAAoB;IAC1D,oBAAY,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,SAAgB,uBAAuB;IACrC,OAAO,oBAAY,CAAC,0BAA0B,EAAE,CAAC,IAAI,CAAC;AACxD,CAAC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAC,MAAiC;IACzE,oBAAY,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,SAAgB,yBAAyB;IACvC,OAAO,oBAAY,CAAC,0BAA0B,EAAE,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB;IAC/B,oBAAY,CAAC,eAAe,EAAE,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,SAAgB,yBAAyB;IACvC,oBAAY,CAAC,mBAAmB,EAAE,CAAC;AACrC,CAAC;AAED,sDAAsD;AACtD,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAClD,yBAAyB,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Validation mode types
4
+ */
5
+ export type ValidationMode = 'strict' | 'weak' | 'ignore';
6
+ /**
7
+ * Validation configuration interface
8
+ */
9
+ export interface ValidationConfig {
10
+ mode: ValidationMode;
11
+ throwOnError?: boolean;
12
+ includeWarnings?: boolean;
13
+ }
14
+ /**
15
+ * Validation warning interface
16
+ */
17
+ export interface ValidationWarning {
18
+ path: string[];
19
+ message: string;
20
+ code: string;
21
+ severity: 'low' | 'medium' | 'high';
22
+ }
23
+ /**
24
+ * Enhanced validation result type
25
+ */
26
+ export type EnhancedValidationResult<T> = {
27
+ success: true;
28
+ data: T;
29
+ warnings?: ValidationWarning[];
30
+ mode: ValidationMode;
31
+ } | {
32
+ success: false;
33
+ error: z.ZodError;
34
+ warnings?: ValidationWarning[];
35
+ mode: ValidationMode;
36
+ };
37
+ /**
38
+ * Error severity classification
39
+ */
40
+ export declare enum ErrorSeverity {
41
+ CRITICAL = "critical",
42
+ WARNING = "warning",
43
+ INFO = "info"
44
+ }
45
+ /**
46
+ * Validation utilities class
47
+ */
48
+ export declare class ValidationUtils {
49
+ /**
50
+ * Categorize Zod error by severity
51
+ */
52
+ static categorizeError(error: z.ZodIssue): ErrorSeverity;
53
+ /**
54
+ * Convert Zod issue to validation warning
55
+ */
56
+ static issueToWarning(issue: z.ZodIssue): ValidationWarning;
57
+ /**
58
+ * Perform weak validation that returns warnings instead of errors
59
+ */
60
+ static performWeakValidation<T>(schema: z.ZodSchema<T>, data: any, config: ValidationConfig): EnhancedValidationResult<T>;
61
+ /**
62
+ * Perform validation based on mode
63
+ */
64
+ static performValidation<T>(schema: z.ZodSchema<T>, data: any, config: ValidationConfig): EnhancedValidationResult<T>;
65
+ }
66
+ /**
67
+ * Default validation configuration
68
+ */
69
+ export declare const DEFAULT_VALIDATION_CONFIG: ValidationConfig;
70
+ //# sourceMappingURL=ValidationConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidationConfig.d.ts","sourceRoot":"","sources":["../../../src/core/config/ValidationConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,cAAc,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CA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