@cocreate/organizations 1.23.1 → 1.23.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 CHANGED
@@ -1,3 +1,20 @@
1
+ ## [1.23.3](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.23.2...v1.23.3) (2023-11-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * favicon.ico path ([0f45edf](https://github.com/CoCreate-app/CoCreate-organizations/commit/0f45edf7cb85c7ac7ae4b53434193b8ec960e81a))
7
+ * if organization_id entered return organiozation_id withoput generating users, keys, etc. ([4839882](https://github.com/CoCreate-app/CoCreate-organizations/commit/48398828b7606f84f38cad14d04cf553a2459c6c))
8
+ * update dependencies to the lates versions ([4778523](https://github.com/CoCreate-app/CoCreate-organizations/commit/47785236ea0a160cfb8455f63803831e87615d48))
9
+ * update method to use object.update etc ([06e9822](https://github.com/CoCreate-app/CoCreate-organizations/commit/06e9822199e62336bbfc843637e642ef48e3dfc4))
10
+
11
+ ## [1.23.2](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.23.1...v1.23.2) (2023-10-26)
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * if no org returned from service worker fetch file and get org from header ([03de0dc](https://github.com/CoCreate-app/CoCreate-organizations/commit/03de0dcb0c7bd489d02f041537b6f5fbb7673b53))
17
+
1
18
  ## [1.23.1](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.23.0...v1.23.1) (2023-10-25)
2
19
 
3
20
 
@@ -6,9 +6,9 @@
6
6
  <!-- CoCreate Favicon -->
7
7
  <link
8
8
  rel="icon"
9
- href="https://cdn.cocreate.app/favicon.ico"
10
- type="image/ico"
11
- sizes="16x16" />
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
12
  <link rel="manifest" href="/manifest.webmanifest" />
13
13
  </head>
14
14
  <body class="padding:20px">
package/demo/index.html CHANGED
@@ -6,9 +6,9 @@
6
6
  <!-- CoCreate Favicon -->
7
7
  <link
8
8
  rel="icon"
9
- href="https://cdn.cocreate.app/favicon.ico"
10
- type="image/ico"
11
- sizes="16x16" />
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
12
 
13
13
  <style>
14
14
  .speech-bubble:after {
@@ -6,9 +6,9 @@
6
6
  <!-- CoCreate Favicon -->
7
7
  <link
8
8
  rel="icon"
9
- href="https://cdn.cocreate.app/favicon.ico"
10
- type="image/ico"
11
- sizes="16x16" />
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
12
  <link rel="manifest" href="/manifest.webmanifest" />
13
13
  </head>
14
14
  <body>
@@ -6,9 +6,9 @@
6
6
  <!-- CoCreate Favicon -->
7
7
  <link
8
8
  rel="icon"
9
- href="https://cdn.cocreate.app/favicon.ico"
10
- type="image/ico"
11
- sizes="16x16" />
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
12
  <link rel="manifest" href="/manifest.webmanifest" />
13
13
  </head>
14
14
  <body class="width:fit-content overflow:auto">
@@ -6,9 +6,9 @@
6
6
  <!-- CoCreate Favicon -->
7
7
  <link
8
8
  rel="icon"
9
- href="https://cdn.cocreate.app/favicon.ico"
10
- type="image/ico"
11
- sizes="16x16" />
9
+ type="image/png"
10
+ sizes="32x32"
11
+ href="../assets/favicon.ico" />
12
12
  <link rel="manifest" href="/manifest.webmanifest" />
13
13
  </head>
14
14
  <body class="width:fit-content overflow:auto">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/organizations",
3
- "version": "1.23.1",
3
+ "version": "1.23.3",
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,9 +58,9 @@
58
58
  "webpack-log": "^3.0.1"
59
59
  },
60
60
  "dependencies": {
61
- "@cocreate/actions": "^1.12.0",
62
- "@cocreate/config": "^1.6.5",
63
- "@cocreate/crud-client": "^1.28.10",
64
- "@cocreate/elements": "^1.25.1"
61
+ "@cocreate/actions": "^1.12.1",
62
+ "@cocreate/config": "^1.6.6",
63
+ "@cocreate/crud-client": "^1.28.12",
64
+ "@cocreate/elements": "^1.25.2"
65
65
  }
66
66
  }
package/src/client.js CHANGED
@@ -12,7 +12,7 @@ async function generateDB(organization = { object: {} }, user = { object: {} })
12
12
 
13
13
  try {
14
14
  // Create organization
15
- organization.method = 'create.object'
15
+ organization.method = 'object.create'
16
16
  organization.storage = 'indexeddb'
17
17
  organization.database = organization_id
18
18
  organization.array = 'organizations'
@@ -22,7 +22,7 @@ async function generateDB(organization = { object: {} }, user = { object: {} })
22
22
  Indexeddb.send(organization);
23
23
 
24
24
  // Create user
25
- user.method = 'create.object'
25
+ user.method = 'object.create'
26
26
  user.storage = 'indexeddb'
27
27
  user.database = organization_id
28
28
  user.array = 'users'
@@ -34,7 +34,7 @@ async function generateDB(organization = { object: {} }, user = { object: {} })
34
34
 
35
35
  // Create default key
36
36
  let key = {
37
- method: 'create.object',
37
+ method: 'object.create',
38
38
  storage: 'indexeddb',
39
39
  database: organization_id,
40
40
  array: 'keys',
@@ -55,7 +55,7 @@ async function generateDB(organization = { object: {} }, user = { object: {} })
55
55
  // Create role
56
56
  let role_id = Crud.ObjectId().toString();
57
57
  let role = {
58
- method: 'create.object',
58
+ method: 'object.create',
59
59
  storage: 'indexeddb',
60
60
  database: organization_id,
61
61
  array: 'keys',
@@ -71,7 +71,7 @@ async function generateDB(organization = { object: {} }, user = { object: {} })
71
71
 
72
72
  // Create user key
73
73
  let userKey = {
74
- method: 'create.object',
74
+ method: 'object.create',
75
75
  storage: 'indexeddb',
76
76
  database: organization_id,
77
77
  array: 'keys',
@@ -98,7 +98,7 @@ async function generateDB(organization = { object: {} }, user = { object: {} })
98
98
  async function get() {
99
99
  let organization_id = await getOrganizationFromServiceWorker()
100
100
  if (!organization_id) {
101
- let data = await Indexeddb.send({ method: 'read.database' })
101
+ let data = await Indexeddb.send({ method: 'database.read' })
102
102
  for (let database of data.database) {
103
103
  let name = database.name
104
104
  if (name.match(/^[0-9a-fA-F]{24}$/)) {
@@ -106,6 +106,12 @@ async function get() {
106
106
  }
107
107
  }
108
108
  }
109
+
110
+ if (!organization_id) {
111
+ let file = await fetch('/')
112
+ organization_id = file.headers.get('organization');
113
+ }
114
+
109
115
  if (!organization_id)
110
116
  organization_id = await createOrganization()
111
117
 
@@ -150,6 +156,8 @@ async function createOrganizationPromise() {
150
156
 
151
157
  const organization_id = prompt("An organization_id could not be found, if you already have an organization_id input it now.\n\nOr leave blank and click 'OK' to create a new organization");
152
158
 
159
+ if (organization_id)
160
+ return organization_id
153
161
  if (organization_id === null)
154
162
  return Crud.socket.organization = 'canceled'
155
163
 
package/src/server.js CHANGED
@@ -51,21 +51,21 @@ class CoCreateOrganization {
51
51
  }
52
52
 
53
53
  const Data = {}
54
- Data.method = 'create.object'
54
+ Data.method = 'object.create'
55
55
  Data.database = process.env.organization_id
56
56
  Data.organization_id = process.env.organization_id
57
57
 
58
58
  if (organization) {
59
- const response = await this.crud.send({ ...Data, method: 'create.object', array: 'organizations', object: organization })
59
+ const response = await this.crud.send({ ...Data, array: 'organizations', object: organization })
60
60
  this.wsManager.send(this.platformSocket, response);
61
61
  }
62
62
  if (user) {
63
- const response = await this.crud.send({ ...Data, method: 'create.object', array: 'users', object: user })
63
+ const response = await this.crud.send({ ...Data, array: 'users', object: user })
64
64
  this.wsManager.send(this.platformSocket, response);
65
65
  }
66
66
 
67
67
  if (userKey) {
68
- const response = await this.crud.send({ ...Data, method: 'create.object', array: 'keys', object: userKey })
68
+ const response = await this.crud.send({ ...Data, array: 'keys', object: userKey })
69
69
  this.wsManager.send(this.platformSocket, response);
70
70
  }
71
71