Files
speckle-connectors-dui/lib/bindings/definitions/ISendBinding.ts
T
Oğuzhan Koral 3b4aa93858 Feat: mocked bindings and logging to seq (#39)
* mocked bindings and logging to seq

* test deploy

* test deploy

* test deploy

* connectorless state

* remove logs

* remove more logs

* add flags to globalThus

* log with /api/events/raw

* log error link on prod over local account

* handle test query to distinguish self hosters

* throw again

* log again...

* sa and ra

* error policy non none

* attach server url to logs

* Add host app version

* rename name to slug

* remove useless re throw

* fix confusion on versions
2025-07-23 15:51:09 +01:00

71 lines
1.9 KiB
TypeScript

import type { ISendFilter } from '~~/lib/models/card/send'
import type {
IBinding,
IBindingSharedEvents
} from '~~/lib/bindings/definitions/IBinding'
import type { CardSetting } from '~/lib/models/card/setting'
import type { IModelCardSharedEvents } from '~/lib/models/card'
import type { ConversionResult } from '~/lib/conversions/conversionResult'
import type { CreateVersionArgs } from '~/lib/bridge/server'
export const ISendBindingKey = 'sendBinding'
export interface ISendBinding extends IBinding<ISendBindingEvents> {
getSendFilters: () => Promise<ISendFilter[]>
getSendSettings: () => Promise<CardSetting[]>
send: (modelId: string) => Promise<void>
cancelSend: (modelId: string) => Promise<void>
}
export interface ISendBindingEvents
extends IBindingSharedEvents,
IModelCardSharedEvents {
refreshSendFilters: () => void
setModelsExpired: (modelCardIds: string[]) => void
setModelSendResult: (args: {
modelCardId: string
versionId: string
sendConversionResults: ConversionResult[]
}) => void
setIdMap: (args: {
modelCardId: string
idMap: Record<string, string>
newSelectedObjectIds: string[]
}) => void
/**
* Use whenever want to cancel model card progress, it is used on Archicad so far since send operation blocks the UI thread.
*/
triggerCancel: (modelCardId: string) => void
triggerCreateVersion: (args: CreateVersionArgs) => void
}
export class MockedSendBinding implements ISendBinding {
public async getSendFilters() {
return await []
}
public async getSendSettings() {
return await []
}
public async send(_modelCardId: string) {
return await console.log('no way dude')
}
public async cancelSend(_modelCardId: string) {
return await console.log('no way dude')
}
public async showDevTools() {
await console.log('No way dude')
}
public async openUrl(url: string) {
await window.open(url)
}
public on() {
return
}
}