hytopia 0.10.14 → 0.10.16

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.
@@ -9,7 +9,7 @@ Get global data from the data persistence service.
9
9
  **Signature:**
10
10
 
11
11
  ```typescript
12
- getGlobalData(key: string): Promise<Record<string, unknown> | void>;
12
+ getGlobalData(key: string, maxRetries?: number): Promise<Record<string, unknown> | undefined>;
13
13
  ```
14
14
 
15
15
  ## Parameters
@@ -45,12 +45,28 @@ string
45
45
  The key to get the data from.
46
46
 
47
47
 
48
+ </td></tr>
49
+ <tr><td>
50
+
51
+ maxRetries
52
+
53
+
54
+ </td><td>
55
+
56
+ number
57
+
58
+
59
+ </td><td>
60
+
61
+ _(Optional)_ The maximum number of retries to attempt in the event of failure.
62
+
63
+
48
64
  </td></tr>
49
65
  </tbody></table>
50
66
 
51
67
  **Returns:**
52
68
 
53
- Promise&lt;Record&lt;string, unknown&gt; \| void&gt;
69
+ Promise&lt;Record&lt;string, unknown&gt; \| undefined&gt;
54
70
 
55
71
  The data from the persistence layer.
56
72
 
@@ -84,7 +84,7 @@ Description
84
84
  </th></tr></thead>
85
85
  <tbody><tr><td>
86
86
 
87
- [getGlobalData(key)](./server.persistencemanager.getglobaldata.md)
87
+ [getGlobalData(key, maxRetries)](./server.persistencemanager.getglobaldata.md)
88
88
 
89
89
 
90
90
  </td><td>
@@ -9,7 +9,7 @@ Set global data in the data persistence service. This data is available and shar
9
9
  **Signature:**
10
10
 
11
11
  ```typescript
12
- setGlobalData(key: string, data: Record<string, unknown>): Promise<Record<string, unknown> | void>;
12
+ setGlobalData(key: string, data: Record<string, unknown>): Promise<Record<string, unknown> | undefined>;
13
13
  ```
14
14
 
15
15
  ## Parameters
@@ -66,5 +66,5 @@ The data to set.
66
66
 
67
67
  **Returns:**
68
68
 
69
- Promise&lt;Record&lt;string, unknown&gt; \| void&gt;
69
+ Promise&lt;Record&lt;string, unknown&gt; \| undefined&gt;
70
70
 
@@ -19,5 +19,5 @@ The persisted data for the player.
19
19
 
20
20
  ## Remarks
21
21
 
22
- This method returns the player persisted data.
22
+ This method returns the player persisted data. If it returns undefined, the player data failed to load and your game logic should handle this case appropriately. If it returns an empty object {<!-- -->}<!-- -->, the player data loaded successfully but no prior data has been set.
23
23
 
@@ -56,5 +56,5 @@ The persisted data for the player.
56
56
 
57
57
  ## Remarks
58
58
 
59
- This method is asynchronous and returns a promise that resolves to the player data.
59
+ This method is asynchronous and returns a promise that resolves to the player data. Data is set using shallow merge of the existing data. It is recommended that you provide a changed data object for your saved data structure rather than the entire data object to avoid edge cases with data persistence or overwrites.
60
60
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.10.14",
3
+ "version": "0.10.16",
4
4
  "description": "The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./server.mjs",
package/server.api.json CHANGED
@@ -35243,7 +35243,7 @@
35243
35243
  {
35244
35244
  "kind": "Method",
35245
35245
  "canonicalReference": "server!PersistenceManager#getGlobalData:member(1)",
35246
- "docComment": "/**\n * Get global data from the data persistence service.\n *\n * @param key - The key to get the data from.\n *\n * @returns The data from the persistence layer.\n */\n",
35246
+ "docComment": "/**\n * Get global data from the data persistence service.\n *\n * @param key - The key to get the data from.\n *\n * @param maxRetries - The maximum number of retries to attempt in the event of failure.\n *\n * @returns The data from the persistence layer.\n */\n",
35247
35247
  "excerptTokens": [
35248
35248
  {
35249
35249
  "kind": "Content",
@@ -35253,6 +35253,14 @@
35253
35253
  "kind": "Content",
35254
35254
  "text": "string"
35255
35255
  },
35256
+ {
35257
+ "kind": "Content",
35258
+ "text": ", maxRetries?: "
35259
+ },
35260
+ {
35261
+ "kind": "Content",
35262
+ "text": "number"
35263
+ },
35256
35264
  {
35257
35265
  "kind": "Content",
35258
35266
  "text": "): "
@@ -35273,7 +35281,7 @@
35273
35281
  },
35274
35282
  {
35275
35283
  "kind": "Content",
35276
- "text": "<string, unknown> | void>"
35284
+ "text": "<string, unknown> | undefined>"
35277
35285
  },
35278
35286
  {
35279
35287
  "kind": "Content",
@@ -35282,8 +35290,8 @@
35282
35290
  ],
35283
35291
  "isStatic": false,
35284
35292
  "returnTypeTokenRange": {
35285
- "startIndex": 3,
35286
- "endIndex": 7
35293
+ "startIndex": 5,
35294
+ "endIndex": 9
35287
35295
  },
35288
35296
  "releaseTag": "Public",
35289
35297
  "isProtected": false,
@@ -35296,6 +35304,14 @@
35296
35304
  "endIndex": 2
35297
35305
  },
35298
35306
  "isOptional": false
35307
+ },
35308
+ {
35309
+ "parameterName": "maxRetries",
35310
+ "parameterTypeTokenRange": {
35311
+ "startIndex": 3,
35312
+ "endIndex": 4
35313
+ },
35314
+ "isOptional": true
35299
35315
  }
35300
35316
  ],
35301
35317
  "isOptional": false,
@@ -35379,7 +35395,7 @@
35379
35395
  },
35380
35396
  {
35381
35397
  "kind": "Content",
35382
- "text": "<string, unknown> | void>"
35398
+ "text": "<string, unknown> | undefined>"
35383
35399
  },
35384
35400
  {
35385
35401
  "kind": "Content",
@@ -35562,7 +35578,7 @@
35562
35578
  {
35563
35579
  "kind": "Method",
35564
35580
  "canonicalReference": "server!Player#getPersistedData:member(1)",
35565
- "docComment": "/**\n * Get the persisted data for the player.\n *\n * @remarks\n *\n * This method returns the player persisted data.\n *\n * @returns The persisted data for the player.\n */\n",
35581
+ "docComment": "/**\n * Get the persisted data for the player.\n *\n * @remarks\n *\n * This method returns the player persisted data. If it returns undefined, the player data failed to load and your game logic should handle this case appropriately. If it returns an empty object {}, the player data loaded successfully but no prior data has been set.\n *\n * @returns The persisted data for the player.\n */\n",
35566
35582
  "excerptTokens": [
35567
35583
  {
35568
35584
  "kind": "Content",
@@ -35769,7 +35785,7 @@
35769
35785
  {
35770
35786
  "kind": "Method",
35771
35787
  "canonicalReference": "server!Player#setPersistedData:member(1)",
35772
- "docComment": "/**\n * Set the persisted data for the player. This data can later be retrieved using {@link Player.getPersistedData}, even if a player disconnects and rejoin a game in the future, or joins a different HYTOPIA managed lobby of your game.\n *\n * @remarks\n *\n * This method is asynchronous and returns a promise that resolves to the player data.\n *\n * @param data - The data to set.\n *\n * @returns The persisted data for the player.\n */\n",
35788
+ "docComment": "/**\n * Set the persisted data for the player. This data can later be retrieved using {@link Player.getPersistedData}, even if a player disconnects and rejoin a game in the future, or joins a different HYTOPIA managed lobby of your game.\n *\n * @remarks\n *\n * This method is asynchronous and returns a promise that resolves to the player data. Data is set using shallow merge of the existing data. It is recommended that you provide a changed data object for your saved data structure rather than the entire data object to avoid edge cases with data persistence or overwrites.\n *\n * @param data - The data to set.\n *\n * @returns The persisted data for the player.\n */\n",
35773
35789
  "excerptTokens": [
35774
35790
  {
35775
35791
  "kind": "Content",
package/server.d.ts CHANGED
@@ -4340,9 +4340,10 @@ export declare class PersistenceManager {
4340
4340
  /**
4341
4341
  * Get global data from the data persistence service.
4342
4342
  * @param key - The key to get the data from.
4343
+ * @param maxRetries - The maximum number of retries to attempt in the event of failure.
4343
4344
  * @returns The data from the persistence layer.
4344
4345
  */
4345
- getGlobalData(key: string): Promise<Record<string, unknown> | void>;
4346
+ getGlobalData(key: string, maxRetries?: number): Promise<Record<string, unknown> | undefined>;
4346
4347
 
4347
4348
  /**
4348
4349
  * Set global data in the data persistence service. This
@@ -4350,7 +4351,7 @@ export declare class PersistenceManager {
4350
4351
  * @param key - The key to set the data to.
4351
4352
  * @param data - The data to set.
4352
4353
  */
4353
- setGlobalData(key: string, data: Record<string, unknown>): Promise<Record<string, unknown> | void>;
4354
+ setGlobalData(key: string, data: Record<string, unknown>): Promise<Record<string, unknown> | undefined>;
4354
4355
 
4355
4356
 
4356
4357
  }
@@ -4403,7 +4404,11 @@ export declare class Player extends EventRouter implements protocol.Serializable
4403
4404
  * Get the persisted data for the player.
4404
4405
  *
4405
4406
  * @remarks
4406
- * This method returns the player persisted data.
4407
+ * This method returns the player persisted data. If it returns
4408
+ * undefined, the player data failed to load and your game
4409
+ * logic should handle this case appropriately. If it returns
4410
+ * an empty object {}, the player data loaded successfully but
4411
+ * no prior data has been set.
4407
4412
  *
4408
4413
  * @returns The persisted data for the player.
4409
4414
  */
@@ -4433,7 +4438,11 @@ export declare class Player extends EventRouter implements protocol.Serializable
4433
4438
  *
4434
4439
  * @remarks
4435
4440
  * This method is asynchronous and returns a promise that
4436
- * resolves to the player data.
4441
+ * resolves to the player data. Data is set using shallow
4442
+ * merge of the existing data. It is recommended that you
4443
+ * provide a changed data object for your saved data structure
4444
+ * rather than the entire data object to avoid edge cases with
4445
+ * data persistence or overwrites.
4437
4446
  *
4438
4447
  * @param data - The data to set.
4439
4448
  * @returns The persisted data for the player.