@gbraver-burst-network/browser-sdk 1.13.0 → 1.14.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.
- package/lib/src/browser-sdk/create-battle-sdk-from-battle-start.js +1 -2
- package/lib/src/browser-sdk/index.d.ts +3 -9
- package/lib/src/browser-sdk/index.js +32 -66
- package/lib/src/browser-sdk/login.d.ts +0 -15
- package/lib/src/browser-sdk/user.d.ts +1 -13
- package/lib/src/index.d.ts +2 -1
- package/lib/src/index.js +3 -1
- package/lib/src/initialize-browser-sdk.d.ts +18 -0
- package/lib/src/initialize-browser-sdk.js +34 -0
- package/lib/src/json/parse.js +1 -2
- package/lib/src/response/accept-command.js +2 -2
- package/lib/src/response/battle-end.js +2 -2
- package/lib/src/response/battle-progressed.js +2 -2
- package/lib/src/response/battle-start.js +2 -2
- package/lib/src/response/cloud-not-private-match-making.js +2 -2
- package/lib/src/response/created-private-match-room.js +2 -2
- package/lib/src/response/entered-casual-match.js +2 -2
- package/lib/src/response/not-ready-battle-progress.js +2 -2
- package/lib/src/response/pong.js +2 -2
- package/lib/src/response/reject-private-match-entry.js +2 -2
- package/lib/src/response/suddenly-battle-end.js +2 -2
- package/lib/src/wait/wait.js +1 -2
- package/lib/src/websocket/connect.js +1 -2
- package/lib/src/websocket/create-private-match-room.js +1 -2
- package/lib/src/websocket/enter-casual-match.js +1 -2
- package/lib/src/websocket/enter-private-match-room.js +1 -2
- package/lib/src/websocket/ping.js +1 -2
- package/lib/src/websocket/private-match-make-polling.js +1 -2
- package/lib/src/websocket/send-command.js +2 -3
- package/lib/src/websocket/send-to-api-server.js +1 -2
- package/lib/src/websocket/wait-until.js +1 -2
- package/package.json +6 -6
- package/lib/src/auth0/client.d.ts +0 -11
- package/lib/src/auth0/client.js +0 -24
- package/lib/src/auth0/login-redirect.d.ts +0 -11
- package/lib/src/auth0/login-redirect.js +0 -21
- package/lib/src/http-request/delete-user.d.ts +0 -8
- package/lib/src/http-request/delete-user.js +0 -31
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createBattleSDKFromBattleStart =
|
|
3
|
+
exports.createBattleSDKFromBattleStart = createBattleSDKFromBattleStart;
|
|
4
4
|
const battle_sdk_1 = require("./battle-sdk");
|
|
5
5
|
/**
|
|
6
6
|
* BattleStartからBattleSDKを生成する
|
|
@@ -19,4 +19,3 @@ function createBattleSDKFromBattleStart(battleStart, websocket) {
|
|
|
19
19
|
websocket,
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
exports.createBattleSDKFromBattleStart = createBattleSDKFromBattleStart;
|
|
@@ -2,20 +2,14 @@ import { CasualMatch } from "./casual-match";
|
|
|
2
2
|
import { LoginCheck, Logout, UniversalLogin } from "./login";
|
|
3
3
|
import { Ping } from "./ping";
|
|
4
4
|
import { PrivateMatchCreate, PrivateMatchRoomEnter } from "./private-match";
|
|
5
|
-
import { LoggedInUserDelete,
|
|
5
|
+
import { LoggedInUserDelete, UserMailGet, UserNameGet, UserPictureGet } from "./user";
|
|
6
6
|
import { WebsocketDisconnect, WebsocketErrorNotifier } from "./websocket";
|
|
7
7
|
/** ブラウザSDK */
|
|
8
|
-
export interface BrowserSDK extends UniversalLogin, LoginCheck, Logout, Ping, CasualMatch, UserNameGet, UserPictureGet, UserMailGet,
|
|
8
|
+
export interface BrowserSDK extends UniversalLogin, LoginCheck, Logout, Ping, CasualMatch, UserNameGet, UserPictureGet, UserMailGet, LoggedInUserDelete, WebsocketDisconnect, WebsocketErrorNotifier, PrivateMatchCreate, PrivateMatchRoomEnter {
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* GブレイバーバーストブラウザSDKを生成する
|
|
12
|
-
*
|
|
13
|
-
* @param ownURL リダイレクト元となるGブレイバーバーストのURL
|
|
14
|
-
* @param restAPIURL Rest API のURL
|
|
15
12
|
* @param websocketAPIURL Websocket APIのURL
|
|
16
|
-
* @param auth0Domain auth0ドメイン
|
|
17
|
-
* @param auth0ClientID auth0クライアントID
|
|
18
|
-
* @param auth0Audience auth0 audience
|
|
19
13
|
* @returns GブレイバーバーストブラウザSDK
|
|
20
14
|
*/
|
|
21
|
-
export declare function createBrowserSDK(
|
|
15
|
+
export declare function createBrowserSDK(websocketAPIURL: string): Promise<BrowserSDK>;
|
|
@@ -19,13 +19,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
19
19
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
20
20
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
21
21
|
};
|
|
22
|
-
var _BrowserSDKImpl_instances,
|
|
22
|
+
var _BrowserSDKImpl_instances, _BrowserSDKImpl_websocketAPIURL, _BrowserSDKImpl_websocket, _BrowserSDKImpl_websocketError, _BrowserSDKImpl_websocketSubscriptions, _BrowserSDKImpl_getOrCreateWebSocket;
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.createBrowserSDK =
|
|
24
|
+
exports.createBrowserSDK = createBrowserSDK;
|
|
25
|
+
const auth_1 = require("aws-amplify/auth");
|
|
25
26
|
const rxjs_1 = require("rxjs");
|
|
26
|
-
const client_1 = require("../auth0/client");
|
|
27
|
-
const login_redirect_1 = require("../auth0/login-redirect");
|
|
28
|
-
const delete_user_1 = require("../http-request/delete-user");
|
|
29
27
|
const connect_1 = require("../websocket/connect");
|
|
30
28
|
const create_private_match_room_1 = require("../websocket/create-private-match-room");
|
|
31
29
|
const enter_casual_match_1 = require("../websocket/enter-casual-match");
|
|
@@ -37,101 +35,75 @@ const private_match_room_sdk_1 = require("./private-match-room-sdk");
|
|
|
37
35
|
class BrowserSDKImpl {
|
|
38
36
|
/**
|
|
39
37
|
* コンストラクタ
|
|
40
|
-
*
|
|
41
|
-
* @param ownURL リダイレクト元となるGブレイバーバーストのURL
|
|
42
|
-
* @param restAPIURL Rest API のURL
|
|
43
38
|
* @param websocketAPIURL Websocket API のURL
|
|
44
|
-
* @param auth0Client auth0クライアント
|
|
45
39
|
*/
|
|
46
|
-
constructor(
|
|
40
|
+
constructor(websocketAPIURL) {
|
|
47
41
|
_BrowserSDKImpl_instances.add(this);
|
|
48
|
-
|
|
49
|
-
_BrowserSDKImpl_restAPIURL.set(this, void 0);
|
|
42
|
+
/** Web Socket APIのURL */
|
|
50
43
|
_BrowserSDKImpl_websocketAPIURL.set(this, void 0);
|
|
51
|
-
|
|
44
|
+
/** Web Socket クライアント */
|
|
52
45
|
_BrowserSDKImpl_websocket.set(this, void 0);
|
|
46
|
+
/** Web Socket エラー通知 */
|
|
53
47
|
_BrowserSDKImpl_websocketError.set(this, void 0);
|
|
48
|
+
/** Web Socket イベントストリーム */
|
|
54
49
|
_BrowserSDKImpl_websocketSubscriptions.set(this, void 0);
|
|
55
|
-
__classPrivateFieldSet(this, _BrowserSDKImpl_ownURL, ownURL, "f");
|
|
56
|
-
__classPrivateFieldSet(this, _BrowserSDKImpl_restAPIURL, restAPIURL, "f");
|
|
57
50
|
__classPrivateFieldSet(this, _BrowserSDKImpl_websocketAPIURL, websocketAPIURL, "f");
|
|
58
|
-
__classPrivateFieldSet(this, _BrowserSDKImpl_auth0Client, auth0Client, "f");
|
|
59
51
|
__classPrivateFieldSet(this, _BrowserSDKImpl_websocket, null, "f");
|
|
60
52
|
__classPrivateFieldSet(this, _BrowserSDKImpl_websocketError, new rxjs_1.Subject(), "f");
|
|
61
53
|
__classPrivateFieldSet(this, _BrowserSDKImpl_websocketSubscriptions, [], "f");
|
|
62
54
|
}
|
|
63
55
|
/** @override */
|
|
64
|
-
isLoginSuccessRedirect() {
|
|
65
|
-
return (0, login_redirect_1.isLoginSuccessRedirect)();
|
|
66
|
-
}
|
|
67
|
-
/** @override */
|
|
68
|
-
afterLoginSuccess() {
|
|
69
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
yield __classPrivateFieldGet(this, _BrowserSDKImpl_auth0Client, "f").handleRedirectCallback();
|
|
71
|
-
(0, login_redirect_1.clearLoginHistory)();
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
/** @override */
|
|
75
56
|
gotoLoginPage() {
|
|
76
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
yield
|
|
78
|
-
authorizationParams: {
|
|
79
|
-
redirect_uri: __classPrivateFieldGet(this, _BrowserSDKImpl_ownURL, "f"),
|
|
80
|
-
},
|
|
81
|
-
});
|
|
58
|
+
yield (0, auth_1.signInWithRedirect)();
|
|
82
59
|
});
|
|
83
60
|
}
|
|
84
61
|
/** @override */
|
|
85
62
|
isLogin() {
|
|
86
|
-
return
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
try {
|
|
65
|
+
yield (0, auth_1.getCurrentUser)();
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
catch (_a) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
87
72
|
}
|
|
88
73
|
/** @override */
|
|
89
74
|
logout() {
|
|
90
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
yield
|
|
92
|
-
logoutParams: {
|
|
93
|
-
returnTo: __classPrivateFieldGet(this, _BrowserSDKImpl_ownURL, "f"),
|
|
94
|
-
},
|
|
95
|
-
});
|
|
76
|
+
yield (0, auth_1.signOut)();
|
|
96
77
|
});
|
|
97
78
|
}
|
|
98
79
|
/** @override */
|
|
99
80
|
getUserName() {
|
|
100
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
101
82
|
var _a;
|
|
102
|
-
const
|
|
103
|
-
return (_a =
|
|
83
|
+
const userAttributes = yield (0, auth_1.fetchUserAttributes)();
|
|
84
|
+
return (_a = userAttributes === null || userAttributes === void 0 ? void 0 : userAttributes.preferred_username) !== null && _a !== void 0 ? _a : "";
|
|
104
85
|
});
|
|
105
86
|
}
|
|
106
87
|
/** @override */
|
|
107
88
|
getUserPictureURL() {
|
|
108
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
109
90
|
var _a;
|
|
110
|
-
const
|
|
111
|
-
return (_a =
|
|
91
|
+
const userAttributes = yield (0, auth_1.fetchUserAttributes)();
|
|
92
|
+
return (_a = userAttributes === null || userAttributes === void 0 ? void 0 : userAttributes.picture) !== null && _a !== void 0 ? _a : "";
|
|
112
93
|
});
|
|
113
94
|
}
|
|
114
95
|
/** @override */
|
|
115
96
|
getMail() {
|
|
116
97
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
98
|
var _a;
|
|
118
|
-
const
|
|
119
|
-
return (_a =
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
/** @override */
|
|
123
|
-
isMailVerified() {
|
|
124
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
var _a;
|
|
126
|
-
const user = yield __classPrivateFieldGet(this, _BrowserSDKImpl_auth0Client, "f").getUser();
|
|
127
|
-
return (_a = user === null || user === void 0 ? void 0 : user.email_verified) !== null && _a !== void 0 ? _a : false;
|
|
99
|
+
const userAttributes = yield (0, auth_1.fetchUserAttributes)();
|
|
100
|
+
return (_a = userAttributes === null || userAttributes === void 0 ? void 0 : userAttributes.email) !== null && _a !== void 0 ? _a : "";
|
|
128
101
|
});
|
|
129
102
|
}
|
|
130
103
|
/** @override */
|
|
131
104
|
deleteLoggedInUser() {
|
|
132
105
|
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
-
|
|
134
|
-
yield (0, delete_user_1.deleteLoggedInUser)(__classPrivateFieldGet(this, _BrowserSDKImpl_restAPIURL, "f"), accessToken);
|
|
106
|
+
yield (0, auth_1.deleteUser)();
|
|
135
107
|
});
|
|
136
108
|
}
|
|
137
109
|
/** @override */
|
|
@@ -185,12 +157,14 @@ class BrowserSDKImpl {
|
|
|
185
157
|
return __classPrivateFieldGet(this, _BrowserSDKImpl_websocketError, "f");
|
|
186
158
|
}
|
|
187
159
|
}
|
|
188
|
-
|
|
160
|
+
_BrowserSDKImpl_websocketAPIURL = new WeakMap(), _BrowserSDKImpl_websocket = new WeakMap(), _BrowserSDKImpl_websocketError = new WeakMap(), _BrowserSDKImpl_websocketSubscriptions = new WeakMap(), _BrowserSDKImpl_instances = new WeakSet(), _BrowserSDKImpl_getOrCreateWebSocket = function _BrowserSDKImpl_getOrCreateWebSocket() {
|
|
189
161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
var _a, _b;
|
|
190
163
|
if (__classPrivateFieldGet(this, _BrowserSDKImpl_websocket, "f")) {
|
|
191
164
|
return __classPrivateFieldGet(this, _BrowserSDKImpl_websocket, "f");
|
|
192
165
|
}
|
|
193
|
-
const
|
|
166
|
+
const authSession = yield (0, auth_1.fetchAuthSession)();
|
|
167
|
+
const accessToken = (_b = (_a = authSession.tokens) === null || _a === void 0 ? void 0 : _a.accessToken.toString()) !== null && _b !== void 0 ? _b : "";
|
|
194
168
|
const websocket = yield (0, connect_1.connect)(`${__classPrivateFieldGet(this, _BrowserSDKImpl_websocketAPIURL, "f")}?token=${accessToken}`);
|
|
195
169
|
__classPrivateFieldSet(this, _BrowserSDKImpl_websocketSubscriptions, [
|
|
196
170
|
(0, rxjs_1.fromEvent)(websocket, "error").subscribe(__classPrivateFieldGet(this, _BrowserSDKImpl_websocketError, "f")),
|
|
@@ -202,19 +176,11 @@ _BrowserSDKImpl_ownURL = new WeakMap(), _BrowserSDKImpl_restAPIURL = new WeakMap
|
|
|
202
176
|
};
|
|
203
177
|
/**
|
|
204
178
|
* GブレイバーバーストブラウザSDKを生成する
|
|
205
|
-
*
|
|
206
|
-
* @param ownURL リダイレクト元となるGブレイバーバーストのURL
|
|
207
|
-
* @param restAPIURL Rest API のURL
|
|
208
179
|
* @param websocketAPIURL Websocket APIのURL
|
|
209
|
-
* @param auth0Domain auth0ドメイン
|
|
210
|
-
* @param auth0ClientID auth0クライアントID
|
|
211
|
-
* @param auth0Audience auth0 audience
|
|
212
180
|
* @returns GブレイバーバーストブラウザSDK
|
|
213
181
|
*/
|
|
214
|
-
function createBrowserSDK(
|
|
182
|
+
function createBrowserSDK(websocketAPIURL) {
|
|
215
183
|
return __awaiter(this, void 0, void 0, function* () {
|
|
216
|
-
|
|
217
|
-
return new BrowserSDKImpl(ownURL, restAPIURL, websocketAPIURL, auth0Client);
|
|
184
|
+
return new BrowserSDKImpl(websocketAPIURL);
|
|
218
185
|
});
|
|
219
186
|
}
|
|
220
|
-
exports.createBrowserSDK = createBrowserSDK;
|
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
/** ユニバーサルログイン */
|
|
2
2
|
export interface UniversalLogin {
|
|
3
|
-
/**
|
|
4
|
-
* ログイン成功時のリダイレクトか否かを判定する
|
|
5
|
-
*
|
|
6
|
-
* @returns 判定結果、trueでログイン成功時のリダイレクトである
|
|
7
|
-
*/
|
|
8
|
-
isLoginSuccessRedirect(): boolean;
|
|
9
|
-
/**
|
|
10
|
-
* ログイン成功後の処理
|
|
11
|
-
*
|
|
12
|
-
* @returns 処理完了後に発火するPromise
|
|
13
|
-
*/
|
|
14
|
-
afterLoginSuccess(): Promise<void>;
|
|
15
3
|
/**
|
|
16
4
|
* ログインページに遷移する
|
|
17
|
-
*
|
|
18
5
|
* @returns ログインページ遷移後に発火するPromise
|
|
19
6
|
*/
|
|
20
7
|
gotoLoginPage(): Promise<void>;
|
|
@@ -23,7 +10,6 @@ export interface UniversalLogin {
|
|
|
23
10
|
export interface LoginCheck {
|
|
24
11
|
/**
|
|
25
12
|
* ログインしているかをチェックする
|
|
26
|
-
*
|
|
27
13
|
* @returns ログインしている場合trueを返す
|
|
28
14
|
*/
|
|
29
15
|
isLogin(): Promise<boolean>;
|
|
@@ -32,7 +18,6 @@ export interface LoginCheck {
|
|
|
32
18
|
export interface Logout {
|
|
33
19
|
/**
|
|
34
20
|
* ログアウトする
|
|
35
|
-
*
|
|
36
21
|
* @returns ログアウト成功したら発火するPromise
|
|
37
22
|
*/
|
|
38
23
|
logout(): Promise<void>;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
export interface UserNameGet {
|
|
3
3
|
/**
|
|
4
4
|
* ユーザ名を取得する
|
|
5
|
-
*
|
|
6
5
|
* @returns ユーザ名
|
|
7
6
|
*/
|
|
8
7
|
getUserName(): Promise<string>;
|
|
@@ -11,7 +10,6 @@ export interface UserNameGet {
|
|
|
11
10
|
export interface UserPictureGet {
|
|
12
11
|
/**
|
|
13
12
|
* ユーザ画像URLを取得する
|
|
14
|
-
*
|
|
15
13
|
* @returns ユーザ画像URL
|
|
16
14
|
*/
|
|
17
15
|
getUserPictureURL(): Promise<string>;
|
|
@@ -20,25 +18,15 @@ export interface UserPictureGet {
|
|
|
20
18
|
export interface UserMailGet {
|
|
21
19
|
/**
|
|
22
20
|
* メールアドレスを取得する
|
|
23
|
-
*
|
|
24
21
|
* @returns メールアドレス
|
|
25
22
|
*/
|
|
26
23
|
getMail(): Promise<string>;
|
|
27
24
|
}
|
|
28
|
-
/** メール認証完了 */
|
|
29
|
-
export interface MailVerify {
|
|
30
|
-
/**
|
|
31
|
-
* メール認証が完了しているか否か
|
|
32
|
-
*
|
|
33
|
-
* @returns 判定結果、trueでメール認証が完了している
|
|
34
|
-
*/
|
|
35
|
-
isMailVerified(): Promise<boolean>;
|
|
36
|
-
}
|
|
37
25
|
/** ユーザ削除削除 */
|
|
38
26
|
export interface LoggedInUserDelete {
|
|
39
27
|
/**
|
|
40
28
|
* 現在ログインしているユーザを削除する
|
|
41
|
-
*
|
|
29
|
+
* 本関数はユーザー削除後にログアウト処理を行うため、Hosted UIにリダイレクトする
|
|
42
30
|
* @returns 処理が完了したら発火するPromise
|
|
43
31
|
*/
|
|
44
32
|
deleteLoggedInUser(): Promise<void>;
|
package/lib/src/index.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export { CasualMatch } from "./browser-sdk/casual-match";
|
|
|
4
4
|
export { LoginCheck, Logout, UniversalLogin } from "./browser-sdk/login";
|
|
5
5
|
export { Ping } from "./browser-sdk/ping";
|
|
6
6
|
export { PrivateMatchCreate, PrivateMatchRoom, PrivateMatchRoomEnter, PrivateMatchRoomID, } from "./browser-sdk/private-match";
|
|
7
|
-
export { LoggedInUserDelete,
|
|
7
|
+
export { LoggedInUserDelete, UserMailGet, UserNameGet, UserPictureGet, } from "./browser-sdk/user";
|
|
8
8
|
export { WebsocketDisconnect, WebsocketErrorNotifier, } from "./browser-sdk/websocket";
|
|
9
|
+
export { initializeBrowserSDK } from "./initialize-browser-sdk";
|
package/lib/src/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createBrowserSDK = void 0;
|
|
3
|
+
exports.initializeBrowserSDK = exports.createBrowserSDK = void 0;
|
|
4
4
|
var browser_sdk_1 = require("./browser-sdk");
|
|
5
5
|
Object.defineProperty(exports, "createBrowserSDK", { enumerable: true, get: function () { return browser_sdk_1.createBrowserSDK; } });
|
|
6
|
+
var initialize_browser_sdk_1 = require("./initialize-browser-sdk");
|
|
7
|
+
Object.defineProperty(exports, "initializeBrowserSDK", { enumerable: true, get: function () { return initialize_browser_sdk_1.initializeBrowserSDK; } });
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** 初期化パラメータ */
|
|
2
|
+
type InitializeParams = {
|
|
3
|
+
/** Cognito ユーザープールID */
|
|
4
|
+
userPoolId: string;
|
|
5
|
+
/** Cognito ユーザープール クライアントID */
|
|
6
|
+
userPoolClientId: string;
|
|
7
|
+
/** Cognito Hosted UI ドメイン */
|
|
8
|
+
hostedUIDomain: string;
|
|
9
|
+
/** アプリケーションをホストしているURL(Hosted UI ログイン後のリダイレクトURL) */
|
|
10
|
+
ownURL: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* ブラウザSDKの初期化を行う
|
|
14
|
+
* 本関数はアプリケーション開始直後に1回だけ呼び出すこと
|
|
15
|
+
* @param params 初期化パラメータ
|
|
16
|
+
*/
|
|
17
|
+
export declare function initializeBrowserSDK(params: InitializeParams): void;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initializeBrowserSDK = initializeBrowserSDK;
|
|
4
|
+
const aws_amplify_1 = require("aws-amplify");
|
|
5
|
+
/**
|
|
6
|
+
* ブラウザSDKの初期化を行う
|
|
7
|
+
* 本関数はアプリケーション開始直後に1回だけ呼び出すこと
|
|
8
|
+
* @param params 初期化パラメータ
|
|
9
|
+
*/
|
|
10
|
+
function initializeBrowserSDK(params) {
|
|
11
|
+
aws_amplify_1.Amplify.configure({
|
|
12
|
+
Auth: {
|
|
13
|
+
Cognito: {
|
|
14
|
+
userPoolId: params.userPoolId,
|
|
15
|
+
userPoolClientId: params.userPoolClientId,
|
|
16
|
+
loginWith: {
|
|
17
|
+
oauth: {
|
|
18
|
+
domain: params.hostedUIDomain,
|
|
19
|
+
scopes: [
|
|
20
|
+
"openid",
|
|
21
|
+
"email",
|
|
22
|
+
"profile",
|
|
23
|
+
"phone",
|
|
24
|
+
"aws.cognito.signin.user.admin",
|
|
25
|
+
],
|
|
26
|
+
redirectSignIn: [params.ownURL],
|
|
27
|
+
redirectSignOut: [params.ownURL],
|
|
28
|
+
responseType: "code",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}
|
package/lib/src/json/parse.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseJSON =
|
|
3
|
+
exports.parseJSON = parseJSON;
|
|
4
4
|
/**
|
|
5
5
|
* JSONパースを行う
|
|
6
6
|
* JSONパースできなかった場合はnullを返す
|
|
@@ -18,4 +18,3 @@ function parseJSON(origin) {
|
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
exports.parseJSON = parseJSON;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.AcceptCommandSchema = void 0;
|
|
4
|
+
exports.parseAcceptCommand = parseAcceptCommand;
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
/** AcceptCommand zodスキーマ */
|
|
6
7
|
exports.AcceptCommandSchema = zod_1.z.object({
|
|
@@ -16,4 +17,3 @@ function parseAcceptCommand(data) {
|
|
|
16
17
|
const result = exports.AcceptCommandSchema.safeParse(data);
|
|
17
18
|
return result.success ? result.data : null;
|
|
18
19
|
}
|
|
19
|
-
exports.parseAcceptCommand = parseAcceptCommand;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.BattleEndSchema = void 0;
|
|
4
|
+
exports.parseBattleEnd = parseBattleEnd;
|
|
4
5
|
const gbraver_burst_core_1 = require("gbraver-burst-core");
|
|
5
6
|
const zod_1 = require("zod");
|
|
6
7
|
/** BattleEnd zodスキーマ */
|
|
@@ -18,4 +19,3 @@ function parseBattleEnd(data) {
|
|
|
18
19
|
const result = exports.BattleEndSchema.safeParse(data);
|
|
19
20
|
return result.success ? result.data : null;
|
|
20
21
|
}
|
|
21
|
-
exports.parseBattleEnd = parseBattleEnd;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.BattleProgressedSchema = void 0;
|
|
4
|
+
exports.parseBattleProgressed = parseBattleProgressed;
|
|
4
5
|
const gbraver_burst_core_1 = require("gbraver-burst-core");
|
|
5
6
|
const zod_1 = require("zod");
|
|
6
7
|
/** BattleProgressed zodスキーマ */
|
|
@@ -19,4 +20,3 @@ function parseBattleProgressed(data) {
|
|
|
19
20
|
const result = exports.BattleProgressedSchema.safeParse(data);
|
|
20
21
|
return result.success ? result.data : null;
|
|
21
22
|
}
|
|
22
|
-
exports.parseBattleProgressed = parseBattleProgressed;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.BattleStartSchema = void 0;
|
|
4
|
+
exports.parseBattleStart = parseBattleStart;
|
|
4
5
|
const gbraver_burst_core_1 = require("gbraver-burst-core");
|
|
5
6
|
const zod_1 = require("zod");
|
|
6
7
|
/** BattleStart zodスキーマ */
|
|
@@ -23,4 +24,3 @@ function parseBattleStart(data) {
|
|
|
23
24
|
const result = exports.BattleStartSchema.safeParse(data);
|
|
24
25
|
return result.success ? result.data : null;
|
|
25
26
|
}
|
|
26
|
-
exports.parseBattleStart = parseBattleStart;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CouldNotPrivateMatchMakingSchema = void 0;
|
|
4
|
+
exports.parseCouldNotPrivateMatchMaking = parseCouldNotPrivateMatchMaking;
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
/** CouldNotPrivateMatchMaking zodスキーマ */
|
|
6
7
|
exports.CouldNotPrivateMatchMakingSchema = zod_1.z.object({
|
|
@@ -16,4 +17,3 @@ function parseCouldNotPrivateMatchMaking(origin) {
|
|
|
16
17
|
const result = exports.CouldNotPrivateMatchMakingSchema.safeParse(origin);
|
|
17
18
|
return result.success ? result.data : null;
|
|
18
19
|
}
|
|
19
|
-
exports.parseCouldNotPrivateMatchMaking = parseCouldNotPrivateMatchMaking;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CreatedPrivateMatchRoomSchema = void 0;
|
|
4
|
+
exports.parseCreatedPrivateMatchRoom = parseCreatedPrivateMatchRoom;
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
/** CreatedPrivateMatchRoom zodスキーマ */
|
|
6
7
|
exports.CreatedPrivateMatchRoomSchema = zod_1.z.object({
|
|
@@ -17,4 +18,3 @@ function parseCreatedPrivateMatchRoom(data) {
|
|
|
17
18
|
const result = exports.CreatedPrivateMatchRoomSchema.safeParse(data);
|
|
18
19
|
return result.success ? result.data : null;
|
|
19
20
|
}
|
|
20
|
-
exports.parseCreatedPrivateMatchRoom = parseCreatedPrivateMatchRoom;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.EnteredCasualMatchSchema = void 0;
|
|
4
|
+
exports.parseEnteredCasualMatch = parseEnteredCasualMatch;
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
/** EnteredCasualMatch zodスキーマ */
|
|
6
7
|
exports.EnteredCasualMatchSchema = zod_1.z.object({
|
|
@@ -16,4 +17,3 @@ function parseEnteredCasualMatch(data) {
|
|
|
16
17
|
const result = exports.EnteredCasualMatchSchema.safeParse(data);
|
|
17
18
|
return result.success ? result.data : null;
|
|
18
19
|
}
|
|
19
|
-
exports.parseEnteredCasualMatch = parseEnteredCasualMatch;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.NotReadyBattleProgressSchema = void 0;
|
|
4
|
+
exports.parseNotReadyBattleProgress = parseNotReadyBattleProgress;
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
/** NotReadyBattleProgress zodスキーマ */
|
|
6
7
|
exports.NotReadyBattleProgressSchema = zod_1.z.object({
|
|
@@ -16,4 +17,3 @@ function parseNotReadyBattleProgress(data) {
|
|
|
16
17
|
const result = exports.NotReadyBattleProgressSchema.safeParse(data);
|
|
17
18
|
return result.success ? result.data : null;
|
|
18
19
|
}
|
|
19
|
-
exports.parseNotReadyBattleProgress = parseNotReadyBattleProgress;
|
package/lib/src/response/pong.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PongSchema = void 0;
|
|
4
|
+
exports.parsePong = parsePong;
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
/** Pong zodスキーマ */
|
|
6
7
|
exports.PongSchema = zod_1.z.object({
|
|
@@ -17,4 +18,3 @@ function parsePong(data) {
|
|
|
17
18
|
const result = exports.PongSchema.safeParse(data);
|
|
18
19
|
return result.success ? result.data : null;
|
|
19
20
|
}
|
|
20
|
-
exports.parsePong = parsePong;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.RejectPrivateMatchEntrySchema = void 0;
|
|
4
|
+
exports.parseRejectPrivateMatchEntry = parseRejectPrivateMatchEntry;
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
/** RejectPrivateMatchEntry zodスキーマ */
|
|
6
7
|
exports.RejectPrivateMatchEntrySchema = zod_1.z.object({
|
|
@@ -16,4 +17,3 @@ function parseRejectPrivateMatchEntry(origin) {
|
|
|
16
17
|
const result = exports.RejectPrivateMatchEntrySchema.safeParse(origin);
|
|
17
18
|
return result.success ? result.data : null;
|
|
18
19
|
}
|
|
19
|
-
exports.parseRejectPrivateMatchEntry = parseRejectPrivateMatchEntry;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SuddenlyBattleEndSchema = void 0;
|
|
4
|
+
exports.parseSuddenlyBattleEnd = parseSuddenlyBattleEnd;
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
/** SuddenlyBattleEnd zodスキーマ */
|
|
6
7
|
exports.SuddenlyBattleEndSchema = zod_1.z.object({
|
|
@@ -16,4 +17,3 @@ function parseSuddenlyBattleEnd(data) {
|
|
|
16
17
|
const result = exports.SuddenlyBattleEndSchema.safeParse(data);
|
|
17
18
|
return result.success ? result.data : null;
|
|
18
19
|
}
|
|
19
|
-
exports.parseSuddenlyBattleEnd = parseSuddenlyBattleEnd;
|
package/lib/src/wait/wait.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.connect =
|
|
3
|
+
exports.connect = connect;
|
|
4
4
|
/**
|
|
5
5
|
* 接続完了したWebSocketを返す
|
|
6
6
|
*
|
|
@@ -23,4 +23,3 @@ function connect(url) {
|
|
|
23
23
|
errorHandler && websocket.removeEventListener("error", errorHandler);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
exports.connect = connect;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPrivateMatchRoom =
|
|
3
|
+
exports.createPrivateMatchRoom = createPrivateMatchRoom;
|
|
4
4
|
const parse_1 = require("../json/parse");
|
|
5
5
|
const created_private_match_room_1 = require("../response/created-private-match-room");
|
|
6
6
|
const send_to_api_server_1 = require("./send-to-api-server");
|
|
@@ -24,4 +24,3 @@ function createPrivateMatchRoom(websocket, armdozerId, pilotId) {
|
|
|
24
24
|
response && resolve(response);
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
exports.createPrivateMatchRoom = createPrivateMatchRoom;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enterCasualMatch =
|
|
3
|
+
exports.enterCasualMatch = enterCasualMatch;
|
|
4
4
|
const parse_1 = require("../json/parse");
|
|
5
5
|
const battle_start_1 = require("../response/battle-start");
|
|
6
6
|
const send_to_api_server_1 = require("./send-to-api-server");
|
|
@@ -25,4 +25,3 @@ function enterCasualMatch(websocket, armdozerId, pilotId) {
|
|
|
25
25
|
response && resolve(response);
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
exports.enterCasualMatch = enterCasualMatch;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enterPrivateMatchRoom =
|
|
3
|
+
exports.enterPrivateMatchRoom = enterPrivateMatchRoom;
|
|
4
4
|
const parse_1 = require("../json/parse");
|
|
5
5
|
const battle_start_1 = require("../response/battle-start");
|
|
6
6
|
const reject_private_match_entry_1 = require("../response/reject-private-match-entry");
|
|
@@ -33,4 +33,3 @@ function enterPrivateMatchRoom(websocket, roomID, armdozerId, pilotId) {
|
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
exports.enterPrivateMatchRoom = enterPrivateMatchRoom;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ping =
|
|
3
|
+
exports.ping = ping;
|
|
4
4
|
const parse_1 = require("../json/parse");
|
|
5
5
|
const pong_1 = require("../response/pong");
|
|
6
6
|
const send_to_api_server_1 = require("./send-to-api-server");
|
|
@@ -21,4 +21,3 @@ function ping(websocket) {
|
|
|
21
21
|
response && resolve(response);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
exports.ping = ping;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.privateMatchMakePolling =
|
|
12
|
+
exports.privateMatchMakePolling = privateMatchMakePolling;
|
|
13
13
|
const parse_1 = require("../json/parse");
|
|
14
14
|
const battle_start_1 = require("../response/battle-start");
|
|
15
15
|
const cloud_not_private_match_making_1 = require("../response/cloud-not-private-match-making");
|
|
@@ -59,4 +59,3 @@ function privateMatchMakePolling(websocket, roomID) {
|
|
|
59
59
|
}));
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
exports.privateMatchMakePolling = privateMatchMakePolling;
|
|
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.sendCommand = sendCommand;
|
|
13
|
+
exports.sendCommandWithPolling = sendCommandWithPolling;
|
|
13
14
|
const parse_1 = require("../json/parse");
|
|
14
15
|
const accept_command_1 = require("../response/accept-command");
|
|
15
16
|
const battle_end_1 = require("../response/battle-end");
|
|
@@ -49,7 +50,6 @@ function sendCommand(websocket, battleID, flowID, command) {
|
|
|
49
50
|
}
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
|
-
exports.sendCommand = sendCommand;
|
|
53
53
|
/**
|
|
54
54
|
* 更新確認ポーリング付きでAPIサーバにコマンド送信を行う
|
|
55
55
|
*
|
|
@@ -114,4 +114,3 @@ function sendCommandWithPolling(websocket, battleID, flowID, command) {
|
|
|
114
114
|
}));
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
-
exports.sendCommandWithPolling = sendCommandWithPolling;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendToAPIServer =
|
|
3
|
+
exports.sendToAPIServer = sendToAPIServer;
|
|
4
4
|
/**
|
|
5
5
|
* APIサーバにメッセージ送信をする
|
|
6
6
|
*
|
|
@@ -10,4 +10,3 @@ exports.sendToAPIServer = void 0;
|
|
|
10
10
|
function sendToAPIServer(websocket, data) {
|
|
11
11
|
websocket.send(JSON.stringify(data));
|
|
12
12
|
}
|
|
13
|
-
exports.sendToAPIServer = sendToAPIServer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.waitUntil =
|
|
3
|
+
exports.waitUntil = waitUntil;
|
|
4
4
|
/**
|
|
5
5
|
* Websocketで特定メッセージを受信するまで待機する
|
|
6
6
|
* 利用イメージは、コード例を参照
|
|
@@ -37,4 +37,3 @@ function waitUntil(websocket, messageHandler) {
|
|
|
37
37
|
handler && websocket.removeEventListener("message", handler);
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
exports.waitUntil = waitUntil;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gbraver-burst-network/browser-sdk",
|
|
3
3
|
"description": "gbraver burst browser sdk",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.14.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
|
-
"
|
|
11
|
+
"aws-amplify": "^6.3.8",
|
|
12
12
|
"gbraver-burst-core": "^1.31.1",
|
|
13
13
|
"rxjs": "^7.8.1",
|
|
14
14
|
"zod": "^3.23.8"
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"eslint-plugin-simple-import-sort": "^12.1.0",
|
|
22
22
|
"jest": "^29.7.0",
|
|
23
23
|
"npm-run-all": "^4.1.5",
|
|
24
|
-
"prettier": "3.3.
|
|
24
|
+
"prettier": "3.3.2",
|
|
25
25
|
"rimraf": "^5.0.7",
|
|
26
|
-
"ts-jest": "^29.1.
|
|
27
|
-
"typescript-eslint": "^7.
|
|
28
|
-
"webpack": "^5.
|
|
26
|
+
"ts-jest": "^29.1.5",
|
|
27
|
+
"typescript-eslint": "^7.14.1",
|
|
28
|
+
"webpack": "^5.92.1",
|
|
29
29
|
"webpack-cli": "^5.1.4"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Auth0Client } from "@auth0/auth0-spa-js";
|
|
2
|
-
/**
|
|
3
|
-
* Auth0Clientを生成するヘルパー関数
|
|
4
|
-
*
|
|
5
|
-
* @param domain auth0ドメイン
|
|
6
|
-
* @param clientID auth0クライアントID
|
|
7
|
-
* @param audience auth0 audience
|
|
8
|
-
* @param redirectURI リダイレクト元となるGブレイバーバーストのURL
|
|
9
|
-
* @returns Auth0Client
|
|
10
|
-
*/
|
|
11
|
-
export declare function createAuth0ClientHelper(domain: string, clientID: string, audience: string, redirectURI: string): Promise<Auth0Client>;
|
package/lib/src/auth0/client.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createAuth0ClientHelper = void 0;
|
|
4
|
-
const auth0_spa_js_1 = require("@auth0/auth0-spa-js");
|
|
5
|
-
/**
|
|
6
|
-
* Auth0Clientを生成するヘルパー関数
|
|
7
|
-
*
|
|
8
|
-
* @param domain auth0ドメイン
|
|
9
|
-
* @param clientID auth0クライアントID
|
|
10
|
-
* @param audience auth0 audience
|
|
11
|
-
* @param redirectURI リダイレクト元となるGブレイバーバーストのURL
|
|
12
|
-
* @returns Auth0Client
|
|
13
|
-
*/
|
|
14
|
-
function createAuth0ClientHelper(domain, clientID, audience, redirectURI) {
|
|
15
|
-
return (0, auth0_spa_js_1.createAuth0Client)({
|
|
16
|
-
domain: domain,
|
|
17
|
-
clientId: clientID,
|
|
18
|
-
authorizationParams: {
|
|
19
|
-
redirect_uri: redirectURI,
|
|
20
|
-
audience: audience,
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
exports.createAuth0ClientHelper = createAuth0ClientHelper;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clearLoginHistory = exports.isLoginSuccessRedirect = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* ログイン成功時のリダイレクトか否かを判定する
|
|
6
|
-
* trueでログイン成功時のリダイレクトである
|
|
7
|
-
*
|
|
8
|
-
* @returns 判定結果
|
|
9
|
-
*/
|
|
10
|
-
function isLoginSuccessRedirect() {
|
|
11
|
-
const query = window.location.search;
|
|
12
|
-
return query.includes("code=") && query.includes("state=");
|
|
13
|
-
}
|
|
14
|
-
exports.isLoginSuccessRedirect = isLoginSuccessRedirect;
|
|
15
|
-
/**
|
|
16
|
-
* ログインリダイレクトのヒストリーをクリアする
|
|
17
|
-
*/
|
|
18
|
-
function clearLoginHistory() {
|
|
19
|
-
window.history.replaceState({}, document.title, "/");
|
|
20
|
-
}
|
|
21
|
-
exports.clearLoginHistory = clearLoginHistory;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.deleteLoggedInUser = void 0;
|
|
13
|
-
/**
|
|
14
|
-
* 現在ログインしているユーザを削除する
|
|
15
|
-
*
|
|
16
|
-
* @param restAPIURL Rest API のURL
|
|
17
|
-
* @param accessToken Auth0 アクセストークン
|
|
18
|
-
* @returns 処理が完了したら発火するPromise
|
|
19
|
-
*/
|
|
20
|
-
function deleteLoggedInUser(restAPIURL, accessToken) {
|
|
21
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
yield fetch(`${restAPIURL}`, {
|
|
23
|
-
mode: "cors",
|
|
24
|
-
headers: {
|
|
25
|
-
Authorization: `Bearer ${accessToken}`,
|
|
26
|
-
},
|
|
27
|
-
method: "DELETE",
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
exports.deleteLoggedInUser = deleteLoggedInUser;
|