@itrocks/framework 1.0.3 → 1.4.0
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 +5 -0
- package/cjs/property-select-provider.js +8 -1
- package/cjs/property-select.d.ts +1 -0
- package/cjs/property-select.js +1 -1
- package/cjs/sql-relationships.js +12 -6
- package/docs/property-select.md +6 -0
- package/fr-FR.csv +1 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -323,3 +323,8 @@ The list HTML includes authorised selector metadata, advice, template and sessio
|
|
|
323
323
|
additional application requests.
|
|
324
324
|
A stable configured `session.secret` is needed to recognise existing cookies after a server restart.
|
|
325
325
|
See [property selector integration](docs/property-select.md) for route-backed metadata and access.
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
Ordinary object collections without an explicit relation cardinality use the storage link-table convention in SQL
|
|
329
|
+
criteria, including filters through a collection's representative properties. Component collections retain their
|
|
330
|
+
inverse foreign-key mapping. Explicit relation metadata and schema mappings take precedence.
|
|
@@ -5,6 +5,8 @@ const class_file_1 = require("@itrocks/class-file");
|
|
|
5
5
|
const class_type_1 = require("@itrocks/class-type");
|
|
6
6
|
const composition_1 = require("@itrocks/composition");
|
|
7
7
|
const composition_2 = require("@itrocks/composition");
|
|
8
|
+
const property_expand_1 = require("@itrocks/property-expand");
|
|
9
|
+
const property_group_1 = require("@itrocks/property-group");
|
|
8
10
|
const property_select_1 = require("@itrocks/property-select");
|
|
9
11
|
const route_1 = require("@itrocks/route");
|
|
10
12
|
const translate_1 = require("@itrocks/translate");
|
|
@@ -94,13 +96,18 @@ class ReflectionMetadataProvider {
|
|
|
94
96
|
}
|
|
95
97
|
aborted(signal);
|
|
96
98
|
const { displayOf: classDisplay } = require('@itrocks/class-view');
|
|
97
|
-
|
|
99
|
+
const groups = Object.entries((0, property_group_1.groupOf)(target)).map(([name, members]) => ({
|
|
100
|
+
label: (0, translate_1.tr)(name), name,
|
|
101
|
+
properties: properties.filter(property => members.includes(property.name)).map(property => property.path)
|
|
102
|
+
})).filter(group => group.properties.length);
|
|
103
|
+
return { groups, label: (0, translate_1.tr)(classDisplay(target) || target.name), path, properties, type: typeId(target) };
|
|
98
104
|
}
|
|
99
105
|
description(context, name, path, names) {
|
|
100
106
|
const { displayOf } = require('@itrocks/property-view');
|
|
101
107
|
const property = new reflect_property_1.ReflectProperty(context, name);
|
|
102
108
|
const fact = property.relation;
|
|
103
109
|
const description = {
|
|
110
|
+
component: !!(0, composition_1.componentOf)(context.type, name) || (0, property_expand_1.expandOf)(context.type, name),
|
|
104
111
|
kind: fact ? 'relation' : 'terminal', label: (0, translate_1.tr)(displayOf(context.type, name) || name),
|
|
105
112
|
name, order: names.indexOf(name), path
|
|
106
113
|
};
|
package/cjs/property-select.d.ts
CHANGED
package/cjs/property-select.js
CHANGED
|
@@ -98,7 +98,7 @@ async function metadataBootstrap(request, root, usedPaths, record) {
|
|
|
98
98
|
...configuration, contexts: [...contexts.values()], errors: [...errors],
|
|
99
99
|
record: { ...record, state: selector.snapshot() },
|
|
100
100
|
template: await new template_1.Template({}).parseFile(require.resolve('@itrocks/property-select/front/property-select.html')),
|
|
101
|
-
translations: { 'Add columns': (0, translate_1.tr)('Add columns') }
|
|
101
|
+
translations: { 'Add columns': (0, translate_1.tr)('Add columns'), Others: (0, translate_1.tr)('Others') }
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
104
|
finally {
|
package/cjs/sql-relationships.js
CHANGED
|
@@ -78,7 +78,10 @@ function relationshipOf(table, column, property) {
|
|
|
78
78
|
throw new sql_join_1.RelationshipError('unsupported-relationship', column);
|
|
79
79
|
inverse = candidates[0];
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
const conventionalCollection = (fact.cardinality === 'unknown')
|
|
82
|
+
&& (multiplicity === 'many')
|
|
83
|
+
&& !(0, composition_1.componentOf)(table, column);
|
|
84
|
+
if (!mapping && ((fact.cardinality === 'many-to-many') || conventionalCollection)) {
|
|
82
85
|
const left = (0, sql_join_dependencies_8.tableOf)(table);
|
|
83
86
|
const right = (0, sql_join_dependencies_8.tableOf)(target);
|
|
84
87
|
if ((left === right) || ((0, rename_1.toColumn)(left) === (0, rename_1.toColumn)(right))) {
|
|
@@ -107,11 +110,14 @@ function relationshipOf(table, column, property) {
|
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
112
|
let cardinality = fact.cardinality;
|
|
110
|
-
if (
|
|
111
|
-
if (
|
|
112
|
-
cardinality = (
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
if (cardinality === 'unknown') {
|
|
114
|
+
if (multiplicity === 'many') {
|
|
115
|
+
cardinality = (0, composition_1.componentOf)(table, column) ? 'one-to-many' : 'many-to-many';
|
|
116
|
+
}
|
|
117
|
+
else if (multiplicity === 'one') {
|
|
118
|
+
const owned = (0, composition_1.componentOf)(table, column)
|
|
119
|
+
|| ((0, composition_2.compositeOf)(table, column) && (inverse?.relation?.targetMultiplicity === 'one'));
|
|
120
|
+
cardinality = owned ? 'one-to-one' : 'many-to-one';
|
|
115
121
|
}
|
|
116
122
|
}
|
|
117
123
|
return {
|
package/docs/property-select.md
CHANGED
|
@@ -48,6 +48,12 @@ constructing domain records. Metadata uses declared property types, never getter
|
|
|
48
48
|
|
|
49
49
|
`context(root, path, signal?)` returns one object's authorised properties, with full root-relative paths.
|
|
50
50
|
`resolve(root, '', signal?)` returns that root context; another path returns one property description.
|
|
51
|
+
Functional groups come from `groupOf(target)` in `@itrocks/property-group`. Each group contains its stable name,
|
|
52
|
+
translated label and authorised full property paths; empty groups are omitted. Inherited and property-level
|
|
53
|
+
`@Group` declarations use the same accessor.
|
|
54
|
+
Relations marked `@Component` or [`@Expand`](https://github.com/itrocks-ts/property-expand) receive `component: true`.
|
|
55
|
+
The selector presents both as identical groups of authorised child properties. `@Expand` only requests expansion;
|
|
56
|
+
it does not declare composition, change cardinality or infer an ownership inverse.
|
|
51
57
|
Labels and order reuse `class-view` and `property-view`, with technical-name fallbacks. Order gaps after permission
|
|
52
58
|
filtering retain the original business order. Host translation remains separate.
|
|
53
59
|
|
package/fr-FR.csv
CHANGED
package/package.json
CHANGED
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
"@itrocks/mysql": "latest",
|
|
37
37
|
"@itrocks/notifications": "latest",
|
|
38
38
|
"@itrocks/password": "latest",
|
|
39
|
+
"@itrocks/property-expand": "latest",
|
|
40
|
+
"@itrocks/property-group": "latest",
|
|
39
41
|
"@itrocks/property-select": "latest",
|
|
40
42
|
"@itrocks/property-translate": "latest",
|
|
41
43
|
"@itrocks/property-type": "latest",
|
|
@@ -121,5 +123,5 @@
|
|
|
121
123
|
"build:test": "tsc -p test/tsconfig.json",
|
|
122
124
|
"test": "npm run build && npm run build:test && node --test test/*.test.js test/*.test.mjs"
|
|
123
125
|
},
|
|
124
|
-
"version": "1.0
|
|
126
|
+
"version": "1.4.0"
|
|
125
127
|
}
|