Files
Kristaps Fabians Geikins 4b06f42db7 chore(server): run TS files directly (no compilation) (#5134)
* sort of works

* type fixes

* added option to run old way too
2025-07-23 11:20:40 +02:00

42 lines
1.4 KiB
TypeScript

import type { GraphQLContext } from '@/modules/shared/helpers/typeHelper'
import type {
IsCreatedBeyondHistoryLimitCutoff,
GetProjectLimitDate
} from '@speckle/shared'
import {
getProjectLimitDateFactory as getProjectLimitDateFactoryBase,
isCreatedBeyondHistoryLimitCutoffFactory as isCreatedBeyondHistoryLimitCutoffFactoryBase
} from '@speckle/shared'
import { PersonalProjectsLimits } from '@speckle/shared/authz'
import { getFeatureFlags } from '@speckle/shared/environment'
const { FF_PERSONAL_PROJECTS_LIMITS_ENABLED } = getFeatureFlags()
const getPersonalProjectLimits = FF_PERSONAL_PROJECTS_LIMITS_ENABLED
? () => Promise.resolve(PersonalProjectsLimits)
: () => Promise.resolve(null)
export const isCreatedBeyondHistoryLimitCutoffFactory = (deps: {
ctx: GraphQLContext
}): IsCreatedBeyondHistoryLimitCutoff => {
const getProjectLimitDate = getProjectLimitDateFactory(deps)
const isCreatedBeyondHistoryLimitCutoffFactory =
isCreatedBeyondHistoryLimitCutoffFactoryBase({
getProjectLimitDate
})
return isCreatedBeyondHistoryLimitCutoffFactory
}
export const getProjectLimitDateFactory = (deps: {
ctx: GraphQLContext
}): GetProjectLimitDate => {
const getProjectLimitDate = getProjectLimitDateFactoryBase({
// this one
getWorkspaceLimits: async ({ workspaceId }) =>
(await deps.ctx.loaders.gatekeeper?.getWorkspaceLimits.load(workspaceId)) || null,
getPersonalProjectLimits
})
return getProjectLimitDate
}