@hasna/connectors 1.3.18 → 1.3.20

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.
@@ -0,0 +1,125 @@
1
+ import { existsSync, readFileSync, writeFileSync, mkdirSync, readdirSync, rmSync } from 'fs';
2
+ import { homedir } from 'os';
3
+ import { join } from 'path';
4
+
5
+ const CONNECTOR_NAME = 'connect-minimax';
6
+ const DEFAULT_PROFILE = 'default';
7
+
8
+ export interface ProfileConfig {
9
+ apiKey?: string;
10
+ groupId?: string;
11
+ }
12
+
13
+ let profileOverride: string | undefined;
14
+
15
+ const CONFIG_DIR = join(homedir(), '.hasna', 'connectors', CONNECTOR_NAME);
16
+ const PROFILES_DIR = join(CONFIG_DIR, 'profiles');
17
+ const CURRENT_PROFILE_FILE = join(CONFIG_DIR, 'current_profile');
18
+
19
+ export function setProfileOverride(profile: string | undefined): void {
20
+ profileOverride = profile;
21
+ }
22
+
23
+ export function ensureConfigDir(): void {
24
+ if (!existsSync(CONFIG_DIR)) mkdirSync(CONFIG_DIR, { recursive: true });
25
+ if (!existsSync(PROFILES_DIR)) mkdirSync(PROFILES_DIR, { recursive: true });
26
+ }
27
+
28
+ function getProfilePath(profile: string): string {
29
+ return join(PROFILES_DIR, `${profile}.json`);
30
+ }
31
+
32
+ export function getCurrentProfile(): string {
33
+ if (profileOverride) return profileOverride;
34
+ ensureConfigDir();
35
+ if (existsSync(CURRENT_PROFILE_FILE)) {
36
+ try {
37
+ const profile = readFileSync(CURRENT_PROFILE_FILE, 'utf-8').trim();
38
+ if (profile && profileExists(profile)) return profile;
39
+ } catch {}
40
+ }
41
+ return DEFAULT_PROFILE;
42
+ }
43
+
44
+ export function setCurrentProfile(profile: string): void {
45
+ ensureConfigDir();
46
+ if (!profileExists(profile) && profile !== DEFAULT_PROFILE) {
47
+ throw new Error(`Profile "${profile}" does not exist`);
48
+ }
49
+ writeFileSync(CURRENT_PROFILE_FILE, profile);
50
+ }
51
+
52
+ export function profileExists(profile: string): boolean {
53
+ return existsSync(getProfilePath(profile));
54
+ }
55
+
56
+ export function listProfiles(): string[] {
57
+ ensureConfigDir();
58
+ if (!existsSync(PROFILES_DIR)) return [];
59
+ return readdirSync(PROFILES_DIR)
60
+ .filter(f => f.endsWith('.json'))
61
+ .map(f => f.replace('.json', ''))
62
+ .sort();
63
+ }
64
+
65
+ export function createProfile(profile: string, config: ProfileConfig = {}): boolean {
66
+ ensureConfigDir();
67
+ if (profileExists(profile)) return false;
68
+ if (!/^[a-zA-Z0-9_-]+$/.test(profile)) {
69
+ throw new Error('Profile name can only contain letters, numbers, hyphens, and underscores');
70
+ }
71
+ writeFileSync(getProfilePath(profile), JSON.stringify(config, null, 2));
72
+ return true;
73
+ }
74
+
75
+ export function deleteProfile(profile: string): boolean {
76
+ if (profile === DEFAULT_PROFILE) return false;
77
+ if (!profileExists(profile)) return false;
78
+ if (getCurrentProfile() === profile) setCurrentProfile(DEFAULT_PROFILE);
79
+ rmSync(getProfilePath(profile));
80
+ return true;
81
+ }
82
+
83
+ export function loadProfile(profile?: string): ProfileConfig {
84
+ ensureConfigDir();
85
+ const profilePath = getProfilePath(profile || getCurrentProfile());
86
+ if (!existsSync(profilePath)) return {};
87
+ try {
88
+ return JSON.parse(readFileSync(profilePath, 'utf-8'));
89
+ } catch {
90
+ return {};
91
+ }
92
+ }
93
+
94
+ export function saveProfile(config: ProfileConfig, profile?: string): void {
95
+ ensureConfigDir();
96
+ writeFileSync(getProfilePath(profile || getCurrentProfile()), JSON.stringify(config, null, 2));
97
+ }
98
+
99
+ export function getApiKey(): string | undefined {
100
+ return process.env.MINIMAX_API_KEY || loadProfile().apiKey;
101
+ }
102
+
103
+ export function setApiKey(apiKey: string): void {
104
+ const config = loadProfile();
105
+ config.apiKey = apiKey;
106
+ saveProfile(config);
107
+ }
108
+
109
+ export function getGroupId(): string | undefined {
110
+ return process.env.MINIMAX_GROUP_ID || loadProfile().groupId;
111
+ }
112
+
113
+ export function setGroupId(groupId: string): void {
114
+ const config = loadProfile();
115
+ config.groupId = groupId;
116
+ saveProfile(config);
117
+ }
118
+
119
+ export function clearConfig(): void {
120
+ saveProfile({});
121
+ }
122
+
123
+ export function getConfigDir(): string {
124
+ return CONFIG_DIR;
125
+ }
@@ -0,0 +1,40 @@
1
+ import chalk from 'chalk';
2
+
3
+ export type OutputFormat = 'json' | 'pretty';
4
+
5
+ export function formatOutput(data: unknown, format: OutputFormat = 'pretty'): string {
6
+ if (format === 'json') return JSON.stringify(data, null, 2);
7
+ return formatPretty(data);
8
+ }
9
+
10
+ function formatPretty(data: unknown, indent = 0): string {
11
+ if (data === null || data === undefined) return chalk.gray('null');
12
+ if (typeof data !== 'object') return String(data);
13
+
14
+ const spaces = ' '.repeat(indent);
15
+ const entries = Object.entries(data as Record<string, unknown>);
16
+
17
+ return entries
18
+ .map(([key, value]) => {
19
+ if (Array.isArray(value)) {
20
+ if (value.length === 0) return `${spaces}${chalk.blue(key)}: ${chalk.gray('[]')}`;
21
+ if (typeof value[0] === 'object') {
22
+ return `${spaces}${chalk.blue(key)}:\n${value.map(v => formatPretty(v, indent + 1)).join('\n')}`;
23
+ }
24
+ return `${spaces}${chalk.blue(key)}: ${value.join(', ')}`;
25
+ }
26
+ if (typeof value === 'object' && value !== null) {
27
+ return `${spaces}${chalk.blue(key)}:\n${formatPretty(value, indent + 1)}`;
28
+ }
29
+ return `${spaces}${chalk.blue(key)}: ${chalk.white(String(value))}`;
30
+ })
31
+ .join('\n');
32
+ }
33
+
34
+ export function success(message: string): void { console.log(chalk.green('✓'), message); }
35
+ export function error(message: string): void { console.error(chalk.red('✗'), message); }
36
+ export function warn(message: string): void { console.warn(chalk.yellow('⚠'), message); }
37
+ export function info(message: string): void { console.log(chalk.blue('ℹ'), message); }
38
+ export function print(data: unknown, format: OutputFormat = 'pretty'): void {
39
+ console.log(formatOutput(data, format));
40
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "rootDir": "./src"
6
+ },
7
+ "include": ["src/**/*.ts"]
8
+ }
package/dist/index.js CHANGED
@@ -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.18",
4972
+ version: "1.3.20",
4973
4973
  description: "Open source connector library - Install API connectors with a single command",
4974
4974
  type: "module",
4975
4975
  bin: {
@@ -16684,6 +16684,13 @@ var connectors = [
16684
16684
  category: "AI & ML",
16685
16685
  tags: ["ai", "llm", "grok"]
16686
16686
  },
16687
+ {
16688
+ name: "minimax",
16689
+ displayName: "Minimax",
16690
+ description: "Video, music, image, TTS, and sound effects generation",
16691
+ category: "AI & ML",
16692
+ tags: ["ai", "video", "music", "tts", "image", "sound-effects"]
16693
+ },
16687
16694
  {
16688
16695
  name: "mistral",
16689
16696
  displayName: "Mistral",
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
  /**
3
3
  * Standalone entry point for the connector auth dashboard server.
4
- * Usage: connectors-serve [--port 19426]
4
+ * Usage: connectors-serve [--port 9876]
5
5
  */
6
6
  export {};
@@ -9,4 +9,5 @@ export interface ServeOptions {
9
9
  }
10
10
  export declare function startServer(requestedPort: number, options?: {
11
11
  open?: boolean;
12
+ strict?: boolean;
12
13
  }): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/connectors",
3
- "version": "1.3.18",
3
+ "version": "1.3.20",
4
4
  "description": "Open source connector library - Install API connectors with a single command",
5
5
  "type": "module",
6
6
  "bin": {