33// SPDX-License-Identifier: MIT
44
55import { initTRPC , TRPCError } from "@trpc/server" ;
6- import * as fs from "fs" ;
7- import { join as pathJoin } from "path" ;
86import superjson from "superjson" ;
97import type { Equals , ReturnType } from "tsafe" ;
108import { assert } from "tsafe/assert" ;
@@ -21,7 +19,7 @@ import {
2119 SoftwareType ,
2220 UserWithId
2321} from "../core/usecases/readWriteSillData" ;
24- import { getMonorepoRootPackageJson } from "../tools/getMonorepoRootPackageJson " ;
22+ import { projectVersion } from "../tools/projectVersion " ;
2523import type { OptionalIfCanBeUndefined } from "../tools/OptionalIfCanBeUndefined" ;
2624import type { Context } from "./context" ;
2725import type { OidcParams } from "../core/usecases/auth/oidcClient" ;
@@ -87,15 +85,7 @@ export function createRouter(params: {
8785 // PUBLIC PROCEDURES
8886 "getRedirectUrl" : loggedProcedure . query ( ( ) => redirectUrl ) ,
8987 "getExternalSoftwareDataOrigin" : loggedProcedure . query ( async ( ) => ( await dbApi . source . getMainSource ( ) ) . kind ) ,
90- "getApiVersion" : loggedProcedure . query (
91- ( ( ) => {
92- const out : string = JSON . parse (
93- fs . readFileSync ( pathJoin ( getMonorepoRootPackageJson ( ) , "package.json" ) ) . toString ( "utf8" )
94- ) [ "version" ] ;
95-
96- return ( ) => out ;
97- } ) ( )
98- ) ,
88+ "getApiVersion" : loggedProcedure . query ( ( ) => projectVersion ) ,
9989 "getOidcManageProfileUrl" : loggedProcedure . query ( ( ) => oidcParams . manageProfileUrl ) ,
10090 "getUiConfig" : loggedProcedure . query ( async ( ) => ( {
10191 uiConfig,
0 commit comments