@exulu/backend 1.69.1 → 1.69.3

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.
@@ -892,6 +892,11 @@ function subtractDuration(date, duration) {
892
892
  }
893
893
  return new Date(date.getTime() - durationToDays(duration) * DAY_MS);
894
894
  }
895
+ function subtractOneCalendarMonth(date) {
896
+ const result = new Date(date);
897
+ result.setUTCMonth(result.getUTCMonth() - 1);
898
+ return result;
899
+ }
895
900
  function windowStartYmd(reset_at, duration) {
896
901
  const now = Date.now();
897
902
  const reset = reset_at ? new Date(reset_at) : null;
@@ -899,7 +904,7 @@ function windowStartYmd(reset_at, duration) {
899
904
  const trailingStart = subtractDuration(new Date(now), duration);
900
905
  if (resetMs !== null) {
901
906
  if (resetMs > now) {
902
- const periodStart = subtractDuration(reset, duration);
907
+ const periodStart = reset.getUTCDate() === 1 ? subtractOneCalendarMonth(reset) : subtractDuration(reset, duration);
903
908
  return ymd(periodStart > trailingStart ? periodStart : trailingStart);
904
909
  } else {
905
910
  return ymd(reset > trailingStart ? reset : trailingStart);
@@ -1630,7 +1635,7 @@ var ExuluTool = class _ExuluTool {
1630
1635
  });
1631
1636
  providerapikey = resolved.apiKey;
1632
1637
  }
1633
- const { convertExuluToolsToAiSdkTools: convertExuluToolsToAiSdkTools2 } = await import("./convert-exulu-tools-to-ai-sdk-tools-MXLGIOCT.js");
1638
+ const { convertExuluToolsToAiSdkTools: convertExuluToolsToAiSdkTools2 } = await import("./convert-exulu-tools-to-ai-sdk-tools-GQ3UIYP7.js");
1634
1639
  const tools = await convertExuluToolsToAiSdkTools2(
1635
1640
  [this],
1636
1641
  [],
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  convertExuluToolsToAiSdkTools
3
- } from "./chunk-PJSDLFXL.js";
3
+ } from "./chunk-WCP3WZM3.js";
4
4
  export {
5
5
  convertExuluToolsToAiSdkTools
6
6
  };
package/dist/index.cjs CHANGED
@@ -2758,6 +2758,11 @@ function subtractDuration(date, duration) {
2758
2758
  }
2759
2759
  return new Date(date.getTime() - durationToDays(duration) * DAY_MS);
2760
2760
  }
2761
+ function subtractOneCalendarMonth(date) {
2762
+ const result = new Date(date);
2763
+ result.setUTCMonth(result.getUTCMonth() - 1);
2764
+ return result;
2765
+ }
2761
2766
  function windowStartYmd(reset_at, duration) {
2762
2767
  const now = Date.now();
2763
2768
  const reset = reset_at ? new Date(reset_at) : null;
@@ -2765,7 +2770,7 @@ function windowStartYmd(reset_at, duration) {
2765
2770
  const trailingStart = subtractDuration(new Date(now), duration);
2766
2771
  if (resetMs !== null) {
2767
2772
  if (resetMs > now) {
2768
- const periodStart = subtractDuration(reset, duration);
2773
+ const periodStart = reset.getUTCDate() === 1 ? subtractOneCalendarMonth(reset) : subtractDuration(reset, duration);
2769
2774
  return ymd(periodStart > trailingStart ? periodStart : trailingStart);
2770
2775
  } else {
2771
2776
  return ymd(reset > trailingStart ? reset : trailingStart);
@@ -11187,10 +11192,11 @@ init_auth();
11187
11192
  var requestValidators = {
11188
11193
  authenticate: async (req) => {
11189
11194
  const rawApiKey = req.headers["exulu-api-key"] || req.headers["x-api-key"];
11190
- const apikey = rawApiKey?.replace(/^Bearer\s+/i, "") || null;
11195
+ const stripped = rawApiKey?.replace(/^Bearer\s+/i, "") ?? null;
11196
+ const apikey = stripped?.includes("/") ? stripped : void 0;
11191
11197
  const { db: db2 } = await postgresClient();
11192
11198
  let authtoken = null;
11193
- if (typeof apikey !== "string") {
11199
+ if (!apikey) {
11194
11200
  authtoken = await getToken((req.headers["authorization"] || req.headers["x-api-key"]) ?? "");
11195
11201
  }
11196
11202
  return await authentication({
package/dist/index.js CHANGED
@@ -88,7 +88,7 @@ import {
88
88
  vectorSearch,
89
89
  waitForLiteLLMReady,
90
90
  withRetry
91
- } from "./chunk-PJSDLFXL.js";
91
+ } from "./chunk-WCP3WZM3.js";
92
92
  import {
93
93
  findLiteLLMModel
94
94
  } from "./chunk-YCE44CMU.js";
@@ -213,10 +213,11 @@ import "express";
213
213
  var requestValidators = {
214
214
  authenticate: async (req) => {
215
215
  const rawApiKey = req.headers["exulu-api-key"] || req.headers["x-api-key"];
216
- const apikey = rawApiKey?.replace(/^Bearer\s+/i, "") || null;
216
+ const stripped = rawApiKey?.replace(/^Bearer\s+/i, "") ?? null;
217
+ const apikey = stripped?.includes("/") ? stripped : void 0;
217
218
  const { db } = await postgresClient();
218
219
  let authtoken = null;
219
- if (typeof apikey !== "string") {
220
+ if (!apikey) {
220
221
  authtoken = await getToken((req.headers["authorization"] || req.headers["x-api-key"]) ?? "");
221
222
  }
222
223
  return await authentication({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@exulu/backend",
3
3
  "author": "Qventu Bv.",
4
- "version": "1.69.1",
4
+ "version": "1.69.3",
5
5
  "main": "./dist/index.js",
6
6
  "private": false,
7
7
  "publishConfig": {