@orthacms/content-server 0.4.3 → 0.5.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/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/lib/content.module.d.ts.map +1 -1
- package/dist/lib/content.module.js +8 -0
- package/dist/lib/copilot/entry-proposal.applier.d.ts.map +1 -1
- package/dist/lib/copilot/entry-proposal.applier.js +5 -4
- package/dist/lib/docs/describe-content-api.d.ts +7 -0
- package/dist/lib/docs/describe-content-api.d.ts.map +1 -1
- package/dist/lib/docs/describe-content-api.js +177 -53
- package/dist/lib/docs/describe-views-api.d.ts +19 -0
- package/dist/lib/docs/describe-views-api.d.ts.map +1 -0
- package/dist/lib/docs/describe-views-api.js +76 -0
- package/dist/lib/docs/field-schema.d.ts.map +1 -1
- package/dist/lib/docs/field-schema.js +36 -2
- package/dist/lib/docs/openapi-writer.d.ts +49 -0
- package/dist/lib/docs/openapi-writer.d.ts.map +1 -0
- package/dist/lib/docs/openapi-writer.js +76 -0
- package/dist/lib/docs/public-api-schemas.d.ts +45 -0
- package/dist/lib/docs/public-api-schemas.d.ts.map +1 -0
- package/dist/lib/docs/public-api-schemas.js +377 -0
- package/dist/lib/docs/views-schemas.d.ts +22 -0
- package/dist/lib/docs/views-schemas.d.ts.map +1 -0
- package/dist/lib/docs/views-schemas.js +156 -0
- package/dist/lib/entries/application/use-cases/bulk-publish-entries.use-case.d.ts +8 -2
- package/dist/lib/entries/application/use-cases/bulk-publish-entries.use-case.d.ts.map +1 -1
- package/dist/lib/entries/application/use-cases/bulk-publish-entries.use-case.js +19 -4
- package/dist/lib/entries/application/use-cases/bulk-unpublish-entries.use-case.d.ts +2 -2
- package/dist/lib/entries/application/use-cases/bulk-unpublish-entries.use-case.d.ts.map +1 -1
- package/dist/lib/entries/application/use-cases/bulk-unpublish-entries.use-case.js +14 -4
- package/dist/lib/entries/application/use-cases/publish-entry.use-case.d.ts +6 -8
- package/dist/lib/entries/application/use-cases/publish-entry.use-case.d.ts.map +1 -1
- package/dist/lib/entries/application/use-cases/publish-entry.use-case.js +10 -4
- package/dist/lib/entries/application/use-cases/unpublish-entry.use-case.d.ts +2 -5
- package/dist/lib/entries/application/use-cases/unpublish-entry.use-case.d.ts.map +1 -1
- package/dist/lib/entries/application/use-cases/unpublish-entry.use-case.js +6 -1
- package/dist/lib/entries/domain/entry.d.ts +8 -1
- package/dist/lib/entries/domain/entry.d.ts.map +1 -1
- package/dist/lib/entries/domain/entry.js +12 -12
- package/dist/lib/entries/domain/events/entry-events.d.ts +47 -5
- package/dist/lib/entries/domain/events/entry-events.d.ts.map +1 -1
- package/dist/lib/entries/domain/events/entry-events.js +26 -10
- package/dist/lib/entries/entries.constants.d.ts +10 -2
- package/dist/lib/entries/entries.constants.d.ts.map +1 -1
- package/dist/lib/entries/entries.constants.js +11 -2
- package/dist/lib/entries/http/controllers/bulk-entries.controller.d.ts +2 -2
- package/dist/lib/entries/http/controllers/bulk-entries.controller.d.ts.map +1 -1
- package/dist/lib/entries/http/controllers/bulk-entries.controller.js +8 -6
- package/dist/lib/entries/infrastructure/persistence/entry-writer.service.d.ts +22 -6
- package/dist/lib/entries/infrastructure/persistence/entry-writer.service.d.ts.map +1 -1
- package/dist/lib/entries/infrastructure/persistence/entry-writer.service.js +71 -17
- package/dist/lib/insights/docs/describe-content-insights-api.d.ts +23 -0
- package/dist/lib/insights/docs/describe-content-insights-api.d.ts.map +1 -0
- package/dist/lib/insights/docs/describe-content-insights-api.js +329 -0
- package/dist/lib/mcp/content-tools.provider.d.ts.map +1 -1
- package/dist/lib/mcp/content-tools.provider.js +10 -9
- package/dist/lib/public-api/http/controllers/public-entry-writes.controller.d.ts +14 -13
- package/dist/lib/public-api/http/controllers/public-entry-writes.controller.d.ts.map +1 -1
- package/dist/lib/public-api/http/controllers/public-entry-writes.controller.js +62 -46
- package/dist/lib/public-api/http/guards/api-token-workspace.guard.d.ts.map +1 -1
- package/dist/lib/public-api/http/guards/api-token-workspace.guard.js +8 -0
- package/dist/lib/public-api/infrastructure/public-entry-writes.service.d.ts +10 -9
- package/dist/lib/public-api/infrastructure/public-entry-writes.service.d.ts.map +1 -1
- package/dist/lib/public-api/infrastructure/public-entry-writes.service.js +23 -24
- package/dist/lib/public-api/infrastructure/token-actor.d.ts +37 -0
- package/dist/lib/public-api/infrastructure/token-actor.d.ts.map +1 -0
- package/dist/lib/public-api/infrastructure/token-actor.js +58 -0
- package/dist/lib/revisions/application/use-cases/restore-revision.use-case.d.ts.map +1 -1
- package/dist/lib/revisions/application/use-cases/restore-revision.use-case.js +12 -1
- package/dist/lib/revisions/infrastructure/purge/revisions-workspace.purger.d.ts +28 -0
- package/dist/lib/revisions/infrastructure/purge/revisions-workspace.purger.d.ts.map +1 -0
- package/dist/lib/revisions/infrastructure/purge/revisions-workspace.purger.js +52 -0
- package/dist/lib/utils/content-plugin.d.ts.map +1 -1
- package/dist/lib/utils/content-plugin.js +10 -1
- package/dist/lib/utils/content-views-plugin.d.ts.map +1 -1
- package/dist/lib/utils/content-views-plugin.js +8 -0
- package/dist/lib/views/application/use-cases/create-saved-view.use-case.d.ts +4 -1
- package/dist/lib/views/application/use-cases/create-saved-view.use-case.d.ts.map +1 -1
- package/dist/lib/views/application/use-cases/create-saved-view.use-case.js +33 -9
- package/dist/lib/views/application/use-cases/delete-saved-view.use-case.d.ts +4 -1
- package/dist/lib/views/application/use-cases/delete-saved-view.use-case.d.ts.map +1 -1
- package/dist/lib/views/application/use-cases/delete-saved-view.use-case.js +24 -3
- package/dist/lib/views/application/use-cases/update-saved-view.use-case.d.ts +4 -1
- package/dist/lib/views/application/use-cases/update-saved-view.use-case.d.ts.map +1 -1
- package/dist/lib/views/application/use-cases/update-saved-view.use-case.js +32 -3
- package/dist/lib/views/domain/events/saved-view-events.d.ts +28 -0
- package/dist/lib/views/domain/events/saved-view-events.d.ts.map +1 -0
- package/dist/lib/views/domain/events/saved-view-events.js +38 -0
- package/dist/lib/views/infrastructure/persistence/drizzle-saved-view.repository.d.ts +12 -3
- package/dist/lib/views/infrastructure/persistence/drizzle-saved-view.repository.d.ts.map +1 -1
- package/dist/lib/views/infrastructure/persistence/drizzle-saved-view.repository.js +15 -5
- package/package.json +11 -11
- package/dist/lib/entries/controllers/bulk-entries.controller.d.ts +0 -26
- package/dist/lib/entries/controllers/bulk-entries.controller.d.ts.map +0 -1
- package/dist/lib/entries/controllers/create-entry.controller.d.ts +0 -20
- package/dist/lib/entries/controllers/create-entry.controller.d.ts.map +0 -1
- package/dist/lib/entries/controllers/delete-entry.controller.d.ts +0 -24
- package/dist/lib/entries/controllers/delete-entry.controller.d.ts.map +0 -1
- package/dist/lib/entries/controllers/get-entry.controller.d.ts +0 -34
- package/dist/lib/entries/controllers/get-entry.controller.d.ts.map +0 -1
- package/dist/lib/entries/controllers/list-entries.controller.d.ts +0 -20
- package/dist/lib/entries/controllers/list-entries.controller.d.ts.map +0 -1
- package/dist/lib/entries/controllers/publish-entry.controller.d.ts +0 -19
- package/dist/lib/entries/controllers/publish-entry.controller.d.ts.map +0 -1
- package/dist/lib/entries/controllers/resolve-type.d.ts +0 -9
- package/dist/lib/entries/controllers/resolve-type.d.ts.map +0 -1
- package/dist/lib/entries/controllers/update-entry.controller.d.ts +0 -18
- package/dist/lib/entries/controllers/update-entry.controller.d.ts.map +0 -1
- package/dist/lib/entries/dto/bulk-ids.dto.d.ts +0 -11
- package/dist/lib/entries/dto/bulk-ids.dto.d.ts.map +0 -1
- package/dist/lib/entries/dto/list-entries-query.dto.d.ts +0 -46
- package/dist/lib/entries/dto/list-entries-query.dto.d.ts.map +0 -1
- package/dist/lib/entries/dto/relation-delta-map.validator.d.ts +0 -19
- package/dist/lib/entries/dto/relation-delta-map.validator.d.ts.map +0 -1
- package/dist/lib/entries/dto/save-entry.dto.d.ts +0 -46
- package/dist/lib/entries/dto/save-entry.dto.d.ts.map +0 -1
- package/dist/lib/entries/infrastructure/persistence/field-selection.d.ts +0 -24
- package/dist/lib/entries/infrastructure/persistence/field-selection.d.ts.map +0 -1
- package/dist/lib/entries/infrastructure/queries/entry-filter-schema.d.ts +0 -40
- package/dist/lib/entries/infrastructure/queries/entry-filter-schema.d.ts.map +0 -1
- package/dist/lib/entries/services/entries.service.d.ts +0 -59
- package/dist/lib/entries/services/entries.service.d.ts.map +0 -1
- package/dist/lib/entries/services/entry-counter.service.d.ts +0 -31
- package/dist/lib/entries/services/entry-counter.service.d.ts.map +0 -1
- package/dist/lib/entries/services/entry-filter-schema.d.ts +0 -32
- package/dist/lib/entries/services/entry-filter-schema.d.ts.map +0 -1
- package/dist/lib/entries/services/entry-row.d.ts +0 -56
- package/dist/lib/entries/services/entry-row.d.ts.map +0 -1
- package/dist/lib/entries/services/entry-writer.service.d.ts +0 -193
- package/dist/lib/entries/services/entry-writer.service.d.ts.map +0 -1
- package/dist/lib/entries/services/relation-link.service.d.ts +0 -115
- package/dist/lib/entries/services/relation-link.service.d.ts.map +0 -1
- package/dist/lib/extension/entry-access-source.d.ts +0 -112
- package/dist/lib/extension/entry-access-source.d.ts.map +0 -1
- package/dist/lib/extension/entry-write-hook.d.ts +0 -98
- package/dist/lib/extension/entry-write-hook.d.ts.map +0 -1
- package/dist/lib/extension/per-locale-relation.d.ts +0 -18
- package/dist/lib/extension/per-locale-relation.d.ts.map +0 -1
- package/dist/lib/public/controllers/get-public-entry.controller.d.ts +0 -26
- package/dist/lib/public/controllers/get-public-entry.controller.d.ts.map +0 -1
- package/dist/lib/public/controllers/list-public-entries.controller.d.ts +0 -24
- package/dist/lib/public/controllers/list-public-entries.controller.d.ts.map +0 -1
- package/dist/lib/public/controllers/public-schema.controller.d.ts +0 -18
- package/dist/lib/public/controllers/public-schema.controller.d.ts.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ENTRY_EVENT_KINDS = void 0;
|
|
4
|
+
exports.entrySubjectPayload = entrySubjectPayload;
|
|
4
5
|
exports.entryEvent = entryEvent;
|
|
5
6
|
exports.entryCreated = entryCreated;
|
|
6
7
|
exports.entryUpdated = entryUpdated;
|
|
@@ -37,6 +38,21 @@ exports.ENTRY_EVENT_KINDS = {
|
|
|
37
38
|
};
|
|
38
39
|
/** The aggregate type stamped on every entry domain event. */
|
|
39
40
|
const AGGREGATE_TYPE = 'content_entry';
|
|
41
|
+
/**
|
|
42
|
+
* The subject fields every entry event's payload carries.
|
|
43
|
+
*
|
|
44
|
+
* Exported because the {@link Entry} model raises its two events through the
|
|
45
|
+
* envelope builder directly rather than the per-kind helpers — those two are
|
|
46
|
+
* status transitions the model owns, and it must produce the same payload shape
|
|
47
|
+
* as the five the write path mints.
|
|
48
|
+
*/
|
|
49
|
+
function entrySubjectPayload(subject) {
|
|
50
|
+
return {
|
|
51
|
+
contentType: subject.contentType,
|
|
52
|
+
workspaceId: subject.workspaceId ?? null,
|
|
53
|
+
title: subject.title ?? null
|
|
54
|
+
};
|
|
55
|
+
}
|
|
40
56
|
/**
|
|
41
57
|
* Builds an entry {@link DomainEvent} of `kind` for `entryId`, carrying
|
|
42
58
|
* `payload`. Keeps the domain model free of the event envelope's plumbing — the
|
|
@@ -51,8 +67,8 @@ function entryEvent(kind, entryId, payload) {
|
|
|
51
67
|
});
|
|
52
68
|
}
|
|
53
69
|
/** A new entry exists. `contentType` is what lets the log name *what* was made. */
|
|
54
|
-
function entryCreated(entryId,
|
|
55
|
-
return entryEvent(exports.ENTRY_EVENT_KINDS.CREATED, entryId,
|
|
70
|
+
function entryCreated(entryId, subject) {
|
|
71
|
+
return entryEvent(exports.ENTRY_EVENT_KINDS.CREATED, entryId, entrySubjectPayload(subject));
|
|
56
72
|
}
|
|
57
73
|
/**
|
|
58
74
|
* An entry's stored values changed, naming **which fields** did.
|
|
@@ -66,9 +82,9 @@ function entryCreated(entryId, contentType) {
|
|
|
66
82
|
* and therefore no event at all, so the log records editorial changes rather
|
|
67
83
|
* than round trips.
|
|
68
84
|
*/
|
|
69
|
-
function entryUpdated(entryId,
|
|
85
|
+
function entryUpdated(entryId, subject, fields) {
|
|
70
86
|
return entryEvent(exports.ENTRY_EVENT_KINDS.UPDATED, entryId, {
|
|
71
|
-
|
|
87
|
+
...entrySubjectPayload(subject),
|
|
72
88
|
fields: [...fields]
|
|
73
89
|
});
|
|
74
90
|
}
|
|
@@ -78,15 +94,15 @@ function entryUpdated(entryId, contentType, fields) {
|
|
|
78
94
|
* while any other type is gone from the table the moment this commits, and a
|
|
79
95
|
* reviewer reading the log needs to know which happened.
|
|
80
96
|
*/
|
|
81
|
-
function entryDeleted(entryId,
|
|
97
|
+
function entryDeleted(entryId, subject, soft) {
|
|
82
98
|
return entryEvent(exports.ENTRY_EVENT_KINDS.DELETED, entryId, {
|
|
83
|
-
|
|
99
|
+
...entrySubjectPayload(subject),
|
|
84
100
|
soft
|
|
85
101
|
});
|
|
86
102
|
}
|
|
87
103
|
/** A soft-deleted entry's tombstone was cleared. */
|
|
88
|
-
function entryRestored(entryId,
|
|
89
|
-
return entryEvent(exports.ENTRY_EVENT_KINDS.RESTORED, entryId,
|
|
104
|
+
function entryRestored(entryId, subject) {
|
|
105
|
+
return entryEvent(exports.ENTRY_EVENT_KINDS.RESTORED, entryId, entrySubjectPayload(subject));
|
|
90
106
|
}
|
|
91
107
|
/**
|
|
92
108
|
* A tombstoned entry was destroyed permanently.
|
|
@@ -95,6 +111,6 @@ function entryRestored(entryId, contentType) {
|
|
|
95
111
|
* action with nothing left behind to inspect afterwards, so it is exactly the
|
|
96
112
|
* one an audit trail has to record distinctly.
|
|
97
113
|
*/
|
|
98
|
-
function entryPurged(entryId,
|
|
99
|
-
return entryEvent(exports.ENTRY_EVENT_KINDS.PURGED, entryId,
|
|
114
|
+
function entryPurged(entryId, subject) {
|
|
115
|
+
return entryEvent(exports.ENTRY_EVENT_KINDS.PURGED, entryId, entrySubjectPayload(subject));
|
|
100
116
|
}
|
|
@@ -3,8 +3,16 @@
|
|
|
3
3
|
export declare const DEFAULT_PAGE_SIZE = 25;
|
|
4
4
|
/** Hard cap on rows per page — bounds a single query's cost. */
|
|
5
5
|
export declare const MAX_PAGE_SIZE = 100;
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Max length of the raw `?filter=` JSON string — a coarse first guard against
|
|
8
|
+
* oversized payloads, ahead of the filter engine's own budgets.
|
|
9
|
+
*
|
|
10
|
+
* Re-exported rather than declared: the number belongs to the engine that
|
|
11
|
+
* enforces the rest of the filter's limits, and four packages each declaring
|
|
12
|
+
* their own copy is how one of them (`alarms`) came to say 8192 while the other
|
|
13
|
+
* three said 4096. See `filters/budgets.ts` in `@orthacms/utils-server`.
|
|
14
|
+
*/
|
|
15
|
+
export { FILTER_MAX_LENGTH } from '@orthacms/utils-server';
|
|
8
16
|
/** Max ids a single bulk action (`{ ids }`) may target — bounds the statement. */
|
|
9
17
|
export declare const BULK_MAX_IDS = 100;
|
|
10
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entries.constants.d.ts","sourceRoot":"","sources":["../../../src/lib/entries/entries.constants.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,gEAAgE;AAChE,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC
|
|
1
|
+
{"version":3,"file":"entries.constants.d.ts","sourceRoot":"","sources":["../../../src/lib/entries/entries.constants.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,gEAAgE;AAChE,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC;;;;;;;;GAQG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,kFAAkF;AAClF,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAC"}
|
|
@@ -6,8 +6,17 @@ exports.BULK_MAX_SAVE_ITEMS = exports.BULK_MAX_IDS = exports.FILTER_MAX_LENGTH =
|
|
|
6
6
|
exports.DEFAULT_PAGE_SIZE = 25;
|
|
7
7
|
/** Hard cap on rows per page — bounds a single query's cost. */
|
|
8
8
|
exports.MAX_PAGE_SIZE = 100;
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Max length of the raw `?filter=` JSON string — a coarse first guard against
|
|
11
|
+
* oversized payloads, ahead of the filter engine's own budgets.
|
|
12
|
+
*
|
|
13
|
+
* Re-exported rather than declared: the number belongs to the engine that
|
|
14
|
+
* enforces the rest of the filter's limits, and four packages each declaring
|
|
15
|
+
* their own copy is how one of them (`alarms`) came to say 8192 while the other
|
|
16
|
+
* three said 4096. See `filters/budgets.ts` in `@orthacms/utils-server`.
|
|
17
|
+
*/
|
|
18
|
+
var utils_server_1 = require("@orthacms/utils-server");
|
|
19
|
+
Object.defineProperty(exports, "FILTER_MAX_LENGTH", { enumerable: true, get: function () { return utils_server_1.FILTER_MAX_LENGTH; } });
|
|
11
20
|
/** Max ids a single bulk action (`{ ids }`) may target — bounds the statement. */
|
|
12
21
|
exports.BULK_MAX_IDS = 100;
|
|
13
22
|
/**
|
|
@@ -24,8 +24,8 @@ export declare class BulkEntriesController {
|
|
|
24
24
|
constructor(registry: ContentTypeRegistry, writer: EntryWriterService, bulkPublishPreview: BulkPublishPreviewQuery, bulkPublishEntries: BulkPublishEntriesUseCase, bulkUnpublishEntries: BulkUnpublishEntriesUseCase);
|
|
25
25
|
/** Dry run: validate each id and report a per-entry verdict. Writes nothing. */
|
|
26
26
|
previewPublish(typeName: string, body: BulkIdsDto, workspaceId: string): Promise<BulkPublishPreview>;
|
|
27
|
-
publish(typeName: string, body: BulkIdsDto, workspaceId: string): Promise<BulkPublishResult>;
|
|
28
|
-
unpublish(typeName: string, body: BulkIdsDto, workspaceId: string): Promise<BulkActionResult>;
|
|
27
|
+
publish(typeName: string, body: BulkIdsDto, workspaceId: string, user?: PublicUser): Promise<BulkPublishResult>;
|
|
28
|
+
unpublish(typeName: string, body: BulkIdsDto, workspaceId: string, user?: PublicUser): Promise<BulkActionResult>;
|
|
29
29
|
remove(typeName: string, body: BulkIdsDto, workspaceId: string, user?: PublicUser): Promise<BulkActionResult>;
|
|
30
30
|
restore(typeName: string, body: BulkIdsDto, workspaceId: string, user?: PublicUser): Promise<BulkActionResult>;
|
|
31
31
|
purge(typeName: string, body: BulkIdsDto, workspaceId: string, user?: PublicUser): Promise<BulkActionResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk-entries.controller.d.ts","sourceRoot":"","sources":["../../../../../src/lib/entries/http/controllers/bulk-entries.controller.ts"],"names":[],"mappings":"AASA,OAAO,EAKH,KAAK,UAAU,EAElB,MAAM,2BAA2B,CAAC;AAInC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,2DAA2D,CAAC;AACtG,OAAO,EAAE,2BAA2B,EAAE,MAAM,6DAA6D,CAAC;AAC1G,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EACR,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACpB,MAAM,0BAA0B,CAAC;AAIlC;;;;;;;;GAQG;AACH,qBAEa,qBAAqB;IAG1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAJpB,QAAQ,EAAE,mBAAmB,EAC7B,MAAM,EAAE,kBAAkB,EAC1B,kBAAkB,EAAE,uBAAuB,EAC3C,kBAAkB,EAAE,yBAAyB,EAC7C,oBAAoB,EAAE,2BAA2B;IAGtE,gFAAgF;IAIhF,cAAc,CACS,QAAQ,EAAE,MAAM,EAC3B,IAAI,EAAE,UAAU,EACJ,WAAW,EAAE,MAAM,GACxC,OAAO,CAAC,kBAAkB,CAAC;IAQ9B,OAAO,CACgB,QAAQ,EAAE,MAAM,EAC3B,IAAI,EAAE,UAAU,EACJ,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"bulk-entries.controller.d.ts","sourceRoot":"","sources":["../../../../../src/lib/entries/http/controllers/bulk-entries.controller.ts"],"names":[],"mappings":"AASA,OAAO,EAKH,KAAK,UAAU,EAElB,MAAM,2BAA2B,CAAC;AAInC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,MAAM,2DAA2D,CAAC;AACtG,OAAO,EAAE,2BAA2B,EAAE,MAAM,6DAA6D,CAAC;AAC1G,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EACR,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACpB,MAAM,0BAA0B,CAAC;AAIlC;;;;;;;;GAQG;AACH,qBAEa,qBAAqB;IAG1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBAJpB,QAAQ,EAAE,mBAAmB,EAC7B,MAAM,EAAE,kBAAkB,EAC1B,kBAAkB,EAAE,uBAAuB,EAC3C,kBAAkB,EAAE,yBAAyB,EAC7C,oBAAoB,EAAE,2BAA2B;IAGtE,gFAAgF;IAIhF,cAAc,CACS,QAAQ,EAAE,MAAM,EAC3B,IAAI,EAAE,UAAU,EACJ,WAAW,EAAE,MAAM,GACxC,OAAO,CAAC,kBAAkB,CAAC;IAQ9B,OAAO,CACgB,QAAQ,EAAE,MAAM,EAC3B,IAAI,EAAE,UAAU,EACJ,WAAW,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,UAAU,GACjC,OAAO,CAAC,iBAAiB,CAAC;IAa7B,SAAS,CACc,QAAQ,EAAE,MAAM,EAC3B,IAAI,EAAE,UAAU,EACJ,WAAW,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,UAAU,GACjC,OAAO,CAAC,gBAAgB,CAAC;IAa5B,MAAM,CACiB,QAAQ,EAAE,MAAM,EAC3B,IAAI,EAAE,UAAU,EACJ,WAAW,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,UAAU,GACjC,OAAO,CAAC,gBAAgB,CAAC;IAa5B,OAAO,CACgB,QAAQ,EAAE,MAAM,EAC3B,IAAI,EAAE,UAAU,EACJ,WAAW,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,UAAU,GACjC,OAAO,CAAC,gBAAgB,CAAC;IAa5B,KAAK,CACkB,QAAQ,EAAE,MAAM,EAC3B,IAAI,EAAE,UAAU,EACJ,WAAW,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,UAAU,GACjC,OAAO,CAAC,gBAAgB,CAAC;CAS/B"}
|
|
@@ -41,13 +41,13 @@ let BulkEntriesController = class BulkEntriesController {
|
|
|
41
41
|
const type = (0, resolve_type_1.resolveType)(this.registry, typeName);
|
|
42
42
|
return this.bulkPublishPreview.preview(type, body.ids, workspaceId);
|
|
43
43
|
}
|
|
44
|
-
publish(typeName, body, workspaceId) {
|
|
44
|
+
publish(typeName, body, workspaceId, user) {
|
|
45
45
|
const type = (0, resolve_type_1.resolveType)(this.registry, typeName);
|
|
46
|
-
return this.bulkPublishEntries.execute(type, body.ids, workspaceId);
|
|
46
|
+
return this.bulkPublishEntries.execute(type, body.ids, workspaceId, (0, to_actor_1.toActor)(user));
|
|
47
47
|
}
|
|
48
|
-
unpublish(typeName, body, workspaceId) {
|
|
48
|
+
unpublish(typeName, body, workspaceId, user) {
|
|
49
49
|
const type = (0, resolve_type_1.resolveType)(this.registry, typeName);
|
|
50
|
-
return this.bulkUnpublishEntries.execute(type, body.ids, workspaceId);
|
|
50
|
+
return this.bulkUnpublishEntries.execute(type, body.ids, workspaceId, (0, to_actor_1.toActor)(user));
|
|
51
51
|
}
|
|
52
52
|
remove(typeName, body, workspaceId, user) {
|
|
53
53
|
const type = (0, resolve_type_1.resolveType)(this.registry, typeName);
|
|
@@ -81,8 +81,9 @@ tslib_1.__decorate([
|
|
|
81
81
|
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
82
82
|
tslib_1.__param(1, (0, common_1.Body)()),
|
|
83
83
|
tslib_1.__param(2, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
84
|
+
tslib_1.__param(3, (0, identity_server_1.CurrentUser)()),
|
|
84
85
|
tslib_1.__metadata("design:type", Function),
|
|
85
|
-
tslib_1.__metadata("design:paramtypes", [String, bulk_ids_dto_1.BulkIdsDto, String]),
|
|
86
|
+
tslib_1.__metadata("design:paramtypes", [String, bulk_ids_dto_1.BulkIdsDto, String, Object]),
|
|
86
87
|
tslib_1.__metadata("design:returntype", Promise)
|
|
87
88
|
], BulkEntriesController.prototype, "publish", null);
|
|
88
89
|
tslib_1.__decorate([
|
|
@@ -92,8 +93,9 @@ tslib_1.__decorate([
|
|
|
92
93
|
tslib_1.__param(0, (0, common_1.Param)('typeName')),
|
|
93
94
|
tslib_1.__param(1, (0, common_1.Body)()),
|
|
94
95
|
tslib_1.__param(2, (0, workspaces_server_1.CurrentWorkspace)()),
|
|
96
|
+
tslib_1.__param(3, (0, identity_server_1.CurrentUser)()),
|
|
95
97
|
tslib_1.__metadata("design:type", Function),
|
|
96
|
-
tslib_1.__metadata("design:paramtypes", [String, bulk_ids_dto_1.BulkIdsDto, String]),
|
|
98
|
+
tslib_1.__metadata("design:paramtypes", [String, bulk_ids_dto_1.BulkIdsDto, String, Object]),
|
|
97
99
|
tslib_1.__metadata("design:returntype", Promise)
|
|
98
100
|
], BulkEntriesController.prototype, "unpublish", null);
|
|
99
101
|
tslib_1.__decorate([
|
|
@@ -51,16 +51,32 @@ export declare class EntryWriterService {
|
|
|
51
51
|
* `uow.run(...)`, where the two are the same object.
|
|
52
52
|
*/
|
|
53
53
|
private tx;
|
|
54
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* One event per affected row, built from each row's own id **and the row
|
|
56
|
+
* itself** — the latter because an entry event carries a frozen `title`
|
|
57
|
+
* snapshot, and a title is per row rather than per batch.
|
|
58
|
+
*/
|
|
55
59
|
private eventsFor;
|
|
60
|
+
/**
|
|
61
|
+
* What an entry event says about its subject: the type, the workspace, and
|
|
62
|
+
* a **frozen** human label read off the row being written.
|
|
63
|
+
*
|
|
64
|
+
* Frozen rather than looked up, for the same reason `actor_email` is: the
|
|
65
|
+
* audit row has to outlive its subject. `entry.purged` destroys the only
|
|
66
|
+
* other copy of the name, so a row that stored just the uuid could never
|
|
67
|
+
* answer "what did they delete" — not even in principle.
|
|
68
|
+
*/
|
|
69
|
+
private subjectOf;
|
|
56
70
|
/**
|
|
57
71
|
* Append `events` to the transactional outbox, stamped with the acting
|
|
58
|
-
*
|
|
72
|
+
* principal, from inside the active unit of work.
|
|
59
73
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
74
|
+
* A **token** may be the actor here, and that is the whole difference from
|
|
75
|
+
* {@link revisionActorId} below: the audit row now carries an `actor_type`,
|
|
76
|
+
* so naming a credential is a fact rather than a misused user column. A
|
|
77
|
+
* write made with a bearer token used to reach the log as "System", which
|
|
78
|
+
* left every write over the public REST API, GraphQL and MCP unattributable
|
|
79
|
+
* to the credential that made it.
|
|
64
80
|
*/
|
|
65
81
|
private emit;
|
|
66
82
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-writer.service.d.ts","sourceRoot":"","sources":["../../../../../src/lib/entries/infrastructure/persistence/entry-writer.service.ts"],"names":[],"mappings":"AAoBA,OAAO,
|
|
1
|
+
{"version":3,"file":"entry-writer.service.d.ts","sourceRoot":"","sources":["../../../../../src/lib/entries/infrastructure/persistence/entry-writer.service.ts"],"names":[],"mappings":"AAoBA,OAAO,EAIH,YAAY,EACZ,UAAU,EACV,KAAK,QAAQ,EAEb,KAAK,UAAU,EAClB,MAAM,oBAAoB,CAAC;AAO5B,OAAO,EAEH,KAAK,qBAAqB,EAC7B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAEH,KAAK,kBAAkB,EAC1B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AAEvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAGlE,OAAO,EACH,sBAAsB,EACtB,KAAK,eAAe,EACvB,MAAM,uDAAuD,CAAC;AAC/D,OAAO,KAAK,EACR,WAAW,EACX,aAAa,EACb,iBAAiB,EACpB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAQjE,OAAO,EAEH,mBAAmB,EACnB,KAAK,aAAa,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEH,KAAK,aAAa,EACrB,MAAM,qDAAqD,CAAC;AAY7D,oFAAoF;AACpF,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAenC;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBACa,kBAAkB;IAEL,OAAO,CAAC,QAAQ,CAAC,EAAE;IAIrC,OA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eAAe;YAcf,aAAa;IA8C3B,2EAA2E;IAC3E,OAAO,CAAC,OAAO;IAIf;;;;OAIG;IACH,OAAO,CAAC,KAAK;IAIb;;;OAGG;IACH,OAAO,CAAC,SAAS;IAajB;;;;OAIG;IACG,QAAQ,CACV,IAAI,EAAE,cAAc,EACpB,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,MAAM,EACnB,IAAI,GAAE,QAAQ,GAAG,aAAuB,GACzC,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;IAS3B;;;;OAIG;IACG,aAAa,CACf,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,MAAM,EAAE,EACb,WAAW,EAAE,MAAM,EACnB,IAAI,GAAE,QAAQ,GAAG,aAAuB,GACzC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAgB5B;;;;;;;;;;;;;OAaG;IACH;;;;;;;;;;;;;;;;;;OAkBG;YACW,qBAAqB;YA4DrB,qBAAqB;IAiHnC;;;;;;;;;;;;;;OAcG;YACW,kBAAkB;IAoDhC;;;;;;;;;;OAUG;YACW,uBAAuB;IAoBrC;;;;;;;;OAQG;IACG,sBAAsB,CACxB,IAAI,EAAE,QAAQ,GAAG,aAAa,EAC9B,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,eAAe,EAAE,CAAC;IA8B7B,qEAAqE;IACrE,OAAO,CAAC,WAAW;IAanB,0DAA0D;IAC1D,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,QAAQ;CAKnB"}
|
|
@@ -97,18 +97,40 @@ let EntryWriterService = class EntryWriterService {
|
|
|
97
97
|
tx() {
|
|
98
98
|
return this.uow.current();
|
|
99
99
|
}
|
|
100
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* One event per affected row, built from each row's own id **and the row
|
|
102
|
+
* itself** — the latter because an entry event carries a frozen `title`
|
|
103
|
+
* snapshot, and a title is per row rather than per batch.
|
|
104
|
+
*/
|
|
101
105
|
eventsFor(rows, build) {
|
|
102
|
-
return rows.map((row) => build(row['id']));
|
|
106
|
+
return rows.map((row) => build(row['id'], row));
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* What an entry event says about its subject: the type, the workspace, and
|
|
110
|
+
* a **frozen** human label read off the row being written.
|
|
111
|
+
*
|
|
112
|
+
* Frozen rather than looked up, for the same reason `actor_email` is: the
|
|
113
|
+
* audit row has to outlive its subject. `entry.purged` destroys the only
|
|
114
|
+
* other copy of the name, so a row that stored just the uuid could never
|
|
115
|
+
* answer "what did they delete" — not even in principle.
|
|
116
|
+
*/
|
|
117
|
+
subjectOf(type, workspaceId, row) {
|
|
118
|
+
return {
|
|
119
|
+
contentType: type.name,
|
|
120
|
+
workspaceId,
|
|
121
|
+
title: row ? (0, entry_row_1.entryTitle)(type, row) : null
|
|
122
|
+
};
|
|
103
123
|
}
|
|
104
124
|
/**
|
|
105
125
|
* Append `events` to the transactional outbox, stamped with the acting
|
|
106
|
-
*
|
|
126
|
+
* principal, from inside the active unit of work.
|
|
107
127
|
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
128
|
+
* A **token** may be the actor here, and that is the whole difference from
|
|
129
|
+
* {@link revisionActorId} below: the audit row now carries an `actor_type`,
|
|
130
|
+
* so naming a credential is a fact rather than a misused user column. A
|
|
131
|
+
* write made with a bearer token used to reach the log as "System", which
|
|
132
|
+
* left every write over the public REST API, GraphQL and MCP unattributable
|
|
133
|
+
* to the credential that made it.
|
|
112
134
|
*/
|
|
113
135
|
async emit(events, actor) {
|
|
114
136
|
if (events.length === 0)
|
|
@@ -330,7 +352,7 @@ let EntryWriterService = class EntryWriterService {
|
|
|
330
352
|
* this transaction and has it captured by the same version.
|
|
331
353
|
*/
|
|
332
354
|
async create(type, values, workspaceId, relations, locale, localeGroupId, actor, extensions) {
|
|
333
|
-
const actorId = actor
|
|
355
|
+
const actorId = revisionActorId(actor);
|
|
334
356
|
// `coerceValues` stamps every declared field onto the bag, so the
|
|
335
357
|
// "sent in both places" check below has to read the RAW body — after
|
|
336
358
|
// coercion every field looks present.
|
|
@@ -437,7 +459,9 @@ let EntryWriterService = class EntryWriterService {
|
|
|
437
459
|
// Inside the transaction, so the fact and the row it
|
|
438
460
|
// describes commit together or not at all — the whole point
|
|
439
461
|
// of the outbox.
|
|
440
|
-
await this.emit([
|
|
462
|
+
await this.emit([
|
|
463
|
+
(0, entry_events_1.entryCreated)(id, this.subjectOf(type, workspaceId, inserted))
|
|
464
|
+
], actor);
|
|
441
465
|
return inserted;
|
|
442
466
|
}), type);
|
|
443
467
|
return (0, entry_row_1.toRecord)(type, row);
|
|
@@ -517,7 +541,7 @@ let EntryWriterService = class EntryWriterService {
|
|
|
517
541
|
* type validates now.
|
|
518
542
|
*/
|
|
519
543
|
async update(type, id, values, workspaceId, relations, actor, options) {
|
|
520
|
-
const actorId = actor
|
|
544
|
+
const actorId = revisionActorId(actor);
|
|
521
545
|
let coerced = (0, entry_row_1.coerceValues)(type, values);
|
|
522
546
|
// The row's own locale is what a relation link must match. Read up front
|
|
523
547
|
// (one indexed lookup, and only on localized types) so the pre-transaction
|
|
@@ -613,7 +637,9 @@ let EntryWriterService = class EntryWriterService {
|
|
|
613
637
|
// trip, not an editorial change, and the log is read by people.
|
|
614
638
|
const fields = this.changedFields(type, before, updated);
|
|
615
639
|
if (fields.length > 0) {
|
|
616
|
-
await this.emit([
|
|
640
|
+
await this.emit([
|
|
641
|
+
(0, entry_events_1.entryUpdated)(id, this.subjectOf(type, workspaceId, updated), fields)
|
|
642
|
+
], actor);
|
|
617
643
|
}
|
|
618
644
|
return updated;
|
|
619
645
|
});
|
|
@@ -782,7 +808,9 @@ let EntryWriterService = class EntryWriterService {
|
|
|
782
808
|
.returning(), type);
|
|
783
809
|
if (!row)
|
|
784
810
|
throw this.notFound(type, id);
|
|
785
|
-
await this.emit([
|
|
811
|
+
await this.emit([
|
|
812
|
+
(0, entry_events_1.entryDeleted)(id, this.subjectOf(type, workspaceId, row), Boolean(type.paranoid))
|
|
813
|
+
], actor);
|
|
786
814
|
});
|
|
787
815
|
}
|
|
788
816
|
/**
|
|
@@ -806,7 +834,9 @@ let EntryWriterService = class EntryWriterService {
|
|
|
806
834
|
.returning(), type);
|
|
807
835
|
if (!row)
|
|
808
836
|
throw this.notFound(type, id);
|
|
809
|
-
await this.emit([
|
|
837
|
+
await this.emit([
|
|
838
|
+
(0, entry_events_1.entryRestored)(id, this.subjectOf(type, workspaceId, row))
|
|
839
|
+
], actor);
|
|
810
840
|
return (0, entry_row_1.toRecord)(type, row);
|
|
811
841
|
});
|
|
812
842
|
}
|
|
@@ -824,7 +854,9 @@ let EntryWriterService = class EntryWriterService {
|
|
|
824
854
|
throw this.notFound(type, id);
|
|
825
855
|
// The one content action that leaves nothing behind to inspect, so
|
|
826
856
|
// the event is the only remaining record that it happened.
|
|
827
|
-
await this.emit([
|
|
857
|
+
await this.emit([
|
|
858
|
+
(0, entry_events_1.entryPurged)(id, this.subjectOf(type, workspaceId, row))
|
|
859
|
+
], actor);
|
|
828
860
|
});
|
|
829
861
|
}
|
|
830
862
|
/** Delete a set of entries: soft for paranoid types, hard otherwise. */
|
|
@@ -850,7 +882,7 @@ let EntryWriterService = class EntryWriterService {
|
|
|
850
882
|
.returning(), type);
|
|
851
883
|
// One event per row actually removed, not one per id asked for:
|
|
852
884
|
// batching is a way of asking, and the log records what happened.
|
|
853
|
-
await this.emit(this.eventsFor(rows, (id) => (0, entry_events_1.entryDeleted)(id, type
|
|
885
|
+
await this.emit(this.eventsFor(rows, (id, row) => (0, entry_events_1.entryDeleted)(id, this.subjectOf(type, workspaceId, row), Boolean(type.paranoid))), actor);
|
|
854
886
|
return { count: rows.length };
|
|
855
887
|
});
|
|
856
888
|
}
|
|
@@ -866,7 +898,7 @@ let EntryWriterService = class EntryWriterService {
|
|
|
866
898
|
.delete(type.table)
|
|
867
899
|
.where((0, drizzle_orm_1.and)((0, drizzle_orm_1.inArray)(t['id'], ids), this.scope(type, workspaceId), (0, drizzle_orm_1.isNotNull)(t['deletedAt'])))
|
|
868
900
|
.returning(), type);
|
|
869
|
-
await this.emit(this.eventsFor(rows, (id) => (0, entry_events_1.entryPurged)(id, type
|
|
901
|
+
await this.emit(this.eventsFor(rows, (id, row) => (0, entry_events_1.entryPurged)(id, this.subjectOf(type, workspaceId, row))), actor);
|
|
870
902
|
return { count: rows.length };
|
|
871
903
|
});
|
|
872
904
|
}
|
|
@@ -891,7 +923,7 @@ let EntryWriterService = class EntryWriterService {
|
|
|
891
923
|
})
|
|
892
924
|
.where((0, drizzle_orm_1.and)((0, drizzle_orm_1.inArray)(t['id'], ids), this.scope(type, workspaceId), (0, drizzle_orm_1.isNotNull)(t['deletedAt'])))
|
|
893
925
|
.returning(), type);
|
|
894
|
-
await this.emit(this.eventsFor(rows, (id) => (0, entry_events_1.entryRestored)(id, type
|
|
926
|
+
await this.emit(this.eventsFor(rows, (id, row) => (0, entry_events_1.entryRestored)(id, this.subjectOf(type, workspaceId, row))), actor);
|
|
895
927
|
return { count: rows.length };
|
|
896
928
|
});
|
|
897
929
|
}
|
|
@@ -1327,3 +1359,25 @@ exports.EntryWriterService = EntryWriterService = tslib_1.__decorate([
|
|
|
1327
1359
|
entry_validation_service_1.EntryValidationService,
|
|
1328
1360
|
relation_link_service_1.RelationLinkService, Object, entry_write_extension_1.EntryWriteExtensionRegistry, Object, Object])
|
|
1329
1361
|
], EntryWriterService);
|
|
1362
|
+
/**
|
|
1363
|
+
* The **user** id to stamp on a revision, or `null` when the writer is not a
|
|
1364
|
+
* person.
|
|
1365
|
+
*
|
|
1366
|
+
* `content_entry_revisions.created_by` records a `users` row. A token is not
|
|
1367
|
+
* one, so writing its id there would make the history resolve every version to
|
|
1368
|
+
* a nonexistent person — which is why the public API used to pass no actor at
|
|
1369
|
+
* all rather than pass the token. The audit path has since gained an
|
|
1370
|
+
* `actor_type` and can name a credential honestly, so the two answers had to be
|
|
1371
|
+
* separated: {@link EntryWriterService.emit} gets the real principal, and this
|
|
1372
|
+
* gets a user id or nothing.
|
|
1373
|
+
*
|
|
1374
|
+
* An actor with no `type` is a person — every actor predates the field except
|
|
1375
|
+
* the token ones that introduced it.
|
|
1376
|
+
*/
|
|
1377
|
+
function revisionActorId(actor) {
|
|
1378
|
+
if (!actor)
|
|
1379
|
+
return null;
|
|
1380
|
+
return (actor.type ?? database_1.EVENT_ACTOR_TYPE.User) === database_1.EVENT_ACTOR_TYPE.User
|
|
1381
|
+
? actor.id
|
|
1382
|
+
: null;
|
|
1383
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The content-insights pass over the host's OpenAPI document.
|
|
3
|
+
*
|
|
4
|
+
* Six widgets, six **unlike** payloads. They share a prefix and nothing else:
|
|
5
|
+
* one is a stat tile with two sparklines, one a sparse 7×24 grid, one a fixed
|
|
6
|
+
* set of age buckets, one a time series with a self-describing bucket width.
|
|
7
|
+
* Reading a family resemblance into them and describing them from one schema is
|
|
8
|
+
* how a document ends up confidently wrong, so each is written out.
|
|
9
|
+
*
|
|
10
|
+
* Separate from `docs/describe-content-api.ts` because it describes a separate
|
|
11
|
+
* surface: `/insights/*` is grouped under its own `insights` tag in the
|
|
12
|
+
* reference (the host tags by first route segment), and the widgets are read by
|
|
13
|
+
* the Insights page rather than by anything reading content.
|
|
14
|
+
*
|
|
15
|
+
* Pure: it takes the document and mutates only these six operations.
|
|
16
|
+
*/
|
|
17
|
+
import type { OpenApiDocument } from '@orthacms/bootstrap-server';
|
|
18
|
+
import type { OpenApiSchema } from '../../docs/field-schema';
|
|
19
|
+
/** The schemas this pass adds, keyed by component name. */
|
|
20
|
+
export declare function buildContentInsightsSchemas(): Record<string, OpenApiSchema>;
|
|
21
|
+
/** Adds the content-insights schemas and describes the six widget routes. */
|
|
22
|
+
export declare function describeContentInsightsApi(document: OpenApiDocument): void;
|
|
23
|
+
//# sourceMappingURL=describe-content-insights-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe-content-insights-api.d.ts","sourceRoot":"","sources":["../../../../src/lib/insights/docs/describe-content-insights-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAyP7D,2DAA2D;AAC3D,wBAAgB,2BAA2B,IAAI,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAS3E;AA6DD,6EAA6E;AAC7E,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CA2B1E"}
|