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
4 changes: 2 additions & 2 deletions packages/components/src/renderers/basic/span.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
*/

import { ComponentRegistry } from '@object-ui/core';
import type { SpanSchema } from '@object-ui/types';
import type { TextSpanSchema } from '@object-ui/types';
import { renderChildren } from '../../lib/utils';
import { forwardRef } from 'react';

const SpanRenderer = forwardRef<HTMLSpanElement, { schema: SpanSchema; className?: string; [key: string]: any }>(
const SpanRenderer = forwardRef<HTMLSpanElement, { schema: TextSpanSchema; className?: string; [key: string]: any }>(
({ schema, className, ...props }, ref) => {
// Deprecation warning
if (process.env.NODE_ENV !== 'production') {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/renderers/form/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { ComponentRegistry, resolveFieldRuleState, evalFieldPredicate, resolveCascadingOptions, isValueStillOffered } from '@object-ui/core';
import type { FormSchema, FormField as FormFieldConfig, FormFieldTab, FormFieldPane, ValidationRule, FieldCondition, SelectOption } from '@object-ui/types';
import type { FormSchema, FormField as FormFieldConfig, FormFieldTab, FormFieldPane, FieldValidationRules, FieldCondition, SelectOption } from '@object-ui/types';
import { useForm } from 'react-hook-form';
import { Form, FormField, FormItem, FormLabel, FormControl, FormMessage, FormDescription } from '../../ui/form';
import { Button } from '../../ui/button';
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/adapters/ValueDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import type {
DataSource,
BatchTransactionOperation,
MutationEvent,
DataSourceMutationEvent,
QueryParams,
QueryResult,
AggregateParams,
Expand Down Expand Up @@ -233,7 +233,7 @@ function selectFields<T>(record: T, fields?: string[]): T {
export class ValueDataSource<T = any> implements DataSource<T> {
private items: T[];
private idField: string | undefined;
private mutationListeners = new Set<(event: MutationEvent<T>) => void>();
private mutationListeners = new Set<(event: DataSourceMutationEvent<T>) => void>();

constructor(config: ValueDataSourceConfig<T>) {
// Deep clone to prevent external mutation
Expand All @@ -242,7 +242,7 @@ export class ValueDataSource<T = any> implements DataSource<T> {
}

/** Notify all mutation subscribers */
private emitMutation(event: MutationEvent<T>): void {
private emitMutation(event: DataSourceMutationEvent<T>): void {
for (const listener of this.mutationListeners) {
try { listener(event); } catch (err) { console.warn('ValueDataSource: mutation listener error', err); }
}
Expand Down Expand Up @@ -453,7 +453,7 @@ export class ValueDataSource<T = any> implements DataSource<T> {
// Mutation subscription (P2 — Event Bus)
// -----------------------------------------------------------------------

onMutation(callback: (event: MutationEvent<T>) => void): () => void {
onMutation(callback: (event: DataSourceMutationEvent<T>) => void): () => void {
this.mutationListeners.add(callback);
return () => { this.mutationListeners.delete(callback); };
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/query/query-ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
FromNode,
WhereNode,
JoinNode,
GroupByNode,
GroupByClauseNode,
OrderByNode,
LimitNode,
OffsetNode,
Expand Down Expand Up @@ -210,7 +210,7 @@ export class QueryASTBuilder {
};
}

private buildGroupBy(fields: string[]): GroupByNode {
private buildGroupBy(fields: string[]): GroupByClauseNode {
return {
type: 'group_by',
fields: fields.map(field => this.buildField(field)),
Expand Down
10 changes: 5 additions & 5 deletions packages/data-objectstack/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ObjectStackClient, type QueryOptions as ObjectStackQueryOptions } from
import type {
DataSource,
BatchTransactionOperation,
MutationEvent,
DataSourceMutationEvent,
QueryParams,
QueryResult,
GlobalSearchResult,
Expand Down Expand Up @@ -658,7 +658,7 @@ export class ObjectStackAdapter<T = unknown> implements DataSource<T> {
// create/update/delete so data-bound views (ListView, ObjectView, kanban,
// calendar) auto-refresh — the interface ListView relies on to reflect
// inline-edit "Save All" writes without a manual reload.
private mutationListeners = new Set<(event: MutationEvent<T>) => void>();
private mutationListeners = new Set<(event: DataSourceMutationEvent<T>) => void>();

// Subscribers registered via onWriteWarning(). Emitted after a create/update
// whose response carried `droppedFields` (framework #3431/#3455) so the app
Expand Down Expand Up @@ -1073,7 +1073,7 @@ export class ObjectStackAdapter<T = unknown> implements DataSource<T> {
* Notify all mutation subscribers. A throwing listener must not break the
* mutation or starve the other subscribers, so each is isolated.
*/
private emitMutation(event: MutationEvent<T>): void {
private emitMutation(event: DataSourceMutationEvent<T>): void {
for (const listener of this.mutationListeners) {
try {
listener(event);
Expand All @@ -1089,7 +1089,7 @@ export class ObjectStackAdapter<T = unknown> implements DataSource<T> {
* mutation (e.g. inline-edit "Save All", which writes through `update` and
* must repaint the list without a manual reload).
*/
onMutation(callback: (event: MutationEvent<T>) => void): () => void {
onMutation(callback: (event: DataSourceMutationEvent<T>) => void): () => void {
this.mutationListeners.add(callback);
return () => {
this.mutationListeners.delete(callback);
Expand Down Expand Up @@ -1476,7 +1476,7 @@ export class ObjectStackAdapter<T = unknown> implements DataSource<T> {
}

/**
* Emit one MutationEvent per committed operation so the invalidation bus
* Emit one DataSourceMutationEvent per committed operation so the invalidation bus
* (#2269) sees writes that went through /batch exactly like single
* create/update/delete calls — master-detail ModalForm saves otherwise leave
* related lists and count badges stale (#2582). `results` is index-aligned
Expand Down
70 changes: 35 additions & 35 deletions packages/data-objectstack/src/onMutation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
clearSharedDiscoveryCache,
readTransactionalBatchCapability,
} from './index';
import type { MutationEvent } from '@object-ui/types';
import type { DataSourceMutationEvent } from '@object-ui/types';

function makeDS(stub: Record<string, any>) {
const ds: any = new ObjectStackAdapter({
Expand All @@ -49,8 +49,8 @@ describe('ObjectStackAdapter.onMutation', () => {
.mockResolvedValue({ record: { id: 'r1', account: 'acc-1' } });
const ds = makeDS({ update });

const events: MutationEvent[] = [];
const unsub = ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
const unsub = ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

await ds.update('showcase_project', 'r1', { account: 'acc-1' });

Expand All @@ -67,8 +67,8 @@ describe('ObjectStackAdapter.onMutation', () => {
it('emits a create event with the new record', async () => {
const create = vi.fn().mockResolvedValue({ record: { id: 'new', name: 'X' } });
const ds = makeDS({ create });
const events: MutationEvent[] = [];
ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

await ds.create('showcase_project', { name: 'X' });

Expand All @@ -83,8 +83,8 @@ describe('ObjectStackAdapter.onMutation', () => {
.mockResolvedValueOnce({ deleted: true })
.mockResolvedValueOnce({ deleted: false });
const ds = makeDS({ delete: del });
const events: MutationEvent[] = [];
ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

await ds.delete('showcase_project', 'r1');
await ds.delete('showcase_project', 'r2');
Expand All @@ -97,8 +97,8 @@ describe('ObjectStackAdapter.onMutation', () => {
it('emits a single bulk event per bulkUpdate call (not per id)', async () => {
const updateMany = vi.fn().mockResolvedValue({ succeeded: 3, failed: 0, results: [] });
const ds = makeDS({ updateMany });
const events: MutationEvent[] = [];
ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

await ds.bulkUpdate('showcase_project', ['a', 'b', 'c'], { archived: true });

Expand All @@ -108,8 +108,8 @@ describe('ObjectStackAdapter.onMutation', () => {
it('does not emit when a bulk operation affected zero rows', async () => {
const updateMany = vi.fn().mockResolvedValue({ succeeded: 0, failed: 0, results: [] });
const ds = makeDS({ updateMany });
const events: MutationEvent[] = [];
ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

await ds.bulkUpdate('showcase_project', ['a'], { archived: true });

Expand Down Expand Up @@ -160,8 +160,8 @@ describe('ObjectStackAdapter.batchTransaction mutation events', () => {
{ status: 200, headers: { 'Content-Type': 'application/json' } },
),
);
const events: MutationEvent[] = [];
ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

await ds.batchTransaction([
{ object: 'ehr_task_version', action: 'create', data: { name: 'Task version A' } },
Expand All @@ -183,8 +183,8 @@ describe('ObjectStackAdapter.batchTransaction mutation events', () => {
{ status: 200, headers: { 'Content-Type': 'application/json' } },
),
);
const events: MutationEvent[] = [];
ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

await ds.batchTransaction([
{ object: 'ehr_task_version', action: 'update', id: 'p1', data: { name: 'Renamed' } },
Expand All @@ -208,8 +208,8 @@ describe('ObjectStackAdapter.batchTransaction mutation events', () => {
headers: { 'Content-Type': 'application/json' },
}),
);
const events: MutationEvent[] = [];
ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

await ds.batchTransaction([{ object: 'ehr_task_version', data: { name: 'X' } }]);

Expand All @@ -225,8 +225,8 @@ describe('ObjectStackAdapter.batchTransaction mutation events', () => {
headers: { 'Content-Type': 'application/json' },
}),
);
const events: MutationEvent[] = [];
ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

await expect(
ds.batchTransaction([{ object: 'ehr_task_version', action: 'create', data: {} }]),
Expand Down Expand Up @@ -265,8 +265,8 @@ describe('ObjectStackAdapter.batchTransaction fallback (no server atomicity)', (
const create = vi.fn(async (_o: string, d: any) => ({ record: { id: 'p1', ...d } }));
const { ds, batchTransaction } = makeFallbackDS({ batchStatus: 404, clientData: { create } });
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
const events: MutationEvent[] = [];
ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

const res = await ds.batchTransaction([{ object: 'proj', action: 'create', data: { name: 'A' } }]);

Expand Down Expand Up @@ -311,8 +311,8 @@ describe('ObjectStackAdapter.batchTransaction fallback (no server atomicity)', (
ds.connected = true;
ds.connectionState = 'connected';
ds.client = { data: { batchTransaction: sdkBatch } };
const events: MutationEvent[] = [];
ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

const res = await ds.batchTransaction([{ object: 'proj', action: 'create', data: { name: 'A' } }]);

Expand All @@ -335,8 +335,8 @@ describe('ObjectStackAdapter.bulk mutation events', () => {
it('emits a single create event per bulk create call', async () => {
const createMany = vi.fn().mockResolvedValue([{ id: 'c1' }, { id: 'c2' }]);
const ds = makeDS({ createMany });
const events: MutationEvent[] = [];
ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

await ds.bulk('ehr_task_check_item', 'create', [{ label: 'a' }, { label: 'b' }]);

Expand All @@ -346,8 +346,8 @@ describe('ObjectStackAdapter.bulk mutation events', () => {
it('does not emit when a bulk create returned zero records', async () => {
const createMany = vi.fn().mockResolvedValue([]);
const ds = makeDS({ createMany });
const events: MutationEvent[] = [];
ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

await ds.bulk('ehr_task_check_item', 'create', [{ label: 'a' }]);

Expand All @@ -357,8 +357,8 @@ describe('ObjectStackAdapter.bulk mutation events', () => {
it('emits a single delete event per bulk delete call', async () => {
const deleteMany = vi.fn().mockResolvedValue(undefined);
const ds = makeDS({ deleteMany });
const events: MutationEvent[] = [];
ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

await ds.bulk('ehr_task_check_item', 'delete', [{ id: 'c1' }, { id: 'c2' }] as any);

Expand All @@ -368,8 +368,8 @@ describe('ObjectStackAdapter.bulk mutation events', () => {
it('emits a single update event per bulk update call', async () => {
const updateMany = vi.fn().mockResolvedValue([{ id: 'c1' }]);
const ds = makeDS({ updateMany });
const events: MutationEvent[] = [];
ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

await ds.bulk('ehr_task_check_item', 'update', [{ id: 'c1', label: 'x' }] as any);

Expand All @@ -379,8 +379,8 @@ describe('ObjectStackAdapter.bulk mutation events', () => {
it('bulk create failure emits nothing', async () => {
const createMany = vi.fn().mockRejectedValue(new Error('boom'));
const ds = makeDS({ createMany });
const events: MutationEvent[] = [];
ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

await expect(ds.bulk('ehr_task_check_item', 'create', [{ label: 'a' }])).rejects.toThrow();

Expand Down Expand Up @@ -481,8 +481,8 @@ describe('ObjectStackAdapter.batchTransaction capability gate (#2693 / framework
batchStatus: 200,
batchBody: { results: [{ id: 'p1', name: 'A' }, { id: 'c1', proj: 'p1' }] },
});
const events: MutationEvent[] = [];
ds.onMutation((e: MutationEvent) => events.push(e));
const events: DataSourceMutationEvent[] = [];
ds.onMutation((e: DataSourceMutationEvent) => events.push(e));

const res = await ds.batchTransaction([
{ object: 'proj', action: 'create', data: { name: 'A' } },
Expand Down
2 changes: 1 addition & 1 deletion packages/mobile/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export type {
MobileOverrides,
PWAConfig,
PWAIcon,
CacheStrategy,
FetchCacheStrategy,
OfflineConfig,
OfflineRoute,
GestureType,
Expand Down
14 changes: 7 additions & 7 deletions packages/plugin-report/src/LiveReportExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import type {
DataSource,
QueryParams,
ReportSchema,
ReportComponentSchema,
ReportExportFormat,
ReportExportConfig,
ReportField,
ReportSchedule,
ReportScheduleConfig,
} from '@object-ui/types';
import { exportReport } from './ReportExportEngine';

Expand Down Expand Up @@ -78,8 +78,8 @@ export interface LiveExportResult {
* Schedule trigger callback
*/
export type ScheduleTriggerCallback = (
report: ReportSchema,
schedule: ReportSchedule,
report: ReportComponentSchema,
schedule: ReportScheduleConfig,
) => void;

/**
Expand All @@ -95,7 +95,7 @@ export type ScheduleTriggerCallback = (
* ```
*/
export async function exportWithLiveData(
report: ReportSchema,
report: ReportComponentSchema,
options: LiveExportOptions,
): Promise<LiveExportResult> {
const {
Expand Down Expand Up @@ -159,7 +159,7 @@ export async function exportWithLiveData(
* ```
*/
export function exportExcelWithFormulas(
report: ReportSchema,
report: ReportComponentSchema,
data: any[],
options: {
columns?: ExcelColumnConfig[];
Expand Down Expand Up @@ -243,7 +243,7 @@ export function exportExcelWithFormulas(
* ```
*/
export function createScheduleTrigger(
report: ReportSchema,
report: ReportComponentSchema,
dataSource: DataSource,
resource: string,
onComplete: ScheduleTriggerCallback,
Expand Down
Loading
Loading