@synova-cloud/sdk 1.6.0 → 1.7.0
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/README.md +131 -7
- package/dist/index.cjs +558 -108
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +451 -77
- package/dist/index.d.ts +451 -77
- package/dist/index.js +537 -109
- package/dist/index.js.map +1 -1
- package/package.json +16 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,24 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schema primitive types
|
|
3
|
+
*/
|
|
4
|
+
type TJsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array';
|
|
5
|
+
/**
|
|
6
|
+
* JSON Schema string formats
|
|
7
|
+
* @see https://json-schema.org/understanding-json-schema/reference/string#built-in-formats
|
|
8
|
+
*/
|
|
9
|
+
type TJsonSchemaFormat = 'date-time' | 'date' | 'time' | 'duration' | 'email' | 'idn-email' | 'hostname' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'iri' | 'iri-reference' | 'uuid' | 'json-pointer' | 'relative-json-pointer' | 'regex';
|
|
10
|
+
/**
|
|
11
|
+
* JSON Schema definition
|
|
12
|
+
* @see https://json-schema.org/specification
|
|
13
|
+
*/
|
|
14
|
+
interface IJsonSchema {
|
|
15
|
+
type?: TJsonSchemaType | TJsonSchemaType[];
|
|
10
16
|
description?: string;
|
|
11
|
-
|
|
17
|
+
examples?: unknown[];
|
|
18
|
+
default?: unknown;
|
|
12
19
|
enum?: (string | number | boolean | null)[];
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
minLength?: number;
|
|
21
|
+
maxLength?: number;
|
|
22
|
+
pattern?: string;
|
|
23
|
+
format?: TJsonSchemaFormat;
|
|
24
|
+
minimum?: number;
|
|
25
|
+
maximum?: number;
|
|
26
|
+
exclusiveMinimum?: number;
|
|
27
|
+
exclusiveMaximum?: number;
|
|
28
|
+
multipleOf?: number;
|
|
29
|
+
items?: IJsonSchema;
|
|
30
|
+
minItems?: number;
|
|
31
|
+
maxItems?: number;
|
|
32
|
+
uniqueItems?: boolean;
|
|
33
|
+
properties?: Record<string, IJsonSchema>;
|
|
18
34
|
required?: string[];
|
|
19
|
-
|
|
35
|
+
additionalProperties?: boolean | IJsonSchema;
|
|
36
|
+
allOf?: IJsonSchema[];
|
|
37
|
+
anyOf?: IJsonSchema[];
|
|
38
|
+
oneOf?: IJsonSchema[];
|
|
39
|
+
not?: IJsonSchema;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Metadata keys used by schema decorators
|
|
43
|
+
*/
|
|
44
|
+
declare const SCHEMA_METADATA_KEYS: {
|
|
45
|
+
readonly DESCRIPTION: "synova:schema:description";
|
|
46
|
+
readonly EXAMPLES: "synova:schema:examples";
|
|
47
|
+
readonly DEFAULT: "synova:schema:default";
|
|
48
|
+
readonly FORMAT: "synova:schema:format";
|
|
49
|
+
readonly ARRAY_ITEM_TYPE: "synova:schema:arrayItemType";
|
|
50
|
+
readonly NULLABLE: "synova:schema:nullable";
|
|
51
|
+
readonly ENUM: "synova:schema:enum";
|
|
52
|
+
readonly MIN_LENGTH: "synova:schema:minLength";
|
|
53
|
+
readonly MAX_LENGTH: "synova:schema:maxLength";
|
|
54
|
+
readonly PATTERN: "synova:schema:pattern";
|
|
55
|
+
readonly MINIMUM: "synova:schema:minimum";
|
|
56
|
+
readonly MAXIMUM: "synova:schema:maximum";
|
|
57
|
+
readonly EXCLUSIVE_MINIMUM: "synova:schema:exclusiveMinimum";
|
|
58
|
+
readonly EXCLUSIVE_MAXIMUM: "synova:schema:exclusiveMaximum";
|
|
59
|
+
readonly MULTIPLE_OF: "synova:schema:multipleOf";
|
|
60
|
+
readonly MIN_ITEMS: "synova:schema:minItems";
|
|
61
|
+
readonly MAX_ITEMS: "synova:schema:maxItems";
|
|
62
|
+
readonly UNIQUE_ITEMS: "synova:schema:uniqueItems";
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Options for schema generation
|
|
66
|
+
*/
|
|
67
|
+
interface IGenerateSchemaOptions {
|
|
68
|
+
/** Allow additional properties on objects (default: false) */
|
|
20
69
|
additionalProperties?: boolean;
|
|
21
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Constructor type for classes
|
|
73
|
+
*/
|
|
74
|
+
type TClassConstructor<T = unknown> = new (...args: any[]) => T;
|
|
75
|
+
|
|
76
|
+
type TSynovaMessageRole = 'system' | 'user' | 'assistant' | 'tool';
|
|
77
|
+
type TSynovaResponseType = 'message' | 'tool_calls' | 'image' | 'audio' | 'error';
|
|
78
|
+
type TSynovaModelType = 'text' | 'image';
|
|
79
|
+
type TSynovaUsageType = 'tokens' | 'images' | 'time';
|
|
22
80
|
interface ISynovaLogger {
|
|
23
81
|
debug: (message: string, ...args: unknown[]) => void;
|
|
24
82
|
info: (message: string, ...args: unknown[]) => void;
|
|
@@ -119,7 +177,7 @@ interface ISynovaExecuteOptions {
|
|
|
119
177
|
/** Model parameters (temperature, maxTokens, topP, topK, etc.) */
|
|
120
178
|
parameters?: Record<string, unknown>;
|
|
121
179
|
/** JSON Schema for structured output */
|
|
122
|
-
responseSchema?:
|
|
180
|
+
responseSchema?: IJsonSchema;
|
|
123
181
|
}
|
|
124
182
|
interface ISynovaExecutionUsage {
|
|
125
183
|
/** Usage type: 'tokens' for LLM, 'images' for image generation, 'time' for time-based billing */
|
|
@@ -327,97 +385,82 @@ declare class HttpClient {
|
|
|
327
385
|
private log;
|
|
328
386
|
}
|
|
329
387
|
|
|
388
|
+
/**
|
|
389
|
+
* Execute options with optional responseClass for typed responses
|
|
390
|
+
*/
|
|
391
|
+
interface ISynovaExecuteTypedOptions<T> extends Omit<ISynovaExecuteOptions, 'responseSchema'> {
|
|
392
|
+
/** Class to use for response typing and schema generation */
|
|
393
|
+
responseClass: TClassConstructor<T>;
|
|
394
|
+
/** Enable class-validator validation (default: true) */
|
|
395
|
+
validate?: boolean;
|
|
396
|
+
}
|
|
330
397
|
declare class PromptsResource {
|
|
331
398
|
private readonly http;
|
|
332
399
|
constructor(http: HttpClient);
|
|
333
400
|
/**
|
|
334
401
|
* Get a prompt by ID (returns version with 'latest' tag)
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
*
|
|
402
|
+
*/
|
|
403
|
+
get(promptId: string, options?: ISynovaGetPromptOptions): Promise<ISynovaPrompt>;
|
|
404
|
+
/**
|
|
405
|
+
* Execute a prompt with typed response
|
|
339
406
|
*
|
|
340
407
|
* @example
|
|
341
408
|
* ```ts
|
|
342
|
-
* //
|
|
343
|
-
* const
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
* //
|
|
349
|
-
* const v2 = await client.prompts.get('prm_abc123', { version: '2.0.0' });
|
|
409
|
+
* // With responseClass - returns typed object
|
|
410
|
+
* const topic = await client.prompts.execute('prm_abc123', {
|
|
411
|
+
* provider: 'openai',
|
|
412
|
+
* model: 'gpt-4o',
|
|
413
|
+
* responseClass: TopicDto,
|
|
414
|
+
* });
|
|
415
|
+
* console.log(topic.title); // Typed as string
|
|
350
416
|
* ```
|
|
351
417
|
*/
|
|
352
|
-
|
|
418
|
+
execute<T>(promptId: string, options: ISynovaExecuteTypedOptions<T>): Promise<T>;
|
|
353
419
|
/**
|
|
354
|
-
* Execute a prompt
|
|
355
|
-
*
|
|
356
|
-
* @param promptId - The prompt ID
|
|
357
|
-
* @param options - Execution options including provider, model and variables
|
|
358
|
-
* @returns The execution response
|
|
420
|
+
* Execute a prompt
|
|
359
421
|
*
|
|
360
422
|
* @example
|
|
361
423
|
* ```ts
|
|
424
|
+
* // Without responseClass - returns ISynovaExecuteResponse
|
|
362
425
|
* const result = await client.prompts.execute('prm_abc123', {
|
|
363
426
|
* provider: 'openai',
|
|
364
427
|
* model: 'gpt-4o',
|
|
365
|
-
* variables: { topic: 'TypeScript' },
|
|
366
428
|
* });
|
|
367
|
-
*
|
|
368
429
|
* if (result.type === 'message') {
|
|
369
430
|
* console.log(result.content);
|
|
370
431
|
* }
|
|
371
|
-
*
|
|
372
|
-
* // Image generation
|
|
373
|
-
* const imageResult = await client.prompts.execute('prm_image123', {
|
|
374
|
-
* provider: 'google',
|
|
375
|
-
* model: 'gemini-2.0-flash-exp',
|
|
376
|
-
* variables: { style: 'modern' },
|
|
377
|
-
* });
|
|
378
|
-
*
|
|
379
|
-
* if (imageResult.type === 'image') {
|
|
380
|
-
* console.log('Generated images:', imageResult.files);
|
|
381
|
-
* }
|
|
382
432
|
* ```
|
|
383
433
|
*/
|
|
384
434
|
execute(promptId: string, options: ISynovaExecuteOptions): Promise<ISynovaExecuteResponse>;
|
|
435
|
+
/**
|
|
436
|
+
* Execute a prompt by tag with typed response
|
|
437
|
+
*/
|
|
438
|
+
executeByTag<T>(promptId: string, tag: string, options: ISynovaExecuteTypedOptions<T>): Promise<T>;
|
|
385
439
|
/**
|
|
386
440
|
* Execute a prompt by tag
|
|
387
|
-
*
|
|
388
|
-
* @param promptId - The prompt ID
|
|
389
|
-
* @param tag - The tag (e.g., 'latest', 'production', 'staging')
|
|
390
|
-
* @param options - Execution options
|
|
391
|
-
* @returns The execution response
|
|
392
|
-
*
|
|
393
|
-
* @example
|
|
394
|
-
* ```ts
|
|
395
|
-
* const result = await client.prompts.executeByTag('prm_abc123', 'production', {
|
|
396
|
-
* provider: 'openai',
|
|
397
|
-
* model: 'gpt-4o',
|
|
398
|
-
* variables: { topic: 'TypeScript' },
|
|
399
|
-
* });
|
|
400
|
-
* ```
|
|
401
441
|
*/
|
|
402
442
|
executeByTag(promptId: string, tag: string, options: ISynovaExecuteOptions): Promise<ISynovaExecuteResponse>;
|
|
443
|
+
/**
|
|
444
|
+
* Execute a prompt by version with typed response
|
|
445
|
+
*/
|
|
446
|
+
executeByVersion<T>(promptId: string, version: string, options: ISynovaExecuteTypedOptions<T>): Promise<T>;
|
|
403
447
|
/**
|
|
404
448
|
* Execute a prompt by version
|
|
405
|
-
*
|
|
406
|
-
* @param promptId - The prompt ID
|
|
407
|
-
* @param version - The semantic version (e.g., '1.0.0', '2.1.0')
|
|
408
|
-
* @param options - Execution options
|
|
409
|
-
* @returns The execution response
|
|
410
|
-
*
|
|
411
|
-
* @example
|
|
412
|
-
* ```ts
|
|
413
|
-
* const result = await client.prompts.executeByVersion('prm_abc123', '1.2.0', {
|
|
414
|
-
* provider: 'openai',
|
|
415
|
-
* model: 'gpt-4o',
|
|
416
|
-
* variables: { topic: 'TypeScript' },
|
|
417
|
-
* });
|
|
418
|
-
* ```
|
|
419
449
|
*/
|
|
420
450
|
executeByVersion(promptId: string, version: string, options: ISynovaExecuteOptions): Promise<ISynovaExecuteResponse>;
|
|
451
|
+
/**
|
|
452
|
+
* Execute raw request without typed response
|
|
453
|
+
* @throws {ExecutionSynovaError} If LLM returns an error
|
|
454
|
+
*/
|
|
455
|
+
private executeRaw;
|
|
456
|
+
/**
|
|
457
|
+
* Execute with typed response class
|
|
458
|
+
*/
|
|
459
|
+
private executeTyped;
|
|
460
|
+
/**
|
|
461
|
+
* Validate object using class-validator
|
|
462
|
+
*/
|
|
463
|
+
private validateObject;
|
|
421
464
|
}
|
|
422
465
|
|
|
423
466
|
declare class ModelsResource {
|
|
@@ -632,5 +675,336 @@ declare class NetworkSynovaError extends SynovaError {
|
|
|
632
675
|
readonly cause?: Error;
|
|
633
676
|
constructor(message: string, cause?: Error);
|
|
634
677
|
}
|
|
678
|
+
/**
|
|
679
|
+
* Error thrown when LLM execution fails (returned in response with type='error')
|
|
680
|
+
*/
|
|
681
|
+
declare class ExecutionSynovaError extends SynovaError {
|
|
682
|
+
readonly code: string;
|
|
683
|
+
readonly provider?: string;
|
|
684
|
+
readonly retryable: boolean;
|
|
685
|
+
readonly retryAfterMs?: number;
|
|
686
|
+
readonly details?: ISynovaExecutionError['details'];
|
|
687
|
+
constructor(error: ISynovaExecutionError);
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Validation violation details
|
|
691
|
+
*/
|
|
692
|
+
interface IValidationViolation {
|
|
693
|
+
property: string;
|
|
694
|
+
constraints: Record<string, string>;
|
|
695
|
+
value?: unknown;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Error thrown when LLM response fails class-validator validation
|
|
699
|
+
*/
|
|
700
|
+
declare class ValidationSynovaError extends SynovaError {
|
|
701
|
+
readonly violations: IValidationViolation[];
|
|
702
|
+
constructor(violations: IValidationViolation[]);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Generates JSON Schema from TypeScript classes decorated with schema decorators.
|
|
707
|
+
*
|
|
708
|
+
* @example
|
|
709
|
+
* ```typescript
|
|
710
|
+
* import { ClassSchema, Description, Example, SchemaMin, SchemaMax } from '@synova-cloud/sdk';
|
|
711
|
+
*
|
|
712
|
+
* class User {
|
|
713
|
+
* @Description('User ID')
|
|
714
|
+
* @Example('usr_123')
|
|
715
|
+
* id: string;
|
|
716
|
+
*
|
|
717
|
+
* @Description('User age')
|
|
718
|
+
* @SchemaMin(0)
|
|
719
|
+
* @SchemaMax(150)
|
|
720
|
+
* age: number;
|
|
721
|
+
* }
|
|
722
|
+
*
|
|
723
|
+
* const schema = ClassSchema.generate(User);
|
|
724
|
+
* ```
|
|
725
|
+
*/
|
|
726
|
+
declare class ClassSchema {
|
|
727
|
+
/**
|
|
728
|
+
* Generate JSON Schema from a class
|
|
729
|
+
*/
|
|
730
|
+
static generate<T>(targetClass: TClassConstructor<T>, options?: IGenerateSchemaOptions): IJsonSchema;
|
|
731
|
+
/**
|
|
732
|
+
* Get all properties with their schemas
|
|
733
|
+
*/
|
|
734
|
+
private static getProperties;
|
|
735
|
+
/**
|
|
736
|
+
* Get property names from class-validator metadata
|
|
737
|
+
*/
|
|
738
|
+
private static getClassValidatorProperties;
|
|
739
|
+
/**
|
|
740
|
+
* Get property names from our decorator metadata
|
|
741
|
+
*/
|
|
742
|
+
private static getDecoratorProperties;
|
|
743
|
+
/**
|
|
744
|
+
* Get JSON Schema for a single property
|
|
745
|
+
*/
|
|
746
|
+
private static getPropertySchema;
|
|
747
|
+
/**
|
|
748
|
+
* Get base schema from TypeScript type
|
|
749
|
+
*/
|
|
750
|
+
private static getBaseTypeSchema;
|
|
751
|
+
/**
|
|
752
|
+
* Get schema for array items
|
|
753
|
+
*/
|
|
754
|
+
private static getArrayItemSchema;
|
|
755
|
+
/**
|
|
756
|
+
* Apply class-validator constraints to schema
|
|
757
|
+
*/
|
|
758
|
+
private static applyClassValidatorConstraints;
|
|
759
|
+
/**
|
|
760
|
+
* Apply a single class-validator constraint
|
|
761
|
+
*/
|
|
762
|
+
private static applyValidationConstraint;
|
|
763
|
+
/**
|
|
764
|
+
* Apply our decorator metadata to schema.
|
|
765
|
+
* Our decorators take precedence over class-validator if both are used.
|
|
766
|
+
*/
|
|
767
|
+
private static applyDecoratorMetadata;
|
|
768
|
+
/**
|
|
769
|
+
* Get required properties (properties without @IsOptional)
|
|
770
|
+
*/
|
|
771
|
+
private static getRequiredProperties;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Adds a description to the property schema.
|
|
776
|
+
* Helps LLMs understand the expected content.
|
|
777
|
+
*
|
|
778
|
+
* @example
|
|
779
|
+
* ```typescript
|
|
780
|
+
* class Article {
|
|
781
|
+
* @Description('SEO-optimized article title, 50-60 characters')
|
|
782
|
+
* title: string;
|
|
783
|
+
* }
|
|
784
|
+
* ```
|
|
785
|
+
*/
|
|
786
|
+
declare function Description(description: string): PropertyDecorator;
|
|
787
|
+
/**
|
|
788
|
+
* Adds example values to the property schema.
|
|
789
|
+
* Helps LLMs understand the expected format.
|
|
790
|
+
*
|
|
791
|
+
* @example
|
|
792
|
+
* ```typescript
|
|
793
|
+
* class Article {
|
|
794
|
+
* @Example('How to Optimize SQL Queries', '10 Tips for Better Code')
|
|
795
|
+
* title: string;
|
|
796
|
+
* }
|
|
797
|
+
* ```
|
|
798
|
+
*/
|
|
799
|
+
declare function Example(...examples: unknown[]): PropertyDecorator;
|
|
800
|
+
/**
|
|
801
|
+
* Sets the default value for the property.
|
|
802
|
+
*
|
|
803
|
+
* @example
|
|
804
|
+
* ```typescript
|
|
805
|
+
* class Settings {
|
|
806
|
+
* @Default('en')
|
|
807
|
+
* language: string;
|
|
808
|
+
* }
|
|
809
|
+
* ```
|
|
810
|
+
*/
|
|
811
|
+
declare function Default(value: unknown): PropertyDecorator;
|
|
812
|
+
/**
|
|
813
|
+
* Sets the type of array items.
|
|
814
|
+
* Required since TypeScript loses array item types at runtime.
|
|
815
|
+
*
|
|
816
|
+
* @example
|
|
817
|
+
* ```typescript
|
|
818
|
+
* class Article {
|
|
819
|
+
* @ArrayItems(String)
|
|
820
|
+
* keywords: string[];
|
|
821
|
+
*
|
|
822
|
+
* @ArrayItems(Comment)
|
|
823
|
+
* comments: Comment[];
|
|
824
|
+
* }
|
|
825
|
+
* ```
|
|
826
|
+
*/
|
|
827
|
+
declare function ArrayItems(itemType: TClassConstructor | StringConstructor | NumberConstructor | BooleanConstructor): PropertyDecorator;
|
|
828
|
+
/**
|
|
829
|
+
* Sets semantic format for string (email, uri, uuid, date-time, etc.).
|
|
830
|
+
*
|
|
831
|
+
* @example
|
|
832
|
+
* ```typescript
|
|
833
|
+
* class User {
|
|
834
|
+
* @Format('email')
|
|
835
|
+
* email: string;
|
|
836
|
+
*
|
|
837
|
+
* @Format('date-time')
|
|
838
|
+
* createdAt: string;
|
|
839
|
+
* }
|
|
840
|
+
* ```
|
|
841
|
+
*/
|
|
842
|
+
declare function Format(format: TJsonSchemaFormat): PropertyDecorator;
|
|
843
|
+
/**
|
|
844
|
+
* Marks the property as nullable (can be null).
|
|
845
|
+
*
|
|
846
|
+
* @example
|
|
847
|
+
* ```typescript
|
|
848
|
+
* class User {
|
|
849
|
+
* @Nullable()
|
|
850
|
+
* middleName: string | null;
|
|
851
|
+
* }
|
|
852
|
+
* ```
|
|
853
|
+
*/
|
|
854
|
+
declare function Nullable(): PropertyDecorator;
|
|
855
|
+
/**
|
|
856
|
+
* Sets minimum string length.
|
|
857
|
+
*
|
|
858
|
+
* @example
|
|
859
|
+
* ```typescript
|
|
860
|
+
* class User {
|
|
861
|
+
* @SchemaMinLength(3)
|
|
862
|
+
* username: string;
|
|
863
|
+
* }
|
|
864
|
+
* ```
|
|
865
|
+
*/
|
|
866
|
+
declare function SchemaMinLength(length: number): PropertyDecorator;
|
|
867
|
+
/**
|
|
868
|
+
* Sets maximum string length.
|
|
869
|
+
*
|
|
870
|
+
* @example
|
|
871
|
+
* ```typescript
|
|
872
|
+
* class User {
|
|
873
|
+
* @SchemaMaxLength(100)
|
|
874
|
+
* bio: string;
|
|
875
|
+
* }
|
|
876
|
+
* ```
|
|
877
|
+
*/
|
|
878
|
+
declare function SchemaMaxLength(length: number): PropertyDecorator;
|
|
879
|
+
/**
|
|
880
|
+
* Sets regex pattern for string validation.
|
|
881
|
+
*
|
|
882
|
+
* @example
|
|
883
|
+
* ```typescript
|
|
884
|
+
* class User {
|
|
885
|
+
* @SchemaPattern('^[a-z0-9_]+$')
|
|
886
|
+
* username: string;
|
|
887
|
+
* }
|
|
888
|
+
* ```
|
|
889
|
+
*/
|
|
890
|
+
declare function SchemaPattern(pattern: string): PropertyDecorator;
|
|
891
|
+
/**
|
|
892
|
+
* Sets minimum value (inclusive).
|
|
893
|
+
*
|
|
894
|
+
* @example
|
|
895
|
+
* ```typescript
|
|
896
|
+
* class Product {
|
|
897
|
+
* @SchemaMin(0)
|
|
898
|
+
* price: number;
|
|
899
|
+
* }
|
|
900
|
+
* ```
|
|
901
|
+
*/
|
|
902
|
+
declare function SchemaMin(value: number): PropertyDecorator;
|
|
903
|
+
/**
|
|
904
|
+
* Sets maximum value (inclusive).
|
|
905
|
+
*
|
|
906
|
+
* @example
|
|
907
|
+
* ```typescript
|
|
908
|
+
* class Rating {
|
|
909
|
+
* @SchemaMax(5)
|
|
910
|
+
* score: number;
|
|
911
|
+
* }
|
|
912
|
+
* ```
|
|
913
|
+
*/
|
|
914
|
+
declare function SchemaMax(value: number): PropertyDecorator;
|
|
915
|
+
/**
|
|
916
|
+
* Sets minimum value (exclusive).
|
|
917
|
+
*
|
|
918
|
+
* @example
|
|
919
|
+
* ```typescript
|
|
920
|
+
* class Discount {
|
|
921
|
+
* @ExclusiveMin(0) // must be > 0
|
|
922
|
+
* percentage: number;
|
|
923
|
+
* }
|
|
924
|
+
* ```
|
|
925
|
+
*/
|
|
926
|
+
declare function ExclusiveMin(value: number): PropertyDecorator;
|
|
927
|
+
/**
|
|
928
|
+
* Sets maximum value (exclusive).
|
|
929
|
+
*
|
|
930
|
+
* @example
|
|
931
|
+
* ```typescript
|
|
932
|
+
* class Probability {
|
|
933
|
+
* @ExclusiveMax(1) // must be < 1
|
|
934
|
+
* value: number;
|
|
935
|
+
* }
|
|
936
|
+
* ```
|
|
937
|
+
*/
|
|
938
|
+
declare function ExclusiveMax(value: number): PropertyDecorator;
|
|
939
|
+
/**
|
|
940
|
+
* Value must be a multiple of this number.
|
|
941
|
+
*
|
|
942
|
+
* @example
|
|
943
|
+
* ```typescript
|
|
944
|
+
* class Currency {
|
|
945
|
+
* @MultipleOf(0.01)
|
|
946
|
+
* amount: number;
|
|
947
|
+
* }
|
|
948
|
+
* ```
|
|
949
|
+
*/
|
|
950
|
+
declare function MultipleOf(value: number): PropertyDecorator;
|
|
951
|
+
/**
|
|
952
|
+
* Sets minimum array length.
|
|
953
|
+
*
|
|
954
|
+
* @example
|
|
955
|
+
* ```typescript
|
|
956
|
+
* class Order {
|
|
957
|
+
* @SchemaMinItems(1)
|
|
958
|
+
* items: OrderItem[];
|
|
959
|
+
* }
|
|
960
|
+
* ```
|
|
961
|
+
*/
|
|
962
|
+
declare function SchemaMinItems(count: number): PropertyDecorator;
|
|
963
|
+
/**
|
|
964
|
+
* Sets maximum array length.
|
|
965
|
+
*
|
|
966
|
+
* @example
|
|
967
|
+
* ```typescript
|
|
968
|
+
* class Article {
|
|
969
|
+
* @SchemaMaxItems(10)
|
|
970
|
+
* tags: string[];
|
|
971
|
+
* }
|
|
972
|
+
* ```
|
|
973
|
+
*/
|
|
974
|
+
declare function SchemaMaxItems(count: number): PropertyDecorator;
|
|
975
|
+
/**
|
|
976
|
+
* Requires all array items to be unique.
|
|
977
|
+
*
|
|
978
|
+
* @example
|
|
979
|
+
* ```typescript
|
|
980
|
+
* class User {
|
|
981
|
+
* @SchemaUniqueItems()
|
|
982
|
+
* roles: string[];
|
|
983
|
+
* }
|
|
984
|
+
* ```
|
|
985
|
+
*/
|
|
986
|
+
declare function SchemaUniqueItems(): PropertyDecorator;
|
|
987
|
+
/**
|
|
988
|
+
* Sets allowed enum values.
|
|
989
|
+
*
|
|
990
|
+
* @example
|
|
991
|
+
* ```typescript
|
|
992
|
+
* class User {
|
|
993
|
+
* @SchemaEnum(['admin', 'user', 'guest'])
|
|
994
|
+
* role: string;
|
|
995
|
+
* }
|
|
996
|
+
* ```
|
|
997
|
+
*
|
|
998
|
+
* With TypeScript enum:
|
|
999
|
+
* ```typescript
|
|
1000
|
+
* enum Status { Active = 'active', Inactive = 'inactive' }
|
|
1001
|
+
*
|
|
1002
|
+
* class User {
|
|
1003
|
+
* @SchemaEnum(Object.values(Status))
|
|
1004
|
+
* status: Status;
|
|
1005
|
+
* }
|
|
1006
|
+
* ```
|
|
1007
|
+
*/
|
|
1008
|
+
declare function SchemaEnum(values: (string | number | boolean | null)[]): PropertyDecorator;
|
|
635
1009
|
|
|
636
|
-
export { ApiSynovaError, AuthSynovaError, type ISynovaConfig, type ISynovaExecuteOptions, type ISynovaExecuteResponse, type ISynovaExecutionError, type ISynovaExecutionErrorDetails, type ISynovaExecutionUsage, type ISynovaFileAttachment, type ISynovaFileThumbnails, type ISynovaGetPromptOptions, type ISynovaListModelsOptions, type ISynovaLogger, type ISynovaMessage, type ISynovaModel, type ISynovaModelCapabilities, type ISynovaModelLimits, type ISynovaModelPricing, type ISynovaModelsResponse, type ISynovaPrompt, type ISynovaPromptVariable, type ISynovaProvider, type ISynovaProviderResponse, type ISynovaRetryConfig, type ISynovaToolCall, type ISynovaToolResult, type ISynovaUploadOptions, type ISynovaUploadResponse, type ISynovaUploadedFile, NetworkSynovaError, NotFoundSynovaError, RateLimitSynovaError, ServerSynovaError, SynovaCloudSdk, SynovaError, type TSynovaMessageRole, type TSynovaModelType, type TSynovaResponseType, type TSynovaRetryStrategy, type TSynovaUsageType, TimeoutSynovaError };
|
|
1010
|
+
export { ApiSynovaError, ArrayItems, AuthSynovaError, ClassSchema, Default, Description, Example, ExclusiveMax, ExclusiveMin, ExecutionSynovaError, Format, type IGenerateSchemaOptions, type IJsonSchema, type ISynovaConfig, type ISynovaExecuteOptions, type ISynovaExecuteResponse, type ISynovaExecuteTypedOptions, type ISynovaExecutionError, type ISynovaExecutionErrorDetails, type ISynovaExecutionUsage, type ISynovaFileAttachment, type ISynovaFileThumbnails, type ISynovaGetPromptOptions, type ISynovaListModelsOptions, type ISynovaLogger, type ISynovaMessage, type ISynovaModel, type ISynovaModelCapabilities, type ISynovaModelLimits, type ISynovaModelPricing, type ISynovaModelsResponse, type ISynovaPrompt, type ISynovaPromptVariable, type ISynovaProvider, type ISynovaProviderResponse, type ISynovaRetryConfig, type ISynovaToolCall, type ISynovaToolResult, type ISynovaUploadOptions, type ISynovaUploadResponse, type ISynovaUploadedFile, type IValidationViolation, MultipleOf, NetworkSynovaError, NotFoundSynovaError, Nullable, RateLimitSynovaError, SCHEMA_METADATA_KEYS, SchemaEnum, SchemaMax, SchemaMaxItems, SchemaMaxLength, SchemaMin, SchemaMinItems, SchemaMinLength, SchemaPattern, SchemaUniqueItems, ServerSynovaError, SynovaCloudSdk, SynovaError, type TClassConstructor, type TJsonSchemaFormat, type TJsonSchemaType, type TSynovaMessageRole, type TSynovaModelType, type TSynovaResponseType, type TSynovaRetryStrategy, type TSynovaUsageType, TimeoutSynovaError, ValidationSynovaError };
|