@hasna/connectors 1.3.23 → 1.3.25

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.
Files changed (36) hide show
  1. package/bin/index.js +492 -153
  2. package/bin/mcp.js +1078 -595
  3. package/bin/serve.js +774 -436
  4. package/connectors/connect-cloudflare/bun.lock +32 -0
  5. package/connectors/connect-gmail/bin/index.js +7027 -0
  6. package/connectors/connect-googledrive/bin/index.js +5958 -0
  7. package/connectors/connect-imessage/bin/.gitkeep +2 -0
  8. package/connectors/connect-imessage/bin/index.js +3016 -0
  9. package/connectors/connect-imessage/bun.lock +32 -0
  10. package/connectors/connect-imessage/package.json +46 -0
  11. package/connectors/connect-imessage/src/api/client.ts +139 -0
  12. package/connectors/connect-imessage/src/api/conversations.ts +49 -0
  13. package/connectors/connect-imessage/src/api/health.ts +16 -0
  14. package/connectors/connect-imessage/src/api/index.ts +62 -0
  15. package/connectors/connect-imessage/src/api/messages.ts +119 -0
  16. package/connectors/connect-imessage/src/cli/index.ts +258 -0
  17. package/connectors/connect-imessage/src/index.ts +26 -0
  18. package/connectors/connect-imessage/src/types/index.ts +134 -0
  19. package/connectors/connect-imessage/src/utils/config.ts +219 -0
  20. package/connectors/connect-imessage/src/utils/output.ts +121 -0
  21. package/connectors/connect-imessage/tsconfig.json +16 -0
  22. package/dist/core/builtins.test.d.ts +1 -0
  23. package/dist/core/connectors/googledrive.d.ts +6 -0
  24. package/dist/core/connectors/internal-operations.test.d.ts +1 -0
  25. package/dist/core/connectors/internal-runtime.test.d.ts +1 -0
  26. package/dist/core/errors.test.d.ts +1 -0
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +640 -86
  29. package/dist/lib/runner-auth.test.d.ts +1 -0
  30. package/dist/lib/runner.d.ts +31 -0
  31. package/dist/lib/test-endpoints.test.d.ts +1 -0
  32. package/dist/lib/workflow-runner.d.ts +7 -0
  33. package/dist/server/auth-exchange.test.d.ts +1 -0
  34. package/dist/server/auth-refresh.test.d.ts +1 -0
  35. package/dist/server/auth.d.ts +1 -0
  36. package/package.json +1 -1
@@ -0,0 +1,121 @@
1
+ import chalk from 'chalk';
2
+ import type { IMessageHealth, IMessageConversation, IMessage, IMessageContact } from '../types';
3
+
4
+ export type OutputFormat = 'json' | 'pretty';
5
+
6
+ function formatJson(data: unknown): string {
7
+ return JSON.stringify(data, null, 2);
8
+ }
9
+
10
+ export function output(data: unknown, format: OutputFormat = 'pretty'): void {
11
+ if (format === 'json') {
12
+ console.log(formatJson(data));
13
+ return;
14
+ }
15
+
16
+ // Pretty output
17
+ if (Array.isArray(data)) {
18
+ if (data.length === 0) {
19
+ console.log(chalk.dim('No results'));
20
+ return;
21
+ }
22
+ data.forEach((item) => outputSingle(item));
23
+ } else {
24
+ outputSingle(data);
25
+ }
26
+ }
27
+
28
+ function outputSingle(data: unknown): void {
29
+ if (isHealth(data)) {
30
+ outputHealth(data);
31
+ } else if (isConversation(data)) {
32
+ outputConversation(data);
33
+ } else if (isMessage(data)) {
34
+ outputMessage(data);
35
+ } else if (isContact(data)) {
36
+ outputContact(data);
37
+ } else {
38
+ console.log(formatJson(data));
39
+ }
40
+ }
41
+
42
+ function isHealth(data: unknown): data is IMessageHealth {
43
+ return typeof data === 'object' && data !== null && 'bridge' in data && 'imessage' in data;
44
+ }
45
+
46
+ function outputHealth(health: IMessageHealth): void {
47
+ const statusColor =
48
+ health.status === 'healthy'
49
+ ? chalk.green
50
+ : health.status === 'degraded'
51
+ ? chalk.yellow
52
+ : chalk.red;
53
+
54
+ console.log(chalk.bold('iMessage Bridge Status'));
55
+ console.log('');
56
+ console.log(' Status:', statusColor(health.status));
57
+ console.log('');
58
+ console.log(chalk.bold(' Bridge:'));
59
+ console.log(' Reachable:', health.bridge.reachable ? chalk.green('Yes') : chalk.red('No'));
60
+ if (health.bridge.version) console.log(' Version:', health.bridge.version);
61
+ if (health.bridge.platform) console.log(' Platform:', health.bridge.platform);
62
+ if (health.bridge.lastSeen) console.log(' Last Seen:', health.bridge.lastSeen);
63
+ console.log('');
64
+ console.log(chalk.bold(' iMessage:'));
65
+ console.log(' Signed In:', health.imessage.signedIn ? chalk.green('Yes') : chalk.red('No'));
66
+ if (health.imessage.account) console.log(' Account:', health.imessage.account);
67
+ console.log('');
68
+ console.log(' Timestamp:', health.timestamp);
69
+ }
70
+
71
+ function isConversation(data: unknown): data is IMessageConversation {
72
+ return typeof data === 'object' && data !== null && 'chatIdentifier' in data;
73
+ }
74
+
75
+ function outputConversation(conv: IMessageConversation): void {
76
+ console.log(chalk.bold(conv.displayName || conv.chatIdentifier));
77
+ console.log(' ID:', conv.id);
78
+ console.log(' Type:', conv.type);
79
+ if (conv.participants?.length) {
80
+ console.log(' Participants:', conv.participants.map((p) => p.name || p.handle).join(', '));
81
+ }
82
+ if (conv.lastMessage?.text) {
83
+ const prefix = conv.lastMessage.fromMe ? chalk.dim('You:') : chalk.dim('');
84
+ console.log(' Last:', prefix, conv.lastMessage.text.substring(0, 80));
85
+ }
86
+ if (conv.unreadCount && conv.unreadCount > 0) {
87
+ console.log(' Unread:', chalk.yellow(conv.unreadCount));
88
+ }
89
+ console.log('');
90
+ }
91
+
92
+ function isMessage(data: unknown): data is IMessage {
93
+ return typeof data === 'object' && data !== null && 'guid' in data && 'fromMe' in data;
94
+ }
95
+
96
+ function outputMessage(msg: IMessage): void {
97
+ const sender = msg.fromMe ? chalk.cyan('You') : chalk.green(msg.displayName || msg.handle || 'Unknown');
98
+ const arrow = msg.fromMe ? '→' : '←';
99
+ console.log(`${sender} ${arrow} ${msg.text || '(no text)'}`);
100
+ console.log(' Date:', msg.date);
101
+ if (msg.attachments?.length) {
102
+ console.log(' Attachments:', msg.attachments.length);
103
+ }
104
+ console.log('');
105
+ }
106
+
107
+ function isContact(data: unknown): data is IMessageContact {
108
+ return typeof data === 'object' && data !== null && 'handle' in data;
109
+ }
110
+
111
+ function outputContact(contact: IMessageContact): void {
112
+ console.log(chalk.bold(contact.name || contact.handle));
113
+ console.log(' Handle:', contact.handle);
114
+ if (contact.phoneNumbers?.length) {
115
+ console.log(' Phones:', contact.phoneNumbers.join(', '));
116
+ }
117
+ if (contact.emails?.length) {
118
+ console.log(' Emails:', contact.emails.join(', '));
119
+ }
120
+ console.log('');
121
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "outDir": "./dist",
11
+ "declaration": true,
12
+ "resolveJsonModule": true
13
+ },
14
+ "include": ["src/**/*"],
15
+ "exclude": ["node_modules", "dist"]
16
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const GOOGLE_DRIVE_FOLDER_MIME = "application/vnd.google-apps.folder";
2
+ interface GoogleDriveContext {
3
+ profile: string;
4
+ }
5
+ export declare const googleDriveConnector: import("../connector.js").InternalConnectorDefinition<GoogleDriveContext>;
6
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -9,5 +9,5 @@
9
9
  */
10
10
  export { CONNECTORS, CATEGORIES, getConnector, getConnectorsByCategory, searchConnectors, loadConnectorVersions, type ConnectorMeta, type Category, type ScoredResult, type SearchContext, } from "./lib/registry.js";
11
11
  export { installConnector, installConnectors, getInstalledConnectors, removeConnector, connectorExists, getConnectorPath, getConnectorDocs, type InstallResult, type InstallOptions, type ConnectorDocs, } from "./lib/installer.js";
12
- export { runConnectorCommand, getConnectorOperations, getConnectorCommandHelp, getConnectorCliPath, hasConnectorCommandSurface, getConnectorsWithCli, type RunResult, } from "./lib/runner.js";
12
+ export { runConnectorCommand, runConnectorOperation, buildConnectorOperationArgs, getConnectorOperations, getConnectorCommandHelp, getConnectorCliPath, hasConnectorCommandSurface, getConnectorsWithCli, type RunResult, type RunConnectorOperationArgs, type ConnectorOperationResult, } from "./lib/runner.js";
13
13
  export { defineConnector, executeConnectorOperation, getConnectorOperation, listConnectorOperations, ConnectorDefinitionError, ConnectorOperationNotFoundError, type ConnectorAuthDefinition, type ConnectorAuthField, type ConnectorAuthType, type ConnectorCommandDescriptor, type ConnectorCommandResult, type ConnectorCommandRuntime, type ConnectorContextFactoryArgs, type ConnectorDefinition, type ConnectorMetadata, type ConnectorOperationContext, type ConnectorOperationDefinition, type ConnectorOperationMap, type ExecuteConnectorOperationArgs, type InternalConnectorDefinition, type InternalConnectorOperationDefinition, } from "./core/index.js";