@8ms/helpers 2.3.12 → 2.3.14
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/.yarn/install-state.gz +0 -0
- package/dist/prisma/server/index.mjs +3 -11
- package/dist/util/index.d.mts +4 -1
- package/dist/util/index.mjs +10 -1
- package/package.json +1 -1
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
+
import { getError } from "../../util/index.mjs";
|
|
1
2
|
import { BaseNamespace } from "../../_class/index.mjs";
|
|
2
3
|
|
|
3
|
-
//#region src/util/getError.ts
|
|
4
|
-
const getError = (error) => {
|
|
5
|
-
let response = "";
|
|
6
|
-
if (typeof error === "string") response = error.toUpperCase();
|
|
7
|
-
else if (error instanceof Error) response = error.message;
|
|
8
|
-
return response;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
4
|
//#region src/prisma/server/PrismaNamespace.ts
|
|
13
5
|
var PrismaNamespace = class extends BaseNamespace {
|
|
14
6
|
ensureInit = async () => {
|
|
@@ -26,14 +18,14 @@ var PrismaNamespace = class extends BaseNamespace {
|
|
|
26
18
|
} catch (e) {
|
|
27
19
|
throw new Error(`MariaDB adapter not installed - ${getError(e)}`);
|
|
28
20
|
}
|
|
29
|
-
|
|
21
|
+
if (this.config.isPostgres) try {
|
|
30
22
|
const { PrismaPg } = await import("@prisma/adapter-pg");
|
|
31
23
|
adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL });
|
|
32
24
|
} catch (e) {
|
|
33
25
|
throw new Error(`Postgres adapter not installed - ${getError(e)}`);
|
|
34
26
|
}
|
|
35
27
|
try {
|
|
36
|
-
const { PrismaClient } = await import("
|
|
28
|
+
const { PrismaClient } = await import("@prisma/client");
|
|
37
29
|
if (this.config.isDebug) this.client = new PrismaClient({
|
|
38
30
|
adapter,
|
|
39
31
|
log: [{
|
package/dist/util/index.d.mts
CHANGED
|
@@ -16,6 +16,9 @@ type GetClean = {
|
|
|
16
16
|
*/
|
|
17
17
|
declare const getClean: (props: GetClean) => string;
|
|
18
18
|
//#endregion
|
|
19
|
+
//#region src/util/getError.d.ts
|
|
20
|
+
declare const getError: (error: any) => string;
|
|
21
|
+
//#endregion
|
|
19
22
|
//#region src/util/getWithoutHash.d.ts
|
|
20
23
|
/**
|
|
21
24
|
* Get a URL without the parameter query.
|
|
@@ -44,4 +47,4 @@ declare const promiseChunks: (promises: Promise<any>[], size: number, sleepSecon
|
|
|
44
47
|
//#region src/util/sleep.d.ts
|
|
45
48
|
declare const sleep: (seconds: number) => Promise<void>;
|
|
46
49
|
//#endregion
|
|
47
|
-
export { defaultTo, getClean, getWithoutHash, getWithoutParameter, isUndefined, promiseChunks, sleep };
|
|
50
|
+
export { defaultTo, getClean, getError, getWithoutHash, getWithoutParameter, isUndefined, promiseChunks, sleep };
|
package/dist/util/index.mjs
CHANGED
|
@@ -59,6 +59,15 @@ const getClean = (props) => {
|
|
|
59
59
|
return response;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/util/getError.ts
|
|
64
|
+
const getError = (error) => {
|
|
65
|
+
let response = "";
|
|
66
|
+
if (typeof error === "string") response = error.toUpperCase();
|
|
67
|
+
else if (error instanceof Error) response = error.message;
|
|
68
|
+
return response;
|
|
69
|
+
};
|
|
70
|
+
|
|
62
71
|
//#endregion
|
|
63
72
|
//#region src/util/isUndefined.ts
|
|
64
73
|
const undefinedValue = "__!!UNDEFINED!!__";
|
|
@@ -95,4 +104,4 @@ const promiseChunks = async (promises, size, sleepSeconds = 0, callbackFunction)
|
|
|
95
104
|
};
|
|
96
105
|
|
|
97
106
|
//#endregion
|
|
98
|
-
export { defaultTo, getClean, getWithoutHash, getWithoutParameter, isUndefined, promiseChunks, sleep };
|
|
107
|
+
export { defaultTo, getClean, getError, getWithoutHash, getWithoutParameter, isUndefined, promiseChunks, sleep };
|