@cocreate/organizations 1.22.0 → 1.23.0

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,18 @@
1
+ # [1.23.0](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.22.1...v1.23.0) (2023-10-22)
2
+
3
+
4
+ ### Features
5
+
6
+ * ObjectId() returns an object containg the parts iof the _id along with a toString() function ([46d5c28](https://github.com/CoCreate-app/CoCreate-organizations/commit/46d5c28f3ca21b12477a34f69225e8fc5af63fd1))
7
+ * ObjectId() returns an object containg the parts iof the _id along with a toString() function ([a1976de](https://github.com/CoCreate-app/CoCreate-organizations/commit/a1976de4d1af4af5d07830cc080eecca709d2cc1))
8
+
9
+ ## [1.22.1](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.22.0...v1.22.1) (2023-10-19)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * getFormData renamed to getData ([dba019c](https://github.com/CoCreate-app/CoCreate-organizations/commit/dba019c295054be92576e0d94b92966109dcd19e))
15
+
1
16
  # [1.22.0](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.21.6...v1.22.0) (2023-10-16)
2
17
 
3
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/organizations",
3
- "version": "1.22.0",
3
+ "version": "1.23.0",
4
4
  "description": "A simple organizations component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "organizations",
package/src/client.js CHANGED
@@ -6,9 +6,9 @@ import Indexeddb from '@cocreate/indexeddb';
6
6
  import uuid from '@cocreate/uuid';
7
7
 
8
8
  async function generateDB(organization = { object: {} }, user = { object: {} }) {
9
- const organization_id = organization.object._id || Crud.ObjectId();
9
+ const organization_id = organization.object._id || Crud.ObjectId().toString();
10
10
  const apikey = organization.object.key || uuid.generate();
11
- const user_id = user.object._id || Crud.ObjectId();
11
+ const user_id = user.object._id || Crud.ObjectId().toString();
12
12
 
13
13
  try {
14
14
  // Create organization
@@ -39,7 +39,7 @@ async function generateDB(organization = { object: {} }, user = { object: {} })
39
39
  database: organization_id,
40
40
  array: 'keys',
41
41
  object: {
42
- _id: Crud.ObjectId(),
42
+ _id: Crud.ObjectId().toString(),
43
43
  type: "key",
44
44
  key: apikey,
45
45
  actions: {
@@ -53,7 +53,7 @@ async function generateDB(organization = { object: {} }, user = { object: {} })
53
53
  Indexeddb.send(key);
54
54
 
55
55
  // Create role
56
- let role_id = Crud.ObjectId();
56
+ let role_id = Crud.ObjectId().toString();
57
57
  let role = {
58
58
  method: 'create.object',
59
59
  storage: 'indexeddb',
@@ -76,7 +76,7 @@ async function generateDB(organization = { object: {} }, user = { object: {} })
76
76
  database: organization_id,
77
77
  array: 'keys',
78
78
  object: {
79
- _id: Crud.ObjectId(),
79
+ _id: Crud.ObjectId().toString(),
80
80
  type: "user",
81
81
  key: user_id,
82
82
  array: 'users', // could be any array
@@ -175,6 +175,7 @@ async function createOrganizationPromise() {
175
175
  }
176
176
  }
177
177
 
178
+
178
179
  async function createOrganization() {
179
180
  return organizationPromise || (organizationPromise = createOrganizationPromise());
180
181
  }
@@ -183,8 +184,8 @@ async function create(btn) {
183
184
  let formEl = btn.closest("form");
184
185
  if (!formEl) return;
185
186
 
186
- let organization = Elements.getFormData(formEl, 'organizations')
187
- let user = Elements.getFormData(formEl, 'users')
187
+ let organization = Elements.getData(formEl, 'organizations')
188
+ let user = Elements.getData(formEl, 'users')
188
189
 
189
190
  if (!organization || !organization.object)
190
191
  return