@xmobitea/gn-server 2.0.1 → 2.0.2
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/dist/index.js +25 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -65825,6 +65825,27 @@ const getGNReflectedDataType = (prototype, propertyKey) => {
|
|
|
65825
65825
|
return GNMetadata_1.FieldDataType.Object;
|
|
65826
65826
|
}
|
|
65827
65827
|
};
|
|
65828
|
+
const getGNReflectedMetadata = (prototype, propertyKey) => {
|
|
65829
|
+
let t = Reflect.getMetadata("design:type", prototype, propertyKey);
|
|
65830
|
+
if (!t) {
|
|
65831
|
+
throw Error(`Cannot get gn reflected data type for ${prototype.constructor.name}:${propertyKey}`);
|
|
65832
|
+
}
|
|
65833
|
+
let answer = {
|
|
65834
|
+
fieldDataType: null,
|
|
65835
|
+
prototype: t.prototype
|
|
65836
|
+
};
|
|
65837
|
+
if (t.name == "Boolean")
|
|
65838
|
+
answer.fieldDataType = GNMetadata_1.FieldDataType.Boolean;
|
|
65839
|
+
else if (t.name == "Number")
|
|
65840
|
+
answer.fieldDataType = GNMetadata_1.FieldDataType.Number;
|
|
65841
|
+
else if (t.name == "String")
|
|
65842
|
+
answer.fieldDataType = GNMetadata_1.FieldDataType.String;
|
|
65843
|
+
else if (t.name == "Array")
|
|
65844
|
+
answer.fieldDataType = GNMetadata_1.FieldDataType.Array;
|
|
65845
|
+
else
|
|
65846
|
+
answer.fieldDataType = GNMetadata_1.FieldDataType.Object;
|
|
65847
|
+
return answer;
|
|
65848
|
+
};
|
|
65828
65849
|
const initGNObjectMetadata = (prototype) => {
|
|
65829
65850
|
if (prototype === Object.prototype) {
|
|
65830
65851
|
return {};
|
|
@@ -65840,10 +65861,12 @@ const initGNObjectFieldMetadata = (prototype, propertyKey) => {
|
|
|
65840
65861
|
let meta = (0, exports.initGNObjectMetadata)(prototype);
|
|
65841
65862
|
let fieldIndex = meta.fields.findIndex((f) => f.name === propertyKey);
|
|
65842
65863
|
if (fieldIndex < 0) {
|
|
65864
|
+
let gnReflectedMetadata = getGNReflectedMetadata(prototype, propertyKey);
|
|
65843
65865
|
const field = {
|
|
65844
65866
|
name: propertyKey,
|
|
65845
|
-
fieldType: getGNReflectedDataType(prototype, propertyKey),
|
|
65846
|
-
|
|
65867
|
+
// fieldType: getGNReflectedDataType(prototype, propertyKey),
|
|
65868
|
+
fieldType: gnReflectedMetadata.fieldDataType,
|
|
65869
|
+
cls: gnReflectedMetadata.prototype.constructor
|
|
65847
65870
|
};
|
|
65848
65871
|
meta.fields.push(field);
|
|
65849
65872
|
return field;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xmobitea/gn-server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Game Networking Server by XmobiTea (Pro)",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@msgpack/msgpack": "^2.8.0",
|
|
39
|
-
"@sendgrid/mail": "^
|
|
39
|
+
"@sendgrid/mail": "^8.1.1",
|
|
40
40
|
"@socket.io/mongo-adapter": "^0.3.2",
|
|
41
41
|
"@socket.io/mongo-emitter": "^0.2.0",
|
|
42
42
|
"@types/crypto-js": "^4.2.2",
|
|
43
|
-
"@xmobitea/gn-typescript-client": "^2.0.
|
|
43
|
+
"@xmobitea/gn-typescript-client": "^2.0.12",
|
|
44
44
|
"async-lock": "^1.4.1",
|
|
45
45
|
"async-middleware": "^1.2.1",
|
|
46
46
|
"axios": "^1.6.7",
|