Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aire-ux/aire-condensation

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aire-ux/aire-condensation - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

5

package.json
{
"name": "@aire-ux/aire-condensation",
"version": "0.1.5",
"version": "0.1.6",
"description": "Client-side serialization library for Aire-UX",

@@ -81,4 +81,3 @@ "main": "dist/index.js",

"reflect-metadata": "^0.1.13"
},
"gitHead": "f0913bd1095bb927a69d28347b3482ba34fa0a8c"
}
}

7

src/main/typescript/condensation.ts

@@ -174,9 +174,8 @@ import TypeRegistry from "@condensation/type-registry";

return ctorArgs.map((def, idx) => {
const doc = args[idx],
jsonValue = JSON.parse(doc);
const doc = args[idx];
if (def.type !== Dynamic) {
const deserializer = Condensation.deserializerFor(def.type);
return deserializer.read(jsonValue);
return deserializer.read(deserializer.primitive ? doc : JSON.parse(doc));
} else {
return jsonValue;
return JSON.parse(doc);
}

@@ -183,0 +182,0 @@ });

@@ -7,2 +7,3 @@ import "reflect-metadata";

export interface Deserializer<T> {
primitive: boolean;
read(object: any): T;

@@ -12,2 +13,3 @@ }

export class StringDeserializer implements Deserializer<string> {
primitive = true;
read(object: any): string {

@@ -19,2 +21,3 @@ return object as string;

export class BooleanDeserializer implements Deserializer<boolean> {
primitive = true;
read(object: any): boolean {

@@ -26,2 +29,3 @@ return object as boolean;

export class NumberDeserializer implements Deserializer<number> {
primitive = true;
read(object: any): number {

@@ -33,2 +37,3 @@ return object as number;

export class TypeRegistrationDeserializer<T> implements Deserializer<T> {
primitive = false;
constructor(

@@ -35,0 +40,0 @@ readonly type: Class<T>,

import { Condensation, Context } from "@condensation/condensation";
import { Property, RootElement } from "@condensation/root-element";
import { Receive, Remotable } from "@condensation/remotable";
import {Receive, Remotable, Remote} from "@condensation/remotable";
import { allocate, Region } from "@condensation/types";

@@ -55,2 +55,48 @@

test('objects should be able to receive escaped string primitives', () => {
@Remotable
class RemotePerson {
firstName: string | undefined;
@Remote
setFirstName(@Receive(String) name: string) : void {
this.firstName = name;
}
}
const value = context.create<RemotePerson>(
RemotePerson
);
context.invoke(value, 'setFirstName', "Josiah");
expect(value.firstName).toBe("Josiah");
});
test('objects should be able to receive string primitives', () => {
@Remotable
class RemotePerson {
firstName: string | undefined;
@Remote
setFirstName(@Receive(String) name: string) : void {
this.firstName = name;
}
}
const value = context.create<RemotePerson>(
RemotePerson
);
context.invoke(value, 'setFirstName', "Josiah");
expect(value.firstName).toBe("Josiah");
});
test("objects should be invocable by their handles", () => {

@@ -57,0 +103,0 @@ @RootElement

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc