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
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Java code templates for WebDriver BiDi Java code generation
|
|
3
|
+
*/
|
|
4
|
+
export const emptyResultTemplate = `package org.openqa.selenium.bidirectional;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents an empty result from a WebDriver BiDi command
|
|
8
|
+
*/
|
|
9
|
+
public class EmptyResult {
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new EmptyResult instance
|
|
12
|
+
*/
|
|
13
|
+
public EmptyResult() {
|
|
14
|
+
// Empty result has no properties
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
export const contextValueTemplate = `package org.openqa.selenium.bidirectional;
|
|
19
|
+
|
|
20
|
+
import java.util.Map;
|
|
21
|
+
import java.util.HashMap;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Represents a value with context in WebDriver BiDi protocol
|
|
25
|
+
*/
|
|
26
|
+
public class ContextValue {
|
|
27
|
+
private final String context;
|
|
28
|
+
private final Map<String, Object> additionalProperties = new HashMap<>();
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new ContextValue instance
|
|
32
|
+
* @param context The context ID (typically a browsing context ID)
|
|
33
|
+
*/
|
|
34
|
+
public ContextValue(String context) {
|
|
35
|
+
this.context = context;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Gets the context property
|
|
40
|
+
* @return Context ID value
|
|
41
|
+
*/
|
|
42
|
+
public String getContext() {
|
|
43
|
+
return context;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Adds an additional property to this value
|
|
48
|
+
* @param key Property name
|
|
49
|
+
* @param value Property value
|
|
50
|
+
*/
|
|
51
|
+
public void addProperty(String key, Object value) {
|
|
52
|
+
additionalProperties.put(key, value);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Converts this object to a map for use with BiDi protocol
|
|
57
|
+
* @return Map representation of this object
|
|
58
|
+
*/
|
|
59
|
+
public Map<String, Object> asMap() {
|
|
60
|
+
Map<String, Object> result = new HashMap<>(additionalProperties);
|
|
61
|
+
result.put("context", context);
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
}`;
|
|
65
|
+
export const accessibilityValueTemplate = `package org.openqa.selenium.bidirectional;
|
|
66
|
+
|
|
67
|
+
import java.util.Map;
|
|
68
|
+
import java.util.HashMap;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Represents a value with accessibility properties in WebDriver BiDi protocol
|
|
72
|
+
*/
|
|
73
|
+
public class AccessibilityValue {
|
|
74
|
+
private final String name;
|
|
75
|
+
private final String role;
|
|
76
|
+
private final Map<String, Object> additionalProperties = new HashMap<>();
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Creates a new AccessibilityValue instance
|
|
80
|
+
* @param name The accessible name
|
|
81
|
+
* @param role The accessible role
|
|
82
|
+
*/
|
|
83
|
+
public AccessibilityValue(String name, String role) {
|
|
84
|
+
this.name = name;
|
|
85
|
+
this.role = role;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Gets the name property
|
|
90
|
+
* @return Name value
|
|
91
|
+
*/
|
|
92
|
+
public String getName() {
|
|
93
|
+
return name;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Gets the role property
|
|
98
|
+
* @return Role value
|
|
99
|
+
*/
|
|
100
|
+
public String getRole() {
|
|
101
|
+
return role;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Adds an additional property to this value
|
|
106
|
+
* @param key Property name
|
|
107
|
+
* @param value Property value
|
|
108
|
+
*/
|
|
109
|
+
public void addProperty(String key, Object value) {
|
|
110
|
+
additionalProperties.put(key, value);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Converts this object to a map for use with BiDi protocol
|
|
115
|
+
* @return Map representation of this object
|
|
116
|
+
*/
|
|
117
|
+
public Map<String, Object> asMap() {
|
|
118
|
+
Map<String, Object> result = new HashMap<>(additionalProperties);
|
|
119
|
+
if (name != null) {
|
|
120
|
+
result.put("name", name);
|
|
121
|
+
}
|
|
122
|
+
if (role != null) {
|
|
123
|
+
result.put("role", role);
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
}`;
|
|
128
|
+
export const getEnumTemplate = (name, enums) => {
|
|
129
|
+
return `/**
|
|
130
|
+
* Represents ${name} in WebDriver BiDi protocol
|
|
131
|
+
* as enum of "${enums.join('" / "')}"
|
|
132
|
+
*/
|
|
133
|
+
public enum ${name} {
|
|
134
|
+
${enums.map((e) => {
|
|
135
|
+
if (e.includes('.')) {
|
|
136
|
+
const [, prop] = e.split('.');
|
|
137
|
+
return `${prop.toUpperCase()}(${prop}.class);`;
|
|
138
|
+
}
|
|
139
|
+
if (e.startsWith('-')) {
|
|
140
|
+
return `NEGATIVE_${e.slice(1).toUpperCase()}("${e}");`;
|
|
141
|
+
}
|
|
142
|
+
return `${e.toUpperCase()}("${e}");`;
|
|
143
|
+
}).join('\n ')}
|
|
144
|
+
|
|
145
|
+
private final String value;
|
|
146
|
+
|
|
147
|
+
${name}(String value) {
|
|
148
|
+
this.value = value;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
public String getValue() {
|
|
152
|
+
return value;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
public static ${name} fromString(String text) {
|
|
156
|
+
for (${name} ${name.toLowerCase()} : ${name}.values()) {
|
|
157
|
+
if (${name.toLowerCase()}.value.equalsIgnoreCase(text)) {
|
|
158
|
+
return ${name.toLowerCase()};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
throw new IllegalArgumentException("No ${name} with value: " + text);
|
|
162
|
+
}
|
|
163
|
+
}`;
|
|
164
|
+
};
|
|
165
|
+
export const capabilitiesTemplate = `package org.openqa.selenium.bidirectional.session;
|
|
166
|
+
|
|
167
|
+
import java.util.Map;
|
|
168
|
+
import java.util.HashMap;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Represents browser capabilities in WebDriver BiDi protocol
|
|
172
|
+
*/
|
|
173
|
+
public class Capabilities {
|
|
174
|
+
private final Map<String, Object> capabilities;
|
|
175
|
+
|
|
176
|
+
public Capabilities(Map<String, Object> capabilities) {
|
|
177
|
+
this.capabilities = capabilities != null ? capabilities : new HashMap<>();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
public Boolean getAcceptInsecureCerts() {
|
|
181
|
+
return (Boolean) capabilities.get("acceptInsecureCerts");
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
public String getBrowserName() {
|
|
185
|
+
return (String) capabilities.get("browserName");
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
public String getBrowserVersion() {
|
|
189
|
+
return (String) capabilities.get("browserVersion");
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
public String getPlatformName() {
|
|
193
|
+
return (String) capabilities.get("platformName");
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
public Boolean getSetWindowRect() {
|
|
197
|
+
return (Boolean) capabilities.get("setWindowRect");
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
public String getUserAgent() {
|
|
201
|
+
return (String) capabilities.get("userAgent");
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
public String getWebSocketUrl() {
|
|
205
|
+
return (String) capabilities.get("webSocketUrl");
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
public Map<String, Object> asMap() {
|
|
209
|
+
return new HashMap<>(capabilities);
|
|
210
|
+
}
|
|
211
|
+
}`;
|
|
212
|
+
export const newResultTemplate = `package org.openqa.selenium.bidirectional.session;
|
|
213
|
+
|
|
214
|
+
import java.util.Map;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Result for session.New command.
|
|
218
|
+
* Auto-generated from the CDDL specification.
|
|
219
|
+
*/
|
|
220
|
+
public class NewResult {
|
|
221
|
+
private final String sessionId;
|
|
222
|
+
private final Capabilities capabilities;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Constructor for NewResult.
|
|
226
|
+
*
|
|
227
|
+
* @param sessionId The session ID
|
|
228
|
+
* @param capabilities The capabilities map
|
|
229
|
+
*/
|
|
230
|
+
public NewResult(String sessionId, Map<String, Object> capabilities) {
|
|
231
|
+
this.sessionId = sessionId;
|
|
232
|
+
this.capabilities = new Capabilities(capabilities);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Get the session ID.
|
|
237
|
+
*
|
|
238
|
+
* @return The session ID
|
|
239
|
+
*/
|
|
240
|
+
public String getSessionId() {
|
|
241
|
+
return sessionId;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Get the capabilities.
|
|
246
|
+
*
|
|
247
|
+
* @return The capabilities
|
|
248
|
+
*/
|
|
249
|
+
public Capabilities getCapabilities() {
|
|
250
|
+
return capabilities;
|
|
251
|
+
}
|
|
252
|
+
}`;
|
package/build/utils.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* write generated ts file so it
|
|
3
|
+
* - passes our eslint rules (no crlf)
|
|
4
|
+
* - and has a note at the top that the file is generated
|
|
5
|
+
*
|
|
6
|
+
* @param filePath path to file to write
|
|
7
|
+
* @param content content of file
|
|
8
|
+
*/
|
|
9
|
+
export declare function writeFile(filePath: string, content: string): Promise<void>;
|
|
10
|
+
export declare function pascalCase(name: string): string;
|
|
11
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,iBAKjE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,UAEtC"}
|
package/build/utils.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import { GENERATED_FILE_COMMENT } from './constants.js';
|
|
3
|
+
import camelcase from 'camelcase';
|
|
4
|
+
/**
|
|
5
|
+
* write generated ts file so it
|
|
6
|
+
* - passes our eslint rules (no crlf)
|
|
7
|
+
* - and has a note at the top that the file is generated
|
|
8
|
+
*
|
|
9
|
+
* @param filePath path to file to write
|
|
10
|
+
* @param content content of file
|
|
11
|
+
*/
|
|
12
|
+
export async function writeFile(filePath, content) {
|
|
13
|
+
return fs.writeFile(filePath, GENERATED_FILE_COMMENT + '\n\n' + content.replace(/\r\n/g, '\n'));
|
|
14
|
+
}
|
|
15
|
+
export function pascalCase(name) {
|
|
16
|
+
return camelcase(name, { pascalCase: true });
|
|
17
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cddl2java",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "A Node.js package that can generates Java classes based on a CDDL file",
|
|
5
|
+
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/webdriverio/cddl/blob/main/packages/cddl2java/README.md",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+ssh://git@github.com/webdriverio/cddl.git"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"cddl",
|
|
14
|
+
"typescript",
|
|
15
|
+
"java"
|
|
16
|
+
],
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/webdriverio/cddl/issues"
|
|
19
|
+
},
|
|
20
|
+
"type": "module",
|
|
21
|
+
"exports": "./build/index.js",
|
|
22
|
+
"types": "./build/index.d.ts",
|
|
23
|
+
"bin": {
|
|
24
|
+
"cddl2java": "./bin/cddl2java.js"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"release": "release-it --config .release-it.ts --VV",
|
|
28
|
+
"release:ci": "pnpm release --ci --npm.skipChecks"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/yargs": "^17.0.35",
|
|
32
|
+
"@types/node": "^25.5.0"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@babel/parser": "^7.29.0",
|
|
36
|
+
"camelcase": "^9.0.0",
|
|
37
|
+
"cddl": "workspace:*",
|
|
38
|
+
"recast": "^0.23.11",
|
|
39
|
+
"yargs": "^18.0.0"
|
|
40
|
+
}
|
|
41
|
+
}
|
package/src/cli.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import fs from 'node:fs/promises'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
|
|
4
|
+
import { transform } from './index.js'
|
|
5
|
+
import { pkg } from './constants.js'
|
|
6
|
+
|
|
7
|
+
const HELP = `
|
|
8
|
+
${pkg.name}
|
|
9
|
+
${pkg.description}
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
runme2java ./path/to/spec.cddl &> ./outputDir
|
|
13
|
+
|
|
14
|
+
v${pkg.version}
|
|
15
|
+
Copyright ${(new Date()).getFullYear()} ${pkg.author}
|
|
16
|
+
`
|
|
17
|
+
|
|
18
|
+
export default async function cli (args = process.argv.slice(2)) {
|
|
19
|
+
if (args.includes('--help') || args.length === 0) {
|
|
20
|
+
console.log(HELP);
|
|
21
|
+
return process.exit(0)
|
|
22
|
+
}
|
|
23
|
+
if (args.includes('--version') || args.includes('-v')) {
|
|
24
|
+
console.log(pkg.version);
|
|
25
|
+
return process.exit(0)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const cddlFilePath = path.isAbsolute(args[0]) ? args[0] : path.resolve(process.cwd(), args[0])
|
|
29
|
+
const hasAccess = await fs.access(cddlFilePath).then(() => true, () => false)
|
|
30
|
+
if (!hasAccess) {
|
|
31
|
+
console.error(`Couldn't find or access source CDDL file at "${cddlFilePath}"`)
|
|
32
|
+
return process.exit(1)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const outputDir = path.isAbsolute(args[1]) ? args[1] : path.resolve(process.cwd(), args[1])
|
|
36
|
+
const hasAccessOutputDir = await fs.access(outputDir).then(() => true, () => false)
|
|
37
|
+
if (!hasAccessOutputDir) {
|
|
38
|
+
await fs.mkdir(outputDir, { recursive: true })
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return transform(cddlFilePath, outputDir)
|
|
42
|
+
}
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import fs from 'node:fs/promises'
|
|
2
|
+
import url from 'node:url'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
|
|
5
|
+
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
|
|
6
|
+
export const pkg = JSON.parse(await fs.readFile(path.join(__dirname, '..', 'package.json'), 'utf-8'))
|
|
7
|
+
|
|
8
|
+
export const GENERATED_FILE_COMMENT = `/**
|
|
9
|
+
* !!! PLEASE DO NOT EDIT THIS FILE !!!
|
|
10
|
+
*
|
|
11
|
+
* This source file, even though checked in, is auto-generated based on the
|
|
12
|
+
* current development within the WebDriver Bidi spec. Any changes to this
|
|
13
|
+
* file need to come from the specification.
|
|
14
|
+
*/`
|
|
15
|
+
|
|
16
|
+
export const CDDL_PARSE_ERROR_MESSAGE = `
|
|
17
|
+
====================
|
|
18
|
+
CDDL PARSING FAILED!
|
|
19
|
+
====================
|
|
20
|
+
|
|
21
|
+
No updates to the CDDL interface can be applied as the script failed to parse
|
|
22
|
+
the spec CDDL due to the following error:
|
|
23
|
+
|
|
24
|
+
%s
|
|
25
|
+
`
|