@crombolo/schema 0.33.1 → 0.35.2
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 +14 -0
- package/package.json +4 -4
- package/src/generate.ts +11 -2
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @crombolo/schema
|
|
2
|
+
|
|
3
|
+
**Internal to crombolo.** This package is published because
|
|
4
|
+
[`@crombolo/crombolo`](https://www.npmjs.com/package/@crombolo/crombolo)
|
|
5
|
+
depends on it, and its exports can change in any release, a patch included.
|
|
6
|
+
|
|
7
|
+
Import from `@crombolo/crombolo` instead:
|
|
8
|
+
|
|
9
|
+
- `@crombolo/crombolo` for a site: its config, its boot and its views.
|
|
10
|
+
- `@crombolo/crombolo/bundle` for a server bundle's author.
|
|
11
|
+
- `@crombolo/crombolo/host` for whoever runs sites.
|
|
12
|
+
|
|
13
|
+
Those three entry points carry the compatibility promise in
|
|
14
|
+
[`docs/api.md`](https://github.com/kineco-au/crombolo-cms/blob/main/docs/api.md).
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crombolo/schema",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Schema-as-code for crombolo: TOML document, media and member type definitions.",
|
|
3
|
+
"version": "0.35.2",
|
|
4
|
+
"description": "Internal to crombolo, with no compatibility promise: use @crombolo/crombolo. Schema-as-code for crombolo: TOML document, media and member type definitions.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Crombolo",
|
|
7
7
|
"homepage": "https://github.com/kineco-au/crombolo-cms#readme",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@crombolo/core": "0.
|
|
32
|
-
"@crombolo/data": "0.
|
|
31
|
+
"@crombolo/core": "0.35.2",
|
|
32
|
+
"@crombolo/data": "0.35.2"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/src/generate.ts
CHANGED
|
@@ -85,10 +85,17 @@ function tsTypeFor(set: SchemaSet, dataTypeAlias: string): string {
|
|
|
85
85
|
return 'boolean'
|
|
86
86
|
case 'Umbraco.ContentPicker':
|
|
87
87
|
return 'PublishedContent | null'
|
|
88
|
+
// These can name media, which is looked up as it is read (story 197): awaited.
|
|
88
89
|
case 'Umbraco.MultiNodeTreePicker':
|
|
89
|
-
return 'PublishedContent[]'
|
|
90
|
+
return 'Promise<PublishedContent[]>'
|
|
90
91
|
case 'Umbraco.MultiUrlPicker':
|
|
91
|
-
return 'Link[]'
|
|
92
|
+
return 'Promise<Link[]>'
|
|
93
|
+
case 'Umbraco.MediaPicker3':
|
|
94
|
+
return config.multiple === false
|
|
95
|
+
? 'Promise<MediaWithCrops | null>'
|
|
96
|
+
: 'Promise<MediaWithCrops[]>'
|
|
97
|
+
case 'Umbraco.RichText':
|
|
98
|
+
return 'string | Promise<string>'
|
|
92
99
|
case 'Umbraco.ElementPicker': {
|
|
93
100
|
// `allowedContentTypes` is a comma-separated list of element type keys, as
|
|
94
101
|
// Umbraco's AllowedContentTypeKeysParser reads it. Narrowing to those types
|
|
@@ -186,8 +193,10 @@ export function generateTypes(set: SchemaSet): string {
|
|
|
186
193
|
'BlockGridItem',
|
|
187
194
|
'BlockItem',
|
|
188
195
|
'Link',
|
|
196
|
+
'MediaWithCrops',
|
|
189
197
|
'PublishedContent',
|
|
190
198
|
'PublishedElement',
|
|
199
|
+
'PublishedMedia',
|
|
191
200
|
'TypedElement',
|
|
192
201
|
].filter((name) => new RegExp(`\\b${name}\\b`).test(body.split('\n').slice(2).join('\n')))
|
|
193
202
|
if (used.length > 0)
|