@openfort/openfort-js 0.8.13 → 0.8.14

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.cjs CHANGED
@@ -1379,6 +1379,38 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1379
1379
  options: localVarRequestOptions,
1380
1380
  };
1381
1381
  },
1382
+ /**
1383
+ * Create a guest player.
1384
+ * @summary Create a guest player.
1385
+ * @param {string} [xGame]
1386
+ * @param {*} [options] Override http request option.
1387
+ * @throws {RequiredError}
1388
+ */
1389
+ registerGuest: async (xGame, options = {}) => {
1390
+ const localVarPath = `/iam/v1/guest`;
1391
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1392
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1393
+ let baseOptions;
1394
+ if (configuration) {
1395
+ baseOptions = configuration.baseOptions;
1396
+ }
1397
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1398
+ const localVarHeaderParameter = {};
1399
+ const localVarQueryParameter = {};
1400
+ // authentication pk required
1401
+ // http bearer authentication required
1402
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1403
+ if (xGame != null) {
1404
+ localVarHeaderParameter['x-game'] = String(xGame);
1405
+ }
1406
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1407
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1408
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1409
+ return {
1410
+ url: toPathString(localVarUrlObj),
1411
+ options: localVarRequestOptions,
1412
+ };
1413
+ },
1382
1414
  /**
1383
1415
  * Start the Email Verification process for a player.
1384
1416
  * @summary Request an Email Verification.
@@ -1937,6 +1969,17 @@ const AuthenticationApiFp = function (configuration) {
1937
1969
  const localVarAxiosArgs = await localVarAxiosParamCreator.refresh(refreshTokenRequest, options);
1938
1970
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1939
1971
  },
1972
+ /**
1973
+ * Create a guest player.
1974
+ * @summary Create a guest player.
1975
+ * @param {string} [xGame]
1976
+ * @param {*} [options] Override http request option.
1977
+ * @throws {RequiredError}
1978
+ */
1979
+ async registerGuest(xGame, options) {
1980
+ const localVarAxiosArgs = await localVarAxiosParamCreator.registerGuest(xGame, options);
1981
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1982
+ },
1940
1983
  /**
1941
1984
  * Start the Email Verification process for a player.
1942
1985
  * @summary Request an Email Verification.
@@ -2245,6 +2288,17 @@ class AuthenticationApi extends BaseAPI {
2245
2288
  refresh(requestParameters, options) {
2246
2289
  return AuthenticationApiFp(this.configuration).refresh(requestParameters.refreshTokenRequest, options).then((request) => request(this.axios, this.basePath));
2247
2290
  }
2291
+ /**
2292
+ * Create a guest player.
2293
+ * @summary Create a guest player.
2294
+ * @param {AuthenticationApiRegisterGuestRequest} requestParameters Request parameters.
2295
+ * @param {*} [options] Override http request option.
2296
+ * @throws {RequiredError}
2297
+ * @memberof AuthenticationApi
2298
+ */
2299
+ registerGuest(requestParameters = {}, options) {
2300
+ return AuthenticationApiFp(this.configuration).registerGuest(requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
2301
+ }
2248
2302
  /**
2249
2303
  * Start the Email Verification process for a player.
2250
2304
  * @summary Request an Email Verification.
@@ -3282,7 +3336,7 @@ class KeyPair extends signingKey.SigningKey {
3282
3336
  }
3283
3337
  }
3284
3338
 
3285
- const VERSION = '0.8.12';
3339
+ const VERSION = '0.8.14';
3286
3340
 
3287
3341
  var Event;
3288
3342
  (function (Event) {
@@ -4302,6 +4356,11 @@ class AuthManager {
4302
4356
  key: result.data.key,
4303
4357
  };
4304
4358
  }
4359
+ async registerGuest() {
4360
+ const request = {};
4361
+ const response = await this.backendApiClients.authenticationApi.registerGuest(request);
4362
+ return response.data;
4363
+ }
4305
4364
  async poolOAuth(key) {
4306
4365
  const request = {
4307
4366
  key,
@@ -6924,6 +6983,20 @@ class Openfort {
6924
6983
  new Authentication('jwt', result.token, result.player.id, result.refreshToken).save(this.storage);
6925
6984
  return result;
6926
6985
  }
6986
+ /**
6987
+ * Registers a new guest user.
6988
+ *
6989
+ * @returns An AuthResponse object containing authentication details.
6990
+ */
6991
+ async registerGuest() {
6992
+ const previousAuth = Authentication.fromStorage(this.storage);
6993
+ const result = await this.authManager.registerGuest();
6994
+ if (previousAuth && previousAuth.player !== result.player.id) {
6995
+ this.logout();
6996
+ }
6997
+ new Authentication('jwt', result.token, result.player.id, result.refreshToken).save(this.storage);
6998
+ return result;
6999
+ }
6927
7000
  /**
6928
7001
  * Signs up a new user with email and password.
6929
7002
  *
package/dist/index.d.ts CHANGED
@@ -657,6 +657,12 @@ declare class Openfort {
657
657
  password: string;
658
658
  ecosystemGame?: string;
659
659
  }): Promise<AuthResponse>;
660
+ /**
661
+ * Registers a new guest user.
662
+ *
663
+ * @returns An AuthResponse object containing authentication details.
664
+ */
665
+ registerGuest(): Promise<AuthResponse>;
660
666
  /**
661
667
  * Signs up a new user with email and password.
662
668
  *
package/dist/index.js CHANGED
@@ -1356,6 +1356,38 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1356
1356
  options: localVarRequestOptions,
1357
1357
  };
1358
1358
  },
1359
+ /**
1360
+ * Create a guest player.
1361
+ * @summary Create a guest player.
1362
+ * @param {string} [xGame]
1363
+ * @param {*} [options] Override http request option.
1364
+ * @throws {RequiredError}
1365
+ */
1366
+ registerGuest: async (xGame, options = {}) => {
1367
+ const localVarPath = `/iam/v1/guest`;
1368
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1369
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1370
+ let baseOptions;
1371
+ if (configuration) {
1372
+ baseOptions = configuration.baseOptions;
1373
+ }
1374
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1375
+ const localVarHeaderParameter = {};
1376
+ const localVarQueryParameter = {};
1377
+ // authentication pk required
1378
+ // http bearer authentication required
1379
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1380
+ if (xGame != null) {
1381
+ localVarHeaderParameter['x-game'] = String(xGame);
1382
+ }
1383
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1384
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1385
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1386
+ return {
1387
+ url: toPathString(localVarUrlObj),
1388
+ options: localVarRequestOptions,
1389
+ };
1390
+ },
1359
1391
  /**
1360
1392
  * Start the Email Verification process for a player.
1361
1393
  * @summary Request an Email Verification.
@@ -1914,6 +1946,17 @@ const AuthenticationApiFp = function (configuration) {
1914
1946
  const localVarAxiosArgs = await localVarAxiosParamCreator.refresh(refreshTokenRequest, options);
1915
1947
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1916
1948
  },
1949
+ /**
1950
+ * Create a guest player.
1951
+ * @summary Create a guest player.
1952
+ * @param {string} [xGame]
1953
+ * @param {*} [options] Override http request option.
1954
+ * @throws {RequiredError}
1955
+ */
1956
+ async registerGuest(xGame, options) {
1957
+ const localVarAxiosArgs = await localVarAxiosParamCreator.registerGuest(xGame, options);
1958
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1959
+ },
1917
1960
  /**
1918
1961
  * Start the Email Verification process for a player.
1919
1962
  * @summary Request an Email Verification.
@@ -2222,6 +2265,17 @@ class AuthenticationApi extends BaseAPI {
2222
2265
  refresh(requestParameters, options) {
2223
2266
  return AuthenticationApiFp(this.configuration).refresh(requestParameters.refreshTokenRequest, options).then((request) => request(this.axios, this.basePath));
2224
2267
  }
2268
+ /**
2269
+ * Create a guest player.
2270
+ * @summary Create a guest player.
2271
+ * @param {AuthenticationApiRegisterGuestRequest} requestParameters Request parameters.
2272
+ * @param {*} [options] Override http request option.
2273
+ * @throws {RequiredError}
2274
+ * @memberof AuthenticationApi
2275
+ */
2276
+ registerGuest(requestParameters = {}, options) {
2277
+ return AuthenticationApiFp(this.configuration).registerGuest(requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
2278
+ }
2225
2279
  /**
2226
2280
  * Start the Email Verification process for a player.
2227
2281
  * @summary Request an Email Verification.
@@ -3259,7 +3313,7 @@ class KeyPair extends SigningKey {
3259
3313
  }
3260
3314
  }
3261
3315
 
3262
- const VERSION = '0.8.12';
3316
+ const VERSION = '0.8.14';
3263
3317
 
3264
3318
  var Event;
3265
3319
  (function (Event) {
@@ -4279,6 +4333,11 @@ class AuthManager {
4279
4333
  key: result.data.key,
4280
4334
  };
4281
4335
  }
4336
+ async registerGuest() {
4337
+ const request = {};
4338
+ const response = await this.backendApiClients.authenticationApi.registerGuest(request);
4339
+ return response.data;
4340
+ }
4282
4341
  async poolOAuth(key) {
4283
4342
  const request = {
4284
4343
  key,
@@ -6901,6 +6960,20 @@ class Openfort {
6901
6960
  new Authentication('jwt', result.token, result.player.id, result.refreshToken).save(this.storage);
6902
6961
  return result;
6903
6962
  }
6963
+ /**
6964
+ * Registers a new guest user.
6965
+ *
6966
+ * @returns An AuthResponse object containing authentication details.
6967
+ */
6968
+ async registerGuest() {
6969
+ const previousAuth = Authentication.fromStorage(this.storage);
6970
+ const result = await this.authManager.registerGuest();
6971
+ if (previousAuth && previousAuth.player !== result.player.id) {
6972
+ this.logout();
6973
+ }
6974
+ new Authentication('jwt', result.token, result.player.id, result.refreshToken).save(this.storage);
6975
+ return result;
6976
+ }
6904
6977
  /**
6905
6978
  * Signs up a new user with email and password.
6906
6979
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfort/openfort-js",
3
- "version": "0.8.13",
3
+ "version": "0.8.14",
4
4
  "author": "Openfort (https://www.openfort.xyz)",
5
5
  "bugs": "https://github.com/openfort-xyz/openfort-js/issues",
6
6
  "repository": "openfort-xyz/openfort-js.git",