chore: Review fixes at #378 (#383)

* Review fixes

* remove logs

* Fixes

* Todo to remove prefix later

* Refactor service signatures

* Fixes

* Update lock file

* Fix lockfile

* Update deps

* More fixes and renames

* Fix compiler

* Peer refactoring and cutting onConnectionChange API

* Revert deleted API
This commit is contained in:
Akim
2023-11-23 04:18:10 +07:00
committed by GitHub
parent f4a550dd22
commit 98462bfdf6
34 changed files with 2413 additions and 585 deletions

View File

@ -14,17 +14,12 @@
* limitations under the License.
*/
import { ServiceDef } from "@fluencelabs/interfaces";
import { JSONValue, ServiceDef } from "@fluencelabs/interfaces";
import { recursiveRenameLaquaProps } from "../utils.js";
import { TypeGenerator } from "./interfaces.js";
// Actual value of defaultServiceId which comes from aqua-api
export interface DefaultServiceId {
s_Some__f_value?: string;
}
export function generateServices(
typeGenerator: TypeGenerator,
services: Record<string, ServiceDef>,
@ -68,21 +63,6 @@ function generateRegisterServiceOverload(
}
function serviceToJson(service: ServiceDef): string {
return JSON.stringify(
{
// This assertion is required because aqua-api gives bad types
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
...((service.defaultServiceId as DefaultServiceId).s_Some__f_value != null
? {
defaultServiceId:
// This assertion is required because aqua-api gives bad types
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
(service.defaultServiceId as DefaultServiceId).s_Some__f_value,
}
: {}),
functions: recursiveRenameLaquaProps(service.functions),
},
null,
4,
);
const record: Record<never, JSONValue> = service;
return JSON.stringify(recursiveRenameLaquaProps(record), null, 4);
}