corebasic 1.0.194 → 1.0.196

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/dip.js CHANGED
@@ -13,6 +13,9 @@ export const batchAbort = Elabase.batchAbort
13
13
  export const batchSubmit = Elabase.batchSubmit
14
14
  export const batch = Elabase.batch
15
15
  export const globalMeta = Elabase.globalMeta
16
+ export const companyMeta = Elabase.companyMeta
17
+ export const outletMeta = Elabase.outletMeta
18
+ export const customMeta = Elabase.customMeta
16
19
 
17
20
  export const shard_stats = Elabase.shard_stats
18
21
  export let config = Elabase.config
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
- let obj = { ...args, company: "GLOBAL", outlet: "GLOBAL" }
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
- export const customMeta = args => {
75
- let obj = { ...args }
76
-
77
- if (obj.company === "GLOBAL")
78
- delete obj.company
79
- if (obj.outlet === "GLOBAL")
80
- delete obj.outlet
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
- ...obj,
84
- set: (company, outlet) => {
69
+ return {...args, company: "GLOBAL", outlet}
70
+ }
85
71
 
86
- if (typeof company !== "string" && !Array.isArray(company))
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
- if (!company || (typeof company === "string" && company.trim() === "") || company === "GLOBAL" || (Array.isArray(company) && (!company.length || company.some(item => typeof item !== "string" || item.trim() === "" || item === "GLOBAL")) ))
93
- throw {message: "Error: Invalid company provided in Dip.customMeta().set()"}
94
- if (!outlet || (typeof outlet === "string" && outlet.trim() === "") || outlet === "GLOBAL" || (Array.isArray(outlet) && (!outlet.length || outlet.some(item => typeof item !== "string" || item.trim() === "" || item === "GLOBAL")) ))
95
- throw {message: "Error: Invalid outlet provided in Dip.customMeta().set()"}
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
- return {...obj, company, outlet}
98
- }
99
- }
84
+ return {...args, company, outlet}
100
85
  }
101
86
 
102
87
  function validate_collection(collection, fn_name) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corebasic",
3
3
  "type": "module",
4
- "version": "1.0.194",
4
+ "version": "1.0.196",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "scripts": {