mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 11:36:05 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d880cb881 | |||
| 3d076704f9 | |||
| 1b0f043506 | |||
| c383b11648 | |||
| fed564e7c0 | |||
| 9e216f5ae4 | |||
| 0f0232491b | |||
| 35fb59e64e | |||
| ee3fff1dab | |||
| 3bc75d2b1c | |||
| 094426debb | |||
| 313198ba63 | |||
| e677d58f91 |
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"src": {
|
||||
"@typescript-eslint/no-non-null-assertion": 382,
|
||||
"@typescript-eslint/no-misused-promises": 849,
|
||||
"@typescript-eslint/no-misused-promises": 848,
|
||||
"no-console": 88,
|
||||
"complexity": 220,
|
||||
"@typescript-eslint/no-explicit-any": 146,
|
||||
|
||||
@@ -440,6 +440,8 @@ export const CHANGE_LABELS: Record<AssistantChangeLabelKey, { labelKey: string }
|
||||
currency: { labelKey: 'assistant.change.label.currency' },
|
||||
stopType: { labelKey: 'assistant.change.label.stopType' },
|
||||
text: { labelKey: 'assistant.change.label.text' },
|
||||
title: { labelKey: 'assistant.change.label.title' },
|
||||
content: { labelKey: 'assistant.change.label.content' },
|
||||
icon: { labelKey: 'assistant.change.label.icon' },
|
||||
color: { labelKey: 'assistant.change.label.color' },
|
||||
position: { labelKey: 'assistant.change.label.position' },
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// FE-DOCSYNC-BIND-001 to FE-DOCSYNC-BIND-030
|
||||
// FE-DOCSYNC-BIND-001 to FE-DOCSYNC-BIND-032
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||
import en from '@trek/shared/i18n/en'
|
||||
import { render, screen, fireEvent, waitFor, within } from '../../../../tests/helpers/render'
|
||||
@@ -66,6 +66,7 @@ function renderCard(
|
||||
canManage?: boolean
|
||||
providerName?: string
|
||||
onReconnect?: () => void
|
||||
onEditConnection?: () => void
|
||||
} = {},
|
||||
) {
|
||||
const utils = render(
|
||||
@@ -75,6 +76,7 @@ function renderCard(
|
||||
sync={makeSync(opts.sync)}
|
||||
canManage={opts.canManage ?? true}
|
||||
onReconnect={opts.onReconnect}
|
||||
onEditConnection={opts.onEditConnection}
|
||||
/>,
|
||||
)
|
||||
const header = utils.container.querySelector('header') as HTMLElement
|
||||
@@ -421,3 +423,31 @@ describe('DocSyncBinding: the direction lanes', () => {
|
||||
expect(updateLink).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
describe('DocSyncBinding: the connection behind it', () => {
|
||||
const S = en as unknown as Record<string, string>
|
||||
const editButton = () => screen.queryByRole('button', { name: S['docsync.connection.edit'] })
|
||||
|
||||
it('FE-DOCSYNC-BIND-031: the settings open the stored connection at any time, not only after a refusal', () => {
|
||||
const onEditConnection = vi.fn()
|
||||
renderCard({ link: { lastSyncState: 'ok' }, onEditConnection })
|
||||
|
||||
expect(editButton()).not.toBeInTheDocument()
|
||||
openSettings()
|
||||
expect(screen.getByText(S['docsync.connection.title'])).toBeInTheDocument()
|
||||
fireEvent.click(editButton() as HTMLElement)
|
||||
|
||||
expect(onEditConnection).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('FE-DOCSYNC-BIND-032: a member, or a panel without the form, gets no way to the connection', () => {
|
||||
const member = renderCard({ canManage: false, onEditConnection: vi.fn() })
|
||||
expect(screen.queryByRole('button', { name: 'Settings' })).not.toBeInTheDocument()
|
||||
expect(editButton()).not.toBeInTheDocument()
|
||||
member.unmount()
|
||||
|
||||
renderCard()
|
||||
openSettings()
|
||||
expect(editButton()).not.toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState } from 'react'
|
||||
import {
|
||||
AlertTriangle, Check, ChevronDown, Clock, Copy, FolderOpen, Link2Off, RefreshCw,
|
||||
AlertTriangle, Check, ChevronDown, Clock, Copy, FolderOpen, KeyRound, Link2Off, RefreshCw,
|
||||
} from 'lucide-react'
|
||||
import ConfirmDialog from '../../shared/ConfirmDialog'
|
||||
import CustomSelect from '../../shared/CustomSelect'
|
||||
@@ -27,6 +27,7 @@ export default function DocSyncBinding({
|
||||
sync,
|
||||
canManage,
|
||||
onReconnect,
|
||||
onEditConnection,
|
||||
}: {
|
||||
link: DocSyncLink
|
||||
providerName: string
|
||||
@@ -38,6 +39,8 @@ export default function DocSyncBinding({
|
||||
* not carry; left out, a refused credential is reported but not curable.
|
||||
*/
|
||||
onReconnect?: () => void
|
||||
/** The same form at any time, to change the address or the login, or to remove the connection. */
|
||||
onEditConnection?: () => void
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
const [open, setOpen] = useState(false)
|
||||
@@ -237,6 +240,21 @@ export default function DocSyncBinding({
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{onEditConnection && (
|
||||
<Row label={t('docsync.connection.title')} hint={t('docsync.connection.hint')}>
|
||||
<span className="flex justify-end">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onEditConnection}
|
||||
className="flex items-center gap-1.5 rounded-lg border border-edge bg-surface px-2.5 py-1.5 text-caption font-medium text-content-secondary transition-colors hover:bg-surface-hover"
|
||||
>
|
||||
<KeyRound size={13} />
|
||||
{t('docsync.connection.edit')}
|
||||
</button>
|
||||
</span>
|
||||
</Row>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// FE-DOCSYNC-CONNECT-001 to FE-DOCSYNC-CONNECT-027
|
||||
// FE-DOCSYNC-CONNECT-001 to FE-DOCSYNC-CONNECT-030
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import en from '@trek/shared/i18n/en'
|
||||
import { render, screen, fireEvent, waitFor, act, within } from '../../../../tests/helpers/render'
|
||||
@@ -13,6 +13,7 @@ const listLinks = vi.fn(async (_tripId: number | string): Promise<unknown> => []
|
||||
const status = vi.fn(async (_tripId: number | string): Promise<unknown> => ({ items: {}, links: [] }))
|
||||
const saveConnection = vi.fn(async (_tripId: number | string, _data: unknown): Promise<unknown> => ({ id: 1 }))
|
||||
const testConnection = vi.fn(async (_tripId: number | string, _data: unknown): Promise<unknown> => ({ connected: true }))
|
||||
const deleteConnection = vi.fn(async (_tripId: number | string, _id: number): Promise<unknown> => ({ success: true }))
|
||||
|
||||
vi.mock('../../../api/client', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../../../api/client')>()
|
||||
@@ -26,6 +27,7 @@ vi.mock('../../../api/client', async (importOriginal) => {
|
||||
listLinks: (tripId: number | string) => listLinks(tripId),
|
||||
saveConnection: (tripId: number | string, data: unknown) => saveConnection(tripId, data),
|
||||
testConnection: (tripId: number | string, data: unknown) => testConnection(tripId, data),
|
||||
deleteConnection: (tripId: number | string, id: number) => deleteConnection(tripId, id),
|
||||
},
|
||||
}
|
||||
})
|
||||
@@ -81,11 +83,13 @@ function Harness({
|
||||
provider,
|
||||
onClose,
|
||||
onConnected,
|
||||
onRemoved,
|
||||
waitForConnection,
|
||||
}: {
|
||||
provider: DocSyncProvider
|
||||
onClose: () => void
|
||||
onConnected: (providerId: string) => void
|
||||
onRemoved?: () => void
|
||||
/**
|
||||
* Hold the dialog back until the stored connection is in hand, the way the
|
||||
* panel does: it only offers "connect" once it knows what is already there.
|
||||
@@ -94,7 +98,9 @@ function Harness({
|
||||
}) {
|
||||
const sync = useDocSync(TRIP_ID, true)
|
||||
if (waitForConnection && !sync.connectionFor(provider.id)) return null
|
||||
return <DocSyncConnectModal provider={provider} sync={sync} onClose={onClose} onConnected={onConnected} />
|
||||
return (
|
||||
<DocSyncConnectModal provider={provider} sync={sync} onClose={onClose} onConnected={onConnected} onRemoved={onRemoved} />
|
||||
)
|
||||
}
|
||||
|
||||
/** Let the hook's initial load land before anything is asserted. */
|
||||
@@ -492,3 +498,52 @@ describe('DocSyncConnectModal with a connection already stored', () => {
|
||||
expect(saveConnection).toHaveBeenCalledWith(TRIP_ID, expect.objectContaining({ baseUrl: 'https://cloud.example.com' }))
|
||||
})
|
||||
})
|
||||
|
||||
describe('DocSyncConnectModal removal', () => {
|
||||
const removeButton = () => screen.queryByRole('button', { name: tx('docsync.connection.remove') })
|
||||
// The confirmation is portalled after the dialog, so its button is the last one of that name.
|
||||
const confirmRemoval = () => {
|
||||
const named = screen.getAllByRole('button', { name: tx('docsync.connection.remove') })
|
||||
return named[named.length - 1]
|
||||
}
|
||||
|
||||
async function openWithRemoval(stored: boolean) {
|
||||
if (stored) listConnections.mockResolvedValue([connection()])
|
||||
const onRemoved = vi.fn()
|
||||
render(<Harness provider={nextcloud} onClose={vi.fn()} onConnected={vi.fn()} onRemoved={onRemoved} waitForConnection={stored} />)
|
||||
await flush()
|
||||
return onRemoved
|
||||
}
|
||||
|
||||
it('FE-DOCSYNC-CONNECT-028: a stored connection can be removed after a confirmation, and the dialog is told', async () => {
|
||||
const onRemoved = await openWithRemoval(true)
|
||||
await waitFor(() => expect(removeButton()).toBeInTheDocument())
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: tx('docsync.connection.remove') }))
|
||||
expect(deleteConnection).not.toHaveBeenCalled()
|
||||
await screen.findByText(tx('docsync.connection.confirmRemove'))
|
||||
fireEvent.click(confirmRemoval())
|
||||
|
||||
await waitFor(() => expect(deleteConnection).toHaveBeenCalledWith(TRIP_ID, 9))
|
||||
await waitFor(() => expect(onRemoved).toHaveBeenCalled())
|
||||
})
|
||||
|
||||
it('FE-DOCSYNC-CONNECT-029: a refused removal keeps the dialog and says why', async () => {
|
||||
deleteConnection.mockRejectedValueOnce({ response: { status: 403, data: { error: 'forbidden' } } })
|
||||
const onRemoved = await openWithRemoval(true)
|
||||
await waitFor(() => expect(removeButton()).toBeInTheDocument())
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: tx('docsync.connection.remove') }))
|
||||
await screen.findByText(tx('docsync.connection.confirmRemove'))
|
||||
fireEvent.click(confirmRemoval())
|
||||
|
||||
await waitFor(() => expect(deleteConnection).toHaveBeenCalled())
|
||||
expect(onRemoved).not.toHaveBeenCalled()
|
||||
expect(await screen.findByText(tx('docsync.error.forbidden'))).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-DOCSYNC-CONNECT-030: a first connection has nothing to remove', async () => {
|
||||
await openWithRemoval(false)
|
||||
expect(removeButton()).not.toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useId, useState } from 'react'
|
||||
import { AlertTriangle, Check, Loader2, Plug, ShieldAlert } from 'lucide-react'
|
||||
import { DialogButton, DialogFooter, DialogHeader, DialogShell, DialogTile, FooterSpacer, NEUTRAL_TINT } from '../../shared/DialogShell'
|
||||
import { DeleteButton, DialogButton, DialogFooter, DialogHeader, DialogShell, DialogTile, FooterSpacer, NEUTRAL_TINT } from '../../shared/DialogShell'
|
||||
import ConfirmDialog from '../../shared/ConfirmDialog'
|
||||
import { Tooltip } from '../../shared/Tooltip'
|
||||
import ToggleSwitch from '../../Settings/ToggleSwitch'
|
||||
import { useTranslation } from '../../../i18n/TranslationContext'
|
||||
@@ -22,11 +23,14 @@ export default function DocSyncConnectModal({
|
||||
sync,
|
||||
onClose,
|
||||
onConnected,
|
||||
onRemoved,
|
||||
}: {
|
||||
provider: DocSyncProvider
|
||||
sync: ReturnType<typeof useDocSync>
|
||||
onClose: () => void
|
||||
onConnected: (providerId: string) => void
|
||||
/** After the stored connection was removed from here; left out, the form offers no removal. */
|
||||
onRemoved?: () => void
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
const existing = sync.connectionFor(provider.id)
|
||||
@@ -34,6 +38,11 @@ export default function DocSyncConnectModal({
|
||||
|
||||
const form = useConnectForm(provider, existing, sync)
|
||||
const [verdict, setVerdict] = useState<DocSyncVerdict | null>(null)
|
||||
const [confirmRemove, setConfirmRemove] = useState(false)
|
||||
|
||||
const remove = async () => {
|
||||
if (existing && (await sync.removeConnection(existing.id))) onRemoved?.()
|
||||
}
|
||||
|
||||
const test = async () => setVerdict(await form.probe())
|
||||
const labelId = useId()
|
||||
@@ -46,6 +55,7 @@ export default function DocSyncConnectModal({
|
||||
<DialogShell
|
||||
onClose={onClose}
|
||||
labelledBy={labelId}
|
||||
blocked={confirmRemove}
|
||||
header={(
|
||||
<DialogHeader
|
||||
tile={<DialogTile>{Icon ? <Icon className="h-5 w-5 text-content" /> : <Plug size={20} strokeWidth={1.9} className="text-content-muted" />}</DialogTile>}
|
||||
@@ -57,6 +67,13 @@ export default function DocSyncConnectModal({
|
||||
)}
|
||||
footer={(
|
||||
<DialogFooter>
|
||||
{existing && onRemoved && (
|
||||
<DeleteButton
|
||||
label={t('docsync.connection.remove')}
|
||||
onClick={() => setConfirmRemove(true)}
|
||||
disabled={sync.busy === 'connection'}
|
||||
/>
|
||||
)}
|
||||
<Verdict verdict={verdict} busy={sync.busy === 'test'} failure={sync.error} />
|
||||
<FooterSpacer />
|
||||
<DialogButton onClick={() => void test()} disabled={!form.complete || sync.busy === 'test'}>
|
||||
@@ -101,6 +118,15 @@ export default function DocSyncConnectModal({
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<ConfirmDialog
|
||||
isOpen={confirmRemove}
|
||||
onClose={() => setConfirmRemove(false)}
|
||||
onConfirm={() => void remove()}
|
||||
title={t('docsync.connection.remove')}
|
||||
message={t('docsync.connection.confirmRemove')}
|
||||
confirmLabel={t('docsync.connection.remove')}
|
||||
/>
|
||||
</DialogShell>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -62,6 +62,9 @@ export default function DocSyncPanel({
|
||||
setSelected(prev => (sync.links.some(l => l.id === prev) ? prev : (sync.links[0]?.id ?? null)))
|
||||
}, [sync.links])
|
||||
|
||||
// The connection behind the folder picker, which the picker can send back to.
|
||||
const scopeProvider = scopeFor ? sync.providers.find(p => p.id === scopeFor) : undefined
|
||||
|
||||
const attention = ATTENTION_STATES.reduce((n, k) => n + (sync.itemCounts[k] ?? 0), 0)
|
||||
const labelId = useId()
|
||||
|
||||
@@ -113,6 +116,7 @@ export default function DocSyncPanel({
|
||||
sync={sync}
|
||||
canManage={canManage}
|
||||
onReconnect={activeProvider ? () => setReconnecting(activeProvider) : undefined}
|
||||
onEditConnection={canManage && activeProvider ? () => setReconnecting(activeProvider) : undefined}
|
||||
/>
|
||||
{/* Every action in this column reports here: a refused run, a
|
||||
switch that flipped back, a conflict the server would not
|
||||
@@ -141,6 +145,7 @@ export default function DocSyncPanel({
|
||||
sync={sync}
|
||||
onClose={() => setConnecting(null)}
|
||||
onConnected={id => { setConnecting(null); setScopeFor(id) }}
|
||||
onRemoved={() => setConnecting(null)}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -149,6 +154,7 @@ export default function DocSyncPanel({
|
||||
provider={reconnecting}
|
||||
sync={sync}
|
||||
onClose={() => setReconnecting(null)}
|
||||
onRemoved={() => setReconnecting(null)}
|
||||
onConnected={id => {
|
||||
setReconnecting(null)
|
||||
// Run straight away, as binding does: the card still reports the
|
||||
@@ -168,6 +174,7 @@ export default function DocSyncPanel({
|
||||
sync={sync}
|
||||
onClose={() => setScopeFor(null)}
|
||||
onBound={() => setScopeFor(null)}
|
||||
onEditConnection={scopeProvider ? () => { setScopeFor(null); setConnecting(scopeProvider) } : undefined}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// FE-DOCSYNC-SCOPE-001 to FE-DOCSYNC-SCOPE-023
|
||||
// FE-DOCSYNC-SCOPE-001 to FE-DOCSYNC-SCOPE-024
|
||||
|
||||
/**
|
||||
* The folder picker of the document-sync dialog.
|
||||
@@ -84,9 +84,10 @@ function deferred<T>() {
|
||||
return { promise, resolve, reject }
|
||||
}
|
||||
|
||||
function Harness({ suggestedName = 'trek-paris-42', providerName = 'Paperless' }: {
|
||||
function Harness({ suggestedName = 'trek-paris-42', providerName = 'Paperless', onEditConnection }: {
|
||||
suggestedName?: string
|
||||
providerName?: string
|
||||
onEditConnection?: () => void
|
||||
}) {
|
||||
const sync = useDocSync(TRIP_ID, false)
|
||||
return (
|
||||
@@ -97,6 +98,7 @@ function Harness({ suggestedName = 'trek-paris-42', providerName = 'Paperless' }
|
||||
sync={sync}
|
||||
onClose={onClose}
|
||||
onBound={onBound}
|
||||
onEditConnection={onEditConnection}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -381,3 +383,20 @@ describe('DocSyncScopeModal errors', () => {
|
||||
expect(createButton()).toBeEnabled()
|
||||
})
|
||||
})
|
||||
|
||||
describe('DocSyncScopeModal connection', () => {
|
||||
it('FE-DOCSYNC-SCOPE-024: leads back to the stored connection before a folder is chosen', async () => {
|
||||
const editButton = () => screen.queryByRole('button', { name: S['docsync.connection.edit'] })
|
||||
const onEditConnection = vi.fn()
|
||||
const first = render(<Harness onEditConnection={onEditConnection} />)
|
||||
await waitFor(() => expect(listScopes).toHaveBeenCalled())
|
||||
|
||||
fireEvent.click(editButton() as HTMLElement)
|
||||
expect(onEditConnection).toHaveBeenCalledTimes(1)
|
||||
expect(createLink).not.toHaveBeenCalled()
|
||||
first.unmount()
|
||||
|
||||
render(<Harness />)
|
||||
expect(editButton()).not.toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useId, useMemo, useState } from 'react'
|
||||
import { FolderPlus, Loader2, Search } from 'lucide-react'
|
||||
import { FolderPlus, KeyRound, Loader2, Search } from 'lucide-react'
|
||||
import { DialogHeader, DialogShell, DialogTile, NEUTRAL_TINT } from '../../shared/DialogShell'
|
||||
import { useTranslation } from '../../../i18n/TranslationContext'
|
||||
import type { DocSyncConnection, useDocSync } from './useDocSync'
|
||||
@@ -22,6 +22,7 @@ export default function DocSyncScopeModal({
|
||||
sync,
|
||||
onClose,
|
||||
onBound,
|
||||
onEditConnection,
|
||||
}: {
|
||||
connection: DocSyncConnection
|
||||
providerName: string
|
||||
@@ -30,6 +31,8 @@ export default function DocSyncScopeModal({
|
||||
sync: ReturnType<typeof useDocSync>
|
||||
onClose: () => void
|
||||
onBound: () => void
|
||||
/** Back to the stored connection, to change the login or remove it before choosing a folder. */
|
||||
onEditConnection?: () => void
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
const labelId = useId()
|
||||
@@ -63,7 +66,19 @@ export default function DocSyncScopeModal({
|
||||
)}
|
||||
>
|
||||
<div className="space-y-4">
|
||||
<p className="text-caption text-content-muted">{t('docsync.scope.intro')}</p>
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<p className="text-caption text-content-muted">{t('docsync.scope.intro')}</p>
|
||||
{onEditConnection && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onEditConnection}
|
||||
className="flex shrink-0 items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1 text-caption font-medium text-content-secondary transition-colors hover:bg-surface-hover"
|
||||
>
|
||||
<KeyRound size={13} />
|
||||
{t('docsync.connection.edit')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="rounded-xl border border-edge bg-surface-secondary p-3">
|
||||
<span className="mb-2 block text-body font-medium text-content">{t('docsync.scope.createTitle')}</span>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// FE-DOCSYNC-HOOK-001 to FE-DOCSYNC-HOOK-030
|
||||
// FE-DOCSYNC-HOOK-001 to FE-DOCSYNC-HOOK-032
|
||||
|
||||
/**
|
||||
* The document-sync hook.
|
||||
@@ -22,6 +22,7 @@ const testConnectionApi = vi.fn(async (_tripId: number | string, _data: unknown)
|
||||
const updateLinkApi = vi.fn(async (_tripId: number | string, _linkId: number, _patch: unknown): Promise<unknown> => ({}))
|
||||
const syncNowApi = vi.fn(async (_tripId: number | string, _linkId: number, _full: boolean): Promise<unknown> => ({}))
|
||||
const listScopesApi = vi.fn(async (_tripId: number | string, _connectionId: number, _q?: string): Promise<unknown> => ({ scopes: [] }))
|
||||
const deleteConnectionApi = vi.fn(async (_tripId: number | string, _id: number): Promise<unknown> => ({ success: true }))
|
||||
const resolveApi = vi.fn(async (_tripId: number | string, _itemId: number, _keep: string): Promise<unknown> => ({ success: true }))
|
||||
|
||||
vi.mock('../../../api/client', async (importOriginal) => {
|
||||
@@ -40,6 +41,7 @@ vi.mock('../../../api/client', async (importOriginal) => {
|
||||
syncNow: (tripId: number | string, linkId: number, full: boolean) => syncNowApi(tripId, linkId, full),
|
||||
listScopes: (tripId: number | string, connectionId: number, q?: string) => listScopesApi(tripId, connectionId, q),
|
||||
resolve: (tripId: number | string, itemId: number, keep: string) => resolveApi(tripId, itemId, keep),
|
||||
deleteConnection: (tripId: number | string, id: number) => deleteConnectionApi(tripId, id),
|
||||
},
|
||||
}
|
||||
})
|
||||
@@ -126,6 +128,7 @@ beforeEach(() => {
|
||||
syncNowApi.mockResolvedValue({ state: 'ok', pulled: 0, pushed: 0, conflicts: 0, missing: 0 })
|
||||
listScopesApi.mockResolvedValue({ scopes: [] })
|
||||
resolveApi.mockResolvedValue({ success: true })
|
||||
deleteConnectionApi.mockResolvedValue({ success: true })
|
||||
})
|
||||
|
||||
describe('useDocSync initial load', () => {
|
||||
@@ -471,6 +474,38 @@ describe('useDocSync resolveConflict', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('useDocSync removeConnection', () => {
|
||||
it('FE-DOCSYNC-HOOK-031: forgets the connection and reloads, so its bindings leave the screen too', async () => {
|
||||
const { result } = await mountLoaded()
|
||||
expect(result.current.links).toHaveLength(1)
|
||||
// The server drops the bindings with the connection (ON DELETE CASCADE).
|
||||
listConnectionsApi.mockResolvedValue([])
|
||||
listLinksApi.mockResolvedValue([])
|
||||
|
||||
let ok: boolean | undefined
|
||||
await act(async () => { ok = await result.current.removeConnection(9) })
|
||||
|
||||
expect(ok).toBe(true)
|
||||
expect(deleteConnectionApi).toHaveBeenCalledWith(TRIP, 9)
|
||||
expect(result.current.connectionFor('nextcloud')).toBeNull()
|
||||
expect(result.current.links).toEqual([])
|
||||
expect(result.current.busy).toBeNull()
|
||||
})
|
||||
|
||||
it('FE-DOCSYNC-HOOK-032: a refused removal keeps everything and says why', async () => {
|
||||
deleteConnectionApi.mockRejectedValueOnce({ response: { status: 403, data: { error: 'forbidden' } } })
|
||||
const { result } = await mountLoaded()
|
||||
|
||||
let ok: boolean | undefined
|
||||
await act(async () => { ok = await result.current.removeConnection(9) })
|
||||
|
||||
expect(ok).toBe(false)
|
||||
expect(result.current.error).toBe('forbidden')
|
||||
expect(result.current.connectionFor('nextcloud')).not.toBeNull()
|
||||
expect(result.current.busy).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('needsReauth', () => {
|
||||
it('FE-DOCSYNC-HOOK-030: reads a refused credential off either the state or the error code', () => {
|
||||
expect(needsReauth({ lastSyncState: 'needs_reauth', lastSyncError: null })).toBe(true)
|
||||
|
||||
@@ -264,6 +264,27 @@ export function useDocSync(tripId: number | string, enabled: boolean) {
|
||||
}
|
||||
}, [tripId, load])
|
||||
|
||||
/**
|
||||
* Forget a stored connection, and with it every binding of this trip that
|
||||
* runs through it. The documents stay on both sides; what goes is the
|
||||
* address and the login TREK kept for the store, which is the one thing a
|
||||
* person changing accounts or folders had no way to take back.
|
||||
*/
|
||||
const removeConnection = useCallback(async (connectionId: number) => {
|
||||
setBusy('connection')
|
||||
setError(null)
|
||||
try {
|
||||
await docsyncApi.deleteConnection(tripId, connectionId)
|
||||
await load()
|
||||
return true
|
||||
} catch (e: unknown) {
|
||||
setError(readError(e))
|
||||
return false
|
||||
} finally {
|
||||
setBusy(null)
|
||||
}
|
||||
}, [tripId, load])
|
||||
|
||||
/**
|
||||
* Probe without saving. Always resolves to a verdict object: the route
|
||||
* answers 200 even for an unreachable instance, because a form showing a typo
|
||||
@@ -427,7 +448,7 @@ export function useDocSync(tripId: number | string, enabled: boolean) {
|
||||
connections, links, itemCounts,
|
||||
loading, busy, error,
|
||||
connectionFor, load,
|
||||
saveConnection, testConnection,
|
||||
saveConnection, testConnection, removeConnection,
|
||||
loadScopes, createScope,
|
||||
createLink, updateLink, removeLink, syncNow, resolveConflict,
|
||||
}
|
||||
|
||||
@@ -485,6 +485,17 @@ describe('KategorieGruppe — inline add item', () => {
|
||||
expect(onAddItem).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('FE-W5CAT-028a: Enter on the first item typed into the placeholder row opens the add field (#2825)', async () => {
|
||||
server.use(http.put('/api/trips/1/packing/1', () => HttpResponse.json({ item: buildPackingItem({ id: 1, name: 'Tent', category: 'Gear' }) })))
|
||||
setup({ items: [buildPackingItem({ id: 1, name: '...', category: 'Gear' })] })
|
||||
|
||||
fireEvent.click(screen.getByText('...'))
|
||||
fireEvent.change(screen.getByPlaceholderText('...'), { target: { value: 'Tent' } })
|
||||
fireEvent.keyDown(screen.getByPlaceholderText('...'), { key: 'Enter' })
|
||||
|
||||
await waitFor(() => expect(screen.getByPlaceholderText('Item name...')).toHaveFocus())
|
||||
})
|
||||
|
||||
it('FE-W5CAT-028: the confirm button adds the item, and stays inert while empty', () => {
|
||||
const onAddItem = vi.fn(async () => {})
|
||||
const { container } = setup({ onAddItem })
|
||||
|
||||
@@ -86,6 +86,7 @@ export function KategorieGruppe({ kategorie, items, tripId, allCategories, onRen
|
||||
const [showAddItem, setShowAddItem] = useState(false)
|
||||
const [newItemName, setNewItemName] = useState('')
|
||||
const addItemRef = useRef<HTMLInputElement>(null)
|
||||
const openAddItem = () => { setShowAddItem(true); setTimeout(() => addItemRef.current?.focus(), 30) }
|
||||
const menuBtnRef = useRef<HTMLButtonElement>(null)
|
||||
const assigneeDropdownRef = useRef<HTMLDivElement>(null)
|
||||
const { togglePackingItem } = useTripStore()
|
||||
@@ -292,7 +293,7 @@ export function KategorieGruppe({ kategorie, items, tripId, allCategories, onRen
|
||||
const contributions = contribFor(item.id)
|
||||
return (
|
||||
<React.Fragment key={item.id}>
|
||||
<ArtikelZeile item={item} tripId={tripId} categories={allCategories} onCategoryChange={() => {}} onDelete={onDeleteItem} bagTrackingEnabled={bagTrackingEnabled} bags={bags} onCreateBag={onCreateBag} canEdit={canEdit} divider={index > 0}
|
||||
<ArtikelZeile item={item} tripId={tripId} categories={allCategories} onCategoryChange={() => {}} onDelete={onDeleteItem} onPlaceholderFilled={openAddItem} bagTrackingEnabled={bagTrackingEnabled} bags={bags} onCreateBag={onCreateBag} canEdit={canEdit} divider={index > 0}
|
||||
tripMembers={tripMembers} currentUserId={currentUserId} onSetSharing={onSetSharing} onClone={onClone} onJoin={onJoin} onLeave={onLeave}
|
||||
drag={canEdit && reorderable ? {
|
||||
isDragging: dragId === item.id,
|
||||
@@ -343,7 +344,7 @@ export function KategorieGruppe({ kategorie, items, tripId, allCategories, onRen
|
||||
// A row of its own on a faint tint, so it closes the card instead
|
||||
// of trailing off: a dashed box in the checkbox column (past the drag
|
||||
// grip's width) and the label where an item's name sits.
|
||||
<button type="button" onClick={() => { setShowAddItem(true); setTimeout(() => addItemRef.current?.focus(), 30) }}
|
||||
<button type="button" onClick={openAddItem}
|
||||
style={{ display: 'flex', alignItems: 'center', gap: 9, width: 'calc(100% - 8px)', margin: '6px 4px 0', paddingBlock: 8, paddingInlineEnd: 10, paddingInlineStart: 28, borderRadius: 10, border: 'none', background: 'var(--bg-secondary)', cursor: 'pointer', fontSize: 'calc(13px * var(--fs-scale-body, 1))', fontWeight: 500, color: 'var(--text-faint)', fontFamily: 'inherit', textAlign: 'start' }}
|
||||
onMouseEnter={e => e.currentTarget.style.color = 'var(--text-secondary)'}
|
||||
onMouseLeave={e => e.currentTarget.style.color = 'var(--text-faint)'}>
|
||||
|
||||
@@ -257,6 +257,23 @@ describe('ArtikelZeile — renaming', () => {
|
||||
await waitFor(() => expect(screen.getByText('...')).toBeInTheDocument())
|
||||
})
|
||||
|
||||
it('FE-W5ROW-008b: Enter on a filled placeholder row hands the typing on, a blur does not (#2825)', async () => {
|
||||
server.use(http.put('/api/trips/1/packing/1', () => HttpResponse.json({ item: buildPackingItem({ id: 1, name: 'Tent' }) })))
|
||||
const onPlaceholderFilled = vi.fn()
|
||||
setup({ item: buildPackingItem({ id: 1, name: '...', category: 'Gear' }), onPlaceholderFilled })
|
||||
|
||||
fireEvent.click(screen.getByText('...'))
|
||||
fireEvent.change(screen.getByPlaceholderText('...'), { target: { value: 'Tent' } })
|
||||
fireEvent.blur(screen.getByPlaceholderText('...'))
|
||||
await waitFor(() => expect(screen.queryByPlaceholderText('...')).toBeNull())
|
||||
expect(onPlaceholderFilled).not.toHaveBeenCalled()
|
||||
|
||||
fireEvent.click(screen.getByText('...'))
|
||||
fireEvent.change(screen.getByPlaceholderText('...'), { target: { value: 'Tent' } })
|
||||
fireEvent.keyDown(screen.getByPlaceholderText('...'), { key: 'Enter' })
|
||||
await waitFor(() => expect(onPlaceholderFilled).toHaveBeenCalledTimes(1))
|
||||
})
|
||||
|
||||
it('FE-W5ROW-009: a failing rename surfaces a save error', async () => {
|
||||
server.use(http.put('/api/trips/1/packing/1', () => new HttpResponse(null, { status: 500 })))
|
||||
setup()
|
||||
|
||||
@@ -25,6 +25,8 @@ interface ArtikelZeileProps {
|
||||
categories: string[]
|
||||
onCategoryChange: () => void
|
||||
onDelete?: (item: PackingItem) => Promise<void>
|
||||
/** Enter on the filled '...' row, so the category's add field can take over the typing (#2825). */
|
||||
onPlaceholderFilled?: () => void
|
||||
bagTrackingEnabled?: boolean
|
||||
bags?: PackingBag[]
|
||||
onCreateBag: (name: string) => Promise<PackingBag | undefined>
|
||||
@@ -49,7 +51,7 @@ interface ArtikelZeileProps {
|
||||
}
|
||||
}
|
||||
|
||||
export function ArtikelZeile({ item, tripId, categories, onCategoryChange: _onCategoryChange, onDelete, bagTrackingEnabled, bags = [], onCreateBag, canEdit = true, tripMembers = [], currentUserId, onSetSharing, onClone, onJoin, onLeave, divider = false, drag }: ArtikelZeileProps) {
|
||||
export function ArtikelZeile({ item, tripId, categories, onCategoryChange: _onCategoryChange, onDelete, onPlaceholderFilled, bagTrackingEnabled, bags = [], onCreateBag, canEdit = true, tripMembers = [], currentUserId, onSetSharing, onClone, onJoin, onLeave, divider = false, drag }: ArtikelZeileProps) {
|
||||
const isPlaceholder = item.name === PACKING_PLACEHOLDER_NAME
|
||||
const [editing, setEditing] = useState(false)
|
||||
const [editName, setEditName] = useState(isPlaceholder ? '' : item.name)
|
||||
@@ -80,9 +82,12 @@ export function ArtikelZeile({ item, tripId, categories, onCategoryChange: _onCa
|
||||
|
||||
const handleToggle = () => togglePackingItem(tripId, item.id, !item.checked)
|
||||
|
||||
const handleSaveName = async () => {
|
||||
const handleSaveName = async (viaEnter = false) => {
|
||||
if (!editName.trim()) { setEditing(false); setEditName(isPlaceholder ? '' : item.name); return }
|
||||
try { await updatePackingItem(tripId, item.id, { name: editName.trim() }); setEditing(false) }
|
||||
try {
|
||||
await updatePackingItem(tripId, item.id, { name: editName.trim() }); setEditing(false)
|
||||
if (viaEnter && isPlaceholder) onPlaceholderFilled?.()
|
||||
}
|
||||
catch { toast.error(t('packing.toast.saveError')) }
|
||||
}
|
||||
|
||||
@@ -188,8 +193,8 @@ export function ArtikelZeile({ item, tripId, categories, onCategoryChange: _onCa
|
||||
type="text" value={editName} autoFocus
|
||||
placeholder={isPlaceholder ? '...' : undefined}
|
||||
onChange={e => setEditName(e.target.value)}
|
||||
onBlur={handleSaveName}
|
||||
onKeyDown={e => { if (e.key === 'Enter') void handleSaveName(); if (e.key === 'Escape') { setEditing(false); setEditName(isPlaceholder ? '' : item.name) } }}
|
||||
onBlur={() => void handleSaveName()}
|
||||
onKeyDown={e => { if (e.key === 'Enter') void handleSaveName(true); if (e.key === 'Escape') { setEditing(false); setEditName(isPlaceholder ? '' : item.name) } }}
|
||||
style={{ flex: 1, minWidth: 0, fontSize: 'calc(13.5px * var(--fs-scale-body, 1))', padding: '2px 8px', borderRadius: 6, border: '1px solid var(--border-primary)', outline: 'none', fontFamily: 'inherit' }}
|
||||
/>
|
||||
) : canEdit ? (
|
||||
|
||||
@@ -803,6 +803,34 @@ describe('useRoadtripRoutes', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('FE-ROADTRIP-ROUTES-052: a join this device routed before is not paced like a request (#2794)', async () => {
|
||||
// A join kept its request slot whatever answered it, so a month of connected days
|
||||
// waited half a minute on every open with every road already on the device. The
|
||||
// clock is held still, so every answer reads as one from the cache; a join that
|
||||
// still waited its turn would wait 1.1 s of real time, past what waitFor gives it.
|
||||
const clock = vi.spyOn(performance, 'now').mockImplementation(() => 10_000)
|
||||
try {
|
||||
const MUNICH: [number, number] = [48.1374, 11.5755]
|
||||
const INNSBRUCK: [number, number] = [47.2692, 11.4041]
|
||||
const BOZEN: [number, number] = [46.4983, 11.3548]
|
||||
setting({ roadtrip_connect_days: true })
|
||||
const daysList = [day(1, 1), day(2, 2), day(3, 3)]
|
||||
const assignments = {
|
||||
...map(1, [{ id: 1, at: HAMBURG, time: '09:00' }, { id: 2, at: LUENEBURG }]),
|
||||
...map(2, [{ id: 3, at: BERLIN, time: '09:00' }, { id: 4, at: MUNICH }]),
|
||||
...map(3, [{ id: 5, at: INNSBRUCK, time: '09:00' }, { id: 6, at: BOZEN }]),
|
||||
} as AssignmentsMap
|
||||
renderHook(() => useRoadtripRoutes(7, daysList, assignments))
|
||||
|
||||
await waitFor(() => {
|
||||
expect(askedFor(LUENEBURG, BERLIN)).toHaveLength(1)
|
||||
expect(askedFor(MUNICH, INNSBRUCK)).toHaveLength(1)
|
||||
})
|
||||
} finally {
|
||||
clock.mockRestore()
|
||||
}
|
||||
})
|
||||
|
||||
it('FE-ROADTRIP-ROUTES-051: a join OSRM answered in the engine’s place is drawn, flagged, and asked for again on request', async () => {
|
||||
// Filed like any answer, it stood in for the weighed road until the page was loaded
|
||||
// again, and a picker on it read the stand-in line as the road already taken.
|
||||
|
||||
@@ -692,11 +692,19 @@ export function useRoadtripRoutes(
|
||||
* for both, so a choice being checked cannot fire into the gap a seam is keeping.
|
||||
*/
|
||||
const lastSpacedRequestAt = useRef(0)
|
||||
/** Waits until the gap since the last such request is kept, then claims the next slot. */
|
||||
const spacedRequest = useCallback(async (signal: AbortSignal): Promise<void> => {
|
||||
/**
|
||||
* Waits until the gap since the last such request is kept, then claims the next slot.
|
||||
* Hands back what gives the slot up again, for a request the cache answered.
|
||||
*/
|
||||
const spacedRequest = useCallback(async (signal: AbortSignal): Promise<() => void> => {
|
||||
const since = performance.now() - lastSpacedRequestAt.current
|
||||
if (since < REQUEST_SPACING_MS) await sleep(REQUEST_SPACING_MS - since, signal)
|
||||
if (!signal.aborted) lastSpacedRequestAt.current = performance.now()
|
||||
const before = lastSpacedRequestAt.current
|
||||
const claimed = performance.now()
|
||||
if (!signal.aborted) lastSpacedRequestAt.current = claimed
|
||||
return () => {
|
||||
if (lastSpacedRequestAt.current === claimed) lastSpacedRequestAt.current = before
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
@@ -727,7 +735,7 @@ export function useRoadtripRoutes(
|
||||
// shared routing hosts answered the tail with 429, and a refused seam
|
||||
// writes no state, so nothing changed to make the effect try again: the
|
||||
// map drew the trip in pieces and the totals came back short.
|
||||
await spacedRequest(controller.signal)
|
||||
const release = await spacedRequest(controller.signal)
|
||||
if (controller.signal.aborted) return
|
||||
try {
|
||||
// The via points on this seam, threaded in the same way the day runs thread
|
||||
@@ -735,6 +743,7 @@ export function useRoadtripRoutes(
|
||||
// shape: it is asked for on its own, so the points the traveller dropped on it
|
||||
// never reached the router and dragging one did visibly nothing.
|
||||
const shaping = viasOnLeg(seam.from, seam.to, viasByDay[seam.from.ownerDayId] ?? [])
|
||||
const startedAt = performance.now()
|
||||
const r = await calculateRouteWithLegs(
|
||||
[
|
||||
{ lat: seam.from.lat, lng: seam.from.lng },
|
||||
@@ -743,6 +752,10 @@ export function useRoadtripRoutes(
|
||||
],
|
||||
{ signal: controller.signal, profile: mode, tripId: tripId ?? null, dayId: seam.dayId, avoid },
|
||||
)
|
||||
// A seam this device routed before came back from its cache and went nowhere, so
|
||||
// its slot goes back before the store below re-runs this effect. Holding it made a
|
||||
// trip of connected days wait a second per join on every open (#2794).
|
||||
if (performance.now() - startedAt <= CACHE_HIT_MS) release()
|
||||
if (controller.signal.aborted) return
|
||||
// One leg per waypoint PAIR, so a shaped seam comes back in pieces and the rail
|
||||
// wants the whole drive: merged here, exactly as a day run folds its via legs
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// FE-DOCSYNC-MOBILE-001 to FE-DOCSYNC-MOBILE-024
|
||||
// FE-DOCSYNC-MOBILE-001 to FE-DOCSYNC-MOBILE-027
|
||||
import type { ComponentProps } from 'react'
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { render, screen, fireEvent, waitFor, within } from '../../../../../tests/helpers/render'
|
||||
@@ -137,6 +137,12 @@ beforeEach(() => {
|
||||
vi.spyOn(docsyncApi, 'createLink').mockResolvedValue({})
|
||||
vi.spyOn(docsyncApi, 'items').mockResolvedValue([])
|
||||
vi.spyOn(docsyncApi, 'resolve').mockResolvedValue({ success: true })
|
||||
vi.spyOn(docsyncApi, 'deleteConnection').mockImplementation(async (_tripId, id) => {
|
||||
// The bindings go with their connection, as ON DELETE CASCADE has it.
|
||||
connections = connections.filter(c => c.id !== id)
|
||||
links = links.filter(l => l.connectionId !== id)
|
||||
return { success: true }
|
||||
})
|
||||
})
|
||||
|
||||
/** The status route with a number of conflicts on it, holdings as usual. */
|
||||
@@ -528,3 +534,45 @@ describe('MDocSyncSheet: what a member may do', () => {
|
||||
expect(screen.queryByRole('button', { name: /Papra/ })).not.toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
describe('MDocSyncSheet: the stored connection', () => {
|
||||
const removeButtons = () => screen.getAllByRole('button', { name: 'Remove connection' })
|
||||
|
||||
it('FE-DOCSYNC-MOBILE-025: a binding opens its connection at any time, and removing it asks first', async () => {
|
||||
renderSheet()
|
||||
await openDetail()
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Edit connection' }))
|
||||
expect(await screen.findByPlaceholderText('https://paperless.example')).toHaveValue('https://paperless.example')
|
||||
|
||||
fireEvent.click(removeButtons()[0])
|
||||
expect(docsyncApi.deleteConnection).not.toHaveBeenCalled()
|
||||
expect(await screen.findByText(/TREK forgets the address and login/)).toBeInTheDocument()
|
||||
// The confirmation sheet opens over the form, so its button is the last one of that name.
|
||||
const named = removeButtons()
|
||||
fireEvent.click(named[named.length - 1])
|
||||
|
||||
await waitFor(() => expect(docsyncApi.deleteConnection).toHaveBeenCalledWith(TRIP_ID, 5))
|
||||
// Back at the list, with Paperless offered again from scratch.
|
||||
expect(await screen.findByText('Connect a provider')).toBeInTheDocument()
|
||||
expect(screen.queryByRole('button', { name: 'Sync now' })).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-DOCSYNC-MOBILE-026: a stored connection without a binding can be edited from the folder picker', async () => {
|
||||
renderSheet()
|
||||
fireEvent.click(await screen.findByRole('button', { name: /Nextcloud/ }))
|
||||
await screen.findByText('Photos')
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Edit connection' }))
|
||||
|
||||
expect(await screen.findByRole('button', { name: 'Remove connection' })).toBeInTheDocument()
|
||||
expect(screen.getByRole('button', { name: 'Save' })).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-DOCSYNC-MOBILE-027: a member sees no way to the connection', async () => {
|
||||
renderSheet({ canManage: false })
|
||||
await openDetail()
|
||||
|
||||
expect(screen.queryByRole('button', { name: 'Edit connection' })).not.toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import {
|
||||
ArrowLeft, ArrowRight, Check, ChevronLeft, ChevronRight, FolderPlus, FolderSync, KeyRound, Link2Off,
|
||||
Loader2, Plus, RefreshCw,
|
||||
Loader2, Plus, RefreshCw, Trash2,
|
||||
} from 'lucide-react'
|
||||
import MSheet from '../../../components/MSheet'
|
||||
import MIconBtn from '../../../components/MIconBtn'
|
||||
@@ -149,6 +149,7 @@ export default function MDocSyncSheet({
|
||||
provider={pending}
|
||||
sync={sync}
|
||||
onDone={connected}
|
||||
onRemoved={() => { setReconnectFor(null); setPending(null); setView('list') }}
|
||||
/>
|
||||
) : view === 'scope' && pending && sync.connectionFor(pending.id) ? (
|
||||
<ScopeView
|
||||
@@ -156,6 +157,7 @@ export default function MDocSyncSheet({
|
||||
suggestedName={slugFor(tripTitle, tripId)}
|
||||
sync={sync}
|
||||
onBound={() => setView('list')}
|
||||
onEditConnection={() => setView('connect')}
|
||||
/>
|
||||
) : view === 'detail' && link ? (
|
||||
<DetailView
|
||||
@@ -417,6 +419,19 @@ function DetailView({
|
||||
</button>
|
||||
</SettingRow>
|
||||
|
||||
{onReconnect && (
|
||||
<SettingRow label={t('docsync.connection.title')} hint={t('docsync.connection.hint')}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onReconnect}
|
||||
className="flex items-center gap-1.5 rounded-full bg-[color:var(--m-ic)] px-3 py-[6px] font-geist text-caption font-bold text-m-ink"
|
||||
>
|
||||
<KeyRound size={12} strokeWidth={2.2} />
|
||||
{t('docsync.connection.edit')}
|
||||
</button>
|
||||
</SettingRow>
|
||||
)}
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={onUnlink}
|
||||
@@ -443,14 +458,18 @@ function ConnectView({
|
||||
provider,
|
||||
sync,
|
||||
onDone,
|
||||
onRemoved,
|
||||
}: {
|
||||
provider: DocSyncProvider
|
||||
sync: ReturnType<typeof useDocSync>
|
||||
onDone: () => void
|
||||
onRemoved: () => void
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
const form = useConnectForm(provider, sync.connectionFor(provider.id), sync)
|
||||
const existing = sync.connectionFor(provider.id)
|
||||
const form = useConnectForm(provider, existing, sync)
|
||||
const [verdict, setVerdict] = useState<DocSyncVerdict | null>(null)
|
||||
const [confirmRemove, setConfirmRemove] = useState(false)
|
||||
|
||||
return (
|
||||
<div className="mt-3 flex flex-col gap-3">
|
||||
@@ -534,6 +553,32 @@ function ConnectView({
|
||||
{sync.busy === 'save' ? <Loader2 size={15} className="mx-auto animate-spin" /> : t('common.save')}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{existing && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setConfirmRemove(true)}
|
||||
disabled={sync.busy === 'connection'}
|
||||
className="flex h-11 w-full items-center justify-center gap-2 rounded-2xl border border-[color:var(--m-rowbr)] text-body font-bold text-[color:var(--m-st-danger)] disabled:opacity-50"
|
||||
>
|
||||
<Trash2 size={15} strokeWidth={2.2} />
|
||||
{t('docsync.connection.remove')}
|
||||
</button>
|
||||
)}
|
||||
|
||||
<MConfirmSheet
|
||||
open={confirmRemove}
|
||||
onClose={() => setConfirmRemove(false)}
|
||||
title={t('docsync.connection.remove')}
|
||||
message={t('docsync.connection.confirmRemove')}
|
||||
confirmLabel={t('docsync.connection.remove')}
|
||||
cancelLabel={t('common.cancel')}
|
||||
danger
|
||||
onConfirm={() => {
|
||||
setConfirmRemove(false)
|
||||
if (existing) void sync.removeConnection(existing.id).then(ok => { if (ok) onRemoved() })
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -544,11 +589,14 @@ function ScopeView({
|
||||
suggestedName,
|
||||
sync,
|
||||
onBound,
|
||||
onEditConnection,
|
||||
}: {
|
||||
connectionId: number
|
||||
suggestedName: string
|
||||
sync: ReturnType<typeof useDocSync>
|
||||
onBound: () => void
|
||||
/** Back to the stored connection, to change the login or remove it before choosing a folder. */
|
||||
onEditConnection: () => void
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
const { scopes, error, name, setName, working, bind, createAndBind } = useScopePicker({
|
||||
@@ -562,6 +610,15 @@ function ScopeView({
|
||||
<div className="mt-3 flex flex-col gap-3">
|
||||
<p className="font-geist text-[0.71875rem] leading-snug text-m-muted">{t('docsync.scope.intro')}</p>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={onEditConnection}
|
||||
className="flex h-9 items-center justify-center gap-1.5 self-start rounded-full bg-[color:var(--m-ic)] px-3 font-geist text-caption font-bold text-m-ink"
|
||||
>
|
||||
<KeyRound size={12} strokeWidth={2.2} />
|
||||
{t('docsync.connection.edit')}
|
||||
</button>
|
||||
|
||||
<div className="flex gap-2">
|
||||
<input
|
||||
value={name}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
// Build server/assets/airports.json from OurAirports (davidmegginson.github.io/ourairports-data).
|
||||
// License: Public Domain. Keeps large/medium airports with an IATA code; timezone derived from coords via tz-lookup.
|
||||
// License: Public Domain. Keeps large/medium airports with an IATA code, small ones only with scheduled service;
|
||||
// timezone derived from coords via tz-lookup.
|
||||
import fs from 'node:fs';
|
||||
import https from 'node:https';
|
||||
import path from 'node:path';
|
||||
@@ -91,7 +92,9 @@ for (let i = 1; i < rows.length; i++) {
|
||||
if (!KEEP.has(r[TYPE])) continue;
|
||||
const iata = r[IATA]?.trim().toUpperCase();
|
||||
if (!iata || iata.length !== 3) continue;
|
||||
if (r[SERVICE] !== 'yes') continue;
|
||||
// The scheduled_service flag lags reality: Little Cayman (LYB) has daily flights and is
|
||||
// marked "no". So it only filters the small fields, where it keeps every airstrip with a code out.
|
||||
if (r[TYPE] === 'small_airport' && r[SERVICE] !== 'yes') continue;
|
||||
const lat = Number(r[LAT]);
|
||||
const lng = Number(r[LNG]);
|
||||
if (!Number.isFinite(lat) || !Number.isFinite(lng)) continue;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"src/nest/budget/budget.mcp.ts": 36,
|
||||
"src/nest/collab/collab.mcp.ts": 20,
|
||||
"src/nest/collections/collections.mcp.ts": 14,
|
||||
"src/nest/day-notes/day-notes.mcp.ts": 10,
|
||||
"src/nest/day-notes/day-notes.mcp.ts": 6,
|
||||
"src/nest/days/days.mcp.ts": 2,
|
||||
"src/nest/doc-sync/doc-sync.mcp.ts": 1,
|
||||
"src/nest/files/files.mcp.ts": 4,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"scripts/db-call-graph.mjs": 1036,
|
||||
"scripts/generate-entities.ts": 2259,
|
||||
"src/db/repositories/Places.repository.ts": 1439,
|
||||
"src/db/repositories/Places.repository.ts": 1438,
|
||||
"src/db/repositories/Reservations.repository.ts": 1604,
|
||||
"src/db/repositories/Trips.repository.ts": 1121,
|
||||
"src/db/repositories/Users.repository.ts": 1445,
|
||||
|
||||
@@ -605,16 +605,15 @@ export class PlacesRepository extends TrekRepository<Places> {
|
||||
* it was.
|
||||
*/
|
||||
async listDedupInputs(trip_id: string): Promise<{
|
||||
name: string | null; lat: number | null; lng: number | null;
|
||||
name: string | null; lat: number | null; lng: number | null; route_geometry: string | null;
|
||||
google_place_id: string | null; google_ftid: string | null; osm_id: string | null; amap_poi_id: string | null;
|
||||
}[]> {
|
||||
// route_geometry tells a track from a pin: a track to import matches only tracks (#2810).
|
||||
return this.qb('p')
|
||||
.select(['p.name', 'p.lat', 'p.lng', 'p.google_place_id', 'p.google_ftid', 'p.osm_id', 'p.amap_poi_id'])
|
||||
.select(['p.name', 'p.lat', 'p.lng', 'p.route_geometry',
|
||||
'p.google_place_id', 'p.google_ftid', 'p.osm_id', 'p.amap_poi_id'])
|
||||
.where('p.trip_id = ?', [trip_id])
|
||||
.execute<{
|
||||
name: string | null; lat: number | null; lng: number | null;
|
||||
google_place_id: string | null; google_ftid: string | null; osm_id: string | null; amap_poi_id: string | null;
|
||||
}[]>('all', false);
|
||||
.execute<Awaited<ReturnType<PlacesRepository['listDedupInputs']>>>('all', false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,11 +59,21 @@ export async function refusalOf(kind: AiConnectionKind, res: Response): Promise<
|
||||
// refusal the provider's own code already explains (a plan that does not cover it) keeps that code.
|
||||
const image = namesImageInput(res.status, body) && providerFailure(kind, res.status, named).code === 'generic';
|
||||
const code = image ? IMAGE_INPUT_REFUSED : named;
|
||||
// Status and code only: an error body can quote the request, and the request holds the trip.
|
||||
logWarn(`[ai] ${kind} refused the request: HTTP ${res.status}${code ? ` (${code})` : ''}`);
|
||||
// Status, code and the refused field's path only: an error message can quote the request, and the
|
||||
// request holds the trip. The path alone says which part of a replayed conversation the provider refused.
|
||||
const param = refusedParamOf(body);
|
||||
logWarn(
|
||||
`[ai] ${kind} refused the request: HTTP ${res.status}${code ? ` (${code})` : ''}${param ? ` at ${param}` : ''}`,
|
||||
);
|
||||
return providerFailure(kind, res.status, code);
|
||||
}
|
||||
|
||||
/** The field an error body names as refused (OpenAI's `param`, such as `input[12]`), when it is a bare path. */
|
||||
function refusedParamOf(body: unknown): string | undefined {
|
||||
const param = asRecord(asRecord(body).error).param;
|
||||
return typeof param === 'string' && /^[\w.[\]-]{1,80}$/.test(param) ? param : undefined;
|
||||
}
|
||||
|
||||
/** One SSE data payload as a JSON object; null for anything else (a `[DONE]`, a keepalive). */
|
||||
export function parseEventData(data: string): Record<string, unknown> | null {
|
||||
try {
|
||||
|
||||
@@ -9,6 +9,7 @@ import { fitToSize } from './assistant-output';
|
||||
import {
|
||||
ADD_FOUND_PLACE_TOOL,
|
||||
APPROVAL_TTL_MS,
|
||||
ASSISTANT_MODEL_CALLED_SERVER_TOOLS,
|
||||
ASSISTANT_SERVER_TOOLS,
|
||||
IMPORT_BOOKING_TOOL,
|
||||
IMPORT_TOUR_FILE_TOOL,
|
||||
@@ -190,13 +191,6 @@ function earlierCut(text: string, earlier: boolean): string {
|
||||
: text;
|
||||
}
|
||||
|
||||
/**
|
||||
* The model's own calls on attached files: told after the step that made
|
||||
* them, so the history ends on the user's side when the user's decision on
|
||||
* them goes on.
|
||||
*/
|
||||
const ATTACHED_FILE_TOOLS: ReadonlySet<string> = new Set([READ_ATTACHED_FILE_TOOL, KEEP_ATTACHED_FILE_TOOL]);
|
||||
|
||||
/** What became of keeping an attached file in Files, as its stored part says. */
|
||||
function keptFileLine(part: ToolCallPart): string {
|
||||
const file = quoted(part.args.name);
|
||||
@@ -234,30 +228,31 @@ function attachedReadLine(
|
||||
}
|
||||
|
||||
/**
|
||||
* What the model is told of its reads of attached files in one step: the
|
||||
* text of each file the user let it read, the first time the history holds
|
||||
* it (`told` keeps track), and what became of a read the user did not allow.
|
||||
* `texts` are the shared files' texts, by attachment id; one no longer there
|
||||
* was swept with its file.
|
||||
* The answer a replayed call gets: what became of an attached file (the text
|
||||
* of a file the user let it read, the first time the history holds it, `told`
|
||||
* keeping track; `texts` are the shared files' texts by attachment id), "not
|
||||
* applied" for a held change that never ran, the stored result otherwise.
|
||||
*/
|
||||
function attachedReadNote(
|
||||
calls: readonly ToolCallPart[],
|
||||
function replayedOutput(
|
||||
part: ToolCallPart,
|
||||
texts: ReadonlyMap<string, string>,
|
||||
told: Set<string>,
|
||||
earlier: boolean,
|
||||
): string {
|
||||
return calls
|
||||
.map((part) =>
|
||||
part.toolName === KEEP_ATTACHED_FILE_TOOL ? keptFileLine(part) : attachedReadLine(part, texts, told, earlier),
|
||||
)
|
||||
.join('\n\n');
|
||||
if (part.toolName === KEEP_ATTACHED_FILE_TOOL) return keptFileLine(part);
|
||||
if (part.toolName === READ_ATTACHED_FILE_TOOL) return attachedReadLine(part, texts, told, earlier);
|
||||
if (part.result === undefined) return NOT_APPLIED;
|
||||
return outputText(earlier ? fitToSize(part.result, EARLIER_TOOL_OUTPUT_CHARS) : part.result);
|
||||
}
|
||||
|
||||
/**
|
||||
* The thread as the provider reads it, oldest first, from its first user
|
||||
* message on. A step's tool calls are followed by their answers; a held
|
||||
* change that was never applied answers that it was not, since every call
|
||||
* must be answered. `providerIds` maps a held call's own id to the id the
|
||||
* must be answered. That includes the server's tools the model called itself
|
||||
* (a trip note, an attached file): the providers that replay their own record
|
||||
* of a step refuse it with a call left unanswered, and every later message of
|
||||
* the thread with it. `providerIds` maps a held call's own id to the id the
|
||||
* provider gave it.
|
||||
*/
|
||||
export function toChatHistory(
|
||||
@@ -282,42 +277,31 @@ export function toChatHistory(
|
||||
(part): part is Extract<AssistantMessagePart, { type: 'tool-call' }> =>
|
||||
part.type === 'tool-call' && part.toolName !== ASSISTANT_WEB_SEARCH_STEP,
|
||||
);
|
||||
const reads = allCalls.filter((part) => ATTACHED_FILE_TOOLS.has(part.toolName));
|
||||
const serverCalls = allCalls.filter(
|
||||
(part) => ASSISTANT_SERVER_TOOLS.has(part.toolName) && !ATTACHED_FILE_TOOLS.has(part.toolName),
|
||||
);
|
||||
const serverStep = (part: ToolCallPart) =>
|
||||
ASSISTANT_SERVER_TOOLS.has(part.toolName) && !ASSISTANT_MODEL_CALLED_SERVER_TOOLS.has(part.toolName);
|
||||
// Told as the user's side of the conversation: the history then ends on it
|
||||
// when a decision on these bookings starts the next answer.
|
||||
if (serverCalls.length > 0) history.push({ role: 'user', text: serverStepsNote(serverCalls) });
|
||||
const calls = allCalls.filter((part) => !ASSISTANT_SERVER_TOOLS.has(part.toolName));
|
||||
const note = serverStepsNote(allCalls.filter(serverStep));
|
||||
if (note) history.push({ role: 'user', text: note });
|
||||
const calls = allCalls.filter((part) => !serverStep(part));
|
||||
const toolCalls: AiToolCall[] = calls.map((part) => ({
|
||||
id: providerIds.get(part.toolCallId) ?? part.toolCallId,
|
||||
name: part.toolName,
|
||||
args: part.args,
|
||||
}));
|
||||
const text = textOf(parts);
|
||||
// Told after the step that read the files, so the history ends on the user's side when a consent goes on.
|
||||
const readNote = reads.length > 0 ? attachedReadNote(reads, attachedTexts, told, earlier) : '';
|
||||
if (!text && toolCalls.length === 0) {
|
||||
if (readNote) history.push({ role: 'user', text: readNote });
|
||||
return;
|
||||
}
|
||||
if (!text && toolCalls.length === 0) return;
|
||||
const providerState = decodeJson(ASSISTANT_PROVIDER_STATE, row.provider_state, `message ${row.id}`);
|
||||
history.push({ role: 'assistant', text, toolCalls, providerState });
|
||||
calls.forEach((part, index) => {
|
||||
const output =
|
||||
part.result === undefined
|
||||
? NOT_APPLIED
|
||||
: outputText(earlier ? fitToSize(part.result, EARLIER_TOOL_OUTPUT_CHARS) : part.result);
|
||||
history.push({
|
||||
role: 'tool',
|
||||
toolCallId: toolCalls[index].id,
|
||||
name: part.toolName,
|
||||
output,
|
||||
output: replayedOutput(part, attachedTexts, told, earlier),
|
||||
...(part.isError ? { isError: true } : {}),
|
||||
});
|
||||
});
|
||||
if (readNote) history.push({ role: 'user', text: readNote });
|
||||
});
|
||||
return history;
|
||||
}
|
||||
|
||||
@@ -255,6 +255,18 @@ export const ASSISTANT_SERVER_TOOLS: ReadonlySet<string> = new Set([
|
||||
...Object.keys(ASSISTANT_SERVER_WRITE_TOOLS),
|
||||
]);
|
||||
|
||||
/**
|
||||
* The server's tools the model calls itself. TREK answers them, but they are
|
||||
* calls in the provider's own record of the step, so a replayed step has to
|
||||
* answer them like any other; the rest of the server's tools are steps the
|
||||
* server took, which the provider never saw.
|
||||
*/
|
||||
export const ASSISTANT_MODEL_CALLED_SERVER_TOOLS: ReadonlySet<string> = new Set([
|
||||
REMEMBER_TOOL,
|
||||
READ_ATTACHED_FILE_TOOL,
|
||||
KEEP_ATTACHED_FILE_TOOL,
|
||||
]);
|
||||
|
||||
/** The largest file the assistant reads. */
|
||||
export const MAX_ATTACHMENT_BYTES = 10 * 1024 * 1024;
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ const DESCRIBERS: Readonly<Record<string, Describer>> = {
|
||||
const dayId = id(args, 'dayId');
|
||||
const rows = new Rows()
|
||||
.add('day', dayLabel(ctx, dayId))
|
||||
.add('time', text(args.time))
|
||||
.add('content', text(args.time))
|
||||
.add('icon', text(args.icon))
|
||||
.add('color', text(args.color));
|
||||
return { subject: text(args.text), rows, dayId, placeIds: [] };
|
||||
@@ -203,8 +203,8 @@ const DESCRIBERS: Readonly<Record<string, Describer>> = {
|
||||
update_day_note: (ctx, args) => {
|
||||
const note = ctx.card.notes.get(id(args, 'noteId') ?? 0);
|
||||
const rows = new Rows();
|
||||
if (has(args, 'text')) rows.change('text', note?.text ?? null, text(args.text));
|
||||
if (has(args, 'time')) rows.change('time', note?.time ?? null, text(args.time));
|
||||
if (has(args, 'text')) rows.change('title', note?.text ?? null, text(args.text));
|
||||
if (has(args, 'time')) rows.change('content', note?.time ?? null, text(args.time));
|
||||
if (has(args, 'icon')) rows.change('icon', note?.icon ?? null, text(args.icon));
|
||||
if (has(args, 'color')) rows.change('color', note?.color ?? null, text(args.color));
|
||||
return { subject: note?.text ?? text(args.text), rows, dayId: id(args, 'dayId'), placeIds: [] };
|
||||
|
||||
@@ -11,7 +11,13 @@ import {
|
||||
} from '../../nest-mcp';
|
||||
import { McpToolGuardsService } from '../mcp-shared/mcp-tool-guards.service';
|
||||
import { DayNotesService } from './day-notes.service';
|
||||
import { idSchema, NOTE_COLORS, type NoteColor } from '@trek/shared';
|
||||
import {
|
||||
dayNoteCreateRequestSchema,
|
||||
dayNoteUpdateRequestSchema,
|
||||
idSchema,
|
||||
NOTE_COLORS,
|
||||
type NoteColor,
|
||||
} from '@trek/shared';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
@@ -23,6 +29,18 @@ import { z } from 'zod';
|
||||
*/
|
||||
const noteColorSchema = z.enum(NOTE_COLORS);
|
||||
|
||||
/**
|
||||
* The note's two text fields carry their names from the time a note was a line
|
||||
* with a clock time: `text` is the heading and `time` the Markdown body under it.
|
||||
* The REST contract holds the bounds, so a note written in the planner can always
|
||||
* be edited here; the descriptions are what tells a model which field is which.
|
||||
*/
|
||||
const NOTE_TITLE = 'The note title, shown as its heading in the day plan. Keep it short';
|
||||
const NOTE_BODY =
|
||||
'The note body shown under the title: details, links, reminders, Markdown allowed. ' +
|
||||
'Despite the field name this is the content, not a clock time';
|
||||
const noteTitleSchema = dayNoteCreateRequestSchema.shape.text.describe(NOTE_TITLE);
|
||||
|
||||
function parseId(value: string | string[]): number | null {
|
||||
const n = Number(Array.isArray(value) ? value[0] : value);
|
||||
return Number.isInteger(n) && n > 0 ? n : null;
|
||||
@@ -52,12 +70,12 @@ export class DayNotesMcp {
|
||||
|
||||
@Tool({
|
||||
name: 'create_day_note',
|
||||
description: 'Add a note to a specific day in a trip.',
|
||||
description: 'Add a note to a specific day in a trip: a title in `text` and its body in `time`.',
|
||||
inputSchema: {
|
||||
tripId: idSchema,
|
||||
dayId: idSchema,
|
||||
text: z.string().min(1).max(500),
|
||||
time: z.string().max(250).optional().describe('Time label (e.g. "09:00" or "Morning")'),
|
||||
text: noteTitleSchema,
|
||||
time: dayNoteCreateRequestSchema.shape.time.describe(NOTE_BODY),
|
||||
icon: z.string().max(64).optional().describe('Emoji icon for the note'),
|
||||
color: noteColorSchema
|
||||
.nullable()
|
||||
@@ -86,7 +104,7 @@ export class DayNotesMcp {
|
||||
tripId: number;
|
||||
dayId: number;
|
||||
text: string;
|
||||
time?: string;
|
||||
time?: string | null;
|
||||
icon?: string;
|
||||
color?: NoteColor | null;
|
||||
sort_order?: number;
|
||||
@@ -104,18 +122,14 @@ export class DayNotesMcp {
|
||||
|
||||
@Tool({
|
||||
name: 'update_day_note',
|
||||
description: 'Edit an existing note on a specific day.',
|
||||
description: 'Edit an existing note on a specific day: its title is `text`, its body `time`.',
|
||||
inputSchema: {
|
||||
tripId: idSchema,
|
||||
dayId: idSchema,
|
||||
noteId: idSchema,
|
||||
text: z.string().min(1).max(500).optional(),
|
||||
time: z
|
||||
.string()
|
||||
.max(250)
|
||||
.nullable()
|
||||
.optional()
|
||||
.describe('Time label (e.g. "09:00" or "Morning"), or null to clear'),
|
||||
// The create bound, so an update cannot blank the title the planner requires.
|
||||
text: noteTitleSchema.optional(),
|
||||
time: dayNoteUpdateRequestSchema.shape.time.describe(`${NOTE_BODY}, or null to clear it`),
|
||||
icon: z.string().max(64).optional().describe('Emoji icon for the note'),
|
||||
color: noteColorSchema
|
||||
.nullable()
|
||||
|
||||
@@ -86,11 +86,16 @@ export async function reclaimPhotoCache(
|
||||
|
||||
export interface DedupSet {
|
||||
names: Set<string>;
|
||||
/** The names of the places with a line: a track to import matches only these (#2810). Absent where none is read. */
|
||||
trackNames?: Set<string>;
|
||||
coords: Array<{ lat: number; lng: number }>;
|
||||
/** Provider ids (google_place_id, google_ftid, osm_id, amap_poi_id) of the places already in the trip. */
|
||||
externalIds: Set<string>;
|
||||
}
|
||||
|
||||
/** A candidate for the dedup set; `track` when it is a line (a GPX track or route, a KML path). */
|
||||
export type DedupCandidate = PlaceMatchCandidate & { track?: boolean };
|
||||
|
||||
/**
|
||||
* Returns true if a candidate place is already represented in the dedup set.
|
||||
*
|
||||
@@ -104,12 +109,14 @@ export interface DedupSet {
|
||||
* JavaScript's is not, and only unnamed rows contribute coordinates to a dedup
|
||||
* set. `findDuplicatePlace` spells out where the two still answer differently.
|
||||
*/
|
||||
export function isPlaceDuplicate(candidate: PlaceMatchCandidate, dedup: DedupSet): boolean {
|
||||
export function isPlaceDuplicate(candidate: DedupCandidate, dedup: DedupSet): boolean {
|
||||
for (const strategy of placeMatchStrategies(candidate)) {
|
||||
if (strategy.by === 'externalId') {
|
||||
if (dedup.externalIds.has(strategy.id)) return true;
|
||||
} else if (strategy.by === 'name') {
|
||||
if (dedup.names.has(strategy.name)) return true;
|
||||
// A track is the same as a track of that name, never as a sight of that name:
|
||||
// a watch names a hike after the place it went to (#2810).
|
||||
if ((candidate.track ? dedup.trackNames : dedup.names)?.has(strategy.name)) return true;
|
||||
} else if (
|
||||
dedup.coords.some(
|
||||
(c) =>
|
||||
@@ -130,29 +137,34 @@ export function isPlaceDuplicate(candidate: PlaceMatchCandidate, dedup: DedupSet
|
||||
*/
|
||||
export function dedupSetOf(
|
||||
rows: ReadonlyArray<
|
||||
{ name: string | null; lat: number | null; lng: number | null } & Parameters<typeof externalIdsOf>[0]
|
||||
{ name: string | null; lat: number | null; lng: number | null; route_geometry?: string | null } & Parameters<
|
||||
typeof externalIdsOf
|
||||
>[0]
|
||||
>,
|
||||
): DedupSet {
|
||||
const names = new Set<string>();
|
||||
const trackNames = new Set<string>();
|
||||
const coords: Array<{ lat: number; lng: number }> = [];
|
||||
const externalIds = new Set<string>();
|
||||
for (const row of rows) {
|
||||
for (const id of externalIdsOf(row)) externalIds.add(id);
|
||||
if (row.name) {
|
||||
names.add(row.name.trim().toLowerCase());
|
||||
if (row.route_geometry) trackNames.add(row.name.trim().toLowerCase());
|
||||
} else if (row.lat != null && row.lng != null) {
|
||||
coords.push({ lat: row.lat, lng: row.lng });
|
||||
}
|
||||
}
|
||||
return { names, coords, externalIds };
|
||||
return { names, trackNames, coords, externalIds };
|
||||
}
|
||||
|
||||
/** Record a newly inserted place so subsequent candidates in the same batch are checked against it. */
|
||||
export function trackInsertedInDedupSet(place: PlaceMatchCandidate, dedup: DedupSet): void {
|
||||
export function trackInsertedInDedupSet(place: DedupCandidate, dedup: DedupSet): void {
|
||||
for (const id of externalIdsOf(place)) dedup.externalIds.add(id);
|
||||
const normalizedName = normalizePlaceName(place.name);
|
||||
if (normalizedName) {
|
||||
dedup.names.add(normalizedName);
|
||||
if (place.track) (dedup.trackNames ??= new Set()).add(normalizedName);
|
||||
} else if (place.lat != null && place.lng != null) {
|
||||
dedup.coords.push({ lat: place.lat, lng: place.lng });
|
||||
}
|
||||
|
||||
@@ -758,7 +758,7 @@ export class PlacesService {
|
||||
async gpxDuplicates(tripId: string, rows: PreparedGpxPlace[]): Promise<boolean[]> {
|
||||
const dedup = await this.buildDedupSet(tripId);
|
||||
return rows.map((wp) => {
|
||||
const candidate = { name: wp.name, lat: wp.lat, lng: wp.lng };
|
||||
const candidate = { name: wp.name, lat: wp.lat, lng: wp.lng, track: !!wp.routeGeometry };
|
||||
if (isPlaceDuplicate(candidate, dedup)) return true;
|
||||
trackInsertedInDedupSet(candidate, dedup);
|
||||
return false;
|
||||
@@ -925,7 +925,7 @@ export class PlacesService {
|
||||
// `findWithTagsAndRatings` INSIDE the caller's transaction, so the read
|
||||
// sees the still-uncommitted row.
|
||||
for (const wp of waypoints) {
|
||||
if (isPlaceDuplicate({ name: wp.name, lat: wp.lat, lng: wp.lng }, dedup)) {
|
||||
if (isPlaceDuplicate({ name: wp.name, lat: wp.lat, lng: wp.lng, track: !!wp.routeGeometry }, dedup)) {
|
||||
skipped++;
|
||||
continue;
|
||||
}
|
||||
@@ -960,7 +960,7 @@ export class PlacesService {
|
||||
});
|
||||
const place = (await this.placesRepo.findWithTagsAndRatings(placeId))!;
|
||||
created.push(place);
|
||||
trackInsertedInDedupSet({ name: wp.name, lat: wp.lat, lng: wp.lng }, dedup);
|
||||
trackInsertedInDedupSet({ name: wp.name, lat: wp.lat, lng: wp.lng, track: !!wp.routeGeometry }, dedup);
|
||||
}
|
||||
|
||||
return { places: created, count: created.length, skipped };
|
||||
@@ -1033,7 +1033,7 @@ export class PlacesService {
|
||||
const fallbackName = `Placemark ${fallbackIndex}`;
|
||||
const name = parsedPlacemark.name || fallbackName;
|
||||
|
||||
if (isPlaceDuplicate({ name, lat: parsedPlacemark.lat, lng: parsedPlacemark.lng }, dedup)) {
|
||||
if (isPlaceDuplicate({ name, lat: parsedPlacemark.lat, lng: parsedPlacemark.lng, track: isPath }, dedup)) {
|
||||
summary.skippedCount += 1;
|
||||
dupCount++;
|
||||
fallbackIndex += 1;
|
||||
@@ -1079,7 +1079,7 @@ export class PlacesService {
|
||||
|
||||
const place = (await this.placesRepo.findWithTagsAndRatings(placeId))!;
|
||||
created.push(place);
|
||||
trackInsertedInDedupSet({ name, lat: parsedPlacemark.lat, lng: parsedPlacemark.lng }, dedup);
|
||||
trackInsertedInDedupSet({ name, lat: parsedPlacemark.lat, lng: parsedPlacemark.lng, track: isPath }, dedup);
|
||||
summary.createdCount += 1;
|
||||
fallbackIndex += 1;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { PreparedGpxPlace } from '../place-import/place-import.types';
|
||||
import { PlacesService } from '../places/places.service';
|
||||
import { readTourFile } from './tour-file-import.helpers';
|
||||
import { gpxOfLine, splitGpxTrackPieces } from './tour-file-split.helpers';
|
||||
import { tracksToAdopt } from './tour-track-adoption';
|
||||
import { computeTourMetrics, parseRouteGeometry } from './tours.helpers';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { TOUR_GPX_TEXT_MAX, type TourFileLeftOut } from '@trek/shared';
|
||||
@@ -15,7 +16,10 @@ export interface TourFileTrack {
|
||||
point_count: number;
|
||||
distance_km: number;
|
||||
has_heights: boolean;
|
||||
/** A track already in the trip under the same name and start, which the import would skip. */
|
||||
/**
|
||||
* A track already in the trip under the same name and start, which the import would skip. A track
|
||||
* from before Tours under the same name is none: the import takes it over as a tour (#2810).
|
||||
*/
|
||||
duplicate: boolean;
|
||||
}
|
||||
|
||||
@@ -55,7 +59,9 @@ export class TourFileReadService {
|
||||
async read(tripId: number, buffer: Buffer, fileName: string): Promise<TourFileTracks> {
|
||||
const { rows, leftOut } = await readTourFile(this.placeImport, buffer, fileName);
|
||||
if (rows.length === 0) return { tracks: [], whole: false };
|
||||
const duplicates = await this.places.gpxDuplicates(String(tripId), rows);
|
||||
const found = await this.places.gpxDuplicates(String(tripId), rows);
|
||||
const adopt = tracksToAdopt(rows, await this.places.list(String(tripId), {}));
|
||||
const duplicates = found.map((duplicate, index) => duplicate && !adopt.has(index));
|
||||
const extra = leftOut ? { left_out: leftOut } : {};
|
||||
if (!isGpxName(fileName)) {
|
||||
const tracks = rows.map((row, index) =>
|
||||
|
||||
@@ -565,6 +565,21 @@ describe('Tours e2e (real guards + temp SQLite)', () => {
|
||||
expect((await importGpx(OWNER, TRACK_GPX)).body).toEqual({ tours: [], caution: false, skipped: 1 });
|
||||
});
|
||||
|
||||
it('imports a hike named after a sight of the trip instead of skipping it as a duplicate (#2810)', async () => {
|
||||
// A watch names the hike after where it went, and that place is already planned.
|
||||
const sight = (await makePlace(orm, 5, { name: 'alpine loop', lat: 47, lng: 11 })).id;
|
||||
|
||||
const preview = await previewGpx(OWNER, TRACK_GPX);
|
||||
expect(preview.body.tracks[0]).toMatchObject({ name: 'Alpine loop', duplicate: false });
|
||||
|
||||
const res = await importGpx(OWNER, TRACK_GPX);
|
||||
expect(res.status).toBe(201);
|
||||
expect(res.body).toMatchObject({ skipped: 0 });
|
||||
expect(res.body.tours).toHaveLength(1);
|
||||
expect(res.body.tours[0].place_id).not.toBe(sight);
|
||||
expect(await placeColumns(sight, 'route_geometry')).toEqual({ route_geometry: null });
|
||||
});
|
||||
|
||||
it('400 without a file, and for a file with no track or route', async () => {
|
||||
const missing = await importGpx(OWNER, null);
|
||||
expect(missing.status).toBe(400);
|
||||
|
||||
@@ -574,20 +574,21 @@ describe('PlacesRepository.listForGpx (PL29) and existsByImageUrl (PI1)', () =>
|
||||
* by, the service-level dedup tests.
|
||||
*/
|
||||
describe('PlacesRepository.listDedupInputs (PL24)', () => {
|
||||
it('PLACEREPO-048: projects exactly the seven dedup columns, scoped to the trip', async () => {
|
||||
it('PLACEREPO-048: projects exactly the eight dedup columns, the line included (#2810), scoped to the trip', async () => {
|
||||
const { user } = createUser(testDb);
|
||||
const trip = createTrip(testDb, user.id);
|
||||
const other = createTrip(testDb, user.id);
|
||||
await insertRow(t.orm, Places, {
|
||||
trip: trip.id, name: 'Louvre', lat: 48.86, lng: 2.34, google_place_id: 'gp1', google_ftid: 'ft1', osm_id: 'osm1', amap_poi_id: 'amap1',
|
||||
route_geometry: '[[48.86,2.34],[48.87,2.35]]',
|
||||
});
|
||||
await insertRow(t.orm, Places, { trip: trip.id, name: '', lat: 1.1, lng: 2.2 });
|
||||
createPlace(testDb, other.id, { name: 'Not this trip' });
|
||||
|
||||
const rows = await places.listDedupInputs(String(trip.id));
|
||||
expect(rows).toEqual([
|
||||
{ name: 'Louvre', lat: 48.86, lng: 2.34, google_place_id: 'gp1', google_ftid: 'ft1', osm_id: 'osm1', amap_poi_id: 'amap1' },
|
||||
{ name: '', lat: 1.1, lng: 2.2, google_place_id: null, google_ftid: null, osm_id: null, amap_poi_id: null },
|
||||
{ name: 'Louvre', lat: 48.86, lng: 2.34, route_geometry: '[[48.86,2.34],[48.87,2.35]]', google_place_id: 'gp1', google_ftid: 'ft1', osm_id: 'osm1', amap_poi_id: 'amap1' },
|
||||
{ name: '', lat: 1.1, lng: 2.2, route_geometry: null, google_place_id: null, google_ftid: null, osm_id: null, amap_poi_id: null },
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@@ -99,6 +99,43 @@ describe('Tool: create_day_note', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('describes text as the title and time as the body, as the planner shows them', async () => {
|
||||
const { user } = createUser(testDb);
|
||||
await withHarness(user.id, async (h) => {
|
||||
const { tools } = await h.client.listTools();
|
||||
for (const name of ['create_day_note', 'update_day_note']) {
|
||||
const props = tools.find((t) => t.name === name)?.inputSchema.properties as Record<string, unknown>;
|
||||
// The nullable body may come out as an anyOf, so read the property whole.
|
||||
const time = JSON.stringify(props.time);
|
||||
expect(JSON.stringify(props.text)).toMatch(/title/i);
|
||||
expect(time).toMatch(/body/i);
|
||||
expect(time).not.toMatch(/time label/i);
|
||||
expect(time).toContain('"maxLength":2000');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('takes a body of 2000 characters, the bound the planner allows, and refuses one more', async () => {
|
||||
const { user } = createUser(testDb);
|
||||
const trip = createTrip(testDb, user.id);
|
||||
const day = createDay(testDb, trip.id);
|
||||
await withHarness(user.id, async (h) => {
|
||||
const body = 'b'.repeat(2000);
|
||||
const result = await h.client.callTool({
|
||||
name: 'create_day_note',
|
||||
arguments: { tripId: trip.id, dayId: day.id, text: 'Museum day', time: body },
|
||||
});
|
||||
const data = parseToolResult(result) as { note: { id: number } };
|
||||
expect((await dayNote(data.note.id)).time).toBe(body);
|
||||
const tooLong = await h.client.callTool({
|
||||
name: 'create_day_note',
|
||||
arguments: { tripId: trip.id, dayId: day.id, text: 'Museum day', time: `${body}b` },
|
||||
});
|
||||
expect(tooLong.isError).toBe(true);
|
||||
expect(await countRows(orm, DayNotes, { day: day.id })).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
it('defaults icon to 📝', async () => {
|
||||
const { user } = createUser(testDb);
|
||||
const trip = createTrip(testDb, user.id);
|
||||
@@ -220,6 +257,45 @@ describe('Tool: update_day_note', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('edits a note whose body is longer than 250 characters without shortening it', async () => {
|
||||
const { user } = createUser(testDb);
|
||||
const trip = createTrip(testDb, user.id);
|
||||
const day = createDay(testDb, trip.id);
|
||||
const longBody = 'Opening hours and the ticket links. '.repeat(20);
|
||||
const note = createDayNote(testDb, day.id, trip.id, { text: 'Museum day', time: longBody });
|
||||
await withHarness(user.id, async (h) => {
|
||||
const renamed = await h.client.callTool({
|
||||
name: 'update_day_note',
|
||||
arguments: { tripId: trip.id, dayId: day.id, noteId: note.id, text: 'Museums' },
|
||||
});
|
||||
expect(renamed.isError).toBeFalsy();
|
||||
const longer = `${longBody}Bring the pass.`;
|
||||
const rewritten = await h.client.callTool({
|
||||
name: 'update_day_note',
|
||||
arguments: { tripId: trip.id, dayId: day.id, noteId: note.id, time: longer },
|
||||
});
|
||||
expect(rewritten.isError).toBeFalsy();
|
||||
const row = await dayNote(note.id);
|
||||
expect(row.text).toBe('Museums');
|
||||
expect(row.time).toBe(longer);
|
||||
});
|
||||
});
|
||||
|
||||
it('refuses an empty title on update and keeps the stored one', async () => {
|
||||
const { user } = createUser(testDb);
|
||||
const trip = createTrip(testDb, user.id);
|
||||
const day = createDay(testDb, trip.id);
|
||||
const note = createDayNote(testDb, day.id, trip.id, { text: 'Keep me' });
|
||||
await withHarness(user.id, async (h) => {
|
||||
const result = await h.client.callTool({
|
||||
name: 'update_day_note',
|
||||
arguments: { tripId: trip.id, dayId: day.id, noteId: note.id, text: '' },
|
||||
});
|
||||
expect(result.isError).toBe(true);
|
||||
expect((await dayNote(note.id)).text).toBe('Keep me');
|
||||
});
|
||||
});
|
||||
|
||||
it('trims text whitespace', async () => {
|
||||
const { user } = createUser(testDb);
|
||||
const trip = createTrip(testDb, user.id);
|
||||
|
||||
@@ -28,6 +28,12 @@ import { toProviderSchema, type AiFetch } from '../../../../src/nest/ai-connecti
|
||||
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
|
||||
const { logWarn } = vi.hoisted(() => ({ logWarn: vi.fn() }));
|
||||
vi.mock('../../../../src/nest/audit/audit-log.logger', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import('../../../../src/nest/audit/audit-log.logger')>()),
|
||||
logWarn,
|
||||
}));
|
||||
|
||||
/** An SSE body from whole events, cut every `every` characters so no event arrives in one piece. */
|
||||
function sseBody(events: unknown[], every = 7): ReadableStream<Uint8Array> {
|
||||
const text = events.map((e) => `data: ${typeof e === 'string' ? e : JSON.stringify(e)}\n\n`).join('');
|
||||
@@ -145,6 +151,40 @@ describe('provider errors', () => {
|
||||
expect(errorCodeOf(null)).toBeUndefined();
|
||||
expect(errorCodeOf({})).toBeUndefined();
|
||||
});
|
||||
|
||||
it('PERR-004: a refusal is logged with the path of the field it names, never with its message (#2845)', async () => {
|
||||
const refused = (param: unknown) =>
|
||||
failure(
|
||||
new OpenAiResponsesClient(
|
||||
'm',
|
||||
async () => 'at',
|
||||
fetchAnswering(
|
||||
jsonResponse(400, {
|
||||
error: {
|
||||
type: 'invalid_request_error',
|
||||
code: null,
|
||||
message: 'No tool output found for function call call_note. Dinner in Rome at 20:00.',
|
||||
param,
|
||||
},
|
||||
}),
|
||||
).fetcher,
|
||||
).stream(REQUEST, signal()),
|
||||
);
|
||||
|
||||
logWarn.mockClear();
|
||||
expect(await refused('input[3]')).toMatchObject({ code: 'generic', status: 400 });
|
||||
expect(logWarn).toHaveBeenCalledWith(
|
||||
'[ai] chatgpt refused the request: HTTP 400 (invalid_request_error) at input[3]',
|
||||
);
|
||||
|
||||
logWarn.mockClear();
|
||||
await refused('input[3] Dinner in Rome');
|
||||
await refused(null);
|
||||
expect(logWarn.mock.calls.map(([line]) => line)).toEqual([
|
||||
'[ai] chatgpt refused the request: HTTP 400 (invalid_request_error)',
|
||||
'[ai] chatgpt refused the request: HTTP 400 (invalid_request_error)',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('toProviderSchema', () => {
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* The bundled assets/airports.json itself, not a fixture.
|
||||
*
|
||||
* OurAirports marks some airports with daily flights as having no scheduled
|
||||
* service, and the build used to drop them on that flag alone (#2820, Little
|
||||
* Cayman). These pin a few of them and the codes saved bookings already point at.
|
||||
*/
|
||||
import { findByIata } from '../../../../src/nest/airports/airports.data';
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
describe('bundled airport dataset', () => {
|
||||
it('AIRPORT-ASSET-001: keeps airports OurAirports flags as unscheduled', () => {
|
||||
expect(findByIata('LYB')?.name).toBe('Edward Bodden Little Cayman Airfield');
|
||||
expect(findByIata('VEY')?.country).toBe('IS');
|
||||
});
|
||||
|
||||
it('AIRPORT-ASSET-002: still resolves the codes it carried before', () => {
|
||||
for (const code of ['PBI', 'ADA', 'GCM', 'CYB', 'FRA']) {
|
||||
expect(findByIata(code), code).not.toBeNull();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -6,6 +6,9 @@
|
||||
*/
|
||||
import type { AssistantMessageRow } from '../../../../src/db/repositories/AssistantMessages.repository';
|
||||
import type { AssistantToolCallRow } from '../../../../src/db/repositories/AssistantToolCalls.repository';
|
||||
import type { AiChatMessage } from '../../../../src/nest/ai-connections/ai-chat-client.interface';
|
||||
import { toAnthropicMessages } from '../../../../src/nest/ai-connections/providers/anthropic-messages.client';
|
||||
import { toResponsesInput } from '../../../../src/nest/ai-connections/providers/openai-responses.client';
|
||||
import {
|
||||
messageIdOf,
|
||||
outputText,
|
||||
@@ -249,7 +252,7 @@ describe('toChatHistory', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('ASTHIS-005d: the text of a file the user let the model read comes after the step, once, cut in earlier turns', () => {
|
||||
it('ASTHIS-005d: the text of a file the user let the model read answers its read, once, cut in earlier turns', () => {
|
||||
const id = '0b7c2f0e-6f6d-4a8e-9b1a-3d2c1e0f9a87';
|
||||
type CallPart = Extract<AssistantMessagePart, { type: 'tool-call' }>;
|
||||
const read = (toolCallId: string, extra: Partial<CallPart>): AssistantMessagePart => ({
|
||||
@@ -270,20 +273,27 @@ describe('toChatHistory', () => {
|
||||
row('user', [{ type: 'text', text: 'Thanks' }]),
|
||||
];
|
||||
const history = toChatHistory(rows, new Map(), new Map([[id, long]]));
|
||||
expect(history.map((message) => message.role)).toEqual(['user', 'assistant', 'user', 'user', 'user']);
|
||||
expect(history[1]).toMatchObject({ role: 'assistant', text: 'I need to read it first.', toolCalls: [] });
|
||||
const told = (history[2] as { text: string }).text;
|
||||
expect(history.map((message) => message.role)).toEqual(['user', 'assistant', 'tool', 'assistant', 'tool', 'user']);
|
||||
expect(history[1]).toMatchObject({
|
||||
role: 'assistant',
|
||||
text: 'I need to read it first.',
|
||||
toolCalls: [{ id: 'r1', name: 'read_attached_file' }],
|
||||
});
|
||||
expect(history[2]).toMatchObject({ role: 'tool', toolCallId: 'r1' });
|
||||
const told = (history[2] as { output: string }).output;
|
||||
expect(told).toContain('The user let you read the attached file "AirBnB Buchung.pdf".');
|
||||
expect(told).toContain('Casa Lisboa');
|
||||
// An earlier turn's text is cut so it does not crowd out the conversation.
|
||||
expect(told.length).toBeLessThan(long.length);
|
||||
expect(told.endsWith('[...]')).toBe(true);
|
||||
expect((history[3] as { text: string }).text).toBe(
|
||||
'You read the attached file "AirBnB Buchung.pdf" again; its text is above.',
|
||||
);
|
||||
expect(history[4]).toMatchObject({
|
||||
role: 'tool',
|
||||
toolCallId: 'r2',
|
||||
output: 'You read the attached file "AirBnB Buchung.pdf" again; its text is above.',
|
||||
});
|
||||
// The latest turn keeps the whole text.
|
||||
const latest = toChatHistory(rows.slice(0, 2), new Map(), new Map([[id, long]]));
|
||||
expect((latest[2] as { text: string }).text).toContain(long);
|
||||
expect((latest[2] as { output: string }).output).toContain(long);
|
||||
});
|
||||
|
||||
it('ASTHIS-005e: a read the user did not allow, one still waiting, a refused one and a swept file say so', () => {
|
||||
@@ -303,21 +313,21 @@ describe('toChatHistory', () => {
|
||||
]),
|
||||
],
|
||||
new Map(),
|
||||
).map((message) => (message as { text: string }).text);
|
||||
expect(step({ approval: { id: 'r', approved: false } })[1]).toBe(
|
||||
).map((message) => (message.role === 'tool' ? message.output : null));
|
||||
expect(step({ approval: { id: 'r', approved: false } })[2]).toBe(
|
||||
'The user did not let you read the attached file "a.pdf".',
|
||||
);
|
||||
expect(step({ approval: { id: 'r' } })[1]).toContain("waits for the user's agreement; you have not read it.");
|
||||
expect(step({ approval: { id: 'r', resolution: 'expired' } })[1]).toContain('you have not read it');
|
||||
expect(step({ result: 'No such attachment in this conversation.', isError: true })[1]).toBe(
|
||||
expect(step({ approval: { id: 'r' } })[2]).toContain("waits for the user's agreement; you have not read it.");
|
||||
expect(step({ approval: { id: 'r', resolution: 'expired' } })[2]).toContain('you have not read it');
|
||||
expect(step({ result: 'No such attachment in this conversation.', isError: true })[2]).toBe(
|
||||
'Reading the attached file "a.pdf" failed: No such attachment in this conversation.',
|
||||
);
|
||||
expect(step({ result: { read: true } })[1]).toBe(
|
||||
expect(step({ result: { read: true } })[2]).toBe(
|
||||
'The attached file "a.pdf" is no longer kept; you cannot read it again.',
|
||||
);
|
||||
});
|
||||
|
||||
it('ASTHIS-005f: keeping an attached file is told after its step, whatever became of it', () => {
|
||||
it('ASTHIS-005f: keeping an attached file is answered with what became of it', () => {
|
||||
const keep = (extra: Partial<Extract<AssistantMessagePart, { type: 'tool-call' }>>) =>
|
||||
toChatHistory(
|
||||
[
|
||||
@@ -336,11 +346,12 @@ describe('toChatHistory', () => {
|
||||
new Map(),
|
||||
);
|
||||
const kept = keep({ approval: { id: 'k', approved: true }, result: { file: { id: 31 } } });
|
||||
expect(kept.map((message) => message.role)).toEqual(['user', 'assistant', 'user']);
|
||||
expect((kept[2] as { text: string }).text).toBe(
|
||||
'The attached file "a.pdf" is in the trip\'s Files now (file id 31).',
|
||||
);
|
||||
const lastOf = (extra: Parameters<typeof keep>[0]) => (keep(extra).at(-1) as { text: string }).text;
|
||||
expect(kept.map((message) => message.role)).toEqual(['user', 'assistant', 'tool']);
|
||||
expect(kept[2]).toMatchObject({
|
||||
toolCallId: 'k',
|
||||
output: 'The attached file "a.pdf" is in the trip\'s Files now (file id 31).',
|
||||
});
|
||||
const lastOf = (extra: Parameters<typeof keep>[0]) => (keep(extra).at(-1) as { output: string }).output;
|
||||
expect(
|
||||
lastOf({ approval: { id: 'k', approved: true }, result: 'The file could not be kept.', isError: true }),
|
||||
).toBe('The attached file "a.pdf" could not be kept in Files: The file could not be kept.');
|
||||
@@ -448,6 +459,151 @@ describe('toChatHistory', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('toChatHistory: calls the model made of the server tools (#2845)', () => {
|
||||
/**
|
||||
* The thread of #2845: a step that kept a trip note on the way (it runs at
|
||||
* once), then a step whose changes the user applied, both with the
|
||||
* provider's own record of the step stored beside them.
|
||||
*/
|
||||
function appliedAfterANote(
|
||||
noteState: Record<string, unknown>,
|
||||
changeState: Record<string, unknown>,
|
||||
): AiChatMessage[] {
|
||||
const rows = [
|
||||
row('user', [{ type: 'text', text: 'Dinner at 20:00 on day 2, and remember we like late dinners' }]),
|
||||
row(
|
||||
'assistant',
|
||||
[
|
||||
{
|
||||
type: 'tool-call',
|
||||
toolCallId: 'call_note',
|
||||
toolName: 'remember_for_trip',
|
||||
args: { note: 'Likes late dinners' },
|
||||
result: { notes: 'Likes late dinners' },
|
||||
},
|
||||
],
|
||||
{ provider_state: JSON.stringify(noteState) },
|
||||
),
|
||||
row(
|
||||
'assistant',
|
||||
[
|
||||
{ type: 'text', text: 'Shall I move it?' },
|
||||
{
|
||||
type: 'tool-call',
|
||||
toolCallId: 'held-1',
|
||||
toolName: 'update_assignment_time',
|
||||
args: { assignmentId: 7, place_time: '20:00' },
|
||||
result: { assignment: { id: 7 } },
|
||||
approval: { id: 'held-1', approved: true },
|
||||
},
|
||||
],
|
||||
{ provider_state: JSON.stringify(changeState) },
|
||||
),
|
||||
];
|
||||
return toChatHistory(rows, new Map([['held-1', 'call_move']]));
|
||||
}
|
||||
|
||||
it('ASTHIS-015: the Responses API gets an answer for every call it made, a kept note included', () => {
|
||||
const history = appliedAfterANote(
|
||||
{
|
||||
adapter: 'openai-responses',
|
||||
items: [
|
||||
{ type: 'reasoning', id: 'rs_1', encrypted_content: 'x' },
|
||||
{ type: 'function_call', call_id: 'call_note', name: 'remember_for_trip', arguments: '{}' },
|
||||
],
|
||||
},
|
||||
{
|
||||
adapter: 'openai-responses',
|
||||
items: [
|
||||
{ type: 'reasoning', id: 'rs_2', encrypted_content: 'y' },
|
||||
{ type: 'message', role: 'assistant', content: [{ type: 'output_text', text: 'Shall I move it?' }] },
|
||||
{ type: 'function_call', call_id: 'call_move', name: 'update_assignment_time', arguments: '{}' },
|
||||
],
|
||||
},
|
||||
);
|
||||
const input = toResponsesInput({ system: '', messages: history, tools: [] });
|
||||
const made = input.filter((item) => item.type === 'function_call').map((item) => item.call_id);
|
||||
const answered = input.filter((item) => item.type === 'function_call_output').map((item) => item.call_id);
|
||||
expect(made).toEqual(['call_note', 'call_move']);
|
||||
expect(answered).toEqual(['call_note', 'call_move']);
|
||||
for (const id of made) {
|
||||
const call = input.findIndex((item) => item.type === 'function_call' && item.call_id === id);
|
||||
const output = input.findIndex((item) => item.type === 'function_call_output' && item.call_id === id);
|
||||
expect(output).toBeGreaterThan(call);
|
||||
}
|
||||
expect(input.find((item) => item.type === 'function_call_output' && item.call_id === 'call_note')).toMatchObject({
|
||||
output: '{"notes":"Likes late dinners"}',
|
||||
});
|
||||
// Nothing empty goes out as the user's: a kept note is no step of the server to tell.
|
||||
const userTexts = input
|
||||
.filter((item) => item.type === 'message' && item.role === 'user')
|
||||
.flatMap((item) => (item.content as Array<{ text?: string }>).map((part) => part.text ?? ''));
|
||||
expect(userTexts).toEqual(['Dinner at 20:00 on day 2, and remember we like late dinners']);
|
||||
});
|
||||
|
||||
it('ASTHIS-016: Anthropic gets a tool_result for every tool_use it replays, a kept note included', () => {
|
||||
const history = appliedAfterANote(
|
||||
{
|
||||
adapter: 'anthropic-messages',
|
||||
blocks: [
|
||||
{ type: 'thinking', thinking: 'note it', signature: 's1' },
|
||||
{ type: 'tool_use', id: 'call_note', name: 'remember_for_trip', input: {} },
|
||||
],
|
||||
},
|
||||
{
|
||||
adapter: 'anthropic-messages',
|
||||
blocks: [
|
||||
{ type: 'thinking', thinking: 'move it', signature: 's2' },
|
||||
{ type: 'text', text: 'Shall I move it?' },
|
||||
{ type: 'tool_use', id: 'call_move', name: 'update_assignment_time', input: {} },
|
||||
],
|
||||
},
|
||||
);
|
||||
const messages = toAnthropicMessages(history);
|
||||
const uses = messages.flatMap((message) => message.content).filter((block) => block.type === 'tool_use');
|
||||
expect(uses.map((block) => block.id)).toEqual(['call_note', 'call_move']);
|
||||
messages.forEach((message, index) => {
|
||||
const ids = message.content.filter((block) => block.type === 'tool_use').map((block) => block.id);
|
||||
if (ids.length === 0) return;
|
||||
const next = messages[index + 1];
|
||||
expect(next?.role).toBe('user');
|
||||
const results = next.content.filter((block) => block.type === 'tool_result').map((block) => block.tool_use_id);
|
||||
expect(results).toEqual(ids);
|
||||
});
|
||||
expect(messages.flatMap((message) => message.content).some((block) => block.text === '')).toBe(false);
|
||||
});
|
||||
|
||||
it('ASTHIS-017: a step that only kept a note is the model call it was, answered with what was kept', () => {
|
||||
const history = toChatHistory(
|
||||
[
|
||||
row('user', [{ type: 'text', text: 'Remember the ferry leaves at 7' }]),
|
||||
row('assistant', [
|
||||
{
|
||||
type: 'tool-call',
|
||||
toolCallId: 'n1',
|
||||
toolName: 'remember_for_trip',
|
||||
args: { note: 'Ferry at 7' },
|
||||
result: { notes: 'Ferry at 7' },
|
||||
},
|
||||
]),
|
||||
row('assistant', [{ type: 'text', text: 'Noted.' }]),
|
||||
],
|
||||
new Map(),
|
||||
);
|
||||
expect(history).toEqual([
|
||||
{ role: 'user', text: 'Remember the ferry leaves at 7' },
|
||||
{
|
||||
role: 'assistant',
|
||||
text: '',
|
||||
toolCalls: [{ id: 'n1', name: 'remember_for_trip', args: { note: 'Ferry at 7' } }],
|
||||
providerState: null,
|
||||
},
|
||||
{ role: 'tool', toolCallId: 'n1', name: 'remember_for_trip', output: '{"notes":"Ferry at 7"}' },
|
||||
{ role: 'assistant', text: 'Noted.', toolCalls: [], providerState: null },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('toThreadMessages', () => {
|
||||
it('ASTHIS-010: the steps of one answer are one message under the first row id', () => {
|
||||
nextId = 10;
|
||||
|
||||
@@ -142,7 +142,7 @@ describe('describeToolCall', () => {
|
||||
});
|
||||
expect(describe_('update_day_note', { dayId: 31, noteId: 41, time: null })).toMatchObject({
|
||||
subject: 'Rail pass',
|
||||
rows: [{ op: 'change', labelKey: 'time', before: '09:00', after: '' }],
|
||||
rows: [{ op: 'change', labelKey: 'content', before: '09:00', after: '' }],
|
||||
});
|
||||
expect(describe_('create_day_note', { dayId: 33, text: 'Laundry', icon: '🧺' }).rows).toEqual([
|
||||
{ op: 'add', labelKey: 'day', before: null, after: 'Spare day' },
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
import {
|
||||
COORD_DEDUP_TOLERANCE,
|
||||
dedupSetOf,
|
||||
externalIdsOf,
|
||||
isPlaceDuplicate,
|
||||
mapWithConcurrency,
|
||||
@@ -25,6 +26,29 @@ vi.mock('../../../src/db/database', () => ({
|
||||
const emptyDedup = (): DedupSet => ({ names: new Set(), coords: [], externalIds: new Set() });
|
||||
|
||||
describe('isPlaceDuplicate / trackInsertedInDedupSet', () => {
|
||||
it('matches a track only against the tracks of that name, never a sight of that name (#2810)', () => {
|
||||
// The watch named the hike after the gorge, and the gorge is already a place of the trip.
|
||||
const dedup = dedupSetOf([
|
||||
{ name: 'Hokitika Gorge', lat: -42.95, lng: 171.0, route_geometry: null },
|
||||
{ name: ' 008 ', lat: 1, lng: 2, route_geometry: '[[1,2],[3,4]]' },
|
||||
]);
|
||||
expect(isPlaceDuplicate({ name: 'hokitika gorge', lat: -42.9, lng: 171.0, track: true }, dedup)).toBe(false);
|
||||
expect(isPlaceDuplicate({ name: '008', lat: 1, lng: 2, track: true }, dedup)).toBe(true);
|
||||
// A pin still matches every place of its name, a track included.
|
||||
expect(isPlaceDuplicate({ name: 'Hokitika Gorge', lat: null, lng: null }, dedup)).toBe(true);
|
||||
expect(isPlaceDuplicate({ name: '008', lat: null, lng: null }, dedup)).toBe(true);
|
||||
|
||||
// A track imported earlier in the same file counts for the next one.
|
||||
trackInsertedInDedupSet({ name: 'Hokitika Gorge', lat: -42.9, lng: 171.0, track: true }, dedup);
|
||||
expect(isPlaceDuplicate({ name: 'Hokitika gorge ', lat: null, lng: null, track: true }, dedup)).toBe(true);
|
||||
// A set built by hand without tracks matches no track by name.
|
||||
const bare = emptyDedup();
|
||||
trackInsertedInDedupSet({ name: 'Ridge', lat: 1, lng: 2 }, bare);
|
||||
expect(isPlaceDuplicate({ name: 'Ridge', lat: 1, lng: 2, track: true }, bare)).toBe(false);
|
||||
trackInsertedInDedupSet({ name: 'Lake', lat: 1, lng: 2, track: true }, bare);
|
||||
expect([...(bare.trackNames ?? [])]).toEqual(['lake']);
|
||||
});
|
||||
|
||||
it('matches a named place case- and whitespace-insensitively', () => {
|
||||
const dedup = emptyDedup();
|
||||
trackInsertedInDedupSet({ name: ' Eiffel Tower ', lat: 1, lng: 2 }, dedup);
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
* line is written as GPX.
|
||||
*/
|
||||
import { PlaceImportService } from '../../../src/nest/place-import/place-import.service';
|
||||
import { PlacesService } from '../../../src/nest/places/places.service';
|
||||
import { TourFileReadService } from '../../../src/nest/tours/tour-file-read.service';
|
||||
import { gpxOfLine, splitGpxTracks } from '../../../src/nest/tours/tour-file-split.helpers';
|
||||
import { TourFilesModule } from '../../../src/nest/tours/tour-files.module';
|
||||
import { createSnapshotTestDb } from '../../helpers/db-mock';
|
||||
import { makePlace } from '../../helpers/factories/places';
|
||||
import { makeTrip } from '../../helpers/factories/trips';
|
||||
import { makeUser } from '../../helpers/factories/users';
|
||||
import { createTestModule, type TestModule } from '../../helpers/test-module';
|
||||
@@ -18,7 +20,7 @@ import { TOUR_GPX_TEXT_MAX } from '@trek/shared';
|
||||
|
||||
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
|
||||
|
||||
// TOUR-FILE-READ-001 to TOUR-FILE-READ-008
|
||||
// TOUR-FILE-READ-001 to TOUR-FILE-READ-009
|
||||
|
||||
const db = createSnapshotTestDb();
|
||||
let t: TestModule;
|
||||
@@ -130,6 +132,25 @@ describe('TourFileReadService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('TOUR-FILE-READ-009: a track from before Tours under the same name is proposed, for the import to take over (#2810)', async () => {
|
||||
const trip = await tripId();
|
||||
// 4.x stored a GPX track as a plain place: a line, no tours row.
|
||||
await makePlace(t.get(MikroORM), trip, {
|
||||
name: 'Saturday',
|
||||
lat: 47.5,
|
||||
lng: 11.1,
|
||||
route_geometry: '[[47.5,11.1,800],[47.51,11.1,1000]]',
|
||||
});
|
||||
const rows = t.get(PlaceImportService).readGpx(Buffer.from(TWO_TRACKS, 'utf8'), { importTracks: true });
|
||||
expect((await t.get(PlacesService).gpxDuplicates(String(trip), rows)).some(Boolean)).toBe(true);
|
||||
|
||||
const read = await files.read(trip, Buffer.from(TWO_TRACKS, 'utf8'), 'weekend.gpx');
|
||||
expect(read.tracks.map((track) => [track.name, track.duplicate])).toEqual([
|
||||
['Saturday', false],
|
||||
['Sunday', false],
|
||||
]);
|
||||
});
|
||||
|
||||
it('TOUR-FILE-READ-008: a track longer than one import takes is named but carries no text', async () => {
|
||||
const points = Array.from(
|
||||
{ length: 20_000 },
|
||||
|
||||
@@ -154,6 +154,9 @@ export const ASSISTANT_CHANGE_LABEL_KEYS = [
|
||||
'currency',
|
||||
'stopType',
|
||||
'text',
|
||||
// A day note's heading and its body; `text` and `time` stay for rows already stored.
|
||||
'title',
|
||||
'content',
|
||||
'icon',
|
||||
'color',
|
||||
'position',
|
||||
|
||||
@@ -191,6 +191,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'العملة',
|
||||
'assistant.change.label.stopType': 'نوع التوقف',
|
||||
'assistant.change.label.text': 'النص',
|
||||
'assistant.change.label.title': 'العنوان',
|
||||
'assistant.change.label.content': 'المحتوى',
|
||||
'assistant.change.label.icon': 'الأيقونة',
|
||||
'assistant.change.label.color': 'اللون',
|
||||
'assistant.change.label.position': 'الترتيب',
|
||||
|
||||
@@ -177,6 +177,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'متوقفة مؤقتاً: أوقف مسؤول الخادم هذا المزوّد. ستُستأنف المزامنة عند إعادة تشغيله.',
|
||||
'docsync.binding.reconnect': 'إعادة الاتصال',
|
||||
'docsync.connection.title': 'الاتصال',
|
||||
'docsync.connection.hint': 'العنوان وبيانات الدخول التي يستخدمها TREK لهذا المخزن.',
|
||||
'docsync.connection.edit': 'تعديل الاتصال',
|
||||
'docsync.connection.remove': 'إزالة الاتصال',
|
||||
'docsync.connection.confirmRemove':
|
||||
'ينسى TREK عنوان هذا المخزن وبيانات الدخول إليه، وتتوقف كل مزامنة لهذه الرحلة عبره. تبقى المستندات في TREK وفي المخزن.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -182,6 +182,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Valyuta',
|
||||
'assistant.change.label.stopType': 'Dayanacaq növü',
|
||||
'assistant.change.label.text': 'Mətn',
|
||||
'assistant.change.label.title': 'Başlıq',
|
||||
'assistant.change.label.content': 'Məzmun',
|
||||
'assistant.change.label.icon': 'İkon',
|
||||
'assistant.change.label.color': 'Rəng',
|
||||
'assistant.change.label.position': 'Sıra',
|
||||
|
||||
@@ -183,6 +183,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Dayandırılıb: administrator bu provayderi deaktiv edib. O, yenidən aktivləşdirildikdə sinxronlaşdırma davam edəcək.',
|
||||
'docsync.binding.reconnect': 'Yenidən qoşul',
|
||||
'docsync.connection.title': 'Bağlantı',
|
||||
'docsync.connection.hint': 'TREK-in bu anbar üçün istifadə etdiyi ünvan və giriş məlumatları.',
|
||||
'docsync.connection.edit': 'Bağlantını redaktə et',
|
||||
'docsync.connection.remove': 'Bağlantını sil',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK bu anbarın ünvanını və giriş məlumatlarını unudur, bu səyahətin onun üzərindən gedən bütün sinxronlaşdırmaları dayanır. Sənədlər TREK-də və anbarda qalır.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -182,6 +182,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Moeda',
|
||||
'assistant.change.label.stopType': 'Tipo de parada',
|
||||
'assistant.change.label.text': 'Texto',
|
||||
'assistant.change.label.title': 'Título',
|
||||
'assistant.change.label.content': 'Conteúdo',
|
||||
'assistant.change.label.icon': 'Ícone',
|
||||
'assistant.change.label.color': 'Cor',
|
||||
'assistant.change.label.position': 'Ordem',
|
||||
|
||||
@@ -180,6 +180,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Pausado: um administrador desativou este provedor. A sincronização continua assim que ele for reativado.',
|
||||
'docsync.binding.reconnect': 'Voltar a ligar',
|
||||
'docsync.connection.title': 'Conexão',
|
||||
'docsync.connection.hint': 'O endereço e o login que o TREK usa para este armazenamento.',
|
||||
'docsync.connection.edit': 'Editar conexão',
|
||||
'docsync.connection.remove': 'Remover conexão',
|
||||
'docsync.connection.confirmRemove':
|
||||
'O TREK esquece o endereço e o login deste armazenamento, e toda sincronização desta viagem por ele para. Os documentos continuam no TREK e no armazenamento.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -183,6 +183,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Moneda',
|
||||
'assistant.change.label.stopType': 'Tipus de parada',
|
||||
'assistant.change.label.text': 'Text', // same-as-en
|
||||
'assistant.change.label.title': 'Títol',
|
||||
'assistant.change.label.content': 'Contingut',
|
||||
'assistant.change.label.icon': 'Icona',
|
||||
'assistant.change.label.color': 'Color',
|
||||
'assistant.change.label.position': 'Ordre',
|
||||
|
||||
@@ -182,6 +182,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'En pausa: un administrador ha desactivat aquest proveïdor. La sincronització es reprèn quan es torni a activar.',
|
||||
'docsync.binding.reconnect': 'Torna a connectar',
|
||||
'docsync.connection.title': 'Connexió',
|
||||
'docsync.connection.hint': 'L’adreça i l’inici de sessió que TREK fa servir per a aquest emmagatzematge.',
|
||||
'docsync.connection.edit': 'Edita la connexió',
|
||||
'docsync.connection.remove': 'Elimina la connexió',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK oblida l’adreça i l’inici de sessió d’aquest emmagatzematge, i totes les sincronitzacions d’aquest viatge a través seu s’aturen. Els documents es queden a TREK i a l’emmagatzematge.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -184,6 +184,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Měna',
|
||||
'assistant.change.label.stopType': 'Typ zastávky',
|
||||
'assistant.change.label.text': 'Text', // same-as-en
|
||||
'assistant.change.label.title': 'Název',
|
||||
'assistant.change.label.content': 'Obsah',
|
||||
'assistant.change.label.icon': 'Ikona',
|
||||
'assistant.change.label.color': 'Barva',
|
||||
'assistant.change.label.position': 'Pořadí',
|
||||
|
||||
@@ -178,6 +178,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Pozastaveno: správce tohoto poskytovatele vypnul. Synchronizace bude pokračovat, jakmile ho znovu zapne.',
|
||||
'docsync.binding.reconnect': 'Znovu připojit',
|
||||
'docsync.connection.title': 'Připojení',
|
||||
'docsync.connection.hint': 'Adresa a přihlášení, které TREK pro toto úložiště používá.',
|
||||
'docsync.connection.edit': 'Upravit připojení',
|
||||
'docsync.connection.remove': 'Odebrat připojení',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK zapomene adresu a přihlášení k tomuto úložišti a veškerá synchronizace této cesty přes něj se zastaví. Dokumenty zůstanou v TREKu i v úložišti.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -182,6 +182,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Währung',
|
||||
'assistant.change.label.stopType': 'Art des Stopps',
|
||||
'assistant.change.label.text': 'Text', // same-as-en
|
||||
'assistant.change.label.title': 'Titel',
|
||||
'assistant.change.label.content': 'Inhalt',
|
||||
'assistant.change.label.icon': 'Symbol',
|
||||
'assistant.change.label.color': 'Farbe',
|
||||
'assistant.change.label.position': 'Reihenfolge',
|
||||
|
||||
@@ -182,6 +182,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Pausiert: Ein Administrator hat diesen Anbieter abgeschaltet. Der Abgleich läuft weiter, sobald er wieder eingeschaltet ist.',
|
||||
'docsync.binding.reconnect': 'Neu verbinden',
|
||||
'docsync.connection.title': 'Verbindung',
|
||||
'docsync.connection.hint': 'Adresse und Anmeldung, mit denen TREK diesen Speicher erreicht.',
|
||||
'docsync.connection.edit': 'Verbindung bearbeiten',
|
||||
'docsync.connection.remove': 'Verbindung entfernen',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK vergisst Adresse und Anmeldung für diesen Speicher, und jeder Abgleich dieser Reise darüber endet. Die Dokumente bleiben in TREK und im Speicher.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -178,6 +178,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Currency',
|
||||
'assistant.change.label.stopType': 'Stop type',
|
||||
'assistant.change.label.text': 'Text',
|
||||
'assistant.change.label.title': 'Title',
|
||||
'assistant.change.label.content': 'Content',
|
||||
'assistant.change.label.icon': 'Icon',
|
||||
'assistant.change.label.color': 'Colour',
|
||||
'assistant.change.label.position': 'Position',
|
||||
|
||||
@@ -178,6 +178,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Paused: an administrator has switched this provider off. Syncing resumes once it is back on.',
|
||||
'docsync.binding.reconnect': 'Reconnect',
|
||||
'docsync.connection.title': 'Connection',
|
||||
'docsync.connection.hint': 'The address and login TREK uses for this store.',
|
||||
'docsync.connection.edit': 'Edit connection',
|
||||
'docsync.connection.remove': 'Remove connection',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK forgets the address and login for this store, and every sync of this trip through it stops. Documents stay in TREK and at the store.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -181,6 +181,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Moneda',
|
||||
'assistant.change.label.stopType': 'Tipo de parada',
|
||||
'assistant.change.label.text': 'Texto',
|
||||
'assistant.change.label.title': 'Título',
|
||||
'assistant.change.label.content': 'Contenido',
|
||||
'assistant.change.label.icon': 'Icono',
|
||||
'assistant.change.label.color': 'Color',
|
||||
'assistant.change.label.position': 'Orden',
|
||||
|
||||
@@ -182,6 +182,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'En pausa: un administrador ha desactivado este proveedor. La sincronización se reanuda en cuanto vuelva a activarse.',
|
||||
'docsync.binding.reconnect': 'Volver a conectar',
|
||||
'docsync.connection.title': 'Conexión',
|
||||
'docsync.connection.hint': 'La dirección y el inicio de sesión que TREK usa para este almacenamiento.',
|
||||
'docsync.connection.edit': 'Editar conexión',
|
||||
'docsync.connection.remove': 'Eliminar conexión',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK olvida la dirección y el inicio de sesión de este almacenamiento, y se detiene toda sincronización de este viaje a través de él. Los documentos se quedan en TREK y en el almacenamiento.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -182,6 +182,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Valuuta',
|
||||
'assistant.change.label.stopType': 'Peatuse tüüp',
|
||||
'assistant.change.label.text': 'Tekst',
|
||||
'assistant.change.label.title': 'Pealkiri',
|
||||
'assistant.change.label.content': 'Sisu',
|
||||
'assistant.change.label.icon': 'Ikoon',
|
||||
'assistant.change.label.color': 'Värv',
|
||||
'assistant.change.label.position': 'Järjekord',
|
||||
|
||||
@@ -178,6 +178,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Peatatud: administraator on selle teenuse välja lülitanud. Sünkroonimine jätkub, kui see uuesti lubatakse.',
|
||||
'docsync.binding.reconnect': 'Ühenda uuesti',
|
||||
'docsync.connection.title': 'Ühendus',
|
||||
'docsync.connection.hint': 'Aadress ja sisselogimine, mida TREK selle hoidla jaoks kasutab.',
|
||||
'docsync.connection.edit': 'Muuda ühendust',
|
||||
'docsync.connection.remove': 'Eemalda ühendus',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK unustab selle hoidla aadressi ja sisselogimise ning kõik selle reisi sünkroonimised selle kaudu peatuvad. Dokumendid jäävad TREKi ja hoidlasse.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -183,6 +183,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Devise',
|
||||
'assistant.change.label.stopType': 'Type d’arrêt',
|
||||
'assistant.change.label.text': 'Texte',
|
||||
'assistant.change.label.title': 'Titre',
|
||||
'assistant.change.label.content': 'Contenu',
|
||||
'assistant.change.label.icon': 'Icône',
|
||||
'assistant.change.label.color': 'Couleur',
|
||||
'assistant.change.label.position': 'Ordre',
|
||||
|
||||
@@ -184,6 +184,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'En pause : un administrateur a désactivé ce fournisseur. La synchronisation reprendra dès qu’il sera réactivé.',
|
||||
'docsync.binding.reconnect': 'Reconnecter',
|
||||
'docsync.connection.title': 'Connexion',
|
||||
'docsync.connection.hint': 'L’adresse et l’identifiant que TREK utilise pour ce stockage.',
|
||||
'docsync.connection.edit': 'Modifier la connexion',
|
||||
'docsync.connection.remove': 'Supprimer la connexion',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK oublie l’adresse et l’identifiant de ce stockage, et toute synchronisation de ce voyage par son biais s’arrête. Les documents restent dans TREK et dans le stockage.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -185,6 +185,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Νόμισμα',
|
||||
'assistant.change.label.stopType': 'Τύπος στάσης',
|
||||
'assistant.change.label.text': 'Κείμενο',
|
||||
'assistant.change.label.title': 'Τίτλος',
|
||||
'assistant.change.label.content': 'Περιεχόμενο',
|
||||
'assistant.change.label.icon': 'Εικονίδιο',
|
||||
'assistant.change.label.color': 'Χρώμα',
|
||||
'assistant.change.label.position': 'Σειρά',
|
||||
|
||||
@@ -185,6 +185,13 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Σε παύση: ένας διαχειριστής απενεργοποίησε αυτόν τον πάροχο. Ο συγχρονισμός θα συνεχιστεί μόλις ενεργοποιηθεί ξανά.',
|
||||
'docsync.binding.reconnect': 'Επανασύνδεση',
|
||||
'docsync.connection.title': 'Σύνδεση',
|
||||
'docsync.connection.hint':
|
||||
'Η διεύθυνση και τα στοιχεία σύνδεσης που χρησιμοποιεί το TREK για αυτόν τον χώρο αποθήκευσης.',
|
||||
'docsync.connection.edit': 'Επεξεργασία σύνδεσης',
|
||||
'docsync.connection.remove': 'Αφαίρεση σύνδεσης',
|
||||
'docsync.connection.confirmRemove':
|
||||
'Το TREK ξεχνά τη διεύθυνση και τα στοιχεία σύνδεσης αυτού του χώρου αποθήκευσης και κάθε συγχρονισμός αυτού του ταξιδιού μέσω αυτού σταματά. Τα έγγραφα μένουν στο TREK και στον χώρο αποθήκευσης.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -184,6 +184,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Pénznem',
|
||||
'assistant.change.label.stopType': 'Megálló típusa',
|
||||
'assistant.change.label.text': 'Szöveg',
|
||||
'assistant.change.label.title': 'Cím',
|
||||
'assistant.change.label.content': 'Tartalom',
|
||||
'assistant.change.label.icon': 'Ikon',
|
||||
'assistant.change.label.color': 'Szín',
|
||||
'assistant.change.label.position': 'Pozíció',
|
||||
|
||||
@@ -183,6 +183,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Szüneteltetve: egy rendszergazda kikapcsolta ezt a szolgáltatót. A szinkronizálás folytatódik, amint újra bekapcsolják.',
|
||||
'docsync.binding.reconnect': 'Újracsatlakozás',
|
||||
'docsync.connection.title': 'Kapcsolat',
|
||||
'docsync.connection.hint': 'A cím és a bejelentkezés, amelyet a TREK ehhez a tárhoz használ.',
|
||||
'docsync.connection.edit': 'Kapcsolat szerkesztése',
|
||||
'docsync.connection.remove': 'Kapcsolat eltávolítása',
|
||||
'docsync.connection.confirmRemove':
|
||||
'A TREK elfelejti ennek a tárnak a címét és a bejelentkezést, és az utazás minden ezen keresztül futó szinkronizálása leáll. A dokumentumok a TREK-ben és a tárban is megmaradnak.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -176,6 +176,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Mata uang',
|
||||
'assistant.change.label.stopType': 'Jenis pemberhentian',
|
||||
'assistant.change.label.text': 'Teks',
|
||||
'assistant.change.label.title': 'Judul',
|
||||
'assistant.change.label.content': 'Isi',
|
||||
'assistant.change.label.icon': 'Ikon',
|
||||
'assistant.change.label.color': 'Warna',
|
||||
'assistant.change.label.position': 'Posisi',
|
||||
|
||||
@@ -181,6 +181,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Dijeda: administrator menonaktifkan penyedia ini. Sinkronisasi berlanjut setelah penyedia diaktifkan kembali.',
|
||||
'docsync.binding.reconnect': 'Hubungkan ulang',
|
||||
'docsync.connection.title': 'Koneksi',
|
||||
'docsync.connection.hint': 'Alamat dan login yang dipakai TREK untuk penyimpanan ini.',
|
||||
'docsync.connection.edit': 'Edit koneksi',
|
||||
'docsync.connection.remove': 'Hapus koneksi',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK melupakan alamat dan login penyimpanan ini, dan semua sinkronisasi perjalanan ini melaluinya berhenti. Dokumen tetap ada di TREK dan di penyimpanan.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -184,6 +184,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Valuta',
|
||||
'assistant.change.label.stopType': 'Tipo di tappa',
|
||||
'assistant.change.label.text': 'Testo',
|
||||
'assistant.change.label.title': 'Titolo',
|
||||
'assistant.change.label.content': 'Contenuto',
|
||||
'assistant.change.label.icon': 'Icona',
|
||||
'assistant.change.label.color': 'Colore',
|
||||
'assistant.change.label.position': 'Posizione',
|
||||
|
||||
@@ -182,6 +182,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'In pausa: un amministratore ha disattivato questo provider. La sincronizzazione riprende appena viene riattivato.',
|
||||
'docsync.binding.reconnect': 'Riconnetti',
|
||||
'docsync.connection.title': 'Connessione',
|
||||
'docsync.connection.hint': 'L’indirizzo e l’accesso che TREK usa per questo archivio.',
|
||||
'docsync.connection.edit': 'Modifica connessione',
|
||||
'docsync.connection.remove': 'Rimuovi connessione',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK dimentica l’indirizzo e l’accesso di questo archivio, e ogni sincronizzazione di questo viaggio attraverso di esso si ferma. I documenti restano in TREK e nell’archivio.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -176,6 +176,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': '通貨',
|
||||
'assistant.change.label.stopType': '立ち寄りの種類',
|
||||
'assistant.change.label.text': 'テキスト',
|
||||
'assistant.change.label.title': 'タイトル',
|
||||
'assistant.change.label.content': '内容',
|
||||
'assistant.change.label.icon': 'アイコン',
|
||||
'assistant.change.label.color': '色',
|
||||
'assistant.change.label.position': '位置',
|
||||
|
||||
@@ -175,6 +175,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'一時停止中:管理者がこの連携先を無効にしました。再び有効になると同期が再開されます。',
|
||||
'docsync.binding.reconnect': '再接続',
|
||||
'docsync.connection.title': '接続',
|
||||
'docsync.connection.hint': 'TREK がこのストレージに使うアドレスとログイン情報です。',
|
||||
'docsync.connection.edit': '接続を編集',
|
||||
'docsync.connection.remove': '接続を削除',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK はこのストレージのアドレスとログイン情報を削除し、この旅行のこのストレージ経由の同期はすべて止まります。ドキュメントは TREK とストレージの両方に残ります。',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -174,6 +174,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': '통화',
|
||||
'assistant.change.label.stopType': '경유지 유형',
|
||||
'assistant.change.label.text': '텍스트',
|
||||
'assistant.change.label.title': '제목',
|
||||
'assistant.change.label.content': '내용',
|
||||
'assistant.change.label.icon': '아이콘',
|
||||
'assistant.change.label.color': '색상',
|
||||
'assistant.change.label.position': '위치',
|
||||
|
||||
@@ -173,6 +173,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.unknown_provider': '이 저장소는 이 인스턴스에서 사용할 수 없습니다.',
|
||||
'docsync.error.provider_disabled': '일시 중지됨: 관리자가 이 저장소를 껐습니다. 다시 켜지면 동기화가 재개됩니다.',
|
||||
'docsync.binding.reconnect': '다시 연결',
|
||||
'docsync.connection.title': '연결',
|
||||
'docsync.connection.hint': 'TREK가 이 저장소에 사용하는 주소와 로그인 정보입니다.',
|
||||
'docsync.connection.edit': '연결 편집',
|
||||
'docsync.connection.remove': '연결 삭제',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK가 이 저장소의 주소와 로그인 정보를 지우고, 이 저장소를 통한 이 여행의 모든 동기화가 중단됩니다. 문서는 TREK와 저장소에 그대로 남습니다.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -182,6 +182,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Valuta',
|
||||
'assistant.change.label.stopType': 'Soort stop',
|
||||
'assistant.change.label.text': 'Tekst',
|
||||
'assistant.change.label.title': 'Titel',
|
||||
'assistant.change.label.content': 'Inhoud',
|
||||
'assistant.change.label.icon': 'Pictogram',
|
||||
'assistant.change.label.color': 'Kleur',
|
||||
'assistant.change.label.position': 'Positie',
|
||||
|
||||
@@ -179,6 +179,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Gepauzeerd: een beheerder heeft deze aanbieder uitgeschakeld. De synchronisatie gaat verder zodra hij weer aanstaat.',
|
||||
'docsync.binding.reconnect': 'Opnieuw verbinden',
|
||||
'docsync.connection.title': 'Verbinding',
|
||||
'docsync.connection.hint': 'Het adres en de login die TREK voor deze opslag gebruikt.',
|
||||
'docsync.connection.edit': 'Verbinding bewerken',
|
||||
'docsync.connection.remove': 'Verbinding verwijderen',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK vergeet het adres en de login van deze opslag, en elke synchronisatie van deze reis via deze opslag stopt. De documenten blijven in TREK en in de opslag.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -189,6 +189,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Waluta',
|
||||
'assistant.change.label.stopType': 'Rodzaj przystanku',
|
||||
'assistant.change.label.text': 'Tekst',
|
||||
'assistant.change.label.title': 'Tytuł',
|
||||
'assistant.change.label.content': 'Treść',
|
||||
'assistant.change.label.icon': 'Ikona',
|
||||
'assistant.change.label.color': 'Kolor',
|
||||
'assistant.change.label.position': 'Pozycja',
|
||||
|
||||
@@ -183,6 +183,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Wstrzymane: administrator wyłączył tego dostawcę. Synchronizacja zostanie wznowiona, gdy znów go włączy.',
|
||||
'docsync.binding.reconnect': 'Połącz ponownie',
|
||||
'docsync.connection.title': 'Połączenie',
|
||||
'docsync.connection.hint': 'Adres i dane logowania, których TREK używa dla tego magazynu.',
|
||||
'docsync.connection.edit': 'Edytuj połączenie',
|
||||
'docsync.connection.remove': 'Usuń połączenie',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK zapomina adres i dane logowania tego magazynu, a każda synchronizacja tej podróży przez niego się zatrzymuje. Dokumenty zostają w TREK i w magazynie.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -189,6 +189,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Валюта',
|
||||
'assistant.change.label.stopType': 'Тип остановки',
|
||||
'assistant.change.label.text': 'Текст',
|
||||
'assistant.change.label.title': 'Заголовок',
|
||||
'assistant.change.label.content': 'Содержание',
|
||||
'assistant.change.label.icon': 'Значок',
|
||||
'assistant.change.label.color': 'Цвет',
|
||||
'assistant.change.label.position': 'Позиция',
|
||||
|
||||
@@ -184,6 +184,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Приостановлено: администратор отключил этого провайдера. Синхронизация возобновится, как только его снова включат.',
|
||||
'docsync.binding.reconnect': 'Подключить заново',
|
||||
'docsync.connection.title': 'Подключение',
|
||||
'docsync.connection.hint': 'Адрес и данные входа, которые TREK использует для этого хранилища.',
|
||||
'docsync.connection.edit': 'Изменить подключение',
|
||||
'docsync.connection.remove': 'Удалить подключение',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK забудет адрес и данные входа для этого хранилища, и вся синхронизация этой поездки через него остановится. Документы останутся в TREK и в хранилище.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -184,6 +184,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Mena',
|
||||
'assistant.change.label.stopType': 'Typ zastávky',
|
||||
'assistant.change.label.text': 'Text', // same-as-en
|
||||
'assistant.change.label.title': 'Názov',
|
||||
'assistant.change.label.content': 'Obsah',
|
||||
'assistant.change.label.icon': 'Ikona',
|
||||
'assistant.change.label.color': 'Farba',
|
||||
'assistant.change.label.position': 'Poradie',
|
||||
|
||||
@@ -179,6 +179,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Pozastavené: správca tohto poskytovateľa vypol. Synchronizácia bude pokračovať, hneď ako ho znova zapne.',
|
||||
'docsync.binding.reconnect': 'Znova pripojiť',
|
||||
'docsync.connection.title': 'Pripojenie',
|
||||
'docsync.connection.hint': 'Adresa a prihlásenie, ktoré TREK pre toto úložisko používa.',
|
||||
'docsync.connection.edit': 'Upraviť pripojenie',
|
||||
'docsync.connection.remove': 'Odstrániť pripojenie',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK zabudne adresu a prihlásenie k tomuto úložisku a každá synchronizácia tejto cesty cez neho sa zastaví. Dokumenty zostanú v TREKu aj v úložisku.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -183,6 +183,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Valuta',
|
||||
'assistant.change.label.stopType': 'Typ av stopp',
|
||||
'assistant.change.label.text': 'Text', // same-as-en
|
||||
'assistant.change.label.title': 'Titel',
|
||||
'assistant.change.label.content': 'Innehåll',
|
||||
'assistant.change.label.icon': 'Ikon',
|
||||
'assistant.change.label.color': 'Färg',
|
||||
'assistant.change.label.position': 'Position', // same-as-en
|
||||
|
||||
@@ -176,6 +176,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Pausad: en administratör har stängt av den här leverantören. Synkroniseringen fortsätter när den slås på igen.',
|
||||
'docsync.binding.reconnect': 'Anslut igen',
|
||||
'docsync.connection.title': 'Anslutning',
|
||||
'docsync.connection.hint': 'Adressen och inloggningen som TREK använder för den här lagringen.',
|
||||
'docsync.connection.edit': 'Redigera anslutning',
|
||||
'docsync.connection.remove': 'Ta bort anslutning',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK glömmer adressen och inloggningen för den här lagringen, och all synkronisering av resan via den stoppas. Dokumenten finns kvar i TREK och i lagringen.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -174,6 +174,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'สกุลเงิน',
|
||||
'assistant.change.label.stopType': 'ประเภทจุดแวะ',
|
||||
'assistant.change.label.text': 'ข้อความ',
|
||||
'assistant.change.label.title': 'หัวข้อ',
|
||||
'assistant.change.label.content': 'เนื้อหา',
|
||||
'assistant.change.label.icon': 'ไอคอน',
|
||||
'assistant.change.label.color': 'สี',
|
||||
'assistant.change.label.position': 'ลำดับ',
|
||||
|
||||
@@ -173,6 +173,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'หยุดชั่วคราว: ผู้ดูแลระบบปิดผู้ให้บริการนี้ การซิงค์จะกลับมาทำงานเมื่อเปิดอีกครั้ง',
|
||||
'docsync.binding.reconnect': 'เชื่อมต่อใหม่',
|
||||
'docsync.connection.title': 'การเชื่อมต่อ',
|
||||
'docsync.connection.hint': 'ที่อยู่และข้อมูลเข้าสู่ระบบที่ TREK ใช้กับที่เก็บนี้',
|
||||
'docsync.connection.edit': 'แก้ไขการเชื่อมต่อ',
|
||||
'docsync.connection.remove': 'ลบการเชื่อมต่อ',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK จะลืมที่อยู่และข้อมูลเข้าสู่ระบบของที่เก็บนี้ และการซิงก์ทั้งหมดของทริปนี้ผ่านที่เก็บนี้จะหยุดลง เอกสารยังอยู่ใน TREK และในที่เก็บ',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -181,6 +181,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Para birimi',
|
||||
'assistant.change.label.stopType': 'Durak türü',
|
||||
'assistant.change.label.text': 'Metin',
|
||||
'assistant.change.label.title': 'Başlık',
|
||||
'assistant.change.label.content': 'İçerik',
|
||||
'assistant.change.label.icon': 'Simge',
|
||||
'assistant.change.label.color': 'Renk',
|
||||
'assistant.change.label.position': 'Sıra',
|
||||
|
||||
@@ -180,6 +180,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Duraklatıldı: bir yönetici bu sağlayıcıyı kapattı. Yeniden açıldığında eşitleme kaldığı yerden devam eder.',
|
||||
'docsync.binding.reconnect': 'Yeniden bağlan',
|
||||
'docsync.connection.title': 'Bağlantı',
|
||||
'docsync.connection.hint': 'TREK’in bu depo için kullandığı adres ve oturum bilgileri.',
|
||||
'docsync.connection.edit': 'Bağlantıyı düzenle',
|
||||
'docsync.connection.remove': 'Bağlantıyı kaldır',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK bu deponun adresini ve oturum bilgilerini unutur, bu seyahatin bu depo üzerinden yapılan tüm eşitlemeleri durur. Belgeler TREK’te ve depoda kalır.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -189,6 +189,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Валюта',
|
||||
'assistant.change.label.stopType': 'Тип зупинки',
|
||||
'assistant.change.label.text': 'Текст',
|
||||
'assistant.change.label.title': 'Заголовок',
|
||||
'assistant.change.label.content': 'Вміст',
|
||||
'assistant.change.label.icon': 'Значок',
|
||||
'assistant.change.label.color': 'Колір',
|
||||
'assistant.change.label.position': 'Позиція',
|
||||
|
||||
@@ -182,6 +182,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Призупинено: адміністратор вимкнув цього постачальника. Синхронізація відновиться, щойно його знову ввімкнуть.',
|
||||
'docsync.binding.reconnect': 'Підключити знову',
|
||||
'docsync.connection.title': 'Підключення',
|
||||
'docsync.connection.hint': 'Адреса й дані входу, які TREK використовує для цього сховища.',
|
||||
'docsync.connection.edit': 'Змінити підключення',
|
||||
'docsync.connection.remove': 'Видалити підключення',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK забуде адресу й дані входу для цього сховища, і вся синхронізація цієї подорожі через нього зупиниться. Документи залишаться в TREK і в сховищі.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -176,6 +176,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': 'Tiền tệ',
|
||||
'assistant.change.label.stopType': 'Loại điểm dừng',
|
||||
'assistant.change.label.text': 'Văn bản',
|
||||
'assistant.change.label.title': 'Tiêu đề',
|
||||
'assistant.change.label.content': 'Nội dung',
|
||||
'assistant.change.label.icon': 'Biểu tượng',
|
||||
'assistant.change.label.color': 'Màu',
|
||||
'assistant.change.label.position': 'Vị trí',
|
||||
|
||||
@@ -178,6 +178,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.provider_disabled':
|
||||
'Đã tạm dừng: quản trị viên đã tắt nhà cung cấp này. Việc đồng bộ sẽ tiếp tục khi nó được bật lại.',
|
||||
'docsync.binding.reconnect': 'Kết nối lại',
|
||||
'docsync.connection.title': 'Kết nối',
|
||||
'docsync.connection.hint': 'Địa chỉ và thông tin đăng nhập TREK dùng cho kho lưu trữ này.',
|
||||
'docsync.connection.edit': 'Sửa kết nối',
|
||||
'docsync.connection.remove': 'Xóa kết nối',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK quên địa chỉ và thông tin đăng nhập của kho lưu trữ này, và mọi đồng bộ của chuyến đi này qua kho đó đều dừng. Tài liệu vẫn còn trong TREK và trong kho lưu trữ.',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -170,6 +170,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': '貨幣',
|
||||
'assistant.change.label.stopType': '停靠類型',
|
||||
'assistant.change.label.text': '文字',
|
||||
'assistant.change.label.title': '標題',
|
||||
'assistant.change.label.content': '內容',
|
||||
'assistant.change.label.icon': '圖示',
|
||||
'assistant.change.label.color': '顏色',
|
||||
'assistant.change.label.position': '位置',
|
||||
|
||||
@@ -168,6 +168,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.unknown_provider': '這個提供者在此執行個體上無法使用。',
|
||||
'docsync.error.provider_disabled': '已暫停:管理員已停用此提供者。重新啟用後會繼續同步。',
|
||||
'docsync.binding.reconnect': '重新連線',
|
||||
'docsync.connection.title': '連線',
|
||||
'docsync.connection.hint': 'TREK 用於此儲存空間的位址與登入資訊。',
|
||||
'docsync.connection.edit': '編輯連線',
|
||||
'docsync.connection.remove': '移除連線',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK 會忘記此儲存空間的位址與登入資訊,此行程經由它的所有同步都會停止。文件仍保留在 TREK 與儲存空間中。',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -170,6 +170,8 @@ const assistant: TranslationStrings = {
|
||||
'assistant.change.label.currency': '货币',
|
||||
'assistant.change.label.stopType': '停靠类型',
|
||||
'assistant.change.label.text': '文本',
|
||||
'assistant.change.label.title': '标题',
|
||||
'assistant.change.label.content': '内容',
|
||||
'assistant.change.label.icon': '图标',
|
||||
'assistant.change.label.color': '颜色',
|
||||
'assistant.change.label.position': '位置',
|
||||
|
||||
@@ -167,6 +167,12 @@ const docsync: TranslationStrings = {
|
||||
'docsync.error.unknown_provider': '此实例不提供该文档服务。',
|
||||
'docsync.error.provider_disabled': '已暂停:管理员已关闭此文档服务。重新启用后将继续同步。',
|
||||
'docsync.binding.reconnect': '重新连接',
|
||||
'docsync.connection.title': '连接',
|
||||
'docsync.connection.hint': 'TREK 用于此存储的地址和登录信息。',
|
||||
'docsync.connection.edit': '编辑连接',
|
||||
'docsync.connection.remove': '移除连接',
|
||||
'docsync.connection.confirmRemove':
|
||||
'TREK 会忘记此存储的地址和登录信息,此行程经由它的所有同步都会停止。文档仍保留在 TREK 和存储中。',
|
||||
};
|
||||
|
||||
export default docsync;
|
||||
|
||||
@@ -101,8 +101,8 @@ Requires `trips:read` or `trips:write` scope.
|
||||
|
||||
| Tool | Description |
|
||||
|---|---|
|
||||
| `create_day_note` | Add a note to a specific day with optional time label and emoji icon. |
|
||||
| `update_day_note` | Edit a day note's text, time, or icon. |
|
||||
| `create_day_note` | Add a note to a specific day: `text` is the title, `time` the Markdown body (up to 2000 characters), plus an optional icon and colour. |
|
||||
| `update_day_note` | Edit a day note's title (`text`), body (`time`), icon, colour or position. |
|
||||
| `delete_day_note` | Remove a note from a day. |
|
||||
|
||||
### Accommodations
|
||||
|
||||
Reference in New Issue
Block a user