@kevisual/oss 0.0.11 → 0.0.13

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.
@@ -1,32 +1,190 @@
1
- import * as minio_dist_esm_internal_type_mjs from 'minio/dist/esm/internal/type.mjs';
2
- import { O as OssBase, e as OssService, a as OssBaseOptions, L as ListFileObject, c as ListObjectResult } from '../index-BGsBfWH-.js';
3
- import 'minio';
4
- import 'stream';
1
+ // Generated by dts-bundle-generator v9.5.1
5
2
 
6
- declare class ConfigOssService extends OssBase implements OssService {
7
- owner: string;
8
- constructor(opts: OssBaseOptions<{
9
- owner: string;
10
- }>);
11
- listAllFile(): Promise<ListFileObject[]>;
12
- listAll(): Promise<ListObjectResult[]>;
13
- configMap: Map<string, any>;
14
- keys: string[];
15
- getAllConfigJson(): Promise<ListFileObject[]>;
16
- isEndWithJson(string: string): boolean;
17
- putJsonObject(key: string, data: any): Promise<minio_dist_esm_internal_type_mjs.UploadedObjectInfo>;
18
- getObjectList(objectNameList: string[]): Promise<Map<string, Record<string, any>>>;
19
- getList(): Promise<{
20
- list: {
21
- key: string;
22
- name: string;
23
- size: number;
24
- lastModified: Date;
25
- etag: string;
26
- }[];
27
- keys: string[];
28
- keyEtagMap: Map<string, string>;
29
- }>;
3
+ import { Client, ItemBucketMetadata } from 'minio';
4
+
5
+ export type UploadedObjectInfo = {
6
+ etag: string;
7
+ lastModified?: Date;
8
+ size?: number;
9
+ versionId: string;
10
+ metadata?: ItemBucketMetadata;
11
+ };
12
+ export type StatObjectResult = {
13
+ size: number;
14
+ etag: string;
15
+ lastModified: Date;
16
+ metaData: ItemBucketMetadata;
17
+ versionId?: string | null;
18
+ };
19
+ export type ListFileObject = {
20
+ name: string;
21
+ size: number;
22
+ lastModified: Date;
23
+ etag: string;
24
+ };
25
+ export type ListDirectoryObject = {
26
+ prefix: string;
27
+ size: number;
28
+ };
29
+ export type ListObjectResult = ListFileObject | ListDirectoryObject;
30
+ export interface OssBaseOperation {
31
+ prefix: string;
32
+ setPrefix(prefix: string): void;
33
+ /**
34
+ * 获取对象
35
+ * @param objectName 对象名
36
+ */
37
+ getObject(objectName: string): Promise<any>;
38
+ /**
39
+ * 上传对象
40
+ * @param objectName 对象名
41
+ * @param data 数据
42
+ */
43
+ putObject(objectName: string, data: Buffer | string, metaData?: ItemBucketMetadata): Promise<UploadedObjectInfo>;
44
+ /**
45
+ * 上传文件
46
+ * @param objectName 对象名
47
+ * @param filePath 文件路径
48
+ */
49
+ fPutObject(objectName: string, filePath: string, metaData?: ItemBucketMetadata): Promise<UploadedObjectInfo>;
50
+ /**
51
+ * 获取对象信息
52
+ * @param objectName 对象名
53
+ */
54
+ statObject(objectName: string): Promise<StatObjectResult>;
55
+ /**
56
+ * 删除对象
57
+ * @param objectName 对象名
58
+ */
59
+ deleteObject(objectName: string): Promise<any>;
60
+ /**
61
+ * 列出对象
62
+ * @param objectName 对象名
63
+ * @param opts 选项
64
+ * @param opts.recursive 是否递归
65
+ * @param opts.startAfter 开始位置
66
+ */
67
+ listObjects(objectName: string, opts?: {
68
+ /**
69
+ * 是否递归
70
+ */
71
+ recursive?: boolean;
72
+ /**
73
+ * 开始位置
74
+ */
75
+ startAfter?: string;
76
+ }): Promise<ListObjectResult[]>;
77
+ /**
78
+ * 复制对象
79
+ * @param sourceObject 源对象
80
+ * @param targetObject 目标对象
81
+ */
82
+ copyObject: Client["copyObject"];
83
+ }
84
+ export interface OssService extends OssBaseOperation {
85
+ owner: string;
86
+ }
87
+ export type OssBaseOptions<T = {
88
+ [key: string]: any;
89
+ }> = {
90
+ /**
91
+ * 已经初始化好的minio client
92
+ */
93
+ client: Client;
94
+ /**
95
+ * 桶名
96
+ */
97
+ bucketName: string;
98
+ /**
99
+ * 前缀
100
+ */
101
+ prefix?: string;
102
+ } & T;
103
+ declare class OssBase implements OssBaseOperation {
104
+ client?: Client;
105
+ bucketName: string;
106
+ prefix: string;
107
+ /**
108
+ * 计算字符串或者对象的的md5值
109
+ */
110
+ hash: (str: string | Buffer | Object) => string;
111
+ constructor(opts: OssBaseOptions);
112
+ setPrefix(prefix: string): void;
113
+ getObject(objectName: string): Promise<import("stream").Readable>;
114
+ getJson(objectName: string): Promise<Record<string, any>>;
115
+ /**
116
+ * 上传文件, 当是流的时候,中断之后的etag会变,所以传递的时候不要嵌套async await,例如 busboy 监听文件流内部的时候,不要用check
117
+ * @param objectName
118
+ * @param data
119
+ * @param metaData
120
+ * @param options 如果文件本身存在,则复制原有的meta的内容
121
+ * @returns
122
+ */
123
+ putObject(objectName: string, data: Buffer | string | Object, metaData?: ItemBucketMetadata, opts?: {
124
+ check?: boolean;
125
+ isStream?: boolean;
126
+ size?: number;
127
+ }): Promise<import("node_modules/minio/dist/main/internal/type.js").UploadedObjectInfo>;
128
+ deleteObject(objectName: string): Promise<void>;
129
+ listObjects<IS_FILE = false>(objectName: string, opts?: {
130
+ recursive?: boolean;
131
+ startAfter?: string;
132
+ }): Promise<IS_FILE extends true ? ListFileObject[] : ListObjectResult[]>;
133
+ fPutObject(objectName: string, filePath: string, metaData?: ItemBucketMetadata): Promise<any>;
134
+ /**
135
+ * 获取完整的对象名称
136
+ * @param objectName
137
+ * @returns
138
+ */
139
+ getObjectName(objectName: string): Promise<string>;
140
+ statObject(objectName: string, checkFile?: boolean): Promise<import("minio").BucketItemStat>;
141
+ /**
142
+ * 检查文件hash是否一致
143
+ * @param objectName
144
+ * @param hash
145
+ * @returns
146
+ */
147
+ checkObjectHash(objectName: string, hash: string, meta?: ItemBucketMetadata): Promise<{
148
+ success: boolean;
149
+ metaData: ItemBucketMetadata | null;
150
+ obj: any;
151
+ equalMeta?: boolean;
152
+ }>;
153
+ getMetadata(pathname: string, meta?: ItemBucketMetadata): ItemBucketMetadata;
154
+ copyObject(sourceObject: any, targetObject: any): Promise<import("node_modules/minio/dist/main/internal/type.js").CopyObjectResult>;
155
+ replaceObject(objectName: string, meta: {
156
+ [key: string]: string;
157
+ }): Promise<import("node_modules/minio/dist/main/internal/type.js").CopyObjectResult>;
158
+ static create<T extends OssBase, U>(this: new (opts: OssBaseOptions<U>) => T, opts: OssBaseOptions<U>): T;
159
+ static fromBase<T extends OssBase, U>(this: new (opts: OssBaseOptions<U>) => T, createOpts: {
160
+ oss: OssBase;
161
+ opts: Partial<OssBaseOptions<U>>;
162
+ }): T;
163
+ }
164
+ export declare class ConfigOssService extends OssBase implements OssService {
165
+ owner: string;
166
+ constructor(opts: OssBaseOptions<{
167
+ owner: string;
168
+ }>);
169
+ listAllFile(): Promise<ListFileObject[]>;
170
+ listAll(): Promise<ListObjectResult[]>;
171
+ configMap: Map<string, any>;
172
+ keys: string[];
173
+ getAllConfigJson(): Promise<ListFileObject[]>;
174
+ isEndWithJson(string: string): boolean;
175
+ putJsonObject(key: string, data: any): Promise<import("node_modules/minio/dist/main/internal/type.js").UploadedObjectInfo>;
176
+ getObjectList(objectNameList: string[]): Promise<Map<string, Record<string, any>>>;
177
+ getList(): Promise<{
178
+ list: {
179
+ key: string;
180
+ name: string;
181
+ size: number;
182
+ lastModified: Date;
183
+ etag: string;
184
+ }[];
185
+ keys: string[];
186
+ keyEtagMap: Map<string, string>;
187
+ }>;
30
188
  }
31
189
 
32
- export { ConfigOssService };
190
+ export {};