@adobe/spacecat-shared-data-access 2.65.1 → 2.65.2
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/models/base/base.collection.js +0 -22
- package/src/models/base/base.model.js +0 -4
- package/src/models/base/entity.registry.js +0 -12
- package/src/models/base/reference.js +0 -1
- package/src/models/base/schema.js +2 -8
- package/src/models/site-top-form/site-top-form.collection.js +1 -1
- package/src/models/suggestion/suggestion.collection.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v2.65.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.65.1...@adobe/spacecat-shared-data-access-v2.65.2) (2025-10-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* remove all debug logs from data access ([#994](https://github.com/adobe/spacecat-shared/issues/994)) ([453d55b](https://github.com/adobe/spacecat-shared/commit/453d55bde5373519b9102ffdc8ca1ea523338078))
|
|
7
|
+
|
|
1
8
|
# [@adobe/spacecat-shared-data-access-v2.65.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.65.0...@adobe/spacecat-shared-data-access-v2.65.1) (2025-10-01)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -260,26 +260,12 @@ class BaseCollection {
|
|
|
260
260
|
|| (options.fetchAllPages !== false && !options.limit);
|
|
261
261
|
|
|
262
262
|
if (shouldFetchAllPages) {
|
|
263
|
-
let pageCount = 1;
|
|
264
|
-
const startTime = Date.now();
|
|
265
|
-
|
|
266
263
|
while (result.cursor) {
|
|
267
|
-
pageCount += 1;
|
|
268
264
|
queryOptions.cursor = result.cursor;
|
|
269
265
|
// eslint-disable-next-line no-await-in-loop
|
|
270
266
|
result = await query.go(queryOptions);
|
|
271
267
|
allData = allData.concat(result.data);
|
|
272
268
|
}
|
|
273
|
-
|
|
274
|
-
// Debug logging to track pagination behavior
|
|
275
|
-
if (pageCount > 1) {
|
|
276
|
-
this.log.debug(`Pagination completed for ${this.entityName}`, {
|
|
277
|
-
entityName: this.entityName,
|
|
278
|
-
totalPages: pageCount,
|
|
279
|
-
totalRecords: allData.length,
|
|
280
|
-
queryDuration: Date.now() - startTime,
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
269
|
}
|
|
284
270
|
|
|
285
271
|
if (options.limit === 1) {
|
|
@@ -415,8 +401,6 @@ class BaseCollection {
|
|
|
415
401
|
|
|
416
402
|
this.#invalidateCache();
|
|
417
403
|
|
|
418
|
-
this.log.debug(`Created item for [${this.entityName}]`); // ~100k logs
|
|
419
|
-
|
|
420
404
|
await this.#onCreate(instance);
|
|
421
405
|
|
|
422
406
|
return instance;
|
|
@@ -495,8 +479,6 @@ class BaseCollection {
|
|
|
495
479
|
|
|
496
480
|
this.#invalidateCache();
|
|
497
481
|
|
|
498
|
-
this.log.debug(`Created ${createdItems.length} items for [${this.entityName}]`);
|
|
499
|
-
|
|
500
482
|
await this.#onCreateMany({ createdItems, errorItems });
|
|
501
483
|
|
|
502
484
|
return { createdItems, errorItems };
|
|
@@ -537,8 +519,6 @@ class BaseCollection {
|
|
|
537
519
|
this.log.error(`Failed to process all items in batch write for [${this.entityName}]: ${JSON.stringify(response.unprocessed)}`);
|
|
538
520
|
}
|
|
539
521
|
|
|
540
|
-
this.log.debug(`Updated ${items.length} items for [${this.entityName}]`);
|
|
541
|
-
|
|
542
522
|
return this.#invalidateCache();
|
|
543
523
|
} catch (error) {
|
|
544
524
|
return this.#logAndThrowError('Failed to save many', error);
|
|
@@ -565,8 +545,6 @@ class BaseCollection {
|
|
|
565
545
|
|
|
566
546
|
await this.entity.delete(ids.map((id) => ({ [this.idName]: id }))).go();
|
|
567
547
|
|
|
568
|
-
this.log.debug(`Removed ${ids.length} items for [${this.entityName}]`);
|
|
569
|
-
|
|
570
548
|
return this.#invalidateCache();
|
|
571
549
|
} catch (error) {
|
|
572
550
|
return this.#logAndThrowError('Failed to remove by IDs', error);
|
|
@@ -267,8 +267,6 @@ class BaseModel {
|
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
|
|
270
|
-
this.log.debug(`Removing entity ${this.entityName} with ID ${this.getId()} and ${dependents.length} dependents`);
|
|
271
|
-
|
|
272
270
|
await Promise.all(removePromises);
|
|
273
271
|
|
|
274
272
|
await this.entity.remove({ [this.idName]: this.getId() }).go();
|
|
@@ -297,8 +295,6 @@ class BaseModel {
|
|
|
297
295
|
async save() {
|
|
298
296
|
// todo: validate associations
|
|
299
297
|
try {
|
|
300
|
-
this.log.debug(`Saving entity ${this.entityName} with ID ${this.getId()}`);
|
|
301
|
-
|
|
302
298
|
await this.patcher.save();
|
|
303
299
|
this.#invalidateCache();
|
|
304
300
|
|
|
@@ -97,18 +97,6 @@ class EntityRegistry {
|
|
|
97
97
|
const collection = new Collection(this.service, this, schema, this.log);
|
|
98
98
|
this.collections.set(Collection.name, collection);
|
|
99
99
|
});
|
|
100
|
-
|
|
101
|
-
this.#logIndexes();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
#logIndexes() {
|
|
105
|
-
// reduce collection schema indexes into object
|
|
106
|
-
const indexes = Object.values(EntityRegistry.entities).reduce((acc, { schema }) => {
|
|
107
|
-
acc[schema.getEntityName()] = schema.indexes;
|
|
108
|
-
return acc;
|
|
109
|
-
}, {});
|
|
110
|
-
|
|
111
|
-
this.log.debug('Indexes:', JSON.stringify(indexes, null, 2));
|
|
112
100
|
}
|
|
113
101
|
|
|
114
102
|
/**
|
|
@@ -315,16 +315,15 @@ class Schema {
|
|
|
315
315
|
* @throws {SchemaError} - Throws an error if the entity is not a BaseModel or BaseCollection.
|
|
316
316
|
* @return {Object[]}
|
|
317
317
|
*/
|
|
318
|
-
toAccessorConfigs(entity
|
|
318
|
+
toAccessorConfigs(entity) {
|
|
319
319
|
if (!(entity instanceof BaseModel) && !(entity instanceof BaseCollection)) {
|
|
320
320
|
throw new SchemaError(this, 'Entity must extend BaseModel or BaseCollection');
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
const indexAccessors = this.getIndexAccessors();
|
|
324
324
|
const accessorConfigs = [];
|
|
325
|
-
const createdAccessors = [];
|
|
326
325
|
|
|
327
|
-
indexAccessors.forEach(({
|
|
326
|
+
indexAccessors.forEach(({ keySets }) => {
|
|
328
327
|
// generate a method for each prefix of the keySets array
|
|
329
328
|
// for example, if keySets = ['opportunityId', 'status'], we create:
|
|
330
329
|
// allByOpportunityId(...)
|
|
@@ -346,14 +345,9 @@ class Schema {
|
|
|
346
345
|
name: keyNamesToMethodName(subset, 'findBy'),
|
|
347
346
|
requiredKeys: subset,
|
|
348
347
|
});
|
|
349
|
-
createdAccessors.push(`index [${indexName}] with keys [${subset.join(', ')}]`);
|
|
350
348
|
});
|
|
351
349
|
});
|
|
352
350
|
|
|
353
|
-
if (createdAccessors.length > 0) {
|
|
354
|
-
log.debug(`Created accessors:\n${createdAccessors.map((accessor) => ` - ${accessor}`).join('\n')}`);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
351
|
return accessorConfigs;
|
|
358
352
|
}
|
|
359
353
|
|
|
@@ -150,7 +150,7 @@ class SiteTopFormCollection extends BaseCollection {
|
|
|
150
150
|
});
|
|
151
151
|
} catch (legacyError) {
|
|
152
152
|
// If the null search also fails, ignore and return the original null result
|
|
153
|
-
this.log.
|
|
153
|
+
this.log.error(`Legacy null formSource search failed: ${legacyError.message}`);
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
|