From 0c58bfe687b1ff9af4968a8f2ed54e1ced92fadf Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 19:41:37 +0000 Subject: [PATCH 1/2] docs(skills): owner_id in the session-token filter example, bound user id in the hook find example The query skill's session-token example filtered on `owner`, a column the platform does not provision; it now names `owner_id`. The hook reference's `find` example compared `owner_id` to an unbound `uid`; it now reads `ctx.session?.userId`. The filters.md addition is paid in the same file by dropping a third restatement of `{30_days_ago}`. Claude-Session: https://claude.ai/code/session_01ADHkmPNsfEF3TsQJfFdSGv Co-authored-by: Claude --- .changeset/33730-skills-query-hook-examples.md | 8 ++++++++ skills/objectstack-data/references/data-hooks.md | 2 +- skills/objectstack-query/rules/filters.md | 5 ++--- 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 .changeset/33730-skills-query-hook-examples.md diff --git a/.changeset/33730-skills-query-hook-examples.md b/.changeset/33730-skills-query-hook-examples.md new file mode 100644 index 00000000000..c54417e4989 --- /dev/null +++ b/.changeset/33730-skills-query-hook-examples.md @@ -0,0 +1,8 @@ +--- +'@objectstack/skills': patch +--- + +Clause-②: no +Metadata-protocol: none + +The published query and hook skill examples now filter on the platform's `owner_id` column with `{current_user_id}`, and the hook `find` example reads the caller's id from `ctx.session?.userId` instead of an unbound variable. diff --git a/skills/objectstack-data/references/data-hooks.md b/skills/objectstack-data/references/data-hooks.md index 93990109626..5d6edbc4046 100644 --- a/skills/objectstack-data/references/data-hooks.md +++ b/skills/objectstack-data/references/data-hooks.md @@ -295,7 +295,7 @@ same DSL as the [objectstack-query](../../objectstack-query/SKILL.md) skill: await ctx.api.object('candidate').findOne({ where: { id: ctx.result.id } }); await ctx.api.object('candidate').find({ where: { stage: 'hired' } }); await ctx.api.object('invoice').count({ where: { amount: { $gte: 1000 } } }); -await ctx.api.object('task').find({ where: { $and: [{ done: false }, { owner_id: uid }] } }); +await ctx.api.object('task').find({ where: { $and: [{ done: false }, { owner_id: ctx.session?.userId }] } }); ``` > `filter:` is tolerated as an **object-valued** alias (normalised to `where`), diff --git a/skills/objectstack-query/rules/filters.md b/skills/objectstack-query/rules/filters.md index a55ddd2b310..2f432bcf8c8 100644 --- a/skills/objectstack-query/rules/filters.md +++ b/skills/objectstack-query/rules/filters.md @@ -163,8 +163,7 @@ where: { period boundaries like `{current_month_start}`, `{last_quarter_end}`, `{next_year_start}` (and bare aliases like `{month_start}`). - **Parameterised tokens:** `{N__ago}` / `{N__from_now}` with - units `minute|hour|day|week|month|year` — e.g. `{30_days_ago}`, - `{2_weeks_from_now}`. + units `minute|hour|day|week|month|year` — e.g. `{2_weeks_from_now}`. - **Both spellings parse:** `{today}` and `${today}` are the same token (`DATE_MACRO_WRAPPED_RE` is `/^\$?\{([a-zA-Z0-9_]+)\}$/`, and the context tokens share it). @@ -174,7 +173,7 @@ where: { user's id and the active organization id. ```typescript -where: { owner: '{current_user_id}', close_date: { $gte: '{current_year_start}' } } +where: { owner_id: '{current_user_id}', close_date: { $gte: '{current_year_start}' } } ``` **Scope:** tokens expand on **both** sides of the wire — client-side by From 2d1bc82ec5c6609ce8b26c81c42018a34656c159 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 20:35:32 +0000 Subject: [PATCH 2/2] docs(skills): the hook find example reads the user id first and returns early without one A security item is with the owner seat. Claude-Session: https://claude.ai/code/session_01ADHkmPNsfEF3TsQJfFdSGv Co-authored-by: Claude --- skills/objectstack-data/references/data-hooks.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/skills/objectstack-data/references/data-hooks.md b/skills/objectstack-data/references/data-hooks.md index 5d6edbc4046..95f1acdf951 100644 --- a/skills/objectstack-data/references/data-hooks.md +++ b/skills/objectstack-data/references/data-hooks.md @@ -295,7 +295,9 @@ same DSL as the [objectstack-query](../../objectstack-query/SKILL.md) skill: await ctx.api.object('candidate').findOne({ where: { id: ctx.result.id } }); await ctx.api.object('candidate').find({ where: { stage: 'hired' } }); await ctx.api.object('invoice').count({ where: { amount: { $gte: 1000 } } }); -await ctx.api.object('task').find({ where: { $and: [{ done: false }, { owner_id: ctx.session?.userId }] } }); +const uid = ctx.session?.userId; +if (!uid) return; +await ctx.api.object('task').find({ where: { $and: [{ done: false }, { owner_id: uid }] } }); ``` > `filter:` is tolerated as an **object-valued** alias (normalised to `where`),