@sprucelabs/data-stores 28.1.8 → 28.1.10
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.
|
@@ -756,7 +756,7 @@ const databaseAssertUtil = {
|
|
|
756
756
|
assert.isEqual(indexes[0][0].toLowerCase(), 'uniquefield');
|
|
757
757
|
yield db.syncUniqueIndexes(this.collectionName, [
|
|
758
758
|
{
|
|
759
|
-
fields: ['
|
|
759
|
+
fields: ['uniqueField'],
|
|
760
760
|
filter: { isActive: true },
|
|
761
761
|
},
|
|
762
762
|
]);
|
|
@@ -766,7 +766,7 @@ const databaseAssertUtil = {
|
|
|
766
766
|
filter: { otherField: { $exists: true } },
|
|
767
767
|
},
|
|
768
768
|
{
|
|
769
|
-
fields: ['
|
|
769
|
+
fields: ['uniqueField'],
|
|
770
770
|
filter: { isActive: true },
|
|
771
771
|
},
|
|
772
772
|
]);
|
|
@@ -1474,9 +1474,9 @@ const databaseAssertUtil = {
|
|
|
1474
1474
|
try {
|
|
1475
1475
|
yield db.syncUniqueIndexes(this.collectionName, [
|
|
1476
1476
|
{
|
|
1477
|
-
fields: ['
|
|
1477
|
+
fields: ['uniqueField', 'someField3'],
|
|
1478
1478
|
filter: {
|
|
1479
|
-
|
|
1479
|
+
uniqueField: { $exists: true },
|
|
1480
1480
|
},
|
|
1481
1481
|
},
|
|
1482
1482
|
]);
|
|
@@ -1487,9 +1487,9 @@ const databaseAssertUtil = {
|
|
|
1487
1487
|
}
|
|
1488
1488
|
try {
|
|
1489
1489
|
yield db.createOne(this.collectionName, {
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1490
|
+
uniqueField: 'test',
|
|
1491
|
+
slug: null,
|
|
1492
|
+
someField3: 'test',
|
|
1493
1493
|
});
|
|
1494
1494
|
}
|
|
1495
1495
|
catch (err) {
|
|
@@ -1497,30 +1497,30 @@ const databaseAssertUtil = {
|
|
|
1497
1497
|
err.stack) !== null && _b !== void 0 ? _b : err.message);
|
|
1498
1498
|
}
|
|
1499
1499
|
yield assert.doesThrowAsync(() => db.createOne(this.collectionName, {
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1500
|
+
uniqueField: 'test',
|
|
1501
|
+
slug: null,
|
|
1502
|
+
someField3: 'test',
|
|
1503
1503
|
}), undefined, `Creating a duplicate record with should throw an error.`);
|
|
1504
1504
|
yield db.createOne(this.collectionName, {
|
|
1505
|
-
|
|
1506
|
-
|
|
1505
|
+
slug: '555-000-0000',
|
|
1506
|
+
someField3: 'test',
|
|
1507
1507
|
});
|
|
1508
1508
|
yield db.createOne(this.collectionName, {
|
|
1509
|
-
|
|
1510
|
-
|
|
1509
|
+
slug: '555-000-0001',
|
|
1510
|
+
someField3: 'test',
|
|
1511
1511
|
});
|
|
1512
1512
|
try {
|
|
1513
1513
|
yield db.syncUniqueIndexes(this.collectionName, [
|
|
1514
1514
|
{
|
|
1515
|
-
fields: ['
|
|
1515
|
+
fields: ['uniqueField', 'someField3'],
|
|
1516
1516
|
filter: {
|
|
1517
|
-
|
|
1517
|
+
uniqueField: { $exists: true },
|
|
1518
1518
|
},
|
|
1519
1519
|
},
|
|
1520
1520
|
{
|
|
1521
|
-
fields: ['
|
|
1521
|
+
fields: ['slug', 'someField3'],
|
|
1522
1522
|
filter: {
|
|
1523
|
-
|
|
1523
|
+
slug: { $exists: true, $type: 'string' },
|
|
1524
1524
|
},
|
|
1525
1525
|
},
|
|
1526
1526
|
]);
|
|
@@ -1530,15 +1530,15 @@ const databaseAssertUtil = {
|
|
|
1530
1530
|
err.stack) !== null && _c !== void 0 ? _c : err.message);
|
|
1531
1531
|
}
|
|
1532
1532
|
yield db.createOne(this.collectionName, {
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1533
|
+
uniqueField: 'test',
|
|
1534
|
+
slug: null,
|
|
1535
|
+
someField3: 'next',
|
|
1536
1536
|
});
|
|
1537
1537
|
try {
|
|
1538
1538
|
yield db.createOne(this.collectionName, {
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1539
|
+
uniqueField: 'test2',
|
|
1540
|
+
slug: null,
|
|
1541
|
+
someField3: 'next',
|
|
1542
1542
|
});
|
|
1543
1543
|
}
|
|
1544
1544
|
catch (err) {
|
|
@@ -689,7 +689,7 @@ const databaseAssertUtil = {
|
|
|
689
689
|
test_utils_1.assert.isEqual(indexes[0][0].toLowerCase(), 'uniquefield');
|
|
690
690
|
await db.syncUniqueIndexes(this.collectionName, [
|
|
691
691
|
{
|
|
692
|
-
fields: ['
|
|
692
|
+
fields: ['uniqueField'],
|
|
693
693
|
filter: { isActive: true },
|
|
694
694
|
},
|
|
695
695
|
]);
|
|
@@ -699,7 +699,7 @@ const databaseAssertUtil = {
|
|
|
699
699
|
filter: { otherField: { $exists: true } },
|
|
700
700
|
},
|
|
701
701
|
{
|
|
702
|
-
fields: ['
|
|
702
|
+
fields: ['uniqueField'],
|
|
703
703
|
filter: { isActive: true },
|
|
704
704
|
},
|
|
705
705
|
]);
|
|
@@ -1349,9 +1349,9 @@ const databaseAssertUtil = {
|
|
|
1349
1349
|
try {
|
|
1350
1350
|
await db.syncUniqueIndexes(this.collectionName, [
|
|
1351
1351
|
{
|
|
1352
|
-
fields: ['
|
|
1352
|
+
fields: ['uniqueField', 'someField3'],
|
|
1353
1353
|
filter: {
|
|
1354
|
-
|
|
1354
|
+
uniqueField: { $exists: true },
|
|
1355
1355
|
},
|
|
1356
1356
|
},
|
|
1357
1357
|
]);
|
|
@@ -1362,9 +1362,9 @@ const databaseAssertUtil = {
|
|
|
1362
1362
|
}
|
|
1363
1363
|
try {
|
|
1364
1364
|
await db.createOne(this.collectionName, {
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1365
|
+
uniqueField: 'test',
|
|
1366
|
+
slug: null,
|
|
1367
|
+
someField3: 'test',
|
|
1368
1368
|
});
|
|
1369
1369
|
}
|
|
1370
1370
|
catch (err) {
|
|
@@ -1372,30 +1372,30 @@ const databaseAssertUtil = {
|
|
|
1372
1372
|
err.stack) !== null && _b !== void 0 ? _b : err.message);
|
|
1373
1373
|
}
|
|
1374
1374
|
await test_utils_1.assert.doesThrowAsync(() => db.createOne(this.collectionName, {
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1375
|
+
uniqueField: 'test',
|
|
1376
|
+
slug: null,
|
|
1377
|
+
someField3: 'test',
|
|
1378
1378
|
}), undefined, `Creating a duplicate record with should throw an error.`);
|
|
1379
1379
|
await db.createOne(this.collectionName, {
|
|
1380
|
-
|
|
1381
|
-
|
|
1380
|
+
slug: '555-000-0000',
|
|
1381
|
+
someField3: 'test',
|
|
1382
1382
|
});
|
|
1383
1383
|
await db.createOne(this.collectionName, {
|
|
1384
|
-
|
|
1385
|
-
|
|
1384
|
+
slug: '555-000-0001',
|
|
1385
|
+
someField3: 'test',
|
|
1386
1386
|
});
|
|
1387
1387
|
try {
|
|
1388
1388
|
await db.syncUniqueIndexes(this.collectionName, [
|
|
1389
1389
|
{
|
|
1390
|
-
fields: ['
|
|
1390
|
+
fields: ['uniqueField', 'someField3'],
|
|
1391
1391
|
filter: {
|
|
1392
|
-
|
|
1392
|
+
uniqueField: { $exists: true },
|
|
1393
1393
|
},
|
|
1394
1394
|
},
|
|
1395
1395
|
{
|
|
1396
|
-
fields: ['
|
|
1396
|
+
fields: ['slug', 'someField3'],
|
|
1397
1397
|
filter: {
|
|
1398
|
-
|
|
1398
|
+
slug: { $exists: true, $type: 'string' },
|
|
1399
1399
|
},
|
|
1400
1400
|
},
|
|
1401
1401
|
]);
|
|
@@ -1405,15 +1405,15 @@ const databaseAssertUtil = {
|
|
|
1405
1405
|
err.stack) !== null && _c !== void 0 ? _c : err.message);
|
|
1406
1406
|
}
|
|
1407
1407
|
await db.createOne(this.collectionName, {
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1408
|
+
uniqueField: 'test',
|
|
1409
|
+
slug: null,
|
|
1410
|
+
someField3: 'next',
|
|
1411
1411
|
});
|
|
1412
1412
|
try {
|
|
1413
1413
|
await db.createOne(this.collectionName, {
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1414
|
+
uniqueField: 'test2',
|
|
1415
|
+
slug: null,
|
|
1416
|
+
someField3: 'next',
|
|
1417
1417
|
});
|
|
1418
1418
|
}
|
|
1419
1419
|
catch (err) {
|