Chore/rm main entity concept (#7709)
**What** Update the `MedusaService` class, factory and types to remove the concept of main modules. The idea being that all method will be explicitly named and suffixes to represent the object you are trying to manipulate. This pr also includes various fixes in different modules Co-authored-by: Stevche Radevski <4820812+sradevski@users.noreply.github.com> Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
533 files changed
+6469
-9769
No files matched your search
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* return the file path of the caller of the function calling this function
|
||||
* @param position
|
||||
*/
|
||||
export function getCallerFilePath(position = 2) {
|
||||
if (position >= Error.stackTraceLimit) {
|
||||
throw new TypeError(
|
||||
"getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `" +
|
||||
position +
|
||||
"` and Error.stackTraceLimit was: `" +
|
||||
Error.stackTraceLimit +
|
||||
"`"
|
||||
)
|
||||
}
|
||||
|
||||
const oldPrepareStackTrace = Error.prepareStackTrace
|
||||
Error.prepareStackTrace = (_, stack) => stack
|
||||
const stack = new Error().stack
|
||||
Error.prepareStackTrace = oldPrepareStackTrace
|
||||
|
||||
if (stack !== null && typeof stack === "object") {
|
||||
// stack[0] holds this file
|
||||
// stack[1] holds where this function was called
|
||||
// stack[2] holds the file we're interested in
|
||||
return stack[position] ? (stack[position] as any).getFileName() : undefined
|
||||
}
|
||||
}
|
||||
@@ -65,3 +65,4 @@ export * from "./load-env"
|
||||
export * from "./define-config"
|
||||
export * from "./file-system"
|
||||
export * from "./graceful-shutdown-server"
|
||||
export * from "./get-caller-file-path"
|
||||
Reference in new issue
Block a user