cddl2java 0.0.0
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/.release-it.ts +10 -0
- package/README.md +28 -0
- package/bin/cddl2java.js +5 -0
- package/build/cli.d.ts +2 -0
- package/build/cli.d.ts.map +1 -0
- package/build/cli.js +36 -0
- package/build/constants.d.ts +4 -0
- package/build/constants.d.ts.map +1 -0
- package/build/constants.js +22 -0
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +656 -0
- package/build/templates.d.ts +10 -0
- package/build/templates.d.ts.map +1 -0
- package/build/templates.js +252 -0
- package/build/utils.d.ts +11 -0
- package/build/utils.d.ts.map +1 -0
- package/build/utils.js +17 -0
- package/package.json +41 -0
- package/src/cli.ts +42 -0
- package/src/constants.ts +25 -0
- package/src/index.ts +731 -0
- package/src/templates.ts +258 -0
- package/src/utils.ts +23 -0
- package/tests/__fixtures__/AccessibilityValue.java +71 -0
- package/tests/__fixtures__/Browser/BrowserModule.java +34 -0
- package/tests/__fixtures__/Browser/ClientWindowInfo.java +122 -0
- package/tests/__fixtures__/Browser/ClientWindowNamedState.java +50 -0
- package/tests/__fixtures__/Browser/ClientWindowRectState.java +98 -0
- package/tests/__fixtures__/Browser/CreateUserContextResult.java +16 -0
- package/tests/__fixtures__/Browser/GetClientWindowsResult.java +50 -0
- package/tests/__fixtures__/Browser/GetUserContextsResult.java +50 -0
- package/tests/__fixtures__/Browser/RemoveUserContextParameters.java +50 -0
- package/tests/__fixtures__/Browser/SetClientWindowStateParameters.java +50 -0
- package/tests/__fixtures__/Browser/UserContextInfo.java +50 -0
- package/tests/__fixtures__/BrowsingContext/AccessibilityLocator.java +62 -0
- package/tests/__fixtures__/BrowsingContext/ActivateParameters.java +50 -0
- package/tests/__fixtures__/BrowsingContext/BaseNavigationInfo.java +86 -0
- package/tests/__fixtures__/BrowsingContext/BoxClipRectangle.java +98 -0
- package/tests/__fixtures__/BrowsingContext/BrowsingContextModule.java +34 -0
- package/tests/__fixtures__/BrowsingContext/CaptureScreenshotParameters.java +86 -0
- package/tests/__fixtures__/BrowsingContext/CaptureScreenshotResult.java +50 -0
- package/tests/__fixtures__/BrowsingContext/ClipRectangle.java +17 -0
- package/tests/__fixtures__/BrowsingContext/CloseParameters.java +62 -0
- package/tests/__fixtures__/BrowsingContext/ContextLocator.java +62 -0
- package/tests/__fixtures__/BrowsingContext/CreateParameters.java +86 -0
- package/tests/__fixtures__/BrowsingContext/CreateResult.java +50 -0
- package/tests/__fixtures__/BrowsingContext/CreateType.java +35 -0
- package/tests/__fixtures__/BrowsingContext/CssLocator.java +62 -0
- package/tests/__fixtures__/BrowsingContext/DownloadWillBeginParams.java +50 -0
- package/tests/__fixtures__/BrowsingContext/ElementClipRectangle.java +62 -0
- package/tests/__fixtures__/BrowsingContext/GetTreeParameters.java +62 -0
- package/tests/__fixtures__/BrowsingContext/GetTreeResult.java +50 -0
- package/tests/__fixtures__/BrowsingContext/HandleUserPromptParameters.java +74 -0
- package/tests/__fixtures__/BrowsingContext/HistoryUpdatedParameters.java +62 -0
- package/tests/__fixtures__/BrowsingContext/ImageFormat.java +62 -0
- package/tests/__fixtures__/BrowsingContext/Info.java +122 -0
- package/tests/__fixtures__/BrowsingContext/InnerTextLocator.java +98 -0
- package/tests/__fixtures__/BrowsingContext/LocateNodesParameters.java +98 -0
- package/tests/__fixtures__/BrowsingContext/LocateNodesResult.java +50 -0
- package/tests/__fixtures__/BrowsingContext/Locator.java +20 -0
- package/tests/__fixtures__/BrowsingContext/NavigateParameters.java +74 -0
- package/tests/__fixtures__/BrowsingContext/NavigateResult.java +62 -0
- package/tests/__fixtures__/BrowsingContext/PrintMarginParameters.java +86 -0
- package/tests/__fixtures__/BrowsingContext/PrintPageParameters.java +62 -0
- package/tests/__fixtures__/BrowsingContext/PrintParameters.java +134 -0
- package/tests/__fixtures__/BrowsingContext/PrintResult.java +50 -0
- package/tests/__fixtures__/BrowsingContext/ReadinessState.java +36 -0
- package/tests/__fixtures__/BrowsingContext/ReloadParameters.java +74 -0
- package/tests/__fixtures__/BrowsingContext/SetViewportParameters.java +86 -0
- package/tests/__fixtures__/BrowsingContext/TraverseHistoryParameters.java +62 -0
- package/tests/__fixtures__/BrowsingContext/TraverseHistoryResult.java +28 -0
- package/tests/__fixtures__/BrowsingContext/UserPromptClosedParameters.java +86 -0
- package/tests/__fixtures__/BrowsingContext/UserPromptOpenedParameters.java +98 -0
- package/tests/__fixtures__/BrowsingContext/UserPromptType.java +37 -0
- package/tests/__fixtures__/BrowsingContext/Viewport.java +62 -0
- package/tests/__fixtures__/BrowsingContext/XPathLocator.java +62 -0
- package/tests/__fixtures__/ContextValue.java +55 -0
- package/tests/__fixtures__/EmptyResult.java +21 -0
- package/tests/__fixtures__/Emulation/EmulationModule.java +34 -0
- package/tests/__fixtures__/Emulation/GeolocationCoordinates.java +122 -0
- package/tests/__fixtures__/Emulation/SetGeolocationOverrideParameters.java +74 -0
- package/tests/__fixtures__/Input/ElementOrigin.java +62 -0
- package/tests/__fixtures__/Input/FileDialogInfo.java +74 -0
- package/tests/__fixtures__/Input/InputModule.java +34 -0
- package/tests/__fixtures__/Input/KeyDownAction.java +62 -0
- package/tests/__fixtures__/Input/KeySourceAction.java +18 -0
- package/tests/__fixtures__/Input/KeySourceActions.java +74 -0
- package/tests/__fixtures__/Input/KeyUpAction.java +62 -0
- package/tests/__fixtures__/Input/NoneSourceAction.java +16 -0
- package/tests/__fixtures__/Input/NoneSourceActions.java +74 -0
- package/tests/__fixtures__/Input/Origin.java +36 -0
- package/tests/__fixtures__/Input/PauseAction.java +62 -0
- package/tests/__fixtures__/Input/PerformActionsParameters.java +62 -0
- package/tests/__fixtures__/Input/PointerCommonProperties.java +122 -0
- package/tests/__fixtures__/Input/PointerDownAction.java +62 -0
- package/tests/__fixtures__/Input/PointerMoveAction.java +98 -0
- package/tests/__fixtures__/Input/PointerParameters.java +50 -0
- package/tests/__fixtures__/Input/PointerSourceAction.java +19 -0
- package/tests/__fixtures__/Input/PointerSourceActions.java +86 -0
- package/tests/__fixtures__/Input/PointerType.java +36 -0
- package/tests/__fixtures__/Input/PointerUpAction.java +62 -0
- package/tests/__fixtures__/Input/ReleaseActionsParameters.java +50 -0
- package/tests/__fixtures__/Input/SetFilesParameters.java +74 -0
- package/tests/__fixtures__/Input/SourceActions.java +19 -0
- package/tests/__fixtures__/Input/WheelScrollAction.java +122 -0
- package/tests/__fixtures__/Input/WheelSourceAction.java +17 -0
- package/tests/__fixtures__/Input/WheelSourceActions.java +74 -0
- package/tests/__fixtures__/Log/BaseLogEntry.java +98 -0
- package/tests/__fixtures__/Log/ConsoleLogEntry.java +74 -0
- package/tests/__fixtures__/Log/Entry.java +18 -0
- package/tests/__fixtures__/Log/GenericLogEntry.java +50 -0
- package/tests/__fixtures__/Log/JavascriptLogEntry.java +50 -0
- package/tests/__fixtures__/Log/Level.java +37 -0
- package/tests/__fixtures__/Log/LogModule.java +34 -0
- package/tests/__fixtures__/Network/AddInterceptParameters.java +74 -0
- package/tests/__fixtures__/Network/AddInterceptResult.java +50 -0
- package/tests/__fixtures__/Network/AuthChallenge.java +62 -0
- package/tests/__fixtures__/Network/AuthCredentials.java +74 -0
- package/tests/__fixtures__/Network/AuthRequiredParameters.java +50 -0
- package/tests/__fixtures__/Network/Base64Value.java +62 -0
- package/tests/__fixtures__/Network/BaseParameters.java +122 -0
- package/tests/__fixtures__/Network/BeforeRequestSentParameters.java +50 -0
- package/tests/__fixtures__/Network/BytesValue.java +17 -0
- package/tests/__fixtures__/Network/ContinueRequestParameters.java +110 -0
- package/tests/__fixtures__/Network/ContinueResponseParameters.java +110 -0
- package/tests/__fixtures__/Network/ContinueWithAuthCredentials.java +62 -0
- package/tests/__fixtures__/Network/ContinueWithAuthNoCredentials.java +50 -0
- package/tests/__fixtures__/Network/ContinueWithAuthParameters.java +50 -0
- package/tests/__fixtures__/Network/Cookie.java +146 -0
- package/tests/__fixtures__/Network/CookieHeader.java +62 -0
- package/tests/__fixtures__/Network/FailRequestParameters.java +50 -0
- package/tests/__fixtures__/Network/FetchErrorParameters.java +50 -0
- package/tests/__fixtures__/Network/FetchTimingInfo.java +194 -0
- package/tests/__fixtures__/Network/Header.java +62 -0
- package/tests/__fixtures__/Network/Initiator.java +98 -0
- package/tests/__fixtures__/Network/InterceptPhase.java +36 -0
- package/tests/__fixtures__/Network/NetworkModule.java +34 -0
- package/tests/__fixtures__/Network/ProvideResponseParameters.java +110 -0
- package/tests/__fixtures__/Network/RemoveInterceptParameters.java +50 -0
- package/tests/__fixtures__/Network/RequestData.java +158 -0
- package/tests/__fixtures__/Network/ResponseCompletedParameters.java +50 -0
- package/tests/__fixtures__/Network/ResponseContent.java +50 -0
- package/tests/__fixtures__/Network/ResponseData.java +182 -0
- package/tests/__fixtures__/Network/ResponseStartedParameters.java +50 -0
- package/tests/__fixtures__/Network/SameSite.java +36 -0
- package/tests/__fixtures__/Network/SetCacheBehaviorParameters.java +62 -0
- package/tests/__fixtures__/Network/SetCookieHeader.java +146 -0
- package/tests/__fixtures__/Network/StringValue.java +62 -0
- package/tests/__fixtures__/Network/UrlPattern.java +17 -0
- package/tests/__fixtures__/Network/UrlPatternPattern.java +110 -0
- package/tests/__fixtures__/Network/UrlPatternString.java +62 -0
- package/tests/__fixtures__/Script/AddPreloadScriptParameters.java +98 -0
- package/tests/__fixtures__/Script/AddPreloadScriptResult.java +50 -0
- package/tests/__fixtures__/Script/ArrayBufferRemoteValue.java +74 -0
- package/tests/__fixtures__/Script/ArrayLocalValue.java +62 -0
- package/tests/__fixtures__/Script/ArrayRemoteValue.java +86 -0
- package/tests/__fixtures__/Script/AudioWorkletRealmInfo.java +50 -0
- package/tests/__fixtures__/Script/BaseRealmInfo.java +62 -0
- package/tests/__fixtures__/Script/BigIntValue.java +62 -0
- package/tests/__fixtures__/Script/BooleanValue.java +62 -0
- package/tests/__fixtures__/Script/CallFunctionParameters.java +134 -0
- package/tests/__fixtures__/Script/ChannelProperties.java +74 -0
- package/tests/__fixtures__/Script/ChannelValue.java +62 -0
- package/tests/__fixtures__/Script/ContextTarget.java +62 -0
- package/tests/__fixtures__/Script/DateLocalValue.java +62 -0
- package/tests/__fixtures__/Script/DedicatedWorkerRealmInfo.java +62 -0
- package/tests/__fixtures__/Script/DisownParameters.java +62 -0
- package/tests/__fixtures__/Script/ErrorRemoteValue.java +74 -0
- package/tests/__fixtures__/Script/EvaluateParameters.java +110 -0
- package/tests/__fixtures__/Script/EvaluateResult.java +17 -0
- package/tests/__fixtures__/Script/EvaluateResultException.java +74 -0
- package/tests/__fixtures__/Script/EvaluateResultSuccess.java +74 -0
- package/tests/__fixtures__/Script/ExceptionDetails.java +98 -0
- package/tests/__fixtures__/Script/FunctionRemoteValue.java +74 -0
- package/tests/__fixtures__/Script/GeneratorRemoteValue.java +74 -0
- package/tests/__fixtures__/Script/GetRealmsParameters.java +62 -0
- package/tests/__fixtures__/Script/GetRealmsResult.java +50 -0
- package/tests/__fixtures__/Script/HTMLCollectionRemoteValue.java +86 -0
- package/tests/__fixtures__/Script/LocalValue.java +24 -0
- package/tests/__fixtures__/Script/MapLocalValue.java +62 -0
- package/tests/__fixtures__/Script/MapRemoteValue.java +86 -0
- package/tests/__fixtures__/Script/MessageParameters.java +74 -0
- package/tests/__fixtures__/Script/NodeListRemoteValue.java +86 -0
- package/tests/__fixtures__/Script/NodeProperties.java +146 -0
- package/tests/__fixtures__/Script/NodeRemoteValue.java +98 -0
- package/tests/__fixtures__/Script/NullValue.java +50 -0
- package/tests/__fixtures__/Script/NumberValue.java +62 -0
- package/tests/__fixtures__/Script/ObjectLocalValue.java +62 -0
- package/tests/__fixtures__/Script/ObjectRemoteValue.java +86 -0
- package/tests/__fixtures__/Script/PaintWorkletRealmInfo.java +50 -0
- package/tests/__fixtures__/Script/PrimitiveProtocolValue.java +21 -0
- package/tests/__fixtures__/Script/PromiseRemoteValue.java +74 -0
- package/tests/__fixtures__/Script/ProxyRemoteValue.java +74 -0
- package/tests/__fixtures__/Script/RealmDestroyedParameters.java +50 -0
- package/tests/__fixtures__/Script/RealmInfo.java +23 -0
- package/tests/__fixtures__/Script/RealmTarget.java +50 -0
- package/tests/__fixtures__/Script/RealmType.java +41 -0
- package/tests/__fixtures__/Script/RegExpLocalValue.java +62 -0
- package/tests/__fixtures__/Script/RegExpValue.java +62 -0
- package/tests/__fixtures__/Script/RemoteObjectReference.java +62 -0
- package/tests/__fixtures__/Script/RemoteReference.java +17 -0
- package/tests/__fixtures__/Script/RemoteValue.java +36 -0
- package/tests/__fixtures__/Script/RemovePreloadScriptParameters.java +50 -0
- package/tests/__fixtures__/Script/ResultOwnership.java +35 -0
- package/tests/__fixtures__/Script/ScriptModule.java +34 -0
- package/tests/__fixtures__/Script/SerializationOptions.java +74 -0
- package/tests/__fixtures__/Script/ServiceWorkerRealmInfo.java +50 -0
- package/tests/__fixtures__/Script/SetLocalValue.java +62 -0
- package/tests/__fixtures__/Script/SetRemoteValue.java +86 -0
- package/tests/__fixtures__/Script/SharedReference.java +62 -0
- package/tests/__fixtures__/Script/SharedWorkerRealmInfo.java +50 -0
- package/tests/__fixtures__/Script/Source.java +62 -0
- package/tests/__fixtures__/Script/SpecialNumber.java +37 -0
- package/tests/__fixtures__/Script/StackFrame.java +86 -0
- package/tests/__fixtures__/Script/StackTrace.java +50 -0
- package/tests/__fixtures__/Script/StringValue.java +62 -0
- package/tests/__fixtures__/Script/SymbolRemoteValue.java +74 -0
- package/tests/__fixtures__/Script/Target.java +17 -0
- package/tests/__fixtures__/Script/TypedArrayRemoteValue.java +74 -0
- package/tests/__fixtures__/Script/UndefinedValue.java +50 -0
- package/tests/__fixtures__/Script/WeakMapRemoteValue.java +74 -0
- package/tests/__fixtures__/Script/WeakSetRemoteValue.java +74 -0
- package/tests/__fixtures__/Script/WindowProxyProperties.java +50 -0
- package/tests/__fixtures__/Script/WindowProxyRemoteValue.java +86 -0
- package/tests/__fixtures__/Script/WindowRealmInfo.java +74 -0
- package/tests/__fixtures__/Script/WorkerRealmInfo.java +50 -0
- package/tests/__fixtures__/Script/WorkletRealmInfo.java +50 -0
- package/tests/__fixtures__/Session/Capabilities.java +55 -0
- package/tests/__fixtures__/Session/CapabilitiesRequest.java +62 -0
- package/tests/__fixtures__/Session/CapabilityRequest.java +110 -0
- package/tests/__fixtures__/Session/NewParameters.java +50 -0
- package/tests/__fixtures__/Session/NewResult.java +62 -0
- package/tests/__fixtures__/Session/ProxyConfiguration.java +20 -0
- package/tests/__fixtures__/Session/SessionModule.java +34 -0
- package/tests/__fixtures__/Session/StatusResult.java +62 -0
- package/tests/__fixtures__/Session/SubscribeResult.java +50 -0
- package/tests/__fixtures__/Session/SubscriptionRequest.java +74 -0
- package/tests/__fixtures__/Session/UnsubscribeByAttributesRequest.java +62 -0
- package/tests/__fixtures__/Session/UnsubscribeByIDRequest.java +50 -0
- package/tests/__fixtures__/Session/UnsubscribeParameters.java +17 -0
- package/tests/__fixtures__/Session/UserPromptHandler.java +110 -0
- package/tests/__fixtures__/Session/UserPromptHandlerType.java +36 -0
- package/tests/__fixtures__/Storage/BrowsingContextPartitionDescriptor.java +62 -0
- package/tests/__fixtures__/Storage/CookieFilter.java +146 -0
- package/tests/__fixtures__/Storage/DeleteCookiesParameters.java +62 -0
- package/tests/__fixtures__/Storage/DeleteCookiesResult.java +50 -0
- package/tests/__fixtures__/Storage/GetCookiesParameters.java +62 -0
- package/tests/__fixtures__/Storage/GetCookiesResult.java +62 -0
- package/tests/__fixtures__/Storage/PartialCookie.java +134 -0
- package/tests/__fixtures__/Storage/PartitionDescriptor.java +17 -0
- package/tests/__fixtures__/Storage/PartitionKey.java +62 -0
- package/tests/__fixtures__/Storage/SetCookieParameters.java +62 -0
- package/tests/__fixtures__/Storage/SetCookieResult.java +50 -0
- package/tests/__fixtures__/Storage/StorageKeyPartitionDescriptor.java +74 -0
- package/tests/__fixtures__/Storage/StorageModule.java +34 -0
- package/tests/__fixtures__/WebExtension/ExtensionArchivePath.java +62 -0
- package/tests/__fixtures__/WebExtension/ExtensionBase64Encoded.java +62 -0
- package/tests/__fixtures__/WebExtension/ExtensionData.java +18 -0
- package/tests/__fixtures__/WebExtension/ExtensionPath.java +62 -0
- package/tests/__fixtures__/WebExtension/InstallParameters.java +50 -0
- package/tests/__fixtures__/WebExtension/InstallResult.java +50 -0
- package/tests/__fixtures__/WebExtension/UninstallParameters.java +50 -0
- package/tests/__fixtures__/WebExtension/WebExtensionModule.java +34 -0
- package/tests/__output__/AccessibilityValue.java +71 -0
- package/tests/__output__/Browser/BrowserModule.java +34 -0
- package/tests/__output__/Browser/ClientWindowInfo.java +122 -0
- package/tests/__output__/Browser/ClientWindowNamedState.java +50 -0
- package/tests/__output__/Browser/ClientWindowRectState.java +98 -0
- package/tests/__output__/Browser/CreateUserContextResult.java +16 -0
- package/tests/__output__/Browser/GetClientWindowsResult.java +50 -0
- package/tests/__output__/Browser/GetUserContextsResult.java +50 -0
- package/tests/__output__/Browser/RemoveUserContextParameters.java +50 -0
- package/tests/__output__/Browser/SetClientWindowStateParameters.java +50 -0
- package/tests/__output__/Browser/UserContextInfo.java +50 -0
- package/tests/__output__/BrowsingContext/AccessibilityLocator.java +62 -0
- package/tests/__output__/BrowsingContext/ActivateParameters.java +50 -0
- package/tests/__output__/BrowsingContext/BaseNavigationInfo.java +86 -0
- package/tests/__output__/BrowsingContext/BoxClipRectangle.java +98 -0
- package/tests/__output__/BrowsingContext/BrowsingContextModule.java +34 -0
- package/tests/__output__/BrowsingContext/CaptureScreenshotParameters.java +86 -0
- package/tests/__output__/BrowsingContext/CaptureScreenshotResult.java +50 -0
- package/tests/__output__/BrowsingContext/ClipRectangle.java +17 -0
- package/tests/__output__/BrowsingContext/CloseParameters.java +62 -0
- package/tests/__output__/BrowsingContext/ContextLocator.java +62 -0
- package/tests/__output__/BrowsingContext/CreateParameters.java +86 -0
- package/tests/__output__/BrowsingContext/CreateResult.java +50 -0
- package/tests/__output__/BrowsingContext/CreateType.java +35 -0
- package/tests/__output__/BrowsingContext/CssLocator.java +62 -0
- package/tests/__output__/BrowsingContext/DownloadWillBeginParams.java +50 -0
- package/tests/__output__/BrowsingContext/ElementClipRectangle.java +62 -0
- package/tests/__output__/BrowsingContext/GetTreeParameters.java +62 -0
- package/tests/__output__/BrowsingContext/GetTreeResult.java +50 -0
- package/tests/__output__/BrowsingContext/HandleUserPromptParameters.java +74 -0
- package/tests/__output__/BrowsingContext/HistoryUpdatedParameters.java +62 -0
- package/tests/__output__/BrowsingContext/ImageFormat.java +62 -0
- package/tests/__output__/BrowsingContext/Info.java +122 -0
- package/tests/__output__/BrowsingContext/InnerTextLocator.java +98 -0
- package/tests/__output__/BrowsingContext/LocateNodesParameters.java +98 -0
- package/tests/__output__/BrowsingContext/LocateNodesResult.java +50 -0
- package/tests/__output__/BrowsingContext/Locator.java +20 -0
- package/tests/__output__/BrowsingContext/NavigateParameters.java +74 -0
- package/tests/__output__/BrowsingContext/NavigateResult.java +62 -0
- package/tests/__output__/BrowsingContext/PrintMarginParameters.java +86 -0
- package/tests/__output__/BrowsingContext/PrintPageParameters.java +62 -0
- package/tests/__output__/BrowsingContext/PrintParameters.java +134 -0
- package/tests/__output__/BrowsingContext/PrintResult.java +50 -0
- package/tests/__output__/BrowsingContext/ReadinessState.java +36 -0
- package/tests/__output__/BrowsingContext/ReloadParameters.java +74 -0
- package/tests/__output__/BrowsingContext/SetViewportParameters.java +86 -0
- package/tests/__output__/BrowsingContext/TraverseHistoryParameters.java +62 -0
- package/tests/__output__/BrowsingContext/TraverseHistoryResult.java +28 -0
- package/tests/__output__/BrowsingContext/UserPromptClosedParameters.java +86 -0
- package/tests/__output__/BrowsingContext/UserPromptOpenedParameters.java +98 -0
- package/tests/__output__/BrowsingContext/UserPromptType.java +37 -0
- package/tests/__output__/BrowsingContext/Viewport.java +62 -0
- package/tests/__output__/BrowsingContext/XPathLocator.java +62 -0
- package/tests/__output__/ContextValue.java +55 -0
- package/tests/__output__/EmptyResult.java +21 -0
- package/tests/__output__/Emulation/EmulationModule.java +34 -0
- package/tests/__output__/Emulation/GeolocationCoordinates.java +122 -0
- package/tests/__output__/Emulation/SetGeolocationOverrideParameters.java +74 -0
- package/tests/__output__/Input/ElementOrigin.java +62 -0
- package/tests/__output__/Input/FileDialogInfo.java +74 -0
- package/tests/__output__/Input/InputModule.java +34 -0
- package/tests/__output__/Input/KeyDownAction.java +62 -0
- package/tests/__output__/Input/KeySourceAction.java +18 -0
- package/tests/__output__/Input/KeySourceActions.java +74 -0
- package/tests/__output__/Input/KeyUpAction.java +62 -0
- package/tests/__output__/Input/NoneSourceAction.java +16 -0
- package/tests/__output__/Input/NoneSourceActions.java +74 -0
- package/tests/__output__/Input/Origin.java +36 -0
- package/tests/__output__/Input/PauseAction.java +62 -0
- package/tests/__output__/Input/PerformActionsParameters.java +62 -0
- package/tests/__output__/Input/PointerCommonProperties.java +122 -0
- package/tests/__output__/Input/PointerDownAction.java +62 -0
- package/tests/__output__/Input/PointerMoveAction.java +98 -0
- package/tests/__output__/Input/PointerParameters.java +50 -0
- package/tests/__output__/Input/PointerSourceAction.java +19 -0
- package/tests/__output__/Input/PointerSourceActions.java +86 -0
- package/tests/__output__/Input/PointerType.java +36 -0
- package/tests/__output__/Input/PointerUpAction.java +62 -0
- package/tests/__output__/Input/ReleaseActionsParameters.java +50 -0
- package/tests/__output__/Input/SetFilesParameters.java +74 -0
- package/tests/__output__/Input/SourceActions.java +19 -0
- package/tests/__output__/Input/WheelScrollAction.java +122 -0
- package/tests/__output__/Input/WheelSourceAction.java +17 -0
- package/tests/__output__/Input/WheelSourceActions.java +74 -0
- package/tests/__output__/Log/BaseLogEntry.java +98 -0
- package/tests/__output__/Log/ConsoleLogEntry.java +74 -0
- package/tests/__output__/Log/Entry.java +18 -0
- package/tests/__output__/Log/GenericLogEntry.java +50 -0
- package/tests/__output__/Log/JavascriptLogEntry.java +50 -0
- package/tests/__output__/Log/Level.java +37 -0
- package/tests/__output__/Log/LogModule.java +34 -0
- package/tests/__output__/Network/AddInterceptParameters.java +74 -0
- package/tests/__output__/Network/AddInterceptResult.java +50 -0
- package/tests/__output__/Network/AuthChallenge.java +62 -0
- package/tests/__output__/Network/AuthCredentials.java +74 -0
- package/tests/__output__/Network/AuthRequiredParameters.java +50 -0
- package/tests/__output__/Network/Base64Value.java +62 -0
- package/tests/__output__/Network/BaseParameters.java +122 -0
- package/tests/__output__/Network/BeforeRequestSentParameters.java +50 -0
- package/tests/__output__/Network/BytesValue.java +17 -0
- package/tests/__output__/Network/ContinueRequestParameters.java +110 -0
- package/tests/__output__/Network/ContinueResponseParameters.java +110 -0
- package/tests/__output__/Network/ContinueWithAuthCredentials.java +62 -0
- package/tests/__output__/Network/ContinueWithAuthNoCredentials.java +50 -0
- package/tests/__output__/Network/ContinueWithAuthParameters.java +50 -0
- package/tests/__output__/Network/Cookie.java +146 -0
- package/tests/__output__/Network/CookieHeader.java +62 -0
- package/tests/__output__/Network/FailRequestParameters.java +50 -0
- package/tests/__output__/Network/FetchErrorParameters.java +50 -0
- package/tests/__output__/Network/FetchTimingInfo.java +194 -0
- package/tests/__output__/Network/Header.java +62 -0
- package/tests/__output__/Network/Initiator.java +98 -0
- package/tests/__output__/Network/InterceptPhase.java +36 -0
- package/tests/__output__/Network/NetworkModule.java +34 -0
- package/tests/__output__/Network/ProvideResponseParameters.java +110 -0
- package/tests/__output__/Network/RemoveInterceptParameters.java +50 -0
- package/tests/__output__/Network/RequestData.java +158 -0
- package/tests/__output__/Network/ResponseCompletedParameters.java +50 -0
- package/tests/__output__/Network/ResponseContent.java +50 -0
- package/tests/__output__/Network/ResponseData.java +182 -0
- package/tests/__output__/Network/ResponseStartedParameters.java +50 -0
- package/tests/__output__/Network/SameSite.java +36 -0
- package/tests/__output__/Network/SetCacheBehaviorParameters.java +62 -0
- package/tests/__output__/Network/SetCookieHeader.java +146 -0
- package/tests/__output__/Network/StringValue.java +62 -0
- package/tests/__output__/Network/UrlPattern.java +17 -0
- package/tests/__output__/Network/UrlPatternPattern.java +110 -0
- package/tests/__output__/Network/UrlPatternString.java +62 -0
- package/tests/__output__/Script/AddPreloadScriptParameters.java +98 -0
- package/tests/__output__/Script/AddPreloadScriptResult.java +50 -0
- package/tests/__output__/Script/ArrayBufferRemoteValue.java +74 -0
- package/tests/__output__/Script/ArrayLocalValue.java +62 -0
- package/tests/__output__/Script/ArrayRemoteValue.java +86 -0
- package/tests/__output__/Script/AudioWorkletRealmInfo.java +50 -0
- package/tests/__output__/Script/BaseRealmInfo.java +62 -0
- package/tests/__output__/Script/BigIntValue.java +62 -0
- package/tests/__output__/Script/BooleanValue.java +62 -0
- package/tests/__output__/Script/CallFunctionParameters.java +134 -0
- package/tests/__output__/Script/ChannelProperties.java +74 -0
- package/tests/__output__/Script/ChannelValue.java +62 -0
- package/tests/__output__/Script/ContextTarget.java +62 -0
- package/tests/__output__/Script/DateLocalValue.java +62 -0
- package/tests/__output__/Script/DedicatedWorkerRealmInfo.java +62 -0
- package/tests/__output__/Script/DisownParameters.java +62 -0
- package/tests/__output__/Script/ErrorRemoteValue.java +74 -0
- package/tests/__output__/Script/EvaluateParameters.java +110 -0
- package/tests/__output__/Script/EvaluateResult.java +17 -0
- package/tests/__output__/Script/EvaluateResultException.java +74 -0
- package/tests/__output__/Script/EvaluateResultSuccess.java +74 -0
- package/tests/__output__/Script/ExceptionDetails.java +98 -0
- package/tests/__output__/Script/FunctionRemoteValue.java +74 -0
- package/tests/__output__/Script/GeneratorRemoteValue.java +74 -0
- package/tests/__output__/Script/GetRealmsParameters.java +62 -0
- package/tests/__output__/Script/GetRealmsResult.java +50 -0
- package/tests/__output__/Script/HTMLCollectionRemoteValue.java +86 -0
- package/tests/__output__/Script/LocalValue.java +24 -0
- package/tests/__output__/Script/MapLocalValue.java +62 -0
- package/tests/__output__/Script/MapRemoteValue.java +86 -0
- package/tests/__output__/Script/MessageParameters.java +74 -0
- package/tests/__output__/Script/NodeListRemoteValue.java +86 -0
- package/tests/__output__/Script/NodeProperties.java +146 -0
- package/tests/__output__/Script/NodeRemoteValue.java +98 -0
- package/tests/__output__/Script/NullValue.java +50 -0
- package/tests/__output__/Script/NumberValue.java +62 -0
- package/tests/__output__/Script/ObjectLocalValue.java +62 -0
- package/tests/__output__/Script/ObjectRemoteValue.java +86 -0
- package/tests/__output__/Script/PaintWorkletRealmInfo.java +50 -0
- package/tests/__output__/Script/PrimitiveProtocolValue.java +21 -0
- package/tests/__output__/Script/PromiseRemoteValue.java +74 -0
- package/tests/__output__/Script/ProxyRemoteValue.java +74 -0
- package/tests/__output__/Script/RealmDestroyedParameters.java +50 -0
- package/tests/__output__/Script/RealmInfo.java +23 -0
- package/tests/__output__/Script/RealmTarget.java +50 -0
- package/tests/__output__/Script/RealmType.java +41 -0
- package/tests/__output__/Script/RegExpLocalValue.java +62 -0
- package/tests/__output__/Script/RegExpValue.java +62 -0
- package/tests/__output__/Script/RemoteObjectReference.java +62 -0
- package/tests/__output__/Script/RemoteReference.java +17 -0
- package/tests/__output__/Script/RemoteValue.java +36 -0
- package/tests/__output__/Script/RemovePreloadScriptParameters.java +50 -0
- package/tests/__output__/Script/ResultOwnership.java +35 -0
- package/tests/__output__/Script/ScriptModule.java +34 -0
- package/tests/__output__/Script/SerializationOptions.java +74 -0
- package/tests/__output__/Script/ServiceWorkerRealmInfo.java +50 -0
- package/tests/__output__/Script/SetLocalValue.java +62 -0
- package/tests/__output__/Script/SetRemoteValue.java +86 -0
- package/tests/__output__/Script/SharedReference.java +62 -0
- package/tests/__output__/Script/SharedWorkerRealmInfo.java +50 -0
- package/tests/__output__/Script/Source.java +62 -0
- package/tests/__output__/Script/SpecialNumber.java +37 -0
- package/tests/__output__/Script/StackFrame.java +86 -0
- package/tests/__output__/Script/StackTrace.java +50 -0
- package/tests/__output__/Script/StringValue.java +62 -0
- package/tests/__output__/Script/SymbolRemoteValue.java +74 -0
- package/tests/__output__/Script/Target.java +17 -0
- package/tests/__output__/Script/TypedArrayRemoteValue.java +74 -0
- package/tests/__output__/Script/UndefinedValue.java +50 -0
- package/tests/__output__/Script/WeakMapRemoteValue.java +74 -0
- package/tests/__output__/Script/WeakSetRemoteValue.java +74 -0
- package/tests/__output__/Script/WindowProxyProperties.java +50 -0
- package/tests/__output__/Script/WindowProxyRemoteValue.java +86 -0
- package/tests/__output__/Script/WindowRealmInfo.java +74 -0
- package/tests/__output__/Script/WorkerRealmInfo.java +50 -0
- package/tests/__output__/Script/WorkletRealmInfo.java +50 -0
- package/tests/__output__/Session/Capabilities.java +55 -0
- package/tests/__output__/Session/CapabilitiesRequest.java +62 -0
- package/tests/__output__/Session/CapabilityRequest.java +110 -0
- package/tests/__output__/Session/NewParameters.java +50 -0
- package/tests/__output__/Session/NewResult.java +62 -0
- package/tests/__output__/Session/ProxyConfiguration.java +20 -0
- package/tests/__output__/Session/SessionModule.java +34 -0
- package/tests/__output__/Session/StatusResult.java +62 -0
- package/tests/__output__/Session/SubscribeResult.java +50 -0
- package/tests/__output__/Session/SubscriptionRequest.java +74 -0
- package/tests/__output__/Session/UnsubscribeByAttributesRequest.java +62 -0
- package/tests/__output__/Session/UnsubscribeByIDRequest.java +50 -0
- package/tests/__output__/Session/UnsubscribeParameters.java +17 -0
- package/tests/__output__/Session/UserPromptHandler.java +110 -0
- package/tests/__output__/Session/UserPromptHandlerType.java +36 -0
- package/tests/__output__/Storage/BrowsingContextPartitionDescriptor.java +62 -0
- package/tests/__output__/Storage/CookieFilter.java +146 -0
- package/tests/__output__/Storage/DeleteCookiesParameters.java +62 -0
- package/tests/__output__/Storage/DeleteCookiesResult.java +50 -0
- package/tests/__output__/Storage/GetCookiesParameters.java +62 -0
- package/tests/__output__/Storage/GetCookiesResult.java +62 -0
- package/tests/__output__/Storage/PartialCookie.java +134 -0
- package/tests/__output__/Storage/PartitionDescriptor.java +17 -0
- package/tests/__output__/Storage/PartitionKey.java +62 -0
- package/tests/__output__/Storage/SetCookieParameters.java +62 -0
- package/tests/__output__/Storage/SetCookieResult.java +50 -0
- package/tests/__output__/Storage/StorageKeyPartitionDescriptor.java +74 -0
- package/tests/__output__/Storage/StorageModule.java +34 -0
- package/tests/__output__/WebExtension/ExtensionArchivePath.java +62 -0
- package/tests/__output__/WebExtension/ExtensionBase64Encoded.java +62 -0
- package/tests/__output__/WebExtension/ExtensionData.java +18 -0
- package/tests/__output__/WebExtension/ExtensionPath.java +62 -0
- package/tests/__output__/WebExtension/InstallParameters.java +50 -0
- package/tests/__output__/WebExtension/InstallResult.java +50 -0
- package/tests/__output__/WebExtension/UninstallParameters.java +50 -0
- package/tests/__output__/WebExtension/WebExtensionModule.java +34 -0
- package/tests/bidi.cddl +2511 -0
- package/tests/mod.test.ts +65 -0
- package/tsconfig.json +11 -0
package/build/index.js
ADDED
|
@@ -0,0 +1,656 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import util from 'node:util';
|
|
4
|
+
import camelcase from 'camelcase';
|
|
5
|
+
import { parse as parseCDDL } from 'cddl';
|
|
6
|
+
import { pascalCase, writeFile } from './utils.js';
|
|
7
|
+
import { CDDL_PARSE_ERROR_MESSAGE } from './constants.js';
|
|
8
|
+
import { emptyResultTemplate, contextValueTemplate, accessibilityValueTemplate, getEnumTemplate, capabilitiesTemplate, newResultTemplate, } from './templates.js';
|
|
9
|
+
function parseCDDLFile(filePath) {
|
|
10
|
+
let ast;
|
|
11
|
+
try {
|
|
12
|
+
ast = parseCDDL(filePath);
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
/* c8 ignore next */ console.log(util.format(CDDL_PARSE_ERROR_MESSAGE, `Failed to parse ${filePath}: ${err.stack}`));
|
|
16
|
+
/* c8 ignore next */ process.exit(0);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* CDDL ast transformation
|
|
20
|
+
* Unfortunately the CDDL can not be always correctly transformed into TypeScript
|
|
21
|
+
* Therefor we need to make some adjustments here:
|
|
22
|
+
*
|
|
23
|
+
* - remove CommandData and Extensible from Command group
|
|
24
|
+
*/
|
|
25
|
+
const commandGroup = ast.findIndex((a) => a.Name === 'Command');
|
|
26
|
+
if (commandGroup !== -1) {
|
|
27
|
+
ast[commandGroup].Properties = [ast[commandGroup].Properties[0]];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* have groups with method property extend from Command group
|
|
31
|
+
*/
|
|
32
|
+
const commandGroups = ast.filter((a) => (a.Type === 'group' &&
|
|
33
|
+
a.Properties &&
|
|
34
|
+
a.Properties[0] &&
|
|
35
|
+
a.Properties[0].Name === 'method'));
|
|
36
|
+
for (const g of commandGroups) {
|
|
37
|
+
g.Properties.push({
|
|
38
|
+
HasCut: false,
|
|
39
|
+
Occurrence: { n: 1, m: 1 },
|
|
40
|
+
Name: '',
|
|
41
|
+
Type: [{ Type: 'group', Value: 'Command', Unwrapped: false }],
|
|
42
|
+
Comments: []
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
return ast;
|
|
46
|
+
}
|
|
47
|
+
const stringTypes = [
|
|
48
|
+
'script.InternalId',
|
|
49
|
+
'browser.ClientWindow',
|
|
50
|
+
'browser.UserContext',
|
|
51
|
+
'browsingContext.BrowsingContext',
|
|
52
|
+
'browsingContext.Navigation',
|
|
53
|
+
'network.Request',
|
|
54
|
+
'script.Channel',
|
|
55
|
+
'script.Handle',
|
|
56
|
+
'script.InternalId',
|
|
57
|
+
'script.PreloadScript',
|
|
58
|
+
'script.Realm',
|
|
59
|
+
'script.SharedId',
|
|
60
|
+
'browser.ClientWindow',
|
|
61
|
+
'browser.UserContext',
|
|
62
|
+
'browsingContext.BrowsingContext',
|
|
63
|
+
'browsingContext.Navigation',
|
|
64
|
+
'network.Request',
|
|
65
|
+
'script.Channel',
|
|
66
|
+
'script.Handle',
|
|
67
|
+
'script.InternalId',
|
|
68
|
+
'script.PreloadScript',
|
|
69
|
+
'script.Realm',
|
|
70
|
+
'script.SharedId'
|
|
71
|
+
];
|
|
72
|
+
async function createModules(assignments) {
|
|
73
|
+
const javaFiles = new Map();
|
|
74
|
+
for (const assignment of assignments) {
|
|
75
|
+
/**
|
|
76
|
+
* only create methods for groups that have a method property and therefor are commands that
|
|
77
|
+
* receive a certain result
|
|
78
|
+
*/
|
|
79
|
+
if (assignment.Type !== 'group' || assignment.Properties.length === 0 || assignment.Properties[0].Name !== 'method') {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const responseType = assignments.find((a) => camelcase(a.Name) === `${camelcase(assignment.Name)}Result`);
|
|
83
|
+
const methodId = (assignment.Properties[0].Type[0]).Value;
|
|
84
|
+
const paramName = (assignment.Properties[1].Type[0]).Value;
|
|
85
|
+
// Extract scope and command from assignment name
|
|
86
|
+
const [scope, command] = assignment.Name.split('.');
|
|
87
|
+
const moduleScope = (scope[0].toUpperCase() + scope.slice(1));
|
|
88
|
+
// Handle parameter class name - safely extract from paramName
|
|
89
|
+
let paramClass;
|
|
90
|
+
const paramParts = paramName.split('.');
|
|
91
|
+
if (paramParts.length > 1) {
|
|
92
|
+
// Parameter has a scope prefix (e.g., 'session.Capabilities')
|
|
93
|
+
paramClass = paramParts[1][0].toUpperCase() + paramParts[1].slice(1);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
// Parameter doesn't have a scope prefix
|
|
97
|
+
paramClass = paramName[0].toUpperCase() + paramName.slice(1);
|
|
98
|
+
}
|
|
99
|
+
// Properly format parameter type
|
|
100
|
+
const paramType = `${paramClass}`;
|
|
101
|
+
// Handle return type - should be in same package
|
|
102
|
+
const resultTypeJava = responseType
|
|
103
|
+
? resultName(responseType.Name)
|
|
104
|
+
: 'EmptyResult';
|
|
105
|
+
// Adjust result type to proper package reference if it's EmptyResult
|
|
106
|
+
const resultTypeJavaEmbed = responseType
|
|
107
|
+
? resultTypeJava
|
|
108
|
+
: 'org.openqa.selenium.bidirectional.EmptyResult';
|
|
109
|
+
const specUrl = `https://w3c.github.io/webdriver-bidi/#command-${methodId.replace('.', '-')}`;
|
|
110
|
+
const description = `WebDriver Bidi command to send command method "${methodId}" with parameters.`;
|
|
111
|
+
const c = [
|
|
112
|
+
'*',
|
|
113
|
+
` * ${description}`,
|
|
114
|
+
` * @url ${specUrl}`,
|
|
115
|
+
` * @param parameters \`${paramType}\` {@link ${specUrl} | command parameter}`,
|
|
116
|
+
` * @return Command object with result type for ${methodId}`,
|
|
117
|
+
' *'
|
|
118
|
+
];
|
|
119
|
+
const mapKey = [moduleScope, `${moduleScope}Module`];
|
|
120
|
+
if (!javaFiles.has(mapKey)) {
|
|
121
|
+
javaFiles.set(mapKey, `package org.openqa.selenium.bidirectional.${scope.toLowerCase()};
|
|
122
|
+
|
|
123
|
+
import java.util.Map;
|
|
124
|
+
import java.util.HashMap;
|
|
125
|
+
import org.openqa.selenium.bidi.Command;
|
|
126
|
+
import org.openqa.selenium.bidirectional.EmptyResult;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Auto generated class for running WebDriver BiDi ${scope.toLowerCase()} commands in Java
|
|
130
|
+
*/
|
|
131
|
+
public class ${moduleScope}Module {
|
|
132
|
+
`);
|
|
133
|
+
}
|
|
134
|
+
let code = javaFiles.get(mapKey);
|
|
135
|
+
code += `
|
|
136
|
+
/*${c.join('\n ')}/
|
|
137
|
+
public Command<${resultTypeJavaEmbed}> ${command} (${paramType} parameters) {
|
|
138
|
+
return new Command<>(
|
|
139
|
+
"${methodId}",
|
|
140
|
+
parameters.asMap(),
|
|
141
|
+
${resultTypeJavaEmbed}.class
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
}`;
|
|
145
|
+
javaFiles.set(mapKey, code);
|
|
146
|
+
}
|
|
147
|
+
return javaFiles;
|
|
148
|
+
}
|
|
149
|
+
// Helper function to get correct class name for result types
|
|
150
|
+
function resultName(name) {
|
|
151
|
+
const [_scope, resultName] = name.split('.');
|
|
152
|
+
return resultName[0].toUpperCase() + resultName.slice(1);
|
|
153
|
+
}
|
|
154
|
+
async function createPropertyClasses(assignments) {
|
|
155
|
+
const javaPropFiles = new Map();
|
|
156
|
+
const allGroupEnums = assignments
|
|
157
|
+
.filter((a) => (a.Type === 'variable' &&
|
|
158
|
+
Array.isArray(a.PropertyType) &&
|
|
159
|
+
a.PropertyType.every((p) => p.Type === 'group')))
|
|
160
|
+
.map((a) => {
|
|
161
|
+
const prop = a.PropertyType;
|
|
162
|
+
return {
|
|
163
|
+
name: a.Name,
|
|
164
|
+
enums: prop.map((p) => p.Value)
|
|
165
|
+
};
|
|
166
|
+
});
|
|
167
|
+
for (const assignment of assignments) {
|
|
168
|
+
/**
|
|
169
|
+
* only create methods for groups that have a method property and therefor are commands that
|
|
170
|
+
* receive a certain result
|
|
171
|
+
*/
|
|
172
|
+
if (!(assignment.Type !== 'group' || assignment.Properties.length === 0 || assignment.Properties[0].Name !== 'method')) {
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* some commands have no scope, e.g. "Command"
|
|
177
|
+
*/
|
|
178
|
+
if (!assignment.Name.includes('.')) {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
const scopeCamelCase = assignment.Name.split('.')[0][0].toUpperCase() + assignment.Name.split('.')[0].slice(1);
|
|
182
|
+
if ('Properties' in assignment) {
|
|
183
|
+
const prop = assignment.Name.split('.')[1];
|
|
184
|
+
const propClassName = prop[0].toUpperCase() + prop.slice(1);
|
|
185
|
+
const mapKey = [scopeCamelCase, propClassName];
|
|
186
|
+
const props = new Map();
|
|
187
|
+
for (const property of assignment.Properties) {
|
|
188
|
+
if (Array.isArray(property) || !property.Name) {
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
let { type, isLiteral } = parseType(property.Type);
|
|
192
|
+
// Override specific unknown types with known implementations
|
|
193
|
+
let finalType = type;
|
|
194
|
+
// Check for array of types
|
|
195
|
+
// {
|
|
196
|
+
// "HasCut": true,
|
|
197
|
+
// "Occurrence": {
|
|
198
|
+
// "n": 0,
|
|
199
|
+
// "m": null
|
|
200
|
+
// },
|
|
201
|
+
// "Name": "cookies",
|
|
202
|
+
// "Type": [
|
|
203
|
+
// {
|
|
204
|
+
// "Type": "array",
|
|
205
|
+
// "Name": "",
|
|
206
|
+
// "Values": [
|
|
207
|
+
// {
|
|
208
|
+
// "HasCut": false,
|
|
209
|
+
// "Occurrence": {
|
|
210
|
+
// "n": 0,
|
|
211
|
+
// "m": null
|
|
212
|
+
// },
|
|
213
|
+
// "Name": "",
|
|
214
|
+
// "Type": [
|
|
215
|
+
// {
|
|
216
|
+
// "Type": "group",
|
|
217
|
+
// "Value": "network.SetCookieHeader",
|
|
218
|
+
// "Unwrapped": false
|
|
219
|
+
// }
|
|
220
|
+
// ],
|
|
221
|
+
// "Comments": []
|
|
222
|
+
// }
|
|
223
|
+
// ],
|
|
224
|
+
// "Comments": []
|
|
225
|
+
// }
|
|
226
|
+
// ],
|
|
227
|
+
// "Comments": []
|
|
228
|
+
// }
|
|
229
|
+
if (Array.isArray(property.Type) &&
|
|
230
|
+
property.Type.length > 0 &&
|
|
231
|
+
property.Type[0] &&
|
|
232
|
+
property.Type[0].Type === 'array') {
|
|
233
|
+
const prop = property.Type[0];
|
|
234
|
+
if (prop.Values && prop.Values.length > 0 && prop.Values[0] && Array.isArray(prop.Values[0].Type)) {
|
|
235
|
+
const propType = prop.Values[0].Type;
|
|
236
|
+
if (typeof propType[0].Value === 'string') {
|
|
237
|
+
finalType = `List<${parseType(propType[0]).type}>`;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* special cases for which we don't have proper type handling yet
|
|
243
|
+
*/
|
|
244
|
+
if (type === 'Unknown') {
|
|
245
|
+
// Apply special case overrides for common property names
|
|
246
|
+
if (property.Name === 'capabilities') {
|
|
247
|
+
finalType = 'Capabilities';
|
|
248
|
+
}
|
|
249
|
+
else if (property.Name === 'value' &&
|
|
250
|
+
(assignment.Name.includes('Accessibility') || assignment.Name.includes('Element'))) {
|
|
251
|
+
finalType = 'AccessibilityValue';
|
|
252
|
+
}
|
|
253
|
+
else if (property.Name === 'value' && assignment.Name.includes('Context')) {
|
|
254
|
+
finalType = 'ContextValue';
|
|
255
|
+
}
|
|
256
|
+
else if (property.Name === 'attributes') {
|
|
257
|
+
finalType = 'Map<String, String>';
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
/* c8 ignore next */ throw new Error(`Unknown property: ${property.Name}`);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
props.set(parsePropertyName(property.Name), { type: finalType, isLiteral });
|
|
264
|
+
}
|
|
265
|
+
if (props.size > 0) {
|
|
266
|
+
let code = '';
|
|
267
|
+
if (!javaPropFiles.has(mapKey)) {
|
|
268
|
+
const implementsExtension = allGroupEnums.find(({ name, enums }) => name && enums.includes(`${scopeCamelCase.toLowerCase()}.${propClassName}`));
|
|
269
|
+
code += `package org.openqa.selenium.bidirectional.${scopeCamelCase.toLowerCase()};
|
|
270
|
+
|
|
271
|
+
import java.util.Map;
|
|
272
|
+
import java.util.HashMap;
|
|
273
|
+
import java.util.List;
|
|
274
|
+
import java.util.ArrayList;
|
|
275
|
+
import org.openqa.selenium.bidirectional.*;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Auto-generated class for WebDriver BiDi protocol
|
|
279
|
+
* Represents parameters for ${assignment.Name} command
|
|
280
|
+
*/
|
|
281
|
+
public class ${propClassName}${implementsExtension ? ` implements ${implementsExtension.name.includes('.') ? implementsExtension.name.split('.')[1] : implementsExtension.name}` : ''} {
|
|
282
|
+
`;
|
|
283
|
+
}
|
|
284
|
+
const assignableProps = Array.from(props.entries()).filter(([_, { isLiteral }]) => !isLiteral);
|
|
285
|
+
const literalProps = Array.from(props.entries()).filter(([_, { isLiteral }]) => isLiteral);
|
|
286
|
+
// Add constructor
|
|
287
|
+
const assignablePropsCode = assignableProps.length > 0
|
|
288
|
+
? `
|
|
289
|
+
` + assignableProps.map(([prop]) => `this.${prop} = ${prop};`).join(`
|
|
290
|
+
`)
|
|
291
|
+
: '';
|
|
292
|
+
const literalPropsCode = literalProps.length > 0
|
|
293
|
+
? `
|
|
294
|
+
` + literalProps.map(([prop, { type }]) => `this.${prop} = "${type}";`).join(`
|
|
295
|
+
`)
|
|
296
|
+
: '';
|
|
297
|
+
code += `
|
|
298
|
+
/**
|
|
299
|
+
* Creates a new ${propClassName} instance
|
|
300
|
+
*/
|
|
301
|
+
public ${propClassName}(${assignableProps.map(([prop, { type }]) => `${type} ${prop}`).join(', ')}) {${assignablePropsCode + literalPropsCode}
|
|
302
|
+
}
|
|
303
|
+
`;
|
|
304
|
+
// Add properties and getters
|
|
305
|
+
for (const [prop, { type, isLiteral }] of props.entries()) {
|
|
306
|
+
const propName = parsePropertyName(prop);
|
|
307
|
+
const propNameCamelCase = propName[0].toUpperCase() + propName.slice(1);
|
|
308
|
+
// Use String type for literals
|
|
309
|
+
const javaType = isLiteral ? 'String' : type;
|
|
310
|
+
code += `
|
|
311
|
+
private final ${javaType} ${prop};
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Gets the ${prop} property
|
|
315
|
+
* @return ${javaType} value
|
|
316
|
+
*/
|
|
317
|
+
public ${javaType} get${propNameCamelCase}() {
|
|
318
|
+
return this.${prop};
|
|
319
|
+
}
|
|
320
|
+
`;
|
|
321
|
+
}
|
|
322
|
+
// Add asMap method for command parameters
|
|
323
|
+
code += `
|
|
324
|
+
/**
|
|
325
|
+
* Converts this object to a map for use with BiDi protocol
|
|
326
|
+
* @return Map representation of this object
|
|
327
|
+
*/
|
|
328
|
+
public Map<String, Object> asMap() {
|
|
329
|
+
Map<String, Object> toReturn = new HashMap<>();
|
|
330
|
+
${Array.from(props.entries()).map(([prop]) => `toReturn.put("${parsePropertyName(prop)}", this.${prop});`).join(`
|
|
331
|
+
`)}
|
|
332
|
+
return toReturn;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
}`;
|
|
336
|
+
javaPropFiles.set(mapKey, code);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
else if (assignment.Type === 'variable') {
|
|
340
|
+
const propType = assignment.PropertyType;
|
|
341
|
+
/**
|
|
342
|
+
* handle group enums like
|
|
343
|
+
* {
|
|
344
|
+
* Type: 'variable',
|
|
345
|
+
* Name: 'input.WheelSourceAction',
|
|
346
|
+
* IsChoiceAddition: false,
|
|
347
|
+
* PropertyType: [
|
|
348
|
+
* { Type: 'group', Value: 'input.PauseAction', Unwrapped: false },
|
|
349
|
+
* { Type: 'group', Value: 'input.WheelScrollAction', Unwrapped: false }
|
|
350
|
+
* ],
|
|
351
|
+
* Comments: []
|
|
352
|
+
* }
|
|
353
|
+
*/
|
|
354
|
+
if (propType.every((p) => p.Type === 'group')) {
|
|
355
|
+
const enumClasses = propType.map((p) => p.Value);
|
|
356
|
+
const [module, prop] = assignment.Name.split('.');
|
|
357
|
+
let code = ('/**\n' +
|
|
358
|
+
` * Auto-generated class for WebDriver BiDi protocol\n` +
|
|
359
|
+
` * Represents enum for ${assignment.Name} which can be either of these classes:\n` +
|
|
360
|
+
` * - ${enumClasses.join('\n * - ')}\n` +
|
|
361
|
+
` */\n` +
|
|
362
|
+
`public class ${prop} {\n\n}`);
|
|
363
|
+
javaPropFiles.set([pascalCase(module), prop], code);
|
|
364
|
+
}
|
|
365
|
+
else
|
|
366
|
+
/**
|
|
367
|
+
* handle literal enums like
|
|
368
|
+
* {
|
|
369
|
+
* Type: 'variable',
|
|
370
|
+
* Name: 'input.PointerType',
|
|
371
|
+
* IsChoiceAddition: false,
|
|
372
|
+
* PropertyType: [
|
|
373
|
+
* { Type: 'literal', Value: 'mouse', Unwrapped: false },
|
|
374
|
+
* { Type: 'literal', Value: 'pen', Unwrapped: false },
|
|
375
|
+
* { Type: 'literal', Value: 'touch', Unwrapped: false }
|
|
376
|
+
* ],
|
|
377
|
+
* Comments: []
|
|
378
|
+
* }
|
|
379
|
+
*/
|
|
380
|
+
if (propType.every((p) => p.Type === 'literal' || p.Type === 'group')) {
|
|
381
|
+
const [module, prop] = assignment.Name.split('.');
|
|
382
|
+
const enumValues = propType.map((p) => {
|
|
383
|
+
if (p.Type === 'group') {
|
|
384
|
+
const [mod, prop] = p.Value.split('.');
|
|
385
|
+
return `${mod.slice(0, 1).toUpperCase() + mod.slice(1)}.${prop}`;
|
|
386
|
+
}
|
|
387
|
+
return p.Value;
|
|
388
|
+
});
|
|
389
|
+
const code = getEnumTemplate(prop, enumValues);
|
|
390
|
+
javaPropFiles.set([pascalCase(module), prop], code);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return javaPropFiles;
|
|
395
|
+
}
|
|
396
|
+
function parsePropertyName(name) {
|
|
397
|
+
/**
|
|
398
|
+
* avoid having assignments with reserved words
|
|
399
|
+
*/
|
|
400
|
+
if (name === 'this') {
|
|
401
|
+
return 'self';
|
|
402
|
+
}
|
|
403
|
+
if (name === 'self') {
|
|
404
|
+
return 'this';
|
|
405
|
+
}
|
|
406
|
+
return name;
|
|
407
|
+
}
|
|
408
|
+
function parseType(specType) {
|
|
409
|
+
let type = 'Unknown';
|
|
410
|
+
let isLiteral = false;
|
|
411
|
+
// Handle complex single object with Type field (not in an array)
|
|
412
|
+
if (!Array.isArray(specType) && typeof specType === 'object' && 'Type' in specType) {
|
|
413
|
+
specType = [specType];
|
|
414
|
+
}
|
|
415
|
+
// Handle single value types
|
|
416
|
+
if (specType.length === 1) {
|
|
417
|
+
// Handle primitive types
|
|
418
|
+
if (specType[0] === 'bool') {
|
|
419
|
+
return { type: 'Boolean', isLiteral: false };
|
|
420
|
+
}
|
|
421
|
+
else if (specType[0] === 'float') {
|
|
422
|
+
return { type: 'Float', isLiteral: false };
|
|
423
|
+
}
|
|
424
|
+
else if ((specType[0] === 'string' || specType[0] === 'text')) {
|
|
425
|
+
return { type: 'String', isLiteral: false };
|
|
426
|
+
}
|
|
427
|
+
else if (specType[0] === 'null' || specType[0] === 'any') {
|
|
428
|
+
return { type: 'Object', isLiteral: false }; // null/any represented as Object in Java
|
|
429
|
+
}
|
|
430
|
+
else if (typeof specType[0] === 'object') {
|
|
431
|
+
// Handle various object types
|
|
432
|
+
if ('Type' in specType[0]) {
|
|
433
|
+
const objType = specType[0].Type;
|
|
434
|
+
if (objType === 'group') {
|
|
435
|
+
if ('Value' in specType[0] && typeof specType[0].Value === 'string') {
|
|
436
|
+
// Special types
|
|
437
|
+
const value = specType[0].Value;
|
|
438
|
+
// Numeric types
|
|
439
|
+
if (value === 'js-int') {
|
|
440
|
+
return { type: 'Integer', isLiteral: false };
|
|
441
|
+
}
|
|
442
|
+
else if (value === 'js-uint') {
|
|
443
|
+
return { type: 'Long', isLiteral: false };
|
|
444
|
+
}
|
|
445
|
+
// Special case known types
|
|
446
|
+
const knownTypes = {
|
|
447
|
+
'session.Capabilities': 'Session.Capabilities',
|
|
448
|
+
'Capabilities': 'Capabilities',
|
|
449
|
+
'session.Subscription': 'String',
|
|
450
|
+
'browsingContext.BrowsingContext': 'String',
|
|
451
|
+
'browser.UserContext': 'String',
|
|
452
|
+
'browser.ClientWindow': 'String'
|
|
453
|
+
};
|
|
454
|
+
if (value in knownTypes) {
|
|
455
|
+
return { type: knownTypes[value], isLiteral: false };
|
|
456
|
+
}
|
|
457
|
+
if (stringTypes.includes(value)) {
|
|
458
|
+
return { type: 'String', isLiteral: false };
|
|
459
|
+
}
|
|
460
|
+
// Reference to another type - keep proper casing
|
|
461
|
+
const parts = value.split('.');
|
|
462
|
+
if (parts.length > 1) {
|
|
463
|
+
// Handle scoped types (e.g., 'session.Subscription')
|
|
464
|
+
const scope = parts[0][0].toUpperCase() + parts[0].slice(1);
|
|
465
|
+
const typeName = parts[1][0].toUpperCase() + parts[1].slice(1);
|
|
466
|
+
return { type: `${scope}.${typeName}`, isLiteral: false };
|
|
467
|
+
}
|
|
468
|
+
/* c8 ignore next */ throw new Error(`Unknown type: ${value}`);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
else if (objType === 'float') {
|
|
472
|
+
return { type: 'Float', isLiteral: false };
|
|
473
|
+
}
|
|
474
|
+
else if (objType === 'range') {
|
|
475
|
+
// For range types, determine integer vs float
|
|
476
|
+
if (specType[0].Value && typeof specType[0].Value === 'object' &&
|
|
477
|
+
specType[0].Value.Min && specType[0].Value.Min.Value !== undefined) {
|
|
478
|
+
const minVal = specType[0].Value.Min.Value;
|
|
479
|
+
return { type: Number.isInteger(minVal) ? 'Integer' : 'Float', isLiteral: false };
|
|
480
|
+
}
|
|
481
|
+
/* c8 ignore next */ throw new Error(`Unknown type: ${JSON.stringify(specType[0].Value)}`);
|
|
482
|
+
}
|
|
483
|
+
else if (objType === 'literal' && 'Value' in specType[0] && specType[0].Value !== undefined) {
|
|
484
|
+
return { type: specType[0].Value, isLiteral: true };
|
|
485
|
+
}
|
|
486
|
+
else if (Array.isArray(specType[0].Values)) {
|
|
487
|
+
const propType = specType[0].Values[0];
|
|
488
|
+
if (propType.Type && Array.isArray(propType.Type) && propType.Type.length === 1) {
|
|
489
|
+
const subType = parseType(propType.Type[0]);
|
|
490
|
+
return { type: `List<${subType.type}>`, isLiteral: false };
|
|
491
|
+
}
|
|
492
|
+
return { type: 'List<String>', isLiteral: false };
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
// Handle type with operator (default values)
|
|
496
|
+
if ('Operator' in specType[0] && specType[0].Operator) {
|
|
497
|
+
// Handle boolean with default
|
|
498
|
+
if (specType[0].Type === 'bool') {
|
|
499
|
+
return { type: 'Boolean', isLiteral: false };
|
|
500
|
+
}
|
|
501
|
+
// Handle complex types with operators
|
|
502
|
+
if (typeof specType[0].Type === 'object' && 'Type' in specType[0].Type) {
|
|
503
|
+
if (specType[0].Type.Type === 'range') {
|
|
504
|
+
return { type: 'Float', isLiteral: false };
|
|
505
|
+
}
|
|
506
|
+
else if (specType[0].Type.Type === 'group' && 'Value' in specType[0].Type) {
|
|
507
|
+
if (specType[0].Type.Value === 'js-uint') {
|
|
508
|
+
return { type: 'Long', isLiteral: false };
|
|
509
|
+
}
|
|
510
|
+
// For other group references
|
|
511
|
+
const parts = specType[0].Type.Value.split('.');
|
|
512
|
+
if (parts.length > 1) {
|
|
513
|
+
const scope = parts[0][0].toUpperCase() + parts[0].slice(1);
|
|
514
|
+
const typeName = parts[1][0].toUpperCase() + parts[1].slice(1);
|
|
515
|
+
return { type: `${scope}.${typeName}`, isLiteral: false };
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
/* c8 ignore next */ throw new Error(`Unknown operator: ${JSON.stringify(specType[0].Operator)}`);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
else {
|
|
524
|
+
// Multiple types represent a union - use Object for unions
|
|
525
|
+
return { type: 'Object', isLiteral: false };
|
|
526
|
+
}
|
|
527
|
+
return { type, isLiteral };
|
|
528
|
+
}
|
|
529
|
+
async function createJavaFiles(javaFiles, outputDir) {
|
|
530
|
+
for (const [[moduleScope, moduleName], code] of javaFiles.entries()) {
|
|
531
|
+
const rootDir = path.join(outputDir, moduleScope);
|
|
532
|
+
await fs.mkdir(rootDir, { recursive: true });
|
|
533
|
+
await writeFile(path.resolve(rootDir, `${moduleName}.java`), code);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
async function createResultClasses(assignments) {
|
|
537
|
+
const javaResultFiles = new Map();
|
|
538
|
+
for (const assignment of assignments) {
|
|
539
|
+
/**
|
|
540
|
+
* only create result classes for result types
|
|
541
|
+
*/
|
|
542
|
+
if (!assignment.Name.includes('Result')) {
|
|
543
|
+
continue;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* skip empty result
|
|
547
|
+
*/
|
|
548
|
+
if (assignment.Name === 'EmptyResult') {
|
|
549
|
+
continue;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* some results have no scope, skip them
|
|
553
|
+
*/
|
|
554
|
+
if (!assignment.Name.includes('.')) {
|
|
555
|
+
continue;
|
|
556
|
+
}
|
|
557
|
+
const [scope, resultName] = assignment.Name.split('.');
|
|
558
|
+
const scopeCamelCase = scope[0].toUpperCase() + scope.slice(1);
|
|
559
|
+
const resultClassName = resultName[0].toUpperCase() + resultName.slice(1);
|
|
560
|
+
const mapKey = [scopeCamelCase, resultClassName];
|
|
561
|
+
// Special case for session.NewResult - skip and handle separately
|
|
562
|
+
if (assignment.Name === 'session.NewResult') {
|
|
563
|
+
javaResultFiles.set(mapKey, newResultTemplate);
|
|
564
|
+
continue;
|
|
565
|
+
}
|
|
566
|
+
const props = new Map();
|
|
567
|
+
if ('Properties' in assignment && assignment.Properties) {
|
|
568
|
+
for (const property of assignment.Properties) {
|
|
569
|
+
const { type, isLiteral } = parseType(property.Type);
|
|
570
|
+
props.set(parsePropertyName(property.Name), { type, isLiteral });
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
let code = `package org.openqa.selenium.bidirectional.${scopeCamelCase.toLowerCase()};
|
|
574
|
+
|
|
575
|
+
import java.util.Map;
|
|
576
|
+
import java.util.HashMap;
|
|
577
|
+
import java.util.List;
|
|
578
|
+
import java.util.ArrayList;
|
|
579
|
+
import org.openqa.selenium.bidirectional.EmptyResult;
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Auto-generated class for WebDriver BiDi protocol
|
|
583
|
+
* Represents response for ${assignment.Name} command
|
|
584
|
+
*/
|
|
585
|
+
public class ${resultClassName} {
|
|
586
|
+
`;
|
|
587
|
+
if (props.size > 0) {
|
|
588
|
+
// Add constructor
|
|
589
|
+
code += `
|
|
590
|
+
/**
|
|
591
|
+
* Creates a new ${resultClassName} instance
|
|
592
|
+
*/
|
|
593
|
+
public ${resultClassName}(${Array.from(props.entries()).map(([prop, { type }]) => `${type} ${prop}`).join(', ')}) {
|
|
594
|
+
${Array.from(props.entries()).map(([prop]) => `this.${prop} = ${prop};`).join(`
|
|
595
|
+
`)}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
`;
|
|
599
|
+
// Add properties and getters
|
|
600
|
+
for (const [prop, { type }] of props.entries()) {
|
|
601
|
+
const propNameCamelCase = prop[0].toUpperCase() + prop.slice(1);
|
|
602
|
+
code += `
|
|
603
|
+
private final ${type} ${prop};
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Gets the ${prop} property
|
|
607
|
+
* @return ${type} value
|
|
608
|
+
*/
|
|
609
|
+
public ${type} get${propNameCamelCase}() {
|
|
610
|
+
return this.${prop};
|
|
611
|
+
}
|
|
612
|
+
`;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
// Empty constructor for classes without properties
|
|
617
|
+
code += `
|
|
618
|
+
/**
|
|
619
|
+
* Creates a new ${resultClassName} instance
|
|
620
|
+
*/
|
|
621
|
+
public ${resultClassName}() {
|
|
622
|
+
// No properties to initialize
|
|
623
|
+
}
|
|
624
|
+
`;
|
|
625
|
+
}
|
|
626
|
+
javaResultFiles.set(mapKey, code);
|
|
627
|
+
}
|
|
628
|
+
return javaResultFiles;
|
|
629
|
+
}
|
|
630
|
+
async function createEmptyResultClass(outputDir) {
|
|
631
|
+
await fs.mkdir(path.join(outputDir), { recursive: true });
|
|
632
|
+
await writeFile(path.resolve(outputDir, 'EmptyResult.java'), emptyResultTemplate);
|
|
633
|
+
}
|
|
634
|
+
async function createHelperClasses(outputDir) {
|
|
635
|
+
// Create directories and write files
|
|
636
|
+
await writeFile(path.resolve(outputDir, 'ContextValue.java'), contextValueTemplate);
|
|
637
|
+
await writeFile(path.resolve(outputDir, 'AccessibilityValue.java'), accessibilityValueTemplate);
|
|
638
|
+
await fs.mkdir(path.join(outputDir, 'Session'), { recursive: true });
|
|
639
|
+
await writeFile(path.resolve(outputDir, 'Session/Capabilities.java'), capabilitiesTemplate);
|
|
640
|
+
}
|
|
641
|
+
export async function transform(cddlFilePath, outputDir) {
|
|
642
|
+
const ast = parseCDDLFile(cddlFilePath);
|
|
643
|
+
const [moduleCode, propertyCode, resultCode] = await Promise.all([
|
|
644
|
+
createModules(ast),
|
|
645
|
+
createPropertyClasses(ast),
|
|
646
|
+
createResultClasses(ast)
|
|
647
|
+
]);
|
|
648
|
+
await fs.mkdir(outputDir, { recursive: true });
|
|
649
|
+
await Promise.all([
|
|
650
|
+
createJavaFiles(moduleCode, outputDir),
|
|
651
|
+
createJavaFiles(propertyCode, outputDir),
|
|
652
|
+
createJavaFiles(resultCode, outputDir),
|
|
653
|
+
createEmptyResultClass(outputDir),
|
|
654
|
+
createHelperClasses(outputDir)
|
|
655
|
+
]);
|
|
656
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Java code templates for WebDriver BiDi Java code generation
|
|
3
|
+
*/
|
|
4
|
+
export declare const emptyResultTemplate: string;
|
|
5
|
+
export declare const contextValueTemplate: string;
|
|
6
|
+
export declare const accessibilityValueTemplate: string;
|
|
7
|
+
export declare const getEnumTemplate: (name: string, enums: string[]) => string;
|
|
8
|
+
export declare const capabilitiesTemplate: string;
|
|
9
|
+
export declare const newResultTemplate: string;
|
|
10
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,mBAAmB,EAAE,MAajC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,MA8CjC,CAAC;AAEH,eAAO,MAAM,0BAA0B,EAAE,MA8DvC,CAAC;AAEH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,EAAE,WAoC5D,CAAA;AAED,eAAO,MAAM,oBAAoB,EAAE,MA8CjC,CAAC;AAEH,eAAO,MAAM,iBAAiB,EAAE,MAwC9B,CAAC"}
|