@veritree/services 2.30.0 → 2.30.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/package.json +1 -7
- package/src/endpoints/organizations.js +2 -8
- package/src/helpers/api.js +31 -29
- package/jsdoc.json +0 -16
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veritree/services",
|
|
3
|
-
"version": "2.30.
|
|
3
|
+
"version": "2.30.1",
|
|
4
4
|
"description": "A collection of javascript functions/services to talk to veritree API",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"doc": "jsdoc -c jsdoc.json"
|
|
8
|
-
},
|
|
9
6
|
"main": "index.js",
|
|
10
7
|
"repository": "https://github.com/tentree-org/veritree-services.git",
|
|
11
8
|
"author": "cyroveritree <cyro@veritree.com>",
|
|
@@ -15,8 +12,5 @@
|
|
|
15
12
|
},
|
|
16
13
|
"dependencies": {
|
|
17
14
|
"np": "^7.6.2"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"jsdoc": "^4.0.2"
|
|
21
15
|
}
|
|
22
16
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Api from
|
|
1
|
+
import Api from '../helpers/api';
|
|
2
2
|
|
|
3
3
|
class OrganizationsApi extends Api {
|
|
4
4
|
constructor(resource) {
|
|
5
5
|
super(resource);
|
|
6
|
-
this.resource =
|
|
6
|
+
this.resource = 'organizations';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
tasks(orgId) {
|
|
@@ -14,12 +14,6 @@ class OrganizationsApi extends Api {
|
|
|
14
14
|
return await this.get(url);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* Creates a new task with the specified data.
|
|
19
|
-
*
|
|
20
|
-
* @param {Object} taskData - An object containing the data for the new task.
|
|
21
|
-
* @returns {Promise<Object>} - A Promise that resolves to the created task object.
|
|
22
|
-
*/
|
|
23
17
|
const create = async (data) => {
|
|
24
18
|
url = `${url}${this.getUrlParams()}`;
|
|
25
19
|
return await this.post(url, data);
|
package/src/helpers/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getCookie } from "./cookies";
|
|
2
|
-
import { getSession } from "./session";
|
|
3
2
|
import { createParamsStringFromArgs } from "../utils/args";
|
|
3
|
+
import { getSession } from "./session";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Returns the runtime configuration object for Nuxt 3.
|
|
@@ -11,27 +11,27 @@ import { createParamsStringFromArgs } from "../utils/args";
|
|
|
11
11
|
*
|
|
12
12
|
* @returns {Object|null} - The runtime configuration object, or null if it's not available.
|
|
13
13
|
*/
|
|
14
|
-
function getNuxtRuntimeConfig() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function getVersion() {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
14
|
+
// function getNuxtRuntimeConfig() {
|
|
15
|
+
// if (typeof useRuntimeConfig === "function") {
|
|
16
|
+
// return useRuntimeConfig();
|
|
17
|
+
// } else {
|
|
18
|
+
// return null;
|
|
19
|
+
// }
|
|
20
|
+
// }
|
|
21
|
+
|
|
22
|
+
// function getVersion() {
|
|
23
|
+
// if (process) {
|
|
24
|
+
// process?.env?.API_VERITREE_VERSION;
|
|
25
|
+
// } else {
|
|
26
|
+
// const nuxtRuntimeConfig = getNuxtRuntimeConfig();
|
|
27
|
+
|
|
28
|
+
// if (nuxtRuntimeConfig) {
|
|
29
|
+
// return nuxtRuntimeConfig.public.API_VERITREE_VERSION;
|
|
30
|
+
// }
|
|
31
|
+
// }
|
|
32
|
+
|
|
33
|
+
// return "5.0.0";
|
|
34
|
+
// }
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Adds a version parameter to a URL if it does not already have one.
|
|
@@ -53,7 +53,7 @@ function addVersionParam(url) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
// Use environment variable if available, otherwise use default version
|
|
56
|
-
const version =
|
|
56
|
+
const version = process.env.API_VERITREE_VERSION || "5.0.0";
|
|
57
57
|
|
|
58
58
|
// Append version parameter to URL
|
|
59
59
|
const urlVersionParam = url.includes("?")
|
|
@@ -106,13 +106,15 @@ function getConfig(method, data, as) {
|
|
|
106
106
|
export default class Api {
|
|
107
107
|
constructor(resource) {
|
|
108
108
|
// Nuxt 3
|
|
109
|
-
const nuxtConfig = getNuxtRuntimeConfig();
|
|
110
|
-
const url =
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
// const nuxtConfig = getNuxtRuntimeConfig();
|
|
110
|
+
// const url =
|
|
111
|
+
// nuxtConfig?.public?.API_VERITREE_URL ||
|
|
112
|
+
// process?.env?.API_VERITREE_URL ||
|
|
113
|
+
// null;
|
|
114
|
+
|
|
115
|
+
// this.baseUrl = url + "/api";
|
|
114
116
|
|
|
115
|
-
this.baseUrl =
|
|
117
|
+
this.baseUrl = process.env ? `${process.env.API_VERITREE_URL}/api` : null;
|
|
116
118
|
this.resource = resource ? resource : "";
|
|
117
119
|
this.orgId = null;
|
|
118
120
|
this.orgType = null;
|
package/jsdoc.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"source": {
|
|
3
|
-
"include": ["src/endpoints"],
|
|
4
|
-
"includePattern": ".js$",
|
|
5
|
-
"excludePattern": "(node_modules/|docs)"
|
|
6
|
-
},
|
|
7
|
-
"plugins": ["plugins/markdown"],
|
|
8
|
-
"templates": {
|
|
9
|
-
"cleverLinks": true,
|
|
10
|
-
"monospaceLinks": true
|
|
11
|
-
},
|
|
12
|
-
"opts": {
|
|
13
|
-
"recurse": true,
|
|
14
|
-
"destination": "./documentation/"
|
|
15
|
-
}
|
|
16
|
-
}
|