@almadar/integrations 2.39.0 → 2.41.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.
@@ -395,8 +395,7 @@ var serviceCredentials = {
395
395
  { envVar: "RIGGER_GENERATE_TIMEOUT_MS", required: false, description: "Timeout (ms) for the 'generate' action; a local z-image-turbo run takes ~60-90 s and a kontext edit at 1024px several minutes (default 600000)" }
396
396
  ]
397
397
  };
398
-
399
- // src/factory.ts
398
+ var callLog = createLogger("almadar:integrations:calls");
400
399
  function instanceKey(name, principal) {
401
400
  return principal ? `${name}\0${principal}` : name;
402
401
  }
@@ -441,8 +440,16 @@ var IntegrationFactory = class {
441
440
  * Execute an action on an integration
442
441
  */
443
442
  async execute(integration, action, params, context) {
444
- const instance = this.get(integration, context?.principal);
445
- return await instance.execute(action, params, context);
443
+ const start = performance.now();
444
+ const record = (ok, error) => callLog.call({ kind: "external", service: integration, op: action, durationMs: performance.now() - start, ok, ...error !== void 0 ? { error } : {} });
445
+ try {
446
+ const result = await this.get(integration, context?.principal).execute(action, params, context);
447
+ record(result.success, result.success ? void 0 : result.error?.message);
448
+ return result;
449
+ } catch (err) {
450
+ record(false, err instanceof Error ? err.message : String(err));
451
+ throw err;
452
+ }
446
453
  }
447
454
  /**
448
455
  * Check if integration is configured