@almadar/integrations 2.12.0 → 2.14.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,885 +1,10 @@
1
- import { d as IntegrationParams, c as IntegrationLogger, b as IntegrationErrorCode, I as IntegrationConfig, B as BaseIntegration, e as IntegrationResult } from './BaseIntegration-B9lSTRQm.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
2
  export { a as IntegrationError, V as ValidationError, f as ValidationResult, v as validateParams } from './BaseIntegration-B9lSTRQm.js';
3
- import { ServiceParams, LogMeta } from '@almadar/core';
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';
4
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
- file?: IntegrationParams;
436
- acl?: 'public' | 'private';
437
- maxSize?: number;
438
- metadata?: IntegrationParams;
439
- };
440
- result: {
441
- key: string;
442
- bucket: string;
443
- size: number;
444
- etag: string;
445
- };
446
- };
447
- download: {
448
- params: {
449
- bucket: string;
450
- key: string;
451
- };
452
- result: {
453
- content: string;
454
- contentType: string;
455
- size: number;
456
- metadata: IntegrationParams;
457
- };
458
- };
459
- list: {
460
- params: {
461
- bucket: string;
462
- prefix?: string;
463
- maxKeys?: number;
464
- };
465
- result: {
466
- keys: Array<{
467
- key: string;
468
- size: number;
469
- lastModified: number;
470
- }>;
471
- truncated: boolean;
472
- };
473
- };
474
- delete: {
475
- params: {
476
- bucket: string;
477
- key: string;
478
- };
479
- result: {
480
- deleted: boolean;
481
- };
482
- };
483
- getSignedUrl: {
484
- params: {
485
- bucket: string;
486
- key: string;
487
- expiresIn?: number;
488
- operation?: 'get' | 'put';
489
- };
490
- result: {
491
- url: string;
492
- expiresAt: number;
493
- };
494
- };
495
- };
496
- type QueueActions = {
497
- enqueue: {
498
- params: {
499
- queue: string;
500
- payload: ServiceParams;
501
- delay?: number;
502
- priority?: number;
503
- };
504
- result: {
505
- jobId: string;
506
- position: number;
507
- };
508
- };
509
- dequeue: {
510
- params: {
511
- queue: string;
512
- };
513
- result: {
514
- job: {
515
- id: string;
516
- payload: ServiceParams;
517
- enqueuedAt: number;
518
- priority: number;
519
- } | null;
520
- };
521
- };
522
- status: {
523
- params: {
524
- jobId: string;
525
- };
526
- result: {
527
- status: 'pending' | 'processing' | 'completed' | 'failed';
528
- job: {
529
- id: string;
530
- payload: ServiceParams;
531
- enqueuedAt: number;
532
- priority: number;
533
- } | null;
534
- };
535
- };
536
- complete: {
537
- params: {
538
- jobId: string;
539
- result?: ServiceParams;
540
- };
541
- result: {
542
- completed: boolean;
543
- };
544
- };
545
- fail: {
546
- params: {
547
- jobId: string;
548
- error?: string;
549
- };
550
- result: {
551
- failed: boolean;
552
- };
553
- };
554
- cancel: {
555
- params: {
556
- jobId: string;
557
- };
558
- result: {
559
- cancelled: boolean;
560
- };
561
- };
562
- size: {
563
- params: {
564
- queue: string;
565
- };
566
- result: {
567
- size: number;
568
- pending: number;
569
- processing: number;
570
- };
571
- };
572
- };
573
- type RedisActions = {
574
- get: {
575
- params: {
576
- key: string;
577
- };
578
- result: {
579
- value: ServiceParams;
580
- };
581
- };
582
- set: {
583
- params: {
584
- key: string;
585
- value: ServiceParams;
586
- ttl?: number;
587
- };
588
- result: {
589
- ok: boolean;
590
- };
591
- };
592
- delete: {
593
- params: {
594
- key: string;
595
- };
596
- result: {
597
- deleted: boolean;
598
- };
599
- };
600
- lock: {
601
- params: {
602
- key: string;
603
- ttl?: number;
604
- };
605
- result: {
606
- acquired: boolean;
607
- lockId: string;
608
- };
609
- };
610
- unlock: {
611
- params: {
612
- key: string;
613
- lockId: string;
614
- };
615
- result: {
616
- released: boolean;
617
- };
618
- };
619
- increment: {
620
- params: {
621
- key: string;
622
- by?: number;
623
- };
624
- result: {
625
- value: number;
626
- };
627
- };
628
- expire: {
629
- params: {
630
- key: string;
631
- ttl: number;
632
- };
633
- result: {
634
- set: boolean;
635
- };
636
- };
637
- publish: {
638
- params: {
639
- channel: string;
640
- message: ServiceParams;
641
- };
642
- result: {
643
- receivers: number;
644
- };
645
- };
646
- subscribe: {
647
- params: {
648
- channel: string;
649
- };
650
- result: {
651
- subscribed: boolean;
652
- };
653
- };
654
- };
655
- type OAuthActions = {
656
- authorize: {
657
- params: {
658
- provider: 'google' | 'github' | 'auth0';
659
- scopes: string[];
660
- redirectUri: string;
661
- };
662
- result: {
663
- authUrl: string;
664
- state: string;
665
- };
666
- };
667
- token: {
668
- params: {
669
- code: string;
670
- state: string;
671
- };
672
- result: {
673
- accessToken: string;
674
- refreshToken: string;
675
- expiresIn: number;
676
- tokenType: 'bearer';
677
- };
678
- };
679
- refresh: {
680
- params: {
681
- refreshToken: string;
682
- };
683
- result: {
684
- accessToken: string;
685
- expiresIn: number;
686
- };
687
- };
688
- revoke: {
689
- params: {
690
- token: string;
691
- };
692
- result: {
693
- revoked: boolean;
694
- };
695
- };
696
- userinfo: {
697
- params: {
698
- accessToken: string;
699
- };
700
- result: {
701
- sub: string;
702
- email: string;
703
- name: string;
704
- picture: string;
705
- };
706
- };
707
- };
708
- type OtelActions = {
709
- startSpan: {
710
- params: {
711
- name: string;
712
- attributes?: IntegrationParams;
713
- traceId?: string;
714
- };
715
- result: {
716
- spanId: string;
717
- traceId: string;
718
- };
719
- };
720
- endSpan: {
721
- params: {
722
- spanId: string;
723
- status?: 'ok' | 'error';
724
- };
725
- result: {
726
- ended: boolean;
727
- };
728
- };
729
- addEvent: {
730
- params: {
731
- spanId: string;
732
- name: string;
733
- attributes?: IntegrationParams;
734
- };
735
- result: {
736
- added: boolean;
737
- };
738
- };
739
- recordMetric: {
740
- params: {
741
- name: string;
742
- value: number;
743
- type?: 'counter' | 'gauge' | 'histogram';
744
- labels?: IntegrationParams;
745
- };
746
- result: {
747
- recorded: boolean;
748
- };
749
- };
750
- getSpan: {
751
- params: {
752
- spanId: string;
753
- };
754
- result: {
755
- spanId: string;
756
- traceId: string;
757
- name: string;
758
- startTime: number;
759
- endTime?: number;
760
- status?: 'ok' | 'error';
761
- attributes: IntegrationParams;
762
- } | null;
763
- };
764
- getMetrics: {
765
- params: Record<string, never>;
766
- result: Record<string, {
767
- name: string;
768
- type: string;
769
- value: number;
770
- values: number[];
771
- labels: IntegrationParams;
772
- }>;
773
- };
774
- };
775
- type CLIActions = {
776
- validate: {
777
- params: {
778
- schema: string;
779
- };
780
- result: {
781
- valid: boolean;
782
- errors: string[];
783
- warnings: string[];
784
- summary: string;
785
- };
786
- };
787
- };
788
- type DeepAgentActions = {
789
- sendMessage: {
790
- params: {
791
- message: string;
792
- threadId?: string;
793
- skill?: string;
794
- context?: IntegrationParams;
795
- };
796
- result: {
797
- response: string;
798
- threadId: string;
799
- };
800
- };
801
- cancelGeneration: {
802
- params: {
803
- threadId: string;
804
- };
805
- result: {
806
- cancelled: boolean;
807
- };
808
- };
809
- validateSchema: {
810
- params: {
811
- schema: string;
812
- };
813
- result: {
814
- valid: boolean;
815
- errors: string[];
816
- };
817
- };
818
- compileSchema: {
819
- params: {
820
- schema: string;
821
- shell?: string;
822
- };
823
- result: {
824
- output: string;
825
- files: string[];
826
- };
827
- };
828
- getThreadHistory: {
829
- params: {
830
- threadId: string;
831
- };
832
- result: {
833
- messages: Array<{
834
- role: string;
835
- content: string;
836
- timestamp: number;
837
- }>;
838
- };
839
- };
840
- };
841
- /**
842
- * Maps each integration name (as used in `registerIntegration`) to its action
843
- * map type. Use with `ServiceContract<IntegrationContracts[K]>` to get a fully
844
- * typed service interface for a specific integration.
845
- *
846
- * @example
847
- * ```typescript
848
- * import type { ServiceContract } from '@almadar/core';
849
- * import type { IntegrationContracts } from '@almadar/integrations';
850
- *
851
- * type TypedStripe = ServiceContract<IntegrationContracts['stripe']>;
852
- * ```
853
- */
854
- type IntegrationContracts = {
855
- github: GitHubActions;
856
- stripe: StripeActions;
857
- llm: LLMIntegrationActions;
858
- youtube: YouTubeActions;
859
- twilio: TwilioActions;
860
- email: EmailActions;
861
- docker: DockerActions;
862
- storage: StorageActions;
863
- queue: QueueActions;
864
- redis: RedisActions;
865
- oauth: OAuthActions;
866
- otel: OtelActions;
867
- cli: CLIActions;
868
- deepagent: DeepAgentActions;
869
- };
870
- /** Integration name literal union. */
871
- type IntegrationName = keyof IntegrationContracts;
872
- /**
873
- * Helper: extract the action names for a given integration.
874
- *
875
- * @example
876
- * ```typescript
877
- * type StripeAction = IntegrationActionName<'stripe'>;
878
- * // => 'createPaymentIntent' | 'confirmPayment' | 'refund'
879
- * ```
880
- */
881
- type IntegrationActionName<K extends IntegrationName> = keyof IntegrationContracts[K] & string;
882
-
883
8
  /**
884
9
  * Console-based logger implementation.
885
10
  *
@@ -1426,4 +551,4 @@ declare class DockerIntegration extends BaseIntegration {
1426
551
  private list;
1427
552
  }
1428
553
 
1429
- 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 };