@almadar/integrations 2.11.0 → 2.13.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,882 +1,10 @@
1
- import { d as IntegrationParams, c as IntegrationLogger, b as IntegrationErrorCode, I as IntegrationConfig, B as BaseIntegration, e as IntegrationResult } from './BaseIntegration-d17YX8KE.js';
2
- export { a as IntegrationError, V as ValidationError, f as ValidationResult, v as validateParams } from './BaseIntegration-d17YX8KE.js';
3
- import { ServiceParams, LogMeta } from '@almadar/core';
4
- export { I as IntegrationFactory, g as getIntegrationFactory, r as resetIntegrationFactory } from './factory-BcFFy4JA.js';
1
+ import { c as IntegrationLogger, b as IntegrationErrorCode, I as IntegrationConfig, B as BaseIntegration, d as IntegrationParams, e as IntegrationResult } from './BaseIntegration-B9lSTRQm.js';
2
+ export { a as IntegrationError, V as ValidationError, f as ValidationResult, v as validateParams } from './BaseIntegration-B9lSTRQm.js';
3
+ export { C as CLIActions, D as DeepAgentActions, a as DockerActions, E as EmailActions, G as GitHubActions, I as IntegrationActionName, b as IntegrationContracts, c as IntegrationName, L as LLMIntegrationActions, O as OAuthActions, d as OtelActions, Q as QueueActions, R as RedisActions, S as StorageActions, e as StripeActions, T as TwilioActions, Y as YouTubeActions } from './contracts-DMzkrcLB.js';
4
+ import { LogMeta } from '@almadar/core';
5
+ export { I as IntegrationFactory, g as getIntegrationFactory, r as resetIntegrationFactory } from './factory-TNgVDujm.js';
5
6
  export { GitHubIntegration } from './integrations/github/index.js';
6
7
 
7
- /**
8
- * ServiceContract type definitions for all @almadar/integrations.
9
- *
10
- * Each integration defines its own action map as a Record<string, ServiceAction>,
11
- * suitable for use with ServiceContract<T> from @almadar/core.
12
- *
13
- * Types are simplified representations of the actual params/results. They capture
14
- * the contract shape without pulling in third-party SDK types (Stripe, Twilio, etc.).
15
- *
16
- * @packageDocumentation
17
- */
18
-
19
- type GitHubActions = {
20
- cloneRepo: {
21
- params: {
22
- repoUrl: string;
23
- targetDir: string;
24
- branch?: string;
25
- };
26
- result: {
27
- message: string;
28
- };
29
- };
30
- createBranch: {
31
- params: {
32
- branchName: string;
33
- baseBranch?: string;
34
- };
35
- result: {
36
- message: string;
37
- };
38
- };
39
- commit: {
40
- params: {
41
- message: string;
42
- files?: string[];
43
- };
44
- result: {
45
- message: string;
46
- };
47
- };
48
- push: {
49
- params: {
50
- branchName: string;
51
- force?: boolean;
52
- };
53
- result: {
54
- message: string;
55
- };
56
- };
57
- createPR: {
58
- params: {
59
- title: string;
60
- body: string;
61
- head: string;
62
- base: string;
63
- };
64
- result: {
65
- number: number;
66
- url: string;
67
- title: string;
68
- };
69
- };
70
- getPRComments: {
71
- params: {
72
- prNumber: number;
73
- };
74
- result: {
75
- comments: Array<{
76
- id: number;
77
- body: string;
78
- user: string;
79
- }>;
80
- };
81
- };
82
- listIssues: {
83
- params: {
84
- state?: string;
85
- labels?: string[];
86
- per_page?: number;
87
- };
88
- result: {
89
- issues: Array<{
90
- number: number;
91
- title: string;
92
- state: string;
93
- }>;
94
- };
95
- };
96
- getIssue: {
97
- params: {
98
- issueNumber: number;
99
- };
100
- result: {
101
- number: number;
102
- title: string;
103
- body: string;
104
- state: string;
105
- };
106
- };
107
- getFile: {
108
- params: {
109
- owner: string;
110
- repo: string;
111
- path: string;
112
- ref?: string;
113
- };
114
- result: {
115
- path: string;
116
- content: string;
117
- sha: string;
118
- size: number;
119
- };
120
- };
121
- listCommits: {
122
- params: {
123
- owner: string;
124
- repo: string;
125
- path?: string;
126
- ref?: string;
127
- per_page?: number;
128
- };
129
- result: {
130
- commits: Array<{
131
- sha: string;
132
- message: string;
133
- author: string;
134
- date: string;
135
- }>;
136
- };
137
- };
138
- createIssue: {
139
- params: {
140
- owner: string;
141
- repo: string;
142
- title: string;
143
- body?: string;
144
- labels?: string[];
145
- };
146
- result: {
147
- number: number;
148
- title: string;
149
- url: string;
150
- };
151
- };
152
- };
153
- type StripeActions = {
154
- createPaymentIntent: {
155
- params: {
156
- amount: number;
157
- currency: string;
158
- metadata?: Record<string, string>;
159
- };
160
- result: {
161
- id: string;
162
- clientSecret: string;
163
- status: string;
164
- amount: number;
165
- currency: string;
166
- };
167
- };
168
- confirmPayment: {
169
- params: {
170
- paymentIntentId: string;
171
- };
172
- result: {
173
- id: string;
174
- status: string;
175
- };
176
- };
177
- refund: {
178
- params: {
179
- paymentIntentId: string;
180
- amount?: number;
181
- };
182
- result: {
183
- id: string;
184
- status: string;
185
- amount: number;
186
- };
187
- };
188
- };
189
- type LLMIntegrationActions = {
190
- generate: {
191
- params: {
192
- userPrompt: string;
193
- systemPrompt?: string;
194
- model?: string;
195
- temperature?: number;
196
- maxTokens?: number;
197
- };
198
- result: {
199
- content: string;
200
- usage: {
201
- promptTokens?: number;
202
- completionTokens?: number;
203
- totalTokens?: number;
204
- tokens?: number;
205
- };
206
- };
207
- };
208
- classify: {
209
- params: {
210
- text: string;
211
- categories: string[];
212
- model?: string;
213
- };
214
- result: {
215
- category: string;
216
- confidence: number;
217
- reasoning: string;
218
- };
219
- };
220
- extract: {
221
- params: {
222
- text: string;
223
- schema: IntegrationParams;
224
- model?: string;
225
- };
226
- result: IntegrationParams;
227
- };
228
- summarize: {
229
- params: {
230
- text: string;
231
- maxLength?: number;
232
- style?: string;
233
- model?: string;
234
- };
235
- result: {
236
- summary: string;
237
- keyPoints: string[];
238
- };
239
- };
240
- };
241
- type YouTubeActions = {
242
- search: {
243
- params: {
244
- query: string;
245
- maxResults?: number;
246
- type?: string;
247
- };
248
- result: Array<{
249
- videoId: string;
250
- title: string;
251
- thumbnail: string;
252
- description: string;
253
- }>;
254
- };
255
- getVideo: {
256
- params: {
257
- videoId: string;
258
- };
259
- result: {
260
- title: string;
261
- description: string;
262
- viewCount: string;
263
- likeCount: string;
264
- };
265
- };
266
- getChannel: {
267
- params: {
268
- channelId: string;
269
- };
270
- result: {
271
- name: string;
272
- description: string;
273
- subscriberCount: string;
274
- };
275
- };
276
- };
277
- type TwilioActions = {
278
- sendSMS: {
279
- params: {
280
- to: string;
281
- body: string;
282
- };
283
- result: {
284
- sid: string;
285
- status: string;
286
- };
287
- };
288
- sendWhatsApp: {
289
- params: {
290
- to: string;
291
- body: string;
292
- };
293
- result: {
294
- sid: string;
295
- status: string;
296
- };
297
- };
298
- };
299
- type EmailActions = {
300
- send: {
301
- params: {
302
- to: string;
303
- subject: string;
304
- body: string;
305
- from?: string;
306
- };
307
- result: {
308
- id: string;
309
- status: string;
310
- };
311
- };
312
- };
313
- type DockerActions = {
314
- build: {
315
- params: {
316
- tag: string;
317
- dockerfile?: string;
318
- context?: string;
319
- buildArgs?: Record<string, string>;
320
- };
321
- result: {
322
- imageId: string;
323
- tag: string;
324
- size: number;
325
- buildTime: number;
326
- };
327
- };
328
- run: {
329
- params: {
330
- image: string;
331
- name?: string;
332
- ports?: Array<{
333
- host: number;
334
- container: number;
335
- protocol?: string;
336
- }>;
337
- env?: Record<string, string>;
338
- volumes?: Array<{
339
- host: string;
340
- container: string;
341
- }>;
342
- command?: string;
343
- };
344
- result: {
345
- containerId: string;
346
- name: string;
347
- status: string;
348
- ports: Array<{
349
- host: number;
350
- container: number;
351
- protocol: string;
352
- }>;
353
- };
354
- };
355
- stop: {
356
- params: {
357
- containerId: string;
358
- };
359
- result: {
360
- containerId: string;
361
- status: string;
362
- stoppedAt: number;
363
- };
364
- };
365
- remove: {
366
- params: {
367
- containerId: string;
368
- force?: boolean;
369
- };
370
- result: {
371
- containerId: string;
372
- removed: boolean;
373
- };
374
- };
375
- logs: {
376
- params: {
377
- containerId: string;
378
- tail?: number;
379
- since?: string;
380
- };
381
- result: {
382
- containerId: string;
383
- logs: string[];
384
- lineCount: number;
385
- };
386
- };
387
- status: {
388
- params: {
389
- containerId: string;
390
- };
391
- result: {
392
- containerId: string;
393
- name: string;
394
- image: string;
395
- status: string;
396
- ports: Array<{
397
- host: number;
398
- container: number;
399
- protocol: string;
400
- }>;
401
- createdAt: number;
402
- startedAt: number | null;
403
- stoppedAt: number | null;
404
- };
405
- };
406
- list: {
407
- params: {
408
- all?: boolean;
409
- filterByLabel?: string;
410
- };
411
- result: {
412
- containers: Array<{
413
- id: string;
414
- name: string;
415
- image: string;
416
- status: string;
417
- ports: Array<{
418
- host: number;
419
- container: number;
420
- protocol: string;
421
- }>;
422
- createdAt: number;
423
- }>;
424
- total: number;
425
- };
426
- };
427
- };
428
- type StorageActions = {
429
- upload: {
430
- params: {
431
- bucket: string;
432
- key: string;
433
- content: string;
434
- contentType?: string;
435
- metadata?: IntegrationParams;
436
- };
437
- result: {
438
- key: string;
439
- bucket: string;
440
- size: number;
441
- etag: string;
442
- };
443
- };
444
- download: {
445
- params: {
446
- bucket: string;
447
- key: string;
448
- };
449
- result: {
450
- content: string;
451
- contentType: string;
452
- size: number;
453
- metadata: IntegrationParams;
454
- };
455
- };
456
- list: {
457
- params: {
458
- bucket: string;
459
- prefix?: string;
460
- maxKeys?: number;
461
- };
462
- result: {
463
- keys: Array<{
464
- key: string;
465
- size: number;
466
- lastModified: number;
467
- }>;
468
- truncated: boolean;
469
- };
470
- };
471
- delete: {
472
- params: {
473
- bucket: string;
474
- key: string;
475
- };
476
- result: {
477
- deleted: boolean;
478
- };
479
- };
480
- getSignedUrl: {
481
- params: {
482
- bucket: string;
483
- key: string;
484
- expiresIn?: number;
485
- operation?: 'get' | 'put';
486
- };
487
- result: {
488
- url: string;
489
- expiresAt: number;
490
- };
491
- };
492
- };
493
- type QueueActions = {
494
- enqueue: {
495
- params: {
496
- queue: string;
497
- payload: ServiceParams;
498
- delay?: number;
499
- priority?: number;
500
- };
501
- result: {
502
- jobId: string;
503
- position: number;
504
- };
505
- };
506
- dequeue: {
507
- params: {
508
- queue: string;
509
- };
510
- result: {
511
- job: {
512
- id: string;
513
- payload: ServiceParams;
514
- enqueuedAt: number;
515
- priority: number;
516
- } | null;
517
- };
518
- };
519
- status: {
520
- params: {
521
- jobId: string;
522
- };
523
- result: {
524
- status: 'pending' | 'processing' | 'completed' | 'failed';
525
- job: {
526
- id: string;
527
- payload: ServiceParams;
528
- enqueuedAt: number;
529
- priority: number;
530
- } | null;
531
- };
532
- };
533
- complete: {
534
- params: {
535
- jobId: string;
536
- result?: ServiceParams;
537
- };
538
- result: {
539
- completed: boolean;
540
- };
541
- };
542
- fail: {
543
- params: {
544
- jobId: string;
545
- error?: string;
546
- };
547
- result: {
548
- failed: boolean;
549
- };
550
- };
551
- cancel: {
552
- params: {
553
- jobId: string;
554
- };
555
- result: {
556
- cancelled: boolean;
557
- };
558
- };
559
- size: {
560
- params: {
561
- queue: string;
562
- };
563
- result: {
564
- size: number;
565
- pending: number;
566
- processing: number;
567
- };
568
- };
569
- };
570
- type RedisActions = {
571
- get: {
572
- params: {
573
- key: string;
574
- };
575
- result: {
576
- value: ServiceParams;
577
- };
578
- };
579
- set: {
580
- params: {
581
- key: string;
582
- value: ServiceParams;
583
- ttl?: number;
584
- };
585
- result: {
586
- ok: boolean;
587
- };
588
- };
589
- delete: {
590
- params: {
591
- key: string;
592
- };
593
- result: {
594
- deleted: boolean;
595
- };
596
- };
597
- lock: {
598
- params: {
599
- key: string;
600
- ttl?: number;
601
- };
602
- result: {
603
- acquired: boolean;
604
- lockId: string;
605
- };
606
- };
607
- unlock: {
608
- params: {
609
- key: string;
610
- lockId: string;
611
- };
612
- result: {
613
- released: boolean;
614
- };
615
- };
616
- increment: {
617
- params: {
618
- key: string;
619
- by?: number;
620
- };
621
- result: {
622
- value: number;
623
- };
624
- };
625
- expire: {
626
- params: {
627
- key: string;
628
- ttl: number;
629
- };
630
- result: {
631
- set: boolean;
632
- };
633
- };
634
- publish: {
635
- params: {
636
- channel: string;
637
- message: ServiceParams;
638
- };
639
- result: {
640
- receivers: number;
641
- };
642
- };
643
- subscribe: {
644
- params: {
645
- channel: string;
646
- };
647
- result: {
648
- subscribed: boolean;
649
- };
650
- };
651
- };
652
- type OAuthActions = {
653
- authorize: {
654
- params: {
655
- provider: 'google' | 'github' | 'auth0';
656
- scopes: string[];
657
- redirectUri: string;
658
- };
659
- result: {
660
- authUrl: string;
661
- state: string;
662
- };
663
- };
664
- token: {
665
- params: {
666
- code: string;
667
- state: string;
668
- };
669
- result: {
670
- accessToken: string;
671
- refreshToken: string;
672
- expiresIn: number;
673
- tokenType: 'bearer';
674
- };
675
- };
676
- refresh: {
677
- params: {
678
- refreshToken: string;
679
- };
680
- result: {
681
- accessToken: string;
682
- expiresIn: number;
683
- };
684
- };
685
- revoke: {
686
- params: {
687
- token: string;
688
- };
689
- result: {
690
- revoked: boolean;
691
- };
692
- };
693
- userinfo: {
694
- params: {
695
- accessToken: string;
696
- };
697
- result: {
698
- sub: string;
699
- email: string;
700
- name: string;
701
- picture: string;
702
- };
703
- };
704
- };
705
- type OtelActions = {
706
- startSpan: {
707
- params: {
708
- name: string;
709
- attributes?: IntegrationParams;
710
- traceId?: string;
711
- };
712
- result: {
713
- spanId: string;
714
- traceId: string;
715
- };
716
- };
717
- endSpan: {
718
- params: {
719
- spanId: string;
720
- status?: 'ok' | 'error';
721
- };
722
- result: {
723
- ended: boolean;
724
- };
725
- };
726
- addEvent: {
727
- params: {
728
- spanId: string;
729
- name: string;
730
- attributes?: IntegrationParams;
731
- };
732
- result: {
733
- added: boolean;
734
- };
735
- };
736
- recordMetric: {
737
- params: {
738
- name: string;
739
- value: number;
740
- type?: 'counter' | 'gauge' | 'histogram';
741
- labels?: IntegrationParams;
742
- };
743
- result: {
744
- recorded: boolean;
745
- };
746
- };
747
- getSpan: {
748
- params: {
749
- spanId: string;
750
- };
751
- result: {
752
- spanId: string;
753
- traceId: string;
754
- name: string;
755
- startTime: number;
756
- endTime?: number;
757
- status?: 'ok' | 'error';
758
- attributes: IntegrationParams;
759
- } | null;
760
- };
761
- getMetrics: {
762
- params: Record<string, never>;
763
- result: Record<string, {
764
- name: string;
765
- type: string;
766
- value: number;
767
- values: number[];
768
- labels: IntegrationParams;
769
- }>;
770
- };
771
- };
772
- type CLIActions = {
773
- validate: {
774
- params: {
775
- schema: string;
776
- };
777
- result: {
778
- valid: boolean;
779
- errors: string[];
780
- warnings: string[];
781
- summary: string;
782
- };
783
- };
784
- };
785
- type DeepAgentActions = {
786
- sendMessage: {
787
- params: {
788
- message: string;
789
- threadId?: string;
790
- skill?: string;
791
- context?: IntegrationParams;
792
- };
793
- result: {
794
- response: string;
795
- threadId: string;
796
- };
797
- };
798
- cancelGeneration: {
799
- params: {
800
- threadId: string;
801
- };
802
- result: {
803
- cancelled: boolean;
804
- };
805
- };
806
- validateSchema: {
807
- params: {
808
- schema: string;
809
- };
810
- result: {
811
- valid: boolean;
812
- errors: string[];
813
- };
814
- };
815
- compileSchema: {
816
- params: {
817
- schema: string;
818
- shell?: string;
819
- };
820
- result: {
821
- output: string;
822
- files: string[];
823
- };
824
- };
825
- getThreadHistory: {
826
- params: {
827
- threadId: string;
828
- };
829
- result: {
830
- messages: Array<{
831
- role: string;
832
- content: string;
833
- timestamp: number;
834
- }>;
835
- };
836
- };
837
- };
838
- /**
839
- * Maps each integration name (as used in `registerIntegration`) to its action
840
- * map type. Use with `ServiceContract<IntegrationContracts[K]>` to get a fully
841
- * typed service interface for a specific integration.
842
- *
843
- * @example
844
- * ```typescript
845
- * import type { ServiceContract } from '@almadar/core';
846
- * import type { IntegrationContracts } from '@almadar/integrations';
847
- *
848
- * type TypedStripe = ServiceContract<IntegrationContracts['stripe']>;
849
- * ```
850
- */
851
- type IntegrationContracts = {
852
- github: GitHubActions;
853
- stripe: StripeActions;
854
- llm: LLMIntegrationActions;
855
- youtube: YouTubeActions;
856
- twilio: TwilioActions;
857
- email: EmailActions;
858
- docker: DockerActions;
859
- storage: StorageActions;
860
- queue: QueueActions;
861
- redis: RedisActions;
862
- oauth: OAuthActions;
863
- otel: OtelActions;
864
- cli: CLIActions;
865
- deepagent: DeepAgentActions;
866
- };
867
- /** Integration name literal union. */
868
- type IntegrationName = keyof IntegrationContracts;
869
- /**
870
- * Helper: extract the action names for a given integration.
871
- *
872
- * @example
873
- * ```typescript
874
- * type StripeAction = IntegrationActionName<'stripe'>;
875
- * // => 'createPaymentIntent' | 'confirmPayment' | 'refund'
876
- * ```
877
- */
878
- type IntegrationActionName<K extends IntegrationName> = keyof IntegrationContracts[K] & string;
879
-
880
8
  /**
881
9
  * Console-based logger implementation.
882
10
  *
@@ -1423,4 +551,4 @@ declare class DockerIntegration extends BaseIntegration {
1423
551
  private list;
1424
552
  }
1425
553
 
1426
- export { type AlmadarCheckoutSession, type AlmadarCustomer, type AlmadarInvoiceFailure, type AlmadarInvoicePayment, type AlmadarPortalSession, type AlmadarStripeEvent, type AlmadarStripeEventOk, type AlmadarSubscription, type AlmadarSubscriptionStatus, type AlmadarTier, BaseIntegration, type CLIActions, CLIIntegration, type CancelSubscriptionInput, ConsoleLogger, type CreateCheckoutInput, type CreateCustomerInput, type CreatePortalInput, type DeepAgentActions, DeepAgentIntegration, type DockerActions, DockerIntegration, type EmailActions, EmailIntegration, type GitHubActions, type IntegrationActionName, IntegrationConfig, type IntegrationConstructor, type IntegrationContracts, IntegrationErrorCode, IntegrationLogger, type IntegrationName, IntegrationResult, LLMIntegration, type LLMIntegrationActions, type OAuthActions, OAuthIntegration, type OtelActions, OtelIntegration, type QueueActions, QueueIntegration, type RedisActions, RedisIntegration, type RetryConfig, type StorageActions, StorageIntegration, type StripeActions, StripeIntegration, type StripePriceMap, type TwilioActions, TwilioIntegration, type UpdateSubscriptionInput, type VerifyAndParseInput, type YouTubeActions, YouTubeIntegration, getIntegration, getRegisteredIntegrations, isKnownIntegration, registerIntegration, verifyAndParseStripeEvent, withRetry };
554
+ export { type AlmadarCheckoutSession, type AlmadarCustomer, type AlmadarInvoiceFailure, type AlmadarInvoicePayment, type AlmadarPortalSession, type AlmadarStripeEvent, type AlmadarStripeEventOk, type AlmadarSubscription, type AlmadarSubscriptionStatus, type AlmadarTier, BaseIntegration, CLIIntegration, type CancelSubscriptionInput, ConsoleLogger, type CreateCheckoutInput, type CreateCustomerInput, type CreatePortalInput, DeepAgentIntegration, DockerIntegration, EmailIntegration, IntegrationConfig, type IntegrationConstructor, IntegrationErrorCode, IntegrationLogger, IntegrationResult, LLMIntegration, OAuthIntegration, OtelIntegration, QueueIntegration, RedisIntegration, type RetryConfig, StorageIntegration, StripeIntegration, type StripePriceMap, TwilioIntegration, type UpdateSubscriptionInput, type VerifyAndParseInput, YouTubeIntegration, getIntegration, getRegisteredIntegrations, isKnownIntegration, registerIntegration, verifyAndParseStripeEvent, withRetry };