@ai-matrx/data 0.22.0 → 0.22.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.22.2
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/data/v0.22.1..npm/data/v0.22.2 -- apps/shared/data`).
7
+ No source changes intended and no consumer action required.
8
+
9
+ ## 0.22.1
10
+
11
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
12
+ `git diff npm/data/v0.22.0..npm/data/v0.22.1 -- apps/shared/data`).
13
+ No source changes intended and no consumer action required.
14
+
3
15
  ## 0.22.0 — the one DB-types copy
4
16
 
5
17
  - New subpath `@ai-matrx/data/types`: `Database` (+ `Json`, `Tables`, `TablesInsert`, `TablesUpdate`,
@@ -39,6 +39,8 @@
39
39
  /** Structurally compatible with @supabase/ssr's CookieOptionsWithName. */
40
40
  interface AuthCookieOptions {
41
41
  name: string;
42
+ /** Remote hosts require HTTPS; loopback development remains usable over HTTP. */
43
+ secure: boolean;
42
44
  domain?: string;
43
45
  }
44
46
  /** A cookie as read from a request — name + value, nothing else needed. */
@@ -39,6 +39,8 @@
39
39
  /** Structurally compatible with @supabase/ssr's CookieOptionsWithName. */
40
40
  interface AuthCookieOptions {
41
41
  name: string;
42
+ /** Remote hosts require HTTPS; loopback development remains usable over HTTP. */
43
+ secure: boolean;
42
44
  domain?: string;
43
45
  }
44
46
  /** A cookie as read from a request — name + value, nothing else needed. */
package/dist/db.cjs CHANGED
@@ -373,9 +373,12 @@ function createAuthCookie(args) {
373
373
  const legacyCookieName = args.legacyCookieName;
374
374
  const apex = args.apexDomain.toLowerCase();
375
375
  const optionsForHost = (host) => {
376
- const hostname = (host ?? "").split(":")[0]?.toLowerCase() ?? "";
376
+ const normalized = (host ?? "").toLowerCase();
377
+ const hostname = normalized.startsWith("[") ? normalized.slice(1, normalized.indexOf("]")) : normalized === "::1" ? normalized : normalized.split(":")[0] ?? "";
378
+ const loopback = hostname === "localhost" || hostname.endsWith(".localhost") || hostname === "::1" || /^127(?:\.(?:0|[1-9]\d{0,2})){3}$/.test(hostname) && hostname.split(".").every((part) => Number(part) <= 255);
379
+ const secure = !loopback;
377
380
  const onApex = hostname === apex || hostname.endsWith(`.${apex}`);
378
- return onApex ? { name: cookieName, domain: `.${apex}` } : { name: cookieName };
381
+ return onApex ? { name: cookieName, domain: `.${apex}`, secure } : { name: cookieName, secure };
379
382
  };
380
383
  const isCurrentCookie = (name) => belongsToStorageKey(name, cookieName);
381
384
  const isAuthCookie = (name) => isCurrentCookie(name) || legacyCookieName !== void 0 && (name === legacyCookieName || name.startsWith(`${legacyCookieName}.`));