corebasic 1.0.193 → 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 -35
- package/package.json +1 -1
package/libs/elabase.js
CHANGED
|
@@ -48,49 +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 (outlet === "GLOBAL")
|
|
57
|
-
throw {message: "Error: Invalid outlet provided in Dip.globalMeta().setOutlet()"}
|
|
58
|
-
return {...obj, outlet}
|
|
59
|
-
},
|
|
60
|
-
setCompany: company => {
|
|
61
|
-
if (company === "GLOBAL")
|
|
62
|
-
throw {message: "Error: Invalid company provided in Dip.globalMeta().setCompany()"}
|
|
63
|
-
return {...obj, company}
|
|
64
|
-
},
|
|
65
|
-
}
|
|
53
|
+
return { ...args, company: "GLOBAL", outlet: "GLOBAL" }
|
|
66
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()"}
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
if (
|
|
74
|
-
|
|
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()"}
|
|
75
68
|
|
|
76
|
-
return {
|
|
77
|
-
|
|
78
|
-
set: (company, outlet) => {
|
|
69
|
+
return {...args, company: "GLOBAL", outlet}
|
|
70
|
+
}
|
|
79
71
|
|
|
80
|
-
|
|
81
|
-
throw {message: "Error: Invalid company provided in Dip.customMeta().set()"}
|
|
82
|
-
if (typeof outlet !== "string" && !Array.isArray(outlet))
|
|
83
|
-
throw {message: "Error: Invalid outlet provided in Dip.customMeta().set()"}
|
|
72
|
+
export const customMeta = (company, outlet, args) => {
|
|
84
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()"}
|
|
85
78
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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()"}
|
|
90
83
|
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
}
|
|
84
|
+
return {...args, company, outlet}
|
|
94
85
|
}
|
|
95
86
|
|
|
96
87
|
function validate_collection(collection, fn_name) {
|