@yawlabs/vend-mcp 0.1.0 → 0.1.1

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/index.d.ts CHANGED
@@ -42,6 +42,7 @@ export declare class VendGuard {
42
42
  private errorCacheTtl;
43
43
  private cached;
44
44
  private cachedAt;
45
+ private readonly maxFallbackTtl;
45
46
  private hooks;
46
47
  constructor(opts: VendAuthOptions);
47
48
  /** Update the license key (clears cache) */
package/dist/index.js CHANGED
@@ -42,6 +42,7 @@ export class VendGuard {
42
42
  errorCacheTtl;
43
43
  cached = null;
44
44
  cachedAt = 0;
45
+ maxFallbackTtl = 3600_000; // 1 hour max for offline fallback
45
46
  hooks;
46
47
  constructor(opts) {
47
48
  this.apiKey = opts.apiKey;
@@ -104,8 +105,8 @@ export class VendGuard {
104
105
  }
105
106
  catch (err) {
106
107
  this.hooks.onError?.('validate', err);
107
- // On network error, use previous successful cache if available
108
- if (this.cached?.valid) {
108
+ // On network error, use previous successful cache if not too old
109
+ if (this.cached?.valid && Date.now() - this.cachedAt < this.maxFallbackTtl) {
109
110
  this.hooks.onValidate?.(this.cached, true);
110
111
  return this.cached;
111
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yawlabs/vend-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "description": "Vend SDK for MCP servers — license key gating and usage metering in two lines",
6
6
  "exports": {