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.33.0 to 1.34.0

19

CHANGELOG.md

@@ -0,1 +1,20 @@

# [1.34.0](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.33.0...v1.34.0) (2024-01-08)
### Bug Fixes
* applied host to define environment/branch ([7a61c24](https://github.com/CoCreate-app/CoCreate-crud-server/commit/7a61c24c1ef879170106ab3aafa365f5078f6cb7))
* crud defaults defined by host ([b362deb](https://github.com/CoCreate-app/CoCreate-crud-server/commit/b362deb42945bc6326cfe590a61f532ac8206aa7))
* data.host data.socket.host ([00eb3a0](https://github.com/CoCreate-app/CoCreate-crud-server/commit/00eb3a030219e78617796f6a2f1fd10a2cec012f))
* getOrganization then get storage from organization returned ([8253876](https://github.com/CoCreate-app/CoCreate-crud-server/commit/8253876601dca41a58566ffad1542e63080e842e))
* removed host.crud ([ee1743a](https://github.com/CoCreate-app/CoCreate-crud-server/commit/ee1743abd580efe9045cdd7bcdae7d6b8e206744))
* requesting organization for platform ([edd65c5](https://github.com/CoCreate-app/CoCreate-crud-server/commit/edd65c50ab232cdb24010a7a447cf7924f94ff0b))
* typo host.length ([b97e059](https://github.com/CoCreate-app/CoCreate-crud-server/commit/b97e0590ee867634415583ae9a89b9462c7fa3b0))
### Features
* bumped CoCreate dependencies to their latest versions ([0aad6d7](https://github.com/CoCreate-app/CoCreate-crud-server/commit/0aad6d794b114993abffd58c83042b95838fe036))
* crud.getHost and crud.getorganization ([4445e27](https://github.com/CoCreate-app/CoCreate-crud-server/commit/4445e27891b65b53647d18031add25f2de16b417))
# [1.33.0](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.32.0...v1.33.0) (2023-11-25)

@@ -2,0 +21,0 @@

6

package.json
{
"name": "@cocreate/crud-server",
"version": "1.33.0",
"version": "1.34.0",
"description": "CoCreate-crud-server",

@@ -43,4 +43,4 @@ "keywords": [

"dependencies": {
"@cocreate/config": "^1.8.0",
"@cocreate/utils": "^1.29.0",
"@cocreate/config": "^1.10.0",
"@cocreate/utils": "^1.30.0",
"csvtojson": "^2.0.10",

@@ -47,0 +47,0 @@ "json-2-csv": "^3.10.3"

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

this.organizations = {};
this.hosts = {};
this.init()

@@ -65,21 +66,11 @@ }

return resolve()
if (!this.config)
this.config = await Config({
'organization_id': { prompt: 'Enter your organization_id: ' },
'storage': {
prompt: 'Enter a friendly name for the new storage: ',
variable: 'name'
},
'storage.{{name}}.provider': {
prompt: 'Enter the storage provider, ex mongodb: '
},
'storage.{{name}}.url': {
prompt: 'Enter the storage providers url: '
}
})
let storages = await this.getStorage(data)
if (storages.error)
return resolve(storages)
let organization = await this.getOrganization(data.organization_id)
if (organization.error)
return resolve(organization)
let storages = organization.storage
if (!storages)
return resolve({ serverStorage: false, error: 'A storage url could not be found' })
if (!data['timeStamp'])

@@ -124,2 +115,22 @@ data['timeStamp'] = new Date().toISOString()

if (organization.host) {
let host = organization.host
for (let i = 0; i < host.length; i++) {
let hostname
if (data.socket)
hostname = data.socket.host
else
hostname = data.host
if (host[i].name === hostname) {
if (host[i].storage)
data.storage = host[i].storage
if (host[i].database)
data.database = host[i].database
if (host[i].array)
data.array = host[i].array
break
}
}
}
if (!data.storage || !data.storage.length) {

@@ -187,17 +198,9 @@ data.storage = [Object.keys(storages)[0]]

async getStorage(data) {
if (this.organizations[data.organization_id])
return await this.organizations[data.organization_id]
if (data.organization_id === this.config.organization_id) {
this.organizations[data.organization_id] = this.config.storage
return this.config.storage
async getHost(host) {
if (this.hosts[host]) {
return await this.hosts[host]
} else {
if (this.organizations[data.organization_id]) {
return await this.organizations[data.organization_id]
} else {
this.organizations[data.organization_id] = this.getOrganization(data)
this.organizations[data.organization_id] = await this.organizations[data.organization_id]
return this.organizations[data.organization_id]
}
this.hosts[host] = this.getOrg(null, host)
this.hosts[host] = await this.hosts[host]
return this.hosts[host]
}

@@ -207,18 +210,44 @@

async getOrganization(data) {
let organization = await this.send({
async getOrganization(organization_id, platform) {
if (this.organizations[organization_id]) {
return await this.organizations[organization_id]
} else {
this.organizations[organization_id] = this.getOrg(organization_id, null, platform)
this.organizations[organization_id] = await this.organizations[organization_id]
return this.organizations[organization_id]
}
}
async getOrg(organization_id, host, platform = true) {
let data = {
method: 'object.read',
host,
database: this.config.organization_id,
array: 'organizations',
object: [{ _id: data.organization_id }],
organization_id: this.config.organization_id
})
}
if (!platform)
data.database = data.organization_id = organization_id
if (organization_id)
data.object = [{ _id: organization_id }]
else if (host)
data.$filter = {
query: [
{ key: "host", value: [host], operator: "$elemMatch" }
]
}
else
return { serverOrganization: false, error: 'An organization could not be found' }
if (data.organization_id === this.config.organization_id)
this.organizations[organization_id] = this.config
let organization = await this.send(data)
if (organization
&& organization.object
&& organization.object[0]) {
if (organization.object[0].storage) {
return organization.object[0].storage
} else
return { serverStorage: false, error: 'A storage url could not be found' }
return organization.object[0]
} else {

@@ -225,0 +254,0 @@ return { serverOrganization: false, error: 'An organization could not be found' }

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