@domain.js/main 0.5.2 → 0.5.3

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.
@@ -15,6 +15,6 @@ export declare type Client = Socket<DefaultEventsMap, DefaultEventsMap, DefaultE
15
15
  quit?: Function;
16
16
  entranceOpts?: any[];
17
17
  };
18
- declare const makeProfile: (client: Client, type: string | undefined, auth: string | Signature, extra?: Profile["extra"]) => Profile;
18
+ declare const makeProfile: (client: Client, type: string | undefined, auth: string | Signature | undefined, extra?: Profile["extra"]) => Profile;
19
19
  export declare function BridgeSocket(io: Server, domain: Domain): void;
20
20
  export {};
@@ -58,13 +58,15 @@ const makeProfile = (client, type = "user", auth, extra = {}) => {
58
58
  if (extra.uuid)
59
59
  obj.uuid = extra.uuid;
60
60
  }
61
- if (typeof auth === "string") {
62
- obj.token = auth;
63
- }
64
- else {
65
- obj.sign = auth;
66
- obj.sign.uri = "/socket.io";
67
- obj.sign.method = "socket.init";
61
+ if (auth) {
62
+ if (typeof auth === "string") {
63
+ obj.token = auth;
64
+ }
65
+ else {
66
+ obj.sign = auth;
67
+ obj.sign.uri = "/socket.io";
68
+ obj.sign.method = "socket.init";
69
+ }
68
70
  }
69
71
  return obj;
70
72
  };
@@ -88,10 +90,6 @@ function BridgeSocket(io, domain) {
88
90
  console.log("[%s] connection: client.id: %s", new Date(), client.id);
89
91
  client.on("init", async (type, auth, extra = {}) => {
90
92
  console.log("[%s] socket.init: client.id: %s", new Date(), client.id);
91
- if (!auth) {
92
- client.emit("initError", "auth info lost");
93
- return;
94
- }
95
93
  try {
96
94
  Object.assign(client, { profile: makeProfile(client, type, auth, extra) });
97
95
  if (!client.profile)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domain.js/main",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "DDD framework",
5
5
  "main": "dist/index.js",
6
6
  "bin": {