Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 4 additions & 6 deletions apps/gateway/src/common/documents/getData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ import {
} from '@latitude-data/constants'
import { getDocumentMetadata } from '@latitude-data/core/services/documents/scan'
import { documentPresenterWithProviderAndMetadata } from '$/presenters/documentPresenter'
import {
Commit,
DocumentVersion,
Project,
type Workspace,
} from '@latitude-data/core/schema/types'
import { Project } from '@latitude-data/core/schema/models/types/Project'
import { Workspace } from '@latitude-data/core/schema/models/types/Workspace'
import { Commit } from '@latitude-data/core/schema/models/types/Commit'
import { DocumentVersion } from '@latitude-data/core/schema/models/types/DocumentVersion'

async function getProjectByVersionData({
workspace,
Expand Down
3 changes: 2 additions & 1 deletion apps/gateway/src/middlewares/auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { unsafelyFindWorkspace } from '@latitude-data/core/data-access/workspaces'
import { unsafelyGetApiKeyByToken } from '@latitude-data/core/data-access/apiKeys'
import { bearerAuth } from 'hono/bearer-auth'
import { type ApiKey, type Workspace } from '@latitude-data/core/schema/types'
import { Workspace } from '@latitude-data/core/schema/models/types/Workspace'
import { ApiKey } from '@latitude-data/core/schema/models/types/ApiKey'

declare module 'hono' {
interface ContextVariableMap {
Expand Down
22 changes: 10 additions & 12 deletions apps/gateway/src/presenters/documentPresenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ import { ParameterType } from '@latitude-data/constants'
import { ProviderApiKeysRepository } from '@latitude-data/core/repositories'
import { scanDocumentContent } from '@latitude-data/core/services/documents/scan'
import { ConversationMetadata } from 'promptl-ai'
import {
Commit,
DocumentVersion,
Workspace,
} from '@latitude-data/core/schema/types'
import { Providers } from '@latitude-data/constants'
import { Commit } from '@latitude-data/core/schema/models/types/Commit'
import { Workspace } from '@latitude-data/core/schema/models/types/Workspace'
import { DocumentVersion } from '@latitude-data/core/schema/models/types/DocumentVersion'

export const documentPresenterSchema = z.object({
versionUuid: z.string(),
Expand Down Expand Up @@ -40,14 +38,14 @@ export function documentPresenterWithProviderAndMetadata({
const parameters =
rawParams.length > 0
? rawParams.reduce(
(acc, rawParam) => {
if (acc[rawParam]) return acc
acc[rawParam] = { type: ParameterType.Text }
(acc, rawParam) => {
if (acc[rawParam]) return acc
acc[rawParam] = { type: ParameterType.Text }

return acc
},
{ ...configParams },
)
return acc
},
{ ...configParams },
)
: configParams

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
helpers,
} from '@latitude-data/core/factories'
import { generateUUIDIdentifier } from '@latitude-data/core/lib/generateUUID'
import { ApiKey } from '@latitude-data/core/schema/types'
import { ApiKey } from '@latitude-data/core/schema/models/types/ApiKey'
import { describe, expect, it } from 'vitest'

describe('POST /conversations/:conversationUuid/evaluations/:evaluationUuid/annotate', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
EvaluationResultV2,
PublicManualEvaluationResultV2,
} from '@latitude-data/constants'
import { Commit } from '@latitude-data/core/schema/types'
import { Commit } from '@latitude-data/core/schema/models/types/Commit'

export function serializeEvaluationResultV2(
evaluationResult: EvaluationResultV2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import {
LogSources,
StreamEventTypes,
} from '@latitude-data/core/constants'
import { ProviderLog, Workspace } from '@latitude-data/core/schema/types'
import { ProviderLog } from '@latitude-data/core/schema/models/types/ProviderLog'
import { Workspace } from '@latitude-data/core/schema/models/types/Workspace'

const mocks = vi.hoisted(() => ({
addMessages: vi.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { unsafelyGetFirstApiKeyByWorkspaceId } from '@latitude-data/core/data-ac
import { createProject } from '@latitude-data/core/factories'
import { ProjectsRepository } from '@latitude-data/core/repositories'
import { beforeAll, describe, expect, it, vi } from 'vitest'
import { Project } from '@latitude-data/core/schema/types'
import { Project } from '@latitude-data/core/schema/models/types/Project'

vi.mock('$/jobs', () => ({
queues: { jobs: { enqueueUpdateApiKeyProviderJob: vi.fn() } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { DocumentVersionsRepository } from '@latitude-data/core/repositories'
import { mergeCommit } from '@latitude-data/core/services/commits/merge'
import { beforeAll, describe, expect, it, vi } from 'vitest'
import { Commit } from '@latitude-data/core/schema/types'
import { Commit } from '@latitude-data/core/schema/models/types/Commit'

vi.mock('$/jobs', () => ({
queues: { jobs: { enqueueUpdateApiKeyProviderJob: vi.fn() } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ import {
} from '@latitude-data/core/repositories'
import { mergeCommit } from '@latitude-data/core/services/commits/merge'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import {
Commit,
Project,
ProviderApiKey,
User,
Workspace,
} from '@latitude-data/core/schema/types'
import { Project } from '@latitude-data/core/schema/models/types/Project'
import { Commit } from '@latitude-data/core/schema/models/types/Commit'
import { Workspace } from '@latitude-data/core/schema/models/types/Workspace'
import { User } from '@latitude-data/core/schema/models/types/User'
import { ProviderApiKey } from '@latitude-data/core/schema/models/types/ProviderApiKey'

const mocks = vi.hoisted(() => ({
queues: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { createNewDocument } from '@latitude-data/core/services/documents/create
import { documentPresenter } from '$/presenters/documentPresenter'
import { AppRouteHandler } from '$/openApi/types'
import { GetOrCreateRoute } from './getOrCreate.route'
import { Commit, Workspace } from '@latitude-data/core/schema/types'
import { Commit } from '@latitude-data/core/schema/models/types/Commit'
import { Workspace } from '@latitude-data/core/schema/models/types/Workspace'

async function getOrCreateDocument({
workspace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,15 @@ import { mergeCommit } from '@latitude-data/core/services/commits/merge'
import { testConsumeStream } from 'test/helpers'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { ChainEventTypes } from '@latitude-data/constants'
import {
Commit,
Project,
ProviderLog,
Workspace,
} from '@latitude-data/core/schema/types'
import {
LegacyChainEventTypes,
LogSources,
StreamEventTypes,
} from '@latitude-data/core/constants'
import { Commit } from '@latitude-data/core/schema/models/types/Commit'
import { Workspace } from '@latitude-data/core/schema/models/types/Workspace'
import { Project } from '@latitude-data/core/schema/models/types/Project'
import { ProviderLog } from '@latitude-data/core/schema/models/types/ProviderLog'

const mocks = vi.hoisted(() => ({
runDocumentAtCommit: vi.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { unsafelyFindWorkspace } from '@latitude-data/core/data-access/workspace
import { PromisedResult } from '@latitude-data/core/lib/Transaction'
import { NotFoundError } from '@latitude-data/constants/errors'
import { Result } from '@latitude-data/core/lib/Result'
import { Commit, Workspace } from '@latitude-data/core/schema/types'
import { Commit } from '@latitude-data/core/schema/models/types/Commit'
import { Workspace } from '@latitude-data/core/schema/models/types/Workspace'

async function resolveWorkspaceAndCommit(
triggerUuid: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { withAdmin } from '../../../procedures'
import { registerEmailTriggerEvent } from '@latitude-data/core/services/documentTriggers/handlers/email/registerEvent'
import { CommitsRepository } from '@latitude-data/core/repositories'
import { Result, TypedResult } from '@latitude-data/core/lib/Result'
import { Commit } from '@latitude-data/core/schema/types'

import { Commit } from '@latitude-data/core/schema/models/types/Commit'
export const manualEmailTriggerAction = withAdmin
.inputSchema(
z.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ import { DocumentVersionsRepository } from '@latitude-data/core/repositories'
import { createDraftWithContentAction } from '$/actions/commits/createDraftWithContentAction'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { Providers } from '@latitude-data/constants'
import {
type DocumentVersion,
type Project,
type User,
type Workspace,
} from '@latitude-data/core/schema/types'

import { User } from '@latitude-data/core/schema/models/types/User'
import { Workspace } from '@latitude-data/core/schema/models/types/Workspace'
import { DocumentVersion } from '@latitude-data/core/schema/models/types/DocumentVersion'
import { Project } from '@latitude-data/core/schema/models/types/Project'
const mocks = vi.hoisted(() => {
return {
getSession: vi.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
} from '@latitude-data/core/repositories'
import { createCommit } from '@latitude-data/core/services/commits/create'
import { updateDocument } from '@latitude-data/core/services/documents/update'
import { Commit } from '@latitude-data/core/schema/models/types/Commit'
import { z } from 'zod'

import { Commit } from '@latitude-data/core/schema/types'
import { withProject, withProjectSchema } from '../procedures'

export const createDraftWithPromptlUpgradeAction = withProject
Expand Down
12 changes: 5 additions & 7 deletions apps/web/src/actions/commits/deleteDraftCommit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import * as factories from '@latitude-data/core/factories'
import { DocumentVersionsRepository } from '@latitude-data/core/repositories'
import { deleteDraftCommitAction } from '$/actions/commits/deleteDraftCommitAction'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import {
type Commit,
type Project,
type ProviderApiKey,
type User,
type Workspace,
} from '@latitude-data/core/schema/types'

import { Commit } from '@latitude-data/core/schema/models/types/Commit'
import { User } from '@latitude-data/core/schema/models/types/User'
import { Workspace } from '@latitude-data/core/schema/models/types/Workspace'
import { ProviderApiKey } from '@latitude-data/core/schema/models/types/ProviderApiKey'
import { Project } from '@latitude-data/core/schema/models/types/Project'
const mocks = vi.hoisted(() => {
return {
getSession: vi.fn(),
Expand Down
12 changes: 5 additions & 7 deletions apps/web/src/actions/commits/publishDraftCommit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import { updateDocument } from '@latitude-data/core/services/documents/update'
import { publishDraftCommitAction } from '$/actions/commits/publishDraftCommitAction'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { Providers } from '@latitude-data/constants'
import {
type Commit,
type DocumentVersion,
type Project,
type User,
type Workspace,
} from '@latitude-data/core/schema/types'

import { Commit } from '@latitude-data/core/schema/models/types/Commit'
import { User } from '@latitude-data/core/schema/models/types/User'
import { Workspace } from '@latitude-data/core/schema/models/types/Workspace'
import { DocumentVersion } from '@latitude-data/core/schema/models/types/DocumentVersion'
import { Project } from '@latitude-data/core/schema/models/types/Project'
const mocks = vi.hoisted(() => {
return {
getSession: vi.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ import { and, eq } from 'drizzle-orm'
import { beforeEach, describe, expect, it, vi } from 'vitest'

import { destroyDocumentAction } from './index'
import {
Commit,
DocumentVersion,
Project,
User,
} from '@latitude-data/core/schema/types'
import { Commit } from '@latitude-data/core/schema/models/types/Commit'
import { User } from '@latitude-data/core/schema/models/types/User'
import { DocumentVersion } from '@latitude-data/core/schema/models/types/DocumentVersion'
import { Project } from '@latitude-data/core/schema/models/types/Project'
import { Providers } from '@latitude-data/constants'

const mocks = vi.hoisted(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import { PublishedDocumentRepository } from '@latitude-data/core/repositories/pu
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { publishDocumentAction } from './publishDocumentAction'
import { Providers } from '@latitude-data/constants'
import {
type Commit,
type DocumentVersion,
type Project,
type User,
type Workspace,
} from '@latitude-data/core/schema/types'

import { Commit } from '@latitude-data/core/schema/models/types/Commit'
import { User } from '@latitude-data/core/schema/models/types/User'
import { Workspace } from '@latitude-data/core/schema/models/types/Workspace'
import { DocumentVersion } from '@latitude-data/core/schema/models/types/DocumentVersion'
import { Project } from '@latitude-data/core/schema/models/types/Project'
const mocks = vi.hoisted(() => {
return {
getSession: vi.fn(),
Expand Down
8 changes: 3 additions & 5 deletions apps/web/src/actions/documents/updateContent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import { updateDocument } from '@latitude-data/core/services/documents/update'
import { beforeEach, describe, expect, it, vi } from 'vitest'

import { updateDocumentContentAction } from './updateContent'
import {
DocumentVersion,
Project,
User,
} from '@latitude-data/core/schema/types'
import { User } from '@latitude-data/core/schema/models/types/User'
import { DocumentVersion } from '@latitude-data/core/schema/models/types/DocumentVersion'
import { Project } from '@latitude-data/core/schema/models/types/Project'
import { Providers } from '@latitude-data/constants'

const mocks = vi.hoisted(() => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/actions/integrations/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
pipedreamIntegrationConfigurationSchema,
} from '@latitude-data/core/services/integrations/helpers/schema'
import { IntegrationsRepository } from '@latitude-data/core/repositories'
import { Workspace } from '@latitude-data/core/schema/types'
import { Workspace } from '@latitude-data/core/schema/models/types/Workspace'
import { authProcedure } from '../procedures'

const nameSchema = z
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/actions/magicLinkTokens/confirm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { createProject } from '@latitude-data/core/factories'
import { generateUUIDIdentifier } from '@latitude-data/core/lib/generateUUID'
import { confirmMagicLinkToken } from '@latitude-data/core/services/magicLinkTokens/confirm'
import { createMagicLinkToken } from '@latitude-data/core/services/magicLinkTokens/create'
import { User } from '@latitude-data/core/schema/models/types/User'
import { frontendRedirect } from '$/lib/frontendRedirect'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { confirmMagicLinkTokenAction } from './confirm'
import { User } from '@latitude-data/core/schema/types'

vi.mock('$/lib/frontendRedirect', () => ({
frontendRedirect: vi.fn(),
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/actions/procedures/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { headers } from 'next/headers'

import { getUnsafeIp } from '$/helpers/ip'
import { captureException } from '$/helpers/captureException'
import { Dataset } from '@latitude-data/core/schema/types'
import { Dataset } from '@latitude-data/core/schema/models/types/Dataset'
import { getCurrentUserOrRedirect } from '$/services/auth/getCurrentUser'
import { cache } from '@latitude-data/core/cache'
import {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/actions/providerApiKeys/create.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as factories from '@latitude-data/core/factories'
import { Workspace } from '@latitude-data/core/schema/models/types/Workspace'
import { User } from 'lucia'
import { beforeEach, describe, expect, it, vi } from 'vitest'

import { createProviderApiKeyAction } from './create'
import { Providers } from '@latitude-data/constants'
import { Workspace } from '@latitude-data/core/schema/types'

const mocks = vi.hoisted(() => {
return {
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/actions/rewards/claimRewardAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { claimReward } from '@latitude-data/core/services/claimedRewards/claim'
import { z } from 'zod'

import { authProcedure } from '../procedures'
import { ClaimedReward } from '@latitude-data/core/schema/types'

import { RewardType } from '@latitude-data/core/constants'

import { ClaimedReward } from '@latitude-data/core/schema/models/types/ClaimedReward'
export const claimRewardAction = authProcedure
.inputSchema(
z.object({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use server'
import { updateRewardClaim } from '@latitude-data/core/services/claimedRewards/update'
import { ClaimedReward } from '@latitude-data/core/schema/models/types/ClaimedReward'
import { z } from 'zod'
import { withAdmin } from '../procedures'
import { ClaimedReward } from '@latitude-data/core/schema/types'

export const updateRewardClaimValidityAction = withAdmin
.inputSchema(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import {
ActionFrontendParameters,
ActionType,
} from '@latitude-data/constants/actions'
import { User, Workspace } from '@latitude-data/core/schema/types'

import { User } from '@latitude-data/core/schema/models/types/User'
import { Workspace } from '@latitude-data/core/schema/models/types/Workspace'
import { ClientOnly } from '@latitude-data/web-ui/atoms/ClientOnly'
import { Icon } from '@latitude-data/web-ui/atoms/Icons'
import { Text } from '@latitude-data/web-ui/atoms/Text'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import {
ActionFrontendParameters,
ActionType,
} from '@latitude-data/constants/actions'
import { User, Workspace } from '@latitude-data/core/schema/types'

import { User } from '@latitude-data/core/schema/models/types/User'
import { Workspace } from '@latitude-data/core/schema/models/types/Workspace'
import { useRouter } from 'next/navigation'
import { z } from 'zod'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use client'
import { User } from '@latitude-data/core/schema/models/types/User'

import { AppHeaderWrapper } from '$/components/layouts/AppLayout/Header'
import AvatarDropdown from '$/components/layouts/AppLayout/Header/AvatarDropdown'
import { HeaderBreadcrumb } from '$/components/layouts/AppLayout/Header/Breadcrumb'
import { User } from '@latitude-data/core/schema/types'

export default function BasicHeader({
currentUser,
Expand Down
Loading
Loading