-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rework registries, instantiate constructors every time
- Loading branch information
Showing
20 changed files
with
441 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export * from "./definition/_index.mjs"; | ||
export * from "./base.endpoint.mjs"; | ||
export * from "./endpoint.registry.mjs"; | ||
export * from "./route.utility.mjs"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./interface/endpoint-entry.interface.mjs"; |
13 changes: 13 additions & 0 deletions
13
packages/architectura/src/core/endpoint/definition/interface/endpoint-entry.interface.mts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { ConstructorOf } from "@vitruvius-labs/ts-predicate"; | ||
import type { HTTPMethodEnum } from "../../../definition/enum/http-method.enum.mjs"; | ||
import type { BaseEndpoint } from "../../base.endpoint.mjs"; | ||
|
||
/** @internal */ | ||
interface EndpointEntryInterface | ||
{ | ||
method: HTTPMethodEnum; | ||
route: RegExp; | ||
endpoint: BaseEndpoint | ConstructorOf<BaseEndpoint>; | ||
} | ||
|
||
export type { EndpointEntryInterface }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
class RouteUtility | ||
{ | ||
public static NormalizeRoute(route: RegExp | string): RegExp | ||
{ | ||
if (route instanceof RegExp) | ||
{ | ||
return new RegExp(this.MakeRouteWhole(route.source), route.flags); | ||
} | ||
|
||
return new RegExp(this.MakeRouteWhole(route)); | ||
} | ||
|
||
private static MakeRouteWhole(route: string): string | ||
{ | ||
let pattern: string = route; | ||
|
||
if (!route.startsWith("^")) | ||
{ | ||
pattern = `^${pattern}`; | ||
} | ||
|
||
if (!route.endsWith("$")) | ||
{ | ||
pattern = `${pattern}$`; | ||
} | ||
|
||
return pattern; | ||
} | ||
} | ||
|
||
export { RouteUtility }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./base.pre-hook.mjs"; | ||
export * from "./base.post-hook.mjs"; | ||
export * from "./base.error-hook.mjs"; | ||
export * from "./hook.registry.mjs"; |
Oops, something went wrong.