@series-inc/rundot-game-sdk 5.14.2 → 5.14.3

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.
@@ -36,6 +36,15 @@ var RundotGameMessageId = /* @__PURE__ */ ((RundotGameMessageId2) => {
36
36
  RundotGameMessageId2["OWNER_STORAGE_GET_ALL_DATA"] = "H5_OWNER_STORAGE_GET_ALL_DATA";
37
37
  RundotGameMessageId2["OWNER_STORAGE_SET_MULTIPLE_ITEMS"] = "H5_OWNER_STORAGE_SET_MULTIPLE_ITEMS";
38
38
  RundotGameMessageId2["OWNER_STORAGE_REMOVE_MULTIPLE_ITEMS"] = "H5_OWNER_STORAGE_REMOVE_MULTIPLE_ITEMS";
39
+ RundotGameMessageId2["GLOBAL_STORAGE_GET_ITEM"] = "H5_GLOBAL_STORAGE_GET_ITEM";
40
+ RundotGameMessageId2["GLOBAL_STORAGE_SET_ITEM"] = "H5_GLOBAL_STORAGE_SET_ITEM";
41
+ RundotGameMessageId2["GLOBAL_STORAGE_REMOVE_ITEM"] = "H5_GLOBAL_STORAGE_REMOVE_ITEM";
42
+ RundotGameMessageId2["GLOBAL_STORAGE_CLEAR"] = "H5_GLOBAL_STORAGE_CLEAR";
43
+ RundotGameMessageId2["GLOBAL_STORAGE_KEY"] = "H5_GLOBAL_STORAGE_KEY";
44
+ RundotGameMessageId2["GLOBAL_STORAGE_LENGTH"] = "H5_GLOBAL_STORAGE_LENGTH";
45
+ RundotGameMessageId2["GLOBAL_STORAGE_GET_ALL_ITEMS"] = "H5_GLOBAL_STORAGE_GET_ALL_ITEMS";
46
+ RundotGameMessageId2["GLOBAL_STORAGE_SET_MULTIPLE_ITEMS"] = "H5_GLOBAL_STORAGE_SET_MULTIPLE_ITEMS";
47
+ RundotGameMessageId2["GLOBAL_STORAGE_REMOVE_MULTIPLE_ITEMS"] = "H5_GLOBAL_STORAGE_REMOVE_MULTIPLE_ITEMS";
39
48
  RundotGameMessageId2["SHARED_STORAGE_GET_ITEM"] = "H5_SHARED_STORAGE_GET_ITEM";
40
49
  RundotGameMessageId2["SHARED_STORAGE_SET_ITEM"] = "H5_SHARED_STORAGE_SET_ITEM";
41
50
  RundotGameMessageId2["SHARED_STORAGE_REMOVE_ITEM"] = "H5_SHARED_STORAGE_REMOVE_ITEM";
@@ -3019,6 +3028,118 @@ var RpcStorageApi = class {
3019
3028
  }
3020
3029
  };
3021
3030
 
3031
+ // src/storage/DualEmitStorageApi.ts
3032
+ var DualEmitStorageApi = class {
3033
+ constructor(rpcClient, sharedIds, sharedScope, globalIds) {
3034
+ this.rpcClient = rpcClient;
3035
+ this.sharedIds = sharedIds;
3036
+ this.sharedScope = sharedScope;
3037
+ this.globalIds = globalIds;
3038
+ }
3039
+ sharedBody(extra) {
3040
+ return { ...this.sharedScope, ...extra ?? {} };
3041
+ }
3042
+ clear() {
3043
+ return dualWrite(
3044
+ this.rpcClient.call(this.sharedIds.clear, this.sharedBody()),
3045
+ this.rpcClient.call(this.globalIds.clear, void 0)
3046
+ );
3047
+ }
3048
+ getItem(key) {
3049
+ return dualRead(
3050
+ this.rpcClient.call(this.sharedIds.getItem, this.sharedBody({ key })),
3051
+ this.rpcClient.call(this.globalIds.getItem, { key })
3052
+ );
3053
+ }
3054
+ setItem(key, value) {
3055
+ return dualWrite(
3056
+ this.rpcClient.call(this.sharedIds.setItem, this.sharedBody({ key, value })),
3057
+ this.rpcClient.call(this.globalIds.setItem, { key, value })
3058
+ );
3059
+ }
3060
+ key(index) {
3061
+ return dualRead(
3062
+ this.rpcClient.call(this.sharedIds.getKey, this.sharedBody({ index })),
3063
+ this.rpcClient.call(this.globalIds.getKey, { index })
3064
+ );
3065
+ }
3066
+ length() {
3067
+ return dualRead(
3068
+ this.rpcClient.call(this.sharedIds.length, this.sharedBody()),
3069
+ this.rpcClient.call(this.globalIds.length, void 0)
3070
+ );
3071
+ }
3072
+ removeItem(key) {
3073
+ return dualWrite(
3074
+ this.rpcClient.call(this.sharedIds.removeItem, this.sharedBody({ key })),
3075
+ this.rpcClient.call(this.globalIds.removeItem, { key })
3076
+ );
3077
+ }
3078
+ removeMultipleItems(keys) {
3079
+ if (!this.sharedIds.removeMultipleItems) {
3080
+ throw new Error("Method not implemented");
3081
+ }
3082
+ return dualWrite(
3083
+ this.rpcClient.call(this.sharedIds.removeMultipleItems, this.sharedBody({ keys })),
3084
+ this.rpcClient.call(this.globalIds.removeMultipleItems, { keys })
3085
+ );
3086
+ }
3087
+ getAllItems() {
3088
+ if (!this.sharedIds.getAllItems) {
3089
+ throw new Error("Method not implemented");
3090
+ }
3091
+ const sharedCall = this.rpcClient.call(
3092
+ this.sharedIds.getAllItems,
3093
+ this.sharedBody()
3094
+ );
3095
+ const globalCall = this.rpcClient.call(this.globalIds.getAllItems, void 0).then((dict) => Object.keys(dict ?? {}));
3096
+ return dualRead(sharedCall, globalCall);
3097
+ }
3098
+ getAllData() {
3099
+ if (!this.sharedIds.getAllData) {
3100
+ throw new Error("Method not implemented");
3101
+ }
3102
+ return dualRead(
3103
+ this.rpcClient.call(this.sharedIds.getAllData, this.sharedBody()),
3104
+ this.rpcClient.call(this.globalIds.getAllItems, void 0)
3105
+ );
3106
+ }
3107
+ setMultipleItems(items) {
3108
+ if (!this.sharedIds.setMultipleItems) {
3109
+ throw new Error("Method not implemented");
3110
+ }
3111
+ return dualWrite(
3112
+ this.rpcClient.call(this.sharedIds.setMultipleItems, this.sharedBody({ items })),
3113
+ this.rpcClient.call(this.globalIds.setMultipleItems, { items })
3114
+ );
3115
+ }
3116
+ };
3117
+ var NO_HANDLER_PREFIX = "Unsupported message type:";
3118
+ function isNoHandlerError(reason) {
3119
+ return reason instanceof Error && reason.message.startsWith(NO_HANDLER_PREFIX);
3120
+ }
3121
+ async function dualWrite(primary, fallback) {
3122
+ const results = await Promise.allSettled([primary, fallback]);
3123
+ if (results.some((r) => r.status === "fulfilled")) return;
3124
+ const realError = results.find(
3125
+ (r) => r.status === "rejected" && !isNoHandlerError(r.reason)
3126
+ );
3127
+ if (realError) throw realError.reason;
3128
+ throw results[0].reason;
3129
+ }
3130
+ async function dualRead(primary, fallback) {
3131
+ const results = await Promise.allSettled([primary, fallback]);
3132
+ for (const r of results) {
3133
+ if (r.status === "fulfilled") return r.value;
3134
+ }
3135
+ for (const r of results) {
3136
+ if (r.status === "rejected" && !isNoHandlerError(r.reason)) {
3137
+ throw r.reason;
3138
+ }
3139
+ }
3140
+ throw results[0].reason;
3141
+ }
3142
+
3022
3143
  // src/storage/RpcInboundStorageApi.ts
3023
3144
  var RpcInboundStorageApi = class {
3024
3145
  rpcClient;
@@ -5675,6 +5796,6 @@ var MockMultiplayerApi = class {
5675
5796
  }
5676
5797
  };
5677
5798
 
5678
- export { AccessDeniedError, BaseCdnApi, DEFAULT_SHARED_LIB_CDN_BASE, EMBEDDED_LIBRARIES, EMBEDDED_LIBRARY_BY_KEY, FILE_EXTENSION_PATTERN, HapticFeedbackStyle, HostCdnApi, HostDeviceApi, HostEnvironmentApi, HostProfileApi, HostSystemApi, HostTimeApi, MIN_CDN_PATH_SEGMENTS, MODULE_TO_LIBRARY_SPECIFIERS, MockAccessGateApi, MockAdminImageGenApi, MockAdminUgcApi, MockAdsApi, MockAnalyticsApi, MockAvatarApi, MockCdnApi, MockDebug, MockDeviceApi, MockEntitlementApi, MockEnvironmentApi, MockFeaturesApi, MockHapticsApi, MockIapApi, MockLifecycleApi, MockLoggingApi, MockMultiplayerApi, MockNavigationApi, MockNotificationsApi, MockPopupsApi, MockPreloaderApi, MockProfileApi, MockSharedAssetsApi, MockShopApi, MockStorageApi, MockSystemApi, MockTimeApi, MockVideoApi, ROOM_GAME_PHASES, RpcAccessGateApi, RpcAdsApi, RpcAnalyticsApi, RpcAvatarApi, RpcEntitlementApi, RpcFeaturesApi, RpcHapticsApi, RpcIapApi, RpcInboundStorageApi, RpcLifecycleApi, RpcLoggingApi, RpcNavigationApi, RpcNotificationsApi, RpcPopupsApi, RpcPreloaderApi, RpcRoomsApi, RpcSharedAssetsApi, RpcShopApi, RpcStorageApi, RpcVideoApi, RundotGameMessageId, RundotGameRoom, SandboxAppApi, SandboxProfileApi, WsMultiplayerApi, applyAccessGates, base64ToArrayBuffer, base64ToUtf8, buildFunctionsBaseUrl, createAccessGatedApi, createMockStorageApi, exchangeForCustomToken, generateId, getCloudRunUrl, getFirebaseClient, getLibraryDefinition, getSandboxConfig, hasHostedUrlStructure, initializeAccessGate, initializeAds, initializeAnalytics, initializeAvatar3d, initializeCdn, initializeEntitlements, initializeFeaturesApi, initializeHaptics, initializeIap, initializeLifecycleApi, initializeLocalNotifications, initializeLoggingApi, initializePopups, initializePreloader, initializeProfile, initializeRoomsApi, initializeShop, initializeStackNavigation, initializeStorage, initializeSystem, initializeTime, initializeVideo, isPacificDaylightTime, isSandboxEnabled, mockLog, observeFirestoreCollection, observeFirestoreDocument, parseCdnPathSegments, resolveCollectionItemPrice, setStoredAppRole, setupRoomNotifications, signInWithGoogle };
5679
- //# sourceMappingURL=chunk-QEIRJ4K6.js.map
5680
- //# sourceMappingURL=chunk-QEIRJ4K6.js.map
5799
+ export { AccessDeniedError, BaseCdnApi, DEFAULT_SHARED_LIB_CDN_BASE, DualEmitStorageApi, EMBEDDED_LIBRARIES, EMBEDDED_LIBRARY_BY_KEY, FILE_EXTENSION_PATTERN, HapticFeedbackStyle, HostCdnApi, HostDeviceApi, HostEnvironmentApi, HostProfileApi, HostSystemApi, HostTimeApi, MIN_CDN_PATH_SEGMENTS, MODULE_TO_LIBRARY_SPECIFIERS, MockAccessGateApi, MockAdminImageGenApi, MockAdminUgcApi, MockAdsApi, MockAnalyticsApi, MockAvatarApi, MockCdnApi, MockDebug, MockDeviceApi, MockEntitlementApi, MockEnvironmentApi, MockFeaturesApi, MockHapticsApi, MockIapApi, MockLifecycleApi, MockLoggingApi, MockMultiplayerApi, MockNavigationApi, MockNotificationsApi, MockPopupsApi, MockPreloaderApi, MockProfileApi, MockSharedAssetsApi, MockShopApi, MockStorageApi, MockSystemApi, MockTimeApi, MockVideoApi, ROOM_GAME_PHASES, RpcAccessGateApi, RpcAdsApi, RpcAnalyticsApi, RpcAvatarApi, RpcEntitlementApi, RpcFeaturesApi, RpcHapticsApi, RpcIapApi, RpcInboundStorageApi, RpcLifecycleApi, RpcLoggingApi, RpcNavigationApi, RpcNotificationsApi, RpcPopupsApi, RpcPreloaderApi, RpcRoomsApi, RpcSharedAssetsApi, RpcShopApi, RpcStorageApi, RpcVideoApi, RundotGameMessageId, RundotGameRoom, SandboxAppApi, SandboxProfileApi, WsMultiplayerApi, applyAccessGates, base64ToArrayBuffer, base64ToUtf8, buildFunctionsBaseUrl, createAccessGatedApi, createMockStorageApi, exchangeForCustomToken, generateId, getCloudRunUrl, getFirebaseClient, getLibraryDefinition, getSandboxConfig, hasHostedUrlStructure, initializeAccessGate, initializeAds, initializeAnalytics, initializeAvatar3d, initializeCdn, initializeEntitlements, initializeFeaturesApi, initializeHaptics, initializeIap, initializeLifecycleApi, initializeLocalNotifications, initializeLoggingApi, initializePopups, initializePreloader, initializeProfile, initializeRoomsApi, initializeShop, initializeStackNavigation, initializeStorage, initializeSystem, initializeTime, initializeVideo, isPacificDaylightTime, isSandboxEnabled, mockLog, observeFirestoreCollection, observeFirestoreDocument, parseCdnPathSegments, resolveCollectionItemPrice, setStoredAppRole, setupRoomNotifications, signInWithGoogle };
5800
+ //# sourceMappingURL=chunk-BVAGHPCR.js.map
5801
+ //# sourceMappingURL=chunk-BVAGHPCR.js.map