File tree 1 file changed +5
-2
lines changed
packages/app-service/src/support
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import { Constants } from '../constants'
5
5
import { execSync } from 'child_process'
6
6
import Config from '../config'
7
7
import { logger } from './logger'
8
- import { DatabaseAgent } from '../db'
9
8
10
9
11
10
/**
@@ -59,9 +58,11 @@ interface AppConfigItem {
59
58
* @returns
60
59
*/
61
60
export async function getExtraPackages ( ) {
61
+ const { DatabaseAgent } = require ( '../db' ) // init.ts should not import db globally, because init.ts would be referenced in build time
62
+
62
63
await DatabaseAgent . accessor . ready
63
64
const db = DatabaseAgent . db
64
- const doc = await db . collection < AppConfigItem > ( Constants . config_collection )
65
+ const doc : AppConfigItem = await db . collection ( Constants . config_collection )
65
66
. findOne ( { key : 'packages' } )
66
67
67
68
return doc ?. value ?? [ ]
@@ -109,6 +110,8 @@ export function moduleExists(mod: string) {
109
110
* @returns
110
111
*/
111
112
export async function ensureCollectionIndexes ( ) : Promise < any > {
113
+ const { DatabaseAgent } = require ( '../db' ) // init.ts should not import db globally, because init.ts would be referenced in build time
114
+
112
115
const db = DatabaseAgent . db
113
116
await db . collection ( Constants . function_log_collection )
114
117
. createIndexes ( [
You can’t perform that action at this time.
0 commit comments