corebasic 1.0.194 → 1.0.195
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/libs/elabase.js +26 -41
- package/package.json +1 -1
package/libs/elabase.js
CHANGED
|
@@ -48,55 +48,40 @@ export function start(dbName) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
|
|
51
52
|
export const globalMeta = args => {
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
...obj,
|
|
55
|
-
setOutlet: outlet => {
|
|
56
|
-
if (typeof outlet !== "string" && !Array.isArray(outlet))
|
|
57
|
-
throw {message: "Error: Invalid outlet provided in Dip.globalMeta().setOutlet()"}
|
|
58
|
-
if (!outlet || (typeof outlet === "string" && outlet.trim() === "") || outlet === "GLOBAL" || (Array.isArray(outlet) && (!outlet.length || outlet.some(item => typeof item !== "string" || item.trim() === "" || item === "GLOBAL")) ))
|
|
59
|
-
throw {message: "Error: Invalid outlet provided in Dip.globalMeta().setOutlet()"}
|
|
60
|
-
|
|
61
|
-
return {...obj, outlet}
|
|
62
|
-
},
|
|
63
|
-
setCompany: company => {
|
|
64
|
-
if (typeof company !== "string" && !Array.isArray(company))
|
|
65
|
-
throw {message: "Error: Invalid company provided in Dip.globalMeta().setCompany()"}
|
|
66
|
-
if (!company || (typeof company === "string" && company.trim() === "") || company === "GLOBAL" || (Array.isArray(company) && (!company.length || company.some(item => typeof item !== "string" || item.trim() === "" || item === "GLOBAL")) ))
|
|
67
|
-
throw {message: "Error: Invalid company provided in Dip.globalMeta().setCompany()"}
|
|
68
|
-
|
|
69
|
-
return {...obj, company}
|
|
70
|
-
},
|
|
71
|
-
}
|
|
53
|
+
return { ...args, company: "GLOBAL", outlet: "GLOBAL" }
|
|
72
54
|
}
|
|
55
|
+
export const companyMeta = (company, args) => {
|
|
56
|
+
if (typeof company !== "string" && !Array.isArray(company))
|
|
57
|
+
throw {message: "Error: Invalid company provided in Dip.companyMeta()"}
|
|
58
|
+
if (!company || (typeof company === "string" && company.trim() === "") || company === "GLOBAL" || (Array.isArray(company) && (!company.length || company.some(item => typeof item !== "string" || item.trim() === "" || item === "GLOBAL")) ))
|
|
59
|
+
throw {message: "Error: Invalid company provided in Dip.companyMeta()"}
|
|
73
60
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
if (
|
|
80
|
-
|
|
61
|
+
return {...args, outlet: "GLOBAL", company}
|
|
62
|
+
}
|
|
63
|
+
export const outletMeta = (outlet, args) => {
|
|
64
|
+
if (typeof outlet !== "string" && !Array.isArray(outlet))
|
|
65
|
+
throw {message: "Error: Invalid outlet provided in Dip.outletMeta()"}
|
|
66
|
+
if (!outlet || (typeof outlet === "string" && outlet.trim() === "") || outlet === "GLOBAL" || (Array.isArray(outlet) && (!outlet.length || outlet.some(item => typeof item !== "string" || item.trim() === "" || item === "GLOBAL")) ))
|
|
67
|
+
throw {message: "Error: Invalid outlet provided in Dip.outletMeta()"}
|
|
81
68
|
|
|
82
|
-
return {
|
|
83
|
-
|
|
84
|
-
set: (company, outlet) => {
|
|
69
|
+
return {...args, company: "GLOBAL", outlet}
|
|
70
|
+
}
|
|
85
71
|
|
|
86
|
-
|
|
87
|
-
throw {message: "Error: Invalid company provided in Dip.customMeta().set()"}
|
|
88
|
-
if (typeof outlet !== "string" && !Array.isArray(outlet))
|
|
89
|
-
throw {message: "Error: Invalid outlet provided in Dip.customMeta().set()"}
|
|
72
|
+
export const customMeta = (company, outlet, args) => {
|
|
90
73
|
|
|
74
|
+
if (typeof company !== "string" && !Array.isArray(company))
|
|
75
|
+
throw {message: "Error: Invalid company provided in Dip.customMeta()"}
|
|
76
|
+
if (typeof outlet !== "string" && !Array.isArray(outlet))
|
|
77
|
+
throw {message: "Error: Invalid outlet provided in Dip.customMeta()"}
|
|
91
78
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
79
|
+
if (!company || (typeof company === "string" && company.trim() === "") || company === "GLOBAL" || (Array.isArray(company) && (!company.length || company.some(item => typeof item !== "string" || item.trim() === "" || item === "GLOBAL")) ))
|
|
80
|
+
throw {message: "Error: Invalid company provided in Dip.customMeta()"}
|
|
81
|
+
if (!outlet || (typeof outlet === "string" && outlet.trim() === "") || outlet === "GLOBAL" || (Array.isArray(outlet) && (!outlet.length || outlet.some(item => typeof item !== "string" || item.trim() === "" || item === "GLOBAL")) ))
|
|
82
|
+
throw {message: "Error: Invalid outlet provided in Dip.customMeta()"}
|
|
96
83
|
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
}
|
|
84
|
+
return {...args, company, outlet}
|
|
100
85
|
}
|
|
101
86
|
|
|
102
87
|
function validate_collection(collection, fn_name) {
|