identity-admin 1.25.9 → 1.25.11
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/README.md +126 -126
- package/lib/Dashboard.d.ts +14 -14
- package/lib/Dashboard.js +95 -95
- package/lib/container/helpers/HelperInversify.d.ts +6 -6
- package/lib/container/helpers/HelperInversify.js +10 -10
- package/lib/container/helpers/HelperTypes.d.ts +5 -5
- package/lib/container/helpers/HelperTypes.js +7 -7
- package/lib/container/index.d.ts +1 -1
- package/lib/container/index.js +14 -14
- package/lib/container/repositories/RepositoryInversify.d.ts +4 -4
- package/lib/container/repositories/RepositoryInversify.js +13 -13
- package/lib/container/repositories/RepositoryTypes.d.ts +4 -4
- package/lib/container/repositories/RepositoryTypes.js +6 -6
- package/lib/container/types.d.ts +8 -8
- package/lib/container/types.js +9 -9
- package/lib/controllers/ActionController.d.ts +8 -8
- package/lib/controllers/ActionController.js +79 -79
- package/lib/controllers/DashboardController.d.ts +41 -41
- package/lib/controllers/DashboardController.js +589 -589
- package/lib/controllers/ResourceController.d.ts +13 -13
- package/lib/controllers/ResourceController.js +124 -124
- package/lib/helpers/ActionsGenerator.d.ts +11 -11
- package/lib/helpers/ActionsGenerator.js +175 -175
- package/lib/helpers/FiltersHelper.d.ts +9 -9
- package/lib/helpers/FiltersHelper.js +105 -105
- package/lib/helpers/LocalesHelper.d.ts +4 -4
- package/lib/helpers/LocalesHelper.js +73 -73
- package/lib/helpers/LocalizedStringHelper.d.ts +9 -9
- package/lib/helpers/LocalizedStringHelper.js +57 -57
- package/lib/helpers/PopulationHelper.d.ts +12 -12
- package/lib/helpers/PopulationHelper.js +50 -50
- package/lib/helpers/ResourceGenerator.d.ts +7 -7
- package/lib/helpers/ResourceGenerator.js +171 -171
- package/lib/helpers/ResourceHelper.d.ts +28 -28
- package/lib/helpers/ResourceHelper.js +376 -376
- package/lib/helpers/SchemaGenerator.d.ts +5 -5
- package/lib/helpers/SchemaGenerator.js +96 -96
- package/lib/helpers/SchemaHelper.d.ts +5 -5
- package/lib/helpers/SchemaHelper.js +21 -21
- package/lib/locales/en.json +53 -53
- package/lib/middlewares/isAuth.d.ts +13 -13
- package/lib/middlewares/isAuth.js +43 -43
- package/lib/models/ModelNames.d.ts +4 -4
- package/lib/models/ModelNames.js +7 -7
- package/lib/models/customPage/CustomPage.d.ts +2 -2
- package/lib/models/customPage/CustomPage.js +38 -33
- package/lib/models/customPage/ICustomPage.d.ts +17 -16
- package/lib/models/customPage/ICustomPage.js +2 -2
- package/lib/models/file/File.d.ts +2 -2
- package/lib/models/file/File.js +23 -23
- package/lib/models/file/IFile.d.ts +15 -15
- package/lib/models/file/IFile.js +2 -2
- package/lib/models/location/ILocation.d.ts +14 -14
- package/lib/models/location/ILocation.js +2 -2
- package/lib/models/location/Location.d.ts +2 -2
- package/lib/models/location/Location.js +21 -21
- package/lib/models/modelConfiguration/IModelConfigurations.d.ts +29 -29
- package/lib/models/modelConfiguration/IModelConfigurations.js +2 -2
- package/lib/models/modelConfiguration/ModelConfiguration.d.ts +13 -13
- package/lib/models/modelConfiguration/ModelConfiguration.js +95 -95
- package/lib/models/request-log/IRequestLog.d.ts +22 -22
- package/lib/models/request-log/IRequestLog.js +2 -2
- package/lib/models/request-log/RequestLog.d.ts +3 -3
- package/lib/models/request-log/RequestLog.js +51 -51
- package/lib/repositories/DashboardRepository.d.ts +5 -5
- package/lib/repositories/DashboardRepository.js +12 -12
- package/lib/repositories/Repository.d.ts +68 -68
- package/lib/repositories/Repository.js +212 -212
- package/lib/repositories/RequestLogRepository.d.ts +10 -10
- package/lib/repositories/RequestLogRepository.js +54 -54
- package/lib/repositories/SaveResult.d.ts +14 -14
- package/lib/repositories/SaveResult.js +18 -18
- package/lib/router/index.d.ts +8 -8
- package/lib/router/index.js +104 -104
- package/lib/types/DashbordConfig.d.ts +21 -21
- package/lib/types/DashbordConfig.js +2 -2
- package/lib/types/IConfigurationFile.d.ts +6 -6
- package/lib/types/IConfigurationFile.js +2 -2
- package/lib/types/IResourceFile.d.ts +566 -559
- package/lib/types/IResourceFile.js +2 -2
- package/lib/types/IResourceResponse.d.ts +95 -95
- package/lib/types/IResourceResponse.js +2 -2
- package/lib/types/helpers.d.ts +60 -60
- package/lib/types/helpers.js +70 -70
- package/lib/utils/ResourceUtils.d.ts +2 -2
- package/lib/utils/ResourceUtils.js +7 -7
- package/lib/utils/ResponseUtils.d.ts +11 -11
- package/lib/utils/ResponseUtils.js +41 -41
- package/lib/utils/StringUtils.d.ts +9 -9
- package/lib/utils/StringUtils.js +46 -46
- package/lib/view/asset-manifest.json +18 -18
- package/lib/view/assets/icons/delete_icon.svg +3 -3
- package/lib/view/assets/icons/flags/ic_flag_cn.svg +9 -9
- package/lib/view/assets/icons/flags/ic_flag_sa.svg +9 -9
- package/lib/view/assets/icons/flags/ic_flag_vn.svg +9 -9
- package/lib/view/assets/icons/info_icon.svg +3 -3
- package/lib/view/assets/icons/navbar/ic_banking.svg +5 -5
- package/lib/view/assets/icons/navbar/ic_invoice.svg +4 -4
- package/lib/view/assets/icons/navbar/ic_kanban.svg +7 -7
- package/lib/view/assets/icons/navbar/ic_menu_item.svg +8 -8
- package/lib/view/assets/icons/small_info_icon.svg +3 -3
- package/lib/view/assets/illustrations/Group 16.svg +4 -4
- package/lib/view/assets/illustrations/logo.svg +5 -5
- package/lib/view/favicon/browserconfig.xml +9 -9
- package/lib/view/favicon/safari-pinned-tab.svg +182 -182
- package/lib/view/favicon/site.webmanifest +19 -19
- package/lib/view/fonts/index.css +18 -18
- package/lib/view/index.html +52 -52
- package/lib/view/manifest.json +20 -20
- package/lib/view/robots.txt +3 -3
- package/lib/view/static/css/main.54de06ef.css +1 -1
- package/lib/view/static/js/574.778b5963.chunk.js +1 -1
- package/lib/view/static/js/678.521704a3.chunk.js +1 -1
- package/lib/view/static/js/798.54856416.chunk.js +1 -1
- package/lib/view/static/js/main.4687f255.js +2 -2
- package/lib/view/static/js/main.4687f255.js.LICENSE.txt +214 -214
- package/package.json +51 -51
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
// import { AdminParent, SetupParent } from "@pbb/materialUi/parents";
|
|
7
|
-
const StringUtils_1 = __importDefault(require("../utils/StringUtils"));
|
|
8
|
-
const ResourceHelper_1 = __importDefault(require("./ResourceHelper"));
|
|
9
|
-
var pluralize = require('pluralize');
|
|
10
|
-
class LocalesHelper {
|
|
11
|
-
static localizeResource(resource) {
|
|
12
|
-
var _a, _b, _c, _d, _e;
|
|
13
|
-
const modelName = resource.resource.modelName;
|
|
14
|
-
const modifiedResource = JSON.parse(JSON.stringify(resource));
|
|
15
|
-
const title = ResourceHelper_1.default.getSchemaTitle(modelName, resource);
|
|
16
|
-
const schema = resource.resource.schema.paths;
|
|
17
|
-
const recordFields = ResourceHelper_1.default.manageFields(schema, title, resource.properties.hiddenProperties);
|
|
18
|
-
const modelCheck = resource.properties.model ? JSON.parse(JSON.stringify(resource.properties.model)) : undefined;
|
|
19
|
-
const actionsCheck = resource.properties.actions;
|
|
20
|
-
const modelAndPopulatedString = ResourceHelper_1.default.setModelSchema(schema, modelCheck, modelName);
|
|
21
|
-
modifiedResource.properties.model = modelAndPopulatedString[0];
|
|
22
|
-
modifiedResource.properties.populatedString = modelAndPopulatedString[1];
|
|
23
|
-
const modifiedProperties = ResourceHelper_1.default.addVirtualFields(JSON.parse(JSON.stringify(recordFields)), modelCheck);
|
|
24
|
-
modifiedResource.properties.path = ResourceHelper_1.default.getModelPath(modelName);
|
|
25
|
-
const modifiedListProperties = modifiedProperties[0];
|
|
26
|
-
const modifiedShowProperties = modifiedProperties[1];
|
|
27
|
-
const modifiedFormProperties = modifiedProperties[2];
|
|
28
|
-
if (!resource.properties.parent) {
|
|
29
|
-
//modifiedResource.properties.parent = SetupParent
|
|
30
|
-
}
|
|
31
|
-
if (!resource.properties.name) {
|
|
32
|
-
modifiedResource.properties.name = StringUtils_1.default.convertCamelCaseToWord(modelName);
|
|
33
|
-
}
|
|
34
|
-
if (!resource.showProperties) {
|
|
35
|
-
modifiedResource.showProperties = modifiedShowProperties;
|
|
36
|
-
}
|
|
37
|
-
if (!resource.listProperties) {
|
|
38
|
-
modifiedResource.listProperties = ResourceHelper_1.default.exchangeFirstFieldWithTitle(JSON.parse(JSON.stringify(modifiedListProperties)), title);
|
|
39
|
-
}
|
|
40
|
-
if (!resource.formProperties) {
|
|
41
|
-
modifiedResource.formProperties = ResourceHelper_1.default.removeUnWantedFieldsFromCreateOrUpdate(JSON.parse(JSON.stringify(modifiedFormProperties)));
|
|
42
|
-
}
|
|
43
|
-
modifiedResource.properties.title = title;
|
|
44
|
-
if (!resource.properties.defaultOrderBy) {
|
|
45
|
-
modifiedResource.properties.defaultOrderBy = title;
|
|
46
|
-
}
|
|
47
|
-
if (!resource.properties.defaultOrder) {
|
|
48
|
-
modifiedResource.properties.defaultOrder = 'asc';
|
|
49
|
-
}
|
|
50
|
-
if (!resource.properties.defaultrowsPerPage) {
|
|
51
|
-
modifiedResource.properties.defaultrowsPerPage = 10;
|
|
52
|
-
}
|
|
53
|
-
modifiedResource.listProperties = ResourceHelper_1.default.prepareProperties(resource.listProperties ? resource.listProperties : modifiedResource.listProperties, modelName, modifiedResource.properties.model);
|
|
54
|
-
modifiedResource.showProperties = ResourceHelper_1.default.prepareProperties(resource.showProperties ? resource.showProperties : modifiedResource.showProperties, modelName, modifiedResource.properties.model);
|
|
55
|
-
modifiedResource.properties.filters = ResourceHelper_1.default.getFilters(resource.properties.filters ? JSON.parse(JSON.stringify(resource.properties.filters)) : undefined);
|
|
56
|
-
if (modifiedResource.properties.filters.scopes.isAccessible) {
|
|
57
|
-
const options = (_c = (_b = (_a = resource === null || resource === void 0 ? void 0 : resource.properties) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.scopes) === null || _c === void 0 ? void 0 : _c.options;
|
|
58
|
-
modifiedResource.properties.filters.scopes.options = ResourceHelper_1.default.setScopeFilterOptions(modelName, options);
|
|
59
|
-
}
|
|
60
|
-
const actions = ResourceHelper_1.default.getActions(actionsCheck ? JSON.parse(JSON.stringify(resource.properties.actions)) : undefined); //resource.properties.actions? ResourcesHelper.getActions(JSON.parse(JSON.stringify(resource.properties.actions))): ResourcesHelper.getActions(undefined)
|
|
61
|
-
for (const key in actions) {
|
|
62
|
-
if (key === 'extras') {
|
|
63
|
-
actions.extras = actions.extras ? ResourceHelper_1.default.addExtraActions(JSON.parse(JSON.stringify((_e = (_d = resource === null || resource === void 0 ? void 0 : resource.properties) === null || _d === void 0 ? void 0 : _d.actions) === null || _e === void 0 ? void 0 : _e.extras))) : actions.extras;
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
const translation = ResourceHelper_1.default.checkActionTranslation(modelName, key);
|
|
67
|
-
actions[key] = ResourceHelper_1.default.appendActionValues(key, actions[key], translation);
|
|
68
|
-
}
|
|
69
|
-
modifiedResource.properties.actions = actions;
|
|
70
|
-
return modifiedResource;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
exports.default = LocalesHelper;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
// import { AdminParent, SetupParent } from "@pbb/materialUi/parents";
|
|
7
|
+
const StringUtils_1 = __importDefault(require("../utils/StringUtils"));
|
|
8
|
+
const ResourceHelper_1 = __importDefault(require("./ResourceHelper"));
|
|
9
|
+
var pluralize = require('pluralize');
|
|
10
|
+
class LocalesHelper {
|
|
11
|
+
static localizeResource(resource) {
|
|
12
|
+
var _a, _b, _c, _d, _e;
|
|
13
|
+
const modelName = resource.resource.modelName;
|
|
14
|
+
const modifiedResource = JSON.parse(JSON.stringify(resource));
|
|
15
|
+
const title = ResourceHelper_1.default.getSchemaTitle(modelName, resource);
|
|
16
|
+
const schema = resource.resource.schema.paths;
|
|
17
|
+
const recordFields = ResourceHelper_1.default.manageFields(schema, title, resource.properties.hiddenProperties);
|
|
18
|
+
const modelCheck = resource.properties.model ? JSON.parse(JSON.stringify(resource.properties.model)) : undefined;
|
|
19
|
+
const actionsCheck = resource.properties.actions;
|
|
20
|
+
const modelAndPopulatedString = ResourceHelper_1.default.setModelSchema(schema, modelCheck, modelName);
|
|
21
|
+
modifiedResource.properties.model = modelAndPopulatedString[0];
|
|
22
|
+
modifiedResource.properties.populatedString = modelAndPopulatedString[1];
|
|
23
|
+
const modifiedProperties = ResourceHelper_1.default.addVirtualFields(JSON.parse(JSON.stringify(recordFields)), modelCheck);
|
|
24
|
+
modifiedResource.properties.path = ResourceHelper_1.default.getModelPath(modelName);
|
|
25
|
+
const modifiedListProperties = modifiedProperties[0];
|
|
26
|
+
const modifiedShowProperties = modifiedProperties[1];
|
|
27
|
+
const modifiedFormProperties = modifiedProperties[2];
|
|
28
|
+
if (!resource.properties.parent) {
|
|
29
|
+
//modifiedResource.properties.parent = SetupParent
|
|
30
|
+
}
|
|
31
|
+
if (!resource.properties.name) {
|
|
32
|
+
modifiedResource.properties.name = StringUtils_1.default.convertCamelCaseToWord(modelName);
|
|
33
|
+
}
|
|
34
|
+
if (!resource.showProperties) {
|
|
35
|
+
modifiedResource.showProperties = modifiedShowProperties;
|
|
36
|
+
}
|
|
37
|
+
if (!resource.listProperties) {
|
|
38
|
+
modifiedResource.listProperties = ResourceHelper_1.default.exchangeFirstFieldWithTitle(JSON.parse(JSON.stringify(modifiedListProperties)), title);
|
|
39
|
+
}
|
|
40
|
+
if (!resource.formProperties) {
|
|
41
|
+
modifiedResource.formProperties = ResourceHelper_1.default.removeUnWantedFieldsFromCreateOrUpdate(JSON.parse(JSON.stringify(modifiedFormProperties)));
|
|
42
|
+
}
|
|
43
|
+
modifiedResource.properties.title = title;
|
|
44
|
+
if (!resource.properties.defaultOrderBy) {
|
|
45
|
+
modifiedResource.properties.defaultOrderBy = title;
|
|
46
|
+
}
|
|
47
|
+
if (!resource.properties.defaultOrder) {
|
|
48
|
+
modifiedResource.properties.defaultOrder = 'asc';
|
|
49
|
+
}
|
|
50
|
+
if (!resource.properties.defaultrowsPerPage) {
|
|
51
|
+
modifiedResource.properties.defaultrowsPerPage = 10;
|
|
52
|
+
}
|
|
53
|
+
modifiedResource.listProperties = ResourceHelper_1.default.prepareProperties(resource.listProperties ? resource.listProperties : modifiedResource.listProperties, modelName, modifiedResource.properties.model);
|
|
54
|
+
modifiedResource.showProperties = ResourceHelper_1.default.prepareProperties(resource.showProperties ? resource.showProperties : modifiedResource.showProperties, modelName, modifiedResource.properties.model);
|
|
55
|
+
modifiedResource.properties.filters = ResourceHelper_1.default.getFilters(resource.properties.filters ? JSON.parse(JSON.stringify(resource.properties.filters)) : undefined);
|
|
56
|
+
if (modifiedResource.properties.filters.scopes.isAccessible) {
|
|
57
|
+
const options = (_c = (_b = (_a = resource === null || resource === void 0 ? void 0 : resource.properties) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.scopes) === null || _c === void 0 ? void 0 : _c.options;
|
|
58
|
+
modifiedResource.properties.filters.scopes.options = ResourceHelper_1.default.setScopeFilterOptions(modelName, options);
|
|
59
|
+
}
|
|
60
|
+
const actions = ResourceHelper_1.default.getActions(actionsCheck ? JSON.parse(JSON.stringify(resource.properties.actions)) : undefined); //resource.properties.actions? ResourcesHelper.getActions(JSON.parse(JSON.stringify(resource.properties.actions))): ResourcesHelper.getActions(undefined)
|
|
61
|
+
for (const key in actions) {
|
|
62
|
+
if (key === 'extras') {
|
|
63
|
+
actions.extras = actions.extras ? ResourceHelper_1.default.addExtraActions(JSON.parse(JSON.stringify((_e = (_d = resource === null || resource === void 0 ? void 0 : resource.properties) === null || _d === void 0 ? void 0 : _d.actions) === null || _e === void 0 ? void 0 : _e.extras))) : actions.extras;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const translation = ResourceHelper_1.default.checkActionTranslation(modelName, key);
|
|
67
|
+
actions[key] = ResourceHelper_1.default.appendActionValues(key, actions[key], translation);
|
|
68
|
+
}
|
|
69
|
+
modifiedResource.properties.actions = actions;
|
|
70
|
+
return modifiedResource;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.default = LocalesHelper;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IResourceFile } from "../types/IResourceFile";
|
|
2
|
-
export default class LocalizedStringHelper {
|
|
3
|
-
static mapLocalizableString(recordParams: any, resource: IResourceFile): any;
|
|
4
|
-
private static getArrayOfLanguages;
|
|
5
|
-
static checkLocalizedStringType(resource: IResourceFile, fieldName: string): boolean;
|
|
6
|
-
static getFilterObject(searchBy: string, index: string, value: any): {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
1
|
+
import { IResourceFile } from "../types/IResourceFile";
|
|
2
|
+
export default class LocalizedStringHelper {
|
|
3
|
+
static mapLocalizableString(recordParams: any, resource: IResourceFile): any;
|
|
4
|
+
private static getArrayOfLanguages;
|
|
5
|
+
static checkLocalizedStringType(resource: IResourceFile, fieldName: string): boolean;
|
|
6
|
+
static getFilterObject(searchBy: string, index: string, value: any): {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const helpers_1 = require("../types/helpers");
|
|
4
|
-
class LocalizedStringHelper {
|
|
5
|
-
static mapLocalizableString(recordParams, resource) {
|
|
6
|
-
const modelObject = resource.properties.model;
|
|
7
|
-
if (!modelObject) {
|
|
8
|
-
return recordParams;
|
|
9
|
-
}
|
|
10
|
-
for (const key in modelObject) {
|
|
11
|
-
if (!modelObject.hasOwnProperty(key) || key === 'virtuals') {
|
|
12
|
-
continue;
|
|
13
|
-
}
|
|
14
|
-
const castedModelObject = modelObject;
|
|
15
|
-
if (castedModelObject[key].type && castedModelObject[key].type === helpers_1.FieldTypes.LOCALIZEDSTRING && recordParams[key]) {
|
|
16
|
-
recordParams[key] = this.getArrayOfLanguages(recordParams[key]);
|
|
17
|
-
}
|
|
18
|
-
else if (castedModelObject[key].arrayType && castedModelObject[key].arrayType === helpers_1.FieldTypes.LOCALIZEDSTRING && recordParams[key] && recordParams[key].length !== 0) {
|
|
19
|
-
for (var j = 0; j < recordParams[key].length; j++) {
|
|
20
|
-
recordParams[key][j] = this.getArrayOfLanguages(recordParams[key][j]);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return recordParams;
|
|
25
|
-
}
|
|
26
|
-
static getArrayOfLanguages(record) {
|
|
27
|
-
var localizedArray = [];
|
|
28
|
-
for (const language in record) {
|
|
29
|
-
if (!record.hasOwnProperty(language)) {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
const languageObject = {
|
|
33
|
-
key: language,
|
|
34
|
-
value: record[language] ? record[language] : undefined
|
|
35
|
-
};
|
|
36
|
-
localizedArray.push(languageObject);
|
|
37
|
-
}
|
|
38
|
-
return localizedArray;
|
|
39
|
-
}
|
|
40
|
-
static checkLocalizedStringType(resource, fieldName) {
|
|
41
|
-
const modelObject = resource.properties.model;
|
|
42
|
-
if (!modelObject || !modelObject.hasOwnProperty(fieldName)) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
const castedModelObject = modelObject;
|
|
46
|
-
if (castedModelObject[fieldName].type && castedModelObject[fieldName].type === helpers_1.FieldTypes.LOCALIZEDSTRING) {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
static getFilterObject(searchBy, index, value) {
|
|
52
|
-
const filterObject = {};
|
|
53
|
-
filterObject[`${searchBy}.${index}.value`] = value;
|
|
54
|
-
return filterObject;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.default = LocalizedStringHelper;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const helpers_1 = require("../types/helpers");
|
|
4
|
+
class LocalizedStringHelper {
|
|
5
|
+
static mapLocalizableString(recordParams, resource) {
|
|
6
|
+
const modelObject = resource.properties.model;
|
|
7
|
+
if (!modelObject) {
|
|
8
|
+
return recordParams;
|
|
9
|
+
}
|
|
10
|
+
for (const key in modelObject) {
|
|
11
|
+
if (!modelObject.hasOwnProperty(key) || key === 'virtuals') {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
const castedModelObject = modelObject;
|
|
15
|
+
if (castedModelObject[key].type && castedModelObject[key].type === helpers_1.FieldTypes.LOCALIZEDSTRING && recordParams[key]) {
|
|
16
|
+
recordParams[key] = this.getArrayOfLanguages(recordParams[key]);
|
|
17
|
+
}
|
|
18
|
+
else if (castedModelObject[key].arrayType && castedModelObject[key].arrayType === helpers_1.FieldTypes.LOCALIZEDSTRING && recordParams[key] && recordParams[key].length !== 0) {
|
|
19
|
+
for (var j = 0; j < recordParams[key].length; j++) {
|
|
20
|
+
recordParams[key][j] = this.getArrayOfLanguages(recordParams[key][j]);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return recordParams;
|
|
25
|
+
}
|
|
26
|
+
static getArrayOfLanguages(record) {
|
|
27
|
+
var localizedArray = [];
|
|
28
|
+
for (const language in record) {
|
|
29
|
+
if (!record.hasOwnProperty(language)) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const languageObject = {
|
|
33
|
+
key: language,
|
|
34
|
+
value: record[language] ? record[language] : undefined
|
|
35
|
+
};
|
|
36
|
+
localizedArray.push(languageObject);
|
|
37
|
+
}
|
|
38
|
+
return localizedArray;
|
|
39
|
+
}
|
|
40
|
+
static checkLocalizedStringType(resource, fieldName) {
|
|
41
|
+
const modelObject = resource.properties.model;
|
|
42
|
+
if (!modelObject || !modelObject.hasOwnProperty(fieldName)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
const castedModelObject = modelObject;
|
|
46
|
+
if (castedModelObject[fieldName].type && castedModelObject[fieldName].type === helpers_1.FieldTypes.LOCALIZEDSTRING) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
static getFilterObject(searchBy, index, value) {
|
|
52
|
+
const filterObject = {};
|
|
53
|
+
filterObject[`${searchBy}.${index}.value`] = value;
|
|
54
|
+
return filterObject;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.default = LocalizedStringHelper;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { IResourceFile } from "../types/IResourceFile";
|
|
2
|
-
export declare enum PopulationType {
|
|
3
|
-
LIST = "LIST",
|
|
4
|
-
SHOW = "SHOW"
|
|
5
|
-
}
|
|
6
|
-
export declare class PopulationHelper {
|
|
7
|
-
private resource;
|
|
8
|
-
private populatedString;
|
|
9
|
-
private populationType;
|
|
10
|
-
constructor(resource: IResourceFile, populationType: PopulationType, populatedString: any);
|
|
11
|
-
get(): Promise<any>;
|
|
12
|
-
}
|
|
1
|
+
import { IResourceFile } from "../types/IResourceFile";
|
|
2
|
+
export declare enum PopulationType {
|
|
3
|
+
LIST = "LIST",
|
|
4
|
+
SHOW = "SHOW"
|
|
5
|
+
}
|
|
6
|
+
export declare class PopulationHelper {
|
|
7
|
+
private resource;
|
|
8
|
+
private populatedString;
|
|
9
|
+
private populationType;
|
|
10
|
+
constructor(resource: IResourceFile, populationType: PopulationType, populatedString: any);
|
|
11
|
+
get(): Promise<any>;
|
|
12
|
+
}
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.PopulationHelper = exports.PopulationType = void 0;
|
|
13
|
-
var PopulationType;
|
|
14
|
-
(function (PopulationType) {
|
|
15
|
-
PopulationType["LIST"] = "LIST";
|
|
16
|
-
PopulationType["SHOW"] = "SHOW";
|
|
17
|
-
})(PopulationType = exports.PopulationType || (exports.PopulationType = {}));
|
|
18
|
-
class PopulationHelper {
|
|
19
|
-
constructor(resource, populationType, populatedString) {
|
|
20
|
-
this.resource = resource;
|
|
21
|
-
this.populatedString = populatedString;
|
|
22
|
-
this.populationType = populationType;
|
|
23
|
-
}
|
|
24
|
-
get() {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const { populate } = this.resource.properties;
|
|
27
|
-
if (!populate) {
|
|
28
|
-
return this.populatedString;
|
|
29
|
-
}
|
|
30
|
-
if (!populate.all && !populate.list && !populate.show) {
|
|
31
|
-
return this.populatedString;
|
|
32
|
-
}
|
|
33
|
-
if (populate.all) {
|
|
34
|
-
return yield populate.all(this.populatedString);
|
|
35
|
-
}
|
|
36
|
-
if (this.populationType === PopulationType.LIST) {
|
|
37
|
-
if (populate.list) {
|
|
38
|
-
return yield populate.list(this.populatedString);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
if (populate.show) {
|
|
43
|
-
return yield populate.show(this.populatedString);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return this.populatedString;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.PopulationHelper = PopulationHelper;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PopulationHelper = exports.PopulationType = void 0;
|
|
13
|
+
var PopulationType;
|
|
14
|
+
(function (PopulationType) {
|
|
15
|
+
PopulationType["LIST"] = "LIST";
|
|
16
|
+
PopulationType["SHOW"] = "SHOW";
|
|
17
|
+
})(PopulationType = exports.PopulationType || (exports.PopulationType = {}));
|
|
18
|
+
class PopulationHelper {
|
|
19
|
+
constructor(resource, populationType, populatedString) {
|
|
20
|
+
this.resource = resource;
|
|
21
|
+
this.populatedString = populatedString;
|
|
22
|
+
this.populationType = populationType;
|
|
23
|
+
}
|
|
24
|
+
get() {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const { populate } = this.resource.properties;
|
|
27
|
+
if (!populate) {
|
|
28
|
+
return this.populatedString;
|
|
29
|
+
}
|
|
30
|
+
if (!populate.all && !populate.list && !populate.show) {
|
|
31
|
+
return this.populatedString;
|
|
32
|
+
}
|
|
33
|
+
if (populate.all) {
|
|
34
|
+
return yield populate.all(this.populatedString);
|
|
35
|
+
}
|
|
36
|
+
if (this.populationType === PopulationType.LIST) {
|
|
37
|
+
if (populate.list) {
|
|
38
|
+
return yield populate.list(this.populatedString);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
if (populate.show) {
|
|
43
|
+
return yield populate.show(this.populatedString);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return this.populatedString;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.PopulationHelper = PopulationHelper;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Document } from "mongoose";
|
|
2
|
-
import { IResourceFile } from "../types/IResourceFile";
|
|
3
|
-
import { IConfiguartionFile } from "../types/IConfigurationFile";
|
|
4
|
-
import { IModelConfigurationDocument } from "../models/modelConfiguration/IModelConfigurations";
|
|
5
|
-
export default class ResourceGenerator {
|
|
6
|
-
static generate(resource: IResourceFile, currentUser: Document, configurations?: IConfiguartionFile, modelConfigurations?: Map<string, IModelConfigurationDocument>): any;
|
|
7
|
-
}
|
|
1
|
+
import { Document } from "mongoose";
|
|
2
|
+
import { IResourceFile } from "../types/IResourceFile";
|
|
3
|
+
import { IConfiguartionFile } from "../types/IConfigurationFile";
|
|
4
|
+
import { IModelConfigurationDocument } from "../models/modelConfiguration/IModelConfigurations";
|
|
5
|
+
export default class ResourceGenerator {
|
|
6
|
+
static generate(resource: IResourceFile, currentUser: Document, configurations?: IConfiguartionFile, modelConfigurations?: Map<string, IModelConfigurationDocument>): any;
|
|
7
|
+
}
|