@itrocks/framework 0.0.1

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 ADDED
@@ -0,0 +1,14 @@
1
+ ISC License
2
+ Copyright (C) 2024, Baptiste Pillot <baptiste@pillot.fr>
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted, provided that the above
6
+ copyright notice and this permission notice appear in all copies.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13
+ OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14
+ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ [![npm version](https://img.shields.io/npm/v/@itrocks/framework?logo=npm)](https://www.npmjs.org/package/@itrocks/framework)
2
+ [![npm downloads](https://img.shields.io/npm/dm/@itrocks/framework)](https://www.npmjs.org/package/@itrocks/framework)
3
+ [![GitHub](https://img.shields.io/github/last-commit/itrocks-ts/framework?color=2dba4e&label=commit&logo=github)](https://github.com/itrocks-ts/framework)
4
+ [![issues](https://img.shields.io/github/issues/itrocks-ts/framework)](https://github.com/itrocks-ts/framework/issues)
5
+ [![discord](https://img.shields.io/discord/1314141024020467782?color=7289da&label=discord&logo=discord&logoColor=white)](https://25.re/ditr)
6
+
7
+ # it.rocks framework
8
+
9
+ RAD framework for intuitive web application development, blending data and domain-driven design with modular architecture.
package/app.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import '../auto-redirect/build.js';
2
+ import '../real-viewport-height/real-viewport-height.js';
package/app.js ADDED
@@ -0,0 +1,35 @@
1
+ import build from '../build/build.js';
2
+ import buildXTarget from '../xtarget/build.js';
3
+ import XTargetBeginEnd from '../xtarget/begin-end.js';
4
+ import XTargetComposite from '../xtarget/composite.js';
5
+ import XTargetDefaultTarget from '../xtarget/default-target.js';
6
+ import XTargetHead from '../xtarget/head.js';
7
+ import XTargetHeadersSize from '../xtarget/headers-size.js';
8
+ import XTargetHistory from '../xtarget/history.js';
9
+ import XTargetMainTarget from '../xtarget/main-target.js';
10
+ import XTargetModifier from '../xtarget/modifier.js';
11
+ import { XTargetDefaultOptions } from '../xtarget/xtarget.js';
12
+ import autoFocus from '../auto-focus/auto-focus.js';
13
+ import '../auto-redirect/build.js';
14
+ import breadcrumb from '../breadcrumb/breadcrumb.js';
15
+ import collapse from '../collapse/collapse.js';
16
+ import containedAutoWidth from '../contained-auto-width/contained-auto-width.js';
17
+ import notification from '../notifications/notifications.js';
18
+ import { notifications } from '../notifications/notifications.js';
19
+ import '../real-viewport-height/real-viewport-height.js';
20
+ let selector;
21
+ selector = 'input[data-type=object], ul[data-type=objects] > li > input';
22
+ build(selector, async (input) => (await import('../autocompleter/autocompleter.js')).default(input));
23
+ build('main > * > h2, main > * > header > h2', breadcrumb);
24
+ build('button.collapse', button => collapse(button, 'body'));
25
+ build('input[data-type=date]', async (input) => (await import('../air-datepicker/air-datepicker.js')).default(input));
26
+ build('form', autoFocus);
27
+ selector = '[data-contained-auto-width], [data-multiple-contained-auto-width] > li';
28
+ build(selector, async (container) => containedAutoWidth(container));
29
+ build('#notifications > li', notification);
30
+ build('#notifications', notifications);
31
+ XTargetDefaultOptions({ plugins: [
32
+ XTargetBeginEnd, XTargetComposite, XTargetDefaultTarget, XTargetHead, XTargetHeadersSize, XTargetHistory,
33
+ XTargetMainTarget, XTargetModifier
34
+ ] });
35
+ buildXTarget();
@@ -0,0 +1 @@
1
+ export declare const accessConfig: Record<string, any>;
package/cjs/access.js ADDED
@@ -0,0 +1,14 @@
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/register'
11
+ ]
12
+ };
13
+ (0, config_1.mergeConfig)(exports.accessConfig, '/app/config/access.js');
14
+ //# sourceMappingURL=access.js.map
package/cjs/class.d.ts ADDED
@@ -0,0 +1,9 @@
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 ADDED
@@ -0,0 +1,35 @@
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
@@ -0,0 +1 @@
1
+ export declare const composeConfig: Record<string, string | string[]>;
package/cjs/compose.js ADDED
@@ -0,0 +1,10 @@
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': '/class',
7
+ '@itrocks/reflect:ReflectProperty': '/property',
8
+ };
9
+ (0, config_1.mergeConfig)(exports.composeConfig, '/app/config/compose.js');
10
+ //# sourceMappingURL=compose.js.map
@@ -0,0 +1,2 @@
1
+ export type Config = Record<string, any>;
2
+ export declare function mergeConfig(config: Config, appConfigFile: string): void;
package/cjs/config.js ADDED
@@ -0,0 +1,24 @@
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 mergeConfig(config, appConfigFile) {
7
+ if (!(0, node_fs_1.existsSync)(app_dir_1.appDir + appConfigFile))
8
+ return;
9
+ const appConfig = Object.values(require(app_dir_1.appDir + appConfigFile))[0];
10
+ Object.entries(appConfig).forEach(([key, value]) => {
11
+ if (config[key]) {
12
+ if (!Array.isArray(config[key]))
13
+ config[key] = [config[key]];
14
+ if (Array.isArray(value))
15
+ config[key].push(...value);
16
+ else
17
+ config[key].push(value);
18
+ }
19
+ else {
20
+ config[key] = value;
21
+ }
22
+ });
23
+ }
24
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1,2 @@
1
+ import '@itrocks/class-file/automation';
2
+ export declare function main(): Promise<void>;
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.main = main;
4
+ require("@itrocks/class-file/automation");
5
+ const compose_1 = require("@itrocks/compose");
6
+ const compose_2 = require("./compose");
7
+ (0, compose_1.compose)(__dirname, compose_2.composeConfig);
8
+ const lazy_loading_1 = require("@itrocks/lazy-loading");
9
+ (0, lazy_loading_1.initLazyLoading)();
10
+ const action_1 = require("@itrocks/action");
11
+ const action_2 = require("@itrocks/action");
12
+ const action_3 = require("@itrocks/action");
13
+ const action_4 = require("@itrocks/action");
14
+ const action_request_1 = require("@itrocks/action-request");
15
+ const action_request_2 = require("@itrocks/action-request");
16
+ const app_dir_1 = require("@itrocks/app-dir");
17
+ const class_file_1 = require("@itrocks/class-file");
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 mysql_1 = require("@itrocks/mysql");
29
+ const password_1 = require("@itrocks/password");
30
+ const transformers_1 = require("@itrocks/password/transformers");
31
+ const property_view_1 = require("@itrocks/property-view");
32
+ const rename_1 = require("@itrocks/rename");
33
+ const required_1 = require("@itrocks/required");
34
+ const route_1 = require("@itrocks/route");
35
+ const route_2 = require("@itrocks/route");
36
+ const route_3 = require("@itrocks/route");
37
+ const sql_functions_1 = require("@itrocks/sql-functions");
38
+ const storage_1 = require("@itrocks/storage");
39
+ const store_1 = require("@itrocks/store");
40
+ const store_2 = require("@itrocks/store");
41
+ const template_1 = require("@itrocks/template");
42
+ const transformer_1 = require("@itrocks/transformer");
43
+ const transformer_2 = require("@itrocks/transformer");
44
+ const transformer_3 = require("@itrocks/transformer");
45
+ const translate_1 = require("@itrocks/translate");
46
+ const date_fns_1 = require("date-fns");
47
+ const node_path_1 = require("node:path");
48
+ const data_source_1 = require("../../../../local/data-source");
49
+ const secret_1 = require("../../../../local/secret");
50
+ const session_1 = require("../../../../local/session");
51
+ const access_1 = require("./access");
52
+ const template_2 = require("./template");
53
+ let routes;
54
+ template_1.frontScripts.push('/node_modules/@itrocks/air-datepicker/air-datepicker.js', '/node_modules/@itrocks/asset-loader/asset-loader.js', '/node_modules/@itrocks/asset-loader/load-css.js', '/node_modules/@itrocks/asset-loader/load-script.js', '/node_modules/@itrocks/auto-focus/auto-focus.js', '/node_modules/@itrocks/auto-redirect/auto-redirect.js', '/node_modules/@itrocks/auto-redirect/build.js', '/node_modules/@itrocks/autocompleter/autocompleter.js', '/node_modules/@itrocks/breadcrumb/breadcrumb.js', '/node_modules/@itrocks/build/build.js', '/node_modules/@itrocks/collapse/collapse.js', '/node_modules/@itrocks/contained-auto-width/contained-auto-width.js', '/node_modules/@itrocks/form-fetch/form-fetch.js', '/node_modules/@itrocks/modal/modal.js', '/node_modules/@itrocks/notifications/notifications.js', '/node_modules/@itrocks/plugin/plugin.js', '/node_modules/@itrocks/real-viewport-height/real-viewport-height.js', '/node_modules/@itrocks/sorted-array/sorted-array.js', '/node_modules/@itrocks/table/freeze.js', '/node_modules/@itrocks/table/freeze/inherit-background.js', '/node_modules/@itrocks/table/freeze/inherit-border.js', '/node_modules/@itrocks/table/table.js', '/node_modules/@itrocks/xtarget/begin-end.js', '/node_modules/@itrocks/xtarget/build.js', '/node_modules/@itrocks/xtarget/composite.js', '/node_modules/@itrocks/xtarget/default-target.js', '/node_modules/@itrocks/xtarget/head.js', '/node_modules/@itrocks/xtarget/headers-size.js', '/node_modules/@itrocks/xtarget/history.js', '/node_modules/@itrocks/xtarget/main-target.js', '/node_modules/@itrocks/xtarget/modifier.js', '/node_modules/@itrocks/xtarget/xtarget.js', '/node_modules/air-datepicker/air-datepicker.js', '/node_modules/air-datepicker/locale/en.js', '/node_modules/air-datepicker/locale/fr.js', '/node_modules/autocompleter/autocomplete.es.js');
55
+ function bindDependencies() {
56
+ (0, class_view_1.classViewDependsOn)({ requiredOf: required_1.requiredOf, tr: translate_1.tr });
57
+ (0, storage_1.createDataSource)(data_source_1.localDataSource);
58
+ (0, collection_1.initCollection)();
59
+ (0, core_transformers_1.initCoreTransformers)({
60
+ displayOf: property_view_1.displayOf,
61
+ formatDate: date => (0, date_fns_1.format)(date, (0, translate_1.tr)('dd/MM/yyyy', { ucFirst: false })),
62
+ ignoreTransformedValue: transformer_2.IGNORE,
63
+ parseDate: date => (0, date_fns_1.parse)(date, (0, translate_1.tr)('dd/MM/yyyy', { ucFirst: false }), new Date),
64
+ representativeValueOf: class_view_2.representativeValueOf,
65
+ routeOf: route_3.routeOf,
66
+ tr: translate_1.tr
67
+ });
68
+ (0, mysql_1.mysqlDependsOn)({
69
+ applyReadTransformer: async function (data, property, object) {
70
+ const value = await (0, transformer_1.applyTransformer)(data[property], object, property, transformer_3.SQL, transformer_3.READ, data);
71
+ if ((value !== transformer_2.IGNORE) && Reflect.getOwnMetadata(lazy_loading_2.PROTECT_GET, object, property)) {
72
+ Reflect.deleteMetadata(lazy_loading_2.PROTECT_GET, object, property);
73
+ }
74
+ return value;
75
+ },
76
+ applySaveTransformer: async function (object, property, data) {
77
+ const value = Reflect.getMetadata(lazy_loading_2.PROTECT_GET, object, property) ? undefined : await object[property];
78
+ return (0, transformer_1.applyTransformer)(value, object, property, transformer_3.SQL, transformer_3.SAVE, data);
79
+ },
80
+ columnOf: rename_1.toColumn,
81
+ componentOf: composition_1.componentOf,
82
+ ignoreTransformedValue: transformer_2.IGNORE,
83
+ QueryFunction: sql_functions_1.SqlFunction,
84
+ queryFunctionCall: value => [value.value, value.sql],
85
+ storeOf: store_2.storeOf
86
+ });
87
+ (0, password_1.passwordDependsOn)({
88
+ setTransformers: transformers_1.setPasswordTransformers
89
+ });
90
+ (0, route_2.routeDependsOn)({
91
+ calculate: (target) => routes.summarize((0, class_file_1.fileOf)(target).slice(app_dir_1.appDir.length, -3))
92
+ });
93
+ (0, store_1.storeDependsOn)({
94
+ setTransformers: core_transformers_2.initStoreTransformers,
95
+ toStoreName: rename_1.toColumn
96
+ });
97
+ (0, translate_1.trInit)('fr-FR', (0, node_path_1.normalize)(__dirname + '/../fr-FR.csv'));
98
+ action_1.Action.prototype.htmlTemplateResponse = async function (data, request, templateFile, statusCode = 200, headers = {}) {
99
+ const containerData = {
100
+ action: request.action,
101
+ actions: this.actions,
102
+ request,
103
+ session: request.request.session
104
+ };
105
+ const template = new template_2.Template(data, containerData);
106
+ template.included = (request.request.headers['sec-fetch-dest'] === 'empty');
107
+ return this.htmlResponse(await template.parseFile(templateFile, __dirname + '/../../home/cjs/container.html'), statusCode, headers);
108
+ };
109
+ }
110
+ function buildWorkflow() {
111
+ (0, action_2.setActionCss)({ css: '/node_modules/@itrocks/(action)/css/action.css' });
112
+ (0, action_3.setActionTemplates)({ need: 'object', template: __dirname + '/../../action/cjs/selectionAction.html' }, { template: __dirname + '/../../action/cjs/action.html' });
113
+ (0, action_1.setAction)('edit', 'delete');
114
+ (0, action_1.setAction)('login', 'forgot-password');
115
+ (0, action_1.setAction)('login', 'register');
116
+ (0, action_1.setAction)('list', 'new');
117
+ (0, action_1.setAction)('list', 'delete', { need: 'object' });
118
+ (0, action_1.setAction)('output', 'edit');
119
+ (0, action_1.setAction)('output', 'print', { target: undefined });
120
+ (0, action_1.setAction)('output', 'delete');
121
+ }
122
+ async function execute(request) {
123
+ // Access control
124
+ if (!request.request.session.user && !access_1.accessConfig.free.includes(request.route + '/' + request.action)) {
125
+ request.action = 'login';
126
+ request.route = '/user';
127
+ }
128
+ // Resolve action class or function module
129
+ const module = routes.resolve(request.route + '/' + request.action);
130
+ // undefined module
131
+ if (!module) {
132
+ console.error('Action ' + request.route + '/' + request.action + ' not found');
133
+ throw 'Action ' + request.route + '/' + request.action + ' not found';
134
+ }
135
+ // ActionClass module
136
+ if ((0, class_type_1.isAnyType)(module)) {
137
+ const action = (new module);
138
+ if (request.format in action) {
139
+ const need = (0, action_4.needOf)(action);
140
+ if (need.alternative
141
+ && (need.alternative !== request.action)
142
+ && (((need.need === 'object') && !request.ids.length)
143
+ || ((need.need === 'Store') && !(0, store_2.storeOf)(request.type)))) {
144
+ request.action = need.alternative;
145
+ return execute(request);
146
+ }
147
+ if ((need.need === 'object') && !request.ids.length && !request.request.data.confirm) {
148
+ console.error('Action ' + request.route + '/' + request.action + ' needs at least one object');
149
+ throw 'Action ' + request.route + '/' + request.action + ' needs at least one ';
150
+ }
151
+ return action[request.format](request);
152
+ }
153
+ }
154
+ // ActionFunction module
155
+ return module(request);
156
+ }
157
+ async function main() {
158
+ bindDependencies();
159
+ buildWorkflow();
160
+ routes = await (0, route_1.loadRoutes)();
161
+ (0, action_request_2.actionRequestDependsOn)({ getModule: routes.resolve.bind(routes) });
162
+ return new fastify_1.FastifyServer({
163
+ assetPath: app_dir_1.appDir,
164
+ execute: request => execute(new action_request_1.Request(request)),
165
+ favicon: '/node_modules/@itrocks/framework/favicon.ico',
166
+ frontScripts: template_1.frontScripts,
167
+ port: 3000,
168
+ secret: secret_1.localSecret,
169
+ store: new fastify_file_session_store_1.FileStore(session_1.localSession.path)
170
+ }).run();
171
+ }
172
+ //# sourceMappingURL=framework.js.map
@@ -0,0 +1 @@
1
+ export declare function parseDecorator(variable: string, data: any): any;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseDecorator = parseDecorator;
4
+ const class_type_1 = require("@itrocks/class-type");
5
+ const class_view_1 = require("@itrocks/class-view");
6
+ const class_view_2 = require("@itrocks/class-view");
7
+ const property_view_1 = require("@itrocks/property-view");
8
+ const reflect_1 = require("@itrocks/reflect");
9
+ const reflect_2 = require("@itrocks/reflect");
10
+ const rename_1 = require("@itrocks/rename");
11
+ const route_1 = require("@itrocks/route");
12
+ const translate_1 = require("@itrocks/translate");
13
+ function parseDecorator(variable, data) {
14
+ if ((typeof data !== 'function') && (typeof data !== 'object')) {
15
+ console.error('Bad data for variable', variable, 'data', data);
16
+ }
17
+ switch (variable) {
18
+ case '@display':
19
+ if (data instanceof reflect_2.ReflectProperty)
20
+ return (0, translate_1.tr)((0, property_view_1.displayOf)(data.class.object ?? data.class.type, data.name));
21
+ if (data instanceof reflect_1.ReflectClass)
22
+ return (0, translate_1.tr)((0, class_view_1.displayOf)(data.type));
23
+ if (typeof data === 'object')
24
+ return (0, class_view_1.displayOf)(data);
25
+ return data;
26
+ case '@output':
27
+ return new rename_1.Str((0, class_view_2.trOutputOf)(data));
28
+ case '@route':
29
+ return (0, route_1.routeOf)(data);
30
+ case '@typeRoute':
31
+ return (0, route_1.routeOf)((0, class_type_1.typeOf)(data));
32
+ }
33
+ return '?';
34
+ }
35
+ //# sourceMappingURL=parseDecorator.js.map
@@ -0,0 +1 @@
1
+ export declare function parseReflect(variable: string, data: any): any;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseReflect = parseReflect;
4
+ const reflect_1 = require("@itrocks/reflect");
5
+ const reflect_2 = require("@itrocks/reflect");
6
+ function parseReflect(variable, data) {
7
+ const typeOfDataChar = (typeof data)[0];
8
+ if ((typeOfDataChar !== 'f') && (typeOfDataChar !== 'o')) {
9
+ throw 'Could not parse ' + variable + ' for non-object ' + data;
10
+ }
11
+ if (!((data instanceof reflect_1.ReflectClass) || (data instanceof reflect_2.ReflectProperty))) {
12
+ data = new reflect_1.ReflectClass(data);
13
+ }
14
+ const value = data[variable.substring(1)];
15
+ return ((typeof value)[0] === 'f')
16
+ ? value.call(data)
17
+ : value;
18
+ }
19
+ //# sourceMappingURL=parseReflect.js.map
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1,32 @@
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
@@ -0,0 +1,7 @@
1
+ import { Template as T } from '@itrocks/template';
2
+ import { VariableParser } from '@itrocks/template';
3
+ export declare class Template extends T {
4
+ doLiteral: boolean;
5
+ parsers: VariableParser[];
6
+ applyLiterals(text: string, parts?: string[]): string;
7
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Template = void 0;
4
+ const rename_1 = require("@itrocks/rename");
5
+ const template_1 = require("@itrocks/template");
6
+ const translate_1 = require("@itrocks/translate");
7
+ const parseDecorator_1 = require("./parseDecorator");
8
+ const parseReflect_1 = require("./parseReflect");
9
+ class Template extends template_1.Template {
10
+ doLiteral = true;
11
+ parsers = [
12
+ ['@', parseDecorator_1.parseDecorator],
13
+ ['%', parseReflect_1.parseReflect]
14
+ ];
15
+ applyLiterals(text, parts = []) {
16
+ return (0, translate_1.tr)(text, parts);
17
+ }
18
+ }
19
+ exports.Template = Template;
20
+ // @ts-ignore Added to be used in templates
21
+ rename_1.Str.prototype.tr = function () {
22
+ return (0, translate_1.tr)(this + '');
23
+ };
24
+ //# sourceMappingURL=template.js.map
package/favicon.ico ADDED
Binary file
package/fr-FR.csv ADDED
@@ -0,0 +1,76 @@
1
+ ?; ?
2
+ !; !
3
+ $1 deleted;$1 supprimé
4
+ $1 $2 deleted;$1 $2 supprimés
5
+ $1 elements;$1 éléments
6
+ $1 list;$1s
7
+ $1 saved;$1 enregistré
8
+ an email for password reset was sent to you;un mail de réinitialisation de mot de passe vous a été envoyé
9
+ active;actif
10
+ add;ajouter
11
+ add $1;ajouter $1
12
+ age;age
13
+ all data will be lost;toutes les données seront perdues
14
+ authenticate user;authentifier l'utilisateur
15
+ back;retour
16
+ birthday;date de naissance
17
+ cancel;annuler
18
+ close;fermer
19
+ confirm;confirmer
20
+ continue;continuer
21
+ could not create this user account;impossible de créer ce compte utilisateur
22
+ delete;supprimer
23
+ delete $1;supprimer $1
24
+ demo objects;objets démo
25
+ display $1;afficher $1
26
+ do you confirm deletion;confirmez-vous la suppression
27
+ edit;modifier
28
+ edit $1;modifier $1
29
+ email;mail
30
+ en;fr
31
+ false;faux
32
+ forgot password;mot de passe oublié
33
+ global search;recherche globale
34
+ home;accueil
35
+ id;id
36
+ lines;lignes
37
+ login;identifiant
38
+ user login;connection utilisateur
39
+ login user;connecter utilisateur
40
+ logout;déconnecter
41
+ main module;module principal
42
+ dd/MM/yyyy;dd/MM/yyyy
43
+ name;nom
44
+ new;nouveau
45
+ new $1;nouveau $1
46
+ no;non
47
+ password;mot de passe
48
+ password reset request;demande de réinitialisation de mot de passe
49
+ please confirm;veuillez confirmer
50
+ please confirm $1;veuillez confirmer $1
51
+ please enter your new password;veuillez entrer votre nouveau mot de passe
52
+ please try again later or contact our support team if the issue persists;veuillez réessayer ultérieurement ou contacter notre équipe de support si le problème persiste
53
+ please wait for an administrator to activate it;veuillez attendre qu'un administrateur l'active
54
+ print;imprimer
55
+ register;s'enregistrer
56
+ register error;erreur à l'enregistrement
57
+ reset;réinitialiser
58
+ save;enregistrer
59
+ save $1;enregistrer $1
60
+ send;envoyer
61
+ this is the $1 I love;c'est le $1 que j'aime
62
+ true;vrai
63
+ unable to login;impossible de se connecter
64
+ unable to login: unknown email, login or password;impossible de se connecter : mail, identifiant ou mot de passe inconnu
65
+ unknown;inconnu
66
+ unknown email, login or password;mail, identifiant ou mot de passe inconnu
67
+ user;utilisateur
68
+ user account created;compte utilisateur créé
69
+ user login;connexion utilisateur
70
+ users;utilisateurs
71
+ we were unable to send the password reset email;nous n'avons pas pu envoyer l'email de réinitialisation de mot de passe
72
+ welcome;bienvenue
73
+ welcome home;bienvenue à la maison
74
+ welcome, $1;bienvenue, $1
75
+ yes;oui
76
+ your password has been reset;votre mot de passe a été réinitialisé
package/package.json ADDED
@@ -0,0 +1,103 @@
1
+ {
2
+ "author": {
3
+ "name": "Baptiste Pillot",
4
+ "email": "baptiste@pillot.fr"
5
+ },
6
+ "dependencies": {
7
+ "@itrocks/action-pack": "latest",
8
+ "@itrocks/air-datepicker": "latest",
9
+ "@itrocks/app-dir": "latest",
10
+ "@itrocks/asset-loader": "latest",
11
+ "@itrocks/auto-focus": "latest",
12
+ "@itrocks/auto-redirect": "latest",
13
+ "@itrocks/autocompleter": "latest",
14
+ "@itrocks/breadcrumb": "latest",
15
+ "@itrocks/build": "latest",
16
+ "@itrocks/business-pack": "latest",
17
+ "@itrocks/class-file": "latest",
18
+ "@itrocks/class-type": "latest",
19
+ "@itrocks/collapse": "latest",
20
+ "@itrocks/collection": "latest",
21
+ "@itrocks/compose": "latest",
22
+ "@itrocks/confirm": "latest",
23
+ "@itrocks/contained-auto-width": "latest",
24
+ "@itrocks/contenteditable": "latest",
25
+ "@itrocks/core-responses": "latest",
26
+ "@itrocks/core-transformers": "latest",
27
+ "@itrocks/decorator": "latest",
28
+ "@itrocks/delete": "latest",
29
+ "@itrocks/domain-components": "latest",
30
+ "@itrocks/edit": "latest",
31
+ "@itrocks/fastify": "latest",
32
+ "@itrocks/fastify-file-session-store": "latest",
33
+ "@itrocks/forgot-password": "latest",
34
+ "@itrocks/home": "latest",
35
+ "@itrocks/lazy-loading": "latest",
36
+ "@itrocks/list": "latest",
37
+ "@itrocks/modal": "latest",
38
+ "@itrocks/mysql": "latest",
39
+ "@itrocks/new": "latest",
40
+ "@itrocks/notifications": "latest",
41
+ "@itrocks/output": "latest",
42
+ "@itrocks/password": "latest",
43
+ "@itrocks/print": "latest",
44
+ "@itrocks/property-type": "latest",
45
+ "@itrocks/property-view": "latest",
46
+ "@itrocks/real-viewport-height": "latest",
47
+ "@itrocks/reflect": "latest",
48
+ "@itrocks/register": "latest",
49
+ "@itrocks/rename": "latest",
50
+ "@itrocks/request-response": "latest",
51
+ "@itrocks/save": "latest",
52
+ "@itrocks/sql-functions": "latest",
53
+ "@itrocks/summary": "latest",
54
+ "@itrocks/table": "latest",
55
+ "@itrocks/template": "latest",
56
+ "@itrocks/transformer": "latest",
57
+ "@itrocks/translate": "latest",
58
+ "@itrocks/user": "latest",
59
+ "@itrocks/uses": "latest",
60
+ "@itrocks/webstorm": "latest",
61
+ "@itrocks/xtarget": "latest",
62
+ "air-datepicker": "^3.5",
63
+ "autocompleter": "^9.3",
64
+ "date-fns": "^4.1"
65
+ },
66
+ "description": "RAD framework for intuitive web application development, blending data and domain-driven design with modular architecture",
67
+ "devDependencies": {
68
+ "typescript": "^5.6"
69
+ },
70
+ "exports": "./cjs/framework.js",
71
+ "files": [
72
+ "favicon.ico",
73
+ "LICENSE",
74
+ "README.md",
75
+ "cjs/*",
76
+ "*.csv",
77
+ "*.d.ts",
78
+ "*.js",
79
+ "!*.map"
80
+ ],
81
+ "homepage": "https://it.rocks",
82
+ "keywords": [
83
+ "backend",
84
+ "business",
85
+ "domain",
86
+ "driven",
87
+ "framework",
88
+ "it.rocks"
89
+ ],
90
+ "license": "ISC",
91
+ "name": "@itrocks/framework",
92
+ "repository": {
93
+ "type": "git",
94
+ "url": "git+https://github.com/itrocks-ts/framework.git"
95
+ },
96
+ "scripts": {
97
+ "build": "npm run build:back && npm run build:front",
98
+ "build:back": "tsc -p tsconfig.json",
99
+ "build:front": "tsc -p src/front/tsconfig.json && sed -i 's#../../##g' app.js app.d.ts"
100
+ },
101
+ "types": "./cjs/framework.d.ts",
102
+ "version": "0.0.1"
103
+ }