@hasna/connectors 1.3.22 → 1.3.23
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/bin/index.js +109 -59
- package/bin/mcp.js +236 -182
- package/bin/serve.js +77 -33
- package/connectors/connect-dropbox/src/api/bulk.ts +285 -0
- package/connectors/connect-dropbox/src/api/index.ts +4 -0
- package/connectors/connect-dropbox/src/cli/index.ts +151 -0
- package/connectors/connect-github/src/api/bulk.ts +328 -0
- package/connectors/connect-github/src/api/index.ts +4 -0
- package/connectors/connect-github/src/cli/index.ts +145 -0
- package/connectors/connect-gmail/src/api/history.ts +82 -0
- package/connectors/connect-gmail/src/api/index.ts +12 -0
- package/connectors/connect-gmail/src/api/settings.ts +280 -0
- package/connectors/connect-gmail/src/api/watch.ts +40 -0
- package/connectors/connect-gmail/src/cli/index.ts +237 -0
- package/connectors/connect-googleads/src/api/bulk.ts +354 -0
- package/connectors/connect-googleads/src/api/index.ts +4 -0
- package/connectors/connect-googleads/src/cli/index.ts +192 -0
- package/connectors/connect-googlecalendar/src/api/acl.ts +66 -0
- package/connectors/connect-googlecalendar/src/api/bulk.ts +452 -0
- package/connectors/connect-googlecalendar/src/api/freebusy.ts +35 -0
- package/connectors/connect-googlecalendar/src/api/index.ts +9 -0
- package/connectors/connect-googlecalendar/src/cli/index.ts +522 -0
- package/connectors/connect-googlecalendar/src/types/index.ts +90 -0
- package/connectors/connect-googlecontacts/src/api/bulk.ts +365 -0
- package/connectors/connect-googlecontacts/src/api/groups.ts +164 -0
- package/connectors/connect-googlecontacts/src/api/index.ts +8 -0
- package/connectors/connect-googlecontacts/src/cli/index.ts +340 -0
- package/connectors/connect-googledocs/src/api/bulk.ts +301 -0
- package/connectors/connect-googledocs/src/api/index.ts +4 -0
- package/connectors/connect-googledocs/src/cli/index.ts +187 -0
- package/connectors/connect-googledrive/src/api/bulk.ts +505 -0
- package/connectors/connect-googledrive/src/api/changes.ts +139 -0
- package/connectors/connect-googledrive/src/api/client.ts +34 -0
- package/connectors/connect-googledrive/src/api/index.ts +12 -0
- package/connectors/connect-googledrive/src/api/revisions.ts +132 -0
- package/connectors/connect-googledrive/src/cli/index.ts +624 -0
- package/connectors/connect-googledrive/src/index.ts +2 -0
- package/connectors/connect-googlephotos/src/api/bulk.ts +455 -0
- package/connectors/connect-googlephotos/src/api/index.ts +8 -0
- package/connectors/connect-googlephotos/src/cli/index.ts +185 -0
- package/connectors/connect-googletasks/src/api/bulk.ts +359 -0
- package/connectors/connect-googletasks/src/api/index.ts +1 -0
- package/connectors/connect-googletasks/src/cli/index.ts +178 -0
- package/connectors/connect-linear/src/api/bulk.ts +219 -0
- package/connectors/connect-linear/src/api/index.ts +4 -0
- package/connectors/connect-linear/src/cli/index.ts +116 -0
- package/connectors/connect-shopify/src/api/bulk.ts +288 -0
- package/connectors/connect-shopify/src/api/index.ts +4 -0
- package/connectors/connect-shopify/src/cli/index.ts +108 -0
- package/connectors/connect-slack/src/api/bulk.ts +237 -0
- package/connectors/connect-slack/src/api/index.ts +4 -0
- package/connectors/connect-slack/src/cli/index.ts +157 -0
- package/connectors/connect-stripe/src/api/bulk.ts +488 -0
- package/connectors/connect-stripe/src/api/index.ts +4 -0
- package/connectors/connect-stripe/src/cli/index.ts +206 -0
- package/dist/index.js +75 -33
- package/dist/lib/runner.d.ts +15 -5
- package/package.json +2 -2
- package/connectors/connect-cloudflare/bun.lock +0 -32
- package/connectors/connect-gmail/bin/index.js +0 -7027
- package/connectors/connect-gmail/dist/cli/index.js +0 -7035
- package/connectors/connect-gmail/dist/index.js +0 -2174
- package/dist/server/server.test.d.ts +0 -1
|
@@ -1991,5 +1991,211 @@ billingPortalCmd
|
|
|
1991
1991
|
}
|
|
1992
1992
|
});
|
|
1993
1993
|
|
|
1994
|
+
// ============================================
|
|
1995
|
+
// Bulk Operations Commands
|
|
1996
|
+
// ============================================
|
|
1997
|
+
const bulkCmd = program
|
|
1998
|
+
.command('bulk')
|
|
1999
|
+
.description('Bulk operations');
|
|
2000
|
+
|
|
2001
|
+
bulkCmd
|
|
2002
|
+
.command('products')
|
|
2003
|
+
.description('Bulk product operations')
|
|
2004
|
+
.requiredOption('--ids <ids>', 'Comma-separated product IDs')
|
|
2005
|
+
.requiredOption('--action <action>', 'Action: delete, activate, deactivate')
|
|
2006
|
+
.option('--concurrency <number>', 'Max concurrent operations', '10')
|
|
2007
|
+
.option('--dry-run', 'Preview without executing')
|
|
2008
|
+
.action(async function(this: Command, opts) {
|
|
2009
|
+
try {
|
|
2010
|
+
const client = getClient();
|
|
2011
|
+
const result = await client.bulk.products({
|
|
2012
|
+
productIds: opts.ids.split(',').map((id: string) => id.trim()),
|
|
2013
|
+
action: opts.action as 'delete' | 'activate' | 'deactivate',
|
|
2014
|
+
concurrency: parseInt(opts.concurrency),
|
|
2015
|
+
dryRun: opts.dryRun,
|
|
2016
|
+
onProgress: (current, total) => info(`Progress: ${current}/${total}`),
|
|
2017
|
+
});
|
|
2018
|
+
print(result, getFormat(this));
|
|
2019
|
+
info(`Success: ${result.success}, Failed: ${result.failed}, Total: ${result.total}`);
|
|
2020
|
+
if (result.errors.length > 0) {
|
|
2021
|
+
warn('Errors:');
|
|
2022
|
+
result.errors.forEach(e => error(` ${e.productId}: ${e.error}`));
|
|
2023
|
+
}
|
|
2024
|
+
} catch (err) {
|
|
2025
|
+
error(String(err));
|
|
2026
|
+
process.exit(1);
|
|
2027
|
+
}
|
|
2028
|
+
});
|
|
2029
|
+
|
|
2030
|
+
bulkCmd
|
|
2031
|
+
.command('prices')
|
|
2032
|
+
.description('Bulk price operations')
|
|
2033
|
+
.requiredOption('--ids <ids>', 'Comma-separated price IDs')
|
|
2034
|
+
.requiredOption('--action <action>', 'Action: activate, deactivate')
|
|
2035
|
+
.option('--concurrency <number>', 'Max concurrent operations', '10')
|
|
2036
|
+
.option('--dry-run', 'Preview without executing')
|
|
2037
|
+
.action(async function(this: Command, opts) {
|
|
2038
|
+
try {
|
|
2039
|
+
const client = getClient();
|
|
2040
|
+
const result = await client.bulk.prices({
|
|
2041
|
+
priceIds: opts.ids.split(',').map((id: string) => id.trim()),
|
|
2042
|
+
action: opts.action as 'activate' | 'deactivate',
|
|
2043
|
+
concurrency: parseInt(opts.concurrency),
|
|
2044
|
+
dryRun: opts.dryRun,
|
|
2045
|
+
onProgress: (current, total) => info(`Progress: ${current}/${total}`),
|
|
2046
|
+
});
|
|
2047
|
+
print(result, getFormat(this));
|
|
2048
|
+
info(`Success: ${result.success}, Failed: ${result.failed}, Total: ${result.total}`);
|
|
2049
|
+
if (result.errors.length > 0) {
|
|
2050
|
+
warn('Errors:');
|
|
2051
|
+
result.errors.forEach(e => error(` ${e.priceId}: ${e.error}`));
|
|
2052
|
+
}
|
|
2053
|
+
} catch (err) {
|
|
2054
|
+
error(String(err));
|
|
2055
|
+
process.exit(1);
|
|
2056
|
+
}
|
|
2057
|
+
});
|
|
2058
|
+
|
|
2059
|
+
bulkCmd
|
|
2060
|
+
.command('customers')
|
|
2061
|
+
.description('Bulk delete customers')
|
|
2062
|
+
.requiredOption('--ids <ids>', 'Comma-separated customer IDs')
|
|
2063
|
+
.option('--concurrency <number>', 'Max concurrent operations', '10')
|
|
2064
|
+
.option('--dry-run', 'Preview without executing')
|
|
2065
|
+
.action(async function(this: Command, opts) {
|
|
2066
|
+
try {
|
|
2067
|
+
const client = getClient();
|
|
2068
|
+
const result = await client.bulk.customers({
|
|
2069
|
+
customerIds: opts.ids.split(',').map((id: string) => id.trim()),
|
|
2070
|
+
concurrency: parseInt(opts.concurrency),
|
|
2071
|
+
dryRun: opts.dryRun,
|
|
2072
|
+
onProgress: (current, total) => info(`Progress: ${current}/${total}`),
|
|
2073
|
+
});
|
|
2074
|
+
print(result, getFormat(this));
|
|
2075
|
+
info(`Success: ${result.success}, Failed: ${result.failed}, Total: ${result.total}`);
|
|
2076
|
+
if (result.errors.length > 0) {
|
|
2077
|
+
warn('Errors:');
|
|
2078
|
+
result.errors.forEach(e => error(` ${e.customerId}: ${e.error}`));
|
|
2079
|
+
}
|
|
2080
|
+
} catch (err) {
|
|
2081
|
+
error(String(err));
|
|
2082
|
+
process.exit(1);
|
|
2083
|
+
}
|
|
2084
|
+
});
|
|
2085
|
+
|
|
2086
|
+
bulkCmd
|
|
2087
|
+
.command('subscriptions')
|
|
2088
|
+
.description('Bulk subscription operations')
|
|
2089
|
+
.requiredOption('--ids <ids>', 'Comma-separated subscription IDs')
|
|
2090
|
+
.requiredOption('--action <action>', 'Action: cancel, resume')
|
|
2091
|
+
.option('--cancel-immediately', 'Cancel immediately instead of at period end')
|
|
2092
|
+
.option('--concurrency <number>', 'Max concurrent operations', '10')
|
|
2093
|
+
.option('--dry-run', 'Preview without executing')
|
|
2094
|
+
.action(async function(this: Command, opts) {
|
|
2095
|
+
try {
|
|
2096
|
+
const client = getClient();
|
|
2097
|
+
const result = await client.bulk.subscriptions({
|
|
2098
|
+
subscriptionIds: opts.ids.split(',').map((id: string) => id.trim()),
|
|
2099
|
+
action: opts.action as 'cancel' | 'resume',
|
|
2100
|
+
cancelImmediately: opts.cancelImmediately,
|
|
2101
|
+
concurrency: parseInt(opts.concurrency),
|
|
2102
|
+
dryRun: opts.dryRun,
|
|
2103
|
+
onProgress: (current, total) => info(`Progress: ${current}/${total}`),
|
|
2104
|
+
});
|
|
2105
|
+
print(result, getFormat(this));
|
|
2106
|
+
info(`Success: ${result.success}, Failed: ${result.failed}, Total: ${result.total}`);
|
|
2107
|
+
if (result.errors.length > 0) {
|
|
2108
|
+
warn('Errors:');
|
|
2109
|
+
result.errors.forEach(e => error(` ${e.subscriptionId}: ${e.error}`));
|
|
2110
|
+
}
|
|
2111
|
+
} catch (err) {
|
|
2112
|
+
error(String(err));
|
|
2113
|
+
process.exit(1);
|
|
2114
|
+
}
|
|
2115
|
+
});
|
|
2116
|
+
|
|
2117
|
+
bulkCmd
|
|
2118
|
+
.command('coupons')
|
|
2119
|
+
.description('Bulk delete coupons')
|
|
2120
|
+
.requiredOption('--ids <ids>', 'Comma-separated coupon IDs')
|
|
2121
|
+
.option('--concurrency <number>', 'Max concurrent operations', '10')
|
|
2122
|
+
.option('--dry-run', 'Preview without executing')
|
|
2123
|
+
.action(async function(this: Command, opts) {
|
|
2124
|
+
try {
|
|
2125
|
+
const client = getClient();
|
|
2126
|
+
const result = await client.bulk.coupons({
|
|
2127
|
+
couponIds: opts.ids.split(',').map((id: string) => id.trim()),
|
|
2128
|
+
concurrency: parseInt(opts.concurrency),
|
|
2129
|
+
dryRun: opts.dryRun,
|
|
2130
|
+
onProgress: (current, total) => info(`Progress: ${current}/${total}`),
|
|
2131
|
+
});
|
|
2132
|
+
print(result, getFormat(this));
|
|
2133
|
+
info(`Success: ${result.success}, Failed: ${result.failed}, Total: ${result.total}`);
|
|
2134
|
+
if (result.errors.length > 0) {
|
|
2135
|
+
warn('Errors:');
|
|
2136
|
+
result.errors.forEach(e => error(` ${e.couponId}: ${e.error}`));
|
|
2137
|
+
}
|
|
2138
|
+
} catch (err) {
|
|
2139
|
+
error(String(err));
|
|
2140
|
+
process.exit(1);
|
|
2141
|
+
}
|
|
2142
|
+
});
|
|
2143
|
+
|
|
2144
|
+
bulkCmd
|
|
2145
|
+
.command('invoices')
|
|
2146
|
+
.description('Bulk invoice operations')
|
|
2147
|
+
.requiredOption('--ids <ids>', 'Comma-separated invoice IDs')
|
|
2148
|
+
.requiredOption('--action <action>', 'Action: delete, void, finalize')
|
|
2149
|
+
.option('--concurrency <number>', 'Max concurrent operations', '10')
|
|
2150
|
+
.option('--dry-run', 'Preview without executing')
|
|
2151
|
+
.action(async function(this: Command, opts) {
|
|
2152
|
+
try {
|
|
2153
|
+
const client = getClient();
|
|
2154
|
+
const result = await client.bulk.invoices({
|
|
2155
|
+
invoiceIds: opts.ids.split(',').map((id: string) => id.trim()),
|
|
2156
|
+
action: opts.action as 'delete' | 'void' | 'finalize',
|
|
2157
|
+
concurrency: parseInt(opts.concurrency),
|
|
2158
|
+
dryRun: opts.dryRun,
|
|
2159
|
+
onProgress: (current, total) => info(`Progress: ${current}/${total}`),
|
|
2160
|
+
});
|
|
2161
|
+
print(result, getFormat(this));
|
|
2162
|
+
info(`Success: ${result.success}, Failed: ${result.failed}, Total: ${result.total}`);
|
|
2163
|
+
if (result.errors.length > 0) {
|
|
2164
|
+
warn('Errors:');
|
|
2165
|
+
result.errors.forEach(e => error(` ${e.invoiceId}: ${e.error}`));
|
|
2166
|
+
}
|
|
2167
|
+
} catch (err) {
|
|
2168
|
+
error(String(err));
|
|
2169
|
+
process.exit(1);
|
|
2170
|
+
}
|
|
2171
|
+
});
|
|
2172
|
+
|
|
2173
|
+
bulkCmd
|
|
2174
|
+
.command('webhooks')
|
|
2175
|
+
.description('Bulk delete webhooks')
|
|
2176
|
+
.requiredOption('--ids <ids>', 'Comma-separated webhook IDs')
|
|
2177
|
+
.option('--concurrency <number>', 'Max concurrent operations', '10')
|
|
2178
|
+
.option('--dry-run', 'Preview without executing')
|
|
2179
|
+
.action(async function(this: Command, opts) {
|
|
2180
|
+
try {
|
|
2181
|
+
const client = getClient();
|
|
2182
|
+
const result = await client.bulk.webhooks({
|
|
2183
|
+
webhookIds: opts.ids.split(',').map((id: string) => id.trim()),
|
|
2184
|
+
concurrency: parseInt(opts.concurrency),
|
|
2185
|
+
dryRun: opts.dryRun,
|
|
2186
|
+
onProgress: (current, total) => info(`Progress: ${current}/${total}`),
|
|
2187
|
+
});
|
|
2188
|
+
print(result, getFormat(this));
|
|
2189
|
+
info(`Success: ${result.success}, Failed: ${result.failed}, Total: ${result.total}`);
|
|
2190
|
+
if (result.errors.length > 0) {
|
|
2191
|
+
warn('Errors:');
|
|
2192
|
+
result.errors.forEach(e => error(` ${e.webhookId}: ${e.error}`));
|
|
2193
|
+
}
|
|
2194
|
+
} catch (err) {
|
|
2195
|
+
error(String(err));
|
|
2196
|
+
process.exit(1);
|
|
2197
|
+
}
|
|
2198
|
+
});
|
|
2199
|
+
|
|
1994
2200
|
// Parse and execute
|
|
1995
2201
|
program.parse();
|
package/dist/index.js
CHANGED
|
@@ -136,7 +136,7 @@ import { existsSync } from "fs";
|
|
|
136
136
|
import { dirname, join } from "path";
|
|
137
137
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
138
138
|
|
|
139
|
-
// node_modules/zod/v3/external.js
|
|
139
|
+
// ../../../home/hasna/workspace/hasna/opensource/open-connectors/node_modules/zod/v3/external.js
|
|
140
140
|
var exports_external = {};
|
|
141
141
|
__export(exports_external, {
|
|
142
142
|
void: () => voidType,
|
|
@@ -248,7 +248,7 @@ __export(exports_external, {
|
|
|
248
248
|
BRAND: () => BRAND
|
|
249
249
|
});
|
|
250
250
|
|
|
251
|
-
// node_modules/zod/v3/helpers/util.js
|
|
251
|
+
// ../../../home/hasna/workspace/hasna/opensource/open-connectors/node_modules/zod/v3/helpers/util.js
|
|
252
252
|
var util;
|
|
253
253
|
(function(util2) {
|
|
254
254
|
util2.assertEqual = (_) => {};
|
|
@@ -379,7 +379,7 @@ var getParsedType = (data) => {
|
|
|
379
379
|
}
|
|
380
380
|
};
|
|
381
381
|
|
|
382
|
-
// node_modules/zod/v3/ZodError.js
|
|
382
|
+
// ../../../home/hasna/workspace/hasna/opensource/open-connectors/node_modules/zod/v3/ZodError.js
|
|
383
383
|
var ZodIssueCode = util.arrayToEnum([
|
|
384
384
|
"invalid_type",
|
|
385
385
|
"invalid_literal",
|
|
@@ -498,7 +498,7 @@ ZodError.create = (issues) => {
|
|
|
498
498
|
return error;
|
|
499
499
|
};
|
|
500
500
|
|
|
501
|
-
// node_modules/zod/v3/locales/en.js
|
|
501
|
+
// ../../../home/hasna/workspace/hasna/opensource/open-connectors/node_modules/zod/v3/locales/en.js
|
|
502
502
|
var errorMap = (issue, _ctx) => {
|
|
503
503
|
let message;
|
|
504
504
|
switch (issue.code) {
|
|
@@ -601,7 +601,7 @@ var errorMap = (issue, _ctx) => {
|
|
|
601
601
|
};
|
|
602
602
|
var en_default = errorMap;
|
|
603
603
|
|
|
604
|
-
// node_modules/zod/v3/errors.js
|
|
604
|
+
// ../../../home/hasna/workspace/hasna/opensource/open-connectors/node_modules/zod/v3/errors.js
|
|
605
605
|
var overrideErrorMap = en_default;
|
|
606
606
|
function setErrorMap(map) {
|
|
607
607
|
overrideErrorMap = map;
|
|
@@ -609,7 +609,7 @@ function setErrorMap(map) {
|
|
|
609
609
|
function getErrorMap() {
|
|
610
610
|
return overrideErrorMap;
|
|
611
611
|
}
|
|
612
|
-
// node_modules/zod/v3/helpers/parseUtil.js
|
|
612
|
+
// ../../../home/hasna/workspace/hasna/opensource/open-connectors/node_modules/zod/v3/helpers/parseUtil.js
|
|
613
613
|
var makeIssue = (params) => {
|
|
614
614
|
const { data, path, errorMaps, issueData } = params;
|
|
615
615
|
const fullPath = [...path, ...issueData.path || []];
|
|
@@ -715,14 +715,14 @@ var isAborted = (x) => x.status === "aborted";
|
|
|
715
715
|
var isDirty = (x) => x.status === "dirty";
|
|
716
716
|
var isValid = (x) => x.status === "valid";
|
|
717
717
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
718
|
-
// node_modules/zod/v3/helpers/errorUtil.js
|
|
718
|
+
// ../../../home/hasna/workspace/hasna/opensource/open-connectors/node_modules/zod/v3/helpers/errorUtil.js
|
|
719
719
|
var errorUtil;
|
|
720
720
|
(function(errorUtil2) {
|
|
721
721
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
722
722
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
723
723
|
})(errorUtil || (errorUtil = {}));
|
|
724
724
|
|
|
725
|
-
// node_modules/zod/v3/types.js
|
|
725
|
+
// ../../../home/hasna/workspace/hasna/opensource/open-connectors/node_modules/zod/v3/types.js
|
|
726
726
|
class ParseInputLazyPath {
|
|
727
727
|
constructor(parent, value, path, key) {
|
|
728
728
|
this._cachedPath = [];
|
|
@@ -4969,7 +4969,7 @@ var githubConnector = defineConnector({
|
|
|
4969
4969
|
// package.json
|
|
4970
4970
|
var package_default = {
|
|
4971
4971
|
name: "@hasna/connectors",
|
|
4972
|
-
version: "1.3.
|
|
4972
|
+
version: "1.3.23",
|
|
4973
4973
|
description: "Open source connector library - Install API connectors with a single command",
|
|
4974
4974
|
type: "module",
|
|
4975
4975
|
bin: {
|
|
@@ -5000,7 +5000,7 @@ var package_default = {
|
|
|
5000
5000
|
typecheck: "tsc --noEmit",
|
|
5001
5001
|
test: "bun test",
|
|
5002
5002
|
"sdk:build": "cd sdk && bun run build",
|
|
5003
|
-
prepublishOnly: "bun
|
|
5003
|
+
prepublishOnly: "bun run build && bun test"
|
|
5004
5004
|
},
|
|
5005
5005
|
keywords: [
|
|
5006
5006
|
"connectors",
|
|
@@ -5067,7 +5067,7 @@ import {
|
|
|
5067
5067
|
} from "fs";
|
|
5068
5068
|
import { join as join7 } from "path";
|
|
5069
5069
|
|
|
5070
|
-
// node_modules/@hasna/cloud/dist/index.js
|
|
5070
|
+
// ../../../home/hasna/workspace/hasna/opensource/open-connectors/node_modules/@hasna/cloud/dist/index.js
|
|
5071
5071
|
import { createRequire } from "module";
|
|
5072
5072
|
import { Database } from "bun:sqlite";
|
|
5073
5073
|
import {
|
|
@@ -23160,6 +23160,53 @@ function getConnectorCliPath(name) {
|
|
|
23160
23160
|
function hasConnectorCommandSurface(name) {
|
|
23161
23161
|
return Boolean(getInternalCommandRuntime(name)?.commands.length || getConnectorCliPath(name));
|
|
23162
23162
|
}
|
|
23163
|
+
function normalizeCommanderUsage(usage) {
|
|
23164
|
+
const commandToken = usage.trim().split(/\s+/)[0];
|
|
23165
|
+
if (!commandToken || commandToken === "help")
|
|
23166
|
+
return null;
|
|
23167
|
+
const aliases = commandToken.split("|").filter(Boolean);
|
|
23168
|
+
const [name, ...rest] = aliases;
|
|
23169
|
+
if (!name)
|
|
23170
|
+
return null;
|
|
23171
|
+
return {
|
|
23172
|
+
name,
|
|
23173
|
+
aliases: rest,
|
|
23174
|
+
usage: usage.trim()
|
|
23175
|
+
};
|
|
23176
|
+
}
|
|
23177
|
+
function parseCommanderHelpOperations(helpText) {
|
|
23178
|
+
const operations = [];
|
|
23179
|
+
const lines = helpText.split(`
|
|
23180
|
+
`);
|
|
23181
|
+
let inCommands = false;
|
|
23182
|
+
for (const line of lines) {
|
|
23183
|
+
if (line.trim().startsWith("Commands:")) {
|
|
23184
|
+
inCommands = true;
|
|
23185
|
+
continue;
|
|
23186
|
+
}
|
|
23187
|
+
if (!inCommands)
|
|
23188
|
+
continue;
|
|
23189
|
+
if (line.trim() === "") {
|
|
23190
|
+
if (operations.length > 0)
|
|
23191
|
+
inCommands = false;
|
|
23192
|
+
continue;
|
|
23193
|
+
}
|
|
23194
|
+
const row = line.match(/^ {2}(\S.*?)(?: {2,}(.+))?$/);
|
|
23195
|
+
if (!row)
|
|
23196
|
+
continue;
|
|
23197
|
+
const usage = row[1].trim();
|
|
23198
|
+
const summary = (row[2] ?? "").trim();
|
|
23199
|
+
const normalized = normalizeCommanderUsage(usage);
|
|
23200
|
+
if (!normalized)
|
|
23201
|
+
continue;
|
|
23202
|
+
operations.push({
|
|
23203
|
+
...normalized,
|
|
23204
|
+
summary,
|
|
23205
|
+
source: "cli"
|
|
23206
|
+
});
|
|
23207
|
+
}
|
|
23208
|
+
return operations;
|
|
23209
|
+
}
|
|
23163
23210
|
function runConnectorCommand(name, args, timeoutMs = 30000) {
|
|
23164
23211
|
getConnectorsHome();
|
|
23165
23212
|
const internalRuntime = getInternalCommandRuntime(name);
|
|
@@ -23226,38 +23273,33 @@ function runLegacyConnectorCommand(name, args, timeoutMs = 30000) {
|
|
|
23226
23273
|
async function getConnectorOperations(name) {
|
|
23227
23274
|
const internalRuntime = getInternalCommandRuntime(name);
|
|
23228
23275
|
if (internalRuntime?.commands.length) {
|
|
23276
|
+
const operations2 = internalRuntime.commands.map((command) => ({
|
|
23277
|
+
name: command.name,
|
|
23278
|
+
aliases: [],
|
|
23279
|
+
usage: command.name,
|
|
23280
|
+
summary: command.summary,
|
|
23281
|
+
source: "internal"
|
|
23282
|
+
}));
|
|
23229
23283
|
return {
|
|
23230
|
-
commands:
|
|
23284
|
+
commands: operations2.map((operation) => operation.name),
|
|
23285
|
+
operations: operations2,
|
|
23231
23286
|
helpText: internalRuntime.helpText ?? buildInternalHelpText(name, internalRuntime.commands),
|
|
23232
23287
|
hasCli: true
|
|
23233
23288
|
};
|
|
23234
23289
|
}
|
|
23235
23290
|
const cliPath = getConnectorCliPath(name);
|
|
23236
23291
|
if (!cliPath) {
|
|
23237
|
-
return { commands: [], helpText: "", hasCli: false };
|
|
23292
|
+
return { commands: [], operations: [], helpText: "", hasCli: false };
|
|
23238
23293
|
}
|
|
23239
23294
|
const result = await runConnectorCommand(name, ["--help"]);
|
|
23240
23295
|
const helpText = result.stdout || result.stderr;
|
|
23241
|
-
const
|
|
23242
|
-
|
|
23243
|
-
|
|
23244
|
-
|
|
23245
|
-
|
|
23246
|
-
|
|
23247
|
-
|
|
23248
|
-
continue;
|
|
23249
|
-
}
|
|
23250
|
-
if (inCommands) {
|
|
23251
|
-
const match = line.match(/^\s{2,}(\S+)/);
|
|
23252
|
-
if (match && match[1] !== "help") {
|
|
23253
|
-
commands.push(match[1]);
|
|
23254
|
-
}
|
|
23255
|
-
if (line.trim() === "" && commands.length > 0) {
|
|
23256
|
-
inCommands = false;
|
|
23257
|
-
}
|
|
23258
|
-
}
|
|
23259
|
-
}
|
|
23260
|
-
return { commands, helpText, hasCli: true };
|
|
23296
|
+
const operations = parseCommanderHelpOperations(helpText);
|
|
23297
|
+
return {
|
|
23298
|
+
commands: operations.map((operation) => operation.name),
|
|
23299
|
+
operations,
|
|
23300
|
+
helpText,
|
|
23301
|
+
hasCli: true
|
|
23302
|
+
};
|
|
23261
23303
|
}
|
|
23262
23304
|
async function getConnectorCommandHelp(name, command) {
|
|
23263
23305
|
const internalRuntime = getInternalCommandRuntime(name);
|
package/dist/lib/runner.d.ts
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
* Connector runner - executes internal command runtimes first, then falls back
|
|
3
3
|
* to legacy connector CLIs for unmigrated connectors.
|
|
4
4
|
*/
|
|
5
|
+
export interface ConnectorOperationDescriptor {
|
|
6
|
+
name: string;
|
|
7
|
+
aliases: string[];
|
|
8
|
+
usage: string;
|
|
9
|
+
summary: string;
|
|
10
|
+
source: "internal" | "cli";
|
|
11
|
+
}
|
|
12
|
+
export interface ConnectorOperationsResult {
|
|
13
|
+
commands: string[];
|
|
14
|
+
operations: ConnectorOperationDescriptor[];
|
|
15
|
+
helpText: string;
|
|
16
|
+
hasCli: boolean;
|
|
17
|
+
}
|
|
5
18
|
/**
|
|
6
19
|
* Build the subprocess env with auto-detected credentials.
|
|
7
20
|
*
|
|
@@ -24,6 +37,7 @@ export declare function buildEnvWithCredentials(connectorName: string, baseEnv:
|
|
|
24
37
|
*/
|
|
25
38
|
export declare function getConnectorCliPath(name: string): string | null;
|
|
26
39
|
export declare function hasConnectorCommandSurface(name: string): boolean;
|
|
40
|
+
export declare function parseCommanderHelpOperations(helpText: string): ConnectorOperationDescriptor[];
|
|
27
41
|
export interface RunResult {
|
|
28
42
|
stdout: string;
|
|
29
43
|
stderr: string;
|
|
@@ -42,11 +56,7 @@ export declare function runConnectorCommand(name: string, args: string[], timeou
|
|
|
42
56
|
* Get the list of available operations for a connector by parsing its --help output.
|
|
43
57
|
* Returns structured command list.
|
|
44
58
|
*/
|
|
45
|
-
export declare function getConnectorOperations(name: string): Promise<
|
|
46
|
-
commands: string[];
|
|
47
|
-
helpText: string;
|
|
48
|
-
hasCli: boolean;
|
|
49
|
-
}>;
|
|
59
|
+
export declare function getConnectorOperations(name: string): Promise<ConnectorOperationsResult>;
|
|
50
60
|
/**
|
|
51
61
|
* Get detailed help for a specific connector subcommand.
|
|
52
62
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/connectors",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.23",
|
|
4
4
|
"description": "Open source connector library - Install API connectors with a single command",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"typecheck": "tsc --noEmit",
|
|
32
32
|
"test": "bun test",
|
|
33
33
|
"sdk:build": "cd sdk && bun run build",
|
|
34
|
-
"prepublishOnly": "bun
|
|
34
|
+
"prepublishOnly": "bun run build && bun test"
|
|
35
35
|
},
|
|
36
36
|
"keywords": [
|
|
37
37
|
"connectors",
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"lockfileVersion": 1,
|
|
3
|
-
"configVersion": 1,
|
|
4
|
-
"workspaces": {
|
|
5
|
-
"": {
|
|
6
|
-
"name": "@hasna/connect-cloudflare",
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"chalk": "^5.3.0",
|
|
9
|
-
"commander": "^12.1.0",
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
"@types/bun": "latest",
|
|
13
|
-
"typescript": "^5",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
"packages": {
|
|
18
|
-
"@types/bun": ["@types/bun@1.3.11", "", { "dependencies": { "bun-types": "1.3.11" } }, "sha512-5vPne5QvtpjGpsGYXiFyycfpDF2ECyPcTSsFBMa0fraoxiQyMJ3SmuQIGhzPg2WJuWxVBoxWJ2kClYTcw/4fAg=="],
|
|
19
|
-
|
|
20
|
-
"@types/node": ["@types/node@25.5.0", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-jp2P3tQMSxWugkCUKLRPVUpGaL5MVFwF8RDuSRztfwgN1wmqJeMSbKlnEtQqU8UrhTmzEmZdu2I6v2dpp7XIxw=="],
|
|
21
|
-
|
|
22
|
-
"bun-types": ["bun-types@1.3.11", "", { "dependencies": { "@types/node": "*" } }, "sha512-1KGPpoxQWl9f6wcZh57LvrPIInQMn2TQ7jsgxqpRzg+l0QPOFvJVH7HmvHo/AiPgwXy+/Thf6Ov3EdVn1vOabg=="],
|
|
23
|
-
|
|
24
|
-
"chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="],
|
|
25
|
-
|
|
26
|
-
"commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="],
|
|
27
|
-
|
|
28
|
-
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
|
29
|
-
|
|
30
|
-
"undici-types": ["undici-types@7.18.2", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="],
|
|
31
|
-
}
|
|
32
|
-
}
|