@phtngyn/cms 0.1.0-beta.0 → 0.1.0-beta.2
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/README.md +260 -6
- package/package.json +31 -16
- package/src/Authoring.d.ts +13 -1
- package/src/Configuration-Br7tE9Qt.d.ts +68 -0
- package/src/{AuthoringSchema-BQ5kbhVB.js → Configuration-CA_jvQKG.js} +599 -492
- package/src/Configuration-CA_jvQKG.js.map +1 -0
- package/src/Configuration.d.ts +2 -44
- package/src/Configuration.js +0 -1
- package/src/Configuration.js.map +1 -1
- package/src/{DocumentEngine-Da0kWotL.js → DocumentEngine-CgiBQU4g.js} +110 -84
- package/src/DocumentEngine-CgiBQU4g.js.map +1 -0
- package/src/DocumentModel-BB9igGC7.d.ts +34 -0
- package/src/DocumentModel.d.ts +2 -30
- package/src/DocumentModel.js +13 -3
- package/src/DocumentModel.js.map +1 -1
- package/src/Forms-BsJMev5_.d.ts +74 -0
- package/src/Forms-CfcI3tPU.js +79 -0
- package/src/Forms-CfcI3tPU.js.map +1 -0
- package/src/Forms-DxbkU3_5.js +367 -0
- package/src/Forms-DxbkU3_5.js.map +1 -0
- package/src/Forms.d.ts +35 -0
- package/src/Forms.js +13 -0
- package/src/Forms.js.map +1 -0
- package/src/HttpPaths-c9nLZ9H2.js +21 -0
- package/src/HttpPaths-c9nLZ9H2.js.map +1 -0
- package/src/I18n-DZK4CkJF.d.ts +21 -0
- package/src/I18n.d.ts +2 -0
- package/src/I18n.js +1 -0
- package/src/Module.js +78 -81
- package/src/Module.js.map +1 -1
- package/src/S3MediaObjects-JKMAWyVB.js +2664 -0
- package/src/S3MediaObjects-JKMAWyVB.js.map +1 -0
- package/src/Seed.d.ts +6 -0
- package/src/Seed.js +34 -0
- package/src/Seed.js.map +1 -0
- package/src/Seo-402YumpT.d.ts +198 -0
- package/src/{connection-ZGtL54qY.js → connection-B-iz0Y9Y.js} +5 -7
- package/src/connection-B-iz0Y9Y.js.map +1 -0
- package/src/{installation-BNKaVjni.js → installation-DgF2M1gL.js} +1162 -2147
- package/src/installation-DgF2M1gL.js.map +1 -0
- package/src/internal/authoring-catalog.js +153 -0
- package/src/internal/authoring-catalog.js.map +1 -0
- package/src/internal/authoring-compiler.js +2 -2
- package/src/internal/authoring-compiler.js.map +1 -1
- package/src/internal/authoring-metadata.js +68 -49
- package/src/internal/authoring-metadata.js.map +1 -1
- package/src/internal/cms-config.js +0 -1
- package/src/internal/cms-config.js.map +1 -1
- package/src/internal/configuration.js +25 -13
- package/src/internal/configuration.js.map +1 -1
- package/src/internal/document-model.js +66 -20
- package/src/internal/document-model.js.map +1 -1
- package/src/internal/form-capabilities.js +12 -0
- package/src/internal/form-capabilities.js.map +1 -0
- package/src/internal/i18n.js +47 -0
- package/src/internal/i18n.js.map +1 -0
- package/src/internal/studio-app.js +66 -0
- package/src/internal/studio-app.js.map +1 -0
- package/src/location-CFKTeK1K.js +35 -0
- package/src/location-CFKTeK1K.js.map +1 -0
- package/src/{metadata-Czvi3E4K.js → metadata-BEZPWh-3.js} +3 -72
- package/src/metadata-BEZPWh-3.js.map +1 -0
- package/src/{models-DS5ClMsH.js → models-BWm1pTAf.js} +9 -31
- package/src/models-BWm1pTAf.js.map +1 -0
- package/src/models-DwYioyNV.js +726 -0
- package/src/models-DwYioyNV.js.map +1 -0
- package/src/runtime/blocks.js +30 -0
- package/src/runtime/blocks.js.map +1 -0
- package/src/runtime/collaboration.js +9 -4
- package/src/runtime/collaboration.js.map +1 -1
- package/src/runtime/delivery/DocumentRenderer.js +10 -4
- package/src/runtime/delivery/DocumentRenderer.js.map +1 -1
- package/src/runtime/delivery/blocks.js +8 -0
- package/src/runtime/delivery/blocks.js.map +1 -0
- package/src/runtime/delivery/context.js +12 -0
- package/src/runtime/delivery/context.js.map +1 -0
- package/src/runtime/delivery/document-page.js +14 -12
- package/src/runtime/delivery/document-page.js.map +1 -1
- package/src/runtime/delivery/document.js +21 -3
- package/src/runtime/delivery/document.js.map +1 -1
- package/src/runtime/delivery/error.js +11 -0
- package/src/runtime/delivery/error.js.map +1 -0
- package/src/runtime/delivery/plugin.js +41 -0
- package/src/runtime/delivery/plugin.js.map +1 -0
- package/src/runtime/delivery/types.d.ts +5 -0
- package/src/runtime/delivery/useCmsDocumentSeo.d.ts +56 -0
- package/src/runtime/delivery/useCmsDocumentSeo.js +99 -0
- package/src/runtime/delivery/useCmsDocumentSeo.js.map +1 -0
- package/src/runtime/delivery/useDocument.js +5 -2
- package/src/runtime/delivery/useDocument.js.map +1 -1
- package/src/runtime/delivery/useDocumentQuery.js +5 -2
- package/src/runtime/delivery/useDocumentQuery.js.map +1 -1
- package/src/runtime/forms/document.js +38 -0
- package/src/runtime/forms/document.js.map +1 -0
- package/src/runtime/forms/useCmsForm.js +149 -0
- package/src/runtime/forms/useCmsForm.js.map +1 -0
- package/src/runtime/i18n/translator.js +22 -0
- package/src/runtime/i18n/translator.js.map +1 -0
- package/src/runtime/i18n/useCmsI18n.d.ts +9 -0
- package/src/runtime/i18n/useCmsI18n.js +29 -0
- package/src/runtime/i18n/useCmsI18n.js.map +1 -0
- package/src/runtime/installation.js +1 -1
- package/src/runtime/plugin.js +3 -3
- package/src/runtime/plugin.js.map +1 -1
- package/src/runtime/preview/comark-document.js +0 -1
- package/src/runtime/preview/comark-document.js.map +1 -1
- package/src/runtime/preview/connection.js +1 -1
- package/src/runtime/preview/controller.js +37 -11
- package/src/runtime/preview/controller.js.map +1 -1
- package/src/runtime/preview/overlay.js +65 -0
- package/src/runtime/preview/overlay.js.map +1 -0
- package/src/runtime/preview/plugin.client.js +59 -61
- package/src/runtime/preview/plugin.client.js.map +1 -1
- package/src/runtime/preview/preview.css +72 -4
- package/src/runtime/preview/protocol.js.map +1 -1
- package/src/runtime/preview/store.js +1 -1
- package/src/runtime/preview/targets.js +0 -1
- package/src/runtime/preview/targets.js.map +1 -1
- package/src/runtime/sitemap-entries.js +17 -0
- package/src/runtime/sitemap-entries.js.map +1 -0
- package/src/runtime/sitemap.js +24 -0
- package/src/runtime/sitemap.js.map +1 -0
- package/src/runtime/studio-app.js +5 -1
- package/src/runtime/studio-app.js.map +1 -1
- package/src/runtime/studio-entry.js +36 -0
- package/src/runtime/studio-entry.js.map +1 -0
- package/src/runtime/studio-navigation.js +11 -0
- package/src/runtime/studio-navigation.js.map +1 -0
- package/src/scalars-B2lgGUnj.js +26 -0
- package/src/scalars-B2lgGUnj.js.map +1 -0
- package/src/{store-Nl4uxEXx.js → store-DjJs3I7k.js} +12 -7
- package/src/store-DjJs3I7k.js.map +1 -0
- package/studio/CreateDocumentDialog-CTeIFlPb.js +256 -0
- package/studio/collaboration-DcK2F6v9.js +4566 -0
- package/studio/documentPlanning-Bfv-d7OU.js +29820 -0
- package/studio/dom-to-image-more.min-D6jGGdrW.js +877 -0
- package/studio/editor-Bzlh3zXt.js +30827 -0
- package/studio/host.css +3 -0
- package/studio/host.js +46614 -0
- package/studio/rolldown-runtime-B0aSnxlc.js +20 -0
- package/dist/studio/assets/ActivityEntryRow-D--fRvWI.js +0 -1
- package/dist/studio/assets/ActivityView-D-XBBUHb.js +0 -1
- package/dist/studio/assets/CreateDocumentDialog-CH8UH1QM.js +0 -1
- package/dist/studio/assets/DocumentsView-CxRpmAxt.js +0 -34
- package/dist/studio/assets/DropdownMenu-BSb1l7fr.js +0 -1
- package/dist/studio/assets/Input-DVao38h7.js +0 -3
- package/dist/studio/assets/MediaView-BHrPIjxB.js +0 -1
- package/dist/studio/assets/Modal-VNrXGa5C.js +0 -1
- package/dist/studio/assets/OverviewView-DfP6-mLZ.js +0 -1
- package/dist/studio/assets/Select-BJZIs9sY.js +0 -1
- package/dist/studio/assets/SettingsView-CerHe-ua.js +0 -1
- package/dist/studio/assets/Skeleton-CWJNi3nS.js +0 -1
- package/dist/studio/assets/StudioPageHeader-DP9HDAF2.js +0 -1
- package/dist/studio/assets/UsersView-cP3REkH2.js +0 -1
- package/dist/studio/assets/collaboration-BLnCzfvV.js +0 -4
- package/dist/studio/assets/context-dY4fNbn3.js +0 -1
- package/dist/studio/assets/editor-CE07wW83.js +0 -137
- package/dist/studio/assets/gateway-BAyQgCse.js +0 -10
- package/dist/studio/assets/index-CjoaPLhZ.js +0 -28
- package/dist/studio/assets/index-s2rPqCmP.css +0 -2
- package/dist/studio/assets/render-BkxbK2St.js +0 -83
- package/dist/studio/assets/rolldown-runtime-DK3Fl9T5.js +0 -1
- package/dist/studio/assets/useMediaLibrary-D7qR7aBf.js +0 -1
- package/dist/studio/index.html +0 -76
- package/src/AuthoringSchema-BQ5kbhVB.js.map +0 -1
- package/src/Configuration-BGYFD2N1.js +0 -150
- package/src/Configuration-BGYFD2N1.js.map +0 -1
- package/src/DocumentEngine-Da0kWotL.js.map +0 -1
- package/src/HttpPaths-86qLGB90.js +0 -15
- package/src/HttpPaths-86qLGB90.js.map +0 -1
- package/src/StudioHttp-BTLLooh0.js +0 -916
- package/src/StudioHttp-BTLLooh0.js.map +0 -1
- package/src/connection-ZGtL54qY.js.map +0 -1
- package/src/installation-BNKaVjni.js.map +0 -1
- package/src/internal/component-metadata.js +0 -37
- package/src/internal/component-metadata.js.map +0 -1
- package/src/metadata-Czvi3E4K.js.map +0 -1
- package/src/models-Citx8jBi.js +0 -306
- package/src/models-Citx8jBi.js.map +0 -1
- package/src/models-DS5ClMsH.js.map +0 -1
- package/src/store-Nl4uxEXx.js.map +0 -1
|
@@ -0,0 +1,726 @@
|
|
|
1
|
+
import { c as RevisionId, d as SourcePath, f as nonNegativeInt, i as DocumentVersion, o as PublicPath, p as publicPathPattern, r as DocumentId, s as RelativeDocumentPath, t as DocumentGeneration, u as Slug } from "./scalars-B2lgGUnj.js";
|
|
2
|
+
import { DateTime, Option, Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
//#region ../protocol/src/Identity.ts
|
|
5
|
+
const RequestId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand("RequestId"));
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region ../protocol/src/internal/configuration/scalars.ts
|
|
9
|
+
const collectionNamePattern = /^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$/u;
|
|
10
|
+
const localePattern = /^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u;
|
|
11
|
+
const sourceDirectoryPattern = /^(?:\.|(?!\.)[^/?#\\]+(?:\/(?!\.)[^/?#\\]+)*)$/u;
|
|
12
|
+
const AddressPattern = Schema.String.check(Schema.isPattern(publicPathPattern)).pipe(Schema.brand("AddressPattern"));
|
|
13
|
+
const CollectionName = Schema.String.check(Schema.isPattern(collectionNamePattern)).pipe(Schema.brand("CollectionName"));
|
|
14
|
+
const Locale = Schema.String.check(Schema.isPattern(localePattern)).pipe(Schema.brand("Locale"));
|
|
15
|
+
const SourceDirectory = Schema.String.check(Schema.isPattern(sourceDirectoryPattern)).pipe(Schema.brand("SourceDirectory"));
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region ../protocol/src/Media.ts
|
|
19
|
+
/**
|
|
20
|
+
* Media wire models. Search pages are newest-first with opaque continuation cursors; only ready
|
|
21
|
+
* assets are public results, and names, folders, and object keys are validated path-safe values.
|
|
22
|
+
*/
|
|
23
|
+
const hasUnsafeMediaCharacter = (value) => {
|
|
24
|
+
for (const character of value) {
|
|
25
|
+
const codePoint = character.codePointAt(0);
|
|
26
|
+
if (character === "\\" || codePoint !== void 0 && (codePoint <= 31 || codePoint === 127)) return true;
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
};
|
|
30
|
+
const isSafeMediaPath = (value, allowEmpty) => {
|
|
31
|
+
if (value.length === 0) return allowEmpty;
|
|
32
|
+
if (value !== value.trim() || value.startsWith("/") || value.endsWith("/") || hasUnsafeMediaCharacter(value)) return false;
|
|
33
|
+
return value.split("/").every((segment) => segment.length > 0 && segment !== "." && segment !== "..");
|
|
34
|
+
};
|
|
35
|
+
const safeMediaFolder = Schema.makeFilter((value) => isSafeMediaPath(value, true), { expected: "a provider-relative media folder without traversal segments" });
|
|
36
|
+
const safeMediaObjectKey = Schema.makeFilter((value) => isSafeMediaPath(value, false), { expected: "a non-empty provider-relative media object key without traversal segments" });
|
|
37
|
+
const safeMediaName = Schema.makeFilter((value) => value.length > 0 && value.length <= 255 && value === value.trim() && value !== "." && value !== ".." && !value.includes("/") && !hasUnsafeMediaCharacter(value), { expected: "a safe media file name of at most 255 characters" });
|
|
38
|
+
const MediaId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand("MediaId"));
|
|
39
|
+
const MediaFolder = Schema.String.check(Schema.isMaxLength(512), safeMediaFolder).pipe(Schema.brand("MediaFolder"));
|
|
40
|
+
const MediaObjectKey = Schema.String.check(Schema.isMaxLength(1024), safeMediaObjectKey).pipe(Schema.brand("MediaObjectKey"));
|
|
41
|
+
const MediaName = Schema.String.check(safeMediaName).pipe(Schema.brand("MediaName"));
|
|
42
|
+
const MediaCursor = Schema.NonEmptyString.pipe(Schema.brand("MediaCursor"));
|
|
43
|
+
const ImageMimeType = Schema.Literals([
|
|
44
|
+
"image/avif",
|
|
45
|
+
"image/gif",
|
|
46
|
+
"image/jpeg",
|
|
47
|
+
"image/png",
|
|
48
|
+
"image/webp"
|
|
49
|
+
]);
|
|
50
|
+
const MediaStatus = Schema.Literals([
|
|
51
|
+
"uploading",
|
|
52
|
+
"ready",
|
|
53
|
+
"deleting"
|
|
54
|
+
]);
|
|
55
|
+
const MediaByteSize = Schema.Int.check(Schema.isGreaterThan(0));
|
|
56
|
+
const MediaAsset = Schema.Struct({
|
|
57
|
+
kind: Schema.tag("image"),
|
|
58
|
+
id: MediaId,
|
|
59
|
+
objectKey: MediaObjectKey,
|
|
60
|
+
url: Schema.NonEmptyString,
|
|
61
|
+
name: MediaName,
|
|
62
|
+
folder: MediaFolder,
|
|
63
|
+
mimeType: ImageMimeType,
|
|
64
|
+
byteSize: MediaByteSize,
|
|
65
|
+
createdAt: Schema.DateTimeUtcFromString,
|
|
66
|
+
updatedAt: Schema.DateTimeUtcFromString,
|
|
67
|
+
status: MediaStatus
|
|
68
|
+
}).annotate({ identifier: "MediaAsset" });
|
|
69
|
+
const MediaUpload = Schema.Struct({
|
|
70
|
+
name: MediaName,
|
|
71
|
+
folder: Schema.optionalKey(MediaFolder),
|
|
72
|
+
declaredMimeType: Schema.optionalKey(Schema.NonEmptyString),
|
|
73
|
+
declaredByteSize: MediaByteSize
|
|
74
|
+
}).annotate({ identifier: "MediaUpload" });
|
|
75
|
+
const MediaQuery = Schema.Struct({
|
|
76
|
+
cursor: Schema.optionalKey(MediaCursor),
|
|
77
|
+
folder: Schema.optionalKey(MediaFolder),
|
|
78
|
+
search: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(200))),
|
|
79
|
+
limit: Schema.optionalKey(Schema.Int.check(Schema.isBetween({
|
|
80
|
+
minimum: 1,
|
|
81
|
+
maximum: 100
|
|
82
|
+
})))
|
|
83
|
+
}).annotate({ identifier: "MediaQuery" });
|
|
84
|
+
const ReadyMediaAssets = Schema.Array(MediaAsset).check(Schema.makeFilter((assets) => assets.every((asset) => asset.status === "ready"), { expected: "media assets whose lifecycle status is ready" }));
|
|
85
|
+
const MediaPage = Schema.Struct({
|
|
86
|
+
assets: ReadyMediaAssets,
|
|
87
|
+
folders: Schema.Array(MediaFolder),
|
|
88
|
+
nextCursor: Schema.optionalKey(MediaCursor),
|
|
89
|
+
total: nonNegativeInt
|
|
90
|
+
}).annotate({ identifier: "MediaPage" });
|
|
91
|
+
const MediaReference = Schema.Struct({
|
|
92
|
+
documentId: DocumentId,
|
|
93
|
+
mediaId: Schema.optionalKey(MediaId),
|
|
94
|
+
path: PublicPath,
|
|
95
|
+
sourcePath: SourcePath,
|
|
96
|
+
objectKey: MediaObjectKey,
|
|
97
|
+
nodePath: Schema.Array(nonNegativeInt)
|
|
98
|
+
}).annotate({ identifier: "MediaReference" });
|
|
99
|
+
const MediaObjectMismatch = Schema.Struct({
|
|
100
|
+
asset: MediaAsset,
|
|
101
|
+
storedByteSize: MediaByteSize,
|
|
102
|
+
storedMimeType: Schema.optionalKey(ImageMimeType)
|
|
103
|
+
}).annotate({ identifier: "MediaObjectMismatch" });
|
|
104
|
+
const MediaIntegrityReport = Schema.Struct({
|
|
105
|
+
missingAssets: Schema.Array(MediaReference),
|
|
106
|
+
missingObjects: Schema.Array(MediaAsset),
|
|
107
|
+
mismatchedObjects: Schema.Array(MediaObjectMismatch),
|
|
108
|
+
orphanedObjectKeys: Schema.Array(MediaObjectKey),
|
|
109
|
+
unusedAssets: Schema.Array(MediaAsset)
|
|
110
|
+
}).annotate({ identifier: "MediaIntegrityReport" });
|
|
111
|
+
const MediaCleanupReport = Schema.Struct({ removedObjectKeys: Schema.Array(MediaObjectKey) }).annotate({ identifier: "MediaCleanupReport" });
|
|
112
|
+
var MediaNotFound = class extends Schema.TaggedError()("Media.NotFound", { mediaId: MediaId }) {};
|
|
113
|
+
var MediaReferenced = class extends Schema.TaggedError()("Media.Referenced", {
|
|
114
|
+
mediaId: MediaId,
|
|
115
|
+
references: Schema.Array(MediaReference),
|
|
116
|
+
seoScopes: Schema.optionalKey(Schema.Array(Schema.Literals(["working", "published"])))
|
|
117
|
+
}) {};
|
|
118
|
+
var MediaConflict = class extends Schema.TaggedError()("Media.Conflict", { mediaId: MediaId }) {};
|
|
119
|
+
var MediaInvalid = class extends Schema.TaggedError()("Media.Invalid", { message: Schema.NonEmptyString }) {};
|
|
120
|
+
var MediaTooLarge = class extends Schema.TaggedError()("Media.TooLarge", {
|
|
121
|
+
declaredByteSize: MediaByteSize,
|
|
122
|
+
maxUploadBytes: MediaByteSize
|
|
123
|
+
}) {};
|
|
124
|
+
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region ../protocol/src/AccessControl.ts
|
|
127
|
+
const ROLES = [
|
|
128
|
+
"administrator",
|
|
129
|
+
"editor",
|
|
130
|
+
"viewer"
|
|
131
|
+
];
|
|
132
|
+
const Role = Schema.Literals(ROLES);
|
|
133
|
+
const StudioActor = Schema.Struct({
|
|
134
|
+
id: Schema.NonEmptyString,
|
|
135
|
+
email: Schema.NonEmptyString,
|
|
136
|
+
name: Schema.NonEmptyString,
|
|
137
|
+
roles: Schema.Array(Schema.NonEmptyString)
|
|
138
|
+
}).annotate({ identifier: "StudioActor" });
|
|
139
|
+
const StudioRequestContext = Schema.Struct({
|
|
140
|
+
actor: StudioActor,
|
|
141
|
+
requestId: RequestId
|
|
142
|
+
}).annotate({ identifier: "StudioRequestContext" });
|
|
143
|
+
const DOCUMENT_ACTIONS = [
|
|
144
|
+
"document.browse",
|
|
145
|
+
"document.read",
|
|
146
|
+
"document.trash",
|
|
147
|
+
"document.validate",
|
|
148
|
+
"document.create",
|
|
149
|
+
"document.update",
|
|
150
|
+
"document.move",
|
|
151
|
+
"document.remove",
|
|
152
|
+
"document.restore",
|
|
153
|
+
"document.undelete",
|
|
154
|
+
"document.publish",
|
|
155
|
+
"document.unpublish",
|
|
156
|
+
"document.duplicate",
|
|
157
|
+
"document.history"
|
|
158
|
+
];
|
|
159
|
+
const DocumentAction = Schema.Literals(DOCUMENT_ACTIONS);
|
|
160
|
+
const DocumentCatalogResource = Schema.Struct({ kind: Schema.tag("catalog") });
|
|
161
|
+
const CollectionResource = Schema.Struct({
|
|
162
|
+
kind: Schema.tag("collection"),
|
|
163
|
+
collection: CollectionName,
|
|
164
|
+
locale: Schema.optionalKey(Locale)
|
|
165
|
+
});
|
|
166
|
+
const DocumentResource = Schema.Struct({
|
|
167
|
+
kind: Schema.tag("document"),
|
|
168
|
+
documentId: DocumentId
|
|
169
|
+
});
|
|
170
|
+
const DocumentAccessResource = Schema.Union([
|
|
171
|
+
DocumentCatalogResource,
|
|
172
|
+
CollectionResource,
|
|
173
|
+
DocumentResource
|
|
174
|
+
]).pipe(Schema.toTaggedUnion("kind"));
|
|
175
|
+
const DocumentAccessDecision = Schema.Struct({
|
|
176
|
+
action: DocumentAction,
|
|
177
|
+
resource: DocumentAccessResource
|
|
178
|
+
}).annotate({ identifier: "DocumentAccessDecision" });
|
|
179
|
+
const MEDIA_ACTIONS = [
|
|
180
|
+
"media.read",
|
|
181
|
+
"media.search",
|
|
182
|
+
"media.integrity",
|
|
183
|
+
"media.upload",
|
|
184
|
+
"media.replace",
|
|
185
|
+
"media.remove",
|
|
186
|
+
"media.cleanup"
|
|
187
|
+
];
|
|
188
|
+
const MediaAction = Schema.Literals(MEDIA_ACTIONS);
|
|
189
|
+
const MediaCatalogResource = Schema.Struct({ kind: Schema.tag("media-catalog") });
|
|
190
|
+
const MediaAssetResource = Schema.Struct({
|
|
191
|
+
kind: Schema.tag("media-asset"),
|
|
192
|
+
mediaId: MediaId
|
|
193
|
+
});
|
|
194
|
+
const MediaFolderResource = Schema.Struct({
|
|
195
|
+
kind: Schema.tag("media-folder"),
|
|
196
|
+
folder: MediaFolder
|
|
197
|
+
});
|
|
198
|
+
const MediaResource = Schema.Union([
|
|
199
|
+
MediaCatalogResource,
|
|
200
|
+
MediaAssetResource,
|
|
201
|
+
MediaFolderResource
|
|
202
|
+
]).pipe(Schema.toTaggedUnion("kind"));
|
|
203
|
+
const MediaAccessDecision = Schema.Struct({
|
|
204
|
+
action: MediaAction,
|
|
205
|
+
resource: MediaResource
|
|
206
|
+
}).annotate({ identifier: "MediaAccessDecision" });
|
|
207
|
+
const ActivityResource = Schema.Struct({ kind: Schema.tag("activity") });
|
|
208
|
+
const ActivityAccessDecision = Schema.Struct({
|
|
209
|
+
action: Schema.Literal("activity.read"),
|
|
210
|
+
resource: ActivityResource
|
|
211
|
+
}).annotate({ identifier: "ActivityAccessDecision" });
|
|
212
|
+
const SEO_ACTIONS = [
|
|
213
|
+
"seo.read",
|
|
214
|
+
"seo.save",
|
|
215
|
+
"seo.publish"
|
|
216
|
+
];
|
|
217
|
+
const SeoAction = Schema.Literals(SEO_ACTIONS);
|
|
218
|
+
const SeoResource = Schema.Struct({ kind: Schema.tag("seo") });
|
|
219
|
+
const SeoAccessDecision = Schema.Struct({
|
|
220
|
+
action: SeoAction,
|
|
221
|
+
resource: SeoResource
|
|
222
|
+
}).annotate({ identifier: "SeoAccessDecision" });
|
|
223
|
+
const STUDIO_ACTIONS = [
|
|
224
|
+
...DOCUMENT_ACTIONS,
|
|
225
|
+
...MEDIA_ACTIONS,
|
|
226
|
+
...SEO_ACTIONS,
|
|
227
|
+
"activity.read"
|
|
228
|
+
];
|
|
229
|
+
const StudioAction = Schema.Literals(STUDIO_ACTIONS);
|
|
230
|
+
const StudioResource = Schema.Union([
|
|
231
|
+
DocumentAccessResource,
|
|
232
|
+
MediaResource,
|
|
233
|
+
ActivityResource,
|
|
234
|
+
SeoResource
|
|
235
|
+
]);
|
|
236
|
+
const StudioAccessDecision = Schema.Union([
|
|
237
|
+
DocumentAccessDecision,
|
|
238
|
+
MediaAccessDecision,
|
|
239
|
+
ActivityAccessDecision,
|
|
240
|
+
SeoAccessDecision
|
|
241
|
+
]);
|
|
242
|
+
var AuthenticationRequired = class extends Schema.TaggedError()("Studio.AuthenticationRequired", {}) {};
|
|
243
|
+
var StudioEntryDenied = class extends Schema.TaggedError()("Studio.EntryDenied", {}) {};
|
|
244
|
+
var AccessDenied = class extends Schema.TaggedError()("Studio.AccessDenied", {
|
|
245
|
+
action: StudioAction,
|
|
246
|
+
actorId: StudioActor.fields.id,
|
|
247
|
+
resource: StudioResource
|
|
248
|
+
}) {};
|
|
249
|
+
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region ../protocol/src/Seo.ts
|
|
252
|
+
const absoluteUrl = Schema.makeFilter((value) => {
|
|
253
|
+
try {
|
|
254
|
+
const url = new URL(value);
|
|
255
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
256
|
+
} catch {
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
}, { expected: "an absolute HTTP or HTTPS URL" });
|
|
260
|
+
const canonicalOrigin = Schema.makeFilter((value) => {
|
|
261
|
+
try {
|
|
262
|
+
const url = new URL(value);
|
|
263
|
+
return (url.protocol === "http:" || url.protocol === "https:") && url.origin === value && url.pathname === "/" && url.search === "" && url.hash === "";
|
|
264
|
+
} catch {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
}, { expected: "an HTTP or HTTPS origin without a path, query, hash, or trailing slash" });
|
|
268
|
+
const titleTemplate = Schema.makeFilter((value) => value.includes("%s"), { expected: "a title template containing %s" });
|
|
269
|
+
const calendarDate = Schema.makeFilter((value) => {
|
|
270
|
+
if (!/^\d{4}-\d{2}-\d{2}$/u.test(value)) return false;
|
|
271
|
+
const parsed = DateTime.make(value);
|
|
272
|
+
return Option.isSome(parsed) && DateTime.formatIsoDate(parsed.value) === value;
|
|
273
|
+
}, { expected: "a valid calendar date in YYYY-MM-DD format" });
|
|
274
|
+
const SeoUrl = Schema.NonEmptyString.check(absoluteUrl).pipe(Schema.brand("SeoUrl"));
|
|
275
|
+
const SeoCanonicalOrigin = Schema.NonEmptyString.check(canonicalOrigin).pipe(Schema.brand("SeoCanonicalOrigin"));
|
|
276
|
+
const SeoImage = Schema.Struct({
|
|
277
|
+
mediaId: MediaId,
|
|
278
|
+
url: SeoUrl,
|
|
279
|
+
alt: Schema.NonEmptyString
|
|
280
|
+
}).annotate({ identifier: "SeoImage" });
|
|
281
|
+
const StructuredDataType = Schema.Literals(["WebPage", "Article"]);
|
|
282
|
+
const WebPageStructuredData = Schema.Struct({ type: Schema.tag("WebPage") });
|
|
283
|
+
const ArticleStructuredData = Schema.Struct({
|
|
284
|
+
type: Schema.tag("Article"),
|
|
285
|
+
headline: Schema.optionalKey(Schema.NonEmptyString),
|
|
286
|
+
datePublished: Schema.optionalKey(Schema.String.check(calendarDate)),
|
|
287
|
+
dateModified: Schema.optionalKey(Schema.String.check(calendarDate))
|
|
288
|
+
});
|
|
289
|
+
const DocumentStructuredData = Schema.Union([WebPageStructuredData, ArticleStructuredData]).pipe(Schema.toTaggedUnion("type"));
|
|
290
|
+
const IdentityType = Schema.Literals([
|
|
291
|
+
"Person",
|
|
292
|
+
"Organization",
|
|
293
|
+
"LocalBusiness"
|
|
294
|
+
]);
|
|
295
|
+
const identityFields = {
|
|
296
|
+
name: Schema.NonEmptyString,
|
|
297
|
+
url: Schema.optionalKey(SeoUrl)
|
|
298
|
+
};
|
|
299
|
+
const PersonIdentity = Schema.Struct({
|
|
300
|
+
type: Schema.tag("Person"),
|
|
301
|
+
...identityFields,
|
|
302
|
+
image: Schema.optionalKey(SeoImage)
|
|
303
|
+
});
|
|
304
|
+
const OrganizationIdentity = Schema.Struct({
|
|
305
|
+
type: Schema.tag("Organization"),
|
|
306
|
+
...identityFields,
|
|
307
|
+
logo: Schema.optionalKey(SeoImage)
|
|
308
|
+
});
|
|
309
|
+
const PostalAddress = Schema.Struct({
|
|
310
|
+
streetAddress: Schema.optionalKey(Schema.NonEmptyString),
|
|
311
|
+
addressLocality: Schema.optionalKey(Schema.NonEmptyString),
|
|
312
|
+
addressRegion: Schema.optionalKey(Schema.NonEmptyString),
|
|
313
|
+
postalCode: Schema.optionalKey(Schema.NonEmptyString),
|
|
314
|
+
addressCountry: Schema.optionalKey(Schema.NonEmptyString)
|
|
315
|
+
}).annotate({ identifier: "PostalAddress" });
|
|
316
|
+
const LocalBusinessIdentity = Schema.Struct({
|
|
317
|
+
type: Schema.tag("LocalBusiness"),
|
|
318
|
+
...identityFields,
|
|
319
|
+
logo: Schema.optionalKey(SeoImage),
|
|
320
|
+
image: Schema.optionalKey(SeoImage),
|
|
321
|
+
telephone: Schema.optionalKey(Schema.NonEmptyString),
|
|
322
|
+
address: Schema.optionalKey(PostalAddress)
|
|
323
|
+
});
|
|
324
|
+
const SiteIdentity = Schema.Union([
|
|
325
|
+
PersonIdentity,
|
|
326
|
+
OrganizationIdentity,
|
|
327
|
+
LocalBusinessIdentity
|
|
328
|
+
]).pipe(Schema.toTaggedUnion("type"));
|
|
329
|
+
const DocumentSeo = Schema.Struct({
|
|
330
|
+
title: Schema.optionalKey(Schema.NonEmptyString),
|
|
331
|
+
description: Schema.optionalKey(Schema.NonEmptyString),
|
|
332
|
+
socialTitle: Schema.optionalKey(Schema.NonEmptyString),
|
|
333
|
+
socialDescription: Schema.optionalKey(Schema.NonEmptyString),
|
|
334
|
+
socialImage: Schema.optionalKey(SeoImage),
|
|
335
|
+
index: Schema.optionalKey(Schema.Boolean),
|
|
336
|
+
follow: Schema.optionalKey(Schema.Boolean),
|
|
337
|
+
canonicalUrl: Schema.optionalKey(SeoUrl),
|
|
338
|
+
structuredData: Schema.optionalKey(DocumentStructuredData)
|
|
339
|
+
}).annotate({ identifier: "DocumentSeo" });
|
|
340
|
+
const GlobalSeoSettings = Schema.Struct({
|
|
341
|
+
siteName: Schema.NonEmptyString,
|
|
342
|
+
defaultDescription: Schema.optionalKey(Schema.NonEmptyString),
|
|
343
|
+
canonicalOrigin: SeoCanonicalOrigin,
|
|
344
|
+
titleTemplate: Schema.optionalKey(Schema.NonEmptyString.check(titleTemplate)),
|
|
345
|
+
socialTitle: Schema.optionalKey(Schema.NonEmptyString),
|
|
346
|
+
socialDescription: Schema.optionalKey(Schema.NonEmptyString),
|
|
347
|
+
socialImage: Schema.optionalKey(SeoImage),
|
|
348
|
+
index: Schema.Boolean,
|
|
349
|
+
follow: Schema.Boolean,
|
|
350
|
+
identity: Schema.optionalKey(SiteIdentity)
|
|
351
|
+
}).annotate({ identifier: "GlobalSeoSettings" });
|
|
352
|
+
const SeoCapabilities = Schema.Struct({
|
|
353
|
+
structuredDataTypes: Schema.Array(StructuredDataType),
|
|
354
|
+
identityTypes: Schema.Array(IdentityType),
|
|
355
|
+
generatedSocialImageTemplateIds: Schema.Array(Schema.NonEmptyString)
|
|
356
|
+
}).annotate({ identifier: "SeoCapabilities" });
|
|
357
|
+
const SeoConfiguration = Schema.Struct({
|
|
358
|
+
defaults: GlobalSeoSettings,
|
|
359
|
+
capabilities: SeoCapabilities
|
|
360
|
+
}).annotate({ identifier: "SeoConfiguration" });
|
|
361
|
+
const ResolvedSeo = Schema.Struct({
|
|
362
|
+
title: Schema.NonEmptyString,
|
|
363
|
+
description: Schema.optionalKey(Schema.NonEmptyString),
|
|
364
|
+
socialTitle: Schema.NonEmptyString,
|
|
365
|
+
socialDescription: Schema.optionalKey(Schema.NonEmptyString),
|
|
366
|
+
socialImage: Schema.optionalKey(SeoImage),
|
|
367
|
+
canonicalUrl: SeoUrl,
|
|
368
|
+
index: Schema.Boolean,
|
|
369
|
+
follow: Schema.Boolean,
|
|
370
|
+
structuredData: Schema.optionalKey(DocumentStructuredData),
|
|
371
|
+
identity: Schema.optionalKey(SiteIdentity)
|
|
372
|
+
}).annotate({ identifier: "ResolvedSeo" });
|
|
373
|
+
const SeoVersion = Schema.NonEmptyString.pipe(Schema.brand("SeoVersion"));
|
|
374
|
+
const SeoRevisionId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand("SeoRevisionId"));
|
|
375
|
+
const SeoRevision = Schema.Struct({
|
|
376
|
+
revisionId: SeoRevisionId,
|
|
377
|
+
version: SeoVersion,
|
|
378
|
+
settings: GlobalSeoSettings,
|
|
379
|
+
editedBy: StudioActor,
|
|
380
|
+
editedAt: Schema.DateTimeUtcFromString
|
|
381
|
+
}).annotate({ identifier: "SeoRevision" });
|
|
382
|
+
const SeoState = Schema.Struct({
|
|
383
|
+
working: SeoRevision,
|
|
384
|
+
published: Schema.optionalKey(SeoRevision),
|
|
385
|
+
capabilities: SeoCapabilities
|
|
386
|
+
}).annotate({ identifier: "SeoState" });
|
|
387
|
+
const SeoSnapshot = Schema.Struct({
|
|
388
|
+
revision: SeoRevision,
|
|
389
|
+
capabilities: SeoCapabilities
|
|
390
|
+
}).annotate({ identifier: "SeoSnapshot" });
|
|
391
|
+
const mutationMetadata = {
|
|
392
|
+
reason: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(1e3))),
|
|
393
|
+
confirmedSiteWideChange: Schema.optionalKey(Schema.Boolean)
|
|
394
|
+
};
|
|
395
|
+
const SaveSeoInput = Schema.Struct({
|
|
396
|
+
expectedVersion: SeoVersion,
|
|
397
|
+
settings: GlobalSeoSettings,
|
|
398
|
+
...mutationMetadata
|
|
399
|
+
}).annotate({ identifier: "SaveSeoInput" });
|
|
400
|
+
const PublishSeoInput = Schema.Struct({
|
|
401
|
+
expectedVersion: SeoVersion,
|
|
402
|
+
...mutationMetadata
|
|
403
|
+
}).annotate({ identifier: "PublishSeoInput" });
|
|
404
|
+
const SeoMutationResult = Schema.Struct({
|
|
405
|
+
action: Schema.Literals(["seo.save", "seo.publish"]),
|
|
406
|
+
state: SeoState
|
|
407
|
+
}).annotate({ identifier: "SeoMutationResult" });
|
|
408
|
+
const SitemapAlternative = Schema.Struct({
|
|
409
|
+
locale: Locale,
|
|
410
|
+
loc: PublicPath
|
|
411
|
+
}).annotate({ identifier: "SitemapAlternative" });
|
|
412
|
+
const SitemapEntry = Schema.Struct({
|
|
413
|
+
loc: PublicPath,
|
|
414
|
+
lastmod: Schema.DateTimeUtcFromString,
|
|
415
|
+
alternatives: Schema.optionalKey(Schema.Array(SitemapAlternative))
|
|
416
|
+
}).annotate({ identifier: "SitemapEntry" });
|
|
417
|
+
const SeoConfirmationChange = Schema.Literals(["canonicalOrigin", "indexability"]);
|
|
418
|
+
var SeoVersionConflict = class extends Schema.TaggedError()("Seo.VersionConflict", {
|
|
419
|
+
expectedVersion: SeoVersion,
|
|
420
|
+
actualVersion: SeoVersion
|
|
421
|
+
}) {};
|
|
422
|
+
var SeoConfirmationRequired = class extends Schema.TaggedError()("Seo.ConfirmationRequired", { changes: Schema.Array(SeoConfirmationChange) }) {};
|
|
423
|
+
var SeoMediaUnavailable = class extends Schema.TaggedError()("Seo.MediaUnavailable", { mediaId: MediaId }) {};
|
|
424
|
+
|
|
425
|
+
//#endregion
|
|
426
|
+
//#region ../protocol/src/internal/documents/models.ts
|
|
427
|
+
const DocumentIssueCode = Schema.Literals([
|
|
428
|
+
"document.collision",
|
|
429
|
+
"document.id",
|
|
430
|
+
"document.invalid",
|
|
431
|
+
"i18n.missing-translation",
|
|
432
|
+
"markdown.parse",
|
|
433
|
+
"reference.document",
|
|
434
|
+
"reference.component",
|
|
435
|
+
"seo.invalid",
|
|
436
|
+
"schema.option",
|
|
437
|
+
"schema.constraint",
|
|
438
|
+
"schema.required",
|
|
439
|
+
"schema.type",
|
|
440
|
+
"schema.unknown"
|
|
441
|
+
]);
|
|
442
|
+
const DocumentIssue = Schema.Struct({
|
|
443
|
+
code: DocumentIssueCode,
|
|
444
|
+
severity: Schema.Literals(["error", "warning"]),
|
|
445
|
+
message: Schema.NonEmptyString,
|
|
446
|
+
sourcePath: Schema.optionalKey(SourcePath),
|
|
447
|
+
collection: Schema.optionalKey(CollectionName),
|
|
448
|
+
field: Schema.optionalKey(Schema.NonEmptyString),
|
|
449
|
+
key: Schema.optionalKey(PublicPath),
|
|
450
|
+
locale: Schema.optionalKey(Locale)
|
|
451
|
+
}).annotate({ identifier: "DocumentIssue" });
|
|
452
|
+
const DocumentSourcePoint = Schema.Struct({
|
|
453
|
+
offset: nonNegativeInt,
|
|
454
|
+
line: nonNegativeInt,
|
|
455
|
+
column: nonNegativeInt
|
|
456
|
+
});
|
|
457
|
+
const DocumentSourceRange = Schema.Struct({
|
|
458
|
+
start: DocumentSourcePoint,
|
|
459
|
+
end: DocumentSourcePoint
|
|
460
|
+
});
|
|
461
|
+
const DocumentSourceMapping = Schema.Struct({
|
|
462
|
+
nodePath: Schema.Array(nonNegativeInt),
|
|
463
|
+
range: DocumentSourceRange
|
|
464
|
+
});
|
|
465
|
+
const MarkdownNode = Schema.suspend(() => Schema.Union([
|
|
466
|
+
Schema.String,
|
|
467
|
+
Schema.Tuple([
|
|
468
|
+
Schema.Null,
|
|
469
|
+
Schema.JsonObject,
|
|
470
|
+
Schema.String
|
|
471
|
+
]),
|
|
472
|
+
Schema.TupleWithRest(Schema.Tuple([Schema.NonEmptyString, Schema.JsonObject]), [MarkdownNode])
|
|
473
|
+
]));
|
|
474
|
+
const CmsMarkdownDocument = Schema.Struct({
|
|
475
|
+
nodes: Schema.Array(MarkdownNode),
|
|
476
|
+
frontmatter: Schema.JsonObject,
|
|
477
|
+
meta: Schema.JsonObject
|
|
478
|
+
}).annotate({ identifier: "CmsMarkdownDocument" });
|
|
479
|
+
const CmsDocumentHeading = Schema.Struct({
|
|
480
|
+
depth: Schema.Int.check(Schema.isBetween({
|
|
481
|
+
minimum: 1,
|
|
482
|
+
maximum: 6
|
|
483
|
+
})),
|
|
484
|
+
id: Schema.String,
|
|
485
|
+
text: Schema.String
|
|
486
|
+
});
|
|
487
|
+
const CmsDocumentAnalysis = Schema.Struct({
|
|
488
|
+
components: Schema.Array(Schema.NonEmptyString),
|
|
489
|
+
headings: Schema.Array(CmsDocumentHeading),
|
|
490
|
+
searchText: Schema.String,
|
|
491
|
+
summary: Schema.String
|
|
492
|
+
});
|
|
493
|
+
const CompiledDocumentSource = Schema.Struct({
|
|
494
|
+
path: SourcePath,
|
|
495
|
+
mappings: Schema.Array(DocumentSourceMapping),
|
|
496
|
+
publishedAt: Schema.optionalKey(Schema.DateTimeUtcFromString)
|
|
497
|
+
});
|
|
498
|
+
const CompiledDocument = Schema.Struct({
|
|
499
|
+
id: DocumentId,
|
|
500
|
+
key: PublicPath,
|
|
501
|
+
path: PublicPath,
|
|
502
|
+
locale: Schema.optionalKey(Locale),
|
|
503
|
+
collection: CollectionName,
|
|
504
|
+
draft: Schema.Boolean,
|
|
505
|
+
title: Schema.NonEmptyString,
|
|
506
|
+
description: Schema.optionalKey(Schema.String),
|
|
507
|
+
seo: Schema.optionalKey(DocumentSeo),
|
|
508
|
+
resolvedSeo: Schema.optionalKey(ResolvedSeo),
|
|
509
|
+
data: Schema.JsonObject,
|
|
510
|
+
issues: Schema.Array(DocumentIssue),
|
|
511
|
+
analysis: CmsDocumentAnalysis,
|
|
512
|
+
body: CmsMarkdownDocument,
|
|
513
|
+
engineFingerprint: Schema.NonEmptyString,
|
|
514
|
+
source: CompiledDocumentSource
|
|
515
|
+
}).annotate({ identifier: "CompiledDocument" });
|
|
516
|
+
const documentAttribution = {
|
|
517
|
+
createdBy: Schema.optionalKey(StudioActor),
|
|
518
|
+
editedBy: Schema.optionalKey(StudioActor),
|
|
519
|
+
editedAt: Schema.optionalKey(Schema.DateTimeUtcFromString)
|
|
520
|
+
};
|
|
521
|
+
const DocumentSource = Schema.Struct({
|
|
522
|
+
...documentAttribution,
|
|
523
|
+
documentId: DocumentId,
|
|
524
|
+
sourcePath: SourcePath,
|
|
525
|
+
markdown: Schema.String,
|
|
526
|
+
revisionId: RevisionId,
|
|
527
|
+
version: DocumentVersion,
|
|
528
|
+
publishedVersion: Schema.optionalKey(DocumentVersion)
|
|
529
|
+
}).annotate({ identifier: "DocumentSource" });
|
|
530
|
+
const DocumentImportSource = Schema.Struct({
|
|
531
|
+
sourcePath: SourcePath,
|
|
532
|
+
markdown: Schema.String,
|
|
533
|
+
published: Schema.Boolean
|
|
534
|
+
}).annotate({ identifier: "DocumentImportSource" });
|
|
535
|
+
const DocumentImportMode = Schema.Literals(["preserve", "overwrite"]);
|
|
536
|
+
const DocumentImportInput = Schema.Struct({
|
|
537
|
+
sources: Schema.Array(DocumentImportSource),
|
|
538
|
+
mode: DocumentImportMode,
|
|
539
|
+
reason: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(1e3)))
|
|
540
|
+
}).annotate({ identifier: "DocumentImportInput" });
|
|
541
|
+
const DocumentImportReport = Schema.Struct({
|
|
542
|
+
created: nonNegativeInt,
|
|
543
|
+
preserved: nonNegativeInt,
|
|
544
|
+
published: nonNegativeInt,
|
|
545
|
+
unchanged: nonNegativeInt,
|
|
546
|
+
updated: nonNegativeInt
|
|
547
|
+
}).annotate({ identifier: "DocumentImportReport" });
|
|
548
|
+
const DocumentSummary = Schema.Struct({
|
|
549
|
+
...documentAttribution,
|
|
550
|
+
publishedVersion: Schema.optionalKey(DocumentVersion),
|
|
551
|
+
publishedPath: Schema.optionalKey(PublicPath),
|
|
552
|
+
sourcePath: SourcePath,
|
|
553
|
+
version: DocumentVersion,
|
|
554
|
+
document: CompiledDocument
|
|
555
|
+
}).annotate({ identifier: "DocumentSummary" });
|
|
556
|
+
const DeletedDocument = Schema.Struct({
|
|
557
|
+
title: Schema.optionalKey(Schema.String),
|
|
558
|
+
path: Schema.optionalKey(PublicPath),
|
|
559
|
+
trashBatchId: Schema.optionalKey(DocumentVersion),
|
|
560
|
+
documentId: DocumentId,
|
|
561
|
+
deletedAt: Schema.DateTimeUtcFromString,
|
|
562
|
+
sourcePath: SourcePath,
|
|
563
|
+
version: DocumentVersion
|
|
564
|
+
}).annotate({ identifier: "DeletedDocument" });
|
|
565
|
+
const DocumentBrowseQuery = Schema.Struct({
|
|
566
|
+
collection: Schema.optionalKey(CollectionName),
|
|
567
|
+
locale: Schema.optionalKey(Locale)
|
|
568
|
+
}).annotate({ identifier: "DocumentBrowseQuery" });
|
|
569
|
+
const PublishedDocumentLookup = Schema.Union([
|
|
570
|
+
Schema.Struct({
|
|
571
|
+
kind: Schema.tag("id"),
|
|
572
|
+
documentId: DocumentId
|
|
573
|
+
}),
|
|
574
|
+
Schema.Struct({
|
|
575
|
+
kind: Schema.tag("path"),
|
|
576
|
+
path: PublicPath
|
|
577
|
+
}),
|
|
578
|
+
Schema.Struct({
|
|
579
|
+
kind: Schema.tag("key"),
|
|
580
|
+
key: PublicPath,
|
|
581
|
+
collection: Schema.optionalKey(CollectionName),
|
|
582
|
+
locale: Schema.optionalKey(Locale)
|
|
583
|
+
})
|
|
584
|
+
]).pipe(Schema.toTaggedUnion("kind"));
|
|
585
|
+
const DocumentQueryScalar = Schema.Union([
|
|
586
|
+
Schema.String,
|
|
587
|
+
Schema.Finite,
|
|
588
|
+
Schema.Boolean,
|
|
589
|
+
Schema.Null
|
|
590
|
+
]);
|
|
591
|
+
const validDocumentQueryField = Schema.makeFilter((field) => {
|
|
592
|
+
const segments = field.split(".");
|
|
593
|
+
return field.length <= 200 && segments.length <= 8 && segments.every((segment) => segment.length > 0);
|
|
594
|
+
}, { expected: "a non-empty field path of at most 200 characters and eight non-empty segments" });
|
|
595
|
+
const DocumentQueryField = Schema.NonEmptyString.check(validDocumentQueryField);
|
|
596
|
+
const DocumentQueryValue = Schema.Union([DocumentQueryScalar, Schema.Array(DocumentQueryScalar).check(Schema.isMaxLength(20))]);
|
|
597
|
+
const DocumentQuerySort = Schema.Struct({
|
|
598
|
+
field: DocumentQueryField,
|
|
599
|
+
direction: Schema.optionalKey(Schema.Literals(["asc", "desc"]))
|
|
600
|
+
});
|
|
601
|
+
const DocumentQueryWhere = Schema.Record(Schema.String, DocumentQueryValue).check(Schema.makeFilter((where) => Object.keys(where).every((field) => Schema.is(DocumentQueryField)(field)), { expected: "document query keys with valid bounded field paths" }), Schema.makeFilter((where) => Object.keys(where).length <= 12, { expected: "at most 12 document query filters" }));
|
|
602
|
+
const PublishedDocumentSelection = Schema.Struct({
|
|
603
|
+
collection: Schema.optionalKey(CollectionName),
|
|
604
|
+
locale: Schema.optionalKey(Locale),
|
|
605
|
+
where: Schema.optionalKey(DocumentQueryWhere),
|
|
606
|
+
sort: Schema.optionalKey(Schema.Array(DocumentQuerySort).check(Schema.isMaxLength(4)))
|
|
607
|
+
}).annotate({ identifier: "PublishedDocumentSelection" });
|
|
608
|
+
const PublishedDocumentQuery = Schema.Struct({
|
|
609
|
+
...PublishedDocumentSelection.fields,
|
|
610
|
+
offset: Schema.optionalKey(nonNegativeInt),
|
|
611
|
+
limit: Schema.Int.check(Schema.isBetween({
|
|
612
|
+
minimum: 1,
|
|
613
|
+
maximum: 100
|
|
614
|
+
}))
|
|
615
|
+
}).annotate({ identifier: "PublishedDocumentQuery" });
|
|
616
|
+
const PublishedDocumentSurroundQuery = Schema.Struct({ ...PublishedDocumentSelection.fields }).annotate({ identifier: "PublishedDocumentSurroundQuery" });
|
|
617
|
+
const PublishedDocumentPage = Schema.Struct({
|
|
618
|
+
items: Schema.Array(CompiledDocument),
|
|
619
|
+
total: nonNegativeInt
|
|
620
|
+
}).annotate({ identifier: "PublishedDocumentPage" });
|
|
621
|
+
const DocumentNavigationQuery = Schema.Struct({
|
|
622
|
+
collection: Schema.optionalKey(CollectionName),
|
|
623
|
+
locale: Schema.optionalKey(Locale)
|
|
624
|
+
}).annotate({ identifier: "DocumentNavigationQuery" });
|
|
625
|
+
const documentMutationMetadata = { reason: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(1e3))) };
|
|
626
|
+
const DocumentNavigationItem = Schema.suspend(() => Schema.Struct({
|
|
627
|
+
key: PublicPath,
|
|
628
|
+
title: Schema.NonEmptyString,
|
|
629
|
+
path: Schema.optionalKey(PublicPath),
|
|
630
|
+
locale: Schema.optionalKey(Locale),
|
|
631
|
+
documentId: Schema.optionalKey(DocumentId),
|
|
632
|
+
children: Schema.Array(DocumentNavigationItem)
|
|
633
|
+
}));
|
|
634
|
+
const DocumentSurround = Schema.Struct({
|
|
635
|
+
previous: Schema.NullOr(CompiledDocument),
|
|
636
|
+
next: Schema.NullOr(CompiledDocument)
|
|
637
|
+
}).annotate({ identifier: "DocumentSurround" });
|
|
638
|
+
const HomeDocumentLocation = Schema.Struct({ kind: Schema.tag("home") });
|
|
639
|
+
const NestedDocumentLocation = Schema.Struct({
|
|
640
|
+
kind: Schema.tag("entry"),
|
|
641
|
+
parent: Schema.optionalKey(RelativeDocumentPath),
|
|
642
|
+
slug: Slug
|
|
643
|
+
});
|
|
644
|
+
const DocumentLocation = Schema.Union([HomeDocumentLocation, NestedDocumentLocation]).pipe(Schema.toTaggedUnion("kind"));
|
|
645
|
+
const CreateDocumentInput = Schema.Struct({
|
|
646
|
+
collection: CollectionName,
|
|
647
|
+
locale: Schema.optionalKey(Locale),
|
|
648
|
+
location: DocumentLocation,
|
|
649
|
+
title: Schema.NonEmptyString,
|
|
650
|
+
...documentMutationMetadata
|
|
651
|
+
}).annotate({ identifier: "CreateDocumentInput" });
|
|
652
|
+
const UpdateDocumentInput = Schema.Struct({
|
|
653
|
+
documentId: DocumentId,
|
|
654
|
+
expectedVersion: DocumentVersion,
|
|
655
|
+
markdown: Schema.String,
|
|
656
|
+
...documentMutationMetadata
|
|
657
|
+
}).annotate({ identifier: "UpdateDocumentInput" });
|
|
658
|
+
const MoveDocumentInput = Schema.Struct({
|
|
659
|
+
documentId: DocumentId,
|
|
660
|
+
expectedVersion: DocumentVersion,
|
|
661
|
+
location: DocumentLocation,
|
|
662
|
+
...documentMutationMetadata
|
|
663
|
+
}).annotate({ identifier: "MoveDocumentInput" });
|
|
664
|
+
const DuplicateDocumentInput = Schema.Struct({
|
|
665
|
+
...MoveDocumentInput.fields,
|
|
666
|
+
includeChildren: Schema.Boolean
|
|
667
|
+
}).annotate({ identifier: "DuplicateDocumentInput" });
|
|
668
|
+
const UnpublishDocumentInput = Schema.Struct({
|
|
669
|
+
documentId: DocumentId,
|
|
670
|
+
expectedVersion: DocumentVersion,
|
|
671
|
+
...documentMutationMetadata
|
|
672
|
+
}).annotate({ identifier: "UnpublishDocumentInput" });
|
|
673
|
+
const RemoveDocumentInput = Schema.Struct({
|
|
674
|
+
documentId: DocumentId,
|
|
675
|
+
expectedVersion: DocumentVersion,
|
|
676
|
+
...documentMutationMetadata
|
|
677
|
+
}).annotate({ identifier: "RemoveDocumentInput" });
|
|
678
|
+
const PublishDocumentInput = Schema.Struct({
|
|
679
|
+
documentId: DocumentId,
|
|
680
|
+
expectedVersion: DocumentVersion,
|
|
681
|
+
...documentMutationMetadata
|
|
682
|
+
}).annotate({ identifier: "PublishDocumentInput" });
|
|
683
|
+
const RestoreDocumentInput = Schema.Struct({
|
|
684
|
+
documentId: DocumentId,
|
|
685
|
+
revisionId: RevisionId,
|
|
686
|
+
expectedVersion: DocumentVersion,
|
|
687
|
+
...documentMutationMetadata
|
|
688
|
+
}).annotate({ identifier: "RestoreDocumentInput" });
|
|
689
|
+
const UndeleteDocumentInput = Schema.Struct({
|
|
690
|
+
documentId: DocumentId,
|
|
691
|
+
expectedVersion: DocumentVersion,
|
|
692
|
+
...documentMutationMetadata
|
|
693
|
+
}).annotate({ identifier: "UndeleteDocumentInput" });
|
|
694
|
+
const DOCUMENT_REVISION_ACTIONS = [
|
|
695
|
+
"document.create",
|
|
696
|
+
"document.move",
|
|
697
|
+
"document.remove",
|
|
698
|
+
"document.restore",
|
|
699
|
+
"document.undelete",
|
|
700
|
+
"document.update"
|
|
701
|
+
];
|
|
702
|
+
const DocumentRevisionAction = Schema.Literals(DOCUMENT_REVISION_ACTIONS);
|
|
703
|
+
const DocumentMutationAction = Schema.Literals([
|
|
704
|
+
...DOCUMENT_REVISION_ACTIONS,
|
|
705
|
+
"document.publish",
|
|
706
|
+
"document.unpublish"
|
|
707
|
+
]);
|
|
708
|
+
const DocumentMutationResult = Schema.Struct({
|
|
709
|
+
action: DocumentMutationAction,
|
|
710
|
+
affectedDocumentIds: Schema.optionalKey(Schema.Array(DocumentId)),
|
|
711
|
+
documentId: DocumentId,
|
|
712
|
+
generation: DocumentGeneration,
|
|
713
|
+
revisionId: RevisionId,
|
|
714
|
+
sourcePath: SourcePath,
|
|
715
|
+
version: DocumentVersion,
|
|
716
|
+
entry: Schema.optionalKey(DocumentSummary)
|
|
717
|
+
}).annotate({ identifier: "DocumentMutationResult" });
|
|
718
|
+
const DocumentValidationResult = Schema.Struct({
|
|
719
|
+
valid: Schema.Boolean,
|
|
720
|
+
document: Schema.optionalKey(CompiledDocument),
|
|
721
|
+
issues: Schema.Array(DocumentIssue)
|
|
722
|
+
}).annotate({ identifier: "DocumentValidationResult" });
|
|
723
|
+
|
|
724
|
+
//#endregion
|
|
725
|
+
export { DOCUMENT_ACTIONS as $, RemoveDocumentInput as A, SeoCapabilities as B, MarkdownNode as C, MediaTooLarge as Ct, PublishedDocumentPage as D, Locale as Dt, PublishedDocumentLookup as E, CollectionName as Et, DocumentSeo as F, SeoRevision as G, SeoConfirmationRequired as H, GlobalSeoSettings as I, SeoUrl as J, SeoSnapshot as K, PublishSeoInput as L, UndeleteDocumentInput as M, UnpublishDocumentInput as N, PublishedDocumentQuery as O, SourceDirectory as Ot, UpdateDocumentInput as P, AuthenticationRequired as Q, SaveSeoInput as R, DuplicateDocumentInput as S, MediaStatus as St, PublishDocumentInput as T, AddressPattern as Tt, SeoMediaUnavailable as U, SeoConfiguration as V, SeoMutationResult as W, SitemapEntry as X, SeoVersionConflict as Y, AccessDenied as Z, DocumentSource as _, MediaObjectKey as _t, DOCUMENT_REVISION_ACTIONS as a, ImageMimeType as at, DocumentSurround as b, MediaReference as bt, DocumentImportInput as c, MediaCleanupReport as ct, DocumentIssue as d, MediaFolder as dt, MEDIA_ACTIONS as et, DocumentMutationResult as f, MediaId as ft, DocumentRevisionAction as g, MediaNotFound as gt, DocumentQueryScalar as h, MediaName as ht, CreateDocumentInput as i, StudioRequestContext as it, RestoreDocumentInput as j, PublishedDocumentSurroundQuery as k, RequestId as kt, DocumentImportReport as l, MediaConflict as lt, DocumentNavigationQuery as m, MediaInvalid as mt, CmsMarkdownDocument as n, StudioActor as nt, DeletedDocument as o, MediaAsset as ot, DocumentNavigationItem as p, MediaIntegrityReport as pt, SeoState as q, CompiledDocument as r, StudioEntryDenied as rt, DocumentBrowseQuery as s, MediaByteSize as st, CmsDocumentAnalysis as t, Role as tt, DocumentImportSource as u, MediaCursor as ut, DocumentSourceMapping as v, MediaPage as vt, MoveDocumentInput as w, MediaUpload as wt, DocumentValidationResult as x, MediaReferenced as xt, DocumentSummary as y, MediaQuery as yt, SeoCanonicalOrigin as z };
|
|
726
|
+
//# sourceMappingURL=models-DwYioyNV.js.map
|