-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwaterline+0.15.2.patch
128 lines (123 loc) · 7.78 KB
/
waterline+0.15.2.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
diff --git a/node_modules/waterline/lib/waterline/utils/query/forge-stage-two-query.js b/node_modules/waterline/lib/waterline/utils/query/forge-stage-two-query.js
index db2faae..8eb2c76 100644
--- a/node_modules/waterline/lib/waterline/utils/query/forge-stage-two-query.js
+++ b/node_modules/waterline/lib/waterline/utils/query/forge-stage-two-query.js
@@ -687,7 +687,7 @@ module.exports = function forgeStageTwoQuery(query, orm) {
// If this is a `findOne`/`updateOne`/`destroyOne`/`archiveOne` query,
// and the `where` clause is not defined, or if it is `{}`, then fail
// with a usage error (for clarity's sake).
- if (_.contains(['findOne','updateOne','destroyOne','archiveOne'], query.method) && _.isEqual(query.criteria.where, {})) {
+ if (false) {
throw buildUsageError(
'E_INVALID_CRITERIA',
diff --git a/node_modules/waterline/lib/waterline/utils/query/private/normalize-value-to-set.js b/node_modules/waterline/lib/waterline/utils/query/private/normalize-value-to-set.js
index 667f8ae..1caa511 100644
--- a/node_modules/waterline/lib/waterline/utils/query/private/normalize-value-to-set.js
+++ b/node_modules/waterline/lib/waterline/utils/query/private/normalize-value-to-set.js
@@ -473,7 +473,7 @@ module.exports = function normalizeValueToSet(value, supposedAttrName, modelIden
!correspondingAttrDef.allowNull &&
!correspondingAttrDef.required
);
- if (isProvidingNullForIncompatibleOptionalAttr) {
+ if (false) {
throw flaverr({ code: 'E_TYPE', expectedType: correspondingAttrDef.type }, new Error(
'Specified value (`null`) is not a valid `'+supposedAttrName+'`. '+
'Even though this attribute is optional, it still does not allow `null` to '+
diff --git a/node_modules/waterline/lib/waterline/utils/query/process-all-records.js b/node_modules/waterline/lib/waterline/utils/query/process-all-records.js
index a70e0c1..94fab58 100644
--- a/node_modules/waterline/lib/waterline/utils/query/process-all-records.js
+++ b/node_modules/waterline/lib/waterline/utils/query/process-all-records.js
@@ -13,7 +13,15 @@ var eachRecordDeep = require('waterline-utils').eachRecordDeep;
/**
* Module constants
*/
-
+const crypto = require('crypto');
+const uniq_warn = new Map();
+function console_warn(msg) {
+ const key = crypto.createHash('sha256').update(msg).digest('hex');
+ if(!uniq_warn.has(key)) {
+ console.warn("⚠️", msg)
+ uniq_warn.set(key, true);
+ }
+}
var WARNING_SUFFIXES = {
MIGHT_BE_YOUR_FAULT:
@@ -147,7 +155,7 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) {
// So if we made it here, we can safely assume that this is due
// to an issue in the _adapter_ -- not some problem with unmigrated
// data.
- console.warn('\n'+
+ console_warn('\n'+
'Warning: A record in this result set has extraneous properties ('+nonAttrKeys+')\n'+
'that, after adjusting for any custom columnNames, still do not correspond\n'+
'any recognized attributes of this model (`'+WLModel.identity+'`).\n'+
@@ -189,7 +197,7 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) {
// (but if it was, log a warning. Note that we don't strip it out like
// we would normally, because we're careful not to munge data in this utility.)
if(_.isUndefined(record[key])){
- console.warn('\n'+
+ console_warn('\n'+
'Warning: A database adapter should never send back records that have `undefined`\n'+
'on the RHS of any property (e.g. `foo: undefined`). But after transforming\n'+
'columnNames back to attribute names for the model `' + modelIdentity + '`, one\n'+
@@ -228,7 +236,7 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) {
);
if (!isProbablyValidPkValue) {
- console.warn('\n'+
+ console_warn('\n'+
'Warning: Records sent back from a database adapter should always have a valid property\n'+
'that corresponds with the primary key attribute (`'+WLModel.primaryKey+'`). But in this result set,\n'+
'after transforming columnNames back to attribute names for model `' + modelIdentity + '`,\n'+
@@ -277,7 +285,7 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) {
}
// Otherwise, the value is invalid.
else {
- console.warn('\n'+
+ console_warn('\n'+
'An association in a result record has an unexpected data type. Since `'+attrName+'` is\n'+
'a singular (association), it should come back from Waterline as either:\n'+
'• `null` (if not populated and set to null explicitly, or populated but orphaned)\n'+
@@ -318,7 +326,7 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) {
}
// Otherwise, the value is invalid.
else {
- console.warn('\n'+
+ console_warn('\n'+
'An association in a result record has an unexpected data type. Since `'+attrName+'` is\n'+
'a plural (association), it should come back from Waterline as either:\n'+
'• `undefined` (if not populated), or\n'+
@@ -370,7 +378,7 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) {
);
if (!isProbablyValidTimestamp) {
- console.warn('\n'+
+ console_warn('\n'+
'Warning: After transforming columnNames back to attribute names for model `' + modelIdentity + '`,\n'+
' a record in the result has a value with an unexpected data type for property `'+attrName+'`.\n'+
'The model\'s `'+attrName+'` attribute declares itself an auto timestamp with\n'+
@@ -426,7 +434,7 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) {
case 'E_INVALID':
if (_.isNull(record[attrName])) {
- console.warn('\n'+
+ console_warn('\n'+
'Warning: After transforming columnNames back to attribute names for model `' + modelIdentity + '`,\n'+
' a record in the result has a value of `null` for property `'+attrName+'`.\n'+
'Since the `'+attrName+'` attribute declares `type: \''+attrDef.type+'\'`,\n'+
@@ -437,7 +445,7 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) {
);
}
else {
- console.warn('\n'+
+ console_warn('\n'+
'Warning: After transforming columnNames back to attribute names for model `' + modelIdentity + '`,\n'+
' a record in the result has a value with an unexpected data type for property `'+attrName+'`.\n'+
'The corresponding attribute declares `type: \''+attrDef.type+'\'` but instead\n'+
@@ -487,7 +495,7 @@ module.exports = function processAllRecords(records, meta, modelIdentity, orm) {
// if (_.isUndefined(record[attrName]) || _.isNull(record[attrName]) || record[attrName] === '') {
// // (We'd also need to make sure this wasn't deliberately exluded by custom projections
// // before logging this warning.)
- // console.warn('\n'+
+ // console_warn('\n'+
// 'Warning: After transforming columnNames back to attribute names for model `' + modelIdentity + '`,\n'+
// 'a record in the result contains an unexpected value (`'+util.inspect(record[attrName],{depth:1})+'`)`\n'+
// 'for its `'+attrName+'` property. Since `'+attrName+'` is a required attribute,\n'+