@anthusai/papyrus 5.136.0-next.6 → 5.137.0-next.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/amplify/data/resource.js +8 -0
- package/amplify/data/resource.ts +8 -0
- package/amplify/data/schema.js +8 -0
- package/amplify/data/schema.ts +8 -0
- package/amplify/functions/content-actions/handler.py +5 -4
- package/amplify/functions/procedure-action/handler.ts +16 -15
- package/lib/images/operations.generated.ts +3 -0
- package/package.json +1 -1
- package/routes.manifest.json +1 -1
package/amplify/data/resource.js
CHANGED
|
@@ -1432,12 +1432,20 @@ const schema = a.schema({
|
|
|
1432
1432
|
newsroomFeedKey: a.string(),
|
|
1433
1433
|
usage: a.json(),
|
|
1434
1434
|
costUsd: a.float(),
|
|
1435
|
+
/** `attention`, only while the run needs a person (it failed, or its outcome is unknown) and nobody has acknowledged it; absent otherwise, so the attention index is sparse (PPY-577310). A shared stack puts the tenant in front. */
|
|
1436
|
+
attentionKey: a.string(),
|
|
1437
|
+
/** When the run needed attention (its finish time). The sort key of the attention index; absent with `attentionKey`. */
|
|
1438
|
+
dueAt: a.datetime(),
|
|
1439
|
+
/** Who acknowledged the run and when. Acknowledging clears `attentionKey` and `dueAt`; the run stays as history. */
|
|
1440
|
+
acknowledgedAt: a.datetime(),
|
|
1441
|
+
acknowledgedBy: a.string(),
|
|
1435
1442
|
})
|
|
1436
1443
|
.secondaryIndexes((index) => [
|
|
1437
1444
|
index("procedureId").sortKeys(["requestedAt"]).queryField("listProcedureRunsByProcedureAndRequestedAt"),
|
|
1438
1445
|
index("assignmentId").sortKeys(["requestedAt"]).queryField("listProcedureRunsByAssignmentAndRequestedAt"),
|
|
1439
1446
|
index("runStatus").sortKeys(["requestedAt"]).queryField("listProcedureRunsByStatusAndRequestedAt"),
|
|
1440
1447
|
index("newsroomFeedKey").sortKeys(["requestedAt"]).queryField("listProcedureRunsByFeedAndRequestedAt"),
|
|
1448
|
+
index("attentionKey").sortKeys(["dueAt"]).queryField("listProcedureRunsByAttentionKeyAndDueAt"),
|
|
1441
1449
|
])
|
|
1442
1450
|
.authorization((allow) => [
|
|
1443
1451
|
allow.group("editor").to(["read"]),
|
package/amplify/data/resource.ts
CHANGED
|
@@ -1557,12 +1557,20 @@ const schema = a.schema({
|
|
|
1557
1557
|
newsroomFeedKey: a.string(),
|
|
1558
1558
|
usage: a.json(),
|
|
1559
1559
|
costUsd: a.float(),
|
|
1560
|
+
/** `attention`, only while the run needs a person (it failed, or its outcome is unknown) and nobody has acknowledged it; absent otherwise, so the attention index is sparse (PPY-577310). A shared stack puts the tenant in front. */
|
|
1561
|
+
attentionKey: a.string(),
|
|
1562
|
+
/** When the run needed attention (its finish time). The sort key of the attention index; absent with `attentionKey`. */
|
|
1563
|
+
dueAt: a.datetime(),
|
|
1564
|
+
/** Who acknowledged the run and when. Acknowledging clears `attentionKey` and `dueAt`; the run stays as history. */
|
|
1565
|
+
acknowledgedAt: a.datetime(),
|
|
1566
|
+
acknowledgedBy: a.string(),
|
|
1560
1567
|
})
|
|
1561
1568
|
.secondaryIndexes((index) => [
|
|
1562
1569
|
index("procedureId").sortKeys(["requestedAt"]).queryField("listProcedureRunsByProcedureAndRequestedAt"),
|
|
1563
1570
|
index("assignmentId").sortKeys(["requestedAt"]).queryField("listProcedureRunsByAssignmentAndRequestedAt"),
|
|
1564
1571
|
index("runStatus").sortKeys(["requestedAt"]).queryField("listProcedureRunsByStatusAndRequestedAt"),
|
|
1565
1572
|
index("newsroomFeedKey").sortKeys(["requestedAt"]).queryField("listProcedureRunsByFeedAndRequestedAt"),
|
|
1573
|
+
index("attentionKey").sortKeys(["dueAt"]).queryField("listProcedureRunsByAttentionKeyAndDueAt"),
|
|
1566
1574
|
])
|
|
1567
1575
|
.authorization((allow) => [
|
|
1568
1576
|
allow.group("editor").to(["read"]),
|
package/amplify/data/schema.js
CHANGED
|
@@ -1405,12 +1405,20 @@ function buildBaseDefinitions(excludedGroups = []) {
|
|
|
1405
1405
|
newsroomFeedKey: a.string(),
|
|
1406
1406
|
usage: a.json(),
|
|
1407
1407
|
costUsd: a.float(),
|
|
1408
|
+
/** `attention`, only while the run needs a person (it failed, or its outcome is unknown) and nobody has acknowledged it; absent otherwise, so the attention index is sparse (PPY-577310). A shared stack puts the tenant in front. */
|
|
1409
|
+
attentionKey: a.string(),
|
|
1410
|
+
/** When the run needed attention (its finish time). The sort key of the attention index; absent with `attentionKey`. */
|
|
1411
|
+
dueAt: a.datetime(),
|
|
1412
|
+
/** Who acknowledged the run and when. Acknowledging clears `attentionKey` and `dueAt`; the run stays as history. */
|
|
1413
|
+
acknowledgedAt: a.datetime(),
|
|
1414
|
+
acknowledgedBy: a.string(),
|
|
1408
1415
|
})
|
|
1409
1416
|
.secondaryIndexes((index) => [
|
|
1410
1417
|
index("procedureId").sortKeys(["requestedAt"]).queryField("listProcedureRunsByProcedureAndRequestedAt"),
|
|
1411
1418
|
index("assignmentId").sortKeys(["requestedAt"]).queryField("listProcedureRunsByAssignmentAndRequestedAt"),
|
|
1412
1419
|
index("runStatus").sortKeys(["requestedAt"]).queryField("listProcedureRunsByStatusAndRequestedAt"),
|
|
1413
1420
|
index("newsroomFeedKey").sortKeys(["requestedAt"]).queryField("listProcedureRunsByFeedAndRequestedAt"),
|
|
1421
|
+
index("attentionKey").sortKeys(["dueAt"]).queryField("listProcedureRunsByAttentionKeyAndDueAt"),
|
|
1414
1422
|
])
|
|
1415
1423
|
.authorization((allow) => [
|
|
1416
1424
|
allow.group("editor").to(["read"]),
|
package/amplify/data/schema.ts
CHANGED
|
@@ -1533,12 +1533,20 @@ const definitions = {
|
|
|
1533
1533
|
newsroomFeedKey: a.string(),
|
|
1534
1534
|
usage: a.json(),
|
|
1535
1535
|
costUsd: a.float(),
|
|
1536
|
+
/** `attention`, only while the run needs a person (it failed, or its outcome is unknown) and nobody has acknowledged it; absent otherwise, so the attention index is sparse (PPY-577310). A shared stack puts the tenant in front. */
|
|
1537
|
+
attentionKey: a.string(),
|
|
1538
|
+
/** When the run needed attention (its finish time). The sort key of the attention index; absent with `attentionKey`. */
|
|
1539
|
+
dueAt: a.datetime(),
|
|
1540
|
+
/** Who acknowledged the run and when. Acknowledging clears `attentionKey` and `dueAt`; the run stays as history. */
|
|
1541
|
+
acknowledgedAt: a.datetime(),
|
|
1542
|
+
acknowledgedBy: a.string(),
|
|
1536
1543
|
})
|
|
1537
1544
|
.secondaryIndexes((index) => [
|
|
1538
1545
|
index("procedureId").sortKeys(["requestedAt"]).queryField("listProcedureRunsByProcedureAndRequestedAt"),
|
|
1539
1546
|
index("assignmentId").sortKeys(["requestedAt"]).queryField("listProcedureRunsByAssignmentAndRequestedAt"),
|
|
1540
1547
|
index("runStatus").sortKeys(["requestedAt"]).queryField("listProcedureRunsByStatusAndRequestedAt"),
|
|
1541
1548
|
index("newsroomFeedKey").sortKeys(["requestedAt"]).queryField("listProcedureRunsByFeedAndRequestedAt"),
|
|
1549
|
+
index("attentionKey").sortKeys(["dueAt"]).queryField("listProcedureRunsByAttentionKeyAndDueAt"),
|
|
1542
1550
|
])
|
|
1543
1551
|
.authorization((allow) => [
|
|
1544
1552
|
allow.group("editor").to(["read"]),
|
|
@@ -786,7 +786,7 @@ def save_item_draft_action(arguments: dict, actor: str, approved_by: str | None
|
|
|
786
786
|
},
|
|
787
787
|
}
|
|
788
788
|
if record["status"] == "published" and projection_configured():
|
|
789
|
-
published = publish_item(client, record["id"], actor=actor, approved_by=approved_by)
|
|
789
|
+
published = publish_item(client, record["id"], actor=actor, approved_by=approved_by, by_person=approved_by)
|
|
790
790
|
response["item"]["versionNumber"] = published.version_number
|
|
791
791
|
response.update(project_item_action(client, record["id"], unpublished=False))
|
|
792
792
|
return response
|
|
@@ -881,7 +881,7 @@ def drain_publish_queue_action() -> dict:
|
|
|
881
881
|
return {"ok": True, "scheduled": bool(schedule_projection_task({"task": "drain"}, "batch publish"))}
|
|
882
882
|
|
|
883
883
|
|
|
884
|
-
def publish_item_action(arguments: dict, actor: str, approved_by: str | None = None) -> dict:
|
|
884
|
+
def publish_item_action(arguments: dict, actor: str, approved_by: str | None = None, by_person: str | None = None) -> dict:
|
|
885
885
|
if arguments.get("jobStatus"):
|
|
886
886
|
return projection_status_action(arguments)
|
|
887
887
|
if arguments.get("drain") is True:
|
|
@@ -890,7 +890,7 @@ def publish_item_action(arguments: dict, actor: str, approved_by: str | None = N
|
|
|
890
890
|
candidate = client.get_record("Item", arguments["id"]) or {}
|
|
891
891
|
live = client.get_record("PublishedItem", published_item_id_for(candidate.get("lineageId") or arguments["id"]))
|
|
892
892
|
render_preflight(client, arguments["id"]) # a page the site cannot render is refused before any published data is written
|
|
893
|
-
result = publish_item(client, arguments["id"], actor=actor, approved_by=approved_by)
|
|
893
|
+
result = publish_item(client, arguments["id"], actor=actor, approved_by=approved_by, by_person=by_person)
|
|
894
894
|
response = {
|
|
895
895
|
"ok": True,
|
|
896
896
|
"changed": result.changed,
|
|
@@ -1168,7 +1168,8 @@ def _handle_field(event):
|
|
|
1168
1168
|
if field == "saveItemDraft":
|
|
1169
1169
|
return save_item_draft_action(arguments, actor, person_from_event(event))
|
|
1170
1170
|
if field == "publishItem":
|
|
1171
|
-
|
|
1171
|
+
person = person_from_event(event)
|
|
1172
|
+
return publish_item_action(arguments, actor, person, person)
|
|
1172
1173
|
if field == "createStoryFromReference":
|
|
1173
1174
|
return create_story_from_reference_action(arguments, actor)
|
|
1174
1175
|
if field == "moveStoryStage":
|
|
@@ -49,17 +49,17 @@ async function listProcedureDefinitions(getClient: () => Promise<DataClient>) {
|
|
|
49
49
|
const client = await getClient();
|
|
50
50
|
const definitions = await listProcedureDefinitionsPage(client);
|
|
51
51
|
const versions = await listProcedureVersionsPage(client);
|
|
52
|
-
const runs = await listProcedureRunsPage(client);
|
|
53
52
|
const versionsByProcedureId = groupBy(versions, (entry) => normalizeOptionalString(entry.procedureId) ?? "");
|
|
54
|
-
|
|
53
|
+
// Each definition's ten latest runs are one indexed query; no read lists the whole run table.
|
|
54
|
+
const recentRunsByProcedureId = new Map<string, any[]>(
|
|
55
|
+
await Promise.all(definitions.map(async (definition): Promise<[string, any[]]> => [definition.id, await listRecentProcedureRuns(client, definition.id)])),
|
|
56
|
+
);
|
|
55
57
|
return {
|
|
56
58
|
items: definitions.map((definition) => {
|
|
57
59
|
const currentVersion = normalizeOptionalString(definition.currentVersionId)
|
|
58
60
|
? versions.find((entry) => entry.id === definition.currentVersionId) ?? null
|
|
59
61
|
: null;
|
|
60
|
-
const recentRuns =
|
|
61
|
-
.sort((left, right) => String(right.requestedAt ?? "").localeCompare(String(left.requestedAt ?? "")))
|
|
62
|
-
.slice(0, 10);
|
|
62
|
+
const recentRuns = recentRunsByProcedureId.get(definition.id) ?? [];
|
|
63
63
|
return {
|
|
64
64
|
...definition,
|
|
65
65
|
currentVersion,
|
|
@@ -417,10 +417,6 @@ async function listProcedureVersionsPage(client: DataClient): Promise<any[]> {
|
|
|
417
417
|
return await listModelPages((client.models.ProcedureVersion as any));
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
-
async function listProcedureRunsPage(client: DataClient): Promise<any[]> {
|
|
421
|
-
return await listModelPages((client.models.ProcedureRun as any));
|
|
422
|
-
}
|
|
423
|
-
|
|
424
420
|
async function listProcedureVersionsByProcedure(client: DataClient, procedureId: string): Promise<any[]> {
|
|
425
421
|
const model = client.models.ProcedureVersion as any;
|
|
426
422
|
if (typeof model.listProcedureVersionsByProcedureAndVersion === "function") {
|
|
@@ -431,12 +427,17 @@ async function listProcedureVersionsByProcedure(client: DataClient, procedureId:
|
|
|
431
427
|
}
|
|
432
428
|
|
|
433
429
|
async function listProcedureRunsByProcedureId(client: DataClient, procedureId: string): Promise<any[]> {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
430
|
+
return await listByIndexPages((client.models.ProcedureRun as any).listProcedureRunsByProcedureAndRequestedAt, { procedureId });
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/** The ten latest runs of one procedure, newest first: one key-condition query on the procedure index. */
|
|
434
|
+
async function listRecentProcedureRuns(client: DataClient, procedureId: string): Promise<any[]> {
|
|
435
|
+
const response: DataClientResult<any[]> = await (client.models.ProcedureRun as any).listProcedureRunsByProcedureAndRequestedAt(
|
|
436
|
+
{ procedureId },
|
|
437
|
+
{ authMode: LAMBDA_DATA_AUTH_MODE, limit: 10, sortDirection: "DESC" },
|
|
438
|
+
);
|
|
439
|
+
assertNoDataErrors(response.errors, "list recent ProcedureRuns");
|
|
440
|
+
return response.data ?? [];
|
|
440
441
|
}
|
|
441
442
|
|
|
442
443
|
async function listModelPages(model: any): Promise<any[]> {
|
|
@@ -882,12 +882,15 @@ export type GuidelinesResolveInput = {
|
|
|
882
882
|
section?: string;
|
|
883
883
|
/** The language of the text the guidelines are for: its overlays (a variant's base language first) are laid over the shared guidelines. Leave it out for the guidelines every language shares. */
|
|
884
884
|
language?: string;
|
|
885
|
+
/** The channel the text is for (x, linkedin, email): a rule file scoped to channel/<name> is in the answer only for that channel. */
|
|
886
|
+
channel?: string;
|
|
885
887
|
};
|
|
886
888
|
|
|
887
889
|
export type GuidelinesResolveResult = {
|
|
888
890
|
kind: string;
|
|
889
891
|
section?: string;
|
|
890
892
|
language?: string;
|
|
893
|
+
channel?: string;
|
|
891
894
|
/** False when the publication has no guidelines of this kind yet. */
|
|
892
895
|
found: boolean;
|
|
893
896
|
/** A guideline document of that kind: schemaVersion and the fields the kind allows. */
|
package/package.json
CHANGED
package/routes.manifest.json
CHANGED