bruce-models 7.1.100 → 7.1.102

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.
@@ -364,6 +364,10 @@
364
364
  EConcept["UI_SLIDE"] = "pvs";
365
365
  EConcept["UI_SLIDE_GROUP"] = "sg";
366
366
  EConcept["UI_TABLE_VIEW"] = "tv";
367
+ EConcept["WORKFLOW_ITEM"] = "wi";
368
+ EConcept["WORKFLOW_ITEM_STATUS"] = "wis";
369
+ EConcept["WORKFLOW_ITEM_TYPE"] = "wit";
370
+ EConcept["WORKFLOW_QUEUE"] = "wq";
367
371
  })(EConcept = AccountConcept.EConcept || (AccountConcept.EConcept = {}));
368
372
  let EAction;
369
373
  (function (EAction) {
@@ -579,14 +583,17 @@
579
583
  };
580
584
  };
581
585
  /**
582
- * Returns true if the given Entity internal ID falls within the reported range string.
586
+ * Returns true if the given internal ID falls within the reported range string.
587
+ *
588
+ * Every concept whose records carry a numeric identity reports them this way, as runs rather than
589
+ * as one ID per record, so that a change touching thousands of rows is still a short message.
583
590
  *
584
591
  * @example
585
- * isEntityInternalIdInRangeString("100-200,305,400-450", 150) // true
586
- * isEntityInternalIdInRangeString("100-200,305,400-450", 301) // false
592
+ * isInternalIdInRangeString("100-200,305,400-450", 150) // true
593
+ * isInternalIdInRangeString("100-200,305,400-450", 301) // false
587
594
  */
588
- RecordChangeFeed.isEntityInternalIdInRangeString = (rangeString, entityInternalId) => {
589
- if (!rangeString || !Number.isInteger(entityInternalId)) {
595
+ RecordChangeFeed.isInternalIdInRangeString = (rangeString, internalId) => {
596
+ if (!rangeString || !Number.isInteger(internalId)) {
590
597
  return false;
591
598
  }
592
599
  for (const part of rangeString.split(",")) {
@@ -602,12 +609,20 @@
602
609
  }
603
610
  const min = Math.min(start, end);
604
611
  const max = Math.max(start, end);
605
- if (entityInternalId >= min && entityInternalId <= max) {
612
+ if (internalId >= min && internalId <= max) {
606
613
  return true;
607
614
  }
608
615
  }
609
616
  return false;
610
617
  };
618
+ /**
619
+ * Returns true if the given Entity internal ID falls within the reported range string.
620
+ *
621
+ * The Entity-named form of {@link isInternalIdInRangeString}, kept because it is what the Entity
622
+ * callers already read as. Ranges are not an Entity idea: a Workflow Item reports its own IDs the
623
+ * same way.
624
+ */
625
+ RecordChangeFeed.isEntityInternalIdInRangeString = (rangeString, entityInternalId) => RecordChangeFeed.isInternalIdInRangeString(rangeString, entityInternalId);
611
626
  /**
612
627
  * Returns true if the given record ID appears in a comma-separated list string.
613
628
  *
@@ -815,8 +830,23 @@
815
830
  }
816
831
  const isEntityConcept = event.concept === ENTITY_CONCEPT;
817
832
  if (!isEntityConcept && params.recordId !== undefined) {
818
- const list = typeof event.data === "string" ? event.data : "";
819
- if (!RecordChangeFeed.isRecordIdInListString(list, params.recordId)) {
833
+ const data = typeof event.data === "string" ? event.data : "";
834
+ const numericId = Number(params.recordId);
835
+ const isNumericIdentity = Number.isInteger(numericId)
836
+ && String(params.recordId).trim() === String(numericId);
837
+ /*
838
+ * A NUMERIC identity is reported as runs, so it is matched against the runs: a Workflow
839
+ * Item asking about ID 7 has to see itself in "5-9" and not only in a list that spells
840
+ * out every ID. Matching runs still finds a plain numeric ID, since one ID is a run of
841
+ * one, so this is what every numeric concept wants.
842
+ *
843
+ * A STRING identity (a Bookmark, a Project View) has no runs to fall inside and arrives
844
+ * as a plain list, which is matched as one.
845
+ */
846
+ const matched = isNumericIdentity
847
+ ? RecordChangeFeed.isInternalIdInRangeString(data, numericId)
848
+ : RecordChangeFeed.isRecordIdInListString(data, params.recordId);
849
+ if (!matched) {
820
850
  return false;
821
851
  }
822
852
  }
@@ -5552,9 +5582,21 @@
5552
5582
  body["Scenario"] = scenario;
5553
5583
  }
5554
5584
  const res = yield api.POST("v3/entities/historic", body, exports.Api.PrepReqParams(req));
5555
- const entityIds = records.map(r => r["Entity.ID"]).filter((v, i, a) => v && a.indexOf(v) === i);
5585
+ const seenIds = new Set();
5586
+ const entityIds = records.map(r => r["Entity.ID"]).filter(v => {
5587
+ if (!v || seenIds.has(v))
5588
+ return false;
5589
+ seenIds.add(v);
5590
+ return true;
5591
+ });
5556
5592
  ClearCacheByEntityIds(api, entityIds);
5557
- for (const attrKey of records.map(r => r.AttrKey).filter((v, i, a) => v && a.indexOf(v) === i)) {
5593
+ const seenKeys = new Set();
5594
+ for (const attrKey of records.map(r => r.AttrKey).filter(v => {
5595
+ if (!v || seenKeys.has(v))
5596
+ return false;
5597
+ seenKeys.add(v);
5598
+ return true;
5599
+ })) {
5558
5600
  api.Cache.RemoveByContains(exports.Entity.GetHistoricContainsKey(attrKey));
5559
5601
  }
5560
5602
  return {
@@ -23685,7 +23727,7 @@
23685
23727
  }
23686
23728
 
23687
23729
  // This is updated with the package.json version on build.
23688
- const VERSION = "7.1.100";
23730
+ const VERSION = "7.1.102";
23689
23731
 
23690
23732
  exports.VERSION = VERSION;
23691
23733
  exports.AbstractApi = AbstractApi;