@gbraver-burst-network/browser-sdk 1.8.1 → 1.9.0

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.
@@ -1,6 +1,6 @@
1
- import type { Battle } from "@gbraver-burst-network/browser-core";
2
1
  import type { Command, GameState, Player } from "gbraver-burst-core";
3
2
  import { Observable } from "rxjs";
3
+ import { Battle } from "./battle";
4
4
  /** コンストラクタのパラメータ */
5
5
  type Param = {
6
6
  /** プレイヤー情報 */
@@ -0,0 +1,27 @@
1
+ import type { Command, GameState, Player } from "gbraver-burst-core";
2
+ import { Observable } from "rxjs";
3
+ /**
4
+ * バトル
5
+ * 本操作はログイン後に実行することを想定している
6
+ */
7
+ export interface Battle {
8
+ /** プレイヤーの情報 */
9
+ player: Player;
10
+ /** 対戦相手の情報 */
11
+ enemy: Player;
12
+ /** ゲームの初期状態 */
13
+ initialState: GameState[];
14
+ /**
15
+ * バトルを進行させる
16
+ *
17
+ * @param command プレイヤーが入力するコマンド
18
+ * @return ゲーム結果
19
+ */
20
+ progress(command: Command): Promise<GameState[]>;
21
+ /**
22
+ * バトル強制終了の通知ストリーム
23
+ *
24
+ * @return 通知ストリーム
25
+ */
26
+ suddenlyBattleNotifier(): Observable<unknown>;
27
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,9 @@
1
- import type { CasualMatch, LoggedInUserDelete, LoginCheck, Logout, MailVerify, Ping, PrivateMatchCreate, PrivateMatchRoomEnter, UniversalLogin, UserMailGet, UserNameGet, UserPictureGet, WebsocketDisconnect, WebsocketErrorNotifier } from "@gbraver-burst-network/browser-core";
1
+ import { CasualMatch } from "./casual-match";
2
+ import { LoginCheck, Logout, UniversalLogin } from "./login";
3
+ import { Ping } from "./ping";
4
+ import { PrivateMatchCreate, PrivateMatchRoomEnter } from "./private-match";
5
+ import { LoggedInUserDelete, MailVerify, UserMailGet, UserNameGet, UserPictureGet } from "./user";
6
+ import { WebsocketDisconnect, WebsocketErrorNotifier } from "./websocket";
2
7
  /** ブラウザSDK */
3
8
  export interface BrowserSDK extends UniversalLogin, LoginCheck, Logout, Ping, CasualMatch, UserNameGet, UserPictureGet, UserMailGet, MailVerify, LoggedInUserDelete, WebsocketDisconnect, WebsocketErrorNotifier, PrivateMatchCreate, PrivateMatchRoomEnter {
4
9
  }
@@ -0,0 +1,16 @@
1
+ import type { ArmDozerId, PilotId } from "gbraver-burst-core";
2
+ import type { Battle } from "./battle";
3
+ /**
4
+ * カジュアルマッチ
5
+ * 本操作はログイン後に実行することを想定している
6
+ */
7
+ export interface CasualMatch {
8
+ /**
9
+ * カジュアルマッチをスタートさせる
10
+ *
11
+ * @param armdozerId 選択したアームドーザID
12
+ * @param pilotId 選択したパイロットID
13
+ * @return バトル
14
+ */
15
+ startCasualMatch(armdozerId: ArmDozerId, pilotId: PilotId): Promise<Battle>;
16
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,39 @@
1
+ /** ユニバーサルログイン */
2
+ export interface UniversalLogin {
3
+ /**
4
+ * ログイン成功時のリダイレクトか否かを判定する
5
+ *
6
+ * @return 判定結果、trueでログイン成功時のリダイレクトである
7
+ */
8
+ isLoginSuccessRedirect(): boolean;
9
+ /**
10
+ * ログイン成功後の処理
11
+ *
12
+ * @return 処理完了後に発火するPromise
13
+ */
14
+ afterLoginSuccess(): Promise<void>;
15
+ /**
16
+ * ログインページに遷移する
17
+ *
18
+ * @return ログインページ遷移後に発火するPromise
19
+ */
20
+ gotoLoginPage(): Promise<void>;
21
+ }
22
+ /** ログインチェック */
23
+ export interface LoginCheck {
24
+ /**
25
+ * ログインしているかをチェックする
26
+ *
27
+ * @return ログインしている場合trueを返す
28
+ */
29
+ isLogin(): Promise<boolean>;
30
+ }
31
+ /** ログアウト */
32
+ export interface Logout {
33
+ /**
34
+ * ログアウトする
35
+ *
36
+ * @return ログアウト成功したら発火するPromise
37
+ */
38
+ logout(): Promise<void>;
39
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ export interface Ping {
2
+ /**
3
+ * APIサーバと疎通確認を行う
4
+ *
5
+ * @return APIサーバから返されたメッセージ
6
+ */
7
+ ping(): Promise<string>;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,5 @@
1
- import { Battle, PrivateMatchRoom, PrivateMatchRoomID } from "@gbraver-burst-network/browser-core";
1
+ import { Battle } from "./battle";
2
+ import { PrivateMatchRoom, PrivateMatchRoomID } from "./private-match";
2
3
  /** プライベートマッチSDK */
3
4
  export declare class PrivateMatchRoomSDK implements PrivateMatchRoom {
4
5
  #private;
@@ -0,0 +1,36 @@
1
+ import { ArmDozerId, PilotId } from "gbraver-burst-core";
2
+ import { Battle } from "./battle";
3
+ /** プライベートマッチルーム生成 */
4
+ export interface PrivateMatchCreate {
5
+ /**
6
+ * プライベートマッチルームを生成する
7
+ * @param armdozerId 選択したアームドーザのID
8
+ * @param pilotId 選択したパイロットのID
9
+ * @return 生成したプライベートマッチルームのID
10
+ */
11
+ createPrivateMatchRoom(armdozerId: ArmDozerId, pilotId: PilotId): Promise<PrivateMatchRoom>;
12
+ }
13
+ /** プライベートマッチルームID */
14
+ export type PrivateMatchRoomID = string;
15
+ /** プライベートマッチルーム */
16
+ export interface PrivateMatchRoom {
17
+ /** ルームID、本プロパティを招待するユーザに共有する */
18
+ roomID: PrivateMatchRoomID;
19
+ /**
20
+ * マッチングが成立するまで待機する
21
+ * @return バトル
22
+ */
23
+ waitUntilMatching(): Promise<Battle>;
24
+ }
25
+ /** プライベートマッチルーム入室 */
26
+ export interface PrivateMatchRoomEnter {
27
+ /**
28
+ * プライベートマッチルームに入室する
29
+ * マッチングに選ばれた場合はBattleを返すが、選ばれなかった場合はnullを返す
30
+ * @param private 入室するルームのID
31
+ * @param armdozerId 選択したアームドーザ
32
+ * @param pilotId 選択したパイロット
33
+ * @return マッチング結果
34
+ */
35
+ enterPrivateMatchRoom(roomID: PrivateMatchRoomID, armdozerId: ArmDozerId, pilotId: PilotId): Promise<Battle | null>;
36
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,45 @@
1
+ /** ユーザ名取得 */
2
+ export interface UserNameGet {
3
+ /**
4
+ * ユーザ名を取得する
5
+ *
6
+ * @return ユーザ名
7
+ */
8
+ getUserName(): Promise<string>;
9
+ }
10
+ /** ユーザ画像取得 */
11
+ export interface UserPictureGet {
12
+ /**
13
+ * ユーザ画像URLを取得する
14
+ *
15
+ * @return ユーザ画像URL
16
+ */
17
+ getUserPictureURL(): Promise<string>;
18
+ }
19
+ /** ユーザメールアドレス取得 */
20
+ export interface UserMailGet {
21
+ /**
22
+ * メールアドレスを取得する
23
+ *
24
+ * @return メールアドレス
25
+ */
26
+ getMail(): Promise<string>;
27
+ }
28
+ /** メール認証完了 */
29
+ export interface MailVerify {
30
+ /**
31
+ * メール認証が完了しているか否か
32
+ *
33
+ * @return 判定結果、trueでメール認証が完了している
34
+ */
35
+ isMailVerified(): Promise<boolean>;
36
+ }
37
+ /** ユーザ削除削除 */
38
+ export interface LoggedInUserDelete {
39
+ /**
40
+ * 現在ログインしているユーザを削除する
41
+ *
42
+ * @return 処理が完了したら発火するPromise
43
+ */
44
+ deleteLoggedInUser(): Promise<void>;
45
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ import { Observable } from "rxjs";
2
+ /** Websocket切断 */
3
+ export interface WebsocketDisconnect {
4
+ /**
5
+ * 内部的に保有するWebsocketコネクションを切断する
6
+ *
7
+ * @return 処理が完了したら発火するPromise
8
+ */
9
+ disconnectWebsocket(): Promise<unknown>;
10
+ }
11
+ /** Websocket エラー通知 */
12
+ export interface WebsocketErrorNotifier {
13
+ /**
14
+ * WebSocketのエラーを通知する
15
+ *
16
+ * @return 通知ストリーム
17
+ */
18
+ websocketErrorNotifier(): Observable<unknown>;
19
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,9 @@
1
+ export type { Battle } from "./browser-sdk/battle";
1
2
  export type { BrowserSDK } from "./browser-sdk/browser-sdk";
2
3
  export { createBrowserSDK } from "./browser-sdk/browser-sdk";
4
+ export type { CasualMatch } from "./browser-sdk/casual-match";
5
+ export type { LoginCheck, Logout, UniversalLogin } from "./browser-sdk/login";
6
+ export type { Ping } from "./browser-sdk/ping";
7
+ export type { PrivateMatchCreate, PrivateMatchRoom, PrivateMatchRoomEnter, PrivateMatchRoomID, } from "./browser-sdk/private-match";
8
+ export type { LoggedInUserDelete, MailVerify, UserMailGet, UserNameGet, UserPictureGet, } from "./browser-sdk/user";
9
+ export type { WebsocketDisconnect, WebsocketErrorNotifier, } from "./browser-sdk/websocket";
@@ -1,5 +1,5 @@
1
- import { PrivateMatchRoomID } from "@gbraver-burst-network/browser-core";
2
1
  import { ArmDozerId, PilotId } from "gbraver-burst-core";
2
+ import { PrivateMatchRoomID } from "../browser-sdk/private-match";
3
3
  /** プライベートマッチルームエントリ */
4
4
  export type EnterPrivateMatchRoom = {
5
5
  action: "enter-private-match-room";
@@ -1,5 +1,5 @@
1
- import { PrivateMatchRoomID } from "@gbraver-burst-network/browser-core";
2
1
  /** プライベートルームマッチポーリング */
2
+ import { PrivateMatchRoomID } from "../browser-sdk/private-match";
3
3
  export type PrivateMatchMakePolling = {
4
4
  action: "private-match-make-polling";
5
5
  /** ルームID */
@@ -1,5 +1,5 @@
1
- import { PrivateMatchRoomID } from "@gbraver-burst-network/browser-core";
2
1
  import { ArmDozerId, PilotId } from "gbraver-burst-core";
2
+ import { PrivateMatchRoomID } from "../browser-sdk/private-match";
3
3
  import { BattleStart } from "../response/battle-start";
4
4
  import { RejectPrivateMatchEntry } from "../response/reject-private-match-entry";
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { PrivateMatchRoomID } from "@gbraver-burst-network/browser-core";
1
+ import { PrivateMatchRoomID } from "../browser-sdk/private-match";
2
2
  import { BattleStart } from "../response/battle-start";
3
3
  /**
4
4
  * プライベートマッチングポーリング
package/package.json CHANGED
@@ -1,39 +1,38 @@
1
1
  {
2
2
  "name": "@gbraver-burst-network/browser-sdk",
3
3
  "description": "gbraver burst browser sdk",
4
- "version": "1.8.1",
4
+ "version": "1.9.0",
5
5
  "author": "Y.Takeuchi",
6
6
  "bugs": {
7
7
  "url": "https://github.com/kaidouji85/gbraver-burst-network/issues",
8
8
  "email": "kaidouji85@gmail.com"
9
9
  },
10
10
  "dependencies": {
11
- "@auth0/auth0-spa-js": "^2.0.2",
12
- "@gbraver-burst-network/browser-core": "^1.8.1",
11
+ "@auth0/auth0-spa-js": "^2.0.4",
13
12
  "gbraver-burst-core": "^1.16.4",
14
13
  "rxjs": "^7.8.0"
15
14
  },
16
15
  "devDependencies": {
17
16
  "@types/jest": "^29.4.0",
18
- "@typescript-eslint/eslint-plugin": "^5.49.0",
19
- "@typescript-eslint/parser": "^5.49.0",
17
+ "@typescript-eslint/eslint-plugin": "^5.53.0",
18
+ "@typescript-eslint/parser": "^5.53.0",
20
19
  "codehawk-cli": "^10.1.0",
21
- "eslint": "^8.33.0",
20
+ "eslint": "^8.34.0",
22
21
  "eslint-plugin-jest": "^27.2.1",
23
22
  "eslint-plugin-simple-import-sort": "^10.0.0",
24
- "jest": "^29.4.1",
23
+ "jest": "^29.4.3",
25
24
  "npm-run-all": "^4.1.5",
26
- "prettier": "2.8.3",
25
+ "prettier": "2.8.4",
27
26
  "rimraf": "^4.1.2",
28
27
  "ts-jest": "^29.0.5",
29
- "typescript": "^4.9.4",
28
+ "typescript": "^4.9.5",
30
29
  "webpack": "^5.75.0",
31
30
  "webpack-cli": "^5.0.1"
32
31
  },
33
32
  "files": [
34
33
  "lib"
35
34
  ],
36
- "gitHead": "3ac3152242f02a6373680fceb87bb3b2e2c373a5",
35
+ "gitHead": "ab2f3ddfb2860d73404111c0986c9277f843e558",
37
36
  "homepage": "https://github.com/kaidouji85/gbraver-burst-network/tree/develop/packages/browser-sdk#readme",
38
37
  "keywords": [
39
38
  "browser",