@dhyasama/totem-models 12.8.0 → 12.10.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.
- package/index.js +4 -0
- package/lib/Account.js +14 -14
- package/lib/Activity.js +2 -2
- package/lib/ApiKey.js +3 -3
- package/lib/CalendarEvent.js +14 -14
- package/lib/CapTable.js +11 -11
- package/lib/Deal.js +14 -14
- package/lib/DiffbotArticle.js +3 -3
- package/lib/DiffbotOrganization.js +3 -3
- package/lib/Document.js +7 -7
- package/lib/Event.js +5 -5
- package/lib/EventAttendee.js +4 -4
- package/lib/Financials.js +23 -23
- package/lib/FinancialsAnalysis.js +5 -5
- package/lib/Flag.js +5 -5
- package/lib/Folder.js +4 -4
- package/lib/Fund.js +10 -10
- package/lib/Interaction.js +14 -14
- package/lib/Investment.js +3 -3
- package/lib/LimitedPartner.js +18 -18
- package/lib/LimitedPartnerCampaign.js +6 -6
- package/lib/LimitedPartnerCommunication.js +12 -12
- package/lib/LimitedPartnerContactGroup.js +4 -4
- package/lib/LimitedPartnerReportGenerator.js +2 -2
- package/lib/List.js +8 -8
- package/lib/Meeting.js +6 -6
- package/lib/Message.js +17 -17
- package/lib/MessageRecipient.js +3 -3
- package/lib/News.js +4 -4
- package/lib/Note.js +5 -5
- package/lib/Organization.js +41 -40
- package/lib/Person.js +19 -19
- package/lib/Rate.js +3 -3
- package/lib/Round.js +13 -13
- package/lib/Snapshot.js +2 -2
- package/lib/Sync.js +2 -2
- package/lib/Webhook.js +1 -1
- package/package.json +2 -1
- package/test/Organization.js +81 -0
package/lib/Round.js
CHANGED
|
@@ -314,7 +314,7 @@ module.exports = function(mongoose, config) {
|
|
|
314
314
|
return rounds;
|
|
315
315
|
};
|
|
316
316
|
|
|
317
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
317
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
318
318
|
else { return run(); }
|
|
319
319
|
|
|
320
320
|
};
|
|
@@ -372,7 +372,7 @@ module.exports = function(mongoose, config) {
|
|
|
372
372
|
return rounds;
|
|
373
373
|
};
|
|
374
374
|
|
|
375
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
375
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
376
376
|
else { return run(); }
|
|
377
377
|
|
|
378
378
|
};
|
|
@@ -408,7 +408,7 @@ module.exports = function(mongoose, config) {
|
|
|
408
408
|
return rounds;
|
|
409
409
|
};
|
|
410
410
|
|
|
411
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
411
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
412
412
|
else { return run(); }
|
|
413
413
|
|
|
414
414
|
};
|
|
@@ -465,7 +465,7 @@ module.exports = function(mongoose, config) {
|
|
|
465
465
|
return fundInvestments;
|
|
466
466
|
};
|
|
467
467
|
|
|
468
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
468
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
469
469
|
else { return run(); }
|
|
470
470
|
|
|
471
471
|
};
|
|
@@ -533,7 +533,7 @@ module.exports = function(mongoose, config) {
|
|
|
533
533
|
return portfolioInvestments;
|
|
534
534
|
};
|
|
535
535
|
|
|
536
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
536
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
537
537
|
else { return run(); }
|
|
538
538
|
|
|
539
539
|
};
|
|
@@ -574,7 +574,7 @@ module.exports = function(mongoose, config) {
|
|
|
574
574
|
return calculatePerformance(rounds);
|
|
575
575
|
};
|
|
576
576
|
|
|
577
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
577
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
578
578
|
else { return run(); }
|
|
579
579
|
|
|
580
580
|
};
|
|
@@ -625,7 +625,7 @@ module.exports = function(mongoose, config) {
|
|
|
625
625
|
return buildPortfolio(rounds, [fundId]);
|
|
626
626
|
};
|
|
627
627
|
|
|
628
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
628
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
629
629
|
else { return run(); }
|
|
630
630
|
|
|
631
631
|
};
|
|
@@ -685,7 +685,7 @@ module.exports = function(mongoose, config) {
|
|
|
685
685
|
return buildPortfolio(rounds, fundIds);
|
|
686
686
|
};
|
|
687
687
|
|
|
688
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
688
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
689
689
|
else { return run(); }
|
|
690
690
|
|
|
691
691
|
};
|
|
@@ -746,7 +746,7 @@ module.exports = function(mongoose, config) {
|
|
|
746
746
|
return portfolio;
|
|
747
747
|
};
|
|
748
748
|
|
|
749
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
749
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
750
750
|
else { return run(); }
|
|
751
751
|
|
|
752
752
|
};
|
|
@@ -774,7 +774,7 @@ module.exports = function(mongoose, config) {
|
|
|
774
774
|
return result;
|
|
775
775
|
};
|
|
776
776
|
|
|
777
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
777
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
778
778
|
else { return run(); }
|
|
779
779
|
|
|
780
780
|
};
|
|
@@ -791,7 +791,7 @@ module.exports = function(mongoose, config) {
|
|
|
791
791
|
return result;
|
|
792
792
|
};
|
|
793
793
|
|
|
794
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
794
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
795
795
|
else { return run(); }
|
|
796
796
|
|
|
797
797
|
};
|
|
@@ -944,7 +944,7 @@ module.exports = function(mongoose, config) {
|
|
|
944
944
|
return relatedWithRounds;
|
|
945
945
|
};
|
|
946
946
|
|
|
947
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
947
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
948
948
|
else { return run(); }
|
|
949
949
|
|
|
950
950
|
};
|
|
@@ -961,7 +961,7 @@ module.exports = function(mongoose, config) {
|
|
|
961
961
|
return await this.findByIdAndUpdate(_id, update, { new: true });
|
|
962
962
|
};
|
|
963
963
|
|
|
964
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
964
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
965
965
|
else { return run(); }
|
|
966
966
|
|
|
967
967
|
};
|
package/lib/Snapshot.js
CHANGED
|
@@ -20,7 +20,7 @@ module.exports = function(mongoose, config) {
|
|
|
20
20
|
return result;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
23
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
24
24
|
else { return run(); }
|
|
25
25
|
|
|
26
26
|
};
|
|
@@ -35,7 +35,7 @@ module.exports = function(mongoose, config) {
|
|
|
35
35
|
return await this.findByIdAndUpdate(_id, update, { new: true });
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
38
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
39
39
|
else { return run(); }
|
|
40
40
|
|
|
41
41
|
};
|
package/lib/Sync.js
CHANGED
|
@@ -34,7 +34,7 @@ module.exports = function(mongoose, config) {
|
|
|
34
34
|
return result;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
37
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
38
38
|
else { return run(); }
|
|
39
39
|
|
|
40
40
|
};
|
|
@@ -50,7 +50,7 @@ module.exports = function(mongoose, config) {
|
|
|
50
50
|
return await this.findByIdAndUpdate(_id, update, { new: true });
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
53
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
54
54
|
else { return run(); }
|
|
55
55
|
|
|
56
56
|
};
|
package/lib/Webhook.js
CHANGED
|
@@ -27,7 +27,7 @@ module.exports = function(mongoose, config) {
|
|
|
27
27
|
return await this.findByIdAndUpdate(_id, update, { new: true });
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
if (typeof cb === 'function') { run().then(result => cb(null, result)
|
|
30
|
+
if (typeof cb === 'function') { run().then(result => cb(null, result), err => cb(err)); return; }
|
|
31
31
|
else { return run(); }
|
|
32
32
|
|
|
33
33
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhyasama/totem-models",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.10.0",
|
|
4
4
|
"author": "Jason Reynolds",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"description": "Models for Totem platform",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"awesome-phonenumber": "^1.0.14",
|
|
22
22
|
"escape-string-regexp": "^1.0.5",
|
|
23
23
|
"moment": "^2.30.1",
|
|
24
|
+
"mongoose-lean-virtuals": "^2.1.0",
|
|
24
25
|
"range_check": "^1.4.0",
|
|
25
26
|
"underscore": "^1.13.6",
|
|
26
27
|
"validator": "^13.11.0"
|
package/test/Organization.js
CHANGED
|
@@ -1127,6 +1127,87 @@ describe('Organization', function() {
|
|
|
1127
1127
|
});
|
|
1128
1128
|
});
|
|
1129
1129
|
|
|
1130
|
+
it('finds the primary address for an org', function(done) {
|
|
1131
|
+
|
|
1132
|
+
var o = new Organization();
|
|
1133
|
+
o.name = 'Addressable';
|
|
1134
|
+
o.slug = 'addressable';
|
|
1135
|
+
o.website = 'addressable.org';
|
|
1136
|
+
|
|
1137
|
+
o.contact.address = [];
|
|
1138
|
+
o.contact.address.push({
|
|
1139
|
+
street: '1 Main Street',
|
|
1140
|
+
city: 'Portland',
|
|
1141
|
+
state: 'ME',
|
|
1142
|
+
country: 'USA',
|
|
1143
|
+
postalCode: '04101',
|
|
1144
|
+
primary: false
|
|
1145
|
+
});
|
|
1146
|
+
o.contact.address.push({
|
|
1147
|
+
street: '2 Center Street',
|
|
1148
|
+
city: 'Bangor',
|
|
1149
|
+
state: 'ME',
|
|
1150
|
+
country: 'USA',
|
|
1151
|
+
postalCode: '04412',
|
|
1152
|
+
primary: true
|
|
1153
|
+
});
|
|
1154
|
+
|
|
1155
|
+
Organization.upsert(o, 'test-user', function(err, org) {
|
|
1156
|
+
|
|
1157
|
+
should.not.exist(err);
|
|
1158
|
+
should.exist(org);
|
|
1159
|
+
|
|
1160
|
+
Organization.findById(org._id).lean({ virtuals: true })
|
|
1161
|
+
.then(function(result) {
|
|
1162
|
+
should.exist(result);
|
|
1163
|
+
should.exist(result.address);
|
|
1164
|
+
should.exist(result.address.primary);
|
|
1165
|
+
result.address.primary.postalCode.should.equal('04412');
|
|
1166
|
+
done();
|
|
1167
|
+
})
|
|
1168
|
+
.catch(done);
|
|
1169
|
+
|
|
1170
|
+
});
|
|
1171
|
+
|
|
1172
|
+
});
|
|
1173
|
+
|
|
1174
|
+
it('does not throw when contact is omitted from a lean projection', function(done) {
|
|
1175
|
+
|
|
1176
|
+
var o = new Organization();
|
|
1177
|
+
o.name = 'Projected';
|
|
1178
|
+
o.slug = 'projected';
|
|
1179
|
+
o.website = 'projected.org';
|
|
1180
|
+
|
|
1181
|
+
o.contact.address = [];
|
|
1182
|
+
o.contact.address.push({
|
|
1183
|
+
street: '10 Broad Street',
|
|
1184
|
+
city: 'New York',
|
|
1185
|
+
state: 'NY',
|
|
1186
|
+
country: 'USA',
|
|
1187
|
+
postalCode: '10004',
|
|
1188
|
+
primary: true
|
|
1189
|
+
});
|
|
1190
|
+
|
|
1191
|
+
Organization.upsert(o, 'test-user', function(err, org) {
|
|
1192
|
+
|
|
1193
|
+
should.not.exist(err);
|
|
1194
|
+
should.exist(org);
|
|
1195
|
+
|
|
1196
|
+
Organization.findById(org._id)
|
|
1197
|
+
.select('name')
|
|
1198
|
+
.lean({ virtuals: true })
|
|
1199
|
+
.then(function(result) {
|
|
1200
|
+
should.exist(result);
|
|
1201
|
+
should.exist(result.address);
|
|
1202
|
+
should.equal(result.address.primary, null);
|
|
1203
|
+
done();
|
|
1204
|
+
})
|
|
1205
|
+
.catch(done);
|
|
1206
|
+
|
|
1207
|
+
});
|
|
1208
|
+
|
|
1209
|
+
});
|
|
1210
|
+
|
|
1130
1211
|
it('cleans people', function (done) {
|
|
1131
1212
|
|
|
1132
1213
|
var littleDirtyOrg = new Organization();
|