Upgrade npm bazel rules to latest

Later than v2, rollup_bundle needs additional configuration to find
workspace files. It also no longer minifies, so needed to add an
additional post-bundle step to maintain api.

We had to rename the `Object` class to `ObjectGenerated` in the
flatbuffers TypeScript generator. This lets us avoid name clashes with
the builtin `Object` class.
Upstream issue: https://github.com/google/flatbuffers/issues/6994

Change-Id: I45ab717bfc9ff8ef24aa05644fb845879cc09d98
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
diff --git a/aos/network/www/BUILD b/aos/network/www/BUILD
index 64d7452..f62ed67 100644
--- a/aos/network/www/BUILD
+++ b/aos/network/www/BUILD
@@ -1,5 +1,5 @@
-load("@npm_bazel_typescript//:defs.bzl", "ts_library")
-load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle")
+load("@npm//@bazel/typescript:index.bzl", "ts_library")
+load("//tools/build_rules:js.bzl", "rollup_bundle")
 load("//aos:config.bzl", "aos_config")
 
 filegroup(
@@ -43,7 +43,6 @@
 
 rollup_bundle(
     name = "main_bundle",
-    enable_code_splitting = False,
     entry_point = "main.ts",
     target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//aos:__subpackages__"],
@@ -165,7 +164,6 @@
 
 rollup_bundle(
     name = "reflection_test_bundle",
-    enable_code_splitting = False,
     entry_point = "reflection_test_main.ts",
     target_compatible_with = ["@platforms//os:linux"],
     deps = [
diff --git a/aos/network/www/proxy.ts b/aos/network/www/proxy.ts
index c52f495..5461899 100644
--- a/aos/network/www/proxy.ts
+++ b/aos/network/www/proxy.ts
@@ -243,7 +243,7 @@
     this.webSocketConnection.send(array.buffer.slice(array.byteOffset));
   }
 
-  onIceCandidateError(e: RTCPeerConnectionIceErrorEvent): void {
+  onIceCandidateError(e: Event): void {
     console.warn(e);
   }
 
diff --git a/aos/network/www/reflection.ts b/aos/network/www/reflection.ts
index 4362806..18d4996 100644
--- a/aos/network/www/reflection.ts
+++ b/aos/network/www/reflection.ts
@@ -236,7 +236,7 @@
   }
 
   // Returns the Object definition associated with the given type index.
-  getType(typeIndex: number): reflection.Object {
+  getType(typeIndex: number): reflection.ObjectGenerated {
     if (typeIndex === -1) {
       return this.schema.rootTable();
     }
@@ -249,7 +249,7 @@
   // Retrieves the Field schema for the given field name within a given
   // type index.
   getField(fieldName: string, typeIndex: number): reflection.Field {
-    const schema: reflection.Object = this.getType(typeIndex);
+    const schema: reflection.ObjectGenerated = this.getType(typeIndex);
     const numFields = schema.fieldsLength();
     for (let ii = 0; ii < numFields; ++ii) {
       const field = schema.fields(ii);