Skip to content

Commit

Permalink
* Fixed solaris-common imports and module import issues.
Browse files Browse the repository at this point in the history
* Updated wait() method in Mutex class to correct log message typo.
  • Loading branch information
Metritutus committed Jan 20, 2025
1 parent f99e0e9 commit 292c592
Show file tree
Hide file tree
Showing 20 changed files with 56 additions and 42 deletions.
4 changes: 2 additions & 2 deletions client/src/sockets/socketHandlers/clientHandler.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Emitter, type DefaultEventsMap } from '@socket.io/component-emitter';
import type { SocketEventName } from '@solaris-common';
import { Socket } from 'socket.io-client';
import type { SocketEventName } from 'solaris-common';
import type { Store } from 'vuex/types/index.js';
import GameHelper from '../../services/gameHelper';
import type { State } from '../../store';
import type { PlayerClientSocketEmitter } from '../socketEmitters/player';
import ClientSocketEventNames, { type ClientSocketEventType } from "../socketEventNames/client";
import type { State } from '../../store';

export class ClientHandler {

Expand Down
28 changes: 26 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/api/controllers/ledger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LedgerType } from 'solaris-common';
import { LedgerType } from '@solaris-common';
import { DependencyContainer } from '../../services/types/DependencyContainer';

export default (container: DependencyContainer) => {
Expand Down
21 changes: 11 additions & 10 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"version": "1.0.0",
"description": "",
"scripts": {
"test": "ts-node -P tsconfig.json --files ../node_modules/jasmine/bin/jasmine",
"start-jobs:dev": "ts-node-dev --transpile-only --respawn --inspect=9230 jobs/index.ts",
"start-jobs:prod": "node dist/server/jobs/index.js",
"start-api:dev": "ts-node-dev --transpile-only --respawn --inspect=9231 api/index.ts",
"start-api:prod": "node dist/server/api/index.js",
"start-db-migrate:dev": "ts-node-dev --transpile-only --respawn --inspect=9233 db/migrate.ts",
"test": "ts-node -r tsconfig-paths/register -P tsconfig.json --files ../node_modules/jasmine/bin/jasmine",
"start-jobs:dev": "ts-node-dev -r tsconfig-paths/register --transpile-only --respawn --inspect=9230 jobs/index.ts",
"start-jobs:prod": "node -r tsconfig-paths/register dist/server/jobs/index.js",
"start-api:dev": "ts-node-dev -r tsconfig-paths/register --transpile-only --respawn --inspect=9231 api/index.ts",
"start-api:prod": "node -r tsconfig-paths/register dist/server/api/index.js",
"start-db-migrate:dev": "ts-node-dev -r tsconfig-paths/register --transpile-only --respawn --inspect=9233 db/migrate.ts",
"start-db-migrate:prod": "node dist/server/db/migrate.js",
"start-db-recalc-ranks:dev": "ts-node-dev --transpile-only --respawn --inspect=9234 db/recalculateRankings.ts",
"start-db-recalc-ranks:prod": "node dist/server/db/recalculateRankings.js",
"restore-game": "ts-node-dev --transpile-only db/restoreGame.ts",
"start-db-recalc-ranks:dev": "ts-node-dev -r tsconfig-paths/register --transpile-only --respawn --inspect=9234 db/recalculateRankings.ts",
"start-db-recalc-ranks:prod": "node -r tsconfig-paths/register dist/server/db/recalculateRankings.js",
"restore-game": "ts-node-dev -r tsconfig-paths/register --transpile-only db/restoreGame.ts",
"prebuild": "rm -rf ./dist",
"build": "tsc",
"postbuild": "cp -r services/emailTemplates ./dist/server/services/emailTemplates && cp .env ./dist | true",
Expand Down Expand Up @@ -51,7 +51,8 @@
"random-seed": "^0.3.0",
"recaptcha-v2": "^0.1.3",
"simplex-noise": "^4.0.1",
"socket.io": "4.8.1"
"socket.io": "4.8.1",
"tsconfig-paths": "^4.2.0"
},
"devDependencies": {
"@types/connect-mongodb-session": "2.4.1",
Expand Down
5 changes: 1 addition & 4 deletions server/services/broadcast.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { GameState } from 'solaris-common';
import { ConversationMessageSentResult } from "solaris-common";
import { DiplomaticStatus } from 'solaris-common';
import { LedgerType } from 'solaris-common';
import { ConversationMessageSentResult, DiplomaticStatus, GameState, LedgerType } from '@solaris-common';
import { DiplomacyServerSocketEmitter } from '../sockets/socketEmitters/diplomacy';
import { GameServerSocketEmitter } from '../sockets/socketEmitters/game';
import { PlayerServerSocketEmitter } from '../sockets/socketEmitters/player';
Expand Down
2 changes: 1 addition & 1 deletion server/services/event.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LedgerType } from 'solaris-common';
import { LedgerType } from '@solaris-common';
import ValidationError from "../errors/validation";
import BadgeService, { BadgeServiceEvents } from "./badge";
import BroadcastService from "./broadcast";
Expand Down
2 changes: 1 addition & 1 deletion server/services/ledger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LedgerType } from "solaris-common";
import { LedgerType } from "@solaris-common";
import ValidationError from "../errors/validation";
import PlayerService from "./player";
import PlayerCreditsService from "./playerCredits";
Expand Down
2 changes: 1 addition & 1 deletion server/services/trade.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const EventEmitter = require('events');
const moment = require('moment');
import { LedgerType } from 'solaris-common';
import { LedgerType } from '@solaris-common';
import ValidationError from '../errors/validation';
import AchievementService from './achievement';
import DiplomacyService from './diplomacy';
Expand Down
2 changes: 1 addition & 1 deletion server/services/types/Guild.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SettingVisibility } from "solaris-common";
import { SettingVisibility } from "@solaris-common";
import { DBObjectId } from "./DBObjectId";
import { User } from "./User";

Expand Down
2 changes: 1 addition & 1 deletion server/services/types/Mutex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class Mutex {
return true;
}
else {
log.warn(`Cannot unlock Mutex wiht id ${this.id} as lockId does not match. Expected: ${lockId}, Actual: ${lockIdInput}`);
log.warn(`Cannot unlock Mutex with id ${this.id} as lockId does not match. Expected: ${lockId}, Actual: ${lockIdInput}`);
}

return false;
Expand Down
2 changes: 1 addition & 1 deletion server/services/types/User.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { UserGameSettings } from "@solaris-common";
import { DBObjectId } from "./DBObjectId";
import { UserLevel } from "./UserLevel";
import type { UserGameSettings } from "solaris-common";

export interface UserRoles {
administrator: boolean;
Expand Down
3 changes: 1 addition & 2 deletions server/sockets/socketEmitters/diplomacy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { DiplomacySocketEventNames, DiplomacySocketEventType, DiplomaticStatus } from "@solaris-common";
import { Server } from "socket.io";
import { DiplomaticStatus } from "solaris-common";
import { DiplomacySocketEventNames, DiplomacySocketEventType } from "solaris-common";
import { ServerSocketEmitter } from "./serverSocketEmitter";

export class DiplomacyServerSocketEmitter extends ServerSocketEmitter<DiplomacySocketEventType> {
Expand Down
3 changes: 1 addition & 2 deletions server/sockets/socketEmitters/game.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { GameSocketEventNames, GameSocketEventType, GameState } from "@solaris-common";
import { Server } from "socket.io";
import { GameState } from "solaris-common";
import { GameSocketEventNames, GameSocketEventType } from "solaris-common";
import { ServerSocketEmitter } from "./serverSocketEmitter";

export class GameServerSocketEmitter extends ServerSocketEmitter<GameSocketEventType> {
Expand Down
5 changes: 1 addition & 4 deletions server/sockets/socketEmitters/player.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { ConversationMessageSentResult, LedgerType, PlayerSocketEventNames, PlayerSocketEventType, TradeEventTechnology } from "@solaris-common";
import { Server } from "socket.io";
import { ConversationMessageSentResult } from "solaris-common";
import { LedgerType } from "solaris-common";
import { TradeEventTechnology } from "solaris-common";
import { PlayerSocketEventNames, PlayerSocketEventType } from "solaris-common";
import { ServerSocketEmitter } from "./serverSocketEmitter";

export class PlayerServerSocketEmitter extends ServerSocketEmitter<PlayerSocketEventType> {
Expand Down
3 changes: 1 addition & 2 deletions server/sockets/socketEmitters/serverSocketEmitter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SocketEmitter, type SocketEventName } from "@solaris-common";
import type { DefaultEventsMap, Server } from "socket.io";
import type { Room } from "socket.io-adapter";
import { SocketEmitter } from "solaris-common";
import { type SocketEventName } from "solaris-common";
import { TypedEventBroadcaster } from "../../../node_modules/socket.io/dist/typed-events";

export abstract class ServerSocketEmitter<TSocketEventType> extends SocketEmitter<TSocketEventType> {
Expand Down
3 changes: 1 addition & 2 deletions server/sockets/socketEventNames/server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { makeCastFunc, type SocketEventName } from "@solaris-common";
import { Socket } from "socket.io";
import { type SocketEventName } from "solaris-common";
import { makeCastFunc } from "solaris-common";

export type ServerSocketEventType = { serverSocketEventType: 'serverSocketEventType' };
export type ServerSocketEventName<TData> = SocketEventName<ServerSocketEventType, TData> & { serverSocketEventName: 'serverSocketEventName' };
Expand Down
2 changes: 1 addition & 1 deletion server/sockets/socketHandlers/player.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PlayerSocketEventNames, type PlayerSocketEventType } from '@solaris-common';
import type { Socket } from "socket.io";
import { PlayerSocketEventNames, type PlayerSocketEventType } from 'solaris-common';
import GameService from "../../services/game";
import SocketService from "../../services/socket";
import { objectIdFromString } from "../../services/types/DBObjectId";
Expand Down
2 changes: 1 addition & 1 deletion server/sockets/socketHandlers/serverHandler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SocketEventName } from "@solaris-common";
import { Logger } from "pino";
import type { Server, Socket } from "socket.io";
import { SocketEventName } from "solaris-common";
import { EventEmitter } from "stream";
import ServerSocketEventNames, { ServerSocketEventType } from "../socketEventNames/server";

Expand Down
3 changes: 1 addition & 2 deletions server/sockets/socketHandlers/serverSocketHandler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { SocketHandler, type SocketEventName } from "@solaris-common";
import type { Socket } from "socket.io";
import { type SocketEventName } from "solaris-common";
import { SocketHandler } from "solaris-common";
import { ServerHandler, ServerHandlerEvents } from "./serverHandler";

export abstract class ServerSocketHandler<TSocketEventType> extends SocketHandler<TSocketEventType> {
Expand Down
2 changes: 1 addition & 1 deletion server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"module": "commonjs",
"resolveJsonModule": true,
"sourceMap": true,
"outDir": "./dist/server",
"outDir": "./dist",
"noEmit": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
Expand Down

0 comments on commit 292c592

Please sign in to comment.