@tiangong-lca/tidas-sdk 0.1.20 → 0.1.22

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 (255) hide show
  1. package/README.md +174 -451
  2. package/dist/core/base/TidasEntity.d.ts +190 -0
  3. package/dist/core/base/TidasEntity.d.ts.map +1 -0
  4. package/dist/core/base/TidasEntity.js +433 -0
  5. package/dist/core/base/TidasEntity.js.map +1 -0
  6. package/dist/core/config/GlobalConfig.d.ts +60 -0
  7. package/dist/core/config/GlobalConfig.d.ts.map +1 -0
  8. package/dist/core/config/GlobalConfig.js +110 -0
  9. package/dist/core/config/GlobalConfig.js.map +1 -0
  10. package/dist/core/config/ValidationConfig.d.ts +70 -0
  11. package/dist/core/config/ValidationConfig.d.ts.map +1 -0
  12. package/dist/core/config/ValidationConfig.js +157 -0
  13. package/dist/core/config/ValidationConfig.js.map +1 -0
  14. package/dist/core/copilot/ai.d.ts +150 -0
  15. package/dist/core/copilot/ai.d.ts.map +1 -0
  16. package/dist/core/copilot/ai.js +581 -0
  17. package/dist/core/copilot/ai.js.map +1 -0
  18. package/dist/core/copilot/base.d.ts +83 -0
  19. package/dist/core/copilot/base.d.ts.map +1 -0
  20. package/dist/core/copilot/base.js +193 -0
  21. package/dist/core/copilot/base.js.map +1 -0
  22. package/dist/core/copilot/index.d.ts +1 -0
  23. package/dist/core/copilot/index.d.ts.map +1 -0
  24. package/dist/core/copilot/index.js +2 -0
  25. package/dist/core/copilot/index.js.map +1 -0
  26. package/dist/core/entities/TidasContact.d.ts +14 -0
  27. package/dist/core/entities/TidasContact.d.ts.map +1 -0
  28. package/dist/core/entities/TidasContact.js +124 -0
  29. package/dist/core/entities/TidasContact.js.map +1 -0
  30. package/dist/core/entities/TidasFlow.d.ts +14 -0
  31. package/dist/core/entities/TidasFlow.d.ts.map +1 -0
  32. package/dist/core/entities/TidasFlow.js +143 -0
  33. package/dist/core/entities/TidasFlow.js.map +1 -0
  34. package/dist/core/entities/TidasFlowProperty.d.ts +14 -0
  35. package/dist/core/entities/TidasFlowProperty.d.ts.map +1 -0
  36. package/dist/core/entities/TidasFlowProperty.js +156 -0
  37. package/dist/core/entities/TidasFlowProperty.js.map +1 -0
  38. package/dist/core/entities/TidasLCIAMethod.d.ts +14 -0
  39. package/dist/core/entities/TidasLCIAMethod.d.ts.map +1 -0
  40. package/dist/core/entities/TidasLCIAMethod.js +177 -0
  41. package/dist/core/entities/TidasLCIAMethod.js.map +1 -0
  42. package/dist/core/entities/TidasLifeCycleModel.d.ts +14 -0
  43. package/dist/core/entities/TidasLifeCycleModel.d.ts.map +1 -0
  44. package/dist/core/entities/TidasLifeCycleModel.js +169 -0
  45. package/dist/core/entities/TidasLifeCycleModel.js.map +1 -0
  46. package/dist/core/entities/TidasProcess.d.ts +14 -0
  47. package/dist/core/entities/TidasProcess.d.ts.map +1 -0
  48. package/dist/core/entities/TidasProcess.js +191 -0
  49. package/dist/core/entities/TidasProcess.js.map +1 -0
  50. package/dist/core/entities/TidasSource.d.ts +14 -0
  51. package/dist/core/entities/TidasSource.d.ts.map +1 -0
  52. package/dist/core/entities/TidasSource.js +146 -0
  53. package/dist/core/entities/TidasSource.js.map +1 -0
  54. package/dist/core/entities/TidasUnitGroup.d.ts +14 -0
  55. package/dist/core/entities/TidasUnitGroup.d.ts.map +1 -0
  56. package/dist/core/entities/TidasUnitGroup.js +177 -0
  57. package/dist/core/entities/TidasUnitGroup.js.map +1 -0
  58. package/dist/core/factories/index.d.ts +46 -0
  59. package/dist/core/factories/index.d.ts.map +1 -0
  60. package/dist/core/factories/index.js +223 -0
  61. package/dist/core/factories/index.js.map +1 -0
  62. package/dist/core/index.d.ts +9 -0
  63. package/dist/core/index.d.ts.map +1 -0
  64. package/dist/core/index.js +56 -0
  65. package/dist/core/index.js.map +1 -0
  66. package/dist/core/zod-factories.d.ts +71 -0
  67. package/dist/core/zod-factories.d.ts.map +1 -0
  68. package/dist/core/zod-factories.js +169 -0
  69. package/dist/core/zod-factories.js.map +1 -0
  70. package/dist/core/zod-proxy.d.ts +108 -0
  71. package/dist/core/zod-proxy.d.ts.map +1 -0
  72. package/dist/core/zod-proxy.js +382 -0
  73. package/dist/core/zod-proxy.js.map +1 -0
  74. package/dist/data/bundled-methodologies.json +1259 -0
  75. package/dist/index.d.ts +33 -0
  76. package/dist/index.d.ts.map +1 -0
  77. package/dist/index.js +73 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/schemas/index.d.ts +48 -0
  80. package/dist/schemas/index.d.ts.map +1 -0
  81. package/dist/schemas/index.js +112 -0
  82. package/dist/schemas/index.js.map +1 -0
  83. package/dist/schemas/tidas_contacts.schema.d.ts +124 -0
  84. package/dist/schemas/tidas_contacts.schema.d.ts.map +1 -0
  85. package/dist/schemas/tidas_contacts.schema.js +75 -0
  86. package/dist/schemas/tidas_contacts.schema.js.map +1 -0
  87. package/dist/schemas/tidas_contacts_category.schema.d.ts +3 -0
  88. package/dist/schemas/tidas_contacts_category.schema.d.ts.map +1 -0
  89. package/dist/schemas/tidas_contacts_category.schema.js +53 -0
  90. package/dist/schemas/tidas_contacts_category.schema.js.map +1 -0
  91. package/dist/schemas/tidas_data_types.schema.d.ts +34 -0
  92. package/dist/schemas/tidas_data_types.schema.d.ts.map +1 -0
  93. package/dist/schemas/tidas_data_types.schema.js +60 -0
  94. package/dist/schemas/tidas_data_types.schema.js.map +1 -0
  95. package/dist/schemas/tidas_flowproperties.schema.d.ts +152 -0
  96. package/dist/schemas/tidas_flowproperties.schema.d.ts.map +1 -0
  97. package/dist/schemas/tidas_flowproperties.schema.js +88 -0
  98. package/dist/schemas/tidas_flowproperties.schema.js.map +1 -0
  99. package/dist/schemas/tidas_flowproperties_category.schema.d.ts +3 -0
  100. package/dist/schemas/tidas_flowproperties_category.schema.d.ts.map +1 -0
  101. package/dist/schemas/tidas_flowproperties_category.schema.js +28 -0
  102. package/dist/schemas/tidas_flowproperties_category.schema.js.map +1 -0
  103. package/dist/schemas/tidas_flows.schema.d.ts +215 -0
  104. package/dist/schemas/tidas_flows.schema.d.ts.map +1 -0
  105. package/dist/schemas/tidas_flows.schema.js +165 -0
  106. package/dist/schemas/tidas_flows.schema.js.map +1 -0
  107. package/dist/schemas/tidas_flows_elementary_category.schema.d.ts +3 -0
  108. package/dist/schemas/tidas_flows_elementary_category.schema.d.ts.map +1 -0
  109. package/dist/schemas/tidas_flows_elementary_category.schema.js +309 -0
  110. package/dist/schemas/tidas_flows_elementary_category.schema.js.map +1 -0
  111. package/dist/schemas/tidas_flows_product_category.schema.d.ts +3 -0
  112. package/dist/schemas/tidas_flows_product_category.schema.d.ts.map +1 -0
  113. package/dist/schemas/tidas_flows_product_category.schema.js +28368 -0
  114. package/dist/schemas/tidas_flows_product_category.schema.js.map +1 -0
  115. package/dist/schemas/tidas_lciamethods.schema.d.ts +546 -0
  116. package/dist/schemas/tidas_lciamethods.schema.d.ts.map +1 -0
  117. package/dist/schemas/tidas_lciamethods.schema.js +513 -0
  118. package/dist/schemas/tidas_lciamethods.schema.js.map +1 -0
  119. package/dist/schemas/tidas_lciamethods_category.schema.d.ts +3 -0
  120. package/dist/schemas/tidas_lciamethods_category.schema.d.ts.map +1 -0
  121. package/dist/schemas/tidas_lciamethods_category.schema.js +278 -0
  122. package/dist/schemas/tidas_lciamethods_category.schema.js.map +1 -0
  123. package/dist/schemas/tidas_lifecyclemodels.schema.d.ts +465 -0
  124. package/dist/schemas/tidas_lifecyclemodels.schema.d.ts.map +1 -0
  125. package/dist/schemas/tidas_lifecyclemodels.schema.js +420 -0
  126. package/dist/schemas/tidas_lifecyclemodels.schema.js.map +1 -0
  127. package/dist/schemas/tidas_locations_category.schema.d.ts +3 -0
  128. package/dist/schemas/tidas_locations_category.schema.d.ts.map +1 -0
  129. package/dist/schemas/tidas_locations_category.schema.js +655 -0
  130. package/dist/schemas/tidas_locations_category.schema.js.map +1 -0
  131. package/dist/schemas/tidas_processes.schema.d.ts +626 -0
  132. package/dist/schemas/tidas_processes.schema.d.ts.map +1 -0
  133. package/dist/schemas/tidas_processes.schema.js +659 -0
  134. package/dist/schemas/tidas_processes.schema.js.map +1 -0
  135. package/dist/schemas/tidas_processes_category.schema.d.ts +3 -0
  136. package/dist/schemas/tidas_processes_category.schema.d.ts.map +1 -0
  137. package/dist/schemas/tidas_processes_category.schema.js +4904 -0
  138. package/dist/schemas/tidas_processes_category.schema.js.map +1 -0
  139. package/dist/schemas/tidas_sources.schema.d.ts +113 -0
  140. package/dist/schemas/tidas_sources.schema.d.ts.map +1 -0
  141. package/dist/schemas/tidas_sources.schema.js +73 -0
  142. package/dist/schemas/tidas_sources.schema.js.map +1 -0
  143. package/dist/schemas/tidas_sources_category.schema.d.ts +3 -0
  144. package/dist/schemas/tidas_sources_category.schema.d.ts.map +1 -0
  145. package/dist/schemas/tidas_sources_category.schema.js +43 -0
  146. package/dist/schemas/tidas_sources_category.schema.js.map +1 -0
  147. package/dist/schemas/tidas_unitgroups.schema.d.ts +140 -0
  148. package/dist/schemas/tidas_unitgroups.schema.d.ts.map +1 -0
  149. package/dist/schemas/tidas_unitgroups.schema.js +103 -0
  150. package/dist/schemas/tidas_unitgroups.schema.js.map +1 -0
  151. package/dist/schemas/tidas_unitgroups_category.schema.d.ts +3 -0
  152. package/dist/schemas/tidas_unitgroups_category.schema.d.ts.map +1 -0
  153. package/dist/schemas/tidas_unitgroups_category.schema.js +28 -0
  154. package/dist/schemas/tidas_unitgroups_category.schema.js.map +1 -0
  155. package/dist/services/copilot-service.d.ts +147 -0
  156. package/dist/services/copilot-service.d.ts.map +1 -0
  157. package/dist/services/copilot-service.js +259 -0
  158. package/dist/services/copilot-service.js.map +1 -0
  159. package/dist/services/index.d.ts +9 -0
  160. package/dist/services/index.d.ts.map +1 -0
  161. package/dist/services/index.js +24 -0
  162. package/dist/services/index.js.map +1 -0
  163. package/dist/types/index.d.ts +22 -0
  164. package/dist/types/index.d.ts.map +1 -0
  165. package/dist/types/index.js +21 -0
  166. package/dist/types/index.js.map +1 -0
  167. package/dist/types/multi-lang-types.d.ts +23 -0
  168. package/dist/types/multi-lang-types.d.ts.map +1 -0
  169. package/dist/types/multi-lang-types.js +40 -0
  170. package/dist/types/multi-lang-types.js.map +1 -0
  171. package/dist/types/tidas_contacts.d.ts +72 -0
  172. package/dist/types/tidas_contacts.d.ts.map +1 -0
  173. package/dist/types/tidas_contacts.js +8 -0
  174. package/dist/types/tidas_contacts.js.map +1 -0
  175. package/dist/types/tidas_contacts_category.d.ts +43 -0
  176. package/dist/types/tidas_contacts_category.d.ts.map +1 -0
  177. package/dist/types/tidas_contacts_category.js +8 -0
  178. package/dist/types/tidas_contacts_category.js.map +1 -0
  179. package/dist/types/tidas_data_types.d.ts +116 -0
  180. package/dist/types/tidas_data_types.d.ts.map +1 -0
  181. package/dist/types/tidas_data_types.js +8 -0
  182. package/dist/types/tidas_data_types.js.map +1 -0
  183. package/dist/types/tidas_flowproperties.d.ts +73 -0
  184. package/dist/types/tidas_flowproperties.d.ts.map +1 -0
  185. package/dist/types/tidas_flowproperties.js +8 -0
  186. package/dist/types/tidas_flowproperties.js.map +1 -0
  187. package/dist/types/tidas_flowproperties_category.d.ts +23 -0
  188. package/dist/types/tidas_flowproperties_category.d.ts.map +1 -0
  189. package/dist/types/tidas_flowproperties_category.js +8 -0
  190. package/dist/types/tidas_flowproperties_category.js.map +1 -0
  191. package/dist/types/tidas_flows.d.ts +113 -0
  192. package/dist/types/tidas_flows.d.ts.map +1 -0
  193. package/dist/types/tidas_flows.js +8 -0
  194. package/dist/types/tidas_flows.js.map +1 -0
  195. package/dist/types/tidas_flows_elementary_category.d.ts +227 -0
  196. package/dist/types/tidas_flows_elementary_category.d.ts.map +1 -0
  197. package/dist/types/tidas_flows_elementary_category.js +8 -0
  198. package/dist/types/tidas_flows_elementary_category.js.map +1 -0
  199. package/dist/types/tidas_flows_product_category.d.ts +18351 -0
  200. package/dist/types/tidas_flows_product_category.d.ts.map +1 -0
  201. package/dist/types/tidas_flows_product_category.js +8 -0
  202. package/dist/types/tidas_flows_product_category.js.map +1 -0
  203. package/dist/types/tidas_lciamethods.d.ts +231 -0
  204. package/dist/types/tidas_lciamethods.d.ts.map +1 -0
  205. package/dist/types/tidas_lciamethods.js +8 -0
  206. package/dist/types/tidas_lciamethods.js.map +1 -0
  207. package/dist/types/tidas_lciamethods_category.d.ts +215 -0
  208. package/dist/types/tidas_lciamethods_category.d.ts.map +1 -0
  209. package/dist/types/tidas_lciamethods_category.js +8 -0
  210. package/dist/types/tidas_lciamethods_category.js.map +1 -0
  211. package/dist/types/tidas_lifecyclemodels.d.ts +259 -0
  212. package/dist/types/tidas_lifecyclemodels.d.ts.map +1 -0
  213. package/dist/types/tidas_lifecyclemodels.js +8 -0
  214. package/dist/types/tidas_lifecyclemodels.js.map +1 -0
  215. package/dist/types/tidas_locations_category.d.ts +7 -0
  216. package/dist/types/tidas_locations_category.d.ts.map +1 -0
  217. package/dist/types/tidas_locations_category.js +8 -0
  218. package/dist/types/tidas_locations_category.js.map +1 -0
  219. package/dist/types/tidas_processes.d.ts +301 -0
  220. package/dist/types/tidas_processes.d.ts.map +1 -0
  221. package/dist/types/tidas_processes.js +8 -0
  222. package/dist/types/tidas_processes.js.map +1 -0
  223. package/dist/types/tidas_processes_category.d.ts +3327 -0
  224. package/dist/types/tidas_processes_category.d.ts.map +1 -0
  225. package/dist/types/tidas_processes_category.js +8 -0
  226. package/dist/types/tidas_processes_category.js.map +1 -0
  227. package/dist/types/tidas_sources.d.ts +58 -0
  228. package/dist/types/tidas_sources.d.ts.map +1 -0
  229. package/dist/types/tidas_sources.js +8 -0
  230. package/dist/types/tidas_sources.js.map +1 -0
  231. package/dist/types/tidas_sources_category.d.ts +35 -0
  232. package/dist/types/tidas_sources_category.d.ts.map +1 -0
  233. package/dist/types/tidas_sources_category.js +8 -0
  234. package/dist/types/tidas_sources_category.js.map +1 -0
  235. package/dist/types/tidas_unitgroups.d.ts +85 -0
  236. package/dist/types/tidas_unitgroups.d.ts.map +1 -0
  237. package/dist/types/tidas_unitgroups.js +8 -0
  238. package/dist/types/tidas_unitgroups.js.map +1 -0
  239. package/dist/types/tidas_unitgroups_category.d.ts +23 -0
  240. package/dist/types/tidas_unitgroups_category.d.ts.map +1 -0
  241. package/dist/types/tidas_unitgroups_category.js +8 -0
  242. package/dist/types/tidas_unitgroups_category.js.map +1 -0
  243. package/dist/utils/diff.d.ts +47 -0
  244. package/dist/utils/diff.d.ts.map +1 -0
  245. package/dist/utils/diff.js +263 -0
  246. package/dist/utils/diff.js.map +1 -0
  247. package/dist/utils/index.d.ts +7 -0
  248. package/dist/utils/index.d.ts.map +1 -0
  249. package/dist/utils/index.js +31 -0
  250. package/dist/utils/index.js.map +1 -0
  251. package/dist/utils/object-utils.d.ts +47 -0
  252. package/dist/utils/object-utils.d.ts.map +1 -0
  253. package/dist/utils/object-utils.js +332 -0
  254. package/dist/utils/object-utils.js.map +1 -0
  255. package/package.json +4 -4
package/README.md CHANGED
@@ -1,530 +1,253 @@
1
1
  # TIDAS TypeScript SDK
2
2
 
3
- [English](README.md) | [中文](README-zh.md)
3
+ TypeScript SDK for TIDAS (TianGong Life Cycle Assessment data format) providing type-safe data manipulation, validation, and comprehensive schema support.
4
4
 
5
- A TypeScript SDK for ILCD/TIDAS data management that provides type-safe data operations for Life Cycle Assessment (LCA) data structures.
5
+ ## 🚀 Status
6
6
 
7
- ## 🚀 Quick Start
7
+ **Version**: 0.1.20 (Production Ready)
8
+ **Published**: [@tiangong-lca/tidas-sdk](https://www.npmjs.com/package/@tiangong-lca/tidas-sdk)
8
9
 
9
- ### Installation
10
+ ## ✨ Features
11
+
12
+ - ✅ **Type-Safe Operations**: Full TypeScript support with generated types
13
+ - ✅ **Runtime Validation**: Zod schema validation for all TIDAS data types
14
+ - ✅ **Complete Schema Coverage**: Support for all 18 TIDAS data types
15
+ - ✅ **Property Access**: Convenient API for accessing nested properties
16
+ - ✅ **Object Utilities**: Factory functions and manipulation utilities
17
+ - ✅ **JSON Conversion**: Seamless serialization/deserialization
18
+
19
+ ## 📦 Installation
10
20
 
11
21
  ```bash
12
22
  npm install @tiangong-lca/tidas-sdk
13
23
  ```
14
24
 
25
+ ## 🔧 Quick Start
26
+
15
27
  ### Basic Usage
16
28
 
17
29
  ```typescript
18
- import { createContact } from '@tiangong-lca/tidas-sdk/core';
19
-
20
- // Create a new Contact entity
21
- const contact = createContact();
22
-
23
- // Set multilingual name (recommended: use setText method)
24
- contact.contactDataSet.contactInformation.dataSetInformation['common:name'].setText?.('Dr. Jane Smith', 'en');
25
- contact.contactDataSet.contactInformation.dataSetInformation['common:name'].setText?.('Dr. Jane Smith', 'fr');
26
-
27
- // You can also set the multilingual array directly
28
- contact.contactDataSet.contactInformation.dataSetInformation['common:shortName'] = [
29
- { '@xml:lang': 'en', '#text': 'J. Smith' },
30
- { '@xml:lang': 'fr', '#text': 'J. Smith' },
31
- ];
30
+ import { createTidasContact, TidasContact } from '@tiangong-lca/tidas-sdk';
32
31
 
33
- // Get the name in a specific language
34
- const enName = contact.contactDataSet.contactInformation.dataSetInformation['common:name'].getText?.('en');
32
+ // Create a contact using factory function
33
+ const contact = createTidasContact({
34
+ name: "Example Organization",
35
+ email: "contact@example.com"
36
+ });
35
37
 
36
- // Validate the entity
37
- const validation = contact.validate();
38
- console.log('Valid:', validation.success);
38
+ // Access properties with type safety
39
+ console.log(contact.name); // "Example Organization"
39
40
 
40
- // Convert to JSON string
41
- const json = contact.toJSONString(2);
42
- console.log(json);
41
+ // Convert to JSON
42
+ const json = contact.toJSON();
43
43
  ```
44
44
 
45
- ## 📦 Package Structure
46
-
47
- The SDK provides multiple entry points for different use cases:
45
+ ### Advanced Usage
48
46
 
49
47
  ```typescript
50
- // Core functionality (recommended)
51
- import { createContact, createFlow } from '@tiangong-lca/tidas-sdk/core';
52
-
53
- // Type definitions
54
- import { Contact, Flow } from '@tiangong-lca/tidas-sdk/types';
55
-
56
- // Zod schemas for validation
57
- import { ContactSchema } from '@tiangong-lca/tidas-sdk/schemas';
58
-
59
- // Utility functions
60
- import { objectUtils } from '@tiangong-lca/tidas-sdk/utils';
48
+ import {
49
+ TidasProcess,
50
+ createTidasProcess,
51
+ validateTidasData
52
+ } from '@tiangong-lca/tidas-sdk';
53
+
54
+ // Create and validate complex objects
55
+ const process = createTidasProcess({
56
+ name: "Manufacturing Process",
57
+ description: "Production of electronic components"
58
+ });
61
59
 
62
- // Everything (for convenience, but larger bundle)
63
- import * from '@tiangong-lca/tidas-sdk';
60
+ // Validate data
61
+ const validation = validateTidasData(process, 'Process');
62
+ if (!validation.success) {
63
+ console.error('Validation errors:', validation.errors);
64
+ }
64
65
  ```
65
66
 
66
- ## 🏗️ Features
67
-
68
- - **Type Safety**: Full TypeScript support with generated types from ILCD schemas
69
- - **Runtime Validation**: Zod-based validation with configurable modes (strict/weak/ignore)
70
- - **8 Entity Types**: Support for all core TIDAS entities
71
- - **JSON Interoperability**: Seamless conversion between objects and JSON
72
- - **Batch Operations**: Efficient processing of multiple entities
73
- - **Multi-language Support**: Built-in support for multi-language text fields
74
- - **Performance Optimized**: Configurable validation for performance-critical scenarios
75
- - **AI-Powered Suggestions**: Improve data quality using TIDAS methodology rules
67
+ ## 🏗️ Architecture
76
68
 
77
- ## 📚 Usage Guide
78
-
79
- ### 1. Creating Entities
80
-
81
- The SDK supports all 8 TIDAS entity types:
69
+ ### Module Structure
82
70
 
83
71
  ```typescript
84
- import {
85
- createContact,
86
- createFlow,
87
- createProcess,
88
- createSource,
89
- createFlowProperty,
90
- createUnitGroup,
91
- createLCIAMethod,
92
- createLifeCycleModel,
93
- } from '@tiangong-lca/tidas-sdk/core';
94
-
95
- // Create individual entities
96
- const contact = createContact();
97
- const flow = createFlow();
98
- const process = createProcess();
99
-
100
- // Create entities from existing data
101
- const existingData = { /* TIDAS data structure */ };
102
- const processWithData = createProcess(existingData);
103
- ```
72
+ // Core imports
73
+ import {
74
+ // Types
75
+ TidasContact,
76
+ TidasProcess,
77
+ TidasFlow,
78
+ // ... all 18 TIDAS types
79
+
80
+ // Factory functions
81
+ createTidasContact,
82
+ createTidasProcess,
83
+ createTidasFlow,
84
+ // ... all factory functions
85
+
86
+ // Utilities
87
+ validateTidasData,
88
+ convertToJSON,
89
+ convertFromJSON
90
+ } from '@tiangong-lca/tidas-sdk';
91
+
92
+ // Individual modules
93
+ import { TidasContact } from '@tiangong-lca/tidas-sdk/core';
94
+ import { TidasTypes } from '@tiangong-lca/tidas-sdk/types';
95
+ import { TidasSchemas } from '@tiangong-lca/tidas-sdk/schemas';
96
+ import { TidasUtils } from '@tiangong-lca/tidas-sdk/utils';
97
+ ```
98
+
99
+ ### Supported TIDAS Data Types
100
+
101
+ - TidasContact
102
+ - TidasFlow
103
+ - TidasProcess
104
+ - TidasSource
105
+ - TidasFlowProperty
106
+ - TidasUnitGroup
107
+ - TidasLCIAMethod
108
+ - TidasLifeCycleModel
109
+ - And 10 additional specialized types
110
+
111
+ ## 🧪 Development
112
+
113
+ ### Setup
104
114
 
105
- ### 2. Working with Multi-language Fields
106
-
107
- TIDAS entities support multi-language text fields:
108
-
109
- ```typescript
110
- // Using setText/getText methods (recommended)
111
- flow.flowDataSet.flowInformation.dataSetInformation.name.baseName.setText?.('Water', 'en');
112
- flow.flowDataSet.flowInformation.dataSetInformation.name.baseName.setText?.('Wasser', 'de');
113
- flow.flowDataSet.flowInformation.dataSetInformation.name.baseName.setText?.('Eau', 'fr');
114
-
115
- // Get text in a specific language
116
- const englishName = flow.flowDataSet.flowInformation.dataSetInformation.name.baseName.getText?.('en');
117
-
118
- // Direct array assignment
119
- flow.flowDataSet.flowInformation.dataSetInformation['common:generalComment'] = [
120
- { '@xml:lang': 'en', '#text': 'Pure water for industrial processes' },
121
- { '@xml:lang': 'de', '#text': 'Reines Wasser für industrielle Prozesse' },
122
- { '@xml:lang': 'fr', '#text': 'Eau pure pour les processus industriels' },
123
- ];
124
- ```
115
+ ```bash
116
+ # Clone repository
117
+ git clone https://github.com/tiangong-lca/tidas-sdk.git
118
+ cd tidas-sdk/sdks/typescript
125
119
 
126
- ### 3. Validation Modes
120
+ # Install dependencies
121
+ npm install
127
122
 
128
- The SDK provides three validation modes to balance data quality and performance:
123
+ # Build the SDK
124
+ npm run build
129
125
 
130
- ```typescript
131
- import {
132
- createProcess,
133
- setGlobalValidationMode,
134
- getGlobalValidationMode
135
- } from '@tiangong-lca/tidas-sdk/core';
136
-
137
- // Strict validation (default) - Full schema validation, rejects on any error
138
- const strictProcess = createProcess({}, { mode: 'strict' });
139
- const result = strictProcess.validate();
140
-
141
- // Weak validation - Non-critical issues become warnings
142
- const weakProcess = createProcess({}, { mode: 'weak', includeWarnings: true });
143
- const enhanced = weakProcess.validateEnhanced();
144
- console.log('Warnings:', enhanced.warnings);
145
-
146
- // Ignore validation - Skip validation for maximum performance
147
- const fastProcess = createProcess({}, { mode: 'ignore' });
148
- // Always passes validation - ideal for bulk operations
149
-
150
- // Global validation configuration
151
- setGlobalValidationMode('weak'); // Applies to all new entities
152
- const process = createProcess(); // Uses weak validation
153
-
154
- // Runtime configuration changes
155
- process.setValidationMode('strict');
156
- console.log('Current mode:', process.getValidationConfig().mode);
126
+ # Run tests
127
+ npm test
157
128
  ```
158
129
 
159
- ### 4. Batch Operations
160
-
161
- Create and process multiple entities efficiently:
162
-
163
- ```typescript
164
- import { createFlowsBatch, createContactsBatch } from '@tiangong-lca/tidas-sdk/core';
165
-
166
- // Create multiple entities at once
167
- const flowsData = [
168
- { flowDataSet: { /* data 1 */ } },
169
- { flowDataSet: { /* data 2 */ } },
170
- { flowDataSet: { /* data 3 */ } },
171
- ];
172
-
173
- const flows = createFlowsBatch(flowsData, { mode: 'weak' });
174
-
175
- // Process in batch
176
- flows.forEach((flow, index) => {
177
- flow.flowDataSet.flowInformation.dataSetInformation.name.baseName.setText?.(
178
- `Flow ${index + 1}`,
179
- 'en'
180
- );
181
- });
130
+ ### Development Commands
182
131
 
183
- // Validate all
184
- const validationResults = flows.map(flow => flow.validate());
185
- const successCount = validationResults.filter(r => r.success).length;
186
- console.log(`${successCount}/${flows.length} flows are valid`);
187
- ```
132
+ ```bash
133
+ # Development mode (watch)
134
+ npm run dev
188
135
 
189
- ### 5. JSON Operations
136
+ # Type checking
137
+ npm run typecheck
190
138
 
191
- Convert between entities and JSON:
139
+ # Linting
140
+ npm run lint
141
+ npm run lint:fix
192
142
 
193
- ```typescript
194
- // Export to JSON
195
- const jsonString = process.toJSONString(2); // Pretty-printed with 2-space indent
196
- const jsonObject = process.toJSON();
143
+ # Formatting
144
+ npm run format
145
+ npm run format:check
197
146
 
198
- // Import from JSON string
199
- import { createProcess } from '@tiangong-lca/tidas-sdk/core';
147
+ # Testing
148
+ npm test
149
+ npm run test:watch
150
+ npm run test:coverage
200
151
 
201
- const jsonData = '{ "processDataSet": { ... } }';
202
- const parsedData = JSON.parse(jsonData);
203
- const importedProcess = createProcess(parsedData);
204
-
205
- // Verify imported data
206
- const validation = importedProcess.validate();
207
- if (validation.success) {
208
- console.log('Successfully imported and validated');
209
- }
152
+ # Build
153
+ npm run clean
154
+ npm run build
210
155
  ```
211
156
 
212
- ### 6. Entity Cloning
157
+ ### Testing
213
158
 
214
- Create copies of entities:
215
-
216
- ```typescript
217
- // Clone an existing entity
218
- const originalContact = createContact();
219
- originalContact.contactDataSet.contactInformation.dataSetInformation['common:name'].setText?.('Dr. Alice Johnson', 'en');
220
-
221
- const clonedContact = originalContact.clone();
159
+ ```bash
160
+ # Run all tests
161
+ npm test
222
162
 
223
- // Modify the clone independently
224
- clonedContact.contactDataSet.contactInformation.dataSetInformation['common:name'] = [
225
- { '@xml:lang': 'en', '#text': 'Dr. Alice Johnson (Copy)' }
226
- ];
163
+ # Watch mode
164
+ npm run test:watch
227
165
 
228
- // Generate new UUID for the clone
229
- clonedContact.contactDataSet.contactInformation.dataSetInformation['common:UUID'] = crypto.randomUUID();
166
+ # Coverage report
167
+ npm run test:coverage
230
168
  ```
231
169
 
232
- ### 7. Entity Relationships
170
+ ## 📚 Examples
233
171
 
234
- Build relationships between different entity types:
172
+ See the [examples](./examples/) directory for comprehensive usage examples:
235
173
 
236
- ```typescript
237
- // Create related entities
238
- const massUnitGroup = createUnitGroup();
239
- massUnitGroup.unitGroupDataSet.unitGroupInformation.dataSetInformation['common:name'] = [
240
- { '@xml:lang': 'en', '#text': 'Mass units' }
241
- ];
242
-
243
- const massFlowProperty = createFlowProperty();
244
- massFlowProperty.flowPropertyDataSet.flowPropertiesInformation.dataSetInformation['common:name'] = [
245
- { '@xml:lang': 'en', '#text': 'Mass' }
246
- ];
247
-
248
- // Reference unit group in flow property
249
- const unitGroupUUID = massUnitGroup.unitGroupDataSet.unitGroupInformation.dataSetInformation['common:UUID'];
250
- massFlowProperty.flowPropertyDataSet.flowPropertiesInformation.quantitativeReference.referenceToReferenceUnitGroup = {
251
- '@type': 'unit group data set',
252
- '@refObjectId': unitGroupUUID,
253
- '@version': '1.0.0',
254
- '@uri': '',
255
- 'common:shortDescription': [{ '@xml:lang': 'en', '#text': 'Mass units' }],
256
- };
257
-
258
- // Create a flow using this flow property
259
- const co2Flow = createFlow();
260
- const flowPropertyUUID = massFlowProperty.flowPropertyDataSet.flowPropertiesInformation.dataSetInformation['common:UUID'];
261
- co2Flow.flowDataSet.flowProperties.flowProperty = {
262
- '@dataSetInternalID': '0',
263
- referenceToFlowPropertyDataSet: {
264
- '@type': 'flow property data set',
265
- '@refObjectId': flowPropertyUUID,
266
- '@version': '1.0.0',
267
- '@uri': '',
268
- 'common:shortDescription': [{ '@xml:lang': 'en', '#text': 'Mass' }],
269
- },
270
- meanValue: '1.0',
271
- };
272
- ```
273
-
274
- ### 8. AI-Powered Data Improvement
174
+ - [01-basic-usage](./examples/01-basic-usage/) - Basic object creation and manipulation
175
+ - [02-object-oriented-usage](./examples/02-object-oriented-usage/) - Advanced patterns
176
+ - [03-complete-tidas-entities](./examples/03-complete-tidas-entities/) - All data types
275
177
 
276
- Use AI to improve data quality and compliance with TIDAS methodology rules:
178
+ ## 🔗 API Reference
277
179
 
278
- ```typescript
279
- import { createProcess, suggestData } from '@tiangong-lca/tidas-sdk';
180
+ ### Factory Functions
280
181
 
281
- // Set your OpenAI API key (required)
282
- process.env.OPENAI_API_KEY = 'your-api-key';
182
+ All TIDAS types have corresponding factory functions:
283
183
 
284
- // Method 1: Using entity's suggest method
285
- const process = createProcess({ processDataSet: { /* incomplete data */ } });
286
- const result = await process.suggest({
287
- outputDiffSummary: true, // Get text diff summary
288
- outputDiffHTML: true, // Get HTML diff viewer
289
- });
184
+ ```typescript
185
+ // General pattern
186
+ createTidas{Type}(data: Partial<Tidas{Type}>): Tidas{Type}
290
187
 
291
- console.log(result.data); // The improved entity
292
- console.log(result.diffSummary); // Text diff summary
293
- console.log(result.diffHTML); // HTML diff visualization
294
-
295
- // Method 2: Using the suggestData service function
296
- const improvedResult = await suggestData(
297
- { processDataSet: { /* data */ } },
298
- 'process',
299
- {
300
- skipPaths: ['administrativeInformation'], // Skip certain paths
301
- maxRetries: 2, // Retry on validation failures
302
- outputDiffSummary: true
303
- }
304
- );
305
-
306
- // Method 3: Batch suggestions
307
- import { batchSuggest } from '@tiangong-lca/tidas-sdk';
308
-
309
- const results = await batchSuggest([
310
- { data: processData1, type: 'process' },
311
- { data: flowData, type: 'flow' },
312
- { data: contactData, type: 'contact' }
313
- ]);
188
+ // Examples
189
+ createTidasContact(data)
190
+ createTidasProcess(data)
191
+ createTidasFlow(data)
314
192
  ```
315
193
 
316
- ### 9. Validation Error Handling
317
-
318
- Handle validation errors gracefully:
194
+ ### Validation
319
195
 
320
196
  ```typescript
321
- // Basic validation
322
- const process = createProcess();
323
- const validation = process.validate();
324
-
325
- if (!validation.success) {
326
- console.log('Validation errors:', validation.error.issues);
327
- validation.error.issues.forEach(issue => {
328
- console.log(`- ${issue.path.join('.')}: ${issue.message}`);
329
- });
330
- }
331
-
332
- // Enhanced validation with warnings
333
- const weakProcess = createProcess({}, { mode: 'weak', includeWarnings: true });
334
- const enhanced = weakProcess.validateEnhanced();
335
-
336
- if (enhanced.warnings) {
337
- console.log('Validation warnings:');
338
- enhanced.warnings.forEach(warning => {
339
- console.log(`[${warning.severity}] ${warning.path.join('.')}: ${warning.message}`);
340
- });
197
+ // Validate any TIDAS data
198
+ const result = validateTidasData(data, 'Contact');
199
+ if (result.success) {
200
+ // Data is valid
201
+ } else {
202
+ // Handle validation errors
203
+ console.error(result.errors);
341
204
  }
342
205
  ```
343
206
 
344
- ### 10. Performance Optimization
345
-
346
- For performance-critical scenarios:
207
+ ### Property Access
347
208
 
348
209
  ```typescript
349
- // Use ignore mode for bulk operations
350
- const startTime = performance.now();
351
- const manyFlows = createFlowsBatch(
352
- Array(1000).fill({}),
353
- { mode: 'ignore' } // Skip validation for maximum speed
354
- );
355
- const endTime = performance.now();
356
- console.log(`Created 1000 flows in ${endTime - startTime}ms`);
357
-
358
- // Configure properties without validation overhead
359
- manyFlows.forEach((flow, index) => {
360
- flow.flowDataSet.flowInformation.dataSetInformation.name.baseName.setText?.(
361
- `Flow ${index}`,
362
- 'en'
363
- );
364
- });
365
-
366
- // Validate only when needed
367
- const validationResults = manyFlows.map(f => f.validate());
210
+ // Access nested properties with type safety
211
+ const contact = createTidasContact(data);
212
+ const email = contact.email; // Type: string | undefined
213
+ const address = contact.address?.street; // Type: string | undefined
368
214
  ```
369
215
 
370
- ## 📚 Examples
216
+ ## 📖 Documentation
371
217
 
372
- The `examples/` directory contains comprehensive usage examples:
218
+ - **Development Guidelines**: [../../CLAUDE.md](../../CLAUDE.md)
219
+ - **Project Progress**: [../../docs/development-progress.md](../../docs/development-progress.md)
220
+ - **Requirements**: [../../docs/requirement-design.md](../../docs/requirement-design.md)
221
+ - **Release Notes**: [RELEASE.md](./RELEASE.md)
373
222
 
374
- - `01-basic-usage/` - Simple entity creation and basic operations
375
- - `02-advanced-features/` - Advanced patterns including batch operations and relationships
376
- - `03-validation-modes/` - Comprehensive validation configuration examples
223
+ ## 🚀 Release
377
224
 
378
- To run the examples:
225
+ Automated release process:
379
226
 
380
227
  ```bash
381
- cd examples
382
- npm install
383
- npm run run-basic # Basic entity usage
384
- npm run run-advanced # Advanced usage patterns
385
- npm run run-validation # Validation configuration demo
386
- ```
387
-
388
- See [examples/README.md](examples/README.md) for detailed information.
389
-
390
- ## 🔧 Development
228
+ # Patch release (x.y.Z)
229
+ npm run release:patch
391
230
 
392
- This repository contains the source code for the SDK. The examples use the published npm package.
231
+ # Minor release (x.Y.z)
232
+ npm run release:minor
393
233
 
394
- ### Build Commands
395
-
396
- ```bash
397
- npm run build # Compile TypeScript
398
- npm run dev # Watch mode
399
- npm run generate-types # Generate types from schemas
400
- npm run generate-schemas # Generate Zod schemas
401
- npm run test # Run tests
402
- npm run lint # Lint code
403
- npm run format # Format code
404
- ```
405
-
406
- ### Project Structure
407
-
408
- ```
409
- tidas-typescript/
410
- ├── src/
411
- │ ├── types/ # Generated TypeScript types (18 files)
412
- │ ├── schemas/ # Generated Zod schemas (18 files)
413
- │ ├── core/ # Core functionality
414
- │ │ ├── base/ # TidasEntity base class
415
- │ │ ├── entities/ # 8 entity classes
416
- │ │ ├── factories/ # Factory functions
417
- │ │ └── config/ # Validation configuration
418
- │ ├── utils/ # Utility functions
419
- │ └── services/ # AI suggestion service
420
- ├── examples/ # Usage examples
421
- ├── scripts/ # Code generation scripts
422
- └── dist/ # Compiled output
234
+ # Major release (X.y.z)
235
+ npm run release:major
423
236
  ```
424
237
 
425
238
  ## 🤝 Contributing
426
239
 
427
- 1. Fork the repository
428
- 2. Create a feature branch
429
- 3. Make your changes
430
- 4. Add tests and examples
431
- 5. Submit a pull request
240
+ We welcome contributions! Please:
241
+ 1. Follow the development guidelines
242
+ 2. Add tests for new functionality
243
+ 3. Ensure all tests pass and code is properly formatted
244
+ 4. Update documentation as needed
432
245
 
433
246
  ## 📄 License
434
247
 
435
- MIT License - see [LICENSE](LICENSE) file for details.
436
-
437
- ## 🏷️ Version
438
-
439
- Current version: 0.1.16
248
+ MIT License - see [LICENSE](../LICENSE) file for details.
440
249
 
441
- ## 🔗 Links
250
+ ## 🔗 Related Packages
442
251
 
443
- - [npm package](https://www.npmjs.com/package/@tiangong-lca/tidas-sdk)
444
- - [GitHub repository](https://github.com/tiangong-lca/tidas-sdk)
445
-
446
- ## 📖 API Reference
447
-
448
- ### Core Entities
449
-
450
- All entity types follow the same pattern:
451
-
452
- - `TidasContact` - Contact/organization information
453
- - `TidasFlow` - Material or energy flows
454
- - `TidasProcess` - Process datasets
455
- - `TidasSource` - Literature sources
456
- - `TidasFlowProperty` - Flow properties (e.g., mass, energy)
457
- - `TidasUnitGroup` - Unit groups for measurements
458
- - `TidasLCIAMethod` - LCIA methodology data
459
- - `TidasLifeCycleModel` - Life cycle models
460
-
461
- ### Factory Functions
462
-
463
- - `createContact(data?, config?)` - Create Contact entity
464
- - `createFlow(data?, config?)` - Create Flow entity
465
- - `createProcess(data?, config?)` - Create Process entity
466
- - `createSource(data?, config?)` - Create Source entity
467
- - `createFlowProperty(data?, config?)` - Create FlowProperty entity
468
- - `createUnitGroup(data?, config?)` - Create UnitGroup entity
469
- - `createLCIAMethod(data?, config?)` - Create LCIAMethod entity
470
- - `createLifeCycleModel(data?, config?)` - Create LifeCycleModel entity
471
-
472
- Batch factory functions:
473
-
474
- - `createContactsBatch(dataArray, config?)` - Create multiple Contacts
475
- - `createFlowsBatch(dataArray, config?)` - Create multiple Flows
476
- - `createProcessesBatch(dataArray, config?)` - Create multiple Processes
477
- - (Similar batch functions for all entity types)
478
-
479
- ### Entity Methods
480
-
481
- All entities inherit these methods from `TidasEntity`:
482
-
483
- - `validate()` - Validate entity data (legacy format)
484
- - `validateEnhanced()` - Enhanced validation with warnings
485
- - `toJSON()` - Convert to plain JavaScript object
486
- - `toJSONString(indent?)` - Convert to JSON string
487
- - `clone()` - Create a deep copy of the entity
488
- - `getValue(path)` - Get nested value using dot notation
489
- - `getValidationConfig()` - Get current validation configuration
490
- - `setValidationMode(mode)` - Set validation mode
491
- - `setValidationConfig(config)` - Set validation configuration
492
- - `suggest(options?)` - AI-powered data improvement
493
-
494
- ### Validation Configuration
495
-
496
- ```typescript
497
- interface ValidationConfig {
498
- mode: 'strict' | 'weak' | 'ignore';
499
- includeWarnings?: boolean;
500
- }
501
-
502
- // Global configuration functions
503
- setGlobalValidationMode(mode: 'strict' | 'weak' | 'ignore'): void
504
- getGlobalValidationMode(): 'strict' | 'weak' | 'ignore'
505
- setGlobalValidationConfig(config: Partial<ValidationConfig>): void
506
- resetGlobalConfig(): void
507
- ```
508
-
509
- ### AI Suggestion Service
510
-
511
- ```typescript
512
- // Suggest improvements for data
513
- suggestData(
514
- data: any,
515
- dataType: DataType,
516
- options?: SuggestOptions
517
- ): Promise<SuggestResult>
518
-
519
- // Batch suggestions
520
- batchSuggest(
521
- items: Array<{ data: any; type: DataType }>,
522
- options?: SuggestOptions
523
- ): Promise<SuggestResult[]>
524
-
525
- // Validate API key
526
- validateApiKey(): boolean
527
-
528
- // Get available data types
529
- getAvailableDataTypes(): string[]
530
- ```
252
+ - [tidas-tools](https://pypi.org/project/tidas-tools/): Python utilities for TIDAS data
253
+ - [tidas-python-sdk](../python/): Python SDK (in development)