@objectql/types 1.7.1 → 1.7.3
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 +118 -21
- package/dist/field.d.ts +73 -1
- package/package.json +2 -1
- package/schemas/object.schema.json +32 -2
package/LICENSE
CHANGED
|
@@ -1,21 +1,118 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
to
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
# PolyForm Shield License 1.0.0
|
|
2
|
+
|
|
3
|
+
<https://polyformproject.org/licenses/shield/1.0.0>
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
In order to get any license under these terms, you must agree
|
|
8
|
+
to them as both strict obligations and conditions to all
|
|
9
|
+
your licenses.
|
|
10
|
+
|
|
11
|
+
## Copyright License
|
|
12
|
+
|
|
13
|
+
The licensor grants you a copyright license for the
|
|
14
|
+
software to do everything you might do with the software
|
|
15
|
+
that would otherwise infringe the licensor's copyright
|
|
16
|
+
in it for any permitted purpose. However, you may
|
|
17
|
+
only distribute the software according to [Distribution
|
|
18
|
+
License](#distribution-license) and make changes or new works
|
|
19
|
+
based on the software according to [Changes and New Works
|
|
20
|
+
License](#changes-and-new-works-license).
|
|
21
|
+
|
|
22
|
+
## Distribution License
|
|
23
|
+
|
|
24
|
+
The licensor grants you an additional copyright license
|
|
25
|
+
to distribute copies of the software. Your license
|
|
26
|
+
to distribute covers distributing the software with
|
|
27
|
+
changes and new works permitted by [Changes and New Works
|
|
28
|
+
License](#changes-and-new-works-license).
|
|
29
|
+
|
|
30
|
+
## Notices
|
|
31
|
+
|
|
32
|
+
You must ensure that anyone who gets a copy of any part of
|
|
33
|
+
the software from you also gets a copy of these terms or the
|
|
34
|
+
URL for them above, as well as copies of any plain-text lines
|
|
35
|
+
beginning with `Required Notice:` that the licensor provided
|
|
36
|
+
with the software. For example:
|
|
37
|
+
|
|
38
|
+
> Required Notice: Copyright ObjectQL Contributors (https://github.com/objectql)
|
|
39
|
+
|
|
40
|
+
## Changes and New Works License
|
|
41
|
+
|
|
42
|
+
The licensor grants you an additional copyright license to
|
|
43
|
+
make changes and new works based on the software for any
|
|
44
|
+
permitted purpose.
|
|
45
|
+
|
|
46
|
+
## Patent License
|
|
47
|
+
|
|
48
|
+
The licensor grants you a patent license for the software that
|
|
49
|
+
covers patent claims the licensor can license, or becomes able
|
|
50
|
+
to license, that you would infringe by using the software.
|
|
51
|
+
|
|
52
|
+
## Fair Use
|
|
53
|
+
|
|
54
|
+
You may have "fair use" rights for the software under the
|
|
55
|
+
law. These terms do not limit them.
|
|
56
|
+
|
|
57
|
+
## No Other Rights
|
|
58
|
+
|
|
59
|
+
These terms do not allow you to sublicense or transfer any of
|
|
60
|
+
your licenses to anyone else, or prevent the licensor from
|
|
61
|
+
granting licenses to anyone else. These terms do not imply
|
|
62
|
+
any other licenses.
|
|
63
|
+
|
|
64
|
+
## Patent Defense
|
|
65
|
+
|
|
66
|
+
If you make any written claim that the software infringes or
|
|
67
|
+
contributes to infringement of any patent, your patent license
|
|
68
|
+
for the software granted under these terms ends immediately. If
|
|
69
|
+
your company makes such a claim, your patent license ends
|
|
70
|
+
immediately for work on behalf of your company.
|
|
71
|
+
|
|
72
|
+
## Violations
|
|
73
|
+
|
|
74
|
+
The first time you are notified in writing that you have
|
|
75
|
+
violated any of these terms, or done anything with the software
|
|
76
|
+
not covered by your licenses, your licenses can nonetheless
|
|
77
|
+
continue if you come into full compliance with these terms,
|
|
78
|
+
and take practical steps to correct past violations, within
|
|
79
|
+
32 days of receiving notice. Otherwise, all your licenses
|
|
80
|
+
end immediately.
|
|
81
|
+
|
|
82
|
+
## No Liability
|
|
83
|
+
|
|
84
|
+
***As far as the law allows, the software comes as is, without
|
|
85
|
+
any warranty or condition, and the licensor will not be liable
|
|
86
|
+
to you for any damages arising out of these terms or the use
|
|
87
|
+
or nature of the software, under any kind of legal claim.***
|
|
88
|
+
|
|
89
|
+
## Definitions
|
|
90
|
+
|
|
91
|
+
The **licensor** is the individual or entity offering these
|
|
92
|
+
terms, and the **software** is the software the licensor makes
|
|
93
|
+
available under these terms.
|
|
94
|
+
|
|
95
|
+
**You** refers to the individual or entity agreeing to these
|
|
96
|
+
terms.
|
|
97
|
+
|
|
98
|
+
**Your company** is any legal entity, sole proprietorship,
|
|
99
|
+
or other kind of organization that you work for, plus all
|
|
100
|
+
organizations that have control over, are under the control of,
|
|
101
|
+
or are under common control with that organization. **Control**
|
|
102
|
+
means ownership of substantially all the assets of an entity,
|
|
103
|
+
or the power to direct its management and policies by vote,
|
|
104
|
+
contract, or otherwise. Control can be direct or indirect.
|
|
105
|
+
|
|
106
|
+
**Your licenses** are all the licenses granted to you for the
|
|
107
|
+
software under these terms.
|
|
108
|
+
|
|
109
|
+
**Use** means anything you do with the software requiring one
|
|
110
|
+
of your licenses.
|
|
111
|
+
|
|
112
|
+
**Permitted purpose** means any purpose other than competing
|
|
113
|
+
with the licensor or any product the licensor or its affiliates
|
|
114
|
+
provides using the software.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
Required Notice: Copyright (c) 2026 ObjectQL Contributors (https://github.com/objectql)
|
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",
|