slidge-whatsapp 0.2.6__cp312-cp312-manylinux_2_36_aarch64.whl → 0.3.0b0__cp312-cp312-manylinux_2_36_aarch64.whl
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.
- slidge_whatsapp/contact.py +13 -3
- slidge_whatsapp/event.go +115 -39
- slidge_whatsapp/gateway.go +7 -63
- slidge_whatsapp/gateway.py +2 -3
- slidge_whatsapp/generated/_whatsapp.cpython-312-aarch64-linux-gnu.h +169 -152
- slidge_whatsapp/generated/_whatsapp.cpython-312-aarch64-linux-gnu.so +0 -0
- slidge_whatsapp/generated/build.py +134 -120
- slidge_whatsapp/generated/whatsapp.c +1511 -1239
- slidge_whatsapp/generated/whatsapp.go +1263 -1152
- slidge_whatsapp/generated/whatsapp.py +1171 -1046
- slidge_whatsapp/generated/whatsapp_go.h +169 -152
- slidge_whatsapp/go.mod +18 -15
- slidge_whatsapp/go.sum +38 -32
- slidge_whatsapp/group.py +34 -30
- slidge_whatsapp/media/media.go +6 -2
- slidge_whatsapp/session.go +33 -16
- slidge_whatsapp/session.py +46 -14
- slidge_whatsapp/vendor/github.com/beeper/argo-go/LICENSE +9 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/block/blockreader.go +329 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/block/blockwriter.go +417 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/codec/decoder.go +652 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/codec/encoder.go +985 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/header/header.go +135 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/internal/util/util.go +133 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/label/label.go +384 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/label/wiremarkers.go +37 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/pkg/bitset/bitset.go +197 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/pkg/buf/buf.go +420 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/pkg/varint/varint.go +246 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/wire/wire.go +614 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/wirecodec/decode.go +341 -0
- slidge_whatsapp/vendor/github.com/elliotchance/orderedmap/v3/LICENSE +21 -0
- slidge_whatsapp/vendor/github.com/elliotchance/orderedmap/v3/list.go +95 -0
- slidge_whatsapp/vendor/github.com/elliotchance/orderedmap/v3/orderedmap.go +187 -0
- slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/fitz.go +1 -0
- slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/fitz_cgo.go +3 -0
- slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/fitz_nocgo.go +4 -5
- slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/purego_darwin.go +11 -1
- slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/purego_linux.go +10 -0
- slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/purego_windows.go +12 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/.gitignore +0 -2
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/CHANGELOG.md +30 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/COPYRIGHT.txt +6 -1
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/README.md +14 -17
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/abi.go +1 -1
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/abi2.go +7 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/assets/libffi/LICENSE +21 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/assets/libffi/darwin_amd64/libffi.8.dylib +0 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/assets/libffi/darwin_arm64/libffi.8.dylib +0 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/assets/libffi/windows_amd64/libffi-8.dll +0 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/cif.go +15 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/cif_arm64.go +16 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/embed.go +49 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/embed_darwin_amd64.go +10 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/embed_darwin_arm64.go +10 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/embed_windows_amd64.go +10 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/ffi.go +51 -13
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/init.go +22 -9
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/README.md +2 -0
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c +3096 -1651
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h +188 -128
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_userauth.go +13 -140
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3ext.h +4 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.23.go +2 -2
- slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.25.go +37 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/LICENSE +19 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/argmap.go +37 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/collections.go +148 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/comment.go +31 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/decode.go +216 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/definition.go +110 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/directive.go +43 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/document.go +89 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/dumper.go +159 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/fragment.go +41 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/operation.go +32 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/path.go +72 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/selection.go +41 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/source.go +19 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/type.go +68 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/value.go +122 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exhttp/handleerrors.go +60 -26
- slidge_whatsapp/vendor/go.mau.fi/util/exhttp/json.go +1 -6
- slidge_whatsapp/vendor/go.mau.fi/util/exhttp/networkerror.go +2 -1
- slidge_whatsapp/vendor/go.mau.fi/util/exstrings/stringutil.go +104 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/event.go +19 -3
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/.pre-commit-config.yaml +3 -3
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/decode.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/hash.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate.go +5 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/argo/argo-wire-type-store.argo +63 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/argo/argo.go +62 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/argo/name-to-queryids.json +306 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/armadillomessage.go +40 -7
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/binary/encoder.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/call.go +2 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/client.go +79 -45
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/connectionevents.go +13 -6
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download-to-file.go +19 -12
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download.go +26 -6
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/errors.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/group.go +99 -27
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/internals.go +54 -26
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/keepalive.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/message.go +208 -57
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/msgsecret.go +2 -14
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/newsletter.go +83 -7
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/notification.go +17 -8
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair-code.go +2 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/presence.go +15 -6
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/extra.go +7 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/InstamadilloAddMessage.pb.go +983 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/InstamadilloAddMessage.proto +85 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/extra.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeActionLog/InstamadilloCoreTypeActionLog.pb.go +197 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeActionLog/InstamadilloCoreTypeActionLog.proto +13 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeAdminMessage/InstamadilloCoreTypeAdminMessage.pb.go +279 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeAdminMessage/InstamadilloCoreTypeAdminMessage.proto +21 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeCollection/InstamadilloCoreTypeCollection.pb.go +137 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeCollection/InstamadilloCoreTypeCollection.proto +10 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeLink/InstamadilloCoreTypeLink.pb.go +313 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeLink/InstamadilloCoreTypeLink.proto +27 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeMedia/InstamadilloCoreTypeMedia.pb.go +1299 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeMedia/InstamadilloCoreTypeMedia.proto +112 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeText/InstamadilloCoreTypeText.pb.go +514 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeText/InstamadilloCoreTypeText.proto +47 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/InstamadilloDeleteMessage.pb.go +123 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/InstamadilloDeleteMessage.proto +7 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/extra.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/InstamadilloSupplementMessage.pb.go +720 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/InstamadilloSupplementMessage.proto +59 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/extra.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloTransportPayload/InstamadilloTransportPayload.pb.go +365 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloTransportPayload/InstamadilloTransportPayload.proto +33 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloXmaContentRef/InstamadilloXmaContentRef.pb.go +1238 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloXmaContentRef/InstamadilloXmaContentRef.proto +105 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.go +16 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.proto +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waBotMetadata/WABotMetadata.pb.go +5156 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waBotMetadata/WABotMetadata.proto +516 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WACompanionReg.pb.go +46 -10
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WACompanionReg.proto +4 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go +8975 -11209
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto +193 -421
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go +52 -23
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.proto +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waLidMigrationSyncPayload/WAWebProtobufLidMigrationSyncPayload.pb.go +198 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waLidMigrationSyncPayload/WAWebProtobufLidMigrationSyncPayload.proto +14 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/extra.go +7 -6
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.pb.go +952 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.proto +88 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go +1143 -463
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto +60 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go +60 -38
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.go +11 -3
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/receipt.go +20 -7
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/reportingfields.json +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/reportingtoken.go +176 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/retry.go +10 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/send.go +38 -21
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/sendfb.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/clientpayload.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/noop.go +3 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go +9 -6
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go +25 -5
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/00-latest-schema.sql +4 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/10-chat-db-lid-migration-ts.sql +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/store.go +5 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/call.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/events/events.go +13 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/jid.go +2 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/message.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/user.go +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/user.go +14 -8
- slidge_whatsapp/vendor/golang.org/x/crypto/curve25519/curve25519.go +1 -1
- slidge_whatsapp/vendor/golang.org/x/net/http2/config.go +44 -2
- slidge_whatsapp/vendor/golang.org/x/net/http2/frame.go +8 -8
- slidge_whatsapp/vendor/golang.org/x/net/http2/gotrack.go +14 -3
- slidge_whatsapp/vendor/golang.org/x/net/http2/http2.go +7 -29
- slidge_whatsapp/vendor/golang.org/x/net/http2/server.go +53 -71
- slidge_whatsapp/vendor/golang.org/x/net/http2/transport.go +20 -74
- slidge_whatsapp/vendor/golang.org/x/sys/unix/affinity_linux.go +1 -3
- slidge_whatsapp/vendor/golang.org/x/sys/unix/mkerrors.sh +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_darwin.go +1 -55
- slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_solaris.go +1 -1
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux.go +47 -16
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +4 -4
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux.go +168 -12
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +17 -1
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +18 -2
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +17 -1
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +17 -1
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +18 -2
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/types_windows.go +6 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/zsyscall_windows.go +483 -483
- slidge_whatsapp/vendor/google.golang.org/protobuf/encoding/protowire/wire.go +25 -1
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb +0 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/editions.go +10 -5
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/presence.go +33 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/genid/api_gen.go +6 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +68 -22
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/impl/codec_message_opaque.go +2 -1
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/impl/message_opaque.go +8 -37
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/impl/presence.go +0 -3
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/version/version.go +1 -1
- slidge_whatsapp/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go +8 -0
- slidge_whatsapp/vendor/modules.txt +57 -23
- {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/METADATA +2 -2
- {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/RECORD +254 -174
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/abi_amd64.go +0 -7
- slidge_whatsapp/vendor/golang.org/x/net/http2/config_go124.go +0 -61
- slidge_whatsapp/vendor/golang.org/x/net/http2/config_pre_go124.go +0 -16
- slidge_whatsapp/vendor/golang.org/x/net/http2/timer.go +0 -20
- {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/LICENSE +0 -0
- {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/WHEEL +0 -0
- {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,614 @@
|
|
|
1
|
+
// Package wire defines the fundamental Argo wire types, such as String, Varint, Record, Array, etc.,
|
|
2
|
+
// and provides utilities for working with these types. It forms the basis for how Argo data
|
|
3
|
+
// is structured and represented before being encoded or after being decoded.
|
|
4
|
+
package wire
|
|
5
|
+
|
|
6
|
+
import (
|
|
7
|
+
"fmt"
|
|
8
|
+
"math/big"
|
|
9
|
+
"strings"
|
|
10
|
+
|
|
11
|
+
"github.com/beeper/argo-go/label"
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
// BlockKey is a type alias for string, representing a key used to identify a block
|
|
15
|
+
// in an Argo stream. This key is often used for deduplication and referencing.
|
|
16
|
+
// For example, a block of strings might have the key "String".
|
|
17
|
+
type BlockKey string
|
|
18
|
+
|
|
19
|
+
// TypeKey is a string constant representing the kind of an Argo wire type.
|
|
20
|
+
// Each distinct wire type (e.g., StringType, ArrayType) has a unique TypeKey.
|
|
21
|
+
// This is used for type assertions and type-based dispatch.
|
|
22
|
+
type TypeKey string
|
|
23
|
+
|
|
24
|
+
const (
|
|
25
|
+
// Primitive types
|
|
26
|
+
|
|
27
|
+
// TypeKeyString represents the wire type for UTF-8 encoded strings.
|
|
28
|
+
TypeKeyString TypeKey = "STRING"
|
|
29
|
+
// TypeKeyBoolean represents the wire type for boolean values (true or false).
|
|
30
|
+
TypeKeyBoolean TypeKey = "BOOLEAN"
|
|
31
|
+
// TypeKeyVarint represents the wire type for variable-length integers.
|
|
32
|
+
TypeKeyVarint TypeKey = "VARINT"
|
|
33
|
+
// TypeKeyFloat64 represents the wire type for 64-bit floating-point numbers (IEEE 754).
|
|
34
|
+
TypeKeyFloat64 TypeKey = "FLOAT64"
|
|
35
|
+
// TypeKeyBytes represents the wire type for opaque byte arrays.
|
|
36
|
+
TypeKeyBytes TypeKey = "BYTES"
|
|
37
|
+
// TypeKeyPath represents the wire type for GraphQL paths, used for referring to specific locations within a data structure.
|
|
38
|
+
TypeKeyPath TypeKey = "PATH"
|
|
39
|
+
|
|
40
|
+
// Compound types
|
|
41
|
+
|
|
42
|
+
// TypeKeyFixed represents the wire type for fixed-length byte arrays.
|
|
43
|
+
TypeKeyFixed TypeKey = "FIXED"
|
|
44
|
+
// TypeKeyBlock represents a block, which is a sequence of values of the same underlying type.
|
|
45
|
+
// Blocks can optionally be deduplicated.
|
|
46
|
+
TypeKeyBlock TypeKey = "BLOCK"
|
|
47
|
+
// TypeKeyNullable represents a wire type that can hold a value of another type or be explicitly null.
|
|
48
|
+
TypeKeyNullable TypeKey = "NULLABLE"
|
|
49
|
+
// TypeKeyArray represents an ordered sequence of values, all of the same underlying type.
|
|
50
|
+
TypeKeyArray TypeKey = "ARRAY"
|
|
51
|
+
// TypeKeyRecord represents a structured collection of named fields, where each field has its own wire type.
|
|
52
|
+
TypeKeyRecord TypeKey = "RECORD"
|
|
53
|
+
// TypeKeyDesc represents a self-describing value, where the value itself carries its type information.
|
|
54
|
+
TypeKeyDesc TypeKey = "DESC"
|
|
55
|
+
// TypeKeyExtensions represents an extension
|
|
56
|
+
TypeKeyExtensions TypeKey = "EXTENSIONS"
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
// AbsentValue is a sentinel value used to indicate that an omittable field in a RecordType
|
|
60
|
+
// was not present during decoding. Functions that decode record fields can return
|
|
61
|
+
// (AbsentValue, nil) to signal this absence without it being an error.
|
|
62
|
+
// It is a pointer to an empty struct to ensure it's a unique, comparable value.
|
|
63
|
+
var AbsentValue interface{} = &struct{}{}
|
|
64
|
+
|
|
65
|
+
// Type is the core interface implemented by all Argo wire types.
|
|
66
|
+
// It provides a way to get the TypeKey of the wire type and includes an unexported
|
|
67
|
+
// marker method (isWireType) to ensure that only types defined within this package
|
|
68
|
+
// can satisfy the interface. This helps maintain a closed set of known wire types.
|
|
69
|
+
type Type interface {
|
|
70
|
+
GetTypeKey() TypeKey
|
|
71
|
+
isWireType() // Unexported marker method to restrict implementations to this package.
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// --- Primitive Types ---
|
|
75
|
+
|
|
76
|
+
// StringType represents the Argo wire type for UTF-8 encoded strings.
|
|
77
|
+
// It implements the Type interface.
|
|
78
|
+
// Use the global String instance for this type.
|
|
79
|
+
type StringType struct{}
|
|
80
|
+
|
|
81
|
+
func (StringType) GetTypeKey() TypeKey { return TypeKeyString }
|
|
82
|
+
func (StringType) isWireType() {}
|
|
83
|
+
|
|
84
|
+
// BooleanType represents the Argo wire type for boolean values (true or false).
|
|
85
|
+
// It implements the Type interface.
|
|
86
|
+
// Use the global Boolean instance for this type.
|
|
87
|
+
type BooleanType struct{}
|
|
88
|
+
|
|
89
|
+
func (BooleanType) GetTypeKey() TypeKey { return TypeKeyBoolean }
|
|
90
|
+
func (BooleanType) isWireType() {}
|
|
91
|
+
|
|
92
|
+
// VarintType represents the Argo wire type for variable-length integers.
|
|
93
|
+
// It implements the Type interface.
|
|
94
|
+
// Use the global Varint instance for this type.
|
|
95
|
+
type VarintType struct{}
|
|
96
|
+
|
|
97
|
+
func (VarintType) GetTypeKey() TypeKey { return TypeKeyVarint }
|
|
98
|
+
func (VarintType) isWireType() {}
|
|
99
|
+
|
|
100
|
+
// Float64Type represents the Argo wire type for 64-bit floating-point numbers (IEEE 754).
|
|
101
|
+
// It implements the Type interface.
|
|
102
|
+
// Use the global Float64 instance for this type.
|
|
103
|
+
type Float64Type struct{}
|
|
104
|
+
|
|
105
|
+
func (Float64Type) GetTypeKey() TypeKey { return TypeKeyFloat64 }
|
|
106
|
+
func (Float64Type) isWireType() {}
|
|
107
|
+
|
|
108
|
+
// BytesType represents the Argo wire type for opaque byte arrays.
|
|
109
|
+
// It implements the Type interface.
|
|
110
|
+
// Use the global Bytes instance for this type.
|
|
111
|
+
type BytesType struct{}
|
|
112
|
+
|
|
113
|
+
func (BytesType) GetTypeKey() TypeKey { return TypeKeyBytes }
|
|
114
|
+
func (BytesType) isWireType() {}
|
|
115
|
+
|
|
116
|
+
// PathType represents the Argo wire type for Argo paths.
|
|
117
|
+
// Paths are used for referring to specific locations within a data structure.
|
|
118
|
+
// It implements the Type interface.
|
|
119
|
+
// Use the global Path instance for this type.
|
|
120
|
+
type PathType struct{}
|
|
121
|
+
|
|
122
|
+
func (PathType) GetTypeKey() TypeKey { return TypeKeyPath }
|
|
123
|
+
func (PathType) isWireType() {}
|
|
124
|
+
|
|
125
|
+
// DescType represents the Argo wire type for self-describing values.
|
|
126
|
+
// A self-describing value carries its type information along with the data.
|
|
127
|
+
// It implements the Type interface.
|
|
128
|
+
// Use the global Desc instance for this type.
|
|
129
|
+
type DescType struct{}
|
|
130
|
+
|
|
131
|
+
func (DescType) GetTypeKey() TypeKey { return TypeKeyDesc }
|
|
132
|
+
func (DescType) isWireType() {}
|
|
133
|
+
|
|
134
|
+
// ExtensionsType represents the Argo wire type for extensions.
|
|
135
|
+
// It implements the Type interface.
|
|
136
|
+
// Use the global Extensions instance for this type.
|
|
137
|
+
type ExtensionsType struct{}
|
|
138
|
+
|
|
139
|
+
func (ExtensionsType) GetTypeKey() TypeKey { return TypeKeyExtensions }
|
|
140
|
+
func (ExtensionsType) isWireType() {}
|
|
141
|
+
|
|
142
|
+
// --- Global instances of primitive types ---
|
|
143
|
+
|
|
144
|
+
// Global pre-allocated instances of primitive wire types.
|
|
145
|
+
// These should be used instead of creating new zero-value structs of these types.
|
|
146
|
+
var (
|
|
147
|
+
String Type = StringType{} // String is the global instance of StringType.
|
|
148
|
+
Boolean Type = BooleanType{} // Boolean is the global instance of BooleanType.
|
|
149
|
+
Varint Type = VarintType{} // Varint is the global instance of VarintType.
|
|
150
|
+
Float64 Type = Float64Type{} // Float64 is the global instance of Float64Type.
|
|
151
|
+
Bytes Type = BytesType{} // Bytes is the global instance of BytesType.
|
|
152
|
+
Path Type = PathType{} // Path is the global instance of PathType.
|
|
153
|
+
Desc Type = DescType{} // Desc is the global instance of DescType.
|
|
154
|
+
Extensions Type = ExtensionsType{}
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
// --- Compound Types ---
|
|
158
|
+
|
|
159
|
+
// FixedType represents the Argo wire type for fixed-length byte arrays.
|
|
160
|
+
// The Length field specifies the exact number of bytes this type represents.
|
|
161
|
+
// It implements the Type interface.
|
|
162
|
+
type FixedType struct {
|
|
163
|
+
Length int
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
func (FixedType) GetTypeKey() TypeKey { return TypeKeyFixed }
|
|
167
|
+
func (FixedType) isWireType() {}
|
|
168
|
+
|
|
169
|
+
// BlockType represents an Argo block, which is a sequence of values all of the same underlying type (Of).
|
|
170
|
+
// Blocks have a Key for identification and potential deduplication.
|
|
171
|
+
// The Dedupe flag indicates whether values within this block are subject to deduplication.
|
|
172
|
+
// It implements the Type interface.
|
|
173
|
+
type BlockType struct {
|
|
174
|
+
Of Type
|
|
175
|
+
Key BlockKey
|
|
176
|
+
Dedupe bool
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
func (BlockType) GetTypeKey() TypeKey { return TypeKeyBlock }
|
|
180
|
+
func (BlockType) isWireType() {}
|
|
181
|
+
|
|
182
|
+
// ArrayType represents an Argo array, which is an ordered sequence of values,
|
|
183
|
+
// all of the same underlying type (Of).
|
|
184
|
+
// It implements the Type interface.
|
|
185
|
+
type ArrayType struct {
|
|
186
|
+
Of Type
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
func (ArrayType) GetTypeKey() TypeKey { return TypeKeyArray }
|
|
190
|
+
func (ArrayType) isWireType() {}
|
|
191
|
+
|
|
192
|
+
// NullableType represents an Argo wire type that can either hold a value of another type (Of)
|
|
193
|
+
// or be explicitly null.
|
|
194
|
+
// It implements the Type interface.
|
|
195
|
+
type NullableType struct {
|
|
196
|
+
Of Type
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
func (NullableType) GetTypeKey() TypeKey { return TypeKeyNullable }
|
|
200
|
+
func (NullableType) isWireType() {}
|
|
201
|
+
|
|
202
|
+
// Field defines a single field within a RecordType.
|
|
203
|
+
// It has a Name, an underlying wire Type (Of), and an Omittable flag.
|
|
204
|
+
// If Omittable is true, the field may be absent from an encoded record.
|
|
205
|
+
type Field struct {
|
|
206
|
+
Name string
|
|
207
|
+
Of Type
|
|
208
|
+
Omittable bool
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// RecordType represents an Argo record, a structured collection of named Fields.
|
|
212
|
+
// Each field has its own wire type. The order of fields in the Fields slice is significant.
|
|
213
|
+
// It implements the Type interface.
|
|
214
|
+
type RecordType struct {
|
|
215
|
+
Fields []Field
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
func (RecordType) GetTypeKey() TypeKey { return TypeKeyRecord }
|
|
219
|
+
func (RecordType) isWireType() {}
|
|
220
|
+
|
|
221
|
+
// --- Helper functions for creating types ---
|
|
222
|
+
|
|
223
|
+
// NewBlockType is a constructor function that creates and returns a new BlockType.
|
|
224
|
+
// It initializes the BlockType with the specified underlying type (of),
|
|
225
|
+
// block key (key), and deduplication flag (dedupe).
|
|
226
|
+
func NewBlockType(of Type, key BlockKey, dedupe bool) BlockType {
|
|
227
|
+
return BlockType{Of: of, Key: key, Dedupe: dedupe}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// NewNullableType is a constructor function that creates and returns a new NullableType.
|
|
231
|
+
// It initializes the NullableType with the specified underlying type (of)
|
|
232
|
+
// that can be made nullable.
|
|
233
|
+
func NewNullableType(of Type) NullableType {
|
|
234
|
+
return NullableType{Of: of}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// DeduplicateByDefault determines whether a given wire type (t) should have
|
|
238
|
+
// its corresponding BlockType deduplicated by default.
|
|
239
|
+
// Primitive types like String and Bytes are typically deduplicated by default.
|
|
240
|
+
// Other types like numbers or booleans usually are not.
|
|
241
|
+
// This function returns an error for types like Array or Record, for which
|
|
242
|
+
// block-level deduplication is not directly applicable or meaningful in the same way.
|
|
243
|
+
func DeduplicateByDefault(t Type) (bool, error) {
|
|
244
|
+
switch t.GetTypeKey() {
|
|
245
|
+
case TypeKeyString, TypeKeyBytes:
|
|
246
|
+
return true, nil
|
|
247
|
+
case TypeKeyBoolean, TypeKeyVarint, TypeKeyFloat64, TypeKeyPath, TypeKeyFixed, TypeKeyDesc:
|
|
248
|
+
return false, nil
|
|
249
|
+
default:
|
|
250
|
+
return false, fmt.Errorf("programmer error: DeduplicateByDefault does not make sense for type %s", t.GetTypeKey())
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// MustDeduplicateByDefault is a helper function that calls DeduplicateByDefault(t)
|
|
255
|
+
// and panics if an error occurs. This is intended for use during package initialization
|
|
256
|
+
// where an error from DeduplicateByDefault would indicate a programming error in defining
|
|
257
|
+
// default deduplication behavior for core types.
|
|
258
|
+
func MustDeduplicateByDefault(t Type) bool {
|
|
259
|
+
val, err := DeduplicateByDefault(t)
|
|
260
|
+
if err != nil {
|
|
261
|
+
panic(fmt.Sprintf("initialization error for DeduplicateByDefault: %v", err))
|
|
262
|
+
}
|
|
263
|
+
return val
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// --- Global instances of commonly used complex types ---
|
|
267
|
+
|
|
268
|
+
// Global pre-allocated instances of frequently used complex wire types.
|
|
269
|
+
// These are initialized in the init function.
|
|
270
|
+
var (
|
|
271
|
+
// VarintBlock is a block of Varint values, keyed as "Int", with default deduplication.
|
|
272
|
+
VarintBlock Type
|
|
273
|
+
// Location is a RecordType representing a line and column, often used for error reporting.
|
|
274
|
+
// Both fields use VarintBlock.
|
|
275
|
+
Location Type
|
|
276
|
+
// Error is a RecordType representing a structured error, potentially including a message,
|
|
277
|
+
// locations, a path, and extensions.
|
|
278
|
+
Error Type
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
// init initializes the global complex type instances like VarintBlock, Location, and Error.
|
|
282
|
+
// This ensures they are ready for use as soon as the package is imported.
|
|
283
|
+
func init() {
|
|
284
|
+
VarintBlock = NewBlockType(Varint, "Int", MustDeduplicateByDefault(Varint))
|
|
285
|
+
|
|
286
|
+
Location = RecordType{
|
|
287
|
+
Fields: []Field{
|
|
288
|
+
{Name: "line", Of: VarintBlock, Omittable: false},
|
|
289
|
+
{Name: "column", Of: VarintBlock, Omittable: false},
|
|
290
|
+
},
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
stringBlock := NewBlockType(String, "String", MustDeduplicateByDefault(String))
|
|
294
|
+
locationArray := ArrayType{Of: Location}
|
|
295
|
+
|
|
296
|
+
Error = RecordType{
|
|
297
|
+
Fields: []Field{
|
|
298
|
+
{Name: "message", Of: stringBlock, Omittable: false},
|
|
299
|
+
{Name: "locations", Of: locationArray, Omittable: true},
|
|
300
|
+
{Name: "path", Of: Path, Omittable: true},
|
|
301
|
+
{Name: "extensions", Of: Desc, Omittable: true},
|
|
302
|
+
},
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// --- Type guard functions ---
|
|
307
|
+
|
|
308
|
+
// IsString checks if the given Type is StringType. Returns true if it is, false otherwise.
|
|
309
|
+
func IsString(t Type) bool { return t.GetTypeKey() == TypeKeyString }
|
|
310
|
+
|
|
311
|
+
// IsBoolean checks if the given Type is BooleanType. Returns true if it is, false otherwise.
|
|
312
|
+
func IsBoolean(t Type) bool { return t.GetTypeKey() == TypeKeyBoolean }
|
|
313
|
+
|
|
314
|
+
// IsVarint checks if the given Type is VarintType. Returns true if it is, false otherwise.
|
|
315
|
+
func IsVarint(t Type) bool { return t.GetTypeKey() == TypeKeyVarint }
|
|
316
|
+
|
|
317
|
+
// IsFloat64 checks if the given Type is Float64Type. Returns true if it is, false otherwise.
|
|
318
|
+
func IsFloat64(t Type) bool { return t.GetTypeKey() == TypeKeyFloat64 }
|
|
319
|
+
|
|
320
|
+
// IsBytes checks if the given Type is BytesType. Returns true if it is, false otherwise.
|
|
321
|
+
func IsBytes(t Type) bool { return t.GetTypeKey() == TypeKeyBytes }
|
|
322
|
+
|
|
323
|
+
// IsPath checks if the given Type is PathType. Returns true if it is, false otherwise.
|
|
324
|
+
func IsPath(t Type) bool { return t.GetTypeKey() == TypeKeyPath }
|
|
325
|
+
|
|
326
|
+
// IsFixed checks if the given Type is FixedType. Returns true if it is, false otherwise.
|
|
327
|
+
func IsFixed(t Type) bool { return t.GetTypeKey() == TypeKeyFixed }
|
|
328
|
+
|
|
329
|
+
// IsDesc checks if the given Type is DescType. Returns true if it is, false otherwise.
|
|
330
|
+
func IsDesc(t Type) bool { return t.GetTypeKey() == TypeKeyDesc }
|
|
331
|
+
|
|
332
|
+
// IsBlock checks if the given Type is BlockType. Returns true if it is, false otherwise.
|
|
333
|
+
func IsBlock(t Type) bool { return t.GetTypeKey() == TypeKeyBlock }
|
|
334
|
+
|
|
335
|
+
// IsArray checks if the given Type is ArrayType. Returns true if it is, false otherwise.
|
|
336
|
+
func IsArray(t Type) bool { return t.GetTypeKey() == TypeKeyArray }
|
|
337
|
+
|
|
338
|
+
// IsNullable checks if the given Type is NullableType. Returns true if it is, false otherwise.
|
|
339
|
+
func IsNullable(t Type) bool { return t.GetTypeKey() == TypeKeyNullable }
|
|
340
|
+
|
|
341
|
+
// IsRecord checks if the given Type is RecordType. Returns true if it is, false otherwise.
|
|
342
|
+
func IsRecord(t Type) bool { return t.GetTypeKey() == TypeKeyRecord }
|
|
343
|
+
|
|
344
|
+
// IsLabeled checks if values of the given wire type (wt) are expected to start with a Label
|
|
345
|
+
// in the Argo binary encoding. This is true for types like Nullable, String, Boolean, Bytes, and Array.
|
|
346
|
+
// For a BlockType, it recursively checks if the underlying element type is labeled.
|
|
347
|
+
// It panics if it encounters a BlockType that doesn't conform to the expected structure
|
|
348
|
+
// (which indicates a programming error).
|
|
349
|
+
// Other types (e.g., Varint, Float64, Fixed, Path, Desc, Record) are not directly prefixed by a Label.
|
|
350
|
+
func IsLabeled(wt Type) bool {
|
|
351
|
+
switch wt.GetTypeKey() {
|
|
352
|
+
case TypeKeyNullable, TypeKeyString, TypeKeyBoolean, TypeKeyBytes, TypeKeyArray:
|
|
353
|
+
return true
|
|
354
|
+
case TypeKeyBlock:
|
|
355
|
+
if bt, ok := wt.(BlockType); ok {
|
|
356
|
+
return IsLabeled(bt.Of)
|
|
357
|
+
}
|
|
358
|
+
// Should not happen if type system is used correctly
|
|
359
|
+
panic(fmt.Sprintf("IsLabeled: expected BlockType, got %T", wt))
|
|
360
|
+
default:
|
|
361
|
+
return false
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// Print generates a human-readable string representation of a wire type (wt).
|
|
366
|
+
// It formats the type structure with indentation for readability, useful for debugging
|
|
367
|
+
// or displaying type information.
|
|
368
|
+
// Example:
|
|
369
|
+
// RECORD (
|
|
370
|
+
//
|
|
371
|
+
// "field1": STRING
|
|
372
|
+
// "field2": NULLABLE (
|
|
373
|
+
// VARINT
|
|
374
|
+
// )
|
|
375
|
+
//
|
|
376
|
+
// )
|
|
377
|
+
func Print(wt Type) string {
|
|
378
|
+
return printRecursive(wt, 0)
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// printRecursive is a helper for Print. It recursively builds the string representation
|
|
382
|
+
// of a wire type, using the 'indent' parameter to manage nesting levels for compound types
|
|
383
|
+
// like Record, Array, Block, and Nullable.
|
|
384
|
+
func printRecursive(wt Type, indent int) string {
|
|
385
|
+
indentStr := func(plus int) string {
|
|
386
|
+
return strings.Repeat(" ", indent+plus)
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
inner := func() string {
|
|
390
|
+
switch t := wt.(type) {
|
|
391
|
+
case StringType, VarintType, BooleanType, Float64Type, BytesType, PathType, DescType, ExtensionsType:
|
|
392
|
+
return string(t.GetTypeKey())
|
|
393
|
+
case NullableType:
|
|
394
|
+
// The TS version `recurse(wt.of) + '?'` implies the recursed string includes its own indent.
|
|
395
|
+
return printRecursive(t.Of, indent+1) + "?"
|
|
396
|
+
case FixedType:
|
|
397
|
+
return fmt.Sprintf("%s(%d)", t.GetTypeKey(), t.Length)
|
|
398
|
+
case BlockType:
|
|
399
|
+
// The TS version `recurse(wt.of) + (wt.dedupe ? '<' : '{') + wt.key + (wt.dedupe ? '>' : '}')`
|
|
400
|
+
// implies the recursed string includes its own indent.
|
|
401
|
+
brackets := "{}"
|
|
402
|
+
if t.Dedupe {
|
|
403
|
+
brackets = "<>"
|
|
404
|
+
}
|
|
405
|
+
return printRecursive(t.Of, indent+1) + string(brackets[0]) + string(t.Key) + string(brackets[1])
|
|
406
|
+
case ArrayType:
|
|
407
|
+
// The TS version `recurse(wt.of) + '[]'` implies the recursed string includes its own indent.
|
|
408
|
+
return printRecursive(t.Of, indent+1) + "[]"
|
|
409
|
+
case RecordType:
|
|
410
|
+
var fieldStrings []string
|
|
411
|
+
for _, field := range t.Fields {
|
|
412
|
+
omittableMarker := ""
|
|
413
|
+
if field.Omittable {
|
|
414
|
+
omittableMarker = "?"
|
|
415
|
+
}
|
|
416
|
+
// TS: `${name}${omittable ? '?' : ''}: ${recurse(type).trimStart()}`
|
|
417
|
+
// Here, trim the leading space from the recursive call to align field type info.
|
|
418
|
+
fieldTypeStr := strings.TrimSpace(printRecursive(field.Of, indent+1))
|
|
419
|
+
fieldStrings = append(fieldStrings,
|
|
420
|
+
fmt.Sprintf("%s%s%s: %s", indentStr(1), field.Name, omittableMarker, fieldTypeStr),
|
|
421
|
+
)
|
|
422
|
+
}
|
|
423
|
+
return "{\n" + strings.Join(fieldStrings, "\n") + "\n" + indentStr(0) + "}"
|
|
424
|
+
default:
|
|
425
|
+
panic(fmt.Sprintf("programmer error: printRecursive can't handle type %T with key %s", wt, wt.GetTypeKey()))
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return indentStr(0) + inner()
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// PathToWirePath converts a human-readable path (a slice of strings and integers representing
|
|
432
|
+
// record field names and array indices) into a wire path (a slice of integers representing
|
|
433
|
+
// field/element indices) for a given wire type (wt).
|
|
434
|
+
// This is used to translate a user-friendly path into the compact numerical representation
|
|
435
|
+
// used in the Argo binary format (e.g., for error reporting or targeted data access).
|
|
436
|
+
// Returns an error if the path is invalid for the given wire type (e.g., a string field name
|
|
437
|
+
// used for an array, or an index out of bounds).
|
|
438
|
+
func PathToWirePath(wt Type, path []interface{}) ([]int, error) {
|
|
439
|
+
if len(path) == 0 {
|
|
440
|
+
return []int{}, nil
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
current := path[0]
|
|
444
|
+
tail := path[1:]
|
|
445
|
+
|
|
446
|
+
switch t := wt.(type) {
|
|
447
|
+
case BlockType:
|
|
448
|
+
return PathToWirePath(t.Of, path) // Pass full path, block doesn't consume a path element
|
|
449
|
+
case NullableType:
|
|
450
|
+
return PathToWirePath(t.Of, path) // Pass full path, nullable doesn't consume
|
|
451
|
+
case ArrayType:
|
|
452
|
+
arrayIdx, ok := current.(int)
|
|
453
|
+
if !ok {
|
|
454
|
+
return nil, fmt.Errorf("array index must be numeric, got: %v (type %T)", current, current)
|
|
455
|
+
}
|
|
456
|
+
if arrayIdx < 0 {
|
|
457
|
+
return nil, fmt.Errorf("array index must be non-negative, got: %d", arrayIdx)
|
|
458
|
+
}
|
|
459
|
+
subPath, err := PathToWirePath(t.Of, tail)
|
|
460
|
+
if err != nil {
|
|
461
|
+
return nil, err
|
|
462
|
+
}
|
|
463
|
+
return append([]int{arrayIdx}, subPath...), nil
|
|
464
|
+
case RecordType:
|
|
465
|
+
fieldName, ok := current.(string)
|
|
466
|
+
if !ok {
|
|
467
|
+
return nil, fmt.Errorf("record field name must be a string, got: %v (type %T)", current, current)
|
|
468
|
+
}
|
|
469
|
+
fieldIndex := -1
|
|
470
|
+
for i, f := range t.Fields {
|
|
471
|
+
if f.Name == fieldName {
|
|
472
|
+
fieldIndex = i
|
|
473
|
+
break
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
if fieldIndex == -1 {
|
|
477
|
+
return nil, fmt.Errorf("encoding error: could not find record field: %s", fieldName)
|
|
478
|
+
}
|
|
479
|
+
field := t.Fields[fieldIndex]
|
|
480
|
+
subPath, err := PathToWirePath(field.Of, tail)
|
|
481
|
+
if err != nil {
|
|
482
|
+
return nil, err
|
|
483
|
+
}
|
|
484
|
+
return append([]int{fieldIndex}, subPath...), nil
|
|
485
|
+
case StringType, VarintType, BooleanType, Float64Type, BytesType, PathType, DescType, FixedType:
|
|
486
|
+
if len(path) > 0 { // Path is not empty, but primitive type cannot be indexed further
|
|
487
|
+
return nil, fmt.Errorf("encoding error: path %v attempts to index into primitive type %s", path, t.GetTypeKey())
|
|
488
|
+
}
|
|
489
|
+
return []int{}, nil
|
|
490
|
+
default:
|
|
491
|
+
panic(fmt.Sprintf("programmer error: PathToWirePath can't handle type %T with key %s", wt, wt.GetTypeKey()))
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
// WirePathToPath converts a wire path (a slice of integers representing field/element indices)
|
|
496
|
+
// back into a human-readable path (a slice of strings for record field names and integers for
|
|
497
|
+
// array indices) for a given wire type (wt).
|
|
498
|
+
// This is the reverse of PathToWirePath and is useful for presenting internal Argo paths
|
|
499
|
+
// in a more understandable format.
|
|
500
|
+
// Returns an error if the wire path is invalid for the given wire type (e.g., an index
|
|
501
|
+
// is out of bounds for a record or array).
|
|
502
|
+
func WirePathToPath(wt Type, wirePath []int) ([]interface{}, error) {
|
|
503
|
+
if len(wirePath) == 0 {
|
|
504
|
+
return []interface{}{}, nil
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
currentIndex := wirePath[0]
|
|
508
|
+
tailPath := wirePath[1:]
|
|
509
|
+
|
|
510
|
+
switch t := wt.(type) {
|
|
511
|
+
case BlockType:
|
|
512
|
+
return WirePathToPath(t.Of, wirePath) // Pass full wirePath
|
|
513
|
+
case NullableType:
|
|
514
|
+
return WirePathToPath(t.Of, wirePath) // Pass full wirePath
|
|
515
|
+
case ArrayType:
|
|
516
|
+
// Array index is directly the current wirePath element
|
|
517
|
+
subPath, err := WirePathToPath(t.Of, tailPath)
|
|
518
|
+
if err != nil {
|
|
519
|
+
return nil, err
|
|
520
|
+
}
|
|
521
|
+
return append([]interface{}{currentIndex}, subPath...), nil
|
|
522
|
+
case RecordType:
|
|
523
|
+
if currentIndex < 0 || currentIndex >= len(t.Fields) {
|
|
524
|
+
return nil, fmt.Errorf("encoding error: could not find record field by index: %d (record has %d fields)", currentIndex, len(t.Fields))
|
|
525
|
+
}
|
|
526
|
+
field := t.Fields[currentIndex]
|
|
527
|
+
subPath, err := WirePathToPath(field.Of, tailPath)
|
|
528
|
+
if err != nil {
|
|
529
|
+
return nil, err
|
|
530
|
+
}
|
|
531
|
+
return append([]interface{}{field.Name}, subPath...), nil
|
|
532
|
+
case StringType, VarintType, BooleanType, Float64Type, BytesType, PathType, DescType, FixedType:
|
|
533
|
+
if len(wirePath) > 0 { // wirePath is not empty, but primitive type cannot be indexed further
|
|
534
|
+
return nil, fmt.Errorf("encoding error: wirePath %v attempts to index into primitive type %s", wirePath, t.GetTypeKey())
|
|
535
|
+
}
|
|
536
|
+
return []interface{}{}, nil
|
|
537
|
+
default:
|
|
538
|
+
panic(fmt.Sprintf("programmer error: WirePathToPath can't handle type %T with key %s", wt, wt.GetTypeKey()))
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
// --- SelfDescribing Namespace ---
|
|
543
|
+
|
|
544
|
+
// SelfDescribingTypeMarkers are label.Label instances used to mark self-describing types.
|
|
545
|
+
var (
|
|
546
|
+
SelfDescribingTypeMarkerNull = label.NullMarker
|
|
547
|
+
SelfDescribingTypeMarkerFalse = label.FalseMarker
|
|
548
|
+
SelfDescribingTypeMarkerTrue = label.TrueMarker
|
|
549
|
+
SelfDescribingTypeMarkerObject = label.NewFromInt64(2)
|
|
550
|
+
SelfDescribingTypeMarkerList = label.NewFromInt64(3)
|
|
551
|
+
SelfDescribingTypeMarkerString = label.NewFromInt64(4)
|
|
552
|
+
SelfDescribingTypeMarkerBytes = label.NewFromInt64(5)
|
|
553
|
+
SelfDescribingTypeMarkerInt = label.NewFromInt64(6)
|
|
554
|
+
SelfDescribingTypeMarkerFloat = label.NewFromInt64(7)
|
|
555
|
+
)
|
|
556
|
+
|
|
557
|
+
// SelfDescribing is a collection of pre-encoded byte slices for self-describing type markers.
|
|
558
|
+
var (
|
|
559
|
+
SelfDescribingNull = label.Null // From label package []byte
|
|
560
|
+
SelfDescribingFalse = label.False // From label package []byte
|
|
561
|
+
SelfDescribingTrue = label.True // From label package []byte
|
|
562
|
+
SelfDescribingObject = SelfDescribingTypeMarkerObject.Encode()
|
|
563
|
+
SelfDescribingList = SelfDescribingTypeMarkerList.Encode()
|
|
564
|
+
SelfDescribingString = SelfDescribingTypeMarkerString.Encode()
|
|
565
|
+
SelfDescribingBytes = SelfDescribingTypeMarkerBytes.Encode()
|
|
566
|
+
SelfDescribingInt = SelfDescribingTypeMarkerInt.Encode()
|
|
567
|
+
SelfDescribingFloat = SelfDescribingTypeMarkerFloat.Encode()
|
|
568
|
+
)
|
|
569
|
+
|
|
570
|
+
// SelfDescribingBlocks is a map from BlockKey to the Type of the elements in that block.
|
|
571
|
+
// This is used when decoding self-describing values that are blocks, to know the type
|
|
572
|
+
// of the items within the block from its key.
|
|
573
|
+
// It's initialized in the second init function to ensure all base types are defined.
|
|
574
|
+
var SelfDescribingBlocks map[BlockKey]Type
|
|
575
|
+
|
|
576
|
+
// init (the second one in this file) initializes SelfDescribingBlocks.
|
|
577
|
+
// It populates the map with common block types that might be used in self-describing contexts.
|
|
578
|
+
// This is done in a separate init to avoid initialization cycles, ensuring that all base types
|
|
579
|
+
// (like String, Varint) and compound types derived from them (like stringBlock, VarintBlock)
|
|
580
|
+
// are fully defined before being added to this map.
|
|
581
|
+
func init() { // Second init for SelfDescribingBlocks to ensure base types are ready
|
|
582
|
+
stringBlock := NewBlockType(String, "String", MustDeduplicateByDefault(String))
|
|
583
|
+
bytesBlock := NewBlockType(Bytes, "Bytes", MustDeduplicateByDefault(Bytes))
|
|
584
|
+
// Note: VarintBlock is already defined globally and initialized in the first init.
|
|
585
|
+
// Create a Float64 block type for self-describing floats.
|
|
586
|
+
float64Block := NewBlockType(Float64, "Float", MustDeduplicateByDefault(Float64))
|
|
587
|
+
|
|
588
|
+
SelfDescribingBlocks = map[BlockKey]Type{
|
|
589
|
+
stringBlock.Key: stringBlock.Of,
|
|
590
|
+
bytesBlock.Key: bytesBlock.Of,
|
|
591
|
+
VarintBlock.(BlockType).Key: VarintBlock.(BlockType).Of,
|
|
592
|
+
float64Block.Key: float64Block.Of,
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// bigInt is a small utility function to create a *big.Int from an int64 value.
|
|
597
|
+
// Primarily used for testing or when *big.Int literals are needed.
|
|
598
|
+
func bigInt(val int64) *big.Int {
|
|
599
|
+
return big.NewInt(val)
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// Ensure all Type implementations satisfy the Type interface.
|
|
603
|
+
var _ Type = StringType{}
|
|
604
|
+
var _ Type = BooleanType{}
|
|
605
|
+
var _ Type = VarintType{}
|
|
606
|
+
var _ Type = Float64Type{}
|
|
607
|
+
var _ Type = BytesType{}
|
|
608
|
+
var _ Type = PathType{}
|
|
609
|
+
var _ Type = FixedType{}
|
|
610
|
+
var _ Type = BlockType{}
|
|
611
|
+
var _ Type = ArrayType{}
|
|
612
|
+
var _ Type = NullableType{}
|
|
613
|
+
var _ Type = RecordType{}
|
|
614
|
+
var _ Type = DescType{}
|