@revealui/cache 0.1.4 → 0.1.5

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.
@@ -0,0 +1,90 @@
1
+ RevealUI Studio — Commercial Licensing for Pro Packages
2
+
3
+ This file is an explainer for the dual-license structure of this repository.
4
+ It is NOT a standalone license document; the canonical license terms for
5
+ each Pro package live in that package's own LICENSE file.
6
+
7
+ ## Repository Licensing Overview
8
+
9
+ Most of this repository (the OSS packages, apps, scripts, docs, and tooling)
10
+ is licensed under the MIT License. See LICENSE in the repository root for
11
+ those terms.
12
+
13
+ A small number of "Pro" packages are licensed under the Functional Source
14
+ License v1.1 with MIT Future License (FSL-1.1-MIT) instead of MIT. Those
15
+ packages each carry their own LICENSE file containing the canonical FSL
16
+ terms; this file documents which packages are covered and what FSL-1.1-MIT
17
+ permits and restricts.
18
+
19
+ ## Pro Packages Covered
20
+
21
+ The following packages distributed in this repository are licensed under
22
+ FSL-1.1-MIT, not MIT:
23
+
24
+ - @revealui/ai (see packages/ai/LICENSE)
25
+ - @revealui/harnesses (see packages/harnesses/LICENSE)
26
+
27
+ Additional Pro packages may be added in future. The presence of a LICENSE
28
+ file inside a package directory containing the FSL-1.1-MIT text is the
29
+ authoritative signal that the package is governed by FSL terms rather than
30
+ the root MIT LICENSE.
31
+
32
+ ## What FSL-1.1-MIT Permits
33
+
34
+ Source code for Pro packages is publicly available. You may:
35
+
36
+ - Use the package internally for any purpose, including commercial use
37
+ - Modify the package and distribute derivative works under the same terms
38
+ - Inspect, audit, and debug the source
39
+ - Depend on the package from your own software
40
+
41
+ ## What FSL-1.1-MIT Restricts
42
+
43
+ You may NOT make the functionality of a Pro package available to third
44
+ parties as a service that competes with RevealUI Studio's commercial
45
+ offerings. The full restriction text in each per-package LICENSE controls;
46
+ in plain language, prohibited uses include:
47
+
48
+ - Hosting the package as part of a SaaS that primarily delivers the
49
+ package's functionality
50
+ - Offering a service whose value derives entirely or primarily from the
51
+ package
52
+ - Repackaging the functionality for redistribution as a competing service
53
+
54
+ If you are unsure whether your intended use is restricted, contact
55
+ founder@revealui.com before relying on the package.
56
+
57
+ ## Change Date and MIT Conversion
58
+
59
+ Each Pro package's LICENSE file specifies a Change Date. On the earlier of
60
+ that date or the fourth anniversary of the first publicly-available
61
+ distribution of a specific version of the package under FSL, the package
62
+ automatically converts to the MIT License (the "Change License"). After
63
+ conversion, all FSL restrictions are removed for the version in question
64
+ and going forward.
65
+
66
+ This means every Pro package in this repository will eventually become MIT;
67
+ FSL-1.1-MIT is a time-limited restriction, not a permanent one.
68
+
69
+ ## Commercial Licensing Alternatives
70
+
71
+ If FSL-1.1-MIT terms do not fit your use case (for example, you are
72
+ building a service that the FSL would prohibit, or you need contractual
73
+ guarantees beyond what an open license provides), commercial licensing is
74
+ available.
75
+
76
+ Contact: founder@revealui.com
77
+
78
+ ## Canonical FSL-1.1-MIT Text
79
+
80
+ The Functional Source License v1.1 with MIT Future License is published at:
81
+
82
+ https://fsl.software/FSL-1.1-MIT.template.md
83
+
84
+ The full canonical text is reproduced verbatim in each Pro package's
85
+ LICENSE file. If there is any conflict between this explainer and a
86
+ per-package LICENSE file, the per-package LICENSE file controls.
87
+
88
+ ---
89
+
90
+ Copyright (c) 2025-2026 RevealUI Studio
package/README.md CHANGED
@@ -83,6 +83,6 @@ Optional peer dependency: `next` (>=14.0.0) - required for ISR helpers.
83
83
 
84
84
  ## Related Packages
85
85
 
86
- - `apps/api` - Applies cache headers to REST responses
86
+ - `apps/server` - Applies cache headers to REST responses
87
87
  - `apps/marketing` - Uses ISR presets for marketing pages
88
88
  - `@revealui/core` - Triggers cache invalidation on content changes
package/dist/index.js CHANGED
@@ -368,6 +368,9 @@ function getCacheTTL(headers) {
368
368
  return 0;
369
369
  }
370
370
 
371
+ // src/edge-cache.ts
372
+ import { getClientIp } from "@revealui/security";
373
+
371
374
  // src/logger.ts
372
375
  var cacheLogger = console;
373
376
  function configureCacheLogger(logger) {
@@ -570,7 +573,7 @@ var EdgeRateLimiter = class {
570
573
  * Check rate limit
571
574
  */
572
575
  check(request) {
573
- const key = this.config.key ? this.config.key(request) : request.headers.get("x-forwarded-for") || "unknown";
576
+ const key = this.config.key ? this.config.key(request) : getClientIp(request);
574
577
  const now = Date.now();
575
578
  let entry = this.cache.get(key);
576
579
  if (!entry || now > entry.resetTime) {
@@ -631,7 +634,7 @@ function getABTestVariant(request, testName, variants) {
631
634
  if (cookieVariant && variants.includes(cookieVariant)) {
632
635
  return cookieVariant;
633
636
  }
634
- const ip = request.headers.get("x-forwarded-for") || "unknown";
637
+ const ip = getClientIp(request);
635
638
  const hash = simpleHash(ip + testName);
636
639
  const variantIndex = hash % variants.length;
637
640
  const variant = variants[variantIndex];
package/package.json CHANGED
@@ -1,14 +1,17 @@
1
1
  {
2
2
  "name": "@revealui/cache",
3
- "version": "0.1.4",
4
- "description": "Caching infrastructure for RevealUI - CDN config, edge cache, ISR presets, revalidation",
3
+ "version": "0.1.5",
4
+ "description": "CDN config, edge cache, ISR presets, and revalidation helpers for Vercel and Hono. Ships with RevealUI.",
5
5
  "license": "MIT",
6
+ "dependencies": {
7
+ "@revealui/security": "0.3.1"
8
+ },
6
9
  "devDependencies": {
7
- "@electric-sql/pglite": "^0.4.3",
8
- "@types/node": "^25.5.2",
10
+ "@electric-sql/pglite": "^0.4.4",
11
+ "@types/node": "^25.6.0",
9
12
  "tsup": "^8.5.1",
10
- "typescript": "^6.0.2",
11
- "vitest": "^4.1.3",
13
+ "typescript": "^6.0.3",
14
+ "vitest": "^4.1.5",
12
15
  "@revealui/dev": "0.1.0"
13
16
  },
14
17
  "engines": {