@itrocks/framework 1.3.0 → 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 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.
@@ -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
- if (!mapping && (fact.cardinality === 'many-to-many')) {
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 ((cardinality === 'unknown') && inverse) {
111
- if ((0, composition_1.componentOf)(table, column))
112
- cardinality = (multiplicity === 'many') ? 'one-to-many' : 'one-to-one';
113
- else if ((0, composition_2.compositeOf)(table, column)) {
114
- cardinality = (inverse.relation?.targetMultiplicity === 'many') ? 'many-to-one' : 'one-to-one';
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/package.json CHANGED
@@ -123,5 +123,5 @@
123
123
  "build:test": "tsc -p test/tsconfig.json",
124
124
  "test": "npm run build && npm run build:test && node --test test/*.test.js test/*.test.mjs"
125
125
  },
126
- "version": "1.3.0"
126
+ "version": "1.4.0"
127
127
  }