@shipload/sdk 1.0.0-next.72 → 1.0.0-next.74

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 (47) hide show
  1. package/lib/shipload.d.ts +576 -133
  2. package/lib/shipload.js +6019 -5114
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +6002 -5108
  5. package/lib/shipload.m.js.map +1 -1
  6. package/lib/testing.d.ts +194 -52
  7. package/lib/testing.js +767 -468
  8. package/lib/testing.js.map +1 -1
  9. package/lib/testing.m.js +767 -468
  10. package/lib/testing.m.js.map +1 -1
  11. package/package.json +1 -1
  12. package/src/contracts/server.ts +523 -143
  13. package/src/data/catalog.test.ts +81 -1
  14. package/src/data/catalog.ts +6 -4
  15. package/src/data/entities.json +2 -2
  16. package/src/data/metadata.ts +197 -363
  17. package/src/data/task-types.json +184 -0
  18. package/src/entities/makers.ts +2 -2
  19. package/src/index-module.ts +31 -2
  20. package/src/influence/civic-shuttle.test.ts +58 -0
  21. package/src/influence/civic-shuttle.ts +52 -6
  22. package/src/influence/duration.ts +0 -65
  23. package/src/influence/index.ts +4 -5
  24. package/src/influence/influence.test.ts +51 -136
  25. package/src/influence/valuation.ts +75 -0
  26. package/src/managers/actions.ts +49 -10
  27. package/src/managers/balances.test.ts +33 -0
  28. package/src/managers/balances.ts +15 -0
  29. package/src/managers/context.ts +50 -11
  30. package/src/managers/index.ts +14 -0
  31. package/src/managers/jobs.test.ts +82 -1
  32. package/src/managers/jobs.ts +41 -2
  33. package/src/managers/nft.test.ts +173 -1
  34. package/src/managers/nft.ts +35 -2
  35. package/src/managers/shuttle.test.ts +562 -0
  36. package/src/managers/shuttle.ts +397 -0
  37. package/src/resolution/resolve-item.ts +2 -2
  38. package/src/scheduling/availability.ts +10 -0
  39. package/src/scheduling/energy.ts +55 -1
  40. package/src/scheduling/jobs.test.ts +171 -1
  41. package/src/scheduling/jobs.ts +110 -13
  42. package/src/scheduling/projection.ts +2 -1
  43. package/src/scheduling/task-effects.ts +38 -0
  44. package/src/scheduling/unwrap.test.ts +60 -0
  45. package/src/scheduling/unwrap.ts +24 -8
  46. package/src/shipload.ts +23 -4
  47. package/src/types.ts +1 -0
package/lib/testing.d.ts CHANGED
@@ -49,6 +49,56 @@ declare namespace Types {
49
49
  class addoracle extends Struct {
50
50
  oracle_id: Name;
51
51
  }
52
+ class placement extends Struct {
53
+ task_index: UInt8;
54
+ starts_at: TimePoint;
55
+ completes_at: TimePoint;
56
+ schedule_started: TimePoint;
57
+ }
58
+ class coordinates extends Struct {
59
+ x: Int64;
60
+ y: Int64;
61
+ z?: UInt16;
62
+ }
63
+ class entity_ref extends Struct {
64
+ entity_type: Name;
65
+ entity_id: UInt64;
66
+ }
67
+ class coupling extends Struct {
68
+ counterpart: entity_ref;
69
+ hold: UInt64;
70
+ kind: UInt8;
71
+ }
72
+ class refit_op extends Struct {
73
+ op: UInt8;
74
+ slot: UInt8;
75
+ }
76
+ class task extends Struct {
77
+ type: UInt8;
78
+ duration: UInt32;
79
+ cancelable: UInt8;
80
+ coordinates?: coordinates;
81
+ cargo: cargo_item[];
82
+ couplings: coupling[];
83
+ subject?: entity_ref;
84
+ entitygroup?: UInt64;
85
+ energy_cost?: UInt32;
86
+ target_item_id?: UInt16;
87
+ refit?: refit_op;
88
+ charter_node?: UInt32;
89
+ }
90
+ class schedule extends Struct {
91
+ started: TimePoint;
92
+ tasks: task[];
93
+ }
94
+ class lane extends Struct {
95
+ lane_key: UInt8;
96
+ schedule: schedule;
97
+ }
98
+ class append_result extends Struct {
99
+ placed: placement;
100
+ lanes: lane[];
101
+ }
52
102
  class ballot_credit extends Struct {
53
103
  account: Name;
54
104
  amount: UInt64;
@@ -87,6 +137,11 @@ declare namespace Types {
87
137
  id: UInt64;
88
138
  inputs: cargo_item[];
89
139
  }
140
+ class blenddepot extends Struct {
141
+ depot_id: UInt64;
142
+ owner: Name;
143
+ inputs: cargo_item[];
144
+ }
90
145
  class builder_lane extends Struct {
91
146
  slot_index: UInt8;
92
147
  speed: UInt16;
@@ -102,11 +157,7 @@ declare namespace Types {
102
157
  dock_id: UInt64;
103
158
  target_item_id: UInt16;
104
159
  inputs: cargo_item[];
105
- }
106
- class coordinates extends Struct {
107
- x: Int64;
108
- y: Int64;
109
- z?: UInt16;
160
+ shuttled_by?: UInt64;
110
161
  }
111
162
  class buildjob_row extends Struct {
112
163
  id: UInt64;
@@ -134,10 +185,6 @@ declare namespace Types {
134
185
  lane_key: UInt8;
135
186
  count: UInt64;
136
187
  }
137
- class entity_ref extends Struct {
138
- entity_type: Name;
139
- entity_id: UInt64;
140
- }
141
188
  class cancel_results extends Struct {
142
189
  entity_id: UInt64;
143
190
  entity_type: Name;
@@ -148,6 +195,7 @@ declare namespace Types {
148
195
  }
149
196
  class cancelbuild extends Struct {
150
197
  job_id: UInt64;
198
+ shuttled_by?: UInt64;
151
199
  }
152
200
  class cancelcivic extends Struct {
153
201
  building: UInt64;
@@ -174,6 +222,17 @@ declare namespace Types {
174
222
  id: UInt64;
175
223
  entity_id?: UInt64;
176
224
  }
225
+ class cargoreserve_row extends Struct {
226
+ id: UInt64;
227
+ entity_id: UInt64;
228
+ hold: UInt64;
229
+ owner: Name;
230
+ item_id: UInt64;
231
+ quantity: UInt64;
232
+ stats: UInt64;
233
+ modules: module_entry[];
234
+ sequence_id?: UInt64;
235
+ }
177
236
  class castballot extends Struct {
178
237
  player: Name;
179
238
  ballot_id: UInt64;
@@ -262,6 +321,7 @@ declare namespace Types {
262
321
  class claimcraft extends Struct {
263
322
  job_id: UInt64;
264
323
  ship_id: UInt64;
324
+ shuttled_by?: UInt64;
265
325
  }
266
326
  class cluster_slot extends Struct {
267
327
  hub: UInt64;
@@ -339,11 +399,6 @@ declare namespace Types {
339
399
  class configlog extends Struct {
340
400
  config: game_config;
341
401
  }
342
- class coupling extends Struct {
343
- counterpart: entity_ref;
344
- hold: UInt64;
345
- kind: UInt8;
346
- }
347
402
  class craft extends Struct {
348
403
  id: UInt64;
349
404
  recipe_id: UInt16;
@@ -364,6 +419,7 @@ declare namespace Types {
364
419
  recipe_id: UInt16;
365
420
  quantity: UInt32;
366
421
  inputs: cargo_item[];
422
+ shuttled_by?: UInt64;
367
423
  }
368
424
  class craftjob_row extends Struct {
369
425
  id: UInt64;
@@ -384,6 +440,27 @@ declare namespace Types {
384
440
  class craftjobs_result extends Struct {
385
441
  jobs: craftjob_row[];
386
442
  }
443
+ class hold extends Struct {
444
+ id: UInt64;
445
+ kind: UInt8;
446
+ counterpart: entity_ref;
447
+ until: TimePoint;
448
+ incoming_mass: UInt32;
449
+ }
450
+ class dbgappend extends Struct {
451
+ lanes: lane[];
452
+ holds: hold[];
453
+ new_task: task;
454
+ lane_key: UInt8;
455
+ now: TimePoint;
456
+ min_starts_at?: TimePoint;
457
+ }
458
+ class dbgbarrier extends Struct {
459
+ lanes: lane[];
460
+ holds: hold[];
461
+ new_task: task;
462
+ lane_key: UInt8;
463
+ }
387
464
  class dbgcredit extends Struct {
388
465
  owner: Name;
389
466
  x: Int64;
@@ -440,6 +517,14 @@ declare namespace Types {
440
517
  y: Int64;
441
518
  seats: UInt32;
442
519
  }
520
+ class dbgstart extends Struct {
521
+ lanes: lane[];
522
+ holds: hold[];
523
+ new_task: task;
524
+ lane_key: UInt8;
525
+ now: TimePoint;
526
+ min_starts_at?: TimePoint;
527
+ }
443
528
  class decomp_bucket extends Struct {
444
529
  category: UInt8;
445
530
  tier: UInt8;
@@ -487,11 +572,13 @@ declare namespace Types {
487
572
  ship_id: UInt64;
488
573
  depot_id: UInt64;
489
574
  items: cargo_item[];
575
+ shuttled_by?: UInt64;
490
576
  }
491
577
  class depottake extends Struct {
492
578
  ship_id: UInt64;
493
579
  depot_id: UInt64;
494
580
  items: cargo_item[];
581
+ shuttled_by?: UInt64;
495
582
  }
496
583
  class descentity extends Struct {
497
584
  item_id: UInt16;
@@ -545,39 +632,6 @@ declare namespace Types {
545
632
  velocity: UInt16;
546
633
  drain: UInt16;
547
634
  }
548
- class refit_op extends Struct {
549
- op: UInt8;
550
- slot: UInt8;
551
- }
552
- class task extends Struct {
553
- type: UInt8;
554
- duration: UInt32;
555
- cancelable: UInt8;
556
- coordinates?: coordinates;
557
- cargo: cargo_item[];
558
- couplings: coupling[];
559
- subject?: entity_ref;
560
- entitygroup?: UInt64;
561
- energy_cost?: UInt32;
562
- target_item_id?: UInt16;
563
- refit?: refit_op;
564
- charter_node?: UInt32;
565
- }
566
- class schedule extends Struct {
567
- started: TimePoint;
568
- tasks: task[];
569
- }
570
- class lane extends Struct {
571
- lane_key: UInt8;
572
- schedule: schedule;
573
- }
574
- class hold extends Struct {
575
- id: UInt64;
576
- kind: UInt8;
577
- counterpart: entity_ref;
578
- until: TimePoint;
579
- incoming_mass: UInt32;
580
- }
581
635
  class entity_info extends Struct {
582
636
  type: Name;
583
637
  id: UInt64;
@@ -670,6 +724,8 @@ declare namespace Types {
670
724
  class fixcargomass extends Struct {
671
725
  entity_id: UInt64;
672
726
  }
727
+ class fixhubid extends Struct {
728
+ }
673
729
  class fixitemids extends Struct {
674
730
  }
675
731
  class grid_cell extends Struct {
@@ -715,6 +771,17 @@ declare namespace Types {
715
771
  class getbuildjobs extends Struct {
716
772
  building_id: UInt64;
717
773
  }
774
+ class getbuildopts extends Struct {
775
+ target_id: UInt64;
776
+ dock_id: UInt64;
777
+ target_item_id: UInt16;
778
+ inputs: cargo_item[];
779
+ candidates: UInt64[];
780
+ }
781
+ class getcbldopts extends Struct {
782
+ job_id: UInt64;
783
+ candidates: UInt64[];
784
+ }
718
785
  class getcharter extends Struct {
719
786
  x: Int64;
720
787
  y: Int64;
@@ -723,6 +790,11 @@ declare namespace Types {
723
790
  }
724
791
  class getchrtready extends Struct {
725
792
  }
793
+ class getclaimopts extends Struct {
794
+ job_id: UInt64;
795
+ ship_id: UInt64;
796
+ candidates: UInt64[];
797
+ }
726
798
  class getcluster extends Struct {
727
799
  hub_id: UInt64;
728
800
  }
@@ -731,6 +803,15 @@ declare namespace Types {
731
803
  class getcraftjobs extends Struct {
732
804
  building_id: UInt64;
733
805
  }
806
+ class getcraftopts extends Struct {
807
+ ship_id: UInt64;
808
+ workshop_id: UInt64;
809
+ recipe_id: UInt16;
810
+ quantity: UInt32;
811
+ inputs: cargo_item[];
812
+ candidates: UInt64[];
813
+ recharge: boolean;
814
+ }
734
815
  class getdecomp extends Struct {
735
816
  item_id: UInt16;
736
817
  }
@@ -849,6 +930,12 @@ declare namespace Types {
849
930
  }
850
931
  class getslots extends Struct {
851
932
  }
933
+ class getstoreopts extends Struct {
934
+ ship_id: UInt64;
935
+ depot_id: UInt64;
936
+ items: cargo_item[];
937
+ candidates: UInt64[];
938
+ }
852
939
  class getstratum extends Struct {
853
940
  x: Int64;
854
941
  y: Int64;
@@ -858,6 +945,14 @@ declare namespace Types {
858
945
  owner: Name;
859
946
  entity_type?: Name;
860
947
  }
948
+ class gettakeopts extends Struct {
949
+ ship_id: UInt64;
950
+ depot_id: UInt64;
951
+ items: cargo_item[];
952
+ candidates: UInt64[];
953
+ }
954
+ class gettasktypes extends Struct {
955
+ }
861
956
  class getvoteready extends Struct {
862
957
  }
863
958
  class getvotes extends Struct {
@@ -906,6 +1001,15 @@ declare namespace Types {
906
1001
  class importgroup extends Struct {
907
1002
  row: entitygroup_row;
908
1003
  }
1004
+ class locker_row extends Struct {
1005
+ depot_id: UInt64;
1006
+ stored_mass: UInt64;
1007
+ reserved_mass: UInt64;
1008
+ }
1009
+ class importlocker extends Struct {
1010
+ owner: Name;
1011
+ row: locker_row;
1012
+ }
909
1013
  class nftconfig_row extends Struct {
910
1014
  item_id: UInt16;
911
1015
  template_id: Int32;
@@ -936,6 +1040,10 @@ declare namespace Types {
936
1040
  class importstate extends Struct {
937
1041
  row: state_row;
938
1042
  }
1043
+ class importstorage extends Struct {
1044
+ depot_id: UInt64;
1045
+ row: storage_row;
1046
+ }
939
1047
  class infburn_row extends Struct {
940
1048
  bps: UInt16;
941
1049
  }
@@ -1070,11 +1178,6 @@ declare namespace Types {
1070
1178
  is_system: boolean;
1071
1179
  is_wormhole: boolean;
1072
1180
  }
1073
- class locker_row extends Struct {
1074
- depot_id: UInt64;
1075
- stored_mass: UInt64;
1076
- reserved_mass: UInt64;
1077
- }
1078
1181
  class mandates_row extends Struct {
1079
1182
  node_id: UInt32;
1080
1183
  repeats: UInt16;
@@ -1390,6 +1493,33 @@ declare namespace Types {
1390
1493
  to_id: UInt64;
1391
1494
  items: cargo_item[];
1392
1495
  }
1496
+ class shuttle_rejection extends Struct {
1497
+ reason: string;
1498
+ at?: TimePoint;
1499
+ until?: TimePoint;
1500
+ have?: UInt64;
1501
+ need?: UInt64;
1502
+ cap?: UInt64;
1503
+ task_type?: UInt8;
1504
+ }
1505
+ class shuttle_option extends Struct {
1506
+ shuttled_by?: UInt64;
1507
+ mode: UInt8;
1508
+ host_id: UInt64;
1509
+ lane_key: UInt8;
1510
+ duration: UInt32;
1511
+ start: TimePoint;
1512
+ finish: TimePoint;
1513
+ bays: UInt8;
1514
+ window_starts_at?: TimePoint;
1515
+ window_completes_at?: TimePoint;
1516
+ energy_cost?: UInt32;
1517
+ rejection?: shuttle_rejection;
1518
+ resolved: boolean;
1519
+ }
1520
+ class shuttle_options extends Struct {
1521
+ options: shuttle_option[];
1522
+ }
1393
1523
  class socket_pick extends Struct {
1394
1524
  found: boolean;
1395
1525
  socket: UInt8;
@@ -1444,6 +1574,18 @@ declare namespace Types {
1444
1574
  class task_results extends Struct {
1445
1575
  entities: entity_task_info[];
1446
1576
  }
1577
+ class task_type_info extends Struct {
1578
+ type: UInt8;
1579
+ position_bound: boolean;
1580
+ mobility: boolean;
1581
+ consumer: boolean;
1582
+ is_terminal: boolean;
1583
+ caps_plan: boolean;
1584
+ cargo_effect_resolve: boolean;
1585
+ }
1586
+ class task_types_result extends Struct {
1587
+ types: task_type_info[];
1588
+ }
1447
1589
  class transit extends Struct {
1448
1590
  id: UInt64;
1449
1591
  ax: Int64;