@xiaou66/picture-plugin 0.0.6 → 0.0.8
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 +6 -2
- package/dist/index.es.js.map +1 -1
- package/dist/storage/StoragePlugIn.d.ts +20 -4
- 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 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()}uploadFile(t){return this.doUploadFile(t)}}exports.StoragePlugIn=n;exports.createStoragePlugInConfig=r;
|
|
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","../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
|
|
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
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
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;"}
|
|
@@ -50,9 +50,8 @@ interface IStoragePlugIn<C = any> {
|
|
|
50
50
|
/**
|
|
51
51
|
* 上传文件
|
|
52
52
|
* @param params 参数
|
|
53
|
-
* @param config 配置文件
|
|
54
53
|
*/
|
|
55
|
-
uploadFile(params: IUploadFileParams): IUploadFileResult
|
|
54
|
+
uploadFile(params: IUploadFileParams): Promise<IUploadFileResult>;
|
|
56
55
|
/**
|
|
57
56
|
* 插件销毁调用
|
|
58
57
|
*/
|
|
@@ -65,10 +64,27 @@ export declare abstract class StoragePlugIn<C = any> implements IStoragePlugIn<C
|
|
|
65
64
|
constructor();
|
|
66
65
|
readConfig(storageId: string): C;
|
|
67
66
|
init(): void;
|
|
67
|
+
/**
|
|
68
|
+
* 初始化使用 <br/>
|
|
69
|
+
* constructor 方法之后调用, 在第一次使用前调用
|
|
70
|
+
* @protected
|
|
71
|
+
*/
|
|
68
72
|
protected abstract doInit(): void;
|
|
69
73
|
destroy(): void;
|
|
74
|
+
/**
|
|
75
|
+
* 插件销毁调用, 用于销毁资源
|
|
76
|
+
* @protected
|
|
77
|
+
*/
|
|
70
78
|
protected abstract doDestroy(): void;
|
|
71
|
-
|
|
72
|
-
|
|
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>;
|
|
73
89
|
}
|
|
74
90
|
export {};
|