Skip to content

Commit fdcfb42

Browse files
committed
do mix with adapt ns info
1 parent 731ac2d commit fdcfb42

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

packages/data-service/src/data-service.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,6 @@ class DataServiceImpl extends WithLogContext implements DataService {
11791179
adaptCollectionInfo({
11801180
db: dbName,
11811181
...collInfo,
1182-
is_non_existent: false,
11831182
}) ?? null
11841183
);
11851184
}
@@ -1352,7 +1351,10 @@ class DataServiceImpl extends WithLogContext implements DataService {
13521351
// if they were fetched successfully
13531352
[...collectionsFromPrivileges, ...listedCollections],
13541353
'name'
1355-
).map((coll) => adaptCollectionInfo({ db: databaseName, ...coll }));
1354+
).map(({ is_non_existent, ...coll }) => ({
1355+
is_non_existent,
1356+
...adaptCollectionInfo({ db: databaseName, ...coll }),
1357+
}));
13561358

13571359
return collections;
13581360
}
@@ -1455,10 +1457,11 @@ class DataServiceImpl extends WithLogContext implements DataService {
14551457
// if they were fetched successfully
14561458
[...databasesFromRoles, ...databasesFromPrivileges, ...listedDatabases],
14571459
'name'
1458-
).map(({ name, ...db }) => {
1460+
).map(({ name, is_non_existent, ...db }) => {
14591461
return {
14601462
_id: name,
14611463
name,
1464+
is_non_existent,
14621465
...adaptDatabaseInfo(db),
14631466
};
14641467
});

packages/data-service/src/instance-detail-helper.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -359,17 +359,15 @@ function adaptBuildInfo(rawBuildInfo: Partial<BuildInfo>) {
359359
}
360360

361361
export function adaptDatabaseInfo(
362-
databaseStats: Partial<DbStats> &
363-
Partial<DatabaseInfo> & { is_non_existent: boolean }
364-
): Omit<DatabaseDetails, '_id' | 'collections' | 'name'> {
362+
databaseStats: Partial<DbStats> & Partial<DatabaseInfo>
363+
): Omit<DatabaseDetails, '_id' | 'collections' | 'name' | 'is_non_existent'> {
365364
return {
366365
collection_count: databaseStats.collections ?? 0,
367366
document_count: databaseStats.objects ?? 0,
368367
index_count: databaseStats.indexes ?? 0,
369368
storage_size: databaseStats.storageSize ?? 0,
370369
data_size: databaseStats.dataSize ?? 0,
371370
index_size: databaseStats.indexSize ?? 0,
372-
is_non_existent: databaseStats.is_non_existent,
373371
};
374372
}
375373

@@ -379,12 +377,10 @@ export function adaptCollectionInfo({
379377
info,
380378
options,
381379
type,
382-
is_non_existent,
383380
}: CollectionInfoNameOnly &
384381
Partial<CollectionInfo> & {
385382
db: string;
386-
is_non_existent: boolean;
387-
}): CollectionDetails {
383+
}): Omit<CollectionDetails, 'is_non_existent'> {
388384
const ns = toNS(`${db}.${name}`);
389385
const {
390386
collection,
@@ -432,6 +428,5 @@ export function adaptCollectionInfo({
432428
validation: hasValidation
433429
? { validator, validationAction, validationLevel }
434430
: null,
435-
is_non_existent,
436431
};
437432
}

0 commit comments

Comments
 (0)