Skip to content
This repository has been archived by the owner on Nov 4, 2021. It is now read-only.

Commit

Permalink
Move createServer under src/shared
Browse files Browse the repository at this point in the history
  • Loading branch information
macobo committed Mar 19, 2021
1 parent a58ab36 commit 43e6988
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion benchmarks/postgres/ingestion.benchmark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import os from 'os'
import { performance } from 'perf_hooks'

import { IEvent } from '../../src/idl/protos'
import { createServer } from '../../src/server'
import { EventsProcessor } from '../../src/shared/ingestion/process-event'
import { createServer } from '../../src/shared/server'
import { UUIDT } from '../../src/shared/utils'
import { LogLevel, PluginsServer, SessionRecordingEvent, Team } from '../../src/types'
import { getFirstTeam, resetTestDatabase } from '../../tests/helpers/sql'
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/vm/memory.benchmark.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PluginEvent } from '@posthog/plugin-scaffold/src/types'

import { createServer } from '../../src/server'
import { createServer } from '../../src/shared/server'
import { Plugin, PluginConfig, PluginConfigVMReponse } from '../../src/types'
import { createPluginConfigVM } from '../../src/worker/vm/vm'
import { commonOrganizationId } from '../../tests/helpers/plugins'
Expand Down
2 changes: 1 addition & 1 deletion src/main/pluginsServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { FastifyInstance } from 'fastify'
import Redis from 'ioredis'
import * as schedule from 'node-schedule'

import { createServer } from '../server'
import { defaultConfig } from '../shared/config'
import { createServer } from '../shared/server'
import { status } from '../shared/status'
import { createRedis, delay } from '../shared/utils'
import { PluginsServer, PluginsServerConfig, Queue, ScheduleControl } from '../types'
Expand Down
16 changes: 8 additions & 8 deletions src/server.ts → src/shared/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import * as path from 'path'
import { types as pgTypes } from 'pg'
import { ConnectionOptions } from 'tls'

import { defaultConfig } from './shared/config'
import { DB } from './shared/db'
import { status } from './shared/status'
import { createPostgresPool, createRedis, UUIDT } from './shared/utils'
import { PluginsServer, PluginsServerConfig } from './types'
import { EventsProcessor } from './worker/ingestion/process-event'

const { version } = require('../package.json')
import { PluginsServer, PluginsServerConfig } from '../types'
import { EventsProcessor } from '../worker/ingestion/process-event'
import { defaultConfig } from './config'
import { DB } from './db'
import { status } from './status'
import { createPostgresPool, createRedis, UUIDT } from './utils'

const { version } = require('../../package.json')

export async function createServer(
config: Partial<PluginsServerConfig> = {},
Expand Down
2 changes: 1 addition & 1 deletion src/worker/worker.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { initApp } from '../init'
import { createServer } from '../server'
import { createServer } from '../shared/server'
import { status } from '../shared/status'
import { cloneObject } from '../shared/utils'
import { PluginsServer, PluginsServerConfig } from '../types'
Expand Down
2 changes: 1 addition & 1 deletion tests/plugins.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PluginEvent } from '@posthog/plugin-scaffold/src/types'
import { mocked } from 'ts-jest/utils'

import { createServer } from '../src/server'
import { clearError, processError } from '../src/shared/error'
import { createServer } from '../src/shared/server'
import { LogLevel, PluginsServer } from '../src/types'
import { loadPlugin } from '../src/worker/plugins/loadPlugin'
import { runPlugins } from '../src/worker/plugins/run'
Expand Down
2 changes: 1 addition & 1 deletion tests/postgres/queue.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { startQueue } from '../../src/main/queue'
import { createServer } from '../../src/server'
import Client from '../../src/shared/celery/client'
import { createServer } from '../../src/shared/server'
import { delay } from '../../src/shared/utils'
import { LogLevel, PluginsServer } from '../../src/types'
import { runPlugins } from '../../src/worker/plugins/run'
Expand Down
2 changes: 1 addition & 1 deletion tests/postgres/vm.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PluginEvent } from '@posthog/plugin-scaffold'
import * as fetch from 'node-fetch'

import { createServer } from '../../src/server'
import Client from '../../src/shared/celery/client'
import { createServer } from '../../src/shared/server'
import { delay } from '../../src/shared/utils'
import { PluginsServer } from '../../src/types'
import { createPluginConfigVM } from '../../src/worker/vm/vm'
Expand Down
2 changes: 1 addition & 1 deletion tests/postgres/vm.timeout.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createServer } from '../../src/server'
import { createServer } from '../../src/shared/server'
import { PluginsServer } from '../../src/types'
import { createPluginConfigVM } from '../../src/worker/vm/vm'
import { pluginConfig39 } from '../helpers/plugins'
Expand Down
2 changes: 1 addition & 1 deletion tests/schedule.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
startSchedule,
waitForTasksToFinish,
} from '../src/main/services/schedule'
import { createServer } from '../src/server'
import { createServer } from '../src/shared/server'
import { delay } from '../src/shared/utils'
import { LogLevel, ScheduleControl } from '../src/types'
import { createPromise } from './helpers/promises'
Expand Down
2 changes: 1 addition & 1 deletion tests/shared/process-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { DateTime } from 'luxon'
import { performance } from 'perf_hooks'

import { IEvent } from '../../src/idl/protos'
import { createServer } from '../../src/server'
import { hashElements } from '../../src/shared/ingestion/utils'
import { createServer } from '../../src/shared/server'
import { delay, UUIDT } from '../../src/shared/utils'
import {
Database,
Expand Down
2 changes: 1 addition & 1 deletion tests/sql.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createServer } from '../src/server'
import { createServer } from '../src/shared/server'
import { getPluginAttachmentRows, getPluginConfigRows, getPluginRows, setError } from '../src/shared/sql'
import { PluginConfig, PluginError, PluginsServer } from '../src/types'
import { commonOrganizationId } from './helpers/plugins'
Expand Down
2 changes: 1 addition & 1 deletion tests/transforms.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createServer } from '../src/server'
import { createServer } from '../src/shared/server'
import { code } from '../src/shared/utils'
import { PluginsServer } from '../src/types'
import { transformCode } from '../src/worker/vm/transforms'
Expand Down

0 comments on commit 43e6988

Please sign in to comment.