abmp-npm 1.8.32 → 1.8.33

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/backend/consts.js CHANGED
@@ -11,18 +11,6 @@ const CONFIG_KEYS = {
11
11
  const MAX__MEMBERS_SEARCH_RESULTS = 120;
12
12
  const WIX_QUERY_MAX_LIMIT = 1000;
13
13
 
14
- /**
15
- * Member action types
16
- * @readonly
17
- * @enum {string}
18
- */
19
- const MEMBER_ACTIONS = {
20
- UPDATE: 'update',
21
- NEW: 'new',
22
- DROP: 'drop',
23
- NONE: 'none',
24
- };
25
-
26
14
  const TASKS_NAMES = {
27
15
  ScheduleDailyMembersDataSync: 'ScheduleDailyMembersDataSync',
28
16
  ScheduleMembersDataPerAction: 'ScheduleMembersDataPerAction',
@@ -35,7 +23,6 @@ module.exports = {
35
23
  CONFIG_KEYS,
36
24
  MAX__MEMBERS_SEARCH_RESULTS,
37
25
  WIX_QUERY_MAX_LIMIT,
38
- MEMBER_ACTIONS,
39
26
  TASKS_NAMES,
40
27
  GEO_HASH_PRECISION,
41
28
  };
@@ -1,7 +1,7 @@
1
1
  const { COLLECTIONS } = require('../public/consts');
2
2
 
3
- const { MEMBER_ACTIONS } = require('./consts');
4
3
  const { updateMemberContactInfo } = require('./contacts-methods');
4
+ const { MEMBER_ACTIONS } = require('./daily-pull');
5
5
  const { wixData } = require('./elevated-modules');
6
6
  const { createSiteMember, getCurrentMember } = require('./members-area-methods');
7
7
  const {
@@ -11,9 +11,9 @@ const {
11
11
  formatDateToMonthYear,
12
12
  getAddressDisplayOptions,
13
13
  isStudent,
14
- urlExists,
15
14
  generateGeoHash,
16
15
  } = require('./utils');
16
+
17
17
  /**
18
18
  * Retrieves member data by member ID
19
19
  * @param {string} memberId - The member ID to search for
@@ -283,6 +283,39 @@ async function saveRegistrationData(data, id) {
283
283
  }
284
284
  }
285
285
 
286
+ /**
287
+ * Checks if a URL already exists in the database for a different member (case-insensitive)
288
+ * @param {string} url - The URL to check
289
+ * @param {string|number} excludeMemberId - Member ID to exclude from the check
290
+ * @returns {Promise<boolean>} - True if URL exists for another member
291
+ */
292
+ async function urlExists(url, excludeMemberId) {
293
+ if (!url) return false;
294
+
295
+ try {
296
+ let query = wixData
297
+ .query(COLLECTIONS.MEMBERS_DATA)
298
+ .contains('url', url)
299
+ .ne('action', MEMBER_ACTIONS.DROP);
300
+
301
+ if (excludeMemberId) {
302
+ query = query.ne('memberId', excludeMemberId);
303
+ }
304
+
305
+ const { items } = await query.find();
306
+
307
+ // Case-insensitive comparison
308
+ const matchingMembers = items.filter(
309
+ item => item.url && item.url.toLowerCase() === url.toLowerCase()
310
+ );
311
+
312
+ return matchingMembers.length > 0;
313
+ } catch (error) {
314
+ console.error('Error checking URL existence:', error);
315
+ return false;
316
+ }
317
+ }
318
+
286
319
  module.exports = {
287
320
  findMemberByWixDataId,
288
321
  createContactAndMemberIfNew,
package/backend/utils.js CHANGED
@@ -4,6 +4,7 @@ const { COLLECTIONS } = require('../public/consts');
4
4
 
5
5
  const { CONFIG_KEYS, GEO_HASH_PRECISION } = require('./consts');
6
6
  const { wixData } = require('./elevated-modules');
7
+ const { urlExists } = require('./members-data-methods');
7
8
 
8
9
  /**
9
10
  * Retrieves site configuration values from the database
@@ -81,35 +82,6 @@ function getAddressDisplayOptions(member) {
81
82
  return displayOptions;
82
83
  }
83
84
 
84
- /**
85
- * Checks if a URL already exists in the database for a different member (case-insensitive)
86
- * @param {string} url - The URL to check
87
- * @param {string|number} excludeMemberId - Member ID to exclude from the check
88
- * @returns {Promise<boolean>} - True if URL exists for another member
89
- */
90
- async function urlExists(url, excludeMemberId) {
91
- if (!url) return false;
92
-
93
- try {
94
- let query = wixData.query(COLLECTIONS.MEMBERS_DATA).contains('url', url).ne('action', 'drop');
95
-
96
- if (excludeMemberId) {
97
- query = query.ne('memberId', excludeMemberId);
98
- }
99
-
100
- const { items } = await query.find();
101
-
102
- // Case-insensitive comparison
103
- const matchingMembers = items.filter(
104
- item => item.url && item.url.toLowerCase() === url.toLowerCase()
105
- );
106
-
107
- return matchingMembers.length > 0;
108
- } catch (error) {
109
- console.error('Error checking URL existence:', error);
110
- return false;
111
- }
112
- }
113
85
  const queryAllItems = async query => {
114
86
  console.log('start query');
115
87
  let oldResults = await query.find();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abmp-npm",
3
- "version": "1.8.32",
3
+ "version": "1.8.33",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",