Anki/proto/anki
Damien Elmes 6941bccde4 Add support for proto3 optional scalars
Protobuf 3.15 introduced support for marking scalar fields like
uint32 as optional, and all of our tooling appears to support it
now. This allows us to use simple optional/null checks in our Rust/
TypeScript code, without having to resort to an inner message.

I had to apply a minor patch to protobufjs to get this working with
the json-module output; this has also been submitted upstream:
https://github.com/protobufjs/protobuf.js/pull/1693

I've modified CardStatsResponse as an example of the new syntax.

One thing to note: while the Rust and TypeScript bindings use optional/
null fields, as that is the norm in those languages, Google's Python
bindings are not very Pythonic. Referencing an optional field that is
missing will yield the default value, and a separate HasField() call
is required, eg:

```
>>> from anki.stats_pb2 import CardStatsResponse as R
... msg = R.FromString(b"")
... print(msg.first_review)
... print(msg.HasField("first_review"))
0
False
```
2022-02-27 19:42:06 +10:00
..
backend.proto Backend Custom Study (#1600) 2022-01-20 14:25:22 +10:00
card_rendering.proto replace the old stripHTML() methods with the backend implementation 2021-10-01 23:15:45 +10:00
cards.proto Original position (#1677) 2022-02-22 22:48:21 +10:00
collection.proto split out cards and collection 2021-07-10 19:52:31 +10:00
config.proto Add option to ignore accents in search by default (#1667) 2022-02-17 16:30:52 +10:00
deckconfig.proto Config for burying interday learning cards (#1680) 2022-02-22 21:37:59 +10:00
decks.proto V3 parent limits (#1638) 2022-02-10 09:55:43 +10:00
generic.proto Card info cleanup (#1446) 2021-10-23 11:00:43 +10:00
i18n.proto refactor protobuf handling for split/import 2021-07-10 19:17:05 +10:00
links.proto Remove native HelpPage enum 2021-07-22 16:32:49 +02:00
media.proto split out remaining tags, stats, media and rendering 2021-07-10 23:16:18 +10:00
notes.proto support updating multiple notes in one transaction/undo op 2021-08-02 17:07:26 +10:00
notetypes.proto Change Notetype UI Rework (#1499) 2021-11-24 12:09:55 +10:00
scheduler.proto Backend Custom Study (#1600) 2022-01-20 14:25:22 +10:00
search.proto fix sort order toggling 2021-10-30 09:14:43 +10:00
stats.proto Add support for proto3 optional scalars 2022-02-27 19:42:06 +10:00
sync.proto split out sync, search, scheduler & config 2021-07-10 21:33:12 +10:00
tags.proto bikeshedding: amount -> match_limit 2021-09-12 11:57:49 +10:00