@etothepii/satisfactory-file-parser 3.1.2 → 3.2.2

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.
Files changed (512) hide show
  1. package/.github/workflows/tests.yml +1 -1
  2. package/CHANGELOG.md +18 -0
  3. package/GUIDE.md +7 -1
  4. package/README.md +4 -0
  5. package/build/index.d.ts +1 -0
  6. package/build/index.d.ts.map +1 -1
  7. package/build/index.js +1 -0
  8. package/build/index.js.map +1 -1
  9. package/build/parser/context/context.d.ts +1 -0
  10. package/build/parser/context/context.d.ts.map +1 -1
  11. package/build/parser/context/context.js.map +1 -1
  12. package/build/parser/parser.d.ts.map +1 -1
  13. package/build/parser/parser.js +4 -4
  14. package/build/parser/parser.js.map +1 -1
  15. package/build/parser/satisfactory/save/satisfactory-save-header.d.ts.map +1 -1
  16. package/build/parser/satisfactory/save/satisfactory-save-header.js +4 -3
  17. package/build/parser/satisfactory/save/satisfactory-save-header.js.map +1 -1
  18. package/build/parser/satisfactory/save/satisfactory-save.d.ts +2 -3
  19. package/build/parser/satisfactory/save/satisfactory-save.d.ts.map +1 -1
  20. package/build/parser/satisfactory/save/satisfactory-save.js +1 -2
  21. package/build/parser/satisfactory/save/satisfactory-save.js.map +1 -1
  22. package/build/parser/satisfactory/save/save-reader.d.ts +0 -17
  23. package/build/parser/satisfactory/save/save-reader.d.ts.map +1 -1
  24. package/build/parser/satisfactory/save/save-reader.js +1 -37
  25. package/build/parser/satisfactory/save/save-reader.js.map +1 -1
  26. package/build/parser/satisfactory/save/save-writer.d.ts +0 -3
  27. package/build/parser/satisfactory/save/save-writer.d.ts.map +1 -1
  28. package/build/parser/satisfactory/save/save-writer.js +0 -22
  29. package/build/parser/satisfactory/save/save-writer.js.map +1 -1
  30. package/build/parser/satisfactory/types/property/PropertiesList.js +1 -1
  31. package/build/parser/satisfactory/types/property/PropertiesList.js.map +1 -1
  32. package/build/parser/satisfactory/types/property/generic/MapProperty.d.ts +3 -3
  33. package/build/parser/satisfactory/types/property/generic/MapProperty.d.ts.map +1 -1
  34. package/build/parser/satisfactory/types/property/generic/MapProperty.js +12 -2
  35. package/build/parser/satisfactory/types/property/generic/MapProperty.js.map +1 -1
  36. package/build/parser/satisfactory/types/structs/SaveBodyValidation.d.ts +19 -0
  37. package/build/parser/satisfactory/types/structs/SaveBodyValidation.d.ts.map +1 -0
  38. package/build/parser/satisfactory/types/structs/SaveBodyValidation.js +41 -0
  39. package/build/parser/satisfactory/types/structs/SaveBodyValidation.js.map +1 -0
  40. package/build/parser/stream/reworked/readable-stream-parser.d.ts +1 -1
  41. package/build/parser/stream/reworked/readable-stream-parser.d.ts.map +1 -1
  42. package/build/parser/stream/reworked/readable-stream-parser.js +6 -7
  43. package/build/parser/stream/reworked/readable-stream-parser.js.map +1 -1
  44. package/build/parser/stream/reworked/save-stream-json-stringifier.d.ts.map +1 -1
  45. package/build/parser/stream/reworked/save-stream-json-stringifier.js +1 -2
  46. package/build/parser/stream/reworked/save-stream-json-stringifier.js.map +1 -1
  47. package/build/parser/stream/reworked/save-stream-writer.class.d.ts +2 -3
  48. package/build/parser/stream/reworked/save-stream-writer.class.d.ts.map +1 -1
  49. package/build/parser/stream/reworked/save-stream-writer.class.js +4 -7
  50. package/build/parser/stream/reworked/save-stream-writer.class.js.map +1 -1
  51. package/docs/assets/search.js +1 -1
  52. package/docs/classes/BlueprintConfigReader.html +4 -4
  53. package/docs/classes/BlueprintConfigWriter.html +4 -4
  54. package/docs/classes/BlueprintReader.html +4 -4
  55. package/docs/classes/BlueprintWriter.html +4 -4
  56. package/docs/classes/CompressionLibraryError.html +2 -2
  57. package/docs/classes/CorruptBlueprintError.html +2 -2
  58. package/docs/classes/CorruptSaveError.html +2 -2
  59. package/docs/classes/Parser.html +6 -6
  60. package/docs/classes/ParserError.html +2 -2
  61. package/docs/classes/ReadableStreamParser.html +2 -2
  62. package/docs/classes/SatisfactorySave.html +2 -2
  63. package/docs/classes/SaveComponent.html +2 -2
  64. package/docs/classes/SaveEntity.html +2 -2
  65. package/docs/classes/SaveObject.html +2 -2
  66. package/docs/classes/SaveReader.html +5 -6
  67. package/docs/classes/SaveStreamJsonStringifier.html +2 -2
  68. package/docs/classes/SaveStreamWriter.html +2 -2
  69. package/docs/classes/SaveWriter.html +5 -6
  70. package/docs/classes/TimeoutError.html +2 -2
  71. package/docs/classes/UnimplementedError.html +2 -2
  72. package/docs/classes/UnsupportedVersionError.html +2 -2
  73. package/docs/enums/BlueprintConfigVersion.html +2 -2
  74. package/docs/enums/BlueprintHeaderVersion.html +2 -2
  75. package/docs/enums/CompressionAlgorithmCode.html +2 -2
  76. package/docs/enums/FactoryGameCustomVersion.html +2 -2
  77. package/docs/enums/RuntimeBuildableInstanceDataVersion.html +2 -2
  78. package/docs/enums/SaveCustomVersion.html +10 -10
  79. package/docs/enums/SaveHeaderType.html +2 -2
  80. package/docs/functions/AbstractBaseProperty.Create.html +1 -1
  81. package/docs/functions/ArrayProperty.CalcOverhead.html +1 -1
  82. package/docs/functions/ArrayProperty.Parse.html +1 -1
  83. package/docs/functions/ArrayProperty.Serialize.html +1 -1
  84. package/docs/functions/BlueprintConfig.Parse.html +1 -1
  85. package/docs/functions/BlueprintConfig.Serialize.html +1 -1
  86. package/docs/functions/BlueprintHeader.Parse.html +1 -1
  87. package/docs/functions/BlueprintHeader.Serialize.html +1 -1
  88. package/docs/functions/BoolArrayProperty.Parse.html +1 -1
  89. package/docs/functions/BoolArrayProperty.Serialize.html +1 -1
  90. package/docs/functions/BoolProperty.CalcOverhead.html +1 -1
  91. package/docs/functions/BoolProperty.Parse.html +1 -1
  92. package/docs/functions/BoolProperty.ReadValue.html +1 -1
  93. package/docs/functions/BoolProperty.Serialize.html +1 -1
  94. package/docs/functions/BoolProperty.SerializeValue.html +1 -1
  95. package/docs/functions/BuildableSubsystemSpecialProperties.Parse.html +1 -1
  96. package/docs/functions/BuildableSubsystemSpecialProperties.Serialize.html +1 -1
  97. package/docs/functions/BuildableTypeInstance.Parse.html +1 -1
  98. package/docs/functions/BuildableTypeInstance.Serialize.html +1 -1
  99. package/docs/functions/ByteArrayProperty.Parse.html +1 -1
  100. package/docs/functions/ByteArrayProperty.Serialize.html +1 -1
  101. package/docs/functions/ByteProperty.CalcOverhead.html +1 -1
  102. package/docs/functions/ByteProperty.Parse.html +1 -1
  103. package/docs/functions/ByteProperty.ReadValue.html +1 -1
  104. package/docs/functions/ByteProperty.Serialize.html +1 -1
  105. package/docs/functions/ByteProperty.SerializeValue.html +1 -1
  106. package/docs/functions/CircuitSpecialProperties.Parse.html +1 -1
  107. package/docs/functions/CircuitSpecialProperties.Serialize.html +1 -1
  108. package/docs/functions/ConveyorChainActorSpecialProperties.Parse.html +1 -1
  109. package/docs/functions/ConveyorChainActorSpecialProperties.Serialize.html +1 -1
  110. package/docs/functions/ConveyorSpecialProperties.Parse.html +1 -1
  111. package/docs/functions/ConveyorSpecialProperties.Serialize.html +1 -1
  112. package/docs/functions/DoubleArrayProperty.Parse.html +1 -1
  113. package/docs/functions/DoubleArrayProperty.Serialize.html +1 -1
  114. package/docs/functions/DoubleProperty.CalcOverhead.html +1 -1
  115. package/docs/functions/DoubleProperty.Parse.html +1 -1
  116. package/docs/functions/DoubleProperty.ReadValue.html +1 -1
  117. package/docs/functions/DoubleProperty.Serialize.html +1 -1
  118. package/docs/functions/DoubleProperty.SerializeValue.html +1 -1
  119. package/docs/functions/DynamicStructPropertyValue.read.html +1 -1
  120. package/docs/functions/DynamicStructPropertyValue.write.html +1 -1
  121. package/docs/functions/EmptySpecialProperties.Parse.html +1 -1
  122. package/docs/functions/EmptySpecialProperties.Serialize.html +1 -1
  123. package/docs/functions/EnumArrayProperty.Parse.html +1 -1
  124. package/docs/functions/EnumArrayProperty.Serialize.html +1 -1
  125. package/docs/functions/EnumProperty.CalcOverhead.html +1 -1
  126. package/docs/functions/EnumProperty.Parse.html +1 -1
  127. package/docs/functions/EnumProperty.ReadValue.html +1 -1
  128. package/docs/functions/EnumProperty.Serialize.html +1 -1
  129. package/docs/functions/EnumProperty.SerializeValue.html +1 -1
  130. package/docs/functions/FGDynamicStruct.Parse.html +1 -1
  131. package/docs/functions/FGDynamicStruct.Serialize.html +1 -1
  132. package/docs/functions/FICFrameRange.Parse.html +1 -1
  133. package/docs/functions/FICFrameRange.Serialize.html +1 -1
  134. package/docs/functions/FloatArrayProperty.Parse.html +1 -1
  135. package/docs/functions/FloatArrayProperty.Serialize.html +1 -1
  136. package/docs/functions/FloatProperty.CalcOverhead.html +1 -1
  137. package/docs/functions/FloatProperty.Parse.html +1 -1
  138. package/docs/functions/FloatProperty.ReadValue.html +1 -1
  139. package/docs/functions/FloatProperty.Serialize.html +1 -1
  140. package/docs/functions/FloatProperty.SerializeValue.html +1 -1
  141. package/docs/functions/GUID.read.html +1 -1
  142. package/docs/functions/GUID.write.html +1 -1
  143. package/docs/functions/GUIDInfo.read.html +1 -1
  144. package/docs/functions/GUIDInfo.write.html +1 -1
  145. package/docs/functions/Int32ArrayProperty.Parse.html +1 -1
  146. package/docs/functions/Int32ArrayProperty.Serialize.html +1 -1
  147. package/docs/functions/Int32Property.CalcOverhead.html +1 -1
  148. package/docs/functions/Int32Property.Parse.html +1 -1
  149. package/docs/functions/Int32Property.ReadValue.html +1 -1
  150. package/docs/functions/Int32Property.Serialize.html +1 -1
  151. package/docs/functions/Int32Property.SerializeValue.html +1 -1
  152. package/docs/functions/Int32SetProperty.Parse.html +1 -1
  153. package/docs/functions/Int32SetProperty.Serialize.html +1 -1
  154. package/docs/functions/Int64ArrayProperty.Parse.html +1 -1
  155. package/docs/functions/Int64ArrayProperty.Serialize.html +1 -1
  156. package/docs/functions/Int64Property.CalcOverhead.html +1 -1
  157. package/docs/functions/Int64Property.Parse.html +1 -1
  158. package/docs/functions/Int64Property.ReadValue.html +1 -1
  159. package/docs/functions/Int64Property.Serialize.html +1 -1
  160. package/docs/functions/Int64Property.SerializeValue.html +1 -1
  161. package/docs/functions/Int8Property.CalcOverhead.html +1 -1
  162. package/docs/functions/Int8Property.Parse.html +1 -1
  163. package/docs/functions/Int8Property.ReadValue.html +1 -1
  164. package/docs/functions/Int8Property.Serialize.html +1 -1
  165. package/docs/functions/Int8Property.SerializeValue.html +1 -1
  166. package/docs/functions/Level.ReadAllObjectContents.html +1 -1
  167. package/docs/functions/Level.ReadAllObjectHeaders.html +1 -1
  168. package/docs/functions/Level.ReadLevel.html +1 -1
  169. package/docs/functions/Level.ReadNObjectContents.html +1 -1
  170. package/docs/functions/Level.ReadNObjectHeaders.html +1 -1
  171. package/docs/functions/Level.SerializeAllObjectContents.html +1 -1
  172. package/docs/functions/Level.SerializeAllObjectHeaders.html +1 -1
  173. package/docs/functions/Level.SerializeLevel.html +1 -1
  174. package/docs/functions/LevelToDestroyedActorsMap.read.html +1 -1
  175. package/docs/functions/LevelToDestroyedActorsMap.write.html +1 -1
  176. package/docs/functions/MD5Hash.read.html +1 -1
  177. package/docs/functions/MD5Hash.write.html +1 -1
  178. package/docs/functions/MapProperty.CalcOverhead.html +1 -1
  179. package/docs/functions/MapProperty.Parse.html +1 -1
  180. package/docs/functions/MapProperty.Serialize.html +1 -1
  181. package/docs/functions/ObjectArrayProperty.Parse.html +1 -1
  182. package/docs/functions/ObjectArrayProperty.Serialize.html +1 -1
  183. package/docs/functions/ObjectProperty.CalcOverhead.html +1 -1
  184. package/docs/functions/ObjectProperty.Parse.html +1 -1
  185. package/docs/functions/ObjectProperty.ReadValue.html +1 -1
  186. package/docs/functions/ObjectProperty.Serialize.html +1 -1
  187. package/docs/functions/ObjectProperty.SerializeValue.html +1 -1
  188. package/docs/functions/ObjectReference.IsEqual.html +1 -1
  189. package/docs/functions/ObjectReference.read.html +1 -1
  190. package/docs/functions/ObjectReference.write.html +1 -1
  191. package/docs/functions/ObjectSetProperty.Parse.html +1 -1
  192. package/docs/functions/ObjectSetProperty.Serialize.html +1 -1
  193. package/docs/functions/ObjectsListSpecialProperties.Parse.html +1 -1
  194. package/docs/functions/ObjectsListSpecialProperties.Serialize.html +1 -1
  195. package/docs/functions/PlayerSpecialProperties.Parse.html +1 -1
  196. package/docs/functions/PlayerSpecialProperties.Serialize.html +1 -1
  197. package/docs/functions/PowerLineSpecialProperties.Parse.html +1 -1
  198. package/docs/functions/PowerLineSpecialProperties.Serialize.html +1 -1
  199. package/docs/functions/PropertiesList.ParseList.html +1 -1
  200. package/docs/functions/PropertiesList.ParseSingleProperty.html +1 -1
  201. package/docs/functions/PropertiesList.SerializeList.html +1 -1
  202. package/docs/functions/PropertiesList.SerializeSingleProperty.html +1 -1
  203. package/docs/functions/SatisfactorySaveHeader.Parse.html +1 -1
  204. package/docs/functions/SatisfactorySaveHeader.Serialize.html +1 -1
  205. package/docs/functions/SaveBodyChunks.CompressDataIntoChunks.html +1 -1
  206. package/docs/functions/SaveBodyChunks.DecompressChunks.html +1 -1
  207. package/docs/functions/SetProperty.CalcOverhead.html +1 -1
  208. package/docs/functions/SetProperty.Parse.html +1 -1
  209. package/docs/functions/SetProperty.Serialize.html +1 -1
  210. package/docs/functions/SoftObjectArrayProperty.Parse.html +1 -1
  211. package/docs/functions/SoftObjectArrayProperty.Serialize.html +1 -1
  212. package/docs/functions/SoftObjectReference.read.html +1 -1
  213. package/docs/functions/SoftObjectReference.write.html +1 -1
  214. package/docs/functions/SpecialDroneActionProperties.Parse.html +1 -1
  215. package/docs/functions/SpecialDroneActionProperties.Serialize.html +1 -1
  216. package/docs/functions/SpecialProperties.ParseClassSpecificSpecialProperties.html +1 -1
  217. package/docs/functions/SpecialProperties.SerializeClassSpecificSpecialProperties.html +1 -1
  218. package/docs/functions/StrArrayProperty.Parse.html +1 -1
  219. package/docs/functions/StrArrayProperty.Serialize.html +1 -1
  220. package/docs/functions/StrProperty.CalcOverhead.html +1 -1
  221. package/docs/functions/StrProperty.Parse.html +1 -1
  222. package/docs/functions/StrProperty.ReadValue.html +1 -1
  223. package/docs/functions/StrProperty.Serialize.html +1 -1
  224. package/docs/functions/StrProperty.SerializeValue.html +1 -1
  225. package/docs/functions/StrSetProperty.Parse.html +1 -1
  226. package/docs/functions/StrSetProperty.Serialize.html +1 -1
  227. package/docs/functions/StructArrayProperty.Parse.html +1 -1
  228. package/docs/functions/StructArrayProperty.Serialize.html +1 -1
  229. package/docs/functions/StructProperty.CalcOverhead.html +1 -1
  230. package/docs/functions/StructProperty.Parse.html +1 -1
  231. package/docs/functions/StructProperty.ParseValue.html +1 -1
  232. package/docs/functions/StructProperty.Serialize.html +1 -1
  233. package/docs/functions/StructProperty.SerializeValue.html +1 -1
  234. package/docs/functions/StructSetProperty.Parse.html +1 -1
  235. package/docs/functions/StructSetProperty.Serialize.html +1 -1
  236. package/docs/functions/TextArrayProperty.Parse.html +1 -1
  237. package/docs/functions/TextArrayProperty.Serialize.html +1 -1
  238. package/docs/functions/TextProperty.CalcOverhead.html +1 -1
  239. package/docs/functions/TextProperty.Parse.html +1 -1
  240. package/docs/functions/TextProperty.ReadValue.html +1 -1
  241. package/docs/functions/TextProperty.Serialize.html +1 -1
  242. package/docs/functions/TextProperty.SerializeValue.html +1 -1
  243. package/docs/functions/Transform.Parse.html +1 -1
  244. package/docs/functions/Transform.ParseF.html +1 -1
  245. package/docs/functions/Transform.Serialize.html +1 -1
  246. package/docs/functions/Transform.SerializeF.html +1 -1
  247. package/docs/functions/Uint32Property.CalcOverhead.html +1 -1
  248. package/docs/functions/Uint32Property.Parse.html +1 -1
  249. package/docs/functions/Uint32Property.ReadValue.html +1 -1
  250. package/docs/functions/Uint32Property.Serialize.html +1 -1
  251. package/docs/functions/Uint32Property.SerializeValue.html +1 -1
  252. package/docs/functions/Uint32SetProperty.Parse.html +1 -1
  253. package/docs/functions/Uint32SetProperty.Serialize.html +1 -1
  254. package/docs/functions/Uint64Property.CalcOverhead.html +1 -1
  255. package/docs/functions/Uint64Property.Parse.html +1 -1
  256. package/docs/functions/Uint64Property.ReadValue.html +1 -1
  257. package/docs/functions/Uint64Property.Serialize.html +1 -1
  258. package/docs/functions/Uint64Property.SerializeValue.html +1 -1
  259. package/docs/functions/Uint8Property.CalcOverhead.html +1 -1
  260. package/docs/functions/Uint8Property.Parse.html +1 -1
  261. package/docs/functions/Uint8Property.ReadValue.html +1 -1
  262. package/docs/functions/Uint8Property.Serialize.html +1 -1
  263. package/docs/functions/Uint8Property.SerializeValue.html +1 -1
  264. package/docs/functions/VehiclePhysicsData.Parse.html +1 -1
  265. package/docs/functions/VehiclePhysicsData.Serialize.html +1 -1
  266. package/docs/functions/VehicleSpecialProperties.Parse.html +1 -1
  267. package/docs/functions/VehicleSpecialProperties.Serialize.html +1 -1
  268. package/docs/functions/col4.ParseBGRA.html +1 -1
  269. package/docs/functions/col4.ParseRGBA.html +1 -1
  270. package/docs/functions/col4.SerializeBGRA.html +1 -1
  271. package/docs/functions/col4.SerializeRGBA.html +1 -1
  272. package/docs/functions/isArrayProperty.html +1 -1
  273. package/docs/functions/isBoolArrayProperty.html +1 -1
  274. package/docs/functions/isBoolProperty.html +1 -1
  275. package/docs/functions/isBuildableSubsystemSpecialProperties.html +1 -1
  276. package/docs/functions/isByteArrayProperty.html +1 -1
  277. package/docs/functions/isByteProperty.html +1 -1
  278. package/docs/functions/isCircuitSpecialProperties.html +1 -1
  279. package/docs/functions/isConveyorChainActorSpecialProperties.html +1 -1
  280. package/docs/functions/isConveyorSpecialProperties.html +1 -1
  281. package/docs/functions/isDoubleArrayProperty.html +1 -1
  282. package/docs/functions/isDoubleProperty.html +1 -1
  283. package/docs/functions/isEmptySpecialProperties.html +1 -1
  284. package/docs/functions/isEnumArrayProperty.html +1 -1
  285. package/docs/functions/isEnumProperty.html +1 -1
  286. package/docs/functions/isFloatArrayProperty.html +1 -1
  287. package/docs/functions/isFloatProperty.html +1 -1
  288. package/docs/functions/isInt32ArrayProperty.html +1 -1
  289. package/docs/functions/isInt32Property.html +1 -1
  290. package/docs/functions/isInt32SetProperty.html +1 -1
  291. package/docs/functions/isInt64ArrayProperty.html +1 -1
  292. package/docs/functions/isInt64Property.html +1 -1
  293. package/docs/functions/isInt8Property.html +1 -1
  294. package/docs/functions/isMapProperty.html +1 -1
  295. package/docs/functions/isObjectArrayProperty.html +1 -1
  296. package/docs/functions/isObjectProperty.html +1 -1
  297. package/docs/functions/isObjectSetProperty.html +1 -1
  298. package/docs/functions/isObjectsListSpecialProperties.html +1 -1
  299. package/docs/functions/isPlayerSpecialProperties.html +1 -1
  300. package/docs/functions/isPowerLineSpecialProperties.html +1 -1
  301. package/docs/functions/isSaveComponent.html +1 -1
  302. package/docs/functions/isSaveEntity.html +1 -1
  303. package/docs/functions/isSetProperty.html +1 -1
  304. package/docs/functions/isSoftObjectArrayProperty.html +1 -1
  305. package/docs/functions/isSpecialDroneActionProperties.html +1 -1
  306. package/docs/functions/isStrArrayProperty.html +1 -1
  307. package/docs/functions/isStrProperty.html +1 -1
  308. package/docs/functions/isStrSetProperty.html +1 -1
  309. package/docs/functions/isStructArrayProperty.html +1 -1
  310. package/docs/functions/isStructProperty.html +1 -1
  311. package/docs/functions/isStructSetProperty.html +1 -1
  312. package/docs/functions/isTextArrayProperty.html +1 -1
  313. package/docs/functions/isTextProperty.html +1 -1
  314. package/docs/functions/isUInt64Property.html +1 -1
  315. package/docs/functions/isUint32Property.html +1 -1
  316. package/docs/functions/isUint32SetProperty.html +1 -1
  317. package/docs/functions/isUint8Property.html +1 -1
  318. package/docs/functions/isVehicleSpecialProperties.html +1 -1
  319. package/docs/functions/vec2.Parse.html +1 -1
  320. package/docs/functions/vec2.ParseF.html +1 -1
  321. package/docs/functions/vec2.Serialize.html +1 -1
  322. package/docs/functions/vec2.SerializeF.html +1 -1
  323. package/docs/functions/vec3.Parse.html +1 -1
  324. package/docs/functions/vec3.ParseF.html +1 -1
  325. package/docs/functions/vec3.ParseInt.html +1 -1
  326. package/docs/functions/vec3.Serialize.html +1 -1
  327. package/docs/functions/vec3.SerializeF.html +1 -1
  328. package/docs/functions/vec3.SerializeInt.html +1 -1
  329. package/docs/functions/vec3.add.html +1 -1
  330. package/docs/functions/vec3.length.html +1 -1
  331. package/docs/functions/vec3.mult.html +1 -1
  332. package/docs/functions/vec3.norm.html +1 -1
  333. package/docs/functions/vec3.sub.html +1 -1
  334. package/docs/functions/vec4.Parse.html +1 -1
  335. package/docs/functions/vec4.ParseF.html +1 -1
  336. package/docs/functions/vec4.Serialize.html +1 -1
  337. package/docs/functions/vec4.SerializeF.html +1 -1
  338. package/docs/index.html +2 -1
  339. package/docs/interfaces/Blueprint.html +2 -2
  340. package/docs/interfaces/BlueprintConfig-1.html +2 -2
  341. package/docs/interfaces/SaveComponentHeader.html +2 -2
  342. package/docs/interfaces/SaveEntityHeader.html +2 -2
  343. package/docs/interfaces/SaveObjectHeader.html +2 -2
  344. package/docs/modules/AbstractBaseProperty.html +1 -1
  345. package/docs/modules/ArrayProperty.html +1 -1
  346. package/docs/modules/BlueprintConfig.html +1 -1
  347. package/docs/modules/BlueprintHeader.html +1 -1
  348. package/docs/modules/BoolArrayProperty.html +1 -1
  349. package/docs/modules/BoolProperty.html +1 -1
  350. package/docs/modules/BuildableSubsystemSpecialProperties.html +1 -1
  351. package/docs/modules/BuildableTypeInstance.html +1 -1
  352. package/docs/modules/ByteArrayProperty.html +1 -1
  353. package/docs/modules/ByteProperty.html +1 -1
  354. package/docs/modules/CircuitSpecialProperties.html +1 -1
  355. package/docs/modules/ConveyorChainActorSpecialProperties.html +1 -1
  356. package/docs/modules/ConveyorSpecialProperties.html +1 -1
  357. package/docs/modules/DoubleArrayProperty.html +1 -1
  358. package/docs/modules/DoubleProperty.html +1 -1
  359. package/docs/modules/DynamicStructPropertyValue.html +1 -1
  360. package/docs/modules/EmptySpecialProperties.html +1 -1
  361. package/docs/modules/EnumArrayProperty.html +1 -1
  362. package/docs/modules/EnumProperty.html +1 -1
  363. package/docs/modules/FGDynamicStruct.html +1 -1
  364. package/docs/modules/FICFrameRange.html +1 -1
  365. package/docs/modules/FloatArrayProperty.html +1 -1
  366. package/docs/modules/FloatProperty.html +1 -1
  367. package/docs/modules/GUID.html +1 -1
  368. package/docs/modules/GUIDInfo.html +1 -1
  369. package/docs/modules/Int32ArrayProperty.html +1 -1
  370. package/docs/modules/Int32Property.html +1 -1
  371. package/docs/modules/Int32SetProperty.html +1 -1
  372. package/docs/modules/Int64ArrayProperty.html +1 -1
  373. package/docs/modules/Int64Property.html +1 -1
  374. package/docs/modules/Int8Property.html +1 -1
  375. package/docs/modules/Level.html +1 -1
  376. package/docs/modules/LevelToDestroyedActorsMap.html +1 -1
  377. package/docs/modules/MD5Hash.html +1 -1
  378. package/docs/modules/MapProperty.html +1 -1
  379. package/docs/modules/ObjectArrayProperty.html +1 -1
  380. package/docs/modules/ObjectProperty.html +1 -1
  381. package/docs/modules/ObjectReference.html +1 -1
  382. package/docs/modules/ObjectSetProperty.html +1 -1
  383. package/docs/modules/ObjectsListSpecialProperties.html +1 -1
  384. package/docs/modules/PlayerSpecialProperties.html +1 -1
  385. package/docs/modules/PowerLineSpecialProperties.html +1 -1
  386. package/docs/modules/PropertiesList.html +1 -1
  387. package/docs/modules/SatisfactorySaveHeader.html +1 -1
  388. package/docs/modules/SaveBodyChunks.html +1 -1
  389. package/docs/modules/SetProperty.html +1 -1
  390. package/docs/modules/SoftObjectArrayProperty.html +1 -1
  391. package/docs/modules/SoftObjectReference.html +1 -1
  392. package/docs/modules/SpecialDroneActionProperties.html +1 -1
  393. package/docs/modules/SpecialProperties.html +1 -1
  394. package/docs/modules/StrArrayProperty.html +1 -1
  395. package/docs/modules/StrProperty.html +1 -1
  396. package/docs/modules/StrSetProperty.html +1 -1
  397. package/docs/modules/StructArrayProperty.html +1 -1
  398. package/docs/modules/StructProperty.html +1 -1
  399. package/docs/modules/StructSetProperty.html +1 -1
  400. package/docs/modules/TextArrayProperty.html +1 -1
  401. package/docs/modules/TextProperty.html +1 -1
  402. package/docs/modules/Transform.html +1 -1
  403. package/docs/modules/Uint32Property.html +1 -1
  404. package/docs/modules/Uint32SetProperty.html +1 -1
  405. package/docs/modules/Uint64Property.html +1 -1
  406. package/docs/modules/Uint8Property.html +1 -1
  407. package/docs/modules/VehiclePhysicsData.html +1 -1
  408. package/docs/modules/VehicleSpecialProperties.html +1 -1
  409. package/docs/modules/col4.html +1 -1
  410. package/docs/modules/vec2.html +1 -1
  411. package/docs/modules/vec3.html +1 -1
  412. package/docs/modules/vec4.html +1 -1
  413. package/docs/types/AbstractBaseProperty-1.html +1 -1
  414. package/docs/types/ArrayProperty.AvailableArrayPropertyTypes.html +1 -1
  415. package/docs/types/ArrayPropertyStructValueFields.html +1 -1
  416. package/docs/types/BasicMultipleStructPropertyValue.html +1 -1
  417. package/docs/types/BasicStructPropertyValue.html +1 -1
  418. package/docs/types/BlueprintHeader-1.html +1 -1
  419. package/docs/types/BoolArrayProperty-1.html +1 -1
  420. package/docs/types/BoolProperty-1.html +1 -1
  421. package/docs/types/BoxStructPropertyValue.html +1 -1
  422. package/docs/types/BuildableSubsystemSpecialProperties-1.html +1 -1
  423. package/docs/types/BuildableTypeInstance-1.html +1 -1
  424. package/docs/types/ByteArray4.html +1 -1
  425. package/docs/types/ByteArrayProperty-1.html +1 -1
  426. package/docs/types/ByteProperty-1.html +1 -1
  427. package/docs/types/BytePropertyValue.html +1 -1
  428. package/docs/types/ChunkCompressionInfo.html +1 -1
  429. package/docs/types/ChunkSummary.html +1 -1
  430. package/docs/types/CircuitSpecialProperties-1.html +1 -1
  431. package/docs/types/ClientIdentityInfo.html +1 -1
  432. package/docs/types/ConveyorChainActorSpecialProperties-1.html +1 -1
  433. package/docs/types/ConveyorChainSegmentSpecialProperties.html +1 -1
  434. package/docs/types/ConveyorItemSpecialProperties.html +1 -1
  435. package/docs/types/ConveyorSpecialProperties-1.html +1 -1
  436. package/docs/types/DoubleArrayProperty-1.html +1 -1
  437. package/docs/types/DoubleProperty-1.html +1 -1
  438. package/docs/types/DynamicStructPropertyValue-1.html +1 -1
  439. package/docs/types/EmptySpecialProperties-1.html +1 -1
  440. package/docs/types/EnumArrayProperty-1.html +1 -1
  441. package/docs/types/EnumProperty-1.html +1 -1
  442. package/docs/types/FGDynamicStruct-1.html +1 -1
  443. package/docs/types/FICFrameRange-1.html +1 -1
  444. package/docs/types/FICFrameRangeStructPropertyValue.html +1 -1
  445. package/docs/types/FloatArrayProperty-1.html +1 -1
  446. package/docs/types/FloatProperty-1.html +1 -1
  447. package/docs/types/GENERIC_MAP_KEY_TYPE.html +1 -1
  448. package/docs/types/GENERIC_MAP_VALUE_TYPE.html +1 -1
  449. package/docs/types/GENERIC_STRUCT_PROPERTY_VALUE.html +1 -1
  450. package/docs/types/GUID-1.html +1 -1
  451. package/docs/types/GUIDInfo-1.html +1 -1
  452. package/docs/types/Grids.html +1 -1
  453. package/docs/types/Int32ArrayProperty-1.html +1 -1
  454. package/docs/types/Int32Property-1.html +1 -1
  455. package/docs/types/Int32SetProperty-1.html +1 -1
  456. package/docs/types/Int64ArrayProperty-1.html +1 -1
  457. package/docs/types/Int64Property-1.html +1 -1
  458. package/docs/types/Int8Property-1.html +1 -1
  459. package/docs/types/InventoryItemStructPropertyValue.html +1 -1
  460. package/docs/types/Level-1.html +1 -1
  461. package/docs/types/LevelToDestroyedActorsMap-1.html +1 -1
  462. package/docs/types/Levels.html +1 -1
  463. package/docs/types/MAP_STRUCT_KEY_PROXY.html +1 -1
  464. package/docs/types/MD5Hash-1.html +1 -1
  465. package/docs/types/MapProperty-1.html +1 -1
  466. package/docs/types/ModData.html +1 -1
  467. package/docs/types/ObjectArrayProperty-1.html +1 -1
  468. package/docs/types/ObjectProperty-1.html +1 -1
  469. package/docs/types/ObjectReference-1.html +1 -1
  470. package/docs/types/ObjectSetProperty-1.html +1 -1
  471. package/docs/types/ObjectsListSpecialProperties-1.html +1 -1
  472. package/docs/types/PlayerSpecialProperties-1.html +1 -1
  473. package/docs/types/PowerLineSpecialProperties-1.html +1 -1
  474. package/docs/types/PropertiesMap.html +1 -1
  475. package/docs/types/RailroadTrackPositionStructPropertyValue.html +1 -1
  476. package/docs/types/RoughSaveVersion.html +1 -1
  477. package/docs/types/SatisfactoryModMetadata.html +1 -1
  478. package/docs/types/SatisfactorySaveHeader-1.html +1 -1
  479. package/docs/types/SaveBodyChunks-1.html +1 -1
  480. package/docs/types/SaveBodyValidation.html +1 -1
  481. package/docs/types/SetProperty.AvailableSetPropertyTypes.html +1 -1
  482. package/docs/types/SoftObjectArrayProperty-1.html +1 -1
  483. package/docs/types/SoftObjectReference-1.html +1 -1
  484. package/docs/types/SpecialDroneAction.html +1 -1
  485. package/docs/types/SpecialDroneActionProperties-1.html +1 -1
  486. package/docs/types/SpecialProperties.AvailableSpecialPropertiesTypes.html +1 -1
  487. package/docs/types/StrArrayProperty-1.html +1 -1
  488. package/docs/types/StrProperty-1.html +1 -1
  489. package/docs/types/StrSetProperty-1.html +1 -1
  490. package/docs/types/StructArrayProperty-1.html +1 -1
  491. package/docs/types/StructProperty-1.html +1 -1
  492. package/docs/types/StructSetProperty-1.html +1 -1
  493. package/docs/types/TextArrayProperty-1.html +1 -1
  494. package/docs/types/TextProperty-1.html +1 -1
  495. package/docs/types/TextPropertyValue.html +1 -1
  496. package/docs/types/Transform-1.html +1 -1
  497. package/docs/types/Uint32Property-1.html +1 -1
  498. package/docs/types/Uint32SetProperty-1.html +1 -1
  499. package/docs/types/Uint64Property-1.html +1 -1
  500. package/docs/types/Uint8Property-1.html +1 -1
  501. package/docs/types/VehiclePhysicsData-1.html +1 -1
  502. package/docs/types/VehicleSpecialProperties-1.html +1 -1
  503. package/docs/types/col4-1.html +1 -1
  504. package/docs/types/vec2-1.html +1 -1
  505. package/docs/types/vec3-1.html +1 -1
  506. package/docs/types/vec4-1.html +1 -1
  507. package/docs/variables/DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE.html +1 -1
  508. package/docs/variables/EDIT.html +1 -1
  509. package/docs/variables/SaveBodyChunks.HEADER_V1.html +1 -1
  510. package/docs/variables/SaveBodyChunks.HEADER_V2.html +1 -1
  511. package/jsr.json +5 -5
  512. package/package.json +1 -2
@@ -1,9 +1,9 @@
1
1
  import { WritableStreamDefaultWriter } from "stream/web";
2
2
  import { SatisfactorySaveHeader } from '../../satisfactory/save/satisfactory-save-header';
3
3
  import { ChunkCompressionInfo } from "../../satisfactory/save/save-body-chunks";
4
- import { Grids, SaveBodyValidation } from '../../satisfactory/save/save-reader';
5
4
  import { SaveObject } from "../../satisfactory/types/objects/SaveObject";
6
5
  import { ObjectReference } from '../../satisfactory/types/structs/ObjectReference';
6
+ import { SaveBodyValidation } from "../../satisfactory/types/structs/SaveBodyValidation";
7
7
  export declare class SaveStreamWriter {
8
8
  private writer;
9
9
  private mode;
@@ -14,8 +14,7 @@ export declare class SaveStreamWriter {
14
14
  beginSave: () => Promise<void>;
15
15
  writeHeader: (header: SatisfactorySaveHeader) => Promise<void>;
16
16
  writeCompressionInfo: (compressionInfo: ChunkCompressionInfo) => Promise<void>;
17
- writeGridHash: (gridHash: SaveBodyValidation) => Promise<void>;
18
- writeGrids: (grids: Grids) => Promise<void>;
17
+ writeSaveBodyValidation: (saveBodyValidation: SaveBodyValidation) => Promise<void>;
19
18
  openLevels: () => Promise<void>;
20
19
  openLevel: (levelName: string) => Promise<void>;
21
20
  writeObjects: (...objects: SaveObject[]) => Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"save-stream-writer.class.d.ts","sourceRoot":"","sources":["../../../../src/parser/stream/reworked/save-stream-writer.class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kDAAkD,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AAwBnF,qBAAa,gBAAgB;IAahB,OAAO,CAAC,MAAM;IAX1B,OAAO,CAAC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) => this.createExecutionFunction(['FINISHED_HEADER'], async () => {
32
32
  await this.writer.write(`, "compressionInfo": ${JSON.stringify(compressionInfo)}`);
33
33
  }, 'WROTE_COMPRESSION_INFO');
34
- this.writeGridHash = (gridHash) => this.createExecutionFunction(['WROTE_COMPRESSION_INFO'], async () => {
35
- await this.writer.write(`, "gridHash": ${JSON.stringify(gridHash)}`);
36
- }, 'WROTE_GRID_HASH');
37
- this.writeGrids = (grids) => this.createExecutionFunction(['WROTE_GRID_HASH'], async () => {
38
- await this.writer.write(`, "grids": ${JSON.stringify(grids)}`);
39
- }, 'WROTE_GRIDS');
40
- this.openLevels = () => this.createExecutionFunction(['WROTE_GRIDS'], async () => {
34
+ this.writeSaveBodyValidation = (saveBodyValidation) => this.createExecutionFunction(['WROTE_COMPRESSION_INFO'], async () => {
35
+ await this.writer.write(`, "saveBodyValidation": ${JSON.stringify(saveBodyValidation)}`);
36
+ }, 'WROTE_SAVE_BODY_VALIDATION');
37
+ this.openLevels = () => this.createExecutionFunction(['WROTE_SAVE_BODY_VALIDATION'], async () => {
41
38
  await this.writer.write(`, "levels": [`);
42
39
  }, 'OPENED_LEVELS');
43
40
  this.openLevel = (levelName) => this.createExecutionFunction(['OPENED_LEVELS', 'FINISHED_LEVEL'], async () => {
@@ -1 +1 @@
1
- {"version":3,"file":"save-stream-writer.class.js","sourceRoot":"","sources":["../../../../src/parser/stream/reworked/save-stream-writer.class.ts"],"names":[],"mappings":";;;AAUA,MAAM,gBAAgB;IACrB,YAAmB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAE7B,CAAC;IAEM,iBAAiB,CAAC,GAAG,mBAA2B;QACtD,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,CAAC,IAAI,cAAc,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC9H,CA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B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;CACD;AApJD,4CAoJC","sourcesContent":["import { WritableStreamDefaultWriter } from \"stream/web\";\nimport { SatisfactorySaveHeader } from '../../satisfactory/save/satisfactory-save-header';\nimport { ChunkCompressionInfo } from \"../../satisfactory/save/save-body-chunks\";\nimport { Grids, SaveBodyValidation } from '../../satisfactory/save/save-reader';\nimport { SaveObject } from \"../../satisfactory/types/objects/SaveObject\";\nimport { ObjectReference } from '../../satisfactory/types/structs/ObjectReference';\n\ntype Mode = 'BEFORE_START' | 'OPENED_SAVE' | 'FINISHED_HEADER' | 'OPENED_LEVELS' | 'FINISHED_LEVELS' | 'OPENED_LEVEL' | 'FINISHED_LEVEL' | 'FINISHED_SAVE'\n\t| 'WROTE_COMPRESSION_INFO' | 'WROTE_OBJECT' | 'SWITCH_TO_COLLECTABLES' | 'WROTE_COLLECTABLE' | 'WROTE_GRID_HASH' | 'WROTE_GRIDS';\n\nclass ModeStateTracker {\n\tconstructor(public mode: Mode) {\n\n\t}\n\n\tpublic checkIsComingFrom(...allowedPredecessors: Mode[]) {\n\t\tif (!allowedPredecessors.includes(this.mode)) {\n\t\t\tthrow new Error(`Wrong order of commands. mode is ${this.mode}. but only ${allowedPredecessors.join(', ')} is/are allowed.`);\n\t\t}\n\t}\n\n\tpublic advance(newMode: Mode) {\n\t\tthis.mode = newMode;\n\t}\n}\n\n/**\n * @deprecated use ReadableStreamParser instead.\n */\nexport class SaveStreamWriter {\n\n\tprivate mode: Mode;\n\tprivate tracker: ModeStateTracker;\n\n\t// we need some flat structure to keep track of number of elements.\n\tprivate formatTracker: {\n\t\tlevels: {\n\t\t\tobjectCount: number;\n\t\t\tcollectablesCount: number;\n\t\t}[]\n\t};\n\n\tconstructor(private writer: WritableStreamDefaultWriter<string>) {\n\t\tthis.mode = 'BEFORE_START';\n\t\tthis.tracker = new ModeStateTracker(this.mode);\n\t\tthis.formatTracker = {\n\t\t\tlevels: []\n\t\t};\n\t}\n\n\tprivate createExecutionFunction = async (allowedInputModes: Mode[], fn: () => Promise<void> | void, targetMode: Mode): Promise<void> => {\n\t\tthis.tracker.checkIsComingFrom(...allowedInputModes);\n\t\tawait fn();\n\t\tthis.tracker.advance(targetMode);\n\t}\n\n\tpublic beginSave = (): Promise<void> => this.createExecutionFunction(\n\t\t['BEFORE_START'],\n\t\tasync () => {\n\t\t\tawait this.writer.write('{');\n\t\t},\n\t\t'OPENED_SAVE'\n\t);\n\n\tpublic writeHeader = (header: SatisfactorySaveHeader): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_SAVE'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`\"header\": ${JSON.stringify(header)}`);\n\t\t},\n\t\t'FINISHED_HEADER'\n\t);\n\n\tpublic writeCompressionInfo = (compressionInfo: ChunkCompressionInfo): Promise<void> => this.createExecutionFunction(\n\t\t['FINISHED_HEADER'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`, \"compressionInfo\": ${JSON.stringify(compressionInfo)}`);\n\t\t},\n\t\t'WROTE_COMPRESSION_INFO'\n\t);\n\n\tpublic writeGridHash = (gridHash: SaveBodyValidation): Promise<void> => this.createExecutionFunction(\n\t\t['WROTE_COMPRESSION_INFO'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`, \"gridHash\": ${JSON.stringify(gridHash)}`);\n\t\t},\n\t\t'WROTE_GRID_HASH'\n\t);\n\n\tpublic writeGrids = (grids: Grids): Promise<void> => this.createExecutionFunction(\n\t\t['WROTE_GRID_HASH'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`, \"grids\": ${JSON.stringify(grids)}`);\n\t\t},\n\t\t'WROTE_GRIDS'\n\t);\n\n\tpublic openLevels = (): Promise<void> => this.createExecutionFunction(\n\t\t['WROTE_GRIDS'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`, \"levels\": [`);\n\t\t},\n\t\t'OPENED_LEVELS'\n\t);\n\n\tpublic openLevel = (levelName: string): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_LEVELS', 'FINISHED_LEVEL'],\n\t\tasync () => {\n\t\t\tthis.formatTracker.levels.push({\n\t\t\t\tobjectCount: 0, collectablesCount: 0\n\t\t\t});\n\t\t\tconst prefix = this.formatTracker.levels.length > 1 ? ', ' : '';\n\t\t\tawait this.writer.write(`${prefix}{\"name\": \"${levelName}\", \"objects\": [`);\n\t\t},\n\t\t'OPENED_LEVEL'\n\t);\n\n\tpublic writeObjects = (...objects: SaveObject[]): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_LEVEL', 'WROTE_OBJECT'],\n\t\tasync () => {\n\t\t\tconst stringified = objects.map(saveObj => JSON.stringify(saveObj));\n\n\t\t\tfor (const obj of stringified) {\n\t\t\t\tawait this.writer.write(`${this.formatTracker.levels.at(-1)!.objectCount >= 1 ? ', ' : ''}${obj}`);\n\t\t\t\tthis.formatTracker.levels.at(-1)!.objectCount++;\n\t\t\t}\n\t\t},\n\t\t'WROTE_OBJECT'\n\t);\n\n\tpublic switchInLevelToCollectables = (...objects: SaveObject[]): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_LEVEL', 'WROTE_OBJECT'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`], \"collectables\": [`);\n\t\t},\n\t\t'SWITCH_TO_COLLECTABLES'\n\t);\n\n\tpublic writeCollectables = (...collectables: ObjectReference[]): Promise<void> => this.createExecutionFunction(\n\t\t['SWITCH_TO_COLLECTABLES', 'WROTE_COLLECTABLE'],\n\t\tasync () => {\n\t\t\tconst stringified = collectables.map(coll => JSON.stringify(coll));\n\n\t\t\tfor (const obj of stringified) {\n\t\t\t\tawait this.writer.write(`${this.formatTracker.levels.at(-1)!.collectablesCount >= 1 ? ', ' : ''}${obj}`);\n\t\t\t\tthis.formatTracker.levels.at(-1)!.collectablesCount++;\n\t\t\t}\n\t\t},\n\t\t'WROTE_COLLECTABLE'\n\t);\n\n\tpublic endLevel = (): Promise<void> => this.createExecutionFunction(\n\t\t['SWITCH_TO_COLLECTABLES', 'WROTE_COLLECTABLE'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`]}`);\n\t\t},\n\t\t'FINISHED_LEVEL'\n\t);\n\n\tpublic endLevels = (): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_LEVELS', 'FINISHED_LEVEL'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`]`);\n\t\t},\n\t\t'FINISHED_LEVELS'\n\t);\n\n\tpublic endSave = (): Promise<void> => this.createExecutionFunction(\n\t\t['FINISHED_LEVELS'],\n\t\tasync () => {\n\t\t\tawait this.writer.write('}');\n\t\t},\n\t\t'FINISHED_SAVE'\n\t);\n\n\tpublic async close(): Promise<void> {\n\t\treturn this.writer.close();\n\t}\n}"]}
1
+ {"version":3,"file":"save-stream-writer.class.js","sourceRoot":"","sources":["../../../../src/parser/stream/reworked/save-stream-writer.class.ts"],"names":[],"mappings":";;;AAUA,MAAM,gBAAgB;IACrB,YAAmB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAE7B,CAAC;IAEM,iBAAiB,CAAC,GAAG,mBAA2B;QACtD,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,CAAC,IAAI,cAAc,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC9H,CAAC;IACF,CAAC;IAEM,OAAO,CAAC,OAAa;QAC3B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;IACrB,CAAC;CACD;AAKD,MAAa,gBAAgB;IAa5B,YAAoB,MAA2C;QAA3C,WAAM,GAAN,MAAM,CAAqC;QAQvD,4BAAuB,GAAG,KAAK,EAAE,iBAAyB,EAAE,EAA8B,EAAE,UAAgB,EAAiB,EAAE;YACtI,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CAAC,CAAC;YAC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AS,GAAG,GAAkB,EAAE,CAAC,IAAI,CAAC,uBAAuB,CACnE,CAAC,eAAe,EAAE,gBAAgB,CAAC,EACnC,KAAK,IAAI,EAAE;YACV,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC,EACD,iBAAiB,CACjB,CAAC;QAEK,YAAO,GAAG,GAAkB,EAAE,CAAC,IAAI,CAAC,uBAAuB,CACjE,CAAC,iBAAiB,CAAC,EACnB,KAAK,IAAI,EAAE;YACV,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC,EACD,eAAe,CACf,CAAC;QA1HD,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,CAAC,aAAa,GAAG;YACpB,MAAM,EAAE,EAAE;SACV,CAAC;IACH,CAAC;IAuHM,KAAK,CAAC,KAAK;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;CACD;AA7ID,4CA6IC","sourcesContent":["import { WritableStreamDefaultWriter } from \"stream/web\";\nimport { SatisfactorySaveHeader } from '../../satisfactory/save/satisfactory-save-header';\nimport { ChunkCompressionInfo } from \"../../satisfactory/save/save-body-chunks\";\nimport { SaveObject } from \"../../satisfactory/types/objects/SaveObject\";\nimport { ObjectReference } from '../../satisfactory/types/structs/ObjectReference';\nimport { Grids, SaveBodyValidation } from \"../../satisfactory/types/structs/SaveBodyValidation\";\n\ntype Mode = 'BEFORE_START' | 'OPENED_SAVE' | 'FINISHED_HEADER' | 'OPENED_LEVELS' | 'FINISHED_LEVELS' | 'OPENED_LEVEL' | 'FINISHED_LEVEL' | 'FINISHED_SAVE'\n\t| 'WROTE_COMPRESSION_INFO' | 'WROTE_OBJECT' | 'SWITCH_TO_COLLECTABLES' | 'WROTE_COLLECTABLE' | 'WROTE_SAVE_BODY_VALIDATION';\n\nclass ModeStateTracker {\n\tconstructor(public mode: Mode) {\n\n\t}\n\n\tpublic checkIsComingFrom(...allowedPredecessors: Mode[]) {\n\t\tif (!allowedPredecessors.includes(this.mode)) {\n\t\t\tthrow new Error(`Wrong order of commands. mode is ${this.mode}. but only ${allowedPredecessors.join(', ')} is/are allowed.`);\n\t\t}\n\t}\n\n\tpublic advance(newMode: Mode) {\n\t\tthis.mode = newMode;\n\t}\n}\n\n/**\n * @deprecated use ReadableStreamParser instead.\n */\nexport class SaveStreamWriter {\n\n\tprivate mode: Mode;\n\tprivate tracker: ModeStateTracker;\n\n\t// we need some flat structure to keep track of number of elements.\n\tprivate formatTracker: {\n\t\tlevels: {\n\t\t\tobjectCount: number;\n\t\t\tcollectablesCount: number;\n\t\t}[]\n\t};\n\n\tconstructor(private writer: WritableStreamDefaultWriter<string>) {\n\t\tthis.mode = 'BEFORE_START';\n\t\tthis.tracker = new ModeStateTracker(this.mode);\n\t\tthis.formatTracker = {\n\t\t\tlevels: []\n\t\t};\n\t}\n\n\tprivate createExecutionFunction = async (allowedInputModes: Mode[], fn: () => Promise<void> | void, targetMode: Mode): Promise<void> => {\n\t\tthis.tracker.checkIsComingFrom(...allowedInputModes);\n\t\tawait fn();\n\t\tthis.tracker.advance(targetMode);\n\t}\n\n\tpublic beginSave = (): Promise<void> => this.createExecutionFunction(\n\t\t['BEFORE_START'],\n\t\tasync () => {\n\t\t\tawait this.writer.write('{');\n\t\t},\n\t\t'OPENED_SAVE'\n\t);\n\n\tpublic writeHeader = (header: SatisfactorySaveHeader): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_SAVE'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`\"header\": ${JSON.stringify(header)}`);\n\t\t},\n\t\t'FINISHED_HEADER'\n\t);\n\n\tpublic writeCompressionInfo = (compressionInfo: ChunkCompressionInfo): Promise<void> => this.createExecutionFunction(\n\t\t['FINISHED_HEADER'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`, \"compressionInfo\": ${JSON.stringify(compressionInfo)}`);\n\t\t},\n\t\t'WROTE_COMPRESSION_INFO'\n\t);\n\n\tpublic writeSaveBodyValidation = (saveBodyValidation: SaveBodyValidation): Promise<void> => this.createExecutionFunction(\n\t\t['WROTE_COMPRESSION_INFO'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`, \"saveBodyValidation\": ${JSON.stringify(saveBodyValidation)}`);\n\t\t},\n\t\t'WROTE_SAVE_BODY_VALIDATION'\n\t);\n\n\n\tpublic openLevels = (): Promise<void> => this.createExecutionFunction(\n\t\t['WROTE_SAVE_BODY_VALIDATION'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`, \"levels\": [`);\n\t\t},\n\t\t'OPENED_LEVELS'\n\t);\n\n\tpublic openLevel = (levelName: string): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_LEVELS', 'FINISHED_LEVEL'],\n\t\tasync () => {\n\t\t\tthis.formatTracker.levels.push({\n\t\t\t\tobjectCount: 0, collectablesCount: 0\n\t\t\t});\n\t\t\tconst prefix = this.formatTracker.levels.length > 1 ? ', ' : '';\n\t\t\tawait this.writer.write(`${prefix}{\"name\": \"${levelName}\", \"objects\": [`);\n\t\t},\n\t\t'OPENED_LEVEL'\n\t);\n\n\tpublic writeObjects = (...objects: SaveObject[]): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_LEVEL', 'WROTE_OBJECT'],\n\t\tasync () => {\n\t\t\tconst stringified = objects.map(saveObj => JSON.stringify(saveObj));\n\n\t\t\tfor (const obj of stringified) {\n\t\t\t\tawait this.writer.write(`${this.formatTracker.levels.at(-1)!.objectCount >= 1 ? ', ' : ''}${obj}`);\n\t\t\t\tthis.formatTracker.levels.at(-1)!.objectCount++;\n\t\t\t}\n\t\t},\n\t\t'WROTE_OBJECT'\n\t);\n\n\tpublic switchInLevelToCollectables = (...objects: SaveObject[]): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_LEVEL', 'WROTE_OBJECT'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`], \"collectables\": [`);\n\t\t},\n\t\t'SWITCH_TO_COLLECTABLES'\n\t);\n\n\tpublic writeCollectables = (...collectables: ObjectReference[]): Promise<void> => this.createExecutionFunction(\n\t\t['SWITCH_TO_COLLECTABLES', 'WROTE_COLLECTABLE'],\n\t\tasync () => {\n\t\t\tconst stringified = collectables.map(coll => JSON.stringify(coll));\n\n\t\t\tfor (const obj of stringified) {\n\t\t\t\tawait this.writer.write(`${this.formatTracker.levels.at(-1)!.collectablesCount >= 1 ? ', ' : ''}${obj}`);\n\t\t\t\tthis.formatTracker.levels.at(-1)!.collectablesCount++;\n\t\t\t}\n\t\t},\n\t\t'WROTE_COLLECTABLE'\n\t);\n\n\tpublic endLevel = (): Promise<void> => this.createExecutionFunction(\n\t\t['SWITCH_TO_COLLECTABLES', 'WROTE_COLLECTABLE'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`]}`);\n\t\t},\n\t\t'FINISHED_LEVEL'\n\t);\n\n\tpublic endLevels = (): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_LEVELS', 'FINISHED_LEVEL'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`]`);\n\t\t},\n\t\t'FINISHED_LEVELS'\n\t);\n\n\tpublic endSave = (): Promise<void> => this.createExecutionFunction(\n\t\t['FINISHED_LEVELS'],\n\t\tasync () => {\n\t\t\tawait this.writer.write('}');\n\t\t},\n\t\t'FINISHED_SAVE'\n\t);\n\n\tpublic async close(): Promise<void> {\n\t\treturn this.writer.close();\n\t}\n}"]}