-
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.
- Loading branch information
Showing
36 changed files
with
400 additions
and
132 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
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 was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
packages/backend/src/config/managers/InjectorMetadataManager.ts
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
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 was deleted.
Oops, something went wrong.
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
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
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
22 changes: 22 additions & 0 deletions
22
packages/backend/src/decorators/setup/class-decorators/factory.ts
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,22 @@ | ||
import { type Class } from "@org/shared"; | ||
import { ClassMetadata } from "../shared/ClassMetadata"; | ||
|
||
export type ClassDecoratorSupplier<This extends Class> = (content: { | ||
meta: ClassMetadata; | ||
clazz: Class; | ||
}) => ReturnType<ClassDecoratorDef<This>>; | ||
|
||
export type ClassDecoratorDef<This extends Class> = ( | ||
constructor: This, | ||
context: ClassDecoratorContext, | ||
) => void | undefined | This; | ||
|
||
export function createClassDecorator<This extends Class>( | ||
supplier: ClassDecoratorSupplier<This>, | ||
): ClassDecoratorDef<This> { | ||
return function (clazz: This, context: ClassDecoratorContext<This>) { | ||
const meta = ClassMetadata.for(context); | ||
meta._setClass(clazz); | ||
return supplier({ clazz, meta }); | ||
}; | ||
} |
1 change: 1 addition & 0 deletions
1
packages/backend/src/decorators/setup/class-decorators/index.ts
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 "./factory"; |
19 changes: 19 additions & 0 deletions
19
packages/backend/src/decorators/setup/field-decorators/factory.ts
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,19 @@ | ||
import { ClassMetadata } from "../shared/ClassMetadata"; | ||
|
||
export type FieldDecoratorSupplier<This, Value> = (content: { | ||
meta: ClassMetadata; | ||
}) => ReturnType<FieldDecoratorDef<This, Value>>; | ||
|
||
export type FieldDecoratorDef<This, Value> = ( | ||
target: undefined, | ||
context: ClassFieldDecoratorContext<This, Value>, | ||
) => void | undefined | ((value: Value) => Value); | ||
|
||
export function createFieldDecorator<This, Value>( | ||
supplier: FieldDecoratorSupplier<This, Value>, | ||
): FieldDecoratorDef<This, Value> { | ||
return function (_target: undefined, context: ClassFieldDecoratorContext<This, Value>) { | ||
const meta = ClassMetadata.for(context); | ||
return supplier({ meta }); | ||
}; | ||
} |
1 change: 1 addition & 0 deletions
1
packages/backend/src/decorators/setup/field-decorators/index.ts
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 "./factory"; |
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,8 @@ | ||
/** | ||
* @packageDocumentation tsvdec - Decorators module | ||
*/ | ||
|
||
export * from "./class-decorators"; | ||
export * from "./field-decorators"; | ||
export * from "./method-decorators"; | ||
export * from "./shared"; |
21 changes: 21 additions & 0 deletions
21
packages/backend/src/decorators/setup/method-decorators/factory.ts
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,21 @@ | ||
import { type TODO } from "@org/shared"; | ||
import { ClassMetadata } from "../shared/ClassMetadata"; | ||
|
||
export type MethodDecoratorSupplier<This, Fn extends (...args: TODO[]) => TODO> = (content: { | ||
meta: ClassMetadata; | ||
target: Fn; | ||
}) => ReturnType<MethodDecoratorDef<This, Fn>>; | ||
|
||
export type MethodDecoratorDef<This, Fn extends (...args: TODO[]) => TODO> = ( | ||
target: Fn, | ||
context: ClassMethodDecoratorContext<This, Fn>, | ||
) => void | undefined | Fn; | ||
|
||
export function createMethodDecorator<This, Fn extends (...args: TODO[]) => TODO>( | ||
supplier: MethodDecoratorSupplier<This, Fn>, | ||
): MethodDecoratorDef<This, Fn> { | ||
return function (target: Fn, context: ClassMethodDecoratorContext<This, Fn>) { | ||
const meta = ClassMetadata.for(context); | ||
return supplier({ target, meta }); | ||
}; | ||
} |
1 change: 1 addition & 0 deletions
1
packages/backend/src/decorators/setup/method-decorators/index.ts
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 "./factory"; |
Oops, something went wrong.