@cocreate/organizations 1.19.1 → 1.19.2

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,10 @@
1
+ ## [1.19.2](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.19.1...v1.19.2) (2023-09-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * conflict with config.key and apikey ([5f2c3d9](https://github.com/CoCreate-app/CoCreate-organizations/commit/5f2c3d9b553ff5ca7dac356ea96957396c5d081d))
7
+
1
8
  ## [1.19.1](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.19.0...v1.19.1) (2023-09-18)
2
9
 
3
10
 
@@ -1,24 +1,24 @@
1
- module.exports = {
2
- "organization_id": "",
3
- "key": "",
4
- "host": "",
5
- "sources": [
6
- {
7
- "array": "files",
8
- "object": {
9
- "_id": "60207e303c260207bf49cab8",
10
- "name": "index.html",
11
- "path": "/docs/organizations",
12
- "pathname": "/docs/organizations/index.html",
13
- "src": "{{./docs/index.html}}",
14
- "host": [
15
- "*",
16
- "general.cocreate.app"
17
- ],
18
- "directory": "organizations",
19
- "content-type": "{{content-type}}",
20
- "public": "true"
21
- }
22
- }
23
- ]
24
- }
1
+ module.exports = {
2
+ "organization_id": "",
3
+ "key": "",
4
+ "host": "",
5
+ "sources": [
6
+ {
7
+ "array": "files",
8
+ "object": {
9
+ "_id": "60207e303c260207bf49cab8",
10
+ "name": "index.html",
11
+ "path": "/docs/organizations",
12
+ "pathname": "/docs/organizations/index.html",
13
+ "src": "{{./docs/index.html}}",
14
+ "host": [
15
+ "*",
16
+ "general.cocreate.app"
17
+ ],
18
+ "directory": "organizations",
19
+ "content-type": "{{content-type}}",
20
+ "public": "true"
21
+ }
22
+ }
23
+ ]
24
+ };
package/docs/index.html CHANGED
@@ -351,7 +351,6 @@
351
351
  </button>
352
352
  </main>
353
353
 
354
- <script src="./apikey.js"></script>
355
354
  <script src="https://CoCreate.app/dist/CoCreate.js"></script>
356
355
  </body>
357
356
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/organizations",
3
- "version": "1.19.1",
3
+ "version": "1.19.2",
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",
@@ -58,8 +58,8 @@
58
58
  "webpack-log": "^3.0.1"
59
59
  },
60
60
  "dependencies": {
61
- "@cocreate/actions": "^1.11.1",
62
- "@cocreate/crud-client": "^1.25.0",
63
- "@cocreate/elements": "^1.21.0"
61
+ "@cocreate/actions": "^1.11.2",
62
+ "@cocreate/crud-client": "^1.25.1",
63
+ "@cocreate/elements": "^1.21.1"
64
64
  }
65
65
  }
package/src/client.js CHANGED
@@ -5,11 +5,11 @@ import Elements from '@cocreate/elements';
5
5
 
6
6
  async function generateDB(organization = { object: {} }, user = { object: {} }) {
7
7
  const organization_id = organization.object._id || Crud.ObjectId();
8
- const defaultKey = organization.object.key || uuid.generate();
8
+ const apikey = organization.object.key || uuid.generate();
9
9
  const user_id = user.object._id || Crud.ObjectId();
10
10
 
11
- let apiKey = await Crud.send({ method: 'create.object', database: organization_id, array: 'keys', organization_id })
12
- if (apiKey && apiKey.object && apiKey.object[0])
11
+ let hasApiKey = await Crud.send({ method: 'read.object', database: organization_id, array: 'keys', organization_id })
12
+ if (hasApiKey && hasApiKey.object && hasApiKey.object[0])
13
13
  return
14
14
 
15
15
  try {
@@ -43,7 +43,7 @@ async function generateDB(organization = { object: {} }, user = { object: {} })
43
43
  object: {
44
44
  _id: Crud.ObjectId(),
45
45
  type: "key",
46
- key: defaultKey,
46
+ key: apikey,
47
47
  actions: {
48
48
  signIn: true,
49
49
  signUp: true
@@ -90,7 +90,7 @@ async function generateDB(organization = { object: {} }, user = { object: {} })
90
90
  };
91
91
  Crud.send(userKey);
92
92
 
93
- return { organization: organization.object, key: key.object, user: user.object, role: role.object, userKey: userKey.object }
93
+ return { organization: organization.object, apikey, user: user.object, role: role.object, userKey: userKey.object }
94
94
 
95
95
  } catch (error) {
96
96
  return false