@itrocks/framework 1.5.2 → 1.6.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/README.md +10 -0
- package/cjs/dependencies.js +12 -9
- package/cjs/language.js +2 -1
- package/cjs/property-select-actions.d.ts +3 -3
- package/cjs/property-select.d.ts +1 -1
- package/cjs/sql-relationships.js +11 -3
- package/package.json +1 -1
- package/property-select-list.js +4 -1
- package/property-select-metadata.js +2 -2
package/README.md
CHANGED
|
@@ -74,6 +74,16 @@ import { beforeFrameworkRun } from '@itrocks/framework'
|
|
|
74
74
|
beforeFrameworkRun(() => import('./src/dependencies'))
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+
### Applications in subdirectories
|
|
78
|
+
|
|
79
|
+
The framework supports public mount paths such as `/showtime/`. The reverse proxy sets `X-Forwarded-Prefix: /showtime`;
|
|
80
|
+
no business routes or filesystem paths need that prefix. Rendering uses the current request's public URL callback,
|
|
81
|
+
including framework URL-valued data attributes. The home container supplies a `<base>` for browser-relative endpoints
|
|
82
|
+
and the import map. Application containers must provide the same base element before their scripts and links.
|
|
83
|
+
Application browser code should use base-relative endpoints or resolve them against `document.baseURI`.
|
|
84
|
+
|
|
85
|
+
For an Apache proxy, use `ProxyPass "/showtime/" "http://127.0.0.1:3456/"` and set the prefix header within that location.
|
|
86
|
+
|
|
77
87
|
### Request languages
|
|
78
88
|
|
|
79
89
|
The framework can select one translation catalog for each request without sharing language state between concurrent
|
package/cjs/dependencies.js
CHANGED
|
@@ -98,21 +98,24 @@ function bind() {
|
|
|
98
98
|
const containerData = Object.assign(defaultContainerData(request), this);
|
|
99
99
|
const contained = !request.request.headers['xhr-info'] && config_1.config.container?.file;
|
|
100
100
|
const template = new template_1.Template(data, containerData);
|
|
101
|
+
template.applicationPath = request.request.applicationPath.bind(request.request);
|
|
102
|
+
template.publicUrl = request.request.publicUrl.bind(request.request);
|
|
103
|
+
template.urlAttributes.push('data-custom-list-route', 'data-fetch', 'data-feed', 'data-href', 'data-link', 'data-route');
|
|
101
104
|
return this.htmlResponse(await template.parseFile(templateFile, contained && (0, node_path_1.join)(app_dir_1.appDir, config_1.config.container.file)), statusCode, headers);
|
|
102
105
|
};
|
|
103
106
|
}
|
|
104
107
|
function configContainerData() {
|
|
105
108
|
const configContainerData = config_1.config.container?.data ?? {};
|
|
106
109
|
for (const [name, value] of Object.entries(configContainerData)) {
|
|
107
|
-
if ((typeof value === 'string')
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
if (!(typeof value === 'string') || !'@.'.includes(value[0]))
|
|
111
|
+
continue;
|
|
112
|
+
const exported = value.includes(':')
|
|
113
|
+
? require(value.split(':')[0])[value.split(':')[1]]
|
|
114
|
+
: (require(value).default ?? Object.values(require(value))[0]);
|
|
115
|
+
configContainerData[name] =
|
|
116
|
+
(0, class_type_1.isAnyFunction)(exported) ? exported(config_1.config[name]) :
|
|
117
|
+
(0, class_type_2.isAnyType)(exported) ? new exported(config_1.config[name]) :
|
|
118
|
+
exported;
|
|
116
119
|
}
|
|
117
120
|
return configContainerData;
|
|
118
121
|
}
|
package/cjs/language.js
CHANGED
|
@@ -41,7 +41,8 @@ function configureLanguages() {
|
|
|
41
41
|
// TODO search language files everywhere in application modules, not only into app
|
|
42
42
|
const directories = [
|
|
43
43
|
(0, node_path_2.join)((0, node_path_1.dirname)(require.resolve('@itrocks/custom-list')), '..'),
|
|
44
|
-
(0, node_path_2.join)(__dirname, '..'), (0, node_path_2.join)(app_dir_1.appDir, 'app'),
|
|
44
|
+
(0, node_path_2.join)(__dirname, '..'), (0, node_path_2.join)(app_dir_1.appDir, 'app'),
|
|
45
|
+
app_dir_1.appDir
|
|
45
46
|
];
|
|
46
47
|
for (const language of configuration.supportedLanguages) {
|
|
47
48
|
for (const directory of directories) {
|
|
@@ -6,13 +6,13 @@ declare abstract class MetadataAction extends Action {
|
|
|
6
6
|
json(request: Request): Promise<import("@itrocks/core-responses").JsonResponse>;
|
|
7
7
|
}
|
|
8
8
|
export declare class MetadataConfiguration extends MetadataAction {
|
|
9
|
-
protected operation:
|
|
9
|
+
protected operation: 'configuration';
|
|
10
10
|
}
|
|
11
11
|
export declare class MetadataContext extends MetadataAction {
|
|
12
|
-
protected operation:
|
|
12
|
+
protected operation: 'context';
|
|
13
13
|
}
|
|
14
14
|
export declare class MetadataResolve extends MetadataAction {
|
|
15
|
-
protected operation:
|
|
15
|
+
protected operation: 'resolve';
|
|
16
16
|
}
|
|
17
17
|
export declare class PropertySelectTemplate extends Action {
|
|
18
18
|
html(): Promise<import("@itrocks/core-responses").HtmlResponse>;
|
package/cjs/property-select.d.ts
CHANGED
|
@@ -24,8 +24,8 @@ export declare function metadataBootstrap(request: Request, root: RootId, usedPa
|
|
|
24
24
|
contexts: ObjectContext[];
|
|
25
25
|
errors: [string, string][];
|
|
26
26
|
record: {
|
|
27
|
-
state: import("@itrocks/property-select").SelectorState;
|
|
28
27
|
revision: number;
|
|
28
|
+
state: import("@itrocks/property-select").SelectorState;
|
|
29
29
|
};
|
|
30
30
|
template: string;
|
|
31
31
|
translations: {
|
package/cjs/sql-relationships.js
CHANGED
|
@@ -25,7 +25,12 @@ const sql_join_dependencies_8 = require("./sql-join-dependencies");
|
|
|
25
25
|
const dependencies = { mappingOf: () => undefined };
|
|
26
26
|
function bindSqlJoins() {
|
|
27
27
|
(0, sql_join_2.sqlJoinDependsOn)({
|
|
28
|
-
columnDefinitionOf: sql_join_dependencies_1.columnDefinitionOf,
|
|
28
|
+
columnDefinitionOf: sql_join_dependencies_1.columnDefinitionOf,
|
|
29
|
+
columnDefinitionsOf: sql_join_dependencies_2.columnDefinitionsOf,
|
|
30
|
+
columnOf: sql_join_dependencies_3.columnOf,
|
|
31
|
+
componentOf: composition_1.componentOf,
|
|
32
|
+
isCollection: sql_join_dependencies_4.isCollection,
|
|
33
|
+
isScalar: sql_join_dependencies_5.isScalar,
|
|
29
34
|
multiplicityOf: property => {
|
|
30
35
|
try {
|
|
31
36
|
return (0, reflect_path_2.resolvePropertyPath)(property.class, [String(property.name)]).targetMultiplicity;
|
|
@@ -37,12 +42,15 @@ function bindSqlJoins() {
|
|
|
37
42
|
: error.code === 'invalid-path' ? 'invalid-path' : 'unsupported-relationship', error.path);
|
|
38
43
|
}
|
|
39
44
|
},
|
|
40
|
-
relationshipOf,
|
|
45
|
+
relationshipOf,
|
|
46
|
+
requiredOf: required_1.requiredOf,
|
|
47
|
+
rightColumnDefinitionOf: sql_join_dependencies_6.rightColumnDefinitionOf,
|
|
41
48
|
storedAsValueOf: property => {
|
|
42
49
|
const target = (0, sql_join_dependencies_7.tableDefinitionOf)(property);
|
|
43
50
|
return !!target && !(0, store_1.storeOf)(target);
|
|
44
51
|
},
|
|
45
|
-
tableDefinitionOf: sql_join_dependencies_7.tableDefinitionOf,
|
|
52
|
+
tableDefinitionOf: sql_join_dependencies_7.tableDefinitionOf,
|
|
53
|
+
tableOf: sql_join_dependencies_8.tableOf
|
|
46
54
|
});
|
|
47
55
|
}
|
|
48
56
|
function relationshipOf(table, column, property) {
|
package/package.json
CHANGED
package/property-select-list.js
CHANGED
|
@@ -22,7 +22,10 @@ async function activate(entry) {
|
|
|
22
22
|
if (!entry.article.isConnected || mounted.has(entry.article))
|
|
23
23
|
return;
|
|
24
24
|
integration = new ListPropertySelect(entry.article, {
|
|
25
|
-
...entry.options,
|
|
25
|
+
...entry.options,
|
|
26
|
+
advice: configuration.advice,
|
|
27
|
+
metadata,
|
|
28
|
+
templateUrl: 'property-select/template/html',
|
|
26
29
|
mountSelector: (content, title) => register(entry.article, content, title)
|
|
27
30
|
});
|
|
28
31
|
mounted.set(entry.article, integration);
|
|
@@ -3,9 +3,9 @@ export class HttpMetadataProvider {
|
|
|
3
3
|
fetcher;
|
|
4
4
|
initial;
|
|
5
5
|
constructor(options = {}) {
|
|
6
|
-
this.
|
|
7
|
-
this.endpoint = options.endpoint ?? '/property-select';
|
|
6
|
+
this.endpoint = options.endpoint ?? 'property-select';
|
|
8
7
|
this.fetcher = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
8
|
+
this.initial = options.initial;
|
|
9
9
|
}
|
|
10
10
|
configuration(root, signal) {
|
|
11
11
|
return this.request('configuration', root, '', signal);
|