@crombolo/api-management 0.52.2 → 0.54.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crombolo/api-management",
3
- "version": "0.52.2",
3
+ "version": "0.54.1",
4
4
  "description": "Internal to crombolo, with no compatibility promise: use @crombolo/crombolo. Umbraco-compatible Management API handlers for crombolo.",
5
5
  "license": "MIT",
6
6
  "author": "Crombolo",
@@ -29,8 +29,8 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@crombolo/content": "0.52.2",
33
- "@crombolo/contracts": "0.52.2",
34
- "@crombolo/core": "0.52.2"
32
+ "@crombolo/content": "0.54.1",
33
+ "@crombolo/contracts": "0.54.1",
34
+ "@crombolo/core": "0.54.1"
35
35
  }
36
36
  }
@@ -76,6 +76,9 @@ const CONTENT: Sections = ['content']
76
76
  const MEDIA: Sections = ['media']
77
77
  const SETTINGS: Sections = ['settings']
78
78
  const USERS: Sections = ['users']
79
+ /** The parts of Settings a group can hold alone (story 296). */
80
+ const STRUCTURE: Sections = ['settings', 'structure']
81
+ const COMPONENTS: Sections = ['settings', 'components']
79
82
  const MEMBERS: Sections = ['members']
80
83
  const TRANSLATION: Sections = ['translation']
81
84
  const LIBRARY: Sections = ['library']
@@ -86,16 +89,16 @@ const TREES: Record<string, Sections> = {
86
89
  document: ANY_TREE,
87
90
  media: ANY_TREE,
88
91
  element: ANY_TREE,
89
- 'document-type': SETTINGS,
90
- 'document-blueprint': SETTINGS,
91
- 'data-type': SETTINGS,
92
- 'media-type': SETTINGS,
93
- 'member-type': ['settings', 'members'],
94
- template: ['settings', 'content'],
92
+ 'document-type': STRUCTURE,
93
+ 'document-blueprint': STRUCTURE,
94
+ 'data-type': STRUCTURE,
95
+ 'media-type': STRUCTURE,
96
+ 'member-type': ['settings', 'members', 'structure'],
97
+ template: ['settings', 'content', 'components'],
95
98
  dictionary: ['translation', 'settings'],
96
- 'partial-view': SETTINGS,
97
- script: SETTINGS,
98
- stylesheet: SETTINGS,
99
+ 'partial-view': COMPONENTS,
100
+ script: COMPONENTS,
101
+ stylesheet: COMPONENTS,
99
102
  'relation-type': SETTINGS,
100
103
  'static-file': ['settings', 'content', 'media', 'members'],
101
104
  'member-group': MEMBERS,
@@ -112,12 +115,12 @@ const SETTINGS_AREAS = new Set([
112
115
  'published-cache',
113
116
  'telemetry',
114
117
  'webhook',
115
- 'partial-view',
116
- 'script',
117
- 'stylesheet',
118
118
  'relation-type',
119
119
  ])
120
120
 
121
+ /** What a group given Components can write. */
122
+ const COMPONENT_AREAS = new Set(['partial-view', 'script', 'stylesheet'])
123
+
121
124
  /** Type actions only the Settings section may take, beyond every write. */
122
125
  const TYPE_ADMIN_ACTIONS = new Set([
123
126
  'configuration',
@@ -144,6 +147,7 @@ export function sectionRequirements(operation: OperationInfo): Array<Sections |
144
147
  const action = second.startsWith('{') ? third : second
145
148
  const typeAdmin = write || TYPE_ADMIN_ACTIONS.has(action)
146
149
  if (SETTINGS_AREAS.has(area)) return [SETTINGS]
150
+ if (COMPONENT_AREAS.has(area)) return [COMPONENTS]
147
151
  switch (area) {
148
152
  case 'tree':
149
153
  return TREES[second] ? [TREES[second]] : []
@@ -166,35 +170,42 @@ export function sectionRequirements(operation: OperationInfo): Array<Sections |
166
170
  case 'dynamic-root':
167
171
  return [CONTENT]
168
172
  case 'document-type':
169
- if (second === 'folder') return [SETTINGS]
170
- if (third === 'blueprint') return [['content', 'library', 'settings'], CONTENT]
173
+ if (second === 'folder') return [STRUCTURE]
174
+ if (third === 'blueprint') return [['content', 'library', 'settings', 'structure'], CONTENT]
171
175
  return typeAdmin
172
- ? [['content', 'library', 'settings'], SETTINGS]
173
- : [['content', 'library', 'settings']]
176
+ ? [['content', 'library', 'settings', 'structure'], STRUCTURE]
177
+ : [['content', 'library', 'settings', 'structure']]
174
178
  case 'document-blueprint':
175
179
  if (second === 'from-document' || third === 'scaffold') return [CONTENT]
176
- if (!write && second.startsWith('{') && third === '') return [['content', 'settings']]
177
- return [SETTINGS]
180
+ if (!write && second.startsWith('{') && third === '')
181
+ return [['content', 'settings', 'structure']]
182
+ return [STRUCTURE]
178
183
  case 'data-type':
179
- if (second === 'folder') return [SETTINGS]
184
+ if (second === 'folder') return [STRUCTURE]
180
185
  return typeAdmin
181
- ? [['content', 'library', 'media', 'members', 'settings'], SETTINGS]
182
- : [['content', 'library', 'media', 'members', 'settings']]
186
+ ? [['content', 'library', 'media', 'members', 'settings', 'structure'], STRUCTURE]
187
+ : [['content', 'library', 'media', 'members', 'settings', 'structure']]
183
188
  case 'media':
184
189
  return [MEDIA]
185
190
  case 'media-type':
186
- if (second === 'folder') return [SETTINGS]
187
- return typeAdmin ? [['media', 'settings'], SETTINGS] : [['media', 'settings']]
191
+ if (second === 'folder') return [STRUCTURE]
192
+ return typeAdmin
193
+ ? [['media', 'settings', 'structure'], STRUCTURE]
194
+ : [['media', 'settings', 'structure']]
188
195
  case 'member-type':
189
- if (second === 'folder') return [SETTINGS]
190
- return typeAdmin ? [['settings', 'members'], SETTINGS] : [['settings', 'members']]
196
+ if (second === 'folder') return [STRUCTURE]
197
+ return typeAdmin
198
+ ? [['settings', 'members', 'structure'], STRUCTURE]
199
+ : [['settings', 'members', 'structure']]
191
200
  case 'member':
192
201
  case 'member-group':
193
202
  return [MEMBERS]
194
203
  case 'template':
195
- return write ? [['settings', 'content'], SETTINGS] : [['settings', 'content']]
204
+ return write
205
+ ? [['settings', 'content', 'components'], COMPONENTS]
206
+ : [['settings', 'content', 'components']]
196
207
  case 'language':
197
- return write ? [SETTINGS] : []
208
+ return write ? [STRUCTURE] : []
198
209
  case 'dictionary':
199
210
  return [TRANSLATION]
200
211
  case 'user':