chore(server): run TS files directly (no compilation) (#5134)
* sort of works * type fixes * added option to run old way too
This commit is contained in:
committed by
GitHub
parent
e34a44bf66
commit
4b06f42db7
@@ -3,7 +3,8 @@
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import './bootstrap.js'
|
||||
import http from 'http'
|
||||
import express, { Express } from 'express'
|
||||
import type { Express } from 'express'
|
||||
import express from 'express'
|
||||
|
||||
// `express-async-errors` patches express to catch errors in async handlers. no variable needed
|
||||
import 'express-async-errors'
|
||||
@@ -24,7 +25,8 @@ import {
|
||||
} from '@/observability/components/express/expressLogging'
|
||||
|
||||
import { errorMetricsMiddlewareFactory } from '@/observability/components/express/metrics/errorMetrics'
|
||||
import prometheusClient, { Registry } from 'prom-client'
|
||||
import type { Registry } from 'prom-client'
|
||||
import prometheusClient from 'prom-client'
|
||||
|
||||
import { ApolloServer } from '@apollo/server'
|
||||
import { expressMiddleware } from '@apollo/server/express4'
|
||||
@@ -52,7 +54,7 @@ import {
|
||||
isRateLimiterEnabled
|
||||
} from '@/modules/shared/helpers/envHelper'
|
||||
import * as ModulesSetup from '@/modules/index'
|
||||
import { GraphQLContext, Optional } from '@/modules/shared/helpers/typeHelper'
|
||||
import type { GraphQLContext, Optional } from '@/modules/shared/helpers/typeHelper'
|
||||
|
||||
import { get, has, isString } from 'lodash-es'
|
||||
import { corsMiddlewareFactory } from '@/modules/core/configs/cors'
|
||||
@@ -74,7 +76,7 @@ import { initFactory as healthchecksInitFactory } from '@/healthchecks'
|
||||
import type { ReadinessHandler } from '@/healthchecks/types'
|
||||
import type ws from 'ws'
|
||||
import type { Server as MockWsServer } from 'mock-socket'
|
||||
import { SetOptional } from 'type-fest'
|
||||
import type { SetOptional } from 'type-fest'
|
||||
import {
|
||||
enterNewRequestContext,
|
||||
getRequestContext,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
import { DatabaseError } from '@/modules/shared/errors'
|
||||
import { ensureError } from '@speckle/shared'
|
||||
import { startupLogger } from '@/observability/logging'
|
||||
|
||||
@@ -44,6 +44,7 @@ const configs = [
|
||||
patterns: ['.*']
|
||||
}
|
||||
],
|
||||
'@typescript-eslint/consistent-type-imports': 'error',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
'@typescript-eslint/no-unsafe-return': 'error',
|
||||
'@typescript-eslint/no-floating-promises': 'error',
|
||||
|
||||
@@ -21,7 +21,7 @@ const aliases = {
|
||||
/**
|
||||
* EXTENSIONS TO EVALUATE FOR EXTENSIONLESS IMPORTS
|
||||
*/
|
||||
const extensions = ['.js', '.mjs', '.cjs', '.json']
|
||||
const extensions = ['.ts', '.js', '.mjs', '.cjs', '.json']
|
||||
|
||||
// Register the module hooks
|
||||
register('./esmLoader.js', {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import type {
|
||||
FreeConnectionsCalculator,
|
||||
FreeConnectionsCalculators
|
||||
} from '@/healthchecks/types'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ensureErrorOrWrapAsCause } from '@/modules/shared/errors/ensureError'
|
||||
import { join, merge } from 'lodash-es'
|
||||
import VError from 'verror'
|
||||
import {
|
||||
import type {
|
||||
FreeConnectionsCalculators,
|
||||
MultiDBCheck,
|
||||
ReadinessHandler,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { healthCheckLogger } from '@/observability/logging'
|
||||
import { highFrequencyMetricsCollectionPeriodMs } from '@/modules/shared/helpers/envHelper'
|
||||
import { handleLivenessFactory, handleReadinessFactory } from '@/healthchecks/health'
|
||||
import { FreeConnectionsCalculator, ReadinessHandler } from '@/healthchecks/types'
|
||||
import type { FreeConnectionsCalculator, ReadinessHandler } from '@/healthchecks/types'
|
||||
import { isRedisAlive } from '@/healthchecks/redis'
|
||||
import { areAllPostgresAlive } from '@/healthchecks/postgres'
|
||||
import { Application } from 'express'
|
||||
import type { Application } from 'express'
|
||||
import { knexFreeDbConnectionSamplerFactory } from '@/healthchecks/connectionPool'
|
||||
import { getAllRegisteredDbClients } from '@/modules/multiregion/utils/dbSelector'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { expect } from 'chai'
|
||||
import { isRedisAlive } from '@/healthchecks/redis'
|
||||
import { getInmemoryRedisClient } from '@/test/redisHelper'
|
||||
import Redis from 'ioredis'
|
||||
import type Redis from 'ioredis'
|
||||
|
||||
describe('Healthchecks @healthchecks', () => {
|
||||
describe('Redis health check @redis', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Redis from 'ioredis'
|
||||
import type Redis from 'ioredis'
|
||||
|
||||
export type CheckResponse = { isAlive: true } | { isAlive: false; err: unknown }
|
||||
export type RedisCheck = (params: { client: Redis }) => Promise<CheckResponse>
|
||||
|
||||
@@ -13,13 +13,9 @@ import {
|
||||
knexAsyncStackTracesEnabled
|
||||
} from '@/modules/shared/helpers/envHelper'
|
||||
import { dbLogger as logger } from '@/observability/logging'
|
||||
import { Knex } from 'knex'
|
||||
import {
|
||||
createKnexConfig,
|
||||
configureKnexClient,
|
||||
KnexConfigArgs,
|
||||
RegionServerConfig
|
||||
} from '@speckle/shared/environment/db'
|
||||
import type { Knex } from 'knex'
|
||||
import type { KnexConfigArgs, RegionServerConfig } from '@speckle/shared/environment/db'
|
||||
import { createKnexConfig, configureKnexClient } from '@speckle/shared/environment/db'
|
||||
|
||||
function walk(dir: string) {
|
||||
let results: string[] = []
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ServerAccessRequestRecord } from '@/modules/accessrequests/repositories'
|
||||
import { StreamRoles } from '@speckle/shared'
|
||||
import type { ServerAccessRequestRecord } from '@/modules/accessrequests/repositories'
|
||||
import type { StreamRoles } from '@speckle/shared'
|
||||
|
||||
export const accessRequestEventsNamespace = 'accessrequests' as const
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { StreamAccessRequestGraphQLReturn } from '@/modules/accessrequests/helpers/graphTypes'
|
||||
import {
|
||||
import type { StreamAccessRequestGraphQLReturn } from '@/modules/accessrequests/helpers/graphTypes'
|
||||
import type {
|
||||
AccessRequestType,
|
||||
ServerAccessRequestRecord,
|
||||
StreamAccessRequestRecord
|
||||
} from '@/modules/accessrequests/repositories'
|
||||
import { Nullable, Optional } from '@speckle/shared'
|
||||
import type { Nullable, Optional } from '@speckle/shared'
|
||||
|
||||
export type GetUsersPendingAccessRequest = <
|
||||
T extends AccessRequestType = AccessRequestType,
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
requestProjectAccessFactory,
|
||||
requestStreamAccessFactory
|
||||
} from '@/modules/accessrequests/services/stream'
|
||||
import { Resolvers } from '@/modules/core/graph/generated/graphql'
|
||||
import type { Resolvers } from '@/modules/core/graph/generated/graphql'
|
||||
import { mapStreamRoleToValue } from '@/modules/core/helpers/graphTypes'
|
||||
import { Roles } from '@/modules/core/helpers/mainConstants'
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { StreamAccessRequestRecord } from '@/modules/accessrequests/repositories'
|
||||
import { StreamAccessRequest } from '@/modules/core/graph/generated/graphql'
|
||||
import type { StreamAccessRequestRecord } from '@/modules/accessrequests/repositories'
|
||||
import type { StreamAccessRequest } from '@/modules/core/graph/generated/graphql'
|
||||
|
||||
export type StreamAccessRequestGraphQLReturn = Omit<
|
||||
StreamAccessRequest,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { moduleLogger } from '@/observability/logging'
|
||||
import { initializeEventListenerFactory } from '@/modules/accessrequests/services/eventListener'
|
||||
import { getStreamCollaboratorsFactory } from '@/modules/core/repositories/streams'
|
||||
import { publishNotification } from '@/modules/notifications/services/publication'
|
||||
import { Optional, SpeckleModule } from '@/modules/shared/helpers/typeHelper'
|
||||
import type { Optional, SpeckleModule } from '@/modules/shared/helpers/typeHelper'
|
||||
import { getEventBus } from '@/modules/shared/services/eventBus'
|
||||
|
||||
let quitListeners: Optional<() => void> = undefined
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
const TABLE_NAME = 'server_access_requests'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import type {
|
||||
AccessRecordInput,
|
||||
CreateNewRequest,
|
||||
DeleteRequestById,
|
||||
@@ -8,9 +8,9 @@ import {
|
||||
} from '@/modules/accessrequests/domain/operations'
|
||||
import { ServerAccessRequests, Streams } from '@/modules/core/dbSchema'
|
||||
import { InvalidArgumentError } from '@/modules/shared/errors'
|
||||
import { Nullable } from '@/modules/shared/helpers/typeHelper'
|
||||
import type { Nullable } from '@/modules/shared/helpers/typeHelper'
|
||||
import cryptoRandomString from 'crypto-random-string'
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
const tables = {
|
||||
serverAccessRequests: (db: Knex) => db(ServerAccessRequests.name)
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import { AccessRequestEvents } from '@/modules/accessrequests/domain/events'
|
||||
import { isStreamAccessRequest } from '@/modules/accessrequests/repositories'
|
||||
import { GetStreamCollaborators } from '@/modules/core/domain/streams/operations'
|
||||
import type { GetStreamCollaborators } from '@/modules/core/domain/streams/operations'
|
||||
import { Roles } from '@/modules/core/helpers/mainConstants'
|
||||
import {
|
||||
NotificationPublisher,
|
||||
NotificationType
|
||||
} from '@/modules/notifications/helpers/types'
|
||||
import { EventBus, EventPayload } from '@/modules/shared/services/eventBus'
|
||||
import type { NotificationPublisher } from '@/modules/notifications/helpers/types'
|
||||
import { NotificationType } from '@/modules/notifications/helpers/types'
|
||||
import type { EventBus, EventPayload } from '@/modules/shared/services/eventBus'
|
||||
|
||||
type OnServerAccessRequestCreatedDeps = {
|
||||
getStreamCollaborators: GetStreamCollaborators
|
||||
|
||||
@@ -2,23 +2,23 @@ import {
|
||||
AccessRequestCreationError,
|
||||
AccessRequestProcessingError
|
||||
} from '@/modules/accessrequests/errors'
|
||||
import { StreamAccessRequestGraphQLReturn } from '@/modules/accessrequests/helpers/graphTypes'
|
||||
import {
|
||||
AccessRequestType,
|
||||
generateId,
|
||||
import type { StreamAccessRequestGraphQLReturn } from '@/modules/accessrequests/helpers/graphTypes'
|
||||
import type {
|
||||
ServerAccessRequestRecord,
|
||||
StreamAccessRequestRecord
|
||||
} from '@/modules/accessrequests/repositories'
|
||||
import { AccessRequestType, generateId } from '@/modules/accessrequests/repositories'
|
||||
import { StreamInvalidAccessError } from '@/modules/core/errors/stream'
|
||||
import { TokenResourceIdentifier } from '@/modules/core/domain/tokens/types'
|
||||
import { Roles, StreamRoles } from '@/modules/core/helpers/mainConstants'
|
||||
import type { TokenResourceIdentifier } from '@/modules/core/domain/tokens/types'
|
||||
import type { StreamRoles } from '@/modules/core/helpers/mainConstants'
|
||||
import { Roles } from '@/modules/core/helpers/mainConstants'
|
||||
import { ensureError } from '@/modules/shared/helpers/errorHelper'
|
||||
import {
|
||||
import type {
|
||||
MaybeNullOrUndefined,
|
||||
Nullable,
|
||||
Optional
|
||||
} from '@/modules/shared/helpers/typeHelper'
|
||||
import {
|
||||
import type {
|
||||
CreateNewRequest,
|
||||
DeleteRequestById,
|
||||
GetPendingAccessRequest,
|
||||
@@ -29,12 +29,12 @@ import {
|
||||
GetUserStreamAccessRequest,
|
||||
RequestProjectAccess
|
||||
} from '@/modules/accessrequests/domain/operations'
|
||||
import {
|
||||
import type {
|
||||
AddOrUpdateStreamCollaborator,
|
||||
GetStream,
|
||||
ValidateStreamAccess
|
||||
} from '@/modules/core/domain/streams/operations'
|
||||
import { EventBusEmit } from '@/modules/shared/services/eventBus'
|
||||
import type { EventBusEmit } from '@/modules/shared/services/eventBus'
|
||||
import { AccessRequestEvents } from '@/modules/accessrequests/domain/events'
|
||||
|
||||
function buildStreamAccessRequestGraphQLReturn(
|
||||
|
||||
@@ -40,7 +40,8 @@ import {
|
||||
import { NotificationType } from '@/modules/notifications/helpers/types'
|
||||
import { authorizeResolver } from '@/modules/shared'
|
||||
import { getEventBus } from '@/modules/shared/services/eventBus'
|
||||
import { BasicTestUser, createTestUsers } from '@/test/authHelper'
|
||||
import type { BasicTestUser } from '@/test/authHelper'
|
||||
import { createTestUsers } from '@/test/authHelper'
|
||||
import {
|
||||
CreateProjectAccessRequestDocument,
|
||||
GetActiveUserFullProjectAccessRequestDocument,
|
||||
@@ -49,15 +50,16 @@ import {
|
||||
StreamRole,
|
||||
UseProjectAccessRequestDocument
|
||||
} from '@/modules/core/graph/generated/graphql'
|
||||
import { testApolloServer, TestApolloServer } from '@/test/graphqlHelper'
|
||||
import type { TestApolloServer } from '@/test/graphqlHelper'
|
||||
import { testApolloServer } from '@/test/graphqlHelper'
|
||||
import { truncateTables } from '@/test/hooks'
|
||||
import {
|
||||
buildNotificationsStateTracker,
|
||||
NotificationsStateManager
|
||||
} from '@/test/notificationsHelper'
|
||||
import type { NotificationsStateManager } from '@/test/notificationsHelper'
|
||||
import { buildNotificationsStateTracker } from '@/test/notificationsHelper'
|
||||
import { getStreamActivities } from '@/test/speckle-helpers/activityStreamHelper'
|
||||
import { createEmailListener, TestEmailListener } from '@/test/speckle-helpers/email'
|
||||
import { BasicTestStream, createTestStreams } from '@/test/speckle-helpers/streamHelper'
|
||||
import type { TestEmailListener } from '@/test/speckle-helpers/email'
|
||||
import { createEmailListener } from '@/test/speckle-helpers/email'
|
||||
import type { BasicTestStream } from '@/test/speckle-helpers/streamHelper'
|
||||
import { createTestStreams } from '@/test/speckle-helpers/streamHelper'
|
||||
import { expect } from 'chai'
|
||||
import { noop } from 'lodash-es'
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@ import {
|
||||
import { NotificationType } from '@/modules/notifications/helpers/types'
|
||||
import { authorizeResolver } from '@/modules/shared'
|
||||
import { getEventBus } from '@/modules/shared/services/eventBus'
|
||||
import { BasicTestUser, createTestUsers } from '@/test/authHelper'
|
||||
import type { BasicTestUser } from '@/test/authHelper'
|
||||
import { createTestUsers } from '@/test/authHelper'
|
||||
import {
|
||||
createStreamAccessRequest,
|
||||
getFullStreamAccessRequest,
|
||||
@@ -50,15 +51,16 @@ import {
|
||||
useStreamAccessRequest
|
||||
} from '@/test/graphql/accessRequests'
|
||||
import { StreamRole } from '@/modules/core/graph/generated/graphql'
|
||||
import { createAuthedTestContext, ServerAndContext } from '@/test/graphqlHelper'
|
||||
import type { ServerAndContext } from '@/test/graphqlHelper'
|
||||
import { createAuthedTestContext } from '@/test/graphqlHelper'
|
||||
import { truncateTables } from '@/test/hooks'
|
||||
import {
|
||||
buildNotificationsStateTracker,
|
||||
NotificationsStateManager
|
||||
} from '@/test/notificationsHelper'
|
||||
import type { NotificationsStateManager } from '@/test/notificationsHelper'
|
||||
import { buildNotificationsStateTracker } from '@/test/notificationsHelper'
|
||||
import { getStreamActivities } from '@/test/speckle-helpers/activityStreamHelper'
|
||||
import { createEmailListener, TestEmailListener } from '@/test/speckle-helpers/email'
|
||||
import { BasicTestStream, createTestStreams } from '@/test/speckle-helpers/streamHelper'
|
||||
import type { TestEmailListener } from '@/test/speckle-helpers/email'
|
||||
import { createEmailListener } from '@/test/speckle-helpers/email'
|
||||
import type { BasicTestStream } from '@/test/speckle-helpers/streamHelper'
|
||||
import { createTestStreams } from '@/test/speckle-helpers/streamHelper'
|
||||
import { expect } from 'chai'
|
||||
import { noop } from 'lodash-es'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import type {
|
||||
Activity,
|
||||
ActivitySummary,
|
||||
CommentCreatedActivityInput,
|
||||
@@ -7,12 +7,12 @@ import {
|
||||
ResourceType,
|
||||
StreamActionType
|
||||
} from '@/modules/activitystream/domain/types'
|
||||
import {
|
||||
import type {
|
||||
StreamActivityRecord,
|
||||
StreamScopeActivity
|
||||
} from '@/modules/activitystream/helpers/types'
|
||||
import { CommentRecord } from '@/modules/comments/helpers/types'
|
||||
import {
|
||||
import type { CommentRecord } from '@/modules/comments/helpers/types'
|
||||
import type {
|
||||
BranchDeleteInput,
|
||||
BranchUpdateInput,
|
||||
CommitCreateInput,
|
||||
@@ -24,13 +24,13 @@ import {
|
||||
UpdateModelInput,
|
||||
UpdateVersionInput
|
||||
} from '@/modules/core/graph/generated/graphql'
|
||||
import {
|
||||
import type {
|
||||
BranchRecord,
|
||||
CommitRecord,
|
||||
StreamAclRecord,
|
||||
StreamRecord
|
||||
} from '@/modules/core/helpers/types'
|
||||
import { Nullable } from '@speckle/shared'
|
||||
import type { Nullable } from '@speckle/shared'
|
||||
|
||||
export type GetUserStreamActivity = (
|
||||
streamId: string,
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import {
|
||||
import type {
|
||||
StreamActionTypes,
|
||||
StreamResourceTypes,
|
||||
StreamScopeActivity
|
||||
} from '@/modules/activitystream/helpers/types'
|
||||
import { ViewerResourceItem } from '@/modules/comments/domain/types'
|
||||
import {
|
||||
import type { ViewerResourceItem } from '@/modules/comments/domain/types'
|
||||
import type {
|
||||
CommentCreateInput,
|
||||
CreateCommentInput,
|
||||
CreateCommentReplyInput,
|
||||
ReplyCreateInput
|
||||
} from '@/modules/core/graph/generated/graphql'
|
||||
import { StreamRecord, UserRecord } from '@/modules/core/helpers/types'
|
||||
import type { StreamRecord, UserRecord } from '@/modules/core/helpers/types'
|
||||
import z from 'zod'
|
||||
|
||||
// Activity
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { EventBusListen, EventPayload } from '@/modules/shared/services/eventBus'
|
||||
import {
|
||||
import type { EventBusListen, EventPayload } from '@/modules/shared/services/eventBus'
|
||||
import type {
|
||||
AddStreamAccessRequestDeclinedActivity,
|
||||
AddStreamAccessRequestedActivity,
|
||||
SaveStreamActivity
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import type {
|
||||
AddBranchCreatedActivity,
|
||||
AddBranchDeletedActivity,
|
||||
AddBranchUpdatedActivity,
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from '@/modules/activitystream/helpers/types'
|
||||
import { ModelEvents } from '@/modules/core/domain/branches/events'
|
||||
import { isBranchDeleteInput, isBranchUpdateInput } from '@/modules/core/helpers/branch'
|
||||
import { EventBusListen } from '@/modules/shared/services/eventBus'
|
||||
import type { EventBusListen } from '@/modules/shared/services/eventBus'
|
||||
|
||||
/**
|
||||
* Save "branch created" activity
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import {
|
||||
import type {
|
||||
AddThreadCreatedActivity,
|
||||
AddReplyAddedActivity,
|
||||
SaveStreamActivity,
|
||||
AddCommentArchivedActivity
|
||||
} from '@/modules/activitystream/domain/operations'
|
||||
import {
|
||||
import type {
|
||||
CommentCreatedActivityInput,
|
||||
ReplyCreatedActivityInput
|
||||
} from '@/modules/activitystream/domain/types'
|
||||
@@ -12,11 +12,12 @@ import {
|
||||
StreamActionTypes,
|
||||
StreamResourceTypes
|
||||
} from '@/modules/activitystream/helpers/types'
|
||||
import { CommentEvents, CommentEventsPayloads } from '@/modules/comments/domain/events'
|
||||
import { ReplyCreateInput } from '@/modules/core/graph/generated/graphql'
|
||||
import { EventBusListen } from '@/modules/shared/services/eventBus'
|
||||
import type { CommentEventsPayloads } from '@/modules/comments/domain/events'
|
||||
import { CommentEvents } from '@/modules/comments/domain/events'
|
||||
import type { ReplyCreateInput } from '@/modules/core/graph/generated/graphql'
|
||||
import type { EventBusListen } from '@/modules/shared/services/eventBus'
|
||||
import { has } from 'lodash-es'
|
||||
import { OverrideProperties } from 'type-fest'
|
||||
import type { OverrideProperties } from 'type-fest'
|
||||
|
||||
const addThreadCreatedActivityFactory =
|
||||
({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import type {
|
||||
AddCommitCreatedActivity,
|
||||
AddCommitDeletedActivity,
|
||||
AddCommitUpdatedActivity,
|
||||
@@ -9,10 +9,10 @@ import {
|
||||
StreamResourceTypes
|
||||
} from '@/modules/activitystream/helpers/types'
|
||||
import { VersionEvents } from '@/modules/core/domain/commits/events'
|
||||
import { CommitCreateInput } from '@/modules/core/graph/generated/graphql'
|
||||
import { CommitRecord } from '@/modules/core/helpers/types'
|
||||
import { EventBusListen } from '@/modules/shared/services/eventBus'
|
||||
import { MaybeNullOrUndefined } from '@speckle/shared'
|
||||
import type { CommitCreateInput } from '@/modules/core/graph/generated/graphql'
|
||||
import type { CommitRecord } from '@/modules/core/helpers/types'
|
||||
import type { EventBusListen } from '@/modules/shared/services/eventBus'
|
||||
import type { MaybeNullOrUndefined } from '@speckle/shared'
|
||||
|
||||
/**
|
||||
* Save "new commit created" activity item
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { EventBusListen, EventPayload } from '@/modules/shared/services/eventBus'
|
||||
import type { EventBusListen, EventPayload } from '@/modules/shared/services/eventBus'
|
||||
import { GatekeeperEvents } from '@/modules/gatekeeperCore/domain/events'
|
||||
import { SaveActivity } from '@/modules/activitystream/domain/operations'
|
||||
import type { SaveActivity } from '@/modules/activitystream/domain/operations'
|
||||
|
||||
const addWorkspacePlanCreatedActivityFactory =
|
||||
({ saveActivity }: { saveActivity: SaveActivity }) =>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SaveStreamActivity } from '@/modules/activitystream/domain/operations'
|
||||
import type { SaveStreamActivity } from '@/modules/activitystream/domain/operations'
|
||||
import {
|
||||
StreamActionTypes,
|
||||
StreamResourceTypes
|
||||
@@ -9,8 +9,8 @@ import {
|
||||
getResourceTypeRole,
|
||||
resolveTarget
|
||||
} from '@/modules/serverinvites/helpers/core'
|
||||
import { GetProjectInviteProject } from '@/modules/serverinvites/services/operations'
|
||||
import { EventBusListen, EventPayload } from '@/modules/shared/services/eventBus'
|
||||
import type { GetProjectInviteProject } from '@/modules/serverinvites/services/operations'
|
||||
import type { EventBusListen, EventPayload } from '@/modules/shared/services/eventBus'
|
||||
import { Roles } from '@speckle/shared'
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import type {
|
||||
AddStreamDeletedActivity,
|
||||
AddStreamUpdatedActivity,
|
||||
SaveActivity,
|
||||
@@ -9,12 +9,12 @@ import {
|
||||
StreamResourceTypes
|
||||
} from '@/modules/activitystream/helpers/types'
|
||||
import { ProjectEvents } from '@/modules/core/domain/projects/events'
|
||||
import {
|
||||
import type {
|
||||
ProjectCreateInput,
|
||||
StreamCreateInput
|
||||
} from '@/modules/core/graph/generated/graphql'
|
||||
import { StreamRecord } from '@/modules/core/helpers/types'
|
||||
import { EventBusListen, EventPayload } from '@/modules/shared/services/eventBus'
|
||||
import type { StreamRecord } from '@/modules/core/helpers/types'
|
||||
import type { EventBusListen, EventPayload } from '@/modules/shared/services/eventBus'
|
||||
|
||||
// Activity
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { UserUpdateInput } from '@/modules/core/graph/generated/graphql'
|
||||
import { UserRecord } from '@/modules/core/helpers/types'
|
||||
import type { UserUpdateInput } from '@/modules/core/graph/generated/graphql'
|
||||
import type { UserRecord } from '@/modules/core/helpers/types'
|
||||
import {
|
||||
StreamActionTypes,
|
||||
StreamResourceTypes
|
||||
} from '@/modules/activitystream/helpers/types'
|
||||
import { SaveStreamActivity } from '@/modules/activitystream/domain/operations'
|
||||
import { EventBusListen, EventPayload } from '@/modules/shared/services/eventBus'
|
||||
import type { SaveStreamActivity } from '@/modules/activitystream/domain/operations'
|
||||
import type { EventBusListen, EventPayload } from '@/modules/shared/services/eventBus'
|
||||
import { UserEvents } from '@/modules/core/domain/users/events'
|
||||
|
||||
const addUserCreatedActivityFactory =
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { EventBusListen, EventPayload } from '@/modules/shared/services/eventBus'
|
||||
import { SaveActivity } from '@/modules/activitystream/domain/operations'
|
||||
import type { EventBusListen, EventPayload } from '@/modules/shared/services/eventBus'
|
||||
import type { SaveActivity } from '@/modules/activitystream/domain/operations'
|
||||
import { WorkspaceEvents } from '@/modules/workspacesCore/domain/events'
|
||||
|
||||
const addWorkspaceSeatUpdatedActivityFactory =
|
||||
|
||||
@@ -10,9 +10,9 @@ import {
|
||||
getUserActivityFactory,
|
||||
getUserTimelineFactory
|
||||
} from '@/modules/activitystream/repositories'
|
||||
import { Resolvers } from '@/modules/core/graph/generated/graphql'
|
||||
import type { Resolvers } from '@/modules/core/graph/generated/graphql'
|
||||
import { InvalidActionTypeError } from '@/modules/activitystream/errors/activityStream'
|
||||
import { StreamActionType } from '@/modules/activitystream/domain/types'
|
||||
import type { StreamActionType } from '@/modules/activitystream/domain/types'
|
||||
import { md5 } from '@/modules/shared/helpers/cryptoHelper'
|
||||
|
||||
type ActivityPaginatedArgs = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { StreamActivityRecord } from '@/modules/activitystream/helpers/types'
|
||||
import { ActivityCollection } from '@/modules/core/graph/generated/graphql'
|
||||
import type { StreamActivityRecord } from '@/modules/activitystream/helpers/types'
|
||||
import type { ActivityCollection } from '@/modules/core/graph/generated/graphql'
|
||||
|
||||
export type ActivityCollectionGraphQLReturn = Omit<ActivityCollection, 'items'> & {
|
||||
items: StreamActivityRecord[]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Nullable } from '@/modules/shared/helpers/typeHelper'
|
||||
import type { Nullable } from '@/modules/shared/helpers/typeHelper'
|
||||
|
||||
export type StreamActivityRecord = {
|
||||
streamId: Nullable<string>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import cron from 'node-cron'
|
||||
import { Optional, SpeckleModule } from '@/modules/shared/helpers/typeHelper'
|
||||
import type cron from 'node-cron'
|
||||
import type { Optional, SpeckleModule } from '@/modules/shared/helpers/typeHelper'
|
||||
import { publishNotification } from '@/modules/notifications/services/publication'
|
||||
import { moduleLogger } from '@/observability/logging'
|
||||
import { weeklyEmailDigestEnabled } from '@/modules/shared/helpers/envHelper'
|
||||
import { EventBus, getEventBus } from '@/modules/shared/services/eventBus'
|
||||
import type { EventBus } from '@/modules/shared/services/eventBus'
|
||||
import { getEventBus } from '@/modules/shared/services/eventBus'
|
||||
import { sendActivityNotificationsFactory } from '@/modules/activitystream/services/summary'
|
||||
import {
|
||||
getActiveUserStreamsFactory,
|
||||
@@ -12,13 +13,13 @@ import {
|
||||
} from '@/modules/activitystream/repositories'
|
||||
import { db } from '@/db/knex'
|
||||
import { getStreamFactory } from '@/modules/core/repositories/streams'
|
||||
import { ScheduleExecution } from '@/modules/core/domain/scheduledTasks/operations'
|
||||
import type { ScheduleExecution } from '@/modules/core/domain/scheduledTasks/operations'
|
||||
import { scheduleExecutionFactory } from '@/modules/core/services/taskScheduler'
|
||||
import {
|
||||
acquireTaskLockFactory,
|
||||
releaseTaskLockFactory
|
||||
} from '@/modules/core/repositories/scheduledTasks'
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
import { reportUserActivityFactory } from '@/modules/activitystream/events/userListeners'
|
||||
import { reportAccessRequestActivityFactory } from '@/modules/activitystream/events/accessRequestListeners'
|
||||
import { reportBranchActivityFactory } from '@/modules/activitystream/events/branchListeners'
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
const TABLE_NAME = 'stream_activity'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
await knex.schema.createTable('activity', (table) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import type {
|
||||
GetActiveUserStreams,
|
||||
GetActivities,
|
||||
GetActivityCountByResourceId,
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
SaveActivity,
|
||||
SaveStreamActivity
|
||||
} from '@/modules/activitystream/domain/operations'
|
||||
import {
|
||||
import type {
|
||||
StreamActivityRecord,
|
||||
StreamScopeActivity
|
||||
} from '@/modules/activitystream/helpers/types'
|
||||
@@ -22,19 +22,19 @@ import {
|
||||
StreamActivity
|
||||
} from '@/modules/core/dbSchema'
|
||||
import { Roles } from '@/modules/core/helpers/mainConstants'
|
||||
import { StreamAclRecord } from '@/modules/core/helpers/types'
|
||||
import type { StreamAclRecord } from '@/modules/core/helpers/types'
|
||||
import {
|
||||
createWebhookEventFactory,
|
||||
getStreamWebhooksFactory
|
||||
} from '@/modules/webhooks/repositories/webhooks'
|
||||
import { dispatchStreamEventFactory } from '@/modules/webhooks/services/webhooks'
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
import { getStreamFactory } from '@/modules/core/repositories/streams'
|
||||
import { getUserFactory } from '@/modules/core/repositories/users'
|
||||
import { getServerInfoFactory } from '@/modules/core/repositories/server'
|
||||
import { getProjectDbClient } from '@/modules/multiregion/utils/dbSelector'
|
||||
import cryptoRandomString from 'crypto-random-string'
|
||||
import { Activity } from '@/modules/activitystream/domain/types'
|
||||
import type { Activity } from '@/modules/activitystream/domain/types'
|
||||
|
||||
const tables = {
|
||||
streamActivity: <T extends object = StreamActivityRecord>(db: Knex) =>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Activity as ActivityModel, StreamAcl } from '@/modules/core/dbSchema'
|
||||
import { StreamAclRecord } from '@/modules/core/helpers/types'
|
||||
import { SubscriptionData } from '@/modules/gatekeeper/domain/billing'
|
||||
import { WorkspaceSeat } from '@/modules/workspacesCore/domain/types'
|
||||
import type { StreamAclRecord } from '@/modules/core/helpers/types'
|
||||
import type { SubscriptionData } from '@/modules/gatekeeper/domain/billing'
|
||||
import type { WorkspaceSeat } from '@/modules/workspacesCore/domain/types'
|
||||
import { WorkspaceSeats } from '@/modules/workspacesCore/helpers/db'
|
||||
import {
|
||||
import type {
|
||||
StreamRoles,
|
||||
WorkspacePlan,
|
||||
WorkspacePlanBillingIntervals,
|
||||
@@ -11,10 +11,10 @@ import {
|
||||
WorkspacePlanStatuses
|
||||
} from '@speckle/shared'
|
||||
import cryptoRandomString from 'crypto-random-string'
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
import { MaxBackfillIterationsReached } from '@/modules/activitystream/errors/activityStream'
|
||||
import { Logger } from '@/observability/logging'
|
||||
import { Activity } from '@/modules/activitystream/domain/types'
|
||||
import type { Logger } from '@/observability/logging'
|
||||
import type { Activity } from '@/modules/activitystream/domain/types'
|
||||
|
||||
export const getUntrackedWorkspaceSeatsFactory =
|
||||
({ db }: { db: Knex }) =>
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
import {
|
||||
NotificationPublisher,
|
||||
NotificationType
|
||||
} from '@/modules/notifications/helpers/types'
|
||||
import {
|
||||
import type { NotificationPublisher } from '@/modules/notifications/helpers/types'
|
||||
import { NotificationType } from '@/modules/notifications/helpers/types'
|
||||
import type {
|
||||
CreateActivitySummary,
|
||||
GetActiveUserStreams,
|
||||
GetUserStreamActivity
|
||||
} from '@/modules/activitystream/domain/operations'
|
||||
import { GetStream } from '@/modules/core/domain/streams/operations'
|
||||
import { GetUser } from '@/modules/core/domain/users/operations'
|
||||
import type { GetStream } from '@/modules/core/domain/streams/operations'
|
||||
import type { GetUser } from '@/modules/core/domain/users/operations'
|
||||
|
||||
export const createActivitySummaryFactory =
|
||||
({
|
||||
|
||||
@@ -50,8 +50,10 @@ import { createObjectFactory } from '@/modules/core/services/objects/management'
|
||||
import { storeSingleObjectIfNotFoundFactory } from '@/modules/core/repositories/objects'
|
||||
import { getEventBus } from '@/modules/shared/services/eventBus'
|
||||
import type http from 'node:http'
|
||||
import { BasicTestStream, createTestStream } from '@/test/speckle-helpers/streamHelper'
|
||||
import { BasicTestBranch, createTestBranch } from '@/test/speckle-helpers/branchHelper'
|
||||
import type { BasicTestStream } from '@/test/speckle-helpers/streamHelper'
|
||||
import { createTestStream } from '@/test/speckle-helpers/streamHelper'
|
||||
import type { BasicTestBranch } from '@/test/speckle-helpers/branchHelper'
|
||||
import { createTestBranch } from '@/test/speckle-helpers/branchHelper'
|
||||
import { getActivitiesFactory } from '@/modules/activitystream/repositories/index'
|
||||
|
||||
const getUser = getUserFactory({ db })
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { truncateTables } from '@/test/hooks'
|
||||
import { BasicTestUser, createTestUsers } from '@/test/authHelper'
|
||||
import type { BasicTestUser } from '@/test/authHelper'
|
||||
import { createTestUsers } from '@/test/authHelper'
|
||||
import { StreamActivity, Users } from '@/modules/core/dbSchema'
|
||||
import {
|
||||
createActivitySummaryFactory,
|
||||
@@ -10,7 +11,7 @@ import {
|
||||
StreamActionTypes,
|
||||
StreamResourceTypes
|
||||
} from '@/modules/activitystream/helpers/types'
|
||||
import {
|
||||
import type {
|
||||
ActivityDigestMessage,
|
||||
NotificationType,
|
||||
NotificationTypeMessageMap
|
||||
|
||||
@@ -14,11 +14,12 @@ import {
|
||||
} from '@/modules/activitystream/services/backfillActivity'
|
||||
import { expect } from 'chai'
|
||||
import { WorkspaceSeats } from '@/modules/workspacesCore/helpers/db'
|
||||
import { WorkspaceSeat, WorkspaceSeatType } from '@/modules/workspacesCore/domain/types'
|
||||
import type { WorkspaceSeat } from '@/modules/workspacesCore/domain/types'
|
||||
import { WorkspaceSeatType } from '@/modules/workspacesCore/domain/types'
|
||||
import { saveActivityFactory } from '@/modules/activitystream/repositories'
|
||||
import { buildTestWorkspaceSubscription } from '@/modules/gatekeeper/tests/helpers/workspacePlan'
|
||||
import { SubscriptionData } from '@/modules/gatekeeper/domain/billing'
|
||||
import { StreamAclRecord } from '@/modules/core/helpers/types'
|
||||
import type { SubscriptionData } from '@/modules/gatekeeper/domain/billing'
|
||||
import type { StreamAclRecord } from '@/modules/core/helpers/types'
|
||||
import { StreamAcl } from '@/modules/core/dbSchema'
|
||||
import { Roles } from '@speckle/shared'
|
||||
import { getFeatureFlags } from '@/modules/shared/helpers/envHelper'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SpeckleModule } from '@/modules/shared/helpers/typeHelper'
|
||||
import type { SpeckleModule } from '@/modules/shared/helpers/typeHelper'
|
||||
import { moduleLogger } from '@/observability/logging'
|
||||
import { readFile } from 'fs/promises'
|
||||
import { getFrontendOrigin } from '@/modules/shared/helpers/envHelper'
|
||||
|
||||
@@ -4,8 +4,8 @@ import {
|
||||
getServerOrigin,
|
||||
getFeatureFlags
|
||||
} from '@/modules/shared/helpers/envHelper'
|
||||
import { ServerScope } from '@speckle/shared'
|
||||
import { Merge } from 'type-fest'
|
||||
import type { ServerScope } from '@speckle/shared'
|
||||
import type { Merge } from 'type-fest'
|
||||
|
||||
const { FF_WORKSPACES_MODULE_ENABLED, FF_AUTOMATE_MODULE_ENABLED } = getFeatureFlags()
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import { DefaultAppWithUnwrappedScopes } from '@/modules/auth/defaultApps'
|
||||
import {
|
||||
import type { DefaultAppWithUnwrappedScopes } from '@/modules/auth/defaultApps'
|
||||
import type {
|
||||
FullServerApp,
|
||||
ServerAppListItem,
|
||||
UserServerApp
|
||||
} from '@/modules/auth/domain/types'
|
||||
import { ScopeRecord } from '@/modules/auth/helpers/types'
|
||||
import {
|
||||
import type { ScopeRecord } from '@/modules/auth/helpers/types'
|
||||
import type {
|
||||
AuthorizationCodeRecord,
|
||||
RefreshTokenRecord
|
||||
} from '@/modules/auth/repositories'
|
||||
import { ServerAppRecord } from '@/modules/core/helpers/types'
|
||||
import { MarkNullableOptional } from '@/modules/shared/helpers/typeHelper'
|
||||
import { Optional, ServerScope } from '@speckle/shared'
|
||||
import { SetOptional } from 'type-fest'
|
||||
import type { ServerAppRecord } from '@/modules/core/helpers/types'
|
||||
import type { MarkNullableOptional } from '@/modules/shared/helpers/typeHelper'
|
||||
import type { Optional, ServerScope } from '@speckle/shared'
|
||||
import type { SetOptional } from 'type-fest'
|
||||
import type { Handler } from 'express'
|
||||
import { Strategy, AuthenticateOptions } from 'passport'
|
||||
import type { Strategy, AuthenticateOptions } from 'passport'
|
||||
|
||||
export type GetApp = (params: { id: string }) => Promise<FullServerApp | null>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ScopeRecord } from '@/modules/auth/helpers/types'
|
||||
import { ServerAppRecord, UserRecord } from '@/modules/core/helpers/types'
|
||||
import type { ScopeRecord } from '@/modules/auth/helpers/types'
|
||||
import type { ServerAppRecord, UserRecord } from '@/modules/core/helpers/types'
|
||||
|
||||
export type UserServerApp = ServerAppRecord & {
|
||||
author: Pick<UserRecord, 'id' | 'name' | 'avatar'> | null
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
revokeExistingAppCredentialsForUserFactory
|
||||
} from '@/modules/auth/repositories/apps'
|
||||
import { db } from '@/db/knex'
|
||||
import { Resolvers } from '@/modules/core/graph/generated/graphql'
|
||||
import type { Resolvers } from '@/modules/core/graph/generated/graphql'
|
||||
import { withOperationLogging } from '@/observability/domain/businessLogging'
|
||||
|
||||
const getApp = getAppFactory({ db })
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getAuthStrategies } from '@/modules/auth'
|
||||
import { Resolvers } from '@/modules/core/graph/generated/graphql'
|
||||
import type { Resolvers } from '@/modules/core/graph/generated/graphql'
|
||||
|
||||
export default {
|
||||
ServerInfo: {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import type {
|
||||
ServerAppListItem,
|
||||
FullServerApp,
|
||||
UserServerApp
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { MaybeAsync, ServerScope } from '@speckle/shared'
|
||||
import type { MaybeAsync, ServerScope } from '@speckle/shared'
|
||||
import type { Express, RequestHandler } from 'express'
|
||||
import type { Session, SessionData } from 'express-session'
|
||||
import type { TokenSet, UserinfoResponse } from 'openid-client'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SpeckleModule } from '@/modules/shared/helpers/typeHelper'
|
||||
import type { SpeckleModule } from '@/modules/shared/helpers/typeHelper'
|
||||
|
||||
import { registerOrUpdateScopeFactory } from '@/modules/shared/repositories/scopes'
|
||||
import { moduleLogger } from '@/observability/logging'
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
} from '@/modules/serverinvites/repositories/serverInvites'
|
||||
import authRestApi from '@/modules/auth/rest/index'
|
||||
import authScopes from '@/modules/auth/scopes'
|
||||
import { AuthStrategyMetadata } from '@/modules/auth/helpers/types'
|
||||
import type { AuthStrategyMetadata } from '@/modules/auth/helpers/types'
|
||||
import azureAdStrategyBuilderFactory from '@/modules/auth/strategies/azureAd'
|
||||
import googleStrategyBuilderFactory from '@/modules/auth/strategies/google'
|
||||
import localStrategyBuilderFactory from '@/modules/auth/strategies/local'
|
||||
|
||||
@@ -9,12 +9,12 @@ import {
|
||||
getSessionSecret
|
||||
} from '@/modules/shared/helpers/envHelper'
|
||||
import { isString, noop } from 'lodash-es'
|
||||
import { CreateAuthorizationCode } from '@/modules/auth/domain/operations'
|
||||
import type { CreateAuthorizationCode } from '@/modules/auth/domain/operations'
|
||||
import { ensureError, TIME_MS } from '@speckle/shared'
|
||||
import { LegacyGetUser } from '@/modules/core/domain/users/operations'
|
||||
import type { LegacyGetUser } from '@/modules/core/domain/users/operations'
|
||||
import { ForbiddenError } from '@/modules/shared/errors'
|
||||
import { UserInputError } from '@/modules/core/errors/userinput'
|
||||
import { EventBusEmit } from '@/modules/shared/services/eventBus'
|
||||
import type { EventBusEmit } from '@/modules/shared/services/eventBus'
|
||||
import { UserEvents } from '@/modules/core/domain/users/events'
|
||||
|
||||
export const sessionMiddlewareFactory = (): RequestHandler => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { logger, moduleLogger } from '@/observability/logging'
|
||||
import { getDefaultApp } from '@/modules/auth/defaultApps'
|
||||
import {
|
||||
import type {
|
||||
CreateApp,
|
||||
CreateAuthorizationCode,
|
||||
CreateRefreshToken,
|
||||
@@ -21,13 +21,13 @@ import {
|
||||
UpdateApp,
|
||||
UpdateDefaultApp
|
||||
} from '@/modules/auth/domain/operations'
|
||||
import {
|
||||
import type {
|
||||
ScopeRecord,
|
||||
ServerAppsScopesRecord,
|
||||
TokenScopeRecord,
|
||||
UserServerAppTokenRecord
|
||||
} from '@/modules/auth/helpers/types'
|
||||
import {
|
||||
import type {
|
||||
ApiTokenRecord,
|
||||
AuthorizationCodeRecord,
|
||||
RefreshTokenRecord
|
||||
@@ -43,9 +43,9 @@ import {
|
||||
Users,
|
||||
UserServerAppTokens
|
||||
} from '@/modules/core/dbSchema'
|
||||
import { ServerAppRecord, UserRecord } from '@/modules/core/helpers/types'
|
||||
import type { ServerAppRecord, UserRecord } from '@/modules/core/helpers/types'
|
||||
import cryptoRandomString from 'crypto-random-string'
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
import { difference, omit } from 'lodash-es'
|
||||
import { AppCreateError } from '@/modules/auth/errors'
|
||||
import { UserInputError } from '@/modules/core/errors/userinput'
|
||||
|
||||
@@ -6,12 +6,12 @@ import {
|
||||
knex
|
||||
} from '@/modules/core/dbSchema'
|
||||
import { InvalidArgumentError } from '@/modules/shared/errors'
|
||||
import { Nullable } from '@/modules/shared/helpers/typeHelper'
|
||||
import { ServerAppsScopesRecord } from '@/modules/auth/helpers/types'
|
||||
import type { Nullable } from '@/modules/shared/helpers/typeHelper'
|
||||
import type { ServerAppsScopesRecord } from '@/modules/auth/helpers/types'
|
||||
import { groupBy, mapValues } from 'lodash-es'
|
||||
import { TokenScopeData } from '@/modules/shared/domain/rolesAndScopes/types'
|
||||
import { Knex } from 'knex'
|
||||
import {
|
||||
import type { TokenScopeData } from '@/modules/shared/domain/rolesAndScopes/types'
|
||||
import type { Knex } from 'knex'
|
||||
import type {
|
||||
DeleteExistingUserAuthTokens,
|
||||
GetAppScopes
|
||||
} from '@/modules/auth/domain/operations'
|
||||
|
||||
@@ -5,7 +5,8 @@ import {
|
||||
} from '@/modules/core/services/tokens'
|
||||
import { validateScopes } from '@/modules/shared'
|
||||
import { InvalidAccessCodeRequestError } from '@/modules/auth/errors'
|
||||
import { ensureError, Optional, Scopes } from '@speckle/shared'
|
||||
import type { Optional } from '@speckle/shared'
|
||||
import { ensureError, Scopes } from '@speckle/shared'
|
||||
import { BadRequestError, ForbiddenError } from '@/modules/shared/errors'
|
||||
import {
|
||||
getAppFactory,
|
||||
@@ -22,7 +23,7 @@ import {
|
||||
createAppTokenFromAccessCodeFactory,
|
||||
refreshAppTokenFactory
|
||||
} from '@/modules/auth/services/serverApps'
|
||||
import { Express } from 'express'
|
||||
import type { Express } from 'express'
|
||||
import {
|
||||
getApiTokenByIdFactory,
|
||||
getTokenResourceAccessDefinitionsByIdFactory,
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
import mailchimp from '@mailchimp/mailchimp_marketing'
|
||||
import { md5 } from '@/modules/shared/helpers/cryptoHelper'
|
||||
import { getMailchimpConfig } from '@/modules/shared/helpers/envHelper'
|
||||
import { UserRecord } from '@/modules/core/helpers/types'
|
||||
import type { UserRecord } from '@/modules/core/helpers/types'
|
||||
import { MisconfiguredEnvironmentError } from '@/modules/shared/errors'
|
||||
import { OnboardingCompletionInput } from '@/modules/core/graph/generated/graphql'
|
||||
import type { OnboardingCompletionInput } from '@/modules/core/graph/generated/graphql'
|
||||
|
||||
let mailchimpInitialized = false
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getDefaultApps } from '@/modules/auth/defaultApps'
|
||||
import {
|
||||
import type {
|
||||
CreateAppTokenFromAccessCode,
|
||||
CreateRefreshToken,
|
||||
DeleteAuthorizationCode,
|
||||
@@ -12,10 +12,10 @@ import {
|
||||
RevokeRefreshToken,
|
||||
UpdateDefaultApp
|
||||
} from '@/modules/auth/domain/operations'
|
||||
import { ScopeRecord } from '@/modules/auth/helpers/types'
|
||||
import { CreateAndStoreAppToken } from '@/modules/core/domain/tokens/operations'
|
||||
import { createBareToken } from '@/modules/core/services/tokens'
|
||||
import { ServerScope } from '@speckle/shared'
|
||||
import type { ScopeRecord } from '@/modules/auth/helpers/types'
|
||||
import type { CreateAndStoreAppToken } from '@/modules/core/domain/tokens/operations'
|
||||
import type { createBareToken } from '@/modules/core/services/tokens'
|
||||
import type { ServerScope } from '@speckle/shared'
|
||||
import bcrypt from 'bcrypt'
|
||||
import {
|
||||
AccessCodeNotFoundError,
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import passport from 'passport'
|
||||
import type { Express } from 'express'
|
||||
import {
|
||||
import type {
|
||||
AuthStrategyBuilder,
|
||||
AuthStrategyMetadata,
|
||||
AuthStrategyPassportUser
|
||||
} from '@/modules/auth/helpers/types'
|
||||
import { CreateAuthorizationCode } from '@/modules/auth/domain/operations'
|
||||
import type { CreateAuthorizationCode } from '@/modules/auth/domain/operations'
|
||||
import {
|
||||
finalizeAuthMiddlewareFactory,
|
||||
moveAuthParamsToSessionMiddlewareFactory,
|
||||
sessionMiddlewareFactory
|
||||
} from '@/modules/auth/middleware'
|
||||
import { LegacyGetUser } from '@/modules/core/domain/users/operations'
|
||||
import { EventBusEmit } from '@/modules/shared/services/eventBus'
|
||||
import type { LegacyGetUser } from '@/modules/core/domain/users/operations'
|
||||
import type { EventBusEmit } from '@/modules/shared/services/eventBus'
|
||||
|
||||
const setupStrategiesFactory =
|
||||
(deps: {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* istanbul ignore file */
|
||||
import passport from 'passport'
|
||||
import { OIDCStrategy, IProfile, VerifyCallback } from 'passport-azure-ad'
|
||||
import type { IProfile, VerifyCallback } from 'passport-azure-ad'
|
||||
import { OIDCStrategy } from 'passport-azure-ad'
|
||||
|
||||
import {
|
||||
UserInputError,
|
||||
@@ -9,7 +10,7 @@ import {
|
||||
|
||||
import { ServerInviteResourceType } from '@/modules/serverinvites/domain/constants'
|
||||
import { getResourceTypeRole } from '@/modules/serverinvites/helpers/core'
|
||||
import { AuthStrategyBuilder } from '@/modules/auth/helpers/types'
|
||||
import type { AuthStrategyBuilder } from '@/modules/auth/helpers/types'
|
||||
import {
|
||||
getAzureAdClientId,
|
||||
getAzureAdClientSecret,
|
||||
@@ -18,19 +19,20 @@ import {
|
||||
getServerOrigin
|
||||
} from '@/modules/shared/helpers/envHelper'
|
||||
import type { Request } from 'express'
|
||||
import { ensureError, Optional } from '@speckle/shared'
|
||||
import { ServerInviteRecord } from '@/modules/serverinvites/domain/types'
|
||||
import {
|
||||
import type { Optional } from '@speckle/shared'
|
||||
import { ensureError } from '@speckle/shared'
|
||||
import type { ServerInviteRecord } from '@/modules/serverinvites/domain/types'
|
||||
import type {
|
||||
FinalizeInvitedServerRegistration,
|
||||
ResolveAuthRedirectPath,
|
||||
ValidateServerInvite
|
||||
} from '@/modules/serverinvites/services/operations'
|
||||
import { PassportAuthenticateHandlerBuilder } from '@/modules/auth/domain/operations'
|
||||
import {
|
||||
import type { PassportAuthenticateHandlerBuilder } from '@/modules/auth/domain/operations'
|
||||
import type {
|
||||
FindOrCreateValidatedUser,
|
||||
LegacyGetUserByEmail
|
||||
} from '@/modules/core/domain/users/operations'
|
||||
import { GetServerInfo } from '@/modules/core/domain/server/operations'
|
||||
import type { GetServerInfo } from '@/modules/core/domain/server/operations'
|
||||
import { EnvironmentResourceError } from '@/modules/shared/errors'
|
||||
import { InviteNotFoundError } from '@/modules/serverinvites/errors'
|
||||
|
||||
|
||||
@@ -10,7 +10,10 @@ import {
|
||||
|
||||
import { ServerInviteResourceType } from '@/modules/serverinvites/domain/constants'
|
||||
import { getResourceTypeRole } from '@/modules/serverinvites/helpers/core'
|
||||
import { AuthStrategyBuilder, AuthStrategyMetadata } from '@/modules/auth/helpers/types'
|
||||
import type {
|
||||
AuthStrategyBuilder,
|
||||
AuthStrategyMetadata
|
||||
} from '@/modules/auth/helpers/types'
|
||||
import {
|
||||
getGithubClientId,
|
||||
getGithubClientSecret,
|
||||
@@ -18,23 +21,24 @@ import {
|
||||
} from '@/modules/shared/helpers/envHelper'
|
||||
import type { Request } from 'express'
|
||||
import { get } from 'lodash-es'
|
||||
import { ensureError, Optional } from '@speckle/shared'
|
||||
import { ServerInviteRecord } from '@/modules/serverinvites/domain/types'
|
||||
import {
|
||||
import type { Optional } from '@speckle/shared'
|
||||
import { ensureError } from '@speckle/shared'
|
||||
import type { ServerInviteRecord } from '@/modules/serverinvites/domain/types'
|
||||
import type {
|
||||
FinalizeInvitedServerRegistration,
|
||||
ResolveAuthRedirectPath,
|
||||
ValidateServerInvite
|
||||
} from '@/modules/serverinvites/services/operations'
|
||||
import { PassportAuthenticateHandlerBuilder } from '@/modules/auth/domain/operations'
|
||||
import {
|
||||
import type { PassportAuthenticateHandlerBuilder } from '@/modules/auth/domain/operations'
|
||||
import type {
|
||||
FindOrCreateValidatedUser,
|
||||
LegacyGetUserByEmail
|
||||
} from '@/modules/core/domain/users/operations'
|
||||
import crs from 'crypto-random-string'
|
||||
import { GetServerInfo } from '@/modules/core/domain/server/operations'
|
||||
import type { GetServerInfo } from '@/modules/core/domain/server/operations'
|
||||
import { EnvironmentResourceError } from '@/modules/shared/errors'
|
||||
import { InviteNotFoundError } from '@/modules/serverinvites/errors'
|
||||
import { ExpectedAuthFailure } from '@/modules/auth/domain/const'
|
||||
import type { ExpectedAuthFailure } from '@/modules/auth/domain/const'
|
||||
|
||||
const githubStrategyBuilderFactory =
|
||||
(deps: {
|
||||
|
||||
@@ -9,24 +9,28 @@ import {
|
||||
|
||||
import { ServerInviteResourceType } from '@/modules/serverinvites/domain/constants'
|
||||
import { getResourceTypeRole } from '@/modules/serverinvites/helpers/core'
|
||||
import { AuthStrategyMetadata, AuthStrategyBuilder } from '@/modules/auth/helpers/types'
|
||||
import type {
|
||||
AuthStrategyMetadata,
|
||||
AuthStrategyBuilder
|
||||
} from '@/modules/auth/helpers/types'
|
||||
import {
|
||||
getGoogleClientId,
|
||||
getGoogleClientSecret
|
||||
} from '@/modules/shared/helpers/envHelper'
|
||||
import { ensureError, Optional } from '@speckle/shared'
|
||||
import { ServerInviteRecord } from '@/modules/serverinvites/domain/types'
|
||||
import {
|
||||
import type { Optional } from '@speckle/shared'
|
||||
import { ensureError } from '@speckle/shared'
|
||||
import type { ServerInviteRecord } from '@/modules/serverinvites/domain/types'
|
||||
import type {
|
||||
FinalizeInvitedServerRegistration,
|
||||
ResolveAuthRedirectPath,
|
||||
ValidateServerInvite
|
||||
} from '@/modules/serverinvites/services/operations'
|
||||
import { PassportAuthenticateHandlerBuilder } from '@/modules/auth/domain/operations'
|
||||
import {
|
||||
import type { PassportAuthenticateHandlerBuilder } from '@/modules/auth/domain/operations'
|
||||
import type {
|
||||
FindOrCreateValidatedUser,
|
||||
LegacyGetUserByEmail
|
||||
} from '@/modules/core/domain/users/operations'
|
||||
import { GetServerInfo } from '@/modules/core/domain/server/operations'
|
||||
import type { GetServerInfo } from '@/modules/core/domain/server/operations'
|
||||
import { EnvironmentResourceError } from '@/modules/shared/errors'
|
||||
import { ExpectedAuthFailure } from '@/modules/auth/domain/const'
|
||||
import { ServerNoAccessError } from '@speckle/shared/authz'
|
||||
|
||||
@@ -3,20 +3,24 @@ import { getIpFromRequest } from '@/modules/shared/utils/ip'
|
||||
import { UserInputError } from '@/modules/core/errors/userinput'
|
||||
import { ServerInviteResourceType } from '@/modules/serverinvites/domain/constants'
|
||||
import { getResourceTypeRole } from '@/modules/serverinvites/helpers/core'
|
||||
import { AuthStrategyMetadata, AuthStrategyBuilder } from '@/modules/auth/helpers/types'
|
||||
import { ServerInviteRecord } from '@/modules/serverinvites/domain/types'
|
||||
import { ensureError, Optional } from '@speckle/shared'
|
||||
import {
|
||||
import type {
|
||||
AuthStrategyMetadata,
|
||||
AuthStrategyBuilder
|
||||
} from '@/modules/auth/helpers/types'
|
||||
import type { ServerInviteRecord } from '@/modules/serverinvites/domain/types'
|
||||
import type { Optional } from '@speckle/shared'
|
||||
import { ensureError } from '@speckle/shared'
|
||||
import type {
|
||||
FinalizeInvitedServerRegistration,
|
||||
ResolveAuthRedirectPath,
|
||||
ValidateServerInvite
|
||||
} from '@/modules/serverinvites/services/operations'
|
||||
import {
|
||||
import type {
|
||||
CreateValidatedUser,
|
||||
LegacyGetUserByEmail,
|
||||
ValidateUserPassword
|
||||
} from '@/modules/core/domain/users/operations'
|
||||
import { GetServerInfo } from '@/modules/core/domain/server/operations'
|
||||
import type { GetServerInfo } from '@/modules/core/domain/server/operations'
|
||||
import { UserValidationError } from '@/modules/core/errors/user'
|
||||
import {
|
||||
resolveErrorInfo,
|
||||
|
||||
@@ -15,21 +15,22 @@ import {
|
||||
import { getNameFromUserInfo } from '@/modules/auth/helpers/oidc'
|
||||
import { ServerInviteResourceType } from '@/modules/serverinvites/domain/constants'
|
||||
import { getResourceTypeRole } from '@/modules/serverinvites/helpers/core'
|
||||
import { AuthStrategyBuilder } from '@/modules/auth/helpers/types'
|
||||
import type { AuthStrategyBuilder } from '@/modules/auth/helpers/types'
|
||||
import { get } from 'lodash-es'
|
||||
import { ensureError, Optional } from '@speckle/shared'
|
||||
import { ServerInviteRecord } from '@/modules/serverinvites/domain/types'
|
||||
import {
|
||||
import type { Optional } from '@speckle/shared'
|
||||
import { ensureError } from '@speckle/shared'
|
||||
import type { ServerInviteRecord } from '@/modules/serverinvites/domain/types'
|
||||
import type {
|
||||
FinalizeInvitedServerRegistration,
|
||||
ResolveAuthRedirectPath,
|
||||
ValidateServerInvite
|
||||
} from '@/modules/serverinvites/services/operations'
|
||||
import { PassportAuthenticateHandlerBuilder } from '@/modules/auth/domain/operations'
|
||||
import {
|
||||
import type { PassportAuthenticateHandlerBuilder } from '@/modules/auth/domain/operations'
|
||||
import type {
|
||||
FindOrCreateValidatedUser,
|
||||
LegacyGetUserByEmail
|
||||
} from '@/modules/core/domain/users/operations'
|
||||
import { GetServerInfo } from '@/modules/core/domain/server/operations'
|
||||
import type { GetServerInfo } from '@/modules/core/domain/server/operations'
|
||||
import { EnvironmentResourceError } from '@/modules/shared/errors'
|
||||
import { InviteNotFoundError } from '@/modules/serverinvites/errors'
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ import {
|
||||
} from '@/modules/core/repositories/tokens'
|
||||
import { getServerInfoFactory } from '@/modules/core/repositories/server'
|
||||
import { getEventBus } from '@/modules/shared/services/eventBus'
|
||||
import { BasicTestUser } from '@/test/authHelper'
|
||||
import type { BasicTestUser } from '@/test/authHelper'
|
||||
|
||||
let sendRequest: Awaited<ReturnType<typeof initializeTestServer>>['sendRequest']
|
||||
|
||||
|
||||
@@ -67,10 +67,11 @@ import {
|
||||
} from '@/modules/core/repositories/tokens'
|
||||
import { getServerInfoFactory } from '@/modules/core/repositories/server'
|
||||
import { getEventBus } from '@/modules/shared/services/eventBus'
|
||||
import { BasicTestUser } from '@/test/authHelper'
|
||||
import { AppScopes, ensureError } from '@speckle/shared'
|
||||
import { ValidTokenResult } from '@/modules/core/helpers/types'
|
||||
import {
|
||||
import type { BasicTestUser } from '@/test/authHelper'
|
||||
import type { AppScopes } from '@speckle/shared'
|
||||
import { ensureError } from '@speckle/shared'
|
||||
import type { ValidTokenResult } from '@/modules/core/helpers/types'
|
||||
import type {
|
||||
DefaultAppIds,
|
||||
DefaultAppWithUnwrappedScopes
|
||||
} from '@/modules/auth/defaultApps'
|
||||
|
||||
@@ -1,33 +1,35 @@
|
||||
import { db } from '@/db/knex'
|
||||
import {
|
||||
generateRegistrationParams,
|
||||
localAuthRestApi,
|
||||
import type {
|
||||
LocalAuthRestApiHelpers,
|
||||
LoginParams
|
||||
} from '@/modules/auth/tests/helpers/registration'
|
||||
import {
|
||||
generateRegistrationParams,
|
||||
localAuthRestApi
|
||||
} from '@/modules/auth/tests/helpers/registration'
|
||||
import { AllScopes } from '@/modules/core/helpers/mainConstants'
|
||||
import { updateServerInfoFactory } from '@/modules/core/repositories/server'
|
||||
import { findInviteFactory } from '@/modules/serverinvites/repositories/serverInvites'
|
||||
import { LogicError } from '@/modules/shared/errors'
|
||||
import { getFeatureFlags } from '@/modules/shared/helpers/envHelper'
|
||||
import { expectToThrow, itEach } from '@/test/assertionHelper'
|
||||
import { BasicTestUser, createTestUsers } from '@/test/authHelper'
|
||||
import {
|
||||
CreateProjectInviteDocument,
|
||||
import type { BasicTestUser } from '@/test/authHelper'
|
||||
import { createTestUsers } from '@/test/authHelper'
|
||||
import type {
|
||||
CreateProjectInviteMutationVariables,
|
||||
CreateServerInviteDocument,
|
||||
CreateServerInviteMutationVariables,
|
||||
UseStreamInviteDocument
|
||||
CreateServerInviteMutationVariables
|
||||
} from '@/modules/core/graph/generated/graphql'
|
||||
import {
|
||||
createTestContext,
|
||||
testApolloServer,
|
||||
TestApolloServer
|
||||
} from '@/test/graphqlHelper'
|
||||
CreateProjectInviteDocument,
|
||||
CreateServerInviteDocument,
|
||||
UseStreamInviteDocument
|
||||
} from '@/modules/core/graph/generated/graphql'
|
||||
import type { TestApolloServer } from '@/test/graphqlHelper'
|
||||
import { createTestContext, testApolloServer } from '@/test/graphqlHelper'
|
||||
import { beforeEachContext } from '@/test/hooks'
|
||||
import { captureCreatedInvite } from '@/test/speckle-helpers/inviteHelper'
|
||||
import type { BasicTestStream } from '@/test/speckle-helpers/streamHelper'
|
||||
import {
|
||||
BasicTestStream,
|
||||
createTestStreams,
|
||||
getUserStreamRole
|
||||
} from '@/test/speckle-helpers/streamHelper'
|
||||
|
||||
@@ -10,10 +10,10 @@ import type {
|
||||
FunctionSchemaType,
|
||||
FunctionWithVersionsSchemaType
|
||||
} from '@/modules/automate/helpers/executionEngine'
|
||||
import type { VersionCreationTriggerType } from '@/modules/automate/helpers/types'
|
||||
import {
|
||||
type AutomationFunctionRunRecord,
|
||||
type BaseTriggerManifest,
|
||||
VersionCreationTriggerType,
|
||||
isVersionCreatedTriggerManifest
|
||||
} from '@/modules/automate/helpers/types'
|
||||
import type { AuthCodePayload } from '@/modules/automate/services/authCode'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import type {
|
||||
AutomationFunctionRunRecord,
|
||||
AutomationRecord,
|
||||
AutomationRunRecord,
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
BaseTriggerManifest,
|
||||
RunTriggerSource
|
||||
} from '@/modules/automate/helpers/types'
|
||||
import {
|
||||
import type {
|
||||
InsertableAutomationRun,
|
||||
StoredInsertableAutomationRevision
|
||||
} from '@/modules/automate/repositories/automations'
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import {
|
||||
AutomationRunStatus,
|
||||
AutomationRunStatuses
|
||||
} from '@/modules/automate/helpers/types'
|
||||
import type { AutomationRunStatus } from '@/modules/automate/helpers/types'
|
||||
import { AutomationRunStatuses } from '@/modules/automate/helpers/types'
|
||||
|
||||
export const isFinished = (runStatus: AutomationRunStatus) => {
|
||||
const finishedStatuses: AutomationRunStatus[] = [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { InsertableAutomationFunctionRun } from '@/modules/automate/domain/types'
|
||||
import {
|
||||
import type { InsertableAutomationFunctionRun } from '@/modules/automate/domain/types'
|
||||
import type {
|
||||
AutomationRevisionFunctionRecord,
|
||||
AutomationFunctionRunRecord,
|
||||
AutomationRecord,
|
||||
@@ -15,16 +15,20 @@ import {
|
||||
BaseTriggerManifest,
|
||||
RunTriggerSource
|
||||
} from '@/modules/automate/helpers/types'
|
||||
import {
|
||||
import type {
|
||||
InsertableAutomationRevision,
|
||||
InsertableAutomationRun
|
||||
} from '@/modules/automate/repositories/automations'
|
||||
import { AuthCodePayload } from '@/modules/automate/services/authCode'
|
||||
import { ProjectAutomationCreateInput } from '@/modules/core/graph/generated/graphql'
|
||||
import { ContextResourceAccessRules } from '@/modules/core/helpers/token'
|
||||
import { BranchRecord, CommitRecord, StreamRecord } from '@/modules/core/helpers/types'
|
||||
import { Nullable, Optional, StreamRoles } from '@speckle/shared'
|
||||
import { SetRequired } from 'type-fest'
|
||||
import type { AuthCodePayload } from '@/modules/automate/services/authCode'
|
||||
import type { ProjectAutomationCreateInput } from '@/modules/core/graph/generated/graphql'
|
||||
import type { ContextResourceAccessRules } from '@/modules/core/helpers/token'
|
||||
import type {
|
||||
BranchRecord,
|
||||
CommitRecord,
|
||||
StreamRecord
|
||||
} from '@/modules/core/helpers/types'
|
||||
import type { Nullable, Optional, StreamRoles } from '@speckle/shared'
|
||||
import type { SetRequired } from 'type-fest'
|
||||
|
||||
export type StoreAutomation = (
|
||||
automation: AutomationRecord
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
import type {
|
||||
AutomationFunctionRunRecord,
|
||||
AutomationRunTriggerRecord,
|
||||
AutomationTriggerType
|
||||
} from '@/modules/automate/helpers/types'
|
||||
import { BranchRecord, CommitRecord } from '@/modules/core/helpers/types'
|
||||
import type { BranchRecord, CommitRecord } from '@/modules/core/helpers/types'
|
||||
|
||||
export type InsertableAutomationFunctionRun = Pick<
|
||||
AutomationFunctionRunRecord,
|
||||
|
||||
@@ -5,14 +5,14 @@ import {
|
||||
FunctionNotFoundError
|
||||
} from '@/modules/automate/errors/management'
|
||||
import { functionTemplateRepos } from '@/modules/automate/helpers/executionEngine'
|
||||
import {
|
||||
import type {
|
||||
AutomationRevisionTriggerDefinitionGraphQLReturn,
|
||||
AutomationRunTriggerGraphQLReturn
|
||||
} from '@/modules/automate/helpers/graphTypes'
|
||||
import { VersionCreationTriggerType } from '@/modules/automate/helpers/types'
|
||||
import { BranchCommits, Branches, Commits } from '@/modules/core/dbSchema'
|
||||
import { AutomateRunStatus } from '@/modules/core/graph/generated/graphql'
|
||||
import { SpeckleModuleMocksConfig } from '@/modules/shared/helpers/mocks'
|
||||
import type { SpeckleModuleMocksConfig } from '@/modules/shared/helpers/mocks'
|
||||
import { getFeatureFlags } from '@/modules/shared/helpers/envHelper'
|
||||
import { faker } from '@faker-js/faker'
|
||||
import { Automate, isNullOrUndefined, SourceAppNames } from '@speckle/shared'
|
||||
|
||||
@@ -11,8 +11,8 @@ import {
|
||||
getUserFunctionsFactory,
|
||||
regenerateFunctionToken
|
||||
} from '@/modules/automate/clients/executionEngine'
|
||||
import type { GetProjectAutomationsParams } from '@/modules/automate/repositories/automations'
|
||||
import {
|
||||
GetProjectAutomationsParams,
|
||||
getAutomationFactory,
|
||||
getAutomationRunsItemsFactory,
|
||||
getAutomationRunsTotalCountFactory,
|
||||
@@ -53,10 +53,8 @@ import {
|
||||
regenerateFunctionTokenFactory,
|
||||
updateFunctionFactory
|
||||
} from '@/modules/automate/services/functionManagement'
|
||||
import {
|
||||
Resolvers,
|
||||
AutomateRunTriggerType
|
||||
} from '@/modules/core/graph/generated/graphql'
|
||||
import type { Resolvers } from '@/modules/core/graph/generated/graphql'
|
||||
import { AutomateRunTriggerType } from '@/modules/core/graph/generated/graphql'
|
||||
import { getGenericRedis } from '@/modules/shared/redis/redis'
|
||||
import { createAutomation as clientCreateAutomation } from '@/modules/automate/clients/executionEngine'
|
||||
import {
|
||||
@@ -81,14 +79,14 @@ import {
|
||||
AutomationNotFoundError,
|
||||
FunctionNotFoundError
|
||||
} from '@/modules/automate/errors/management'
|
||||
import type { FunctionReleaseSchemaType } from '@/modules/automate/helpers/executionEngine'
|
||||
import {
|
||||
FunctionReleaseSchemaType,
|
||||
dbToGraphqlTriggerTypeMap,
|
||||
functionTemplateRepos
|
||||
} from '@/modules/automate/helpers/executionEngine'
|
||||
import { authorizeResolver } from '@/modules/shared'
|
||||
import type { AutomationRevisionFunctionForInputRedaction } from '@/modules/automate/services/encryption'
|
||||
import {
|
||||
AutomationRevisionFunctionForInputRedaction,
|
||||
getEncryptionKeyPair,
|
||||
getEncryptionKeyPairFor,
|
||||
getEncryptionPublicKey,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Resolvers } from '@/modules/core/graph/generated/graphql'
|
||||
import type { Resolvers } from '@/modules/core/graph/generated/graphql'
|
||||
import { Authz } from '@speckle/shared'
|
||||
|
||||
export default {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
AutomateFunctionTemplateLanguage,
|
||||
AutomateRunTriggerType
|
||||
} from '@/modules/core/graph/generated/graphql'
|
||||
import { Nullable, SourceAppName } from '@speckle/shared'
|
||||
import type { Nullable, SourceAppName } from '@speckle/shared'
|
||||
|
||||
// TODO: These should be managed in a shared package maybe?
|
||||
export type FunctionSchemaType = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import type {
|
||||
AutomationRevisionFunctionRecord,
|
||||
AutomationFunctionRunRecord,
|
||||
AutomationRecord,
|
||||
@@ -8,15 +8,15 @@ import {
|
||||
AutomationRunWithTriggersFunctionRuns,
|
||||
AutomationTriggerDefinitionRecord
|
||||
} from '@/modules/automate/helpers/types'
|
||||
import {
|
||||
import type {
|
||||
AutomateFunction,
|
||||
AutomateFunctionRelease,
|
||||
ProjectAutomationsUpdatedMessage,
|
||||
ProjectTriggeredAutomationsStatusUpdatedMessageType,
|
||||
TriggeredAutomationsStatus
|
||||
} from '@/modules/core/graph/generated/graphql'
|
||||
import { Nullable } from '@speckle/shared'
|
||||
import { Merge, SetOptional } from 'type-fest'
|
||||
import type { Nullable } from '@speckle/shared'
|
||||
import type { Merge, SetOptional } from 'type-fest'
|
||||
|
||||
export type AutomateFunctionGraphQLReturn = Pick<
|
||||
AutomateFunction,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Automate, Nullable } from '@speckle/shared'
|
||||
import type { Automate, Nullable } from '@speckle/shared'
|
||||
|
||||
export type AutomationRecord = {
|
||||
id: string
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { automateLogger, moduleLogger } from '@/observability/logging'
|
||||
import { Optional, SpeckleModule } from '@/modules/shared/helpers/typeHelper'
|
||||
import type { Optional, SpeckleModule } from '@/modules/shared/helpers/typeHelper'
|
||||
import {
|
||||
onModelVersionCreateFactory,
|
||||
triggerAutomationRevisionRunFactory
|
||||
@@ -29,7 +29,7 @@ import { buildDecryptor } from '@/modules/shared/utils/libsodium'
|
||||
import { getUserEmailFromAutomationRunFactory } from '@/modules/automate/services/tracking'
|
||||
import authGithubAppRest from '@/modules/automate/rest/authGithubApp'
|
||||
import { getFeatureFlags, isTestEnv } from '@/modules/shared/helpers/envHelper'
|
||||
import { TokenScopeData } from '@/modules/shared/domain/rolesAndScopes/types'
|
||||
import type { TokenScopeData } from '@/modules/shared/domain/rolesAndScopes/types'
|
||||
import { db } from '@/db/knex'
|
||||
import { ProjectSubscriptions, publish } from '@/modules/shared/utils/subscriptions'
|
||||
import { getBranchLatestCommitsFactory } from '@/modules/core/repositories/branches'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
const AUTOMATIONS_TABLE_NAME = 'automations'
|
||||
const AUTOMATION_RUNS_TABLE_NAME = 'automation_runs'
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
const AUTOMATIONS_TABLE_NAME = 'automations'
|
||||
const AUTOMATION_RUNS_TABLE_NAME = 'automation_runs'
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
const TABLE_NAME = 'automation_function_runs'
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
const AUTOMATIONS_TABLE_NAME = 'automations'
|
||||
const AUTOMATION_RUNS_TABLE_NAME = 'automation_runs'
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
const AUTOMATION_FUNCTION_RUNS_TABLE_NAME = 'automation_function_runs'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
const AUTOMATIONS_TABLE_NAME_OLD = 'automations'
|
||||
const AUTOMATION_RUNS_TABLE_NAME_OLD = 'automation_runs'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
const AUTOMATIONS_TABLE_NAME = 'automations'
|
||||
const REVISIONS_TABLE_NAME = 'automation_revisions'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
const REVISIONS_TABLE_NAME = 'automation_revisions'
|
||||
const TRIGGERS_TABLE_NAME = 'automation_triggers'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
const REVISIONS_TABLE_NAME = 'automation_revisions'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
await knex.schema.createTable('automation_tokens', (table) => {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
const TABLE_NAME = 'automation_function_runs'
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
const AUTOMATION_REVISIONS_TABLE = 'automation_revisions'
|
||||
const AUTOMATION_REVISION_FUNCTIONS_TABLE = 'automation_revision_functions'
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
const AUTOMATIONS_TABLE = 'automations'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
const AUTOMATIONS_TABLE_NAME_NEW = 'beta_automations'
|
||||
const AUTOMATION_RUNS_TABLE_NAME_NEW = 'beta_automation_runs'
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
await knex.schema.alterTable('automation_revision_functions', (table) => {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
await knex.schema.alterTable('automations', (table) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import type {
|
||||
MarkAutomationDeleted,
|
||||
GetActiveTriggerDefinitions,
|
||||
GetAutomation,
|
||||
@@ -29,11 +29,11 @@ import {
|
||||
UpsertAutomationFunctionRun,
|
||||
UpsertAutomationRun
|
||||
} from '@/modules/automate/domain/operations'
|
||||
import {
|
||||
import type {
|
||||
AutomationRunFullTrigger,
|
||||
InsertableAutomationFunctionRun
|
||||
} from '@/modules/automate/domain/types'
|
||||
import {
|
||||
import type {
|
||||
AutomationRecord,
|
||||
AutomationRevisionRecord,
|
||||
AutomationTriggerDefinitionRecord,
|
||||
@@ -45,7 +45,9 @@ import {
|
||||
AutomationRunTriggerRecord,
|
||||
AutomationFunctionRunRecord,
|
||||
AutomationRevisionWithTriggersFunctions,
|
||||
AutomationTriggerType,
|
||||
AutomationTriggerType
|
||||
} from '@/modules/automate/helpers/types'
|
||||
import {
|
||||
VersionCreationTriggerType,
|
||||
isVersionCreatedTrigger
|
||||
} from '@/modules/automate/helpers/types'
|
||||
@@ -65,11 +67,11 @@ import {
|
||||
Streams,
|
||||
knex
|
||||
} from '@/modules/core/dbSchema'
|
||||
import {
|
||||
import type {
|
||||
AutomationRunsArgs,
|
||||
ProjectAutomationsArgs
|
||||
} from '@/modules/core/graph/generated/graphql'
|
||||
import { StreamRecord } from '@/modules/core/helpers/types'
|
||||
import type { StreamRecord } from '@/modules/core/helpers/types'
|
||||
|
||||
import {
|
||||
executeBatchedSelect,
|
||||
@@ -80,11 +82,12 @@ import {
|
||||
decodeIsoDateCursor,
|
||||
encodeIsoDateCursor
|
||||
} from '@/modules/shared/helpers/dbHelper'
|
||||
import { Nullable, StreamRoles, isNullOrUndefined } from '@speckle/shared'
|
||||
import type { Nullable, StreamRoles } from '@speckle/shared'
|
||||
import { isNullOrUndefined } from '@speckle/shared'
|
||||
import cryptoRandomString from 'crypto-random-string'
|
||||
import { Knex } from 'knex'
|
||||
import type { Knex } from 'knex'
|
||||
import { clamp, groupBy, keyBy, pick } from 'lodash-es'
|
||||
import { SetOptional, SetRequired } from 'type-fest'
|
||||
import type { SetOptional, SetRequired } from 'type-fest'
|
||||
|
||||
const tables = {
|
||||
automations: (db: Knex) => db<AutomationRecord>(Automations.name),
|
||||
|
||||
@@ -10,7 +10,7 @@ import { validateScope, validateServerRoleBuilderFactory } from '@/modules/share
|
||||
import { authMiddlewareCreator } from '@/modules/shared/middleware'
|
||||
import { getRolesFactory } from '@/modules/shared/repositories/roles'
|
||||
import { Roles, Scopes } from '@speckle/shared'
|
||||
import { Application } from 'express'
|
||||
import type { Application } from 'express'
|
||||
import { validateRequest } from 'zod-express'
|
||||
import { z } from 'zod'
|
||||
import { sessionMiddlewareFactory } from '@/modules/auth/middleware'
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
import { authMiddlewareCreator } from '@/modules/shared/middleware'
|
||||
import { getRolesFactory } from '@/modules/shared/repositories/roles'
|
||||
import { Roles, Scopes } from '@speckle/shared'
|
||||
import { Application } from 'express'
|
||||
import type { Application } from 'express'
|
||||
import { FunctionRunNotFoundError } from '@/modules/automate/errors/runs'
|
||||
|
||||
export default (app: Application) => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { automateLogger } from '@/observability/logging'
|
||||
import { CreateStoredAuthCode } from '@/modules/automate/domain/operations'
|
||||
import type { CreateStoredAuthCode } from '@/modules/automate/domain/operations'
|
||||
import { AutomateAuthCodeHandshakeError } from '@/modules/automate/errors/management'
|
||||
import { EventBus } from '@/modules/shared/services/eventBus'
|
||||
import type { EventBus } from '@/modules/shared/services/eventBus'
|
||||
import cryptoRandomString from 'crypto-random-string'
|
||||
import Redis from 'ioredis'
|
||||
import type Redis from 'ioredis'
|
||||
import { get, has, isObjectLike } from 'lodash-es'
|
||||
import { Logger } from 'pino'
|
||||
import type { Logger } from 'pino'
|
||||
import { WorkspaceEvents } from '@/modules/workspacesCore/domain/events'
|
||||
|
||||
export enum AuthCodePayloadAction {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user