@crombolo/render 0.55.0 → 0.56.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/package.json +3 -3
- package/src/site.ts +70 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crombolo/render",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.56.0",
|
|
4
4
|
"description": "Internal to crombolo, with no compatibility promise: use @crombolo/crombolo. TSX server rendering and the published-content model for crombolo.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Crombolo",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@crombolo/common": "0.
|
|
38
|
-
"@crombolo/core": "0.
|
|
37
|
+
"@crombolo/common": "0.56.0",
|
|
38
|
+
"@crombolo/core": "0.56.0",
|
|
39
39
|
"@types/react": "^19.3.0"
|
|
40
40
|
}
|
|
41
41
|
}
|
package/src/site.ts
CHANGED
|
@@ -83,11 +83,81 @@ export interface SiteJobs {
|
|
|
83
83
|
status(id: string): Promise<SiteJobStatus | undefined>
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
/**
|
|
87
|
+
* A page as the site's code reads and writes it (story 298): its values by
|
|
88
|
+
* alias, and by culture for a property that varies, `{ title: { 'en-GB': 'Hi' } }`.
|
|
89
|
+
*/
|
|
90
|
+
export interface SiteDocument {
|
|
91
|
+
key: string
|
|
92
|
+
/** Its content type's alias. */
|
|
93
|
+
contentType: string
|
|
94
|
+
parent: string | null
|
|
95
|
+
/** Its name, or its name in each culture where the type varies. */
|
|
96
|
+
name: string | Readonly<Record<string, string>>
|
|
97
|
+
values: Readonly<Record<string, unknown>>
|
|
98
|
+
/** Whether it, or any of its cultures, is published. */
|
|
99
|
+
published: boolean
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** What a new page is: where, of what type, and its name and values. */
|
|
103
|
+
export interface SiteDocumentInput {
|
|
104
|
+
parent: string | null
|
|
105
|
+
/** The content type's alias. */
|
|
106
|
+
contentType: string
|
|
107
|
+
name: string
|
|
108
|
+
/** The culture `name`, and any plain value of a varying property, are in. */
|
|
109
|
+
culture?: string
|
|
110
|
+
values?: Readonly<Record<string, unknown>>
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** A change to a page: a new name, and the values given; the rest stay. */
|
|
114
|
+
export interface SiteDocumentChange {
|
|
115
|
+
name?: string
|
|
116
|
+
culture?: string
|
|
117
|
+
values?: Readonly<Record<string, unknown>>
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
type ContentWrite = Promise<Result<{ key: string }, 400 | 403 | 404 | 422>>
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Pages, as the API user the config's `content.actAs` names: its permissions
|
|
124
|
+
* bound what this may do, and every change is audited as it. Writes happen in
|
|
125
|
+
* an action, a route, a job or an event handler; a page render only reads.
|
|
126
|
+
*/
|
|
127
|
+
export interface SiteContent {
|
|
128
|
+
/** The page as last saved. */
|
|
129
|
+
get(key: string): Promise<Result<SiteDocument, 403 | 404>>
|
|
130
|
+
/** A page's children as last saved, in order; `null` for the top level. */
|
|
131
|
+
children(key: string | null): Promise<Result<SiteDocument[], 403 | 404>>
|
|
132
|
+
create(input: SiteDocumentInput): ContentWrite
|
|
133
|
+
update(key: string, change: SiteDocumentChange): ContentWrite
|
|
134
|
+
/** Publishes it, or some of its cultures; a workflow may hold it for approval. */
|
|
135
|
+
publish(key: string, options?: { cultures?: string[] }): ContentWrite
|
|
136
|
+
unpublish(key: string, options?: { cultures?: string[] }): ContentWrite
|
|
137
|
+
/** To the recycle bin. */
|
|
138
|
+
delete(key: string): ContentWrite
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** A content event as the config's `events` handlers receive it (story 298). */
|
|
142
|
+
export interface SiteContentEvent {
|
|
143
|
+
/** As webhooks name it: `Umbraco.ContentPublish`. */
|
|
144
|
+
alias: string
|
|
145
|
+
/** The page it is about. */
|
|
146
|
+
key: string
|
|
147
|
+
/** Its content type's alias, when it is still there to say. */
|
|
148
|
+
contentType: string | null
|
|
149
|
+
/** The cultures it was about, when it was about some. */
|
|
150
|
+
cultures: string[] | null
|
|
151
|
+
/** Who made the change. */
|
|
152
|
+
actor: { kind: string; name: string }
|
|
153
|
+
}
|
|
154
|
+
|
|
86
155
|
export interface SiteServices {
|
|
87
156
|
media: SiteMedia
|
|
88
157
|
queries: SiteQueries
|
|
89
158
|
members: SiteMembers
|
|
90
159
|
jobs: SiteJobs
|
|
160
|
+
content: SiteContent
|
|
91
161
|
}
|
|
92
162
|
|
|
93
163
|
/** The site's services as the visitor; only while a page renders. */
|