From 183f7c9715b354dfce10cacd4ead8306f5bafe6e Mon Sep 17 00:00:00 2001 From: CodeMash Date: Tue, 13 Oct 2026 09:38:15 +0300 Subject: [PATCH] feat(marketplace): useGetMarketplaceFunctionRunsQuery takes functionId (@norbix.ai/ts ^4.22.0) @norbix.ai/ts 4.22.0 adds functionId to GetMarketplaceFunctionRuns (one of functionId / triggerId / taskId) and the run row fields status, correlationId, hasDetails, triggerId and taskId. The hook passes the typed argument through; a new test sends functionId through the real SDK with a fake fetch and pins the exact query and no body. README: runs per function and the details helper. Co-Authored-By: Claude Opus 5.5 --- README.md | 9 +++++++++ package-lock.json | 8 ++++---- package.json | 2 +- tests/marketplace.test.ts | 22 ++++++++++++++++++++++ 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3afbb2b..27677a6 100644 --- a/README.md +++ b/README.md @@ -567,6 +567,15 @@ const [invoke] = useInvokeMarketplaceFunctionMutation(); await invoke({ functionViewId: 'func_4hT2b9QkLm3XcT1yRfGh7a', payload: { text: 'Order shipped' } }); ``` +`useGetMarketplaceFunctionRunsQuery` takes exactly one of `functionId` (a function's own runs from every source — invoke, trigger, scheduler — newest first, up to 50), `triggerId` or `taskId`. A row carries `status` (`ok` / `failed` / `skipped`), `durationMs`, `source`, `correlationId` and `hasDetails`; when `hasDetails` is true, the run's input, steps and response are in the project log — read them with `norbix.hub.code.getMarketplaceFunctionRunDetails(row.correlationId)` from `@norbix.ai/ts` 4.22.0. + +```tsx +const { data } = useGetMarketplaceFunctionRunsQuery({ + functionId: 'func_4hT2b9QkLm3XcT1yRfGh7a', + limit: 20, +}); +``` + ## Working with terms A **taxonomy** is a named tree of **terms** (labels). A term can have one parent (a clean hierarchy) or several parents (the same item under many categories). There is one read hook per scenario — pick the one that matches what you want: diff --git a/package-lock.json b/package-lock.json index 3a36897..902f927 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@commitlint/cli": "^21.2.2", "@commitlint/config-conventional": "^21.2.2", "@eslint/js": "^10.0.1", - "@norbix.ai/ts": "^4.21.0", + "@norbix.ai/ts": "^4.22.0", "@reduxjs/toolkit": "^2.12.0", "@semantic-release/commit-analyzer": "^13.0.1", "@semantic-release/github": "^12.0.9", @@ -1490,9 +1490,9 @@ } }, "node_modules/@norbix.ai/ts": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@norbix.ai/ts/-/ts-4.21.0.tgz", - "integrity": "sha512-q3iIBPcVFwLozQ10mtLBI6pOb1Kp01Ixw0mYWWknrP9nZvJIGA4ZX/xY4P1q110SqSBUblB2Sa8DKoRWZciz4g==", + "version": "4.22.0", + "resolved": "https://registry.npmjs.org/@norbix.ai/ts/-/ts-4.22.0.tgz", + "integrity": "sha512-l3ktvdYIQ4ffu9RZiJM6WJMfZdwc5vWr9EO2KzXEWeNm1wO92d4mBzOlv1rbeY3cEjFegXTAHH49oo5cUSbHdQ==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index ee891d3..3b8cd60 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "@commitlint/cli": "^21.2.2", "@commitlint/config-conventional": "^21.2.2", "@eslint/js": "^10.0.1", - "@norbix.ai/ts": "^4.21.0", + "@norbix.ai/ts": "^4.22.0", "@reduxjs/toolkit": "^2.12.0", "@semantic-release/commit-analyzer": "^13.0.1", "@semantic-release/github": "^12.0.9", diff --git a/tests/marketplace.test.ts b/tests/marketplace.test.ts index 2731caf..e062f4f 100644 --- a/tests/marketplace.test.ts +++ b/tests/marketplace.test.ts @@ -311,4 +311,26 @@ describe('marketplace hooks through the real SDK (fake fetch)', () => { expect(body).toEqual(wire); } }); + + // Exactly one of functionId / triggerId / taskId (gateway item gw-runs, @norbix.ai/ts 4.22.0): + // a function's own runs from every source. The typed arg below only compiles on 4.22.0+. + it('getMarketplaceFunctionRuns takes functionId and sends it on the query, no body', async () => { + const args: NonNullable[0]> = { + functionId: 'func_1p4R3gTobGZpD6fXvHT4rd', + limit: 50, + }; + const { seen, result } = run('getMarketplaceFunctionRuns', args); + expect(((await result) as { error?: unknown }).error).toBeUndefined(); + expect(seen).toHaveLength(1); + expect(seen[0]!.method).toBe('GET'); + const url = new URL(seen[0]!.url); + expect(`${url.origin}${url.pathname}`).toBe(`${HUB}/code/marketplace/functions/runs`); + expect( + Object.fromEntries([...url.searchParams.entries()].filter(([k]) => k !== 'env')), + ).toEqual({ + functionId: 'func_1p4R3gTobGZpD6fXvHT4rd', + limit: '50', + }); + expect(seen[0]!.body).toBeUndefined(); + }); });