sqlmath 2023.1.29 → 2023.3.21

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/CHANGELOG.md CHANGED
@@ -3,6 +3,21 @@
3
3
  # Todo
4
4
  - none
5
5
 
6
+ # v2023.3.21
7
+ - sqlmath - move c-function str99JsonAppendText() from file sqlmath_base.c to sqlite3.c
8
+ - sqlmath - merge file sqlite3_ext.c into sqlite3.c
9
+ - sqlmath - streamline str99 c-code
10
+ - sqlmath - add sql-functions jenks_concat(kk, col1, col2, ...), jenks_json(kk, jsonArray)
11
+ - chart - bugfix - fix special-character in col-name being sql-injected
12
+
13
+ # v2023.2.26
14
+ - chart - bugfix - use spy for reference previous-ydate instead of 1a_mybot
15
+ - sqlmath - add functions dbExecAndReturnLastJsonAsync(), dbExecAndReturnLastTextAsync()
16
+ - sqlmath - add sql-functions jfromfloat64array(), jtofloat64array()
17
+ - sqlite - update to sqlite v3.39.4
18
+ - ci - replace shell-function shGithubPushBackupAndSquash() with simplified shGitCommitPushOrSquash()
19
+ - ci - in windows-ci-env, alias node=node.exe instead of using winpty for pipes
20
+
6
21
  # v2023.1.29
7
22
  - ci - add auto-logo-creation in private repo
8
23
  - ci - auto-create asset_image_logo_512.png from asset_image_logo_512.html
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
  # Status
5
- | Branch | [master<br>(v2023.1.29)](https://github.com/sqlmath/sqlmath/tree/master) | [beta<br>(Web Demo)](https://github.com/sqlmath/sqlmath/tree/beta) | [alpha<br>(Development)](https://github.com/sqlmath/sqlmath/tree/alpha) |
5
+ | Branch | [master<br>(v2023.3.21)](https://github.com/sqlmath/sqlmath/tree/master) | [beta<br>(Web Demo)](https://github.com/sqlmath/sqlmath/tree/beta) | [alpha<br>(Development)](https://github.com/sqlmath/sqlmath/tree/alpha) |
6
6
  |--:|:--:|:--:|:--:|
7
7
  | CI | [![ci](https://github.com/sqlmath/sqlmath/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/sqlmath/sqlmath/actions?query=branch%3Amaster) | [![ci](https://github.com/sqlmath/sqlmath/actions/workflows/ci.yml/badge.svg?branch=beta)](https://github.com/sqlmath/sqlmath/actions?query=branch%3Abeta) | [![ci](https://github.com/sqlmath/sqlmath/actions/workflows/ci.yml/badge.svg?branch=alpha)](https://github.com/sqlmath/sqlmath/actions?query=branch%3Aalpha) |
8
8
  | Coverage | [![coverage](https://sqlmath.github.io/sqlmath/branch-master/.artifact/coverage/coverage_badge.svg)](https://sqlmath.github.io/sqlmath/branch-master/.artifact/coverage/index.html) | [![coverage](https://sqlmath.github.io/sqlmath/branch-beta/.artifact/coverage/coverage_badge.svg)](https://sqlmath.github.io/sqlmath/branch-beta/.artifact/coverage/index.html) | [![coverage](https://sqlmath.github.io/sqlmath/branch-alpha/.artifact/coverage/coverage_badge.svg)](https://sqlmath.github.io/sqlmath/branch-alpha/.artifact/coverage/index.html) |
Binary file
Binary file
Binary file
package/jslint.mjs CHANGED
@@ -165,7 +165,7 @@ let jslint_charset_ascii = (
165
165
  + "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
166
166
  + "`abcdefghijklmnopqrstuvwxyz{|}~\u007f"
167
167
  );
168
- let jslint_edition = "v2023.1.1-beta";
168
+ let jslint_edition = "v2022.3.1-beta";
169
169
  let jslint_export; // The jslint object to be exported.
170
170
  let jslint_fudge = 1; // Fudge starting line and starting
171
171
  // ... column to 1.
@@ -11236,25 +11236,27 @@ function sentinel() {}
11236
11236
  }
11237
11237
  }));
11238
11238
  exitCode = await new Promise(function (resolve) {
11239
- moduleChildProcess.spawn((
11240
- processArgv[0] === "npm"
11239
+ moduleChildProcess.spawn(
11240
+ (
11241
+ processArgv[0] === "npm"
11241
11242
 
11242
11243
  // If win32 environment, then replace program npm with npm.cmd.
11243
11244
  // Coverage-hack - Ugly-hack to get test-coverage under both win32 and linux.
11244
11245
 
11245
- ? process.platform.replace("win32", "npm.cmd").replace(
11246
- process.platform,
11247
- "npm"
11248
- )
11249
- : processArgv[0]
11250
- ), processArgv.slice(1), {
11251
- env: Object.assign({}, process.env, {
11252
- NODE_V8_COVERAGE: coverageDir
11253
- }),
11254
- stdio: [
11255
- "ignore", 1, 2
11256
- ]
11257
- }).on("exit", resolve);
11246
+ ? process.platform.replace("win32", "npm.cmd").replace(
11247
+ process.platform,
11248
+ "npm"
11249
+ )
11250
+ : processArgv[0]
11251
+ ),
11252
+ processArgv.slice(1),
11253
+ {
11254
+ env: Object.assign({}, process.env, {
11255
+ NODE_V8_COVERAGE: coverageDir
11256
+ }),
11257
+ stdio: ["ignore", 1, 2]
11258
+ }
11259
+ ).on("exit", resolve);
11258
11260
  });
11259
11261
  }
11260
11262
 
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "engines": {
12
12
  "node": ">=14"
13
13
  },
14
- "fileCount": 33,
14
+ "fileCount": 32,
15
15
  "homepage": "https://github.com/sqlmath/sqlmath",
16
16
  "keywords": [
17
17
  "data-science",
@@ -38,5 +38,5 @@
38
38
  },
39
39
  "shCiArtifactUpload": 1,
40
40
  "shCiNpmPublish": 1,
41
- "version": "2023.1.29"
41
+ "version": "2023.3.21"
42
42
  }
package/sqlmath.mjs CHANGED
@@ -29,15 +29,13 @@ let FILENAME_DBTMP = "/tmp/__dbtmp1";
29
29
  let IS_BROWSER;
30
30
  let JSBATON_ARGC = 16;
31
31
  let SQLITE_DATATYPE_BLOB = 0x04;
32
- // let SQLITE_DATATYPE_BLOB_0 = 0x14;
33
- let SQLITE_DATATYPE_EXTERNALBUFFER = -0x01;
34
32
  let SQLITE_DATATYPE_FLOAT = 0x02;
35
- // let SQLITE_DATATYPE_FLOAT_0 = 0x12;
36
33
  let SQLITE_DATATYPE_INTEGER = 0x01;
37
34
  let SQLITE_DATATYPE_INTEGER_0 = 0x11;
38
35
  let SQLITE_DATATYPE_INTEGER_1 = 0x21;
39
36
  let SQLITE_DATATYPE_NULL = 0x05;
40
37
  let SQLITE_DATATYPE_OFFSET = 768;
38
+ let SQLITE_DATATYPE_SHAREDARRAYBUFFER = 0x71;
41
39
  let SQLITE_DATATYPE_TEXT = 0x03;
42
40
  let SQLITE_DATATYPE_TEXT_0 = 0x13;
43
41
  let SQLITE_MAX_LENGTH2 = 1_000_000_000;
@@ -87,7 +85,7 @@ let debugInline = (function () {
87
85
  let sqlMessageDict = {}; // dict of web-worker-callbacks
88
86
  let sqlMessageId = 0;
89
87
  let sqlWorker;
90
- let version = "v2023.1.29";
88
+ let version = "v2023.3.21";
91
89
 
92
90
  function assertJsonEqual(aa, bb, message) {
93
91
 
@@ -304,6 +302,26 @@ function dbExecAndReturnLastBlobAsync({
304
302
  });
305
303
  }
306
304
 
305
+ async function dbExecAndReturnLastJsonAsync(option) {
306
+
307
+ // This function will exec <sql> in <db> and return last value retrieved
308
+ // from execution as raw text.
309
+
310
+ return JSON.parse(
311
+ await dbExecAndReturnLastTextAsync(option)
312
+ );
313
+ }
314
+
315
+ async function dbExecAndReturnLastTextAsync(option) {
316
+
317
+ // This function will exec <sql> in <db> and return last value retrieved
318
+ // from execution as raw text.
319
+
320
+ return new TextDecoder().decode(
321
+ await dbExecAndReturnLastBlobAsync(option)
322
+ );
323
+ }
324
+
307
325
  async function dbExecAsync({
308
326
  bindList = [],
309
327
  db,
@@ -337,7 +355,7 @@ async function dbExecAsync({
337
355
  );
338
356
  modeRetry -= 1;
339
357
  await new Promise(function (resolve) {
340
- setTimeout(resolve, 50);
358
+ setTimeout(resolve, 5_000 * !process.env.npm_config_mode_test);
341
359
  });
342
360
  }
343
361
  }
@@ -561,14 +579,13 @@ function jsbatonValuePush({
561
579
  let vtype;
562
580
  /*
563
581
  #define SQLITE_DATATYPE_BLOB 0x04
564
- // #define SQLITE_DATATYPE_BLOB_0 0x14
565
582
  #define SQLITE_DATATYPE_FLOAT 0x02
566
- // #define SQLITE_DATATYPE_FLOAT_0 0x12
567
583
  #define SQLITE_DATATYPE_INTEGER 0x01
568
584
  #define SQLITE_DATATYPE_INTEGER_0 0x11
569
585
  #define SQLITE_DATATYPE_INTEGER_1 0x21
570
586
  #define SQLITE_DATATYPE_NULL 0x05
571
- #define SQLITE_DATATYPE_EXTERNALBUFFER -0x01
587
+ #define SQLITE_DATATYPE_OFFSET 768
588
+ #define SQLITE_DATATYPE_SHAREDARRAYBUFFER 0x71
572
589
  #define SQLITE_DATATYPE_TEXT 0x03
573
590
  #define SQLITE_DATATYPE_TEXT_0 0x13
574
591
  // 1. false.bigint
@@ -655,7 +672,7 @@ function jsbatonValuePush({
655
672
  "externalbufferList.length must be less than 8"
656
673
  );
657
674
  externalbufferList.push(new DataView(value));
658
- vtype = SQLITE_DATATYPE_EXTERNALBUFFER;
675
+ vtype = SQLITE_DATATYPE_SHAREDARRAYBUFFER;
659
676
  vsize = 4;
660
677
  break;
661
678
  }
@@ -732,18 +749,6 @@ function jsbatonValuePush({
732
749
  vsize
733
750
  ).set(new Uint8Array(value.buffer, value.byteOffset, vsize), 0);
734
751
  break;
735
- case SQLITE_DATATYPE_EXTERNALBUFFER:
736
- vsize = value.byteLength;
737
- // push vsize
738
- assertOrThrow(
739
- 0 <= vsize && vsize <= 1_000_000_000,
740
- (
741
- "sqlite-blob byte-length must be within inclusive-range"
742
- + " 0 to 1,000,000,000"
743
- )
744
- );
745
- baton.setInt32(nused + 1, vsize, true);
746
- break;
747
752
  case SQLITE_DATATYPE_FLOAT:
748
753
  baton.setFloat64(nused + 1, value, true);
749
754
  break;
@@ -760,6 +765,18 @@ function jsbatonValuePush({
760
765
  );
761
766
  baton.setBigInt64(nused + 1, value, true);
762
767
  break;
768
+ case SQLITE_DATATYPE_SHAREDARRAYBUFFER:
769
+ vsize = value.byteLength;
770
+ // push vsize
771
+ assertOrThrow(
772
+ 0 <= vsize && vsize <= 1_000_000_000,
773
+ (
774
+ "sqlite-blob byte-length must be within inclusive-range"
775
+ + " 0 to 1,000,000,000"
776
+ )
777
+ );
778
+ baton.setInt32(nused + 1, vsize, true);
779
+ break;
763
780
  }
764
781
  return baton;
765
782
  }
@@ -977,6 +994,8 @@ export {
977
994
  assertOrThrow,
978
995
  dbCloseAsync,
979
996
  dbExecAndReturnLastBlobAsync,
997
+ dbExecAndReturnLastJsonAsync,
998
+ dbExecAndReturnLastTextAsync,
980
999
  dbExecAsync,
981
1000
  dbFileExportAsync,
982
1001
  dbFileImportAsync,