sqlmath 2022.10.20 → 2022.11.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
@@ -1,9 +1,25 @@
1
1
  # Changelog
2
2
 
3
3
  # Todo
4
- - add dbtable-crud-operations dbtableOpenCsv, dbtableOpenJson
5
4
  - none
6
5
 
6
+ # v2022.11.20
7
+ - ci - auto-update version-number in main mjs-module
8
+ - editor - update codemirror-editor to v5.65.10
9
+ - doc - add api-doc
10
+ - doc - document quickstart-build, quickstart-website
11
+ - sqlmath - bugfix - fix function dbFileImportOrExport() throwing incorrect error
12
+ - chart - improve ergonomics to attach database and import csv/json
13
+ - demo - add hotkeys ctrl-o to open database, ctrl-s to save database
14
+ - demo - streamline charts sector, subsector, stock into single logic
15
+ - sqlmath - remove unused sqlite-extensions carray, csv from file sqlite3_ext.c
16
+ - chart - add chart-options xstep, ystep
17
+ - ci - update to nodejs v18
18
+ - chart - redesign tooltip
19
+ - chart - add xvalueConvert option juliandayToDate
20
+ - chart - add dbtable-crud-operations dbtableImportCsv, dbtableImportJson
21
+ - chart - add intraday, 1-min chart
22
+
7
23
  # v2022.10.20
8
24
  - demo - add chart tradebot_historical_backtrack
9
25
  - chart - allow hiding series by clicking it in plot-area
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
  # Status
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) |
5
+ | Branch | [master<br>(v2022.11.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) |
@@ -15,11 +15,20 @@
15
15
 
16
16
  1. [Web Demo](#web-demo)
17
17
 
18
- 2. [Package Listing](#package-listing)
18
+ 2. [Quickstart Build](#quickstart-build)
19
+ - [To build sqlmath:](#to-build-sqlmath)
19
20
 
20
- 3. [Changelog](#changelog)
21
+ 3. [Quickstart Website](#quickstart-website)
22
+ - [To serve your own sqlmath website:](#to-serve-your-own-sqlmath-website)
21
23
 
22
- 4. [License](#license)
24
+ 4. [Documentation](#documentation)
25
+ - [API Doc](#api-doc)
26
+
27
+ 5. [Package Listing](#package-listing)
28
+
29
+ 6. [Changelog](#changelog)
30
+
31
+ 7. [License](#license)
23
32
 
24
33
 
25
34
  <br><br>
@@ -29,6 +38,54 @@
29
38
  [![screenshot](https://sqlmath.github.io/sqlmath/branch-beta/.artifact/screenshot_browser__2fsqlmath_2fbranch-beta_2findex.html.png)](https://sqlmath.github.io/sqlmath/index.html)
30
39
 
31
40
 
41
+ <br><br>
42
+ # Quickstart Build
43
+
44
+
45
+ <br><br>
46
+ ### To build sqlmath:
47
+ ```shell
48
+ #!/bin/sh
49
+
50
+ # git clone sqlmath repo
51
+ git clone https://github.com/sqlmath/sqlmath --branch=beta --single-branch
52
+ cd sqlmath
53
+
54
+ # build nodejs binary ./_binary_sqlmath_napi8_xxx_x64.node
55
+ npm run test2
56
+
57
+ # build webassembly binary ./sqlmath_wasm.wasm
58
+ sh jslint_ci.sh shCiBuildWasm
59
+ ```
60
+
61
+
62
+ <br><br>
63
+ # Quickstart Website
64
+
65
+
66
+ <br><br>
67
+ ### To serve your own sqlmath website:
68
+ ```shell
69
+ #!/bin/sh
70
+
71
+ # cd <sqlmath repo>
72
+
73
+ # serve website at http://localhost:8080/index.html
74
+ PORT=8080 sh jslint_ci.sh shHttpFileServer
75
+ ```
76
+
77
+
78
+ <br><br>
79
+ # Documentation
80
+
81
+
82
+ <br><br>
83
+ ### API Doc
84
+ - https://sqlmath.github.io/sqlmath/apidoc.html
85
+
86
+ [![screenshot](https://sqlmath.github.io/sqlmath/branch-beta/.artifact/screenshot_browser__2f.artifact_2fapidoc.html.png)](https://sqlmath.github.io/sqlmath/apidoc.html)
87
+
88
+
32
89
  <br><br>
33
90
  # Package Listing
34
91
  ![screenshot_package_listing.svg](https://sqlmath.github.io/sqlmath/branch-beta/.artifact/screenshot_package_listing.svg)
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.20";
168
+ let jslint_edition = "v2022.12.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.
@@ -2038,13 +2038,6 @@ async function jslint_cli({
2038
2038
  return;
2039
2039
  }
2040
2040
 
2041
- // PR-349 - Detect cli-option --mode-vim-plugin.
2042
-
2043
- mode_wrapper_vim = (
2044
- process_argv.slice(2).indexOf("--mode-vim-plugin") >= 0
2045
- || mode_wrapper_vim
2046
- );
2047
-
2048
2041
  // Normalize file relative to process.cwd().
2049
2042
 
2050
2043
  process_argv.slice(2).some(function (arg) {
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.10.20"
40
+ "version": "2022.11.20"
41
41
  }
package/sqlmath.mjs CHANGED
@@ -87,6 +87,7 @@ let debugInline = (function () {
87
87
  let sqlMessageDict = {}; // dict of web-worker-callbacks
88
88
  let sqlMessageId = 0;
89
89
  let sqlWorker;
90
+ let version = "v2022.11.20";
90
91
 
91
92
  function assertJsonEqual(aa, bb, message) {
92
93
 
@@ -110,7 +111,7 @@ function assertJsonEqual(aa, bb, message) {
110
111
 
111
112
  function assertNumericalEqual(aa, bb, message) {
112
113
 
113
- // This function will assert aa - bb <= Number.EPSILON
114
+ // This function will assert aa - bb <= Number.EPSILON.
114
115
 
115
116
  assertOrThrow(aa, "value cannot be 0 or falsy");
116
117
  if (!(Math.abs((aa - bb) / Math.max(aa, bb)) <= 256 * Number.EPSILON)) {
@@ -138,8 +139,10 @@ function assertOrThrow(condition, message) {
138
139
  }
139
140
 
140
141
  async function cCallAsync(baton, cFuncName, ...argList) {
141
- // this function will serialize <argList> to a c <baton>,
142
- // suitable for passing into napi
142
+
143
+ // This function will serialize <argList> to a c <baton>,
144
+ // suitable for passing into napi.
145
+
143
146
  let argi = 0;
144
147
  let errStack;
145
148
  assertOrThrow(
@@ -227,7 +230,9 @@ async function cCallAsync(baton, cFuncName, ...argList) {
227
230
  }
228
231
 
229
232
  function dbCallAsync(baton, cFuncName, db, ...argList) {
230
- // this function will call <cFuncName> using db <argList>[0]
233
+
234
+ // This function will call <cFuncName> using db <argList>[0].
235
+
231
236
  let __db = dbDeref(db);
232
237
  // increment __db.busy
233
238
  __db.busy += 1;
@@ -246,7 +251,9 @@ function dbCallAsync(baton, cFuncName, db, ...argList) {
246
251
  async function dbCloseAsync({
247
252
  db
248
253
  }) {
249
- // this function will close sqlite-database-connection <db>
254
+
255
+ // This function will close sqlite-database-connection <db>.
256
+
250
257
  let __db = dbDeref(db);
251
258
  // prevent segfault - do not close db if actions are pending
252
259
  assertOrThrow(
@@ -268,7 +275,9 @@ async function dbCloseAsync({
268
275
  }
269
276
 
270
277
  function dbDeref(db) {
271
- // this function will get private-object mapped to <db>
278
+
279
+ // This function will get private-object mapped to <db>.
280
+
272
281
  let __db = dbDict.get(db);
273
282
  assertOrThrow(__db?.connPool[0] > 0, "invalid or closed db");
274
283
  assertOrThrow(__db.busy >= 0, "invalid db.busy " + __db.busy);
@@ -283,8 +292,10 @@ function dbExecAndReturnLastBlobAsync({
283
292
  db,
284
293
  sql
285
294
  }) {
286
- // this function will exec <sql> in <db> and return last value retrieved
287
- // from execution as raw blob/buffer
295
+
296
+ // This function will exec <sql> in <db> and return last value retrieved
297
+ // from execution as raw blob/buffer.
298
+
288
299
  return dbExecAsync({
289
300
  bindList,
290
301
  db,
@@ -300,7 +311,9 @@ async function dbExecAsync({
300
311
  responseType,
301
312
  sql
302
313
  }) {
303
- // this function will exec <sql> in <db> and return <result>
314
+
315
+ // This function will exec <sql> in <db> and return <result>.
316
+
304
317
  let baton;
305
318
  let bindByKey;
306
319
  let bindListLength;
@@ -394,9 +407,15 @@ async function dbFileExportAsync({
394
407
  db,
395
408
  dbData,
396
409
  filename,
397
- modeExport = 1
410
+ modeExport = 1,
411
+ modeNoop
398
412
  }) {
399
- // This function will export <db> to <filename>
413
+
414
+ // This function will export <db> to <filename>.
415
+
416
+ if (modeNoop) {
417
+ return;
418
+ }
400
419
  if (IS_BROWSER) {
401
420
  filename = FILENAME_DBTMP;
402
421
  }
@@ -420,7 +439,9 @@ async function dbFileImportAsync({
420
439
  dbData,
421
440
  filename
422
441
  }) {
423
- // This function will import <filename> to <db>
442
+
443
+ // This function will import <filename> to <db>.
444
+
424
445
  await dbFileExportAsync({
425
446
  db,
426
447
  dbData,
@@ -430,7 +451,9 @@ async function dbFileImportAsync({
430
451
  }
431
452
 
432
453
  async function dbNoopAsync(...argList) {
433
- // this function will do nothing except return argList
454
+
455
+ // This function will do nothing except return argList.
456
+
434
457
  return await cCallAsync(undefined, "_dbNoop", ...argList);
435
458
  }
436
459
 
@@ -441,7 +464,9 @@ async function dbOpenAsync({
441
464
  flags,
442
465
  threadCount = 1
443
466
  }) {
444
- // this function will open and return sqlite-database-connection <db>
467
+
468
+ // This function will open and return sqlite-database-connection <db>.
469
+
445
470
  // int sqlite3_open_v2(
446
471
  // const char *filename, /* Database filename (UTF-8) */
447
472
  // sqlite3 **ppDb, /* OUT: SQLite db handle */
@@ -498,7 +523,9 @@ async function dbOpenAsync({
498
523
  }
499
524
 
500
525
  function isExternalBuffer(buf) {
501
- // this function will check if <buf> is ArrayBuffer or SharedArrayBuffer
526
+
527
+ // This function will check if <buf> is ArrayBuffer or SharedArrayBuffer.
528
+
502
529
  return buf && (
503
530
  buf.constructor === ArrayBuffer
504
531
  || (
@@ -509,7 +536,9 @@ function isExternalBuffer(buf) {
509
536
  }
510
537
 
511
538
  function jsbatonCreate() {
512
- // this function will create buffer <baton>
539
+
540
+ // This function will create buffer <baton>.
541
+
513
542
  let baton = new DataView(new ArrayBuffer(1024));
514
543
  // offset nalloc, nused
515
544
  baton.setInt32(4, SQLITE_DATATYPE_OFFSET, true);
@@ -522,7 +551,9 @@ function jsbatonValuePush({
522
551
  externalbufferList,
523
552
  value
524
553
  }) {
525
- // this function will push <value> to buffer <baton>
554
+
555
+ // This function will push <value> to buffer <baton>.
556
+
526
557
  let nn;
527
558
  let nused;
528
559
  let tmp;
@@ -737,7 +768,9 @@ function jsbatonValueString({
737
768
  argi,
738
769
  baton
739
770
  }) {
740
- // this function will return string-value from <baton> at given <offset>
771
+
772
+ // This function will return string-value from <baton> at given <offset>.
773
+
741
774
  let offset = baton.getInt32(4 + 4 + argi * 8, true);
742
775
  return new TextDecoder().decode(new Uint8Array(
743
776
  baton.buffer,
@@ -780,7 +813,7 @@ function objectDeepCopyWithKeysSorted(obj) {
780
813
 
781
814
  async function sqlMessagePost(baton, cFuncName, ...argList) {
782
815
 
783
- // This function will post msg to <sqlWorker> and return result
816
+ // This function will post msg to <sqlWorker> and return result.
784
817
 
785
818
  let errStack;
786
819
  let id;
@@ -832,12 +865,17 @@ async function sqlMessagePost(baton, cFuncName, ...argList) {
832
865
  }
833
866
 
834
867
  async function sqlmathInit() {
868
+
869
+ // This function will init sqlmath.
870
+
835
871
  dbFinalizationRegistry = new FinalizationRegistry(function ({
836
872
  afterFinalization,
837
873
  ptr
838
874
  }) {
875
+
839
876
  // This function will auto-close any open sqlite3-db-pointer,
840
- // after its js-wrapper has been garbage-collected
877
+ // after its js-wrapper has been garbage-collected.
878
+
841
879
  cCallAsync(undefined, "_dbClose", ptr[0]);
842
880
  if (afterFinalization) {
843
881
  afterFinalization();
@@ -871,6 +909,8 @@ function sqlmathWebworkerInit({
871
909
  modeTest
872
910
  }) {
873
911
 
912
+ // This function will init sqlmath web-worker.
913
+
874
914
  // Feature-detect browser.
875
915
 
876
916
  let Worker = globalThis.Worker;
@@ -947,5 +987,6 @@ export {
947
987
  noop,
948
988
  objectDeepCopyWithKeysSorted,
949
989
  sqlmathInit,
950
- sqlmathWebworkerInit
990
+ sqlmathWebworkerInit,
991
+ version
951
992
  };