@crossdelta/infrastructure 0.5.4 → 0.5.5

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/index.cjs CHANGED
@@ -660,20 +660,16 @@ var collectStreamDefinitions = (contractsModule) => {
660
660
  };
661
661
  var getStreamDefinition = (contractsModule, streamName) => collectStreamDefinitions(contractsModule).find((s) => s.stream === streamName);
662
662
  var getStreamNames = (contractsModule) => collectStreamDefinitions(contractsModule).map((s) => s.stream);
663
- var buildSubjectMap = (streams) => streams.reduce((acc, { stream, subjects }) => {
664
- for (const subject of subjects) {
665
- acc.set(subject, stream);
666
- }
667
- return acc;
668
- }, new Map);
669
663
  var findDuplicateSubjects = (streams) => {
670
- const subjectMap = buildSubjectMap(streams);
664
+ const seen = new Map;
671
665
  const duplicates = new Set;
672
- for (const { subjects } of streams) {
666
+ for (const { stream, subjects } of streams) {
673
667
  for (const subject of subjects) {
674
- const existingStream = subjectMap.get(subject);
675
- if (existingStream) {
668
+ const existingStream = seen.get(subject);
669
+ if (existingStream !== undefined && existingStream !== stream) {
676
670
  duplicates.add(subject);
671
+ } else {
672
+ seen.set(subject, stream);
677
673
  }
678
674
  }
679
675
  }
package/dist/index.js CHANGED
@@ -571,20 +571,16 @@ var collectStreamDefinitions = (contractsModule) => {
571
571
  };
572
572
  var getStreamDefinition = (contractsModule, streamName) => collectStreamDefinitions(contractsModule).find((s) => s.stream === streamName);
573
573
  var getStreamNames = (contractsModule) => collectStreamDefinitions(contractsModule).map((s) => s.stream);
574
- var buildSubjectMap = (streams) => streams.reduce((acc, { stream, subjects }) => {
575
- for (const subject of subjects) {
576
- acc.set(subject, stream);
577
- }
578
- return acc;
579
- }, new Map);
580
574
  var findDuplicateSubjects = (streams) => {
581
- const subjectMap = buildSubjectMap(streams);
575
+ const seen = new Map;
582
576
  const duplicates = new Set;
583
- for (const { subjects } of streams) {
577
+ for (const { stream, subjects } of streams) {
584
578
  for (const subject of subjects) {
585
- const existingStream = subjectMap.get(subject);
586
- if (existingStream) {
579
+ const existingStream = seen.get(subject);
580
+ if (existingStream !== undefined && existingStream !== stream) {
587
581
  duplicates.add(subject);
582
+ } else {
583
+ seen.set(subject, stream);
588
584
  }
589
585
  }
590
586
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossdelta/infrastructure",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {