@tiangong-lca/tidas-sdk 0.1.9 → 0.1.10

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 (38) hide show
  1. package/dist/core/base/TidasEntity.d.ts +85 -0
  2. package/dist/core/base/TidasEntity.d.ts.map +1 -1
  3. package/dist/core/base/TidasEntity.js +123 -1
  4. package/dist/core/base/TidasEntity.js.map +1 -1
  5. package/dist/core/methodology/ai.d.ts +150 -0
  6. package/dist/core/methodology/ai.d.ts.map +1 -0
  7. package/dist/core/methodology/ai.js +581 -0
  8. package/dist/core/methodology/ai.js.map +1 -0
  9. package/dist/core/methodology/base.d.ts +58 -0
  10. package/dist/core/methodology/base.d.ts.map +1 -0
  11. package/dist/core/methodology/base.js +178 -0
  12. package/dist/core/methodology/base.js.map +1 -0
  13. package/dist/core/methodology/index.d.ts +1 -0
  14. package/dist/core/methodology/index.d.ts.map +1 -0
  15. package/dist/core/methodology/index.js +2 -0
  16. package/dist/core/methodology/index.js.map +1 -0
  17. package/dist/index.d.ts +3 -2
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +10 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/methodologies/tidas_processes.yaml +375 -0
  22. package/dist/services/index.d.ts +9 -0
  23. package/dist/services/index.d.ts.map +1 -0
  24. package/dist/services/index.js +24 -0
  25. package/dist/services/index.js.map +1 -0
  26. package/dist/services/suggestion-service.d.ts +147 -0
  27. package/dist/services/suggestion-service.d.ts.map +1 -0
  28. package/dist/services/suggestion-service.js +259 -0
  29. package/dist/services/suggestion-service.js.map +1 -0
  30. package/dist/utils/diff.d.ts +47 -0
  31. package/dist/utils/diff.d.ts.map +1 -0
  32. package/dist/utils/diff.js +263 -0
  33. package/dist/utils/diff.js.map +1 -0
  34. package/dist/utils/object-utils.d.ts +18 -0
  35. package/dist/utils/object-utils.d.ts.map +1 -1
  36. package/dist/utils/object-utils.js +178 -2
  37. package/dist/utils/object-utils.js.map +1 -1
  38. package/package.json +6 -2
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Suggestion Service
3
+ *
4
+ * Provides a simple API for external modules to suggest improvements for TIDAS/ILCD data
5
+ * using AI-powered methodology rules.
6
+ */
7
+ import type { ModelConfig } from '../core/methodology/ai';
8
+ /**
9
+ * Supported data types for suggestions
10
+ */
11
+ export type DataType = 'process' | 'processes' | 'flow' | 'flows' | 'contact' | 'contacts' | 'source' | 'sources' | 'flowproperty' | 'flowproperties' | 'unitgroup' | 'unitgroups' | 'lciamethod' | 'lciamethods' | 'lifecyclemodel' | 'lifecyclemodels';
12
+ /**
13
+ * Options for suggestions
14
+ */
15
+ export interface SuggestOptions {
16
+ /** Paths to skip during suggestion */
17
+ skipPaths?: string[];
18
+ /** Maximum retries per rule */
19
+ maxRetries?: number;
20
+ /** Generate text diff summary */
21
+ outputDiffSummary?: boolean;
22
+ /** Generate HTML diff viewer */
23
+ outputDiffHTML?: boolean;
24
+ /** Specific paths to focus on in diff summary */
25
+ diffPaths?: string[];
26
+ /** Model configuration for AI */
27
+ modelConfig?: ModelConfig;
28
+ }
29
+ /**
30
+ * Result of suggestion
31
+ */
32
+ export interface SuggestResult {
33
+ /** The improved data */
34
+ data: any;
35
+ /** Text diff summary (if requested) */
36
+ diffSummary?: string;
37
+ /** HTML diff viewer code (if requested) */
38
+ diffHTML?: string;
39
+ /** Whether the suggestion was successful */
40
+ success: boolean;
41
+ /** Error message if suggestion failed */
42
+ error?: string;
43
+ }
44
+ /**
45
+ * Suggest improvements for TIDAS/ILCD data using AI-powered methodology rules
46
+ *
47
+ * This function can work in three modes:
48
+ * 1. Entity instance: If a TIDAS entity is passed, uses its suggest method directly
49
+ * 2. Entity mode (default): Creates proper TIDAS entities for validation and structure
50
+ * 3. Raw mode: Directly processes data without entity creation (use `raw: true` option)
51
+ *
52
+ * @param data - The data to improve (can be TIDAS entity, JSON string, or object)
53
+ * @param dataType - The type of data (e.g., 'process', 'flow', etc.) or methodology name for raw mode
54
+ * @param options - Optional configuration for suggestions
55
+ * @returns Promise<SuggestResult> - The suggestion result
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * // With TIDAS entity
60
+ * const process = createProcess({ processDataSet: { ... } });
61
+ * const result = await suggestData(process, 'process');
62
+ *
63
+ * // Entity mode - with proper validation and structure
64
+ * const result = await suggestData(
65
+ * { processDataSet: { ... } },
66
+ * 'process'
67
+ * );
68
+ *
69
+ * // Raw mode - direct processing without entity creation
70
+ * const result = await suggestData(
71
+ * { name: 'test', description: 'sample' },
72
+ * 'processes',
73
+ * { raw: true }
74
+ * );
75
+ *
76
+ * // With JSON string and diff outputs
77
+ * const result = await suggestData(
78
+ * '{"processDataSet": {...}}',
79
+ * 'process',
80
+ * {
81
+ * outputDiffHTML: true,
82
+ * outputDiffSummary: true
83
+ * }
84
+ * );
85
+ *
86
+ * // Access results
87
+ * console.log(result.data); // Improved data
88
+ * console.log(result.diffHTML); // HTML diff viewer
89
+ * console.log(result.diffSummary); // Text diff summary
90
+ * ```
91
+ */
92
+ export declare function suggestData(data: any, dataType: DataType | string, options?: SuggestOptions & {
93
+ raw?: boolean;
94
+ }): Promise<SuggestResult>;
95
+ /**
96
+ * @deprecated Use suggestData with { raw: true } option instead
97
+ *
98
+ * This function is kept for backward compatibility but will be removed in future versions.
99
+ * Please use suggestData with the raw option:
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * // Instead of:
104
+ * const result = await suggestRawData(data, 'processes');
105
+ *
106
+ * // Use:
107
+ * const result = await suggestData(data, 'processes', { raw: true });
108
+ * ```
109
+ */
110
+ export declare function suggestRawData(data: any, dataType: DataType | string, options?: SuggestOptions): Promise<SuggestResult>;
111
+ /**
112
+ * Batch suggest improvements for multiple data items
113
+ *
114
+ * @param items - Array of items to improve
115
+ * @param options - Optional configuration
116
+ * @returns Promise<SuggestResult[]> - Array of suggestion results
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * const results = await batchSuggest([
121
+ * { data: processData1, type: 'process' },
122
+ * { data: flowData, type: 'flow' },
123
+ * { data: contactData, type: 'contact' }
124
+ * ]);
125
+ * ```
126
+ */
127
+ export declare function batchSuggest(items: Array<{
128
+ data: any;
129
+ type: DataType;
130
+ }>, options?: SuggestOptions): Promise<SuggestResult[]>;
131
+ /**
132
+ * Validate if the provided API key is configured
133
+ */
134
+ export declare function validateApiKey(): boolean;
135
+ /**
136
+ * Get available data types for optimization
137
+ */
138
+ export declare function getAvailableDataTypes(): string[];
139
+ declare const _default: {
140
+ suggestData: typeof suggestData;
141
+ suggestRawData: typeof suggestRawData;
142
+ batchSuggest: typeof batchSuggest;
143
+ validateApiKey: typeof validateApiKey;
144
+ getAvailableDataTypes: typeof getAvailableDataTypes;
145
+ };
146
+ export default _default;
147
+ //# sourceMappingURL=suggestion-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggestion-service.d.ts","sourceRoot":"","sources":["../../src/services/suggestion-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D;;GAEG;AACH,MAAM,MAAM,QAAQ,GAChB,SAAS,GACT,WAAW,GACX,MAAM,GACN,OAAO,GACP,SAAS,GACT,UAAU,GACV,QAAQ,GACR,SAAS,GACT,cAAc,GACd,gBAAgB,GAChB,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,aAAa,GACb,gBAAgB,GAChB,iBAAiB,CAAC;AAEtB;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gCAAgC;IAChC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,iCAAiC;IACjC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,wBAAwB;IACxB,IAAI,EAAE,GAAG,CAAC;IACV,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA8CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE,QAAQ,GAAG,MAAM,EAC3B,OAAO,CAAC,EAAE,cAAc,GAAG;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3C,OAAO,CAAC,aAAa,CAAC,CAkHxB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE,QAAQ,GAAG,MAAM,EAC3B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,aAAa,CAAC,CAGxB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,GAAG,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,EAC3C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,aAAa,EAAE,CAAC,CAK1B;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAEhD;;;;;;;;AAGD,wBAME"}
@@ -0,0 +1,259 @@
1
+ "use strict";
2
+ /**
3
+ * Suggestion Service
4
+ *
5
+ * Provides a simple API for external modules to suggest improvements for TIDAS/ILCD data
6
+ * using AI-powered methodology rules.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.suggestData = suggestData;
10
+ exports.suggestRawData = suggestRawData;
11
+ exports.batchSuggest = batchSuggest;
12
+ exports.validateApiKey = validateApiKey;
13
+ exports.getAvailableDataTypes = getAvailableDataTypes;
14
+ const factories_1 = require("../core/factories");
15
+ const ai_1 = require("../core/methodology/ai");
16
+ const diff_1 = require("../utils/diff");
17
+ /**
18
+ * Factory map for creating entities based on data type
19
+ */
20
+ const entityFactories = {
21
+ process: factories_1.createProcess,
22
+ processes: factories_1.createProcess,
23
+ flow: factories_1.createFlow,
24
+ flows: factories_1.createFlow,
25
+ contact: factories_1.createContact,
26
+ contacts: factories_1.createContact,
27
+ source: factories_1.createSource,
28
+ sources: factories_1.createSource,
29
+ flowproperty: factories_1.createFlowProperty,
30
+ flowproperties: factories_1.createFlowProperty,
31
+ unitgroup: factories_1.createUnitGroup,
32
+ unitgroups: factories_1.createUnitGroup,
33
+ lciamethod: factories_1.createLCIAMethod,
34
+ lciamethods: factories_1.createLCIAMethod,
35
+ lifecyclemodel: factories_1.createLifeCycleModel,
36
+ lifecyclemodels: factories_1.createLifeCycleModel,
37
+ };
38
+ /**
39
+ * Methodology type mapping for suggestions
40
+ */
41
+ const methodologyTypeMap = {
42
+ process: 'processes',
43
+ processes: 'processes',
44
+ flow: 'flows',
45
+ flows: 'flows',
46
+ contact: 'contacts',
47
+ contacts: 'contacts',
48
+ source: 'sources',
49
+ sources: 'sources',
50
+ flowproperty: 'flowproperties',
51
+ flowproperties: 'flowproperties',
52
+ unitgroup: 'unitgroups',
53
+ unitgroups: 'unitgroups',
54
+ lciamethod: 'lciamethods',
55
+ lciamethods: 'lciamethods',
56
+ lifecyclemodel: 'lifecyclemodels',
57
+ lifecyclemodels: 'lifecyclemodels',
58
+ };
59
+ /**
60
+ * Suggest improvements for TIDAS/ILCD data using AI-powered methodology rules
61
+ *
62
+ * This function can work in three modes:
63
+ * 1. Entity instance: If a TIDAS entity is passed, uses its suggest method directly
64
+ * 2. Entity mode (default): Creates proper TIDAS entities for validation and structure
65
+ * 3. Raw mode: Directly processes data without entity creation (use `raw: true` option)
66
+ *
67
+ * @param data - The data to improve (can be TIDAS entity, JSON string, or object)
68
+ * @param dataType - The type of data (e.g., 'process', 'flow', etc.) or methodology name for raw mode
69
+ * @param options - Optional configuration for suggestions
70
+ * @returns Promise<SuggestResult> - The suggestion result
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * // With TIDAS entity
75
+ * const process = createProcess({ processDataSet: { ... } });
76
+ * const result = await suggestData(process, 'process');
77
+ *
78
+ * // Entity mode - with proper validation and structure
79
+ * const result = await suggestData(
80
+ * { processDataSet: { ... } },
81
+ * 'process'
82
+ * );
83
+ *
84
+ * // Raw mode - direct processing without entity creation
85
+ * const result = await suggestData(
86
+ * { name: 'test', description: 'sample' },
87
+ * 'processes',
88
+ * { raw: true }
89
+ * );
90
+ *
91
+ * // With JSON string and diff outputs
92
+ * const result = await suggestData(
93
+ * '{"processDataSet": {...}}',
94
+ * 'process',
95
+ * {
96
+ * outputDiffHTML: true,
97
+ * outputDiffSummary: true
98
+ * }
99
+ * );
100
+ *
101
+ * // Access results
102
+ * console.log(result.data); // Improved data
103
+ * console.log(result.diffHTML); // HTML diff viewer
104
+ * console.log(result.diffSummary); // Text diff summary
105
+ * ```
106
+ */
107
+ async function suggestData(data, dataType, options) {
108
+ try {
109
+ // Check if data is a TIDAS entity (has suggest method)
110
+ if (data && typeof data.suggest === 'function') {
111
+ // It's a TIDAS entity, use its suggest method directly
112
+ const result = await data.suggest({
113
+ skipPaths: options?.skipPaths,
114
+ maxRetries: options?.maxRetries,
115
+ modelConfig: options?.modelConfig,
116
+ outputDiffSummary: options?.outputDiffSummary,
117
+ outputDiffHTML: options?.outputDiffHTML,
118
+ diffPaths: options?.diffPaths,
119
+ });
120
+ // Extract the improved data
121
+ const improvedData = result.data.toJSON();
122
+ return {
123
+ success: true,
124
+ data: improvedData,
125
+ diffSummary: result.diffSummary,
126
+ diffHTML: result.diffHTML,
127
+ };
128
+ }
129
+ // Parse JSON if string is provided
130
+ const parsedData = typeof data === 'string' ? JSON.parse(data) : data;
131
+ // Check if raw mode is requested
132
+ if (options?.raw) {
133
+ // Raw mode: directly process without entity creation
134
+ const methodologyType = methodologyTypeMap[dataType] || dataType;
135
+ // Store original data for diff if needed
136
+ const originalData = options?.outputDiffSummary || options?.outputDiffHTML
137
+ ? JSON.parse(JSON.stringify(parsedData))
138
+ : null;
139
+ // Apply suggestion directly
140
+ const improvedData = await (0, ai_1.suggestEntireObject)(parsedData, methodologyType, {
141
+ skipPaths: options?.skipPaths,
142
+ maxRetries: options?.maxRetries,
143
+ });
144
+ // Generate diffs if requested
145
+ let diffSummary;
146
+ let diffHTML;
147
+ if (originalData) {
148
+ if (options?.outputDiffSummary) {
149
+ diffSummary = (0, diff_1.generateDiffSummary)(originalData, improvedData, options.diffPaths);
150
+ }
151
+ if (options?.outputDiffHTML) {
152
+ diffHTML = (0, diff_1.generateDiffHTML)(originalData, improvedData);
153
+ }
154
+ }
155
+ return {
156
+ success: true,
157
+ data: improvedData,
158
+ diffSummary,
159
+ diffHTML,
160
+ };
161
+ }
162
+ // Entity mode: use proper entity creation and validation
163
+ if (!entityFactories[dataType]) {
164
+ return {
165
+ success: false,
166
+ data: parsedData,
167
+ error: `Unsupported data type: ${dataType}. Supported types: ${Object.keys(entityFactories).join(', ')}`
168
+ };
169
+ }
170
+ // Create entity from data
171
+ const factory = entityFactories[dataType];
172
+ const entity = factory(parsedData);
173
+ // Use entity's suggest method for improvement
174
+ const result = await entity.suggest({
175
+ skipPaths: options?.skipPaths,
176
+ maxRetries: options?.maxRetries,
177
+ modelConfig: options?.modelConfig,
178
+ outputDiffSummary: options?.outputDiffSummary,
179
+ outputDiffHTML: options?.outputDiffHTML,
180
+ diffPaths: options?.diffPaths,
181
+ });
182
+ // Extract the improved data
183
+ const improvedData = result.data.toJSON();
184
+ return {
185
+ success: true,
186
+ data: improvedData,
187
+ diffSummary: result.diffSummary,
188
+ diffHTML: result.diffHTML,
189
+ };
190
+ }
191
+ catch (error) {
192
+ console.error('Suggestion failed:', error);
193
+ return {
194
+ success: false,
195
+ data: data,
196
+ error: error.message,
197
+ };
198
+ }
199
+ }
200
+ /**
201
+ * @deprecated Use suggestData with { raw: true } option instead
202
+ *
203
+ * This function is kept for backward compatibility but will be removed in future versions.
204
+ * Please use suggestData with the raw option:
205
+ *
206
+ * @example
207
+ * ```typescript
208
+ * // Instead of:
209
+ * const result = await suggestRawData(data, 'processes');
210
+ *
211
+ * // Use:
212
+ * const result = await suggestData(data, 'processes', { raw: true });
213
+ * ```
214
+ */
215
+ async function suggestRawData(data, dataType, options) {
216
+ console.warn('suggestRawData is deprecated. Use suggestData with { raw: true } option instead.');
217
+ return suggestData(data, dataType, { ...options, raw: true });
218
+ }
219
+ /**
220
+ * Batch suggest improvements for multiple data items
221
+ *
222
+ * @param items - Array of items to improve
223
+ * @param options - Optional configuration
224
+ * @returns Promise<SuggestResult[]> - Array of suggestion results
225
+ *
226
+ * @example
227
+ * ```typescript
228
+ * const results = await batchSuggest([
229
+ * { data: processData1, type: 'process' },
230
+ * { data: flowData, type: 'flow' },
231
+ * { data: contactData, type: 'contact' }
232
+ * ]);
233
+ * ```
234
+ */
235
+ async function batchSuggest(items, options) {
236
+ const results = await Promise.all(items.map(item => suggestData(item.data, item.type, options)));
237
+ return results;
238
+ }
239
+ /**
240
+ * Validate if the provided API key is configured
241
+ */
242
+ function validateApiKey() {
243
+ return !!process.env.OPENAI_API_KEY;
244
+ }
245
+ /**
246
+ * Get available data types for optimization
247
+ */
248
+ function getAvailableDataTypes() {
249
+ return Object.keys(entityFactories);
250
+ }
251
+ // Default export for convenience
252
+ exports.default = {
253
+ suggestData,
254
+ suggestRawData, // Deprecated, kept for backward compatibility
255
+ batchSuggest,
256
+ validateApiKey,
257
+ getAvailableDataTypes,
258
+ };
259
+ //# sourceMappingURL=suggestion-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggestion-service.js","sourceRoot":"","sources":["../../src/services/suggestion-service.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAmKH,kCAsHC;AAiBD,wCAOC;AAkBD,oCAQC;AAKD,wCAEC;AAKD,sDAEC;AAvVD,iDAS2B;AAC3B,+CAA6D;AAE7D,wCAAsE;AAyDtE;;GAEG;AACH,MAAM,eAAe,GAAG;IACtB,OAAO,EAAE,yBAAa;IACtB,SAAS,EAAE,yBAAa;IACxB,IAAI,EAAE,sBAAU;IAChB,KAAK,EAAE,sBAAU;IACjB,OAAO,EAAE,yBAAa;IACtB,QAAQ,EAAE,yBAAa;IACvB,MAAM,EAAE,wBAAY;IACpB,OAAO,EAAE,wBAAY;IACrB,YAAY,EAAE,8BAAkB;IAChC,cAAc,EAAE,8BAAkB;IAClC,SAAS,EAAE,2BAAe;IAC1B,UAAU,EAAE,2BAAe;IAC3B,UAAU,EAAE,4BAAgB;IAC5B,WAAW,EAAE,4BAAgB;IAC7B,cAAc,EAAE,gCAAoB;IACpC,eAAe,EAAE,gCAAoB;CACtC,CAAC;AAEF;;GAEG;AACH,MAAM,kBAAkB,GAA6B;IACnD,OAAO,EAAE,WAAW;IACpB,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,gBAAgB;IAC9B,cAAc,EAAE,gBAAgB;IAChC,SAAS,EAAE,YAAY;IACvB,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,aAAa;IACzB,WAAW,EAAE,aAAa;IAC1B,cAAc,EAAE,iBAAiB;IACjC,eAAe,EAAE,iBAAiB;CACnC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACI,KAAK,UAAU,WAAW,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AAC,cAAc,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AACtC,CAAC;AAED,iCAAiC;AACjC,kBAAe;IACb,WAAW;IACX,cAAc,EAAE,8CAA8C;IAC9D,YAAY;IACZ,cAAc;IACd,qBAAqB;CACtB,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Generate an HTML page showing the diff between two JSON objects using Monaco Editor
3
+ *
4
+ * @param original - Original JSON object
5
+ * @param improved - Improved/modified JSON object
6
+ * @param options - Optional configuration
7
+ * @returns HTML string containing the diff viewer
8
+ */
9
+ export declare function generateDiffHTML(original: any, improved: any): string;
10
+ /**
11
+ * Save diff HTML to a file
12
+ *
13
+ * @param original - Original JSON object
14
+ * @param improved - Improved/modified JSON object
15
+ * @param outputPath - Path where to save the HTML file
16
+ * @param options - Optional configuration
17
+ */
18
+ export declare function saveDiffToFile(original: any, improved: any, outputPath: string, options?: {
19
+ title?: string;
20
+ description?: string;
21
+ theme?: 'light' | 'dark';
22
+ }): Promise<void>;
23
+ /**
24
+ * Generate a simple text-based diff summary
25
+ *
26
+ * @param original - Original JSON object
27
+ * @param improved - Improved/modified JSON object
28
+ * @param paths - Optional array of paths to focus on
29
+ * @returns Text summary of differences
30
+ */
31
+ export declare function generateDiffSummary(original: any, improved: any, paths?: string[]): string;
32
+ /**
33
+ * Open diff viewer in browser (Node.js environment)
34
+ */
35
+ export declare function openDiffInBrowser(original: any, improved: any, options?: {
36
+ title?: string;
37
+ description?: string;
38
+ theme?: 'light' | 'dark';
39
+ }): Promise<void>;
40
+ declare const _default: {
41
+ generateDiffHTML: typeof generateDiffHTML;
42
+ saveDiffToFile: typeof saveDiffToFile;
43
+ generateDiffSummary: typeof generateDiffSummary;
44
+ openDiffInBrowser: typeof openDiffInBrowser;
45
+ };
46
+ export default _default;
47
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/utils/diff.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,GAAG,MAAM,CA6CrE;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,GAAG,EACb,QAAQ,EAAE,GAAG,EACb,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;IACR,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1B,GACA,OAAO,CAAC,IAAI,CAAC,CAIf;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,GAAG,EACb,QAAQ,EAAE,GAAG,EACb,KAAK,CAAC,EAAE,MAAM,EAAE,GACf,MAAM,CAmCR;AAiGD;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,GAAG,EACb,QAAQ,EAAE,GAAG,EACb,OAAO,CAAC,EAAE;IACR,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1B,GACA,OAAO,CAAC,IAAI,CAAC,CA4Bf;;;;;;;AAED,wBAKE"}