@enonic-types/lib-schema 8.0.0-B2 → 8.0.0-B5

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/schema.d.ts +43 -29
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enonic-types/lib-schema",
3
- "version": "8.0.0-B2",
3
+ "version": "8.0.0-B5",
4
4
  "description": "Type definitions for lib-schema.",
5
5
  "types": "schema.d.ts",
6
6
  "files": [
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/enonic/xp/tree/master#readme",
29
29
  "dependencies": {
30
- "@enonic-types/core": "8.0.0-B2"
30
+ "@enonic-types/core": "8.0.0-B5"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
package/schema.d.ts CHANGED
@@ -11,19 +11,19 @@ declare global {
11
11
  '/lib/xp/schema': typeof import('./schema');
12
12
  }
13
13
  }
14
- import type { ByteSource, FormItem, UserKey, ConfigValue } from '@enonic-types/core';
14
+ import type { ByteSource, ConfigObject, ConfigValue, FormItem, UserKey } from '@enonic-types/core';
15
15
  export type { ByteSource, FormItem, FormItemFormFragment, FormItemInput, FormItemLayout, FormItemOptionSet, FormItemSet, GroupKey, InputType, PrincipalKey, RoleKey, UserKey, ValueType, ConfigValue, } from '@enonic-types/core';
16
16
  export interface Icon {
17
17
  data: ByteSource;
18
18
  mimeType: string;
19
19
  modifiedTime: string;
20
20
  }
21
+ export type ContentSchemaType = 'CONTENT_TYPE' | 'FORM_FRAGMENT' | 'MIXIN';
21
22
  export interface CreateDynamicContentSchemaParams {
22
23
  name: string;
23
- type: string;
24
- resource?: string | null;
24
+ type: ContentSchemaType;
25
+ resource: string;
25
26
  }
26
- export type ContentSchemaType = 'CONTENT_TYPE' | 'FORM_FRAGMENT' | 'MIXIN';
27
27
  export interface Schema {
28
28
  name: string;
29
29
  title: string;
@@ -39,6 +39,15 @@ export interface Schema {
39
39
  icon?: Icon;
40
40
  }
41
41
  export interface ContentTypeSchema extends Schema {
42
+ superType?: string | null;
43
+ abstract?: boolean;
44
+ final?: boolean;
45
+ allowChildContent?: boolean;
46
+ allowChildContentType?: string[];
47
+ displayNamePlaceholder?: string | null;
48
+ displayNamePlaceholderI18nKey?: string | null;
49
+ displayNameExpression?: string | null;
50
+ displayNameListExpression?: string | null;
42
51
  form: FormItem[];
43
52
  config: Record<string, ConfigValue>;
44
53
  mixinNames?: string[];
@@ -56,7 +65,7 @@ export interface MixinSchema extends Schema {
56
65
  * @param {object} params JSON with the parameters.
57
66
  * @param {string} params.name Schema resource name.
58
67
  * @param {string} params.type Schema type.
59
- * @param {string} [params.resource] Schema resource value.
68
+ * @param {string} params.resource Schema resource value.
60
69
  *
61
70
  * @returns {ContentTypeSchema | FormFragmentSchema | MixinSchema} created resource.
62
71
  */
@@ -95,24 +104,29 @@ export interface PartDescriptor extends ComponentDescriptor {
95
104
  * @param {object} params JSON with the parameters.
96
105
  * @param {string} params.key Component resource descriptor key.
97
106
  * @param {string} params.type Component type.
98
- * @param {string} [params.resource] Component resource value.
107
+ * @param {string} params.resource Component resource value.
99
108
  *
100
- * @returns {string} created resource.
109
+ * @returns {LayoutDescriptor | PageDescriptor | PartDescriptor} created resource.
101
110
  */
102
111
  export declare function createComponent(params: CreateDynamicComponentParams): LayoutDescriptor | PageDescriptor | PartDescriptor;
103
112
  export interface CreateDynamicStylesParams {
104
113
  application: string;
105
114
  resource: string;
106
115
  }
116
+ export type EditorConfig = ConfigObject & {
117
+ css?: string;
118
+ };
107
119
  export interface StyleDescriptor {
108
120
  application: string;
109
- cssPath: string;
110
121
  modifiedTime: string;
111
122
  resource: string;
112
- elements?: {
113
- element: string;
114
- label: string;
123
+ elements: {
124
+ label: string | null;
115
125
  name: string;
126
+ type: string;
127
+ aspectRatio?: string | null;
128
+ filter?: string | null;
129
+ editor?: EditorConfig;
116
130
  }[];
117
131
  }
118
132
  /**
@@ -120,7 +134,7 @@ export interface StyleDescriptor {
120
134
  *
121
135
  * @param {object} params JSON with the parameters.
122
136
  * @param {string} params.application Application key.
123
- * @param {string} [params.resource] Styles resource value.
137
+ * @param {string} params.resource Styles resource value.
124
138
  *
125
139
  * @returns {StyleDescriptor} created resource.
126
140
  */
@@ -136,9 +150,9 @@ export interface GetDynamicContentSchemaParams {
136
150
  * @param {string} params.name Content schema resource name.
137
151
  * @param {string} params.type Content schema type.
138
152
  *
139
- * @returns {ContentTypeSchema | FormFragmentSchema | MixinSchema} fetched resource.
153
+ * @returns {ContentTypeSchema | FormFragmentSchema | MixinSchema | null} fetched resource, or `null` if not found.
140
154
  */
141
- export declare function getSchema(params: GetDynamicContentSchemaParams): ContentTypeSchema | FormFragmentSchema | MixinSchema;
155
+ export declare function getSchema(params: GetDynamicContentSchemaParams): ContentTypeSchema | FormFragmentSchema | MixinSchema | null;
142
156
  export interface GetDynamicComponentParams {
143
157
  key: string;
144
158
  type: ComponentDescriptorType;
@@ -150,9 +164,9 @@ export interface GetDynamicComponentParams {
150
164
  * @param {string} params.key Component resource descriptor key.
151
165
  * @param {string} params.type Component type.
152
166
  *
153
- * @returns {string} fetched resource.
167
+ * @returns {LayoutDescriptor | PageDescriptor | PartDescriptor} fetched resource.
154
168
  */
155
- export declare function getComponent(params: GetDynamicComponentParams): unknown;
169
+ export declare function getComponent(params: GetDynamicComponentParams): LayoutDescriptor | PageDescriptor | PartDescriptor;
156
170
  export interface SiteDescriptor {
157
171
  application: string;
158
172
  resource: string;
@@ -173,7 +187,7 @@ export interface GetDynamicSiteParams {
173
187
  * @param {object} params JSON with the parameters.
174
188
  * @param {string} params.application Application key.
175
189
  *
176
- * @returns {SiteDescriptor} fetched resource.
190
+ * @returns {SiteDescriptor | null} fetched resource, or `null` if not found.
177
191
  */
178
192
  export declare function getSite(params: GetDynamicSiteParams): SiteDescriptor | null;
179
193
  export interface GetDynamicStylesParams {
@@ -183,9 +197,9 @@ export interface GetDynamicStylesParams {
183
197
  * Fetches dynamic styles schema resource.
184
198
  *
185
199
  * @param {object} params JSON with the parameters.
186
- * @param {string} params.application application key.
200
+ * @param {string} params.application Application key.
187
201
  *
188
- * @returns {StyleDescriptor} fetched resource.
202
+ * @returns {StyleDescriptor | null} fetched resource, or `null` if not found.
189
203
  */
190
204
  export declare function getStyles(params: GetDynamicStylesParams): StyleDescriptor | null;
191
205
  export interface DeleteDynamicContentSchemaParams {
@@ -239,9 +253,9 @@ export interface UpdateDynamicContentSchemaParams {
239
253
  * @param {object} params JSON with the parameters.
240
254
  * @param {string} params.name Content schema resource name.
241
255
  * @param {string} params.type Content schema type.
242
- * @param {string} [params.resource] Schema resource value.
256
+ * @param {string} params.resource Schema resource value.
243
257
  *
244
- * @returns {ContentTypeSchema | FormFragmentSchema | MixinSchema} created resource.
258
+ * @returns {ContentTypeSchema | FormFragmentSchema | MixinSchema} updated resource.
245
259
  */
246
260
  export declare function updateSchema(params: UpdateDynamicContentSchemaParams): ContentTypeSchema | FormFragmentSchema | MixinSchema;
247
261
  export interface UpdateDynamicComponentParams {
@@ -255,9 +269,9 @@ export interface UpdateDynamicComponentParams {
255
269
  * @param {object} params JSON with the parameters.
256
270
  * @param {string} params.key Component resource descriptor key.
257
271
  * @param {string} params.type Component type.
258
- * @param {string} [params.resource] Component resource value.
272
+ * @param {string} params.resource Component resource value.
259
273
  *
260
- * @returns {LayoutDescriptor | PageDescriptor | PartDescriptor} created resource.
274
+ * @returns {LayoutDescriptor | PageDescriptor | PartDescriptor} updated resource.
261
275
  */
262
276
  export declare function updateComponent(params: UpdateDynamicComponentParams): LayoutDescriptor | PageDescriptor | PartDescriptor;
263
277
  export interface UpdateDynamicSiteParams {
@@ -269,9 +283,9 @@ export interface UpdateDynamicSiteParams {
269
283
  *
270
284
  * @param {object} params JSON with the parameters.
271
285
  * @param {string} params.application Application key.
272
- * @param {string} [params.resource] Site schema resource value.
286
+ * @param {string} params.resource Site schema resource value.
273
287
  *
274
- * @returns {string} created resource.
288
+ * @returns {SiteDescriptor} updated resource.
275
289
  */
276
290
  export declare function updateSite(params: UpdateDynamicSiteParams): SiteDescriptor;
277
291
  export interface UpdateDynamicStylesParams {
@@ -283,9 +297,9 @@ export interface UpdateDynamicStylesParams {
283
297
  *
284
298
  * @param {object} params JSON with the parameters.
285
299
  * @param {string} params.application Application key.
286
- * @param {string} [params.resource] Styles schema resource value.
300
+ * @param {string} params.resource Styles schema resource value.
287
301
  *
288
- * @returns {string} created resource.
302
+ * @returns {StyleDescriptor} updated resource.
289
303
  */
290
304
  export declare function updateStyles(params: UpdateDynamicStylesParams): StyleDescriptor;
291
305
  export interface ListDynamicComponentsParams {
@@ -313,6 +327,6 @@ export interface ListDynamicSchemasParams {
313
327
  * @param {string} params.application Application key.
314
328
  * @param {string} params.type Content schema type.
315
329
  *
316
- * @returns {ContentSchemaType[] | FormFragmentSchema[] | MixinSchema[]} fetched resources.
330
+ * @returns {ContentTypeSchema[] | FormFragmentSchema[] | MixinSchema[]} fetched resources.
317
331
  */
318
- export declare function listSchemas(params: ListDynamicSchemasParams): ContentSchemaType[] | FormFragmentSchema[] | MixinSchema[];
332
+ export declare function listSchemas(params: ListDynamicSchemasParams): ContentTypeSchema[] | FormFragmentSchema[] | MixinSchema[];