@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.
@@ -6167,21 +6167,21 @@ function getStatusForMethod(method) {
6167
6167
  }
6168
6168
  }
6169
6169
  __name(getStatusForMethod, "getStatusForMethod");
6170
- function getInjectedServices() {
6170
+ function getInjectedServices(coreInstance) {
6171
6171
  return {
6172
- db: Core.db,
6173
- cache: Core.cache,
6174
- storage: Core.storage,
6175
- notifications: Core.notifications,
6176
- api: Core.api
6172
+ db: coreInstance.db,
6173
+ cache: coreInstance.cache,
6174
+ storage: coreInstance.storage,
6175
+ notifications: coreInstance.notifications,
6176
+ api: coreInstance.api
6177
6177
  };
6178
6178
  }
6179
6179
  __name(getInjectedServices, "getInjectedServices");
6180
6180
  function createServiceGetter(service, getCore) {
6181
6181
  return async () => {
6182
- if (getCore) await getCore();
6183
- if (typeof service === "function") return service();
6184
- return ServiceRegistry.get(service);
6182
+ const coreInstance = getCore ? await getCore() : Core;
6183
+ const svc = typeof service === "function" ? await service() : ServiceRegistry.get(service);
6184
+ return { service: svc, core: coreInstance };
6185
6185
  };
6186
6186
  }
6187
6187
  __name(createServiceGetter, "createServiceGetter");
@@ -6214,13 +6214,13 @@ function createNextApiRoute(config) {
6214
6214
  function createHandler(method, handler) {
6215
6215
  return ServerErrorMiddleware__namespace.withErrorHandler(
6216
6216
  async (request, context) => {
6217
- const svc = await getService();
6217
+ const { service: svc, core: coreInstance } = await getService();
6218
6218
  const routeContext = context;
6219
6219
  const params = routeContext?.params ? await routeContext.params : {};
6220
6220
  const query = parseQueryParams(request);
6221
6221
  const headers = parseHeaders(request);
6222
6222
  const body = await parseMutationBody(request, method);
6223
- const services = injectServices ? getInjectedServices() : emptyServices;
6223
+ const services = injectServices ? getInjectedServices(coreInstance) : emptyServices;
6224
6224
  const ctx = {
6225
6225
  params,
6226
6226
  query,