New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cocreate/crud-server

Package Overview
Dependencies
Maintainers
1
Versions
175
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cocreate/crud-server - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

4

index.js

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

const user = require('./src/user');
const organization = require('./src/organization');
const industry = require('./src/industry');
const organization = require('./src/organization.js');
const industry = require('./src/industry.js');
const backup = require('./src/backup');

@@ -10,0 +10,0 @@

{
"name": "@cocreate/crud-server",
"version": "1.0.1",
"version": "1.1.0",
"description": "CoCreate-crud-server",

@@ -36,3 +36,3 @@ "keywords": [

"author": "CoCreate LLC",
"license": "unlicensed",
"license": "SSPL-1.0",
"bugs": {

@@ -39,0 +39,0 @@ "url": "https://github.com/CoCreate-app/CoCreate-crud-server/issues"

@@ -24,6 +24,5 @@

var apiKey = data['apiKey'];
var securityKey = data['securityKey'];
var organization_id = data['organization_id'];
if (!apiKey || !securityKey || !organization_id) return {result: false};
if (!apiKey || !organization_id) return {result: false};

@@ -36,3 +35,2 @@ var collection = this.db.collection('organizations');

"apiKey": data['apiKey'],
"securityKey": data['securityKey'],
}

@@ -39,0 +37,0 @@

@@ -54,10 +54,4 @@

async createDocument(socket, req_data, roomInfo){
const securityRes = await this.checkSecurity(req_data);
const self = this;
if (!securityRes.result) {
this.wsManager.send(socket, 'securityError', 'error', null, roomInfo);
return;
}
if(!req_data.data) return;

@@ -75,2 +69,3 @@

}
if (req_data.broadcast !== false) {

@@ -83,2 +78,5 @@ if (req_data.room) {

}
self.processCRUDEvent('createDocument', response);
} else {

@@ -97,11 +95,7 @@ self.wsManager.send(socket, 'ServerError', error, null, roomInfo);

if (!req_data['collection'] || req_data['collection'] == 'null' || typeof req_data['collection'] !== 'string') {
this.wsManager.send(socket, 'ServerError', 'error', null, roomInfo);
return;
}
const self = this;
const securityRes = await this.checkSecurity(req_data);
if (!securityRes.result) {
this.wsManager.send(socket, 'securityError', 'error', null, roomInfo);
return;
}
try {

@@ -114,4 +108,4 @@

};
if (securityRes['organization_id']) {
query['organization_id'] = securityRes['organization_id'];
if (req_data['organization_id']) {
query['organization_id'] = req_data['organization_id'];
}

@@ -127,2 +121,3 @@

}
self.wsManager.send(socket, 'readDocument', { ...req_data, data: encodeObject(tmp)}, req_data['organization_id'], roomInfo);

@@ -141,9 +136,4 @@ } else {

async updateDocument(socket, req_data, roomInfo) {
const securityRes = await this.checkSecurity(req_data);
const self = this;
if (!securityRes.result) {
this.wsManager.send(socket, 'securityError', 'error', req_data['organization_id'], roomInfo);
return;
}
try {

@@ -182,2 +172,4 @@

}
self.processCRUDEvent('updateDocument', response);
}).catch((error) => {

@@ -196,8 +188,3 @@ self.wsManager.send(socket, 'ServerError', error, null, roomInfo);

const self = this;
const securityRes = await this.checkSecurity(req_data);
if (!securityRes.result) {
this.wsManager.send(socket, 'securityError', 'error', null, roomInfo);
return;
}
try {

@@ -208,6 +195,3 @@ const collection = this.db.collection(req_data["collection"]);

};
// if (securityRes['organization_id']) {
// query['organization_id'] = securityRes['organization_id'];
// }
collection.deleteOne(query, function(error, result) {

@@ -226,2 +210,3 @@ if (!error) {

}
self.processCRUDEvent('deleteDocument', response);
} else {

@@ -236,2 +221,9 @@ self.wsManager.send(socket, 'ServerError', error, null, roomInfo);

}
processCRUDEvent(action, data) {
process.emit('changed-document', data)
// if (data.collection == 'permissions') {
// process.emit('refresh-permission', data)
// }
}
}

@@ -238,0 +230,0 @@

@@ -72,6 +72,5 @@

const newOrgApiKey = newOrg.apiKey;
const newOrgSecurityKey = newOrg.securityKey;
const {subdomain, apiKey, securityKey, organization_id} = orgData;
const {subdomain, apiKey, organization_id} = orgData;

@@ -112,6 +111,2 @@ const newDB = this.getDB(newOrgId);

}
if (newOrgSecurityKey && securityKey) {
document[field] = self.replaceContent(document[field], securityKey, newOrgSecurityKey);
}
}

@@ -205,3 +200,2 @@ }

apiKey: orgDocument.apiKey,
securityKey: orgDocument.securityKey,
organization_id: organization_id

@@ -208,0 +202,0 @@ }

@@ -58,3 +58,3 @@

async readDocumentList(socket, req_data, roomInfo) {
const securityRes = await this.checkSecurity(req_data);
// const securityRes = await this.checkSecurity(req_data);

@@ -70,6 +70,6 @@ function sleep(ms) {

const self = this;
if (!securityRes.result) {
this.wsManager.send(socket, 'securityError', 'error', req_data['organization_id'], roomInfo);
return;
}
// if (!securityRes.result) {
// this.wsManager.send(socket, 'securityError', 'error', req_data['organization_id'], roomInfo);
// return;
// }

@@ -83,3 +83,12 @@ if (req_data['is_collection']) {

var collection = this.db.collection(req_data['collection']);
const operator = req_data.operator;
const operator = {
filters: [],
orders: [],
search: {
value: [],
type: "or"
},
startIndex: 0,
...req_data.operator
};

@@ -89,13 +98,5 @@ var query = {};

// if (operator['fetch'] && operator.fetch.name) {
// let fetch_value = operator.fetch.value;
// if (operator.fetch.name === "_id") {
// fetch_value = new ObjectID(fetch_value)
// }
// query[operator.fetch.name] = fetch_value;
// if (securityRes['organization_id']) {
// query['organization_id'] = securityRes['organization_id'];
// }
if (securityRes['organization_id']) {
query['organization_id'] = securityRes['organization_id'];
}

@@ -102,0 +103,0 @@ var sort = {};

@@ -177,6 +177,5 @@

const newOrgApiKey = newOrg.apiKey;
const newOrgSecurityKey = newOrg.securityKey;
const {subdomain, apiKey, securityKey, organization_id} = orgData;
const {subdomain, apiKey, organization_id} = orgData;

@@ -217,6 +216,2 @@ const newDB = this.getDB(newOrgId);

}
if (newOrgSecurityKey && securityKey) {
document[field] = self.replaceContent(document[field], securityKey, newOrgSecurityKey);
}
}

@@ -310,3 +305,2 @@ }

apiKey: orgDocument.apiKey,
securityKey: orgDocument.securityKey,
organization_id: organization_id

@@ -313,0 +307,0 @@ }

@@ -16,5 +16,2 @@

this.wsManager.on('deleteOrg', (socket, data, roomInfo) => this.deleteOrg(socket, data));
this.wsManager.on('runIndustry', (socket, data, roomInfo) => this.runIndustry(socket, data));
this.wsManager.on('createIndustryNew', (socket, data, roomInfo) => this.createIndustry(socket, data));
}

@@ -29,11 +26,11 @@ }

const collection = this.getCollection(data);
collection.insertOne(data.data, function(error, result) {
collection.insertOne({ ...data.data, organization_id: data.organization_id }, function(error, result) {
if(!error && result){
const orgId = result.ops[0]._id + "";
const anotherCollection = self.getDB(orgId).collection(data['collection']);
anotherCollection.insertOne(result.ops[0]);
anotherCollection.insertOne({...result.ops[0], organization_id : orgId});
const response = { ...data, document_id: result.ops[0]._id, data: result.ops[0] }
self.wsManager.send(socket, 'createOrg', response, );
self.wsManager.send(socket, 'createOrg', response );
if (data.room) {

@@ -40,0 +37,0 @@ self.wsManager.broadcast(socket, data.namespace || data['organization_id'] , data.room, 'createDocument', response, true);

@@ -30,3 +30,2 @@

apiKey: string,
securityKey: string,
organization_id: string

@@ -81,3 +80,2 @@ }

apiKey: string,
securityKey: string,
organization_id: string

@@ -105,3 +103,3 @@ }

collection.find(query).toArray(function(error, result) {
collection.find(query).toArray(async function(error, result) {
let response = {

@@ -116,2 +114,6 @@ eId: req_data['eId'],

if (!error && result && result.length > 0) {
let token = null;
if (self.wsManager.authInstance) {
token = await self.wsManager.authInstance.generateToken({user_id: result[0]['_id']});
}
response = { ...response,

@@ -123,3 +125,4 @@ success: true,

message: "Login successfuly",
status: "success"
status: "success",
token
};

@@ -170,3 +173,2 @@ }

apiKey: res[0]['apiKey'],
securityKey: res[0]['securityKey'],
adminUI_id: res[0]['adminUI_id'],

@@ -198,3 +200,2 @@ builderUI_id: res[0]['builderUI_id'],

apiKey: string,
securityKey: string,
organization_id: string

@@ -201,0 +202,0 @@ }

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