refactor(orchestration): Align configuration and fixes (#9242)
RESOLVES FRMW-2712 **What** Refactor orchestration packages to use the latest configuration of typescript and fixes issues
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
import { IDistributedSchedulerStorage, SchedulerOptions } from "../../dist"
|
||||
import { IDistributedSchedulerStorage, SchedulerOptions } from "../../src"
|
||||
|
||||
export class MockSchedulerStorage implements IDistributedSchedulerStorage {
|
||||
async schedule(
|
||||
jobDefinition: string | { jobId: string },
|
||||
schedulerOptions: SchedulerOptions
|
||||
): Promise<void> {
|
||||
return Promise.resolve()
|
||||
return await Promise.resolve()
|
||||
}
|
||||
|
||||
async remove(jobId: string): Promise<void> {
|
||||
return Promise.resolve()
|
||||
return await Promise.resolve()
|
||||
}
|
||||
|
||||
async removeAll(): Promise<void> {
|
||||
return Promise.resolve()
|
||||
return await Promise.resolve()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { MedusaContainer, RemoteExpandProperty } from "@medusajs/types"
|
||||
import {
|
||||
IModuleService,
|
||||
MedusaContainer,
|
||||
RemoteExpandProperty,
|
||||
} from "@medusajs/types"
|
||||
import { lowerCaseFirst, toPascalCase } from "@medusajs/utils"
|
||||
import { remoteJoinerData } from "../../__fixtures__/joiner/data"
|
||||
import { serviceConfigs, serviceMock } from "../../__mocks__/joiner/mock_data"
|
||||
@@ -51,7 +55,7 @@ const fetchServiceDataCallback = jest.fn(
|
||||
? lowerCaseFirst(serviceConfig.serviceName) + "Service"
|
||||
: serviceConfig.serviceName
|
||||
|
||||
const service = container.resolve(moduleRegistryName)
|
||||
const service: IModuleService = container.resolve(moduleRegistryName)
|
||||
const methodName = relationship?.inverse
|
||||
? `getBy${toPascalCase(pkField)}`
|
||||
: "list"
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { MedusaContainer, RemoteExpandProperty } from "@medusajs/types"
|
||||
import {
|
||||
IModuleService,
|
||||
MedusaContainer,
|
||||
RemoteExpandProperty,
|
||||
} from "@medusajs/types"
|
||||
import { lowerCaseFirst, toPascalCase } from "@medusajs/utils"
|
||||
import { serviceConfigs, serviceMock } from "../../__mocks__/joiner/mock_data"
|
||||
import { RemoteJoiner } from "./../../joiner"
|
||||
@@ -23,7 +27,7 @@ const fetchServiceDataCallback = async (
|
||||
const moduleRegistryName =
|
||||
lowerCaseFirst(serviceConfig.serviceName) + "Service"
|
||||
|
||||
const service = container.resolve(moduleRegistryName)
|
||||
const service: IModuleService = container.resolve(moduleRegistryName)
|
||||
const methodName = relationship?.inverse
|
||||
? `getBy${toPascalCase(pkField)}`
|
||||
: "list"
|
||||
|
||||
@@ -4,17 +4,16 @@ import {
|
||||
JoinerServiceConfigAlias,
|
||||
ModuleJoinerConfig,
|
||||
RemoteExpandProperty,
|
||||
RemoteJoinerOptions,
|
||||
RemoteJoinerQuery,
|
||||
RemoteNestedExpands,
|
||||
} from "@medusajs/types"
|
||||
|
||||
import { RemoteJoinerOptions } from "@medusajs/types"
|
||||
import {
|
||||
MedusaError,
|
||||
deduplicate,
|
||||
extractRelationsFromGQL,
|
||||
isDefined,
|
||||
isString,
|
||||
MedusaError,
|
||||
} from "@medusajs/utils"
|
||||
import GraphQLParser from "./graphql-ast"
|
||||
|
||||
@@ -146,7 +145,7 @@ export class RemoteJoiner {
|
||||
}
|
||||
|
||||
constructor(
|
||||
private serviceConfigs: ModuleJoinerConfig[],
|
||||
serviceConfigs: ModuleJoinerConfig[],
|
||||
private remoteFetchData: RemoteFetchDataCallback,
|
||||
private options: {
|
||||
autoCreateServiceNameAlias?: boolean
|
||||
@@ -158,7 +157,7 @@ export class RemoteJoiner {
|
||||
this.entityMap = extractRelationsFromGQL(this.options.entitiesMap)
|
||||
}
|
||||
|
||||
this.serviceConfigs = this.buildReferences(
|
||||
this.buildReferences(
|
||||
JSON.parse(JSON.stringify(serviceConfigs), (key, value) => {
|
||||
if (key === "schema") {
|
||||
return
|
||||
@@ -831,14 +830,8 @@ export class RemoteJoiner {
|
||||
implodeMapping: InternalImplodeMapping[]
|
||||
options?: RemoteJoinerOptions
|
||||
}): Map<string, RemoteExpandProperty> {
|
||||
const {
|
||||
initialService,
|
||||
query,
|
||||
serviceConfig,
|
||||
expands,
|
||||
implodeMapping,
|
||||
options,
|
||||
} = params
|
||||
const { initialService, query, serviceConfig, expands, implodeMapping } =
|
||||
params
|
||||
|
||||
const parsedExpands = this.parseProperties({
|
||||
initialService,
|
||||
|
||||
@@ -294,7 +294,6 @@ export class OrchestratorBuilder {
|
||||
}
|
||||
|
||||
pruneAction(action: string) {
|
||||
const actionStep = this.findOrThrowStepByAction(action)
|
||||
const parentStep = this.findParentStepByAction(action, this.steps)!
|
||||
|
||||
if (Array.isArray(parentStep.next)) {
|
||||
|
||||
Reference in New Issue
Block a user