@itrocks/framework 0.2.2 → 0.2.3
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/cjs/dependencies.js +29 -13
- package/package.json +1 -1
package/cjs/dependencies.js
CHANGED
|
@@ -6,6 +6,8 @@ const lazy_loading_1 = require("@itrocks/lazy-loading");
|
|
|
6
6
|
const action_1 = require("@itrocks/action");
|
|
7
7
|
const app_dir_1 = require("@itrocks/app-dir");
|
|
8
8
|
const class_file_1 = require("@itrocks/class-file");
|
|
9
|
+
const class_type_1 = require("@itrocks/class-type");
|
|
10
|
+
const class_type_2 = require("@itrocks/class-type");
|
|
9
11
|
const class_view_1 = require("@itrocks/class-view");
|
|
10
12
|
const class_view_2 = require("@itrocks/class-view");
|
|
11
13
|
const collection_1 = require("@itrocks/collection");
|
|
@@ -16,7 +18,6 @@ const core_transformers_2 = require("@itrocks/core-transformers");
|
|
|
16
18
|
const file_1 = require("@itrocks/file");
|
|
17
19
|
const lazy_loading_2 = require("@itrocks/lazy-loading");
|
|
18
20
|
const list_properties_1 = require("@itrocks/list-properties");
|
|
19
|
-
const menu_1 = require("@itrocks/menu");
|
|
20
21
|
const mysql_1 = require("@itrocks/mysql");
|
|
21
22
|
const password_1 = require("@itrocks/password");
|
|
22
23
|
const transformers_1 = require("@itrocks/password/transformers");
|
|
@@ -42,7 +43,6 @@ const translate_1 = require("@itrocks/translate");
|
|
|
42
43
|
const date_fns_1 = require("date-fns");
|
|
43
44
|
const node_path_1 = require("node:path");
|
|
44
45
|
const node_path_2 = require("node:path");
|
|
45
|
-
const menu = new menu_1.Menu(config_1.config.menu);
|
|
46
46
|
async function propertyOutput(object, property) {
|
|
47
47
|
return (0, transformer_1.applyTransformer)(await object[property], object, property, transformer_2.HTML, transformer_3.OUTPUT);
|
|
48
48
|
}
|
|
@@ -109,20 +109,36 @@ function bind() {
|
|
|
109
109
|
(0, translate_1.trLoad)((0, node_path_1.join)(app_dir_1.appDir, 'app', 'fr-FR.csv')).catch();
|
|
110
110
|
(0, translate_1.trLoad)((0, node_path_1.join)(app_dir_1.appDir, 'fr-FR.csv')).catch();
|
|
111
111
|
action_1.Action.prototype.htmlTemplateResponse = async function (data, request, templateFile, statusCode = 200, headers = {}) {
|
|
112
|
-
const containerData =
|
|
113
|
-
action: request.action,
|
|
114
|
-
favicon: config_1.config.container?.favicon ?? (0, node_path_2.normalize)((0, node_path_1.join)(__dirname, '../favicon.ico')),
|
|
115
|
-
manifest: config_1.config.container?.manifest ? [config_1.config.container.manifest] : [],
|
|
116
|
-
menu,
|
|
117
|
-
request,
|
|
118
|
-
scripts: config_1.config.container?.scripts,
|
|
119
|
-
session: request.request.session,
|
|
120
|
-
styleSheets: config_1.config.container?.styleSheets,
|
|
121
|
-
};
|
|
122
|
-
Object.assign(containerData, this);
|
|
112
|
+
const containerData = Object.assign(defaultContainerData(request), this);
|
|
123
113
|
const contained = !request.request.headers['xhr-info'] && config_1.config.container?.file;
|
|
124
114
|
const template = new template_insight_1.Template(data, containerData);
|
|
125
115
|
return this.htmlResponse(await template.parseFile(templateFile, contained && (0, node_path_1.join)(app_dir_1.appDir, config_1.config.container.file)), statusCode, headers);
|
|
126
116
|
};
|
|
127
117
|
}
|
|
118
|
+
function configContainerData() {
|
|
119
|
+
const configContainerData = config_1.config.container?.data ?? {};
|
|
120
|
+
for (const [name, value] of Object.entries(configContainerData)) {
|
|
121
|
+
if ((typeof value === 'string') && '@.'.includes(value[0])) {
|
|
122
|
+
const exported = value.includes(':')
|
|
123
|
+
? require(value.split(':')[0])[value.split(':')[1]]
|
|
124
|
+
: (require(value).default ?? Object.values(require(value))[0]);
|
|
125
|
+
configContainerData[name] =
|
|
126
|
+
(0, class_type_1.isAnyFunction)(exported) ? exported(config_1.config[name]) :
|
|
127
|
+
(0, class_type_2.isAnyType)(exported) ? new exported(config_1.config[name]) :
|
|
128
|
+
exported;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return configContainerData;
|
|
132
|
+
}
|
|
133
|
+
function defaultContainerData(request) {
|
|
134
|
+
return Object.assign({
|
|
135
|
+
action: request.action,
|
|
136
|
+
favicon: config_1.config.container?.favicon ?? (0, node_path_2.normalize)((0, node_path_1.join)(__dirname, '../favicon.ico')),
|
|
137
|
+
manifest: config_1.config.container?.manifest ? [config_1.config.container.manifest] : [],
|
|
138
|
+
request,
|
|
139
|
+
scripts: config_1.config.container?.scripts,
|
|
140
|
+
session: request.request.session,
|
|
141
|
+
styleSheets: config_1.config.container?.styleSheets,
|
|
142
|
+
}, configContainerData());
|
|
143
|
+
}
|
|
128
144
|
//# sourceMappingURL=dependencies.js.map
|
package/package.json
CHANGED