@veritree/services 2.30.0 → 2.30.1-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 +2 -7
- package/src/helpers/api.js +2 -49
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veritree/services",
|
|
3
|
-
"version": "2.30.
|
|
3
|
+
"version": "2.30.1-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>",
|
|
@@ -16,7 +13,5 @@
|
|
|
16
13
|
"dependencies": {
|
|
17
14
|
"np": "^7.6.2"
|
|
18
15
|
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"jsdoc": "^4.0.2"
|
|
21
|
-
}
|
|
16
|
+
"devDependencies": {}
|
|
22
17
|
}
|
package/src/helpers/api.js
CHANGED
|
@@ -2,45 +2,6 @@ import { getCookie } from "./cookies";
|
|
|
2
2
|
import { getSession } from "./session";
|
|
3
3
|
import { createParamsStringFromArgs } from "../utils/args";
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Returns the runtime configuration object for Nuxt 3.
|
|
7
|
-
*
|
|
8
|
-
* Note:
|
|
9
|
-
* This function should only be used with Nuxt 3.
|
|
10
|
-
* For Nuxt 2, the environment variables will work as expected.
|
|
11
|
-
*
|
|
12
|
-
* @returns {Object|null} - The runtime configuration object, or null if it's not available.
|
|
13
|
-
*/
|
|
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
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Adds a version parameter to a URL if it does not already have one.
|
|
38
|
-
* If an environment variable called API_VERITREE_VERSION is defined, its value is used as the version,
|
|
39
|
-
* otherwise the default version "5.0.0" is used.
|
|
40
|
-
*
|
|
41
|
-
* @param {string} url - The URL to modify.
|
|
42
|
-
* @returns {string} The modified URL with the version parameter appended to it.
|
|
43
|
-
*/
|
|
44
5
|
function addVersionParam(url) {
|
|
45
6
|
// If URL is invalid or already has the result parameter, return it as is
|
|
46
7
|
if (!url || url.includes("_result=1")) {
|
|
@@ -52,8 +13,7 @@ function addVersionParam(url) {
|
|
|
52
13
|
return url;
|
|
53
14
|
}
|
|
54
15
|
|
|
55
|
-
|
|
56
|
-
const version = getVersion();
|
|
16
|
+
const version = '10.0.0';
|
|
57
17
|
|
|
58
18
|
// Append version parameter to URL
|
|
59
19
|
const urlVersionParam = url.includes("?")
|
|
@@ -105,14 +65,7 @@ function getConfig(method, data, as) {
|
|
|
105
65
|
|
|
106
66
|
export default class Api {
|
|
107
67
|
constructor(resource) {
|
|
108
|
-
|
|
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 ? `${url}/api` : null;
|
|
68
|
+
this.baseUrl = null;
|
|
116
69
|
this.resource = resource ? resource : "";
|
|
117
70
|
this.orgId = null;
|
|
118
71
|
this.orgType = null;
|