Skip to content
Merged
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
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -552,11 +552,13 @@ listings, the installed connections (`int_…`) with their secrets, token
mappings and validation test, the vendor function catalog, and the functions
added on a connection (`func_…`). Every tag is of type `CodeMarketplace`.

| Area | Hooks | Cache tag (`CodeMarketplace/…`) |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| Catalog | `useGetMarketplaceListingsQuery`, `useGetMarketplaceListingQuery`, `useGetMarketplaceListingFunctionTokensQuery` | provides `LISTINGS` |
| Area | Hooks | Cache tag (`CodeMarketplace/…`) |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Catalog | `useGetMarketplaceListingsQuery`, `useGetMarketplaceListingQuery`, `useGetMarketplaceListingFunctionTokensQuery` | provides `LISTINGS` |
| Connections | `useGetMarketplaceIntegrationsQuery`, `useGetMarketplaceIntegrationQuery`, `useSaveMarketplaceIntegrationMutation`, `useDeleteMarketplaceIntegrationMutation`, `useEnableMarketplaceIntegrationMutation`, `useDisableMarketplaceIntegrationMutation`, `useReplaceMarketplaceIntegrationSecretsMutation`, `useRevealMarketplaceIntegrationSecretsMutation`, `useSetMarketplaceIntegrationTokenMappingsMutation`, `useTestMarketplaceIntegrationMutation`, `useGetMarketplaceFunctionCatalogQuery`, `useGetMarketplaceIntegrationToolsQuery` (the stored MCP tool catalog of an MCP connection, core SDK 4.23.0+) | `INTEGRATIONS`, `<integrationViewId>`, `CATALOG:<integrationViewId>`, `TOOLS:<integrationViewId>` (test and delete invalidate it); reveal touches nothing |
| Functions | `useGetMarketplaceFunctionsQuery`, `useGetMarketplaceFunctionQuery`, `useSaveMarketplaceFunctionMutation`, `useDeleteMarketplaceFunctionMutation`, `useEnableMarketplaceFunctionMutation`, `useDisableMarketplaceFunctionMutation`, `useGetMarketplaceFunctionTokensQuery`, `useInvokeMarketplaceFunctionMutation`, `useGetMarketplaceFunctionRunsQuery` | `FUNCTIONS:<integrationViewId>`, `<functionViewId>`, `RUNS`; invoke touches nothing |
| Access | `useGetMarketplaceIntegrationAccessQuery` (the access matrix of a connection: roles, packages, tools, functions), `useSetMarketplaceIntegrationRoleAccessMutation` (a role's package + Manage), `useSaveMarketplaceIntegrationCustomAccessMutation` (a custom policy for one role) — core SDK 4.24.0+ | `ACCESS:<integrationViewId>`; the two writes invalidate only that connection's matrix, and so do test, delete, function save and function delete |
| Sign-in | `useStartMarketplaceIntegrationSignInMutation` (OAuth sign-in of an MCP connection: open `authorizeUrl`; core SDK 4.24.0+) | invalidates nothing — read the connection again (`signedIn`) after the person returns |
| Functions | `useGetMarketplaceFunctionsQuery`, `useGetMarketplaceFunctionQuery`, `useSaveMarketplaceFunctionMutation`, `useDeleteMarketplaceFunctionMutation`, `useEnableMarketplaceFunctionMutation`, `useDisableMarketplaceFunctionMutation`, `useGetMarketplaceFunctionTokensQuery`, `useInvokeMarketplaceFunctionMutation`, `useGetMarketplaceFunctionRunsQuery` | `FUNCTIONS:<integrationViewId>`, `<functionViewId>`, `RUNS`; invoke touches nothing |

Revealing secrets is a mutation on purpose: a query would keep the clear values
in the store's cache.
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"@commitlint/cli": "^21.2.2",
"@commitlint/config-conventional": "^21.2.2",
"@eslint/js": "^10.0.1",
"@norbix.ai/ts": "^4.23.0",
"@norbix.ai/ts": "^4.24.0",
"@reduxjs/toolkit": "^2.12.0",
"@semantic-release/commit-analyzer": "^13.0.1",
"@semantic-release/github": "^12.0.9",
Expand Down
41 changes: 39 additions & 2 deletions src/hooks/hub/marketplace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,18 @@ import type { Arg, Result } from '../types.js';
* - `CATALOG:<integrationId>` — the vendor functions a connection offers
* - `TOOLS:<integrationId>` — the stored MCP tool catalog of an MCP connection;
* validation (test) rewrites it (core SDK 4.23.0)
* - `ACCESS:<integrationId>` — the access matrix of a connection (which role holds
* which package); a role package or a custom policy
* write, validation, delete and function writes
* rewrite it (core SDK 4.24.0)
* - `FUNCTIONS:<integrationId>`— the functions added on a connection
* - `<functionViewId>` — one function and its tokens
* - `RUNS` — the last runs of a trigger or task (core SDK 4.21.0)
*
* Starting the OAuth sign-in (route 28) invalidates nothing: the connection
* changes only when the vendor sends the browser back to the gateway, so read
* the connection again after the person returns (`signedIn`).
*
* Revealing secrets is a mutation on purpose: a query would keep the clear
* values in the store's cache.
*/
Expand All @@ -44,6 +52,10 @@ export const hubCodeMarketplace = (b: Builder) => {
type TestIntegration = Fn<'testMarketplaceIntegration'>;
type GetCatalog = Fn<'getMarketplaceFunctionCatalog'>;
type GetTools = Fn<'getMarketplaceIntegrationTools'>;
type GetAccess = Fn<'getMarketplaceIntegrationAccess'>;
type SetRoleAccess = Fn<'setMarketplaceIntegrationRoleAccess'>;
type SaveCustomAccess = Fn<'saveMarketplaceIntegrationCustomAccess'>;
type StartSignIn = Fn<'startMarketplaceIntegrationSignIn'>;
type GetFunctions = Fn<'getMarketplaceFunctions'>;
type GetFunction = Fn<'getMarketplaceFunction'>;
type SaveFunction = Fn<'saveMarketplaceFunction'>;
Expand All @@ -70,6 +82,7 @@ export const hubCodeMarketplace = (b: Builder) => {
{ type: T, id: 'INTEGRATIONS' },
{ type: T, id: integrationId(arg) },
];
const access = (arg: unknown) => ({ type: T, id: `ACCESS:${integrationId(arg)}` });
const functions = (arg: unknown) => [
{ type: T, id: `FUNCTIONS:${integrationId(arg)}` },
{ type: T, id: functionId(arg) },
Expand Down Expand Up @@ -112,6 +125,7 @@ export const hubCodeMarketplace = (b: Builder) => {
...integration(arg),
{ type: T, id: `FUNCTIONS:${integrationId(arg)}` },
{ type: T, id: `TOOLS:${integrationId(arg)}` },
access(arg),
],
}),
enableMarketplaceIntegration: b.mutation<Result<EnableIntegration>, Arg<EnableIntegration>>({
Expand Down Expand Up @@ -141,6 +155,7 @@ export const hubCodeMarketplace = (b: Builder) => {
invalidatesTags: (_res, _err, arg) => [
{ type: T, id: integrationId(arg) },
{ type: T, id: `TOOLS:${integrationId(arg)}` },
access(arg),
],
}),
getMarketplaceFunctionCatalog: b.query<Result<GetCatalog>, Arg<GetCatalog>>({
Expand All @@ -152,6 +167,28 @@ export const hubCodeMarketplace = (b: Builder) => {
providesTags: (_res, _err, arg) => [{ type: T, id: `TOOLS:${integrationId(arg)}` }],
}),

// ---- Access (core SDK 4.24.0) ----
getMarketplaceIntegrationAccess: b.query<Result<GetAccess>, Arg<GetAccess>>({
query: (args) => (norbix) => callHC(norbix).getMarketplaceIntegrationAccess(args),
providesTags: (_res, _err, arg) => [access(arg)],
}),
setMarketplaceIntegrationRoleAccess: b.mutation<Result<SetRoleAccess>, Arg<SetRoleAccess>>({
query: (args) => (norbix) => callHC(norbix).setMarketplaceIntegrationRoleAccess(args),
invalidatesTags: (_res, _err, arg) => [access(arg)],
}),
saveMarketplaceIntegrationCustomAccess: b.mutation<
Result<SaveCustomAccess>,
Arg<SaveCustomAccess>
>({
query: (args) => (norbix) => callHC(norbix).saveMarketplaceIntegrationCustomAccess(args),
invalidatesTags: (_res, _err, arg) => [access(arg)],
}),

// ---- OAuth sign-in (core SDK 4.24.0) ----
startMarketplaceIntegrationSignIn: b.mutation<Result<StartSignIn>, Arg<StartSignIn>>({
query: (args) => (norbix) => callHC(norbix).startMarketplaceIntegrationSignIn(args),
}),

// ---- Functions on a connection ----
getMarketplaceFunctions: b.query<Result<GetFunctions>, Arg<GetFunctions>>({
query: (args) => (norbix) => callHC(norbix).getMarketplaceFunctions(args),
Expand All @@ -163,11 +200,11 @@ export const hubCodeMarketplace = (b: Builder) => {
}),
saveMarketplaceFunction: b.mutation<Result<SaveFunction>, Arg<SaveFunction>>({
query: (args) => (norbix) => callHC(norbix).saveMarketplaceFunction(args),
invalidatesTags: (_res, _err, arg) => functions(arg),
invalidatesTags: (_res, _err, arg) => [...functions(arg), access(arg)],
}),
deleteMarketplaceFunction: b.mutation<Result<DeleteFunction>, Arg<DeleteFunction>>({
query: (args) => (norbix) => callHC(norbix).deleteMarketplaceFunction(args),
invalidatesTags: (_res, _err, arg) => functions(arg),
invalidatesTags: (_res, _err, arg) => [...functions(arg), access(arg)],
}),
enableMarketplaceFunction: b.mutation<Result<EnableFunction>, Arg<EnableFunction>>({
query: (args) => (norbix) => callHC(norbix).enableMarketplaceFunction(args),
Expand Down
Loading