@nordsym/apiclaw 1.7.8 → 1.7.9

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.
@@ -95,9 +95,9 @@ export const verifyMagicLink = mutation({
95
95
  status: "active",
96
96
  tier: "free",
97
97
  usageCount: 0,
98
- usageLimit: 50, // Legacy field, now using weekly limits
98
+ usageLimit: 50, // 50 calls/month for free tier
99
99
  weeklyUsageCount: 0,
100
- weeklyUsageLimit: 50, // 50 calls/week for free tier
100
+ weeklyUsageLimit: 50, // Monthly limit (field name is legacy)
101
101
  hourlyUsageCount: 0,
102
102
  referralCode: newReferralCode!,
103
103
  createdAt: Date.now(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nordsym/apiclaw",
3
- "version": "1.7.8",
3
+ "version": "1.7.9",
4
4
  "description": "The API layer for AI agents. Dashboard + 22K APIs + 18 Direct Call providers. MCP native.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -97,7 +97,7 @@ const anonymousRateLimits = new Map<string, AnonymousRateLimitState>();
97
97
  // Rate limit constants
98
98
  const ANONYMOUS_HOURLY_LIMIT = 5;
99
99
  const ANONYMOUS_WEEKLY_LIMIT = 10;
100
- const FREE_WEEKLY_LIMIT = 50;
100
+ const FREE_MONTHLY_LIMIT = 50;
101
101
 
102
102
  /**
103
103
  * Calculate minutes until next hour
@@ -112,14 +112,10 @@ function calculateMinutesUntilNextHour(): number {
112
112
  /**
113
113
  * Get next Monday 00:00 UTC as ISO string
114
114
  */
115
- function getNextMondayUTC(): string {
115
+ function getNextMonthUTC(): string {
116
116
  const now = new Date();
117
- const dayOfWeek = now.getUTCDay(); // 0 = Sunday, 1 = Monday, etc.
118
- const daysUntilMonday = dayOfWeek === 0 ? 1 : 8 - dayOfWeek;
119
- const nextMonday = new Date(now);
120
- nextMonday.setUTCDate(now.getUTCDate() + daysUntilMonday);
121
- nextMonday.setUTCHours(0, 0, 0, 0);
122
- return nextMonday.toISOString().replace('T', ' ').slice(0, 16) + ' UTC';
117
+ const nextMonth = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth() + 1, 1));
118
+ return nextMonth.toISOString().replace('T', ' ').slice(0, 16) + ' UTC';
123
119
  }
124
120
 
125
121
  /**
@@ -174,10 +170,10 @@ function checkAnonymousRateLimit(fingerprint: string): { allowed: boolean; error
174
170
  allowed: false,
175
171
  error: JSON.stringify({
176
172
  success: false,
177
- error: `Weekly limit reached (${ANONYMOUS_WEEKLY_LIMIT} calls)`,
178
- hint: "Register to get 50 calls/week",
173
+ error: `Monthly limit reached (${ANONYMOUS_WEEKLY_LIMIT} calls)`,
174
+ hint: "Register to get 50 calls/month",
179
175
  action: "Run: register_owner({ email: 'you@example.com' })",
180
- retry_after: getNextMondayUTC()
176
+ retry_after: getNextMonthUTC()
181
177
  }, null, 2)
182
178
  };
183
179
  }
@@ -267,7 +263,7 @@ async function trackEarnProgress(workspaceId: string, provider: string, action:
267
263
  /**
268
264
  * Rate limiting for anonymous proxy usage
269
265
  * Limits: 10 calls/week, 5 calls/hour (anonymous)
270
- * 50 calls/week, 10 calls/hour (authenticated)
266
+ * 50 calls/month, 10 calls/hour (authenticated)
271
267
  */
272
268
  interface RateLimitState {
273
269
  hourly: { count: number; resetAt: number };
@@ -326,7 +322,7 @@ function checkWorkspaceAccess(providerId?: string): { allowed: boolean; error?:
326
322
  error: JSON.stringify({
327
323
  success: false,
328
324
  error: `Register to continue. You've used ${UNREGISTERED_CALL_LIMIT} free calls.`,
329
- hint: "Run register_owner with your email to unlock 50 calls/week.",
325
+ hint: "Run register_owner with your email to unlock 50 calls/month.",
330
326
  action: "register_owner"
331
327
  }, null, 2)
332
328
  };
@@ -339,10 +335,10 @@ function checkWorkspaceAccess(providerId?: string): { allowed: boolean; error?:
339
335
  allowed: false,
340
336
  error: JSON.stringify({
341
337
  success: false,
342
- error: `Weekly limit reached (${FREE_WEEKLY_LIMIT} calls)`,
338
+ error: `Monthly limit reached (${FREE_MONTHLY_LIMIT} calls)`,
343
339
  hint: "Upgrade to Backer for unlimited calls",
344
340
  upgrade_url: "https://apiclaw.nordsym.com/upgrade",
345
- retry_after: getNextMondayUTC()
341
+ retry_after: getNextMonthUTC()
346
342
  }, null, 2)
347
343
  };
348
344
  }
@@ -1574,7 +1570,7 @@ Docs: https://apiclaw.nordsym.com
1574
1570
  if (result.success && workspaceContext && !workspaceContext.email) {
1575
1571
  const remaining = UNREGISTERED_CALL_LIMIT - (workspaceContext.usageCount || 0);
1576
1572
  if (remaining > 0 && remaining <= 3) {
1577
- responseData._notice = `${remaining} free calls remaining. Run register_owner to unlock 50/week.`;
1573
+ responseData._notice = `${remaining} free calls remaining. Run register_owner to unlock 50/month.`;
1578
1574
  }
1579
1575
  }
1580
1576