@cocreate/indexeddb 1.9.4 → 1.9.5

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,11 @@
1
+ ## [1.9.5](https://github.com/CoCreate-app/CoCreate-indexeddb/compare/v1.9.4...v1.9.5) (2023-05-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Refactor organization and user document creation ([1e55ba0](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/1e55ba0e8b8b5ff096cac98e64e4d13cac7572ee))
7
+ * Updated dependencies to the lastest versions ([476552a](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/476552a85e3a0e16ac4da1129ae710093d0c01d6))
8
+
1
9
  ## [1.9.4](https://github.com/CoCreate-app/CoCreate-indexeddb/compare/v1.9.3...v1.9.4) (2023-05-19)
2
10
 
3
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/indexeddb",
3
- "version": "1.9.4",
3
+ "version": "1.9.5",
4
4
  "description": "A simple indexeddb component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "indexeddb",
package/src/index.js CHANGED
@@ -1034,8 +1034,8 @@ async function generateDB(organization = { document: {} }, user = { document: {}
1034
1034
  organization.collection = 'organizations'
1035
1035
  organization.document._id = organization_id
1036
1036
  organization.document.key = defaultKey
1037
- organization.document.name = organization.document.name || 'untitiled',
1038
- organization.organization_id = organization_id
1037
+ organization.document.name = organization.document.name || 'untitiled'
1038
+ organization.organization_id = organization_id
1039
1039
  createDocument(organization);
1040
1040
 
1041
1041
  // Create primary key
@@ -1049,18 +1049,6 @@ async function generateDB(organization = { document: {} }, user = { document: {}
1049
1049
  hosts: [
1050
1050
  "*"
1051
1051
  ],
1052
- collections: {
1053
- "organizations": ["read"],
1054
- "files": ["read"]
1055
- },
1056
- documents: {
1057
- "someid": {
1058
- "permissions": [""],
1059
- "fieldNames": {
1060
- "name": ["read"]
1061
- }
1062
- }
1063
- },
1064
1052
  actions: {
1065
1053
  "signIn": "",
1066
1054
  "signUp": "",
@@ -1068,8 +1056,7 @@ async function generateDB(organization = { document: {} }, user = { document: {}
1068
1056
  "runIndustry": "",
1069
1057
  "sendgrid": ["sendEmail"]
1070
1058
  },
1071
- admin: "false",
1072
- default: true,
1059
+ default: true
1073
1060
  },
1074
1061
  organization_id
1075
1062
  }
@@ -1079,11 +1066,10 @@ async function generateDB(organization = { document: {} }, user = { document: {}
1079
1066
  user.database = organization_id
1080
1067
  user.collection = 'users'
1081
1068
  user.document._id = user_id
1082
- user.document.name = user.document.name || 'untitiled',
1083
- user.document.password = user.document.password || btoa('0000'),
1084
- user.document.connected_orgs = [organization_id],
1085
- user.document.current_org = organization_id,
1086
- user.organization_id = organization_id
1069
+ user.document.firstname = user.document.firstname || 'untitiled'
1070
+ user.document.lastname = user.document.lastname || 'untitiled'
1071
+ user.organization_id = organization_id
1072
+
1087
1073
  createDocument(user);
1088
1074
 
1089
1075
  // Create role permission
@@ -1095,14 +1081,8 @@ async function generateDB(organization = { document: {} }, user = { document: {}
1095
1081
  _id: role_id,
1096
1082
  "type": "role",
1097
1083
  "name": "admin",
1098
- "collections": {
1099
- "*": ["*"]
1100
- },
1101
- "actions": {
1102
- "*": ""
1103
- },
1104
- "admin": "true",
1105
1084
  "hosts": ["*"],
1085
+ "admin": "true"
1106
1086
  },
1107
1087
  organization_id
1108
1088
  };
@@ -1114,9 +1094,11 @@ async function generateDB(organization = { document: {} }, user = { document: {}
1114
1094
  collection: 'keys',
1115
1095
  document: {
1116
1096
  _id: ObjectId(),
1117
- "type": "user_id",
1097
+ "type": "user",
1118
1098
  "key": user_id,
1119
- "roles": [role_id]
1099
+ "roles": [role_id],
1100
+ "email": user.document.email,
1101
+ "password": user.document.password || btoa('0000')
1120
1102
  },
1121
1103
  organization_id
1122
1104
  };