diff --git a/packages/server/modules/acc/domain/constants.ts b/packages/server/modules/acc/domain/constants.ts index efee7d348..5df31147b 100644 --- a/packages/server/modules/acc/domain/constants.ts +++ b/packages/server/modules/acc/domain/constants.ts @@ -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 -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 diff --git a/packages/server/modules/acc/events/eventListeners.ts b/packages/server/modules/acc/events/eventListeners.ts index ba656d3c6..08d51c636 100644 --- a/packages/server/modules/acc/events/eventListeners.ts +++ b/packages/server/modules/acc/events/eventListeners.ts @@ -8,8 +8,6 @@ export const reportAccSyncItemCreatedFactory = async (payload: EventPayload) => { const { projectId, syncItem } = payload.payload - console.log('ACC REPORT SYNC ITEM CREATED') - await deps.publish(ProjectSubscriptions.ProjectAccSyncItemUpdated, { projectId, projectAccSyncItemsUpdated: { diff --git a/packages/server/modules/acc/graph/resolvers/accSyncItems.ts b/packages/server/modules/acc/graph/resolvers/accSyncItems.ts index 37cdda96b..746000f9f 100644 --- a/packages/server/modules/acc/graph/resolvers/accSyncItems.ts +++ b/packages/server/modules/acc/graph/resolvers/accSyncItems.ts @@ -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! }) },