@almadar/integrations 2.5.0 → 2.5.1
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/{BaseIntegration-B9X5vK3f.d.ts → BaseIntegration-DjXCkytU.d.ts} +4 -5
- package/dist/{factory-CSJzotsJ.d.ts → factory-BoDqQ89e.d.ts} +5 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +23 -17
- package/dist/index.js.map +1 -1
- package/dist/integrations/github/index.d.ts +11 -9
- package/dist/integrations/github/index.js +1 -1
- package/dist/integrations/github/index.js.map +1 -1
- package/dist/mocks/index.d.ts +3 -2
- package/dist/mocks/index.js +6 -0
- package/dist/mocks/index.js.map +1 -1
- package/dist/runtime/index.d.ts +3 -2
- package/dist/runtime/index.js +7 -2
- package/dist/runtime/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { LogMeta } from '@almadar/core';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Core types for Almadar integrations
|
|
3
5
|
*/
|
|
@@ -66,10 +68,7 @@ declare class IntegrationError extends Error {
|
|
|
66
68
|
details: unknown;
|
|
67
69
|
};
|
|
68
70
|
}
|
|
69
|
-
|
|
70
|
-
interface LogMeta {
|
|
71
|
-
[key: string]: string | number | boolean | null | undefined | Error | string[] | LogMeta;
|
|
72
|
-
}
|
|
71
|
+
|
|
73
72
|
/**
|
|
74
73
|
* Logger interface
|
|
75
74
|
*/
|
|
@@ -136,4 +135,4 @@ declare abstract class BaseIntegration {
|
|
|
136
135
|
protected executeWithRetry<T>(fn: () => Promise<T>): Promise<T>;
|
|
137
136
|
}
|
|
138
137
|
|
|
139
|
-
export { BaseIntegration as B, type IntegrationParams as I, type
|
|
138
|
+
export { BaseIntegration as B, type IntegrationParams as I, type ValidationError as V, type IntegrationLogger as a, type IntegrationErrorCode as b, type IntegrationConfig as c, type IntegrationResult as d, IntegrationError as e, type ValidationResult as f, validateParams as v };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as IntegrationConfig, B as BaseIntegration, I as IntegrationParams, d as IntegrationResult } from './BaseIntegration-
|
|
1
|
+
import { c as IntegrationConfig, B as BaseIntegration, I as IntegrationParams, d as IntegrationResult } from './BaseIntegration-DjXCkytU.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Factory for creating and managing integration instances
|
|
@@ -22,6 +22,10 @@ declare class IntegrationFactory {
|
|
|
22
22
|
* Check if integration is configured
|
|
23
23
|
*/
|
|
24
24
|
isConfigured(name: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Register an integration instance directly (used by mock infrastructure)
|
|
27
|
+
*/
|
|
28
|
+
registerInstance(name: string, instance: BaseIntegration): void;
|
|
25
29
|
/**
|
|
26
30
|
* Clear all instances (useful for testing)
|
|
27
31
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { I as IntegrationParams, a as IntegrationLogger,
|
|
2
|
-
export { e as IntegrationError, V as ValidationError, f as ValidationResult, v as validateParams } from './BaseIntegration-
|
|
3
|
-
|
|
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
|
+
export { e as IntegrationError, V as ValidationError, f as ValidationResult, v as validateParams } from './BaseIntegration-DjXCkytU.js';
|
|
3
|
+
import { LogMeta } from '@almadar/core';
|
|
4
|
+
export { I as IntegrationFactory, g as getIntegrationFactory, r as resetIntegrationFactory } from './factory-BoDqQ89e.js';
|
|
4
5
|
export { GitHubIntegration } from './integrations/github/index.js';
|
|
5
6
|
|
|
6
7
|
/**
|
package/dist/index.js
CHANGED
|
@@ -258,6 +258,12 @@ var IntegrationFactory = class {
|
|
|
258
258
|
isConfigured(name) {
|
|
259
259
|
return this.configs.has(name);
|
|
260
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Register an integration instance directly (used by mock infrastructure)
|
|
263
|
+
*/
|
|
264
|
+
registerInstance(name, instance) {
|
|
265
|
+
this.instances.set(name, instance);
|
|
266
|
+
}
|
|
261
267
|
/**
|
|
262
268
|
* Clear all instances (useful for testing)
|
|
263
269
|
*/
|
|
@@ -339,7 +345,7 @@ var StripeIntegration = class extends BaseIntegration {
|
|
|
339
345
|
}
|
|
340
346
|
async createPaymentIntent(params) {
|
|
341
347
|
const { amount, currency, metadata } = params;
|
|
342
|
-
this.logger.debug("Creating payment intent", { amount, currency });
|
|
348
|
+
this.logger.debug("Creating payment intent", { amount: Number(amount), currency: String(currency ?? "") });
|
|
343
349
|
return await this.client.paymentIntents.create({
|
|
344
350
|
amount,
|
|
345
351
|
currency,
|
|
@@ -348,12 +354,12 @@ var StripeIntegration = class extends BaseIntegration {
|
|
|
348
354
|
}
|
|
349
355
|
async confirmPayment(params) {
|
|
350
356
|
const { paymentIntentId } = params;
|
|
351
|
-
this.logger.debug("Confirming payment", { paymentIntentId });
|
|
357
|
+
this.logger.debug("Confirming payment", { paymentIntentId: String(paymentIntentId ?? "") });
|
|
352
358
|
return await this.client.paymentIntents.confirm(paymentIntentId);
|
|
353
359
|
}
|
|
354
360
|
async refund(params) {
|
|
355
361
|
const { paymentIntentId, amount } = params;
|
|
356
|
-
this.logger.debug("Creating refund", { paymentIntentId, amount });
|
|
362
|
+
this.logger.debug("Creating refund", { paymentIntentId: String(paymentIntentId ?? ""), amount: Number(amount) });
|
|
357
363
|
return await this.client.refunds.create({
|
|
358
364
|
payment_intent: paymentIntentId,
|
|
359
365
|
amount
|
|
@@ -416,7 +422,7 @@ var YouTubeIntegration = class extends BaseIntegration {
|
|
|
416
422
|
}
|
|
417
423
|
async search(params) {
|
|
418
424
|
const { query, maxResults, type } = params;
|
|
419
|
-
this.logger.debug("Searching YouTube", { query, maxResults, type });
|
|
425
|
+
this.logger.debug("Searching YouTube", { query: String(query ?? ""), maxResults: Number(maxResults ?? 10), type: String(type ?? "") });
|
|
420
426
|
const response = await this.client.search.list({
|
|
421
427
|
part: ["snippet"],
|
|
422
428
|
q: query,
|
|
@@ -432,7 +438,7 @@ var YouTubeIntegration = class extends BaseIntegration {
|
|
|
432
438
|
}
|
|
433
439
|
async getVideo(params) {
|
|
434
440
|
const { videoId } = params;
|
|
435
|
-
this.logger.debug("Getting video details", { videoId });
|
|
441
|
+
this.logger.debug("Getting video details", { videoId: String(videoId ?? "") });
|
|
436
442
|
const response = await this.client.videos.list({
|
|
437
443
|
part: ["snippet", "statistics"],
|
|
438
444
|
id: [videoId]
|
|
@@ -450,7 +456,7 @@ var YouTubeIntegration = class extends BaseIntegration {
|
|
|
450
456
|
}
|
|
451
457
|
async getChannel(params) {
|
|
452
458
|
const { channelId } = params;
|
|
453
|
-
this.logger.debug("Getting channel details", { channelId });
|
|
459
|
+
this.logger.debug("Getting channel details", { channelId: String(channelId ?? "") });
|
|
454
460
|
const response = await this.client.channels.list({
|
|
455
461
|
part: ["snippet", "statistics"],
|
|
456
462
|
id: [channelId]
|
|
@@ -518,7 +524,7 @@ var TwilioIntegration = class extends BaseIntegration {
|
|
|
518
524
|
}
|
|
519
525
|
async sendSMS(params) {
|
|
520
526
|
const { to, body } = params;
|
|
521
|
-
this.logger.debug("Sending SMS", { to });
|
|
527
|
+
this.logger.debug("Sending SMS", { to: String(to ?? "") });
|
|
522
528
|
const message = await this.client.messages.create({
|
|
523
529
|
from: this.phoneNumber,
|
|
524
530
|
to,
|
|
@@ -531,7 +537,7 @@ var TwilioIntegration = class extends BaseIntegration {
|
|
|
531
537
|
}
|
|
532
538
|
async sendWhatsApp(params) {
|
|
533
539
|
const { to, body } = params;
|
|
534
|
-
this.logger.debug("Sending WhatsApp message", { to });
|
|
540
|
+
this.logger.debug("Sending WhatsApp message", { to: String(to ?? "") });
|
|
535
541
|
const message = await this.client.messages.create({
|
|
536
542
|
from: `whatsapp:${this.phoneNumber}`,
|
|
537
543
|
to: `whatsapp:${to}`,
|
|
@@ -740,7 +746,7 @@ var LLMIntegration = class extends BaseIntegration {
|
|
|
740
746
|
}
|
|
741
747
|
async classify(params) {
|
|
742
748
|
const { text, categories, model } = params;
|
|
743
|
-
this.logger.debug("Classifying text", { categories });
|
|
749
|
+
this.logger.debug("Classifying text", { categories: categories.join(", ") });
|
|
744
750
|
const ClassificationSchema = z.object({
|
|
745
751
|
category: z.enum(categories),
|
|
746
752
|
confidence: z.number().min(0).max(1),
|
|
@@ -757,7 +763,7 @@ var LLMIntegration = class extends BaseIntegration {
|
|
|
757
763
|
}
|
|
758
764
|
async extract(params) {
|
|
759
765
|
const { text, schema, model } = params;
|
|
760
|
-
this.logger.debug("Extracting structured data", { schema });
|
|
766
|
+
this.logger.debug("Extracting structured data", { schema: String(schema ?? "") });
|
|
761
767
|
const ExtractSchema = z.record(z.unknown());
|
|
762
768
|
const client = model ? new LLMClient({ provider: this.provider, model, temperature: 0.2 }) : this.getClient();
|
|
763
769
|
const schemaDescription = JSON.stringify(schema, null, 2);
|
|
@@ -855,7 +861,7 @@ var DeepAgentIntegration = class extends BaseIntegration {
|
|
|
855
861
|
}
|
|
856
862
|
async sendMessage(params) {
|
|
857
863
|
const { message, threadId, skill, context } = params;
|
|
858
|
-
this.logger.debug("Sending message to DeepAgent", { threadId, skill });
|
|
864
|
+
this.logger.debug("Sending message to DeepAgent", { threadId: String(threadId ?? ""), skill: String(skill ?? "") });
|
|
859
865
|
const response = await this.request("/api/agent/message", {
|
|
860
866
|
message,
|
|
861
867
|
threadId,
|
|
@@ -866,7 +872,7 @@ var DeepAgentIntegration = class extends BaseIntegration {
|
|
|
866
872
|
}
|
|
867
873
|
async cancelGeneration(params) {
|
|
868
874
|
const { threadId } = params;
|
|
869
|
-
this.logger.debug("Cancelling generation", { threadId });
|
|
875
|
+
this.logger.debug("Cancelling generation", { threadId: String(threadId ?? "") });
|
|
870
876
|
const response = await this.request("/api/agent/cancel", {
|
|
871
877
|
threadId
|
|
872
878
|
});
|
|
@@ -882,7 +888,7 @@ var DeepAgentIntegration = class extends BaseIntegration {
|
|
|
882
888
|
}
|
|
883
889
|
async compileSchema(params) {
|
|
884
890
|
const { schema, shell } = params;
|
|
885
|
-
this.logger.debug("Compiling schema", { shell });
|
|
891
|
+
this.logger.debug("Compiling schema", { shell: String(shell ?? "") });
|
|
886
892
|
const response = await this.request("/api/schema/compile", {
|
|
887
893
|
schema,
|
|
888
894
|
shell
|
|
@@ -891,7 +897,7 @@ var DeepAgentIntegration = class extends BaseIntegration {
|
|
|
891
897
|
}
|
|
892
898
|
async getThreadHistory(params) {
|
|
893
899
|
const { threadId } = params;
|
|
894
|
-
this.logger.debug("Getting thread history", { threadId });
|
|
900
|
+
this.logger.debug("Getting thread history", { threadId: String(threadId ?? "") });
|
|
895
901
|
const response = await this.request("/api/agent/history", {
|
|
896
902
|
threadId
|
|
897
903
|
});
|
|
@@ -1363,7 +1369,7 @@ var GitHubIntegration = class extends BaseIntegration {
|
|
|
1363
1369
|
* List issues
|
|
1364
1370
|
*/
|
|
1365
1371
|
async listIssues(params) {
|
|
1366
|
-
this.logger.debug("Listing issues", params);
|
|
1372
|
+
this.logger.debug("Listing issues", { state: params.state, labels: params.labels?.join(", "), limit: params.limit });
|
|
1367
1373
|
const apiConfig = this.getAPIConfig();
|
|
1368
1374
|
const issues = await listIssues(params, apiConfig);
|
|
1369
1375
|
return { issues };
|
|
@@ -2150,7 +2156,7 @@ var OAuthIntegration = class extends BaseIntegration {
|
|
|
2150
2156
|
const provider = params.provider;
|
|
2151
2157
|
const scopes = params.scopes;
|
|
2152
2158
|
const redirectUri = params.redirectUri;
|
|
2153
|
-
this.logger.debug("OAuth AUTHORIZE", { provider, scopes, redirectUri });
|
|
2159
|
+
this.logger.debug("OAuth AUTHORIZE", { provider, scopes: scopes.join(", "), redirectUri });
|
|
2154
2160
|
const state = this.generateToken(16);
|
|
2155
2161
|
this.states.set(state, provider);
|
|
2156
2162
|
const baseUrl = PROVIDER_AUTH_URLS[provider];
|
|
@@ -2547,7 +2553,7 @@ var DockerIntegration = class extends BaseIntegration {
|
|
|
2547
2553
|
const env = params.env ?? {};
|
|
2548
2554
|
const rawVolumes = params.volumes ?? [];
|
|
2549
2555
|
const command = params.command ?? "";
|
|
2550
|
-
this.logger.debug("Docker RUN", { image, name, ports: rawPorts.map((p) => `${p.host}:${p.container}`), volumes: rawVolumes.map((v) => `${v.host}:${v.container}`), command });
|
|
2556
|
+
this.logger.debug("Docker RUN", { image, name, ports: rawPorts.map((p) => `${p.host}:${p.container}`).join(", "), volumes: rawVolumes.map((v) => `${v.host}:${v.container}`).join(", "), command });
|
|
2551
2557
|
const containerId = this.generateId();
|
|
2552
2558
|
const ports = rawPorts.map((p) => ({
|
|
2553
2559
|
host: p.host,
|