From 079848d0920d54eb5cb7fedb1b2a3120e47db285 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Mon, 3 Feb 2025 13:29:49 +0000 Subject: [PATCH 1/2] add routes --- src/components/httpRoutes/index.ts | 4 +++- src/components/httpRoutes/routeUtils.ts | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/httpRoutes/index.ts b/src/components/httpRoutes/index.ts index ee974a52d..9b302f395 100644 --- a/src/components/httpRoutes/index.ts +++ b/src/components/httpRoutes/index.ts @@ -12,6 +12,7 @@ import { queueRoutes } from './queue.js' // import { getConfiguration } from '../../utils/config.js' import { jobsRoutes } from './jobs.js' import { addMapping, allRoutesMapping, findPathName } from './routeUtils.js' +import { PolicyServerPassthroughRoute } from './policyServer.js' export * from './getOceanPeers.js' @@ -57,7 +58,8 @@ httpRoutes.use(computeRoutes) httpRoutes.use(queueRoutes) // running jobs httpRoutes.use(jobsRoutes) - +// policy server passthrough +httpRoutes.use(PolicyServerPassthroughRoute) export function getAllServiceEndpoints() { httpRoutes.stack.forEach(addMapping.bind(null, [])) const data: any = {} diff --git a/src/components/httpRoutes/routeUtils.ts b/src/components/httpRoutes/routeUtils.ts index 4843f5d0e..2ec92a9f1 100644 --- a/src/components/httpRoutes/routeUtils.ts +++ b/src/components/httpRoutes/routeUtils.ts @@ -174,6 +174,11 @@ routesNames.set('indexQueue', { method: 'get' }) +routesNames.set('PolicyServerPassthrough', { + path: `${SERVICES_API_BASE_PATH}/PolicyServerPassthrough`, + method: 'post' +}) + export function addMapping(path: any, layer: any) { if (layer.route) { layer.route.stack.forEach(addMapping.bind(null, path.concat(split(layer.route.path)))) From 547d98720f89beb687ee0504be759c0e868bcdd5 Mon Sep 17 00:00:00 2001 From: paulo-ocean Date: Mon, 3 Feb 2025 14:31:08 +0000 Subject: [PATCH 2/2] fix doc route path --- docs/API.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/API.md b/docs/API.md index 6bade2969..facdd5f56 100644 --- a/docs/API.md +++ b/docs/API.md @@ -537,7 +537,7 @@ returns an empty object if it is valid otherwise an array with error | ---------- | -------- | -------- | ------------------------------------------------- | | command | string | v | command name | | node | string | | if not present it means current node | -| multiAddrs | string[] | | if passed, use this instead of peerStore & DHT | +| multiAddrs | string[] | | if passed, use this instead of peerStore & DHT | | id | string | v | document id or did | | chainId | number | v | chain id of network on which document is provided | | nftAddress | string | v | address of nft token | @@ -1161,7 +1161,7 @@ returns the current indexing queue, as an array of objects ## PolicyServer Passthrough -### `HTTP` POST /PolicyServerPassthrough +### `HTTP` POST /api/services/PolicyServerPassthrough ### `P2P` command: PolicyServerPassthrough