@lacecms/application 0.1.0-rc1 → 0.1.0-rc2

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.
Files changed (267) hide show
  1. package/dist/{email.d.ts → accounts/email.d.ts} +1 -8
  2. package/dist/accounts/email.d.ts.map +1 -0
  3. package/dist/accounts/email.js.map +1 -0
  4. package/dist/accounts/import-tokens.d.ts +11 -0
  5. package/dist/accounts/import-tokens.d.ts.map +1 -0
  6. package/dist/accounts/import-tokens.js +24 -0
  7. package/dist/accounts/import-tokens.js.map +1 -0
  8. package/dist/{oauth.d.ts → accounts/oauth.d.ts} +1 -1
  9. package/dist/accounts/oauth.d.ts.map +1 -0
  10. package/dist/accounts/oauth.js.map +1 -0
  11. package/dist/accounts/use-cases.d.ts +147 -0
  12. package/dist/accounts/use-cases.d.ts.map +1 -0
  13. package/dist/{accounts.js → accounts/use-cases.js} +8 -28
  14. package/dist/accounts/use-cases.js.map +1 -0
  15. package/dist/builds/export-pages.d.ts +14 -0
  16. package/dist/builds/export-pages.d.ts.map +1 -0
  17. package/dist/builds/export-pages.js +28 -0
  18. package/dist/builds/export-pages.js.map +1 -0
  19. package/dist/{site-build-tracker.d.ts → builds/tracker.d.ts} +3 -2
  20. package/dist/builds/tracker.d.ts.map +1 -0
  21. package/dist/{site-build-tracker.js → builds/tracker.js} +1 -1
  22. package/dist/builds/tracker.js.map +1 -0
  23. package/dist/{site-build-use-cases.d.ts → builds/use-cases.d.ts} +5 -4
  24. package/dist/builds/use-cases.d.ts.map +1 -0
  25. package/dist/{site-build-use-cases.js → builds/use-cases.js} +1 -1
  26. package/dist/builds/use-cases.js.map +1 -0
  27. package/dist/configuration/apply.d.ts +42 -0
  28. package/dist/configuration/apply.d.ts.map +1 -0
  29. package/dist/configuration/apply.js +315 -0
  30. package/dist/configuration/apply.js.map +1 -0
  31. package/dist/configuration/decisions.d.ts +18 -0
  32. package/dist/configuration/decisions.d.ts.map +1 -0
  33. package/dist/configuration/decisions.js +368 -0
  34. package/dist/configuration/decisions.js.map +1 -0
  35. package/dist/configuration/diagnostics.d.ts +15 -0
  36. package/dist/configuration/diagnostics.d.ts.map +1 -0
  37. package/dist/configuration/diagnostics.js +33 -0
  38. package/dist/configuration/diagnostics.js.map +1 -0
  39. package/dist/configuration/evidence.d.ts +9 -0
  40. package/dist/configuration/evidence.d.ts.map +1 -0
  41. package/dist/configuration/evidence.js +194 -0
  42. package/dist/configuration/evidence.js.map +1 -0
  43. package/dist/{configuration-fields.d.ts → configuration/fields.d.ts} +2 -3
  44. package/dist/configuration/fields.d.ts.map +1 -0
  45. package/dist/{configuration-fields.js → configuration/fields.js} +6 -8
  46. package/dist/configuration/fields.js.map +1 -0
  47. package/dist/configuration/limits.d.ts +9 -0
  48. package/dist/configuration/limits.d.ts.map +1 -0
  49. package/dist/configuration/limits.js +10 -0
  50. package/dist/configuration/limits.js.map +1 -0
  51. package/dist/{configuration-links.d.ts → configuration/links.d.ts} +2 -7
  52. package/dist/configuration/links.d.ts.map +1 -0
  53. package/dist/{configuration-links.js → configuration/links.js} +2 -2
  54. package/dist/configuration/links.js.map +1 -0
  55. package/dist/configuration/migration.d.ts +19 -0
  56. package/dist/configuration/migration.d.ts.map +1 -0
  57. package/dist/{configuration-migration.js → configuration/migration.js} +2 -6
  58. package/dist/configuration/migration.js.map +1 -0
  59. package/dist/configuration/model-state.d.ts +10 -0
  60. package/dist/configuration/model-state.d.ts.map +1 -0
  61. package/dist/configuration/model-state.js +45 -0
  62. package/dist/configuration/model-state.js.map +1 -0
  63. package/dist/configuration/plan-results.d.ts +4 -0
  64. package/dist/configuration/plan-results.d.ts.map +1 -0
  65. package/dist/configuration/plan-results.js +23 -0
  66. package/dist/configuration/plan-results.js.map +1 -0
  67. package/dist/configuration/plan.d.ts +35 -0
  68. package/dist/configuration/plan.d.ts.map +1 -0
  69. package/dist/configuration/plan.js +249 -0
  70. package/dist/configuration/plan.js.map +1 -0
  71. package/dist/configuration/report.d.ts +5 -0
  72. package/dist/configuration/report.d.ts.map +1 -0
  73. package/dist/configuration/report.js +102 -0
  74. package/dist/configuration/report.js.map +1 -0
  75. package/dist/configuration/snapshot-counts.d.ts +8 -0
  76. package/dist/configuration/snapshot-counts.d.ts.map +1 -0
  77. package/dist/configuration/snapshot-counts.js +24 -0
  78. package/dist/configuration/snapshot-counts.js.map +1 -0
  79. package/dist/configuration/structure-diff.d.ts +9 -0
  80. package/dist/configuration/structure-diff.d.ts.map +1 -0
  81. package/dist/{configuration-evolution.js → configuration/structure-diff.js} +3 -263
  82. package/dist/configuration/structure-diff.js.map +1 -0
  83. package/dist/configuration/structure-hints.d.ts +5 -0
  84. package/dist/configuration/structure-hints.d.ts.map +1 -0
  85. package/dist/configuration/structure-hints.js +65 -0
  86. package/dist/configuration/structure-hints.js.map +1 -0
  87. package/dist/configuration/types.d.ts +495 -0
  88. package/dist/configuration/types.d.ts.map +1 -0
  89. package/dist/configuration/types.js +2 -0
  90. package/dist/configuration/types.js.map +1 -0
  91. package/dist/{content-authority.d.ts → content/authority.d.ts} +1 -1
  92. package/dist/content/authority.d.ts.map +1 -0
  93. package/dist/{content-authority.js → content/authority.js} +1 -1
  94. package/dist/content/authority.js.map +1 -0
  95. package/dist/content/collection-queries.d.ts +13 -0
  96. package/dist/content/collection-queries.d.ts.map +1 -0
  97. package/dist/content/collection-queries.js +109 -0
  98. package/dist/content/collection-queries.js.map +1 -0
  99. package/dist/content/draft-normalization.d.ts +45 -0
  100. package/dist/content/draft-normalization.d.ts.map +1 -0
  101. package/dist/content/draft-normalization.js +87 -0
  102. package/dist/content/draft-normalization.js.map +1 -0
  103. package/dist/content/draft-validation.d.ts +5 -0
  104. package/dist/content/draft-validation.d.ts.map +1 -0
  105. package/dist/content/draft-validation.js +65 -0
  106. package/dist/content/draft-validation.js.map +1 -0
  107. package/dist/content/internal-links.d.ts +22 -0
  108. package/dist/content/internal-links.d.ts.map +1 -0
  109. package/dist/{internal-links.js → content/internal-links.js} +6 -4
  110. package/dist/content/internal-links.js.map +1 -0
  111. package/dist/content/publication-projection.d.ts +16 -0
  112. package/dist/content/publication-projection.d.ts.map +1 -0
  113. package/dist/content/publication-projection.js +66 -0
  114. package/dist/content/publication-projection.js.map +1 -0
  115. package/dist/content/published-projection.d.ts +12 -0
  116. package/dist/content/published-projection.d.ts.map +1 -0
  117. package/dist/content/published-projection.js +30 -0
  118. package/dist/content/published-projection.js.map +1 -0
  119. package/dist/content/use-case-inputs.d.ts +139 -0
  120. package/dist/content/use-case-inputs.d.ts.map +1 -0
  121. package/dist/content/use-case-inputs.js +2 -0
  122. package/dist/content/use-case-inputs.js.map +1 -0
  123. package/dist/content/use-cases.d.ts +62 -0
  124. package/dist/content/use-cases.d.ts.map +1 -0
  125. package/dist/{content-use-cases.js → content/use-cases.js} +20 -217
  126. package/dist/content/use-cases.js.map +1 -0
  127. package/dist/index.d.ts +47 -880
  128. package/dist/index.d.ts.map +1 -1
  129. package/dist/index.js +56 -222
  130. package/dist/index.js.map +1 -1
  131. package/dist/media/helpers.d.ts +3 -0
  132. package/dist/media/helpers.d.ts.map +1 -0
  133. package/dist/media/helpers.js +8 -0
  134. package/dist/media/helpers.js.map +1 -0
  135. package/dist/{image-container.d.ts → media/image-container.d.ts} +1 -1
  136. package/dist/media/image-container.d.ts.map +1 -0
  137. package/dist/media/image-container.js.map +1 -0
  138. package/dist/media/limits.d.ts +5 -0
  139. package/dist/media/limits.d.ts.map +1 -0
  140. package/dist/media/limits.js +11 -0
  141. package/dist/media/limits.js.map +1 -0
  142. package/dist/media/metadata.d.ts +11 -0
  143. package/dist/media/metadata.d.ts.map +1 -0
  144. package/dist/media/metadata.js +73 -0
  145. package/dist/media/metadata.js.map +1 -0
  146. package/dist/media/projection.d.ts +5 -0
  147. package/dist/media/projection.d.ts.map +1 -0
  148. package/dist/media/projection.js +41 -0
  149. package/dist/media/projection.js.map +1 -0
  150. package/dist/{media-use-cases.d.ts → media/types.d.ts} +6 -57
  151. package/dist/media/types.d.ts.map +1 -0
  152. package/dist/media/types.js +2 -0
  153. package/dist/media/types.js.map +1 -0
  154. package/dist/media/upload.d.ts +9 -0
  155. package/dist/media/upload.d.ts.map +1 -0
  156. package/dist/media/upload.js +80 -0
  157. package/dist/media/upload.js.map +1 -0
  158. package/dist/media/use-cases.d.ts +46 -0
  159. package/dist/media/use-cases.d.ts.map +1 -0
  160. package/dist/{media-use-cases.js → media/use-cases.js} +15 -209
  161. package/dist/media/use-cases.js.map +1 -0
  162. package/dist/{dispatchers.d.ts → outbox/dispatchers.d.ts} +4 -1
  163. package/dist/outbox/dispatchers.d.ts.map +1 -0
  164. package/dist/{dispatchers.js → outbox/dispatchers.js} +3 -1
  165. package/dist/outbox/dispatchers.js.map +1 -0
  166. package/dist/outbox/retry-policy.d.ts +6 -0
  167. package/dist/outbox/retry-policy.d.ts.map +1 -0
  168. package/dist/outbox/retry-policy.js +29 -0
  169. package/dist/outbox/retry-policy.js.map +1 -0
  170. package/dist/ports/builds.d.ts +163 -0
  171. package/dist/ports/builds.d.ts.map +1 -0
  172. package/dist/ports/builds.js +2 -0
  173. package/dist/ports/builds.js.map +1 -0
  174. package/dist/ports/content.d.ts +269 -0
  175. package/dist/ports/content.d.ts.map +1 -0
  176. package/dist/ports/content.js +15 -0
  177. package/dist/ports/content.js.map +1 -0
  178. package/dist/ports/infrastructure.d.ts +27 -0
  179. package/dist/ports/infrastructure.d.ts.map +1 -0
  180. package/dist/ports/infrastructure.js +9 -0
  181. package/dist/ports/infrastructure.js.map +1 -0
  182. package/dist/{internal-links.d.ts → ports/links.d.ts} +2 -22
  183. package/dist/ports/links.d.ts.map +1 -0
  184. package/dist/ports/links.js +2 -0
  185. package/dist/ports/links.js.map +1 -0
  186. package/dist/ports/media.d.ts +195 -0
  187. package/dist/ports/media.d.ts.map +1 -0
  188. package/dist/ports/media.js +18 -0
  189. package/dist/ports/media.js.map +1 -0
  190. package/dist/ports/outbox.d.ts +43 -0
  191. package/dist/ports/outbox.d.ts.map +1 -0
  192. package/dist/ports/outbox.js +2 -0
  193. package/dist/ports/outbox.js.map +1 -0
  194. package/dist/ports/security.d.ts +306 -0
  195. package/dist/ports/security.d.ts.map +1 -0
  196. package/dist/ports/security.js +17 -0
  197. package/dist/ports/security.js.map +1 -0
  198. package/dist/shared/actors.d.ts +13 -0
  199. package/dist/shared/actors.d.ts.map +1 -0
  200. package/dist/shared/actors.js +12 -0
  201. package/dist/shared/actors.js.map +1 -0
  202. package/dist/shared/brands.d.ts +18 -0
  203. package/dist/shared/brands.d.ts.map +1 -0
  204. package/dist/shared/brands.js +30 -0
  205. package/dist/shared/brands.js.map +1 -0
  206. package/dist/shared/limits.d.ts +27 -0
  207. package/dist/shared/limits.d.ts.map +1 -0
  208. package/dist/shared/limits.js +27 -0
  209. package/dist/shared/limits.js.map +1 -0
  210. package/dist/shared/pagination.d.ts +7 -0
  211. package/dist/shared/pagination.d.ts.map +1 -0
  212. package/dist/shared/pagination.js +2 -0
  213. package/dist/shared/pagination.js.map +1 -0
  214. package/dist/shared/permissions.d.ts +12 -0
  215. package/dist/shared/permissions.d.ts.map +1 -0
  216. package/dist/shared/permissions.js +22 -0
  217. package/dist/shared/permissions.js.map +1 -0
  218. package/dist/shared/text.d.ts +3 -0
  219. package/dist/shared/text.d.ts.map +1 -0
  220. package/dist/shared/text.js +5 -0
  221. package/dist/shared/text.js.map +1 -0
  222. package/package.json +4 -4
  223. package/dist/accounts.d.ts +0 -301
  224. package/dist/accounts.d.ts.map +0 -1
  225. package/dist/accounts.js.map +0 -1
  226. package/dist/collection-queries.d.ts +0 -47
  227. package/dist/collection-queries.d.ts.map +0 -1
  228. package/dist/collection-queries.js +0 -171
  229. package/dist/collection-queries.js.map +0 -1
  230. package/dist/configuration-evolution.d.ts +0 -164
  231. package/dist/configuration-evolution.d.ts.map +0 -1
  232. package/dist/configuration-evolution.js.map +0 -1
  233. package/dist/configuration-fields.d.ts.map +0 -1
  234. package/dist/configuration-fields.js.map +0 -1
  235. package/dist/configuration-links.d.ts.map +0 -1
  236. package/dist/configuration-links.js.map +0 -1
  237. package/dist/configuration-migration.d.ts +0 -132
  238. package/dist/configuration-migration.d.ts.map +0 -1
  239. package/dist/configuration-migration.js.map +0 -1
  240. package/dist/configuration-sync.d.ts +0 -316
  241. package/dist/configuration-sync.d.ts.map +0 -1
  242. package/dist/configuration-sync.js +0 -1102
  243. package/dist/configuration-sync.js.map +0 -1
  244. package/dist/content-authority.d.ts.map +0 -1
  245. package/dist/content-authority.js.map +0 -1
  246. package/dist/content-use-cases.d.ts +0 -224
  247. package/dist/content-use-cases.d.ts.map +0 -1
  248. package/dist/content-use-cases.js.map +0 -1
  249. package/dist/dispatchers.d.ts.map +0 -1
  250. package/dist/dispatchers.js.map +0 -1
  251. package/dist/email.d.ts.map +0 -1
  252. package/dist/email.js.map +0 -1
  253. package/dist/image-container.d.ts.map +0 -1
  254. package/dist/image-container.js.map +0 -1
  255. package/dist/internal-links.d.ts.map +0 -1
  256. package/dist/internal-links.js.map +0 -1
  257. package/dist/media-use-cases.d.ts.map +0 -1
  258. package/dist/media-use-cases.js.map +0 -1
  259. package/dist/oauth.d.ts.map +0 -1
  260. package/dist/oauth.js.map +0 -1
  261. package/dist/site-build-tracker.d.ts.map +0 -1
  262. package/dist/site-build-tracker.js.map +0 -1
  263. package/dist/site-build-use-cases.d.ts.map +0 -1
  264. package/dist/site-build-use-cases.js.map +0 -1
  265. /package/dist/{email.js → accounts/email.js} +0 -0
  266. /package/dist/{oauth.js → accounts/oauth.js} +0 -0
  267. /package/dist/{image-container.js → media/image-container.js} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,887 +1,54 @@
1
- export * from "./content-authority.js";
2
- export * from "./oauth.js";
3
- export * from "./collection-queries.js";
4
- import type { ResolvedCollectionQuery, ListQueryLimits } from "./collection-queries.js";
5
- import type { InternalLinkReference, PublicInternalLinkReference, JsonObject } from "@lacecms/content";
6
- import type { LinkImpactAcknowledgment } from "./internal-links.js";
7
- export * from "./internal-links.js";
8
- import type { Actor, ActorId, BlockKey, Brand, CompleteDraftMutation, ContentEntry, ContentEntryId, ContentModelKey, ContentSnapshotId, DraftMediaReference, MediaFocalPoint, MediaId, MediaMetadata, PublishedSnapshot, SiteBuildFailureReason, SiteBuildId, SiteBuildProviderStage, SiteBuildStatus, TrackedSiteBuildOutcome, UnixMilliseconds } from "@lacecms/domain";
9
- import { type Permission } from "@lacecms/domain";
10
- import type { AccountSecurityPort } from "./accounts.js";
11
- import type { UserProfileReader } from "./email.js";
12
1
  export declare const packageName = "@lacecms/application";
13
2
  /** Build-export page failures the HTTP boundary maps to stable responses. */
14
3
  export { BuildExportCursorError, BuildExportVersionChangedError } from "@lacecms/domain";
15
4
  /** Portable helpers that import clients apply exactly as the server does. */
16
5
  export { isMediaFocalCoordinate, normalizeMediaTags, normalizeMediaText } from "@lacecms/domain";
17
6
  export { canonicalizeJson, encodeEntryLink } from "@lacecms/content";
18
- export * from "./accounts.js";
19
- export * from "./configuration-sync.js";
20
- export * from "./email.js";
21
- export * from "./site-build-use-cases.js";
22
- export * from "./dispatchers.js";
23
- export * from "./site-build-tracker.js";
24
- export type OpaqueCursor = Brand<string, "OpaqueCursor">;
25
- export type OpaqueTokenSecret = Brand<string, "OpaqueTokenSecret">;
26
- export type OpaqueTokenVerifier = Brand<string, "OpaqueTokenVerifier">;
27
- export type DispatcherEventId = Brand<string, "DispatcherEventId">;
28
- export type DispatcherLeaseId = Brand<string, "DispatcherLeaseId">;
29
- export type PublicationIdempotencyKey = Brand<string, "PublicationIdempotencyKey">;
30
- export type PublicationRequestFingerprint = Brand<string, "PublicationRequestFingerprint">;
31
- export declare function opaqueCursor(value: string): OpaqueCursor;
32
- export declare function opaqueTokenSecret(value: string): OpaqueTokenSecret;
33
- export declare function opaqueTokenVerifier(value: string): OpaqueTokenVerifier;
34
- export declare function dispatcherEventId(value: string): DispatcherEventId;
35
- export declare function dispatcherLeaseId(value: string): DispatcherLeaseId;
36
- /** A caller-supplied key that makes one guarded publication retry-safe. */
37
- export declare function publicationIdempotencyKey(value: string): PublicationIdempotencyKey;
38
- /** Canonical application-generated identity of the complete publication request. */
39
- export declare function publicationRequestFingerprint(value: string): PublicationRequestFingerprint;
40
- /** A transport-neutral cursor page. Cursors are intentionally opaque to callers. */
41
- export interface CursorPage<Value> {
42
- readonly items: readonly Value[];
43
- readonly nextCursor?: OpaqueCursor;
44
- }
45
- /** Publication state derived from the draft and current published revisions. */
46
- export type ContentEntryStatus = "changed" | "draft" | "published";
47
- export declare const CONTENT_ENTRY_STATUSES: readonly ContentEntryStatus[];
48
- /** Admin entry-list order; a leading `-` sorts descending. */
49
- export type ContentEntrySort = "-publishedAt" | "-title" | "-updatedAt" | "publishedAt" | "title" | "updatedAt" | `field:${string}` | `-field:${string}`;
50
- export declare const CONTENT_ENTRY_SORTS: readonly ContentEntrySort[];
51
- export declare const DEFAULT_CONTENT_ENTRY_SORT: ContentEntrySort;
52
- export declare const MAX_CONTENT_ENTRY_SEARCH_LENGTH = 200;
53
- /** Display name used for `system:` audit actors such as configuration sync. */
54
- export declare const SYSTEM_ACTOR_DISPLAY_NAME = "System";
55
- /** Display name used when an audit actor no longer has a user record. */
56
- export declare const UNKNOWN_ACTOR_DISPLAY_NAME = "Unknown user";
57
- /** A human-readable actor reference that keeps raw IDs out of rendered lists. */
58
- export interface ActorSummary {
59
- readonly displayName: string;
60
- readonly id: ActorId;
61
- }
62
- /** Resolves the portable display-name fallbacks shared by every runtime adapter. */
63
- export declare function actorDisplayName(id: string, storedName?: string | null): string;
64
- /** Folds only ASCII letters, matching SQLite `lower()` so every adapter searches alike. */
65
- export declare function foldAscii(value: string): string;
66
- /** Scalar draft values of a model's configured list fields. */
67
- export type ContentEntryListValues = Readonly<Record<string, boolean | number | string>>;
68
- export interface ContentEntrySummary {
69
- readonly draftRevision: number;
70
- readonly id: ContentEntryId;
71
- readonly listValues: ContentEntryListValues;
72
- readonly modelKey: ContentModelKey;
73
- readonly publishedAt?: UnixMilliseconds;
74
- readonly publishedSnapshotId?: ContentSnapshotId;
75
- readonly slug?: string;
76
- readonly status: ContentEntryStatus;
77
- readonly title: string;
78
- readonly updatedAt: UnixMilliseconds;
79
- readonly updatedBy: ActorSummary;
80
- }
81
- /** Entry counts for one model and search term, independent of status filter and cursor. */
82
- export interface ContentEntryStatusTotals {
83
- readonly all: number;
84
- readonly changed: number;
85
- readonly draft: number;
86
- readonly published: number;
87
- }
88
- export interface ContentEntryListPage extends CursorPage<ContentEntrySummary> {
89
- readonly totals: ContentEntryStatusTotals;
90
- }
91
- export interface LoadContentEntryInput {
92
- readonly entryId: ContentEntryId;
93
- }
94
- export interface ListContentEntriesInput {
95
- readonly listQueryLimits?: ListQueryLimits;
96
- readonly query?: ResolvedCollectionQuery;
97
- readonly after?: OpaqueCursor;
98
- readonly limit: number;
99
- /** Draft field keys whose scalar values are copied into each summary. */
100
- readonly listFields: readonly string[];
101
- readonly modelKey: ContentModelKey;
102
- /** A trimmed, non-empty title-or-slug substring; ASCII letters match case-insensitively. */
103
- readonly q?: string;
104
- /** Collections only: the exact current draft slug (import lookups, ADR 0016). */
105
- readonly slug?: string;
106
- readonly sort: ContentEntrySort;
107
- readonly status?: ContentEntryStatus;
108
- }
109
- export interface ContentEntryReadPort {
110
- /** Returns one summary per requested ID, in order, with display-name fallbacks applied. */
111
- describeActors(ids: readonly ActorId[]): Promise<readonly ActorSummary[]>;
112
- load(input: LoadContentEntryInput): Promise<ContentEntry | null>;
113
- loadDraft(input: LoadContentEntryInput): Promise<ContentEntry["draft"] | null>;
114
- loadPublished(input: LoadContentEntryInput): Promise<PublishedSnapshot | null>;
115
- list(input: ListContentEntriesInput): Promise<ContentEntryListPage>;
116
- }
117
- export interface CreateContentEntryInput {
118
- readonly internalLinks?: readonly InternalLinkReference[];
119
- /** Commits the new entry only while the duplicated source draft is still at this revision. */
120
- readonly duplicateOf?: DuplicateSourceGuard;
121
- readonly entry: ContentEntry;
122
- readonly mediaReferences: readonly DraftMediaReference[];
123
- }
124
- /** The source draft revision on which a duplicate creation depends. */
125
- export interface DuplicateSourceGuard {
126
- readonly entryId: ContentEntryId;
127
- readonly expectedRevision: number;
128
- }
129
- export interface SaveCompleteDraftInput {
130
- readonly internalLinks?: readonly InternalLinkReference[];
131
- readonly entryId: ContentEntryId;
132
- readonly mutation: CompleteDraftMutation;
133
- }
134
- export interface PublishContentEntryCommand {
135
- readonly entryId: ContentEntryId;
136
- readonly expectedRevision: number;
137
- readonly idempotency?: PublicationIdempotency;
138
- readonly publishedAt: UnixMilliseconds;
139
- readonly publishedBy: Actor;
140
- readonly publishedSnapshotId: ContentSnapshotId;
141
- /**
142
- * The published projection of the draft at `expectedRevision`, present when
143
- * its model or a draft block declares conditional-field rules. Repositories
144
- * write it instead of copying draft fields, block data and references.
145
- */
146
- readonly projection?: PublishedProjection;
147
- }
148
- /** Published values and references of a draft whose hidden targets are removed. */
149
- export interface PublishedProjection {
150
- /** Every draft block exactly once, with its projected data. */
151
- readonly blocks: readonly {
152
- readonly data: JsonObject;
153
- readonly key: BlockKey;
154
- }[];
155
- readonly fields: JsonObject;
156
- readonly internalLinks: readonly InternalLinkReference[];
157
- readonly mediaReferences: readonly DraftMediaReference[];
158
- }
159
- /**
160
- * Applies a supplied projection to an entry whose draft was copied into its
161
- * publication. Fails without a result when the projection does not name every
162
- * draft block exactly once.
163
- */
164
- export declare function withPublishedProjection(entry: ContentEntry, projection: PublishedProjection): ContentEntry;
165
- /** Maps projected block data by key after checking it names exactly the draft's blocks. */
166
- export declare function publishedProjectionBlockData(draftKeys: readonly BlockKey[], projection: PublishedProjection): ReadonlyMap<BlockKey, JsonObject>;
167
- /** Atomic idempotency scope retained alongside a successful publication. */
168
- export interface PublicationIdempotency {
169
- readonly actorId: ActorId;
170
- readonly fingerprint: PublicationRequestFingerprint;
171
- readonly key: PublicationIdempotencyKey;
172
- }
173
- export interface DeleteContentEntryInput {
174
- readonly linkImpact?: LinkImpactAcknowledgment;
175
- readonly deletedAt: UnixMilliseconds;
176
- readonly deletedBy: Actor;
177
- readonly entryId: ContentEntryId;
178
- readonly expectedPublishedSnapshotId?: ContentSnapshotId;
179
- readonly expectedRevision: number;
180
- }
181
- export interface UnpublishContentEntryCommand {
182
- readonly linkImpact?: LinkImpactAcknowledgment;
183
- readonly entryId: ContentEntryId;
184
- readonly expectedPublishedSnapshotId: ContentSnapshotId;
185
- readonly idempotency?: PublicationIdempotency;
186
- readonly unpublishedAt: UnixMilliseconds;
187
- readonly unpublishedBy: Actor;
188
- }
189
- export interface RevertContentDraftCommand {
190
- readonly entryId: ContentEntryId;
191
- readonly expectedPublishedSnapshotId: ContentSnapshotId;
192
- readonly expectedRevision: number;
193
- readonly revertedAt: UnixMilliseconds;
194
- readonly revertedBy: Actor;
195
- }
196
- export type ContentCommandStatus = "created" | "deleted" | "published" | "reverted" | "saved";
197
- /** A complete state change returned by a specialized atomic command. */
198
- export interface ContentCommandResult {
199
- readonly entry?: ContentEntry;
200
- readonly status: ContentCommandStatus;
201
- }
202
- /** A publication result distinguishes a fresh commit from an idempotent replay. */
203
- export type PublishContentEntryResult = Readonly<{
204
- readonly entry: ContentEntry;
205
- readonly outcome: "published";
206
- readonly status: "published";
207
- readonly targetVersion: number;
208
- }> | Readonly<{
209
- readonly entry: ContentEntry;
210
- readonly outcome: "replayed";
211
- readonly status: "published";
212
- }>;
213
- /** An unpublication result distinguishes a fresh commit from an idempotent replay. */
214
- export type UnpublishContentEntryResult = Readonly<{
215
- readonly entry: ContentEntry;
216
- readonly outcome: "unpublished";
217
- readonly status: "unpublished";
218
- readonly targetVersion: number;
219
- }> | Readonly<{
220
- readonly entry: ContentEntry;
221
- readonly outcome: "replayed";
222
- readonly status: "unpublished";
223
- }>;
224
- /**
225
- * Specialized state-changing operations. These deliberately replace a generic
226
- * transaction callback so D1 and SQLite can preserve identical semantics.
227
- */
228
- export interface ContentEntryCommandPort {
229
- create(input: CreateContentEntryInput): Promise<ContentCommandResult>;
230
- delete(input: DeleteContentEntryInput): Promise<ContentCommandResult>;
231
- publish(input: PublishContentEntryCommand): Promise<PublishContentEntryResult>;
232
- /** Copies the current publication into the draft and aligns both revisions. */
233
- revertDraft(input: RevertContentDraftCommand): Promise<ContentCommandResult>;
234
- saveCompleteDraft(input: SaveCompleteDraftInput): Promise<ContentCommandResult>;
235
- /** Removes the current publication and its route while keeping the draft. */
236
- unpublish(input: UnpublishContentEntryCommand): Promise<UnpublishContentEntryResult>;
237
- }
238
- export interface PublicContentEntry {
239
- readonly entry: ContentEntry;
240
- readonly internalLinks: readonly PublicInternalLinkReference[];
241
- /** Active media referenced by the entry's current published snapshot. */
242
- readonly media: readonly MediaMetadata[];
243
- readonly path: string;
244
- }
245
- export interface ListPublicContentInput {
246
- readonly after?: OpaqueCursor;
247
- readonly limit: number;
248
- readonly modelKey: ContentModelKey;
249
- }
250
- /** A published route-less global with the media its publication references. */
251
- export interface PublicGlobalContent {
252
- readonly internalLinks: readonly PublicInternalLinkReference[];
253
- /** Published-only projection; never exposes the mutable draft. */
254
- readonly entry: ContentEntry;
255
- /** Active media referenced by the global's current published snapshot. */
256
- readonly media: readonly MediaMetadata[];
257
- }
258
- /** Entries one build-export page holds at most. */
259
- export declare const MAX_BUILD_EXPORT_PAGE_SIZE = 100;
260
- /**
261
- * Stored JSON bytes (fields, SEO and visible block data and settings; globals
262
- * on the first page) after which a build-export page ends. It bounds the
263
- * memory and CPU of hydrating, validating and serializing one page.
264
- */
265
- export declare const BUILD_EXPORT_PAGE_BYTE_BUDGET = 4000000;
266
- export interface ExportBuildContentPageInput {
267
- /** Continuation cursor of the previous page; absent for the first page. */
268
- readonly after?: OpaqueCursor;
269
- /** Entries per page, from 1 to `MAX_BUILD_EXPORT_PAGE_SIZE`. */
270
- readonly limit: number;
271
- }
272
- /** One page of the build export, read from a single published state. */
273
- export interface BuildContentExportPage {
274
- /** Routed published entries ordered by path, continuing after the cursor. */
275
- readonly entries: readonly PublicContentEntry[];
276
- /** Published globals ordered by model key; on the first page only. */
277
- readonly globals?: readonly PublicGlobalContent[];
278
- /** Present exactly when further entries remain. */
279
- readonly nextCursor?: OpaqueCursor;
280
- /** The published-state version every page of the sequence was read at. */
281
- readonly version: number;
282
- }
283
- /** A candidate entry of a build-export page and its stored JSON size in bytes. */
284
- export interface BuildExportCandidate {
285
- readonly bytes: number;
286
- }
287
- /**
288
- * Chooses how many of the ordered candidates (read with `limit + 1` rows) one
289
- * page holds: at most `limit`, ending before an entry would raise the page's
290
- * stored bytes above the budget, but always at least one entry. `initialBytes`
291
- * counts the first page's globals.
292
- */
293
- export declare function selectBuildExportPage(candidates: readonly BuildExportCandidate[], limit: number, initialBytes?: number): {
294
- readonly count: number;
295
- readonly more: boolean;
296
- };
297
- /** Rejects a build-export page size outside 1–100. */
298
- export declare function assertBuildExportPageSize(limit: number): number;
299
- export interface PublicContentReadPort {
300
- /**
301
- * Reads one build-export page from a single published state. Fails with
302
- * `BuildExportVersionChangedError` when the cursor's version is no longer
303
- * current or a publication lands during the read, and with
304
- * `BuildExportCursorError` for a malformed or foreign cursor.
305
- */
306
- exportBuildContentPage(input: ExportBuildContentPageInput): Promise<BuildContentExportPage>;
307
- loadPublic(path: string): Promise<PublicContentEntry | null>;
308
- /** Reads a published global by model key without consulting published routes. */
309
- loadPublicGlobal(modelKey: ContentModelKey): Promise<PublicGlobalContent | null>;
310
- loadPublicMedia(id: string): Promise<MediaMetadata | null>;
311
- listPublic(input: ListPublicContentInput): Promise<CursorPage<PublicContentEntry>>;
312
- publishedContentVersion(): Promise<number>;
313
- }
314
- export interface PutObjectInput {
315
- readonly body: ByteStream;
316
- readonly contentType: string;
317
- readonly key: string;
318
- }
319
- export interface StoredObject {
320
- readonly contentType: string;
321
- readonly key: string;
322
- readonly size: number;
323
- }
324
- /** A portable binary stream without binding the application layer to a runtime API. */
325
- export interface ByteStream extends AsyncIterable<Uint8Array> {
326
- }
327
- export interface ReadUrlOptions {
328
- readonly expiresAt?: UnixMilliseconds;
329
- }
330
- export interface ObjectStorage {
331
- createReadUrl(key: string, options?: ReadUrlOptions): Promise<string>;
332
- delete(key: string): Promise<void>;
333
- get(key: string): Promise<ByteStream | null>;
334
- put(input: PutObjectInput): Promise<StoredObject>;
335
- }
336
- export type MediaMimeType = "image/avif" | "image/gif" | "image/jpeg" | "image/png" | "image/webp";
337
- /**
338
- * A verified image result. Implementations MUST parse the complete byte sequence,
339
- * reject malformed or trailing data, and report dimensions from the image itself
340
- * after applying its embedded orientation, so they are the displayed dimensions.
341
- */
342
- export interface ImageInspector {
343
- inspect(bytes: Uint8Array, mimeType: MediaMimeType): Promise<ImageDimensions>;
344
- }
345
- export interface ImageDimensions {
346
- readonly height: number;
347
- readonly width: number;
348
- }
349
- /** Operational evidence is deliberately sanitized before it crosses this port. */
350
- export interface OperationalLogger {
351
- error(input: OperationalError): void | Promise<void>;
352
- }
353
- export interface OperationalError {
354
- readonly code: "MEDIA_METADATA_CREATE_FAILED" | "MEDIA_OBJECT_CLEANUP_FAILED";
355
- readonly storageKey: string;
356
- }
357
- /** A derived cache; callers must always remain correct on a miss. */
358
- export interface Cache {
359
- delete(key: string): Promise<void>;
360
- get<Value>(key: string): Promise<Value | null>;
361
- set<Value>(key: string, value: Value): Promise<void>;
362
- }
363
- export interface SiteBuildRequest {
364
- readonly buildId: SiteBuildId;
365
- readonly targetVersion: number;
366
- }
367
- /**
368
- * `succeeded` is proven publication only. `accepted` is untracked provider
369
- * acceptance; `tracking` means this runtime will track the exact deployment.
370
- */
371
- export type BuildTriggerResult = Readonly<{
372
- readonly status: "accepted";
373
- readonly providerBuildId?: string;
374
- }> | Readonly<{
375
- readonly status: "tracking";
376
- readonly providerBuildId: string;
377
- }> | Readonly<{
378
- readonly status: "succeeded";
379
- }> | Readonly<{
380
- readonly status: "failed";
381
- readonly reason: string;
382
- readonly path?: string;
383
- }>;
384
- export interface SiteBuildTrigger {
385
- trigger(input: SiteBuildRequest): Promise<BuildTriggerResult>;
386
- }
387
- export interface BuildQueueReceipt {
388
- readonly coalesced: boolean;
389
- readonly eventId: DispatcherEventId;
390
- readonly targetVersion: number;
391
- }
392
- export interface EnqueueSiteBuildInput {
393
- readonly requestedAt: UnixMilliseconds;
394
- readonly requestedBy: Actor;
395
- readonly retryOfBuildId?: SiteBuildId;
396
- }
397
- export interface SiteBuildCommandPort {
398
- requestBuild(input: EnqueueSiteBuildInput): Promise<BuildQueueReceipt>;
399
- }
400
- /** Persisted build history visible to authenticated admin sessions. */
401
- export interface SiteBuildRecord {
402
- readonly id: SiteBuildId;
403
- readonly reason: string;
404
- readonly status: SiteBuildStatus;
405
- readonly targetVersion: number;
406
- readonly requestedBy: string;
407
- readonly requestedAt: UnixMilliseconds;
408
- readonly startedAt?: UnixMilliseconds;
409
- readonly completedAt?: UnixMilliseconds;
410
- readonly providerBuildId?: string;
411
- readonly providerStage?: SiteBuildProviderStage;
412
- readonly providerCheckedAt?: UnixMilliseconds;
413
- readonly error?: string;
414
- readonly errorPath?: string;
415
- }
416
- export interface SiteBuildReadPort {
417
- listSiteBuilds(limit: number): Promise<readonly SiteBuildRecord[]>;
418
- getSiteBuild(buildId: SiteBuildId): Promise<SiteBuildRecord | null>;
419
- }
420
- export interface SiteBuildWorkLease extends DispatcherLease {
421
- readonly buildId: SiteBuildId;
422
- readonly targetVersion: number;
423
- }
424
- export interface SiteBuildDispatchPort {
425
- claimSiteBuilds(input: {
426
- readonly limit: number;
427
- readonly now: UnixMilliseconds;
428
- }): Promise<readonly SiteBuildWorkLease[]>;
429
- renewSiteBuildLease(input: {
430
- readonly leaseId: DispatcherLeaseId;
431
- readonly now: UnixMilliseconds;
432
- }): Promise<boolean>;
433
- /** Untracked provider acceptance: terminal `accepted`, optional provider ID. */
434
- recordSiteBuildAccepted(input: {
435
- readonly leaseId: DispatcherLeaseId;
436
- readonly now: UnixMilliseconds;
437
- readonly providerBuildId?: string;
438
- }): Promise<void>;
439
- /** Tracked provider acceptance: the build stays `running` and its event completes. */
440
- recordSiteBuildTracking(input: {
441
- readonly leaseId: DispatcherLeaseId;
442
- readonly now: UnixMilliseconds;
443
- readonly providerBuildId: string;
444
- }): Promise<void>;
445
- recordSiteBuildSuccess(input: {
446
- readonly leaseId: DispatcherLeaseId;
447
- readonly now: UnixMilliseconds;
448
- }): Promise<void>;
449
- recordSiteBuildFailure(input: {
450
- readonly leaseId: DispatcherLeaseId;
451
- readonly now: UnixMilliseconds;
452
- readonly reason: string;
453
- readonly path?: string;
454
- readonly retryAt?: UnixMilliseconds;
455
- readonly terminal: boolean;
456
- }): Promise<void>;
457
- /**
458
- * Ends a tracked deployment for the exact build and provider ID; idempotent
459
- * for the same outcome and never reopens a terminal build. A supplied stage
460
- * is recorded with the completion time as the last check.
461
- */
462
- completeTrackedSiteBuild(input: {
463
- readonly buildId: SiteBuildId;
464
- readonly providerBuildId: string;
465
- readonly now: UnixMilliseconds;
466
- readonly outcome: TrackedSiteBuildOutcome;
467
- readonly reason?: string;
468
- readonly stage?: SiteBuildProviderStage;
469
- }): Promise<void>;
470
- /**
471
- * Leases due tracked builds (`running`, provider ID, completed event) by
472
- * moving their next check to `now + leaseMs`; each is returned to one caller.
473
- */
474
- claimTrackedSiteBuildChecks(input: {
475
- readonly limit: number;
476
- readonly leaseMs: number;
477
- readonly now: UnixMilliseconds;
478
- }): Promise<readonly TrackedSiteBuildCheck[]>;
479
- /**
480
- * Schedules the next check of a still-running tracked build. With a stage the
481
- * observation is recorded as the last successful check at `now`.
482
- */
483
- recordTrackedSiteBuildCheck(input: {
484
- readonly buildId: SiteBuildId;
485
- readonly providerBuildId: string;
486
- readonly now: UnixMilliseconds;
487
- readonly checkAfter: UnixMilliseconds;
488
- readonly stage?: SiteBuildProviderStage;
489
- }): Promise<boolean>;
490
- }
491
- /** One leased check of a tracked provider deployment. */
492
- export interface TrackedSiteBuildCheck {
493
- readonly buildId: SiteBuildId;
494
- readonly providerBuildId: string;
495
- /** Completion time of the build's outbox event: when tracking began. */
496
- readonly trackingStartedAt: UnixMilliseconds;
497
- /** Last successful provider read, when one happened. */
498
- readonly lastCheckedAt?: UnixMilliseconds;
499
- }
500
- /** Closed facts read from a provider about one exact deployment. */
501
- export type ProviderDeploymentObservation = Readonly<{
502
- kind: "progress";
503
- stage: SiteBuildProviderStage;
504
- }> | Readonly<{
505
- kind: "outcome";
506
- outcome: "succeeded" | "failed" | "cancelled";
507
- reason?: SiteBuildFailureReason;
508
- stage: SiteBuildProviderStage;
509
- }> | Readonly<{
510
- kind: "forbidden";
511
- }> | Readonly<{
512
- kind: "not_found";
513
- }> | Readonly<{
514
- kind: "rejected";
515
- }> | Readonly<{
516
- kind: "transient";
517
- }>;
518
- /** Reads a provider deployment; never returns provider text or credentials. */
519
- export interface ProviderDeploymentReader {
520
- read(providerBuildId: string): Promise<ProviderDeploymentObservation>;
521
- }
522
- export interface Clock {
523
- now(): UnixMilliseconds;
524
- }
525
- export interface IdGenerator {
526
- next(): string;
527
- }
528
- /** Persistence receives only the derived verifier, never an opaque secret. */
529
- export interface OpaqueTokenHasher {
530
- hash(secret: OpaqueTokenSecret): Promise<OpaqueTokenVerifier>;
531
- verify(secret: OpaqueTokenSecret, verifier: OpaqueTokenVerifier): Promise<boolean>;
532
- }
533
- export type SecurityRole = "admin" | "editor" | "viewer";
534
- export interface ManagedUser {
535
- readonly disabled: boolean;
536
- readonly email: string;
537
- readonly id: string;
538
- readonly role: SecurityRole;
539
- }
540
- export interface BuildTokenMetadata {
541
- readonly capabilities: readonly ["content:build:read"];
542
- readonly createdAt: UnixMilliseconds;
543
- readonly id: string;
544
- readonly lastUsedAt?: UnixMilliseconds;
545
- readonly name: string;
546
- readonly revokedAt?: UnixMilliseconds;
547
- readonly tokenPrefix: string;
548
- }
549
- export interface IssuedBuildToken extends BuildTokenMetadata {
550
- /** Returned exactly once by the creation command; never persisted or logged. */
551
- readonly token: OpaqueTokenSecret;
552
- }
553
- /** Import tokens may write content and media; publication is an optional extra (ADR 0016). */
554
- export type ImportTokenCapabilities = readonly ["content:import"] | readonly ["content:import", "content:publish"];
555
- export declare const MIN_IMPORT_TOKEN_LIFETIME_DAYS = 1;
556
- export declare const MAX_IMPORT_TOKEN_LIFETIME_DAYS = 7;
557
- /** `last_used_at` is written at most once per this interval per token. */
558
- export declare const IMPORT_TOKEN_USE_RECORD_INTERVAL_MS = 60000;
559
- export interface ImportTokenMetadata {
560
- readonly capabilities: ImportTokenCapabilities;
561
- readonly createdAt: UnixMilliseconds;
562
- readonly createdBy: {
563
- readonly displayName?: string;
564
- readonly email: string;
565
- readonly id: string;
566
- };
567
- readonly expiresAt: UnixMilliseconds;
568
- readonly id: string;
569
- readonly lastUsedAt?: UnixMilliseconds;
570
- readonly name: string;
571
- readonly revokedAt?: UnixMilliseconds;
572
- readonly tokenPrefix: string;
573
- }
574
- export interface IssuedImportToken extends ImportTokenMetadata {
575
- /** Returned exactly once by the creation command; never persisted or logged. */
576
- readonly token: OpaqueTokenSecret;
577
- }
578
- /** An unexpired, unrevoked import token and its enabled creator's current role. */
579
- export interface ResolvedImportToken {
580
- readonly creator: {
581
- readonly id: string;
582
- readonly role: string;
583
- };
584
- readonly token: ImportTokenMetadata;
585
- }
586
- /**
587
- * Chooses an import token's capabilities. Publication is granted only when the
588
- * creating actor currently holds `content:publish`; asking for it otherwise is
589
- * refused rather than silently narrowed.
590
- */
591
- export declare function importTokenCapabilities(actor: Actor, allowPublish: boolean): ImportTokenCapabilities;
592
- /** Validates a whole-day lifetime and returns the absolute expiry. */
593
- export declare function importTokenExpiry(now: UnixMilliseconds, days: number): UnixMilliseconds;
594
- /** Security lifecycle boundary implemented by each runtime's durable adapter. */
595
- export interface SecurityService extends UserProfileReader, AccountSecurityPort {
596
- /** Read-only durable completion marker; never infers completion from users. */
597
- isSetupComplete(): Promise<boolean>;
598
- bootstrap(input: {
599
- readonly email: string;
600
- readonly password: string;
601
- readonly token: OpaqueTokenSecret;
602
- }): Promise<{
603
- readonly user: ManagedUser;
604
- }>;
605
- createSetupToken(): Promise<{
606
- readonly expiresAt: UnixMilliseconds;
607
- readonly token: OpaqueTokenSecret;
608
- }>;
609
- createBuildToken(input: {
610
- readonly name: string;
611
- readonly now: UnixMilliseconds;
612
- }): Promise<IssuedBuildToken>;
613
- /** Disabling also deletes every session of the user in the same operation. */
614
- disableUser(input: {
615
- readonly userId: string;
616
- }): Promise<ManagedUser>;
617
- listBuildTokens(): Promise<readonly BuildTokenMetadata[]>;
618
- listUsers(): Promise<readonly ManagedUser[]>;
619
- revokeBuildToken(input: {
620
- readonly tokenId: string;
621
- readonly now: UnixMilliseconds;
622
- }): Promise<BuildTokenMetadata | null>;
623
- /** Disabling also deletes every session of the user in the same operation. */
624
- updateUser(input: {
625
- readonly role?: SecurityRole;
626
- readonly userId: string;
627
- readonly disabled?: boolean;
628
- }): Promise<ManagedUser | null>;
629
- /** Accepts only an unrevoked token whose capabilities are exactly `content:build:read`. */
630
- verifyBuildToken(input: {
631
- readonly token: OpaqueTokenSecret;
632
- readonly now: UnixMilliseconds;
633
- }): Promise<boolean>;
634
- createImportToken(input: {
635
- readonly capabilities: ImportTokenCapabilities;
636
- readonly createdBy: string;
637
- readonly expiresAt: UnixMilliseconds;
638
- readonly name: string;
639
- readonly now: UnixMilliseconds;
640
- }): Promise<IssuedImportToken>;
641
- /** Newest first, including expired and revoked tokens. */
642
- listImportTokens(): Promise<readonly ImportTokenMetadata[]>;
643
- /** Idempotent; null when no import token has the identifier. */
644
- revokeImportToken(input: {
645
- readonly tokenId: string;
646
- readonly now: UnixMilliseconds;
647
- }): Promise<ImportTokenMetadata | null>;
648
- /**
649
- * Null for an unknown, revoked or expired token, another token kind, or a
650
- * missing or disabled creator. A successful resolution records its use at
651
- * most once per `IMPORT_TOKEN_USE_RECORD_INTERVAL_MS`.
652
- */
653
- resolveImportToken(input: {
654
- readonly token: OpaqueTokenSecret;
655
- readonly now: UnixMilliseconds;
656
- }): Promise<ResolvedImportToken | null>;
657
- }
658
- export interface RateLimitDecision {
659
- readonly allowed: boolean;
660
- readonly retryAfterSeconds: number;
661
- }
662
- /**
663
- * `invite` covers invitation create, resend and revoke plus administrator
664
- * resets per actor; `reset` counts public reset requests per normalized email.
665
- */
666
- export type SensitiveRateLimitOperation = "mcp" | "oauth-register" | "oauth-token" | "oauth-revoke" | "auth" | "email" | "invite" | "reset" | "setup" | "token" | "upload";
667
- export interface SensitiveRateLimiter {
668
- check(input: {
669
- readonly operation: SensitiveRateLimitOperation;
670
- readonly subject: string;
671
- readonly now: UnixMilliseconds;
672
- }): Promise<RateLimitDecision>;
673
- }
674
- /** Keeps the role matrix in the domain policy rather than HTTP handlers. */
675
- export declare function requireUsersManager(actor: Actor): void;
676
- /** Authorizes installation settings: status, build tokens and email delivery checks. */
677
- export declare function requireSettingsManager(actor: Actor): void;
678
- /** The permissions the domain policy grants an actor, for session summaries. */
679
- export declare function actorPermissions(actor: Actor): readonly Permission[];
680
- /** The role's permissions narrowed by any delegated ceiling, in the domain's order. */
681
- export declare function effectiveActorPermissions(actor: Actor): readonly Permission[];
682
- export interface DispatcherEvent {
683
- readonly attempts: number;
684
- readonly availableAt: UnixMilliseconds;
685
- readonly id: DispatcherEventId;
686
- readonly payload: JsonObject;
687
- readonly type: string;
688
- }
689
- /** Fixed dispatcher timing keeps recovery semantics identical across runtimes. */
690
- export declare const DISPATCHER_LEASE_DURATION_MS = 60000;
691
- export declare const SITE_BUILD_DEBOUNCE_MS = 5000;
692
- export interface DispatcherRetryPolicy {
693
- readonly baseDelayMs: number;
694
- readonly maxAttempts: number;
695
- readonly maxDelayMs: number;
696
- }
697
- export declare const defaultDispatcherRetryPolicy: DispatcherRetryPolicy;
698
- export declare const siteBuildRetryPolicy: DispatcherRetryPolicy;
699
- /** Calculates full-jitter exponential retry delay without choosing the random sample. */
700
- export declare function dispatcherRetryDelay(policy: DispatcherRetryPolicy, failedAttempt: number, random: number): number;
701
- export interface DispatcherLease {
702
- readonly event: DispatcherEvent;
703
- readonly expiresAt: UnixMilliseconds;
704
- readonly id: DispatcherLeaseId;
705
- }
706
- export interface ClaimDispatcherEventsInput {
707
- readonly eventTypes: readonly string[];
708
- readonly limit: number;
709
- readonly now: UnixMilliseconds;
710
- }
711
- export interface CompleteDispatcherLeaseInput {
712
- readonly completedAt: UnixMilliseconds;
713
- readonly error?: string;
714
- readonly leaseId: DispatcherLeaseId;
715
- readonly outcome: "succeeded";
716
- }
717
- export interface RetryDispatcherLeaseInput {
718
- readonly error: string;
719
- readonly failedAt: UnixMilliseconds;
720
- readonly leaseId: DispatcherLeaseId;
721
- readonly retryAt?: UnixMilliseconds;
722
- }
723
- export interface DispatcherLeasePort {
724
- claim(input: ClaimDispatcherEventsInput): Promise<readonly DispatcherLease[]>;
725
- complete(input: CompleteDispatcherLeaseInput): Promise<void>;
726
- retry(input: RetryDispatcherLeaseInput): Promise<void>;
727
- }
728
- /** Metadata-only media reads remain separate from binary object storage. */
729
- export interface MediaReadPort {
730
- loadMedia(id: string): Promise<MediaMetadata | null>;
731
- }
732
- /** Bounded set-based metadata validation for complete content mutations. */
733
- export interface ContentMediaReadPort extends MediaReadPort {
734
- loadMediaMany(ids: readonly string[]): Promise<readonly MediaMetadata[]>;
735
- }
736
- /** Admin media-list order; a leading `-` sorts descending. */
737
- export type MediaSort = "-createdAt" | "-filename" | "-size" | "createdAt" | "filename" | "size";
738
- export declare const MEDIA_SORTS: readonly MediaSort[];
739
- export declare const DEFAULT_MEDIA_SORT: MediaSort;
740
- export declare const MAX_MEDIA_SEARCH_LENGTH = 200;
741
- /** Upper bound on the referencing entries returned by one media usage read. */
742
- export declare const MAX_MEDIA_USAGE_ENTRIES = 50;
743
- export interface ListMediaInput {
744
- readonly tags?: readonly string[];
745
- /** Restricts the page to `active` items with this lowercase-hex SHA-256. */
746
- readonly sha256?: string;
747
- readonly after?: OpaqueCursor;
748
- readonly limit: number;
749
- /** Trimmed, non-empty filename substring; matched case-insensitively for ASCII. */
750
- readonly q?: string;
751
- readonly sort: MediaSort;
752
- readonly type?: MediaMimeType;
753
- }
754
- /** Media metadata with its uploader's display name and distinct referencing-entry count. */
755
- export interface MediaCatalogItem {
756
- readonly createdBy: ActorSummary;
757
- readonly media: MediaMetadata;
758
- readonly usageCount: number;
759
- }
760
- export interface ListMediaTagsInput {
761
- readonly after?: OpaqueCursor;
762
- readonly limit: number;
763
- readonly q?: string;
764
- }
765
- export interface MediaTagCount {
766
- readonly tag: string;
767
- readonly count: number;
768
- }
769
- export interface MediaListPort {
770
- listMediaTags(input: ListMediaTagsInput): Promise<CursorPage<MediaTagCount>>;
771
- listMedia(input: ListMediaInput): Promise<CursorPage<MediaCatalogItem>>;
772
- }
773
- /** Which of an entry's current snapshots reference a media item at one location. */
774
- export type MediaUsageState = "draft" | "published";
775
- export type MediaUsageLocation = {
776
- readonly field: string;
777
- readonly source: "field";
778
- readonly states: readonly MediaUsageState[];
779
- } | {
780
- readonly field: "image";
781
- readonly source: "seo";
782
- readonly states: readonly MediaUsageState[];
783
- } | {
784
- readonly blockKey: BlockKey;
785
- readonly blockType: string;
786
- readonly field: string;
787
- readonly source: "block";
788
- readonly states: readonly MediaUsageState[];
789
- };
790
- /** One entry whose current draft or published snapshot references a media item. */
791
- export interface MediaUsageEntry {
792
- readonly entryId: ContentEntryId;
793
- readonly locations: readonly MediaUsageLocation[];
794
- readonly modelKey: ContentModelKey;
795
- readonly slug?: string;
796
- readonly status: ContentEntryStatus;
797
- readonly title: string;
798
- }
799
- export interface LoadMediaUsageInput {
800
- readonly limit: number;
801
- readonly mediaId: MediaId;
802
- }
803
- /**
804
- * Presentation reads derived from the same reference projection that guards
805
- * deletion; lifecycle reads stay on `MediaReadPort`.
806
- */
807
- export interface MediaCatalogPort {
808
- loadMediaCatalogItem(id: string): Promise<MediaCatalogItem | null>;
809
- loadMediaUsage(input: LoadMediaUsageInput): Promise<readonly MediaUsageEntry[]>;
810
- }
811
- export interface CreateMediaMetadataInput {
812
- readonly tags?: readonly string[];
813
- /** SHA-256 of the stored bytes as lowercase hex. */
814
- readonly sha256?: string;
815
- readonly createdAt: UnixMilliseconds;
816
- readonly createdBy: ActorId;
817
- readonly filename: string;
818
- readonly height: number;
819
- readonly id: MediaId;
820
- readonly mimeType: MediaMimeType;
821
- readonly size: number;
822
- readonly storageKey: string;
823
- readonly width: number;
824
- }
825
- /** A durable request to delete binary media asynchronously after reference checks. */
826
- export interface MarkMediaForDeletionInput {
827
- readonly mediaId: MediaId;
828
- readonly requestedAt: UnixMilliseconds;
829
- readonly requestedBy: Actor;
830
- }
831
- export interface MarkMediaForDeletionResult {
832
- readonly media: MediaMetadata;
833
- readonly status: "deleting";
834
- }
835
- /**
836
- * Replaces an active item's descriptive metadata with complete values, guarded
837
- * by the `updatedAt` the values were merged from.
838
- */
839
- export interface UpdateMediaMetadataInput {
840
- readonly tags?: readonly string[];
841
- readonly publishedEffect?: boolean;
842
- readonly alt: string | null;
843
- readonly caption: string | null;
844
- readonly expectedUpdatedAt: UnixMilliseconds;
845
- readonly focalPoint: MediaFocalPoint | null;
846
- readonly mediaId: MediaId;
847
- readonly requestedBy: Actor;
848
- /** Strictly greater than `expectedUpdatedAt`, so every version has a distinct tag. */
849
- readonly updatedAt: UnixMilliseconds;
850
- }
851
- export interface UpdateMediaMetadataResult {
852
- readonly media: MediaMetadata;
853
- /** Present only when a current publication uses the item and a build was requested. */
854
- readonly targetVersion?: number;
855
- }
856
- /** Mutation remains separate from metadata reads and binary object storage. */
857
- export interface MediaCommandPort {
858
- createMedia(input: CreateMediaMetadataInput): Promise<MediaMetadata>;
859
- markForDeletion(input: MarkMediaForDeletionInput): Promise<MarkMediaForDeletionResult>;
860
- retryDeletion(input: MarkMediaForDeletionInput): Promise<MarkMediaForDeletionResult>;
861
- updateMediaMetadata(input: UpdateMediaMetadataInput): Promise<UpdateMediaMetadataResult>;
862
- }
863
- /** Private worker-only boundary: transport never receives the storage key. */
864
- export interface MediaDeletionDispatchPort {
865
- completeMediaDeletion(input: {
866
- readonly completedAt: UnixMilliseconds;
867
- readonly leaseId: DispatcherLeaseId;
868
- readonly mediaId: MediaId;
869
- }): Promise<void>;
870
- failMediaDeletion(input: {
871
- readonly failedAt: UnixMilliseconds;
872
- readonly leaseId: DispatcherLeaseId;
873
- readonly mediaId: MediaId;
874
- readonly sanitizedError: string;
875
- readonly terminal: boolean;
876
- readonly retryAt?: UnixMilliseconds;
877
- }): Promise<void>;
878
- loadDeletingMedia(id: MediaId): Promise<MediaMetadata | null>;
879
- }
880
- export * from "./content-use-cases.js";
881
- export * from "./media-use-cases.js";
882
- /** Authorizes read-only installation metadata with the existing content permission. */
883
- export declare function requireContentReader(actor: Actor): void;
884
- export { CompleteImageContainerInspector } from "./image-container.js";
885
- export * from "./configuration-fields.js";
886
- export * from "./configuration-links.js";
7
+ export * from "./shared/brands.js";
8
+ export * from "./shared/pagination.js";
9
+ export * from "./shared/limits.js";
10
+ export * from "./shared/actors.js";
11
+ export * from "./shared/text.js";
12
+ export * from "./shared/permissions.js";
13
+ export * from "./ports/infrastructure.js";
14
+ export * from "./ports/outbox.js";
15
+ export * from "./ports/links.js";
16
+ export * from "./ports/content.js";
17
+ export * from "./ports/media.js";
18
+ export * from "./ports/builds.js";
19
+ export * from "./ports/security.js";
20
+ export * from "./content/authority.js";
21
+ export * from "./content/collection-queries.js";
22
+ export * from "./content/internal-links.js";
23
+ export * from "./content/published-projection.js";
24
+ export * from "./content/use-case-inputs.js";
25
+ export { duplicateTitle, contentModelRoute, normalizeDraftCandidate, type NormalizeDraftCandidateInput, type NormalizedDraftCandidate, } from "./content/draft-normalization.js";
26
+ export * from "./content/use-cases.js";
27
+ export * from "./media/use-cases.js";
28
+ export * from "./media/types.js";
29
+ export * from "./media/limits.js";
30
+ export { detectMediaMimeType, sanitizeMediaFilename, collectMediaBytes } from "./media/upload.js";
31
+ export { normalizeMediaMetadataPatch } from "./media/metadata.js";
32
+ export { CompleteImageContainerInspector } from "./media/image-container.js";
33
+ export * from "./accounts/use-cases.js";
34
+ export * from "./accounts/email.js";
35
+ export * from "./accounts/oauth.js";
36
+ export * from "./accounts/import-tokens.js";
37
+ export * from "./builds/export-pages.js";
38
+ export * from "./builds/use-cases.js";
39
+ export * from "./builds/tracker.js";
40
+ export * from "./outbox/retry-policy.js";
41
+ export * from "./outbox/dispatchers.js";
42
+ export * from "./configuration/limits.js";
43
+ export * from "./configuration/types.js";
44
+ export * from "./configuration/fields.js";
45
+ export * from "./configuration/structure-diff.js";
46
+ export * from "./configuration/structure-hints.js";
47
+ export * from "./configuration/evidence.js";
48
+ export * from "./configuration/migration.js";
49
+ export * from "./configuration/links.js";
50
+ export { contentSyncActor } from "./configuration/model-state.js";
51
+ export * from "./configuration/plan.js";
52
+ export * from "./configuration/report.js";
53
+ export * from "./configuration/apply.js";
887
54
  //# sourceMappingURL=index.d.ts.map