@almadar/integrations 2.6.3 → 2.7.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.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { I as IntegrationParams, a as IntegrationLogger, b as IntegrationErrorCode, c as IntegrationConfig, B as BaseIntegration, d as IntegrationResult } from './BaseIntegration-DjXCkytU.js';
2
2
  export { e as IntegrationError, V as ValidationError, f as ValidationResult, v as validateParams } from './BaseIntegration-DjXCkytU.js';
3
- import { LogMeta } from '@almadar/core';
3
+ import { ServiceParams, LogMeta } from '@almadar/core';
4
4
  export { I as IntegrationFactory, g as getIntegrationFactory, r as resetIntegrationFactory } from './factory-BoDqQ89e.js';
5
5
  export { GitHubIntegration } from './integrations/github/index.js';
6
6
 
@@ -385,7 +385,7 @@ type StorageActions = {
385
385
  params: {
386
386
  bucket: string;
387
387
  key: string;
388
- content: unknown;
388
+ content: string;
389
389
  contentType?: string;
390
390
  metadata?: IntegrationParams;
391
391
  };
@@ -402,7 +402,7 @@ type StorageActions = {
402
402
  key: string;
403
403
  };
404
404
  result: {
405
- content: unknown;
405
+ content: string;
406
406
  contentType: string;
407
407
  size: number;
408
408
  metadata: IntegrationParams;
@@ -449,7 +449,7 @@ type QueueActions = {
449
449
  enqueue: {
450
450
  params: {
451
451
  queue: string;
452
- payload: unknown;
452
+ payload: ServiceParams;
453
453
  delay?: number;
454
454
  priority?: number;
455
455
  };
@@ -465,7 +465,7 @@ type QueueActions = {
465
465
  result: {
466
466
  job: {
467
467
  id: string;
468
- payload: unknown;
468
+ payload: ServiceParams;
469
469
  enqueuedAt: number;
470
470
  priority: number;
471
471
  } | null;
@@ -479,7 +479,7 @@ type QueueActions = {
479
479
  status: 'pending' | 'processing' | 'completed' | 'failed';
480
480
  job: {
481
481
  id: string;
482
- payload: unknown;
482
+ payload: ServiceParams;
483
483
  enqueuedAt: number;
484
484
  priority: number;
485
485
  } | null;
@@ -488,7 +488,7 @@ type QueueActions = {
488
488
  complete: {
489
489
  params: {
490
490
  jobId: string;
491
- result?: unknown;
491
+ result?: ServiceParams;
492
492
  };
493
493
  result: {
494
494
  completed: boolean;
@@ -528,13 +528,13 @@ type RedisActions = {
528
528
  key: string;
529
529
  };
530
530
  result: {
531
- value: unknown;
531
+ value: ServiceParams;
532
532
  };
533
533
  };
534
534
  set: {
535
535
  params: {
536
536
  key: string;
537
- value: unknown;
537
+ value: ServiceParams;
538
538
  ttl?: number;
539
539
  };
540
540
  result: {
@@ -589,7 +589,7 @@ type RedisActions = {
589
589
  publish: {
590
590
  params: {
591
591
  channel: string;
592
- message: unknown;
592
+ message: ServiceParams;
593
593
  };
594
594
  result: {
595
595
  receivers: number;
@@ -833,16 +833,24 @@ type IntegrationName = keyof IntegrationContracts;
833
833
  type IntegrationActionName<K extends IntegrationName> = keyof IntegrationContracts[K] & string;
834
834
 
835
835
  /**
836
- * Console-based logger implementation
836
+ * Console-based logger implementation.
837
+ *
838
+ * Routes through `@almadar/logger`'s shared gate so namespace filtering
839
+ * (`ALMADAR_DEBUG`, `globalThis.__ALMADAR_DEBUG__`) and the production
840
+ * level default (WARN+) apply uniformly with the rest of `@almadar/*`.
841
+ *
842
+ * The constructor's `level` argument is retained for backwards
843
+ * compatibility but is now a no-op — the active level is owned by the
844
+ * shared logger (compile-time + env). To filter integration logs at
845
+ * runtime, set `globalThis.__ALMADAR_DEBUG__ = 'almadar:integrations:*'`.
837
846
  */
838
847
  declare class ConsoleLogger implements IntegrationLogger {
839
- private level;
840
- constructor(level?: 'debug' | 'info' | 'warn' | 'error');
848
+ private readonly log;
849
+ constructor(_level?: 'debug' | 'info' | 'warn' | 'error');
841
850
  debug(message: string, meta?: LogMeta): void;
842
851
  info(message: string, meta?: LogMeta): void;
843
852
  warn(message: string, meta?: LogMeta): void;
844
853
  error(message: string, meta?: LogMeta): void;
845
- private shouldLog;
846
854
  }
847
855
 
848
856
  /**
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { createLogger } from '@almadar/logger';
1
2
  import { integratorsRegistry } from '@almadar/patterns';
2
3
  import Stripe from 'stripe';
3
4
  import { google } from 'googleapis';
@@ -13,32 +14,20 @@ import { tmpdir } from 'os';
13
14
 
14
15
  // src/core/logger.ts
15
16
  var ConsoleLogger = class {
16
- constructor(level = "info") {
17
- this.level = level;
17
+ constructor(_level = "info") {
18
+ this.log = createLogger("almadar:integrations");
18
19
  }
19
20
  debug(message, meta) {
20
- if (this.shouldLog("debug")) {
21
- console.debug(`[DEBUG] ${message}`, meta || "");
22
- }
21
+ this.log.debug(message, meta);
23
22
  }
24
23
  info(message, meta) {
25
- if (this.shouldLog("info")) {
26
- console.log(`[INFO] ${message}`, meta || "");
27
- }
24
+ this.log.info(message, meta);
28
25
  }
29
26
  warn(message, meta) {
30
- if (this.shouldLog("warn")) {
31
- console.warn(`[WARN] ${message}`, meta || "");
32
- }
27
+ this.log.warn(message, meta);
33
28
  }
34
29
  error(message, meta) {
35
- if (this.shouldLog("error")) {
36
- console.error(`[ERROR] ${message}`, meta || "");
37
- }
38
- }
39
- shouldLog(level) {
40
- const levels = ["debug", "info", "warn", "error"];
41
- return levels.indexOf(level) >= levels.indexOf(this.level);
30
+ this.log.error(message, meta);
42
31
  }
43
32
  };
44
33
  function validateParams(integration, action, params) {