fix(acc): string enum

This commit is contained in:
Charles Driesler
2025-08-05 13:56:37 +01:00
parent 9096190568
commit b19c8477c7
3 changed files with 27 additions and 23 deletions
+22 -20
View File
@@ -1,3 +1,6 @@
import type { StringEnumValues } from '@speckle/shared'
import { StringEnum } from '@speckle/shared'
export const ImporterAutomateFunctions = {
svf2: {
functionId: '2909d29a9d',
@@ -5,26 +8,25 @@ export const ImporterAutomateFunctions = {
}
}
export const AccSyncItemStatuses = {
export const AccSyncItemStatuses = StringEnum([
// A new file version had been detected, and we are awaiting a processable file.
pending: 'pending',
'pending',
// We are actively processing the new file version. (The Automate function has been triggered.)
syncing: 'syncing',
failed: 'failed',
paused: 'paused',
succeeded: 'succeeded'
} as const
export type AccSyncItemStatus =
(typeof AccSyncItemStatuses)[keyof typeof AccSyncItemStatuses]
'syncing',
'failed',
'paused',
'succeeded'
])
export type AccSyncItemStatus = StringEnumValues<typeof AccSyncItemStatuses>
export const AccRegions = {
US: 'US',
EMEA: 'EMEA',
AUS: 'AUS',
CAN: 'CAN',
DEU: 'DEU',
IND: 'IND',
JPN: 'JPN',
GBR: 'GBR'
}
export type AccRegion = (typeof AccRegions)[keyof typeof AccRegions]
export const AccRegions = StringEnum([
'US',
'EMEA',
'AUS',
'CAN',
'DEU',
'IND',
'JPN',
'GBR'
])
export type AccRegion = StringEnumValues<typeof AccRegions>
@@ -8,8 +8,6 @@ export const reportAccSyncItemCreatedFactory =
async (payload: EventPayload<typeof AccSyncItemEvents.Created>) => {
const { projectId, syncItem } = payload.payload
console.log('ACC REPORT SYNC ITEM CREATED')
await deps.publish(ProjectSubscriptions.ProjectAccSyncItemUpdated, {
projectId,
projectAccSyncItemsUpdated: {
@@ -61,6 +61,7 @@ import {
import { throwIfAuthNotOk } from '@/modules/shared/helpers/errorHelper'
import { AccModuleDisabledError, SyncItemNotFoundError } from '@/modules/acc/errors/acc'
import { getFeatureFlags } from '@speckle/shared/environment'
import type { AccRegion } from '@/modules/acc/domain/constants'
const { FF_ACC_INTEGRATION_ENABLED, FF_AUTOMATE_MODULE_ENABLED } = getFeatureFlags()
@@ -133,7 +134,10 @@ const resolvers: Resolvers = {
}),
eventEmit: getEventBus().emit
})({
syncItem: input,
syncItem: {
...input,
accRegion: input.accRegion as AccRegion
},
creatorUserId: ctx.userId!
})
},