abapgit-agent 1.2.0 → 1.4.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.
@@ -378,6 +378,24 @@ class ABAPClient {
378
378
 
379
379
  return await this.request('POST', '/tree', data, { csrfToken: this.csrfToken });
380
380
  }
381
+
382
+ async preview(objects, type = null, limit = 10) {
383
+ // Fetch CSRF token first
384
+ await this.fetchCsrfToken();
385
+
386
+ const data = {
387
+ objects: objects,
388
+ limit: Math.min(Math.max(1, limit), 100)
389
+ };
390
+
391
+ if (type) {
392
+ data.type = type;
393
+ }
394
+
395
+ logger.info('Previewing data', { objects, type, limit: data.limit, service: 'abapgit-agent' });
396
+
397
+ return await this.request('POST', '/preview', data, { csrfToken: this.csrfToken });
398
+ }
381
399
  }
382
400
 
383
401
  // Singleton instance
package/src/agent.js CHANGED
@@ -191,6 +191,25 @@ class ABAPGitAgent {
191
191
  throw new Error(`Tree command failed: ${error.message}`);
192
192
  }
193
193
  }
194
+
195
+ async preview(objects, type = null, limit = 10) {
196
+ logger.info('Previewing data', { objects, type, limit });
197
+
198
+ try {
199
+ const result = await this.abap.preview(objects, type, limit);
200
+ return {
201
+ success: result.SUCCESS === 'X' || result.success === 'X' || result.success === true,
202
+ command: result.COMMAND || result.command || 'PREVIEW',
203
+ message: result.MESSAGE || result.message || '',
204
+ objects: result.OBJECTS || result.objects || [],
205
+ summary: result.SUMMARY || result.summary || null,
206
+ error: result.ERROR || result.error || null
207
+ };
208
+ } catch (error) {
209
+ logger.error('Preview command failed', { error: error.message });
210
+ throw new Error(`Preview command failed: ${error.message}`);
211
+ }
212
+ }
194
213
  }
195
214
 
196
215
  module.exports = {