|
| 1 | +--- |
| 2 | +"@objectstack/spec": major |
| 3 | +"@objectstack/plugin-sharing": major |
| 4 | +--- |
| 5 | + |
| 6 | +feat(spec)!: resolve the three cross-form dual-source names — ShareRecipientType, TransformType, suggestFieldType (#4539) |
| 7 | + |
| 8 | +Three `dual-source-exports.baseline.json` rows where the two declarations |
| 9 | +sharing a name did not even share a FORM (type vs const, or two unrelated |
| 10 | +functions), so a wrong import-path pick had no shape overlap to hide behind |
| 11 | +and failed far from the cause. Each judged against a three-repo import-level |
| 12 | +scan (framework, cloud, objectui — the latter two contained zero references |
| 13 | +to all three names). All three rows are deleted from the baseline. |
| 14 | + |
| 15 | +**Renamed — `./contracts` `ShareRecipientType` → `RecordShareRecipientType`:** |
| 16 | + |
| 17 | +Two live concepts shared the name. The security zod enum |
| 18 | +(`user | team | position | unit_and_subordinates | business_unit`) is the |
| 19 | +authorable sharing-RULE recipient vocabulary and keeps the name. The contracts |
| 20 | +type describes a different thing — the `recipient_type` a `sys_record_share` |
| 21 | +ROW may carry — and its claim to "mirror spec/security" had been false since |
| 22 | +`group`→`team`/`guest` were retired there. Its member set is now aligned to |
| 23 | +the storage-side gate it actually mirrors, the `SysRecordShare` |
| 24 | +`recipient_type` select: `role` (never persistable, zero producers) is |
| 25 | +replaced by `position`. Only `user` is enforced (and written) today; |
| 26 | +`ISharingService.grant` keeps refusing every other value (ADR-0078). |
| 27 | +Fix: `import type { ShareRecipientType } from '@objectstack/spec/contracts'` |
| 28 | +(or from `@objectstack/plugin-sharing`, whose re-export is renamed in |
| 29 | +lockstep) → `RecordShareRecipientType`; code that named the `'role'` member |
| 30 | +was describing a value no row could ever hold — use the rule vocabulary |
| 31 | +(`SharingRuleRecipientType`) if a role recipient was meant. |
| 32 | + |
| 33 | +**Renamed — `./shared` `TransformTypeSchema` / `TransformType` → |
| 34 | +`FieldMappingTransformSchema` / `FieldMappingTransform`:** |
| 35 | + |
| 36 | +`./data`'s `TransformType` (the authorable import-mapping enum |
| 37 | +`none | constant | lookup | split | join | javascript | map`) is the live |
| 38 | +declaration and keeps the name. `./shared` exported `TransformType` as the |
| 39 | +inferred type of `TransformTypeSchema` — a differently-shaped discriminated |
| 40 | +union of transform CONFIG objects — with zero importers for either name in |
| 41 | +all three repos. The shared pair is renamed (not just the alias deleted): |
| 42 | +the docs generator derives `import type { X }` examples by stripping |
| 43 | +`Schema` from each schema const, so an alias-less `TransformTypeSchema` |
| 44 | +would have kept generating a reference to an export that no longer exists. |
| 45 | +Fix: `TransformTypeSchema` → `FieldMappingTransformSchema`, |
| 46 | +`import type { TransformType } from '@objectstack/spec/shared'` → |
| 47 | +`FieldMappingTransform` (same shape); importers who meant the import-mapping |
| 48 | +enum import `TransformType` from `@objectstack/spec/data`. |
| 49 | + |
| 50 | +**Renamed — `./data` `suggestFieldType` → `suggestFieldTypeForSqlType`:** |
| 51 | + |
| 52 | +The only function-kind dual-source. The two implementations were never forks |
| 53 | +of one function — different signatures, semantics and return types: |
| 54 | +`shared/suggestions.zod.ts` (kept on `.` / `./shared` under the original |
| 55 | +name) is the typo-suggester for an invalid authored FieldType |
| 56 | +(`(input: string) => string[]`, alias table + Levenshtein, feeds the zod |
| 57 | +error map), while `data/type-compat.ts` is the deterministic SQL-column → |
| 58 | +FieldType mapper for external-datasource drafts |
| 59 | +(`(rawType, dialect?) => FieldType | undefined`, ADR-0015 §4.6). Same input, |
| 60 | +divergent outputs — `('varchar(255)')` → `[]` vs `'text'`; `('text_area')` → |
| 61 | +`['textarea']` vs `undefined`; `('int')` → `['number']` vs `'number'` — and |
| 62 | +the wrong pick compiled wherever the result was only truthiness-checked |
| 63 | +(`[]` is truthy). Behavioral divergence is now pinned in |
| 64 | +`data/type-compat.test.ts`. |
| 65 | +Fix: `import { suggestFieldType } from '@objectstack/spec/data'` → |
| 66 | +`suggestFieldTypeForSqlType` (same signature); imports from the root entry |
| 67 | +or `./shared` are unaffected. |
0 commit comments