expresso-macchiato 0.3.8-dev → 0.3.8-dev.1
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.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +14 -12
- package/dist/index.mjs +13 -11
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -467,7 +467,7 @@ type SocketConnectionOk<Metadata = any> = {
|
|
|
467
467
|
};
|
|
468
468
|
type SocketConnectionMiddleware<Metadata extends Record<string, any> = any> = (self: SocketWrapper, client: Socket, commId?: string, metadata?: Metadata) => Promise<SocketConnectionOk<Metadata> | SocketConnectionNok>;
|
|
469
469
|
type SocketWrapperConstructor<Metadata extends Record<string, any> = any> = {
|
|
470
|
-
|
|
470
|
+
socketNamespace: string;
|
|
471
471
|
clientConnectionKey?: string;
|
|
472
472
|
connectionMiddleware?: SocketConnectionMiddleware<Metadata>;
|
|
473
473
|
afterClientConnect?: (self: SocketWrapper, client: Socket, metadata?: Metadata) => Promise<void>;
|
|
@@ -477,7 +477,7 @@ type SocketWrapperConstructor<Metadata extends Record<string, any> = any> = {
|
|
|
477
477
|
|
|
478
478
|
declare class SocketWrapper<Metadata extends Record<string, any> = any> {
|
|
479
479
|
protected connectedClients: Map<string, ConnectedSocketClient>;
|
|
480
|
-
readonly
|
|
480
|
+
readonly socketNamespace: string;
|
|
481
481
|
protected readonly data: SocketWrapperConstructor<Metadata>;
|
|
482
482
|
protected namespace?: Namespace;
|
|
483
483
|
constructor(data: SocketWrapperConstructor<Metadata>);
|
|
@@ -651,6 +651,7 @@ declare const apiNok: (err: any, status?: number) => ExpressReturn;
|
|
|
651
651
|
declare const errorCatcher: (res: Response$1, err: unknown, errorsList?: ErrorsMapping, errorString?: string) => void;
|
|
652
652
|
declare const socketOk: <T extends Record<string, any> = any>(newMetadata?: T) => SocketConnectionOk;
|
|
653
653
|
declare const socketNok: (message: string) => SocketConnectionNok;
|
|
654
|
+
declare const sleep: (ms: number) => Promise<unknown>;
|
|
654
655
|
declare const getCompiledPath: (__filename: string, __dirname: string, pathsWithoutExtension: string[]) => string[];
|
|
655
656
|
|
|
656
|
-
export { type ApiKeySecurity, BackgroundService, type BaseFormatContrainedParameter, type BaseOAuthSecurity, type BaseParameter, type BaseSchema, type BaseSecurity, type BasicAuthenticationSecurity, type BodyParameter, type Components, type ConnectedSocketClient, type Contact, type DefaultTokenPayload, type DynamicDbRouterOptions, type DynamicSwaggerOperation, type DynamicSwaggerOperationBody, type DynamicSwaggerPath, type DynamicSwaggerRequestBodyOperation, type ErrorsMapping, type ExpressReturn, type ExternalDocs, type FormDataParameter, type GenericFormat, type Header, type HeaderParameter, type Info, type IntegerFormat, type License, type ListOptions, type MethodPathHandling, type Methods, type NumberFormat, type OAuth2AccessCodeSecurity, type OAuth2ApplicationSecurity, type OAuth2ImplicitSecurity, type OAuth2PasswordSecurity, type OAuthScope, type Operation, type Parameter, type ParameterCollectionFormat, type ParameterType, type Path, type PathParameter, type ProjectConfigs, type QueryParameter, type Reference, type RequestBodyOperation, type Response, RouterWrapper, type RouterWrapperInterface, type Schema, type SchemaFormatConstraints, type SchemaV3, type SearchQuery, type SecureTokenConfig, type Security, type Server, type SocketConnectionMiddleware, type SocketConnectionNok, type SocketConnectionOk, SocketWrapper, type SocketWrapperConstructor, type Spec, Starter, type StarterOptions, type StringFormat, Swagger, type SwaggerMetadataInterface, type Tag, Token, type TokenApiOptions, type TokenConstructor, type XML, apiNok, apiOk, errorCatcher, fullLogNok, fullLogOk, getCompiledPath, log, socketNok, socketOk };
|
|
657
|
+
export { type ApiKeySecurity, BackgroundService, type BaseFormatContrainedParameter, type BaseOAuthSecurity, type BaseParameter, type BaseSchema, type BaseSecurity, type BasicAuthenticationSecurity, type BodyParameter, type Components, type ConnectedSocketClient, type Contact, type DefaultTokenPayload, type DynamicDbRouterOptions, type DynamicSwaggerOperation, type DynamicSwaggerOperationBody, type DynamicSwaggerPath, type DynamicSwaggerRequestBodyOperation, type ErrorsMapping, type ExpressReturn, type ExternalDocs, type FormDataParameter, type GenericFormat, type Header, type HeaderParameter, type Info, type IntegerFormat, type License, type ListOptions, type MethodPathHandling, type Methods, type NumberFormat, type OAuth2AccessCodeSecurity, type OAuth2ApplicationSecurity, type OAuth2ImplicitSecurity, type OAuth2PasswordSecurity, type OAuthScope, type Operation, type Parameter, type ParameterCollectionFormat, type ParameterType, type Path, type PathParameter, type ProjectConfigs, type QueryParameter, type Reference, type RequestBodyOperation, type Response, RouterWrapper, type RouterWrapperInterface, type Schema, type SchemaFormatConstraints, type SchemaV3, type SearchQuery, type SecureTokenConfig, type Security, type Server, type SocketConnectionMiddleware, type SocketConnectionNok, type SocketConnectionOk, SocketWrapper, type SocketWrapperConstructor, type Spec, Starter, type StarterOptions, type StringFormat, Swagger, type SwaggerMetadataInterface, type Tag, Token, type TokenApiOptions, type TokenConstructor, type XML, apiNok, apiOk, errorCatcher, fullLogNok, fullLogOk, getCompiledPath, log, sleep, socketNok, socketOk };
|
package/dist/index.d.ts
CHANGED
|
@@ -467,7 +467,7 @@ type SocketConnectionOk<Metadata = any> = {
|
|
|
467
467
|
};
|
|
468
468
|
type SocketConnectionMiddleware<Metadata extends Record<string, any> = any> = (self: SocketWrapper, client: Socket, commId?: string, metadata?: Metadata) => Promise<SocketConnectionOk<Metadata> | SocketConnectionNok>;
|
|
469
469
|
type SocketWrapperConstructor<Metadata extends Record<string, any> = any> = {
|
|
470
|
-
|
|
470
|
+
socketNamespace: string;
|
|
471
471
|
clientConnectionKey?: string;
|
|
472
472
|
connectionMiddleware?: SocketConnectionMiddleware<Metadata>;
|
|
473
473
|
afterClientConnect?: (self: SocketWrapper, client: Socket, metadata?: Metadata) => Promise<void>;
|
|
@@ -477,7 +477,7 @@ type SocketWrapperConstructor<Metadata extends Record<string, any> = any> = {
|
|
|
477
477
|
|
|
478
478
|
declare class SocketWrapper<Metadata extends Record<string, any> = any> {
|
|
479
479
|
protected connectedClients: Map<string, ConnectedSocketClient>;
|
|
480
|
-
readonly
|
|
480
|
+
readonly socketNamespace: string;
|
|
481
481
|
protected readonly data: SocketWrapperConstructor<Metadata>;
|
|
482
482
|
protected namespace?: Namespace;
|
|
483
483
|
constructor(data: SocketWrapperConstructor<Metadata>);
|
|
@@ -651,6 +651,7 @@ declare const apiNok: (err: any, status?: number) => ExpressReturn;
|
|
|
651
651
|
declare const errorCatcher: (res: Response$1, err: unknown, errorsList?: ErrorsMapping, errorString?: string) => void;
|
|
652
652
|
declare const socketOk: <T extends Record<string, any> = any>(newMetadata?: T) => SocketConnectionOk;
|
|
653
653
|
declare const socketNok: (message: string) => SocketConnectionNok;
|
|
654
|
+
declare const sleep: (ms: number) => Promise<unknown>;
|
|
654
655
|
declare const getCompiledPath: (__filename: string, __dirname: string, pathsWithoutExtension: string[]) => string[];
|
|
655
656
|
|
|
656
|
-
export { type ApiKeySecurity, BackgroundService, type BaseFormatContrainedParameter, type BaseOAuthSecurity, type BaseParameter, type BaseSchema, type BaseSecurity, type BasicAuthenticationSecurity, type BodyParameter, type Components, type ConnectedSocketClient, type Contact, type DefaultTokenPayload, type DynamicDbRouterOptions, type DynamicSwaggerOperation, type DynamicSwaggerOperationBody, type DynamicSwaggerPath, type DynamicSwaggerRequestBodyOperation, type ErrorsMapping, type ExpressReturn, type ExternalDocs, type FormDataParameter, type GenericFormat, type Header, type HeaderParameter, type Info, type IntegerFormat, type License, type ListOptions, type MethodPathHandling, type Methods, type NumberFormat, type OAuth2AccessCodeSecurity, type OAuth2ApplicationSecurity, type OAuth2ImplicitSecurity, type OAuth2PasswordSecurity, type OAuthScope, type Operation, type Parameter, type ParameterCollectionFormat, type ParameterType, type Path, type PathParameter, type ProjectConfigs, type QueryParameter, type Reference, type RequestBodyOperation, type Response, RouterWrapper, type RouterWrapperInterface, type Schema, type SchemaFormatConstraints, type SchemaV3, type SearchQuery, type SecureTokenConfig, type Security, type Server, type SocketConnectionMiddleware, type SocketConnectionNok, type SocketConnectionOk, SocketWrapper, type SocketWrapperConstructor, type Spec, Starter, type StarterOptions, type StringFormat, Swagger, type SwaggerMetadataInterface, type Tag, Token, type TokenApiOptions, type TokenConstructor, type XML, apiNok, apiOk, errorCatcher, fullLogNok, fullLogOk, getCompiledPath, log, socketNok, socketOk };
|
|
657
|
+
export { type ApiKeySecurity, BackgroundService, type BaseFormatContrainedParameter, type BaseOAuthSecurity, type BaseParameter, type BaseSchema, type BaseSecurity, type BasicAuthenticationSecurity, type BodyParameter, type Components, type ConnectedSocketClient, type Contact, type DefaultTokenPayload, type DynamicDbRouterOptions, type DynamicSwaggerOperation, type DynamicSwaggerOperationBody, type DynamicSwaggerPath, type DynamicSwaggerRequestBodyOperation, type ErrorsMapping, type ExpressReturn, type ExternalDocs, type FormDataParameter, type GenericFormat, type Header, type HeaderParameter, type Info, type IntegerFormat, type License, type ListOptions, type MethodPathHandling, type Methods, type NumberFormat, type OAuth2AccessCodeSecurity, type OAuth2ApplicationSecurity, type OAuth2ImplicitSecurity, type OAuth2PasswordSecurity, type OAuthScope, type Operation, type Parameter, type ParameterCollectionFormat, type ParameterType, type Path, type PathParameter, type ProjectConfigs, type QueryParameter, type Reference, type RequestBodyOperation, type Response, RouterWrapper, type RouterWrapperInterface, type Schema, type SchemaFormatConstraints, type SchemaV3, type SearchQuery, type SecureTokenConfig, type Security, type Server, type SocketConnectionMiddleware, type SocketConnectionNok, type SocketConnectionOk, SocketWrapper, type SocketWrapperConstructor, type Spec, Starter, type StarterOptions, type StringFormat, Swagger, type SwaggerMetadataInterface, type Tag, Token, type TokenApiOptions, type TokenConstructor, type XML, apiNok, apiOk, errorCatcher, fullLogNok, fullLogOk, getCompiledPath, log, sleep, socketNok, socketOk };
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ var errorCatcher = (res, err, errorsList, errorString) => {
|
|
|
36
36
|
};
|
|
37
37
|
var socketOk = (newMetadata) => ({ ok: true, newMetadata });
|
|
38
38
|
var socketNok = (message) => ({ ok: false, message });
|
|
39
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
39
40
|
var getCompiledPath = (__filename, __dirname, pathsWithoutExtension) => {
|
|
40
41
|
const isCompiled = __filename.endsWith(".js");
|
|
41
42
|
return pathsWithoutExtension.map((p) => _path3.default.join(__dirname, p + (isCompiled ? ".js" : ".ts")).replaceAll("\\", "/"));
|
|
@@ -714,7 +715,7 @@ var SocketWrapper = class {
|
|
|
714
715
|
this.setupConnection = (io) => {
|
|
715
716
|
try {
|
|
716
717
|
if (!this.data.listeners) throw new Error("No listeners provided");
|
|
717
|
-
this.namespace = io.of(`/${this.
|
|
718
|
+
this.namespace = io.of(`/${this.socketNamespace}`);
|
|
718
719
|
if (this.data.connectionMiddleware) {
|
|
719
720
|
io.use(async (client, next) => {
|
|
720
721
|
const commId = client.handshake.query.commId;
|
|
@@ -734,26 +735,26 @@ var SocketWrapper = class {
|
|
|
734
735
|
const metadata = client.handshake.query.metadata;
|
|
735
736
|
const finalClientId = this.data.clientConnectionKey ? _nullishCoalesce(_optionalChain([metadata, 'optionalAccess', _45 => _45[this.data.clientConnectionKey]]), () => ( client.id)) : client.id;
|
|
736
737
|
this.connectedClients.set(finalClientId, { socket: client, connectedAt: /* @__PURE__ */ new Date(), metadata });
|
|
737
|
-
log.cyan(`[SOCKETWRAPPER] [${this.
|
|
738
|
+
log.cyan(`[SOCKETWRAPPER] [${this.socketNamespace.toUpperCase()}] Client ${client.id} connected`);
|
|
738
739
|
if (this.data.afterClientConnect) this.data.afterClientConnect(this, client, metadata);
|
|
739
740
|
for (const eventName in this.data.listeners) client.on(eventName, (...params) => _optionalChain([this, 'access', _46 => _46.data, 'access', _47 => _47.listeners, 'optionalAccess', _48 => _48[eventName], 'call', _49 => _49(this, client, metadata, ...params)]));
|
|
740
741
|
client.on("disconnect", () => this.handleDisconnection(client));
|
|
741
742
|
} catch (err) {
|
|
742
|
-
fullLogNok(`SOCKETWRAPPER`, `[${this.
|
|
743
|
+
fullLogNok(`SOCKETWRAPPER`, `[${this.socketNamespace.toUpperCase()}]`, err);
|
|
743
744
|
}
|
|
744
745
|
});
|
|
745
746
|
} catch (err) {
|
|
746
|
-
fullLogNok(`SOCKETWRAPPER`, `[${this.
|
|
747
|
+
fullLogNok(`SOCKETWRAPPER`, `[${this.socketNamespace.toUpperCase()}]`, err);
|
|
747
748
|
}
|
|
748
749
|
};
|
|
749
750
|
this.handleDisconnection = (client) => {
|
|
750
751
|
try {
|
|
751
752
|
if (!this.namespace) throw new Error("Socket.IO not initialized");
|
|
752
753
|
this.connectedClients.delete(client.id);
|
|
753
|
-
log.cyan(`[SOCKETWRAPPER] [${this.
|
|
754
|
+
log.cyan(`[SOCKETWRAPPER] [${this.socketNamespace.toUpperCase()}] Client ${client.id} disconnected`);
|
|
754
755
|
if (this.data.onClientDisconnect) this.data.onClientDisconnect(client);
|
|
755
756
|
} catch (err) {
|
|
756
|
-
fullLogNok(`SOCKETWRAPPER`, `[${this.
|
|
757
|
+
fullLogNok(`SOCKETWRAPPER`, `[${this.socketNamespace.toUpperCase()}]`, err);
|
|
757
758
|
}
|
|
758
759
|
};
|
|
759
760
|
// --- SEND METHODS
|
|
@@ -762,7 +763,7 @@ var SocketWrapper = class {
|
|
|
762
763
|
if (!this.namespace) throw new Error("Socket.IO not initialized");
|
|
763
764
|
this.namespace.emit(eventName, data);
|
|
764
765
|
} catch (err) {
|
|
765
|
-
fullLogNok(`SOCKETWRAPPER`, `[${this.
|
|
766
|
+
fullLogNok(`SOCKETWRAPPER`, `[${this.socketNamespace.toUpperCase()}]`, err);
|
|
766
767
|
}
|
|
767
768
|
};
|
|
768
769
|
this.broadcastExceptClient = (clientId, eventName, data) => {
|
|
@@ -771,7 +772,7 @@ var SocketWrapper = class {
|
|
|
771
772
|
if (id !== clientId) client.socket.emit(eventName, data);
|
|
772
773
|
}
|
|
773
774
|
} catch (err) {
|
|
774
|
-
fullLogNok(`SOCKETWRAPPER`, `[${this.
|
|
775
|
+
fullLogNok(`SOCKETWRAPPER`, `[${this.socketNamespace.toUpperCase()}]`, err);
|
|
775
776
|
}
|
|
776
777
|
};
|
|
777
778
|
this.sendToClient = (clientId, eventName, data) => {
|
|
@@ -780,7 +781,7 @@ var SocketWrapper = class {
|
|
|
780
781
|
if (!connectedClient) throw new Error(`Client ${clientId} not found`);
|
|
781
782
|
connectedClient.socket.emit(eventName, data);
|
|
782
783
|
} catch (err) {
|
|
783
|
-
fullLogNok(`SOCKETWRAPPER`, `[${this.
|
|
784
|
+
fullLogNok(`SOCKETWRAPPER`, `[${this.socketNamespace.toUpperCase()}]`, err);
|
|
784
785
|
}
|
|
785
786
|
};
|
|
786
787
|
this.sendToRoom = (room, eventName, data) => {
|
|
@@ -788,7 +789,7 @@ var SocketWrapper = class {
|
|
|
788
789
|
if (!this.namespace) throw new Error("Socket.IO not initialized");
|
|
789
790
|
this.namespace.to(room).emit(eventName, data);
|
|
790
791
|
} catch (err) {
|
|
791
|
-
fullLogNok(`SOCKETWRAPPER`, `[${this.
|
|
792
|
+
fullLogNok(`SOCKETWRAPPER`, `[${this.socketNamespace.toUpperCase()}]`, err);
|
|
792
793
|
}
|
|
793
794
|
};
|
|
794
795
|
// --- GETTERS
|
|
@@ -800,7 +801,7 @@ var SocketWrapper = class {
|
|
|
800
801
|
}
|
|
801
802
|
return void 0;
|
|
802
803
|
};
|
|
803
|
-
this.
|
|
804
|
+
this.socketNamespace = data.socketNamespace;
|
|
804
805
|
this.data = data;
|
|
805
806
|
Object.keys(_nullishCoalesce(data.listeners, () => ( {}))).forEach((key) => {
|
|
806
807
|
this[key] = _optionalChain([data, 'access', _50 => _50.listeners, 'optionalAccess', _51 => _51[key], 'access', _52 => _52.bind, 'call', _53 => _53(this)]);
|
|
@@ -959,4 +960,5 @@ var Token = class {
|
|
|
959
960
|
|
|
960
961
|
|
|
961
962
|
|
|
962
|
-
|
|
963
|
+
|
|
964
|
+
exports.BackgroundService = BackgroundService; exports.RouterWrapper = RouterWrapper; exports.SocketWrapper = SocketWrapper; exports.Starter = Starter; exports.Swagger = Swagger; exports.Token = Token; exports.apiNok = apiNok; exports.apiOk = apiOk; exports.errorCatcher = errorCatcher; exports.fullLogNok = fullLogNok; exports.fullLogOk = fullLogOk; exports.getCompiledPath = getCompiledPath; exports.log = log; exports.sleep = sleep; exports.socketNok = socketNok; exports.socketOk = socketOk;
|
package/dist/index.mjs
CHANGED
|
@@ -36,6 +36,7 @@ var errorCatcher = (res, err, errorsList, errorString) => {
|
|
|
36
36
|
};
|
|
37
37
|
var socketOk = (newMetadata) => ({ ok: true, newMetadata });
|
|
38
38
|
var socketNok = (message) => ({ ok: false, message });
|
|
39
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
39
40
|
var getCompiledPath = (__filename2, __dirname2, pathsWithoutExtension) => {
|
|
40
41
|
const isCompiled = __filename2.endsWith(".js");
|
|
41
42
|
return pathsWithoutExtension.map((p) => path.join(__dirname2, p + (isCompiled ? ".js" : ".ts")).replaceAll("\\", "/"));
|
|
@@ -714,7 +715,7 @@ var SocketWrapper = class {
|
|
|
714
715
|
this.setupConnection = (io) => {
|
|
715
716
|
try {
|
|
716
717
|
if (!this.data.listeners) throw new Error("No listeners provided");
|
|
717
|
-
this.namespace = io.of(`/${this.
|
|
718
|
+
this.namespace = io.of(`/${this.socketNamespace}`);
|
|
718
719
|
if (this.data.connectionMiddleware) {
|
|
719
720
|
io.use(async (client, next) => {
|
|
720
721
|
const commId = client.handshake.query.commId;
|
|
@@ -734,26 +735,26 @@ var SocketWrapper = class {
|
|
|
734
735
|
const metadata = client.handshake.query.metadata;
|
|
735
736
|
const finalClientId = this.data.clientConnectionKey ? metadata?.[this.data.clientConnectionKey] ?? client.id : client.id;
|
|
736
737
|
this.connectedClients.set(finalClientId, { socket: client, connectedAt: /* @__PURE__ */ new Date(), metadata });
|
|
737
|
-
log.cyan(`[SOCKETWRAPPER] [${this.
|
|
738
|
+
log.cyan(`[SOCKETWRAPPER] [${this.socketNamespace.toUpperCase()}] Client ${client.id} connected`);
|
|
738
739
|
if (this.data.afterClientConnect) this.data.afterClientConnect(this, client, metadata);
|
|
739
740
|
for (const eventName in this.data.listeners) client.on(eventName, (...params) => this.data.listeners?.[eventName](this, client, metadata, ...params));
|
|
740
741
|
client.on("disconnect", () => this.handleDisconnection(client));
|
|
741
742
|
} catch (err) {
|
|
742
|
-
fullLogNok(`SOCKETWRAPPER`, `[${this.
|
|
743
|
+
fullLogNok(`SOCKETWRAPPER`, `[${this.socketNamespace.toUpperCase()}]`, err);
|
|
743
744
|
}
|
|
744
745
|
});
|
|
745
746
|
} catch (err) {
|
|
746
|
-
fullLogNok(`SOCKETWRAPPER`, `[${this.
|
|
747
|
+
fullLogNok(`SOCKETWRAPPER`, `[${this.socketNamespace.toUpperCase()}]`, err);
|
|
747
748
|
}
|
|
748
749
|
};
|
|
749
750
|
this.handleDisconnection = (client) => {
|
|
750
751
|
try {
|
|
751
752
|
if (!this.namespace) throw new Error("Socket.IO not initialized");
|
|
752
753
|
this.connectedClients.delete(client.id);
|
|
753
|
-
log.cyan(`[SOCKETWRAPPER] [${this.
|
|
754
|
+
log.cyan(`[SOCKETWRAPPER] [${this.socketNamespace.toUpperCase()}] Client ${client.id} disconnected`);
|
|
754
755
|
if (this.data.onClientDisconnect) this.data.onClientDisconnect(client);
|
|
755
756
|
} catch (err) {
|
|
756
|
-
fullLogNok(`SOCKETWRAPPER`, `[${this.
|
|
757
|
+
fullLogNok(`SOCKETWRAPPER`, `[${this.socketNamespace.toUpperCase()}]`, err);
|
|
757
758
|
}
|
|
758
759
|
};
|
|
759
760
|
// --- SEND METHODS
|
|
@@ -762,7 +763,7 @@ var SocketWrapper = class {
|
|
|
762
763
|
if (!this.namespace) throw new Error("Socket.IO not initialized");
|
|
763
764
|
this.namespace.emit(eventName, data);
|
|
764
765
|
} catch (err) {
|
|
765
|
-
fullLogNok(`SOCKETWRAPPER`, `[${this.
|
|
766
|
+
fullLogNok(`SOCKETWRAPPER`, `[${this.socketNamespace.toUpperCase()}]`, err);
|
|
766
767
|
}
|
|
767
768
|
};
|
|
768
769
|
this.broadcastExceptClient = (clientId, eventName, data) => {
|
|
@@ -771,7 +772,7 @@ var SocketWrapper = class {
|
|
|
771
772
|
if (id !== clientId) client.socket.emit(eventName, data);
|
|
772
773
|
}
|
|
773
774
|
} catch (err) {
|
|
774
|
-
fullLogNok(`SOCKETWRAPPER`, `[${this.
|
|
775
|
+
fullLogNok(`SOCKETWRAPPER`, `[${this.socketNamespace.toUpperCase()}]`, err);
|
|
775
776
|
}
|
|
776
777
|
};
|
|
777
778
|
this.sendToClient = (clientId, eventName, data) => {
|
|
@@ -780,7 +781,7 @@ var SocketWrapper = class {
|
|
|
780
781
|
if (!connectedClient) throw new Error(`Client ${clientId} not found`);
|
|
781
782
|
connectedClient.socket.emit(eventName, data);
|
|
782
783
|
} catch (err) {
|
|
783
|
-
fullLogNok(`SOCKETWRAPPER`, `[${this.
|
|
784
|
+
fullLogNok(`SOCKETWRAPPER`, `[${this.socketNamespace.toUpperCase()}]`, err);
|
|
784
785
|
}
|
|
785
786
|
};
|
|
786
787
|
this.sendToRoom = (room, eventName, data) => {
|
|
@@ -788,7 +789,7 @@ var SocketWrapper = class {
|
|
|
788
789
|
if (!this.namespace) throw new Error("Socket.IO not initialized");
|
|
789
790
|
this.namespace.to(room).emit(eventName, data);
|
|
790
791
|
} catch (err) {
|
|
791
|
-
fullLogNok(`SOCKETWRAPPER`, `[${this.
|
|
792
|
+
fullLogNok(`SOCKETWRAPPER`, `[${this.socketNamespace.toUpperCase()}]`, err);
|
|
792
793
|
}
|
|
793
794
|
};
|
|
794
795
|
// --- GETTERS
|
|
@@ -800,7 +801,7 @@ var SocketWrapper = class {
|
|
|
800
801
|
}
|
|
801
802
|
return void 0;
|
|
802
803
|
};
|
|
803
|
-
this.
|
|
804
|
+
this.socketNamespace = data.socketNamespace;
|
|
804
805
|
this.data = data;
|
|
805
806
|
Object.keys(data.listeners ?? {}).forEach((key) => {
|
|
806
807
|
this[key] = data.listeners?.[key].bind(this);
|
|
@@ -957,6 +958,7 @@ export {
|
|
|
957
958
|
fullLogOk,
|
|
958
959
|
getCompiledPath,
|
|
959
960
|
log,
|
|
961
|
+
sleep,
|
|
960
962
|
socketNok,
|
|
961
963
|
socketOk
|
|
962
964
|
};
|