@cocreate/crud-server 1.28.4 → 1.28.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## [1.28.6](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.28.5...v1.28.6) (2023-10-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * bump cocreate dependency versions ([1d1fc7c](https://github.com/CoCreate-app/CoCreate-crud-server/commit/1d1fc7cc74dafc5ca1bb8919403bcbf59a31ac08))
7
+
8
+ ## [1.28.5](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.28.4...v1.28.5) (2023-10-09)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * broadcast depreciated in favor of send() ([e5097b2](https://github.com/CoCreate-app/CoCreate-crud-server/commit/e5097b270e6eaa2d80b7b91aeab97906f5f1729f))
14
+ * removed timeStamp.toISOString() ([e09bcd5](https://github.com/CoCreate-app/CoCreate-crud-server/commit/e09bcd5d090e4aed1484661b0e5d28d27b0b4ee4))
15
+ * timestamp and sort() param ([44614c9](https://github.com/CoCreate-app/CoCreate-crud-server/commit/44614c9e5ccf6d0710f7162d1ab83dfddd2b8cd6))
16
+
1
17
  ## [1.28.4](https://github.com/CoCreate-app/CoCreate-crud-server/compare/v1.28.3...v1.28.4) (2023-09-18)
2
18
 
3
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/crud-server",
3
- "version": "1.28.4",
3
+ "version": "1.28.6",
4
4
  "description": "CoCreate-crud-server",
5
5
  "keywords": [
6
6
  "cocreate-crud",
@@ -40,8 +40,8 @@
40
40
  },
41
41
  "homepage": "https://cocreate.app/docs/CoCreate-crud-server",
42
42
  "dependencies": {
43
- "@cocreate/config": "^1.5.1",
44
- "@cocreate/utils": "^1.24.1",
43
+ "@cocreate/config": "^1.6.0",
44
+ "@cocreate/utils": "^1.25.0",
45
45
  "csvtojson": "^2.0.10",
46
46
  "json-2-csv": "^3.10.3"
47
47
  }
package/src/index.js CHANGED
@@ -76,8 +76,6 @@ class CoCreateCrudServer {
76
76
  }
77
77
  })
78
78
 
79
-
80
-
81
79
  let storages = this.storages.get(data.organization_id)
82
80
  if (storages === false)
83
81
  return resolve({ storage: false, error: 'A storage or database could not be found' })
@@ -110,8 +108,10 @@ class CoCreateCrudServer {
110
108
  }
111
109
  }
112
110
 
113
- if (!data['timeStamp'])
114
- data['timeStamp'] = new Date().toISOString()
111
+ if (data['timeStamp'])
112
+ data['timeStamp'] = new Date(data['timeStamp'])
113
+ else
114
+ data['timeStamp'] = new Date()
115
115
 
116
116
  // TODO: manage error handling if if no method defined
117
117
  if (data.method.startsWith('update') && data.upsert != false)
@@ -175,7 +175,7 @@ class CoCreateCrudServer {
175
175
  if (!data.type)
176
176
  data.type = data.method.split('.').pop()
177
177
  if (data.$filter.sort && data.$filter.sort.length)
178
- data[data.type] = sortData(array, data.$filter.sort)
178
+ data[data.type] = sortData(data[data.type], data.$filter.sort)
179
179
  if (data.$filter.index && data.$filter.limit)
180
180
  data[data.type] = data[data.type].slice(data.$filter.index, data.$filter.limit)
181
181
 
@@ -190,16 +190,16 @@ class CoCreateCrudServer {
190
190
  delete data.storageName
191
191
 
192
192
  if (data.socket) {
193
- if (data.organization_id === this.config.organization_id && data.socket.config.organization_id !== data.organization_id) {
194
- this.wsManager.broadcast({
193
+ if (data.organization_id === this.config.organization_id && data.socket.organization_id !== data.organization_id) {
194
+ this.wsManager.send({
195
195
  config: {
196
196
  organization_id: this.config.organization_id,
197
197
  }
198
198
  }, { ...data });
199
- data.organization_id = data.socket.config.organization_id
199
+ data.organization_id = data.socket.organization_id
200
200
  }
201
201
 
202
- this.wsManager.broadcast(data);
202
+ this.wsManager.send(data);
203
203
  process.emit('changed-object', data)
204
204
  resolve()
205
205
  } else {