@unchainedshop/core-events 3.1.1 → 3.1.5
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/lib/db/EventsCollection.d.ts.map +1 -1
- package/lib/module/configureEventHistoryAdapter.d.ts.map +1 -1
- package/lib/module/configureEventsModule.d.ts.map +1 -1
- package/package.json +4 -5
- package/src/module/buildFindSelector.test.ts +17 -13
- package/jest.config.js +0 -17
- package/lib/db/EventsSchema.d.ts +0 -3
- package/lib/db/EventsSchema.d.ts.map +0 -1
- package/lib/db/EventsSchema.js +0 -9
- package/lib/db/EventsSchema.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventsCollection.d.ts","sourceRoot":"","sources":["../../src/db/EventsCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD,MAAM,MAAM,KAAK,GAAG;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,GAAG,eAAe,CAAC;AAEpB,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"EventsCollection.d.ts","sourceRoot":"","sources":["../../src/db/EventsCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD,MAAM,MAAM,KAAK,GAAG;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,GAAG,eAAe,CAAC;AAEpB,eAAO,MAAM,gBAAgB,GAAU,IAAI,OAAO,CAAC,EAAE,uCAsBpD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configureEventHistoryAdapter.d.ts","sourceRoot":"","sources":["../../src/module/configureEventHistoryAdapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,eAAO,MAAM,4BAA4B,
|
|
1
|
+
{"version":3,"file":"configureEventHistoryAdapter.d.ts","sourceRoot":"","sources":["../../src/module/configureEventHistoryAdapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,eAAO,MAAM,4BAA4B,GACvC,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,cAAc,CAAC,GAAG,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,OAAO,CAAC,SAiBnG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configureEventsModule.d.ts","sourceRoot":"","sources":["../../src/module/configureEventsModule.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAIP,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAiB,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAoB,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAGpE,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,WAAW,CAAC,E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eAAe,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,KAItE,OAAO,CAAC,WAAW,EAAE,CAAC;EAyD5B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/core-events",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.5",
|
|
4
4
|
"main": "lib/events-index.js",
|
|
5
5
|
"types": "lib/events-index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"build": "tsc -b",
|
|
10
10
|
"prepublishOnly": "npm run clean && npm run build",
|
|
11
11
|
"watch": "tsc -w",
|
|
12
|
-
"test": "
|
|
13
|
-
"test:watch": "
|
|
12
|
+
"test": "tsx --test",
|
|
13
|
+
"test:watch": "tsx --test --watch"
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
@@ -36,8 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^22.13.4",
|
|
39
|
-
"
|
|
40
|
-
"ts-jest": "^29.2.5",
|
|
39
|
+
"tsx": "^4.19.2",
|
|
41
40
|
"typescript": "^5.7.3"
|
|
42
41
|
}
|
|
43
42
|
}
|
|
@@ -1,36 +1,40 @@
|
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import assert from 'node:assert';
|
|
1
3
|
import { buildFindSelector } from './configureEventsModule.js';
|
|
2
4
|
|
|
3
5
|
describe('buildFindSelector', () => {
|
|
4
6
|
it('Return correct filter object when passed create, queryString, types', () => {
|
|
5
|
-
|
|
7
|
+
assert.deepStrictEqual(
|
|
6
8
|
buildFindSelector({
|
|
7
9
|
created: new Date('2022-12-03T18:23:38.278Z'),
|
|
8
10
|
queryString: 'Hello world',
|
|
9
11
|
types: ['PRODUCT_CREATED'],
|
|
10
12
|
}),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
{
|
|
14
|
+
type: { $in: ['PRODUCT_CREATED'] },
|
|
15
|
+
$text: { $search: 'Hello world' },
|
|
16
|
+
created: { $gte: new Date('2022-12-03T18:23:38.278Z') },
|
|
17
|
+
},
|
|
18
|
+
);
|
|
16
19
|
});
|
|
17
20
|
|
|
18
21
|
it('Return correct filter object when passed create, queryString', () => {
|
|
19
|
-
|
|
22
|
+
assert.deepStrictEqual(
|
|
20
23
|
buildFindSelector({ created: new Date('2022-12-03T18:23:38.278Z'), queryString: 'Hello world' }),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
{
|
|
25
|
+
$text: { $search: 'Hello world' },
|
|
26
|
+
created: { $gte: new Date('2022-12-03T18:23:38.278Z') },
|
|
27
|
+
},
|
|
28
|
+
);
|
|
25
29
|
});
|
|
26
30
|
|
|
27
31
|
it('Return correct filter object when passed create', () => {
|
|
28
|
-
|
|
32
|
+
assert.deepStrictEqual(buildFindSelector({ created: new Date('2022-12-03T18:23:38.278Z') }), {
|
|
29
33
|
created: { $gte: new Date('2022-12-03T18:23:38.278Z') },
|
|
30
34
|
});
|
|
31
35
|
});
|
|
32
36
|
|
|
33
37
|
it('Return correct filter object when passed no argument', () => {
|
|
34
|
-
|
|
38
|
+
assert.deepStrictEqual(buildFindSelector({}), {});
|
|
35
39
|
});
|
|
36
40
|
});
|
package/jest.config.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
|
|
2
|
-
export default {
|
|
3
|
-
preset: 'ts-jest/presets/default-esm', // or other ESM presets
|
|
4
|
-
testEnvironment: 'node',
|
|
5
|
-
extensionsToTreatAsEsm: ['.ts'],
|
|
6
|
-
transform: {
|
|
7
|
-
'^.+\\.tsx?$': [
|
|
8
|
-
'ts-jest',
|
|
9
|
-
{
|
|
10
|
-
useESM: true,
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
},
|
|
14
|
-
moduleNameMapper: {
|
|
15
|
-
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
16
|
-
},
|
|
17
|
-
};
|
package/lib/db/EventsSchema.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventsSchema.d.ts","sourceRoot":"","sources":["../../src/db/EventsSchema.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,eAAO,MAAM,YAAY,cAQxB,CAAC"}
|
package/lib/db/EventsSchema.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Schemas } from '@unchainedshop/utils';
|
|
2
|
-
import SimpleSchema from 'simpl-schema';
|
|
3
|
-
export const EventsSchema = new SimpleSchema({
|
|
4
|
-
type: { type: String, required: true },
|
|
5
|
-
payload: { type: Object, blackbox: true },
|
|
6
|
-
context: { type: Object, blackbox: true },
|
|
7
|
-
...Schemas.timestampFields,
|
|
8
|
-
}, { requiredByDefault: false });
|
|
9
|
-
//# sourceMappingURL=EventsSchema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventsSchema.js","sourceRoot":"","sources":["../../src/db/EventsSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,YAAY,MAAM,cAAc,CAAC;AAExC,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,YAAY,CAC1C;IACE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACzC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACzC,GAAG,OAAO,CAAC,eAAe;CAC3B,EACD,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CAAC"}
|