@rss/common
Advanced tools
Comparing version 0.0.55 to 0.0.56
'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
@@ -170,3 +172,9 @@ | ||
var sections = template.sectionDefinitions.map(function (sectionDefinition) { | ||
return Object.assign({}, sectionDefinition, { cards: sectionDefinition.cardDefinitions }); | ||
return Object.assign({}, _extends({}, sectionDefinition, { id: new ObjectId() }), { | ||
cards: sectionDefinition.cardDefinitions.map(function (item) { | ||
return _extends({}, item, { | ||
id: new ObjectId() | ||
}); | ||
}) | ||
}); | ||
}); | ||
@@ -173,0 +181,0 @@ return new this(Object.assign({}, opt, { sections: sections, template: template })); |
@@ -27,3 +27,3 @@ 'use strict'; | ||
_this.details = { | ||
location: null, | ||
locations: [], | ||
inventories: [], | ||
@@ -42,3 +42,3 @@ hazardCodes: [] | ||
value: function fillObject(details) { | ||
this.details.location = details.location || null; | ||
this.details.locations = details.locations || null; | ||
this.details.inventories = details.inventories ? details.inventories.map(function (inv) { | ||
@@ -64,3 +64,3 @@ return new InventoryPlacardReference(inv); | ||
details: { | ||
location: { type: 'object' }, | ||
locations: { type: 'array', item: { type: 'object' } }, | ||
inventories: { type: 'array', item: { $ref: 'inventory-placard-reference.schema.json' } }, | ||
@@ -67,0 +67,0 @@ hazardCodes: { type: 'array', item: { type: 'string' } } |
@@ -11,2 +11,3 @@ 'use strict'; | ||
var ObjectId = require('bson').ObjectID; | ||
var clone = require('clone'); | ||
@@ -27,8 +28,11 @@ var tv4 = require('tv4'); | ||
_this.details = { | ||
buildingId: null, | ||
floorId: null, | ||
roomId: null, | ||
buildingName: null, | ||
floorName: null, | ||
roomNumber: null | ||
suiteId: null, | ||
locations: [{ | ||
buildingId: null, | ||
floorId: null, | ||
roomId: null, | ||
buildingName: null, | ||
floorName: null, | ||
roomNumber: null | ||
}] | ||
}; | ||
@@ -45,8 +49,13 @@ | ||
value: function fillObject(details) { | ||
this.details.buildingId = details.buildingId || null; | ||
this.details.floorId = details.floorId || null; | ||
this.details.roomId = details.roomId || null; | ||
this.details.buildingName = details.buildingName || null; | ||
this.details.floorName = details.floorName || null; | ||
this.details.roomNumber = details.roomNumber || null; | ||
this.details.suiteId = details.suiteId ? new ObjectId(details.suiteId) : null; | ||
this.details.locations = details.locations.map(function (loc) { | ||
return { | ||
buildingId: loc.buildingId || '', | ||
floorId: loc.floorId || '', | ||
roomId: loc.roomId || '', | ||
buildingName: loc.buildingName || '', | ||
floorName: loc.floorName || '', | ||
roomNumber: loc.roomNumber || '' | ||
}; | ||
}); | ||
} | ||
@@ -68,8 +77,14 @@ }, { | ||
details: { | ||
buildingId: { type: ['string', 'null'] }, | ||
floorId: { type: ['string', 'null'] }, | ||
roomId: { type: ['string', 'null'] }, | ||
buildingName: { type: ['string', 'null'] }, | ||
floorName: { type: ['string', 'null'] }, | ||
roomNumber: { type: ['string', 'null'] } | ||
suiteId: { type: ['object', 'null'] }, | ||
locations: { | ||
type: 'array', | ||
items: { | ||
buildingId: { type: ['string', 'null'] }, | ||
floorId: { type: ['string', 'null'] }, | ||
roomId: { type: ['string', 'null'] }, | ||
buildingName: { type: ['string', 'null'] }, | ||
floorName: { type: ['string', 'null'] }, | ||
roomNumber: { type: ['string', 'null'] } | ||
} | ||
} | ||
} | ||
@@ -76,0 +91,0 @@ } |
{ | ||
"name": "@rss/common", | ||
"version": "0.0.55", | ||
"version": "0.0.56", | ||
"description": "common constant, classes, & helper", | ||
@@ -5,0 +5,0 @@ "author": "Risk & Safety Solution", |
@@ -135,3 +135,12 @@ const ObjectId = require('bson').ObjectID; | ||
const sections = template.sectionDefinitions.map((sectionDefinition) => | ||
Object.assign({}, sectionDefinition, { cards: sectionDefinition.cardDefinitions }), | ||
Object.assign( | ||
{}, | ||
{ ...sectionDefinition, id: new ObjectId() }, | ||
{ | ||
cards: sectionDefinition.cardDefinitions.map((item) => ({ | ||
...item, | ||
id: new ObjectId(), | ||
})), | ||
}, | ||
), | ||
); | ||
@@ -138,0 +147,0 @@ return new this(Object.assign({}, opt, { sections, template })); |
@@ -12,3 +12,3 @@ const clone = require('clone'); | ||
this.details = { | ||
location: null, | ||
locations: [], | ||
inventories: [], | ||
@@ -24,3 +24,3 @@ hazardCodes: [], | ||
fillObject(details) { | ||
this.details.location = details.location || null; | ||
this.details.locations = details.locations || null; | ||
this.details.inventories = details.inventories | ||
@@ -46,3 +46,3 @@ ? details.inventories.map((inv) => new InventoryPlacardReference(inv)) | ||
details: { | ||
location: { type: 'object' }, | ||
locations: { type: 'array', item: { type: 'object' } }, | ||
inventories: { type: 'array', item: { $ref: 'inventory-placard-reference.schema.json' } }, | ||
@@ -49,0 +49,0 @@ hazardCodes: { type: 'array', item: { type: 'string' } }, |
@@ -0,1 +1,2 @@ | ||
const ObjectId = require('bson').ObjectID; | ||
const clone = require('clone'); | ||
@@ -11,8 +12,13 @@ const tv4 = require('tv4'); | ||
this.details = { | ||
buildingId: null, | ||
floorId: null, | ||
roomId: null, | ||
buildingName: null, | ||
floorName: null, | ||
roomNumber: null, | ||
suiteId: null, | ||
locations: [ | ||
{ | ||
buildingId: null, | ||
floorId: null, | ||
roomId: null, | ||
buildingName: null, | ||
floorName: null, | ||
roomNumber: null, | ||
}, | ||
], | ||
}; | ||
@@ -26,8 +32,11 @@ | ||
fillObject(details) { | ||
this.details.buildingId = details.buildingId || null; | ||
this.details.floorId = details.floorId || null; | ||
this.details.roomId = details.roomId || null; | ||
this.details.buildingName = details.buildingName || null; | ||
this.details.floorName = details.floorName || null; | ||
this.details.roomNumber = details.roomNumber || null; | ||
this.details.suiteId = details.suiteId ? new ObjectId(details.suiteId) : null; | ||
this.details.locations = details.locations.map((loc) => ({ | ||
buildingId: loc.buildingId || '', | ||
floorId: loc.floorId || '', | ||
roomId: loc.roomId || '', | ||
buildingName: loc.buildingName || '', | ||
floorName: loc.floorName || '', | ||
roomNumber: loc.roomNumber || '', | ||
})); | ||
} | ||
@@ -49,8 +58,14 @@ | ||
details: { | ||
buildingId: { type: ['string', 'null'] }, | ||
floorId: { type: ['string', 'null'] }, | ||
roomId: { type: ['string', 'null'] }, | ||
buildingName: { type: ['string', 'null'] }, | ||
floorName: { type: ['string', 'null'] }, | ||
roomNumber: { type: ['string', 'null'] }, | ||
suiteId: { type: ['object', 'null'] }, | ||
locations: { | ||
type: 'array', | ||
items: { | ||
buildingId: { type: ['string', 'null'] }, | ||
floorId: { type: ['string', 'null'] }, | ||
roomId: { type: ['string', 'null'] }, | ||
buildingName: { type: ['string', 'null'] }, | ||
floorName: { type: ['string', 'null'] }, | ||
roomNumber: { type: ['string', 'null'] }, | ||
}, | ||
}, | ||
}, | ||
@@ -57,0 +72,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
764668
237
12772