@plyaz/core 1.18.1 → 1.18.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6118,21 +6118,21 @@ function getStatusForMethod(method) {
6118
6118
  }
6119
6119
  }
6120
6120
  __name(getStatusForMethod, "getStatusForMethod");
6121
- function getInjectedServices() {
6121
+ function getInjectedServices(coreInstance) {
6122
6122
  return {
6123
- db: Core.db,
6124
- cache: Core.cache,
6125
- storage: Core.storage,
6126
- notifications: Core.notifications,
6127
- api: Core.api
6123
+ db: coreInstance.db,
6124
+ cache: coreInstance.cache,
6125
+ storage: coreInstance.storage,
6126
+ notifications: coreInstance.notifications,
6127
+ api: coreInstance.api
6128
6128
  };
6129
6129
  }
6130
6130
  __name(getInjectedServices, "getInjectedServices");
6131
6131
  function createServiceGetter(service, getCore) {
6132
6132
  return async () => {
6133
- if (getCore) await getCore();
6134
- if (typeof service === "function") return service();
6135
- return ServiceRegistry.get(service);
6133
+ const coreInstance = getCore ? await getCore() : Core;
6134
+ const svc = typeof service === "function" ? await service() : ServiceRegistry.get(service);
6135
+ return { service: svc, core: coreInstance };
6136
6136
  };
6137
6137
  }
6138
6138
  __name(createServiceGetter, "createServiceGetter");
@@ -6165,13 +6165,13 @@ function createNextApiRoute(config) {
6165
6165
  function createHandler(method, handler) {
6166
6166
  return ServerErrorMiddleware.withErrorHandler(
6167
6167
  async (request, context) => {
6168
- const svc = await getService();
6168
+ const { service: svc, core: coreInstance } = await getService();
6169
6169
  const routeContext = context;
6170
6170
  const params = routeContext?.params ? await routeContext.params : {};
6171
6171
  const query = parseQueryParams(request);
6172
6172
  const headers = parseHeaders(request);
6173
6173
  const body = await parseMutationBody(request, method);
6174
- const services = injectServices ? getInjectedServices() : emptyServices;
6174
+ const services = injectServices ? getInjectedServices(coreInstance) : emptyServices;
6175
6175
  const ctx = {
6176
6176
  params,
6177
6177
  query,