@phtngyn/cms 0.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +13 -0
- package/README.md +90 -0
- package/dist/studio/assets/ActivityEntryRow-D--fRvWI.js +1 -0
- package/dist/studio/assets/ActivityView-D-XBBUHb.js +1 -0
- package/dist/studio/assets/CreateDocumentDialog-CH8UH1QM.js +1 -0
- package/dist/studio/assets/DocumentsView-CxRpmAxt.js +34 -0
- package/dist/studio/assets/DropdownMenu-BSb1l7fr.js +1 -0
- package/dist/studio/assets/Input-DVao38h7.js +3 -0
- package/dist/studio/assets/MediaView-BHrPIjxB.js +1 -0
- package/dist/studio/assets/Modal-VNrXGa5C.js +1 -0
- package/dist/studio/assets/OverviewView-DfP6-mLZ.js +1 -0
- package/dist/studio/assets/Select-BJZIs9sY.js +1 -0
- package/dist/studio/assets/SettingsView-CerHe-ua.js +1 -0
- package/dist/studio/assets/Skeleton-CWJNi3nS.js +1 -0
- package/dist/studio/assets/StudioPageHeader-DP9HDAF2.js +1 -0
- package/dist/studio/assets/UsersView-cP3REkH2.js +1 -0
- package/dist/studio/assets/collaboration-BLnCzfvV.js +4 -0
- package/dist/studio/assets/context-dY4fNbn3.js +1 -0
- package/dist/studio/assets/editor-CE07wW83.js +137 -0
- package/dist/studio/assets/gateway-BAyQgCse.js +10 -0
- package/dist/studio/assets/index-CjoaPLhZ.js +28 -0
- package/dist/studio/assets/index-s2rPqCmP.css +2 -0
- package/dist/studio/assets/render-BkxbK2St.js +83 -0
- package/dist/studio/assets/rolldown-runtime-DK3Fl9T5.js +1 -0
- package/dist/studio/assets/useMediaLibrary-D7qR7aBf.js +1 -0
- package/dist/studio/index.html +76 -0
- package/package.json +75 -0
- package/src/Authoring.d.ts +46 -0
- package/src/Authoring.js +1 -0
- package/src/AuthoringSchema-BQ5kbhVB.js +926 -0
- package/src/AuthoringSchema-BQ5kbhVB.js.map +1 -0
- package/src/Configuration-BGYFD2N1.js +150 -0
- package/src/Configuration-BGYFD2N1.js.map +1 -0
- package/src/Configuration.d.ts +44 -0
- package/src/Configuration.js +9 -0
- package/src/Configuration.js.map +1 -0
- package/src/DocumentEngine-Da0kWotL.js +851 -0
- package/src/DocumentEngine-Da0kWotL.js.map +1 -0
- package/src/DocumentModel.d.ts +30 -0
- package/src/DocumentModel.js +15 -0
- package/src/DocumentModel.js.map +1 -0
- package/src/HttpPaths-86qLGB90.js +15 -0
- package/src/HttpPaths-86qLGB90.js.map +1 -0
- package/src/Module.d.ts +12 -0
- package/src/Module.js +167 -0
- package/src/Module.js.map +1 -0
- package/src/StudioHttp-BTLLooh0.js +916 -0
- package/src/StudioHttp-BTLLooh0.js.map +1 -0
- package/src/connection-ZGtL54qY.js +94 -0
- package/src/connection-ZGtL54qY.js.map +1 -0
- package/src/installation-BNKaVjni.js +9128 -0
- package/src/installation-BNKaVjni.js.map +1 -0
- package/src/internal/authoring-compiler.js +120 -0
- package/src/internal/authoring-compiler.js.map +1 -0
- package/src/internal/authoring-metadata.js +163 -0
- package/src/internal/authoring-metadata.js.map +1 -0
- package/src/internal/cms-config.js +46 -0
- package/src/internal/cms-config.js.map +1 -0
- package/src/internal/component-metadata.js +37 -0
- package/src/internal/component-metadata.js.map +1 -0
- package/src/internal/configuration.js +93 -0
- package/src/internal/configuration.js.map +1 -0
- package/src/internal/document-model.js +236 -0
- package/src/internal/document-model.js.map +1 -0
- package/src/internal/field-metadata.js +6 -0
- package/src/internal/field-metadata.js.map +1 -0
- package/src/metadata-Czvi3E4K.js +190 -0
- package/src/metadata-Czvi3E4K.js.map +1 -0
- package/src/models-Citx8jBi.js +306 -0
- package/src/models-Citx8jBi.js.map +1 -0
- package/src/models-DS5ClMsH.js +153 -0
- package/src/models-DS5ClMsH.js.map +1 -0
- package/src/runtime/api.js +9 -0
- package/src/runtime/api.js.map +1 -0
- package/src/runtime/collaboration.js +40 -0
- package/src/runtime/collaboration.js.map +1 -0
- package/src/runtime/delivery/DocumentField.js +23 -0
- package/src/runtime/delivery/DocumentField.js.map +1 -0
- package/src/runtime/delivery/DocumentRenderer.js +51 -0
- package/src/runtime/delivery/DocumentRenderer.js.map +1 -0
- package/src/runtime/delivery/DocumentScope.js +41 -0
- package/src/runtime/delivery/DocumentScope.js.map +1 -0
- package/src/runtime/delivery/document-page.js +23 -0
- package/src/runtime/delivery/document-page.js.map +1 -0
- package/src/runtime/delivery/document.js +25 -0
- package/src/runtime/delivery/document.js.map +1 -0
- package/src/runtime/delivery/preview.d.ts +11 -0
- package/src/runtime/delivery/preview.js +6 -0
- package/src/runtime/delivery/preview.js.map +1 -0
- package/src/runtime/delivery/types.d.ts +80 -0
- package/src/runtime/delivery/types.js +1 -0
- package/src/runtime/delivery/useDocument.d.ts +6 -0
- package/src/runtime/delivery/useDocument.js +20 -0
- package/src/runtime/delivery/useDocument.js.map +1 -0
- package/src/runtime/delivery/useDocumentQuery.d.ts +7 -0
- package/src/runtime/delivery/useDocumentQuery.js +26 -0
- package/src/runtime/delivery/useDocumentQuery.js.map +1 -0
- package/src/runtime/installation.js +3 -0
- package/src/runtime/plugin.js +32 -0
- package/src/runtime/plugin.js.map +1 -0
- package/src/runtime/preview/CmsStudioPreviewMarker.js +15 -0
- package/src/runtime/preview/CmsStudioPreviewMarker.js.map +1 -0
- package/src/runtime/preview/comark-document.js +38 -0
- package/src/runtime/preview/comark-document.js.map +1 -0
- package/src/runtime/preview/connection.js +3 -0
- package/src/runtime/preview/controller.js +247 -0
- package/src/runtime/preview/controller.js.map +1 -0
- package/src/runtime/preview/plugin.client.js +70 -0
- package/src/runtime/preview/plugin.client.js.map +1 -0
- package/src/runtime/preview/preview.css +9 -0
- package/src/runtime/preview/protocol.d.ts +10 -0
- package/src/runtime/preview/protocol.js +11 -0
- package/src/runtime/preview/protocol.js.map +1 -0
- package/src/runtime/preview/store.js +4 -0
- package/src/runtime/preview/targets.js +102 -0
- package/src/runtime/preview/targets.js.map +1 -0
- package/src/runtime/studio-app.js +13 -0
- package/src/runtime/studio-app.js.map +1 -0
- package/src/store-Nl4uxEXx.js +221 -0
- package/src/store-Nl4uxEXx.js.map +1 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region ../protocol/src/internal/scalars.ts
|
|
4
|
+
const nonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
|
|
5
|
+
const publicPathPattern = /^\/(?!(?:[^/]+\/)*\.\.?(?:\/|$))(?:[^/?#\\]+(?:\/[^/?#\\]+)*)?$/u;
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region ../protocol/src/internal/documents/scalars.ts
|
|
9
|
+
const relativeDocumentPathPattern = /^(?!(?:[^/]+\/)*\.\.?(?:\/|$))[^/?#\\]+(?:\/[^/?#\\]+)*$/u;
|
|
10
|
+
const slugPattern = /^[\p{Letter}\p{Number}][\p{Letter}\p{Number}_-]*$/u;
|
|
11
|
+
const sourcePathPattern = /^(?!\.)[^/?#\\]+(?:\/(?!\.)[^/?#\\]+)*\.(?:md|mdc)$/u;
|
|
12
|
+
const DocumentGeneration = Schema.String.check(Schema.isPattern(/^(?:0|[1-9]\d*)$/u)).pipe(Schema.brand("DocumentGeneration"));
|
|
13
|
+
const DocumentVersion = Schema.NonEmptyString.pipe(Schema.brand("DocumentVersion"));
|
|
14
|
+
const DocumentHistoryCursor = Schema.NonEmptyString.pipe(Schema.brand("DocumentHistoryCursor"));
|
|
15
|
+
const DocumentId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand("DocumentId"));
|
|
16
|
+
const EditorNodeId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand("EditorNodeId"));
|
|
17
|
+
const PublicPath = Schema.String.check(Schema.isPattern(publicPathPattern)).pipe(Schema.brand("PublicPath"));
|
|
18
|
+
const RelativeDocumentPath = Schema.String.check(Schema.isPattern(relativeDocumentPathPattern)).pipe(Schema.brand("RelativeDocumentPath"));
|
|
19
|
+
const RevisionId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand("RevisionId"));
|
|
20
|
+
const RevisionNumber = nonNegativeInt.pipe(Schema.brand("RevisionNumber"));
|
|
21
|
+
const Slug = Schema.String.check(Schema.isPattern(slugPattern)).pipe(Schema.brand("Slug"));
|
|
22
|
+
const SourcePath = Schema.String.check(Schema.isPattern(sourcePathPattern)).pipe(Schema.brand("SourcePath"));
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region ../protocol/src/internal/configuration/scalars.ts
|
|
26
|
+
const collectionNamePattern = /^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$/u;
|
|
27
|
+
const localePattern = /^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u;
|
|
28
|
+
const sourceDirectoryPattern = /^(?:\.|(?!\.)[^/?#\\]+(?:\/(?!\.)[^/?#\\]+)*)$/u;
|
|
29
|
+
const AddressPattern = Schema.String.check(Schema.isPattern(publicPathPattern)).pipe(Schema.brand("AddressPattern"));
|
|
30
|
+
const CollectionName = Schema.String.check(Schema.isPattern(collectionNamePattern)).pipe(Schema.brand("CollectionName"));
|
|
31
|
+
const Locale = Schema.String.check(Schema.isPattern(localePattern)).pipe(Schema.brand("Locale"));
|
|
32
|
+
const SourceDirectory = Schema.String.check(Schema.isPattern(sourceDirectoryPattern)).pipe(Schema.brand("SourceDirectory"));
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region ../protocol/src/internal/documents/models.ts
|
|
36
|
+
const DocumentIssueCode = Schema.Literals([
|
|
37
|
+
"document.collision",
|
|
38
|
+
"document.id",
|
|
39
|
+
"document.invalid",
|
|
40
|
+
"i18n.missing-translation",
|
|
41
|
+
"markdown.parse",
|
|
42
|
+
"reference.document",
|
|
43
|
+
"reference.component",
|
|
44
|
+
"schema.option",
|
|
45
|
+
"schema.constraint",
|
|
46
|
+
"schema.required",
|
|
47
|
+
"schema.type",
|
|
48
|
+
"schema.unknown"
|
|
49
|
+
]);
|
|
50
|
+
const DocumentIssue = Schema.Struct({
|
|
51
|
+
code: DocumentIssueCode,
|
|
52
|
+
severity: Schema.Literals(["error", "warning"]),
|
|
53
|
+
message: Schema.NonEmptyString,
|
|
54
|
+
sourcePath: Schema.optionalKey(SourcePath),
|
|
55
|
+
collection: Schema.optionalKey(CollectionName),
|
|
56
|
+
field: Schema.optionalKey(Schema.NonEmptyString),
|
|
57
|
+
key: Schema.optionalKey(PublicPath),
|
|
58
|
+
locale: Schema.optionalKey(Locale)
|
|
59
|
+
}).annotate({ identifier: "DocumentIssue" });
|
|
60
|
+
const DocumentSourcePoint = Schema.Struct({
|
|
61
|
+
offset: nonNegativeInt,
|
|
62
|
+
line: nonNegativeInt,
|
|
63
|
+
column: nonNegativeInt
|
|
64
|
+
});
|
|
65
|
+
const DocumentSourceRange = Schema.Struct({
|
|
66
|
+
start: DocumentSourcePoint,
|
|
67
|
+
end: DocumentSourcePoint
|
|
68
|
+
});
|
|
69
|
+
const DocumentSourceMapping = Schema.Struct({
|
|
70
|
+
nodePath: Schema.Array(nonNegativeInt),
|
|
71
|
+
range: DocumentSourceRange
|
|
72
|
+
});
|
|
73
|
+
const MarkdownNode = Schema.suspend(() => Schema.Union([
|
|
74
|
+
Schema.String,
|
|
75
|
+
Schema.Tuple([
|
|
76
|
+
Schema.Null,
|
|
77
|
+
Schema.JsonObject,
|
|
78
|
+
Schema.String
|
|
79
|
+
]),
|
|
80
|
+
Schema.TupleWithRest(Schema.Tuple([Schema.NonEmptyString, Schema.JsonObject]), [MarkdownNode])
|
|
81
|
+
]));
|
|
82
|
+
const CmsMarkdownDocument = Schema.Struct({
|
|
83
|
+
nodes: Schema.Array(MarkdownNode),
|
|
84
|
+
frontmatter: Schema.JsonObject,
|
|
85
|
+
meta: Schema.JsonObject
|
|
86
|
+
}).annotate({ identifier: "CmsMarkdownDocument" });
|
|
87
|
+
const CmsDocumentHeading = Schema.Struct({
|
|
88
|
+
depth: Schema.Int.check(Schema.isBetween({
|
|
89
|
+
minimum: 1,
|
|
90
|
+
maximum: 6
|
|
91
|
+
})),
|
|
92
|
+
id: Schema.String,
|
|
93
|
+
text: Schema.String
|
|
94
|
+
});
|
|
95
|
+
/** Stable, JSON-safe analysis derived from the same document used for delivery. */
|
|
96
|
+
const CmsDocumentAnalysis = Schema.Struct({
|
|
97
|
+
components: Schema.Array(Schema.NonEmptyString),
|
|
98
|
+
headings: Schema.Array(CmsDocumentHeading),
|
|
99
|
+
searchText: Schema.String,
|
|
100
|
+
summary: Schema.String
|
|
101
|
+
});
|
|
102
|
+
const CompiledDocumentSource = Schema.Struct({
|
|
103
|
+
path: SourcePath,
|
|
104
|
+
mappings: Schema.Array(DocumentSourceMapping)
|
|
105
|
+
});
|
|
106
|
+
const CompiledDocument = Schema.Struct({
|
|
107
|
+
id: DocumentId,
|
|
108
|
+
key: PublicPath,
|
|
109
|
+
path: PublicPath,
|
|
110
|
+
locale: Schema.optionalKey(Locale),
|
|
111
|
+
collection: CollectionName,
|
|
112
|
+
draft: Schema.Boolean,
|
|
113
|
+
title: Schema.NonEmptyString,
|
|
114
|
+
description: Schema.optionalKey(Schema.String),
|
|
115
|
+
data: Schema.JsonObject,
|
|
116
|
+
issues: Schema.Array(DocumentIssue),
|
|
117
|
+
analysis: CmsDocumentAnalysis,
|
|
118
|
+
body: CmsMarkdownDocument,
|
|
119
|
+
engineFingerprint: Schema.NonEmptyString,
|
|
120
|
+
source: CompiledDocumentSource
|
|
121
|
+
}).annotate({ identifier: "CompiledDocument" });
|
|
122
|
+
const DocumentSource = Schema.Struct({
|
|
123
|
+
documentId: DocumentId,
|
|
124
|
+
sourcePath: SourcePath,
|
|
125
|
+
markdown: Schema.String,
|
|
126
|
+
revisionId: RevisionId,
|
|
127
|
+
version: DocumentVersion,
|
|
128
|
+
publishedVersion: Schema.optionalKey(DocumentVersion)
|
|
129
|
+
}).annotate({ identifier: "DocumentSource" });
|
|
130
|
+
const DocumentImportSource = Schema.Struct({
|
|
131
|
+
sourcePath: SourcePath,
|
|
132
|
+
markdown: Schema.String,
|
|
133
|
+
published: Schema.Boolean
|
|
134
|
+
}).annotate({ identifier: "DocumentImportSource" });
|
|
135
|
+
const DocumentImportMode = Schema.Literals(["preserve", "overwrite"]);
|
|
136
|
+
const DocumentImportInput = Schema.Struct({
|
|
137
|
+
sources: Schema.Array(DocumentImportSource),
|
|
138
|
+
mode: DocumentImportMode,
|
|
139
|
+
reason: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(1e3)))
|
|
140
|
+
}).annotate({ identifier: "DocumentImportInput" });
|
|
141
|
+
const DocumentImportReport = Schema.Struct({
|
|
142
|
+
created: nonNegativeInt,
|
|
143
|
+
preserved: nonNegativeInt,
|
|
144
|
+
published: nonNegativeInt,
|
|
145
|
+
unchanged: nonNegativeInt,
|
|
146
|
+
updated: nonNegativeInt
|
|
147
|
+
}).annotate({ identifier: "DocumentImportReport" });
|
|
148
|
+
const DocumentSummary = Schema.Struct({
|
|
149
|
+
sourcePath: SourcePath,
|
|
150
|
+
version: DocumentVersion,
|
|
151
|
+
document: CompiledDocument
|
|
152
|
+
}).annotate({ identifier: "DocumentSummary" });
|
|
153
|
+
const DeletedDocument = Schema.Struct({
|
|
154
|
+
documentId: DocumentId,
|
|
155
|
+
deletedAt: Schema.DateTimeUtcFromString,
|
|
156
|
+
sourcePath: SourcePath,
|
|
157
|
+
version: DocumentVersion
|
|
158
|
+
}).annotate({ identifier: "DeletedDocument" });
|
|
159
|
+
const DocumentBrowseQuery = Schema.Struct({
|
|
160
|
+
collection: Schema.optionalKey(CollectionName),
|
|
161
|
+
locale: Schema.optionalKey(Locale)
|
|
162
|
+
}).annotate({ identifier: "DocumentBrowseQuery" });
|
|
163
|
+
const PublishedDocumentLookup = Schema.Union([
|
|
164
|
+
Schema.Struct({
|
|
165
|
+
kind: Schema.tag("id"),
|
|
166
|
+
documentId: DocumentId
|
|
167
|
+
}),
|
|
168
|
+
Schema.Struct({
|
|
169
|
+
kind: Schema.tag("path"),
|
|
170
|
+
path: PublicPath
|
|
171
|
+
}),
|
|
172
|
+
Schema.Struct({
|
|
173
|
+
kind: Schema.tag("key"),
|
|
174
|
+
key: PublicPath,
|
|
175
|
+
collection: Schema.optionalKey(CollectionName),
|
|
176
|
+
locale: Schema.optionalKey(Locale)
|
|
177
|
+
})
|
|
178
|
+
]).pipe(Schema.toTaggedUnion("kind"));
|
|
179
|
+
const DocumentQueryScalar = Schema.Union([
|
|
180
|
+
Schema.String,
|
|
181
|
+
Schema.Finite,
|
|
182
|
+
Schema.Boolean,
|
|
183
|
+
Schema.Null
|
|
184
|
+
]);
|
|
185
|
+
const validDocumentQueryField = Schema.makeFilter((field) => {
|
|
186
|
+
const segments = field.split(".");
|
|
187
|
+
return field.length <= 200 && segments.length <= 8 && segments.every((segment) => segment.length > 0);
|
|
188
|
+
}, { expected: "a non-empty field path of at most 200 characters and eight non-empty segments" });
|
|
189
|
+
const DocumentQueryField = Schema.NonEmptyString.check(validDocumentQueryField);
|
|
190
|
+
const DocumentQueryValue = Schema.Union([DocumentQueryScalar, Schema.Array(DocumentQueryScalar).check(Schema.isMaxLength(20))]);
|
|
191
|
+
const DocumentQuerySort = Schema.Struct({
|
|
192
|
+
field: DocumentQueryField,
|
|
193
|
+
direction: Schema.optionalKey(Schema.Literals(["asc", "desc"]))
|
|
194
|
+
});
|
|
195
|
+
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" }));
|
|
196
|
+
const PublishedDocumentSelection = Schema.Struct({
|
|
197
|
+
collection: Schema.optionalKey(CollectionName),
|
|
198
|
+
locale: Schema.optionalKey(Locale),
|
|
199
|
+
where: Schema.optionalKey(DocumentQueryWhere),
|
|
200
|
+
sort: Schema.optionalKey(Schema.Array(DocumentQuerySort).check(Schema.isMaxLength(4)))
|
|
201
|
+
}).annotate({ identifier: "PublishedDocumentSelection" });
|
|
202
|
+
const PublishedDocumentQuery = Schema.Struct({
|
|
203
|
+
...PublishedDocumentSelection.fields,
|
|
204
|
+
offset: Schema.optionalKey(nonNegativeInt),
|
|
205
|
+
limit: Schema.Int.check(Schema.isBetween({
|
|
206
|
+
minimum: 1,
|
|
207
|
+
maximum: 100
|
|
208
|
+
}))
|
|
209
|
+
}).annotate({ identifier: "PublishedDocumentQuery" });
|
|
210
|
+
const PublishedDocumentSurroundQuery = Schema.Struct({ ...PublishedDocumentSelection.fields }).annotate({ identifier: "PublishedDocumentSurroundQuery" });
|
|
211
|
+
const PublishedDocumentPage = Schema.Struct({
|
|
212
|
+
items: Schema.Array(CompiledDocument),
|
|
213
|
+
total: nonNegativeInt
|
|
214
|
+
}).annotate({ identifier: "PublishedDocumentPage" });
|
|
215
|
+
const DocumentNavigationQuery = Schema.Struct({
|
|
216
|
+
collection: Schema.optionalKey(CollectionName),
|
|
217
|
+
locale: Schema.optionalKey(Locale)
|
|
218
|
+
}).annotate({ identifier: "DocumentNavigationQuery" });
|
|
219
|
+
const documentMutationMetadata = { reason: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(1e3))) };
|
|
220
|
+
const DocumentNavigationItem = Schema.suspend(() => Schema.Struct({
|
|
221
|
+
key: PublicPath,
|
|
222
|
+
title: Schema.NonEmptyString,
|
|
223
|
+
path: Schema.optionalKey(PublicPath),
|
|
224
|
+
locale: Schema.optionalKey(Locale),
|
|
225
|
+
documentId: Schema.optionalKey(DocumentId),
|
|
226
|
+
children: Schema.Array(DocumentNavigationItem)
|
|
227
|
+
}));
|
|
228
|
+
const DocumentSurround = Schema.Struct({
|
|
229
|
+
previous: Schema.NullOr(CompiledDocument),
|
|
230
|
+
next: Schema.NullOr(CompiledDocument)
|
|
231
|
+
}).annotate({ identifier: "DocumentSurround" });
|
|
232
|
+
const HomeDocumentLocation = Schema.Struct({ kind: Schema.tag("home") });
|
|
233
|
+
const NestedDocumentLocation = Schema.Struct({
|
|
234
|
+
kind: Schema.tag("entry"),
|
|
235
|
+
parent: Schema.optionalKey(RelativeDocumentPath),
|
|
236
|
+
slug: Slug
|
|
237
|
+
});
|
|
238
|
+
const DocumentLocation = Schema.Union([HomeDocumentLocation, NestedDocumentLocation]).pipe(Schema.toTaggedUnion("kind"));
|
|
239
|
+
const CreateDocumentInput = Schema.Struct({
|
|
240
|
+
collection: CollectionName,
|
|
241
|
+
locale: Schema.optionalKey(Locale),
|
|
242
|
+
location: DocumentLocation,
|
|
243
|
+
title: Schema.NonEmptyString,
|
|
244
|
+
...documentMutationMetadata
|
|
245
|
+
}).annotate({ identifier: "CreateDocumentInput" });
|
|
246
|
+
const UpdateDocumentInput = Schema.Struct({
|
|
247
|
+
documentId: DocumentId,
|
|
248
|
+
expectedVersion: DocumentVersion,
|
|
249
|
+
markdown: Schema.String,
|
|
250
|
+
...documentMutationMetadata
|
|
251
|
+
}).annotate({ identifier: "UpdateDocumentInput" });
|
|
252
|
+
const MoveDocumentInput = Schema.Struct({
|
|
253
|
+
documentId: DocumentId,
|
|
254
|
+
expectedVersion: DocumentVersion,
|
|
255
|
+
location: DocumentLocation,
|
|
256
|
+
...documentMutationMetadata
|
|
257
|
+
}).annotate({ identifier: "MoveDocumentInput" });
|
|
258
|
+
const RemoveDocumentInput = Schema.Struct({
|
|
259
|
+
documentId: DocumentId,
|
|
260
|
+
expectedVersion: DocumentVersion,
|
|
261
|
+
...documentMutationMetadata
|
|
262
|
+
}).annotate({ identifier: "RemoveDocumentInput" });
|
|
263
|
+
const PublishDocumentInput = Schema.Struct({
|
|
264
|
+
documentId: DocumentId,
|
|
265
|
+
expectedVersion: DocumentVersion,
|
|
266
|
+
...documentMutationMetadata
|
|
267
|
+
}).annotate({ identifier: "PublishDocumentInput" });
|
|
268
|
+
const RestoreDocumentInput = Schema.Struct({
|
|
269
|
+
documentId: DocumentId,
|
|
270
|
+
revisionId: RevisionId,
|
|
271
|
+
expectedVersion: DocumentVersion,
|
|
272
|
+
...documentMutationMetadata
|
|
273
|
+
}).annotate({ identifier: "RestoreDocumentInput" });
|
|
274
|
+
const UndeleteDocumentInput = Schema.Struct({
|
|
275
|
+
documentId: DocumentId,
|
|
276
|
+
expectedVersion: DocumentVersion,
|
|
277
|
+
...documentMutationMetadata
|
|
278
|
+
}).annotate({ identifier: "UndeleteDocumentInput" });
|
|
279
|
+
const DOCUMENT_REVISION_ACTIONS = [
|
|
280
|
+
"document.create",
|
|
281
|
+
"document.move",
|
|
282
|
+
"document.remove",
|
|
283
|
+
"document.restore",
|
|
284
|
+
"document.undelete",
|
|
285
|
+
"document.update"
|
|
286
|
+
];
|
|
287
|
+
const DocumentRevisionAction = Schema.Literals(DOCUMENT_REVISION_ACTIONS);
|
|
288
|
+
const DocumentMutationAction = Schema.Literals([...DOCUMENT_REVISION_ACTIONS, "document.publish"]);
|
|
289
|
+
const DocumentMutationResult = Schema.Struct({
|
|
290
|
+
action: DocumentMutationAction,
|
|
291
|
+
documentId: DocumentId,
|
|
292
|
+
generation: DocumentGeneration,
|
|
293
|
+
revisionId: RevisionId,
|
|
294
|
+
sourcePath: SourcePath,
|
|
295
|
+
version: DocumentVersion,
|
|
296
|
+
entry: Schema.optionalKey(DocumentSummary)
|
|
297
|
+
}).annotate({ identifier: "DocumentMutationResult" });
|
|
298
|
+
const DocumentValidationResult = Schema.Struct({
|
|
299
|
+
valid: Schema.Boolean,
|
|
300
|
+
document: Schema.optionalKey(CompiledDocument),
|
|
301
|
+
issues: Schema.Array(DocumentIssue)
|
|
302
|
+
}).annotate({ identifier: "DocumentValidationResult" });
|
|
303
|
+
|
|
304
|
+
//#endregion
|
|
305
|
+
export { RestoreDocumentInput as A, DocumentVersion as B, MoveDocumentInput as C, PublishedDocumentQuery as D, PublishedDocumentPage as E, Locale as F, SourcePath as G, PublicPath as H, SourceDirectory as I, nonNegativeInt as K, DocumentGeneration as L, UpdateDocumentInput as M, AddressPattern as N, PublishedDocumentSurroundQuery as O, CollectionName as P, DocumentHistoryCursor as R, MarkdownNode as S, PublishedDocumentLookup as T, RevisionId as U, EditorNodeId as V, RevisionNumber as W, DocumentSource as _, DOCUMENT_REVISION_ACTIONS as a, DocumentSurround as b, DocumentImportInput as c, DocumentIssue as d, DocumentMutationResult as f, DocumentRevisionAction as g, DocumentQueryScalar as h, CreateDocumentInput as i, UndeleteDocumentInput as j, RemoveDocumentInput as k, DocumentImportReport as l, DocumentNavigationQuery as m, CmsMarkdownDocument as n, DeletedDocument as o, DocumentNavigationItem as p, CompiledDocument as r, DocumentBrowseQuery as s, CmsDocumentAnalysis as t, DocumentImportSource as u, DocumentSourceMapping as v, PublishDocumentInput as w, DocumentValidationResult as x, DocumentSummary as y, DocumentId as z };
|
|
306
|
+
//# sourceMappingURL=models-Citx8jBi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models-Citx8jBi.js","names":[],"sources":["../../../../protocol/src/internal/scalars.ts","../../../../protocol/src/internal/documents/scalars.ts","../../../../protocol/src/internal/configuration/scalars.ts","../../../../protocol/src/internal/documents/models.ts"],"sourcesContent":["import { Schema } from 'effect'\n\nexport const nonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))\n\nexport const publicPathPattern = /^\\/(?!(?:[^/]+\\/)*\\.\\.?(?:\\/|$))(?:[^/?#\\\\]+(?:\\/[^/?#\\\\]+)*)?$/u\n","import { Schema } from 'effect'\nimport { nonNegativeInt, publicPathPattern } from '../scalars'\n\nconst relativeDocumentPathPattern = /^(?!(?:[^/]+\\/)*\\.\\.?(?:\\/|$))[^/?#\\\\]+(?:\\/[^/?#\\\\]+)*$/u\nconst slugPattern = /^[\\p{Letter}\\p{Number}][\\p{Letter}\\p{Number}_-]*$/u\nconst sourcePathPattern = /^(?!\\.)[^/?#\\\\]+(?:\\/(?!\\.)[^/?#\\\\]+)*\\.(?:md|mdc)$/u\n\nexport const DocumentGeneration = Schema.String.check(Schema.isPattern(/^(?:0|[1-9]\\d*)$/u)).pipe(\n Schema.brand('DocumentGeneration'),\n)\nexport type DocumentGeneration = typeof DocumentGeneration.Type\n\nexport const DocumentVersion = Schema.NonEmptyString.pipe(Schema.brand('DocumentVersion'))\nexport type DocumentVersion = typeof DocumentVersion.Type\n\nexport const DocumentHistoryCursor = Schema.NonEmptyString.pipe(Schema.brand('DocumentHistoryCursor'))\nexport type DocumentHistoryCursor = typeof DocumentHistoryCursor.Type\n\nexport const DocumentId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand('DocumentId'))\nexport type DocumentId = typeof DocumentId.Type\n\nexport const EditorNodeId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand('EditorNodeId'))\nexport type EditorNodeId = typeof EditorNodeId.Type\n\nexport const PublicPath = Schema.String.check(Schema.isPattern(publicPathPattern)).pipe(Schema.brand('PublicPath'))\nexport type PublicPath = typeof PublicPath.Type\n\nexport const RelativeDocumentPath = Schema.String.check(Schema.isPattern(relativeDocumentPathPattern)).pipe(\n Schema.brand('RelativeDocumentPath'),\n)\nexport type RelativeDocumentPath = typeof RelativeDocumentPath.Type\n\nexport const RevisionId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand('RevisionId'))\nexport type RevisionId = typeof RevisionId.Type\n\nexport const RevisionNumber = nonNegativeInt.pipe(Schema.brand('RevisionNumber'))\nexport type RevisionNumber = typeof RevisionNumber.Type\n\nexport const Slug = Schema.String.check(Schema.isPattern(slugPattern)).pipe(Schema.brand('Slug'))\nexport type Slug = typeof Slug.Type\n\nexport const SourcePath = Schema.String.check(Schema.isPattern(sourcePathPattern)).pipe(Schema.brand('SourcePath'))\nexport type SourcePath = typeof SourcePath.Type\n","import { Schema } from 'effect'\nimport { publicPathPattern } from '../scalars'\n\nconst collectionNamePattern = /^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$/u\nconst localePattern = /^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u\nconst sourceDirectoryPattern = /^(?:\\.|(?!\\.)[^/?#\\\\]+(?:\\/(?!\\.)[^/?#\\\\]+)*)$/u\n\nexport const AddressPattern = Schema.String.check(Schema.isPattern(publicPathPattern)).pipe(\n Schema.brand('AddressPattern'),\n)\nexport type AddressPattern = typeof AddressPattern.Type\n\nexport const CollectionName = Schema.String.check(Schema.isPattern(collectionNamePattern)).pipe(\n Schema.brand('CollectionName'),\n)\nexport type CollectionName = typeof CollectionName.Type\n\nexport const Locale = Schema.String.check(Schema.isPattern(localePattern)).pipe(Schema.brand('Locale'))\nexport type Locale = typeof Locale.Type\n\nexport const SourceDirectory = Schema.String.check(Schema.isPattern(sourceDirectoryPattern)).pipe(\n Schema.brand('SourceDirectory'),\n)\nexport type SourceDirectory = typeof SourceDirectory.Type\n","import { Schema } from 'effect'\nimport { CollectionName, Locale } from '../configuration/scalars'\nimport { nonNegativeInt } from '../scalars'\nimport {\n DocumentGeneration,\n DocumentVersion,\n DocumentId,\n PublicPath,\n RelativeDocumentPath,\n RevisionId,\n Slug,\n SourcePath,\n} from './scalars'\n\nexport const DocumentIssueCode = Schema.Literals([\n 'document.collision',\n 'document.id',\n 'document.invalid',\n 'i18n.missing-translation',\n 'markdown.parse',\n 'reference.document',\n 'reference.component',\n 'schema.option',\n 'schema.constraint',\n 'schema.required',\n 'schema.type',\n 'schema.unknown',\n])\nexport type DocumentIssueCode = typeof DocumentIssueCode.Type\n\nexport const DocumentIssue = Schema.Struct({\n code: DocumentIssueCode,\n severity: Schema.Literals(['error', 'warning']),\n message: Schema.NonEmptyString,\n sourcePath: Schema.optionalKey(SourcePath),\n collection: Schema.optionalKey(CollectionName),\n field: Schema.optionalKey(Schema.NonEmptyString),\n key: Schema.optionalKey(PublicPath),\n locale: Schema.optionalKey(Locale),\n}).annotate({ identifier: 'DocumentIssue' })\nexport interface DocumentIssue extends Schema.Schema.Type<typeof DocumentIssue> {}\n\nexport const DocumentSourcePoint = Schema.Struct({\n offset: nonNegativeInt,\n line: nonNegativeInt,\n column: nonNegativeInt,\n})\nexport interface DocumentSourcePoint extends Schema.Schema.Type<typeof DocumentSourcePoint> {}\n\nexport const DocumentSourceRange = Schema.Struct({\n start: DocumentSourcePoint,\n end: DocumentSourcePoint,\n})\nexport interface DocumentSourceRange extends Schema.Schema.Type<typeof DocumentSourceRange> {}\n\nexport const DocumentSourceMapping = Schema.Struct({\n nodePath: Schema.Array(nonNegativeInt),\n range: DocumentSourceRange,\n})\nexport interface DocumentSourceMapping extends Schema.Schema.Type<typeof DocumentSourceMapping> {}\n\nexport type MarkdownNode =\n | string\n | readonly [null, Schema.JsonObject, string]\n | readonly [string, Schema.JsonObject, ...MarkdownNode[]]\n\nexport const MarkdownNode: Schema.Codec<MarkdownNode> = Schema.suspend(() =>\n Schema.Union([\n Schema.String,\n Schema.Tuple([Schema.Null, Schema.JsonObject, Schema.String]),\n Schema.TupleWithRest(Schema.Tuple([Schema.NonEmptyString, Schema.JsonObject]), [MarkdownNode]),\n ]),\n)\n\nexport const CmsMarkdownDocument = Schema.Struct({\n nodes: Schema.Array(MarkdownNode),\n frontmatter: Schema.JsonObject,\n meta: Schema.JsonObject,\n}).annotate({ identifier: 'CmsMarkdownDocument' })\nexport interface CmsMarkdownDocument extends Schema.Schema.Type<typeof CmsMarkdownDocument> {}\n\nexport const CmsDocumentHeading = Schema.Struct({\n depth: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 6 })),\n id: Schema.String,\n text: Schema.String,\n})\nexport interface CmsDocumentHeading extends Schema.Schema.Type<typeof CmsDocumentHeading> {}\n\n/** Stable, JSON-safe analysis derived from the same document used for delivery. */\nexport const CmsDocumentAnalysis = Schema.Struct({\n components: Schema.Array(Schema.NonEmptyString),\n headings: Schema.Array(CmsDocumentHeading),\n searchText: Schema.String,\n summary: Schema.String,\n})\nexport interface CmsDocumentAnalysis extends Schema.Schema.Type<typeof CmsDocumentAnalysis> {}\n\nexport const CompiledDocumentSource = Schema.Struct({\n path: SourcePath,\n mappings: Schema.Array(DocumentSourceMapping),\n})\nexport interface CompiledDocumentSource extends Schema.Schema.Type<typeof CompiledDocumentSource> {}\n\nexport const CompiledDocument = Schema.Struct({\n id: DocumentId,\n key: PublicPath,\n path: PublicPath,\n locale: Schema.optionalKey(Locale),\n collection: CollectionName,\n draft: Schema.Boolean,\n title: Schema.NonEmptyString,\n description: Schema.optionalKey(Schema.String),\n data: Schema.JsonObject,\n issues: Schema.Array(DocumentIssue),\n analysis: CmsDocumentAnalysis,\n body: CmsMarkdownDocument,\n engineFingerprint: Schema.NonEmptyString,\n source: CompiledDocumentSource,\n}).annotate({ identifier: 'CompiledDocument' })\nexport interface CompiledDocument extends Schema.Schema.Type<typeof CompiledDocument> {}\n\nexport const DocumentSource = Schema.Struct({\n documentId: DocumentId,\n sourcePath: SourcePath,\n markdown: Schema.String,\n revisionId: RevisionId,\n version: DocumentVersion,\n publishedVersion: Schema.optionalKey(DocumentVersion),\n}).annotate({ identifier: 'DocumentSource' })\nexport interface DocumentSource extends Schema.Schema.Type<typeof DocumentSource> {}\n\nexport const DocumentImportSource = Schema.Struct({\n sourcePath: SourcePath,\n markdown: Schema.String,\n published: Schema.Boolean,\n}).annotate({ identifier: 'DocumentImportSource' })\nexport interface DocumentImportSource extends Schema.Schema.Type<typeof DocumentImportSource> {}\n\nexport const DocumentImportMode = Schema.Literals(['preserve', 'overwrite'])\nexport type DocumentImportMode = typeof DocumentImportMode.Type\n\nexport const DocumentImportInput = Schema.Struct({\n sources: Schema.Array(DocumentImportSource),\n mode: DocumentImportMode,\n reason: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(1_000))),\n}).annotate({ identifier: 'DocumentImportInput' })\nexport interface DocumentImportInput extends Schema.Schema.Type<typeof DocumentImportInput> {}\n\nexport const DocumentImportReport = Schema.Struct({\n created: nonNegativeInt,\n preserved: nonNegativeInt,\n published: nonNegativeInt,\n unchanged: nonNegativeInt,\n updated: nonNegativeInt,\n}).annotate({ identifier: 'DocumentImportReport' })\nexport interface DocumentImportReport extends Schema.Schema.Type<typeof DocumentImportReport> {}\n\nexport const DocumentSummary = Schema.Struct({\n sourcePath: SourcePath,\n version: DocumentVersion,\n document: CompiledDocument,\n}).annotate({ identifier: 'DocumentSummary' })\nexport interface DocumentSummary extends Schema.Schema.Type<typeof DocumentSummary> {}\n\nexport const DeletedDocument = Schema.Struct({\n documentId: DocumentId,\n deletedAt: Schema.DateTimeUtcFromString,\n sourcePath: SourcePath,\n version: DocumentVersion,\n}).annotate({ identifier: 'DeletedDocument' })\nexport interface DeletedDocument extends Schema.Schema.Type<typeof DeletedDocument> {}\n\nexport const DocumentBrowseQuery = Schema.Struct({\n collection: Schema.optionalKey(CollectionName),\n locale: Schema.optionalKey(Locale),\n}).annotate({ identifier: 'DocumentBrowseQuery' })\nexport interface DocumentBrowseQuery extends Schema.Schema.Type<typeof DocumentBrowseQuery> {}\n\nexport const PublishedDocumentLookup = Schema.Union([\n Schema.Struct({\n kind: Schema.tag('id'),\n documentId: DocumentId,\n }),\n Schema.Struct({\n kind: Schema.tag('path'),\n path: PublicPath,\n }),\n Schema.Struct({\n kind: Schema.tag('key'),\n key: PublicPath,\n collection: Schema.optionalKey(CollectionName),\n locale: Schema.optionalKey(Locale),\n }),\n]).pipe(Schema.toTaggedUnion('kind'))\nexport type PublishedDocumentLookup = typeof PublishedDocumentLookup.Type\n\nexport const DocumentQueryScalar = Schema.Union([Schema.String, Schema.Finite, Schema.Boolean, Schema.Null])\nexport type DocumentQueryScalar = typeof DocumentQueryScalar.Type\n\nconst validDocumentQueryField = Schema.makeFilter<string>(\n (field) => {\n const segments = field.split('.')\n return field.length <= 200 && segments.length <= 8 && segments.every((segment) => segment.length > 0)\n },\n { expected: 'a non-empty field path of at most 200 characters and eight non-empty segments' },\n)\n\nexport const DocumentQueryField = Schema.NonEmptyString.check(validDocumentQueryField)\nexport type DocumentQueryField = typeof DocumentQueryField.Type\n\nexport const DocumentQueryValue = Schema.Union([\n DocumentQueryScalar,\n Schema.Array(DocumentQueryScalar).check(Schema.isMaxLength(20)),\n])\nexport type DocumentQueryValue = typeof DocumentQueryValue.Type\n\nexport const DocumentQuerySort = Schema.Struct({\n field: DocumentQueryField,\n direction: Schema.optionalKey(Schema.Literals(['asc', 'desc'])),\n})\nexport interface DocumentQuerySort extends Schema.Schema.Type<typeof DocumentQuerySort> {}\n\nconst DocumentQueryWhere = Schema.Record(Schema.String, DocumentQueryValue).check(\n Schema.makeFilter((where) => Object.keys(where).every((field) => Schema.is(DocumentQueryField)(field)), {\n expected: 'document query keys with valid bounded field paths',\n }),\n Schema.makeFilter((where) => Object.keys(where).length <= 12, {\n expected: 'at most 12 document query filters',\n }),\n)\n\nexport const PublishedDocumentSelection = Schema.Struct({\n collection: Schema.optionalKey(CollectionName),\n locale: Schema.optionalKey(Locale),\n where: Schema.optionalKey(DocumentQueryWhere),\n sort: Schema.optionalKey(Schema.Array(DocumentQuerySort).check(Schema.isMaxLength(4))),\n}).annotate({ identifier: 'PublishedDocumentSelection' })\nexport interface PublishedDocumentSelection extends Schema.Schema.Type<typeof PublishedDocumentSelection> {}\n\nexport const PublishedDocumentQuery = Schema.Struct({\n ...PublishedDocumentSelection.fields,\n offset: Schema.optionalKey(nonNegativeInt),\n limit: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 })),\n}).annotate({ identifier: 'PublishedDocumentQuery' })\nexport interface PublishedDocumentQuery extends Schema.Schema.Type<typeof PublishedDocumentQuery> {}\n\nexport const PublishedDocumentSurroundQuery = Schema.Struct({\n ...PublishedDocumentSelection.fields,\n}).annotate({ identifier: 'PublishedDocumentSurroundQuery' })\nexport interface PublishedDocumentSurroundQuery extends Schema.Schema.Type<typeof PublishedDocumentSurroundQuery> {}\n\nexport const PublishedDocumentPage = Schema.Struct({\n items: Schema.Array(CompiledDocument),\n total: nonNegativeInt,\n}).annotate({ identifier: 'PublishedDocumentPage' })\nexport interface PublishedDocumentPage extends Schema.Schema.Type<typeof PublishedDocumentPage> {}\n\nexport const DocumentNavigationQuery = Schema.Struct({\n collection: Schema.optionalKey(CollectionName),\n locale: Schema.optionalKey(Locale),\n}).annotate({ identifier: 'DocumentNavigationQuery' })\nexport interface DocumentNavigationQuery extends Schema.Schema.Type<typeof DocumentNavigationQuery> {}\n\nconst documentMutationMetadata = {\n reason: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(1_000))),\n}\n\nexport interface DocumentNavigationItem {\n readonly key: PublicPath\n readonly title: string\n readonly path?: PublicPath\n readonly locale?: Locale\n readonly documentId?: DocumentId\n readonly children: ReadonlyArray<DocumentNavigationItem>\n}\n\ninterface DocumentNavigationItemEncoded {\n readonly key: string\n readonly title: string\n readonly path?: string\n readonly locale?: string\n readonly documentId?: string\n readonly children: ReadonlyArray<DocumentNavigationItemEncoded>\n}\n\nexport const DocumentNavigationItem: Schema.Codec<DocumentNavigationItem, DocumentNavigationItemEncoded> =\n Schema.suspend(() =>\n Schema.Struct({\n key: PublicPath,\n title: Schema.NonEmptyString,\n path: Schema.optionalKey(PublicPath),\n locale: Schema.optionalKey(Locale),\n documentId: Schema.optionalKey(DocumentId),\n children: Schema.Array(DocumentNavigationItem),\n }),\n )\n\nexport const DocumentSurround = Schema.Struct({\n previous: Schema.NullOr(CompiledDocument),\n next: Schema.NullOr(CompiledDocument),\n}).annotate({ identifier: 'DocumentSurround' })\nexport interface DocumentSurround extends Schema.Schema.Type<typeof DocumentSurround> {}\n\nexport const HomeDocumentLocation = Schema.Struct({\n kind: Schema.tag('home'),\n})\nexport interface HomeDocumentLocation extends Schema.Schema.Type<typeof HomeDocumentLocation> {}\n\nexport const NestedDocumentLocation = Schema.Struct({\n kind: Schema.tag('entry'),\n parent: Schema.optionalKey(RelativeDocumentPath),\n slug: Slug,\n})\nexport interface NestedDocumentLocation extends Schema.Schema.Type<typeof NestedDocumentLocation> {}\n\nexport const DocumentLocation = Schema.Union([HomeDocumentLocation, NestedDocumentLocation]).pipe(\n Schema.toTaggedUnion('kind'),\n)\nexport type DocumentLocation = typeof DocumentLocation.Type\n\nexport const CreateDocumentInput = Schema.Struct({\n collection: CollectionName,\n locale: Schema.optionalKey(Locale),\n location: DocumentLocation,\n title: Schema.NonEmptyString,\n ...documentMutationMetadata,\n}).annotate({ identifier: 'CreateDocumentInput' })\nexport interface CreateDocumentInput extends Schema.Schema.Type<typeof CreateDocumentInput> {}\n\nexport const UpdateDocumentInput = Schema.Struct({\n documentId: DocumentId,\n expectedVersion: DocumentVersion,\n markdown: Schema.String,\n ...documentMutationMetadata,\n}).annotate({ identifier: 'UpdateDocumentInput' })\nexport interface UpdateDocumentInput extends Schema.Schema.Type<typeof UpdateDocumentInput> {}\n\nexport const MoveDocumentInput = Schema.Struct({\n documentId: DocumentId,\n expectedVersion: DocumentVersion,\n location: DocumentLocation,\n ...documentMutationMetadata,\n}).annotate({ identifier: 'MoveDocumentInput' })\nexport interface MoveDocumentInput extends Schema.Schema.Type<typeof MoveDocumentInput> {}\n\nexport const RemoveDocumentInput = Schema.Struct({\n documentId: DocumentId,\n expectedVersion: DocumentVersion,\n ...documentMutationMetadata,\n}).annotate({ identifier: 'RemoveDocumentInput' })\nexport interface RemoveDocumentInput extends Schema.Schema.Type<typeof RemoveDocumentInput> {}\n\nexport const PublishDocumentInput = Schema.Struct({\n documentId: DocumentId,\n expectedVersion: DocumentVersion,\n ...documentMutationMetadata,\n}).annotate({ identifier: 'PublishDocumentInput' })\nexport interface PublishDocumentInput extends Schema.Schema.Type<typeof PublishDocumentInput> {}\n\nexport const RestoreDocumentInput = Schema.Struct({\n documentId: DocumentId,\n revisionId: RevisionId,\n expectedVersion: DocumentVersion,\n ...documentMutationMetadata,\n}).annotate({ identifier: 'RestoreDocumentInput' })\nexport interface RestoreDocumentInput extends Schema.Schema.Type<typeof RestoreDocumentInput> {}\n\nexport const UndeleteDocumentInput = Schema.Struct({\n documentId: DocumentId,\n expectedVersion: DocumentVersion,\n ...documentMutationMetadata,\n}).annotate({ identifier: 'UndeleteDocumentInput' })\nexport interface UndeleteDocumentInput extends Schema.Schema.Type<typeof UndeleteDocumentInput> {}\n\nexport const DOCUMENT_REVISION_ACTIONS = [\n 'document.create',\n 'document.move',\n 'document.remove',\n 'document.restore',\n 'document.undelete',\n 'document.update',\n] as const\n\nexport const DocumentRevisionAction = Schema.Literals(DOCUMENT_REVISION_ACTIONS)\nexport type DocumentRevisionAction = typeof DocumentRevisionAction.Type\n\nexport const DocumentMutationAction = Schema.Literals([...DOCUMENT_REVISION_ACTIONS, 'document.publish'])\nexport type DocumentMutationAction = typeof DocumentMutationAction.Type\n\nexport const DocumentMutationResult = Schema.Struct({\n action: DocumentMutationAction,\n documentId: DocumentId,\n generation: DocumentGeneration,\n revisionId: RevisionId,\n sourcePath: SourcePath,\n version: DocumentVersion,\n entry: Schema.optionalKey(DocumentSummary),\n}).annotate({ identifier: 'DocumentMutationResult' })\nexport interface DocumentMutationResult extends Schema.Schema.Type<typeof DocumentMutationResult> {}\n\nexport const DocumentValidationResult = Schema.Struct({\n valid: Schema.Boolean,\n document: Schema.optionalKey(CompiledDocument),\n issues: Schema.Array(DocumentIssue),\n}).annotate({ identifier: 'DocumentValidationResult' })\nexport interface DocumentValidationResult extends Schema.Schema.Type<typeof DocumentValidationResult> {}\n"],"mappings":";;;AAEA,MAAa,iBAAiB,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;AAE/E,MAAa,oBAAoB;;;;ACDjC,MAAM,8BAA8B;AACpC,MAAM,cAAc;AACpB,MAAM,oBAAoB;AAE1B,MAAa,qBAAqB,OAAO,OAAO,MAAM,OAAO,UAAU,mBAAmB,CAAC,CAAC,CAAC,KAC3F,OAAO,MAAM,oBAAoB,CACnC;AAGA,MAAa,kBAAkB,OAAO,eAAe,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAGzF,MAAa,wBAAwB,OAAO,eAAe,KAAK,OAAO,MAAM,uBAAuB,CAAC;AAGrG,MAAa,aAAa,OAAO,OAAO,MAAM,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM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153 @@
|
|
|
1
|
+
import { H as PublicPath, L as DocumentGeneration, P as CollectionName, T as PublishedDocumentLookup, V as EditorNodeId, W as RevisionNumber, r as CompiledDocument, z as DocumentId } from "./models-Citx8jBi.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
|
|
4
|
+
//#region ../protocol/src/Identity.ts
|
|
5
|
+
/** Cross-domain request correlation; decode unknown strings before crossing a seam. */
|
|
6
|
+
const RequestId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand("RequestId"));
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region ../protocol/src/internal/preview/models.ts
|
|
10
|
+
const DOCUMENT_PREVIEW_CHANNEL = "cms:document-preview";
|
|
11
|
+
const PreviewSessionId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand("PreviewSessionId"));
|
|
12
|
+
const PreviewIntentId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand("PreviewIntentId"));
|
|
13
|
+
const exactOrigin = Schema.makeFilter((value) => {
|
|
14
|
+
try {
|
|
15
|
+
const url = new URL(value);
|
|
16
|
+
return (url.protocol === "http:" || url.protocol === "https:") && url.origin === value;
|
|
17
|
+
} catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}, { expected: "an exact HTTP or HTTPS origin without a path" });
|
|
21
|
+
const PreviewOrigin = Schema.NonEmptyString.check(exactOrigin).pipe(Schema.brand("PreviewOrigin"));
|
|
22
|
+
const PreviewSessionRequest = Schema.Struct({ previewOrigin: PreviewOrigin }).annotate({ identifier: "PreviewSessionRequest" });
|
|
23
|
+
const PreviewSession = Schema.Struct({
|
|
24
|
+
editorOrigin: PreviewOrigin,
|
|
25
|
+
expiresAt: Schema.DateTimeUtcFromString,
|
|
26
|
+
previewOrigin: PreviewOrigin,
|
|
27
|
+
sessionId: PreviewSessionId,
|
|
28
|
+
token: Schema.NonEmptyString
|
|
29
|
+
}).annotate({ identifier: "PreviewSession" });
|
|
30
|
+
const PreviewSessionAccess = Schema.Struct({ token: PreviewSession.fields.token }).annotate({ identifier: "PreviewSessionAccess" });
|
|
31
|
+
const PreviewDraftRequest = Schema.Struct({
|
|
32
|
+
lookup: PublishedDocumentLookup,
|
|
33
|
+
token: PreviewSession.fields.token
|
|
34
|
+
}).annotate({ identifier: "PreviewDraftRequest" });
|
|
35
|
+
const PreviewInvalidation = Schema.Struct({
|
|
36
|
+
generation: DocumentGeneration,
|
|
37
|
+
type: Schema.tag("document-invalidated")
|
|
38
|
+
}).annotate({ identifier: "PreviewInvalidation" });
|
|
39
|
+
var PreviewSessionInvalid = class extends Schema.TaggedError()("Preview.SessionInvalid", { reason: Schema.Literals([
|
|
40
|
+
"expired",
|
|
41
|
+
"invalid",
|
|
42
|
+
"origin"
|
|
43
|
+
]) }) {};
|
|
44
|
+
var PreviewDraftNotFound = class extends Schema.TaggedError()("Preview.DraftNotFound", { lookup: PublishedDocumentLookup }) {};
|
|
45
|
+
const DocumentPreviewFocusIntent = Schema.Struct({
|
|
46
|
+
id: PreviewIntentId,
|
|
47
|
+
documentId: DocumentId,
|
|
48
|
+
nodeId: Schema.optionalKey(EditorNodeId),
|
|
49
|
+
origin: Schema.Literals(["editor", "preview"]),
|
|
50
|
+
reveal: Schema.Boolean,
|
|
51
|
+
revision: RevisionNumber
|
|
52
|
+
});
|
|
53
|
+
const RenderedCompiledDocument = Schema.Struct({
|
|
54
|
+
collection: CollectionName,
|
|
55
|
+
documentId: DocumentId,
|
|
56
|
+
path: PublicPath,
|
|
57
|
+
role: Schema.Literals([
|
|
58
|
+
"embedded",
|
|
59
|
+
"primary",
|
|
60
|
+
"related",
|
|
61
|
+
"summary"
|
|
62
|
+
]),
|
|
63
|
+
title: Schema.NonEmptyString
|
|
64
|
+
});
|
|
65
|
+
const RenderedDocumentManifest = Schema.Struct({
|
|
66
|
+
documents: Schema.Array(RenderedCompiledDocument),
|
|
67
|
+
route: PublicPath
|
|
68
|
+
});
|
|
69
|
+
const previewEnvelope = {
|
|
70
|
+
channel: Schema.Literal(DOCUMENT_PREVIEW_CHANNEL),
|
|
71
|
+
sessionId: PreviewSessionId
|
|
72
|
+
};
|
|
73
|
+
const StudioConnectMessage = Schema.Struct({
|
|
74
|
+
...previewEnvelope,
|
|
75
|
+
type: Schema.tag("studio:connect")
|
|
76
|
+
});
|
|
77
|
+
const StudioModeMessage = Schema.Struct({
|
|
78
|
+
...previewEnvelope,
|
|
79
|
+
type: Schema.tag("studio:mode"),
|
|
80
|
+
mode: Schema.Literals(["browse", "edit"])
|
|
81
|
+
});
|
|
82
|
+
const StudioNavigateMessage = Schema.Struct({
|
|
83
|
+
...previewEnvelope,
|
|
84
|
+
type: Schema.tag("studio:navigate"),
|
|
85
|
+
path: PublicPath
|
|
86
|
+
});
|
|
87
|
+
const StudioPatchMessage = Schema.Struct({
|
|
88
|
+
...previewEnvelope,
|
|
89
|
+
type: Schema.tag("studio:patch"),
|
|
90
|
+
document: CompiledDocument,
|
|
91
|
+
fallbacks: Schema.Record(Schema.String, Schema.String),
|
|
92
|
+
focus: Schema.optionalKey(DocumentPreviewFocusIntent),
|
|
93
|
+
revision: RevisionNumber
|
|
94
|
+
});
|
|
95
|
+
const StudioFocusMessage = Schema.Struct({
|
|
96
|
+
...previewEnvelope,
|
|
97
|
+
type: Schema.tag("studio:focus"),
|
|
98
|
+
focus: DocumentPreviewFocusIntent
|
|
99
|
+
});
|
|
100
|
+
const PreviewReadyMessage = Schema.Struct({
|
|
101
|
+
...previewEnvelope,
|
|
102
|
+
type: Schema.tag("preview:ready"),
|
|
103
|
+
path: PublicPath
|
|
104
|
+
});
|
|
105
|
+
const PreviewManifestMessage = Schema.Struct({
|
|
106
|
+
...previewEnvelope,
|
|
107
|
+
type: Schema.tag("preview:manifest"),
|
|
108
|
+
manifest: RenderedDocumentManifest,
|
|
109
|
+
revision: RevisionNumber
|
|
110
|
+
});
|
|
111
|
+
const PreviewActivateMessage = Schema.Struct({
|
|
112
|
+
...previewEnvelope,
|
|
113
|
+
type: Schema.tag("preview:activate"),
|
|
114
|
+
documentId: DocumentId,
|
|
115
|
+
field: Schema.optionalKey(Schema.NonEmptyString),
|
|
116
|
+
nodeId: Schema.optionalKey(EditorNodeId),
|
|
117
|
+
requestId: RequestId,
|
|
118
|
+
revision: RevisionNumber
|
|
119
|
+
});
|
|
120
|
+
const PreviewAppliedMessage = Schema.Struct({
|
|
121
|
+
...previewEnvelope,
|
|
122
|
+
type: Schema.tag("preview:applied"),
|
|
123
|
+
intentId: PreviewIntentId,
|
|
124
|
+
nodeId: Schema.optionalKey(EditorNodeId),
|
|
125
|
+
result: Schema.Literals([
|
|
126
|
+
"exact",
|
|
127
|
+
"fallback",
|
|
128
|
+
"missing"
|
|
129
|
+
]),
|
|
130
|
+
revision: RevisionNumber
|
|
131
|
+
});
|
|
132
|
+
const PreviewRenderedMessage = Schema.Struct({
|
|
133
|
+
...previewEnvelope,
|
|
134
|
+
type: Schema.tag("preview:rendered"),
|
|
135
|
+
revision: RevisionNumber
|
|
136
|
+
});
|
|
137
|
+
const DocumentPreviewMessage = Schema.Union([
|
|
138
|
+
StudioConnectMessage,
|
|
139
|
+
StudioModeMessage,
|
|
140
|
+
StudioNavigateMessage,
|
|
141
|
+
StudioPatchMessage,
|
|
142
|
+
StudioFocusMessage,
|
|
143
|
+
PreviewReadyMessage,
|
|
144
|
+
PreviewManifestMessage,
|
|
145
|
+
PreviewActivateMessage,
|
|
146
|
+
PreviewAppliedMessage,
|
|
147
|
+
PreviewRenderedMessage
|
|
148
|
+
]).pipe(Schema.toTaggedUnion("type"));
|
|
149
|
+
const isDocumentPreviewMessage = Schema.is(DocumentPreviewMessage);
|
|
150
|
+
|
|
151
|
+
//#endregion
|
|
152
|
+
export { PreviewIntentId as a, PreviewSession as c, PreviewSessionInvalid as d, PreviewSessionRequest as f, PreviewDraftRequest as i, PreviewSessionAccess as l, RequestId as m, DocumentPreviewMessage as n, PreviewInvalidation as o, isDocumentPreviewMessage as p, PreviewDraftNotFound as r, PreviewOrigin as s, DOCUMENT_PREVIEW_CHANNEL as t, PreviewSessionId as u };
|
|
153
|
+
//# sourceMappingURL=models-DS5ClMsH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models-DS5ClMsH.js","names":[],"sources":["../../../../protocol/src/Identity.ts","../../../../protocol/src/internal/preview/models.ts"],"sourcesContent":["/** Cross-domain request correlation; decode unknown strings before crossing a seam. */\nimport { Schema } from 'effect'\n\nexport const RequestId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand('RequestId'))\nexport type RequestId = typeof RequestId.Type\n","import { CompiledDocument, PublishedDocumentLookup } from '../../Documents'\nimport { RequestId } from '../../Identity'\nimport { CollectionName } from '../configuration/scalars'\nimport { DocumentGeneration, DocumentId, EditorNodeId, PublicPath, RevisionNumber } from '../documents/scalars'\nimport { Schema } from 'effect'\n\nexport const DOCUMENT_PREVIEW_CHANNEL = 'cms:document-preview'\n\nexport const PreviewSessionId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand('PreviewSessionId'))\nexport type PreviewSessionId = typeof PreviewSessionId.Type\n\nexport const PreviewIntentId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand('PreviewIntentId'))\nexport type PreviewIntentId = typeof PreviewIntentId.Type\n\nconst exactOrigin = Schema.makeFilter<string>(\n (value) => {\n try {\n const url = new URL(value)\n return (url.protocol === 'http:' || url.protocol === 'https:') && url.origin === value\n } catch {\n return false\n }\n },\n { expected: 'an exact HTTP or HTTPS origin without a path' },\n)\n\nexport const PreviewOrigin = Schema.NonEmptyString.check(exactOrigin).pipe(Schema.brand('PreviewOrigin'))\nexport type PreviewOrigin = typeof PreviewOrigin.Type\n\nexport const PreviewSessionRequest = Schema.Struct({\n previewOrigin: PreviewOrigin,\n}).annotate({ identifier: 'PreviewSessionRequest' })\nexport interface PreviewSessionRequest extends Schema.Schema.Type<typeof PreviewSessionRequest> {}\n\nexport const PreviewSession = Schema.Struct({\n editorOrigin: PreviewOrigin,\n expiresAt: Schema.DateTimeUtcFromString,\n previewOrigin: PreviewOrigin,\n sessionId: PreviewSessionId,\n token: Schema.NonEmptyString,\n}).annotate({ identifier: 'PreviewSession' })\nexport interface PreviewSession extends Schema.Schema.Type<typeof PreviewSession> {}\n\nexport const PreviewSessionAccess = Schema.Struct({ token: PreviewSession.fields.token }).annotate({\n identifier: 'PreviewSessionAccess',\n})\nexport interface PreviewSessionAccess extends Schema.Schema.Type<typeof PreviewSessionAccess> {}\n\nexport const PreviewDraftRequest = Schema.Struct({\n lookup: PublishedDocumentLookup,\n token: PreviewSession.fields.token,\n}).annotate({ identifier: 'PreviewDraftRequest' })\nexport interface PreviewDraftRequest extends Schema.Schema.Type<typeof PreviewDraftRequest> {}\n\nexport const PreviewInvalidation = Schema.Struct({\n generation: DocumentGeneration,\n type: Schema.tag('document-invalidated'),\n}).annotate({ identifier: 'PreviewInvalidation' })\nexport interface PreviewInvalidation extends Schema.Schema.Type<typeof PreviewInvalidation> {}\n\nexport class PreviewSessionInvalid extends Schema.TaggedError<PreviewSessionInvalid>()('Preview.SessionInvalid', {\n reason: Schema.Literals(['expired', 'invalid', 'origin']),\n}) {}\n\nexport class PreviewDraftNotFound extends Schema.TaggedError<PreviewDraftNotFound>()('Preview.DraftNotFound', {\n lookup: PublishedDocumentLookup,\n}) {}\n\nexport const DocumentPreviewFocusIntent = Schema.Struct({\n id: PreviewIntentId,\n documentId: DocumentId,\n nodeId: Schema.optionalKey(EditorNodeId),\n origin: Schema.Literals(['editor', 'preview']),\n reveal: Schema.Boolean,\n revision: RevisionNumber,\n})\nexport interface DocumentPreviewFocusIntent extends Schema.Schema.Type<typeof DocumentPreviewFocusIntent> {}\n\nexport const RenderedCompiledDocument = Schema.Struct({\n collection: CollectionName,\n documentId: DocumentId,\n path: PublicPath,\n role: Schema.Literals(['embedded', 'primary', 'related', 'summary']),\n title: Schema.NonEmptyString,\n})\nexport interface RenderedCompiledDocument extends Schema.Schema.Type<typeof RenderedCompiledDocument> {}\n\nexport const RenderedDocumentManifest = Schema.Struct({\n documents: Schema.Array(RenderedCompiledDocument),\n route: PublicPath,\n})\nexport interface RenderedDocumentManifest extends Schema.Schema.Type<typeof RenderedDocumentManifest> {}\n\nconst previewEnvelope = {\n channel: Schema.Literal(DOCUMENT_PREVIEW_CHANNEL),\n sessionId: PreviewSessionId,\n}\n\nconst StudioConnectMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('studio:connect'),\n})\n\nconst StudioModeMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('studio:mode'),\n mode: Schema.Literals(['browse', 'edit']),\n})\n\nconst StudioNavigateMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('studio:navigate'),\n path: PublicPath,\n})\n\nconst StudioPatchMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('studio:patch'),\n document: CompiledDocument,\n fallbacks: Schema.Record(Schema.String, Schema.String),\n focus: Schema.optionalKey(DocumentPreviewFocusIntent),\n revision: RevisionNumber,\n})\n\nconst StudioFocusMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('studio:focus'),\n focus: DocumentPreviewFocusIntent,\n})\n\nconst PreviewReadyMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('preview:ready'),\n path: PublicPath,\n})\n\nconst PreviewManifestMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('preview:manifest'),\n manifest: RenderedDocumentManifest,\n revision: RevisionNumber,\n})\n\nconst PreviewActivateMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('preview:activate'),\n documentId: DocumentId,\n field: Schema.optionalKey(Schema.NonEmptyString),\n nodeId: Schema.optionalKey(EditorNodeId),\n requestId: RequestId,\n revision: RevisionNumber,\n})\n\nconst PreviewAppliedMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('preview:applied'),\n intentId: PreviewIntentId,\n nodeId: Schema.optionalKey(EditorNodeId),\n result: Schema.Literals(['exact', 'fallback', 'missing']),\n revision: RevisionNumber,\n})\n\nconst PreviewRenderedMessage = Schema.Struct({\n ...previewEnvelope,\n type: Schema.tag('preview:rendered'),\n revision: RevisionNumber,\n})\n\nexport const DocumentPreviewMessage = Schema.Union([\n StudioConnectMessage,\n StudioModeMessage,\n StudioNavigateMessage,\n StudioPatchMessage,\n StudioFocusMessage,\n PreviewReadyMessage,\n PreviewManifestMessage,\n PreviewActivateMessage,\n PreviewAppliedMessage,\n PreviewRenderedMessage,\n]).pipe(Schema.toTaggedUnion('type'))\nexport type DocumentPreviewMessage = typeof DocumentPreviewMessage.Type\n\nexport const isDocumentPreviewMessage = Schema.is(DocumentPreviewMessage)\n\ntype PreviewPayload<Message extends DocumentPreviewMessage> = Message extends DocumentPreviewMessage\n ? Omit<Message, 'channel' | 'sessionId'>\n : never\n\nexport type StudioPreviewPayload = PreviewPayload<\n Extract<DocumentPreviewMessage, { readonly type: `studio:${string}` }>\n>\n\nexport type PreviewSitePayload = PreviewPayload<Extract<DocumentPreviewMessage, { readonly type: `preview:${string}` }>>\n"],"mappings":";;;;;AAGA,MAAa,YAAY,OAAO,OAAO,MAAM,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,WAAW,CAAC;;;;ACG5F,MAAa,2BAA2B;AAExC,MAAa,mBAAmB,OAAO,OAAO,MAAM,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAG1G,MAAa,kBAAkB,OAAO,OAAO,MAAM,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAGxG,MAAM,cAAc,OAAO,YACxB,UAAU;CACT,IAAI;EACF,MAAM,MAAM,IAAI,IAAI,KAAK;EACzB,QAAQ,IAAI,aAAa,WAAW,IAAI,aAAa,aAAa,IAAI,WAAW;CACnF,QAAQ;EACN,OAAO;CACT;AACF,GACA,EAAE,UAAU,+CAA+C,CAC7D;AAEA,MAAa,gBAAgB,OAAO,eAAe,MAAM,WAAW,CAAC,CAA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1C,GAAG;CACH,MAAM,OAAO,IAAI,iBAAiB;CAClC,UAAU;CACV,QAAQ,OAAO,YAAY,YAAY;CACvC,QAAQ,OAAO,SAAS;EAAC;EAAS;EAAY;CAAS,CAAC;CACxD,UAAU;AACZ,CAAC;AAED,MAAM,yBAAyB,OAAO,OAAO;CAC3C,GAAG;CACH,MAAM,OAAO,IAAI,kBAAkB;CACnC,UAAU;AACZ,CAAC;AAED,MAAa,yBAAyB,OAAO,MAAM;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,CAAC,KAAK,OAAO,cAAc,MAAM,CAAC;AAGpC,MAAa,2BAA2B,OAAO,GAAG,sBAAsB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useCmsInstallation } from "./plugin.js";
|
|
2
|
+
import { defineEventHandler, toWebRequest } from "h3";
|
|
3
|
+
|
|
4
|
+
//#region src/runtime/api.ts
|
|
5
|
+
var api_default = defineEventHandler((event) => useCmsInstallation().then((installation) => installation.fetch(toWebRequest(event))));
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { api_default as default };
|
|
9
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","names":[],"sources":["../../../../src/runtime/api.ts"],"sourcesContent":["import { defineEventHandler, toWebRequest } from 'h3'\nimport { useCmsInstallation } from './plugin'\n\nexport default defineEventHandler((event) =>\n useCmsInstallation().then((installation) => installation.fetch(toWebRequest(event))),\n)\n"],"mappings":";;;;AAGA,kBAAe,oBAAoB,UACjC,mBAAmB,CAAC,CAAC,MAAM,iBAAiB,aAAa,MAAM,aAAa,KAAK,CAAC,CAAC,CACrF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useCmsInstallation } from "./plugin.js";
|
|
2
|
+
import { defineWebSocketHandler } from "h3";
|
|
3
|
+
|
|
4
|
+
//#region src/runtime/collaboration.ts
|
|
5
|
+
var collaboration_default = defineWebSocketHandler({
|
|
6
|
+
open(peer) {
|
|
7
|
+
return useCmsInstallation().then((installation) => {
|
|
8
|
+
const request = new Request(peer.request.url, { headers: peer.request.headers });
|
|
9
|
+
installation.webSocket.open({
|
|
10
|
+
request,
|
|
11
|
+
socket: collaborationSocket(peer.websocket)
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
message(peer, message) {
|
|
16
|
+
return useCmsInstallation().then((installation) => {
|
|
17
|
+
installation.webSocket.message(collaborationSocket(peer.websocket), message.uint8Array());
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
close(peer, details) {
|
|
21
|
+
return useCmsInstallation().then((installation) => {
|
|
22
|
+
installation.webSocket.close(collaborationSocket(peer.websocket), {
|
|
23
|
+
code: details.code,
|
|
24
|
+
reason: details.reason
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
error(peer) {
|
|
29
|
+
return useCmsInstallation().then((installation) => {
|
|
30
|
+
installation.webSocket.error(collaborationSocket(peer.websocket));
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
function collaborationSocket(socket) {
|
|
35
|
+
return socket;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { collaboration_default as default };
|
|
40
|
+
//# sourceMappingURL=collaboration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collaboration.js","names":[],"sources":["../../../../src/runtime/collaboration.ts"],"sourcesContent":["import type { CmsInstallation } from '@internal/platform-node/Installation'\nimport { defineWebSocketHandler } from 'h3'\nimport { useCmsInstallation } from './plugin'\n\ntype CollaborationSocket = Parameters<CmsInstallation['webSocket']['open']>[0]['socket']\ntype H3WebSocketHooks = Parameters<typeof defineWebSocketHandler>[0]\ntype H3Socket = Parameters<NonNullable<H3WebSocketHooks['open']>>[0]['websocket']\n\nexport default defineWebSocketHandler({\n open(peer) {\n return useCmsInstallation().then((installation) => {\n const request = new Request(peer.request.url, { headers: peer.request.headers })\n installation.webSocket.open({ request, socket: collaborationSocket(peer.websocket) })\n })\n },\n message(peer, message) {\n return useCmsInstallation().then((installation) => {\n installation.webSocket.message(collaborationSocket(peer.websocket), message.uint8Array())\n })\n },\n close(peer, details) {\n return useCmsInstallation().then((installation) => {\n installation.webSocket.close(collaborationSocket(peer.websocket), {\n code: details.code,\n reason: details.reason,\n })\n })\n },\n error(peer) {\n return useCmsInstallation().then((installation) => {\n installation.webSocket.error(collaborationSocket(peer.websocket))\n })\n },\n})\n\nfunction collaborationSocket(socket: H3Socket): CollaborationSocket {\n // SAFETY: crossws exposes the standard send/close/event WebSocket surface consumed by Hocuspocus.\n return socket as CollaborationSocket\n}\n"],"mappings":";;;;AAQA,4BAAe,uBAAuB;CACpC,KAAK,MAAM;EACT,OAAO,mBAAmB,CAAC,CAAC,MAAM,iBAAiB;GACjD,MAAM,UAAU,IAAI,QAAQ,KAAK,QAAQ,KAAK,EAAE,SAAS,KAAK,QAAQ,QAAQ,CAAC;GAC/E,aAAa,UAAU,KAAK;IAAE;IAAS,QAAQ,oBAAoB,KAAK,SAAS;GAAE,CAAC;EACtF,CAAC;CACH;CACA,QAAQ,MAAM,SAAS;EACrB,OAAO,mBAAmB,CAAC,CAAC,MAAM,iBAAiB;GACjD,aAAa,UAAU,QAAQ,oBAAoB,KAAK,SAAS,GAAG,QAAQ,WAAW,CAAC;EAC1F,CAAC;CACH;CACA,MAAM,MAAM,SAAS;EACnB,OAAO,mBAAmB,CAAC,CAAC,MAAM,iBAAiB;GACjD,aAAa,UAAU,MAAM,oBAAoB,KAAK,SAAS,GAAG;IAChE,MAAM,QAAQ;IACd,QAAQ,QAAQ;GAClB,CAAC;EACH,CAAC;CACH;CACA,MAAM,MAAM;EACV,OAAO,mBAAmB,CAAC,CAAC,MAAM,iBAAiB;GACjD,aAAa,UAAU,MAAM,oBAAoB,KAAK,SAAS,CAAC;EAClE,CAAC;CACH;AACF,CAAC;AAED,SAAS,oBAAoB,QAAuC;CAElE,OAAO;AACT"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineComponent, h } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region src/runtime/delivery/DocumentField.ts
|
|
4
|
+
var DocumentField_default = defineComponent({
|
|
5
|
+
name: "DocumentField",
|
|
6
|
+
props: {
|
|
7
|
+
as: {
|
|
8
|
+
default: "span",
|
|
9
|
+
type: String
|
|
10
|
+
},
|
|
11
|
+
name: {
|
|
12
|
+
required: true,
|
|
13
|
+
type: String
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
setup(props, { slots }) {
|
|
17
|
+
return () => h(props.as, { "data-cms-field": props.name }, slots.default?.());
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { DocumentField_default as default };
|
|
23
|
+
//# sourceMappingURL=DocumentField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentField.js","names":[],"sources":["../../../../../src/runtime/delivery/DocumentField.ts"],"sourcesContent":["import { defineComponent, h } from 'vue'\n\nexport default defineComponent({\n name: 'DocumentField',\n props: {\n as: { default: 'span', type: String },\n name: { required: true, type: String },\n },\n setup(props, { slots }) {\n return () => h(props.as, { 'data-cms-field': props.name }, slots.default?.())\n },\n})\n"],"mappings":";;;AAEA,4BAAe,gBAAgB;CAC7B,MAAM;CACN,OAAO;EACL,IAAI;GAAE,SAAS;GAAQ,MAAM;EAAO;EACpC,MAAM;GAAE,UAAU;GAAM,MAAM;EAAO;CACvC;CACA,MAAM,OAAO,EAAE,SAAS;EACtB,aAAa,EAAE,MAAM,IAAI,EAAE,kBAAkB,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC;CAC9E;AACF,CAAC"}
|