@singi-labs/sifa-sdk 0.19.41 → 0.19.42

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.
@@ -1713,10 +1713,24 @@ function removeOrgNotificationEmail(config, body, options = {}) {
1713
1713
  );
1714
1714
  }
1715
1715
 
1716
+ // src/logic/date-lookahead.ts
1717
+ function isBeyondLookahead(value, months, now = /* @__PURE__ */ new Date()) {
1718
+ const match = /^(\d{4})(?:-(\d{2}))?/.exec(value);
1719
+ if (!match) return false;
1720
+ const index = Number(match[1]) * 12 + (match[2] ? Number(match[2]) : 1);
1721
+ const limit = now.getFullYear() * 12 + now.getMonth() + 1 + months;
1722
+ return index > limit;
1723
+ }
1724
+ function isUpcomingStart(startedAt, now = /* @__PURE__ */ new Date()) {
1725
+ return !!startedAt && isBeyondLookahead(startedAt, 0, now);
1726
+ }
1727
+
1716
1728
  // src/logic/primary-position.ts
1717
- function pickPrimaryPosition(positions) {
1729
+ function pickPrimaryPosition(positions, now = /* @__PURE__ */ new Date()) {
1718
1730
  if (!positions || positions.length === 0) return void 0;
1719
- const active = positions.filter((p) => !p.endedAt && !p.hidden);
1731
+ const active = positions.filter(
1732
+ (p) => !p.endedAt && !p.hidden && !isUpcomingStart(p.startedAt, now)
1733
+ );
1720
1734
  if (active.length === 0) return void 0;
1721
1735
  const flagged = active.find((p) => p.primary === true);
1722
1736
  if (flagged) return flagged;