@xuda.io/xuda-dbs-plugin-xuda 1.0.30 → 1.0.32

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/package.json +3 -2
  2. package/server.js +19 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-dbs-plugin-xuda",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "description": "Xuda Database Socket for Xuda's proprietary structure powered by CouchDB",
5
5
  "scripts": {
6
6
  "pub": "npm version patch --force && npm publish --access public"
@@ -16,6 +16,7 @@
16
16
  "svg_icon": "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" width=\"24px\" height=\"24px\" viewBox=\"0 0 256 256\" strokeWidth={1.5} stroke=\"currentColor\" className=\"w-6 h-6\"><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125\" /></svg>",
17
17
  "dependencies": {
18
18
  "nano": "^10.1.0",
19
- "lodash": "^4.17.21"
19
+ "lodash": "^4.17.21",
20
+ "@xuda.io/xu_cast": "latest"
20
21
  }
21
22
  }
package/server.js CHANGED
@@ -170,6 +170,25 @@ const find_item_by_key = function (arr, key, val) {
170
170
  });
171
171
  };
172
172
 
173
+ const get_cast_val = async function (source, attributeP, typeP, valP) {
174
+ const module = await import(
175
+ "https://dist.xuda.io/runtime/js/modules/xuda-get-cast-util-module.mjs"
176
+ );
177
+
178
+ return module.cast(
179
+ typeP,
180
+ valP,
181
+ function (res) {
182
+ var msg = `error converting ${attributeP} from ${valP} to ${typeP}`;
183
+ console.error(source, msg);
184
+ },
185
+ function (res) {
186
+ var msg = `type mismatch auto conversion made to ${attributeP} from value ${valP} to ${typeP}`;
187
+ console.warn(source, msg);
188
+ }
189
+ );
190
+ };
191
+
173
192
  exports.create = async (params, setup_doc, resolve, reject) => {
174
193
  const e = params.e;
175
194
  const db = params.db;