nolo-cli 0.143.0-alpha.1 → 0.145.0-alpha.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/README.md +2 -0
- package/{_executeModel-QK43QR2R.js → _executeModel-M3FASQ2Z.js} +18 -17
- package/{agentDeleteCommand-SE4WUIRR.js → agentDeleteCommand-K7GCEEVS.js} +10 -9
- package/{agentEmailCommands-LW5JMYH2.js → agentEmailCommands-MNXRO36L.js} +24 -23
- package/{agentListCommands-LGZG2OQR.js → agentListCommands-KMZR6VVM.js} +12 -11
- package/{agentMachineCommands-BNOXYSPZ.js → agentMachineCommands-75TIBYDY.js} +10 -9
- package/{agentProviderCommands-AOG3OZJA.js → agentProviderCommands-TWB6E5WD.js} +1 -1
- package/{agentRecordCommands-W5ZXPHZV.js → agentRecordCommands-RDO5L3N4.js} +23 -22
- package/{agentRunCommand-VRLCL57M.js → agentRunCommand-FVJJPL27.js} +23 -22
- package/{agentRuntimeLocal-VOQ3UYZB.js → agentRuntimeLocal-DAK7RCER.js} +8 -7
- package/{agentSlice-4AK24F5F.js → agentSlice-6MRJR2BJ.js} +1 -1
- package/{appDeleteCommands-XWAIUHTN.js → appDeleteCommands-JMMXK3XT.js} +11 -10
- package/{appDeployCommands-CBJJCUMG.js → appDeployCommands-JFU6GALI.js} +11 -10
- package/{appDeployStatusCommands-LTTZTJQS.js → appDeployStatusCommands-AXTZ4GAN.js} +11 -10
- package/{appGetCommands-QHUB7MFF.js → appGetCommands-CR2W3DCM.js} +11 -10
- package/{appListCommands-HINIDJE7.js → appListCommands-2TV6P3EU.js} +11 -10
- package/{authCommand-LARLQ3GC.js → authCommand-UBJ4EWYZ.js} +6 -6
- package/{authCommands-GBIFZWD3.js → authCommands-H6WKKCRW.js} +1 -1
- package/{builtinSkillRegistry-AFPSTTAU.js → builtinSkillRegistry-ZMF6YGNO.js} +4 -3
- package/{chatQueueReduxAdapter-KIQ3FQ62.js → chatQueueReduxAdapter-CDOHVTSE.js} +2 -2
- package/{chromeCommands-NKU3OWKH.js → chromeCommands-2N6MEWRU.js} +94 -23
- package/{chromeOpsCommands-OQDJGD4Y.js → chromeOpsCommands-IXRLN57H.js} +4 -3
- package/{chunk-7MUSNQ6E.js → chunk-27ONFIEY.js} +20 -2
- package/{chunk-OZ6V53WV.js → chunk-2EE5UD3N.js} +1 -1
- package/{chunk-44QZPYLI.js → chunk-2SYTUTLI.js} +92 -20
- package/{chunk-DID5AVGT.js → chunk-2TKVOEQF.js} +11 -10
- package/chunk-5J3PYNUP.js +255 -0
- package/{chunk-OUOJE2P2.js → chunk-5XYFIDFU.js} +5 -5
- package/{chunk-WTUVMKSQ.js → chunk-62XHRZG4.js} +2 -2
- package/{chunk-WC6A2Q7S.js → chunk-6TPOEJMQ.js} +5 -2
- package/{chunk-RRMAZ2BI.js → chunk-7NANRWL4.js} +1 -1
- package/{chunk-44F6KKUE.js → chunk-7YAK46ML.js} +3 -3
- package/{chunk-NOGH7HCP.js → chunk-A6FNUMCF.js} +47 -6
- package/{chunk-OFYHCA6W.js → chunk-AATZZAZE.js} +1 -1
- package/{chunk-KUPDS66Q.js → chunk-ANX7Z7Z2.js} +8 -8
- package/{chunk-J5H6SUOW.js → chunk-B2XUQXQX.js} +2 -2
- package/{chunk-A5MB5RIT.js → chunk-CCOXTK3I.js} +1 -1
- package/chunk-GNMAFAIS.js +29 -0
- package/{chunk-GZQNKKDG.js → chunk-HKBFZONG.js} +1 -1
- package/{chunk-7LLWEG6F.js → chunk-I44MDY73.js} +3 -3
- package/{chunk-QDT5T7MK.js → chunk-I4OPU5TK.js} +1 -1
- package/{chunk-VPFEPRME.js → chunk-IVZJWTDI.js} +3 -0
- package/{chunk-CTGZO35O.js → chunk-JLQKV2ZJ.js} +2 -2
- package/{chunk-PQVOC2CZ.js → chunk-M2YBIBBS.js} +1 -1
- package/{chunk-ZOI6KA4N.js → chunk-M76SRQ3H.js} +34 -22
- package/{chunk-K25DK52L.js → chunk-OKSJZ4UU.js} +21 -223
- package/{chunk-U5QTKTZE.js → chunk-P6GMCCAT.js} +1 -1
- package/{chunk-L6RB42ZR.js → chunk-QFZM5BFI.js} +3 -3
- package/{chunk-GH4MH73K.js → chunk-RHDOQWXZ.js} +175 -17
- package/{chunk-M6NK74VP.js → chunk-S5XGT6GB.js} +1 -1
- package/{chunk-KUWT3C2P.js → chunk-T76D3OYX.js} +1 -1
- package/{chunk-MXRUAINC.js → chunk-UMB7CHAY.js} +3 -3
- package/{chunk-VVUSRF5D.js → chunk-VJ4FUWPC.js} +3 -3
- package/{chunk-T36EFAW7.js → chunk-VZVTPDPL.js} +3 -3
- package/{chunk-AAROOKLX.js → chunk-X2QRZXZH.js} +1 -1
- package/{chunk-WYYO2YOL.js → chunk-XNXNHAAP.js} +1 -1
- package/{chunk-O6OSWFZQ.js → chunk-XUWRURDF.js} +6 -0
- package/{chunk-DOBBRISY.js → chunk-Y6XHJ4JJ.js} +22 -10
- package/{chunk-W247GBSQ.js → chunk-YU2THNST.js} +1 -1
- package/{chunk-OY5IJI2N.js → chunk-YUNJN43V.js} +23 -3
- package/{commandRegistry-DETYXF5I.js → commandRegistry-ZF6YXQWV.js} +76 -65
- package/{contentThunks-6QBTPLWT.js → contentThunks-6Y6ATG3A.js} +3 -3
- package/{createAgentAutomationAction-TZVIJTZ7.js → createAgentAutomationAction-OQTLA2FC.js} +3 -3
- package/{createDialogAction-KTDAEA42.js → createDialogAction-IF5EZMBD.js} +6 -5
- package/{createPageAction-4RASVDAU.js → createPageAction-GU766R3L.js} +3 -3
- package/{dialogCommands-GY7LRERG.js → dialogCommands-QV7XAX2V.js} +11 -10
- package/{dialogSlice-J24APUGG.js → dialogSlice-CVHMDSVV.js} +2 -2
- package/{docCreateCommands-T7KII3WP.js → docCreateCommands-FSBANQTO.js} +10 -9
- package/{docDeleteCommands-SQ26EFE6.js → docDeleteCommands-4IR4YSGU.js} +11 -10
- package/{docReadCommands-I6NA2ZKV.js → docReadCommands-4EYPGUE3.js} +10 -9
- package/{docStore-SPOGE7K3.js → docStore-RQOWPNON.js} +1 -1
- package/{docUpdateCommands-IG43SZ6U.js → docUpdateCommands-RW2BYLSE.js} +10 -9
- package/{handleSendMessageAction-I2IN64DS.js → handleSendMessageAction-UDTPG5WK.js} +4 -3
- package/index.js +4 -4
- package/{machineCommands-U7VABJPW.js → machineCommands-WBQ4TCPD.js} +22 -21
- package/{machineWsRunDispatch-ZNU6LRNG.js → machineWsRunDispatch-7DNDXUOS.js} +22 -21
- package/node_modules/abstract-level/CHANGELOG.md +150 -0
- package/node_modules/abstract-level/LICENSE +21 -0
- package/node_modules/abstract-level/README.md +1957 -0
- package/node_modules/abstract-level/UPGRADING.md +669 -0
- package/node_modules/abstract-level/abstract-chained-batch.js +397 -0
- package/node_modules/abstract-level/abstract-iterator.js +404 -0
- package/node_modules/abstract-level/abstract-level.js +1127 -0
- package/node_modules/abstract-level/abstract-snapshot.js +84 -0
- package/node_modules/abstract-level/index.d.ts +52 -0
- package/node_modules/abstract-level/index.js +9 -0
- package/node_modules/abstract-level/lib/abstract-sublevel-iterator.js +141 -0
- package/node_modules/abstract-level/lib/abstract-sublevel.js +290 -0
- package/node_modules/abstract-level/lib/common.js +33 -0
- package/node_modules/abstract-level/lib/default-chained-batch.js +29 -0
- package/node_modules/abstract-level/lib/default-kv-iterator.js +74 -0
- package/node_modules/abstract-level/lib/deferred-iterator.js +110 -0
- package/node_modules/abstract-level/lib/deferred-queue.js +84 -0
- package/node_modules/abstract-level/lib/errors.js +21 -0
- package/node_modules/abstract-level/lib/event-monitor.js +30 -0
- package/node_modules/abstract-level/lib/hooks.js +78 -0
- package/node_modules/abstract-level/lib/prefixes.js +21 -0
- package/node_modules/abstract-level/lib/prewrite-batch.js +96 -0
- package/node_modules/abstract-level/lib/range-options.js +26 -0
- package/node_modules/abstract-level/package.json +66 -0
- package/node_modules/abstract-level/test/async-iterator-test.js +132 -0
- package/node_modules/abstract-level/test/batch-test.js +214 -0
- package/node_modules/abstract-level/test/chained-batch-test.js +315 -0
- package/node_modules/abstract-level/test/clear-range-test.js +262 -0
- package/node_modules/abstract-level/test/clear-test.js +110 -0
- package/node_modules/abstract-level/test/common.js +90 -0
- package/node_modules/abstract-level/test/deferred-open-test.js +209 -0
- package/node_modules/abstract-level/test/del-test.js +65 -0
- package/node_modules/abstract-level/test/encoding-buffer-test.js +336 -0
- package/node_modules/abstract-level/test/encoding-custom-test.js +92 -0
- package/node_modules/abstract-level/test/encoding-decode-error-test.js +85 -0
- package/node_modules/abstract-level/test/encoding-json-test.js +75 -0
- package/node_modules/abstract-level/test/encoding-test.js +130 -0
- package/node_modules/abstract-level/test/events/write.js +132 -0
- package/node_modules/abstract-level/test/factory-test.js +36 -0
- package/node_modules/abstract-level/test/get-many-test.js +157 -0
- package/node_modules/abstract-level/test/get-sync-test.js +61 -0
- package/node_modules/abstract-level/test/get-test.js +83 -0
- package/node_modules/abstract-level/test/has-many-test.js +144 -0
- package/node_modules/abstract-level/test/has-test.js +81 -0
- package/node_modules/abstract-level/test/hooks/newsub.js +57 -0
- package/node_modules/abstract-level/test/hooks/postopen.js +229 -0
- package/node_modules/abstract-level/test/hooks/prewrite.js +816 -0
- package/node_modules/abstract-level/test/hooks/shared.js +38 -0
- package/node_modules/abstract-level/test/index.js +86 -0
- package/node_modules/abstract-level/test/iterator-explicit-snapshot-test.js +393 -0
- package/node_modules/abstract-level/test/iterator-no-snapshot-test.js +49 -0
- package/node_modules/abstract-level/test/iterator-range-test.js +277 -0
- package/node_modules/abstract-level/test/iterator-seek-test.js +335 -0
- package/node_modules/abstract-level/test/iterator-snapshot-test.js +56 -0
- package/node_modules/abstract-level/test/iterator-test.js +621 -0
- package/node_modules/abstract-level/test/manifest-test.js +21 -0
- package/node_modules/abstract-level/test/open-create-if-missing-test.js +39 -0
- package/node_modules/abstract-level/test/open-error-if-exists-test.js +25 -0
- package/node_modules/abstract-level/test/open-test.js +263 -0
- package/node_modules/abstract-level/test/put-get-del-test.js +97 -0
- package/node_modules/abstract-level/test/put-test.js +70 -0
- package/node_modules/abstract-level/test/self/abstract-iterator-test.js +182 -0
- package/node_modules/abstract-level/test/self/async-iterator-test.js +242 -0
- package/node_modules/abstract-level/test/self/attach-resource-test.js +74 -0
- package/node_modules/abstract-level/test/self/defer-test.js +140 -0
- package/node_modules/abstract-level/test/self/deferred-iterator-test.js +314 -0
- package/node_modules/abstract-level/test/self/deferred-operations-test.js +86 -0
- package/node_modules/abstract-level/test/self/deferred-queue-test.js +93 -0
- package/node_modules/abstract-level/test/self/encoding-test.js +391 -0
- package/node_modules/abstract-level/test/self/errors-test.js +11 -0
- package/node_modules/abstract-level/test/self/iterator-test.js +1050 -0
- package/node_modules/abstract-level/test/self/sublevel-test.js +1039 -0
- package/node_modules/abstract-level/test/self.js +905 -0
- package/node_modules/abstract-level/test/sublevel-test.js +209 -0
- package/node_modules/abstract-level/test/traits/closed.js +42 -0
- package/node_modules/abstract-level/test/traits/index.js +4 -0
- package/node_modules/abstract-level/test/traits/open.js +62 -0
- package/node_modules/abstract-level/test/util.js +275 -0
- package/node_modules/abstract-level/types/abstract-chained-batch.d.ts +124 -0
- package/node_modules/abstract-level/types/abstract-iterator.d.ts +241 -0
- package/node_modules/abstract-level/types/abstract-level.d.ts +636 -0
- package/node_modules/abstract-level/types/abstract-snapshot.d.ts +30 -0
- package/node_modules/abstract-level/types/abstract-sublevel.d.ts +76 -0
- package/node_modules/abstract-level/types/interfaces.d.ts +43 -0
- package/node_modules/base64-js/LICENSE +21 -0
- package/node_modules/base64-js/README.md +34 -0
- package/node_modules/base64-js/base64js.min.js +1 -0
- package/node_modules/base64-js/index.d.ts +3 -0
- package/node_modules/base64-js/index.js +150 -0
- package/node_modules/base64-js/package.json +47 -0
- package/node_modules/browser-level/CHANGELOG.md +44 -0
- package/node_modules/browser-level/LICENSE +21 -0
- package/node_modules/browser-level/README.md +124 -0
- package/node_modules/browser-level/UPGRADING.md +143 -0
- package/node_modules/browser-level/index.d.ts +108 -0
- package/node_modules/browser-level/index.js +323 -0
- package/node_modules/browser-level/iterator.js +239 -0
- package/node_modules/browser-level/package.json +48 -0
- package/node_modules/browser-level/util/clear.js +38 -0
- package/node_modules/browser-level/util/deserialize.js +17 -0
- package/node_modules/browser-level/util/key-range.js +20 -0
- package/node_modules/buffer/AUTHORS.md +73 -0
- package/node_modules/buffer/LICENSE +21 -0
- package/node_modules/buffer/README.md +410 -0
- package/node_modules/buffer/index.d.ts +194 -0
- package/node_modules/buffer/index.js +2106 -0
- package/node_modules/buffer/package.json +93 -0
- package/node_modules/classic-level/CHANGELOG.md +115 -0
- package/node_modules/classic-level/LICENSE +21 -0
- package/node_modules/classic-level/README.md +274 -0
- package/node_modules/classic-level/UPGRADING.md +131 -0
- package/node_modules/classic-level/binding.cc +2652 -0
- package/node_modules/classic-level/binding.gyp +71 -0
- package/node_modules/classic-level/binding.js +1 -0
- package/node_modules/classic-level/chained-batch.js +35 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/LICENSE +27 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/Makefile +424 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/build_detect_platform +256 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/autocompact_test.cc +118 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/builder.cc +88 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/builder.h +34 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/c.cc +595 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/c_test.c +390 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/corruption_test.cc +374 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_bench.cc +1020 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_impl.cc +1568 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_impl.h +212 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_iter.cc +317 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_iter.h +28 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_test.cc +2158 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/dbformat.cc +140 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/dbformat.h +230 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/dbformat_test.cc +112 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/dumpfile.cc +225 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/fault_injection_test.cc +554 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/filename.cc +144 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/filename.h +85 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/filename_test.cc +123 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/leveldbutil.cc +64 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_format.h +35 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_reader.cc +284 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_reader.h +113 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_test.cc +591 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_writer.cc +112 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_writer.h +54 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/memtable.cc +145 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/memtable.h +89 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/recovery_test.cc +324 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/repair.cc +461 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/skiplist.h +384 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/skiplist_test.cc +378 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/snapshot.h +67 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/table_cache.cc +127 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/table_cache.h +61 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_edit.cc +266 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_edit.h +107 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_edit_test.cc +46 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_set.cc +1535 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_set.h +399 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_set_test.cc +179 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/write_batch.cc +147 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/write_batch_internal.h +50 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/db/write_batch_test.cc +120 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/helpers/memenv/memenv.cc +398 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/helpers/memenv/memenv.h +20 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/helpers/memenv/memenv_test.cc +241 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/c.h +290 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/cache.h +110 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/comparator.h +63 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/db.h +164 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/dumpfile.h +25 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/env.h +351 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/filter_policy.h +70 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/iterator.h +100 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/options.h +213 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/slice.h +109 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/status.h +112 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/table.h +85 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/table_builder.h +92 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/value_sink.h +26 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/write_batch.h +64 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/issues/issue178_test.cc +92 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/issues/issue200_test.cc +59 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/atomic_pointer.h +242 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port.h +21 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port_example.h +141 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port_posix.cc +53 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port_posix.h +156 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port_posix_sse.cc +129 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/thread_annotations.h +60 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/port/win/stdint.h +24 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/block.cc +268 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/block.h +44 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/block_builder.cc +109 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/block_builder.h +57 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/filter_block.cc +111 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/filter_block.h +68 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/filter_block_test.cc +128 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/format.cc +144 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/format.h +108 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/iterator.cc +67 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/iterator_wrapper.h +66 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/merger.cc +197 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/merger.h +26 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/table.cc +285 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/table_builder.cc +270 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/table_test.cc +876 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/two_level_iterator.cc +182 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/table/two_level_iterator.h +34 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/arena.cc +68 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/arena.h +68 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/arena_test.cc +68 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/bloom.cc +95 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/bloom_test.cc +162 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/cache.cc +405 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/cache_test.cc +226 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/coding.cc +194 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/coding.h +104 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/coding_test.cc +196 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/comparator.cc +81 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/crc32c.cc +350 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/crc32c.h +45 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/crc32c_test.cc +72 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env.cc +100 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env_posix.cc +695 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env_posix_test.cc +66 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env_posix_test_helper.h +28 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env_test.cc +106 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/filter_policy.cc +11 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/hash.cc +52 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/hash.h +19 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/hash_test.cc +54 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/histogram.cc +139 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/histogram.h +42 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/logging.cc +72 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/logging.h +43 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/mutexlock.h +41 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/options.cc +30 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/posix_logger.h +98 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/random.h +64 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/status.cc +75 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/testharness.cc +77 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/testharness.h +138 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/testutil.cc +51 -0
- package/node_modules/classic-level/deps/leveldb/leveldb-1.20/util/testutil.h +63 -0
- package/node_modules/classic-level/deps/leveldb/leveldb.gyp +282 -0
- package/node_modules/classic-level/deps/leveldb/patches/001-value-sink.patch +164 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/atomic_pointer_win.h +48 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/env_win.cc +692 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/port_uv.cc +36 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/port_uv.h +157 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/port_uv.h.bak +153 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/stdint-msvc2008.h +247 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/uv_condvar.h +45 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/uv_condvar_posix.cc +139 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/win_logger.cc +79 -0
- package/node_modules/classic-level/deps/leveldb/port-libuv/win_logger.h +28 -0
- package/node_modules/classic-level/deps/snappy/freebsd/config.h +135 -0
- package/node_modules/classic-level/deps/snappy/freebsd/snappy-stubs-public.h +100 -0
- package/node_modules/classic-level/deps/snappy/linux/config.h +135 -0
- package/node_modules/classic-level/deps/snappy/linux/snappy-stubs-public.h +100 -0
- package/node_modules/classic-level/deps/snappy/mac/config.h +137 -0
- package/node_modules/classic-level/deps/snappy/mac/snappy-stubs-public.h +100 -0
- package/node_modules/classic-level/deps/snappy/openbsd/config.h +135 -0
- package/node_modules/classic-level/deps/snappy/openbsd/snappy-stubs-public.h +100 -0
- package/node_modules/classic-level/deps/snappy/snappy/COPYING +54 -0
- package/node_modules/classic-level/deps/snappy/snappy/cmake/SnappyConfig.cmake +1 -0
- package/node_modules/classic-level/deps/snappy/snappy/cmake/config.h.in +62 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-c.cc +90 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-c.h +138 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-internal.h +224 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-sinksource.cc +104 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-sinksource.h +182 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-stubs-internal.cc +42 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-stubs-internal.h +561 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-stubs-public.h.in +94 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-test.cc +612 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy-test.h +573 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy.cc +1515 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy.h +203 -0
- package/node_modules/classic-level/deps/snappy/snappy/snappy_unittest.cc +1410 -0
- package/node_modules/classic-level/deps/snappy/snappy.gyp +119 -0
- package/node_modules/classic-level/deps/snappy/solaris/config.h +135 -0
- package/node_modules/classic-level/deps/snappy/solaris/snappy-stubs-public.h +100 -0
- package/node_modules/classic-level/deps/snappy/win32/config.h +29 -0
- package/node_modules/classic-level/deps/snappy/win32/snappy-stubs-public.h +100 -0
- package/node_modules/classic-level/index.d.ts +343 -0
- package/node_modules/classic-level/index.js +311 -0
- package/node_modules/classic-level/iterator.js +122 -0
- package/node_modules/classic-level/package.json +70 -0
- package/node_modules/classic-level/prebuilds/android-arm/classic-level.armv7.node +0 -0
- package/node_modules/classic-level/prebuilds/android-arm64/classic-level.armv8.node +0 -0
- package/node_modules/classic-level/prebuilds/darwin-x64+arm64/classic-level.node +0 -0
- package/node_modules/classic-level/prebuilds/linux-arm/classic-level.armv6.node +0 -0
- package/node_modules/classic-level/prebuilds/linux-arm/classic-level.armv7.node +0 -0
- package/node_modules/classic-level/prebuilds/linux-arm64/classic-level.armv8.node +0 -0
- package/node_modules/classic-level/prebuilds/linux-x64/classic-level.musl.node +0 -0
- package/node_modules/classic-level/prebuilds/linux-x64/classic-level.node +0 -0
- package/node_modules/classic-level/prebuilds/win32-ia32/classic-level.node +0 -0
- package/node_modules/classic-level/prebuilds/win32-x64/classic-level.node +0 -0
- package/node_modules/ieee754/LICENSE +11 -0
- package/node_modules/ieee754/README.md +51 -0
- package/node_modules/ieee754/index.d.ts +10 -0
- package/node_modules/ieee754/index.js +85 -0
- package/node_modules/ieee754/package.json +52 -0
- package/node_modules/is-buffer/LICENSE +21 -0
- package/node_modules/is-buffer/README.md +54 -0
- package/node_modules/is-buffer/index.d.ts +2 -0
- package/node_modules/is-buffer/index.js +11 -0
- package/node_modules/is-buffer/package.json +65 -0
- package/node_modules/level/CHANGELOG.md +532 -0
- package/node_modules/level/LICENSE +21 -0
- package/node_modules/level/README.md +107 -0
- package/node_modules/level/UPGRADING.md +413 -0
- package/node_modules/level/browser.js +1 -0
- package/node_modules/level/index.d.ts +75 -0
- package/node_modules/level/index.js +1 -0
- package/node_modules/level/package.json +62 -0
- package/node_modules/level-supports/CHANGELOG.md +140 -0
- package/node_modules/level-supports/LICENSE +21 -0
- package/node_modules/level-supports/README.md +276 -0
- package/node_modules/level-supports/index.d.ts +137 -0
- package/node_modules/level-supports/index.js +26 -0
- package/node_modules/level-supports/package.json +46 -0
- package/node_modules/level-supports/test/cloneable.js +26 -0
- package/node_modules/level-supports/test/index.js +24 -0
- package/node_modules/level-supports/test/self.js +86 -0
- package/node_modules/level-supports/test/shape.js +23 -0
- package/node_modules/level-transcoder/CHANGELOG.md +15 -0
- package/node_modules/level-transcoder/LICENSE +21 -0
- package/node_modules/level-transcoder/README.md +214 -0
- package/node_modules/level-transcoder/UPGRADING.md +13 -0
- package/node_modules/level-transcoder/index.d.ts +27 -0
- package/node_modules/level-transcoder/index.js +158 -0
- package/node_modules/level-transcoder/lib/encoding.d.ts +158 -0
- package/node_modules/level-transcoder/lib/encoding.js +105 -0
- package/node_modules/level-transcoder/lib/encodings.d.ts +9 -0
- package/node_modules/level-transcoder/lib/encodings.js +135 -0
- package/node_modules/level-transcoder/lib/formats.d.ts +13 -0
- package/node_modules/level-transcoder/lib/formats.js +111 -0
- package/node_modules/level-transcoder/lib/text-endec.d.ts +6 -0
- package/node_modules/level-transcoder/lib/text-endec.js +19 -0
- package/node_modules/level-transcoder/package.json +46 -0
- package/node_modules/maybe-combine-errors/LICENSE.md +21 -0
- package/node_modules/maybe-combine-errors/README.md +94 -0
- package/node_modules/maybe-combine-errors/index.js +60 -0
- package/node_modules/maybe-combine-errors/package.json +33 -0
- package/node_modules/module-error/CHANGELOG.md +23 -0
- package/node_modules/module-error/LICENSE +21 -0
- package/node_modules/module-error/README.md +89 -0
- package/node_modules/module-error/index.d.ts +18 -0
- package/node_modules/module-error/index.js +22 -0
- package/node_modules/module-error/package.json +36 -0
- package/node_modules/napi-macros/LICENSE +21 -0
- package/node_modules/napi-macros/README.md +277 -0
- package/node_modules/napi-macros/index.js +1 -0
- package/node_modules/napi-macros/napi-macros.h +255 -0
- package/node_modules/napi-macros/package.json +22 -0
- package/node_modules/node-gyp-build/LICENSE +21 -0
- package/node_modules/node-gyp-build/README.md +58 -0
- package/node_modules/node-gyp-build/SECURITY.md +5 -0
- package/node_modules/node-gyp-build/bin.js +84 -0
- package/node_modules/node-gyp-build/build-test.js +19 -0
- package/node_modules/node-gyp-build/index.js +6 -0
- package/node_modules/node-gyp-build/node-gyp-build.js +207 -0
- package/node_modules/node-gyp-build/optional.js +7 -0
- package/node_modules/node-gyp-build/package.json +43 -0
- package/package.json +6 -3
- package/{providerPresetApply-7XEHTODR.js → providerPresetApply-XTEXOH7X.js} +3 -3
- package/{providerRegistry-GNV4FFSA.js → providerRegistry-ADYDSLKR.js} +3 -3
- package/{readlineWorkspace-46KDFUHN.js → readlineWorkspace-LO6ZLFTO.js} +1381 -1317
- package/{runAgentClientLoop-CQWLWU4W.js → runAgentClientLoop-KAYGKVTK.js} +16 -15
- package/{runtimeDoctorCommands-3USD722U.js → runtimeDoctorCommands-ID23PNNZ.js} +28 -0
- package/{spaceCommands-TSBC5UWP.js → spaceCommands-FA6RCZ2Y.js} +10 -9
- package/{streamAgentChatTurn-XD5JEJXA.js → streamAgentChatTurn-DFNDU2UY.js} +17 -16
- package/{tools-5NAJJTFN.js → tools-6HKH75NT.js} +13 -12
- package/{tuiSummaryLlmCaller-7KLLDP22.js → tuiSummaryLlmCaller-CFFVXQWX.js} +2 -2
- package/{updateCommands-XYMGOKF4.js → updateCommands-4EHDLF5J.js} +1 -1
- package/{updateDialogTitleAction-IKZPJCRA.js → updateDialogTitleAction-FFSYTLBC.js} +3 -3
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const shape = require('./shape')
|
|
4
|
+
const cloneable = require('./cloneable')
|
|
5
|
+
|
|
6
|
+
module.exports = function suite (test, testCommon) {
|
|
7
|
+
test('db has manifest', async function (t) {
|
|
8
|
+
const db = testCommon.factory()
|
|
9
|
+
const manifest = db.supports
|
|
10
|
+
|
|
11
|
+
shape(t, manifest)
|
|
12
|
+
cloneable(t, manifest)
|
|
13
|
+
|
|
14
|
+
const before = Object.assign({}, manifest, {
|
|
15
|
+
additionalMethods: Object.assign({}, manifest.additionalMethods)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
await db.open()
|
|
19
|
+
t.same(db.supports, before, 'manifest did not change after open')
|
|
20
|
+
|
|
21
|
+
await db.close()
|
|
22
|
+
t.same(db.supports, before, 'manifest did not change after close')
|
|
23
|
+
})
|
|
24
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('tape')
|
|
4
|
+
const { supports } = require('..')
|
|
5
|
+
const shape = require('./shape')
|
|
6
|
+
const cloneable = require('./cloneable')
|
|
7
|
+
|
|
8
|
+
test('no options', function (t) {
|
|
9
|
+
shape(t, supports())
|
|
10
|
+
cloneable(t, supports())
|
|
11
|
+
t.end()
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
test('falsy options', function (t) {
|
|
15
|
+
;[null, false, undefined, 0, ''].forEach(function (value) {
|
|
16
|
+
const manifest = supports({
|
|
17
|
+
seek: value,
|
|
18
|
+
additionalMethods: {
|
|
19
|
+
foo: value
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
shape(t, manifest)
|
|
24
|
+
t.is(manifest.seek, false)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
t.end()
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
test('truthy options', function (t) {
|
|
31
|
+
;[true, {}, 'yes', 1, []].forEach(function (value) {
|
|
32
|
+
const manifest = supports({
|
|
33
|
+
streams: value,
|
|
34
|
+
additionalMethods: {
|
|
35
|
+
foo: value
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
shape(t, manifest)
|
|
40
|
+
t.same(manifest.streams, value)
|
|
41
|
+
t.same(manifest.additionalMethods.foo, value)
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
t.end()
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
test('merges input objects without mutating them', function (t) {
|
|
48
|
+
const input1 = { seek: null, streams: false }
|
|
49
|
+
const input2 = { streams: true, additionalMethods: {} }
|
|
50
|
+
const manifest = supports(input1, input2)
|
|
51
|
+
|
|
52
|
+
manifest.foobar = true
|
|
53
|
+
manifest.additionalMethods.baz = true
|
|
54
|
+
|
|
55
|
+
t.same(input1, { seek: null, streams: false })
|
|
56
|
+
t.same(input2, { streams: true, additionalMethods: {} })
|
|
57
|
+
t.is(manifest.seek, false)
|
|
58
|
+
t.is(manifest.streams, true)
|
|
59
|
+
shape(t, manifest)
|
|
60
|
+
t.end()
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
test('inherits additionalMethods', function (t) {
|
|
64
|
+
const manifest = supports({ additionalMethods: { foo: true } }, {})
|
|
65
|
+
t.same(manifest.additionalMethods, { foo: true })
|
|
66
|
+
t.end()
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
test('does not merge additionalMethods', function (t) {
|
|
70
|
+
const input1 = { additionalMethods: { foo: true } }
|
|
71
|
+
const input2 = { additionalMethods: { bar: true } }
|
|
72
|
+
const manifest = supports(input1, input2)
|
|
73
|
+
t.same(manifest.additionalMethods, { bar: true })
|
|
74
|
+
t.end()
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
test('adds snapshots alias', function (t) {
|
|
78
|
+
for (const value of [true, false]) {
|
|
79
|
+
t.is(supports({ implicitSnapshots: value }).implicitSnapshots, value)
|
|
80
|
+
t.is(supports({ implicitSnapshots: value }).snapshots, value)
|
|
81
|
+
t.is(supports({ snapshots: value }).implicitSnapshots, value)
|
|
82
|
+
t.is(supports({ snapshots: value }).snapshots, value)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
t.end()
|
|
86
|
+
})
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty
|
|
4
|
+
|
|
5
|
+
module.exports = function shape (t, manifest) {
|
|
6
|
+
t.ok(isObject(manifest), 'manifest is object')
|
|
7
|
+
t.ok(isObject(manifest.additionalMethods), 'additionalMethods is object')
|
|
8
|
+
t.ok(isObject(manifest.signals), 'signals is object')
|
|
9
|
+
|
|
10
|
+
for (const k in manifest) {
|
|
11
|
+
if (!hasOwnProperty.call(manifest, k)) continue
|
|
12
|
+
|
|
13
|
+
if (manifest[k]) {
|
|
14
|
+
t.ok(manifest[k], 'truthy: ' + k)
|
|
15
|
+
} else {
|
|
16
|
+
t.is(manifest[k], false, 'false: ' + k)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function isObject (o) {
|
|
22
|
+
return typeof o === 'object' && o !== null
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.0.1] - 2021-11-26
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Remove `codecs` from supported interfaces in `README` ([`3b6b003`](https://github.com/Level/transcoder/commit/3b6b003))
|
|
8
|
+
|
|
9
|
+
## [1.0.0] - 2021-11-07
|
|
10
|
+
|
|
11
|
+
_:seedling: Initial release._
|
|
12
|
+
|
|
13
|
+
[1.0.1]: https://github.com/Level/transcoder/releases/tag/v1.0.1
|
|
14
|
+
|
|
15
|
+
[1.0.0]: https://github.com/Level/transcoder/releases/tag/v1.0.0
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2012 The contributors to level-transcoder and level-codec.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# level-transcoder
|
|
2
|
+
|
|
3
|
+
**Encode data with built-in or custom encodings.** The successor to [`level-codec`][level-codec] that transcodes encodings from and to internal data formats supported by a database. This allows a database to store data in a format of its choice (Buffer, Uint8Array or String) with zero-effort support of known encodings. That includes other encoding interfaces in the ecosystem like [`abstract-encoding`][abstract-enc] and [`multiformats`][blockcodec].
|
|
4
|
+
|
|
5
|
+
[![level badge][level-badge]](https://github.com/Level/awesome)
|
|
6
|
+
[](https://www.npmjs.com/package/level-transcoder)
|
|
7
|
+
[](https://www.npmjs.com/package/level-transcoder)
|
|
8
|
+
[](https://github.com/Level/transcoder/actions/workflows/test.yml)
|
|
9
|
+
[](https://codecov.io/gh/Level/transcoder)
|
|
10
|
+
[](https://standardjs.com)
|
|
11
|
+
[](https://common-changelog.org)
|
|
12
|
+
[](https://opencollective.com/level)
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
Create a transcoder, passing a desired format:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
const { Transcoder } = require('level-transcoder')
|
|
20
|
+
|
|
21
|
+
const transcoder1 = new Transcoder(['view'])
|
|
22
|
+
const transcoder2 = new Transcoder(['buffer'])
|
|
23
|
+
const transcoder3 = new Transcoder(['utf8'])
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then select an encoding and encode some data:
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
// Uint8Array(3) [ 49, 50, 51 ]
|
|
30
|
+
console.log(transcoder1.encoding('json').encode(123))
|
|
31
|
+
|
|
32
|
+
// <Buffer 31 32 33>
|
|
33
|
+
console.log(transcoder2.encoding('json').encode(123))
|
|
34
|
+
|
|
35
|
+
// '123'
|
|
36
|
+
console.log(transcoder3.encoding('json').encode(123))
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
If the `Transcoder` constructor is given multiple formats then `Transcoder#encoding()` selects an encoding with the best fitting format. Consider a database like [`leveldown`][leveldown] which has the ability to return data as a Buffer or string. If an `encoding.decode(data)` function needs a string, we'll want to fetch that `data` from the database as a string. This avoids the cost of having to convert a Buffer to a string. So we'd use the following transcoder:
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
const transcoder = new Transcoder(['buffer', 'utf8'])
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Then, knowing for example that the return value of `JSON.stringify(data)` is a UTF-8 string which matches one of the given formats, the `'json'` encoding will return a string here:
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
// '123'
|
|
49
|
+
console.log(transcoder.encoding('json').encode(123))
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
In contrast, data encoded as a `'view'` (for now that just means Uint8Array) would get transcoded into the `'buffer'` encoding. Copying of data is avoided where possible, like how the underlying ArrayBuffer of a view can be passed to `Buffer.from(..)` without a copy.
|
|
53
|
+
|
|
54
|
+
Lastly, encodings returned by `Transcoder#encoding()` have a `format` property to be used to forward information to an underlying store. For example: an input value of `{ x: 3 }` using the `'json'` encoding which has a `format` of `'utf8'`, can be forwarded as value `'{"x":3}'` with encoding `'utf8'`. Vice versa for output.
|
|
55
|
+
|
|
56
|
+
## Encodings
|
|
57
|
+
|
|
58
|
+
### Built-in Encodings
|
|
59
|
+
|
|
60
|
+
These encodings can be used out of the box and are to be selected by name.
|
|
61
|
+
|
|
62
|
+
In this table, the _input_ is what `encode()` accepts. The _format_ is what `encode()` returns as well as what `decode()` accepts. The _output_ is what `decode()` returns. The TypeScript typings of `level-transcoder` have generic type parameters with matching names: `TIn`, `TFormat` and `TOut`.
|
|
63
|
+
|
|
64
|
+
| Name | Input | Format | Output |
|
|
65
|
+
| :---------------------- | :------------------------- | :--------- | :-------------- |
|
|
66
|
+
| `'buffer'` <sup>1</sup> | Buffer, Uint8Array, String | `'buffer'` | Buffer |
|
|
67
|
+
| `'view'` | Uint8Array, Buffer, String | `'view'` | Uint8Array |
|
|
68
|
+
| `'utf8'` | String, Buffer, Uint8Array | `'utf8'` | String |
|
|
69
|
+
| `'json'` | Any JSON type | `'utf8'` | As input |
|
|
70
|
+
| `'hex'` | String (hex), Buffer | `'buffer'` | String (hex) |
|
|
71
|
+
| `'base64'` | String (base64), Buffer | `'buffer'` | String (base64) |
|
|
72
|
+
|
|
73
|
+
<sup>1</sup> Aliased as `'binary'`. Use of this alias does not affect the ability to transcode.
|
|
74
|
+
|
|
75
|
+
### Transcoder Encodings
|
|
76
|
+
|
|
77
|
+
It's not necessary to use or reference the below encodings directly. They're listed here for implementation notes and to show how input and output is the same; it's the format that differs.
|
|
78
|
+
|
|
79
|
+
Custom encodings are transcoded in the same way and require no additional setup. For example: if a custom encoding has `{ name: 'example', format: 'utf8' }` then `level-transcoder` will create transcoder encodings on demand with names `'example+buffer'` and `'example+view'`.
|
|
80
|
+
|
|
81
|
+
| Name | Input | Format | Output |
|
|
82
|
+
| :--------------------------- | :------------------------- | :--------- | :-------------- |
|
|
83
|
+
| `'buffer+view'` | Buffer, Uint8Array, String | `'view'` | Buffer |
|
|
84
|
+
| `'view+buffer'` | Uint8Array, Buffer, String | `'buffer'` | Uint8Array |
|
|
85
|
+
| `'utf8+view'` | String, Buffer, Uint8Array | `'view'` | String |
|
|
86
|
+
| `'utf8+buffer'` | String, Buffer, Uint8Array | `'buffer'` | String |
|
|
87
|
+
| `'json+view'` | Any JSON type | `'view'` | As input |
|
|
88
|
+
| `'json+buffer'` | Any JSON type | `'buffer'` | As input |
|
|
89
|
+
| `'hex+view'` <sup>1</sup> | String (hex), Buffer | `'view'` | String (hex) |
|
|
90
|
+
| `'base64+view'` <sup>1</sup> | String (base64), Buffer | `'view'` | String (base64) |
|
|
91
|
+
|
|
92
|
+
<sup>1</sup> Unlike other encodings that transcode to `'view'`, these depend on Buffer at the moment and thus don't work in browsers if a [shim](https://github.com/feross/buffer) is not included by JavaScript bundlers like Webpack and Browserify.
|
|
93
|
+
|
|
94
|
+
### Ecosystem Encodings
|
|
95
|
+
|
|
96
|
+
Various modules in the ecosystem, in and outside of Level, can be used with `level-transcoder` although they follow different interfaces. Common between the interfaces is that they have `encode()` and `decode()` methods. The terms "codec" and "encoding" are used interchangeably in the ecosystem. Passing these encodings through `Transcoder#encoding()` (which is done implicitly when used in an `abstract-level` database) results in normalized encoding objects as described further below.
|
|
97
|
+
|
|
98
|
+
| Module | Format | Interface | Named |
|
|
99
|
+
| :----------------------------------------- | :--------------- | :---------------------------------- | :---- |
|
|
100
|
+
| [`protocol-buffers`][protocol-buffers] | `buffer` | [`level-codec`][level-codec] | ❌ |
|
|
101
|
+
| [`charwise`][charwise] | `utf8` | [`level-codec`][level-codec] | ✅ |
|
|
102
|
+
| [`bytewise`][bytewise] | `buffer` | [`level-codec`][level-codec] | ✅ |
|
|
103
|
+
| [`lexicographic-integer-encoding`][lexint] | `buffer`, `utf8` | [`level-codec`][level-codec] | ✅ |
|
|
104
|
+
| [`abstract-encoding`][abstract-enc] | `buffer` | [`abstract-encoding`][abstract-enc] | ❌ |
|
|
105
|
+
| [`multiformats`][js-multiformats] | `view` | [`multiformats`][blockcodec] | ✅ |
|
|
106
|
+
|
|
107
|
+
Those marked as not named are modules that export or generate encodings that don't have a `name` property (or `type` as an alias). We call these _anonymous encodings_. They can only be used as objects and not by name. Passing an anonymous encoding through `Transcoder#encoding()` does give it a `name` property for compatibility, but the value of `name` is not deterministic.
|
|
108
|
+
|
|
109
|
+
## API
|
|
110
|
+
|
|
111
|
+
### `Transcoder`
|
|
112
|
+
|
|
113
|
+
#### `transcoder = new Transcoder(formats)`
|
|
114
|
+
|
|
115
|
+
Create a new transcoder, providing the formats that are supported by a database (or other). The `formats` argument must be an array containing one or more of `'buffer'`, `'view'`, `'utf8'`. The returned `transcoder` instance is stateful, in that it contains a set of cached encoding objects.
|
|
116
|
+
|
|
117
|
+
#### `encoding = transcoder.encoding(encoding)`
|
|
118
|
+
|
|
119
|
+
Returns the given `encoding` argument as a normalized encoding object that follows the `level-transcoder` encoding interface. The `encoding` argument may be:
|
|
120
|
+
|
|
121
|
+
- A string to select a known encoding by its name
|
|
122
|
+
- An object that follows one of the following interfaces: [`level-transcoder`](#encoding-interface), [`level-codec`](https://github.com/Level/codec#encoding-format), [`abstract-encoding`][abstract-enc], [`multiformats`][blockcodec]
|
|
123
|
+
- A previously normalized encoding, such that `encoding(x)` equals `encoding(encoding(x))`.
|
|
124
|
+
|
|
125
|
+
Results are cached. If the `encoding` argument is an object and it has a name then subsequent calls can refer to that encoding by name.
|
|
126
|
+
|
|
127
|
+
Depending on the `formats` provided to the `Transcoder` constructor, this method may return a _transcoder encoding_ that translates the desired encoding from / to a supported format. Its `encode()` and `decode()` methods will have respectively the same input and output types as a non-transcoded encoding, but its `name` property will differ.
|
|
128
|
+
|
|
129
|
+
#### `encodings = transcoder.encodings()`
|
|
130
|
+
|
|
131
|
+
Get an array of encoding objects. This includes:
|
|
132
|
+
|
|
133
|
+
- Encodings for the `formats` that were passed to the `Transcoder` constructor
|
|
134
|
+
- Custom encodings that were passed to `transcoder.encoding()`
|
|
135
|
+
- Transcoder encodings for either.
|
|
136
|
+
|
|
137
|
+
### `Encoding`
|
|
138
|
+
|
|
139
|
+
#### `data = encoding.encode(data)`
|
|
140
|
+
|
|
141
|
+
Encode data.
|
|
142
|
+
|
|
143
|
+
#### `data = encoding.decode(data)`
|
|
144
|
+
|
|
145
|
+
Decode data.
|
|
146
|
+
|
|
147
|
+
#### `encoding.name`
|
|
148
|
+
|
|
149
|
+
Unique name. A string.
|
|
150
|
+
|
|
151
|
+
#### `encoding.commonName`
|
|
152
|
+
|
|
153
|
+
Common name, computed from `name`. If this encoding is a transcoder encoding, `name` will be for example `'json+view'` and `commonName` will be just `'json'`. Else `name` will equal `commonName`.
|
|
154
|
+
|
|
155
|
+
#### `encoding.format`
|
|
156
|
+
|
|
157
|
+
Name of the (lower-level) encoding used by the return value of `encode()`. One of `'buffer'`, `'view'`, `'utf8'`. If `name` equals `format` then the encoding can be assumed to be idempotent, such that `encode(x)` equals `encode(encode(x))`.
|
|
158
|
+
|
|
159
|
+
## Encoding Interface
|
|
160
|
+
|
|
161
|
+
Custom encodings must follow the following interface:
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
interface IEncoding<TIn, TFormat, TOut> {
|
|
165
|
+
name: string
|
|
166
|
+
format: 'buffer' | 'view' | 'utf8'
|
|
167
|
+
encode: (data: TIn) => TFormat
|
|
168
|
+
decode: (data: TFormat) => TOut
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Install
|
|
173
|
+
|
|
174
|
+
With [npm](https://npmjs.org) do:
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
npm install level-transcoder
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Contributing
|
|
181
|
+
|
|
182
|
+
[`Level/transcoder`](https://github.com/Level/transcoder) is an **OPEN Open Source Project**. This means that:
|
|
183
|
+
|
|
184
|
+
> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.
|
|
185
|
+
|
|
186
|
+
See the [Contribution Guide](https://github.com/Level/community/blob/master/CONTRIBUTING.md) for more details.
|
|
187
|
+
|
|
188
|
+
## Donate
|
|
189
|
+
|
|
190
|
+
Support us with a monthly donation on [Open Collective](https://opencollective.com/level) and help us continue our work.
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
|
|
194
|
+
[MIT](LICENSE)
|
|
195
|
+
|
|
196
|
+
[level-badge]: https://leveljs.org/img/badge.svg
|
|
197
|
+
|
|
198
|
+
[level-codec]: https://github.com/Level/codec
|
|
199
|
+
|
|
200
|
+
[leveldown]: https://github.com/Level/leveldown
|
|
201
|
+
|
|
202
|
+
[protocol-buffers]: https://github.com/mafintosh/protocol-buffers
|
|
203
|
+
|
|
204
|
+
[charwise]: https://github.com/dominictarr/charwise
|
|
205
|
+
|
|
206
|
+
[bytewise]: https://github.com/deanlandolt/bytewise
|
|
207
|
+
|
|
208
|
+
[lexint]: https://github.com/vweevers/lexicographic-integer-encoding
|
|
209
|
+
|
|
210
|
+
[abstract-enc]: https://github.com/mafintosh/abstract-encoding
|
|
211
|
+
|
|
212
|
+
[js-multiformats]: https://github.com/multiformats/js-multiformats
|
|
213
|
+
|
|
214
|
+
[blockcodec]: https://github.com/multiformats/js-multiformats/blob/master/src/codecs/interface.ts
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Upgrade Guide
|
|
2
|
+
|
|
3
|
+
This document describes breaking changes and how to upgrade. For a complete list of changes including minor and patch releases, please refer to the [changelog](CHANGELOG.md).
|
|
4
|
+
|
|
5
|
+
## 1.0.0
|
|
6
|
+
|
|
7
|
+
This is the initial release of `level-transcoder`, which was forked from `level-codec`. Ultimately `level-transcoder` got a completely different API, so the two modules are not interchangeable. That said, here are the high-level differences from `level-codec` just for the record:
|
|
8
|
+
|
|
9
|
+
- Throws if an encoding is not found, rather than falling back to `'id'` encoding
|
|
10
|
+
- The `'binary'` encoding has been renamed to `'buffer'`, with `'binary'` as an alias
|
|
11
|
+
- The `'utf8'` encoding of `level-codec` did not touch Buffers. In `level-transcoder` the same encoding will call `buffer.toString('utf8')` for consistency. Consumers can use the `'buffer'` encoding to avoid this conversion.
|
|
12
|
+
- The `'id'` encoding (aliased as `'none'`) which wasn't supported by any active `abstract-leveldown` implementation, has been removed.
|
|
13
|
+
- The `'ascii'`, `'ucs2'` and `'utf16le'` encodings are not supported.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Encoding, MixedEncoding, KnownEncoding, KnownEncodingName } from './lib/encoding'
|
|
2
|
+
|
|
3
|
+
export class Transcoder<T = any> {
|
|
4
|
+
/**
|
|
5
|
+
* Create a Transcoder.
|
|
6
|
+
* @param formats Formats supported by consumer.
|
|
7
|
+
*/
|
|
8
|
+
constructor (formats: Array<'buffer'|'view'|'utf8'>)
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Get an array of supported encoding objects.
|
|
12
|
+
*/
|
|
13
|
+
encodings (): Array<Encoding<any, T, any>>
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Get the given encoding, creating a transcoder encoding if necessary.
|
|
17
|
+
* @param encoding Named encoding or encoding object.
|
|
18
|
+
*/
|
|
19
|
+
encoding<TIn, TFormat, TOut> (
|
|
20
|
+
encoding: MixedEncoding<TIn, TFormat, TOut>
|
|
21
|
+
): Encoding<TIn, T, TOut>
|
|
22
|
+
|
|
23
|
+
encoding<N extends KnownEncodingName> (encoding: N): KnownEncoding<N, T>
|
|
24
|
+
encoding (encoding: string): Encoding<any, T, any>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export * from './lib/encoding'
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const ModuleError = require('module-error')
|
|
4
|
+
const encodings = require('./lib/encodings')
|
|
5
|
+
const { Encoding } = require('./lib/encoding')
|
|
6
|
+
const { BufferFormat, ViewFormat, UTF8Format } = require('./lib/formats')
|
|
7
|
+
|
|
8
|
+
const kFormats = Symbol('formats')
|
|
9
|
+
const kEncodings = Symbol('encodings')
|
|
10
|
+
const validFormats = new Set(['buffer', 'view', 'utf8'])
|
|
11
|
+
|
|
12
|
+
/** @template T */
|
|
13
|
+
class Transcoder {
|
|
14
|
+
/**
|
|
15
|
+
* @param {Array<'buffer'|'view'|'utf8'>} formats
|
|
16
|
+
*/
|
|
17
|
+
constructor (formats) {
|
|
18
|
+
if (!Array.isArray(formats)) {
|
|
19
|
+
throw new TypeError("The first argument 'formats' must be an array")
|
|
20
|
+
} else if (!formats.every(f => validFormats.has(f))) {
|
|
21
|
+
// Note: we only only support aliases in key- and valueEncoding options (where we already did)
|
|
22
|
+
throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** @type {Map<string|MixedEncoding<any, any, any>, Encoding<any, any, any>>} */
|
|
26
|
+
this[kEncodings] = new Map()
|
|
27
|
+
this[kFormats] = new Set(formats)
|
|
28
|
+
|
|
29
|
+
// Register encodings (done early in order to populate encodings())
|
|
30
|
+
for (const k in encodings) {
|
|
31
|
+
try {
|
|
32
|
+
this.encoding(k)
|
|
33
|
+
} catch (err) {
|
|
34
|
+
/* istanbul ignore if: assertion */
|
|
35
|
+
if (err.code !== 'LEVEL_ENCODING_NOT_SUPPORTED') throw err
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @returns {Array<Encoding<any,T,any>>}
|
|
42
|
+
*/
|
|
43
|
+
encodings () {
|
|
44
|
+
return Array.from(new Set(this[kEncodings].values()))
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param {string|MixedEncoding<any, any, any>} encoding
|
|
49
|
+
* @returns {Encoding<any, T, any>}
|
|
50
|
+
*/
|
|
51
|
+
encoding (encoding) {
|
|
52
|
+
let resolved = this[kEncodings].get(encoding)
|
|
53
|
+
|
|
54
|
+
if (resolved === undefined) {
|
|
55
|
+
if (typeof encoding === 'string' && encoding !== '') {
|
|
56
|
+
resolved = lookup[encoding]
|
|
57
|
+
|
|
58
|
+
if (!resolved) {
|
|
59
|
+
throw new ModuleError(`Encoding '${encoding}' is not found`, {
|
|
60
|
+
code: 'LEVEL_ENCODING_NOT_FOUND'
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
} else if (typeof encoding !== 'object' || encoding === null) {
|
|
64
|
+
throw new TypeError("First argument 'encoding' must be a string or object")
|
|
65
|
+
} else {
|
|
66
|
+
resolved = from(encoding)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const { name, format } = resolved
|
|
70
|
+
|
|
71
|
+
if (!this[kFormats].has(format)) {
|
|
72
|
+
if (this[kFormats].has('view')) {
|
|
73
|
+
resolved = resolved.createViewTranscoder()
|
|
74
|
+
} else if (this[kFormats].has('buffer')) {
|
|
75
|
+
resolved = resolved.createBufferTranscoder()
|
|
76
|
+
} else if (this[kFormats].has('utf8')) {
|
|
77
|
+
resolved = resolved.createUTF8Transcoder()
|
|
78
|
+
} else {
|
|
79
|
+
throw new ModuleError(`Encoding '${name}' cannot be transcoded`, {
|
|
80
|
+
code: 'LEVEL_ENCODING_NOT_SUPPORTED'
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
for (const k of [encoding, name, resolved.name, resolved.commonName]) {
|
|
86
|
+
this[kEncodings].set(k, resolved)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return resolved
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
exports.Transcoder = Transcoder
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @param {MixedEncoding<any, any, any>} options
|
|
98
|
+
* @returns {Encoding<any, any, any>}
|
|
99
|
+
*/
|
|
100
|
+
function from (options) {
|
|
101
|
+
if (options instanceof Encoding) {
|
|
102
|
+
return options
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Loosely typed for ecosystem compatibility
|
|
106
|
+
const maybeType = 'type' in options && typeof options.type === 'string' ? options.type : undefined
|
|
107
|
+
const name = options.name || maybeType || `anonymous-${anonymousCount++}`
|
|
108
|
+
|
|
109
|
+
switch (detectFormat(options)) {
|
|
110
|
+
case 'view': return new ViewFormat({ ...options, name })
|
|
111
|
+
case 'utf8': return new UTF8Format({ ...options, name })
|
|
112
|
+
case 'buffer': return new BufferFormat({ ...options, name })
|
|
113
|
+
default: {
|
|
114
|
+
throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* If format is not provided, fallback to detecting `level-codec`
|
|
121
|
+
* or `multiformats` encodings, else assume a format of buffer.
|
|
122
|
+
* @param {MixedEncoding<any, any, any>} options
|
|
123
|
+
* @returns {string}
|
|
124
|
+
*/
|
|
125
|
+
function detectFormat (options) {
|
|
126
|
+
if ('format' in options && options.format !== undefined) {
|
|
127
|
+
return options.format
|
|
128
|
+
} else if ('buffer' in options && typeof options.buffer === 'boolean') {
|
|
129
|
+
return options.buffer ? 'buffer' : 'utf8' // level-codec
|
|
130
|
+
} else if ('code' in options && Number.isInteger(options.code)) {
|
|
131
|
+
return 'view' // multiformats
|
|
132
|
+
} else {
|
|
133
|
+
return 'buffer'
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @typedef {import('./lib/encoding').MixedEncoding<TIn,TFormat,TOut>} MixedEncoding
|
|
139
|
+
* @template TIn, TFormat, TOut
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @type {Object.<string, Encoding<any, any, any>>}
|
|
144
|
+
*/
|
|
145
|
+
const aliases = {
|
|
146
|
+
binary: encodings.buffer,
|
|
147
|
+
'utf-8': encodings.utf8
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @type {Object.<string, Encoding<any, any, any>>}
|
|
152
|
+
*/
|
|
153
|
+
const lookup = {
|
|
154
|
+
...encodings,
|
|
155
|
+
...aliases
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
let anonymousCount = 0
|