ai-yuca 1.0.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.
Files changed (62) hide show
  1. package/.eslintrc.js +25 -0
  2. package/CONFIG_UPLOAD.md +154 -0
  3. package/CONTRIBUTING.md +58 -0
  4. package/INSTALLATION.md +192 -0
  5. package/README.md +80 -0
  6. package/bin/cli.js +85 -0
  7. package/bin/cli.ts +302 -0
  8. package/dist/bin/cli.d.ts +2 -0
  9. package/dist/bin/cli.js +297 -0
  10. package/dist/package.json +51 -0
  11. package/dist/src/config.d.ts +56 -0
  12. package/dist/src/config.js +101 -0
  13. package/dist/src/download.d.ts +30 -0
  14. package/dist/src/download.js +214 -0
  15. package/dist/src/index.d.ts +18 -0
  16. package/dist/src/index.js +126 -0
  17. package/dist/src/types/analyze.d.ts +33 -0
  18. package/dist/src/types/analyze.js +5 -0
  19. package/dist/src/types/download.d.ts +60 -0
  20. package/dist/src/types/download.js +2 -0
  21. package/dist/src/types/index.d.ts +8 -0
  22. package/dist/src/types/index.js +28 -0
  23. package/dist/src/types/upload.d.ts +89 -0
  24. package/dist/src/types/upload.js +2 -0
  25. package/dist/src/upload.d.ts +24 -0
  26. package/dist/src/upload.js +252 -0
  27. package/dist/src/uploadWithConfig.d.ts +34 -0
  28. package/dist/src/uploadWithConfig.js +82 -0
  29. package/dist/src/utils/compression.d.ts +16 -0
  30. package/dist/src/utils/compression.js +85 -0
  31. package/dist/test/compression.test.d.ts +1 -0
  32. package/dist/test/compression.test.js +109 -0
  33. package/dist/test/download.test.d.ts +1 -0
  34. package/dist/test/download.test.js +168 -0
  35. package/dist/test/index.test.d.ts +1 -0
  36. package/dist/test/index.test.js +33 -0
  37. package/dist/test/upload.test.d.ts +1 -0
  38. package/dist/test/upload.test.js +140 -0
  39. package/docs/usage.md +223 -0
  40. package/examples/sample.txt +7 -0
  41. package/examples/upload-example.js +53 -0
  42. package/out/test.txt +1 -0
  43. package/package.json +51 -0
  44. package/src/config.ts +104 -0
  45. package/src/download.ts +216 -0
  46. package/src/index.js +88 -0
  47. package/src/index.ts +98 -0
  48. package/src/types/analyze.ts +37 -0
  49. package/src/types/download.ts +67 -0
  50. package/src/types/index.ts +16 -0
  51. package/src/types/upload.ts +97 -0
  52. package/src/upload.js +197 -0
  53. package/src/upload.ts +254 -0
  54. package/src/uploadWithConfig.ts +122 -0
  55. package/src/utils/compression.ts +61 -0
  56. package/test/compression.test.ts +88 -0
  57. package/test/download.test.ts +162 -0
  58. package/test/index.test.js +38 -0
  59. package/test/index.test.ts +39 -0
  60. package/test/upload.test.ts +131 -0
  61. package/tsconfig.json +17 -0
  62. package/vs.config.json +42 -0
@@ -0,0 +1,56 @@
1
+ /**
2
+ * 配置文件接口
3
+ */
4
+ export interface VSConfig {
5
+ upload: {
6
+ uploadPath: string;
7
+ s3Static: string;
8
+ };
9
+ aws: {
10
+ Bucket: string;
11
+ prefix: string;
12
+ Region: string;
13
+ HostName: string;
14
+ };
15
+ deploy?: {
16
+ baseUrl: string[];
17
+ host: string;
18
+ testHost: string;
19
+ };
20
+ crowdin?: {
21
+ project: string;
22
+ langMap: string[];
23
+ workDir: string;
24
+ reg: string;
25
+ keysDir: string;
26
+ Bucket: string;
27
+ prefix: string;
28
+ Region: string;
29
+ FromIni: string;
30
+ HostName: string;
31
+ };
32
+ }
33
+ /**
34
+ * 读取配置文件
35
+ * @param configPath - 配置文件路径,默认为项目根目录下的vs.config.json
36
+ * @returns 配置对象
37
+ */
38
+ export declare function loadConfig(configPath?: string): VSConfig;
39
+ /**
40
+ * 获取上传桶名称
41
+ * @param config - 配置对象
42
+ * @returns 桶名称
43
+ */
44
+ export declare function getBucketName(config: VSConfig): string;
45
+ /**
46
+ * 获取上传目标路径
47
+ * @param config - 配置对象
48
+ * @returns 目标路径
49
+ */
50
+ export declare function getUploadDestination(config: VSConfig): string;
51
+ /**
52
+ * 获取本地上传源路径
53
+ * @param config - 配置对象
54
+ * @returns 本地源路径
55
+ */
56
+ export declare function getUploadSourcePath(config: VSConfig): string;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.loadConfig = loadConfig;
37
+ exports.getBucketName = getBucketName;
38
+ exports.getUploadDestination = getUploadDestination;
39
+ exports.getUploadSourcePath = getUploadSourcePath;
40
+ /**
41
+ * 配置文件读取模块
42
+ */
43
+ const fs = __importStar(require("fs"));
44
+ const path = __importStar(require("path"));
45
+ /**
46
+ * 读取配置文件
47
+ * @param configPath - 配置文件路径,默认为项目根目录下的vs.config.json
48
+ * @returns 配置对象
49
+ */
50
+ function loadConfig(configPath) {
51
+ const defaultConfigPath = path.join(process.cwd(), 'vs.config.json');
52
+ const finalConfigPath = configPath || defaultConfigPath;
53
+ if (!fs.existsSync(finalConfigPath)) {
54
+ throw new Error(`配置文件不存在: ${finalConfigPath}`);
55
+ }
56
+ try {
57
+ const configContent = fs.readFileSync(finalConfigPath, 'utf-8');
58
+ const config = JSON.parse(configContent);
59
+ // 验证必要的配置项
60
+ if (!config.upload || !config.aws) {
61
+ throw new Error('配置文件缺少必要的upload或aws配置项');
62
+ }
63
+ if (!config.upload.uploadPath || !config.upload.s3Static) {
64
+ throw new Error('配置文件缺少必要的upload.uploadPath或upload.s3Static配置项');
65
+ }
66
+ if (!config.aws.Bucket || !config.aws.prefix) {
67
+ throw new Error('配置文件缺少必要的aws.Bucket或aws.prefix配置项');
68
+ }
69
+ return config;
70
+ }
71
+ catch (error) {
72
+ if (error instanceof SyntaxError) {
73
+ throw new Error(`配置文件格式错误: ${error.message}`);
74
+ }
75
+ throw error;
76
+ }
77
+ }
78
+ /**
79
+ * 获取上传桶名称
80
+ * @param config - 配置对象
81
+ * @returns 桶名称
82
+ */
83
+ function getBucketName(config) {
84
+ return config.aws.Bucket;
85
+ }
86
+ /**
87
+ * 获取上传目标路径
88
+ * @param config - 配置对象
89
+ * @returns 目标路径
90
+ */
91
+ function getUploadDestination(config) {
92
+ return `${config.aws.prefix}/${config.upload.s3Static}`;
93
+ }
94
+ /**
95
+ * 获取本地上传源路径
96
+ * @param config - 配置对象
97
+ * @returns 本地源路径
98
+ */
99
+ function getUploadSourcePath(config) {
100
+ return path.join(process.cwd(), config.upload.uploadPath);
101
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * GCP下载功能模块
3
+ */
4
+ import { Storage } from '@google-cloud/storage';
5
+ import { DownloadFileOptions, DownloadFilesOptions, DownloadResult, DownloadFilesResult } from './types/download';
6
+ import { StorageClientOptions } from './types/upload';
7
+ /**
8
+ * 创建GCP存储客户端
9
+ * @param options - 配置选项
10
+ * @returns GCP存储客户端实例
11
+ */
12
+ declare function createStorageClient(options?: Partial<StorageClientOptions>): Storage;
13
+ /**
14
+ * 确保目录存在,如果不存在则创建
15
+ * @param dirPath - 目录路径
16
+ */
17
+ declare function ensureDirectoryExists(dirPath: string): Promise<void>;
18
+ /**
19
+ * 下载单个文件从GCP存储桶
20
+ * @param options - 下载选项
21
+ * @returns 下载结果
22
+ */
23
+ declare function downloadFile(options: DownloadFileOptions): Promise<DownloadResult>;
24
+ /**
25
+ * 批量下载文件从GCP存储桶
26
+ * @param options - 下载选项
27
+ * @returns 下载结果
28
+ */
29
+ declare function downloadFiles(options: DownloadFilesOptions): Promise<DownloadFilesResult>;
30
+ export { createStorageClient, downloadFile, downloadFiles, ensureDirectoryExists };
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.createStorageClient = createStorageClient;
37
+ exports.downloadFile = downloadFile;
38
+ exports.downloadFiles = downloadFiles;
39
+ exports.ensureDirectoryExists = ensureDirectoryExists;
40
+ /**
41
+ * GCP下载功能模块
42
+ */
43
+ const storage_1 = require("@google-cloud/storage");
44
+ const fs = __importStar(require("fs"));
45
+ const path = __importStar(require("path"));
46
+ const util = __importStar(require("util"));
47
+ const mkdir = util.promisify(fs.mkdir);
48
+ /**
49
+ * 创建GCP存储客户端
50
+ * @param options - 配置选项
51
+ * @returns GCP存储客户端实例
52
+ */
53
+ function createStorageClient(options = {}) {
54
+ const { keyFilename, projectId, credentials } = options;
55
+ // 如果提供了keyFilename,使用密钥文件认证
56
+ if (keyFilename) {
57
+ return new storage_1.Storage({
58
+ keyFilename
59
+ });
60
+ }
61
+ // 如果提供了credentials,使用凭证对象认证
62
+ if (credentials) {
63
+ return new storage_1.Storage({
64
+ projectId,
65
+ credentials
66
+ });
67
+ }
68
+ // 使用应用默认凭证(ADC)进行免密认证
69
+ return new storage_1.Storage();
70
+ }
71
+ /**
72
+ * 确保目录存在,如果不存在则创建
73
+ * @param dirPath - 目录路径
74
+ */
75
+ async function ensureDirectoryExists(dirPath) {
76
+ try {
77
+ if (!fs.existsSync(dirPath)) {
78
+ await mkdir(dirPath, { recursive: true });
79
+ }
80
+ }
81
+ catch (error) {
82
+ throw new Error(`创建目录失败: ${error instanceof Error ? error.message : String(error)}`);
83
+ }
84
+ }
85
+ /**
86
+ * 下载单个文件从GCP存储桶
87
+ * @param options - 下载选项
88
+ * @returns 下载结果
89
+ */
90
+ async function downloadFile(options) {
91
+ const { bucketName, sourcePath, destinationPath, storageClient } = options;
92
+ if (!bucketName || !sourcePath || !destinationPath || !storageClient) {
93
+ throw new Error('缺少必要的下载参数');
94
+ }
95
+ try {
96
+ // 获取存储桶
97
+ const bucket = storageClient.bucket(bucketName);
98
+ const file = bucket.file(sourcePath);
99
+ // 检查文件是否存在
100
+ const [exists] = await file.exists();
101
+ if (!exists) {
102
+ throw new Error(`文件不存在: ${sourcePath}`);
103
+ }
104
+ // 确保目标目录存在
105
+ const destDir = path.dirname(destinationPath);
106
+ await ensureDirectoryExists(destDir);
107
+ // 下载文件
108
+ await file.download({
109
+ destination: destinationPath
110
+ });
111
+ return {
112
+ success: true,
113
+ file: sourcePath,
114
+ localPath: destinationPath
115
+ };
116
+ }
117
+ catch (error) {
118
+ return {
119
+ success: false,
120
+ file: sourcePath,
121
+ error: error instanceof Error ? error.message : String(error)
122
+ };
123
+ }
124
+ }
125
+ /**
126
+ * 列出存储桶中的文件和目录
127
+ * @param bucket - 存储桶
128
+ * @param prefix - 前缀路径
129
+ * @returns 文件和目录列表
130
+ */
131
+ async function listFiles(bucket, prefix = '') {
132
+ try {
133
+ const options = {
134
+ prefix: prefix,
135
+ delimiter: '/'
136
+ };
137
+ const [files, , apiResponse] = await bucket.getFiles(options);
138
+ // 获取文件路径
139
+ const filePaths = files.map(file => file.name);
140
+ // 获取目录前缀
141
+ const prefixes = apiResponse && typeof apiResponse === 'object' && 'prefixes' in apiResponse
142
+ ? (apiResponse.prefixes || [])
143
+ : [];
144
+ return [...filePaths, ...prefixes];
145
+ }
146
+ catch (error) {
147
+ throw new Error(`列出文件失败: ${error instanceof Error ? error.message : String(error)}`);
148
+ }
149
+ }
150
+ /**
151
+ * 批量下载文件从GCP存储桶
152
+ * @param options - 下载选项
153
+ * @returns 下载结果
154
+ */
155
+ async function downloadFiles(options) {
156
+ const { bucketName, sourcePath, destinationPath, storageClient, recursive = false } = options;
157
+ if (!bucketName || !sourcePath || !destinationPath || !storageClient) {
158
+ throw new Error('缺少必要的下载参数');
159
+ }
160
+ const results = {
161
+ success: [],
162
+ failed: []
163
+ };
164
+ try {
165
+ // 获取存储桶
166
+ const bucket = storageClient.bucket(bucketName);
167
+ // 确保目标目录存在
168
+ await ensureDirectoryExists(destinationPath);
169
+ // 列出源路径下的所有文件
170
+ const files = await listFiles(bucket, sourcePath);
171
+ for (const file of files) {
172
+ // 如果是目录(以/结尾)
173
+ if (file.endsWith('/')) {
174
+ if (recursive) {
175
+ // 递归下载子目录
176
+ const subSourcePath = file;
177
+ const subDestinationPath = path.join(destinationPath, path.basename(file));
178
+ const subResults = await downloadFiles({
179
+ bucketName,
180
+ sourcePath: subSourcePath,
181
+ destinationPath: subDestinationPath,
182
+ storageClient,
183
+ recursive
184
+ });
185
+ results.success = results.success.concat(subResults.success);
186
+ results.failed = results.failed.concat(subResults.failed);
187
+ }
188
+ }
189
+ else {
190
+ // 下载文件
191
+ const relativePath = file.startsWith(sourcePath)
192
+ ? file.substring(sourcePath.length)
193
+ : file;
194
+ const destFilePath = path.join(destinationPath, relativePath);
195
+ const result = await downloadFile({
196
+ bucketName,
197
+ sourcePath: file,
198
+ destinationPath: destFilePath,
199
+ storageClient
200
+ });
201
+ if (result.success) {
202
+ results.success.push(result);
203
+ }
204
+ else {
205
+ results.failed.push(result);
206
+ }
207
+ }
208
+ }
209
+ return results;
210
+ }
211
+ catch (error) {
212
+ throw new Error(`下载文件失败: ${error instanceof Error ? error.message : String(error)}`);
213
+ }
214
+ }
@@ -0,0 +1,18 @@
1
+ import { AnalyzeOptions, AnalysisResult } from './types/analyze';
2
+ /**
3
+ * 分析文本内容
4
+ * @param options - 分析选项
5
+ * @returns 分析结果
6
+ */
7
+ declare function analyze(options: AnalyzeOptions): AnalysisResult;
8
+ /**
9
+ * 分析文本内容的核心功能
10
+ * @param content - 要分析的文本内容
11
+ * @returns 分析结果
12
+ */
13
+ declare function analyzeContent(content: string): AnalysisResult;
14
+ export { analyze, analyzeContent };
15
+ export { createStorageClient, uploadFile, uploadFiles } from './upload';
16
+ export { downloadFiles } from './download';
17
+ export { uploadFilesWithConfig, getConfigSummary } from './uploadWithConfig';
18
+ export { loadConfig, getBucketName, getUploadDestination, getUploadSourcePath } from './config';
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.getUploadSourcePath = exports.getUploadDestination = exports.getBucketName = exports.loadConfig = exports.getConfigSummary = exports.uploadFilesWithConfig = exports.downloadFiles = exports.uploadFiles = exports.uploadFile = exports.createStorageClient = void 0;
37
+ exports.analyze = analyze;
38
+ exports.analyzeContent = analyzeContent;
39
+ /**
40
+ * AI-Yuca 核心功能模块
41
+ */
42
+ const fs = __importStar(require("fs"));
43
+ /**
44
+ * 分析文本内容
45
+ * @param options - 分析选项
46
+ * @returns 分析结果
47
+ */
48
+ function analyze(options) {
49
+ const { file, text } = options;
50
+ if (!file && !text) {
51
+ console.error('错误: 必须提供文件路径或文本内容');
52
+ process.exit(1);
53
+ }
54
+ let content = '';
55
+ if (file) {
56
+ try {
57
+ content = fs.readFileSync(file, 'utf8');
58
+ }
59
+ catch (err) {
60
+ console.error(`错误: 无法读取文件 ${file}`);
61
+ if (err instanceof Error) {
62
+ console.error(err.message);
63
+ }
64
+ process.exit(1);
65
+ }
66
+ }
67
+ else if (text) {
68
+ content = text;
69
+ }
70
+ // 执行分析
71
+ const result = analyzeContent(content);
72
+ // 输出结果
73
+ console.log('分析结果:');
74
+ console.log(JSON.stringify(result, null, 2));
75
+ return result;
76
+ }
77
+ /**
78
+ * 分析文本内容的核心功能
79
+ * @param content - 要分析的文本内容
80
+ * @returns 分析结果
81
+ */
82
+ function analyzeContent(content) {
83
+ var _a;
84
+ // 基本统计
85
+ const charCount = content.length;
86
+ // 改进的单词计数,同时支持英文和中文
87
+ const wordCount = ((_a = content.match(/[\w\u4e00-\u9fa5]+/g)) === null || _a === void 0 ? void 0 : _a.length) || 0;
88
+ const lineCount = content.split('\n').length;
89
+ // 关键词提取 (简单实现)
90
+ const words = content.toLowerCase()
91
+ .replace(/[^\w\s]/g, '')
92
+ .split(/\s+/)
93
+ .filter(word => word.length > 3);
94
+ const wordFrequency = {};
95
+ words.forEach(word => {
96
+ wordFrequency[word] = (wordFrequency[word] || 0) + 1;
97
+ });
98
+ // 获取前5个最常见的词
99
+ const topKeywords = Object.entries(wordFrequency)
100
+ .sort((a, b) => b[1] - a[1])
101
+ .slice(0, 5)
102
+ .map(([word, count]) => ({ word, count }));
103
+ return {
104
+ statistics: {
105
+ charCount,
106
+ wordCount,
107
+ lineCount
108
+ },
109
+ keywords: topKeywords,
110
+ summary: `文本包含 ${charCount} 个字符, ${wordCount} 个单词, ${lineCount} 行。`
111
+ };
112
+ }
113
+ var upload_1 = require("./upload");
114
+ Object.defineProperty(exports, "createStorageClient", { enumerable: true, get: function () { return upload_1.createStorageClient; } });
115
+ Object.defineProperty(exports, "uploadFile", { enumerable: true, get: function () { return upload_1.uploadFile; } });
116
+ Object.defineProperty(exports, "uploadFiles", { enumerable: true, get: function () { return upload_1.uploadFiles; } });
117
+ var download_1 = require("./download");
118
+ Object.defineProperty(exports, "downloadFiles", { enumerable: true, get: function () { return download_1.downloadFiles; } });
119
+ var uploadWithConfig_1 = require("./uploadWithConfig");
120
+ Object.defineProperty(exports, "uploadFilesWithConfig", { enumerable: true, get: function () { return uploadWithConfig_1.uploadFilesWithConfig; } });
121
+ Object.defineProperty(exports, "getConfigSummary", { enumerable: true, get: function () { return uploadWithConfig_1.getConfigSummary; } });
122
+ var config_1 = require("./config");
123
+ Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return config_1.loadConfig; } });
124
+ Object.defineProperty(exports, "getBucketName", { enumerable: true, get: function () { return config_1.getBucketName; } });
125
+ Object.defineProperty(exports, "getUploadDestination", { enumerable: true, get: function () { return config_1.getUploadDestination; } });
126
+ Object.defineProperty(exports, "getUploadSourcePath", { enumerable: true, get: function () { return config_1.getUploadSourcePath; } });
@@ -0,0 +1,33 @@
1
+ /**
2
+ * 分析功能相关类型定义
3
+ */
4
+ /**
5
+ * 分析选项接口
6
+ */
7
+ export interface AnalyzeOptions {
8
+ file?: string;
9
+ text?: string;
10
+ }
11
+ /**
12
+ * 分析结果统计接口
13
+ */
14
+ export interface Statistics {
15
+ charCount: number;
16
+ wordCount: number;
17
+ lineCount: number;
18
+ }
19
+ /**
20
+ * 关键词接口
21
+ */
22
+ export interface Keyword {
23
+ word: string;
24
+ count: number;
25
+ }
26
+ /**
27
+ * 分析结果接口
28
+ */
29
+ export interface AnalysisResult {
30
+ statistics: Statistics;
31
+ keywords: Keyword[];
32
+ summary: string;
33
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * 分析功能相关类型定义
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,60 @@
1
+ /**
2
+ * 下载功能相关类型定义
3
+ */
4
+ import { Storage } from '@google-cloud/storage';
5
+ /**
6
+ * 下载选项接口
7
+ */
8
+ export interface DownloadFileOptions {
9
+ bucketName: string;
10
+ sourcePath: string;
11
+ destinationPath: string;
12
+ storageClient: Storage;
13
+ }
14
+ /**
15
+ * 批量下载选项接口
16
+ */
17
+ export interface DownloadFilesOptions {
18
+ bucketName: string;
19
+ sourcePath: string;
20
+ destinationPath: string;
21
+ storageClient: Storage;
22
+ recursive?: boolean;
23
+ }
24
+ /**
25
+ * 下载成功结果接口
26
+ */
27
+ export interface DownloadSuccessResult {
28
+ success: true;
29
+ file: string;
30
+ localPath: string;
31
+ }
32
+ /**
33
+ * 下载失败结果接口
34
+ */
35
+ export interface DownloadFailedResult {
36
+ success: false;
37
+ file: string;
38
+ error: string;
39
+ }
40
+ /**
41
+ * 下载结果类型
42
+ */
43
+ export type DownloadResult = DownloadSuccessResult | DownloadFailedResult;
44
+ /**
45
+ * 批量下载结果接口
46
+ */
47
+ export interface DownloadFilesResult {
48
+ success: DownloadSuccessResult[];
49
+ failed: DownloadFailedResult[];
50
+ }
51
+ /**
52
+ * CLI下载命令选项接口
53
+ */
54
+ export interface DownloadCommandOptions {
55
+ source: string;
56
+ bucket: string;
57
+ destination: string;
58
+ keyFile?: string;
59
+ recursive: boolean;
60
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 类型定义索引文件
3
+ */
4
+ export * from './upload';
5
+ export * from './download';
6
+ export * from '../config';
7
+ export * from '../uploadWithConfig';
8
+ export * from './analyze';
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * 类型定义索引文件
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ // 导出所有上传相关类型
21
+ __exportStar(require("./upload"), exports);
22
+ // 导出所有下载相关类型
23
+ __exportStar(require("./download"), exports);
24
+ // 导出所有配置相关类型
25
+ __exportStar(require("../config"), exports);
26
+ __exportStar(require("../uploadWithConfig"), exports);
27
+ // 导出所有分析相关类型
28
+ __exportStar(require("./analyze"), exports);