amiudmodz 6.2.9 → 6.3.1
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/lib/Foundation/ai-rich.d.ts +123 -0
- package/lib/Foundation/ai-rich.d.ts.map +1 -0
- package/lib/Foundation/ai-rich.js +542 -0
- package/lib/Foundation/ai-rich.js.map +1 -0
- package/lib/Foundation/audio-duration.d.ts +3 -0
- package/lib/Foundation/audio-duration.d.ts.map +1 -0
- package/lib/Foundation/audio-duration.js +514 -0
- package/lib/Foundation/audio-duration.js.map +1 -0
- package/lib/Foundation/audio-samples.d.ts +3 -0
- package/lib/Foundation/audio-samples.d.ts.map +1 -0
- package/lib/Foundation/audio-samples.js +294 -0
- package/lib/Foundation/audio-samples.js.map +1 -0
- package/lib/Foundation/boom.d.ts +17 -0
- package/lib/Foundation/boom.d.ts.map +1 -0
- package/lib/Foundation/boom.js +37 -0
- package/lib/Foundation/boom.js.map +1 -0
- package/lib/Foundation/cache.d.ts +25 -0
- package/lib/Foundation/cache.d.ts.map +1 -0
- package/lib/Foundation/cache.js +112 -0
- package/lib/Foundation/cache.js.map +1 -0
- package/lib/Foundation/concurrency.d.ts +13 -0
- package/lib/Foundation/concurrency.d.ts.map +1 -0
- package/lib/Foundation/concurrency.js +62 -0
- package/lib/Foundation/concurrency.js.map +1 -0
- package/lib/Foundation/curve25519.d.ts +11 -0
- package/lib/Foundation/curve25519.d.ts.map +1 -0
- package/lib/Foundation/curve25519.js +178 -0
- package/lib/Foundation/curve25519.js.map +1 -0
- package/lib/Foundation/image-thumb.d.ts +13 -0
- package/lib/Foundation/image-thumb.d.ts.map +1 -0
- package/lib/Foundation/image-thumb.js +65 -0
- package/lib/Foundation/image-thumb.js.map +1 -0
- package/lib/Foundation/link-preview.d.ts +29 -0
- package/lib/Foundation/link-preview.d.ts.map +1 -0
- package/lib/Foundation/link-preview.js +309 -0
- package/lib/Foundation/link-preview.js.map +1 -0
- package/lib/Foundation/logger.d.ts +31 -0
- package/lib/Foundation/logger.d.ts.map +1 -0
- package/lib/Foundation/logger.js +54 -0
- package/lib/Foundation/logger.js.map +1 -0
- package/lib/Foundation/long.d.ts +33 -0
- package/lib/Foundation/long.d.ts.map +1 -0
- package/lib/Foundation/long.js +135 -0
- package/lib/Foundation/long.js.map +1 -0
- package/lib/Foundation/protobuf-minimal.d.ts +115 -0
- package/lib/Foundation/protobuf-minimal.d.ts.map +1 -0
- package/lib/Foundation/protobuf-minimal.js +614 -0
- package/lib/Foundation/protobuf-minimal.js.map +1 -0
- package/lib/Foundation/qrcode-terminal.d.ts +2 -0
- package/lib/Foundation/qrcode-terminal.d.ts.map +1 -0
- package/lib/Foundation/qrcode-terminal.js +405 -0
- package/lib/Foundation/qrcode-terminal.js.map +1 -0
- package/lib/Foundation/sql-database.d.ts +15 -0
- package/lib/Foundation/sql-database.d.ts.map +1 -0
- package/lib/Foundation/sql-database.js +719 -0
- package/lib/Foundation/sql-database.js.map +1 -0
- package/lib/Foundation/wa-crypto.d.ts +14 -0
- package/lib/Foundation/wa-crypto.d.ts.map +1 -0
- package/lib/Foundation/wa-crypto.js +48 -0
- package/lib/Foundation/wa-crypto.js.map +1 -0
- package/lib/Foundation/zip.d.ts +2 -0
- package/lib/Foundation/zip.d.ts.map +1 -0
- package/lib/Foundation/zip.js +98 -0
- package/lib/Foundation/zip.js.map +1 -0
- package/lib/Signal/libsignal.js +0 -3
- package/lib/Signal/libsignal.js.map +1 -1
- package/lib/Socket/business.d.ts +3 -1
- package/lib/Socket/business.d.ts.map +1 -1
- package/lib/Socket/communities.d.ts +3 -1
- package/lib/Socket/communities.d.ts.map +1 -1
- package/lib/Socket/index.d.ts.map +1 -1
- package/lib/Socket/index.js +19 -14
- package/lib/Socket/index.js.map +1 -1
- package/lib/Socket/messages-recv.d.ts +3 -1
- package/lib/Socket/messages-recv.d.ts.map +1 -1
- package/lib/Socket/messages-recv.js +6 -2
- package/lib/Socket/messages-recv.js.map +1 -1
- package/lib/Socket/messages-send.d.ts +3 -1
- package/lib/Socket/messages-send.d.ts.map +1 -1
- package/lib/Socket/messages-send.js +298 -52
- package/lib/Socket/messages-send.js.map +1 -1
- package/lib/Socket/newsletter.d.ts.map +1 -1
- package/lib/Socket/newsletter.js +4 -5
- package/lib/Socket/newsletter.js.map +1 -1
- package/lib/Utils/crypto.d.ts.map +1 -1
- package/lib/Utils/crypto.js +6 -7
- package/lib/Utils/crypto.js.map +1 -1
- package/lib/Utils/messages-media.d.ts.map +1 -1
- package/lib/Utils/messages-media.js +89 -26
- package/lib/Utils/messages-media.js.map +1 -1
- package/lib/Utils/messages.d.ts +6 -0
- package/lib/Utils/messages.d.ts.map +1 -1
- package/lib/Utils/messages.js +198 -27
- package/lib/Utils/messages.js.map +1 -1
- package/lib/VoIP/WaVoipCoordinator.d.ts +39 -0
- package/lib/VoIP/WaVoipCoordinator.d.ts.map +1 -0
- package/lib/VoIP/WaVoipCoordinator.js +156 -0
- package/lib/VoIP/WaVoipCoordinator.js.map +1 -0
- package/lib/VoIP/app-data/WaAppDataStream.d.ts +35 -0
- package/lib/VoIP/app-data/WaAppDataStream.d.ts.map +1 -0
- package/lib/VoIP/app-data/WaAppDataStream.js +174 -0
- package/lib/VoIP/app-data/WaAppDataStream.js.map +1 -0
- package/lib/VoIP/app-data/protocol.d.ts +28 -0
- package/lib/VoIP/app-data/protocol.d.ts.map +1 -0
- package/lib/VoIP/app-data/protocol.js +167 -0
- package/lib/VoIP/app-data/protocol.js.map +1 -0
- package/lib/VoIP/bytes.d.ts +19 -0
- package/lib/VoIP/bytes.d.ts.map +1 -0
- package/lib/VoIP/bytes.js +64 -0
- package/lib/VoIP/bytes.js.map +1 -0
- package/lib/VoIP/call/WaCallManager.d.ts +58 -0
- package/lib/VoIP/call/WaCallManager.d.ts.map +1 -0
- package/lib/VoIP/call/WaCallManager.js +434 -0
- package/lib/VoIP/call/WaCallManager.js.map +1 -0
- package/lib/VoIP/call/WaCallMediaSession.d.ts +143 -0
- package/lib/VoIP/call/WaCallMediaSession.d.ts.map +1 -0
- package/lib/VoIP/call/WaCallMediaSession.js +1674 -0
- package/lib/VoIP/call/WaCallMediaSession.js.map +1 -0
- package/lib/VoIP/call/call-state.d.ts +34 -0
- package/lib/VoIP/call/call-state.d.ts.map +1 -0
- package/lib/VoIP/call/call-state.js +189 -0
- package/lib/VoIP/call/call-state.js.map +1 -0
- package/lib/VoIP/crypto/encryption.d.ts +6 -0
- package/lib/VoIP/crypto/encryption.d.ts.map +1 -0
- package/lib/VoIP/crypto/encryption.js +14 -0
- package/lib/VoIP/crypto/encryption.js.map +1 -0
- package/lib/VoIP/crypto/primitives.d.ts +5 -0
- package/lib/VoIP/crypto/primitives.d.ts.map +1 -0
- package/lib/VoIP/crypto/primitives.js +22 -0
- package/lib/VoIP/crypto/primitives.js.map +1 -0
- package/lib/VoIP/crypto/rtcp.d.ts +6 -0
- package/lib/VoIP/crypto/rtcp.d.ts.map +1 -0
- package/lib/VoIP/crypto/rtcp.js +71 -0
- package/lib/VoIP/crypto/rtcp.js.map +1 -0
- package/lib/VoIP/crypto/srtp.d.ts +40 -0
- package/lib/VoIP/crypto/srtp.d.ts.map +1 -0
- package/lib/VoIP/crypto/srtp.js +174 -0
- package/lib/VoIP/crypto/srtp.js.map +1 -0
- package/lib/VoIP/crypto/ssrc.d.ts +4 -0
- package/lib/VoIP/crypto/ssrc.d.ts.map +1 -0
- package/lib/VoIP/crypto/ssrc.js +15 -0
- package/lib/VoIP/crypto/ssrc.js.map +1 -0
- package/lib/VoIP/index.d.ts +82 -104
- package/lib/VoIP/index.d.ts.map +1 -1
- package/lib/VoIP/index.js +596 -885
- package/lib/VoIP/index.js.map +1 -1
- package/lib/VoIP/media/WaAudioEngine.d.ts +79 -0
- package/lib/VoIP/media/WaAudioEngine.d.ts.map +1 -0
- package/lib/VoIP/media/WaAudioEngine.js +478 -0
- package/lib/VoIP/media/WaAudioEngine.js.map +1 -0
- package/lib/VoIP/media/WaVideoEngine.d.ts +31 -0
- package/lib/VoIP/media/WaVideoEngine.d.ts.map +1 -0
- package/lib/VoIP/media/WaVideoEngine.js +261 -0
- package/lib/VoIP/media/WaVideoEngine.js.map +1 -0
- package/lib/VoIP/media/audio-codec.d.ts +74 -0
- package/lib/VoIP/media/audio-codec.d.ts.map +1 -0
- package/lib/VoIP/media/audio-codec.js +0 -0
- package/lib/VoIP/media/audio-codec.js.map +1 -0
- package/lib/VoIP/media/audio-reorder.d.ts +19 -0
- package/lib/VoIP/media/audio-reorder.d.ts.map +1 -0
- package/lib/VoIP/media/audio-reorder.js +112 -0
- package/lib/VoIP/media/audio-reorder.js.map +1 -0
- package/lib/VoIP/media/h264.d.ts +21 -0
- package/lib/VoIP/media/h264.d.ts.map +1 -0
- package/lib/VoIP/media/h264.js +239 -0
- package/lib/VoIP/media/h264.js.map +1 -0
- package/lib/VoIP/media/mlow-codec.d.ts +77 -0
- package/lib/VoIP/media/mlow-codec.d.ts.map +1 -0
- package/lib/VoIP/media/mlow-codec.js +467 -0
- package/lib/VoIP/media/mlow-codec.js.map +1 -0
- package/lib/VoIP/media/rtcp.d.ts +10 -0
- package/lib/VoIP/media/rtcp.d.ts.map +1 -0
- package/lib/VoIP/media/rtcp.js +61 -0
- package/lib/VoIP/media/rtcp.js.map +1 -0
- package/lib/VoIP/media/rtp.d.ts +56 -0
- package/lib/VoIP/media/rtp.d.ts.map +1 -0
- package/lib/VoIP/media/rtp.js +225 -0
- package/lib/VoIP/media/rtp.js.map +1 -0
- package/lib/VoIP/protobuf.d.ts +3 -0
- package/lib/VoIP/protobuf.d.ts.map +1 -0
- package/lib/VoIP/protobuf.js +30 -0
- package/lib/VoIP/protobuf.js.map +1 -0
- package/lib/VoIP/relay/WaManualRelay.d.ts +62 -0
- package/lib/VoIP/relay/WaManualRelay.d.ts.map +1 -0
- package/lib/VoIP/relay/WaManualRelay.js +619 -0
- package/lib/VoIP/relay/WaManualRelay.js.map +1 -0
- package/lib/VoIP/relay/datachannel/pre-negotiated.d.ts +22 -0
- package/lib/VoIP/relay/datachannel/pre-negotiated.d.ts.map +1 -0
- package/lib/VoIP/relay/datachannel/pre-negotiated.js +34 -0
- package/lib/VoIP/relay/datachannel/pre-negotiated.js.map +1 -0
- package/lib/VoIP/relay/dtls/aead.d.ts +23 -0
- package/lib/VoIP/relay/dtls/aead.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/aead.js +41 -0
- package/lib/VoIP/relay/dtls/aead.js.map +1 -0
- package/lib/VoIP/relay/dtls/cert-builder.d.ts +6 -0
- package/lib/VoIP/relay/dtls/cert-builder.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/cert-builder.js +68 -0
- package/lib/VoIP/relay/dtls/cert-builder.js.map +1 -0
- package/lib/VoIP/relay/dtls/der.d.ts +19 -0
- package/lib/VoIP/relay/dtls/der.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/der.js +96 -0
- package/lib/VoIP/relay/dtls/der.js.map +1 -0
- package/lib/VoIP/relay/dtls/ecdhe.d.ts +9 -0
- package/lib/VoIP/relay/dtls/ecdhe.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/ecdhe.js +33 -0
- package/lib/VoIP/relay/dtls/ecdhe.js.map +1 -0
- package/lib/VoIP/relay/dtls/handshake-framing.d.ts +49 -0
- package/lib/VoIP/relay/dtls/handshake-framing.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/handshake-framing.js +102 -0
- package/lib/VoIP/relay/dtls/handshake-framing.js.map +1 -0
- package/lib/VoIP/relay/dtls/handshake-messages.d.ts +64 -0
- package/lib/VoIP/relay/dtls/handshake-messages.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/handshake-messages.js +154 -0
- package/lib/VoIP/relay/dtls/handshake-messages.js.map +1 -0
- package/lib/VoIP/relay/dtls/handshake.d.ts +28 -0
- package/lib/VoIP/relay/dtls/handshake.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/handshake.js +555 -0
- package/lib/VoIP/relay/dtls/handshake.js.map +1 -0
- package/lib/VoIP/relay/dtls/prf.d.ts +13 -0
- package/lib/VoIP/relay/dtls/prf.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/prf.js +35 -0
- package/lib/VoIP/relay/dtls/prf.js.map +1 -0
- package/lib/VoIP/relay/dtls/record.d.ts +25 -0
- package/lib/VoIP/relay/dtls/record.d.ts.map +1 -0
- package/lib/VoIP/relay/dtls/record.js +49 -0
- package/lib/VoIP/relay/dtls/record.js.map +1 -0
- package/lib/VoIP/relay/relay-ack.d.ts +31 -0
- package/lib/VoIP/relay/relay-ack.d.ts.map +1 -0
- package/lib/VoIP/relay/relay-ack.js +142 -0
- package/lib/VoIP/relay/relay-ack.js.map +1 -0
- package/lib/VoIP/relay/sctp/association.d.ts +22 -0
- package/lib/VoIP/relay/sctp/association.d.ts.map +1 -0
- package/lib/VoIP/relay/sctp/association.js +434 -0
- package/lib/VoIP/relay/sctp/association.js.map +1 -0
- package/lib/VoIP/relay/sctp/crc32c.d.ts +2 -0
- package/lib/VoIP/relay/sctp/crc32c.d.ts.map +1 -0
- package/lib/VoIP/relay/sctp/crc32c.js +20 -0
- package/lib/VoIP/relay/sctp/crc32c.js.map +1 -0
- package/lib/VoIP/relay/sctp/wire.d.ts +96 -0
- package/lib/VoIP/relay/sctp/wire.d.ts.map +1 -0
- package/lib/VoIP/relay/sctp/wire.js +206 -0
- package/lib/VoIP/relay/sctp/wire.js.map +1 -0
- package/lib/VoIP/relay/stun.d.ts +47 -0
- package/lib/VoIP/relay/stun.d.ts.map +1 -0
- package/lib/VoIP/relay/stun.js +459 -0
- package/lib/VoIP/relay/stun.js.map +1 -0
- package/lib/VoIP/shim/baileys-resolve.d.ts +2 -0
- package/lib/VoIP/shim/baileys-resolve.d.ts.map +1 -0
- package/lib/VoIP/shim/baileys-resolve.js +22 -0
- package/lib/VoIP/shim/baileys-resolve.js.map +1 -0
- package/lib/VoIP/shim/core.d.ts +32 -0
- package/lib/VoIP/shim/core.d.ts.map +1 -0
- package/lib/VoIP/shim/core.js +67 -0
- package/lib/VoIP/shim/core.js.map +1 -0
- package/lib/VoIP/shim/crypto.d.ts +2 -0
- package/lib/VoIP/shim/crypto.d.ts.map +1 -0
- package/lib/VoIP/shim/crypto.js +7 -0
- package/lib/VoIP/shim/crypto.js.map +1 -0
- package/lib/VoIP/shim/proto.d.ts +2 -0
- package/lib/VoIP/shim/proto.d.ts.map +1 -0
- package/lib/VoIP/shim/proto.js +10 -0
- package/lib/VoIP/shim/proto.js.map +1 -0
- package/lib/VoIP/shim/protocol.d.ts +32 -0
- package/lib/VoIP/shim/protocol.d.ts.map +1 -0
- package/lib/VoIP/shim/protocol.js +131 -0
- package/lib/VoIP/shim/protocol.js.map +1 -0
- package/lib/VoIP/shim/transport.d.ts +20 -0
- package/lib/VoIP/shim/transport.d.ts.map +1 -0
- package/lib/VoIP/shim/transport.js +83 -0
- package/lib/VoIP/shim/transport.js.map +1 -0
- package/lib/VoIP/shim/util.d.ts +13 -0
- package/lib/VoIP/shim/util.d.ts.map +1 -0
- package/lib/VoIP/shim/util.js +208 -0
- package/lib/VoIP/shim/util.js.map +1 -0
- package/lib/VoIP/signaling/bridge.d.ts +4 -0
- package/lib/VoIP/signaling/bridge.d.ts.map +1 -0
- package/lib/VoIP/signaling/bridge.js +103 -0
- package/lib/VoIP/signaling/bridge.js.map +1 -0
- package/lib/VoIP/signaling/screen-share.d.ts +40 -0
- package/lib/VoIP/signaling/screen-share.d.ts.map +1 -0
- package/lib/VoIP/signaling/screen-share.js +55 -0
- package/lib/VoIP/signaling/screen-share.js.map +1 -0
- package/lib/VoIP/signaling/signaling.d.ts +396 -0
- package/lib/VoIP/signaling/signaling.d.ts.map +1 -0
- package/lib/VoIP/signaling/signaling.js +488 -0
- package/lib/VoIP/signaling/signaling.js.map +1 -0
- package/lib/VoIP/types.d.ts +37 -12
- package/lib/VoIP/types.d.ts.map +1 -1
- package/lib/VoIP/types.js +65 -12
- package/lib/VoIP/types.js.map +1 -1
- package/lib/VoIP/voip-deps.d.ts +46 -0
- package/lib/VoIP/voip-deps.d.ts.map +1 -0
- package/lib/VoIP/voip-deps.js +244 -0
- package/lib/VoIP/voip-deps.js.map +1 -0
- package/lib/VoIP/voipClient.d.ts +34 -0
- package/lib/VoIP/voipClient.d.ts.map +1 -0
- package/lib/VoIP/voipClient.js +351 -0
- package/lib/VoIP/voipClient.js.map +1 -0
- package/lib/VoIP/wasm-engine.d.ts +2 -2
- package/lib/WABinary/decode.d.ts.map +1 -1
- package/lib/WABinary/decode.js +10 -0
- package/lib/WABinary/decode.js.map +1 -1
- package/lib/WABinary/encode.d.ts.map +1 -1
- package/lib/WABinary/encode.js +10 -0
- package/lib/WABinary/encode.js.map +1 -1
- package/lib/WABinary/generic-utils.js +1 -1
- package/lib/WABinary/generic-utils.js.map +1 -1
- package/lib/WABinary/jid-utils.d.ts.map +1 -1
- package/lib/WABinary/jid-utils.js +18 -17
- package/lib/WABinary/jid-utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,719 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
+
};
|
|
12
|
+
var _SqlDatabase_instances, _SqlDatabase_tables, _SqlDatabase_indexes, _SqlDatabase_undo, _SqlDatabase_pending, _SqlDatabase_inTxn, _SqlDatabase_path, _SqlDatabase_logBytes, _SqlDatabase_baseBytes, _SqlDatabase_closed, _SqlDatabase_assertOpen, _SqlDatabase_invoke, _SqlDatabase_control, _SqlDatabase_statement, _SqlDatabase_commit, _SqlDatabase_rollback, _SqlDatabase_undoTo, _SqlDatabase_end, _SqlDatabase_execute, _SqlDatabase_table, _SqlDatabase_column, _SqlDatabase_isPrimaryKey, _SqlDatabase_value, _SqlDatabase_checkNotNull, _SqlDatabase_createTable, _SqlDatabase_createIndex, _SqlDatabase_insert, _SqlDatabase_upsertConflict, _SqlDatabase_deleteRows, _SqlDatabase_selectRows, _SqlDatabase_match, _SqlDatabase_candidates, _SqlDatabase_addEntry, _SqlDatabase_removeEntry, _SqlDatabase_indexRow, _SqlDatabase_unindexRow, _SqlDatabase_storeRow, _SqlDatabase_removeRow, _SqlDatabase_restoreRow, _SqlDatabase_open, _SqlDatabase_replay, _SqlDatabase_append, _SqlDatabase_maybeCompact, _SqlDatabase_compact;
|
|
13
|
+
import { appendFileSync, existsSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
14
|
+
const MAGIC = '{"nsql":1}';
|
|
15
|
+
const COMPACT_MIN_BYTES = 256 * 1024;
|
|
16
|
+
const COMPACT_GROWTH_RATIO = 0.5;
|
|
17
|
+
const CONTROL = new Set(['begin', 'commit', 'rollback']);
|
|
18
|
+
const TOKEN = /\s+|'((?:[^']|'')*)'|"([^"]*)"|`([^`]*)`|\[([^\]]*)\]|(\d+\.?\d*(?:[eE][+-]?\d+)?|\.\d+(?:[eE][+-]?\d+)?)|([A-Za-z_]\w*)|([(),;=?*.-])/y;
|
|
19
|
+
class SqlError extends Error {
|
|
20
|
+
constructor(message) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = 'SqlError';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const lower = name => name.toLowerCase();
|
|
26
|
+
const keyOf = (table, row) => JSON.stringify(table.pk.map(i => row[i]));
|
|
27
|
+
const sameRow = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
|
|
28
|
+
const bind = (count, params) => {
|
|
29
|
+
if (params.length !== count)
|
|
30
|
+
throw new SqlError(`expected ${count} parameters, got ${params.length}`);
|
|
31
|
+
return params.map(value => {
|
|
32
|
+
if (value === null || typeof value === 'string')
|
|
33
|
+
return value;
|
|
34
|
+
if (typeof value === 'boolean')
|
|
35
|
+
return Number(value);
|
|
36
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
37
|
+
return value;
|
|
38
|
+
throw new SqlError(`unsupported parameter type: ${typeof value}`);
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const tokenize = sql => {
|
|
42
|
+
const tokens = [];
|
|
43
|
+
TOKEN.lastIndex = 0;
|
|
44
|
+
while (TOKEN.lastIndex < sql.length) {
|
|
45
|
+
const at = TOKEN.lastIndex;
|
|
46
|
+
const m = TOKEN.exec(sql);
|
|
47
|
+
if (!m)
|
|
48
|
+
throw new SqlError(`unexpected character at offset ${at}`);
|
|
49
|
+
const end = TOKEN.lastIndex;
|
|
50
|
+
let token = null;
|
|
51
|
+
if (m[1] !== undefined)
|
|
52
|
+
token = { k: 'str', v: m[1].replace(/''/g, "'") };
|
|
53
|
+
else if (m[5] !== undefined)
|
|
54
|
+
token = { k: 'num', v: Number(m[5]) };
|
|
55
|
+
else if (m[6] !== undefined)
|
|
56
|
+
token = { k: 'id', v: m[6] };
|
|
57
|
+
else if (m[7] !== undefined)
|
|
58
|
+
token = { k: 'p', v: m[7] };
|
|
59
|
+
else if (m[2] !== undefined || m[3] !== undefined || m[4] !== undefined)
|
|
60
|
+
token = { k: 'id', v: m[2] ?? m[3] ?? m[4] };
|
|
61
|
+
if (token)
|
|
62
|
+
tokens.push({ ...token, at, end });
|
|
63
|
+
}
|
|
64
|
+
tokens.push({ k: 'eof', at: sql.length, end: sql.length });
|
|
65
|
+
return tokens;
|
|
66
|
+
};
|
|
67
|
+
class Parser {
|
|
68
|
+
constructor(tokens) {
|
|
69
|
+
this.tokens = tokens;
|
|
70
|
+
this.pos = 0;
|
|
71
|
+
this.params = 0;
|
|
72
|
+
}
|
|
73
|
+
peek() {
|
|
74
|
+
return this.tokens[this.pos];
|
|
75
|
+
}
|
|
76
|
+
next() {
|
|
77
|
+
return this.tokens[this.pos++];
|
|
78
|
+
}
|
|
79
|
+
isKw(word) {
|
|
80
|
+
const t = this.peek();
|
|
81
|
+
return t.k === 'id' && t.v.toUpperCase() === word;
|
|
82
|
+
}
|
|
83
|
+
eatKw(word) {
|
|
84
|
+
if (!this.isKw(word))
|
|
85
|
+
return false;
|
|
86
|
+
this.pos++;
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
expectKw(word) {
|
|
90
|
+
if (!this.eatKw(word))
|
|
91
|
+
throw new SqlError(`expected ${word}`);
|
|
92
|
+
}
|
|
93
|
+
isP(ch) {
|
|
94
|
+
const t = this.peek();
|
|
95
|
+
return t.k === 'p' && t.v === ch;
|
|
96
|
+
}
|
|
97
|
+
eatP(ch) {
|
|
98
|
+
if (!this.isP(ch))
|
|
99
|
+
return false;
|
|
100
|
+
this.pos++;
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
expectP(ch) {
|
|
104
|
+
if (!this.eatP(ch))
|
|
105
|
+
throw new SqlError(`expected '${ch}'`);
|
|
106
|
+
}
|
|
107
|
+
ident() {
|
|
108
|
+
const t = this.next();
|
|
109
|
+
if (t.k !== 'id')
|
|
110
|
+
throw new SqlError('expected identifier');
|
|
111
|
+
return t.v;
|
|
112
|
+
}
|
|
113
|
+
identList() {
|
|
114
|
+
this.expectP('(');
|
|
115
|
+
const names = [this.ident()];
|
|
116
|
+
while (this.eatP(','))
|
|
117
|
+
names.push(this.ident());
|
|
118
|
+
this.expectP(')');
|
|
119
|
+
return names;
|
|
120
|
+
}
|
|
121
|
+
operand() {
|
|
122
|
+
const t = this.next();
|
|
123
|
+
if (t.k === 'str' || t.k === 'num')
|
|
124
|
+
return { kind: 'lit', value: t.v };
|
|
125
|
+
if (t.k === 'p' && t.v === '?')
|
|
126
|
+
return { kind: 'param', index: this.params++ };
|
|
127
|
+
if (t.k === 'p' && t.v === '-' && this.peek().k === 'num')
|
|
128
|
+
return { kind: 'lit', value: -this.next().v };
|
|
129
|
+
if (t.k === 'id' && t.v.toUpperCase() === 'NULL')
|
|
130
|
+
return { kind: 'lit', value: null };
|
|
131
|
+
if (t.k === 'id' && t.v.toUpperCase() === 'EXCLUDED' && this.eatP('.'))
|
|
132
|
+
return { kind: 'excluded', column: this.ident() };
|
|
133
|
+
throw new SqlError('unsupported expression');
|
|
134
|
+
}
|
|
135
|
+
statement() {
|
|
136
|
+
const t = this.peek();
|
|
137
|
+
const word = t.k === 'id' ? t.v.toUpperCase() : '';
|
|
138
|
+
switch (word) {
|
|
139
|
+
case 'CREATE':
|
|
140
|
+
return this.create();
|
|
141
|
+
case 'INSERT':
|
|
142
|
+
return this.insert();
|
|
143
|
+
case 'SELECT':
|
|
144
|
+
return this.select();
|
|
145
|
+
case 'DELETE':
|
|
146
|
+
return this.remove();
|
|
147
|
+
case 'PRAGMA':
|
|
148
|
+
return this.skip();
|
|
149
|
+
case 'BEGIN':
|
|
150
|
+
return this.control('begin');
|
|
151
|
+
case 'COMMIT':
|
|
152
|
+
case 'END':
|
|
153
|
+
return this.control('commit');
|
|
154
|
+
case 'ROLLBACK':
|
|
155
|
+
return this.control('rollback');
|
|
156
|
+
default:
|
|
157
|
+
throw new SqlError(`unsupported statement${word ? ` ${word}` : ''}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
control(type) {
|
|
161
|
+
this.next();
|
|
162
|
+
this.eatKw('TRANSACTION');
|
|
163
|
+
return { type, write: false };
|
|
164
|
+
}
|
|
165
|
+
skip() {
|
|
166
|
+
this.next();
|
|
167
|
+
while (!this.isP(';') && this.peek().k !== 'eof')
|
|
168
|
+
this.next();
|
|
169
|
+
return { type: 'noop', write: false };
|
|
170
|
+
}
|
|
171
|
+
create() {
|
|
172
|
+
this.next();
|
|
173
|
+
if (this.isKw('UNIQUE'))
|
|
174
|
+
throw new SqlError('unique indexes are not supported');
|
|
175
|
+
if (this.eatKw('TABLE'))
|
|
176
|
+
return this.createTable();
|
|
177
|
+
if (this.eatKw('INDEX'))
|
|
178
|
+
return this.createIndex();
|
|
179
|
+
throw new SqlError('unsupported CREATE statement');
|
|
180
|
+
}
|
|
181
|
+
ifNotExists() {
|
|
182
|
+
if (!this.eatKw('IF'))
|
|
183
|
+
return false;
|
|
184
|
+
this.expectKw('NOT');
|
|
185
|
+
this.expectKw('EXISTS');
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
createTable() {
|
|
189
|
+
const ifNotExists = this.ifNotExists();
|
|
190
|
+
const name = this.ident();
|
|
191
|
+
this.expectP('(');
|
|
192
|
+
const columns = [];
|
|
193
|
+
let primaryKey = null;
|
|
194
|
+
do {
|
|
195
|
+
if (this.eatKw('PRIMARY')) {
|
|
196
|
+
this.expectKw('KEY');
|
|
197
|
+
primaryKey = this.identList();
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
columns.push(this.columnDef());
|
|
201
|
+
}
|
|
202
|
+
} while (this.eatP(','));
|
|
203
|
+
this.expectP(')');
|
|
204
|
+
const key = primaryKey ?? columns.filter(c => c.primary).map(c => c.name);
|
|
205
|
+
if (!key.length)
|
|
206
|
+
throw new SqlError(`table ${name} needs a PRIMARY KEY`);
|
|
207
|
+
return { type: 'create_table', name, ifNotExists, columns, primaryKey: key, write: true };
|
|
208
|
+
}
|
|
209
|
+
columnDef() {
|
|
210
|
+
const column = { name: this.ident(), notNull: false, primary: false };
|
|
211
|
+
if (this.peek().k === 'id' && !this.isKw('NOT') && !this.isKw('PRIMARY'))
|
|
212
|
+
this.next();
|
|
213
|
+
for (;;) {
|
|
214
|
+
if (this.eatKw('NOT')) {
|
|
215
|
+
this.expectKw('NULL');
|
|
216
|
+
column.notNull = true;
|
|
217
|
+
}
|
|
218
|
+
else if (this.eatKw('PRIMARY')) {
|
|
219
|
+
this.expectKw('KEY');
|
|
220
|
+
column.primary = true;
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
return column;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
createIndex() {
|
|
228
|
+
const ifNotExists = this.ifNotExists();
|
|
229
|
+
const name = this.ident();
|
|
230
|
+
this.expectKw('ON');
|
|
231
|
+
const table = this.ident();
|
|
232
|
+
const columns = this.identList();
|
|
233
|
+
return { type: 'create_index', name, table, columns, ifNotExists, write: true };
|
|
234
|
+
}
|
|
235
|
+
insert() {
|
|
236
|
+
this.next();
|
|
237
|
+
let replace = false;
|
|
238
|
+
if (this.eatKw('OR')) {
|
|
239
|
+
this.expectKw('REPLACE');
|
|
240
|
+
replace = true;
|
|
241
|
+
}
|
|
242
|
+
this.expectKw('INTO');
|
|
243
|
+
const table = this.ident();
|
|
244
|
+
const columns = this.isP('(') ? this.identList() : null;
|
|
245
|
+
this.expectKw('VALUES');
|
|
246
|
+
this.expectP('(');
|
|
247
|
+
const values = [this.operand()];
|
|
248
|
+
while (this.eatP(','))
|
|
249
|
+
values.push(this.operand());
|
|
250
|
+
this.expectP(')');
|
|
251
|
+
let onConflict = null;
|
|
252
|
+
if (this.eatKw('ON')) {
|
|
253
|
+
this.expectKw('CONFLICT');
|
|
254
|
+
const target = this.identList();
|
|
255
|
+
this.expectKw('DO');
|
|
256
|
+
if (this.eatKw('NOTHING')) {
|
|
257
|
+
onConflict = { target, action: 'nothing' };
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
this.expectKw('UPDATE');
|
|
261
|
+
this.expectKw('SET');
|
|
262
|
+
const sets = [];
|
|
263
|
+
do {
|
|
264
|
+
const column = this.ident();
|
|
265
|
+
this.expectP('=');
|
|
266
|
+
sets.push({ column, operand: this.operand() });
|
|
267
|
+
} while (this.eatP(','));
|
|
268
|
+
onConflict = { target, action: 'update', sets };
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return { type: 'insert', table, columns, values, replace, onConflict, write: true };
|
|
272
|
+
}
|
|
273
|
+
select() {
|
|
274
|
+
this.next();
|
|
275
|
+
let columns = '*';
|
|
276
|
+
if (!this.eatP('*')) {
|
|
277
|
+
columns = [this.ident()];
|
|
278
|
+
while (this.eatP(','))
|
|
279
|
+
columns.push(this.ident());
|
|
280
|
+
}
|
|
281
|
+
this.expectKw('FROM');
|
|
282
|
+
const table = this.ident();
|
|
283
|
+
return { type: 'select', table, columns, where: this.where(), write: false };
|
|
284
|
+
}
|
|
285
|
+
remove() {
|
|
286
|
+
this.next();
|
|
287
|
+
this.expectKw('FROM');
|
|
288
|
+
const table = this.ident();
|
|
289
|
+
return { type: 'delete', table, where: this.where(), write: true };
|
|
290
|
+
}
|
|
291
|
+
where() {
|
|
292
|
+
const conditions = [];
|
|
293
|
+
if (!this.eatKw('WHERE'))
|
|
294
|
+
return conditions;
|
|
295
|
+
do {
|
|
296
|
+
const column = this.ident();
|
|
297
|
+
this.expectP('=');
|
|
298
|
+
conditions.push({ column, operand: this.operand() });
|
|
299
|
+
} while (this.eatKw('AND'));
|
|
300
|
+
return conditions;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
const parseStatements = sql => {
|
|
304
|
+
const parser = new Parser(tokenize(sql));
|
|
305
|
+
const statements = [];
|
|
306
|
+
while (parser.peek().k !== 'eof') {
|
|
307
|
+
if (parser.eatP(';'))
|
|
308
|
+
continue;
|
|
309
|
+
const start = parser.peek().at;
|
|
310
|
+
parser.params = 0;
|
|
311
|
+
const stmt = parser.statement();
|
|
312
|
+
const end = parser.tokens[parser.pos - 1].end;
|
|
313
|
+
if (!parser.eatP(';') && parser.peek().k !== 'eof')
|
|
314
|
+
throw new SqlError('expected ;');
|
|
315
|
+
stmt.text = sql.slice(start, end);
|
|
316
|
+
stmt.paramCount = parser.params;
|
|
317
|
+
statements.push(stmt);
|
|
318
|
+
}
|
|
319
|
+
return statements;
|
|
320
|
+
};
|
|
321
|
+
export class SqlDatabase {
|
|
322
|
+
constructor(path = ':memory:') {
|
|
323
|
+
_SqlDatabase_instances.add(this);
|
|
324
|
+
_SqlDatabase_tables.set(this, new Map());
|
|
325
|
+
_SqlDatabase_indexes.set(this, new Map());
|
|
326
|
+
_SqlDatabase_undo.set(this, []);
|
|
327
|
+
_SqlDatabase_pending.set(this, []);
|
|
328
|
+
_SqlDatabase_inTxn.set(this, false);
|
|
329
|
+
_SqlDatabase_path.set(this, null);
|
|
330
|
+
_SqlDatabase_logBytes.set(this, 0);
|
|
331
|
+
_SqlDatabase_baseBytes.set(this, 0);
|
|
332
|
+
_SqlDatabase_closed.set(this, false);
|
|
333
|
+
if (path !== ':memory:')
|
|
334
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_open).call(this, path);
|
|
335
|
+
}
|
|
336
|
+
exec(sql) {
|
|
337
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_assertOpen).call(this);
|
|
338
|
+
for (const stmt of parseStatements(sql))
|
|
339
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_invoke).call(this, stmt, []);
|
|
340
|
+
}
|
|
341
|
+
prepare(sql) {
|
|
342
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_assertOpen).call(this);
|
|
343
|
+
const statements = parseStatements(sql);
|
|
344
|
+
if (statements.length !== 1)
|
|
345
|
+
throw new SqlError('prepare expects exactly one statement');
|
|
346
|
+
const [stmt] = statements;
|
|
347
|
+
return {
|
|
348
|
+
run: (...params) => ({ changes: __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_invoke).call(this, stmt, params).changes }),
|
|
349
|
+
get: (...params) => __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_invoke).call(this, stmt, params).rows[0],
|
|
350
|
+
all: (...params) => __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_invoke).call(this, stmt, params).rows
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
transaction(fn) {
|
|
354
|
+
return (...args) => {
|
|
355
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_assertOpen).call(this);
|
|
356
|
+
if (__classPrivateFieldGet(this, _SqlDatabase_inTxn, "f"))
|
|
357
|
+
return fn(...args);
|
|
358
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_control).call(this, 'begin');
|
|
359
|
+
try {
|
|
360
|
+
const result = fn(...args);
|
|
361
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_commit).call(this);
|
|
362
|
+
return result;
|
|
363
|
+
}
|
|
364
|
+
catch (err) {
|
|
365
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_rollback).call(this);
|
|
366
|
+
throw err;
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
close() {
|
|
371
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_rollback).call(this);
|
|
372
|
+
__classPrivateFieldSet(this, _SqlDatabase_closed, true, "f");
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
_SqlDatabase_tables = new WeakMap(), _SqlDatabase_indexes = new WeakMap(), _SqlDatabase_undo = new WeakMap(), _SqlDatabase_pending = new WeakMap(), _SqlDatabase_inTxn = new WeakMap(), _SqlDatabase_path = new WeakMap(), _SqlDatabase_logBytes = new WeakMap(), _SqlDatabase_baseBytes = new WeakMap(), _SqlDatabase_closed = new WeakMap(), _SqlDatabase_instances = new WeakSet(), _SqlDatabase_assertOpen = function _SqlDatabase_assertOpen() {
|
|
376
|
+
if (__classPrivateFieldGet(this, _SqlDatabase_closed, "f"))
|
|
377
|
+
throw new SqlError('database is closed');
|
|
378
|
+
}, _SqlDatabase_invoke = function _SqlDatabase_invoke(stmt, params) {
|
|
379
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_assertOpen).call(this);
|
|
380
|
+
if (CONTROL.has(stmt.type))
|
|
381
|
+
return __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_control).call(this, stmt.type);
|
|
382
|
+
const values = bind(stmt.paramCount, params);
|
|
383
|
+
return __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_statement).call(this, () => {
|
|
384
|
+
const result = __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_execute).call(this, stmt, values);
|
|
385
|
+
if (stmt.write && result.changes && !result.noop)
|
|
386
|
+
__classPrivateFieldGet(this, _SqlDatabase_pending, "f").push([stmt.text, values]);
|
|
387
|
+
return result;
|
|
388
|
+
});
|
|
389
|
+
}, _SqlDatabase_control = function _SqlDatabase_control(type) {
|
|
390
|
+
if (type === 'begin') {
|
|
391
|
+
if (__classPrivateFieldGet(this, _SqlDatabase_inTxn, "f"))
|
|
392
|
+
throw new SqlError('cannot start a transaction within a transaction');
|
|
393
|
+
__classPrivateFieldSet(this, _SqlDatabase_inTxn, true, "f");
|
|
394
|
+
}
|
|
395
|
+
else if (!__classPrivateFieldGet(this, _SqlDatabase_inTxn, "f")) {
|
|
396
|
+
throw new SqlError('no transaction is active');
|
|
397
|
+
}
|
|
398
|
+
else if (type === 'commit') {
|
|
399
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_commit).call(this);
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_rollback).call(this);
|
|
403
|
+
}
|
|
404
|
+
return { changes: 0, rows: [] };
|
|
405
|
+
}, _SqlDatabase_statement = function _SqlDatabase_statement(fn) {
|
|
406
|
+
const auto = !__classPrivateFieldGet(this, _SqlDatabase_inTxn, "f");
|
|
407
|
+
if (auto)
|
|
408
|
+
__classPrivateFieldSet(this, _SqlDatabase_inTxn, true, "f");
|
|
409
|
+
const mark = __classPrivateFieldGet(this, _SqlDatabase_undo, "f").length;
|
|
410
|
+
const pmark = __classPrivateFieldGet(this, _SqlDatabase_pending, "f").length;
|
|
411
|
+
let result;
|
|
412
|
+
try {
|
|
413
|
+
result = fn();
|
|
414
|
+
}
|
|
415
|
+
catch (err) {
|
|
416
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_undoTo).call(this, mark);
|
|
417
|
+
__classPrivateFieldGet(this, _SqlDatabase_pending, "f").length = pmark;
|
|
418
|
+
if (auto)
|
|
419
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_end).call(this);
|
|
420
|
+
throw err;
|
|
421
|
+
}
|
|
422
|
+
if (auto)
|
|
423
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_commit).call(this);
|
|
424
|
+
return result;
|
|
425
|
+
}, _SqlDatabase_commit = function _SqlDatabase_commit() {
|
|
426
|
+
try {
|
|
427
|
+
if (__classPrivateFieldGet(this, _SqlDatabase_path, "f") !== null && __classPrivateFieldGet(this, _SqlDatabase_pending, "f").length)
|
|
428
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_append).call(this, __classPrivateFieldGet(this, _SqlDatabase_pending, "f"));
|
|
429
|
+
}
|
|
430
|
+
catch (err) {
|
|
431
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_rollback).call(this);
|
|
432
|
+
throw err;
|
|
433
|
+
}
|
|
434
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_end).call(this);
|
|
435
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_maybeCompact).call(this);
|
|
436
|
+
}, _SqlDatabase_rollback = function _SqlDatabase_rollback() {
|
|
437
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_undoTo).call(this, 0);
|
|
438
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_end).call(this);
|
|
439
|
+
}, _SqlDatabase_undoTo = function _SqlDatabase_undoTo(mark) {
|
|
440
|
+
while (__classPrivateFieldGet(this, _SqlDatabase_undo, "f").length > mark)
|
|
441
|
+
__classPrivateFieldGet(this, _SqlDatabase_undo, "f").pop()();
|
|
442
|
+
}, _SqlDatabase_end = function _SqlDatabase_end() {
|
|
443
|
+
__classPrivateFieldSet(this, _SqlDatabase_undo, [], "f");
|
|
444
|
+
__classPrivateFieldSet(this, _SqlDatabase_pending, [], "f");
|
|
445
|
+
__classPrivateFieldSet(this, _SqlDatabase_inTxn, false, "f");
|
|
446
|
+
}, _SqlDatabase_execute = function _SqlDatabase_execute(stmt, params) {
|
|
447
|
+
switch (stmt.type) {
|
|
448
|
+
case 'create_table':
|
|
449
|
+
return __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_createTable).call(this, stmt);
|
|
450
|
+
case 'create_index':
|
|
451
|
+
return __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_createIndex).call(this, stmt);
|
|
452
|
+
case 'insert':
|
|
453
|
+
return __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_insert).call(this, stmt, params);
|
|
454
|
+
case 'delete':
|
|
455
|
+
return __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_deleteRows).call(this, stmt, params);
|
|
456
|
+
case 'select':
|
|
457
|
+
return __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_selectRows).call(this, stmt, params);
|
|
458
|
+
default:
|
|
459
|
+
return { changes: 0, rows: [] };
|
|
460
|
+
}
|
|
461
|
+
}, _SqlDatabase_table = function _SqlDatabase_table(name) {
|
|
462
|
+
const table = __classPrivateFieldGet(this, _SqlDatabase_tables, "f").get(lower(name));
|
|
463
|
+
if (!table)
|
|
464
|
+
throw new SqlError(`no such table: ${name}`);
|
|
465
|
+
return table;
|
|
466
|
+
}, _SqlDatabase_column = function _SqlDatabase_column(table, name) {
|
|
467
|
+
const i = table.colIndex.get(lower(name));
|
|
468
|
+
if (i === undefined)
|
|
469
|
+
throw new SqlError(`no such column: ${name}`);
|
|
470
|
+
return i;
|
|
471
|
+
}, _SqlDatabase_isPrimaryKey = function _SqlDatabase_isPrimaryKey(table, names) {
|
|
472
|
+
const cols = names.map(n => __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_column).call(this, table, n));
|
|
473
|
+
return cols.length === table.pk.length && cols.every(i => table.pk.includes(i));
|
|
474
|
+
}, _SqlDatabase_value = function _SqlDatabase_value(operand, params) {
|
|
475
|
+
if (operand.kind === 'param')
|
|
476
|
+
return params[operand.index];
|
|
477
|
+
if (operand.kind === 'lit')
|
|
478
|
+
return operand.value;
|
|
479
|
+
throw new SqlError('excluded is only valid in ON CONFLICT ... DO UPDATE SET');
|
|
480
|
+
}, _SqlDatabase_checkNotNull = function _SqlDatabase_checkNotNull(table, row) {
|
|
481
|
+
table.columns.forEach((c, i) => {
|
|
482
|
+
if (c.notNull && row[i] === null)
|
|
483
|
+
throw new SqlError(`NOT NULL constraint failed: ${table.name}.${c.name}`);
|
|
484
|
+
});
|
|
485
|
+
}, _SqlDatabase_createTable = function _SqlDatabase_createTable(stmt) {
|
|
486
|
+
const key = lower(stmt.name);
|
|
487
|
+
if (__classPrivateFieldGet(this, _SqlDatabase_tables, "f").has(key)) {
|
|
488
|
+
if (stmt.ifNotExists)
|
|
489
|
+
return { changes: 0, rows: [] };
|
|
490
|
+
throw new SqlError(`table ${stmt.name} already exists`);
|
|
491
|
+
}
|
|
492
|
+
const pkNames = stmt.primaryKey.map(lower);
|
|
493
|
+
const columns = stmt.columns.map(c => ({ name: c.name, notNull: c.notNull || pkNames.includes(lower(c.name)) }));
|
|
494
|
+
const colIndex = new Map(columns.map((c, i) => [lower(c.name), i]));
|
|
495
|
+
const pk = stmt.primaryKey.map(name => {
|
|
496
|
+
const i = colIndex.get(lower(name));
|
|
497
|
+
if (i === undefined)
|
|
498
|
+
throw new SqlError(`no such column: ${name}`);
|
|
499
|
+
return i;
|
|
500
|
+
});
|
|
501
|
+
const table = { name: stmt.name, sql: stmt.text, columns, colIndex, pk, rows: new Map(), indexes: [] };
|
|
502
|
+
__classPrivateFieldGet(this, _SqlDatabase_tables, "f").set(key, table);
|
|
503
|
+
__classPrivateFieldGet(this, _SqlDatabase_undo, "f").push(() => __classPrivateFieldGet(this, _SqlDatabase_tables, "f").delete(key));
|
|
504
|
+
return { changes: 1, rows: [] };
|
|
505
|
+
}, _SqlDatabase_createIndex = function _SqlDatabase_createIndex(stmt) {
|
|
506
|
+
const key = lower(stmt.name);
|
|
507
|
+
if (__classPrivateFieldGet(this, _SqlDatabase_indexes, "f").has(key)) {
|
|
508
|
+
if (stmt.ifNotExists)
|
|
509
|
+
return { changes: 0, rows: [] };
|
|
510
|
+
throw new SqlError(`index ${stmt.name} already exists`);
|
|
511
|
+
}
|
|
512
|
+
const table = __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_table).call(this, stmt.table);
|
|
513
|
+
const index = {
|
|
514
|
+
name: stmt.name,
|
|
515
|
+
sql: stmt.text,
|
|
516
|
+
columns: stmt.columns.map(c => __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_column).call(this, table, c)),
|
|
517
|
+
entries: new Map()
|
|
518
|
+
};
|
|
519
|
+
for (const [rowKey, row] of table.rows)
|
|
520
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_addEntry).call(this, index, rowKey, row);
|
|
521
|
+
table.indexes.push(index);
|
|
522
|
+
__classPrivateFieldGet(this, _SqlDatabase_indexes, "f").set(key, index);
|
|
523
|
+
__classPrivateFieldGet(this, _SqlDatabase_undo, "f").push(() => {
|
|
524
|
+
table.indexes.splice(table.indexes.indexOf(index), 1);
|
|
525
|
+
__classPrivateFieldGet(this, _SqlDatabase_indexes, "f").delete(key);
|
|
526
|
+
});
|
|
527
|
+
return { changes: 1, rows: [] };
|
|
528
|
+
}, _SqlDatabase_insert = function _SqlDatabase_insert(stmt, params) {
|
|
529
|
+
const table = __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_table).call(this, stmt.table);
|
|
530
|
+
const names = stmt.columns ?? table.columns.map(c => c.name);
|
|
531
|
+
if (names.length !== stmt.values.length)
|
|
532
|
+
throw new SqlError(`${names.length} columns but ${stmt.values.length} values supplied`);
|
|
533
|
+
if (stmt.onConflict && !__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_isPrimaryKey).call(this, table, stmt.onConflict.target))
|
|
534
|
+
throw new SqlError('ON CONFLICT target must be the primary key');
|
|
535
|
+
const row = table.columns.map(() => null);
|
|
536
|
+
names.forEach((name, i) => {
|
|
537
|
+
row[__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_column).call(this, table, name)] = __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_value).call(this, stmt.values[i], params);
|
|
538
|
+
});
|
|
539
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_checkNotNull).call(this, table, row);
|
|
540
|
+
const rowKey = keyOf(table, row);
|
|
541
|
+
const existing = table.rows.get(rowKey);
|
|
542
|
+
if (!existing) {
|
|
543
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_storeRow).call(this, table, rowKey, row);
|
|
544
|
+
return { changes: 1, rows: [] };
|
|
545
|
+
}
|
|
546
|
+
const action = stmt.onConflict?.action;
|
|
547
|
+
if (action === 'nothing')
|
|
548
|
+
return { changes: 0, rows: [] };
|
|
549
|
+
if (action === 'update')
|
|
550
|
+
return __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_upsertConflict).call(this, table, rowKey, existing, stmt.onConflict.sets, row, params);
|
|
551
|
+
if (stmt.replace) {
|
|
552
|
+
if (sameRow(existing, row))
|
|
553
|
+
return { changes: 1, rows: [], noop: true };
|
|
554
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_storeRow).call(this, table, rowKey, row);
|
|
555
|
+
return { changes: 1, rows: [] };
|
|
556
|
+
}
|
|
557
|
+
throw new SqlError(`UNIQUE constraint failed: ${table.pk.map(i => `${table.name}.${table.columns[i].name}`).join(', ')}`);
|
|
558
|
+
}, _SqlDatabase_upsertConflict = function _SqlDatabase_upsertConflict(table, rowKey, existing, sets, incoming, params) {
|
|
559
|
+
const next = existing.slice();
|
|
560
|
+
for (const { column, operand } of sets) {
|
|
561
|
+
next[__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_column).call(this, table, column)] = operand.kind === 'excluded'
|
|
562
|
+
? incoming[__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_column).call(this, table, operand.column)]
|
|
563
|
+
: __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_value).call(this, operand, params);
|
|
564
|
+
}
|
|
565
|
+
if (table.pk.some(i => next[i] !== existing[i]))
|
|
566
|
+
throw new SqlError('primary key cannot be changed on conflict');
|
|
567
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_checkNotNull).call(this, table, next);
|
|
568
|
+
// rewriting identical data (e.g. saveCreds with unchanged creds) must not grow the log
|
|
569
|
+
if (sameRow(existing, next))
|
|
570
|
+
return { changes: 1, rows: [], noop: true };
|
|
571
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_storeRow).call(this, table, rowKey, next);
|
|
572
|
+
return { changes: 1, rows: [] };
|
|
573
|
+
}, _SqlDatabase_deleteRows = function _SqlDatabase_deleteRows(stmt, params) {
|
|
574
|
+
const table = __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_table).call(this, stmt.table);
|
|
575
|
+
let changes = 0;
|
|
576
|
+
for (const row of __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_match).call(this, table, stmt.where, params)) {
|
|
577
|
+
if (__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_removeRow).call(this, table, keyOf(table, row)))
|
|
578
|
+
changes++;
|
|
579
|
+
}
|
|
580
|
+
return { changes, rows: [] };
|
|
581
|
+
}, _SqlDatabase_selectRows = function _SqlDatabase_selectRows(stmt, params) {
|
|
582
|
+
const table = __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_table).call(this, stmt.table);
|
|
583
|
+
const names = stmt.columns === '*' ? table.columns.map(c => c.name) : stmt.columns;
|
|
584
|
+
const picks = names.map(n => __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_column).call(this, table, n));
|
|
585
|
+
const rows = __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_match).call(this, table, stmt.where, params).map(row => Object.fromEntries(names.map((n, i) => [n, row[picks[i]]])));
|
|
586
|
+
return { changes: 0, rows };
|
|
587
|
+
}, _SqlDatabase_match = function _SqlDatabase_match(table, where, params) {
|
|
588
|
+
const bound = where.map(({ column, operand }) => ({ index: __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_column).call(this, table, column), value: __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_value).call(this, operand, params) }));
|
|
589
|
+
const wanted = new Map(bound.map(({ index, value }) => [index, value]));
|
|
590
|
+
return __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_candidates).call(this, table, wanted).filter(row => bound.every(({ index, value }) => value !== null && row[index] === value));
|
|
591
|
+
}, _SqlDatabase_candidates = function _SqlDatabase_candidates(table, wanted) {
|
|
592
|
+
if (table.pk.every(i => wanted.has(i))) {
|
|
593
|
+
const row = table.rows.get(JSON.stringify(table.pk.map(i => wanted.get(i))));
|
|
594
|
+
return row ? [row] : [];
|
|
595
|
+
}
|
|
596
|
+
for (const index of table.indexes) {
|
|
597
|
+
if (index.columns.every(i => wanted.has(i))) {
|
|
598
|
+
const keys = index.entries.get(JSON.stringify(index.columns.map(i => wanted.get(i))));
|
|
599
|
+
return keys ? [...keys].map(k => table.rows.get(k)) : [];
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
return [...table.rows.values()];
|
|
603
|
+
}, _SqlDatabase_addEntry = function _SqlDatabase_addEntry(index, rowKey, row) {
|
|
604
|
+
const k = JSON.stringify(index.columns.map(i => row[i]));
|
|
605
|
+
let set = index.entries.get(k);
|
|
606
|
+
if (!set) {
|
|
607
|
+
set = new Set();
|
|
608
|
+
index.entries.set(k, set);
|
|
609
|
+
}
|
|
610
|
+
set.add(rowKey);
|
|
611
|
+
}, _SqlDatabase_removeEntry = function _SqlDatabase_removeEntry(index, rowKey, row) {
|
|
612
|
+
const k = JSON.stringify(index.columns.map(i => row[i]));
|
|
613
|
+
const set = index.entries.get(k);
|
|
614
|
+
if (!set)
|
|
615
|
+
return;
|
|
616
|
+
set.delete(rowKey);
|
|
617
|
+
if (!set.size)
|
|
618
|
+
index.entries.delete(k);
|
|
619
|
+
}, _SqlDatabase_indexRow = function _SqlDatabase_indexRow(table, rowKey, row) {
|
|
620
|
+
for (const index of table.indexes)
|
|
621
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_addEntry).call(this, index, rowKey, row);
|
|
622
|
+
}, _SqlDatabase_unindexRow = function _SqlDatabase_unindexRow(table, rowKey, row) {
|
|
623
|
+
for (const index of table.indexes)
|
|
624
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_removeEntry).call(this, index, rowKey, row);
|
|
625
|
+
}, _SqlDatabase_storeRow = function _SqlDatabase_storeRow(table, rowKey, row) {
|
|
626
|
+
const prev = table.rows.get(rowKey);
|
|
627
|
+
if (prev)
|
|
628
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_unindexRow).call(this, table, rowKey, prev);
|
|
629
|
+
table.rows.set(rowKey, row);
|
|
630
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_indexRow).call(this, table, rowKey, row);
|
|
631
|
+
__classPrivateFieldGet(this, _SqlDatabase_undo, "f").push(() => __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_restoreRow).call(this, table, rowKey, prev));
|
|
632
|
+
}, _SqlDatabase_removeRow = function _SqlDatabase_removeRow(table, rowKey) {
|
|
633
|
+
const prev = table.rows.get(rowKey);
|
|
634
|
+
if (!prev)
|
|
635
|
+
return false;
|
|
636
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_unindexRow).call(this, table, rowKey, prev);
|
|
637
|
+
table.rows.delete(rowKey);
|
|
638
|
+
__classPrivateFieldGet(this, _SqlDatabase_undo, "f").push(() => __classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_restoreRow).call(this, table, rowKey, prev));
|
|
639
|
+
return true;
|
|
640
|
+
}, _SqlDatabase_restoreRow = function _SqlDatabase_restoreRow(table, rowKey, prev) {
|
|
641
|
+
const current = table.rows.get(rowKey);
|
|
642
|
+
if (current)
|
|
643
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_unindexRow).call(this, table, rowKey, current);
|
|
644
|
+
if (prev) {
|
|
645
|
+
table.rows.set(rowKey, prev);
|
|
646
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_indexRow).call(this, table, rowKey, prev);
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
table.rows.delete(rowKey);
|
|
650
|
+
}
|
|
651
|
+
}, _SqlDatabase_open = function _SqlDatabase_open(path) {
|
|
652
|
+
let text = existsSync(path) ? readFileSync(path, 'utf8') : '';
|
|
653
|
+
const fresh = text === '';
|
|
654
|
+
if (fresh)
|
|
655
|
+
text = `${MAGIC}\n`;
|
|
656
|
+
const lines = text.split('\n');
|
|
657
|
+
const tail = lines.pop();
|
|
658
|
+
if (lines[0] !== MAGIC)
|
|
659
|
+
throw new SqlError(`${path} is not a native sql database file`);
|
|
660
|
+
for (const line of lines.slice(1))
|
|
661
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_replay).call(this, line);
|
|
662
|
+
__classPrivateFieldSet(this, _SqlDatabase_path, path, "f");
|
|
663
|
+
__classPrivateFieldSet(this, _SqlDatabase_logBytes, __classPrivateFieldSet(this, _SqlDatabase_baseBytes, Buffer.byteLength(text), "f"), "f");
|
|
664
|
+
if (fresh) {
|
|
665
|
+
writeFileSync(path, text);
|
|
666
|
+
}
|
|
667
|
+
else if (tail !== '' || lines.length > 2) {
|
|
668
|
+
// torn write, or the log holds more than a single snapshot line: rewrite as a clean
|
|
669
|
+
// snapshot so baseBytes reflects live data and old bloated files shrink on first open
|
|
670
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_compact).call(this);
|
|
671
|
+
}
|
|
672
|
+
}, _SqlDatabase_replay = function _SqlDatabase_replay(line) {
|
|
673
|
+
if (line === '')
|
|
674
|
+
return;
|
|
675
|
+
let entries;
|
|
676
|
+
try {
|
|
677
|
+
entries = JSON.parse(line);
|
|
678
|
+
}
|
|
679
|
+
catch {
|
|
680
|
+
throw new SqlError('corrupted sql log entry');
|
|
681
|
+
}
|
|
682
|
+
for (const [sql, params] of entries) {
|
|
683
|
+
const [stmt] = parseStatements(sql);
|
|
684
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_invoke).call(this, stmt, params);
|
|
685
|
+
}
|
|
686
|
+
}, _SqlDatabase_append = function _SqlDatabase_append(entries) {
|
|
687
|
+
const line = `${JSON.stringify(entries)}\n`;
|
|
688
|
+
appendFileSync(__classPrivateFieldGet(this, _SqlDatabase_path, "f"), line);
|
|
689
|
+
__classPrivateFieldSet(this, _SqlDatabase_logBytes, __classPrivateFieldGet(this, _SqlDatabase_logBytes, "f") + Buffer.byteLength(line), "f");
|
|
690
|
+
}, _SqlDatabase_maybeCompact = function _SqlDatabase_maybeCompact() {
|
|
691
|
+
if (__classPrivateFieldGet(this, _SqlDatabase_path, "f") === null)
|
|
692
|
+
return;
|
|
693
|
+
// baseBytes is always the size of a clean snapshot, so garbage = logBytes - baseBytes
|
|
694
|
+
const garbage = __classPrivateFieldGet(this, _SqlDatabase_logBytes, "f") - __classPrivateFieldGet(this, _SqlDatabase_baseBytes, "f");
|
|
695
|
+
if (garbage < Math.max(COMPACT_MIN_BYTES, __classPrivateFieldGet(this, _SqlDatabase_baseBytes, "f") * COMPACT_GROWTH_RATIO))
|
|
696
|
+
return;
|
|
697
|
+
try {
|
|
698
|
+
__classPrivateFieldGet(this, _SqlDatabase_instances, "m", _SqlDatabase_compact).call(this);
|
|
699
|
+
}
|
|
700
|
+
catch { }
|
|
701
|
+
}, _SqlDatabase_compact = function _SqlDatabase_compact() {
|
|
702
|
+
const entries = [];
|
|
703
|
+
for (const table of __classPrivateFieldGet(this, _SqlDatabase_tables, "f").values())
|
|
704
|
+
entries.push([table.sql, []]);
|
|
705
|
+
for (const index of __classPrivateFieldGet(this, _SqlDatabase_indexes, "f").values())
|
|
706
|
+
entries.push([index.sql, []]);
|
|
707
|
+
for (const table of __classPrivateFieldGet(this, _SqlDatabase_tables, "f").values()) {
|
|
708
|
+
const names = table.columns.map(c => `"${c.name}"`).join(', ');
|
|
709
|
+
const sql = `INSERT INTO "${table.name}" (${names}) VALUES (${table.columns.map(() => '?').join(', ')})`;
|
|
710
|
+
for (const row of table.rows.values())
|
|
711
|
+
entries.push([sql, row]);
|
|
712
|
+
}
|
|
713
|
+
const text = `${MAGIC}\n${JSON.stringify(entries)}\n`;
|
|
714
|
+
const tmp = `${__classPrivateFieldGet(this, _SqlDatabase_path, "f")}.tmp`;
|
|
715
|
+
writeFileSync(tmp, text);
|
|
716
|
+
renameSync(tmp, __classPrivateFieldGet(this, _SqlDatabase_path, "f"));
|
|
717
|
+
__classPrivateFieldSet(this, _SqlDatabase_logBytes, __classPrivateFieldSet(this, _SqlDatabase_baseBytes, Buffer.byteLength(text), "f"), "f");
|
|
718
|
+
};
|
|
719
|
+
//# sourceMappingURL=sql-database.js.map
|