corebasic 1.0.191 → 1.0.193

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.
Files changed (2) hide show
  1. package/libs/elabase.js +40 -4
  2. package/package.json +1 -1
package/libs/elabase.js CHANGED
@@ -52,8 +52,44 @@ export const globalMeta = args => {
52
52
  let obj = { ...args, company: "GLOBAL", outlet: "GLOBAL" }
53
53
  return {
54
54
  ...obj,
55
- setOutlet: outlet => {return {...obj, outlet}},
56
- setCompany: company => {return {...obj, company}},
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
+ }
66
+ }
67
+
68
+ export const customMeta = args => {
69
+ let obj = { ...args }
70
+
71
+ if (obj.company === "GLOBAL")
72
+ delete obj.company
73
+ if (obj.outlet === "GLOBAL")
74
+ delete obj.outlet
75
+
76
+ return {
77
+ ...obj,
78
+ set: (company, outlet) => {
79
+
80
+ if (typeof company !== "string" && !Array.isArray(company))
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()"}
84
+
85
+
86
+ if (!company || (typeof company === "string" && company.trim() === "") || company === "GLOBAL" || (Array.isArray(company) && (!company.length || company.some(item => typeof item !== "string" || item.trim() === "" || item === "GLOBAL")) ))
87
+ throw {message: "Error: Invalid company provided in Dip.customMeta().set()"}
88
+ if (!outlet || (typeof outlet === "string" && outlet.trim() === "") || outlet === "GLOBAL" || (Array.isArray(outlet) && (!outlet.length || outlet.some(item => typeof item !== "string" || item.trim() === "" || item === "GLOBAL")) ))
89
+ throw {message: "Error: Invalid outlet provided in Dip.customMeta().set()"}
90
+
91
+ return {...obj, company, outlet}
92
+ }
57
93
  }
58
94
  }
59
95
 
@@ -190,7 +226,7 @@ function validate_topology(meta, collection, fn_name) {
190
226
 
191
227
  let config = COLLECTIONS_JSON?.[collection]
192
228
  if (!config) {
193
- console.warn(`Warn: Nonexistant config for collection: ${collection}${fn_name ? ` ${fn_name}` : ''}`)
229
+ console.warn(`Warn: Missing config for collection: ${collection}${fn_name ? ` ${fn_name}` : ''}`)
194
230
  return new_meta
195
231
  }
196
232
 
@@ -205,7 +241,7 @@ function validate_topology(meta, collection, fn_name) {
205
241
 
206
242
  if (config.suffix && meta.suffix) {
207
243
  if (!config.suffix[meta.suffix]) {
208
- console.warn(`Warn: Nonexistant suffix config for collection: ${collection} suffix:${meta.suffix}${fn_name ? ` ${fn_name}` : ''}`)
244
+ console.warn(`Warn: Missing suffix config for collection: ${collection} suffix:${meta.suffix}${fn_name ? ` ${fn_name}` : ''}`)
209
245
  return new_meta
210
246
  }
211
247
  check_core_meta(config.suffix[meta.suffix], meta, meta.suffix)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corebasic",
3
3
  "type": "module",
4
- "version": "1.0.191",
4
+ "version": "1.0.193",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "scripts": {