Skip to content

Commit

Permalink
Make separate GatewayApi type (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
stepanenkoxx authored Nov 14, 2024
1 parent 40c6a73 commit f2fc141
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions api/registry/types.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export type {DLSConstructor} from '../../src/registry/common/components/dls/types';
export type {GatewayApi} from '../../src/registry';
10 changes: 9 additions & 1 deletion src/registry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ const wrapperGetGatewayControllers = (

let gateway: ReturnType<typeof wrapperGetGatewayControllers>;

export type GatewayApi<TSchema extends SchemasByScope> = ApiWithRoot<
TSchema,
AppContext,
Request,
Response
>;

export const registry = {
setupApp(appInstance: ExpressKit) {
if (app) {
Expand Down Expand Up @@ -58,8 +65,9 @@ export const registry = {
if (!gateway) {
throw new Error('First of all setup the gateway');
}

return {gatewayApi: gateway.api} as {
gatewayApi: ApiWithRoot<TSchema, AppContext, Request, Response>;
gatewayApi: GatewayApi<TSchema>;
};
},
common: commonRegistry,
Expand Down
2 changes: 1 addition & 1 deletion src/tests/int/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export const routes = {
rootCollectionPermissions: '/v1/root-collection-permissions',
workbooks: '/v2/workbooks',
privateWorkbooks: '/private/v2/workbooks',
};
} as const;

0 comments on commit f2fc141

Please sign in to comment.