From 551f881bc7ca658ca0ac031fa5272b8226f223de Mon Sep 17 00:00:00 2001 From: Enes Date: Fri, 6 Sep 2024 23:45:59 +0300 Subject: [PATCH] BUG fix for listCollections function --- app/lib/Collections/listCollections.js | 2 +- app/src/Collections/listCollections.ts | 4 +- app/weivdata.d.ts | 2 +- docs/functions/Hooks.afterCount.html | 4 +- docs/functions/Hooks.afterFindOne.html | 4 +- docs/functions/Hooks.afterGet.html | 4 +- docs/functions/Hooks.afterGetAndRemove.html | 4 +- docs/functions/Hooks.afterGetAndReplace.html | 4 +- docs/functions/Hooks.afterGetAndUpdate.html | 4 +- docs/functions/Hooks.afterIncrement.html | 4 +- docs/functions/Hooks.afterInsert.html | 4 +- docs/functions/Hooks.afterMultiply.html | 4 +- docs/functions/Hooks.afterPull.html | 4 +- docs/functions/Hooks.afterPush.html | 4 +- docs/functions/Hooks.afterQuery.html | 4 +- docs/functions/Hooks.afterRemove.html | 4 +- docs/functions/Hooks.afterReplace.html | 4 +- docs/functions/Hooks.afterUpdate.html | 4 +- docs/functions/Hooks.beforeCount.html | 4 +- docs/functions/Hooks.beforeFindOne.html | 4 +- docs/functions/Hooks.beforeGet.html | 4 +- docs/functions/Hooks.beforeGetAndRemove.html | 4 +- docs/functions/Hooks.beforeGetAndReplace.html | 4 +- docs/functions/Hooks.beforeGetAndUpdate.html | 4 +- docs/functions/Hooks.beforeIncrement.html | 4 +- docs/functions/Hooks.beforeInsert.html | 4 +- docs/functions/Hooks.beforeMultiply.html | 4 +- docs/functions/Hooks.beforePull.html | 4 +- docs/functions/Hooks.beforePush.html | 4 +- docs/functions/Hooks.beforeQuery.html | 4 +- docs/functions/Hooks.beforeRemove.html | 4 +- docs/functions/Hooks.beforeReplace.html | 4 +- docs/functions/Hooks.beforeUpdate.html | 4 +- docs/functions/Hooks.onFailure.html | 4 +- docs/functions/_version.html | 4 +- docs/functions/aggregate.html | 4 +- docs/functions/bulkInsert.html | 4 +- docs/functions/bulkRemove.html | 4 +- docs/functions/bulkSave.html | 4 +- docs/functions/bulkUpdate.html | 4 +- docs/functions/convertIdToObjectId.html | 4 +- docs/functions/convertIdToString.html | 4 +- docs/functions/createCollection.html | 4 +- docs/functions/deleteCollection.html | 4 +- docs/functions/filter.html | 4 +- docs/functions/findOne.html | 4 +- docs/functions/flushCache.html | 4 +- docs/functions/get.html | 4 +- docs/functions/getAndRemove.html | 4 +- docs/functions/getAndReplace.html | 4 +- docs/functions/getAndUpdate.html | 4 +- docs/functions/increment.html | 4 +- docs/functions/insert.html | 4 +- docs/functions/insertReference.html | 4 +- docs/functions/isReferenced.html | 4 +- docs/functions/listCollections.html | 8 +-- docs/functions/multiply.html | 4 +- docs/functions/native.html | 4 +- docs/functions/pull.html | 4 +- docs/functions/push.html | 4 +- docs/functions/query.html | 4 +- docs/functions/queryReferenced.html | 4 +- docs/functions/remove.html | 4 +- docs/functions/removeReference.html | 4 +- docs/functions/renameCollection.html | 4 +- docs/functions/replace.html | 4 +- docs/functions/replaceReferences.html | 4 +- docs/functions/save.html | 4 +- docs/functions/truncate.html | 4 +- docs/functions/update.html | 4 +- docs/hierarchy.html | 2 +- docs/index.html | 2 +- .../CustomOptions.ConfigOptions.html | 6 +- .../CustomOptions.ConnectionOptions.html | 12 ++-- docs/interfaces/IncludeObject.html | 18 +++--- docs/interfaces/Item.html | 4 +- docs/interfaces/SyncWixApps.wixBlog.html | 6 +- docs/interfaces/SyncWixApps.wixEcom.html | 6 +- docs/interfaces/SyncWixApps.wixMarketing.html | 6 +- docs/interfaces/SyncWixApps.wixMembers.html | 6 +- .../SyncWixApps.wixPricingPlans.html | 6 +- docs/interfaces/SyncWixApps.wixStores.html | 6 +- docs/interfaces/WeivDataAggregate.html | 30 +++++----- docs/interfaces/WeivDataAggregateResult.html | 14 ++--- docs/interfaces/WeivDataFilter.html | 38 ++++++------- docs/interfaces/WeivDataOptions.html | 12 ++-- docs/interfaces/WeivDataOptionsCache.html | 16 +++--- docs/interfaces/WeivDataOptionsOwner.html | 14 ++--- docs/interfaces/WeivDataOptionsQuery.html | 14 ++--- docs/interfaces/WeivDataOptionsWrite.html | 14 ++--- .../interfaces/WeivDataOptionsWriteOwner.html | 16 +++--- docs/interfaces/WeivDataQuery.html | 56 +++++++++---------- .../WeivDataQueryReferencedResult.html | 16 +++--- docs/interfaces/WeivDataQueryResult.html | 28 +++++----- docs/modules.html | 2 +- docs/modules/CustomOptions.html | 4 +- docs/modules/Errors.html | 4 +- docs/modules/Hooks.html | 4 +- docs/modules/SyncWixApps.html | 4 +- docs/types/BulkInsertResult.html | 4 +- docs/types/BulkRemoveResult.html | 4 +- docs/types/BulkSaveResult.html | 4 +- docs/types/BulkUpdateResult.html | 4 +- docs/types/CacheSelections.html | 4 +- docs/types/CollectionID.html | 4 +- docs/types/CustomOptions.WeivDataConfig.html | 4 +- docs/types/Errors.ErrorsList.html | 4 +- docs/types/Hooks.HookContext.html | 4 +- docs/types/Hooks.HookName.html | 4 +- docs/types/ItemID.html | 4 +- docs/types/PipelineStage.html | 4 +- docs/types/PipelineStageKey.html | 4 +- docs/types/ReadConcern.html | 4 +- docs/types/ReferencedItem.html | 4 +- docs/types/ReferringItem.html | 4 +- docs/types/SaveResult.html | 4 +- docs/types/WeivDataAggregateRunOptions.html | 4 +- .../types/WeivDataQueryReferencedOptions.html | 4 +- 118 files changed, 361 insertions(+), 361 deletions(-) diff --git a/app/lib/Collections/listCollections.js b/app/lib/Collections/listCollections.js index c512a737..d8c9d2c1 100644 --- a/app/lib/Collections/listCollections.js +++ b/app/lib/Collections/listCollections.js @@ -8,7 +8,7 @@ async function listCollections(databaseName, suppressAuth, filter, listOptions) try { const { safeCollectionFilter, safeCollectionOptions } = await (0, validator_1.validateParams)({ databaseName, suppressAuth, collectionFilter: filter, collectionOptions: listOptions }, ["databaseName"], "listCollections"); const { database } = await (0, connection_helpers_1.connectionHandler)(`${databaseName}/`, suppressAuth); - return await database.listCollections(safeCollectionFilter, safeCollectionOptions).toArray(); + return await database.listCollections(safeCollectionFilter || undefined, safeCollectionOptions || undefined).toArray(); } catch (err) { (0, error_manager_1.kaptanLogar)("00022", `when listing all collections in a database, details: ${err}`); diff --git a/app/src/Collections/listCollections.ts b/app/src/Collections/listCollections.ts index fb9d79f7..49f0594a 100644 --- a/app/src/Collections/listCollections.ts +++ b/app/src/Collections/listCollections.ts @@ -3,7 +3,7 @@ import type { Document, ListCollectionsOptions, CollectionInfo } from 'mongodb/m import { validateParams } from '../Helpers/validator'; import { kaptanLogar } from '../Errors/error_manager'; -export async function listCollections(databaseName: string, suppressAuth?: boolean, filter?: Document, listOptions?: ListCollectionsOptions): Promise { +export async function listCollections(databaseName: string, suppressAuth: boolean, filter?: Document, listOptions?: ListCollectionsOptions): Promise { try { const { safeCollectionFilter, safeCollectionOptions } = await validateParams<"listCollections">( { databaseName, suppressAuth, collectionFilter: filter, collectionOptions: listOptions }, @@ -12,7 +12,7 @@ export async function listCollections(databaseName: string, suppressAuth?: boole ); const { database } = await connectionHandler(`${databaseName}/`, suppressAuth); - return await database.listCollections(safeCollectionFilter, safeCollectionOptions).toArray(); + return await database.listCollections(safeCollectionFilter || undefined, safeCollectionOptions || undefined).toArray(); } catch (err) { kaptanLogar("00022", `when listing all collections in a database, details: ${err}`); } diff --git a/app/weivdata.d.ts b/app/weivdata.d.ts index 48c69d21..c7b6561c 100644 --- a/app/weivdata.d.ts +++ b/app/weivdata.d.ts @@ -1318,7 +1318,7 @@ declare module '@exweiv/weiv-data' { * @param listOptions MongoDB native listCollections options. [Read More](https://mongodb.github.io/node-mongodb-native/6.6/classes/Db.html#listCollections). * @returns Fulfilled - Array of [CollectionInfo](https://mongodb.github.io/node-mongodb-native/6.6/interfaces/CollectionInfo.html). */ - function listCollections(databaseName: string, suppressAuth?: boolean, filter?: Document, listOptions?: ListCollectionsOptions): Promise; + function listCollections(databaseName: string, suppressAuth: boolean, filter?: Document, listOptions?: ListCollectionsOptions): Promise; /** * @description diff --git a/docs/functions/Hooks.afterCount.html b/docs/functions/Hooks.afterCount.html index b1af0042..24da41ef 100644 --- a/docs/functions/Hooks.afterCount.html +++ b/docs/functions/Hooks.afterCount.html @@ -3,10 +3,10 @@
  • context: HookContext

    Contextual information about the hook.

  • Returns Promise<number> | number

    The count to return to count() instead of the original count. Returning a rejected promise will not block the operation, but will return a rejected promise to the caller as well as trigger the onFailure() hook.

    A hook that is triggered after a count() operation.

    -