@umituz/react-native-ai-fal-provider 2.3.4 → 3.0.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/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Validates input parameters before API calls
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { isValidPrompt } from "./type-guards";
|
|
7
7
|
import { IMAGE_URL_FIELDS } from './constants/image-fields.constants';
|
|
8
8
|
import { isImageDataUri } from './validators/data-uri-validator.util';
|
|
9
9
|
import { isNonEmptyString } from './validators/string-validator.util';
|
|
@@ -89,13 +89,6 @@ export function validateInput(
|
|
|
89
89
|
): void {
|
|
90
90
|
const errors: ValidationError[] = [];
|
|
91
91
|
|
|
92
|
-
// Validate model ID
|
|
93
|
-
if (!model || typeof model !== "string") {
|
|
94
|
-
errors.push({ field: "model", message: "Model ID is required and must be a string" });
|
|
95
|
-
} else if (!isValidModelId(model)) {
|
|
96
|
-
errors.push({ field: "model", message: `Invalid model ID format: ${model}` });
|
|
97
|
-
}
|
|
98
|
-
|
|
99
92
|
// Validate input is not empty
|
|
100
93
|
if (!input || typeof input !== "object" || Object.keys(input).length === 0) {
|
|
101
94
|
errors.push({ field: "input", message: "Input must be a non-empty object" });
|
|
@@ -41,10 +41,13 @@ export function isValidApiKey(value: unknown): boolean {
|
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* Validate model ID format
|
|
44
|
-
* Pattern: org/model or org/model/
|
|
44
|
+
* Pattern: org/model or org/model/sub1/sub2/... (multiple path segments)
|
|
45
45
|
* Allows dots for versions (e.g., v1.5) but prevents path traversal (..)
|
|
46
|
+
* Examples:
|
|
47
|
+
* - xai/grok-imagine-video/text-to-video
|
|
48
|
+
* - fal-ai/minimax/hailuo-02/standard/image-to-video
|
|
46
49
|
*/
|
|
47
|
-
const MODEL_ID_PATTERN = /^[a-zA-Z0-9-_]+\/[a-zA-Z0-9-_.]+(\/[a-zA-Z0-9-_.]+)
|
|
50
|
+
const MODEL_ID_PATTERN = /^[a-zA-Z0-9-_]+\/[a-zA-Z0-9-_.]+(\/[a-zA-Z0-9-_.]+)*$/;
|
|
48
51
|
|
|
49
52
|
export function isValidModelId(value: unknown): boolean {
|
|
50
53
|
if (typeof value !== "string") {
|