@itrocks/framework 0.0.14 → 0.0.15
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.d.ts +1 -0
- package/cjs/dependencies.js +94 -0
- package/cjs/framework.d.ts +2 -1
- package/cjs/framework.js +13 -172
- package/cjs/main.d.ts +1 -0
- package/cjs/main.js +66 -0
- package/cjs/workflow.d.ts +1 -0
- package/cjs/workflow.js +19 -0
- package/package.json +3 -8
- package/cjs/access.d.ts +0 -1
- package/cjs/access.js +0 -14
- package/cjs/class.d.ts +0 -9
- package/cjs/class.js +0 -35
- package/cjs/compose.d.ts +0 -1
- package/cjs/compose.js +0 -10
- package/cjs/config.d.ts +0 -2
- package/cjs/config.js +0 -32
- package/cjs/menu.d.ts +0 -1
- package/cjs/menu.js +0 -11
- package/cjs/property.d.ts +0 -10
- package/cjs/property.js +0 -32
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function bind(): void;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bind = bind;
|
|
4
|
+
const lazy_loading_1 = require("@itrocks/lazy-loading");
|
|
5
|
+
(0, lazy_loading_1.initLazyLoading)();
|
|
6
|
+
const action_1 = require("@itrocks/action");
|
|
7
|
+
const app_dir_1 = require("@itrocks/app-dir");
|
|
8
|
+
const class_file_1 = require("@itrocks/class-file");
|
|
9
|
+
const class_view_1 = require("@itrocks/class-view");
|
|
10
|
+
const class_view_2 = require("@itrocks/class-view");
|
|
11
|
+
const collection_1 = require("@itrocks/collection");
|
|
12
|
+
const composition_1 = require("@itrocks/composition");
|
|
13
|
+
const config_1 = require("@itrocks/config");
|
|
14
|
+
const core_transformers_1 = require("@itrocks/core-transformers");
|
|
15
|
+
const core_transformers_2 = require("@itrocks/core-transformers");
|
|
16
|
+
const lazy_loading_2 = require("@itrocks/lazy-loading");
|
|
17
|
+
const menu_1 = require("@itrocks/menu");
|
|
18
|
+
const mysql_1 = require("@itrocks/mysql");
|
|
19
|
+
const password_1 = require("@itrocks/password");
|
|
20
|
+
const transformers_1 = require("@itrocks/password/transformers");
|
|
21
|
+
const property_view_1 = require("@itrocks/property-view");
|
|
22
|
+
const rename_1 = require("@itrocks/rename");
|
|
23
|
+
const required_1 = require("@itrocks/required");
|
|
24
|
+
const route_1 = require("@itrocks/route");
|
|
25
|
+
const route_2 = require("@itrocks/route");
|
|
26
|
+
const sql_functions_1 = require("@itrocks/sql-functions");
|
|
27
|
+
const storage_1 = require("@itrocks/storage");
|
|
28
|
+
const store_1 = require("@itrocks/store");
|
|
29
|
+
const store_2 = require("@itrocks/store");
|
|
30
|
+
const transformer_1 = require("@itrocks/transformer");
|
|
31
|
+
const transformer_2 = require("@itrocks/transformer");
|
|
32
|
+
const transformer_3 = require("@itrocks/transformer");
|
|
33
|
+
const translate_1 = require("@itrocks/translate");
|
|
34
|
+
const date_fns_1 = require("date-fns");
|
|
35
|
+
const node_path_1 = require("node:path");
|
|
36
|
+
const template_1 = require("./template");
|
|
37
|
+
const menu = new menu_1.Menu(config_1.config.menu);
|
|
38
|
+
function bind() {
|
|
39
|
+
(0, class_view_1.classViewDependsOn)({ requiredOf: required_1.requiredOf, tr: translate_1.tr });
|
|
40
|
+
(0, storage_1.createDataSource)(config_1.config.dataSource);
|
|
41
|
+
(0, collection_1.initCollection)();
|
|
42
|
+
(0, core_transformers_1.initCoreTransformers)({
|
|
43
|
+
displayOf: property_view_1.displayOf,
|
|
44
|
+
formatDate: date => (0, date_fns_1.format)(date, (0, translate_1.tr)('dd/MM/yyyy', { ucFirst: false })),
|
|
45
|
+
ignoreTransformedValue: transformer_2.IGNORE,
|
|
46
|
+
parseDate: date => (0, date_fns_1.parse)(date, (0, translate_1.tr)('dd/MM/yyyy', { ucFirst: false }), new Date),
|
|
47
|
+
representativeValueOf: class_view_2.representativeValueOf,
|
|
48
|
+
routeOf: route_2.routeOf,
|
|
49
|
+
tr: translate_1.tr
|
|
50
|
+
});
|
|
51
|
+
(0, mysql_1.mysqlDependsOn)({
|
|
52
|
+
applyReadTransformer: async function (data, property, object) {
|
|
53
|
+
const value = await (0, transformer_1.applyTransformer)(data[property], object, property, transformer_3.SQL, transformer_3.READ, data);
|
|
54
|
+
if ((value !== transformer_2.IGNORE) && Reflect.getOwnMetadata(lazy_loading_2.PROTECT_GET, object, property)) {
|
|
55
|
+
Reflect.deleteMetadata(lazy_loading_2.PROTECT_GET, object, property);
|
|
56
|
+
}
|
|
57
|
+
return value;
|
|
58
|
+
},
|
|
59
|
+
applySaveTransformer: async function (object, property, data) {
|
|
60
|
+
const value = Reflect.getMetadata(lazy_loading_2.PROTECT_GET, object, property) ? undefined : await object[property];
|
|
61
|
+
return (0, transformer_1.applyTransformer)(value, object, property, transformer_3.SQL, transformer_3.SAVE, data);
|
|
62
|
+
},
|
|
63
|
+
columnOf: rename_1.toColumn,
|
|
64
|
+
componentOf: composition_1.componentOf,
|
|
65
|
+
ignoreTransformedValue: transformer_2.IGNORE,
|
|
66
|
+
QueryFunction: sql_functions_1.SqlFunction,
|
|
67
|
+
queryFunctionCall: value => [value.value, value.sql],
|
|
68
|
+
storeOf: store_2.storeOf
|
|
69
|
+
});
|
|
70
|
+
(0, password_1.passwordDependsOn)({
|
|
71
|
+
setTransformers: transformers_1.setPasswordTransformers
|
|
72
|
+
});
|
|
73
|
+
(0, route_1.routeDependsOn)({
|
|
74
|
+
calculate: (target) => route_2.routes.summarize((0, class_file_1.fileOf)(target).slice(app_dir_1.appDir.length, -3))
|
|
75
|
+
});
|
|
76
|
+
(0, store_1.storeDependsOn)({
|
|
77
|
+
setTransformers: core_transformers_2.initStoreTransformers,
|
|
78
|
+
toStoreName: rename_1.toColumn
|
|
79
|
+
});
|
|
80
|
+
(0, translate_1.trInit)('fr-FR', (0, node_path_1.normalize)((0, node_path_1.join)(__dirname, '..', 'fr-FR.csv')));
|
|
81
|
+
action_1.Action.prototype.htmlTemplateResponse = async function (data, request, templateFile, statusCode = 200, headers = {}) {
|
|
82
|
+
const containerData = {
|
|
83
|
+
action: request.action,
|
|
84
|
+
actions: this.actions,
|
|
85
|
+
menu,
|
|
86
|
+
request,
|
|
87
|
+
session: request.request.session
|
|
88
|
+
};
|
|
89
|
+
const template = new template_1.Template(data, containerData);
|
|
90
|
+
template.included = (request.request.headers['sec-fetch-dest'] === 'empty');
|
|
91
|
+
return this.htmlResponse(await template.parseFile(templateFile, (0, node_path_1.join)(app_dir_1.appDir, config_1.config.container)), statusCode, headers);
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=dependencies.js.map
|
package/cjs/framework.d.ts
CHANGED
package/cjs/framework.js
CHANGED
|
@@ -1,177 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ReflectProperty = exports.ReflectClass = void 0;
|
|
4
4
|
require("@itrocks/class-file/automation");
|
|
5
5
|
const compose_1 = require("@itrocks/compose");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const class_type_1 = require("@itrocks/class-type");
|
|
19
|
-
const class_view_1 = require("@itrocks/class-view");
|
|
20
|
-
const class_view_2 = require("@itrocks/class-view");
|
|
21
|
-
const collection_1 = require("@itrocks/collection");
|
|
22
|
-
const composition_1 = require("@itrocks/composition");
|
|
23
|
-
const core_transformers_1 = require("@itrocks/core-transformers");
|
|
24
|
-
const core_transformers_2 = require("@itrocks/core-transformers");
|
|
25
|
-
const fastify_1 = require("@itrocks/fastify");
|
|
26
|
-
const fastify_file_session_store_1 = require("@itrocks/fastify-file-session-store");
|
|
27
|
-
const lazy_loading_2 = require("@itrocks/lazy-loading");
|
|
28
|
-
const menu_1 = require("@itrocks/menu");
|
|
29
|
-
const mysql_1 = require("@itrocks/mysql");
|
|
30
|
-
const password_1 = require("@itrocks/password");
|
|
31
|
-
const transformers_1 = require("@itrocks/password/transformers");
|
|
32
|
-
const property_view_1 = require("@itrocks/property-view");
|
|
33
|
-
const rename_1 = require("@itrocks/rename");
|
|
34
|
-
const required_1 = require("@itrocks/required");
|
|
35
|
-
const route_1 = require("@itrocks/route");
|
|
36
|
-
const route_2 = require("@itrocks/route");
|
|
37
|
-
const route_3 = require("@itrocks/route");
|
|
38
|
-
const sql_functions_1 = require("@itrocks/sql-functions");
|
|
39
|
-
const storage_1 = require("@itrocks/storage");
|
|
40
|
-
const store_1 = require("@itrocks/store");
|
|
41
|
-
const store_2 = require("@itrocks/store");
|
|
42
|
-
const template_1 = require("@itrocks/template");
|
|
43
|
-
const transformer_1 = require("@itrocks/transformer");
|
|
44
|
-
const transformer_2 = require("@itrocks/transformer");
|
|
45
|
-
const transformer_3 = require("@itrocks/transformer");
|
|
46
|
-
const translate_1 = require("@itrocks/translate");
|
|
47
|
-
const date_fns_1 = require("date-fns");
|
|
48
|
-
const node_path_1 = require("node:path");
|
|
49
|
-
const data_source_1 = require("../../../../local/data-source");
|
|
50
|
-
const secret_1 = require("../../../../local/secret");
|
|
51
|
-
const session_1 = require("../../../../local/session");
|
|
52
|
-
const access_1 = require("./access");
|
|
53
|
-
const menu_2 = require("./menu");
|
|
54
|
-
const template_2 = require("./template");
|
|
55
|
-
const menu = new menu_1.Menu(menu_2.menuConfig);
|
|
56
|
-
let routes;
|
|
57
|
-
template_1.frontScripts.push('/node_modules/air-datepicker/locale/en.js', '/node_modules/air-datepicker/locale/fr.js');
|
|
58
|
-
function bindDependencies() {
|
|
59
|
-
(0, class_view_1.classViewDependsOn)({ requiredOf: required_1.requiredOf, tr: translate_1.tr });
|
|
60
|
-
(0, storage_1.createDataSource)(data_source_1.localDataSource);
|
|
61
|
-
(0, collection_1.initCollection)();
|
|
62
|
-
(0, core_transformers_1.initCoreTransformers)({
|
|
63
|
-
displayOf: property_view_1.displayOf,
|
|
64
|
-
formatDate: date => (0, date_fns_1.format)(date, (0, translate_1.tr)('dd/MM/yyyy', { ucFirst: false })),
|
|
65
|
-
ignoreTransformedValue: transformer_2.IGNORE,
|
|
66
|
-
parseDate: date => (0, date_fns_1.parse)(date, (0, translate_1.tr)('dd/MM/yyyy', { ucFirst: false }), new Date),
|
|
67
|
-
representativeValueOf: class_view_2.representativeValueOf,
|
|
68
|
-
routeOf: route_3.routeOf,
|
|
69
|
-
tr: translate_1.tr
|
|
70
|
-
});
|
|
71
|
-
(0, mysql_1.mysqlDependsOn)({
|
|
72
|
-
applyReadTransformer: async function (data, property, object) {
|
|
73
|
-
const value = await (0, transformer_1.applyTransformer)(data[property], object, property, transformer_3.SQL, transformer_3.READ, data);
|
|
74
|
-
if ((value !== transformer_2.IGNORE) && Reflect.getOwnMetadata(lazy_loading_2.PROTECT_GET, object, property)) {
|
|
75
|
-
Reflect.deleteMetadata(lazy_loading_2.PROTECT_GET, object, property);
|
|
76
|
-
}
|
|
77
|
-
return value;
|
|
78
|
-
},
|
|
79
|
-
applySaveTransformer: async function (object, property, data) {
|
|
80
|
-
const value = Reflect.getMetadata(lazy_loading_2.PROTECT_GET, object, property) ? undefined : await object[property];
|
|
81
|
-
return (0, transformer_1.applyTransformer)(value, object, property, transformer_3.SQL, transformer_3.SAVE, data);
|
|
82
|
-
},
|
|
83
|
-
columnOf: rename_1.toColumn,
|
|
84
|
-
componentOf: composition_1.componentOf,
|
|
85
|
-
ignoreTransformedValue: transformer_2.IGNORE,
|
|
86
|
-
QueryFunction: sql_functions_1.SqlFunction,
|
|
87
|
-
queryFunctionCall: value => [value.value, value.sql],
|
|
88
|
-
storeOf: store_2.storeOf
|
|
89
|
-
});
|
|
90
|
-
(0, password_1.passwordDependsOn)({
|
|
91
|
-
setTransformers: transformers_1.setPasswordTransformers
|
|
92
|
-
});
|
|
93
|
-
(0, route_2.routeDependsOn)({
|
|
94
|
-
calculate: (target) => routes.summarize((0, class_file_1.fileOf)(target).slice(app_dir_1.appDir.length, -3))
|
|
95
|
-
});
|
|
96
|
-
(0, store_1.storeDependsOn)({
|
|
97
|
-
setTransformers: core_transformers_2.initStoreTransformers,
|
|
98
|
-
toStoreName: rename_1.toColumn
|
|
99
|
-
});
|
|
100
|
-
(0, translate_1.trInit)('fr-FR', (0, node_path_1.normalize)(__dirname + '/../fr-FR.csv'));
|
|
101
|
-
action_1.Action.prototype.htmlTemplateResponse = async function (data, request, templateFile, statusCode = 200, headers = {}) {
|
|
102
|
-
const containerData = {
|
|
103
|
-
action: request.action,
|
|
104
|
-
actions: this.actions,
|
|
105
|
-
menu,
|
|
106
|
-
request,
|
|
107
|
-
session: request.request.session
|
|
108
|
-
};
|
|
109
|
-
const template = new template_2.Template(data, containerData);
|
|
110
|
-
template.included = (request.request.headers['sec-fetch-dest'] === 'empty');
|
|
111
|
-
return this.htmlResponse(await template.parseFile(templateFile, __dirname + '/../../home/cjs/container.html'), statusCode, headers);
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
function buildWorkflow() {
|
|
115
|
-
(0, action_2.setActionCss)({ file: '/node_modules/@itrocks/(action)/css/action.css' });
|
|
116
|
-
(0, action_3.setActionTemplates)({ need: 'object', file: __dirname + '/../../action/cjs/selectionAction.html' }, { file: __dirname + '/../../action/cjs/action.html' });
|
|
117
|
-
(0, action_1.setAction)('edit', 'delete');
|
|
118
|
-
(0, action_1.setAction)('login', 'forgot-password');
|
|
119
|
-
(0, action_1.setAction)('login', 'signup', { caption: 'Sign up' });
|
|
120
|
-
(0, action_1.setAction)('list', 'new');
|
|
121
|
-
(0, action_1.setAction)('list', 'delete', { need: 'object' });
|
|
122
|
-
(0, action_1.setAction)('output', 'edit');
|
|
123
|
-
(0, action_1.setAction)('output', 'print', { target: undefined });
|
|
124
|
-
(0, action_1.setAction)('output', 'delete');
|
|
125
|
-
}
|
|
126
|
-
async function execute(request) {
|
|
127
|
-
// Access control
|
|
128
|
-
if (!request.request.session.user && !access_1.accessConfig.free.includes(request.route + '/' + request.action)) {
|
|
129
|
-
request.action = 'login';
|
|
130
|
-
request.route = '/user';
|
|
131
|
-
}
|
|
132
|
-
// Resolve action class or function module
|
|
133
|
-
const module = routes.resolve(request.route + '/' + request.action);
|
|
134
|
-
// undefined module
|
|
135
|
-
if (!module) {
|
|
136
|
-
console.error('Action ' + request.route + '/' + request.action + ' not found');
|
|
137
|
-
throw 'Action ' + request.route + '/' + request.action + ' not found';
|
|
138
|
-
}
|
|
139
|
-
// ActionClass module
|
|
140
|
-
if ((0, class_type_1.isAnyType)(module)) {
|
|
141
|
-
const action = (new module);
|
|
142
|
-
if (request.format in action) {
|
|
143
|
-
const need = (0, action_4.needOf)(action);
|
|
144
|
-
if (need.alternative
|
|
145
|
-
&& (need.alternative !== request.action)
|
|
146
|
-
&& (((need.need === 'object') && !request.ids.length)
|
|
147
|
-
|| ((need.need === 'Store') && !(0, store_2.storeOf)(request.type)))) {
|
|
148
|
-
request.action = need.alternative;
|
|
149
|
-
return execute(request);
|
|
150
|
-
}
|
|
151
|
-
if ((need.need === 'object') && !request.ids.length && !request.request.data.confirm) {
|
|
152
|
-
console.error('Action ' + request.route + '/' + request.action + ' needs at least one object');
|
|
153
|
-
throw 'Action ' + request.route + '/' + request.action + ' needs at least one ';
|
|
154
|
-
}
|
|
155
|
-
return action[request.format](request);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
// ActionFunction module
|
|
159
|
-
return module(request);
|
|
160
|
-
}
|
|
161
|
-
async function main() {
|
|
162
|
-
bindDependencies();
|
|
163
|
-
buildWorkflow();
|
|
164
|
-
routes = await (0, route_1.loadRoutes)();
|
|
165
|
-
(0, action_request_2.actionRequestDependsOn)({ getModule: routes.resolve.bind(routes) });
|
|
166
|
-
return new fastify_1.FastifyServer({
|
|
167
|
-
assetPath: app_dir_1.appDir,
|
|
168
|
-
execute: request => execute(new action_request_1.Request(request)),
|
|
169
|
-
favicon: '/node_modules/@itrocks/framework/favicon.ico',
|
|
170
|
-
frontScripts: template_1.frontScripts,
|
|
171
|
-
port: 3000,
|
|
172
|
-
scriptCalls: ['loadCss', 'loadScript'],
|
|
173
|
-
secret: secret_1.localSecret,
|
|
174
|
-
store: new fastify_file_session_store_1.FileStore(session_1.localSession.path)
|
|
175
|
-
}).run();
|
|
176
|
-
}
|
|
6
|
+
const config_1 = require("@itrocks/config");
|
|
7
|
+
const config_2 = require("@itrocks/config");
|
|
8
|
+
var reflect_class_1 = require("./reflect-class");
|
|
9
|
+
Object.defineProperty(exports, "ReflectClass", { enumerable: true, get: function () { return reflect_class_1.ReflectClass; } });
|
|
10
|
+
var reflect_property_1 = require("./reflect-property");
|
|
11
|
+
Object.defineProperty(exports, "ReflectProperty", { enumerable: true, get: function () { return reflect_property_1.ReflectProperty; } });
|
|
12
|
+
(0, config_2.scanConfigFiles)().then(() => {
|
|
13
|
+
(0, compose_1.compose)(__dirname, config_1.config.compose);
|
|
14
|
+
require('./dependencies').bind();
|
|
15
|
+
require('./workflow').build();
|
|
16
|
+
require('./main').run();
|
|
17
|
+
});
|
|
177
18
|
//# sourceMappingURL=framework.js.map
|
package/cjs/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function run(): Promise<void>;
|
package/cjs/main.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.run = run;
|
|
4
|
+
const app_dir_1 = require("@itrocks/app-dir");
|
|
5
|
+
const action_1 = require("@itrocks/action");
|
|
6
|
+
const action_request_1 = require("@itrocks/action-request");
|
|
7
|
+
const action_request_2 = require("@itrocks/action-request");
|
|
8
|
+
const class_type_1 = require("@itrocks/class-type");
|
|
9
|
+
const config_1 = require("@itrocks/config");
|
|
10
|
+
const fastify_1 = require("@itrocks/fastify");
|
|
11
|
+
const fastify_file_session_store_1 = require("@itrocks/fastify-file-session-store");
|
|
12
|
+
const route_1 = require("@itrocks/route");
|
|
13
|
+
const store_1 = require("@itrocks/store");
|
|
14
|
+
const template_1 = require("@itrocks/template");
|
|
15
|
+
const node_path_1 = require("node:path");
|
|
16
|
+
template_1.frontScripts.push('/node_modules/air-datepicker/locale/en.js', '/node_modules/air-datepicker/locale/fr.js');
|
|
17
|
+
async function execute(request) {
|
|
18
|
+
// Access control
|
|
19
|
+
if (!request.request.session.user && !config_1.config.access.free.includes(request.route + '/' + request.action)) {
|
|
20
|
+
request.action = 'login';
|
|
21
|
+
request.route = '/user';
|
|
22
|
+
}
|
|
23
|
+
// Resolve action class or function module
|
|
24
|
+
const module = route_1.routes.resolve(request.route + '/' + request.action);
|
|
25
|
+
// undefined module
|
|
26
|
+
if (!module) {
|
|
27
|
+
console.error('Action ' + request.route + '/' + request.action + ' not found');
|
|
28
|
+
throw 'Action ' + request.route + '/' + request.action + ' not found';
|
|
29
|
+
}
|
|
30
|
+
// ActionClass module
|
|
31
|
+
if ((0, class_type_1.isAnyType)(module)) {
|
|
32
|
+
const action = (new module);
|
|
33
|
+
if (request.format in action) {
|
|
34
|
+
const need = (0, action_1.needOf)(action);
|
|
35
|
+
if (need.alternative
|
|
36
|
+
&& (need.alternative !== request.action)
|
|
37
|
+
&& (((need.need === 'object') && !request.ids.length)
|
|
38
|
+
|| ((need.need === 'Store') && !(0, store_1.storeOf)(request.type)))) {
|
|
39
|
+
request.action = need.alternative;
|
|
40
|
+
return execute(request);
|
|
41
|
+
}
|
|
42
|
+
if ((need.need === 'object') && !request.ids.length && !request.request.data.confirm) {
|
|
43
|
+
console.error('Action ' + request.route + '/' + request.action + ' needs at least one object');
|
|
44
|
+
throw 'Action ' + request.route + '/' + request.action + ' needs at least one ';
|
|
45
|
+
}
|
|
46
|
+
return action[request.format](request);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// ActionFunction module
|
|
50
|
+
return module(request);
|
|
51
|
+
}
|
|
52
|
+
async function run() {
|
|
53
|
+
await (0, route_1.loadRoutes)(route_1.routes, config_1.config.routes);
|
|
54
|
+
(0, action_request_1.actionRequestDependsOn)({ getModule: route_1.routes.resolve.bind(route_1.routes) });
|
|
55
|
+
return new fastify_1.FastifyServer({
|
|
56
|
+
assetPath: app_dir_1.appDir,
|
|
57
|
+
execute: request => execute(new action_request_2.Request(request)),
|
|
58
|
+
favicon: '/node_modules/@itrocks/framework/favicon.ico',
|
|
59
|
+
frontScripts: template_1.frontScripts,
|
|
60
|
+
port: 3000,
|
|
61
|
+
scriptCalls: ['loadCss', 'loadScript'],
|
|
62
|
+
secret: config_1.config.secret,
|
|
63
|
+
store: new fastify_file_session_store_1.FileStore((0, node_path_1.join)(app_dir_1.appDir, config_1.config.session.path))
|
|
64
|
+
}).run();
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function build(): void;
|
package/cjs/workflow.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.build = build;
|
|
4
|
+
const action_1 = require("@itrocks/action");
|
|
5
|
+
const action_2 = require("@itrocks/action");
|
|
6
|
+
const action_3 = require("@itrocks/action");
|
|
7
|
+
function build() {
|
|
8
|
+
(0, action_2.setActionCss)({ file: '/node_modules/@itrocks/(action)/css/action.css' });
|
|
9
|
+
(0, action_3.setActionTemplates)({ need: 'object', file: __dirname + '/../../action/cjs/selectionAction.html' }, { file: __dirname + '/../../action/cjs/action.html' });
|
|
10
|
+
(0, action_1.setAction)('edit', 'delete');
|
|
11
|
+
(0, action_1.setAction)('login', 'forgot-password');
|
|
12
|
+
(0, action_1.setAction)('login', 'signup', { caption: 'Sign up' });
|
|
13
|
+
(0, action_1.setAction)('list', 'new');
|
|
14
|
+
(0, action_1.setAction)('list', 'delete', { need: 'object' });
|
|
15
|
+
(0, action_1.setAction)('output', 'edit');
|
|
16
|
+
(0, action_1.setAction)('output', 'print', { target: undefined });
|
|
17
|
+
(0, action_1.setAction)('output', 'delete');
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=workflow.js.map
|
package/package.json
CHANGED
|
@@ -24,21 +24,18 @@
|
|
|
24
24
|
"@itrocks/contenteditable": "latest",
|
|
25
25
|
"@itrocks/core-responses": "latest",
|
|
26
26
|
"@itrocks/core-transformers": "latest",
|
|
27
|
+
"@itrocks/config": "latest",
|
|
28
|
+
"@itrocks/crud-pack": "latest",
|
|
27
29
|
"@itrocks/decorator": "latest",
|
|
28
|
-
"@itrocks/delete": "latest",
|
|
29
30
|
"@itrocks/domain-components": "latest",
|
|
30
|
-
"@itrocks/edit": "latest",
|
|
31
31
|
"@itrocks/fastify": "latest",
|
|
32
32
|
"@itrocks/fastify-file-session-store": "latest",
|
|
33
33
|
"@itrocks/forgot-password": "latest",
|
|
34
34
|
"@itrocks/home": "latest",
|
|
35
35
|
"@itrocks/lazy-loading": "latest",
|
|
36
|
-
"@itrocks/list": "latest",
|
|
37
36
|
"@itrocks/modal": "latest",
|
|
38
37
|
"@itrocks/mysql": "latest",
|
|
39
|
-
"@itrocks/new": "latest",
|
|
40
38
|
"@itrocks/notifications": "latest",
|
|
41
|
-
"@itrocks/output": "latest",
|
|
42
39
|
"@itrocks/password": "latest",
|
|
43
40
|
"@itrocks/print": "latest",
|
|
44
41
|
"@itrocks/property-type": "latest",
|
|
@@ -47,10 +44,8 @@
|
|
|
47
44
|
"@itrocks/reflect": "latest",
|
|
48
45
|
"@itrocks/rename": "latest",
|
|
49
46
|
"@itrocks/request-response": "latest",
|
|
50
|
-
"@itrocks/save": "latest",
|
|
51
47
|
"@itrocks/signup": "latest",
|
|
52
48
|
"@itrocks/sql-functions": "latest",
|
|
53
|
-
"@itrocks/summary": "latest",
|
|
54
49
|
"@itrocks/table": "latest",
|
|
55
50
|
"@itrocks/template": "latest",
|
|
56
51
|
"@itrocks/transformer": "latest",
|
|
@@ -98,5 +93,5 @@
|
|
|
98
93
|
"build:front": "tsc -p src/front/tsconfig.json && sed -i 's#../../##g' app.js app.d.ts"
|
|
99
94
|
},
|
|
100
95
|
"types": "./cjs/framework.d.ts",
|
|
101
|
-
"version": "0.0.
|
|
96
|
+
"version": "0.0.15"
|
|
102
97
|
}
|
package/cjs/access.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const accessConfig: Record<string, any>;
|
package/cjs/access.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.accessConfig = void 0;
|
|
4
|
-
const config_1 = require("./config");
|
|
5
|
-
exports.accessConfig = {
|
|
6
|
-
free: [
|
|
7
|
-
'/user/authenticate',
|
|
8
|
-
'/user/forgot-password',
|
|
9
|
-
'/user/login',
|
|
10
|
-
'/user/signup'
|
|
11
|
-
]
|
|
12
|
-
};
|
|
13
|
-
(0, config_1.mergeConfig)(exports.accessConfig, '/app/config/access.js');
|
|
14
|
-
//# sourceMappingURL=access.js.map
|
package/cjs/class.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { PropertyTypes } from '@itrocks/property-type';
|
|
2
|
-
import { ReflectClass as RC } from '@itrocks/reflect';
|
|
3
|
-
export { ReflectClass };
|
|
4
|
-
export default class ReflectClass<T extends object = object> extends RC<T> {
|
|
5
|
-
inheritedPropertyTypes(propertyTypes: PropertyTypes<T>): void;
|
|
6
|
-
get parent(): any;
|
|
7
|
-
get properties(): Record<Extract<keyof T, string>, import("@itrocks/reflect").ReflectProperty<T>>;
|
|
8
|
-
get uses(): import("@itrocks/class-type").default[];
|
|
9
|
-
}
|
package/cjs/class.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ReflectClass = void 0;
|
|
4
|
-
const reflect_1 = require("@itrocks/reflect");
|
|
5
|
-
const uses_1 = require("@itrocks/uses");
|
|
6
|
-
const property_1 = require("./property");
|
|
7
|
-
class ReflectClass extends reflect_1.ReflectClass {
|
|
8
|
-
inheritedPropertyTypes(propertyTypes) {
|
|
9
|
-
super.inheritedPropertyTypes(propertyTypes);
|
|
10
|
-
for (const uses of this.uses) {
|
|
11
|
-
Object.assign(propertyTypes, new ReflectClass(uses).propertyTypes);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
get parent() {
|
|
15
|
-
const parent = super.parent;
|
|
16
|
-
return parent
|
|
17
|
-
? Object.setPrototypeOf(parent, ReflectClass.prototype)
|
|
18
|
-
: parent;
|
|
19
|
-
}
|
|
20
|
-
get properties() {
|
|
21
|
-
const properties = super.properties;
|
|
22
|
-
for (const reflectProperty of Object.values(properties)) {
|
|
23
|
-
Object.setPrototypeOf(reflectProperty, property_1.ReflectProperty.prototype);
|
|
24
|
-
}
|
|
25
|
-
return properties;
|
|
26
|
-
}
|
|
27
|
-
get uses() {
|
|
28
|
-
const value = (0, uses_1.usesOf)(this.type);
|
|
29
|
-
Object.defineProperty(this, 'uses', { value });
|
|
30
|
-
return value;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.default = ReflectClass;
|
|
34
|
-
exports.ReflectClass = ReflectClass;
|
|
35
|
-
//# sourceMappingURL=class.js.map
|
package/cjs/compose.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const composeConfig: Record<string, string | string[]>;
|
package/cjs/compose.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.composeConfig = void 0;
|
|
4
|
-
const config_1 = require("./config");
|
|
5
|
-
exports.composeConfig = {
|
|
6
|
-
'@itrocks/reflect:ReflectClass': '/reflect-class',
|
|
7
|
-
'@itrocks/reflect:ReflectProperty': '/reflect-property',
|
|
8
|
-
};
|
|
9
|
-
(0, config_1.mergeConfig)(exports.composeConfig, '/app/config/compose.js');
|
|
10
|
-
//# sourceMappingURL=compose.js.map
|
package/cjs/config.d.ts
DELETED
package/cjs/config.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergeConfig = mergeConfig;
|
|
4
|
-
const app_dir_1 = require("@itrocks/app-dir");
|
|
5
|
-
const node_fs_1 = require("node:fs");
|
|
6
|
-
function mergeConfigObject(config, mergeConfig) {
|
|
7
|
-
Object.entries(mergeConfig).forEach(([key, value]) => {
|
|
8
|
-
if (config[key]) {
|
|
9
|
-
if (Array.isArray(value)) {
|
|
10
|
-
if (!Array.isArray(config[key])) {
|
|
11
|
-
config[key] = [config[key]];
|
|
12
|
-
}
|
|
13
|
-
config[key].push(...value);
|
|
14
|
-
}
|
|
15
|
-
else if (Array.isArray(config[key])) {
|
|
16
|
-
config[key].push(value);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
mergeConfigObject(config[key], value);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
config[key] = value;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
function mergeConfig(config, appConfigFile) {
|
|
28
|
-
if (!(0, node_fs_1.existsSync)(app_dir_1.appDir + appConfigFile))
|
|
29
|
-
return;
|
|
30
|
-
mergeConfigObject(config, Object.values(require(app_dir_1.appDir + appConfigFile))[0]);
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=config.js.map
|
package/cjs/menu.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const menuConfig: Record<string, Record<string, string>>;
|
package/cjs/menu.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.menuConfig = void 0;
|
|
4
|
-
const config_1 = require("./config");
|
|
5
|
-
exports.menuConfig = {
|
|
6
|
-
'Administration': {
|
|
7
|
-
'/user/list': 'Users'
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
(0, config_1.mergeConfig)(exports.menuConfig, '/app/config/menu.js');
|
|
11
|
-
//# sourceMappingURL=menu.js.map
|
package/cjs/property.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { HtmlContainer } from '@itrocks/core-transformers';
|
|
2
|
-
import { ReflectProperty as RP } from '@itrocks/reflect';
|
|
3
|
-
export { ReflectProperty };
|
|
4
|
-
export default class ReflectProperty<T extends object> extends RP<T> {
|
|
5
|
-
get class(): any;
|
|
6
|
-
edit(format?: string): Promise<string>;
|
|
7
|
-
output(format?: string, askFor?: HtmlContainer): Promise<string>;
|
|
8
|
-
outputMandatoryContainer(format?: string): Promise<string>;
|
|
9
|
-
outputOptionalContainer(format?: string): Promise<string>;
|
|
10
|
-
}
|
package/cjs/property.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ReflectProperty = void 0;
|
|
4
|
-
const core_transformers_1 = require("@itrocks/core-transformers");
|
|
5
|
-
const reflect_1 = require("@itrocks/reflect");
|
|
6
|
-
const transformer_1 = require("@itrocks/transformer");
|
|
7
|
-
const transformer_2 = require("@itrocks/transformer");
|
|
8
|
-
const class_1 = require("./class");
|
|
9
|
-
class ReflectProperty extends reflect_1.ReflectProperty {
|
|
10
|
-
get class() {
|
|
11
|
-
return Object.setPrototypeOf(super.class, class_1.ReflectClass.prototype);
|
|
12
|
-
}
|
|
13
|
-
async edit(format = transformer_2.HTML) {
|
|
14
|
-
const object = this.object ?? this.class.type;
|
|
15
|
-
const value = this.object ? this.object[this.name] : undefined;
|
|
16
|
-
return (0, transformer_1.applyTransformer)(await value, object, this.name, format, transformer_2.EDIT);
|
|
17
|
-
}
|
|
18
|
-
async output(format = transformer_2.HTML, askFor) {
|
|
19
|
-
const object = this.object ?? this.class.type;
|
|
20
|
-
const value = this.object ? await this.object[this.name] : undefined;
|
|
21
|
-
return (0, transformer_1.applyTransformer)(value, object, this.name, format, transformer_2.OUTPUT, askFor);
|
|
22
|
-
}
|
|
23
|
-
async outputMandatoryContainer(format = transformer_2.HTML) {
|
|
24
|
-
return this.output(format, new core_transformers_1.HtmlContainer(true));
|
|
25
|
-
}
|
|
26
|
-
async outputOptionalContainer(format = transformer_2.HTML) {
|
|
27
|
-
return this.output(format, new core_transformers_1.HtmlContainer(false));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.default = ReflectProperty;
|
|
31
|
-
exports.ReflectProperty = ReflectProperty;
|
|
32
|
-
//# sourceMappingURL=property.js.map
|