Skip to content

Commit 8ad4407

Browse files
committed
fix(types): take the record page request shapes from the spec
check:spec-symbols refused three hand-written declarations in @object-ui/types under names @objectstack/spec/api already exports (RecordPageRelatedRequest, RecordPageRequest, RecordPagePartRefusal). They are now re-exported from the spec, and RecordPageOperation is bound to the spec's RecordPageExplainOperation. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzhCjfxaYJQyy6tFjVr
1 parent 0efe2a4 commit 8ad4407

1 file changed

Lines changed: 12 additions & 39 deletions

File tree

‎ui/packages/types/src/data.ts‎

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import type {
2424
ImportJobStatus,
2525
ImportRowResult,
2626
ImportWriteMode,
27+
RecordPageExplainOperation,
28+
RecordPagePartRefusal,
29+
RecordPageRequest,
2730
UndoImportJobResponse,
2831
} from '@objectstack/spec/api';
2932
import type { EngineAggregateOptions, FilterArray } from '@objectstack/spec/data';
@@ -375,45 +378,15 @@ export interface RecordFieldAccess {
375378
}
376379

377380
/** A record-grained operation a record page's header asks a verdict for. */
378-
export type RecordPageOperation = 'update' | 'delete' | 'transfer';
379-
380-
/** One related list a record page draws, as {@link RecordPageRequest} names it. */
381-
export interface RecordPageRelatedRequest {
382-
/** The child object. */
383-
object: string;
384-
/** The child's lookup or master-detail field that points at the record. */
385-
field: string;
386-
/** The list's own declared scope, AND-composed with the parent condition. */
387-
filter?: unknown;
388-
/** How many first rows to return with the count (0 = the count alone). */
389-
top: number;
390-
/** The order of the first rows, as the list's row read sends `$orderby`; absent for the default order. */
391-
sort?: Array<{ field: string; order: 'asc' | 'desc' }>;
392-
}
393-
394-
/**
395-
* What a record page asks of the server when it opens
396-
* (`POST /data/{object}/{id}/page`, `RecordPageRequest` in `@objectstack/spec`).
397-
*/
398-
export interface RecordPageRequest {
399-
/** Lookup fields of the record to resolve, as `findOne`'s `$expand`. */
400-
expand?: string[];
401-
/** The related lists the page draws, in order. */
402-
related?: RecordPageRelatedRequest[];
403-
/** The operations to answer a record-grained access verdict for. */
404-
explain?: RecordPageOperation[];
405-
/** Return the caller's field projection of the record. */
406-
fieldAccess?: boolean;
407-
/** Return the record's approval requests and its approval lock. */
408-
approvals?: boolean;
409-
}
410-
411-
/** The refusal a replaced read answers, carried in place of a part's answer. */
412-
export interface RecordPagePartRefusal {
413-
code: string;
414-
status: number;
415-
message: string;
416-
}
381+
export type RecordPageOperation = RecordPageExplainOperation;
382+
383+
// What a record page asks when it opens (`POST /data/{object}/{id}/page`) and
384+
// the refusal a replaced read answers are the spec's own shapes.
385+
export type {
386+
RecordPagePartRefusal,
387+
RecordPageRelatedRequest,
388+
RecordPageRequest,
389+
} from '@objectstack/spec/api';
417390

418391
/**
419392
* The answer to {@link RecordPageRequest} (`RecordPageResponse` in

0 commit comments

Comments
 (0)