@unchainedshop/core-events 4.8.10 → 4.8.12

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.
@@ -1,26 +1,24 @@
1
- import { isDocumentDBCompatModeEnabled, mongodb } from '@unchainedshop/mongodb';
1
+ import { mongodb } from '@unchainedshop/mongodb';
2
2
  import { buildDbIndexes } from '@unchainedshop/mongodb';
3
- const TWO_DAYS_SEC = 172800;
3
+ const EVENTS_TTL_SECONDS = Number(process.env.EVENTS_TTL_SECONDS) || 172800;
4
4
  export const EventsCollection = async (db) => {
5
5
  const Events = db.collection('events');
6
- if (!isDocumentDBCompatModeEnabled()) {
7
- await buildDbIndexes(Events, [
8
- {
9
- index: { _id: 'text', type: 'text' },
10
- options: {
11
- weights: {
12
- _id: 8,
13
- type: 4,
14
- },
15
- name: 'events_fulltext_search',
6
+ await buildDbIndexes(Events, [
7
+ {
8
+ index: { _id: 'text', type: 'text' },
9
+ options: {
10
+ weights: {
11
+ _id: 8,
12
+ type: 4,
16
13
  },
14
+ name: 'events_fulltext_search',
17
15
  },
18
- ]);
19
- }
16
+ },
17
+ ]);
20
18
  await buildDbIndexes(Events, [
21
19
  {
22
20
  index: { created: -1 },
23
- options: { expireAfterSeconds: TWO_DAYS_SEC, name: 'created' },
21
+ options: { expireAfterSeconds: EVENTS_TTL_SECONDS, name: 'created' },
24
22
  },
25
23
  { index: { type: 1 }, options: { name: 'type' } },
26
24
  ]);
@@ -1,4 +1,4 @@
1
- import { mongodb, generateDbFilterById, buildSortOptions, generateDbObjectId, assertDocumentDBCompatMode, } from '@unchainedshop/mongodb';
1
+ import { mongodb, generateDbFilterById, buildSortOptions, generateDbObjectId, } from '@unchainedshop/mongodb';
2
2
  import { getRegisteredEvents } from '@unchainedshop/events';
3
3
  import { SortDirection } from '@unchainedshop/utils';
4
4
  import { EventsCollection } from "../db/EventsCollection.js";
@@ -10,7 +10,6 @@ export const buildFindSelector = ({ types, queryString, created }) => {
10
10
  if (types && Array.isArray(types))
11
11
  selector.type = { $in: types };
12
12
  if (queryString) {
13
- assertDocumentDBCompatMode();
14
13
  selector.$text = { $search: queryString };
15
14
  }
16
15
  if (created) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unchainedshop/core-events",
3
3
  "description": "Event history and tracking module for the Unchained Engine",
4
- "version": "4.8.10",
4
+ "version": "4.8.12",
5
5
  "main": "lib/events-index.js",
6
6
  "types": "lib/events-index.d.ts",
7
7
  "type": "module",
@@ -35,8 +35,8 @@
35
35
  },
36
36
  "homepage": "https://github.com/unchainedshop/unchained#readme",
37
37
  "dependencies": {
38
- "@unchainedshop/events": "^4.6.0",
39
- "@unchainedshop/utils": "^4.6.0"
38
+ "@unchainedshop/events": "^4.8.12",
39
+ "@unchainedshop/utils": "^4.8.12"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "^25.0.0",