@plyaz/core 1.18.2 → 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.
@@ -6145,21 +6145,21 @@ function getStatusForMethod(method) {
6145
6145
  }
6146
6146
  }
6147
6147
  __name(getStatusForMethod, "getStatusForMethod");
6148
- function getInjectedServices() {
6148
+ function getInjectedServices(coreInstance) {
6149
6149
  return {
6150
- db: Core.db,
6151
- cache: Core.cache,
6152
- storage: Core.storage,
6153
- notifications: Core.notifications,
6154
- api: Core.api
6150
+ db: coreInstance.db,
6151
+ cache: coreInstance.cache,
6152
+ storage: coreInstance.storage,
6153
+ notifications: coreInstance.notifications,
6154
+ api: coreInstance.api
6155
6155
  };
6156
6156
  }
6157
6157
  __name(getInjectedServices, "getInjectedServices");
6158
6158
  function createServiceGetter(service, getCore) {
6159
6159
  return async () => {
6160
- if (getCore) await getCore();
6161
- if (typeof service === "function") return service();
6162
- return ServiceRegistry.get(service);
6160
+ const coreInstance = getCore ? await getCore() : Core;
6161
+ const svc = typeof service === "function" ? await service() : ServiceRegistry.get(service);
6162
+ return { service: svc, core: coreInstance };
6163
6163
  };
6164
6164
  }
6165
6165
  __name(createServiceGetter, "createServiceGetter");
@@ -6192,13 +6192,13 @@ function createNextApiRoute(config) {
6192
6192
  function createHandler(method, handler) {
6193
6193
  return ServerErrorMiddleware.withErrorHandler(
6194
6194
  async (request, context) => {
6195
- const svc = await getService();
6195
+ const { service: svc, core: coreInstance } = await getService();
6196
6196
  const routeContext = context;
6197
6197
  const params = routeContext?.params ? await routeContext.params : {};
6198
6198
  const query = parseQueryParams(request);
6199
6199
  const headers = parseHeaders(request);
6200
6200
  const body = await parseMutationBody(request, method);
6201
- const services = injectServices ? getInjectedServices() : emptyServices;
6201
+ const services = injectServices ? getInjectedServices(coreInstance) : emptyServices;
6202
6202
  const ctx = {
6203
6203
  params,
6204
6204
  query,