@dreamboard-games/sdk 0.5.0-alpha.13 → 0.5.0-alpha.15

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.
package/dist/reducer.js CHANGED
@@ -22,11 +22,12 @@ import {
22
22
  markManifestScopedSchema,
23
23
  noopDiagnosticsSink,
24
24
  normalizeCommandParams,
25
+ resolveZoneAccess,
25
26
  sparseCounts,
26
27
  sparseMap,
27
28
  unwrapWrappers,
28
29
  validatedReducerDefinition
29
- } from "./chunk-6ZNAIOYG.js";
30
+ } from "./chunk-TJQTLYDI.js";
30
31
  import {
31
32
  CARD_REFERENCE_PREFIX,
32
33
  boardSpaceHostId,
@@ -706,15 +707,21 @@ var boardTarget = {
706
707
  };
707
708
 
708
709
  // src/reducer/inputs/cardTarget.ts
709
- function createCardTargetBuilder(zoneIds) {
710
+ function createCardTargetBuilder(zoneIds, definitions) {
710
711
  return createTargetRuleBuilder((predicates) => ({
711
712
  ...createTargetRule(
712
713
  ({ state, playerId, q }) => {
713
714
  const zones = q.zones;
714
715
  return zoneIds.flatMap((zoneId) => {
715
- const hosts = zones(zoneId);
716
- return (hosts[playerId] ?? hosts.table ?? []).filter(
717
- (id) => Object.hasOwn(state.table.cards, id)
716
+ const definition = definitions.zoneDefinitions[zoneId];
717
+ return Object.entries(zones(zoneId)).flatMap(
718
+ ([hostId, cards]) => resolveZoneAccess(
719
+ state.table,
720
+ definitions,
721
+ definition,
722
+ hostId,
723
+ playerId
724
+ ) ? cards.filter((id) => Object.hasOwn(state.table.cards, id)) : []
718
725
  );
719
726
  });
720
727
  },
@@ -732,8 +739,11 @@ function createCardTargetBuilder(zoneIds) {
732
739
  }));
733
740
  }
734
741
  var cardTarget = {
735
- zones(zoneIds) {
736
- return createCardTargetBuilder(zoneIds);
742
+ zones(zoneIds, definitions) {
743
+ return createCardTargetBuilder(
744
+ zoneIds,
745
+ definitions
746
+ );
737
747
  }
738
748
  };
739
749
 
@@ -936,10 +946,10 @@ function applyWhere(builder, where) {
936
946
  builder
937
947
  );
938
948
  }
939
- function createFusedCardInput() {
949
+ function createFusedCardInput(contract) {
940
950
  return (options) => cardInput({
941
951
  target: applyWhere(
942
- cardTarget.zones(options.from),
952
+ cardTarget.zones(options.from, contract.manifest),
943
953
  options.where
944
954
  ).build()
945
955
  });
@@ -985,7 +995,7 @@ function createFusedBoardInputs() {
985
995
  function createBoundInputBuilders(contract) {
986
996
  return {
987
997
  board: createFusedBoardInputs(),
988
- card: createFusedCardInput(),
998
+ card: createFusedCardInput(contract),
989
999
  tile: createFusedTileInput(contract),
990
1000
  form: formInput.forState(),
991
1001
  rng: rngInput