Skip to content
Open
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
107 changes: 0 additions & 107 deletions packages/appkit/src/database/contract/column-info.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/appkit/src/database/contract/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
export * from "./column-info";
export * from "./registry";
export * from "./relation";
export * from "./wire";
24 changes: 0 additions & 24 deletions packages/appkit/src/database/contract/relation.ts

This file was deleted.

129 changes: 0 additions & 129 deletions packages/appkit/src/database/contract/tests/column-info.test.ts

This file was deleted.

39 changes: 1 addition & 38 deletions packages/appkit/src/database/contract/tests/registry.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { describe, expectTypeOf, it } from "vitest";
import type {
DatabaseRegistryEntry,
ReferentialAction,
RegisteredEntity,
RelationEdge,
} from "../index";
import type { DatabaseRegistryEntry, RegisteredEntity } from "../index";

/**
* Type-level tests for the contract. These are verified by `tsc` during
Expand Down Expand Up @@ -57,35 +52,3 @@ describe("DatabaseRegistryEntry shape", () => {
expectTypeOf<DatabaseRegistryEntry>().toHaveProperty("includes");
});
});

describe("RelationEdge shape", () => {
it("requires the from/to columns and allows optional referential actions", () => {
const edge: RelationEdge = {
fromColumn: "author_id",
toTable: "users",
toColumn: "id",
onDelete: "cascade",
onUpdate: "no action",
};
expectTypeOf(edge.fromColumn).toEqualTypeOf<string>();
expectTypeOf(edge.toTable).toEqualTypeOf<string>();
expectTypeOf(edge.toColumn).toEqualTypeOf<string>();
expectTypeOf(edge.onDelete).toEqualTypeOf<ReferentialAction | undefined>();
expectTypeOf(edge.onUpdate).toEqualTypeOf<ReferentialAction | undefined>();
});

it("accepts a minimal edge without referential actions", () => {
const edge: RelationEdge = {
fromColumn: "author_id",
toTable: "users",
toColumn: "id",
};
expectTypeOf(edge).toMatchTypeOf<RelationEdge>();
});

it("pins the referential-action union", () => {
expectTypeOf<ReferentialAction>().toEqualTypeOf<
"cascade" | "set null" | "set default" | "restrict" | "no action"
>();
});
});
7 changes: 3 additions & 4 deletions packages/appkit/src/database/contract/wire.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
/** Max number of values allowed in an `in.(…)` list. */
export const IN_CAP = 100;
/** Hard ceiling for `.limit()` clamp. */
/** Hard ceiling for a runtime query limit. */
export const MAX_LIMIT = 500;
/** Default page size when no `.limit()` is supplied. */
export const DEFAULT_LIMIT = 50;
/** Max number of relations resolvable in a single `.include()`. */
export const MAX_INCLUDES = 10;

/** Filter operators usable in the runtime WHERE translator and the `where` spec type. */
export const FILTER_OPERATORS = [
export const FILTER_OPERATORS = Object.freeze([
"eq",
"neq",
"gt",
Expand All @@ -19,7 +18,7 @@ export const FILTER_OPERATORS = [
"ilike",
"in",
"is",
] as const;
] as const);

export type FilterOperator = (typeof FILTER_OPERATORS)[number];

Expand Down
Loading
Loading