@phtngyn/cms 0.1.0-beta.0 → 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -1
- package/package.json +5 -5
- package/src/Authoring.d.ts +13 -1
- package/src/{AuthoringSchema-BQ5kbhVB.js → Configuration-DyKo0sLS.js} +595 -367
- package/src/Configuration-DyKo0sLS.js.map +1 -0
- package/src/{DocumentEngine-Da0kWotL.js → DocumentEngine-DYObwMDY.js} +44 -66
- package/src/DocumentEngine-DYObwMDY.js.map +1 -0
- package/src/DocumentModel.d.ts +4 -0
- package/src/DocumentModel.js.map +1 -1
- package/src/{HttpPaths-86qLGB90.js → HttpPaths-BbS21Jy8.js} +4 -2
- package/src/{HttpPaths-86qLGB90.js.map → HttpPaths-BbS21Jy8.js.map} +1 -1
- package/src/Module.js +27 -76
- package/src/Module.js.map +1 -1
- package/src/{StudioHttp-BTLLooh0.js → StudioHttp-jR2-bc01.js} +44 -242
- package/src/StudioHttp-jR2-bc01.js.map +1 -0
- package/src/{connection-ZGtL54qY.js → connection-CBTY-TzB.js} +3 -3
- package/src/{connection-ZGtL54qY.js.map → connection-CBTY-TzB.js.map} +1 -1
- package/src/{installation-BNKaVjni.js → installation-DeuBiFRE.js} +488 -236
- package/src/installation-DeuBiFRE.js.map +1 -0
- package/src/internal/authoring-catalog.js +147 -0
- package/src/internal/authoring-catalog.js.map +1 -0
- package/src/internal/authoring-compiler.js +2 -1
- package/src/internal/authoring-compiler.js.map +1 -1
- package/src/internal/authoring-metadata.js +67 -48
- package/src/internal/authoring-metadata.js.map +1 -1
- package/src/internal/configuration.js +5 -6
- package/src/internal/configuration.js.map +1 -1
- package/src/internal/document-model.js +3 -2
- package/src/internal/document-model.js.map +1 -1
- package/src/internal/studio-app.js +66 -0
- package/src/internal/studio-app.js.map +1 -0
- package/src/location-DtYv2aes.js +36 -0
- package/src/location-DtYv2aes.js.map +1 -0
- package/src/{metadata-Czvi3E4K.js → metadata-DE1Mc2td.js} +2 -2
- package/src/{metadata-Czvi3E4K.js.map → metadata-DE1Mc2td.js.map} +1 -1
- package/src/{models-Citx8jBi.js → models-BkMgeaOL.js} +252 -3
- package/src/models-BkMgeaOL.js.map +1 -0
- package/src/{models-DS5ClMsH.js → models-C3witQBK.js} +8 -31
- package/src/models-C3witQBK.js.map +1 -0
- package/src/runtime/blocks.js +17 -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 +6 -3
- package/src/runtime/delivery/DocumentRenderer.js.map +1 -1
- package/src/runtime/delivery/blocks.js +6 -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 +5 -3
- package/src/runtime/delivery/document-page.js.map +1 -1
- package/src/runtime/delivery/document.js +18 -2
- 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 +21 -0
- package/src/runtime/delivery/plugin.js.map +1 -0
- package/src/runtime/delivery/useDocument.js +6 -3
- package/src/runtime/delivery/useDocument.js.map +1 -1
- package/src/runtime/delivery/useDocumentQuery.js +6 -3
- package/src/runtime/delivery/useDocumentQuery.js.map +1 -1
- 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/connection.js +1 -1
- package/src/runtime/preview/controller.js +29 -10
- 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 +21 -34
- package/src/runtime/preview/plugin.client.js.map +1 -1
- package/src/runtime/preview/preview.css +72 -4
- package/src/runtime/preview/store.js +1 -1
- 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/{store-Nl4uxEXx.js → store-CfFFx9Ua.js} +3 -3
- package/src/{store-Nl4uxEXx.js.map → store-CfFFx9Ua.js.map} +1 -1
- package/studio/CreateDocumentDialog--L9lTfx6.js +256 -0
- package/studio/collaboration-DUuu678R.js +4565 -0
- package/studio/documentPlanning-BXX04Woe.js +28989 -0
- package/studio/dom-to-image-more.min-D6jGGdrW.js +877 -0
- package/studio/editor-PexnXkJY.js +30817 -0
- package/studio/host.css +3 -0
- package/studio/host.js +44179 -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/StudioHttp-BTLLooh0.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/models-Citx8jBi.js.map +0 -1
- package/src/models-DS5ClMsH.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpPaths-
|
|
1
|
+
{"version":3,"file":"HttpPaths-BbS21Jy8.js","names":[],"sources":["../../../../protocol/src/HttpPaths.ts"],"sourcesContent":["export const STUDIO_BASE_PATH = '/_cms'\nexport const STUDIO_APP_PATH = `${STUDIO_BASE_PATH}/app`\nexport const STUDIO_API_PATH = `${STUDIO_BASE_PATH}/api`\nexport const STUDIO_COLLABORATION_PATH = `${STUDIO_BASE_PATH}/collaboration`\nexport const STUDIO_HEALTH_PATH = `${STUDIO_BASE_PATH}/health`\nexport const CMS_AUTHENTICATION_PATH = '/api/cms/auth'\nexport const CMS_LIVENESS_PATH = `${STUDIO_HEALTH_PATH}/live`\nexport const CMS_READINESS_PATH = `${STUDIO_HEALTH_PATH}/ready`\nexport const CMS_DELIVERY_READ_PATH = `${STUDIO_API_PATH}/delivery/read`\nexport const CMS_DELIVERY_QUERY_PATH = `${STUDIO_API_PATH}/delivery/query`\nexport const CMS_PREVIEW_READ_PATH = `${STUDIO_API_PATH}/preview/read`\nexport const CMS_PREVIEW_QUERY_PATH = `${STUDIO_API_PATH}/preview/query`\n"],"mappings":";AAAA,MAAa,mBAAmB;AAChC,MAAa,kBAAkB,GAAG,iBAAiB;AACnD,MAAa,kBAAkB,GAAG,iBAAiB;AACnD,MAAa,4BAA4B,GAAG,iBAAiB;AAC7D,MAAa,qBAAqB,GAAG,iBAAiB;AACtD,MAAa,0BAA0B;AACvC,MAAa,oBAAoB,GAAG,mBAAmB;AACvD,MAAa,qBAAqB,GAAG,mBAAmB;AACxD,MAAa,yBAAyB,GAAG,gBAAgB;AACzD,MAAa,0BAA0B,GAAG,gBAAgB;AAC1D,MAAa,wBAAwB,GAAG,gBAAgB;AACxD,MAAa,yBAAyB,GAAG,gBAAgB"}
|
package/src/Module.js
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
import { c as
|
|
1
|
+
import { c as STUDIO_API_PATH, d as STUDIO_COLLABORATION_PATH, f as STUDIO_HEALTH_PATH, l as STUDIO_APP_PATH, t as CMS_AUTHENTICATION_PATH, u as STUDIO_BASE_PATH } from "./HttpPaths-BbS21Jy8.js";
|
|
2
|
+
import { registerStudioApp } from "./internal/studio-app.js";
|
|
3
|
+
import { cmsAuthoringPlugin } from "./internal/authoring-compiler.js";
|
|
4
|
+
import { registerAuthoringCatalog } from "./internal/authoring-catalog.js";
|
|
2
5
|
import { loadCmsConfiguration } from "./internal/cms-config.js";
|
|
3
6
|
import { compileCmsConfiguration } from "./internal/configuration.js";
|
|
4
|
-
import { cmsAuthoringPlugin } from "./internal/authoring-compiler.js";
|
|
5
|
-
import { resolveBlockAuthoring } from "./internal/authoring-metadata.js";
|
|
6
|
-
import { createCheckerByJson } from "vue-component-meta";
|
|
7
|
-
import { NodeFileSystem, NodePath } from "@effect/platform-node-shared";
|
|
8
7
|
import { addComponent, addImports, addPlugin, addServerHandler, addServerPlugin, addServerTemplate, addVitePlugin, createResolver, defineNuxtModule, extendPages } from "@nuxt/kit";
|
|
9
|
-
import { Effect,
|
|
8
|
+
import { Effect, Layer } from "effect";
|
|
9
|
+
import { NodeCrypto, NodeFileSystem, NodePath } from "@effect/platform-node-shared";
|
|
10
10
|
|
|
11
11
|
//#region src/Module.ts
|
|
12
12
|
const resolver = createResolver(import.meta.url);
|
|
13
|
-
const nodeLayer = Layer.merge(NodeFileSystem.layer, NodePath.layer);
|
|
14
|
-
var StudioApplicationMissing = class extends Schema.TaggedError()("StudioApplicationMissing", {}) {};
|
|
13
|
+
const nodeLayer = Layer.merge(NodeCrypto.layer, Layer.merge(NodeFileSystem.layer, NodePath.layer));
|
|
15
14
|
const cmsNuxtModule = defineNuxtModule({
|
|
16
|
-
moduleDependencies: {
|
|
17
|
-
"@comark/nuxt": {},
|
|
18
|
-
"nuxt-component-meta": { overrides: {
|
|
19
|
-
exclude: [/(?:^|[\\/])node_modules[\\/]/u],
|
|
20
|
-
globalsOnly: true
|
|
21
|
-
} }
|
|
22
|
-
},
|
|
15
|
+
moduleDependencies: { "@comark/nuxt": {} },
|
|
23
16
|
meta: {
|
|
24
17
|
compatibility: { nuxt: ">=4.5.0 <5.0.0" },
|
|
25
18
|
name: "@phtngyn/cms"
|
|
@@ -30,52 +23,28 @@ const cmsNuxtModule = defineNuxtModule({
|
|
|
30
23
|
});
|
|
31
24
|
const setupModule = Effect.fn("CmsNuxtModule.setup")(function* (nuxt) {
|
|
32
25
|
addVitePlugin(cmsAuthoringPlugin());
|
|
33
|
-
const path = yield* Path.Path;
|
|
34
26
|
const authored = yield* loadCmsConfiguration(nuxt.options.rootDir);
|
|
35
27
|
const initialSources = yield* Effect.promise(() => Promise.resolve(authored.configuration.initialSources?.() ?? []));
|
|
36
28
|
const compiled = compileCmsConfiguration(authored.configuration, initialSources);
|
|
37
29
|
nuxt.options.watch.push(authored.path);
|
|
38
|
-
const
|
|
39
|
-
let authoring = [];
|
|
40
|
-
nuxt.hook("components:extend", (components) => runAuthoring(Effect.gen(function* () {
|
|
41
|
-
const fileSystem = yield* FileSystem.FileSystem;
|
|
42
|
-
const checker = createCheckerByJson(nuxt.options.rootDir, {
|
|
43
|
-
compilerOptions: {
|
|
44
|
-
strict: true,
|
|
45
|
-
target: "ESNext",
|
|
46
|
-
module: "ESNext",
|
|
47
|
-
moduleResolution: "Bundler",
|
|
48
|
-
baseUrl: nuxt.options.rootDir,
|
|
49
|
-
paths: Object.fromEntries(Object.entries(nuxt.options.alias).map(([key, value]) => [`${key}/*`, [`${value}/*`]]))
|
|
50
|
-
},
|
|
51
|
-
files: []
|
|
52
|
-
}, { schema: true });
|
|
53
|
-
const resolved = [];
|
|
54
|
-
for (const component of components) {
|
|
55
|
-
if (!component.filePath.endsWith(".vue") || component.filePath.includes("/node_modules/")) continue;
|
|
56
|
-
const source = yield* fileSystem.readFileString(component.filePath);
|
|
57
|
-
const definition = yield* resolveBlockAuthoring(checker, component.filePath, component.kebabName, source);
|
|
58
|
-
if (!definition) continue;
|
|
59
|
-
if (resolved.some((existing) => existing.name === definition.name)) throw new Error(`Duplicate authoring block ${definition.name}.`);
|
|
60
|
-
resolved.push(definition);
|
|
61
|
-
component.global = true;
|
|
62
|
-
}
|
|
63
|
-
authoring = resolved.sort((left, right) => left.name.localeCompare(right.name));
|
|
64
|
-
})));
|
|
30
|
+
const authoring = yield* registerAuthoringCatalog(nuxt, compiled.documents);
|
|
65
31
|
const installationPluginId = resolver.resolve("./runtime/plugin.virtual.mjs");
|
|
66
32
|
const installationPluginTemplate = addServerTemplate({
|
|
67
33
|
filename: installationPluginId,
|
|
68
34
|
getContents: () => [
|
|
69
35
|
`import { createInstallationPlugin } from ${JSON.stringify(resolver.resolve("./runtime/plugin"))}`,
|
|
70
36
|
`import cmsConfiguration from ${JSON.stringify(authored.path)}`,
|
|
71
|
-
|
|
72
|
-
`export default createInstallationPlugin(cmsConfiguration,
|
|
37
|
+
`import authoring from ${JSON.stringify(authoring.dst)}`,
|
|
38
|
+
`export default createInstallationPlugin(cmsConfiguration, authoring, ${JSON.stringify(compiled.initialSources)})`
|
|
73
39
|
].join("\n")
|
|
74
40
|
});
|
|
41
|
+
addServerHandler({
|
|
42
|
+
handler: resolver.resolve("./runtime/api"),
|
|
43
|
+
route: `${STUDIO_HEALTH_PATH}/**:path`
|
|
44
|
+
});
|
|
75
45
|
registerDeliveryUi(nuxt);
|
|
76
|
-
yield* registerStudioApp();
|
|
77
|
-
|
|
78
|
-
configureNitro(nuxt, path.resolve(path.dirname(shellPath), "assets"));
|
|
46
|
+
yield* registerStudioApp(nuxt, resolver);
|
|
47
|
+
configureNitro(nuxt);
|
|
79
48
|
addServerPlugin(installationPluginTemplate.filename);
|
|
80
49
|
addServerHandler({
|
|
81
50
|
handler: resolver.resolve("./runtime/api"),
|
|
@@ -87,10 +56,11 @@ const setupModule = Effect.fn("CmsNuxtModule.setup")(function* (nuxt) {
|
|
|
87
56
|
});
|
|
88
57
|
addServerHandler({
|
|
89
58
|
handler: resolver.resolve("./runtime/api"),
|
|
90
|
-
route: `${
|
|
59
|
+
route: `${STUDIO_API_PATH}/**:path`
|
|
91
60
|
});
|
|
92
61
|
});
|
|
93
62
|
function registerDeliveryUi(nuxt) {
|
|
63
|
+
addPlugin(resolver.resolve("./runtime/blocks"));
|
|
94
64
|
nuxt.options.css.push(resolver.resolve("./runtime/preview/preview.css"));
|
|
95
65
|
addComponent({
|
|
96
66
|
name: "DocumentField",
|
|
@@ -108,6 +78,7 @@ function registerDeliveryUi(nuxt) {
|
|
|
108
78
|
name: "CmsStudioPreviewMarker",
|
|
109
79
|
filePath: resolver.resolve("./runtime/preview/CmsStudioPreviewMarker")
|
|
110
80
|
});
|
|
81
|
+
addPlugin(resolver.resolve("./runtime/delivery/plugin"));
|
|
111
82
|
addPlugin(resolver.resolve("./runtime/preview/plugin.client"));
|
|
112
83
|
addImports([{
|
|
113
84
|
name: "useDocument",
|
|
@@ -124,37 +95,17 @@ function registerDeliveryUi(nuxt) {
|
|
|
124
95
|
});
|
|
125
96
|
});
|
|
126
97
|
}
|
|
127
|
-
|
|
128
|
-
const fileSystem = yield* FileSystem.FileSystem;
|
|
129
|
-
const shellPath = resolver.resolve("../dist/studio/index.html");
|
|
130
|
-
if (!(yield* fileSystem.exists(shellPath))) return yield* new StudioApplicationMissing();
|
|
131
|
-
const shell = yield* fileSystem.readFileString(shellPath);
|
|
132
|
-
const handler = addServerTemplate({
|
|
133
|
-
filename: resolver.resolve("./runtime/studio-app.virtual.mjs"),
|
|
134
|
-
getContents: () => [`import { createStudioAppHandler } from ${JSON.stringify(resolver.resolve("./runtime/studio-app"))}`, `export default createStudioAppHandler(${JSON.stringify(shell)})`].join("\n")
|
|
135
|
-
});
|
|
136
|
-
addServerHandler({
|
|
137
|
-
handler: handler.filename,
|
|
138
|
-
method: "get",
|
|
139
|
-
route: STUDIO_APP_PATH
|
|
140
|
-
});
|
|
141
|
-
addServerHandler({
|
|
142
|
-
handler: handler.filename,
|
|
143
|
-
method: "get",
|
|
144
|
-
route: `${STUDIO_APP_PATH}/**:path`
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
function configureNitro(nuxt, assetsPath) {
|
|
98
|
+
function configureNitro(nuxt) {
|
|
148
99
|
nuxt.hook("nitro:config", (config) => {
|
|
149
100
|
config.experimental ||= {};
|
|
150
101
|
config.experimental.websocket = true;
|
|
151
|
-
config.publicAssets ||= [];
|
|
152
|
-
config.publicAssets.push({
|
|
153
|
-
baseURL: `${STUDIO_APP_PATH}/assets`,
|
|
154
|
-
dir: assetsPath,
|
|
155
|
-
maxAge: nuxt.options.dev ? 0 : 31536e3
|
|
156
|
-
});
|
|
157
102
|
config.routeRules ||= {};
|
|
103
|
+
const studioRules = {
|
|
104
|
+
ssr: false,
|
|
105
|
+
headers: { "cache-control": "no-store" }
|
|
106
|
+
};
|
|
107
|
+
config.routeRules[`${STUDIO_APP_PATH}/**`] = studioRules;
|
|
108
|
+
config.routeRules[STUDIO_APP_PATH] = studioRules;
|
|
158
109
|
config.routeRules[STUDIO_BASE_PATH] = { redirect: {
|
|
159
110
|
statusCode: 302,
|
|
160
111
|
to: STUDIO_APP_PATH
|
package/src/Module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Module.js","names":[],"sources":["../../../src/Module.ts"],"sourcesContent":["import type { HookResult, Nuxt } from '@nuxt/schema'\nimport type { NitroConfig } from 'nitropack/types'\nimport type { ComponentDefinition } from '@internal/protocol/Configuration'\nimport { createCheckerByJson } from 'vue-component-meta'\nimport { NodeFileSystem, NodePath } from '@effect/platform-node-shared'\nimport {\n CMS_AUTHENTICATION_PATH,\n STUDIO_APP_PATH,\n STUDIO_BASE_PATH,\n STUDIO_COLLABORATION_PATH,\n} from '@internal/protocol/HttpPaths'\nimport {\n addComponent,\n addImports,\n addPlugin,\n addServerHandler,\n addServerPlugin,\n addServerTemplate,\n addVitePlugin,\n createResolver,\n defineNuxtModule,\n extendPages,\n} from '@nuxt/kit'\nimport { Effect, FileSystem, Layer, Path, Schema } from 'effect'\nimport { loadCmsConfiguration } from './internal/cms-config'\nimport { compileCmsConfiguration } from './internal/configuration'\nimport { cmsAuthoringPlugin } from './internal/authoring-compiler'\nimport { resolveBlockAuthoring } from './internal/authoring-metadata'\n\ndeclare module '@nuxt/schema' {\n interface NuxtHooks {\n 'nitro:config': (nitroConfig: NitroConfig) => HookResult\n }\n}\n\nconst resolver = createResolver(import.meta.url)\nconst nodeLayer = Layer.merge(NodeFileSystem.layer, NodePath.layer)\n\nclass StudioApplicationMissing extends Schema.TaggedError<StudioApplicationMissing>()('StudioApplicationMissing', {}) {}\n\nconst cmsNuxtModule = defineNuxtModule({\n moduleDependencies: {\n '@comark/nuxt': {},\n 'nuxt-component-meta': {\n overrides: {\n exclude: [/(?:^|[\\\\/])node_modules[\\\\/]/u],\n globalsOnly: true,\n },\n },\n },\n meta: {\n compatibility: { nuxt: '>=4.5.0 <5.0.0' },\n name: '@phtngyn/cms',\n },\n setup(_options, nuxt) {\n return Effect.runPromise(setupModule(nuxt).pipe(Effect.provide(nodeLayer)))\n },\n})\n\nexport default cmsNuxtModule\n\nconst setupModule = Effect.fn('CmsNuxtModule.setup')(function* (nuxt: Nuxt) {\n addVitePlugin(cmsAuthoringPlugin())\n const path = yield* Path.Path\n const authored = yield* loadCmsConfiguration(nuxt.options.rootDir)\n const initialSources = yield* Effect.promise(() => Promise.resolve(authored.configuration.initialSources?.() ?? []))\n const compiled = compileCmsConfiguration(authored.configuration, initialSources)\n nuxt.options.watch.push(authored.path)\n const runAuthoring = Effect.runPromiseWith(yield* Effect.context<FileSystem.FileSystem>())\n let authoring: ReadonlyArray<ComponentDefinition> = []\n nuxt.hook('components:extend', (components) =>\n runAuthoring(\n Effect.gen(function* () {\n const fileSystem = yield* FileSystem.FileSystem\n const checker = createCheckerByJson(\n nuxt.options.rootDir,\n {\n compilerOptions: {\n strict: true,\n target: 'ESNext',\n module: 'ESNext',\n moduleResolution: 'Bundler',\n baseUrl: nuxt.options.rootDir,\n paths: Object.fromEntries(\n Object.entries(nuxt.options.alias).map(([key, value]) => [`${key}/*`, [`${value}/*`]]),\n ),\n },\n files: [],\n },\n { schema: true },\n )\n const resolved: ComponentDefinition[] = []\n for (const component of components) {\n if (!component.filePath.endsWith('.vue') || component.filePath.includes('/node_modules/')) continue\n const source = yield* fileSystem.readFileString(component.filePath)\n const definition = yield* resolveBlockAuthoring(checker, component.filePath, component.kebabName, source)\n if (!definition) continue\n if (resolved.some((existing) => existing.name === definition.name))\n throw new Error(`Duplicate authoring block ${definition.name}.`)\n resolved.push(definition)\n // Nuxt generates delivery and preview registration from this same discovered component.\n component.global = true\n }\n authoring = resolved.sort((left, right) => left.name.localeCompare(right.name))\n }),\n ),\n )\n\n const installationPluginId = resolver.resolve('./runtime/plugin.virtual.mjs')\n const installationPluginTemplate = addServerTemplate({\n filename: installationPluginId,\n getContents: () =>\n [\n `import { createInstallationPlugin } from ${JSON.stringify(resolver.resolve('./runtime/plugin'))}`,\n `import cmsConfiguration from ${JSON.stringify(authored.path)}`,\n \"import components from '#nuxt-component-meta/nitro'\",\n `export default createInstallationPlugin(cmsConfiguration, components, ${JSON.stringify(compiled.initialSources)}, ${JSON.stringify(authoring)})`,\n ].join('\\n'),\n })\n registerDeliveryUi(nuxt)\n yield* registerStudioApp()\n const shellPath = resolver.resolve('../dist/studio/index.html')\n configureNitro(nuxt, path.resolve(path.dirname(shellPath), 'assets'))\n addServerPlugin(installationPluginTemplate.filename)\n addServerHandler({\n handler: resolver.resolve('./runtime/api'),\n route: `${CMS_AUTHENTICATION_PATH}/**:path`,\n })\n addServerHandler({\n handler: resolver.resolve('./runtime/collaboration'),\n route: STUDIO_COLLABORATION_PATH,\n })\n addServerHandler({\n handler: resolver.resolve('./runtime/api'),\n route: `${STUDIO_BASE_PATH}/**:path`,\n })\n})\n\nfunction registerDeliveryUi(nuxt: Nuxt): void {\n nuxt.options.css.push(resolver.resolve('./runtime/preview/preview.css'))\n addComponent({ name: 'DocumentField', filePath: resolver.resolve('./runtime/delivery/DocumentField') })\n addComponent({ name: 'DocumentRenderer', filePath: resolver.resolve('./runtime/delivery/DocumentRenderer') })\n addComponent({ name: 'DocumentScope', filePath: resolver.resolve('./runtime/delivery/DocumentScope') })\n addComponent({\n name: 'CmsStudioPreviewMarker',\n filePath: resolver.resolve('./runtime/preview/CmsStudioPreviewMarker'),\n })\n addPlugin(resolver.resolve('./runtime/preview/plugin.client'))\n addImports([\n { name: 'useDocument', from: resolver.resolve('./runtime/delivery/useDocument') },\n { name: 'useDocumentQuery', from: resolver.resolve('./runtime/delivery/useDocumentQuery') },\n ])\n extendPages((pages) => {\n pages.push({\n file: resolver.resolve('./runtime/delivery/document'),\n name: 'cms-document-page',\n path: '/:contentPath(.*)*',\n })\n })\n}\n\nconst registerStudioApp = Effect.fn('CmsNuxtModule.registerStudioApp')(function* () {\n const fileSystem = yield* FileSystem.FileSystem\n const shellPath = resolver.resolve('../dist/studio/index.html')\n if (!(yield* fileSystem.exists(shellPath))) {\n return yield* new StudioApplicationMissing()\n }\n const shell = yield* fileSystem.readFileString(shellPath)\n const handler = addServerTemplate({\n filename: resolver.resolve('./runtime/studio-app.virtual.mjs'),\n getContents: () =>\n [\n `import { createStudioAppHandler } from ${JSON.stringify(resolver.resolve('./runtime/studio-app'))}`,\n `export default createStudioAppHandler(${JSON.stringify(shell)})`,\n ].join('\\n'),\n })\n addServerHandler({ handler: handler.filename, method: 'get', route: STUDIO_APP_PATH })\n addServerHandler({ handler: handler.filename, method: 'get', route: `${STUDIO_APP_PATH}/**:path` })\n})\n\nfunction configureNitro(nuxt: Nuxt, assetsPath: string): void {\n nuxt.hook('nitro:config', (config: NitroConfig) => {\n config.experimental ||= {}\n config.experimental.websocket = true\n config.publicAssets ||= []\n config.publicAssets.push({\n baseURL: `${STUDIO_APP_PATH}/assets`,\n dir: assetsPath,\n maxAge: nuxt.options.dev ? 0 : 60 * 60 * 24 * 365,\n })\n config.routeRules ||= {}\n config.routeRules[STUDIO_BASE_PATH] = { redirect: { statusCode: 302, to: STUDIO_APP_PATH } }\n })\n}\n"],"mappings":";;;;;;;;;;;AAmCA,MAAM,WAAW,eAAe,YAAY,GAAG;AAC/C,MAAM,YAAY,MAAM,MAAM,eAAe,OAAO,SAAS,KAAK;AAElE,IAAM,2BAAN,cAAuC,OAAO,YAAsC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC,CAAC;AAEvH,MAAM,gBAAgB,iBAAiB;CACrC,oBAAoB;EAClB,gBAAgB,CAAC;EACjB,uBAAuB,EACrB,WAAW;GACT,SAAS,CAAC,+BAA+B;GACzC,aAAa;EACf,EACF;CACF;CACA,MAAM;EACJ,eAAe,EAAE,MAAM,iBAAiB;EACxC,MAAM;CACR;CACA,MAAM,UAAU,MAAM;EACpB,OAAO,OAAO,WAAW,YAAY,IAAI,CAAC,CAAC,KAAK,OAAO,QAAQ,SAAS,CAAC,CAAC;CAC5E;AACF,CAAC;AAID,MAAM,cAAc,OAAO,GAAG,qBAAqB,CAAC,CAAC,WAAW,MAAY;CAC1E,cAAc,mBAAmB,CAAC;CAClC,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM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[],"sources":["../../../src/Module.ts"],"sourcesContent":["import type { HookResult, Nuxt } from '@nuxt/schema'\nimport type { NitroConfig } from 'nitropack/types'\nimport { registerStudioApp } from './internal/studio-app'\nimport { registerAuthoringCatalog } from './internal/authoring-catalog'\nimport { NodeCrypto, NodeFileSystem, NodePath } from '@effect/platform-node-shared'\nimport {\n CMS_AUTHENTICATION_PATH,\n STUDIO_APP_PATH,\n STUDIO_BASE_PATH,\n STUDIO_API_PATH,\n STUDIO_HEALTH_PATH,\n STUDIO_COLLABORATION_PATH,\n} from '@internal/protocol/HttpPaths'\nimport {\n addComponent,\n addImports,\n addPlugin,\n addServerHandler,\n addServerPlugin,\n addServerTemplate,\n addVitePlugin,\n createResolver,\n defineNuxtModule,\n extendPages,\n} from '@nuxt/kit'\nimport { Effect, Layer } from 'effect'\nimport { loadCmsConfiguration } from './internal/cms-config'\nimport { compileCmsConfiguration } from './internal/configuration'\nimport { cmsAuthoringPlugin } from './internal/authoring-compiler'\n\ndeclare module '@nuxt/schema' {\n interface NuxtHooks {\n 'nitro:config': (nitroConfig: NitroConfig) => HookResult\n }\n}\n\nconst resolver = createResolver(import.meta.url)\nconst nodeLayer = Layer.merge(NodeCrypto.layer, Layer.merge(NodeFileSystem.layer, NodePath.layer))\n\nconst cmsNuxtModule = defineNuxtModule({\n moduleDependencies: {\n '@comark/nuxt': {},\n },\n meta: {\n compatibility: { nuxt: '>=4.5.0 <5.0.0' },\n name: '@phtngyn/cms',\n },\n setup(_options, nuxt) {\n return Effect.runPromise(setupModule(nuxt).pipe(Effect.provide(nodeLayer)))\n },\n})\n\nexport default cmsNuxtModule\n\nconst setupModule = Effect.fn('CmsNuxtModule.setup')(function* (nuxt: Nuxt) {\n addVitePlugin(cmsAuthoringPlugin())\n const authored = yield* loadCmsConfiguration(nuxt.options.rootDir)\n const initialSources = yield* Effect.promise(() => Promise.resolve(authored.configuration.initialSources?.() ?? []))\n const compiled = compileCmsConfiguration(authored.configuration, initialSources)\n nuxt.options.watch.push(authored.path)\n const authoring = yield* registerAuthoringCatalog(nuxt, compiled.documents)\n const installationPluginId = resolver.resolve('./runtime/plugin.virtual.mjs')\n const installationPluginTemplate = addServerTemplate({\n filename: installationPluginId,\n getContents: () =>\n [\n `import { createInstallationPlugin } from ${JSON.stringify(resolver.resolve('./runtime/plugin'))}`,\n `import cmsConfiguration from ${JSON.stringify(authored.path)}`,\n `import authoring from ${JSON.stringify(authoring.dst)}`,\n `export default createInstallationPlugin(cmsConfiguration, authoring, ${JSON.stringify(compiled.initialSources)})`,\n ].join('\\n'),\n })\n addServerHandler({ handler: resolver.resolve('./runtime/api'), route: `${STUDIO_HEALTH_PATH}/**:path` })\n registerDeliveryUi(nuxt)\n yield* registerStudioApp(nuxt, resolver)\n configureNitro(nuxt)\n addServerPlugin(installationPluginTemplate.filename)\n addServerHandler({\n handler: resolver.resolve('./runtime/api'),\n route: `${CMS_AUTHENTICATION_PATH}/**:path`,\n })\n addServerHandler({\n handler: resolver.resolve('./runtime/collaboration'),\n route: STUDIO_COLLABORATION_PATH,\n })\n addServerHandler({\n handler: resolver.resolve('./runtime/api'),\n route: `${STUDIO_API_PATH}/**:path`,\n })\n})\n\nfunction registerDeliveryUi(nuxt: Nuxt): void {\n addPlugin(resolver.resolve('./runtime/blocks'))\n nuxt.options.css.push(resolver.resolve('./runtime/preview/preview.css'))\n addComponent({ name: 'DocumentField', filePath: resolver.resolve('./runtime/delivery/DocumentField') })\n addComponent({ name: 'DocumentRenderer', filePath: resolver.resolve('./runtime/delivery/DocumentRenderer') })\n addComponent({ name: 'DocumentScope', filePath: resolver.resolve('./runtime/delivery/DocumentScope') })\n addComponent({\n name: 'CmsStudioPreviewMarker',\n filePath: resolver.resolve('./runtime/preview/CmsStudioPreviewMarker'),\n })\n addPlugin(resolver.resolve('./runtime/delivery/plugin'))\n addPlugin(resolver.resolve('./runtime/preview/plugin.client'))\n addImports([\n { name: 'useDocument', from: resolver.resolve('./runtime/delivery/useDocument') },\n { name: 'useDocumentQuery', from: resolver.resolve('./runtime/delivery/useDocumentQuery') },\n ])\n extendPages((pages) => {\n pages.push({\n file: resolver.resolve('./runtime/delivery/document'),\n name: 'cms-document-page',\n path: '/:contentPath(.*)*',\n })\n })\n}\n\nfunction configureNitro(nuxt: Nuxt): void {\n nuxt.hook('nitro:config', (config: NitroConfig) => {\n config.experimental ||= {}\n config.experimental.websocket = true\n config.routeRules ||= {}\n const studioRules = { ssr: false, headers: { 'cache-control': 'no-store' } }\n config.routeRules[`${STUDIO_APP_PATH}/**`] = studioRules\n config.routeRules[STUDIO_APP_PATH] = studioRules\n\n config.routeRules[STUDIO_BASE_PATH] = { redirect: { statusCode: 302, to: STUDIO_APP_PATH } }\n })\n}\n"],"mappings":";;;;;;;;;;;AAoCA,MAAM,WAAW,eAAe,YAAY,GAAG;AAC/C,MAAM,YAAY,MAAM,MAAM,WAAW,OAAO,MAAM,MAAM,eAAe,OAAO,SAAS,KAAK,CAAC;AAEjG,MAAM,gBAAgB,iBAAiB;CACrC,oBAAoB,EAClB,gBAAgB,CAAC,EACnB;CACA,MAAM;EACJ,eAAe,EAAE,MAAM,iBAAiB;EACxC,MAAM;CACR;CACA,MAAM,UAAU,MAAM;EACpB,OAAO,OAAO,WAAW,YAAY,IAAI,CAAC,CAAC,KAAK,OAAO,QAAQ,SAAS,CAAC,CAAC;CAC5E;AACF,CAAC;AAID,MAAM,cAAc,OAAO,GAAG,qBAAqB,CAAC,CAAC,WAAW,MAAY;CAC1E,cAAc,mBAAmB,CAAC;CAClC,MAAM,WAAW,OAAO,qBAAqB,KAAK,QAAQ,OAAO;CACjE,MAAM,iBAAiB,OAAO,OAAO,cAAc,QAAQ,QAAQ,SAAS,cAAc,iBAAiB,KAAK,CAAC,CAAC,CAAC;CACnH,MAAM,WAAW,wBAAwB,SAAS,eAAe,cAAc;CAC/E,KAAK,QAAQ,MAAM,KAAK,SAAS,IAAI;CACrC,MAAM,YAAY,OAAO,yBAAyB,MAAM,SAAS,SAAS;CAC1E,MAA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W,CACT;EAAE,MAAM;EAAe,MAAM,SAAS,QAAQ,gCAAgC;CAAE,GAChF;EAAE,MAAM;EAAoB,MAAM,SAAS,QAAQ,qCAAqC;CAAE,CAC5F,CAAC;CACD,aAAa,UAAU;EACrB,MAAM,KAAK;GACT,MAAM,SAAS,QAAQ,6BAA6B;GACpD,MAAM;GACN,MAAM;EACR,CAAC;CACH,CAAC;AACH;AAEA,SAAS,eAAe,MAAkB;CACxC,KAAK,KAAK,iBAAiB,WAAwB;EACjD,OAAO,iBAAiB,CAAC;EACzB,OAAO,aAAa,YAAY;EAChC,OAAO,eAAe,CAAC;EACvB,MAAM,cAAc;GAAE,KAAK;GAAO,SAAS,EAAE,iBAAiB,WAAW;EAAE;EAC3E,OAAO,WAAW,GAAG,gBAAgB,QAAQ;EAC7C,OAAO,WAAW,mBAAmB;EAErC,OAAO,WAAW,oBAAoB,EAAE,UAAU;GAAE,YAAY;GAAK,IAAI;EAAgB,EAAE;CAC7F,CAAC;AACH"}
|
|
@@ -1,117 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as
|
|
3
|
-
import {
|
|
4
|
-
import { n as DocumentConfiguration, r as MediaConfiguration, t as ComponentDefinition } from "./Configuration-BGYFD2N1.js";
|
|
1
|
+
import { c as STUDIO_API_PATH } from "./HttpPaths-BbS21Jy8.js";
|
|
2
|
+
import { A as RemoveDocumentInput, B as StudioActor, D as PublishedDocumentPage, E as PublishedDocumentLookup, F as AccessDenied, I as AuthenticationRequired, K as MediaCleanupReport, M as UndeleteDocumentInput, O as PublishedDocumentQuery, P as UpdateDocumentInput, Q as MediaInvalid, S as DuplicateDocumentInput, T as PublishDocumentInput, Tt as nonNegativeInt, V as StudioEntryDenied, W as MediaAsset, X as MediaId, Y as MediaFolder, Z as MediaIntegrityReport, _ as DocumentSource, _t as DocumentVersion, at as MediaReferenced, b as DocumentSurround, ct as MediaUpload, d as DocumentIssue, et as MediaNotFound, f as DocumentMutationResult, g as DocumentRevisionAction, gt as DocumentId, ht as DocumentHistoryCursor, i as CreateDocumentInput, j as RestoreDocumentInput, k as PublishedDocumentSurroundQuery, m as DocumentNavigationQuery, n as CmsMarkdownDocument, nt as MediaPage, o as DeletedDocument, p as DocumentNavigationItem, pt as RequestId, q as MediaConflict, r as CompiledDocument, rt as MediaQuery, s as DocumentBrowseQuery, st as MediaTooLarge, tt as MediaObjectKey, w as MoveDocumentInput, wt as SourcePath, x as DocumentValidationResult, xt as RevisionId, y as DocumentSummary, yt as PublicPath, z as Role } from "./models-BkMgeaOL.js";
|
|
3
|
+
import { i as MediaConfiguration, r as DocumentConfiguration } from "./Configuration-DyKo0sLS.js";
|
|
5
4
|
import { Context, Schema } from "effect";
|
|
6
5
|
import { Multipart } from "effect/unstable/http";
|
|
7
6
|
import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema } from "effect/unstable/httpapi";
|
|
8
7
|
|
|
9
|
-
//#region ../protocol/src/Media.ts
|
|
10
|
-
/**
|
|
11
|
-
* Media wire models. Search pages are newest-first with opaque continuation cursors; only ready
|
|
12
|
-
* assets are public results, and names, folders, and object keys are validated path-safe values.
|
|
13
|
-
*/
|
|
14
|
-
const hasUnsafeMediaCharacter = (value) => {
|
|
15
|
-
for (const character of value) {
|
|
16
|
-
const codePoint = character.codePointAt(0);
|
|
17
|
-
if (character === "\\" || codePoint !== void 0 && (codePoint <= 31 || codePoint === 127)) return true;
|
|
18
|
-
}
|
|
19
|
-
return false;
|
|
20
|
-
};
|
|
21
|
-
const isSafeMediaPath = (value, allowEmpty) => {
|
|
22
|
-
if (value.length === 0) return allowEmpty;
|
|
23
|
-
if (value !== value.trim() || value.startsWith("/") || value.endsWith("/") || hasUnsafeMediaCharacter(value)) return false;
|
|
24
|
-
return value.split("/").every((segment) => segment.length > 0 && segment !== "." && segment !== "..");
|
|
25
|
-
};
|
|
26
|
-
const safeMediaFolder = Schema.makeFilter((value) => isSafeMediaPath(value, true), { expected: "a provider-relative media folder without traversal segments" });
|
|
27
|
-
const safeMediaObjectKey = Schema.makeFilter((value) => isSafeMediaPath(value, false), { expected: "a non-empty provider-relative media object key without traversal segments" });
|
|
28
|
-
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" });
|
|
29
|
-
const MediaId = Schema.String.check(Schema.isUUID()).pipe(Schema.brand("MediaId"));
|
|
30
|
-
const MediaFolder = Schema.String.check(Schema.isMaxLength(512), safeMediaFolder).pipe(Schema.brand("MediaFolder"));
|
|
31
|
-
const MediaObjectKey = Schema.String.check(Schema.isMaxLength(1024), safeMediaObjectKey).pipe(Schema.brand("MediaObjectKey"));
|
|
32
|
-
const MediaName = Schema.String.check(safeMediaName).pipe(Schema.brand("MediaName"));
|
|
33
|
-
const MediaCursor = Schema.NonEmptyString.pipe(Schema.brand("MediaCursor"));
|
|
34
|
-
const ImageMimeType = Schema.Literals([
|
|
35
|
-
"image/avif",
|
|
36
|
-
"image/gif",
|
|
37
|
-
"image/jpeg",
|
|
38
|
-
"image/png",
|
|
39
|
-
"image/webp"
|
|
40
|
-
]);
|
|
41
|
-
const MediaStatus = Schema.Literals([
|
|
42
|
-
"uploading",
|
|
43
|
-
"ready",
|
|
44
|
-
"deleting"
|
|
45
|
-
]);
|
|
46
|
-
const MediaByteSize = Schema.Int.check(Schema.isGreaterThan(0));
|
|
47
|
-
const MediaAsset = Schema.Struct({
|
|
48
|
-
kind: Schema.tag("image"),
|
|
49
|
-
id: MediaId,
|
|
50
|
-
objectKey: MediaObjectKey,
|
|
51
|
-
url: Schema.NonEmptyString,
|
|
52
|
-
name: MediaName,
|
|
53
|
-
folder: MediaFolder,
|
|
54
|
-
mimeType: ImageMimeType,
|
|
55
|
-
byteSize: MediaByteSize,
|
|
56
|
-
createdAt: Schema.DateTimeUtcFromString,
|
|
57
|
-
updatedAt: Schema.DateTimeUtcFromString,
|
|
58
|
-
status: MediaStatus
|
|
59
|
-
}).annotate({ identifier: "MediaAsset" });
|
|
60
|
-
const MediaUpload = Schema.Struct({
|
|
61
|
-
name: MediaName,
|
|
62
|
-
folder: Schema.optionalKey(MediaFolder),
|
|
63
|
-
declaredMimeType: Schema.optionalKey(Schema.NonEmptyString),
|
|
64
|
-
declaredByteSize: MediaByteSize
|
|
65
|
-
}).annotate({ identifier: "MediaUpload" });
|
|
66
|
-
const MediaQuery = Schema.Struct({
|
|
67
|
-
cursor: Schema.optionalKey(MediaCursor),
|
|
68
|
-
folder: Schema.optionalKey(MediaFolder),
|
|
69
|
-
search: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(200))),
|
|
70
|
-
limit: Schema.optionalKey(Schema.Int.check(Schema.isBetween({
|
|
71
|
-
minimum: 1,
|
|
72
|
-
maximum: 100
|
|
73
|
-
})))
|
|
74
|
-
}).annotate({ identifier: "MediaQuery" });
|
|
75
|
-
const ReadyMediaAssets = Schema.Array(MediaAsset).check(Schema.makeFilter((assets) => assets.every((asset) => asset.status === "ready"), { expected: "media assets whose lifecycle status is ready" }));
|
|
76
|
-
const MediaPage = Schema.Struct({
|
|
77
|
-
assets: ReadyMediaAssets,
|
|
78
|
-
folders: Schema.Array(MediaFolder),
|
|
79
|
-
nextCursor: Schema.optionalKey(MediaCursor),
|
|
80
|
-
total: nonNegativeInt
|
|
81
|
-
}).annotate({ identifier: "MediaPage" });
|
|
82
|
-
const MediaReference = Schema.Struct({
|
|
83
|
-
documentId: DocumentId,
|
|
84
|
-
path: PublicPath,
|
|
85
|
-
sourcePath: SourcePath,
|
|
86
|
-
objectKey: MediaObjectKey,
|
|
87
|
-
nodePath: Schema.Array(nonNegativeInt)
|
|
88
|
-
}).annotate({ identifier: "MediaReference" });
|
|
89
|
-
const MediaObjectMismatch = Schema.Struct({
|
|
90
|
-
asset: MediaAsset,
|
|
91
|
-
storedByteSize: MediaByteSize,
|
|
92
|
-
storedMimeType: Schema.optionalKey(ImageMimeType)
|
|
93
|
-
}).annotate({ identifier: "MediaObjectMismatch" });
|
|
94
|
-
const MediaIntegrityReport = Schema.Struct({
|
|
95
|
-
missingAssets: Schema.Array(MediaReference),
|
|
96
|
-
missingObjects: Schema.Array(MediaAsset),
|
|
97
|
-
mismatchedObjects: Schema.Array(MediaObjectMismatch),
|
|
98
|
-
orphanedObjectKeys: Schema.Array(MediaObjectKey),
|
|
99
|
-
unusedAssets: Schema.Array(MediaAsset)
|
|
100
|
-
}).annotate({ identifier: "MediaIntegrityReport" });
|
|
101
|
-
const MediaCleanupReport = Schema.Struct({ removedObjectKeys: Schema.Array(MediaObjectKey) }).annotate({ identifier: "MediaCleanupReport" });
|
|
102
|
-
var MediaNotFound = class extends Schema.TaggedError()("Media.NotFound", { mediaId: MediaId }) {};
|
|
103
|
-
var MediaReferenced = class extends Schema.TaggedError()("Media.Referenced", {
|
|
104
|
-
mediaId: MediaId,
|
|
105
|
-
references: Schema.Array(MediaReference)
|
|
106
|
-
}) {};
|
|
107
|
-
var MediaConflict = class extends Schema.TaggedError()("Media.Conflict", { mediaId: MediaId }) {};
|
|
108
|
-
var MediaInvalid = class extends Schema.TaggedError()("Media.Invalid", { message: Schema.NonEmptyString }) {};
|
|
109
|
-
var MediaTooLarge = class extends Schema.TaggedError()("Media.TooLarge", {
|
|
110
|
-
declaredByteSize: MediaByteSize,
|
|
111
|
-
maxUploadBytes: MediaByteSize
|
|
112
|
-
}) {};
|
|
113
|
-
|
|
114
|
-
//#endregion
|
|
115
8
|
//#region ../protocol/src/internal/documents/errors.ts
|
|
116
9
|
var DocumentNotFound = class extends Schema.TaggedError()("Document.NotFound", {
|
|
117
10
|
documentId: DocumentId,
|
|
@@ -130,116 +23,6 @@ var DocumentMediaUnavailable = class extends Schema.TaggedError()("Document.Medi
|
|
|
130
23
|
var DocumentValidationFailed = class extends Schema.TaggedError()("Document.ValidationFailed", { issues: Schema.Array(DocumentIssue) }) {};
|
|
131
24
|
var PublishedDocumentNotFound = class extends Schema.TaggedError()("PublishedDocument.NotFound", { lookup: PublishedDocumentLookup }) {};
|
|
132
25
|
|
|
133
|
-
//#endregion
|
|
134
|
-
//#region ../protocol/src/AccessControl.ts
|
|
135
|
-
/** Wire-visible Studio actors, request identity, roles, access decisions, and denials. */
|
|
136
|
-
const ROLES = [
|
|
137
|
-
"administrator",
|
|
138
|
-
"editor",
|
|
139
|
-
"viewer"
|
|
140
|
-
];
|
|
141
|
-
const Role = Schema.Literals(ROLES);
|
|
142
|
-
const StudioActor = Schema.Struct({
|
|
143
|
-
id: Schema.NonEmptyString,
|
|
144
|
-
email: Schema.NonEmptyString,
|
|
145
|
-
name: Schema.NonEmptyString,
|
|
146
|
-
roles: Schema.Array(Schema.NonEmptyString)
|
|
147
|
-
}).annotate({ identifier: "StudioActor" });
|
|
148
|
-
const StudioRequestContext = Schema.Struct({
|
|
149
|
-
actor: StudioActor,
|
|
150
|
-
requestId: RequestId
|
|
151
|
-
}).annotate({ identifier: "StudioRequestContext" });
|
|
152
|
-
const DOCUMENT_ACTIONS = [
|
|
153
|
-
"document.browse",
|
|
154
|
-
"document.read",
|
|
155
|
-
"document.trash",
|
|
156
|
-
"document.validate",
|
|
157
|
-
"document.create",
|
|
158
|
-
"document.update",
|
|
159
|
-
"document.move",
|
|
160
|
-
"document.remove",
|
|
161
|
-
"document.restore",
|
|
162
|
-
"document.undelete",
|
|
163
|
-
"document.publish",
|
|
164
|
-
"document.history"
|
|
165
|
-
];
|
|
166
|
-
const DocumentAction = Schema.Literals(DOCUMENT_ACTIONS);
|
|
167
|
-
const DocumentCatalogResource = Schema.Struct({ kind: Schema.tag("catalog") });
|
|
168
|
-
const CollectionResource = Schema.Struct({
|
|
169
|
-
kind: Schema.tag("collection"),
|
|
170
|
-
collection: CollectionName,
|
|
171
|
-
locale: Schema.optionalKey(Locale)
|
|
172
|
-
});
|
|
173
|
-
const DocumentResource = Schema.Struct({
|
|
174
|
-
kind: Schema.tag("document"),
|
|
175
|
-
documentId: DocumentId
|
|
176
|
-
});
|
|
177
|
-
const DocumentAccessResource = Schema.Union([
|
|
178
|
-
DocumentCatalogResource,
|
|
179
|
-
CollectionResource,
|
|
180
|
-
DocumentResource
|
|
181
|
-
]).pipe(Schema.toTaggedUnion("kind"));
|
|
182
|
-
const DocumentAccessDecision = Schema.Struct({
|
|
183
|
-
action: DocumentAction,
|
|
184
|
-
resource: DocumentAccessResource
|
|
185
|
-
}).annotate({ identifier: "DocumentAccessDecision" });
|
|
186
|
-
const MEDIA_ACTIONS = [
|
|
187
|
-
"media.read",
|
|
188
|
-
"media.search",
|
|
189
|
-
"media.integrity",
|
|
190
|
-
"media.upload",
|
|
191
|
-
"media.replace",
|
|
192
|
-
"media.remove",
|
|
193
|
-
"media.cleanup"
|
|
194
|
-
];
|
|
195
|
-
const MediaAction = Schema.Literals(MEDIA_ACTIONS);
|
|
196
|
-
const MediaCatalogResource = Schema.Struct({ kind: Schema.tag("media-catalog") });
|
|
197
|
-
const MediaAssetResource = Schema.Struct({
|
|
198
|
-
kind: Schema.tag("media-asset"),
|
|
199
|
-
mediaId: MediaId
|
|
200
|
-
});
|
|
201
|
-
const MediaFolderResource = Schema.Struct({
|
|
202
|
-
kind: Schema.tag("media-folder"),
|
|
203
|
-
folder: MediaFolder
|
|
204
|
-
});
|
|
205
|
-
const MediaResource = Schema.Union([
|
|
206
|
-
MediaCatalogResource,
|
|
207
|
-
MediaAssetResource,
|
|
208
|
-
MediaFolderResource
|
|
209
|
-
]).pipe(Schema.toTaggedUnion("kind"));
|
|
210
|
-
const MediaAccessDecision = Schema.Struct({
|
|
211
|
-
action: MediaAction,
|
|
212
|
-
resource: MediaResource
|
|
213
|
-
}).annotate({ identifier: "MediaAccessDecision" });
|
|
214
|
-
const ActivityResource = Schema.Struct({ kind: Schema.tag("activity") });
|
|
215
|
-
const ActivityAccessDecision = Schema.Struct({
|
|
216
|
-
action: Schema.Literal("activity.read"),
|
|
217
|
-
resource: ActivityResource
|
|
218
|
-
}).annotate({ identifier: "ActivityAccessDecision" });
|
|
219
|
-
const STUDIO_ACTIONS = [
|
|
220
|
-
...DOCUMENT_ACTIONS,
|
|
221
|
-
...MEDIA_ACTIONS,
|
|
222
|
-
"activity.read"
|
|
223
|
-
];
|
|
224
|
-
const StudioAction = Schema.Literals(STUDIO_ACTIONS);
|
|
225
|
-
const StudioResource = Schema.Union([
|
|
226
|
-
DocumentAccessResource,
|
|
227
|
-
MediaResource,
|
|
228
|
-
ActivityResource
|
|
229
|
-
]);
|
|
230
|
-
const StudioAccessDecision = Schema.Union([
|
|
231
|
-
DocumentAccessDecision,
|
|
232
|
-
MediaAccessDecision,
|
|
233
|
-
ActivityAccessDecision
|
|
234
|
-
]);
|
|
235
|
-
var AuthenticationRequired = class extends Schema.TaggedError()("Studio.AuthenticationRequired", {}) {};
|
|
236
|
-
var StudioEntryDenied = class extends Schema.TaggedError()("Studio.EntryDenied", {}) {};
|
|
237
|
-
var AccessDenied = class extends Schema.TaggedError()("Studio.AccessDenied", {
|
|
238
|
-
action: StudioAction,
|
|
239
|
-
actorId: StudioActor.fields.id,
|
|
240
|
-
resource: StudioResource
|
|
241
|
-
}) {};
|
|
242
|
-
|
|
243
26
|
//#endregion
|
|
244
27
|
//#region ../protocol/src/Activity.ts
|
|
245
28
|
/**
|
|
@@ -256,6 +39,7 @@ const ACTIVITY_ACTIONS = [
|
|
|
256
39
|
"document.revision.restored",
|
|
257
40
|
"document.untrashed",
|
|
258
41
|
"document.published",
|
|
42
|
+
"document.unpublished",
|
|
259
43
|
"media.uploaded",
|
|
260
44
|
"media.replaced",
|
|
261
45
|
"media.removed",
|
|
@@ -414,6 +198,7 @@ const CollaborationUser = Schema.Struct({
|
|
|
414
198
|
name: Schema.NonEmptyString
|
|
415
199
|
});
|
|
416
200
|
const CollaborationTicket = Schema.Struct({
|
|
201
|
+
authoringRevision: Schema.NonEmptyString,
|
|
417
202
|
authoredStateVector: StateVector,
|
|
418
203
|
documentName: Schema.NonEmptyString,
|
|
419
204
|
source: DocumentSource,
|
|
@@ -564,8 +349,7 @@ const DeliverySurroundPayload = Schema.Struct({
|
|
|
564
349
|
}).annotate({ identifier: "DeliverySurroundPayload" });
|
|
565
350
|
const InternalError$1 = StudioInternalError.pipe(HttpApiSchema.status(500));
|
|
566
351
|
const PublishedNotFound = PublishedDocumentNotFound.pipe(HttpApiSchema.status(404));
|
|
567
|
-
const
|
|
568
|
-
const PreviewDraftMissing = PreviewDraftNotFound.pipe(HttpApiSchema.status(404));
|
|
352
|
+
const Forbidden$1 = AccessDenied.pipe(HttpApiSchema.status(403));
|
|
569
353
|
const PublishedDeliveryApi = HttpApiGroup.make("delivery").add(HttpApiEndpoint.post("read", "/read", {
|
|
570
354
|
payload: PublishedDocumentLookup,
|
|
571
355
|
success: CompiledDocument,
|
|
@@ -583,19 +367,31 @@ const PublishedDeliveryApi = HttpApiGroup.make("delivery").add(HttpApiEndpoint.p
|
|
|
583
367
|
success: DocumentSurround,
|
|
584
368
|
error: [PublishedNotFound, InternalError$1]
|
|
585
369
|
})).prefix("/delivery");
|
|
586
|
-
const PreviewDeliveryApi = HttpApiGroup.make("previewDelivery").add(HttpApiEndpoint.post("
|
|
587
|
-
payload:
|
|
370
|
+
const PreviewDeliveryApi = HttpApiGroup.make("previewDelivery").add(HttpApiEndpoint.post("read", "/read", {
|
|
371
|
+
payload: PublishedDocumentLookup,
|
|
588
372
|
success: CompiledDocument,
|
|
589
373
|
error: [
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
374
|
+
PublishedNotFound,
|
|
375
|
+
InternalError$1,
|
|
376
|
+
Forbidden$1
|
|
593
377
|
]
|
|
594
|
-
}), HttpApiEndpoint.post("
|
|
595
|
-
payload:
|
|
596
|
-
success:
|
|
597
|
-
error: [
|
|
598
|
-
})
|
|
378
|
+
}), HttpApiEndpoint.post("query", "/query", {
|
|
379
|
+
payload: PublishedDocumentQuery,
|
|
380
|
+
success: PublishedDocumentPage,
|
|
381
|
+
error: [InternalError$1, Forbidden$1]
|
|
382
|
+
}), HttpApiEndpoint.post("navigation", "/navigation", {
|
|
383
|
+
payload: DocumentNavigationQuery,
|
|
384
|
+
success: Schema.Array(DocumentNavigationItem),
|
|
385
|
+
error: [InternalError$1, Forbidden$1]
|
|
386
|
+
}), HttpApiEndpoint.post("surround", "/surround", {
|
|
387
|
+
payload: DeliverySurroundPayload,
|
|
388
|
+
success: DocumentSurround,
|
|
389
|
+
error: [
|
|
390
|
+
PublishedNotFound,
|
|
391
|
+
InternalError$1,
|
|
392
|
+
Forbidden$1
|
|
393
|
+
]
|
|
394
|
+
})).prefix("/preview");
|
|
599
395
|
|
|
600
396
|
//#endregion
|
|
601
397
|
//#region ../protocol/src/StudioHttp.ts
|
|
@@ -607,7 +403,6 @@ const PreviewDeliveryApi = HttpApiGroup.make("previewDelivery").add(HttpApiEndpo
|
|
|
607
403
|
const ApiVersion = Schema.NonEmptyString.pipe(Schema.brand("ApiVersion"));
|
|
608
404
|
const StudioBootstrap = Schema.Struct({
|
|
609
405
|
basePath: PublicPath,
|
|
610
|
-
components: Schema.Array(ComponentDefinition),
|
|
611
406
|
documents: DocumentConfiguration,
|
|
612
407
|
media: MediaConfiguration,
|
|
613
408
|
version: ApiVersion
|
|
@@ -682,7 +477,6 @@ const UserDuplicate = UserAlreadyExists.pipe(HttpApiSchema.status(409));
|
|
|
682
477
|
const MissingUser = UserNotFound.pipe(HttpApiSchema.status(404));
|
|
683
478
|
const UserSelfRemoval = UserSelfRemovalDenied.pipe(HttpApiSchema.status(409));
|
|
684
479
|
const UserSelfRoleChange = UserSelfRoleChangeDenied.pipe(HttpApiSchema.status(409));
|
|
685
|
-
const InvalidPreviewSession = PreviewSessionInvalid.pipe(HttpApiSchema.status(401));
|
|
686
480
|
const StudioDocumentsApi = HttpApiGroup.make("documents").add(HttpApiEndpoint.get("browse", "/", {
|
|
687
481
|
query: DocumentBrowseQuery,
|
|
688
482
|
success: Schema.Array(DocumentSummary),
|
|
@@ -722,6 +516,19 @@ const StudioDocumentsApi = HttpApiGroup.make("documents").add(HttpApiEndpoint.ge
|
|
|
722
516
|
payload: MoveDocumentPayload,
|
|
723
517
|
success: DocumentMutationResult,
|
|
724
518
|
error: MutationErrors
|
|
519
|
+
}), HttpApiEndpoint.post("duplicate", "/:documentId/duplicate", {
|
|
520
|
+
params: { documentId: DocumentId },
|
|
521
|
+
payload: Schema.Struct({
|
|
522
|
+
...MoveDocumentPayload.fields,
|
|
523
|
+
includeChildren: DuplicateDocumentInput.fields.includeChildren
|
|
524
|
+
}),
|
|
525
|
+
success: DocumentMutationResult,
|
|
526
|
+
error: MutationErrors
|
|
527
|
+
}), HttpApiEndpoint.post("unpublish", "/:documentId/unpublish", {
|
|
528
|
+
params: { documentId: DocumentId },
|
|
529
|
+
payload: PublishDocumentPayload,
|
|
530
|
+
success: DocumentMutationResult,
|
|
531
|
+
error: MutationErrors
|
|
725
532
|
}), HttpApiEndpoint.post("publish", "/:documentId/publish", {
|
|
726
533
|
params: { documentId: DocumentId },
|
|
727
534
|
payload: PublishDocumentPayload,
|
|
@@ -817,11 +624,6 @@ const StudioDiagnosticsApi = HttpApiGroup.make("diagnostics").add(HttpApiEndpoin
|
|
|
817
624
|
success: Schema.Array(DocumentIssue),
|
|
818
625
|
error: [Forbidden, InternalError]
|
|
819
626
|
})).middleware(StudioAuthentication);
|
|
820
|
-
const StudioPreviewSessionsApi = HttpApiGroup.make("previewSessions").add(HttpApiEndpoint.post("issue", "/preview/sessions", {
|
|
821
|
-
payload: PreviewSessionRequest,
|
|
822
|
-
success: PreviewSession.pipe(HttpApiSchema.status(201)),
|
|
823
|
-
error: [InvalidPreviewSession, InternalError]
|
|
824
|
-
})).middleware(StudioAuthentication);
|
|
825
627
|
const StudioHistoryApi = HttpApiGroup.make("history").add(HttpApiEndpoint.get("list", "/", {
|
|
826
628
|
query: DocumentHistoryQuery,
|
|
827
629
|
success: DocumentRevisionPage,
|
|
@@ -909,8 +711,8 @@ const StudioCollaborationApi = HttpApiGroup.make("collaboration").add(HttpApiEnd
|
|
|
909
711
|
InternalError
|
|
910
712
|
]
|
|
911
713
|
})).middleware(StudioAuthentication).prefix("/collaboration");
|
|
912
|
-
var StudioApi = class extends HttpApi.make("StudioApi").add(InitializationApi, PublishedDeliveryApi, StudioConfigurationApi, StudioSessionApi, StudioDiagnosticsApi,
|
|
714
|
+
var StudioApi = class extends HttpApi.make("StudioApi").add(InitializationApi, PublishedDeliveryApi, StudioConfigurationApi, StudioSessionApi, StudioDiagnosticsApi, PreviewDeliveryApi.middleware(StudioAuthentication), StudioDocumentsApi, StudioHistoryApi, StudioActivityApi, StudioUserAdministrationApi, StudioMediaApi, StudioCollaborationApi).middleware(StudioSchemaError).prefix(STUDIO_API_PATH) {};
|
|
913
715
|
|
|
914
716
|
//#endregion
|
|
915
|
-
export {
|
|
916
|
-
//# sourceMappingURL=StudioHttp-
|
|
717
|
+
export { ACTIVITY_ACTIONS as A, ActivityTargetKind as B, CollaborationTicket as C, DocumentRevision as D, DocumentHistoryInvalidCursor as E, ActivityEntry as F, DocumentVersionConflict as G, DocumentNotFound as H, ActivityEntryDraft as I, PublishedDocumentNotFound as K, ActivityId as L, ActivityContext as M, ActivityCursor as N, DocumentRevisionComparison as O, ActivityCursorInvalid as P, ActivityPage as R, CollaborationServerMessage as S, DocumentHistoryComparisonTooLarge as T, DocumentPathConflict as U, DocumentMediaUnavailable as V, DocumentValidationFailed as W, UserNotFound as _, StudioBootstrap as a, UserSelfRoleChangeDenied as b, StudioInternalError as c, InitializationProofInvalid as d, InitializationState as f, UserAlreadyExists as g, UserAdministrationDenied as h, StudioBadRequest as i, ActivityAction as j, DocumentRevisionPage as k, studioInternalError as l, User as m, StudioApi as n, StudioRequestConflict as o, CreateUserInput as p, StudioAuthentication as r, StudioSchemaError as s, CurrentStudioRequest as t, InitializationAlreadyCompleted as u, UserPage as v, StateVector as w, CollaborationClientMessage as x, UserSelfRemovalDenied as y, ActivityTarget as z };
|
|
718
|
+
//# sourceMappingURL=StudioHttp-jR2-bc01.js.map
|