mirror of
https://github.com/esiur/esiur-js.git
synced 2025-06-27 07:13:12 +00:00
bugfix
This commit is contained in:
@ -322,7 +322,7 @@ export default class Codec {
|
||||
static isLocalResource( resource, connection) {
|
||||
if (connection == null) return false;
|
||||
if (resource instanceof DistributedResource) {
|
||||
if (resource.connection == connection) return true;
|
||||
if (resource._p.connection == connection) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import TypedMap from './TypedMap.js';
|
||||
import PropertyValueArray from './PropertyValueArray.js';
|
||||
import PropertyValue from './PropertyValue.js';
|
||||
import Record from './Record.js';
|
||||
import { UInt64, Int64 } from '../Data/ExtendedTypes.js';
|
||||
|
||||
export class PropertyValueParserResults {
|
||||
//final int size;
|
||||
@ -114,12 +115,12 @@ export default class DataDeserializer {
|
||||
|
||||
static int64Parser(
|
||||
data, offset, length, connection) {
|
||||
return new AsyncReply(data.getInt64(offset));
|
||||
return new AsyncReply(new Int64(data.getInt64(offset)));
|
||||
}
|
||||
|
||||
static uInt64Parser(
|
||||
data, offset, length, connection) {
|
||||
return new AsyncReply(data.getUint64(offset));
|
||||
return new AsyncReply(new UInt64(data.getUint64(offset)));
|
||||
}
|
||||
|
||||
static dateTimeParser(
|
||||
@ -222,10 +223,10 @@ export default class DataDeserializer {
|
||||
enumVal.index = index;
|
||||
enumVal.name = template.constants[index].name;
|
||||
enumVal.value = template.constants[index].value;
|
||||
return new AsyncReply.ready(enumVal);
|
||||
return new AsyncReply(enumVal);
|
||||
} else {
|
||||
return AsyncReply.ready(IEnum(index, template.constants[index].value,
|
||||
template.constants[index].name));
|
||||
return new AsyncReply(new IEnum(index, template.constants[index].value,
|
||||
template.constants[index].name, template));
|
||||
}
|
||||
} else {
|
||||
var reply = new AsyncReply();
|
||||
@ -242,7 +243,7 @@ export default class DataDeserializer {
|
||||
reply.trigger(enumVal);
|
||||
} else {
|
||||
reply.trigger(new IEnum(
|
||||
index, tmp.constants[index].value, tmp.constants[index].name));
|
||||
index, tmp.constants[index].value, tmp.constants[index].name, tmp));
|
||||
}
|
||||
} else
|
||||
reply.triggerError(new Error("Template not found for enum"));
|
||||
|
@ -129,7 +129,7 @@ export default class DataSerializer {
|
||||
return new DataSerializerComposeResults(
|
||||
TransmissionTypeIdentifier.Null, new DC(0));
|
||||
|
||||
var template = Warehouse.getTemplateByType(value.runtimeType);
|
||||
var template = Warehouse.getTemplateByType(value.runtimeType) ?? value.template;
|
||||
|
||||
if (template == null)
|
||||
return new DataSerializerComposeResults(
|
||||
@ -322,7 +322,7 @@ export default class DataSerializer {
|
||||
var rt = new DC(4);
|
||||
|
||||
if (Codec.isLocalResource(resource, connection)) {
|
||||
rt.setUint32(0, resource.id ?? 0);
|
||||
rt.setUint32(0, resource._p.instanceId ?? 0);
|
||||
return new DataSerializerComposeResults(
|
||||
TransmissionTypeIdentifier.ResourceLocal, rt);
|
||||
} else {
|
||||
|
@ -2,15 +2,16 @@
|
||||
|
||||
export default class IEnum {
|
||||
|
||||
IEnum(index, value, name){
|
||||
constructor(index, value, name, template){
|
||||
this.index = index;
|
||||
this.value = value;
|
||||
this.name = name;
|
||||
this.template = template;
|
||||
}
|
||||
|
||||
get template () {
|
||||
//return new TemplateDescriber("IEnum");
|
||||
}
|
||||
// get template () {
|
||||
// //return new TemplateDescriber("IEnum");
|
||||
// }
|
||||
|
||||
toString() {
|
||||
return `${this.name}<${this.value}>`;
|
||||
|
@ -34,7 +34,7 @@ export const RepresentationTypeIdentifier = {
|
||||
Record : 0x15,
|
||||
List : 0x16,
|
||||
Map : 0x17,
|
||||
Enum : 0x18,
|
||||
Enum : 0x44,
|
||||
TypedResource : 0x45, // Followed by UUID
|
||||
TypedRecord : 0x46, // Followed by UUID
|
||||
TypedList : 0x48, // Followed by element type
|
||||
|
@ -126,11 +126,12 @@ export default class DistributedResource extends IResource
|
||||
&& arguments[0].constructor.name == "Object")
|
||||
{
|
||||
|
||||
let argsObj = arguments[0];
|
||||
// named args
|
||||
for (let i = 0; i < ft.args.length; i++){
|
||||
let arg = ft.args[i];
|
||||
if (arguments[arg.name] != undefined) {
|
||||
argsMap.set(new UInt8(arg.index), arguments[arg.name]);
|
||||
if (argsObj[arg.name] != undefined) {
|
||||
argsMap.set(new UInt8(arg.index), argsObj[arg.name]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,6 +317,9 @@ export class WH extends IEventHandler
|
||||
|
||||
getTemplateByType(type)
|
||||
{
|
||||
if (type == null)
|
||||
return null;
|
||||
|
||||
var templateType = TemplateType.Unspecified;
|
||||
|
||||
if (type.prototype instanceof DistributedResource)
|
||||
@ -595,8 +598,8 @@ export class WH extends IEventHandler
|
||||
...this._getTypeEntries(UInt64, new RepresentationType(RepresentationTypeIdentifier.UInt64, false)),
|
||||
...this._getTypeEntries(Float32, new RepresentationType(RepresentationTypeIdentifier.Float32, false)),
|
||||
...this._getTypeEntries(Float64, new RepresentationType(RepresentationTypeIdentifier.Float64, false)),
|
||||
...this._getTypeEntries(String, new RepresentationType(RepresentationTypeIdentifier.Int8, String)),
|
||||
...this._getTypeEntries(Date, new RepresentationType(RepresentationTypeIdentifier.Int8, Date)),
|
||||
...this._getTypeEntries(String, new RepresentationType(RepresentationTypeIdentifier.String, String)),
|
||||
...this._getTypeEntries(Date, new RepresentationType(RepresentationTypeIdentifier.DateTime, Date)),
|
||||
...this._getTypeEntries(Record, new RepresentationType(RepresentationTypeIdentifier.Record, false)),
|
||||
...this._getTypeEntries(IResource, new RepresentationType(RepresentationTypeIdentifier.Resource, false)),
|
||||
...this._getTypeEntries(Array, new RepresentationType(RepresentationTypeIdentifier.List, false)),
|
||||
|
Reference in New Issue
Block a user