@sfxcode/mongocamp-server-core 1.10.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,6 +27,13 @@ The keys are the env variables of the Scala server (`CONNECTION_*`, `AUTH_*`, `C
27
27
 
28
28
  The category `jvm` holds the numbers of the Node runtime (`nodejs_*`).
29
29
 
30
+ ## Logging
31
+
32
+ `logger` (`{ info, warn, error }`, default `console`) receives the messages of the server. `server.fetch(request, { log, requestId })`
33
+ adds the fields of the server under `mongocamp` to the wide event of the host (anything with `set(fields)`, e.g. evlog's request logger)
34
+ and uses the host's request id for `x-request-id` and the events. `apps/server` does both with `evlog/nitro/v3`; the Nuxt module passes
35
+ the event of `evlog/nuxt` when the application uses it.
36
+
30
37
  ## Extensions
31
38
 
32
39
  The dynamic JVM plugins of the Scala server are replaced by three things a host can use.
@@ -62,8 +69,14 @@ await createMongocampServer({
62
69
  enabled: true, // false: this instance does not run the jobs on their schedule (several instances of one application)
63
70
  },
64
71
  })
72
+
73
+ // later, e.g. in a Nuxt application through useMongocampCore(): schedules the stored jobs of the class right away
74
+ const remove = server.registerJobHandler('my.app.CleanupJob', async run => cleanup(run.config))
65
75
  ```
66
76
 
77
+ `JOBS_ENABLED=false` (environment or `config`, never stored) switches the scheduler of an instance off as well, also for the standalone
78
+ server.
79
+
67
80
  ### Routes
68
81
 
69
82
  Routes of the host go in front of the core: answer them yourself and give every other request to `server.fetch`. In Nitro 3 a route
package/dist/index.d.mts CHANGED
@@ -35,6 +35,9 @@ declare const ConfigKeys: {
35
35
  readonly AuthRefreshGraceDuration: "AUTH_REFRESH_GRACE_DURATION";
36
36
  readonly AuthGrantDeniedStatus: "AUTH_GRANT_DENIED_STATUS";
37
37
  readonly ImportMaxBytes: "IMPORT_MAX_BYTES";
38
+ readonly FilterTimeZone: "FILTER_TIME_ZONE";
39
+ readonly MigrationDropScalaLeftovers: "MIGRATION_DROP_SCALA_LEFTOVERS";
40
+ readonly JobsEnabled: "JOBS_ENABLED";
38
41
  readonly AuthPrefix: "AUTH_PREFIX";
39
42
  readonly AuthBearer: "AUTH_BEARER";
40
43
  readonly AuthBasic: "AUTH_BASIC";
@@ -110,6 +113,24 @@ declare class ConfigStore {
110
113
  allDefinitions(): ConfigDefinition[];
111
114
  }
112
115
 
116
+ /**
117
+ * The log of the server: `console` by default, any structured logger (evlog, consola, pino) through the option `logger`. The core never
118
+ * depends on a logging library; a host adapts its logger to these three functions.
119
+ */
120
+ interface MongocampLogger {
121
+ info: (message: string) => void;
122
+ warn: (message: string) => void;
123
+ error: (message: string, error?: unknown) => void;
124
+ }
125
+ declare const consoleLogger: MongocampLogger;
126
+ /**
127
+ * The wide event of one request, e.g. the request logger of evlog (`useLogger(event)`): anything with `set`. The server adds its fields under
128
+ * the key `mongocamp` (`requestFields`), the host emits the event.
129
+ */
130
+ interface RequestLog {
131
+ set: (fields: Record<string, unknown>) => void;
132
+ }
133
+
113
134
  interface DatabaseOptions {
114
135
  /** A full MongoDB connection string. Takes precedence over the `CONNECTION_*` configurations. */
115
136
  connectionUri?: string;
@@ -158,16 +179,24 @@ declare const PaginationHeaders: {
158
179
  readonly currentPage: "x-pagination-current-page";
159
180
  readonly countRows: "x-pagination-count-rows";
160
181
  readonly countPages: "x-pagination-count-pages";
182
+ readonly next: "x-pagination-next";
161
183
  };
184
+ /** `after` switches to cursor paging (`http/cursor.ts`): the token of the previous page, or empty for the first page. */
162
185
  interface Paging {
163
186
  rowsPerPage?: number;
164
187
  page?: number;
188
+ after?: string;
165
189
  }
190
+ /**
191
+ * `allCount` and `pagesCount` are missing when the count was skipped (`count=none`), `page` with cursor paging; `next` is the cursor of the
192
+ * next page, missing when the page is the last one.
193
+ */
166
194
  interface PaginationInfo {
167
- allCount: number;
195
+ allCount?: number;
168
196
  perPage: number;
169
- page: number;
170
- pagesCount: number;
197
+ page?: number;
198
+ pagesCount?: number;
199
+ next?: string;
171
200
  }
172
201
 
173
202
  interface Grant {
@@ -184,7 +213,7 @@ interface Role {
184
213
  }
185
214
  interface UserInformation {
186
215
  userId: string;
187
- /** SHA-256 hex of the password. */
216
+ /** The stored hash of the password (`auth/password.ts`: `scrypt$...`, or the SHA-256 hex of the Scala server). */
188
217
  password: string;
189
218
  apiKey: string | null;
190
219
  roles: string[];
@@ -241,8 +270,8 @@ interface AuthHolder {
241
270
  info: PaginationInfo;
242
271
  }>;
243
272
  findUserOption: (userId: string) => Promise<UserInformation | undefined>;
244
- /** The user with the given password hash; 401 "user or password does not exists" otherwise. */
245
- findUserWithPassword: (userId: string, passwordHash: string) => Promise<UserInformation>;
273
+ /** Replaces a password hash of the old format after a login (only while the stored hash is still `oldHash`). */
274
+ upgradePassword: (userId: string, oldHash: string, newHash: string) => Promise<void>;
246
275
  findUserByApiKeyOption: (apiKey: string) => Promise<UserInformation | undefined>;
247
276
  findRoles: (names: string[]) => Promise<Role[]>;
248
277
  }
@@ -255,7 +284,12 @@ declare class MongoAuthHolder implements AuthHolder {
255
284
  get users(): Collection;
256
285
  get rolesCollection(): Collection;
257
286
  /** Creates the indexes and, for an empty user collection, the user `admin` with a random password that is printed once. */
258
- createIndicesAndInitData(log?: (message: string) => void): Promise<void>;
287
+ createIndicesAndInitData(log?: (message: string) => void, warn?: (message: string) => void): Promise<void>;
288
+ /**
289
+ * Unique index for the api-key lookup, partial on string values (users without a key store `null`). A database in which two users share
290
+ * a key (possible with the Scala server, which had no index) gets a non-unique index instead, so the start never fails on old data.
291
+ */
292
+ createApiKeyIndex(warn?: (message: string) => void): Promise<void>;
259
293
  allUsers(filter: string | undefined, paging: Paging): Promise<{
260
294
  items: UserInformation[];
261
295
  info: PaginationInfo;
@@ -265,7 +299,7 @@ declare class MongoAuthHolder implements AuthHolder {
265
299
  info: PaginationInfo;
266
300
  }>;
267
301
  findUserOption(userId: string): Promise<UserInformation | undefined>;
268
- findUserWithPassword(userId: string, passwordHash: string): Promise<UserInformation>;
302
+ upgradePassword(userId: string, oldHash: string, newHash: string): Promise<void>;
269
303
  findUserByApiKeyOption(apiKey: string): Promise<UserInformation | undefined>;
270
304
  findRoles(names: string[]): Promise<Role[]>;
271
305
  addUser(user: UserInformation): Promise<UserInformation>;
@@ -339,8 +373,12 @@ declare class AuthService {
339
373
  private readonly version;
340
374
  readonly holder: AuthHolder;
341
375
  readonly tokens: TokenCache;
376
+ /** Key: SHA-256 of user and password; value: the stored hash that was verified, valid while the user still has it. */
377
+ private readonly basicCache;
378
+ /** The user of a request once it is authenticated, for the fields of its wide event (`userOf`). */
379
+ private readonly requestUsers;
342
380
  constructor(database: MongocampDatabase, config: ConfigStore, version: VersionInfo);
343
- initialize(): Promise<void>;
381
+ initialize(logger?: MongocampLogger): Promise<void>;
344
382
  /** The users and roles in the database, for the routes that change them (only with `AUTH_HANDLER=mongo`). */
345
383
  get mongoHolder(): MongoAuthHolder | undefined;
346
384
  get bearerEnabled(): boolean;
@@ -351,6 +389,8 @@ declare class AuthService {
351
389
  authenticateUser(credentials: Credentials): Promise<UserInformation>;
352
390
  /** The logged in user of a request with the current roles. */
353
391
  authenticate(request: Request): Promise<AuthorizedUser>;
392
+ /** The id of the user a request was authenticated as, `undefined` before (or without) the authentication. */
393
+ userOf(request: Request): string | undefined;
354
394
  /** The error for a logged in user without the grant for a request; the status is `AUTH_GRANT_DENIED_STATUS` (403) or 401. */
355
395
  grantDenied(message: string): MongocampError;
356
396
  requireAdmin(request: Request): Promise<AuthorizedUser>;
@@ -360,6 +400,12 @@ declare class AuthService {
360
400
  /** A new token for the user (`AuthHolder.generateLoginResult`), valid for `AUTH_EXPIRING_DURATION`. */
361
401
  generateLoginResult(user: UserInformation): Promise<LoginResult>;
362
402
  login(userId: string, password: string): Promise<LoginResult>;
403
+ /**
404
+ * The user with this password; 401 "user or password does not exists" otherwise. A correct password with a hash of the old format
405
+ * (SHA-256 of the Scala server) is stored again with a salted hash (2.0.0). With `cache` (Basic auth) a verified password is remembered
406
+ * for `BasicAuthCacheMillis` as long as the stored hash does not change (a new password or a deleted user count at once).
407
+ */
408
+ verifyCredentials(userId: string, password: string, cache: boolean): Promise<UserInformation>;
363
409
  /** A new token; the bearer token of the call stays valid for `AUTH_REFRESH_GRACE_DURATION` and is invalid afterwards. */
364
410
  refresh(user: UserInformation, bearer: string | undefined): Promise<LoginResult>;
365
411
  }
@@ -400,8 +446,20 @@ interface components {
400
446
  /** ClusterMemberInformation */
401
447
  ClusterMemberInformation: {
402
448
  name: string;
449
+ /**
450
+ * @deprecated
451
+ * @description Deprecated: JGroups cluster of the Scala server, always false
452
+ */
403
453
  siteMaster: boolean;
454
+ /**
455
+ * @deprecated
456
+ * @description Deprecated: JGroups cluster of the Scala server, always false
457
+ */
404
458
  siteAddress: boolean;
459
+ /**
460
+ * @deprecated
461
+ * @description Deprecated: JGroups cluster of the Scala server, always false
462
+ */
405
463
  multicast: boolean;
406
464
  coordinator: boolean;
407
465
  };
@@ -617,6 +675,10 @@ interface components {
617
675
  /** IndexOptionsRequest */
618
676
  IndexOptionsRequest: {
619
677
  name?: string;
678
+ /**
679
+ * @deprecated
680
+ * @description Deprecated: ignored by MongoDB since 4.2
681
+ */
620
682
  background?: boolean;
621
683
  defaultLanguage?: string;
622
684
  /** Format: int32 */
@@ -860,7 +922,15 @@ interface components {
860
922
  /** SettingsResponse */
861
923
  SettingsResponse: {
862
924
  routesPlugins?: string[];
925
+ /**
926
+ * @deprecated
927
+ * @description Deprecated: plugin system of the Scala server, always [GridFsFileAdapter]
928
+ */
863
929
  filePlugins?: string[];
930
+ /**
931
+ * @deprecated
932
+ * @description Deprecated: plugin system of the Scala server, the value of PLUGINS_IGNORED
933
+ */
864
934
  ignoredPlugins?: string[];
865
935
  configurations: components["schemas"]["Map_Any"];
866
936
  };
@@ -1155,7 +1225,7 @@ declare class ConfigPersistence {
1155
1225
  * year optional), steps as `* /5` without the space, `L`, `W`, `#`, nicknames like `@daily`; 0 is Sunday.
1156
1226
  *
1157
1227
  * Differences to the Scala server (Quartz, clustered JDBC job store in `mc_jobs_*`): the Quartz tables are not read, Quartz expressions
1158
- * like `0 0/5 * ? * * *` are not accepted, and every instance with an active scheduler runs the jobs (the handlers must allow that, the
1228
+ * like `0 0/5 * ? * * *` are not accepted (`MIGRATION_DROP_SCALA_LEFTOVERS` rewrites the one of the token cleanup), and every instance with an active scheduler runs the jobs (the handlers must allow that, the
1159
1229
  * token cleanup does). Changes of another instance are read with the refresh.
1160
1230
  */
1161
1231
  type JobConfig = Schemas['JobConfig'];
@@ -1181,9 +1251,10 @@ declare class JobScheduler {
1181
1251
  private readonly events;
1182
1252
  private readonly handlers;
1183
1253
  private readonly options;
1254
+ private readonly logger;
1184
1255
  private readonly entries;
1185
1256
  private timer;
1186
- constructor(database: MongocampDatabase, events: EventBus, handlers: Map<string, JobHandler>, options: SchedulerOptions);
1257
+ constructor(database: MongocampDatabase, events: EventBus, handlers: Map<string, JobHandler>, options: SchedulerOptions, logger?: MongocampLogger);
1187
1258
  get collection(): Collection;
1188
1259
  initialize(): Promise<void>;
1189
1260
  /** Reads the stored jobs and brings the schedules in line: new ones are added, changed ones rescheduled, removed ones stopped. */
@@ -1192,6 +1263,12 @@ declare class JobScheduler {
1192
1263
  private run;
1193
1264
  private information;
1194
1265
  list(): JobInformation[];
1266
+ /**
1267
+ * Adds the handler of a class name at runtime (a host that gets the server after its start, e.g. a Nuxt application through
1268
+ * `useMongocampCore()`). The stored jobs of that class are scheduled now; the returned function removes the handler again and stops them.
1269
+ */
1270
+ registerHandler(className: string, handler: JobHandler): () => void;
1271
+ private rescheduleClass;
1195
1272
  classes(): string[];
1196
1273
  /** Checks the class and the expression; an empty name is the simple name of the class (`addJob`). */
1197
1274
  private checked;
@@ -1272,6 +1349,8 @@ interface VersionInfo {
1272
1349
  /** Everything a route needs. One instance per server. */
1273
1350
  interface MongocampContext {
1274
1351
  config: ConfigStore;
1352
+ /** The log of the server (option `logger`, `console` by default). */
1353
+ logger: MongocampLogger;
1275
1354
  database: MongocampDatabase;
1276
1355
  version: VersionInfo;
1277
1356
  auth: AuthService;
@@ -1302,34 +1381,71 @@ interface MongocampServerOptions extends DatabaseOptions {
1302
1381
  shutdown?: (force: boolean) => void | Promise<void>;
1303
1382
  /** Interval in milliseconds to read configuration changes of other instances, `false` for none. Default one minute. */
1304
1383
  configRefresh?: number | false;
1305
- /**
1306
- * The jobs: `false` keeps the scheduler of this instance from running the jobs on their schedule (several instances of an application
1307
- * need only one that runs them); `handlers` adds job handlers by class name; `refresh` is the interval to read the job changes of other
1308
- * instances (default one minute, `false` for none).
1309
- */
1384
+ /** The log of the server (start, failed jobs and writes, 5xx errors); `console` when omitted. */
1385
+ logger?: MongocampLogger;
1310
1386
  /** Listeners of the events, registered before the start (`server:started`); later ones with `server.events.on(...)`. */
1311
1387
  on?: {
1312
1388
  [N in EventName]?: EventListener<N>;
1313
1389
  };
1390
+ /**
1391
+ * The jobs: `false` keeps the scheduler of this instance from running the jobs on their schedule (several instances of an application
1392
+ * need only one that runs them; the configuration `JOBS_ENABLED=false` does the same); `handlers` adds job handlers by class name (later
1393
+ * ones with `server.registerJobHandler(...)`); `refresh` is the interval to read the job changes of other instances (default one minute,
1394
+ * `false` for none).
1395
+ */
1314
1396
  jobs?: boolean | {
1315
1397
  enabled?: boolean;
1316
1398
  handlers?: Record<string, JobHandler>;
1317
1399
  refresh?: number | false;
1318
1400
  };
1319
1401
  }
1402
+ /** Options of one request. */
1403
+ interface FetchOptions {
1404
+ /**
1405
+ * The wide event of the request in the host (e.g. `useLogger(event)` of evlog): the server adds its fields under `mongocamp` (operation,
1406
+ * user, collection or bucket, rows, error code), the host emits it.
1407
+ */
1408
+ log?: RequestLog;
1409
+ /** The id of the request in the host (e.g. the one of its wide event), used for `x-request-id` and the events; a new one without. */
1410
+ requestId?: string;
1411
+ }
1320
1412
  interface MongocampServer {
1321
1413
  /** Web standard handler; paths start at the API root (`/version`, `/auth/login`, ...). */
1322
- fetch: (request: Request) => Promise<Response>;
1414
+ fetch: (request: Request, options?: FetchOptions) => Promise<Response>;
1323
1415
  context: MongocampContext;
1324
1416
  /** The registered routes as `METHOD /path/:param`, for checks against the OpenAPI spec. */
1325
1417
  routes: () => string[];
1326
1418
  /** The events of the server (`hookable`): `server.events.on('document:create', event => ...)`. */
1327
1419
  events: EventBus;
1420
+ /**
1421
+ * Adds a job handler after the start: the stored jobs with this `className` are scheduled right away. Returns a function that removes the
1422
+ * handler again. A Nuxt application registers its handlers this way in a Nitro plugin (`(await useMongocampCore()).registerJobHandler(...)`).
1423
+ */
1424
+ registerJobHandler: (className: string, handler: JobHandler) => () => void;
1328
1425
  close: () => Promise<void>;
1329
1426
  }
1330
1427
  /** Creates and connects a MongoCamp server. */
1331
1428
  declare function createMongocampServer(options?: MongocampServerOptions): Promise<MongocampServer>;
1332
1429
 
1430
+ /** The fields of the server in the wide event of a request (key `mongocamp`). */
1431
+ interface MongocampRequestFields {
1432
+ requestId: string;
1433
+ /** The operationId of the OpenAPI spec (`listDocuments`), `NOT_SET` for an unknown route. */
1434
+ operation: string;
1435
+ controller: string;
1436
+ /** The user the request was authenticated as; missing for public routes and invalid credentials. */
1437
+ user?: string;
1438
+ database?: string;
1439
+ collection?: string;
1440
+ bucket?: string;
1441
+ /** All matching rows of a paged list (`x-pagination-count-rows`). */
1442
+ rows?: number;
1443
+ /** `x-error-code` and `x-error-message` of an error response. */
1444
+ errorCode?: string;
1445
+ errorMessage?: string;
1446
+ }
1447
+ declare function requestFields(request: Request, response: Response, fields: HttpRequestFields, user: string | undefined): MongocampRequestFields;
1448
+
1333
1449
  /** Error codes of the API (`mongocamp-library/.../exception/ErrorCodes.scala`), sent in `ErrorDescription.code` and `x-error-code`. */
1334
1450
  declare const ErrorCodes: {
1335
1451
  /** A request that could not be decoded (body, query or header with an invalid value). */
@@ -1397,16 +1513,18 @@ declare function convertIdValue(id: unknown): unknown;
1397
1513
  declare function pathIdFilter(id: string): PlainObject;
1398
1514
 
1399
1515
  /**
1400
- * How documents are written in responses.
1516
+ * How documents are written in responses (query parameter `extendedJson`).
1401
1517
  *
1402
- * Without the query parameter `extendedJson` the documents are written as the Scala server did (`BsonConverter.asMap` + circe):
1403
- * ObjectIds as hex strings, dates as ISO-8601 instants, every number as JSON number (64 bit integers and decimals with all digits),
1404
- * regular expressions as their pattern. With `extendedJson=relaxed|canonical` they are MongoDB Extended JSON (`ExtendedJsonWriter.scala`).
1518
+ * - `relaxed` (the default since 2.0.0) and `canonical`: MongoDB Extended JSON (`ExtendedJsonWriter.scala`), the types of ids, dates,
1519
+ * decimals, binary data and regular expressions stay visible (`{"$oid": ...}`, `{"$date": ...}`); canonical also wraps every number.
1520
+ * A text that looks like a date is written as `{"$string": ...}`, so a request body gives it back as text.
1521
+ * - `plain` (the default of 1.x, the format of the Scala server, `BsonConverter.asMap` + circe): ObjectIds as hex strings, dates as
1522
+ * ISO-8601 instants, every number as JSON number (64 bit integers and decimals with all digits), regular expressions as their pattern.
1405
1523
  */
1406
- type ExtendedJsonMode = 'relaxed' | 'canonical';
1407
- /** The mode of the query parameter `extendedJson`; `undefined` without it. Another value is a bad request. */
1524
+ type ExtendedJsonMode = 'relaxed' | 'canonical' | 'plain';
1525
+ /** The mode of the query parameter `extendedJson`; `undefined` without it (the caller picks the default). Another value is a bad request. */
1408
1526
  declare function parseExtendedJsonMode(value: string | null | undefined): ExtendedJsonMode | undefined;
1409
- /** A document for a response: the default format, or Extended JSON for the query parameter `extendedJson`. */
1527
+ /** A document for a response in the mode of the query parameter `extendedJson`, relaxed Extended JSON by default. */
1410
1528
  declare function documentToJson(document: Record<string, unknown>, mode?: ExtendedJsonMode): Record<string, unknown>;
1411
1529
 
1412
1530
  /**
@@ -1456,11 +1574,15 @@ declare class LuceneQueryError extends Error {
1456
1574
  }
1457
1575
 
1458
1576
  /**
1459
- * A Lucene query as MongoDB filter, ported from `LuceneQueryConverter.scala` of the Scala driver with its results (also where they
1460
- * are surprising, e.g. a negated AND group becomes `$nor` of the terms; the server pins these results in its tests).
1577
+ * A Lucene query as MongoDB filter (from `LuceneQueryConverter.scala` of the Scala driver, with Lucene's boolean rules since 2.0.0).
1461
1578
  *
1579
+ * - a group matches its required clauses (MUST) and none of its prohibited ones (MUST_NOT); its optional clauses (SHOULD) only count
1580
+ * without a required clause, then one of them has to match, as in Lucene
1581
+ * - a group of prohibited clauses only matches every document except them (like Elasticsearch and Solr, Lucene itself matches nothing)
1582
+ * - a prohibited group is negated as a whole: `-(a AND b)` is "not both", `$nor` of the group
1462
1583
  * - terms are `$eq` / `$ne` with the converted value (number, boolean, date or text)
1463
- * - wildcards and prefixes are anchored, case-insensitive regular expressions that match line breaks (`$options: "is"`)
1584
+ * - wildcards and prefixes are anchored, case-sensitive regular expressions that match line breaks (`$options: "s"`), so an index on the
1585
+ * field serves a prefix (`abc*`); `caseInsensitive` adds the option `i` (the behaviour before 2.0.0, which cannot use index bounds)
1464
1586
  * - ranges are `$gte`/`$gt`/`$lte`/`$lt`, `[* TO *]`, `field:*` and `_exists_:field` are `$exists`
1465
1587
  *
1466
1588
  * With `searchWithValueAndString` a value that converts (e.g. the number `123`) is also searched as the text (`"123"`).
@@ -1468,6 +1590,10 @@ declare class LuceneQueryError extends Error {
1468
1590
  type Filter = Record<string, unknown>;
1469
1591
  interface ConvertOptions {
1470
1592
  searchWithValueAndString?: boolean;
1593
+ /** Wildcards and prefixes ignore the case (query parameter `filterCaseInsensitive`). */
1594
+ caseInsensitive?: boolean;
1595
+ /** The time zone of dates without offset (`FILTER_TIME_ZONE`), UTC by default. */
1596
+ timeZone?: string;
1471
1597
  }
1472
1598
  declare function luceneQueryToFilter(query: LuceneQuery, options?: ConvertOptions): Filter;
1473
1599
 
@@ -1480,10 +1606,10 @@ declare const FilterDefaultField = "";
1480
1606
  declare function luceneToFilter(input: string, defaultField: string, options?: ConvertOptions): Record<string, unknown>;
1481
1607
  /**
1482
1608
  * The `filter` query parameter of the server (`LuceneQueryTools.parseFilter` + `toFilterMap`): the MongoDB filter of the query, an
1483
- * empty filter without one. A filter that cannot be parsed or converted is a decode failure of the parameter (400, code 4001) with
1609
+ * empty filter without one or for a blank one. A filter that cannot be parsed or converted is a decode failure of the parameter (400, code 4001) with
1484
1610
  * the first line of the reason as additional info. The `_id` and wrapper conversion (`convertFields`) is applied by the routes.
1485
1611
  */
1486
- declare function filterParameter(input: string | null | undefined, parameter?: string): Record<string, unknown>;
1612
+ declare function filterParameter(input: string | null | undefined, options?: ConvertOptions, parameter?: string): Record<string, unknown>;
1487
1613
 
1488
- export { CleanUpTokenJob, CleanUpTokenJobClass, ConfigKeys, ConfigStore, ConfigurationError, DefaultRowsPerPage, ErrorCodes, EventBus, FilterDefaultField, JobScheduler, LuceneQueryError, MongocampError, PaginationHeaders, TextMarker, configDefinitions, convertFields, convertIdValue, createMongocampServer, decodeAny, documentToJson, filterParameter, luceneQueryToFilter, luceneToFilter, parseExtendedJsonMode, parseJson, parseLuceneQuery, pathIdFilter, stringifyJson };
1489
- export type { ConfigDefinition, ConfigKey, ConfigType, ConvertOptions, ErrorDescription, EventListener, EventName, ExtendedJsonMode, JobConfig, JobHandler, JobInformation, JobRun, LuceneQuery, MongocampContext, MongocampEvent, MongocampEvents, MongocampServer, MongocampServerOptions, PaginationInfo, Paging, VersionInfo };
1614
+ export { CleanUpTokenJob, CleanUpTokenJobClass, ConfigKeys, ConfigStore, ConfigurationError, DefaultRowsPerPage, ErrorCodes, EventBus, FilterDefaultField, JobScheduler, LuceneQueryError, MongocampError, PaginationHeaders, TextMarker, configDefinitions, consoleLogger, convertFields, convertIdValue, createMongocampServer, decodeAny, documentToJson, filterParameter, luceneQueryToFilter, luceneToFilter, parseExtendedJsonMode, parseJson, parseLuceneQuery, pathIdFilter, requestFields, stringifyJson };
1615
+ export type { ConfigDefinition, ConfigKey, ConfigType, ConvertOptions, ErrorDescription, EventListener, EventName, ExtendedJsonMode, FetchOptions, JobConfig, JobHandler, JobInformation, JobRun, LuceneQuery, MongocampContext, MongocampEvent, MongocampEvents, MongocampLogger, MongocampRequestFields, MongocampServer, MongocampServerOptions, PaginationInfo, Paging, RequestLog, VersionInfo };