@unchainedshop/core-quotations 4.4.0 → 4.5.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.
@@ -2,9 +2,10 @@ import { type SortOption } from '@unchainedshop/utils';
2
2
  import { type Quotation, QuotationStatus } from '../db/QuotationsCollection.ts';
3
3
  import { mongodb, type ModuleInput } from '@unchainedshop/mongodb';
4
4
  import { type QuotationsSettingsOptions } from '../quotations-settings.ts';
5
- export interface QuotationQuery extends mongodb.Filter<Quotation> {
5
+ export interface QuotationQuery {
6
6
  userId?: string;
7
7
  queryString?: string;
8
+ quotationIds?: string[];
8
9
  }
9
10
  export interface QuotationData {
10
11
  configuration?: {
@@ -15,7 +16,7 @@ export interface QuotationData {
15
16
  productId: string;
16
17
  userId: string;
17
18
  }
18
- export declare const buildFindSelector: ({ userId, queryString, ...rest }?: QuotationQuery) => mongodb.Filter<Quotation>;
19
+ export declare const buildFindSelector: ({ userId, queryString, quotationIds }?: QuotationQuery) => mongodb.Filter<Quotation>;
19
20
  export declare const configureQuotationsModule: ({ db, migrationRepository, options: quotationsOptions, }: ModuleInput<QuotationsSettingsOptions>) => Promise<{
20
21
  count: (query: QuotationQuery) => Promise<number>;
21
22
  openQuotationWithProduct: ({ productId }: {
@@ -6,11 +6,14 @@ import { QuotationsCollection } from "../db/QuotationsCollection.js";
6
6
  import { quotationsSettings } from "../quotations-settings.js";
7
7
  import renameCurrencyCode from "../migrations/20250502111800-currency-code.js";
8
8
  const QUOTATION_EVENTS = ['QUOTATION_REQUEST_CREATE', 'QUOTATION_REMOVE', 'QUOTATION_UPDATE'];
9
- export const buildFindSelector = ({ userId, queryString, ...rest } = {}) => {
10
- const selector = { ...rest };
9
+ export const buildFindSelector = ({ userId, queryString, quotationIds } = {}) => {
10
+ const selector = {};
11
11
  if (userId) {
12
12
  selector.userId = userId;
13
13
  }
14
+ if (quotationIds) {
15
+ selector._id = { $in: quotationIds };
16
+ }
14
17
  if (queryString) {
15
18
  assertDocumentDBCompatMode();
16
19
  selector.$text = { $search: queryString };
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@unchainedshop/core-quotations",
3
- "version": "4.4.0",
3
+ "version": "4.5.0",
4
4
  "main": "lib/quotations-index.js",
5
5
  "types": "lib/quotations-index.d.ts",
6
6
  "type": "module",
7
+ "sideEffects": false,
7
8
  "scripts": {
8
9
  "clean": "tsc -b --clean",
9
10
  "build": "tsc -b",
@@ -33,9 +34,9 @@
33
34
  },
34
35
  "homepage": "https://github.com/unchainedshop/unchained#readme",
35
36
  "dependencies": {
36
- "@unchainedshop/events": "^4.4.0",
37
- "@unchainedshop/logger": "^4.4.0",
38
- "@unchainedshop/utils": "^4.4.0"
37
+ "@unchainedshop/events": "^4.5.0",
38
+ "@unchainedshop/logger": "^4.5.0",
39
+ "@unchainedshop/utils": "^4.5.0"
39
40
  },
40
41
  "devDependencies": {
41
42
  "@types/node": "^25.0.0",