@singi-labs/sifa-sdk 0.19.41 → 0.19.43
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/badge/index.cjs +16 -2
- package/dist/badge/index.cjs.map +1 -1
- package/dist/badge/index.js +16 -2
- package/dist/badge/index.js.map +1 -1
- package/dist/index.cjs +39 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -2
- package/dist/index.d.ts +49 -2
- package/dist/index.js +36 -4
- package/dist/index.js.map +1 -1
- package/dist/jsonld/index.cjs +16 -2
- package/dist/jsonld/index.cjs.map +1 -1
- package/dist/jsonld/index.js +16 -2
- package/dist/jsonld/index.js.map +1 -1
- package/dist/query/fetchers/index.cjs +16 -2
- package/dist/query/fetchers/index.cjs.map +1 -1
- package/dist/query/fetchers/index.js +16 -2
- package/dist/query/fetchers/index.js.map +1 -1
- package/dist/query/index.cjs +16 -2
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.js +16 -2
- package/dist/query/index.js.map +1 -1
- package/package.json +1 -1
package/dist/query/index.cjs
CHANGED
|
@@ -164,10 +164,24 @@ async function fetchGetProfileView(config, actor, options = {}) {
|
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
// src/logic/date-lookahead.ts
|
|
168
|
+
function isBeyondLookahead(value, months, now = /* @__PURE__ */ new Date()) {
|
|
169
|
+
const match = /^(\d{4})(?:-(\d{2}))?/.exec(value);
|
|
170
|
+
if (!match) return false;
|
|
171
|
+
const index = Number(match[1]) * 12 + (match[2] ? Number(match[2]) : 1);
|
|
172
|
+
const limit = now.getFullYear() * 12 + now.getMonth() + 1 + months;
|
|
173
|
+
return index > limit;
|
|
174
|
+
}
|
|
175
|
+
function isUpcomingStart(startedAt, now = /* @__PURE__ */ new Date()) {
|
|
176
|
+
return !!startedAt && isBeyondLookahead(startedAt, 0, now);
|
|
177
|
+
}
|
|
178
|
+
|
|
167
179
|
// src/logic/primary-position.ts
|
|
168
|
-
function pickPrimaryPosition(positions) {
|
|
180
|
+
function pickPrimaryPosition(positions, now = /* @__PURE__ */ new Date()) {
|
|
169
181
|
if (!positions || positions.length === 0) return void 0;
|
|
170
|
-
const active = positions.filter(
|
|
182
|
+
const active = positions.filter(
|
|
183
|
+
(p) => !p.endedAt && !p.hidden && !isUpcomingStart(p.startedAt, now)
|
|
184
|
+
);
|
|
171
185
|
if (active.length === 0) return void 0;
|
|
172
186
|
const flagged = active.find((p) => p.primary === true);
|
|
173
187
|
if (flagged) return flagged;
|