@cocreate/indexeddb 1.13.2 → 1.13.3
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 +9 -0
- package/CoCreate.config.js +24 -24
- package/package.json +1 -1
- package/src/index.js +10 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [1.13.3](https://github.com/CoCreate-app/CoCreate-indexeddb/compare/v1.13.2...v1.13.3) (2023-09-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* get.database response ([a2311df](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/a2311df7ef6c29cab8e21144ff10fa94a9c71540))
|
|
7
|
+
* handle method get.database ([dbc998e](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/dbc998ef9e7cd141c14c41c55e625bec9c996e55))
|
|
8
|
+
* Refactor condition for filtering objects in `processObject` function ([d5fc6a3](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/d5fc6a32ff3f09d2d6542c7733d4963df7900513))
|
|
9
|
+
|
|
1
10
|
## [1.13.2](https://github.com/CoCreate-app/CoCreate-indexeddb/compare/v1.13.1...v1.13.2) (2023-08-21)
|
|
2
11
|
|
|
3
12
|
|
package/CoCreate.config.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"organization_id": "",
|
|
3
|
-
"key": "",
|
|
4
|
-
"host": "",
|
|
5
|
-
"sources": [
|
|
6
|
-
{
|
|
7
|
-
"array": "files",
|
|
8
|
-
"object": {
|
|
9
|
-
"_id": "637ca2aa50234ef1671ce308",
|
|
10
|
-
"name": "index.html",
|
|
11
|
-
"path": "/docs/indexeddb/index.html",
|
|
12
|
-
"src": "{{./docs/index.html}}",
|
|
13
|
-
"host": [
|
|
14
|
-
"cocreate.app",
|
|
15
|
-
"general.cocreate.app"
|
|
16
|
-
],
|
|
17
|
-
"directory": "/docs/indexeddb",
|
|
18
|
-
"parentDirectory": "{{parentDirectory}}",
|
|
19
|
-
"content-type": "{{content-type}}",
|
|
20
|
-
"public": "true",
|
|
21
|
-
"website_id": "644d4bff8036fb9d1d1fd69c"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
]
|
|
1
|
+
module.exports = {
|
|
2
|
+
"organization_id": "",
|
|
3
|
+
"key": "",
|
|
4
|
+
"host": "",
|
|
5
|
+
"sources": [
|
|
6
|
+
{
|
|
7
|
+
"array": "files",
|
|
8
|
+
"object": {
|
|
9
|
+
"_id": "637ca2aa50234ef1671ce308",
|
|
10
|
+
"name": "index.html",
|
|
11
|
+
"path": "/docs/indexeddb/index.html",
|
|
12
|
+
"src": "{{./docs/index.html}}",
|
|
13
|
+
"host": [
|
|
14
|
+
"cocreate.app",
|
|
15
|
+
"general.cocreate.app"
|
|
16
|
+
],
|
|
17
|
+
"directory": "/docs/indexeddb",
|
|
18
|
+
"parentDirectory": "{{parentDirectory}}",
|
|
19
|
+
"content-type": "{{content-type}}",
|
|
20
|
+
"public": "true",
|
|
21
|
+
"website_id": "644d4bff8036fb9d1d1fd69c"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
25
|
}
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -63,9 +63,12 @@ async function indexedDb(data) {
|
|
|
63
63
|
let type = data.method.split('.');
|
|
64
64
|
type = type[type.length - 1];
|
|
65
65
|
|
|
66
|
-
if (type === 'database')
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
if (type === 'database') {
|
|
67
|
+
if (data.method === 'get.database') {
|
|
68
|
+
return await processDatabase(data)
|
|
69
|
+
} else
|
|
70
|
+
await processDatabase(data, newData, type)
|
|
71
|
+
} else {
|
|
69
72
|
if (data.request)
|
|
70
73
|
data[type] = data.request
|
|
71
74
|
|
|
@@ -419,7 +422,7 @@ async function processObject(data, newData, database, array, type) {
|
|
|
419
422
|
let filteredObjects
|
|
420
423
|
let arrayExist = db.objectStoreNames.contains(array)
|
|
421
424
|
if (arrayExist) {
|
|
422
|
-
if (data.filter || data.method == 'read.object' && !data.object && !data.object.length) {
|
|
425
|
+
if (data.filter || data.method == 'read.object' && (!data.object || data.object && !data.object.length)) {
|
|
423
426
|
db.close()
|
|
424
427
|
filteredObjects = await readObject(data, database, array)
|
|
425
428
|
db = await processDatabase({ method: 'get.database', database })
|
|
@@ -434,10 +437,10 @@ async function processObject(data, newData, database, array, type) {
|
|
|
434
437
|
}
|
|
435
438
|
}
|
|
436
439
|
|
|
437
|
-
let transaction, objectStore
|
|
440
|
+
// let transaction, objectStore
|
|
438
441
|
if (array && db) {
|
|
439
|
-
transaction = db.transaction([array], "readwrite");
|
|
440
|
-
objectStore = transaction.objectStore(array);
|
|
442
|
+
var transaction = db.transaction([array], "readwrite");
|
|
443
|
+
var objectStore = transaction.objectStore(array);
|
|
441
444
|
}
|
|
442
445
|
|
|
443
446
|
let objects = []
|