@hasna/connectors 1.3.32 → 1.3.33
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 +19345 -804
- package/bin/mcp.js +35033 -33318
- package/bin/serve.js +26861 -7773
- package/dist/cli/auth-no-browser.test.d.ts +1 -0
- package/dist/cli/commands/auth.d.ts +3 -0
- package/dist/core/builtins.test.d.ts +1 -0
- package/dist/core/connectors/gmail.d.ts +5 -0
- package/dist/core/connectors/googledrive.d.ts +6 -0
- package/dist/core/connectors/internal-operations.test.d.ts +1 -0
- package/dist/core/connectors/internal-runtime.test.d.ts +1 -0
- package/dist/core/errors.test.d.ts +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1399 -167
- package/dist/lib/connector-resolver.d.ts +37 -0
- package/dist/lib/connector-resolver.test.d.ts +1 -0
- package/dist/lib/lock.d.ts +1 -1
- package/dist/lib/manifest.d.ts +50 -0
- package/dist/lib/manifest.test.d.ts +1 -0
- package/dist/lib/runner-auth.test.d.ts +1 -0
- package/dist/lib/runner.d.ts +31 -0
- package/dist/lib/test-endpoints.test.d.ts +1 -0
- package/dist/lib/workflow-runner.d.ts +7 -0
- package/dist/mcp/http.d.ts +14 -0
- package/dist/mcp/http.test.d.ts +1 -0
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/server.d.ts +3 -0
- package/dist/server/auth-exchange.test.d.ts +1 -0
- package/dist/server/auth-refresh.test.d.ts +1 -0
- package/dist/server/auth.d.ts +4 -3
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const LEGACY_CONNECTOR_PREFIX = "connect-";
|
|
2
|
+
export interface ConnectorNameResolution {
|
|
3
|
+
input: string;
|
|
4
|
+
canonicalName: string;
|
|
5
|
+
legacyName: string;
|
|
6
|
+
aliases: string[];
|
|
7
|
+
isLegacyInput: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ConnectorPackagePathResolution extends ConnectorNameResolution {
|
|
10
|
+
connectorsDir: string;
|
|
11
|
+
preferredDirName: string;
|
|
12
|
+
preferredPath: string;
|
|
13
|
+
existingPath: string | null;
|
|
14
|
+
existingDirName: string | null;
|
|
15
|
+
checkedPaths: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface ConnectorConfigPathResolution extends ConnectorNameResolution {
|
|
18
|
+
connectorsHome: string;
|
|
19
|
+
preferredDirName: string;
|
|
20
|
+
preferredPath: string;
|
|
21
|
+
legacyPath: string;
|
|
22
|
+
existingPaths: string[];
|
|
23
|
+
readPaths: string[];
|
|
24
|
+
}
|
|
25
|
+
export declare function normalizeConnectorName(name: string): string;
|
|
26
|
+
export declare function legacyConnectorName(name: string): string;
|
|
27
|
+
export declare function resolveConnectorName(name: string): ConnectorNameResolution;
|
|
28
|
+
export declare function isValidConnectorName(name: string): boolean;
|
|
29
|
+
export declare function connectorPackageDirNames(name: string): string[];
|
|
30
|
+
export declare function connectorConfigDirNames(name: string): string[];
|
|
31
|
+
export declare function resolveConnectorPackagePath(connectorsDir: string, name: string): ConnectorPackagePathResolution;
|
|
32
|
+
export declare function getConnectorPackagePath(connectorsDir: string, name: string): string;
|
|
33
|
+
export declare function resolveConnectorConfigPaths(name: string, connectorsHome?: string): ConnectorConfigPathResolution;
|
|
34
|
+
export declare function getConnectorConfigDir(name: string, connectorsHome?: string): string;
|
|
35
|
+
export declare function getExistingConnectorConfigDirs(name: string, connectorsHome?: string): string[];
|
|
36
|
+
export declare function getConnectorConfigReadDirs(name: string, connectorsHome?: string): string[];
|
|
37
|
+
export declare function listConfiguredConnectorNames(connectorsHome?: string): string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/lib/lock.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Strategy: atomic O_EXCL file creation as the lock primitive (works on all
|
|
9
9
|
* platforms including macOS). Lock files live at:
|
|
10
|
-
* ~/.hasna/connectors/
|
|
10
|
+
* ~/.hasna/connectors/{name}/.write.lock
|
|
11
11
|
*
|
|
12
12
|
* Callers that cannot acquire the lock within the timeout receive a LockTimeoutError.
|
|
13
13
|
*/
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type Category, type ConnectorMeta } from "./registry.js";
|
|
2
|
+
import { type ConnectorDocs } from "./installer.js";
|
|
3
|
+
import { type ConnectorOperationDescriptor } from "./runner.js";
|
|
4
|
+
import { type AuthType } from "../server/auth.js";
|
|
5
|
+
export interface ConnectorCapabilityRuntime {
|
|
6
|
+
packageName: "@hasna/connectors";
|
|
7
|
+
connectorId: string;
|
|
8
|
+
legacyConnectorId: string;
|
|
9
|
+
packagePath: string;
|
|
10
|
+
configDirName: string;
|
|
11
|
+
legacyConfigDirName: string;
|
|
12
|
+
internal: boolean;
|
|
13
|
+
packageDirectory: boolean;
|
|
14
|
+
commandSurface: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface ConnectorCapabilityAuth {
|
|
17
|
+
type: AuthType;
|
|
18
|
+
summary: string | null;
|
|
19
|
+
envVars: ConnectorDocs["envVars"];
|
|
20
|
+
}
|
|
21
|
+
export interface ConnectorCapabilityDocs {
|
|
22
|
+
overview: string;
|
|
23
|
+
cliCommands: string;
|
|
24
|
+
dataStorage: string | null;
|
|
25
|
+
}
|
|
26
|
+
export interface ConnectorCapability extends ConnectorMeta {
|
|
27
|
+
id: string;
|
|
28
|
+
aliases: string[];
|
|
29
|
+
runtime: ConnectorCapabilityRuntime;
|
|
30
|
+
auth: ConnectorCapabilityAuth;
|
|
31
|
+
docs: ConnectorCapabilityDocs;
|
|
32
|
+
operations?: ConnectorOperationDescriptor[];
|
|
33
|
+
}
|
|
34
|
+
export interface ConnectorCapabilityManifest {
|
|
35
|
+
version: 1;
|
|
36
|
+
packageName: "@hasna/connectors";
|
|
37
|
+
packageVersion: string;
|
|
38
|
+
generatedAt: string;
|
|
39
|
+
categories: readonly Category[];
|
|
40
|
+
connectorCount: number;
|
|
41
|
+
connectors: ConnectorCapability[];
|
|
42
|
+
}
|
|
43
|
+
export interface ConnectorCapabilityOptions {
|
|
44
|
+
includeOperations?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface ConnectorCapabilityManifestOptions extends ConnectorCapabilityOptions {
|
|
47
|
+
connectorNames?: string[];
|
|
48
|
+
}
|
|
49
|
+
export declare function getConnectorCapability(name: string, options?: ConnectorCapabilityOptions): Promise<ConnectorCapability | null>;
|
|
50
|
+
export declare function getConnectorCapabilityManifest(options?: ConnectorCapabilityManifestOptions): Promise<ConnectorCapabilityManifest>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/lib/runner.d.ts
CHANGED
|
@@ -44,6 +44,28 @@ export interface RunResult {
|
|
|
44
44
|
exitCode: number;
|
|
45
45
|
success: boolean;
|
|
46
46
|
}
|
|
47
|
+
export interface RunConnectorOperationArgs {
|
|
48
|
+
connector: string;
|
|
49
|
+
operation: string;
|
|
50
|
+
input?: Record<string, unknown> & {
|
|
51
|
+
/**
|
|
52
|
+
* Positional arguments for legacy connector command surfaces.
|
|
53
|
+
*
|
|
54
|
+
* Example: { args: ["MESSAGE_ID"], body: true } becomes
|
|
55
|
+
* `messages read MESSAGE_ID --body --format json`.
|
|
56
|
+
*/
|
|
57
|
+
args?: Array<string | number | boolean>;
|
|
58
|
+
};
|
|
59
|
+
profile?: string;
|
|
60
|
+
timeoutMs?: number;
|
|
61
|
+
parseJson?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface ConnectorOperationResult<T = unknown> extends RunResult {
|
|
64
|
+
connector: string;
|
|
65
|
+
operation: string;
|
|
66
|
+
profile?: string;
|
|
67
|
+
data?: T;
|
|
68
|
+
}
|
|
47
69
|
/**
|
|
48
70
|
* Run a connector CLI command as a subprocess.
|
|
49
71
|
*
|
|
@@ -52,6 +74,15 @@ export interface RunResult {
|
|
|
52
74
|
* @param timeoutMs - Max execution time (default 30s)
|
|
53
75
|
*/
|
|
54
76
|
export declare function runConnectorCommand(name: string, args: string[], timeoutMs?: number): Promise<RunResult>;
|
|
77
|
+
/**
|
|
78
|
+
* Run a connector operation through the one-product runtime.
|
|
79
|
+
*
|
|
80
|
+
* This is the stable SDK surface for consumers such as @hasna/files. It avoids
|
|
81
|
+
* importing individual connect-* packages while still supporting legacy
|
|
82
|
+
* connector CLIs during the migration to internal connector definitions.
|
|
83
|
+
*/
|
|
84
|
+
export declare function runConnectorOperation<T = unknown>(args: RunConnectorOperationArgs): Promise<ConnectorOperationResult<T>>;
|
|
85
|
+
export declare function buildConnectorOperationArgs(args: RunConnectorOperationArgs): string[];
|
|
55
86
|
/**
|
|
56
87
|
* Get the list of available operations for a connector by parsing its --help output.
|
|
57
88
|
* Returns structured command list.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,7 +4,13 @@
|
|
|
4
4
|
* Each step receives the previous step's output as additional context
|
|
5
5
|
* injected into its args as --input <previous_output>.
|
|
6
6
|
*/
|
|
7
|
+
import { spawn as nodeSpawn } from "child_process";
|
|
7
8
|
import type { ConnectorWorkflow } from "../db/workflows.js";
|
|
9
|
+
type SpawnFn = typeof nodeSpawn;
|
|
10
|
+
/** @internal Test hook for substituting process spawning. */
|
|
11
|
+
export declare function __setSpawnForTests(fn: SpawnFn): void;
|
|
12
|
+
/** @internal Restore default process spawning after tests. */
|
|
13
|
+
export declare function __resetSpawnForTests(): void;
|
|
8
14
|
export interface WorkflowStepResult {
|
|
9
15
|
step: number;
|
|
10
16
|
connector: string;
|
|
@@ -20,3 +26,4 @@ export interface WorkflowResult {
|
|
|
20
26
|
final_output: string;
|
|
21
27
|
}
|
|
22
28
|
export declare function runWorkflow(workflow: ConnectorWorkflow): Promise<WorkflowResult>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const MCP_HTTP_PORT = 8854;
|
|
2
|
+
export declare const MCP_NAME = "connectors";
|
|
3
|
+
export declare function isHttpMode(argv: string[]): boolean;
|
|
4
|
+
export declare function isStdioMode(argv: string[]): boolean;
|
|
5
|
+
export declare function resolveHttpPort(argv: string[]): number;
|
|
6
|
+
export declare function healthPayload(): {
|
|
7
|
+
status: string;
|
|
8
|
+
name: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function handleMcpHttpRequest(req: Request): Promise<Response | null>;
|
|
11
|
+
export declare function startMcpHttpServer(port: number): Promise<{
|
|
12
|
+
port: number;
|
|
13
|
+
stop: () => void;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
export {};
|
|
2
|
+
export { buildServer } from "./server.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/server/auth.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface AuthStatus {
|
|
|
9
9
|
configured: boolean;
|
|
10
10
|
tokenExpiry?: number;
|
|
11
11
|
hasRefreshToken?: boolean;
|
|
12
|
+
hasOAuthCredentials?: boolean;
|
|
12
13
|
envVars: {
|
|
13
14
|
variable: string;
|
|
14
15
|
description: string;
|
|
@@ -78,18 +79,18 @@ export declare function refreshOAuthToken(name: string): Promise<OAuthTokens>;
|
|
|
78
79
|
export declare function getTokenExpiry(name: string): number | null;
|
|
79
80
|
/**
|
|
80
81
|
* List all profile names for a connector.
|
|
81
|
-
* Reads ~/.hasna/connectors/
|
|
82
|
+
* Reads ~/.hasna/connectors/{name}/profiles/ and legacy connect-{name} entries —
|
|
82
83
|
* both .json files (pattern 1) and subdirectories (pattern 2).
|
|
83
84
|
*/
|
|
84
85
|
export declare function listProfiles(name: string): string[];
|
|
85
86
|
/**
|
|
86
87
|
* Switch the active profile for a connector.
|
|
87
|
-
* Writes the profile name to ~/.hasna/connectors/
|
|
88
|
+
* Writes the profile name to ~/.hasna/connectors/{name}/current_profile
|
|
88
89
|
*/
|
|
89
90
|
export declare function switchProfile(name: string, profile: string): void;
|
|
90
91
|
/**
|
|
91
92
|
* Delete a profile for a connector.
|
|
92
|
-
* Removes the profile file or directory from ~/.hasna/connectors/
|
|
93
|
+
* Removes the profile file or directory from ~/.hasna/connectors/{name}/profiles/.
|
|
93
94
|
* Refuses to delete the "default" profile.
|
|
94
95
|
* Returns true if deletion succeeded, false if profile not found or is "default".
|
|
95
96
|
*/
|