corebasic 1.0.177 → 1.0.179

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 +14 -5
  2. package/package.json +1 -1
package/libs/elabase.js CHANGED
@@ -76,14 +76,14 @@ export function transactionCommit(arg) {
76
76
  isTransaction = false
77
77
  transactions = []
78
78
  return new Promise((resolve, reject) => resolve())
79
- .then(() => execute({ "transaction": txns, mode, stats: arg?.stats ?? false, version: arg?.version, compression: arg?.compression }))
79
+ .then(() => execute({ "transaction": txns, mode, stats: arg?.stats ?? false, version: arg?.version, compression: arg?.compression, size: arg?.size }))
80
80
  .then (result => {
81
81
  Events.send("Elabase.transactionCommit", { response: result })
82
82
  return result
83
83
  })
84
84
  }
85
85
 
86
- export const insert = async (meta, collection, value, _id) => {
86
+ export const insert = async (meta, collection, value, _id, extras) => {
87
87
  if (typeof collection !== "string") throw {message: "Error: collection type is not string in Dip.insert()"}
88
88
  // Multi Company Support
89
89
  if (Utils.isEmpty(meta?.company)) throw {message: "Error: meta argument not provided in Dip.insert()"}
@@ -101,6 +101,7 @@ export const insert = async (meta, collection, value, _id) => {
101
101
  ...(meta.DIP_URL ? {DIP_URL: meta.DIP_URL} : {}),
102
102
  ...(meta.DIP_DB ? {db: meta.DIP_DB} : {}),
103
103
  }
104
+ arg = Object.assign(arg, extras)
104
105
  if (_id)
105
106
  arg._id = _id
106
107
 
@@ -123,7 +124,7 @@ export const insert = async (meta, collection, value, _id) => {
123
124
  })
124
125
  }
125
126
 
126
- export const query = async (meta, collection, query, options) => {
127
+ export const query = async (meta, collection, query, options, extras) => {
127
128
  if (typeof collection !== "string") throw {message: "Error: collection type is not string in Dip.query()"}
128
129
  if (meta?.USE_EMPTY_COMPANY) {
129
130
 
@@ -144,6 +145,7 @@ export const query = async (meta, collection, query, options) => {
144
145
  ...(meta.DIP_URL ? {DIP_URL: meta.DIP_URL} : {}),
145
146
  ...(meta.DIP_DB ? {db: meta.DIP_DB} : {}),
146
147
  }
148
+ arg = Object.assign(arg, extras)
147
149
  if (isTransaction) {
148
150
  transactions.push(arg)
149
151
  return
@@ -171,7 +173,7 @@ function collectionArray(col) {
171
173
  }
172
174
 
173
175
 
174
- export const update = async (meta, collection, query, update, options) => {
176
+ export const update = async (meta, collection, query, update, options, extras) => {
175
177
  // Multi Company Support
176
178
  if (Utils.isEmpty(meta?.company)) throw {message: "Error: meta argument not provided in Dip.update()"}
177
179
  if (typeof collection !== "string") throw {message: "Error: collection type is not string in Dip.update()"}
@@ -202,6 +204,7 @@ export const update = async (meta, collection, query, update, options) => {
202
204
  ...(meta.DIP_URL ? {DIP_URL: meta.DIP_URL} : {}),
203
205
  ...(meta.DIP_DB ? {db: meta.DIP_DB} : {}),
204
206
  }
207
+ arg = Object.assign(arg, extras)
205
208
  if (isTransaction) {
206
209
  transactions.push(arg)
207
210
  return
@@ -215,7 +218,7 @@ export const update = async (meta, collection, query, update, options) => {
215
218
  })
216
219
  }
217
220
 
218
- export const remove = async (meta, collection, query) => {
221
+ export const remove = async (meta, collection, query, extras) => {
219
222
  // Multi Company Support
220
223
  if (Utils.isEmpty(meta?.company)) throw {message: "Error: meta argument not provided in Dip.remove()"}
221
224
  if (typeof collection !== "string") throw {message: "Error: collection type is not string in Dip.remove()"}
@@ -231,6 +234,7 @@ export const remove = async (meta, collection, query) => {
231
234
  ...(meta.DIP_URL ? {DIP_URL: meta.DIP_URL} : {}),
232
235
  ...(meta.DIP_DB ? {db: meta.DIP_DB} : {}),
233
236
  }
237
+ arg = Object.assign(arg, extras)
234
238
  if (isTransaction) {
235
239
  transactions.push(arg)
236
240
  return
@@ -244,6 +248,11 @@ export const remove = async (meta, collection, query) => {
244
248
  })
245
249
  }
246
250
 
251
+ export const close = async (meta, db) => {
252
+ return query(meta, "-", {}, {}, {db: db ?? root.db, close: true})
253
+ }
254
+
255
+
247
256
  export let config = {
248
257
  useDipper: false
249
258
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corebasic",
3
3
  "type": "module",
4
- "version": "1.0.177",
4
+ "version": "1.0.179",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "scripts": {