Repository navigation
First stable release of AWS CDK Blocks for Kotlin.
Breaking
- The Gradle plugin's extension, tasks and types are renamed from
AwsBlocksto
CdkBlocks: configure it withcdkBlocks { }, and the codegen tasks are
cdkBlocksCodegen<Variant>andcdkBlocksDumpModel. Inside the extension,
oidc { redirectUrl }is renamedrelayTo, matching the backend's
allowedRelayOrigins. - The generated
Api(server: BlocksServer = Servers.local)constructor is gone. Build a
Blocksinstance and take the API from it:Api()becomesBlocks().api, and
Api(server = s)becomesBlocks(s).api. OneBlocksserves every API over a single
HTTP engine, so keep the instance andclose()it when done. - One error taxonomy, shared with the Swift and Dart clients: every exception extends
BlocksException. Transport failures areTransportException(was
NetworkException).ApiExceptionreplacescodeanddatawithstatus,name
andretriable— match errors bynamewith the newisBlocksError.
TransferableIOExceptionis nowFileTransferException. A JSON-RPC error arriving
with a non-2xx HTTP status throws the sameApiExceptionas one arriving with
HTTP 200. - Each API namespace is called at its own path,
{url}/{namespace}, instead of the
shared/cdk-blocks/api. Deploy the backend with@aws-blocks/core0.8.0 or later,
or any@aws-cdk-blocks/core, before shipping an app built with this version: an
older backend serves only the shared path and rejects the per-namespace one. A proxy
in front of the API must forward the whole/cdk-blocks/api/*subtree. - Generated clients and the codegen defaults use the
/cdk-blocks/apiand
/cdk-blocks/auth/*paths. A server URL still configured with/aws-blocks/apikeeps
working; a bare origin does not, so append/cdk-blocks/apito aservers {}override
such aslocal("http://10.0.2.2:3001"). Aservers {}URL that reaches no RPC is
rejected, and the unusedx-blocks-endpointspec key is dropped. - Unions and string enums that a response can carry are open: an arm or value a newer
backend adds decodes to an unknown variant instead of throwing
SerializationException, so an exhaustivewhenneeds that branch. Such an enum is
now a sealed class rather than a Kotlinenum class: usevalueandfromValuein
place ofnameandvalueOf, andentriesin place ofvalues().ordinal,
EnumSetand comparisons no longer apply. - On the JVM, set
BlocksConfig.applicationIdto keep the session across restarts.
0.2.0 always persisted to~/.blocks; without anapplicationIdthe session is now
held in memory and is gone when the process exits, with no error. The cookie jar also
moved to a single stored entry with no fallback read, so every signed-in user on
Android, iOS and the JVM signs in once more after upgrading. OidcClientis typed by the spec's provider names, so a provider a method does not
declare no longer compiles.OidcClient.signOut()throws when the backend refuses the sign-out.- A realtime subscription that ends throws instead of going quiet.
- Built with Kotlin 2.2.21 (0.2.0: 2.1.21), and depends on kotlinx-serialization-json
1.9.0 (was 1.7.3) and Ktor 3.3.3 (was 3.1.3), which brings OkHttp 5 on JVM and
Android.
Other changes
- Add OIDC sign-in on iOS and JVM. iOS uses
ASWebAuthenticationSession; the JVM
receives the relay on a loopback address it binds per sign-in, so desktop apps need no
relay configuration, and its landing pages are configurable. The JVM holds its session
encryption key in the operating system. - Add
OidcClient.restore(), which reads the backend's session for the client's cookie,
andOidcUsergains the optional fields anAuthblock reports. - Generated clients hydrate transferables inside lists, maps and models, accept a
$ref, emit the declared type and factory call for a bound transferable result, and
produceUnknownTransferablefor a tag with no binding. Codegen reports a declared
binding it cannot apply, and warns whenexcludeNativePackagesnames a package the
spec does not declare. - Set default HTTP timeouts of 30 s connect and 60 s socket.
- Hold the Android credential store on an Android Keystore key, and pin
androidx.security:security-cryptoto the stable1.1.0. - Store the iOS cookie jar with a this-device-only Keychain accessibility class, and
check the result of the system random number generator. - Generated clients compile and round-trip across the whole schema surface: unions with
no discriminator or a boolean one, tuples, self-referencing types, objects with no
properties, inline-object properties,format: uuid,unknownfields, additional
properties, names that collide, type names that are valid files on Windows, and
escaped schema-controlled strings. - Cookie storage no longer loses, over-sends or shares cookies.
- Raw routes resolve against the server URL cut at its first
cdk-blocksor
aws-blockspath segment. - Send an
aws-blocks-kotlinuser-agent token on outbound requests. - Document the
org.jetbrains.kotlin.plugin.serializationplugin the Gradle plugin
requires, the RPC, OIDC and file-transfer exceptions, that an upload to a handle
signed with a content length must send exactly that length, and how the JVM cookie
store keeps its encryption key. The Android and multiplatform examples point at the
shared backend setup and explain how to use the stub identity provider for testing. - The codegen task's "no spec found" error names the
.cdk-blocks-sandboxconfig
directory.
Thanks to @cadivus, @ekjotmultani, @harsh62, @ikenyal, @mattcreaser, @Simone319,
@soberm and @VarshithaPamisetty for their contributions to this release.