@almadar/integrations 2.29.0 → 2.31.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/{BaseIntegration-C_5q54DM.d.ts → BaseIntegration-BYlbMFlf.d.ts} +7 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +124 -32
- package/dist/index.js.map +1 -1
- package/dist/integrations/github/index.d.ts +108 -4
- package/dist/integrations/github/index.js +82 -5
- package/dist/integrations/github/index.js.map +1 -1
- package/dist/mocks/index.d.ts +1 -1
- package/dist/mocks/index.js.map +1 -1
- package/dist/runtime/index.d.ts +2 -2
- package/dist/runtime/index.js +123 -31
- package/dist/runtime/index.js.map +1 -1
- package/dist/{store-eq1-GfDi.d.ts → store-BYRZDq9B.d.ts} +393 -2
- package/package.json +5 -5
package/dist/runtime/index.js
CHANGED
|
@@ -184,6 +184,14 @@ var ConsoleLogger = class {
|
|
|
184
184
|
}
|
|
185
185
|
};
|
|
186
186
|
var RESERVED_ENVELOPE_KEYS = /* @__PURE__ */ new Set(["emit", "onSuccess", "onError", "timeout"]);
|
|
187
|
+
var UnknownActionError = class extends Error {
|
|
188
|
+
constructor(integration, action) {
|
|
189
|
+
super(`Unknown ${integration} action: ${action}`);
|
|
190
|
+
this.name = "UnknownActionError";
|
|
191
|
+
this.integration = integration;
|
|
192
|
+
this.action = action;
|
|
193
|
+
}
|
|
194
|
+
};
|
|
187
195
|
function validateParams(integration, action, params) {
|
|
188
196
|
const typedRegistry = integratorsRegistry;
|
|
189
197
|
const registry = typedRegistry.integrators[integration];
|
|
@@ -572,7 +580,7 @@ var StripeIntegration = class extends BaseIntegration {
|
|
|
572
580
|
data = await this.executeWithRetry(() => this.refund(params));
|
|
573
581
|
break;
|
|
574
582
|
default:
|
|
575
|
-
throw new
|
|
583
|
+
throw new UnknownActionError(this.config.name, action);
|
|
576
584
|
}
|
|
577
585
|
return {
|
|
578
586
|
success: true,
|
|
@@ -799,7 +807,7 @@ var YouTubeIntegration = class extends BaseIntegration {
|
|
|
799
807
|
data = await this.executeWithRetry(() => this.getChannel(params));
|
|
800
808
|
break;
|
|
801
809
|
default:
|
|
802
|
-
throw new
|
|
810
|
+
throw new UnknownActionError(this.config.name, action);
|
|
803
811
|
}
|
|
804
812
|
return {
|
|
805
813
|
success: true,
|
|
@@ -901,7 +909,7 @@ var TwilioIntegration = class extends BaseIntegration {
|
|
|
901
909
|
data = await this.executeWithRetry(() => this.sendWhatsApp(params));
|
|
902
910
|
break;
|
|
903
911
|
default:
|
|
904
|
-
throw new
|
|
912
|
+
throw new UnknownActionError(this.config.name, action);
|
|
905
913
|
}
|
|
906
914
|
return {
|
|
907
915
|
success: true,
|
|
@@ -983,7 +991,7 @@ var EmailIntegration = class extends BaseIntegration {
|
|
|
983
991
|
data = await this.executeWithRetry(() => this.send(params));
|
|
984
992
|
break;
|
|
985
993
|
default:
|
|
986
|
-
throw new
|
|
994
|
+
throw new UnknownActionError(this.config.name, action);
|
|
987
995
|
}
|
|
988
996
|
return {
|
|
989
997
|
success: true,
|
|
@@ -1083,7 +1091,7 @@ var WebhookIntegration = class extends BaseIntegration {
|
|
|
1083
1091
|
data = await this.executeWithRetry(() => this.send(params));
|
|
1084
1092
|
break;
|
|
1085
1093
|
default:
|
|
1086
|
-
throw new
|
|
1094
|
+
throw new UnknownActionError(this.config.name, action);
|
|
1087
1095
|
}
|
|
1088
1096
|
return {
|
|
1089
1097
|
success: true,
|
|
@@ -1174,7 +1182,7 @@ var PushIntegration = class extends BaseIntegration {
|
|
|
1174
1182
|
data = await this.executeWithRetry(() => this.send(params));
|
|
1175
1183
|
break;
|
|
1176
1184
|
default:
|
|
1177
|
-
throw new
|
|
1185
|
+
throw new UnknownActionError(this.config.name, action);
|
|
1178
1186
|
}
|
|
1179
1187
|
return {
|
|
1180
1188
|
success: true,
|
|
@@ -1283,7 +1291,7 @@ var CalendarIntegration = class extends BaseIntegration {
|
|
|
1283
1291
|
data = await this.executeWithRetry(() => this.stopWatch(params));
|
|
1284
1292
|
break;
|
|
1285
1293
|
default:
|
|
1286
|
-
throw new
|
|
1294
|
+
throw new UnknownActionError(this.config.name, action);
|
|
1287
1295
|
}
|
|
1288
1296
|
return {
|
|
1289
1297
|
success: true,
|
|
@@ -1528,7 +1536,7 @@ var DriveIntegration = class extends BaseIntegration {
|
|
|
1528
1536
|
data = await this.executeWithRetry(() => this.shareFile(params));
|
|
1529
1537
|
break;
|
|
1530
1538
|
default:
|
|
1531
|
-
throw new
|
|
1539
|
+
throw new UnknownActionError(this.config.name, action);
|
|
1532
1540
|
}
|
|
1533
1541
|
return {
|
|
1534
1542
|
success: true,
|
|
@@ -1666,7 +1674,7 @@ var MetaAdsIntegration = class extends BaseIntegration {
|
|
|
1666
1674
|
data = await this.executeWithRetry(() => this.listCampaigns(params));
|
|
1667
1675
|
break;
|
|
1668
1676
|
default:
|
|
1669
|
-
throw new
|
|
1677
|
+
throw new UnknownActionError(this.config.name, action);
|
|
1670
1678
|
}
|
|
1671
1679
|
return {
|
|
1672
1680
|
success: true,
|
|
@@ -1765,7 +1773,7 @@ var AccountingIntegration = class extends BaseIntegration {
|
|
|
1765
1773
|
data = this.exportRows(params.entries, JOURNAL_COLUMNS, "journal");
|
|
1766
1774
|
break;
|
|
1767
1775
|
default:
|
|
1768
|
-
throw new
|
|
1776
|
+
throw new UnknownActionError(this.config.name, action);
|
|
1769
1777
|
}
|
|
1770
1778
|
return {
|
|
1771
1779
|
success: true,
|
|
@@ -1847,7 +1855,7 @@ var BankingIntegration = class extends BaseIntegration {
|
|
|
1847
1855
|
data = await this.executeWithRetry(() => this.listTransactions(params));
|
|
1848
1856
|
break;
|
|
1849
1857
|
default:
|
|
1850
|
-
throw new
|
|
1858
|
+
throw new UnknownActionError(this.config.name, action);
|
|
1851
1859
|
}
|
|
1852
1860
|
return {
|
|
1853
1861
|
success: true,
|
|
@@ -1971,7 +1979,7 @@ var EsignIntegration = class extends BaseIntegration {
|
|
|
1971
1979
|
data = await this.executeWithRetry(() => this.downloadDocument(params));
|
|
1972
1980
|
break;
|
|
1973
1981
|
default:
|
|
1974
|
-
throw new
|
|
1982
|
+
throw new UnknownActionError(this.config.name, action);
|
|
1975
1983
|
}
|
|
1976
1984
|
return {
|
|
1977
1985
|
success: true,
|
|
@@ -2125,7 +2133,7 @@ var LLMIntegration = class extends BaseIntegration {
|
|
|
2125
2133
|
data = await this.executeWithRetry(() => this.embed(params));
|
|
2126
2134
|
break;
|
|
2127
2135
|
default:
|
|
2128
|
-
throw new
|
|
2136
|
+
throw new UnknownActionError(this.config.name, action);
|
|
2129
2137
|
}
|
|
2130
2138
|
return {
|
|
2131
2139
|
success: true,
|
|
@@ -2291,7 +2299,7 @@ var MLIntegration = class extends BaseIntegration {
|
|
|
2291
2299
|
data = await this.executeWithRetry(() => this.infer(params));
|
|
2292
2300
|
break;
|
|
2293
2301
|
default:
|
|
2294
|
-
throw new
|
|
2302
|
+
throw new UnknownActionError(this.config.name, action);
|
|
2295
2303
|
}
|
|
2296
2304
|
return {
|
|
2297
2305
|
success: true,
|
|
@@ -2428,7 +2436,7 @@ var DeepAgentIntegration = class extends BaseIntegration {
|
|
|
2428
2436
|
);
|
|
2429
2437
|
break;
|
|
2430
2438
|
default:
|
|
2431
|
-
throw new
|
|
2439
|
+
throw new UnknownActionError(this.config.name, action);
|
|
2432
2440
|
}
|
|
2433
2441
|
return {
|
|
2434
2442
|
success: true,
|
|
@@ -2730,10 +2738,10 @@ async function getPRComments(params, config) {
|
|
|
2730
2738
|
return data;
|
|
2731
2739
|
}
|
|
2732
2740
|
async function listIssues(params, config) {
|
|
2733
|
-
const { state = "open", labels = [],
|
|
2741
|
+
const { state = "open", labels = [], per_page = 30 } = params;
|
|
2734
2742
|
const queryParams = new URLSearchParams({
|
|
2735
2743
|
state,
|
|
2736
|
-
per_page: Math.min(
|
|
2744
|
+
per_page: Math.min(per_page, 100).toString()
|
|
2737
2745
|
});
|
|
2738
2746
|
if (labels.length > 0) {
|
|
2739
2747
|
queryParams.append("labels", labels.join(","));
|
|
@@ -2750,6 +2758,52 @@ async function getIssue(params, config) {
|
|
|
2750
2758
|
const { data: comments } = await githubFetch(commentsEndpoint, config);
|
|
2751
2759
|
return { issue, comments };
|
|
2752
2760
|
}
|
|
2761
|
+
async function listCommits(config, options) {
|
|
2762
|
+
const params = new URLSearchParams();
|
|
2763
|
+
if (options?.path) params.set("path", options.path);
|
|
2764
|
+
if (options?.ref) params.set("sha", options.ref);
|
|
2765
|
+
if (options?.perPage) params.set("per_page", options.perPage.toString());
|
|
2766
|
+
if (options?.page) params.set("page", options.page.toString());
|
|
2767
|
+
const queryStr = params.toString();
|
|
2768
|
+
const endpoint = `/repos/${config.owner}/${config.repo}/commits${queryStr ? `?${queryStr}` : ""}`;
|
|
2769
|
+
const { data } = await githubFetch(endpoint, config);
|
|
2770
|
+
return data.map((item) => ({
|
|
2771
|
+
sha: item.sha,
|
|
2772
|
+
message: item.commit.message,
|
|
2773
|
+
author: item.commit.author,
|
|
2774
|
+
stats: item.stats
|
|
2775
|
+
}));
|
|
2776
|
+
}
|
|
2777
|
+
async function getFile(params, token) {
|
|
2778
|
+
const { owner, repo, path, ref } = params;
|
|
2779
|
+
const config = { token};
|
|
2780
|
+
const query = ref ? `?ref=${encodeURIComponent(ref)}` : "";
|
|
2781
|
+
const endpoint = `/repos/${owner}/${repo}/contents/${path}${query}`;
|
|
2782
|
+
const { data } = await githubFetch(endpoint, config);
|
|
2783
|
+
const content = data.encoding === "base64" ? Buffer.from(data.content, "base64").toString("utf-8") : data.content;
|
|
2784
|
+
return { path: data.path, content, sha: data.sha, size: data.size };
|
|
2785
|
+
}
|
|
2786
|
+
async function listCommitsSummary(params, token) {
|
|
2787
|
+
const { owner, repo, path, ref, per_page } = params;
|
|
2788
|
+
const config = { token, owner, repo };
|
|
2789
|
+
const commits = await listCommits(config, { path, ref, perPage: per_page });
|
|
2790
|
+
return commits.map((commit2) => ({
|
|
2791
|
+
sha: commit2.sha,
|
|
2792
|
+
message: commit2.message,
|
|
2793
|
+
author: commit2.author.name,
|
|
2794
|
+
date: commit2.author.date
|
|
2795
|
+
}));
|
|
2796
|
+
}
|
|
2797
|
+
async function createIssue(params, token) {
|
|
2798
|
+
const { owner, repo, title, body, labels } = params;
|
|
2799
|
+
const config = { token};
|
|
2800
|
+
const endpoint = `/repos/${owner}/${repo}/issues`;
|
|
2801
|
+
const { data } = await githubFetch(endpoint, config, {
|
|
2802
|
+
method: "POST",
|
|
2803
|
+
body: JSON.stringify({ title, body, labels })
|
|
2804
|
+
});
|
|
2805
|
+
return { number: data.number, title: data.title, url: data.url };
|
|
2806
|
+
}
|
|
2753
2807
|
function parseRepoUrl(repoUrl) {
|
|
2754
2808
|
try {
|
|
2755
2809
|
const url = new URL(repoUrl);
|
|
@@ -2847,8 +2901,23 @@ var GitHubIntegration = class extends BaseIntegration {
|
|
|
2847
2901
|
() => this.getIssue(params)
|
|
2848
2902
|
);
|
|
2849
2903
|
break;
|
|
2904
|
+
case "getFile":
|
|
2905
|
+
data = await this.executeWithRetry(
|
|
2906
|
+
() => this.getFile(params)
|
|
2907
|
+
);
|
|
2908
|
+
break;
|
|
2909
|
+
case "listCommits":
|
|
2910
|
+
data = await this.executeWithRetry(
|
|
2911
|
+
() => this.listCommits(params)
|
|
2912
|
+
);
|
|
2913
|
+
break;
|
|
2914
|
+
case "createIssue":
|
|
2915
|
+
data = await this.executeWithRetry(
|
|
2916
|
+
() => this.createIssue(params)
|
|
2917
|
+
);
|
|
2918
|
+
break;
|
|
2850
2919
|
default:
|
|
2851
|
-
throw new
|
|
2920
|
+
throw new UnknownActionError(this.config.name, action);
|
|
2852
2921
|
}
|
|
2853
2922
|
return {
|
|
2854
2923
|
success: true,
|
|
@@ -2927,7 +2996,7 @@ var GitHubIntegration = class extends BaseIntegration {
|
|
|
2927
2996
|
* List issues
|
|
2928
2997
|
*/
|
|
2929
2998
|
async listIssues(params) {
|
|
2930
|
-
this.logger.debug("Listing issues", { state: params.state, labels: params.labels?.join(", "),
|
|
2999
|
+
this.logger.debug("Listing issues", { state: params.state, labels: params.labels?.join(", "), per_page: params.per_page });
|
|
2931
3000
|
const apiConfig = this.getAPIConfig();
|
|
2932
3001
|
const issues = await listIssues(params, apiConfig);
|
|
2933
3002
|
return { issues };
|
|
@@ -2941,6 +3010,29 @@ var GitHubIntegration = class extends BaseIntegration {
|
|
|
2941
3010
|
const result = await getIssue(params, apiConfig);
|
|
2942
3011
|
return result;
|
|
2943
3012
|
}
|
|
3013
|
+
/**
|
|
3014
|
+
* Get a file's content plus metadata (owner/repo are per-call, not the
|
|
3015
|
+
* configured default repo)
|
|
3016
|
+
*/
|
|
3017
|
+
async getFile(params) {
|
|
3018
|
+
this.logger.debug("Getting file", { owner: params.owner, repo: params.repo, path: params.path });
|
|
3019
|
+
return getFile(params, this.token);
|
|
3020
|
+
}
|
|
3021
|
+
/**
|
|
3022
|
+
* List commits (owner/repo are per-call, not the configured default repo)
|
|
3023
|
+
*/
|
|
3024
|
+
async listCommits(params) {
|
|
3025
|
+
this.logger.debug("Listing commits", { owner: params.owner, repo: params.repo, path: params.path });
|
|
3026
|
+
const commits = await listCommitsSummary(params, this.token);
|
|
3027
|
+
return { commits };
|
|
3028
|
+
}
|
|
3029
|
+
/**
|
|
3030
|
+
* Create an issue (owner/repo are per-call, not the configured default repo)
|
|
3031
|
+
*/
|
|
3032
|
+
async createIssue(params) {
|
|
3033
|
+
this.logger.debug("Creating issue", { owner: params.owner, repo: params.repo, title: params.title });
|
|
3034
|
+
return createIssue(params, this.token);
|
|
3035
|
+
}
|
|
2944
3036
|
/**
|
|
2945
3037
|
* Get API config for GitHub API calls
|
|
2946
3038
|
*/
|
|
@@ -2972,7 +3064,7 @@ var CLIIntegration = class extends BaseIntegration {
|
|
|
2972
3064
|
data = await this.validate(params);
|
|
2973
3065
|
break;
|
|
2974
3066
|
default:
|
|
2975
|
-
throw new
|
|
3067
|
+
throw new UnknownActionError(this.config.name, action);
|
|
2976
3068
|
}
|
|
2977
3069
|
return {
|
|
2978
3070
|
success: true,
|
|
@@ -3100,7 +3192,7 @@ var RedisIntegration = class extends BaseIntegration {
|
|
|
3100
3192
|
);
|
|
3101
3193
|
break;
|
|
3102
3194
|
default:
|
|
3103
|
-
throw new
|
|
3195
|
+
throw new UnknownActionError(this.config.name, action);
|
|
3104
3196
|
}
|
|
3105
3197
|
return {
|
|
3106
3198
|
success: true,
|
|
@@ -3306,7 +3398,7 @@ var QueueIntegration = class extends BaseIntegration {
|
|
|
3306
3398
|
data = await this.executeWithRetry(() => this.size(params));
|
|
3307
3399
|
break;
|
|
3308
3400
|
default:
|
|
3309
|
-
throw new
|
|
3401
|
+
throw new UnknownActionError(this.config.name, action);
|
|
3310
3402
|
}
|
|
3311
3403
|
return {
|
|
3312
3404
|
success: true,
|
|
@@ -3513,7 +3605,7 @@ var OtelIntegration = class extends BaseIntegration {
|
|
|
3513
3605
|
data = await this.executeWithRetry(() => this.getAllMetrics());
|
|
3514
3606
|
break;
|
|
3515
3607
|
default:
|
|
3516
|
-
throw new
|
|
3608
|
+
throw new UnknownActionError(this.config.name, action);
|
|
3517
3609
|
}
|
|
3518
3610
|
return {
|
|
3519
3611
|
success: true,
|
|
@@ -3709,7 +3801,7 @@ var OAuthIntegration = class extends BaseIntegration {
|
|
|
3709
3801
|
data = await this.executeWithRetry(() => this.real ? this.oidcUserinfo(params) : this.userinfo(params));
|
|
3710
3802
|
break;
|
|
3711
3803
|
default:
|
|
3712
|
-
throw new
|
|
3804
|
+
throw new UnknownActionError(this.config.name, action);
|
|
3713
3805
|
}
|
|
3714
3806
|
return {
|
|
3715
3807
|
success: true,
|
|
@@ -4027,7 +4119,7 @@ var CredentialsIntegration = class extends BaseIntegration {
|
|
|
4027
4119
|
break;
|
|
4028
4120
|
}
|
|
4029
4121
|
default:
|
|
4030
|
-
throw new
|
|
4122
|
+
throw new UnknownActionError(this.config.name, action);
|
|
4031
4123
|
}
|
|
4032
4124
|
return {
|
|
4033
4125
|
success: true,
|
|
@@ -4237,7 +4329,7 @@ var StorageIntegration = class extends BaseIntegration {
|
|
|
4237
4329
|
data = await this.executeWithRetry(() => this.getSignedUrl(params));
|
|
4238
4330
|
break;
|
|
4239
4331
|
default:
|
|
4240
|
-
throw new
|
|
4332
|
+
throw new UnknownActionError(this.config.name, action);
|
|
4241
4333
|
}
|
|
4242
4334
|
return {
|
|
4243
4335
|
success: true,
|
|
@@ -4530,7 +4622,7 @@ var DockerIntegration = class extends BaseIntegration {
|
|
|
4530
4622
|
data = await this.executeWithRetry(() => this.list(params));
|
|
4531
4623
|
break;
|
|
4532
4624
|
default:
|
|
4533
|
-
throw new
|
|
4625
|
+
throw new UnknownActionError(this.config.name, action);
|
|
4534
4626
|
}
|
|
4535
4627
|
return {
|
|
4536
4628
|
success: true,
|
|
@@ -4948,7 +5040,7 @@ var DatabaseIntegration = class extends BaseIntegration {
|
|
|
4948
5040
|
data = await this.executeWithRetry(() => this.runQuery(params));
|
|
4949
5041
|
break;
|
|
4950
5042
|
default:
|
|
4951
|
-
throw new
|
|
5043
|
+
throw new UnknownActionError(this.config.name, action);
|
|
4952
5044
|
}
|
|
4953
5045
|
return {
|
|
4954
5046
|
success: true,
|
|
@@ -5027,7 +5119,7 @@ var WikimediaIntegration = class extends BaseIntegration {
|
|
|
5027
5119
|
data = await this.executeWithRetry(() => this.getPage(params));
|
|
5028
5120
|
break;
|
|
5029
5121
|
default:
|
|
5030
|
-
throw new
|
|
5122
|
+
throw new UnknownActionError(this.config.name, action);
|
|
5031
5123
|
}
|
|
5032
5124
|
return { success: true, data, metadata: this.createMetadata(action, Date.now() - startTime) };
|
|
5033
5125
|
} catch (error) {
|
|
@@ -5102,7 +5194,7 @@ var IconifyIntegration = class extends BaseIntegration {
|
|
|
5102
5194
|
data = await this.executeWithRetry(() => this.getIconBody(params));
|
|
5103
5195
|
break;
|
|
5104
5196
|
default:
|
|
5105
|
-
throw new
|
|
5197
|
+
throw new UnknownActionError(this.config.name, action);
|
|
5106
5198
|
}
|
|
5107
5199
|
return { success: true, data, metadata: this.createMetadata(action, Date.now() - startTime) };
|
|
5108
5200
|
} catch (error) {
|
|
@@ -5206,7 +5298,7 @@ var ArxivIntegration = class extends BaseIntegration {
|
|
|
5206
5298
|
data = await this.executeWithRetry(() => this.search(params));
|
|
5207
5299
|
break;
|
|
5208
5300
|
default:
|
|
5209
|
-
throw new
|
|
5301
|
+
throw new UnknownActionError(this.config.name, action);
|
|
5210
5302
|
}
|
|
5211
5303
|
return { success: true, data, metadata: this.createMetadata(action, Date.now() - startTime) };
|
|
5212
5304
|
} catch (error) {
|