You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@objectstack/spec 17.4.0 exports no type for the ctx.api a *.hook.ts body receives. Checked on the installed package: grep -rhoE "export (type|interface) (HookApi|HookContext|HookObjectApi)" node_modules/@objectstack/spec/dist/data/*.d.ts returns nothing. A hook therefore casts ctx.api as HookApi | undefined against a type the app wrote.
Evidence (hotcrm, origin/mainc716a2c)
src/objects/_hook-api.ts — ~2,358 authored tokens declaring HookQuery, HookCountQuery, HookUpdateDoc, HookUpdateOptions, HookDeleteOptions, HookObjectApi, HookApi; imported by all 17 hook files in the app.
The file exists to make the where / filter mixing hazard a compile error (HookQuery omits filter; test/hook-query-predicate.test.ts pins the engine per method) — i.e. it encodes engine behaviour the platform knows and the app re-derived.
Export the hook API surface from @objectstack/spec/data (or wherever the hook contract lives) so that an app's hook can import type { HookApi } from '@objectstack/spec/data' and delete its own copy. The where-only query shape (no filter key) should be the exported shape, since the engine folds filter to where and refuses both.
Gap
@objectstack/spec17.4.0 exports no type for thectx.apia*.hook.tsbody receives. Checked on the installed package:grep -rhoE "export (type|interface) (HookApi|HookContext|HookObjectApi)" node_modules/@objectstack/spec/dist/data/*.d.tsreturns nothing. A hook therefore castsctx.api as HookApi | undefinedagainst a type the app wrote.Evidence (hotcrm,
origin/mainc716a2c)src/objects/_hook-api.ts— ~2,358 authored tokens declaringHookQuery,HookCountQuery,HookUpdateDoc,HookUpdateOptions,HookDeleteOptions,HookObjectApi,HookApi; imported by all 17 hook files in the app.where/filtermixing hazard a compile error (HookQueryomitsfilter;test/hook-query-predicate.test.tspins the engine per method) — i.e. it encodes engine behaviour the platform knows and the app re-derived.Ask
Export the hook API surface from
@objectstack/spec/data(or wherever the hook contract lives) so that an app's hook canimport type { HookApi } from '@objectstack/spec/data'and delete its own copy. Thewhere-only query shape (nofilterkey) should be the exported shape, since the engine foldsfiltertowhereand refuses both.Dedupe words: HookApi, hook ctx.api type, _hook-api.ts, HookQuery, HookObjectApi.