@crombolo/content 0.80.1 → 0.81.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crombolo/content",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.81.0",
|
|
4
4
|
"description": "Internal to crombolo, with no compatibility promise: use @crombolo/crombolo. The rules every page, media and Library write follows, whoever starts it: who may, where it may go, approvals, and what it announces. No transport.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Crombolo",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@crombolo/core": "0.
|
|
33
|
-
"@crombolo/data": "0.
|
|
32
|
+
"@crombolo/core": "0.81.0",
|
|
33
|
+
"@crombolo/data": "0.81.0"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/media-operations.ts
CHANGED
|
@@ -259,7 +259,8 @@ export type MediaOperations = ReturnType<typeof createMediaOperations>
|
|
|
259
259
|
export function createMediaOperations(options: MediaOperationsOptions) {
|
|
260
260
|
const { db, events } = options
|
|
261
261
|
const repo = new DocumentRepository(db, { ...options.repository, kind: 'media' })
|
|
262
|
-
|
|
262
|
+
// Story 436: a key the workspace holds its own of answers its own.
|
|
263
|
+
const nodes = new NodeRepository(db, { workspace: options.repository?.workspace })
|
|
263
264
|
const types = new ContentTypeRepository(db, { kind: 'media' })
|
|
264
265
|
const nodeId = options.repository?.nodeId
|
|
265
266
|
|
package/src/operations.ts
CHANGED
|
@@ -209,7 +209,8 @@ export function createDocumentOperations(options: DocumentOperationsOptions) {
|
|
|
209
209
|
const repo = new DocumentRepository(db, options.repository)
|
|
210
210
|
/** Set for a workspace's operations (story 375): nothing they write reaches Shared. */
|
|
211
211
|
const workspace = options.repository?.workspace
|
|
212
|
-
|
|
212
|
+
// Story 436: a key the workspace holds its own of answers its own.
|
|
213
|
+
const nodes = new NodeRepository(db, { workspace })
|
|
213
214
|
const types = new ContentTypeRepository(db, {
|
|
214
215
|
kind: repo.kind === 'media' ? 'media' : 'document',
|
|
215
216
|
})
|
|
@@ -160,6 +160,9 @@ async function recordChange(
|
|
|
160
160
|
options.only !== undefined
|
|
161
161
|
? `${ONLY_NAMES[options.onlyKind ?? 'publish']} "${merged[0]?.name ?? done[0]?.name ?? 'a page'}"`
|
|
162
162
|
: list.map((w) => w.name).join(', ')
|
|
163
|
+
// Story 436: a change another workspace's merge applied already is held, and not again.
|
|
164
|
+
const held = await changes.held((options.appliedChanges ?? []).map((c) => c.key))
|
|
165
|
+
const isHeld = (key: string) => held.has(normaliseUuid(key))
|
|
163
166
|
const id = await changes.begin({
|
|
164
167
|
kind: 'merge',
|
|
165
168
|
name,
|
|
@@ -167,10 +170,11 @@ async function recordChange(
|
|
|
167
170
|
appliedBy: options.userKey,
|
|
168
171
|
workspaceKey: first.key,
|
|
169
172
|
key:
|
|
170
|
-
options.changeKey ??
|
|
173
|
+
(options.changeKey && !isHeld(options.changeKey) ? options.changeKey : undefined) ??
|
|
171
174
|
(list.length === 1 && options.only === undefined ? first.key : undefined),
|
|
172
175
|
})
|
|
173
|
-
for (const applied of options.appliedChanges ?? [])
|
|
176
|
+
for (const applied of options.appliedChanges ?? [])
|
|
177
|
+
if (!isHeld(applied.key)) await changes.applied(applied, id)
|
|
174
178
|
for (const item of items) await changes.item(id, item)
|
|
175
179
|
const runs = new TransferRunRepository(tx)
|
|
176
180
|
for (const page of pages)
|