@genex-ai/embed-sdk 0.35.0 → 0.36.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/README.md CHANGED
@@ -138,6 +138,9 @@ fresh at each join (`auth: () => getColyseusAuth()`; tokens rotate) and never lo
138
138
  - `getAuthorityRegions()`: the same servers by region (`{ region, urls }`), for `connectAuthority()`'s
139
139
  `regions`: the nearest region is joined, and each region is its own matchmaking pool. Empty when the
140
140
  stand names no regions, and in local test mode.
141
+ - `getAuthorityHome()` (SDK **0.36.0+**): the region of those nearest the player by geography (from the country the player
142
+ connects from), for `connectAuthority()`'s `home`: it is joined and created in first. `undefined` when
143
+ the stand names none or the country is unknown, and in local test mode.
141
144
 
142
145
  In local test mode both lists are empty and `getColyseusAuth()` is `undefined`, except for a
143
146
  local authority server: a loopback page opened with `?genex_authority_url=ws://127.0.0.1:<port>`
@@ -1668,7 +1668,7 @@ var LOCAL_AUTH_FLAG = "genex:embed:local-auth";
1668
1668
  var ENTRY_REFERRER_MEMO = "genex:embed:entry-referrer";
1669
1669
  var ENTRY_REFERRER_NONE = "none";
1670
1670
  var PLAYER_ID_KEY = "genex:player";
1671
- var SDK_VERSION = "0.35.0";
1671
+ var SDK_VERSION = "0.36.0";
1672
1672
  var config2 = null;
1673
1673
  var state = "pending";
1674
1674
  var user = null;
@@ -1682,6 +1682,7 @@ var embedToken;
1682
1682
  var colyseusUrls;
1683
1683
  var authorityUrls;
1684
1684
  var authorityRegions;
1685
+ var authorityHome;
1685
1686
  var localAuthority = false;
1686
1687
  var parentOrigin = null;
1687
1688
  var shellCaps = [];
@@ -1911,6 +1912,11 @@ function getAuthorityUrls() {
1911
1912
  function getAuthorityRegions() {
1912
1913
  return regionList(authorityRegions);
1913
1914
  }
1915
+ function getAuthorityHome() {
1916
+ if (typeof authorityHome !== "string" || authorityHome.length === 0) return void 0;
1917
+ const home = authorityHome;
1918
+ return regionList(authorityRegions).some((r) => r.region === home) ? home : void 0;
1919
+ }
1914
1920
  function waitForAuth() {
1915
1921
  if (state === "authenticated" && user) return Promise.resolve({ user });
1916
1922
  if (state === "blocked") return Promise.reject(new Error("genex embed auth: blocked"));
@@ -2705,6 +2711,7 @@ function adoptColyseus(block) {
2705
2711
  colyseusUrls = block?.urls;
2706
2712
  authorityUrls = block?.authorityUrls;
2707
2713
  authorityRegions = block?.authorityRegions;
2714
+ authorityHome = block?.authorityHome;
2708
2715
  }
2709
2716
  function urlList(value) {
2710
2717
  if (!Array.isArray(value)) return void 0;
@@ -3282,6 +3289,7 @@ export {
3282
3289
  getColyseusUrls,
3283
3290
  getAuthorityUrls,
3284
3291
  getAuthorityRegions,
3292
+ getAuthorityHome,
3285
3293
  waitForAuth,
3286
3294
  waitForPlayer,
3287
3295
  on,
package/dist/index.d.ts CHANGED
@@ -1011,6 +1011,12 @@ type AuthorityRegion = {
1011
1011
  * is its own matchmaking pool. Empty when the stand names no regions, and in local test mode; `urls`
1012
1012
  * alone are then used. Fresh copies: editing them changes nothing. */
1013
1013
  declare function getAuthorityRegions(): AuthorityRegion[];
1014
+ /** The player's home region (multiplayer PROTOCOL.md §17.1 *Regions*, server-owned): the region of
1015
+ * {@link getAuthorityRegions} nearest the player by geography, which the server names from the country
1016
+ * the request came from. Pass to `connectAuthority()` as `home`: that region is joined and created in
1017
+ * first, whatever a latency probe measured. Undefined when the server names none (no country, an older
1018
+ * API), when it names a region it does not serve, and in local test mode. */
1019
+ declare function getAuthorityHome(): string | undefined;
1014
1020
  /**
1015
1021
  * Resolves with the signed-in ACCOUNT once authenticated; rejects if the
1016
1022
  * session ends up blocked. THE gate for /state saves and any account-bound
@@ -1192,4 +1198,4 @@ declare function __resetForTests(overrides?: {
1192
1198
  platformConfirmTimeoutMs?: number;
1193
1199
  }): void;
1194
1200
 
1195
- export { type AppendEventResult, type AuthState, type AuthorityRegion, type DeleteSharedResult, type EmbedConfig, type EmbedEntry, type EmbedEvent, type EmbedShell, type EmbedUser, type Entitlement, type GenerateOptions, type GenerateStreamOptions, type HapticKind, ItemState, type JudgeOptions, type JudgeResult, type Leaderboard, type LeaderboardEntry, type PaymentOptions, type PaymentPage, type PaymentReceipt, type PaymentResult, type PaymentStatus, type PlatformError, type PlatformFeature, type PlatformOutcome, type PlayerStateResult, type PurchaseResult, type PurchaseStatus, type PutSharedResult, type RequestWorkflowOptions, RuntimeGenerationBilling, RuntimeGenerationFunding, RuntimeGenerationModels, type RuntimeGenerationResult, RuntimeGenerationView, RuntimeGrantView, RuntimeJudgeAnswer, RuntimeJudgeQuestion, RuntimeJudgmentView, type RuntimeWorkflowAuthorization, RuntimeWorkflowInput, RuntimeWorkflowOfferings, type SaveStateResult, type ShareOptions, type ShareResult, type SharedEventPage, type SharedEventRecord, type SharedObject, type SharedObjectInfo, type SharedPage, type ShopItem, type SpendGrantDisclosure, type SpendGrantOptions, type SpendGrantResult, type SubmitScoreResult, type WorldStateResult, __resetForTests, _stashTicketFromUrl, appendEvent, buy, consumeEntitlement, copyText, deleteShared, generate, generateStream, generationErrorMessage, getActiveSpendGrant, getAuthState, getAuthorityRegions, getAuthorityUrls, getColyseusAuth, getColyseusUrls, getEmbedToken, getEntitlements, getEntry, getGeneration, getGenerationModels, getLeaderboard, getPayment, getPayments, getShared, getShell, getShop, getSpendGrant, getUser, getWorkflowOfferings, haptic, initEmbed, isEmbedded, judge, keepAwake, listEvents, listShared, loadPlayerState, loadWorldState, on, onShellClosing, openExternal, putShared, requestPayment, requestSpendGrant, requestWorkflow, resumeWorkflow, saveFile, savePlayerState, saveWorldState, setFullscreen, share, stopSpendGrant, submitScore, supports, waitForAuth, waitForGeneration, waitForPlayer };
1201
+ export { type AppendEventResult, type AuthState, type AuthorityRegion, type DeleteSharedResult, type EmbedConfig, type EmbedEntry, type EmbedEvent, type EmbedShell, type EmbedUser, type Entitlement, type GenerateOptions, type GenerateStreamOptions, type HapticKind, ItemState, type JudgeOptions, type JudgeResult, type Leaderboard, type LeaderboardEntry, type PaymentOptions, type PaymentPage, type PaymentReceipt, type PaymentResult, type PaymentStatus, type PlatformError, type PlatformFeature, type PlatformOutcome, type PlayerStateResult, type PurchaseResult, type PurchaseStatus, type PutSharedResult, type RequestWorkflowOptions, RuntimeGenerationBilling, RuntimeGenerationFunding, RuntimeGenerationModels, type RuntimeGenerationResult, RuntimeGenerationView, RuntimeGrantView, RuntimeJudgeAnswer, RuntimeJudgeQuestion, RuntimeJudgmentView, type RuntimeWorkflowAuthorization, RuntimeWorkflowInput, RuntimeWorkflowOfferings, type SaveStateResult, type ShareOptions, type ShareResult, type SharedEventPage, type SharedEventRecord, type SharedObject, type SharedObjectInfo, type SharedPage, type ShopItem, type SpendGrantDisclosure, type SpendGrantOptions, type SpendGrantResult, type SubmitScoreResult, type WorldStateResult, __resetForTests, _stashTicketFromUrl, appendEvent, buy, consumeEntitlement, copyText, deleteShared, generate, generateStream, generationErrorMessage, getActiveSpendGrant, getAuthState, getAuthorityHome, getAuthorityRegions, getAuthorityUrls, getColyseusAuth, getColyseusUrls, getEmbedToken, getEntitlements, getEntry, getGeneration, getGenerationModels, getLeaderboard, getPayment, getPayments, getShared, getShell, getShop, getSpendGrant, getUser, getWorkflowOfferings, haptic, initEmbed, isEmbedded, judge, keepAwake, listEvents, listShared, loadPlayerState, loadWorldState, on, onShellClosing, openExternal, putShared, requestPayment, requestSpendGrant, requestWorkflow, resumeWorkflow, saveFile, savePlayerState, saveWorldState, setFullscreen, share, stopSpendGrant, submitScore, supports, waitForAuth, waitForGeneration, waitForPlayer };
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  generationErrorMessage,
13
13
  getActiveSpendGrant,
14
14
  getAuthState,
15
+ getAuthorityHome,
15
16
  getAuthorityRegions,
16
17
  getAuthorityUrls,
17
18
  getColyseusAuth,
@@ -58,7 +59,7 @@ import {
58
59
  waitForAuth,
59
60
  waitForGeneration,
60
61
  waitForPlayer
61
- } from "./chunk-KEW6LYT2.js";
62
+ } from "./chunk-RAAJ2ZK5.js";
62
63
  import "./chunk-QBCWKMVQ.js";
63
64
  export {
64
65
  ItemState,
@@ -74,6 +75,7 @@ export {
74
75
  generationErrorMessage,
75
76
  getActiveSpendGrant,
76
77
  getAuthState,
78
+ getAuthorityHome,
77
79
  getAuthorityRegions,
78
80
  getAuthorityUrls,
79
81
  getColyseusAuth,
package/dist/sentry.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  _stashTicketFromUrl,
3
3
  getUser,
4
4
  on
5
- } from "./chunk-KEW6LYT2.js";
5
+ } from "./chunk-RAAJ2ZK5.js";
6
6
  import "./chunk-QBCWKMVQ.js";
7
7
 
8
8
  // src/sentry.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genex-ai/embed-sdk",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Player identity + durable game state for genex games \u2014 signed-in or guest play, per-player save slots, shared world state, soft-trust leaderboards, and shared collections and event streams.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",