Unverified Commit 3862ca0a authored by Matteo Bigoi's avatar Matteo Bigoi Committed by GitHub
Browse files

Initial implementation of Typescript server bindings (#2277)



* A barely working code generation in typescript

* Extract shared socket into feature inside aws-smithy-http-server

* Building a fully functional application, I think

* Add NAPI build.rs

* Refactor all names to use typescript instead of js

* Add (hopefully) the PR bot for TS

* Clippy fixes

* Fix documentation

Signed-off-by: default avatarDaniele Ahmed <ahmeddan@amazon.de>

* set_reuse_port in socket not on windows

Signed-off-by: default avatarDaniele Ahmed <ahmeddan@amazon.de>

* Add example implementation

* Allow the new application to build

* Remove all occurrences of Python

* Simplify README

* Fix issue with the codegen-diff-revision script

* Try to prevent the ci-lint to bother us with TODO at this stage of development

* Remove codegen-client from typescript dependencies

Signed-off-by: default avatarBigo <1781140+crisidev@users.noreply.github.com>

* Add CODEOWNERS and fix some other linting issues

* Add license

* Prevent from running tests on typescript in Windows

Signed-off-by: default avatarBigo <1781140+crisidev@users.noreply.github.com>

* Initial work to remove error from this PR

* Update to call_async

Signed-off-by: default avatarDaniele Ahmed <ahmeddan@amazon.de>

* types/node in package.json

Signed-off-by: default avatarDaniele Ahmed <ahmeddan@amazon.de>

* Generate app.ts

Signed-off-by: default avatarDaniele Ahmed <ahmeddan@amazon.de>

* Improve makefile

* Adapting code to the latest changes and removing runtime dependency (for now).

* Removing rust-runtime/aws-smithy-http-server-typescript.

* Making CI happy.

* Restoring ServerCodegenDecorator to be like main.

* Adding back the aws-smithy-http-server-typescript crate back.

* Removing index.js file.

---------

Signed-off-by: default avatarDaniele Ahmed <ahmeddan@amazon.de>
Signed-off-by: default avatarBigo <1781140+crisidev@users.noreply.github.com>
Co-authored-by: default avatar82marbag <69267416+82marbag@users.noreply.github.com>
Co-authored-by: default avatarAlberto Pose <albepose@amazon.com>
parent 9006fe87
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -189,8 +189,9 @@ jobs:
          pushd "${runtime_path}" &>/dev/null
          # aws-smithy-http-server-python cannot be compiled on Windows since it uses the `signal-hook` crate
          # which is not really yet fully supported on the platform.
          cargo test --all-features --workspace --exclude aws-smithy-http-server-python
          cargo doc --no-deps --document-private-items --all-features --workspace --exclude aws-smithy-http-server-python
          # aws-smithy-http-server-typescript cannot be compiled right now on Windows.
          cargo test --all-features --workspace --exclude aws-smithy-http-server-python --exclude aws-smithy-http-server-typescript
          cargo doc --no-deps --document-private-items --all-features --workspace --exclude aws-smithy-http-server-python --exclude aws-smithy-http-server-typescript
          popd &>/dev/null
        done

@@ -210,24 +211,24 @@ jobs:
        - target: i686-unknown-linux-gnu
          build_smithy_rs_features: --all-features
          build_aws_exclude: ''
          build_smithy_rs_exclude: --exclude aws-smithy-http-server-python
          build_smithy_rs_exclude: --exclude aws-smithy-http-server-python --exclude aws-smithy-http-server-typescript
          test_smithy_rs_features: --all-features
          test_aws_exclude: ''
          test_smithy_rs_exclude: --exclude aws-smithy-http-server-python
          test_smithy_rs_exclude: --exclude aws-smithy-http-server-python --exclude aws-smithy-http-server-typescript
        - target: powerpc-unknown-linux-gnu
          build_smithy_rs_features: --features native-tls
          build_aws_exclude: --exclude aws-inlineable
          build_smithy_rs_exclude: --exclude aws-smithy-http-server-python
          build_smithy_rs_exclude: --exclude aws-smithy-http-server-python --exclude aws-smithy-http-server-typescript
          test_smithy_rs_features: --features native-tls
          test_aws_exclude: --exclude aws-inlineable
          test_smithy_rs_exclude: --exclude aws-smithy-http-server-python
          test_smithy_rs_exclude: --exclude aws-smithy-http-server-python --exclude aws-smithy-http-server-typescript
        - target: powerpc64-unknown-linux-gnu
          build_smithy_rs_features: --features native-tls
          build_aws_exclude: --exclude aws-inlineable
          build_smithy_rs_exclude: --exclude aws-smithy-http-server-python
          build_smithy_rs_exclude: --exclude aws-smithy-http-server-python --exclude aws-smithy-http-server-typescript
          test_smithy_rs_features: --features native-tls
          test_aws_exclude: --exclude aws-inlineable
          test_smithy_rs_exclude: --exclude aws-smithy-http-server-python
          test_smithy_rs_exclude: --exclude aws-smithy-http-server-python --exclude aws-smithy-http-server-typescript
    env:
      CROSS_CONFIG: Cross.toml
    steps:
+2 −2
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ jobs:
        ./gradlew -Paws.services=+sts,+sso,+transcribestreaming,+dynamodb :aws:sdk:assemble

        # Copy the Server runtime crate(s) in
        cp -r rust-runtime/aws-smithy-http-server rust-runtime/aws-smithy-http-server-python aws/sdk/build/aws-sdk/sdk
        cp -r rust-runtime/aws-smithy-http-server rust-runtime/aws-smithy-http-server-python rust-runtime/aws-smithy-http-server-typescript aws/sdk/build/aws-sdk/sdk

        pushd aws/sdk/build/aws-sdk

@@ -118,7 +118,7 @@ jobs:
        sed -i '/examples/d' Cargo.toml

        # Add server runtime crates to the workspace
        sed -i 's/"sdk\/sts",/"sdk\/sts","sdk\/aws-smithy-http-server","sdk\/aws-smithy-http-server-python",/' Cargo.toml
        sed -i 's/"sdk\/sts",/"sdk\/sts","sdk\/aws-smithy-http-server","sdk\/aws-smithy-http-server-python","sdk\/aws-smithy-http-server-typescript",/' Cargo.toml

        cargo doc --no-deps --all-features
        popd
+33 −28
Original line number Diff line number Diff line
@@ -10,6 +10,11 @@
/codegen-server/python/                             @awslabs/smithy-rs-python-server @awslabs/smithy-rs-server
/rust-runtime/aws-smithy-http-server-python/        @awslabs/smithy-rs-python-server @awslabs/smithy-rs-server

# Typescript Server
/codegen-server-test/typescript/                    @awslabs/smithy-rs-typescript-server @awslabs/smithy-rs-server
/codegen-server/typescript/                         @awslabs/smithy-rs-typescript-server @awslabs/smithy-rs-server
/rust-runtime/aws-smithy-http-server-typescript/    @awslabs/smithy-rs-typescript-server @awslabs/smithy-rs-server

# Shared ownership
/.github/                                           @awslabs/rust-sdk-owners @awslabs/smithy-rs-server
/CHANGELOG.md                                       @awslabs/rust-sdk-owners @awslabs/smithy-rs-server
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ object CrateSet {
    val SERVER_SMITHY_RUNTIME = SMITHY_RUNTIME_COMMON + listOf(
        "aws-smithy-http-server",
        "aws-smithy-http-server-python",
        "aws-smithy-http-server-typescript",
    )

    val ENTIRE_SMITHY_RUNTIME = (AWS_SDK_SMITHY_RUNTIME + SERVER_SMITHY_RUNTIME).toSortedSet()
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ import java.nio.file.Path
sealed class DependencyScope {
    object Dev : DependencyScope()
    object Compile : DependencyScope()
    object Build : DependencyScope()
}

sealed class DependencyLocation
Loading