From 53a11378487504e40bfa3e50aad22078bdd04d01 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Fri, 12 Oct 2018 13:38:51 +0200 Subject: [PATCH] Updated simpl-schema and collection2, started untangling the mess that made --- app/.meteor/packages | 4 +- app/.meteor/versions | 12 +- app/imports/api/creature/Actions.js | 2 + app/imports/api/creature/Attacks.js | 17 +- app/imports/api/creature/Attributes.js | 3 + app/imports/api/creature/Buffs.js | 24 +- app/imports/api/creature/Classes.js | 21 +- app/imports/api/creature/Conditions.js | 21 +- app/imports/api/creature/Creatures.js | 8 +- app/imports/api/creature/CustomBuffs.js | 6 +- app/imports/api/creature/DamageMultipliers.js | 3 - app/imports/api/creature/Features.js | 11 +- app/imports/api/creature/Notes.js | 7 +- app/imports/api/creature/SpellLists.js | 7 +- app/imports/api/creature/Spells.js | 9 +- .../api/creature/TemporaryHitPoints.js | 41 --- .../api/creature/subSchemas/ColorSchema.js | 11 + .../{DeathSaves.js => DeathSavesSchema.js} | 5 +- app/imports/api/parenting.js | 1 + app/package-lock.json | 246 ++++++++++++++++++ app/package.json | 1 + app/server/lib/cron/deleteRemovedDocuments.js | 14 + app/server/migrations/migrations.js | 1 + 23 files changed, 337 insertions(+), 138 deletions(-) delete mode 100644 app/imports/api/creature/TemporaryHitPoints.js create mode 100644 app/imports/api/creature/subSchemas/ColorSchema.js rename app/imports/api/creature/subSchemas/{DeathSaves.js => DeathSavesSchema.js} (68%) diff --git a/app/.meteor/packages b/app/.meteor/packages index 6f11acb1..fa387e8d 100644 --- a/app/.meteor/packages +++ b/app/.meteor/packages @@ -9,9 +9,7 @@ random@1.1.0 dburles:collection-helpers reactive-var@1.0.11 underscore@1.0.10 -aldeed:collection2 matb33:collection-hooks -zimme:collection-softremovable momentjs:moment dburles:mongo-collection-instances percolate:migrations @@ -51,3 +49,5 @@ mdg:validated-method akryum:vue-component akryum:vue-router2 static-html +aldeed:collection2@3.0.0 +aldeed:schema-index diff --git a/app/.meteor/versions b/app/.meteor/versions index cb5ab6dc..be86bf6c 100644 --- a/app/.meteor/versions +++ b/app/.meteor/versions @@ -9,11 +9,8 @@ akryum:vue-component@0.14.1 akryum:vue-component-dev-client@0.4.3 akryum:vue-component-dev-server@0.1.2 akryum:vue-router2@0.2.2 -aldeed:collection2@2.10.0 -aldeed:collection2-core@1.2.0 -aldeed:schema-deny@1.1.0 -aldeed:schema-index@1.1.1 -aldeed:simple-schema@1.5.4 +aldeed:collection2@3.0.0 +aldeed:schema-index@3.0.0 allow-deny@1.1.0 autoupdate@1.4.1 babel-compiler@7.1.1 @@ -28,7 +25,6 @@ caching-html-compiler@1.1.3 callback-hook@1.1.0 check@1.3.1 chuangbo:marked@0.3.5_1 -coffeescript@1.0.17 dburles:collection-helpers@1.1.0 dburles:mongo-collection-instances@0.3.5 ddp@1.4.0 @@ -65,7 +61,6 @@ localstorage@1.2.0 logging@1.1.20 matb33:collection-hooks@0.8.4 mdg:validated-method@1.2.0 -mdg:validation-error@0.5.1 meteor@1.9.2 meteor-base@1.4.0 meteorhacks:picker@1.0.3 @@ -121,11 +116,10 @@ templating@1.3.2 templating-compiler@1.3.3 templating-runtime@1.3.2 templating-tools@1.1.2 +tmeasday:check-npm-versions@0.3.2 tracker@1.2.0 underscore@1.0.10 url@1.2.0 webapp@1.6.2 webapp-hashing@1.0.9 wizonesolutions:canonical@0.0.5 -zimme:collection-behaviours@1.1.3 -zimme:collection-softremovable@1.0.5 diff --git a/app/imports/api/creature/Actions.js b/app/imports/api/creature/Actions.js index 1318bb76..7cf56831 100644 --- a/app/imports/api/creature/Actions.js +++ b/app/imports/api/creature/Actions.js @@ -1,3 +1,5 @@ +import SimpleSchema from 'simpl-schema'; + let Actions = new Mongo.Collection("actions"); /* diff --git a/app/imports/api/creature/Attacks.js b/app/imports/api/creature/Attacks.js index eeb8b2f6..6a6cbc25 100644 --- a/app/imports/api/creature/Attacks.js +++ b/app/imports/api/creature/Attacks.js @@ -1,3 +1,6 @@ +import SimpleSchema from 'simpl-schema'; +import {makeChild} from "/imports/api/parenting.js"; + let Attacks = new Mongo.Collection("attacks"); /* @@ -51,15 +54,6 @@ attackSchema = new SimpleSchema({ ], defaultValue: "slashing", }, - //the id of the feature, buff or item that created this effect - parent: { - type: Schemas.Parent - }, - color: { - type: String, - allowedValues: _.pluck(colorOptions, "key"), - defaultValue: "q", - }, enabled: { type: Boolean, defaultValue: true, @@ -68,7 +62,7 @@ attackSchema = new SimpleSchema({ Attacks.attachSchema(attackSchema); -Attacks.attachBehaviour("softRemovable"); +//Attacks.attachBehaviour("softRemovable"); makeChild(Attacks, ["name", "enabled"]); //children of lots of things Attacks.after.insert(function (userId, attack) { @@ -83,7 +77,4 @@ Attacks.after.insert(function (userId, attack) { } }); -Attacks.allow(CHARACTER_SUBSCHEMA_ALLOW); -Attacks.deny(CHARACTER_SUBSCHEMA_DENY); - export default Attacks; diff --git a/app/imports/api/creature/Attributes.js b/app/imports/api/creature/Attributes.js index bc30a521..dcb1b492 100644 --- a/app/imports/api/creature/Attributes.js +++ b/app/imports/api/creature/Attributes.js @@ -1,4 +1,6 @@ import {makeChild} from "/imports/api/parenting.js"; +import SimpleSchema from 'simpl-schema'; +import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js"; let Attributes = new Mongo.Collection("attributes"); @@ -78,6 +80,7 @@ attributeSchema = new SimpleSchema({ }); Attributes.attachSchema(attributeSchema); +Attributes.attachSchema(ColorSchema); Attributes.attachBehaviour("softRemovable"); makeChild(Attributes, ["enabled"]); //children of lots of things diff --git a/app/imports/api/creature/Buffs.js b/app/imports/api/creature/Buffs.js index e6e00710..291536b3 100644 --- a/app/imports/api/creature/Buffs.js +++ b/app/imports/api/creature/Buffs.js @@ -1,6 +1,10 @@ -Buffs = new Mongo.Collection("buffs"); +import SimpleSchema from 'simpl-schema'; +import {makeParent} from "/imports/api/parenting.js"; +import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js"; -Schemas.Buff = new SimpleSchema({ +let Buffs = new Mongo.Collection("buffs"); + +let buffSchema = new SimpleSchema({ charId: { type: String, regEx: SimpleSchema.RegEx.Id, @@ -27,6 +31,9 @@ Schemas.Buff = new SimpleSchema({ "custom", ], }, + lifeTime: { + type: Object, + }, "lifeTime.total": { type: Number, defaultValue: 0, //0 is infinite @@ -37,11 +44,6 @@ Schemas.Buff = new SimpleSchema({ defaultValue: 0, min: 0, }, - color: { - type: String, - allowedValues: _.pluck(colorOptions, "key"), - defaultValue: "q", - }, appliedBy: { //the charId of whoever applied the buff type: String, regEx: SimpleSchema.RegEx.Id, @@ -58,10 +60,10 @@ Schemas.Buff = new SimpleSchema({ }, }); -Buffs.attachSchema(Schemas.Buff); +Buffs.attachSchema(buffSchema); +Buffs.attachSchema(ColorSchema); -Buffs.attachBehaviour("softRemovable"); +//Buffs.attachBehaviour("softRemovable"); makeParent(Buffs, ["name", "enabled"]); //parents of effects, attacks, proficiencies -Buffs.allow(CHARACTER_SUBSCHEMA_ALLOW); -Buffs.deny(CHARACTER_SUBSCHEMA_DENY); +export default Buffs; diff --git a/app/imports/api/creature/Classes.js b/app/imports/api/creature/Classes.js index 52e4df9e..023aa51e 100644 --- a/app/imports/api/creature/Classes.js +++ b/app/imports/api/creature/Classes.js @@ -1,6 +1,10 @@ -Classes = new Mongo.Collection("classes"); +import SimpleSchema from 'simpl-schema'; +import {makeParent} from "/imports/api/parenting.js"; +import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js"; -Schemas.Class = new SimpleSchema({ +let Classes = new Mongo.Collection("classes"); + +classSchema= new SimpleSchema({ charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1}, name: {type: String, optional: true, trim: false}, level: {type: Number}, @@ -16,17 +20,12 @@ Schemas.Class = new SimpleSchema({ } }, }, - color: { - type: String, - allowedValues: _.pluck(colorOptions, "key"), - defaultValue: "q", - }, }); -Classes.attachSchema(Schemas.Class); +Classes.attachSchema(classSchema); +Classes.attachSchema(ColorSchema); -Classes.attachBehaviour("softRemovable"); +//Classes.attachBehaviour("softRemovable"); makeParent(Classes, "name"); //parents of effects and attacks -Classes.allow(CHARACTER_SUBSCHEMA_ALLOW); -Classes.deny(CHARACTER_SUBSCHEMA_DENY); +export default Classes; diff --git a/app/imports/api/creature/Conditions.js b/app/imports/api/creature/Conditions.js index ce894fe1..b558cf2a 100644 --- a/app/imports/api/creature/Conditions.js +++ b/app/imports/api/creature/Conditions.js @@ -1,6 +1,10 @@ -Conditions = new Mongo.Collection("conditions"); +import SimpleSchema from 'simpl-schema'; +import {makeParent} from "/imports/api/parenting.js"; +import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js"; -Schemas.Conditions = new SimpleSchema({ +let Conditions = new Mongo.Collection("conditions"); + +conditionSchema = new SimpleSchema({ charId: { type: String, regEx: SimpleSchema.RegEx.Id, @@ -26,17 +30,12 @@ Schemas.Conditions = new SimpleSchema({ defaultValue: 0, min: 0, }, - color: { - type: String, - allowedValues: _.pluck(colorOptions, "key"), - defaultValue: "q", - }, }); -Conditions.attachSchema(Schemas.Conditions); +Conditions.attachSchema(conditionSchema); +Conditions.attachSchema(ColorSchema); -Conditions.attachBehaviour("softRemovable"); +//Conditions.attachBehaviour("softRemovable"); makeParent(Conditions, ["name"]); //parents of effects, attacks, proficiencies -Conditions.allow(CHARACTER_SUBSCHEMA_ALLOW); -Conditions.deny(CHARACTER_SUBSCHEMA_DENY); +export default Conditions; diff --git a/app/imports/api/creature/Creatures.js b/app/imports/api/creature/Creatures.js index c5b460bf..abd58787 100644 --- a/app/imports/api/creature/Creatures.js +++ b/app/imports/api/creature/Creatures.js @@ -1,6 +1,7 @@ import { ValidatedMethod } from 'meteor/mdg:validated-method'; import Effects from "/imports/api/creature/Effects.js" import deathSaveSchema from "/imports/api/creature/subSchemas/DeathSaves.js" +import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js"; //set up the collection for creatures Creatures = new Mongo.Collection("creatures"); @@ -32,12 +33,6 @@ let creatureSchema = new SimpleSchema({ owner: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1}, readers: {type: [String], regEx: SimpleSchema.RegEx.Id, defaultValue: [], index: 1}, writers: {type: [String], regEx: SimpleSchema.RegEx.Id, defaultValue: [], index: 1}, - color: { - type: String, - defaultValue: "#9E9E9E", - // match hex colors of the form #A23 or #A23f56 - regEx: /^#([a-f0-9]{3}){1,2}\b$/i, - }, //TODO add per-creature settings //how many experiences to load at a time in XP table "settings.experiencesInc": {type: Number, defaultValue: 20}, @@ -61,6 +56,7 @@ let creatureSchema = new SimpleSchema({ }); Creatures.attachSchema(creatureSchema); +Creatures.attachSchema(ColorSchema); Creatures.calculate = { xpLevel: function(charId){ diff --git a/app/imports/api/creature/CustomBuffs.js b/app/imports/api/creature/CustomBuffs.js index 7a766b01..94d987bd 100644 --- a/app/imports/api/creature/CustomBuffs.js +++ b/app/imports/api/creature/CustomBuffs.js @@ -37,15 +37,11 @@ Schemas.CustomBuff = new SimpleSchema({ defaultValue: 0, //0 is infinite min: 0, }, - //the id of the feature, buff or item that creates this buff - parent: { - type: Schemas.Parent, - }, }); CustomBuffs.attachSchema(Schemas.CustomBuff); -CustomBuffs.attachBehaviour("softRemovable"); +//CustomBuffs.attachBehaviour("softRemovable"); makeParent(CustomBuffs, ["name", "enabled"]); //parents of effects, attacks, proficiencies. Since this represents a template, "enabled" is always false. makeChild(CustomBuffs); //children of lots of things diff --git a/app/imports/api/creature/DamageMultipliers.js b/app/imports/api/creature/DamageMultipliers.js index 553dc09d..3b5515b9 100644 --- a/app/imports/api/creature/DamageMultipliers.js +++ b/app/imports/api/creature/DamageMultipliers.js @@ -22,9 +22,6 @@ Schemas.DamageMultiplier = new SimpleSchema({ decimal: true, defaultValue: 1, }, - parent: { - type: Schemas.Parent - }, enabled: { type: Boolean, defaultValue: true, diff --git a/app/imports/api/creature/Features.js b/app/imports/api/creature/Features.js index 468d6fe3..dac786ea 100644 --- a/app/imports/api/creature/Features.js +++ b/app/imports/api/creature/Features.js @@ -1,4 +1,5 @@ Features = new Mongo.Collection("features"); +import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js"; Schemas.Feature = new SimpleSchema({ charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1}, @@ -13,13 +14,10 @@ Schemas.Feature = new SimpleSchema({ }, enabled: {type: Boolean, defaultValue: true}, alwaysEnabled:{type: Boolean, defaultValue: true}, - color: {type: String, - allowedValues: _.pluck(colorOptions, "key"), - defaultValue: "q", - }, }); Features.attachSchema(Schemas.Feature); +Features.attachSchema(ColorSchema); Features.helpers({ usesLeft: function(){ @@ -30,12 +28,9 @@ Features.helpers({ }, }); -Features.attachBehaviour("softRemovable"); +//Features.attachBehaviour("softRemovable"); makeParent(Features, ["name", "enabled"]); //parents of effects and attacks -Features.allow(CHARACTER_SUBSCHEMA_ALLOW); -Features.deny(CHARACTER_SUBSCHEMA_DENY); - //give characters default feature of base ability scores of 10 Characters.after.insert(function(userId, char) { if (Meteor.isServer){ diff --git a/app/imports/api/creature/Notes.js b/app/imports/api/creature/Notes.js index f1ce7aa4..c0df5e5e 100644 --- a/app/imports/api/creature/Notes.js +++ b/app/imports/api/creature/Notes.js @@ -1,17 +1,14 @@ Notes = new Mongo.Collection("notes"); +import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js"; Schemas.Note = new SimpleSchema({ charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1}, name: {type: String, optional: true, trim: false}, description: {type: String, optional: true, trim: false}, - color: { - type: String, - allowedValues:_.pluck(colorOptions, "key"), - defaultValue: "q", - }, }); Notes.attachSchema(Schemas.Note); +Attributes.attachSchema(ColorSchema); Notes.attachBehaviour("softRemovable"); diff --git a/app/imports/api/creature/SpellLists.js b/app/imports/api/creature/SpellLists.js index 982be871..723ff916 100644 --- a/app/imports/api/creature/SpellLists.js +++ b/app/imports/api/creature/SpellLists.js @@ -1,4 +1,5 @@ SpellLists = new Mongo.Collection("spellLists"); +import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js"; Schemas.SpellLists = new SimpleSchema({ charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1}, @@ -7,15 +8,11 @@ Schemas.SpellLists = new SimpleSchema({ saveDC: {type: String, optional: true, trim: false}, attackBonus: {type: String, optional: true, trim: false}, maxPrepared: {type: String, optional: true, trim: false}, - color: { - type: String, - allowedValues: _.pluck(colorOptions, "key"), - defaultValue: "q", - }, "settings.showUnprepared": {type: Boolean, defaultValue: true}, }); SpellLists.attachSchema(Schemas.SpellLists); +Attributes.attachSchema(ColorSchema); SpellLists.helpers({ numPrepared: function(){ diff --git a/app/imports/api/creature/Spells.js b/app/imports/api/creature/Spells.js index 2b5876b2..22cf664d 100644 --- a/app/imports/api/creature/Spells.js +++ b/app/imports/api/creature/Spells.js @@ -1,4 +1,5 @@ Spells = new Mongo.Collection("spells"); +import ColorSchema from "/imports/api/creature/subSchemas/ColorSchema.js"; Schemas.Spell = new SimpleSchema({ charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1}, @@ -52,14 +53,10 @@ Schemas.Spell = new SimpleSchema({ defaultValue: "Abjuration", allowedValues: magicSchools, }, - color: { - type: String, - allowedValues: _.pluck(colorOptions, "key"), - defaultValue: "q", - }, }); Spells.attachSchema(Schemas.Spell); +Attributes.attachSchema(ColorSchema); Spells.attachBehaviour("softRemovable"); makeChild(Spells); //children of spell lists @@ -249,4 +246,4 @@ Meteor.methods({ check(charId, String); copySpell(spellId, "Characters", charId); }, -}); \ No newline at end of file +}); diff --git a/app/imports/api/creature/TemporaryHitPoints.js b/app/imports/api/creature/TemporaryHitPoints.js deleted file mode 100644 index 65b2a44b..00000000 --- a/app/imports/api/creature/TemporaryHitPoints.js +++ /dev/null @@ -1,41 +0,0 @@ -TemporaryHitPoints = new Mongo.Collection("temporaryHitPoints"); - -Schemas.TemporaryHitPoints = new SimpleSchema({ - charId: {type: String, regEx: SimpleSchema.RegEx.Id, index: 1}, - name: {type: String, optional: true}, - maximum: {type: Number, defaultValue: 0, min: 0, max: 500}, - used: {type: Number, defaultValue: 0, min: 0, max: 500}, - deleteOnZero:{type: Boolean, defaultValue: false}, - dateAdded: { - type: Date, - autoValue: function() { - if (this.isInsert) { - return new Date(); - } else if (this.isUpsert) { - return {$setOnInsert: new Date()}; - } else { - this.unset(); - } - }, - }, -}); - -TemporaryHitPoints.attachSchema(Schemas.TemporaryHitPoints); - -TemporaryHitPoints.helpers({ - left: function(){ - return this.maximum - this.used; - } -}); - -//remove the temporary hit points when they hit zero -TemporaryHitPoints.after.update( - function(userId, thp, fieldNames, modifier, options){ - if (thp.used >= thp.maximum && thp.deleteOnZero){ - TemporaryHitPoints.remove(thp._id); - } - }, {fetchPrevious: false} -); - -TemporaryHitPoints.allow(CHARACTER_SUBSCHEMA_ALLOW); -TemporaryHitPoints.deny(CHARACTER_SUBSCHEMA_DENY); diff --git a/app/imports/api/creature/subSchemas/ColorSchema.js b/app/imports/api/creature/subSchemas/ColorSchema.js new file mode 100644 index 00000000..7f447d92 --- /dev/null +++ b/app/imports/api/creature/subSchemas/ColorSchema.js @@ -0,0 +1,11 @@ +import SimpleSchema from 'simpl-schema'; +const ColorSchema = new SimpleSchema({ + color: { + type: String, + defaultValue: "#9E9E9E", + // match hex colors of the form #A23 or #A23f56 + regEx: /^#([a-f0-9]{3}){1,2}\b$/i, + }, +}); + +export default ColorSchema; diff --git a/app/imports/api/creature/subSchemas/DeathSaves.js b/app/imports/api/creature/subSchemas/DeathSavesSchema.js similarity index 68% rename from app/imports/api/creature/subSchemas/DeathSaves.js rename to app/imports/api/creature/subSchemas/DeathSavesSchema.js index 4e5c1200..dc51596a 100644 --- a/app/imports/api/creature/subSchemas/DeathSaves.js +++ b/app/imports/api/creature/subSchemas/DeathSavesSchema.js @@ -1,4 +1,5 @@ -const deathSaveSchema = new SimpleSchema({ +import SimpleSchema from 'simpl-schema'; +const DeathSavesSchema = new SimpleSchema({ pass: { type: Number, min: 0, @@ -21,4 +22,4 @@ const deathSaveSchema = new SimpleSchema({ }, }); -export default deathSaveSchema; +export default DeathSavesSchema; diff --git a/app/imports/api/parenting.js b/app/imports/api/parenting.js index 6b5b3f0a..806d1ed9 100644 --- a/app/imports/api/parenting.js +++ b/app/imports/api/parenting.js @@ -1,3 +1,4 @@ +import SimpleSchema from 'simpl-schema'; import { ValidatedMethod } from 'meteor/mdg:validated-method'; let childSchema = new SimpleSchema({ diff --git a/app/package-lock.json b/app/package-lock.json index 3bd1b2bb..984548a2 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -162,6 +162,11 @@ "wrap-ansi": "^2.0.0" } }, + "clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=" + }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -578,11 +583,211 @@ "path-exists": "^3.0.0" } }, + "lodash._basecallback": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/lodash._basecallback/-/lodash._basecallback-3.3.1.tgz", + "integrity": "sha1-t7K7Q9whYEJKIczybFfkQ3cqjic=", + "requires": { + "lodash._baseisequal": "^3.0.0", + "lodash._bindcallback": "^3.0.0", + "lodash.isarray": "^3.0.0", + "lodash.pairs": "^3.0.0" + } + }, + "lodash._baseeach": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash._baseeach/-/lodash._baseeach-3.0.4.tgz", + "integrity": "sha1-z4cGVyyhROjZ11InyZDamC+TKvM=", + "requires": { + "lodash.keys": "^3.0.0" + } + }, + "lodash._basefind": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._basefind/-/lodash._basefind-3.0.0.tgz", + "integrity": "sha1-srugXMZF+XLeLPkl+iv2Og9gyK4=" + }, + "lodash._basefindindex": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/lodash._basefindindex/-/lodash._basefindindex-3.6.0.tgz", + "integrity": "sha1-8IM2ChsCJBjtgbyJm+sxLiHnSk8=" + }, + "lodash._baseisequal": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/lodash._baseisequal/-/lodash._baseisequal-3.0.7.tgz", + "integrity": "sha1-2AJfdjOdKTQnZ9zIh85cuVpbUfE=", + "requires": { + "lodash.isarray": "^3.0.0", + "lodash.istypedarray": "^3.0.0", + "lodash.keys": "^3.0.0" + } + }, + "lodash._baseismatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/lodash._baseismatch/-/lodash._baseismatch-3.1.3.tgz", + "integrity": "sha1-Byj8SO+hFpnT1fLXMEnyqxPED9U=", + "requires": { + "lodash._baseisequal": "^3.0.0" + } + }, + "lodash._basematches": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash._basematches/-/lodash._basematches-3.2.0.tgz", + "integrity": "sha1-9H4D8H7CB4SrCWjQy2y1l+IQEVg=", + "requires": { + "lodash._baseismatch": "^3.0.0", + "lodash.pairs": "^3.0.0" + } + }, + "lodash._bindcallback": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz", + "integrity": "sha1-5THCdkTPi1epnhftlbNcdIeJOS4=" + }, + "lodash._getnative": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=" + }, + "lodash._reinterpolate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", + "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=" + }, + "lodash.every": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.every/-/lodash.every-4.6.0.tgz", + "integrity": "sha1-64mYS+vENkJ5uzrvu9HKGb+mxqc=" + }, + "lodash.find": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.find/-/lodash.find-4.6.0.tgz", + "integrity": "sha1-ywcE1Hq3F4n/oN6Ll92Sb7iLE7E=" + }, + "lodash.findwhere": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.findwhere/-/lodash.findwhere-3.1.0.tgz", + "integrity": "sha1-eTfTTz6sgY3sf6lOjKXib9uhz8E=", + "requires": { + "lodash._basematches": "^3.0.0", + "lodash.find": "^3.0.0" + }, + "dependencies": { + "lodash.find": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/lodash.find/-/lodash.find-3.2.1.tgz", + "integrity": "sha1-BG4xnzrOkSrGySRsf2g8XsB7Nq0=", + "requires": { + "lodash._basecallback": "^3.0.0", + "lodash._baseeach": "^3.0.0", + "lodash._basefind": "^3.0.0", + "lodash._basefindindex": "^3.0.0", + "lodash.isarray": "^3.0.0", + "lodash.keys": "^3.0.0" + } + } + } + }, + "lodash.foreach": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz", + "integrity": "sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM=" + }, + "lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=" + }, + "lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=" + }, + "lodash.isarray": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=" + }, + "lodash.isempty": { + "version": "4.4.0", + "resolved": "http://registry.npmjs.org/lodash.isempty/-/lodash.isempty-4.4.0.tgz", + "integrity": "sha1-b4bL7di+TsmHvpqvM8loTbGzHn4=" + }, + "lodash.isobject": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz", + "integrity": "sha1-PI+41bW/S/kK4G4U8qUwpO2TXh0=" + }, + "lodash.istypedarray": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/lodash.istypedarray/-/lodash.istypedarray-3.0.6.tgz", + "integrity": "sha1-yaR3SYYHUB2OhJTSg7h8OSgc72I=" + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "requires": { + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" + } + }, + "lodash.merge": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.1.tgz", + "integrity": "sha512-AOYza4+Hf5z1/0Hztxpm2/xiPZgi/cjMqdnKTUWTBSKchJlxXXuUSxCCl8rJlf4g6yww/j6mA8nC8Hw/EZWxKQ==" + }, "lodash.omit": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.omit/-/lodash.omit-4.5.0.tgz", "integrity": "sha1-brGa5aHuHdnfC5aeZs4Lf6MLXmA=" }, + "lodash.pairs": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash.pairs/-/lodash.pairs-3.0.1.tgz", + "integrity": "sha1-u+CNV4bu6qCaFckevw3LfSvjJqk=", + "requires": { + "lodash.keys": "^3.0.0" + } + }, + "lodash.pick": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz", + "integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=" + }, + "lodash.template": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.4.0.tgz", + "integrity": "sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A=", + "requires": { + "lodash._reinterpolate": "~3.0.0", + "lodash.templatesettings": "^4.0.0" + } + }, + "lodash.templatesettings": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz", + "integrity": "sha1-K01OlbpEDZFf8IvImeRVNmZxMxY=", + "requires": { + "lodash._reinterpolate": "~3.0.0" + } + }, + "lodash.union": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz", + "integrity": "sha1-SLtQiECfFvGCFmZkHETdGqrjzYg=" + }, + "lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" + }, + "lodash.without": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.without/-/lodash.without-4.4.0.tgz", + "integrity": "sha1-PNRXSgC2e643OpS3SHcmQFB7eqw=" + }, "lru-cache": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", @@ -600,6 +805,15 @@ "mimic-fn": "^1.0.0" } }, + "message-box": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/message-box/-/message-box-0.2.0.tgz", + "integrity": "sha512-SPLfVDEM2YcAgV2IB0B5vOGjvqXSSw7ZibEeXcff8HYpxyG1Uj+XjgnGUGyR1C0EQCvPI3MBx3p7opt2CIQ2hw==", + "requires": { + "lodash.merge": "^4.6.0", + "lodash.template": "^4.4.0" + } + }, "meteor-node-stubs": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/meteor-node-stubs/-/meteor-node-stubs-0.3.3.tgz", @@ -1372,6 +1586,17 @@ "minimist": "0.0.8" } }, + "mongo-object": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/mongo-object/-/mongo-object-0.1.3.tgz", + "integrity": "sha512-m3vs+a1JkvRXELJMe2ieMmBe03NUy6bctGjWicRhReYj8brDi0ojKHLKLmXWr/RupNaFP8Q7/x8xG8GpFtp9wg==", + "requires": { + "lodash.foreach": "^4.5.0", + "lodash.isempty": "^4.4.0", + "lodash.isobject": "^3.0.2", + "lodash.without": "^4.4.0" + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -1740,6 +1965,27 @@ "version": "3.0.2", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, + "simpl-schema": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/simpl-schema/-/simpl-schema-1.5.3.tgz", + "integrity": "sha512-J24gSh39gBc3TYRFgaWx81bRf9unNML9u3dTAgxL1KI3F9JOv+Z29yEbosJFqmHfuuZ3K7ET/tTQKX4r4+f8/w==", + "requires": { + "clone": "^2.1.1", + "extend": "^3.0.1", + "lodash.every": "^4.6.0", + "lodash.find": "^4.6.0", + "lodash.findwhere": "^3.1.0", + "lodash.includes": "^4.3.0", + "lodash.isempty": "^4.4.0", + "lodash.isobject": "^3.0.2", + "lodash.omit": "^4.5.0", + "lodash.pick": "^4.4.0", + "lodash.union": "^4.6.0", + "lodash.uniq": "^4.5.0", + "message-box": "^0.2.0", + "mongo-object": "^0.1.3" + } + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", diff --git a/app/package.json b/app/package.json index a690dc4d..2a048a29 100644 --- a/app/package.json +++ b/app/package.json @@ -21,6 +21,7 @@ "fibers": "^2.0.2", "meteor-node-stubs": "^0.3.3", "qrcode": "^1.3.0", + "simpl-schema": "^1.5.3", "source-map-support": "^0.5.9", "underscore": "^1.9.1", "vue": "^2.5.17", diff --git a/app/server/lib/cron/deleteRemovedDocuments.js b/app/server/lib/cron/deleteRemovedDocuments.js index d450aaec..1553cfd2 100644 --- a/app/server/lib/cron/deleteRemovedDocuments.js +++ b/app/server/lib/cron/deleteRemovedDocuments.js @@ -1,3 +1,17 @@ +import Attacks from "/imports/api/creature/Attacks.js"; +import Buffs from "/imports/api/creature/Buffs.js"; +import Classes from "/imports/api/creature/Classes.js"; +import CustomBuffs from "/imports/api/creature/CustomBuffs.js"; +import Effects from "/imports/api/creature/Effects.js"; +import Experiences from "/imports/api/creature/Experiences.js"; +import Features from "/imports/api/creature/Features.js"; +import Notes from "/imports/api/creature/Notes.js"; +import Proficiencies from "/imports/api/creature/Proficiencies.js"; +import SpellLists from "/imports/api/creature/SpellLists.js"; +import Spells from "/imports/api/creature/Spells.js"; +import Containers from "/imports/api/creature/Containers.js"; +import Items from "/imports/api/creature/Items.js"; + Meteor.startup(() => { const collections = [ Attacks, Buffs, Classes, CustomBuffs, Effects, Experiences, diff --git a/app/server/migrations/migrations.js b/app/server/migrations/migrations.js index 71ce0770..2115e058 100644 --- a/app/server/migrations/migrations.js +++ b/app/server/migrations/migrations.js @@ -59,6 +59,7 @@ Migrations.add({ version: 3, name: "Moves all character attributes off the character document", up: function () { + //TODO Temporary hitpoints should become attributes with the hitpoints type const batchSize = 50; const stats = [ // Abilities