store: merge names registration with master

This commit is contained in:
shum committed 2026-10-26 14:10:23 +00:00
commit e97c79b8c5
726 files changed
+114123 -5631

No files matched your search

+3
View File
@@ -299,6 +299,7 @@ cliCommands =
"SetClientService",
"SetContactFeature",
"SetContactTimedMessages",
"SetGroupChatLayout",
"SetGroupFeature",
"SetGroupFeatureRole",
"SetGroupMemberAdmissionReview",
@@ -370,6 +371,7 @@ undocumentedCommands =
"APIConnectPreparedGroup",
"APIContactInfo",
"APIContactQueueInfo",
"APICreateBadgeInvoice",
"APICreateChatItems",
"APICreateChatTag",
"APICreateMemberContact",
@@ -421,6 +423,7 @@ undocumentedCommands =
"APIPlanForwardChatItems",
"APIPrepareContact",
"APIPrepareGroup",
"APIPurchaseBadge",
"APIRedeemBadgeCode",
"APIRegisterToken",
"APIRejectCall",
+3
View File
@@ -203,6 +203,7 @@ undocumentedEvents =
"CEvtContactRequestRejected",
"CEvtContactSwitch",
"CEvtCustomChatEvent",
"CEvtDuplicateGroupMessage",
"CEvtGroupMemberRatchetSync",
"CEvtGroupMemberSwitch",
"CEvtServiceSubStatus",
@@ -223,6 +224,8 @@ undocumentedEvents =
"CEvtSndFileRedirectStartXFTP",
"CEvtSndFileStart", -- legacy SMP files
"CEvtSndStandaloneFileComplete",
"CEvtStorePurchaseCredited",
"CEvtStorePurchaseRefused",
"CEvtConnectionsDiff",
"CEvtSubscriptionEnd",
"CEvtTerminalEvent",
+22 -23
View File
@@ -60,10 +60,7 @@ commandsCodeText =
<> respAliasLine
where
constrName = T.pack $ fstToUpper tag
classDef =
("class " <> constrName <> "(TypedDict):\n")
<> bodyOrPass (fieldsCodePy " " "T." params)
<> "\n"
classDef = typedDictCode constrName (fieldsCodePy "T." params) <> "\n"
cmdStringFunc =
("\ndef " <> constrName <> "_cmd_string(self: " <> constrName <> ") -> str:\n")
<> " return " <> pySelfSyntaxText "T." (fstToUpper tag, params) syntax <> "\n"
@@ -143,9 +140,7 @@ typesCodeText =
"FileProtocol" -> map toUpper m
_ -> m
typeDefCode = case typeDef of
ATDRecord fields ->
("\nclass " <> name' <> "(TypedDict):\n")
<> bodyOrPass (fieldsCodePy " " "" fields)
ATDRecord fields -> "\n" <> typedDictCode name' (fieldsCodePy "" fields)
ATDEnum cs ->
"\n" <> name' <> " = Literal["
<> T.intercalate ", " (map (\m -> "\"" <> T.pack (enumValue m) <> "\"") $ L.toList cs)
@@ -231,9 +226,7 @@ unionTypeCodePy memberName typesNamespace name cs =
constrTypeRef (ATUnionMember tag _) = memberName name tag
tagLiterals = T.intercalate ", " $ map (\(ATUnionMember tag _) -> "\"" <> T.pack tag <> "\"") $ L.toList cs
memberClass (ATUnionMember tag fields) =
("\nclass " <> memberName name tag <> "(TypedDict):\n")
<> (" type: Literal[\"" <> T.pack tag <> "\"]\n")
<> fieldsCodePy " " typesNamespace fields
"\n" <> typedDictCode (memberName name tag) (("type", "Literal[\"" <> T.pack tag <> "\"]", "") : fieldsCodePy typesNamespace fields)
-- | Render the right-hand side of a union alias: either inline (one line) or
-- multi-line wrapped in parentheses with `|` separators between alternatives.
@@ -248,21 +241,27 @@ unionAliasRhs lhs constr cs
(h : t) -> h : map ("| " <>) t
cs' = map constr cs
-- | Emit a body of `pass` if there are no fields, otherwise the rendered
-- fields as-is.
bodyOrPass :: Text -> Text
bodyOrPass body
| T.null body = " pass\n"
| otherwise = body
typedDictCode :: Text -> [(Text, Text, Text)] -> Text
typedDictCode name fields
| any (\(field, _, _) -> field `elem` pyKeywords) fields =
(name <> " = TypedDict(\"" <> name <> "\", {\n")
<> foldMap (\(field, t, comment) -> " \"" <> field <> "\": " <> t <> "," <> comment <> "\n") fields
<> "})\n"
| null fields = "class " <> name <> "(TypedDict):\n pass\n"
| otherwise =
("class " <> name <> "(TypedDict):\n")
<> foldMap (\(field, t, comment) -> " " <> field <> ": " <> t <> comment <> "\n") fields
-- | Render record fields for a TypedDict body. Each field becomes
-- `<indent><name>: <type>[ # <comment>]`. Optional fields wrap the type in
-- `NotRequired[...]`.
fieldsCodePy :: Text -> Text -> [APIRecordField] -> Text
fieldsCodePy indent namespace = foldMap render
pyKeywords :: [Text]
pyKeywords =
["False", "None", "True", "and", "as", "assert", "async", "await", "break", "class", "continue", "def", "del", "elif", "else", "except", "finally", "for", "from", "global", "if", "import", "in", "is", "lambda", "nonlocal", "not", "or", "pass", "raise", "return", "try", "while", "with", "yield"]
-- | Render record fields for a TypedDict as name, type and comment.
-- Optional fields wrap the type in `NotRequired[...]`.
fieldsCodePy :: Text -> [APIRecordField] -> [(Text, Text, Text)]
fieldsCodePy namespace = map render
where
render (APIRecordField name t) =
indent <> T.pack name <> ": " <> wrapOptional t (typeText t) <> typeComment t <> "\n"
render (APIRecordField name t) = (T.pack name, wrapOptional t (typeText t), typeComment t)
wrapOptional t inner = case t of
ATOptional _ -> "NotRequired[" <> inner <> "]"
_ -> inner
+1
View File
@@ -135,6 +135,7 @@ undocumentedResponses =
"CRAppSettings",
"CRArchiveExported",
"CRArchiveImported",
"CRBadgeInvoice",
"CRBadgeLedger",
"CRBadgeRedeemed",
"CRBadgeState",
+13 -1
View File
@@ -223,6 +223,7 @@ chatTypesDocsData =
(sti @BadgeRedeemError, STUnion, "BRE", [], "", ""),
(sti @BlockingInfo, STRecord, "", [], "", ""),
(sti @BlockingReason, STEnum, "BR", [], "", ""),
(sti @BlockToken, STUnion, "", [], "", ""),
(sti @BrokerErrorType, STUnion, "", [], "", ""),
(sti @BusinessChatInfo, STRecord, "", [], "", ""),
(sti @BusinessChatType, STEnum, "BC", [], "", ""),
@@ -234,6 +235,7 @@ chatTypesDocsData =
(sti @BadgeType, STEnum, "BT", ["BTUnknown"], "", ""),
(sti @ChatFeature, STEnum, "CF", [], "", ""),
(sti @ChatItemDeletion, STRecord, "", [], "", "Message deletion result."),
(sti @ChatLayout, STEnum, "CL", ["CLUnknown"], "", ""),
(sti @ChatPeerType, STEnum, "CPT", ["CPTUnknown"], "", ""),
(sti @ChatRef, STRecord, "", [], Param "chatType" <> Param "chatId" <> Optional "" (Param "$0") "chatScope", "Used in API commands. Chat scope can only be passed with groups."),
(sti @ChatSettings, STRecord, "", [], "", ""),
@@ -285,7 +287,7 @@ chatTypesDocsData =
(sti @FileStatus, STEnum, "FS", [], "", ""),
(sti @FileTransferMeta, STRecord, "", [], "", ""),
(sti @FileType, STEnum' (consLower "FT"), "", [], "", ""),
(sti @Format, STUnion, "", ["Unknown"], "", ""),
(sti @Format, STUnion, "", ["Unknown"], "", "The format markup is a token of block Markdown syntax; its text is the syntax. The format escape is the backslash of a backslash escape. Bold singleStar: written with single stars."),
(sti @FormattedText, STRecord, "", [], "", ""),
(sti @FullGroupPreferences, STRecord, "", [], "", ""),
(sti @FullPreferences, STRecord, "", [], "", ""),
@@ -321,8 +323,10 @@ chatTypesDocsData =
(sti @LinkContent, STUnion, "LC", [], "", ""),
(sti @LinkOwnerSig, STRecord, "", [], "", ""),
(sti @LinkPreview, STRecord, "", [], "", ""),
(sti @ListEntry, STRecord, "", [], "", ""),
(sti @BadgeInfo, STRecord, "", [], "", ""),
(sti @LocalProfile, STRecord, "", [], "", ""),
(sti @MarkdownBlock, STUnion, "", ["UnknownBlock"], "", ""),
(sti @MemberCriteria, STEnum1, "MC", [], "", ""),
(sti @MsgChatLink, STUnion, "MCL", [], "", "Connection link sent in a message - only short links are allowed."),
(sti @MsgContent, STUnion, "MC", [], "", ""),
@@ -374,6 +378,7 @@ chatTypesDocsData =
(sti @ReportReason, STEnum' (dropPfxSfx "RR" ""), "", ["RRUnknown"], "", ""),
(sti @RoleGroupPreference, STRecord, "", [], "", ""),
(sti @SecurityCode, STRecord, "", [], "", ""),
(sti @SegmentRange, STRecord, "", [], "", ""),
(sti @SimplePreference, STRecord, "", [], "", ""),
(sti @SimplexDomain, STRecord, "", [], "", ""),
(sti @SimplexDomainClaim, STRecord, "", [], "", ""),
@@ -395,6 +400,7 @@ chatTypesDocsData =
(sti @SubscriptionStatus, STUnion, "SS", [], "", ""),
(sti @SupportGroupPreference, STRecord, "", [], "", ""),
(sti @SwitchPhase, STEnum, "SP", [], "", ""),
(sti @TableAlign, STEnum, "TA", [], "", ""),
(sti @TimedMessagesGroupPreference, STRecord, "", [], "", ""),
(sti @TimedMessagesPreference, STRecord, "", [], "", ""),
(sti @TransportError, STUnion, "TE", [], "", ""),
@@ -460,6 +466,7 @@ deriving instance Generic BadgeProof
deriving instance Generic BadgeRedeemError
deriving instance Generic BlockingInfo
deriving instance Generic BlockingReason
deriving instance Generic BlockToken
deriving instance Generic BrokerErrorType
deriving instance Generic BusinessChatInfo
deriving instance Generic BusinessChatType
@@ -471,6 +478,7 @@ deriving instance Generic ChatError
deriving instance Generic ChatErrorType
deriving instance Generic ChatFeature
deriving instance Generic ChatItemDeletion
deriving instance Generic ChatLayout
deriving instance Generic ChatPeerType
deriving instance Generic ChatRef
deriving instance Generic ChatSettings
@@ -565,8 +573,10 @@ deriving instance Generic JSONCIStatus
deriving instance Generic LinkContent
deriving instance Generic LinkOwnerSig
deriving instance Generic LinkPreview
deriving instance Generic ListEntry
deriving instance Generic BadgeInfo
deriving instance Generic LocalProfile
deriving instance Generic MarkdownBlock
deriving instance Generic MemberCriteria
deriving instance Generic MsgChatLink
deriving instance Generic MsgContent
@@ -617,6 +627,7 @@ deriving instance Generic RemoteCtrlSessionState
deriving instance Generic RemoteCtrlStopReason
deriving instance Generic ReportReason
deriving instance Generic SecurityCode
deriving instance Generic SegmentRange
deriving instance Generic SimplexDomain
deriving instance Generic SimplexDomainClaim
deriving instance Generic SimplexDomainError
@@ -637,6 +648,7 @@ deriving instance Generic StoreServiceErrorCode
deriving instance Generic SubscriptionStatus
deriving instance Generic SupportGroupPreference
deriving instance Generic SwitchPhase
deriving instance Generic TableAlign
deriving instance Generic TimedMessagesGroupPreference
deriving instance Generic TimedMessagesPreference
deriving instance Generic TransportError