@wix/patterns-fields-utils 1.0.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/@wix/patterns-fields-bundled-cm-media-utils/dist/cjs/index.d.ts +176 -0
- package/@wix/patterns-fields-bundled-cm-media-utils/dist/cjs/index.js +7103 -0
- package/@wix/patterns-fields-bundled-cm-media-utils/dist/cjs/index.js.map +1 -0
- package/@wix/patterns-fields-bundled-cm-media-utils/dist/esm/index.d.mts +176 -0
- package/@wix/patterns-fields-bundled-cm-media-utils/dist/esm/index.mjs +7118 -0
- package/@wix/patterns-fields-bundled-cm-media-utils/dist/esm/index.mjs.map +1 -0
- package/@wix/patterns-fields-bundled-cm-media-utils/package.json +37 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/cjs/index.css.map +1 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/cjs/index.d.ts +115 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/cjs/index.global.css +1536 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/cjs/index.js +76375 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/cjs/index.js.map +1 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/cjs/move-POMANKZG.svg +3 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/chunk-ANOFRNLZ.mjs +302 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/chunk-ANOFRNLZ.mjs.map +1 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/chunk-D3Y2XBAR.mjs +9573 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/chunk-D3Y2XBAR.mjs.map +1 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/chunk-FOPGQED5.mjs +60 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/chunk-FOPGQED5.mjs.map +1 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/chunk-KK6IAXDC.mjs +61 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/chunk-KK6IAXDC.mjs.map +1 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/chunk-LSMTMMMM.mjs +999 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/chunk-LSMTMMMM.mjs.map +1 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/hls-X7Z2O2CI.mjs +32977 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/hls-X7Z2O2CI.mjs.map +1 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/html2canvas.esm-26SHFSHQ.mjs +7813 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/html2canvas.esm-26SHFSHQ.mjs.map +1 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/index.css.map +1 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/index.d.mts +115 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/index.global.css +1537 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/index.mjs +23054 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/index.mjs.map +1 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/lib-INOZ3X5B.mjs +6427 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/lib-INOZ3X5B.mjs.map +1 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/move-POMANKZG.svg +3 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/player.es-EHCCDTX6.mjs +1600 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/player.es-EHCCDTX6.mjs.map +1 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/validateTypes-OWSYRJSG.mjs +85 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/validateTypes-OWSYRJSG.mjs.map +1 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/videoItem-QVVYW7GT.mjs +311 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/videoItem-QVVYW7GT.mjs.map +1 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/videoScrollHelper-HX35Z6JI.mjs +307 -0
- package/@wix/patterns-fields-bundled-organize-media/dist/esm/videoScrollHelper-HX35Z6JI.mjs.map +1 -0
- package/@wix/patterns-fields-bundled-organize-media/package.json +70 -0
- package/@wix/wix-data-schema-types/.nvmrc +1 -0
- package/@wix/wix-data-schema-types/index.d.ts +1 -0
- package/@wix/wix-data-schema-types/lib/capabilities.d.ts +18 -0
- package/@wix/wix-data-schema-types/lib/capabilities.js +3 -0
- package/@wix/wix-data-schema-types/lib/capabilities.js.map +1 -0
- package/@wix/wix-data-schema-types/lib/defaultMaxPageSize.d.ts +4 -0
- package/@wix/wix-data-schema-types/lib/defaultMaxPageSize.js +9 -0
- package/@wix/wix-data-schema-types/lib/defaultMaxPageSize.js.map +1 -0
- package/@wix/wix-data-schema-types/lib/field.d.ts +350 -0
- package/@wix/wix-data-schema-types/lib/field.js +173 -0
- package/@wix/wix-data-schema-types/lib/field.js.map +1 -0
- package/@wix/wix-data-schema-types/lib/fieldPlugins.d.ts +23 -0
- package/@wix/wix-data-schema-types/lib/fieldPlugins.js +8 -0
- package/@wix/wix-data-schema-types/lib/fieldPlugins.js.map +1 -0
- package/@wix/wix-data-schema-types/lib/filter.d.ts +261 -0
- package/@wix/wix-data-schema-types/lib/filter.js +41 -0
- package/@wix/wix-data-schema-types/lib/filter.js.map +1 -0
- package/@wix/wix-data-schema-types/lib/index.d.ts +9 -0
- package/@wix/wix-data-schema-types/lib/index.js +26 -0
- package/@wix/wix-data-schema-types/lib/index.js.map +1 -0
- package/@wix/wix-data-schema-types/lib/order.d.ts +24 -0
- package/@wix/wix-data-schema-types/lib/order.js +9 -0
- package/@wix/wix-data-schema-types/lib/order.js.map +1 -0
- package/@wix/wix-data-schema-types/lib/pagingMode.d.ts +4 -0
- package/@wix/wix-data-schema-types/lib/pagingMode.js +9 -0
- package/@wix/wix-data-schema-types/lib/pagingMode.js.map +1 -0
- package/@wix/wix-data-schema-types/lib/plugins.d.ts +76 -0
- package/@wix/wix-data-schema-types/lib/plugins.js +27 -0
- package/@wix/wix-data-schema-types/lib/plugins.js.map +1 -0
- package/@wix/wix-data-schema-types/lib/schema.d.ts +202 -0
- package/@wix/wix-data-schema-types/lib/schema.js +106 -0
- package/@wix/wix-data-schema-types/lib/schema.js.map +1 -0
- package/@wix/wix-data-schema-types/package.json +45 -0
- package/@wix/wix-data-schema-types/src/capabilities.ts +19 -0
- package/@wix/wix-data-schema-types/src/defaultMaxPageSize.ts +6 -0
- package/@wix/wix-data-schema-types/src/field.ts +355 -0
- package/@wix/wix-data-schema-types/src/fieldPlugins.ts +28 -0
- package/@wix/wix-data-schema-types/src/filter.ts +280 -0
- package/@wix/wix-data-schema-types/src/index.ts +9 -0
- package/@wix/wix-data-schema-types/src/order.ts +26 -0
- package/@wix/wix-data-schema-types/src/pagingMode.ts +4 -0
- package/@wix/wix-data-schema-types/src/plugins.ts +97 -0
- package/@wix/wix-data-schema-types/src/schema.ts +222 -0
- package/@wix/wix-data-schema-types/tsconfig.json +18 -0
- package/@wix/wix-data-schema-types/tslint.json +3 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { FieldPlugins } from './fieldPlugins'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @interface FieldSpec
|
|
5
|
+
* @member displayName {string} - Defines UI-friendly name of a field. This name is used in Content Manager
|
|
6
|
+
* header and when binding to the field in Data Binding.
|
|
7
|
+
* @member type {FieldType} - Defines field data type.
|
|
8
|
+
* @member systemField {boolean} - Defines field is system or user created field.
|
|
9
|
+
* @member queryOperators {Array<AllowedFilterOperator>} - Denotes which filter operators can be used on field. This limits
|
|
10
|
+
* the filters that are available in Content Manager and Dataset. Wix Data, however, will not validate filters
|
|
11
|
+
* passed by user from code. Undefined implies default type operators are supported, empty array - no filters
|
|
12
|
+
* are supported on the field.
|
|
13
|
+
* @member sortable {boolean} - Defines the field is sortable or not. Similarly to queryOperators, impacts
|
|
14
|
+
* Content Manager and Data Binding.
|
|
15
|
+
* @member isDeleted {boolean} - Deleted fields are hidden from data results, also excluded from sorts
|
|
16
|
+
* and filters.
|
|
17
|
+
* @member index {number} - Defines field order in cases where fields are ordered, e.g., Content Manager.
|
|
18
|
+
* @member pii {boolean} - Indicates that field contains PII data and should be encrypted.
|
|
19
|
+
* @member calculator {Calculator} - Defines how virtual data should be generated.
|
|
20
|
+
* @member linkedRouterPage {string} - Defines reference to router pattern in the site document
|
|
21
|
+
* @member minValue {number} - Min possible value for the field.
|
|
22
|
+
* @member maxValue {number} - Max possible value for the field.
|
|
23
|
+
* @member minStrLength {number} - Min length for the string field.
|
|
24
|
+
* @member maxStrLength {number} - Max length for the string field.
|
|
25
|
+
* @member minArraySize {number} - Min size for the repeated field.
|
|
26
|
+
* @member maxArraySize {number} - Max size for the repeated field.
|
|
27
|
+
* @member readOnly {boolean} - Indicates that the field cannot be set by the client. E.g. Id field assigned by the server.
|
|
28
|
+
* @member immutable {boolean} - Indicates that the field can be set by the client, but can never be changed or updated.
|
|
29
|
+
* @member required {boolean} - Indicates that the field is required.
|
|
30
|
+
*/
|
|
31
|
+
export type FieldSpec = {
|
|
32
|
+
displayName: string
|
|
33
|
+
type: FieldType
|
|
34
|
+
systemField: boolean
|
|
35
|
+
queryOperators?: AllowedFilterOperator[]
|
|
36
|
+
sortable?: boolean
|
|
37
|
+
isDeleted?: boolean
|
|
38
|
+
index?: number
|
|
39
|
+
pii?: boolean
|
|
40
|
+
calculator?: Calculator
|
|
41
|
+
linkedRouterPage?: string
|
|
42
|
+
description?: string
|
|
43
|
+
minValue?: number
|
|
44
|
+
maxValue?: number
|
|
45
|
+
minStrLength?: number
|
|
46
|
+
maxStrLength?: number
|
|
47
|
+
minArraySize?: number
|
|
48
|
+
maxArraySize?: number
|
|
49
|
+
readOnly?: boolean
|
|
50
|
+
immutable?: boolean
|
|
51
|
+
required?: boolean
|
|
52
|
+
plugin?: string
|
|
53
|
+
plugins?: FieldPlugins
|
|
54
|
+
pageLinkType?: PageLinkType
|
|
55
|
+
condition?: Condition
|
|
56
|
+
} & ValidFieldTypes
|
|
57
|
+
|
|
58
|
+
export type NestedFieldSpec = {
|
|
59
|
+
type: FieldType
|
|
60
|
+
displayName?: string
|
|
61
|
+
queryOperators?: AllowedFilterOperator[]
|
|
62
|
+
sortable?: boolean
|
|
63
|
+
} & ValidNestedFieldTypes
|
|
64
|
+
|
|
65
|
+
export type ValidFieldTypes = ReferenceField | MultiReferenceField | ValidNestedFieldTypes | SlugField
|
|
66
|
+
|
|
67
|
+
export type ValidNestedFieldTypes = TextField | NumberField | DateTimeField | DateField | ImageField | BoolField | DocumentField | UrlField | EmailField |
|
|
68
|
+
RichTextField | VideoField | PageLinkField | MediaGalleryField | AddressField | AnyField | ArrayStringField | ArrayDocumentField |
|
|
69
|
+
AudioField | TimeField | LanguageField | RichContentField | ColorField | ArrayField | ObjectField
|
|
70
|
+
|
|
71
|
+
export interface Calculator {
|
|
72
|
+
config: {
|
|
73
|
+
pattern: string,
|
|
74
|
+
lowercase: boolean
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export enum FieldType {
|
|
79
|
+
/**
|
|
80
|
+
* JSON Number (Ex. 2 or 26.7)
|
|
81
|
+
*/
|
|
82
|
+
number = 'number',
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* JSON String
|
|
86
|
+
*/
|
|
87
|
+
text = 'text',
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Wix Media or HTTP(S) url to an image,
|
|
91
|
+
* image://...
|
|
92
|
+
*/
|
|
93
|
+
image = 'image',
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* JSON Boolean (true, false)
|
|
97
|
+
*/
|
|
98
|
+
boolean = 'boolean',
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Wix Media link to a document, in form wix:media://...
|
|
102
|
+
*/
|
|
103
|
+
document = 'document',
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* HTTP(S) URL as a JSON String
|
|
107
|
+
*/
|
|
108
|
+
url = 'url',
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Email address as a JSON String
|
|
112
|
+
*/
|
|
113
|
+
email = 'email',
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* HTML String with tags allowed in Wix RichText.
|
|
117
|
+
*/
|
|
118
|
+
richText = 'richtext',
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Date type represented as an object with $date attribute
|
|
122
|
+
* holding ISO 8601 string with UTC date.
|
|
123
|
+
*
|
|
124
|
+
* Example: { $date: '2018-04-01T00:00:00Z' }
|
|
125
|
+
*
|
|
126
|
+
* This will get transformed to JavaScript Date on the client side.
|
|
127
|
+
* It is similar to 'dateTime', except for the time part:
|
|
128
|
+
* time always is 00:00:00Z
|
|
129
|
+
*/
|
|
130
|
+
date = 'date',
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Date time type represented as an object with $date attribute
|
|
134
|
+
* holding ISO 8601 string with UTC date.
|
|
135
|
+
*
|
|
136
|
+
* Example: { $date: '2018-04-01T00:00:00Z' }
|
|
137
|
+
*
|
|
138
|
+
* This will get transformed to JavaScript Date on the client side.
|
|
139
|
+
*/
|
|
140
|
+
dateTime = 'datetime',
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Wix Media link to video
|
|
144
|
+
*/
|
|
145
|
+
video = 'video',
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* String ID to referenced item.
|
|
149
|
+
*
|
|
150
|
+
* If specified in a collection together with referencedCollectionName,
|
|
151
|
+
* Wix Data will handle the includes by making additional request to
|
|
152
|
+
* included collection using hasSome filter and passing down ids of the
|
|
153
|
+
* items to be included.
|
|
154
|
+
*/
|
|
155
|
+
reference = 'reference',
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Multi-reference fields are not yet directly supported in DB Drivers.
|
|
159
|
+
* Consult Wix Data team before trying to use it.
|
|
160
|
+
*/
|
|
161
|
+
multiReference = 'multi-reference',
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Relative URL to a page in a site.
|
|
165
|
+
*/
|
|
166
|
+
pageLink = 'pagelink',
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* JSON Object as plain JSON.
|
|
170
|
+
*/
|
|
171
|
+
object = 'object',
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Gallery type for binding to Pro Gallery components.
|
|
175
|
+
*/
|
|
176
|
+
mediaGallery = 'media-gallery',
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Address type.
|
|
180
|
+
* See https://docs.google.com/document/d/1pwZKxnBBxR1mBnJGiS6M6qSdjKd1YDJ2OAM4nHJjFS8/edit#heading=h.5ndfgx3b0knm
|
|
181
|
+
*
|
|
182
|
+
* Items should at very least contain 'formatted' property.
|
|
183
|
+
*/
|
|
184
|
+
address = 'address',
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Array of strings type.
|
|
188
|
+
*/
|
|
189
|
+
stringArray = 'array<string>',
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* JSON Color Hex String
|
|
193
|
+
*/
|
|
194
|
+
color = 'color',
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Wix Media link to audio
|
|
198
|
+
*/
|
|
199
|
+
audio = 'audio',
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* JSON String holding time in a following format: '00:00:00'
|
|
203
|
+
*/
|
|
204
|
+
time = 'time',
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Array
|
|
208
|
+
*/
|
|
209
|
+
array = 'array',
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* RichContent type for binding to RichContentEditor/RichContentViewer components
|
|
213
|
+
* based on Ricos https://github.com/wix-incubator/rich-content
|
|
214
|
+
*/
|
|
215
|
+
richContent = 'rich-content',
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Text string holding language name in which row content is translated. Complies with BCP47 standard: https://tools.ietf.org/html/bcp47#appendix-A
|
|
219
|
+
*/
|
|
220
|
+
language = 'language',
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Array of documents, see {@link FieldType.document}
|
|
224
|
+
*/
|
|
225
|
+
documentArray = 'array<document>',
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Any JSON data type
|
|
229
|
+
*/
|
|
230
|
+
any = 'any',
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Slug type used for dynamic page URLs.
|
|
234
|
+
*/
|
|
235
|
+
slug = 'slug',
|
|
236
|
+
|
|
237
|
+
legacyBook = 'bookType',
|
|
238
|
+
|
|
239
|
+
legacyExternalUrl = 'externalUrl',
|
|
240
|
+
|
|
241
|
+
legacyBrokenRef = 'broken-reference',
|
|
242
|
+
|
|
243
|
+
legacyExternalVideo = 'externalVideo',
|
|
244
|
+
|
|
245
|
+
legacyImage = 'Image'
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export type TextField = { type: FieldType.text }
|
|
249
|
+
export type NumberField = { type: FieldType.number }
|
|
250
|
+
export type DateTimeField = { type: FieldType.dateTime }
|
|
251
|
+
export type DateField = { type: FieldType.date }
|
|
252
|
+
export type ImageField = { type: FieldType.image }
|
|
253
|
+
export type BoolField = { type: FieldType.boolean }
|
|
254
|
+
export type DocumentField = { type: FieldType.document }
|
|
255
|
+
export type UrlField = { type: FieldType.url }
|
|
256
|
+
export type EmailField = { type: FieldType.email }
|
|
257
|
+
export type RichTextField = { type: FieldType.richText }
|
|
258
|
+
export type VideoField = { type: FieldType.video }
|
|
259
|
+
export type PageLinkField = { type: FieldType.pageLink }
|
|
260
|
+
export type MediaGalleryField = { type: FieldType.mediaGallery }
|
|
261
|
+
export type AddressField = { type: FieldType.address }
|
|
262
|
+
export type AnyField = { type: FieldType.any }
|
|
263
|
+
export type ArrayStringField = { type: FieldType.stringArray }
|
|
264
|
+
export type ArrayDocumentField = { type: FieldType.documentArray }
|
|
265
|
+
export type AudioField = { type: FieldType.audio }
|
|
266
|
+
export type TimeField = { type: FieldType.time }
|
|
267
|
+
export type LanguageField = { type: FieldType.language }
|
|
268
|
+
export type RichContentField = { type: FieldType.richContent }
|
|
269
|
+
export type ColorField = { type: FieldType.color }
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @member referencedCollection {string} - Denotes referenced collection name.
|
|
273
|
+
*/
|
|
274
|
+
export type ReferenceField = {
|
|
275
|
+
type: FieldType.reference
|
|
276
|
+
referencedCollection: string
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* @member referencedCollection {string} - Denotes referenced collection name.
|
|
281
|
+
* @member referencingFieldKey {string} - Denotes the field key to represent current collection items
|
|
282
|
+
* in referenced collection.
|
|
283
|
+
* @member referencingDisplayName {string} - Defines UI-friendly name for field that represents current
|
|
284
|
+
* collection items in referenced collection. This name is used in Content Manager header and when
|
|
285
|
+
* binding to the field in Data Binding.
|
|
286
|
+
*/
|
|
287
|
+
export type MultiReferenceField = {
|
|
288
|
+
type: FieldType.multiReference
|
|
289
|
+
referencedCollection: string
|
|
290
|
+
referencingFieldKey: string
|
|
291
|
+
referencingDisplayName?: string
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* @member elementType {NestedFieldSpec} - Denotes type of elements in array.
|
|
296
|
+
*/
|
|
297
|
+
export type ArrayField = {
|
|
298
|
+
type: FieldType.array,
|
|
299
|
+
elementType?: ValidNestedFieldTypes
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* @member elementType { [fieldName: string]: NestedFieldSpec } - Denotes structure of the the object.
|
|
304
|
+
*/
|
|
305
|
+
export type ObjectField = {
|
|
306
|
+
type: FieldType.object,
|
|
307
|
+
fields?: { [fieldName: string]: NestedFieldSpec }
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* @member pattern {string} - Denotes pattern for generating slug values.
|
|
312
|
+
*/
|
|
313
|
+
export type SlugField = {
|
|
314
|
+
type: FieldType.slug,
|
|
315
|
+
pattern: string
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export enum AllowedFilterOperator {
|
|
319
|
+
eq = 'eq',
|
|
320
|
+
ne = 'ne',
|
|
321
|
+
lt = 'lt',
|
|
322
|
+
lte = 'lte',
|
|
323
|
+
gt = 'gt',
|
|
324
|
+
gte = 'gte',
|
|
325
|
+
hasSome = 'hasSome',
|
|
326
|
+
hasAll = 'hasAll',
|
|
327
|
+
contains = 'contains',
|
|
328
|
+
startsWith = 'startsWith',
|
|
329
|
+
endsWith = 'endsWith',
|
|
330
|
+
urlized = 'urlized',
|
|
331
|
+
exists = 'exists'
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export enum PageLinkType {
|
|
335
|
+
COLLECTION_DEFINED = 'COLLECTION_DEFINED',
|
|
336
|
+
ROUTER_DEFINED = 'ROUTER_DEFINED'
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export enum FieldPermission {
|
|
340
|
+
/** No special permissions required to read the field (visitors) */
|
|
341
|
+
ANYONE,
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Special permissions required to read the field (members, contributors, etc.)
|
|
345
|
+
*/
|
|
346
|
+
RESTRICTED,
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export type Condition = {
|
|
350
|
+
/** Conditional (requested) field enum value */
|
|
351
|
+
groupName?: string
|
|
352
|
+
|
|
353
|
+
/** Who can read the field? */
|
|
354
|
+
permission: FieldPermission
|
|
355
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
export const CMS_FIELD_PLUGIN_ID = 'cms'
|
|
3
|
+
export interface CmsFieldPlugin {
|
|
4
|
+
// marks CMS-internal field, that should not be displayed anywhere
|
|
5
|
+
internal: boolean
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const CATEGORY_FIELD_PLUGIN_ID = 'categoryField'
|
|
9
|
+
export interface CategoryFieldPlugin {
|
|
10
|
+
isPrimary: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const PRIMARY_CATEGORY_FIELD_PLUGIN_ID = 'primaryCategoryField'
|
|
14
|
+
export interface PrimaryCategoryFieldPlugin {}
|
|
15
|
+
|
|
16
|
+
export const CATEGORY_CONSUMER_FIELD_PLUGIN_ID = 'categoryConsumer'
|
|
17
|
+
export interface CategoryConsumerFieldPlugin {}
|
|
18
|
+
|
|
19
|
+
export interface KnownFieldPlugins {
|
|
20
|
+
[CMS_FIELD_PLUGIN_ID]?: CmsFieldPlugin
|
|
21
|
+
[CATEGORY_FIELD_PLUGIN_ID]?: CategoryFieldPlugin
|
|
22
|
+
[PRIMARY_CATEGORY_FIELD_PLUGIN_ID]?: PrimaryCategoryFieldPlugin
|
|
23
|
+
[CATEGORY_CONSUMER_FIELD_PLUGIN_ID]?: CategoryConsumerFieldPlugin
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type FieldPlugins = KnownFieldPlugins & Record<string, object>
|
|
27
|
+
export type FieldPluginId = keyof KnownFieldPlugins
|
|
28
|
+
export type FieldPlugin = Required<KnownFieldPlugins>[FieldPluginId]
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @type Filter
|
|
3
|
+
* @description Filter is a single condition filter or a combination of conditions through And or Or filters.
|
|
4
|
+
*/
|
|
5
|
+
export type Filter = And | Or | Not | Eq | Ne | Lt | Lte | Gt | Gte |
|
|
6
|
+
HasSome | HasAll | Contains | StartsWith | EndsWith | Urlized
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @enum Operator
|
|
10
|
+
* @description Provides values for filter operator.
|
|
11
|
+
* @member and to combine multiple filters with an and.
|
|
12
|
+
* @member or to combine multiple filters with an or.
|
|
13
|
+
* @member not to add filter witch has to be not matched.
|
|
14
|
+
* @member eq to add `equality` condition to filter.
|
|
15
|
+
* @member ne to add `not equal` condition to filter.
|
|
16
|
+
* @member lt to add `les than` condition to filter.
|
|
17
|
+
* @member lte to add `tess than or equal` condition to filter.
|
|
18
|
+
* @member gt to add `greater than` condition to filter.
|
|
19
|
+
* @member gte to add `greater than or equal` condition to filter.
|
|
20
|
+
* @member hasSome to add `has some values of provided` condition to filter.
|
|
21
|
+
* @member hasAll to add `has all values of provided` condition to filter.
|
|
22
|
+
* @member contains to add `field value contains provided value` condition to filter.
|
|
23
|
+
* @member startsWith to add `field value starts with provided value` condition to filter.
|
|
24
|
+
* @member endsWith to add `ends with provided value` condition to filter.
|
|
25
|
+
* @member urlized to add `urlized provided value` condition to filter.
|
|
26
|
+
*/
|
|
27
|
+
export enum Operator {
|
|
28
|
+
and = '$and',
|
|
29
|
+
or = '$or',
|
|
30
|
+
not = '$not',
|
|
31
|
+
eq = '$eq',
|
|
32
|
+
ne = '$ne',
|
|
33
|
+
lt = '$lt',
|
|
34
|
+
lte = '$lte',
|
|
35
|
+
gt = '$gt',
|
|
36
|
+
gte = '$gte',
|
|
37
|
+
hasSome = '$hasSome',
|
|
38
|
+
hasAll = '$hasAll',
|
|
39
|
+
contains = '$contains',
|
|
40
|
+
startsWith = '$startsWith',
|
|
41
|
+
endsWith = '$endsWith',
|
|
42
|
+
urlized = '$urlized'
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @type Literal
|
|
47
|
+
* @description Describes types used in some of filters
|
|
48
|
+
*/
|
|
49
|
+
export type Literal = string | number | Date | null
|
|
50
|
+
|
|
51
|
+
export interface FilterInterface {
|
|
52
|
+
kind: 'filter'
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @interface And
|
|
57
|
+
* @member operator - `and` operator.
|
|
58
|
+
* @member value - `Array` of `Filter`.
|
|
59
|
+
* @description A filter with an `and` returns all the items that match all filters in `and` filter array.
|
|
60
|
+
* @example Filter where `someField` is between 6 and 12
|
|
61
|
+
* const andFilter: And = {
|
|
62
|
+
* operator: Operator.and,
|
|
63
|
+
* value: [
|
|
64
|
+
* {operator: Operator.gt, fieldName: 'someField', value:6},
|
|
65
|
+
* {operator: Operator.lt, fieldName: 'someField', value:12}
|
|
66
|
+
* ]
|
|
67
|
+
* }
|
|
68
|
+
*/
|
|
69
|
+
export interface And extends FilterInterface {
|
|
70
|
+
operator: Operator.and
|
|
71
|
+
value: Filter[]
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @interface Or
|
|
76
|
+
* @member operator - `or` operator
|
|
77
|
+
* @member value - `Array` of `Filter`.
|
|
78
|
+
* @description A filter with an `or` returns all the items that match at least one filter in `or` filter array.
|
|
79
|
+
* @example Filter where `someField` equals "hi" or "bye"
|
|
80
|
+
* const orFilter: Or = {
|
|
81
|
+
* operator: Operator.or,
|
|
82
|
+
* value: [
|
|
83
|
+
* {operator: Operator.eq, fieldName: 'someField', value:'hi'},
|
|
84
|
+
* {operator: Operator.eq, fieldName: 'someField', value:'bye'}
|
|
85
|
+
* ]
|
|
86
|
+
* }
|
|
87
|
+
*/
|
|
88
|
+
export interface Or extends FilterInterface {
|
|
89
|
+
operator: Operator.or
|
|
90
|
+
value: Filter[]
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @interface Not
|
|
95
|
+
* @member operator - `not` operator.
|
|
96
|
+
* @member value - `Filter`.
|
|
97
|
+
* @description A query with a `not` returns all the items that match the filter as defined up to the `not`
|
|
98
|
+
* operator, but don't match the filter under the `not` operator.
|
|
99
|
+
* @example Filter where `someField` not equals "hi"
|
|
100
|
+
* const notFilter: Not = {
|
|
101
|
+
* operator: Operator.not,
|
|
102
|
+
* value: {operator: Operator.eq, fieldName: 'someField', value: 'hi'}
|
|
103
|
+
* }
|
|
104
|
+
*/
|
|
105
|
+
export interface Not extends FilterInterface {
|
|
106
|
+
operator: Operator.not
|
|
107
|
+
value: Filter
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @interface Eq
|
|
112
|
+
* @member operator - `eq`
|
|
113
|
+
* @member fieldName - field witch has to be equal to `value`
|
|
114
|
+
* @member value - value to match a field value. Value can be any type.
|
|
115
|
+
* @example Filter where `someField` equals "hi"
|
|
116
|
+
* const eq: Eq = {operator: Operator.eq, fieldName: 'someField', value: 'hi'}
|
|
117
|
+
*/
|
|
118
|
+
export interface Eq extends FilterInterface {
|
|
119
|
+
operator: Operator.eq
|
|
120
|
+
fieldName: string
|
|
121
|
+
value: any
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @interface Ne
|
|
126
|
+
* @member operator - `ne` not equal
|
|
127
|
+
* @member fieldName - field witch has to be not equal to `value`
|
|
128
|
+
* @member value - value to not match a field value. Value can be any type.
|
|
129
|
+
* @example Filter where `someField` not equals "hi"
|
|
130
|
+
* const ne: Ne = {operator: Operator.ne, fieldName: 'someField', value: 'hi'}
|
|
131
|
+
*/
|
|
132
|
+
export interface Ne extends FilterInterface {
|
|
133
|
+
operator: Operator.ne
|
|
134
|
+
fieldName: string
|
|
135
|
+
value: any
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @interface Lt
|
|
140
|
+
* @member operator - `lt` less than
|
|
141
|
+
* @member fieldName - field witch has to be less than to `value`
|
|
142
|
+
* @member value - value compare field value to.
|
|
143
|
+
* @example Filter where `someField` is less than 6
|
|
144
|
+
* const lt: Lt = {operator: Operator.lt, fieldName: 'someField', value: 6}
|
|
145
|
+
*/
|
|
146
|
+
export interface Lt extends FilterInterface {
|
|
147
|
+
operator: Operator.lt
|
|
148
|
+
fieldName: string
|
|
149
|
+
value: Literal
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @interface Lte
|
|
154
|
+
* @member operator - `lte` less than or equal
|
|
155
|
+
* @member fieldName - field witch has to be less than or equal to `value`
|
|
156
|
+
* @member value - value compare field value to.
|
|
157
|
+
* @example Filter where `someField` is less than or equal to 6
|
|
158
|
+
* const lte: Lte = {operator: Operator.lte, fieldName: 'someField', value: 6}
|
|
159
|
+
*/
|
|
160
|
+
export interface Lte extends FilterInterface {
|
|
161
|
+
operator: Operator.lte
|
|
162
|
+
fieldName: string
|
|
163
|
+
value: Literal
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @interface Gt
|
|
168
|
+
* @member operator - `gt` greater than
|
|
169
|
+
* @member fieldName - field witch has to be greater than to `value`
|
|
170
|
+
* @member value - value compare field value to.
|
|
171
|
+
* @example Filter where `someField` is greater than 6
|
|
172
|
+
* const gt: Gt = {operator: Operator.gt, fieldName: 'someField', value: 6}
|
|
173
|
+
*/
|
|
174
|
+
export interface Gt extends FilterInterface {
|
|
175
|
+
operator: Operator.gt
|
|
176
|
+
fieldName: string
|
|
177
|
+
value: Literal
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @interface Gte
|
|
182
|
+
* @member operator - `gte` greater than or equal
|
|
183
|
+
* @member fieldName - field witch has to be greater than or equal to `value`
|
|
184
|
+
* @member value - value compare field value to.
|
|
185
|
+
* @example Filter where `someField` is greater than or equal to 6
|
|
186
|
+
* const gte: Gte = {operator: Operator.gte, fieldName: 'someField', value: 6}
|
|
187
|
+
*/
|
|
188
|
+
export interface Gte extends FilterInterface {
|
|
189
|
+
operator: Operator.gte
|
|
190
|
+
fieldName: string
|
|
191
|
+
value: Literal
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @interface StartsWith
|
|
196
|
+
* @member operator - `startsWith` starts with
|
|
197
|
+
* @member fieldName - field witch has to start with `value`
|
|
198
|
+
* @member value - value compare field value to.
|
|
199
|
+
* @example Filter where `someField` starts with "hel"
|
|
200
|
+
* const startsWith: StartsWith = {operator: Operator.startsWith, fieldName: 'someField', value: 'hel'}
|
|
201
|
+
*/
|
|
202
|
+
export interface StartsWith extends FilterInterface {
|
|
203
|
+
operator: Operator.startsWith
|
|
204
|
+
fieldName: string
|
|
205
|
+
value: string
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @interface EndsWith
|
|
210
|
+
* @member operator - `endsWith` starts with
|
|
211
|
+
* @member fieldName - field witch has to end with `value`
|
|
212
|
+
* @member value - value compare field value to.
|
|
213
|
+
* @example Filter where `someField` ends with "lo"
|
|
214
|
+
* const endsWith: EndsWith = {operator: Operator.endsWith, fieldName: 'someField', value: 'lo'}
|
|
215
|
+
*/
|
|
216
|
+
export interface EndsWith extends FilterInterface {
|
|
217
|
+
operator: Operator.endsWith
|
|
218
|
+
fieldName: string
|
|
219
|
+
value: string
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* @interface Urlized
|
|
224
|
+
* Tokens should be joined using `-` or ` `. I.e. value ["hello", "world"] matches "hello world" and "hello-world".
|
|
225
|
+
* @member operator - `urlized`
|
|
226
|
+
* @member ignoreCase - case sensative or not
|
|
227
|
+
* @member fieldName - field witch has to match urlized `value`
|
|
228
|
+
* @member value - array of tokens
|
|
229
|
+
* @example Filter where `someField` matches ["hello", "world"]
|
|
230
|
+
* const matches: Matches = {operator: Operator.matches,
|
|
231
|
+
* ignoreCase: true, fieldName: 'someField', value: ['hello', 'world']}
|
|
232
|
+
*/
|
|
233
|
+
export interface Urlized extends FilterInterface {
|
|
234
|
+
operator: Operator.urlized
|
|
235
|
+
ignoreCase: boolean
|
|
236
|
+
fieldName: string
|
|
237
|
+
value: string[]
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @interface Contains
|
|
242
|
+
* @member operator - `contains`
|
|
243
|
+
* @member fieldName - field witch has to contain `value`
|
|
244
|
+
* @member value - value compare field value to.
|
|
245
|
+
* @example Filter where `someField` contains "ell"
|
|
246
|
+
* const contains: Contains = {operator: Operator.contains, fieldName: 'someField', value: 'ell'}
|
|
247
|
+
*/
|
|
248
|
+
export interface Contains extends FilterInterface {
|
|
249
|
+
operator: Operator.contains
|
|
250
|
+
fieldName: string
|
|
251
|
+
value: string
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* @interface HasSome
|
|
256
|
+
* @member operator - `hasSome`
|
|
257
|
+
* @member fieldName - field witch has to contain some of the values.
|
|
258
|
+
* @member value - values compare field values to.
|
|
259
|
+
* @example Filter where `someField` contains at least one of [1,2,3]
|
|
260
|
+
* const hasSome: HasSome = {operator: Operator.hasSome, fieldName: 'someField', value: [1,2,3]}
|
|
261
|
+
*/
|
|
262
|
+
export interface HasSome extends FilterInterface {
|
|
263
|
+
operator: Operator.hasSome
|
|
264
|
+
fieldName: string
|
|
265
|
+
value: Literal[]
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* @interface HasAll
|
|
270
|
+
* @member operator - `hasAll`
|
|
271
|
+
* @member fieldName - field witch has to contain all of the values.
|
|
272
|
+
* @member value - values compare field values to.
|
|
273
|
+
* @example Filter where `someField` contains all of [1,2,3]
|
|
274
|
+
* const hasAll: HasAll = {operator: Operator.hasAll, fieldName: 'someField', value: [1,2,3]}
|
|
275
|
+
*/
|
|
276
|
+
export interface HasAll extends FilterInterface {
|
|
277
|
+
operator: Operator.hasAll
|
|
278
|
+
fieldName: string
|
|
279
|
+
value: Literal[]
|
|
280
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './order'
|
|
2
|
+
export * from './filter'
|
|
3
|
+
export * from './field'
|
|
4
|
+
export * from './schema'
|
|
5
|
+
export * from './pagingMode'
|
|
6
|
+
export * from './plugins'
|
|
7
|
+
export * from './defaultMaxPageSize'
|
|
8
|
+
export * from './fieldPlugins'
|
|
9
|
+
export * from './capabilities'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @type OrderBy
|
|
3
|
+
* @description Describes and order with a list of order specifications
|
|
4
|
+
* @example `someField` ordered ascending, `otherField` ordered descending
|
|
5
|
+
* const orderBy: OrderBy = [
|
|
6
|
+
* {fieldName: 'someField', direction: Direction.asc},
|
|
7
|
+
* {fieldName: 'otherField', direction: Direction.desc}
|
|
8
|
+
* ]
|
|
9
|
+
*/
|
|
10
|
+
export type OrderBy = OrderSpec[]
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @interface OrderSpec
|
|
14
|
+
* @description Order specification for single field.
|
|
15
|
+
* @example `someField` ordered ascending
|
|
16
|
+
* const ascOrder: OrderSpec = {fieldName: 'someField', direction: Direction.asc}
|
|
17
|
+
*/
|
|
18
|
+
export interface OrderSpec {
|
|
19
|
+
fieldName: string
|
|
20
|
+
direction: Direction
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export enum Direction {
|
|
24
|
+
asc = 'asc',
|
|
25
|
+
desc = 'desc'
|
|
26
|
+
}
|