@shipload/sdk 1.0.0-next.3 → 1.0.0-next.30

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 (99) hide show
  1. package/lib/shipload.d.ts +1847 -962
  2. package/lib/shipload.js +9088 -4854
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +8957 -4805
  5. package/lib/shipload.m.js.map +1 -1
  6. package/lib/testing.d.ts +856 -0
  7. package/lib/testing.js +3739 -0
  8. package/lib/testing.js.map +1 -0
  9. package/lib/testing.m.js +3733 -0
  10. package/lib/testing.m.js.map +1 -0
  11. package/package.json +15 -2
  12. package/src/capabilities/craftable.ts +51 -0
  13. package/src/capabilities/crafting.test.ts +7 -0
  14. package/src/capabilities/crafting.ts +3 -3
  15. package/src/capabilities/gathering.ts +17 -7
  16. package/src/capabilities/index.ts +0 -1
  17. package/src/capabilities/modules.ts +6 -0
  18. package/src/capabilities/storage.ts +16 -1
  19. package/src/contracts/platform.ts +231 -3
  20. package/src/contracts/server.ts +816 -471
  21. package/src/data/capabilities.ts +14 -329
  22. package/src/data/capability-formulas.ts +76 -0
  23. package/src/data/catalog.ts +0 -5
  24. package/src/data/colors.ts +14 -47
  25. package/src/data/entities.json +46 -10
  26. package/src/data/item-ids.ts +15 -12
  27. package/src/data/items.json +302 -38
  28. package/src/data/kind-registry.json +85 -0
  29. package/src/data/kind-registry.ts +150 -0
  30. package/src/data/metadata.ts +100 -31
  31. package/src/data/recipes-runtime.ts +3 -23
  32. package/src/data/recipes.json +250 -113
  33. package/src/derivation/build-methods.ts +45 -0
  34. package/src/derivation/capabilities.ts +415 -0
  35. package/src/derivation/capability-mappings.ts +117 -0
  36. package/src/derivation/crafting.ts +23 -24
  37. package/src/derivation/index.ts +17 -2
  38. package/src/derivation/reserve-regen.ts +34 -0
  39. package/src/derivation/resources.ts +125 -38
  40. package/src/derivation/stars.test.ts +51 -0
  41. package/src/derivation/stars.ts +15 -0
  42. package/src/derivation/stats.ts +6 -6
  43. package/src/derivation/stratum.ts +15 -19
  44. package/src/derivation/tiers.ts +28 -7
  45. package/src/entities/entity.ts +98 -0
  46. package/src/entities/gamestate.ts +3 -28
  47. package/src/entities/makers.ts +91 -136
  48. package/src/entities/slot-multiplier.ts +39 -0
  49. package/src/errors.ts +10 -15
  50. package/src/format.ts +26 -4
  51. package/src/index-module.ts +189 -47
  52. package/src/managers/actions.ts +252 -83
  53. package/src/managers/base.ts +6 -2
  54. package/src/managers/construction-types.ts +79 -0
  55. package/src/managers/construction.ts +396 -0
  56. package/src/managers/context.ts +11 -1
  57. package/src/managers/entities.ts +18 -66
  58. package/src/managers/epochs.ts +40 -0
  59. package/src/managers/index.ts +17 -1
  60. package/src/managers/locations.ts +25 -29
  61. package/src/managers/nft.ts +28 -0
  62. package/src/managers/plot.ts +127 -0
  63. package/src/nft/atomicassets.abi.json +1342 -0
  64. package/src/nft/atomicassets.ts +237 -0
  65. package/src/nft/atomicdata.ts +130 -0
  66. package/src/nft/buildImmutableData.ts +321 -0
  67. package/src/nft/description.ts +37 -15
  68. package/src/nft/index.ts +3 -0
  69. package/src/resolution/describe-module.ts +5 -8
  70. package/src/resolution/display-name.ts +38 -10
  71. package/src/resolution/resolve-item.ts +22 -20
  72. package/src/scheduling/accessor.ts +68 -22
  73. package/src/scheduling/availability.ts +108 -0
  74. package/src/scheduling/energy.ts +48 -0
  75. package/src/scheduling/lane-core.ts +130 -0
  76. package/src/scheduling/lanes.ts +60 -0
  77. package/src/scheduling/projection.ts +121 -94
  78. package/src/scheduling/schedule.ts +237 -103
  79. package/src/scheduling/task-cargo.ts +46 -0
  80. package/src/shipload.ts +16 -1
  81. package/src/subscriptions/manager.ts +40 -6
  82. package/src/subscriptions/mappers.ts +3 -8
  83. package/src/subscriptions/types.ts +3 -2
  84. package/src/testing/catalog-hash.ts +19 -0
  85. package/src/testing/index.ts +2 -0
  86. package/src/testing/projection-parity.ts +143 -0
  87. package/src/travel/travel.ts +90 -13
  88. package/src/types/capabilities.ts +1 -0
  89. package/src/types/index.ts +0 -1
  90. package/src/types.ts +19 -12
  91. package/src/utils/cargo.ts +27 -0
  92. package/src/utils/display-name.ts +61 -0
  93. package/src/utils/system.ts +25 -24
  94. package/src/capabilities/loading.ts +0 -8
  95. package/src/entities/container.ts +0 -108
  96. package/src/entities/ship-deploy.ts +0 -258
  97. package/src/entities/ship.ts +0 -204
  98. package/src/entities/warehouse.ts +0 -119
  99. package/src/types/entity-traits.ts +0 -69
@@ -10,30 +10,32 @@ export {Types as ServerTypes} from './contracts/server'
10
10
  export {Types as PlatformTypes} from './contracts/platform'
11
11
 
12
12
  import type {ServerContract} from './contracts'
13
+ import type {Entity as EntityType} from './entities/entity'
13
14
 
14
15
  export {Shipload} from './shipload'
15
- export {Ship} from './entities/ship'
16
- export type {ShipStateInput, PackedModuleInput} from './entities/ship'
17
- export {Warehouse, computeWarehouseCapabilities} from './entities/warehouse'
18
- export type {WarehouseStateInput} from './entities/warehouse'
19
- export {Container} from './entities/container'
20
- export type {ContainerStateInput} from './entities/container'
21
- export {makeShip, makeWarehouse, makeContainer} from './entities/makers'
16
+ export {Entity} from './entities/entity'
17
+ export type Ship = EntityType
18
+ export type Warehouse = EntityType
19
+ export type Container = EntityType
20
+ export type Extractor = EntityType
21
+ export type Factory = EntityType
22
+ export type Nexus = EntityType
23
+ export {makeEntity} from './entities/makers'
24
+ export type {EntityStateInput, PackedModuleInput} from './entities/makers'
25
+ export type {InstalledModule} from './entities/slot-multiplier'
22
26
 
23
27
  export type movement_stats = ServerContract.Types.movement_stats
24
28
  export type energy_stats = ServerContract.Types.energy_stats
25
29
  export type loader_stats = ServerContract.Types.loader_stats
26
30
  export type schedule = ServerContract.Types.schedule
31
+ export type lane = ServerContract.Types.lane
27
32
  export type task = ServerContract.Types.task
28
33
  export type cargo_item = ServerContract.Types.cargo_item
29
- export type warehouse_row = ServerContract.Types.warehouse_row
30
- export type container_row = ServerContract.Types.container_row
34
+ export type entity_row = ServerContract.Types.entity_row
31
35
  export type gatherer_stats = ServerContract.Types.gatherer_stats
32
36
 
33
37
  export type location_static = ServerContract.Types.location_static
34
- export type location_epoch = ServerContract.Types.location_epoch
35
38
  export type location_derived = ServerContract.Types.location_derived
36
- export type location_row = ServerContract.Types.location_row
37
39
  export {Player} from './entities/player'
38
40
  export type {PlayerStateInput} from './entities/player'
39
41
  export {EntityInventory} from './entities/entity-inventory'
@@ -46,8 +48,22 @@ export {
46
48
  LocationsManager,
47
49
  EpochsManager,
48
50
  ActionsManager,
51
+ NftManager,
52
+ ConstructionManager,
53
+ } from './managers'
54
+ export type {
55
+ LocationStratum,
56
+ NftConfigForItem,
57
+ BuildableTarget,
58
+ BuildState,
59
+ SourceEntityRef,
60
+ SourceCargoStack,
61
+ FinalizerEntityRef,
62
+ FinalizerCapability,
63
+ InboundTransfer,
64
+ ScheduledBuild,
65
+ Reservation,
49
66
  } from './managers'
50
- export type {EntityType, LocationStratum} from './managers'
51
67
  export type {EntityRefInput} from './managers/actions'
52
68
 
53
69
  export {
@@ -63,7 +79,6 @@ export {
63
79
  categoryLabel,
64
80
  categoryFromIndex,
65
81
  categoryLabelFromIndex,
66
- tierLabel,
67
82
  } from './data/catalog'
68
83
  export {getCurrentEpoch, getEpochInfo} from './scheduling/epoch'
69
84
  export type {EpochInfo} from './scheduling/epoch'
@@ -73,8 +88,8 @@ export {
73
88
  getLocationType,
74
89
  getLocationTypeName,
75
90
  isGatherableLocation,
91
+ isLocationBuildable,
76
92
  deriveLocationStatic,
77
- deriveLocationEpoch,
78
93
  deriveLocation,
79
94
  } from './utils/system'
80
95
 
@@ -86,6 +101,7 @@ export {
86
101
  getEligibleResources,
87
102
  getResourceWeight,
88
103
  getLocationCandidates,
104
+ getLocationProfile,
89
105
  getDepthThreshold,
90
106
  getResourceTier,
91
107
  DEPTH_THRESHOLD_T1,
@@ -95,6 +111,9 @@ export {
95
111
  DEPTH_THRESHOLD_T5,
96
112
  LOCATION_MIN_DEPTH,
97
113
  LOCATION_MAX_DEPTH,
114
+ yieldThresholdAt,
115
+ YIELD_FRACTION_SHALLOW,
116
+ YIELD_FRACTION_DEEP,
98
117
  PLANET_SUBTYPE_GAS_GIANT,
99
118
  PLANET_SUBTYPE_ROCKY,
100
119
  PLANET_SUBTYPE_TERRESTRIAL,
@@ -105,42 +124,61 @@ export {
105
124
 
106
125
  export type {StratumInfo, ResourceStats, DerivedStratum} from './derivation'
107
126
 
108
- export {RESERVE_TIERS, TIER_ROLL_MAX, rollTier, rollWithinTier} from './derivation'
127
+ export {RESERVE_TIERS, TIER_ROLL_MAX, tierOfReserve, rollTier, rollWithinTier} from './derivation'
109
128
  export type {ReserveTier, TierRange} from './derivation'
110
129
 
130
+ export {getEffectiveReserve} from './derivation'
131
+ export type {EffectiveReserveInput} from './derivation'
132
+
111
133
  export {getStatDefinitions, getStatName, resolveStats} from './derivation'
112
134
  export type {StatDefinition, NamedStats} from './derivation'
113
135
 
136
+ export {
137
+ STAR_STEP,
138
+ MAX_STARS_PER_STAT,
139
+ MAX_STAR_RATING,
140
+ starsForStat,
141
+ starRating,
142
+ statMagnitude,
143
+ } from './derivation'
144
+
114
145
  export {hash, hash512} from './utils/hash'
146
+ export {validateDisplayName, normalizeDisplayName} from './utils/display-name'
147
+ export type {DisplayNameResult} from './utils/display-name'
115
148
 
116
149
  export {
117
150
  distanceBetweenCoordinates,
118
151
  distanceBetweenPoints,
119
152
  findNearbyPlanets,
120
- lerp,
121
- rotation,
122
- calc_ship_mass,
123
153
  calc_acceleration,
154
+ calc_energyusage,
124
155
  calc_flighttime,
125
- calc_ship_flighttime,
126
- calc_ship_acceleration,
127
- calc_rechargetime,
128
- calc_ship_rechargetime,
129
- calc_loader_flighttime,
130
156
  calc_loader_acceleration,
131
- calc_energyusage,
157
+ calc_loader_flighttime,
132
158
  calc_orbital_altitude,
159
+ calc_rechargetime,
160
+ calc_ship_acceleration,
161
+ calc_ship_flighttime,
162
+ calc_ship_mass,
163
+ calc_ship_rechargetime,
133
164
  calc_transfer_duration,
134
- calculateTransferTime,
165
+ calculateFlightTime,
135
166
  calculateLoadTimeBreakdown,
136
167
  calculateRefuelingTime,
137
- calculateFlightTime,
138
- estimateTravelTime,
168
+ calculateTransferTime,
169
+ easeFlightProgress,
139
170
  estimateDealTravelTime,
140
- hasEnergyForDistance,
141
- getFlightOrigin,
171
+ estimateTravelTime,
172
+ flightSpeedFactor,
173
+ type FloatPosition,
142
174
  getDestinationLocation,
175
+ getFlightOrigin,
176
+ getInterpolatedPosition,
143
177
  getPositionAt,
178
+ hasEnergyForDistance,
179
+ interpolateFlightPosition,
180
+ lerp,
181
+ rotation,
144
182
  } from './travel/travel'
145
183
  export type {
146
184
  LoadTimeBreakdown,
@@ -151,7 +189,19 @@ export type {
151
189
  } from './travel/travel'
152
190
 
153
191
  export * as schedule from './scheduling/schedule'
154
- export type {Scheduleable, ScheduleData} from './scheduling/schedule'
192
+ export {LANE_MOBILITY, LANE_BARRIER} from './scheduling/schedule'
193
+ export type {
194
+ ScheduleData,
195
+ LaneView,
196
+ OrderedTask,
197
+ ResolvedEvent,
198
+ } from './scheduling/schedule'
199
+ export {
200
+ candidateLaneCompletesAt,
201
+ laneKeyForModule,
202
+ rawScheduleEnd,
203
+ workerLaneKey,
204
+ } from './scheduling/lanes'
155
205
  export {ScheduleAccessor, createScheduleAccessor} from './scheduling/accessor'
156
206
  export {InventoryAccessor, createInventoryAccessor} from './entities/inventory-accessor'
157
207
  export type {HasCargo} from './entities/inventory-accessor'
@@ -159,36 +209,73 @@ export type {HasCargo} from './entities/inventory-accessor'
159
209
  export * as cargoUtils from './entities/cargo-utils'
160
210
  export type {CargoData} from './entities/cargo-utils'
161
211
 
212
+ export {cargoRef, cargoItem} from './utils/cargo'
213
+
162
214
  export {
163
215
  createProjectedEntity,
164
216
  projectEntity,
165
217
  projectEntityAt,
166
- projectFromCurrentState,
167
- projectFromCurrentStateAt,
218
+ projectRemainingAt,
168
219
  validateSchedule,
169
220
  } from './scheduling/projection'
170
221
  export type {
171
222
  Projectable,
172
- ProjectableSnapshot,
173
223
  ProjectedEntity,
174
224
  ProjectionOptions,
175
225
  } from './scheduling/projection'
176
226
 
227
+ export {taskCargoChanges} from './scheduling/task-cargo'
228
+ export type {TaskCargoChange, TaskCargoDirection} from './scheduling/task-cargo'
229
+
230
+ export {
231
+ projectedCargoAvailableAt,
232
+ availableForItem,
233
+ cargoReadyAt,
234
+ taskCargoEffect,
235
+ } from './scheduling/availability'
236
+
237
+ export {maxCraftable} from './capabilities/craftable'
238
+
239
+ export {energyAtTime} from './scheduling/energy'
240
+
177
241
  export * from './types/capabilities'
178
242
  export * from './types/entity'
243
+ export {
244
+ EntityClass,
245
+ ENTITY_SHIP,
246
+ ENTITY_WAREHOUSE,
247
+ ENTITY_EXTRACTOR,
248
+ ENTITY_FACTORY,
249
+ ENTITY_CONTAINER,
250
+ ENTITY_NEXUS,
251
+ getEntityClass,
252
+ getPackedEntityType,
253
+ getKindMeta,
254
+ getTemplateMeta,
255
+ kindCan,
256
+ ALL_ENTITY_TYPES,
257
+ CAP_WRAP,
258
+ CAP_UNDEPLOY,
259
+ CAP_DEMOLISH,
260
+ CAP_MODULES,
261
+ isShip,
262
+ isWarehouse,
263
+ isExtractor,
264
+ isFactory,
265
+ isContainer,
266
+ isNexus,
267
+ isPlot,
268
+ } from './data/kind-registry'
269
+ export type {EntityTypeName, KindMeta, TemplateMeta} from './data/kind-registry'
179
270
  export * from './capabilities'
180
271
 
181
272
  export {
182
273
  categoryColors,
183
274
  tierColors,
184
- tierLabels,
185
- categoryIcons,
186
- categoryIconShapes,
187
275
  componentIcon,
188
276
  moduleIcon,
189
277
  itemAbbreviations,
190
278
  } from './data/colors'
191
- export type {CategoryIconShape} from './data/colors'
192
279
 
193
280
  export {itemTier, itemOffset, itemCategory, isRelatedItem, isCraftedItem} from './data/tiers'
194
281
  export type {CraftedItemCategory} from './data/tiers'
@@ -202,14 +289,19 @@ export type {PlanetSubtypeInfo} from './data/locations'
202
289
  export {
203
290
  capabilityNames,
204
291
  capabilityAttributes,
205
- statMappings,
206
292
  isInvertedAttribute,
207
293
  getCapabilityAttributes,
294
+ } from './data/capabilities'
295
+ export type {CapabilityAttribute, StatMapping} from './data/capabilities'
296
+
297
+ export {
298
+ deriveStatMappings,
208
299
  getStatMappings,
209
300
  getStatMappingsForStat,
210
301
  getStatMappingsForCapability,
211
- } from './data/capabilities'
212
- export type {CapabilityAttribute, StatMapping} from './data/capabilities'
302
+ } from './derivation/capability-mappings'
303
+ export {SLOT_FORMULAS} from './data/capability-formulas'
304
+ export type {SlotConsumer, SlotConsumerKind} from './data/capability-formulas'
213
305
 
214
306
  export {
215
307
  encodeStats,
@@ -228,7 +320,15 @@ export {
228
320
  } from './derivation/crafting'
229
321
  export type {StackInput, CategoryStacks, RecipeSlotInput} from './derivation/crafting'
230
322
 
231
- export {computeContainerCapabilities, computeContainerT2Capabilities} from './entities/container'
323
+ export {
324
+ availableBuildMethods,
325
+ isBuildable,
326
+ isPlotBuildable,
327
+ filterByBuildMethod,
328
+ allBuildableItems,
329
+ allPlotBuildableItems,
330
+ } from './derivation/build-methods'
331
+ export type {BuildMethod} from './derivation/build-methods'
232
332
 
233
333
  export {
234
334
  computeShipHullCapabilities,
@@ -240,9 +340,16 @@ export {
240
340
  computeCrafterCapabilities,
241
341
  computeWarehouseHullCapabilities,
242
342
  computeStorageCapabilities,
243
- computeShipCapabilities,
244
- } from './entities/ship-deploy'
245
- export type {ShipCapabilities} from './entities/ship-deploy'
343
+ computeContainerCapabilities,
344
+ computeContainerT2Capabilities,
345
+ computeWarpCapabilities,
346
+ computeBaseCapacity,
347
+ computeEntityCapabilities,
348
+ GATHERER_DEPTH_TABLE,
349
+ GATHERER_DEPTH_MAX_TIER,
350
+ gathererDepthForTier,
351
+ } from './derivation/capabilities'
352
+ export type {GathererDepthParams, ComputedCapabilities} from './derivation/capabilities'
246
353
 
247
354
  export {resolveItem} from './resolution/resolve-item'
248
355
  export type {
@@ -282,6 +389,39 @@ export type {
282
389
  NFTCommonBase,
283
390
  } from './nft/deserializers'
284
391
 
392
+ export {deserializeAtomicData} from './nft/atomicdata'
393
+ export type {SchemaField, RawData} from './nft/atomicdata'
394
+
395
+ export {
396
+ buildImmutableData,
397
+ buildResourceImmutable,
398
+ buildComponentImmutable,
399
+ buildModuleImmutable,
400
+ buildEntityImmutable,
401
+ computeNftImageUrl,
402
+ } from './nft/buildImmutableData'
403
+ export type {
404
+ AtomicAttributeType,
405
+ ImmutableEntry,
406
+ ImmutableModuleSlot,
407
+ } from './nft/buildImmutableData'
408
+
409
+ export {
410
+ fetchAtomicAssetsForOwner,
411
+ fetchAtomicSchemas,
412
+ decodeAtomicAsset,
413
+ buildMintAssetAction,
414
+ ATOMICASSETS_ACCOUNT,
415
+ SHIPLOAD_COLLECTION,
416
+ } from './nft/atomicassets'
417
+ export type {
418
+ AtomicAssetRow,
419
+ AtomicSchemaRow,
420
+ DecodedAtomicAsset,
421
+ FetchAssetsOptions,
422
+ MintAssetParams,
423
+ } from './nft/atomicassets'
424
+
285
425
  export {
286
426
  buildEntityDescription,
287
427
  formatModuleLine,
@@ -297,11 +437,13 @@ export {
297
437
  computeGathererYield,
298
438
  computeGathererDrain,
299
439
  computeGathererDepth,
300
- computeGathererSpeed,
301
440
  computeLoaderMass,
302
441
  computeLoaderThrust,
303
442
  computeCrafterSpeed,
304
443
  computeCrafterDrain,
444
+ computeHaulerCapacity,
445
+ computeHaulerEfficiency,
446
+ computeWarpRange,
305
447
  } from './nft/description'
306
448
 
307
449
  export {
@@ -312,9 +454,9 @@ export {
312
454
  itemTypeCode,
313
455
  } from './data/tiers'
314
456
 
315
- export {formatMass, formatMassDelta} from './format'
457
+ export {formatMass, formatMassDelta, formatMassScaled, formatLocation} from './format'
316
458
 
317
- export {displayName, describeItem} from './resolution/display-name'
459
+ export {displayName, baseName, describeItem} from './resolution/display-name'
318
460
  export type {DescribeOptions} from './resolution/display-name'
319
461
 
320
462
  export * from './subscriptions'