@carbonorm/carbonnode 3.0.10 → 3.0.12
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/dist/api/builders/sqlBuilder.d.ts +21 -3
- package/dist/api/executors/Executor.d.ts +1 -1
- package/dist/api/executors/SqlExecutor.d.ts +4 -3
- package/dist/index.cjs.js +312 -211
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +311 -208
- package/dist/index.esm.js.map +1 -1
- package/dist/variables/isLocal.d.ts +1 -2
- package/dist/variables/isNode.d.ts +1 -1
- package/dist/variables/isTest.d.ts +1 -2
- package/dist/variables/isVerbose.d.ts +1 -2
- package/package.json +1 -1
- package/src/api/builders/sqlBuilder.ts +199 -149
- package/src/api/executors/Executor.ts +2 -2
- package/src/api/executors/HttpExecutor.ts +10 -10
- package/src/api/executors/SqlExecutor.ts +71 -15
- package/src/api/restRequest.ts +1 -1
- package/src/api/utils/apiHelpers.ts +1 -1
- package/src/api/utils/cacheManager.ts +1 -1
- package/src/api/utils/logger.ts +2 -2
- package/src/api/utils/toastNotifier.ts +2 -2
- package/src/variables/isLocal.ts +3 -2
- package/src/variables/isNode.ts +10 -1
- package/src/variables/isTest.ts +5 -4
- package/src/variables/isVerbose.ts +4 -5
|
@@ -45,7 +45,7 @@ export function checkCache<ResponseDataType = any, RestShortTableNames = string>
|
|
|
45
45
|
|
|
46
46
|
if (true === cacheResult?.final) {
|
|
47
47
|
|
|
48
|
-
if (false === isTest || true === isVerbose) {
|
|
48
|
+
if (false === isTest() || true === isVerbose()) {
|
|
49
49
|
|
|
50
50
|
console.groupCollapsed('%c API: Rest api cache (' + requestMethod + ' ' + tableName + ') has reached the final result. Returning undefined!', 'color: #cc0')
|
|
51
51
|
|
package/src/api/utils/logger.ts
CHANGED
|
@@ -4,14 +4,14 @@ import isVerbose from "variables/isVerbose";
|
|
|
4
4
|
* Conditionally group a log if verbose.
|
|
5
5
|
*/
|
|
6
6
|
export function group(title: string, data?: any): void {
|
|
7
|
-
if (!isVerbose) return;
|
|
7
|
+
if (!isVerbose()) return;
|
|
8
8
|
console.groupCollapsed(`%c${title}`, "color: #007acc");
|
|
9
9
|
if (data !== undefined) console.log(data);
|
|
10
10
|
console.groupEnd();
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export function info(message: string, ...optional: any[]): void {
|
|
14
|
-
if (!isVerbose) return;
|
|
14
|
+
if (!isVerbose()) return;
|
|
15
15
|
console.info(`%cINFO: ${message}`, "color: #0a0", ...optional);
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -3,9 +3,9 @@ import { toastOptions, toastOptionsDevs } from "variables/toastOptions";
|
|
|
3
3
|
import isLocal from "variables/isLocal";
|
|
4
4
|
|
|
5
5
|
export function onSuccess(message: string): void {
|
|
6
|
-
toast.success(message, isLocal ? toastOptionsDevs : toastOptions);
|
|
6
|
+
toast.success(message, isLocal() ? toastOptionsDevs : toastOptions);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export function onError(message: string): void {
|
|
10
|
-
toast.error(message, isLocal ? toastOptionsDevs : toastOptions);
|
|
10
|
+
toast.error(message, isLocal() ? toastOptionsDevs : toastOptions);
|
|
11
11
|
}
|
package/src/variables/isLocal.ts
CHANGED
package/src/variables/isNode.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
const isNode =
|
|
1
|
+
const isNode = () => {
|
|
2
|
+
|
|
3
|
+
console.log('Checking if running in Node.js environment...');
|
|
4
|
+
|
|
5
|
+
const isNodeEnv = typeof process !== 'undefined' && !!process.versions?.node;
|
|
6
|
+
|
|
7
|
+
console.log(`Is Node.js environment: ${isNodeEnv}`);
|
|
8
|
+
|
|
9
|
+
return isNodeEnv;
|
|
10
|
+
}
|
|
2
11
|
|
|
3
12
|
export default isNode;
|
package/src/variables/isTest.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {getEnvVar} from "./getEnvVar";
|
|
2
2
|
|
|
3
|
-
const isTest = getEnvVar('JEST_WORKER_ID') || getEnvVar('NODE_ENV') === 'test'
|
|
4
|
-
|| getEnvVar('REACT_APP_TEST') === 'true' || getEnvVar('VITE_TEST') === 'true'
|
|
5
|
-
|| getEnvVar('MODE') === 'test' || getEnvVar('VITE_TEST_MODE') === 'true';
|
|
6
3
|
|
|
7
|
-
export default
|
|
4
|
+
export default function () {
|
|
5
|
+
return getEnvVar('JEST_WORKER_ID') || getEnvVar('NODE_ENV') === 'test'
|
|
6
|
+
|| getEnvVar('REACT_APP_TEST') === 'true' || getEnvVar('VITE_TEST') === 'true'
|
|
7
|
+
|| getEnvVar('MODE') === 'test' || getEnvVar('VITE_TEST_MODE') === 'true';
|
|
8
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {getEnvVar} from "./getEnvVar";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export default isVerbose
|
|
3
|
+
export default function () {
|
|
4
|
+
const envVerbose = getEnvVar('VERBOSE') || getEnvVar('REACT_APP_VERBOSE') || getEnvVar('VITE_VERBOSE') || ''
|
|
5
|
+
return ['true', '1', 'yes', 'on'].includes(envVerbose.toLowerCase());
|
|
6
|
+
}
|