@xiaou66/picture-plugin 0.0.4 → 0.0.6
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 +21 -3
- package/dist/index.es.js.map +1 -1
- package/dist/storage/StoragePlugIn.d.ts +52 -5
- package/package.json +3 -2
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()}uploadFile(t){return 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 * @param config 配置文件\n */\n uploadFile(params: IUploadFileParams): 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 protected abstract doInit(): void;\n\n destroy() {\n this.doDestroy()\n }\n\n protected abstract doDestroy(): void\n\n uploadFile(params: IUploadFileParams): IUploadFileResult {\n return this.doUploadFile(params);\n }\n\n abstract doUploadFile(params: IUploadFileParams): IUploadFileResult;\n}\n"],"names":["createStoragePlugInConfig","config","StoragePlugIn","storageId","key","params"],"mappings":"gFAwEO,SAASA,EAA0BC,EAAsE,CACvG,MAAA,CACL,GAAGA,EACH,WAAY,SACd,CACF,CCDO,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,CAKd,SAAU,CACR,KAAK,UAAU,CAAA,CAKjB,WAAWC,EAA8C,CAChD,OAAA,KAAK,aAAaA,CAAM,CAAA,CAInC"}
|
package/dist/index.es.js
CHANGED
|
@@ -1,10 +1,28 @@
|
|
|
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
|
+
uploadFile(t) {
|
|
21
|
+
return this.doUploadFile(t);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
7
24
|
export {
|
|
8
|
-
n as
|
|
25
|
+
n as StoragePlugIn,
|
|
26
|
+
r as createStoragePlugInConfig
|
|
9
27
|
};
|
|
10
28
|
//# 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 * @param config 配置文件\n */\n uploadFile(params: IUploadFileParams): 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 protected abstract doInit(): void;\n\n destroy() {\n this.doDestroy()\n }\n\n protected abstract doDestroy(): void\n\n uploadFile(params: IUploadFileParams): IUploadFileResult {\n return this.doUploadFile(params);\n }\n\n abstract doUploadFile(params: IUploadFileParams): 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;ACDO,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,EAKd,UAAU;AACR,SAAK,UAAU;AAAA,EAAA;AAAA,EAKjB,WAAWC,GAA8C;AAChD,WAAA,KAAK,aAAaA,CAAM;AAAA,EAAA;AAInC;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface IUploadFileResult {
|
|
2
2
|
/**
|
|
3
3
|
* 上传后文件访问地址
|
|
4
4
|
*/
|
|
@@ -8,20 +8,67 @@ export interface IUploadResult {
|
|
|
8
8
|
*/
|
|
9
9
|
extra: any;
|
|
10
10
|
}
|
|
11
|
+
export interface IUploadFileParams {
|
|
12
|
+
/**
|
|
13
|
+
* 上传 id
|
|
14
|
+
*/
|
|
15
|
+
readonly id: string;
|
|
16
|
+
/**
|
|
17
|
+
* 配置 id
|
|
18
|
+
*/
|
|
19
|
+
readonly storageId: string;
|
|
20
|
+
/**
|
|
21
|
+
* 文件路径
|
|
22
|
+
*/
|
|
23
|
+
readonly filePath: string;
|
|
24
|
+
/**
|
|
25
|
+
* 文件名称
|
|
26
|
+
*/
|
|
27
|
+
readonly fileName: string;
|
|
28
|
+
/**
|
|
29
|
+
* 文件大小
|
|
30
|
+
*/
|
|
31
|
+
readonly fileSize: number;
|
|
32
|
+
/**
|
|
33
|
+
* 文件
|
|
34
|
+
*/
|
|
35
|
+
readonly file: File;
|
|
36
|
+
}
|
|
11
37
|
/**
|
|
12
38
|
* 插件接口
|
|
13
39
|
*/
|
|
14
|
-
|
|
40
|
+
interface IStoragePlugIn<C = any> {
|
|
15
41
|
/**
|
|
16
|
-
*
|
|
42
|
+
* 插件初始化调用
|
|
17
43
|
*/
|
|
18
44
|
init(): void;
|
|
45
|
+
/**
|
|
46
|
+
* 读取配置
|
|
47
|
+
* @param storageId
|
|
48
|
+
*/
|
|
49
|
+
readConfig(storageId: string): C;
|
|
19
50
|
/**
|
|
20
51
|
* 上传文件
|
|
52
|
+
* @param params 参数
|
|
53
|
+
* @param config 配置文件
|
|
21
54
|
*/
|
|
22
|
-
uploadFile():
|
|
55
|
+
uploadFile(params: IUploadFileParams): IUploadFileResult;
|
|
23
56
|
/**
|
|
24
|
-
*
|
|
57
|
+
* 插件销毁调用
|
|
25
58
|
*/
|
|
26
59
|
destroy(): void;
|
|
27
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* 存储插件
|
|
63
|
+
*/
|
|
64
|
+
export declare abstract class StoragePlugIn<C = any> implements IStoragePlugIn<C> {
|
|
65
|
+
constructor();
|
|
66
|
+
readConfig(storageId: string): C;
|
|
67
|
+
init(): void;
|
|
68
|
+
protected abstract doInit(): void;
|
|
69
|
+
destroy(): void;
|
|
70
|
+
protected abstract doDestroy(): void;
|
|
71
|
+
uploadFile(params: IUploadFileParams): IUploadFileResult;
|
|
72
|
+
abstract doUploadFile(params: IUploadFileParams): IUploadFileResult;
|
|
73
|
+
}
|
|
74
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiaou66/picture-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Picture bed plugin system",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "vite build",
|
|
16
16
|
"dev": "vite",
|
|
17
|
-
"prepare": "npm run build"
|
|
17
|
+
"prepare": "npm run build",
|
|
18
|
+
"publish": "npm publish"
|
|
18
19
|
},
|
|
19
20
|
"author": "xiaou",
|
|
20
21
|
"license": "ISC",
|