json-as 0.5.14 → 0.5.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/assembly/src/json.ts
CHANGED
|
@@ -394,13 +394,15 @@ function parseArray<T extends unknown[]>(data: string): T {
|
|
|
394
394
|
// @ts-ignore
|
|
395
395
|
return parseArrayArray<T>(data);
|
|
396
396
|
// @ts-ignore
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
// @ts-ignore
|
|
400
|
-
if (isDefined(type.__JSON_Set_Key)) {
|
|
397
|
+
} else if (isManaged<valueof<T>>() || isReference<valueof<T>>()) {
|
|
398
|
+
const type = changetype<nonnull<valueof<T>>>(__new(offsetof<nonnull<valueof<T>>>(), idof <nonnull<valueof<T>>>()));
|
|
401
399
|
// @ts-ignore
|
|
402
|
-
|
|
400
|
+
if (isDefined(type.__JSON_Set_Key)) {
|
|
401
|
+
// @ts-ignore
|
|
402
|
+
return parseObjectArray<T>(data);
|
|
403
|
+
}
|
|
403
404
|
}
|
|
405
|
+
return unreachable();
|
|
404
406
|
}
|
|
405
407
|
|
|
406
408
|
// @ts-ignore
|
package/package.json
CHANGED
package/transform/lib/index.js
CHANGED
|
@@ -48,7 +48,9 @@ class AsJSONTransform extends BaseVisitor {
|
|
|
48
48
|
//);
|
|
49
49
|
}
|
|
50
50
|
visitClassDeclaration(node) {
|
|
51
|
-
var _a, _b, _c, _d;
|
|
51
|
+
var _a, _b, _c, _d, _e;
|
|
52
|
+
if (!((_a = node.decorators) === null || _a === void 0 ? void 0 : _a.length))
|
|
53
|
+
return;
|
|
52
54
|
let foundDecorator = false;
|
|
53
55
|
for (const decorator of node.decorators) {
|
|
54
56
|
// @ts-ignore
|
|
@@ -81,9 +83,9 @@ class AsJSONTransform extends BaseVisitor {
|
|
|
81
83
|
return v;
|
|
82
84
|
}
|
|
83
85
|
});
|
|
84
|
-
if (parentSchema.length > 0 && ((
|
|
85
|
-
(
|
|
86
|
-
this.currentClass.encodeStmts.push(...(
|
|
86
|
+
if (parentSchema.length > 0 && ((_b = parentSchema[0]) === null || _b === void 0 ? void 0 : _b.encodeStmts)) {
|
|
87
|
+
(_c = parentSchema[0]) === null || _c === void 0 ? void 0 : _c.encodeStmts.push(((_d = parentSchema[0]) === null || _d === void 0 ? void 0 : _d.encodeStmts.pop()) + ",");
|
|
88
|
+
this.currentClass.encodeStmts.push(...(_e = parentSchema[0]) === null || _e === void 0 ? void 0 : _e.encodeStmts);
|
|
87
89
|
}
|
|
88
90
|
else {
|
|
89
91
|
//console.log("Class extends " + this.currentClass.parent + ", but parent class not found. Maybe add the @json decorator over parent class?")
|
package/transform/package.json
CHANGED
package/transform/src/index.ts
CHANGED