@umituz/react-native-ai-fal-provider 2.0.5 → 2.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-ai-fal-provider",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "FAL AI provider for React Native - implements IAIProvider interface for unified AI generation",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -22,7 +22,13 @@ export function getRequestStore(): RequestStore {
22
22
 
23
23
  export function createRequestKey(model: string, input: Record<string, unknown>): string {
24
24
  const inputStr = JSON.stringify(input, Object.keys(input).sort());
25
- return `${model}:${inputStr.slice(0, 100)}`;
25
+ // Simple hash to avoid collisions from truncation
26
+ let hash = 0;
27
+ for (let i = 0; i < inputStr.length; i++) {
28
+ const char = inputStr.charCodeAt(i);
29
+ hash = ((hash << 5) - hash + char) | 0;
30
+ }
31
+ return `${model}:${hash.toString(36)}`;
26
32
  }
27
33
 
28
34
  export function getExistingRequest<T>(key: string): ActiveRequest<T> | undefined {
@@ -10,7 +10,7 @@ const PATTERNS: Record<FalErrorType, string[]> = {
10
10
  [FalErrorType.IMAGE_TOO_SMALL]: ["image_too_small", "image dimensions are too small", "minimum dimensions"],
11
11
  [FalErrorType.VALIDATION]: ["validation", "invalid", "unprocessable", "422", "bad request", "400"],
12
12
  [FalErrorType.CONTENT_POLICY]: ["content_policy", "content policy", "policy violation", "nsfw", "inappropriate"],
13
- [FalErrorType.RATE_LIMIT]: ["rate limit", "too many requests", "429", "quota"],
13
+ [FalErrorType.RATE_LIMIT]: ["rate limit", "too many requests", "429"],
14
14
  [FalErrorType.AUTHENTICATION]: ["unauthorized", "401", "forbidden", "403", "api key", "authentication"],
15
15
  [FalErrorType.QUOTA_EXCEEDED]: ["quota exceeded", "insufficient credits", "billing", "payment required", "402"],
16
16
  [FalErrorType.MODEL_NOT_FOUND]: ["model not found", "endpoint not found", "404", "not found"],
@@ -44,6 +44,7 @@ export function isFalErrorType(value: unknown): value is FalErrorType {
44
44
  FalErrorType.TIMEOUT,
45
45
  FalErrorType.API_ERROR,
46
46
  FalErrorType.VALIDATION,
47
+ FalErrorType.IMAGE_TOO_SMALL,
47
48
  FalErrorType.CONTENT_POLICY,
48
49
  FalErrorType.RATE_LIMIT,
49
50
  FalErrorType.AUTHENTICATION,