Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .changeset/25921-core-zero-consumer-exports.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
'@object-ui/core': patch
---

refactor(core)!: retire forty-two zero-consumer entry exports, and delete the query-AST convenience pair nothing reads

Clause-②: no (narrowing)
Metadata-protocol: none

<!-- adr-0087: not-required (runtime-export-retired @object-ui/core#buildQueryAST, @object-ui/core#defaultQueryASTBuilder, @object-ui/core#CANONICAL_COLUMN_IDENTITY_KEY, @object-ui/core#LEGACY_COLUMN_IDENTITY_KEYS, @object-ui/core#normalizeColumnIdentities, @object-ui/core#CANONICAL_COLUMN_LABEL_KEY, @object-ui/core#isOpenDomAttributeFamily, @object-ui/core#AffordanceGrantRow, @object-ui/core#normalizeObjectSortability, @object-ui/core#OBJECT_SORTABILITY_KEY, @object-ui/core#ACTION_SWITCHED_OFF_KEY, @object-ui/core#CASCADE_DELETE_OBJECTS_KEY, @object-ui/core#compareCellValues, @object-ui/core#SUBJECT_PERMISSIONS, @object-ui/core#SUBJECT_CAPABILITIES, @object-ui/core#ROW_PREDICATE_CANONICAL_ROOT, @object-ui/core#NAVIGATION_ALIAS_KEYS, @object-ui/core#HOST_DISPATCH_ACTION_KEYS, @object-ui/core#KNOWN_ACTION_KEYS, @object-ui/core#classifyActionKeys, @object-ui/core#hasDeprecatedObjectParams, @object-ui/core#warnOnDeprecatedObjectParams, @object-ui/core#isLegacyActionEnvelope, @object-ui/core#actionCopyText, @object-ui/core#fillTransitionalCopy, @object-ui/core#toCSSColor, @object-ui/core#generateTypographyVars, @object-ui/core#generateBorderRadiusVars, @object-ui/core#generateShadowVars, @object-ui/core#isElementDataSourceBlock, @object-ui/core#isErrorCode, @object-ui/core#formatErrorMessage, @object-ui/core#isDebugEnabled, @object-ui/core#ContextTokenName, @object-ui/core#isBuiltinAggregate, @object-ui/core#resolveMeasureLabel, @object-ui/core#resolveRelationshipTarget, @object-ui/core#resolveDimensionFieldOptions, @object-ui/core#INTEGER_AGGREGATES, @object-ui/core#isColorLiteral, @object-ui/core#buildFieldColorMap, @object-ui/core#FieldColorOption) the retired operands are client-side helpers, constants, symbol keys and three types of the UI core package; nothing in the workspace or in hotcrm imports any of them from the package entry, and no packages/spec schema, registered node type, conversion surface or stored shape names them, so there is nothing for `objectstack migrate meta` to rewrite -->

**BREAKING** for a host that imports any of these forty-two names from `@object-ui/core`. None had an importer anywhere in the workspace or in hotcrm, so the Console and every `@object-ui/*` package are unaffected.

Two of them are **gone from the package, not only from the entry**, because nothing inside the package read them either: `buildQueryAST` and the `defaultQueryASTBuilder` instance it wrapped are deleted from `query/query-ast.ts`.

The other forty stay in their modules for the code and tests that read them and only leave the entry. Every other name the entry exported stays exported unchanged, among them `QueryASTBuilder`, `columnIdentity`, `columnHeader`, `normalizeColumnIdentity`, `toDomProps`, `pickDomProps`, `AFFORDANCE_GRANTS`, `attachObjectSortability`, `readObjectSortability`, `markSwitchedOffActions`, `isActionSwitchedOff`, `attachCascadeDeleteObjects`, `readCascadeDeleteObjects`, `getSortValue`, `compareSortValues`, `bindSubjectPermissions`, `subjectPermissionsOf`, `bindSubjectCapabilities`, `subjectCapabilitiesOf`, `detectNonCanonicalRowSpelling`, `ACTION_DEF_KEYS`, `SPEC_ACTION_KEYS`, `RETIRED_ACTION_KEYS`, `warnOnUnknownActionKeys`, `interpretActionResponse`, `readActionPayload`, `actionCopySource`, `fillTemplateHoles`, `generateThemeVars`, `generateColorVars`, `elementDataSourceBlock`, `ERROR_CODES`, `createError`, `ObjectUIError` with all its subclasses, `debugLog`, `parseDebugFlags`, `CONTEXT_TOKENS`, `resolveFilterPlaceholders`, `buildChartSeries`, `isIntegerAggregate`, `resolveDimensionFieldMeta` and `createFieldColorResolver`.

What leaves, and what to write instead:

- FROM `buildQueryAST(query)`, `defaultQueryASTBuilder` TO `new QueryASTBuilder().build(query)`.
- FROM `CANONICAL_COLUMN_IDENTITY_KEY`, `LEGACY_COLUMN_IDENTITY_KEYS`, `CANONICAL_COLUMN_LABEL_KEY` TO `columnIdentity(column)` / `columnHeader(column)`, which read the canonical key and its legacy spellings; FROM `normalizeColumnIdentities(columns)` TO `columns.map(normalizeColumnIdentity)`.
- FROM `isOpenDomAttributeFamily` TO `toDomProps` / `pickDomProps`, which already pass every `data-*` and `aria-*` key.
- FROM `AffordanceGrantRow` TO `AffordanceGrant`, or `(typeof AFFORDANCE_GRANTS)[ConsoleAffordance]` for one row.
- FROM `normalizeObjectSortability`, `OBJECT_SORTABILITY_KEY` TO `attachObjectSortability` / `readObjectSortability`.
- FROM `ACTION_SWITCHED_OFF_KEY` TO `markSwitchedOffActions` / `markSwitchedOffActionsByObject` / `isActionSwitchedOff`.
- FROM `CASCADE_DELETE_OBJECTS_KEY` TO `attachCascadeDeleteObjects` / `readCascadeDeleteObjects`.
- FROM `compareCellValues(a, b, options)` TO `compareSortValues(getSortValue(a, options), getSortValue(b, options))`.
- FROM `SUBJECT_PERMISSIONS`, `SUBJECT_CAPABILITIES` TO `bindSubjectPermissions` / `subjectPermissionsOf` and `bindSubjectCapabilities` / `subjectCapabilitiesOf`.
- FROM `ROW_PREDICATE_CANONICAL_ROOT` TO the literal `'record'`, or `detectNonCanonicalRowSpelling` to check a predicate.
- FROM `NAVIGATION_ALIAS_KEYS`, `HOST_DISPATCH_ACTION_KEYS`, `KNOWN_ACTION_KEYS`, `classifyActionKeys` TO `warnOnUnknownActionKeys`, which classifies an action against the same vocabulary, or `ACTION_DEF_KEYS` / `SPEC_ACTION_KEYS` for the authored key lists.
- FROM `hasDeprecatedObjectParams`, `warnOnDeprecatedObjectParams` TO nothing: `ActionRunner` warns about deprecated object params itself when it runs the action.
- FROM `isLegacyActionEnvelope` TO `interpretActionResponse` / `readActionPayload`, which unwrap the legacy envelope.
- FROM `actionCopyText`, `fillTransitionalCopy` TO `actionCopySource` with `hasTemplateHoles` / `fillTemplateHoles`.
- FROM `toCSSColor`, `generateTypographyVars`, `generateBorderRadiusVars`, `generateShadowVars` TO `generateThemeVars(theme)`, which emits all of those variables, or `generateColorVars` for the colour block alone.
- FROM `isElementDataSourceBlock` TO nothing a host needs: the component registry reads it when `elementDataSourceBlock` marks a renderer.
- FROM `isErrorCode(code)` TO `code in ERROR_CODES`; FROM `formatErrorMessage(error)` TO `error.message` with `ERROR_CODES[error.code]` for the suggestion and doc link.
- FROM `isDebugEnabled` TO `debugLog` / `debugTime`, which are no-ops when debug mode is off.
- FROM `ContextTokenName` TO `(typeof CONTEXT_TOKENS)[number]`.
- FROM `isBuiltinAggregate`, `resolveMeasureLabel` TO `buildChartSeries` with `builtinAggregateLabels`, which labels a built-in aggregate measure the same way; FROM `INTEGER_AGGREGATES` TO `isIntegerAggregate`.
- FROM `resolveDimensionFieldOptions(...)` TO `resolveDimensionFieldMeta(...)`, the same walk, reading each entry's `options`; FROM `resolveRelationshipTarget` TO `resolveDimensionFieldMeta`, which follows the relationship for a dotted path.
- FROM `isColorLiteral`, `buildFieldColorMap`, `FieldColorOption` TO `createFieldColorResolver(fieldDef)`, which builds the colour map and accepts colour literals as-is.
33 changes: 24 additions & 9 deletions ui/packages/core/src/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,38 @@ export * from './ActionEngine.js';
export {
ACTION_DEF_KEYS,
SPEC_ACTION_KEYS,
NAVIGATION_ALIAS_KEYS,
HOST_DISPATCH_ACTION_KEYS,
RETIRED_ACTION_KEYS,
KNOWN_ACTION_KEYS,
classifyActionKeys,
warnOnUnknownActionKeys,
hasDeprecatedObjectParams,
warnOnDeprecatedObjectParams,
// `resetActionKeyWarnings` is test-only and stays off the barrel
// `resetActionKeyWarnings` is test-only and stays off the barrel;
// `NAVIGATION_ALIAS_KEYS`, `HOST_DISPATCH_ACTION_KEYS`, `KNOWN_ACTION_KEYS`,
// `classifyActionKeys`, `hasDeprecatedObjectParams` and
// `warnOnDeprecatedObjectParams` stay in the module for `ActionRunner` and
// its pins, off the public entry (objectstack#25921: zero consumers)
} from './actionKeys.js';
export * from './TransactionManager.js';
export * from './UndoManager.js';
export * from './bulkFastPath.js';
export * from './actionErrorDetail.js';
export * from './actionResponse.js';
// Named, not `export *`: `isLegacyActionEnvelope` stays in the module for its
// in-package readers and off the public entry (objectstack#25921: zero
// consumers).
export {
readActionPayload,
interpretActionResponse,
refusalFieldErrors,
type ActionResponseOutcome,
} from './actionResponse.js';
export * from './serverActionHandler.js';
export * from './recordIdParam.js';
export * from './recordDelete.js';
export * from './navigationTarget.js';
export * from './actionCopyTemplate.js';
// Named, not `export *`: `actionCopyText`, `fillTransitionalCopy` stay in the
// module for its in-package readers and off the public entry
// (objectstack#25921: zero consumers).
export {
isActionCopyEnvelope,
actionCopySource,
hasTemplateHoles,
fillTemplateHoles,
type ActionCopyTemplate,
} from './actionCopyTemplate.js';
3 changes: 2 additions & 1 deletion ui/packages/core/src/data-scope/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export {
elementDataSourceBlock,
elementDataSourceRefusedLimitMessage,
elementDataSourceViewNotFoundMessage,
isElementDataSourceBlock,
// `isElementDataSourceBlock` stays in the module for the registry and off
// the public entry (objectstack#25921: zero consumers).
isElementDataSourceConfig,
resolveSavedView,
type ComposedElementDataSource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ import { describe, it, expect, vi, beforeEach, afterEach, type MockInstance } fr
import * as core from '../index.js';
import {
detectNonCanonicalRowSpelling,
ROW_PREDICATE_CANONICAL_ROOT,
evalRowPredicate,
partitionRowsByPredicate,
} from '../index.js';
import { ROW_PREDICATE_CANONICAL_ROOT } from '../rowPredicateCanon.js';

const row = { status: 'in_review', amount: 10 };
const other = { status: 'draft', amount: 1 };
Expand Down Expand Up @@ -165,7 +165,9 @@ describe('[#5741] `evalRowPredicate` — the row is bound as `record.*` only', (
expect('warnNonCanonicalRowSpelling' in core).toBe(false);
expect('resetRowPredicateCanonWarnings' in core).toBe(false);
expect(typeof core.detectNonCanonicalRowSpelling).toBe('function');
expect(core.ROW_PREDICATE_CANONICAL_ROOT).toBe('record');
// The canonical-root constant stays in the module, off the barrel
// (objectstack#25921: zero consumers outside the package).
expect('ROW_PREDICATE_CANONICAL_ROOT' in core).toBe(false);
});

it('`partitionRowsByPredicate`: `record.*` still partitions; a retired spelling excludes EVERY row', () => {
Expand Down
18 changes: 16 additions & 2 deletions ui/packages/core/src/evaluator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,22 @@ export * from './ExpressionEvaluator.js';
export * from './predicateInput.js';
export * from './declaredPredicate.js';
export * from './fieldRules.js';
export * from './subjectPermissions.js';
export * from './rowPredicateCanon.js';
// Named, not `export *`: `SUBJECT_PERMISSIONS`, `SUBJECT_CAPABILITIES` stay in
// the module for its in-package readers and off the public entry
// (objectstack#25921: zero consumers).
export {
bindSubjectPermissions,
subjectPermissionsOf,
bindSubjectCapabilities,
subjectCapabilitiesOf,
} from './subjectPermissions.js';
// Named, not `export *`: `ROW_PREDICATE_CANONICAL_ROOT` stays in the module for
// its in-package readers and off the public entry (objectstack#25921: zero
// consumers).
export {
detectNonCanonicalRowSpelling,
type NonCanonicalRowSpelling,
} from './rowPredicateCanon.js';
export * from './listConditional.js';
export * from './deadlineSettled.js';
export * from './optionRules.js';
Expand Down
Loading
Loading