@cocreate/api 1.18.2 → 1.19.1
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 +19 -0
- package/package.json +6 -6
- package/src/server.js +3 -43
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## [1.19.1](https://github.com/CoCreate-app/CoCreate-api/compare/v1.19.0...v1.19.1) (2024-01-30)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update getOrganization param ([bdcfb79](https://github.com/CoCreate-app/CoCreate-api/commit/bdcfb79d6437b86900a9157a06e50df13c04c22d))
|
|
7
|
+
|
|
8
|
+
# [1.19.0](https://github.com/CoCreate-app/CoCreate-api/compare/v1.18.2...v1.19.0) (2024-01-08)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* applied host to define environment/branch ([93d0288](https://github.com/CoCreate-app/CoCreate-api/commit/93d028877f4c2bdccc6c02ee7435620c8c8b2bab))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* bumped CoCreate dependencies to their latest versions ([c4e4a48](https://github.com/CoCreate-app/CoCreate-api/commit/c4e4a4826419af23da119063be0e56eb9fcc3ff9))
|
|
19
|
+
|
|
1
20
|
## [1.18.2](https://github.com/CoCreate-app/CoCreate-api/compare/v1.18.1...v1.18.2) (2023-12-09)
|
|
2
21
|
|
|
3
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.1",
|
|
4
4
|
"description": "A simple api helper component in vanilla javascript used by JavaScript developers to create thirdparty api intergrations. CoCreate-api includes the client component and server side for api processing. Thirdparty apis can be accessible using HTML5 attributes and/or JavaScript API. ",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"thirdparty-api-intergration",
|
|
@@ -59,11 +59,11 @@
|
|
|
59
59
|
"webpack-log": "^3.0.1"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@cocreate/actions": "^1.
|
|
63
|
-
"@cocreate/crud-client": "^1.
|
|
62
|
+
"@cocreate/actions": "^1.15.1",
|
|
63
|
+
"@cocreate/crud-client": "^1.32.2",
|
|
64
64
|
"@cocreate/element-prototype": "^1.15.0",
|
|
65
|
-
"@cocreate/render": "^1.
|
|
66
|
-
"@cocreate/socket-client": "^1.
|
|
67
|
-
"@cocreate/utils": "^1.
|
|
65
|
+
"@cocreate/render": "^1.37.1",
|
|
66
|
+
"@cocreate/socket-client": "^1.36.1",
|
|
67
|
+
"@cocreate/utils": "^1.30.0"
|
|
68
68
|
}
|
|
69
69
|
}
|
package/src/server.js
CHANGED
|
@@ -7,53 +7,13 @@ class CoCreateApi {
|
|
|
7
7
|
|
|
8
8
|
async getOrganization(config, component) {
|
|
9
9
|
|
|
10
|
-
let
|
|
11
|
-
method: 'object.read',
|
|
12
|
-
array: "organizations",
|
|
13
|
-
key: config["key"],
|
|
14
|
-
organization_id: config["organization_id"],
|
|
15
|
-
object: {
|
|
16
|
-
_id: config["organization_id"]
|
|
17
|
-
}
|
|
10
|
+
let organization = await this.crud.getOrganization(config);
|
|
18
11
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (!org || !org.object && !org.object[0]) {
|
|
22
|
-
console.log(component, " Error GET ORG in : ", e);
|
|
12
|
+
if (!organization.error)
|
|
23
13
|
return false;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return org.object[0];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async getApiKey(organization_id, name) {
|
|
30
|
-
this.organizations[organization_id] = this.getOrganization(organization_id, name)
|
|
31
|
-
this.organizations[organization_id] = await this.organizations[organization_id]
|
|
32
|
-
return this.organizations[organization_id]
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async getOrganizationNew(organization_id, name) {
|
|
36
|
-
let organization = await this.crud.send({
|
|
37
|
-
method: 'object.read',
|
|
38
|
-
database: organization_id,
|
|
39
|
-
array: 'organizations',
|
|
40
|
-
object: [{ _id: organization_id }],
|
|
41
|
-
organization_id
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
if (organization
|
|
45
|
-
&& organization.object
|
|
46
|
-
&& organization.object[0]) {
|
|
47
|
-
if (organization.object[0].apis && organization.object[0].apis[name]) {
|
|
48
|
-
return organization.object[0].apis && organization.object[0].apis[name]
|
|
49
|
-
} else
|
|
50
|
-
return { [this.name]: false, error: 'An apikey could not be found' }
|
|
51
|
-
} else {
|
|
52
|
-
return { serverOrganization: false, error: 'An organization could not be found' }
|
|
53
|
-
}
|
|
54
14
|
|
|
15
|
+
return organization
|
|
55
16
|
}
|
|
56
|
-
|
|
57
17
|
}
|
|
58
18
|
|
|
59
19
|
|