verteilen-core 1.3.23 → 1.3.25
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.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interface/plugin.d.ts +9 -15
- package/dist/server/plugin.js +2 -2
- package/dist/util/plugin_builder.d.ts +2 -0
- package/dist/util/plugin_builder.js +85 -0
- package/dist/utility.d.ts +1 -0
- package/dist/utility.js +17 -0
- package/package.json +1 -1
- package/src/index.ts +3 -1
- package/src/interface/plugin.ts +21 -15
- package/src/server/plugin.ts +2 -2
- package/src/util/plugin_builder.ts +58 -0
- package/src/utility.ts +1 -0
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -51,29 +51,23 @@ export interface TemplateData_Project {
|
|
|
51
51
|
title: string;
|
|
52
52
|
filename: string;
|
|
53
53
|
group: string;
|
|
54
|
+
value: number;
|
|
54
55
|
}
|
|
55
56
|
export interface TemplateData_Database {
|
|
56
57
|
title: string;
|
|
57
58
|
filename: string;
|
|
58
59
|
group: string;
|
|
59
|
-
}
|
|
60
|
-
export interface TemplateGroup_Project {
|
|
61
60
|
value: number;
|
|
62
|
-
group: string;
|
|
63
|
-
title?: string;
|
|
64
|
-
filename?: string;
|
|
65
|
-
template?: ProjectCall;
|
|
66
61
|
}
|
|
67
|
-
export interface
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
template?: DatabaseCall;
|
|
62
|
+
export interface TemplateGroup_Project extends TemplateData_Project {
|
|
63
|
+
template: ProjectCall;
|
|
64
|
+
}
|
|
65
|
+
export interface TemplateGroup_Database extends TemplateData_Database {
|
|
66
|
+
template: DatabaseCall;
|
|
73
67
|
}
|
|
74
|
-
export interface
|
|
68
|
+
export interface PluginGenData {
|
|
75
69
|
url?: string;
|
|
76
|
-
projects: Array<
|
|
77
|
-
databases: Array<
|
|
70
|
+
projects: Array<TemplateGroup_Project>;
|
|
71
|
+
databases: Array<TemplateGroup_Database>;
|
|
78
72
|
}
|
|
79
73
|
export {};
|
package/dist/server/plugin.js
CHANGED
|
@@ -28,13 +28,13 @@ const GetCurrentPlugin = async (loader) => {
|
|
|
28
28
|
}
|
|
29
29
|
if (header == undefined)
|
|
30
30
|
continue;
|
|
31
|
-
header.
|
|
31
|
+
header.projects = header.projects.map(x => ({
|
|
32
32
|
value: -1,
|
|
33
33
|
group: x.group,
|
|
34
34
|
filename: x.filename,
|
|
35
35
|
title: x.title
|
|
36
36
|
}));
|
|
37
|
-
header.
|
|
37
|
+
header.databases = header.databases.map(x => ({
|
|
38
38
|
value: -1,
|
|
39
39
|
group: x.group,
|
|
40
40
|
filename: x.filename,
|
|
@@ -0,0 +1,85 @@
|
|
|
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.PluginBuild = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const interface_1 = require("../interface");
|
|
40
|
+
const PluginBuild = (plugins, templates) => {
|
|
41
|
+
const root = path.join(__dirname, 'dist');
|
|
42
|
+
const root_p = path.join(root, 'project');
|
|
43
|
+
const root_d = path.join(root, 'database');
|
|
44
|
+
const m_path = path.join(root, 'manifest.json');
|
|
45
|
+
if (!fs.existsSync(root)) {
|
|
46
|
+
fs.mkdirSync(root);
|
|
47
|
+
}
|
|
48
|
+
let manifest = {
|
|
49
|
+
thumbnail: "",
|
|
50
|
+
icon: "",
|
|
51
|
+
owner: "",
|
|
52
|
+
title: "",
|
|
53
|
+
plugins: [],
|
|
54
|
+
projects: [],
|
|
55
|
+
databases: []
|
|
56
|
+
};
|
|
57
|
+
if (fs.existsSync(m_path)) {
|
|
58
|
+
manifest = JSON.parse(fs.readFileSync(m_path).toString());
|
|
59
|
+
}
|
|
60
|
+
manifest.plugins = plugins.plugins;
|
|
61
|
+
manifest.projects = templates.projects.map(x => ({
|
|
62
|
+
title: x.title,
|
|
63
|
+
filename: x.filename,
|
|
64
|
+
group: x.group,
|
|
65
|
+
value: x.value,
|
|
66
|
+
}));
|
|
67
|
+
manifest.databases = templates.databases.map(x => ({
|
|
68
|
+
title: x.title,
|
|
69
|
+
filename: x.filename,
|
|
70
|
+
group: x.group,
|
|
71
|
+
value: x.value,
|
|
72
|
+
}));
|
|
73
|
+
delete manifest.acl;
|
|
74
|
+
delete manifest.permission;
|
|
75
|
+
fs.writeFileSync(m_path, JSON.stringify(manifest, null, 4));
|
|
76
|
+
templates.projects.forEach(item => {
|
|
77
|
+
const result = item.template((0, interface_1.CreateDefaultProject)());
|
|
78
|
+
fs.writeFileSync(path.join(root_p, `${item.title}.json`), JSON.stringify(result, null, 4), 'utf-8');
|
|
79
|
+
});
|
|
80
|
+
templates.databases.forEach(item => {
|
|
81
|
+
const result = item.template();
|
|
82
|
+
fs.writeFileSync(path.join(root_d, `${item.title}.json`), JSON.stringify(result, null, 4), 'utf-8');
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
exports.PluginBuild = PluginBuild;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './util/plugin_builder';
|
package/dist/utility.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./util/plugin_builder"), exports);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/interface/plugin.ts
CHANGED
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
import { DatabaseContainer, DataTime, Project } from "./base"
|
|
7
7
|
import { ACLType, LocalPermission } from "./server"
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Method to generate project template (populate)
|
|
11
|
+
*/
|
|
9
12
|
type ProjectCall = (p:Project) => Project
|
|
13
|
+
/**
|
|
14
|
+
* Method to generate database values
|
|
15
|
+
*/
|
|
10
16
|
type DatabaseCall = () => Array<DatabaseContainer>
|
|
11
17
|
|
|
12
18
|
/**
|
|
@@ -201,6 +207,10 @@ export interface TemplateData_Project {
|
|
|
201
207
|
* **Group Name**
|
|
202
208
|
*/
|
|
203
209
|
group: string
|
|
210
|
+
/**
|
|
211
|
+
* **Sort Order**
|
|
212
|
+
*/
|
|
213
|
+
value: number
|
|
204
214
|
}
|
|
205
215
|
|
|
206
216
|
/**
|
|
@@ -219,29 +229,25 @@ export interface TemplateData_Database {
|
|
|
219
229
|
* **Group Name**
|
|
220
230
|
*/
|
|
221
231
|
group: string
|
|
232
|
+
/**
|
|
233
|
+
* **Sort Order**
|
|
234
|
+
*/
|
|
235
|
+
value: number
|
|
222
236
|
}
|
|
223
237
|
|
|
224
|
-
export interface TemplateGroup_Project {
|
|
225
|
-
|
|
226
|
-
group: string
|
|
227
|
-
title?: string
|
|
228
|
-
filename?: string
|
|
229
|
-
template?: ProjectCall
|
|
238
|
+
export interface TemplateGroup_Project extends TemplateData_Project {
|
|
239
|
+
template: ProjectCall
|
|
230
240
|
}
|
|
231
241
|
|
|
232
|
-
export interface TemplateGroup_Database {
|
|
233
|
-
|
|
234
|
-
group: string
|
|
235
|
-
title?: string
|
|
236
|
-
filename?: string
|
|
237
|
-
template?: DatabaseCall
|
|
242
|
+
export interface TemplateGroup_Database extends TemplateData_Database {
|
|
243
|
+
template: DatabaseCall
|
|
238
244
|
}
|
|
239
245
|
|
|
240
246
|
/**
|
|
241
247
|
* **Template Group Data**
|
|
242
248
|
*/
|
|
243
|
-
export interface
|
|
249
|
+
export interface PluginGenData {
|
|
244
250
|
url?: string
|
|
245
|
-
projects: Array<
|
|
246
|
-
databases: Array<
|
|
251
|
+
projects: Array<TemplateGroup_Project>
|
|
252
|
+
databases: Array<TemplateGroup_Database>
|
|
247
253
|
}
|
package/src/server/plugin.ts
CHANGED
|
@@ -106,13 +106,13 @@ export const GetCurrentPlugin = async (loader:RecordIOBase):Promise<PluginPageDa
|
|
|
106
106
|
continue
|
|
107
107
|
}
|
|
108
108
|
if(header == undefined) continue
|
|
109
|
-
header.
|
|
109
|
+
header.projects = header.projects.map(x => ({
|
|
110
110
|
value: -1,
|
|
111
111
|
group: x.group,
|
|
112
112
|
filename: x.filename,
|
|
113
113
|
title: x.title
|
|
114
114
|
}))
|
|
115
|
-
header.
|
|
115
|
+
header.databases = header.databases.map(x => ({
|
|
116
116
|
value: -1,
|
|
117
117
|
group: x.group,
|
|
118
118
|
filename: x.filename,
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as fs from 'fs'
|
|
2
|
+
import * as path from 'path'
|
|
3
|
+
import { CreateDefaultProject, DatabaseContainer, PluginContainer, PluginGenData, PluginNode, Project } from '../interface'
|
|
4
|
+
|
|
5
|
+
export const PluginBuild = (plugins:PluginNode, templates:PluginGenData) => {
|
|
6
|
+
const root = path.join(__dirname, 'dist')
|
|
7
|
+
const root_p = path.join(root, 'project')
|
|
8
|
+
const root_d = path.join(root, 'database')
|
|
9
|
+
const m_path = path.join(root, 'manifest.json')
|
|
10
|
+
if(!fs.existsSync(root)){
|
|
11
|
+
fs.mkdirSync(root)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let manifest:PluginContainer = {
|
|
15
|
+
thumbnail: "",
|
|
16
|
+
icon: "",
|
|
17
|
+
owner: "",
|
|
18
|
+
title: "",
|
|
19
|
+
plugins: [],
|
|
20
|
+
projects: [],
|
|
21
|
+
databases: []
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if(fs.existsSync(m_path)){
|
|
25
|
+
manifest = JSON.parse(fs.readFileSync(m_path).toString())
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
manifest.plugins = plugins.plugins
|
|
29
|
+
manifest.projects = templates.projects.map(x => ({
|
|
30
|
+
title: x.title,
|
|
31
|
+
filename: x.filename,
|
|
32
|
+
group: x.group,
|
|
33
|
+
value: x.value,
|
|
34
|
+
}))
|
|
35
|
+
manifest.databases = templates.databases.map(x => ({
|
|
36
|
+
title: x.title,
|
|
37
|
+
filename: x.filename,
|
|
38
|
+
group: x.group,
|
|
39
|
+
value: x.value,
|
|
40
|
+
}))
|
|
41
|
+
|
|
42
|
+
delete manifest.acl
|
|
43
|
+
delete manifest.permission
|
|
44
|
+
fs.writeFileSync(m_path, JSON.stringify(manifest, null, 4))
|
|
45
|
+
|
|
46
|
+
templates.projects.forEach(item => {
|
|
47
|
+
const result:Project = item.template(CreateDefaultProject())
|
|
48
|
+
fs.writeFileSync(
|
|
49
|
+
path.join(root_p, `${item.title}.json`),
|
|
50
|
+
JSON.stringify(result, null, 4), 'utf-8')
|
|
51
|
+
})
|
|
52
|
+
templates.databases.forEach(item => {
|
|
53
|
+
const result:Array<DatabaseContainer> = item.template()
|
|
54
|
+
fs.writeFileSync(
|
|
55
|
+
path.join(root_d, `${item.title}.json`),
|
|
56
|
+
JSON.stringify(result, null, 4), 'utf-8')
|
|
57
|
+
})
|
|
58
|
+
}
|
package/src/utility.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './util/plugin_builder'
|