From 9991dd21b3d153da1bf686b941d415d20dc0e714 Mon Sep 17 00:00:00 2001 From: Tony Xiao Date: Sun, 26 Nov 2023 01:21:07 -0800 Subject: [PATCH] chore: update api paths --- kits/sdk/venice.oas.d.ts | 8 +-- kits/sdk/venice.oas.json | 56 +++++++++---------- .../router/connectorConfigRouter.ts | 2 +- .../engine-backend/router/connectorRouter.ts | 2 +- .../engine-backend/router/endUserRouter.ts | 4 +- .../engine-backend/router/pipelineRouter.ts | 2 +- .../engine-backend/router/resourceRouter.ts | 6 +- verticals/vertical-accounting/accounting.ts | 14 ++--- verticals/vertical-investment/investment.ts | 14 ++--- verticals/vertical-pta/index.ts | 4 +- 10 files changed, 57 insertions(+), 55 deletions(-) diff --git a/kits/sdk/venice.oas.d.ts b/kits/sdk/venice.oas.d.ts index b8d12689..df57166f 100644 --- a/kits/sdk/venice.oas.d.ts +++ b/kits/sdk/venice.oas.d.ts @@ -38,7 +38,7 @@ export interface paths { patch?: never; trace?: never; }; - "/core/connect-token": { + "/connect/token": { parameters: { query?: never; header?: never; @@ -54,7 +54,7 @@ export interface paths { patch?: never; trace?: never; }; - "/core/magic-link": { + "/connect/magic-link": { parameters: { query?: never; header?: never; @@ -70,7 +70,7 @@ export interface paths { patch?: never; trace?: never; }; - "/core/passthrough": { + "/passthrough": { parameters: { query?: never; header?: never; @@ -189,7 +189,7 @@ export interface paths { path?: never; cookie?: never; }; - /** Get catalog of all available connectors */ + /** @description Get catalog of all available connectors */ get: operations["listConnectorMetas"]; put?: never; post?: never; diff --git a/kits/sdk/venice.oas.json b/kits/sdk/venice.oas.json index c51b288e..eafa983b 100644 --- a/kits/sdk/venice.oas.json +++ b/kits/sdk/venice.oas.json @@ -70,7 +70,7 @@ } } }, - "/core/connect-token": { + "/connect/token": { "post": { "operationId": "createConnectToken", "tags": [ @@ -140,7 +140,7 @@ } } }, - "/core/magic-link": { + "/connect/magic-link": { "post": { "operationId": "createMagicLink", "tags": [ @@ -233,11 +233,11 @@ } } }, - "/core/passthrough": { + "/passthrough": { "post": { "operationId": "passthrough", "tags": [ - "Resource" + "Internal" ], "requestBody": { "required": true, @@ -317,7 +317,7 @@ "post": { "operationId": "sourceSync", "tags": [ - "Resource" + "Core" ], "parameters": [ { @@ -388,7 +388,7 @@ "post": { "operationId": "createResource", "tags": [ - "Resource" + "Core" ], "requestBody": { "required": true, @@ -450,7 +450,7 @@ "get": { "operationId": "listResources", "tags": [ - "Resource" + "Core" ], "parameters": [ { @@ -545,7 +545,7 @@ "patch": { "operationId": "updateResource", "tags": [ - "Resource" + "Core" ], "parameters": [ { @@ -625,7 +625,7 @@ "delete": { "operationId": "deleteResource", "tags": [ - "Resource" + "Core" ], "parameters": [ { @@ -689,7 +689,7 @@ "get": { "operationId": "getResource", "tags": [ - "Resource" + "Core" ], "parameters": [ { @@ -750,7 +750,7 @@ "get": { "operationId": "adminListConnectorConfigs", "tags": [ - "Connector Configs" + "Core" ], "responses": { "200": { @@ -781,7 +781,7 @@ "post": { "operationId": "adminUpsertConnectorConfig", "tags": [ - "Connector Configs" + "Core" ], "requestBody": { "required": true, @@ -896,7 +896,7 @@ "delete": { "operationId": "adminDeleteConnectorConfig", "tags": [ - "Connector Configs" + "Core" ], "parameters": [ { @@ -953,7 +953,7 @@ "get": { "operationId": "adminGetConnectorConfig", "tags": [ - "Connector Configs" + "Core" ], "parameters": [ { @@ -1014,7 +1014,7 @@ "get": { "operationId": "listConnectorConfigInfos", "tags": [ - "Connector Configs" + "Core" ], "parameters": [ { @@ -1127,7 +1127,7 @@ "/connector": { "get": { "operationId": "listConnectorMetas", - "summary": "Get catalog of all available connectors", + "description": "Get catalog of all available connectors", "tags": [ "Connectors" ], @@ -1381,7 +1381,7 @@ "get": { "operationId": "listPipelines", "tags": [ - "Pipeline" + "Core" ], "parameters": [ { @@ -1461,7 +1461,7 @@ "delete": { "operationId": "deletePipeline", "tags": [ - "Pipeline" + "Core" ], "parameters": [ { @@ -1525,7 +1525,7 @@ "get": { "operationId": "verticals-accounting-account_list", "tags": [ - "Verticals/Accounting" + "Verticals" ], "parameters": [ { @@ -1627,7 +1627,7 @@ "get": { "operationId": "verticals-accounting-expense_list", "tags": [ - "Verticals/Accounting" + "Verticals" ], "parameters": [ { @@ -1729,7 +1729,7 @@ "get": { "operationId": "verticals-accounting-vendor_list", "tags": [ - "Verticals/Accounting" + "Verticals" ], "parameters": [ { @@ -1827,7 +1827,7 @@ "get": { "operationId": "verticals-pta-account_list", "tags": [ - "Verticals/Pta" + "Verticals" ], "parameters": [ { @@ -1911,7 +1911,7 @@ "get": { "operationId": "verticals-pta-transaction_list", "tags": [ - "Verticals/Pta" + "Verticals" ], "parameters": [ { @@ -1995,7 +1995,7 @@ "get": { "operationId": "verticals-pta-commodity_list", "tags": [ - "Verticals/Pta" + "Verticals" ], "parameters": [ { @@ -2079,7 +2079,7 @@ "get": { "operationId": "verticals-investment-account_list", "tags": [ - "Verticals/Investment" + "Verticals" ], "parameters": [ { @@ -2173,7 +2173,7 @@ "get": { "operationId": "verticals-investment-transaction_list", "tags": [ - "Verticals/Investment" + "Verticals" ], "parameters": [ { @@ -2263,7 +2263,7 @@ "get": { "operationId": "verticals-investment-holding_list", "tags": [ - "Verticals/Investment" + "Verticals" ], "parameters": [ { @@ -2353,7 +2353,7 @@ "get": { "operationId": "verticals-investment-security_list", "tags": [ - "Verticals/Investment" + "Verticals" ], "parameters": [ { diff --git a/packages/engine-backend/router/connectorConfigRouter.ts b/packages/engine-backend/router/connectorConfigRouter.ts index b4930824..bb7a568d 100644 --- a/packages/engine-backend/router/connectorConfigRouter.ts +++ b/packages/engine-backend/router/connectorConfigRouter.ts @@ -13,7 +13,7 @@ import {adminProcedure, protectedProcedure, trpc} from './_base' export {type inferProcedureInput} from '@trpc/server' -const tags = ['Connector Configs'] +const tags = ['Core'] export const connectorConfigRouter = trpc.router({ adminListConnectorConfigs: adminProcedure diff --git a/packages/engine-backend/router/connectorRouter.ts b/packages/engine-backend/router/connectorRouter.ts index ffb14fe2..035f0312 100644 --- a/packages/engine-backend/router/connectorRouter.ts +++ b/packages/engine-backend/router/connectorRouter.ts @@ -13,7 +13,7 @@ export const connectorRouter = trpc.router({ method: 'GET', path: '/connector', tags, - summary: 'Get catalog of all available connectors', + description: 'Get catalog of all available connectors', }, }) .input(z.object({includeOas: z.boolean().optional()}).optional()) diff --git a/packages/engine-backend/router/endUserRouter.ts b/packages/engine-backend/router/endUserRouter.ts index 41e0e438..78ef5754 100644 --- a/packages/engine-backend/router/endUserRouter.ts +++ b/packages/engine-backend/router/endUserRouter.ts @@ -112,7 +112,7 @@ const tags = ['Connect'] /** TODO: Modify this so that admin user can execute it... not just endUser */ export const endUserRouter = trpc.router({ createConnectToken: protectedProcedure - .meta({openapi: {method: 'POST', path: '/core/connect-token', tags}}) + .meta({openapi: {method: 'POST', path: '/connect/token', tags}}) .input(endUserRouterSchema.createConnectToken.input) .output(z.object({token: z.string()})) .mutation(({input: {validityInSeconds, ...input}, ctx}) => ({ @@ -121,7 +121,7 @@ export const endUserRouter = trpc.router({ }), })), createMagicLink: protectedProcedure - .meta({openapi: {method: 'POST', path: '/core/magic-link', tags}}) + .meta({openapi: {method: 'POST', path: '/connect/magic-link', tags}}) .input(endUserRouterSchema.createMagicLink.input) .output(z.object({url: z.string()})) .mutation(({input: {endUserId, validityInSeconds, ...params}, ctx}) => { diff --git a/packages/engine-backend/router/pipelineRouter.ts b/packages/engine-backend/router/pipelineRouter.ts index 10195179..c938fd00 100644 --- a/packages/engine-backend/router/pipelineRouter.ts +++ b/packages/engine-backend/router/pipelineRouter.ts @@ -7,7 +7,7 @@ import {zListParams} from './_schemas' export {type inferProcedureInput} from '@trpc/server' -const tags = ['Pipeline'] +const tags = ['Core'] export const pipelineRouter = trpc.router({ listPipelines: protectedProcedure diff --git a/packages/engine-backend/router/resourceRouter.ts b/packages/engine-backend/router/resourceRouter.ts index b05d0463..bff57dd2 100644 --- a/packages/engine-backend/router/resourceRouter.ts +++ b/packages/engine-backend/router/resourceRouter.ts @@ -18,12 +18,14 @@ import {zListParams} from './_schemas' export {type inferProcedureInput} from '@trpc/server' -const tags = ['Resource'] +const tags = ['Core'] export const resourceRouter = trpc.router({ // TODO: maybe we should allow resourceId to be part of the path rather than only in the headers + + // Should this really be part of the resource router? or left elsewhere? passthrough: remoteProcedure - .meta({openapi: {method: 'POST', path: '/core/passthrough', tags}}) // Where do we put this? + .meta({openapi: {method: 'POST', path: '/passthrough', tags: ['Internal']}}) // Where do we put this? .input(zPassthroughInput) .output(z.any()) .mutation(async ({input, ctx}) => { diff --git a/verticals/vertical-accounting/accounting.ts b/verticals/vertical-accounting/accounting.ts index a5370b0d..c2efb0ed 100644 --- a/verticals/vertical-accounting/accounting.ts +++ b/verticals/vertical-accounting/accounting.ts @@ -1,16 +1,16 @@ import type {MaybePromise} from '@usevenice/util' -import {objectEntries, R, startCase} from '@usevenice/util' +import {objectEntries, R} from '@usevenice/util' +import type { + PaginatedOutput, + Pagination, + VerticalRouterOpts, +} from '@usevenice/vdk' import { paginatedOutput, proxyListRemoteRedux, z, zPaginationParams, } from '@usevenice/vdk' -import type { - PaginatedOutput, - Pagination, - VerticalRouterOpts, -} from '@usevenice/vdk' import type { ConnectorSchemas, ConnHelpers, @@ -80,7 +80,7 @@ export function createAccountingRouter(opts: VerticalRouterOpts) { openapi: { method: 'GET', path: `/verticals/${vertical}/${entityName}`, - tags: [`Verticals/${startCase(vertical)}`], + tags: ['Verticals'], }, }) .input(zPaginationParams.nullish()) diff --git a/verticals/vertical-investment/investment.ts b/verticals/vertical-investment/investment.ts index 2eb7cbbd..a5213de6 100644 --- a/verticals/vertical-investment/investment.ts +++ b/verticals/vertical-investment/investment.ts @@ -2,18 +2,18 @@ // Guess it means accounting router also belongs in the engine backend... import type {MaybePromise} from '@usevenice/util' -import {objectEntries, R, startCase} from '@usevenice/util' +import {objectEntries, R} from '@usevenice/util' +import type { + PaginatedOutput, + Pagination, + VerticalRouterOpts, +} from '@usevenice/vdk' import { paginatedOutput, proxyListRemoteRedux, z, zPaginationParams, } from '@usevenice/vdk' -import type { - PaginatedOutput, - Pagination, - VerticalRouterOpts, -} from '@usevenice/vdk' import type { ConnectorSchemas, ConnHelpers, @@ -71,7 +71,7 @@ export function createInvestmentRouter(opts: VerticalRouterOpts) { openapi: { method: 'GET', path: `/verticals/${vertical}/${entityName}`, - tags: [`Verticals/${startCase(vertical)}`], + tags: ['Verticals'], }, }) .input(zPaginationParams.nullish()) diff --git a/verticals/vertical-pta/index.ts b/verticals/vertical-pta/index.ts index ce4881b7..629dbfdb 100644 --- a/verticals/vertical-pta/index.ts +++ b/verticals/vertical-pta/index.ts @@ -1,5 +1,5 @@ import type {MaybePromise} from '@usevenice/util' -import {objectEntries, R, startCase, z, zObject} from '@usevenice/util' +import {objectEntries, R, z, zObject} from '@usevenice/util' import type { PaginatedOutput, Pagination, @@ -67,7 +67,7 @@ export function createPtaRouter(opts: VerticalRouterOpts) { openapi: { method: 'GET', path: `/verticals/${vertical}/${entityName}`, - tags: [`Verticals/${startCase(vertical)}`], + tags: ['Verticals'], }, }) .input(zPaginationParams.nullish())