Skip to content

Commit fdfefd7

Browse files
committed
rename
1 parent f50da13 commit fdfefd7

File tree

5 files changed

+35
-35
lines changed

5 files changed

+35
-35
lines changed

spec/MongoStorageAdapter.spec.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -825,12 +825,12 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
825825
});
826826
});
827827

828-
describe('clientLogEvents', () => {
828+
describe('logClientEvents', () => {
829829
it('should log MongoDB client events when configured', async () => {
830830
const logger = require('../lib/logger').logger;
831831
const logSpy = spyOn(logger, 'warn');
832832

833-
const clientLogEvents = [
833+
const logClientEvents = [
834834
{
835835
name: 'serverDescriptionChanged',
836836
keys: ['address'],
@@ -840,7 +840,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
840840

841841
const adapter = new MongoStorageAdapter({
842842
uri: databaseURI,
843-
mongoOptions: { clientLogEvents },
843+
mongoOptions: { logClientEvents },
844844
});
845845

846846
// Connect to trigger event listeners setup
@@ -867,7 +867,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
867867
const logger = require('../lib/logger').logger;
868868
const logSpy = spyOn(logger, 'info');
869869

870-
const clientLogEvents = [
870+
const logClientEvents = [
871871
{
872872
name: 'connectionPoolReady',
873873
logLevel: 'info',
@@ -876,7 +876,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
876876

877877
const adapter = new MongoStorageAdapter({
878878
uri: databaseURI,
879-
mongoOptions: { clientLogEvents },
879+
mongoOptions: { logClientEvents },
880880
});
881881

882882
await adapter.connect();
@@ -899,7 +899,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
899899
const logger = require('../lib/logger').logger;
900900
const logSpy = spyOn(logger, 'warn');
901901

902-
const clientLogEvents = [
902+
const logClientEvents = [
903903
{
904904
name: 'topologyDescriptionChanged',
905905
keys: ['previousDescription.type', 'newDescription.type', 'newDescription.servers.size'],
@@ -909,7 +909,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
909909

910910
const adapter = new MongoStorageAdapter({
911911
uri: databaseURI,
912-
mongoOptions: { clientLogEvents },
912+
mongoOptions: { logClientEvents },
913913
});
914914

915915
await adapter.connect();
@@ -936,7 +936,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
936936
const logger = require('../lib/logger').logger;
937937
const infoSpy = spyOn(logger, 'info');
938938

939-
const clientLogEvents = [
939+
const logClientEvents = [
940940
{
941941
name: 'connectionPoolReady',
942942
keys: ['address'],
@@ -946,7 +946,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
946946

947947
const adapter = new MongoStorageAdapter({
948948
uri: databaseURI,
949-
mongoOptions: { clientLogEvents },
949+
mongoOptions: { logClientEvents },
950950
});
951951

952952
await adapter.connect();
@@ -969,7 +969,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
969969
const logger = require('../lib/logger').logger;
970970
const warnSpy = spyOn(logger, 'warn');
971971

972-
const clientLogEvents = [
972+
const logClientEvents = [
973973
{
974974
name: 'customEvent',
975975
logLevel: 'warn',
@@ -978,7 +978,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
978978

979979
const adapter = new MongoStorageAdapter({
980980
uri: databaseURI,
981-
mongoOptions: { clientLogEvents },
981+
mongoOptions: { logClientEvents },
982982
});
983983

984984
await adapter.connect();
@@ -1002,7 +1002,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
10021002
const logger = require('../lib/logger').logger;
10031003
const infoSpy = spyOn(logger, 'info');
10041004

1005-
const clientLogEvents = [
1005+
const logClientEvents = [
10061006
{
10071007
name: 'testEvent',
10081008
keys: ['nonexistent.nested.key', 'another.missing'],
@@ -1012,7 +1012,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
10121012

10131013
const adapter = new MongoStorageAdapter({
10141014
uri: databaseURI,
1015-
mongoOptions: { clientLogEvents },
1015+
mongoOptions: { logClientEvents },
10161016
});
10171017

10181018
await adapter.connect();
@@ -1035,7 +1035,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
10351035
const logger = require('../lib/logger').logger;
10361036
const warnSpy = spyOn(logger, 'warn');
10371037

1038-
const clientLogEvents = [
1038+
const logClientEvents = [
10391039
{
10401040
name: 'circularEvent',
10411041
logLevel: 'info',
@@ -1044,7 +1044,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
10441044

10451045
const adapter = new MongoStorageAdapter({
10461046
uri: databaseURI,
1047-
mongoOptions: { clientLogEvents },
1047+
mongoOptions: { logClientEvents },
10481048
});
10491049

10501050
await adapter.connect();

src/Adapters/Storage/Mongo/MongoStorageAdapter.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// @flow
2+
import { format as formatUrl, parse as parseUrl } from '../../../vendor/mongodbUrl';
3+
import type { QueryOptions, QueryType, SchemaType, StorageClass } from '../StorageAdapter';
4+
import { StorageAdapter } from '../StorageAdapter';
25
import MongoCollection from './MongoCollection';
36
import MongoSchemaCollection from './MongoSchemaCollection';
4-
import { StorageAdapter } from '../StorageAdapter';
5-
import type { SchemaType, QueryType, StorageClass, QueryOptions } from '../StorageAdapter';
6-
import { parse as parseUrl, format as formatUrl } from '../../../vendor/mongodbUrl';
77
import {
8-
parseObjectToMongoObjectForCreate,
98
mongoObjectToParseObject,
9+
parseObjectToMongoObjectForCreate,
1010
transformKey,
11-
transformWhere,
12-
transformUpdate,
1311
transformPointerString,
12+
transformUpdate,
13+
transformWhere,
1414
} from './MongoTransform';
1515
// @flow-disable-next
1616
import Parse from 'parse/node';
@@ -132,7 +132,7 @@ export class MongoStorageAdapter implements StorageAdapter {
132132
_mongoOptions: Object;
133133
_onchange: any;
134134
_stream: any;
135-
_clientLogEvents: ?Array<any>;
135+
_logClientEvents: ?Array<any>;
136136
// Public
137137
connectionPromise: ?Promise<any>;
138138
database: any;
@@ -155,7 +155,7 @@ export class MongoStorageAdapter implements StorageAdapter {
155155
this.enableSchemaHooks = !!mongoOptions.enableSchemaHooks;
156156
this.schemaCacheTtl = mongoOptions.schemaCacheTtl;
157157
this.disableIndexFieldValidation = !!mongoOptions.disableIndexFieldValidation;
158-
this._clientLogEvents = mongoOptions.clientLogEvents;
158+
this._logClientEvents = mongoOptions.logClientEvents;
159159
// Remove Parse Server-specific options that should not be passed to MongoDB client
160160
// Note: We only delete from this._mongoOptions, not from the original mongoOptions object,
161161
// because other components (like DatabaseController) need access to these options
@@ -164,7 +164,7 @@ export class MongoStorageAdapter implements StorageAdapter {
164164
'schemaCacheTtl',
165165
'maxTimeMS',
166166
'disableIndexFieldValidation',
167-
'clientLogEvents',
167+
'logClientEvents',
168168
'createIndexUserUsername',
169169
'createIndexUserUsernameCaseInsensitive',
170170
'createIndexUserEmail',
@@ -208,8 +208,8 @@ export class MongoStorageAdapter implements StorageAdapter {
208208
});
209209

210210
// Set up client event logging if configured
211-
if (this._clientLogEvents && Array.isArray(this._clientLogEvents)) {
212-
this._clientLogEvents.forEach(eventConfig => {
211+
if (this._logClientEvents && Array.isArray(this._logClientEvents)) {
212+
this._logClientEvents.forEach(eventConfig => {
213213
client.on(eventConfig.name, event => {
214214
try {
215215
let logData = {};

src/Options/Definitions.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,12 +1117,6 @@ module.exports.DatabaseOptions = {
11171117
'The MongoDB driver option to specify the amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the autoSelectFamily option. If set to a positive integer less than 10, the value 10 is used instead.',
11181118
action: parsers.numberParser('autoSelectFamilyAttemptTimeout'),
11191119
},
1120-
clientLogEvents: {
1121-
env: 'PARSE_SERVER_DATABASE_CLIENT_LOG_EVENTS',
1122-
help:
1123-
"An array of MongoDB client event configurations to enable logging of specific events. Each configuration object should contain:<br><ul><li>`name` (the event name, e.g., 'topologyDescriptionChanged', 'serverDescriptionChanged', 'connectionPoolCleared', 'connectionPoolReady')</li><li>`keys` (optional array of dot-notation paths to extract specific data from the event object; if not provided or empty, the entire event object will be logged)</li><li>`logLevel` (the log level to use for this event: 'error', 'warn', 'info', 'debug', etc.).</li></ul>",
1124-
action: parsers.arrayParser,
1125-
},
11261120
compressors: {
11271121
env: 'PARSE_SERVER_DATABASE_COMPRESSORS',
11281122
help:
@@ -1225,6 +1219,12 @@ module.exports.DatabaseOptions = {
12251219
'The MongoDB driver option to specify the size (in milliseconds) of the latency window for selecting among multiple suitable MongoDB instances.',
12261220
action: parsers.numberParser('localThresholdMS'),
12271221
},
1222+
logClientEvents: {
1223+
env: 'PARSE_SERVER_DATABASE_LOG_CLIENT_EVENTS',
1224+
help:
1225+
"An array of MongoDB client event configurations to enable logging of specific events. Each configuration object should contain:<br><ul><li>`name` (the event name, e.g., 'topologyDescriptionChanged', 'serverDescriptionChanged', 'connectionPoolCleared', 'connectionPoolReady')</li><li>`keys` (optional array of dot-notation paths to extract specific data from the event object; if not provided or empty, the entire event object will be logged)</li><li>`logLevel` (the log level to use for this event: 'error', 'warn', 'info', 'debug', etc.).</li></ul>",
1226+
action: parsers.arrayParser,
1227+
},
12281228
maxConnecting: {
12291229
env: 'PARSE_SERVER_DATABASE_MAX_CONNECTING',
12301230
help:

src/Options/docs.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Options/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ export interface FileUploadOptions {
608608
enableForPublic: ?boolean;
609609
}
610610

611-
export type ClientLogEvent = {
611+
export type LogClientEvent = {
612612
/* The MongoDB driver event name to listen for. */
613613
name: string,
614614
/* Optional array of dot-notation paths to extract specific data from the event object. If not provided or empty, the entire event object will be logged. */
@@ -735,7 +735,7 @@ export interface DatabaseOptions {
735735
/* Set to `true` to disable validation of index fields. When disabled, indexes can be created even if the fields do not exist in the schema. This can be useful when creating indexes on fields that will be added later. */
736736
disableIndexFieldValidation: ?boolean;
737737
/* An array of MongoDB client event configurations to enable logging of specific events. Each configuration object should contain:<br><ul><li>`name` (the event name, e.g., 'topologyDescriptionChanged', 'serverDescriptionChanged', 'connectionPoolCleared', 'connectionPoolReady')</li><li>`keys` (optional array of dot-notation paths to extract specific data from the event object; if not provided or empty, the entire event object will be logged)</li><li>`logLevel` (the log level to use for this event: 'error', 'warn', 'info', 'debug', etc.).</li></ul> */
738-
clientLogEvents: ?(ClientLogEvent[]);
738+
logClientEvents: ?(LogClientEvent[]);
739739
}
740740

741741
export interface AuthAdapter {

0 commit comments

Comments
 (0)