feat: align Archicad and Vectorworks with new ingestion flow

This commit is contained in:
Björn Steinhagen
2026-02-02 12:22:02 +02:00
parent bcb1729bed
commit b134edacaa
2 changed files with 69 additions and 33 deletions
+48 -21
View File
@@ -5,7 +5,8 @@ import { send, type Base } from '@speckle/objectsender'
import { provideApolloClient, useMutation } from '@vue/apollo-composable'
import {
versionDetailsQuery,
markReceivedVersionMutation
markReceivedVersionMutation,
createVersionMutation
} from '~/lib/graphql/mutationsAndQueries'
import { storeToRefs } from 'pinia'
import type { DUIAccount } from '~/store/accounts'
@@ -17,6 +18,7 @@ import type { ToastNotification } from '@speckle/ui-components'
import { ToastNotificationType } from '@speckle/ui-components'
import { useModelIngestion } from '../ingestion/composables/useModelIngestion'
import type { ISenderModelCard } from '../models/card/send'
import { useCheckGraphql } from '~/lib/core/composables/useCheckGraphql'
export type SendBatchViaBrowserArgs = {
modelCardId: string
@@ -469,33 +471,58 @@ export class ArchicadBridge {
private async createVersion(args: CreateVersionArgs) {
const hostAppStore = useHostAppStore()
const { completeIngestionWithVersion } = useModelIngestion()
const { canCreateModelIngestion } = useCheckGraphql()
const modelCard = hostAppStore.models.find(
(model) => model.modelCardId === args.modelCardId
) as ISenderModelCard
const canCreateIngestion = await canCreateModelIngestion(
modelCard.projectId,
modelCard.modelId,
modelCard.accountId
)
const ingestionId = hostAppStore.ingestionStatus[args.modelCardId]
if (!ingestionId) {
throw new Error(`Ingestion failed: Ingestion ID not found to create version.`)
}
if (canCreateIngestion.queryAvailable) {
const ingestionId = hostAppStore.ingestionStatus[args.modelCardId]
if (!ingestionId) {
throw new Error(`Ingestion failed: Ingestion ID not found to create version.`)
}
const res = await completeIngestionWithVersion(
modelCard as ISenderModelCard,
ingestionId,
args.referencedObjectId
)
if (res?.statusData.__typename === 'ModelIngestionSuccessStatus') {
return res?.statusData.versionId
}
if (res?.statusData.__typename === 'ModelIngestionFailedStatus') {
throw new Error(
`Ingestion failed: ${res?.statusData.errorReason || 'Unknown error'}.`
const res = await completeIngestionWithVersion(
modelCard,
ingestionId,
args.referencedObjectId
)
if (res?.statusData.__typename === 'ModelIngestionSuccessStatus') {
return res?.statusData.versionId
}
if (res?.statusData.__typename === 'ModelIngestionFailedStatus') {
throw new Error(
`Ingestion failed: ${res?.statusData.errorReason || 'Unknown error'}.`
)
}
throw new Error(
`Ingestion status does not match with the expected types as success or failure.`
)
} else {
const accountStore = useAccountStore()
const account = accountStore.getAccountClient(args.accountId)
const { mutate } = provideApolloClient(account)(() =>
useMutation(createVersionMutation)
)
const result = await mutate({
input: {
modelId: args.modelId,
objectId: args.referencedObjectId,
sourceApplication: args.sourceApplication || 'Archicad',
projectId: args.projectId
}
})
return result?.data?.versionMutations?.create?.id
}
throw new Error(
`Ingestion status does not match with the expected types as success or failure.`
)
}
}
+21 -12
View File
@@ -304,19 +304,28 @@ export const useHostAppStore = defineStore('hostAppStore', () => {
const modelCard = documentModelStore.value.models.find(
(m) => m.modelId === args.modelId && m.projectId === args.projectId
) as ISenderModelCard
const ingestionId = modelCard
? ingestionStatus.value[modelCard.modelCardId]
: undefined
if (ingestionId && modelCard) {
try {
await completeIngestionWithVersion(
modelCard,
ingestionId,
args.referencedObjectId
)
} catch (err) {
console.error(`completeIngestionWithVersion failed: ${err}`)
const { canCreateModelIngestion } = useCheckGraphql()
const canCreateIngestion = await canCreateModelIngestion(
args.projectId,
args.modelId,
args.accountId
)
if (canCreateIngestion.queryAvailable) {
const ingestionId = modelCard
? ingestionStatus.value[modelCard.modelCardId]
: undefined
if (ingestionId && modelCard) {
try {
await completeIngestionWithVersion(
modelCard,
ingestionId,
args.referencedObjectId
)
} catch (err) {
console.error(`completeIngestionWithVersion failed: ${err}`)
}
}
} else {
// Fallback to legacy flow (Old Server)