Conversation
|
nice is this ready to review? |
|
yep, pr ready |
|
out of curiosity, breaking changes? so we'll need to change FE before we do this one? |
…indOne result key
474d2e0 to
815edac
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
fixes https://github.com/constructive-io/constructive-planning/issues/752
ORM model interfaces (the core fix)
findFirst — single object return ✓
findFirst
(args: FindFirstArgs<S, UserFilter, UserOrderBy> & { select: S } & StrictSelect<S, UserSelect>
): QueryBuilder<{
user: InferSelectResult<UserWithRelations, S> | null; // ← singular, was array
}>
With transform callback: (data) => ({ user: data.users?.nodes?.[0] ?? null })
findOne — single object return ✓
Same { user: ... | null } shape as findFirst, using buildFindManyDocument with where: { id: { equalTo: args.id } }, first: 1.
Coverage across SDKs (constructive-sdk only — others mirror)
FindFirstArgs interface (in generated select-types.ts)
export interface FindFirstArgs<TSelect, TWhere, TOrderBy = never> {
select?: TSelect;
where?: TWhere;
orderBy?: TOrderBy[]; // ← new orderBy support
}
CLI (sdk/constructive-cli)
React hooks (sdk/constructive-react)
migrate-client SDK
Same pattern verified on SqlAction.findFirst — returns { sqlAction: ... | null } with SqlActionOrderBy type param.
Build + typecheck (already done)