Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rss/common

Package Overview
Dependencies
Maintainers
1
Versions
895
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rss/common - npm Package Compare versions

Comparing version 0.0.61 to 0.0.62

1

dist/constant/core/roles.constant.js

@@ -10,2 +10,3 @@ 'use strict';

DELEGATE: 'Delegate',
DEVELOPER: 'Developer',
EHS_ADMIN: 'EHS Admin',

@@ -12,0 +13,0 @@ LAB_MANAGER: 'LAB_MANAGER',

@@ -6,3 +6,4 @@ 'use strict';

READY_FOR_USE: 'READY_FOR_USE',
READY_FOR_USE_BY_SYSTEM: 'READY_FOR_USE_BY_SYSTEM',
ARCHIVED: 'ARCHIVED'
};

3

dist/model/procedure/document.js

@@ -171,2 +171,3 @@ 'use strict';

value: function fromTemplate(template, opt) {
var status = template.createBySystem ? DOCUMENT_STATUS.READY_FOR_USE_BY_SYSTEM : DOCUMENT_STATUS.DRAFT;
var sections = template.sectionDefinitions.map(function (sectionDefinition) {

@@ -181,3 +182,3 @@ return Object.assign({}, _extends({}, sectionDefinition, { id: new ObjectId() }), {

});
return new this(Object.assign({}, opt, { sections: sections, template: template }));
return new this(Object.assign({}, opt, { sections: sections, template: template, status: status }));
}

@@ -184,0 +185,0 @@ }]);

@@ -30,2 +30,3 @@ 'use strict';

this.preventRemove = false;
this.createBySystem = false;

@@ -51,2 +52,3 @@ if (opt) {

this.preventRemove = opt.preventRemove || false;
this.createBySystem = opt.createBySystem || false;

@@ -82,3 +84,4 @@ if (opt.sectionDefinitions) {

preventClone: { type: 'boolean' },
preventRemove: { type: 'boolean' }
preventRemove: { type: 'boolean' },
createBySystem: { type: 'boolean' }
},

@@ -85,0 +88,0 @@ required: Object.keys(this)

{
"name": "@rss/common",
"version": "0.0.61",
"version": "0.0.62",
"description": "common constant, classes, & helper",

@@ -5,0 +5,0 @@ "author": "Risk & Safety Solution",

@@ -8,2 +8,3 @@ module.exports = {

DELEGATE: 'Delegate',
DEVELOPER: 'Developer',
EHS_ADMIN: 'EHS Admin',

@@ -10,0 +11,0 @@ LAB_MANAGER: 'LAB_MANAGER',

module.exports = {
DRAFT: 'DRAFT',
READY_FOR_USE: 'READY_FOR_USE',
READY_FOR_USE_BY_SYSTEM: 'READY_FOR_USE_BY_SYSTEM',
ARCHIVED: 'ARCHIVED',
};

@@ -134,2 +134,3 @@ const ObjectId = require('bson').ObjectID;

static fromTemplate(template, opt) {
const status = template.createBySystem ? DOCUMENT_STATUS.READY_FOR_USE_BY_SYSTEM : DOCUMENT_STATUS.DRAFT;
const sections = template.sectionDefinitions.map((sectionDefinition) =>

@@ -147,3 +148,3 @@ Object.assign(

);
return new this(Object.assign({}, opt, { sections, template }));
return new this(Object.assign({}, opt, { sections, template, status }));
}

@@ -150,0 +151,0 @@

const Document = require('./document');
const TemplateReference = require('./template-reference');
const DOCUMENT_STATUS = require('../../constant/procedure/document-status.constant');

@@ -124,2 +125,6 @@ const ObjectId = require('bson').ObjectID;

doc.sections = doc.sections.map((section) => {
section.cards.map((card) => {
delete card.id; //eslint-disable-line
return card;
});
delete section.id; // eslint-disable-line

@@ -182,5 +187,28 @@ return section;

delete newDocument.sections[0].id;
delete newDocument.sections[0].cards[0].id;
expect(doc).toEqual(newDocument);
});
it('should create a document from a template marked create by system', () => {
const template = {
_id: new ObjectId('507f191e810c19729de860ea'),
name: 'Created by the system',
campusCode: ['ALL'],
tenantCode: ['ALL'],
status: 'PUBLISHED',
maxExpirationDays: 365, // days
types: ['LOTO'],
preventClone: false,
preventRemove: false,
createBySystem: true,
sectionDefinitions: [],
};
const doc = Document.fromTemplate(template, {
title: 'I am created by the system',
});
expect(doc.status).toEqual(DOCUMENT_STATUS.READY_FOR_USE_BY_SYSTEM);
});
it('should calculate counts for a document', () => {

@@ -187,0 +215,0 @@ const doc = new Document({

@@ -22,2 +22,3 @@ const ObjectId = require('bson').ObjectID;

this.preventRemove = false;
this.createBySystem = false;

@@ -39,2 +40,3 @@ if (opt) {

this.preventRemove = opt.preventRemove || false;
this.createBySystem = opt.createBySystem || false;

@@ -67,2 +69,3 @@ if (opt.sectionDefinitions) {

preventRemove: { type: 'boolean' },
createBySystem: { type: 'boolean' },
},

@@ -69,0 +72,0 @@ required: Object.keys(this),

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc