@syncular/typegen 0.50.0 → 0.51.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
@@ -717,15 +717,18 @@ sync query compareLists(left, right) {
717
717
  }
718
718
  ```
719
719
 
720
- Coverage must resolve every read schema table and bind every declared scope on
721
- every table instance. A required scope bind can propagate across a qualified
720
+ Coverage must resolve every read schema table and bind at least one declared
721
+ scope on every table instance. Select the unit with `by` for a multi-scope
722
+ table. The descriptor includes all proven dimensions; unbound dimensions are
723
+ omitted. A required scope bind can propagate across a qualified
722
724
  scope-column equality in an unconditional outer `WHERE` clause or a simple
723
725
  mandatory `ON` clause. The generated descriptor contains aggregate coverage for
724
726
  every table, and readiness requires all of it. A self-join claims coverage when
725
727
  every instance of the table carries the same proof (the same scopes, operators,
726
728
  and parameters); the descriptor then holds one coverage entry and one
727
729
  dependency for that table. An unproven instance or differing proofs fail with
728
- `SYQL6005_INVALID_SYNC_QUERY`. `ON` clauses containing `OR`, `NOT`, or nested
730
+ `SYQL6005_INVALID_SYNC_QUERY`. Bound fixed dimensions retain intersection
731
+ semantics. Scoped remote operations still require every declared scope. `ON` clauses containing `OR`, `NOT`, or nested
729
732
  SQL cannot claim coverage. Only
730
733
  required, non-null, exactly typed binds are allowed. Result identity is inferred
731
734
  from schema keys and the projection; a self-join has no inferred identity. Without constructive proof an ordinary
@@ -1192,11 +1192,11 @@ class Validator {
1192
1192
  const table = this.#ir.tables.find((item) => item.name === candidate.ref.table);
1193
1193
  return (table !== undefined &&
1194
1194
  table.scopes.length > 0 &&
1195
- candidate.scopes.length === table.scopes.length);
1195
+ candidate.scopes.length > 0);
1196
1196
  });
1197
1197
  const syncBy = logical.declaration.syncBy;
1198
1198
  if (eligible.length === 0 || eligible.length !== syncedCandidates.length) {
1199
- this.#fail('SYQL6005_INVALID_SYNC_QUERY', logical.declaration.syncBy?.span ?? logical.declaration.nameSpan, 'sync query coverage cannot be proven for every read table instance from required equality/IN predicates over every declared scope; split the query or add an exact compatible scope proof');
1199
+ this.#fail('SYQL6005_INVALID_SYNC_QUERY', logical.declaration.syncBy?.span ?? logical.declaration.nameSpan, 'sync query coverage cannot be proven for every read table instance from required equality/IN predicates on declared scopes; split the query or add an exact compatible scope proof');
1200
1200
  }
1201
1201
  const divergent = eligible.find((candidate) => eligible.some((other) => other.ref.table === candidate.ref.table &&
1202
1202
  proofKey(other) !== proofKey(candidate)));
@@ -1251,7 +1251,8 @@ class Validator {
1251
1251
  this.#fail('SYQL6005_INVALID_SYNC_QUERY', syncBy?.span ?? logical.declaration.nameSpan, `joined multi-scope table ${table.name} has no unambiguous unit dimension compatible with the selected anchor; split the query`);
1252
1252
  }
1253
1253
  const fixedScopes = table.scopes
1254
- .filter((scope) => scope.variable !== unit.binding.variable)
1254
+ .filter((scope) => scope.variable !== unit.binding.variable &&
1255
+ byVariable.has(scope.variable))
1255
1256
  .map((scope) => {
1256
1257
  const fixed = byVariable.get(scope.variable);
1257
1258
  if (fixed === undefined ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncular/typegen",
3
- "version": "0.50.0",
3
+ "version": "0.51.0",
4
4
  "description": "Syncular schema-to-TypeScript type generator and the `syncular` CLI",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Benjamin Kniffler",
@@ -56,9 +56,9 @@
56
56
  "!dist/**/*.test.d.ts"
57
57
  ],
58
58
  "dependencies": {
59
- "@syncular/core": "0.50.0"
59
+ "@syncular/core": "0.51.0"
60
60
  },
61
61
  "devDependencies": {
62
- "@syncular/server": "0.50.0"
62
+ "@syncular/server": "0.51.0"
63
63
  }
64
64
  }
@@ -1739,7 +1739,7 @@ class Validator {
1739
1739
  return (
1740
1740
  table !== undefined &&
1741
1741
  table.scopes.length > 0 &&
1742
- candidate.scopes.length === table.scopes.length
1742
+ candidate.scopes.length > 0
1743
1743
  );
1744
1744
  });
1745
1745
  const syncBy = logical.declaration.syncBy;
@@ -1747,7 +1747,7 @@ class Validator {
1747
1747
  this.#fail(
1748
1748
  'SYQL6005_INVALID_SYNC_QUERY',
1749
1749
  logical.declaration.syncBy?.span ?? logical.declaration.nameSpan,
1750
- 'sync query coverage cannot be proven for every read table instance from required equality/IN predicates over every declared scope; split the query or add an exact compatible scope proof',
1750
+ 'sync query coverage cannot be proven for every read table instance from required equality/IN predicates on declared scopes; split the query or add an exact compatible scope proof',
1751
1751
  );
1752
1752
  }
1753
1753
  const divergent = eligible.find((candidate) =>
@@ -1852,7 +1852,11 @@ class Validator {
1852
1852
  );
1853
1853
  }
1854
1854
  const fixedScopes = table.scopes
1855
- .filter((scope) => scope.variable !== unit.binding.variable)
1855
+ .filter(
1856
+ (scope) =>
1857
+ scope.variable !== unit.binding.variable &&
1858
+ byVariable.has(scope.variable),
1859
+ )
1856
1860
  .map((scope) => {
1857
1861
  const fixed = byVariable.get(scope.variable) as
1858
1862
  | InferredScope