@crombolo/data 0.80.0 → 0.80.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/data",
|
|
3
|
-
"version": "0.80.
|
|
3
|
+
"version": "0.80.1",
|
|
4
4
|
"description": "Internal to crombolo, with no compatibility promise: use @crombolo/crombolo. SQLite and Postgres storage for crombolo: schema, migrations and repositories.",
|
|
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.80.
|
|
32
|
+
"@crombolo/core": "0.80.1",
|
|
33
33
|
"kysely": "0.29.6"
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -967,6 +967,24 @@ export class DocumentRepository {
|
|
|
967
967
|
return true
|
|
968
968
|
}
|
|
969
969
|
|
|
970
|
+
/** Whether the workspace moves the page, or one above it, out of the bin at its merge. */
|
|
971
|
+
async #leavesBin(node: NodeRow): Promise<boolean> {
|
|
972
|
+
const rows = await this.#db.q
|
|
973
|
+
.selectFrom('workspace_pending')
|
|
974
|
+
.select('id')
|
|
975
|
+
.where('workspace_id', '=', this.#workspace as number)
|
|
976
|
+
.where('kind', '=', 'move')
|
|
977
|
+
.where('node_id', 'in', [
|
|
978
|
+
node.id,
|
|
979
|
+
...node.path
|
|
980
|
+
.split(',')
|
|
981
|
+
.map(Number)
|
|
982
|
+
.filter((id) => id > 0),
|
|
983
|
+
])
|
|
984
|
+
.execute()
|
|
985
|
+
return rows.length > 0
|
|
986
|
+
}
|
|
987
|
+
|
|
970
988
|
/**
|
|
971
989
|
* Publishes a page in the workspace only (story 375): Shared's published
|
|
972
990
|
* page, its flags and the published cache are untouched, and the usual rules
|
|
@@ -976,7 +994,8 @@ export class DocumentRepository {
|
|
|
976
994
|
node: NodeRow,
|
|
977
995
|
cultures: readonly string[] | null,
|
|
978
996
|
): Promise<DocumentAggregate | undefined> {
|
|
979
|
-
if (node.trashed
|
|
997
|
+
if (node.trashed && !(await this.#leavesBin(node)))
|
|
998
|
+
throw new PublishBlockedError('The document is in the recycle bin.')
|
|
980
999
|
if (!(await this.#ancestorsPublishedInWorkspace(node)))
|
|
981
1000
|
throw new PublishBlockedError('An ancestor is not published.')
|
|
982
1001
|
await this.#touch(node)
|
|
@@ -482,12 +482,17 @@ export class WorkspaceRepository {
|
|
|
482
482
|
.execute()
|
|
483
483
|
}
|
|
484
484
|
|
|
485
|
-
async dropPending(
|
|
486
|
-
|
|
485
|
+
async dropPending(
|
|
486
|
+
id: number,
|
|
487
|
+
nodeId: number,
|
|
488
|
+
kinds?: ReadonlyArray<WorkspacePending['kind']>,
|
|
489
|
+
): Promise<void> {
|
|
490
|
+
let rows = this.#db.q
|
|
487
491
|
.deleteFrom('workspace_pending')
|
|
488
492
|
.where('workspace_id', '=', id)
|
|
489
493
|
.where('node_id', '=', nodeId)
|
|
490
|
-
|
|
494
|
+
if (kinds) rows = rows.where('kind', 'in', [...kinds])
|
|
495
|
+
await rows.execute()
|
|
491
496
|
}
|
|
492
497
|
|
|
493
498
|
/** A page merged alone from a person's own workspace (story 380): its rows there go. */
|