@xiaou66/picture-plugin 0.0.5 → 0.0.7
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/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +25 -3
- package/dist/index.es.js.map +1 -1
- package/dist/storage/StoragePlugIn.d.ts +42 -3
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(e){return{...e,plugInType:"storage"}}class n{constructor(){}readConfig(t){const o=`storageSource/${t}`;return utools.dbCryptoStorage.getItem(o)}init(){this.doInit()}destroy(){this.doDestroy()}async uploadFile(t){return await this.doUploadFile(t)}}exports.StoragePlugIn=n;exports.createStoragePlugInConfig=r;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/storage/StoragePlugInConfig.ts"],"sourcesContent":["export interface StorageUIFormElement {\n type: 'input';\n\n formItem: {\n rules?: Record<string, any>;\n field: string;\n label: string;\n },\n\n /**\n * 元素属性值\n */\n elementProperty: Record<string, any>;\n}\n\nexport interface StorageUIConfig {\n /**\n * 提示\n */\n tips: string,\n\n /**\n * 表单\n */\n forms: StorageUIFormElement[];\n}\n\nexport interface StoragePlugInConfig {\n /**\n * 插件 code 全局唯一\n */\n pluginCode: string;\n /**\n * 插件名称\n */\n pluginName: string;\n\n /**\n * 插件版本\n */\n pluginVersion: string;\n\n /**\n * 插件作者\n */\n pluginAuthor: string;\n\n /**\n * 插件描述\n */\n pluginDesc: string;\n\n /**\n * 插件类型\n */\n plugInType: 'storage';\n\n /**\n * 插件 logo\n */\n plugInLogo: string;\n\n /**\n * 配置 ui\n */\n uiConfig?: StorageUIConfig;\n}\n\n/**\n * 场景插件配置\n * @param config\n */\nexport function createStoragePlugInConfig(config: Omit<StoragePlugInConfig, 'plugInType'>): StoragePlugInConfig {\n return {\n ...config,\n plugInType: 'storage',\n };\n}\n"],"names":["createStoragePlugInConfig","config"],"mappings":"gFAwEO,SAASA,EAA0BC,EAAsE,CACvG,MAAA,CACL,GAAGA,EACH,WAAY,SACd,CACF"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/storage/StoragePlugInConfig.ts","../src/storage/StoragePlugIn.ts"],"sourcesContent":["export interface StorageUIFormElement {\n type: 'input';\n\n formItem: {\n rules?: Record<string, any>;\n field: string;\n label: string;\n },\n\n /**\n * 元素属性值\n */\n elementProperty: Record<string, any>;\n}\n\nexport interface StorageUIConfig {\n /**\n * 提示\n */\n tips: string,\n\n /**\n * 表单\n */\n forms: StorageUIFormElement[];\n}\n\nexport interface StoragePlugInConfig {\n /**\n * 插件 code 全局唯一\n */\n pluginCode: string;\n /**\n * 插件名称\n */\n pluginName: string;\n\n /**\n * 插件版本\n */\n pluginVersion: string;\n\n /**\n * 插件作者\n */\n pluginAuthor: string;\n\n /**\n * 插件描述\n */\n pluginDesc: string;\n\n /**\n * 插件类型\n */\n plugInType: 'storage';\n\n /**\n * 插件 logo\n */\n plugInLogo: string;\n\n /**\n * 配置 ui\n */\n uiConfig?: StorageUIConfig;\n}\n\n/**\n * 场景插件配置\n * @param config\n */\nexport function createStoragePlugInConfig(config: Omit<StoragePlugInConfig, 'plugInType'>): StoragePlugInConfig {\n return {\n ...config,\n plugInType: 'storage',\n };\n}\n","export interface IUploadFileResult {\n /**\n * 上传后文件访问地址\n */\n url: string;\n\n /**\n * 额外数据\n */\n extra: any;\n}\n\nexport interface IUploadFileParams {\n /**\n * 上传 id\n */\n readonly id: string;\n\n /**\n * 配置 id\n */\n readonly storageId: string;\n\n /**\n * 文件路径\n */\n readonly filePath: string;\n\n /**\n * 文件名称\n */\n readonly fileName: string;\n\n /**\n * 文件大小\n */\n readonly fileSize: number;\n\n /**\n * 文件\n */\n readonly file: File;\n}\n\n/**\n * 插件接口\n */\ninterface IStoragePlugIn<C = any> {\n\n /**\n * 插件初始化调用\n */\n init(): void;\n\n /**\n * 读取配置\n * @param storageId\n */\n readConfig(storageId: string): C;\n\n /**\n * 上传文件\n * @param params 参数\n */\n uploadFile(params: IUploadFileParams): Promise<IUploadFileResult>;\n\n /**\n * 插件销毁调用\n */\n destroy(): void;\n}\n\n/**\n * 存储插件\n */\nexport abstract class StoragePlugIn<C = any> implements IStoragePlugIn<C> {\n constructor() {}\n\n readConfig(storageId: string): C {\n const key = `storageSource/${storageId}`\n return utools.dbCryptoStorage.getItem(key)\n }\n\n init() {\n this.doInit();\n }\n\n /**\n * 初始化使用 <br/>\n * constructor 方法之后调用, 在第一次使用前调用\n * @protected\n */\n protected abstract doInit(): void;\n\n destroy() {\n this.doDestroy()\n }\n\n /**\n * 插件销毁调用, 用于销毁资源\n * @protected\n */\n protected abstract doDestroy(): void\n\n /**\n * 上传文件\n * @param params 参数\n */\n async uploadFile(params: IUploadFileParams): Promise<IUploadFileResult> {\n return await this.doUploadFile(params);\n }\n\n /**\n * 上传文件\n * @param params 参数\n */\n abstract doUploadFile(params: IUploadFileParams): Promise<IUploadFileResult>;\n}\n"],"names":["createStoragePlugInConfig","config","StoragePlugIn","storageId","key","params"],"mappings":"gFAwEO,SAASA,EAA0BC,EAAsE,CACvG,MAAA,CACL,GAAGA,EACH,WAAY,SACd,CACF,CCFO,MAAeC,CAAoD,CACxE,aAAc,CAAA,CAEd,WAAWC,EAAsB,CACzB,MAAAC,EAAM,iBAAiBD,CAAS,GAC/B,OAAA,OAAO,gBAAgB,QAAQC,CAAG,CAAA,CAG3C,MAAO,CACL,KAAK,OAAO,CAAA,CAUd,SAAU,CACR,KAAK,UAAU,CAAA,CAajB,MAAM,WAAWC,EAAuD,CAC/D,OAAA,MAAM,KAAK,aAAaA,CAAM,CAAA,CAQzC"}
|
package/dist/index.es.js
CHANGED
|
@@ -1,10 +1,32 @@
|
|
|
1
|
-
function
|
|
1
|
+
function r(o) {
|
|
2
2
|
return {
|
|
3
|
-
...
|
|
3
|
+
...o,
|
|
4
4
|
plugInType: "storage"
|
|
5
5
|
};
|
|
6
6
|
}
|
|
7
|
+
class n {
|
|
8
|
+
constructor() {
|
|
9
|
+
}
|
|
10
|
+
readConfig(t) {
|
|
11
|
+
const e = `storageSource/${t}`;
|
|
12
|
+
return utools.dbCryptoStorage.getItem(e);
|
|
13
|
+
}
|
|
14
|
+
init() {
|
|
15
|
+
this.doInit();
|
|
16
|
+
}
|
|
17
|
+
destroy() {
|
|
18
|
+
this.doDestroy();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 上传文件
|
|
22
|
+
* @param params 参数
|
|
23
|
+
*/
|
|
24
|
+
async uploadFile(t) {
|
|
25
|
+
return await this.doUploadFile(t);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
7
28
|
export {
|
|
8
|
-
n as
|
|
29
|
+
n as StoragePlugIn,
|
|
30
|
+
r as createStoragePlugInConfig
|
|
9
31
|
};
|
|
10
32
|
//# sourceMappingURL=index.es.js.map
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../src/storage/StoragePlugInConfig.ts"],"sourcesContent":["export interface StorageUIFormElement {\n type: 'input';\n\n formItem: {\n rules?: Record<string, any>;\n field: string;\n label: string;\n },\n\n /**\n * 元素属性值\n */\n elementProperty: Record<string, any>;\n}\n\nexport interface StorageUIConfig {\n /**\n * 提示\n */\n tips: string,\n\n /**\n * 表单\n */\n forms: StorageUIFormElement[];\n}\n\nexport interface StoragePlugInConfig {\n /**\n * 插件 code 全局唯一\n */\n pluginCode: string;\n /**\n * 插件名称\n */\n pluginName: string;\n\n /**\n * 插件版本\n */\n pluginVersion: string;\n\n /**\n * 插件作者\n */\n pluginAuthor: string;\n\n /**\n * 插件描述\n */\n pluginDesc: string;\n\n /**\n * 插件类型\n */\n plugInType: 'storage';\n\n /**\n * 插件 logo\n */\n plugInLogo: string;\n\n /**\n * 配置 ui\n */\n uiConfig?: StorageUIConfig;\n}\n\n/**\n * 场景插件配置\n * @param config\n */\nexport function createStoragePlugInConfig(config: Omit<StoragePlugInConfig, 'plugInType'>): StoragePlugInConfig {\n return {\n ...config,\n plugInType: 'storage',\n };\n}\n"],"names":["createStoragePlugInConfig","config"],"mappings":"AAwEO,SAASA,EAA0BC,GAAsE;AACvG,SAAA;AAAA,IACL,GAAGA;AAAA,IACH,YAAY;AAAA,EACd;AACF;"}
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../src/storage/StoragePlugInConfig.ts","../src/storage/StoragePlugIn.ts"],"sourcesContent":["export interface StorageUIFormElement {\n type: 'input';\n\n formItem: {\n rules?: Record<string, any>;\n field: string;\n label: string;\n },\n\n /**\n * 元素属性值\n */\n elementProperty: Record<string, any>;\n}\n\nexport interface StorageUIConfig {\n /**\n * 提示\n */\n tips: string,\n\n /**\n * 表单\n */\n forms: StorageUIFormElement[];\n}\n\nexport interface StoragePlugInConfig {\n /**\n * 插件 code 全局唯一\n */\n pluginCode: string;\n /**\n * 插件名称\n */\n pluginName: string;\n\n /**\n * 插件版本\n */\n pluginVersion: string;\n\n /**\n * 插件作者\n */\n pluginAuthor: string;\n\n /**\n * 插件描述\n */\n pluginDesc: string;\n\n /**\n * 插件类型\n */\n plugInType: 'storage';\n\n /**\n * 插件 logo\n */\n plugInLogo: string;\n\n /**\n * 配置 ui\n */\n uiConfig?: StorageUIConfig;\n}\n\n/**\n * 场景插件配置\n * @param config\n */\nexport function createStoragePlugInConfig(config: Omit<StoragePlugInConfig, 'plugInType'>): StoragePlugInConfig {\n return {\n ...config,\n plugInType: 'storage',\n };\n}\n","export interface IUploadFileResult {\n /**\n * 上传后文件访问地址\n */\n url: string;\n\n /**\n * 额外数据\n */\n extra: any;\n}\n\nexport interface IUploadFileParams {\n /**\n * 上传 id\n */\n readonly id: string;\n\n /**\n * 配置 id\n */\n readonly storageId: string;\n\n /**\n * 文件路径\n */\n readonly filePath: string;\n\n /**\n * 文件名称\n */\n readonly fileName: string;\n\n /**\n * 文件大小\n */\n readonly fileSize: number;\n\n /**\n * 文件\n */\n readonly file: File;\n}\n\n/**\n * 插件接口\n */\ninterface IStoragePlugIn<C = any> {\n\n /**\n * 插件初始化调用\n */\n init(): void;\n\n /**\n * 读取配置\n * @param storageId\n */\n readConfig(storageId: string): C;\n\n /**\n * 上传文件\n * @param params 参数\n */\n uploadFile(params: IUploadFileParams): Promise<IUploadFileResult>;\n\n /**\n * 插件销毁调用\n */\n destroy(): void;\n}\n\n/**\n * 存储插件\n */\nexport abstract class StoragePlugIn<C = any> implements IStoragePlugIn<C> {\n constructor() {}\n\n readConfig(storageId: string): C {\n const key = `storageSource/${storageId}`\n return utools.dbCryptoStorage.getItem(key)\n }\n\n init() {\n this.doInit();\n }\n\n /**\n * 初始化使用 <br/>\n * constructor 方法之后调用, 在第一次使用前调用\n * @protected\n */\n protected abstract doInit(): void;\n\n destroy() {\n this.doDestroy()\n }\n\n /**\n * 插件销毁调用, 用于销毁资源\n * @protected\n */\n protected abstract doDestroy(): void\n\n /**\n * 上传文件\n * @param params 参数\n */\n async uploadFile(params: IUploadFileParams): Promise<IUploadFileResult> {\n return await this.doUploadFile(params);\n }\n\n /**\n * 上传文件\n * @param params 参数\n */\n abstract doUploadFile(params: IUploadFileParams): Promise<IUploadFileResult>;\n}\n"],"names":["createStoragePlugInConfig","config","StoragePlugIn","storageId","key","params"],"mappings":"AAwEO,SAASA,EAA0BC,GAAsE;AACvG,SAAA;AAAA,IACL,GAAGA;AAAA,IACH,YAAY;AAAA,EACd;AACF;ACFO,MAAeC,EAAoD;AAAA,EACxE,cAAc;AAAA,EAAA;AAAA,EAEd,WAAWC,GAAsB;AACzB,UAAAC,IAAM,iBAAiBD,CAAS;AAC/B,WAAA,OAAO,gBAAgB,QAAQC,CAAG;AAAA,EAAA;AAAA,EAG3C,OAAO;AACL,SAAK,OAAO;AAAA,EAAA;AAAA,EAUd,UAAU;AACR,SAAK,UAAU;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAajB,MAAM,WAAWC,GAAuD;AAC/D,WAAA,MAAM,KAAK,aAAaA,CAAM;AAAA,EAAA;AAQzC;"}
|
|
@@ -13,6 +13,10 @@ export interface IUploadFileParams {
|
|
|
13
13
|
* 上传 id
|
|
14
14
|
*/
|
|
15
15
|
readonly id: string;
|
|
16
|
+
/**
|
|
17
|
+
* 配置 id
|
|
18
|
+
*/
|
|
19
|
+
readonly storageId: string;
|
|
16
20
|
/**
|
|
17
21
|
* 文件路径
|
|
18
22
|
*/
|
|
@@ -33,19 +37,54 @@ export interface IUploadFileParams {
|
|
|
33
37
|
/**
|
|
34
38
|
* 插件接口
|
|
35
39
|
*/
|
|
36
|
-
|
|
40
|
+
interface IStoragePlugIn<C = any> {
|
|
37
41
|
/**
|
|
38
42
|
* 插件初始化调用
|
|
39
43
|
*/
|
|
40
44
|
init(): void;
|
|
45
|
+
/**
|
|
46
|
+
* 读取配置
|
|
47
|
+
* @param storageId
|
|
48
|
+
*/
|
|
49
|
+
readConfig(storageId: string): C;
|
|
41
50
|
/**
|
|
42
51
|
* 上传文件
|
|
43
52
|
* @param params 参数
|
|
44
|
-
* @param config 配置文件
|
|
45
53
|
*/
|
|
46
|
-
uploadFile(params: IUploadFileParams
|
|
54
|
+
uploadFile(params: IUploadFileParams): Promise<IUploadFileResult>;
|
|
47
55
|
/**
|
|
48
56
|
* 插件销毁调用
|
|
49
57
|
*/
|
|
50
58
|
destroy(): void;
|
|
51
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* 存储插件
|
|
62
|
+
*/
|
|
63
|
+
export declare abstract class StoragePlugIn<C = any> implements IStoragePlugIn<C> {
|
|
64
|
+
constructor();
|
|
65
|
+
readConfig(storageId: string): C;
|
|
66
|
+
init(): void;
|
|
67
|
+
/**
|
|
68
|
+
* 初始化使用 <br/>
|
|
69
|
+
* constructor 方法之后调用, 在第一次使用前调用
|
|
70
|
+
* @protected
|
|
71
|
+
*/
|
|
72
|
+
protected abstract doInit(): void;
|
|
73
|
+
destroy(): void;
|
|
74
|
+
/**
|
|
75
|
+
* 插件销毁调用, 用于销毁资源
|
|
76
|
+
* @protected
|
|
77
|
+
*/
|
|
78
|
+
protected abstract doDestroy(): void;
|
|
79
|
+
/**
|
|
80
|
+
* 上传文件
|
|
81
|
+
* @param params 参数
|
|
82
|
+
*/
|
|
83
|
+
uploadFile(params: IUploadFileParams): Promise<IUploadFileResult>;
|
|
84
|
+
/**
|
|
85
|
+
* 上传文件
|
|
86
|
+
* @param params 参数
|
|
87
|
+
*/
|
|
88
|
+
abstract doUploadFile(params: IUploadFileParams): Promise<IUploadFileResult>;
|
|
89
|
+
}
|
|
90
|
+
export {};
|