@objectql/types 1.7.2 → 1.8.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/LICENSE +1 -1
- package/dist/field.d.ts +73 -1
- package/package.json +2 -1
- package/schemas/object.schema.json +32 -2
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2026 ObjectQL Contributors
|
|
3
|
+
Copyright (c) 2026 ObjectQL Contributors (https://github.com/objectql)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/dist/field.d.ts
CHANGED
|
@@ -1,4 +1,44 @@
|
|
|
1
1
|
import { FieldValidation, ValidationAiContext } from './validation';
|
|
2
|
+
/**
|
|
3
|
+
* Attachment field data structure for file and image types.
|
|
4
|
+
* Stores metadata about uploaded files, with actual file content stored separately.
|
|
5
|
+
*/
|
|
6
|
+
export interface AttachmentData {
|
|
7
|
+
/** Unique identifier for this file */
|
|
8
|
+
id?: string;
|
|
9
|
+
/** File name (e.g., "invoice.pdf") */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Publicly accessible URL to the file */
|
|
12
|
+
url: string;
|
|
13
|
+
/** File size in bytes */
|
|
14
|
+
size: number;
|
|
15
|
+
/** MIME type (e.g., "application/pdf", "image/jpeg") */
|
|
16
|
+
type: string;
|
|
17
|
+
/** Original filename as uploaded by user */
|
|
18
|
+
original_name?: string;
|
|
19
|
+
/** Upload timestamp (ISO 8601) */
|
|
20
|
+
uploaded_at?: string;
|
|
21
|
+
/** User ID who uploaded the file */
|
|
22
|
+
uploaded_by?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Image-specific attachment data with additional metadata.
|
|
26
|
+
* Extends AttachmentData with image-specific properties.
|
|
27
|
+
*/
|
|
28
|
+
export interface ImageAttachmentData extends AttachmentData {
|
|
29
|
+
/** Image width in pixels */
|
|
30
|
+
width?: number;
|
|
31
|
+
/** Image height in pixels */
|
|
32
|
+
height?: number;
|
|
33
|
+
/** Thumbnail URL (if generated) */
|
|
34
|
+
thumbnail_url?: string;
|
|
35
|
+
/** Alternative sizes/versions */
|
|
36
|
+
variants?: {
|
|
37
|
+
small?: string;
|
|
38
|
+
medium?: string;
|
|
39
|
+
large?: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
2
42
|
/**
|
|
3
43
|
* Represents the supported field data types in the ObjectQL schema.
|
|
4
44
|
* These types determine how data is stored, validated, and rendered.
|
|
@@ -7,8 +47,10 @@ import { FieldValidation, ValidationAiContext } from './validation';
|
|
|
7
47
|
* - `textarea`: Long string.
|
|
8
48
|
* - `select`: Choice from a list.
|
|
9
49
|
* - `lookup`: Relationship to another object.
|
|
50
|
+
* - `file`: File attachment. Value stored as AttachmentData (single) or AttachmentData[] (multiple).
|
|
51
|
+
* - `image`: Image attachment. Value stored as ImageAttachmentData (single) or ImageAttachmentData[] (multiple).
|
|
10
52
|
*/
|
|
11
|
-
export type FieldType = 'text' | 'textarea' | 'markdown' | 'html' | 'select' | 'date' | 'datetime' | 'time' | 'number' | 'currency' | 'percent' | 'boolean' | 'email' | 'phone' | 'url' | 'image' | 'file' | '
|
|
53
|
+
export type FieldType = 'text' | 'textarea' | 'markdown' | 'html' | 'select' | 'date' | 'datetime' | 'time' | 'number' | 'currency' | 'percent' | 'boolean' | 'email' | 'phone' | 'url' | 'image' | 'file' | 'location' | 'lookup' | 'master_detail' | 'password' | 'formula' | 'summary' | 'auto_number' | 'object' | 'vector' | 'grid';
|
|
12
54
|
/**
|
|
13
55
|
* Defines a single option for select/multiselect fields.
|
|
14
56
|
*/
|
|
@@ -63,6 +105,36 @@ export interface FieldConfig {
|
|
|
63
105
|
* Specifies the target object name for relationship fields.
|
|
64
106
|
*/
|
|
65
107
|
reference_to?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Allowed file extensions for file/image fields.
|
|
110
|
+
* Example: ['.pdf', '.docx'] or ['.jpg', '.png', '.gif']
|
|
111
|
+
*/
|
|
112
|
+
accept?: string[];
|
|
113
|
+
/**
|
|
114
|
+
* Maximum file size in bytes for file/image fields.
|
|
115
|
+
* Example: 5242880 (5MB)
|
|
116
|
+
*/
|
|
117
|
+
max_size?: number;
|
|
118
|
+
/**
|
|
119
|
+
* Minimum file size in bytes for file/image fields.
|
|
120
|
+
*/
|
|
121
|
+
min_size?: number;
|
|
122
|
+
/**
|
|
123
|
+
* Maximum image width in pixels for image fields.
|
|
124
|
+
*/
|
|
125
|
+
max_width?: number;
|
|
126
|
+
/**
|
|
127
|
+
* Maximum image height in pixels for image fields.
|
|
128
|
+
*/
|
|
129
|
+
max_height?: number;
|
|
130
|
+
/**
|
|
131
|
+
* Minimum image width in pixels for image fields.
|
|
132
|
+
*/
|
|
133
|
+
min_width?: number;
|
|
134
|
+
/**
|
|
135
|
+
* Minimum image height in pixels for image fields.
|
|
136
|
+
*/
|
|
137
|
+
min_height?: number;
|
|
66
138
|
/** Minimum for number/currency/percent. */
|
|
67
139
|
min?: number;
|
|
68
140
|
/** Maximum for number/currency/percent. */
|
package/package.json
CHANGED
|
@@ -548,6 +548,13 @@
|
|
|
548
548
|
"additionalProperties": false,
|
|
549
549
|
"description": "Configuration for a single field on an object. This defines the schema, validation rules, and UI hints for the attribute.",
|
|
550
550
|
"properties": {
|
|
551
|
+
"accept": {
|
|
552
|
+
"description": "Allowed file extensions for file/image fields. Example: ['.pdf', '.docx'] or ['.jpg', '.png', '.gif']",
|
|
553
|
+
"items": {
|
|
554
|
+
"type": "string"
|
|
555
|
+
},
|
|
556
|
+
"type": "array"
|
|
557
|
+
},
|
|
551
558
|
"ai_context": {
|
|
552
559
|
"$ref": "#/definitions/ValidationAiContext",
|
|
553
560
|
"description": "AI context for the field. Provides semantic information for AI tools."
|
|
@@ -591,18 +598,42 @@
|
|
|
591
598
|
"description": "Maximum for number/currency/percent.",
|
|
592
599
|
"type": "number"
|
|
593
600
|
},
|
|
601
|
+
"max_height": {
|
|
602
|
+
"description": "Maximum image height in pixels for image fields.",
|
|
603
|
+
"type": "number"
|
|
604
|
+
},
|
|
594
605
|
"max_length": {
|
|
595
606
|
"description": "Maximum length for text based fields.",
|
|
596
607
|
"type": "number"
|
|
597
608
|
},
|
|
609
|
+
"max_size": {
|
|
610
|
+
"description": "Maximum file size in bytes for file/image fields. Example: 5242880 (5MB)",
|
|
611
|
+
"type": "number"
|
|
612
|
+
},
|
|
613
|
+
"max_width": {
|
|
614
|
+
"description": "Maximum image width in pixels for image fields.",
|
|
615
|
+
"type": "number"
|
|
616
|
+
},
|
|
598
617
|
"min": {
|
|
599
618
|
"description": "Minimum for number/currency/percent.",
|
|
600
619
|
"type": "number"
|
|
601
620
|
},
|
|
621
|
+
"min_height": {
|
|
622
|
+
"description": "Minimum image height in pixels for image fields.",
|
|
623
|
+
"type": "number"
|
|
624
|
+
},
|
|
602
625
|
"min_length": {
|
|
603
626
|
"description": "Minimum length for text based fields.",
|
|
604
627
|
"type": "number"
|
|
605
628
|
},
|
|
629
|
+
"min_size": {
|
|
630
|
+
"description": "Minimum file size in bytes for file/image fields.",
|
|
631
|
+
"type": "number"
|
|
632
|
+
},
|
|
633
|
+
"min_width": {
|
|
634
|
+
"description": "Minimum image width in pixels for image fields.",
|
|
635
|
+
"type": "number"
|
|
636
|
+
},
|
|
606
637
|
"multiple": {
|
|
607
638
|
"description": "Whether the field allows multiple values. Supported by 'select', 'lookup', 'file', 'image'.",
|
|
608
639
|
"type": "boolean"
|
|
@@ -687,7 +718,7 @@
|
|
|
687
718
|
"type": "object"
|
|
688
719
|
},
|
|
689
720
|
"FieldType": {
|
|
690
|
-
"description": "Represents the supported field data types in the ObjectQL schema. These types determine how data is stored, validated, and rendered.\n\n- `text`: Simple string.\n- `textarea`: Long string.\n- `select`: Choice from a list.\n- `lookup`: Relationship to another object.",
|
|
721
|
+
"description": "Represents the supported field data types in the ObjectQL schema. These types determine how data is stored, validated, and rendered.\n\n- `text`: Simple string.\n- `textarea`: Long string.\n- `select`: Choice from a list.\n- `lookup`: Relationship to another object.\n- `file`: File attachment. Value stored as AttachmentData (single) or AttachmentData[] (multiple).\n- `image`: Image attachment. Value stored as ImageAttachmentData (single) or ImageAttachmentData[] (multiple).",
|
|
691
722
|
"enum": [
|
|
692
723
|
"text",
|
|
693
724
|
"textarea",
|
|
@@ -706,7 +737,6 @@
|
|
|
706
737
|
"url",
|
|
707
738
|
"image",
|
|
708
739
|
"file",
|
|
709
|
-
"avatar",
|
|
710
740
|
"location",
|
|
711
741
|
"lookup",
|
|
712
742
|
"master_detail",
|