sqlmath 2022.9.20 → 2022.10.20

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
@@ -4,6 +4,13 @@
4
4
  - add dbtable-crud-operations dbtableOpenCsv, dbtableOpenJson
5
5
  - none
6
6
 
7
+ # v2022.10.20
8
+ - demo - add chart tradebot_historical_backtrack
9
+ - chart - allow hiding series by clicking it in plot-area
10
+ - coverage - add test-coverage for function sqlmathWebworkerInit()
11
+ - chart - use different color for category - short
12
+ - sqlmath - re-enable sql-function squared()
13
+
7
14
  # v2022.9.20
8
15
  - sqlmath - bugfix - handle null seriesList, xlabelList, xdata, ydata
9
16
  - sqlmath - revamp str99 with sqlite3_str
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
  # Status
5
- | Branch | [master<br>(v2022.9.20)](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>(v2022.10.20)](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 = "v2022.9.1-beta";
168
+ let jslint_edition = "v2022.9.20";
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.
package/package.json CHANGED
@@ -37,5 +37,5 @@
37
37
  "test2": "sh jslint_ci.sh shCiBase",
38
38
  "test_win32": "node -e \"require('child_process').spawn('C:\\\\Program Files\\\\Git\\\\bin\\\\bash.exe',['-c','npm run test' + ' ' + process.argv.slice(1).join(' ')],{stdio:['ignore',1,2]});\""
39
39
  },
40
- "version": "2022.9.20"
40
+ "version": "2022.10.20"
41
41
  }
package/sqlmath.mjs CHANGED
@@ -439,7 +439,6 @@ async function dbOpenAsync({
439
439
  dbData,
440
440
  filename,
441
441
  flags,
442
- rawPtr,
443
442
  threadCount = 1
444
443
  }) {
445
444
  // this function will open and return sqlite-database-connection <db>
@@ -461,16 +460,10 @@ async function dbOpenAsync({
461
460
  !dbData || isExternalBuffer(dbData),
462
461
  "dbData must be ArrayBuffer"
463
462
  );
464
- if (rawPtr) {
465
- rawPtr = [
466
- BigInt(rawPtr)
467
- ];
468
- threadCount = 1;
469
- }
470
463
  connPool = await Promise.all(Array.from(new Array(
471
464
  threadCount
472
465
  ), async function () {
473
- let ptr = rawPtr || await cCallAsync(
466
+ let ptr = await cCallAsync(
474
467
  undefined,
475
468
  "_dbOpen",
476
469
  // 0. const char *filename, Database filename (UTF-8)
@@ -486,7 +479,7 @@ async function dbOpenAsync({
486
479
  // 4. wasm-only - arraybuffer of raw sqlite-database to open in wasm
487
480
  dbData
488
481
  );
489
- ptr = rawPtr || [
482
+ ptr = [
490
483
  ptr[0].getBigInt64(4 + 4, true)
491
484
  ];
492
485
  dbFinalizationRegistry.register(db, {
@@ -824,7 +817,7 @@ async function sqlMessagePost(baton, cFuncName, ...argList) {
824
817
  delete sqlMessageDict[id];
825
818
  // debug slow postMessage
826
819
  timeElapsed = Date.now() - timeElapsed;
827
- if (timeElapsed > 500) {
820
+ if (timeElapsed > 500 || cFuncName === "testTimeElapsed") {
828
821
  consoleError(
829
822
  "sqlMessagePost - " + JSON.stringify({
830
823
  cFuncName,
@@ -874,19 +867,44 @@ async function sqlmathInit() {
874
867
  }
875
868
 
876
869
  function sqlmathWebworkerInit({
877
- Worker
870
+ db,
871
+ modeTest
878
872
  }) {
879
873
 
880
874
  // Feature-detect browser.
881
875
 
876
+ let Worker = globalThis.Worker;
882
877
  IS_BROWSER = true;
883
- Worker = Worker || globalThis.Worker;
878
+ if (modeTest) {
879
+ Worker = function () {
880
+ return;
881
+ };
882
+ }
884
883
  sqlWorker = new Worker("sqlmath_wasm.js");
885
884
  sqlWorker.onmessage = function ({
886
885
  data
887
886
  }) {
888
887
  sqlMessageDict[data.id](data);
889
888
  };
889
+ if (modeTest) {
890
+ sqlWorker.postMessage = function (data) {
891
+ setTimeout(function () {
892
+ sqlWorker.onmessage({
893
+ data
894
+ });
895
+ });
896
+ };
897
+ // test cCallAsync handling-behavior
898
+ cCallAsync(undefined, "testTimeElapsed", true);
899
+ // test dbFileExportAsync handling-behavior
900
+ dbFileExportAsync({
901
+ db,
902
+ filename: "aa",
903
+ modeTest
904
+ });
905
+ // revert IS_BROWSER
906
+ IS_BROWSER = undefined;
907
+ }
890
908
  }
891
909
 
892
910
  await sqlmathInit({});