zeed 1.4.0 → 1.8.0
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/dist/{args-FLoL3OKJ.d.cts → args-CEjib9V9.d.mts} +1 -1
- package/dist/{args-WC9q5kz2.d.mts → args-DEig-jw4.d.cts} +1 -1
- package/dist/{clipboard-BkUO-syY.d.mts → clipboard-BusqmLLY.d.cts} +1 -1
- package/dist/{clipboard-Cfpr331X.d.cts → clipboard-DcuuFRwa.d.mts} +1 -1
- package/dist/common/exec/index.d.cts +2 -2
- package/dist/common/exec/index.d.mts +2 -2
- package/dist/common/exec/promise.d.cts +1 -1
- package/dist/common/exec/promise.d.mts +1 -1
- package/dist/common/exec/throttle-debounce.d.cts +1 -1
- package/dist/common/exec/throttle-debounce.d.mts +1 -1
- package/dist/common/index.cjs +21 -0
- package/dist/common/index.d.cts +14 -11
- package/dist/common/index.d.mts +15 -12
- package/dist/common/index.mjs +4 -1
- package/dist/common/msg/rpc.cjs +8 -8
- package/dist/common/msg/rpc.cjs.map +1 -1
- package/dist/common/msg/rpc.mjs +8 -8
- package/dist/common/msg/rpc.mjs.map +1 -1
- package/dist/common/schema/export-json-schema.cjs +40 -31
- package/dist/common/schema/export-json-schema.cjs.map +1 -1
- package/dist/common/schema/export-json-schema.mjs +40 -31
- package/dist/common/schema/export-json-schema.mjs.map +1 -1
- package/dist/common/schema/index.cjs +21 -0
- package/dist/common/schema/index.d.cts +6 -3
- package/dist/common/schema/index.d.mts +7 -4
- package/dist/common/schema/index.mjs +4 -1
- package/dist/common/schema/sql/expr.cjs +128 -0
- package/dist/common/schema/sql/expr.cjs.map +1 -0
- package/dist/common/schema/sql/expr.d.cts +2 -0
- package/dist/common/schema/sql/expr.d.mts +2 -0
- package/dist/common/schema/sql/expr.mjs +115 -0
- package/dist/common/schema/sql/expr.mjs.map +1 -0
- package/dist/common/schema/sql/index.cjs +23 -0
- package/dist/common/schema/sql/index.d.cts +4 -0
- package/dist/common/schema/sql/index.d.mts +4 -0
- package/dist/common/schema/sql/index.mjs +5 -0
- package/dist/common/schema/sql/select.cjs +143 -0
- package/dist/common/schema/sql/select.cjs.map +1 -0
- package/dist/common/schema/sql/select.d.cts +2 -0
- package/dist/common/schema/sql/select.d.mts +2 -0
- package/dist/common/schema/sql/select.mjs +139 -0
- package/dist/common/schema/sql/select.mjs.map +1 -0
- package/dist/common/schema/sql/table.cjs +23 -0
- package/dist/common/schema/sql/table.cjs.map +1 -0
- package/dist/common/schema/sql/table.d.cts +2 -0
- package/dist/common/schema/sql/table.d.mts +2 -0
- package/dist/common/schema/sql/table.mjs +20 -0
- package/dist/common/schema/sql/table.mjs.map +1 -0
- package/dist/common/schema/type-test.d.cts +1 -1
- package/dist/common/schema/type-test.d.mts +1 -1
- package/dist/common/schema/utils.d.cts +1 -1
- package/dist/common/schema/utils.d.mts +1 -1
- package/dist/common/schema/z.d.mts +1 -1
- package/dist/common/storage/index.d.cts +1 -1
- package/dist/common/storage/index.d.mts +1 -1
- package/dist/common/storage/memstorage.d.cts +1 -1
- package/dist/common/storage/memstorage.d.mts +1 -1
- package/dist/common/test.d.cts +1 -1
- package/dist/common/test.d.mts +1 -1
- package/dist/common/time.d.cts +1 -1
- package/dist/common/time.d.mts +1 -1
- package/dist/common/timeout.d.cts +1 -1
- package/dist/common/timeout.d.mts +1 -1
- package/dist/common/utils.d.cts +1 -1
- package/dist/common/utils.d.mts +1 -1
- package/dist/common/uuid.d.cts +1 -1
- package/dist/common/uuid.d.mts +1 -1
- package/dist/{crypto-CyTV7Qce.d.cts → crypto-D68rVmvU.d.mts} +1 -1
- package/dist/{crypto-LT7EC5_d.d.mts → crypto-KzGHoCJE.d.cts} +1 -1
- package/dist/{env-B3vOiVY8.d.cts → env-BJXdwBKq.d.mts} +1 -1
- package/dist/{env-C3npYe8w.d.mts → env-HsOnA_yK.d.cts} +1 -1
- package/dist/expr-CCKrqOw1.d.mts +25 -0
- package/dist/expr-yYgSeBZ3.d.cts +25 -0
- package/dist/{files-CDNKX9VI.d.mts → files-4O-PxnAC.d.cts} +1 -1
- package/dist/{files-DdI9UZvg.d.cts → files-BlpxqSTT.d.mts} +1 -1
- package/dist/{files-async-1V0bu_ca.d.cts → files-async-DFLC-Nkd.d.cts} +1 -1
- package/dist/{files-async-cBMkRwsu.d.mts → files-async-DfuEEDjH.d.mts} +1 -1
- package/dist/{filestorage-CXQ9MzeW.d.cts → filestorage-BjeBZEAs.d.cts} +1 -1
- package/dist/{filestorage-YzM2z9sU.d.mts → filestorage-CmfztpWm.d.mts} +1 -1
- package/dist/{fs-DHJ9AqUk.d.cts → fs-D837bjRT.d.cts} +1 -1
- package/dist/{fs-DgjZdpuF.d.mts → fs-DlYLapik.d.mts} +1 -1
- package/dist/{glob-Bfs7ZS_i.d.mts → glob-5yW09dkR.d.mts} +1 -1
- package/dist/{glob-Bt150jOY.d.cts → glob-CZaZPqiy.d.cts} +1 -1
- package/dist/index.all.cjs +21 -0
- package/dist/index.all.d.cts +28 -25
- package/dist/index.all.d.mts +29 -26
- package/dist/index.all.mjs +4 -1
- package/dist/index.browser.cjs +21 -0
- package/dist/index.browser.d.cts +14 -11
- package/dist/index.browser.d.mts +15 -12
- package/dist/index.browser.mjs +4 -1
- package/dist/index.jsr.d.cts +4 -4
- package/dist/index.jsr.d.mts +4 -4
- package/dist/index.node.cjs +21 -0
- package/dist/index.node.d.cts +28 -25
- package/dist/index.node.d.mts +29 -26
- package/dist/index.node.mjs +4 -1
- package/dist/{log-file-bsTsc9KM.d.cts → log-file-DwEDms1F.d.cts} +2 -2
- package/dist/{log-file-DTuImomJ.d.mts → log-file-QV1unm3z.d.mts} +2 -2
- package/dist/{log-file-rotation-_YruAcNc.d.cts → log-file-rotation-BpZxXYlU.d.cts} +2 -2
- package/dist/{log-file-rotation-FBmtp_Uz.d.mts → log-file-rotation-DanrO_2y.d.mts} +2 -2
- package/dist/{log-node-DlrXl3QO.d.mts → log-node-BSn7RqAc.d.mts} +1 -1
- package/dist/{log-node-Dk948mHX.d.cts → log-node-D_fiJL6x.d.cts} +1 -1
- package/dist/{log-rotation-CkyjZbK5.d.mts → log-rotation-BdGakFya.d.cts} +1 -1
- package/dist/{log-rotation-_d7iRm9s.d.cts → log-rotation-Ce4e-8LN.d.mts} +1 -1
- package/dist/{log-util-2Ls76P-0.d.cts → log-util-C0U3zCjw.d.cts} +1 -1
- package/dist/{log-util-Da_d19f8.d.mts → log-util-Da_UCcmt.d.mts} +1 -1
- package/dist/{memstorage-D5A9FwiP.d.mts → memstorage-BhWXthO8.d.mts} +1 -1
- package/dist/{memstorage-BcjQLdaQ.d.cts → memstorage-tvlWDYgS.d.cts} +1 -1
- package/dist/node/args.d.cts +1 -1
- package/dist/node/args.d.mts +1 -1
- package/dist/node/clipboard.d.cts +1 -1
- package/dist/node/clipboard.d.mts +1 -1
- package/dist/node/crypto.d.cts +1 -1
- package/dist/node/crypto.d.mts +1 -1
- package/dist/node/env.d.cts +1 -1
- package/dist/node/env.d.mts +1 -1
- package/dist/node/files-async.d.cts +1 -1
- package/dist/node/files-async.d.mts +1 -1
- package/dist/node/files.d.cts +1 -1
- package/dist/node/files.d.mts +1 -1
- package/dist/node/filestorage.d.cts +1 -1
- package/dist/node/filestorage.d.mts +1 -1
- package/dist/node/fs.d.cts +1 -1
- package/dist/node/fs.d.mts +1 -1
- package/dist/node/glob.d.cts +1 -1
- package/dist/node/glob.d.mts +1 -1
- package/dist/node/index.d.cts +14 -14
- package/dist/node/index.d.mts +14 -14
- package/dist/node/log/index.d.cts +5 -5
- package/dist/node/log/index.d.mts +5 -5
- package/dist/node/log/log-file-rotation.d.cts +1 -1
- package/dist/node/log/log-file-rotation.d.mts +1 -1
- package/dist/node/log/log-file.d.cts +1 -1
- package/dist/node/log/log-file.d.mts +1 -1
- package/dist/node/log/log-node.cjs +4 -13
- package/dist/node/log/log-node.cjs.map +1 -1
- package/dist/node/log/log-node.d.cts +1 -1
- package/dist/node/log/log-node.d.mts +1 -1
- package/dist/node/log/log-node.mjs +4 -13
- package/dist/node/log/log-node.mjs.map +1 -1
- package/dist/node/log/log-rotation.d.cts +1 -1
- package/dist/node/log/log-rotation.d.mts +1 -1
- package/dist/node/log/log-util.d.cts +1 -1
- package/dist/node/log/log-util.d.mts +1 -1
- package/dist/{promise-DGgiRckN.d.cts → promise-CU_CENbU.d.cts} +1 -1
- package/dist/{promise-MH3xAy4S.d.mts → promise-CoWXgo4w.d.mts} +1 -1
- package/dist/select-DrciHdk_.d.cts +52 -0
- package/dist/select-F2KpP6mo.d.mts +52 -0
- package/dist/table-Cr8tjDIL.d.mts +19 -0
- package/dist/table-IkLXirT-.d.cts +19 -0
- package/dist/{test-CAhm15f4.d.mts → test-DcXa0MeX.d.cts} +1 -1
- package/dist/{test-D2plOVHF.d.cts → test-jZsc7P2c.d.mts} +1 -1
- package/dist/{throttle-debounce-BLFxAZ8W.d.mts → throttle-debounce-CCh0F100.d.mts} +1 -1
- package/dist/{throttle-debounce-Psb0ay1r.d.cts → throttle-debounce-DyFiyoAk.d.cts} +1 -1
- package/dist/{time-BfKJBbym.d.cts → time-BgFZe9ys.d.cts} +1 -1
- package/dist/{time-DxE-vjjw.d.mts → time-DSV_k3mG.d.mts} +1 -1
- package/dist/{timeout-CnUk6Ruj.d.mts → timeout-DDSSNZY8.d.mts} +1 -1
- package/dist/{timeout-CpFcK8MD.d.cts → timeout-E3ZQbJgK.d.cts} +1 -1
- package/dist/{type-test-BiKyEZkc.d.mts → type-test-BvzWDJz3.d.mts} +1 -1
- package/dist/{type-test-sM7QpfQU.d.cts → type-test-CBK-iJ9d.d.cts} +1 -1
- package/dist/{utils-B8DsVgFr.d.mts → utils-1RyCGkpQ.d.mts} +1 -1
- package/dist/{utils-BfZkD2Pt.d.mts → utils-6Culwiaf.d.cts} +1 -1
- package/dist/{utils-DHQBNh-Z.d.cts → utils-CDJihcg3.d.mts} +1 -1
- package/dist/{utils-Bctk_WhH.d.cts → utils-nCQklGHV.d.cts} +1 -1
- package/dist/{uuid-Cusm2nIK.d.cts → uuid-CKFZfSff.d.mts} +1 -1
- package/dist/{uuid-ININPGKB.d.mts → uuid-D42A8UdP.d.cts} +1 -1
- package/dist/z-C0fpNWZg.d.cts +1 -0
- package/dist/z-D_jezYmm.d.mts +1 -0
- package/dist/{z-collection-BmuBin--.d.mts → z-collection-BSfgRU0Q.d.mts} +1 -1
- package/package.json +23 -27
- package/src/common/bin/lib0/decoding.spec.ts +84 -1
- package/src/common/bin/lib0/encoding.spec.ts +109 -1
- package/src/common/bin/lib0/string.spec.ts +45 -1
- package/src/common/crypto/crypto.spec.ts +7 -0
- package/src/common/crypto/xaes.spec.ts +48 -0
- package/src/common/data/deep.spec.ts +45 -0
- package/src/common/data/regexp.spec.ts +30 -0
- package/src/common/schema/export-json-schema.spec.ts +11 -7
- package/src/common/schema/export-json-schema.ts +59 -52
- package/src/common/schema/_sandbox/sandbox-inherit.ts +0 -13
- package/src/common/schema/_sandbox/sandbox.ts +0 -42
- package/src/common/schema/_sandbox/sandbox.xspec.ts +0 -45
- /package/dist/{index-BH1nuHdZ.d.cts → index-CIABef8t.d.mts} +0 -0
- /package/dist/{index-BL7o4fG9.d.cts → index-CliqZ9rj.d.mts} +0 -0
- /package/dist/{index-CP2eJYlK.d.mts → index-D6xqj1Qx.d.cts} +0 -0
- /package/dist/{index-DjOaHFU3.d.mts → index-DHFfG4yr.d.cts} +0 -0
- /package/dist/{index-sViox9YW.d.mts → index-N-OgGgfF.d.mts} +0 -0
- /package/dist/{z-ClMox7qS.d.mts → index-WOw4GVZo.d.cts} +0 -0
- /package/dist/{z-dtM4F8Lo.d.cts → index-luywJTzJ.d.mts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as useMutex, n as Mutex, r as useAsyncMutex, t as AsyncMutex } from "../../mutex-Bx9wpyQU.cjs";
|
|
2
2
|
import { a as PoolTask, c as PoolTaskIdConflictResolution, d as Progress, f as ProgressOptions, i as PoolConfig, l as PoolTaskState, n as TaskEvents, o as PoolTaskEvents, r as TaskFn, s as PoolTaskFn, t as SerialQueue, u as usePool } from "../../index-CFkMqHvX.cjs";
|
|
3
|
-
import { a as isTimeout, c as timeout, i as isPromise, l as tryTimeout, n as createPromise, o as promisify, r as immediate, s as sleep, t as AsyncReturnType, u as waitOn } from "../../promise-
|
|
4
|
-
import { n as throttle, t as debounce } from "../../throttle-debounce-
|
|
3
|
+
import { a as isTimeout, c as timeout, i as isPromise, l as tryTimeout, n as createPromise, o as promisify, r as immediate, s as sleep, t as AsyncReturnType, u as waitOn } from "../../promise-CU_CENbU.cjs";
|
|
4
|
+
import { n as throttle, t as debounce } from "../../throttle-debounce-DyFiyoAk.cjs";
|
|
5
5
|
export { AsyncMutex, AsyncReturnType, Mutex, PoolConfig, PoolTask, PoolTaskEvents, PoolTaskFn, PoolTaskIdConflictResolution, PoolTaskState, Progress, ProgressOptions, SerialQueue, TaskEvents, TaskFn, createPromise, debounce, immediate, isPromise, isTimeout, promisify, sleep, throttle, timeout, tryTimeout, useAsyncMutex, useMutex, usePool, waitOn };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as useMutex, n as Mutex, r as useAsyncMutex, t as AsyncMutex } from "../../mutex-D_myf4dr.mjs";
|
|
2
2
|
import { a as PoolTask, c as PoolTaskIdConflictResolution, d as Progress, f as ProgressOptions, i as PoolConfig, l as PoolTaskState, n as TaskEvents, o as PoolTaskEvents, r as TaskFn, s as PoolTaskFn, t as SerialQueue, u as usePool } from "../../index-C_3Y_s6f.mjs";
|
|
3
|
-
import { a as isTimeout, c as timeout, i as isPromise, l as tryTimeout, n as createPromise, o as promisify, r as immediate, s as sleep, t as AsyncReturnType, u as waitOn } from "../../promise-
|
|
4
|
-
import { n as throttle, t as debounce } from "../../throttle-debounce-
|
|
3
|
+
import { a as isTimeout, c as timeout, i as isPromise, l as tryTimeout, n as createPromise, o as promisify, r as immediate, s as sleep, t as AsyncReturnType, u as waitOn } from "../../promise-CoWXgo4w.mjs";
|
|
4
|
+
import { n as throttle, t as debounce } from "../../throttle-debounce-CCh0F100.mjs";
|
|
5
5
|
export { AsyncMutex, AsyncReturnType, Mutex, PoolConfig, PoolTask, PoolTaskEvents, PoolTaskFn, PoolTaskIdConflictResolution, PoolTaskState, Progress, ProgressOptions, SerialQueue, TaskEvents, TaskFn, createPromise, debounce, immediate, isPromise, isTimeout, promisify, sleep, throttle, timeout, tryTimeout, useAsyncMutex, useMutex, usePool, waitOn };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as isTimeout, c as timeout, i as isPromise, l as tryTimeout, n as createPromise, o as promisify, r as immediate, s as sleep, t as AsyncReturnType, u as waitOn } from "../../promise-
|
|
1
|
+
import { a as isTimeout, c as timeout, i as isPromise, l as tryTimeout, n as createPromise, o as promisify, r as immediate, s as sleep, t as AsyncReturnType, u as waitOn } from "../../promise-CU_CENbU.cjs";
|
|
2
2
|
export { AsyncReturnType, createPromise, immediate, isPromise, isTimeout, promisify, sleep, timeout, tryTimeout, waitOn };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as isTimeout, c as timeout, i as isPromise, l as tryTimeout, n as createPromise, o as promisify, r as immediate, s as sleep, t as AsyncReturnType, u as waitOn } from "../../promise-
|
|
1
|
+
import { a as isTimeout, c as timeout, i as isPromise, l as tryTimeout, n as createPromise, o as promisify, r as immediate, s as sleep, t as AsyncReturnType, u as waitOn } from "../../promise-CoWXgo4w.mjs";
|
|
2
2
|
export { AsyncReturnType, createPromise, immediate, isPromise, isTimeout, promisify, sleep, timeout, tryTimeout, waitOn };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as throttle, t as debounce } from "../../throttle-debounce-
|
|
1
|
+
import { n as throttle, t as debounce } from "../../throttle-debounce-DyFiyoAk.cjs";
|
|
2
2
|
export { debounce, throttle };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as throttle, t as debounce } from "../../throttle-debounce-
|
|
1
|
+
import { n as throttle, t as debounce } from "../../throttle-debounce-CCh0F100.mjs";
|
|
2
2
|
export { debounce, throttle };
|
package/dist/common/index.cjs
CHANGED
|
@@ -82,6 +82,9 @@ const require_common_schema_parse_args = require('./schema/parse-args.cjs');
|
|
|
82
82
|
const require_common_schema_parse_env = require('./schema/parse-env.cjs');
|
|
83
83
|
const require_common_schema_schema = require('./schema/schema.cjs');
|
|
84
84
|
const require_common_schema_serialize = require('./schema/serialize.cjs');
|
|
85
|
+
const require_common_schema_sql_table = require('./schema/sql/table.cjs');
|
|
86
|
+
const require_common_schema_sql_expr = require('./schema/sql/expr.cjs');
|
|
87
|
+
const require_common_schema_sql_select = require('./schema/sql/select.cjs');
|
|
85
88
|
const require_common_schema_z_collection = require('./schema/z-collection.cjs');
|
|
86
89
|
const require_common_storage_memstorage = require('./storage/memstorage.cjs');
|
|
87
90
|
const require_common_test = require('./test.cjs');
|
|
@@ -120,6 +123,7 @@ exports.PubSub = require_common_msg_pubsub.PubSub;
|
|
|
120
123
|
exports.RPCMode = require_common_msg_rpc.RPCMode;
|
|
121
124
|
exports.RX_URL = require_common_data_url.RX_URL;
|
|
122
125
|
exports.ResillientChannel = require_common_msg_channel_resilient.ResillientChannel;
|
|
126
|
+
exports.SelectBuilder = require_common_schema_sql_select.SelectBuilder;
|
|
123
127
|
exports.SerialQueue = require_common_exec_queue.SerialQueue;
|
|
124
128
|
exports.TIME_DAY_MS = require_common_time.TIME_DAY_MS;
|
|
125
129
|
exports.TIME_DAY_S = require_common_time.TIME_DAY_S;
|
|
@@ -143,6 +147,7 @@ exports.XRX = require_common_data_xrx.XRX;
|
|
|
143
147
|
exports._decodeUtf8Polyfill = require_bin._decodeUtf8Polyfill;
|
|
144
148
|
exports._encodeUtf8Polyfill = require_bin._encodeUtf8Polyfill;
|
|
145
149
|
exports._useBase = require_common_data_basex._useBase;
|
|
150
|
+
exports.and = require_common_schema_sql_expr.and;
|
|
146
151
|
exports.any = require_common_schema_schema.any;
|
|
147
152
|
exports.array = require_common_schema_schema.array;
|
|
148
153
|
exports.arrayAvg = require_common_data_array.arrayAvg;
|
|
@@ -291,6 +296,7 @@ exports.endSortWeight = require_common_data_sortable.endSortWeight;
|
|
|
291
296
|
exports.ensureKey = require_common_data_utils.ensureKey;
|
|
292
297
|
exports.ensureKeyAsync = require_common_data_utils.ensureKeyAsync;
|
|
293
298
|
exports.ensureUint8Array = require_bin.ensureUint8Array;
|
|
299
|
+
exports.eq = require_common_schema_sql_expr.eq;
|
|
294
300
|
exports.equalBinary = require_bin.equalBinary;
|
|
295
301
|
exports.escapeHTML = require_common_data_html.escapeHTML;
|
|
296
302
|
exports.escapeRegExp = require_common_data_regexp.escapeRegExp;
|
|
@@ -313,6 +319,7 @@ exports.formatBytesToHumanBase1024 = require_common_data_format.formatBytesToHum
|
|
|
313
319
|
exports.formatMessages = require_common_data_message.formatMessages;
|
|
314
320
|
exports.formatMilliseconds = require_common_time.formatMilliseconds;
|
|
315
321
|
exports.formatSecondsToTime = require_common_data_format.formatSecondsToTime;
|
|
322
|
+
exports.from = require_common_schema_sql_select.from;
|
|
316
323
|
exports.fromBase64 = require_bin.fromBase64;
|
|
317
324
|
exports.fromBase64String = require_bin.fromBase64String;
|
|
318
325
|
exports.fromCamelCase = require_common_data_camelcase.fromCamelCase;
|
|
@@ -337,15 +344,19 @@ exports.getTimestamp = require_common_time.getTimestamp;
|
|
|
337
344
|
exports.getTimestampInSeconds = require_common_time.getTimestampInSeconds;
|
|
338
345
|
exports.getWindow = require_common_platform.getWindow;
|
|
339
346
|
exports.globalAny = require_common_global.globalAny;
|
|
347
|
+
exports.gt = require_common_schema_sql_expr.gt;
|
|
348
|
+
exports.gte = require_common_schema_sql_expr.gte;
|
|
340
349
|
exports.helpSchemaArgs = require_common_schema_parse_args.helpSchemaArgs;
|
|
341
350
|
exports.hex = require_bin.hex;
|
|
342
351
|
exports.immediate = require_common_exec_promise.immediate;
|
|
343
352
|
exports.importKeyXAES = require_common_crypto_xaes.importKeyXAES;
|
|
353
|
+
exports.inArray = require_common_schema_sql_expr.inArray;
|
|
344
354
|
exports.int = require_common_schema_schema.int;
|
|
345
355
|
exports.isArray = require_common_data_is.isArray;
|
|
346
356
|
exports.isBinaryArray = require_common_data_is.isBinaryArray;
|
|
347
357
|
exports.isBoolean = require_common_data_is.isBoolean;
|
|
348
358
|
exports.isBrowser = require_common_platform.isBrowser;
|
|
359
|
+
exports.isColumn = require_common_schema_sql_table.isColumn;
|
|
349
360
|
exports.isEmpty = require_common_data_is.isEmpty;
|
|
350
361
|
exports.isEven = require_common_data_rounding.isEven;
|
|
351
362
|
exports.isFunction = require_common_data_is.isFunction;
|
|
@@ -384,6 +395,7 @@ exports.jsonStringifySafe = require_common_data_json.jsonStringifySafe;
|
|
|
384
395
|
exports.jsonStringifySorted = require_common_data_json.jsonStringifySorted;
|
|
385
396
|
exports.jsonToUint8Array = require_bin.jsonToUint8Array;
|
|
386
397
|
exports.last = require_common_data_utils.last;
|
|
398
|
+
exports.like = require_common_schema_sql_expr.like;
|
|
387
399
|
exports.linkifyPlainText = require_common_data_url.linkifyPlainText;
|
|
388
400
|
exports.linkifyPlainTextSimple = require_common_data_url.linkifyPlainTextSimple;
|
|
389
401
|
exports.linkifyPlainTextWithLineBreaks = require_common_data_url.linkifyPlainTextWithLineBreaks;
|
|
@@ -394,12 +406,16 @@ exports.listQuery = require_common_data_list.listQuery;
|
|
|
394
406
|
exports.literal = require_common_schema_schema.literal;
|
|
395
407
|
exports.logCaptureConsole = require_common_log_log_console_capture.logCaptureConsole;
|
|
396
408
|
exports.logMessageFromCompact = require_common_log_log_memory.logMessageFromCompact;
|
|
409
|
+
exports.lt = require_common_schema_sql_expr.lt;
|
|
410
|
+
exports.lte = require_common_schema_sql_expr.lte;
|
|
397
411
|
exports.memoize = require_common_data_utils.memoize;
|
|
398
412
|
exports.memoizeAsync = require_common_data_utils.memoizeAsync;
|
|
399
413
|
exports.moveSortWeight = require_common_data_sortable.moveSortWeight;
|
|
414
|
+
exports.ne = require_common_schema_sql_expr.ne;
|
|
400
415
|
exports.none = require_common_schema_schema.none;
|
|
401
416
|
exports.noop = require_common_utils.noop;
|
|
402
417
|
exports.noopDisposer = require_common_dispose_utils.noopDisposer;
|
|
418
|
+
exports.not = require_common_schema_sql_expr.not;
|
|
403
419
|
exports.number = require_common_schema_schema.number;
|
|
404
420
|
exports.numberToBase32 = require_common_data_math.numberToBase32;
|
|
405
421
|
exports.object = require_common_schema_schema.object;
|
|
@@ -414,6 +430,7 @@ exports.objectMergeDisposable = require_common_data_object.objectMergeDisposable
|
|
|
414
430
|
exports.objectOmit = require_common_data_object.objectOmit;
|
|
415
431
|
exports.objectPick = require_common_data_object.objectPick;
|
|
416
432
|
exports.objectPlain = require_common_data_object.objectPlain;
|
|
433
|
+
exports.or = require_common_schema_sql_expr.or;
|
|
417
434
|
exports.parseBasicAuth = require_common_network.parseBasicAuth;
|
|
418
435
|
exports.parseDate = require_common_time.parseDate;
|
|
419
436
|
exports.parseFloat = require_common_data_convert.parseFloat;
|
|
@@ -455,6 +472,7 @@ exports.schemaExportTypescriptInterface = require_common_schema_export_typescrip
|
|
|
455
472
|
exports.schemaParseObject = require_common_schema_parse_object.schemaParseObject;
|
|
456
473
|
exports.schemaValidateObject = require_common_schema_parse_object.schemaValidateObject;
|
|
457
474
|
exports.seededRandom = require_common_data_math.seededRandom;
|
|
475
|
+
exports.select = require_common_schema_sql_select.select;
|
|
458
476
|
exports.serializeSchema = require_common_schema_serialize.serializeSchema;
|
|
459
477
|
exports.setDayTest = require_common_data_day.setDayTest;
|
|
460
478
|
exports.setTestMode = require_common_test.setTestMode;
|
|
@@ -464,6 +482,8 @@ exports.size = require_common_data_utils.size;
|
|
|
464
482
|
exports.sleep = require_common_exec_promise.sleep;
|
|
465
483
|
exports.sortedItems = require_common_data_sortable.sortedItems;
|
|
466
484
|
exports.sortedOrderby = require_common_data_orderby.sortedOrderby;
|
|
485
|
+
exports.sqlIsNotNull = require_common_schema_sql_expr.sqlIsNotNull;
|
|
486
|
+
exports.sqlIsNull = require_common_schema_sql_expr.sqlIsNull;
|
|
467
487
|
exports.startSortWeight = require_common_data_sortable.startSortWeight;
|
|
468
488
|
exports.str = require_bin.str;
|
|
469
489
|
exports.string = require_common_schema_schema.string;
|
|
@@ -480,6 +500,7 @@ exports.suidBytes = require_common_uuid.suidBytes;
|
|
|
480
500
|
exports.suidBytesDate = require_common_uuid.suidBytesDate;
|
|
481
501
|
exports.suidDate = require_common_uuid.suidDate;
|
|
482
502
|
exports.sum = require_common_data_math.sum;
|
|
503
|
+
exports.table = require_common_schema_sql_table.table;
|
|
483
504
|
exports.throttle = require_common_exec_throttle_debounce.throttle;
|
|
484
505
|
exports.timeout = require_common_exec_promise.timeout;
|
|
485
506
|
exports.timestampMillisecondsToSeconds = require_common_time.timestampMillisecondsToSeconds;
|
package/dist/common/index.d.cts
CHANGED
|
@@ -73,14 +73,17 @@ import { i as stringFromSchemaEnv, n as SchemaEnvType, r as parseSchemaEnv, t as
|
|
|
73
73
|
import { i as schemaValidateObject, n as schemaCreateObject, r as schemaParseObject, t as SchemaValidateMessage } from "../parse-object-D_fCDXxd.cjs";
|
|
74
74
|
import { t as StandardSchemaV1 } from "../schema-standard-BxRHxZeM.cjs";
|
|
75
75
|
import { n as deserializeSchema, r as serializeSchema, t as SerializedType } from "../serialize-9GhlcFMv.cjs";
|
|
76
|
-
import { n as
|
|
77
|
-
import { a as
|
|
78
|
-
import { n as
|
|
79
|
-
import { t as
|
|
80
|
-
import {
|
|
81
|
-
import { t as
|
|
82
|
-
import { t as
|
|
83
|
-
import { C as
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
-
|
|
76
|
+
import { a as table, i as isColumn, n as TableColumns, r as TableShape, t as Column } from "../table-IkLXirT-.cjs";
|
|
77
|
+
import { a as gte, c as lt, d as not, f as or, i as gt, l as lte, m as sqlIsNull, n as and, o as inArray, p as sqlIsNotNull, r as eq, s as like, t as Expr, u as ne } from "../expr-yYgSeBZ3.cjs";
|
|
78
|
+
import { a as RowFromTable, c as select, i as RowFromSelection, n as InferRow, o as SelectBuilder, r as QueryDependencies, s as from, t as CompiledQuery } from "../select-DrciHdk_.cjs";
|
|
79
|
+
import { n as IsEqual, t as Expect } from "../type-test-CBK-iJ9d.cjs";
|
|
80
|
+
import { a as isSchemaPrimitive, i as isSchemaOptional, n as isSchemaObject, r as isSchemaObjectFlat, t as isSchemaDefault } from "../utils-nCQklGHV.cjs";
|
|
81
|
+
import { n as MemStorageOptions, t as MemStorage } from "../memstorage-tvlWDYgS.cjs";
|
|
82
|
+
import { t as setTestMode } from "../test-DcXa0MeX.cjs";
|
|
83
|
+
import { C as parseDate, E as timestampSecondsToMilliseconds, S as getTimestampInSeconds, T as timestampMillisecondsToSeconds, _ as formatMilliseconds, a as TIME_MINUTE_MS, b as getSecondsFromBuildNumber, c as TIME_MONTH_S, d as TIME_YEAR_MS, f as TIME_YEAR_S, g as duration, h as datetimeToUTC, i as TIME_HOUR_S, l as TIME_WEEK_MS, m as datetimeToLocal, n as TIME_DAY_S, o as TIME_MINUTE_S, p as dateFromSeconds, r as TIME_HOUR_MS, s as TIME_MONTH_MS, t as TIME_DAY_MS, u as TIME_WEEK_S, v as getBuildNumber, w as setTimestampTest, x as getTimestamp, y as getPerformanceTimestamp } from "../time-BgFZe9ys.cjs";
|
|
84
|
+
import { t as safeTimeout } from "../timeout-E3ZQbJgK.cjs";
|
|
85
|
+
import { t as noop } from "../utils-6Culwiaf.cjs";
|
|
86
|
+
import { C as uuidv4, S as uuidIsValid, _ as uuidDecodeV4, a as suidBytesDate, b as uuidEncodeB62, c as unameReset, d as uuidB32, f as uuidB62, g as uuidDecodeB62, h as uuidDecodeB32, i as suidBytes, l as uuid, m as uuidDecode, n as setUuidDefaultEncoding, o as suidDate, p as uuidBytes, r as suid, s as uname, t as qid, u as uuid32bit, v as uuidEncode, x as uuidEncodeV4, y as uuidEncodeB32 } from "../uuid-D42A8UdP.cjs";
|
|
87
|
+
import { a as isTimeout, c as timeout, i as isPromise, l as tryTimeout, n as createPromise, o as promisify, r as immediate, s as sleep, t as AsyncReturnType, u as waitOn } from "../promise-CU_CENbU.cjs";
|
|
88
|
+
import { n as throttle, t as debounce } from "../throttle-debounce-DyFiyoAk.cjs";
|
|
89
|
+
export { ArgumentsType, AsyncMutex, AsyncReturnType, BaseXAlphabet, BaseXAsChain, BaseXChain, BaseXDecodeFunction, BaseXEncodeFunction, BaseXFirst, BaseXInput, BaseXLast, BaseXOutput, BaseXTail, Bech32, Bech32Decoded, Bech32DecodedWithArray, BinInput, BinaryEncoder, BytesCoder, CRYPTO_DEFAULT_ALG, CRYPTO_DEFAULT_DERIVE_ALG, CRYPTO_DEFAULT_DERIVE_ITERATIONS, CRYPTO_DEFAULT_HASH_ALG, CRYPTO_DEFAULT_IV_LENGTH, Channel, ChannelMessageEvent, Coder, Column, CompiledQuery, CryptoEncoder, DAY_MS, Day, DayInput, DayInputLegacy, DayValue, DebugChannel, DecimalInput, DecimalValue, DefaultListener, DefaultLogger, DiffOptions, Difference, DifferenceType, Disposer, DisposerFunction, Emitter, EmitterAllHandler, EmitterHandler, EmitterSubscriberOptions, Encoder, Expect, Expr, FilterFunction, Infer, InferRow, IsEqual, Json, JsonEncoder, JsonEntryProcessor, LinkifyOptions, ListenerSignature, LocalChannel, LogConfig, LogHandler, LogHandlerOptions, LogLevel, LogLevelAlias, LogLevelAliasKey, LogLevelAliasType, LogLevelAll, LogLevelDebug, LogLevelError, LogLevelFatal, LogLevelInfo, LogLevelOff, LogLevelWarn, LogMessage, LogMessageCompact, LogOriginalConsole, LoggerConsoleHandler, LoggerContext, LoggerContextInterface, LoggerInterface, LoggerMemoryHandler, MapperFunction, MemStorage, MemStorageOptions, Message, MessageAction, MessageDefinitions, MessageHub, MessageResult, MessagesDefaultMethods, MessagesMethods, MessagesOptions, Mutex, NamespaceFilter, NestedArray, NoopEncoder, ObjectStorage, PoolConfig, PoolTask, PoolTaskEvents, PoolTaskFn, PoolTaskIdConflictResolution, PoolTaskState, Primitive, Progress, ProgressOptions, PubSub, PubSubConfig, QueryDependencies, RPCFn, RPCMessage, RPCMode, RPCOptions, RPCOptionsBasic, RPCReturn, RX_URL, RenderMessagesOptions, ResillientChannel, ReturnType, RoundingMode, RowFromSelection, RowFromTable, SchemaEnvOptions, SchemaEnvType, SchemaValidateMessage, SelectBuilder, SerialQueue, SerializedType, Signal, SignalWatcher, SortableItem, StandardSchemaV1, TIME_DAY_MS, TIME_DAY_S, TIME_HOUR_MS, TIME_HOUR_S, TIME_MINUTE_MS, TIME_MINUTE_S, TIME_MONTH_MS, TIME_MONTH_S, TIME_WEEK_MS, TIME_WEEK_S, TIME_YEAR_MS, TIME_YEAR_S, TableColumns, TableShape, TaskEvents, TaskFn, TimerExecFunction, Type, TypeArray, TypeArrayOutput, TypeLiterals, TypeMeta, TypeObjectFixOptional, TypeTuple, TypeUnion, Uint8ArrayToDataUri, Uint8ArrayToHexDump, Uint8ArrayToJson, Uint8ArrayToString, Uint8ArrayToWords, UseDefer, UseDispose, UseDisposeConfig, UseDisposeWithUtils, UseRPCHubType, UseStringHashPool, XRX, ZeedGlobalContext, ZeedGlobalEmitter, _decodeUtf8Polyfill, _encodeUtf8Polyfill, _useBase, and, any, array, arrayAvg, arrayBatches, arrayEmptyInPlace, arrayFilterInPlace, arrayFlatten, arrayIntersection, arrayIsEqual, arrayMax, arrayMin, arrayMinus, arrayRandomElement, arrayRemoveElement, arraySetArrayInPlace, arraySetElement, arrayShuffle, arrayShuffleForce, arrayShuffleInPlace, arraySorted, arraySortedNumbers, arraySum, arraySymmetricDifference, arrayToggleInPlace, arrayUnion, arrayUnique, assert, assertCondition, assertNumber, avg, base16, base32, base32ToNumber, base32agnoster, base32crockford, base32hex, base32hexnopad, base32nopad, base58, base58check, base58flickr, base58xmr, base58xrp, base64, base64nopad, base64url, base64urlnopad, bech32, bech32m, between, bitfield, blobToArrayBuffer, blobToDataUri, blobToUint8Array, boolean, browserSelectColorByName, bytes, bytesToString, cloneJsonObject, cloneObject, cmp, composeOrderby, createArray, createBase58check, createBinaryStreamDecoder, createBinaryStreamEncoder, createLocalChannelPair, createPromise, createPromiseProxy, csvParse, csvParseToObjects, csvStringify, dataUriToBlob, dataUriToMimeType, dataUriToUint8Array, dateFromSeconds, dateStringToDays, datetimeToLocal, datetimeToUTC, day, dayDay, dayDaysInMonth, dayDiff, dayFromAny, dayFromDate, dayFromDateGMT, dayFromDateUTC, dayFromParts, dayFromString, dayFromTimestamp, dayFromTimestampSeconds, dayFromToday, dayIterator, dayMonth, dayMonthOffset, dayMonthStart, dayOffset, dayRange, dayToDate, dayToDateGMT, dayToDateUTC, dayToParts, dayToString, dayToTimestamp, dayToTimestampSeconds, dayYear, dayYearOffset, dayYearStart, debounce, deburr, decimal, decimalCentsPart, decimalFromCents, decimalToCents, decodeBase16, decodeBase32, decodeBase58, decodeBase62, decodeJson, decrypt, decryptAesGcm, decryptXAES, deepEqual, deepMerge, deepStripUndefinedInPlace, deriveKeyPbkdf2, deriveKeyPbkdf2CBC, deserializeSchema, detect, diffObjects, digest, distributedFilePath, double, duration, empty, encodeBase16, encodeBase32, encodeBase58, encodeBase62, encodeJson, encodeQuery, encrypt, encryptAesGcm, encryptXAES, endSortWeight, ensureKey, ensureKeyAsync, ensureUint8Array, eq, equalBinary, escapeHTML, escapeRegExp, estimateSizeForBase, exportKeyXAES, fatal, fetchBasic, fetchJson, fetchOptionType, fetchOptionsBasicAuth, fetchOptionsFormURLEncoded, fetchOptionsJson, fetchOptionsType, fetchText, first, fixBrokenUtf8String, float, forEachDay, forTimes, formatBytesToHumanBase1000, formatBytesToHumanBase1024, formatMessages, formatMilliseconds, formatSecondsToTime, from, fromBase64, fromBase64String, fromCamelCase, fromHex, func, generateKeyXAES, getBuildNumber, getGlobal, getGlobalConsole, getGlobalContext, getGlobalEmitter, getGlobalLogger, getGlobalLoggerIfExists, getLocalStorage, getNamespaceFilterString, getNavigator, getPerformanceTimestamp, getSecondsFromBuildNumber, getSecureRandom, getSecureRandomIfPossible, getTimestamp, getTimestampInSeconds, getWindow, globalAny, gt, gte, helpSchemaArgs, hex, httpMethod, immediate, importKeyXAES, inArray, int, isArray, isBinaryArray, isBoolean, isBrowser, isColumn, isEmpty, isEven, isFunction, isHalf, isInteger, isLocalHost, isNotEmpty, isNotNull, isNull, isNullOrUndefined, isNumber, isObject, isPrime, isPrimeRX, isPrimitive, isPromise, isRecord, isRecordPlain, isSafeInteger, isSchemaDefault, isSchemaObject, isSchemaObjectFlat, isSchemaOptional, isSchemaPrimitive, isString, isSymbol, isTimeout, isTruthy, isUint8Array, isValue, joinLogStrings, joinToUint8Array, jsonParse, jsonStringify, jsonStringifySafe, jsonStringifySorted, jsonToUint8Array, last, like, linkifyPlainText, linkifyPlainTextSimple, linkifyPlainTextWithLineBreaks, listDistinctUnion, listGroupBy, listOfKey, listQuery, literal, logCaptureConsole, logMessageFromCompact, lt, lte, memoize, memoizeAsync, moveSortWeight, ne, none, noop, noopDisposer, not, number, numberToBase32, object, objectAssignDeepInPlace, objectAssignDescriptionInPlace, objectDescribeChange, objectFilter, objectInclusivePick, objectIsEmpty, objectMap, objectMergeDisposable, objectOmit, objectPick, objectPlain, or, parseBasicAuth, parseDate, parseFloat, parseInt, parseLogLevel, parseOrderby, parseQuery, parseSchemaArgs, parseSchemaEnv, polyfillUsing, promisify, qid, randomBoolean, randomFloat, randomInt, randomUint8Array, real, record, regExpEscape, regExpString, renderMessages, roundArrayOfNumbersToMatchSum, roundArrayOfObjectsToMatchSum, roundDown, roundHalfAwayFromZero, roundHalfDown, roundHalfEven, roundHalfOdd, roundHalfTowardsZero, roundHalfUp, roundUp, rpc, safeTimeout, schemaCreateObject, schemaExportJsonSchema, schemaExportJsonSchemaString, schemaExportSwiftStruct, schemaExportTypescriptInterface, schemaParseObject, schemaValidateObject, seededRandom, select, serializeSchema, setDayTest, setTestMode, setTimestampTest, setUuidDefaultEncoding, size, sleep, sortedItems, sortedOrderby, sqlIsNotNull, sqlIsNull, startSortWeight, str, string, stringFromSchemaEnv, stringHashFNV1a, stringLiterals, stringToBoolean, stringToBytes, stringToFloat, stringToInteger, stringToUInt8Array, suid, suidBytes, suidBytesDate, suidDate, sum, table, throttle, timeout, timestampMillisecondsToSeconds, timestampSecondsToMilliseconds, toArrayBuffer, toBase64, toBase64Url, toBool, toCamelCase, toCapitalize, toCapitalizeWords, toFloat, toHex, toHumanReadableUrl, toInt, toString, toUint8Array, toValidFilename, today, tryTimeout, tuple, uname, unameReset, unescapeHTML, union, useAsyncMutex, useBase, useDefer, useDispose, useDisposeWithUtils, useEventListener, useEventListenerOnce, useExitHandler, useInterval, useIntervalPause, useLevelFilter, useMessageHub, useMutex, useNamespaceFilter, usePool, usePubSub, useRPC, useRPCHub, useSignal, useSorted, useStringHashPool, useTimeout, utf8, utils, uuid, uuid32bit, uuidB32, uuidB62, uuidBytes, uuidDecode, uuidDecodeB32, uuidDecodeB62, uuidDecodeV4, uuidEncode, uuidEncodeB32, uuidEncodeB62, uuidEncodeV4, uuidIsValid, uuidv4, valueToBoolean, valueToBooleanNotFalse, valueToFloat, valueToInteger, valueToString, waitOn, wordsToUint8Array, z_collection_d_exports as z };
|
package/dist/common/index.d.mts
CHANGED
|
@@ -72,15 +72,18 @@ import { i as stringFromSchemaEnv, n as SchemaEnvType, r as parseSchemaEnv, t as
|
|
|
72
72
|
import { i as schemaValidateObject, n as schemaCreateObject, r as schemaParseObject, t as SchemaValidateMessage } from "../parse-object-BRWSD2uh.mjs";
|
|
73
73
|
import { t as StandardSchemaV1 } from "../schema-standard-Q-bdIO6s.mjs";
|
|
74
74
|
import { n as deserializeSchema, r as serializeSchema, t as SerializedType } from "../serialize-rRk9F-zH.mjs";
|
|
75
|
-
import { n as
|
|
76
|
-
import { a as
|
|
77
|
-
import { t as
|
|
78
|
-
import { n as
|
|
79
|
-
import { t as
|
|
80
|
-
import {
|
|
81
|
-
import { t as
|
|
82
|
-
import { t as
|
|
83
|
-
import { C as
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
-
|
|
75
|
+
import { a as table, i as isColumn, n as TableColumns, r as TableShape, t as Column } from "../table-Cr8tjDIL.mjs";
|
|
76
|
+
import { a as gte, c as lt, d as not, f as or, i as gt, l as lte, m as sqlIsNull, n as and, o as inArray, p as sqlIsNotNull, r as eq, s as like, t as Expr, u as ne } from "../expr-CCKrqOw1.mjs";
|
|
77
|
+
import { a as RowFromTable, c as select, i as RowFromSelection, n as InferRow, o as SelectBuilder, r as QueryDependencies, s as from, t as CompiledQuery } from "../select-F2KpP6mo.mjs";
|
|
78
|
+
import { n as IsEqual, t as Expect } from "../type-test-BvzWDJz3.mjs";
|
|
79
|
+
import { a as isSchemaPrimitive, i as isSchemaOptional, n as isSchemaObject, r as isSchemaObjectFlat, t as isSchemaDefault } from "../utils-1RyCGkpQ.mjs";
|
|
80
|
+
import { t as z_collection_d_exports } from "../z-collection-BSfgRU0Q.mjs";
|
|
81
|
+
import { n as MemStorageOptions, t as MemStorage } from "../memstorage-BhWXthO8.mjs";
|
|
82
|
+
import { t as setTestMode } from "../test-jZsc7P2c.mjs";
|
|
83
|
+
import { C as parseDate, E as timestampSecondsToMilliseconds, S as getTimestampInSeconds, T as timestampMillisecondsToSeconds, _ as formatMilliseconds, a as TIME_MINUTE_MS, b as getSecondsFromBuildNumber, c as TIME_MONTH_S, d as TIME_YEAR_MS, f as TIME_YEAR_S, g as duration, h as datetimeToUTC, i as TIME_HOUR_S, l as TIME_WEEK_MS, m as datetimeToLocal, n as TIME_DAY_S, o as TIME_MINUTE_S, p as dateFromSeconds, r as TIME_HOUR_MS, s as TIME_MONTH_MS, t as TIME_DAY_MS, u as TIME_WEEK_S, v as getBuildNumber, w as setTimestampTest, x as getTimestamp, y as getPerformanceTimestamp } from "../time-DSV_k3mG.mjs";
|
|
84
|
+
import { t as safeTimeout } from "../timeout-DDSSNZY8.mjs";
|
|
85
|
+
import { t as noop } from "../utils-CDJihcg3.mjs";
|
|
86
|
+
import { C as uuidv4, S as uuidIsValid, _ as uuidDecodeV4, a as suidBytesDate, b as uuidEncodeB62, c as unameReset, d as uuidB32, f as uuidB62, g as uuidDecodeB62, h as uuidDecodeB32, i as suidBytes, l as uuid, m as uuidDecode, n as setUuidDefaultEncoding, o as suidDate, p as uuidBytes, r as suid, s as uname, t as qid, u as uuid32bit, v as uuidEncode, x as uuidEncodeV4, y as uuidEncodeB32 } from "../uuid-CKFZfSff.mjs";
|
|
87
|
+
import { a as isTimeout, c as timeout, i as isPromise, l as tryTimeout, n as createPromise, o as promisify, r as immediate, s as sleep, t as AsyncReturnType, u as waitOn } from "../promise-CoWXgo4w.mjs";
|
|
88
|
+
import { n as throttle, t as debounce } from "../throttle-debounce-CCh0F100.mjs";
|
|
89
|
+
export { ArgumentsType, AsyncMutex, AsyncReturnType, BaseXAlphabet, BaseXAsChain, BaseXChain, BaseXDecodeFunction, BaseXEncodeFunction, BaseXFirst, BaseXInput, BaseXLast, BaseXOutput, BaseXTail, Bech32, Bech32Decoded, Bech32DecodedWithArray, BinInput, BinaryEncoder, BytesCoder, CRYPTO_DEFAULT_ALG, CRYPTO_DEFAULT_DERIVE_ALG, CRYPTO_DEFAULT_DERIVE_ITERATIONS, CRYPTO_DEFAULT_HASH_ALG, CRYPTO_DEFAULT_IV_LENGTH, Channel, ChannelMessageEvent, Coder, Column, CompiledQuery, CryptoEncoder, DAY_MS, Day, DayInput, DayInputLegacy, DayValue, DebugChannel, DecimalInput, DecimalValue, DefaultListener, DefaultLogger, DiffOptions, Difference, DifferenceType, Disposer, DisposerFunction, Emitter, EmitterAllHandler, EmitterHandler, EmitterSubscriberOptions, Encoder, Expect, Expr, FilterFunction, Infer, InferRow, IsEqual, Json, JsonEncoder, JsonEntryProcessor, LinkifyOptions, ListenerSignature, LocalChannel, LogConfig, LogHandler, LogHandlerOptions, LogLevel, LogLevelAlias, LogLevelAliasKey, LogLevelAliasType, LogLevelAll, LogLevelDebug, LogLevelError, LogLevelFatal, LogLevelInfo, LogLevelOff, LogLevelWarn, LogMessage, LogMessageCompact, LogOriginalConsole, LoggerConsoleHandler, LoggerContext, LoggerContextInterface, LoggerInterface, LoggerMemoryHandler, MapperFunction, MemStorage, MemStorageOptions, Message, MessageAction, MessageDefinitions, MessageHub, MessageResult, MessagesDefaultMethods, MessagesMethods, MessagesOptions, Mutex, NamespaceFilter, NestedArray, NoopEncoder, ObjectStorage, PoolConfig, PoolTask, PoolTaskEvents, PoolTaskFn, PoolTaskIdConflictResolution, PoolTaskState, Primitive, Progress, ProgressOptions, PubSub, PubSubConfig, QueryDependencies, RPCFn, RPCMessage, RPCMode, RPCOptions, RPCOptionsBasic, RPCReturn, RX_URL, RenderMessagesOptions, ResillientChannel, ReturnType, RoundingMode, RowFromSelection, RowFromTable, SchemaEnvOptions, SchemaEnvType, SchemaValidateMessage, SelectBuilder, SerialQueue, SerializedType, Signal, SignalWatcher, SortableItem, StandardSchemaV1, TIME_DAY_MS, TIME_DAY_S, TIME_HOUR_MS, TIME_HOUR_S, TIME_MINUTE_MS, TIME_MINUTE_S, TIME_MONTH_MS, TIME_MONTH_S, TIME_WEEK_MS, TIME_WEEK_S, TIME_YEAR_MS, TIME_YEAR_S, TableColumns, TableShape, TaskEvents, TaskFn, TimerExecFunction, Type, TypeArray, TypeArrayOutput, TypeLiterals, TypeMeta, TypeObjectFixOptional, TypeTuple, TypeUnion, Uint8ArrayToDataUri, Uint8ArrayToHexDump, Uint8ArrayToJson, Uint8ArrayToString, Uint8ArrayToWords, UseDefer, UseDispose, UseDisposeConfig, UseDisposeWithUtils, UseRPCHubType, UseStringHashPool, XRX, ZeedGlobalContext, ZeedGlobalEmitter, _decodeUtf8Polyfill, _encodeUtf8Polyfill, _useBase, and, any, array, arrayAvg, arrayBatches, arrayEmptyInPlace, arrayFilterInPlace, arrayFlatten, arrayIntersection, arrayIsEqual, arrayMax, arrayMin, arrayMinus, arrayRandomElement, arrayRemoveElement, arraySetArrayInPlace, arraySetElement, arrayShuffle, arrayShuffleForce, arrayShuffleInPlace, arraySorted, arraySortedNumbers, arraySum, arraySymmetricDifference, arrayToggleInPlace, arrayUnion, arrayUnique, assert, assertCondition, assertNumber, avg, base16, base32, base32ToNumber, base32agnoster, base32crockford, base32hex, base32hexnopad, base32nopad, base58, base58check, base58flickr, base58xmr, base58xrp, base64, base64nopad, base64url, base64urlnopad, bech32, bech32m, between, bitfield, blobToArrayBuffer, blobToDataUri, blobToUint8Array, boolean, browserSelectColorByName, bytes, bytesToString, cloneJsonObject, cloneObject, cmp, composeOrderby, createArray, createBase58check, createBinaryStreamDecoder, createBinaryStreamEncoder, createLocalChannelPair, createPromise, createPromiseProxy, csvParse, csvParseToObjects, csvStringify, dataUriToBlob, dataUriToMimeType, dataUriToUint8Array, dateFromSeconds, dateStringToDays, datetimeToLocal, datetimeToUTC, day, dayDay, dayDaysInMonth, dayDiff, dayFromAny, dayFromDate, dayFromDateGMT, dayFromDateUTC, dayFromParts, dayFromString, dayFromTimestamp, dayFromTimestampSeconds, dayFromToday, dayIterator, dayMonth, dayMonthOffset, dayMonthStart, dayOffset, dayRange, dayToDate, dayToDateGMT, dayToDateUTC, dayToParts, dayToString, dayToTimestamp, dayToTimestampSeconds, dayYear, dayYearOffset, dayYearStart, debounce, deburr, decimal, decimalCentsPart, decimalFromCents, decimalToCents, decodeBase16, decodeBase32, decodeBase58, decodeBase62, decodeJson, decrypt, decryptAesGcm, decryptXAES, deepEqual, deepMerge, deepStripUndefinedInPlace, deriveKeyPbkdf2, deriveKeyPbkdf2CBC, deserializeSchema, detect, diffObjects, digest, distributedFilePath, double, duration, empty, encodeBase16, encodeBase32, encodeBase58, encodeBase62, encodeJson, encodeQuery, encrypt, encryptAesGcm, encryptXAES, endSortWeight, ensureKey, ensureKeyAsync, ensureUint8Array, eq, equalBinary, escapeHTML, escapeRegExp, estimateSizeForBase, exportKeyXAES, fatal, fetchBasic, fetchJson, fetchOptionType, fetchOptionsBasicAuth, fetchOptionsFormURLEncoded, fetchOptionsJson, fetchOptionsType, fetchText, first, fixBrokenUtf8String, float, forEachDay, forTimes, formatBytesToHumanBase1000, formatBytesToHumanBase1024, formatMessages, formatMilliseconds, formatSecondsToTime, from, fromBase64, fromBase64String, fromCamelCase, fromHex, func, generateKeyXAES, getBuildNumber, getGlobal, getGlobalConsole, getGlobalContext, getGlobalEmitter, getGlobalLogger, getGlobalLoggerIfExists, getLocalStorage, getNamespaceFilterString, getNavigator, getPerformanceTimestamp, getSecondsFromBuildNumber, getSecureRandom, getSecureRandomIfPossible, getTimestamp, getTimestampInSeconds, getWindow, globalAny, gt, gte, helpSchemaArgs, hex, httpMethod, immediate, importKeyXAES, inArray, int, isArray, isBinaryArray, isBoolean, isBrowser, isColumn, isEmpty, isEven, isFunction, isHalf, isInteger, isLocalHost, isNotEmpty, isNotNull, isNull, isNullOrUndefined, isNumber, isObject, isPrime, isPrimeRX, isPrimitive, isPromise, isRecord, isRecordPlain, isSafeInteger, isSchemaDefault, isSchemaObject, isSchemaObjectFlat, isSchemaOptional, isSchemaPrimitive, isString, isSymbol, isTimeout, isTruthy, isUint8Array, isValue, joinLogStrings, joinToUint8Array, jsonParse, jsonStringify, jsonStringifySafe, jsonStringifySorted, jsonToUint8Array, last, like, linkifyPlainText, linkifyPlainTextSimple, linkifyPlainTextWithLineBreaks, listDistinctUnion, listGroupBy, listOfKey, listQuery, literal, logCaptureConsole, logMessageFromCompact, lt, lte, memoize, memoizeAsync, moveSortWeight, ne, none, noop, noopDisposer, not, number, numberToBase32, object, objectAssignDeepInPlace, objectAssignDescriptionInPlace, objectDescribeChange, objectFilter, objectInclusivePick, objectIsEmpty, objectMap, objectMergeDisposable, objectOmit, objectPick, objectPlain, or, parseBasicAuth, parseDate, parseFloat, parseInt, parseLogLevel, parseOrderby, parseQuery, parseSchemaArgs, parseSchemaEnv, polyfillUsing, promisify, qid, randomBoolean, randomFloat, randomInt, randomUint8Array, real, record, regExpEscape, regExpString, renderMessages, roundArrayOfNumbersToMatchSum, roundArrayOfObjectsToMatchSum, roundDown, roundHalfAwayFromZero, roundHalfDown, roundHalfEven, roundHalfOdd, roundHalfTowardsZero, roundHalfUp, roundUp, rpc, safeTimeout, schemaCreateObject, schemaExportJsonSchema, schemaExportJsonSchemaString, schemaExportSwiftStruct, schemaExportTypescriptInterface, schemaParseObject, schemaValidateObject, seededRandom, select, serializeSchema, setDayTest, setTestMode, setTimestampTest, setUuidDefaultEncoding, size, sleep, sortedItems, sortedOrderby, sqlIsNotNull, sqlIsNull, startSortWeight, str, string, stringFromSchemaEnv, stringHashFNV1a, stringLiterals, stringToBoolean, stringToBytes, stringToFloat, stringToInteger, stringToUInt8Array, suid, suidBytes, suidBytesDate, suidDate, sum, table, throttle, timeout, timestampMillisecondsToSeconds, timestampSecondsToMilliseconds, toArrayBuffer, toBase64, toBase64Url, toBool, toCamelCase, toCapitalize, toCapitalizeWords, toFloat, toHex, toHumanReadableUrl, toInt, toString, toUint8Array, toValidFilename, today, tryTimeout, tuple, uname, unameReset, unescapeHTML, union, useAsyncMutex, useBase, useDefer, useDispose, useDisposeWithUtils, useEventListener, useEventListenerOnce, useExitHandler, useInterval, useIntervalPause, useLevelFilter, useMessageHub, useMutex, useNamespaceFilter, usePool, usePubSub, useRPC, useRPCHub, useSignal, useSorted, useStringHashPool, useTimeout, utf8, utils, uuid, uuid32bit, uuidB32, uuidB62, uuidBytes, uuidDecode, uuidDecodeB32, uuidDecodeB62, uuidDecodeV4, uuidEncode, uuidEncodeB32, uuidEncodeB62, uuidEncodeV4, uuidIsValid, uuidv4, valueToBoolean, valueToBooleanNotFalse, valueToFloat, valueToInteger, valueToString, waitOn, wordsToUint8Array, z_collection_d_exports as z };
|
package/dist/common/index.mjs
CHANGED
|
@@ -81,9 +81,12 @@ import { helpSchemaArgs, parseSchemaArgs } from "./schema/parse-args.mjs";
|
|
|
81
81
|
import { parseSchemaEnv, stringFromSchemaEnv } from "./schema/parse-env.mjs";
|
|
82
82
|
import { Type, any, array, boolean, double, float, func, int, literal, none, number, object, real, record, rpc, string, stringLiterals, tuple, union } from "./schema/schema.mjs";
|
|
83
83
|
import { deserializeSchema, serializeSchema } from "./schema/serialize.mjs";
|
|
84
|
+
import { isColumn, table } from "./schema/sql/table.mjs";
|
|
85
|
+
import { and, eq, gt, gte, inArray, like, lt, lte, ne, not, or, sqlIsNotNull, sqlIsNull } from "./schema/sql/expr.mjs";
|
|
86
|
+
import { SelectBuilder, from, select } from "./schema/sql/select.mjs";
|
|
84
87
|
import { t as z_collection_exports } from "./schema/z-collection.mjs";
|
|
85
88
|
import { MemStorage } from "./storage/memstorage.mjs";
|
|
86
89
|
import { setTestMode } from "./test.mjs";
|
|
87
90
|
import { noop } from "./utils.mjs";
|
|
88
91
|
|
|
89
|
-
export { BinaryEncoder, CRYPTO_DEFAULT_ALG, CRYPTO_DEFAULT_DERIVE_ALG, CRYPTO_DEFAULT_DERIVE_ITERATIONS, CRYPTO_DEFAULT_HASH_ALG, CRYPTO_DEFAULT_IV_LENGTH, Channel, CryptoEncoder, DAY_MS, Day, DebugChannel, DefaultLogger, Emitter, JsonEncoder, LocalChannel, LogLevelAlias, LogLevelAll, LogLevelDebug, LogLevelError, LogLevelFatal, LogLevelInfo, LogLevelOff, LogLevelWarn, LoggerConsoleHandler, LoggerContext, LoggerMemoryHandler, MemStorage, NoopEncoder, Progress, PubSub, RPCMode, RX_URL, ResillientChannel, SerialQueue, TIME_DAY_MS, TIME_DAY_S, TIME_HOUR_MS, TIME_HOUR_S, TIME_MINUTE_MS, TIME_MINUTE_S, TIME_MONTH_MS, TIME_MONTH_S, TIME_WEEK_MS, TIME_WEEK_S, TIME_YEAR_MS, TIME_YEAR_S, Type, Uint8ArrayToDataUri, Uint8ArrayToHexDump, Uint8ArrayToJson, Uint8ArrayToString, Uint8ArrayToWords, XRX, _decodeUtf8Polyfill, _encodeUtf8Polyfill, _useBase, any, array, arrayAvg, arrayBatches, arrayEmptyInPlace, arrayFilterInPlace, arrayFlatten, arrayIntersection, arrayIsEqual, arrayMax, arrayMin, arrayMinus, arrayRandomElement, arrayRemoveElement, arraySetArrayInPlace, arraySetElement, arrayShuffle, arrayShuffleForce, arrayShuffleInPlace, arraySorted, arraySortedNumbers, arraySum, arraySymmetricDifference, arrayToggleInPlace, arrayUnion, arrayUnique, assert, assertCondition, assertNumber, avg, base16, base32, base32ToNumber, base32agnoster, base32crockford, base32hex, base32hexnopad, base32nopad, base58, base58check, base58flickr, base58xmr, base58xrp, base64, base64nopad, base64url, base64urlnopad, bech32, bech32m, between, bitfield, blobToArrayBuffer, blobToDataUri, blobToUint8Array, boolean, browserSelectColorByName, bytes, bytesToString, cloneJsonObject, cloneObject, cmp, composeOrderby, createArray, createBase58check, createBinaryStreamDecoder, createBinaryStreamEncoder, createLocalChannelPair, createPromise, createPromiseProxy, csvParse, csvParseToObjects, csvStringify, dataUriToBlob, dataUriToMimeType, dataUriToUint8Array, dateFromSeconds, dateStringToDays, datetimeToLocal, datetimeToUTC, day, dayDay, dayDaysInMonth, dayDiff, dayFromAny, dayFromDate, dayFromDateGMT, dayFromDateUTC, dayFromParts, dayFromString, dayFromTimestamp, dayFromTimestampSeconds, dayFromToday, dayIterator, dayMonth, dayMonthOffset, dayMonthStart, dayOffset, dayRange, dayToDate, dayToDateGMT, dayToDateUTC, dayToParts, dayToString, dayToTimestamp, dayToTimestampSeconds, dayYear, dayYearOffset, dayYearStart, debounce, deburr, decimal, decimalCentsPart, decimalFromCents, decimalToCents, decodeBase16, decodeBase32, decodeBase58, decodeBase62, decodeJson, decrypt, decryptAesGcm, decryptXAES, deepEqual, deepMerge, deepStripUndefinedInPlace, deriveKeyPbkdf2, deriveKeyPbkdf2CBC, deserializeSchema, detect, diffObjects, digest, distributedFilePath, double, duration, empty, encodeBase16, encodeBase32, encodeBase58, encodeBase62, encodeJson, encodeQuery, encrypt, encryptAesGcm, encryptXAES, endSortWeight, ensureKey, ensureKeyAsync, ensureUint8Array, equalBinary, escapeHTML, escapeRegExp, estimateSizeForBase, exportKeyXAES, fatal, fetchBasic, fetchJson, fetchOptionsBasicAuth, fetchOptionsFormURLEncoded, fetchOptionsJson, fetchText, first, fixBrokenUtf8String, float, forEachDay, forTimes, formatBytesToHumanBase1000, formatBytesToHumanBase1024, formatMessages, formatMilliseconds, formatSecondsToTime, fromBase64, fromBase64String, fromCamelCase, fromHex, func, generateKeyXAES, getBuildNumber, getGlobal, getGlobalConsole, getGlobalContext, getGlobalEmitter, getGlobalLogger, getGlobalLoggerIfExists, getLocalStorage, getNamespaceFilterString, getNavigator, getPerformanceTimestamp, getSecondsFromBuildNumber, getSecureRandom, getSecureRandomIfPossible, getTimestamp, getTimestampInSeconds, getWindow, globalAny, helpSchemaArgs, hex, immediate, importKeyXAES, int, isArray, isBinaryArray, isBoolean, isBrowser, isEmpty, isEven, isFunction, isHalf, isInteger, isLocalHost, isNotEmpty, isNotNull, isNull, isNullOrUndefined, isNumber, isObject, isPrime, isPrimeRX, isPrimitive, isPromise, isRecord, isRecordPlain, isSafeInteger, isSchemaDefault, isSchemaObject, isSchemaObjectFlat, isSchemaOptional, isSchemaPrimitive, isString, isSymbol, isTimeout, isTruthy, isUint8Array, isValue, joinLogStrings, joinToUint8Array, jsonParse, jsonStringify, jsonStringifySafe, jsonStringifySorted, jsonToUint8Array, last, linkifyPlainText, linkifyPlainTextSimple, linkifyPlainTextWithLineBreaks, listDistinctUnion, listGroupBy, listOfKey, listQuery, literal, logCaptureConsole, logMessageFromCompact, memoize, memoizeAsync, moveSortWeight, none, noop, noopDisposer, number, numberToBase32, object, objectAssignDeepInPlace, objectAssignDescriptionInPlace, objectDescribeChange, objectFilter, objectInclusivePick, objectIsEmpty, objectMap, objectMergeDisposable, objectOmit, objectPick, objectPlain, parseBasicAuth, parseDate, parseFloat, parseInt, parseLogLevel, parseOrderby, parseQuery, parseSchemaArgs, parseSchemaEnv, polyfillUsing, promisify, qid, randomBoolean, randomFloat, randomInt, randomUint8Array, real, record, regExpEscape, regExpString, renderMessages, roundArrayOfNumbersToMatchSum, roundArrayOfObjectsToMatchSum, roundDown, roundHalfAwayFromZero, roundHalfDown, roundHalfEven, roundHalfOdd, roundHalfTowardsZero, roundHalfUp, roundUp, rpc, safeTimeout, schemaCreateObject, schemaExportJsonSchema, schemaExportJsonSchemaString, schemaExportSwiftStruct, schemaExportTypescriptInterface, schemaParseObject, schemaValidateObject, seededRandom, serializeSchema, setDayTest, setTestMode, setTimestampTest, setUuidDefaultEncoding, size, sleep, sortedItems, sortedOrderby, startSortWeight, str, string, stringFromSchemaEnv, stringHashFNV1a, stringLiterals, stringToBoolean, stringToBytes, stringToFloat, stringToInteger, stringToUInt8Array, suid, suidBytes, suidBytesDate, suidDate, sum, throttle, timeout, timestampMillisecondsToSeconds, timestampSecondsToMilliseconds, toArrayBuffer, toBase64, toBase64Url, toBool, toCamelCase, toCapitalize, toCapitalizeWords, toFloat, toHex, toHumanReadableUrl, toInt, toString, toUint8Array, toValidFilename, today, tryTimeout, tuple, uname, unameReset, unescapeHTML, union, useAsyncMutex, useBase, useDefer, useDispose, useDisposeWithUtils, useEventListener, useEventListenerOnce, useExitHandler, useInterval, useIntervalPause, useLevelFilter, useMessageHub, useMutex, useNamespaceFilter, usePool, usePubSub, useRPC, useRPCHub, useSignal, useSorted, useStringHashPool, useTimeout, utf8, utils, uuid, uuid32bit, uuidB32, uuidB62, uuidBytes, uuidDecode, uuidDecodeB32, uuidDecodeB62, uuidDecodeV4, uuidEncode, uuidEncodeB32, uuidEncodeB62, uuidEncodeV4, uuidIsValid, uuidv4, valueToBoolean, valueToBooleanNotFalse, valueToFloat, valueToInteger, valueToString, waitOn, wordsToUint8Array, z_collection_exports as z };
|
|
92
|
+
export { BinaryEncoder, CRYPTO_DEFAULT_ALG, CRYPTO_DEFAULT_DERIVE_ALG, CRYPTO_DEFAULT_DERIVE_ITERATIONS, CRYPTO_DEFAULT_HASH_ALG, CRYPTO_DEFAULT_IV_LENGTH, Channel, CryptoEncoder, DAY_MS, Day, DebugChannel, DefaultLogger, Emitter, JsonEncoder, LocalChannel, LogLevelAlias, LogLevelAll, LogLevelDebug, LogLevelError, LogLevelFatal, LogLevelInfo, LogLevelOff, LogLevelWarn, LoggerConsoleHandler, LoggerContext, LoggerMemoryHandler, MemStorage, NoopEncoder, Progress, PubSub, RPCMode, RX_URL, ResillientChannel, SelectBuilder, SerialQueue, TIME_DAY_MS, TIME_DAY_S, TIME_HOUR_MS, TIME_HOUR_S, TIME_MINUTE_MS, TIME_MINUTE_S, TIME_MONTH_MS, TIME_MONTH_S, TIME_WEEK_MS, TIME_WEEK_S, TIME_YEAR_MS, TIME_YEAR_S, Type, Uint8ArrayToDataUri, Uint8ArrayToHexDump, Uint8ArrayToJson, Uint8ArrayToString, Uint8ArrayToWords, XRX, _decodeUtf8Polyfill, _encodeUtf8Polyfill, _useBase, and, any, array, arrayAvg, arrayBatches, arrayEmptyInPlace, arrayFilterInPlace, arrayFlatten, arrayIntersection, arrayIsEqual, arrayMax, arrayMin, arrayMinus, arrayRandomElement, arrayRemoveElement, arraySetArrayInPlace, arraySetElement, arrayShuffle, arrayShuffleForce, arrayShuffleInPlace, arraySorted, arraySortedNumbers, arraySum, arraySymmetricDifference, arrayToggleInPlace, arrayUnion, arrayUnique, assert, assertCondition, assertNumber, avg, base16, base32, base32ToNumber, base32agnoster, base32crockford, base32hex, base32hexnopad, base32nopad, base58, base58check, base58flickr, base58xmr, base58xrp, base64, base64nopad, base64url, base64urlnopad, bech32, bech32m, between, bitfield, blobToArrayBuffer, blobToDataUri, blobToUint8Array, boolean, browserSelectColorByName, bytes, bytesToString, cloneJsonObject, cloneObject, cmp, composeOrderby, createArray, createBase58check, createBinaryStreamDecoder, createBinaryStreamEncoder, createLocalChannelPair, createPromise, createPromiseProxy, csvParse, csvParseToObjects, csvStringify, dataUriToBlob, dataUriToMimeType, dataUriToUint8Array, dateFromSeconds, dateStringToDays, datetimeToLocal, datetimeToUTC, day, dayDay, dayDaysInMonth, dayDiff, dayFromAny, dayFromDate, dayFromDateGMT, dayFromDateUTC, dayFromParts, dayFromString, dayFromTimestamp, dayFromTimestampSeconds, dayFromToday, dayIterator, dayMonth, dayMonthOffset, dayMonthStart, dayOffset, dayRange, dayToDate, dayToDateGMT, dayToDateUTC, dayToParts, dayToString, dayToTimestamp, dayToTimestampSeconds, dayYear, dayYearOffset, dayYearStart, debounce, deburr, decimal, decimalCentsPart, decimalFromCents, decimalToCents, decodeBase16, decodeBase32, decodeBase58, decodeBase62, decodeJson, decrypt, decryptAesGcm, decryptXAES, deepEqual, deepMerge, deepStripUndefinedInPlace, deriveKeyPbkdf2, deriveKeyPbkdf2CBC, deserializeSchema, detect, diffObjects, digest, distributedFilePath, double, duration, empty, encodeBase16, encodeBase32, encodeBase58, encodeBase62, encodeJson, encodeQuery, encrypt, encryptAesGcm, encryptXAES, endSortWeight, ensureKey, ensureKeyAsync, ensureUint8Array, eq, equalBinary, escapeHTML, escapeRegExp, estimateSizeForBase, exportKeyXAES, fatal, fetchBasic, fetchJson, fetchOptionsBasicAuth, fetchOptionsFormURLEncoded, fetchOptionsJson, fetchText, first, fixBrokenUtf8String, float, forEachDay, forTimes, formatBytesToHumanBase1000, formatBytesToHumanBase1024, formatMessages, formatMilliseconds, formatSecondsToTime, from, fromBase64, fromBase64String, fromCamelCase, fromHex, func, generateKeyXAES, getBuildNumber, getGlobal, getGlobalConsole, getGlobalContext, getGlobalEmitter, getGlobalLogger, getGlobalLoggerIfExists, getLocalStorage, getNamespaceFilterString, getNavigator, getPerformanceTimestamp, getSecondsFromBuildNumber, getSecureRandom, getSecureRandomIfPossible, getTimestamp, getTimestampInSeconds, getWindow, globalAny, gt, gte, helpSchemaArgs, hex, immediate, importKeyXAES, inArray, int, isArray, isBinaryArray, isBoolean, isBrowser, isColumn, isEmpty, isEven, isFunction, isHalf, isInteger, isLocalHost, isNotEmpty, isNotNull, isNull, isNullOrUndefined, isNumber, isObject, isPrime, isPrimeRX, isPrimitive, isPromise, isRecord, isRecordPlain, isSafeInteger, isSchemaDefault, isSchemaObject, isSchemaObjectFlat, isSchemaOptional, isSchemaPrimitive, isString, isSymbol, isTimeout, isTruthy, isUint8Array, isValue, joinLogStrings, joinToUint8Array, jsonParse, jsonStringify, jsonStringifySafe, jsonStringifySorted, jsonToUint8Array, last, like, linkifyPlainText, linkifyPlainTextSimple, linkifyPlainTextWithLineBreaks, listDistinctUnion, listGroupBy, listOfKey, listQuery, literal, logCaptureConsole, logMessageFromCompact, lt, lte, memoize, memoizeAsync, moveSortWeight, ne, none, noop, noopDisposer, not, number, numberToBase32, object, objectAssignDeepInPlace, objectAssignDescriptionInPlace, objectDescribeChange, objectFilter, objectInclusivePick, objectIsEmpty, objectMap, objectMergeDisposable, objectOmit, objectPick, objectPlain, or, parseBasicAuth, parseDate, parseFloat, parseInt, parseLogLevel, parseOrderby, parseQuery, parseSchemaArgs, parseSchemaEnv, polyfillUsing, promisify, qid, randomBoolean, randomFloat, randomInt, randomUint8Array, real, record, regExpEscape, regExpString, renderMessages, roundArrayOfNumbersToMatchSum, roundArrayOfObjectsToMatchSum, roundDown, roundHalfAwayFromZero, roundHalfDown, roundHalfEven, roundHalfOdd, roundHalfTowardsZero, roundHalfUp, roundUp, rpc, safeTimeout, schemaCreateObject, schemaExportJsonSchema, schemaExportJsonSchemaString, schemaExportSwiftStruct, schemaExportTypescriptInterface, schemaParseObject, schemaValidateObject, seededRandom, select, serializeSchema, setDayTest, setTestMode, setTimestampTest, setUuidDefaultEncoding, size, sleep, sortedItems, sortedOrderby, sqlIsNotNull, sqlIsNull, startSortWeight, str, string, stringFromSchemaEnv, stringHashFNV1a, stringLiterals, stringToBoolean, stringToBytes, stringToFloat, stringToInteger, stringToUInt8Array, suid, suidBytes, suidBytesDate, suidDate, sum, table, throttle, timeout, timestampMillisecondsToSeconds, timestampSecondsToMilliseconds, toArrayBuffer, toBase64, toBase64Url, toBool, toCamelCase, toCapitalize, toCapitalizeWords, toFloat, toHex, toHumanReadableUrl, toInt, toString, toUint8Array, toValidFilename, today, tryTimeout, tuple, uname, unameReset, unescapeHTML, union, useAsyncMutex, useBase, useDefer, useDispose, useDisposeWithUtils, useEventListener, useEventListenerOnce, useExitHandler, useInterval, useIntervalPause, useLevelFilter, useMessageHub, useMutex, useNamespaceFilter, usePool, usePubSub, useRPC, useRPCHub, useSignal, useSorted, useStringHashPool, useTimeout, utf8, utils, uuid, uuid32bit, uuidB32, uuidB62, uuidBytes, uuidDecode, uuidDecodeB32, uuidDecodeB62, uuidDecodeV4, uuidEncode, uuidEncodeB32, uuidEncodeB62, uuidEncodeV4, uuidIsValid, uuidv4, valueToBoolean, valueToBooleanNotFalse, valueToFloat, valueToInteger, valueToString, waitOn, wordsToUint8Array, z_collection_exports as z };
|
package/dist/common/msg/rpc.cjs
CHANGED
|
@@ -30,10 +30,10 @@ function setupRPCBasic(options, functions, eventNames = []) {
|
|
|
30
30
|
try {
|
|
31
31
|
const msg = await deserialize(data);
|
|
32
32
|
const mode = msg?.[0];
|
|
33
|
-
const id = mode ===
|
|
34
|
-
const [method, ...args] = msg.slice(mode ===
|
|
33
|
+
const id = mode === 2 ? 0 : msg?.[1];
|
|
34
|
+
const [method, ...args] = msg.slice(mode === 2 ? 1 : 2);
|
|
35
35
|
const methodName = stringHashPool?.stringForHash(method) ?? method;
|
|
36
|
-
if (mode ===
|
|
36
|
+
if (mode === 1 || mode === 2) {
|
|
37
37
|
let result, error;
|
|
38
38
|
if (method != null) try {
|
|
39
39
|
const fn = functions[methodName];
|
|
@@ -47,11 +47,11 @@ function setupRPCBasic(options, functions, eventNames = []) {
|
|
|
47
47
|
onError?.(error, method ?? "", args);
|
|
48
48
|
}
|
|
49
49
|
if (id > 0) await post(await serialize(error ? [
|
|
50
|
-
|
|
50
|
+
4,
|
|
51
51
|
id,
|
|
52
52
|
error
|
|
53
53
|
] : [
|
|
54
|
-
|
|
54
|
+
3,
|
|
55
55
|
id,
|
|
56
56
|
result
|
|
57
57
|
]));
|
|
@@ -59,7 +59,7 @@ function setupRPCBasic(options, functions, eventNames = []) {
|
|
|
59
59
|
const promise = rpcPromiseMap.get(id);
|
|
60
60
|
if (promise != null) {
|
|
61
61
|
clearTimeout(promise.timeoutId);
|
|
62
|
-
if (mode ===
|
|
62
|
+
if (mode === 4 && exceptions === true) promise.reject(method);
|
|
63
63
|
else promise.resolve(method);
|
|
64
64
|
}
|
|
65
65
|
rpcPromiseMap.delete(id);
|
|
@@ -75,7 +75,7 @@ function setupRPCBasic(options, functions, eventNames = []) {
|
|
|
75
75
|
proxyHandler: { get(_, methodName) {
|
|
76
76
|
const method = stringHashPool?.hash(methodName) ?? methodName;
|
|
77
77
|
const sendEvent = async (...args) => await post(await serialize([
|
|
78
|
-
|
|
78
|
+
2,
|
|
79
79
|
method,
|
|
80
80
|
...args
|
|
81
81
|
]));
|
|
@@ -105,7 +105,7 @@ function setupRPCBasic(options, functions, eventNames = []) {
|
|
|
105
105
|
timeoutId
|
|
106
106
|
});
|
|
107
107
|
await post(await serialize([
|
|
108
|
-
|
|
108
|
+
1,
|
|
109
109
|
id,
|
|
110
110
|
method,
|
|
111
111
|
...args
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.cjs","names":["createPromise"],"sources":["../../../src/common/msg/rpc.ts"],"sourcesContent":["// From https://github.com/antfu/birpc/blob/main/src/index.ts MIT\n\nimport type { UseStringHashPool } from '../data/string-hash-pool'\nimport type { LoggerInterface } from '../log/log-base'\nimport type { Pipe } from './pipe'\nimport { createPromise } from '../exec/promise'\n\nexport type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never\nexport type ReturnType<T> = T extends (...args: any) => infer R ? R : never\n\nexport interface RPCOptionsBasic extends Pipe {\n /** No return values expected */\n onlyEvents?: boolean\n /** Maximum timeout for waiting for response, in milliseconds */\n timeout?: number\n /** Custom logger */\n log?: LoggerInterface\n /** Custom error handler */\n onError?: (error: Error, functionName: string, args: any[]) => boolean | void\n /** Custom error handler for timeouts */\n onTimeoutError?: (functionName: string, args: any[]) => boolean | void\n /** Throw execptions. Default: true */\n exceptions?: boolean\n /** */\n stringHashPool?: UseStringHashPool\n}\n\nexport interface RPCOptions<Remote> extends RPCOptionsBasic {\n // /** No return values expected */\n // onlyEvents?: boolean\n /** Names of remote functions that do not need response. */\n eventNames?: (keyof Remote)[]\n}\n\nexport interface RPCFn<T> {\n /** Call the remote function and wait for the result. */\n (...args: ArgumentsType<T>): Promise<Awaited<ReturnType<T>>>\n /** Send event without asking for response */\n asEvent: (...args: ArgumentsType<T>) => void\n}\n\nexport type RPCReturn<RemoteFunctions> = {\n [K in keyof RemoteFunctions]: RPCFn<RemoteFunctions[K]>\n}\n\nlet rpcCounter = 1\n\nexport enum RPCMode {\n request = 1,\n event = 2,\n resolve = 3,\n reject = 4,\n}\n\nexport type RPCMessage = [\n mode: RPCMode,\n id: number,\n method: string | number | any,\n ...any,\n]\n\nconst defaultSerialize = (i: any) => i\nconst defaultDeserialize = defaultSerialize\n\nfunction setupRPCBasic(options: RPCOptionsBasic, functions: Record<string, (...args: any) => Promise<any>>, eventNames: string[] = []) {\n const {\n log,\n post,\n on,\n serialize = defaultSerialize,\n deserialize = defaultDeserialize,\n timeout = 60e3,\n onError,\n onTimeoutError,\n onlyEvents = false,\n exceptions = true,\n stringHashPool,\n } = options\n\n if (stringHashPool) {\n Object.keys(functions).forEach(stringHashPool.hash)\n }\n\n function checkEventNames(eventNames: string[]) {\n // eventNames.forEach((n) => {\n // if (functions[n] == null)\n // throw new Error(`event name ${n} has no registered function`)\n // })\n }\n\n checkEventNames(eventNames)\n\n function registerFunctions(additionalFunctions: any) {\n Object.assign(functions, additionalFunctions ?? {})\n if (stringHashPool)\n Object.keys(additionalFunctions).forEach(stringHashPool.hash)\n }\n\n function registerEventNames(additionalEventNames: string[]) {\n checkEventNames(additionalEventNames)\n eventNames.push(...additionalEventNames)\n }\n\n const rpcPromiseMap = new Map<number, {\n resolve: (...args: any) => any\n reject: (...args: any) => any\n timeoutId: Parameters<typeof clearTimeout>[0]\n }>()\n\n on(async (data) => {\n try {\n const msg = await deserialize(data) as RPCMessage\n const mode = msg?.[0]\n const id = mode === RPCMode.event ? 0 : msg?.[1]\n const [method, ...args] = msg.slice(mode === RPCMode.event ? 1 : 2)\n const methodName = stringHashPool?.stringForHash(method) ?? method\n if (mode === RPCMode.request || mode === RPCMode.event) {\n let result, error: any\n if (method != null) {\n try {\n const fn = functions[methodName]\n result = await fn(...args)\n }\n catch (e) {\n error = String(e)\n }\n }\n else {\n error = 'Method implementation missing'\n }\n if (error) {\n log?.warn('error', msg, error)\n onError?.(error, method ?? '', args)\n }\n if (id > 0) {\n const data = await serialize(error\n ? [RPCMode.reject, id, error]\n : [RPCMode.resolve, id, result])\n await post(data)\n }\n }\n else if (id) {\n const promise = rpcPromiseMap.get(id)\n if (promise != null) {\n clearTimeout(promise.timeoutId)\n if (mode === RPCMode.reject && exceptions === true)\n promise.reject(method)\n else\n promise.resolve(method)\n }\n rpcPromiseMap.delete(id)\n }\n }\n catch (err) {\n log?.warn('Error on handling RPC data. Invalid?', err, data)\n }\n })\n\n const proxyHandler = {\n get(_: any, methodName: string) {\n const method = stringHashPool?.hash(methodName) ?? methodName\n const sendEvent = async (...args: any[]) => await post(await serialize([RPCMode.event, method, ...args]))\n\n if (onlyEvents || eventNames.includes(methodName)) {\n sendEvent.asEvent = sendEvent\n return sendEvent\n }\n\n const sendCall = async (...args: any[]) => {\n const [promise, resolve, reject] = createPromise()\n const id = rpcCounter++\n\n let timeoutId: any\n if (timeout >= 0) {\n timeoutId = setTimeout(() => {\n try {\n // Custom onTimeoutError handler can throw its own error too\n onTimeoutError?.(methodName, args)\n throw new Error(`rpc timeout on calling \"${methodName}\"`)\n }\n catch (e) {\n if (exceptions === true)\n reject(e)\n else\n resolve(undefined)\n }\n rpcPromiseMap.delete(id)\n\n // Garbage Collection https://jakearchibald.com/2024/garbage-collection-and-closures/\n clearTimeout(timeoutId)\n timeoutId = undefined\n }, timeout).unref?.()\n }\n\n rpcPromiseMap.set(id, { resolve, reject, timeoutId })\n const data = await serialize([RPCMode.request, id, method, ...args])\n await post(data)\n return promise\n }\n sendCall.asEvent = sendEvent\n return sendCall\n },\n }\n\n return {\n post,\n serialize,\n rpcPromiseMap,\n proxyHandler,\n registerFunctions,\n registerEventNames,\n }\n}\n\nexport function useRPC<LocalFunctions, RemoteFunctions = LocalFunctions>(\n functions: LocalFunctions,\n options: RPCOptions<RemoteFunctions>,\n): RPCReturn<RemoteFunctions> {\n const { eventNames = [] } = options\n\n const { proxyHandler } = setupRPCBasic(options, functions as any, eventNames as any)\n\n return new Proxy({}, proxyHandler)\n}\n\nexport function useRPCHub(options: RPCOptionsBasic) {\n const eventNames: string[] = []\n const functions: Record<string, any> = {}\n\n const {\n proxyHandler,\n registerFunctions,\n registerEventNames,\n } = setupRPCBasic(options, functions, eventNames)\n\n function createRPCProxy() {\n return new Proxy({}, proxyHandler)\n }\n\n return function<LocalFunctions, RemoteFunctions = LocalFunctions>(\n additionalFunctions?: LocalFunctions,\n additionalEventNames: string[] = [],\n ): RPCReturn<RemoteFunctions> {\n registerFunctions(additionalFunctions ?? {})\n registerEventNames(additionalEventNames)\n return createRPCProxy()\n }\n}\n\nexport type UseRPCHubType = ReturnType<typeof useRPCHub>\n\n// Syntax test case\n// async function _demo() {\n// const hub: UseRPCHubType = {} as any\n// const x = hub({\n// test(name: string): string {\n// return name\n// },\n// })\n// await x.test('dsd')\n// }\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"rpc.cjs","names":["createPromise"],"sources":["../../../src/common/msg/rpc.ts"],"sourcesContent":["// From https://github.com/antfu/birpc/blob/main/src/index.ts MIT\n\nimport type { UseStringHashPool } from '../data/string-hash-pool'\nimport type { LoggerInterface } from '../log/log-base'\nimport type { Pipe } from './pipe'\nimport { createPromise } from '../exec/promise'\n\nexport type ArgumentsType<T> = T extends (...args: infer A) => any ? A : never\nexport type ReturnType<T> = T extends (...args: any) => infer R ? R : never\n\nexport interface RPCOptionsBasic extends Pipe {\n /** No return values expected */\n onlyEvents?: boolean\n /** Maximum timeout for waiting for response, in milliseconds */\n timeout?: number\n /** Custom logger */\n log?: LoggerInterface\n /** Custom error handler */\n onError?: (error: Error, functionName: string, args: any[]) => boolean | void\n /** Custom error handler for timeouts */\n onTimeoutError?: (functionName: string, args: any[]) => boolean | void\n /** Throw execptions. Default: true */\n exceptions?: boolean\n /** */\n stringHashPool?: UseStringHashPool\n}\n\nexport interface RPCOptions<Remote> extends RPCOptionsBasic {\n // /** No return values expected */\n // onlyEvents?: boolean\n /** Names of remote functions that do not need response. */\n eventNames?: (keyof Remote)[]\n}\n\nexport interface RPCFn<T> {\n /** Call the remote function and wait for the result. */\n (...args: ArgumentsType<T>): Promise<Awaited<ReturnType<T>>>\n /** Send event without asking for response */\n asEvent: (...args: ArgumentsType<T>) => void\n}\n\nexport type RPCReturn<RemoteFunctions> = {\n [K in keyof RemoteFunctions]: RPCFn<RemoteFunctions[K]>\n}\n\nlet rpcCounter = 1\n\nexport enum RPCMode {\n request = 1,\n event = 2,\n resolve = 3,\n reject = 4,\n}\n\nexport type RPCMessage = [\n mode: RPCMode,\n id: number,\n method: string | number | any,\n ...any,\n]\n\nconst defaultSerialize = (i: any) => i\nconst defaultDeserialize = defaultSerialize\n\nfunction setupRPCBasic(options: RPCOptionsBasic, functions: Record<string, (...args: any) => Promise<any>>, eventNames: string[] = []) {\n const {\n log,\n post,\n on,\n serialize = defaultSerialize,\n deserialize = defaultDeserialize,\n timeout = 60e3,\n onError,\n onTimeoutError,\n onlyEvents = false,\n exceptions = true,\n stringHashPool,\n } = options\n\n if (stringHashPool) {\n Object.keys(functions).forEach(stringHashPool.hash)\n }\n\n function checkEventNames(eventNames: string[]) {\n // eventNames.forEach((n) => {\n // if (functions[n] == null)\n // throw new Error(`event name ${n} has no registered function`)\n // })\n }\n\n checkEventNames(eventNames)\n\n function registerFunctions(additionalFunctions: any) {\n Object.assign(functions, additionalFunctions ?? {})\n if (stringHashPool)\n Object.keys(additionalFunctions).forEach(stringHashPool.hash)\n }\n\n function registerEventNames(additionalEventNames: string[]) {\n checkEventNames(additionalEventNames)\n eventNames.push(...additionalEventNames)\n }\n\n const rpcPromiseMap = new Map<number, {\n resolve: (...args: any) => any\n reject: (...args: any) => any\n timeoutId: Parameters<typeof clearTimeout>[0]\n }>()\n\n on(async (data) => {\n try {\n const msg = await deserialize(data) as RPCMessage\n const mode = msg?.[0]\n const id = mode === RPCMode.event ? 0 : msg?.[1]\n const [method, ...args] = msg.slice(mode === RPCMode.event ? 1 : 2)\n const methodName = stringHashPool?.stringForHash(method) ?? method\n if (mode === RPCMode.request || mode === RPCMode.event) {\n let result, error: any\n if (method != null) {\n try {\n const fn = functions[methodName]\n result = await fn(...args)\n }\n catch (e) {\n error = String(e)\n }\n }\n else {\n error = 'Method implementation missing'\n }\n if (error) {\n log?.warn('error', msg, error)\n onError?.(error, method ?? '', args)\n }\n if (id > 0) {\n const data = await serialize(error\n ? [RPCMode.reject, id, error]\n : [RPCMode.resolve, id, result])\n await post(data)\n }\n }\n else if (id) {\n const promise = rpcPromiseMap.get(id)\n if (promise != null) {\n clearTimeout(promise.timeoutId)\n if (mode === RPCMode.reject && exceptions === true)\n promise.reject(method)\n else\n promise.resolve(method)\n }\n rpcPromiseMap.delete(id)\n }\n }\n catch (err) {\n log?.warn('Error on handling RPC data. Invalid?', err, data)\n }\n })\n\n const proxyHandler = {\n get(_: any, methodName: string) {\n const method = stringHashPool?.hash(methodName) ?? methodName\n const sendEvent = async (...args: any[]) => await post(await serialize([RPCMode.event, method, ...args]))\n\n if (onlyEvents || eventNames.includes(methodName)) {\n sendEvent.asEvent = sendEvent\n return sendEvent\n }\n\n const sendCall = async (...args: any[]) => {\n const [promise, resolve, reject] = createPromise()\n const id = rpcCounter++\n\n let timeoutId: any\n if (timeout >= 0) {\n timeoutId = setTimeout(() => {\n try {\n // Custom onTimeoutError handler can throw its own error too\n onTimeoutError?.(methodName, args)\n throw new Error(`rpc timeout on calling \"${methodName}\"`)\n }\n catch (e) {\n if (exceptions === true)\n reject(e)\n else\n resolve(undefined)\n }\n rpcPromiseMap.delete(id)\n\n // Garbage Collection https://jakearchibald.com/2024/garbage-collection-and-closures/\n clearTimeout(timeoutId)\n timeoutId = undefined\n }, timeout).unref?.()\n }\n\n rpcPromiseMap.set(id, { resolve, reject, timeoutId })\n const data = await serialize([RPCMode.request, id, method, ...args])\n await post(data)\n return promise\n }\n sendCall.asEvent = sendEvent\n return sendCall\n },\n }\n\n return {\n post,\n serialize,\n rpcPromiseMap,\n proxyHandler,\n registerFunctions,\n registerEventNames,\n }\n}\n\nexport function useRPC<LocalFunctions, RemoteFunctions = LocalFunctions>(\n functions: LocalFunctions,\n options: RPCOptions<RemoteFunctions>,\n): RPCReturn<RemoteFunctions> {\n const { eventNames = [] } = options\n\n const { proxyHandler } = setupRPCBasic(options, functions as any, eventNames as any)\n\n return new Proxy({}, proxyHandler)\n}\n\nexport function useRPCHub(options: RPCOptionsBasic) {\n const eventNames: string[] = []\n const functions: Record<string, any> = {}\n\n const {\n proxyHandler,\n registerFunctions,\n registerEventNames,\n } = setupRPCBasic(options, functions, eventNames)\n\n function createRPCProxy() {\n return new Proxy({}, proxyHandler)\n }\n\n return function<LocalFunctions, RemoteFunctions = LocalFunctions>(\n additionalFunctions?: LocalFunctions,\n additionalEventNames: string[] = [],\n ): RPCReturn<RemoteFunctions> {\n registerFunctions(additionalFunctions ?? {})\n registerEventNames(additionalEventNames)\n return createRPCProxy()\n }\n}\n\nexport type UseRPCHubType = ReturnType<typeof useRPCHub>\n\n// Syntax test case\n// async function _demo() {\n// const hub: UseRPCHubType = {} as any\n// const x = hub({\n// test(name: string): string {\n// return name\n// },\n// })\n// await x.test('dsd')\n// }\n"],"mappings":"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"}
|
package/dist/common/msg/rpc.mjs
CHANGED
|
@@ -29,10 +29,10 @@ function setupRPCBasic(options, functions, eventNames = []) {
|
|
|
29
29
|
try {
|
|
30
30
|
const msg = await deserialize(data);
|
|
31
31
|
const mode = msg?.[0];
|
|
32
|
-
const id = mode ===
|
|
33
|
-
const [method, ...args] = msg.slice(mode ===
|
|
32
|
+
const id = mode === 2 ? 0 : msg?.[1];
|
|
33
|
+
const [method, ...args] = msg.slice(mode === 2 ? 1 : 2);
|
|
34
34
|
const methodName = stringHashPool?.stringForHash(method) ?? method;
|
|
35
|
-
if (mode ===
|
|
35
|
+
if (mode === 1 || mode === 2) {
|
|
36
36
|
let result, error;
|
|
37
37
|
if (method != null) try {
|
|
38
38
|
const fn = functions[methodName];
|
|
@@ -46,11 +46,11 @@ function setupRPCBasic(options, functions, eventNames = []) {
|
|
|
46
46
|
onError?.(error, method ?? "", args);
|
|
47
47
|
}
|
|
48
48
|
if (id > 0) await post(await serialize(error ? [
|
|
49
|
-
|
|
49
|
+
4,
|
|
50
50
|
id,
|
|
51
51
|
error
|
|
52
52
|
] : [
|
|
53
|
-
|
|
53
|
+
3,
|
|
54
54
|
id,
|
|
55
55
|
result
|
|
56
56
|
]));
|
|
@@ -58,7 +58,7 @@ function setupRPCBasic(options, functions, eventNames = []) {
|
|
|
58
58
|
const promise = rpcPromiseMap.get(id);
|
|
59
59
|
if (promise != null) {
|
|
60
60
|
clearTimeout(promise.timeoutId);
|
|
61
|
-
if (mode ===
|
|
61
|
+
if (mode === 4 && exceptions === true) promise.reject(method);
|
|
62
62
|
else promise.resolve(method);
|
|
63
63
|
}
|
|
64
64
|
rpcPromiseMap.delete(id);
|
|
@@ -74,7 +74,7 @@ function setupRPCBasic(options, functions, eventNames = []) {
|
|
|
74
74
|
proxyHandler: { get(_, methodName) {
|
|
75
75
|
const method = stringHashPool?.hash(methodName) ?? methodName;
|
|
76
76
|
const sendEvent = async (...args) => await post(await serialize([
|
|
77
|
-
|
|
77
|
+
2,
|
|
78
78
|
method,
|
|
79
79
|
...args
|
|
80
80
|
]));
|
|
@@ -104,7 +104,7 @@ function setupRPCBasic(options, functions, eventNames = []) {
|
|
|
104
104
|
timeoutId
|
|
105
105
|
});
|
|
106
106
|
await post(await serialize([
|
|
107
|
-
|
|
107
|
+
1,
|
|
108
108
|
id,
|
|
109
109
|
method,
|
|
110
110
|
...args
|