@forumone/throughline-publishing 0.3.3 → 0.3.4
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @forumone/throughline-publishing
|
|
2
2
|
|
|
3
|
+
## 0.3.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- add60df: Stop overwriting `publishedAt` on every publish.
|
|
8
|
+
|
|
9
|
+
`executeStep` wrote the current time into the collection's `publishedAtField` on
|
|
10
|
+
every run, so re-publishing an edit re-dated the document. The field means "when
|
|
11
|
+
this went live" — a listing sorts on it and a template prints it — so the visible
|
|
12
|
+
effect was that editing a two-year-old article sent it to the top of its index
|
|
13
|
+
under today's date, and an editor who typed the original date into the sidebar
|
|
14
|
+
watched publishing replace it.
|
|
15
|
+
|
|
16
|
+
The guard was already there and unused: the step computes `wasFirstPublish` for
|
|
17
|
+
the `content/page.published` payload, where it is reported as `isFirstPublish`.
|
|
18
|
+
It now also decides the write, so `publishedAt` is stamped on a first publish and
|
|
19
|
+
left alone afterwards. A document that should genuinely be re-dated is re-dated
|
|
20
|
+
by editing the field, which now survives.
|
|
21
|
+
|
|
22
|
+
`previousPublishedAt` and `isFirstPublish` in the event are unchanged, so a
|
|
23
|
+
subscriber that wants the publish time of _this_ publish still has it.
|
|
24
|
+
|
|
25
|
+
Patch rather than minor: the fix restores what the field was documented to mean.
|
|
26
|
+
Anything relying on it as a last-published timestamp was relying on the bug — and
|
|
27
|
+
`updatedAt` is the field for that.
|
|
28
|
+
|
|
3
29
|
## 0.3.3
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import type { PipelineStep } from '../types.js';
|
|
2
2
|
/**
|
|
3
|
-
* Performs the actual publish: writes `_status: 'published'
|
|
4
|
-
*
|
|
5
|
-
* subscribers can react to (revalidation, integrations, etc.).
|
|
3
|
+
* Performs the actual publish: writes `_status: 'published'`, stamps the
|
|
4
|
+
* publishedAt field on a first publish, then fires `content/page.published`
|
|
5
|
+
* with metadata subscribers can react to (revalidation, integrations, etc.).
|
|
6
|
+
*
|
|
7
|
+
* `publishedAt` is set only when the document does not already have one. It
|
|
8
|
+
* means "when this went live", which is what a listing sorts on and what a
|
|
9
|
+
* template prints on the page — so re-publishing an edit must not move it. It
|
|
10
|
+
* did: every publish overwrote the field with the current time, which sent an
|
|
11
|
+
* edited article to the top of its index and printed today's date on a piece
|
|
12
|
+
* written months ago. An editor who typed the original date into the sidebar
|
|
13
|
+
* watched it be replaced by the act of publishing.
|
|
14
|
+
*
|
|
15
|
+
* The guard is `wasFirstPublish`, which this step already computed for the
|
|
16
|
+
* event payload and did not apply to the write.
|
|
17
|
+
*
|
|
18
|
+
* A document that should genuinely be re-dated is re-dated by editing the
|
|
19
|
+
* field, which now survives.
|
|
6
20
|
*
|
|
7
21
|
* Sets `context.bypassPublishingServer = true` on the Payload update so the
|
|
8
22
|
* status-write blocking hook recognizes this as a sanctioned write. Any
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/execute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/execute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,WAAW,EAAE,YAoCzB,CAAA"}
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { sendEventSafely } from '../../events.js';
|
|
2
2
|
/**
|
|
3
|
-
* Performs the actual publish: writes `_status: 'published'
|
|
4
|
-
*
|
|
5
|
-
* subscribers can react to (revalidation, integrations, etc.).
|
|
3
|
+
* Performs the actual publish: writes `_status: 'published'`, stamps the
|
|
4
|
+
* publishedAt field on a first publish, then fires `content/page.published`
|
|
5
|
+
* with metadata subscribers can react to (revalidation, integrations, etc.).
|
|
6
|
+
*
|
|
7
|
+
* `publishedAt` is set only when the document does not already have one. It
|
|
8
|
+
* means "when this went live", which is what a listing sorts on and what a
|
|
9
|
+
* template prints on the page — so re-publishing an edit must not move it. It
|
|
10
|
+
* did: every publish overwrote the field with the current time, which sent an
|
|
11
|
+
* edited article to the top of its index and printed today's date on a piece
|
|
12
|
+
* written months ago. An editor who typed the original date into the sidebar
|
|
13
|
+
* watched it be replaced by the act of publishing.
|
|
14
|
+
*
|
|
15
|
+
* The guard is `wasFirstPublish`, which this step already computed for the
|
|
16
|
+
* event payload and did not apply to the write.
|
|
17
|
+
*
|
|
18
|
+
* A document that should genuinely be re-dated is re-dated by editing the
|
|
19
|
+
* field, which now survives.
|
|
6
20
|
*
|
|
7
21
|
* Sets `context.bypassPublishingServer = true` on the Payload update so the
|
|
8
22
|
* status-write blocking hook recognizes this as a sanctioned write. Any
|
|
@@ -28,7 +42,7 @@ export const executeStep = async (ctx) => {
|
|
|
28
42
|
id: ctx.documentId,
|
|
29
43
|
data: {
|
|
30
44
|
_status: 'published',
|
|
31
|
-
[ctx.collection.publishedAtField]: now,
|
|
45
|
+
...(wasFirstPublish ? { [ctx.collection.publishedAtField]: now } : {}),
|
|
32
46
|
},
|
|
33
47
|
...(ctx.actor.enforceAccessAs
|
|
34
48
|
? { user: ctx.actor.enforceAccessAs, overrideAccess: false }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/pipeline/steps/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGjD
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/pipeline/steps/execute.ts"],"names":[],"m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EAAE,GAAG,CAAC,UAAU,CAAC,IAAI;YAC/B,EAAE,EAAE,GAAG,CAAC,UAAU;YAClB,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC;YACtE,WAAW,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,IAAI,QAAQ;YAC3C,mBAAmB;YACnB,cAAc,EAAE,eAAe;SAChC;KACF,CAAC,CAAA;IAEF,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;AACpE,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forumone/throughline-publishing",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Policy-gated publishing server for Throughline. Wraps Payload's update operation with composition, accessibility, required-field, embargo, and approval gating.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|