not-node 6.3.46 → 6.3.48
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/package.json +1 -1
- package/src/fields/filter.js +2 -2
- package/src/manifest/manifest.filter.js +4 -3
- package/src/types.js +37 -0
package/package.json
CHANGED
package/src/fields/filter.js
CHANGED
|
@@ -7,7 +7,7 @@ const {
|
|
|
7
7
|
const { getSafeFieldsForRoleAction } = require("../auth/fields");
|
|
8
8
|
const { DEFAULT_USER_ROLE_FOR_GUEST } = require("../auth/const");
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* notFieldsFilter.filter(fields, getApp().getModelSchema(MODEL_NAME), {action});
|
|
11
11
|
*
|
|
12
12
|
* usage:
|
|
13
13
|
* manifest = {
|
|
@@ -17,7 +17,7 @@ const { DEFAULT_USER_ROLE_FOR_GUEST } = require("../auth/const");
|
|
|
17
17
|
* list:{
|
|
18
18
|
* rules:[{
|
|
19
19
|
* root: true,
|
|
20
|
-
* fields:
|
|
20
|
+
* fields: notFieldsFilter.filter(['@*'], getApp().getModelSchema(MODEL_NAME), {action:read});
|
|
21
21
|
* }]
|
|
22
22
|
* },
|
|
23
23
|
* profile:{
|
|
@@ -2,6 +2,7 @@ const merge = require("deepmerge");
|
|
|
2
2
|
const Auth = require("../auth");
|
|
3
3
|
const notFieldsFilter = require("../fields/filter");
|
|
4
4
|
const getApp = require("../getApp");
|
|
5
|
+
const { firstLetterToUpper } = require("../common");
|
|
5
6
|
|
|
6
7
|
const DIRTY_FIELDS = [
|
|
7
8
|
"rules",
|
|
@@ -32,7 +33,7 @@ module.exports = class notManifestFilter {
|
|
|
32
33
|
**/
|
|
33
34
|
static filterRoute(route, auth, role, root, moduleName = "") {
|
|
34
35
|
let result = JSON.parse(JSON.stringify(route));
|
|
35
|
-
const modelName = result.
|
|
36
|
+
const modelName = result.model;
|
|
36
37
|
result.actions = {};
|
|
37
38
|
if (!route || !route.actions) {
|
|
38
39
|
return result;
|
|
@@ -167,9 +168,9 @@ module.exports = class notManifestFilter {
|
|
|
167
168
|
static composeFullModelName(moduleName, modelName) {
|
|
168
169
|
if (modelName) {
|
|
169
170
|
if (moduleName) {
|
|
170
|
-
return `${moduleName}//${modelName}`;
|
|
171
|
+
return `${moduleName}//${firstLetterToUpper(modelName)}`;
|
|
171
172
|
} else {
|
|
172
|
-
return `${modelName}`;
|
|
173
|
+
return `${firstLetterToUpper(modelName)}`;
|
|
173
174
|
}
|
|
174
175
|
}
|
|
175
176
|
return "";
|
package/src/types.js
CHANGED
|
@@ -132,4 +132,41 @@
|
|
|
132
132
|
* @property {function} [idGetter]
|
|
133
133
|
* @property {string} [client]
|
|
134
134
|
*/
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @typedef {object} notFieldSafety
|
|
138
|
+
* @property {Array<string>} create
|
|
139
|
+
* @property {Array<string>} update
|
|
140
|
+
* @property {Array<string>} read
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @typedef {Number|String|Array|Object|Date|import('mongoose').Types.ObjectId|import('mongoose').Schema.Types.Mixed} notFieldModelType
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @typedef {object} notFieldModel
|
|
149
|
+
* @property {notFieldModelType} type
|
|
150
|
+
* @property {any} default default value
|
|
151
|
+
* @property {boolean} [sortable] if field is sortable
|
|
152
|
+
* @property {boolean} [required] if required to be defined
|
|
153
|
+
* @property {notFieldSafety} [safe] safety requirements
|
|
154
|
+
* @property {string} [ref] mongoose model name, if type is ObjectId
|
|
155
|
+
* @property {string} [refPath] path to field with name of mongoose model this field value of ObjectId type reference to
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @typedef {object} notFieldUI
|
|
160
|
+
* @property {string} component name of component to render
|
|
161
|
+
* @property {string} [label] field label text or locale string
|
|
162
|
+
* @property {string} [placeholder] field placeholder text or locale string
|
|
163
|
+
* @property {boolean} [readonly] if component readonly or not
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @typedef {object} notField
|
|
168
|
+
* @property {notFieldUI} [ui]
|
|
169
|
+
* @property {notFieldModel} [model]
|
|
170
|
+
*/
|
|
171
|
+
|
|
135
172
|
module.exports = {};
|