@wopr-network/platform-core 1.27.0 → 1.27.1

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.
@@ -1,5 +1,5 @@
1
1
  import type { ITenantUpdateConfigRepository } from "../fleet/tenant-update-config-repository.js";
2
- export declare function createFleetUpdateConfigRouter(configRepo: ITenantUpdateConfigRepository): import("@trpc/server").TRPCBuiltRouter<{
2
+ export declare function createFleetUpdateConfigRouter(getConfigRepo: () => ITenantUpdateConfigRepository): import("@trpc/server").TRPCBuiltRouter<{
3
3
  ctx: import("./init.js").TRPCContext;
4
4
  meta: object;
5
5
  errorShape: import("@trpc/server").TRPCDefaultErrorShape;
@@ -1,10 +1,10 @@
1
1
  import { z } from "zod";
2
2
  import { logger } from "../config/logger.js";
3
3
  import { protectedProcedure, router } from "./init.js";
4
- export function createFleetUpdateConfigRouter(configRepo) {
4
+ export function createFleetUpdateConfigRouter(getConfigRepo) {
5
5
  return router({
6
6
  getUpdateConfig: protectedProcedure.input(z.object({ tenantId: z.string().min(1) })).query(async ({ input }) => {
7
- return configRepo.get(input.tenantId);
7
+ return getConfigRepo().get(input.tenantId);
8
8
  }),
9
9
  setUpdateConfig: protectedProcedure
10
10
  .input(z.object({
@@ -13,7 +13,7 @@ export function createFleetUpdateConfigRouter(configRepo) {
13
13
  preferredHourUtc: z.number().int().min(0).max(23).optional(),
14
14
  }))
15
15
  .mutation(async ({ input }) => {
16
- await configRepo.upsert(input.tenantId, {
16
+ await getConfigRepo().upsert(input.tenantId, {
17
17
  mode: input.mode,
18
18
  preferredHourUtc: input.preferredHourUtc ?? 3,
19
19
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wopr-network/platform-core",
3
- "version": "1.27.0",
3
+ "version": "1.27.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -3,10 +3,10 @@ import { logger } from "../config/logger.js";
3
3
  import type { ITenantUpdateConfigRepository } from "../fleet/tenant-update-config-repository.js";
4
4
  import { protectedProcedure, router } from "./init.js";
5
5
 
6
- export function createFleetUpdateConfigRouter(configRepo: ITenantUpdateConfigRepository) {
6
+ export function createFleetUpdateConfigRouter(getConfigRepo: () => ITenantUpdateConfigRepository) {
7
7
  return router({
8
8
  getUpdateConfig: protectedProcedure.input(z.object({ tenantId: z.string().min(1) })).query(async ({ input }) => {
9
- return configRepo.get(input.tenantId);
9
+ return getConfigRepo().get(input.tenantId);
10
10
  }),
11
11
 
12
12
  setUpdateConfig: protectedProcedure
@@ -18,7 +18,7 @@ export function createFleetUpdateConfigRouter(configRepo: ITenantUpdateConfigRep
18
18
  }),
19
19
  )
20
20
  .mutation(async ({ input }) => {
21
- await configRepo.upsert(input.tenantId, {
21
+ await getConfigRepo().upsert(input.tenantId, {
22
22
  mode: input.mode,
23
23
  preferredHourUtc: input.preferredHourUtc ?? 3,
24
24
  });