@phtngyn/cms 0.1.0-beta.2 → 0.1.0-beta.4
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 +52 -35
- package/bin/cms.mjs +2 -0
- package/package.json +5 -5
- package/src/{Configuration-CA_jvQKG.js → Configuration-CDMYfTre.js} +3 -3
- package/src/{Configuration-CA_jvQKG.js.map → Configuration-CDMYfTre.js.map} +1 -1
- package/src/Configuration.d.ts +60 -2
- package/src/Configuration.js.map +1 -1
- package/src/ContentTransfer-C3Av9sWz.js +53 -0
- package/src/ContentTransfer-C3Av9sWz.js.map +1 -0
- package/src/{DocumentEngine-CgiBQU4g.js → DocumentEngine-J7g-emdf.js} +4 -4
- package/src/{DocumentEngine-CgiBQU4g.js.map → DocumentEngine-J7g-emdf.js.map} +1 -1
- package/src/DocumentModel.d.ts +33 -2
- package/src/{Forms-DxbkU3_5.js → Forms-Dj6NuW66.js} +2 -2
- package/src/{Forms-DxbkU3_5.js.map → Forms-Dj6NuW66.js.map} +1 -1
- package/src/Forms.d.ts +17 -1
- package/src/Forms.js.map +1 -1
- package/src/I18n.d.ts +20 -2
- package/src/Module.js +2 -3
- package/src/Module.js.map +1 -1
- package/src/{S3MediaObjects-JKMAWyVB.js → S3MediaObjects-CpPSzJto.js} +219 -106
- package/src/S3MediaObjects-CpPSzJto.js.map +1 -0
- package/src/cli/content.js +258 -0
- package/src/cli/content.js.map +1 -0
- package/src/cli.js +71 -0
- package/src/cli.js.map +1 -0
- package/src/{connection-B-iz0Y9Y.js → connection-CBAy2qGy.js} +2 -2
- package/src/{connection-B-iz0Y9Y.js.map → connection-CBAy2qGy.js.map} +1 -1
- package/src/{installation-DgF2M1gL.js → installation-CNfIriVm.js} +21 -23
- package/src/installation-CNfIriVm.js.map +1 -0
- package/src/internal/authoring-catalog.js +2 -2
- package/src/internal/authoring-metadata.js +1 -1
- package/src/internal/configuration.js +6 -10
- package/src/internal/configuration.js.map +1 -1
- package/src/internal/document-model.js +7 -4
- package/src/internal/document-model.js.map +1 -1
- package/src/{location-CFKTeK1K.js → location-BTqdfIzX.js} +2 -2
- package/src/{location-CFKTeK1K.js.map → location-BTqdfIzX.js.map} +1 -1
- package/src/{models-BWm1pTAf.js → models-B4IoTmp7.js} +2 -2
- package/src/{models-BWm1pTAf.js.map → models-B4IoTmp7.js.map} +1 -1
- package/src/{models-DwYioyNV.js → models-Bah5B3bT.js} +4 -21
- package/src/models-Bah5B3bT.js.map +1 -0
- package/src/runtime/delivery/context.js +1 -1
- package/src/runtime/delivery/plugin.js +9 -3
- package/src/runtime/delivery/plugin.js.map +1 -1
- package/src/runtime/delivery/useCmsDocumentSeo.d.ts +3 -0
- package/src/runtime/delivery/useCmsDocumentSeo.js +3 -1
- package/src/runtime/delivery/useCmsDocumentSeo.js.map +1 -1
- package/src/runtime/forms/document.js +1 -1
- package/src/runtime/forms/useCmsForm.js +43 -2
- package/src/runtime/forms/useCmsForm.js.map +1 -1
- package/src/runtime/i18n/translator.js +31 -2
- package/src/runtime/i18n/translator.js.map +1 -1
- package/src/runtime/i18n/useCmsI18n.d.ts +3 -1
- package/src/runtime/i18n/useCmsI18n.js +9 -1
- package/src/runtime/i18n/useCmsI18n.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 +2 -2
- package/src/runtime/preview/plugin.client.js +3 -3
- package/src/runtime/preview/store.js +1 -1
- package/src/runtime/sitemap.js +1 -1
- package/src/{store-DjJs3I7k.js → store-b2CSXgMt.js} +3 -3
- package/src/{store-DjJs3I7k.js.map → store-b2CSXgMt.js.map} +1 -1
- package/studio/{CreateDocumentDialog-CTeIFlPb.js → CreateDocumentDialog-GGey1uBc.js} +1 -1
- package/studio/{documentPlanning-Bfv-d7OU.js → documentPlanning-DRErYmBU.js} +1490 -1450
- package/studio/host.js +2 -2
- package/src/Configuration-Br7tE9Qt.d.ts +0 -68
- package/src/DocumentModel-BB9igGC7.d.ts +0 -34
- package/src/I18n-DZK4CkJF.d.ts +0 -21
- package/src/S3MediaObjects-JKMAWyVB.js.map +0 -1
- package/src/Seed.d.ts +0 -6
- package/src/Seed.js +0 -34
- package/src/Seed.js.map +0 -1
- package/src/installation-DgF2M1gL.js.map +0 -1
- package/src/models-DwYioyNV.js.map +0 -1
package/src/Forms.d.ts
CHANGED
|
@@ -5,6 +5,21 @@ interface UseCmsFormOptions {
|
|
|
5
5
|
/** Replace the HTTP transport, retaining validation and submission state. */
|
|
6
6
|
readonly submit?: (submission: FormSubmission, signal: AbortSignal) => Promise<FormResult>;
|
|
7
7
|
}
|
|
8
|
+
interface CmsFormFieldState {
|
|
9
|
+
readonly field: FormField;
|
|
10
|
+
readonly value: FormValues[string];
|
|
11
|
+
readonly error: string | undefined;
|
|
12
|
+
readonly helpId: string;
|
|
13
|
+
readonly errorId: string;
|
|
14
|
+
readonly inputAttrs: {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly required: boolean;
|
|
18
|
+
readonly 'aria-invalid': 'true' | undefined;
|
|
19
|
+
readonly 'aria-describedby': string | undefined;
|
|
20
|
+
};
|
|
21
|
+
readonly setValue: (value: FormValues[string] | undefined) => void;
|
|
22
|
+
}
|
|
8
23
|
interface UseCmsFormReturn {
|
|
9
24
|
readonly fields: ComputedRef<ReadonlyArray<FormField>>;
|
|
10
25
|
readonly steps: ComputedRef<ReadonlyArray<FormStep>>;
|
|
@@ -18,6 +33,7 @@ interface UseCmsFormReturn {
|
|
|
18
33
|
readonly isSuccess: Readonly<Ref<boolean>>;
|
|
19
34
|
readonly isPreview: ComputedRef<boolean>;
|
|
20
35
|
readonly error: Readonly<Ref<string | undefined>>;
|
|
36
|
+
readonly fieldState: (field: FormField) => CmsFormFieldState;
|
|
21
37
|
readonly next: () => boolean;
|
|
22
38
|
readonly previous: () => void;
|
|
23
39
|
readonly validate: () => boolean;
|
|
@@ -31,5 +47,5 @@ export declare function useCmsForm(input: MaybeRefOrGetter<FormDefinition>, opti
|
|
|
31
47
|
/** Register this definition under the kebab-case name of your Vue form renderer. */
|
|
32
48
|
export declare function defineCmsForm<const Definition extends FormCapabilities>(definition: Definition): Definition;
|
|
33
49
|
//#endregion
|
|
34
|
-
export type { FormDefinition as CmsFormDefinition, FormField as CmsFormField, FormResult as CmsFormResult, FormStep as CmsFormStep, FormValues as CmsFormValues, UseCmsFormOptions, UseCmsFormReturn };
|
|
50
|
+
export type { FormDefinition as CmsFormDefinition, FormField as CmsFormField, CmsFormFieldState, FormResult as CmsFormResult, FormStep as CmsFormStep, FormValues as CmsFormValues, UseCmsFormOptions, UseCmsFormReturn };
|
|
35
51
|
//# sourceMappingURL=Forms.d.ts.map
|
package/src/Forms.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Forms.js","names":[],"sources":["../../../src/Forms.ts"],"sourcesContent":["import type { FormCapabilities } from '@internal/protocol/Forms'\nimport { validateFormCapabilities } from './internal/form-capabilities'\n\nexport type {\n FormDefinition as CmsFormDefinition,\n FormField as CmsFormField,\n FormStep as CmsFormStep,\n FormValues as CmsFormValues,\n FormResult as CmsFormResult,\n} from '@internal/protocol/Forms'\n\nexport type { UseCmsFormOptions, UseCmsFormReturn } from './runtime/forms/useCmsForm'\n\nexport { useCmsForm } from './runtime/forms/useCmsForm'\n\n/** Register this definition under the kebab-case name of your Vue form renderer. */\nexport function defineCmsForm<const Definition extends FormCapabilities>(definition: Definition): Definition {\n validateFormCapabilities(definition)\n\n return definition\n}\n"],"mappings":";;;;;AAgBA,SAAgB,cAAyD,YAAoC;CAC3G,yBAAyB,UAAU;CAEnC,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"Forms.js","names":[],"sources":["../../../src/Forms.ts"],"sourcesContent":["import type { FormCapabilities } from '@internal/protocol/Forms'\nimport { validateFormCapabilities } from './internal/form-capabilities'\n\nexport type {\n FormDefinition as CmsFormDefinition,\n FormField as CmsFormField,\n FormStep as CmsFormStep,\n FormValues as CmsFormValues,\n FormResult as CmsFormResult,\n} from '@internal/protocol/Forms'\n\nexport type { CmsFormFieldState, UseCmsFormOptions, UseCmsFormReturn } from './runtime/forms/useCmsForm'\n\nexport { useCmsForm } from './runtime/forms/useCmsForm'\n\n/** Register this definition under the kebab-case name of your Vue form renderer. */\nexport function defineCmsForm<const Definition extends FormCapabilities>(definition: Definition): Definition {\n validateFormCapabilities(definition)\n\n return definition\n}\n"],"mappings":";;;;;AAgBA,SAAgB,cAAyD,YAAoC;CAC3G,yBAAyB,UAAU;CAEnC,OAAO;AACT"}
|
package/src/I18n.d.ts
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
//#region src/I18n.d.ts
|
|
2
|
+
export interface CmsMessages {
|
|
3
|
+
readonly [key: string]: string | CmsMessages;
|
|
4
|
+
}
|
|
5
|
+
export interface CmsI18nOptions {
|
|
6
|
+
readonly defaultLocale: string;
|
|
7
|
+
readonly fallbackLocale?: string | null;
|
|
8
|
+
readonly prefixDefaultLocale?: boolean;
|
|
9
|
+
readonly locales: Readonly<Record<string, {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly messages?: CmsMessages;
|
|
12
|
+
}>>;
|
|
13
|
+
}
|
|
14
|
+
/** Nuxt augments this registry with the message keys from cms.config.ts. */
|
|
15
|
+
export interface CmsI18nRegistry {}
|
|
16
|
+
export type CmsMessageKey = CmsI18nRegistry extends {
|
|
17
|
+
messageKey: infer Key extends string;
|
|
18
|
+
} ? Key : string;
|
|
19
|
+
//#endregion
|
|
20
|
+
//# sourceMappingURL=I18n.d.ts.map
|
package/src/Module.js
CHANGED
|
@@ -31,8 +31,7 @@ const cmsNuxtModule = defineNuxtModule({
|
|
|
31
31
|
const setupModule = Effect.fn("CmsNuxtModule.setup")(function* (nuxt) {
|
|
32
32
|
addVitePlugin(cmsAuthoringPlugin());
|
|
33
33
|
const authored = yield* loadCmsConfiguration(nuxt.options.rootDir);
|
|
34
|
-
const
|
|
35
|
-
const compiled = compileCmsConfiguration(authored.configuration, initialSources);
|
|
34
|
+
const compiled = compileCmsConfiguration(authored.configuration);
|
|
36
35
|
const i18n = compiled.i18n;
|
|
37
36
|
configureSitemap(nuxt.options);
|
|
38
37
|
const i18nTemplate = addTemplate({
|
|
@@ -55,7 +54,7 @@ const setupModule = Effect.fn("CmsNuxtModule.setup")(function* (nuxt) {
|
|
|
55
54
|
`import { createInstallationPlugin } from ${JSON.stringify(resolver.resolve("./runtime/plugin"))}`,
|
|
56
55
|
`import cmsConfiguration from ${JSON.stringify(authored.path)}`,
|
|
57
56
|
`import authoring from ${JSON.stringify(authoring.dst)}`,
|
|
58
|
-
`export default createInstallationPlugin(cmsConfiguration, authoring
|
|
57
|
+
`export default createInstallationPlugin(cmsConfiguration, authoring)`
|
|
59
58
|
].join("\n")
|
|
60
59
|
});
|
|
61
60
|
addServerHandler({
|
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 { 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 addTemplate,\n addTypeTemplate,\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\nconst CMS_SITEMAP_SOURCE_PATH = `${STUDIO_BASE_PATH}/sitemap`\n\ndeclare module '@nuxt/schema' {\n interface NuxtHooks {\n 'nitro:config': (nitroConfig: NitroConfig) => HookResult\n }\n}\n\nconst resolver = createResolver(import.meta.url)\n\nconst nodeLayer = Layer.merge(NodeCrypto.layer, Layer.merge(NodeFileSystem.layer, NodePath.layer))\n\nconst cmsNuxtModule = defineNuxtModule({\n moduleDependencies: {\n '@nuxtjs/robots': {},\n '@nuxtjs/sitemap': {},\n '@comark/nuxt': {},\n 'nuxt-schema-org': {},\n 'nuxt-seo-utils': {},\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 const i18n = compiled.i18n\n\n configureSitemap(nuxt.options)\n\n const i18nTemplate = addTemplate({\n filename: 'cms/i18n.mjs',\n write: true,\n getContents: () => `export default JSON.parse(${JSON.stringify(JSON.stringify(i18n))})`,\n })\n\n nuxt.options.alias['#cms/i18n'] = i18nTemplate.dst\n const messageKeys = [...new Set(Object.values(i18n.locales).flatMap((locale) => Object.keys(locale.messages)))]\n addTypeTemplate({\n filename: 'types/cms-i18n.d.ts',\n getContents: () =>\n `import '@phtngyn/cms/I18n'\\ndeclare module '@phtngyn/cms/I18n' { interface CmsI18nRegistry { messageKey: ${messageKeys.map((key) => JSON.stringify(key)).join(' | ') || 'string'} } }`,\n })\n nuxt.options.watch.push(authored.path)\n\n const authoring = yield* registerAuthoringCatalog(\n nuxt,\n compiled.documents,\n Object.fromEntries(\n Object.entries(authored.configuration.forms ?? {}).map(([name, form]) => [name, form.definition]),\n ),\n )\n\n const installationPluginId = resolver.resolve('./runtime/plugin.virtual.mjs')\n\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\n addServerHandler({ handler: resolver.resolve('./runtime/api'), route: `${STUDIO_HEALTH_PATH}/**:path` })\n addServerHandler({ handler: resolver.resolve('./runtime/sitemap'), route: CMS_SITEMAP_SOURCE_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\ninterface CmsSitemapConfiguration {\n sources?: Array<unknown>\n}\n\ninterface CmsNuxtSitemapOptions {\n readonly modules?: unknown\n sitemap?: false | CmsSitemapConfiguration\n}\n\nfunction configureSitemap(options: CmsNuxtSitemapOptions): void {\n if (options.sitemap === false) return\n\n const sitemap = options.sitemap ?? {}\n const sources = sitemap.sources ?? []\n\n if (!sources.includes(CMS_SITEMAP_SOURCE_PATH)) sitemap.sources = [...sources, CMS_SITEMAP_SOURCE_PATH]\n\n options.sitemap = sitemap\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: 'useCmsI18n', from: resolver.resolve('./runtime/i18n/useCmsI18n') },\n { name: 'useCmsForm', from: resolver.resolve('./runtime/forms/useCmsForm') },\n { name: 'useCmsDocumentSeo', from: resolver.resolve('./runtime/delivery/useCmsDocumentSeo') },\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":";;;;;;;;;;;AAgCA,MAAM,0BAA0B,GAAG,iBAAiB;AAQpD,MAAM,WAAW,eAAe,YAAY,GAAG;AAE/C,MAA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,UAAU;GAAE,YAAY;GAAK,IAAI;EAAgB,EAAE;CAC7F,CAAC;AACH"}
|
|
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 { 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 addTemplate,\n addTypeTemplate,\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\nconst CMS_SITEMAP_SOURCE_PATH = `${STUDIO_BASE_PATH}/sitemap`\n\ndeclare module '@nuxt/schema' {\n interface NuxtHooks {\n 'nitro:config': (nitroConfig: NitroConfig) => HookResult\n }\n}\n\nconst resolver = createResolver(import.meta.url)\n\nconst nodeLayer = Layer.merge(NodeCrypto.layer, Layer.merge(NodeFileSystem.layer, NodePath.layer))\n\nconst cmsNuxtModule = defineNuxtModule({\n moduleDependencies: {\n '@nuxtjs/robots': {},\n '@nuxtjs/sitemap': {},\n '@comark/nuxt': {},\n 'nuxt-schema-org': {},\n 'nuxt-seo-utils': {},\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 compiled = compileCmsConfiguration(authored.configuration)\n const i18n = compiled.i18n\n\n configureSitemap(nuxt.options)\n\n const i18nTemplate = addTemplate({\n filename: 'cms/i18n.mjs',\n write: true,\n getContents: () => `export default JSON.parse(${JSON.stringify(JSON.stringify(i18n))})`,\n })\n\n nuxt.options.alias['#cms/i18n'] = i18nTemplate.dst\n const messageKeys = [...new Set(Object.values(i18n.locales).flatMap((locale) => Object.keys(locale.messages)))]\n addTypeTemplate({\n filename: 'types/cms-i18n.d.ts',\n getContents: () =>\n `import '@phtngyn/cms/I18n'\\ndeclare module '@phtngyn/cms/I18n' { interface CmsI18nRegistry { messageKey: ${messageKeys.map((key) => JSON.stringify(key)).join(' | ') || 'string'} } }`,\n })\n nuxt.options.watch.push(authored.path)\n\n const authoring = yield* registerAuthoringCatalog(\n nuxt,\n compiled.documents,\n Object.fromEntries(\n Object.entries(authored.configuration.forms ?? {}).map(([name, form]) => [name, form.definition]),\n ),\n )\n\n const installationPluginId = resolver.resolve('./runtime/plugin.virtual.mjs')\n\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)`,\n ].join('\\n'),\n })\n\n addServerHandler({ handler: resolver.resolve('./runtime/api'), route: `${STUDIO_HEALTH_PATH}/**:path` })\n addServerHandler({ handler: resolver.resolve('./runtime/sitemap'), route: CMS_SITEMAP_SOURCE_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\ninterface CmsSitemapConfiguration {\n sources?: Array<unknown>\n}\n\ninterface CmsNuxtSitemapOptions {\n readonly modules?: unknown\n sitemap?: false | CmsSitemapConfiguration\n}\n\nfunction configureSitemap(options: CmsNuxtSitemapOptions): void {\n if (options.sitemap === false) return\n\n const sitemap = options.sitemap ?? {}\n const sources = sitemap.sources ?? []\n\n if (!sources.includes(CMS_SITEMAP_SOURCE_PATH)) sitemap.sources = [...sources, CMS_SITEMAP_SOURCE_PATH]\n\n options.sitemap = sitemap\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: 'useCmsI18n', from: resolver.resolve('./runtime/i18n/useCmsI18n') },\n { name: 'useCmsForm', from: resolver.resolve('./runtime/forms/useCmsForm') },\n { name: 'useCmsDocumentSeo', from: resolver.resolve('./runtime/delivery/useCmsDocumentSeo') },\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":";;;;;;;;;;;AAgCA,MAAM,0BAA0B,GAAG,iBAAiB;AAQpD,MAAM,WAAW,eAAe,YAAY,GAAG;AAE/C,MAAM,YAAY,MAAM,MAAM,WAAW,OAAO,MAAM,MAAM,eAAe,OAAO,SAAS,KAAK,CAAC;AAEjG,MAAM,gBAAgB,iBAAiB;CACrC,oBAAoB;EAClB,kBAAkB,CAAC;EACnB,mBAAmB,CAAC;EACpB,gBAAgB,CAAC;EACjB,mBAAmB,CAAC;EACpB,kBAAkB,CAAC;CACrB;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,WAAW,wBAAwB,SAAS,aAAa;CAC/D,MAAM,OAAO,SAAS;CAEtB,iBAAiB,KAAK,OAAO;CAE7B,MAAM,eAAe,YAAY;EAC/B,UAAU;EAC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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,12 +1,13 @@
|
|
|
1
1
|
import { c as RevisionId, d as SourcePath, f as nonNegativeInt, i as DocumentVersion, n as DocumentHistoryCursor, o as PublicPath, r as DocumentId, s as RelativeDocumentPath, t as DocumentGeneration, u as Slug } from "./scalars-B2lgGUnj.js";
|
|
2
2
|
import { i as FormResult, o as FormSubmission } from "./Forms-CfcI3tPU.js";
|
|
3
|
-
import { a as encodeCmsEditorComponentAttributes, d as createCmsComarkRenderData, m as toComarkDocument, p as mutableJsonObject, s as projectCmsEditorComponentAttributes } from "./Forms-
|
|
4
|
-
import { $ as
|
|
3
|
+
import { a as encodeCmsEditorComponentAttributes, d as createCmsComarkRenderData, m as toComarkDocument, p as mutableJsonObject, s as projectCmsEditorComponentAttributes } from "./Forms-Dj6NuW66.js";
|
|
4
|
+
import { $ as StudioActor, B as SeoMediaUnavailable, C as PublishedDocumentLookup, D as RemoveDocumentInput, E as PublishedDocumentSurroundQuery, Et as RequestId, F as SaveSeoInput, G as SeoUrl, I as SeoCanonicalOrigin, J as AccessDenied, K as SeoVersionConflict, L as SeoCapabilities, N as GlobalSeoSettings, O as RestoreDocumentInput, P as PublishSeoInput, Q as Role, R as SeoConfiguration, S as PublishDocumentInput, T as PublishedDocumentQuery, U as SeoSnapshot, V as SeoMutationResult, W as SeoState, X as DOCUMENT_ACTIONS, Y as AuthenticationRequired, Z as MEDIA_ACTIONS, _ as DocumentSurround, _t as MediaReference, at as MediaCleanupReport, bt as MediaTooLarge, c as DocumentIssue, ct as MediaFolder, d as DocumentNavigationQuery, dt as MediaInvalid, et as StudioEntryDenied, f as DocumentQueryScalar, g as DocumentSummary, gt as MediaQuery, ht as MediaPage, i as CreateDocumentInput, it as MediaByteSize, j as UpdateDocumentInput, k as UndeleteDocumentInput, l as DocumentMutationResult, lt as MediaId, m as DocumentSource, mt as MediaObjectKey, n as CmsMarkdownDocument, nt as ImageMimeType, o as DeletedDocument, ot as MediaConflict, p as DocumentRevisionAction, pt as MediaNotFound, q as SitemapEntry, r as CompiledDocument, rt as MediaAsset, s as DocumentBrowseQuery, u as DocumentNavigationItem, ut as MediaIntegrityReport, v as DocumentValidationResult, vt as MediaReferenced, w as PublishedDocumentPage, x as MoveDocumentInput, xt as MediaUpload, y as DuplicateDocumentInput, z as SeoConfirmationRequired } from "./models-Bah5B3bT.js";
|
|
5
5
|
import { u as STUDIO_API_PATH } from "./HttpPaths-c9nLZ9H2.js";
|
|
6
6
|
import { i as withoutEditorMetadata } from "./metadata-BEZPWh-3.js";
|
|
7
|
-
import { d as EditorRenderFailed, i as MediaConfiguration, r as DocumentConfiguration } from "./Configuration-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { d as EditorRenderFailed, i as MediaConfiguration, r as DocumentConfiguration } from "./Configuration-CDMYfTre.js";
|
|
8
|
+
import { i as ContentSnapshot, n as ContentApplyResult, o as ContentTransferConflict, r as ContentPlan, s as ContentTransferInput, t as ContentApplyInput } from "./ContentTransfer-C3Av9sWz.js";
|
|
9
|
+
import { a as normalizeDocumentRelativePath, c as resolveDocumentAddress, i as localizeDocumentPath, n as referenceTarget, o as normalizePublicPath, r as DocumentCompilationFailed, s as parseDocumentAddress, t as createDocumentEngine } from "./DocumentEngine-J7g-emdf.js";
|
|
10
|
+
import { Context, Crypto, Data, DateTime, Effect, Encoding, Layer, Option, Predicate, PubSub, Redacted, Ref, Result, Schedule, Schema, Semaphore, Stream, flow } from "effect";
|
|
10
11
|
import { NodeStream } from "@effect/platform-node-shared";
|
|
11
12
|
import { Multipart } from "effect/unstable/http";
|
|
12
13
|
import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema } from "effect/unstable/httpapi";
|
|
@@ -504,6 +505,7 @@ const MediaConflictResponse = MediaConflict.pipe(HttpApiSchema.status(409));
|
|
|
504
505
|
const InvalidActivityCursor = ActivityCursorInvalid.pipe(HttpApiSchema.status(400));
|
|
505
506
|
const InvalidHistoryCursor = DocumentHistoryInvalidCursor.pipe(HttpApiSchema.status(400));
|
|
506
507
|
const HistoryComparisonTooLarge = DocumentHistoryComparisonTooLarge.pipe(HttpApiSchema.status(422));
|
|
508
|
+
const ContentConflict = ContentTransferConflict.pipe(HttpApiSchema.status(409));
|
|
507
509
|
const AlreadyInitialized = InitializationAlreadyCompleted.pipe(HttpApiSchema.status(409));
|
|
508
510
|
const InitializationProofRejected = InitializationProofInvalid.pipe(HttpApiSchema.status(403));
|
|
509
511
|
const UserAdministrationForbidden = UserAdministrationDenied.pipe(HttpApiSchema.status(403));
|
|
@@ -587,6 +589,27 @@ const StudioDocumentsApi = HttpApiGroup.make("documents").add(HttpApiEndpoint.ge
|
|
|
587
589
|
success: DocumentMutationResult,
|
|
588
590
|
error: MutationErrors
|
|
589
591
|
})).middleware(StudioAuthentication).prefix("/documents");
|
|
592
|
+
const StudioContentApi = HttpApiGroup.make("content").add(HttpApiEndpoint.get("snapshot", "/snapshot", {
|
|
593
|
+
success: ContentSnapshot,
|
|
594
|
+
error: [Forbidden, InternalError]
|
|
595
|
+
}), HttpApiEndpoint.post("plan", "/plan", {
|
|
596
|
+
payload: ContentTransferInput,
|
|
597
|
+
success: ContentPlan,
|
|
598
|
+
error: [
|
|
599
|
+
ContentConflict,
|
|
600
|
+
Forbidden,
|
|
601
|
+
InternalError
|
|
602
|
+
]
|
|
603
|
+
}), HttpApiEndpoint.post("apply", "/apply", {
|
|
604
|
+
payload: ContentApplyInput,
|
|
605
|
+
success: ContentApplyResult,
|
|
606
|
+
error: [
|
|
607
|
+
ContentConflict,
|
|
608
|
+
ValidationFailed,
|
|
609
|
+
Forbidden,
|
|
610
|
+
InternalError
|
|
611
|
+
]
|
|
612
|
+
})).middleware(StudioAuthentication).prefix("/content");
|
|
590
613
|
const StudioMediaApi = HttpApiGroup.make("media").add(HttpApiEndpoint.get("search", "/", {
|
|
591
614
|
query: MediaQuery,
|
|
592
615
|
success: MediaPage,
|
|
@@ -776,7 +799,7 @@ const FormsApi = HttpApiGroup.make("forms").add(HttpApiEndpoint.post("submit", "
|
|
|
776
799
|
payload: FormSubmission,
|
|
777
800
|
success: FormResult
|
|
778
801
|
})).prefix("/forms");
|
|
779
|
-
var StudioApi = class extends HttpApi.make("StudioApi").add(FormsApi, InitializationApi, PublishedDeliveryApi, StudioConfigurationApi, StudioSessionApi, StudioDiagnosticsApi, PreviewDeliveryApi.middleware(StudioAuthentication), StudioDocumentsApi, StudioHistoryApi, StudioActivityApi, StudioSeoApi, StudioUserAdministrationApi, StudioMediaApi, StudioCollaborationApi).middleware(StudioSchemaError).prefix(STUDIO_API_PATH) {};
|
|
802
|
+
var StudioApi = class extends HttpApi.make("StudioApi").add(FormsApi, InitializationApi, PublishedDeliveryApi, StudioConfigurationApi, StudioSessionApi, StudioDiagnosticsApi, PreviewDeliveryApi.middleware(StudioAuthentication), StudioDocumentsApi, StudioContentApi, StudioHistoryApi, StudioActivityApi, StudioSeoApi, StudioUserAdministrationApi, StudioMediaApi, StudioCollaborationApi).middleware(StudioSchemaError).prefix(STUDIO_API_PATH) {};
|
|
780
803
|
|
|
781
804
|
//#endregion
|
|
782
805
|
//#region ../document/src/Seo.ts
|
|
@@ -823,7 +846,7 @@ const VIEWER_ACTIONS = /* @__PURE__ */ new Set([
|
|
|
823
846
|
"media.search",
|
|
824
847
|
"media.integrity"
|
|
825
848
|
]);
|
|
826
|
-
const EDITOR_ACTIONS = /* @__PURE__ */ new Set([...DOCUMENT_ACTIONS, ...MEDIA_ACTIONS.filter((action) => action !== "media.cleanup")]);
|
|
849
|
+
const EDITOR_ACTIONS = /* @__PURE__ */ new Set([...DOCUMENT_ACTIONS.filter((action) => action !== "document.transfer"), ...MEDIA_ACTIONS.filter((action) => action !== "media.cleanup")]);
|
|
827
850
|
var AccessControl = class extends Context.Service()("@internal/server/AccessControl") {};
|
|
828
851
|
const defaultAccessControlLayer = Layer.succeed(AccessControl, AccessControl.of({ require: Effect.fn("AccessControl.require")(function* (context, decision) {
|
|
829
852
|
if (isAllowed(context, decision.action)) return;
|
|
@@ -1517,8 +1540,136 @@ function referenceIdentity(reference) {
|
|
|
1517
1540
|
return `${reference.documentId}:${reference.sourcePath}:${reference.nodePath.join(".")}:${reference.objectKey}`;
|
|
1518
1541
|
}
|
|
1519
1542
|
|
|
1543
|
+
//#endregion
|
|
1544
|
+
//#region ../server/src/internal/documents/content-transfer.ts
|
|
1545
|
+
/** Plan all incoming sources against one document generation, including cross-document references. */
|
|
1546
|
+
const planContentTransfer = Effect.fn("ContentTransfer.plan")(function* (engine, state, input, crypto) {
|
|
1547
|
+
const currentByPath = new Map(state.snapshot.active.map((source) => [source.sourcePath, source]));
|
|
1548
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1549
|
+
const commitPlans = [];
|
|
1550
|
+
const entries = [];
|
|
1551
|
+
const authored = new Map(authoredSources(state.snapshot).map((source) => [source.sourcePath, source]));
|
|
1552
|
+
const published = new Map(publishedSources(state.snapshot).map((source) => [source.sourcePath, source]));
|
|
1553
|
+
const now = yield* DateTime.now;
|
|
1554
|
+
let created = 0;
|
|
1555
|
+
let updated = 0;
|
|
1556
|
+
let publishedCount = 0;
|
|
1557
|
+
let unchanged = 0;
|
|
1558
|
+
for (const source of input.sources) {
|
|
1559
|
+
if (seen.has(source.sourcePath)) return yield* new ContentTransferConflict({ message: `Duplicate source path: ${source.sourcePath}` });
|
|
1560
|
+
seen.add(source.sourcePath);
|
|
1561
|
+
const current = currentByPath.get(source.sourcePath);
|
|
1562
|
+
const shouldPublish = input.publish && source.published;
|
|
1563
|
+
const action = !current ? "create" : current.markdown !== source.markdown ? input.overwrite ? "update" : "conflict" : shouldPublish && current.publishedVersion !== current.version ? "publish" : "unchanged";
|
|
1564
|
+
entries.push({
|
|
1565
|
+
sourcePath: source.sourcePath,
|
|
1566
|
+
action,
|
|
1567
|
+
currentRevisionId: current?.revisionId ?? null
|
|
1568
|
+
});
|
|
1569
|
+
if (action === "create" || action === "update") {
|
|
1570
|
+
const documentId = current?.documentId ?? DocumentId.make(yield* crypto.randomUUIDv4.pipe(Effect.orDie));
|
|
1571
|
+
if (current) {
|
|
1572
|
+
commitPlans.push({
|
|
1573
|
+
action: "document.update",
|
|
1574
|
+
documentId,
|
|
1575
|
+
expectedVersion: current.version,
|
|
1576
|
+
markdown: source.markdown,
|
|
1577
|
+
publish: shouldPublish,
|
|
1578
|
+
publishedVersion: current.publishedVersion,
|
|
1579
|
+
sourcePath: source.sourcePath
|
|
1580
|
+
});
|
|
1581
|
+
updated++;
|
|
1582
|
+
} else {
|
|
1583
|
+
commitPlans.push({
|
|
1584
|
+
action: "document.create",
|
|
1585
|
+
documentId,
|
|
1586
|
+
markdown: source.markdown,
|
|
1587
|
+
publish: shouldPublish,
|
|
1588
|
+
sourcePath: source.sourcePath
|
|
1589
|
+
});
|
|
1590
|
+
created++;
|
|
1591
|
+
}
|
|
1592
|
+
if (shouldPublish) publishedCount++;
|
|
1593
|
+
authored.set(source.sourcePath, {
|
|
1594
|
+
documentId,
|
|
1595
|
+
draft: !shouldPublish,
|
|
1596
|
+
markdown: source.markdown,
|
|
1597
|
+
sourcePath: source.sourcePath
|
|
1598
|
+
});
|
|
1599
|
+
if (shouldPublish) published.set(source.sourcePath, {
|
|
1600
|
+
documentId,
|
|
1601
|
+
draft: false,
|
|
1602
|
+
markdown: source.markdown,
|
|
1603
|
+
publishedAt: now,
|
|
1604
|
+
sourcePath: source.sourcePath
|
|
1605
|
+
});
|
|
1606
|
+
} else if (action === "publish" && current) {
|
|
1607
|
+
commitPlans.push({
|
|
1608
|
+
action: "document.publish",
|
|
1609
|
+
documentId: current.documentId,
|
|
1610
|
+
expectedVersion: current.version,
|
|
1611
|
+
markdown: current.markdown,
|
|
1612
|
+
revisionId: current.revisionId,
|
|
1613
|
+
sourcePath: current.sourcePath
|
|
1614
|
+
});
|
|
1615
|
+
publishedCount++;
|
|
1616
|
+
authored.set(source.sourcePath, {
|
|
1617
|
+
documentId: current.documentId,
|
|
1618
|
+
draft: false,
|
|
1619
|
+
markdown: current.markdown,
|
|
1620
|
+
sourcePath: current.sourcePath
|
|
1621
|
+
});
|
|
1622
|
+
published.set(source.sourcePath, {
|
|
1623
|
+
documentId: current.documentId,
|
|
1624
|
+
draft: false,
|
|
1625
|
+
markdown: current.markdown,
|
|
1626
|
+
publishedAt: now,
|
|
1627
|
+
sourcePath: current.sourcePath
|
|
1628
|
+
});
|
|
1629
|
+
} else if (action === "unchanged") unchanged++;
|
|
1630
|
+
}
|
|
1631
|
+
const firstPath = input.sources[0]?.sourcePath;
|
|
1632
|
+
const authoredValidation = firstPath ? yield* validateDocumentSources(engine, [...authored.values()], firstPath, state.authored) : DocumentValidationResult.make({
|
|
1633
|
+
issues: [],
|
|
1634
|
+
valid: true
|
|
1635
|
+
});
|
|
1636
|
+
const publishedValidation = input.publish && firstPath ? yield* validateDocumentSources(engine, [...published.values()], firstPath, state.published) : DocumentValidationResult.make({
|
|
1637
|
+
issues: [],
|
|
1638
|
+
valid: true
|
|
1639
|
+
});
|
|
1640
|
+
const issues = [...authoredValidation.issues, ...publishedValidation.issues];
|
|
1641
|
+
return {
|
|
1642
|
+
plan: ContentPlan.make({
|
|
1643
|
+
generation: state.snapshot.generation,
|
|
1644
|
+
entries,
|
|
1645
|
+
issues,
|
|
1646
|
+
valid: authoredValidation.valid && !entries.some((entry) => entry.action === "conflict") && !issues.some((issue) => issue.severity === "error")
|
|
1647
|
+
}),
|
|
1648
|
+
authoredSources: [...authored.values()],
|
|
1649
|
+
publishedSources: [...published.values()],
|
|
1650
|
+
commitPlans,
|
|
1651
|
+
counts: {
|
|
1652
|
+
created,
|
|
1653
|
+
updated,
|
|
1654
|
+
published: publishedCount,
|
|
1655
|
+
unchanged
|
|
1656
|
+
}
|
|
1657
|
+
};
|
|
1658
|
+
});
|
|
1659
|
+
|
|
1520
1660
|
//#endregion
|
|
1521
1661
|
//#region ../server/src/internal/documents/document-mutation.ts
|
|
1662
|
+
/** Commit validated sources and their media references through one generation fence. */
|
|
1663
|
+
const commitApprovedDocumentPlans = Effect.fn("Documents.commitApprovedPlans")(function* (input) {
|
|
1664
|
+
const [plan, ...additionalPlans] = input.plans;
|
|
1665
|
+
return yield* input.repository.commit({
|
|
1666
|
+
activity: input.activity,
|
|
1667
|
+
plan,
|
|
1668
|
+
additionalPlans,
|
|
1669
|
+
expectedGeneration: input.current.snapshot.generation,
|
|
1670
|
+
mediaReferences: input.plans.flatMap((candidate) => projectMediaReferences(input.authored, input.published, candidate.documentId))
|
|
1671
|
+
});
|
|
1672
|
+
});
|
|
1522
1673
|
/** Authorize every affected document before the adapter commits the approved plan atomically. */
|
|
1523
1674
|
const commitDocumentMutation = Effect.fn("Documents.commitMutation")(function* (accessControl, dependencies, current, command, activity) {
|
|
1524
1675
|
if (command.action === "document.move" || command.action === "document.remove" || command.action === "document.duplicate") {
|
|
@@ -1575,12 +1726,13 @@ const commitDocumentMutation = Effect.fn("Documents.commitMutation")(function* (
|
|
|
1575
1726
|
kind: "unchanged",
|
|
1576
1727
|
result: prepared.result
|
|
1577
1728
|
};
|
|
1578
|
-
const committed = yield*
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1729
|
+
const committed = yield* commitApprovedDocumentPlans({
|
|
1730
|
+
repository: dependencies.repository,
|
|
1731
|
+
current,
|
|
1732
|
+
plans: [prepared.commitPlan, ...prepared.additionalPlans ?? []],
|
|
1733
|
+
authored: prepared.authored,
|
|
1734
|
+
published: prepared.published,
|
|
1735
|
+
activity
|
|
1584
1736
|
});
|
|
1585
1737
|
const next = makeDocumentState(prepared.authored, prepared.published, committed.snapshot);
|
|
1586
1738
|
const entry = entryById(next, committed.mutation.documentId);
|
|
@@ -1591,89 +1743,6 @@ const commitDocumentMutation = Effect.fn("Documents.commitMutation")(function* (
|
|
|
1591
1743
|
};
|
|
1592
1744
|
});
|
|
1593
1745
|
|
|
1594
|
-
//#endregion
|
|
1595
|
-
//#region ../server/src/internal/documents/document-import.ts
|
|
1596
|
-
const importDocumentSources = Effect.fn("Documents.importSources")(function* (dependencies, input, activity) {
|
|
1597
|
-
const report = {
|
|
1598
|
-
created: 0,
|
|
1599
|
-
preserved: 0,
|
|
1600
|
-
published: 0,
|
|
1601
|
-
unchanged: 0,
|
|
1602
|
-
updated: 0
|
|
1603
|
-
};
|
|
1604
|
-
for (const source of input.sources) {
|
|
1605
|
-
const plan = planDocumentImport(yield* dependencies.current(source.sourcePath), source, input.mode);
|
|
1606
|
-
switch (plan.kind) {
|
|
1607
|
-
case "create": {
|
|
1608
|
-
const created = yield* dependencies.runMutation({
|
|
1609
|
-
action: "document.create",
|
|
1610
|
-
documentId: yield* dependencies.nextDocumentId,
|
|
1611
|
-
markdown: source.markdown,
|
|
1612
|
-
sourcePath: source.sourcePath
|
|
1613
|
-
}, activity, input.reason);
|
|
1614
|
-
report.created += 1;
|
|
1615
|
-
if (plan.publish) {
|
|
1616
|
-
yield* publish(dependencies, created, input, activity);
|
|
1617
|
-
report.published += 1;
|
|
1618
|
-
}
|
|
1619
|
-
break;
|
|
1620
|
-
}
|
|
1621
|
-
case "preserve":
|
|
1622
|
-
case "unchanged":
|
|
1623
|
-
report[plan.kind === "preserve" ? "preserved" : "unchanged"] += 1;
|
|
1624
|
-
break;
|
|
1625
|
-
case "publish":
|
|
1626
|
-
yield* publish(dependencies, plan.current, input, activity);
|
|
1627
|
-
report.published += 1;
|
|
1628
|
-
break;
|
|
1629
|
-
case "update": {
|
|
1630
|
-
const updated = yield* dependencies.runMutation({
|
|
1631
|
-
action: "document.update",
|
|
1632
|
-
input: {
|
|
1633
|
-
documentId: plan.current.documentId,
|
|
1634
|
-
expectedVersion: plan.current.version,
|
|
1635
|
-
markdown: source.markdown,
|
|
1636
|
-
reason: input.reason
|
|
1637
|
-
}
|
|
1638
|
-
}, activity, input.reason);
|
|
1639
|
-
report.updated += 1;
|
|
1640
|
-
if (plan.publish) {
|
|
1641
|
-
yield* publish(dependencies, updated, input, activity);
|
|
1642
|
-
report.published += 1;
|
|
1643
|
-
}
|
|
1644
|
-
break;
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
return DocumentImportReport.make(report);
|
|
1649
|
-
});
|
|
1650
|
-
function planDocumentImport(current, source, mode) {
|
|
1651
|
-
if (!current) return {
|
|
1652
|
-
kind: "create",
|
|
1653
|
-
publish: source.published
|
|
1654
|
-
};
|
|
1655
|
-
if (current.markdown !== source.markdown) return mode === "overwrite" ? {
|
|
1656
|
-
current,
|
|
1657
|
-
kind: "update",
|
|
1658
|
-
publish: source.published
|
|
1659
|
-
} : { kind: "preserve" };
|
|
1660
|
-
if (source.published && current.publishedVersion !== current.version) return {
|
|
1661
|
-
current,
|
|
1662
|
-
kind: "publish"
|
|
1663
|
-
};
|
|
1664
|
-
return { kind: "unchanged" };
|
|
1665
|
-
}
|
|
1666
|
-
function publish(dependencies, source, input, activity) {
|
|
1667
|
-
return dependencies.runMutation({
|
|
1668
|
-
action: "document.publish",
|
|
1669
|
-
input: {
|
|
1670
|
-
documentId: source.documentId,
|
|
1671
|
-
expectedVersion: source.version,
|
|
1672
|
-
reason: input.reason
|
|
1673
|
-
}
|
|
1674
|
-
}, activity, input.reason);
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
1746
|
//#endregion
|
|
1678
1747
|
//#region ../server/src/internal/documents/document-store.ts
|
|
1679
1748
|
var DocumentStore = class extends Context.Service()("@internal/server/DocumentStore") {};
|
|
@@ -2044,14 +2113,6 @@ const makeDocuments = Effect.fn("Documents.make")(function* (configuration, opti
|
|
|
2044
2113
|
sourcePath: plan.sourcePath
|
|
2045
2114
|
}, activity, input.reason);
|
|
2046
2115
|
});
|
|
2047
|
-
const importSources = (input, activity) => importDocumentSources({
|
|
2048
|
-
current: (sourcePath) => semaphore.withPermits(1)(Effect.gen(function* () {
|
|
2049
|
-
yield* refreshUnlocked();
|
|
2050
|
-
return (yield* Ref.get(state)).snapshot.active.find((candidate) => candidate.sourcePath === sourcePath);
|
|
2051
|
-
})),
|
|
2052
|
-
nextDocumentId: crypto.randomUUIDv4.pipe(Effect.orDie, Effect.map((value) => DocumentId.make(value))),
|
|
2053
|
-
runMutation
|
|
2054
|
-
}, input, activity);
|
|
2055
2116
|
const duplicate = Effect.fn("Documents.duplicate")((input, activity) => runMutation({
|
|
2056
2117
|
action: "document.duplicate",
|
|
2057
2118
|
input,
|
|
@@ -2120,7 +2181,60 @@ const makeDocuments = Effect.fn("Documents.make")(function* (configuration, opti
|
|
|
2120
2181
|
action,
|
|
2121
2182
|
resource
|
|
2122
2183
|
}).pipe(Effect.andThen(effect));
|
|
2184
|
+
const requireContentTransfer = (context) => accessControl.require(context, {
|
|
2185
|
+
action: "document.transfer",
|
|
2186
|
+
resource: { kind: "catalog" }
|
|
2187
|
+
});
|
|
2188
|
+
const contentSnapshot = (context) => requireContentTransfer(context).pipe(Effect.andThen(semaphore.withPermits(1)(Effect.gen(function* () {
|
|
2189
|
+
yield* refreshUnlocked();
|
|
2190
|
+
const current = yield* Ref.get(state);
|
|
2191
|
+
return ContentSnapshot.make({
|
|
2192
|
+
version: 1,
|
|
2193
|
+
sources: current.snapshot.active.map((source) => ({
|
|
2194
|
+
sourcePath: source.sourcePath,
|
|
2195
|
+
markdown: source.markdown,
|
|
2196
|
+
published: source.publishedVersion === source.version
|
|
2197
|
+
})).sort((left, right) => left.sourcePath.localeCompare(right.sourcePath))
|
|
2198
|
+
});
|
|
2199
|
+
}))));
|
|
2200
|
+
const contentPlan = (context, input) => requireContentTransfer(context).pipe(Effect.andThen(semaphore.withPermits(1)(Effect.gen(function* () {
|
|
2201
|
+
yield* refreshUnlocked();
|
|
2202
|
+
return (yield* planContentTransfer(engine, yield* Ref.get(state), input, crypto)).plan;
|
|
2203
|
+
}))));
|
|
2204
|
+
const contentApply = (context, input) => requireContentTransfer(context).pipe(Effect.andThen(semaphore.withPermits(1)(Effect.gen(function* () {
|
|
2205
|
+
yield* refreshUnlocked();
|
|
2206
|
+
const current = yield* Ref.get(state);
|
|
2207
|
+
if (current.snapshot.generation !== input.expectedGeneration) return yield* new ContentTransferConflict({ message: "Content changed since the plan. Run content plan again." });
|
|
2208
|
+
const planned = yield* planContentTransfer(engine, current, input, crypto);
|
|
2209
|
+
if (planned.plan.entries.some((entry) => entry.action === "conflict")) return yield* new ContentTransferConflict({ message: "Destination content differs. Use --overwrite after reviewing the plan." });
|
|
2210
|
+
if (!planned.plan.valid) return yield* new DocumentValidationFailed({ issues: planned.plan.issues });
|
|
2211
|
+
if (planned.commitPlans.length === 0) return ContentApplyResult.make({
|
|
2212
|
+
...planned.counts,
|
|
2213
|
+
generation: current.snapshot.generation
|
|
2214
|
+
});
|
|
2215
|
+
const authored = yield* compileValidCatalog(engine, planned.authoredSources, current.authored);
|
|
2216
|
+
const publishedCatalog = yield* compileValidCatalog(engine, planned.publishedSources, current.published);
|
|
2217
|
+
const [first, ...additionalPlans] = planned.commitPlans;
|
|
2218
|
+
if (!first) throw new Error("Content import requires a commit plan.");
|
|
2219
|
+
const committed = yield* commitApprovedDocumentPlans({
|
|
2220
|
+
repository,
|
|
2221
|
+
current,
|
|
2222
|
+
plans: [first, ...additionalPlans],
|
|
2223
|
+
authored,
|
|
2224
|
+
published: publishedCatalog,
|
|
2225
|
+
activity: requestActivity$1(context, "CMS content import")
|
|
2226
|
+
}).pipe(Effect.mapError((error) => isDocumentGenerationConflict(error) ? new ContentTransferConflict({ message: "Content changed since the plan. Run content plan again." }) : error));
|
|
2227
|
+
yield* Ref.set(state, yield* compileDocumentState(engine, committed.snapshot, current));
|
|
2228
|
+
yield* PubSub.publish(mutationEvents, committed.mutation);
|
|
2229
|
+
return ContentApplyResult.make({
|
|
2230
|
+
...planned.counts,
|
|
2231
|
+
generation: committed.snapshot.generation
|
|
2232
|
+
});
|
|
2233
|
+
}))));
|
|
2123
2234
|
const documents = Documents.of({
|
|
2235
|
+
contentSnapshot,
|
|
2236
|
+
contentPlan,
|
|
2237
|
+
contentApply,
|
|
2124
2238
|
browse: (context, query) => requireThen(context, "document.browse", query.collection ? {
|
|
2125
2239
|
collection: query.collection,
|
|
2126
2240
|
kind: "collection",
|
|
@@ -2167,7 +2281,6 @@ const makeDocuments = Effect.fn("Documents.make")(function* (configuration, opti
|
|
|
2167
2281
|
return {
|
|
2168
2282
|
documents,
|
|
2169
2283
|
maintenance: DocumentMaintenance.of({
|
|
2170
|
-
importSources,
|
|
2171
2284
|
mediaReferences: (documentId) => semaphore.withPermits(1)(Effect.gen(function* () {
|
|
2172
2285
|
yield* refreshUnlocked();
|
|
2173
2286
|
const current = yield* Ref.get(state);
|
|
@@ -2661,4 +2774,4 @@ const maxS3SingleCopyBytes = 5e9;
|
|
|
2661
2774
|
|
|
2662
2775
|
//#endregion
|
|
2663
2776
|
export { DocumentRevision as $, StudioBadRequest as A, User as B, DocumentStore as C, CurrentStudioRequest as D, defaultAccessControlLayer as E, studioInternalError as F, UserSelfRemovalDenied as G, UserAlreadyExists as H, InitializationAlreadyCompleted as I, CollaborationServerMessage as J, UserSelfRoleChangeDenied as K, InitializationProofInvalid as L, StudioRequestConflict as M, StudioSchemaError as N, StudioApi as O, StudioInternalError as P, DocumentHistoryInvalidCursor as Q, InitializationState as R, DocumentPersistenceError as S, AccessControl as T, UserNotFound as U, UserAdministrationDenied as V, UserPage as W, StateVector as X, CollaborationTicket as Y, DocumentHistoryComparisonTooLarge as Z, Documents as _, mediaObjectPrefix as a, ActivityEntry as at, cursorCodec as b, Seo as c, ActivityPage as ct, seoDeliveryLayer as d, DocumentMediaUnavailable as dt, ACTIVITY_ACTIONS as et, seoLayer as f, DocumentNotFound as ft, DocumentPreviews as g, PublishedDocumentNotFound as gt, DocumentMaintenance as h, DocumentVersionConflict as ht, MediaObjectStore as i, ActivityCursorInvalid as it, StudioBootstrap as j, StudioAuthentication as k, SeoDelivery as l, ActivityTarget as lt, SeoStore as m, DocumentValidationFailed as mt, s3MediaObjectStoreLayer as n, ActivityContext as nt, PreviewSeo as o, ActivityEntryDraft as ot, SeoPersistenceError as p, DocumentPathConflict as pt, CollaborationClientMessage as q, MediaPersistenceError as r, ActivityCursor as rt, PublishedSeo as s, ActivityId as st, maxS3SingleCopyBytes as t, ActivityAction as tt, makeDefaultSeoOptions as u, ActivityTargetKind as ut, PublishedDocuments as v, renderEditorMarkdown as w, DocumentGenerationConflict as x, documentsLayer as y, CreateUserInput as z };
|
|
2664
|
-
//# sourceMappingURL=S3MediaObjects-
|
|
2777
|
+
//# sourceMappingURL=S3MediaObjects-CpPSzJto.js.map
|