@steedos/service-metadata-apps 2.2.52-beta.5 → 2.2.52-beta.50
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/LICENSE.txt +2 -5
- package/lib/actionsHandler.js +20 -20
- package/lib/apps.service.js +10 -10
- package/lib/index.js +3 -3
- package/package.json +5 -12
package/LICENSE.txt
CHANGED
|
@@ -6,14 +6,11 @@ To determine under which license you may use a file from the Steedos source code
|
|
|
6
6
|
please resort to the header of that file.
|
|
7
7
|
|
|
8
8
|
If the file has no header, the following rules apply
|
|
9
|
-
1.
|
|
10
|
-
2.
|
|
11
|
-
3. source code that is neither (1) nor (2) is licensed under AGPL, see License.AGPL.txt
|
|
9
|
+
1. enterprise features are licensed under Steedos Enterprise Terms, see License.enterprise.txt
|
|
10
|
+
2. source code that is neither (1) is licensed under MIT, see https://opensource.org/licenses/MIT
|
|
12
11
|
|
|
13
12
|
On request, licenses under different terms are available.
|
|
14
13
|
|
|
15
|
-
Project templates can be found in the folders steedos-projects/
|
|
16
|
-
|
|
17
14
|
Source code of enterprise features are files that
|
|
18
15
|
* are in folders named "ee" or start with "ee_", or in subfolders of such folders.
|
|
19
16
|
* contain the strings "ee_" in its filename name.
|
package/lib/actionsHandler.js
CHANGED
|
@@ -10,12 +10,12 @@ function cacherKey(appApiName) {
|
|
|
10
10
|
return `$steedos.#${_1.METADATA_TYPE}.${appApiName}`;
|
|
11
11
|
}
|
|
12
12
|
function registerApp(ctx, appApiName, data, meta) {
|
|
13
|
-
return
|
|
13
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
14
14
|
return yield ctx.broker.call('metadata.add', { key: cacherKey(appApiName), data: data }, { meta: meta });
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
function getSpaceApp(ctx, appApiName) {
|
|
18
|
-
return
|
|
18
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
const allApps = yield getAllApps(ctx);
|
|
20
20
|
const userSession = ctx.meta.user;
|
|
21
21
|
const spaceId = userSession.spaceId;
|
|
@@ -39,7 +39,7 @@ function getSpaceApp(ctx, appApiName) {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
function get(ctx) {
|
|
42
|
-
return
|
|
42
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
43
43
|
const spaceAppMetadataConfig = yield getSpaceApp(ctx, ctx.params.appApiName);
|
|
44
44
|
if (spaceAppMetadataConfig) {
|
|
45
45
|
return spaceAppMetadataConfig;
|
|
@@ -78,7 +78,7 @@ function get(ctx) {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
function getAllApps(ctx) {
|
|
81
|
-
return
|
|
81
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
82
82
|
return yield ctx.broker.call('metadata.filter', { key: cacherKey("*") }, { meta: ctx.meta });
|
|
83
83
|
});
|
|
84
84
|
}
|
|
@@ -86,12 +86,12 @@ function getAllApps(ctx) {
|
|
|
86
86
|
// return await ctx.broker.call('objects.get', {objectApiName})
|
|
87
87
|
// }
|
|
88
88
|
function getAllTabs(ctx) {
|
|
89
|
-
return
|
|
89
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
90
90
|
return yield ctx.broker.call('tabs.getAll');
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
function getContext(ctx) {
|
|
94
|
-
return
|
|
94
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
95
95
|
return {
|
|
96
96
|
tabs: yield getAllTabs(ctx),
|
|
97
97
|
objects: yield (0, objectql_1.getSteedosSchema)().getAllObject(),
|
|
@@ -99,7 +99,7 @@ function getContext(ctx) {
|
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
function getTab(ctx, tabApiName) {
|
|
102
|
-
return
|
|
102
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
103
103
|
const metadataConfig = yield ctx.broker.call('tabs.get', { tabApiName });
|
|
104
104
|
return metadataConfig === null || metadataConfig === void 0 ? void 0 : metadataConfig.metadata;
|
|
105
105
|
});
|
|
@@ -142,7 +142,7 @@ function checkAppMobile(app, mobile) {
|
|
|
142
142
|
return isChecked;
|
|
143
143
|
}
|
|
144
144
|
function tabMenus(ctx, appPath, tabApiName, menu, mobile, userSession, context) {
|
|
145
|
-
return
|
|
145
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
146
146
|
try {
|
|
147
147
|
const objectsConfigs = context.objects;
|
|
148
148
|
const tab = yield getTab(ctx, tabApiName);
|
|
@@ -220,12 +220,12 @@ function tabMenus(ctx, appPath, tabApiName, menu, mobile, userSession, context)
|
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
222
|
function objectAllowRead(objectApiName, userSession) {
|
|
223
|
-
return
|
|
223
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
224
224
|
return yield (0, objectql_1.getObject)(objectApiName).allowRead(userSession);
|
|
225
225
|
});
|
|
226
226
|
}
|
|
227
227
|
function transformAppToMenus(ctx, app, mobile, userSession, context) {
|
|
228
|
-
return
|
|
228
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
229
229
|
if (!app.code && !app._id) {
|
|
230
230
|
return;
|
|
231
231
|
}
|
|
@@ -292,7 +292,7 @@ function transformAppToMenus(ctx, app, mobile, userSession, context) {
|
|
|
292
292
|
});
|
|
293
293
|
}
|
|
294
294
|
function getAppsMenus(ctx) {
|
|
295
|
-
return
|
|
295
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
296
296
|
const userSession = ctx.meta.user;
|
|
297
297
|
if (!userSession) {
|
|
298
298
|
throw new Error('no permission.');
|
|
@@ -355,7 +355,7 @@ function getAppsMenus(ctx) {
|
|
|
355
355
|
});
|
|
356
356
|
}
|
|
357
357
|
function getAppMenus(ctx) {
|
|
358
|
-
return
|
|
358
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
359
359
|
const userSession = ctx.meta.user;
|
|
360
360
|
const { mobile } = ctx.params;
|
|
361
361
|
if (!userSession) {
|
|
@@ -376,28 +376,28 @@ function getAppMenus(ctx) {
|
|
|
376
376
|
}
|
|
377
377
|
exports.ActionHandlers = {
|
|
378
378
|
get(ctx) {
|
|
379
|
-
return
|
|
379
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
380
380
|
return yield ctx.broker.call('metadata.get', { key: cacherKey(ctx.params.appApiName) }, { meta: ctx.meta });
|
|
381
381
|
});
|
|
382
382
|
},
|
|
383
383
|
getAll(ctx) {
|
|
384
|
-
return
|
|
384
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
385
385
|
return yield getAllApps(ctx);
|
|
386
386
|
});
|
|
387
387
|
},
|
|
388
388
|
getMenus(ctx) {
|
|
389
|
-
return
|
|
389
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
390
390
|
const menus = yield getAppsMenus(ctx);
|
|
391
391
|
return menus;
|
|
392
392
|
});
|
|
393
393
|
},
|
|
394
394
|
getAppMenus(ctx) {
|
|
395
|
-
return
|
|
395
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
396
396
|
return yield getAppMenus(ctx);
|
|
397
397
|
});
|
|
398
398
|
},
|
|
399
399
|
add(ctx) {
|
|
400
|
-
return
|
|
400
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
401
401
|
let config = ctx.params.data;
|
|
402
402
|
const serviceName = ctx.meta.metadataServiceName;
|
|
403
403
|
const metadataApiName = ctx.params.appApiName;
|
|
@@ -411,18 +411,18 @@ exports.ActionHandlers = {
|
|
|
411
411
|
});
|
|
412
412
|
},
|
|
413
413
|
delete(ctx) {
|
|
414
|
-
return
|
|
414
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
415
415
|
return yield ctx.broker.call('metadata.delete', { key: cacherKey(ctx.params.appApiName) }, { meta: ctx.meta });
|
|
416
416
|
});
|
|
417
417
|
},
|
|
418
418
|
verify(ctx) {
|
|
419
|
-
return
|
|
419
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
420
420
|
console.log("verify");
|
|
421
421
|
return true;
|
|
422
422
|
});
|
|
423
423
|
},
|
|
424
424
|
refresh(ctx) {
|
|
425
|
-
return
|
|
425
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
426
426
|
const { isClear, metadataApiNames } = ctx.params;
|
|
427
427
|
if (isClear) {
|
|
428
428
|
for (const metadataApiName of metadataApiNames) {
|
package/lib/apps.service.js
CHANGED
|
@@ -16,7 +16,7 @@ module.exports = {
|
|
|
16
16
|
events: {
|
|
17
17
|
[`$METADATA.${_1.METADATA_TYPE}.*`]: {
|
|
18
18
|
handler(ctx) {
|
|
19
|
-
return
|
|
19
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
return yield actionsHandler_1.ActionHandlers.refresh(ctx);
|
|
21
21
|
});
|
|
22
22
|
}
|
|
@@ -33,7 +33,7 @@ module.exports = {
|
|
|
33
33
|
*/
|
|
34
34
|
get: {
|
|
35
35
|
handler(ctx) {
|
|
36
|
-
return
|
|
36
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
37
|
return yield actionsHandler_1.ActionHandlers.get(ctx);
|
|
38
38
|
});
|
|
39
39
|
}
|
|
@@ -45,7 +45,7 @@ module.exports = {
|
|
|
45
45
|
// },
|
|
46
46
|
params: {},
|
|
47
47
|
handler(ctx) {
|
|
48
|
-
return
|
|
48
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
49
49
|
const result = yield actionsHandler_1.ActionHandlers.getMenus(ctx);
|
|
50
50
|
return result;
|
|
51
51
|
});
|
|
@@ -58,35 +58,35 @@ module.exports = {
|
|
|
58
58
|
},
|
|
59
59
|
params: {},
|
|
60
60
|
handler(ctx) {
|
|
61
|
-
return
|
|
61
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
62
62
|
return yield actionsHandler_1.ActionHandlers.getAppMenus(ctx);
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
getAll: {
|
|
67
67
|
handler(ctx) {
|
|
68
|
-
return
|
|
68
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
69
69
|
return yield actionsHandler_1.ActionHandlers.getAll(ctx);
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
add: {
|
|
74
74
|
handler(ctx) {
|
|
75
|
-
return
|
|
75
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
76
76
|
return yield actionsHandler_1.ActionHandlers.add(ctx);
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
delete: {
|
|
81
81
|
handler(ctx) {
|
|
82
|
-
return
|
|
82
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
83
83
|
return yield actionsHandler_1.ActionHandlers.delete(ctx);
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
verify: {
|
|
88
88
|
handler(ctx) {
|
|
89
|
-
return
|
|
89
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
90
90
|
return yield actionsHandler_1.ActionHandlers.verify(ctx);
|
|
91
91
|
});
|
|
92
92
|
}
|
|
@@ -115,14 +115,14 @@ module.exports = {
|
|
|
115
115
|
* Service started lifecycle event handler
|
|
116
116
|
*/
|
|
117
117
|
started() {
|
|
118
|
-
return
|
|
118
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
119
119
|
});
|
|
120
120
|
},
|
|
121
121
|
/**
|
|
122
122
|
* Service stopped lifecycle event handler
|
|
123
123
|
*/
|
|
124
124
|
stopped() {
|
|
125
|
-
return
|
|
125
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
};
|
package/lib/index.js
CHANGED
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const _ = require("lodash");
|
|
6
6
|
exports.METADATA_TYPE = 'apps';
|
|
7
7
|
function getServiceAppConfig(ctx, serviceName, appApiName) {
|
|
8
|
-
return
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
9
|
const metadataType = exports.METADATA_TYPE;
|
|
10
10
|
const metadataConfig = yield ctx.broker.call(`metadata.getServiceMetadata`, {
|
|
11
11
|
serviceName,
|
|
@@ -17,7 +17,7 @@ function getServiceAppConfig(ctx, serviceName, appApiName) {
|
|
|
17
17
|
}
|
|
18
18
|
exports.getServiceAppConfig = getServiceAppConfig;
|
|
19
19
|
function getServicesAppConfigs(ctx, appApiName) {
|
|
20
|
-
return
|
|
20
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
21
|
const serviceName = '*';
|
|
22
22
|
const metadataType = exports.METADATA_TYPE;
|
|
23
23
|
const configs = yield ctx.broker.call(`metadata.getServiceMetadatas`, {
|
|
@@ -29,7 +29,7 @@ function getServicesAppConfigs(ctx, appApiName) {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
function refreshApp(ctx, appApiName) {
|
|
32
|
-
return
|
|
32
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
33
|
let appConfig = {};
|
|
34
34
|
const appConfigs = yield getServicesAppConfigs(ctx, appApiName);
|
|
35
35
|
if (appConfigs.length == 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-metadata-apps",
|
|
3
|
-
"version": "2.2.52-beta.
|
|
3
|
+
"version": "2.2.52-beta.50",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/apps.service.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,26 +19,19 @@
|
|
|
19
19
|
"author": "",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@steedos/objectql": "2.2.52-beta.
|
|
22
|
+
"@steedos/objectql": "2.2.52-beta.50",
|
|
23
23
|
"dotenv-flow": "^3.1.0",
|
|
24
24
|
"ioredis": "^4.22.0",
|
|
25
25
|
"lodash": "^4.17.21",
|
|
26
|
-
"moleculer": "^0.14.
|
|
26
|
+
"moleculer": "^0.14.21",
|
|
27
27
|
"moleculer-web": "^0.10.4"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"
|
|
31
|
-
"@types/chai-as-promised": "7.1.0",
|
|
32
|
-
"@types/mocha": "^5.2.6",
|
|
33
|
-
"jslint": "^0.12.1",
|
|
34
|
-
"moleculer-repl": "^0.6.4",
|
|
35
|
-
"nodemon": "^1.18.10",
|
|
36
|
-
"ts-node": "^8.0.3",
|
|
37
|
-
"typescript": "3.5.3"
|
|
30
|
+
"typescript": "4.6.3"
|
|
38
31
|
},
|
|
39
32
|
"private": false,
|
|
40
33
|
"publishConfig": {
|
|
41
34
|
"access": "public"
|
|
42
35
|
},
|
|
43
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "7f4c08f68a7835a05456c7f56935e630b965dc66"
|
|
44
37
|
}
|